Ticket #11710: dragons_big_endian_hack.diff

File dragons_big_endian_hack.diff, 4.3 KB (added by dwatteau, 4 years ago)
  • engines/dragons/actorresource.cpp

    diff --git a/engines/dragons/actorresource.cpp b/engines/dragons/actorresource.cpp
    index aac5875d26..9faedd6b6a 100644
    a b bool ActorResource::load(uint32 id, byte *dataStart, Common::SeekableReadStream  
    6767//              }
    6868//      }
    6969
     70#ifdef SCUMM_BIG_ENDIAN
     71        for (int i = 2; i < 0x100; i++) {
     72                uint c = READ_LE_INT16(&_palette[i * 2]);
     73                WRITE_BE_UINT16(&_palette[i * 2], c);
     74        }
     75#endif
     76
    7077        stream.seek(frameOffset);
    7178
    7279        _framesCount = (paletteOffset - stream.readUint16LE()) / 0xe;
  • engines/dragons/background.cpp

    diff --git a/engines/dragons/background.cpp b/engines/dragons/background.cpp
    index d1a4b12eab..bbeb9bd75d 100644
    a b bool Background::load(byte *dataStart, uint32 size) {  
    120120        _palette[0] = 0x00; //FIXME update palette
    121121        _palette[1] = 0x00;
    122122
     123#ifdef SCUMM_BIG_ENDIAN
     124        for (int i = 2; i < 0x100; i++) {
     125                uint c = READ_LE_INT16(&_palette[i * 2]);
     126                WRITE_BE_UINT16(&_palette[i * 2], c);
     127        }
     128#endif
     129
    123130        _scaleLayer.load(stream); // 0x200
    124131        _points2 = loadPoints(stream); // 0x280
    125132        stream.seek(0x305);
  • engines/dragons/bag.cpp

    diff --git a/engines/dragons/bag.cpp b/engines/dragons/bag.cpp
    index 73d625647f..5229990b7a 100644
    a b void Bag::load(BigfileArchive *bigFileArchive) {  
    7171                } else {
    7272                        //c = (uint16)(((uint)c & 0x1f) << 10) | (uint16)(((uint)c & 0x7c00) >> 10) | c & 0x3e0;
    7373                }
     74#ifdef SCUMM_BIG_ENDIAN
     75                WRITE_BE_UINT16(&pal[i * 2], c);
     76#else
    7477                WRITE_LE_UINT16(&pal[i * 2], c);
     78#endif
    7579        }
    7680
    7781        stream.seek(0x308);
  • engines/dragons/cutscene.cpp

    diff --git a/engines/dragons/cutscene.cpp b/engines/dragons/cutscene.cpp
    index e7bc00bb6a..58be9df4bb 100644
    a b void CutScene::loadPalettes() {  
    720720
    721721        _palettes = (byte *)malloc(256 * 2 * 4);
    722722        fd.read(_palettes, 256 * 2 * 4);
     723
     724#ifdef SCUMM_BIG_ENDIAN
     725        for (int paletteNum = 0; paletteNum < 4; paletteNum++) {
     726                for (int i = 0; i < 0x100; i++) {
     727                        uint c = READ_LE_INT16(&_palettes[paletteNum + i * 2]);
     728                        WRITE_BE_UINT16(&_palettes[paletteNum + i * 2], c);
     729                }
     730        }
     731#endif
    723732}
    724733
    725734void CutScene::flameReturnsCutScene() {
  • engines/dragons/font.cpp

    diff --git a/engines/dragons/font.cpp b/engines/dragons/font.cpp
    index a093ce462b..c656dc47c2 100644
    a b Font *FontManager::loadFont(uint16 index, Common::SeekableReadStream &stream) {  
    160160void updatePalEntry(uint16 *pal, uint16 index, uint16 newValue) {
    161161        newValue = (uint16)(((uint16)newValue & 0x1f) << 10) | (uint16)(((uint16)newValue & 0x7c00) >> 10) |
    162162                        (newValue & 0x3e0) | (newValue & 0x8000);
    163         WRITE_LE_INT16(pal + index, newValue);
     163        pal[index] = newValue; // XXX: really?
    164164}
    165165
    166166void FontManager::updatePalette() {
  • engines/dragons/screen.cpp

    diff --git a/engines/dragons/screen.cpp b/engines/dragons/screen.cpp
    index cca0a97ff5..f503bc6ec4 100644
    a b void Screen::copyRectToSurface(const void *buffer, int srcPitch, int srcWidth, i  
    157157                for (int j = 0; j < width; j++) {
    158158                        int32 srcIdx = flipX ? srcWidth - (srcXOffset * 2) - j - 1 : j;
    159159                        if (src[srcIdx * 2] != 0 || src[srcIdx * 2 + 1] != 0) {
    160                                 if ((src[srcIdx * 2 + 1] & 0x80) == 0 || alpha == NONE) {
     160                                if (1 || (src[srcIdx * 2 + 1] & 0x80) == 0 || alpha == NONE) {
    161161                                        // only copy opaque pixels
    162162                                        dst[j * 2] = src[srcIdx * 2];
    163163                                        dst[j * 2 + 1] = src[srcIdx * 2 + 1];
    void Screen::copyRectToSurface8bpp(const void *buffer, const byte* palette, int  
    188188                        int32 srcIdx = flipX ? srcWidth - (srcXOffset * 2) - j - 1 : j;
    189189                        uint16 c = READ_LE_UINT16(&palette[src[srcIdx] * 2]);
    190190                        if (c != 0) {
    191                                 if (!(c & 0x8000) || alpha == NONE) {
     191                                if (1 || !(c & 0x8000) || alpha == NONE) {
    192192                                        // only copy opaque pixels
    193193                                        WRITE_LE_UINT16(&dst[j * 2], c & ~0x8000);
    194194                                } else {
    void Screen::drawScaledSprite(Graphics::Surface *destSurface, const byte *source  
    245245                                byte colorIndex = *wsrc;
    246246                                uint16 c = READ_LE_UINT16(&palette[colorIndex * 2]);
    247247                                if (c != 0) {
    248                                         if (!(c & 0x8000u) || alpha == NONE) {
     248                                        if (1 || !(c & 0x8000u) || alpha == NONE) {
    249249                                                // only copy opaque pixels
    250250                                                WRITE_LE_UINT16(wdst, c & ~0x8000);
    251251                                        } else {