"various changes to get it building for mac, as well as 64-bit" from zestydev

This commit is contained in:
dbalatoni13 2025-04-04 04:05:31 +02:00
parent ed2a2225d7
commit caea40c6aa
11 changed files with 216 additions and 162 deletions

View file

@ -9,17 +9,17 @@ extern "C" {
typedef int OSHeapHandle;
typedef void (*OSAllocVisitor)(void *obj, u32 size);
void *OSInitAlloc(void *arenaStart, void *arenaEnd, int maxHeaps);
OSHeapHandle OSCreateHeap(void *start, void *end);
uintptr_t OSCreateHeap(void *start, void *end);
void OSDestroyHeap(OSHeapHandle heap);
void OSAddToHeap(OSHeapHandle heap, void *start, void *end);
OSHeapHandle OSSetCurrentHeap(OSHeapHandle heap);
void *OSAllocFromHeap(OSHeapHandle heap, u32 size);
void *OSAllocFromHeap(int heap, unsigned long size);
void *OSAllocFixed(void **rstart, void **rend);
void OSFreeToHeap(OSHeapHandle heap, void *ptr);
long OSCheckHeap(OSHeapHandle heap);
void OSDumpHeap(OSHeapHandle heap);
u32 OSReferentSize(void *ptr);
void OSVisitAllocated(OSAllocVisitor visitor);
unsigned long OSReferentSize(void *ptr);
void OSVisitAllocated(void (*visitor)(void *, unsigned long));
extern volatile OSHeapHandle __OSCurrHeap;
#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))
#define OSFree(ptr) OSFreeToHeap(__OSCurrHeap, (ptr))

View file

@ -5,7 +5,7 @@
#include "game/flag.h"
#include "version.h"
//HACK: to prevent prototype errors
// HACK: to prevent prototype errors
extern void HuPadRumbleAllStop(void);
typedef struct player_config {
@ -17,12 +17,12 @@ typedef struct player_config {
} PlayerConfig;
typedef struct system_state {
/* 0x00 */ struct {
/* 0x00 */ struct {
u8 party : 1;
u8 team : 1;
};
/* 0x01 */ u8 diff_story;
/* 0x02 */ struct {
/* 0x01 */ u8 diff_story;
/* 0x02 */ struct {
u16 bonus_star : 1;
u16 explain_mg : 1;
u16 show_com_mg : 1;
@ -30,35 +30,35 @@ typedef struct system_state {
u16 mess_speed : 2;
u16 save_mode : 2;
};
/* 0x04 */ u8 turn;
/* 0x05 */ u8 max_turn;
/* 0x06 */ u8 star_flag;
/* 0x07 */ u8 star_total;
/* 0x08 */ struct {
u8 star_pos : 3;
u8 board : 5;
};
/* 0x09 */ s8 last5_effect;
/* 0x0A */ s8 player_curr;
/* 0x0B */ u8 storyCharBit;
/* 0x0C */ s8 storyChar;
/* 0x0E */ s16 block_pos;
/* 0x10 */ u8 ATTRIBUTE_ALIGN(4) board_data[32];
/* 0x30 */ u8 mess_delay;
/* 0x31 */ struct {
/* 0x04 */ u8 turn;
/* 0x05 */ u8 max_turn;
/* 0x06 */ u8 star_flag;
/* 0x07 */ u8 star_total;
/* 0x08 */ struct {
u8 star_pos : 3;
u8 board : 5;
};
/* 0x09 */ s8 last5_effect;
/* 0x0A */ s8 player_curr;
/* 0x0B */ u8 storyCharBit;
/* 0x0C */ s8 storyChar;
/* 0x0E */ s16 block_pos;
/* 0x10 */ u8 ATTRIBUTE_ALIGN(4) board_data[32];
/* 0x30 */ u8 mess_delay;
/* 0x31 */ struct {
u8 bowser_loss : 4;
u8 bowser_event : 4;
};
/* 0x32 */ s8 lucky_value;
/* 0x34 */ u16 mg_next;
/* 0x36 */ s16 mg_type;
/* 0x38 */ u16 unk_38;
/* 0x3A */ u8 flag[3][16];
/* 0x6A */ u8 unk_6A[0x72];
} SystemState; //8018fcf8, sizeof 0xDC
/* 0x32 */ s8 lucky_value;
/* 0x34 */ u16 mg_next;
/* 0x36 */ s16 mg_type;
/* 0x38 */ u16 unk_38;
/* 0x3A */ u8 flag[3][16];
/* 0x6A */ u8 unk_6A[0x72];
} SystemState; // 8018fcf8, sizeof 0xDC
typedef struct player_state {
/* 0x00 */ struct {
/* 0x00 */ struct {
u16 diff : 2;
u16 com : 1;
u16 character : 4;
@ -66,15 +66,15 @@ typedef struct player_state {
u16 draw_ticket : 1;
u16 ticket_player : 6;
};
/* 0x02 */ struct {
/* 0x02 */ struct {
u8 team : 1;
u8 spark : 1;
u8 player_idx : 2;
};
/* 0x03 */ s8 handicap;
/* 0x04 */ s8 port;
/* 0x05 */ s8 items[3];
/* 0x08 */ struct {
/* 0x03 */ s8 handicap;
/* 0x04 */ s8 port;
/* 0x05 */ s8 items[3];
/* 0x08 */ struct {
u16 color : 2;
u16 moving : 1;
u16 jump : 1;
@ -85,30 +85,30 @@ typedef struct player_state {
u16 bowser_suit : 1;
u16 team_backup : 1;
};
/* 0x0A */ s8 roll;
/* 0x0C */ s16 space_curr;
/* 0x0E */ s16 space_prev;
/* 0x10 */ s16 space_next;
/* 0x12 */ s16 space_shock;
/* 0x14 */ s8 blue_count;
/* 0x15 */ s8 red_count;
/* 0x16 */ s8 question_count;
/* 0x17 */ s8 fortune_count;
/* 0x18 */ s8 bowser_count;
/* 0x19 */ s8 battle_count;
/* 0x1A */ s8 mushroom_count;
/* 0x1B */ s8 warp_count;
/* 0x1C */ s16 coins;
/* 0x1E */ s16 coins_mg;
/* 0x20 */ s16 coins_total;
/* 0x22 */ s16 coins_max;
/* 0x24 */ s16 coins_battle;
/* 0x26 */ s16 coin_collect;
/* 0x28 */ s16 coin_win;
/* 0x2A */ s16 stars;
/* 0x2C */ s16 stars_max;
/* 0x2E */ char unk_2E[2];
} PlayerState; //size of 0x30
/* 0x0A */ s8 roll;
/* 0x0C */ s16 space_curr;
/* 0x0E */ s16 space_prev;
/* 0x10 */ s16 space_next;
/* 0x12 */ s16 space_shock;
/* 0x14 */ s8 blue_count;
/* 0x15 */ s8 red_count;
/* 0x16 */ s8 question_count;
/* 0x17 */ s8 fortune_count;
/* 0x18 */ s8 bowser_count;
/* 0x19 */ s8 battle_count;
/* 0x1A */ s8 mushroom_count;
/* 0x1B */ s8 warp_count;
/* 0x1C */ s16 coins;
/* 0x1E */ s16 coins_mg;
/* 0x20 */ s16 coins_total;
/* 0x22 */ s16 coins_max;
/* 0x24 */ s16 coins_battle;
/* 0x26 */ s16 coin_collect;
/* 0x28 */ s16 coin_win;
/* 0x2A */ s16 stars;
/* 0x2C */ s16 stars_max;
/* 0x2E */ char unk_2E[2];
} PlayerState; // size of 0x30
typedef struct pause_backup_config {
u8 explain_mg : 1;
@ -119,21 +119,21 @@ typedef struct pause_backup_config {
} PauseBackupConfig;
typedef struct game_stat {
/* 0x0 */ s16 unk_00;
/* 0x2 */ u8 language;
/* 0x3 */ u8 sound_mode;
/* 0x4 */ s8 rumble;
/* 0x6 */ u16 total_stars;
/* 0x8 */ OSTime create_time;
/* 0x10 */ u32 mg_custom[2];
/* 0x18 */ u32 mg_avail[2];
/* 0x20 */ u32 mg_record[15];
/* 0x5C */ u8 board_win_count[9][8];
/* 0xA4 */ u8 board_play_count[9];
/* 0xAE */ u16 board_max_stars[9];
/* 0xC0 */ u16 board_max_coins[9];
/* 0xD2 */ u8 present[60];
/* 0x10E */ struct {
/* 0x0 */ s16 unk_00;
/* 0x2 */ u8 language;
/* 0x3 */ u8 sound_mode;
/* 0x4 */ s8 rumble;
/* 0x6 */ u16 total_stars;
/* 0x8 */ OSTime create_time;
/* 0x10 */ u32 mg_custom[2];
/* 0x18 */ u32 mg_avail[2];
/* 0x20 */ u32 mg_record[15];
/* 0x5C */ u8 board_win_count[9][8];
/* 0xA4 */ u8 board_play_count[9];
/* 0xAE */ u16 board_max_stars[9];
/* 0xC0 */ u16 board_max_coins[9];
/* 0xD2 */ u8 present[60];
/* 0x10E */ struct {
u8 story_continue : 1;
u8 party_continue : 1;
u8 open_w06 : 1;
@ -141,8 +141,8 @@ typedef struct game_stat {
u8 customPackEnable : 1;
u8 musicAllF : 1;
};
/* 0x10F */ PauseBackupConfig story_pause;
/* 0x110 */ PauseBackupConfig party_pause;
/* 0x10F */ PauseBackupConfig story_pause;
/* 0x110 */ PauseBackupConfig party_pause;
} GameStat;
extern s16 GwLanguage;
@ -196,8 +196,9 @@ static inline s32 GWRumbleGet(void)
static inline void GWRumbleSet(s32 value)
{
GWGameStat.rumble = value;
if(value == 0) {
HuPadRumbleAllStop();
if (value == 0) {
// TODO: get rumble working
// HuPadRumbleAllStop();
}
}
@ -206,7 +207,6 @@ static inline s32 GWBonusStarGet(void)
return GWSystem.bonus_star;
}
static inline s32 GWMGExplainGet(void)
{
return GWSystem.explain_mg;
@ -250,9 +250,9 @@ static inline s32 GWMessSpeedGet(void)
static inline void GWMessSpeedSet(s32 value)
{
#if VERSION_NTSC
#if VERSION_NTSC
GWSystem.mess_speed = value;
switch(value) {
switch (value) {
case 0:
GWSystem.mess_delay = 16;
break;
@ -265,9 +265,9 @@ static inline void GWMessSpeedSet(s32 value)
GWSystem.mess_delay = 32;
break;
}
#else
#else
GWSystem.mess_speed = value;
switch(value) {
switch (value) {
case 0:
GWSystem.mess_delay = 32;
break;
@ -275,7 +275,7 @@ static inline void GWMessSpeedSet(s32 value)
case 2:
GWSystem.mess_delay = 64;
break;
case 1:
GWSystem.mess_delay = 48;
break;
@ -284,7 +284,7 @@ static inline void GWMessSpeedSet(s32 value)
GWSystem.mess_delay = 120;
break;
}
#endif
#endif
}
static inline void GWSaveModeSet(s32 value)
@ -367,7 +367,7 @@ static inline void GWPlayerCoinWinSet(s32 player, s16 value)
}
}
#define GWPlayerCoinWinAdd(player, value) GWPlayerCoinWinSet((player), GWPlayerCoinWinGet((player))+(value))
#define GWPlayerCoinCollectAdd(player, value) GWPlayerCoinCollectSet((player), (s32)GWPlayerCoinCollectGet((player))+(value))
#define GWPlayerCoinWinAdd(player, value) GWPlayerCoinWinSet((player), GWPlayerCoinWinGet((player)) + (value))
#define GWPlayerCoinCollectAdd(player, value) GWPlayerCoinCollectSet((player), (s32)GWPlayerCoinCollectGet((player)) + (value))
#endif