summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-02-18 06:18:45 +1100
committer Vas Crabb <vas@vastheman.com>2023-02-18 06:18:45 +1100
commitd4589e0b29d6085072ff635d87c3d95c21813a58 (patch)
treec0d3283ecdd99bd380fc155f4e09b7f4bd573116 /plugins
parent20d7135179ffe9959f4bfb759a0e5735b7aaaf15 (diff)
Input refactoring:
osd/modules/input, emu/inpttype.cpp: Made most default joystick assignments supplied by input modules. Input modules take available controls into consideration when generating default assignments. emu/inpttype.ipp: Added a separate "Back" UI input separate from Cancel. You may want an easier to hit combination for moving to the previous menu than for exiting or cancelling input. They both default to Escape. emu/inpttype.ipp: Added a UI Help control. Currently only used by analog inputs menu emu/inpttype.h: Moved I/O port field type enum to its own header and sorted UI controls so they appear in a more logical order. ui: Don't use UI Select to restore defaults - people should be getting used to the UI Clear input by now. UI Select cycles multi-value items instead. ui/inputmap.cpp: Don't use immediate cancel to cycle between clearing and restoring default assignment (use UI Clear instead). osd: Reduced the number of files needing to include the dreaded emu.h. Got some implementation out of headers.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autofire/autofire_menu.lua4
-rw-r--r--plugins/cheat/init.lua2
-rw-r--r--plugins/cheatfind/init.lua2
-rw-r--r--plugins/commonui/init.lua8
-rw-r--r--plugins/inputmacro/inputmacro_menu.lua6
5 files changed, 13 insertions, 9 deletions
diff --git a/plugins/autofire/autofire_menu.lua b/plugins/autofire/autofire_menu.lua
index e2287ce2276..c53dd711f53 100644
--- a/plugins/autofire/autofire_menu.lua
+++ b/plugins/autofire/autofire_menu.lua
@@ -248,7 +248,7 @@ end
local function handle_edit_menu(index, event, buttons)
local section, adjusted_index = menu_section(index)
- if ((section == MENU_SECTIONS.FOOTER) and (event == 'select')) or (event == 'cancel') then
+ if ((section == MENU_SECTIONS.FOOTER) and (event == 'select')) or (event == 'back') then
configure_menu_active = false
table.remove(menu_stack)
return true
@@ -285,7 +285,7 @@ end
local function handle_add_menu(index, event, buttons)
local section, adjusted_index = menu_section(index)
- if ((section == MENU_SECTIONS.FOOTER) and (event == 'select')) or (event == 'cancel') then
+ if ((section == MENU_SECTIONS.FOOTER) and (event == 'select')) or (event == 'back') then
configure_menu_active = false
table.remove(menu_stack)
if is_button_complete(current_button) and (event == 'select') then
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua
index 47d7db26cc2..f76ffcdf62a 100644
--- a/plugins/cheat/init.lua
+++ b/plugins/cheat/init.lua
@@ -714,7 +714,7 @@ function cheat.startplugin()
local function menu_callback(index, event)
manager.machine:popmessage()
if hotkeymenu then
- if event == "cancel" then
+ if event == "back" then
hotkeymenu = false
return true
else
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua
index 7c3cea73e8b..d86315d7156 100644
--- a/plugins/cheatfind/init.lua
+++ b/plugins/cheatfind/init.lua
@@ -1044,7 +1044,7 @@ function cheatfind.startplugin()
end
local function menu_callback(index, event)
- if event == "cancel" and pausesel == 1 then
+ if event == "back" and pausesel == 1 then
emu.unpause()
menu_is_showing = false
return false -- return false so menu will be popped off the stack
diff --git a/plugins/commonui/init.lua b/plugins/commonui/init.lua
index 064d87c2c5e..5219e7dbb9e 100644
--- a/plugins/commonui/init.lua
+++ b/plugins/commonui/init.lua
@@ -106,7 +106,7 @@ function commonui.input_selection_menu(action, title, filter)
function menu:handle(index, event)
local selection
- if (event == 'cancel') or ((index == input_item_cancel) and (event == 'select')) then
+ if (event == 'back') or ((index == input_item_cancel) and (event == 'select')) then
action(nil)
return true
elseif event == 'select' then
@@ -177,16 +177,18 @@ function commonui.switch_polling_helper(starting_sequence)
if uiinput:pressed(cancel) then
-- UI_CANCEL pressed, abort
machine:popmessage()
+ uiinput:reset()
if (not poller.modified) or (modified_ticks == emu.osd_ticks()) then
-- cancelled immediately
- self.sequence = nil
- return true -- TODO: communicate this better?
+ self.sequence = nil -- TODO: communicate this better?
+ return true
else
-- entered something before cancelling
self.sequence = nil
return true
end
elseif poller:poll() then
+ uiinput:reset()
if poller.valid then
-- valid sequence entered
machine:popmessage()
diff --git a/plugins/inputmacro/inputmacro_menu.lua b/plugins/inputmacro/inputmacro_menu.lua
index 3ef5aa3f6e7..48fef405d0f 100644
--- a/plugins/inputmacro/inputmacro_menu.lua
+++ b/plugins/inputmacro/inputmacro_menu.lua
@@ -160,6 +160,8 @@ local function handle_edit_items(index, event)
end
edit_name_buffer = nil
return true
+ elseif event == 'back' then
+ return true -- swallow back while editing text
elseif event == 'cancel' then
edit_name_buffer = nil
return true
@@ -434,7 +436,7 @@ local function handle_add(index, event)
local handled, selection = handle_edit_items(index, event)
if handled then
return true, selection
- elseif event == 'cancel' then
+ elseif event == 'back' then
edit_current_macro = nil
edit_menu_active = false
edit_items = nil
@@ -458,7 +460,7 @@ local function handle_edit(index, event)
local handled, selection = handle_edit_items(index, event)
if handled then
return true, selection
- elseif (event == 'cancel') or ((index == edit_item_exit) and (event == 'select')) then
+ elseif (event == 'back') or ((index == edit_item_exit) and (event == 'select')) then
edit_current_macro = nil
edit_menu_active = false
edit_items = nil