Save states: Make auto save states ignore time when the game is paused
This commit is contained in:
parent
03ad7d5cc7
commit
246e8a2c0a
1 changed files with 13 additions and 4 deletions
|
@ -9,19 +9,28 @@ AutoSaveManager::AutoSaveManager(shared_ptr<Console> console)
|
|||
_stopThread = false;
|
||||
_timer.Reset();
|
||||
_autoSaveThread = std::thread([=]() {
|
||||
while(!_stopThread) {
|
||||
bool showMessage = false;
|
||||
double targetTime = (double)console->GetSettings()->GetAutoSaveDelay(showMessage) * 60 * 1000;
|
||||
while(!_stopThread) {
|
||||
uint32_t autoSaveDelay = console->GetSettings()->GetAutoSaveDelay(showMessage) * 60 * 1000;
|
||||
if(autoSaveDelay > 0) {
|
||||
if(_timer.GetElapsedMS() > autoSaveDelay) {
|
||||
if(targetTime >= 0 && !console->IsExecutionStopped()) {
|
||||
targetTime -= _timer.GetElapsedMS();
|
||||
_timer.Reset();
|
||||
if(targetTime <= 0) {
|
||||
if(!console->IsDebuggerAttached()) {
|
||||
console->GetSaveStateManager()->SaveState(_autoSaveSlot, showMessage);
|
||||
}
|
||||
targetTime = (double)console->GetSettings()->GetAutoSaveDelay(showMessage) * 60 * 1000;
|
||||
_timer.Reset();
|
||||
}
|
||||
} else {
|
||||
_timer.Reset();
|
||||
}
|
||||
} else {
|
||||
_timer.Reset();
|
||||
targetTime = autoSaveDelay;
|
||||
}
|
||||
|
||||
if(!_stopThread) {
|
||||
_signal.Wait(1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue