From eddb0ba43ea75705d2ced3601da019ca2f802a42 Mon Sep 17 00:00:00 2001 From: JaceCear <11230293+JaceCear@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:10:18 +0100 Subject: [PATCH] Split GAME_ and ENGINE_ macros --- include/config.h | 18 ++++++++++++++---- include/game/game.h | 6 ------ include/sprite.h | 2 +- src/core.c | 6 ++++-- src/multi_sio.c | 2 +- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/include/config.h b/include/config.h index afadc0557..ee95e6bad 100644 --- a/include/config.h +++ b/include/config.h @@ -3,13 +3,23 @@ /* TODO: Move config.h into a different location? */ -#define GAME_SA1 1 -#define GAME_SA2 2 -#define GAME_SA3 3 +#define GAME_SA1 1 +#define GAME_SA2 2 +#define GAME_SA3 3 +#define GAME_KATAM 4 -// TODO: Define this in Makefile through a compiler macro! +#define ENGINE_1 1 +#define ENGINE_2 2 +#define ENGINE_3 3 +#define ENGINE_4 4 + +// TODO: Define this in Makefile through a compiler macro? #define GAME GAME_SA2 +// TODO: Do SA1 and SA2 use the same engine ver? +// TODO: Do SA3 and KATAM use the same engine ver? +#define ENGINE GAME + // TODO: Put somewhere else? #if PLATFORM_GBA #define USE_NEW_DMA 0 diff --git a/include/game/game.h b/include/game/game.h index c3621603a..7cc1af7f5 100644 --- a/include/game/game.h +++ b/include/game/game.h @@ -5,10 +5,4 @@ void GameStart(void); -#define GAME_SA1 1 -#define GAME_SA2 2 -#define GAME_SA3 3 -#define GAME_KATAM 4 -#define CURRENT_GAME GAME_SA2 - #endif // GUARD_GAME_H diff --git a/include/sprite.h b/include/sprite.h index 2961d6938..207e98ba3 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -93,7 +93,7 @@ typedef struct { } Background; /* size = 0x40 */ typedef struct { -#if (CURRENT_GAME >= GAME_SA3) +#if (ENGINE >= ENGINE_3) // In SA3 flip-bits are integrated into the oamIndex. // X-Flip: Bit 14 // Y-Flip: Bit 15 diff --git a/src/core.c b/src/core.c index 92e3d439f..cda33891e 100644 --- a/src/core.c +++ b/src/core.c @@ -35,6 +35,8 @@ u8 gNumHBlankIntrs = 0; struct BlendRegs gBldRegs ALIGNED(8) = {}; u8 gOamFreeIndex = 0; struct Task gEmptyTask ALIGNED(16) = {}; + +// NOTE: gNextFreeAffineIndex introduced in SA3, unused before. u8 gNextFreeAffineIndex = 0; BgAffineReg gBgAffineRegs[NUM_AFFINE_BACKGROUNDS] = {}; void *gVramHeapStartAddr = NULL; @@ -251,7 +253,7 @@ void GameInit(void) gBgAffineRegs[1].x = 0; gBgAffineRegs[1].y = 0; -#if (CURRENT_GAME >= GAME_SA3) +#if (GAME >= GAME_SA3) gNextFreeAffineIndex = 0; #endif gUnknown_03001944 = 0; @@ -381,7 +383,7 @@ void GameLoop(void) gFlagsPreVBlank = gFlags; VBlankIntrWait(); -#if (CURRENT_GAME >= GAME_SA3) +#if (GAME >= GAME_SA3) gNextFreeAffineIndex = 0; #endif diff --git a/src/multi_sio.c b/src/multi_sio.c index 6e72757b0..ceb29fdd8 100644 --- a/src/multi_sio.c +++ b/src/multi_sio.c @@ -11,7 +11,7 @@ u32 gMultiSioIntrFuncBuf[0x120 / 4] = {}; // Interrupt Routine RAM Execution Buf struct MultiSioArea gMultiSioArea = {}; -#if (CURRENT_GAME <= GAME_SA2) +#if (GAME <= GAME_SA2) UNUSED u32 gUnusedMultiSioSpace[2] = {}; #endif