diff --git a/src/backend/core/Mem.cpp b/src/backend/core/Mem.cpp index 3c37cd74..f27e6f03 100644 --- a/src/backend/core/Mem.cpp +++ b/src/backend/core/Mem.cpp @@ -4,6 +4,7 @@ #include #include #include +#include namespace n64 { Mem::Mem(Registers ®s, ParallelRDP ¶llel, JIT *jit) : mmio(*this, regs, parallel), flash(saveData), jit(jit) { @@ -28,6 +29,7 @@ void Mem::Reset() { void Mem::LoadSRAM(SaveType save_type, fs::path path) { if (save_type == SAVE_SRAM_256k) { std::error_code error; + std::string savePath = Options::GetInstance().GetValue("general", "savePath"); if (!savePath.empty()) { path = savePath / path.filename(); } diff --git a/src/backend/core/mem/Flash.cpp b/src/backend/core/mem/Flash.cpp index 34e52a8e..c0394780 100644 --- a/src/backend/core/mem/Flash.cpp +++ b/src/backend/core/mem/Flash.cpp @@ -1,5 +1,6 @@ #include #include +#include namespace n64 { constexpr auto FLASH_SIZE = 1_mb; @@ -18,6 +19,7 @@ void Flash::Reset() { void Flash::Load(SaveType saveType, const std::string &path) { if (saveType == SAVE_FLASH_1m) { fs::path flashPath_ = path; + std::string savePath = Options::GetInstance().GetValue("general", "savePath"); if (!savePath.empty()) { flashPath_ = savePath / flashPath_.filename(); } diff --git a/src/backend/core/mmio/PIF.cpp b/src/backend/core/mmio/PIF.cpp index ba51ee39..ba75d950 100644 --- a/src/backend/core/mmio/PIF.cpp +++ b/src/backend/core/mmio/PIF.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #define MEMPAK_SIZE 32768 @@ -37,6 +38,7 @@ void PIF::Reset() { void PIF::MaybeLoadMempak() { if (!mempakOpen) { fs::path mempakPath_ = mempakPath; + std::string savePath = Options::GetInstance().GetValue("general", "savePath"); if (!savePath.empty()) { mempakPath_ = savePath / mempakPath_.filename(); } @@ -88,6 +90,7 @@ FORCE_INLINE size_t GetSaveSize(SaveType saveType) { void PIF::LoadEeprom(const SaveType saveType, const std::string &path) { if (saveType == SAVE_EEPROM_16k || saveType == SAVE_EEPROM_4k) { fs::path eepromPath_ = path; + std::string savePath = Options::GetInstance().GetValue("general", "savePath"); if (!savePath.empty()) { eepromPath_ = savePath / eepromPath_.filename(); } diff --git a/src/common.hpp b/src/common.hpp index 8990cacc..8e916307 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -24,7 +24,6 @@ using m128i = __m128i; constexpr u32 N64_CPU_FREQ = 93750000; constexpr u16 KAIZEN_VERSION = 0x010; -extern std::string savePath; static FORCE_INLINE constexpr u32 GetCyclesPerFrame(bool pal) { if (pal) { diff --git a/src/frontend/SettingsWindow.cpp b/src/frontend/SettingsWindow.cpp index b30de1f8..f70bcbd7 100644 --- a/src/frontend/SettingsWindow.cpp +++ b/src/frontend/SettingsWindow.cpp @@ -4,7 +4,9 @@ #include #include -std::string savePath; +SettingsWindow::SettingsWindow(gui::NativeWindow& window) : window(window) { + savesPath = Options::GetInstance().GetValue("general", "savePath"); +} bool SettingsWindow::render() { ImVec2 center = ImGui::GetMainViewport()->GetCenter();