From 1a6eb25d59044639ba9217d560866bc4716c8634 Mon Sep 17 00:00:00 2001 From: Alexander Paz Date: Thu, 31 Dec 2020 14:33:27 -0500 Subject: [PATCH] Save/Load states based on current game This change saves / loads a save state based on the games filename. This will allow the ability to: a) Use a previously saved state to start a run b) Distinguish states from the same rom file (but differently named filenames) refs: brossentia/BizHawk-Shuffler#1 --- CurrentSaves/DeleteMe | 0 SoloShuffler.lua | 7 ++++--- 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 CurrentSaves/DeleteMe diff --git a/CurrentSaves/DeleteMe b/CurrentSaves/DeleteMe new file mode 100644 index 0000000..e69de29 diff --git a/SoloShuffler.lua b/SoloShuffler.lua index 83d49d1..a3fd74f 100644 --- a/SoloShuffler.lua +++ b/SoloShuffler.lua @@ -6,6 +6,7 @@ i = 0 x = 0 romSet = {} gamePath = ".\\CurrentROMs\\" +savePath = ".\\CurrentSaves\\" settingsPath = "settings.xml" if userdata.get("countdown") ~= nil then countdown = userdata.get("countdown") @@ -180,11 +181,11 @@ function nextGame(game) -- Changes to the next game and saves the current settin console.log("Reroll! " .. ranNumber) end end - currentGame = newGame userdata.set("first",1) - savestate.saveslot(1) + savestate.save(savePath .. currentGame .. ".save") + currentGame = newGame client.openrom(gamePath .. currentGame) - savestate.loadslot(1) + savestate.load(savePath .. currentGame .. ".save") console.log(currentGame .. " loaded!") userdata.set("currentGame",currentGame) userdata.set("timeLimit",timeLimit)