From 53b2110373eb506d9c035697c0719851a77936d4 Mon Sep 17 00:00:00 2001 From: cadmic Date: Fri, 6 Sep 2024 02:18:59 -0700 Subject: [PATCH] Clean up uses of !PLATFORM_N64 vs PLATFORM_GC (#2134) * Clean up uses of !PLATFORM_N64 vs PLATFORM_GC * Put N64 button colors first --- include/fault.h | 4 ++-- include/gfxprint.h | 2 +- include/libc/math.h | 2 +- include/rand.h | 2 +- include/z64interface.h | 6 +++--- osMalloc.h | 2 +- src/audio/general.c | 4 ++-- src/audio/sfx.c | 2 +- src/boot/stackcheck.c | 2 +- src/code/fp.s | 2 +- src/code/fp_math.c | 6 +++--- src/code/gfxprint.c | 6 +++--- src/code/rand.c | 6 +++--- src/code/z_eff_ss_dead.c | 2 +- src/code/z_message.c | 2 +- src/code/z_scene_table.c | 4 ++-- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 4 ++-- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 2 +- src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c | 2 +- src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c | 8 ++++---- 20 files changed, 35 insertions(+), 35 deletions(-) diff --git a/include/fault.h b/include/fault.h index ac63a234db..d72b9691c4 100644 --- a/include/fault.h +++ b/include/fault.h @@ -76,7 +76,7 @@ void Fault_DrawText(s32 x, s32 y, const char* fmt, ...); #define Fault_SetFontColor(color) (void)0 #define Fault_SetCharPad(padW, padH) (void)0 -#else +#elif PLATFORM_GC void Fault_InitDrawer(void); void Fault_SetForeColor(u16 color); @@ -93,7 +93,7 @@ extern vs32 gFaultMsgId; #define FAULT_MSG_ID gFaultMsgId -#else +#elif PLATFORM_GC typedef struct FaultMgr { /* 0x000 */ OSThread thread; diff --git a/include/gfxprint.h b/include/gfxprint.h index da63c9e762..86879c4805 100644 --- a/include/gfxprint.h +++ b/include/gfxprint.h @@ -34,7 +34,7 @@ typedef struct GfxPrint { #define GFXP_FLAG_RAINBOW (1 << 1) #define GFXP_FLAG_SHADOW (1 << 2) #define GFXP_FLAG_UPDATE (1 << 3) -#if PLATFORM_GC +#if !PLATFORM_N64 #define GFXP_FLAG_ENLARGE (1 << 6) #endif #define GFXP_FLAG_OPEN (1 << 7) diff --git a/include/libc/math.h b/include/libc/math.h index b893cce72e..b46b6cd911 100644 --- a/include/libc/math.h +++ b/include/libc/math.h @@ -60,7 +60,7 @@ f64 sqrt(f64 f); #pragma intrinsic(sqrt) #endif -#if PLATFORM_GC +#if !PLATFORM_N64 extern float qNaN0x3FFFFF; extern float qNaN0x10000; extern float sNaN0x3FFFFF; diff --git a/include/rand.h b/include/rand.h index 79ced24ea1..0f4f4d9cd3 100644 --- a/include/rand.h +++ b/include/rand.h @@ -10,7 +10,7 @@ void Rand_Seed_Variable(u32* rndNum, u32 seed); u32 Rand_Next_Variable(u32* rndNum); f32 Rand_ZeroOne_Variable(u32* rndNum); -#if PLATFORM_GC +#if !PLATFORM_N64 f32 Rand_Centered(void); f32 Rand_Centered_Variable(u32* rndNum); #endif diff --git a/include/z64interface.h b/include/z64interface.h index c089ce396b..ac5bfc8153 100644 --- a/include/z64interface.h +++ b/include/z64interface.h @@ -151,7 +151,7 @@ typedef struct InterfaceContext { #define A_BUTTON_X 186 #define A_BUTTON_Y 9 -#if PLATFORM_N64 +#if !PLATFORM_GC #define A_BUTTON_R 90 #define A_BUTTON_G 90 #define A_BUTTON_B 255 @@ -164,7 +164,7 @@ typedef struct InterfaceContext { #define B_BUTTON_X 160 #define B_BUTTON_Y 17 -#if PLATFORM_N64 +#if !PLATFORM_GC #define B_BUTTON_R 0 #define B_BUTTON_G 150 #define B_BUTTON_B 0 @@ -186,7 +186,7 @@ typedef struct InterfaceContext { #define C_UP_BUTTON_X 254 #define C_UP_BUTTON_Y 16 -#if PLATFORM_N64 +#if !PLATFORM_GC #define START_BUTTON_R 200 #define START_BUTTON_G 0 #define START_BUTTON_B 0 diff --git a/osMalloc.h b/osMalloc.h index 5fb8dd8e4d..73f310fa17 100644 --- a/osMalloc.h +++ b/osMalloc.h @@ -11,7 +11,7 @@ typedef struct Arena { #if PLATFORM_N64 /* 0x08 */ u32 size; /* 0x0C */ u8 allocFailures; -#else +#elif PLATFORM_GC /* 0x08 */ OSMesgQueue lockQueue; /* 0x20 */ u8 allocFailures; // only used in non-debug builds /* 0x21 */ u8 isInit; diff --git a/src/audio/general.c b/src/audio/general.c index ab33df2946..af5ca719a6 100644 --- a/src/audio/general.c +++ b/src/audio/general.c @@ -3,7 +3,7 @@ #define ABS_ALT(x) ((x) < 0 ? -(x) : (x)) -#if PLATFORM_GC +#if !PLATFORM_N64 #define AUDIO_PRINTF osSyncPrintf #elif IDO_PRINTF_WORKAROUND #define AUDIO_PRINTF(args) (void)0 @@ -858,7 +858,7 @@ NatureAmbienceDataIO sNatureAmbienceDataIO[20] = { }, }; -#if PLATFORM_GC +#if !PLATFORM_N64 u32 sOcarinaAllowedButtonMask = (BTN_A | BTN_CUP | BTN_CDOWN | BTN_CLEFT | BTN_CRIGHT); s32 sOcarinaAButtonMap = BTN_A; s32 sOcarinaCUpButtonMap = BTN_CUP; diff --git a/src/audio/sfx.c b/src/audio/sfx.c index 4debc94b77..90ed7a28f6 100644 --- a/src/audio/sfx.c +++ b/src/audio/sfx.c @@ -342,7 +342,7 @@ void Audio_ChooseActiveSfx(u8 bankId) { entry->sfxId, entry->posX, entry->posZ, *entry->posX, *entry->posY, *entry->posZ); } entry->priority = (u32)entry->dist + (SQ(0xFF - sfxImportance) * SQ(76)); -#if PLATFORM_GC +#if !PLATFORM_N64 temp3 = entry->sfxId; // fake entry->priority = entry->priority + temp3 - temp3; #endif diff --git a/src/boot/stackcheck.c b/src/boot/stackcheck.c index a1cff55e62..399b6c051b 100644 --- a/src/boot/stackcheck.c +++ b/src/boot/stackcheck.c @@ -18,7 +18,7 @@ void StackCheck_Init(StackEntry* entry, void* stackBottom, void* stackTop, u32 i entry->minSpace = minSpace; entry->name = name; -#if PLATFORM_GC +#if !PLATFORM_N64 iter = sStackInfoListStart; while (iter) { if (iter == entry) { diff --git a/src/code/fp.s b/src/code/fp.s index f7a00e2136..d5b42094a3 100644 --- a/src/code/fp.s +++ b/src/code/fp.s @@ -6,7 +6,7 @@ .balign 16 -#if PLATFORM_GC +#if !PLATFORM_N64 DATA(qNaN0x3FFFFF) .word 0x7FBFFFFF ENDDATA(qNaN0x3FFFFF) diff --git a/src/code/fp_math.c b/src/code/fp_math.c index fb73b58ef6..85fb4cedf3 100644 --- a/src/code/fp_math.c +++ b/src/code/fp_math.c @@ -1,7 +1,7 @@ #include "z64math.h" #include "macros.h" -#if PLATFORM_GC +#if !PLATFORM_N64 s32 gUseAtanContFrac; #endif @@ -46,7 +46,7 @@ f32 Math_FNearbyIntF(f32 x) { return nearbyintf(x); } -#if PLATFORM_GC +#if !PLATFORM_N64 /* Arctangent approximation using a Taylor series (one quadrant) */ f32 Math_FAtanTaylorQF(f32 x) { static const f32 coeffs[] = { @@ -173,7 +173,7 @@ f32 Math_FAtanContFracF(f32 x) { #endif } -#if PLATFORM_GC +#if !PLATFORM_N64 /** * @return arctan(x) in radians, in (-pi/2,pi/2) range */ diff --git a/src/code/gfxprint.c b/src/code/gfxprint.c index ac4bb7ced0..6307324edb 100644 --- a/src/code/gfxprint.c +++ b/src/code/gfxprint.c @@ -126,7 +126,7 @@ u8 sGfxPrintFontData[(16 * 256) / 2] = { 0x1B, 0xAA, 0x40, 0x21, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -#if PLATFORM_GC +#if !PLATFORM_N64 // Can be used to set GFXP_FLAG_ENLARGE by default static u8 sDefaultSpecialFlags; #endif @@ -342,7 +342,7 @@ void GfxPrint_Init(GfxPrint* this) { this->flags |= GFXP_FLAG_SHADOW; this->flags |= GFXP_FLAG_UPDATE; -#if PLATFORM_GC +#if !PLATFORM_N64 if (sDefaultSpecialFlags & GFXP_FLAG_ENLARGE) { this->flags |= GFXP_FLAG_ENLARGE; } else { @@ -370,7 +370,7 @@ Gfx* GfxPrint_Close(GfxPrint* this) { Gfx* ret; this->flags &= ~GFXP_FLAG_OPEN; -#if PLATFORM_GC +#if !PLATFORM_N64 gDPPipeSync(this->dList++); #endif ret = this->dList; diff --git a/src/code/rand.c b/src/code/rand.c index 917b1ecfc6..378f0456e9 100644 --- a/src/code/rand.c +++ b/src/code/rand.c @@ -53,7 +53,7 @@ */ static u32 sRandInt = 1; -#if PLATFORM_GC +#if !PLATFORM_N64 /** * Space to store a value to be re-interpreted as a float. * @@ -114,7 +114,7 @@ f32 Rand_ZeroOne(void) { #endif } -#if PLATFORM_GC +#if !PLATFORM_N64 /** * Returns a pseudo-random floating-point number between -0.5f and 0.5f by the same manner in which Rand_ZeroOne * generates its result. @@ -179,7 +179,7 @@ f32 Rand_ZeroOne_Variable(u32* rndNum) { #endif } -#if PLATFORM_GC +#if !PLATFORM_N64 /** * Generates the next pseudo-random floating-point number between -0.5f and 0.5f from the provided rndNum. * diff --git a/src/code/z_eff_ss_dead.c b/src/code/z_eff_ss_dead.c index 2a64a23f4a..3c1adf4cb6 100644 --- a/src/code/z_eff_ss_dead.c +++ b/src/code/z_eff_ss_dead.c @@ -30,7 +30,7 @@ void func_80026400(PlayState* play, Color_RGBA8* color, s16 arg2, s16 arg3) { Gfx* displayListHead; f32 cos; -#if PLATFORM_GC +#if !PLATFORM_N64 if (arg3 == 0) { return; } diff --git a/src/code/z_message.c b/src/code/z_message.c index eff41c44c2..29212d3182 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -10,7 +10,7 @@ #pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" -#if PLATFORM_N64 +#if !PLATFORM_GC #define OCARINA_BUTTON_A_PRIM_R 80 #define OCARINA_BUTTON_A_PRIM_G 150 #define OCARINA_BUTTON_A_PRIM_B 255 diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index ed18c33c62..a2fc170e8e 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -137,7 +137,7 @@ Gfx sDefaultDisplayList[] = { gsSPEndDisplayList(), }; -#if PLATFORM_N64 // Scene_Draw is at end of file in GC versions +#if PLATFORM_N64 // Scene_Draw is at end of file in GC/iQue versions SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { Scene_DrawConfigDefault, // SDC_DEFAULT @@ -1693,7 +1693,7 @@ void Scene_DrawConfigBesitu(PlayState* play) { CLOSE_DISPS(play->state.gfxCtx, "../z_scene_table.c", 7910); } -#if PLATFORM_GC // Scene_Draw is at beginning of file in N64 versions +#if !PLATFORM_N64 // Scene_Draw is at beginning of file in N64 versions SceneDrawConfigFunc sSceneDrawConfigs[SDC_MAX] = { Scene_DrawConfigDefault, // SDC_DEFAULT diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index a5616563d7..bfc625d69a 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -2261,7 +2261,7 @@ void BossMo_UpdateCore(Actor* thisx, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_0; } -#if PLATFORM_GC +#if !PLATFORM_N64 BossMo_SfxTest(); #endif } @@ -3051,7 +3051,7 @@ void BossMo_DrawEffects(BossMoEffect* effect, PlayState* play) { CLOSE_DISPS(gfxCtx, "../z_boss_mo.c", 7482); } -#if PLATFORM_GC +#if !PLATFORM_N64 void BossMo_SfxTest(void) { // Appears to be a test function for sound effects. static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index ff77304215..a0cecf0478 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -16,7 +16,7 @@ #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4) -#if PLATFORM_N64 +#if !PLATFORM_GC #define CURSOR_COLOR_R 0 #define CURSOR_COLOR_G 80 #define CURSOR_COLOR_B 255 diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index db2b3558ec..1f5dcba140 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -2,7 +2,7 @@ #include "assets/textures/parameter_static/parameter_static.h" #include "assets/textures/icon_item_static/icon_item_static.h" -#if PLATFORM_N64 +#if !PLATFORM_GC #define KALEIDO_COLOR_COLLECT_UNK_R 80 #define KALEIDO_COLOR_COLLECT_UNK_G 150 #define KALEIDO_COLOR_COLLECT_UNK_B 255 diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c index c72a47810a..936400e1c0 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.c @@ -15,7 +15,7 @@ #include "assets/textures/icon_item_gameover_static/icon_item_gameover_static.h" #include "terminal.h" -#if PLATFORM_N64 +#if !PLATFORM_GC #define KALEIDO_COLOR_PROMPT_UNK_R 100 #define KALEIDO_COLOR_PROMPT_UNK_G 100 #define KALEIDO_COLOR_PROMPT_UNK_B 255 @@ -3663,7 +3663,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->state = PAUSE_STATE_CLOSING; WREG(2) = -6240; func_800F64E0(0); -#if PLATFORM_GC && OOT_NTSC +#if !PLATFORM_N64 && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif } else if (CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -3811,7 +3811,7 @@ void KaleidoScope_Update(PlayState* play) { WREG(2) = -6240; YREG(8) = pauseCtx->unk_204; func_800F64E0(0); -#if PLATFORM_GC && OOT_NTSC +#if !PLATFORM_N64 && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif } else { @@ -3839,7 +3839,7 @@ void KaleidoScope_Update(PlayState* play) { gSaveContext.buttonStatus[3] = BTN_ENABLED; gSaveContext.hudVisibilityMode = HUD_VISIBILITY_NO_CHANGE; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); -#if PLATFORM_GC && OOT_NTSC +#if !PLATFORM_N64 && OOT_NTSC AudioOcarina_SetInstrument(OCARINA_INSTRUMENT_OFF); #endif }