aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/kernel/persistenceservice.cpp
diff options
context:
space:
mode:
authorMax Horn2010-10-25 23:19:39 +0000
committerMax Horn2010-10-25 23:19:39 +0000
commita7832856252828450a63fdd1d10c337cc8fb671e (patch)
tree265a3aae7e0d4dad340ce73194273e3a9800b299 /engines/sword25/kernel/persistenceservice.cpp
parente0d5db0bb822f4772d90cd404fb23e89524f7b3a (diff)
downloadscummvm-rg350-a7832856252828450a63fdd1d10c337cc8fb671e.tar.gz
scummvm-rg350-a7832856252828450a63fdd1d10c337cc8fb671e.tar.bz2
scummvm-rg350-a7832856252828450a63fdd1d10c337cc8fb671e.zip
SWORD25: Simplify FS 'wrapper' code a bit, add FIXME comments
The save system of this engine currently partially bypasses the SaveFileManager API, by (abusing) the fact that the Lua engine allows creating files in arbitrary places (it exposes fopen, fread, fwrite etc.). This is used to create a 'config.lua' configuration file. This makes it non-portable. In addition, the filenames used for the savestates ("0.b25s") do not comply with our naming conventions for engine savestates. It should be possible to overcome all this, but it might require hacking the Lua engine; or we could try to replace some of the BS2.5 script functions with our own, dynamically. svn-id: r53838
Diffstat (limited to 'engines/sword25/kernel/persistenceservice.cpp')
-rw-r--r--engines/sword25/kernel/persistenceservice.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/engines/sword25/kernel/persistenceservice.cpp b/engines/sword25/kernel/persistenceservice.cpp
index 0159991e0f..1b41f24a1d 100644
--- a/engines/sword25/kernel/persistenceservice.cpp
+++ b/engines/sword25/kernel/persistenceservice.cpp
@@ -202,7 +202,7 @@ uint PersistenceService::getSlotCount() {
}
Common::String PersistenceService::getSavegameDirectory() {
- Common::FSNode node(FileSystemUtil::getInstance().getUserdataDirectory());
+ Common::FSNode node(FileSystemUtil::getUserdataDirectory());
Common::FSNode childNode = node.getChild(SAVEGAME_DIRECTORY);
// Try and return the path using the savegame subfolder. But if doesn't exist, fall back on the data directory
@@ -251,6 +251,9 @@ Common::String &PersistenceService::getSavegameFilename(uint slotID) {
}
bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotFilename) {
+ // FIXME: This code is a hack which bypasses the savefile API,
+ // and should eventually be removed.
+
// Überprüfen, ob die Slot-ID zulässig ist.
if (slotID >= SLOT_COUNT) {
BS_LOG_ERRORLN("Tried to save to an invalid slot (%d). Only slot ids form 0 to %d are allowed.", slotID, SLOT_COUNT - 1);
@@ -260,9 +263,6 @@ bool PersistenceService::saveGame(uint slotID, const Common::String &screenshotF
// Dateinamen erzeugen.
Common::String filename = generateSavegameFilename(slotID);
- // Sicherstellen, dass das Verzeichnis für die Spielstanddateien existiert.
- FileSystemUtil::getInstance().createDirectory(getSavegameDirectory());
-
// Spielstanddatei öffnen und die Headerdaten schreiben.
Common::SaveFileManager *sfm = g_system->getSavefileManager();
Common::OutSaveFile *file = sfm->openForSaving(filename);