From 8153c952f6d74e29b12aa03f1503530d5a39e732 Mon Sep 17 00:00:00 2001 From: cadmic Date: Wed, 4 Sep 2024 11:56:24 -0700 Subject: [PATCH] [ntsc-1.2] Organize n64dd declarations and convert to 1.0 addresses (#2127) * Reorganize n64dd declarations * Fix bss * Really fix bss --- data/{unk_800093F0.data.s => cic6105.text.s} | 10 ++-- include/cic6105.h | 1 + include/functions.h | 1 + include/n64dd.h | 55 ++++++++++--------- include/segment_symbols.h | 6 ++ include/ultra64/exception.h | 1 + include/ultra64/ucode.h | 2 + spec | 2 +- src/boot/cic6105.c | 4 +- src/boot/z_std_dma.c | 8 +-- src/code/code_n64dd_800AD410.c | 35 +++++------- src/code/code_n64dd_800AD4C0.c | 42 +++++++------- src/code/game.c | 16 +++--- src/code/main.c | 8 +-- src/code/sys_math3d.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_demo.c | 4 +- src/code/z_kaleido_setup.c | 8 +-- src/code/z_play.c | 22 ++++---- src/code/z_room.c | 4 +- src/code/z_scene_table.c | 4 +- src/overlays/actors/ovl_En_Mag/z_en_mag.c | 5 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- src/overlays/gamestates/ovl_select/z_select.c | 6 +- src/overlays/gamestates/ovl_title/z_title.c | 17 ++---- .../misc/ovl_kaleido_scope/z_kaleido_scope.c | 2 +- .../misc/ovl_kaleido_scope/z_lmap_mark.c | 8 +-- tools/disasm/ntsc-1.2/files_boot.csv | 2 +- tools/disasm/ntsc-1.2/functions.txt | 18 +++--- tools/disasm/ntsc-1.2/variables.txt | 12 ++-- undefined_syms.txt | 25 +++------ 31 files changed, 156 insertions(+), 178 deletions(-) rename data/{unk_800093F0.data.s => cic6105.text.s} (77%) diff --git a/data/unk_800093F0.data.s b/data/cic6105.text.s similarity index 77% rename from data/unk_800093F0.data.s rename to data/cic6105.text.s index bf8a636c07..387beeded5 100644 --- a/data/unk_800093F0.data.s +++ b/data/cic6105.text.s @@ -5,15 +5,12 @@ .set noreorder /* don't insert nops after branches */ .set gp=64 /* allow use of 64-bit general purpose registers */ -.section .data +.section .text .balign 16 -/* Unused. - * This appears to be RSP code, however it is not part of - * rspboot as rspbootTextEnd is at this symbol. - */ -glabel D_800093F0 +/* RSP code for cic6105.c, used only in N64 versions. */ + glabel cic6105TextStart .word 0xE80C2001 # sqv $v12[0], 0x10($zero) .word 0x34014000 # li $1, 0x4000 .word 0x40812000 # mtc0 $1, SP_STATUS @@ -22,3 +19,4 @@ glabel D_800093F0 .word 0x09000425 # j 0x04001094 .word 0x00000000 # nop .word 0x00000000 # nop +glabel cic6105TextEnd diff --git a/include/cic6105.h b/include/cic6105.h index 794ada45de..43ffcc4f98 100644 --- a/include/cic6105.h +++ b/include/cic6105.h @@ -5,6 +5,7 @@ extern s32 B_80008EE0; +void func_800014E8(void); void CIC6105_AddFaultClient(void); void CIC6105_RemoveFaultClient(void); void func_80001640(void); diff --git a/include/functions.h b/include/functions.h index 6ad09a447c..51d8fc9676 100644 --- a/include/functions.h +++ b/include/functions.h @@ -91,6 +91,7 @@ s32 __osEPiRawReadIo(OSPiHandle* handle, u32 devAddr, u32* data); void osViSwapBuffer(void* frameBufPtr); s32 __osEPiRawStartDma(OSPiHandle* handle, s32 direction, u32 cartAddr, void* dramAddr, size_t size); OSTime osGetTime(void); +void osSetTime(OSTime time); void __osTimerServicesInit(void); void __osTimerInterrupt(void); void __osSetTimerIntr(OSTime time); diff --git a/include/n64dd.h b/include/n64dd.h index 376665ac32..596092cfd0 100644 --- a/include/n64dd.h +++ b/include/n64dd.h @@ -14,19 +14,17 @@ struct SaveContext; struct Scene; // TODO Use the specific pointer types instead of void* -typedef struct n64ddStruct_800FF4B0_pointers { +typedef struct n64ddStruct_800FEE70_pointers { void* unk_00; void* unk_04; struct RegEditor* unk_08; void* unk_0C[31]; struct SaveContext* unk_88; void* unk_8C[9]; -} n64ddStruct_800FF4B0_pointers; // size = 0xB0 +} n64ddStruct_800FEE70_pointers; // size = 0xB0 -struct n64ddStruct_80121AF0; - -typedef struct n64ddStruct_80121AF0 { - void (*unk_00)(n64ddStruct_800FF4B0_pointers*, struct n64ddStruct_80121AF0*); +typedef struct n64ddStruct_80121220 { + void (*unk_00)(n64ddStruct_800FEE70_pointers*, struct n64ddStruct_80121220*); void (*unk_04)(void); void (*unk_08)(struct PlayState* play, struct RoomContext* roomCtx, s32 roomNum); void (*unk_0C)(struct PlayState* play); @@ -46,30 +44,33 @@ typedef struct n64ddStruct_80121AF0 { s32 (*unk_70)(struct DmaRequest* req, void* ram, uintptr_t vrom, size_t size, u32 unk, OSMesgQueue* queue, OSMesg msg); void (*unk_74)(struct GameState*); s32 (*unk_78)(struct PlayState*, void*, void*); -} n64ddStruct_80121AF0; // size = ? +} n64ddStruct_80121220; // size = ? -void func_800ADA80(void); -void func_800ADAF8(void); -n64ddStruct_80121AF0* func_800ADB30(n64ddStruct_80121AF0* arg0); -void func_800ADB8C(void); -n64ddStruct_800FF4B0_pointers* func_800ADBD0(void); -void func_800ADC00(void); -void func_800ADC08(s32 arg0, s32 arg1, s32 arg2); +void func_800AD410(void); +void func_800AD488(void); +n64ddStruct_80121220* func_800AD4C0(n64ddStruct_80121220* arg0); +void func_800AD51C(void); +n64ddStruct_800FEE70_pointers* func_800AD560(void); +void func_800AD590(void); +void func_800AD598(s32 arg0, s32 arg1, s32 arg2); -void func_801C8510_unknown(void* dest, s32 offset, s32 size); -void func_801C86F0_unknown(void); -void func_801C7760_unknown(union Gfx** gfx); +u32 func_801C6E80(void); +void func_801C6EA0(union Gfx** gfxP); +s32 func_801C70FC(void); +void func_801C7268(void); +s32 func_801C7658(void); +s32 func_801C7818(void); +void func_801C7C1C(void* dest, s32 offset, s32 size); +void func_801C7E78(void); +void n64dd_SetDiskVersion(s32 arg0); -extern n64ddStruct_800FF4B0_pointers D_800FF4B0; -extern n64ddStruct_80121AF0* B_80121AF0; +extern n64ddStruct_800FEE70_pointers D_800FEE70; +extern n64ddStruct_80121220* B_80121220; -extern u8 B_80121AE0; -extern s8 B_80121AE1; -extern u8 B_80121AE2; -extern vu8 B_80121AE3; -extern vu8 B_80121AE4; - -extern char D_801DA410; // type ? -extern char D_801E8090; // type ? +extern u8 D_80121210; +extern u8 D_80121211; +extern u8 D_80121212; +extern vu8 D_80121213; +extern vu8 D_80121214; #endif diff --git a/include/segment_symbols.h b/include/segment_symbols.h index 4e0ce0bbd4..9a03e3c575 100644 --- a/include/segment_symbols.h +++ b/include/segment_symbols.h @@ -84,6 +84,12 @@ DECLARE_SEGMENT(code) DECLARE_ROM_SEGMENT(code) DECLARE_BSS_SEGMENT(code) +// N64-only, not wrapped in these are not wrapped in an `#if PLATFORM_N64` +// so that the N64DD code can always be built. +DECLARE_SEGMENT(n64dd) +DECLARE_ROM_SEGMENT(n64dd) +DECLARE_BSS_SEGMENT(n64dd) + DECLARE_OVERLAY_SEGMENT(kaleido_scope) DECLARE_OVERLAY_SEGMENT(player_actor) DECLARE_OVERLAY_SEGMENT(map_mark_data) diff --git a/include/ultra64/exception.h b/include/ultra64/exception.h index 7d4977f4f9..886a3b9096 100644 --- a/include/ultra64/exception.h +++ b/include/ultra64/exception.h @@ -38,6 +38,7 @@ typedef struct { /* 0x04 */ void* sp; } __osHwInt; // size = 0x08 +OSIntMask osGetIntMask(void); OSIntMask osSetIntMask(OSIntMask); void __osSetHWIntrRoutine(OSHWIntr intr, s32 (*callback)(void), void* sp); diff --git a/include/ultra64/ucode.h b/include/ultra64/ucode.h index 00ef36ac2b..9265c882b6 100644 --- a/include/ultra64/ucode.h +++ b/include/ultra64/ucode.h @@ -12,6 +12,8 @@ extern u64 rspbootTextStart[], rspbootTextEnd[]; +extern u64 cic6105TextStart[], cic6105TextEnd[]; + extern u64 aspMainTextStart[], aspMainTextEnd[]; extern u64 aspMainDataStart[], aspMainDataEnd[]; diff --git a/spec b/spec index 9dfd4b20c9..b82247e1fa 100644 --- a/spec +++ b/spec @@ -15,7 +15,6 @@ beginseg name "boot" address 0x80000460 include "$(BUILD_DIR)/src/boot/boot_main.o" - include "$(BUILD_DIR)/data/unk_800093F0.data.o" include "$(BUILD_DIR)/data/unk_80009410.data.o" include "$(BUILD_DIR)/src/boot/idle.o" include "$(BUILD_DIR)/src/boot/viconfig.o" @@ -144,6 +143,7 @@ beginseg #endif include "$(BUILD_DIR)/src/boot/build.o" include "$(BUILD_DIR)/data/rsp_boot.text.o" + include "$(BUILD_DIR)/data/cic6105.text.o" #ifdef COMPILER_GCC include "$(BUILD_DIR)/src/libc/memset.o" include "$(BUILD_DIR)/src/libc/memmove.o" diff --git a/src/boot/cic6105.c b/src/boot/cic6105.c index 1f6469b560..ca5747c9cf 100644 --- a/src/boot/cic6105.c +++ b/src/boot/cic6105.c @@ -4,10 +4,8 @@ s32 func_80001714(void); -extern u64 cic6105ucodeTextStart[]; - OSTask D_800067C0_unknown = { - 4, 0, rspbootTextStart, 0x3E8, cic6105ucodeTextStart, 0x20, (u64*)gBuildTeam, 8, NULL, 0, NULL, 0, NULL, 0, NULL, 0, + 4, 0, rspbootTextStart, 0x3E8, cic6105TextStart, 0x20, (u64*)gBuildTeam, 8, NULL, 0, NULL, 0, NULL, 0, NULL, 0, }; s32 B_80008EE0; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 3f3d7b87cf..69d48eed92 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -197,8 +197,8 @@ s32 DmaMgr_AudioDmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction) { ASSERT(mb != NULL, "mb != NULL", "../z_std_dma.c", 532); #if PLATFORM_N64 - if (B_80121AE2) { - while (B_80121AE4) { + if (D_80121212) { + while (D_80121214) { Sleep_Msec(1000); } } @@ -543,8 +543,8 @@ s32 DmaMgr_RequestAsync(DmaRequest* req, void* ram, uintptr_t vrom, size_t size, #endif #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_70 != NULL)) { - if (B_80121AF0->unk_70(req, ram, vrom, size, unk, queue, msg) != 0) { + if ((B_80121220 != NULL) && (B_80121220->unk_70 != NULL)) { + if (B_80121220->unk_70(req, ram, vrom, size, unk, queue, msg) != 0) { return 0; } } diff --git a/src/code/code_n64dd_800AD410.c b/src/code/code_n64dd_800AD410.c index 8e380f64c8..66dcc3cc76 100644 --- a/src/code/code_n64dd_800AD410.c +++ b/src/code/code_n64dd_800AD410.c @@ -3,32 +3,25 @@ #include "segment_symbols.h" #include "n64dd.h" -DECLARE_SEGMENT(n64dd) -DECLARE_ROM_SEGMENT(n64dd) -DECLARE_BSS_SEGMENT(n64dd) +u8 D_80121210; +u8 D_80121211; +u8 D_80121212; +vu8 D_80121213; +vu8 D_80121214; -s8 func_801C7740_unknown(void); - -u8 B_80121AE0; -s8 B_80121AE1; -u8 B_80121AE2; -vu8 B_80121AE3; -vu8 B_80121AE4; - -void func_800ADA80(void) { - if (!B_80121AE0) { +void func_800AD410(void) { + if (!D_80121210) { DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart, _n64ddSegmentRomEnd - _n64ddSegmentRomStart); - // TODO use _n64ddSegmentBssStart, _n64ddSegmentBssEnd - bzero(&D_801DA410, &D_801E8090 - &D_801DA410); - B_80121AE0 = true; - B_80121AE1 = func_801C7740_unknown(); - if (B_80121AE1) {} + bzero(_n64ddSegmentBssStart, _n64ddSegmentBssEnd - _n64ddSegmentBssStart); + D_80121210 = true; + D_80121211 = func_801C6E80(); + if (D_80121211) {} } } -void func_800ADAF8(void) { - if (B_80121AE0 && (B_80121AE2 == 0)) { - B_80121AE0 = false; +void func_800AD488(void) { + if (D_80121210 && (D_80121212 == 0)) { + D_80121210 = false; } } diff --git a/src/code/code_n64dd_800AD4C0.c b/src/code/code_n64dd_800AD4C0.c index ed1477f93c..3f1488c66e 100644 --- a/src/code/code_n64dd_800AD4C0.c +++ b/src/code/code_n64dd_800AD4C0.c @@ -2,12 +2,8 @@ #include "fault.h" #include "n64dd.h" -// TODO functions of unknown prototype -extern char osGetIntMask[]; -extern char osSetTime[]; - -n64ddStruct_800FF4B0_pointers D_800FF4B0 = { - func_801C8510_unknown, +n64ddStruct_800FEE70_pointers D_800FEE70 = { + func_801C7C1C, NULL, NULL, Fault_RemoveClient, @@ -16,7 +12,7 @@ n64ddStruct_800FF4B0_pointers D_800FF4B0 = { Fault_WaitForInput, Fault_AddHungupAndCrashImpl, Fault_AddHungupAndCrash, - func_800ADC08, + func_800AD598, _Printf, osCreateThread, osDestroyThread, @@ -53,34 +49,34 @@ n64ddStruct_800FF4B0_pointers D_800FF4B0 = { NULL, }; -n64ddStruct_80121AF0* B_80121AF0; +n64ddStruct_80121220* B_80121220; -n64ddStruct_80121AF0* func_800ADB30(n64ddStruct_80121AF0* arg0) { - n64ddStruct_800FF4B0_pointers* temp_a0 = func_800ADBD0(); +n64ddStruct_80121220* func_800AD4C0(n64ddStruct_80121220* arg0) { + n64ddStruct_800FEE70_pointers* temp_a0 = func_800AD560(); if (arg0 != NULL && arg0->unk_00 != NULL) { arg0->unk_00(temp_a0, arg0); } - B_80121AF0 = arg0; - return B_80121AF0; + B_80121220 = arg0; + return B_80121220; } -void func_800ADB8C(void) { - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_04 != NULL)) { - B_80121AF0->unk_04(); +void func_800AD51C(void) { + if ((B_80121220 != NULL) && (B_80121220->unk_04 != NULL)) { + B_80121220->unk_04(); } - B_80121AF0 = NULL; + B_80121220 = NULL; } -n64ddStruct_800FF4B0_pointers* func_800ADBD0(void) { - D_800FF4B0.unk_04 = 0; - D_800FF4B0.unk_08 = gRegEditor; - D_800FF4B0.unk_88 = &gSaveContext; - return &D_800FF4B0; +n64ddStruct_800FEE70_pointers* func_800AD560(void) { + D_800FEE70.unk_04 = 0; + D_800FEE70.unk_08 = gRegEditor; + D_800FEE70.unk_88 = &gSaveContext; + return &D_800FEE70; } -void func_800ADC00(void) { +void func_800AD590(void) { } -void func_800ADC08(s32 arg0, s32 arg1, s32 arg2) { +void func_800AD598(s32 arg0, s32 arg1, s32 arg2) { } diff --git a/src/code/game.c b/src/code/game.c index 07007f6a70..e00bc74066 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -73,8 +73,8 @@ void GameState_SetFBFilter(Gfx** gfxP) { void func_800C4344(GameState* gameState) { #if PLATFORM_N64 - if (B_80121AE2 != 0) { - func_801C86F0_unknown(); + if (D_80121212 != 0) { + func_801C7E78(); } #elif OOT_DEBUG Input* selectedInput; @@ -245,8 +245,8 @@ void func_800C49F4(GraphicsContext* gfxCtx) { gSPDisplayList(OVERLAY_DISP++, newDlist); #if PLATFORM_N64 - if (B_80121AE2 != 0) { - func_801C7760_unknown(&newDlist); + if (D_80121212 != 0) { + func_801C6EA0(&newDlist); } #endif @@ -271,11 +271,11 @@ void GameState_Update(GameState* gameState) { gameState->main(gameState); #if PLATFORM_N64 - if (B_80121AE2 != 0) { - func_801C86F0_unknown(); + if (D_80121212 != 0) { + func_801C7E78(); } - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_74 != NULL)) { - B_80121AF0->unk_74(gameState); + if ((B_80121220 != NULL) && (B_80121220->unk_74 != NULL)) { + B_80121220->unk_74(gameState); } #endif diff --git a/src/code/main.c b/src/code/main.c index ce1739a5cb..2487725635 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -60,12 +60,12 @@ void Main(void* arg) { PreNmiBuff_Init(gAppNmiBufferPtr); Fault_Init(); #if PLATFORM_N64 - func_800ADA80(); - if ((u8)B_80121AE1 != 0) { - systemHeapStart = (uintptr_t)&D_801E8090; + func_800AD410(); + if (D_80121211 != 0) { + systemHeapStart = (uintptr_t)&_n64ddSegmentEnd; SysCfb_Init(1); } else { - func_800ADAF8(); + func_800AD488(); systemHeapStart = (uintptr_t)_buffersSegmentEnd; SysCfb_Init(0); } diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 9d27596010..570da1ab01 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -5,7 +5,7 @@ #include "macros.h" #include "sys_math3d.h" -#pragma increment_block_number "gc-eu:108 gc-eu-mq:108 gc-jp:108 gc-jp-ce:108 gc-jp-mq:108 gc-us:108 gc-us-mq:108" +#pragma increment_block_number "gc-eu:106 gc-eu-mq:106 gc-jp:106 gc-jp-ce:106 gc-jp-mq:106 gc-us:106 gc-us-mq:106" s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA); diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index b80ac0bb57..b18f3e226d 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -5,7 +5,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.h" -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 56a94816c0..6cf3ae941e 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -2423,8 +2423,8 @@ void Cutscene_HandleConditionalTriggers(PlayState* play) { void Cutscene_SetScript(PlayState* play, void* script) { #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_78 != NULL)) { - if (B_80121AF0->unk_78(play, script, sCutscenesUnknownList)) { + if ((B_80121220 != NULL) && (B_80121220->unk_78 != NULL)) { + if (B_80121220->unk_78(play, script, sCutscenesUnknownList)) { return; } } diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 9875277123..1e54071657 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -177,16 +177,16 @@ void KaleidoSetup_Init(PlayState* play) { View_Init(&pauseCtx->view, play->state.gfxCtx); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_3C != NULL)) { - B_80121AF0->unk_3C(); + if ((B_80121220 != NULL) && (B_80121220->unk_3C != NULL)) { + B_80121220->unk_3C(); } #endif } void KaleidoSetup_Destroy(PlayState* play) { #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_40 != NULL)) { - B_80121AF0->unk_40(); + if ((B_80121220 != NULL) && (B_80121220->unk_40 != NULL)) { + B_80121220->unk_40(); } #endif } diff --git a/src/code/z_play.c b/src/code/z_play.c index 084ef4ddce..c650cbd6c3 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -243,8 +243,8 @@ void Play_Destroy(GameState* thisx) { ZeldaArena_Cleanup(); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_14 != NULL)) { - B_80121AF0->unk_14(this); + if ((B_80121220 != NULL) && (B_80121220->unk_14 != NULL)) { + B_80121220->unk_14(this); } #endif @@ -279,8 +279,8 @@ void Play_Init(GameState* thisx) { GameState_Realloc(&this->state, 0x1D4790); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_10 != NULL)) { - B_80121AF0->unk_10(this); + if ((B_80121220 != NULL) && (B_80121220->unk_10 != NULL)) { + B_80121220->unk_10(this); } #endif @@ -388,7 +388,7 @@ void Play_Init(GameState* thisx) { #endif #if PLATFORM_N64 - if ((B_80121AF0 != NULL && B_80121AF0->unk_54 != NULL && B_80121AF0->unk_54(this))) { + if ((B_80121220 != NULL && B_80121220->unk_54 != NULL && B_80121220->unk_54(this))) { } else { Cutscene_HandleEntranceTriggers(this); } @@ -1499,7 +1499,7 @@ void* Play_LoadFileFromDiskDrive(PlayState* this, RomFile* file) { size = file->vromEnd - file->vromStart; allocp = THA_AllocTailAlign16(&this->state.tha, size); - func_801C8510_unknown(allocp, file->vromStart, size); + func_801C7C1C(allocp, file->vromStart, size); return allocp; } @@ -1537,8 +1537,8 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { u32 size; #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_48 != NULL)) { - scene = B_80121AF0->unk_48(sceneId, gSceneTable); + if ((B_80121220 != NULL) && (B_80121220->unk_48 != NULL)) { + scene = B_80121220->unk_48(sceneId, gSceneTable); } else { scene = &gSceneTable[sceneId]; scene->unk_13 = 0; @@ -1555,7 +1555,7 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { PRINTF("\nSCENE SIZE %fK\n", (scene->sceneFile.vromEnd - scene->sceneFile.vromStart) / 1024.0f); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (scene->unk_12 > 0)) { + if ((B_80121220 != NULL) && (scene->unk_12 > 0)) { this->sceneSegment = Play_LoadFileFromDiskDrive(this, &scene->sceneFile); scene->unk_13 = 1; } else { @@ -1574,8 +1574,8 @@ void Play_SpawnScene(PlayState* this, s32 sceneId, s32 spawn) { Play_InitScene(this, spawn); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_0C != NULL)) { - B_80121AF0->unk_0C(this); + if ((B_80121220 != NULL) && (B_80121220->unk_0C != NULL)) { + B_80121220->unk_0C(this); } #endif diff --git a/src/code/z_room.c b/src/code/z_room.c index 2b727deea9..5a88f1c281 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -623,8 +623,8 @@ s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { osCreateMesgQueue(&roomCtx->loadQueue, &roomCtx->loadMsg, 1); #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_08 != NULL)) { - B_80121AF0->unk_08(play, roomCtx, roomNum); + if ((B_80121220 != NULL) && (B_80121220->unk_08 != NULL)) { + B_80121220->unk_08(play, roomCtx, roomNum); } else { DMA_REQUEST_ASYNC(&roomCtx->dmaRequest, roomCtx->unk_34, play->roomList[roomNum].vromStart, size, 0, &roomCtx->loadQueue, NULL, "../z_room.c", 1036); diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index 2879a3fa4e..6767993f0c 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -196,8 +196,8 @@ SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { }; void Scene_Draw(PlayState* play) { - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_6C != NULL)) { - B_80121AF0->unk_6C(play, sSceneDrawConfigs); + if ((B_80121220 != NULL) && (B_80121220->unk_6C != NULL)) { + B_80121220->unk_6C(play, sSceneDrawConfigs); return; } diff --git a/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/src/overlays/actors/ovl_En_Mag/z_en_mag.c index 94e298ad8b..ccff03803c 100644 --- a/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -474,11 +474,8 @@ void EnMag_DrawImageRGBA32(Gfx** gfxP, s16 centerX, s16 centerY, u8* source, u32 } #if PLATFORM_N64 -// TODO n64dd functions -s32 func_801C79BC_unknown(void); - void func_80AEEA48_unknown(Gfx** gfxP, s16 arg1, s16 arg2, u32 arg3) { - if ((B_80121AE2 != 0) && (func_801C79BC_unknown() != 0)) { + if ((D_80121212 != 0) && (func_801C70FC() != 0)) { Gfx* gfx = *gfxP; s32 temp_a3 = (arg1 + 0x40) << 2; s32 temp_t0 = (arg2 + 5) << 2; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index a229809266..e22bb5e868 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -14,7 +14,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:174 gc-eu-mq:174 gc-jp:176 gc-jp-ce:176 gc-jp-mq:176 gc-us:176 gc-us-mq:176" +#pragma increment_block_number "gc-eu:166 gc-eu-mq:166 gc-jp:168 gc-jp-ce:168 gc-jp-mq:168 gc-us:168 gc-us-mq:168" #define FLAGS ACTOR_FLAG_4 diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index ed249540c5..6ccf547b91 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -12,8 +12,6 @@ #if PLATFORM_N64 #include "n64dd.h" -// TODO n64dd functions -void n64dd_SetDiskVersion(s32); #endif void MapSelect_LoadTitle(MapSelectState* this) { @@ -53,13 +51,13 @@ void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex) { #if PLATFORM_N64 void func_80800AD0_unknown(MapSelectState* this, s32 arg1) { - if (B_80121AE2 != 0) { + if (D_80121212 != 0) { n64dd_SetDiskVersion(1); } } void func_80800B08_unknown(MapSelectState* this, s32 arg1) { - if (B_80121AE2 != 0) { + if (D_80121212 != 0) { n64dd_SetDiskVersion(0); } } diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 19946322fb..c082e6f72f 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -9,17 +9,12 @@ #include "versions.h" #if PLATFORM_N64 +#include "cic6105.h" #include "n64dd.h" #endif #include "assets/textures/nintendo_rogo_static/nintendo_rogo_static.h" -// TODO -void func_800014E8_unknown(void); -s32 func_801C8090_unknown(void); -void func_801C7BC4_unknown(void); -s32 func_801C7ED0_unknown(void); - #if OOT_DEBUG void ConsoleLogo_PrintBuildInfo(Gfx** gfxP) { Gfx* gfx; @@ -186,17 +181,17 @@ void ConsoleLogo_Destroy(GameState* thisx) { #if PLATFORM_N64 if (this->unk_1E0) { - if (func_801C8090_unknown() != 0) { + if (func_801C7818() != 0) { func_800D31A0(); } - func_801C7BC4_unknown(); + func_801C7268(); } #endif Sram_InitSram(&this->state, &this->sramCtx); #if PLATFORM_N64 - func_800014E8_unknown(); + func_800014E8(); #endif } @@ -205,8 +200,8 @@ void ConsoleLogo_Init(GameState* thisx) { ConsoleLogoState* this = (ConsoleLogoState*)thisx; #if PLATFORM_N64 - if ((B_80121AE0 != 0) && ((u8)B_80121AE1 != 0) && (B_80121AE2 == 0)) { - if (func_801C7ED0_unknown() != 0) { + if ((D_80121210 != 0) && (D_80121211 != 0) && (D_80121212 == 0)) { + if (func_801C7658() != 0) { func_800D31A0(); } this->unk_1E0 = true; diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index 3385c1cc56..0f9d3e8693 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -3077,7 +3077,7 @@ void KaleidoScope_UpdateDungeonMap(PlayState* play) { PRINTF("MAP DMA = %d\n", play->interfaceCtx.mapPaletteIndex); #if PLATFORM_N64 - if (B_80121AF0 != NULL && B_80121AF0->unk_44 != NULL && B_80121AF0->unk_44(play)) { + if (B_80121220 != NULL && B_80121220->unk_44 != NULL && B_80121220->unk_44(play)) { } else { KaleidoScope_LoadDungeonMap(play); diff --git a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index b285aaa52d..8b9d5b7891 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -31,16 +31,16 @@ void PauseMapMark_Init(PlayState* play) { gBossMarkScale = 1.0f; gLoadedPauseMarkDataTable = gPauseMapMarkDataTable; #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_34 != NULL)) { - B_80121AF0->unk_34(&gLoadedPauseMarkDataTable); + if ((B_80121220 != NULL) && (B_80121220->unk_34 != NULL)) { + B_80121220->unk_34(&gLoadedPauseMarkDataTable); } #endif } void PauseMapMark_Clear(PlayState* play) { #if PLATFORM_N64 - if ((B_80121AF0 != NULL) && (B_80121AF0->unk_38 != NULL)) { - B_80121AF0->unk_38(&gLoadedPauseMarkDataTable); + if ((B_80121220 != NULL) && (B_80121220->unk_38 != NULL)) { + B_80121220->unk_38(&gLoadedPauseMarkDataTable); } #endif gLoadedPauseMarkDataTable = NULL; diff --git a/tools/disasm/ntsc-1.2/files_boot.csv b/tools/disasm/ntsc-1.2/files_boot.csv index 260778c0c2..dcb6f0bf87 100644 --- a/tools/disasm/ntsc-1.2/files_boot.csv +++ b/tools/disasm/ntsc-1.2/files_boot.csv @@ -84,9 +84,9 @@ FD0,80001430,src/boot/z_locale 60C0,80006520,src/libultra/os/sethwintrroutine 6130,80006590,src/libultra/os/gethwintrroutine 6160,800065C0,data/rsp_boot.text +62E0,80006740,data/cic6105.text offset,vram,.data -62E0,80006740,data/unk_80009410.data 6310,80006770,src/boot/idle 6330,80006790,src/boot/viconfig 6340,800067A0,src/boot/z_std_dma diff --git a/tools/disasm/ntsc-1.2/functions.txt b/tools/disasm/ntsc-1.2/functions.txt index a3c4c7520b..3194bccd86 100644 --- a/tools/disasm/ntsc-1.2/functions.txt +++ b/tools/disasm/ntsc-1.2/functions.txt @@ -2305,13 +2305,13 @@ IrqMgr_HandlePreNMI500 = 0x800AD808; // type:func IrqMgr_HandleRetrace = 0x800AD82C; // type:func IrqMgr_ThreadEntry = 0x800AD8E4; // type:func IrqMgr_Init = 0x800AD9B8; // type:func -func_800ADA80 = 0x800ADA80; // type:func -func_800ADAF8 = 0x800ADAF8; // type:func -func_800ADB30 = 0x800ADB30; // type:func -func_800ADB8C = 0x800ADB8C; // type:func -func_800ADBD0 = 0x800ADBD0; // type:func -func_800ADC00 = 0x800ADC00; // type:func -func_800ADC08 = 0x800ADC08; // type:func +func_800AD410 = 0x800ADA80; // type:func +func_800AD488 = 0x800ADAF8; // type:func +func_800AD4C0 = 0x800ADB30; // type:func +func_800AD51C = 0x800ADB8C; // type:func +func_800AD560 = 0x800ADBD0; // type:func +func_800AD590 = 0x800ADC00; // type:func +func_800AD598 = 0x800ADC08; // type:func Fault_SleepImpl = 0x800ADC20; // type:func Fault_WaitForInputImpl = 0x800ADC5C; // type:func Fault_WaitForInput = 0x800ADCD8; // type:func @@ -3098,8 +3098,8 @@ Message_Init = 0x800E2660; // type:func Regs_InitDataImpl = 0x800E2704; // type:func Regs_InitData = 0x800E35D0; // type:func njpgdspMainTextStart = 0x800E7200; // type:func -func_801C7740_unknown = 0x801C7740; // type:func -func_801C8510_unknown = 0x801C8510; // type:func +func_801C6E80 = 0x801C7740; // type:func +func_801C7C1C = 0x801C8510; // type:func n64dd_SetDiskVersion = 0x801C8808; // type:func ConsoleLogo_Calc = 0x80800000; // type:func ConsoleLogo_SetupView = 0x8080009C; // type:func diff --git a/tools/disasm/ntsc-1.2/variables.txt b/tools/disasm/ntsc-1.2/variables.txt index b434d65043..ce115492fd 100644 --- a/tools/disasm/ntsc-1.2/variables.txt +++ b/tools/disasm/ntsc-1.2/variables.txt @@ -12,16 +12,16 @@ gSaveContext = 0x8011AC80; // size:0x1428 type:SaveContext gRegEditor = 0x8011C0B0; // size:0x4 type:RegEditor* gSegments = 0x80121508; // size:0x40 _string_n64dd_c = 0x801D9680; // size:0x1 type:char -B_80121AF0 = 0x80121AF0; // size:0x4 type:n64ddStruct_80121AF0* -B_80121AE0 = 0x80121AE0; // size:0x1 type:u8 -B_80121AE1 = 0x80121AE1; // size:0x1 type:s8 -B_80121AE2 = 0x80121AE2; // size:0x1 type:u8 +B_80121220 = 0x80121AF0; // size:0x4 type:n64ddStruct_80121220* +D_80121210 = 0x80121AE0; // size:0x1 type:u8 +D_80121211 = 0x80121AE1; // size:0x1 type:s8 +D_80121212 = 0x80121AE2; // size:0x1 type:u8 _n64ddSegmentStart = 0x801C7740; _n64ddSegmentRomStart = 0x00B8ADA0; _n64ddSegmentRomEnd = 0x00B9DA70; D_801DA410 = 0x801DA410; D_801E8090 = 0x801E8090; -D_800FF4B0 = 0x800FF4B0; // size:0xB0 type:n64ddStruct_800FF4B0_pointers +D_800FEE70 = 0x800FF4B0; // size:0xB0 type:n64ddStruct_800FEE70_pointers gPadMgr = 0x8011DBD0; // size:0x468 type:PadMgr gFaultMgr = 0x80121B60; // size:0x5D8 type:FaultMgr_v1 sFaultInputs = 0x80121B00; // size:0x60 type:Input[4] @@ -57,6 +57,6 @@ sGraphStack = 0x8011E468; sGraphThread = 0x8011E2B8; rspbootTextStart = 0x800065C0; rspbootTextEnd = 0x80006720; -cic6105ucodeTextStart = 0x80006720; +cic6105TextStart = 0x80006720; gBuildTeam = 0x80006D30; gBuildDate = 0x80006D3C; diff --git a/undefined_syms.txt b/undefined_syms.txt index 7ce3eb5ae1..b5b1b772f7 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -12,34 +12,25 @@ D_06000000 = 0x06000000; #if PLATFORM_N64 -// boot_main.c -func_80001720 = 0x80001720; - -// cic6105.c -cic6105ucodeTextStart = 0x80006720; - // code_n64dd_800AD410.c -func_800ADCD8_unknown = 0x800ADCD8; -func_800AE170_unknown = 0x800AE170; -func_801C7740_unknown = 0x801C7740; -func_801C8510_unknown = 0x801C8510; +func_801C6E80 = 0x801C7740; +func_801C7C1C = 0x801C8510; D_801DA410 = 0x801DA410; D_801E8090 = 0x801E8090; // game.c -func_801C86F0_unknown = 0x801C86F0; -func_801C7760_unknown = 0x801C7760; +func_801C7E78 = 0x801C86F0; +func_801C6EA0 = 0x801C7760; // z_en_mag.c -func_801C79BC_unknown = 0x801C79BC; +func_801C70FC = 0x801C79BC; // z_setup.c n64dd_SetDiskVersion = 0x801C8808; // z_title.c -func_800014E8_unknown = 0x800014E8; -func_801C8090_unknown = 0x801C8090; -func_801C7BC4_unknown = 0x801C7BC4; -func_801C7ED0_unknown = 0x801C7ED0; +func_801C7818 = 0x801C8090; +func_801C7268 = 0x801C7BC4; +func_801C7658 = 0x801C7ED0; #endif