Shipwright/soh/src/libultra/os/settimer.c
Baoulettes a5df9dddf0
Use Macro for __FILE__ & __LINE__ when possible (#559)
* First batch some overlay

* Almost all overlay

* effect & gamestate

* kaleido stuffs

* more overlay

* more left over from code folder

* remaining hardcoded line and file

* Open & Close _DISP __FILE__ & __LINE__ clean up

* Some if (1) {} remove

* LOG_xxxx __FILE__ , __LINE__ cleaned

* ASSERT macro __FILE__ __LINE__

* mtx without line/file in functions

* " if (1) {} " & "if (0) {}" and tab/white place

* LogUtils as macro

* GameState_, GameAlloc_, SystemArena_ & ZeldaArena_

* Revert "GameState_, GameAlloc_, SystemArena_ & ZeldaArena_"

This reverts commit 0d85caaf7e.

* Like last commit but as macro

* Fix matrix not using macros

* use function not macro

* DebugArena_* functions
GameAlloc_MallocDebug
BgCheck_PosErrorCheck as macros
removed issues with ; in macro file
2022-07-05 19:29:34 -04:00

45 lines
947 B
C

#include "global.h"
s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg) {
OSTime time;
OSTimer* next;
u32 count;
u32 value;
u32 prevInt;
timer->next = NULL;
timer->prev = NULL;
timer->interval = interval;
if (countdown != 0) {
timer->value = countdown;
} else {
timer->value = interval;
}
timer->mq = mq;
timer->msg = msg;
prevInt = __osDisableInt();
if (__osTimerList->next != __osTimerList) {
next = __osTimerList->next;
count = osGetCount();
value = count - __osTimerCounter;
if (value < next->value) {
next->value -= value;
} else {
next->value = 1;
}
}
time = __osInsertTimer(timer);
__osSetTimerIntr(__osTimerList->next->value);
__osRestoreInt(prevInt);
if (time) {} // suppresses set but unused warning
return 0;
}