Merge pull request #580 from dbalatoni13/port

PC port work
This commit is contained in:
Dávid Balatoni 2025-04-09 02:06:50 +02:00 committed by GitHub
commit 909c743527
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
141 changed files with 7242 additions and 3522 deletions

View file

@ -1,58 +0,0 @@
#ifndef _CTYPE_H
#define _CTYPE_H
#include "dolphin/types.h"
extern unsigned char __ctype_map[256];
extern unsigned char __lower_map[256];
extern unsigned char __upper_map[256];
#define __control_char 0x01
#define __motion_char 0x02
#define __space_char 0x04
#define __punctuation 0x08
#define __digit 0x10
#define __hex_digit 0x20
#define __lower_case 0x40
#define __upper_case 0x80
#define __letter (__lower_case | __upper_case)
#define __alphanumeric (__letter | __digit)
#define __graphic (__alphanumeric | __punctuation)
#define __printable (__graphic | __space_char)
#define __whitespace (__motion_char | __space_char)
#define __control (__motion_char | __control_char)
#ifdef __MWERKS__
#define DECL_WEAK __declspec(weak)
#else
#define DECL_WEAK __attribute__((weak))
#endif
#ifdef __cplusplus
extern "C"
{
#endif
DECL_WEAK int isalpha(int __c);
DECL_WEAK int isdigit(int __c);
DECL_WEAK int isspace(int __c);
DECL_WEAK int isupper(int __c);
DECL_WEAK int isxdigit(int __c);
DECL_WEAK int tolower(int __c);
DECL_WEAK int toupper(int __c);
// added underscore to avoid naming conflicts
inline int _isalpha(int c) { return (int)(__ctype_map[(u8)c] & __letter); }
inline int _isdigit(int c) { return (int)(__ctype_map[(u8)c] & __digit); }
inline int _isspace(int c) { return (int)(__ctype_map[(u8)c] & __whitespace); }
inline int _isupper(int c) { return (int)(__ctype_map[(u8)c] & __upper_case); }
inline int _isxdigit(int c) { return (int)(__ctype_map[(u8)c] & __hex_digit); }
inline int _tolower(int c) { return (c == -1 ? -1 : (int)__lower_map[(u8)c]); }
inline int _toupper(int c) { return (c == -1 ? -1 : (int)__upper_map[(u8)c]); }
#ifdef __cplusplus
}
#endif
#endif

View file

@ -29,10 +29,10 @@ typedef enum {
DEMO_STAT_IO = 4
} DEMO_STAT_DISP;
extern unsigned char DemoStatEnable;
void DEMOSetStats(DemoStatData * stat, unsigned long nstats, DEMO_STAT_DISP disp);
void DEMOUpdateStats(unsigned char inc);
void DEMOPrintStats(void);
void DEMOUpdateStats(unsigned char inc);
void DEMOPrintStats(void);
#endif

View file

@ -20,8 +20,10 @@ void GXSetPointSize(u8 pointSize, GXTexOffset texOffsets);
void GXEnableTexOffsets(GXTexCoordID coord, GXBool line_enable, GXBool point_enable);
#ifdef TARGET_PC
void GXSetArray(GXAttr attr, const void* data, u32 size, u8 stride);
#define GXSETARRAY(attr, data, size, stride) GXSetArray((attr), (data), (size), (stride))
#else
void GXSetArray(GXAttr attr, const void* data, u8 stride);
#define GXSETARRAY(attr, data, size, stride) GXSetArray((attr), (data), (stride))
#endif
void GXInvalidateVtxCache(void);

View file

