From 9d4fcf412ca244b95a2c3d94f13f376ccf67fb7e Mon Sep 17 00:00:00 2001 From: KrahJohlito Date: Mon, 25 Nov 2024 11:25:00 +1030 Subject: [PATCH] add a macro for checking if default theme is set --- include/themes.h | 2 ++ src/gui.c | 2 +- src/sound.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/themes.h b/include/themes.h index b0cd3c91c..e408ecd1d 100644 --- a/include/themes.h +++ b/include/themes.h @@ -8,6 +8,8 @@ #define THM_MAX_FILES 64 #define THM_MAX_FONTS 16 +#define IS_DEFAULT_THEME(themeID) ((themeID) == 0) + typedef struct { // optional, only for overlays diff --git a/src/gui.c b/src/gui.c index e200d4c6f..8f4b896ee 100644 --- a/src/gui.c +++ b/src/gui.c @@ -684,7 +684,7 @@ void guiShowUIConfig(void) if (ret) { diaGetInt(diaUIConfig, UICFG_LANG, &langID); diaGetInt(diaUIConfig, UICFG_THEME, &themeID); - if (themeID == 0) { + if (IS_DEFAULT_THEME(themeID)) { diaGetColor(diaUIConfig, UICFG_BGCOL, gDefaultBgColor); diaGetColor(diaUIConfig, UICFG_UICOL, gDefaultUITextColor); diaGetColor(diaUIConfig, UICFG_TXTCOL, gDefaultTextColor); diff --git a/src/sound.c b/src/sound.c index cefb674ef..55eda88e6 100644 --- a/src/sound.c +++ b/src/sound.c @@ -181,7 +181,7 @@ int sfxInit(int bootSnd) // Check default theme is not current theme int themeID = thmGetGuiValue(); - if (themeID != 0) { + if (!IS_DEFAULT_THEME(themeID)) { // Get theme path for sfx char *thmPath = thmGetFilePath(themeID); snprintf(sound_path, sizeof(sound_path), "%ssound", thmPath); @@ -334,7 +334,7 @@ static int bgmLoad(void) memset(vorbisFile, 0, sizeof(OggVorbis_File)); int themeID = thmGetGuiValue(); - if (themeID != 0) { + if (!IS_DEFAULT_THEME(themeID)) { char *thmPath = thmGetFilePath(themeID); snprintf(bgmPath, sizeof(bgmPath), "%ssound/bgm.ogg", thmPath); } else