diff options
Diffstat (limited to 'plugins/portname')
-rw-r--r-- | plugins/portname/init.lua | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/plugins/portname/init.lua b/plugins/portname/init.lua index 3c04d26f72a..b855f27cc6e 100644 --- a/plugins/portname/init.lua +++ b/plugins/portname/init.lua @@ -21,14 +21,14 @@ local exports = {} exports.name = "portname" exports.version = "0.0.1" exports.description = "IOPort name/translation plugin" -exports.license = "The BSD 3-Clause License" +exports.license = "BSD-3-Clause" exports.author = { name = "Carl" } local portname = exports function portname.startplugin() local json = require("json") - local ctrlrpath = lfs.env_replace(manager:options().entries.ctrlrpath:value():match("([^;]+)")) + local ctrlrpath = manager.options.entries.ctrlrpath:value():match("([^;]+)") local function get_filename(nosoft) local filename if emu.softname() ~= "" and not nosoft then @@ -42,7 +42,7 @@ function portname.startplugin() local function parse_names(ctable, depth) if depth >= 5 then - emu.print_error("portname: max import depth exceeded\n") + emu.print_error("portname: max import depth exceeded") return end if ctable.import 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,20 +76,20 @@ 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 + if parent then break end end - if parent ~= "" then + if parent then ret = file:open(emu.romname() .. "_" .. parent:match("([^:]*)$") .. ".json") end end 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,13 +131,13 @@ 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")) - emu.print_verbose("portname: unable to create path " .. path .. "\n") + manager.machine:popmessage(_("Failed to save input name file")) + emu.print_verbose("portname: unable to create path " .. path) return false end elseif attr.mode ~= "directory" then - manager:machine():popmessage(_("Failed to save input name file")) - emu.print_verbose("portname: path exists but isn't directory " .. path .. "\n") + manager.machine:popmessage(_("Failed to save input name file")) + emu.print_verbose("portname: path exists but isn't directory " .. path) return false end return true @@ -151,8 +151,8 @@ function portname.startplugin() local filename = get_filename() 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")) + emu.print_verbose("portname: input name file exists " .. filename) + 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 |