Skip to content

Commit

Permalink
Increase internal RE 2 work area memory to reduce crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
IntelOrca committed Dec 16, 2023
1 parent aea2448 commit cc5aff4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions biorandmod/biorand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

static WCHAR _dataPath[4096];
static FILETIME _lastDataTimestamp;
static void* _largeWorkArea;

static bool ReadFileData(HANDLE hFile, void* address, size_t size)
{
Expand Down Expand Up @@ -139,6 +140,12 @@ static void RE2_HookLoadGame()
{
}
}

// When a stage is loaded, it sets up a work buffer that is used for room storage and operations
// This is tiny from PSX days, but we can make it much larger to reduce chance of crashes when
// we pack rooms full of stuff like enemies and NPCs
_largeWorkArea = malloc(16 * 1024 * 1024);
WriteProcessMemory(GetCurrentProcess(), (LPVOID)(0x4DEF10), &_largeWorkArea, sizeof(_largeWorkArea), NULL);
}

static void ModMain(HMODULE hExecutable)
Expand Down

0 comments on commit cc5aff4

Please sign in to comment.