[Scummvm-cvs-logs] CVS: scummvm/common savefile.h,NONE,1.1 scummsys.h,1.14,1.15 system.h,1.11,1.12
Marcus Comstedt
marcus_c at users.sourceforge.net
Mon Dec 16 17:16:06 CET 2002
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/gp32 gp32.cpp,1.3,1.4 gp32.h,1.3,1.4
- Next message: [Scummvm-cvs-logs] CVS: scummvm/backends/dc Makefile,1.5,1.6 dc.h,1.5,1.6 vmsave.cpp,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv32726/common
Modified Files:
scummsys.h system.h
Added Files:
savefile.h
Log Message:
New savefile backend system (bye bye NONSTANDARD_SAVE...)
--- NEW FILE: savefile.h ---
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001/2002 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header: /cvsroot/scummvm/scummvm/common/savefile.h,v 1.1 2002/12/17 01:15:13 marcus_c Exp $
*
*/
#ifndef COMMON_SAVEFILE_H
#define COMMON_SAVEFILE_H
#include <stdio.h>
class SaveFile {
public:
virtual ~SaveFile() {}
virtual int fread(void *buf, int size, int cnt) = 0;
virtual int fwrite(void *buf, int size, int cnt) = 0;
#ifdef _WIN32_WCE
//Should go away. See scumm/saveload.cpp and scumm/imuse.cpp
virtual int fseek(long offs, int whence) = 0;
virtual int feof() = 0;
#endif
};
class StdioSaveFile : public SaveFile {
private:
FILE *fh;
public:
StdioSaveFile(const char *filename, const char *mode)
{ fh = ::fopen(filename, mode); }
~StdioSaveFile()
{ if(fh) ::fclose(fh); }
bool is_open() { return fh != NULL; }
int fread(void *buf, int size, int cnt)
{ return ::fread(buf, size, cnt, fh); }
int fwrite(void *buf, int size, int cnt)
{ return ::fwrite(buf, size, cnt, fh); }
#ifdef _WIN32_WCE
int fseek(long offs, int whence)
{ return ::fseek(fh, offs, whence); }
int feof()
{ return ::feof(fh); }
#endif
};
class SaveFileManager {
public:
virtual ~SaveFileManager() {}
virtual SaveFile *open_savefile(const char *filename,
bool saveOrLoad)
{
StdioSaveFile *sf = new StdioSaveFile(filename,
(saveOrLoad? "wb":"rb"));
if(!sf->is_open()) {
delete sf;
sf = NULL;
}
return sf;
}
virtual void list_savefiles(const char *prefix,
bool *marks, int num)
{
memset(marks, true, num*sizeof(bool));
}
};
#endif
Index: scummsys.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/scummsys.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- scummsys.h 1 Dec 2002 20:29:20 -0000 1.14
+++ scummsys.h 17 Dec 2002 01:15:13 -0000 1.15
@@ -240,7 +240,6 @@
#define CDECL
#define SCUMM_NEED_ALIGNMENT
#define SCUMM_LITTLE_ENDIAN
- #define NONSTANDARD_SAVE
#define scumm_stricmp stricmp
#define CHECK_HEAP
Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/system.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- system.h 13 Dec 2002 16:15:48 -0000 1.11
+++ system.h 17 Dec 2002 01:15:13 -0000 1.12
@@ -24,6 +24,7 @@
#define COMMON_SYSTEM_H
#include "scummsys.h"
+#include "savefile.h"
class Timer;
@@ -179,6 +180,12 @@
r = (((color>>11)&0x1F) << 3);
g = (((color>>5)&0x3F) << 2);
b = ((color&0x1F) << 3);
+ }
+
+ // Savefile management
+ virtual SaveFileManager *get_savefile_manager()
+ {
+ return new SaveFileManager();
}
};
- Previous message: [Scummvm-cvs-logs] CVS: scummvm/backends/gp32 gp32.cpp,1.3,1.4 gp32.h,1.3,1.4
- Next message: [Scummvm-cvs-logs] CVS: scummvm/backends/dc Makefile,1.5,1.6 dc.h,1.5,1.6 vmsave.cpp,1.5,1.6
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Scummvm-git-logs
mailing list