Changed SaveFileManager methods to take Common::String params (instead of char pointers)
svn-id: r41000
This commit is contained in:
parent
518e005ec2
commit
fb79b18571
43 changed files with 170 additions and 168 deletions
|
@ -144,8 +144,8 @@ DefaultEventManager::DefaultEventManager(EventProvider *boss) :
|
|||
if (_recordMode == kRecorderRecord) {
|
||||
_recordCount = 0;
|
||||
_recordTimeCount = 0;
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordTempFileName.c_str());
|
||||
_recordTimeFile = g_system->getSavefileManager()->openForSaving(_recordTimeFileName.c_str());
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordTempFileName);
|
||||
_recordTimeFile = g_system->getSavefileManager()->openForSaving(_recordTimeFileName);
|
||||
_recordSubtitles = ConfMan.getBool("subtitles");
|
||||
}
|
||||
|
||||
|
@ -155,8 +155,8 @@ DefaultEventManager::DefaultEventManager(EventProvider *boss) :
|
|||
if (_recordMode == kRecorderPlayback) {
|
||||
_playbackCount = 0;
|
||||
_playbackTimeCount = 0;
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordFileName.c_str());
|
||||
_playbackTimeFile = g_system->getSavefileManager()->openForLoading(_recordTimeFileName.c_str());
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordFileName);
|
||||
_playbackTimeFile = g_system->getSavefileManager()->openForLoading(_recordTimeFileName);
|
||||
|
||||
if (!_playbackFile) {
|
||||
warning("Cannot open playback file %s. Playback was switched off", _recordFileName.c_str());
|
||||
|
@ -235,11 +235,11 @@ DefaultEventManager::~DefaultEventManager() {
|
|||
_recordTimeFile->finalize();
|
||||
delete _recordTimeFile;
|
||||
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName.c_str());
|
||||
_playbackFile = g_system->getSavefileManager()->openForLoading(_recordTempFileName);
|
||||
|
||||
assert(_playbackFile);
|
||||
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName.c_str());
|
||||
_recordFile = g_system->getSavefileManager()->openForSaving(_recordFileName);
|
||||
_recordFile->writeUint32LE(RECORD_SIGNATURE);
|
||||
_recordFile->writeUint32LE(RECORD_VERSION);
|
||||
|
||||
|
|
|
@ -318,13 +318,13 @@ public:
|
|||
class VMSaveManager : public Common::SaveFileManager {
|
||||
public:
|
||||
|
||||
virtual Common::OutSaveFile *openForSaving(const char *filename) {
|
||||
return Common::wrapCompressedWriteStream(new OutVMSave(filename));
|
||||
virtual Common::OutSaveFile *openForSaving(const Common::String &filename) {
|
||||
return Common::wrapCompressedWriteStream(new OutVMSave(filename.c_str()));
|
||||
}
|
||||
|
||||
virtual Common::InSaveFile *openForLoading(const char *filename) {
|
||||
virtual Common::InSaveFile *openForLoading(const Common::String &filename) {
|
||||
InVMSave *s = new InVMSave();
|
||||
if (s->readSaveGame(filename)) {
|
||||
if (s->readSaveGame(filename.c_str())) {
|
||||
return Common::wrapCompressedReadStream(s);
|
||||
} else {
|
||||
delete s;
|
||||
|
@ -332,11 +332,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
virtual bool removeSavefile(const char *filename) {
|
||||
return ::deleteSaveGame(filename);
|
||||
virtual bool removeSavefile(const Common::String &filename) {
|
||||
return ::deleteSaveGame(filename.c_str());
|
||||
}
|
||||
|
||||
virtual Common::StringList listSavefiles(const char *glob);
|
||||
virtual Common::StringList listSavefiles(const Common::String &pattern);
|
||||
};
|
||||
|
||||
void OutVMSave::finalize()
|
||||
|
@ -421,12 +421,12 @@ uint32 OutVMSave::write(const void *buf, uint32 cnt)
|
|||
}
|
||||
|
||||
|
||||
Common::StringList VMSaveManager::listSavefiles(const char *glob)
|
||||
Common::StringList VMSaveManager::listSavefiles(const Common::String &pattern)
|
||||
{
|
||||
Common::StringList list;
|
||||
|
||||
for (int i=0; i<24; i++)
|
||||
tryList(glob, i, list);
|
||||
tryList(pattern.c_str(), i, list);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() {
|
|||
|
||||
}
|
||||
|
||||
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
|
||||
GBAMPSaveFile *GBAMPSaveFileManager::openSavefile(const char *name, bool saveOrLoad) {
|
||||
char fileSpec[128];
|
||||
|
||||
strcpy(fileSpec, getSavePath());
|
||||
|
@ -180,7 +180,7 @@ const char *GBAMPSaveFileManager::getSavePath() const {
|
|||
return dir;
|
||||
}
|
||||
|
||||
Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
||||
Common::StringList GBAMPSaveFileManager::listSavefiles(const Common::String &pattern) {
|
||||
|
||||
enum { TYPE_NO_MORE = 0, TYPE_FILE = 1, TYPE_DIR = 2 };
|
||||
char name[256];
|
||||
|
@ -225,7 +225,7 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
|||
}
|
||||
|
||||
|
||||
if (Common::matchString(name, pattern)) {
|
||||
if (Common::matchString(name, pattern.c_str())) {
|
||||
list.push_back(name);
|
||||
}
|
||||
}
|
||||
|
@ -236,5 +236,3 @@ Common::StringList GBAMPSaveFileManager::listSavefiles(const char *pattern) {
|
|||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -66,13 +66,13 @@ public:
|
|||
|
||||
GBAMPSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||
|
||||
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
||||
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
||||
virtual Common::OutSaveFile* openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); }
|
||||
virtual Common::InSaveFile* openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); }
|
||||
|
||||
virtual bool removeSavefile(const char *filename) { return false; } // TODO: Implement this
|
||||
virtual Common::StringList listSavefiles(const char *pattern);
|
||||
virtual bool removeSavefile(const Common::String &filename) { return false; } // TODO: Implement this
|
||||
virtual Common::StringList listSavefiles(const Common::String &pattern);
|
||||
|
||||
void deleteFile(char* name);
|
||||
void deleteFile(const Common::String &name);
|
||||
void listFiles();
|
||||
|
||||
const char *getSavePath() const;
|
||||
|
|
|
@ -360,7 +360,7 @@ DSSaveFileManager* DSSaveFileManager::instancePtr = NULL;
|
|||
|
||||
DSSaveFile *DSSaveFileManager::openSavefile(const char *filename, bool saveOrLoad) {
|
||||
for (int r = 0; r < 8; r++) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches((char *) filename))) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches(filename))) {
|
||||
// consolePrintf("Matched save %d (%d)\n", r, gbaSave[r].getSize());
|
||||
gbaSave[r].reset();
|
||||
//consolePrintf("reset ");
|
||||
|
@ -384,17 +384,17 @@ DSSaveFile* DSSaveFile::clone() {
|
|||
return new DSSaveFile(&save, saveCompressed, saveData);
|
||||
}
|
||||
|
||||
void DSSaveFileManager::deleteFile(char* name) {
|
||||
void DSSaveFileManager::deleteFile(const char* name) {
|
||||
// consolePrintf("Deleting %s", name);
|
||||
for (int r = 0; r < 8; r++) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches((char *) name))) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches(name))) {
|
||||
gbaSave[r].deleteFile();
|
||||
}
|
||||
}
|
||||
flushToSaveRAM();
|
||||
}
|
||||
|
||||
bool DSSaveFileManager::removeSavefile(const char *filename) {
|
||||
bool DSSaveFileManager::removeSavefile(const Common::String &filename) {
|
||||
consolePrintf("DSSaveFileManager::removeSavefile : Not implemented yet.\n");
|
||||
assert(false);
|
||||
//TODO: Implement this. Most likely, you just have to use the code of deleteFile?
|
||||
|
@ -402,7 +402,7 @@ bool DSSaveFileManager::removeSavefile(const char *filename) {
|
|||
}
|
||||
|
||||
|
||||
Common::StringList DSSaveFileManager::listSavefiles(const char *pattern) {
|
||||
Common::StringList DSSaveFileManager::listSavefiles(const Common::String &pattern) {
|
||||
consolePrintf("DSSaveFileManager::listSavefiles : Not implemented yet.\n");
|
||||
assert(false);
|
||||
return Common::StringList();
|
||||
|
@ -424,7 +424,7 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num)
|
|||
|
||||
for (int saveNum = 0; saveNum < num; saveNum++) {
|
||||
for (int r = 0; r < 8; r++) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches((char *) prefix, saveNum))) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches(prefix, saveNum))) {
|
||||
marks[saveNum] = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -122,11 +122,11 @@ public:
|
|||
|
||||
DSSaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||
|
||||
virtual Common::OutSaveFile* openForSaving(const char* filename) { return openSavefile(filename, true); }
|
||||
virtual Common::InSaveFile* openForLoading(const char* filename) { return openSavefile(filename, false); }
|
||||
virtual Common::OutSaveFile* openForSaving(const Common::String &filename) { return openSavefile(filename.c_str(), true); }
|
||||
virtual Common::InSaveFile* openForLoading(const Common::String &filename) { return openSavefile(filename.c_str(), false); }
|
||||
|
||||
virtual bool removeSavefile(const char *filename);
|
||||
virtual Common::StringList listSavefiles(const char *pattern);
|
||||
virtual bool removeSavefile(const Common::String &filename);
|
||||
virtual Common::StringList listSavefiles(const Common::String &pattern);
|
||||
|
||||
void flushToSaveRAM();
|
||||
|
||||
|
@ -144,7 +144,7 @@ public:
|
|||
static void setExtraData(int data);
|
||||
|
||||
protected:
|
||||
DSSaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
||||
DSSaveFile *makeSaveFile(const Common::String &filename, bool saveOrLoad);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,7 +82,7 @@ void Ps2SaveFileManager::mcSplit(char *full, char *game, char *ext) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
Common::InSaveFile *Ps2SaveFileManager::openForLoading(const char *filename) {
|
||||
Common::InSaveFile *Ps2SaveFileManager::openForLoading(const Common::String &filename) {
|
||||
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
|
||||
Common::SeekableReadStream *sf;
|
||||
|
||||
|
@ -93,33 +93,35 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const char *filename) {
|
|||
|
||||
if (_getDev(savePath) == MC_DEV) {
|
||||
// if (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0) {
|
||||
char *game=0, *ext=0, path[32], temp[32];
|
||||
char path[32];
|
||||
|
||||
// FIXME : hack for indy4 iq-points
|
||||
if (strcmp(filename, "iq-points") == 0) {
|
||||
if (filename == "iq-points") {
|
||||
mcCheck("mc0:ScummVM/indy4");
|
||||
sprintf(path, "mc0:ScummVM/indy4/iq-points");
|
||||
}
|
||||
// FIXME : hack for bs1 saved games
|
||||
else if (strcmp(filename, "SAVEGAME.INF") == 0) {
|
||||
else if (filename == "SAVEGAME.INF") {
|
||||
mcCheck("mc0:ScummVM/sword1");
|
||||
sprintf(path, "mc0:ScummVM/sword1/SAVEGAME.INF");
|
||||
}
|
||||
else {
|
||||
printf("MC : filename = %s\n", filename);
|
||||
strcpy(temp, filename);
|
||||
char temp[32];
|
||||
printf("MC : filename = %s\n", filename.c_str());
|
||||
strcpy(temp, filename.c_str());
|
||||
|
||||
// mcSplit(temp, game, ext);
|
||||
game = strdup(strtok(temp, "."));
|
||||
ext = strdup(strtok(NULL, "*"));
|
||||
char *game = strdup(strtok(temp, "."));
|
||||
char *ext = strdup(strtok(NULL, "*"));
|
||||
sprintf(path, "mc0:ScummVM/%s", game); // per game path
|
||||
|
||||
// mcCheck(path); // needed on load ?
|
||||
sprintf(path, "mc0:ScummVM/%s/%s.sav", game, ext);
|
||||
}
|
||||
|
||||
free(game);
|
||||
free(ext);
|
||||
}
|
||||
|
||||
|
||||
Common::FSNode file(path);
|
||||
|
||||
|
@ -142,11 +144,11 @@ Common::InSaveFile *Ps2SaveFileManager::openForLoading(const char *filename) {
|
|||
return Common::wrapCompressedReadStream(sf);
|
||||
}
|
||||
|
||||
Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const char *filename) {
|
||||
Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const Common::String &filename) {
|
||||
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
|
||||
Common::WriteStream *sf;
|
||||
|
||||
printf("openForSaving : %s\n", filename);
|
||||
printf("openForSaving : %s\n", filename.c_str());
|
||||
|
||||
if (!savePath.exists() || !savePath.isDirectory())
|
||||
return NULL;
|
||||
|
@ -155,33 +157,35 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const char *filename) {
|
|||
|
||||
if (_getDev(savePath) == MC_DEV) {
|
||||
// if (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0) {
|
||||
char *game=0, *ext=0, path[32], temp[32];
|
||||
char path[32];
|
||||
|
||||
// FIXME : hack for indy4 iq-points
|
||||
if (strcmp(filename, "iq-points") == 0) {
|
||||
if (filename == "iq-points") {
|
||||
mcCheck("mc0:ScummVM/indy4");
|
||||
sprintf(path, "mc0:ScummVM/indy4/iq-points");
|
||||
}
|
||||
// FIXME : hack for bs1 saved games
|
||||
else if (strcmp(filename, "SAVEGAME.INF") == 0) {
|
||||
else if (filename == "SAVEGAME.INF") {
|
||||
mcCheck("mc0:ScummVM/sword1");
|
||||
sprintf(path, "mc0:ScummVM/sword1/SAVEGAME.INF");
|
||||
}
|
||||
else {
|
||||
strcpy(temp, filename);
|
||||
char temp[32];
|
||||
strcpy(temp, filename.c_str());
|
||||
|
||||
// mcSplit(temp, game, ext);
|
||||
game = strdup(strtok(temp, "."));
|
||||
ext = strdup(strtok(NULL, "*"));
|
||||
char *game = strdup(strtok(temp, "."));
|
||||
char *ext = strdup(strtok(NULL, "*"));
|
||||
sprintf(path, "mc0:ScummVM/%s", game); // per game path
|
||||
mcCheck(path);
|
||||
sprintf(path, "mc0:ScummVM/%s/%s.sav", game, ext);
|
||||
|
||||
free(game);
|
||||
free(ext);
|
||||
}
|
||||
|
||||
Common::FSNode file(path);
|
||||
sf = file.createWriteStream();
|
||||
free(game);
|
||||
free(ext);
|
||||
} else {
|
||||
Common::FSNode file = savePath.getChild(filename);
|
||||
sf = file.createWriteStream();
|
||||
|
@ -191,7 +195,7 @@ Common::OutSaveFile *Ps2SaveFileManager::openForSaving(const char *filename) {
|
|||
return Common::wrapCompressedWriteStream(sf);
|
||||
}
|
||||
|
||||
bool Ps2SaveFileManager::removeSavefile(const char *filename) {
|
||||
bool Ps2SaveFileManager::removeSavefile(const Common::String &filename) {
|
||||
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
|
||||
Common::FSNode file;
|
||||
|
||||
|
@ -200,12 +204,12 @@ bool Ps2SaveFileManager::removeSavefile(const char *filename) {
|
|||
|
||||
if (_getDev(savePath) == MC_DEV) {
|
||||
// if (strncmp(savePath.getPath().c_str(), "mc0:", 4) == 0) {
|
||||
char *game=0, *ext=0, path[32], temp[32];
|
||||
strcpy(temp, filename);
|
||||
char path[32], temp[32];
|
||||
strcpy(temp, filename.c_str());
|
||||
|
||||
// mcSplit(temp, game, ext);
|
||||
game = strdup(strtok(temp, "."));
|
||||
ext = strdup(strtok(NULL, "*"));
|
||||
char *game = strdup(strtok(temp, "."));
|
||||
char *ext = strdup(strtok(NULL, "*"));
|
||||
sprintf(path, "mc0:ScummVM/%s", game); // per game path
|
||||
mcCheck(path);
|
||||
sprintf(path, "mc0:ScummVM/%s/%s.sav", game, ext);
|
||||
|
@ -224,7 +228,7 @@ bool Ps2SaveFileManager::removeSavefile(const char *filename) {
|
|||
return true;
|
||||
}
|
||||
|
||||
Common::StringList Ps2SaveFileManager::listSavefiles(const char *pattern) {
|
||||
Common::StringList Ps2SaveFileManager::listSavefiles(const Common::String &pattern) {
|
||||
Common::FSNode savePath(ConfMan.get("savepath")); // TODO: is this fast?
|
||||
Common::String _dir;
|
||||
Common::String search;
|
||||
|
|
|
@ -37,10 +37,10 @@ public:
|
|||
Ps2SaveFileManager(OSystem_PS2 *system, Gs2dScreen *screen);
|
||||
virtual ~Ps2SaveFileManager();
|
||||
|
||||
virtual Common::InSaveFile *openForLoading(const char *filename);
|
||||
virtual Common::OutSaveFile *openForSaving(const char *filename);
|
||||
virtual Common::StringList listSavefiles(const char *regex);
|
||||
virtual bool removeSavefile(const char *filename);
|
||||
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
|
||||
virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
|
||||
virtual Common::StringList listSavefiles(const Common::String &pattern);
|
||||
virtual bool removeSavefile(const Common::String &filename);
|
||||
|
||||
// void writeSaveNonblocking(char *name, void *buf, uint32 size);
|
||||
// void saveThread(void);
|
||||
|
|
|
@ -54,7 +54,7 @@ void DefaultSaveFileManager::checkPath(const Common::FSNode &dir) {
|
|||
}
|
||||
}
|
||||
|
||||
Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
|
||||
Common::StringList DefaultSaveFileManager::listSavefiles(const Common::String &pattern) {
|
||||
Common::FSNode savePath(getSavePath());
|
||||
checkPath(savePath);
|
||||
if (getError() != Common::kNoError)
|
||||
|
@ -74,7 +74,7 @@ Common::StringList DefaultSaveFileManager::listSavefiles(const char *pattern) {
|
|||
return results;
|
||||
}
|
||||
|
||||
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename) {
|
||||
Common::InSaveFile *DefaultSaveFileManager::openForLoading(const Common::String &filename) {
|
||||
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
||||
Common::FSNode savePath(getSavePath());
|
||||
checkPath(savePath);
|
||||
|
@ -91,7 +91,7 @@ Common::InSaveFile *DefaultSaveFileManager::openForLoading(const char *filename)
|
|||
return Common::wrapCompressedReadStream(sf);
|
||||
}
|
||||
|
||||
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename) {
|
||||
Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String &filename) {
|
||||
// Ensure that the savepath is valid. If not, generate an appropriate error.
|
||||
Common::FSNode savePath(getSavePath());
|
||||
checkPath(savePath);
|
||||
|
@ -106,7 +106,7 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const char *filename)
|
|||
return Common::wrapCompressedWriteStream(sf);
|
||||
}
|
||||
|
||||
bool DefaultSaveFileManager::removeSavefile(const char *filename) {
|
||||
bool DefaultSaveFileManager::removeSavefile(const Common::String &filename) {
|
||||
clearError();
|
||||
|
||||
Common::FSNode savePath(getSavePath());
|
||||
|
|
|
@ -39,10 +39,10 @@ public:
|
|||
DefaultSaveFileManager();
|
||||
DefaultSaveFileManager(const Common::String &defaultSavepath);
|
||||
|
||||
virtual Common::StringList listSavefiles(const char *pattern);
|
||||
virtual Common::InSaveFile *openForLoading(const char *filename);
|
||||
virtual Common::OutSaveFile *openForSaving(const char *filename);
|
||||
virtual bool removeSavefile(const char *filename);
|
||||
virtual Common::StringList listSavefiles(const Common::String &pattern);
|
||||
virtual Common::InSaveFile *openForLoading(const Common::String &filename);
|
||||
virtual Common::OutSaveFile *openForSaving(const Common::String &filename);
|
||||
virtual bool removeSavefile(const Common::String &filename);
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
namespace Common {
|
||||
|
||||
bool SaveFileManager::renameSavefile(const char *oldFilename, const char *newFilename) {
|
||||
bool SaveFileManager::renameSavefile(const String &oldFilename, const String &newFilename) {
|
||||
|
||||
InSaveFile *inFile = 0;
|
||||
OutSaveFile *outFile = 0;
|
||||
|
|
|
@ -110,21 +110,21 @@ public:
|
|||
* @param name the name of the savefile
|
||||
* @return pointer to an OutSaveFile, or NULL if an error occured.
|
||||
*/
|
||||
virtual OutSaveFile *openForSaving(const char *name) = 0;
|
||||
virtual OutSaveFile *openForSaving(const String &name) = 0;
|
||||
|
||||
/**
|
||||
* Open the file with the specified name in the given directory for loading.
|
||||
* @param name the name of the savefile
|
||||
* @return pointer to an InSaveFile, or NULL if an error occured.
|
||||
*/
|
||||
virtual InSaveFile *openForLoading(const char *name) = 0;
|
||||
virtual InSaveFile *openForLoading(const String &name) = 0;
|
||||
|
||||
/**
|
||||
* Removes the given savefile from the system.
|
||||
* @param name the name of the savefile to be removed.
|
||||
* @return true if no error occurred, false otherwise.
|
||||
*/
|
||||
virtual bool removeSavefile(const char *name) = 0;
|
||||
virtual bool removeSavefile(const String &name) = 0;
|
||||
|
||||
/**
|
||||
* Renames the given savefile.
|
||||
|
@ -132,7 +132,7 @@ public:
|
|||
* @param newName New name.
|
||||
* @return true if no error occurred. false otherwise.
|
||||
*/
|
||||
virtual bool renameSavefile(const char *oldName, const char *newName);
|
||||
virtual bool renameSavefile(const String &oldName, const String &newName);
|
||||
|
||||
/**
|
||||
* Request a list of available savegames with a given DOS-style pattern,
|
||||
|
@ -142,7 +142,7 @@ public:
|
|||
* @return list of strings for all present file names.
|
||||
* @see Common::matchString()
|
||||
*/
|
||||
virtual Common::StringList listSavefiles(const char *pattern) = 0;
|
||||
virtual StringList listSavefiles(const String &pattern) = 0;
|
||||
};
|
||||
|
||||
} // End of namespace Common
|
||||
|
|
|
@ -898,7 +898,7 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".???";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -907,7 +907,7 @@ SaveStateList AgiMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
uint32 type = in->readUint32BE();
|
||||
if (type == AGIflag)
|
||||
|
|
|
@ -183,7 +183,7 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".???";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -192,7 +192,7 @@ SaveStateList AgosMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
saveDesc = file->c_str();
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||
|
|
|
@ -569,13 +569,13 @@ SaveStateList CineMetaEngine::listSaves(const char *target) const {
|
|||
|
||||
Common::String pattern = target;
|
||||
pattern += ".?";
|
||||
Common::StringList filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end());
|
||||
Common::StringList::const_iterator file = filenames.begin();
|
||||
|
||||
Common::String filename = target;
|
||||
filename += ".dir";
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(filename.c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(filename);
|
||||
if (in) {
|
||||
int8 ch;
|
||||
char saveDesc[20];
|
||||
|
|
|
@ -206,7 +206,7 @@ SaveStateList CruiseMetaEngine::listSaves(const char *target) const {
|
|||
Common::StringList filenames;
|
||||
Common::String pattern("cruise.s??");
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -215,7 +215,7 @@ SaveStateList CruiseMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 2);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 99) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
Cruise::CruiseSavegameHeader header;
|
||||
Cruise::readSavegameHeader(in, header);
|
||||
|
|
|
@ -230,7 +230,7 @@ void GroovieMetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
}
|
||||
|
||||
Common::String filename = SaveLoad::getSlotSaveName(target, slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor GroovieMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
|
|
|
@ -50,7 +50,7 @@ SaveStateList SaveLoad::listValidSaves(const Common::String &target) {
|
|||
|
||||
// Get the list of savefiles
|
||||
Common::String pattern = target + ".00?";
|
||||
Common::StringList savefiles = g_system->getSavefileManager()->listSavefiles(pattern.c_str());
|
||||
Common::StringList savefiles = g_system->getSavefileManager()->listSavefiles(pattern);
|
||||
|
||||
// Sort the list of filenames
|
||||
sort(savefiles.begin(), savefiles.end());
|
||||
|
@ -80,7 +80,7 @@ Common::InSaveFile *SaveLoad::openForLoading(const Common::String &target, int s
|
|||
|
||||
// Open the savefile
|
||||
Common::String savename = getSlotSaveName(target, slot);
|
||||
Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(savename.c_str());
|
||||
Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(savename);
|
||||
if (!savefile) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ Common::OutSaveFile *SaveLoad::openForSaving(const Common::String &target, int s
|
|||
|
||||
// Open the savefile
|
||||
Common::String savename = getSlotSaveName(target, slot);
|
||||
Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(savename.c_str());
|
||||
Common::OutSaveFile *savefile = g_system->getSavefileManager()->openForSaving(savename);
|
||||
if (!savefile) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1192,7 +1192,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {
|
|||
pattern += ".???";
|
||||
|
||||
Common::StringList filenames;
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
Common::sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -1201,7 +1201,7 @@ SaveStateList KyraMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
if (Kyra::KyraEngine_v1::readSaveHeader(in, false, header) == Kyra::KyraEngine_v1::kRSHENoError) {
|
||||
// Workaround for old savegames using 'German' as description for kyra3 start savegame (slot 0)
|
||||
|
@ -1226,12 +1226,12 @@ void KyraMetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
return;
|
||||
|
||||
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor KyraMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
Common::String filename = Kyra::KyraEngine_v1::getSavegameFilename(target, slot);
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
|
||||
|
||||
if (in) {
|
||||
Kyra::KyraEngine_v1::SaveHeader header;
|
||||
|
|
|
@ -298,7 +298,7 @@ int GUI::redrawShadedButtonCallback(Button *button) {
|
|||
|
||||
void GUI::updateSaveList() {
|
||||
Common::String pattern = _vm->_targetName + ".???";
|
||||
Common::StringList saveFileList = _vm->_saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList saveFileList = _vm->_saveFileMan->listSavefiles(pattern);
|
||||
_saveSlots.clear();
|
||||
|
||||
for (Common::StringList::const_iterator i = saveFileList.begin(); i != saveFileList.end(); ++i) {
|
||||
|
|
|
@ -727,7 +727,7 @@ int GUI_v2::deleteMenu(Button *caller) {
|
|||
break;
|
||||
Common::String oldName = _vm->getSavegameFilename(*i);
|
||||
Common::String newName = _vm->getSavegameFilename(*i-1);
|
||||
_vm->_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str());
|
||||
_vm->_saveFileMan->renameSavefile(oldName, newName);
|
||||
}
|
||||
_saveMenu.menuNameId = _vm->gameFlags().isTalkie ? 9 : 17;
|
||||
return 0;
|
||||
|
|
|
@ -221,7 +221,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const {
|
|||
Common::String saveDesc;
|
||||
Common::String pattern = "lure.???";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -230,7 +230,7 @@ SaveStateList LureMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
saveDesc = Lure::getSaveName(in);
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||
|
@ -251,7 +251,7 @@ void LureMetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
Common::String filename = target;
|
||||
filename += extension;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(LURE)
|
||||
|
|
|
@ -286,7 +286,7 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".0??";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -295,7 +295,7 @@ SaveStateList ParallactionMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 2);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 99) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
Common::String saveDesc = in->readLine();
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||
|
@ -316,7 +316,7 @@ void ParallactionMetaEngine::removeSaveState(const char *target, int slot) const
|
|||
Common::String filename = target;
|
||||
filename += extension;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(PARALLACTION)
|
||||
|
|
|
@ -88,12 +88,12 @@ Common::String SaveLoad::genSaveFileName(uint slot) {
|
|||
|
||||
Common::InSaveFile *SaveLoad::getInSaveFile(uint slot) {
|
||||
Common::String name = genSaveFileName(slot);
|
||||
return _saveFileMan->openForLoading(name.c_str());
|
||||
return _saveFileMan->openForLoading(name);
|
||||
}
|
||||
|
||||
Common::OutSaveFile *SaveLoad::getOutSaveFile(uint slot) {
|
||||
Common::String name = genSaveFileName(slot);
|
||||
return _saveFileMan->openForSaving(name.c_str());
|
||||
return _saveFileMan->openForSaving(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -307,7 +307,7 @@ void SaveLoadChooser::reflowLayout() {
|
|||
|
||||
int SaveLoad::buildSaveFileList(Common::StringList& l) {
|
||||
Common::String pattern = _saveFilePrefix + ".???";
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern);
|
||||
|
||||
Common::String s;
|
||||
|
||||
|
@ -439,7 +439,7 @@ void SaveLoad_ns::renameOldSavefiles() {
|
|||
for (i = 0; i < NUM_SAVESLOTS; i++) {
|
||||
exists[i] = false;
|
||||
Common::String name = genOldSaveFileName(i);
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(name.c_str());
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(name);
|
||||
if (f) {
|
||||
exists[i] = true;
|
||||
num++;
|
||||
|
@ -468,7 +468,7 @@ void SaveLoad_ns::renameOldSavefiles() {
|
|||
if (exists[i]) {
|
||||
Common::String oldName = genOldSaveFileName(i);
|
||||
Common::String newName = genSaveFileName(i);
|
||||
if (_saveFileMan->renameSavefile(oldName.c_str(), newName.c_str())) {
|
||||
if (_saveFileMan->renameSavefile(oldName, newName)) {
|
||||
success++;
|
||||
} else {
|
||||
warning("Error %i (%s) occurred while renaming %s to %s", _saveFileMan->getError(),
|
||||
|
|
|
@ -141,7 +141,7 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const {
|
|||
char saveDesc[32];
|
||||
Common::String pattern("queen.s??");
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -150,7 +150,7 @@ SaveStateList QueenMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 2);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 99) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
for (int i = 0; i < 4; i++)
|
||||
in->readUint32BE();
|
||||
|
@ -171,7 +171,7 @@ void QueenMetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
Common::String filename = target;
|
||||
filename += extension;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
Common::Error QueenMetaEngine::createInstance(OSystem *syst, Engine **engine) const {
|
||||
|
|
|
@ -193,7 +193,7 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".s??";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -203,7 +203,7 @@ SaveStateList SagaMetaEngine::listSaves(const char *target) const {
|
|||
slotNum = atoi(file->c_str() + file->size() - 2);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 99) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
for (int i = 0; i < 3; i++)
|
||||
in->readUint32BE();
|
||||
|
@ -226,7 +226,7 @@ void SagaMetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
Common::String filename = target;
|
||||
filename += extension;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor SagaMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
|
|
|
@ -116,7 +116,7 @@ void file_open(EngineState *s, const char *filename, int mode) {
|
|||
|
||||
if (mode == _K_FILE_MODE_OPEN_OR_FAIL) {
|
||||
// Try to open file, abort if not possible
|
||||
inFile = saveFileMan->openForLoading(wrappedName.c_str());
|
||||
inFile = saveFileMan->openForLoading(wrappedName);
|
||||
// If no matching savestate exists: fall back to reading from a regular file
|
||||
if (!inFile)
|
||||
inFile = SearchMan.createReadStreamForMember(filename);
|
||||
|
@ -124,7 +124,7 @@ void file_open(EngineState *s, const char *filename, int mode) {
|
|||
warning("file_open(_K_FILE_MODE_OPEN_OR_FAIL) failed to open file '%s'", filename);
|
||||
} else if (mode == _K_FILE_MODE_CREATE) {
|
||||
// Create the file, destroying any content it might have had
|
||||
outFile = saveFileMan->openForSaving(wrappedName.c_str());
|
||||
outFile = saveFileMan->openForSaving(wrappedName);
|
||||
if (!outFile)
|
||||
warning("file_open(_K_FILE_MODE_CREATE) failed to create file '%s'", filename);
|
||||
} else if (mode == _K_FILE_MODE_OPEN_OR_CREATE) {
|
||||
|
@ -331,7 +331,7 @@ void delete_savegame(EngineState *s, int savedir_nr) {
|
|||
sciprintf("Deleting savegame '%s'\n", filename.c_str());
|
||||
|
||||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
saveFileMan->removeSavefile(filename.c_str());
|
||||
saveFileMan->removeSavefile(filename);
|
||||
}
|
||||
|
||||
enum {
|
||||
|
@ -444,12 +444,12 @@ void listSavegames(Common::Array<SavegameDesc> &saves) {
|
|||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
|
||||
// Load all saves
|
||||
Common::StringList saveNames = saveFileMan->listSavefiles(((SciEngine *)g_engine)->getSavegamePattern().c_str());
|
||||
Common::StringList saveNames = saveFileMan->listSavefiles(((SciEngine *)g_engine)->getSavegamePattern());
|
||||
|
||||
for (Common::StringList::const_iterator iter = saveNames.begin(); iter != saveNames.end(); ++iter) {
|
||||
Common::String filename = *iter;
|
||||
Common::SeekableReadStream *in;
|
||||
if ((in = saveFileMan->openForLoading(filename.c_str()))) {
|
||||
if ((in = saveFileMan->openForLoading(filename))) {
|
||||
SavegameMetadata meta;
|
||||
if (!get_savegame_metadata(in, &meta)) {
|
||||
// invalid
|
||||
|
@ -490,7 +490,7 @@ reg_t kCheckSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
|
||||
Common::SeekableReadStream *in;
|
||||
if ((in = saveFileMan->openForLoading(filename.c_str()))) {
|
||||
if ((in = saveFileMan->openForLoading(filename))) {
|
||||
// found a savegame file
|
||||
|
||||
SavegameMetadata meta;
|
||||
|
@ -525,7 +525,7 @@ reg_t kGetSaveFiles(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|||
for (uint i = 0; i < saves.size(); i++) {
|
||||
Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(saves[i].id);
|
||||
Common::SeekableReadStream *in;
|
||||
if ((in = saveFileMan->openForLoading(filename.c_str()))) {
|
||||
if ((in = saveFileMan->openForLoading(filename))) {
|
||||
// found a savegame file
|
||||
|
||||
SavegameMetadata meta;
|
||||
|
@ -605,7 +605,7 @@ reg_t kSaveGame(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|||
Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_id);
|
||||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
Common::OutSaveFile *out;
|
||||
if (!(out = saveFileMan->openForSaving(filename.c_str()))) {
|
||||
if (!(out = saveFileMan->openForSaving(filename))) {
|
||||
warning("Error opening savegame \"%s\" for writing", filename.c_str());
|
||||
s->r_acc = NULL_REG;
|
||||
return NULL_REG;
|
||||
|
@ -646,7 +646,7 @@ reg_t kRestoreGame(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
Common::String filename = ((Sci::SciEngine*)g_engine)->getSavegameName(savedir_nr);
|
||||
Common::SeekableReadStream *in;
|
||||
if ((in = saveFileMan->openForLoading(filename.c_str()))) {
|
||||
if ((in = saveFileMan->openForLoading(filename))) {
|
||||
// found a savegame file
|
||||
|
||||
EngineState *newstate = gamestate_restore(s, in);
|
||||
|
@ -781,7 +781,7 @@ reg_t kFileIO(EngineState *s, int funct_nr, int argc, reg_t *argv) {
|
|||
|
||||
Common::SaveFileManager *saveFileMan = g_engine->getSaveFileManager();
|
||||
const Common::String wrappedName = ((Sci::SciEngine*)g_engine)->wrapFilename(name);
|
||||
saveFileMan->removeSavefile(wrappedName.c_str());
|
||||
saveFileMan->removeSavefile(wrappedName);
|
||||
// TODO/FIXME: Should we return something (like, a bool indicating
|
||||
// whether deleting the save succeeded or failed)?
|
||||
break;
|
||||
|
|
|
@ -994,7 +994,7 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".s??";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -1003,7 +1003,7 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 2);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 99) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
Scumm::getSavegameName(in, saveDesc, 0); // FIXME: heversion?!?
|
||||
saveList.push_back(SaveStateDescriptor(slotNum, saveDesc));
|
||||
|
@ -1017,12 +1017,12 @@ SaveStateList ScummMetaEngine::listSaves(const char *target) const {
|
|||
|
||||
void ScummMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = ScummEngine::makeSavegameName(target, slot, false);
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
SaveStateDescriptor ScummMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
|
||||
Common::String filename = ScummEngine::makeSavegameName(target, slot, false);
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str());
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename);
|
||||
|
||||
if (!in)
|
||||
return SaveStateDescriptor();
|
||||
|
|
|
@ -158,7 +158,7 @@ bool ScummEngine::saveState(int slot, bool compat) {
|
|||
} else {
|
||||
filename = makeSavegameName(slot, compat);
|
||||
}
|
||||
if (!(out = _saveFileMan->openForSaving(filename.c_str())))
|
||||
if (!(out = _saveFileMan->openForSaving(filename)))
|
||||
return false;
|
||||
|
||||
saveFailed = false;
|
||||
|
@ -222,7 +222,7 @@ bool ScummEngine_v4::savePreparedSavegame(int slot, char *desc) {
|
|||
// open savegame file
|
||||
if (success) {
|
||||
filename = makeSavegameName(slot, false);
|
||||
if (!(out = _saveFileMan->openForSaving(filename.c_str()))) {
|
||||
if (!(out = _saveFileMan->openForSaving(filename))) {
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ bool ScummEngine::loadState(int slot, bool compat) {
|
|||
} else {
|
||||
filename = makeSavegameName(slot, compat);
|
||||
}
|
||||
if (!(in = _saveFileMan->openForLoading(filename.c_str())))
|
||||
if (!(in = _saveFileMan->openForLoading(filename)))
|
||||
return false;
|
||||
|
||||
if (!loadSaveGameHeader(in, hdr)) {
|
||||
|
@ -562,7 +562,7 @@ void ScummEngine::listSavegames(bool *marks, int num) {
|
|||
prefix.setChar('*', prefix.size()-2);
|
||||
prefix.setChar(0, prefix.size()-1);
|
||||
memset(marks, false, num * sizeof(bool)); //assume no savegames for this title
|
||||
files = _saveFileMan->listSavefiles(prefix.c_str());
|
||||
files = _saveFileMan->listSavefiles(prefix);
|
||||
|
||||
for (Common::StringList::const_iterator file = files.begin(); file != files.end(); ++file) {
|
||||
//Obtain the last 2 digits of the filename, since they correspond to the save slot
|
||||
|
@ -584,7 +584,7 @@ bool ScummEngine::getSavegameName(int slot, Common::String &desc) {
|
|||
|
||||
desc.clear();
|
||||
Common::String filename = makeSavegameName(slot, false);
|
||||
in = _saveFileMan->openForLoading(filename.c_str());
|
||||
in = _saveFileMan->openForLoading(filename);
|
||||
if (in) {
|
||||
result = Scumm::getSavegameName(in, desc, _game.heversion);
|
||||
delete in;
|
||||
|
@ -626,7 +626,7 @@ Graphics::Surface *ScummEngine::loadThumbnailFromSlot(const char *target, int sl
|
|||
return 0;
|
||||
|
||||
Common::String filename = ScummEngine::makeSavegameName(target, slot, false);
|
||||
if (!(in = g_system->getSavefileManager()->openForLoading(filename.c_str()))) {
|
||||
if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -664,7 +664,7 @@ bool ScummEngine::loadInfosFromSlot(const char *target, int slot, InfoStuff *stu
|
|||
return 0;
|
||||
|
||||
Common::String filename = makeSavegameName(target, slot, false);
|
||||
if (!(in = g_system->getSavefileManager()->openForLoading(filename.c_str()))) {
|
||||
if (!(in = g_system->getSavefileManager()->openForLoading(filename))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -363,7 +363,7 @@ void ScummEngine_v4::saveIQPoints() {
|
|||
Common::OutSaveFile *file;
|
||||
Common::String filename = _targetName + ".iq";
|
||||
|
||||
file = _saveFileMan->openForSaving(filename.c_str());
|
||||
file = _saveFileMan->openForSaving(filename);
|
||||
if (file != NULL) {
|
||||
byte *ptr = getResourceAddress(rtString, STRINGID_IQ_EPISODE);
|
||||
if (ptr) {
|
||||
|
@ -379,7 +379,7 @@ void ScummEngine_v4::loadIQPoints(byte *ptr, int size) {
|
|||
Common::InSaveFile *file;
|
||||
Common::String filename = _targetName + ".iq";
|
||||
|
||||
file = _saveFileMan->openForLoading(filename.c_str());
|
||||
file = _saveFileMan->openForLoading(filename);
|
||||
if (file != NULL) {
|
||||
byte *tmp = (byte*)malloc(size);
|
||||
int nread = file->read(tmp, size);
|
||||
|
@ -464,7 +464,7 @@ void ScummEngine_v4::o4_saveLoadGame() {
|
|||
|
||||
listSavegames(avail_saves, ARRAYSIZE(avail_saves));
|
||||
Common::String filename = makeSavegameName(slot, false);
|
||||
if (avail_saves[slot] && (file = _saveFileMan->openForLoading(filename.c_str()))) {
|
||||
if (avail_saves[slot] && (file = _saveFileMan->openForLoading(filename))) {
|
||||
result = 6; // save file exists
|
||||
delete file;
|
||||
} else
|
||||
|
|
|
@ -1756,7 +1756,7 @@ void ScummEngine_v5::o5_roomOps() {
|
|||
error("SO_SAVE_STRING: Unsupported filename %s\n", filename.c_str());
|
||||
}
|
||||
|
||||
Common::OutSaveFile *file = _saveFileMan->openForSaving(filename.c_str());
|
||||
Common::OutSaveFile *file = _saveFileMan->openForSaving(filename);
|
||||
if (file != NULL) {
|
||||
byte *ptr;
|
||||
ptr = getResourceAddress(rtString, a);
|
||||
|
@ -1781,7 +1781,7 @@ void ScummEngine_v5::o5_roomOps() {
|
|||
error("SO_LOAD_STRING: Unsupported filename %s\n", filename.c_str());
|
||||
}
|
||||
|
||||
Common::InSaveFile *file = _saveFileMan->openForLoading(filename.c_str());
|
||||
Common::InSaveFile *file = _saveFileMan->openForLoading(filename);
|
||||
if (file != NULL) {
|
||||
byte *ptr;
|
||||
int len = 256, cnt = 0;
|
||||
|
|
|
@ -210,7 +210,7 @@ SaveStateList SkyMetaEngine::listSaves(const char *target) const {
|
|||
ext.toUppercase();
|
||||
if (isdigit(ext[0]) && isdigit(ext[1]) && isdigit(ext[2])){
|
||||
int slotNum = atoi(ext.c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
saveList.push_back(SaveStateDescriptor(slotNum+1, savenames[slotNum]));
|
||||
delete in;
|
||||
|
|
|
@ -791,7 +791,7 @@ bool Control::restoreFromFile(void) {
|
|||
void Control::readSavegameDescriptions(void) {
|
||||
char saveName[40];
|
||||
Common::String pattern = "sword1.???";
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
_saveNames.clear();
|
||||
|
@ -809,7 +809,7 @@ void Control::readSavegameDescriptions(void) {
|
|||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
num++;
|
||||
Common::InSaveFile *in = _saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = _saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
in->readUint32LE(); // header
|
||||
in->read(saveName, 40);
|
||||
|
@ -847,7 +847,7 @@ int Control::displayMessage(const char *altButton, const char *message, ...) {
|
|||
|
||||
bool Control::savegamesExist(void) {
|
||||
Common::String pattern = "sword1.???";
|
||||
Common::StringList saveNames = _saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList saveNames = _saveFileMan->listSavefiles(pattern);
|
||||
return saveNames.size() > 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ SaveStateList SwordMetaEngine::listSaves(const char *target) const {
|
|||
slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
in->readUint32LE(); // header
|
||||
in->read(saveName, 40);
|
||||
|
|
|
@ -389,7 +389,7 @@ uint32 Sword2Engine::getSaveDescription(uint16 slotNo, byte *description) {
|
|||
|
||||
bool Sword2Engine::saveExists() {
|
||||
Common::String pattern = _targetName + ".???";
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(pattern);
|
||||
|
||||
return !filenames.empty();
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const {
|
|||
Common::String pattern = target;
|
||||
pattern += ".???";
|
||||
|
||||
filenames = saveFileMan->listSavefiles(pattern.c_str());
|
||||
filenames = saveFileMan->listSavefiles(pattern);
|
||||
sort(filenames.begin(), filenames.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -197,7 +197,7 @@ SaveStateList Sword2MetaEngine::listSaves(const char *target) const {
|
|||
int slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
if (slotNum >= 0 && slotNum <= 999) {
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = saveFileMan->openForLoading(*file);
|
||||
if (in) {
|
||||
in->readUint32LE();
|
||||
in->read(saveDesc, SAVE_DESCRIPTION_LEN);
|
||||
|
@ -219,7 +219,7 @@ void Sword2MetaEngine::removeSaveState(const char *target, int slot) const {
|
|||
Common::String filename = target;
|
||||
filename += extension;
|
||||
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
Common::Error Sword2MetaEngine::createInstance(OSystem *syst, Engine **engine) const {
|
||||
|
|
|
@ -569,7 +569,7 @@ extern bool MoviePlaying();
|
|||
SaveStateList TinselMetaEngine::listSaves(const char *target) const {
|
||||
Common::String pattern = target;
|
||||
pattern = pattern + ".???";
|
||||
Common::StringList files = g_system->getSavefileManager()->listSavefiles(pattern.c_str());
|
||||
Common::StringList files = g_system->getSavefileManager()->listSavefiles(pattern);
|
||||
sort(files.begin(), files.end()); // Sort (hopefully ensuring we are sorted numerically..)
|
||||
|
||||
SaveStateList saveList;
|
||||
|
@ -579,7 +579,7 @@ SaveStateList TinselMetaEngine::listSaves(const char *target) const {
|
|||
slotNum = atoi(file->c_str() + file->size() - 3);
|
||||
|
||||
const Common::String &fname = *file;
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname.c_str());
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(fname);
|
||||
if (in) {
|
||||
in->readUint32LE(); // skip id
|
||||
in->readUint32LE(); // skip size
|
||||
|
|
|
@ -309,7 +309,7 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target)
|
|||
int i;
|
||||
|
||||
const Common::String pattern = target + ".???";
|
||||
Common::StringList files = saveFileMan->listSavefiles(pattern.c_str());
|
||||
Common::StringList files = saveFileMan->listSavefiles(pattern);
|
||||
|
||||
numSfiles = 0;
|
||||
|
||||
|
@ -318,7 +318,7 @@ int getList(Common::SaveFileManager *saveFileMan, const Common::String &target)
|
|||
break;
|
||||
|
||||
const Common::String &fname = *file;
|
||||
Common::InSaveFile *f = saveFileMan->openForLoading(fname.c_str());
|
||||
Common::InSaveFile *f = saveFileMan->openForLoading(fname);
|
||||
if (f == NULL) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ bool ToucheMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGa
|
|||
|
||||
SaveStateList ToucheMetaEngine::listSaves(const char *target) const {
|
||||
Common::String pattern = Touche::generateGameStateFileName(target, 0, true);
|
||||
Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern);
|
||||
bool slotsTable[Touche::kMaxSaveStates];
|
||||
memset(slotsTable, 0, sizeof(slotsTable));
|
||||
SaveStateList saveList;
|
||||
|
@ -181,7 +181,7 @@ SaveStateList ToucheMetaEngine::listSaves(const char *target) const {
|
|||
for (int slot = 0; slot < Touche::kMaxSaveStates; ++slot) {
|
||||
if (slotsTable[slot]) {
|
||||
Common::String file = Touche::generateGameStateFileName(target, slot);
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(file.c_str());
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(file);
|
||||
if (in) {
|
||||
char description[64];
|
||||
Touche::readGameStateDescription(in, description, sizeof(description) - 1);
|
||||
|
@ -201,7 +201,7 @@ int ToucheMetaEngine::getMaximumSaveSlot() const {
|
|||
|
||||
void ToucheMetaEngine::removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = Touche::generateGameStateFileName(target, slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
|
||||
#if PLUGIN_ENABLED_DYNAMIC(TOUCHE)
|
||||
|
|
|
@ -377,11 +377,11 @@ void ToucheEngine::handleOptions(int forceDisplay) {
|
|||
menuData.saveLoadDescriptionsTable[i][0] = 0;
|
||||
}
|
||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), 0, true);
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(gameStateFileName.c_str());
|
||||
Common::StringList filenames = _saveFileMan->listSavefiles(gameStateFileName);
|
||||
for (Common::StringList::const_iterator it = filenames.begin(); it != filenames.end(); ++it) {
|
||||
int i = getGameStateFileSlot(it->c_str());
|
||||
if (i >= 0 && i < kMaxSaveStates) {
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(it->c_str());
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(*it);
|
||||
if (f) {
|
||||
readGameStateDescription(f, menuData.saveLoadDescriptionsTable[i], 32);
|
||||
delete f;
|
||||
|
|
|
@ -324,7 +324,7 @@ void ToucheEngine::loadGameStateData(Common::ReadStream *stream) {
|
|||
Common::Error ToucheEngine::saveGameState(int num, const char *description) {
|
||||
bool saveOk = false;
|
||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName.c_str());
|
||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
||||
if (f) {
|
||||
f->writeUint16LE(kCurrentGameStateVersion);
|
||||
f->writeUint16LE(0);
|
||||
|
@ -347,7 +347,7 @@ Common::Error ToucheEngine::saveGameState(int num, const char *description) {
|
|||
Common::Error ToucheEngine::loadGameState(int num) {
|
||||
bool loadOk = false;
|
||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(gameStateFileName.c_str());
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(gameStateFileName);
|
||||
if (f) {
|
||||
uint16 version = f->readUint16LE();
|
||||
if (version < kCurrentGameStateVersion) {
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
|
||||
virtual SaveStateList listSaves(const char *target) const {
|
||||
Common::String pattern = Tucker::generateGameStateFileName(target, 0, true);
|
||||
Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern.c_str());
|
||||
Common::StringList filenames = g_system->getSavefileManager()->listSavefiles(pattern);
|
||||
bool slotsTable[Tucker::kLastSaveSlot + 1];
|
||||
memset(slotsTable, 0, sizeof(slotsTable));
|
||||
SaveStateList saveList;
|
||||
|
@ -172,7 +172,7 @@ public:
|
|||
int slot;
|
||||
const char *ext = strrchr(file->c_str(), '.');
|
||||
if (ext && (slot = atoi(ext + 1)) >= 0 && slot <= Tucker::kLastSaveSlot) {
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(file->c_str());
|
||||
Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(*file);
|
||||
if (in) {
|
||||
slotsTable[slot] = true;
|
||||
delete in;
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
|
||||
virtual void removeSaveState(const char *target, int slot) const {
|
||||
Common::String filename = Tucker::generateGameStateFileName(target, slot);
|
||||
g_system->getSavefileManager()->removeSavefile(filename.c_str());
|
||||
g_system->getSavefileManager()->removeSavefile(filename);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ void TuckerEngine::saveOrLoadGameStateData(S &s) {
|
|||
Common::Error TuckerEngine::loadGameState(int num) {
|
||||
Common::Error ret = Common::kNoError;
|
||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(gameStateFileName.c_str());
|
||||
Common::InSaveFile *f = _saveFileMan->openForLoading(gameStateFileName);
|
||||
if (f) {
|
||||
uint16 version = f->readUint16LE();
|
||||
if (version < kCurrentGameStateVersion) {
|
||||
|
@ -106,7 +106,7 @@ Common::Error TuckerEngine::loadGameState(int num) {
|
|||
Common::Error TuckerEngine::saveGameState(int num, const char *description) {
|
||||
Common::Error ret = Common::kNoError;
|
||||
Common::String gameStateFileName = generateGameStateFileName(_targetName.c_str(), num);
|
||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName.c_str());
|
||||
Common::OutSaveFile *f = _saveFileMan->openForSaving(gameStateFileName);
|
||||
if (f) {
|
||||
f->writeUint16LE(kCurrentGameStateVersion);
|
||||
f->writeUint16LE(0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue