mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-27 16:20:34 +00:00
parent
768ca0839b
commit
e97f10a6fa
@ -3456,10 +3456,10 @@ void func_80183070(void);
|
||||
// void func_801850A0(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7);
|
||||
// void func_801853C8(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6);
|
||||
// void func_80185460(void);
|
||||
void Slowly_Main(s8018571C* iParm1);
|
||||
void Slowly_ThreadEntry(s8018571C* param_1);
|
||||
// void Slowly_Start(s8018571C* param_1, s32* stack, UNK_TYPE4 param_3, s32 param_4, s32 param_5);
|
||||
// void func_801857A0(void);
|
||||
//void Slowly_Main(SlowlyTask* slowly);
|
||||
//void Slowly_ThreadEntry(SlowlyTask* slowly);
|
||||
void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1);
|
||||
void Slowly_Stop(SlowlyTask* slowly);
|
||||
// void func_801857C0(void);
|
||||
// char* func_801857D0(void);
|
||||
// void func_80185864(void);
|
||||
|
@ -4096,7 +4096,7 @@ extern Color_RGBA8 D_801F6D30;
|
||||
// extern UNK_TYPE1 D_801F6D50;
|
||||
extern u8 D_801F6DFC;
|
||||
// extern UNK_TYPE1 D_801F6DFD;
|
||||
extern s8018571C D_801F6E00;
|
||||
extern SlowlyTask D_801F6E00;
|
||||
// extern UNK_TYPE1 D_801F6FC0;
|
||||
extern StackEntry slowlyStackEntry;
|
||||
extern u8 slowlyStack[4096];
|
||||
|
@ -38,6 +38,19 @@
|
||||
#define SCREEN_WIDTH_HIGH_RES 576
|
||||
#define SCREEN_HEIGHT_HIGH_RES 454
|
||||
|
||||
#define Z_THREAD_ID_IDLE 1
|
||||
#define Z_THREAD_ID_SLOWLY 2
|
||||
#define Z_THREAD_ID_MAIN 3
|
||||
#define Z_THREAD_ID_DMAMGR 18
|
||||
#define Z_THREAD_ID_IRQMGR 19
|
||||
|
||||
#define Z_PRIORITY_SLOWLY 5
|
||||
#define Z_PRIORITY_GRAPH 9
|
||||
#define Z_PRIORITY_IDLE 12
|
||||
#define Z_PRIORITY_MAIN 12
|
||||
#define Z_PRIORITY_DMAMGR 17
|
||||
#define Z_PRIORITY_IRQMGR 18
|
||||
|
||||
typedef struct {
|
||||
/* 0x0 */ s16 priority; // Lower means higher priority. -1 means it ignores priority
|
||||
/* 0x2 */ s16 length;
|
||||
@ -456,16 +469,24 @@ typedef void(*osCreateThread_func)(void*);
|
||||
|
||||
typedef void*(*printf_func)(void*, char*, size_t);
|
||||
|
||||
typedef enum {
|
||||
SLOWLY_CALLBACK_NO_ARGS,
|
||||
SLOWLY_CALLBACK_ONE_ARG,
|
||||
SLOWLY_CALLBACK_TWO_ARGS
|
||||
} SlowlyCallbackArgCount;
|
||||
|
||||
typedef struct {
|
||||
/* 0x000 */ OSThread unk0;
|
||||
/* 0x1B0 */ s8 argCount;
|
||||
/* 0x1B1 */ s8 unk1B1;
|
||||
/* 0x1B2 */ UNK_TYPE1 pad1B2[0x2];
|
||||
/* 0x1B4 */ UNK_TYPE1 func;
|
||||
/* 0x1B5 */ UNK_TYPE1 pad1B5[0x3];
|
||||
/* 0x1B8 */ s32 arg0;
|
||||
/* 0x1BC */ s32 arg1;
|
||||
} s8018571C; // size = 0x1C0
|
||||
/* 0x000 */ OSThread thread;
|
||||
/* 0x1B0 */ u8 callbackArgCount;
|
||||
/* 0x1B1 */ u8 status;
|
||||
/* 0x1B4 */ union {
|
||||
void (*callback0)(void);
|
||||
void (*callback1)(void*);
|
||||
void (*callback2)(void*, void*);
|
||||
};
|
||||
/* 0x1B8 */ void* callbackArg0;
|
||||
/* 0x1BC */ void* callbackArg1;
|
||||
} SlowlyTask; // size = 0x1C0
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ int unk0;
|
||||
|
@ -438,6 +438,7 @@ SECTIONS
|
||||
build/asm/code/code_0x80182CE0.o(.text)
|
||||
build/src/code/code_0x80183070.o(.text)
|
||||
build/asm/code/code_0x801830A0.o(.text)
|
||||
build/src/code/sys_slowly.o(.text)
|
||||
build/asm/code/sys_flashrom.o(.text)
|
||||
build/asm/code/code_0x80185F90.o(.text)
|
||||
build/asm/code/code_0x801877D0.o(.text)
|
||||
|
@ -9,6 +9,6 @@ void bootproc(void) {
|
||||
osUnmapTLBAll();
|
||||
gCartHandle = osCartRomInit();
|
||||
StackCheck_Init(&sIdleThreadInfo, sIdleThreadStack, sIdleThreadStack + sizeof(sIdleThreadStack), 0, 256, "idle");
|
||||
osCreateThread(&sIdleThread, 1, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), 12);
|
||||
osCreateThread(&sIdleThread, Z_THREAD_ID_IDLE, Idle_ThreadEntry, NULL, sIdleThreadStack + sizeof(sIdleThreadStack), Z_PRIORITY_IDLE);
|
||||
osStartThread(&sIdleThread);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ void Idle_InitCodeAndMemory(void) {
|
||||
|
||||
void Main_ThreadEntry(void* arg) {
|
||||
StackCheck_Init(&sIrqMgrStackInfo, sIrqMgrStack, sIrqMgrStack + sizeof(sIrqMgrStack), 0, 256, "irqmgr");
|
||||
IrqMgr_Init(&gIrqMgr, &sIrqMgrStackInfo, 18, 1);
|
||||
IrqMgr_Init(&gIrqMgr, &sIrqMgrStackInfo, Z_PRIORITY_IRQMGR, 1);
|
||||
DmaMgr_Start();
|
||||
Idle_InitCodeAndMemory();
|
||||
main(arg);
|
||||
@ -104,7 +104,7 @@ void Idle_ThreadEntry(void* arg) {
|
||||
Idle_InitVideo();
|
||||
osCreatePiManager(150, &gPiMgrCmdQ, sPiMgrCmdBuff, ARRAY_COUNT(sPiMgrCmdBuff));
|
||||
StackCheck_Init(&sMainStackInfo, sMainStack, sMainStack + sizeof(sMainStack), 0, 1024, "main");
|
||||
osCreateThread(&gMainThread, 3, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), 12);
|
||||
osCreateThread(&gMainThread, Z_THREAD_ID_MAIN, Main_ThreadEntry, arg, sMainStack + sizeof(sMainStack), Z_PRIORITY_MAIN);
|
||||
osStartThread(&gMainThread);
|
||||
osSetThreadPri(NULL, 0);
|
||||
|
||||
|
@ -167,6 +167,6 @@ void IrqMgr_Init(IrqMgr* irqmgr, void* stack, OSPri pri, u8 retraceCount) {
|
||||
osSetEventMesg(0xE, &irqmgr->irqQueue, (OSMesg)0x29D);
|
||||
osViSetEvent(&irqmgr->irqQueue, (OSMesg)0x29A, retraceCount);
|
||||
|
||||
osCreateThread(&irqmgr->thread, 0x13, (osCreateThread_func)IrqMgr_ThreadEntry, irqmgr, stack, pri);
|
||||
osCreateThread(&irqmgr->thread, Z_THREAD_ID_IRQMGR, (osCreateThread_func)IrqMgr_ThreadEntry, irqmgr, stack, pri);
|
||||
osStartThread(&irqmgr->thread);
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ void DmaMgr_ProcessMsg(DmaRequest* req) {
|
||||
size = req->size;
|
||||
|
||||
index = DmaMgr_FindDmaIndex(vrom);
|
||||
|
||||
|
||||
if ((index >= 0) && (index < numDmaEntries)) {
|
||||
dmaEntry = &dmadata[index];
|
||||
if (dmaEntry->romEnd == 0) {
|
||||
@ -144,18 +144,18 @@ void DmaMgr_ThreadEntry(void* a0) {
|
||||
|
||||
while (1) {
|
||||
osRecvMesg(&sDmaMgrMsgQueue, &msg, OS_MESG_BLOCK);
|
||||
|
||||
|
||||
if (msg == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
req = (DmaRequest *)msg;
|
||||
|
||||
DmaMgr_ProcessMsg(req);
|
||||
if (req->notifyQueue) {
|
||||
osSendMesg(req->notifyQueue, req->notifyMsg, OS_MESG_NOBLOCK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ void DmaMgr_Start() {
|
||||
|
||||
osCreateMesgQueue(&sDmaMgrMsgQueue, sDmaMgrMsgs, ARRAY_COUNT(sDmaMgrMsgs));
|
||||
StackCheck_Init(&sDmaMgrStackInfo, sDmaMgrStack, sDmaMgrStack + sizeof(sDmaMgrStack), 0, 256, dmamgrThreadName);
|
||||
osCreateThread(&sDmaMgrThread, 18, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack), 17);
|
||||
osCreateThread(&sDmaMgrThread, Z_THREAD_ID_DMAMGR, DmaMgr_ThreadEntry, NULL, sDmaMgrStack + sizeof(sDmaMgrStack), Z_PRIORITY_DMAMGR);
|
||||
osStartThread(&sDmaMgrThread);
|
||||
}
|
||||
#else
|
||||
|
44
src/code/sys_slowly.c
Normal file
44
src/code/sys_slowly.c
Normal file
@ -0,0 +1,44 @@
|
||||
#include <ultra64.h>
|
||||
#include <global.h>
|
||||
|
||||
#define SLOWLY_STATUS_DONE (1 << 0)
|
||||
#define SLOWLY_STATUS_STARTED (1 << 1)
|
||||
|
||||
void Slowly_Main(SlowlyTask* slowly) {
|
||||
slowly->status |= SLOWLY_STATUS_STARTED;
|
||||
|
||||
switch (slowly->callbackArgCount) {
|
||||
case SLOWLY_CALLBACK_NO_ARGS:
|
||||
slowly->callback0();
|
||||
break;
|
||||
case SLOWLY_CALLBACK_ONE_ARG:
|
||||
slowly->callback1(slowly->callbackArg0);
|
||||
break;
|
||||
case SLOWLY_CALLBACK_TWO_ARGS:
|
||||
slowly->callback2(slowly->callbackArg0, slowly->callbackArg1);
|
||||
break;
|
||||
}
|
||||
|
||||
slowly->status |= SLOWLY_STATUS_DONE;
|
||||
}
|
||||
|
||||
void Slowly_ThreadEntry(SlowlyTask* slowly) {
|
||||
Slowly_Main(slowly);
|
||||
}
|
||||
|
||||
void Slowly_Start(SlowlyTask* slowly, void* stack, void (*callback)(), void* callbackArg0, void* callbackArg1) {
|
||||
bzero(slowly, sizeof(SlowlyTask));
|
||||
|
||||
slowly->callbackArgCount = SLOWLY_CALLBACK_TWO_ARGS;
|
||||
slowly->status = 0;
|
||||
slowly->callback0 = callback;
|
||||
slowly->callbackArg0 = callbackArg0;
|
||||
slowly->callbackArg1 = callbackArg1;
|
||||
|
||||
osCreateThread(&slowly->thread, Z_THREAD_ID_SLOWLY, Slowly_ThreadEntry, slowly, stack, Z_PRIORITY_SLOWLY);
|
||||
osStartThread(&slowly->thread);
|
||||
}
|
||||
|
||||
void Slowly_Stop(SlowlyTask* slowly) {
|
||||
osDestroyThread(&slowly->thread);
|
||||
}
|
@ -3455,7 +3455,7 @@
|
||||
0x80185660:("Slowly_Main",),
|
||||
0x801856FC:("Slowly_ThreadEntry",),
|
||||
0x8018571C:("Slowly_Start",),
|
||||
0x801857A0:("func_801857A0",),
|
||||
0x801857A0:("Slowly_Stop",),
|
||||
0x801857C0:("func_801857C0",),
|
||||
0x801857D0:("func_801857D0",),
|
||||
0x80185864:("func_80185864",),
|
||||
|
@ -369,6 +369,7 @@
|
||||
0x80182CE0:"",
|
||||
0x80183070:"",
|
||||
0x801830A0:"",
|
||||
0x80185660:"sys_slowly",
|
||||
0x801857C0:"sys_flashrom",
|
||||
0x80185F90:"",
|
||||
0x801877D0:"",
|
||||
|
@ -4276,7 +4276,7 @@
|
||||
0x801F6D50:("D_801F6D50","UNK_TYPE1","",0x1),
|
||||
0x801F6DFC:("D_801F6DFC","u8","",0x1),
|
||||
0x801F6DFD:("D_801F6DFD","UNK_TYPE1","",0x1),
|
||||
0x801F6E00:("D_801F6E00","s8018571C","",0x1c0),
|
||||
0x801F6E00:("D_801F6E00","SlowlyTask","",0x1c0),
|
||||
0x801F6FC0:("D_801F6FC0","UNK_TYPE1","",0x1),
|
||||
0x801F6FC8:("slowlyStackEntry","StackEntry","",0x1c),
|
||||
0x801F6FE8:("slowlyStack","u8","[4096]",0x1000),
|
||||
|
Loading…
Reference in New Issue
Block a user