From 30c462a8ef5d8044ff5bff0f581e0df71310bba6 Mon Sep 17 00:00:00 2001 From: dbalatoni13 <40299962+dbalatoni13@users.noreply.github.com> Date: Sat, 5 Apr 2025 15:09:21 +0200 Subject: [PATCH] Recover matching status --- include/dolphin/os.h | 4 ++-- include/game/gamework_data.h | 4 ++-- src/dolphin/os/OSAlloc.c | 6 +++--- src/game/init.c | 24 +++++------------------- 4 files changed, 12 insertions(+), 26 deletions(-) diff --git a/include/dolphin/os.h b/include/dolphin/os.h index d255bb04..bfe75527 100644 --- a/include/dolphin/os.h +++ b/include/dolphin/os.h @@ -57,8 +57,8 @@ u32 OSUncachedToCached(void *ucaddr); #define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0)) -#define OSRoundUp32B(x) (((u32)(x) + 0x1F) & ~(0x1F)) -#define OSRoundDown32B(x) (((u32)(x)) & ~(0x1F)) +#define OSRoundUp32B(x) (((size_t)(x) + 0x1F) & ~(0x1F)) +#define OSRoundDown32B(x) (((size_t)(x)) & ~(0x1F)) #define OSRoundUp(x, align) (((x) + (align)-1) & (-(align))) #define OSRoundUpPtr(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1)))) diff --git a/include/game/gamework_data.h b/include/game/gamework_data.h index 8550f6ca..86b03fd7 100644 --- a/include/game/gamework_data.h +++ b/include/game/gamework_data.h @@ -197,8 +197,8 @@ static inline void GWRumbleSet(s32 value) { GWGameStat.rumble = value; if (value == 0) { - // TODO: get rumble working - // HuPadRumbleAllStop(); + // TODO PC: get rumble working + HuPadRumbleAllStop(); } } diff --git a/src/dolphin/os/OSAlloc.c b/src/dolphin/os/OSAlloc.c index a44fdc69..db41789a 100644 --- a/src/dolphin/os/OSAlloc.c +++ b/src/dolphin/os/OSAlloc.c @@ -350,16 +350,16 @@ void *OSInitAlloc(void *arenaStart, void *arenaEnd, int maxHeaps) } __OSCurrHeap = -1; arenaStart = (void *)((uintptr_t)((char *)HeapArray + arraySize)); - arenaStart = (void *)(((uintptr_t)arenaStart + 0x1F) & 0xFFFFFFFFFFFFFFE0); + arenaStart = (void *)(((uintptr_t)arenaStart + 0x1F) & ~0x1F); ArenaStart = arenaStart; - ArenaEnd = (void *)((uintptr_t)arenaEnd & 0xFFFFFFFFFFFFFFE0); + ArenaEnd = (void *)((uintptr_t)arenaEnd & ~0x1F); ASSERTMSG1(0x2A4, ((uintptr_t)ArenaEnd - (uintptr_t)ArenaStart) >= 0x40U, "OSInitAlloc(): too small range."); return arenaStart; } uintptr_t OSCreateHeap(void *start, void *end) { - uintptr_t heap; + s32 heap; struct HeapDesc *hd; struct Cell *cell; diff --git a/src/game/init.c b/src/game/init.c index aef6a721..3deb6725 100644 --- a/src/game/init.c +++ b/src/game/init.c @@ -144,13 +144,8 @@ static void InitMem() uintptr_t *fb1; uintptr_t *fb2; u32 i; -#ifdef TARGET_PC - DemoFrameBuffer1 = (void *)arena_lo; - DemoFrameBuffer2 = (void *)((uintptr_t)DemoFrameBuffer1 + fb_size); -#else - DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo); - DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1 + fb_size); -#endif + DemoFrameBuffer1 = (void *)OSRoundUp32B((uintptr_t)arena_lo); + DemoFrameBuffer2 = (void *)OSRoundUp32B((uintptr_t)DemoFrameBuffer1 + fb_size); DemoCurrentBuffer = DemoFrameBuffer2; #if VERSION_PAL fb1 = DemoFrameBuffer1; @@ -161,26 +156,17 @@ static void InitMem() DCStoreRangeNoSync(DemoFrameBuffer1, fb_size); DCStoreRangeNoSync(DemoFrameBuffer2, fb_size); #endif -#ifdef TARGET_PC - arena_lo = (void *)((uintptr_t)DemoFrameBuffer2 + fb_size); -#else - arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2 + fb_size); -#endif + arena_lo = (void *)OSRoundUp32B((uintptr_t)DemoFrameBuffer2 + fb_size); OSSetArenaLo(arena_lo); if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) { LoadMemInfo(); } else { -#ifdef TARGET_PC arena_lo = OSGetArenaLo(); arena_hi = OSGetArenaHi(); -#else - arena_lo = (void *)OSRoundUp32B((u32)arena_lo); - arena_hi = (void *)OSRoundDown32B((u32)arena_hi); -#endif arena_lo = OSInitAlloc(arena_lo, arena_hi, 1); OSSetArenaLo(arena_lo); - arena_lo = (void *)arena_lo; - arena_hi = (void *)arena_hi; + arena_lo = (void *)OSRoundUp32B((uintptr_t)arena_lo); + arena_hi = (void *)OSRoundDown32B((uintptr_t)arena_hi); OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi)); arena_lo = arena_hi; OSSetArenaLo(arena_lo);