From ec5f686ffba353f729d04865c633a2a0f8784e9e Mon Sep 17 00:00:00 2001 From: gamemasterplc Date: Fri, 10 May 2024 20:33:37 -0500 Subject: [PATCH] Change int to s32 --- include/REL/board_executor.h | 4 ++- include/REL/executor.h | 4 ++- include/game/data.h | 4 +-- include/game/gamework.h | 48 ++++++++++++------------- include/game/jmp.h | 4 +-- include/game/object.h | 26 +++++++------- include/game/process.h | 12 +++---- src/REL/board_executor.c | 2 +- src/REL/executor.c | 2 +- src/REL/mstory4Dll/main.c | 2 +- src/game/data.c | 46 ++++++++++++------------ src/game/decode.c | 16 ++++----- src/game/gamework.c | 70 ++++++++++++++++++------------------ src/game/init.c | 2 +- src/game/jmp.c | 4 +-- src/game/objdll.c | 6 ++-- src/game/objmain.c | 32 ++++++++--------- src/game/objsysobj.c | 2 +- src/game/process.c | 35 ++++++++---------- src/game/wipe.c | 26 +++++++------- 20 files changed, 172 insertions(+), 175 deletions(-) diff --git a/include/REL/board_executor.h b/include/REL/board_executor.h index 89450e01..47d3f448 100644 --- a/include/REL/board_executor.h +++ b/include/REL/board_executor.h @@ -5,7 +5,9 @@ extern "C" { #endif -extern int _prolog(); +#include "dolphin/types.h" + +extern s32 _prolog(); extern void _epilog(); typedef void (*VoidFunc)(void); diff --git a/include/REL/executor.h b/include/REL/executor.h index afec2f28..f6ed3f1d 100644 --- a/include/REL/executor.h +++ b/include/REL/executor.h @@ -5,7 +5,9 @@ extern "C" { #endif -extern int _prolog(); +#include "dolphin/types.h" + +extern s32 _prolog(); extern void _epilog(); typedef void (*VoidFunc)(void); diff --git a/include/game/data.h b/include/game/data.h index 889a931c..f41a3816 100644 --- a/include/game/data.h +++ b/include/game/data.h @@ -30,7 +30,7 @@ typedef struct data_read_stat { } DataReadStat; void HuDataInit(void); -int HuDataReadChk(s32 data_num); +s32 HuDataReadChk(s32 data_num); DataReadStat *HuDataGetStatus(void *dir_ptr); void *HuDataGetDirPtr(s32 data_num); DataReadStat *HuDataDirRead(s32 data_num); @@ -52,7 +52,7 @@ void HuDataDirClose(s32 data_id); void HuDataDirCloseNum(s32 num); void *HuDataReadNumHeapShortForce(s32 data_id, s32 num, HeapID heap); -void HuDecodeData(void *src, void *dst, u32 size, int decode_type); +void HuDecodeData(void *src, void *dst, u32 size, s32 decode_type); extern u32 DirDataSize; diff --git a/include/game/gamework.h b/include/game/gamework.h index 12da26f5..a4c41334 100644 --- a/include/game/gamework.h +++ b/include/game/gamework.h @@ -7,30 +7,30 @@ void GWInit(void); void GWGameStatReset(void); s32 GWMessSpeedGet(void); s32 GWMessDelayGet(void); -void GWMGRecordSet(int index, s32 value); -s32 GWMGRecordGet(int index); -void GWCharColorGet(int character, GXColor *color); -void GWBoardPlayCountSet(int board, u8 value); -void GWBoardPlayCountAdd(int board, u8 value); -u8 GWBoardPlayCountGet(int board); -void GWBoardMaxStarsSet(int board, int value); -u16 GWBoardMaxStarsGet(int board); -void GWBoardMaxCoinsSet(int board, int value); -u16 GWBoardMaxCoinsGet(int board); -int GWBoardWinCountInc(int character, int board); -int GWBoardWinCountGet(int character, int board); -void GWBoardWinCountSet(int character, int board, int value); -int GWMGAvailGet(int id); -int GWMGAvailSet(int id); -int GWMGCustomGet(int id); -int GWMGCustomSet(int id); -int GWMGCustomReset(int id); -s16 GWCoinsGet(int player); -void GWCoinsSet(int player, s16 value); -void GWCoinsAdd(int player, s16 amount); -void GWStarsSet(int player, s16 value); -void GWStarsAdd(int player, s16 amount); -s32 GWStarsGet(int player); +void GWMGRecordSet(s32 index, s32 value); +s32 GWMGRecordGet(s32 index); +void GWCharColorGet(s32 character, GXColor *color); +void GWBoardPlayCountSet(s32 board, u8 value); +void GWBoardPlayCountAdd(s32 board, u8 value); +u8 GWBoardPlayCountGet(s32 board); +void GWBoardMaxStarsSet(s32 board, s32 value); +u16 GWBoardMaxStarsGet(s32 board); +void GWBoardMaxCoinsSet(s32 board, s32 value); +u16 GWBoardMaxCoinsGet(s32 board); +s32 GWBoardWinCountInc(s32 character, s32 board); +s32 GWBoardWinCountGet(s32 character, s32 board); +void GWBoardWinCountSet(s32 character, s32 board, s32 value); +s32 GWMGAvailGet(s32 id); +s32 GWMGAvailSet(s32 id); +s32 GWMGCustomGet(s32 id); +s32 GWMGCustomSet(s32 id); +s32 GWMGCustomReset(s32 id); +s16 GWCoinsGet(s32 player); +void GWCoinsSet(s32 player, s16 value); +void GWCoinsAdd(s32 player, s16 amount); +void GWStarsSet(s32 player, s16 value); +void GWStarsAdd(s32 player, s16 amount); +s32 GWStarsGet(s32 player); void GWTotalStarsSet(s16 value); void GWTotalStarsAdd(s16 amount); u16 GWTotalStarsGet(void); diff --git a/include/game/jmp.h b/include/game/jmp.h index 5e2b8434..0aadbc43 100755 --- a/include/game/jmp.h +++ b/include/game/jmp.h @@ -13,7 +13,7 @@ typedef struct jump_buf { double flt_regs[19]; } jmp_buf; -int gcsetjmp(jmp_buf *jump); -int gclongjmp(jmp_buf *jump, int status); +s32 gcsetjmp(jmp_buf *jump); +s32 gclongjmp(jmp_buf *jump, s32 status); #endif diff --git a/include/game/object.h b/include/game/object.h index eab5424d..95061c52 100644 --- a/include/game/object.h +++ b/include/game/object.h @@ -32,8 +32,8 @@ typedef void (*omObjFunc)(struct om_obj_data *); typedef struct om_ovl_his_data { OverlayID overlay; - int event; - int stat; + s32 event; + s32 stat; } omOvlHisData; typedef struct om_obj_data { @@ -65,14 +65,14 @@ typedef struct om_dll_data { s32 ret; } omDllData; -void omMasterInit(int prio, FileListEntry *ovl_list, int ovl_count, OverlayID start_ovl); -void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat); -void omOvlGotoEx(OverlayID overlay, s16 arg2, int event, int stat); +void omMasterInit(s32 prio, FileListEntry *ovl_list, s32 ovl_count, OverlayID start_ovl); +void omOvlCallEx(OverlayID overlay, s16 arg2, s32 event, s32 stat); +void omOvlGotoEx(OverlayID overlay, s16 arg2, s32 event, s32 stat); void omOvlReturnEx(s16 level, s16 arg2); void omOvlKill(s16 arg); -void omOvlHisChg(s32 level, OverlayID overlay, int event, int stat); +void omOvlHisChg(s32 level, OverlayID overlay, s32 event, s32 stat); omOvlHisData *omOvlHisGet(s32 level); -Process *omInitObjMan(s16 max_objs, int prio); +Process *omInitObjMan(s16 max_objs, s32 prio); void omDestroyObjMan(void); omObjData *omAddObjEx(Process *objman_process, s16 prio, u16 mdlcnt, u16 mtncnt, s16 group, omObjFunc func); void omAddMember(Process *objman_process, u16 group, omObjData *object); @@ -93,7 +93,7 @@ OverlayID omCurrentOvlGet(void); void omDLLDBGOut(void); void omDLLInit(FileListEntry *ovl_list); -int omDLLStart(s16 overlay, s16 flag); +s32 omDLLStart(s16 overlay, s16 flag); void omDLLNumEnd(s16 overlay, s16 flag); void omDLLEnd(s16 dllno, s16 flag); omDllData *omDLLLink(omDllData **dll_ptr, s16 overlay, s16 flag); @@ -113,11 +113,11 @@ extern omObjData *omDBGSysKeyObj; extern Process *omwatchproc; extern OverlayID omnextovl; extern OverlayID omcurovl; -extern int omcurdll; -extern int omovlhisidx; -extern int omovlevtno; -extern int omnextovlevtno; -extern int omovlstat; +extern s32 omcurdll; +extern s32 omovlhisidx; +extern s32 omovlevtno; +extern s32 omnextovlevtno; +extern s32 omovlstat; extern char omUPauseFlag; extern s16 omSysExitReq; extern s16 omdispinfo; diff --git a/include/game/process.h b/include/game/process.h index c83b9cf2..3bd6a297 100644 --- a/include/game/process.h +++ b/include/game/process.h @@ -20,7 +20,7 @@ typedef struct process { u16 exec; u16 stat; u16 prio; - int sleep_time; + s32 sleep_time; u32 base_sp; jmp_buf jump; void (*dtor)(void); @@ -35,19 +35,19 @@ void HuPrcChildUnlink(Process *process); Process *HuPrcChildCreate(void (*func)(void), u16 prio, u32 stack_size, s32 extra_size, Process *parent); void HuPrcChildWatch(void); Process *HuPrcCurrentGet(void); -int HuPrcKill(Process *process); +s32 HuPrcKill(Process *process); void HuPrcChildKill(Process *process); -void HuPrcSleep(int time); +void HuPrcSleep(s32 time); void HuPrcVSleep(); void HuPrcWakeup(Process *process); void HuPrcDestructorSet2(Process *process, void (*func)(void)); void HuPrcDestructorSet(void (*func)(void)); -void HuPrcCall(int tick); +void HuPrcCall(s32 tick); void *HuPrcMemAlloc(s32 size); void HuPrcMemFree(void *ptr); void HuPrcSetStat(Process *process, u16 value); void HuPrcResetStat(Process *process, u16 value); -void HuPrcAllPause(int flag); -void HuPrcAllUPause(int flag); +void HuPrcAllPause(s32 flag); +void HuPrcAllUPause(s32 flag); #endif \ No newline at end of file diff --git a/src/REL/board_executor.c b/src/REL/board_executor.c index b906db0e..c884fbb7 100644 --- a/src/REL/board_executor.c +++ b/src/REL/board_executor.c @@ -5,7 +5,7 @@ static void InitBoard(void) { BoardCommonInit(BoardCreate, BoardDestroy); } -int _prolog(void) { +s32 _prolog(void) { const VoidFunc* ctors = _ctors; while (*ctors != 0) { (**ctors)(); diff --git a/src/REL/executor.c b/src/REL/executor.c index 8cc50de0..4acadcff 100644 --- a/src/REL/executor.c +++ b/src/REL/executor.c @@ -1,6 +1,6 @@ #include "REL/executor.h" -int _prolog(void) { +s32 _prolog(void) { const VoidFunc* ctors = _ctors; while (*ctors != 0) { (**ctors)(); diff --git a/src/REL/mstory4Dll/main.c b/src/REL/mstory4Dll/main.c index 4a3f2661..38dc9400 100644 --- a/src/REL/mstory4Dll/main.c +++ b/src/REL/mstory4Dll/main.c @@ -453,7 +453,7 @@ void fn_1_EC(void) } } -int _prolog(void) { +s32 _prolog(void) { const VoidFunc* ctors = _ctors; while (*ctors != 0) { (**ctors)(); diff --git a/src/game/data.c b/src/game/data.c index 3af1b340..e630d7ed 100644 --- a/src/game/data.c +++ b/src/game/data.c @@ -26,7 +26,7 @@ static DataReadStat ATTRIBUTE_ALIGN(32) ReadDataStat[DATA_MAX_READSTAT]; void HuDataInit(void) { - int i = 0; + s32 i = 0; FileListEntry *dir_stat = DataDirStat; DataReadStat *read_stat; while(dir_stat->name) { @@ -45,9 +45,9 @@ void HuDataInit(void) } } -static int HuDataReadStatusGet(void) +static s32 HuDataReadStatusGet(void) { - int i; + s32 i; for(i=0; i>= 16; for(i=0; i> 16; if(DataDirMax <= dir_id) { @@ -135,7 +135,7 @@ DataReadStat *HuDataDirRead(s32 data_num) static DataReadStat *HuDataDirReadNum(s32 data_num, s32 num) { DataReadStat *read_stat; - int status; + s32 status; s32 dir_id; dir_id = data_num >> 16; if(DataDirMax <= dir_id) { @@ -176,7 +176,7 @@ static DataReadStat *HuDataDirReadNum(s32 data_num, s32 num) DataReadStat *HuDataDirSet(void *dir_ptr, s32 data_num) { DataReadStat *read_stat = HuDataGetStatus(dir_ptr); - int status; + s32 status; if((status = HuDataReadChk(read_stat->dir_id << 16)) >= 0) { HuDataDirClose(data_num); } @@ -194,7 +194,7 @@ DataReadStat *HuDataDirSet(void *dir_ptr, s32 data_num) void HuDataDirReadAsyncCallBack(s32 result, DVDFileInfo* fileInfo) { DataReadStat *read_stat; - int i; + s32 i; for(i=0; istartAddr) { break; @@ -211,7 +211,7 @@ void HuDataDirReadAsyncCallBack(s32 result, DVDFileInfo* fileInfo) s32 HuDataDirReadAsync(s32 data_num) { DataReadStat *read_stat; - int status; + s32 status; s32 dir_id; dir_id = data_num >> 16; if(DataDirMax <= dir_id) { @@ -244,7 +244,7 @@ s32 HuDataDirReadAsync(s32 data_num) s32 HuDataDirReadNumAsync(s32 data_num, s32 num) { DataReadStat *read_stat; - int status; + s32 status; s32 dir_id; dir_id = data_num >> 16; if(DataDirMax <= dir_id) { @@ -291,7 +291,7 @@ static void GetFileInfo(DataReadStat *read_stat, s32 file_num) void *HuDataRead(s32 data_num) { DataReadStat *read_stat; - int status; + s32 status; void *buf; if(!HuDataDirRead(data_num)) { (void)data_num; @@ -312,7 +312,7 @@ void *HuDataRead(s32 data_num) void *HuDataReadNum(s32 data_num, s32 num) { DataReadStat *read_stat; - int status; + s32 status; void *buf; if(!HuDataDirReadNum(data_num, num)) { return NULL; @@ -332,7 +332,7 @@ void *HuDataReadNum(s32 data_num, s32 num) void *HuDataSelHeapRead(s32 data_num, HeapID heap) { DataReadStat *read_stat; - int status; + s32 status; void *buf; if(!HuDataDirRead(data_num)) { return NULL; @@ -368,7 +368,7 @@ void *HuDataSelHeapRead(s32 data_num, HeapID heap) void *HuDataSelHeapReadNum(s32 data_num, s32 num, HeapID heap) { DataReadStat *read_stat; - int status; + s32 status; void *buf; if(!HuDataDirReadNum(data_num, num)) { return NULL; @@ -412,7 +412,7 @@ static void **HuDataReadMultiSub(s32 *data_ids, BOOL use_num, s32 num) char **paths; void **dir_ptrs; void **out_ptrs; - int i, count, total_files; + s32 i, count, total_files; u32 dir_id; for(i=0, count=0; data_ids[i] != -1; i++) { dir_id = data_ids[i] >> 16; @@ -433,7 +433,7 @@ static void **HuDataReadMultiSub(s32 *data_ids, BOOL use_num, s32 num) for(i=0, count=0; data_ids[i] != -1; i++) { dir_id = data_ids[i] >> 16; if(HuDataReadChk(data_ids[i]) < 0) { - int j; + s32 j; for(j=0; dir_ids[j] != -1; j++) { if(dir_ids[j] == dir_id){ break; @@ -481,7 +481,7 @@ static void **HuDataReadMultiSub(s32 *data_ids, BOOL use_num, s32 num) s32 HuDataGetSize(s32 data_num) { DataReadStat *read_stat; - int status; + s32 status; if((status = HuDataReadChk(data_num)) == -1) { return -1; } @@ -499,7 +499,7 @@ void HuDataClose(void *ptr) void HuDataCloseMulti(void **ptrs) { - int i; + s32 i; for(i=0; ptrs[i]; i++) { void *ptr = ptrs[i]; if(ptr) { @@ -514,7 +514,7 @@ void HuDataCloseMulti(void **ptrs) void HuDataDirClose(s32 data_id) { DataReadStat *read_stat; - int i; + s32 i; s32 dir_id = data_id >> 16; for(i=0; isrc++) << 24; size += (*decode->src++) << 16; size += (*decode->src++) << 8; @@ -78,7 +78,7 @@ static void HuDecodeSlide(struct decode_data *decode) num_bits = 32; } if(flag >> 31) { - *decode->dst++ = (int)*decode->src++; + *decode->dst++ = (s32)*decode->src++; decode->size--; } else { u8 *src; @@ -125,7 +125,7 @@ static void HuDecodeFslide(struct decode_data *decode) num_bits = 32; } if(flag >> 31) { - *decode->dst++ = (int)*decode->src++; + *decode->dst++ = (s32)*decode->src++; decode->size--; } else { u8 *src; @@ -155,11 +155,11 @@ static void HuDecodeFslide(struct decode_data *decode) static void HuDecodeRle(struct decode_data *decode) { - int i; + s32 i; while(decode->size) { - int size = *decode->src++; + s32 size = *decode->src++; if(size < 128) { - int fill = *decode->src++; + s32 fill = *decode->src++; for(i=0; idst++ = fill; } @@ -173,7 +173,7 @@ static void HuDecodeRle(struct decode_data *decode) } } -void HuDecodeData(void *src, void *dst, u32 size, int decode_type) +void HuDecodeData(void *src, void *dst, u32 size, s32 decode_type) { struct decode_data decode; struct decode_data *decode_ptr = &decode; diff --git a/src/game/gamework.c b/src/game/gamework.c index e6207992..60ef959b 100644 --- a/src/game/gamework.c +++ b/src/game/gamework.c @@ -147,19 +147,19 @@ s32 GWMessDelayGet(void) return GWSystem.mess_delay; } -void GWMGRecordSet(int index, s32 value) +void GWMGRecordSet(s32 index, s32 value) { if(!_CheckFlag(FLAG_ID_MAKE(1, 12))) { GWGameStat.mg_record[index] = value; } } -s32 GWMGRecordGet(int index) +s32 GWMGRecordGet(s32 index) { return GWGameStat.mg_record[index]; } -void GWCharColorGet(int character, GXColor *color) +void GWCharColorGet(s32 character, GXColor *color) { GXColor char_color[] = { { 227, 67, 67, 255 }, @@ -174,7 +174,7 @@ void GWCharColorGet(int character, GXColor *color) *color = char_color[character]; } -void GWBoardPlayCountSet(int board, u8 value) +void GWBoardPlayCountSet(s32 board, u8 value) { if(value > 99) { value = 99; @@ -182,7 +182,7 @@ void GWBoardPlayCountSet(int board, u8 value) GWGameStat.board_play_count[board] = value; } -void GWBoardPlayCountAdd(int board, u8 value) +void GWBoardPlayCountAdd(s32 board, u8 value) { value += GWGameStat.board_play_count[board]; if(value > 99) { @@ -192,34 +192,34 @@ void GWBoardPlayCountAdd(int board, u8 value) } -u8 GWBoardPlayCountGet(int board) +u8 GWBoardPlayCountGet(s32 board) { return GWGameStat.board_play_count[board]; } -void GWBoardMaxStarsSet(int board, int value) +void GWBoardMaxStarsSet(s32 board, s32 value) { GWGameStat.board_max_stars[board] = value; } -u16 GWBoardMaxStarsGet(int board) +u16 GWBoardMaxStarsGet(s32 board) { return GWGameStat.board_max_stars[board]; } -void GWBoardMaxCoinsSet(int board, int value) +void GWBoardMaxCoinsSet(s32 board, s32 value) { GWGameStat.board_max_coins[board] = value; } -u16 GWBoardMaxCoinsGet(int board) +u16 GWBoardMaxCoinsGet(s32 board) { return GWGameStat.board_max_coins[board]; } -int GWBoardWinCountInc(int character, int board) +s32 GWBoardWinCountInc(s32 character, s32 board) { - int win_count = GWGameStat.board_win_count[board][character]+1; + s32 win_count = GWGameStat.board_win_count[board][character]+1; if(win_count > 99) { win_count = 99; } @@ -227,20 +227,20 @@ int GWBoardWinCountInc(int character, int board) return win_count; } -int GWBoardWinCountGet(int character, int board) +s32 GWBoardWinCountGet(s32 character, s32 board) { return GWGameStat.board_win_count[board][character]; } -void GWBoardWinCountSet(int character, int board, int value) +void GWBoardWinCountSet(s32 character, s32 board, s32 value) { GWGameStat.board_win_count[board][character] = value; } -int GWMGAvailGet(int id) +s32 GWMGAvailGet(s32 id) { - int word; - int bit; + s32 word; + s32 bit; id -= 401; word = id >> 5; bit = id % 32; @@ -251,20 +251,20 @@ int GWMGAvailGet(int id) } } -int GWMGAvailSet(int id) +s32 GWMGAvailSet(s32 id) { - int word; - int bit; + s32 word; + s32 bit; id -= 401; word = id >> 5; bit = id % 32; GWGameStat.mg_avail[word] |= (1 << bit); } -int GWMGCustomGet(int id) +s32 GWMGCustomGet(s32 id) { - int word; - int bit; + s32 word; + s32 bit; id -= 401; word = id >> 5; bit = id % 32; @@ -275,32 +275,32 @@ int GWMGCustomGet(int id) } } -int GWMGCustomSet(int id) +s32 GWMGCustomSet(s32 id) { - int word; - int bit; + s32 word; + s32 bit; id -= 401; word = id >> 5; bit = id % 32; GWGameStat.mg_custom[word] |= (1 << bit); } -int GWMGCustomReset(int id) +s32 GWMGCustomReset(s32 id) { - int word; - int bit; + s32 word; + s32 bit; id -= 401; word = id >> 5; bit = id % 32; GWGameStat.mg_custom[word] &= ~(1 << bit); } -s16 GWCoinsGet(int player) +s16 GWCoinsGet(s32 player) { return GWPlayer[player].coins; } -void GWCoinsSet(int player, s16 value) +void GWCoinsSet(s32 player, s16 value) { if(!_CheckFlag(FLAG_ID_MAKE(1, 12))) { if(value < 0) { @@ -316,12 +316,12 @@ void GWCoinsSet(int player, s16 value) } } -void GWCoinsAdd(int player, s16 amount) +void GWCoinsAdd(s32 player, s16 amount) { GWCoinsSet(player, GWPlayer[player].coins+amount); } -void GWStarsSet(int player, s16 value) +void GWStarsSet(s32 player, s16 value) { if(value < 0) { value = 0; @@ -335,12 +335,12 @@ void GWStarsSet(int player, s16 value) GWPlayer[player].stars = value; } -void GWStarsAdd(int player, s16 amount) +void GWStarsAdd(s32 player, s16 amount) { GWStarsSet(player, GWPlayer[player].stars+amount); } -s32 GWStarsGet(int player) +s32 GWStarsGet(s32 player) { return GWPlayer[player].stars; } diff --git a/src/game/init.c b/src/game/init.c index 06adbaad..f3a4f853 100644 --- a/src/game/init.c +++ b/src/game/init.c @@ -166,7 +166,7 @@ void HuSysBeforeRender() void HuSysDoneRender(s32 retrace_count) { - int retrace_dist; + s32 retrace_dist; if(DemoStatEnable) { GXDrawDone(); DEMOUpdateStats(1); diff --git a/src/game/jmp.c b/src/game/jmp.c index 94ec81b4..8313bd8c 100755 --- a/src/game/jmp.c +++ b/src/game/jmp.c @@ -1,6 +1,6 @@ #include "game/jmp.h" -int gcsetjmp(register jmp_buf *jump) { +s32 gcsetjmp(register jmp_buf *jump) { // clang-format off asm { mflr r5 @@ -36,7 +36,7 @@ int gcsetjmp(register jmp_buf *jump) { } // clang-format off -asm int gclongjmp(register jmp_buf *jump, register int status) { +asm s32 gclongjmp(register jmp_buf *jump, register s32 status) { nofralloc lwz r5, jump->lr lwz r6, jump->cr diff --git a/src/game/objdll.c b/src/game/objdll.c index 067bee54..c1414129 100644 --- a/src/game/objdll.c +++ b/src/game/objdll.c @@ -16,7 +16,7 @@ void omDLLDBGOut(void) void omDLLInit(FileListEntry *ovl_list) { - int i; + s32 i; OSReport("DLL DBG OUT\n"); for(i=0; i= 0 && !flag) { diff --git a/src/game/objmain.c b/src/game/objmain.c index 88ab203a..f802d287 100644 --- a/src/game/objmain.c +++ b/src/game/objmain.c @@ -34,12 +34,12 @@ omObjData *omDBGSysKeyObj; Process *omwatchproc; OverlayID omnextovl; OverlayID omcurovl; -int omcurdll; -int omovlhisidx; -int omovlevtno; -int omnextovlevtno; -int omovlstat; -static int omnextovlstat; +s32 omcurdll; +s32 omovlhisidx; +s32 omovlevtno; +s32 omnextovlevtno; +s32 omovlstat; +static s32 omnextovlstat; char omUPauseFlag; s16 omSysExitReq; s16 omdispinfo; @@ -52,7 +52,7 @@ OverlayID omprevovl = OVL_INVALID; static void omWatchOverlayProc(void); static void omInsertObj(Process *objman_process, omObjData *object); -void omMasterInit(int prio, FileListEntry *ovl_list, int ovl_count, OverlayID start_ovl) +void omMasterInit(s32 prio, FileListEntry *ovl_list, s32 ovl_count, OverlayID start_ovl) { omDLLInit(ovl_list); omwatchproc = HuPrcCreate(omWatchOverlayProc, prio, 8192, 0); @@ -106,7 +106,7 @@ static void omWatchOverlayProc(void) } } -void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat) +void omOvlCallEx(OverlayID overlay, s16 arg2, s32 event, s32 stat) { OSReport("objman>Call New Ovl %d(%d)\n", overlay, arg2); if(omovlhisidx >= OM_OVL_HIS_MAX) { @@ -119,7 +119,7 @@ void omOvlCallEx(OverlayID overlay, s16 arg2, int event, int stat) omOvlGotoEx(overlay, arg2, event, stat); } -void omOvlGotoEx(OverlayID overlay, s16 arg2, int event, int stat) +void omOvlGotoEx(OverlayID overlay, s16 arg2, s32 event, s32 stat) { omprevovl = omcurovl; if(omcurovl >= 0) { @@ -162,7 +162,7 @@ void omOvlKill(s16 arg) omDBGSysKeyObj = NULL; } -void omOvlHisChg(s32 level, OverlayID overlay, int event, int stat) +void omOvlHisChg(s32 level, OverlayID overlay, s32 event, s32 stat) { omOvlHisData *history; if(omovlhisidx-level < 0 || omovlhisidx-level >= OM_OVL_HIS_MAX) { @@ -184,12 +184,12 @@ omOvlHisData *omOvlHisGet(s32 level) return &omovlhis[omovlhisidx-level]; } -Process *omInitObjMan(s16 max_objs, int prio) +Process *omInitObjMan(s16 max_objs, s32 prio) { omObjGroup *group_all; omObjData *obj_all; omObjData *obj; - int i; + s32 i; omObjMan *objman; Process *process; OSReport("objman>InitObjMan start\n"); @@ -245,7 +245,7 @@ void omDestroyObjMan(void) omObjData *omAddObjEx(Process *objman_process, s16 prio, u16 mdlcnt, u16 mtncnt, s16 group, void (*func)(omObjData *)) { - int i; + s32 i; omObjData *object; s16 next_idx; omObjMan *objman = objman_process->user_data; @@ -408,7 +408,7 @@ void omDelMember(Process *objman_process, omObjData *object) void omMakeGroupEx(Process *objman_process, u16 group, u16 max_objs) { - int i; + s32 i; omObjMan *objman = objman_process->user_data; omObjGroup *group_ptr = &objman->group[group]; if(group_ptr->obj != NULL) { @@ -521,7 +521,7 @@ static void omDumpObj(Process *objman_process) { omObjMan *objman = objman_process->user_data; omObjData *obj_all = objman->obj; - int i; + s32 i; OSReport("=================== 現在登録されている OBJECT ==================\n"); OSReport("STAT PRI GRPN MEMN PROG (TRA) (ROT) (SCA) mdlcnt mtncnt work[0] work[1] work[2] work[3] *data\n"); for(i=0; imax_objs; i++) { @@ -540,7 +540,7 @@ void omAllPause(BOOL pause) { Process *objman_process = HuPrcCurrentGet(); omObjMan *objman = objman_process->user_data; - int i; + s32 i; if(pause) { for(i=0; imax_objs; i++) { if((objman->obj[i].stat & (OM_STAT_DELETED|OM_STAT_NOPAUSE)) == 0) { diff --git a/src/game/objsysobj.c b/src/game/objsysobj.c index 765fd55b..3e6b56f3 100644 --- a/src/game/objsysobj.c +++ b/src/game/objsysobj.c @@ -95,7 +95,7 @@ void omSystemKeyCheck(omObjData *object) HuAudSeqPauseAll(0); } } else { - int i; + s32 i; s16 pause = 0; if(WipeStatGet() || omCurrentOvlGet() == OVL_INVALID || omSysExitReq) { return; diff --git a/src/game/process.c b/src/game/process.c index 121089b0..b62b74fc 100644 --- a/src/game/process.c +++ b/src/game/process.c @@ -2,7 +2,7 @@ #include "game/memory.h" #include "dolphin/os.h" -#define PROCESS_MEMORY_RETADDR 0xA5A5A5A5 +#define FAKE_RETADDR 0xA5A5A5A5 #define EXEC_NORMAL 0 #define EXEC_SLEEP 1 @@ -15,7 +15,6 @@ static Process *processcur; static u16 processcnt; u32 procfunc; - void HuPrcInit(void) { processcnt = 0; @@ -49,12 +48,9 @@ static void UnlinkProcess(Process **root, Process *process) { if (process->next) { process->next->prev = process->prev; } - if (process->prev) { process->prev->next = process->next; - } - - else { + } else { *root = process->next; } } @@ -75,13 +71,13 @@ Process *HuPrcCreate(void (*func)(void), u16 prio, u32 stack_size, s32 extra_siz return NULL; } HuMemHeapInit(heap, alloc_size); - process = HuMemMemoryAlloc(heap, sizeof(Process), PROCESS_MEMORY_RETADDR); + process = HuMemMemoryAlloc(heap, sizeof(Process), FAKE_RETADDR); process->heap = heap; process->exec = EXEC_NORMAL; process->stat = 0; process->prio = prio; process->sleep_time = 0; - process->base_sp = ((u32)HuMemMemoryAlloc(heap, stack_size, PROCESS_MEMORY_RETADDR))+stack_size-8; + process->base_sp = ((u32)HuMemMemoryAlloc(heap, stack_size, FAKE_RETADDR))+stack_size-8; gcsetjmp(&process->jump); process->jump.lr = (u32)func; process->jump.sp = process->base_sp; @@ -144,7 +140,7 @@ Process *HuPrcCurrentGet() return processcur; } -static int SetKillStatusProcess(Process *process) +static s32 SetKillStatusProcess(Process *process) { if(process->exec != EXEC_KILLED) { HuPrcWakeup(process); @@ -155,7 +151,7 @@ static int SetKillStatusProcess(Process *process) } } -int HuPrcKill(Process *process) +s32 HuPrcKill(Process *process) { if(process == NULL) { process = HuPrcCurrentGet(); @@ -196,7 +192,7 @@ void HuPrcEnd() gcTerminateProcess(process); } -void HuPrcSleep(int time) +void HuPrcSleep(s32 time) { Process *process = HuPrcCurrentGet(); if(time != 0 && process->exec != EXEC_KILLED) { @@ -210,10 +206,7 @@ void HuPrcSleep(int time) void HuPrcVSleep() { - Process *process = HuPrcCurrentGet(); - if(!gcsetjmp(&process->jump)) { - gclongjmp(&processjmpbuf, 1); - } + HuPrcSleep(0); } void HuPrcWakeup(Process *process) @@ -232,10 +225,10 @@ void HuPrcDestructorSet(void (*func)(void)) process->dtor = func; } -void HuPrcCall(int tick) +void HuPrcCall(s32 tick) { Process *process; - int ret; + s32 ret; processcur = processtop; ret = gcsetjmp(&processjmpbuf); while(1) { @@ -293,12 +286,12 @@ void HuPrcCall(int tick) void *HuPrcMemAlloc(s32 size) { Process *process = HuPrcCurrentGet(); - return HuMemMemoryAlloc(process->heap, size, PROCESS_MEMORY_RETADDR); + return HuMemMemoryAlloc(process->heap, size, FAKE_RETADDR); } void HuPrcMemFree(void *ptr) { - HuMemMemoryFree(ptr, PROCESS_MEMORY_RETADDR); + HuMemMemoryFree(ptr, FAKE_RETADDR); } void HuPrcSetStat(Process *process, u16 value) @@ -311,7 +304,7 @@ void HuPrcResetStat(Process *process, u16 value) process->stat &= ~value; } -void HuPrcAllPause(int flag) +void HuPrcAllPause(s32 flag) { Process *process = processtop; if(flag) { @@ -333,7 +326,7 @@ void HuPrcAllPause(int flag) } } -void HuPrcAllUPause(int flag) +void HuPrcAllUPause(s32 flag) { Process *process = processtop; if(flag) { diff --git a/src/game/wipe.c b/src/game/wipe.c index 7d4cbea0..f2429aa3 100644 --- a/src/game/wipe.c +++ b/src/game/wipe.c @@ -6,7 +6,7 @@ s16 HuSysVWaitGet(s16 old); -typedef int (*fadeFunc)(void); +typedef s32 (*fadeFunc)(void); WipeState wipeData; BOOL wipeFadeInF; @@ -15,9 +15,9 @@ static void WipeColorFill(GXColor color); static void WipeFrameStill(GXColor color); -static int WipeNormalFade(void); -static int WipeCrossFade(void); -static int WipeDummyFade(void); +static s32 WipeNormalFade(void); +static s32 WipeCrossFade(void); +static s32 WipeDummyFade(void); static fadeFunc fadeInFunc[3] = { WipeNormalFade, WipeCrossFade, WipeDummyFade }; static fadeFunc fadeOutFunc[3] = { WipeNormalFade, WipeCrossFade, WipeDummyFade }; @@ -25,7 +25,7 @@ static fadeFunc fadeOutFunc[3] = { WipeNormalFade, WipeCrossFade, WipeDummyFade void WipeInit(GXRenderModeObj *rmode) { WipeState *wipe; - int i; + s32 i; wipe = &wipeData; wipe->unk00 = 0; wipe->unk04 = 0; @@ -46,7 +46,7 @@ void WipeInit(GXRenderModeObj *rmode) void WipeExecAlways(void) { - int i; + s32 i; WipeState *wipe; wipe = &wipeData; switch(wipe->mode) { @@ -151,12 +151,12 @@ u8 WipeStatGet(void) return wipeData.stat; } -static int WipeDummyFade(void) +static s32 WipeDummyFade(void) { return 0; } -static int WipeNormalFade(void) +static s32 WipeNormalFade(void) { u8 alpha; WipeState *wipe = &wipeData; @@ -192,9 +192,9 @@ static void WipeColorFill(GXColor color) WipeState *wipe; u16 ulx, lrx, uly, lry; wipe = &wipeData; - ulx = (int)wipe->x; + ulx = (s32)wipe->x; lrx = wipe->x+wipe->w; - uly = (int)wipe->y; + uly = (s32)wipe->y; lry = wipe->x+wipe->h+1; MTXOrtho(proj, uly, lry, ulx, lrx, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC); @@ -227,7 +227,7 @@ static void WipeColorFill(GXColor color) GXSetChanMatColor(GX_COLOR0A0, colorN); } -static int WipeCrossFade(void) +static s32 WipeCrossFade(void) { u32 size; u8 alpha; @@ -273,9 +273,9 @@ static void WipeFrameStill(GXColor color) WipeState *wipe; u16 ulx, lrx, uly, lry; wipe = &wipeData; - ulx = (int)wipe->x; + ulx = (s32)wipe->x; lrx = wipe->x+wipe->w; - uly = (int)wipe->y; + uly = (s32)wipe->y; lry = wipe->x+wipe->h+1; MTXOrtho(proj, uly, lry, ulx, lrx, 0, 10); GXSetProjection(proj, GX_ORTHOGRAPHIC);