Idle + Main bss and cleanup (#1292)

* Idle bss and cleanup

* main bss and cleanup

* format

* Remove pad comment about sAudioMgr

* PR

* Missed a couple size_t changes

* unused pads

* static
This commit is contained in:
Derek Hensley 2023-06-25 17:18:50 -07:00 committed by GitHub
parent a2c2c45a0e
commit 22035890fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
33 changed files with 199 additions and 175 deletions

View File

@ -4,8 +4,7 @@
#include "z64.h"
void bootproc(void);
void Idle_ThreadEntry(void* arg);
void ViConfig_UpdateVi(u32 mode);
void ViConfig_UpdateVi(u32 black);
void ViConfig_UpdateBlack(void);
s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size);
s32 DmaMgr_DmaHandler(OSPiHandle* pihandle, OSIoMesg* mb, s32 direction);
@ -1514,7 +1513,7 @@ ListAlloc* ListAlloc_Init(ListAlloc* this);
// void ListAlloc_Alloc(void);
// void ListAlloc_Free(void);
void ListAlloc_FreeAll(ListAlloc* this);
void Main(void* arg);
void Sched_SwapFramebuffer(CfbInfo* cfbInfo);
void Sched_RetraceUpdateFramebuffer(SchedContext* sched, CfbInfo* cfbInfo);
void Sched_HandleReset(SchedContext* sched);
@ -1536,7 +1535,7 @@ void Sched_SendAudioCancelMsg(SchedContext* sched);
void Sched_SendGfxCancelMsg(SchedContext* sched);
void Sched_FaultClient(void* param1, void* param2);
void Sched_ThreadEntry(void* arg);
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE arg3, UNK_TYPE arg4, IrqMgr* irqMgr);
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, u8 viModeType, UNK_TYPE arg4, IrqMgr* irqMgr);
// void func_80177390(void);
void func_801773A0(void* arg0);
void func_801773C4(void* arg0);

21
include/idle.h Normal file
View File

@ -0,0 +1,21 @@
#ifndef IDLE_H
#define IDLE_H
#include "ultra64.h"
#include "irqmgr.h"
extern IrqMgr gIrqMgr;
extern OSMesgQueue gPiMgrCmdQueue;
extern OSViMode gViConfigMode;
extern u8 gViConfigModeType;
extern u8 D_80096B20;
extern vu8 gViConfigUseBlack;
extern u8 gViConfigAdditionalScanLines;
extern u32 gViConfigFeatures;
extern f32 gViConfigXScale;
extern f32 gViConfigYScale;
void Idle_ThreadEntry(void* arg);
#endif

View File

@ -3,6 +3,7 @@
#include "libc/stdint.h"
#include "ultra64/convert.h"
#include "main.h"
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240

19
include/main.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef MAIN_H
#define MAIN_H
#include "ultra64.h"
#include "scheduler.h"
#include "padmgr.h"
extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern size_t gSystemHeapSize;
extern u32 gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern OSThread gGraphThread;
extern PadMgr gPadMgr;
void Main(void* arg);
#endif

View File

@ -56,8 +56,6 @@ typedef struct {
/* 0x47E */ u8 isResetting;
} PadMgr; // size = 0x480
extern PadMgr gPadMgr;
// Initialization
s32 PadSetup_Init(OSMesgQueue* mq, u8* outMask, OSContStatus* status);

View File

@ -3,7 +3,7 @@
#include "PR/ultratypes.h"
#define OS_PRIORITY_IDLE 10
#define OS_PRIORITY_IDLE 0
#define OS_PRIORITY_MAIN 10
#define OS_PRIORITY_GRAPH 11
#define OS_PRIORITY_AUDIOMGR 12

View File

