From 3a14fc724c5a0092a9308f86b499e8b894eff260 Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 18 Mar 2019 00:14:12 -0400 Subject: [PATCH 1/2] fix merge conflict --- src/fceu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fceu.cpp b/src/fceu.cpp index 2b5cee6f..d45e6151 100644 --- a/src/fceu.cpp +++ b/src/fceu.cpp @@ -404,7 +404,7 @@ int FDSLoad(const char *name, FCEUFILE *fp); int NSFLoad(const char *name, FCEUFILE *fp); //char lastLoadedGameName [2048] = {0,}; // hack for movie WRAM clearing on record from poweron -bool archiveManuallyCanceled; +extern bool archiveManuallyCanceled; //name should be UTF-8, hopefully, or else there may be trouble FCEUGI *FCEUI_LoadGameVirtual(const char *name, int OverwriteVidMode, bool silent) From f9094a465560ec0ca9cae39ab5524bb41a0ed3a5 Mon Sep 17 00:00:00 2001 From: zeromus Date: Mon, 18 Mar 2019 00:26:26 -0400 Subject: [PATCH 2/2] fix savestate.create(integer) maybe fixes #41 (not sure) --- src/lua-engine.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lua-engine.cpp b/src/lua-engine.cpp index 65627e36..424c9669 100644 --- a/src/lua-engine.cpp +++ b/src/lua-engine.cpp @@ -2711,15 +2711,22 @@ static int savestate_create_aliased(lua_State *L, bool newnumbering) { int which = -1; const char* path = NULL; bool hasArg = false; - if (lua_gettop(L) >= 1) { + + if (lua_gettop(L) >= 1) + { hasArg = true; - path = luaL_checkstring(L, 1); - if(path == NULL) { - which = luaL_checkinteger(L, 1); + + if(lua_isnumber(L,1)) + { + which = luaL_checkinteger(L,1); if (which < 1 || which > 10) { luaL_error(L, "invalid player's savestate %d", which); } } + else + { + path = luaL_checkstring(L, 1); + } } //lets use lua to allocate the memory, since it is effectively a memory pool. @@ -2730,9 +2737,9 @@ static int savestate_create_aliased(lua_State *L, bool newnumbering) { // So I turned the filename selection code into my bitch. :) // Numbers are 0 through 9. if (newnumbering) //1-9, 10 = 0. QWERTY style. - ss->filename = FCEU_MakeFName(FCEUMKF_STATE, (which % 10), 0); + ss->filename = FCEU_MakeFName(FCEUMKF_STATE, (which % 10), 0); else // Note: Windows Slots 1-10 = Which 2-10, 1 - ss->filename = FCEU_MakeFName(FCEUMKF_STATE, which - 1, 0); + ss->filename = FCEU_MakeFName(FCEUMKF_STATE, which - 1, 0); // Only ensure load if the file exists // Also makes it persistent, but files are like that