Subversion Repositories eduke32

Rev

Rev 5062 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1652 terminx 1
//-------------------------------------------------------------------------
2
/*
3
Copyright (C) 2010 EDuke32 developers and contributors
4
 
5
This file is part of EDuke32.
6
 
7
EDuke32 is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License version 2
9
as published by the Free Software Foundation.
10
 
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 
15
See the GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
4541 hendricks2 19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
1652 terminx 20
*/
21
//-------------------------------------------------------------------------
22
 
241 terminx 23
#include "compat.h"
24
#include "baselayer.h"
25
 
26
#include "scriptfile.h"
27
#include "cache1d.h"
28
#include "crc32.h"
29
 
30
#include "duke3d.h"
2726 hendricks2 31
#include "common_game.h"
241 terminx 32
#include "grpscan.h"
33
 
5064 hendricks2 34
static void process_vaca13(int32_t crcval);
35
static void process_vacapp15(int32_t crcval);
5062 hendricks2 36
 
3708 terminx 37
// custom GRP support for the startup window, file format reflects the structure below
38
#define GAMELISTFILE "games.list"
5062 hendricks2 39
//    name                                     crc          size      flags                         dependency  scriptname     defname           postprocessing
40
struct grpfile internalgrpfiles[] =
559 terminx 41
{
5062 hendricks2 42
    { "Duke Nukem 3D",                         DUKE13_CRC,  26524524, GAMEFLAG_DUKE,                         0, NULL, NULL, NULL, NULL },
43
    { "Duke Nukem 3D (South Korean Censored)", DUKEKR_CRC,  26385383, GAMEFLAG_DUKE,                         0, NULL, NULL, NULL, NULL },
44
    { "Duke Nukem 3D: Atomic Edition",         DUKE15_CRC,  44356548, GAMEFLAG_DUKE,                         0, NULL, NULL, NULL, NULL },
45
    { "Duke Nukem 3D: Plutonium Pak",          DUKEPP_CRC,  44348015, GAMEFLAG_DUKE,                         0, NULL, NULL, NULL, NULL },
46
    { "Duke Nukem 3D Shareware 0.99",          DUKE099_CRC, 9690241,  GAMEFLAG_DUKE|GAMEFLAG_DUKEBETA,       0, NULL, NULL, NULL, NULL },
47
    { "Duke Nukem 3D Shareware 1.0",           DUKE10_CRC,  10429258, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE,      0, NULL, NULL, NULL, NULL },
48
    { "Duke Nukem 3D Shareware 1.1",           DUKE11_CRC,  10442980, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE,      0, NULL, NULL, NULL, NULL },
49
    { "Duke Nukem 3D Shareware 1.3D",          DUKESW_CRC,  11035779, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE,      0, NULL, NULL, NULL, NULL },
50
    { "Duke Nukem 3D Mac Demo",                DUKEMD_CRC,  10444391, GAMEFLAG_DUKE|GAMEFLAG_SHAREWARE,      0, NULL, NULL, NULL, NULL },
51
    { "Duke it out in D.C. (1.3D)",            DUKEDC13_CRC, 7926624, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE13_CRC, NULL, NULL, NULL, NULL },
52
    { "Duke it out in D.C.",                   DUKEDCPP_CRC, 8225517, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL, NULL, NULL },
53
    { "Duke it out in D.C.",                   DUKEDC_CRC,  8410183,  GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL, NULL, NULL },
54
    { "Duke Caribbean: Life's a Beach (1.3D)", VACA13_CRC,  23559381, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE13_CRC, NULL, NULL, process_vaca13, NULL },
55
    { "Duke Caribbean: Life's a Beach (PPak)", VACAPP_CRC,  22551333, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKEPP_CRC, NULL, NULL, process_vacapp15, NULL },
56
    { "Duke Caribbean: Life's a Beach",        VACA15_CRC,  22521880, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL, process_vacapp15, NULL },
57
    { "Duke Caribbean: Life's a Beach",        DUKECB_CRC,  22213819, GAMEFLAG_DUKE|GAMEFLAG_ADDON, DUKE15_CRC, NULL, NULL, NULL, NULL },
58
    { "Duke: Nuclear Winter",                  DUKENW_CRC,  16169365, GAMEFLAG_DUKE|GAMEFLAG_ADDON|GAMEFLAG_NWINTER, DUKE15_CRC, "NWINTER.CON", NULL, NULL, NULL },
59
    { "NAM",                                   NAM_CRC,     43448927, GAMEFLAG_NAM,                          0, NULL, NULL, NULL, NULL },
60
    { "NAPALM",                                NAPALM_CRC,  44365728, GAMEFLAG_NAM|GAMEFLAG_NAPALM,          0, NULL, NULL, NULL, NULL },
61
    { "WWII GI",                               WW2GI_CRC,   77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM,           0, NULL, NULL, NULL, NULL },
559 terminx 62
};
241 terminx 63
struct grpfile *foundgrps = NULL;
3708 terminx 64
struct grpfile *listgrps = NULL;
241 terminx 65
 
