From ea6746ff5e14b780fd071da237f7c0256eabd38b Mon Sep 17 00:00:00 2001 From: engineer124 Date: Sun, 17 Apr 2022 14:36:31 +1000 Subject: [PATCH] Improvement on func_80111CB4 --- include/functions.h | 2 +- include/variables.h | 2 +- include/z64.h | 2 +- src/code/graph.c | 2 +- src/code/z_parameter.c | 18 ++++++++++-------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/include/functions.h b/include/functions.h index 9b8dff325..a9e43f7d2 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2735,7 +2735,7 @@ void func_80165690(void); Gfx* func_801660B8(GlobalContext* globalCtx, Gfx* gfx); void Play_Fini(GameState* gameState); // void func_801663C4(void); -void func_80166644(u8* arg0, void* arg1, s32 arg2); +void func_80166644(u8* arg0, u8* arg1, s32 arg2); // void func_801668B4(void); void func_80166968(GlobalContext* globalCtx, Camera* camera); void func_80166B30(GlobalContext* globalCtx); diff --git a/include/variables.h b/include/variables.h index e09e372ba..19fdf5033 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3320,7 +3320,7 @@ extern OSViMode D_801FBB30; extern u32* gFramebuffers[2]; extern OSViMode* D_801FBB88; extern u16* gZBufferPtr; -extern void* D_801FBB90; +extern u8* D_801FBB90; extern u64* gGfxSPTaskOutputBufferPtr; extern size_t gGfxSPTaskOutputBufferSize; // extern UNK_TYPE1 D_801FBB9C; diff --git a/include/z64.h b/include/z64.h index 18ed092c3..876594e91 100644 --- a/include/z64.h +++ b/include/z64.h @@ -1418,7 +1418,7 @@ struct GlobalContext { /* 0x18B9C */ char unk_18B9C[0x2B8]; /* 0x18E54 */ SceneTableEntry* loadedScene; /* 0x18E58 */ char unk_18E58[0x4]; - /* 0x18E5C */ void* unk_18E5C; + /* 0x18E5C */ u8* unk_18E5C; /* 0x18E60 */ char unk_18E60[0x8]; /* 0x18E68 */ s32 unk_18E68; /* 0x18E6C */ char unk_18E6C[0x3EC]; diff --git a/src/code/graph.c b/src/code/graph.c index 8059d1f63..ca18a9049 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -349,7 +349,7 @@ void Graph_ThreadEntry(void* arg) { gGfxSPTaskOutputBufferEnd2 = (u8*)gGfxSPTaskOutputBuffer2 + sizeof(*gGfxSPTaskOutputBuffer2); func_80178978(); - Fault_SetFB(D_801FBB90, SCREEN_WIDTH, SCREEN_HEIGHT); + Fault_SetFB((void*)D_801FBB90, SCREEN_WIDTH, SCREEN_HEIGHT); Graph_Init(&gfxCtx); while (nextOvl) { diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index e98072782..08c2a9628 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1990,11 +1990,12 @@ void func_80110038(GlobalContext* globalCtx) { } } +// a0/a1 swap. Likely related to globalCtx->unk_18E5C #ifdef NON_MATCHING void func_80111CB4(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; Player* player = GET_PLAYER(globalCtx); - void* phi_a1; + s32 pad; s32 sp28; sp28 = false; @@ -2049,6 +2050,7 @@ void func_80111CB4(GlobalContext* globalCtx) { gSaveContext.buttonStatus[3] = BTN_DISABLED; } else { BUTTON_ITEM_EQUIP(CUR_FORM, EQUIP_SLOT_B) = ITEM_BOW; + if (globalCtx->unk_1887C >= 2) { Interface_LoadItemIconImpl(globalCtx, 0); } else if (gSaveContext.save.inventory.items[SLOT_BOW] == ITEM_NONE) { @@ -2056,6 +2058,7 @@ void func_80111CB4(GlobalContext* globalCtx) { } else { Interface_LoadItemIconImpl(globalCtx, 0); } + gSaveContext.buttonStatus[1] = BTN_DISABLED; gSaveContext.buttonStatus[2] = BTN_DISABLED; gSaveContext.buttonStatus[3] = BTN_DISABLED; @@ -2142,8 +2145,8 @@ void func_80111CB4(GlobalContext* globalCtx) { } else if (D_801BF884 != 0) { if (D_801BF884 == 1) { if (!(globalCtx->actorCtx.unk5 & 4)) { - func_801663C4((u8*)((globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90), - gSaveContext.pictoPhoto, 0x4600); + func_801663C4((globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90, + (u8*)gSaveContext.pictoPhoto, 0x4600); interfaceCtx->unk_224 = 0; interfaceCtx->unk_222 = interfaceCtx->unk_224; sp28 = true; @@ -2182,8 +2185,8 @@ void func_80111CB4(GlobalContext* globalCtx) { Interface_ChangeAlpha(50); D_801BF884 = 0; if (D_801BF888) { - func_801663C4((u8*)((globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90), - gSaveContext.pictoPhoto, 0x4600); + func_801663C4((globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90, + (u8*)gSaveContext.pictoPhoto, 0x4600); func_8013A240(globalCtx); } globalCtx->actorCtx.unk5 &= ~0x4; @@ -2209,8 +2212,7 @@ void func_80111CB4(GlobalContext* globalCtx) { Interface_ChangeAlpha(21); D_801BF884 = 1; } else { - phi_a1 = (globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90; - func_80166644(gSaveContext.pictoPhoto, phi_a1, 0x4600); + func_80166644((u8*)gSaveContext.pictoPhoto, ((void)0, (globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90), 0x4600); globalCtx->unk_18845 = 1; D_801BF884 = 2; } @@ -5728,7 +5730,7 @@ void Interface_Draw(GlobalContext* globalCtx) { if (D_801BF884 >= 2) { if ((globalCtx->actorCtx.unk5 & 4) == 0) { func_801663C4((u8*)((globalCtx->unk_18E5C != NULL) ? globalCtx->unk_18E5C : D_801FBB90), - gSaveContext.pictoPhoto, 0x4600); + (u8*)gSaveContext.pictoPhoto, 0x4600); interfaceCtx->unk_224 = 0; interfaceCtx->unk_222 = interfaceCtx->unk_224;