diff --git a/asm/non_matchings/thread0_epc/func_800B71B0.s b/asm/non_matchings/thread0_epc/func_800B71B0.s index 829a5055..24eb430f 100644 --- a/asm/non_matchings/thread0_epc/func_800B71B0.s +++ b/asm/non_matchings/thread0_epc/func_800B71B0.s @@ -1,7 +1,7 @@ glabel func_800B71B0 /* 0B7DB0 800B71B0 27BDF7B8 */ addiu $sp, $sp, -0x848 /* 0B7DB4 800B71B4 AFBF001C */ sw $ra, 0x1c($sp) -/* 0B7DB8 800B71B8 0C03491C */ jal func_800D2470 +/* 0B7DB8 800B71B8 0C03491C */ jal __osGetActiveQueue /* 0B7DBC 800B71BC 00000000 */ nop /* 0B7DC0 800B71C0 8C4E0004 */ lw $t6, 4($v0) /* 0B7DC4 800B71C4 2404FFFF */ li $a0, -1 diff --git a/lib/asm/non_matchings/unknown_0D3020/func_800D2470.s b/lib/asm/non_matchings/unknown_0D3020/func_800D2470.s index 9d7193e6..278ce499 100644 --- a/lib/asm/non_matchings/unknown_0D3020/func_800D2470.s +++ b/lib/asm/non_matchings/unknown_0D3020/func_800D2470.s @@ -1,4 +1,4 @@ -glabel func_800D2470 +glabel __osGetActiveQueue /* 0D3070 800D2470 3C02800E */ lui $v0, %hi(__osActiveQueue) # $v0, 0x800e /* 0D3074 800D2474 03E00008 */ jr $ra /* 0D3078 800D2478 8C42488C */ lw $v0, %lo(__osActiveQueue)($v0) diff --git a/lib/src/unknown_0D3020.c b/lib/src/unknown_0D3020.c index ca3b3508..6ad3a205 100644 --- a/lib/src/unknown_0D3020.c +++ b/lib/src/unknown_0D3020.c @@ -5,7 +5,15 @@ #include "macros.h" #include "libultra_internal.h" +#ifdef NON_MATCHING +//Only fails because it doesn't generate a NOP after this. Maybe -01? +extern OSThread *__osActiveQueue; +OSThread *__osGetActiveQueue(void) { + return __osActiveQueue; +} +#else GLOBAL_ASM("lib/asm/non_matchings/unknown_0D3020/func_800D2470.s") +#endif #define PI_Q_BUF_LEN 1 extern u32 __osPiAccessQueueEnabled;//__osPiAccessQueueEnabled diff --git a/src/thread0_epc.c b/src/thread0_epc.c index ba6f818d..213f69db 100644 --- a/src/thread0_epc.c +++ b/src/thread0_epc.c @@ -144,27 +144,24 @@ GLOBAL_ASM("asm/non_matchings/thread0_epc/thread0.s") #endif void func_800B70D0(void) { - unk800D2470 *node = func_800D2470(); //Might be epcInfo? - while(node->unk4 != -1) { - if (node->unk4 == 0) { - node->unk118 &= 0xFFFF00FE; - node->unk118 |= 0x6C01; - return; + OSThread *node = __osGetActiveQueue(); + while(node->priority != -1) { + if (node->priority == 0) { + node->context.sr &= 0xFFFF00FE; + node->context.sr |= 0x6C01; + break; } - node = node->next; + node = node->tlnext; } } void func_800B7144(void) { - s32 temp_v0_2; - s32 phi_v0; - s32 phi_return; - unk800D2470 *node = func_800D2470(); - while (node->unk4 != -1) { - if ((node->unk4 > 0) && (node->unk4 < 0x80)) { - osStopThread(&node->thread); + OSThread *node = __osGetActiveQueue(); + while (node->priority != -1) { + if ((node->priority > 0) && (node->priority < 128)) { + osStopThread(&node->next); } - node = node->next; + node = node->tlnext; } }