3708 terminx 66
static void LoadList(const char * filename)
67
{
68
    struct grpfile *fg;
69
 
70
    char *grpend = NULL;
71
 
72
    scriptfile *script = scriptfile_fromfile(filename);
73
 
74
    if (!script)
75
        return;
76
 
77
    scriptfile_addsymbolvalue("GAMEFLAG_DUKE", GAMEFLAG_DUKE);
78
    scriptfile_addsymbolvalue("GAMEFLAG_ADDON", GAMEFLAG_DUKE|GAMEFLAG_ADDON);
5050 hendricks2 79
    scriptfile_addsymbolvalue("GAMEFLAG_NAM", GAMEFLAG_NAM);
80
    scriptfile_addsymbolvalue("GAMEFLAG_NAPALM", GAMEFLAG_NAM|GAMEFLAG_NAPALM);
81
    scriptfile_addsymbolvalue("GAMEFLAG_WW2GI", GAMEFLAG_NAM|GAMEFLAG_WW2GI);
3708 terminx 82
    scriptfile_addsymbolvalue("DUKE15_CRC", DUKE15_CRC);
5050 hendricks2 83
    scriptfile_addsymbolvalue("DUKEPP_CRC", DUKEPP_CRC);
3708 terminx 84
    scriptfile_addsymbolvalue("DUKE13_CRC", DUKE13_CRC);
5062 hendricks2 85
    scriptfile_addsymbolvalue("DUKEDC13_CRC", DUKEDC13_CRC);
86
    scriptfile_addsymbolvalue("DUKEDCPP_CRC", DUKEDCPP_CRC);
3708 terminx 87
    scriptfile_addsymbolvalue("DUKEDC_CRC", DUKEDC_CRC);
5062 hendricks2 88
    scriptfile_addsymbolvalue("VACA13_CRC", VACA13_CRC);
89
    scriptfile_addsymbolvalue("VACAPP_CRC", VACAPP_CRC);
90
    scriptfile_addsymbolvalue("VACA15_CRC", VACA15_CRC);
3708 terminx 91
    scriptfile_addsymbolvalue("DUKECB_CRC", DUKECB_CRC);
92
    scriptfile_addsymbolvalue("DUKENW_CRC", DUKENW_CRC);
5050 hendricks2 93
    scriptfile_addsymbolvalue("NAM_CRC", NAM_CRC);
94
    scriptfile_addsymbolvalue("NAPALM_CRC", NAPALM_CRC);
95
    scriptfile_addsymbolvalue("WW2GI_CRC", WW2GI_CRC);
3708 terminx 96
 
3711 helixhorne 97
    while (!scriptfile_eof(script))
3708 terminx 98
    {
3711 helixhorne 99
        enum
100
        {
101
            T_GRPINFO,
102
            T_GAMENAME,
103
            T_CRC,
104
            T_SIZE,
105
            T_DEPCRC,
106
            T_SCRIPTNAME,
107
            T_DEFNAME,
108
            T_FLAGS,
109
        };
3708 terminx 110
 
3711 helixhorne 111
        static const tokenlist profiletokens[] =
112
        {
113
            { "grpinfo",            T_GRPINFO },
114
        };
3708 terminx 115
 
4385 terminx 116
        int32_t token = getatoken(script,profiletokens,ARRAY_SIZE(profiletokens));
3708 terminx 117
        switch (token)
118
        {
119
        case T_GRPINFO:
3711 helixhorne 120
        {
121
            int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
122
            char *gname = NULL, *gscript = NULL, *gdef = NULL;
123
 
124
            static const tokenlist grpinfotokens[] =
3708 terminx 125
            {
3711 helixhorne 126
                { "name",           T_GAMENAME },
127
                { "scriptname",     T_SCRIPTNAME },
128
                { "defname",        T_DEFNAME },
129
                { "crc",            T_CRC },
130
                { "dependency",     T_DEPCRC },
131
                { "size",           T_SIZE },
132
                { "flags",          T_FLAGS },
3708 terminx 133
 
3711 helixhorne 134
            };
3708 terminx 135
 
3711 helixhorne 136
            if (scriptfile_getbraces(script,&grpend)) break;
3708 terminx 137
 
3711 helixhorne 138
            while (script->textptr < grpend)
139
            {
4385 terminx 140
                int32_t token = getatoken(script,grpinfotokens,ARRAY_SIZE(grpinfotokens));
3708 terminx 141
 
3711 helixhorne 142
                switch (token)
3708 terminx 143
                {
3711 helixhorne 144
                case T_GAMENAME:
145
                    scriptfile_getstring(script,&gname); break;
146
                case T_SCRIPTNAME:
147
                    scriptfile_getstring(script,&gscript); break;
148
                case T_DEFNAME:
149
                    scriptfile_getstring(script,&gdef); break;
3708 terminx 150
 
3711 helixhorne 151
                case T_FLAGS:
5050 hendricks2 152
                    scriptfile_getsymbol(script,&gflags); gflags &= GAMEFLAGMASK; break;
3711 helixhorne 153
                case T_DEPCRC:
154
                    scriptfile_getsymbol(script,&gdepcrc); break;
155
                case T_CRC:
156
                    scriptfile_getsymbol(script,&gcrcval); break;
157
                case T_SIZE:
158
                    scriptfile_getnumber(script,&gsize); break;
159
                default:
160
                    break;
161
                }
3708 terminx 162
 
4491 helixhorne 163
                fg = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
3711 helixhorne 164
                fg->next = listgrps;
165
                listgrps = fg;
3708 terminx 166
 
3711 helixhorne 167
                if (gname)
4491 helixhorne 168
                    fg->name = Xstrdup(gname);
3708 terminx 169
 
3711 helixhorne 170
                fg->size = gsize;
171
                fg->crcval = gcrcval;
172
                fg->dependency = gdepcrc;
173
                fg->game = gflags;
3708 terminx 174
 
3711 helixhorne 175
                if (gscript)
176
                    fg->scriptname = dup_filename(gscript);
3708 terminx 177
 
3711 helixhorne 178
                if (gdef)
179
                    fg->defname = dup_filename(gdef);
3708 terminx 180
            }
3711 helixhorne 181
            break;
182
        }
3708 terminx 183
 
184
        default:
185
            break;
186
        }
187
    }
188
 
189
    scriptfile_close(script);
190
    scriptfile_clearsymbols();
191
}
192
 
