mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-14 18:16:09 +00:00
ENGINES: Autosave won't save over a custom save in it's slot
This commit is contained in:
parent
91801a9c55
commit
4f26f2c7ef
@ -495,13 +495,23 @@ void Engine::handleAutoSave() {
|
|||||||
|
|
||||||
void Engine::saveAutosaveIfEnabled() {
|
void Engine::saveAutosaveIfEnabled() {
|
||||||
if (_autosaveInterval != 0) {
|
if (_autosaveInterval != 0) {
|
||||||
bool canSave = canSaveAutosaveCurrently();
|
bool saveFlag = canSaveAutosaveCurrently();
|
||||||
|
Common::String saveName = _("Autosave");
|
||||||
|
|
||||||
if (!canSave || saveGameState(getAutosaveSlot(), _("Autosave"), true).getCode() != Common::kNoError) {
|
if (saveFlag) {
|
||||||
|
// First check for an existing savegame in the slot, and if present, if it's an autosave
|
||||||
|
SaveStateDescriptor desc = getMetaEngine().querySaveMetaInfos(
|
||||||
|
_targetName.c_str(), getAutosaveSlot());
|
||||||
|
saveFlag = desc.getSaveSlot() == -1 || desc.getDescription() == saveName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (saveFlag && saveGameState(getAutosaveSlot(), saveName, true).getCode() != Common::kNoError) {
|
||||||
// Couldn't autosave at the designated time
|
// Couldn't autosave at the designated time
|
||||||
if (!canSave)
|
g_system->displayMessageOnOSD(_("Error occurred making autosave"));
|
||||||
g_system->displayMessageOnOSD(_("Error occurred making autosave"));
|
saveFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!saveFlag) {
|
||||||
// Set the next autosave interval to be in 5 minutes, rather than whatever
|
// Set the next autosave interval to be in 5 minutes, rather than whatever
|
||||||
// full autosave interval the user has selected
|
// full autosave interval the user has selected
|
||||||
_lastAutosaveTime = _system->getMillis() + (5 * 60 * 1000) - _autosaveInterval;
|
_lastAutosaveTime = _system->getMillis() + (5 * 60 * 1000) - _autosaveInterval;
|
||||||
@ -799,3 +809,9 @@ EnginePlugin *Engine::getMetaEnginePlugin() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
MetaEngine &Engine::getMetaEngine() {
|
||||||
|
const Plugin *plugin = EngineMan.findPlugin(ConfMan.get("engineid"));
|
||||||
|
assert(plugin);
|
||||||
|
return plugin->get<MetaEngine>();
|
||||||
|
}
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include "common/singleton.h"
|
#include "common/singleton.h"
|
||||||
|
|
||||||
class OSystem;
|
class OSystem;
|
||||||
|
class MetaEngine;
|
||||||
|
|
||||||
namespace Audio {
|
namespace Audio {
|
||||||
class Mixer;
|
class Mixer;
|
||||||
@ -323,6 +324,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
static bool shouldQuit();
|
static bool shouldQuit();
|
||||||
|
|
||||||
|
static MetaEngine &getMetaEngine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pause or resume the engine. This should stop/resume any audio playback
|
* Pause or resume the engine. This should stop/resume any audio playback
|
||||||
* and other stuff. Called right before the system runs a global dialog
|
* and other stuff. Called right before the system runs a global dialog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user