summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2020-11-25 19:18:26 +1100
committer Vas Crabb <vas@vastheman.com>2020-11-25 19:18:26 +1100
commitec8042864703f9ce6cc9b0cf528e6a8528104b89 (patch)
tree427556c7d86c7cab5f136aff7f0675adc443144b /plugins
parent8ea35743e40bd6dc01e50a0a21524db7b0ad203e (diff)
Fairly significant overhaul of Lua engine and some cleanup.
The things that were previously called device iterators are not iterators in the C++ sense of the word. This is confusing for newcomers. These have been renamed to be device enumerators. Several Lua methods and properties that previously returned tables now return lightweight wrappers for the underlying objects. This means creating them is a lot faster, but you can't modify them, and the performance characteristics of different operations varies. The render manager's target list uses 1-based indexing to be more like idiomatic Lua. It's now possible to create a device enumerator on any device, and then get subdevices (or sibling devices) using a relative tag. Much more render/layout functionality has been exposed to Lua. Layout scripts now have access to the layout file and can directly set the state of an item with no bindings, or register callbacks to obtain state. Some things that were previously methods are now read-only properties. Layout files are no longer required to supply a "name". This was problematic because the same layout file could be loaded for multiple instances of the same device, and each instance of the layout file should use the correct inputs (and in the future outputs) for the device instance it's associated with. This should also fix video output with MSVC builds by avoiding delegates that return things that don't fit in a register.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/console/init.lua15
-rw-r--r--plugins/layout/init.lua19
2 files changed, 23 insertions, 11 deletions
diff --git a/plugins/console/init.lua b/plugins/console/init.lua
index 52d54fdcc1a..af8a8b7965d 100644
--- a/plugins/console/init.lua
+++ b/plugins/console/init.lua
@@ -28,11 +28,16 @@ function console.startplugin()
print(num, line)
end
end
- print(" _/ _/ _/_/ _/ _/ _/_/_/_/");
- print(" _/_/ _/_/ _/ _/ _/_/ _/_/ _/ ");
- print(" _/ _/ _/ _/_/_/_/ _/ _/ _/ _/_/_/ ");
- print(" _/ _/ _/ _/ _/ _/ _/ ");
- print("_/ _/ _/ _/ _/ _/ _/_/_/_/ \n");
+ print(" /| /| /| /| /| _______")
+ print(" / | / | / | / | / | / /")
+ print(" / |/ | / | / |/ | / ____/ ")
+ print(" / | / | / | / /_ ")
+ print(" / |/ | / |/ __/ ")
+ print(" / /| /| /| |/ /| /| /____ ")
+ print(" / / | / | / | / | / | / ")
+ print("/ _/ |/ / / |___/ |/ /_______/ ")
+ print(" / / ")
+ print(" / _/ \n")
print(emu.app_name() .. " " .. emu.app_version(), "\nCopyright (C) Nicola Salmoria and the MAME team\n");
print(_VERSION, "\nCopyright (C) Lua.org, PUC-Rio\n");
-- linenoise isn't thread safe but that means history can handled here
diff --git a/plugins/layout/init.lua b/plugins/layout/init.lua
index 8301167633e..aeb0ad77e44 100644
--- a/plugins/layout/init.lua
+++ b/plugins/layout/init.lua
@@ -13,17 +13,24 @@ local layout = exports
function layout.startplugin()
local scripts = {}
- local function prepare_layout(script)
- local env = { machine = manager:machine(), pairs = pairs, ipairs = ipairs,
- table = { insert = table.insert, remove = table.remove } }
+ local function prepare_layout(file, script)
+ local env = {
+ machine = manager:machine(),
+ file = file,
+ print = print,
+ pairs = pairs,
+ ipairs = ipairs,
+ string = { format = string.format },
+ table = { insert = table.insert, remove = table.remove } }
local script, err = load(script, script, "t", env)
if not script then
emu.print_verbose("error loading layout script " .. err)
return
end
- local name
- script, name = script()
- scripts[name] = script
+ local hooks = script()
+ if hooks ~= nil then
+ table.insert(scripts, hooks)
+ end
end
emu.register_callback(prepare_layout, "layout")