mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-06-01 01:08:51 -04:00
Match & link libultra/settimer
This commit is contained in:
+1
-1
@@ -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"),
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user