From dead2003fa59cbfa6a2fd8ba285bdf28aac953f3 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 18 Aug 2024 10:16:38 +0200 Subject: [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) --- src/core.c | 12 ++++++++++++ system/box64.box64rc | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index eae05d67..3283a6c2 100644 --- a/src/core.c +++ b/src/core.c @@ -2145,6 +2145,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! diff --git a/system/box64.box64rc b/system/box64.box64rc index 383c01d7..dc4a2fc6 100644 --- a/system/box64.box64rc +++ b/system/box64.box64rc @@ -117,7 +117,6 @@ BOX64_MAXCPU=16 BOX64_NOSANDBOX=1 BOX64_INPROCESSGPU=1 BOX64_MALLOC_HACK=2 -BOX64_DYNAREC_BIGBLOCK=0 BOX64_DYNAREC_CALLRET=1 BOX64_DYNAREC_ALIGNED_ATOMICS=1 BOX64_DYNAREC_STRONGMEM=1 -- cgit 1.4.1