From ddbf0ce3ebde231d7a4ff3512ab437d69e890a5a Mon Sep 17 00:00:00 2001 From: EpochFlame Date: Tue, 19 Sep 2023 21:10:54 -0400 Subject: [PATCH] purge HW_REG usage resolves #155 --- docs/recommended_todo.md | 3 ++- include/Dolphin/si.h | 11 +++++------ src/Dolphin/gx/GXDisplayList.c | 7 +++---- src/Dolphin/gx/GXFifo.c | 4 ++-- src/Dolphin/si/SIBios.c | 15 ++++++--------- 5 files changed, 18 insertions(+), 22 deletions(-) diff --git a/docs/recommended_todo.md b/docs/recommended_todo.md index 99c511e5a..285357b3b 100644 --- a/docs/recommended_todo.md +++ b/docs/recommended_todo.md @@ -19,7 +19,7 @@ ###
Dolphin
| File | Size (bytes) | File | Size (bytes) | | ---- | ---- | ---- | ---- | -| TRK_MINNOW_DOLPHIN/targsupp.c | 326 | gx/GXDisplayList.c | 647 | +| TRK_MINNOW_DOLPHIN/targsupp.c | 326 | gx/GXDisplayList.c | 582 | | Runtime/__init_cpp_exceptions.cpp | 684 | Runtime/global_destructor_chain.c | 965 | | mtx/mtxvec.c | 3122 | TRK_MINNOW_DOLPHIN/mslsupp.c | 4555 | | TRK_MINNOW_DOLPHIN/CircleBuffer.c | 4715 | TRK_MINNOW_DOLPHIN/serpoll.c | 4793 | @@ -29,6 +29,7 @@ | TRK_MINNOW_DOLPHIN/dolphin_trk.c | 11230 | TRK_MINNOW_DOLPHIN/support.c | 12046 | | gx/GXTransform.c | 12379 | gx/GXLight.c | 14151 | | gx/GXTev.c | 14624 | gx/GXPixel.c | 15806 | +| gx/GXPerf.c | 17304 | ###
JSystem
| File | Size (bytes) | File | Size (bytes) | diff --git a/include/Dolphin/si.h b/include/Dolphin/si.h index 003db2b06..42b1f98d3 100644 --- a/include/Dolphin/si.h +++ b/include/Dolphin/si.h @@ -24,14 +24,13 @@ typedef struct SIPacket { OSTime fire; // _18 } SIPacket; - // Struct for 'Si' object in SIBios.c (size 0x14). typedef struct SIControl { - int chan; // _00 - u32 poll; // _04 - u32 inputBytes; // _08 - void* input; // _0C - SICallback callback; // _10 + int chan; // _00 + u32 poll; // _04 + u32 inputBytes; // _08 + void* input; // _0C + SICallback callback; // _10 } SIControl; //////////////////////////////////////////// diff --git a/src/Dolphin/gx/GXDisplayList.c b/src/Dolphin/gx/GXDisplayList.c index 03df89b91..78d2b0617 100644 --- a/src/Dolphin/gx/GXDisplayList.c +++ b/src/Dolphin/gx/GXDisplayList.c @@ -1,5 +1,4 @@ #include "Dolphin/gx.h" -#include "Dolphin/os.h" /* * --INFO-- @@ -34,7 +33,7 @@ void GXCallDisplayList(void* dl, u32 byteCnt) if (__GXData->_000[0] == 0) { __GXSendFlushPrim(); } - HW_REG(0xCC008000, u8) = 0x40; - HW_REG(0xCC008000, void*) = dl; - HW_REG(0xCC008000, u32) = byteCnt; + GXWGFifo.u8 = 0x40; + GXWGFifo.u32 = dl; + GXWGFifo.u32 = byteCnt; } diff --git a/src/Dolphin/gx/GXFifo.c b/src/Dolphin/gx/GXFifo.c index 0842225cd..72954bd87 100644 --- a/src/Dolphin/gx/GXFifo.c +++ b/src/Dolphin/gx/GXFifo.c @@ -58,7 +58,7 @@ void GXBreakPointHandler(OSContext* context) // if (IS_FLAG_SET(data->controlRegister, 5) && IS_FLAG_SET(data->_00C, 4)) { // if ((data->controlRegister & BP_ENABLE) && IS_FLAG_SET(data->_00C, 4)) { __GXData->controlRegister.bits.bpEnable = FALSE; - // __cpReg->controlRegister = HW_REG(&__GXData->controlRegister, u16); + // __cpReg->controlRegister = GXWGFifo.u16(&__GXData->controlRegister); __cpReg->controlRegister = __GXData->controlRegister.value; // __GXData->controlRegister &= ~BP_ENABLE; // __cpReg->controlRegister = __GXData->controlRegister; @@ -671,7 +671,7 @@ void __GXFifoInit(void) void __GXFifoReadEnable(void) { // __GXData->controlRegister.gpFifoReadEnable = TRUE; - // __cpReg->controlRegister = HW_REG(&__GXData->controlRegister, u16); + // __cpReg->controlRegister = GXWGFifo.u16(&__GXData->controlRegister); // __GXData->controlRegister |= GP_FIFO_READ_ENABLE; // __GXData->controlRegister = __GXData->controlRegister & ~GP_FIFO_READ_ENABLE | GP_FIFO_READ_ENABLE; // __cpReg->controlRegister = __GXData->controlRegister; diff --git a/src/Dolphin/si/SIBios.c b/src/Dolphin/si/SIBios.c index 5100b8d57..e90a422c9 100644 --- a/src/Dolphin/si/SIBios.c +++ b/src/Dolphin/si/SIBios.c @@ -1,16 +1,16 @@ #include "Dolphin/si.h" -char *__SIVersion = "<< Dolphin SDK - SI\trelease build: Apr 17 2003 12:33:19 (0x2301) >>"; +char* __SIVersion = "<< Dolphin SDK - SI\trelease build: Apr 17 2003 12:33:19 (0x2301) >>"; static SIControl Si = { -1, 0, 0, nullptr, nullptr }; static SIPacket Packet[SI_MAX_CHAN]; static OSAlarm Alarm[SI_MAX_CHAN]; static u32 Type[SI_MAX_CHAN] = { - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE, - SI_ERROR_NO_RESPONSE, + SI_ERROR_NO_RESPONSE, + SI_ERROR_NO_RESPONSE, + SI_ERROR_NO_RESPONSE, + SI_ERROR_NO_RESPONSE, }; static OSTime TypeTime[SI_MAX_CHAN]; @@ -30,10 +30,7 @@ u32 __PADFixBits; * Address: 800F4EFC * Size: 000020 */ -BOOL SIBusy() -{ - return Si.chan != -1 ? TRUE : FALSE; -} +BOOL SIBusy() { return Si.chan != -1 ? TRUE : FALSE; } /* * --INFO--