summaryrefslogtreecommitdiffstatshomepage
path: root/plugins/autofire/init.lua
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2023-03-23 03:39:54 +1100
committer Vas Crabb <vas@vastheman.com>2023-03-23 03:39:54 +1100
commit00f317b3d321d25b3ca404870beb7e12b092c376 (patch)
tree34b329250993a3439fc32ccc78582f9089471977 /plugins/autofire/init.lua
parent38aef3891af1bca4b43f5f5a7914bfb58253f15e (diff)
-ui/menu.cpp: Don't pass IPT_UI_BACK event to the implementation when dismissing the menu.
-plugins/autofire, plugins/inputmacro: Don't be so eager to create empty settings folders.
Diffstat (limited to 'plugins/autofire/init.lua')
-rw-r--r--plugins/autofire/init.lua13
1 files changed, 9 insertions, 4 deletions
diff --git a/plugins/autofire/init.lua b/plugins/autofire/init.lua
index 9e4743718cb..ab5e7b11f47 100644
--- a/plugins/autofire/init.lua
+++ b/plugins/autofire/init.lua
@@ -23,13 +23,12 @@ function autofire.startplugin()
-- 'counter' - position in autofire cycle
local buttons = {}
+ local input_manager
local menu_handler
local function process_frame()
- local input = manager.machine.input
-
local function process_button(button)
- local pressed = input:seq_pressed(button.key)
+ local pressed = input_manager:seq_pressed(button.key)
if pressed then
local state = button.counter < button.on_frames and 1 or 0
button.counter = (button.counter + 1) % (button.on_frames + button.off_frames)
@@ -65,6 +64,8 @@ function autofire.startplugin()
if loader then
buttons = loader:load_settings()
end
+
+ input_manager = manager.machine.input
end
local function save_settings()
@@ -74,6 +75,7 @@ function autofire.startplugin()
end
menu_handler = nil
+ input_manager = nil
buttons = {}
end
@@ -87,7 +89,10 @@ function autofire.startplugin()
local function menu_populate()
if not menu_handler then
- menu_handler = require('autofire/autofire_menu')
+ local status, msg = pcall(function () menu_handler = require('autofire/autofire_menu') end)
+ if not status then
+ emu.print_error(string.format('Error loading autofire menu: %s', msg))
+ end
if menu_handler then
menu_handler:init_menu(buttons)
end