Some process work

This commit is contained in:
dbalatoni13 2025-04-03 14:01:35 +02:00
parent 6e53c813fc
commit 39549e415e
6 changed files with 18 additions and 21 deletions

1
extern/aurora vendored

@ -1 +0,0 @@
Subproject commit 6f6861215150abc4fa00197de43754525cac07a6

View file

@ -1,9 +1,12 @@
#ifndef _GAME_JMP_H #ifndef _GAME_JMP_H
#define _GAME_JMP_H #define _GAME_JMP_H
#ifdef TARGET_PC
#include <setjmp.h>
#else
#include "dolphin.h" #include "dolphin.h"
typedef struct JMPBUF { typedef struct jmp_buf {
u32 lr; u32 lr;
u32 cr; u32 cr;
u32 sp; u32 sp;
@ -11,9 +14,10 @@ typedef struct JMPBUF {
u32 pad; u32 pad;
u32 regs[19]; u32 regs[19];
double flt_regs[19]; double flt_regs[19];
} JMPBUF; } jmp_buf;
s32 gcsetjmp(JMPBUF *jump); s32 gcsetjmp(jmp_buf *jump);
s32 gclongjmp(JMPBUF *jump, s32 status); s32 gclongjmp(jmp_buf *jump, s32 status);
#endif #endif
#endif

View file

@ -3,12 +3,7 @@
#include "dolphin/types.h" #include "dolphin/types.h"
#ifdef TARGET_PC
#include <setjmp.h>
typedef int JMPBUF;
#else
#include "game/jmp.h" #include "game/jmp.h"
#endif
#define PROCESS_STAT_PAUSE 0x1 #define PROCESS_STAT_PAUSE 0x1
#define PROCESS_STAT_UPAUSE 0x2 #define PROCESS_STAT_UPAUSE 0x2
@ -28,7 +23,7 @@ typedef struct process {
u16 prio; u16 prio;
s32 sleep_time; s32 sleep_time;
u32 base_sp; u32 base_sp;
JMPBUF jump; jmp_buf jump;
void (*dtor)(void); void (*dtor)(void);
void *user_data; void *user_data;
} Process; } Process;

View file

@ -5,7 +5,6 @@
#include "game/frand.h" #include "game/frand.h"
#include "game/gamework_data.h" #include "game/gamework_data.h"
#include "game/hsfman.h" #include "game/hsfman.h"
#include "game/jmp.h"
#include "game/minigame_seq.h" #include "game/minigame_seq.h"
#include "game/window.h" #include "game/window.h"
#include "game/wipe.h" #include "game/wipe.h"

View file

@ -108,7 +108,7 @@ void main(void)
#else #else
HuSysInit(&GXPal528IntDf); HuSysInit(&GXPal528IntDf);
#endif #endif
//HuPrcInit(); HuPrcInit();
// HuPadInit(); // HuPadInit();
// GWInit(); // GWInit();
// pfInit(); // pfInit();
@ -168,10 +168,10 @@ void main(void)
HuPerfBegin(0); HuPerfBegin(0);
Hu3DPreProc(); Hu3DPreProc();
HuPadRead(); HuPadRead();
pfClsScr(); pfClsScr();*/
HuPrcCall(1); HuPrcCall(1);
MGSeqMain(); /* MGSeqMain();
HuPerfBegin(1); HuPerfBegin(1);
Hu3DExec(); Hu3DExec();
HuDvdErrorWatch(); HuDvdErrorWatch();

View file

@ -14,7 +14,7 @@
#define EXEC_CHILDWATCH 2 #define EXEC_CHILDWATCH 2
#define EXEC_KILLED 3 #define EXEC_KILLED 3
static JMPBUF processjmpbuf; static jmp_buf processjmpbuf;
static Process *processtop; static Process *processtop;
static Process *processcur; static Process *processcur;
static u16 processcnt; static u16 processcnt;
@ -142,7 +142,7 @@ void HuPrcChildWatch()
curr->exec = EXEC_CHILDWATCH; curr->exec = EXEC_CHILDWATCH;
#ifdef TARGET_PC #ifdef TARGET_PC
#else #else
if (!gcsetjmp(&curr->jump)) { if (gcsetjmp(&curr->jump) == 0) {
gclongjmp(&processjmpbuf, 1); gclongjmp(&processjmpbuf, 1);
} }
#endif #endif
@ -219,7 +219,7 @@ void HuPrcSleep(s32 time)
} }
#ifdef TARGET_PC #ifdef TARGET_PC
#else #else
if (!gcsetjmp(&process->jump)) { if (gcsetjmp(&process->jump) == 0) {
gclongjmp(&processjmpbuf, 1); gclongjmp(&processjmpbuf, 1);
} }
#endif #endif
@ -274,8 +274,8 @@ void HuPrcCall(s32 tick)
if (!process) { if (!process) {
return; return;
} }
#ifdef TARGET_PC #ifdef __MWERKS__
#else // unused
procfunc = process->jump.lr; procfunc = process->jump.lr;
#endif #endif
if ((process->stat & (PROCESS_STAT_PAUSE | PROCESS_STAT_UPAUSE)) && process->exec != EXEC_KILLED) { if ((process->stat & (PROCESS_STAT_PAUSE | PROCESS_STAT_UPAUSE)) && process->exec != EXEC_KILLED) {