aboutsummaryrefslogtreecommitdiff
path: root/sys.cpp
diff options
context:
space:
mode:
authorJames Brown2002-04-29 08:28:27 +0000
committerJames Brown2002-04-29 08:28:27 +0000
commit5f9bd8343c6362f844bcdb5b207bafde5db75bf3 (patch)
tree986723d40aa03ad5452b7c6308c904bde3492b9f /sys.cpp
parentc134803976bcaccd9fe76da14b81962ebc531e81 (diff)
downloadscummvm-rg350-5f9bd8343c6362f844bcdb5b207bafde5db75bf3.tar.gz
scummvm-rg350-5f9bd8343c6362f844bcdb5b207bafde5db75bf3.tar.bz2
scummvm-rg350-5f9bd8343c6362f844bcdb5b207bafde5db75bf3.zip
Small inSANE patch for the dig, and start of Dig Audio support.
It seems to crash using AUTOFREE for some reason. Can someone Valgrind/Purify this for me? svn-id: r4129
Diffstat (limited to 'sys.cpp')
-rw-r--r--sys.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys.cpp b/sys.cpp
index 5c5d23e431..7ac1db91d6 100644
--- a/sys.cpp
+++ b/sys.cpp
@@ -161,6 +161,46 @@ uint32 Scumm::fileReadDwordBE()
return (b << 16) | a;
}
+/* Overloaded versions */
+int Scumm::fileReadByte(void *handle)
+{
+ byte b;
+
+ if (fread(&b, 1, 1, (FILE *) handle) != 1) {
+ clearerr((FILE *) handle);
+ _fileReadFailed = true;
+ }
+ return b ^ _encbyte;
+}
+
+uint Scumm::fileReadWordLE(void *handle)
+{
+ uint a = fileReadByte(handle);
+ uint b = fileReadByte(handle);
+ return a | (b << 8);
+}
+
+uint32 Scumm::fileReadDwordLE(void *handle)
+{
+ uint a = fileReadWordLE(handle);
+ uint b = fileReadWordLE(handle);
+ return (b << 16) | a;
+}
+
+uint Scumm::fileReadWordBE(void *handle)
+{
+ uint b = fileReadByte(handle);
+ uint a = fileReadByte(handle);
+ return a | (b << 8);
+}
+
+uint32 Scumm::fileReadDwordBE(void *handle)
+{
+ uint b = fileReadWordBE(handle);
+ uint a = fileReadWordBE(handle);
+ return (b << 16) | a;
+}
+
byte *Scumm::alloc(int size)
{
byte *me = (byte *)::calloc(size + 4, 1);