This repository has been archived on 2023-01-29. You can view files and clone it, but cannot push or open issues or pull requests.
mame-shutdown/init.lua
Michael Smith 4ab94a1879 Add a delay to the shutdown command.
Safely close active MAME machine to avoid data loss. Fixes #1.
2017-11-10 11:11:48 +01:00

29 lines
802 B
Lua

-- license:BSD-3-Clause
-- copyright-holders:Michael Smith
local exports = {}
exports.name = "shutdown"
exports.version = "0.0.1"
exports.description = "Shut down a Windows system from the MAME menu."
exports.license = "The BSD 3-Clause License"
exports.author = { name = "Michael Smith" }
local shutdown = exports
function shutdown.startplugin()
local function menu_populate()
return {{ "Really shut down system?", "", "off" }, { "No", "", "" }, { "Yes", "", "" }}
end
local function menu_callback(index, event)
if event == "select" and index == 3 then
manager:machine():exit()
os.execute("shutdown /s /t 10")
end
return false
end
emu.register_menu(menu_callback, menu_populate, "System shutdown...")
end
return exports