@ -18,15 +18,8 @@ extern u16 gFramebuffer1[SCREEN_HEIGHT][SCREEN_WIDTH]; // at 0x80000500
extern u8 D_80025D00[];
// data
extern u64 rspbootTextStart[];
extern u8 D_80096B20;
extern vu8 gViConfigUseDefault;
extern u8 gViConfigAdditionalScanLines;
extern u32 gViConfigFeatures;
extern f32 gViConfigXScale;
extern f32 gViConfigYScale;
extern OSPiHandle* gCartHandle;
extern u32 sDmaMgrDmaBuffSize;
extern size_t gDmaMgrDmaBuffSize;
extern vs32 gIrqMgrResetStatus;
extern volatile OSTime sIrqMgrResetTime;
extern volatile OSTime sIrqMgrRetraceTime;
@ -274,11 +267,6 @@ extern char gBuildTeam[];
extern char gBuildDate[];
extern char gBuildMakeOption[];
extern IrqMgr gIrqMgr;
extern OSViMode gViConfigMode;
extern u8 D_8009B290;
extern u8 sYaz0DataBuffer[0x400];
extern u8* sYaz0CurDataEnd;
extern u32 sYaz0CurRomStart;
@ -658,9 +646,7 @@ extern Input* D_801D0D60;
extern u32 retryCount;
extern u32 cfbIdx[3];
extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern u32 startHeapSize;
extern UNK_PTR D_801D1540;
extern Vec3f gZeroVec3f;
extern Vec3s gZeroVec3s;
@ -2257,11 +2243,6 @@ extern GfxMasterList* gGfxMasterDL;
extern CfbInfo sGraphCfbInfos[3];
extern OSTime sGraphTaskStartTime;
extern u32 gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern OSThread gGraphThread;
extern FaultClient sSchedFaultClient;
extern OSTime sRSPGFXStartTime;
extern OSTime sRSPAudioStartTime;

View File

@ -6,6 +6,7 @@
#include "audiothread_cmd.h"
#include "libc/stddef.h"
#include "audio/effects.h"
#include "sequence.h"
#define NO_LAYER ((SequenceLayer*)(-1))

View File

@ -6,6 +6,8 @@
#define Z_THREAD_ID_MAIN 3
#define Z_THREAD_ID_GRAPH 4
#define Z_THREAD_ID_SCHED 5
#define Z_THREAD_ID_PADMGR 7
#define Z_THREAD_ID_AUDIOMGR 10
#define Z_THREAD_ID_FLASHROM 13
#define Z_THREAD_ID_DMAMGR 18
#define Z_THREAD_ID_IRQMGR 19

3
spec
View File

@ -16,7 +16,6 @@ beginseg
include "build/src/boot_O2_g3/boot_main.o"
include "build/data/boot/rspboot.data.o"
include "build/src/boot_O2_g3/idle.o"
include "build/src/boot_O2_g3/idle_extra_bss.o"
include "build/src/boot_O2_g3/viconfig.o"
include "build/data/boot/viconfig.data.o"
include "build/src/boot_O2_g3/z_std_dma.o"
@ -563,8 +562,6 @@ beginseg
include "build/src/code/graphalloc.o"
include "build/src/code/listalloc.o"
include "build/src/code/main.o"
include "build/data/code/main.data.o"
include "build/data/code/main.bss.o"
include "build/src/code/padmgr.o"
include "build/src/code/sched.o"
include "build/src/code/speed_meter.o"

View File

@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "idle.h"
#include "stack.h"
#include "stackcheck.h"
#include "z64thread.h"

View File

