diff options
author | 2020-12-27 01:32:37 +1100 | |
---|---|---|
committer | 2020-12-27 01:32:37 +1100 | |
commit | 9e36b6a6d951ea6f2d72cab874c3c8e72d001001 (patch) | |
tree | c41bfd0c1b499d790c4091eb266caf6955219fc1 /plugins/autofire/autofire_menu.lua | |
parent | 509c946736b5f02cac84d19f2cde4e966d637a2c (diff) |
More Lua interface cleanup - it's simpler with cleaner underlyng APIs.
Made the sound manager mute controls readable, and got rid of system
enable since it just controls system mute anyway. This was causing
confusion: phantom2 was trying to use both independentlyt casuing the
mute bit to be ignored.
THe Lua interface changes are mostly changing methods to properties,
some renames to make things clearer, and some additional properties for
better control over snapshots.
Diffstat (limited to 'plugins/autofire/autofire_menu.lua')
-rw-r--r-- | plugins/autofire/autofire_menu.lua | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/autofire/autofire_menu.lua b/plugins/autofire/autofire_menu.lua index b9fb89d5042..14ad0ea0634 100644 --- a/plugins/autofire/autofire_menu.lua +++ b/plugins/autofire/autofire_menu.lua @@ -63,7 +63,7 @@ local function populate_main_menu(buttons) -- Round to two decimal places rate = math.floor(rate * 100) / 100 local text = button.button.name .. ' [' .. rate .. ' Hz]' - local subtext = manager:machine():input():seq_name(button.key) + local subtext = manager.machine.input:seq_name(button.key) menu[#menu + 1] = {text, subtext, ''} end content_height = #menu @@ -76,7 +76,7 @@ end local function handle_main_menu(index, event, buttons) local section, adjusted_index = menu_section(index) if section == MENU_SECTIONS.CONTENT then - manager:machine():popmessage(_('Press UI Clear to delete')) + manager.machine:popmessage(_('Press UI Clear to delete')) if event == 'select' then current_button = buttons[adjusted_index] table.insert(menu_stack, MENU_TYPES.EDIT) @@ -99,7 +99,7 @@ end local function populate_configure_menu(menu) local button_name = current_button.button and current_button.button.name or _('NOT SET') - local key_name = current_button.key and manager:machine():input():seq_name(current_button.key) or _('NOT SET') + local key_name = current_button.key and manager.machine.input:seq_name(current_button.key) or _('NOT SET') menu[#menu + 1] = {_('Input'), button_name, ''} menu[#menu + 1] = {_('Hotkey'), key_name, ''} menu[#menu + 1] = {_('On frames'), current_button.on_frames, current_button.on_frames > 1 and 'lr' or 'r'} @@ -108,26 +108,26 @@ end -- Borrowed from the cheat plugin local function poll_for_hotkey() - local input = manager:machine():input() + local input = manager.machine.input local poller = input:switch_sequence_poller() - manager:machine():popmessage(_('Press button for hotkey or wait to leave unchanged')) - manager:machine():video():frame_update(true) + manager.machine:popmessage(_('Press button for hotkey or wait to leave unchanged')) + manager.machine.video:frame_update() poller:start() local time = os.clock() local clearmsg = true 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")) + manager.machine:popmessage(_("Invalid sequence entered")) clearmsg = false break end - manager:machine():popmessage(input:seq_name(poller.sequence)) - manager:machine():video():frame_update(true) + manager.machine:popmessage(input:seq_name(poller.sequence)) + manager.machine.video:frame_update() end end if clearmsg then - manager:machine():popmessage() + manager.machine:popmessage() end return poller.valid and poller.sequence or nil end @@ -156,7 +156,7 @@ local function handle_configure_menu(index, event) end elseif index == 3 then -- On frames - manager:machine():popmessage(_('Number of frames button will be pressed')) + manager.machine:popmessage(_('Number of frames button will be pressed')) if event == 'left' then current_button.on_frames = current_button.on_frames - 1 elseif event == 'right' then @@ -164,7 +164,7 @@ local function handle_configure_menu(index, event) end elseif index == 4 then -- Off frames - manager:machine():popmessage(_('Number of frames button will be released')) + manager.machine:popmessage(_('Number of frames button will be released')) if event == 'left' then current_button.off_frames = current_button.off_frames - 1 elseif event == 'right' then @@ -244,7 +244,7 @@ local function populate_button_menu() menu[#menu + 1] = {'---', '', ''} header_height = #menu - for port_key, port in pairs(manager:machine():ioport().ports) do + for port_key, port in pairs(manager.machine.ioport.ports) do for field_key, field in pairs(port.fields) do if is_supported_input(field) then menu[#menu + 1] = {field.name, '', ''} @@ -295,7 +295,7 @@ function lib:populate_menu(buttons) end function lib:handle_menu_event(index, event, buttons) - manager:machine():popmessage() + manager.machine:popmessage() local current_menu = menu_stack[#menu_stack] if current_menu == MENU_TYPES.MAIN then return handle_main_menu(index, event, buttons) |