From ca55b14d61e27a26ee04c00e18fd59c9fb04e0fe Mon Sep 17 00:00:00 2001 From: Anghelo Carvajal Date: Sat, 13 Dec 2025 17:25:58 -0300 Subject: [PATCH] Review --- Makefile | 2 +- include/PR/ucode.h | 3 +++ include/regs.h | 1 + src/boot/CIC6105.c | 15 ++++----------- src/code/audio_thread_manager.c | 4 ++-- src/code/graph.c | 2 +- src/code/osFlash.c | 2 ++ src/code/sys_math3d.c | 2 +- 8 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 308e839282..1ec2277c65 100644 --- a/Makefile +++ b/Makefile @@ -467,7 +467,7 @@ $(BUILD_DIR)/src/code/jpegdecoder.o: OPTFLAGS := -O2 $(BUILD_DIR)/src/code/jpegutils.o: CC := $(CC_OLD) $(BUILD_DIR)/src/code/jpegutils.o: OPTFLAGS := -O2 -$(BUILD_DIR)/src/code/osFlash.o: CC := $(CC_OLD) +$(BUILD_DIR)/src/code/osFlash.o: CC := ./tools/buildtools/preprocess.sh -v $(VERSION) -i $(ICONV) -- $(CC_OLD) $(BUILD_DIR)/src/code/osFlash.o: OPTFLAGS := -g $(BUILD_DIR)/src/code/osFlash.o: MIPS_VERSION := -mips1 diff --git a/include/PR/ucode.h b/include/PR/ucode.h index 848983ebee..bb0c1d1b4e 100644 --- a/include/PR/ucode.h +++ b/include/PR/ucode.h @@ -13,6 +13,9 @@ extern u64 rspbootTextStart[]; extern u64 rspbootTextEnd[]; +extern u64 cic6105TextStart[]; +extern u64 cic6105TextEnd[]; + extern u64 aspMainTextStart[]; extern u64 aspMainTextEnd[]; extern u64 aspMainDataStart[]; diff --git a/include/regs.h b/include/regs.h index 7bd88d7840..d450646405 100644 --- a/include/regs.h +++ b/include/regs.h @@ -68,6 +68,7 @@ extern RegEditor* gRegEditor; #define R_RUN_SPEED_LIMIT REG(45) #define R_ENABLE_ARENA_DBG SREG(0) // Same as OoT +#define R_AUDIOMGR_DEBUG_LEVEL SREG(20) #define R_ROOM_IMAGE_NODRAW_FLAGS SREG(25) #define R_UPDATE_RATE SREG(30) #define R_VI_MODE_EDIT_STATE SREG(48) diff --git a/src/boot/CIC6105.c b/src/boot/CIC6105.c index 2af6bf411d..a38af4e6c2 100644 --- a/src/boot/CIC6105.c +++ b/src/boot/CIC6105.c @@ -8,10 +8,6 @@ #pragma increment_block_number "n64-us:188" -// TODO: Consider moving to a header file. -extern u64 cic6105TextStart[]; -extern u64 cic6105TextEnd[]; - s32 gCICAddr1Val; s32 gCICAddr2Val; FaultClient sRomInfoFaultClient; @@ -24,13 +20,13 @@ s32 CIC6105_ILoveYou(void); void CIC6105_Noop1(void) { #if MM_VERSION < N64_US - SREG(20) = 1; + R_AUDIOMGR_DEBUG_LEVEL = 1; #endif } void CIC6105_Noop2(void) { #if MM_VERSION < N64_US - SREG(20) = 0; + R_AUDIOMGR_DEBUG_LEVEL = 0; #endif } @@ -55,11 +51,6 @@ void CIC6105_PrintRomInfo(void) { FaultDrawer_Printf("[Date:%s]", gBuildDate); FaultDrawer_SetCursor(96, 32); FaultDrawer_Printf("I LOVE YOU %08x", CIC6105_ILoveYou()); - - { - // TODO: where to put this? - static const char unused[] = "flag:%08x data:%08x\n"; - } #endif } @@ -113,6 +104,8 @@ void CIC6105_ScheduleCICTask(void) { gCICValue1 = IO_READ(SP_DMEM_START + 0xFF4); gCICValue2 = IO_READ(SP_DMEM_START + 0xFFC); CIC6105_ILoveYou(); + + (void)"flag:%08x data:%08x\n"; } s32 CIC6105_ILoveYou(void) { diff --git a/src/code/audio_thread_manager.c b/src/code/audio_thread_manager.c index d6661b700d..25aa6c11f4 100644 --- a/src/code/audio_thread_manager.c +++ b/src/code/audio_thread_manager.c @@ -16,7 +16,7 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) { OSTimer timer; s32 msg; - if (SREG(20) > 0) { + if (R_AUDIOMGR_DEBUG_LEVEL > 0) { audioMgr->rspTask = NULL; } @@ -37,7 +37,7 @@ void AudioMgr_HandleRetrace(AudioMgr* audioMgr) { Sched_SendNotifyMsg(audioMgr->sched); } - if (SREG(20) >= 2) { + if (R_AUDIOMGR_DEBUG_LEVEL >= 2) { rspTask = NULL; } else { rspTask = AudioThread_Update(); diff --git a/src/code/graph.c b/src/code/graph.c index f823f995a9..d25ec751fa 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -236,7 +236,7 @@ retry: void Graph_UpdateGame(GameState* gameState) { GameState_GetInput(gameState); GameState_IncrementFrameCount(gameState); - if (SREG(20) < 3) { + if (R_AUDIOMGR_DEBUG_LEVEL < 3) { Audio_Update(); } } diff --git a/src/code/osFlash.c b/src/code/osFlash.c index 17162c53c6..bdc59e8f2b 100644 --- a/src/code/osFlash.c +++ b/src/code/osFlash.c @@ -3,6 +3,8 @@ #include "alignment.h" #include "macros.h" +#pragma increment_block_number "n64-us:188" + u32 __osFlashID[4] ALIGNED(8); OSIoMesg __osFlashMsg ALIGNED(8); OSMesgQueue __osFlashMessageQ ALIGNED(8); diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 039f588296..a0fb5fbd62 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -6,7 +6,7 @@ #include "macros.h" -#pragma increment_block_number "n64-us:124" +#pragma increment_block_number "n64-us:122" // The bss index at this point should be 184