Speedmeter OK (#1393)

* Match

* data + bss

* x

* Small cleanup

* maxVal

* gUnkTimeAcc

* SET_FULLSCREEN_VIEWPORT_HIRES

* Update permuter settings

* SET_FULLSCREEN_VIEWPORT_DYNAMIC
This commit is contained in:
Derek Hensley 2023-10-02 21:52:41 -07:00 committed by GitHub
parent 2a485ad774
commit 4ca54d704e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 367 additions and 110 deletions

View File

@ -667,10 +667,10 @@ void* ZeldaArena_Realloc(void* ptr, size_t newSize);
void ZeldaArena_Free(void* ptr); void ZeldaArena_Free(void* ptr);
void* ZeldaArena_Calloc(u32 num, size_t size); void* ZeldaArena_Calloc(u32 num, size_t size);
void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc); 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_Init(void* start, size_t size);
void ZeldaArena_Cleanup(void); void ZeldaArena_Cleanup(void);
u8 ZeldaArena_IsInitialized(); u8 ZeldaArena_IsInitialized(void);
// void func_80102E40(void); // void func_80102E40(void);
// void func_80102E90(void); // void func_80102E90(void);
// void func_80102EA4(void); // void func_80102EA4(void);

View File

@ -14,7 +14,7 @@ extern OSPiHandle* gCartHandle;
extern size_t gDmaMgrDmaBuffSize; extern size_t gDmaMgrDmaBuffSize;
extern vs32 gIrqMgrResetStatus; extern vs32 gIrqMgrResetStatus;
extern volatile OSTime sIrqMgrResetTime; extern volatile OSTime sIrqMgrResetTime;
extern volatile OSTime sIrqMgrRetraceTime; extern volatile OSTime gIrqMgrRetraceTime;
extern s32 sIrqMgrRetraceCount; extern s32 sIrqMgrRetraceCount;
// extern UNK_TYPE1 sGfxPrintFontTLUT; // extern UNK_TYPE1 sGfxPrintFontTLUT;
@ -366,7 +366,6 @@ extern Input* D_801D0D60;
extern u32 retryCount; extern u32 retryCount;
extern u32 cfbIdx[3]; extern u32 cfbIdx[3];
extern UNK_PTR D_801D1540;
extern Vec3f gZeroVec3f; extern Vec3f gZeroVec3f;
extern Vec3s gZeroVec3s; extern Vec3s gZeroVec3s;
@ -1903,19 +1902,6 @@ extern GfxMasterList* gGfxMasterDL;
extern u64* gAudioSPDataPtr; extern u64* gAudioSPDataPtr;
extern u32 gAudioSPDataSize; 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 Vec3f D_801FBBF0;
extern LineSegment Math3D_ColSphereTri_line; extern LineSegment Math3D_ColSphereTri_line;
extern Vec3f Math3D_ColSphereTri_point; extern Vec3f Math3D_ColSphereTri_point;

View File

@ -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. /* 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; /* 0x10 */ size_t size;
/* 0x14 */ Input input[MAXCONTROLLERS]; /* 0x14 */ Input input[MAXCONTROLLERS];
/* 0x74 */ TwoHeadArena heap; /* 0x74 */ TwoHeadArena tha;
/* 0x84 */ GameAlloc alloc; /* 0x84 */ GameAlloc alloc;
/* 0x98 */ UNK_TYPE1 pad98[0x3]; /* 0x98 */ UNK_TYPE1 pad98[0x3];
/* 0x9B */ u8 running; // If 0, switch to next game state /* 0x9B */ u8 running; // If 0, switch to next game state

View File

@ -7,12 +7,24 @@ struct GameState;
struct GraphicsContext; struct GraphicsContext;
typedef struct SpeedMeter { typedef struct SpeedMeter {
/* 0x00 */ char unk_00[0x20]; /* 0x00 */ char unk_00[0x18];
/* 0x18 */ s32 x; // Unused
/* 0x1C */ s32 y;
} SpeedMeter; // size = 0x20 } SpeedMeter; // size = 0x20
void SpeedMeter_Init(SpeedMeter* this); void SpeedMeter_Init(SpeedMeter* this);
void SpeedMeter_Destroy(SpeedMeter* this); void SpeedMeter_Destroy(SpeedMeter* this);
void SpeedMeter_DrawTimeEntries(SpeedMeter* this, struct GraphicsContext* gfxCtx); 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 #endif

View File

@ -65,6 +65,17 @@ typedef struct View {
} \ } \
(void)0 (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_Init(View* view, struct GraphicsContext* gfxCtx);
void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up);
void View_SetScale(View* view, f32 scale); void View_SetScale(View* view, f32 scale);

2
spec
View File

