aboutsummaryrefslogtreecommitdiff
path: root/backends/platform
diff options
context:
space:
mode:
authorMax Lingua2009-07-12 21:58:00 +0000
committerMax Lingua2009-07-12 21:58:00 +0000
commita0c37549714a9f02351e85d3503ae129b0aae9b0 (patch)
tree81cc225a013cfb2ec2a5d29e3623b94e5e72d3f1 /backends/platform
parentbd91c1129d5b00a1cf76d02ffc31891b26829e16 (diff)
downloadscummvm-rg350-a0c37549714a9f02351e85d3503ae129b0aae9b0.tar.gz
scummvm-rg350-a0c37549714a9f02351e85d3503ae129b0aae9b0.tar.bz2
scummvm-rg350-a0c37549714a9f02351e85d3503ae129b0aae9b0.zip
Split _eof vs. _err.
Latter defaults to false for now, there are hooks for possible future implementation. svn-id: r42428
Diffstat (limited to 'backends/platform')
-rw-r--r--backends/platform/ps2/fileio.cpp23
-rw-r--r--backends/platform/ps2/fileio.h3
2 files changed, 19 insertions, 7 deletions
diff --git a/backends/platform/ps2/fileio.cpp b/backends/platform/ps2/fileio.cpp
index 8e5dc1255f..864f840e8a 100644
--- a/backends/platform/ps2/fileio.cpp
+++ b/backends/platform/ps2/fileio.cpp
@@ -58,6 +58,7 @@ Ps2File::Ps2File(void) {
_cacheSize = 0;
_cachePos = 0;
_eof = false;
+ _err = false;
// _cache = (uint8 *)malloc(PS2_CACHE_MAX);
@@ -224,10 +225,11 @@ bool Ps2File::eof(void) {
}
bool Ps2File::getErr(void) {
- return _eof;
+ return _err;
}
void Ps2File::setErr(bool err) {
+ _err = err;
_eof = err;
}
@@ -261,7 +263,9 @@ int Ps2File::seek(int32 offset, int origin) {
_eof = false;
res = 0;
}
- else _eof = true;
+ else {
+ _eof = true;
+ }
// printf("seek [%d] %d %d\n", _fd, offset, origin);
// printf(" res = %d\n", res);
@@ -350,10 +354,17 @@ uint32 Ps2File::read(void *dest, uint32 len) {
printf("read (1) : _cachePos = %d\n", _cachePos);
#endif
+ if (len == 0) {
+#ifdef __PS2_FILE_SEMA__
+ SignalSema(_sema);
+#endif
+ return 0;
+ }
+
if (_filePos >= _fileSize) {
_eof = true;
#ifdef __PS2_FILE_SEMA__
- SignalSema(_sema);
+ SignalSema(_sema);
#endif
return 0;
}
@@ -526,11 +537,11 @@ int ps2_fflush(FILE *stream) {
int ps2_ferror(FILE *stream) {
int err = ((Ps2File*)stream)->getErr();
- if (err)
+ if (err) {
printf("ferror -> %d\n", err);
+ }
- return 0; // kyra temp
- // return err;
+ return err;
}
void ps2_clearerr(FILE *stream) {
diff --git a/backends/platform/ps2/fileio.h b/backends/platform/ps2/fileio.h
index b481979388..6838162e06 100644
--- a/backends/platform/ps2/fileio.h
+++ b/backends/platform/ps2/fileio.h
@@ -70,7 +70,8 @@ private:
uint8 *_cache;
- int _eof;
+ bool _eof;
+ bool _err;
int _sema;