193
static void LoadGameList(void)
194
{
195
    struct grpfile *fg;
196
    CACHE1D_FIND_REC *srch, *sidx;
197
 
5062 hendricks2 198
    for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
3708 terminx 199
    {
4491 helixhorne 200
        fg = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
3708 terminx 201
 
4491 helixhorne 202
        fg->name = Xstrdup(internalgrpfiles[i].name);
3708 terminx 203
        fg->crcval = internalgrpfiles[i].crcval;
204
        fg->size = internalgrpfiles[i].size;
205
        fg->game = internalgrpfiles[i].game;
206
        fg->dependency = internalgrpfiles[i].dependency;
207
 
208
        if (internalgrpfiles[i].scriptname)
209
            fg->scriptname = dup_filename(internalgrpfiles[i].scriptname);
210
 
211
        if (internalgrpfiles[i].defname)
212
            fg->defname = dup_filename(internalgrpfiles[i].defname);
213
 
5062 hendricks2 214
        fg->postprocessing = internalgrpfiles[i].postprocessing;
215
 
3708 terminx 216
        fg->next = listgrps;
217
        listgrps = fg;
218
    }
219
 
220
    srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE);
221
 
222
    for (sidx = srch; sidx; sidx = sidx->next)
223
        LoadList(srch->name);