@ -560,8 +560,6 @@ beginseg
include "build/src/code/padmgr.o" include "build/src/code/padmgr.o"
include "build/src/code/sched.o" include "build/src/code/sched.o"
include "build/src/code/speed_meter.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/su_mtx.o"
include "build/src/code/sys_cfb.o" include "build/src/code/sys_cfb.o"
include "build/src/code/sys_cmpdma.o" include "build/src/code/sys_cmpdma.o"

View File

@ -4,7 +4,7 @@
vs32 gIrqMgrResetStatus = 0; vs32 gIrqMgrResetStatus = 0;
volatile OSTime sIrqMgrResetTime = 0; volatile OSTime sIrqMgrResetTime = 0;
volatile OSTime sIrqMgrRetraceTime = 0; volatile OSTime gIrqMgrRetraceTime = 0;
s32 sIrqMgrRetraceCount = 0; s32 sIrqMgrRetraceCount = 0;
void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue) { void IrqMgr_AddClient(IrqMgr* irqmgr, IrqMgrClient* client, OSMesgQueue* msgQueue) {
@ -109,11 +109,11 @@ void IrqMgr_HandlePRENMI500(IrqMgr* irqmgr) {
IrqMgr_CheckStack(); IrqMgr_CheckStack();
} }
void IrqMgr_HandleRetrace(IrqMgr* irqmgr) { void IrqMgr_HandleRetrace(IrqMgr* irqmgr) {
if (sIrqMgrRetraceTime == 0) { if (gIrqMgrRetraceTime == 0) {
if (irqmgr->lastFrameTime == 0) { if (irqmgr->lastFrameTime == 0) {
irqmgr->lastFrameTime = osGetTime(); irqmgr->lastFrameTime = osGetTime();
} else { } else {
sIrqMgrRetraceTime = osGetTime() - irqmgr->lastFrameTime; gIrqMgrRetraceTime = osGetTime() - irqmgr->lastFrameTime;
} }
} }

View File

@ -164,11 +164,11 @@ void GameState_InitArena(GameState* gameState, size_t size) {
void* buf = GameAlloc_Malloc(alloc, size); void* buf = GameAlloc_Malloc(alloc, size);
if (buf) { if (buf) {
THA_Init(&gameState->heap, buf, size); THA_Init(&gameState->tha, buf, size);
return; return;
} }
THA_Init(&gameState->heap, NULL, 0); THA_Init(&gameState->tha, NULL, 0);
_dbg_hungup("../game.c", 1035); _dbg_hungup("../game.c", 1035);
} }
@ -178,9 +178,9 @@ void GameState_Realloc(GameState* gameState, size_t size) {
size_t systemMaxFree; size_t systemMaxFree;
size_t bytesFree; size_t bytesFree;
size_t bytesAllocated; 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); GameAlloc_Free(alloc, heapStart);
SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated); SystemArena_GetSizes(&systemMaxFree, &bytesFree, &bytesAllocated);
size = ((systemMaxFree - sizeof(ArenaNode)) < size) ? 0 : size; size = ((systemMaxFree - sizeof(ArenaNode)) < size) ? 0 : size;
@ -190,9 +190,9 @@ void GameState_Realloc(GameState* gameState, size_t size) {
gameArena = GameAlloc_Malloc(alloc, size); gameArena = GameAlloc_Malloc(alloc, size);
if (gameArena != NULL) { if (gameArena != NULL) {
THA_Init(&gameState->heap, gameArena, size); THA_Init(&gameState->tha, gameArena, size);
} else { } else {
THA_Init(&gameState->heap, NULL, 0); THA_Init(&gameState->tha, NULL, 0);
_dbg_hungup("../game.c", 1074); _dbg_hungup("../game.c", 1074);
} }
} }
@ -246,7 +246,7 @@ void GameState_Destroy(GameState* gameState) {
VisZbuf_Destroy(&sGameVisZbuf); VisZbuf_Destroy(&sGameVisZbuf);
VisMono_Destroy(&sGameVisMono); VisMono_Destroy(&sGameVisMono);
ViMode_Destroy(&sGameViMode); ViMode_Destroy(&sGameViMode);
THA_Destroy(&gameState->heap); THA_Destroy(&gameState->tha);
GameAlloc_Cleanup(&gameState->alloc); GameAlloc_Cleanup(&gameState->alloc);
} }
@ -263,11 +263,11 @@ u32 GameState_IsRunning(GameState* gameState) {
} }
s32 GameState_GetArenaSize(GameState* gameState) { s32 GameState_GetArenaSize(GameState* gameState) {
return THA_GetRemaining(&gameState->heap); return THA_GetRemaining(&gameState->tha);
} }
s32 func_80173B48(GameState* gameState) { 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; return result;
} }

