From 11e2912518c502f742a6c18b9dbf1331f4ea73f8 Mon Sep 17 00:00:00 2001 From: EpochFlame <82550703+EpochFlame@users.noreply.github.com> Date: Sat, 4 Feb 2023 23:21:18 -0500 Subject: [PATCH] purge FULL_FRANK ifdef usage only reminder of its usage is in configure.py Former-commit-id: 3b95d440e0bd584752bba06c04d7d5656cf25743 --- src/Dolphin/GBA/GBAXfer.c | 43 ---- src/Dolphin/ai.c | 58 ------ src/Dolphin/ar/ar.c | 95 +-------- src/Dolphin/card/CARDBios.c | 223 +-------------------- src/Dolphin/card/CARDCheck.c | 367 ---------------------------------- src/Dolphin/dsp/dsp.c | 44 +--- src/Dolphin/dvd/dvdfatal.c | 44 ---- src/Dolphin/dvd/dvdfs.c | 20 -- src/Dolphin/os/OSError.c | 156 +-------------- src/Dolphin/os/OSMemory.c | 28 --- src/Dolphin/os/OSResetSW.c | 192 ------------------ src/Dolphin/os/OSRtc.c | 217 -------------------- src/Dolphin/os/OSThread.c | 378 ----------------------------------- src/Dolphin/pad/pad.c | 80 -------- 14 files changed, 4 insertions(+), 1941 deletions(-) diff --git a/src/Dolphin/GBA/GBAXfer.c b/src/Dolphin/GBA/GBAXfer.c index c88ffd1d..ec62432e 100644 --- a/src/Dolphin/GBA/GBAXfer.c +++ b/src/Dolphin/GBA/GBAXfer.c @@ -39,8 +39,6 @@ void __GBAHandler(s32 chan, u32 sr, OSContext* context) { void __GBASyncCallback(s32 chan, s32 ret) { OSWakeupThread(&__GBA[chan].thread_queue); } -#ifdef FULL_FRANK -/* This actually does match, but has an epilogue swap */ s32 __GBASync(s32 chan) { GBA* gba; s32 enabled; @@ -57,47 +55,6 @@ s32 __GBASync(s32 chan) { return ret; } -#else -extern void OSSleepThread(); -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 __GBASync(s32 chan) { - nofralloc - mflr r0 - lis r4, __GBA@ha - stw r0, 4(r1) - slwi r3, r3, 8 - addi r0, r4, __GBA@l - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - add r31, r0, r3 - stw r30, 0x10(r1) - bl OSDisableInterrupts - mr r30, r3 - b lbl_803CAD50 -lbl_803CAD48: - addi r3, r31, 0x24 - bl OSSleepThread -lbl_803CAD50: - lwz r0, 0x1c(r31) - cmplwi r0, 0 - bne lbl_803CAD48 - lwz r31, 0x20(r31) - mr r3, r30 - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif void TypeAndStatusCallback(s32 chan, u32 type) { s32 tmp; diff --git a/src/Dolphin/ai.c b/src/Dolphin/ai.c index fb39c789..9d65b1ec 100644 --- a/src/Dolphin/ai.c +++ b/src/Dolphin/ai.c @@ -22,7 +22,6 @@ void __AIDHandler(s16 interrupt, OSContext* context); void __AICallbackStackSwitch(register AIDCallback cb); void __AI_SRC_INIT(void); -#ifdef FULL_FRANK AIDCallback AIRegisterDMACallback(AIDCallback callback) { s32 oldInts; AIDCallback ret; @@ -33,34 +32,6 @@ AIDCallback AIRegisterDMACallback(AIDCallback callback) { OSRestoreInterrupts(oldInts); return ret; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm AIDCallback AIRegisterDMACallback(AIDCallback callback) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - lwz r31, __AID_Callback - bl OSDisableInterrupts - stw r30, __AID_Callback - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif void AIInitDMA(u32 addr, u32 length) { s32 oldInts; @@ -79,7 +50,6 @@ u32 AIGetDMAStartAddr(void) { return (u32)((__DSPRegs[24] & 0x03ff) << 16) | (__DSPRegs[25] & 0xffe0); } -#ifdef FULL_FRANK AISCallback AIRegisterStreamCallback(AISCallback callback) { AISCallback ret; s32 oldInts; @@ -90,34 +60,6 @@ AISCallback AIRegisterStreamCallback(AISCallback callback) { OSRestoreInterrupts(oldInts); return ret; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm AISCallback AIRegisterStreamCallback(AISCallback callback) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - lwz r31, __AIS_Callback - bl OSDisableInterrupts - stw r30, __AIS_Callback - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif void AIResetStreamSampleCount(void) { __AIRegs[0] = (__AIRegs[0] & ~0x20) | 0x20; } diff --git a/src/Dolphin/ar/ar.c b/src/Dolphin/ar/ar.c index 1d59b303..af44c4c7 100644 --- a/src/Dolphin/ar/ar.c +++ b/src/Dolphin/ar/ar.c @@ -21,7 +21,6 @@ static void __ARHandler(__OSInterrupt interrupt, OSContext* context); static void __ARChecksize(void); static void __ARClearArea(u32 start_addr, u32 length); -#ifdef FULL_FRANK ARCallback ARRegisterDMACallback(ARCallback callback) { ARCallback oldCb; BOOL enabled; @@ -31,36 +30,7 @@ ARCallback ARRegisterDMACallback(ARCallback callback) { OSRestoreInterrupts(enabled); return oldCb; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm ARCallback ARRegisterDMACallback(ARCallback callback) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - lwz r31, __AR_Callback - bl OSDisableInterrupts - stw r30, __AR_Callback - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif -#ifdef FULL_FRANK u32 ARGetDMAStatus() { BOOL enabled; u32 val; @@ -69,32 +39,7 @@ u32 ARGetDMAStatus() { OSRestoreInterrupts(enabled); return val; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm u32 ARGetDMAStatus() { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x10(r1) - stw r31, 0xc(r1) - bl OSDisableInterrupts - lis r4, __DSPRegs + (5 * 2)@ha - lhz r0, __DSPRegs + (5 * 2)@l(r4) - rlwinm r31, r0, 0, 0x16, 0x16 - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - addi r1, r1, 0x10 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif + void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length) { BOOL enabled; @@ -110,7 +55,6 @@ void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length) { OSRestoreInterrupts(enabled); } -#ifdef FULL_FRANK u32 ARAlloc(u32 length) { u32 tmp; BOOL enabled; @@ -125,43 +69,6 @@ u32 ARAlloc(u32 length) { return tmp; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm u32 ARAlloc(u32 length) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - bl OSDisableInterrupts - lwz r31, __AR_StackPointer - lwz r4, __AR_BlockLength - add r0, r31, r30 - stw r0, __AR_StackPointer - stw r30, 0(r4) - lwz r5, __AR_BlockLength - lwz r4, __AR_FreeBlocks - addi r5, r5, 4 - addi r0, r4, -1 - stw r5, __AR_BlockLength - stw r0, __AR_FreeBlocks - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif #if NONMATCHING u32 ARFree(u32* length) { diff --git a/src/Dolphin/card/CARDBios.c b/src/Dolphin/card/CARDBios.c index 0a1fb45b..8b87849a 100644 --- a/src/Dolphin/card/CARDBios.c +++ b/src/Dolphin/card/CARDBios.c @@ -397,8 +397,6 @@ s32 __CARDWritePage(s32 chan, CARDCallback callback) { return result; } -#ifdef FULL_FRANK -/* TODO: Needs frank fix for disconnected stack epilogue */ s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback) { CARDControl* card; s32 result; @@ -428,77 +426,7 @@ s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback) { } return result; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 __CARDEraseSector(s32 chan, u32 addr, CARDCallback callback) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - stw r30, 0x20(r1) - stw r29, 0x1c(r1) - addi r29, r3, 0 - mulli r6, r29, 0x110 - lis r3, __CARDBlock@ha - addi r0, r3, __CARDBlock@l - add r31, r0, r6 - li r0, 0xf1 - stb r0, 0x94(r31) - rlwinm r3, r4, 0xf, 0x19, 0x1f - rlwinm r0, r4, 0x17, 0x18, 0x1f - stb r3, 0x95(r31) - li r6, 3 - addi r3, r29, 0 - stb r0, 0x96(r31) - li r0, -1 - li r4, 0 - stw r6, 0xa0(r31) - stw r0, 0xa4(r31) - stw r6, 0xa8(r31) - bl __CARDStart - addi r30, r3, 0 - cmpwi r30, -1 - bne lbl_803B8C4C - li r30, 0 - b lbl_803B8C94 -lbl_803B8C4C: - cmpwi r30, 0 - blt lbl_803B8C94 - lwz r5, 0xa0(r31) - addi r3, r29, 0 - addi r4, r31, 0x94 - li r6, 1 - bl EXIImmEx - cmpwi r3, 0 - bne lbl_803B8C80 - li r0, 0 - stw r0, 0xcc(r31) - li r30, -3 - b lbl_803B8C84 -lbl_803B8C80: - li r30, 0 -lbl_803B8C84: - mr r3, r29 - bl EXIDeselect - mr r3, r29 - bl EXIUnlock -lbl_803B8C94: - mr r3, r30 - lwz r0, 0x2c(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1c(r1) - addi r1, r1, 0x28 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif + void CARDInit(void) { int chan; @@ -557,8 +485,6 @@ s32 __CARDGetControlBlock(s32 chan, CARDControl** pcard) { return result; } -#ifdef FULL_FRANK -/* TODO: Needs frank fix for disconnected stack epilogue */ s32 __CARDPutControlBlock(CARDControl* card, s32 result) { BOOL enabled; @@ -571,44 +497,6 @@ s32 __CARDPutControlBlock(CARDControl* card, s32 result) { OSRestoreInterrupts(enabled); return result; } -#else -#pragma push -/* clang-format off */ -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 __CARDPutControlBlock(CARDControl* card, s32 result) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - addi r30, r3, 0 - bl OSDisableInterrupts - lwz r0, 0(r30) - cmpwi r0, 0 - beq lbl_803B8E8C - stw r31, 4(r30) - b lbl_803B8E9C -lbl_803B8E8C: - lwz r0, 4(r30) - cmpwi r0, -1 - bne lbl_803B8E9C - stw r31, 4(r30) -lbl_803B8E9C: - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif s32 CARDGetResultCode(s32 chan) { CARDControl* card; @@ -619,7 +507,6 @@ s32 CARDGetResultCode(s32 chan) { return card->result; } -#ifdef FULL_FRANK s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) { CARDControl* card; s32 result; @@ -655,114 +542,6 @@ s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) { return __CARDPutControlBlock(card, CARD_RESULT_READY); } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x30(r1) - stw r31, 0x2c(r1) - addi r31, r5, 0 - stw r30, 0x28(r1) - stw r29, 0x24(r1) - addi r29, r4, 0 - addi r4, r1, 0x18 - bl __CARDGetControlBlock - cmpwi r3, 0 - bge lbl_803B8F20 - b lbl_803B9020 -lbl_803B8F20: - lwz r3, 0x18(r1) - bl __CARDGetFatBlock - mr r30, r3 - lwz r3, 0x18(r1) - bl __CARDGetDirBlock - cmplwi r30, 0 - beq lbl_803B8F44 - cmplwi r3, 0 - bne lbl_803B8F84 -lbl_803B8F44: - lwz r30, 0x18(r1) - bl OSDisableInterrupts - lwz r0, 0(r30) - cmpwi r0, 0 - beq lbl_803B8F64 - li r0, -6 - stw r0, 4(r30) - b lbl_803B8F78 -lbl_803B8F64: - lwz r0, 4(r30) - cmpwi r0, -1 - bne lbl_803B8F78 - li r0, -6 - stw r0, 4(r30) -lbl_803B8F78: - bl OSRestoreInterrupts - li r3, -6 - b lbl_803B9020 -lbl_803B8F84: - cmplwi r29, 0 - beq lbl_803B8FA0 - lwz r4, 0x18(r1) - lhz r0, 6(r30) - lwz r4, 0xc(r4) - mullw r0, r4, r0 - stw r0, 0(r29) -lbl_803B8FA0: - cmplwi r31, 0 - beq lbl_803B8FE4 - li r0, 0 - stw r0, 0(r31) - li r5, 0 - b lbl_803B8FD8 -lbl_803B8FB8: - lbz r0, 8(r3) - cmplwi r0, 0xff - bne lbl_803B8FD0 - lwz r4, 0(r31) - addi r0, r4, 1 - stw r0, 0(r31) -lbl_803B8FD0: - addi r3, r3, 0x40 - addi r5, r5, 1 -lbl_803B8FD8: - clrlwi r0, r5, 0x10 - cmplwi r0, 0x7f - blt lbl_803B8FB8 -lbl_803B8FE4: - lwz r30, 0x18(r1) - bl OSDisableInterrupts - lwz r0, 0(r30) - cmpwi r0, 0 - beq lbl_803B9004 - li r0, 0 - stw r0, 4(r30) - b lbl_803B9018 -lbl_803B9004: - lwz r0, 4(r30) - cmpwi r0, -1 - bne lbl_803B9018 - li r0, 0 - stw r0, 4(r30) -lbl_803B9018: - bl OSRestoreInterrupts - li r3, 0 -lbl_803B9020: - lwz r0, 0x34(r1) - lwz r31, 0x2c(r1) - lwz r30, 0x28(r1) - lwz r29, 0x24(r1) - addi r1, r1, 0x30 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif static BOOL OnReset(BOOL f) { if (!f) { diff --git a/src/Dolphin/card/CARDCheck.c b/src/Dolphin/card/CARDCheck.c index 2253d556..4fc8bef8 100644 --- a/src/Dolphin/card/CARDCheck.c +++ b/src/Dolphin/card/CARDCheck.c @@ -67,7 +67,6 @@ static s32 VerifyID(CARDControl* card) { return CARD_RESULT_READY; } -#ifdef FULL_FRANK static s32 VerifyDir(CARDControl* card, int* outCurrent) { CARDDir* dir[2]; CARDDirCheck* check[2]; @@ -107,179 +106,7 @@ static s32 VerifyDir(CARDControl* card, int* outCurrent) { } return errors; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -static asm s32 VerifyDir(CARDControl* card, int* outCurrent) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x38(r1) - stw r31, 0x34(r1) - addi r7, r1, 0x1c - addi r8, r1, 0x14 - stw r30, 0x30(r1) - li r31, 0 - li r30, 0 - stw r29, 0x2c(r1) - addi r29, r4, 0 - li r4, 0 -lbl_803BB038: - addi r0, r4, 1 - lwz r5, 0x80(r3) - slwi r0, r0, 0xd - add r0, r5, r0 - stw r0, 0(r7) - li r6, 0x1ffc - srawi r6, r6, 1 - lwz r5, 0(r7) - addze. r6, r6 - li r11, 0 - addi r0, r5, 0x1fc0 - stw r0, 0(r8) - li r10, 0 - lwz r5, 0(r7) - ble lbl_803BB12C - rlwinm. r0, r6, 0x1d, 3, 0x1f - mtctr r0 - beq lbl_803BB110 -lbl_803BB080: - lhz r9, 0(r5) - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 2(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 4(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 6(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 8(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xa(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xc(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xe(r5) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - add r11, r11, r0 - addi r5, r5, 0x10 - bdnz lbl_803BB080 - andi. r6, r6, 7 - beq lbl_803BB12C -lbl_803BB110: - mtctr r6 -lbl_803BB114: - lhz r9, 0(r5) - addi r5, r5, 2 - nor r0, r9, r9 - add r10, r10, r9 - add r11, r11, r0 - bdnz lbl_803BB114 -lbl_803BB12C: - clrlwi r0, r10, 0x10 - cmplwi r0, 0xffff - bne lbl_803BB13C - li r10, 0 -lbl_803BB13C: - clrlwi r0, r11, 0x10 - cmplwi r0, 0xffff - bne lbl_803BB14C - li r11, 0 -lbl_803BB14C: - lwz r6, 0(r8) - clrlwi r5, r10, 0x10 - lhz r0, 0x3c(r6) - cmplw r5, r0 - bne lbl_803BB170 - lhz r0, 0x3e(r6) - clrlwi r5, r11, 0x10 - cmplw r5, r0 - beq lbl_803BB180 -lbl_803BB170: - li r0, 0 - stw r0, 0x84(r3) - addi r30, r4, 0 - addi r31, r31, 1 -lbl_803BB180: - addi r4, r4, 1 - cmpwi r4, 2 - addi r7, r7, 4 - addi r8, r8, 4 - blt lbl_803BB038 - cmpwi r31, 0 - bne lbl_803BB21C - lwz r4, 0x84(r3) - cmplwi r4, 0 - bne lbl_803BB200 - lwz r5, 0x18(r1) - lwz r4, 0x14(r1) - lha r5, 0x3a(r5) - lha r0, 0x3a(r4) - subf. r0, r5, r0 - bge lbl_803BB1C8 - li r30, 0 - b lbl_803BB1CC -lbl_803BB1C8: - li r30, 1 -lbl_803BB1CC: - slwi r0, r30, 2 - addi r6, r1, 0x1c - add r6, r6, r0 - lwz r4, 0(r6) - xori r0, r30, 1 - slwi r0, r0, 2 - stw r4, 0x84(r3) - addi r4, r1, 0x1c - li r5, 0x2000 - lwz r3, 0(r6) - lwzx r4, r4, r0 - bl memcpy - b lbl_803BB21C -lbl_803BB200: - lwz r0, 0x1c(r1) - cmplw r4, r0 - bne lbl_803BB214 - li r0, 0 - b lbl_803BB218 -lbl_803BB214: - li r0, 1 -lbl_803BB218: - mr r30, r0 -lbl_803BB21C: - cmplwi r29, 0 - beq lbl_803BB228 - stw r30, 0(r29) -lbl_803BB228: - mr r3, r31 - lwz r0, 0x3c(r1) - lwz r31, 0x34(r1) - lwz r30, 0x30(r1) - lwz r29, 0x2c(r1) - addi r1, r1, 0x38 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif -#ifdef FULL_FRANK static s32 VerifyFAT(CARDControl* card, int* outCurrent) { u16* fat[2]; u16* fatp; @@ -336,200 +163,6 @@ static s32 VerifyFAT(CARDControl* card, int* outCurrent) { } return errors; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off - -static asm s32 VerifyFAT(CARDControl* card, int* outCurrent) { - nofralloc - mflr r0 - li r5, 0 - stw r0, 4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - li r31, 0 - stw r30, 0x20(r1) - li r30, 0 - stw r29, 0x1c(r1) - addi r29, r4, 0 - addi r4, r1, 0x10 -lbl_803BB274: - li r8, 0x1ffc - lwz r6, 0x80(r3) - addi r0, r5, 3 - srawi r8, r8, 1 - slwi r0, r0, 0xd - add r7, r6, r0 - addze. r8, r8 - stw r7, 0(r4) - addi r6, r7, 4 - li r11, 0 - li r10, 0 - ble lbl_803BB35C - rlwinm. r0, r8, 0x1d, 3, 0x1f - mtctr r0 - beq lbl_803BB340 -lbl_803BB2B0: - lhz r9, 0(r6) - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 2(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 4(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 6(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 8(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xa(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xc(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - lhz r9, 0xe(r6) - add r11, r11, r0 - nor r0, r9, r9 - add r10, r10, r9 - add r11, r11, r0 - addi r6, r6, 0x10 - bdnz lbl_803BB2B0 - andi. r8, r8, 7 - beq lbl_803BB35C -lbl_803BB340: - mtctr r8 -lbl_803BB344: - lhz r9, 0(r6) - addi r6, r6, 2 - nor r0, r9, r9 - add r10, r10, r9 - add r11, r11, r0 - bdnz lbl_803BB344 -lbl_803BB35C: - clrlwi r0, r10, 0x10 - cmplwi r0, 0xffff - bne lbl_803BB36C - li r10, 0 -lbl_803BB36C: - clrlwi r0, r11, 0x10 - cmplwi r0, 0xffff - bne lbl_803BB37C - li r11, 0 -lbl_803BB37C: - lhz r6, 0(r7) - clrlwi r0, r10, 0x10 - cmplw r6, r0 - bne lbl_803BB39C - lhz r6, 2(r7) - clrlwi r0, r11, 0x10 - cmplw r6, r0 - beq lbl_803BB3B0 -lbl_803BB39C: - li r0, 0 - stw r0, 0x88(r3) - addi r30, r5, 0 - addi r31, r31, 1 - b lbl_803BB408 -lbl_803BB3B0: - lhz r8, 0x10(r3) - addi r6, r7, 0xa - li r10, 0 - li r9, 5 - b lbl_803BB3DC -lbl_803BB3C4: - lhz r0, 0(r6) - cmplwi r0, 0 - bne lbl_803BB3D4 - addi r10, r10, 1 -lbl_803BB3D4: - addi r6, r6, 2 - addi r9, r9, 1 -lbl_803BB3DC: - clrlwi r0, r9, 0x10 - cmplw r0, r8 - blt lbl_803BB3C4 - lhz r0, 6(r7) - clrlwi r6, r10, 0x10 - cmplw r6, r0 - beq lbl_803BB408 - li r0, 0 - stw r0, 0x88(r3) - addi r30, r5, 0 - addi r31, r31, 1 -lbl_803BB408: - addi r5, r5, 1 - cmpwi r5, 2 - addi r4, r4, 4 - blt lbl_803BB274 - cmpwi r31, 0 - bne lbl_803BB4A0 - lwz r4, 0x88(r3) - cmplwi r4, 0 - bne lbl_803BB484 - lwz r5, 0x14(r1) - lwz r4, 0x10(r1) - lha r5, 4(r5) - lha r0, 4(r4) - subf. r0, r5, r0 - bge lbl_803BB44C - li r30, 0 - b lbl_803BB450 -lbl_803BB44C: - li r30, 1 -lbl_803BB450: - slwi r0, r30, 2 - addi r6, r1, 0x10 - add r6, r6, r0 - lwz r4, 0(r6) - xori r0, r30, 1 - slwi r0, r0, 2 - stw r4, 0x88(r3) - addi r4, r1, 0x10 - li r5, 0x2000 - lwz r3, 0(r6) - lwzx r4, r4, r0 - bl memcpy - b lbl_803BB4A0 -lbl_803BB484: - lwz r0, 0x10(r1) - cmplw r4, r0 - bne lbl_803BB498 - li r0, 0 - b lbl_803BB49C -lbl_803BB498: - li r0, 1 -lbl_803BB49C: - mr r30, r0 -lbl_803BB4A0: - cmplwi r29, 0 - beq lbl_803BB4AC - stw r30, 0(r29) -lbl_803BB4AC: - mr r3, r31 - lwz r0, 0x2c(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1c(r1) - addi r1, r1, 0x28 - mtlr r0 - blr -} - -/* clang-format on */ -#pragma pop -#endif s32 __CARDVerify(CARDControl* card) { s32 result; diff --git a/src/Dolphin/dsp/dsp.c b/src/Dolphin/dsp/dsp.c index cab7a390..c40e0e35 100644 --- a/src/Dolphin/dsp/dsp.c +++ b/src/Dolphin/dsp/dsp.c @@ -84,7 +84,6 @@ void DSPHalt(void) { u32 DSPGetDMAStatus(void) { return __DSPRegs[5] & 0x200; } -#ifdef FULL_FRANK DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { u32 oldInt; oldInt = OSDisableInterrupts(); @@ -98,48 +97,7 @@ DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { return task; } -#else -#pragma push -#include "__ppc_eabi_linker.h" -/* clang-format off */ -#pragma optimization_level 0 -#pragma optimizewithasm off -extern void __DSP_insert_task(DSPTaskInfo* task); -asm DSPTaskInfo* DSPAddTask(DSPTaskInfo* task) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - bl OSDisableInterrupts - addi r31, r3, 0 - addi r3, r30, 0 - bl __DSP_insert_task - li r0, 0 - stw r0, 0(r30) - li r0, 1 - addi r3, r31, 0 - stw r0, 8(r30) - bl OSRestoreInterrupts - lwz r0, __DSP_first_task - cmplw r30, r0 - bne lbl_8036FBB4 - mr r3, r30 - bl __DSP_boot_task -lbl_8036FBB4: - mr r3, r30 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -#endif -/* clang-format on */ + #ifdef __cplusplus } #endif diff --git a/src/Dolphin/dvd/dvdfatal.c b/src/Dolphin/dvd/dvdfatal.c index ea8093c2..503ddb56 100644 --- a/src/Dolphin/dvd/dvdfatal.c +++ b/src/Dolphin/dvd/dvdfatal.c @@ -73,7 +73,6 @@ static void ShowMessage(void) { OSFatal(fg, bg, message); } -#ifdef FULL_FRANK BOOL DVDSetAutoFatalMessaging(BOOL enable) { BOOL enabled; BOOL prev; @@ -84,49 +83,6 @@ BOOL DVDSetAutoFatalMessaging(BOOL enable) { OSRestoreInterrupts(enabled); return prev; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm BOOL DVDSetAutoFatalMessaging(BOOL enable) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - bl OSDisableInterrupts - lwz r0, FatalFunc - cmplwi r0, 0 - beq lbl_80374DFC - li r31, 1 - b lbl_80374E00 -lbl_80374DFC: - li r31, 0 -lbl_80374E00: - cmpwi r30, 0 - beq lbl_80374E14 - lis r4, ShowMessage@ha - addi r0, r4, ShowMessage@l - b lbl_80374E18 -lbl_80374E14: - li r0, 0 -lbl_80374E18: - stw r0, FatalFunc - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format off */ -#endif void __DVDPrintFatalMessage(void) { if (!FatalFunc) { diff --git a/src/Dolphin/dvd/dvdfs.c b/src/Dolphin/dvd/dvdfs.c index d0dc27cc..95394132 100644 --- a/src/Dolphin/dvd/dvdfs.c +++ b/src/Dolphin/dvd/dvdfs.c @@ -193,30 +193,10 @@ BOOL DVDOpen(char* fileName, DVDFileInfo* fileInfo) { return TRUE; } -#ifdef FULL_FRANK BOOL DVDClose(DVDFileInfo* fileInfo) { DVDCancel(&(fileInfo->cb)); return TRUE; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm BOOL DVDClose(DVDFileInfo* fileInfo) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -8(r1) - bl DVDCancel - li r3, 1 - lwz r0, 0xc(r1) - addi r1, r1, 8 - mtlr r0 - blr -} -#pragma pop -#endif static u32 myStrncpy(char* dest, char* src, u32 maxlen) { u32 i = maxlen; diff --git a/src/Dolphin/os/OSError.c b/src/Dolphin/os/OSError.c index 3859a62d..71853996 100644 --- a/src/Dolphin/os/OSError.c +++ b/src/Dolphin/os/OSError.c @@ -40,7 +40,6 @@ __declspec(weak) void OSPanic(const char* file, int line, const char* msg, ...) PPCHalt(); } -#ifdef FULL_FRANK OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) { OSErrorHandler oldHandler; BOOL enabled; @@ -101,160 +100,7 @@ OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) { OSRestoreInterrupts(enabled); return oldHandler; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm OSErrorHandler OSSetErrorHandler(OSError error, OSErrorHandler handler) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x30(r1) - stw r31, 0x2c(r1) - stw r30, 0x28(r1) - stw r29, 0x24(r1) - addi r29, r3, 0 - stw r28, 0x20(r1) - addi r28, r4, 0 - bl OSDisableInterrupts - lis r4, __OSErrorTable@ha - rlwinm r5, r29, 2, 0xe, 0x1d - addi r0, r4, __OSErrorTable@l - clrlwi r6, r29, 0x10 - add r4, r0, r5 - lwz r30, 0(r4) - cmplwi r6, 0x10 - mr r29, r3 - stw r28, 0(r4) - bne lbl_8037FD44 - bl PPCMfmsr - addi r31, r3, 0 - ori r3, r31, 0x2000 - bl PPCMtmsr - bl PPCMffpscr - cmplwi r28, 0 - beq lbl_8037FCD8 - lis r5, __OSActiveThreadQueue@ha - lis r4, 0x6005F8FF@ha - lwz r6, __OSActiveThreadQueue@l(r5) - addi r4, r4, 0x6005F8FF@l - b lbl_8037FCBC -lbl_8037FBD8: - lwz r0, 0x19c(r6) - ori r0, r0, 0x900 - stw r0, 0x19c(r6) - lhz r5, 0x1a2(r6) - clrlwi. r0, r5, 0x1f - bne lbl_8037FC98 - ori r5, r5, 1 - li r0, 4 - sth r5, 0x1a2(r6) - mtctr r0 - addi r5, r6, 0 -lbl_8037FC04: - li r0, -1 - stw r0, 0x94(r5) - stw r0, 0x90(r5) - stw r0, 0x1cc(r5) - stw r0, 0x1c8(r5) - stw r0, 0x9c(r5) - stw r0, 0x98(r5) - stw r0, 0x1d4(r5) - stw r0, 0x1d0(r5) - stw r0, 0xa4(r5) - stw r0, 0xa0(r5) - stw r0, 0x1dc(r5) - stw r0, 0x1d8(r5) - stw r0, 0xac(r5) - stw r0, 0xa8(r5) - stw r0, 0x1e4(r5) - stw r0, 0x1e0(r5) - stw r0, 0xb4(r5) - stw r0, 0xb0(r5) - stw r0, 0x1ec(r5) - stw r0, 0x1e8(r5) - stw r0, 0xbc(r5) - stw r0, 0xb8(r5) - stw r0, 0x1f4(r5) - stw r0, 0x1f0(r5) - stw r0, 0xc4(r5) - stw r0, 0xc0(r5) - stw r0, 0x1fc(r5) - stw r0, 0x1f8(r5) - stw r0, 0xcc(r5) - stw r0, 0xc8(r5) - stw r0, 0x204(r5) - stw r0, 0x200(r5) - addi r5, r5, 0x40 - bdnz lbl_8037FC04 - li r0, 4 - stw r0, 0x194(r6) -lbl_8037FC98: - lwz r0, __OSFpscrEnableBits - lwz r5, 0x194(r6) - rlwinm r0, r0, 0, 0x18, 0x1c - or r0, r5, r0 - stw r0, 0x194(r6) - lwz r0, 0x194(r6) - and r0, r0, r4 - stw r0, 0x194(r6) - lwz r6, 0x2fc(r6) -lbl_8037FCBC: - cmplwi r6, 0 - bne lbl_8037FBD8 - lwz r0, __OSFpscrEnableBits - ori r31, r31, 0x900 - rlwinm r0, r0, 0, 0x18, 0x1c - or r3, r3, r0 - b lbl_8037FD2C -lbl_8037FCD8: - lis r5, __OSActiveThreadQueue@ha - lis r4, 0x6005F8FF@ha - lwz r6, __OSActiveThreadQueue@l(r5) - addi r4, r4, 0x6005F8FF@l - li r5, -2305 - b lbl_8037FD18 -lbl_8037FCF0: - lwz r0, 0x19c(r6) - and r0, r0, r5 - stw r0, 0x19c(r6) - lwz r0, 0x194(r6) - rlwinm r0, r0, 0, 0x1d, 0x17 - stw r0, 0x194(r6) - lwz r0, 0x194(r6) - and r0, r0, r4 - stw r0, 0x194(r6) - lwz r6, 0x2fc(r6) -lbl_8037FD18: - cmplwi r6, 0 - bne lbl_8037FCF0 - li r0, -2305 - rlwinm r3, r3, 0, 0x1d, 0x17 - and r31, r31, r0 -lbl_8037FD2C: - lis r4, 0x6005F8FF@ha - addi r0, r4, 0x6005F8FF@l - and r3, r3, r0 - bl PPCMtfpscr - mr r3, r31 - bl PPCMtmsr -lbl_8037FD44: - mr r3, r29 - bl OSRestoreInterrupts - mr r3, r30 - lwz r0, 0x34(r1) - lwz r31, 0x2c(r1) - lwz r30, 0x28(r1) - lwz r29, 0x24(r1) - lwz r28, 0x20(r1) - addi r1, r1, 0x30 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif + void __OSUnhandledException(__OSException exception, OSContext* context, u32 dsisr, u32 dar) { OSTime now; diff --git a/src/Dolphin/os/OSMemory.c b/src/Dolphin/os/OSMemory.c index 8f76aa89..92a7d35f 100644 --- a/src/Dolphin/os/OSMemory.c +++ b/src/Dolphin/os/OSMemory.c @@ -13,7 +13,6 @@ static OSResetFunctionInfo ResetFunctionInfo = { 127, }; -#ifdef FULL_FRANK static BOOL OnReset(BOOL final) { if (final != FALSE) { __MEMRegs[8] = 0xFF; @@ -21,33 +20,6 @@ static BOOL OnReset(BOOL final) { } return TRUE; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm BOOL OnReset(BOOL final) { - nofralloc - mflr r0 - cmpwi r3, 0 - stw r0, 4(r1) - stwu r1, -8(r1) - beq @1 - lis r3, __MEMRegs+16@ha - li r0, 0xff - sth r0, __MEMRegs+16@l(r3) - lis r3, 0xf000 - bl __OSMaskInterrupts -@1 - li r3, 1 - lwz r0, 0xc(r1) - addi r1, r1, 8 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif u32 OSGetPhysicalMemSize() { return *(u32*)(OSPhysicalToCached(0x0028)); } diff --git a/src/Dolphin/os/OSResetSW.c b/src/Dolphin/os/OSResetSW.c index 97522133..59e70494 100644 --- a/src/Dolphin/os/OSResetSW.c +++ b/src/Dolphin/os/OSResetSW.c @@ -34,7 +34,6 @@ void __OSResetSWInterruptHandler(__OSInterrupt interrupt, OSContext* context) { __PIRegs[0] = 2; } -#ifdef FULL_FRANK BOOL OSGetResetButtonState(void) { BOOL enabled; BOOL state; @@ -88,194 +87,3 @@ BOOL OSGetResetButtonState(void) { OSRestoreInterrupts(enabled); return state; } -#else -extern void __div2i(void); -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm BOOL OSGetResetButtonState(void) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - stw r29, 0xc(r1) - bl OSDisableInterrupts - mr r30, r3 - bl __OSGetSystemTime - lis r5, __PIRegs@ha - lwz r0, __PIRegs@l(r5) - rlwinm. r0, r0, 0, 0xf, 0xf - bne lbl_8038369C - lwz r0, Down - cmpwi r0, 0 - bne lbl_8038360C - lwz r0, HoldUp - li r6, 0 - lwz r5, HoldUp+4 - li r7, 1 - xor r0, r0, r6 - xor r5, r5, r6 - stw r7, Down - or. r0, r5, r0 - beq lbl_803835F8 - b lbl_803835FC -lbl_803835F8: - mr r7, r6 -lbl_803835FC: - stw r4, HoldDown+4 - mr r29, r7 - stw r3, HoldDown - b lbl_80383750 -lbl_8038360C: - lwz r0, HoldUp - li r9, 0 - lwz r5, HoldUp+4 - li r10, 1 - xor r0, r0, r9 - xor r5, r5, r9 - or. r0, r5, r0 - bne lbl_80383680 - lis r6, __OSBusClock@ha - lwz r5, HoldDown+4 - lwz r7, __OSBusClock@l(r6) - lis r6, 0x431BDE83@ha - addi r8, r6, 0x431BDE83@l - lwz r0, HoldDown - srwi r6, r7, 2 - mulhwu r6, r8, r6 - srwi r6, r6, 0xf - mulli r6, r6, 0x64 - subfc r7, r5, r4 - subfe r0, r0, r3 - srwi r8, r6, 3 - xoris r5, r0, 0x8000 - xoris r6, r9, 0x8000 - subfc r0, r7, r8 - subfe r5, r5, r6 - subfe r5, r6, r6 - neg. r5, r5 - bne lbl_80383680 - mr r10, r9 -lbl_80383680: - cmpwi r10, 0 - beq lbl_80383690 - li r0, 1 - b lbl_80383694 -lbl_80383690: - li r0, 0 -lbl_80383694: - mr r29, r0 - b lbl_80383750 -lbl_8038369C: - lwz r0, Down - cmpwi r0, 0 - beq lbl_803836D8 - lwz r5, LastState - li r0, 0 - stw r0, Down - cmpwi r5, 0 - addi r29, r5, 0 - beq lbl_803836CC - stw r4, HoldUp+4 - stw r3, HoldUp - b lbl_80383750 -lbl_803836CC: - stw r0, HoldUp+4 - stw r0, HoldUp - b lbl_80383750 -lbl_803836D8: - lwz r6, HoldUp - li r8, 0 - lwz r7, HoldUp+4 - xor r0, r6, r8 - xor r5, r7, r8 - or. r0, r5, r0 - beq lbl_80383740 - lis r5, __OSBusClock@ha - lwz r0, __OSBusClock@l(r5) - lis r5, 0x10624DD3@ha - addi r5, r5, 0x10624DD3@l - srwi r0, r0, 2 - mulhwu r0, r5, r0 - srwi r0, r0, 6 - mulli r0, r0, 0x28 - subfc r7, r7, r4 - subfe r5, r6, r3 - xoris r6, r5, 0x8000 - xoris r5, r8, 0x8000 - subfc r0, r0, r7 - subfe r5, r5, r6 - subfe r5, r6, r6 - neg. r5, r5 - beq lbl_80383740 - li r29, 1 - b lbl_80383750 -lbl_80383740: - li r0, 0 - stw r0, HoldUp+4 - li r29, 0 - stw r0, HoldUp -lbl_80383750: - lis r5, GameChoice@ha - stw r29, LastState - lbz r0, GameChoice@l(r5) - clrlwi. r0, r0, 0x1a - beq lbl_80383800 - mulli r10, r0, 0x3c - lwz r0, 0xf8(r5) - lwz r9, __OSStartTime+4 - lwz r8, __OSStartTime - srwi r6, r0, 2 - srawi r0, r10, 0x1f - mullw r7, r0, r6 - mulhwu r0, r10, r6 - mullw r5, r10, r6 - addc r9, r9, r5 - li r31, 0 - add r7, r7, r0 - mullw r0, r10, r31 - add r0, r7, r0 - adde r8, r8, r0 - xoris r7, r8, 0x8000 - xoris r5, r3, 0x8000 - subfc r0, r4, r9 - subfe r5, r5, r7 - subfe r5, r7, r7 - neg. r5, r5 - beq lbl_80383800 - subfc r4, r9, r4 - subfe r3, r8, r3 - li r5, 0 - bl __div2i - li r5, 0 - li r6, 2 - bl __div2i - li r0, 1 - and r4, r4, r0 - and r0, r3, r31 - xor r3, r4, r31 - xor r0, r0, r31 - or. r0, r3, r0 - bne lbl_803837FC - li r29, 1 - b lbl_80383800 -lbl_803837FC: - li r29, 0 -lbl_80383800: - mr r3, r30 - bl OSRestoreInterrupts - mr r3, r29 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - lwz r29, 0xc(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif diff --git a/src/Dolphin/os/OSRtc.c b/src/Dolphin/os/OSRtc.c index be146706..42d7ba62 100644 --- a/src/Dolphin/os/OSRtc.c +++ b/src/Dolphin/os/OSRtc.c @@ -172,44 +172,7 @@ static void* LockSram(u32 offset) { return Scb.sram + offset; } -#ifdef FULL_FRANK OSSram* __OSLockSram() { return LockSram(0); } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm OSSram* __OSLockSram() { - nofralloc - mflr r0 - lis r3, Scb@ha - stw r0, 4(r1) - stwu r1, -0x10(r1) - stw r31, 0xc(r1) - addi r31, r3, Scb@l - bl OSDisableInterrupts - lwz r0, 0x48(r31) - addi r4, r31, 0x48 - cmpwi r0, 0 - beq lbl_80383B0C - bl OSRestoreInterrupts - li r31, 0 - b lbl_80383B18 -lbl_80383B0C: - stw r3, 0x44(r31) - li r0, 1 - stw r0, 0(r4) -lbl_80383B18: - mr r3, r31 - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - addi r1, r1, 0x10 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif OSSramEx* __OSLockSramEx() { return LockSram(sizeof(OSSram)); } @@ -278,7 +241,6 @@ BOOL __OSReadROM(void* buffer, s32 length, s32 offset) { } inline OSSram* __OSLockSramHACK() { return LockSram(0); } -#ifdef FULL_FRANK u32 OSGetSoundMode() { OSSram* sram; u32 mode; @@ -288,54 +250,7 @@ u32 OSGetSoundMode() { __OSUnlockSram(FALSE); return mode; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm u32 OSGetSoundMode() { - nofralloc - mflr r0 - lis r3, Scb@ha - stw r0, 4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1c(r1) - addi r31, r3, Scb@l - bl OSDisableInterrupts - lwz r0, 0x48(r31) - addi r4, r31, 0x48 - cmpwi r0, 0 - beq lbl_80384048 - bl OSRestoreInterrupts - li r31, 0 - b lbl_80384054 -lbl_80384048: - stw r3, 0x44(r31) - li r0, 1 - stw r0, 0(r4) -lbl_80384054: - lbz r0, 0x13(r31) - rlwinm. r0, r0, 0, 0x1d, 0x1d - beq lbl_80384068 - li r31, 1 - b lbl_8038406C -lbl_80384068: - li r31, 0 -lbl_8038406C: - li r3, 0 - li r4, 0 - bl UnlockSram - mr r3, r31 - lwz r0, 0x24(r1) - lwz r31, 0x1c(r1) - addi r1, r1, 0x20 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif void OSSetSoundMode(u32 mode) { OSSram* sram; mode <<= 2; @@ -352,7 +267,6 @@ void OSSetSoundMode(u32 mode) { __OSUnlockSram(TRUE); } -#ifdef FULL_FRANK u32 OSGetProgressiveMode() { OSSram* sram; u32 mode; @@ -362,47 +276,6 @@ u32 OSGetProgressiveMode() { __OSUnlockSram(FALSE); return mode; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm u32 OSGetProgressiveMode() { - nofralloc -/* 80384134 00381094 7C 08 02 A6 */ mflr r0 -/* 80384138 00381098 3C 60 80 54 */ lis r3, Scb@ha -/* 8038413C 0038109C 90 01 00 04 */ stw r0, 4(r1) -/* 80384140 003810A0 94 21 FF E8 */ stwu r1, -0x18(r1) -/* 80384144 003810A4 93 E1 00 14 */ stw r31, 0x14(r1) -/* 80384148 003810A8 3B E3 15 A0 */ addi r31, r3, Scb@l -/* 8038414C 003810AC 4B FF D5 15 */ bl OSDisableInterrupts -/* 80384150 003810B0 80 1F 00 48 */ lwz r0, 0x48(r31) -/* 80384154 003810B4 38 9F 00 48 */ addi r4, r31, 0x48 -/* 80384158 003810B8 2C 00 00 00 */ cmpwi r0, 0 -/* 8038415C 003810BC 41 82 00 10 */ beq lbl_8038416C -/* 80384160 003810C0 4B FF D5 29 */ bl OSRestoreInterrupts -/* 80384164 003810C4 3B E0 00 00 */ li r31, 0 -/* 80384168 003810C8 48 00 00 10 */ b lbl_80384178 -lbl_8038416C: -/* 8038416C 003810CC 90 7F 00 44 */ stw r3, 0x44(r31) -/* 80384170 003810D0 38 00 00 01 */ li r0, 1 -/* 80384174 003810D4 90 04 00 00 */ stw r0, 0(r4) -lbl_80384178: -/* 80384178 003810D8 88 1F 00 13 */ lbz r0, 0x13(r31) -/* 8038417C 003810DC 38 60 00 00 */ li r3, 0 -/* 80384180 003810E0 38 80 00 00 */ li r4, 0 -/* 80384184 003810E4 54 1F CF FE */ rlwinm r31, r0, 0x19, 0x1f, 0x1f -/* 80384188 003810E8 4B FF FA 05 */ bl UnlockSram -/* 8038418C 003810EC 7F E3 FB 78 */ mr r3, r31 -/* 80384190 003810F0 80 01 00 1C */ lwz r0, 0x1c(r1) -/* 80384194 003810F4 83 E1 00 14 */ lwz r31, 0x14(r1) -/* 80384198 003810F8 38 21 00 18 */ addi r1, r1, 0x18 -/* 8038419C 003810FC 7C 08 03 A6 */ mtlr r0 -/* 803841A0 00381100 4E 80 00 20 */ blr -} -#pragma pop -/* clang-format on */ -#endif void OSSetProgressiveMode(u32 mode) { OSSram* sram; @@ -420,7 +293,6 @@ void OSSetProgressiveMode(u32 mode) { __OSUnlockSram(TRUE); } -#ifdef FULL_FRANK u8 OSGetLanguage() { OSSram* sram; u8 language; @@ -430,48 +302,7 @@ u8 OSGetLanguage() { __OSUnlockSram(FALSE); return language; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm u8 OSGetLanguage() { - nofralloc - mflr r0 - lis r3, Scb@ha - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r3, Scb@l - bl OSDisableInterrupts - lwz r0, 0x48(r31) - addi r4, r31, 0x48 - cmpwi r0, 0 - beq lbl_80384280 - bl OSRestoreInterrupts - li r31, 0 - b lbl_8038428C -lbl_80384280: - stw r3, 0x44(r31) - li r0, 1 - stw r0, 0(r4) -lbl_8038428C: - lbz r31, 0x12(r31) - li r3, 0 - li r4, 0 - bl UnlockSram - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif -#ifdef FULL_FRANK u16 OSGetWirelessID(s32 channel) { OSSramEx* sram; u16 id; @@ -481,54 +312,6 @@ u16 OSGetWirelessID(s32 channel) { __OSUnlockSramEx(FALSE); return id; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off - -asm u16 OSGetWirelessID(s32 channel) { - nofralloc - mflr r0 - lis r4, Scb@ha - stw r0, 4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1c(r1) - addi r31, r4, Scb@l - stw r30, 0x18(r1) - addi r30, r3, 0 - bl OSDisableInterrupts - lwz r0, 0x48(r31) - addi r4, r31, 0x48 - cmpwi r0, 0 - beq lbl_803842F4 - bl OSRestoreInterrupts - li r3, 0 - b lbl_80384304 -lbl_803842F4: - stw r3, 0x44(r31) - li r0, 1 - addi r3, r31, 0x14 - stw r0, 0(r4) -lbl_80384304: - slwi r0, r30, 1 - add r3, r3, r0 - lhz r31, 0x1c(r3) - li r3, 0 - li r4, 0x14 - bl UnlockSram - mr r3, r31 - lwz r0, 0x24(r1) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - addi r1, r1, 0x20 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif - void OSSetWirelessID(s32 channel, u16 id) { OSSramEx* sram; diff --git a/src/Dolphin/os/OSThread.c b/src/Dolphin/os/OSThread.c index 07afd9b0..47339e40 100644 --- a/src/Dolphin/os/OSThread.c +++ b/src/Dolphin/os/OSThread.c @@ -129,8 +129,6 @@ void OSInitThreadQueue(OSThreadQueue* queue) { queue->head = queue->tail = NULL; OSThread* OSGetCurrentThread() { return __OSCurrentThread; } -#ifdef FULL_FRANK -/* Code matches, stack epilogue bug*/ s32 OSDisableScheduler() { BOOL enabled; s32 count; @@ -140,36 +138,7 @@ s32 OSDisableScheduler() { OSRestoreInterrupts(enabled); return count; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm s32 OSDisableScheduler() { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x10(r1) - stw r31, 0xc(r1) - bl OSDisableInterrupts - lwz r4, Reschedule - addi r0, r4, 1 - stw r0, Reschedule - mr r31, r4 - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - addi r1, r1, 0x10 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif -#ifdef FULL_FRANK -/* Code matches, stack epilogue bug*/ s32 OSEnableScheduler() { BOOL enabled; s32 count; @@ -179,33 +148,6 @@ s32 OSEnableScheduler() { OSRestoreInterrupts(enabled); return count; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level -#pragma optimizewithasm off -asm s32 OSEnableScheduler() { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x10(r1) - stw r31, 0xc(r1) - bl OSDisableInterrupts - lwz r4, Reschedule - subi r0, r4, 1 - stw r0, Reschedule - mr r31, r4 - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - addi r1, r1, 0x10 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif static void SetRun(OSThread* thread) { thread->queue = &RunQueue[thread->priority]; @@ -405,8 +347,6 @@ void OSCancelThread(OSThread* thread) { return; } -#ifdef FULL_FRANK -/* Code matches, stack epilogue bug*/ s32 OSResumeThread(OSThread* thread) { BOOL enabled; s32 suspendCount; @@ -435,209 +375,7 @@ s32 OSResumeThread(OSThread* thread) { OSRestoreInterrupts(enabled); return suspendCount; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 OSResumeThread(OSThread* thread) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - stw r30, 0x20(r1) - stw r29, 0x1c(r1) - mr r29, r3 - bl OSDisableInterrupts - lwz r4, 0x2cc(r29) - addi r31, r3, 0 - addi r0, r4, -1 - stw r0, 0x2cc(r29) - mr r30, r4 - lwz r0, 0x2cc(r29) - cmpwi r0, 0 - bge lbl_80384D60 - li r0, 0 - stw r0, 0x2cc(r29) - b lbl_80384F74 -lbl_80384D60: - bne lbl_80384F74 - lhz r0, 0x2c8(r29) - cmpwi r0, 4 - beq lbl_80384E24 - bge lbl_80384F60 - cmpwi r0, 1 - beq lbl_80384D80 - b lbl_80384F60 -lbl_80384D80: - lwz r0, 0x2d4(r29) - lwz r3, 0x2f4(r29) - b lbl_80384DAC -lbl_80384D8C: - lwz r4, 0(r3) - cmplwi r4, 0 - beq lbl_80384DA8 - lwz r4, 0x2d0(r4) - cmpw r4, r0 - bge lbl_80384DA8 - mr r0, r4 -lbl_80384DA8: - lwz r3, 0x10(r3) -lbl_80384DAC: - cmplwi r3, 0 - bne lbl_80384D8C - stw r0, 0x2d0(r29) - lis r3, RunQueue@ha - addi r0, r3, RunQueue@l - lwz r3, 0x2d0(r29) - slwi r3, r3, 3 - add r0, r0, r3 - stw r0, 0x2dc(r29) - lwz r4, 0x2dc(r29) - lwz r3, 4(r4) - cmplwi r3, 0 - bne lbl_80384DE8 - stw r29, 0(r4) - b lbl_80384DEC -lbl_80384DE8: - stw r29, 0x2e0(r3) -lbl_80384DEC: - stw r3, 0x2e4(r29) - li r0, 0 - li r3, 1 - stw r0, 0x2e0(r29) - lwz r4, 0x2dc(r29) - stw r29, 4(r4) - lwz r0, 0x2d0(r29) - lwz r4, RunQueueBits - subfic r0, r0, 0x1f - slw r0, r3, r0 - or r0, r4, r0 - stw r0, RunQueueBits - stw r3, RunQueueHint - b lbl_80384F60 -lbl_80384E24: - lwz r4, 0x2e0(r29) - lwz r5, 0x2e4(r29) - cmplwi r4, 0 - bne lbl_80384E40 - lwz r3, 0x2dc(r29) - stw r5, 4(r3) - b lbl_80384E44 -lbl_80384E40: - stw r5, 0x2e4(r4) -lbl_80384E44: - cmplwi r5, 0 - bne lbl_80384E58 - lwz r3, 0x2dc(r29) - stw r4, 0(r3) - b lbl_80384E5C -lbl_80384E58: - stw r4, 0x2e0(r5) -lbl_80384E5C: - lwz r0, 0x2d4(r29) - lwz r3, 0x2f4(r29) - b lbl_80384E88 -lbl_80384E68: - lwz r4, 0(r3) - cmplwi r4, 0 - beq lbl_80384E84 - lwz r4, 0x2d0(r4) - cmpw r4, r0 - bge lbl_80384E84 - mr r0, r4 -lbl_80384E84: - lwz r3, 0x10(r3) -lbl_80384E88: - cmplwi r3, 0 - bne lbl_80384E68 - stw r0, 0x2d0(r29) - lwz r4, 0x2dc(r29) - lwz r5, 0(r4) - b lbl_80384EA4 -lbl_80384EA0: - lwz r5, 0x2e0(r5) -lbl_80384EA4: - cmplwi r5, 0 - beq lbl_80384EBC - lwz r3, 0x2d0(r5) - lwz r0, 0x2d0(r29) - cmpw r3, r0 - ble lbl_80384EA0 -lbl_80384EBC: - cmplwi r5, 0 - bne lbl_80384EF4 - lwz r3, 4(r4) - cmplwi r3, 0 - bne lbl_80384ED8 - stw r29, 0(r4) - b lbl_80384EDC -lbl_80384ED8: - stw r29, 0x2e0(r3) -lbl_80384EDC: - stw r3, 0x2e4(r29) - li r0, 0 - stw r0, 0x2e0(r29) - lwz r3, 0x2dc(r29) - stw r29, 4(r3) - b lbl_80384F1C -lbl_80384EF4: - stw r5, 0x2e0(r29) - lwz r3, 0x2e4(r5) - stw r29, 0x2e4(r5) - cmplwi r3, 0 - stw r3, 0x2e4(r29) - bne lbl_80384F18 - lwz r3, 0x2dc(r29) - stw r29, 0(r3) - b lbl_80384F1C -lbl_80384F18: - stw r29, 0x2e0(r3) -lbl_80384F1C: - lwz r3, 0x2f0(r29) - cmplwi r3, 0 - beq lbl_80384F60 - lwz r29, 8(r3) -lbl_80384F2C: - lwz r0, 0x2cc(r29) - cmpwi r0, 0 - bgt lbl_80384F60 - mr r3, r29 - bl __OSGetEffectivePriority - lwz r0, 0x2d0(r29) - addi r4, r3, 0 - cmpw r0, r4 - beq lbl_80384F60 - mr r3, r29 - bl SetEffectivePriority - or. r29, r3, r3 - bne lbl_80384F2C -lbl_80384F60: - lwz r0, RunQueueHint - cmpwi r0, 0 - beq lbl_80384F74 - li r3, 0 - bl SelectThread -lbl_80384F74: - mr r3, r31 - bl OSRestoreInterrupts - mr r3, r30 - lwz r0, 0x2c(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1c(r1) - addi r1, r1, 0x28 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif - -#ifdef FULL_FRANK -/* Code matches, stack epilogue bug*/ s32 OSSuspendThread(OSThread* thread) { BOOL enabled; s32 suspendCount; @@ -668,122 +406,6 @@ s32 OSSuspendThread(OSThread* thread) { OSRestoreInterrupts(enabled); return suspendCount; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm s32 OSSuspendThread(OSThread* thread) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1c(r1) - stw r30, 0x18(r1) - stw r29, 0x14(r1) - mr r29, r3 - bl OSDisableInterrupts - lwz r4, 0x2cc(r29) - addi r31, r3, 0 - addi r0, r4, 1 - or. r30, r4, r4 - stw r0, 0x2cc(r29) - bne lbl_803850E4 - lhz r0, 0x2c8(r29) - cmpwi r0, 3 - beq lbl_803850D0 - bge lbl_80384FF4 - cmpwi r0, 1 - beq lbl_80385010 - bge lbl_80385000 - b lbl_803850D0 -lbl_80384FF4: - cmpwi r0, 5 - bge lbl_803850D0 - b lbl_8038501C -lbl_80385000: - li r0, 1 - stw r0, RunQueueHint - sth r0, 0x2c8(r29) - b lbl_803850D0 -lbl_80385010: - mr r3, r29 - bl UnsetRun - b lbl_803850D0 -lbl_8038501C: - lwz r4, 0x2e0(r29) - lwz r5, 0x2e4(r29) - cmplwi r4, 0 - bne lbl_80385038 - lwz r3, 0x2dc(r29) - stw r5, 4(r3) - b lbl_8038503C -lbl_80385038: - stw r5, 0x2e4(r4) -lbl_8038503C: - cmplwi r5, 0 - bne lbl_80385050 - lwz r3, 0x2dc(r29) - stw r4, 0(r3) - b lbl_80385054 -lbl_80385050: - stw r4, 0x2e0(r5) -lbl_80385054: - li r0, 0x20 - stw r0, 0x2d0(r29) - lwz r4, 0x2dc(r29) - lwz r3, 4(r4) - cmplwi r3, 0 - bne lbl_80385074 - stw r29, 0(r4) - b lbl_80385078 -lbl_80385074: - stw r29, 0x2e0(r3) -lbl_80385078: - stw r3, 0x2e4(r29) - li r0, 0 - stw r0, 0x2e0(r29) - lwz r3, 0x2dc(r29) - stw r29, 4(r3) - lwz r3, 0x2f0(r29) - cmplwi r3, 0 - beq lbl_803850D0 - lwz r29, 8(r3) -lbl_8038509C: - lwz r0, 0x2cc(r29) - cmpwi r0, 0 - bgt lbl_803850D0 - mr r3, r29 - bl __OSGetEffectivePriority - lwz r0, 0x2d0(r29) - addi r4, r3, 0 - cmpw r0, r4 - beq lbl_803850D0 - mr r3, r29 - bl SetEffectivePriority - or. r29, r3, r3 - bne lbl_8038509C -lbl_803850D0: - lwz r0, RunQueueHint - cmpwi r0, 0 - beq lbl_803850E4 - li r3, 0 - bl SelectThread -lbl_803850E4: - mr r3, r31 - bl OSRestoreInterrupts - mr r3, r30 - lwz r0, 0x24(r1) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - addi r1, r1, 0x20 - mtlr r0 - blr -} -#pragma pop -/* clang-format on */ -#endif void OSSleepThread(OSThreadQueue* queue) { BOOL enabled; diff --git a/src/Dolphin/pad/pad.c b/src/Dolphin/pad/pad.c index 3ccf7d15..04147c62 100644 --- a/src/Dolphin/pad/pad.c +++ b/src/Dolphin/pad/pad.c @@ -730,7 +730,6 @@ static void SamplingHandler(__OSInterrupt interrupt, OSContext* context) { } } -#ifdef FULL_FRANK PADSamplingCallback PADSetSamplingCallback(PADSamplingCallback callback) { PADSamplingCallback prev; @@ -743,41 +742,7 @@ PADSamplingCallback PADSetSamplingCallback(PADSamplingCallback callback) { } return prev; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm PADSamplingCallback PADSetSamplingCallback(PADSamplingCallback callback) { - nofralloc - mflr r0 - cmplwi r3, 0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - lwz r31, SamplingCallback - stw r3, SamplingCallback - beq lbl_803875E4 - lis r3, SamplingHandler@ha - addi r3, r3, SamplingHandler@l - bl SIRegisterPollingHandler - b lbl_803875F0 -lbl_803875E4: - lis r3, SamplingHandler@ha - addi r3, r3, SamplingHandler@l - bl SIUnregisterPollingHandler -lbl_803875F0: - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -#pragma pop -#endif -#ifdef FULL_FRANK BOOL __PADDisableRecalibration(BOOL disable) { BOOL enabled; BOOL prev; @@ -791,48 +756,3 @@ BOOL __PADDisableRecalibration(BOOL disable) { OSRestoreInterrupts(enabled); return prev; } -#else -/* clang-format off */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm BOOL __PADDisableRecalibration(BOOL disable) { - nofralloc - mflr r0 - stw r0, 4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - bl OSDisableInterrupts - lis r4, UnkVal@ha - lbz r0, UnkVal@l(r4) - rlwinm. r0, r0, 0, 0x19, 0x19 - beq lbl_8038763C - li r31, 1 - b lbl_80387640 -lbl_8038763C: - li r31, 0 -lbl_80387640: - lis r4, UnkVal@ha - lbz r0, UnkVal@l(r4) - andi. r0, r0, 0xbf - cmpwi r30, 0 - stb r0, UnkVal@l(r4) - beq lbl_80387664 - lbz r0, UnkVal@l(r4) - ori r0, r0, 0x40 - stb r0, UnkVal@l(r4) -lbl_80387664: - bl OSRestoreInterrupts - mr r3, r31 - lwz r0, 0x1c(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr -} -/* clang-format on */ -#pragma pop -#endif