Ticket #8493: lure-update2.patch

File lure-update2.patch, 8.4 KB (added by sev-, 18 years ago)

Update 2 to the module

  • anim.h

    diff -r -u -N lure.orig/anim.h lure/anim.h
    old new  
    88
    99namespace Lure {
    1010
    11 #pragma pack(1)
     11#pragma START_PACK_STRUCTS
    1212
    1313struct AnimationResource {
    1414        uint16 diskId;
     
    2727        uint32 unknown4;
    2828        uint16 unknown5;
    2929        uint8 colourOffset;
    30 };
     30} GCC_PACK;
    3131
    32 #pragma pack()
     32#pragma END_PACK_STRUCTS
    3333
    3434class Animation {
    3535private:
  • decode.cpp

    diff -r -u -N lure.orig/decode.cpp lure/decode.cpp
    old new  
    144144        carry = result;
    145145}
    146146
    147 #define GET_BYTE ax.l = *pSrc++
     147#define GET_BYTE ax.s.l = *pSrc++
    148148#define BX_VAL(x) *((byte *) (dest->data() + bx.v + x))
    149149
    150150void AnimationDecoder::decode_data_2(byte *&pSrc, Register &ax, Register &cx,
    151151                                                                         Register &dx, bool &carry) {
    152         dx.h = ax.h;
     152        dx.s.h = ax.s.h;
    153153       
    154154        for (int v = 0; v < 8; ++v) {
    155155                rcl(ax, carry);
    156156                if (--cx.v == 0) {
    157157                        GET_BYTE;
    158                         cx.l = 8;
     158                        cx.s.l = 8;
    159159                }
    160160        }
    161161}
     
    172172        for (int numBytes = 0; numBytes < 16; ++numBytes, ++pDest) {
    173173                // Split up next byte to pDest and pDest+0x10
    174174                GET_BYTE;
    175                 *(pDest + 0x10) = ax.l & 0xf;
    176                 *pDest = ax.l >> 4;
     175                *(pDest + 0x10) = ax.s.l & 0xf;
     176                *pDest = ax.s.l >> 4;
    177177
    178178                // Split up next byte to pDest+0x20 and pDest+0x30
    179179                GET_BYTE;
    180                 *(pDest + 0x30) = ax.l & 0x0f;
    181                 *(pDest + 0x20) = ax.l >> 4;
     180                *(pDest + 0x30) = ax.s.l & 0x0f;
     181                *(pDest + 0x20) = ax.s.l >> 4;
    182182        }       
    183183
    184184        pDest = (byte *) (dest->data() + 0x40);
    185185        GET_BYTE;
    186         ax.h = ax.l;
     186        ax.s.h = ax.s.l;
    187187        GET_BYTE;
    188188        cx.v = 4;
    189         *pDest = ax.h & 0xf0;
    190         bx.v = ax.h >> 4;
     189        *pDest = ax.s.h & 0xf0;
     190        bx.v = ax.s.h >> 4;
    191191        ax.v <<= 4;
    192192        dx.v = 1;
    193193
     
    203203                rcl(ax, carry);
    204204                if (--cx.v == 0) {
    205205                        GET_BYTE;
    206                         cx.l = 8;
     206                        cx.s.l = 8;
    207207                }
    208208                if (carry) goto loc_1441;
    209                 bx.l = BX_VAL(0);
     209                bx.s.l = BX_VAL(0);
    210210
    211211loc_1439:
    212                 dx.l ^= 1;
    213                 if ((dx.l & 1) != 0) {
    214                         dx.h = bx.l << 4;
    215                         *pDest = dx.h;
     212                dx.s.l ^= 1;
     213                if ((dx.s.l & 1) != 0) {
     214                        dx.s.h = bx.s.l << 4;
     215                        *pDest = dx.s.h;
    216216                } else {
    217                         *pDest++ |= bx.l;
     217                        *pDest++ |= bx.s.l;
    218218                }
    219219                continue;
    220220
     
    222222                rcl(ax, carry);
    223223                if (--cx.v == 0) {
    224224                        GET_BYTE;
    225                         cx.l = 8;
     225                        cx.s.l = 8;
    226226                }
    227227                if (!carry) {
    228228                        rcl(ax, carry);
    229229                        if (--cx.v == 0) {
    230230                                GET_BYTE;
    231                                 cx.l = 8;
     231                                cx.s.l = 8;
    232232                        }
    233233
    234234                        if (!carry) {
    235                                 bx.l = BX_VAL(0x10);
     235                                bx.s.l = BX_VAL(0x10);
    236236                        } else {
    237                                 bx.l = BX_VAL(0x20);
     237                                bx.s.l = BX_VAL(0x20);
    238238                        }
    239239                        goto loc_1439;
    240240                }
     
    243243                rcl(ax, carry);
    244244                if (--cx.v == 0) {
    245245                        GET_BYTE;
    246                         cx.l = 8;
     246                        cx.s.l = 8;
    247247                }
    248248                if (!carry) {
    249                         bx.l = BX_VAL(0x30);
     249                        bx.s.l = BX_VAL(0x30);
    250250                        goto loc_1439;
    251251                }
    252252
    253                 dx.h = ax.h >> 4;
     253                dx.s.h = ax.s.h >> 4;
    254254                for (int ctr = 0; ctr < 4; ++ctr) {
    255255                        rcl(ax, carry);
    256256                        if (--cx.v == 0) {
    257257                                GET_BYTE;
    258                                 cx.l = 8;
     258                                cx.s.l = 8;
    259259                        }
    260260                }
    261261
    262                 if (dx.h == BX_VAL(0)) {
     262                if (dx.s.h == BX_VAL(0)) {
    263263                        tempReg1 = cx;
    264264                        tempReg2 = dx;
    265265                        decode_data_2(pSrc, ax, cx, dx, carry);
    266266               
    267                         dx.l = dx.h;
     267                        dx.s.l = dx.s.h;
    268268                        decode_data_2(pSrc, ax, cx, dx, carry);
    269                         cx.h = dx.l;
    270                         cx.l = dx.h;
     269                        cx.s.h = dx.s.l;
     270                        cx.s.l = dx.s.h;
    271271                        dx = tempReg2;
    272272
    273273                        if (cx.v == 0)
    274274                                // Exit out of infinite loop
    275275                                break;
    276276
    277                 } else if (dx.h == BX_VAL(0x10)) {
     277                } else if (dx.s.h == BX_VAL(0x10)) {
    278278                        tempReg1 = cx;
    279279                        decode_data_2(pSrc, ax, cx, dx, carry);
    280                         cx.v = dx.h;
     280                        cx.v = dx.s.h;
    281281
    282                 } else if (dx.h == BX_VAL(0x20)) {
    283                         dx.h = ax.h >> 2;
     282                } else if (dx.s.h == BX_VAL(0x20)) {
     283                        dx.s.h = ax.s.h >> 2;
    284284
    285285                        for (v = 0; v < 6; ++v) {
    286286                                rcl(ax, carry);
    287287                                if (--cx.v == 0) {
    288288                                        GET_BYTE;
    289                                         cx.l = 8;
     289                                        cx.s.l = 8;
    290290                                }
    291291                        }
    292292
    293293                        tempReg1 = cx;
    294                         cx.v = dx.h;
     294                        cx.v = dx.s.h;
    295295               
    296                 } else if (dx.h == BX_VAL(0x30)) {
    297                         dx.h = ax.h >> 3;
     296                } else if (dx.s.h == BX_VAL(0x30)) {
     297                        dx.s.h = ax.s.h >> 3;
    298298
    299299                        for (v = 0; v < 5; ++v) {
    300300                                rcl(ax, carry);
    301301                                if (--cx.v == 0) {
    302302                                        GET_BYTE;
    303                                         cx.l = 8;
     303                                        cx.s.l = 8;
    304304                                }
    305305                        }
    306306
    307307                        tempReg1 = cx;
    308                         cx.v = dx.h;
     308                        cx.v = dx.s.h;
    309309
    310310                } else {
    311                         bx.l = dx.h;
     311                        bx.s.l = dx.s.h;
    312312                        goto loc_1439;
    313313                }
    314314
    315                 if ((dx.l & 1) == 1) {
    316                         *pDest++ |= bx.l;
     315                if ((dx.s.l & 1) == 1) {
     316                        *pDest++ |= bx.s.l;
    317317                        --cx.v;
    318                         dx.l &= 0xfe;
     318                        dx.s.l &= 0xfe;
    319319                }
    320320
    321                 dx.h = bx.l << 4;
    322                 bx.l |= dx.h;
     321                dx.s.h = bx.s.l << 4;
     322                bx.s.l |= dx.s.h;
    323323
    324324                v = cx.v >> 1;
    325                 while (v-- > 0) *pDest++ = bx.l;
     325                while (v-- > 0) *pDest++ = bx.s.l;
    326326
    327327                cx.v &= 1;
    328328                if (cx.v != 0) {
    329                         *pDest = bx.l & 0xf0;
    330                         dx.l |= 1;
     329                        *pDest = bx.s.l & 0xf0;
     330                        dx.s.l |= 1;
    331331                }
    332332
    333333                cx = tempReg1;
    334                 bx.l &= 0x0f;
     334                bx.s.l &= 0x0f;
    335335        }
    336336
    337337        // Return number of bytes written
  • decode.h

    diff -r -u -N lure.orig/decode.h lure/decode.h
    old new  
    88
    99namespace Lure {
    1010
    11 #pragma pack(1)
     11#pragma START_PACK_STRUCTS
    1212
    1313union Register_Union {
    1414        union {
     
    1616                struct {
    1717                        uint8 l;
    1818                        uint8 h;
    19                 };
     19                } GCC_PACK s;
    2020        };
    21 };
     21} GCC_PACK;
    2222
    23 #pragma pack()
     23#pragma END_PACK_STRUCTS
    2424
    2525typedef union Register_Union Register;
    2626
  • disk.h

    diff -r -u -N lure.orig/disk.h lure/disk.h
    old new  
    1717#define HEADER_IDENT_STRING "heywow"
    1818#define HEADER_ENTRY_UNUSED_ID 0xffff
    1919
    20 #pragma pack(1)
     20#pragma START_PACK_STRUCTS
    2121
    2222struct FileEntry {
    2323        uint16 id;
     
    2525        byte sizeExtension;
    2626        uint16 size;
    2727        uint16 offset;
    28 };
     28} GCC_PACK;
    2929
    30 #pragma pack()
     30#pragma END_PACK_STRUCTS
    3131
    3232class Disk {
    3333private:
  • game.cpp

    diff -r -u -N lure.orig/game.cpp lure/game.cpp
    old new  
    5151
    5252                if (events.pollEvent()) {
    5353                        if (events.type() == OSystem::EVENT_KEYDOWN) {
    54                                 Room &r = Room::getReference();
    5554                                uint8 roomNum = r.roomNumber();
    5655
    5756#ifdef LURE_DEBUG
  • lure.cpp

    diff -r -u -N lure.orig/lure.cpp lure/lure.cpp
    old new  
    2828        kMD5FileSizeLimit = 1024 * 1024
    2929};
    3030
    31 #pragma pack(1)
     31#pragma START_PACK_STRUCTS
    3232
    3333struct VersionStructure {
    3434        uint16 id;
    3535        byte vMajor;
    3636        byte vMinor;
    37 };
     37} GCC_PACK;
    3838
    39 #pragma pack()
     39#pragma END_PACK_STRUCTS
    4040
    4141struct LureGameSettings {
    4242        const char *name;
     
    236236        _system->endGFXTransaction();
    237237
    238238        // for now we prefer MIDI-to-Adlib conversion over native midi
    239         int midiDrv = MidiDriver::detectMusicDriver(MDT_NATIVE | MDT_ADLIB/* | MDT_PREFER_NATIVE*/);
     239        int midiDrv = MidiDriver::detectMusicDriver(MDT_MIDI | MDT_ADLIB/* | MDT_PREFER_MIDI*/);
    240240        bool native_mt32 = (ConfMan.getBool("native_mt32") || (midiDrv == MD_MT32));
    241241
    242242        MidiDriver *driver = MidiDriver::createMidi(midiDrv);
  • module.mk

    diff -r -u -N lure.orig/module.mk lure/module.mk
    old new  
     1MODULE := lure
     2
     3MODULE_OBJS := \
     4        lure/anim.o \
     5        lure/animseq.o \
     6        lure/decode.o \
     7        lure/disk.o \
     8        lure/events.o \
     9        lure/game.o \
     10        lure/intro.o \
     11        lure/lure.o \
     12        lure/memory.o \
     13        lure/menu.o \
     14        lure/palette.o \
     15        lure/res.o \
     16        lure/room.o \
     17        lure/screen.o \
     18        lure/strings.o \
     19        lure/surface.o \
     20        lure/system.o \
     21        lure/debug/input.o
     22
     23MODULE_DIRS += \
     24        lure
     25
     26# This module can be built as a plugin
     27ifdef BUILD_PLUGINS
     28PLUGIN := 1
     29endif
     30
     31# Include common rules
     32include $(srcdir)/common.rules
  • room.cpp

    diff -r -u -N lure.orig/room.cpp lure/room.cpp
    old new  
    276276                        while ((res->hotspotId != 0xffff) && (res->hotspotId != rec->hotspotId))
    277277                                ++res;
    278278
    279                         itoa(rec->hotspotId, s, 16);
     279                        sprintf(s, "%x", rec->hotspotId);
    280280                        s += strlen(s);
    281281
    282282                        if (res->hotspotId == 0xffff)
     
    306306        delete surface;
    307307}
    308308
    309 } // end of namespace Lure
    310  No newline at end of file
     309} // end of namespace Lure
  • surface.cpp

    diff -r -u -N lure.orig/surface.cpp lure/surface.cpp
    old new  
    117117
    118118        byte *pSrc = _data->data();
    119119        byte *pDest = dest->data().data();
    120         uint16 numBytes = min(_height,dest->height()) * FULL_SCREEN_WIDTH;
     120        uint16 numBytes = MIN(_height,dest->height()) * FULL_SCREEN_WIDTH;
    121121
    122122        while (numBytes-- > 0) {
    123123                if (*pSrc) *pDest = *pSrc;