actually save path settings in instance-local config

This commit is contained in:
Arisotura 2024-11-18 23:10:21 +01:00
parent bca0457bea
commit b491e99954
2 changed files with 10 additions and 10 deletions

View File

@ -686,7 +686,7 @@ std::string EmuInstance::getSavestateName(int slot)
{
std::string ext = ".ml";
ext += (char)('0'+slot);
return getAssetPath(false, globalCfg.GetString("SavestatePath"), ext);
return getAssetPath(false, localCfg.GetString("SavestatePath"), ext);
}
bool EmuInstance::savestateExists(int slot)
@ -752,7 +752,7 @@ bool EmuInstance::loadState(const std::string& filename)
previousSaveFile = ndsSave->GetPath();
std::string savefile = filename.substr(lastSep(filename)+1);
savefile = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav", savefile);
savefile = getAssetPath(false, localCfg.GetString("SaveFilePath"), ".sav", savefile);
savefile += instanceFileSuffix();
ndsSave->SetPath(savefile, true);
}
@ -803,7 +803,7 @@ bool EmuInstance::saveState(const std::string& filename)
if (globalCfg.GetBool("Savestate.RelocSRAM") && ndsSave)
{
std::string savefile = filename.substr(lastSep(filename)+1);
savefile = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav", savefile);
savefile = getAssetPath(false, localCfg.GetString("SaveFilePath"), ".sav", savefile);
savefile += instanceFileSuffix();
ndsSave->SetPath(savefile, false);
}
@ -839,7 +839,7 @@ void EmuInstance::loadCheats()
{
unloadCheats();
std::string filename = getAssetPath(false, globalCfg.GetString("CheatFilePath"), ".mch");
std::string filename = getAssetPath(false, localCfg.GetString("CheatFilePath"), ".mch");
// TODO: check for error (malformed cheat file, ...)
cheatFile = std::make_unique<ARCodeFile>(filename);
@ -1405,7 +1405,7 @@ void EmuInstance::reset()
if ((cartType != -1) && ndsSave)
{
std::string oldsave = ndsSave->GetPath();
std::string newsave = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav");
std::string newsave = getAssetPath(false, localCfg.GetString("SaveFilePath"), ".sav");
newsave += instanceFileSuffix();
if (oldsave != newsave)
ndsSave->SetPath(newsave, false);
@ -1414,7 +1414,7 @@ void EmuInstance::reset()
if ((gbaCartType != -1) && gbaSave)
{
std::string oldsave = gbaSave->GetPath();
std::string newsave = getAssetPath(true, globalCfg.GetString("SaveFilePath"), ".sav");
std::string newsave = getAssetPath(true, localCfg.GetString("SaveFilePath"), ".sav");
newsave += instanceFileSuffix();
if (oldsave != newsave)
gbaSave->SetPath(newsave, false);
@ -1863,7 +1863,7 @@ bool EmuInstance::loadROM(QStringList filepath, bool reset)
u32 savelen = 0;
std::unique_ptr<u8[]> savedata = nullptr;
std::string savname = getAssetPath(false, globalCfg.GetString("SaveFilePath"), ".sav");
std::string savname = getAssetPath(false, localCfg.GetString("SaveFilePath"), ".sav");
std::string origsav = savname;
savname += instanceFileSuffix();
@ -2022,7 +2022,7 @@ bool EmuInstance::loadGBAROM(QStringList filepath)
u32 savelen = 0;
std::unique_ptr<u8[]> savedata = nullptr;
std::string savname = getAssetPath(true, globalCfg.GetString("SaveFilePath"), ".sav");
std::string savname = getAssetPath(true, localCfg.GetString("SaveFilePath"), ".sav");
std::string origsav = savname;
savname += instanceFileSuffix();

View File

@ -45,7 +45,7 @@ PathSettingsDialog::PathSettingsDialog(QWidget* parent) : QDialog(parent), ui(ne
emuInstance = ((MainWindow*)parent)->getEmuInstance();
auto& cfg = emuInstance->getGlobalConfig();
auto& cfg = emuInstance->getLocalConfig();
ui->txtSaveFilePath->setText(cfg.GetQString("SaveFilePath"));
ui->txtSavestatePath->setText(cfg.GetQString("SavestatePath"));
ui->txtCheatFilePath->setText(cfg.GetQString("CheatFilePath"));
@ -108,7 +108,7 @@ void PathSettingsDialog::done(int r)
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
return;
auto& cfg = emuInstance->getGlobalConfig();
auto& cfg = emuInstance->getLocalConfig();
cfg.SetQString("SaveFilePath", ui->txtSaveFilePath->text());
cfg.SetQString("SavestatePath", ui->txtSavestatePath->text());
cfg.SetQString("CheatFilePath", ui->txtCheatFilePath->text());