Recently I created a
ShowCP lua plugin script for MAME that will toggle a CP image created using CPWizards "Export Bezels" feature.
-- license:BSD-3-Clause
-- copyright-holders:Ben Baker
local exports = {}
exports.name = "showcp"
exports.version = "0.0.1"
exports.description = "ShowCP plugin"
exports.license = "The BSD 3-Clause License"
exports.author = { name = "Ben Baker" }
local showcp = exports
function showcp.startplugin()
emu.register_pause(function()
manager:machine():render().targets[0].view = 1
end)
emu.register_resume(function()
manager:machine():render().targets[0].view = 0
end)
end
return exports
All you need to enable it is to edit plugin.ini in the MAME folder.
This is a basic example showing how to toggle a render_target during MAMEs pause and resume events.
There are many more classes, functions and properties exposed using Lua which can be seen by examining
luaengine.cpp.
There are already a number of useful plugins distributed with MAME such as "hiscore" (which no longer requires a custom compile) and "cheat" for applying cheat codes.
There is an example plugin in MAME called "dummy" which shows how to use register_menu to create a custom menu. This is available when you press TAB in MAME and select the the Plugin Options->Dummy (Ive attached some screenshots showing it).
The main limitations that I can see at this point is there is no way to show a custom menu except in the Plugin Options. It would be more useful to be able to show a menu during a pause event. The other limitation is there seems to be no way to display an image except for using the bezel (or possibly overlay) system.
Please post any useful information you discover playing with Lua plugins in MAME.