From 9081ef33fcda5e5b563f3f2cea0df4cb429f4f52 Mon Sep 17 00:00:00 2001 From: blastron Date: Tue, 25 Jul 2023 15:40:12 -0700 Subject: [PATCH 1/2] Set defaults when loading an incompatible save. --- App/WRPGconfig.json | 1 - Source/ClientWindow.cpp | 23 +++++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) delete mode 100644 App/WRPGconfig.json diff --git a/App/WRPGconfig.json b/App/WRPGconfig.json deleted file mode 100644 index 04810d8c..00000000 --- a/App/WRPGconfig.json +++ /dev/null @@ -1 +0,0 @@ -{"apSlotName":"Witness","challengeTimer":false,"collect":false,"colorblind":true,"key_skipPuzzle":113,"saveVersion":1} \ No newline at end of file diff --git a/Source/ClientWindow.cpp b/Source/ClientWindow.cpp index e28899bc..9f022a8e 100644 --- a/Source/ClientWindow.cpp +++ b/Source/ClientWindow.cpp @@ -14,7 +14,7 @@ using json = nlohmann::json; ClientWindow* ClientWindow::_singleton = nullptr; -#define SAVE_VERSION 1 +#define SAVE_VERSION 2 #define CLIENT_WINDOW_WIDTH 600 #define CLIENT_MENU_CLASS_NAME L"WitnessRandomizer" @@ -90,6 +90,7 @@ void ClientWindow::saveSettings() void ClientWindow::loadSettings() { std::ifstream inputStream = std::ifstream("WRPGconfig.json"); + bool loadedSettings = false; if (inputStream.good()) { json data; @@ -106,10 +107,24 @@ void ClientWindow::loadSettings() // Load keybinds. InputWatchdog* input = InputWatchdog::get(); input->loadCustomKeybind(CustomKey::SKIP_PUZZLE, - data.contains("key_skipPuzzle") ? static_cast(data["key_skipPuzzle"].get()) : InputButton::KEY_Q); - - refreshKeybind(CustomKey::SKIP_PUZZLE); + data.contains("key_skipPuzzle") ? static_cast(data["key_skipPuzzle"].get()) : InputButton::KEY_T); + + loadedSettings = true; } + + refreshKeybind(CustomKey::SKIP_PUZZLE); + } + + if (!loadedSettings) { + // Set defaults. + setSetting(ClientToggleSetting::ChallengeTimer, false); + setSetting(ClientToggleSetting::Collect, true); + setSetting(ClientToggleSetting::ColorblindMode, false); + + InputWatchdog* input = InputWatchdog::get(); + input->loadCustomKeybind(CustomKey::SKIP_PUZZLE, InputButton::KEY_T); + + refreshKeybind(CustomKey::SKIP_PUZZLE); } #if _DEBUG From 06efd5f04b329ad318e2388917c80a3506a4fd15 Mon Sep 17 00:00:00 2001 From: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com> Date: Sun, 30 Jul 2023 02:10:04 +0200 Subject: [PATCH 2/2] Bump AP version --- App/Version.h | 2 +- Source/Archipelago/APRandomizer.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/App/Version.h b/App/Version.h index e014f2f4..d35e50ae 100644 --- a/App/Version.h +++ b/App/Version.h @@ -10,6 +10,6 @@ #define VERSION_STR TO_STRING(MAJOR) "." TO_STRING(MINOR) "." TO_STRING(PATCH) #define VERSION MAJOR, MINOR, PATCH -#define AP_VERSION_STR "0.4.1" +#define AP_VERSION_STR "0.4.2" #define PRODUCT_NAME L"Witness Random Puzzle Generator for Archipelago.gg" diff --git a/Source/Archipelago/APRandomizer.cpp b/Source/Archipelago/APRandomizer.cpp index 806c9a2f..d6cfd75a 100644 --- a/Source/Archipelago/APRandomizer.cpp +++ b/Source/Archipelago/APRandomizer.cpp @@ -31,7 +31,7 @@ bool APRandomizer::Connect(std::string& server, std::string& user, std::string& ap->set_room_info_handler([&]() { const int item_handling_flags_all = 7; - ap->ConnectSlot(user, password, item_handling_flags_all, {}, {0, 4, 1}); + ap->ConnectSlot(user, password, item_handling_flags_all, {}, {0, 4, 2}); }); ap->set_location_checked_handler([&](const std::list& locations) {