Recover matching status

This commit is contained in:
dbalatoni13 2025-04-05 15:09:21 +02:00
parent 1acc0961d4
commit 30c462a8ef
4 changed files with 12 additions and 26 deletions

View file

@ -57,8 +57,8 @@ u32 OSUncachedToCached(void *ucaddr);
#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0)) #define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0))
#define OSRoundUp32B(x) (((u32)(x) + 0x1F) & ~(0x1F)) #define OSRoundUp32B(x) (((size_t)(x) + 0x1F) & ~(0x1F))
#define OSRoundDown32B(x) (((u32)(x)) & ~(0x1F)) #define OSRoundDown32B(x) (((size_t)(x)) & ~(0x1F))
#define OSRoundUp(x, align) (((x) + (align)-1) & (-(align))) #define OSRoundUp(x, align) (((x) + (align)-1) & (-(align)))
#define OSRoundUpPtr(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1)))) #define OSRoundUpPtr(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1))))

View file

@ -197,8 +197,8 @@ static inline void GWRumbleSet(s32 value)
{ {
GWGameStat.rumble = value; GWGameStat.rumble = value;
if (value == 0) { if (value == 0) {
// TODO: get rumble working // TODO PC: get rumble working
// HuPadRumbleAllStop(); HuPadRumbleAllStop();
} }
} }

View file

@ -350,16 +350,16 @@ void *OSInitAlloc(void *arenaStart, void *arenaEnd, int maxHeaps)
} }
__OSCurrHeap = -1; __OSCurrHeap = -1;
arenaStart = (void *)((uintptr_t)((char *)HeapArray + arraySize)); arenaStart = (void *)((uintptr_t)((char *)HeapArray + arraySize));
arenaStart = (void *)(((uintptr_t)arenaStart + 0x1F) & 0xFFFFFFFFFFFFFFE0); arenaStart = (void *)(((uintptr_t)arenaStart + 0x1F) & ~0x1F);
ArenaStart = arenaStart; 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."); ASSERTMSG1(0x2A4, ((uintptr_t)ArenaEnd - (uintptr_t)ArenaStart) >= 0x40U, "OSInitAlloc(): too small range.");
return arenaStart; return arenaStart;
} }
uintptr_t OSCreateHeap(void *start, void *end) uintptr_t OSCreateHeap(void *start, void *end)
{ {
uintptr_t heap; s32 heap;
struct HeapDesc *hd; struct HeapDesc *hd;
struct Cell *cell; struct Cell *cell;

View file

@ -144,13 +144,8 @@ static void InitMem()
uintptr_t *fb1; uintptr_t *fb1;
uintptr_t *fb2; uintptr_t *fb2;
u32 i; u32 i;
#ifdef TARGET_PC DemoFrameBuffer1 = (void *)OSRoundUp32B((uintptr_t)arena_lo);
DemoFrameBuffer1 = (void *)arena_lo; DemoFrameBuffer2 = (void *)OSRoundUp32B((uintptr_t)DemoFrameBuffer1 + fb_size);
DemoFrameBuffer2 = (void *)((uintptr_t)DemoFrameBuffer1 + fb_size);
#else
DemoFrameBuffer1 = (void *)OSRoundUp32B((u32)arena_lo);
DemoFrameBuffer2 = (void *)OSRoundUp32B((u32)DemoFrameBuffer1 + fb_size);
#endif
DemoCurrentBuffer = DemoFrameBuffer2; DemoCurrentBuffer = DemoFrameBuffer2;
#if VERSION_PAL #if VERSION_PAL
fb1 = DemoFrameBuffer1; fb1 = DemoFrameBuffer1;
@ -161,26 +156,17 @@ static void InitMem()
DCStoreRangeNoSync(DemoFrameBuffer1, fb_size); DCStoreRangeNoSync(DemoFrameBuffer1, fb_size);
DCStoreRangeNoSync(DemoFrameBuffer2, fb_size); DCStoreRangeNoSync(DemoFrameBuffer2, fb_size);
#endif #endif
#ifdef TARGET_PC arena_lo = (void *)OSRoundUp32B((uintptr_t)DemoFrameBuffer2 + fb_size);
arena_lo = (void *)((uintptr_t)DemoFrameBuffer2 + fb_size);
#else
arena_lo = (void *)OSRoundUp32B((u32)DemoFrameBuffer2 + fb_size);
#endif
OSSetArenaLo(arena_lo); OSSetArenaLo(arena_lo);
if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) { if(OSGetConsoleType() == OS_CONSOLE_DEVHW1 && OSGetPhysicalMemSize() != 0x400000 && OSGetConsoleSimulatedMemSize() < 0x1800000) {
LoadMemInfo(); LoadMemInfo();
} else { } else {
#ifdef TARGET_PC
arena_lo = OSGetArenaLo(); arena_lo = OSGetArenaLo();
arena_hi = OSGetArenaHi(); 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); arena_lo = OSInitAlloc(arena_lo, arena_hi, 1);
OSSetArenaLo(arena_lo); OSSetArenaLo(arena_lo);
arena_lo = (void *)arena_lo; arena_lo = (void *)OSRoundUp32B((uintptr_t)arena_lo);
arena_hi = (void *)arena_hi; arena_hi = (void *)OSRoundDown32B((uintptr_t)arena_hi);
OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi)); OSSetCurrentHeap(currentHeapHandle = OSCreateHeap(arena_lo, arena_hi));
arena_lo = arena_hi; arena_lo = arena_hi;
OSSetArenaLo(arena_lo); OSSetArenaLo(arena_lo);