Try to relocate r3 exe
This commit is contained in:
@@ -15,9 +15,18 @@ struct R3Bin {
|
||||
|
||||
auto &config = getDefaultConfig();
|
||||
std::string path = config.gameRootDir + "/Rayman3.exe";
|
||||
module = LoadLibraryA(path.c_str());
|
||||
if (!module)
|
||||
throw std::runtime_error("Failed to load original binary");
|
||||
|
||||
// Reserve 4MB at the original base address
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user