Ticket #8783: createKyradat_NEW.patch

File createKyradat_NEW.patch, 6.5 KB (added by athrxx, 16 years ago)
  • create_kyradat.cpp

     
    199199        // Sequence Player
    200200        { k2SeqplayPakFiles, kTypeStringList, "S_PAKFILES.TXT" },
    201201        { k2SeqplayCredits, kTypeRawData, "S_CREDITS.TXT" },
     202        { k2SeqplayCreditsSpecial, kTypeStringList, "S_CREDITS2.TXT" },
    202203        { k2SeqplayStrings, kTypeLanguageList, "S_STRINGS" },
    203204        { k2SeqplaySfxFiles, kTypeStringList, "S_SFXFILES.TXT" },
    204205        { k2SeqplayTlkFiles, kTypeLanguageList, "S_TLKFILES" },
     
    210211
    211212        // Ingame
    212213        { k2IngamePakFiles, kTypeStringList, "I_PAKFILES.TXT" },
     214        { k2IngameSfxFiles, kTypeStringList, "I_SFXFILES.TXT" },
     215        { k2IngameSfxIndex, kTypeRawData, "I_SFXINDEX.TRA" },   
    213216        { k2IngameTracks, kTypeStringList, "I_TRACKS.TRA" },
    214217        { k2IngameCDA, kTypeRawData, "I_TRACKS.CDA" },
    215218
     
    372375
    373376                        if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ ||
    374377                                g->special == k2TownsFile1E || g->special == k2TownsFile1J ||
    375                                 g->special == k2TownsFile2E || g->special == k2TownsFile2J) {
     378                                g->special == k2TownsFile2E || g->special == k2TownsFile2J || fmtPatch == 5) {
    376379                                // prevents creation of empty entries (which we have mostly between all strings in the fm-towns version)
    377380                                while (!data[++i]) {
    378381                                        if (i == size)
     
    429432        WRITE_BE_UINT32(output, entries); output += 4;
    430433        if (g->special == kFMTownsVersionE || g->special == kFMTownsVersionJ ||
    431434                g->special == k2TownsFile1E || g->special == k2TownsFile1J ||
    432                 g->special == k2TownsFile2E || g->special == k2TownsFile2J) {
     435                g->special == k2TownsFile2E || g->special == k2TownsFile2J || fmtPatch == 5) {
    433436                const byte * c = data + size;
    434437                do {
    435438                        if (fmtPatch == 2 && input - data == 0x3C0 && input[0x10] == 0x32) {
     
    580583                        int v = extractHofSeqData_isSequence(ptr, g, endOffs - ptr);
    581584
    582585                        if (cycle == 0 && v == 1) {
    583                                 if (g->special == k2FloppyFile1 && *ptr == 5) {
    584                                         // patch for floppy version
    585                                         // skips invalid ferb sequence
     586                                if ((g->special == k2FloppyFile1 && *ptr == 5) || (g->special == k2DemoVersion && (ptr - data == 312))) {
     587                                        // patch for floppy version: skips invalid ferb sequence
     588                                        // patch for demo: skips invalid title sequence
    586589                                        ptr += 54;
    587590                                        continue;
    588591                                }
     
    815818        // return values: 1 = possible frame control data; 0 = definitely not frame control data
    816819
    817820        const uint8 *s = (const uint8*)ptr;
    818         for (uint i = 2; i < size; i += 4) {
     821        for (uint32 i = 2; i < size; i += 4) {
    819822                if (!s[i])
    820823                        return 0;
    821824        }
    822825
    823         for (uint i = 1; i < size; i += 2) {
     826        for (uint32 i = 1; i < size; i += 2) {
    824827                if (s[i])
    825828                        return 0;
    826829        }
     
    10901093                        if (i->id == k2IngamePakFiles)
    10911094                                patch = 4;
    10921095                }
     1096
     1097                if (g->special == k2FloppyFile2 || g->special == k2CDFile2E) {
     1098                        if (i->id == k2IngameSfxFiles)
     1099                                patch = 5;
     1100                }               
    10931101               
    10941102                if (!tDesc->extract(out, g, data + i->startOff, i->endOff - i->startOff, filename, patch)) {
    10951103                        fprintf(stderr, "ERROR: couldn't extract id %d\n", i->id);
  • create_kyradat.h

     
    147147        k2SeqplayTlkFiles,
    148148        k2SeqplaySeqData,
    149149        k2SeqplayCredits,
     150        k2SeqplayCreditsSpecial,
    150151        k2SeqplayIntroTracks,
    151152        k2SeqplayFinaleTracks,
    152153        k2SeqplayIntroCDA,
    153154        k2SeqplayFinaleCDA,
    154155
    155156        k2IngamePakFiles,
     157        k2IngameSfxFiles,
     158        k2IngameSfxIndex,
    156159        k2IngameTracks,
    157160        k2IngameCDA,
    158161       
     
    193196        k2FloppyFile1 = 15,
    194197        k2FloppyFile2 = 16,
    195198
    196         k2DemoVersion = 17
     199        k2DemoVersion = 17,
    197200};
    198201
    199202struct SpecialExtension {
     
    203206
    204207enum kGame {
    205208        kKyra1 = 0,
    206         kKyra2 = 1,
    207         kKyra3 = 2
     209        kKyra2,
     210        kKyra3
    208211};
    209212
    210213struct Game {
  • hof_cd.h

     
    11const ExtractEntry kyra2File1CDE[] = {
    22        { k2SeqplayPakFiles, 0x00029FA4, 0x00029FEA },
    33        { k2SeqplayCredits, 0x00027920, 0x00028408 },
     4        { k2SeqplayCreditsSpecial, 0x00029E01, 0x00029E1B },
    45        { k2SeqplayStrings, 0x0002C566, 0x0002CE7C },
    56        { k2SeqplaySfxFiles, 0x0002E284, 0x0002E4B8 },
    67        { k2SeqplayTlkFiles, 0x0002A2AC, 0x0002A349 },
     
    2324};
    2425
    2526const ExtractEntry kyra2File2CDE[] = {
     27        { k2IngameSfxFiles, 0x0002CB30, 0x0002D221 },
     28        { k2IngameSfxIndex, 0x000294F0, 0x00029848 },
    2629        { k2IngameTracks, 0x0002F2FE, 0x0002F37E },
    2730        { -1, 0, 0 }
    2831};
  • hof_floppy.h

     
    3131
    3232const ExtractEntry kyra2File2E[] = {
    3333        { k2IngamePakFiles, 0x0035E4E, 0x00362ED },
     34        { k2IngameSfxFiles, 0x00034700, 0x00034DF1 },
     35        { k2IngameSfxIndex, 0x0002A710, 0x0002AA68 },
    3436        { k2IngameTracks, 0x0003B2F2, 0x0003B370 },
    3537        { -1, 0, 0 }
    3638};
    3739
    3840const ExtractEntry kyra2File2F[] = {
    3941        { k2IngamePakFiles, 0x0003AA9C, 0x0003AB1A },
     42        { k2IngameSfxFiles, 0x00033E24, 0x00034515 },
     43        { k2IngameSfxIndex, 0x000288B0, 0x00028C08 },
    4044        { k2IngameTracks, 0x0003B2F2, 0x0003B370 },
    4145        { -1, 0, 0 }
    4246};
    4347
    4448const ExtractEntry kyra2File2G[] = {
    4549        { k2IngamePakFiles, 0x0035626, 0x0035AC5 },
     50        { k2IngameSfxFiles, 0x00033ED8, 0x000345C9 },
     51        { k2IngameSfxIndex, 0x000288E0, 0x00028C38 },
    4652        { k2IngameTracks, 0x0003AA8C, 0x0003AB0A },
    4753        { -1, 0, 0 }
    4854};
  • hof_towns.h

     
    1515
    1616const ExtractEntry kyra2File2FMTownsE[] = {
    1717        { k2IngamePakFiles, 0x00000540, 0x0000065C },
     18        { k2IngameSfxFiles, 0x00003E3C, 0x000047A3 },
     19        { k2IngameSfxIndex, 0x00013980, 0x00013CD8 },
    1820        { k2IngameCDA, 0x0001808C, 0x000181BC },       
    1921        { -1, 0, 0 }
    2022};
  • misc.h

     
    359359const int kyra2CDFile1EngNeed[] = {
    360360        k2SeqplayPakFiles,
    361361        k2SeqplayCredits,
     362        k2SeqplayCreditsSpecial,
    362363        k2SeqplayStrings,
    363364        k2SeqplaySfxFiles,
    364365        k2SeqplaySeqData,
     
    378379};
    379380
    380381const int kyra2CDFile2EngNeed[] = {
     382        k2IngameSfxFiles,
     383        k2IngameSfxIndex,
    381384        k2IngameTracks,
    382385        -1
    383386};
     
    402405
    403406const int kyra2FloppyFile2Need[] = {
    404407        k2IngamePakFiles,
     408        k2IngameSfxFiles,
     409        k2IngameSfxIndex,
    405410        k2IngameTracks,
    406411        -1
    407412};
     
    423428
    424429const int kyra2TownsFile2EngNeed[] = {
    425430        k2IngamePakFiles,
     431        k2IngameSfxFiles,
     432        k2IngameSfxIndex,
    426433        k2IngameCDA,
    427434        -1
    428435};