diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index ddc1b0e2..cdc27dd7 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -206,6 +206,12 @@ DriverKill() inited=0; } +int reloadLastGame() { + std::string lastRom; + g_config->getOption(std::string("SDL.LastOpenFile"), &lastRom); + return LoadGame(lastRom.c_str()); +} + /** * Loads a game, given a full path/filename. The driver code must be * initialized after the game is loaded, because the emulator code diff --git a/src/drivers/sdl/sdl.cpp b/src/drivers/sdl/sdl.cpp index 25f7f0aa..ce9482fc 100644 --- a/src/drivers/sdl/sdl.cpp +++ b/src/drivers/sdl/sdl.cpp @@ -189,6 +189,12 @@ static void ShowUsage(char *prog) } +int reloadLastGame() { + std::string lastRom; + g_config->getOption(std::string("SDL.LastOpenFile"), &lastRom); + return LoadGame(lastRom.c_str()); +} + /** * Loads a game, given a full path/filename. The driver code must be * initialized after the game is loaded, because the emulator code diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 42344162..74ded2ab 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -545,6 +545,17 @@ static int emu_loadrom(lua_State *L) { } else { return 1; } +#else + const char *nameo2 = luaL_checkstring(L,1); + char nameo[2048]; + strncpy(nameo, nameo2, sizeof(nameo)); + if(!FCEUI_LoadGame(nameo, 0, true)) { + extern void reloadLastGame(); + reloadLastGame(); + return 0; + } else { + return 1; + } #endif return 1; }