Skip to content

Commit 8fabc0a

Browse files
committed
Add screen swap hotkey customization
1 parent e185539 commit 8fabc0a

File tree

5 files changed

+32
-5
lines changed

5 files changed

+32
-5
lines changed

settings/arm9/source/language.inl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ STRING(B4DSMODE, "B4DS Mode")
193193
STRING(S1SD_B4DSMODE, "S1SD: B4DS Mode")
194194
STRING(ESRBRATINGSCREEN, "ESRB Rating Screen")
195195
STRING(HOTKEY, "Menu hotkey")
196+
STRING(SCREEN_SWAP_HOTKEY, "Screen Swap hotkey")
196197
STRING(SAVE_LOCATION, "Save Location")
197198
STRING(FORCESLEEPPATCH, "Force sleep mode patch")
198199
STRING(SYSSD_FORCESLEEPPATCH, "Sys SD: Force sleep mode patch")
@@ -256,6 +257,7 @@ STRING(DESCRIPTION_GAMELOADER, "Select whether to use nds-bootstrap or the flash
256257
STRING(DESCRIPTION_B4DSMODE, "Only use for testing. Activates the mode used when running nds-bootstrap on DS/DS Lite, with some additional DSi features.")
257258
STRING(DESCRIPTION_ESRBRATINGSCREEN, "Displays a screen with USA DS title's ESRB rating and content descriptor(s), when launched via nds-bootstrap. Does not work with all DS titles.")
258259
STRING(DESCRIPTION_HOTKEY, "Set the hotkey to open the nds-bootstrap in-game menu.")
260+
STRING(DESCRIPTION_SCREEN_SWAP_HOTKEY, "Set the hotkey to swap the top and bottom screens.")
259261
STRING(DESCRIPTION_SAVE_LOCATION, "Pick the location of where game saves are placed. Selecting ROM folder will disable save slots.")
260262
STRING(DESCRIPTION_FORCESLEEPMODE, "If a certain Slot-1 card is preventing sleep mode from working, please turn this on. Remember to turn this off if you have a retail game card inserted.")
261263
STRING(DESCRIPTION_SLOT1SDACCESS, "Have access to the console's SD card while running a Slot-1 flashcard.")
@@ -412,6 +414,7 @@ STRING(AB_SETFONT, "\\A / \\B: Set font")
412414

413415
STRING(HOLD_1S_SET, "Hold keys to set hotkey")
414416
STRING(HOLD_1S_DETAILS, "Hold at least two keys for 1 second.\nThe default is \\L \\DD SELECT.\nHold \\B to cancel.")
417+
STRING(HOLD_1S_SCREEN_SWAP_DETAILS, "Hold at least two keys for 1 second.\nThe default is \\L \\R \\DU \\X.\nHold \\B to cancel.")
415418
STRING(TOUCH, "Touch")
416419
STRING(HOTKEY_SET, "Hotkey set!")
417420
STRING(HOTKEY_SETTING_CANCELLED, "Hotkey setting cancelled!")

settings/arm9/source/main.cpp

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ std::string keyString(u16 pressed) {
451451
return keys.substr(0, keys.size() - 1); // Remove trailing space
452452
}
453453

454-
void opt_set_hotkey(void) {
454+
void opt_set_hotkey_main(const bool screenSwap) {
455455
clearScroller();
456456
bool refreshText = true;
457457
u16 held = 0, set = 0, timer = 0;
@@ -467,7 +467,11 @@ void opt_set_hotkey(void) {
467467

468468
keys = keyString(set);
469469
printSmall(false, 0, 48, keys, Alignment::center);
470-
printSmall(false, 0, 170 - calcSmallFontHeight(STR_HOLD_1S_DETAILS), STR_HOLD_1S_DETAILS, Alignment::center);
470+
if (screenSwap) {
471+
printSmall(false, 0, 170 - calcSmallFontHeight(STR_HOLD_1S_SCREEN_SWAP_DETAILS), STR_HOLD_1S_SCREEN_SWAP_DETAILS, Alignment::center);
472+
} else {
473+
printSmall(false, 0, 170 - calcSmallFontHeight(STR_HOLD_1S_DETAILS), STR_HOLD_1S_DETAILS, Alignment::center);
474+
}
471475
updateText(false);
472476
refreshText = false;
473477
}
@@ -497,9 +501,13 @@ void opt_set_hotkey(void) {
497501

498502
// Holding *only* B cancels
499503
if(set == KEY_B) {
500-
keys = keyString(bs().bootstrapHotkey);
504+
keys = keyString(screenSwap ? bs().screenSwapHotkey : bs().bootstrapHotkey);
501505
} else {
502-
bs().bootstrapHotkey = set;
506+
if (screenSwap) {
507+
bs().screenSwapHotkey = set;
508+
} else {
509+
bs().bootstrapHotkey = set;
510+
}
503511
}
504512

505513
mmEffectEx(currentTheme == 4 ? &snd().snd_saturn_select : &snd().snd_select);
@@ -520,6 +528,14 @@ void opt_set_hotkey(void) {
520528
clearText();
521529
}
522530

531+
void opt_set_hotkey(void) {
532+
opt_set_hotkey_main(false);
533+
}
534+
535+
void opt_set_screenswap_hotkey(void) {
536+
opt_set_hotkey_main(true);
537+
}
538+
523539
void begin_update(int opt)
524540
{
525541
ms().saveSettings();
@@ -1339,7 +1355,8 @@ int settingsMode(void)
13391355

13401356
bootstrapPage
13411357
.option(STR_ESRBRATINGSCREEN, STR_DESCRIPTION_ESRBRATINGSCREEN, Option::Bool(&ms().esrbRatingScreen), {STR_ON, STR_OFF}, {true, false})
1342-
.option(STR_HOTKEY, STR_DESCRIPTION_HOTKEY, Option::Nul(opt_set_hotkey), {STR_PRESS_A}, {0});
1358+
.option(STR_HOTKEY, STR_DESCRIPTION_HOTKEY, Option::Nul(opt_set_hotkey), {STR_PRESS_A}, {0})
1359+
.option(STR_SCREEN_SWAP_HOTKEY, STR_DESCRIPTION_SCREEN_SWAP_HOTKEY, Option::Nul(opt_set_screenswap_hotkey), {STR_PRESS_A}, {0});
13431360

13441361
if (!sys().isRegularDS()) {
13451362
bootstrapPage.option(STR_SNDFREQ, STR_DESCRIPTION_SNDFREQ_1, Option::Bool((bool *)&ms().soundFreq), {"47.61 kHz", "32.73 kHz"}, {true, false});

settings/nitrofiles/languages/en/language.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ B4DSMODE=B4DS Mode
185185
S1SD_B4DSMODE=S1SD: B4DS Mode
186186
ESRBRATINGSCREEN=ESRB Rating Screen
187187
HOTKEY=Menu hotkey
188+
SCREEN_SWAP_HOTKEY=Screen Swap hotkey
188189
SAVE_LOCATION=Save Location
189190
FORCESLEEPPATCH=Force sleep mode patch
190191
SYSSD_FORCESLEEPPATCH=Sys SD: Force sleep mode patch
@@ -244,6 +245,7 @@ DESCRIPTION_GAMELOADER=Select whether to use nds-bootstrap or the flashcard kern
244245
DESCRIPTION_B4DSMODE=Only use for testing. Activates the mode used when running nds-bootstrap on DS/DS Lite, with some additional DSi features.
245246
DESCRIPTION_ESRBRATINGSCREEN=Displays a screen with USA DS title's ESRB rating and content descriptor(s), when launched via nds-bootstrap. Does not work with all DS titles.
246247
DESCRIPTION_HOTKEY=Set the hotkey to open the nds-bootstrap in-game menu.
248+
DESCRIPTION_SCREEN_SWAP_HOTKEY=Set the hotkey to swap the top and bottom screens.
247249
DESCRIPTION_SAVE_LOCATION=Pick the location of where game saves are placed. Selecting ROM folder will disable save slots.
248250
DESCRIPTION_FORCESLEEPMODE=If a certain Slot-1 card is preventing sleep mode from working, please turn this on. Remember to turn this off if you have a retail game card inserted.
249251
DESCRIPTION_SLOT1SDACCESS=Have access to the console's SD card while running a Slot-1 flashcard.
@@ -390,6 +392,7 @@ AB_SETFONT=\A / \B: Set font
390392
391393
HOLD_1S_SET=Hold keys to set hotkey
392394
HOLD_1S_DETAILS=Hold at least two keys for 1 second.\nThe default is \L \DD SELECT.\nHold \B to cancel.
395+
HOLD_1S_SCREEN_SWAP_DETAILS=Hold at least two keys for 1 second.\nThe default is \L \R \DU \X.\nHold \B to cancel.
393396
TOUCH=Touch
394397
HOTKEY_SET=Hotkey set!
395398
HOTKEY_SETTING_CANCELLED=Hotkey setting cancelled!

universal/include/common/bootstrapsettings.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class BootstrapSettings
4545
bool sdNand;
4646
TWLSettings::TConsoleModel consoleModel;
4747
int bootstrapHotkey;
48+
int screenSwapHotkey;
4849
TWLSettings::TSaveRelocation saveRelocation;
4950

5051
};

universal/source/common/bootstrapsettings.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ void BootstrapSettings::loadSettings()
4242
sdNand = bootstrapini.GetInt( "NDS-BOOTSTRAP", "SDNAND", sdNand);
4343
consoleModel = (TWLSettings::TConsoleModel)bootstrapini.GetInt("NDS-BOOTSTRAP", "CONSOLE_MODEL", consoleModel);
4444
bootstrapHotkey = strtol(bootstrapini.GetString("NDS-BOOTSTRAP", "HOTKEY", "284").c_str(), NULL, 16);
45+
screenSwapHotkey = strtol(bootstrapini.GetString("NDS-BOOTSTRAP", "SCREEN_SWAP_HOTKEY", "740").c_str(), NULL, 16);
4546
saveRelocation = (TWLSettings::TSaveRelocation)bootstrapini.GetInt( "NDS-BOOTSTRAP", "SAVE_RELOCATION", saveRelocation);
4647
}
4748

@@ -68,6 +69,8 @@ void BootstrapSettings::saveSettings()
6869
char hotkey[8] = {0};
6970
itoa(bootstrapHotkey, hotkey, 16);
7071
bootstrapini.SetString("NDS-BOOTSTRAP", "HOTKEY", hotkey);
72+
itoa(screenSwapHotkey, hotkey, 16);
73+
bootstrapini.SetString("NDS-BOOTSTRAP", "SCREEN_SWAP_HOTKEY", hotkey);
7174
bootstrapini.SetInt("NDS-BOOTSTRAP", "SAVE_RELOCATION", saveRelocation);
7275

7376
bootstrapini.SaveIniFile(bootstrapinipath);

0 commit comments

Comments
 (0)