diff --git a/src/dusk/stubs.cpp b/src/dusk/stubs.cpp index eece4d356e..867a1e1a7d 100644 --- a/src/dusk/stubs.cpp +++ b/src/dusk/stubs.cpp @@ -1171,88 +1171,6 @@ void AIStopDMA(void) { STUB_LOG("AIStopDMA is a stub"); } -#pragma mark AR -#include - -// ARAM emulation: allocate a large buffer to simulate the GameCube's Auxiliary RAM. -// ARAM "addresses" are offsets into this buffer. On GameCube, ARAM is 16 MB starting -// at a base address returned by ARInit. We emulate this by malloc'ing a 16 MB buffer -// and using a simple bump allocator (matching ARAlloc behavior on real hardware). -static const u32 ARAM_EMU_SIZE = 16 * 1024 * 1024; // 16 MB (GameCube ARAM size) -static u8* sAramBuffer = nullptr; -static u32 sAramAllocPtr = 0; // bump allocator offset into sAramBuffer - -// Convert an ARAM "address" (offset) to a real host pointer -static u8* aramToHost(u32 aramAddr) { - if (!sAramBuffer || aramAddr >= ARAM_EMU_SIZE) { - return nullptr; - } - return sAramBuffer + aramAddr; -} - -u32 ARAlloc(u32 length) { - // Simple bump allocator (matching GameCube behavior - ARAlloc never frees) - u32 addr = sAramAllocPtr; - sAramAllocPtr += (length + 31) & ~31; // 32-byte align - if (sAramAllocPtr > ARAM_EMU_SIZE) { - OSReport("[ARAM] ERROR: ARAlloc overflow! Requested %u, used %u/%u\n", - length, sAramAllocPtr, ARAM_EMU_SIZE); - return 0; - } - OSReport("[ARAM] ARAlloc(%u) -> 0x%08X\n", length, addr); - return addr; -} - -u32 ARGetSize(void) { - return ARAM_EMU_SIZE; -} - -u32 ARInit(u32* stack_index_addr, u32 num_entries) { - if (!sAramBuffer) { - sAramBuffer = (u8*)malloc(ARAM_EMU_SIZE); - if (sAramBuffer) { - memset(sAramBuffer, 0, ARAM_EMU_SIZE); - OSReport("[ARAM] Initialized %u bytes of emulated ARAM\n", ARAM_EMU_SIZE); - } else { - OSReport("[ARAM] FATAL: Failed to allocate ARAM emulation buffer!\n"); - } - } - // Return base address (start of usable ARAM, after stack entries) - sAramAllocPtr = 0; - return 0; -} - -#pragma mark ARQ -void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, uintptr_t source, uintptr_t dest, - u32 length, ARQCallback callback) { - // Emulate ARAM DMA transfers using memcpy. - // type 0 = MRAM -> ARAM, type 1 = ARAM -> MRAM - if (type == ARAM_DIR_MRAM_TO_ARAM) { - // Main RAM -> ARAM: source is a host pointer (cast to u32), dest is an ARAM offset - u8* hostSrc = (u8*)(uintptr_t)source; - u8* aramDst = aramToHost(dest); - if (aramDst && hostSrc) { - memcpy(aramDst, hostSrc, length); - } - } else { - // ARAM -> Main RAM: source is an ARAM offset, dest is a host pointer (cast to u32) - u8* aramSrc = aramToHost(source); - u8* hostDst = (u8*)(uintptr_t)dest; - if (aramSrc && hostDst) { - memcpy(hostDst, aramSrc, length); - } - } - - // Immediately invoke the callback (synchronous on PC, no DMA latency) - if (callback) { - callback((uintptr_t)request); - } -} - -void ARQInit() { - // Nothing to do on PC - ARAM is initialized in ARInit -} - #pragma mark DVD #include s32 DVDCancel(volatile DVDCommandBlock* block) { diff --git a/src/m_Do/m_Do_main.cpp b/src/m_Do/m_Do_main.cpp index 4919f8699e..b4d440b6bf 100644 --- a/src/m_Do/m_Do_main.cpp +++ b/src/m_Do/m_Do_main.cpp @@ -232,6 +232,7 @@ int game_main(int argc, char* argv[]) { config.configPath = "."; config.logCallback = &aurora_log_callback; config.mem1Size = 256 * 1024 * 1024; + config.mem2Size = 24 * 1024 * 1024; auroraInfo = aurora_initialize(argc, argv, &config);