Added support for loading ROM files from Lua script on Linux

This commit is contained in:
Mario Perić 2020-10-21 22:05:26 +02:00
parent 5f4af397d0
commit ec72160f39
3 changed files with 23 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}