diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1b848f01..d920174f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,7 +81,7 @@ else(WIN32) pkg_check_modules( SDL2 REQUIRED sdl2) if ( ${SDL2_FOUND} ) - add_definitions( ${SDL2_CFLAGS} ) + add_definitions( ${SDL2_CFLAGS} -D__SDL__ ) endif() # Check for LUA diff --git a/src/drivers/Qt/fceuWrapper.cpp b/src/drivers/Qt/fceuWrapper.cpp index e833c8be..8b4f81f1 100644 --- a/src/drivers/Qt/fceuWrapper.cpp +++ b/src/drivers/Qt/fceuWrapper.cpp @@ -209,7 +209,8 @@ DriverKill() /** * Reloads last game */ -int reloadLastGame() { +int reloadLastGame(void) +{ std::string lastRom; g_config->getOption(std::string("SDL.LastOpenFile"), &lastRom); return LoadGame(lastRom.c_str(), false); diff --git a/src/drivers/Qt/fceuWrapper.h b/src/drivers/Qt/fceuWrapper.h index 6b196856..3d20719b 100644 --- a/src/drivers/Qt/fceuWrapper.h +++ b/src/drivers/Qt/fceuWrapper.h @@ -21,6 +21,7 @@ extern Config *g_config; int LoadGame(const char *path, bool silent = false); int CloseGame(void); +int reloadLastGame(void); int fceuWrapperInit( int argc, char *argv[] ); int fceuWrapperClose( void ); diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 6f8d90f7..767861a7 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -42,6 +42,17 @@ extern char FileBase[]; extern TASEDITOR_LUA taseditor_lua; #endif +#ifdef __SDL__ + +#ifdef __QT_DRIVER__ +#include "drivers/Qt/fceuWrapper.h" +#else +int LoadGame(const char *path, bool silent = false); +int reloadLastGame(void); +#endif + +#endif + #include #include #include @@ -520,13 +531,14 @@ static int emu_getdir(lua_State *L) { extern void ReloadRom(void); -extern int LoadGame(const char*, bool); + // emu.loadrom(string filename) // // Loads the rom from the directory relative to the lua script or from the absolute path. // If the rom can't be loaded, loads the most recent one. -static int emu_loadrom(lua_State *L) { +static int emu_loadrom(lua_State *L) +{ #ifdef WIN32 const char* str = lua_tostring(L,1); @@ -550,8 +562,8 @@ static int emu_loadrom(lua_State *L) { const char *nameo2 = luaL_checkstring(L,1); char nameo[2048]; strncpy(nameo, nameo2, sizeof(nameo)); - if(!LoadGame(nameo, true)) { - extern void reloadLastGame(); + if (!LoadGame(nameo, true)) + { reloadLastGame(); return 0; } else {