@ -1,17 +1,10 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "irqmgr.h"
#include "main.h"
#include "stack.h"
#include "buffers.h"
#include "stackcheck.h"
#include "z64thread.h"
u8 D_80096B20 = 1;
vu8 gViConfigUseDefault = 1;
u8 gViConfigAdditionalScanLines = 0;
u32 gViConfigFeatures = 0x42;
f32 gViConfigXScale = 1.0f;
f32 gViConfigYScale = 1.0f;
// Variables are put before most headers as a hacky way to bypass bss reordering
IrqMgr gIrqMgr;
STACK(sIrqMgrStack, 0x500);
StackEntry sIrqMgrStackInfo;
@ -19,90 +12,101 @@ OSThread sMainThread;
STACK(sMainStack, 0x900);
StackEntry sMainStackInfo;
OSMesg sPiMgrCmdBuff[50];
OSMesgQueue gPiMgrCmdQ;
OSMesgQueue gPiMgrCmdQueue;
OSViMode gViConfigMode;
u8 gViConfigModeType;
void Idle_ClearMemory(void* begin, void* end) {
#include "global.h"
#include "buffers.h"
#include "idle.h"
u8 D_80096B20 = 1;
vu8 gViConfigUseBlack = true;
u8 gViConfigAdditionalScanLines = 0;
u32 gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF;
f32 gViConfigXScale = 1.0f;
f32 gViConfigYScale = 1.0f;
void Main_ClearMemory(void* begin, void* end) {
if (begin < end) {
bzero(begin, (uintptr_t)end - (uintptr_t)begin);
}
}
void Idle_InitFramebuffer(u32* ptr, size_t numBytes, u32 value) {
s32 temp = sizeof(u32);
while (numBytes) {
*ptr++ = value;
numBytes -= temp;
void Main_InitFramebuffer(u32* framebuffer, size_t numBytes, u32 value) {
for (; numBytes > 0; numBytes -= sizeof(u32)) {
*framebuffer++ = value;
}
}
void Idle_InitScreen(void) {
Idle_InitFramebuffer((u32*)gFramebuffer1, 0x25800, 0x00010001);
ViConfig_UpdateVi(0);
void Main_InitScreen(void) {
Main_InitFramebuffer((u32*)gFramebuffer1, sizeof(gFramebuffer1),
(GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
ViConfig_UpdateVi(false);
osViSwapBuffer(gFramebuffer1);
osViBlack(false);
}
void Idle_InitMemory(void) {
u32 pad;
void Main_InitMemory(void) {
void* memStart = (void*)0x80000400;
void* memEnd = OS_PHYSICAL_TO_K0(osMemSize);
Idle_ClearMemory(0x80000400, gFramebuffer1);
Idle_ClearMemory(D_80025D00, bootproc);
Idle_ClearMemory(gGfxSPTaskYieldBuffer, memEnd);
Main_ClearMemory(memStart, gFramebuffer1);
Main_ClearMemory(D_80025D00, bootproc);
Main_ClearMemory(gGfxSPTaskYieldBuffer, memEnd);
}
void Idle_InitCodeAndMemory(void) {
void Main_Init(void) {
DmaRequest dmaReq;
OSMesgQueue queue;
OSMesg mesg;
size_t oldSize;
OSMesgQueue mq;
OSMesg msg[1];
size_t prevSize;
osCreateMesgQueue(&queue, &mesg, 1);
osCreateMesgQueue(&mq, msg, ARRAY_COUNT(msg));
oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0;
prevSize = gDmaMgrDmaBuffSize;
gDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, SEGMENT_START(code), SEGMENT_ROM_START(code),
SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &queue, 0);
Idle_InitScreen();
Idle_InitMemory();
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
SEGMENT_ROM_END(code) - SEGMENT_ROM_START(code), 0, &mq, NULL);
Main_InitScreen();
Main_InitMemory();
osRecvMesg(&mq, NULL, OS_MESG_BLOCK);
sDmaMgrDmaBuffSize = oldSize;
gDmaMgrDmaBuffSize = prevSize;
Idle_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
Main_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
}
void Main_ThreadEntry(void* arg) {
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, STACK_TOP(sIrqMgrStack), 0, 0x100, "irqmgr");
IrqMgr_Init(&gIrqMgr, STACK_TOP(sIrqMgrStack), Z_PRIORITY_IRQMGR, 1);
DmaMgr_Start();
Idle_InitCodeAndMemory();
Main_Init();
Main(arg);
DmaMgr_Stop();
}
void Idle_InitVideo(void) {
osCreateViManager(254);
osCreateViManager(OS_PRIORITY_VIMGR);
gViConfigFeatures = 66;
gViConfigXScale = 1.0;
gViConfigYScale = 1.0;
gViConfigFeatures = OS_VI_DITHER_FILTER_ON | OS_VI_GAMMA_OFF;
gViConfigXScale = 1.0f;
gViConfigYScale = 1.0f;
switch (osTvType) {
case OS_TV_NTSC:
D_8009B290 = 2;
gViConfigModeType = OS_VI_NTSC_LAN1;
gViConfigMode = osViModeNtscLan1;
break;
case OS_TV_MPAL:
D_8009B290 = 30;
gViConfigModeType = OS_VI_MPAL_LAN1;
gViConfigMode = osViModeMpalLan1;
break;
case OS_TV_PAL:
D_8009B290 = 44;
gViConfigModeType = OS_VI_FPAL_LAN1;
gViConfigMode = osViModeFpalLan1;
gViConfigYScale = 0.833f;
break;
@ -113,10 +117,11 @@ void Idle_InitVideo(void) {
void Idle_ThreadEntry(void* arg) {
Idle_InitVideo();
osCreatePiManager(150, &gPiMgrCmdQ, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
osCreatePiManager(OS_PRIORITY_PIMGR, &gPiMgrCmdQueue, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
StackCheck_Init(&sMainStackInfo, sMainStack, STACK_TOP(sMainStack), 0, 0x400, "main");
osCreateThread(&sMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, STACK_TOP(sMainStack), Z_PRIORITY_MAIN);
osStartThread(&sMainThread);
osSetThreadPri(NULL, 0);
osSetThreadPri(NULL, OS_PRIORITY_IDLE);
do { } while (true); }
for (;;) {}
}

View File

@ -1,8 +0,0 @@
#include "PR/ultratypes.h"
#include "ultra64/vi.h"
// This file is currently required to fix bss reordering in idle.c. It is not resolved by prevent_bss_reordering.h .
// Hopefully it will not be permanent.
OSViMode gViConfigMode;
u8 D_8009B290;

View File

@ -1,14 +1,17 @@
#include "global.h"
#include "idle.h"
void ViConfig_UpdateVi(u32 mode) {
if (mode != 0) {
void ViConfig_UpdateVi(u32 black) {
if (black) {
switch (osTvType) {
case OS_TV_MPAL:
osViSetMode(&osViModeMpalLan1);
break;
case OS_TV_PAL:
osViSetMode(&osViModePalLan1);
break;
case OS_TV_NTSC:
default:
osViSetMode(&osViModeNtscLan1);
@ -42,11 +45,11 @@ void ViConfig_UpdateVi(u32 mode) {
}
}
gViConfigUseDefault = mode;
gViConfigUseBlack = black;
}
void ViConfig_UpdateBlack(void) {
if (gViConfigUseDefault != 0) {
if (gViConfigUseBlack) {
osViBlack(true);
} else {
osViBlack(false);

View File

@ -4,10 +4,10 @@
#include "stackcheck.h"
#include "z64thread.h"
u32 sDmaMgrDmaBuffSize = 0x2000;
size_t gDmaMgrDmaBuffSize = 0x2000;
StackEntry sDmaMgrStackInfo;
u16 numDmaEntries;
u16 sNumDmaEntries;
OSMesgQueue sDmaMgrMsgQueue;
OSMesg sDmaMgrMsgs[32];
OSThread sDmaMgrThread;
@ -18,7 +18,7 @@ s32 DmaMgr_DmaRomToRam(uintptr_t rom, void* ram, size_t size) {
OSMesgQueue queue;
OSMesg msg[1];
s32 ret;
size_t buffSize = sDmaMgrDmaBuffSize;
size_t buffSize = gDmaMgrDmaBuffSize;
osInvalDCache(ram, size);
osCreateMesgQueue(&queue, msg, ARRAY_COUNT(msg));
@ -127,7 +127,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
index = DmaMgr_FindDmaIndex(vrom);
if ((index >= 0) && (index < numDmaEntries)) {
if ((index >= 0) && (index < sNumDmaEntries)) {
dmaEntry = &dmadata[index];
if (dmaEntry->romEnd == 0) {
if (dmaEntry->vromEnd < (vrom + size)) {
@ -225,7 +225,7 @@ void DmaMgr_Start(void) {
idx++;
}
numDmaEntries = idx;
sNumDmaEntries = idx;
}
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "audiomgr.h"
#include "idle.h"
#include "system_malloc.h"
#include "z64debug_text.h"
#include "z64rumble.h"

View File

@ -1,6 +1,7 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "buffers.h"
#include "idle.h"
#include "system_malloc.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
#include "overlays/gamestates/ovl_file_choose/z_file_select.h"

View File

@ -1,34 +1,41 @@
/**
* This file has unmigrated bss. It is not practical to migrate it until we have a better way of dealing with bss
* reordering than just prevent_bss_reordering.h: there is too much of it to control, and it cannot be split into
* separate files since most of it is at addresses ending in 8.
*/
#include "global.h"
#include "audiomgr.h"
#include "buffers.h"
#include "idle.h"
#include "irqmgr.h"
#include "padmgr.h"
#include "scheduler.h"
#include "stack.h"
#include "stackcheck.h"
#include "system_heap.h"
#include "z64thread.h"
extern OSMesgQueue sSiIntMsgQ;
extern OSMesg sSiIntMsgBuf[1];
extern u32 gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern IrqMgrClient irqClient;
extern OSMesgQueue irqMgrMsgQ;
extern OSMesg irqMgrMsgBuf[60];
extern OSThread gGraphThread;
extern STACK(sGraphStack, 0x1800);
extern STACK(sSchedStack, 0x600);
extern STACK(sAudioStack, 0x800);
extern STACK(sPadMgrStack, 0x500);
extern StackEntry sGraphStackInfo;
extern StackEntry sSchedStackInfo;
extern StackEntry sAudioStackInfo;
extern StackEntry sPadMgrStackInfo;
extern AudioMgr sAudioMgr;
// Variables are put before most headers as a hacky way to bypass bss reordering
OSMesgQueue sSerialEventQueue;
OSMesg sSerialMsgBuf[1];
u32 gSegments[NUM_SEGMENTS];
SchedContext gSchedContext;
IrqMgrClient sIrqClient;
OSMesgQueue sIrqMgrMsgQueue;
OSMesg sIrqMgrMsgBuf[60];
OSThread gGraphThread;
STACK(sGraphStack, 0x1800);
STACK(sSchedStack, 0x600);
STACK(sAudioStack, 0x800);
STACK(sPadMgrStack, 0x500);
StackEntry sGraphStackInfo;
StackEntry sSchedStackInfo;
StackEntry sAudioStackInfo;
StackEntry sPadMgrStackInfo;
AudioMgr sAudioMgr;
static s32 sBssPad;
PadMgr gPadMgr;
#include "main.h"
#include "buffers.h"
#include "global.h"
s32 gScreenWidth = SCREEN_WIDTH;
s32 gScreenHeight = SCREEN_HEIGHT;
size_t gSystemHeapSize = 0;
void Main(void* arg) {
intptr_t fb;
@ -46,30 +53,31 @@ void Main(void* arg) {
sysHeap = gSystemHeap;
fb = 0x80780000;
startHeapSize = fb - sysHeap;
SystemHeap_Init(sysHeap, startHeapSize);
gSystemHeapSize = fb - sysHeap;
SystemHeap_Init(sysHeap, gSystemHeapSize);
Regs_Init();
R_ENABLE_ARENA_DBG = 0;
osCreateMesgQueue(&sSiIntMsgQ, sSiIntMsgBuf, ARRAY_COUNT(sSiIntMsgBuf));
osSetEventMesg(OS_EVENT_SI, &sSiIntMsgQ, NULL);
osCreateMesgQueue(&sSerialEventQueue, sSerialMsgBuf, ARRAY_COUNT(sSerialMsgBuf));
osSetEventMesg(OS_EVENT_SI, &sSerialEventQueue, NULL);
osCreateMesgQueue(&irqMgrMsgQ, irqMgrMsgBuf, ARRAY_COUNT(irqMgrMsgBuf));
osCreateMesgQueue(&sIrqMgrMsgQueue, sIrqMgrMsgBuf, ARRAY_COUNT(sIrqMgrMsgBuf));
StackCheck_Init(&sSchedStackInfo, sSchedStack, STACK_TOP(sSchedStack), 0, 0x100, "sched");
Sched_Init(&gSchedContext, STACK_TOP(sSchedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
Sched_Init(&gSchedContext, STACK_TOP(sSchedStack), Z_PRIORITY_SCHED, gViConfigModeType, 1, &gIrqMgr);
CIC6105_AddRomInfoFaultPage();
IrqMgr_AddClient(&gIrqMgr, &irqClient, &irqMgrMsgQ);
IrqMgr_AddClient(&gIrqMgr, &sIrqClient, &sIrqMgrMsgQueue);
StackCheck_Init(&sAudioStackInfo, sAudioStack, STACK_TOP(sAudioStack), 0, 0x100, "audio");
AudioMgr_Init(&sAudioMgr, STACK_TOP(sAudioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
AudioMgr_Init(&sAudioMgr, STACK_TOP(sAudioStack), Z_PRIORITY_AUDIOMGR, Z_THREAD_ID_AUDIOMGR, &gSchedContext,
&gIrqMgr);
StackCheck_Init(&sPadMgrStackInfo, sPadMgrStack, STACK_TOP(sPadMgrStack), 0, 0x100, "padmgr");
PadMgr_Init(&sSiIntMsgQ, &gIrqMgr, 7, Z_PRIORITY_PADMGR, STACK_TOP(sPadMgrStack));
PadMgr_Init(&sSerialEventQueue, &gIrqMgr, Z_THREAD_ID_PADMGR, Z_PRIORITY_PADMGR, STACK_TOP(sPadMgrStack));
AudioMgr_Unlock(&sAudioMgr);
@ -81,7 +89,7 @@ void Main(void* arg) {
while (!exit) {
msg = NULL;
osRecvMesg(&irqMgrMsgQ, (OSMesg*)&msg, OS_MESG_BLOCK);
osRecvMesg(&sIrqMgrMsgQueue, (OSMesg*)&msg, OS_MESG_BLOCK);
if (msg == NULL) {
break;
}
@ -90,12 +98,13 @@ void Main(void* arg) {
case OS_SC_PRE_NMI_MSG:
Nmi_SetPrenmiStart();
break;
case OS_SC_NMI_MSG:
exit = true;
break;
}
}
IrqMgr_RemoveClient(&gIrqMgr, &irqClient);
IrqMgr_RemoveClient(&gIrqMgr, &sIrqClient);
osDestroyThread(&gGraphThread);
}

View File

@ -1,5 +1,6 @@
#include "prevent_bss_reordering.h"
#include "global.h"
#include "idle.h"
#include "stackcheck.h"
#include "z64thread.h"
@ -20,14 +21,12 @@ u64* gAudioSPDataPtr;
u32 gAudioSPDataSize;
void Sched_SwapFramebuffer(CfbInfo* cfbInfo) {
s32 one = 1;
if (cfbInfo->swapBuffer != NULL) {
osViSwapBuffer(cfbInfo->swapBuffer);
cfbInfo->updateRate2 = cfbInfo->updateRate;
if ((SREG(62) == 0) && (cfbInfo->viMode != NULL)) {
D_80096B20 = one;
D_80096B20 = 1;
osViSetMode(cfbInfo->viMode);
osViSetSpecialFeatures(cfbInfo->features);
osViSetXScale(cfbInfo->xScale);
@ -43,7 +42,7 @@ void Sched_RetraceUpdateFramebuffer(SchedContext* sched, CfbInfo* cfbInfo) {
sched->shouldUpdateVi = false;
if (gIrqMgrResetStatus == 0) {
ViConfig_UpdateVi(0);
ViConfig_UpdateVi(false);
}
}
Sched_SwapFramebuffer(cfbInfo);
@ -53,7 +52,7 @@ void Sched_HandleReset(SchedContext* sched) {
}
void Sched_HandleStop(SchedContext* sched) {
ViConfig_UpdateVi(1);
ViConfig_UpdateVi(true);
}
/**
@ -600,7 +599,7 @@ void Sched_ThreadEntry(void* arg) {
* Registers an IrqClient for the thread and fault client for the SchedContext.
* Directs the OS to send SP and DP OS messages to interruptQ when the RSP or RDP signal task completion.
*/
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, UNK_TYPE arg3, UNK_TYPE arg4, IrqMgr* irqMgr) {
void Sched_Init(SchedContext* sched, void* stack, OSPri pri, u8 viModeType, UNK_TYPE arg4, IrqMgr* irqMgr) {
bzero(sched, sizeof(SchedContext));
sched->shouldUpdateVi = true;

View File

@ -4,12 +4,6 @@
*/
#include "global.h"
extern u64 rspbootTextStart[];
extern u64 rspbootTextEnd[];
extern u64 gspF3DZEX2_NoN_PosLight_fifoTextStart[];
extern u64 gspF3DZEX2_NoN_PosLight_fifoDataStart[];
u64* initialgspUcodeText = gspF3DZEX2_NoN_PosLight_fifoTextStart;
u64* initialgspUcodeData = gspF3DZEX2_NoN_PosLight_fifoDataStart;

View File

@ -1,5 +1,6 @@
#include "global.h"
#include "buffers.h"
#include "idle.h"
#include "z64bombers_notebook.h"
#include "z64debug_display.h"
#include "z64quake.h"

View File

@ -8,7 +8,7 @@ void PreNMI_Stop(PreNMIState* this) {
void PreNMI_Update(PreNMIState* this) {
if (this->timer == 0) {
ViConfig_UpdateVi(1);
ViConfig_UpdateVi(true);
PreNMI_Stop(this);
} else {
this->timer--;

View File

@ -4,7 +4,7 @@
// 60 is an arbitrary number which specifies the max amount of limbs per skeleton this system supports
MtxF gSkinLimbMatrices[60];
static s32 sUnused;
static s32 sBssPad;
void Skin_UpdateVertices(MtxF* mtx, SkinVertex* skinVertices, SkinLimbModif* modifEntry, Vtx* vtxBuf, Vec3f* pos) {
SkinVertex* vertexEntry;

View File

@ -57,7 +57,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP),
};
s32 sUnused;
static s32 sBssPad;
void ArrowFire_SetupAction(ArrowFire* this, ArrowFireActionFunc actionFunc) {
this->actionFunc = actionFunc;

View File

@ -21,7 +21,7 @@ void ArrowIce_Fly(ArrowIce* this, PlayState* play);
#include "overlays/ovl_Arrow_Ice/ovl_Arrow_Ice.c"
s32 unused; // Needed for bss
static s32 sBssPad;
ActorInit Arrow_Ice_InitVars = {
ACTOR_ARROW_ICE,

View File

@ -37,7 +37,7 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneForward, 2000, ICHAIN_STOP),
};
static s32 sUnused;
static s32 sBssPad;
void ArrowLight_SetupAction(ArrowLight* this, ArrowLightActionFunc actionFunc) {
this->actionFunc = actionFunc;

View File

@ -41,7 +41,7 @@ ActorInit Bg_Iknin_Susceil_InitVars = {
(ActorFunc)BgIkninSusceil_Draw,
};
static s32 unused = 0;
static s32 sPad = 0;
static f32 D_80C0B0E4 = 960.0f;
static Vec2f D_80C0B0E8 = { -320.0f, 0.0f };
static s8 D_80C0B0F0[] = { 0x00, 0x00, 0x07, 0x0A, 0x0A, 0x0B, 0x0B, 0x00 };

View File

@ -68,7 +68,7 @@ Vec3f D_80947B10[] = {
{ -1.0f, -2.0f, -0.2f }, { 0.0f, -2.0f, -0.2f }, { 1.0f, -2.0f, -0.2f }, { 0.0f, -3.0f, -0.5f },
};
static s32 sPad[2] = { 0 };
static s32 sPad = 0;
#include "overlays/ovl_En_Sda/ovl_En_Sda.c"

View File

@ -30,7 +30,7 @@ ActorInit En_Tanron1_InitVars = {
(ActorFunc)EnTanron1_Draw,
};
static s32 sPad[2] = { 0 };
static s32 sPad = 0;
#include "overlays/ovl_En_Tanron1/ovl_En_Tanron1.c"

View File

@ -3,7 +3,6 @@
* Overlay: ovl_Obj_Hunsui
* Description: Switch-Activated Geyser
*/
#include "prevent_bss_reordering.h"
#include "z_obj_hunsui.h"
#include "objects/object_hunsui/object_hunsui.h"

View File

@ -2,11 +2,11 @@
{
0x80080000:("entrypoint",),
0x80080060:("bootproc",),
0x80080150:("Idle_ClearMemory",),
0x80080180:("Idle_InitFramebuffer",),
0x8008019C:("Idle_InitScreen",),
0x800801EC:("Idle_InitMemory",),
0x80080250:("Idle_InitCodeAndMemory",),
0x80080150:("Main_ClearMemory",),
0x80080180:("Main_InitFramebuffer",),
0x8008019C:("Main_InitScreen",),
0x800801EC:("Main_InitMemory",),
0x80080250:("Main_Init",),
0x80080300:("Main_ThreadEntry",),
0x8008038C:("Idle_InitVideo",),
0x80080514:("Idle_ThreadEntry",),

View File

@ -18,7 +18,7 @@
0x80096B30:("gViConfigXScale","f32","",0x4),
0x80096B34:("gViConfigYScale","f32","",0x4),
0x80096B40:("gCartHandle","OSPiHandle*","",0x4),
0x80096B50:("sDmaMgrDmaBuffSize","u32","",0x4),
0x80096B50:("gDmaMgrDmaBuffSize","u32","",0x4),
0x80096B60:("gIrqMgrResetStatus","vs32","",0x4),
0x80096B68:("sIrqMgrResetTime","volatile OSTime","",0x8),
0x80096B70:("sIrqMgrRetraceTime","volatile OSTime","",0x8),
@ -295,11 +295,11 @@
0x8009A840:("sMainStack","u8","[2304]",0x900),
0x8009B140:("sMainStackInfo","StackEntry","",0x1c),
0x8009B160:("sPiMgrCmdBuff","OSMesg","[50]",0xc8),
0x8009B228:("gPiMgrCmdQ","OSMesgQueue","",0x18),
0x8009B228:("gPiMgrCmdQueue","OSMesgQueue","",0x18),
0x8009B240:("gViConfigMode","OSViMode","",0x50),
0x8009B290:("D_8009B290","u8","",0x1),
0x8009B290:("gViConfigModeType","u8","",0x1),
0x8009B2A0:("sDmaMgrStackInfo","StackEntry","",0x1c),
0x8009B2BC:("numDmaEntries","u16","",0x2),
0x8009B2BC:("sNumDmaEntries","u16","",0x2),
0x8009B2C0:("sDmaMgrMsgQueue","OSMesgQueue","",0x18),
0x8009B2D8:("sDmaMgrMsgs","OSMesg","[32]",0x80),
0x8009B358:("sDmaMgrThread","OSThread","",0x1b0),
@ -2157,7 +2157,7 @@
0x801D150C:("gFramerateDivisorThird","f32","",0x4),
0x801D1520:("gScreenWidth","s32","",0x4),
0x801D1524:("gScreenHeight","s32","",0x4),
0x801D1528:("startHeapSize","UNK_TYPE4","",0x4),
0x801D1528:("gSystemHeapSize","UNK_TYPE4","",0x4),
0x801D1530:("sPadMgrInstance","PadMgr*","",0x4),
0x801D1534:("sPadMgrRetraceCount","UNK_TYPE4","",0x4),
0x801D1538:("sVoiceInitStatus","UNK_TYPE4","",0x4),
@ -4035,13 +4035,13 @@
0x801F80F0:("gGfxMasterDL","Gfx*","",0x4),
0x801F80F8:("sGraphCfbInfos","UNK_TYPE1","",0x1),
0x801F8150:("sGraphTaskStartTime","u64","",0x8),
0x801F8160:("sSiIntMsgQ","OSMesgQueue","",0x18),
0x801F8178:("sSiIntMsgBuf","OSMesg","[1]",0x4),
0x801F8160:("sSerialEventQueue","OSMesgQueue","",0x18),
0x801F8178:("sSerialMsgBuf","OSMesg","[1]",0x4),
0x801F8180:("gSegments","u32","[16]",0x40),
0x801F81C0:("gSchedContext","SchedContext","",0x338),
0x801F84F8:("irqClient","IrqMgrClient","",0x8),
0x801F8500:("irqMgrMsgQ","OSMesgQueue","",0x18),
0x801F8518:("irqMgrMsgBuf","OSMesg","[60]",0xf0),
0x801F84F8:("sIrqClient","IrqMgrClient","",0x8),
0x801F8500:("sIrqMgrMsgQueue","OSMesgQueue","",0x18),
0x801F8518:("sIrqMgrMsgBuf","OSMesg","[60]",0xf0),
0x801F8608:("gGraphThread","OSThread","",0x1b0),
0x801F87B8:("sGraphStack","u8","[6144]",0x1800),
0x801F9FB8:("sSchedStack","u8","[1536]",0x600),

View File

@ -1,9 +1,9 @@
asm/non_matchings/boot/boot_main/bootproc.s,bootproc,0x80080060,0x3C
asm/non_matchings/boot/idle/Idle_ClearMemory.s,Idle_ClearMemory,0x80080150,0xC
asm/non_matchings/boot/idle/Idle_InitFramebuffer.s,Idle_InitFramebuffer,0x80080180,0x7
asm/non_matchings/boot/idle/Idle_InitScreen.s,Idle_InitScreen,0x8008019C,0x14
asm/non_matchings/boot/idle/Idle_InitMemory.s,Idle_InitMemory,0x800801EC,0x19
asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.s,Idle_InitCodeAndMemory,0x80080250,0x2C
asm/non_matchings/boot/idle/Main_ClearMemory.s,Main_ClearMemory,0x80080150,0xC
asm/non_matchings/boot/idle/Main_InitFramebuffer.s,Main_InitFramebuffer,0x80080180,0x7
asm/non_matchings/boot/idle/Main_InitScreen.s,Main_InitScreen,0x8008019C,0x14
asm/non_matchings/boot/idle/Main_InitMemory.s,Main_InitMemory,0x800801EC,0x19
asm/non_matchings/boot/idle/Main_Init.s,Main_Init,0x80080250,0x2C
asm/non_matchings/boot/idle/Main_ThreadEntry.s,Main_ThreadEntry,0x80080300,0x23
asm/non_matchings/boot/idle/Idle_InitVideo.s,Idle_InitVideo,0x8008038C,0x62
asm/non_matchings/boot/idle/Idle_ThreadEntry.s,Idle_ThreadEntry,0x80080514,0x33

1 asm/non_matchings/boot/boot_main/bootproc.s bootproc 0x80080060 0x3C
2 asm/non_matchings/boot/idle/Idle_ClearMemory.s asm/non_matchings/boot/idle/Main_ClearMemory.s Idle_ClearMemory Main_ClearMemory 0x80080150 0xC
3 asm/non_matchings/boot/idle/Idle_InitFramebuffer.s asm/non_matchings/boot/idle/Main_InitFramebuffer.s Idle_InitFramebuffer Main_InitFramebuffer 0x80080180 0x7
4 asm/non_matchings/boot/idle/Idle_InitScreen.s asm/non_matchings/boot/idle/Main_InitScreen.s Idle_InitScreen Main_InitScreen 0x8008019C 0x14
5 asm/non_matchings/boot/idle/Idle_InitMemory.s asm/non_matchings/boot/idle/Main_InitMemory.s Idle_InitMemory Main_InitMemory 0x800801EC 0x19
6 asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.s asm/non_matchings/boot/idle/Main_Init.s Idle_InitCodeAndMemory Main_Init 0x80080250 0x2C
7 asm/non_matchings/boot/idle/Main_ThreadEntry.s Main_ThreadEntry 0x80080300 0x23
8 asm/non_matchings/boot/idle/Idle_InitVideo.s Idle_InitVideo 0x8008038C 0x62
9 asm/non_matchings/boot/idle/Idle_ThreadEntry.s Idle_ThreadEntry 0x80080514 0x33