Reduce calls to chdir() and only do it before loading a snapshot as it helps with relative disk locations.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
fb776b3c7f
commit
a29e781de0
2 changed files with 10 additions and 23 deletions
|
@ -483,11 +483,19 @@ void QApple::on_actionLoad_state_triggered()
|
|||
PauseEmulator pause(this);
|
||||
|
||||
emit endEmulator();
|
||||
|
||||
const std::string & filename = Snapshot_GetFilename();
|
||||
|
||||
const QFileInfo file(QString::fromStdString(filename));
|
||||
const QString path = file.absoluteDir().canonicalPath();
|
||||
// this is useful as snapshots from the test
|
||||
// have relative disk location
|
||||
SetCurrentImageDir(path.toStdString().c_str());
|
||||
|
||||
Snapshot_LoadState();
|
||||
SetWindowTitle();
|
||||
myEmulatorWindow->setWindowTitle(QString::fromStdString(g_pAppTitle));
|
||||
const std::string & filename = Snapshot_GetFilename();
|
||||
QString message = QString("State file: %1").arg(QString::fromStdString(filename));
|
||||
QString message = QString("State file: %1").arg(file.filePath());
|
||||
mySaveStateLabel->setText(message);
|
||||
myEmulator->updateVideo();
|
||||
}
|
||||
|
@ -584,13 +592,6 @@ void QApple::on_actionNext_video_mode_triggered()
|
|||
|
||||
void QApple::loadStateFile(const QString & filename)
|
||||
{
|
||||
const QFileInfo file(filename);
|
||||
const QString path = file.absoluteDir().canonicalPath();
|
||||
|
||||
// this is useful as snapshots from the test
|
||||
// have relative disk location
|
||||
SetCurrentImageDir(path.toStdString().c_str());
|
||||
|
||||
Snapshot_SetFilename(filename.toStdString().c_str());
|
||||
ui->actionLoad_state->trigger();
|
||||
}
|
||||
|
|
|
@ -326,30 +326,16 @@ void LoadConfiguration(void)
|
|||
if(REGLOAD(TEXT(REGVALUE_SLOT5), &dwTmp))
|
||||
g_CardMgr.Insert(5, (SS_CARDTYPE)dwTmp);
|
||||
|
||||
//
|
||||
|
||||
char szFilename[MAX_PATH] = {0};
|
||||
|
||||
RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_HDV_START_DIR), 1, szFilename, MAX_PATH);
|
||||
if (szFilename[0] == 0)
|
||||
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
||||
SetCurrentImageDir(szFilename);
|
||||
|
||||
HD_LoadLastDiskImage(HARDDISK_1);
|
||||
HD_LoadLastDiskImage(HARDDISK_2);
|
||||
|
||||
//
|
||||
|
||||
// Current/Starting Dir is the "root" of where the user keeps his disk images
|
||||
RegLoadString(TEXT(REG_PREFS), TEXT(REGVALUE_PREF_START_DIR), 1, szFilename, MAX_PATH);
|
||||
if (szFilename[0] == 0)
|
||||
GetCurrentDirectory(sizeof(szFilename), szFilename);
|
||||
SetCurrentImageDir(szFilename);
|
||||
|
||||
g_CardMgr.GetDisk2CardMgr().LoadLastDiskImage();
|
||||
|
||||
//
|
||||
|
||||
szFilename[0] = 0;
|
||||
RegLoadString(TEXT(REG_CONFIG),TEXT(REGVALUE_SAVESTATE_FILENAME),1,szFilename,sizeof(szFilename));
|
||||
Snapshot_SetFilename(szFilename); // If not in Registry than default will be used (ie. g_sCurrentDir + default filename)
|
||||
|
|
Loading…
Add table
Reference in a new issue