Refer to end of buffers instead of trailing data (#938)

This commit is contained in:
Marijn van der Werf 2023-02-11 17:39:29 +01:00 committed by GitHub
parent 768e88f20d
commit f0ae9177ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 38 additions and 30 deletions

View File

@ -145,7 +145,6 @@ extern UNK_FUN_PTR(gCurtainDrawCallback);
extern u16 gCurrentDoorSounds; extern u16 gCurrentDoorSounds;
extern s32 D_800D9620;
extern UNK_TYPE D_800E92D8; extern UNK_TYPE D_800E92D8;
extern UNK_TYPE D_80147574; extern UNK_TYPE D_80147574;
extern s8 D_8014C248[]; extern s8 D_8014C248[];

View File

@ -21,13 +21,13 @@ extern s32 AlMinFrameSize;
extern OSMesgQueue nuAuDmaMesgQ; extern OSMesgQueue nuAuDmaMesgQ;
extern OSMesg nuAuDmaMesgBuf[50]; extern OSMesg nuAuDmaMesgBuf[50];
extern OSIoMesg nuAuDmaIOMesgBuf[]; extern OSIoMesg nuAuDmaIOMesgBuf[];
extern NUDMABuffer* D_800A3BD4;
extern NUDMABuffer nuAuDmaBufList[50]; extern NUDMABuffer nuAuDmaBufList[50];
extern AuSynDriver auSynDriver; extern AuSynDriver auSynDriver;
extern u64 rspbootUcodeBuffer[]; extern u64 rspbootUcodeBuffer[];
extern u64 n_aspMain_text_bin[]; extern u64 n_aspMain_text_bin[];
extern u64 n_aspMain_data_bin[]; extern u64 n_aspMain_data_bin[];
extern u8 AuHeapBase[AUDIO_HEAP_SIZE]; extern u8 AuHeapBase[AUDIO_HEAP_SIZE];
extern u64 AuStack[NU_AU_STACK_SIZE / sizeof(u64)];
void create_audio_system(void) { void create_audio_system(void) {
u32 i; u32 i;
@ -84,7 +84,7 @@ void create_audio_system(void) {
nuAuPreNMIFunc = nuAuPreNMIProc; nuAuPreNMIFunc = nuAuPreNMIProc;
au_driver_init(&auSynDriver, &config); au_driver_init(&auSynDriver, &config);
au_engine_init(config.outputRate); au_engine_init(config.outputRate);
osCreateThread(&nuAuMgrThread, NU_MAIN_THREAD_ID, nuAuMgr, NULL, &AlCmdListBuffers, NU_AU_MGR_THREAD_PRI); //why main thread? osCreateThread(&nuAuMgrThread, NU_MAIN_THREAD_ID, nuAuMgr, NULL, &AuStack[NU_AU_STACK_SIZE / sizeof(u64)], NU_AU_MGR_THREAD_PRI); //why main thread?
osStartThread(&nuAuMgrThread); osStartThread(&nuAuMgrThread);
} }
@ -188,7 +188,7 @@ s32 nuAuDmaCallBack(s32 addr, s32 len, void *state, u8 arg3) {
} }
lastDmaPtr = NULL; lastDmaPtr = NULL;
dmaPtr = D_800A3BD4; dmaPtr = nuAuDmaState.firstUsed;
addrEnd = addr + len; addrEnd = addr + len;
while (dmaPtr != NULL) { while (dmaPtr != NULL) {

View File

@ -5,11 +5,12 @@
NOP_FIX NOP_FIX
extern u64 nuScStack[NU_SC_STACK_SIZE / sizeof(u64)]; extern u64 nuMainStack[NU_SC_STACK_SIZE / sizeof(u64)];
extern u64 IdleStack[NU_SC_STACK_SIZE / sizeof(u64)];
void nuBoot(void) { void nuBoot(void) {
osInitialize(); osInitialize();
osCreateThread(&IdleThread, NU_IDLE_THREAD_ID, boot_idle, NULL, &nuScStack, 10); osCreateThread(&IdleThread, NU_IDLE_THREAD_ID, boot_idle, NULL, &IdleStack[NU_SC_STACK_SIZE / sizeof(u64)], 10);
osStartThread(&IdleThread); osStartThread(&IdleThread);
} }
@ -19,7 +20,7 @@ void boot_idle(void* data) {
nuPiInit(); nuPiInit();
nuScCreateScheduler(OS_VI_NTSC_LAN1, 1); nuScCreateScheduler(OS_VI_NTSC_LAN1, 1);
osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON); osViSetSpecialFeatures(OS_VI_GAMMA_OFF | OS_VI_GAMMA_DITHER_OFF | OS_VI_DIVOT_ON | OS_VI_DITHER_FILTER_ON);
osCreateThread(&MainThread, NU_MAIN_THREAD_ID, boot_main, NULL, &nuYieldBuf, NU_MAIN_THREAD_PRI); osCreateThread(&MainThread, NU_MAIN_THREAD_ID, boot_main, NULL, &nuMainStack[NU_SC_STACK_SIZE / sizeof(u64)], NU_MAIN_THREAD_PRI);
osStartThread(&MainThread); osStartThread(&MainThread);
osSetThreadPri(&IdleThread, NU_IDLE_THREAD_PRI); osSetThreadPri(&IdleThread, NU_IDLE_THREAD_PRI);

View File

@ -14,7 +14,8 @@ extern s16 swapBufMsg;
extern OSThread GfxTaskMgrThread; extern OSThread GfxTaskMgrThread;
extern NUScTask nuGfxTask[NU_GFX_TASK_NUM]; extern NUScTask nuGfxTask[NU_GFX_TASK_NUM];
extern s32 D_800DA040; extern s32 D_800DA040;
extern s32 D_800B91D0; extern s32 D_800B91D0[NU_GFX_RDP_OUTPUTBUFF_SIZE / sizeof(u32)];
extern u64 GfxTaskMgrStack[NU_GFX_TASKMGR_STACK_SIZE / sizeof(u64)];
extern u8 rspbootUcodeBuffer[]; extern u8 rspbootUcodeBuffer[];
void nuGfxTaskMgr(void* data) { void nuGfxTaskMgr(void* data) {
@ -60,7 +61,7 @@ void nuGfxTaskMgrInit(void) {
swapBufMsg = NU_SC_SWAPBUFFER_MSG; swapBufMsg = NU_SC_SWAPBUFFER_MSG;
nuGfxTaskSpool = 0; nuGfxTaskSpool = 0;
nuGfxDisplayOff(); nuGfxDisplayOff();
osCreateThread(&GfxTaskMgrThread, NU_GFX_TASKMGR_THREAD_ID, nuGfxTaskMgr, NULL, &D_8009E6D0, NU_GFX_TASKMGR_THREAD_PRI); osCreateThread(&GfxTaskMgrThread, NU_GFX_TASKMGR_THREAD_ID, nuGfxTaskMgr, NULL, &GfxTaskMgrStack[NU_GFX_TASKMGR_STACK_SIZE / sizeof(u64)], NU_GFX_TASKMGR_THREAD_PRI);
osStartThread(&GfxTaskMgrThread); osStartThread(&GfxTaskMgrThread);
for (i = 0; i < NU_GFX_TASK_NUM; i++) { for (i = 0; i < NU_GFX_TASK_NUM; i++) {
@ -76,7 +77,7 @@ void nuGfxTaskMgrInit(void) {
nuGfxTask[i].list.t.dram_stack = (u64*) &D_800DA040; nuGfxTask[i].list.t.dram_stack = (u64*) &D_800DA040;
nuGfxTask[i].list.t.dram_stack_size = SP_DRAM_STACK_SIZE8; nuGfxTask[i].list.t.dram_stack_size = SP_DRAM_STACK_SIZE8;
nuGfxTask[i].list.t.output_buff = (u64*) &D_800B91D0; nuGfxTask[i].list.t.output_buff = (u64*) &D_800B91D0;
nuGfxTask[i].list.t.output_buff_size = (u64*) &gZoneCollisionData; nuGfxTask[i].list.t.output_buff_size = (u64*) &D_800B91D0[NU_GFX_RDP_OUTPUTBUFF_SIZE / sizeof(u32)];
nuGfxTask[i].list.t.yield_data_ptr = (u64*) &nuYieldBuf; nuGfxTask[i].list.t.yield_data_ptr = (u64*) &nuYieldBuf;
nuGfxTask[i].list.t.yield_data_size = NU_GFX_YIELD_BUF_SIZE; nuGfxTask[i].list.t.yield_data_size = NU_GFX_YIELD_BUF_SIZE;
} }

View File

@ -3,12 +3,12 @@
void gfxThread(void*); void gfxThread(void*);
extern OSMesg nuContWaitMesgBuf; extern s32 GfxStack[NU_GFX_STACK_SIZE / 4];
extern OSThread D_800B1B90; extern OSThread D_800B1B90;
extern OSMesg nuGfxMesgBuf[NU_GFX_MESGS]; extern OSMesg nuGfxMesgBuf[NU_GFX_MESGS];
void nuGfxThreadStart(void) { void nuGfxThreadStart(void) {
osCreateThread(&D_800B1B90, 4, gfxThread, NULL, &nuContWaitMesgBuf, NU_GFX_THREAD_PRI); osCreateThread(&D_800B1B90, 4, gfxThread, NULL, &GfxStack[NU_GFX_STACK_SIZE / 4], NU_GFX_THREAD_PRI);
osStartThread(&D_800B1B90); osStartThread(&D_800B1B90);
} }

View File

@ -71,7 +71,7 @@ void state_step_startup(void) {
fio_has_valid_backup(); fio_has_valid_backup();
if (D_800D9620 == 0) { if (D_800D95E8.saveSlot == 0) {
gGameStatusPtr->soundOutputMode = SOUND_OUT_STEREO; gGameStatusPtr->soundOutputMode = SOUND_OUT_STEREO;
audio_set_stereo(); audio_set_stereo();
} else { } else {

View File

@ -242,10 +242,11 @@ dlabel swapBufMsg
.space 2 .space 2
dlabel GfxTaskMgrThread dlabel GfxTaskMgrThread
.space 0x000021b0 .space 0x000001b0
dlabel D_8009E6C8 .align 4
.space 8 dlabel GfxTaskMgrStack
.space 0x00002000
dlabel D_8009E6D0 dlabel D_8009E6D0
.space 0x00000020 .space 0x00000020
@ -476,7 +477,10 @@ dlabel D_800A0F54
.space 4 .space 4
dlabel nuAuMgrThread dlabel nuAuMgrThread
.space 0x000025b8 .space 0x000005b8
dlabel AuStack
.space 0x00002000
dlabel AlCmdListBuffers dlabel AlCmdListBuffers
.space 0x0000000c .space 0x0000000c
@ -512,14 +516,10 @@ dlabel nuAuDmaIOMesgBuf
.space 0x000004b0 .space 0x000004b0
dlabel nuAuDmaState dlabel nuAuDmaState
.space 4 .space 0x0000000c
dlabel D_800A3BD4
.space 4 .space 4
dlabel D_800A3BD8
.space 8
dlabel nuAuDmaBufList dlabel nuAuDmaBufList
.space 0x000003e8 .space 0x000003e8
@ -629,7 +629,10 @@ dlabel IdleThread
.space 0x000001b0 .space 0x000001b0
dlabel MainThread dlabel MainThread
.space 0x000021b0 .space 0x000001b0
dlabel IdleStack
.space 0x00002000
dlabel nuScStack dlabel nuScStack
.space 0x00002000 .space 0x00002000
@ -650,7 +653,10 @@ dlabel D_800AC5E8
.space 0x000000c8 .space 0x000000c8
dlabel nuGfxMesgBuf dlabel nuGfxMesgBuf
.space 0x00002020 .space 0x00000020
dlabel GfxStack
.space 0x00002000
dlabel nuContWaitMesgBuf dlabel nuContWaitMesgBuf
.space 4 .space 4
@ -932,9 +938,12 @@ dlabel D_800B451F
.space 1 .space 1
dlabel D_800B4520 dlabel D_800B4520
.space 0x00002070 .space 0x00000070
dlabel D_800B6590 dlabel nuBootStack
.space 0x00002000
dlabel nuMainStack
.space 0x00002000 .space 0x00002000
dlabel nuYieldBuf dlabel nuYieldBuf

View File

@ -19,8 +19,8 @@ glabel entry_point
/* 101C 80025C1C 2129FFF8 */ addi $t1, $t1, -8 /* 101C 80025C1C 2129FFF8 */ addi $t1, $t1, -8
/* 1020 80025C20 1520FFFB */ bnez $t1, .L80025C10 /* 1020 80025C20 1520FFFB */ bnez $t1, .L80025C10
/* 1024 80025C24 00000000 */ nop /* 1024 80025C24 00000000 */ nop
/* 1028 80025C28 3C1D800B */ lui $sp, %hi(D_800B6590) /* 1028 80025C28 3C1D800B */ lui $sp, %hi(nuBootStack + 0x2000)
/* 102C 80025C2C 27BD6590 */ addiu $sp, $sp, %lo(D_800B6590) /* 102C 80025C2C 27BD6590 */ addiu $sp, $sp, %lo(nuBootStack + 0x2000)
/* 1030 80025C30 3C0A8006 */ lui $t2, %hi(nuBoot) /* 1030 80025C30 3C0A8006 */ lui $t2, %hi(nuBoot)
/* 1034 80025C34 254AE8B0 */ addiu $t2, $t2, %lo(nuBoot) /* 1034 80025C34 254AE8B0 */ addiu $t2, $t2, %lo(nuBoot)
/* 1038 80025C38 01400008 */ jr $t2 /* 1038 80025C38 01400008 */ jr $t2

View File

@ -2828,8 +2828,6 @@ phys_get_spin_history = 0x800E5938; // type:func rom:0x7EDE8
phys_reset_spin_history = 0x800E59A0; // type:func rom:0x7EE50 phys_reset_spin_history = 0x800E59A0; // type:func rom:0x7EE50
phys_update_action_state = 0x800E5A2C; // type:func rom:0x7EEDC phys_update_action_state = 0x800E5A2C; // type:func rom:0x7EEDC
nuAuDmaState = 0x800A3BD0; // rom:0x7EFD0 nuAuDmaState = 0x800A3BD0; // rom:0x7EFD0
D_800A3BD4 = 0x800A3BD4; // type:data rom:0x7EFD4
D_800A3BD8 = 0x800A3BD8; // type:data rom:0x7EFD8
nuAuDmaBufList = 0x800A3BE0; // rom:0x7EFE0 nuAuDmaBufList = 0x800A3BE0; // rom:0x7EFE0
phys_peach_update = 0x800E5C78; // type:func rom:0x7F128 phys_peach_update = 0x800E5C78; // type:func rom:0x7F128
set_action_state = 0x800E5DA4; // type:func rom:0x7F254 set_action_state = 0x800E5DA4; // type:func rom:0x7F254