From 2288b677038c5ac47024621c5828abdbbd4b9081 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 13 May 2022 17:09:44 +0200 Subject: [PATCH] Fix loading rpx with ".wut_load_bounds" section --- src/imports.h | 1 + src/module/ModuleDataFactory.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/imports.h b/src/imports.h index 26060d2..f51ef26 100644 --- a/src/imports.h +++ b/src/imports.h @@ -58,6 +58,7 @@ IMPORT(OSCompareAndSwapAtomicEx); IMPORT(OSCompareAndSwapAtomic); IMPORT(OSGetThreadSpecific); IMPORT(OSSetThreadSpecific); +IMPORT(FSTimeToCalendarTime); IMPORT(exit); IMPORT(_Exit); diff --git a/src/module/ModuleDataFactory.cpp b/src/module/ModuleDataFactory.cpp index 4d6f414..d7acff8 100644 --- a/src/module/ModuleDataFactory.cpp +++ b/src/module/ModuleDataFactory.cpp @@ -83,7 +83,7 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u for (uint32_t i = 0; i < sec_num; ++i) { section *psec = reader.sections[i]; - if (psec->get_type() == 0x80000002) { + if (psec->get_type() == 0x80000002 || psec->get_name() == ".wut_load_bounds") { continue; } @@ -103,8 +103,10 @@ ModuleDataFactory::load(const std::string &path, uint32_t destination_address, u destination -= 0x10000000; destinations[psec->get_index()] -= 0x10000000; } else if (address >= 0xC0000000) { - destination -= 0xC0000000; - destinations[psec->get_index()] -= 0xC0000000; + DEBUG_FUNCTION_LINE("Loading section from 0xC0000000 is NOT supported"); + free(destinations); + free(buffer); + return {}; } else { DEBUG_FUNCTION_LINE("Unhandled case"); free(destinations);