Migrated a lot of boot bss, matched a few NON_MATCHINGs in boot (#266)

* Import bss to boot_main and idle, match last function in idle

* Some pointer cleanup in idle, spec

* Clean up idle, add build.c, add bss to CIC6105

* Import rand bss

* sptask bss and a macro

* sptask updated to use libultra macros

* siacs.c bss

* Macros in CIC and idle

* controller bss

* seteventmesg bss

* spec

* pimgr and piacs bss

* initialize OK, threadsave, initialize, pimgr bss

* Match DmaMgr_Start

* Fix bss reorder using separate file

* Small cleanup of hex/dec in buffer sizes

* Add comment, remove unused bss from spec

* Merge remote-tracking branch 'upstream/master' into boot_bss

* Format

* Delete files

* remove commented-out structs

* Bit more cleanup

* Addressed reviews

* Format
This commit is contained in:
EllipticEllipsis
2021-08-18 16:12:35 +01:00
committed by GitHub
parent 49922b4856
commit fa95f9e6e8
33 changed files with 389 additions and 269 deletions
+7
View File
@@ -1,5 +1,12 @@
#include "global.h"
// The latest generated random number, used to generate the next number in the sequence.
static u32 sRandInt = 1;
// Space to store a value to be re-interpreted as a float.
// This can't be static because it is used in z_kankyo
u32 sRandFloat;
#define RAND_MULTIPLIER 1664525
#define RAND_INCREMENT 1013904223
+7 -3
View File
@@ -1,5 +1,9 @@
#include "global.h"
UNK_TYPE4 D_8009BE30;
UNK_TYPE4 D_8009BE34;
FaultClient romInfoFaultClient;
void CIC6105_Nop80081820(void) {
}
@@ -7,9 +11,9 @@ void CIC6105_Nop80081828(void) {
}
void CIC6105_PrintRomInfo(void) {
FaultDrawer_DrawText(80, 200, "SP_STATUS %08x", (UNK_PTR)(*(u32*)0xA4040010));
FaultDrawer_DrawText(40, 184, "ROM_F [Creator:%s]", &D_800994D0);
FaultDrawer_DrawText(56, 192, "[Date:%s]", &D_800994DC);
FaultDrawer_DrawText(80, 200, "SP_STATUS %08x", HW_REG(SP_STATUS_REG, u32));
FaultDrawer_DrawText(40, 184, "ROM_F [Creator:%s]", gBuildTeam);
FaultDrawer_DrawText(56, 192, "[Date:%s]", gBuildDate);
}
void CIC6105_AddRomInfoFaultPage(void) {
+6
View File
@@ -1,5 +1,11 @@
#include "global.h"
StackEntry sBootThreadInfo;
OSThread sIdleThread;
u8 sIdleThreadStack[0x400];
StackEntry sIdleThreadInfo;
u8 sBootThreadStack[0x400];
void bootproc(void) {
StackCheck_Init(&sBootThreadInfo, sBootThreadStack, sBootThreadStack + sizeof(sBootThreadStack), 0, -1, "boot");
osMemSize = osGetMemSize();
+3
View File
@@ -0,0 +1,3 @@
const char gBuildTeam[] = "zelda@srd44";
const char gBuildDate[] = "00-07-31 17:04:16";
const char gBuildMakeOption[] = "";
+19 -18
View File
@@ -7,9 +7,18 @@ u32 gViConfigFeatures = 0x42;
f32 gViConfigXScale = 1.0f;
f32 gViConfigYScale = 1.0f;
IrqMgr gIrqMgr;
u8 sIrqMgrStack[0x500];
StackEntry sIrqMgrStackInfo;
OSThread gMainThread;
u8 sMainStack[0x900];
StackEntry sMainStackInfo;
OSMesg sPiMgrCmdBuff[50];
OSMesgQueue gPiMgrCmdQ;
void Idle_ClearMemory(void* begin, void* end) {
if (begin < end) {
bzero(begin, (s32)(int)end - (int)begin);
bzero(begin, (u32)end - (u32)begin);
}
}
@@ -23,23 +32,21 @@ void Idle_InitFramebuffer(u32* ptr, u32 numBytes, u32 value) {
}
void Idle_InitScreen(void) {
Idle_InitFramebuffer((u32*)&gFramebuffer1, 0x25800, 0x00010001);
Idle_InitFramebuffer((u32*)gFramebuffer1, 0x25800, 0x00010001);
ViConfig_UpdateVi(0);
osViSwapBuffer(&gFramebuffer1);
osViSwapBuffer(gFramebuffer1);
osViBlack(0);
}
void Idle_InitMemory(void) {
u32 pad;
void* memEnd = (void*)(0x80000000 + osMemSize);
void* memEnd = OS_PHYSICAL_TO_K0(osMemSize);
Idle_ClearMemory((void*)0x80000400, &gFramebuffer1);
Idle_ClearMemory(&D_80025D00, (int*)&bootproc);
Idle_ClearMemory(&gGfxSPTaskYieldBuffer, memEnd);
Idle_ClearMemory(0x80000400, gFramebuffer1);
Idle_ClearMemory(D_80025D00, bootproc);
Idle_ClearMemory(gGfxSPTaskYieldBuffer, memEnd);
}
#ifdef NON_MATCHING
// regalloc around DmaMgr_SendRequestImpl
void Idle_InitCodeAndMemory(void) {
DmaRequest dmaReq;
OSMesgQueue queue;
@@ -51,8 +58,8 @@ void Idle_InitCodeAndMemory(void) {
oldSize = sDmaMgrDmaBuffSize;
sDmaMgrDmaBuffSize = 0;
DmaMgr_SendRequestImpl(&dmaReq, (u32)_codeSegmentStart, (u32)_codeSegmentRomStart,
(u32)_codeSegmentRomEnd - (u32)_codeSegmentRomStart, 0, &queue, 0);
DmaMgr_SendRequestImpl(&dmaReq, _codeSegmentStart, _codeSegmentRomStart, _codeSegmentRomEnd - _codeSegmentRomStart,
0, &queue, 0);
Idle_InitScreen();
Idle_InitMemory();
osRecvMesg(&queue, NULL, 1);
@@ -61,9 +68,6 @@ void Idle_InitCodeAndMemory(void) {
Idle_ClearMemory(_codeSegmentBssStart, _codeSegmentBssEnd);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/idle/Idle_InitCodeAndMemory.s")
#endif
void Main_ThreadEntry(void* arg) {
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 256, "irqmgr");
@@ -109,7 +113,4 @@ void Idle_ThreadEntry(void* arg) {
osStartThread(&gMainThread);
osSetThreadPri(NULL, 0);
for (;;) {
;
}
}
do { } while (true); }
+7
View File
@@ -0,0 +1,7 @@
#include "global.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;
+22 -11
View File
@@ -2,6 +2,13 @@
u32 sDmaMgrDmaBuffSize = 0x2000;
StackEntry sDmaMgrStackInfo;
u16 numDmaEntries;
OSMesgQueue sDmaMgrMsgQueue;
OSMesg sDmaMgrMsgs[32];
OSThread sDmaMgrThread;
u8 sDmaMgrStack[0x500];
s32 DmaMgr_DMARomToRam(u32 rom, void* ram, u32 size) {
OSIoMesg ioMsg;
OSMesgQueue queue;
@@ -202,30 +209,34 @@ s32 DmaMgr_SendRequest0(void* vramStart, u32 vromStart, u32 size) {
return 0;
}
#ifdef NON_MATCHING
// TODO missing a useless move initializing v0, and some reorderings
void DmaMgr_Start() {
void DmaMgr_Start(void) {
DmaEntry* iter;
u32 idx;
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, dmadata, (u32)(_dmadataSegmentRomEnd - _dmadataSegmentRomStart));
DmaMgr_DMARomToRam((u32)_dmadataSegmentRomStart, (u32)dmadata,
(u32)_dmadataSegmentRomEnd - (u32)_dmadataSegmentRomStart);
for (iter = dmadata, idx = 0; iter->vromEnd != 0; iter++, idx++) {
;
dummy_label:;
iter = dmadata;
idx = 0;
while (iter->vromEnd != 0) {
iter++;
idx++;
}
numDmaEntries = idx;
dummy_label_2:;
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 256, dmamgrThreadName);
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 0x100, "dmamgr");
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack),
Z_PRIORITY_DMAMGR);
osStartThread(&sDmaMgrThread);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/z_std_dma/DmaMgr_Start.s")
#endif
void DmaMgr_Stop() {
void DmaMgr_Stop(void) {
osSendMesg(&sDmaMgrMsgQueue, NULL, OS_MESG_BLOCK);
}
+8 -8
View File
@@ -169,7 +169,7 @@ void LifeMeter_UpdateColors(GlobalContext* globalCtx) {
s32 LifeMeter_SaveInterfaceHealth(GlobalContext* globalCtx) {
gSaveContext.health = globalCtx->interfaceCtx.health;
return 1;
}
@@ -227,7 +227,7 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
OPEN_DISPS(gfxCtx);
if ((gSaveContext.health % 0x10) == 0){
if ((gSaveContext.health % 0x10) == 0) {
fullHeartCount--;
}
offsetY = 0.0f;
@@ -342,8 +342,8 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
} else if (curCombineModeSet != 3) {
curCombineModeSet = 3;
func_8012C654(gfxCtx);
gDPSetCombineLERP(OVERLAY_DISP++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE,
0, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
gDPSetCombineLERP(OVERLAY_DISP++, ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0,
ENVIRONMENT, PRIMITIVE, TEXEL0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0);
}
posY = 26.0f + offsetY;
posX = 30.0f + offsetX;
@@ -353,11 +353,11 @@ void LifeMeter_Draw(GlobalContext* globalCtx) {
halfTexSize = 8.0f;
halfTexSize *= 0.68f;
gSPTextureRectangle(OVERLAY_DISP++, (s32)((posX - halfTexSize) * 4), (s32)((posY - halfTexSize) * 4),
(s32)((posX + halfTexSize) * 4), (s32)((posY + halfTexSize) * 4), G_TX_RENDERTILE,
0, 0, (s32) temp_f4, (s32) temp_f4);
(s32)((posX + halfTexSize) * 4), (s32)((posY + halfTexSize) * 4), G_TX_RENDERTILE, 0, 0,
(s32)temp_f4, (s32)temp_f4);
} else {
Mtx* mtx;
if ((ddCount < 0) || (ddCount < i)) {
if (curCombineModeSet != 2) {
curCombineModeSet = 2;
@@ -401,7 +401,7 @@ void LifeMeter_UpdateSizeAndBeep(GlobalContext* globalCtx) {
interfaceCtx->lifeSizeChangeDirection = 0;
if (func_801233E4(globalCtx) == 0 && (globalCtx->pauseCtx.state == 0) &&
(globalCtx->pauseCtx.debugState == 0) && LifeMeter_IsCritical() && func_801690CC(globalCtx) == 0) {
//func_801233E4 and func_801690CC : Check if in Cutscene
// func_801233E4 and func_801690CC : Check if in Cutscene
play_sound(NA_SE_SY_HITPOINT_ALARM);
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
#include "math.h"
static s16 sintable[1024] = {
static s16 sintable[0x400] = {
0x0000, 0x0032, 0x0064, 0x0096, 0x00C9, 0x00FB, 0x012D, 0x0160, 0x0192, 0x01C4, 0x01F7, 0x0229, 0x025B, 0x028E,
0x02C0, 0x02F2, 0x0324, 0x0357, 0x0389, 0x03BB, 0x03EE, 0x0420, 0x0452, 0x0484, 0x04B7, 0x04E9, 0x051B, 0x054E,
0x0580, 0x05B2, 0x05E4, 0x0617, 0x0649, 0x067B, 0x06AD, 0x06E0, 0x0712, 0x0744, 0x0776, 0x07A9, 0x07DB, 0x080D,
+1 -1
View File
@@ -6,4 +6,4 @@
f32 sqrtf(f32 f) {
return __builtin_sqrtf(f);
}
}
+8
View File
@@ -2,6 +2,14 @@
UNK_TYPE4 D_80097E40 = 0;
OSPifRam __osContPifRam;
u8 __osContLastCmd;
u8 __osMaxControllers;
OSTimer __osEepromTimer;
OSMesgQueue D_8009CF38;
OSMesg D_8009CF50[1];
s32 osContInit(OSMesgQueue* mq, u8* bitpattern, OSContStatus* data) {
OSMesg dummy;
s32 ret = 0;
+5 -2
View File
@@ -2,6 +2,9 @@
UNK_TYPE4 __osPiAccessQueueEnabled = 0;
OSMesg D_8009E3F0[1];
OSMesgQueue __osPiAccessQueue;
void __osPiCreateAccessQueue(void) {
__osPiAccessQueueEnabled = 1;
osCreateMesgQueue(&__osPiAccessQueue, D_8009E3F0, 1);
@@ -13,9 +16,9 @@ void __osPiGetAccess(void) {
if (!__osPiAccessQueueEnabled) {
__osPiCreateAccessQueue();
}
osRecvMesg(&__osPiAccessQueue, &dummyMesg, 1);
osRecvMesg(&__osPiAccessQueue, &dummyMesg, OS_MESG_BLOCK);
}
void __osPiRelAccess(void) {
osSendMesg(&__osPiAccessQueue, NULL, 0);
osSendMesg(&__osPiAccessQueue, NULL, OS_MESG_NOBLOCK);
}
+8 -1
View File
@@ -1,5 +1,12 @@
#include "global.h"
OSPiHandle D_8009D130;
OSPiHandle D_8009D1A8;
OSThread D_8009D220;
u8 piManagerStack[0x1000];
OSMesgQueue D_8009E3D0;
OSMesg D_8009E3E8[1];
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt) {
u32 savedMask;
OSPri oldPri;
@@ -26,7 +33,7 @@ void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgC
__osPiDevMgr.acsQueue = &__osPiAccessQueue;
__osPiDevMgr.piDmaCallback = osPiRawStartDma;
__osPiDevMgr.epiDmaCallback = osEPiRawStartDma;
osCreateThread(&D_8009D220, 0, __osDevMgrMain, (void*)&__osPiDevMgr, &piManagerStack[4096], pri);
osCreateThread(&D_8009D220, 0, __osDevMgrMain, &__osPiDevMgr, &piManagerStack[0x1000], pri);
osStartThread(&D_8009D220);
__osRestoreInt(savedMask);
if (oldPri != -1) {
+3
View File
@@ -2,6 +2,9 @@
u32 __osSiAccessQueueEnabled = 0;
OSMesg siAccessBuf[1];
OSMesgQueue __osSiAccessQueue;
void __osSiCreateAccessQueue() {
__osSiAccessQueueEnabled = 1;
osCreateMesgQueue(&__osSiAccessQueue, siAccessBuf, 1);
+1 -1
View File
@@ -1,6 +1,6 @@
#include "global.h"
s32 __osSpRawStartDma(s32 direction, u32 devAddr, void* dramAddr, u32 size) {
s32 __osSpRawStartDma(s32 direction, void* devAddr, void* dramAddr, u32 size) {
if (__osSpDeviceBusy() != 0) {
return -1;
}
+30 -41
View File
@@ -1,63 +1,53 @@
#include "global.h"
OSTask* _VirtualToPhysicalTask(OSTask* intp) {
OSTask* tp = &tmp_task;
bcopy((void*)intp, (void*)tp, sizeof(OSTask));
if (tp->t.ucode) {
tp->t.ucode = (u64*)osVirtualToPhysical(tp->t.ucode);
}
if (tp->t.ucode_data) {
tp->t.ucode_data = (u64*)osVirtualToPhysical(tp->t.ucode_data);
}
if (tp->t.dram_stack) {
tp->t.dram_stack = (u64*)osVirtualToPhysical(tp->t.dram_stack);
}
if (tp->t.output_buff) {
tp->t.output_buff = (u64*)osVirtualToPhysical(tp->t.output_buff);
}
if (tp->t.output_buff_size) {
tp->t.output_buff_size = (u64*)osVirtualToPhysical(tp->t.output_buff_size);
}
if (tp->t.data_ptr) {
tp->t.data_ptr = (u64*)osVirtualToPhysical(tp->t.data_ptr);
}
if (tp->t.yield_data_ptr) {
tp->t.yield_data_ptr = (u64*)osVirtualToPhysical(tp->t.yield_data_ptr);
#define _osVirtualToPhysical(ptr) \
if (ptr != NULL) { \
ptr = (void*)osVirtualToPhysical(ptr); \
}
return &tmp_task;
static OSTask sTmpTask;
OSTask* _VirtualToPhysicalTask(OSTask* intp) {
OSTask* tp = &sTmpTask;
bcopy(intp, tp, sizeof(OSTask));
_osVirtualToPhysical(tp->t.ucode);
_osVirtualToPhysical(tp->t.ucode_data);
_osVirtualToPhysical(tp->t.dram_stack);
_osVirtualToPhysical(tp->t.output_buff);
_osVirtualToPhysical(tp->t.output_buff_size);
_osVirtualToPhysical(tp->t.data_ptr);
_osVirtualToPhysical(tp->t.yield_data_ptr);
return tp;
}
void osSpTaskLoad(OSTask* intp) {
OSTask* tp;
OSTask* tp = _VirtualToPhysicalTask(intp);
tp = _VirtualToPhysicalTask(intp);
if ((tp->t.flags & 0x1) != 0) {
if (tp->t.flags & OS_TASK_YIELDED) {
tp->t.ucode_data = tp->t.yield_data_ptr;
tp->t.ucode_data_size = tp->t.yield_data_size;
intp->t.flags &= ~OS_TASK_YIELDED;
intp->t.flags = intp->t.flags & 0xFFFFFFFE;
if ((tp->t.flags & 0x4) != 0) {
tp->t.ucode = *(u64**)(((u32)intp->t.yield_data_ptr + 3068) | 0xA0000000);
if (tp->t.flags & OS_TASK_LOADABLE) {
tp->t.ucode = HW_REG((u32)intp->t.yield_data_ptr + OS_YIELD_DATA_SIZE - 4, u32);
}
}
osWritebackDCache(tp, sizeof(OSTask));
__osSpSetStatus(SP_CLR_SIG0 | SP_CLR_SIG1 | SP_CLR_SIG2 | SP_SET_INTR_BREAK);
osWritebackDCache((void*)tp, sizeof(OSTask));
__osSpSetStatus(11008);
while (__osSpSetPc(0x04001000) == -1) {
while (__osSpSetPc((void*)SP_IMEM_START) == -1) {
;
}
while (__osSpRawStartDma(1, 0x04000FC0, (void*)tp, sizeof(OSTask)) == -1) {
while (__osSpRawStartDma(1, (void*)(SP_IMEM_START - sizeof(*tp)), tp, sizeof(OSTask)) == -1) {
;
}
while (__osSpDeviceBusy()) {
;
}
while (__osSpRawStartDma(1, 0x04001000, (void*)tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
while (__osSpRawStartDma(1, (void*)SP_IMEM_START, tp->t.ucode_boot, tp->t.ucode_boot_size) == -1) {
;
}
}
@@ -66,6 +56,5 @@ void osSpTaskStartGo(OSTask* tp) {
while (__osSpDeviceBusy()) {
;
}
__osSpSetStatus(293);
__osSpSetStatus(SP_SET_INTR_BREAK | SP_CLR_SSTEP | SP_CLR_BROKE | SP_CLR_HALT);
}
+45 -44
View File
@@ -1,32 +1,35 @@
#include "global.h"
u64 osClockRate = 0x0000000003B9ACA0;
s32 osViClock = 0x02E6D354;
#define COLD_RESET 0
typedef struct {
/* 0x0 */ u32 ins_00; // lui k0, 0x8000
/* 0x4 */ u32 ins_04; // addiu k0, k0, 0x39e0
/* 0x8 */ u32 ins_08; // jr k0 ; __osException
/* 0xC */ u32 ins_0C; // nop
} struct_exceptionPreamble;
u64 osClockRate = OS_CLOCK_RATE;
s32 osViClock = VI_NTSC_CLOCK;
UNK_TYPE4 __osShutdown = 0;
UNK_TYPE4 __OSGlobalIntMask = 0x003FFF01;
#ifdef NON_MATCHING
UNK_TYPE4 D_8009CF70;
void __createSpeedParam(void) {
D_8009D130.type = 7;
D_8009D130.latency = *(u32*)0xA4600014;
D_8009D130.pageSize = *(u32*)0xA4600018;
D_8009D130.relDuration = *(u32*)0xA460001C;
D_8009D130.pulse = *(u32*)0xA4600020;
D_8009D1A8.type = 7;
D_8009D1A8.latency = *(u32*)0xA4600024;
D_8009D1A8.pageSize = *(u32*)0xA4600028;
D_8009D1A8.relDuration = *(u32*)0xA460002C;
D_8009D1A8.pulse = *(u32*)0xA4600030;
D_8009D130.type = DEVICE_TYPE_INIT;
D_8009D130.latency = HW_REG(PI_BSD_DOM1_LAT_REG, u32);
D_8009D130.pulse = HW_REG(PI_BSD_DOM1_PWD_REG, u32);
D_8009D130.pageSize = HW_REG(PI_BSD_DOM1_PGS_REG, u32);
D_8009D130.relDuration = HW_REG(PI_BSD_DOM1_RLS_REG, u32);
D_8009D1A8.type = DEVICE_TYPE_INIT;
D_8009D1A8.latency = HW_REG(PI_BSD_DOM2_LAT_REG, u32);
D_8009D1A8.pulse = HW_REG(PI_BSD_DOM2_PWD_REG, u32);
D_8009D1A8.pageSize = HW_REG(PI_BSD_DOM2_PGS_REG, u32);
D_8009D1A8.relDuration = HW_REG(PI_BSD_DOM2_RLS_REG, u32);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/initialize/__createSpeedParam.s")
#endif
#ifdef NON_MATCHING
u64 D_80097E50; // this has to be defined in this file for func_8008A6FC to match
// TODO regalloc is messed up here
// TODO When asm-processor supports -O1, use it here
void osInitialize(void) {
u32 pifdata;
@@ -36,50 +39,48 @@ void osInitialize(void) {
__osSetFpcCsr(0x01000800);
__osSetWatchLo(0x04900000);
while (__osSiRawReadIo(0x1FC007FC, &pifdata) != 0) {
while (__osSiRawReadIo(0x1FC007FC, &pifdata)) {
;
}
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8) != 0) {
while (__osSiRawWriteIo(0x1FC007FC, pifdata | 8)) {
;
}
*(__osExceptionVector*)0x80000000 = *((__osExceptionVector*)__osExceptionPreamble);
*(__osExceptionVector*)0x80000080 = *((__osExceptionVector*)__osExceptionPreamble);
*(__osExceptionVector*)0x80000100 = *((__osExceptionVector*)__osExceptionPreamble);
*(__osExceptionVector*)0x80000180 = *((__osExceptionVector*)__osExceptionPreamble);
*(struct_exceptionPreamble*)0x80000000 = *((struct_exceptionPreamble*)__osExceptionPreamble);
*(struct_exceptionPreamble*)0x80000080 = *((struct_exceptionPreamble*)__osExceptionPreamble);
*(struct_exceptionPreamble*)0x80000100 = *((struct_exceptionPreamble*)__osExceptionPreamble);
*(struct_exceptionPreamble*)0x80000180 = *((struct_exceptionPreamble*)__osExceptionPreamble);
osWritebackDCache((void*)0x80000000, 400);
osInvalICache((void*)0x80000000, 400);
osWritebackDCache(0x80000000, 400);
osInvalICache(0x80000000, 400);
__createSpeedParam();
osUnmapTLBAll();
osMapTLBRdb();
D_80097E50 = (D_80097E50 * 3) / 4;
if (osResetType == 0) {
bzero((u8*)&osAppNmiBuffer, 64);
osClockRate = (u64)((osClockRate * 3ll) / 4ull);
if (osResetType == COLD_RESET) {
bzero(osAppNmiBuffer, 64);
}
if (osTvType == 0) {
osViClock = 0x02F5B2D2;
} else if (osTvType == 2) {
osViClock = 0x02E6025C;
if (osTvType == OS_TV_PAL) {
osViClock = VI_PAL_CLOCK;
} else if (osTvType == OS_TV_MPAL) {
osViClock = VI_MPAL_CLOCK;
} else {
osViClock = 0x02E6D354;
osViClock = VI_NTSC_CLOCK;
}
if ((__osGetCause() & 0x1000) != 0) {
if (__osGetCause() & 0x1000) {
while (1) {
;
}
}
*(u32*)0xA4500008 = 1;
*(u32*)0xA4500010 = 16383;
*(u32*)0xA4500014 = 15;
HW_REG(AI_CONTROL_REG, u32) = 1;
HW_REG(AI_DACRATE_REG, u32) = 0x3FFF;
HW_REG(AI_BITRATE_REG, u32) = 0xF;
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/boot/initialize/osInitialize.s")
#endif
void __osInitialize_autodetect(void) {
}
+2
View File
@@ -2,6 +2,8 @@
UNK_TYPE4 D_80097F10 = 0;
__OSEventState __osEventStateTab[16];
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg m) {
register u32 saveMask;
__OSEventState* es;
+3
View File
@@ -0,0 +1,3 @@
#include "global.h"
OSThread __osThreadSave;
@@ -308,9 +308,7 @@ s32 func_80943E18(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
}
void func_80943E60(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s* rot, Actor* thisx) {
static Gfx* D_809440D4[] = {
D_060070C0, D_06006FB0, D_06006E80, D_06006D70,
};
static Gfx* D_809440D4[] = { D_060070C0, D_06006FB0, D_06006E80, D_06006D70 };
EnDaiku* this = THIS;
OPEN_DISPS(globalCtx->state.gfxCtx);
+1 -1
View File
@@ -1,7 +1,7 @@
/*
* File: z_en_dnb.c
* Overlay: ovl_En_Dnb
* Description:
* Description:
*/
#include "z_en_dnb.h"
+2 -4
View File
@@ -623,8 +623,7 @@ void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) {
break;
case 0x3358:
if ((gSaveContext.playerForm != PLAYER_FORM_HUMAN) ||
!(CHECK_QUEST_ITEM(14))) {
if ((gSaveContext.playerForm != PLAYER_FORM_HUMAN) || !(CHECK_QUEST_ITEM(14))) {
func_801518B0(globalCtx, 0x335C, &this->actor);
this->textId = 0x335C;
func_80151BB4(globalCtx, 5);
@@ -663,8 +662,7 @@ void EnMa4_DialogueHandler(EnMa4* this, GlobalContext* globalCtx) {
case 6: // End conversation
if (func_80147624(globalCtx) != 0) {
if ((globalCtx->msgCtx.unk120B1 == 0) ||
!CHECK_QUEST_ITEM(18)) {
if ((globalCtx->msgCtx.unk120B1 == 0) || !CHECK_QUEST_ITEM(18)) {
EnMa4_SetupWait(this);
}
}