From 334294a06e7f71d9514183fa72279f7ab00cc8c6 Mon Sep 17 00:00:00 2001 From: Artur Bekker Date: Sat, 26 Nov 2022 14:54:11 -0500 Subject: [PATCH] Update lua-engine.cpp Added functionality for unloading a ROM. utilizing a function present in "window.cpp", a new Lua function was added to the emu API to allow Lua scripts to close out of games without having to close out of the whole emulator. --- src/lua-engine.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 61c21fce..7308ac12 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -645,6 +645,13 @@ static int emu_insertOrEjectDisk(lua_State* L) return 0; } +// emu.closeRom() +// Closes out of currently running ROM to allow user to switch games +static int emu_closeRom(lua_State* L) +{ + CloseGame(); + return 0; +} // emu.loadrom(string filename) // @@ -6089,6 +6096,7 @@ static const struct luaL_reg emulib [] = { {"getdir", emu_getdir}, {"switchDisk", emu_switchDisk}, {"insertOrEjectDisk", emu_insertOrEjectDisk}, + {"closeRom", emu_closeRom}, {"loadrom", emu_loadrom}, {"print", print}, // sure, why not {"exit", emu_exit}, // useful for run-and-close scripts