diff options
author | 2020-12-09 01:01:22 +1100 | |
---|---|---|
committer | 2020-12-09 01:10:26 +1100 | |
commit | e008c7b1b1042d644be2a1e177ffa15d53e942c5 (patch) | |
tree | d248f9fcbe15563c46c1ae9605d35a19ed4ada5e /plugins/cheat/init.lua | |
parent | 06568860e7a30424bab61498cd2a8a44889e4412 (diff) |
-Lua engine cleanup, input edition:
* Modernised and cleaned up Lua bindings for input classes.
* Exposed the input_sequence_poller class to Lua and updated the
autofire and cheat plugins to use it, rather than continuing to
pretend it's part of the input manager.
* Exposed more of the natural keyboard manager, including the ability
to enable/disable individual keyboard and keypad devices like you
can from the keyboard mode menu.
* Exposed a few more things on ioport_port and input_device.
-plugins/cheat: Fixed menu item not updating visually when disabling a
cheat with UI Left.
-plugins/cheatfind: Fixed not finding the first screen after screen
enumerator was exposed as an object rather than using a table.
-bwidow.cpp, pacman.cpp: Minor cleanup to recent changes.
Diffstat (limited to 'plugins/cheat/init.lua')
-rw-r--r-- | plugins/cheat/init.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua index 3fa625fb4d3..970e7f3a848 100644 --- a/plugins/cheat/init.lua +++ b/plugins/cheat/init.lua @@ -610,24 +610,25 @@ function cheat.startplugin() local function hkcbfunc(cheat) local input = manager:machine():input() + local poller = input:sequence_poller() manager:machine():popmessage(_("Press button for hotkey or wait to clear")) manager:machine():video():frame_update(true) - input:seq_poll_start("switch") + poller:start("switch") local time = os.clock() local clearmsg = true - while (not input:seq_poll()) and (input.seq_poll_modified() or (os.clock() < time + 1)) do - if input:seq_poll_modified() then - if not input:seq_poll_valid() then + while (not poller:poll()) and (poller.modified or (os.clock() < time + 1)) do + if poller.modified then + if not poller.valid then manager:machine():popmessage(_("Invalid sequence entered")) clearmsg = false break end - manager:machine():popmessage(input:seq_name(input:seq_poll_sequence())) + manager:machine():popmessage(input:seq_name(poller.sequence)) manager:machine():video():frame_update(true) end end - if input:seq_poll_valid() then - cheat.hotkeys = {pressed = false, keys = input:seq_poll_final()} + if poller.valid then + cheat.hotkeys = { pressed = false, keys = poller.sequence } else cheat.hotkeys = nil end @@ -748,7 +749,8 @@ function cheat.startplugin() return chg else if not cheat.is_oneshot then - return cheat:set_enabled(false) + local state, chg = cheat:set_enabled(false) + return chg end return false end |