224
 
225
    klistfree(srch);
226
}
227
 
228
static void FreeGameList(void)
229
{
230
    struct grpfile *fg;
231
 
232
    while (listgrps)
233
    {
234
        fg = listgrps->next;
235
        Bfree(listgrps->name);
236
 
237
        if (listgrps->scriptname)
238
            Bfree(listgrps->scriptname);
239
 
240
        if (listgrps->defname)
241
            Bfree(listgrps->defname);
242
 
243
        Bfree(listgrps);
244
        listgrps = fg;
245
    }
246
}
247
 
248
 
241 terminx 249
#define GRPCACHEFILE "grpfiles.cache"
335 terminx 250
static struct grpcache
251
{
241 terminx 252
    struct grpcache *next;
1205 terminx 253
    int32_t size;
254
    int32_t mtime;
255
    int32_t crcval;
1457 terminx 256
    char name[BMAX_PATH];
335 terminx 257
}
258
*grpcache = NULL, *usedgrpcache = NULL;
241 terminx 259
 
1205 terminx 260
static int32_t LoadGroupsCache(void)
241 terminx 261
{
262
    struct grpcache *fg;
263
 
1205 terminx 264
    int32_t fsize, fmtime, fcrcval;
241 terminx 265
    char *fname;
266
 
267
    scriptfile *script;
268
 
269
    script = scriptfile_fromfile(GRPCACHEFILE);
270
    if (!script) return -1;
271
 
335 terminx 272
    while (!scriptfile_eof(script))
273
    {
2726 hendricks2 274
        if (scriptfile_getstring(script, &fname)) break;    // filename
275
        if (scriptfile_getnumber(script, &fsize)) break;    // filesize
276
        if (scriptfile_getnumber(script, &fmtime)) break;   // modification time
277
        if (scriptfile_getnumber(script, &fcrcval)) break;  // crc checksum
241 terminx 278
 
4491 helixhorne 279
        fg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
241 terminx 280
        fg->next = grpcache;
281
        grpcache = fg;
282
 
1221 terminx 283
        Bstrncpy(fg->name, fname, BMAX_PATH);
241 terminx 284
        fg->size = fsize;
285
        fg->mtime = fmtime;
286
        fg->crcval = fcrcval;
287
    }
288
 
289
    scriptfile_close(script);
290
    return 0;
291
}
292
 
293
static void FreeGroupsCache(void)
294
{
295
    struct grpcache *fg;
296
 
335 terminx 297
    while (grpcache)
298
    {
241 terminx 299
        fg = grpcache->next;
1527 terminx 300
        Bfree(grpcache);
241 terminx 301
        grpcache = fg;
302
    }
303
}
304
 
3654 terminx 305
void RemoveGroup(int32_t crcval)
306
{
3661 terminx 307
    struct grpfile *grp;
3654 terminx 308
 
309
    for (grp = foundgrps; grp; grp=grp->next)
310
    {
311
        if (grp->crcval == crcval)
312
        {
313
            if (grp == foundgrps)
314
                foundgrps = grp->next;
3661 terminx 315
            else
316
            {
317
                struct grpfile *fg;
3654 terminx 318
 
3661 terminx 319
                for (fg = foundgrps; fg; fg=fg->next)
320
                {
321
                    if (fg->next == grp)
322
                    {
323
                        fg->next = grp->next;
324
                        break;
325
                    }
326
                }
327
            }
328
 
3654 terminx 329
            Bfree((char *)grp->name);
330
            Bfree(grp);
331
 
3661 terminx 332
            RemoveGroup(crcval);
333
 
3654 terminx 334
            break;
335
        }
336
    }
337
}
338
 
