[PR #493] [MERGED] Cheats/Patches #1596

Closed
opened 2026-02-27 21:13:13 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/493
Author: @DanielSvoboda
Created: 8/20/2024
Status: Merged
Merged: 8/29/2024
Merged by: @georgemoralis

Base: mainHead: Cheats_Patches


📝 Commits (10+)

📊 Changes

35 files changed (+12003 additions, -798 deletions)

View changed files

📝 CMakeLists.txt (+7 -2)
📝 src/common/path_util.cpp (+2 -0)
📝 src/common/path_util.h (+4 -0)
📝 src/core/module.cpp (+13 -0)
📝 src/emulator.cpp (+6 -0)
src/qt_gui/cheats_patches.cpp (+1264 -0)
src/qt_gui/cheats_patches.h (+115 -0)
📝 src/qt_gui/gui_context_menus.h (+22 -0)
📝 src/qt_gui/main_window.cpp (+107 -24)
📝 src/qt_gui/main_window_ui.h (+6 -1)
src/qt_gui/memory_patcher.cpp (+347 -0)
src/qt_gui/memory_patcher.h (+47 -0)
📝 src/qt_gui/translations/da_DK.ts (+414 -13)
📝 src/qt_gui/translations/de.ts (+414 -13)
📝 src/qt_gui/translations/el.ts (+414 -13)
📝 src/qt_gui/translations/en.ts (+414 -13)
📝 src/qt_gui/translations/es_ES.ts (+415 -14)
📝 src/qt_gui/translations/fi.ts (+414 -13)
📝 src/qt_gui/translations/fr.ts (+414 -13)
📝 src/qt_gui/translations/hu_HU.ts (+401 -0)

...and 15 more files

📄 Description

Add Support for Cheats and Patches

This PR adds the ability to apply cheats and patches to the emulator. Below are two explanations: one simplified and one with technical details for developers.


Cheats
Right-click on a game and select the 'Cheats/Patches' option. From there, you can download cheats from three repositories: wolf2022, GoldHEN, and shadPS4. If a cheat is available in more than one repository, you can delete the undesired file using a specific button. Cheats will only be downloaded for the specific serial and version of the installed game and will be renamed with the format serial+version+repository.

In the top menu, under "Settings -> Utils -> Download Cheats/Patches", you can download all cheats at once for the installed games. It is recommended to apply cheats only during gameplay.

Patches
In addition to cheats, you can also download patches. Unlike cheats, patches are downloaded for all games, not just one specific game. The patch file is quite small. Right-click on a game, select 'Cheats/Patches', go to the patches tab, check the patches you want to use, and click 'Save'. This ensures that these options will be applied automatically every time the emulator is started, without needing to reopen the panel. In the Patches tab, if you hover over them you can see the description on the left side.

image

image


Technical Explanation:

For developers who will maintain this code in the future:

  1. Cheats

    • Cheats are downloaded from repositories and stored in the user\cheats\ folder, with names in the format serial+version+repository. Some repositories may provide multiple files for the same serial+version, distinguished by suffixes like _2 or _3, indicating different authors. The emulator can read any file starting with serial+version, for example:
      CUSA07023_01.03_TEST_shadPS4.json
      CUSA07023_01.03_GoldHEN.json
      CUSA07023_01.03_DANIEL.json
      
    • Cheats in JSON with hint:null are treated as absolute addresses. If the tag is missing, they are considered relative. The emulator handles these cases correctly.
  2. Patches

    • Patches are downloaded to user\patches\repository_name. After downloading the .xml files, a files.json file is created to map the files to the selected games, as patches are not named as systematically as cheats. The files.json includes information about the 'serial and version', ensuring that only the patch corresponding to the game's version is shown. Patches may also include a 'mask', with the title " (any version)".

    • In the context menu (right-click), select the patches you want to activate and save the settings. These patches will be automatically applied every time the game is started in QT mode; patches are not applied in SDL mode. The support for various types present in the XML is provided: byte, bytes16, bytes32, bytes64, bytes, float32, float64, utf8, utf16, mask, mask_jump32.

    • The 'mask' functionality is still under testing, as there are currently few games using it.

    • Changes are made in eboot.bin, not tested with changes in .elf

    • I found some of the text too long to translate in parts,
      so I replaced it with the text below, so the text only appears in the .ts translation file:
      defaultTextEdit_MSG
      CheatsNotFound_MSG
      CheatsDownloadedSuccessfully_MSG
      DownloadComplete_MSG

Repository for New Cheats/Patches
New cheats and patches can be added via the repository:
https://github.com/shadps4-emu/ps4_cheats

Interface based on issues/372

  • Front-end - Interface
  • Back-end - Apply the Cheats/Patchs modifications - By: CrazyBloo
  • Plus other corrections that are not worth describing in detail...

Authored-by: DanielSvoboda
Co-authored-by: CrazyBloo


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/493 **Author:** [@DanielSvoboda](https://github.com/DanielSvoboda) **Created:** 8/20/2024 **Status:** ✅ Merged **Merged:** 8/29/2024 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `Cheats_Patches` --- ### 📝 Commits (10+) - [`10485af`](https://github.com/shadps4-emu/shadPS4/commit/10485af9329af000a4f08c7f36a478e66ace65d4) Cheats/Patches - [`4b84fed`](https://github.com/shadps4-emu/shadPS4/commit/4b84fedd8e6eaeaa0ae55776c0b0d2a1d28ed25a) Clang Format - [`61fb15b`](https://github.com/shadps4-emu/shadPS4/commit/61fb15b7d5ab2795e7e92b8b96ee143e2ef11919) separate files - [`1be30f6`](https://github.com/shadps4-emu/shadPS4/commit/1be30f6b6c65a5661599e9b8a4523762db147115) reuse - [`b017b30`](https://github.com/shadps4-emu/shadPS4/commit/b017b303b2035fb5f304abbb45704e324e9eff3a) initial implementation of cheat functionality - [`f326173`](https://github.com/shadps4-emu/shadPS4/commit/f326173a4685768855b6eca51afdf7b56676b6a5) Merge pull request #2 from CrazyBloo/Cheats_Patches - [`2b45464`](https://github.com/shadps4-emu/shadPS4/commit/2b454644fb6711f12a1f96ef7da8ad16b16a2c04) Update cheats_patches.cpp - [`e938ecf`](https://github.com/shadps4-emu/shadPS4/commit/e938ecf206c45b0929d980dbbf76f7094a7b296a) move eboot_address to module.h - [`0e48887`](https://github.com/shadps4-emu/shadPS4/commit/0e4888723ef1dd5e103d67cbf04f4a7901d88661) Merge pull request #3 from CrazyBloo/Cheats_Patches - [`957d3e3`](https://github.com/shadps4-emu/shadPS4/commit/957d3e38df03b58b6fe5f3df1e9b331c422b653e) Patchs menu and fixes ### 📊 Changes **35 files changed** (+12003 additions, -798 deletions) <details> <summary>View changed files</summary> 📝 `CMakeLists.txt` (+7 -2) 📝 `src/common/path_util.cpp` (+2 -0) 📝 `src/common/path_util.h` (+4 -0) 📝 `src/core/module.cpp` (+13 -0) 📝 `src/emulator.cpp` (+6 -0) ➕ `src/qt_gui/cheats_patches.cpp` (+1264 -0) ➕ `src/qt_gui/cheats_patches.h` (+115 -0) 📝 `src/qt_gui/gui_context_menus.h` (+22 -0) 📝 `src/qt_gui/main_window.cpp` (+107 -24) 📝 `src/qt_gui/main_window_ui.h` (+6 -1) ➕ `src/qt_gui/memory_patcher.cpp` (+347 -0) ➕ `src/qt_gui/memory_patcher.h` (+47 -0) 📝 `src/qt_gui/translations/da_DK.ts` (+414 -13) 📝 `src/qt_gui/translations/de.ts` (+414 -13) 📝 `src/qt_gui/translations/el.ts` (+414 -13) 📝 `src/qt_gui/translations/en.ts` (+414 -13) 📝 `src/qt_gui/translations/es_ES.ts` (+415 -14) 📝 `src/qt_gui/translations/fi.ts` (+414 -13) 📝 `src/qt_gui/translations/fr.ts` (+414 -13) 📝 `src/qt_gui/translations/hu_HU.ts` (+401 -0) _...and 15 more files_ </details> ### 📄 Description ### Add Support for `Cheats and Patches` This PR adds the ability to apply cheats and patches to the emulator. Below are two explanations: one simplified and one with technical details for developers. --- **Cheats** Right-click on a game and select the 'Cheats/Patches' option. From there, you can download cheats from three repositories: wolf2022, GoldHEN, and shadPS4. If a cheat is available in more than one repository, you can delete the undesired file using a specific button. Cheats will only be downloaded for the specific serial and version of the installed game and will be renamed with the format serial+version+repository. In the top menu, under "Settings -> Utils -> Download Cheats/Patches", you can download all cheats at once for the installed games. It is recommended to apply cheats only during gameplay. **Patches** In addition to cheats, you can also download patches. Unlike cheats, patches are downloaded for all games, not just one specific game. The patch file is quite small. Right-click on a game, select 'Cheats/Patches', go to the patches tab, check the patches you want to use, and click 'Save'. This ensures that these options will be applied automatically every time the emulator is started, without needing to reopen the panel. In the Patches tab, if you hover over them you can see the description on the left side. ![image](https://github.com/user-attachments/assets/2669c077-4b55-4d7a-a54d-a6c57548e06b) ![image](https://github.com/user-attachments/assets/ac919a43-8b73-4c8f-b392-6108e8d25ae3) --- **Technical Explanation:** For developers who will maintain this code in the future: 1. **Cheats** - Cheats are downloaded from repositories and stored in the `user\cheats\` folder, with names in the format serial+version+repository. Some repositories may provide multiple files for the same serial+version, distinguished by suffixes like _2 or _3, indicating different authors. The emulator can read any file starting with serial+version, for example: ``` CUSA07023_01.03_TEST_shadPS4.json CUSA07023_01.03_GoldHEN.json CUSA07023_01.03_DANIEL.json ``` - Cheats in JSON with `hint:null` are treated as absolute addresses. If the tag is missing, they are considered relative. The emulator handles these cases correctly. 2. **Patches** - Patches are downloaded to `user\patches\repository_name`. After downloading the .xml files, a `files.json` file is created to map the files to the selected games, as patches are not named as systematically as cheats. The `files.json` includes information about the 'serial and version', ensuring that only the patch corresponding to the game's version is shown. Patches may also include a 'mask', with the title " (any version)". - In the context menu (right-click), select the patches you want to activate and save the settings. These patches will be automatically applied every time the game is started in QT mode; patches are not applied in SDL mode. The support for various types present in the XML is provided: byte, bytes16, bytes32, bytes64, bytes, float32, float64, utf8, utf16, mask, mask_jump32. - The 'mask' functionality is still under testing, as there are currently few games using it. - Changes are made in eboot.bin, not tested with changes in .elf - I found some of the text too long to translate in parts, so I replaced it with the text below, so the text only appears in the .ts translation file: defaultTextEdit_MSG CheatsNotFound_MSG CheatsDownloadedSuccessfully_MSG DownloadComplete_MSG **Repository for New Cheats/Patches** New cheats and patches can be added via the repository: [https://github.com/shadps4-emu/ps4_cheats](https://github.com/shadps4-emu/ps4_cheats) Interface based on [issues/372 ](https://github.com/shadps4-emu/shadPS4/issues/372) - [X] Front-end - Interface - [X] Back-end - Apply the Cheats/Patchs modifications - By: CrazyBloo - [x] Plus other corrections that are not worth describing in detail... Authored-by: DanielSvoboda Co-authored-by: CrazyBloo --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:13:13 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#1596
No description provided.