mirror of https://github.com/zeldaret/mm.git
`z_nmi_buff` OK, `code_8010C1B0` split and OK (#334)
* nmi_buff OK, code_8010C1B0 split and OK * COLD_RESET * spec * Fix lifemeter bss * Rename variable
This commit is contained in:
parent
f80b08450f
commit
bd9e21b165
|
@ -3353,7 +3353,7 @@ extern Arena mainHeap;
|
||||||
// extern UNK_TYPE1 D_801F5730;
|
// extern UNK_TYPE1 D_801F5730;
|
||||||
// extern UNK_TYPE1 D_801F57B4;
|
// extern UNK_TYPE1 D_801F57B4;
|
||||||
// extern UNK_TYPE1 D_801F5834;
|
// extern UNK_TYPE1 D_801F5834;
|
||||||
extern s32* gNMIBuffer;
|
// extern NmiBuff* gNMIBuffer;
|
||||||
// extern UNK_TYPE1 D_801F5850;
|
// extern UNK_TYPE1 D_801F5850;
|
||||||
// extern UNK_TYPE1 D_801F58B0;
|
// extern UNK_TYPE1 D_801F58B0;
|
||||||
// extern UNK_TYPE1 D_801F59AC;
|
// extern UNK_TYPE1 D_801F59AC;
|
||||||
|
@ -3440,7 +3440,7 @@ extern u64 lastRenderFrameTimestamp;
|
||||||
extern OSMesgQueue siEventCallbackQueue;
|
extern OSMesgQueue siEventCallbackQueue;
|
||||||
extern OSMesg siEventCallbackBuffer[1];
|
extern OSMesg siEventCallbackBuffer[1];
|
||||||
extern u32 gSegments[NUM_SEGMENTS];
|
extern u32 gSegments[NUM_SEGMENTS];
|
||||||
extern SchedContext schedContext;
|
extern SchedContext gSchedContext;
|
||||||
extern IrqMgrClient mainIrqmgrCallbackNode;
|
extern IrqMgrClient mainIrqmgrCallbackNode;
|
||||||
extern OSMesgQueue mainIrqmgrCallbackQueue;
|
extern OSMesgQueue mainIrqmgrCallbackQueue;
|
||||||
extern OSMesg mainIrqCallbackBuffer[60];
|
extern OSMesg mainIrqCallbackBuffer[60];
|
||||||
|
|
|
@ -348,6 +348,13 @@ typedef struct {
|
||||||
/* 0x14 */ u32 relocations[1];
|
/* 0x14 */ u32 relocations[1];
|
||||||
} OverlayRelocationSection; // size >= 0x18
|
} OverlayRelocationSection; // size >= 0x18
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
/* 0x00 */ u32 resetting;
|
||||||
|
/* 0x04 */ u32 resetCount;
|
||||||
|
/* 0x08 */ OSTime duration;
|
||||||
|
/* 0x10 */ OSTime resetTime;
|
||||||
|
} NmiBuff; // size >= 0x18
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
/* 0x00 */ s16 intPart[16];
|
/* 0x00 */ s16 intPart[16];
|
||||||
/* 0x20 */ u16 fracPart[16];
|
/* 0x20 */ u16 fracPart[16];
|
||||||
|
|
2
spec
2
spec
|
@ -523,7 +523,7 @@ beginseg
|
||||||
include "build/src/code/z_msgevent.o"
|
include "build/src/code/z_msgevent.o"
|
||||||
include "build/data/code/z_msgevent.data.o"
|
include "build/data/code/z_msgevent.data.o"
|
||||||
include "build/src/code/z_nmi_buff.o"
|
include "build/src/code/z_nmi_buff.o"
|
||||||
include "build/data/code/z_nmi_buff.bss.o"
|
include "build/src/code/code_8010C1B0.o"
|
||||||
include "build/src/code/z_olib.o"
|
include "build/src/code/z_olib.o"
|
||||||
pad_text
|
pad_text
|
||||||
include "build/src/code/z_parameter.o"
|
include "build/src/code/z_parameter.o"
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
#include "global.h"
|
||||||
|
|
||||||
|
// Blocks the current thread until all currently queued scheduler tasks have been completed
|
||||||
|
void func_8010C1B0(void) {
|
||||||
|
OSScTask task;
|
||||||
|
OSMesgQueue queue;
|
||||||
|
OSMesg msg;
|
||||||
|
|
||||||
|
task.next = NULL;
|
||||||
|
task.flags = OS_SC_RCP_MASK;
|
||||||
|
task.msgQ = &queue;
|
||||||
|
task.msg = NULL;
|
||||||
|
task.framebuffer = NULL;
|
||||||
|
task.list.t.type = M_NULTASK;
|
||||||
|
|
||||||
|
osCreateMesgQueue(task.msgQ, &msg, 1);
|
||||||
|
osSendMesg(&gSchedContext.cmdQ, &task, OS_MESG_BLOCK);
|
||||||
|
Sched_SendEntryMsg(&gSchedContext);
|
||||||
|
osRecvMesg(&queue, NULL, OS_MESG_BLOCK);
|
||||||
|
}
|
|
@ -1,3 +1,8 @@
|
||||||
|
/**
|
||||||
|
* 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 "global.h"
|
||||||
|
|
||||||
void Main(void* arg) {
|
void Main(void* arg) {
|
||||||
|
@ -29,18 +34,18 @@ void Main(void* arg) {
|
||||||
osCreateMesgQueue(&mainIrqmgrCallbackQueue, mainIrqCallbackBuffer, ARRAY_COUNT(mainIrqCallbackBuffer));
|
osCreateMesgQueue(&mainIrqmgrCallbackQueue, mainIrqCallbackBuffer, ARRAY_COUNT(mainIrqCallbackBuffer));
|
||||||
|
|
||||||
StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched");
|
StackCheck_Init(&schedStackEntry, schedStack, schedStack + sizeof(schedStack), 0, 0x100, "sched");
|
||||||
Sched_Init(&schedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
|
Sched_Init(&gSchedContext, schedStack + sizeof(schedStack), Z_PRIORITY_SCHED, D_8009B290, 1, &gIrqMgr);
|
||||||
|
|
||||||
CIC6105_AddRomInfoFaultPage();
|
CIC6105_AddRomInfoFaultPage();
|
||||||
|
|
||||||
IrqMgr_AddClient(&gIrqMgr, &mainIrqmgrCallbackNode, &mainIrqmgrCallbackQueue);
|
IrqMgr_AddClient(&gIrqMgr, &mainIrqmgrCallbackNode, &mainIrqmgrCallbackQueue);
|
||||||
|
|
||||||
StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio");
|
StackCheck_Init(&audioStackEntry, audioStack, audioStack + sizeof(audioStack), 0, 0x100, "audio");
|
||||||
AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &schedContext, &gIrqMgr);
|
AudioMgr_Init(&audioContext, audioStack + sizeof(audioStack), Z_PRIORITY_AUDIOMGR, 0xA, &gSchedContext, &gIrqMgr);
|
||||||
|
|
||||||
StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr");
|
StackCheck_Init(&padmgrStackEntry, padmgrStack, padmgrStack + sizeof(padmgrStack), 0, 0x100, "padmgr");
|
||||||
Padmgr_Start(&siEventCallbackQueue, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
|
Padmgr_Start(&siEventCallbackQueue, &gIrqMgr, 7, Z_PRIORITY_PADMGR, padmgrStack + sizeof(padmgrStack));
|
||||||
|
|
||||||
AudioMgr_Unlock(&audioContext);
|
AudioMgr_Unlock(&audioContext);
|
||||||
|
|
||||||
StackCheck_Init(&graphStackEntry, graphStack, graphStack + sizeof(graphStack), 0, 0x100, "graph");
|
StackCheck_Init(&graphStackEntry, graphStack, graphStack + sizeof(graphStack), 0, 0x100, "graph");
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
#include "global.h"
|
#include "global.h"
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_Init.s")
|
#define COLD_RESET 0
|
||||||
|
#define NMI 1
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_SetPrenmiStart.s")
|
NmiBuff* gNMIBuffer;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/Nmi_GetPrenmiHasStarted.s")
|
void Nmi_Init(void) {
|
||||||
|
gNMIBuffer = (NmiBuff*)osAppNmiBuffer;
|
||||||
|
gNMIBuffer->resetting = false;
|
||||||
|
|
||||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_nmi_buff/func_8010C1B0.s")
|
if (osResetType == COLD_RESET) {
|
||||||
|
gNMIBuffer->resetCount = 0;
|
||||||
|
gNMIBuffer->duration = 0;
|
||||||
|
} else {
|
||||||
|
gNMIBuffer->resetCount++;
|
||||||
|
gNMIBuffer->duration += gNMIBuffer->resetTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
gNMIBuffer->resetTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Nmi_SetPrenmiStart(void) {
|
||||||
|
gNMIBuffer->resetting = true;
|
||||||
|
gNMIBuffer->resetTime = osGetTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
u32 Nmi_GetPrenmiHasStarted(void) {
|
||||||
|
return gNMIBuffer->resetting;
|
||||||
|
}
|
||||||
|
|
|
@ -398,6 +398,7 @@
|
||||||
0x8010A000 : "z_map_exp",
|
0x8010A000 : "z_map_exp",
|
||||||
0x8010A760 : "z_msgevent",
|
0x8010A760 : "z_msgevent",
|
||||||
0x8010C0C0 : "z_nmi_buff",
|
0x8010C0C0 : "z_nmi_buff",
|
||||||
|
0x8010C1B0 : "code_8010C1B0",
|
||||||
0x8010C230 : "z_olib",
|
0x8010C230 : "z_olib",
|
||||||
0x8010CB70 : "[PADDING]",
|
0x8010CB70 : "[PADDING]",
|
||||||
0x8010CB80 : "z_parameter",
|
0x8010CB80 : "z_parameter",
|
||||||
|
|
|
@ -4189,7 +4189,7 @@
|
||||||
0x801F8160:("siEventCallbackQueue","OSMesgQueue","",0x18),
|
0x801F8160:("siEventCallbackQueue","OSMesgQueue","",0x18),
|
||||||
0x801F8178:("siEventCallbackBuffer","OSMesg","[1]",0x4),
|
0x801F8178:("siEventCallbackBuffer","OSMesg","[1]",0x4),
|
||||||
0x801F8180:("gSegments","u32","[16]",0x40),
|
0x801F8180:("gSegments","u32","[16]",0x40),
|
||||||
0x801F81C0:("schedContext","SchedContext","",0x338),
|
0x801F81C0:("gSchedContext","SchedContext","",0x338),
|
||||||
0x801F84F8:("mainIrqmgrCallbackNode","IrqMgrClient","",0x8),
|
0x801F84F8:("mainIrqmgrCallbackNode","IrqMgrClient","",0x8),
|
||||||
0x801F8500:("mainIrqmgrCallbackQueue","OSMesgQueue","",0x18),
|
0x801F8500:("mainIrqmgrCallbackQueue","OSMesgQueue","",0x18),
|
||||||
0x801F8518:("mainIrqCallbackBuffer","OSMesg","[60]",0xf0),
|
0x801F8518:("mainIrqCallbackBuffer","OSMesg","[60]",0xf0),
|
||||||
|
|
Loading…
Reference in New Issue