339
struct grpfile * FindGroup(int32_t crcval)
340
{
341
    struct grpfile *grp;
342
 
343
    for (grp = foundgrps; grp; grp=grp->next)
344
    {
345
        if (grp->crcval == crcval)
346
            return grp;
347
    }
348
 
349
    return NULL;
350
}
351
 
5062 hendricks2 352
static void ProcessGroups(CACHE1D_FIND_REC *srch)
241 terminx 353
{
5062 hendricks2 354
    CACHE1D_FIND_REC *sidx;
241 terminx 355
    struct grpcache *fg, *fgg;
356
    struct grpfile *grp;
357
    char *fn;
358
    struct Bstat st;
5062 hendricks2 359
 
1430 terminx 360
#define BUFFER_SIZE (1024 * 1024 * 8)
4491 helixhorne 361
    uint8_t *buf = (uint8_t *)Xmalloc(BUFFER_SIZE);
241 terminx 362
 
335 terminx 363
    for (sidx = srch; sidx; sidx = sidx->next)
364
    {
365
        for (fg = grpcache; fg; fg = fg->next)
366
        {
241 terminx 367
            if (!Bstrcmp(fg->name, sidx->name)) break;
368
        }
369
 
335 terminx 370
        if (fg)
371
        {
2726 hendricks2 372
            if (findfrompath(sidx->name, &fn)) continue; // failed to resolve the filename
335 terminx 373
            if (Bstat(fn, &st))
374
            {
1527 terminx 375
                Bfree(fn);
335 terminx 376
                continue;
2726 hendricks2 377
            } // failed to stat the file
1527 terminx 378
            Bfree(fn);
4997 terminx 379
            if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
335 terminx 380
            {
4491 helixhorne 381
                grp = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
382
                grp->name = Xstrdup(sidx->name);
241 terminx 383
                grp->crcval = fg->crcval;
384
                grp->size = fg->size;
385
                grp->next = foundgrps;
386
                foundgrps = grp;
387
 
4491 helixhorne 388
                fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
241 terminx 389
                strcpy(fgg->name, fg->name);
390
                fgg->size = fg->size;
391
                fgg->mtime = fg->mtime;
392
                fgg->crcval = fg->crcval;
393
                fgg->next = usedgrpcache;
394
                usedgrpcache = fgg;
395
                continue;
396
            }
397
        }
398
 
399
        {
1205 terminx 400
            int32_t b, fh;
4625 terminx 401
            int32_t crcval = 0;
241 terminx 402
 
403
            fh = openfrompath(sidx->name, BO_RDONLY|BO_BINARY, BS_IREAD);
404
            if (fh < 0) continue;
3171 helixhorne 405
            if (Bfstat(fh, &st)) continue;
241 terminx 406
 
407
            initprintf(" Checksumming %s...", sidx->name);
335 terminx 408
            do
409
            {
1430 terminx 410
                b = read(fh, buf, BUFFER_SIZE);
4642 terminx 411
                if (b > 0) crcval = Bcrc32((uint8_t *)buf, b, crcval);
335 terminx 412
            }
1430 terminx 413
            while (b == BUFFER_SIZE);
241 terminx 414
            close(fh);
415
            initprintf(" Done\n");
416
 
4491 helixhorne 417
            grp = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
418
            grp->name = Xstrdup(sidx->name);
241 terminx 419
            grp->crcval = crcval;
420
            grp->size = st.st_size;
421
            grp->next = foundgrps;
422
            foundgrps = grp;
423
 
4491 helixhorne 424
            fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
1221 terminx 425
            Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
241 terminx 426
            fgg->size = st.st_size;
427
            fgg->mtime = st.st_mtime;
428
            fgg->crcval = crcval;
429
            fgg->next = usedgrpcache;
430
            usedgrpcache = fgg;
431
        }
432
    }
433
 
5062 hendricks2 434
    Bfree(buf);
435
}
436
 
