* WIP

* WIP

* WIP func_80078190

* Do some minor documenting and cleanup in sched.c

* Restart func_80078190 and check in the WIP

* Get func_80078190 back to something looking presentable

* WIP render_texture_rectangle_scaled

* Just about matched render_texture_rectangle_scaled

* Match render_texture_rectangle_scaled

* Minor documenting and cleanup

* Minor cleanup

* Cleanup

* Some documenting

* Match func_8006ECFC

* Move some function definitions

* Match func_8006EFDC

* Minor documentation updates

* NAme some functions, and do some documneting on fade transitons

---------

Co-authored-by: Ryan Myers <foldor@gmail.com>
This commit is contained in:
Ryan Myers
2023-02-17 10:04:49 -05:00
committed by GitHub
co-authored by Ryan Myers
parent d57f879dbd
commit 98d3be1b8f
19 changed files with 366 additions and 822 deletions
+30 -32
View File
@@ -20,18 +20,18 @@
/************ .data ************/
s32 D_800DE730[] = { 0, 0 };
s32 D_800DE730[] = { OSMESG_SWAP_BUFFER, OSMESG_SWAP_BUFFER };
s32 gBootBlackoutMesg[] = { OSMESG_SWAP_BUFFER, MESG_SKIP_BUFFER_SWAP };
f32 D_800DE740 = 0;
f32 D_800DE744 = 0;
f32 D_800DE748 = 0;
f32 D_800DE74C = 0;
f32 gAudTaskTimer0 = 0;
f32 gAudTaskTimer1 = 0;
f32 gAudTaskTimer2 = 0;
f32 gAudTaskTimer3 = 0;
u32 gRetraceCounter32 = 0;
s32 gRetraceCounter32 = 0;
s32 gCurRSPTaskCounter = 0;
s32 gCurRDPTaskCounter = 0;
static u32 gUnusedVar = 0;
UNUSED s32 D_800DE75C = 0;
u64 gRetraceCounter64 = 0;
/*******************************/
@@ -63,9 +63,9 @@ const char D_800E7958[] = "\tdata_size\t\t= %u\n";
s32 gCurRSPTaskIsSet;
s32 gCurRDPTaskIsSet;
OSTime gYieldTime;
s32 D_80126120;
u32 gRSPAudTaskCount;
s32 D_80126128[18];
u32 gRSPAudTaskFlushTime;
u32 gRSPAudTaskDoneTime;
UNUSED s32 D_80126128[18];
/*******************************/
@@ -146,10 +146,10 @@ OSMesgQueue *osScGetInterruptQ(OSSched *sc) {
return &sc->interruptQ;
}
UNUSED void func_80079584(f32 *arg0, f32 *arg1, f32 *arg2) {
*arg0 = D_800DE740;
*arg1 = D_800DE748;
*arg2 = D_800DE74C;
UNUSED void scGetAudioTaskTimers(f32 *timer0, f32 *timer1, f32 *timer2) {
*timer0 = gAudTaskTimer0;
*timer1 = gAudTaskTimer2;
*timer2 = gAudTaskTimer3;
}
static void __scMain(void *arg) {
@@ -219,8 +219,8 @@ void func_80079760(OSSched *sc) {
}
}
void dummy_80079808() {}
void dummy_80079810() {}
UNUSED void dummy_80079808() {}
UNUSED void dummy_80079810() {}
void __scHandleRetrace(OSSched *sc) {
OSScTask *rspTask = NULL;
@@ -316,31 +316,29 @@ void __scHandleRetrace(OSSched *sc) {
}
}
//Keeping this defined here because it seems too specific to this function
#define OS_CPU_COUNTER_F (f32)(OS_CPU_COUNTER / 100.0f)
void __scHandleRSP(OSSched *sc) {
OSScTask *t, *sp = 0, *dp = 0;
s32 state;
s32 temp_hi;
t = sc->curRSPTask;
sc->curRSPTask = NULL;
//Rare seems to have edited this function, most specifically here.
//Still need to do better for a match, but this does work
//This should probably have all been behind a debug #ifdef as none of these values are used.
if (t->list.t.type == M_AUDTASK) {
gRSPAudTaskCount = osGetCount();
D_800DE74C = (f32) (((f32) (gRSPAudTaskCount - D_80126120) * 60.0f) / OS_CPU_COUNTER_F);
D_800DE744 = (f32) (D_800DE744 + D_800DE74C);
if (D_800DE740 < D_800DE74C) {
D_800DE740 = D_800DE74C;
gRSPAudTaskDoneTime = osGetCount();
gAudTaskTimer3 = ((gRSPAudTaskDoneTime - gRSPAudTaskFlushTime) * 60.0f) / (OS_CPU_COUNTER / 100);
gAudTaskTimer1 += gAudTaskTimer3;
if (gAudTaskTimer0 < gAudTaskTimer3) {
gAudTaskTimer0 = gAudTaskTimer3;
}
temp_hi = (s32) gRetraceCounter32 % 1000;
if ((temp_hi == 1) || (temp_hi == 2)) {
D_800DE748 = (f32) (D_800DE744 / 500.0f);
D_800DE744 = 0.0f;
D_800DE740 = 0.0f;
if ((gRetraceCounter32 % 1000 == 1) || (gRetraceCounter32 % 1000 == 2)) {
gAudTaskTimer2 = gAudTaskTimer1 / 500.0f;
gAudTaskTimer1 = 0.0f;
gAudTaskTimer0 = 0.0f;
}
}
@@ -463,7 +461,7 @@ void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp) {
if (sp) {
if (sp->list.t.type == M_AUDTASK) {
osWritebackDCacheAll(); /* flush the cache */
D_80126120 = osGetCount();
gRSPAudTaskFlushTime = osGetCount();
}
sp->state &= ~(OS_SC_YIELD | OS_SC_YIELDED);