diff options
author | James Brown | 2002-04-29 08:28:27 +0000 |
---|---|---|
committer | James Brown | 2002-04-29 08:28:27 +0000 |
commit | 5f9bd8343c6362f844bcdb5b207bafde5db75bf3 (patch) | |
tree | 986723d40aa03ad5452b7c6308c904bde3492b9f /sys.cpp | |
parent | c134803976bcaccd9fe76da14b81962ebc531e81 (diff) | |
download | scummvm-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.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
@@ -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); |