diff --git a/configure.py b/configure.py index 27e265f9..e1a87be6 100755 --- a/configure.py +++ b/configure.py @@ -699,11 +699,11 @@ LIBS = [ }, { "lib": "ai", - "mwcc_version": "1.2.5", + "mwcc_version": "1.2.5e", "cflags": "$cflags_base", "host": False, "objects": [ - ["Dolphin/ai", False], + ["Dolphin/ai", True], ], }, { diff --git a/src/Dolphin/ai.c b/src/Dolphin/ai.c index 9d65b1ec..62e350a2 100644 --- a/src/Dolphin/ai.c +++ b/src/Dolphin/ai.c @@ -22,6 +22,7 @@ void __AIDHandler(s16 interrupt, OSContext* context); void __AICallbackStackSwitch(register AIDCallback cb); void __AI_SRC_INIT(void); +#if NONMATCHING AIDCallback AIRegisterDMACallback(AIDCallback callback) { s32 oldInts; AIDCallback ret; @@ -32,6 +33,34 @@ 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; @@ -50,6 +79,7 @@ u32 AIGetDMAStartAddr(void) { return (u32)((__DSPRegs[24] & 0x03ff) << 16) | (__DSPRegs[25] & 0xffe0); } +#if NONMATCHING AISCallback AIRegisterStreamCallback(AISCallback callback) { AISCallback ret; s32 oldInts; @@ -60,6 +90,34 @@ 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/pad/pad.c b/src/Dolphin/pad/pad.c index 98c21a50..4cbabe4d 100644 --- a/src/Dolphin/pad/pad.c +++ b/src/Dolphin/pad/pad.c @@ -833,5 +833,6 @@ lbl_80387664: mtlr r0 blr } +/* clang-format on */ #pragma pop #endif