diff --git a/asm/non_matchings/unknown_079F50/func_80079DE8.s b/asm/non_matchings/unknown_079F50/func_80079DE8.s deleted file mode 100644 index 852ab2f3..00000000 --- a/asm/non_matchings/unknown_079F50/func_80079DE8.s +++ /dev/null @@ -1,28 +0,0 @@ -glabel func_80079DE8 -/* 07A9E8 80079DE8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 07A9EC 80079DEC AFBF0014 */ sw $ra, 0x14($sp) -/* 07A9F0 80079DF0 1080000E */ beqz $a0, .L80079E2C -/* 07A9F4 80079DF4 AFA40020 */ sw $a0, 0x20($sp) -/* 07A9F8 80079DF8 0C03479C */ jal func_800D1E70 -/* 07A9FC 80079DFC 00000000 */ nop -/* 07AA00 80079E00 0C0347AC */ jal func_800D1EB0 -/* 07AA04 80079E04 AFA2001C */ sw $v0, 0x1c($sp) -/* 07AA08 80079E08 8FAF001C */ lw $t7, 0x1c($sp) -/* 07AA0C 80079E0C 00000000 */ nop -/* 07AA10 80079E10 104F0004 */ beq $v0, $t7, .L80079E24 -/* 07AA14 80079E14 8FA20020 */ lw $v0, 0x20($sp) -/* 07AA18 80079E18 10000005 */ b .L80079E30 -/* 07AA1C 80079E1C 00001025 */ move $v0, $zero -/* 07AA20 80079E20 8FA20020 */ lw $v0, 0x20($sp) -.L80079E24: -/* 07AA24 80079E24 10000003 */ b .L80079E34 -/* 07AA28 80079E28 8FBF0014 */ lw $ra, 0x14($sp) -.L80079E2C: -/* 07AA2C 80079E2C 00001025 */ move $v0, $zero -.L80079E30: -/* 07AA30 80079E30 8FBF0014 */ lw $ra, 0x14($sp) -.L80079E34: -/* 07AA34 80079E34 27BD0020 */ addiu $sp, $sp, 0x20 -/* 07AA38 80079E38 03E00008 */ jr $ra -/* 07AA3C 80079E3C 00000000 */ nop - diff --git a/asm/non_matchings/unknown_079F50/func_8007A0D4.s b/asm/non_matchings/unknown_079F50/func_8007A0D4.s index d76654bc..6b17f545 100644 --- a/asm/non_matchings/unknown_079F50/func_8007A0D4.s +++ b/asm/non_matchings/unknown_079F50/func_8007A0D4.s @@ -39,7 +39,7 @@ glabel func_8007A0D4 /* 07AD58 8007A158 AFA30024 */ sw $v1, 0x24($sp) /* 07AD5C 8007A15C AFA5002C */ sw $a1, 0x2c($sp) /* 07AD60 8007A160 AFA60030 */ sw $a2, 0x30($sp) -/* 07AD64 8007A164 0C01E77A */ jal func_80079DE8 +/* 07AD64 8007A164 0C01E77A */ jal __scTaskReady /* 07AD68 8007A168 AFA70034 */ sw $a3, 0x34($sp) /* 07AD6C 8007A16C 8FA30024 */ lw $v1, 0x24($sp) /* 07AD70 8007A170 8FA5002C */ lw $a1, 0x2c($sp) diff --git a/lib/asm/non_matchings/unknown_0D29F0/func_800D1E70.s b/lib/asm/non_matchings/unknown_0D29F0/osViGetCurrentFramebuffer.s similarity index 96% rename from lib/asm/non_matchings/unknown_0D29F0/func_800D1E70.s rename to lib/asm/non_matchings/unknown_0D29F0/osViGetCurrentFramebuffer.s index d8d9dfbf..c13e9882 100644 --- a/lib/asm/non_matchings/unknown_0D29F0/func_800D1E70.s +++ b/lib/asm/non_matchings/unknown_0D29F0/osViGetCurrentFramebuffer.s @@ -1,4 +1,4 @@ -glabel func_800D1E70 +glabel osViGetCurrentFramebuffer /* 0D2A70 800D1E70 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 0D2A74 800D1E74 AFBF001C */ sw $ra, 0x1c($sp) /* 0D2A78 800D1E78 0C034958 */ jal __osDisableInt diff --git a/lib/asm/non_matchings/unknown_0D29F0/func_800D1EB0.s b/lib/asm/non_matchings/unknown_0D29F0/osViGetNextFramebuffer.s similarity index 96% rename from lib/asm/non_matchings/unknown_0D29F0/func_800D1EB0.s rename to lib/asm/non_matchings/unknown_0D29F0/osViGetNextFramebuffer.s index 9cc7a953..bedaf2a2 100644 --- a/lib/asm/non_matchings/unknown_0D29F0/func_800D1EB0.s +++ b/lib/asm/non_matchings/unknown_0D29F0/osViGetNextFramebuffer.s @@ -1,4 +1,4 @@ -glabel func_800D1EB0 +glabel osViGetNextFramebuffer /* 0D2AB0 800D1EB0 27BDFFD8 */ addiu $sp, $sp, -0x28 /* 0D2AB4 800D1EB4 AFBF001C */ sw $ra, 0x1c($sp) /* 0D2AB8 800D1EB8 0C034958 */ jal __osDisableInt diff --git a/lib/src/unknown_0D29F0.c b/lib/src/unknown_0D29F0.c index 750a4cfc..e30fe1b8 100644 --- a/lib/src/unknown_0D29F0.c +++ b/lib/src/unknown_0D29F0.c @@ -9,8 +9,8 @@ extern OSTime __osCurrentTime;//__osCurrentTime extern u32 __osBaseCounter; //__osBaseCounter GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1DF0.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1E70.s") -GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/func_800D1EB0.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osViGetCurrentFramebuffer.s") +GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osViGetNextFramebuffer.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/_VirtualToPhysicalTask.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osSpTaskLoad.s") GLOBAL_ASM("lib/asm/non_matchings/unknown_0D29F0/osSpTaskStartGo.s") diff --git a/src/unknown_079F50.c b/src/unknown_079F50.c index 06132bd1..7ffb41c0 100644 --- a/src/unknown_079F50.c +++ b/src/unknown_079F50.c @@ -148,9 +148,63 @@ GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079760.s") GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079818.s") GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079B44.s") GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079D5C.s") -GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079DE8.s") -GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079E40.s") +OSScTask *__scTaskReady(OSScTask *t) +{ + if (t) { + /* + * If there is a pending swap bail out til later (next + * retrace). + */ + if (osViGetCurrentFramebuffer() != osViGetNextFramebuffer()) { + return 0; + } + + return t; + } + + return 0; +} + +#if 1 +GLOBAL_ASM("asm/non_matchings/unknown_079F50/func_80079E40.s") +#else +s32 func_80079E40(OSSched *sc, OSScTask *t) +{ + int rv; + int firsttime = 1; + + if ((t->state & 0x03) == 0) { /* none of the needs bits set */ + +// assert (t->msgQ); + if(t->msgQ){ + + //rv = osSendMesg(t->msgQ, &t->msg, OS_MESG_BLOCK); + + //if (t->list.t.type == M_GFXTASK) { + if ((t->flags & 0x20) /*&& (t->flags & OS_SC_LAST_TASK)*/){ + if(sc->doAudio < 2){ + sc->frameCount = t; + } + else{ + if(t->startTime == 0){ + osSendMesg(t->msgQ, t->msg, 1); + } + } + //if (firsttime) { + // osViBlack(FALSE); + // firsttime = 0; + //} + //osViSwapBuffer(t->framebuffer); + } + //} + } + return 1; + } + + return 0; +} +#endif void __scAppendList(OSSched *sc, OSScTask *t) { @@ -168,7 +222,7 @@ void __scAppendList(OSSched *sc, OSScTask *t) sc->gfxListTail->next = t; else sc->gfxListHead = t; - + sc->gfxListTail = t; } t->next = NULL;