Use Macro for __FILE__ & __LINE__ when possible (#559)

* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
This commit is contained in:
Baoulettes 2022-07-06 01:29:34 +02:00 committed by GitHub
parent a9c3c7541e
commit a5df9dddf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
467 changed files with 3081 additions and 3459 deletions

View file

@ -998,7 +998,6 @@ void func_80083108(GlobalContext* globalCtx) {
gSaveContext.buttonStatus[0] = gSaveContext.equips.buttonItems[0];
}
}
if (1) {} // Necessary to match
}
if (sp28) {
@ -1495,7 +1494,7 @@ void Interface_LoadItemIcon1(GlobalContext* globalCtx, u16 button) {
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->iconItemSegment + button * 0x1000,
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), "../z_parameter.c", 1171);
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
}
@ -1505,7 +1504,7 @@ void Interface_LoadItemIcon2(GlobalContext* globalCtx, u16 button) {
osCreateMesgQueue(&interfaceCtx->loadQueue, &interfaceCtx->loadMsg, OS_MESG_BLOCK);
DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_180, interfaceCtx->iconItemSegment + button * 0x1000,
(uintptr_t)_icon_item_staticSegmentRomStart + (gSaveContext.equips.buttonItems[button] * 0x1000),
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), "../z_parameter.c", 1193);
0x1000, 0, &interfaceCtx->loadQueue, OS_MESG_PTR(NULL), __FILE__, __LINE__);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
}
@ -2312,7 +2311,7 @@ void Interface_LoadActionLabel(InterfaceContext* interfaceCtx, u16 action, s16 l
//DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160,
//interfaceCtx->doActionSegment + (loadOffset * DO_ACTION_TEX_SIZE),
//(uintptr_t)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE,
//0, &interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2145);
//0, &interfaceCtx->loadQueue, NULL, __FILE__, __LINE__);
//osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
} else {
gSegments[7] = VIRTUAL_TO_PHYSICAL(interfaceCtx->doActionSegment);
@ -2398,7 +2397,7 @@ void Interface_LoadActionLabelB(GlobalContext* globalCtx, u16 action) {
memcpy(interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE, ResourceMgr_LoadTexByName(doAction), DO_ACTION_TEX_SIZE);
//DmaMgr_SendRequest2(&interfaceCtx->dmaRequest_160, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE,
//(uintptr_t)_do_action_staticSegmentRomStart + (action * DO_ACTION_TEX_SIZE), DO_ACTION_TEX_SIZE, 0,
//&interfaceCtx->loadQueue, NULL, "../z_parameter.c", 2228);
//&interfaceCtx->loadQueue, NULL, __FILE__, __LINE__);
osRecvMesg(&interfaceCtx->loadQueue, NULL, OS_MESG_BLOCK);
interfaceCtx->unk_1FA = 1;
@ -2835,7 +2834,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
s16 magicBarY;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2650);
OPEN_DISPS(globalCtx->state.gfxCtx);
if (gSaveContext.magicLevel != 0) {
if (gSaveContext.healthCapacity > 0xA0) {
@ -2921,7 +2920,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) {
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2731);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void func_80088AA0(s16 arg0) {
@ -2961,7 +2960,7 @@ void func_80088B34(s16 arg0) {
}
void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) {
OPEN_DISPS(gfxCtx, "../z_parameter.c", 2820);
OPEN_DISPS(gfxCtx);
gDPLoadTextureBlock_4b(OVERLAY_DISP++, texture, G_IM_FMT_IA, DO_ACTION_TEX_WIDTH, DO_ACTION_TEX_HEIGHT, 0,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD,
@ -2969,7 +2968,7 @@ void Interface_DrawActionLabel(GraphicsContext* gfxCtx, void* texture) {
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
CLOSE_DISPS(gfxCtx, "../z_parameter.c", 2829);
CLOSE_DISPS(gfxCtx);
}
void Interface_DrawItemButtons(GlobalContext* globalCtx) {
@ -2988,7 +2987,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
s16 C_Up_BTN_Pos[] = { C_UP_BUTTON_X+Right_HUD_Margin, C_UP_BUTTON_Y+(Top_HUD_Margin*-1) };
s16 C_Down_BTN_Pos[] = { C_DOWN_BUTTON_X+Right_HUD_Margin, C_DOWN_BUTTON_Y+(Top_HUD_Margin*-1) };
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 2900);
OPEN_DISPS(globalCtx->state.gfxCtx);
// B Button Color & Texture
// Also loads the Item Button Texture reused by other buttons afterwards
@ -3184,7 +3183,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) {
}
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3071);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
int16_t gItemIconX[] = { B_BUTTON_X, C_LEFT_BUTTON_X, C_DOWN_BUTTON_X, C_RIGHT_BUTTON_X,
@ -3195,7 +3194,7 @@ int16_t gItemIconWidth[] = { 30, 24, 24, 24, 16, 16, 16, 16 };
int16_t gItemIconDD[] = { 550, 680, 680, 680, 1024, 1024, 1024, 1024 };
void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) {
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3079);
OPEN_DISPS(globalCtx->state.gfxCtx);
gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
@ -3207,7 +3206,7 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16
(gItemIconY[button] + (Top_HUD_Margin * -1) + gItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0,
gItemIconDD[button] << 1, gItemIconDD[button] << 1);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3094);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
const char* _gAmmoDigit0Tex[] =
@ -3225,7 +3224,7 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
s16 i;
s16 ammo;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3105);
OPEN_DISPS(globalCtx->state.gfxCtx);
i = gSaveContext.equips.buttonItems[button];
@ -3278,19 +3277,19 @@ void Interface_DrawAmmoCount(GlobalContext* globalCtx, s16 button, s16 alpha) {
gItemAmmoY[button] + (Top_HUD_Margin * -1), 8, 8, 1 << 10, 1 << 10);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3158);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void Interface_DrawActionButton(GlobalContext* globalCtx, f32 x, f32 y) {
InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3172);
OPEN_DISPS(globalCtx->state.gfxCtx);
Matrix_Translate(-137.0f + x, 97.0f - y, XREG(18) / 10.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3177),
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0);
@ -3300,7 +3299,7 @@ void Interface_DrawActionButton(GlobalContext* globalCtx, f32 x, f32 y) {
gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0);
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3187);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void Interface_InitVertices(GlobalContext* globalCtx) {
@ -3464,7 +3463,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
s16 svar6;
bool fullUi = !CVar_GetS32("gMinimalUI", 0) || !R_MINIMAP_DISABLED || globalCtx->pauseCtx.state != 0;
OPEN_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 3405);
OPEN_DISPS(globalCtx->state.gfxCtx);
// Invalidate Do Action textures as they may have changed
gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->doActionSegment);
@ -3800,7 +3799,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
Matrix_Translate(-138.0f + rAIconX, 98.0f - (R_A_ICON_Y+(Top_HUD_Margin*-1)), WREG(46 + gSaveContext.language) / 10.0f, MTXMODE_NEW);
Matrix_Scale(1.0f, 1.0f, 1.0f, MTXMODE_APPLY);
Matrix_RotateX(interfaceCtx->unk_1F4 / 10000.0f, MTXMODE_APPLY);
gSPMatrix(OVERLAY_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_parameter.c", 3701),
gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx),
G_MTX_MODELVIEW | G_MTX_LOAD);
gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0);
@ -4352,7 +4351,7 @@ void Interface_Draw(GlobalContext* globalCtx) {
gDPFillRectangle(OVERLAY_DISP++, 0, 0, gScreenWidth - 1, gScreenHeight - 1);
}
CLOSE_DISPS(globalCtx->state.gfxCtx, "../z_parameter.c", 4269);
CLOSE_DISPS(globalCtx->state.gfxCtx);
}
void Interface_Update(GlobalContext* globalCtx) {