From 4f0a8f34d73f3c80ab6368fb6f36bd040e52e768 Mon Sep 17 00:00:00 2001 From: AZero13 <83477269+AZero13@users.noreply.github.com> Date: Mon, 22 Jun 2026 15:20:12 -0400 Subject: [PATCH] UBFix: Have GetMonData2 pass data to GetMonData3 Same with BoxMonData. --- include/pokemon.h | 12 +++++++++++- src/pokemon.c | 5 +++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/pokemon.h b/include/pokemon.h index 414dc417672..c67668cd541 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -343,9 +343,19 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit #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); + +#ifndef UBFIX +u32 GetMonData2(struct Pokemon *mon, s32 field); u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field); +#else +inline u32 GetMonData2(struct Pokemon *mon, s32 field) { + return GetMonData3(mon, field, NULL); +} +inline u32 GetBoxMonData2(struct BoxPokemon *mon, s32 field) { + return GetBoxMonData3(mon, field, NULL); +} +#endif void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg); void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg); diff --git a/src/pokemon.c b/src/pokemon.c index 66a5c3d233e..0c22f027e68 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -2967,7 +2967,10 @@ u32 GetMonData3(struct Pokemon *mon, s32 field, u8 *data) return ret; } +#ifndef UBFIX u32 GetMonData2(struct Pokemon *mon, s32 field) __attribute__((alias("GetMonData3"))); +#endif + /* GameFreak called GetBoxMonData with either 2 or 3 arguments, for type * safety we have a GetBoxMonData macro (in include/pokemon.h) which @@ -3329,7 +3332,9 @@ u32 GetBoxMonData3(struct BoxPokemon *boxMon, s32 field, u8 *data) return retVal; } +#ifndef UBFIX u32 GetBoxMonData2(struct BoxPokemon *boxMon, s32 field) __attribute__((alias("GetBoxMonData3"))); +#endif #define SET8(lhs) (lhs) = *data #define SET16(lhs) (lhs) = data[0] + (data[1] << 8)