437
int32_t ScanGroups(void)
438
{
439
    CACHE1D_FIND_REC *srch;
440
    struct grpcache *fg, *fgg;
441
    struct grpfile *grp;
442
 
443
    initprintf("Searching for game data...\n");
444
 
445
    LoadGameList();
446
    LoadGroupsCache();
447
 
448
    srch = klistpath("/", "*.grp", CACHE1D_FIND_FILE);
449
    ProcessGroups(srch);
241 terminx 450
    klistfree(srch);
5062 hendricks2 451
 
452
    srch = klistpath("/", "*.ssi", CACHE1D_FIND_FILE);
453
    ProcessGroups(srch);
454
    klistfree(srch);
455
 
241 terminx 456
    FreeGroupsCache();
457
 
3654 terminx 458
    for (grp = foundgrps; grp; /*grp=grp->next*/)
459
    {
3708 terminx 460
        struct grpfile *igrp;
461
        for (igrp = listgrps; igrp; igrp=igrp->next)
462
            if (grp->crcval == igrp->crcval) break;
3654 terminx 463
 
3708 terminx 464
        if (igrp == NULL)
465
        {
466
            grp = grp->next;
467
            continue;
468
        }
3654 terminx 469
 
3708 terminx 470
        if (igrp->dependency)
3654 terminx 471
        {
3723 terminx 472
            struct grpfile *depgrp;
473
 
3654 terminx 474
            //initprintf("found grp with dep\n");
3723 terminx 475
            for (depgrp = foundgrps; depgrp; depgrp=depgrp->next)
476
                if (depgrp->crcval == igrp->dependency) break;
3654 terminx 477
 
3723 terminx 478
            if (depgrp == NULL || depgrp->crcval != igrp->dependency) // couldn't find dependency
3654 terminx 479
            {
480
                //initprintf("removing %s\n", grp->name);
3708 terminx 481
                RemoveGroup(igrp->crcval);
3654 terminx 482
                grp = foundgrps;
483
                continue;
484
            }
485
        }
486
 
3803 terminx 487
        if (igrp->game && !grp->game)
488
            grp->game = igrp->game;
489
 
3654 terminx 490
        grp=grp->next;
491
    }
492
 
335 terminx 493
    if (usedgrpcache)
494
    {
1205 terminx 495
        int32_t i = 0;
241 terminx 496
        FILE *fp;
497
        fp = fopen(GRPCACHEFILE, "wt");
335 terminx 498
        if (fp)
499
        {
500
            for (fg = usedgrpcache; fg; fg=fgg)
501
            {
241 terminx 502
                fgg = fg->next;
503
                fprintf(fp, "\"%s\" %d %d %d\n", fg->name, fg->size, fg->mtime, fg->crcval);
1527 terminx 504
                Bfree(fg);
1000 terminx 505
                i++;
241 terminx 506
            }
507
            fclose(fp);
508
        }
1178 terminx 509
//        initprintf("Found %d recognized GRP %s.\n",i,i>1?"files":"file");
2978 helixhorne 510
 
1000 terminx 511
        return 0;
241 terminx 512
    }
1642 terminx 513
 
514
    initprintf("Found no recognized game data!\n");
515
 
241 terminx 516
    return 0;
517
}
518
 
3654 terminx 519
 
241 terminx 520
void FreeGroups(void)
521
{
522
    struct grpfile *fg;
523
 
335 terminx 524
    while (foundgrps)
525
    {
241 terminx 526
        fg = foundgrps->next;
1677 terminx 527
        Bfree((char *)foundgrps->name);
1527 terminx 528
        Bfree(foundgrps);
241 terminx 529
        foundgrps = fg;
530
    }
3708 terminx 531
 
532
    FreeGameList();
241 terminx 533
}
534
 
