Subversion Repositories eduke32

Compare Revisions

Ignore whitespace Rev 5063 → Rev 5064

/polymer/eduke32/build/include/cache1d.h
39,7 → 39,7
int32_t ktell(int32_t handle);
void kclose(int32_t handle);
 
void krename(const char *filename, const char *newname);
void krename(int32_t crcval, int32_t filenum, const char *newname);
 
typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype;
 
/polymer/eduke32/build/src/cache1d.c
35,6 → 35,7
#include "cache1d.h"
#include "pragmas.h"
#include "baselayer.h"
#include "crc32.h"
 
#ifdef WITHKPLIB
#include "kplib.h"
665,6 → 666,7
static uint8_t groupfilgrp[MAXGROUPFILES];
static char *gfilelist[MAXGROUPFILES];
static int32_t *gfileoffs[MAXGROUPFILES];
static int32_t groupcrc[MAXGROUPFILES];
 
static uint8_t filegrp[MAXOPENFILES];
static int32_t filepos[MAXOPENFILES];
691,6 → 693,25
static int32_t klseek_grp(int32_t handle, int32_t offset, int32_t whence);
static void kclose_grp(int32_t handle);
 
static void initgroupfile_crc32(int32_t handle)
{
int32_t b, crcval = 0;
#define BUFFER_SIZE (1024 * 1024 * 8)
uint8_t *buf = (uint8_t *)Xmalloc(BUFFER_SIZE);
klseek_grp(handle, 0, BSEEK_SET);
 
do
{
b = kread_grp(handle, buf, BUFFER_SIZE);
if (b > 0) crcval = Bcrc32((uint8_t *)buf, b, crcval);
}
while (b == BUFFER_SIZE);
 
groupcrc[handle] = crcval;
klseek_grp(handle, 0, BSEEK_SET);
Bfree(buf);
}
 
int32_t initgroupfile(const char *filename)
{
char buf[70];
753,6 → 774,7
j += k;
}
gfileoffs[numgroupfiles][gnumfiles[numgroupfiles]] = j;
initgroupfile_crc32(numgroupfiles);
numgroupfiles++;
return 0;
}
856,6 → 878,7
klseek_grp(numgroupfiles, 104, BSEEK_CUR);
}
gfileoffs[numgroupfiles][gnumfiles[numgroupfiles]] = j;
initgroupfile_crc32(numgroupfiles);
numgroupfiles++;
return 0;
}
1039,36 → 1062,14
return -1;
}
 
void krename(const char *filename, const char *newname)
void krename(int32_t crcval, int32_t filenum, const char *newname)
{
int32_t i, j, k;
char bad, *gfileptr;
 
for (k=numgroupfiles-1; k>=0; k--)
for (int32_t k=numgroupfiles-1; k>=0; k--)
{
if (groupfil[k] >= 0)
if (groupfil[k] >= 0 && groupcrc[k] == crcval)
{
for (i=gnumfiles[k]-1; i>=0; i--)
{
gfileptr = (char *)&gfilelist[k][i<<4];
 
bad = 0;
for (j=0; j<13; j++)
{
if (!filename[j]) break;
if (toupperlookup[filename[j]] != toupperlookup[gfileptr[j]])
{
bad = 1;
break;
}
}
if (bad) continue;
if (j<13 && gfileptr[j]) continue; // JBF: because e1l1.map might exist before e1l1
if (j==13 && filename[j]) continue; // JBF: long file name
 
Bstrncpy(gfileptr, newname, 12);
return;
}
Bstrncpy((char *)&gfilelist[k][filenum<<4], newname, 12);
return;
}
}
}
/polymer/eduke32/build/src/defs.c
2222,10 → 2222,12
 
case T_RENAMEFILE:
{
char *filename = NULL, *newname = NULL;
if (scriptfile_getstring(script,&filename)) break;
int32_t crcval = 0, filenum = -1;
char *newname = NULL;
if (scriptfile_getnumber(script,&crcval)) break;
if (scriptfile_getnumber(script,&filenum)) break;
if (scriptfile_getstring(script,&newname)) break;
krename(filename, newname);
krename(crcval, filenum, newname);
}
break;
 
/polymer/eduke32/source/common.c
25,8 → 25,9
int32_t g_gameType = GAMEFLAG_DUKE;
 
int32_t g_dependencyCRC = 0;
int32_t g_groupCRC;
int32_t g_usingAddon = 0;
void (*g_postprocessing)(void);
void (*g_postprocessing)(int32_t);
 