@ -2,8 +2,9 @@
#define _DOLPHIN_GXPRIV
#include "dolphin/gx.h"
#include "dolphin/os.h"
#ifdef DEBUG
#ifndef NDEBUG
#define ASSERTLINE(line, cond) \
((cond) || (OSPanic(__FILE__, line, "Failed assertion " #cond), 0))

View file

@ -6,7 +6,11 @@
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__MWERKS__) && !defined(GEKKO)
#define GEKKO
#endif
#ifndef GEKKO
#define MTX_USE_C
#undef MTX_USE_PS
@ -302,6 +306,20 @@ void PSMTXMultS16VecArray(const Mtx m, const S16Vec* srcBase, Vec* dstBase, u32
void PSMTXROMultS16VecArray(const ROMtx m, const S16Vec* srcBase, Vec* dstBase, u32 count);
#endif
#ifdef MTX_USE_PS
#define MTXReorder PSMTXReorder
#define MTXROMultVecArray PSMTXROMultVecArray
#define MTXROSkin2VecArray PSMTXROSkin2VecArray
#define MTXROMultS16VecArray PSMTXROMultS16VecArray
#define MTXMultS16VecArray PSMTXMultS16VecArray
#else // MTX_USE_C
#define MTXReorder C_MTXReorder
#define MTXROMultVecArray C_MTXROMultVecArray
#define MTXROSkin2VecArray C_MTXROSkin2VecArray
#define MTXROMultS16VecArray C_MTXROMultS16VecArray
#define MTXMultS16VecArray C_MTXMultS16VecArray
#endif
void MTXInitStack(MtxStack* sPtr, u32 numMtx);
MtxPtr MTXPush(MtxStack* sPtr, const Mtx m);
MtxPtr MTXPushFwd(MtxStack* sPtr, const Mtx m);

View file

@ -23,10 +23,15 @@ extern "C" {
#endif
typedef s64 OSTime;
typedef u32 OSTick;
#ifdef __MWERKS__
u32 __OSBusClock AT_ADDRESS(OS_BASE_CACHED | 0x00F8); // sync with OSLoMem.h
u32 __OSCoreClock AT_ADDRESS(OS_BASE_CACHED | 0x00FC); // sync with OSLoMem.h
#define OS_BUS_CLOCK (u32) __OSBusClock
#define OS_CORE_CLOCK __OSCoreClock
#else
#define OS_BUS_CLOCK 162000000ull
#define OS_CORE_CLOCK 486000000ull
#endif
#define OS_TIMER_CLOCK (OS_BUS_CLOCK / 4)
#ifndef _DEBUG
@ -57,8 +62,8 @@ u32 OSUncachedToCached(void *ucaddr);
#define OSDiffTick(tick1, tick0) ((s32)(tick1) - (s32)(tick0))
#define OSRoundUp32B(x) (((u32)(x) + 0x1F) & ~(0x1F))
#define OSRoundDown32B(x) (((u32)(x)) & ~(0x1F))
#define OSRoundUp32B(x) (((size_t)(x) + 0x1F) & ~(0x1F))
#define OSRoundDown32B(x) (((size_t)(x)) & ~(0x1F))
#define OSRoundUp(x, align) (((x) + (align)-1) & (-(align)))
#define OSRoundUpPtr(x, align) ((void*)((((u32)(x)) + (align)-1) & (~((align)-1))))

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

@ -1,6 +1,8 @@
#ifndef _DOLPHIN_OSFASTCAST
#define _DOLPHIN_OSFASTCAST
#include "dolphin/types.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -44,6 +46,7 @@ static inline void OSInitFastCast(void) {
static inline s16 __OSf32tos16(register f32 inF)
{
#ifdef __MWERKS__
u32 tmp;
register u32* tmpPtr = &tmp;
register s16 out;
@ -55,12 +58,16 @@ static inline s16 __OSf32tos16(register f32 inF)
// clang-format on
return out;
#else
return (s16) inF;
#endif
}
static inline void OSf32tos16(f32 *f, s16 *out) { *out = __OSf32tos16(*f); }
static inline u8 __OSf32tou8(register f32 inF)
{
#ifdef __MWERKS__
u32 tmp;
register u32 *tmpPtr = &tmp;
register u8 out;
@ -72,12 +79,16 @@ static inline u8 __OSf32tou8(register f32 inF)
// clang-format on
return out;
#else
return (u8)inF;
#endif
}
static inline void OSf32tou8(f32 *f, u8 *out) { *out = __OSf32tou8(*f); }
static inline s8 __OSf32tos8(register f32 inF)
{
#ifdef __MWERKS__
u32 tmp;
register u32 *tmpPtr = &tmp;
register s8 out;
@ -90,12 +101,16 @@ static inline s8 __OSf32tos8(register f32 inF)
// clang-format on
return out;
#else
return (s8) inF;
#endif
}
static inline void OSf32tos8(f32 *f, s8 *out) { *out = __OSf32tos8(*f); }
static inline u16 __OSf32tou16(register f32 inF)
{
#ifdef __MWERKS__
u32 tmp;
register u32 *tmpPtr = &tmp;
register u16 out;
@ -107,11 +122,15 @@ static inline u16 __OSf32tou16(register f32 inF)
// clang-format on
return out;
#else
return (u16) inF;
#endif
}
static inline void OSf32tou16(f32 *f, u16 *out) { *out = __OSf32tou16(*f); }
static inline float __OSs8tof32(register const s8* arg) {
#ifdef __MWERKS__
register float ret;
asm {
@ -119,11 +138,15 @@ static inline float __OSs8tof32(register const s8* arg) {
}
return ret;
#else
return (f32)*arg;
#endif
}
static inline void OSs8tof32(const s8* in, float* out) { *out = __OSs8tof32(in); }
static inline float __OSs16tof32(register const s16* arg) {
#ifdef __MWERKS__
register float ret;
asm {
@ -131,11 +154,15 @@ static inline float __OSs16tof32(register const s16* arg) {
}
return ret;
#else
return (f32)*arg;
#endif
}
static inline void OSs16tof32(const s16* in, float* out) { *out = __OSs16tof32(in); }
static inline float __OSu8tof32(register const u8* arg) {
#ifdef __MWERKS__
register float ret;
asm {
@ -143,11 +170,15 @@ static inline float __OSu8tof32(register const u8* arg) {
}
return ret;
#else
return (f32)*arg;
#endif
}
static inline void OSu8tof32(const u8* in, float* out) { *out = __OSu8tof32(in); }
static inline float __OSu16tof32(register const u16* arg) {
#ifdef __MWERKS__
register float ret;
asm {
@ -155,6 +186,9 @@ static inline float __OSu16tof32(register const u16* arg) {
}
return ret;
#else
return (f32)*arg;
#endif
}
static inline void OSu16tof32(const u16* in, float* out) { *out = __OSu16tof32(in); }

View file

@ -20,6 +20,9 @@ typedef unsigned char u8;
typedef unsigned short int u16;
typedef unsigned long u32;
typedef unsigned long long int u64;
typedef u32 size_t;
typedef u32 uintptr_t;
#endif
typedef volatile u8 vu8;
@ -64,7 +67,7 @@ typedef int BOOL;
#define NULL ((void *)0)
#endif
#endif
#if !defined(__cplusplus) || __cplusplus < 201103L
#if !defined(__cplusplus)
#ifndef nullptr
#define nullptr NULL
#endif

View file

@ -15,6 +15,7 @@ u32 VIGetTvFormat(void);
void VISetNextFrameBuffer(void* fb);
void VIWaitForRetrace(void);
void VISetBlack(BOOL black);
void VIConfigurePan(u16 xOrg, u16 yOrg, u16 width, u16 height);
#ifdef TARGET_PC
void VISetWindowTitle(const char* title);

View file

@ -4,6 +4,8 @@
#include "math.h"
#include "dolphin/mtx.h"
#define M_PI 3.141592653589793
typedef struct vec2f {
float x;
float y;
@ -33,7 +35,7 @@ typedef struct vec2f {
#define atan2d(y, x) (180.0*(atan2((y), (x)) / M_PI))
#ifndef __MWERKS__
void HuSetVecF(Vec* arg0, f32 arg8, f32 arg9, f32 argA)
void HuSetVecF(Vec *arg0, f32 arg8, f32 arg9, f32 argA);
#endif
#endif

View file

@ -1,18 +0,0 @@
#ifndef _FLOAT_H_
#define _FLOAT_H_
#ifdef __cplusplus
extern "C" {
#endif
#define FLT_MAX 3.402823466e+38f
#define FLT_EPSILON 1.192092896e-07f
#define FLT_MIN 1.175494351e-38f
#define DBL_EPSILON 1.1920929e-07
#ifdef __cplusplus
}
#endif
#endif

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,17 +141,17 @@ 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;
extern s16 GwLanguageSave;
SHARED_SYM extern s16 GwLanguage;
SHARED_SYM extern s16 GwLanguageSave;
extern PlayerConfig GWPlayerCfg[4];
extern PlayerState GWPlayer[4];
extern SystemState GWSystem;
extern GameStat GWGameStat;
SHARED_SYM extern PlayerConfig GWPlayerCfg[4];
SHARED_SYM extern PlayerState GWPlayer[4];
SHARED_SYM extern SystemState GWSystem;
SHARED_SYM extern GameStat GWGameStat;
static inline s32 GWPlayerCfgGroupGet(s32 player)
{
@ -196,7 +196,8 @@ static inline s32 GWRumbleGet(void)
static inline void GWRumbleSet(s32 value)
{
GWGameStat.rumble = value;
if(value == 0) {
if (value == 0) {
// TODO PC: 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

View file

@ -56,7 +56,6 @@ typedef struct hsf_draw_object {
void Hu3DDrawPreInit(void);
void Hu3DDraw(ModelData *arg0, Mtx arg1, Vec *arg2);
s32 ObjCullCheck(HsfData *arg0, HsfObject *arg1, Mtx arg2);
void FaceDraw(HsfDrawObject *arg0, HsfFace *arg1);
void Hu3DDrawPost(void);
void MakeDisplayList(s16 arg0, u32 arg1);
HsfConstData *ObjConstantMake(HsfObject *arg0, u32 arg1);

View file

@ -1,9 +1,159 @@
#ifndef _GAME_JMP_H
#define _GAME_JMP_H
#ifdef TARGET_PC
#include <setjmp.h>
#include <stdint.h>
#define SETJMP setjmp
#define LONGJMP longjmp
#ifndef _JMP_BUF_DEFINED
#if defined(_M_IX86) || defined(__i386__)
typedef struct __JUMP_BUFFER {
uint32_t Ebp;
uint32_t Ebx;
uint32_t Edi;
uint32_t Esi;
uint32_t Esp;
uint32_t Eip;
uint32_t Registration;
uint32_t TryLevel;
uint32_t Cookie;
uint32_t UnwindFunc;
uint32_t UnwindData[6];
} _JUMP_BUFFER;
#elif defined(_M_X64) || defined(__x86_64__)
#ifndef SETJMP_FLOAT128
// TODO do we need to align this?
typedef struct _SETJMP_FLOAT128 {
uint64_t Part[2];
} SETJMP_FLOAT128;
#endif
typedef struct _JUMP_BUFFER {
uint64_t Frame;
uint64_t Rbx;
uint64_t Rsp;
uint64_t Rbp;
uint64_t Rsi;
uint64_t Rdi;
uint64_t R12;
uint64_t R13;
uint64_t R14;
uint64_t R15;
uint64_t Rip;
uint32_t MxCsr;
uint16_t FpCsr;
uint16_t Spare;
SETJMP_FLOAT128 Xmm6;
SETJMP_FLOAT128 Xmm7;
SETJMP_FLOAT128 Xmm8;
SETJMP_FLOAT128 Xmm9;
SETJMP_FLOAT128 Xmm10;
SETJMP_FLOAT128 Xmm11;
SETJMP_FLOAT128 Xmm12;
SETJMP_FLOAT128 Xmm13;
SETJMP_FLOAT128 Xmm14;
SETJMP_FLOAT128 Xmm15;
} _JUMP_BUFFER;
#elif defined(_M_ARM) || defined(__arm__)
typedef struct _JUMP_BUFFER {
uint32_t Frame;
uint32_t R4;
uint32_t R5;
uint32_t R6;
uint32_t R7;
uint32_t R8;
uint32_t R9;
uint32_t R10;
uint32_t R11;
uint32_t Sp;
uint32_t Pc;
uint32_t Fpscr;
uint32_t long D[8]; // D8-D15 VFP/NEON regs
} _JUMP_BUFFER;
#elif defined(_M_ARM64) || defined(__aarch64__)
typedef struct _JUMP_BUFFER {
uint64_t Frame;
uint64_t Reserved;
uint64_t X19; // x19 -- x28: callee saved registers
uint64_t X20;
uint64_t X21;
uint64_t X22;
uint64_t X23;
uint64_t X24;
uint64_t X25;
uint64_t X26;
uint64_t X27;
uint64_t X28;
uint64_t Fp; // x29 frame pointer
uint64_t Lr; // x30 link register
uint64_t Sp; // x31 stack pointer
uint32_t Fpcr; // fp control register
uint32_t Fpsr; // fp status register
double D[8]; // D8-D15 FP regs
} _JUMP_BUFFER;
#elif defined(__riscv)
typedef struct _JUMP_BUFFER {
uint32_t ra;
uint32_t sp;
uint32_t s0;
uint32_t s1;
uint32_t s2;
uint32_t s3;
uint32_t s4;
uint32_t s5;
uint32_t s6;
uint32_t s7;
uint32_t s8;
uint32_t s9;
uint32_t s10;
uint32_t s11;
#if __riscv_xlen == 64
uint64_t fs0;
uint64_t fs1;
uint64_t fs2;
uint64_t fs3;
uint64_t fs4;
uint64_t fs5;
uint64_t fs6;
uint64_t fs7;
uint64_t fs8;
uint64_t fs9;
uint64_t fs10;
uint64_t fs11;
#endif
} _JUMP_BUFFER;
#endif
#endif
#if defined(_M_IX86) || defined(__i386__)
#define SETJMP_SET_IP(jump, func) ((_JUMP_BUFFER *)((jump)))->Eip = (size_t)func
#define SETJMP_SET_SP(jump, sp) ((_JUMP_BUFFER *)((jump)))->Esp = (size_t)sp
#elif defined(_M_X64) || defined(__x86_64__)
#define SETJMP_SET_IP(jump, func) ((_JUMP_BUFFER *)((jump)))->Rip = (size_t)func
#define SETJMP_SET_SP(jump, sp) ((_JUMP_BUFFER *)((jump)))->Rsp = (size_t)sp
#elif defined(_M_ARM) || defined(__arm__)
#define SETJMP_SET_IP(jump, func) ((_JUMP_BUFFER *)((jump)))->Pc = (size_t)func
#define SETJMP_SET_SP(jump, sp) ((_JUMP_BUFFER *)((jump)))->Sp = (size_t)sp
#elif defined(_M_ARM64) || defined(__aarch64__)
#define SETJMP_SET_IP(jump, func) ((_JUMP_BUFFER *)((jump)))->Lr = (size_t)func
#define SETJMP_SET_SP(jump, sp) ((_JUMP_BUFFER *)((jump)))->Sp = (size_t)sp
#elif defined(__riscv)
#define SETJMP_SET_IP(jump, func) ((_JUMP_BUFFER *)((jump)))->ra = (size_t)func
#define SETJMP_SET_SP(jump, sp) ((_JUMP_BUFFER *)((jump)))->sp = (size_t)sp
#endif
#else
#include "dolphin.h"
typedef struct jump_buf {
typedef struct jmp_buf {
u32 lr;
u32 cr;
u32 sp;
@ -16,4 +166,11 @@ typedef struct jump_buf {
s32 gcsetjmp(jmp_buf *jump);
s32 gclongjmp(jmp_buf *jump, s32 status);
#define SETJMP(jump) gcsetjmp(&(jump))
#define LONGJMP(jump, status) gclongjmp(&(jump), (status))
#define SETJMP_SET_IP(jump, func) jump.lr = (u32)func
#define SETJMP_SET_SP(jump, stack_ptr) jump.sp = (u32)stack_ptr
#endif
#endif

View file

@ -28,14 +28,14 @@ u32 HuMemHeapSizeGet(HeapID heap);
void *HuMemHeapPtrGet(HeapID heap);
void *HuMemHeapInit(void *ptr, s32 size);
void *HuMemMemoryAlloc(void *heap_ptr, s32 size, u32 retaddr);
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, u32 retaddr);
void HuMemMemoryFree(void *ptr, u32 retaddr);
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, u32 retaddr);
void *HuMemMemoryAlloc(void *heap_ptr, s32 size, uintptr_t retaddr);
void *HuMemMemoryAllocNum(void *heap_ptr, s32 size, u32 num, uintptr_t retaddr);
void HuMemMemoryFree(void *ptr, uintptr_t retaddr);
void HuMemMemoryFreeNum(void *heap_ptr, u32 num, uintptr_t retaddr);
s32 HuMemUsedMemorySizeGet(void *heap_ptr);
s32 HuMemUsedMemoryBlockGet(void *heap_ptr);
s32 HuMemMemorySizeGet(void *ptr);
s32 HuMemMemoryAllocSizeGet(s32 size);
void HuMemHeapDump(void *heap_ptr, s16 status);
#endif
#endif

View file

@ -185,6 +185,7 @@ int msmMusPlay(int musId, MSM_MUSPARAM *musParam);
s32 msmMusStop(int musNo, s32 speed);
void msmMusPauseAll(BOOL pause, s32 speed);
s32 msmMusPause(int musNo, BOOL pause, s32 speed);
void msmMusFdoutEnd(void);
s32 msmMusGetMidiCtrl(int musNo, s32 channel, s32 ctrl);
void msmMusStopAll(BOOL checkGrp, s32 speed);
s32 msmMusGetStatus(int musNo);

View file

@ -5,6 +5,10 @@
#include "game/process.h"
#include "game/dvd.h"
#ifdef _WIN32
#include <windows.h>
#endif
#define OM_DLL_MAX 20
#define OVL_DEFINE(name, path) name,
@ -60,9 +64,14 @@ typedef struct om_obj_data {
typedef struct om_dll_data {
char *name;
#if _WIN32
HMODULE hModule;
#else
OSModuleHeader *module;
void *bss;
s32 ret;
#endif
} omDllData;
void omMasterInit(s32 prio, FileListEntry *ovl_list, s32 ovl_count, OverlayID start_ovl);
@ -112,26 +121,26 @@ void omSysPauseCtrl(s16 flag);
extern omObjData *omDBGSysKeyObj;
extern Process *omwatchproc;
extern OverlayID omnextovl;
extern OverlayID omcurovl;
SHARED_SYM extern OverlayID omcurovl;
extern s32 omcurdll;
extern s32 omovlhisidx;
extern s32 omovlevtno;
SHARED_SYM extern s32 omovlhisidx;
SHARED_SYM extern s32 omovlevtno;
extern s32 omnextovlevtno;
extern u32 omovlstat;
SHARED_SYM extern u32 omovlstat;
extern char omUPauseFlag;
extern s16 omSysExitReq;
SHARED_SYM extern s16 omSysExitReq;
extern s16 omdispinfo;
extern u8 omSysPauseEnableFlag;
extern OverlayID omprevovl;
extern omDllData *omDLLinfoTbl[OM_DLL_MAX];
extern Vec CRot;
extern Vec Center;
extern float CZoom;
extern Vec CRotM[16];
extern Vec CenterM[16];
extern float CZoomM[16];
extern s16 omDBGMenuButton;
SHARED_SYM extern Vec CRot;
SHARED_SYM extern Vec Center;
SHARED_SYM extern float CZoom;
SHARED_SYM extern Vec CRotM[16];
SHARED_SYM extern Vec CenterM[16];
SHARED_SYM extern float CZoomM[16];
SHARED_SYM extern s16 omDBGMenuButton;
#endif

View file

@ -2,23 +2,24 @@
#define _GAME_PAD_H
#include "dolphin.h"
#include "version.h"
#define PAD_BUTTON_DIR (PAD_BUTTON_LEFT | PAD_BUTTON_RIGHT | PAD_BUTTON_UP | PAD_BUTTON_DOWN)
#define PAD_BUTTON_TRIGGER_L 0x4000
#define PAD_BUTTON_TRIGGER_R 0x2000
extern u16 HuPadBtn[4];
extern u16 HuPadBtnDown[4];
extern u16 HuPadBtnRep[4];
extern s8 HuPadStkX[4];
extern s8 HuPadStkY[4];
extern s8 HuPadSubStkX[4];
extern s8 HuPadSubStkY[4];
extern u8 HuPadTrigL[4];
extern u8 HuPadTrigR[4];
extern u8 HuPadDStk[4];
extern u8 HuPadDStkRep[4];
SHARED_SYM extern u16 HuPadBtn[4];
SHARED_SYM extern u16 HuPadBtnDown[4];
SHARED_SYM extern u16 HuPadBtnRep[4];
SHARED_SYM extern s8 HuPadStkX[4];
SHARED_SYM extern s8 HuPadStkY[4];
SHARED_SYM extern s8 HuPadSubStkX[4];
SHARED_SYM extern s8 HuPadSubStkY[4];
SHARED_SYM extern u8 HuPadTrigL[4];
SHARED_SYM extern u8 HuPadTrigR[4];
SHARED_SYM extern u8 HuPadDStk[4];
SHARED_SYM extern u8 HuPadDStkRep[4];
extern s8 HuPadErr[4];
extern u16 _PadBtn[4];
extern u16 _PadBtnDown[4];
@ -32,4 +33,4 @@ void HuPadRumbleAllStop(void);
s16 HuPadStatGet(s16 pad);
u32 HuPadRumbleGet(void);
#endif
#endif

View file

@ -1,9 +1,14 @@
#ifndef _GAME_PROCESS_H
#define _GAME_PROCESS_H
#include "game/jmp.h"
#include "dolphin/types.h"
#include "game/jmp.h"
#ifdef TARGET_PC
#include <stdio.h>
#endif
#define PROCESS_STAT_PAUSE 0x1
#define PROCESS_STAT_UPAUSE 0x2
#define PROCESS_STAT_PAUSE_EN 0x4
@ -50,4 +55,4 @@ void HuPrcResetStat(Process *process, u16 value);
void HuPrcAllPause(s32 flag);
void HuPrcAllUPause(s32 flag);
#endif
#endif

9
include/game/sreset.h Normal file
View file

@ -0,0 +1,9 @@
#ifndef _GAME_SRESET_H
#define _GAME_SRESET_H
#include "dolphin.h"
s32 HuSoftResetButtonCheck(void);
void HuDvdErrDispInit(GXRenderModeObj *rmode, void *xfb1, void *xfb2);
#endif

View file

@ -3,6 +3,7 @@
#include "game/animdata.h"
#include "dolphin.h"
#include "version.h"
#define MAKE_MESSID(bank, mess) (((bank) << 16)+(mess))
#define MAKE_MESSID_PTR(ptr) ((u32)(ptr))
@ -75,8 +76,8 @@ typedef struct {
/* 0x160 */ u8 ATTRIBUTE_ALIGN(32) mess_pal[10][3];
} WindowData; // Size 0x180
extern WindowData winData[32];
extern void *messDataPtr;
SHARED_SYM extern WindowData winData[32];
SHARED_SYM extern void *messDataPtr;
void HuWindowInit(void);
void HuWinInit(s32 mess_data_no);
@ -139,6 +140,4 @@ void HuWinExCleanup(s16 window);
void HuWinExAnimPopIn(s16 window, s16 portrait);
void *MessData_MesPtrGet(void *data, u32 index);
extern void *messDataPtr;
#endif

View file

@ -2,6 +2,7 @@
#define _GAME_WIPE_H
#include "dolphin.h"
#include "version.h"
#define WIPE_TYPE_PREV -1
#define WIPE_TYPE_NORMAL 0
@ -37,7 +38,7 @@ void WipeCreate(s16 mode, s16 type, s16 duration);
void WipeColorSet(u8 r, u8 g, u8 b);
u8 WipeStatGet(void);
extern WipeState wipeData;
SHARED_SYM extern WipeState wipeData;
extern BOOL wipeFadeInF;
#endif

View file

@ -1,127 +0,0 @@
#ifndef _MATH_H
#define _MATH_H
#define M_PI 3.141592653589793
#ifndef _MATH_INLINE
#define _MATH_INLINE static inline
#endif
extern int __float_nan[];
extern int __float_huge[];
extern int __double_huge[];
#define INFINITY (*(float *)__float_huge)
#define NAN (*(float *)__float_nan)
#define HUGE_VAL (*(double *)__double_huge)
#ifdef __MWERKS__
extern inline double sqrt(double x)
{
if (x > 0.0) {
double guess = __frsqrte(x); /* returns an approximation to */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 8 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 16 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have 32 sig bits */
guess = .5 * guess * (3.0 - guess * guess * x); /* now have > 53 sig bits */
return x * guess;
}
else if (x == 0)
return 0;
else if (x)
return NAN;
return INFINITY;
}
extern inline float sqrtf(float x)
{
static const double _half = .5;
static const double _three = 3.0;
volatile float y;
if (x > 0.0f) {
double guess = __frsqrte((double)x); // returns an approximation to
guess = _half * guess * (_three - guess * guess * x); // now have 12 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 24 sig bits
guess = _half * guess * (_three - guess * guess * x); // now have 32 sig bits
y = (float)(x * guess);
return y;
}
return x;
}
#else
double sqrt(double x);
float sqrtf(float x);
#endif
double atan(double x);
double copysign(double x, double y);
double cos(double x);
double floor(double x);
double frexp(double x, int *exp);
double ldexp(double x, int exp);
double modf(double x, double *intpart);
double sin(double x);
double tan(double x);
double acos(double x);
double asin(double x);
double atan2(double y, double x);
double fmod(double x, double y);
double log(double x);
double pow(double x, double y);
float tanf(float x);
#ifdef __MWERKS__
extern inline double fabs(double x)
{
return __fabs(x);
}
#else
double fabs(double x);
#endif
_MATH_INLINE float fabsf(float x)
{
return (float)fabs((double)x);
}
_MATH_INLINE float sinf(float x)
{
return (float)sin((double)x);
}
_MATH_INLINE float cosf(float x)
{
return (float)cos((double)x);
}
_MATH_INLINE float atan2f(float y, float x)
{
return (float)atan2((double)y, (double)x);
}
_MATH_INLINE float atanf(float x)
{
return (float)atan((double)x);
}
_MATH_INLINE float asinf(float x)
{
return (float)asin((double)x);
}
_MATH_INLINE float acosf(float x)
{
return (float)acos((double)x);
}
_MATH_INLINE float fmodf(float x, float m)
{
return (float)fmod((double)x, (double)m);
}
_MATH_INLINE float floorf(float x)
{
return floor(x);
}
_MATH_INLINE float powf(float __x, float __y)
{
return pow(__x, __y);
}
#endif

View file

@ -1,108 +1,108 @@
#include "version.h"
OVL_DEFINE(OVL__MINI, "dll/_minigameDLL.rel")
OVL_DEFINE(OVL_BOOT, "dll/bootdll.rel")
OVL_DEFINE(OVL_E3SETUP, "dll/e3setupDLL.rel")
OVL_DEFINE(OVL_INST, "dll/instdll.rel")
OVL_DEFINE(OVL_M300, "dll/m300dll.rel")
OVL_DEFINE(OVL_M302, "dll/m302dll.rel")
OVL_DEFINE(OVL_M303, "dll/m303dll.rel")
OVL_DEFINE(OVL_M330, "dll/m330dll.rel")
OVL_DEFINE(OVL_M333, "dll/m333dll.rel")
OVL_DEFINE(OVL_M401, "dll/m401dll.rel")
OVL_DEFINE(OVL_M402, "dll/m402dll.rel")
OVL_DEFINE(OVL_M403, "dll/m403dll.rel")
OVL_DEFINE(OVL_M404, "dll/m404dll.rel")
OVL_DEFINE(OVL_M405, "dll/m405dll.rel")
OVL_DEFINE(OVL_M406, "dll/m406dll.rel")
OVL_DEFINE(OVL_M407, "dll/m407dll.rel")
OVL_DEFINE(OVL_M408, "dll/m408dll.rel")
OVL_DEFINE(OVL_M409, "dll/m409dll.rel")
OVL_DEFINE(OVL_M410, "dll/m410dll.rel")
OVL_DEFINE(OVL_M411, "dll/m411dll.rel")
OVL_DEFINE(OVL_M412, "dll/m412dll.rel")
OVL_DEFINE(OVL_M413, "dll/m413dll.rel")
OVL_DEFINE(OVL_M414, "dll/m414dll.rel")
OVL_DEFINE(OVL_M415, "dll/m415dll.rel")
OVL_DEFINE(OVL_M416, "dll/m416dll.rel")
OVL_DEFINE(OVL_M417, "dll/m417dll.rel")
OVL_DEFINE(OVL_M418, "dll/m418dll.rel")
OVL_DEFINE(OVL_M419, "dll/m419dll.rel")
OVL_DEFINE(OVL_M420, "dll/m420dll.rel")
OVL_DEFINE(OVL_M421, "dll/m421dll.rel")
OVL_DEFINE(OVL_M422, "dll/m422dll.rel")
OVL_DEFINE(OVL_M423, "dll/m423dll.rel")
OVL_DEFINE(OVL_M424, "dll/m424dll.rel")
OVL_DEFINE(OVL_M425, "dll/m425dll.rel")
OVL_DEFINE(OVL_M426, "dll/m426dll.rel")
OVL_DEFINE(OVL_M427, "dll/m427dll.rel")
OVL_DEFINE(OVL_M428, "dll/m428dll.rel")
OVL_DEFINE(OVL_M429, "dll/m429dll.rel")
OVL_DEFINE(OVL_M430, "dll/m430dll.rel")
OVL_DEFINE(OVL_M431, "dll/m431dll.rel")
OVL_DEFINE(OVL_M432, "dll/m432dll.rel")
OVL_DEFINE(OVL_M433, "dll/m433dll.rel")
OVL_DEFINE(OVL_M434, "dll/m434dll.rel")
OVL_DEFINE(OVL_M435, "dll/m435dll.rel")
OVL_DEFINE(OVL_M436, "dll/m436dll.rel")
OVL_DEFINE(OVL_M437, "dll/m437dll.rel")
OVL_DEFINE(OVL_M438, "dll/m438dll.rel")
OVL_DEFINE(OVL_M439, "dll/m439dll.rel")
OVL_DEFINE(OVL_M440, "dll/m440dll.rel")
OVL_DEFINE(OVL_M441, "dll/m441dll.rel")
OVL_DEFINE(OVL_M442, "dll/m442dll.rel")
OVL_DEFINE(OVL_M443, "dll/m443dll.rel")
OVL_DEFINE(OVL_M444, "dll/m444dll.rel")
OVL_DEFINE(OVL_M445, "dll/m445dll.rel")
OVL_DEFINE(OVL_M446, "dll/m446dll.rel")
OVL_DEFINE(OVL_M447, "dll/m447dll.rel")
OVL_DEFINE(OVL_M448, "dll/m448dll.rel")
OVL_DEFINE(OVL_M449, "dll/m449dll.rel")
OVL_DEFINE(OVL_M450, "dll/m450dll.rel")
OVL_DEFINE(OVL_M451, "dll/m451dll.rel")
OVL_DEFINE(OVL_M453, "dll/m453dll.rel")
OVL_DEFINE(OVL_M455, "dll/m455dll.rel")
OVL_DEFINE(OVL_M456, "dll/m456dll.rel")
OVL_DEFINE(OVL_M457, "dll/m457dll.rel")
OVL_DEFINE(OVL_M458, "dll/m458dll.rel")
OVL_DEFINE(OVL_M459, "dll/m459dll.rel")
OVL_DEFINE(OVL_M460, "dll/m460dll.rel")
OVL_DEFINE(OVL_M461, "dll/m461dll.rel")
OVL_DEFINE(OVL_M462, "dll/m462dll.rel")
OVL_DEFINE(OVL_M463, "dll/m463dll.rel")
OVL_DEFINE(OVL_MENT, "dll/mentdll.rel")
OVL_DEFINE(OVL__MINI, "_minigameDLL")
OVL_DEFINE(OVL_BOOT, "bootdll")
OVL_DEFINE(OVL_E3SETUP, "e3setupDLL")
OVL_DEFINE(OVL_INST, "instdll")
OVL_DEFINE(OVL_M300, "m300dll")
OVL_DEFINE(OVL_M302, "m302dll")
OVL_DEFINE(OVL_M303, "m303dll")
OVL_DEFINE(OVL_M330, "m330dll")
OVL_DEFINE(OVL_M333, "m333dll")
OVL_DEFINE(OVL_M401, "m401dll")
OVL_DEFINE(OVL_M402, "m402dll")
OVL_DEFINE(OVL_M403, "m403dll")
OVL_DEFINE(OVL_M404, "m404dll")
OVL_DEFINE(OVL_M405, "m405dll")
OVL_DEFINE(OVL_M406, "m406dll")
OVL_DEFINE(OVL_M407, "m407dll")
OVL_DEFINE(OVL_M408, "m408dll")
OVL_DEFINE(OVL_M409, "m409dll")
OVL_DEFINE(OVL_M410, "m410dll")
OVL_DEFINE(OVL_M411, "m411dll")
OVL_DEFINE(OVL_M412, "m412dll")
OVL_DEFINE(OVL_M413, "m413dll")
OVL_DEFINE(OVL_M414, "m414dll")
OVL_DEFINE(OVL_M415, "m415dll")
OVL_DEFINE(OVL_M416, "m416dll")
OVL_DEFINE(OVL_M417, "m417dll")
OVL_DEFINE(OVL_M418, "m418dll")
OVL_DEFINE(OVL_M419, "m419dll")
OVL_DEFINE(OVL_M420, "m420dll")
OVL_DEFINE(OVL_M421, "m421dll")
OVL_DEFINE(OVL_M422, "m422dll")
OVL_DEFINE(OVL_M423, "m423dll")
OVL_DEFINE(OVL_M424, "m424dll")
OVL_DEFINE(OVL_M425, "m425dll")
OVL_DEFINE(OVL_M426, "m426dll")
OVL_DEFINE(OVL_M427, "m427dll")
OVL_DEFINE(OVL_M428, "m428dll")
OVL_DEFINE(OVL_M429, "m429dll")
OVL_DEFINE(OVL_M430, "m430dll")
OVL_DEFINE(OVL_M431, "m431dll")
OVL_DEFINE(OVL_M432, "m432dll")
OVL_DEFINE(OVL_M433, "m433dll")
OVL_DEFINE(OVL_M434, "m434dll")
OVL_DEFINE(OVL_M435, "m435dll")
OVL_DEFINE(OVL_M436, "m436dll")
OVL_DEFINE(OVL_M437, "m437dll")
OVL_DEFINE(OVL_M438, "m438dll")
OVL_DEFINE(OVL_M439, "m439dll")
OVL_DEFINE(OVL_M440, "m440dll")
OVL_DEFINE(OVL_M441, "m441dll")
OVL_DEFINE(OVL_M442, "m442dll")
OVL_DEFINE(OVL_M443, "m443dll")
OVL_DEFINE(OVL_M444, "m444dll")
OVL_DEFINE(OVL_M445, "m445dll")
OVL_DEFINE(OVL_M446, "m446dll")
OVL_DEFINE(OVL_M447, "m447dll")
OVL_DEFINE(OVL_M448, "m448dll")
OVL_DEFINE(OVL_M449, "m449dll")
OVL_DEFINE(OVL_M450, "m450dll")
OVL_DEFINE(OVL_M451, "m451dll")
OVL_DEFINE(OVL_M453, "m453dll")
OVL_DEFINE(OVL_M455, "m455dll")
OVL_DEFINE(OVL_M456, "m456dll")
OVL_DEFINE(OVL_M457, "m457dll")
OVL_DEFINE(OVL_M458, "m458dll")
OVL_DEFINE(OVL_M459, "m459dll")
OVL_DEFINE(OVL_M460, "m460dll")
OVL_DEFINE(OVL_M461, "m461dll")
OVL_DEFINE(OVL_M462, "m462dll")
OVL_DEFINE(OVL_M463, "m463dll")
OVL_DEFINE(OVL_MENT, "mentdll")
#if VERSION_JP
OVL_DEFINE(OVL_MGMODE, "dll/mgmodedll.rel")
OVL_DEFINE(OVL_MODELTEST, "dll/modeltestdll.rel")
OVL_DEFINE(OVL_MODESEL, "dll/modeseldll.rel")
OVL_DEFINE(OVL_MOVIE, "dll/moviedll.rel")
OVL_DEFINE(OVL_MGMODE, "mgmodedll")
OVL_DEFINE(OVL_MODELTEST, "modeltestdll")
OVL_DEFINE(OVL_MODESEL, "modeseldll")
OVL_DEFINE(OVL_MOVIE, "moviedll")
#else
OVL_DEFINE(OVL_MESS, "dll/messdll.rel")
OVL_DEFINE(OVL_MGMODE, "dll/mgmodedll.rel")
OVL_DEFINE(OVL_MODELTEST, "dll/modeltestdll.rel")
OVL_DEFINE(OVL_MODESEL, "dll/modeseldll.rel")
OVL_DEFINE(OVL_MESS, "messdll")
OVL_DEFINE(OVL_MGMODE, "mgmodedll")
OVL_DEFINE(OVL_MODELTEST, "modeltestdll")
OVL_DEFINE(OVL_MODESEL, "modeseldll")
#endif
OVL_DEFINE(OVL_MPEX, "dll/mpexdll.rel")
OVL_DEFINE(OVL_MSETUP, "dll/msetupdll.rel")
OVL_DEFINE(OVL_MSTORY2, "dll/mstory2dll.rel")
OVL_DEFINE(OVL_MSTORY3, "dll/mstory3dll.rel")
OVL_DEFINE(OVL_MSTORY4, "dll/mstory4dll.rel")
OVL_DEFINE(OVL_MSTORY, "dll/mstorydll.rel")
OVL_DEFINE(OVL_NIS, "dll/nisdll.rel")
OVL_DEFINE(OVL_OPTION, "dll/option.rel")
OVL_DEFINE(OVL_PRESENT, "dll/present.rel")
OVL_DEFINE(OVL_RESULT, "dll/resultdll.rel")
OVL_DEFINE(OVL_SAF, "dll/safdll.rel")
OVL_DEFINE(OVL_SELMENU, "dll/selmenuDLL.rel")
OVL_DEFINE(OVL_STAFF, "dll/staffdll.rel")
OVL_DEFINE(OVL_SUBCHRSEL, "dll/subchrseldll.rel")
OVL_DEFINE(OVL_W01, "dll/w01dll.rel")
OVL_DEFINE(OVL_W02, "dll/w02dll.rel")
OVL_DEFINE(OVL_W03, "dll/w03dll.rel")
OVL_DEFINE(OVL_W04, "dll/w04dll.rel")
OVL_DEFINE(OVL_W05, "dll/w05dll.rel")
OVL_DEFINE(OVL_W06, "dll/w06dll.rel")
OVL_DEFINE(OVL_W10, "dll/w10dll.rel")
OVL_DEFINE(OVL_W20, "dll/w20dll.rel")
OVL_DEFINE(OVL_W21, "dll/w21dll.rel")
OVL_DEFINE(OVL_ZTAR, "dll/ztardll.rel")
OVL_DEFINE(OVL_MPEX, "mpexdll")
OVL_DEFINE(OVL_MSETUP, "msetupdll")
OVL_DEFINE(OVL_MSTORY2, "mstory2dll")
OVL_DEFINE(OVL_MSTORY3, "mstory3dll")
OVL_DEFINE(OVL_MSTORY4, "mstory4dll")
OVL_DEFINE(OVL_MSTORY, "mstorydll")
OVL_DEFINE(OVL_NIS, "nisdll")
OVL_DEFINE(OVL_OPTION, "option")
OVL_DEFINE(OVL_PRESENT, "present")
OVL_DEFINE(OVL_RESULT, "resultdll")
OVL_DEFINE(OVL_SAF, "safdll")
OVL_DEFINE(OVL_SELMENU, "selmenuDLL")
OVL_DEFINE(OVL_STAFF, "staffdll")
OVL_DEFINE(OVL_SUBCHRSEL, "subchrseldll")
OVL_DEFINE(OVL_W01, "w01dll")
OVL_DEFINE(OVL_W02, "w02dll")
OVL_DEFINE(OVL_W03, "w03dll")
OVL_DEFINE(OVL_W04, "w04dll")
OVL_DEFINE(OVL_W05, "w05dll")
OVL_DEFINE(OVL_W06, "w06dll")
OVL_DEFINE(OVL_W10, "w10dll")
OVL_DEFINE(OVL_W20, "w20dll")
OVL_DEFINE(OVL_W21, "w21dll")
OVL_DEFINE(OVL_ZTAR, "ztardll")

28
include/port/byteswap.h Normal file
View file

@ -0,0 +1,28 @@
#ifndef _SRC_BYTESWAP_H_
#define _SRC_BYTESWAP_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include "game/animdata.h"
#include "game/hsfformat.h"
void byteswap_u32(u32 *src);
void byteswap_s32(s32 *src);
void byteswap_animdata(void *src, AnimData* dest);
void byteswap_animbankdata(void *src, AnimBankData *dest);
void byteswap_animpatdata(void *src, AnimPatData *dest);
void byteswap_animbmpdata(void *src, AnimBmpData *dest);
void byteswap_animframedata(AnimFrameData *src);
void byteswap_animlayerdata(AnimLayerData *src);
void byteswap_hsfheader(HsfHeader *src);
#ifdef __cplusplus
}
#endif
#endif

18
include/port/imgui.h Normal file
View file

@ -0,0 +1,18 @@
#ifndef _SRC_IMGUI_H_
#define _SRC_IMGUI_H_
#include <aurora/aurora.h>
#ifdef __cplusplus
extern "C"
{
#endif
void imgui_main(const AuroraInfo* info);
void frame_limiter();
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,39 +0,0 @@
#ifndef _MSL_COMMON_STDARG_H
#define _MSL_COMMON_STDARG_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __MWERKS__
typedef struct {
char gpr;
char fpr;
char reserved[2];
char* input_arg_area;
char* reg_save_area;
} __va_list[1];
typedef __va_list va_list;
#ifndef __MWERKS__
extern void __builtin_va_info(va_list*);
#endif
void* __va_arg(va_list v_list, unsigned char type);
#define va_start(ap, fmt) ((void)fmt, __builtin_va_info(&ap))
#define va_arg(ap, t) (*((t*)__va_arg(ap, _var_arg_typeof(t))))
#define va_end(ap) (void)0
#else
typedef __builtin_va_list va_list;
#define va_start(v, l) __builtin_va_start(v, l)
#define va_end(v) __builtin_va_end(v)
#define va_arg(v, l) __builtin_va_arg(v, l)
#endif
#ifdef __cplusplus
}
#endif
#endif /* _MSL_COMMON_STDARG_H */

View file

@ -1,28 +0,0 @@
#ifndef _STDDEF_H_
#define _STDDEF_H_
#ifdef __cplusplus
extern "C" {
#endif
#define offsetof(type, member) ((size_t) & (((type*)0)->member))
/* These break 1.2.5 */
//typedef __typeof__(sizeof(0)) size_t;
//typedef __typeof__((char*)0 - (char*)0) ptrdiff_t;
#ifdef __INTELLISENSE__
typedef unsigned int size_t;
typedef int ptrdiff_t;
#else
typedef unsigned long size_t;
typedef long ptrdiff_t;
#endif
#ifndef NULL
#define NULL 0L
#endif
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,14 +0,0 @@
#ifndef _STDINT_H_
#define _STDINT_H_
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned long int uintptr_t;
#ifdef __cplusplus
}
#endif
#endif

View file

@ -1,12 +0,0 @@
#ifndef _STDIO_H_
#define _STDIO_H_
#include "stdarg.h"
int puts(const char* s);
int printf(const char*, ...);
int sprintf(char* s, const char* format, ...);
int vprintf(const char* format, va_list arg);
int vsprintf(char* s, const char* format, va_list arg);
#endif

View file

@ -1,10 +0,0 @@
#ifndef _STDLIB_H
#define _STDLIB_H
#ifdef __MWERKS__
#define abs(x) __abs(x)
#else
int abs(int x);
#endif
#endif

View file

@ -1,18 +0,0 @@
#ifndef _STRING_H_
#define _STRING_H_
typedef unsigned long size_t;
void* memcpy(void* dst, const void* src, size_t n);
void* memset(void* dst, int val, size_t n);
char* strrchr(const char* str, int c);
char* strchr(const char* str, int c);
int strncmp(const char* str1, const char* str2, size_t n);
int strcmp(const char* str1, const char* str2);
char* strcat(char* dst, const char* src, size_t n);
char* strncpy(char* dst, const char* src, size_t n);
char* strcpy(char* dst, const char* src);
size_t strlen(const char* str);
#endif

View file

@ -21,4 +21,15 @@
#define REFRESH_RATE 60
#endif
#if _WIN32
#ifdef TARGET_DOL
#define SHARED_SYM __declspec(dllexport)
#else
#define SHARED_SYM __declspec(dllimport)
#endif
#else
#define SHARED_SYM
#endif
#endif