summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autofire/autofire_menu.lua28
-rw-r--r--plugins/autofire/autofire_save.lua8
-rw-r--r--plugins/autofire/init.lua4
-rw-r--r--plugins/boot.lua4
-rw-r--r--plugins/cheat/cheat_simple.lua8
-rw-r--r--plugins/cheat/cheat_xml.lua2
-rw-r--r--plugins/cheat/init.lua88
-rw-r--r--plugins/cheatfind/init.lua72
-rw-r--r--plugins/console/init.lua4
-rw-r--r--plugins/data/data_hiscore.lua8
-rw-r--r--plugins/data/data_marp.lua2
-rw-r--r--plugins/data/database.lua4
-rw-r--r--plugins/data/load_dat.lua2
-rw-r--r--plugins/discord/init.lua4
-rw-r--r--plugins/gdbstub/init.lua4
-rw-r--r--plugins/hiscore/init.lua6
-rw-r--r--plugins/layout/init.lua4
-rw-r--r--plugins/portname/init.lua18
-rw-r--r--plugins/timer/init.lua2
19 files changed, 136 insertions, 136 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)
diff --git a/plugins/autofire/autofire_save.lua b/plugins/autofire/autofire_save.lua
index 07c4032b434..0576a95582d 100644
--- a/plugins/autofire/autofire_save.lua
+++ b/plugins/autofire/autofire_save.lua
@@ -1,7 +1,7 @@
local lib = {}
local function get_settings_path()
- return emu.subst_env(manager:machine():options().entries.homepath:value():match('([^;]+)')) .. '/autofire/'
+ return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/autofire/'
end
local function get_settings_filename()
@@ -13,12 +13,12 @@ local function initialize_button(settings)
local new_button = {
port = settings.port,
field = settings.field,
- key = manager:machine():input():seq_from_tokens(settings.key),
+ key = manager.machine.input:seq_from_tokens(settings.key),
on_frames = settings.on_frames,
off_frames = settings.off_frames,
counter = 0
}
- local port = manager:machine():ioport().ports[settings.port]
+ local port = manager.machine.ioport.ports[settings.port]
if port then
local field = port.fields[settings.field]
if field then
@@ -36,7 +36,7 @@ local function serialize_settings(button_list)
setting = {
port = button.port,
field = button.field,
- key = manager:machine():input():seq_to_tokens(button.key),
+ key = manager.machine.input:seq_to_tokens(button.key),
on_frames = button.on_frames,
off_frames = button.off_frames
}
diff --git a/plugins/autofire/init.lua b/plugins/autofire/init.lua
index da9a223faa4..72ee65672d4 100644
--- a/plugins/autofire/init.lua
+++ b/plugins/autofire/init.lua
@@ -24,7 +24,7 @@ function autofire.startplugin()
local current_rom = nil
local function process_button(button)
- local pressed = manager:machine():input():seq_pressed(button.key)
+ local pressed = manager.machine.input: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)
@@ -59,7 +59,7 @@ function autofire.startplugin()
local function reinit_buttons()
for i, button in ipairs(buttons) do
button.counter = 0
- button.button = manager:machine():ioport().ports[button.port].fields[button.field]
+ button.button = manager.machine.ioport.ports[button.port].fields[button.field]
end
end
diff --git a/plugins/boot.lua b/plugins/boot.lua
index 3a4de6fcc7c..8ae3e069755 100644
--- a/plugins/boot.lua
+++ b/plugins/boot.lua
@@ -5,7 +5,7 @@ require('lfs')
_G._ = emu.lang_translate
_G.emu.plugin = {} -- table to contain plugin interfaces
-- substitute environment variables in the plugins path from options
-local dirs = emu.subst_env(manager:options().entries.pluginspath:value())
+local dirs = emu.subst_env(manager.options.entries.pluginspath:value())
-- and split the paths apart and make them suitable for package.path
package.path = ""
@@ -16,7 +16,7 @@ for dir in string.gmatch(dirs, "([^;]+)") do
package.path = package.path .. dir .. "/?.lua;" .. dir .. "/?/init.lua"
end
-for _,entry in pairs(manager:plugins()) do
+for _,entry in pairs(manager.plugins) do
if (entry.type == "plugin" and entry.start) then
emu.print_verbose("Starting plugin " .. entry.name .. "...")
plugin = require(entry.name)
diff --git a/plugins/cheat/cheat_simple.lua b/plugins/cheat/cheat_simple.lua
index 9640cf22bc6..f65cc9e46b7 100644
--- a/plugins/cheat/cheat_simple.lua
+++ b/plugins/cheat/cheat_simple.lua
@@ -48,7 +48,7 @@ local function prepare_rom_cheat(desc, region, addr, val, size, banksize, comp)
end
if banksize and comp then
- local rom = manager:machine():memory().regions[region]
+ local rom = manager.machine.memory.regions[region]
local bankaddr = addr & (banksize - 1)
addr = nil
if not rom then
@@ -92,7 +92,7 @@ function codefuncs.nes_gg(desc, code)
if #code == 6 then
addr = ((value >> 4) & 7) | ((value >> 8) & 0x78) | ((value >> 12) & 0x80) | ((value << 8) & 0x700) | ((value << 4) & 0x7800)
newval = ((value >> 20) & 7) | (value & 8) | ((value >> 12) & 0x70) | ((value >> 16) & 0x80)
- if manager:machine():memory().regions[":nes_slot:cart:prg_rom"].size > 32768 then
+ if manager.machine.memory.regions[":nes_slot:cart:prg_rom"].size > 32768 then
emu.print_verbose("warning: gamegenie 6 char code with banked rom " .. desc)
end
return prepare_rom_cheat(desc, ":nes_slot:cart:prg_rom", addr, newval, 8)
@@ -130,7 +130,7 @@ local function snes_prepare_cheat(desc, addr, val)
if ((bank <= 0x3f) and (offset < 0x2000)) or ((bank & 0xfe) == 0x7e) then
return prepare_ram_cheat(desc, ":maincpu", addr, val, 8)
end
- if (manager:machine().devices[":maincpu"].spaces["program"]:read_u8(0xffd5) & 1) == 1 then --hirom
+ if (manager.machine.devices[":maincpu"].spaces["program"]:read_u8(0xffd5) & 1) == 1 then --hirom
if (bank & 0x7f) <= 0x3f and offset >= 0x8000 then
-- direct map
elseif (bank & 0x7f) >= 0x40 and (bank & 0x7f) <= 0x7d then
@@ -309,7 +309,7 @@ function simple.conv_cheat(data)
end
offset = tonumber(offset, 16)
val = tonumber(val, 16)
- if manager:machine().devices[cputag] then
+ if manager.machine.devices[cputag] then
cheat = prepare_ram_cheat(desc, cputag, offset, val, size)
else
cheat = prepare_rom_cheat(desc, cputag, offset, val, size)
diff --git a/plugins/cheat/cheat_xml.lua b/plugins/cheat/cheat_xml.lua
index d5cee8ac2a2..d9032814f30 100644
--- a/plugins/cheat/cheat_xml.lua
+++ b/plugins/cheat/cheat_xml.lua
@@ -59,7 +59,7 @@ function xml.conv_cheat(data)
data = xml_parse(data)
local cpu_spaces = {}
- for tag, device in pairs(manager:machine().devices) do
+ for tag, device in pairs(manager.machine.devices) do
local sp
for name, space in pairs(device.spaces) do
if not sp then
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua
index 83dbdc7bfb1..46a086f8ac2 100644
--- a/plugins/cheat/init.lua
+++ b/plugins/cheat/init.lua
@@ -94,12 +94,12 @@ function cheat.startplugin()
local function load_cheats()
local filename = emu.romname()
local newcheats = {}
- local file = emu.file(manager:machine():options().entries.cheatpath:value():gsub("([^;]+)", "%1;%1/cheat") , 1)
+ local file = emu.file(manager.machine.options.entries.cheatpath:value():gsub("([^;]+)", "%1;%1/cheat") , 1)
if emu.softname() ~= "" then
if emu.softname():find(":") then
filename = emu.softname():gsub(":", "/")
else
- for name, image in pairs(manager:machine().images) do
+ for name, image in pairs(manager.machine.images) do
if image:exists() and image:software_list_name() ~= "" then
filename = image:software_list_name() .. "/" .. emu.softname()
end
@@ -134,7 +134,7 @@ function cheat.startplugin()
local function load_hotkeys()
local json = require("json")
- local file = io.open(emu.subst_env(manager:machine():options().entries.cheatpath:value():match("([^;]+)")) .. "/" .. cheatname .. "_hotkeys.json", "r")
+ local file = io.open(emu.subst_env(manager.machine.options.entries.cheatpath:value():match("([^;]+)")) .. "/" .. cheatname .. "_hotkeys.json", "r")
if not file then
return
end
@@ -142,7 +142,7 @@ function cheat.startplugin()
for num, val in ipairs(hotkeys) do
for num, cheat in pairs(cheats) do
if val.desc == cheat.desc then
- cheat.hotkeys = {pressed = false, keys = manager:machine():input():seq_from_tokens(val.keys)}
+ cheat.hotkeys = {pressed = false, keys = manager.machine.input:seq_from_tokens(val.keys)}
end
end
end
@@ -152,7 +152,7 @@ function cheat.startplugin()
local hotkeys = {}
for num, cheat in ipairs(cheats) do
if cheat.hotkeys then
- local hotkey = {desc = cheat.desc, keys = manager:machine():input():seq_to_tokens(cheat.hotkeys.keys)}
+ local hotkey = {desc = cheat.desc, keys = manager.machine.input:seq_to_tokens(cheat.hotkeys.keys)}
if hotkey.keys ~= "" then
hotkeys[#hotkeys + 1] = hotkey
end
@@ -160,7 +160,7 @@ function cheat.startplugin()
end
if #hotkeys > 0 then
local json = require("json")
- local path = emu.subst_env(manager:machine():options().entries.cheatpath:value():match("([^;]+)"))
+ local path = emu.subst_env(manager.machine.options.entries.cheatpath:value():match("([^;]+)"))
local attr = lfs.attributes(path)
if not attr then
lfs.mkdir(path)
@@ -215,7 +215,7 @@ function cheat.startplugin()
return
end
if type(x) == "string" then
- y = y * mame_manager:ui():get_line_height()
+ y = y * mame_manager.ui.line_height
end
output[#output + 1] = { type = "text", scr = screen, x = x, y = y, str = str, color = color }
end
@@ -278,13 +278,13 @@ function cheat.startplugin()
run_if(wp.cheat, wp.func)
-- go in case a debugger other than "none" is enabled
-- don't use an b/wpset action because that will supress the b/wp index
- manager:machine():debugger().execution_state = "run"
+ manager.machine.debugger.execution_state = "run"
end
else
local bp = breaks[point]
if bp then
run_if(bp.cheat, bp.func)
- manager:machine():debugger().execution_state = "run"
+ manager.machine.debugger.execution_state = "run"
end
end
end
@@ -313,7 +313,7 @@ function cheat.startplugin()
end
local function bwpclr(cheat)
- if not manager:machine():debugger() then
+ if not manager.machine.debugger then
return
end
for num, bp in pairs(breaks) do
@@ -340,7 +340,7 @@ function cheat.startplugin()
if entry.port:sub(1, 1) ~= ":" then
entry.port = ":" .. entry.port
end
- local port = manager:machine():ioport().ports[entry.port]
+ local port = manager.machine.ioport.ports[entry.port]
if not port then
errout(entry.port, entry.field)
end
@@ -372,7 +372,7 @@ function cheat.startplugin()
error("input_run only allowed in one shot cheats")
return
end
- local _, screen = next(manager:machine().screens)
+ local _, screen = next(manager.machine.screens)
list.begin = screen:frame_number()
inputs[#inputs + 1] = list
end
@@ -451,7 +451,7 @@ function cheat.startplugin()
frombcd = frombcd,
pairs = pairs,
ipairs = ipairs,
- outputs = manager:machine():outputs(),
+ outputs = manager.machine.output,
time = time,
input_trans = input_trans,
input_run = function(list) input_run(cheat, list) end,
@@ -483,8 +483,8 @@ function cheat.startplugin()
if cheat.cpu then
cheat.cpudev = {}
for name, tag in pairs(cheat.cpu) do
- if manager:machine():debugger() then
- local dev = manager:machine().devices[tag]
+ if manager.machine.debugger then
+ local dev = manager.machine.devices[tag]
if not dev or not dev.debug then
cheat_error(cheat, "missing or invalid device " .. tag)
return
@@ -505,7 +505,7 @@ function cheat.startplugin()
if cheat.space then
for name, space in pairs(cheat.space) do
local cpu, mem
- cpu = manager:machine().devices[space.tag]
+ cpu = manager.machine.devices[space.tag]
if not cpu then
cheat_error(cheat, "missing device " .. space.tag)
return
@@ -525,17 +525,17 @@ function cheat.startplugin()
end
if cheat.screen then
for name, screen in pairs(cheat.screen) do
- local scr = manager:machine().screens[screen]
+ local scr = manager.machine.screens[screen]
if not scr then
local tag
- tag, scr = next(manager:machine().screens) -- get any screen
+ tag, scr = next(manager.machine.screens) -- get any screen
end
cheat.cheat_env[name] = scr
end
end
if cheat.region then
for name, region in pairs(cheat.region) do
- local mem = manager:machine():memory().regions[region]
+ local mem = manager.machine.memory.regions[region]
if not mem then
cheat_error(cheat, "missing region " .. region)
return
@@ -545,7 +545,7 @@ function cheat.startplugin()
end
if cheat.ram then
for name, tag in pairs(cheat.ram) do
- local ram = manager:machine().devices[tag]
+ local ram = manager.machine.devices[tag]
if not ram then
cheat_error(cheat, "missing ram device " .. tag)
return
@@ -555,7 +555,7 @@ function cheat.startplugin()
end
if cheat.share then
for name, tag in pairs(cheat.share) do
- local share = manager:machine():memory().shares[tag]
+ local share = manager.machine.memory.shares[tag]
if not share then
cheat_error(cheat, "missing share " .. share)
return
@@ -615,36 +615,36 @@ function cheat.startplugin()
return
end
- 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 poller.modified and poller.valid then
cheat.hotkeys = { pressed = false, keys = poller.sequence }
end
if clearmsg then
- manager:machine():popmessage()
+ manager.machine:popmessage()
end
- manager:machine():video():frame_update(true)
+ manager.machine.video:frame_update()
end
for num, cheat in ipairs(cheats) do
if cheat.script then
- menu[#menu + 1] = {cheat.desc, cheat.hotkeys and manager:machine():input():seq_name(cheat.hotkeys.keys) or _("None"), ""}
+ menu[#menu + 1] = {cheat.desc, cheat.hotkeys and manager.machine.input:seq_name(cheat.hotkeys.keys) or _("None"), ""}
hotkeylist[#hotkeylist + 1] = function(event) return hkcbfunc(cheat, event) end
end
end
@@ -703,7 +703,7 @@ function cheat.startplugin()
end
local function menu_callback(index, event)
- manager:machine():popmessage()
+ manager.machine:popmessage()
if hotkeymenu then
if event == "select" or event == "clear" then
index = index - 3
@@ -745,7 +745,7 @@ function cheat.startplugin()
end
if event == "up" or event == "down" or event == "comment" then
if cheat.comment then
- manager:machine():popmessage(string.format(_("Cheat Comment:\n%s"), cheat.comment))
+ manager.machine:popmessage(string.format(_("Cheat Comment:\n%s"), cheat.comment))
end
elseif event == "left" then
if cheat.parameter then
@@ -779,9 +779,9 @@ function cheat.startplugin()
else
itemtext = cheat.parameter.value
end
- manager:machine():popmessage(string.format(_("Activated: %s = %s"), cheat.desc, itemtext))
+ manager.machine:popmessage(string.format(_("Activated: %s = %s"), cheat.desc, itemtext))
elseif not cheat.parameter and cheat.script.on then
- manager:machine():popmessage(string.format(_("Activated: %s"), cheat.desc))
+ manager.machine:popmessage(string.format(_("Activated: %s"), cheat.desc))
end
end
end
@@ -803,7 +803,7 @@ function cheat.startplugin()
start_time = emu.time()
cheats = load_cheats()
local json = require("json")
- local file = io.open(manager:machine():options().entries.cheatpath:value():match("([^;]+)") .. "/output.json", "w")
+ local file = io.open(manager.machine.options.entries.cheatpath:value():match("([^;]+)") .. "/output.json", "w")
if file then
file:write(json.stringify(cheats, {indent = true}))
file:close()
@@ -812,8 +812,8 @@ function cheat.startplugin()
parse_cheat(cheat)
end
load_hotkeys()
- if manager:machine():debugger() then
- consolelog = manager:machine():debugger().consolelog
+ if manager.machine.debugger then
+ consolelog = manager.machine.debugger.consolelog
consolelast = 0
end
end)
@@ -833,22 +833,22 @@ function cheat.startplugin()
run_if(cheat, cheat.script.run)
end
if cheat.hotkeys and cheat.hotkeys.keys then
- if manager:machine():input():seq_pressed(cheat.hotkeys.keys) then
+ if manager.machine.input:seq_pressed(cheat.hotkeys.keys) then
if not cheat.hotkeys.pressed then
if cheat.is_oneshot then
if not run_if(cheat, cheat.script.change) then
run_if(cheat, cheat.script.on)
end
- manager:machine():popmessage(string.format(_("Activated: %s"), cheat.desc))
+ manager.machine:popmessage(string.format(_("Activated: %s"), cheat.desc))
elseif not cheat.enabled then
cheat.enabled = true
run_if(cheat, cheat.script.on)
- manager:machine():popmessage(string.format(_("Enabled: %s"), cheat.desc))
+ manager.machine:popmessage(string.format(_("Enabled: %s"), cheat.desc))
else
cheat.enabled = false
run_if(cheat, cheat.script.off)
bwpclr(cheat)
- manager:machine():popmessage(string.format(_("Disabled: %s"), cheat.desc))
+ manager.machine:popmessage(string.format(_("Disabled: %s"), cheat.desc))
end
end
cheat.hotkeys.pressed = true
@@ -858,7 +858,7 @@ function cheat.startplugin()
end
end
for num, input in pairs(inputs) do
- local _, screen = next(manager:machine().screens)
+ local _, screen = next(manager.machine.screens)
local framenum = screen:frame_number() - input.begin
local enttab = input.start[framenum]
if enttab then
@@ -907,7 +907,7 @@ function cheat.startplugin()
function ce.inject(newcheat)
cheats[#cheats + 1] = newcheat
parse_cheat(newcheat)
- manager:machine():popmessage(string.format(_("%s added"), newcheat.desc))
+ manager.machine:popmessage(string.format(_("%s added"), newcheat.desc))
end
function ce.get(index)
@@ -922,7 +922,7 @@ function cheat.startplugin()
is_oneshot = cheat.is_oneshot,
comment = cheat.comment,
get_hotkeys = function() if cheat.hotkeys then return cheat.hotkeys.keys end return nil end,
- set_hotkeys = function(seq) cheat.hotkeys = { pressed = false, keys = manager:machine():input():seq_clean(seq) } end
+ set_hotkeys = function(seq) cheat.hotkeys = { pressed = false, keys = manager.machine.input:seq_clean(seq) } end
}
if cheat.script then
intf.script = {}
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua
index 1a3be72d9bc..9ac4db42e21 100644
--- a/plugins/cheatfind/init.lua
+++ b/plugins/cheatfind/init.lua
@@ -16,7 +16,7 @@ function cheatfind.startplugin()
-- return table of devices and spaces
function cheat.getspaces()
local spaces = {}
- for tag, device in pairs(manager:machine().devices) do
+ for tag, device in pairs(manager.machine.devices) do
if device.spaces then
spaces[tag] = {}
for name, space in pairs(device.spaces) do
@@ -30,7 +30,7 @@ function cheatfind.startplugin()
-- return table of ram devices
function cheat.getram()
local ram = {}
- for tag, device in pairs(manager:machine().devices) do
+ for tag, device in pairs(manager.machine.devices) do
if device.shortname == "ram" then
ram[tag] = {}
ram[tag].dev = device
@@ -43,7 +43,7 @@ function cheatfind.startplugin()
-- return table of share regions
function cheat.getshares()
local shares = {}
- for tag, share in pairs(manager:machine():memory().shares) do
+ for tag, share in pairs(manager.machine.memory.shares) do
shares[tag] = share
end
return shares
@@ -395,7 +395,7 @@ function cheatfind.startplugin()
local r
name, r = incdec(event, name, 1, #c)
if (event == "select" or event == "comment") and name == 1 then
- manager:machine():popmessage(string.format(_("Default name is %s"), cheat_save.name))
+ manager.machine:popmessage(string.format(_("Default name is %s"), cheat_save.name))
end
return r
end
@@ -424,7 +424,7 @@ function cheatfind.startplugin()
r = true
end
elseif event == "select" or event == "comment" or event == "right" then
- manager:machine():popmessage(_("You can enter any type name"))
+ manager.machine:popmessage(_("You can enter any type name"))
end
end
return r
@@ -441,7 +441,7 @@ function cheatfind.startplugin()
if name == 2 then
desc = name_type ~= #ctype and ctype[name_type] or name_other
if #desc == 0 then
- manager:machine():popmessage(_("Type name is empty"))
+ manager.machine:popmessage(_("Type name is empty"))
return
end
if cplayer[name_player] ~= "All" then
@@ -465,7 +465,7 @@ function cheatfind.startplugin()
-- old cheat .dat format, write support only (for cheat forum posting of new cheats if posted in simple format)
file:write(string.format(cheat_save.dat, desc))
file:close()
- manager:machine():popmessage(string.format(_("Cheat written to %s and added to cheat.simple"), filename))
+ manager.machine:popmessage(string.format(_("Cheat written to %s and added to cheat.simple"), filename))
end
written = true
elseif not getmetatable(devtable[devcur].space).__name:match("device_t") and devtable[devcur].sname == "program" then
@@ -475,12 +475,12 @@ function cheatfind.startplugin()
-- old cheat .dat format, write support only (for cheat forum posting of new cheats if posted in simple format)
file:write(string.format(cheat_save.dat, desc))
file:close()
- manager:machine():popmessage(_("Cheat added to cheat.simple"))
+ manager.machine:popmessage(_("Cheat added to cheat.simple"))
written = true
end
end
if not written then
- manager:machine():popmessage(_("Unable to write file\nEnsure that cheatpath folder exists"))
+ manager.machine:popmessage(_("Unable to write file\nEnsure that cheatpath folder exists"))
end
cheat_save = nil
return true
@@ -498,7 +498,7 @@ function cheatfind.startplugin()
menu_lim(devsel, 1, #devtable, m)
local function f(event)
if (event == "left" or event == "right") and #menu_blocks ~= 0 then
- manager:machine():popmessage(_("Changes to this only take effect when \"Start new search\" is selected"))
+ manager.machine:popmessage(_("Changes to this only take effect when \"Start new search\" is selected"))
end
devsel = incdec(event, devsel, 1, #devtable)
return true
@@ -515,10 +515,10 @@ function cheatfind.startplugin()
if pausesel == 1 then
pausesel = 2
menu_is_showing = false
- manager:machine():popmessage(_("Manually toggle pause when needed"))
+ manager.machine:popmessage(_("Manually toggle pause when needed"))
else
pausesel = 1
- manager:machine():popmessage(_("Automatically toggle pause with on-screen menus"))
+ manager.machine:popmessage(_("Automatically toggle pause with on-screen menus"))
emu.pause()
end
end
@@ -539,7 +539,7 @@ function cheatfind.startplugin()
menu_blocks[num] = {}
menu_blocks[num][1] = cheat.save(devtable[devcur].space, region.offset, region.size)
end
- manager:machine():popmessage(_("All slots cleared and current state saved to Slot 1"))
+ manager.machine:popmessage(_("All slots cleared and current state saved to Slot 1"))
watches = {}
opsel = 1
value = 0
@@ -562,7 +562,7 @@ function cheatfind.startplugin()
for num, region in ipairs(devtable[devcur].ram) do
menu_blocks[num][#menu_blocks[num] + 1] = cheat.save(devtable[devcur].space, region.offset, region.size)
end
- manager:machine():popmessage(string.format(_("Memory state saved to Slot %d"), #menu_blocks[1]))
+ manager.machine:popmessage(string.format(_("Memory state saved to Slot %d"), #menu_blocks[1]))
if (leftop == #menu_blocks[1] - 1 and rightop == #menu_blocks[1] - 2 ) then
leftop = #menu_blocks[1]
rightop = #menu_blocks[1]-1
@@ -609,7 +609,7 @@ function cheatfind.startplugin()
count = count + #matches[#matches][num]
end
end
- manager:machine():popmessage(string.format(_("%d total matches found"), count))
+ manager.machine:popmessage(string.format(_("%d total matches found"), count))
matches[#matches].count = count
matchpg = 0
devsel = devcur
@@ -672,25 +672,25 @@ function cheatfind.startplugin()
opsel, r = incdec(event, opsel, 1, #optable)
if event == "left" or event == "right" or event == "comment" then
if optable[opsel] == "lt" then
- manager:machine():popmessage(_("Left less than right"))
+ manager.machine:popmessage(_("Left less than right"))
elseif optable[opsel] == "gt" then
- manager:machine():popmessage(_("Left greater than right"))
+ manager.machine:popmessage(_("Left greater than right"))
elseif optable[opsel] == "eq" then
- manager:machine():popmessage(_("Left equal to right"))
+ manager.machine:popmessage(_("Left equal to right"))
elseif optable[opsel] == "ne" then
- manager:machine():popmessage(_("Left not equal to right"))
+ manager.machine:popmessage(_("Left not equal to right"))
elseif optable[opsel] == "beq" then
- manager:machine():popmessage(_("Left equal to right with bitmask"))
+ manager.machine:popmessage(_("Left equal to right with bitmask"))
elseif optable[opsel] == "bne" then
- manager:machine():popmessage(_("Left not equal to right with bitmask"))
+ manager.machine:popmessage(_("Left not equal to right with bitmask"))
elseif optable[opsel] == "ltv" then
- manager:machine():popmessage(_("Left less than value"))
+ manager.machine:popmessage(_("Left less than value"))
elseif optable[opsel] == "gtv" then
- manager:machine():popmessage(_("Left greater than value"))
+ manager.machine:popmessage(_("Left greater than value"))
elseif optable[opsel] == "eqv" then
- manager:machine():popmessage(_("Left equal to value"))
+ manager.machine:popmessage(_("Left equal to value"))
elseif optable[opsel] == "nev" then
- manager:machine():popmessage(_("Left not equal to value"))
+ manager.machine:popmessage(_("Left not equal to value"))
end
end
return r
@@ -741,11 +741,11 @@ function cheatfind.startplugin()
pokevalsel, r = incdec(event, pokevalsel, 1, #pokevaltable)
if event == "left" or event == "right" or event == "comment" then
if pokevalsel == 1 then
- manager:machine():popmessage(_("Use this if you want to poke the Slot 1 value (eg. You started with something but lost it)"))
+ manager.machine:popmessage(_("Use this if you want to poke the Slot 1 value (eg. You started with something but lost it)"))
elseif pokevalsel == 2 then
- manager:machine():popmessage(_("Use this if you want to poke the Last Slot value (eg. You started without an item but finally got it)"))
+ manager.machine:popmessage(_("Use this if you want to poke the Last Slot value (eg. You started without an item but finally got it)"))
else
- manager:machine():popmessage(string.format(_("Use this if you want to poke %s"), pokevaltable[pokevalsel]))
+ manager.machine:popmessage(string.format(_("Use this if you want to poke %s"), pokevaltable[pokevalsel]))
end
end
return r
@@ -940,7 +940,7 @@ function cheatfind.startplugin()
end
if match.mode == 1 then
if not emu.plugin.cheat then
- manager:machine():popmessage(_("Cheat engine not available"))
+ manager.machine:popmessage(_("Cheat engine not available"))
else
emu.plugin.cheat.inject(cheat)
end
@@ -954,14 +954,14 @@ function cheatfind.startplugin()
if emu.softname():find(":") then
setname = emu.softname():gsub(":", "/")
else
- for name, image in pairs(manager:machine().images) do
+ for name, image in pairs(manager.machine.images) do
if image:exists() and image:software_list_name() ~= "" then
setname = image:software_list_name() .. "/" .. emu.softname()
end
end
end
end
- cheat_save.path = emu.subst_env(manager:machine():options().entries.cheatpath:value()):match("([^;]+)")
+ cheat_save.path = emu.subst_env(manager.machine.options.entries.cheatpath:value()):match("([^;]+)")
cheat_save.filename = string.format("%s/%s", cheat_save.path, setname)
cheat_save.name = cheat.desc
local json = require("json")
@@ -970,7 +970,7 @@ function cheatfind.startplugin()
cheat_save.xml = string.format("<mamecheat version=\"1\">\n <cheat desc=\"%%s\">\n <script state=\"run\">\n <action>%s.pp%s@%X=%X</action>\n </script>\n </cheat>\n</mamecheat>", dev.tag:sub(2), widchar, match.addr, match.newval)
cheat_save.simple = string.format("%s,%s,%X,%s,%X,%%s\n", setname, dev.tag, match.addr, widchar, pokevalue)
cheat_save.dat = string.format(":%s:40000000:%X:%08X:FFFFFFFF:%%s\n", setname, match.addr, pokevalue)
- manager:machine():popmessage(string.format(_("Default name is %s"), cheat_save.name))
+ manager.machine:popmessage(string.format(_("Default name is %s"), cheat_save.name))
return true
else
local func = "return space:read"
@@ -1045,19 +1045,19 @@ function cheatfind.startplugin()
end
emu.register_menu(menu_callback, menu_populate, _("Cheat Finder"))
emu.register_frame_done(function ()
- local screen = manager:machine().screens:at(1)
- local height = mame_manager:ui():get_line_height()
+ local screen = manager.machine.screens:at(1)
+ local height = mame_manager.ui.line_height
for num, watch in ipairs(watches) do
screen:draw_text("left", num * height, string.format(watch.format, watch.addr, watch.func()))
end
- if tabbed_out and manager:ui():is_menu_active() then
+ if tabbed_out and manager.ui.menu_active then
emu.pause()
menu_is_showing = true
tabbed_out = false
end
end)
emu.register_periodic(function ()
- if menu_is_showing and not manager:ui():is_menu_active() then
+ if menu_is_showing and not manager.ui.menu_active then
emu.unpause()
menu_is_showing = false
tabbed_out = true
diff --git a/plugins/console/init.lua b/plugins/console/init.lua
index af8a8b7965d..330d445fedb 100644
--- a/plugins/console/init.lua
+++ b/plugins/console/init.lua
@@ -216,8 +216,8 @@ return ln.linenoise('$PROMPT')
end
emu.register_start(function()
- if not consolebuf and manager:machine():debugger() then
- consolebuf = manager:machine():debugger().consolelog
+ if not consolebuf and manager.machine.debugger then
+ consolebuf = manager.machine.debugger.consolelog
lastindex = 0
end
end)
diff --git a/plugins/data/data_hiscore.lua b/plugins/data/data_hiscore.lua
index 867041a14cc..ac2513d2690 100644
--- a/plugins/data/data_hiscore.lua
+++ b/plugins/data/data_hiscore.lua
@@ -9,7 +9,7 @@ local curset
function env.open(file, size)
if file == ".hi" then
local path = "hi"
- local ini = emu.file(emu.subst_env(manager:options().entries.inipath:value()), 1)
+ local ini = emu.file(emu.subst_env(manager.options.entries.inipath:value()), 1)
local ret = ini:open("hiscore.ini")
if not ret then
local inifile = ini:read(ini:size())
@@ -23,7 +23,7 @@ function env.open(file, size)
end
file = path .. "/" .. curset .. ".hi"
else
- file = emu.subst_env(manager:options().entries.nvram_directory:value()) .. "/" .. curset .. "/" .. file
+ file = emu.subst_env(manager.options.entries.nvram_directory:value()) .. "/" .. curset .. "/" .. file
end
local f = io.open(file, "rb")
local content = f:read("*all")
@@ -789,12 +789,12 @@ function dat.check(set, softlist)
output = nil
curset = set
- local scrfile = emu.file(emu.subst_env(mame_manager:ui():options().entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1)
+ local scrfile = emu.file(emu.subst_env(mame_manager.ui.options.entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1)
local ret = scrfile:open(set .. ".lua")
local script
if ret then
function get_xml_table(fileset)
- local file = emu.file(emu.subst_env(mame_manager:ui():options().entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1)
+ local file = emu.file(emu.subst_env(mame_manager.ui.options.entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")), 1)
local ret = file:open(fileset .. ".xml")
if ret then
return nil
diff --git a/plugins/data/data_marp.lua b/plugins/data/data_marp.lua
index 5cb0bc3fb19..98e6e8160d4 100644
--- a/plugins/data/data_marp.lua
+++ b/plugins/data/data_marp.lua
@@ -9,7 +9,7 @@ local function init()
local fh
local file = "scores3.htm"
- for path in mame_manager:ui():options().entries.historypath:value():gmatch("([^;]+)") do
+ for path in mame_manager.ui.options.entries.historypath:value():gmatch("([^;]+)") do
filepath = emu.subst_env(path) .. "/" .. file
fh = io.open(filepath, "r")
if fh then
diff --git a/plugins/data/database.lua b/plugins/data/database.lua
index da1a2508cad..b868173ce08 100644
--- a/plugins/data/database.lua
+++ b/plugins/data/database.lua
@@ -4,12 +4,12 @@ local db
local function check_db(msg)
if db:errcode() > sql.OK then
- emu.print_error("Error: " .. msg .. " (" .. db:errcode() .. " - " .. db:errmsg() .. ")\n")
+ emu.print_error(string.format("Error: %s (%s - %s)\n", msg, db:errcode(), db:errmsg()))
end
end
do
- local dbpath = emu.subst_env(mame_manager:ui():options().entries.historypath:value():match("([^;]+)"))
+ local dbpath = emu.subst_env(mame_manager.ui.options.entries.historypath:value():match("([^;]+)"))
db = sql.open(dbpath .. "/history.db")
if not db then
lfs.mkdir(dbpath)
diff --git a/plugins/data/load_dat.lua b/plugins/data/load_dat.lua
index a21ae51aebe..ed13fbefdcc 100644
--- a/plugins/data/load_dat.lua
+++ b/plugins/data/load_dat.lua
@@ -26,7 +26,7 @@ function datfile.open(file, vertag, fixupcb)
local filepath
local fh
- for path in mame_manager:ui():options().entries.historypath:value():gmatch("([^;]+)") do
+ for path in mame_manager.ui.options.entries.historypath:value():gmatch("([^;]+)") do
filepath = emu.subst_env(path) .. "/" .. file
fh = io.open(filepath, "r")
if fh then
diff --git a/plugins/discord/init.lua b/plugins/discord/init.lua
index 5e5ce88a514..83ac15d18b0 100644
--- a/plugins/discord/init.lua
+++ b/plugins/discord/init.lua
@@ -49,9 +49,9 @@ function discord.startplugin()
if not pipe then return end
local running = emu.romname() ~= "___empty"
local state = not running and "In menu" or status
- local details = running and manager:machine():system().description or nil
+ local details = running and manager.machine.system.description or nil
if emu.softname() ~= "" then
- for name, dev in pairs(manager:machine().images) do
+ for name, dev in pairs(manager.machine.images) do
if dev:longname() then
details = details .. " (" .. dev:longname() .. ")"
break
diff --git a/plugins/gdbstub/init.lua b/plugins/gdbstub/init.lua
index afc5428dd22..f7d4ceee6ba 100644
--- a/plugins/gdbstub/init.lua
+++ b/plugins/gdbstub/init.lua
@@ -36,12 +36,12 @@ function gdbstub.startplugin()
local running
emu.register_start(function ()
- debugger = manager:machine():debugger()
+ debugger = manager.machine.debugger
if not debugger then
print("gdbstub: debugger not enabled")
return
end
- cpu = manager:machine().devices[":maincpu"]
+ cpu = manager.machine.devices[":maincpu"]
if not cpu then
print("gdbstub: maincpu not found")
end
diff --git a/plugins/hiscore/init.lua b/plugins/hiscore/init.lua
index e4da7cda4d6..2a9687d1547 100644
--- a/plugins/hiscore/init.lua
+++ b/plugins/hiscore/init.lua
@@ -23,7 +23,7 @@ function hiscore.startplugin()
local hiscoredata_path = "hiscore.dat";
local hiscore_path = "hi";
- local config_path = emu.subst_env(manager:options().entries.inipath:value():match("[^;]+") .. "/hiscore.ini");
+ local config_path = emu.subst_env(manager.options.entries.inipath:value():match("[^;]+") .. "/hiscore.ini");
local current_checksum = 0;
local default_checksum = 0;
@@ -68,13 +68,13 @@ function hiscore.startplugin()
else
local cpu, mem;
local cputag, space, offs, len, chk_st, chk_ed, fill = string.match(line, '^@([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),([^,]+),?(%x?%x?)');
- cpu = manager:machine().devices[cputag];
+ cpu = manager.machine.devices[cputag];
if not cpu then
error(cputag .. " device not found")
end
local rgnname, rgntype = space:match("([^/]*)/?([^/]*)")
if rgntype == "share" then
- mem = manager:machine():memory().shares[rgnname]
+ mem = manager.machine.memory.shares[rgnname]
else
mem = cpu.spaces[space]
end
diff --git a/plugins/layout/init.lua b/plugins/layout/init.lua
index 654df599bd3..55cb433baf2 100644
--- a/plugins/layout/init.lua
+++ b/plugins/layout/init.lua
@@ -15,7 +15,7 @@ function layout.startplugin()
local scripts = {}
local function prepare_layout(file, script)
local env = {
- machine = manager:machine(),
+ machine = manager.machine,
emu = {
render_bounds = emu.render_bounds,
render_color = emu.render_color,
@@ -42,7 +42,7 @@ function layout.startplugin()
emu.register_callback(prepare_layout, "layout")
emu.register_frame(function()
- if manager:machine().paused then
+ if manager.machine.paused then
return
end
for num, scr in pairs(scripts) do
diff --git a/plugins/portname/init.lua b/plugins/portname/init.lua
index 78e8da626b0..7103f138e76 100644
--- a/plugins/portname/init.lua
+++ b/plugins/portname/init.lua
@@ -28,7 +28,7 @@ local portname = exports
function portname.startplugin()
local json = require("json")
- local ctrlrpath = emu.subst_env(manager:options().entries.ctrlrpath:value():match("([^;]+)"))
+ local ctrlrpath = emu.subst_env(manager.options.entries.ctrlrpath:value():match("([^;]+)"))
local function get_filename(nosoft)
local filename
if emu.softname() ~= "" and not nosoft then
@@ -56,7 +56,7 @@ function portname.startplugin()
return
end
for pname, port in pairs(ctable.ports) do
- local ioport = manager:machine():ioport().ports[pname]
+ local ioport = manager.machine.ioport.ports[pname]
if ioport then
for mask, label in pairs(port.labels) do
for num3, field in pairs(ioport.fields) do
@@ -76,7 +76,7 @@ function portname.startplugin()
if ret then
if emu.softname() ~= "" then
local parent
- for tag, image in pairs(manager:machine().images) do
+ for tag, image in pairs(manager.machine.images) do
parent = image.software_parent
if parent ~= "" then
break
@@ -89,7 +89,7 @@ function portname.startplugin()
if ret then
ret = file:open(get_filename(true))
if ret then
- ret = file:open(manager:machine():system().parent .. ".json")
+ ret = file:open(manager.machine.system.parent .. ".json")
if ret then
return
end
@@ -106,7 +106,7 @@ function portname.startplugin()
local function menu_callback(index, event)
if event == "select" then
local ports = {}
- for pname, port in pairs(manager:machine():ioport().ports) do
+ for pname, port in pairs(manager.machine.ioport.ports) do
local labels = {}
local sort = {}
for fname, field in pairs(port.fields) do
@@ -131,12 +131,12 @@ function portname.startplugin()
if not attr then
lfs.mkdir(path)
if not lfs.attributes(path) then
- manager:machine():popmessage(_("Failed to save input name file"))
+ manager.machine:popmessage(_("Failed to save input name file"))
emu.print_verbose("portname: unable to create path " .. path .. "\n")
return false
end
elseif attr.mode ~= "directory" then
- manager:machine():popmessage(_("Failed to save input name file"))
+ manager.machine:popmessage(_("Failed to save input name file"))
emu.print_verbose("portname: path exists but isn't directory " .. path .. "\n")
return false
end
@@ -152,7 +152,7 @@ function portname.startplugin()
local file = io.open(ctrlrpath .. "/portname/" .. filename, "r")
if file then
emu.print_verbose("portname: input name file exists " .. filename .. "\n")
- manager:machine():popmessage(_("Failed to save input name file"))
+ manager.machine:popmessage(_("Failed to save input name file"))
file:close()
return false
end
@@ -164,7 +164,7 @@ function portname.startplugin()
setmetatable(ctable, { __jsonorder = { "romname", "softname", "ports" }})
file:write(json.stringify(ctable, { indent = true }))
file:close()
- manager:machine():popmessage(string.format(_("Input port name file saved to %s"), ctrlrpath .. "/portname/" .. filename))
+ manager.machine:popmessage(string.format(_("Input port name file saved to %s"), ctrlrpath .. "/portname/" .. filename))
end
return false
end
diff --git a/plugins/timer/init.lua b/plugins/timer/init.lua
index 95601ac67f3..f0ddabbcf50 100644
--- a/plugins/timer/init.lua
+++ b/plugins/timer/init.lua
@@ -12,7 +12,7 @@ exports.author = { name = "Carl" }
local timer = exports
function timer.startplugin()
- local dir = emu.subst_env(manager:options().entries.homepath:value())
+ local dir = emu.subst_env(manager.options.entries.homepath:value())
local timer_db = dir .. "/timer/timer.db"
local timer_started = false
local total_time = 0