// g_gameNamePtr can point to one of: grpfiles[].name (string literal), string
// literal, malloc'd block (XXX: possible leak)
460,7 → 461,7
initprintf("Using \"%s\" as main game data file.\n", grpfile);
 
if (g_postprocessing)
g_postprocessing();
g_postprocessing(g_groupCRC);
 
if (autoload)
{
/polymer/eduke32/source/common_game.h
27,7 → 27,8
 
extern int32_t g_usingAddon;
extern int32_t g_dependencyCRC;
extern void (*g_postprocessing)(void);
extern int32_t g_groupCRC;
extern void (*g_postprocessing)(int32_t);
 
#define DUKE (g_gameType & GAMEFLAG_DUKE)
#define NAM (g_gameType & GAMEFLAG_NAM)
/polymer/eduke32/source/grpscan.c
31,8 → 31,8
#include "common_game.h"
#include "grpscan.h"
 
static void process_vaca13(void);
static void process_vacapp15(void);
static void process_vaca13(int32_t crcval);
static void process_vacapp15(int32_t crcval);
 
// custom GRP support for the startup window, file format reflects the structure below
#define GAMELISTFILE "games.list"
532,144 → 532,144
FreeGameList();
}
 
static void process_vaca13(void)
static void process_vaca13(int32_t crcval)
{
krename("ADDREE.COV", "ADDREE.VOC");
krename("BALLBOOM.COV", "BALLBOOM.VOC");
krename("BARMUSIC.COV", "BARMUSIC.VOC");
krename("BCHBALL.COV", "BCHBALL.VOC");
krename("BOING.COV", "BOING.VOC");
krename("CHACHA.COV", "CHACHA.VOC");
krename("CHAINDRV.COV", "CHAINDRV.VOC");
krename("CHEAP01.COV", "CHEAP01.VOC");
krename("CHEER.COV", "CHEER.VOC");
krename("CHNSQRT.COV", "CHNSQRT.VOC");
krename("COCOANUT.COV", "COCOANUT.VOC");
krename("CRUSH2.COV", "CRUSH2.VOC");
krename("DEFLATE2.COV", "DEFLATE2.VOC");
krename("DRAGHURT.COV", "DRAGHURT.VOC");
krename("DRAGROAM.COV", "DRAGROAM.VOC");
krename("DRAGSHOT.COV", "DRAGSHOT.VOC");
krename("DUKE01.COV", "DUKE01.VOC");
krename("ELEV1.COV", "ELEV1.VOC");
krename("GMEOVR05.COV", "GMEOVR05.VOC");
krename("GULLDIE.COV", "GULLDIE.VOC");
krename("GULLHURT.COV", "GULLHURT.VOC");
krename("GULLROAM.COV", "GULLROAM.VOC");
krename("GULLSHIT.COV", "GULLSHIT.VOC");
krename("HELP04.COV", "HELP04.VOC");
krename("ICECONCH.COV", "ICECONCH.VOC");
krename("IDLEBOAT.COV", "IDLEBOAT.VOC");
krename("KICKHEAD.COV", "KICKHEAD.VOC");
krename("LANI05.COV", "LANI05.VOC");
krename("LANI08.COV", "LANI08.VOC");
krename("LANIDUK2.COV", "LANIDUK2.VOC");
krename("MUSCLE01.COV", "MUSCLE01.VOC");
krename("MUSCLE04.COV", "MUSCLE04.VOC");
krename("MUZAK.COV", "MUZAK.VOC");
krename("PINEFALL.COV", "PINEFALL.VOC");
krename("POINT07.COV", "POINT07.VOC");
krename("POINT08.COV", "POINT08.VOC");
krename("RADIO.COV", "RADIO.VOC");
krename("RUIN01.COV", "RUIN01.VOC");
krename("SCREAM.COV", "SCREAM.VOC");
krename("SCREAM04.COV", "SCREAM04.VOC");
krename("SCREAM9.COV", "SCREAM9.VOC");
krename("SHIPHORN.COV", "SHIPHORN.VOC");
krename("SNGLGULL.COV", "SNGLGULL.VOC");
krename("SQRT4.COV", "SQRT4.VOC");
krename("SQUIRT1.COV", "SQUIRT1.VOC");
krename("SSCOOL1.COV", "SSCOOL1.VOC");
krename("SSCOOL2.COV", "SSCOOL2.VOC");
krename("SSCOOL3.COV", "SSCOOL3.VOC");
krename("SSDIE1.COV", "SSDIE1.VOC");
krename("SSDIE2.COV", "SSDIE2.VOC");
krename("SSNORM01.COV", "SSNORM01.VOC");
krename("SSNORM02.COV", "SSNORM02.VOC");
krename("SSNORM03.COV", "SSNORM03.VOC");
krename("SSNORM04.COV", "SSNORM04.VOC");
krename("SSNORM05.COV", "SSNORM05.VOC");
krename("SSNORM06.COV", "SSNORM06.VOC");
krename("SSNORM07.COV", "SSNORM07.VOC");
krename("SSNORM08.COV", "SSNORM08.VOC");
krename("SSNORM10.COV", "SSNORM10.VOC");
krename("SSNORM11.COV", "SSNORM11.VOC");
krename("SSNORM12.COV", "SSNORM12.VOC");
krename("SSNORM13.COV", "SSNORM13.VOC");
krename("SSNORM14.COV", "SSNORM14.VOC");
krename("SSNORM15.COV", "SSNORM15.VOC");
krename("SSNORM16.COV", "SSNORM16.VOC");
krename("SSNORM17.COV", "SSNORM17.VOC");
krename("SSNORM18.COV", "SSNORM18.VOC");
krename("SSNORM19.COV", "SSNORM19.VOC");
krename("SSNORM20.COV", "SSNORM20.VOC");
krename("SSTAUNT1.COV", "SSTAUNT1.VOC");
krename("SSTAUNT2.COV", "SSTAUNT2.VOC");
krename("SSTAUNT3.COV", "SSTAUNT3.VOC");
krename("SSTAUNT4.COV", "SSTAUNT4.VOC");
krename("SSTAUNT5.COV", "SSTAUNT5.VOC");
krename("SSTAUNT6.COV", "SSTAUNT6.VOC");
krename("SSTAUNT7.COV", "SSTAUNT7.VOC");
krename("SSTAUNT8.COV", "SSTAUNT8.VOC");
krename("SURF.COV", "SURF.VOC");
krename("TAN01.COV", "TAN01.VOC");
krename("TAN04.COV", "TAN04.VOC");
krename("VINESNAP.COV", "VINESNAP.VOC");
krename("VOODRUMS.COV", "VOODRUMS.VOC");
krename("WIND54.COV", "WIND54.VOC");
krename("DOOMSDAY.DIM", "DOOMSDAY.MID");
krename("DUKE-O.DIM", "DUKE-O.MID");
krename("IRIEPRTY.DIM", "IRIEPRTY.MID");
krename("JUNGVEIN.DIM", "JUNGVEIN.MID");
krename("PRTYCRUZ.DIM", "PRTYCRUZ.MID");
krename("SOL-MAN1.DIM", "SOL-MAN1.MID");
krename("CINEOV3.MNA", "CINEOV3.ANM");
krename("DUKETEAM.MNA", "DUKETEAM.ANM");
krename("BEACHBAB.NOC", "BEACHBAB.CON");
krename("BEACHBAL.NOC", "BEACHBAL.CON");
krename("BEACHBTH.NOC", "BEACHBTH.CON");
krename("DEFS.NOC", "DEFS.CON");
krename("DRAGON.NOC", "DRAGON.CON");
krename("GAME.NOC", "GAME.CON");
krename("SEAGULL.NOC", "SEAGULL.CON");
krename("SOUNDS.NOC", "SOUNDS.CON");
krename("USER.NOC", "USER.CON");
krename("DEMO1.OMD", "DEMO1.DMO");
krename("DEMO2.OMD", "DEMO2.DMO");
krename("DEMO3.OMD", "DEMO3.DMO");
krename("VACA1.PAM", "VACA1.MAP");
krename("VACA2.PAM", "VACA2.MAP");
krename("VACA3.PAM", "VACA3.MAP");
krename("VACA4.PAM", "VACA4.MAP");
krename("VACA5.PAM", "VACA5.MAP");
krename("VACA6.PAM", "VACA6.MAP");
krename("VACA7.PAM", "VACA7.MAP");
krename("VACADM1.PAM", "VACADM1.MAP");
krename("VACADM2.PAM", "VACADM2.MAP");
krename("VACADM3.PAM", "VACADM3.MAP");
krename("VACADM4.PAM", "VACADM4.MAP");
krename("VACASL.PAM", "VACASL.MAP");
krename("TILES000.TRA", "TILES000.ART");
krename("TILES001.TRA", "TILES001.ART");
krename("TILES003.TRA", "TILES003.ART");
krename("TILES005.TRA", "TILES005.ART");
krename("TILES006.TRA", "TILES006.ART");
krename("TILES007.TRA", "TILES007.ART");
krename("TILES008.TRA", "TILES008.ART");
krename("TILES009.TRA", "TILES009.ART");
krename("TILES010.TRA", "TILES010.ART");
krename("TILES012.TRA", "TILES012.ART");
krename("TILES014.TRA", "TILES014.ART");
krename(crcval, 0, "ADDREE.VOC");
krename(crcval, 1, "BALLBOOM.VOC");
krename(crcval, 2, "BARMUSIC.VOC");
krename(crcval, 3, "BCHBALL.VOC");
krename(crcval, 4, "BOING.VOC");
krename(crcval, 5, "CHACHA.VOC");
krename(crcval, 6, "CHAINDRV.VOC");
krename(crcval, 7, "CHEAP01.VOC");
krename(crcval, 8, "CHEER.VOC");
krename(crcval, 9, "CHNSQRT.VOC");
krename(crcval, 10, "COCOANUT.VOC");
krename(crcval, 11, "CRUSH2.VOC");
krename(crcval, 12, "DEFLATE2.VOC");
krename(crcval, 13, "DRAGHURT.VOC");
krename(crcval, 14, "DRAGROAM.VOC");
krename(crcval, 15, "DRAGSHOT.VOC");
krename(crcval, 16, "DUKE01.VOC");
krename(crcval, 17, "ELEV1.VOC");
krename(crcval, 18, "GMEOVR05.VOC");
krename(crcval, 19, "GULLDIE.VOC");
krename(crcval, 20, "GULLHURT.VOC");
krename(crcval, 21, "GULLROAM.VOC");
krename(crcval, 22, "GULLSHIT.VOC");
krename(crcval, 23, "HELP04.VOC");
krename(crcval, 24, "ICECONCH.VOC");
krename(crcval, 25, "IDLEBOAT.VOC");
krename(crcval, 26, "KICKHEAD.VOC");
krename(crcval, 27, "LANI05.VOC");
krename(crcval, 28, "LANI08.VOC");
krename(crcval, 29, "LANIDUK2.VOC");
krename(crcval, 30, "MUSCLE01.VOC");
krename(crcval, 31, "MUSCLE04.VOC");
krename(crcval, 32, "MUZAK.VOC");
krename(crcval, 33, "PINEFALL.VOC");
krename(crcval, 34, "POINT07.VOC");
krename(crcval, 35, "POINT08.VOC");
krename(crcval, 36, "RADIO.VOC");
krename(crcval, 37, "RUIN01.VOC");
krename(crcval, 38, "SCREAM.VOC");
krename(crcval, 39, "SCREAM04.VOC");
krename(crcval, 40, "SCREAM9.VOC");
krename(crcval, 41, "SHIPHORN.VOC");
krename(crcval, 42, "SNGLGULL.VOC");
krename(crcval, 43, "SQRT4.VOC");
krename(crcval, 44, "SQUIRT1.VOC");
krename(crcval, 45, "SSCOOL1.VOC");
krename(crcval, 46, "SSCOOL2.VOC");
krename(crcval, 47, "SSCOOL3.VOC");
krename(crcval, 48, "SSDIE1.VOC");
krename(crcval, 49, "SSDIE2.VOC");
krename(crcval, 50, "SSNORM01.VOC");
krename(crcval, 51, "SSNORM02.VOC");
krename(crcval, 52, "SSNORM03.VOC");
krename(crcval, 53, "SSNORM04.VOC");
krename(crcval, 54, "SSNORM05.VOC");
krename(crcval, 55, "SSNORM06.VOC");
krename(crcval, 56, "SSNORM07.VOC");
krename(crcval, 57, "SSNORM08.VOC");
krename(crcval, 58, "SSNORM10.VOC");
krename(crcval, 59, "SSNORM11.VOC");
krename(crcval, 60, "SSNORM12.VOC");
krename(crcval, 61, "SSNORM13.VOC");
krename(crcval, 62, "SSNORM14.VOC");
krename(crcval, 63, "SSNORM15.VOC");
krename(crcval, 64, "SSNORM16.VOC");
krename(crcval, 65, "SSNORM17.VOC");
krename(crcval, 66, "SSNORM18.VOC");
krename(crcval, 67, "SSNORM19.VOC");
krename(crcval, 68, "SSNORM20.VOC");
krename(crcval, 69, "SSTAUNT1.VOC");
krename(crcval, 70, "SSTAUNT2.VOC");
krename(crcval, 71, "SSTAUNT3.VOC");
krename(crcval, 72, "SSTAUNT4.VOC");
krename(crcval, 73, "SSTAUNT5.VOC");
krename(crcval, 74, "SSTAUNT6.VOC");
krename(crcval, 75, "SSTAUNT7.VOC");
krename(crcval, 76, "SSTAUNT8.VOC");
krename(crcval, 77, "SURF.VOC");
krename(crcval, 78, "TAN01.VOC");
krename(crcval, 79, "TAN04.VOC");
krename(crcval, 80, "VINESNAP.VOC");
krename(crcval, 81, "VOODRUMS.VOC");
krename(crcval, 82, "WIND54.VOC");
krename(crcval, 83, "DOOMSDAY.MID");
krename(crcval, 84, "DUKE-O.MID");
krename(crcval, 85, "IRIEPRTY.MID");
krename(crcval, 86, "JUNGVEIN.MID");
krename(crcval, 87, "PRTYCRUZ.MID");
krename(crcval, 88, "SOL-MAN1.MID");
krename(crcval, 90, "CINEOV3.ANM");
krename(crcval, 91, "DUKETEAM.ANM");
krename(crcval, 92, "BEACHBAB.CON");
krename(crcval, 93, "BEACHBAL.CON");
krename(crcval, 94, "BEACHBTH.CON");
krename(crcval, 95, "DEFS.CON");
krename(crcval, 96, "DRAGON.CON");
krename(crcval, 97, "GAME.CON");
krename(crcval, 98, "SEAGULL.CON");
krename(crcval, 99, "SOUNDS.CON");
krename(crcval, 100, "USER.CON");
krename(crcval, 101, "DEMO1.DMO");
krename(crcval, 102, "DEMO2.DMO");
krename(crcval, 103, "DEMO3.DMO");
krename(crcval, 104, "VACA1.MAP");
krename(crcval, 105, "VACA2.MAP");
krename(crcval, 106, "VACA3.MAP");
krename(crcval, 107, "VACA4.MAP");
krename(crcval, 108, "VACA5.MAP");
krename(crcval, 109, "VACA6.MAP");
krename(crcval, 110, "VACA7.MAP");
krename(crcval, 111, "VACADM1.MAP");
krename(crcval, 112, "VACADM2.MAP");
krename(crcval, 113, "VACADM3.MAP");
krename(crcval, 114, "VACADM4.MAP");
krename(crcval, 115, "VACASL.MAP");
krename(crcval, 120, "TILES000.ART");
krename(crcval, 121, "TILES001.ART");
krename(crcval, 122, "TILES003.ART");
krename(crcval, 123, "TILES005.ART");
krename(crcval, 124, "TILES006.ART");
krename(crcval, 125, "TILES007.ART");
krename(crcval, 126, "TILES008.ART");
krename(crcval, 127, "TILES009.ART");
krename(crcval, 128, "TILES010.ART");
krename(crcval, 129, "TILES012.ART");
krename(crcval, 130, "TILES014.ART");
}
 
