Try to relocate r3 exe
This commit is contained in:
parent
2c104648cd
commit
556f8339c0
|
@ -82,6 +82,7 @@ function(setup_target TARGET DBG_MODE)
|
||||||
target_link_options(${TARGET} PRIVATE
|
target_link_options(${TARGET} PRIVATE
|
||||||
-Wl,/BASE:0x20000000
|
-Wl,/BASE:0x20000000
|
||||||
-Wl,/DYNAMICBASE:NO
|
-Wl,/DYNAMICBASE:NO
|
||||||
|
-Wl,/SECTION:.reserved,RW,0x400000
|
||||||
)
|
)
|
||||||
target_link_libraries(${TARGET} PRIVATE
|
target_link_libraries(${TARGET} PRIVATE
|
||||||
DbgHelp
|
DbgHelp
|
||||||
|
|
|
@ -15,9 +15,18 @@ struct R3Bin {
|
||||||
|
|
||||||
auto &config = getDefaultConfig();
|
auto &config = getDefaultConfig();
|
||||||
std::string path = config.gameRootDir + "/Rayman3.exe";
|
std::string path = config.gameRootDir + "/Rayman3.exe";
|
||||||
module = LoadLibraryA(path.c_str());
|
|
||||||
if (!module)
|
// Reserve 4MB at the original base address
|
||||||
throw std::runtime_error("Failed to load original binary");
|
module = (HINSTANCE)VirtualAlloc((LPVOID)GH_BASE_ADDR, 4 * 1024 * 1024, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
|
||||||
|
if (!module) {
|
||||||
|
// Get the error code
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
throw std::runtime_error("Failed to allocate memory at original base address: " + std::to_string(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
// module = LoadLibraryA(path.c_str());
|
||||||
|
// if (!module)
|
||||||
|
// throw std::runtime_error("Failed to load original binary");
|
||||||
|
|
||||||
fixupImports(module);
|
fixupImports(module);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue