Modern fixes (#697)
This commit is contained in:
@@ -170,7 +170,11 @@ struct SoundChannel
|
||||
|
||||
struct MusicPlayerInfo;
|
||||
|
||||
#if __STDC_VERSION__ < 202311L
|
||||
typedef void (*MPlayFunc)();
|
||||
#else
|
||||
typedef void (*MPlayFunc)(...);
|
||||
#endif
|
||||
typedef void (*PlyNoteFunc)(u32, struct MusicPlayerInfo *, struct MusicPlayerTrack *);
|
||||
typedef void (*CgbSoundFunc)(void);
|
||||
typedef void (*CgbOscOffFunc)(u8);
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
#define asm_comment(x) asm volatile("@ -- " x " -- ")
|
||||
#define asm_unified(x) asm(".syntax unified\n" x "\n.syntax divided")
|
||||
|
||||
#if __STDC_VERSION__ < 202311L
|
||||
#define asm __asm__
|
||||
#endif
|
||||
|
||||
// IDE support
|
||||
#if defined(__APPLE__) || defined(__CYGWIN__) || defined(__INTELLISENSE__)
|
||||
// We define these when using certain IDEs to fool preproc
|
||||
@@ -131,6 +135,13 @@ extern u8 gStringVar4[];
|
||||
#define NUM_FLAG_BYTES ROUND_BITS_TO_BYTES(FLAGS_COUNT)
|
||||
#define NUM_ADDITIONAL_PHRASE_BYTES ROUND_BITS_TO_BYTES(NUM_ADDITIONAL_PHRASES)
|
||||
|
||||
// This returns the number of arguments passed to it (up to 8).
|
||||
#define NARG_8(...) NARG_8_(_, ##__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0)
|
||||
#define NARG_8_(_, a, b, c, d, e, f, g, h, N, ...) N
|
||||
|
||||
#define CAT(a, b) CAT_(a, b)
|
||||
#define CAT_(a, b) a ## b
|
||||
|
||||
// This produces an error at compile-time if expr is zero.
|
||||
// It looks like file.c:line: size of array `id' is negative
|
||||
#define STATIC_ASSERT(expr, id) typedef char id[(expr) ? 1 : -1];
|
||||
|
||||
@@ -316,7 +316,11 @@ struct STWIStatus
|
||||
u8 recoveryCount;
|
||||
u8 unk_16;
|
||||
u8 unk_17;
|
||||
#if __STDC_VERSION__ < 202311L
|
||||
void (*callbackM)();
|
||||
#else
|
||||
void (*callbackM)(...);
|
||||
#endif
|
||||
void (*callbackS)(u16);
|
||||
void (*callbackID)(void);
|
||||
union RfuPacket *txPacket;
|
||||
|
||||
+11
-12
@@ -335,18 +335,17 @@ u8 GetGenderFromSpeciesAndPersonality(u16 species, u32 personality);
|
||||
void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition);
|
||||
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition);
|
||||
|
||||
// These are full type signatures for GetMonData() and GetBoxMonData(),
|
||||
// but they are not used since some code erroneously omits the third arg.
|
||||
// u32 GetMonData(struct Pokemon *mon, s32 field, u8 *data);
|
||||
// u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data);
|
||||
|
||||
#ifdef IS_POKEMON_C
|
||||
u32 GetMonData(struct Pokemon *, s32, u8 *);
|
||||
u32 GetBoxMonData(struct BoxPokemon *, s32, u8 *);
|
||||
#else
|
||||
u32 GetMonData();
|
||||
u32 GetBoxMonData();
|
||||
#endif // IS_POKEMON_C
|
||||
/* GameFreak called Get(Box)MonData with either 2 or 3 arguments, for
|
||||
* type safety we have a Get(Box)MonData macro which dispatches to
|
||||
* either Get(Box)MonData2 or Get(Box)MonData3 based on the number of
|
||||
* arguments. The two functions are aliases of each other, but they
|
||||
* differ for matching purposes in the caller's codegen. */
|
||||
#define GetMonData(...) CAT(GetMonData, NARG_8(__VA_ARGS__))(__VA_ARGS__)
|
||||
#define GetBoxMonData(...) CAT(GetBoxMonData, NARG_8(__VA_ARGS__))(__VA_ARGS__)
|
||||
u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data);
|
||||
u32 GetMonData2(struct Pokemon *mon, s32 field);
|
||||
u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data);
|
||||
u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field);
|
||||
|
||||
void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
|
||||
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
|
||||
|
||||
Reference in New Issue
Block a user