From 2cafbb46df22bff183d972daf6dcbde56377ea56 Mon Sep 17 00:00:00 2001 From: Ryan Dwyer Date: Mon, 25 Jan 2021 22:14:27 +1000 Subject: [PATCH] Decompile __scYield --- src/boot/boot.c | 28 +++++++++------------------- src/include/boot/boot.h | 1 + src/include/lib/lib_490b0.h | 1 - src/lib/lib_490b0.c | 2 +- 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/boot/boot.c b/src/boot/boot.c index 9c8654470..d9bdac8f0 100644 --- a/src/boot/boot.c +++ b/src/boot/boot.c @@ -2291,25 +2291,15 @@ glabel func00002d68nb ); #endif -GLOBAL_ASM( -glabel __scYield -/* 2b70: 27bdffe8 */ addiu $sp,$sp,-24 -/* 2b74: afbf0014 */ sw $ra,0x14($sp) -/* 2b78: 8c8200c8 */ lw $v0,0xc8($a0) -/* 2b7c: 24010001 */ addiu $at,$zero,0x1 -/* 2b80: 8c4e0010 */ lw $t6,0x10($v0) -/* 2b84: 55c10006 */ bnel $t6,$at,.L00002ba0 -/* 2b88: 8fbf0014 */ lw $ra,0x14($sp) -/* 2b8c: 8c4f0004 */ lw $t7,0x4($v0) -/* 2b90: 35f80010 */ ori $t8,$t7,0x10 -/* 2b94: 0c012440 */ jal func00049100 -/* 2b98: ac580004 */ sw $t8,0x4($v0) -/* 2b9c: 8fbf0014 */ lw $ra,0x14($sp) -.L00002ba0: -/* 2ba0: 27bd0018 */ addiu $sp,$sp,0x18 -/* 2ba4: 03e00008 */ jr $ra -/* 2ba8: 00000000 */ nop -); +void __scYield(OSSched *sc) +{ + if (sc->curRSPTask->list.t.type == M_GFXTASK) { + sc->curRSPTask->state |= 0x0010; + osSpTaskYield(); + } else { + // empty + } +} GLOBAL_ASM( glabel __scSchedule diff --git a/src/include/boot/boot.h b/src/include/boot/boot.h index e868f43fd..fd2ee60f3 100644 --- a/src/include/boot/boot.h +++ b/src/include/boot/boot.h @@ -18,6 +18,7 @@ void __scHandleRetrace(OSSched *sc); void __scAppendList(OSSched *sc, OSScTask *t); void __scExec(OSSched *sc, OSScTask *sp, OSScTask *dp); void __scMain(void *arg); +void __scYield(OSSched *sc); struct bootbufferthing *func0000244c(void); void func00002400(void); void func000024e8(void); diff --git a/src/include/lib/lib_490b0.h b/src/include/lib/lib_490b0.h index 3eee795be..b3a6d8ad3 100644 --- a/src/include/lib/lib_490b0.h +++ b/src/include/lib/lib_490b0.h @@ -4,7 +4,6 @@ #include "types.h" u32 func000490b0(void); -u32 func00049100(void); u32 func00049120(void); #endif diff --git a/src/lib/lib_490b0.c b/src/lib/lib_490b0.c index 7b4f395ff..3c07e1aa9 100644 --- a/src/lib/lib_490b0.c +++ b/src/lib/lib_490b0.c @@ -36,7 +36,7 @@ glabel func000490b0 ); GLOBAL_ASM( -glabel func00049100 +glabel osSpTaskYield /* 49100: 27bdffe8 */ addiu $sp,$sp,-24 /* 49104: afbf0014 */ sw $ra,0x14($sp) /* 49108: 0c012d40 */ jal __osSpSetStatus