View File

@ -8,7 +8,7 @@ FaultAddrConvClient sGraphFaultAddrConvClient;
FaultClient sGraphFaultClient; FaultClient sGraphFaultClient;
GfxMasterList* gGfxMasterDL; GfxMasterList* gGfxMasterDL;
CfbInfo sGraphCfbInfos[3]; CfbInfo sGraphCfbInfos[3];
OSTime sGraphTaskStartTime; OSTime sGraphPrevUpdateEndTime;
#include "variables.h" #include "variables.h"
#include "macros.h" #include "macros.h"
@ -16,6 +16,7 @@ OSTime sGraphTaskStartTime;
#include "idle.h" #include "idle.h"
#include "sys_cfb.h" #include "sys_cfb.h"
#include "system_malloc.h" #include "system_malloc.h"
#include "z64speed_meter.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h" #include "overlays/gamestates/ovl_file_choose/z_file_select.h"
#include "overlays/gamestates/ovl_opening/z_opening.h" #include "overlays/gamestates/ovl_opening/z_opening.h"
@ -310,17 +311,17 @@ void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) {
{ {
OSTime time = osGetTime(); OSTime time = osGetTime();
D_801FBAE8 = sRSPGFXTotalTime; gRSPGfxTimeTotal = gRSPGfxTimeAcc;
D_801FBAE0 = gRSPAudioTotalTime; gRSPAudioTimeTotal = gRSPAudioTimeAcc;
gRDPTimeTotal = gRDPTimeAcc; gRDPTimeTotal = gRDPTimeAcc;
sRSPGFXTotalTime = 0; gRSPGfxTimeAcc = 0;
gRSPAudioTotalTime = 0; gRSPAudioTimeAcc = 0;
gRDPTimeAcc = 0; gRDPTimeAcc = 0;
if (sGraphTaskStartTime != 0) { if (sGraphPrevUpdateEndTime != 0) {
lastRenderFrameDuration = time - sGraphTaskStartTime; gGraphUpdatePeriod = time - sGraphPrevUpdateEndTime;
} }
sGraphTaskStartTime = time; sGraphPrevUpdateEndTime = time;
} }
} }

View File

@ -16,6 +16,7 @@ u32 gAudioSPDataSize;
#include "functions.h" #include "functions.h"
#include "variables.h" #include "variables.h"
#include "stackcheck.h" #include "stackcheck.h"
#include "z64speed_meter.h"
#include "z64thread.h" #include "z64thread.h"
#define RSP_DONE_MSG 667 #define RSP_DONE_MSG 667
@ -426,16 +427,16 @@ void Sched_HandleRSPDone(SchedContext* sched) {
time = osGetTime(); time = osGetTime();
switch (sched->curRSPTask->list.t.type) { switch (sched->curRSPTask->list.t.type) {
case M_AUDTASK: case M_AUDTASK:
gRSPAudioTotalTime += time - sRSPAudioStartTime; gRSPAudioTimeAcc += time - sRSPAudioStartTime;
break; break;
case M_GFXTASK: case M_GFXTASK:
sRSPGFXTotalTime += time - sRSPGFXStartTime; gRSPGfxTimeAcc += time - sRSPGFXStartTime;
break; break;
default: default:
if (1) {} if (1) {}
sRSPOtherTotalTime += time - sRSPOtherStartTime; gRSPOtherTimeAcc += time - sRSPOtherStartTime;
break; break;
} }

View File

@ -1,18 +1,266 @@
#include "global.h" #include "global.h"
#include "sys_cfb.h"
#include "z64speed_meter.h" #include "z64speed_meter.h"
#include "z64view.h" #include "z64view.h"
#include "system_malloc.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++;
}

View File

@ -75,7 +75,7 @@ MtxF* sCurrentMatrix; //!< original name: "Matrix_now"
* @remark original name: "new_Matrix" * @remark original name: "new_Matrix"
*/ */
void Matrix_Init(GameState* gameState) { 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; sCurrentMatrix = sMatrixStack;
} }

View File

