summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/functions.h4
-rw-r--r--include/variables.h16
-rw-r--r--include/z64game.h2
-rw-r--r--include/z64speed_meter.h16
-rw-r--r--include/z64view.h11
-rw-r--r--spec2
-rw-r--r--src/boot/irqmgr.c6
-rw-r--r--src/code/game.c18
-rw-r--r--src/code/graph.c17
-rw-r--r--src/code/sched.c7
-rw-r--r--src/code/speed_meter.c262
-rw-r--r--src/code/sys_matrix.c2
-rw-r--r--src/code/z_bgcheck.c14
-rw-r--r--src/code/z_effect_soft_sprite.c2
-rw-r--r--src/code/z_kaleido_manager.c2
-rw-r--r--src/code/z_malloc.c6
-rw-r--r--src/code/z_map_exp.c2
-rw-r--r--src/code/z_message.c2
-rw-r--r--src/code/z_parameter.c6
-rw-r--r--src/code/z_play.c8
-rw-r--r--src/code/z_room.c2
-rw-r--r--src/code/z_scene.c4
-rw-r--r--src/code/z_sram_NES.c2
-rw-r--r--src/code/z_vr_box.c6
-rw-r--r--src/overlays/gamestates/ovl_daytelop/z_daytelop.c4
-rw-r--r--src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c6
-rw-r--r--src/overlays/gamestates/ovl_title/z_title.c2
-rw-r--r--tools/disasm/functions.txt6
-rw-r--r--tools/disasm/variables.txt32
-rw-r--r--tools/permuter_settings.toml2
-rw-r--r--tools/sizes/code_functions.csv6
31 files changed, 367 insertions, 110 deletions
diff --git a/include/functions.h b/include/functions.h
index 849329d94..47bc7fe3d 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -667,10 +667,10 @@ void* ZeldaArena_Realloc(void* ptr, size_t newSize);
void ZeldaArena_Free(void* ptr);
void* ZeldaArena_Calloc(u32 num, size_t size);
void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc);
-s32 ZeldaArena_Check();
+s32 ZeldaArena_Check(void);
void ZeldaArena_Init(void* start, size_t size);
void ZeldaArena_Cleanup(void);
-u8 ZeldaArena_IsInitialized();
+u8 ZeldaArena_IsInitialized(void);
// void func_80102E40(void);
// void func_80102E90(void);
// void func_80102EA4(void);
diff --git a/include/variables.h b/include/variables.h
index 83427f55f..2d64bd2b0 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -14,7 +14,7 @@ extern OSPiHandle* gCartHandle;
extern size_t gDmaMgrDmaBuffSize;
extern vs32 gIrqMgrResetStatus;
extern volatile OSTime sIrqMgrResetTime;
-extern volatile OSTime sIrqMgrRetraceTime;
+extern volatile OSTime gIrqMgrRetraceTime;
extern s32 sIrqMgrRetraceCount;
// extern UNK_TYPE1 sGfxPrintFontTLUT;
@@ -366,7 +366,6 @@ extern Input* D_801D0D60;
extern u32 retryCount;
extern u32 cfbIdx[3];
-extern UNK_PTR D_801D1540;
extern Vec3f gZeroVec3f;
extern Vec3s gZeroVec3s;
@@ -1903,19 +1902,6 @@ extern GfxMasterList* gGfxMasterDL;
extern u64* gAudioSPDataPtr;
extern u32 gAudioSPDataSize;
-extern volatile OSTime D_801FBAE0;
-extern volatile OSTime D_801FBAE8;
-extern volatile OSTime gRDPTimeTotal;
-extern volatile OSTime lastRenderFrameDuration;
-extern volatile OSTime gRSPAudioTotalTime;
-extern volatile OSTime sRSPGFXTotalTime;
-extern volatile OSTime sRSPOtherTotalTime;
-// extern UNK_TYPE1 D_801FBB18;
-
-// Accumulator for `gRDPTimeTotal`
-extern volatile OSTime gRDPTimeAcc;
-// extern UNK_TYPE1 D_801FBB28;
-
extern Vec3f D_801FBBF0;
extern LineSegment Math3D_ColSphereTri_line;
extern Vec3f Math3D_ColSphereTri_point;
diff --git a/include/z64game.h b/include/z64game.h
index 8b63b701f..50dd68473 100644
--- a/include/z64game.h
+++ b/include/z64game.h
@@ -61,7 +61,7 @@ typedef struct GameState {
/* 0x0C */ GameStateFunc init; // Usually the current game state's init, though after stopping, the graph thread will look here to determine the next game state to load.
/* 0x10 */ size_t size;
/* 0x14 */ Input input[MAXCONTROLLERS];
- /* 0x74 */ TwoHeadArena heap;
+ /* 0x74 */ TwoHeadArena tha;
/* 0x84 */ GameAlloc alloc;
/* 0x98 */ UNK_TYPE1 pad98[0x3];
/* 0x9B */ u8 running; // If 0, switch to next game state
diff --git a/include/z64speed_meter.h b/include/z64speed_meter.h
index fbd815248..44b47ed1e 100644
--- a/include/z64speed_meter.h
+++ b/include/z64speed_meter.h
@@ -7,12 +7,24 @@ struct GameState;
struct GraphicsContext;
typedef struct SpeedMeter {
- /* 0x00 */ char unk_00[0x20];
+ /* 0x00 */ char unk_00[0x18];
+ /* 0x18 */ s32 x; // Unused
+ /* 0x1C */ s32 y;
} SpeedMeter; // size = 0x20
void SpeedMeter_Init(SpeedMeter* this);
void SpeedMeter_Destroy(SpeedMeter* this);
void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx);
-void SpeedMeter_DrawAllocEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx, struct GameState* gameState);
+void SpeedMeter_DrawAllocEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx, struct GameState* state);
+
+extern volatile OSTime gRSPAudioTimeTotal;
+extern volatile OSTime gRSPGfxTimeTotal;
+extern volatile OSTime gRDPTimeTotal;
+extern volatile OSTime gGraphUpdatePeriod;
+extern volatile OSTime gRSPAudioTimeAcc;
+extern volatile OSTime gRSPGfxTimeAcc;
+extern volatile OSTime gRSPOtherTimeAcc;
+extern volatile OSTime gUnkTimeAcc;
+extern volatile OSTime gRDPTimeAcc;
#endif
diff --git a/include/z64view.h b/include/z64view.h
index f0661d947..19bb4492c 100644
--- a/include/z64view.h
+++ b/include/z64view.h
@@ -65,6 +65,17 @@ typedef struct View {
} \
(void)0
+#define SET_FULLSCREEN_VIEWPORT_DYNAMIC(view) \
+{ \
+ Viewport viewport; \
+ viewport.bottomY = gScreenHeight; \
+ viewport.rightX = gScreenWidth; \
+ viewport.topY = 0; \
+ viewport.leftX = 0; \
+ View_SetViewport(view, &viewport); \
+} \
+(void)0
+
void View_Init(View* view, struct GraphicsContext* gfxCtx);
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale);
diff --git a/spec b/spec
index 2e2878c69..00e0fee37 100644
--- a/spec
+++ b/spec
@@ -560,8 +560,6 @@ beginseg
include "build/src/code/padmgr.o"
include "build/src/code/sched.o"
include "build/src/code/speed_meter.o"
- include "build/data/code/speed_meter.data.o"
- include "build/data/code/speed_meter.bss.o"
include "build/src/code/su_mtx.o"
include "build/src/code/sys_cfb.o"
include "build/src/code/sys_cmpdma.o"
diff --git a/src/boot/irqmgr.c b/src/boot/irqmgr.c
index 9a773f279..172eabec8 100644
--- a/src/boot/irqmgr.c
+++ b/src/boot/irqmgr.c
@@ -4,7 +4,7 @@
vs32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0;
-volatile OSTime sIrqMgrRetraceTime = 0;
+volatile OSTime gIrqMgrRetraceTime = 0;
s32 sIrqMgrRetraceCount = 0;
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue) {
@@ -109,11 +109,11 @@ void IrqMgr_HandlePRENMI500(IrqMgr* irqmgr) {
IrqMgr_CheckStack();
}
void IrqMgr_HandleRetrace(IrqMgr* irqmgr) {
- if (sIrqMgrRetraceTime == 0) {
+ if (gIrqMgrRetraceTime == 0) {
if (irqmgr->lastFrameTime == 0) {
irqmgr->lastFrameTime = osGetTime();
} else {
- sIrqMgrRetraceTime = osGetTime() - irqmgr->lastFrameTime;
+ gIrqMgrRetraceTime = osGetTime() - irqmgr->lastFrameTime;
}
}
diff --git a/src/code/game.c b/src/code/game.c
index 4f2df63cd..237783319 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -164,11 +164,11 @@ void GameState_InitArena(GameState* gameState, size_t size) {
void* buf = GameAlloc_Malloc(alloc, size);
if (buf) {
- THA_Init(&gameState->heap, buf, size);
+ THA_Init(&gameState->tha, buf, size);
return;
}
- THA_Init(&gameState->heap, NULL, 0);
+ THA_Init(&gameState->tha, NULL, 0);
_dbg_hungup("../game.c", 1035);
}
@@ -178,9 +178,9 @@ void GameState_Realloc(GameState* gameState, size_t size) {
size_t systemMaxFree;
size_t bytesFree;
size_t bytesAllocated;
- void* heapStart = gameState->heap.start;
+ void* heapStart = gameState->tha.start;
- THA_Destroy(&gameState->heap);
+ THA_Destroy(&gameState->tha);
GameAlloc_Free(alloc, heapStart);
SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - sizeof(ArenaNode)) < size) ? 0 : size;
@@ -190,9 +190,9 @@ void GameState_Realloc(GameState* gameState, size_t size) {
gameArena = GameAlloc_Malloc(alloc, size);
if (gameArena != NULL) {
- THA_Init(&gameState->heap, gameArena, size);
+ THA_Init(&gameState->tha, gameArena, size);
} else {
- THA_Init(&gameState->heap, NULL, 0);
+ THA_Init(&gameState->tha, NULL, 0);
_dbg_hungup("../game.c", 1074);
}
}
@@ -246,7 +246,7 @@ void GameState_Destroy(GameState* gameState) {
VisZbuf_Destroy(&sGameVisZbuf);
VisMono_Destroy(&sGameVisMono);
ViMode_Destroy(&sGameViMode);
- THA_Destroy(&gameState->heap);
+ THA_Destroy(&gameState->tha);
GameAlloc_Cleanup(&gameState->alloc);
}
@@ -263,11 +263,11 @@ u32 GameState_IsRunning(GameState* gameState) {
}
s32 GameState_GetArenaSize(GameState* gameState) {
- return THA_GetRemaining(&gameState->heap);
+ return THA_GetRemaining(&gameState->tha);
}
s32 func_80173B48(GameState* gameState) {
- s32 result = OS_CYCLES_TO_NSEC(gameState->framerateDivisor * sIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(gRDPTimeTotal);
+ s32 result = OS_CYCLES_TO_NSEC(gameState->framerateDivisor * gIrqMgrRetraceTime) - OS_CYCLES_TO_NSEC(gRDPTimeTotal);
return result;
}
diff --git a/src/code/graph.c b/src/code/graph.c
index bce162406..ad4ad0286 100644
--- a/src/code/graph.c
+++ b/src/code/graph.c
@@ -8,7 +8,7 @@ FaultAddrConvClient sGraphFaultAddrConvClient;
FaultClient sGraphFaultClient;
GfxMasterList* gGfxMasterDL;
CfbInfo sGraphCfbInfos[3];
-OSTime sGraphTaskStartTime;
+OSTime sGraphPrevUpdateEndTime;
#include "variables.h"
#include "macros.h"
@@ -16,6 +16,7 @@ OSTime sGraphTaskStartTime;
#include "idle.h"
#include "sys_cfb.h"
#include "system_malloc.h"
+#include "z64speed_meter.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"
#include "overlays/gamestates/ovl_opening/z_opening.h"
@@ -310,17 +311,17 @@ void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
{
OSTime time = osGetTime();
- D_801FBAE8 = sRSPGFXTotalTime;
- D_801FBAE0 = gRSPAudioTotalTime;
+ gRSPGfxTimeTotal = gRSPGfxTimeAcc;
+ gRSPAudioTimeTotal = gRSPAudioTimeAcc;
gRDPTimeTotal = gRDPTimeAcc;
- sRSPGFXTotalTime = 0;
- gRSPAudioTotalTime = 0;
+ gRSPGfxTimeAcc = 0;
+ gRSPAudioTimeAcc = 0;
gRDPTimeAcc = 0;
- if (sGraphTaskStartTime != 0) {
- lastRenderFrameDuration = time - sGraphTaskStartTime;
+ if (sGraphPrevUpdateEndTime != 0) {
+ gGraphUpdatePeriod = time - sGraphPrevUpdateEndTime;
}
- sGraphTaskStartTime = time;
+ sGraphPrevUpdateEndTime = time;
}
}
diff --git a/src/code/sched.c b/src/code/sched.c
index f8dc2a35d..289b4a696 100644
--- a/src/code/sched.c
+++ b/src/code/sched.c
@@ -16,6 +16,7 @@ u32 gAudioSPDataSize;
#include "functions.h"
#include "variables.h"
#include "stackcheck.h"
+#include "z64speed_meter.h"
#include "z64thread.h"
#define RSP_DONE_MSG 667
@@ -426,16 +427,16 @@ void Sched_HandleRSPDone(SchedContext* sched) {
time = osGetTime();
switch (sched->curRSPTask->list.t.type) {
case M_AUDTASK:
- gRSPAudioTotalTime += time - sRSPAudioStartTime;
+ gRSPAudioTimeAcc += time - sRSPAudioStartTime;
break;
case M_GFXTASK:
- sRSPGFXTotalTime += time - sRSPGFXStartTime;
+ gRSPGfxTimeAcc += time - sRSPGFXStartTime;
break;
default:
if (1) {}
- sRSPOtherTotalTime += time - sRSPOtherStartTime;
+ gRSPOtherTimeAcc += time - sRSPOtherStartTime;
break;
}
diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c
index 1e6f1f886..3550d62ce 100644
--- a/src/code/speed_meter.c
+++ b/src/code/speed_meter.c
@@ -1,18 +1,266 @@
#include "global.h"
+#include "sys_cfb.h"
#include "z64speed_meter.h"
#include "z64view.h"
#include "system_malloc.h"
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177390.s")
+/**
+ * How much time the RSP ran audio tasks for over the course of `gGraphUpdatePeriod`.
+ */
+volatile OSTime gRSPAudioTimeTotal;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/SpeedMeter_Init.s")
+/**
+ * How much time the RSP ran graphics tasks for over the course of `gGraphUpdatePeriod`.
+ * Typically the RSP runs 1 graphics task per `Graph_Update` cycle, but may run 0 (see `Graph_Update`).
+ */
+volatile OSTime gRSPGfxTimeTotal;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/SpeedMeter_Destroy.s")
+/**
+ * How much time the RDP ran for over the course of `gGraphUpdatePeriod`.
+ */
+volatile OSTime gRDPTimeTotal;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/SpeedMeter_DrawTimeEntries.s")
+/**
+ * How much time elapsed between the last two `Graph_Update` ending.
+ * This is expected to be at least the duration of a single frame, since it includes the time spent waiting on the
+ * graphics task to be done.
+ */
+volatile OSTime gGraphUpdatePeriod;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177A84.s")
+// Accumulator for `gRSPAudioTimeTotal`
+volatile OSTime gRSPAudioTimeAcc;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177AC8.s")
+// Accumulator for `gRSPGfxTimeTotal`.
+volatile OSTime gRSPGfxTimeAcc;
-#pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntries.s")
+volatile OSTime gRSPOtherTimeAcc;
+volatile OSTime gUnkTimeAcc;
+
+// Accumulator for `gRDPTimeTotal`
+volatile OSTime gRDPTimeAcc;
+
+typedef struct {
+ /* 0x0 */ volatile OSTime* time;
+ /* 0x4 */ u16 x;
+ /* 0x5 */ u16 y;
+ /* 0x6 */ u16 color;
+} SpeedMeterTimeEntry; // size = 0x8
+
+SpeedMeterTimeEntry* sSpeedMeterTimeEntryPtr;
+
+SpeedMeterTimeEntry sSpeedMeterTimeEntryArray[] = {
+ { &gRSPAudioTimeTotal, 0, 6, GPACK_RGBA5551(0, 0, 255, 1) },
+ { &gRSPGfxTimeTotal, 0, 8, GPACK_RGBA5551(255, 128, 128, 1) },
+ { &gRDPTimeTotal, 0, 10, GPACK_RGBA5551(0, 255, 0, 1) },
+ { &gGraphUpdatePeriod, 0, 12, GPACK_RGBA5551(255, 0, 255, 1) },
+};
+
+typedef struct {
+ /* 0x00 */ s32 maxVal;
+ /* 0x04 */ s32 val;
+ /* 0x08 */ u16 backColor;
+ /* 0x0A */ u16 foreColor;
+ /* 0x0C */ s32 ulx;
+ /* 0x10 */ s32 lrx;
+ /* 0x14 */ s32 uly;
+ /* 0x18 */ s32 lry;
+} SpeedMeterAllocEntry; // size = 0x1C
+
+//! FAKE: if(1) in macro
+
+#define gDrawRect(gfx, color, ulx, uly, lrx, lry) \
+ do { \
+ if (gSysCfbHiResEnabled == true) { \
+ u32 tmp = color; \
+ gDPPipeSync(gfx); \
+ gDPSetFillColor(gfx, ((tmp) << 16) | (tmp)); \
+ gDPFillRectangle(gfx, (ulx)*2, (uly)*2, (lrx)*2, (lry)*2); \
+ if (1) {} \
+ } else { \
+ u32 tmp = color; \
+ gDPPipeSync(gfx); \
+ gDPSetFillColor(gfx, ((tmp) << 16) | (tmp)); \
+ gDPFillRectangle(gfx, (ulx), (uly), (lrx), (lry)); \
+ } \
+ } while (0)
+
+void SpeedMeter_InitImpl(SpeedMeter* this, s32 x, s32 y) {
+ this->x = x;
+ this->y = y;
+}
+
+void SpeedMeter_Init(SpeedMeter* this) {
+ SpeedMeter_InitImpl(this, 32, 22);
+}
+
+void SpeedMeter_Destroy(SpeedMeter* this) {
+}
+
+void SpeedMeter_DrawTimeEntries(SpeedMeter* this, GraphicsContext* gfxCtx) {
+ s32 pad[3];
+ u32 baseX = 32;
+ s32 width;
+ s32 uly;
+ s32 lry;
+ s32 pad3;
+ View view;
+ s32 pad2[2];
+ s32 i;
+ Gfx* gfx;
+
+ uly = this->y;
+ lry = this->y + 2;
+
+ OPEN_DISPS(gfxCtx);
+
+ /*! @bug if gIrqMgrRetraceTime is 0, CLOSE_DISPS will never be reached */
+ if (gIrqMgrRetraceTime == 0) {
+ return;
+ }
+
+ sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
+ for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
+ width = ((f64)*sSpeedMeterTimeEntryPtr->time / gIrqMgrRetraceTime) * 64.0;
+ sSpeedMeterTimeEntryPtr->x = baseX + width;
+ sSpeedMeterTimeEntryPtr++;
+ }
+
+ View_Init(&view, gfxCtx);
+ view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
+
+ SET_FULLSCREEN_VIEWPORT_DYNAMIC(&view);
+
+ gfx = OVERLAY_DISP;
+ View_ApplyTo(&view, &gfx);
+
+ gDPPipeSync(gfx++);
+ gDPSetOtherMode(gfx++,
+ G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
+ G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE,
+ G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
+
+ gDrawRect(gfx++, GPACK_RGBA5551(0, 0, 255, 1), baseX + 64 * 0, uly, baseX + 64 * 1, lry);
+ gDrawRect(gfx++, GPACK_RGBA5551(0, 255, 0, 1), baseX + 64 * 1, uly, baseX + 64 * 2, lry);
+ gDrawRect(gfx++, GPACK_RGBA5551(255, 0, 0, 1), baseX + 64 * 2, uly, baseX + 64 * 3, lry);
+ gDrawRect(gfx++, GPACK_RGBA5551(255, 0, 255, 1), baseX + 64 * 3, uly, baseX + 64 * 4, lry);
+
+ sSpeedMeterTimeEntryPtr = &sSpeedMeterTimeEntryArray[0];
+ for (i = 0; i < ARRAY_COUNT(sSpeedMeterTimeEntryArray); i++) {
+ gDrawRect(gfx++, sSpeedMeterTimeEntryPtr->color, baseX, lry + sSpeedMeterTimeEntryPtr->y,
+ sSpeedMeterTimeEntryPtr->x, lry + sSpeedMeterTimeEntryPtr->y + 1);
+ sSpeedMeterTimeEntryPtr++;
+ }
+ gDPPipeSync(gfx++);
+
+ OVERLAY_DISP = gfx;
+
+ CLOSE_DISPS(gfxCtx);
+}
+
+void SpeedMeter_InitAllocEntry(SpeedMeterAllocEntry* this, u32 maxVal, u32 val, u16 backColor, u16 foreColor, u32 ulx,
+ u32 lrx, u32 uly, u32 lry) {
+ this->maxVal = maxVal;
+ this->val = val;
+ this->backColor = backColor;
+ this->foreColor = foreColor;
+ this->ulx = ulx;
+ this->lrx = lrx;
+ this->uly = uly;
+ this->lry = lry;
+}
+
+void SpeedMeter_DrawAllocEntry(SpeedMeterAllocEntry* this, GraphicsContext* gfxCtx) {
+ s32 usedOff;
+ View view;
+ Gfx* gfx;
+
+ if (this->maxVal != 0) {
+ OPEN_DISPS(gfxCtx);
+
+ View_Init(&view, gfxCtx);
+ view.flags = VIEW_VIEWPORT | VIEW_PROJECTION_ORTHO;
+
+ SET_FULLSCREEN_VIEWPORT_DYNAMIC(&view);
+
+ gfx = OVERLAY_DISP;
+ View_ApplyTo(&view, &gfx);
+
+ gDPPipeSync(gfx++);
+ gDPSetOtherMode(gfx++,
+ G_AD_PATTERN | G_CD_MAGICSQ | G_CK_NONE | G_TC_CONV | G_TF_POINT | G_TT_NONE | G_TL_TILE |
+ G_TD_CLAMP | G_TP_NONE | G_CYC_FILL | G_PM_NPRIMITIVE,
+ G_AC_NONE | G_ZS_PIXEL | G_RM_NOOP | G_RM_NOOP2);
+
+ usedOff = ((this->lrx - this->ulx) * this->val) / this->maxVal + this->ulx;
+ gDrawRect(gfx++, this->backColor, usedOff, this->uly, this->lrx, this->lry);
+ gDrawRect(gfx++, this->foreColor, this->ulx, this->uly, usedOff, this->lry);
+
+ gDPPipeSync(gfx++);
+
+ //! FAKE:
+ if (this && this && this) {}
+
+ OVERLAY_DISP = gfx;
+ CLOSE_DISPS(gfxCtx);
+ }
+}
+
+void SpeedMeter_DrawAllocEntries(SpeedMeter* meter, GraphicsContext* gfxCtx, GameState* state) {
+ s32 pad[2];
+ u32 ulx = 30;
+ u32 lrx = 290;
+ SpeedMeterAllocEntry entry;
+ TwoHeadArena* tha;
+ s32 y;
+ TwoHeadGfxArena* thga;
+ u32 zeldaFreeMax;
+ u32 zeldaFree;
+ u32 zeldaAlloc;
+ s32 sysFreeMax;
+ s32 sysFree;
+ s32 sysAlloc;
+
+ y = 212;
+ if (R_ENABLE_ARENA_DBG > 2) {
+ if (ZeldaArena_IsInitialized()) {
+ ZeldaArena_GetSizes(&zeldaFreeMax, &zeldaFree, &zeldaAlloc);
+ SpeedMeter_InitAllocEntry(&entry, zeldaFree + zeldaAlloc, zeldaAlloc, GPACK_RGBA5551(0, 0, 255, 1),
+ GPACK_RGBA5551(255, 255, 255, 1), ulx, lrx, y, y + 1);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+ y++;
+ }
+ }
+
+ if (R_ENABLE_ARENA_DBG > 1) {
+ SystemArena_GetSizes((u32*)&sysFreeMax, (u32*)&sysFree, (u32*)&sysAlloc);
+ SpeedMeter_InitAllocEntry(&entry, sysFree + sysAlloc - state->tha.size, sysAlloc - state->tha.size,
+ GPACK_RGBA5551(0, 0, 255, 1), GPACK_RGBA5551(255, 128, 128, 1), ulx, lrx, y, y);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+ }
+
+ tha = &state->tha;
+ SpeedMeter_InitAllocEntry(&entry, tha->size, tha->size - THA_GetRemaining(tha), GPACK_RGBA5551(0, 0, 255, 1),
+ GPACK_RGBA5551(0, 255, 0, 1), ulx, lrx, y, y);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+
+ thga = &gfxCtx->polyOpa;
+ SpeedMeter_InitAllocEntry(&entry, thga->size, thga->size - THGA_GetRemaining(thga), GPACK_RGBA5551(0, 0, 255, 1),
+ GPACK_RGBA5551(255, 0, 255, 1), ulx, lrx, y, y);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+
+ thga = &gfxCtx->polyXlu;
+ SpeedMeter_InitAllocEntry(&entry, thga->size, thga->size - THGA_GetRemaining(thga), GPACK_RGBA5551(0, 0, 255, 1),
+ GPACK_RGBA5551(255, 255, 0, 1), ulx, lrx, y, y);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+
+ thga = &gfxCtx->overlay;
+ SpeedMeter_InitAllocEntry(&entry, thga->size, thga->size - THGA_GetRemaining(thga), GPACK_RGBA5551(0, 0, 255, 1),
+ GPACK_RGBA5551(255, 0, 0, 1), ulx, lrx, y, y);
+ SpeedMeter_DrawAllocEntry(&entry, gfxCtx);
+ y++;
+}
diff --git a/src/code/sys_matrix.c b/src/code/sys_matrix.c
index 6269add5f..f84dae383 100644
--- a/src/code/sys_matrix.c
+++ b/src/code/sys_matrix.c
@@ -75,7 +75,7 @@ MtxF* sCurrentMatrix; //!< original name: "Matrix_now"
* @remark original name: "new_Matrix"
*/
void Matrix_Init(GameState* gameState) {
- sMatrixStack = THA_AllocTailAlign16(&gameState->heap, MATRIX_STACK_SIZE * sizeof(MtxF));
+ sMatrixStack = THA_AllocTailAlign16(&gameState->tha, MATRIX_STACK_SIZE * sizeof(MtxF));
sCurrentMatrix = sMatrixStack;
}
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index ae871c8a6..2bef40dce 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -140,7 +140,7 @@ void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) {
}
void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) {
- list->tbl = (SSNode*)THA_AllocTailAlign(&play->state.heap, numNodes * sizeof(SSNode), -2);
+ list->tbl = (SSNode*)THA_AllocTailAlign(&play->state.tha, numNodes * sizeof(SSNode), -2);
list->maxNodes = numNodes;
list->count = 0;
}
@@ -1580,7 +1580,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
}
}
colCtx->lookupTbl = THA_AllocTailAlign(
- &play->state.heap,
+ &play->state.tha,
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1);
if (colCtx->lookupTbl == NULL) {
Fault_AddHungupAndCrash("../z_bgcheck.c", 3955);
@@ -2456,8 +2456,8 @@ void SSNodeList_Init(SSNodeList* this) {
void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) {
this->max = tblMax;
this->count = 0;
- this->tbl = THA_AllocTailAlign(&play->state.heap, tblMax * sizeof(SSNode), -2);
- this->polyCheckTbl = THA_AllocTailAlign16(&play->state.heap, numPolys * sizeof(u8));
+ this->tbl = THA_AllocTailAlign(&play->state.tha, tblMax * sizeof(SSNode), -2);
+ this->polyCheckTbl = THA_AllocTailAlign16(&play->state.tha, numPolys * sizeof(u8));
if (this->polyCheckTbl == NULL) {
sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n");
@@ -2599,7 +2599,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) {
* Allocate dyna.polyList
*/
void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) {
- *polyList = THA_AllocTailAlign(&play->state.heap, numPolys * sizeof(CollisionPoly), -2);
+ *polyList = THA_AllocTailAlign(&play->state.tha, numPolys * sizeof(CollisionPoly), -2);
}
/**
@@ -2613,7 +2613,7 @@ void DynaPoly_NullVtxList(Vec3s** vtxList) {
* Allocate dyna.vtxList
*/
void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) {
- *vtxList = THA_AllocTailAlign(&play->state.heap, numVtx * sizeof(Vec3s), -2);
+ *vtxList = THA_AllocTailAlign(&play->state.tha, numVtx * sizeof(Vec3s), -2);
}
/**
@@ -2628,7 +2628,7 @@ void DynaPoly_InitWaterBoxList(DynaWaterBoxList* waterBoxList) {
* Allocate dyna.waterBoxList
*/
void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) {
- waterBoxList->boxes = THA_AllocTailAlign(&play->state.heap, numWaterBoxes * sizeof(WaterBox), -2);
+ waterBoxList->boxes = THA_AllocTailAlign(&play->state.tha, numWaterBoxes * sizeof(WaterBox), -2);
}
/**
diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c
index 870132a07..08aa845ab 100644
--- a/src/code/z_effect_soft_sprite.c
+++ b/src/code/z_effect_soft_sprite.c
@@ -8,7 +8,7 @@ void EffectSS_Init(PlayState* play, s32 numEntries) {
EffectSs* effectsSs;
EffectSsOverlay* overlay;
- sEffectSsInfo.data_table = (EffectSs*)THA_AllocTailAlign16(&play->state.heap, numEntries * sizeof(EffectSs));
+ sEffectSsInfo.data_table = (EffectSs*)THA_AllocTailAlign16(&play->state.tha, numEntries * sizeof(EffectSs));
sEffectSsInfo.searchIndex = 0;
sEffectSsInfo.size = numEntries;
diff --git a/src/code/z_kaleido_manager.c b/src/code/z_kaleido_manager.c
index e09492d4e..d0bacdd22 100644
--- a/src/code/z_kaleido_manager.c
+++ b/src/code/z_kaleido_manager.c
@@ -66,7 +66,7 @@ void KaleidoManager_Init(PlayState* play) {
}
}
- sKaleidoAreaPtr = THA_AllocTailAlign16(&play->state.heap, largestSize);
+ sKaleidoAreaPtr = THA_AllocTailAlign16(&play->state.tha, largestSize);
gKaleidoMgrCurOvl = NULL;
Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL);
}
diff --git a/src/code/z_malloc.c b/src/code/z_malloc.c
index 781f4310e..ac56231cf 100644
--- a/src/code/z_malloc.c
+++ b/src/code/z_malloc.c
@@ -40,7 +40,7 @@ void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc)
__osGetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc);
}
-s32 ZeldaArena_Check() {
+s32 ZeldaArena_Check(void) {
return __osCheckArena(&sZeldaArena);
}
@@ -48,10 +48,10 @@ void ZeldaArena_Init(void* start, size_t size) {
__osMallocInit(&sZeldaArena, start, size);
}
-void ZeldaArena_Cleanup() {
+void ZeldaArena_Cleanup(void) {
__osMallocCleanup(&sZeldaArena);
}
-u8 ZeldaArena_IsInitialized() {
+u8 ZeldaArena_IsInitialized(void) {
return __osMallocIsInitalized(&sZeldaArena);
}
diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c
index c087fe059..f04562e03 100644
--- a/src/code/z_map_exp.c
+++ b/src/code/z_map_exp.c
@@ -181,7 +181,7 @@ void Map_Init(PlayState* play) {
func_80105C40(play->roomCtx.curRoom.num);
interfaceCtx->unk_278 = -1;
interfaceCtx->dungeonOrBossAreaMapIndex = -1;
- interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.heap, 0x1000);
+ interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.tha, 0x1000);
if (func_8010A2AC(play)) {
gSaveContext.mapIndex = func_8010A238(play);
return;
diff --git a/src/code/z_message.c b/src/code/z_message.c
index a922f237b..42a0e301f 100644
--- a/src/code/z_message.c
+++ b/src/code/z_message.c
@@ -597,7 +597,7 @@ void Message_Init(PlayState* play) {
msgCtx->ocarinaAction = msgCtx->textUnskippable = 0;
msgCtx->textColorAlpha = 0xFF;
View_Init(&msgCtx->view, play->state.gfxCtx);
- msgCtx->textboxSegment = THA_AllocTailAlign16(&play->state.heap, 0x13C00);
+ msgCtx->textboxSegment = THA_AllocTailAlign16(&play->state.tha, 0x13C00);
font = &play->msgCtx.font;
Font_LoadOrderedFont(&play->msgCtx.font);
font->unk_11D88 = 0;
diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c
index 2c4106e05..4fcd31c8b 100644
--- a/src/code/z_parameter.c
+++ b/src/code/z_parameter.c
@@ -7115,16 +7115,16 @@ void Interface_Init(PlayState* play) {
interfaceCtx->healthTimer = 200;
parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static);
- interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.heap, parameterStaticSize);
+ interfaceCtx->parameterSegment = THA_AllocTailAlign16(&play->state.tha, parameterStaticSize);
DmaMgr_SendRequest0(interfaceCtx->parameterSegment, SEGMENT_ROM_START(parameter_static), parameterStaticSize);
- interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.heap, 0xC90);
+ interfaceCtx->doActionSegment = THA_AllocTailAlign16(&play->state.tha, 0xC90);
DmaMgr_SendRequest0(interfaceCtx->doActionSegment, SEGMENT_ROM_START(do_action_static), 0x300);
DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180);
Interface_NewDay(play, CURRENT_DAY);
- interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.heap, 0x4000);
+ interfaceCtx->iconItemSegment = THA_AllocTailAlign16(&play->state.tha, 0x4000);
if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) {
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 44efbfbfb..41b921125 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1562,7 +1562,7 @@ void Play_GetFloorSurface(PlayState* this, MtxF* mtx, Vec3f* pos) {
void* Play_LoadFile(PlayState* this, RomFile* entry) {
size_t size = entry->vromEnd - entry->vromStart;
- void* allocp = THA_AllocTailAlign16(&this->state.heap, size);
+ void* allocp = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(allocp, entry->vromStart, size);
@@ -2324,9 +2324,9 @@ void Play_Init(GameState* thisx) {
D_801F6D4C->envColor.b = 0;
D_801F6D4C->envColor.a = 0;
CutsceneFlags_UnsetAll(this);
- THA_GetRemaining(&this->state.heap);
- zAllocSize = THA_GetRemaining(&this->state.heap);
- zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize);
+ THA_GetRemaining(&this->state.tha);
+ zAllocSize = THA_GetRemaining(&this->state.tha);
+ zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.tha, zAllocSize);
ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s
Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);
diff --git a/src/code/z_room.c b/src/code/z_room.c
index b8de6caec..d06739d87 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -516,7 +516,7 @@ size_t Room_AllocateAndLoad(PlayState* play, RoomContext* roomCtx) {
}
}
- roomCtx->roomMemPages[0] = THA_AllocTailAlign16(&play->state.heap, maxRoomSize);
+ roomCtx->roomMemPages[0] = THA_AllocTailAlign16(&play->state.tha, maxRoomSize);
if (roomCtx->roomMemPages[0] == NULL) {
_dbg_hungup("../z_room.c", 1078);
}
diff --git a/src/code/z_scene.c b/src/code/z_scene.c
index 529458f83..811853f07 100644
--- a/src/code/z_scene.c
+++ b/src/code/z_scene.c
@@ -48,7 +48,7 @@ void Object_InitBank(GameState* gameState, ObjectContext* objectCtx) {
for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; }
// clang-format on
- objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocTailAlign16(&gameState->heap, spaceSize);
+ objectCtx->spaceStart = objectCtx->status[0].segment = THA_AllocTailAlign16(&gameState->tha, spaceSize);
objectCtx->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP);
@@ -357,7 +357,7 @@ void Scene_LoadAreaTextures(PlayState* play, s32 fileIndex) {
size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) {
- play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.heap, size);
+ play->roomCtx.unk74 = THA_AllocTailAlign16(&play->state.tha, size);
DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size);
}
}
diff --git a/src/code/z_sram_NES.c b/src/code/z_sram_NES.c
index 198dac4e9..8d382e5db 100644
--- a/src/code/z_sram_NES.c
+++ b/src/code/z_sram_NES.c
@@ -1866,7 +1866,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
if (gSaveContext.flashSaveAvailable) {
- sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->heap, SAVE_BUFFER_SIZE);
+ sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->tha, SAVE_BUFFER_SIZE);
sramCtx->status = 0;
}
}
diff --git a/src/code/z_vr_box.c b/src/code/z_vr_box.c
index dd0785d94..605dff84c 100644
--- a/src/code/z_vr_box.c
+++ b/src/code/z_vr_box.c
@@ -294,15 +294,15 @@ void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) {
Skybox_Setup(gameState, skyboxCtx, skyboxId);
if (skyboxId != SKYBOX_NONE) {
- skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->heap, 0x3840);
+ skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->tha, 0x3840);
if (skyboxId == SKYBOX_CUTSCENE_MAP) {
// Allocate enough space for the vertices for a 6 sided skybox (cube)
- skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 6);
+ skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->tha, sizeof(Vtx) * 32 * 6);
func_80143148(skyboxCtx, 6);
} else {
// Allocate enough space for the vertices for a 5 sided skybox (bottom is missing)
- skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->heap, sizeof(Vtx) * 32 * 5);
+ skyboxCtx->roomVtx = THA_AllocTailAlign16(&gameState->tha, sizeof(Vtx) * 32 * 5);
func_80143148(skyboxCtx, 5);
}
}
diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
index 1b68e0b14..637a20906 100644
--- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
+++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c
@@ -215,11 +215,11 @@ void DayTelop_Noop(DayTelopState* this) {
void DayTelop_LoadGraphics(DayTelopState* this) {
size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static);
- this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize);
+ this->daytelopStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize);
segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static);
- this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.heap, segmentSize);
+ this->gameoverStaticFile = THA_AllocTailAlign16(&this->state.tha, segmentSize);
DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
}
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
index 4d3e172d9..a47b5ed9e 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c
@@ -2531,15 +2531,15 @@ void FileSelect_Init(GameState* thisx) {
Font_LoadOrderedFont(&this->font);
size = SEGMENT_ROM_SIZE(title_static);
- this->staticSegment = THA_AllocTailAlign16(&this->state.heap, size);
+ this->staticSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(title_static), size);
size = SEGMENT_ROM_SIZE(parameter_static);
- this->parameterSegment = THA_AllocTailAlign16(&this->state.heap, size);
+ this->parameterSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size);
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart;
- this->titleSegment = THA_AllocTailAlign16(&this->state.heap, size);
+ this->titleSegment = THA_AllocTailAlign16(&this->state.tha, size);
DmaMgr_SendRequest0(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size);
Audio_SetSpec(0xA);
diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c
index c829e79a9..5cebc2fca 100644
--- a/src/overlays/gamestates/ovl_title/z_title.c
+++ b/src/overlays/gamestates/ovl_title/z_title.c
@@ -154,7 +154,7 @@ void ConsoleLogo_Init(GameState* thisx) {
ConsoleLogoState* this = (ConsoleLogoState*)thisx;
uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static);
- this->staticSegment = THA_AllocTailAlign16(&this->state.heap, segmentSize);
+ this->staticSegment = THA_AllocTailAlign16(&this->state.tha, segmentSize);
DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize);
GameState_SetFramerateDivisor(&this->state, 1);
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 4a8419dc5..c1137d3b2 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -3215,12 +3215,12 @@
0x80177084:("Sched_FaultClient",),
0x8017715C:("Sched_ThreadEntry",),
0x801772A0:("Sched_Init",),
- 0x80177390:("func_80177390",),
+ 0x80177390:("SpeedMeter_InitImpl",),
0x801773A0:("SpeedMeter_Init",),
0x801773C4:("SpeedMeter_Destroy",),
0x801773D0:("SpeedMeter_DrawTimeEntries",),
- 0x80177A84:("func_80177A84",),
- 0x80177AC8:("func_80177AC8",),
+ 0x80177A84:("SpeedMeter_InitAllocEntry",),
+ 0x80177AC8:("SpeedMeter_DrawAllocEntry",),
0x80177E58:("SpeedMeter_DrawAllocEntries",),
0x801780F0:("Mtx_SetTranslateScaleMtx",),
0x801781EC:("Mtx_SetRotationMtx",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index aababcf0b..417e27b77 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -21,7 +21,7 @@
0x80096B50:("gDmaMgrDmaBuffSize","u32","",0x4),
0x80096B60:("gIrqMgrResetStatus","vs32","",0x4),
0x80096B68:("sIrqMgrResetTime","volatile OSTime","",0x8),
- 0x80096B70:("sIrqMgrRetraceTime","volatile OSTime","",0x8),
+ 0x80096B70:("gIrqMgrRetraceTime","volatile OSTime","",0x8),
0x80096B78:("sIrqMgrRetraceCount","s32","",0x4),
0x80096B80:("sCpuExceptions","char*","[18]",0x48),
0x80096BC8:("sFpuExceptions","char*","[6]",0x18),
@@ -2159,7 +2159,7 @@
0x801D1530:("sPadMgrInstance","PadMgr*","",0x4),
0x801D1534:("sPadMgrRetraceCount","UNK_TYPE4","",0x4),
0x801D1538:("sVoiceInitStatus","UNK_TYPE4","",0x4),
- 0x801D1540:("D_801D1540","UNK_PTR","",0x4),
+ 0x801D1540:("sSpeedMeterTimeEntryArray","UNK_PTR","",0x4),
0x801D1570:("D_801D1570","f32","[13]",0x34),
0x801D15B0:("gZeroVec3f","Vec3f","",0xC),
0x801D15BC:("gZeroVec3s","Vec3s","",0x6),
@@ -4032,7 +4032,7 @@
0x801F80E0:("sGraphFaultClient","FaultClient","",0x10),
0x801F80F0:("gGfxMasterDL","Gfx*","",0x4),
0x801F80F8:("sGraphCfbInfos","UNK_TYPE1","",0x1),
- 0x801F8150:("sGraphTaskStartTime","u64","",0x8),
+ 0x801F8150:("sGraphPrevUpdateEndTime","u64","",0x8),
0x801F8160:("sSerialEventQueue","OSMesgQueue","",0x18),
0x801F8178:("sSerialMsgBuf","OSMesg","[1]",0x4),
0x801F8180:("gSegments","u32","[16]",0x40),
@@ -4052,24 +4052,22 @@
0x801FB338:("sAudioMgr","AudioMgr","",0x2e0),
0x801FB620:("gPadMgr","PadMgr","",0x480),
0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1),
- 0x801FBAB0:("sRSPGFXStartTime","OSTime","",0x8),
- 0x801FBAB8:("sRSPAudioStartTime","OSTime","",0x8),
- 0x801FBAC0:("sRSPOtherStartTime","OSTime","",0x8),
+ 0x801FBAB0:("sRSPGfxTimeStart","OSTime","",0x8),
+ 0x801FBAB8:("sRSPAudioTimeStart","OSTime","",0x8),
+ 0x801FBAC0:("sRSPOtherTimeStart","OSTime","",0x8),
0x801FBAC8:("sRDPStartTime","OSTime","",0x8),
0x801FBAD0:("gAudioSPDataPtr","u64*","",0x4),
0x801FBAD4:("gAudioSPDataSize","u32","",0x4),
- 0x801FBAE0:("D_801FBAE0","UNK_TYPE1","",0x1),
- 0x801FBAE8:("D_801FBAE8","UNK_TYPE1","",0x1),
+ 0x801FBAE0:("gRSPAudioTimeTotal","volatile OSTime","",0x8),
+ 0x801FBAE8:("gRSPGfxTimeTotal","volatile OSTime","",0x8),
0x801FBAF0:("gRDPTimeTotal","volatile OSTime","",0x8),
- 0x801FBAF8:("lastRenderFrameDuration","volatile OSTime","",0x8),
- 0x801FBB00:("gRSPAudioTotalTime","UNK_TYPE1","",0x1),
- 0x801FBB04:("D_801FBB04","UNK_TYPE1","",0x1),
- 0x801FBB08:("sRSPGFXTotalTime","UNK_TYPE1","",0x1),
- 0x801FBB0C:("D_801FBB0C","UNK_TYPE1","",0x1),
- 0x801FBB10:("sRSPOtherTotalTime","UNK_TYPE1","",0x1),
- 0x801FBB14:("D_801FBB14","UNK_TYPE1","",0x1),
- 0x801FBB20:("gRDPTimeAcc","UNK_TYPE1","",0x1),
- 0x801FBB28:("D_801FBB28","UNK_TYPE1","",0x1),
+ 0x801FBAF8:("gGraphUpdatePeriod","volatile OSTime","",0x8),
+ 0x801FBB00:("gRSPAudioTimeAcc","volatile OSTime","",0x8),
+ 0x801FBB08:("gRSPGfxTimeAcc","volatile OSTime","",0x8),
+ 0x801FBB10:("gRSPOtherTimeAcc","volatile OSTime","",0x8),
+ 0x801FBB18:("gUnkTimeAcc","volatile OSTime","",0x8),
+ 0x801FBB20:("gRDPTimeAcc","volatile OSTime","",0x8),
+ 0x801FBB28:("sSpeedMeterTimeEntryPtr","UNK_TYPE1","",0x1),
0x801FBB30:("sNotebookViMode","OSViMode","",0x50),
0x801FBB80:("gFramebuffers","u32*","[2]",0x8),
0x801FBB88:("gActiveViMode","OSViMode*","",0x4),
diff --git a/tools/permuter_settings.toml b/tools/permuter_settings.toml
index efa3bc2fe..0aa806f2a 100644
--- a/tools/permuter_settings.toml
+++ b/tools/permuter_settings.toml
@@ -34,6 +34,8 @@ CLEAR_EVENTINF = "int"
CLEAR_EVENTINF_ALT = "int"
"EVENTINF_.*" = "int"
".+REG" = "int"
+SET_FULLSCREEN_VIEWPORT_DYNAMIC = "void"
+gDrawRect = "void"
[decompme.compilers]
"tools/ido_recomp/linux/7.1/cc" = "ido7.1"
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index 5194497c7..3e6042f03 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -2729,12 +2729,12 @@ asm/non_matchings/code/sched/Sched_SendGfxCancelMsg.s,Sched_SendGfxCancelMsg,0x8
asm/non_matchings/code/sched/Sched_FaultClient.s,Sched_FaultClient,0x80177084,0x36
asm/non_matchings/code/sched/Sched_ThreadEntry.s,Sched_ThreadEntry,0x8017715C,0x51
asm/non_matchings/code/sched/Sched_Init.s,Sched_Init,0x801772A0,0x3C
-asm/non_matchings/code/speed_meter/func_80177390.s,func_80177390,0x80177390,0x4
+asm/non_matchings/code/speed_meter/SpeedMeter_InitImpl.s,SpeedMeter_InitImpl,0x80177390,0x4
asm/non_matchings/code/speed_meter/SpeedMeter_Init.s,SpeedMeter_Init,0x801773A0,0x9
asm/non_matchings/code/speed_meter/SpeedMeter_Destroy.s,SpeedMeter_Destroy,0x801773C4,0x3
asm/non_matchings/code/speed_meter/SpeedMeter_DrawTimeEntries.s,SpeedMeter_DrawTimeEntries,0x801773D0,0x1AD
-asm/non_matchings/code/speed_meter/func_80177A84.s,func_80177A84,0x80177A84,0x11
-asm/non_matchings/code/speed_meter/func_80177AC8.s,func_80177AC8,0x80177AC8,0xE4
+asm/non_matchings/code/speed_meter/SpeedMeter_InitAllocEntry.s,SpeedMeter_InitAllocEntry,0x80177A84,0x11
+asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntry.s,SpeedMeter_DrawAllocEntry,0x80177AC8,0xE4
asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntries.s,SpeedMeter_DrawAllocEntries,0x80177E58,0xA6
asm/non_matchings/code/speed_meter/func_801780F0.s,func_801780F0,0x801780F0,0x3F
asm/non_matchings/code/speed_meter/func_801781EC.s,func_801781EC,0x801781EC,0x90