Use separate heap for DVD decompression

This fixes crashes when first entering North Faaron cave and
Renado's Sanctuary due to system heap exhaustion resulting from
multiple threads allocating on the heap at once.

There's some sort of weird contention going on - for some reason the
game gobbles up seemingly any amount of memory you throw at it when
the two threads are competing for heap space. Using a separate heap
in the async thread sidesteps the issue.
This commit is contained in:
Max Roncace
2026-03-29 01:12:40 -04:00
parent 6491062dab
commit d2c5614a47
3 changed files with 30 additions and 0 deletions
+9
View File
@@ -29,6 +29,10 @@
#include "DynamicLink.h"
#include "os_report.h"
#if TARGET_PC
#include <assert.h>
#endif
#if !PLATFORM_GCN
#include <revolution/sc.h>
#include <revolution/wpad.h>
@@ -991,6 +995,11 @@ int mDoMch_Create() {
GXSetVerifyCallback((GXVerifyCallback)&myGXVerifyCallback);
#endif
JKRDvdRipper::setSZSBufferSize(0x4000);
#if TARGET_PC
JKRHeap* dvdHeap = JKRCreateExpHeap(0x10000, NULL, false);
assert(dvdHeap != NULL);
JKRDvdRipper::setHeap(dvdHeap);
#endif
JKRDvdAramRipper::setSZSBufferSize(0x4000);
JKRAram::setSZSBufferSize(0x2000);
mDoDvdThd::create(OSGetThreadPriority(OSGetCurrentThread()) - 2);