Skip to content

Commit a43c9df

Browse files
authored
change PostRestoreHold to only fire if restore key is held (#22)
* change PostRestoreHold to only fire if restore key is held instead of any key * bump version
1 parent e243574 commit a43c9df

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Taskfile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ tasks:
3232
package:
3333
desc: Package the build for release
3434
vars:
35-
VERSION: "SS2.3"
35+
VERSION: "SS2.4"
3636
MOD_DIR: "target/package/mods/The Legend of Zelda - Breath of the Wild/Save State/contents/01007EF00011E000"
3737
cmds:
3838
- megaton build -p none

src/core/controller.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,8 @@ Command Controller::update_setting_mode() {
346346
Command Controller::update_active_mode() {
347347
if (m_restore_fired) {
348348
// after restore, keep firing PostRestoreHold
349-
// until all keys are released
350-
if (get_hold_keys() != Key::None) {
349+
// until all keys in the restore combo are released
350+
if ((get_hold_keys() & m_restore_fired_key) != Key::None) {
351351
return Command::PostRestoreHold;
352352
}
353353
m_restore_fired = false;
@@ -359,9 +359,11 @@ Command Controller::update_active_mode() {
359359
return Command::SaveFile;
360360
} else if (is_only_holding(m_key_restore)) {
361361
m_restore_fired = true;
362+
m_restore_fired_key = m_key_restore;
362363
return Command::Restore;
363364
} else if (is_only_holding(m_key_restore_file)) {
364365
m_restore_fired = true;
366+
m_restore_fired_key = m_key_restore_file;
365367
return Command::RestoreFile;
366368
}
367369
return Command::None;

src/core/controller.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,13 @@ class Controller {
154154
Key m_key_save_file = Key::ZL | Key::L | Key::DpadLeft | Key::RStick;
155155
Key m_key_restore = Key::ZL | Key::L | Key::Plus | Key::DpadRight;
156156
Key m_key_restore_file = Key::ZL | Key::L | Key::DpadRight | Key::RStick;
157+
158+
/**
159+
* State to track the last restore fired, and keep firing PostRestoreHold
160+
* until the user releases the restore key
161+
*/
157162
bool m_restore_fired = false;
163+
Key m_restore_fired_key = Key::None;
158164

159165
u32 m_tick_since_last_menu_input = MENU_REFRESH_TICKS + 1;
160166
mem::StringBuffer<MENU_BUFFER_LEN> m_menu_title;

0 commit comments

Comments
 (0)