Use LoadGame instead of FCEUI_LoadGame

This commit is contained in:
Mario Perić 2020-10-22 01:20:48 +02:00
parent ec72160f39
commit 432ffeeec2
10 changed files with 21 additions and 14 deletions

View File

@ -44,7 +44,7 @@ void LockConsole(void);
void UnlockConsole(void);
void ToggleFS(); /* SDL */
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent = false);
int CloseGame(void);
int GUI_Init(int argc, char **argv, int (*dofunc)(void));
int GUI_Idle(void);

View File

@ -275,12 +275,12 @@ static void DoArgs(int argc, char *argv[])
provides data necessary for the driver code(number of scanlines to
render, what virtual input devices to use, etc.).
*/
int LoadGame(const char *path)
int LoadGame(const char *path, bool silent)
{
FCEUGI *tmp;
CloseGame();
if(!(tmp=FCEUI_LoadGame(path,1)))
if(!(tmp=FCEUI_LoadGame(path,1,silent)))
return 0;
CurGame=tmp;
ParseGI(tmp);

View File

@ -29,7 +29,7 @@ void LockConsole(void);
void UnlockConsole(void);
void ToggleFS(); /* SDL */
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent);
//int CloseGame(void);
void Giggles(int);

View File

@ -206,10 +206,13 @@ DriverKill()
inited=0;
}
/**
* Reloads last game
*/
int reloadLastGame() {
std::string lastRom;
g_config->getOption(std::string("SDL.LastOpenFile"), &lastRom);
return LoadGame(lastRom.c_str());
return LoadGame(lastRom.c_str(), false);
}
/**
@ -218,7 +221,7 @@ int reloadLastGame() {
* provides data necessary for the driver code(number of scanlines to
* render, what virtual input devices to use, etc.).
*/
int LoadGame(const char *path)
int LoadGame(const char *path, bool silent)
{
int gg_enabled, autoLoadDebug, autoOpenDebugger;
@ -233,7 +236,7 @@ int LoadGame(const char *path)
FCEUI_SetGameGenie (gg_enabled);
if(!FCEUI_LoadGame(path, 1)) {
if(!FCEUI_LoadGame(path, 1, silent)) {
return 0;
}

View File

@ -19,7 +19,7 @@ extern unsigned int gui_draw_area_height;
// global configuration object
extern Config *g_config;
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent = false);
int CloseGame(void);
int fceuWrapperInit( int argc, char *argv[] );

View File

@ -24,7 +24,7 @@ extern int dendy;
extern int pal_emulation;
extern bool swapDuty;
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent);
int CloseGame(void);
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
uint64 FCEUD_GetTime();

View File

@ -29,7 +29,7 @@ void LockConsole(void);
void UnlockConsole(void);
void ToggleFS(); /* SDL */
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent);
//int CloseGame(void);
void Giggles(int);

View File

@ -189,6 +189,9 @@ static void ShowUsage(char *prog)
}
/**
* Reloads last game.
*/
int reloadLastGame() {
std::string lastRom;
g_config->getOption(std::string("SDL.LastOpenFile"), &lastRom);
@ -201,12 +204,12 @@ int reloadLastGame() {
* provides data necessary for the driver code(number of scanlines to
* render, what virtual input devices to use, etc.).
*/
int LoadGame(const char *path)
int LoadGame(const char *path, bool silent)
{
if (isloaded){
CloseGame();
}
if(!FCEUI_LoadGame(path, 1)) {
if(!FCEUI_LoadGame(path, 1, silent)) {
return 0;
}

View File

@ -24,7 +24,7 @@ extern int dendy;
extern int pal_emulation;
extern bool swapDuty;
int LoadGame(const char *path);
int LoadGame(const char *path, bool silent = false);
int CloseGame(void);
void FCEUD_Update(uint8 *XBuf, int32 *Buffer, int Count);
uint64 FCEUD_GetTime();

View File

@ -520,6 +520,7 @@ static int emu_getdir(lua_State *L) {
extern void ReloadRom(void);
extern int LoadGame(const char*, bool);
// emu.loadrom(string filename)
//
@ -549,7 +550,7 @@ static int emu_loadrom(lua_State *L) {
const char *nameo2 = luaL_checkstring(L,1);
char nameo[2048];
strncpy(nameo, nameo2, sizeof(nameo));
if(!FCEUI_LoadGame(nameo, 0, true)) {
if(!LoadGame(nameo, true)) {
extern void reloadLastGame();
reloadLastGame();
return 0;