Skip to content

Commit

Permalink
GUI: rework BDM GUI device selection
Browse files Browse the repository at this point in the history
  • Loading branch information
KrahJohlito authored and uyjulian committed Jul 21, 2021
1 parent 70ed88a commit 54f85e6
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
2 changes: 2 additions & 0 deletions include/dialogs.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ enum UI_ITEMS {
CFG_BDMPREFIX,
CFG_ETHPREFIX,
CFG_HDDSPINDOWN,
BLOCKDEVICE_BUTTON,

ABOUT_TITLE,
ABOUT_BUILD_DETAILS,
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions include/lang.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ enum _STR_IDS {
_STR_INFO_DEVELOPER,
_STR_INFO_DESCRIPTION,
_STR_BDM_GAMES,
_STR_BLOCKDEVICE_SETTINGS,

LANG_STR_COUNT
};
Expand Down
1 change: 1 addition & 0 deletions lng/lang_English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,4 @@ Release
Developer
Description
BDM Games
Select Block Devices
27 changes: 23 additions & 4 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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}}},
Expand Down Expand Up @@ -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}}},
Expand Down
20 changes: 16 additions & 4 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions src/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ static char *internalEnglish[LANG_STR_COUNT] = {
"Developer",
"Description",
"BDM Games",
"Select Block Devices",
};

static int guiLangID = 0;
Expand Down

0 comments on commit 54f85e6

Please sign in to comment.