diff --git a/output/CloseEmu.lua b/output/CloseEmu.lua new file mode 100644 index 00000000..feeafdbe --- /dev/null +++ b/output/CloseEmu.lua @@ -0,0 +1 @@ +emu.exit() diff --git a/output/luaScripts/InsertorEject.lua b/output/luaScripts/InsertorEject.lua new file mode 100644 index 00000000..2082c7d6 --- /dev/null +++ b/output/luaScripts/InsertorEject.lua @@ -0,0 +1 @@ +emu.insertOrEjectDisk() diff --git a/output/luaScripts/SwitchDisk.lua b/output/luaScripts/SwitchDisk.lua new file mode 100644 index 00000000..ff66de5f --- /dev/null +++ b/output/luaScripts/SwitchDisk.lua @@ -0,0 +1 @@ +emu.switchDisk() diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 91f862d2..61c21fce 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -628,6 +628,24 @@ extern void ReloadRom(void); //} //#endif +// emu.switchDisk() +// Switches the side of the disk that is currently ejected +static int emu_switchDisk(lua_State* L) +{ + FCEUI_FDSSelect(); + return 0; +} + +// emu.insertOrEjectDisk() +// If the disk is currently ejected, then insert it back into the FDS +// If the disk is currently inserted into the FDS, eject it +static int emu_insertOrEjectDisk(lua_State* L) +{ + FCEUI_FDSInsert(); + return 0; +} + + // emu.loadrom(string filename) // // Loads the rom from the directory relative to the lua script or from the absolute path. @@ -6069,6 +6087,8 @@ static const struct luaL_reg emulib [] = { {"readonly", movie_getreadonly}, {"setreadonly", movie_setreadonly}, {"getdir", emu_getdir}, + {"switchDisk", emu_switchDisk}, + {"insertOrEjectDisk", emu_insertOrEjectDisk}, {"loadrom", emu_loadrom}, {"print", print}, // sure, why not {"exit", emu_exit}, // useful for run-and-close scripts