5064 hendricks2 535
static void process_vaca13(int32_t crcval)
5062 hendricks2 536
{
5064 hendricks2 537
    krename(crcval, 0, "ADDREE.VOC");
538
    krename(crcval, 1, "BALLBOOM.VOC");
539
    krename(crcval, 2, "BARMUSIC.VOC");
540
    krename(crcval, 3, "BCHBALL.VOC");
541
    krename(crcval, 4, "BOING.VOC");
542
    krename(crcval, 5, "CHACHA.VOC");
543
    krename(crcval, 6, "CHAINDRV.VOC");
544
    krename(crcval, 7, "CHEAP01.VOC");
545
    krename(crcval, 8, "CHEER.VOC");
546
    krename(crcval, 9, "CHNSQRT.VOC");
547
    krename(crcval, 10, "COCOANUT.VOC");
548
    krename(crcval, 11, "CRUSH2.VOC");
549
    krename(crcval, 12, "DEFLATE2.VOC");
550
    krename(crcval, 13, "DRAGHURT.VOC");
551
    krename(crcval, 14, "DRAGROAM.VOC");
552
    krename(crcval, 15, "DRAGSHOT.VOC");
553
    krename(crcval, 16, "DUKE01.VOC");
554
    krename(crcval, 17, "ELEV1.VOC");
555
    krename(crcval, 18, "GMEOVR05.VOC");
556
    krename(crcval, 19, "GULLDIE.VOC");
557
    krename(crcval, 20, "GULLHURT.VOC");
558
    krename(crcval, 21, "GULLROAM.VOC");
559
    krename(crcval, 22, "GULLSHIT.VOC");
560
    krename(crcval, 23, "HELP04.VOC");
561
    krename(crcval, 24, "ICECONCH.VOC");
562
    krename(crcval, 25, "IDLEBOAT.VOC");
563
    krename(crcval, 26, "KICKHEAD.VOC");
564
    krename(crcval, 27, "LANI05.VOC");
565
    krename(crcval, 28, "LANI08.VOC");
566
    krename(crcval, 29, "LANIDUK2.VOC");
567
    krename(crcval, 30, "MUSCLE01.VOC");
568
    krename(crcval, 31, "MUSCLE04.VOC");
569
    krename(crcval, 32, "MUZAK.VOC");
570
    krename(crcval, 33, "PINEFALL.VOC");
571
    krename(crcval, 34, "POINT07.VOC");
572
    krename(crcval, 35, "POINT08.VOC");
573
    krename(crcval, 36, "RADIO.VOC");
574
    krename(crcval, 37, "RUIN01.VOC");
575
    krename(crcval, 38, "SCREAM.VOC");
576
    krename(crcval, 39, "SCREAM04.VOC");
577
    krename(crcval, 40, "SCREAM9.VOC");
578
    krename(crcval, 41, "SHIPHORN.VOC");
579
    krename(crcval, 42, "SNGLGULL.VOC");
580
    krename(crcval, 43, "SQRT4.VOC");
581
    krename(crcval, 44, "SQUIRT1.VOC");
582
    krename(crcval, 45, "SSCOOL1.VOC");
583
    krename(crcval, 46, "SSCOOL2.VOC");
584
    krename(crcval, 47, "SSCOOL3.VOC");
585
    krename(crcval, 48, "SSDIE1.VOC");
586
    krename(crcval, 49, "SSDIE2.VOC");
587
    krename(crcval, 50, "SSNORM01.VOC");
588
    krename(crcval, 51, "SSNORM02.VOC");
589
    krename(crcval, 52, "SSNORM03.VOC");
590
    krename(crcval, 53, "SSNORM04.VOC");
591
    krename(crcval, 54, "SSNORM05.VOC");
592
    krename(crcval, 55, "SSNORM06.VOC");
593
    krename(crcval, 56, "SSNORM07.VOC");
594
    krename(crcval, 57, "SSNORM08.VOC");
595
    krename(crcval, 58, "SSNORM10.VOC");
596
    krename(crcval, 59, "SSNORM11.VOC");
597
    krename(crcval, 60, "SSNORM12.VOC");
598
    krename(crcval, 61, "SSNORM13.VOC");
599
    krename(crcval, 62, "SSNORM14.VOC");
600
    krename(crcval, 63, "SSNORM15.VOC");
601
    krename(crcval, 64, "SSNORM16.VOC");
602
    krename(crcval, 65, "SSNORM17.VOC");
603
    krename(crcval, 66, "SSNORM18.VOC");
604
    krename(crcval, 67, "SSNORM19.VOC");
605
    krename(crcval, 68, "SSNORM20.VOC");
606
    krename(crcval, 69, "SSTAUNT1.VOC");
607
    krename(crcval, 70, "SSTAUNT2.VOC");
608
    krename(crcval, 71, "SSTAUNT3.VOC");
609
    krename(crcval, 72, "SSTAUNT4.VOC");
610
    krename(crcval, 73, "SSTAUNT5.VOC");
611
    krename(crcval, 74, "SSTAUNT6.VOC");
612
    krename(crcval, 75, "SSTAUNT7.VOC");
613
    krename(crcval, 76, "SSTAUNT8.VOC");
614
    krename(crcval, 77, "SURF.VOC");
615
    krename(crcval, 78, "TAN01.VOC");
616
    krename(crcval, 79, "TAN04.VOC");
617
    krename(crcval, 80, "VINESNAP.VOC");
618
    krename(crcval, 81, "VOODRUMS.VOC");
619
    krename(crcval, 82, "WIND54.VOC");
620
    krename(crcval, 83, "DOOMSDAY.MID");
621
    krename(crcval, 84, "DUKE-O.MID");
622
    krename(crcval, 85, "IRIEPRTY.MID");
623
    krename(crcval, 86, "JUNGVEIN.MID");
624
    krename(crcval, 87, "PRTYCRUZ.MID");
625
    krename(crcval, 88, "SOL-MAN1.MID");
626
    krename(crcval, 90, "CINEOV3.ANM");
627
    krename(crcval, 91, "DUKETEAM.ANM");
628
    krename(crcval, 92, "BEACHBAB.CON");
629
    krename(crcval, 93, "BEACHBAL.CON");
630
    krename(crcval, 94, "BEACHBTH.CON");
631
    krename(crcval, 95, "DEFS.CON");
632
    krename(crcval, 96, "DRAGON.CON");
633
    krename(crcval, 97, "GAME.CON");
634
    krename(crcval, 98, "SEAGULL.CON");
635
    krename(crcval, 99, "SOUNDS.CON");
636
    krename(crcval, 100, "USER.CON");
637
    krename(crcval, 101, "DEMO1.DMO");
638
    krename(crcval, 102, "DEMO2.DMO");
639
    krename(crcval, 103, "DEMO3.DMO");
640
    krename(crcval, 104, "VACA1.MAP");
641
    krename(crcval, 105, "VACA2.MAP");
642
    krename(crcval, 106, "VACA3.MAP");
643
    krename(crcval, 107, "VACA4.MAP");
644
    krename(crcval, 108, "VACA5.MAP");
645
    krename(crcval, 109, "VACA6.MAP");
646
    krename(crcval, 110, "VACA7.MAP");
647
    krename(crcval, 111, "VACADM1.MAP");
648
    krename(crcval, 112, "VACADM2.MAP");
649
    krename(crcval, 113, "VACADM3.MAP");
650
    krename(crcval, 114, "VACADM4.MAP");
651
    krename(crcval, 115, "VACASL.MAP");
652
    krename(crcval, 120, "TILES000.ART");
653
    krename(crcval, 121, "TILES001.ART");
654
    krename(crcval, 122, "TILES003.ART");
655
    krename(crcval, 123, "TILES005.ART");
656
    krename(crcval, 124, "TILES006.ART");
657
    krename(crcval, 125, "TILES007.ART");
658
    krename(crcval, 126, "TILES008.ART");
659
    krename(crcval, 127, "TILES009.ART");
660
    krename(crcval, 128, "TILES010.ART");
661
    krename(crcval, 129, "TILES012.ART");
662
    krename(crcval, 130, "TILES014.ART");
5062 hendricks2 663
}
664
 
5064 hendricks2 665
static void process_vacapp15(int32_t crcval)
5062 hendricks2 666
{
5064 hendricks2 667
    krename(crcval, 5, "DEFS.CON");
668
    krename(crcval, 6, "GAME.CON");
669
    krename(crcval, 7, "USER.CON");
670
    krename(crcval, 8, "DEMO1.DMO");
671
    krename(crcval, 9, "DEMO2.DMO");
672
    krename(crcval, 10, "DEMO3.DMO");
5062 hendricks2 673
 
674
    initgroupfile("VACATION.PRG");
675
}