From 54f85e6664c401a33879292586a61cba6a6a0434 Mon Sep 17 00:00:00 2001 From: KrahJohlito Date: Thu, 15 Jul 2021 13:06:33 +0930 Subject: [PATCH] GUI: rework BDM GUI device selection --- include/dialogs.h | 2 ++ include/lang.h | 1 + lng/lang_English.lng | 1 + src/dialogs.c | 27 +++++++++++++++++++++++---- src/gui.c | 20 ++++++++++++++++---- src/lang.c | 1 + 6 files changed, 44 insertions(+), 8 deletions(-) diff --git a/include/dialogs.h b/include/dialogs.h index ae4428457..0547e68ce 100644 --- a/include/dialogs.h +++ b/include/dialogs.h @@ -43,6 +43,7 @@ enum UI_ITEMS { CFG_BDMPREFIX, CFG_ETHPREFIX, CFG_HDDSPINDOWN, + BLOCKDEVICE_BUTTON, ABOUT_TITLE, ABOUT_BUILD_DETAILS, @@ -190,5 +191,6 @@ extern struct UIItem diaAbout[]; extern struct UIItem diaVMC[]; extern struct UIItem diaNetCompatUpdate[]; extern struct UIItem diaParentalLockConfig[]; +extern struct UIItem diaBlockDevicesConfig[]; #endif diff --git a/include/lang.h b/include/lang.h index e4b76a738..6ed2f6ad0 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_BLOCKDEVICE_SETTINGS, LANG_STR_COUNT }; diff --git a/lng/lang_English.lng b/lng/lang_English.lng index 36b83f08c..d72ba2064 100644 --- a/lng/lang_English.lng +++ b/lng/lang_English.lng @@ -301,3 +301,4 @@ Release Developer Description BDM Games +Select Block Devices diff --git a/src/dialogs.c b/src/dialogs.c index 9984122f1..7797b978d 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -135,6 +135,28 @@ struct UIItem diaNetConfig[] = { // end of dialog {UI_TERMINATOR}}; +// Block Devices Settings Menu +struct UIItem diaBlockDevicesConfig[] = { + {UI_LABEL, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_BLOCKDEVICE_SETTINGS}}}, + {UI_SPLITTER}, + + {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"USB", -1}}}, + {UI_SPACER}, + {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_ON}}}, + {UI_BREAK}, + + {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"FireWire", -1}}}, + {UI_SPACER}, + {UI_BOOL, CFG_ENABLEFW, 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}}; + // Settings Menu struct UIItem diaConfig[] = { {UI_LABEL, 0, 1, 1, -1, 0, 0, {.label = {NULL, _STR_SETTINGS}}}, @@ -197,11 +219,8 @@ struct UIItem diaConfig[] = { {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_BDMMODE}}}, {UI_SPACER}, {UI_ENUM, CFG_BDMMODE, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, - {UI_BREAK}, - - {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {"- FireWire", -1}}}, {UI_SPACER}, - {UI_BOOL, CFG_ENABLEFW, 1, 1, -1, 0, 0, {.intvalue = {0, 0}}}, + {UI_BUTTON, BLOCKDEVICE_BUTTON, 1, 1, -1, 0, 0, {.label = {NULL, _STR_BLOCKDEVICE_SETTINGS}}}, {UI_BREAK}, {UI_LABEL, 0, 1, 1, -1, -40, 0, {.label = {NULL, _STR_HDDMODE}}}, diff --git a/src/gui.c b/src/gui.c index 00e453fd0..1aaa9a248 100644 --- a/src/gui.c +++ b/src/gui.c @@ -417,6 +417,18 @@ void guiShowNetCompatUpdateSingle(int id, item_list_t *support, config_set_t *co } } +static void guiShowBlockDeviceConfig(void) +{ + int ret; + + diaSetInt(diaBlockDevicesConfig, CFG_ENABLEFW, gEnableFW); + + ret = diaExecuteDialog(diaBlockDevicesConfig, -1, 1, NULL); + if (ret) { + diaGetInt(diaBlockDevicesConfig, CFG_ENABLEFW, &gEnableFW); + } +} + static int guiUpdater(int modified) { int showAutoStartLast; @@ -427,7 +439,7 @@ static int guiUpdater(int modified) diaSetVisible(diaConfig, CFG_AUTOSTARTLAST, showAutoStartLast); diaGetInt(diaConfig, CFG_BDMMODE, &gBDMStartMode); - diaSetEnabled(diaConfig, CFG_ENABLEFW, gBDMStartMode); + diaSetVisible(diaConfig, BLOCKDEVICE_BUTTON, gBDMStartMode); } return 0; } @@ -464,12 +476,11 @@ void guiShowConfig() diaSetInt(diaConfig, CFG_SELECTBUTTON, gSelectButton == KEY_CIRCLE ? 0 : 1); diaSetInt(diaConfig, CFG_DEFDEVICE, gDefaultDevice); diaSetInt(diaConfig, CFG_BDMMODE, gBDMStartMode); + diaSetVisible(diaConfig, BLOCKDEVICE_BUTTON, gBDMStartMode); diaSetInt(diaConfig, CFG_HDDMODE, gHDDStartMode); diaSetInt(diaConfig, CFG_ETHMODE, gETHStartMode); diaSetInt(diaConfig, CFG_APPMODE, gAPPStartMode); - diaSetInt(diaConfig, CFG_ENABLEFW, gEnableFW); - int ret = diaExecuteDialog(diaConfig, -1, 1, &guiUpdater); if (ret) { diaGetInt(diaConfig, CFG_DEBUG, &gDisableDebug); @@ -492,7 +503,8 @@ void guiShowConfig() diaGetInt(diaConfig, CFG_ETHMODE, &gETHStartMode); diaGetInt(diaConfig, CFG_APPMODE, &gAPPStartMode); - diaGetInt(diaConfig, CFG_ENABLEFW, &gEnableFW); + if (ret == BLOCKDEVICE_BUTTON) + guiShowBlockDeviceConfig(); applyConfig(-1, -1); menuReinitMainMenu(); diff --git a/src/lang.c b/src/lang.c index b5834ff23..591e5e2d2 100644 --- a/src/lang.c +++ b/src/lang.c @@ -288,6 +288,7 @@ static char *internalEnglish[LANG_STR_COUNT] = { "Developer", "Description", "BDM Games", + "Select Block Devices", }; static int guiLangID = 0;