From e7ee3b7bc84e583fbfbe7c9896db53d3e808edcc Mon Sep 17 00:00:00 2001
From: RSDuck <RSDuck@users.noreply.github.com>
Date: Tue, 9 Feb 2021 22:19:44 +0100
Subject: wild shot into the dark

---
 src/ARMJIT_Memory.cpp | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

(limited to 'src')

diff --git a/src/ARMJIT_Memory.cpp b/src/ARMJIT_Memory.cpp
index 2ff38f9..5a011f3 100644
--- a/src/ARMJIT_Memory.cpp
+++ b/src/ARMJIT_Memory.cpp
@@ -711,16 +711,11 @@ void Init()
 
     MemoryFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, MemoryTotalSize, NULL);
 
-    MemoryBase = (u8*)VirtualAlloc(NULL, MemoryTotalSize, MEM_RESERVE, PAGE_READWRITE);
-
-    FastMem9Start = VirtualAlloc(NULL, AddrSpaceSize, MEM_RESERVE, PAGE_READWRITE);
-    FastMem7Start = VirtualAlloc(NULL, AddrSpaceSize, MEM_RESERVE, PAGE_READWRITE);
-
-    // only free them after they have all been reserved
-    // so they can't overlap
+    MemoryBase = (u8*)VirtualAlloc(NULL, AddrSpaceSize*4, MEM_RESERVE, PAGE_READWRITE);
     VirtualFree(MemoryBase, 0, MEM_RELEASE);
-    VirtualFree(FastMem9Start, 0, MEM_RELEASE);
-    VirtualFree(FastMem7Start, 0, MEM_RELEASE);
+    FastMem9Start = MemoryBase;
+    FastMem7Start = MemoryBase + AddrSpaceSize;
+    MemoryBase = MemoryBase + AddrSpaceSize*2;
 
     MapViewOfFileEx(MemoryFile, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, MemoryTotalSize, MemoryBase);
 
-- 
cgit v1.2.3