mirror of
https://github.com/modmii/SysCheck-ModMii-Edition.git
synced 2024-11-16 21:29:23 +01:00
46 lines
1.1 KiB
C
46 lines
1.1 KiB
C
|
#include <stdlib.h>
|
||
|
#include <ogc/lwp_watchdog.h>
|
||
|
#include <ogc/lwp.h>
|
||
|
|
||
|
#include "thread.h"
|
||
|
#include "gui.h"
|
||
|
|
||
|
#define STACKSIZE (1024 * 64) // 64KB
|
||
|
#define PRIORITY 50 // Medium-ish
|
||
|
|
||
|
lwp_t Cog_Thread;
|
||
|
u8 stack[STACKSIZE] ATTRIBUTE_ALIGN (32);
|
||
|
vu8 done = 0;
|
||
|
|
||
|
void * DrawCogThread(void *arg) {
|
||
|
while(!done) {
|
||
|
GRRLIB_DrawImg(0, 0, tex_ScreenBuf, 0, 1, 1, HEX_WHITE);
|
||
|
if (CheckTime(Last_Cog_Turn, 25)) {
|
||
|
Cog_Num++;
|
||
|
if (Cog_Num > 4) Cog_Num = 0;
|
||
|
Last_Cog_Turn = gettick();
|
||
|
}
|
||
|
GRRLIB_DrawImg(220, 150, tex_Cogs_png[Cog_Num], 0, 1, 1, HEX_WHITE);
|
||
|
GRRLIB_Render();
|
||
|
}
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
inline void InitThread(void) {
|
||
|
memset (&stack, 0, STACKSIZE);
|
||
|
LWP_CreateThread (&Cog_Thread, DrawCogThread, NULL, stack, STACKSIZE, PRIORITY);
|
||
|
}
|
||
|
|
||
|
inline s32 PauseThread(void) {
|
||
|
//if(!LWP_ThreadIsSuspended(Cog_Thread)) return 0;
|
||
|
return LWP_SuspendThread(Cog_Thread);
|
||
|
}
|
||
|
|
||
|
inline s32 ResumeThread(void) {
|
||
|
//if(LWP_ThreadIsSuspended(Cog_Thread)) return 0;
|
||
|
return LWP_ResumeThread(Cog_Thread);
|
||
|
}
|
||
|
|
||
|
//inline s32 StopThread(void) {
|
||
|
// return LWP_JoinThread(Cog_Thread, NULL);
|
||
|
//}
|