From beb9c86749aa756abb0b16c5f29312d46bccd9af Mon Sep 17 00:00:00 2001 From: lcjh <120989324@qq.com> Date: Tue, 29 Apr 2025 02:27:25 +0800 Subject: [PATCH 1/4] Code Review: SuspiciousPriority (#2854) Priority of the '&&' operation is higher than that of the '||' operation.It's possible that parentheses should be used in the expression. --- src/common/memory_patcher.cpp | 3 ++- src/qt_gui/cheats_patches.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/memory_patcher.cpp b/src/common/memory_patcher.cpp index 2a8b26acb..bb2d23c45 100644 --- a/src/common/memory_patcher.cpp +++ b/src/common/memory_patcher.cpp @@ -169,7 +169,8 @@ void OnGameLoaded() { if (type == "mask_jump32") patchMask = MemoryPatcher::PatchMask::Mask_Jump32; - if (type == "mask" || type == "mask_jump32" && !maskOffsetStr.empty()) { + if ((type == "mask" || type == "mask_jump32") && + !maskOffsetStr.empty()) { maskOffsetValue = std::stoi(maskOffsetStr, 0, 10); } diff --git a/src/qt_gui/cheats_patches.cpp b/src/qt_gui/cheats_patches.cpp index 7239affd5..67f616f87 100644 --- a/src/qt_gui/cheats_patches.cpp +++ b/src/qt_gui/cheats_patches.cpp @@ -1387,7 +1387,7 @@ void CheatsPatches::applyPatch(const QString& patchName, bool enabled) { if (type == "mask_jump32") patchMask = MemoryPatcher::PatchMask::Mask_Jump32; - if (type == "mask" || type == "mask_jump32" && !maskOffsetStr.toStdString().empty()) { + if ((type == "mask" || type == "mask_jump32") && !maskOffsetStr.toStdString().empty()) { maskOffsetValue = std::stoi(maskOffsetStr.toStdString(), 0, 10); } From 5e3157a82c4b3c2fccb4a83ecb491925369b0083 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Tue, 29 Apr 2025 16:29:35 -0700 Subject: [PATCH 2/4] vk_rasterizer: Fix updating wrong color attachment when skipped by mask. (#2859) --- src/video_core/renderer_vulkan/vk_rasterizer.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index b04b4a07e..4caa781b9 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -696,14 +696,19 @@ void Rasterizer::BindTextures(const Shader::Info& stage, Shader::Backend::Bindin void Rasterizer::BeginRendering(const GraphicsPipeline& pipeline, RenderState& state) { int cb_index = 0; - for (auto& [image_id, desc] : cb_descs) { + for (auto attach_idx = 0u; attach_idx < state.num_color_attachments; ++attach_idx) { + if (state.color_attachments[attach_idx].imageView == VK_NULL_HANDLE) { + continue; + } + + auto& [image_id, desc] = cb_descs[cb_index++]; if (auto& old_img = texture_cache.GetImage(image_id); old_img.binding.needs_rebind) { auto& view = texture_cache.FindRenderTarget(desc); ASSERT(view.image_id != image_id); image_id = bound_images.emplace_back(view.image_id); auto& image = texture_cache.GetImage(view.image_id); - state.color_attachments[cb_index].imageView = *view.image_view; - state.color_attachments[cb_index].imageLayout = image.last_state.layout; + state.color_attachments[attach_idx].imageView = *view.image_view; + state.color_attachments[attach_idx].imageLayout = image.last_state.layout; const auto mip = view.info.range.base.level; state.width = std::min(state.width, std::max(image.info.size.width >> mip, 1u)); @@ -722,8 +727,7 @@ void Rasterizer::BeginRendering(const GraphicsPipeline& pipeline, RenderState& s desc.view_info.range); } image.usage.render_target = 1u; - state.color_attachments[cb_index].imageLayout = image.last_state.layout; - ++cb_index; + state.color_attachments[attach_idx].imageLayout = image.last_state.layout; } if (db_desc) { From fa9f58446f85d478689c6048eac0c65ef87635be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20Miko=C5=82ajczyk?= Date: Wed, 30 Apr 2025 11:09:40 +0200 Subject: [PATCH 3/4] Implement sceKernelPwritev (#2865) --- src/core/devices/base_device.h | 4 ++++ src/core/libraries/kernel/file_system.cpp | 27 ++++++++++++++++++++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/src/core/devices/base_device.h b/src/core/devices/base_device.h index 36614b8f4..0cbbd3a00 100644 --- a/src/core/devices/base_device.h +++ b/src/core/devices/base_device.h @@ -40,6 +40,10 @@ public: return ORBIS_KERNEL_ERROR_EBADF; } + virtual size_t pwritev(const Libraries::Kernel::SceKernelIovec* iov, int iovcnt, u64 offset) { + return ORBIS_KERNEL_ERROR_EBADF; + } + virtual s64 lseek(s64 offset, int whence) { return ORBIS_KERNEL_ERROR_EBADF; } diff --git a/src/core/libraries/kernel/file_system.cpp b/src/core/libraries/kernel/file_system.cpp index bc34dff98..bcfa15a62 100644 --- a/src/core/libraries/kernel/file_system.cpp +++ b/src/core/libraries/kernel/file_system.cpp @@ -877,7 +877,7 @@ s32 PS4_SYSV_ABI sceKernelGetdirentries(s32 fd, char* buf, s32 nbytes, s64* base return result; } -s64 PS4_SYSV_ABI posix_pwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { +s64 PS4_SYSV_ABI posix_pwritev(s32 fd, const SceKernelIovec* iov, s32 iovcnt, s64 offset) { if (offset < 0) { *__Error() = POSIX_EINVAL; return -1; @@ -893,7 +893,7 @@ s64 PS4_SYSV_ABI posix_pwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { std::scoped_lock lk{file->m_mutex}; if (file->type == Core::FileSys::FileType::Device) { - s64 result = file->device->pwrite(buf, nbytes, offset); + s64 result = file->device->pwritev(iov, iovcnt, offset); if (result < 0) { ErrSceToPosix(result); return -1; @@ -908,7 +908,16 @@ s64 PS4_SYSV_ABI posix_pwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { *__Error() = POSIX_EIO; return -1; } - return file->f.WriteRaw(buf, nbytes); + size_t total_written = 0; + for (int i = 0; i < iovcnt; i++) { + total_written += file->f.WriteRaw(iov[i].iov_base, iov[i].iov_len); + } + return total_written; +} + +s64 PS4_SYSV_ABI posix_pwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { + SceKernelIovec iovec{buf, nbytes}; + return posix_pwritev(fd, &iovec, 1, offset); } s64 PS4_SYSV_ABI sceKernelPwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { @@ -920,6 +929,15 @@ s64 PS4_SYSV_ABI sceKernelPwrite(s32 fd, void* buf, size_t nbytes, s64 offset) { return result; } +s64 PS4_SYSV_ABI sceKernelPwritev(s32 fd, const SceKernelIovec* iov, s32 iovcnt, s64 offset) { + s64 result = posix_pwritev(fd, iov, iovcnt, offset); + if (result < 0) { + LOG_ERROR(Kernel_Fs, "error = {}", *__Error()); + return ErrnoToSceKernelError(*__Error()); + } + return result; +} + s32 PS4_SYSV_ABI posix_unlink(const char* path) { if (path == nullptr) { *__Error() = POSIX_EINVAL; @@ -1017,7 +1035,10 @@ void RegisterFileSystem(Core::Loader::SymbolsResolver* sym) { LIB_FUNCTION("sfKygSjIbI8", "libkernel", 1, "libkernel", 1, 1, getdirentries); LIB_FUNCTION("taRWhTJFTgE", "libkernel", 1, "libkernel", 1, 1, sceKernelGetdirentries); LIB_FUNCTION("C2kJ-byS5rM", "libkernel", 1, "libkernel", 1, 1, posix_pwrite); + LIB_FUNCTION("FCcmRZhWtOk", "libScePosix", 1, "libkernel", 1, 1, posix_pwritev); + LIB_FUNCTION("FCcmRZhWtOk", "libkernel", 1, "libkernel", 1, 1, posix_pwritev); LIB_FUNCTION("nKWi-N2HBV4", "libkernel", 1, "libkernel", 1, 1, sceKernelPwrite); + LIB_FUNCTION("mBd4AfLP+u8", "libkernel", 1, "libkernel", 1, 1, sceKernelPwritev); LIB_FUNCTION("AUXVxWeJU-A", "libkernel", 1, "libkernel", 1, 1, sceKernelUnlink); } From 53b2ccffcad112e234a46d9d2a7433127c95ccee Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Wed, 30 Apr 2025 12:41:30 +0300 Subject: [PATCH 4/4] New Crowdin updates (#2846) * New translations en_us.ts (Vietnamese) * New translations en_us.ts (Vietnamese) * New translations en_us.ts (Vietnamese) * New translations en_us.ts (Vietnamese) --- src/qt_gui/translations/vi_VN.ts | 70 ++++++++++++++++---------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/qt_gui/translations/vi_VN.ts b/src/qt_gui/translations/vi_VN.ts index e0bc7e4fe..c657888bf 100644 --- a/src/qt_gui/translations/vi_VN.ts +++ b/src/qt_gui/translations/vi_VN.ts @@ -384,23 +384,23 @@ Nothing - Không có gì + Không chạy được Boots - Giày ủng + Chạy được Menus - Menu + Vào được menu Ingame - Trong game + Vào được trò chơi Playable - Có thể chơi + Chơi được @@ -411,7 +411,7 @@ D-Pad - D-Pad + D-Pad Up @@ -447,7 +447,7 @@ Common Config - Common Config + Cài Đặt Chung Use per-game configs @@ -551,26 +551,26 @@ Save - Save + Lưu Apply - Apply + Áp dụng Restore Defaults - Restore Defaults + Khôi Phục Mặc Định Cancel - Cancel + Hủy EditorDialog Edit Keyboard + Mouse and Controller input bindings - Edit Keyboard + Mouse and Controller input bindings + Tùy chỉnh phím được gán cho Bàn phím + Chuột và Tay cầm Use Per-Game configs @@ -578,7 +578,7 @@ Error - Error + Lỗi Could not open the file for reading @@ -590,15 +590,15 @@ Save Changes - Save Changes + Lưu Thay Đổi Do you want to save changes? - Do you want to save changes? + Bạn có muốn lưu thay đổi? Help - Help + Trợ giúp Do you want to reset your custom default config to the original default config? @@ -706,15 +706,15 @@ h - h + giờ m - m + phút s - s + giây Compatibility is untested @@ -722,23 +722,23 @@ Game does not initialize properly / crashes the emulator - Game does not initialize properly / crashes the emulator + Trò chơi không được khởi chạy đúng cách / khiến giả lập bị văng Game boots, but only displays a blank screen - Game boots, but only displays a blank screen + Trò chơi có thể khởi chạy, nhưng chẳng hiện gì cả Game displays an image but does not go past the menu - Game displays an image but does not go past the menu + Trò chơi hiển thị được hình ảnh, nhưng không thể tiếp tục từ menu Game has game-breaking glitches or unplayable performance - Game has game-breaking glitches or unplayable performance + Trò chơi có lỗi ảnh hưởng đến trải nghiệm, hoặc hiệu năng khi chơi không ổn định Game can be completed with playable performance and no major glitches - Game can be completed with playable performance and no major glitches + Trò chơi có thể được hoàn thành từ đầu đến cuối, hiệu năng ổn định và không có lỗi ảnh hưởng đến trải nghiệm Click to see details on github @@ -1170,19 +1170,19 @@ Save - Save + Lưu Apply - Apply + Áp dụng Restore Defaults - Restore Defaults + Khôi Phục Mặc Định Cancel - Cancel + Hủy @@ -1193,7 +1193,7 @@ Boot Game - Boot Game + Khởi Chạy Trò Chơi Check for Updates @@ -1201,7 +1201,7 @@ About shadPS4 - About shadPS4 + Thông Tin Về shadPS4 Configure... @@ -1213,23 +1213,23 @@ Open shadPS4 Folder - Open shadPS4 Folder + Mở Thư Mục Của shadPS4 Exit - Exit + Thoát Exit shadPS4 - Exit shadPS4 + Thoát shadPS4 Exit the application. - Exit the application. + Thoát ứng dụng. Show Game List - Show Game List + Hiển Thị Danh Sách Trò Chơi Game List Refresh