From e76c30f10ae72213cc1e951ddc4c7b15e5401268 Mon Sep 17 00:00:00 2001 From: KrahJohlito Date: Wed, 23 Jun 2021 20:49:09 +0930 Subject: [PATCH] GUI: Move some settings to 'Controller Settings' This would be a good place for PADEMU also --- include/dialogs.h | 1 + include/gui.h | 1 + include/lang.h | 1 + lng/lang_English.lng | 3 ++- src/dialogs.c | 31 +++++++++++++++++++++---------- src/gui.c | 41 +++++++++++++++++++++++++++-------------- src/lang.c | 3 ++- src/menusys.c | 5 +++++ 8 files changed, 60 insertions(+), 26 deletions(-) diff --git a/include/dialogs.h b/include/dialogs.h index ae4428457..40a636f6f 100644 --- a/include/dialogs.h +++ b/include/dialogs.h @@ -180,6 +180,7 @@ extern struct UIItem diaPadEmuInfo[]; extern struct UIItem diaNetConfig[]; extern struct UIItem diaUIConfig[]; extern struct UIItem diaAudioConfig[]; +extern struct UIItem diaControllerConfig[]; extern struct UIItem diaCompatConfig[]; extern struct UIItem diaVMCConfig[]; extern struct UIItem diaGSConfig[]; diff --git a/include/gui.h b/include/gui.h index e906f6bc7..7b51cb4d6 100644 --- a/include/gui.h +++ b/include/gui.h @@ -129,6 +129,7 @@ void guiShowAbout(); void guiShowConfig(); void guiShowUIConfig(); void guiShowAudioConfig(); +void guiShowControllerConfig(); void guiShowNetConfig(); void guiShowParentalLockConfig(); diff --git a/include/lang.h b/include/lang.h index e4b76a738..f7d37e904 100644 --- a/include/lang.h +++ b/include/lang.h @@ -284,6 +284,7 @@ enum _STR_IDS { _STR_INFO_DEVELOPER, _STR_INFO_DESCRIPTION, _STR_BDM_GAMES, + _STR_CONTROLLER_SETTINGS, LANG_STR_COUNT }; diff --git a/lng/lang_English.lng b/lng/lang_English.lng index 36b83f08c..3bea698d3 100644 --- a/lng/lang_English.lng +++ b/lng/lang_English.lng @@ -63,7 +63,7 @@ Games List Game Settings Remove Settings Removed all keys for the game. -Scrolling +Scrolling Speed Slow Medium Fast @@ -301,3 +301,4 @@ Release Developer Description BDM Games +Controller Settings diff --git a/src/dialogs.c b/src/dialogs.c index 9984122f1..3ccdda410 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -172,11 +172,6 @@ struct UIItem diaConfig[] = { {UI_LABEL, CFG_LBL_AUTOSTARTLAST, 1, 1, -1, 0, 0, {.label = {NULL, _STR_AUTOSTARTLAST}}}, {UI_SPACER}, {UI_INT, CFG_AUTOSTARTLAST, 1, 1, _STR_HINT_AUTOSTARTLAST, 0, 0, {.intvalue = {0, 0, 0, 9}}}, - {UI_BREAK}, - - {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_SELECTBUTTON}}}, - {UI_SPACER}, - {UI_ENUM, CFG_SELECTBUTTON, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_SPLITTER}, {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_BDM_PREFIX}}}, @@ -246,11 +241,6 @@ struct UIItem diaUIConfig[] = { {UI_ENUM, UICFG_LANG, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, {UI_BREAK}, - {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_SCROLLING}}}, - {UI_SPACER}, - {UI_ENUM, UICFG_SCROLL, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, - {UI_BREAK}, - {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_AUTOSORT}}}, {UI_SPACER}, {UI_BOOL, UICFG_AUTOSORT, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, @@ -913,3 +903,24 @@ struct UIItem diaAudioConfig[] = { {UI_BREAK}, // end of dialog {UI_TERMINATOR}}; + +// Controller Settings Menu +struct UIItem diaControllerConfig[] = { + {UI_LABEL, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_CONTROLLER_SETTINGS}}}, + {UI_SPLITTER}, + + {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_SCROLLING}}}, + {UI_SPACER}, + {UI_ENUM, UICFG_SCROLL, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, + {UI_BREAK}, + + {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_SELECTBUTTON}}}, + {UI_SPACER}, + {UI_ENUM, CFG_SELECTBUTTON, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, + {UI_BREAK}, + + // buttons + {UI_OK, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_OK}}}, + {UI_BREAK}, + // end of dialog + {UI_TERMINATOR}}; diff --git a/src/gui.c b/src/gui.c index 00e453fd0..994697bb7 100644 --- a/src/gui.c +++ b/src/gui.c @@ -434,14 +434,10 @@ static int guiUpdater(int modified) void guiShowConfig() { - int value; - // configure the enumerations - const char *selectButtons[] = {_l(_STR_CIRCLE), _l(_STR_CROSS), NULL}; const char *deviceNames[] = {_l(_STR_BDM_GAMES), _l(_STR_NET_GAMES), _l(_STR_HDD_GAMES), NULL}; const char *deviceModes[] = {_l(_STR_OFF), _l(_STR_MANUAL), _l(_STR_AUTO), NULL}; - diaSetEnum(diaConfig, CFG_SELECTBUTTON, selectButtons); diaSetEnum(diaConfig, CFG_DEFDEVICE, deviceNames); diaSetEnum(diaConfig, CFG_BDMMODE, deviceModes); diaSetEnum(diaConfig, CFG_HDDMODE, deviceModes); @@ -461,7 +457,6 @@ void guiShowConfig() diaSetVisible(diaConfig, CFG_AUTOSTARTLAST, gRememberLastPlayed); diaSetVisible(diaConfig, CFG_LBL_AUTOSTARTLAST, gRememberLastPlayed); - diaSetInt(diaConfig, CFG_SELECTBUTTON, gSelectButton == KEY_CIRCLE ? 0 : 1); diaSetInt(diaConfig, CFG_DEFDEVICE, gDefaultDevice); diaSetInt(diaConfig, CFG_BDMMODE, gBDMStartMode); diaSetInt(diaConfig, CFG_HDDMODE, gHDDStartMode); @@ -483,10 +478,6 @@ void guiShowConfig() diaGetInt(diaConfig, CFG_LASTPLAYED, &gRememberLastPlayed); diaGetInt(diaConfig, CFG_AUTOSTARTLAST, &gAutoStartLastPlayed); DisableCron = 1; // Disable Auto Start Last Played counter (we don't want to call it right after enable it on GUI) - if (diaGetInt(diaConfig, CFG_SELECTBUTTON, &value)) - gSelectButton = value == 0 ? KEY_CIRCLE : KEY_CROSS; - else - gSelectButton = KEY_CIRCLE; diaGetInt(diaConfig, CFG_DEFDEVICE, &gDefaultDevice); diaGetInt(diaConfig, CFG_HDDMODE, &gHDDStartMode); diaGetInt(diaConfig, CFG_ETHMODE, &gETHStartMode); @@ -576,8 +567,6 @@ void guiShowUIConfig(void) showCfgPopup = 0; guiResetNotifications(); - // configure the enumerations - const char *scrollSpeeds[] = {_l(_STR_SLOW), _l(_STR_MEDIUM), _l(_STR_FAST), NULL}; // clang-format off const char *vmodeNames[] = {_l(_STR_AUTO) , "PAL 640x512i @50Hz 24bit" @@ -597,11 +586,9 @@ void guiShowUIConfig(void) reselect_video_mode: previousVMode = gVMode; - diaSetEnum(diaUIConfig, UICFG_SCROLL, scrollSpeeds); diaSetEnum(diaUIConfig, UICFG_THEME, (const char **)thmGetGuiList()); diaSetEnum(diaUIConfig, UICFG_LANG, (const char **)lngGetGuiList()); diaSetEnum(diaUIConfig, UICFG_VMODE, vmodeNames); - diaSetInt(diaUIConfig, UICFG_SCROLL, gScrollSpeed); diaSetInt(diaUIConfig, UICFG_THEME, thmGetGuiValue()); diaSetInt(diaUIConfig, UICFG_LANG, lngGetGuiValue()); diaSetInt(diaUIConfig, UICFG_AUTOSORT, gAutosort); @@ -617,7 +604,6 @@ void guiShowUIConfig(void) int ret = diaExecuteDialog(diaUIConfig, -1, 1, guiUIUpdater); if (ret) { - diaGetInt(diaUIConfig, UICFG_SCROLL, &gScrollSpeed); diaGetInt(diaUIConfig, UICFG_LANG, &langID); diaGetInt(diaUIConfig, UICFG_THEME, &themeID); if (themeID == 0) { @@ -827,6 +813,33 @@ void guiShowAudioConfig(void) diaExecuteDialog(diaAudioConfig, -1, 1, guiAudioUpdater); } +void guiShowControllerConfig(void) +{ + int value; + + // configure the enumerations + const char *scrollSpeeds[] = {_l(_STR_SLOW), _l(_STR_MEDIUM), _l(_STR_FAST), NULL}; + const char *selectButtons[] = {_l(_STR_CIRCLE), _l(_STR_CROSS), NULL}; + + diaSetEnum(diaControllerConfig, UICFG_SCROLL, scrollSpeeds); + diaSetEnum(diaControllerConfig, CFG_SELECTBUTTON, selectButtons); + + diaSetInt(diaControllerConfig, UICFG_SCROLL, gScrollSpeed); + diaSetInt(diaControllerConfig, CFG_SELECTBUTTON, gSelectButton == KEY_CIRCLE ? 0 : 1); + + int result = diaExecuteDialog(diaControllerConfig, -1, 1, NULL); + if (result) { + diaGetInt(diaControllerConfig, UICFG_SCROLL, &gScrollSpeed); + + if (diaGetInt(diaControllerConfig, CFG_SELECTBUTTON, &value)) + gSelectButton = value == 0 ? KEY_CIRCLE : KEY_CROSS; + else + gSelectButton = KEY_CIRCLE; + + applyConfig(-1, -1); + } +} + int guiShowKeyboard(char *value, int maxLength) { char tmp[maxLength]; diff --git a/src/lang.c b/src/lang.c index b5834ff23..38c00de2d 100644 --- a/src/lang.c +++ b/src/lang.c @@ -50,7 +50,7 @@ static char *internalEnglish[LANG_STR_COUNT] = { "Game Settings", "Remove Settings", "Removed all keys for the game.", - "Scrolling", + "Scrolling Speed", "Slow", "Medium", "Fast", @@ -288,6 +288,7 @@ static char *internalEnglish[LANG_STR_COUNT] = { "Developer", "Description", "BDM Games", + "Controller Settings", }; static int guiLangID = 0; diff --git a/src/menusys.c b/src/menusys.c index 0a8a5d38c..5e82e8535 100644 --- a/src/menusys.c +++ b/src/menusys.c @@ -23,6 +23,7 @@ enum MENU_IDs { MENU_SETTINGS = 0, MENU_GFX_SETTINGS, MENU_AUDIO_SETTINGS, + MENU_CONTROLLER_SETTINGS, MENU_PARENTAL_LOCK, MENU_NET_CONFIG, MENU_NET_UPDATE, @@ -205,6 +206,7 @@ static void menuInitMainMenu(void) submenuAppendItem(&mainMenu, -1, NULL, MENU_SETTINGS, _STR_SETTINGS); submenuAppendItem(&mainMenu, -1, NULL, MENU_GFX_SETTINGS, _STR_GFX_SETTINGS); submenuAppendItem(&mainMenu, -1, NULL, MENU_AUDIO_SETTINGS, _STR_AUDIO_SETTINGS); + submenuAppendItem(&mainMenu, -1, NULL, MENU_CONTROLLER_SETTINGS, _STR_CONTROLLER_SETTINGS); submenuAppendItem(&mainMenu, -1, NULL, MENU_PARENTAL_LOCK, _STR_PARENLOCKCONFIG); submenuAppendItem(&mainMenu, -1, NULL, MENU_NET_CONFIG, _STR_NETCONFIG); submenuAppendItem(&mainMenu, -1, NULL, MENU_NET_UPDATE, _STR_NET_UPDATE); @@ -830,6 +832,9 @@ void menuHandleInputMenu() } else if (id == MENU_AUDIO_SETTINGS) { if (menuCheckParentalLock() == 0) guiShowAudioConfig(); + } else if (id == MENU_CONTROLLER_SETTINGS) { + if (menuCheckParentalLock() == 0) + guiShowControllerConfig(); } else if (id == MENU_PARENTAL_LOCK) { if (menuCheckParentalLock() == 0) guiShowParentalLockConfig();