ew global variable

This commit is contained in:
irisz64
2025-07-22 12:46:50 +02:00
parent 0d48f2c991
commit 3520a309ed
5 changed files with 10 additions and 2 deletions

View File

@@ -4,6 +4,7 @@
#include <cassert>
#include <core/JIT.hpp>
#include <unarr.h>
#include <Options.hpp>
namespace n64 {
Mem::Mem(Registers &regs, ParallelRDP &parallel, 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<std::string>("general", "savePath");
if (!savePath.empty()) {
path = savePath / path.filename();
}

View File

@@ -1,5 +1,6 @@
#include <Mem.hpp>
#include <cassert>
#include <Options.hpp>
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<std::string>("general", "savePath");
if (!savePath.empty()) {
flashPath_ = savePath / flashPath_.filename();
}

View File

@@ -5,6 +5,7 @@
#include <core/mmio/PIF.hpp>
#include <core/registers/Registers.hpp>
#include <log.hpp>
#include <Options.hpp>
#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<std::string>("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<std::string>("general", "savePath");
if (!savePath.empty()) {
eepromPath_ = savePath / eepromPath_.filename();
}