Cheats/Patches (#493)

* Cheats/Patches

Adds the possibility of applying cheats/patches according to the specific game serial+version

The logic for adding modifications has not yet been implemented!

Interface based on issues/372 https://github.com/shadps4-emu/shadPS4/issues/372

[X]Front-end
[]Back-end

Create a synchronized fork of the cheats/patches repository

* Clang Format

* separate files

The code has been separated into separate files as suggested by georgemoralis.
Added the Patch tab, which has not been implemented yet.
Added the 'applyCheat' area to apply the modification, not implemented yet...
And added LOG_INFO.

* reuse

* initial implementation of cheat functionality

* Update cheats_patches.cpp

sets all added buttons to the size of the largest button.
and fixes some aesthetic issues.

* move eboot_address to module.h

fixes the non-qt builds and makes more sense to be there anyway

* Patchs menu and fixes

adds the possibility to download Patches, it does not modify the memory yet.
and some other fixes

* MemoryPatcher namespace, activate cheats on start

* format

* initial patch implementation

* format

* format again...

* convertValueToHex

* Fixes

Choosing which cheat file to use.
And some other fixes

* fix bytes16, bytes32, bytes64 type patches

If a patch is any of these types we convert it from little endian to big endian

* format

* format again :(

* Implement pattern scanning for mask type patches

* add check to stop patches applying to wrong game

previously if you added a patch to a game, but closed the window and opened a different game it would still try to apply the patch, this is now fixed

* format

* Fix 'Hint' 0x400000 |  and Author

* Management |save checkbox | shadps4 repository

MENU - Cheats/Patches Management (implementing Patches)
save patches checkbox
add shadps4 repository

* Load saved patches, miscellaneous fixes

* Fix an issue with mask patches not being saved

* format + remove debug log

* multiple patches | TR translation for cheats/patches

* clang

* ENABLE_QT_GUI

* OK

* move memory_patcher to qt_gui

* clang

* add cheats hu_HU

* fix log

* Remove the item from the patchesListView if no patches were added (the game has patches, but not for the current version)

---------

Co-authored-by: CrazyBloo <CrazyBloo@users.noreply.github.com>
This commit is contained in:
DanielSvoboda
2024-08-29 01:18:50 -03:00
committed by GitHub
parent a6a9fff666
commit 614a23b369
35 changed files with 12003 additions and 798 deletions

View File

@@ -81,67 +81,72 @@
<context>
<name>GuiContextMenus</name>
<message>
<location filename="../gui_context_menus.h" line="39"/>
<location filename="../gui_context_menus.h" line="46"/>
<source>Create Shortcut</source>
<translation>Create Shortcut</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="40"/>
<location filename="../gui_context_menus.h" line="47"/>
<source>Open Game Folder</source>
<translation>Open Game Folder</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="41"/>
<location filename="../gui_context_menus.h" line="48"/>
<source>Cheats / Patches</source>
<translation>Mẹo / Bản </translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="49"/>
<source>SFO Viewer</source>
<translation>SFO Viewer</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="42"/>
<location filename="../gui_context_menus.h" line="50"/>
<source>Trophy Viewer</source>
<translation>Trophy Viewer</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="50"/>
<location filename="../gui_context_menus.h" line="59"/>
<source>Copy info</source>
<translation>Copy info</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="51"/>
<location filename="../gui_context_menus.h" line="60"/>
<source>Copy Name</source>
<translation>Copy Name</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="52"/>
<location filename="../gui_context_menus.h" line="61"/>
<source>Copy Serial</source>
<translation>Copy Serial</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="53"/>
<location filename="../gui_context_menus.h" line="62"/>
<source>Copy All</source>
<translation>Copy All</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="173"/>
<location filename="../gui_context_menus.h" line="195"/>
<source>Shortcut creation</source>
<translation>Shortcut creation</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="174"/>
<location filename="../gui_context_menus.h" line="196"/>
<source>Shortcut created successfully!\n %1</source>
<translation>Shortcut created successfully!\n %1</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="177"/>
<location filename="../gui_context_menus.h" line="199"/>
<source>Error</source>
<translation>Error</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="178"/>
<location filename="../gui_context_menus.h" line="200"/>
<source>Error creating shortcut!\n %1</source>
<translation>Error creating shortcut!\n %1</translation>
</message>
<message>
<location filename="../gui_context_menus.h" line="253"/>
<location filename="../gui_context_menus.h" line="275"/>
<source>Install PKG</source>
<translation>Install PKG</translation>
</message>
@@ -248,6 +253,11 @@
<source>Game Install Directory</source>
<translation>Game Install Directory</translation>
</message>
<message>
<location filename="../main_window_ui.h" line="343"/>
<source>Download Cheats/Patches</source>
<translation>Tải Mẹo / Bản </translation>
</message>
<message>
<location filename="../main_window_ui.h" line="345"/>
<source>Dump Game List</source>
@@ -488,4 +498,395 @@
<translation>Enable RenderDoc Debugging</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../main_window.cpp" line="168"/>
<source> * Unsupported Vulkan Version</source>
<translation> * Phiên bản Vulkan không đưc hỗ trợ</translation>
</message>
<message>
<location filename="../main_window.cpp" line="326"/>
<source>Download Cheats For All Installed Games</source>
<translation>Tải xuống cheat cho tất cả các trò chơi đã cài đt</translation>
</message>
<message>
<location filename="../main_window.cpp" line="328"/>
<source>Download Patches For All Games</source>
<translation>Tải xuống bản cho tất cả các trò chơi</translation>
</message>
<message>
<location filename="../main_window.cpp" line="363"/>
<source>Download Complete</source>
<translation>Tải xuống hoàn tất</translation>
</message>
<message>
<location filename="../main_window.cpp" line="364"/>
<source>You have downloaded cheats for all the games you have installed.</source>
<translation>Bạn đã tải xuống cheat cho tất cả các trò chơi bạn đã cài đt.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="391"/>
<source>Patches Downloaded Successfully!</source>
<translation>Bản đã tải xuống thành công!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="392"/>
<source>All Patches available for all games have been downloaded.</source>
<translation>Tất cả các bản sẵn cho tất cả các trò chơi đã đưc tải xuống.</translation>
</message>
<message>
<location filename="../main_window.cpp" line="549"/>
<source>Games: </source>
<translation>Trò chơi: </translation>
</message>
<message>
<location filename="../main_window.cpp" line="575"/>
<source>PKG File (*.PKG)</source>
<translation>Tệp PKG (*.PKG)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="594"/>
<source>ELF files (*.bin *.elf *.oelf)</source>
<translation>Tệp ELF (*.bin *.elf *.oelf)</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Game Boot</source>
<translation>Khởi đng trò chơi</translation>
</message>
<message>
<location filename="../main_window.cpp" line="600"/>
<source>Only one file can be selected!</source>
<translation>Chỉ thể chọn một tệp duy nhất!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="623"/>
<source>PKG Extraction</source>
<translation>Giải nén PKG</translation>
</message>
<message>
<location filename="../main_window.cpp" line="633"/>
<source>Patch detected!\nPKG and Game versions match!: %1\nWould you like </source>
<translation>Đã phát hiện bản !\nPhiên bản PKG trò chơi khớp!: %1\nBạn muốn </translation>
</message>
<message>
<location filename="../main_window.cpp" line="634"/>
<source>to overwrite?</source>
<translation>ghi đè không?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="639"/>
<source>Patch detected!\nPKG Version %1 is older </source>
<translation>Đã phát hiện bản !\nPhiên bản PKG %1 hơn </translation>
</message>
<message>
<location filename="../main_window.cpp" line="640"/>
<source>than installed version!: %2\nWould you like </source>
<translation>so với phiên bản đã cài đt!: %2\nBạn muốn </translation>
</message>
<message>
<location filename="../main_window.cpp" line="641"/>
<source>to overwrite?</source>
<translation>ghi đè không?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="646"/>
<source>Patch detected!\nGame is installed: %1\nWould you like </source>
<translation>Đã phát hiện bản !\nTrò chơi đã đưc cài đt: %1\nBạn muốn </translation>
</message>
<message>
<location filename="../main_window.cpp" line="647"/>
<source>to install Patch: %2?</source>
<translation>cài đt bản : %2?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="659"/>
<source>Game already installed\n%1\nWould you like to overwrite?</source>
<translation>Trò chơi đã đưc cài đt\n%1\nBạn muốn ghi đè không?</translation>
</message>
<message>
<location filename="../main_window.cpp" line="674"/>
<source>PKG is a patch, please install the game first!</source>
<translation>PKG bản , vui lòng cài đt trò chơi trước!</translation>
</message>
<message>
<location filename="../main_window.cpp" line="681"/>
<source>PKG ERROR</source>
<translation>LOI PKG</translation>
</message>
<message>
<location filename="../main_window.cpp" line="693"/>
<source>Extracting PKG %1/%2</source>
<translation>Đang giải nén PKG %1/%2</translation>
</message>
<message>
<location filename="../main_window.cpp" line="703"/>
<source>Extraction Finished</source>
<translation>Giải nén hoàn tất</translation>
</message>
<message>
<location filename="../main_window.cpp" line="704"/>
<source>Game successfully installed at %1</source>
<translation>Trò chơi đã đưc cài đt thành công tại %1</translation>
</message>
<message>
<location filename="../main_window.cpp" line="725"/>
<source>File doesn't appear to be a valid PKG file</source>
<translation>Tệp không có vẻ là tệp PKG hợp lệ</translation>
</message>
</context>
<context>
<name>CheatsPatches</name>
<message>
<location filename="../cheats_patches.cpp" line="44"/>
<source>Cheats / Patches</source>
<translation>Cheat / Bản vá</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="50"/>
<source>defaultTextEdit_MSG</source>
<translation>Cheats/Patches là các tính năng thử nghiệm.\nHãy sử dụng cẩn thận.\n\nTải xuống các cheat riêng lẻ bằng cách chọn kho lưu trữ và nhấp vào nút tải xuống.\nTại tab Patches, bạn có thể tải xuống tất cả các patch cùng một lúc, chọn cái nào bạn muốn sử dụng và lưu lựa chọn của mình.\n\nVì chúng tôi không phát triển Cheats/Patches,\nxin vui lòng báo cáo các vấn đề cho tác giả cheat.\n\nBạn đã tạo ra một cheat mới? Truy cập:\nhttps://github.com/shadps4-emu/ps4_cheats</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="69"/>
<source>No Image Available</source>
<translation>Không có hình ảnh</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="79"/>
<source>Serial: </source>
<translation>Số seri: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="83"/>
<source>Version: </source>
<translation>Phiên bản: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="87"/>
<source>Size: </source>
<translation>Kích thước: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="126"/>
<source>Select Cheat File:</source>
<translation>Chọn tệp Cheat:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="133"/>
<source>Repository:</source>
<translation>Kho lưu trữ:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="149"/>
<source>Download Cheats</source>
<translation>Tải xuống Cheat</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="155"/>
<source>Delete File</source>
<translation>Xóa tệp</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="169"/>
<source>No files selected.</source>
<translation>Không có tệp nào được chọn.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="170"/>
<source>You can delete the cheats you don't want after downloading them.</source>
<translation>Bạn thể xóa các cheat không muốn sau khi tải xuống.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="178"/>
<source>Do you want to delete the selected file?\n%1</source>
<translation>Bạn muốn xóa tệp đã chọn?\n%1</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="213"/>
<source>Select Patch File:</source>
<translation>Chọn tệp Bản :</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="241"/>
<source>Download Patches</source>
<translation>Tải xuống Bản </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="248"/>
<source>Save</source>
<translation>Lưu</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="256"/>
<source>Cheats</source>
<translation>Cheat</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="257"/>
<source>Patches</source>
<translation>Bản </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>Error</source>
<translation>Lỗi</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="278"/>
<source>No patch selected.</source>
<translation>Không bản nào đưc chọn.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="292"/>
<source>Unable to open files.json for reading.</source>
<translation>Không thể mở files.json đ đc.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="316"/>
<source>No patch file found for the current serial.</source>
<translation>Không tìm thấy tệp bản cho số seri hiện tại.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="323"/>
<source>Unable to open the file for reading.</source>
<translation>Không thể mở tệp đ đc.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="422"/>
<source>Unable to open the file for writing.</source>
<translation>Không thể mở tệp đ ghi.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="432"/>
<source>Failed to parse XML: </source>
<translation>Không thể phân tích XML: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Success</source>
<translation>Thành công</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="434"/>
<source>Options saved successfully.</source>
<translation>Các tùy chọn đã đưc lưu thành công.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="470"/>
<source>Invalid Source</source>
<translation>Nguồn không hợp lệ</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="471"/>
<source>The selected source is invalid.</source>
<translation>Nguồn đã chọn không hợp lệ.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="519"/>
<source>File Exists</source>
<translation>Tệp đã tồn tại</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="520"/>
<source>File already exists. Do you want to replace it?</source>
<translation>Tệp đã tồn tại. Bạn muốn thay thế không?</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="539"/>
<source>Failed to save file:</source>
<translation>Không thể lưu tệp:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="545"/>
<source>Failed to download file:</source>
<translation>Không thể tải xuống tệp:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>Cheats Not Found</source>
<translation>Không tìm thấy Cheat</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="556"/>
<source>CheatsNotFound_MSG</source>
<translation>Không tìm thấy Cheat cho trò chơi này trong phiên bản kho lưu trữ đã chọn,hãy thử kho lưu trữ khác hoặc phiên bản khác của trò chơi.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="593"/>
<source>Cheats Downloaded Successfully</source>
<translation>Cheat đã tải xuống thành công</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="594"/>
<source>CheatsDownloadedSuccessfully_MSG</source>
<translation>Bạn đã tải xuống các cheat thành công. Cho phiên bản trò chơi này từ kho lưu trữ đã chọn. Bạn thể thử tải xuống từ kho lưu trữ khác, nếu , bạn cũng thể sử dụng bằng cách chọn tệp từ danh sách.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="747"/>
<source>Failed to save:</source>
<translation>Không thể lưu:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="754"/>
<source>Failed to download:</source>
<translation>Không thể tải xuống:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="762"/>
<source>Download Complete</source>
<translation>Tải xuống hoàn tất</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="763"/>
<source>DownloadComplete_MSG</source>
<translation>Bản đã tải xuống thành công! Tất cả các bản sẵn cho tất cả các trò chơi đã đưc tải xuống, không cần tải xuống riêng lẻ cho mỗi trò chơi như trong Cheat.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="773"/>
<source>Failed to parse JSON data from HTML.</source>
<translation>Không thể phân tích dữ liệu JSON từ HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="778"/>
<source>Failed to retrieve HTML page.</source>
<translation>Không thể lấy trang HTML.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="801"/>
<source>Failed to open file:</source>
<translation>Không thể mở tệp:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="819"/>
<source>XML ERROR:</source>
<translation>LỖI XML:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="826"/>
<source>Failed to open files.json for writing</source>
<translation>Không thể mở files.json đ ghi</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="925"/>
<source>Author: </source>
<translation>Tác giả: </translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="997"/>
<source>Directory does not exist:</source>
<translation>Thư mục không tồn tại:</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Failed to open files.json for reading.</source>
<translation>Không thể mở files.json đ đc.</translation>
</message>
<message>
<location filename="../cheats_patches.cpp" line="1006"/>
<source>Name:</source>
<translation>Tên:</translation>
</message>
</context>
</TS>