actually save path settings in instance-local config
This commit is contained in:
parent
bca0457bea
commit
b491e99954
|
@ -686,7 +686,7 @@ std::string EmuInstance::getSavestateName(int slot)
|
||||||
{
|
{
|
||||||
std::string ext = ".ml";
|
std::string ext = ".ml";
|
||||||
ext += (char)('0'+slot);
|
ext += (char)('0'+slot);
|
||||||
return getAssetPath(false, globalCfg.GetString("SavestatePath"), ext);
|
return getAssetPath(false, localCfg.GetString("SavestatePath"), ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmuInstance::savestateExists(int slot)
|
bool EmuInstance::savestateExists(int slot)
|
||||||
|
@ -752,7 +752,7 @@ bool EmuInstance::loadState(const std::string& filename)
|
||||||
previousSaveFile = ndsSave->GetPath();
|
previousSaveFile = ndsSave->GetPath();
|
||||||
|
|
||||||
std::string savefile = filename.substr(lastSep(filename)+1);
|
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();
|
savefile += instanceFileSuffix();
|
||||||
ndsSave->SetPath(savefile, true);
|
ndsSave->SetPath(savefile, true);
|
||||||
}
|
}
|
||||||
|
@ -803,7 +803,7 @@ bool EmuInstance::saveState(const std::string& filename)
|
||||||
if (globalCfg.GetBool("Savestate.RelocSRAM") && ndsSave)
|
if (globalCfg.GetBool("Savestate.RelocSRAM") && ndsSave)
|
||||||
{
|
{
|
||||||
std::string savefile = filename.substr(lastSep(filename)+1);
|
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();
|
savefile += instanceFileSuffix();
|
||||||
ndsSave->SetPath(savefile, false);
|
ndsSave->SetPath(savefile, false);
|
||||||
}
|
}
|
||||||
|
@ -839,7 +839,7 @@ void EmuInstance::loadCheats()
|
||||||
{
|
{
|
||||||
unloadCheats();
|
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, ...)
|
// TODO: check for error (malformed cheat file, ...)
|
||||||
cheatFile = std::make_unique<ARCodeFile>(filename);
|
cheatFile = std::make_unique<ARCodeFile>(filename);
|
||||||
|
@ -1405,7 +1405,7 @@ void EmuInstance::reset()
|
||||||
if ((cartType != -1) && ndsSave)
|
if ((cartType != -1) && ndsSave)
|
||||||
{
|
{
|
||||||
std::string oldsave = ndsSave->GetPath();
|
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();
|
newsave += instanceFileSuffix();
|
||||||
if (oldsave != newsave)
|
if (oldsave != newsave)
|
||||||
ndsSave->SetPath(newsave, false);
|
ndsSave->SetPath(newsave, false);
|
||||||
|
@ -1414,7 +1414,7 @@ void EmuInstance::reset()
|
||||||
if ((gbaCartType != -1) && gbaSave)
|
if ((gbaCartType != -1) && gbaSave)
|
||||||
{
|
{
|
||||||
std::string oldsave = gbaSave->GetPath();
|
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();
|
newsave += instanceFileSuffix();
|
||||||
if (oldsave != newsave)
|
if (oldsave != newsave)
|
||||||
gbaSave->SetPath(newsave, false);
|
gbaSave->SetPath(newsave, false);
|
||||||
|
@ -1863,7 +1863,7 @@ bool EmuInstance::loadROM(QStringList filepath, bool reset)
|
||||||
u32 savelen = 0;
|
u32 savelen = 0;
|
||||||
std::unique_ptr<u8[]> savedata = nullptr;
|
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;
|
std::string origsav = savname;
|
||||||
savname += instanceFileSuffix();
|
savname += instanceFileSuffix();
|
||||||
|
|
||||||
|
@ -2022,7 +2022,7 @@ bool EmuInstance::loadGBAROM(QStringList filepath)
|
||||||
u32 savelen = 0;
|
u32 savelen = 0;
|
||||||
std::unique_ptr<u8[]> savedata = nullptr;
|
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;
|
std::string origsav = savname;
|
||||||
savname += instanceFileSuffix();
|
savname += instanceFileSuffix();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ PathSettingsDialog::PathSettingsDialog(QWidget* parent) : QDialog(parent), ui(ne
|
||||||
|
|
||||||
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
emuInstance = ((MainWindow*)parent)->getEmuInstance();
|
||||||
|
|
||||||
auto& cfg = emuInstance->getGlobalConfig();
|
auto& cfg = emuInstance->getLocalConfig();
|
||||||
ui->txtSaveFilePath->setText(cfg.GetQString("SaveFilePath"));
|
ui->txtSaveFilePath->setText(cfg.GetQString("SaveFilePath"));
|
||||||
ui->txtSavestatePath->setText(cfg.GetQString("SavestatePath"));
|
ui->txtSavestatePath->setText(cfg.GetQString("SavestatePath"));
|
||||||
ui->txtCheatFilePath->setText(cfg.GetQString("CheatFilePath"));
|
ui->txtCheatFilePath->setText(cfg.GetQString("CheatFilePath"));
|
||||||
|
@ -108,7 +108,7 @@ void PathSettingsDialog::done(int r)
|
||||||
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
|
QMessageBox::Ok, QMessageBox::Cancel) != QMessageBox::Ok)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto& cfg = emuInstance->getGlobalConfig();
|
auto& cfg = emuInstance->getLocalConfig();
|
||||||
cfg.SetQString("SaveFilePath", ui->txtSaveFilePath->text());
|
cfg.SetQString("SaveFilePath", ui->txtSaveFilePath->text());
|
||||||
cfg.SetQString("SavestatePath", ui->txtSavestatePath->text());
|
cfg.SetQString("SavestatePath", ui->txtSavestatePath->text());
|
||||||
cfg.SetQString("CheatFilePath", ui->txtCheatFilePath->text());
|
cfg.SetQString("CheatFilePath", ui->txtCheatFilePath->text());
|
||||||
|
|
Loading…
Reference in New Issue