diff options
author | Joost Peters | 2005-03-03 21:42:20 +0000 |
---|---|---|
committer | Joost Peters | 2005-03-03 21:42:20 +0000 |
commit | 8825d26dbede26c92d29e105740061ed858acb2e (patch) | |
tree | fc496d3b4bf0f46d1707910247128167ea328dae | |
parent | ff1a0c1c4e62505faeed4f58764ab6a8c7972370 (diff) | |
download | scummvm-rg350-8825d26dbede26c92d29e105740061ed858acb2e.tar.gz scummvm-rg350-8825d26dbede26c92d29e105740061ed858acb2e.tar.bz2 scummvm-rg350-8825d26dbede26c92d29e105740061ed858acb2e.zip |
big endian fixes
svn-id: r16987
-rw-r--r-- | kyra/font.cpp | 26 | ||||
-rw-r--r-- | kyra/wsamovie.cpp | 10 |
2 files changed, 26 insertions, 10 deletions
diff --git a/kyra/font.cpp b/kyra/font.cpp index d6fa103659..48b2ee1ff2 100644 --- a/kyra/font.cpp +++ b/kyra/font.cpp @@ -41,8 +41,18 @@ Font::Font(uint8* buffer, uint32 size) { _buffer = buffer; Common::MemoryReadStream bufferstream(buffer, size); - - bufferstream.read(&_fontHeader, sizeof(_fontHeader)); + + _fontHeader._size = bufferstream.readUint16LE(); + _fontHeader._magic1 = bufferstream.readUint16LE(); + _fontHeader._magic2 = bufferstream.readUint16LE(); + _fontHeader._magic3 = bufferstream.readUint16LE(); + _fontHeader._charWidthOffset = bufferstream.readUint16LE(); + _fontHeader._charBitsOffset = bufferstream.readUint16LE(); + _fontHeader._charHeightOffset = bufferstream.readUint16LE(); + _fontHeader._version = bufferstream.readUint16LE(); + _fontHeader._countChars = bufferstream.readUint16LE(); + _fontHeader._width = bufferstream.readByte(); + _fontHeader._height = bufferstream.readByte(); // tests for the magic values if(_fontHeader._magic1 != FontHeader_Magic1 || _fontHeader._magic2 != FontHeader_Magic2 || @@ -236,14 +246,14 @@ void Font::preRenderAllChars(uint16 offsetTableOffset) { PreRenderedChar newChar; - newChar.c = new uint8[(_charHeight[currentChar] >> 8) * _charWidth[currentChar]]; - assert(newChar.c); - memset(newChar.c, 0, sizeof(uint8) * (_charHeight[currentChar] >> 8) * _charWidth[currentChar]); - newChar.height = (_charHeight[currentChar] >> 8); + newChar.height = READ_LE_UINT16(&_charHeight[currentChar]) >> 8; newChar.width = _charWidth[currentChar]; - newChar.heightadd = _charHeight[currentChar] & 0xFF; + newChar.heightadd = READ_LE_UINT16(&_charHeight[currentChar]) & 0xFF; + newChar.c = new uint8[newChar.height * newChar.width]; + assert(newChar.c); + memset(newChar.c, 0, sizeof(uint8) * newChar.height * newChar.width); - uint8* src = _buffer + _offsetTable[currentChar]; + uint8* src = _buffer + READ_LE_UINT16(&_offsetTable[currentChar]); uint8* dst = &newChar.c[0]; uint8 index = 0; diff --git a/kyra/wsamovie.cpp b/kyra/wsamovie.cpp index 767e8fa557..1b585ba79e 100644 --- a/kyra/wsamovie.cpp +++ b/kyra/wsamovie.cpp @@ -45,8 +45,14 @@ WSAMovieV1::WSAMovieV1(uint8* data, uint32 size, uint8 gameid) { // I like these Streams .... =) Common::MemoryReadStream datastream(data, size); - datastream.read(&_wsaHeader, sizeof(_wsaHeader)); - + _wsaHeader._numFrames = datastream.readUint16LE(); + _wsaHeader._width = datastream.readUint16LE(); + _wsaHeader._height = datastream.readUint16LE(); + _wsaHeader._xPos = datastream.readByte(); + _wsaHeader._yPos = datastream.readByte(); + _wsaHeader._delta = datastream.readUint16LE(); + _wsaHeader._type = datastream.readUint16LE(); + #ifdef DUMP_FILES // TODO: make Linux/BSD conform FILE* wsaheader = fopen("dumps/wsaheader.txt", "w+"); |