From 0d4e0029faad4db242bb051c23182a4f9f48398d Mon Sep 17 00:00:00 2001 From: Eddie Date: Mon, 8 Jan 2024 00:24:56 -0600 Subject: [PATCH 1/3] Add Hotkey for Manual Swapping --- shuffler-src/setupform.lua | 49 +++++++++++++++++++++++++++++++++++++- shuffler.lua | 7 ++++-- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/shuffler-src/setupform.lua b/shuffler-src/setupform.lua index 062dba9..7eb376e 100644 --- a/shuffler-src/setupform.lua +++ b/shuffler-src/setupform.lua @@ -221,7 +221,7 @@ end function module.initial_setup(callback) local setup_window, resume, start_btn local seed_text, min_text, max_text - local mode_combo, hk_complete, plugin_label + local mode_combo, hk_complete, hk_swap, plugin_label local plugin_btn, seed_btn local immutable_inputs local plugin_window = -1 @@ -268,6 +268,47 @@ function module.initial_setup(callback) 'Alt+Shift+D', 'Backslash (above Enter)', 'RightCtrl', + 'F1', + 'F2', + 'F3', + 'F4', + 'F5', + 'F6', + 'F7', + 'F8', + 'F9', + 'F10', + 'F11', + 'F12', + 'F13', + 'F14', + 'F15', + } + -- Additional for swap + local HOTKEY_OPTIONS_SWAP = { + 'Ctrl+Shift+Delete', + 'Ctrl+Shift+End', + 'Ctrl+Shift+D', + 'Alt+Shift+End', + 'Alt+Shift+Delete', + 'Alt+Shift+D', + 'Backslash (above Enter)', + 'RightCtrl', + 'F1', + 'F2', + 'F3', + 'F4', + 'F5', + 'F6', + 'F7', + 'F8', + 'F9', + 'F10', + 'F11', + 'F12', + 'F13', + 'F14', + 'F15', } local function invert_table(t) local keys = {} @@ -337,6 +378,7 @@ function module.initial_setup(callback) config.max_swap = math.max(a, b) config.hk_complete = (forms.gettext(hk_complete) or 'Ctrl+Shift+End'):match("[^%s]+") + config.hk_swap = (forms.gettext(hk_swap) or 'Ctrl+Shift+Delete'):match("[^%s]+") end function main_cleanup() @@ -404,6 +446,11 @@ function module.initial_setup(callback) forms.settext(hk_complete, config.hk_complete or 'Ctrl+Shift+End') y = y + 30 + hk_swap = forms.dropdown(setup_window, HOTKEY_OPTIONS_SWAP, 10, y, 150, 20) + forms.label(setup_window, "Hotkey: Swap Game", 165, y+3, 150, 20) + forms.settext(hk_swap, config.hk_swap or 'Ctrl+Shift+Delete') + y = y + 30 + output_files_combo = forms.dropdown(setup_window, OUTPUT_FILE_MODES, 10, y, 150, 20) forms.label(setup_window, "Output info files for OBS", 165, y+3, 150, 20) forms.settext(output_files_combo, OUTPUT_FILE_MODES[config.output_files] or OUTPUT_FILE_MODES[OUTPUT_FILE_MODES_DEFAULT]) diff --git a/shuffler.lua b/shuffler.lua index de744fc..39e3415 100644 --- a/shuffler.lua +++ b/shuffler.lua @@ -714,8 +714,11 @@ while true do -- mark the game as complete if the hotkey is pressed (and some time buffer) -- the time buffer should hopefully prevent somebody from attempting to -- press the hotkey and the game swapping, marking the wrong game complete - if current_input[config.hk_complete] and not prev_input[config.hk_complete] and - frames_since_restart > math.min(3, config.min_swap/2) * 60 then mark_complete() end + if current_input[config.hk_complete] and not prev_input[config.hk_complete] and frames_since_restart > math.min(3, config.min_swap/2) * 60 then + mark_complete() + elseif current_input[config.hk_swap] and not prev_input[config.hk_swap] then + swap_game() + end prev_input = current_input -- time to swap! From f3487ebe5c0b42916210c09c84fac01513d6cae9 Mon Sep 17 00:00:00 2001 From: Eddie Date: Mon, 13 May 2024 04:05:45 -0500 Subject: [PATCH 2/3] hotkey option in setup and hotkey detection in main script --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3bfb89d..6475b37 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,9 @@ * [tested on Bizhawk v2.6.3-v2.9.1](https://github.com/TASVideos/BizHawk/releases/) * [click here to download the latest version](https://github.com/authorblues/bizhawk-shuffler-2/archive/refs/heads/main.zip) +## Hotkey for Manual Swap +* This fork adds a manual swap on input as well as additional hotkey combinations + ## Additional Resources * **[Setup Instructions](https://github.com/authorblues/bizhawk-shuffler-2/wiki/Setup-Instructions)** * [Frequently Asked Questions](https://github.com/authorblues/bizhawk-shuffler-2/wiki/Frequently-Asked-Questions) - important info! From 6e3543f897b7ba158cc96d2cf5852ffe52617ef7 Mon Sep 17 00:00:00 2001 From: edzwoo Date: Sun, 19 May 2024 23:21:41 -0500 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6475b37..e8719fe 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Bizhawk Shuffler 2 * written by authorblues, inspired by [Brossentia's Bizhawk Shuffler](https://github.com/brossentia/BizHawk-Shuffler), based on slowbeef's original project * [tested on Bizhawk v2.6.3-v2.9.1](https://github.com/TASVideos/BizHawk/releases/) -* [click here to download the latest version](https://github.com/authorblues/bizhawk-shuffler-2/archive/refs/heads/main.zip) +* [click here to download the latest version](https://github.com/edzwoo/bizhawk-shuffler-2/archive/refs/heads/main.zip) ## Hotkey for Manual Swap * This fork adds a manual swap on input as well as additional hotkey combinations