diff --git a/ZAPDTR/ZAPDUtils/Utils/Directory.h b/ZAPDTR/ZAPDUtils/Utils/Directory.h index 1ced139be..ea792d8da 100644 --- a/ZAPDTR/ZAPDUtils/Utils/Directory.h +++ b/ZAPDTR/ZAPDUtils/Utils/Directory.h @@ -1,8 +1,9 @@ #pragma once -#include #include #include +#include "StringHelper.h" +#include #if __has_include() #include @@ -12,8 +13,6 @@ namespace fs = std::filesystem; namespace fs = std::experimental::filesystem; #endif -#include "StringHelper.h" - #undef GetCurrentDirectory #undef CreateDirectory @@ -21,7 +20,7 @@ class Directory { public: #ifndef PATH_HACK - static std::string GetCurrentDirectory() { return fs::current_path().u8string().c_str(); } + static std::string GetCurrentDirectory() { return fs::current_path().string(); } #endif static bool Exists(const fs::path& path) { return fs::exists(path); } diff --git a/libultraship/libultraship/Cvar.cpp b/libultraship/libultraship/Cvar.cpp index fa536e1bb..242b4c913 100644 --- a/libultraship/libultraship/Cvar.cpp +++ b/libultraship/libultraship/Cvar.cpp @@ -4,6 +4,8 @@ #include #include #include +#include +#include "GlobalCtx2.h" std::map, std::less<>> cvars; @@ -135,3 +137,126 @@ extern "C" void CVar_RegisterString(const char* name, const char* defaultValue) if (!CVar_Get(name)) CVar_SetString(name, defaultValue); } + +template bool is_number(const std::string& s) { + Numeric n; + return ((std::istringstream(s) >> n >> std::ws).eof()); +} + +void CVar_LoadLegacy() { + auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg"); + if (File::Exists(cvarsConfig)) { + const auto lines = File::ReadAllLines(cvarsConfig); + + for (const std::string& line : lines) { + std::vector cfg = StringHelper::Split(line, " = "); + if (line.empty()) continue; + if (cfg.size() < 2) continue; + + if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos)) + { + std::string value(cfg[1]); + value.erase(std::remove_if(value.begin(), value.end(), [](char c) { return c == '#'; }), value.end()); + auto splitTest = StringHelper::Split(value, "\r")[0]; + + uint32_t val = std::stoul(splitTest, nullptr, 16); + Color_RGBA8 clr; + clr.r = val >> 24; + clr.g = val >> 16; + clr.b = val >> 8; + clr.a = val & 0xFF; + CVar_SetRGBA(cfg[0].c_str(), clr); + } + + if (cfg[1].find("\"") != std::string::npos) { + std::string value(cfg[1]); + value.erase(std::remove(value.begin(), value.end(), '\"'), value.end()); +#ifdef _MSC_VER + CVar_SetString(cfg[0].c_str(), _strdup(value.c_str())); +#else + CVar_SetString(cfg[0].c_str(), strdup(value.c_str())); +#endif + } + if (is_number(cfg[1])) { + CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1])); + } + if (is_number(cfg[1])) { + CVar_SetS32(cfg[0].c_str(), std::stoi(cfg[1])); + } + } + + fs::remove(cvarsConfig); + } +} + + +extern "C" void CVar_Load() { + std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + pConf->reload(); + + for (const auto& item : pConf->rjson["CVars"].items()) { + auto value = item.value(); + switch (value.type()) { + case nlohmann::detail::value_t::array: + break; + case nlohmann::detail::value_t::object: + if (value["Type"].get() == mercuryRGBAObjectType) { + Color_RGBA8 clr; + clr.r = value["R"].get(); + clr.g = value["G"].get(); + clr.b = value["B"].get(); + clr.a = value["A"].get(); + CVar_SetRGBA(item.key().c_str(), clr); + } + + break; + case nlohmann::detail::value_t::string: + CVar_SetString(item.key().c_str(), value.get().c_str()); + break; + case nlohmann::detail::value_t::boolean: + CVar_SetS32(item.key().c_str(), value.get()); + break; + case nlohmann::detail::value_t::number_unsigned: + case nlohmann::detail::value_t::number_integer: + CVar_SetS32(item.key().c_str(), value.get()); + break; + case nlohmann::detail::value_t::number_float: + CVar_SetFloat(item.key().c_str(), value.get()); + break; + default:; + } + if (item.key() == "gOpenMenuBar") { + int bp = 0; + } + } + + CVar_LoadLegacy(); +} + +extern "C" void CVar_Save() +{ + std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + + for (const auto& cvar : cvars) { + const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str()); + + if (cvar.second->type == CVarType::String && cvar.second->value.valueStr != nullptr) + pConf->setString(key, std::string(cvar.second->value.valueStr)); + else if (cvar.second->type == CVarType::S32) + pConf->setInt(key, cvar.second->value.valueS32); + else if (cvar.second->type == CVarType::Float) + pConf->setFloat(key, cvar.second->value.valueFloat); + else if (cvar.second->type == CVarType::RGBA) + { + auto keyStr = key.c_str(); + Color_RGBA8 clr = cvar.second->value.valueRGBA; + pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r); + pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r); + pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType); + } + } + + pConf->save(); +} diff --git a/libultraship/libultraship/Cvar.h b/libultraship/libultraship/Cvar.h index e6225610d..b13e1ab32 100644 --- a/libultraship/libultraship/Cvar.h +++ b/libultraship/libultraship/Cvar.h @@ -33,20 +33,23 @@ extern "C" { #endif -int32_t CVar_GetS32(const char* name, int32_t defaultValue); -float CVar_GetFloat(const char* name, float defaultValue); -void CVar_SetFloat(const char* name, float value); -const char* CVar_GetString(const char* name, const char* defaultValue); -void CVar_SetS32(const char* name, int32_t value); -void CVar_SetString(const char* name, const char* value); -Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue); -Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue); -void CVar_SetRGBA(const char* name, Color_RGBA8 value); + float CVar_GetFloat(const char* name, float defaultValue); + void CVar_SetFloat(const char* name, float value); + int32_t CVar_GetS32(const char* name, int32_t defaultValue); + void CVar_SetS32(const char* name, int32_t value); + const char* CVar_GetString(const char* name, const char* defaultValue); + void CVar_SetString(const char* name, const char* value); + Color_RGB8 CVar_GetRGB(const char* name, Color_RGB8 defaultValue); + Color_RGBA8 CVar_GetRGBA(const char* name, Color_RGBA8 defaultValue); + void CVar_SetRGBA(const char* name, Color_RGBA8 value); -void CVar_RegisterS32(const char* name, int32_t defaultValue); -void CVar_RegisterFloat(const char* name, float defaultValue); -void CVar_RegisterString(const char* name, const char* defaultValue); -void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue); + void CVar_RegisterS32(const char* name, int32_t defaultValue); + void CVar_RegisterFloat(const char* name, float defaultValue); + void CVar_RegisterString(const char* name, const char* defaultValue); + void CVar_RegisterRGBA(const char* name, Color_RGBA8 defaultValue); + + void CVar_Load(); + void CVar_Save(); #ifdef __cplusplus }; diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp deleted file mode 100644 index d6af51399..000000000 --- a/libultraship/libultraship/GameSettings.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "GameSettings.h" - -// Audio -#include -#include -#include -#include -#include - -#include "Cvar.h" -#include "GlobalCtx2.h" -#include "ImGuiImpl.h" -#include "../../soh/include/z64audio.h" -#include "Hooks.h" -#include "../../soh/soh/Enhancements/debugconsole.h" - -#include "Window.h" -#include "Lib/Fast3D/gfx_rendering_api.h" - -#define ABS(var) var < 0 ? -(var) : var - -using namespace Ship; - -namespace Game { - - bool DeSyncAudio = false; - - void UpdateAudio() { - Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); - Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); - Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); - Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); - } - - void LoadSettings() { - DebugConsole_LoadCVars(); - } - - void SaveSettings() { - DebugConsole_SaveCVars(); - } - - void InitSettings() { - Ship::RegisterHook(UpdateAudio); - Ship::RegisterHook([] { - gfx_get_current_rendering_api()->set_texture_filter((FilteringMode) CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); - SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); - SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); - UpdateAudio(); - }); - } - - void SetSeqPlayerVolume(SeqPlayers playerId, float volume) { - Audio_SetGameVolume(playerId, volume); - } -} diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h deleted file mode 100644 index 0a9aa0ee6..000000000 --- a/libultraship/libultraship/GameSettings.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -enum SeqPlayers { - /* 0 */ SEQ_BGM_MAIN, - /* 1 */ SEQ_FANFARE, - /* 2 */ SEQ_SFX, - /* 3 */ SEQ_BGM_SUB, - /* 4 */ SEQ_MAX - }; - -namespace Game { - void InitSettings(); - void LoadSettings(); - void LoadPadSettings(); - void SaveSettings(); - void SetSeqPlayerVolume(SeqPlayers playerId, float volume); -} diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index a33e75be6..032ca119c 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -7,8 +7,13 @@ #include #include +#include +#include +#include +#include +#include +#include "../../soh/include/z64audio.h" #include "Archive.h" -#include "GameSettings.h" #include "Console.h" #include "Hooks.h" #define IMGUI_DEFINE_MATH_OPERATORS @@ -68,6 +73,14 @@ std::vector emptyArgs; bool isBetaQuestEnabled = false; +enum SeqPlayers { + /* 0 */ SEQ_BGM_MAIN, + /* 1 */ SEQ_FANFARE, + /* 2 */ SEQ_SFX, + /* 3 */ SEQ_BGM_SUB, + /* 4 */ SEQ_MAX +}; + extern "C" { void enableBetaQuest() { isBetaQuestEnabled = true; } void disableBetaQuest() { isBetaQuestEnabled = false; } @@ -115,6 +128,23 @@ namespace SohImGui { std::map> windowCategories; std::map customWindows; + void UpdateAudio() { + Audio_SetGameVolume(SEQ_BGM_MAIN, CVar_GetFloat("gMainMusicVolume", 1)); + Audio_SetGameVolume(SEQ_BGM_SUB, CVar_GetFloat("gSubMusicVolume", 1)); + Audio_SetGameVolume(SEQ_FANFARE, CVar_GetFloat("gSFXMusicVolume", 1)); + Audio_SetGameVolume(SEQ_SFX, CVar_GetFloat("gFanfareVolume", 1)); + } + + void InitSettings() { + Ship::RegisterHook(UpdateAudio); + Ship::RegisterHook([] { + gfx_get_current_rendering_api()->set_texture_filter((FilteringMode)CVar_GetS32("gTextureFilter", FILTER_THREE_POINT)); + SohImGui::console->opened = CVar_GetS32("gConsoleEnabled", 0); + SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); + UpdateAudio(); + }); + } + int GetBackendID(std::shared_ptr cfg) { std::string backend = cfg->getString("Window.GfxBackend"); if (backend.empty()) { @@ -347,7 +377,7 @@ namespace SohImGui { } void Init(WindowImpl window_impl) { - Game::LoadSettings(); + CVar_Load(); impl = window_impl; ImGuiContext* ctx = ImGui::CreateContext(); ImGui::SetCurrentContext(ctx); @@ -405,7 +435,7 @@ namespace SohImGui { pads = cont_pad; }); - Game::InitSettings(); + InitSettings(); CVar_SetS32("gRandoGenerating", 0); CVar_SetS32("gNewSeedGenerated", 0); @@ -419,7 +449,7 @@ namespace SohImGui { void Update(EventImpl event) { if (needs_save) { - Game::SaveSettings(); + CVar_Save(); needs_save = false; } ImGuiProcessEvent(event); @@ -436,11 +466,10 @@ namespace SohImGui { const float volume = floorf(value * 100) / 100; CVar_SetFloat(key, volume); needs_save = true; - Game::SetSeqPlayerVolume(playerId, volume); + Audio_SetGameVolume(playerId, volume); } } - void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue = 0) { if (FirstTimeValue <= 0) { FirstTimeValue = 0; diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp index 1bf67891b..c80dc4be5 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_dxgi.cpp @@ -32,7 +32,6 @@ #define DECLARE_GFX_DXGI_FUNCTIONS #include "gfx_dxgi.h" -#include "../../GameSettings.h" #define WINCLASS_NAME L"N64GAME" #define GFX_API_NAME "DirectX" @@ -274,7 +273,7 @@ static LRESULT CALLBACK gfx_dxgi_wnd_proc(HWND h_wnd, UINT message, WPARAM w_par DragQueryFileA((HDROP)w_param, 0, fileName, 256); CVar_SetString("gDroppedFile", fileName); CVar_SetS32("gNewFileDropped", 1); - Game::SaveSettings(); + CVar_Save(); break; case WM_SYSKEYDOWN: if ((w_param == VK_RETURN) && ((l_param & 1 << 30) == 0)) { diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 06d88b78c..8600aae1f 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -35,8 +35,6 @@ #ifdef _WIN32 #include #endif -#include -#include "../../GameSettings.h" #define GFX_API_NAME "SDL2 - OpenGL" @@ -306,7 +304,7 @@ static void gfx_sdl_handle_events(void) { case SDL_DROPFILE: CVar_SetString("gDroppedFile", event.drop.file); CVar_SetS32("gNewFileDropped", 1); - Game::SaveSettings(); + CVar_Save(); break; case SDL_QUIT: Ship::ExecuteHooks(); diff --git a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h index 9f71bdee4..7b5da63fd 100644 --- a/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h +++ b/libultraship/libultraship/Lib/spdlog/include/spdlog/sinks/sohconsole_sink.h @@ -9,7 +9,6 @@ #include #include #include "ImGuiImpl.h" -#include "GameSettings.h" #include "Cvar.h" #include #include diff --git a/libultraship/libultraship/libultraship.vcxproj b/libultraship/libultraship/libultraship.vcxproj index f677dfe5e..1ab23f2b2 100644 --- a/libultraship/libultraship/libultraship.vcxproj +++ b/libultraship/libultraship/libultraship.vcxproj @@ -261,7 +261,6 @@ - @@ -353,7 +352,6 @@ - diff --git a/libultraship/libultraship/libultraship.vcxproj.filters b/libultraship/libultraship/libultraship.vcxproj.filters index b7fe847ce..b9934022b 100644 --- a/libultraship/libultraship/libultraship.vcxproj.filters +++ b/libultraship/libultraship/libultraship.vcxproj.filters @@ -318,9 +318,6 @@ Source Files\Logging - - Source Files\CustomImpl - Source Files\Resources\Files @@ -608,9 +605,6 @@ Source Files\Logging - - Source Files\CustomImpl - Source Files\Resources diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 3b1ccb4c0..c565ce52b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1,11 +1,6 @@ #include "CosmeticsEditor.h" -#include "../../util.h" #include "../libultraship/ImGuiImpl.h" -#include "GameSettings.h" -#include -#include -#include #include #include #include diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index ba5fb0b34..b50c8c9d6 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -14,7 +14,6 @@ #define Path _Path #define PATH_HACK #include -#include #include "Window.h" #include "Lib/ImGui/imgui_internal.h" @@ -426,7 +425,7 @@ static bool SetCVarHandler(const std::vector& args) { else CVar_SetS32(args[1].c_str(), std::stoi(args[2])); - DebugConsole_SaveCVars(); + CVar_Save(); //INFO("[SOH] Updated player position to [ %.2f, %.2f, %.2f ]", pos.x, pos.y, pos.z); return CMD_SUCCESS; @@ -507,123 +506,5 @@ void DebugConsole_Init(void) { Ship::ArgumentType::NUMBER, } } }); - DebugConsole_LoadCVars(); -} - -template bool is_number(const std::string& s) { - Numeric n; - return ((std::istringstream(s) >> n >> std::ws).eof()); -} - -void DebugConsole_LoadLegacyCVars() { - auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg"); - if (File::Exists(cvarsConfig)) { - const auto lines = File::ReadAllLines(cvarsConfig); - - for (const std::string& line : lines) { - std::vector cfg = StringHelper::Split(line, " = "); - if (line.empty()) continue; - if (cfg.size() < 2) continue; - - if (cfg[1].find("\"") == std::string::npos && (cfg[1].find("#") != std::string::npos)) - { - std::string value(cfg[1]); - value.erase(std::remove_if(value.begin(), value.end(), [](char c) { return c == '#'; }), value.end()); - auto splitTest = StringHelper::Split(value, "\r")[0]; - - uint32_t val = std::stoul(splitTest, nullptr, 16); - Color_RGBA8 clr; - clr.r = val >> 24; - clr.g = val >> 16; - clr.b = val >> 8; - clr.a = val & 0xFF; - CVar_SetRGBA(cfg[0].c_str(), clr); - } - - if (cfg[1].find("\"") != std::string::npos) { - std::string value(cfg[1]); - value.erase(std::remove(value.begin(), value.end(), '\"'), value.end()); - CVar_SetString(cfg[0].c_str(), ImStrdup(value.c_str())); - } - if (is_number(cfg[1])) { - CVar_SetFloat(cfg[0].c_str(), std::stof(cfg[1])); - } - if (is_number(cfg[1])) { - CVar_SetS32(cfg[0].c_str(), std::stoi(cfg[1])); - } - } - - fs::remove(cvarsConfig); - } -} - -void DebugConsole_LoadCVars() { - - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); - pConf->reload(); - - for (const auto& item : pConf->rjson["CVars"].items()) { - auto value = item.value(); - switch (value.type()) { - case nlohmann::detail::value_t::array: - break; - case nlohmann::detail::value_t::object: - if (value["Type"].get() == mercuryRGBAObjectType) { - Color_RGBA8 clr; - clr.r = value["R"].get(); - clr.g = value["G"].get(); - clr.b = value["B"].get(); - clr.a = value["A"].get(); - } - - break; - case nlohmann::detail::value_t::string: - CVar_SetString(item.key().c_str(), value.get().c_str()); - break; - case nlohmann::detail::value_t::boolean: - CVar_SetS32(item.key().c_str(), value.get()); - break; - case nlohmann::detail::value_t::number_unsigned: - case nlohmann::detail::value_t::number_integer: - CVar_SetS32(item.key().c_str(), value.get()); - break; - case nlohmann::detail::value_t::number_float: - CVar_SetFloat(item.key().c_str(), value.get()); - break; - default: ; - } - if (item.key() == "gOpenMenuBar") { - int bp = 0; - } - } - - DebugConsole_LoadLegacyCVars(); -} - -void DebugConsole_SaveCVars() -{ - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); - - for (const auto &cvar : cvars) { - const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str()); - - if (cvar.second->type == CVarType::String && cvar.second->value.valueStr != nullptr) - pConf->setString(key, std::string(cvar.second->value.valueStr)); - else if (cvar.second->type == CVarType::S32) - pConf->setInt(key, cvar.second->value.valueS32); - else if (cvar.second->type == CVarType::Float) - pConf->setFloat(key, cvar.second->value.valueFloat); - else if (cvar.second->type == CVarType::RGBA) - { - auto keyStr = key.c_str(); - Color_RGBA8 clr = cvar.second->value.valueRGBA; - pConf->setUInt(StringHelper::Sprintf("%s.R", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.G", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.B", keyStr), clr.r); - pConf->setUInt(StringHelper::Sprintf("%s.A", keyStr), clr.r); - pConf->setString(StringHelper::Sprintf("%s.Type", keyStr), mercuryRGBAObjectType); - } - } - - pConf->save(); + CVar_Load(); } diff --git a/soh/soh/Enhancements/debugconsole.h b/soh/soh/Enhancements/debugconsole.h index 581c19acd..ffd0cb0cb 100644 --- a/soh/soh/Enhancements/debugconsole.h +++ b/soh/soh/Enhancements/debugconsole.h @@ -1,5 +1,3 @@ #pragma once void DebugConsole_Init(void); -void DebugConsole_LoadCVars(); -void DebugConsole_SaveCVars(); \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index 8f46310cf..5fb1b34c5 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -6,7 +6,6 @@ #include "rando_main.hpp" // #include #include -#include #define NOGDI #define WIN32_LEAN_AND_MEAN #include @@ -25,7 +24,7 @@ void RandoMain::GenerateRando(std::unordered_map cvarS std::string fileName = Ship::GlobalCtx2::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings).c_str()); CVar_SetString("gSpoilerLog", fileName.c_str()); - Game::SaveSettings(); - Game::LoadSettings(); + CVar_Save(); + CVar_Load(); CVar_SetS32("gNewSeedGenerated", 1); } \ No newline at end of file diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 59146ba10..38eb0ea89 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include "../libultraship/ImGuiImpl.h" #include #include "3drando/rando_main.hpp" @@ -3192,7 +3191,7 @@ std::thread randoThread; void GenerateRandomizerImgui() { CVar_SetS32("gRandoGenerating", 1); - Game::SaveSettings(); + CVar_Save(); std::unordered_map cvarSettings; cvarSettings[RSK_FOREST] = CVar_GetS32("gRandomizeForest", 1); @@ -3258,9 +3257,8 @@ void GenerateRandomizerImgui() { RandoMain::GenerateRando(cvarSettings); CVar_SetS32("gRandoGenerating", 0); - Game::SaveSettings(); - - Game::LoadSettings(); + CVar_Save(); + CVar_Load(); generated = 1; }