diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-08-18 10:16:38 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-08-18 10:16:38 +0200 |
| commit | c384d53d75bb082ecbbbd4741f9b9a340ee912a0 (patch) | |
| tree | add24973d7b7227708b85e581873442d68298a70 /src | |
| parent | 243a4deae7390dd3720fee54beabae5a83c3ebb5 (diff) | |
| download | box64-c384d53d75bb082ecbbbd4741f9b9a340ee912a0.tar.gz box64-c384d53d75bb082ecbbbd4741f9b9a340ee912a0.zip | |
[HACK] Patch Heroic 2.15.1 to avoid some internal memory manager test, until a better solution is found (heroic is still a bit unstable)
Diffstat (limited to 'src')
| -rw-r--r-- | src/core.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c index aca52b47..e93a75ea 100644 --- a/src/core.c +++ b/src/core.c @@ -2137,6 +2137,18 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf FreeCollection(&ld_preload); return -1; } + if(!strcmp(prgname, "heroic")) { + // check if heroic needs patching (for the 2.15.1 version) + uint8_t* address = GetBaseAddress(elf_header); + if(address[0x422f6e1]==0x72 && address[0x422f6e2]==0x44 && address[0x422f6e0]==0xF8 && address[0x422f727]==0xcc) { + printf_log(LOG_INFO, "Patched heroic!\n"); + uintptr_t page = ((uintptr_t)&address[0x422f6e1])&~(box64_pagesize-1); + int prot = getProtection(page); + mprotect((void*)page, box64_pagesize, PROT_READ|PROT_WRITE|PROT_EXEC); + address[0x422f6e1]=0x90; address[0x422f6e2]=0x90; + mprotect((void*)page, box64_pagesize, prot); + } + } if(ElfCheckIfUseTCMallocMinimal(elf_header)) { if(!box64_tcmalloc_minimal) { // need to reload with tcmalloc_minimal as a LD_PRELOAD! |