Match & link libultra/settimer

This commit is contained in:
Cuyler36
2025-06-19 07:45:04 -04:00
parent 9a5be63550
commit f906a552f5
2 changed files with 10 additions and 7 deletions
+1 -1
View File
@@ -420,7 +420,7 @@ config.libs = [
Object(Matching, "libultra/gu/scale.c"),
Object(Matching, "libultra/sendmesg.c"),
Object(Matching, "libultra/setthreadpri.c"),
Object(NonMatching, "libultra/settimer.c"),
Object(Matching, "libultra/settimer.c", extra_cflags=["-O0", "-opt schedule", "-opt peep"]), # no clue why this file has these flags, but they're necessary
Object(Matching, "libultra/shutdown.c"),
Object(Matching, "libultra/gu/sins.c"),
Object(Matching, "libultra/startthread.c"),
+9 -6
View File
@@ -2,15 +2,14 @@
#include <dolphin/os.h>
static void timer_handler(OSAlarm* alarm, OSContext* context);
static void timer_handler(OSAlarm* volatile alarm, OSContext* context) {
OSTimer* volatile timer = (OSTimer* volatile)alarm;
static void timer_handler(OSAlarm* alarm, OSContext* context) {
OSTimer* timer = (OSTimer*)alarm;
BOOL enabled = OSDisableInterrupts();
if ((OSTime)timer->interval != 0) {
OSSetAlarm(&timer->alarm, (OSTime)timer->interval, timer_handler);
} else {
OSTimer* next = timer->next;
timer->next->prev = timer->prev;
timer->prev->next = timer->next;
timer->next = NULL;
@@ -21,11 +20,15 @@ static void timer_handler(OSAlarm* volatile alarm, OSContext* context) {
OSRestoreInterrupts(enabled);
}
extern int osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMessageQueue* volatile mq, volatile OSMessage msg) {
extern int osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMessageQueue* mq, OSMessage msg) {
BOOL enable = OSDisableInterrupts();
OSTimer* head;
countdown = countdown == 0 ? interval : countdown;
if (countdown == 0) {
countdown = interval;
}
OSCreateAlarm(&timer->alarm);
timer->mq = (OSMessageQueue*)mq;
timer->msg = msg;