aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMax Horn2008-09-13 16:51:46 +0000
committerMax Horn2008-09-13 16:51:46 +0000
commit655ce26b3f09628d9408a4d82efe3a26116999fe (patch)
tree779a25dbe25c8f916fb385b3dd2d48e0e379d9ec /backends/platform
parentb86a047164b54c20366fcbe21b55bf63f2ced5f4 (diff)
downloadscummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.tar.gz
scummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.tar.bz2
scummvm-rg350-655ce26b3f09628d9408a4d82efe3a26116999fe.zip
Big patch changing the signature of various Stream methods (some ports may need to be slightly tweaked to fix overloading errors/warnings)
svn-id: r34514
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/dc/vmsave.cpp14
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.cpp10
-rw-r--r--backends/platform/ds/arm9/source/gbampsave.h8
-rw-r--r--backends/platform/ds/arm9/source/ramsave.cpp10
-rw-r--r--backends/platform/ds/arm9/source/ramsave.h8
-rw-r--r--backends/platform/ps2/savefile.cpp23
-rw-r--r--backends/platform/ps2/savefile.h20
7 files changed, 50 insertions, 43 deletions
diff --git a/backends/platform/dc/vmsave.cpp b/backends/platform/dc/vmsave.cpp
index 6ab8fc4558..5fe532e1f1 100644
--- a/backends/platform/dc/vmsave.cpp
+++ b/backends/platform/dc/vmsave.cpp
@@ -271,8 +271,8 @@ private:
int _pos, _size;
uint32 read(void *buf, uint32 cnt);
- void skip(uint32 offset);
- void seek(int32 offs, int whence);
+ bool skip(uint32 offset);
+ bool seek(int32 offs, int whence);
public:
InVMSave()
@@ -286,8 +286,8 @@ public:
}
bool eos() const { return _pos >= _size; }
- uint32 pos() const { return _pos; }
- uint32 size() const { return _size; }
+ int32 pos() const { return _pos; }
+ int32 size() const { return _size; }
bool readSaveGame(const char *filename)
{ return ::readSaveGame(buffer, _size, filename); }
@@ -378,15 +378,16 @@ uint32 InVMSave::read(void *buf, uint32 cnt)
return cnt;
}
-void InVMSave::skip(uint32 offset)
+bool InVMSave::skip(uint32 offset)
{
int nbyt = offset;
if (_pos + nbyt > _size)
nbyt = (_size - _pos);
_pos += nbyt;
+ return true;
}
-void InVMSave::seek(int32 offs, int whence)
+bool InVMSave::seek(int32 offs, int whence)
{
switch(whence) {
case SEEK_SET:
@@ -403,6 +404,7 @@ void InVMSave::seek(int32 offs, int whence)
_pos = 0;
else if (_pos > _size)
_pos = _size;
+ return true;
}
uint32 OutVMSave::write(const void *buf, uint32 cnt)
diff --git a/backends/platform/ds/arm9/source/gbampsave.cpp b/backends/platform/ds/arm9/source/gbampsave.cpp
index 9c8af81a6e..8209b783fa 100644
--- a/backends/platform/ds/arm9/source/gbampsave.cpp
+++ b/backends/platform/ds/arm9/source/gbampsave.cpp
@@ -54,8 +54,8 @@ bool GBAMPSaveFile::eos() const {
return DS::std_feof(handle);
}
-void GBAMPSaveFile::skip(uint32 bytes) {
- DS::std_fseek(handle, bytes, SEEK_CUR);
+bool GBAMPSaveFile::skip(uint32 bytes) {
+ return DS::std_fseek(handle, bytes, SEEK_CUR) == 0;
}
void GBAMPSaveFile::flushSaveBuffer() {
@@ -67,11 +67,11 @@ void GBAMPSaveFile::flushSaveBuffer() {
}
}
-uint32 GBAMPSaveFile::pos() const {
+int32 GBAMPSaveFile::pos() const {
return DS::std_ftell(handle);
}
-uint32 GBAMPSaveFile::size() const {
+int32 GBAMPSaveFile::size() const {
int position = pos();
DS::std_fseek(handle, 0, SEEK_END);
int size = DS::std_ftell(handle);
@@ -80,7 +80,7 @@ uint32 GBAMPSaveFile::size() const {
}
void GBAMPSaveFile::seek(int32 pos, int whence) {
- DS::std_fseek(handle, pos, whence);
+ return DS::std_fseek(handle, pos, whence) == 0;
}
diff --git a/backends/platform/ds/arm9/source/gbampsave.h b/backends/platform/ds/arm9/source/gbampsave.h
index d0cbc68bfd..6ddc4fd964 100644
--- a/backends/platform/ds/arm9/source/gbampsave.h
+++ b/backends/platform/ds/arm9/source/gbampsave.h
@@ -43,11 +43,11 @@ public:
virtual uint32 write(const void *buf, uint32 size);
virtual bool eos() const;
- virtual void skip(uint32 bytes);
+ virtual bool skip(uint32 bytes);
- virtual uint32 pos() const;
- virtual uint32 size() const;
- virtual void seek(int32 pos, int whence);
+ virtual int32 pos() const;
+ virtual int32 size() const;
+ virtual bool seek(int32 pos, int whence);
void flushSaveBuffer();
diff --git a/backends/platform/ds/arm9/source/ramsave.cpp b/backends/platform/ds/arm9/source/ramsave.cpp
index be355ce76f..8442fd6b88 100644
--- a/backends/platform/ds/arm9/source/ramsave.cpp
+++ b/backends/platform/ds/arm9/source/ramsave.cpp
@@ -181,15 +181,15 @@ uint32 DSSaveFile::read(void *buf, uint32 size) {
return size;
}
-uint32 DSSaveFile::pos() const {
+int32 DSSaveFile::pos() const {
return ptr;
}
-uint32 DSSaveFile::size() const {
+int32 DSSaveFile::size() const {
return save.size;
}
-void DSSaveFile::seek(int32 pos, int whence) {
+bool DSSaveFile::seek(int32 pos, int whence) {
switch (whence) {
case SEEK_SET: {
ptr = pos;
@@ -204,15 +204,17 @@ void DSSaveFile::seek(int32 pos, int whence) {
break;
}
}
+ return true;
}
bool DSSaveFile::eos() const {
return ptr >= (int) save.size;
}
-void DSSaveFile::skip(uint32 bytes) {
+bool DSSaveFile::skip(uint32 bytes) {
ptr = ptr + bytes;
if (ptr > (int) save.size) ptr = save.size;
+ return true;
}
uint32 DSSaveFile::write(const void *buf, uint32 size) {
diff --git a/backends/platform/ds/arm9/source/ramsave.h b/backends/platform/ds/arm9/source/ramsave.h
index f919da18db..e276775b66 100644
--- a/backends/platform/ds/arm9/source/ramsave.h
+++ b/backends/platform/ds/arm9/source/ramsave.h
@@ -62,11 +62,11 @@ public:
bool isOpen() const { return isOpenFlag; }
virtual bool eos() const;
- virtual void skip(uint32 size);
+ virtual bool skip(uint32 size);
- virtual uint32 pos() const;
- virtual uint32 size() const;
- virtual void seek(int32 pos, int whence);
+ virtual int32 pos() const;
+ virtual int32 size() const;
+ virtual bool seek(int32 pos, int whence);
uint32 read(void *buf, uint32 size);
uint32 write(const void *buf, uint32 size);
diff --git a/backends/platform/ps2/savefile.cpp b/backends/platform/ps2/savefile.cpp
index 5ee724cd3f..7d45aabda7 100644
--- a/backends/platform/ps2/savefile.cpp
+++ b/backends/platform/ps2/savefile.cpp
@@ -112,24 +112,26 @@ bool UclInSaveFile::eos(void) const {
return bufTell() == bufSize();
}
-uint32 UclInSaveFile::pos(void) const {
+int32 UclInSaveFile::pos(void) const {
return bufTell();
}
-uint32 UclInSaveFile::size(void) const {
+int32 UclInSaveFile::size(void) const {
return bufSize();
}
-void UclInSaveFile::seek(int pos, int whence) {
+bool UclInSaveFile::seek(int pos, int whence) {
bufSeek(pos, whence);
+ return true;
}
uint32 UclInSaveFile::read(void *ptr, uint32 size) {
return (uint32)bufRead(ptr, (int)size);
}
-void UclInSaveFile::skip(uint32 offset) {
+bool UclInSaveFile::skip(uint32 offset) {
bufSeek(offset, SEEK_CUR);
+ return true;s
}
UclOutSaveFile::UclOutSaveFile(const char *filename, OSystem_PS2 *system, Gs2dScreen *screen, McAccess *mc) : RawWriteFile(mc) {
@@ -168,12 +170,12 @@ void UclOutSaveFile::clearIOFailed(void) {
_ioFailed = false;
}
-void UclOutSaveFile::flush(void) {
+bool UclOutSaveFile::flush(void) {
if (_pos != 0) {
if (_wasFlushed) {
printf("Multiple calls to UclOutSaveFile::flush!\n");
_ioFailed = true;
- return;
+ return false;
}
uint32 compSize = _pos * 2;
uint8 *compBuf = (uint8*)memalign(64, compSize + 8);
@@ -193,6 +195,7 @@ void UclOutSaveFile::flush(void) {
}
_wasFlushed = true;
}
+ return true;
}
/* ----------------------------------------- Glue Classes for POSIX Memory Card Access ----------------------------------------- */
@@ -216,11 +219,11 @@ uint32 Ps2McReadFile::write(const void *src, uint32 len) {
return 0;
}
-uint32 Ps2McReadFile::tell(void) {
+int32 Ps2McReadFile::tell(void) {
return bufTell();
}
-uint32 Ps2McReadFile::size(void) {
+int32 Ps2McReadFile::size(void) {
return bufSize();
}
@@ -253,11 +256,11 @@ uint32 Ps2McWriteFile::write(const void *src, uint32 len) {
return len;
}
-uint32 Ps2McWriteFile::tell(void) {
+int32 Ps2McWriteFile::tell(void) {
return bufTell();
}
-uint32 Ps2McWriteFile::size(void) {
+int32 Ps2McWriteFile::size(void) {
return bufTell();
}
diff --git a/backends/platform/ps2/savefile.h b/backends/platform/ps2/savefile.h
index 4832b8c3fe..fd09c823d0 100644
--- a/backends/platform/ps2/savefile.h
+++ b/backends/platform/ps2/savefile.h
@@ -41,7 +41,7 @@ public:
UclOutSaveFile(const char *filename, OSystem_PS2 *system, Gs2dScreen *screen, McAccess *mc);
virtual ~UclOutSaveFile(void);
virtual uint32 write(const void *ptr, uint32 size);
- virtual void flush(void);
+ virtual bool flush(void);
virtual bool ioFailed(void) const;
virtual void clearIOFailed(void);
private:
@@ -60,11 +60,11 @@ public:
virtual uint32 read(void *ptr, uint32 size);
virtual bool ioFailed(void) const;
virtual void clearIOFailed(void);
- virtual void skip(uint32 offset);
+ virtual bool skip(uint32 offset);
- virtual uint32 pos(void) const;
- virtual uint32 size(void) const;
- virtual void seek(int pos, int whence = SEEK_SET);
+ virtual int32 pos(void) const;
+ virtual int32 size(void) const;
+ virtual bool seek(int pos, int whence = SEEK_SET);
private:
Gs2dScreen *_screen;
bool _ioFailed;
@@ -75,7 +75,7 @@ public:
AutoSaveFile(Ps2SaveFileManager *saveMan, const char *filename);
~AutoSaveFile(void);
virtual uint32 write(const void *ptr, uint32 size);
- virtual void flush(void) {}
+ virtual bool flush(void) {}
virtual bool ioFailed(void) { return false; };
virtual void clearIOFailed(void) {}
private:
@@ -95,8 +95,8 @@ public:
virtual bool open(const char *name);
virtual uint32 read(void *dest, uint32 len);
virtual uint32 write(const void *src, uint32 len);
- virtual uint32 tell(void);
- virtual uint32 size(void);
+ virtual int32 tell(void);
+ virtual int32 size(void);
virtual int seek(int32 offset, int origin);
virtual bool eof(void);
};
@@ -108,8 +108,8 @@ public:
virtual bool open(const char *name);
virtual uint32 read(void *dest, uint32 len);
virtual uint32 write(const void *src, uint32 len);
- virtual uint32 tell(void);
- virtual uint32 size(void);
+ virtual int32 tell(void);
+ virtual int32 size(void);
virtual int seek(int32 offset, int origin);
virtual bool eof(void);
};