summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2022-07-23 14:57:47 -0400
committerGitHub <noreply@github.com>2022-07-23 14:57:47 -0400
commit260be2c36b2c0edd6459ed75173202bf722a89cb (patch)
tree06b14ce56d6edfe8cc8056fe8fea5b6edf5aad9e /src
parenteff952b9446b11123f51de438959771b999ec2bd (diff)
Hex Cleanup (#960)
* Hex Cleanup * PR Suggestions
Diffstat (limited to 'src')
-rw-r--r--src/boot_O2_g3/fault.c46
-rw-r--r--src/code/z_message.c2
-rw-r--r--src/code/z_room.c9
-rw-r--r--src/code/z_scene.c6
-rw-r--r--src/libultra/gu/lookathil.c2
-rw-r--r--src/libultra/io/contreaddata.c2
-rw-r--r--src/libultra/io/controller.c2
-rw-r--r--src/libultra/io/epirawdma.c2
-rw-r--r--src/libultra/io/visetxscale.c2
-rw-r--r--src/libultra/os/initialize.c2
-rw-r--r--src/libultra/rmon/xldtob.c8
-rw-r--r--src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c2
12 files changed, 42 insertions, 43 deletions
diff --git a/src/boot_O2_g3/fault.c b/src/boot_O2_g3/fault.c
index bc7e8d34a..e648275b6 100644
--- a/src/boot_O2_g3/fault.c
+++ b/src/boot_O2_g3/fault.c
@@ -269,9 +269,9 @@ void Fault_DrawCornerRec(u16 color) {
void Fault_PrintFReg(s32 idx, f32* value) {
u32 raw = *(u32*)value;
- s32 v0 = ((raw & 0x7f800000) >> 0x17) - 0x7f;
+ s32 v0 = ((raw & 0x7F800000) >> 0x17) - 0x7F;
- if ((v0 >= -0x7e && v0 < 0x80) || raw == 0) {
+ if ((v0 >= -0x7E && v0 < 0x80) || raw == 0) {
FaultDrawer_Printf("F%02d:%14.7e ", idx, *value);
} else {
FaultDrawer_Printf("F%02d: %08x(16) ", idx, raw);
@@ -320,7 +320,7 @@ void osSyncPrintfFPCR(u32 value) {
void Fault_PrintThreadContext(OSThread* t) {
__OSThreadContext* ctx;
- s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
+ s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
@@ -383,11 +383,11 @@ void Fault_PrintThreadContext(OSThread* t) {
void osSyncPrintfThreadContext(OSThread* t) {
__OSThreadContext* ctx;
- s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1f) << 0x10) >> 0x10;
+ s32 causeStrIdx = (s32)((((u32)t->context.cause >> 2) & 0x1F) << 0x10) >> 0x10;
if (causeStrIdx == 0x17) {
causeStrIdx = 0x10;
}
- if (causeStrIdx == 0x1f) {
+ if (causeStrIdx == 0x1F) {
causeStrIdx = 0x11;
}
@@ -416,29 +416,29 @@ void osSyncPrintfThreadContext(OSThread* t) {
osSyncPrintfFReg(6, &ctx->fp6.f.f_even);
osSyncPrintf("\n");
osSyncPrintfFReg(8, &ctx->fp8.f.f_even);
- osSyncPrintfFReg(0xa, &ctx->fp10.f.f_even);
+ osSyncPrintfFReg(10, &ctx->fp10.f.f_even);
osSyncPrintf("\n");
- osSyncPrintfFReg(0xc, &ctx->fp12.f.f_even);
- osSyncPrintfFReg(0xe, &ctx->fp14.f.f_even);
+ osSyncPrintfFReg(12, &ctx->fp12.f.f_even);
+ osSyncPrintfFReg(14, &ctx->fp14.f.f_even);
osSyncPrintf("\n");
- osSyncPrintfFReg(0x10, &ctx->fp16.f.f_even);
- osSyncPrintfFReg(0x12, &ctx->fp18.f.f_even);
+ osSyncPrintfFReg(16, &ctx->fp16.f.f_even);
+ osSyncPrintfFReg(18, &ctx->fp18.f.f_even);
osSyncPrintf("\n");
- osSyncPrintfFReg(0x14, &ctx->fp20.f.f_even);
- osSyncPrintfFReg(0x16, &ctx->fp22.f.f_even);
+ osSyncPrintfFReg(20, &ctx->fp20.f.f_even);
+ osSyncPrintfFReg(22, &ctx->fp22.f.f_even);
osSyncPrintf("\n");
- osSyncPrintfFReg(0x18, &ctx->fp24.f.f_even);
- osSyncPrintfFReg(0x1a, &ctx->fp26.f.f_even);
+ osSyncPrintfFReg(24, &ctx->fp24.f.f_even);
+ osSyncPrintfFReg(26, &ctx->fp26.f.f_even);
osSyncPrintf("\n");
- osSyncPrintfFReg(0x1c, &ctx->fp28.f.f_even);
- osSyncPrintfFReg(0x1e, &ctx->fp30.f.f_even);
+ osSyncPrintfFReg(28, &ctx->fp28.f.f_even);
+ osSyncPrintfFReg(30, &ctx->fp30.f.f_even);
osSyncPrintf("\n");
}
OSThread* Fault_FindFaultedThread() {
OSThread* iter = __osGetActiveQueue();
while (iter->priority != -1) {
- if (iter->priority > 0 && iter->priority < 0x7f && (iter->flags & 3)) {
+ if (iter->priority > 0 && iter->priority < 0x7F && (iter->flags & 3)) {
return iter;
}
iter = iter->tlnext;
@@ -459,7 +459,7 @@ void Fault_Wait5Seconds(void) {
void Fault_WaitForButtonCombo(void) {
Input* input = &sFaultContext->padInput[0];
- FaultDrawer_SetForeColor(0xffff);
+ FaultDrawer_SetForeColor(0xFFFF);
FaultDrawer_SetBackColor(1);
do {
do {
@@ -480,8 +480,8 @@ void Fault_DrawMemDumpPage(const char* title, u32* addr, u32 param_3) {
if (alignedAddr < (u32*)0x80000000) {
alignedAddr = (u32*)0x80000000;
}
- if (alignedAddr > (u32*)0x807fff00) {
- alignedAddr = (u32*)0x807fff00;
+ if (alignedAddr > (u32*)0x807FFF00) {
+ alignedAddr = (u32*)0x807FFF00;
}
alignedAddr = (u32*)((u32)alignedAddr & ~3);
@@ -513,8 +513,8 @@ void Fault_DrawMemDump(u32 pc, u32 sp, u32 unk0, u32 unk1) {
if (addr < 0x80000000) {
addr = 0x80000000;
}
- if (addr > 0x807fff00) {
- addr = 0x807fff00;
+ if (addr > 0x807FFF00) {
+ addr = 0x807FFF00;
}
addr &= ~0xF;
@@ -696,7 +696,7 @@ void Fault_ResumeThread(OSThread* t) {
t->context.cause = 0;
t->context.fpcsr = 0;
t->context.pc += 4;
- *(u32*)t->context.pc = 0xd;
+ *(u32*)t->context.pc = 0x0000000D; // write in a break instruction
osWritebackDCache((void*)t->context.pc, 4);
osInvalICache((void*)t->context.pc, 4);
osStartThread(t);
diff --git a/src/code/z_message.c b/src/code/z_message.c
index 1e76578bb..ac8936674 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -229,7 +229,7 @@ void func_8014CCB4(PlayState* play, s16* decodedBufPos, s32* offset, f32* arg3)
s32 k = *offset;
f32 f = *arg3;
- Font_LoadChar(play, 0x838B, k); // 0x838b = ル in JISX0213
+ Font_LoadChar(play, 0x838B, k); // 0x838B = ル in JISX0213
k += FONT_CHAR_TEX_SIZE;
msgCtx->decodedBuffer.wchar[t] = 0x838B;
t += 1;
diff --git a/src/code/z_room.c b/src/code/z_room.c
index 3507765a5..169d6d5b5 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -58,7 +58,7 @@ void Room_DrawType1Mesh(PlayState* play, Room* room, u32 flags) {
} else if (mesh->format == 2) {
func_8012E32C(play, room, flags);
} else {
- __assert("../z_room.c", 0x3c5);
+ __assert("../z_room.c", 965);
}
}
@@ -85,9 +85,8 @@ s32 Room_StartRoomTransition(PlayState* play, RoomContext* roomCtx, s32 index) {
roomCtx->unk31 = 1;
size = play->roomList[index].vromEnd - play->roomList[index].vromStart;
- roomCtx->activeRoomVram =
- (void*)(((s32)roomCtx->roomMemPages[roomCtx->activeMemPage] - (size + 8) * roomCtx->activeMemPage + 8) &
- 0xfffffff0);
+ roomCtx->activeRoomVram = (void*)(ALIGN16((u32)roomCtx->roomMemPages[roomCtx->activeMemPage] -
+ (size + 8) * roomCtx->activeMemPage - 7));
osCreateMesgQueue(&roomCtx->loadQueue, roomCtx->loadMsg, 1);
DmaMgr_SendRequestImpl(&roomCtx->dmaRequest, roomCtx->activeRoomVram, play->roomList[index].vromStart, size, 0,
@@ -114,7 +113,7 @@ s32 Room_HandleLoadCallbacks(PlayState* play, RoomContext* roomCtx) {
if (((play->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
(play->sceneNum != SCENE_IKNINSIDE)) {
- play->envCtx.lightSettingOverride = 0xff;
+ play->envCtx.lightSettingOverride = 0xFF;
play->envCtx.unk_E0 = 0;
}
func_800FEAB0();
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index b4ba212d5..c6e896447 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -237,9 +237,9 @@ void Scene_HeaderCmdRoomBehavior(PlayState* play, SceneCmd* cmd) {
play->roomCtx.currRoom.unk3 = cmd->roomBehavior.gpFlag1;
play->roomCtx.currRoom.unk2 = cmd->roomBehavior.gpFlag2 & 0xFF;
play->roomCtx.currRoom.unk5 = (cmd->roomBehavior.gpFlag2 >> 8) & 1;
- play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xa) & 1;
- play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xb) & 1;
- play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xc) & 1;
+ play->msgCtx.unk12044 = (cmd->roomBehavior.gpFlag2 >> 0xA) & 1;
+ play->roomCtx.currRoom.enablePosLights = (cmd->roomBehavior.gpFlag2 >> 0xB) & 1;
+ play->envCtx.unk_E2 = (cmd->roomBehavior.gpFlag2 >> 0xC) & 1;
}
// SceneTableEntry Header Command 0x0A: Mesh Header
diff --git a/src/libultra/gu/lookathil.c b/src/libultra/gu/lookathil.c
index 823ff0982..dcb05b3d9 100644
--- a/src/libultra/gu/lookathil.c
+++ b/src/libultra/gu/lookathil.c
@@ -1,6 +1,6 @@
#include "global.h"
-#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xff)
+#define FTOFRAC8(x) ((s32)MIN(((x) * (128.0f)), 127.0f) & 0xFF)
void guLookAtHiliteF(f32 mf[4][4], LookAt* l, Hilite* h, f32 xEye, f32 yEye, f32 zEye, f32 xAt, f32 yAt, f32 zAt,
f32 xUp, f32 yUp, f32 zUp, f32 xl1, f32 yl1, f32 zl1, /* light 1 direction */
diff --git a/src/libultra/io/contreaddata.c b/src/libultra/io/contreaddata.c
index b54d894f3..163756e07 100644
--- a/src/libultra/io/contreaddata.c
+++ b/src/libultra/io/contreaddata.c
@@ -28,7 +28,7 @@ void osContGetReadData(OSContPad* data) {
ptr = (u8*)__osContPifRam.ramarray;
for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(__OSContReadFormat), data++) {
readformat = *(__OSContReadFormat*)ptr;
- data->errno = (readformat.rxsize & 0xc0) >> 4;
+ data->errno = (readformat.rxsize & 0xC0) >> 4;
if (data->errno == 0) {
data->button = readformat.button;
data->stick_x = readformat.stick_x;
diff --git a/src/libultra/io/controller.c b/src/libultra/io/controller.c
index bd8270993..245183280 100644
--- a/src/libultra/io/controller.c
+++ b/src/libultra/io/controller.c
@@ -58,7 +58,7 @@ void __osContGetInitData(u8* pattern, OSContStatus* data) {
ptr = (u8*)__osContPifRam.ramarray;
for (i = 0; i < __osMaxControllers; i++, ptr += sizeof(requestHeader), data++) {
requestHeader = *(__OSContRequestHeader*)ptr;
- data->errno = (requestHeader.rxsize & 0xc0) >> 4;
+ data->errno = (requestHeader.rxsize & 0xC0) >> 4;
if (data->errno == 0) {
data->type = requestHeader.typel << 8 | requestHeader.typeh;
data->status = requestHeader.status;
diff --git a/src/libultra/io/epirawdma.c b/src/libultra/io/epirawdma.c
index cbe43ce82..fd7573151 100644
--- a/src/libultra/io/epirawdma.c
+++ b/src/libultra/io/epirawdma.c
@@ -53,7 +53,7 @@ s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dr
}
HW_REG(PI_DRAM_ADDR_REG, void*) = (void*)osVirtualToPhysical(dramAddr);
- HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1fffffff);
+ HW_REG(PI_CART_ADDR_REG, void*) = (void*)((handle->baseAddress | cartAddr) & 0x1FFFFFFF);
switch (direction) {
case OS_READ:
diff --git a/src/libultra/io/visetxscale.c b/src/libultra/io/visetxscale.c
index e6a9ec6bb..0e2cf762d 100644
--- a/src/libultra/io/visetxscale.c
+++ b/src/libultra/io/visetxscale.c
@@ -10,7 +10,7 @@ void osViSetXScale(f32 value) {
__osViNext->state |= 0x2;
- nomValue = __osViNext->modep->comRegs.xScale & 0xfff;
+ nomValue = __osViNext->modep->comRegs.xScale & 0xFFF;
__osViNext->x.scale = (u32)(__osViNext->x.factor * nomValue) & 0xFFF;
__osRestoreInt(saveMask);
diff --git a/src/libultra/os/initialize.c b/src/libultra/os/initialize.c
index 3174d5c99..9fbf5ff64 100644
--- a/src/libultra/os/initialize.c
+++ b/src/libultra/os/initialize.c
@@ -4,7 +4,7 @@
typedef struct {
/* 0x0 */ u32 ins_00; // lui k0, 0x8000
- /* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39e0
+ /* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39E0
/* 0x8 */ u32 ins_08; // jr k0 ; __osException
/* 0xC */ u32 ins_0C; // nop
} struct_exceptionPreamble;
diff --git a/src/libultra/rmon/xldtob.c b/src/libultra/rmon/xldtob.c
index 65ffc7a92..460d0951c 100644
--- a/src/libultra/rmon/xldtob.c
+++ b/src/libultra/rmon/xldtob.c
@@ -9,13 +9,13 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L
/* float properties */
#define _D0 0
-#define _DBIAS 0x3ff
+#define _DBIAS 0x3FF
#define _DLONG 1
#define _DOFF 4
-#define _FBIAS 0x7e
+#define _FBIAS 0x7E
#define _FOFF 7
#define _FRND 1
-#define _LBIAS 0x3ffe
+#define _LBIAS 0x3FFE
#define _LOFF 15
/* integer properties */
#define _C2 1
@@ -26,7 +26,7 @@ const f64 digs[] = { 10e0L, 10e1L, 10e3L, 10e7L, 10e15L, 10e31L, 10e63L, 10e127L
#define INF 1
#define FINITE -1
#define _DFRAC ((1 << _DOFF) - 1)
-#define _DMASK (0x7fff & ~_DFRAC)
+#define _DMASK (0x7FFF & ~_DFRAC)
#define _DMAX ((1 << (15 - _DOFF)) - 1)
#define _DNAN (0x8000 | _DMAX << _DOFF | 1 << (_DOFF - 1))
#define _DSIGN 0x8000
diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
index 2f498f20c..7c98aa84e 100644
--- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
+++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c
@@ -326,7 +326,7 @@ static unkstructInvadepoh1 D_80B4EA24[] = {
{ 1, 1.0f },
};
-static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3c };
+static unkstructInvadepoh4 D_80B4EA2C = { 2, &D_80B4E9C4, 4, D_80B4EA04, 0x28, 0x3C };
static unkstructInvadepoh3 D_80B4EA40 = {
1,