diff options
| author | 2019-03-21 21:41:59 -0400 | |
|---|---|---|
| committer | 2019-03-21 21:41:59 -0400 | |
| commit | 639f0c524d3406b7c156dc75af4e934c6b5adcb6 (patch) | |
| tree | e03093771bbffc832c48670331cf9af54aa4a9fc /src/core/loader/nso.cpp | |
| parent | Merge pull request #2260 from lioncash/sdl (diff) | |
| parent | vm_manager: Remove cheat-specific ranges from VMManager (diff) | |
| download | yuzu-639f0c524d3406b7c156dc75af4e934c6b5adcb6.tar.gz yuzu-639f0c524d3406b7c156dc75af4e934c6b5adcb6.tar.xz yuzu-639f0c524d3406b7c156dc75af4e934c6b5adcb6.zip | |
Merge pull request #1933 from DarkLordZach/cheat-engine
file_sys: Implement parser and interpreter for game memory cheats
Diffstat (limited to 'src/core/loader/nso.cpp')
| -rw-r--r-- | src/core/loader/nso.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index e1c8908a1..0eb9fd7f7 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -7,8 +7,10 @@ | |||
| 7 | #include <lz4.h> | 7 | #include <lz4.h> |
| 8 | #include "common/common_funcs.h" | 8 | #include "common/common_funcs.h" |
| 9 | #include "common/file_util.h" | 9 | #include "common/file_util.h" |
| 10 | #include "common/hex_util.h" | ||
| 10 | #include "common/logging/log.h" | 11 | #include "common/logging/log.h" |
| 11 | #include "common/swap.h" | 12 | #include "common/swap.h" |
| 13 | #include "core/core.h" | ||
| 12 | #include "core/file_sys/patch_manager.h" | 14 | #include "core/file_sys/patch_manager.h" |
| 13 | #include "core/gdbstub/gdbstub.h" | 15 | #include "core/gdbstub/gdbstub.h" |
| 14 | #include "core/hle/kernel/code_set.h" | 16 | #include "core/hle/kernel/code_set.h" |
| @@ -165,6 +167,16 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, | |||
| 165 | std::memcpy(program_image.data(), pi_header.data() + 0x100, program_image.size()); | 167 | std::memcpy(program_image.data(), pi_header.data() + 0x100, program_image.size()); |
| 166 | } | 168 | } |
| 167 | 169 | ||
| 170 | // Apply cheats if they exist and the program has a valid title ID | ||
| 171 | if (pm) { | ||
| 172 | const auto cheats = pm->CreateCheatList(nso_header.build_id); | ||
| 173 | if (!cheats.empty()) { | ||
| 174 | Core::System::GetInstance().RegisterCheatList( | ||
| 175 | cheats, Common::HexArrayToString(nso_header.build_id), load_base, | ||
| 176 | load_base + program_image.size()); | ||
| 177 | } | ||
| 178 | } | ||
| 179 | |||
| 168 | // Load codeset for current process | 180 | // Load codeset for current process |
| 169 | codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image)); | 181 | codeset.memory = std::make_shared<std::vector<u8>>(std::move(program_image)); |
| 170 | process.LoadModule(std::move(codeset), load_base); | 182 | process.LoadModule(std::move(codeset), load_base); |