Skip to content

Commit

Permalink
gui: add button in display settings to reset theme to default compile…
Browse files Browse the repository at this point in the history
…d in colours
  • Loading branch information
KrahJohlito authored and Tupakaveli committed Nov 8, 2019
1 parent 8dcf0b1 commit 6dd7a20
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 26 deletions.
1 change: 1 addition & 0 deletions include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum UI_ITEMS {
UICFG_UICOL,
UICFG_TXTCOL,
UICFG_SELCOL,
UICFG_RESETCOL,
UICFG_AUTOSORT,
UICFG_COVERART,
UICFG_WIDESCREEN,
Expand Down
2 changes: 1 addition & 1 deletion include/lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ enum _STR_IDS {
_STR_VMODE,
_STR_UICOLOR,
_STR_SELCOLOR,
_STR_USE_INFO_SCREEN, // string no longer used
_STR_RESETCOLOR,
_STR_INFO,
_STR_ALTSTARTUP,
_STR_COLOR_SELECTION,
Expand Down
2 changes: 2 additions & 0 deletions include/opl.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ unsigned char gDefaultTextColor[3];
unsigned char gDefaultSelTextColor[3];
unsigned char gDefaultUITextColor[3];

void setDefaultColors(void);

#define MENU_ITEM_HEIGHT 19

// BLURT output
Expand Down
2 changes: 1 addition & 1 deletion lng/lang_English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Automatic HDD Spin Down
Video Mode
Dialog Color
Selected Color
Unused
Reset Colors
Info
Custom ELF
Color Selection
Expand Down
3 changes: 3 additions & 0 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,9 @@ struct UIItem diaUIConfig[] = {
{UI_LABEL, 0, 1, 1, -1, -30, 0, {.label = {NULL, _STR_BGCOLOR}}},
{UI_SPACER},
{UI_COLOUR, UICFG_BGCOL, 1, 1, -1, -10, 17, {.colourvalue = {0, 0}}},
{UI_BREAK},

{UI_BUTTON, UICFG_RESETCOL, 1, 1, -1, 0, 0, {.label = {NULL, _STR_RESETCOLOR}}},
{UI_SPLITTER},

{UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_VMODE}}},
Expand Down
4 changes: 4 additions & 0 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,7 @@ static int guiUIUpdater(int modified)
diaSetEnabled(diaUIConfig, UICFG_UICOL, temp);
diaSetEnabled(diaUIConfig, UICFG_TXTCOL, temp);
diaSetEnabled(diaUIConfig, UICFG_SELCOL, temp);
diaSetEnabled(diaUIConfig, UICFG_RESETCOL, temp);
}

diaGetInt(diaUIConfig, UICFG_XOFF, &x);
Expand Down Expand Up @@ -642,6 +643,9 @@ void guiShowUIConfig(void)
diaGetInt(diaUIConfig, UICFG_YOFF, &gYOff);
diaGetInt(diaUIConfig, UICFG_OVERSCAN, &gOverscan);

if (ret == UICFG_RESETCOL)
setDefaultColors();

applyConfig(themeID, langID);
//wait 70ms for confirm sound to finish playing before clearing buffer
guiDelay(0070);
Expand Down
10 changes: 3 additions & 7 deletions src/guigame.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,6 @@ void guiGameShowPadEmuConfig(void)
void guiGameShowCompatConfig(int id, item_list_t *support, config_set_t *configSet)
{
int i;
int result = COMPAT_NOEXIT;

if (support->flags & MODE_FLAG_COMPAT_DMA) {
const char *dmaModes[] = {"MDMA 0", "MDMA 1", "MDMA 2", "UDMA 0", "UDMA 1", "UDMA 2", "UDMA 3", "UDMA 4", NULL};
Expand All @@ -757,9 +756,8 @@ void guiGameShowCompatConfig(int id, item_list_t *support, config_set_t *configS
diaSetEnum(diaCompatConfig, COMPAT_DMA, dmaModes);
}

while (result >= COMPAT_NOEXIT) {
result = diaExecuteDialog(diaCompatConfig, result, 1, NULL);

int result = diaExecuteDialog(diaCompatConfig, -1, 1, NULL);
if (result) {
compatMode = 0;
for (i = 0; i < COMPAT_MODE_COUNT; ++i) {
int mdpart;
Expand All @@ -774,10 +772,8 @@ void guiGameShowCompatConfig(int id, item_list_t *support, config_set_t *configS
guiMsgBox(_l(_STR_ERROR_LOADING_ID), 0, NULL);
}

if (result == COMPAT_DL_DEFAULTS) {
if (result == COMPAT_DL_DEFAULTS)
guiShowNetCompatUpdateSingle(id, support, configSet);
break;
}

diaGetInt(diaCompatConfig, COMPAT_DMA, &dmaMode);
diaGetString(diaCompatConfig, COMPAT_GAMEID, hexid, sizeof(hexid));
Expand Down
2 changes: 1 addition & 1 deletion src/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static char *internalEnglish[LANG_STR_COUNT] = {
"Video Mode",
"Dialog Color",
"Selected Color",
"Unused", // string no longer used
"Reset Colors",
"Info",
"Custom ELF",
"Color Selection",
Expand Down
37 changes: 21 additions & 16 deletions src/opl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,25 @@ void deinit(int exception, int modeSelected)
configEnd();
}

void setDefaultColors(void)
{
gDefaultBgColor[0] = 0x028;
gDefaultBgColor[1] = 0x0c5;
gDefaultBgColor[2] = 0x0f9;

gDefaultTextColor[0] = 0x0ff;
gDefaultTextColor[1] = 0x0ff;
gDefaultTextColor[2] = 0x0ff;

gDefaultSelTextColor[0] = 0x0ff;
gDefaultSelTextColor[1] = 0x080;
gDefaultSelTextColor[2] = 0x000;

gDefaultUITextColor[0] = 0x040;
gDefaultUITextColor[1] = 0x080;
gDefaultUITextColor[2] = 0x040;
}

static void setDefaults(void)
{
clearIOModuleT(&list_support[USB_MODE]);
Expand Down Expand Up @@ -1456,29 +1475,15 @@ static void setDefaults(void)
gETHStartMode = START_MODE_DISABLED;
gAPPStartMode = START_MODE_DISABLED;

gDefaultBgColor[0] = 0x028;
gDefaultBgColor[1] = 0x0c5;
gDefaultBgColor[2] = 0x0f9;

gDefaultTextColor[0] = 0x0ff;
gDefaultTextColor[1] = 0x0ff;
gDefaultTextColor[2] = 0x0ff;

gDefaultSelTextColor[0] = 0x0ff;
gDefaultSelTextColor[1] = 0x080;
gDefaultSelTextColor[2] = 0x000;

gDefaultUITextColor[0] = 0x040;
gDefaultUITextColor[1] = 0x080;
gDefaultUITextColor[2] = 0x040;

frameCounter = 0;

gVMode = 0;
gXOff = 0;
gYOff = 0;
gOverscan = 0;

setDefaultColors();

// Last Played Auto Start
KeyPressedOnce = 0;
DisableCron = 1; //Auto Start Last Played counter disabled by default
Expand Down

0 comments on commit 6dd7a20

Please sign in to comment.