mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-21 19:51:49 +00:00
Get rid of Common::SaveFile
svn-id: r25666
This commit is contained in:
parent
be878d60db
commit
e326f482c9
@ -139,7 +139,7 @@ GBAMPSaveFileManager::~GBAMPSaveFileManager() {
|
||||
|
||||
}
|
||||
|
||||
Common::SaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
|
||||
GBAMPSaveFile* GBAMPSaveFileManager::openSavefile(char const* name, bool saveOrLoad) {
|
||||
char fileSpec[128];
|
||||
|
||||
strcpy(fileSpec, getSavePath());
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
#define SAVE_BUFFER_SIZE 100000
|
||||
|
||||
class GBAMPSaveFile : public Common::SaveFile {
|
||||
class GBAMPSaveFile : public InSaveFile, public OutSaveFile {
|
||||
FILE* handle;
|
||||
char buffer[SAVE_BUFFER_SIZE];
|
||||
int bufferPos;
|
||||
@ -64,7 +64,7 @@ public:
|
||||
|
||||
// static GBAMPSaveFileManager* instance() { return instancePtr; }
|
||||
|
||||
Common::SaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||
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); }
|
||||
@ -74,9 +74,6 @@ public:
|
||||
|
||||
void deleteFile(char* name);
|
||||
void listFiles();
|
||||
|
||||
protected:
|
||||
Common::SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
||||
};
|
||||
|
||||
|
||||
|
@ -346,7 +346,7 @@ void DSSaveFileManager::listFiles() {
|
||||
|
||||
DSSaveFileManager* DSSaveFileManager::instancePtr = NULL;
|
||||
|
||||
Common::SaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoad) {
|
||||
DSSaveFile *DSSaveFileManager::openSavefile(const char* filename, bool saveOrLoad) {
|
||||
for (int r = 0; r < 8; r++) {
|
||||
if (gbaSave[r].isValid() && (gbaSave[r].matches((char *) filename))) {
|
||||
// consolePrintf("Matched save %d (%d)\n", r, gbaSave[r].getSize());
|
||||
@ -398,7 +398,7 @@ void DSSaveFileManager::listSavefiles(const char *prefix, bool *marks, int num)
|
||||
|
||||
}
|
||||
|
||||
Common::SaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
||||
DSSaveFile *DSSaveFileManager::makeSaveFile(const char *filename, bool saveOrLoad) {
|
||||
|
||||
// Find a free save slot
|
||||
int r = 0;
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define DS_MAX_SAVE_SIZE 150000
|
||||
|
||||
class DSSaveFile : public Common::SaveFile {
|
||||
class DSSaveFile : public InSaveFile, public OutSaveFile {
|
||||
int address;
|
||||
int ptr;
|
||||
bool ownsData;
|
||||
@ -116,7 +116,7 @@ public:
|
||||
|
||||
static DSSaveFileManager* instance() { return instancePtr; }
|
||||
|
||||
Common::SaveFile *openSavefile(const char *filename, bool saveOrLoad);
|
||||
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); }
|
||||
@ -140,7 +140,7 @@ public:
|
||||
static void setExtraData(int data);
|
||||
|
||||
protected:
|
||||
Common::SaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
||||
DSSaveFile *makeSaveFile(const char *filename, bool saveOrLoad);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -56,11 +56,20 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Convenience intermediate class, to be removed.
|
||||
*/
|
||||
class SaveFile : public InSaveFile, public OutSaveFile {};
|
||||
|
||||
/**
|
||||
* The SaveFileManager is serving as a factor for InSaveFile
|
||||
* and OutSaveFile objects.
|
||||
*
|
||||
* Engines and other code should use SaveFiles whenever they need to
|
||||
* store data which they need to be able to retrieve later on --
|
||||
* i.e. typically save states, but also configuration files and similar
|
||||
* things.
|
||||
*
|
||||
* While not declared as a singleton,
|
||||
* it is effectively used as such, with OSystem::getSavefileManager
|
||||
* returning the single SaveFileManager instances to be used.
|
||||
*/
|
||||
class SaveFileManager {
|
||||
|
||||
public:
|
||||
|
Loading…
x
Reference in New Issue
Block a user