@ -140,7 +140,7 @@ void DynaSSNodeList_Init(PlayState* play, DynaSSNodeList* list) {
} }
void DynaSSNodeList_Alloc(PlayState* play, DynaSSNodeList* list, u32 numNodes) { 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->maxNodes = numNodes;
list->count = 0; list->count = 0;
} }
@ -1580,7 +1580,7 @@ void BgCheck_Allocate(CollisionContext* colCtx, PlayState* play, CollisionHeader
} }
} }
colCtx->lookupTbl = THA_AllocTailAlign( colCtx->lookupTbl = THA_AllocTailAlign(
&play->state.heap, &play->state.tha,
colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1); colCtx->subdivAmount.x * sizeof(StaticLookup) * colCtx->subdivAmount.y * colCtx->subdivAmount.z, ~1);
if (colCtx->lookupTbl == NULL) { if (colCtx->lookupTbl == NULL) {
Fault_AddHungupAndCrash("../z_bgcheck.c", 3955); 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) { void SSNodeList_Alloc(PlayState* play, SSNodeList* this, s32 tblMax, s32 numPolys) {
this->max = tblMax; this->max = tblMax;
this->count = 0; this->count = 0;
this->tbl = THA_AllocTailAlign(&play->state.heap, tblMax * sizeof(SSNode), -2); this->tbl = THA_AllocTailAlign(&play->state.tha, tblMax * sizeof(SSNode), -2);
this->polyCheckTbl = THA_AllocTailAlign16(&play->state.heap, numPolys * sizeof(u8)); this->polyCheckTbl = THA_AllocTailAlign16(&play->state.tha, numPolys * sizeof(u8));
if (this->polyCheckTbl == NULL) { if (this->polyCheckTbl == NULL) {
sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n"); sprintf(D_801ED950, "this->polygon_check == NULL(game_alloc() MemoryAllocationError.)\n");
@ -2599,7 +2599,7 @@ void DynaPoly_NullPolyList(CollisionPoly** polyList) {
* Allocate dyna.polyList * Allocate dyna.polyList
*/ */
void DynaPoly_AllocPolyList(PlayState* play, CollisionPoly** polyList, s32 numPolys) { 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 * Allocate dyna.vtxList
*/ */
void DynaPoly_AllocVtxList(PlayState* play, Vec3s** vtxList, s32 numVtx) { 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 * Allocate dyna.waterBoxList
*/ */
void DynaPoly_AllocWaterBoxList(PlayState* play, DynaWaterBoxList* waterBoxList, s32 numWaterBoxes) { 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);
} }
/** /**

View File

@ -8,7 +8,7 @@ void EffectSS_Init(PlayState* play, s32 numEntries) {
EffectSs* effectsSs; EffectSs* effectsSs;
EffectSsOverlay* overlay; 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.searchIndex = 0;
sEffectSsInfo.size = numEntries; sEffectSsInfo.size = numEntries;

View File

@ -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; gKaleidoMgrCurOvl = NULL;
Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL); Fault_AddAddrConvClient(&sKaleidoMgrFaultAddrConvClient, KaleidoManager_FaultAddrConv, NULL);
} }

View File

@ -40,7 +40,7 @@ void ZeldaArena_GetSizes(size_t* outMaxFree, size_t* outFree, size_t* outAlloc)
__osGetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc); __osGetSizes(&sZeldaArena, outMaxFree, outFree, outAlloc);
} }
s32 ZeldaArena_Check() { s32 ZeldaArena_Check(void) {
return __osCheckArena(&sZeldaArena); return __osCheckArena(&sZeldaArena);
} }
@ -48,10 +48,10 @@ void ZeldaArena_Init(void* start, size_t size) {
__osMallocInit(&sZeldaArena, start, size); __osMallocInit(&sZeldaArena, start, size);
} }
void ZeldaArena_Cleanup() { void ZeldaArena_Cleanup(void) {
__osMallocCleanup(&sZeldaArena); __osMallocCleanup(&sZeldaArena);
} }
u8 ZeldaArena_IsInitialized() { u8 ZeldaArena_IsInitialized(void) {
return __osMallocIsInitalized(&sZeldaArena); return __osMallocIsInitalized(&sZeldaArena);
} }

View File

@ -181,7 +181,7 @@ void Map_Init(PlayState* play) {
func_80105C40(play->roomCtx.curRoom.num); func_80105C40(play->roomCtx.curRoom.num);
interfaceCtx->unk_278 = -1; interfaceCtx->unk_278 = -1;
interfaceCtx->dungeonOrBossAreaMapIndex = -1; interfaceCtx->dungeonOrBossAreaMapIndex = -1;
interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.heap, 0x1000); interfaceCtx->mapSegment = THA_AllocTailAlign16(&play->state.tha, 0x1000);
if (func_8010A2AC(play)) { if (func_8010A2AC(play)) {
gSaveContext.mapIndex = func_8010A238(play); gSaveContext.mapIndex = func_8010A238(play);
return; return;

View File

@ -597,7 +597,7 @@ void Message_Init(PlayState* play) {
msgCtx->ocarinaAction = msgCtx->textUnskippable = 0; msgCtx->ocarinaAction = msgCtx->textUnskippable = 0;
msgCtx->textColorAlpha = 0xFF; msgCtx->textColorAlpha = 0xFF;
View_Init(&msgCtx->view, play->state.gfxCtx); 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 = &play->msgCtx.font;
Font_LoadOrderedFont(&play->msgCtx.font); Font_LoadOrderedFont(&play->msgCtx.font);
font->unk_11D88 = 0; font->unk_11D88 = 0;

View File

@ -7115,16 +7115,16 @@ void Interface_Init(PlayState* play) {
interfaceCtx->healthTimer = 200; interfaceCtx->healthTimer = 200;
parameterStaticSize = SEGMENT_ROM_SIZE(parameter_static); 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); 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, SEGMENT_ROM_START(do_action_static), 0x300);
DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180); DmaMgr_SendRequest0(interfaceCtx->doActionSegment + 0x300, SEGMENT_ROM_START(do_action_static) + 0x480, 0x180);
Interface_NewDay(play, CURRENT_DAY); 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) { if (CUR_FORM_EQUIP(EQUIP_SLOT_B) < ITEM_F0) {
Interface_LoadItemIconImpl(play, EQUIP_SLOT_B); Interface_LoadItemIconImpl(play, EQUIP_SLOT_B);

View File

@ -1562,7 +1562,7 @@ void Play_GetFloorSurface(PlayState* this, MtxF* mtx, Vec3f* pos) {
void* Play_LoadFile(PlayState* this, RomFile* entry) { void* Play_LoadFile(PlayState* this, RomFile* entry) {
size_t size = entry->vromEnd - entry->vromStart; 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); DmaMgr_SendRequest0(allocp, entry->vromStart, size);
@ -2324,9 +2324,9 @@ void Play_Init(GameState* thisx) {
D_801F6D4C->envColor.b = 0; D_801F6D4C->envColor.b = 0;
D_801F6D4C->envColor.a = 0; D_801F6D4C->envColor.a = 0;
CutsceneFlags_UnsetAll(this); CutsceneFlags_UnsetAll(this);
THA_GetRemaining(&this->state.heap); THA_GetRemaining(&this->state.tha);
zAllocSize = THA_GetRemaining(&this->state.heap); zAllocSize = THA_GetRemaining(&this->state.tha);
zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.heap, zAllocSize); zAlloc = (uintptr_t)THA_AllocTailAlign16(&this->state.tha, zAllocSize);
ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s ZeldaArena_Init(((zAlloc + 8) & ~0xF), (zAllocSize - ((zAlloc + 8) & ~0xF)) + zAlloc); //! @bug: Incorrect ALIGN16s
Actor_InitContext(this, &this->actorCtx, this->linkActorEntry); Actor_InitContext(this, &this->actorCtx, this->linkActorEntry);

View File

@ -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) { if (roomCtx->roomMemPages[0] == NULL) {
_dbg_hungup("../z_room.c", 1078); _dbg_hungup("../z_room.c", 1078);
} }

View File

@ -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; } for (i = 0; i < OBJECT_EXCHANGE_BANK_MAX; i++) { objectCtx->status[i].id = 0; }
// clang-format on // 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->spaceEnd = (void*)((u32)objectCtx->spaceStart + spaceSize);
objectCtx->mainKeepIndex = Object_Spawn(objectCtx, GAMEPLAY_KEEP); 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; size_t size = sceneTextureFiles[fileIndex].vromEnd - vromStart;
if (size != 0) { 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); DmaMgr_SendRequest0(play->roomCtx.unk74, vromStart, size);
} }
} }

View File

@ -1866,7 +1866,7 @@ void Sram_InitSram(GameState* gameState, SramContext* sramCtx) {
void Sram_Alloc(GameState* gameState, SramContext* sramCtx) { void Sram_Alloc(GameState* gameState, SramContext* sramCtx) {
if (gSaveContext.flashSaveAvailable) { if (gSaveContext.flashSaveAvailable) {
sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->heap, SAVE_BUFFER_SIZE); sramCtx->saveBuf = THA_AllocTailAlign16(&gameState->tha, SAVE_BUFFER_SIZE);
sramCtx->status = 0; sramCtx->status = 0;
} }
} }

View File

@ -294,15 +294,15 @@ void Skybox_Init(GameState* gameState, SkyboxContext* skyboxCtx, s16 skyboxId) {
Skybox_Setup(gameState, skyboxCtx, skyboxId); Skybox_Setup(gameState, skyboxCtx, skyboxId);
if (skyboxId != SKYBOX_NONE) { if (skyboxId != SKYBOX_NONE) {
skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->heap, 0x3840); skyboxCtx->dListBuf = THA_AllocTailAlign16(&gameState->tha, 0x3840);
if (skyboxId == SKYBOX_CUTSCENE_MAP) { if (skyboxId == SKYBOX_CUTSCENE_MAP) {
// Allocate enough space for the vertices for a 6 sided skybox (cube) // 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); func_80143148(skyboxCtx, 6);
} else { } else {
// Allocate enough space for the vertices for a 5 sided skybox (bottom is missing) // 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); func_80143148(skyboxCtx, 5);
} }
} }

View File

@ -215,11 +215,11 @@ void DayTelop_Noop(DayTelopState* this) {
void DayTelop_LoadGraphics(DayTelopState* this) { void DayTelop_LoadGraphics(DayTelopState* this) {
size_t segmentSize = SEGMENT_ROM_SIZE(daytelop_static); 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); DmaMgr_SendRequest0(this->daytelopStaticFile, SEGMENT_ROM_START(daytelop_static), segmentSize);
segmentSize = SEGMENT_ROM_SIZE(icon_item_gameover_static); 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); DmaMgr_SendRequest0(this->gameoverStaticFile, SEGMENT_ROM_START(icon_item_gameover_static), segmentSize);
} }

View File

@ -2531,15 +2531,15 @@ void FileSelect_Init(GameState* thisx) {
Font_LoadOrderedFont(&this->font); Font_LoadOrderedFont(&this->font);
size = SEGMENT_ROM_SIZE(title_static); 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); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(title_static), size);
size = SEGMENT_ROM_SIZE(parameter_static); 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); DmaMgr_SendRequest0(this->parameterSegment, SEGMENT_ROM_START(parameter_static), size);
size = gObjectTable[OBJECT_MAG].vromEnd - gObjectTable[OBJECT_MAG].vromStart; 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); DmaMgr_SendRequest0(this->titleSegment, gObjectTable[OBJECT_MAG].vromStart, size);
Audio_SetSpec(0xA); Audio_SetSpec(0xA);

View File

@ -154,7 +154,7 @@ void ConsoleLogo_Init(GameState* thisx) {
ConsoleLogoState* this = (ConsoleLogoState*)thisx; ConsoleLogoState* this = (ConsoleLogoState*)thisx;
uintptr_t segmentSize = SEGMENT_ROM_SIZE(nintendo_rogo_static); 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); DmaMgr_SendRequest0(this->staticSegment, SEGMENT_ROM_START(nintendo_rogo_static), segmentSize);
GameState_SetFramerateDivisor(&this->state, 1); GameState_SetFramerateDivisor(&this->state, 1);

View File

@ -3215,12 +3215,12 @@
0x80177084:("Sched_FaultClient",), 0x80177084:("Sched_FaultClient",),
0x8017715C:("Sched_ThreadEntry",), 0x8017715C:("Sched_ThreadEntry",),
0x801772A0:("Sched_Init",), 0x801772A0:("Sched_Init",),
0x80177390:("func_80177390",), 0x80177390:("SpeedMeter_InitImpl",),
0x801773A0:("SpeedMeter_Init",), 0x801773A0:("SpeedMeter_Init",),
0x801773C4:("SpeedMeter_Destroy",), 0x801773C4:("SpeedMeter_Destroy",),
0x801773D0:("SpeedMeter_DrawTimeEntries",), 0x801773D0:("SpeedMeter_DrawTimeEntries",),
0x80177A84:("func_80177A84",), 0x80177A84:("SpeedMeter_InitAllocEntry",),
0x80177AC8:("func_80177AC8",), 0x80177AC8:("SpeedMeter_DrawAllocEntry",),
0x80177E58:("SpeedMeter_DrawAllocEntries",), 0x80177E58:("SpeedMeter_DrawAllocEntries",),
0x801780F0:("Mtx_SetTranslateScaleMtx",), 0x801780F0:("Mtx_SetTranslateScaleMtx",),
0x801781EC:("Mtx_SetRotationMtx",), 0x801781EC:("Mtx_SetRotationMtx",),

View File

@ -21,7 +21,7 @@
0x80096B50:("gDmaMgrDmaBuffSize","u32","",0x4), 0x80096B50:("gDmaMgrDmaBuffSize","u32","",0x4),
0x80096B60:("gIrqMgrResetStatus","vs32","",0x4), 0x80096B60:("gIrqMgrResetStatus","vs32","",0x4),
0x80096B68:("sIrqMgrResetTime","volatile OSTime","",0x8), 0x80096B68:("sIrqMgrResetTime","volatile OSTime","",0x8),
0x80096B70:("sIrqMgrRetraceTime","volatile OSTime","",0x8), 0x80096B70:("gIrqMgrRetraceTime","volatile OSTime","",0x8),
0x80096B78:("sIrqMgrRetraceCount","s32","",0x4), 0x80096B78:("sIrqMgrRetraceCount","s32","",0x4),
0x80096B80:("sCpuExceptions","char*","[18]",0x48), 0x80096B80:("sCpuExceptions","char*","[18]",0x48),
0x80096BC8:("sFpuExceptions","char*","[6]",0x18), 0x80096BC8:("sFpuExceptions","char*","[6]",0x18),
@ -2159,7 +2159,7 @@
0x801D1530:("sPadMgrInstance","PadMgr*","",0x4), 0x801D1530:("sPadMgrInstance","PadMgr*","",0x4),
0x801D1534:("sPadMgrRetraceCount","UNK_TYPE4","",0x4), 0x801D1534:("sPadMgrRetraceCount","UNK_TYPE4","",0x4),
0x801D1538:("sVoiceInitStatus","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), 0x801D1570:("D_801D1570","f32","[13]",0x34),
0x801D15B0:("gZeroVec3f","Vec3f","",0xC), 0x801D15B0:("gZeroVec3f","Vec3f","",0xC),
0x801D15BC:("gZeroVec3s","Vec3s","",0x6), 0x801D15BC:("gZeroVec3s","Vec3s","",0x6),
@ -4032,7 +4032,7 @@
0x801F80E0:("sGraphFaultClient","FaultClient","",0x10), 0x801F80E0:("sGraphFaultClient","FaultClient","",0x10),
0x801F80F0:("gGfxMasterDL","Gfx*","",0x4), 0x801F80F0:("gGfxMasterDL","Gfx*","",0x4),
0x801F80F8:("sGraphCfbInfos","UNK_TYPE1","",0x1), 0x801F80F8:("sGraphCfbInfos","UNK_TYPE1","",0x1),
0x801F8150:("sGraphTaskStartTime","u64","",0x8), 0x801F8150:("sGraphPrevUpdateEndTime","u64","",0x8),
0x801F8160:("sSerialEventQueue","OSMesgQueue","",0x18), 0x801F8160:("sSerialEventQueue","OSMesgQueue","",0x18),
0x801F8178:("sSerialMsgBuf","OSMesg","[1]",0x4), 0x801F8178:("sSerialMsgBuf","OSMesg","[1]",0x4),
0x801F8180:("gSegments","u32","[16]",0x40), 0x801F8180:("gSegments","u32","[16]",0x40),
@ -4052,24 +4052,22 @@
0x801FB338:("sAudioMgr","AudioMgr","",0x2e0), 0x801FB338:("sAudioMgr","AudioMgr","",0x2e0),
0x801FB620:("gPadMgr","PadMgr","",0x480), 0x801FB620:("gPadMgr","PadMgr","",0x480),
0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1), 0x801FBAA0:("sSchedFaultClient","UNK_TYPE1","",0x1),
0x801FBAB0:("sRSPGFXStartTime","OSTime","",0x8), 0x801FBAB0:("sRSPGfxTimeStart","OSTime","",0x8),
0x801FBAB8:("sRSPAudioStartTime","OSTime","",0x8), 0x801FBAB8:("sRSPAudioTimeStart","OSTime","",0x8),
0x801FBAC0:("sRSPOtherStartTime","OSTime","",0x8), 0x801FBAC0:("sRSPOtherTimeStart","OSTime","",0x8),
0x801FBAC8:("sRDPStartTime","OSTime","",0x8), 0x801FBAC8:("sRDPStartTime","OSTime","",0x8),
0x801FBAD0:("gAudioSPDataPtr","u64*","",0x4), 0x801FBAD0:("gAudioSPDataPtr","u64*","",0x4),
0x801FBAD4:("gAudioSPDataSize","u32","",0x4), 0x801FBAD4:("gAudioSPDataSize","u32","",0x4),
0x801FBAE0:("D_801FBAE0","UNK_TYPE1","",0x1), 0x801FBAE0:("gRSPAudioTimeTotal","volatile OSTime","",0x8),
0x801FBAE8:("D_801FBAE8","UNK_TYPE1","",0x1), 0x801FBAE8:("gRSPGfxTimeTotal","volatile OSTime","",0x8),
0x801FBAF0:("gRDPTimeTotal","volatile OSTime","",0x8), 0x801FBAF0:("gRDPTimeTotal","volatile OSTime","",0x8),
0x801FBAF8:("lastRenderFrameDuration","volatile OSTime","",0x8), 0x801FBAF8:("gGraphUpdatePeriod","volatile OSTime","",0x8),
0x801FBB00:("gRSPAudioTotalTime","UNK_TYPE1","",0x1), 0x801FBB00:("gRSPAudioTimeAcc","volatile OSTime","",0x8),
0x801FBB04:("D_801FBB04","UNK_TYPE1","",0x1), 0x801FBB08:("gRSPGfxTimeAcc","volatile OSTime","",0x8),
0x801FBB08:("sRSPGFXTotalTime","UNK_TYPE1","",0x1), 0x801FBB10:("gRSPOtherTimeAcc","volatile OSTime","",0x8),
0x801FBB0C:("D_801FBB0C","UNK_TYPE1","",0x1), 0x801FBB18:("gUnkTimeAcc","volatile OSTime","",0x8),
0x801FBB10:("sRSPOtherTotalTime","UNK_TYPE1","",0x1), 0x801FBB20:("gRDPTimeAcc","volatile OSTime","",0x8),
0x801FBB14:("D_801FBB14","UNK_TYPE1","",0x1), 0x801FBB28:("sSpeedMeterTimeEntryPtr","UNK_TYPE1","",0x1),
0x801FBB20:("gRDPTimeAcc","UNK_TYPE1","",0x1),
0x801FBB28:("D_801FBB28","UNK_TYPE1","",0x1),
0x801FBB30:("sNotebookViMode","OSViMode","",0x50), 0x801FBB30:("sNotebookViMode","OSViMode","",0x50),
0x801FBB80:("gFramebuffers","u32*","[2]",0x8), 0x801FBB80:("gFramebuffers","u32*","[2]",0x8),
0x801FBB88:("gActiveViMode","OSViMode*","",0x4), 0x801FBB88:("gActiveViMode","OSViMode*","",0x4),

View File

@ -34,6 +34,8 @@ CLEAR_EVENTINF = "int"
CLEAR_EVENTINF_ALT = "int" CLEAR_EVENTINF_ALT = "int"
"EVENTINF_.*" = "int" "EVENTINF_.*" = "int"
".+REG" = "int" ".+REG" = "int"
SET_FULLSCREEN_VIEWPORT_DYNAMIC = "void"
gDrawRect = "void"
[decompme.compilers] [decompme.compilers]
"tools/ido_recomp/linux/7.1/cc" = "ido7.1" "tools/ido_recomp/linux/7.1/cc" = "ido7.1"

View File

@ -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_FaultClient.s,Sched_FaultClient,0x80177084,0x36
asm/non_matchings/code/sched/Sched_ThreadEntry.s,Sched_ThreadEntry,0x8017715C,0x51 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/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_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_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/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/SpeedMeter_InitAllocEntry.s,SpeedMeter_InitAllocEntry,0x80177A84,0x11
asm/non_matchings/code/speed_meter/func_80177AC8.s,func_80177AC8,0x80177AC8,0xE4 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/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_801780F0.s,func_801780F0,0x801780F0,0x3F
asm/non_matchings/code/speed_meter/func_801781EC.s,func_801781EC,0x801781EC,0x90 asm/non_matchings/code/speed_meter/func_801781EC.s,func_801781EC,0x801781EC,0x90

1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2729 asm/non_matchings/code/sched/Sched_FaultClient.s Sched_FaultClient 0x80177084 0x36
2730 asm/non_matchings/code/sched/Sched_ThreadEntry.s Sched_ThreadEntry 0x8017715C 0x51
2731 asm/non_matchings/code/sched/Sched_Init.s Sched_Init 0x801772A0 0x3C
2732 asm/non_matchings/code/speed_meter/func_80177390.s asm/non_matchings/code/speed_meter/SpeedMeter_InitImpl.s func_80177390 SpeedMeter_InitImpl 0x80177390 0x4
2733 asm/non_matchings/code/speed_meter/SpeedMeter_Init.s SpeedMeter_Init 0x801773A0 0x9
2734 asm/non_matchings/code/speed_meter/SpeedMeter_Destroy.s SpeedMeter_Destroy 0x801773C4 0x3
2735 asm/non_matchings/code/speed_meter/SpeedMeter_DrawTimeEntries.s SpeedMeter_DrawTimeEntries 0x801773D0 0x1AD
2736 asm/non_matchings/code/speed_meter/func_80177A84.s asm/non_matchings/code/speed_meter/SpeedMeter_InitAllocEntry.s func_80177A84 SpeedMeter_InitAllocEntry 0x80177A84 0x11
2737 asm/non_matchings/code/speed_meter/func_80177AC8.s asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntry.s func_80177AC8 SpeedMeter_DrawAllocEntry 0x80177AC8 0xE4
2738 asm/non_matchings/code/speed_meter/SpeedMeter_DrawAllocEntries.s SpeedMeter_DrawAllocEntries 0x80177E58 0xA6
2739 asm/non_matchings/code/speed_meter/func_801780F0.s func_801780F0 0x801780F0 0x3F
2740 asm/non_matchings/code/speed_meter/func_801781EC.s func_801781EC 0x801781EC 0x90