static void process_vacapp15(void)
static void process_vacapp15(int32_t crcval)
{
krename("DEFS.NOC", "DEFS.CON");
krename("GAME.NOC", "GAME.CON");
krename("USER.NOC", "USER.CON");
krename("DEMO1.OMD", "DEMO1.DMO");
krename("DEMO2.OMD", "DEMO2.DMO");
krename("DEMO3.OMD", "DEMO3.DMO");
krename(crcval, 5, "DEFS.CON");
krename(crcval, 6, "GAME.CON");
krename(crcval, 7, "USER.CON");
krename(crcval, 8, "DEMO1.DMO");
krename(crcval, 9, "DEMO2.DMO");
krename(crcval, 10, "DEMO3.DMO");
 
initgroupfile("VACATION.PRG");
}
/polymer/eduke32/source/grpscan.h
63,7 → 63,7
int32_t dependency;
char *scriptname;
char *defname;
void (*postprocessing)(void);
void (*postprocessing)(int32_t);
struct grpfile *next;
} grpfile_type;
 
/polymer/eduke32/source/startgtk.game.c
936,6 → 936,7
{
g_gameNamePtr = grp->name;
g_dependencyCRC = grp->dependency;
g_groupCRC = grp->crcval;
g_postprocessing = grp->postprocessing;
 
if (grp->scriptname && g_scriptNamePtr == NULL)
/polymer/eduke32/source/startwin.game.c
805,6 → 805,7
{
g_gameNamePtr = grp->name;
g_dependencyCRC = grp->dependency;
g_groupCRC = grp->crcval;
g_postprocessing = grp->postprocessing;
 
if (grp->scriptname && g_scriptNamePtr == NULL)