diff options
| author | 2019-03-05 10:09:27 -0500 | |
|---|---|---|
| committer | 2019-03-05 10:09:36 -0500 | |
| commit | 52ac6419dafb84b10369226d3746b3b5b761d33b (patch) | |
| tree | 008c14ba2e019b86128e6168ad49a3a1eafa6ba8 /src/core/loader | |
| parent | core: Add support for registering and controlling ownership of CheatEngine (diff) | |
| download | yuzu-52ac6419dafb84b10369226d3746b3b5b761d33b.tar.gz yuzu-52ac6419dafb84b10369226d3746b3b5b761d33b.tar.xz yuzu-52ac6419dafb84b10369226d3746b3b5b761d33b.zip | |
vm_manager: Remove cheat-specific ranges from VMManager
Diffstat (limited to 'src/core/loader')
| -rw-r--r-- | src/core/loader/deconstructed_rom_directory.cpp | 4 | ||||
| -rw-r--r-- | src/core/loader/nso.cpp | 10 | ||||
| -rw-r--r-- | src/core/loader/nso.h | 1 |
3 files changed, 4 insertions, 11 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index ef9a577e3..07aa7a1cd 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp | |||
| @@ -147,10 +147,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(Kernel::Process& process) | |||
| 147 | 147 | ||
| 148 | const VAddr load_addr = next_load_addr; | 148 | const VAddr load_addr = next_load_addr; |
| 149 | const bool should_pass_arguments = std::strcmp(module, "rtld") == 0; | 149 | const bool should_pass_arguments = std::strcmp(module, "rtld") == 0; |
| 150 | const bool should_register_data_segment = std::strcmp(module, "main") == 0; | ||
| 151 | const auto tentative_next_load_addr = | 150 | const auto tentative_next_load_addr = |
| 152 | AppLoader_NSO::LoadModule(process, *module_file, load_addr, should_pass_arguments, | 151 | AppLoader_NSO::LoadModule(process, *module_file, load_addr, should_pass_arguments, pm); |
| 153 | should_register_data_segment, pm); | ||
| 154 | if (!tentative_next_load_addr) { | 152 | if (!tentative_next_load_addr) { |
| 155 | return ResultStatus::ErrorLoadingNSO; | 153 | return ResultStatus::ErrorLoadingNSO; |
| 156 | } | 154 | } |
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 2721d85b1..5f6a6c0cf 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp | |||
| @@ -97,7 +97,6 @@ static constexpr u32 PageAlignSize(u32 size) { | |||
| 97 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, | 97 | std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, |
| 98 | const FileSys::VfsFile& file, VAddr load_base, | 98 | const FileSys::VfsFile& file, VAddr load_base, |
| 99 | bool should_pass_arguments, | 99 | bool should_pass_arguments, |
| 100 | bool should_register_data_region, | ||
| 101 | std::optional<FileSys::PatchManager> pm) { | 100 | std::optional<FileSys::PatchManager> pm) { |
| 102 | if (file.GetSize() < sizeof(NsoHeader)) | 101 | if (file.GetSize() < sizeof(NsoHeader)) |
| 103 | return {}; | 102 | return {}; |
| @@ -156,10 +155,6 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, | |||
| 156 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; | 155 | const u32 image_size{PageAlignSize(static_cast<u32>(program_image.size()) + bss_size)}; |
| 157 | program_image.resize(image_size); | 156 | program_image.resize(image_size); |
| 158 | 157 | ||
| 159 | if (should_register_data_region) { | ||
| 160 | process.VMManager().SetMainCodeRegion(load_base, load_base + program_image.size()); | ||
| 161 | } | ||
| 162 | |||
| 163 | // Apply patches if necessary | 158 | // Apply patches if necessary |
| 164 | if (pm && (pm->HasNSOPatch(nso_header.build_id) || Settings::values.dump_nso)) { | 159 | if (pm && (pm->HasNSOPatch(nso_header.build_id) || Settings::values.dump_nso)) { |
| 165 | std::vector<u8> pi_header(program_image.size() + 0x100); | 160 | std::vector<u8> pi_header(program_image.size() + 0x100); |
| @@ -176,7 +171,8 @@ std::optional<VAddr> AppLoader_NSO::LoadModule(Kernel::Process& process, | |||
| 176 | const auto cheats = pm->CreateCheatList(nso_header.build_id); | 171 | const auto cheats = pm->CreateCheatList(nso_header.build_id); |
| 177 | if (!cheats.empty()) { | 172 | if (!cheats.empty()) { |
| 178 | Core::System::GetInstance().RegisterCheatList( | 173 | Core::System::GetInstance().RegisterCheatList( |
| 179 | cheats, Common::HexArrayToString(nso_header.build_id)); | 174 | cheats, Common::HexArrayToString(nso_header.build_id), load_base, |
| 175 | load_base + program_image.size()); | ||
| 180 | } | 176 | } |
| 181 | } | 177 | } |
| 182 | 178 | ||
| @@ -197,7 +193,7 @@ ResultStatus AppLoader_NSO::Load(Kernel::Process& process) { | |||
| 197 | 193 | ||
| 198 | // Load module | 194 | // Load module |
| 199 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); | 195 | const VAddr base_address = process.VMManager().GetCodeRegionBaseAddress(); |
| 200 | if (!LoadModule(process, *file, base_address, true, true)) { | 196 | if (!LoadModule(process, *file, base_address, true)) { |
| 201 | return ResultStatus::ErrorLoadingNSO; | 197 | return ResultStatus::ErrorLoadingNSO; |
| 202 | } | 198 | } |
| 203 | LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", file->GetName(), base_address); | 199 | LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", file->GetName(), base_address); |
diff --git a/src/core/loader/nso.h b/src/core/loader/nso.h index 858e346c6..135b6ea5a 100644 --- a/src/core/loader/nso.h +++ b/src/core/loader/nso.h | |||
| @@ -43,7 +43,6 @@ public: | |||
| 43 | 43 | ||
| 44 | static std::optional<VAddr> LoadModule(Kernel::Process& process, const FileSys::VfsFile& file, | 44 | static std::optional<VAddr> LoadModule(Kernel::Process& process, const FileSys::VfsFile& file, |
| 45 | VAddr load_base, bool should_pass_arguments, | 45 | VAddr load_base, bool should_pass_arguments, |
| 46 | bool should_register_data_segment, | ||
| 47 | std::optional<FileSys::PatchManager> pm = {}); | 46 | std::optional<FileSys::PatchManager> pm = {}); |
| 48 | 47 | ||
| 49 | ResultStatus Load(Kernel::Process& process) override; | 48 | ResultStatus Load(Kernel::Process& process) override; |