From 5bd0bc3c46b11579977b7e2bacc54408500988fb Mon Sep 17 00:00:00 2001 From: Zac Date: Fri, 22 Nov 2024 01:41:30 +0000 Subject: [PATCH] Tweak formatting and add comments --- include/brx.h | 5 ++++- src/P2/brx.c | 14 ++++++++++---- src/P2/gs.c | 9 ++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/include/brx.h b/include/brx.h index 71d64fd7..26c4c363 100644 --- a/include/brx.h +++ b/include/brx.h @@ -8,6 +8,9 @@ #include "common.h" -// ... +/** + * @brief Get the PLO index from a stock OID. + */ +uint IploFromStockOid(int oid); #endif // BRX_H diff --git a/src/P2/brx.c b/src/P2/brx.c index aa22c034..f0ec0755 100644 --- a/src/P2/brx.c +++ b/src/P2/brx.c @@ -12,14 +12,20 @@ INCLUDE_ASM(const s32, "P2/brx", snd_SendIOPCommandNoWait); INCLUDE_ASM(const s32, "P2/brx", LoadOptionsFromBrx__FPvP18CBinaryInputStream); -uint IploFromStockOid(int oid) { +uint IploFromStockOid(int oid) +{ int iplo; - if (oid >= 0xC && oid <= 0x2a) { - iplo = oid - 0xC; - } else { + // Ensure oid is a stock object (between ) + if (oid >= 12 && oid <= 42) + { + iplo = oid - 12; + } + else + { iplo = -1; } + return iplo; } diff --git a/src/P2/gs.c b/src/P2/gs.c index bad62ffa..db3af4a3 100644 --- a/src/P2/gs.c +++ b/src/P2/gs.c @@ -31,12 +31,11 @@ INCLUDE_ASM(const s32, "P2/gs", ResetGsMemory__Fv); INCLUDE_ASM(const s32, "P2/gs", NLog2__FUi); -void igsMin(GSB *pgsb,int igsMin,int igsMax) - +void InitGsb(GSB *pgsb, int igsMin, int igsMax) { - pgsb->igsMac = igsMin; - pgsb->igsMin = igsMin; - pgsb->igsMax = igsMax; + pgsb->igsMac = igsMin; + pgsb->igsMin = igsMin; + pgsb->igsMax = igsMax; } INCLUDE_ASM(const s32, "P2/gs", ResetGsb__FP3GSB);