Skip to content

Commit

Permalink
GUI: Move some settings to 'Controller Settings'
Browse files Browse the repository at this point in the history
This would be a good place for PADEMU also
  • Loading branch information
KrahJohlito committed Jul 3, 2021
1 parent e41fac7 commit e76c30f
Show file tree
Hide file tree
Showing 8 changed files with 60 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 @@ -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[];
Expand Down
1 change: 1 addition & 0 deletions include/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ void guiShowAbout();
void guiShowConfig();
void guiShowUIConfig();
void guiShowAudioConfig();
void guiShowControllerConfig();
void guiShowNetConfig();
void guiShowParentalLockConfig();

Expand Down
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_CONTROLLER_SETTINGS,

LANG_STR_COUNT
};
Expand Down
3 changes: 2 additions & 1 deletion lng/lang_English.lng
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ Games List
Game Settings
Remove Settings
Removed all keys for the game.
Scrolling
Scrolling Speed
Slow
Medium
Fast
Expand Down Expand Up @@ -301,3 +301,4 @@ Release
Developer
Description
BDM Games
Controller Settings
31 changes: 21 additions & 10 deletions src/dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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}}},
Expand Down Expand Up @@ -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}}},
Expand Down Expand Up @@ -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}};
41 changes: 27 additions & 14 deletions src/gui.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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"
Expand All @@ -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);
Expand All @@ -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) {
Expand Down Expand Up @@ -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];
Expand Down
3 changes: 2 additions & 1 deletion src/lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -288,6 +288,7 @@ static char *internalEnglish[LANG_STR_COUNT] = {
"Developer",
"Description",
"BDM Games",
"Controller Settings",
};

static int guiLangID = 0;
Expand Down
5 changes: 5 additions & 0 deletions src/menusys.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e76c30f

Please sign in to comment.