Skip to content

Commit

Permalink
purge HW_REG usage
Browse files Browse the repository at this point in the history
resolves #155
  • Loading branch information
EpochFlame committed Sep 20, 2023
1 parent 1ed7ea2 commit ddbf0ce
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 22 deletions.
3 changes: 2 additions & 1 deletion docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
### <section id="Dolphin">Dolphin</section>
| File | Size (bytes) | File | Size (bytes) |
| ---- | ---- | ---- | ---- |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/targsupp.c">TRK_MINNOW_DOLPHIN/targsupp.c</a> | 326 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXDisplayList.c">gx/GXDisplayList.c</a> | 647 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/targsupp.c">TRK_MINNOW_DOLPHIN/targsupp.c</a> | 326 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXDisplayList.c">gx/GXDisplayList.c</a> | 582 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/Runtime/__init_cpp_exceptions.cpp">Runtime/__init_cpp_exceptions.cpp</a> | 684 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/Runtime/global_destructor_chain.c">Runtime/global_destructor_chain.c</a> | 965 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/mtx/mtxvec.c">mtx/mtxvec.c</a> | 3122 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/mslsupp.c">TRK_MINNOW_DOLPHIN/mslsupp.c</a> | 4555 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/CircleBuffer.c">TRK_MINNOW_DOLPHIN/CircleBuffer.c</a> | 4715 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/serpoll.c">TRK_MINNOW_DOLPHIN/serpoll.c</a> | 4793 |
Expand All @@ -29,6 +29,7 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/dolphin_trk.c">TRK_MINNOW_DOLPHIN/dolphin_trk.c</a> | 11230 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/TRK_MINNOW_DOLPHIN/support.c">TRK_MINNOW_DOLPHIN/support.c</a> | 12046 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTransform.c">gx/GXTransform.c</a> | 12379 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXLight.c">gx/GXLight.c</a> | 14151 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXTev.c">gx/GXTev.c</a> | 14624 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPixel.c">gx/GXPixel.c</a> | 15806 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/Dolphin/gx/GXPerf.c">gx/GXPerf.c</a> | 17304 |

### <section id="JSystem">JSystem</section>
| File | Size (bytes) | File | Size (bytes) |
Expand Down
11 changes: 5 additions & 6 deletions include/Dolphin/si.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

////////////////////////////////////////////
Expand Down
7 changes: 3 additions & 4 deletions src/Dolphin/gx/GXDisplayList.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "Dolphin/gx.h"
#include "Dolphin/os.h"

/*
* --INFO--
Expand Down Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions src/Dolphin/gx/GXFifo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 6 additions & 9 deletions src/Dolphin/si/SIBios.c
Original file line number Diff line number Diff line change
@@ -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];
Expand All @@ -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--
Expand Down

0 comments on commit ddbf0ce

Please sign in to comment.