summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
Diffstat (limited to 'src/code')
-rw-r--r--src/code/__osMalloc.c6
-rw-r--r--src/code/code_80097A00.c4
-rw-r--r--src/code/code_800EC960.c2
-rw-r--r--src/code/main.c2
-rw-r--r--src/code/mtxuty-cvt.c6
-rw-r--r--src/code/ucode_disas.c64
-rw-r--r--src/code/z_collision_check.c4
7 files changed, 43 insertions, 45 deletions
diff --git a/src/code/__osMalloc.c b/src/code/__osMalloc.c
index b27392753..0b66eb353 100644
--- a/src/code/__osMalloc.c
+++ b/src/code/__osMalloc.c
@@ -17,13 +17,13 @@
OSMesg sArenaLockMsg;
u32 __osMalloc_FreeBlockTest_Enable;
-bool ArenaImpl_GetFillAllocBlock(Arena* arena) {
+u32 ArenaImpl_GetFillAllocBlock(Arena* arena) {
return (arena->flag & FILL_ALLOCBLOCK) != 0;
}
-bool ArenaImpl_GetFillFreeBlock(Arena* arena) {
+u32 ArenaImpl_GetFillFreeBlock(Arena* arena) {
return (arena->flag & FILL_FREEBLOCK) != 0;
}
-bool ArenaImpl_GetCheckFreeBlock(Arena* arena) {
+u32 ArenaImpl_GetCheckFreeBlock(Arena* arena) {
return (arena->flag & CHECK_FREE_BLOCK) != 0;
}
diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c
index b60b98635..26f1cb9e9 100644
--- a/src/code/code_80097A00.c
+++ b/src/code/code_80097A00.c
@@ -33,8 +33,8 @@ u16 gUpgradeCapacities[][4] = {
{ 0, 20, 30, 40 }, // Deku Nut Upgrades
};
-u32 gGsFlagsMask[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
-u32 gGsFlagsShift[] = { 0, 8, 16, 24 };
+u32 gGsFlagsMasks[] = { 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 };
+u32 gGsFlagsShifts[] = { 0, 8, 16, 24 };
void* gItemIcons[] = {
gDekuStickIconTex,
diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c
index 811e16447..875b47d89 100644
--- a/src/code/code_800EC960.c
+++ b/src/code/code_800EC960.c
@@ -145,7 +145,7 @@ u8 D_80130658[0x70] = {
s8 sSpecReverbs[20] = { 0, 0, 0, 0, 0, 0, 0, 40, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
D_801306DC_s D_801306DC[20] = {
- { 0xC0FF, 0XC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3,
+ { 0xC0FF, 0xC0FE, { 0, 2, 0, 0, 3, 0, 1, 2, 9, 1, 3, 64, 1, 4, 0, 1, 5, 32, 2, 2, 4, 2, 3,
0, 2, 4, 1, 2, 5, 16, 3, 2, 10, 3, 3, 112, 3, 4, 1, 3, 5, 48, 4, 2, 14, 4,
3, 127, 4, 4, 0, 4, 5, 16, 5, 2, 0, 5, 3, 127, 5, 4, 1, 5, 5, 16, 6, 2, 1,
6, 3, 127, 6, 4, 3, 6, 5, 16, 7, 2, 17, 7, 3, 127, 7, 4, 1, 7, 5, 16, 0xFF } },
diff --git a/src/code/main.c b/src/code/main.c
index 7afc30081..fce3972d1 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -61,7 +61,7 @@ void Main(void* arg) {
debugHeapSize = (s32)(0x80600000 - debugHeap);
} else {
debugHeapSize = 0x400;
- debugHeap = SystemArena_MallocDebug(debugHeapSize, "../main.c", 0x235);
+ debugHeap = SystemArena_MallocDebug(debugHeapSize, "../main.c", 565);
}
osSyncPrintf("debug_InitArena(%08x, %08x)\n", debugHeap, debugHeapSize);
DebugArena_Init(debugHeap, debugHeapSize);
diff --git a/src/code/mtxuty-cvt.c b/src/code/mtxuty-cvt.c
index ff030d9c3..78926efd0 100644
--- a/src/code/mtxuty-cvt.c
+++ b/src/code/mtxuty-cvt.c
@@ -1,6 +1,6 @@
#include "global.h"
-void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
+void MtxConv_F2L(Mtx* m1, MtxF* m2) {
s32 i;
s32 j;
@@ -16,8 +16,8 @@ void MtxConv_F2L(MatrixInternal* m1, MtxF* m2) {
}
}
-void MtxConv_L2F(MtxF* m1, MatrixInternal* m2) {
+void MtxConv_L2F(MtxF* m1, Mtx* m2) {
LogUtils_CheckNullPointer("m1", m1, "../mtxuty-cvt.c", 55);
LogUtils_CheckNullPointer("m2", m2, "../mtxuty-cvt.c", 56);
- guMtxL2F(m1, (Mtx*)m2);
+ guMtxL2F(m1, m2);
}
diff --git a/src/code/ucode_disas.c b/src/code/ucode_disas.c
index 4af0898b0..9d5278f30 100644
--- a/src/code/ucode_disas.c
+++ b/src/code/ucode_disas.c
@@ -510,7 +510,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_LOAD_UCODE: {
- if (curGfx->dma.len == 0x7ff) {
+ if (curGfx->dma.len == 0x7FF) {
DISAS_LOG("gsSPLoadUcode(0x%08x, 0x%08x),", curGfx->dma.addr, rdpHalf);
} else {
DISAS_LOG("gsSPLoadUcodeEx(0x%08x, 0x%08x, 0x%05x),", curGfx->dma.addr, rdpHalf,
@@ -695,7 +695,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
case G_RDPSETOTHERMODE: {
DISAS_LOG("gsDPSetOtherMode(0x%08x, 0x%08x),", curGfx->words.w0 & 0xFFFFFF, curGfx->words.w1);
- this->modeH = curGfx->words.w0 & 0xfff;
+ this->modeH = curGfx->words.w0 & 0xFFF;
this->modeL = curGfx->words.w1;
if (this->pipeSyncRequired) {
@@ -734,8 +734,8 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_SETCIMG: {
- u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xff;
- u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xff;
+ u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xFF;
+ u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
DISAS_LOG("gsDPSetColorImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x) ),",
(fmt == G_IM_FMT_RGBA)
@@ -744,7 +744,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
(siz == G_IM_SIZ_4b) ? "4b"
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
- (curGfx->dma.len & 0xfff) + 1, curGfx->setimg.dram, addr);
+ (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
if (this->pipeSyncRequired) {
DISAS_LOG("### PipeSyncが必要です。\n");
@@ -762,8 +762,8 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
} break;
case G_SETTIMG: {
- u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xff;
- u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xff;
+ u32 fmt = ((curGfx->words.w0 & 0xE00000) >> 0x15) & 0xFF;
+ u32 siz = ((curGfx->words.w0 & 0x180000) >> 0x13) & 0xFF;
DISAS_LOG("gsDPSetTextureImage(G_IM_FMT_%s, G_IM_SIZ_%s, %d, 0x%08x(0x%08x)),",
(fmt == G_IM_FMT_RGBA)
@@ -772,7 +772,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
: (fmt == G_IM_FMT_CI) ? "CI" : (fmt == G_IM_FMT_IA) ? "IA" : "I",
(siz == G_IM_SIZ_4b) ? "4b"
: (siz == G_IM_SIZ_8b) ? "8b" : (siz == G_IM_SIZ_16b) ? "16b" : "32b",
- (curGfx->dma.len & 0xfff) + 1, curGfx->setimg.dram, addr);
+ (curGfx->dma.len & 0xFFF) + 1, curGfx->setimg.dram, addr);
} break;
case G_SETENVCOLOR: {
@@ -933,39 +933,37 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
DISAS_LOG("),", gmtx.addr); /*! @bug gmtx.addr shouldn't be here*/
if (this->enableLog >= 2) {
- MtxConv_L2F(&mtx, ((MatrixInternal*)addr));
+ MtxConv_L2F(&mtx, (Mtx*)addr);
DISAS_LOG("\n");
+
/*! @bug %.04x.%04x is a typo, should be %04x.%04x */
+ // clang-format off
DISAS_LOG(
- "/ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x \\/ %12.6f %12.6f %12.6f %12.6f "
- "\\\n"
+ "/ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x \\/ %12.6f %12.6f %12.6f %12.6f \\\n"
"| %04x.%04x %04x.%04x %04x.%04x %.04x.%04x || %12.6f %12.6f %12.6f %12.6f |\n"
"| %04x.%04x %04x.%04x %04x.%04x %.04x.%04x || %12.6f %12.6f %12.6f %12.6f |\n"
- "\\ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x /\\ %12.6f %12.6f %12.6f %12.6f "
- "/\n",
- ((MatrixInternal*)addr)->intPart[0][0], ((MatrixInternal*)addr)->fracPart[0][0],
- ((MatrixInternal*)addr)->intPart[1][0], ((MatrixInternal*)addr)->fracPart[1][0],
- ((MatrixInternal*)addr)->intPart[2][0], ((MatrixInternal*)addr)->fracPart[2][0],
- ((MatrixInternal*)addr)->intPart[3][0], ((MatrixInternal*)addr)->fracPart[3][0],
+ "\\ %04x.%04x %04x.%04x %04x.%04x %.04x.%04x /\\ %12.6f %12.6f %12.6f %12.6f /\n",
+ ((Mtx*)addr)->intPart[0][0], ((Mtx*)addr)->fracPart[0][0],
+ ((Mtx*)addr)->intPart[1][0], ((Mtx*)addr)->fracPart[1][0],
+ ((Mtx*)addr)->intPart[2][0], ((Mtx*)addr)->fracPart[2][0],
+ ((Mtx*)addr)->intPart[3][0], ((Mtx*)addr)->fracPart[3][0],
mtx.mf[0][0], mtx.mf[1][0], mtx.mf[2][0], mtx.mf[3][0],
-
- ((MatrixInternal*)addr)->intPart[0][1], ((MatrixInternal*)addr)->fracPart[0][1],
- ((MatrixInternal*)addr)->intPart[1][1], ((MatrixInternal*)addr)->fracPart[1][1],
- ((MatrixInternal*)addr)->intPart[2][1], ((MatrixInternal*)addr)->fracPart[2][1],
- ((MatrixInternal*)addr)->intPart[3][1], ((MatrixInternal*)addr)->fracPart[3][1],
+ ((Mtx*)addr)->intPart[0][1], ((Mtx*)addr)->fracPart[0][1],
+ ((Mtx*)addr)->intPart[1][1], ((Mtx*)addr)->fracPart[1][1],
+ ((Mtx*)addr)->intPart[2][1], ((Mtx*)addr)->fracPart[2][1],
+ ((Mtx*)addr)->intPart[3][1], ((Mtx*)addr)->fracPart[3][1],
mtx.mf[0][1], mtx.mf[1][1], mtx.mf[2][1], mtx.mf[3][1],
-
- ((MatrixInternal*)addr)->intPart[0][2], ((MatrixInternal*)addr)->fracPart[0][2],
- ((MatrixInternal*)addr)->intPart[1][2], ((MatrixInternal*)addr)->fracPart[1][2],
- ((MatrixInternal*)addr)->intPart[2][2], ((MatrixInternal*)addr)->fracPart[2][2],
- ((MatrixInternal*)addr)->intPart[3][2], ((MatrixInternal*)addr)->fracPart[3][2],
+ ((Mtx*)addr)->intPart[0][2], ((Mtx*)addr)->fracPart[0][2],
+ ((Mtx*)addr)->intPart[1][2], ((Mtx*)addr)->fracPart[1][2],
+ ((Mtx*)addr)->intPart[2][2], ((Mtx*)addr)->fracPart[2][2],
+ ((Mtx*)addr)->intPart[3][2], ((Mtx*)addr)->fracPart[3][2],
mtx.mf[0][2], mtx.mf[1][2], mtx.mf[2][2], mtx.mf[3][2],
-
- ((MatrixInternal*)addr)->intPart[0][3], ((MatrixInternal*)addr)->fracPart[0][3],
- ((MatrixInternal*)addr)->intPart[1][3], ((MatrixInternal*)addr)->fracPart[1][3],
- ((MatrixInternal*)addr)->intPart[2][3], ((MatrixInternal*)addr)->fracPart[2][3],
- ((MatrixInternal*)addr)->intPart[3][3], ((MatrixInternal*)addr)->fracPart[3][3],
+ ((Mtx*)addr)->intPart[0][3], ((Mtx*)addr)->fracPart[0][3],
+ ((Mtx*)addr)->intPart[1][3], ((Mtx*)addr)->fracPart[1][3],
+ ((Mtx*)addr)->intPart[2][3], ((Mtx*)addr)->fracPart[2][3],
+ ((Mtx*)addr)->intPart[3][3], ((Mtx*)addr)->fracPart[3][3],
mtx.mf[0][3], mtx.mf[1][3], mtx.mf[2][3], mtx.mf[3][3]);
+ // clang-format on
}
} break;
@@ -974,7 +972,7 @@ void UCodeDisas_Disassemble(UCodeDisas* this, GfxMod* ptr) {
u32 vbidx;
numv >>= 12;
- numv &= 0xff;
+ numv &= 0xFF;
vbidx = (curGfx->vtx.vbidx >> 1) - numv;
DISAS_LOG("gsSPVertex(0x%08x(0x%08x), %d, %d),", curGfx->words.w1, addr, numv, vbidx);
diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c
index 7088730ae..3170eb87a 100644
--- a/src/code/z_collision_check.c
+++ b/src/code/z_collision_check.c
@@ -1077,14 +1077,14 @@ void CollisionCheck_ClearContext(GlobalContext* globalCtx, CollisionCheckContext
* Enables SAC, an alternate collision check mode that allows direct management of collider lists. Unused.
*/
void CollisionCheck_EnableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) {
- colChkCtx->sacFlags |= AC_ON;
+ colChkCtx->sacFlags |= 1;
}
/**
* Disables SAC, an alternate collision check mode that allows direct management of collider lists. Unused.
*/
void CollisionCheck_DisableSAC(GlobalContext* globalCtx, CollisionCheckContext* colChkCtx) {
- colChkCtx->sacFlags &= ~AC_ON;
+ colChkCtx->sacFlags &= ~1;
}
/**