Skip to content

Commit

Permalink
notifications: show upon manual device init, if thm or lang changed (#13
Browse files Browse the repository at this point in the history
)

* sfx: code clean up

* lng: fix font not being rendered if loading translations at boot from a device other than MC, and if lang is changed by manually initalising a device

* gui: add notifications

* gui: reduce notifications code

* notifications: show upon manual device init, if thm or lang changed
  • Loading branch information
KrahJohlito authored and Tupakaveli committed Sep 22, 2019
1 parent bf68d79 commit 5609c75
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 22 deletions.
3 changes: 3 additions & 0 deletions include/opl.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ int gFadeDelay;
int toggleSfx;

int showCfgPopup;
int showThmPopup;
int showLngPopup;
int popupSfxPlayed;

#ifdef IGS
#define IGS_VERSION "0.1"
Expand Down
22 changes: 2 additions & 20 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,8 @@ static ee_sema_t gQueueSema;
static int screenWidth;
static int screenHeight;

static int popupSfxPlayed;
static int popupTimer;

static int showThmPopup;
static int showLngPopup;

// forward decl.
static void guiShow();

Expand Down Expand Up @@ -241,12 +237,10 @@ void guiShowAbout()
static void guiBootNotifications(void)
{
if (gEnableNotifications) {
int themeID = thmGetGuiValue();
if (themeID != 0)
if (thmGetGuiValue() != 0)
showThmPopup = 1;

int langID = lngGetGuiValue();
if (langID != 0)
if (lngGetGuiValue() != 0)
showLngPopup = 1;

if (showThmPopup || showLngPopup || showCfgPopup) {
Expand Down Expand Up @@ -599,8 +593,6 @@ void guiShowUIConfig(void)
, "HDTV 1920x1080i @60Hz 16bit (HIRES)"
, NULL};
int previousVMode;
int previousTheme = thmGetGuiValue();
int previousLang = lngGetGuiValue();

reselect_video_mode:
previousVMode = gVMode;
Expand Down Expand Up @@ -650,16 +642,6 @@ void guiShowUIConfig(void)
//wait 70ms for confirm sound to finish playing before clearing buffer
guiDelay(0070);
sfxInit(0);

if (previousTheme != themeID && themeID != 0) {
showThmPopup = 1;
popupSfxPlayed = 0;
}

if (previousLang != langID && langID != 0) {
showLngPopup = 1;
popupSfxPlayed = 0;
}
}

if (previousVMode != gVMode) {
Expand Down
14 changes: 12 additions & 2 deletions src/opl.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,13 @@ void moduleUpdateMenu(int mode, int themeChanged, int langChanged)
if (!mod->support)
return;

if (langChanged)
if (langChanged) {
guiUpdateScreenScale();
if (lngGetGuiValue() != 0) {
showLngPopup = 1;
popupSfxPlayed = 0;
}
}

// refresh Hints
menuRemoveHints(&mod->menuItem);
Expand All @@ -153,8 +158,13 @@ void moduleUpdateMenu(int mode, int themeChanged, int langChanged)
}

// refresh Cache
if (themeChanged)
if (themeChanged) {
submenuRebuildCache(mod->subMenu);
if (thmGetGuiValue() != 0) {
showThmPopup = 1;
popupSfxPlayed = 0;
}
}
}

static void itemExecSelect(struct menu_item *curMenu)
Expand Down

0 comments on commit 5609c75

Please sign in to comment.