From eb57aa31f3d5dabfe0e1a0ade786f1b7a9961bc6 Mon Sep 17 00:00:00 2001 From: gijs Date: Fri, 20 Oct 2023 17:01:28 +0200 Subject: [PATCH] Rename `D_800C4B20` to `nuGfxZBuffer` --- include/common.h | 1 - include/nu/nusys.h | 2 +- linker_scripts/symbols/addr.txt | 1 + src/_ob_unusual_spiders.c | 2 +- src/main.c | 11 ++++------- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/include/common.h b/include/common.h index 44686dc..c403c17 100644 --- a/include/common.h +++ b/include/common.h @@ -132,7 +132,6 @@ extern s32 D_800E8B14; extern s32 __SCREEN_IS_NOT_BLACK; extern s32 D_800A9EB0; extern s32 __SOMETHING_FRAMEBUFFERS; -extern s32 D_800C4B20; extern void* D_800C4CE0; extern s32 D_A9EF0; extern s32 D_800C4B30; diff --git a/include/nu/nusys.h b/include/nu/nusys.h index 09ecbda..83a04b1 100644 --- a/include/nu/nusys.h +++ b/include/nu/nusys.h @@ -988,7 +988,7 @@ extern void nuDebConPrintf(u32 wndNo, const char* fmt, ...); /*----------------------------------------------------------------------*/ #define nuGfxSetZBuffer(ZBuf_p) \ { \ - nuGfxZBuffer = ZBuf_p; \ + nuGfxZBuffer = (u16*)ZBuf_p; \ } /*----------------------------------------------------------------------*/ /* Remove callback functions */ diff --git a/linker_scripts/symbols/addr.txt b/linker_scripts/symbols/addr.txt index 941f541..e1386d9 100644 --- a/linker_scripts/symbols/addr.txt +++ b/linker_scripts/symbols/addr.txt @@ -14,6 +14,7 @@ nuGfxTaskSpool = 0x800E79A4; nuGfxThread = 0x800BE1C0; nuGfxSwapCfbFunc = 0x800A9E84; nuGfxSwapCfb = 0x8008B110; +nuGfxZBuffer = 0x800C4B20; nuBoot = 0x8007F880; nuScCreateScheduler = 0x80088C50; // rom:0x19050 diff --git a/src/_ob_unusual_spiders.c b/src/_ob_unusual_spiders.c index 439fbad..e690189 100644 --- a/src/_ob_unusual_spiders.c +++ b/src/_ob_unusual_spiders.c @@ -9,7 +9,7 @@ void nuGfxInitEX2(void) { nuGfxThreadStart(); nuGfxSetCfb(&__SOMETHING_FRAMEBUFFERS, NU_GFX_FRAMEBUFFER_NUM); - D_800C4B20 = BOOT_ADDRESS_ULTRA; + nuGfxSetZBuffer(NU_GFX_ZBUFFER_ADDR); nuGfxSwapCfbFuncSet(nuGfxSwapCfb); D_800C4CE0 = &D_800A9EB0; nuGfxTaskMgrInit(); diff --git a/src/main.c b/src/main.c index 4215e03..7053f03 100644 --- a/src/main.c +++ b/src/main.c @@ -2,6 +2,7 @@ #include "libmus.h" #include "nu/nusys.h" +#include "os_convert.h" extern u16 D_800AEDE2; typedef struct { @@ -384,7 +385,7 @@ void func_80073398(void) { D_800A8211 = 0; D_800A8210 = 0; D_800AEF9C = func_800712C4(D_800AEF9C); - D_800C4B20 = 0; + nuGfxZBuffer = 0; } INCLUDE_ASM(const s32, "main", func_800733F8); @@ -400,15 +401,11 @@ void func_800737A0(void) { /* 3C2C 8007382C */ void func_8007382C(void) { - u32 temp_a1; - if (__get_compared_osTvType() != 0) return; if (D_800A8213 != 0) { - temp_a1 = D_800C4B20 - 0x80000000; - - gDPSetDepthImage(obPtrDisplayList++, temp_a1); + gDPSetDepthImage(obPtrDisplayList++, OS_K0_TO_PHYSICAL(nuGfxZBuffer)); gDPPipeSync(obPtrDisplayList++); @@ -417,7 +414,7 @@ void func_8007382C(void) { gDPPipeSync(obPtrDisplayList++); gDPSetRenderMode(obPtrDisplayList++, G_RM_NOOP, G_RM_NOOP2); - gDPSetColorImage(obPtrDisplayList++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, temp_a1); + gDPSetColorImage(obPtrDisplayList++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 320, OS_K0_TO_PHYSICAL(nuGfxZBuffer)); gDPSetFillColor(obPtrDisplayList++, 0xFFFCFFFC); gDPPipeSync(obPtrDisplayList++);