From 891427c75c6c617bf61b2e7f2a3f0d79872f7f3c Mon Sep 17 00:00:00 2001 From: RSDuck Date: Tue, 9 Feb 2021 23:36:46 +0100 Subject: [PATCH] fix #994 --- src/ARMJIT_Memory.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ARMJIT_Memory.cpp b/src/ARMJIT_Memory.cpp index 5a011f3d..063437e5 100644 --- a/src/ARMJIT_Memory.cpp +++ b/src/ARMJIT_Memory.cpp @@ -713,9 +713,15 @@ void Init() MemoryBase = (u8*)VirtualAlloc(NULL, AddrSpaceSize*4, MEM_RESERVE, PAGE_READWRITE); VirtualFree(MemoryBase, 0, MEM_RELEASE); - FastMem9Start = MemoryBase; - FastMem7Start = MemoryBase + AddrSpaceSize; - MemoryBase = MemoryBase + AddrSpaceSize*2; + // this is incredible hacky + // but someone else is trying to go into our address space! + // Windows will very likely give them virtual memory starting at the same address + // as it is giving us now. + // That's why we don't use this address, but instead 4gb inwards + // I know this is terrible + FastMem9Start = MemoryBase + AddrSpaceSize; + FastMem7Start = MemoryBase + AddrSpaceSize*2; + MemoryBase = MemoryBase + AddrSpaceSize*3; MapViewOfFileEx(MemoryFile, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, MemoryTotalSize, MemoryBase);