From 8ac295a0da5d4cc6a7cdea4366d0017549bf2ed1 Mon Sep 17 00:00:00 2001 From: Ryan Myers Date: Fri, 8 Oct 2021 14:09:33 -0400 Subject: [PATCH] Removed duiplicated OSSched as I figured out how to make it work --- lib/src/mips1/sc/sched.c | 12 ++++------- lib/src/mips1/sc/sched.h | 43 +++++++++++----------------------------- 2 files changed, 16 insertions(+), 39 deletions(-) diff --git a/lib/src/mips1/sc/sched.c b/lib/src/mips1/sc/sched.c index 8e28951f..167c8c4d 100644 --- a/lib/src/mips1/sc/sched.c +++ b/lib/src/mips1/sc/sched.c @@ -76,13 +76,12 @@ void osCreateScheduler(OSSched *sc, void *stack, OSPri priority, u8 mode, u8 num sc->curRSPTask = 0; sc->curRDPTask = 0; sc->clientList = 0; - sc->audioListHead = 0; sc->gfxListHead = 0; sc->audioListTail = 0; sc->gfxListTail = 0; - sc->doAudio = 0; sc->frameCount = 0; + sc->unkTask = 0; sc->retraceMsg.type = OS_SC_RETRACE_MSG; /* sent to apps */ sc->prenmiMsg.type = OS_SC_PRE_NMI_MSG; @@ -92,17 +91,14 @@ void osCreateScheduler(OSSched *sc, void *stack, OSPri priority, u8 mode, u8 num osCreateViManager(OS_PRIORITY_VIMGR); osViSetMode(&osViModeTable[mode]); osViBlack(TRUE); - osCreateMesgQueue(&sc->interruptQ, sc->intBuf, OS_SC_MAX_MESGS); osCreateMesgQueue(&sc->cmdQ, sc->cmdMsgBuf, OS_SC_MAX_MESGS); - osSetEventMesg(OS_EVENT_SP, &sc->interruptQ, (OSMesg)RSP_DONE_MSG); osSetEventMesg(OS_EVENT_DP, &sc->interruptQ, (OSMesg)RDP_DONE_MSG); osSetEventMesg(OS_EVENT_PRENMI, &sc->interruptQ, (OSMesg)PRE_NMI_MSG); osViSetEvent(&sc->interruptQ, (OSMesg)VIDEO_MSG, numFields); - osCreateThread(&sc->thread, 5, __scMain, (void *)sc, stack, priority); osStartThread(&sc->thread); } @@ -160,7 +156,7 @@ void func_80079584(f32 *arg0, f32 *arg1, f32 *arg2) { GLOBAL_ASM("lib/asm/non_matchings/sched/__scMain.s") -void func_80079760(OSSched_Rare *sc) { +void func_80079760(OSSched *sc) { s32 state; OSScTask *sp = 0; OSScTask *dp = 0; @@ -183,8 +179,8 @@ void dummy_80079808() { void dummy_80079810() { } -#if 0 -void __scHandleRetrace(OSSched_Rare *sc) { +#ifdef NON_MATCHING +void __scHandleRetrace(OSSched *sc) { OSScTask *rspTask = NULL; OSScClient *client; s32 i; diff --git a/lib/src/mips1/sc/sched.h b/lib/src/mips1/sc/sched.h index b7b4d43c..81df82b4 100644 --- a/lib/src/mips1/sc/sched.h +++ b/lib/src/mips1/sc/sched.h @@ -7,6 +7,7 @@ #define OS_SC_RETRACE_MSG 1 #define OS_SC_PRE_NMI_MSG 4 +#define OS_SC_AUDIO_MSG 5 #define OS_SC_MAX_MESGS 8 /* @@ -29,15 +30,15 @@ /* * OSScTask flags: */ -#define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */ -#define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */ +#define OS_SC_NEEDS_RDP 0x0001 /* uses the RDP */ +#define OS_SC_NEEDS_RSP 0x0002 /* uses the RSP */ #define OS_SC_DRAM_DLIST 0x0004 /* SP & DP communicate through DRAM */ -#define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */ -#define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */ -#define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */ +#define OS_SC_PARALLEL_TASK 0x0010 /* must be first gfx task on list */ +#define OS_SC_LAST_TASK 0x0020 /* last task in queue for frame */ +#define OS_SC_SWAPBUFFER 0x0040 /* swapbuffers when gfx task done */ -#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */ -#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */ +#define OS_SC_RCP_MASK 0x0003 /* mask for needs bits */ +#define OS_SC_TYPE_MASK 0x0007 /* complete type mask */ typedef struct { short type; @@ -47,8 +48,8 @@ typedef struct { typedef struct OSScTask_s { struct OSScTask_s *next; /* note: this must be first */ u32 state; - u32 flags; - void *framebuffer; /* used by graphics tasks */ + u32 flags; + void *framebuffer; /* used by graphics tasks */ OSTask list; OSMesgQueue *msgQ; @@ -68,26 +69,6 @@ typedef struct SCClient_s { OSMesgQueue *msgQ; /* where to send the frame msg */ } OSScClient; -/* 0x71C bytes */ -typedef struct { - /* 0x00 */ OSScMsg retraceMsg; - /* 0x20 */ OSScMsg prenmiMsg; - /* 0x40 */ OSMesgQueue interruptQ; - /* 0x68 */ OSMesg intBuf[OS_SC_MAX_MESGS]; //0x8 per OsMesg - /* 0xA8 */ OSMesgQueue cmdQ; - /* 0xD0 */ OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; //0x8 per OsMesg - /* 0x110 */ OSThread thread; - /* 0x2D8 */ OSScClient *clientList; - /* 0x2F0 */ OSScTask *audioListHead; - /* 0x3A0 */ OSScTask *gfxListHead; - /* 0x450 */ OSScTask *audioListTail; - /* 0x500 */ OSScTask *gfxListTail; - /* 0x5B0 */ OSScTask *curRSPTask; - /* 0x660 */ OSScTask *curRDPTask; - /* 0x710 */ u32 frameCount; - /* 0x714 */ s32 doAudio; -} OSSched; - /* 0x7C8 bytes */ typedef struct { /* 0x00 */ OSScMsg retraceMsg; @@ -107,7 +88,7 @@ typedef struct { /* 0x710 */ OSScTask *unkTask; //Rare added? /* 0x7C0 */ u32 frameCount; /* 0x7C4 */ s32 doAudio; -} OSSched_Rare; +} OSSched; typedef struct{ u8 pad00[0x50]; @@ -126,7 +107,7 @@ void osScRemoveClient(OSSched *sc, OSScClient *c); OSMesgQueue *osScGetCmdQ(OSSched *sc); OSMesgQueue *osScGetInterruptQ(OSSched *sc); void func_80079584(f32 *arg0, f32 *arg1, f32 *arg2); -void func_80079760(OSSched_Rare *sc); +void func_80079760(OSSched *sc); void __scHandleRDP(OSSched *sc); OSScTask *__scTaskReady(OSScTask *t); s32 __scTaskComplete(OSSched *sc, OSScTask *t);