diff --git a/polymer/eduke32/Makefile b/polymer/eduke32/Makefile index c0bac1371..9b9f8e24d 100644 --- a/polymer/eduke32/Makefile +++ b/polymer/eduke32/Makefile @@ -18,6 +18,7 @@ USE_OPENGL = 1 NOASM = 0 LINKED_GTK = 0 BUILD32_ON_64 = 0 +NEDMALLOC = 1 # Debugging/Build options RELEASE?=1 diff --git a/polymer/eduke32/Makefile.msvc b/polymer/eduke32/Makefile.msvc index 59a089e3b..d23a6dd29 100644 --- a/polymer/eduke32/Makefile.msvc +++ b/polymer/eduke32/Makefile.msvc @@ -31,11 +31,11 @@ flags_link=/RELEASE /LTCG DXROOT="C:\Program Files\Microsoft DirectX SDK (February 2010)" -ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DPOLYMER +ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DPOLYMER # /DNEDMALLOC CC=cl AS=ml -LINK=link /nologo /opt:ref +LINK=link /nologo /opt:ref MT=mt CFLAGS= /MT /J /nologo $(flags_cl) \ /I$(INC) /I$(EINC)\msvc /I$(EINC)\ /I$(SRC)\jmact /I$(JAUDIOLIBDIR)\include /I$(ENETDIR)\include \ diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index fa570f47c..6b17df0d3 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -26,6 +26,7 @@ USE_OPENGL ?= 1 NOASM ?= 0 LINKED_GTK ?= 0 BUILD32_ON_64 ?= 0 +NEDMALLOC ?= 1 ifeq (0,$(USE_OPENGL)) POLYMER = 0 @@ -148,8 +149,7 @@ ENGINEOBJS+= \ $(OBJ)/osd.$o \ $(OBJ)/pragmas.$o \ $(OBJ)/scriptfile.$o \ - $(OBJ)/nedmalloc.$o \ - $(OBJ)/mutex.$o + $(OBJ)/mutex.$o ifeq (1,$(USE_OPENGL)) ENGINEOBJS+= $(OBJ)/mdsprite.$o @@ -160,6 +160,10 @@ ifeq (1,$(POLYMER)) ENGINEOBJS+= $(OBJ)/polymer.$o endif +ifeq (1,$(NEDMALLOC)) + ENGINEOBJS+= $(OBJ)/nedmalloc.$o +endif + EDITOROBJS=$(OBJ)/build.$o \ $(OBJ)/config.$o diff --git a/polymer/eduke32/build/Makefile.msvc b/polymer/eduke32/build/Makefile.msvc index e71260ac5..9c1786389 100644 --- a/polymer/eduke32/build/Makefile.msvc +++ b/polymer/eduke32/build/Makefile.msvc @@ -9,7 +9,7 @@ OBJ=obj.msc !endif INC=include\ # !ifndef CFLAGS -CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD /DPOLYMER +CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD /DPOLYMER # /DNEDMALLOC !endif o=obj @@ -76,10 +76,10 @@ ENGINEOBJS= \ $(OBJ)\pragmas.$o \ $(OBJ)\scriptfile.$o \ $(OBJ)\winlayer.$o \ - $(OBJ)\polymer.$o \ - $(OBJ)\nedmalloc.$o \ - $(OBJ)\mutex.$o \ - $(OBJ)\rawinput.$o + $(OBJ)\polymer.$o \ + $(OBJ)\mutex.$o \ + $(OBJ)\rawinput.$o \ +# $(OBJ)\nedmalloc.$o EDITOROBJS=$(OBJ)\build.$o \ $(OBJ)\startwin.editor.$o \ diff --git a/polymer/eduke32/build/Makefile.shared b/polymer/eduke32/build/Makefile.shared index 6e8cf5b18..26025867f 100644 --- a/polymer/eduke32/build/Makefile.shared +++ b/polymer/eduke32/build/Makefile.shared @@ -187,6 +187,10 @@ ifneq (0,$(POLYMER)) endif endif +ifneq (0,$(NEDMALLOC)) + BUILDCFLAGS+= -DNEDMALLOC +endif + ifeq ($(PRETTY_OUTPUT),1) BUILD_STARTED = printf "\033[K\033[1;36mBuild started using \"$(CC) $(OURCFLAGS)\"\033[0m\n" BUILD_FINISHED = printf "\033[K\033[1;36mBuild successful:\033[0m\n" diff --git a/polymer/eduke32/build/include/baselayer.h b/polymer/eduke32/build/include/baselayer.h index 221ae4c2d..88d80f819 100644 --- a/polymer/eduke32/build/include/baselayer.h +++ b/polymer/eduke32/build/include/baselayer.h @@ -12,7 +12,7 @@ extern "C" { #endif -#define SYSTEM_POOL_SIZE (128 * 1048576) +#define SYSTEM_POOL_SIZE (64 * 1048576) extern int32_t _buildargc; extern const char **_buildargv; diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 61cdb17f0..9e767ab16 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -35,11 +35,9 @@ #endif #endif -#define USE_ALLOCATOR 1 -#define USE_MAGIC_HEADERS 1 -#define ENABLE_FAST_HEAP_DETECTION 1 - +#ifdef NEDMALLOC #include "nedmalloc.h" +#endif #ifndef TRUE #define TRUE 1 @@ -382,10 +380,19 @@ int32_t Bclosedir(BDIR *dir); #ifdef __compat_h_macrodef__ # define Brand rand # define Balloca alloca +#ifdef NEDMALLOC # define Bmalloc nedmalloc # define Bcalloc nedcalloc # define Brealloc nedrealloc # define Bfree nedfree +# define Bstrdup nedstrdup +#else +# define Bmalloc malloc +# define Bcalloc calloc +# define Brealloc realloc +# define Bfree free +# define Bstrdup strdup +#endif # define Bopen open # define Bclose close # define Bwrite write @@ -408,7 +415,6 @@ int32_t Bclosedir(BDIR *dir); # define Bfread fread # define Bfwrite fwrite # define Bfprintf fprintf -# define Bstrdup nedstrdup # define Bstrcpy strcpy # define Bstrncpy strncpy # define Bstrcmp strcmp diff --git a/polymer/eduke32/build/include/nedmalloc.h b/polymer/eduke32/build/include/nedmalloc.h index 5f1272ae7..4ea9d93ff 100644 --- a/polymer/eduke32/build/include/nedmalloc.h +++ b/polymer/eduke32/build/include/nedmalloc.h @@ -81,6 +81,16 @@ fashion which may not hold true across OS upgrades. #include /* for size_t */ +#define USE_ALLOCATOR 1 +#define USE_MAGIC_HEADERS 1 +#define MAXTHREADSINPOOL 2 +#define FINEGRAINEDBINS 1 +#define ENABLE_LARGE_PAGES 1 +#define ENABLE_FAST_HEAP_DETECTION 1 +#define NDEBUG 1 +#define THREADCACHEMAX 4194304 +#define THREADCACHEMAXBINS ((22-4)*2) + #ifndef NEDMALLOCEXTSPEC #ifdef NEDMALLOC_DLL_EXPORTS #ifdef WIN32 diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 3deccdf76..670265379 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -54,12 +54,20 @@ int32_t Brand(void) void *Bmalloc(bsize_t size) { +#ifdef NEDMALLOC return nedmalloc(size); +#else + return malloc(size); +#endif } void Bfree(void *ptr) { +#ifdef NEDMALLOC nedfree(ptr); +#else + free(ptr); +#endif } int32_t Bopen(const char *pathname, int32_t flags, uint32_t mode) @@ -157,7 +165,11 @@ bsize_t Bfwrite(const void *ptr, bsize_t size, bsize_t nmemb, BFILE *stream) char *Bstrdup(const char *s) { +#ifdef NEDMALLOC return nedstrdup(s); +#else + return strdup(s); +#endif } char *Bstrcpy(char *dest, const char *src) diff --git a/polymer/eduke32/build/src/config.c b/polymer/eduke32/build/src/config.c index fd5e875e9..7767c3aeb 100644 --- a/polymer/eduke32/build/src/config.c +++ b/polymer/eduke32/build/src/config.c @@ -247,16 +247,8 @@ int32_t loadsetup(const char *fn) if (readconfig(fp, "parlock", val, VL) > 0) ParentalLock = Batoi(val); -#ifdef _WIN32 - { - extern char map_dik_code(int32_t); - for (i=0; i<256; i++) - remap[i]=map_dik_code(i); - } -#else for (i=0; i<256; i++) remap[i]=i; -#endif remapinit=1; if (readconfig(fp, "remap", val, VL) > 0) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 059220d4b..4276788d2 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -6672,7 +6672,9 @@ int32_t loadboard(char *filename, char fromwhere, int32_t *daposx, int32_t *dapo clearbufbyte(&sprite, sizeof(sprite), 0); */ +#ifdef NEDMALLOC nedtrimthreadcache(0, 0); +#endif initspritelists(); diff --git a/polymer/eduke32/build/src/mdsprite.c b/polymer/eduke32/build/src/mdsprite.c index c8b2c31eb..4daa4664c 100644 --- a/polymer/eduke32/build/src/mdsprite.c +++ b/polymer/eduke32/build/src/mdsprite.c @@ -81,7 +81,7 @@ void freevbos() { // OSD_Printf("freeing model %d vbo\n",i); bglDeleteBuffersARB(m->head.numsurfs, m->vbos); - nedpfree(model_data_pool, m->vbos); + Bfree(m->vbos); m->vbos = NULL; } } @@ -101,7 +101,7 @@ void freeallmodels() if (models) { for (i=0; i= nummodelsalloced) { - ml = (mdmodel_t **)nedprealloc(model_data_pool, models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1); + ml = (mdmodel_t **)Brealloc(models,(nummodelsalloced+MODELALLOCGROUP)*sizeof(void*)); if (!ml) return(-1); models = ml; nummodelsalloced += MODELALLOCGROUP; } @@ -310,7 +310,7 @@ int32_t md_defineanimation(int32_t modelid, const char *framestart, const char * ma.fpssc = fpssc; ma.flags = flags; - map = (mdanim_t*)nedpcalloc(model_data_pool, 1,sizeof(mdanim_t)); + map = (mdanim_t*)Bcalloc(1,sizeof(mdanim_t)); if (!map) return(-4); Bmemcpy(map, &ma, sizeof(ma)); @@ -340,13 +340,13 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32 if (sk->palette == (uint8_t)palnum && skinnum == sk->skinnum && surfnum == sk->surfnum) break; if (!sk) { - sk = (mdskinmap_t *)nedpcalloc(model_data_pool, 1,sizeof(mdskinmap_t)); + sk = (mdskinmap_t *)Bcalloc(1,sizeof(mdskinmap_t)); if (!sk) return -4; if (!skl) m->skinmap = sk; else skl->next = sk; } - else if (sk->fn) nedpfree(model_data_pool, sk->fn); + else if (sk->fn) Bfree(sk->fn); sk->palette = (uint8_t)palnum; sk->skinnum = skinnum; @@ -354,7 +354,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32 sk->param = param; sk->specpower = specpower; sk->specfactor = specfactor; - sk->fn = (char *)nedpmalloc(model_data_pool, strlen(skinfn)+1); + sk->fn = (char *)malloc(strlen(skinfn)+1); if (!sk->fn) return(-4); strcpy(sk->fn, skinfn); @@ -418,14 +418,14 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t int32_t r, g, b; picfillen = kfilelength(filh); - picfil = (char *)nedpmalloc(model_data_pool, picfillen+1); if (!picfil) { return -1; } + picfil = (char *)malloc(picfillen+1); if (!picfil) { return -1; } kread(filh, picfil, picfillen); // tsizx/y = replacement texture's natural size // xsiz/y = 2^x size of replacement kpgetdim(picfil,picfillen,&tsizx,&tsizy); - if (tsizx == 0 || tsizy == 0) { nedpfree(model_data_pool, picfil); return -1; } + if (tsizx == 0 || tsizy == 0) { Bfree(picfil); return -1; } if (!glinfo.texnpot) { @@ -438,13 +438,13 @@ static int32_t daskinloader(int32_t filh, intptr_t *fptr, int32_t *bpl, int32_t ysiz = tsizy; } *osizx = tsizx; *osizy = tsizy; - pic = (coltype *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(coltype)); - if (!pic) { nedpfree(model_data_pool, picfil); return -1; } + pic = (coltype *)malloc(xsiz*ysiz*sizeof(coltype)); + if (!pic) { Bfree(picfil); return -1; } memset(pic,0,xsiz*ysiz*sizeof(coltype)); if (kprender(picfil,picfillen,(intptr_t)pic,xsiz*sizeof(coltype),xsiz,ysiz,0,0)) - { nedpfree(model_data_pool, picfil); nedpfree(model_data_pool, pic); return -1; } - nedpfree(model_data_pool, picfil); + { Bfree(picfil); Bfree(pic); return -1; } + Bfree(picfil); cptr = &britable[gammabrightness ? 0 : curbrightness][0]; r=(glinfo.bgra)?hictinting[pal].b:hictinting[pal].r; @@ -621,14 +621,14 @@ static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doa if (alloclen < pict.size) { - void *picc = nedprealloc(model_data_pool, pic, pict.size); + void *picc = Brealloc(pic, pict.size); if (!picc) goto failure; else pic = picc; alloclen = pict.size; - picc = nedprealloc(model_data_pool, packbuf, alloclen+16); + picc = Brealloc(packbuf, alloclen+16); if (!picc) goto failure; else packbuf = picc; - picc = nedprealloc(model_data_pool, midbuf, pict.size); + picc = Brealloc(midbuf, pict.size); if (!picc) goto failure; else midbuf = picc; } @@ -639,14 +639,14 @@ static int32_t mdloadskin_cached(int32_t fil, texcacheheader *head, int32_t *doa if (bglGetError() != GL_NO_ERROR) goto failure; } - if (midbuf) nedpfree(model_data_pool, midbuf); - if (pic) nedpfree(model_data_pool, pic); - if (packbuf) nedpfree(model_data_pool, packbuf); + if (midbuf) Bfree(midbuf); + if (pic) Bfree(pic); + if (packbuf) Bfree(packbuf); return 0; failure: - if (midbuf) nedpfree(model_data_pool, midbuf); - if (pic) nedpfree(model_data_pool, pic); - if (packbuf) nedpfree(model_data_pool, packbuf); + if (midbuf) Bfree(midbuf); + if (pic) Bfree(pic); + if (packbuf) Bfree(packbuf); return -1; } // --------------------------------------------------- JONOF'S COMPRESSED TEXTURE CACHE STUFF @@ -770,7 +770,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf) else if (!hasalpha) intexfmt = GL_RGB; if (glinfo.bgra) texfmt = GL_BGRA; uploadtexture((doalloc&1), xsiz, ysiz, intexfmt, texfmt, (coltype*)fptr, xsiz, ysiz, 0|8192); - nedpfree(model_data_pool, (void*)fptr); + Bfree((void*)fptr); } if (!m->skinloaded) @@ -965,7 +965,7 @@ static void mdloadvbos(md3model_t *m) { int32_t i; - m->vbos = nedpmalloc(model_data_pool, m->head.numsurfs * sizeof(GLuint)); + m->vbos = malloc(m->head.numsurfs * sizeof(GLuint)); bglGenBuffersARB(m->head.numsurfs, m->vbos); i = 0; @@ -989,7 +989,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam) char st[BMAX_PATH]; int32_t i, j, k; - m = (md2model_t *)nedpcalloc(model_data_pool, 1,sizeof(md2model_t)); if (!m) return(0); + m = (md2model_t *)Bcalloc(1,sizeof(md2model_t)); if (!m) return(0); m->mdnum = 2; m->scale = .01f; kread(fil,(char *)&head,sizeof(md2head_t)); @@ -1003,7 +1003,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam) head.ofsframes = B_LITTLE32(head.ofsframes); head.ofsglcmds = B_LITTLE32(head.ofsglcmds); head.ofseof = B_LITTLE32(head.ofseof); - if ((head.id != 0x32504449) || (head.vers != 8)) { nedpfree(model_data_pool, m); return(0); } //"IDP2" + if ((head.id != 0x32504449) || (head.vers != 8)) { Bfree(m); return(0); } //"IDP2" m->numskins = head.numskins; m->numframes = head.numframes; @@ -1011,26 +1011,26 @@ static md2model_t *md2load(int32_t fil, const char *filnam) m->numglcmds = head.numglcmds; m->framebytes = head.framebytes; - m->frames = (char *)nedpcalloc(model_data_pool, m->numframes,m->framebytes); if (!m->frames) { nedpfree(model_data_pool, m); return(0); } - m->glcmds = (int32_t *)nedpcalloc(model_data_pool, m->numglcmds,sizeof(int32_t)); if (!m->glcmds) { nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } - m->tris = (md2tri_t *)nedpcalloc(model_data_pool, head.numtris, sizeof(md2tri_t)); if (!m->tris) { nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } - m->uv = (md2uv_t *)nedpcalloc(model_data_pool, head.numuv, sizeof(md2uv_t)); if (!m->uv) { nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m->frames = (char *)Bcalloc(m->numframes,m->framebytes); if (!m->frames) { Bfree(m); return(0); } + m->glcmds = (int32_t *)Bcalloc(m->numglcmds,sizeof(int32_t)); if (!m->glcmds) { Bfree(m->frames); Bfree(m); return(0); } + m->tris = (md2tri_t *)Bcalloc(head.numtris, sizeof(md2tri_t)); if (!m->tris) { Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } + m->uv = (md2uv_t *)Bcalloc(head.numuv, sizeof(md2uv_t)); if (!m->uv) { Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } klseek(fil,head.ofsframes,SEEK_SET); if (kread(fil,(char *)m->frames,m->numframes*m->framebytes) != m->numframes*m->framebytes) - { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } klseek(fil,head.ofsglcmds,SEEK_SET); if (kread(fil,(char *)m->glcmds,m->numglcmds*sizeof(int32_t)) != (int32_t)(m->numglcmds*sizeof(int32_t))) - { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } klseek(fil,head.ofstris,SEEK_SET); if (kread(fil,(char *)m->tris,head.numtris*sizeof(md2tri_t)) != (int32_t)(head.numtris*sizeof(md2tri_t))) - { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } klseek(fil,head.ofsuv,SEEK_SET); if (kread(fil,(char *)m->uv,head.numuv*sizeof(md2uv_t)) != (int32_t)(head.numuv*sizeof(md2uv_t))) - { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } #if B_BIG_ENDIAN != 0 { @@ -1072,16 +1072,16 @@ static md2model_t *md2load(int32_t fil, const char *filnam) if ((st[i] == '/') || (st[i] == '\\')) { i++; break; } if (i<0) i=0; st[i] = 0; - m->basepath = (char *)nedpmalloc(model_data_pool, i+1); if (!m->basepath) { nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m->basepath = (char *)malloc(i+1); if (!m->basepath) { Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } strcpy(m->basepath, st); - m->skinfn = (char *)nedpcalloc(model_data_pool, m->numskins,64); if (!m->skinfn) { nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m->skinfn = (char *)Bcalloc(m->numskins,64); if (!m->skinfn) { Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } klseek(fil,head.ofsskins,SEEK_SET); if (kread(fil,m->skinfn,64*m->numskins) != 64*m->numskins) - { nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + { Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } - m->texid = (GLuint *)nedpcalloc(model_data_pool, m->numskins, sizeof(GLuint) * (HICEFFECTMASK+1)); - if (!m->texid) { nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m->texid = (GLuint *)Bcalloc(m->numskins, sizeof(GLuint) * (HICEFFECTMASK+1)); + if (!m->texid) { Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } maxmodelverts = max(maxmodelverts, m->numverts); maxmodeltris = max(maxmodeltris, head.numtris); @@ -1090,7 +1090,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam) // the MD2 is now loaded internally - let's begin the MD3 conversion process //OSD_Printf("Beginning md3 conversion.\n"); - m3 = (md3model_t *)nedpcalloc(model_data_pool, 1, sizeof(md3model_t)); if (!m3) { nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m3 = (md3model_t *)Bcalloc(1, sizeof(md3model_t)); if (!m3) { Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } m3->mdnum = 3; m3->texid = 0; m3->scale = m->scale; m3->head.id = 0x33504449; m3->head.vers = 15; // this changes the conversion code to do real MD2->MD3 conversion @@ -1104,8 +1104,8 @@ static md2model_t *md2load(int32_t fil, const char *filnam) m3->numskins = m3->head.numskins; m3->numframes = m3->head.numframes; - m3->head.frames = (md3frame_t *)nedpcalloc(model_data_pool, m3->head.numframes, sizeof(md3frame_t)); if (!m3->head.frames) { nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } - m3->muladdframes = (point3d *)nedpcalloc(model_data_pool, m->numframes * 2, sizeof(point3d)); + m3->head.frames = (md3frame_t *)Bcalloc(m3->head.numframes, sizeof(md3frame_t)); if (!m3->head.frames) { Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } + m3->muladdframes = (point3d *)Bcalloc(m->numframes * 2, sizeof(point3d)); f = (md2frame_t *)(m->frames); @@ -1123,7 +1123,7 @@ static md2model_t *md2load(int32_t fil, const char *filnam) m3->head.tags = NULL; - m3->head.surfs = (md3surf_t *)nedpcalloc(model_data_pool, 1, sizeof(md3surf_t)); if (!m3->head.surfs) { nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + m3->head.surfs = (md3surf_t *)Bcalloc(1, sizeof(md3surf_t)); if (!m3->head.surfs) { Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } s = m3->head.surfs; // model converting @@ -1140,9 +1140,9 @@ static md2model_t *md2load(int32_t fil, const char *filnam) s->shaders = NULL; - s->tris = (md3tri_t *)nedpcalloc(model_data_pool, head.numtris, sizeof(md3tri_t)); if (!s->tris) { nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } - s->uv = (md3uv_t *)nedpcalloc(model_data_pool, s->numverts, sizeof(md3uv_t)); if (!s->uv) { nedpfree(model_data_pool, s->tris); nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } - s->xyzn = (md3xyzn_t *)nedpcalloc(model_data_pool, s->numverts * m->numframes, sizeof(md3xyzn_t)); if (!s->xyzn) { nedpfree(model_data_pool, s->uv); nedpfree(model_data_pool, s->tris); nedpfree(model_data_pool, s); nedpfree(model_data_pool, m3->head.frames); nedpfree(model_data_pool, m3); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); return(0); } + s->tris = (md3tri_t *)Bcalloc(head.numtris, sizeof(md3tri_t)); if (!s->tris) { Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } + s->uv = (md3uv_t *)Bcalloc(s->numverts, sizeof(md3uv_t)); if (!s->uv) { Bfree(s->tris); Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } + s->xyzn = (md3xyzn_t *)Bcalloc(s->numverts * m->numframes, sizeof(md3xyzn_t)); if (!s->xyzn) { Bfree(s->uv); Bfree(s->tris); Bfree(s); Bfree(m3->head.frames); Bfree(m3); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return(0); } //memoryusage += (s->numverts * m->numframes * sizeof(md3xyzn_t)); //OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage); @@ -1196,28 +1196,28 @@ static md2model_t *md2load(int32_t fil, const char *filnam) { mdskinmap_t *sk; - sk = (mdskinmap_t *)nedpcalloc(model_data_pool, 1,sizeof(mdskinmap_t)); + sk = (mdskinmap_t *)Bcalloc(1,sizeof(mdskinmap_t)); sk->palette = 0; sk->skinnum = 0; sk->surfnum = 0; if (m->numskins > 0) { - sk->fn = (char *)nedpmalloc(model_data_pool, strlen(m->basepath)+strlen(m->skinfn)+1); + sk->fn = (char *)malloc(strlen(m->basepath)+strlen(m->skinfn)+1); strcpy(sk->fn, m->basepath); strcat(sk->fn, m->skinfn); } m3->skinmap = sk; } - m3->indexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * s->numtris); - m3->vindexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * s->numtris * 3); - m3->maxdepths = nedpmalloc(model_data_pool, sizeof(float) * s->numtris); + m3->indexes = malloc(sizeof(uint16_t) * s->numtris); + m3->vindexes = malloc(sizeof(uint16_t) * s->numtris * 3); + m3->maxdepths = malloc(sizeof(float) * s->numtris); m3->vbos = NULL; // die MD2 ! DIE ! - nedpfree(model_data_pool, m->texid); nedpfree(model_data_pool, m->skinfn); nedpfree(model_data_pool, m->basepath); nedpfree(model_data_pool, m->uv); nedpfree(model_data_pool, m->tris); nedpfree(model_data_pool, m->glcmds); nedpfree(model_data_pool, m->frames); nedpfree(model_data_pool, m); + Bfree(m->texid); Bfree(m->skinfn); Bfree(m->basepath); Bfree(m->uv); Bfree(m->tris); Bfree(m->glcmds); Bfree(m->frames); Bfree(m); return((md2model_t *)m3); } @@ -1278,7 +1278,7 @@ static md3model_t *md3load(int32_t fil) md3model_t *m; md3surf_t *s; - m = (md3model_t *)nedpcalloc(model_data_pool, 1,sizeof(md3model_t)); if (!m) return(0); + m = (md3model_t *)Bcalloc(1,sizeof(md3model_t)); if (!m) return(0); m->mdnum = 3; m->texid = 0; m->scale = .01f; m->muladdframes = NULL; @@ -1291,7 +1291,7 @@ static md3model_t *md3load(int32_t fil) m->head.ofstags = B_LITTLE32(m->head.ofstags); m->head.ofssurfs = B_LITTLE32(m->head.ofssurfs); m->head.eof = B_LITTLE32(m->head.eof); - if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { nedpfree(model_data_pool, m); return(0); } //"IDP3" + if ((m->head.id != 0x33504449) && (m->head.vers != 15)) { Bfree(m); return(0); } //"IDP3" m->numskins = m->head.numskins; //<- dead code? m->numframes = m->head.numframes; @@ -1299,19 +1299,19 @@ static md3model_t *md3load(int32_t fil) ofsurf = m->head.ofssurfs; klseek(fil,m->head.ofsframes,SEEK_SET); i = m->head.numframes*sizeof(md3frame_t); - m->head.frames = (md3frame_t *)nedpmalloc(model_data_pool, i); if (!m->head.frames) { nedpfree(model_data_pool, m); return(0); } + m->head.frames = (md3frame_t *)malloc(i); if (!m->head.frames) { Bfree(m); return(0); } kread(fil,m->head.frames,i); if (m->head.numtags == 0) m->head.tags = NULL; else { klseek(fil,m->head.ofstags,SEEK_SET); i = m->head.numtags*sizeof(md3tag_t); - m->head.tags = (md3tag_t *)nedpmalloc(model_data_pool, i); if (!m->head.tags) { nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0); } + m->head.tags = (md3tag_t *)malloc(i); if (!m->head.tags) { Bfree(m->head.frames); Bfree(m); return(0); } kread(fil,m->head.tags,i); } klseek(fil,m->head.ofssurfs,SEEK_SET); i = m->head.numsurfs*sizeof(md3surf_t); - m->head.surfs = (md3surf_t *)nedpmalloc(model_data_pool, i); if (!m->head.surfs) { if (m->head.tags) nedpfree(model_data_pool, m->head.tags); nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0); } + m->head.surfs = (md3surf_t *)malloc(i); if (!m->head.surfs) { if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); } #if B_BIG_ENDIAN != 0 { @@ -1355,11 +1355,11 @@ static md3model_t *md3load(int32_t fil) //OSD_Printf("Current model geometry memory usage : %i.\n", memoryusage); - s->tris = (md3tri_t *)nedpmalloc(model_data_pool, leng[0]+leng[1]+leng[2]+leng[3]); + s->tris = (md3tri_t *)malloc(leng[0]+leng[1]+leng[2]+leng[3]); if (!s->tris) { - for (surfi--; surfi>=0; surfi--) nedpfree(model_data_pool, m->head.surfs[surfi].tris); - if (m->head.tags) nedpfree(model_data_pool, m->head.tags); nedpfree(model_data_pool, m->head.frames); nedpfree(model_data_pool, m); return(0); + for (surfi--; surfi>=0; surfi--) Bfree(m->head.surfs[surfi].tris); + if (m->head.tags) Bfree(m->head.tags); Bfree(m->head.frames); Bfree(m); return(0); } s->shaders = (md3shader_t *)(((intptr_t)s->tris)+leng[0]); s->uv = (md3uv_t *)(((intptr_t)s->shaders)+leng[1]); @@ -1428,9 +1428,9 @@ static md3model_t *md3load(int32_t fil) } #endif - m->indexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * maxtrispersurf); - m->vindexes = nedpmalloc(model_data_pool, sizeof(uint16_t) * maxtrispersurf * 3); - m->maxdepths = nedpmalloc(model_data_pool, sizeof(float) * maxtrispersurf); + m->indexes = malloc(sizeof(uint16_t) * maxtrispersurf); + m->vindexes = malloc(sizeof(uint16_t) * maxtrispersurf * 3); + m->maxdepths = malloc(sizeof(float) * maxtrispersurf); m->vbos = NULL; @@ -1580,9 +1580,9 @@ static int md3postload(md3model_t* m) { s = &m->head.surfs[surfi]; - s->geometry = nedpcalloc(model_data_pool, m->head.numframes * s->numverts * sizeof(float), 15); + s->geometry = Bcalloc(m->head.numframes * s->numverts * sizeof(float), 15); - numtris = nedpcalloc(model_data_pool, s->numverts, sizeof(int)); + numtris = Bcalloc(s->numverts, sizeof(int)); verti = 0; while (verti < (m->head.numframes * s->numverts)) @@ -1611,7 +1611,7 @@ static int md3postload(md3model_t* m) s->tris[trii].i[1] >= s->numverts || s->tris[trii].i[1] < 0 || s->tris[trii].i[2] >= s->numverts || s->tris[trii].i[2] < 0) { // corrupt model - nedpfree(model_data_pool, numtris); + Bfree(numtris); OSD_Printf("Triangle index out of bounds!\n"); return 0; } @@ -1693,7 +1693,7 @@ static int md3postload(md3model_t* m) verti++; } - nedpfree(model_data_pool, numtris); + Bfree(numtris); surfi++; } @@ -2232,13 +2232,13 @@ static void md3free(md3model_t *m) for (anim=m->animations; anim; anim=nanim) { nanim = anim->next; - nedpfree(model_data_pool, anim); + Bfree(anim); } for (sk=m->skinmap; sk; sk=nsk) { nsk = sk->next; - nedpfree(model_data_pool, sk->fn); - nedpfree(model_data_pool, sk); + Bfree(sk->fn); + Bfree(sk); } if (m->head.surfs) @@ -2246,35 +2246,35 @@ static void md3free(md3model_t *m) for (surfi=m->head.numsurfs-1; surfi>=0; surfi--) { s = &m->head.surfs[surfi]; - if (s->tris) nedpfree(model_data_pool, s->tris); + if (s->tris) Bfree(s->tris); if (m->head.flags == 1337) { - if (s->shaders) nedpfree(model_data_pool, s->shaders); - if (s->uv) nedpfree(model_data_pool, s->uv); - if (s->xyzn) nedpfree(model_data_pool, s->xyzn); + if (s->shaders) Bfree(s->shaders); + if (s->uv) Bfree(s->uv); + if (s->xyzn) Bfree(s->xyzn); } } - nedpfree(model_data_pool, m->head.surfs); + Bfree(m->head.surfs); } - if (m->head.tags) nedpfree(model_data_pool, m->head.tags); - if (m->head.frames) nedpfree(model_data_pool, m->head.frames); + if (m->head.tags) Bfree(m->head.tags); + if (m->head.frames) Bfree(m->head.frames); - if (m->texid) nedpfree(model_data_pool, m->texid); + if (m->texid) Bfree(m->texid); - if (m->muladdframes) nedpfree(model_data_pool, m->muladdframes); + if (m->muladdframes) Bfree(m->muladdframes); - if (m->indexes) nedpfree(model_data_pool, m->indexes); - if (m->vindexes) nedpfree(model_data_pool, m->vindexes); - if (m->maxdepths) nedpfree(model_data_pool, m->maxdepths); + if (m->indexes) Bfree(m->indexes); + if (m->vindexes) Bfree(m->vindexes); + if (m->maxdepths) Bfree(m->maxdepths); if (m->vbos) { bglDeleteBuffersARB(m->head.numsurfs, m->vbos); - nedpfree(model_data_pool, m->vbos); + Bfree(m->vbos); m->vbos = NULL; } - nedpfree(model_data_pool, m); + Bfree(m); } //---------------------------------------- MD3 LIBRARY ENDS ---------------------------------------- @@ -2301,7 +2301,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i int32_t i; pic = (coltype *)picbuf; //Correct for GL's RGB order; also apply gamma here.. - pic2 = (coltype *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1); + pic2 = (coltype *)malloc(xsiz*ysiz*sizeof(int32_t)); if (!pic2) return((unsigned)-1); cptr = (char*)&britable[gammabrightness ? 0 : curbrightness][0]; if (!is8bit) { @@ -2330,7 +2330,7 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST); bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST); bglTexImage2D(GL_TEXTURE_2D,0,4,xsiz,ysiz,0,GL_RGBA,GL_UNSIGNED_BYTE,(char *)pic2); - nedpfree(model_data_pool, pic2); + Bfree(pic2); return(rtexid); } @@ -2344,7 +2344,7 @@ static int32_t getvox(int32_t x, int32_t y, int32_t z) static void putvox(int32_t x, int32_t y, int32_t z, int32_t col) { - if (vnum >= vmax) { vmax = max(vmax<<1,4096); vcol = (voxcol_t *)nedprealloc(model_data_pool, vcol,vmax*sizeof(voxcol_t)); } + if (vnum >= vmax) { vmax = max(vmax<<1,4096); vcol = (voxcol_t *)Brealloc(vcol,vmax*sizeof(voxcol_t)); } z += x*yzsiz + y*zsiz; vcol[vnum].p = z; z = ((z*214013)&vcolhashsizm1); @@ -2552,7 +2552,7 @@ static voxmodel_t *vox2poly() int32_t i, j, x, y, z, v, ov, oz = 0, cnt, sc, x0, y0, dx, dy,*bx0, *by0; void (*daquad)(int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t); - gvox = (voxmodel_t *)nedpmalloc(model_data_pool, sizeof(voxmodel_t)); if (!gvox) return(0); + gvox = (voxmodel_t *)malloc(sizeof(voxmodel_t)); if (!gvox) return(0); memset(gvox,0,sizeof(voxmodel_t)); //x is largest dimension, y is 2nd largest dimension @@ -2560,7 +2560,7 @@ static voxmodel_t *vox2poly() if ((x < y) && (x < z)) x = z; else if (y < z) y = z; if (x < y) { z = x; x = y; y = z; } shcntp = x; i = x*y*sizeof(int32_t); - shcntmal = (int32_t *)nedpmalloc(model_data_pool, i); if (!shcntmal) { nedpfree(model_data_pool, gvox); return(0); } + shcntmal = (int32_t *)malloc(i); if (!shcntmal) { Bfree(gvox); return(0); } memset(shcntmal,0,i); shcnt = &shcntmal[-shcntp-1]; gmaxx = gmaxy = garea = 0; @@ -2568,7 +2568,7 @@ static voxmodel_t *vox2poly() for (i=0; i<7; i++) gvox->qfacind[i] = -1; i = ((max(ysiz,zsiz)+1)<<2); - bx0 = (int32_t *)nedpmalloc(model_data_pool, i<<1); if (!bx0) { nedpfree(model_data_pool, gvox); return(0); } + bx0 = (int32_t *)malloc(i<<1); if (!bx0) { Bfree(gvox); return(0); } by0 = (int32_t *)(((intptr_t)bx0)+i); for (cnt=0; cnt<2; cnt++) @@ -2614,8 +2614,8 @@ static voxmodel_t *vox2poly() if (!cnt) { - shp = (spoint2d *)nedpmalloc(model_data_pool, gvox->qcnt*sizeof(spoint2d)); - if (!shp) { nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); } + shp = (spoint2d *)malloc(gvox->qcnt*sizeof(spoint2d)); + if (!shp) { Bfree(bx0); Bfree(gvox); return(0); } sc = 0; for (y=gmaxy; y; y--) @@ -2636,7 +2636,7 @@ skindidntfit: mytexo5 = (gvox->mytexx>>5); i = (((gvox->mytexx*gvox->mytexy+31)>>5)<<2); - zbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!zbit) { nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); nedpfree(model_data_pool, shp); return(0); } + zbit = (int32_t *)malloc(i); if (!zbit) { Bfree(bx0); Bfree(gvox); Bfree(shp); return(0); } memset(zbit,0,i); v = gvox->mytexx*gvox->mytexy; @@ -2655,7 +2655,7 @@ skindidntfit: i--; if (i < 0) //Time-out! Very slow if this happens... but at least it still works :P { - nedpfree(model_data_pool, zbit); + Bfree(zbit); //Re-generate shp[].x/y (box sizes) from shcnt (now head indices) for next pass :/ j = 0; @@ -2678,14 +2678,14 @@ skindidntfit: shp[z].x = x0; shp[z].y = y0; //Overwrite size with top-left location } - gvox->quad = (voxrect_t *)nedpmalloc(model_data_pool, gvox->qcnt*sizeof(voxrect_t)); - if (!gvox->quad) { nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, shp); nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); } + gvox->quad = (voxrect_t *)malloc(gvox->qcnt*sizeof(voxrect_t)); + if (!gvox->quad) { Bfree(zbit); Bfree(shp); Bfree(bx0); Bfree(gvox); return(0); } - gvox->mytex = (int32_t *)nedpmalloc(model_data_pool, gvox->mytexx*gvox->mytexy*sizeof(int32_t)); - if (!gvox->mytex) { nedpfree(model_data_pool, gvox->quad); nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, shp); nedpfree(model_data_pool, bx0); nedpfree(model_data_pool, gvox); return(0); } + gvox->mytex = (int32_t *)malloc(gvox->mytexx*gvox->mytexy*sizeof(int32_t)); + if (!gvox->mytex) { Bfree(gvox->quad); Bfree(zbit); Bfree(shp); Bfree(bx0); Bfree(gvox); return(0); } } } - nedpfree(model_data_pool, shp); nedpfree(model_data_pool, zbit); nedpfree(model_data_pool, bx0); + Bfree(shp); Bfree(zbit); Bfree(bx0); return(gvox); } @@ -2708,14 +2708,14 @@ static int32_t loadvox(const char *filnam) pal[255] = -1; vcolhashsizm1 = 8192-1; - vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } + vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { kclose(fil); return(-1); } + vbit = (int32_t *)malloc(i); if (!vbit) { kclose(fil); return(-1); } memset(vbit,0,i); - tbuf = (char *)nedpmalloc(model_data_pool, zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); } + tbuf = (char *)malloc(zsiz*sizeof(uint8_t)); if (!tbuf) { kclose(fil); return(-1); } klseek(fil,12,SEEK_SET); for (x=0; x=0; i--) xyoffs[i] = B_LITTLE16(xyoffs[i]); klseek(fil,-768,SEEK_END); @@ -2775,17 +2775,17 @@ static int32_t loadkvx(const char *filnam) { kread(fil,c,3); pal[i] = B_LITTLE32((((int32_t)c[0])<<18)+(((int32_t)c[1])<<10)+(((int32_t)c[2])<<2)+(i<<24)); } yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); } + vbit = (int32_t *)malloc(i); if (!vbit) { Bfree(xyoffs); kclose(fil); return(-1); } memset(vbit,0,i); for (vcolhashsizm1=4096; vcolhashsizm1<(mip1leng>>1); vcolhashsizm1<<=1); vcolhashsizm1--; //approx to numvoxs! - vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); } + vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { Bfree(xyoffs); kclose(fil); return(-1); } memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); klseek(fil,28+((xsiz+1)<<2)+((ysizp1*xsiz)<<1),SEEK_SET); i = kfilelength(fil)-ktell(fil); - tbuf = (char *)nedpmalloc(model_data_pool, i); if (!tbuf) { nedpfree(model_data_pool, xyoffs); kclose(fil); return(-1); } + tbuf = (char *)malloc(i); if (!tbuf) { Bfree(xyoffs); kclose(fil); return(-1); } kread(fil,tbuf,i); kclose(fil); cptr = tbuf; @@ -2804,7 +2804,7 @@ static int32_t loadkvx(const char *filnam) } } - nedpfree(model_data_pool, tbuf); nedpfree(model_data_pool, xyoffs); return(0); + Bfree(tbuf); Bfree(xyoffs); return(0); } static int32_t loadkv6(const char *filnam) @@ -2823,7 +2823,7 @@ static int32_t loadkv6(const char *filnam) kread(fil,&i,4); zpiv = (float)(B_LITTLE32(i)); kread(fil,&numvoxs,4); numvoxs = B_LITTLE32(numvoxs); - ylen = (uint16_t *)nedpmalloc(model_data_pool, xsiz*ysiz*sizeof(int16_t)); + ylen = (uint16_t *)malloc(xsiz*ysiz*sizeof(int16_t)); if (!ylen) { kclose(fil); return(-1); } klseek(fil,32+(numvoxs<<3)+(xsiz<<2),SEEK_SET); @@ -2831,11 +2831,11 @@ static int32_t loadkv6(const char *filnam) klseek(fil,32,SEEK_SET); yzsiz = ysiz*zsiz; i = ((xsiz*yzsiz+31)>>3); - vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { nedpfree(model_data_pool, ylen); kclose(fil); return(-1); } + vbit = (int32_t *)malloc(i); if (!vbit) { Bfree(ylen); kclose(fil); return(-1); } memset(vbit,0,i); for (vcolhashsizm1=4096; vcolhashsizm1>3); - vbit = (int32_t *)nedpmalloc(model_data_pool, i); if (!vbit) { kclose(fil); return(-1); } + vbit = (int32_t *)malloc(i); if (!vbit) { kclose(fil); return(-1); } memset(vbit,-1,i); vcolhashsizm1 = 1048576-1; - vcolhashead = (int32_t *)nedpmalloc(model_data_pool, (vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } + vcolhashead = (int32_t *)malloc((vcolhashsizm1+1)*sizeof(int32_t)); if (!vcolhashead) { kclose(fil); return(-1); } memset(vcolhashead,-1,(vcolhashsizm1+1)*sizeof(int32_t)); //Allocate huge buffer and load rest of file into it... i = kfilelength(fil)-ktell(fil); - vbuf = (char *)nedpmalloc(model_data_pool, i); if (!vbuf) { kclose(fil); return(-1); } + vbuf = (char *)malloc(i); if (!vbuf) { kclose(fil); return(-1); } kread(fil,vbuf,i); kclose(fil); @@ -2901,17 +2901,17 @@ static int32_t loadvxl(const char *filnam) } v += ((((int32_t)v[2])-((int32_t)v[1])+2)<<2); } - nedpfree(model_data_pool, vbuf); return(0); + Bfree(vbuf); return(0); } #endif void voxfree(voxmodel_t *m) { if (!m) return; - if (m->mytex) nedpfree(model_data_pool, m->mytex); - if (m->quad) nedpfree(model_data_pool, m->quad); - if (m->texid) nedpfree(model_data_pool, m->texid); - nedpfree(model_data_pool, m); + if (m->mytex) Bfree(m->mytex); + if (m->quad) Bfree(m->quad); + if (m->texid) Bfree(m->texid); + Bfree(m); } voxmodel_t *voxload(const char *filnam) @@ -2934,13 +2934,13 @@ voxmodel_t *voxload(const char *filnam) vm->xpiv = xpiv; vm->ypiv = ypiv; vm->zpiv = zpiv; vm->is8bit = is8bit; - vm->texid = (uint32_t *)nedpcalloc(model_data_pool, MAXPALOOKUPS,sizeof(uint32_t)); + vm->texid = (uint32_t *)Bcalloc(MAXPALOOKUPS,sizeof(uint32_t)); if (!vm->texid) { voxfree(vm); vm = 0; } } - if (shcntmal) { nedpfree(model_data_pool, shcntmal); shcntmal = 0; } - if (vbit) { nedpfree(model_data_pool, vbit); vbit = 0; } - if (vcol) { nedpfree(model_data_pool, vcol); vcol = 0; vnum = 0; vmax = 0; } - if (vcolhashead) { nedpfree(model_data_pool, vcolhashead); vcolhashead = 0; } + if (shcntmal) { Bfree(shcntmal); shcntmal = 0; } + if (vbit) { Bfree(vbit); vbit = 0; } + if (vcol) { Bfree(vcol); vcol = 0; vnum = 0; vmax = 0; } + if (vcolhashead) { Bfree(vcolhashead); vcolhashead = 0; } return(vm); } @@ -3135,8 +3135,8 @@ int32_t mddraw(spritetype *tspr) if (r_vbos && (r_vbocount > allocvbos)) { - indexvbos = nedprealloc(model_data_pool, indexvbos, sizeof(GLuint) * r_vbocount); - vertvbos = nedprealloc(model_data_pool, vertvbos, sizeof(GLuint) * r_vbocount); + indexvbos = Brealloc(indexvbos, sizeof(GLuint) * r_vbocount); + vertvbos = Brealloc(vertvbos, sizeof(GLuint) * r_vbocount); bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos])); bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos])); @@ -3159,7 +3159,7 @@ int32_t mddraw(spritetype *tspr) if (maxmodelverts > allocmodelverts) { - point3d *vl = (point3d *)nedprealloc(model_data_pool, vertlist,sizeof(point3d)*maxmodelverts); + point3d *vl = (point3d *)Brealloc(vertlist,sizeof(point3d)*maxmodelverts); if (!vl) { OSD_Printf("ERROR: Not enough memory to allocate %d vertices!\n",maxmodelverts); return 0; } vertlist = vl; allocmodelverts = maxmodelverts; diff --git a/polymer/eduke32/build/src/nedmalloc.c b/polymer/eduke32/build/src/nedmalloc.c index 62284b038..3ab973742 100644 --- a/polymer/eduke32/build/src/nedmalloc.c +++ b/polymer/eduke32/build/src/nedmalloc.c @@ -36,15 +36,6 @@ DEALINGS IN THE SOFTWARE. #pragma warning(disable:4706) /* assignment within conditional expression */ #endif -#define USE_ALLOCATOR 1 -#define USE_MAGIC_HEADERS 1 -#define MAXTHREADSINPOOL 1 -#define FINEGRAINEDBINS 1 -#define ENABLE_LARGE_PAGES 1 -#define ENABLE_FAST_HEAP_DETECTION 1 -#define NDEBUG 1 -#define THREADCACHEMAX 32768 -#define THREADCACHEMAXBINS ((15-4)*2) /*#define ENABLE_TOLERANT_NEDMALLOC 1*/ /*#define ENABLE_FAST_HEAP_DETECTION 1*/ /*#define NEDMALLOC_DEBUG 1*/ diff --git a/polymer/eduke32/build/src/sdlayer.c b/polymer/eduke32/build/src/sdlayer.c index 3003a63f7..8dc44808a 100644 --- a/polymer/eduke32/build/src/sdlayer.c +++ b/polymer/eduke32/build/src/sdlayer.c @@ -173,8 +173,10 @@ int32_t main(int32_t argc, char *argv[]) char *argp; FILE *fp; +#ifdef NEDMALLOC nedcreatepool(SYSTEM_POOL_SIZE, -1); -// atexit(neddestroysyspool); + // atexit(neddestroysyspool); +#endif buildkeytranslationtable(); diff --git a/polymer/eduke32/build/src/winlayer.c b/polymer/eduke32/build/src/winlayer.c index b37595629..24ead37f3 100644 --- a/polymer/eduke32/build/src/winlayer.c +++ b/polymer/eduke32/build/src/winlayer.c @@ -39,6 +39,7 @@ #include "a.h" #include "osd.h" #include "rawinput.h" +#include "nedmalloc.h" // undefine to restrict windowed resolutions to conventional sizes #define ANY_WINDOWED_SIZE @@ -85,7 +86,7 @@ static void ReleaseDirectDrawSurfaces(void); static BOOL InitDirectInput(void); static void UninitDirectInput(void); static void GetKeyNames(void); -static void AcquireInputDevices(char acquire, int8_t device); +static void AcquireInputDevices(char acquire); static inline void DI_PollJoysticks(void); static int32_t SetupDirectDraw(int32_t width, int32_t height); static void UninitDIB(void); @@ -132,7 +133,11 @@ int32_t remapinit=0; static char key_names[256][24]; static OSVERSIONINFOEX osv; +#ifdef NEDMALLOC extern int32_t largepagesavailable; +#else +static HMODULE nedhandle = NULL; +#endif void (*keypresscallback)(int32_t,int32_t) = 0; void (*mousepresscallback)(int32_t,int32_t) = 0; @@ -286,6 +291,7 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in return -1; } +#ifdef NEDMALLOC /* Attempt to enable SeLockMemoryPrivilege, 2003/Vista/7 only */ if (Bgetenv("BUILD_NOLARGEPAGES") == NULL && (osv.dwMajorVersion >= 6 || (osv.dwMajorVersion == 5 && osv.dwMinorVersion == 2))) @@ -310,8 +316,16 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in } nedcreatepool(SYSTEM_POOL_SIZE, -1); + // atexit(neddestroysyspool); +#else + if ((nedhandle = LoadLibrary("nedmalloc.dll"))) + { + nedpool *(WINAPI *nedcreatepool)(size_t, int); -// atexit(neddestroysyspool); + if ((nedcreatepool = (void *)GetProcAddress(nedhandle, "nedcreatepool"))) + nedcreatepool(SYSTEM_POOL_SIZE, -1); + } +#endif hdc = GetDC(NULL); r = GetDeviceCaps(hdc, BITSPIXEL); @@ -430,7 +444,7 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in MB_OK|MB_ICONINFORMATION); #endif -// atexit(uninitsystem); + // atexit(uninitsystem); instanceflag = CreateSemaphore(NULL, 1,1, WindowClass); @@ -528,12 +542,19 @@ static void printsysversion(void) break; } - initprintf("Running under Windows %s (build %lu.%lu.%lu) %s\n", ver, osv.dwMajorVersion, osv.dwMinorVersion, + initprintf("Running under Windows %s (build %lu.%lu.%lu) %s", ver, osv.dwMajorVersion, osv.dwMinorVersion, osv.dwPlatformId == VER_PLATFORM_WIN32_NT ? osv.dwBuildNumber : osv.dwBuildNumber&0xffff, osv.szCSDVersion); +#ifdef NEDMALLOC + initprintf("\n"); + if (largepagesavailable) initprintf("Large page support available\n"); +#else + if (nedhandle) initprintf("with nedmalloc\n"); +#endif + } @@ -541,7 +562,7 @@ int32_t initsystem(void) { DEVMODE desktopmode; -// initprintf("Initializing Windows DirectX/GDI system interface\n"); + // initprintf("Initializing Windows DirectX/GDI system interface\n"); // get the desktop dimensions before anything changes them ZeroMemory(&desktopmode, sizeof(DEVMODE)); @@ -596,6 +617,10 @@ void uninitsystem(void) #if defined(USE_OPENGL) && defined(POLYMOST) unloadgldriver(); #endif + +#ifndef NEDMALLOC + if (nedhandle) FreeLibrary(nedhandle), nedhandle = NULL; +#endif } @@ -671,18 +696,20 @@ int32_t handleevents(void) while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { - if (msg.message == WM_QUIT) - quitevent = 1; - - if (startwin_idle((void*)&msg) > 0) continue; - - if (msg.message == WM_INPUT) + switch (msg.message) { - RI_PollDevices(FALSE); + case WM_QUIT: + quitevent = 1; + continue; + case WM_INPUT: + // this call to RI_PollDevices() probably isn't necessary + // RI_PollDevices(FALSE); RI_ProcessMessage(&msg); continue; } + if (startwin_idle((void*)&msg) > 0) continue; + TranslateMessage(&msg); DispatchMessage(&msg); } @@ -699,31 +726,25 @@ int32_t handleevents(void) //================================================================================================= #define JOYSTICK 0 -#define NUM_INPUTS 1 static HMODULE hDInputDLL = NULL; static LPDIRECTINPUT7A lpDI = NULL; -static LPDIRECTINPUTDEVICE7A lpDID[NUM_INPUTS] = { NULL }; +static LPDIRECTINPUTDEVICE7A lpDID = NULL; #define INPUT_BUFFER_SIZE 32 -static GUID guidDevs[NUM_INPUTS]; +static GUID guidDevs; -static char devacquired[NUM_INPUTS]; -static HANDLE inputevt[NUM_INPUTS]; +static char di_devacquired; +static HANDLE di_inputevt; static int32_t joyblast=0; volatile uint8_t moustat = 0, mousegrab = 0; -static uint32_t idevnums[NUM_INPUTS], numdevs = 0; -static HANDLE waithnds[NUM_INPUTS]; - static struct { char *name; LPDIRECTINPUTDEVICE7A *did; const DIDATAFORMAT *df; -} devicedef[NUM_INPUTS] = -{ - { "joystick", &lpDID[JOYSTICK], &c_dfDIJoystick } -}; +} devicedef = { "joystick", &lpDID, &c_dfDIJoystick }; + static struct _joydef { const char *name; @@ -736,7 +757,7 @@ inline void SetKey(int32_t key, int32_t state) { keystatus[remap[key]] = state; - if (state) + if (state) { keyfifo[keyfifoend] = remap[key]; keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; @@ -744,42 +765,37 @@ inline void SetKey(int32_t key, int32_t state) } } -char map_dik_code(int32_t scanCode) -{ - // ugly table for remapping out of range DIK_ entries will go here - // if I can't figure out the layout problem - return scanCode; -} - // // initinput() -- init input system // int32_t initinput(void) { int32_t i; + char layoutname[KL_NAMELENGTH]; + moustat=0; memset(keystatus, 0, sizeof(keystatus)); + if (!remapinit) for (i=0; i<256; i++) - remap[i]=map_dik_code(i); + remap[i]=i; + remapinit=1; keyfifoplc = keyfifoend = 0; keyasciififoplc = keyasciififoend = 0; inputdevices = 1|2; - joyisgamepad=0, joynumaxes=0, joynumbuttons=0, joynumhats=0; + joyisgamepad = joynumaxes = joynumbuttons = joynumhats=0; // 00000409 is "American English" + + GetKeyboardLayoutName(layoutname); + if (Bstrcmp(layoutname, "00000409")) { - char layoutname[KL_NAMELENGTH]; + initprintf("Switching kb layout from %s ",layoutname); + LoadKeyboardLayout("00000409", KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK); GetKeyboardLayoutName(layoutname); - if (Bstrcmp(layoutname, "00000409")) - { - initprintf("Switching kb layout from %s ",layoutname); - LoadKeyboardLayout("00000409", KLF_ACTIVATE|KLF_SETFORPROCESS|KLF_SUBSTITUTE_OK); - GetKeyboardLayoutName(layoutname); - initprintf("to %s\n",layoutname); - } + initprintf("to %s\n",layoutname); } GetKeyNames(); @@ -858,7 +874,7 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) DIPROPDWORD dipdw; HRESULT result; - if (!lpDID[JOYSTICK]) return; + if (!lpDID) return; if (dead > 10000) dead = 10000; if (satur > 10000) satur = 10000; @@ -880,8 +896,8 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) } dipdw.dwData = dead; - result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph); - if FAILED(result) + result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); + if (FAILED(result)) { //ShowDInputErrorBox("Failed setting joystick dead zone", result); initprintf("Failed setting joystick dead zone: %s\n", GetDInputError(result)); @@ -890,8 +906,8 @@ void setjoydeadzone(int32_t axis, uint16_t dead, uint16_t satur) dipdw.dwData = satur; - result = IDirectInputDevice7_SetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph); - if FAILED(result) + result = IDirectInputDevice7_SetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); + if (FAILED(result)) { //ShowDInputErrorBox("Failed setting joystick saturation point", result); initprintf("Failed setting joystick saturation point: %s\n", GetDInputError(result)); @@ -909,7 +925,7 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) HRESULT result; if (!dead || !satur) return; - if (!lpDID[JOYSTICK]) { *dead = *satur = 0; return; } + if (!lpDID) { *dead = *satur = 0; return; } if (axis >= joynumaxes) { *dead = *satur = 0; return; } memset(&dipdw, 0, sizeof(dipdw)); @@ -926,8 +942,8 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) dipdw.diph.dwHow = DIPH_BYOFFSET; } - result = IDirectInputDevice7_GetProperty(lpDID[JOYSTICK], DIPROP_DEADZONE, &dipdw.diph); - if FAILED(result) + result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_DEADZONE, &dipdw.diph); + if (FAILED(result)) { //ShowDInputErrorBox("Failed getting joystick dead zone", result); initprintf("Failed getting joystick dead zone: %s\n", GetDInputError(result)); @@ -936,8 +952,8 @@ void getjoydeadzone(int32_t axis, uint16_t *dead, uint16_t *satur) *dead = dipdw.dwData; - result = IDirectInputDevice7_GetProperty(lpDID[JOYSTICK], DIPROP_SATURATION, &dipdw.diph); - if FAILED(result) + result = IDirectInputDevice7_GetProperty(lpDID, DIPROP_SATURATION, &dipdw.diph); + if (FAILED(result)) { //ShowDInputErrorBox("Failed getting joystick saturation point", result); initprintf("Failed getting joystick saturation point: %s\n", GetDInputError(result)); @@ -994,21 +1010,13 @@ static BOOL CALLBACK InitDirectInput_enum(LPCDIDEVICEINSTANCE lpddi, LPVOID pvRe UNREFERENCED_PARAMETER(pvRef); -#define COPYGUID(d,s) Bmemcpy(&d,&s,sizeof(GUID)) - - switch (lpddi->dwDevType&0xff) - { - case DIDEVTYPE_JOYSTICK: - { - inputdevices |= (1<<(JOYSTICK+2)); - joyisgamepad = ((lpddi->dwDevType & (DIDEVTYPEJOYSTICK_GAMEPAD<<8)) != 0); - d = joyisgamepad ? "GAMEPAD" : "JOYSTICK"; - COPYGUID(guidDevs[JOYSTICK],lpddi->guidInstance); - } - break; - default: + if ((lpddi->dwDevType&0xff) != DIDEVTYPE_JOYSTICK) return DIENUM_CONTINUE; - } + + inputdevices |= 4; + joyisgamepad = ((lpddi->dwDevType & (DIDEVTYPEJOYSTICK_GAMEPAD<<8)) != 0); + d = joyisgamepad ? "GAMEPAD" : "JOYSTICK"; + Bmemcpy(&guidDevs, &lpddi->guidInstance, sizeof(GUID)); initprintf(" * %s: %s\n", d, lpddi->tszProductName); @@ -1064,16 +1072,13 @@ static BOOL InitDirectInput(void) LPDIRECTINPUTDEVICE7A dev2; DIDEVCAPS didc; - int32_t devn; - if (bDInputInited) return FALSE; initprintf("Initializing DirectInput...\n"); - // load up the DirectInput DLL if (!hDInputDLL) { -// initprintf(" - Loading DINPUT.DLL\n"); + // initprintf(" - Loading DINPUT.DLL\n"); hDInputDLL = LoadLibrary("DINPUT.DLL"); if (!hDInputDLL) { @@ -1082,21 +1087,17 @@ static BOOL InitDirectInput(void) } } - // get the pointer to DirectInputCreate aDirectInputCreateA = (void *)GetProcAddress(hDInputDLL, "DirectInputCreateA"); if (!aDirectInputCreateA) ShowErrorBox("Error fetching DirectInputCreateA()"); - // create a new DirectInput object -// initprintf(" - Creating DirectInput object\n"); result = aDirectInputCreateA(hInstance, DIRECTINPUT_VERSION, &lpDI, NULL); - if FAILED(result) { HorribleDInputDeath("DirectInputCreateA() failed", result); } + if (FAILED(result)) { HorribleDInputDeath("DirectInputCreateA() failed", result); } else if (result != DI_OK) initprintf(" Created DirectInput object with warning: %s\n",GetDInputError(result)); - // enumerate devices to make us look fancy initprintf(" - Enumerating attached game controllers\n"); inputdevices = 1|2; result = IDirectInput7_EnumDevices(lpDI, 0, InitDirectInput_enum, NULL, DIEDFL_ATTACHEDONLY); - if FAILED(result) { HorribleDInputDeath("Failed enumerating attached game controllers", result); } + if (FAILED(result)) { HorribleDInputDeath("Failed enumerating attached game controllers", result); } else if (result != DI_OK) initprintf(" Enumerated game controllers with warning: %s\n",GetDInputError(result)); if (inputdevices == (1|2)) @@ -1107,86 +1108,78 @@ static BOOL InitDirectInput(void) return TRUE; } - // *** - // create the devices - // *** - for (devn = 0; devn < NUM_INPUTS; devn++) + *devicedef.did = NULL; + + // initprintf(" - Creating %s device\n", devicedef.name); + result = IDirectInput7_CreateDeviceEx(lpDI, &guidDevs, &IID_IDirectInputDevice7, (void *)&dev, NULL); + if (FAILED(result)) { HorribleDInputDeath("Failed creating device", result); } + else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result)); + + result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2); + IDirectInputDevice7_Release(dev); + if (FAILED(result)) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); } + else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result)); + + result = IDirectInputDevice7_SetDataFormat(dev2, devicedef.df); + if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting data format", result); } + else if (result != DI_OK) initprintf(" Set data format with warning: %s\n",GetDInputError(result)); + + di_inputevt = CreateEvent(NULL, FALSE, FALSE, NULL); + if (di_inputevt == NULL) { - if ((inputdevices & (1<<(devn+2))) == 0) continue; - *devicedef[devn].did = NULL; - -// initprintf(" - Creating %s device\n", devicedef[devn].name); - result = IDirectInput7_CreateDeviceEx(lpDI, &guidDevs[devn], &IID_IDirectInputDevice7, (void *)&dev, NULL); - if FAILED(result) { HorribleDInputDeath("Failed creating device", result); } - else if (result != DI_OK) initprintf(" Created device with warning: %s\n",GetDInputError(result)); - - result = IDirectInputDevice7_QueryInterface(dev, &IID_IDirectInputDevice7, (LPVOID *)&dev2); - IDirectInputDevice7_Release(dev); - if FAILED(result) { HorribleDInputDeath("Failed querying DirectInput7 interface for device", result); } - else if (result != DI_OK) initprintf(" Queried IDirectInputDevice7 interface with warning: %s\n",GetDInputError(result)); - - result = IDirectInputDevice7_SetDataFormat(dev2, devicedef[devn].df); - if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting data format", result); } - else if (result != DI_OK) initprintf(" Set data format with warning: %s\n",GetDInputError(result)); - - inputevt[devn] = CreateEvent(NULL, FALSE, FALSE, NULL); - if (inputevt[devn] == NULL) - { - IDirectInputDevice7_Release(dev2); - ShowErrorBox("Couldn't create event object"); - UninitDirectInput(); - return TRUE; - } - - result = IDirectInputDevice7_SetEventNotification(dev2, inputevt[devn]); - if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting event object", result); } - else if (result != DI_OK) initprintf(" Set event object with warning: %s\n",GetDInputError(result)); - - IDirectInputDevice7_Unacquire(dev2); - - memset(&dipdw, 0, sizeof(dipdw)); - dipdw.diph.dwSize = sizeof(DIPROPDWORD); - dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); - dipdw.diph.dwObj = 0; - dipdw.diph.dwHow = DIPH_DEVICE; - dipdw.dwData = INPUT_BUFFER_SIZE; - - result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph); - if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); } - else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result)); - - // set up device - if (devn == JOYSTICK) - { - int32_t typecounts[3] = {0,0,0}; - - memset(&didc, 0, sizeof(didc)); - didc.dwSize = sizeof(didc); - result = IDirectInputDevice7_GetCapabilities(dev2, &didc); - if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller capabilities", result); } - else if (result != DI_OK) initprintf(" Fetched controller capabilities with warning: %s\n",GetDInputError(result)); - - joynumaxes = (uint8_t)didc.dwAxes; - joynumbuttons = min(32,(uint8_t)didc.dwButtons); - joynumhats = (uint8_t)didc.dwPOVs; - initprintf("Controller has %d axes, %d buttons, and %d hat(s).\n",joynumaxes,joynumbuttons,joynumhats); - - axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef)); - buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef)); - hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef)); - - joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t)); - joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t)); - - result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL); - if FAILED(result) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); } - else if (result != DI_OK) initprintf(" Fetched controller features with warning: %s\n",GetDInputError(result)); - } - - *devicedef[devn].did = dev2; + IDirectInputDevice7_Release(dev2); + ShowErrorBox("Couldn't create event object"); + UninitDirectInput(); + return TRUE; } - memset(devacquired, 0, sizeof(devacquired)); + result = IDirectInputDevice7_SetEventNotification(dev2, di_inputevt); + if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting event object", result); } + else if (result != DI_OK) initprintf(" Set event object with warning: %s\n",GetDInputError(result)); + + IDirectInputDevice7_Unacquire(dev2); + + memset(&dipdw, 0, sizeof(dipdw)); + dipdw.diph.dwSize = sizeof(DIPROPDWORD); + dipdw.diph.dwHeaderSize = sizeof(DIPROPHEADER); + dipdw.diph.dwObj = 0; + dipdw.diph.dwHow = DIPH_DEVICE; + dipdw.dwData = INPUT_BUFFER_SIZE; + + result = IDirectInputDevice7_SetProperty(dev2, DIPROP_BUFFERSIZE, &dipdw.diph); + if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed setting buffering", result); } + else if (result != DI_OK) initprintf(" Set buffering with warning: %s\n",GetDInputError(result)); + + // set up device + { + int32_t typecounts[3] = {0,0,0}; + + memset(&didc, 0, sizeof(didc)); + didc.dwSize = sizeof(didc); + result = IDirectInputDevice7_GetCapabilities(dev2, &didc); + if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller capabilities", result); } + else if (result != DI_OK) initprintf(" Fetched controller capabilities with warning: %s\n",GetDInputError(result)); + + joynumaxes = (uint8_t)didc.dwAxes; + joynumbuttons = min(32,(uint8_t)didc.dwButtons); + joynumhats = (uint8_t)didc.dwPOVs; + initprintf("Controller has %d axes, %d buttons, and %d hat(s).\n",joynumaxes,joynumbuttons,joynumhats); + + axisdefs = (struct _joydef *)Bcalloc(didc.dwAxes, sizeof(struct _joydef)); + buttondefs = (struct _joydef *)Bcalloc(didc.dwButtons, sizeof(struct _joydef)); + hatdefs = (struct _joydef *)Bcalloc(didc.dwPOVs, sizeof(struct _joydef)); + + joyaxis = (int32_t *)Bcalloc(didc.dwAxes, sizeof(int32_t)); + joyhat = (int32_t *)Bcalloc(didc.dwPOVs, sizeof(int32_t)); + + result = IDirectInputDevice7_EnumObjects(dev2, InitDirectInput_enumobjects, (LPVOID)typecounts, DIDFT_ALL); + if (FAILED(result)) { IDirectInputDevice7_Release(dev2); HorribleDInputDeath("Failed getting controller features", result); } + else if (result != DI_OK) initprintf(" Fetched controller features with warning: %s\n",GetDInputError(result)); + } + + *devicedef.did = dev2; + + di_devacquired = 0; bDInputInited = TRUE; return FALSE; @@ -1198,12 +1191,11 @@ static BOOL InitDirectInput(void) // static void UninitDirectInput(void) { - int32_t devn; int32_t i; if (bDInputInited) initprintf("Uninitializing DirectInput...\n"); - AcquireInputDevices(0,-1); + AcquireInputDevices(0); if (axisdefs) { @@ -1221,20 +1213,15 @@ static void UninitDirectInput(void) Bfree(hatdefs); hatdefs = NULL; } - for (devn = 0; devn < NUM_INPUTS; devn++) + if (*devicedef.did) { - if (*devicedef[devn].did) - { - if (devn != JOYSTICK) IDirectInputDevice7_SetEventNotification(*devicedef[devn].did, NULL); - - IDirectInputDevice7_Release(*devicedef[devn].did); - *devicedef[devn].did = NULL; - } - if (inputevt[devn]) - { - CloseHandle(inputevt[devn]); - inputevt[devn] = NULL; - } + IDirectInputDevice7_Release(*devicedef.did); + *devicedef.did = NULL; + } + if (di_inputevt) + { + CloseHandle(di_inputevt); + di_inputevt = NULL; } if (lpDI) @@ -1294,57 +1281,49 @@ const char *getjoyname(int32_t what, int32_t num) // // AcquireInputDevices() -- (un)acquires the input devices // -static void AcquireInputDevices(char acquire, int8_t device) +static void AcquireInputDevices(char acquire) { DWORD flags; HRESULT result; - int32_t i; if (!bDInputInited) return; if (!hWindow) return; if (acquire) { -// if (!appactive) return; // why acquire when inactive? - for (i=0; i=0; i--) + { + int32_t j; + + // check axes + for (j=0; j (int32_t)(WAIT_OBJECT_0+numdevs)) - return; - - switch (idevnums[ev - WAIT_OBJECT_0]) - { - case JOYSTICK: - if (!lpDID[JOYSTICK]) break; - - result = IDirectInputDevice7_GetDeviceData(lpDID[JOYSTICK], sizeof(DIDEVICEOBJECTDATA), - (LPDIDEVICEOBJECTDATA)&didod, &dwElements, 0); - - if (result != DI_OK || !dwElements) break; - - for (i=dwElements-1; i>=0; i--) - { - int32_t j; - - // check axes - for (j=0; j MAXXDIM) *x = MAXXDIM; if (*y > MAXYDIM) *y = MAXYDIM; -// *x &= 0xfffffff8l; + // *x &= 0xfffffff8l; for (i=0; i= 0) gammabrightness = 1; if (gammabrightness && setgamma() < 0) gammabrightness = 0; } @@ -1813,7 +1773,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs) #if defined(USE_OPENGL) && defined(POLYMOST) if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync); #endif - for (i=0; i0; i--, start++) { - dapal[0] = curpalette[start].b >> 2; - dapal[1] = curpalette[start].g >> 2; - dapal[2] = curpalette[start].r >> 2; - dapal += 4; - } +for (i=num; i>0; i--, start++) { +dapal[0] = curpalette[start].b >> 2; +dapal[1] = curpalette[start].g >> 2; +dapal[2] = curpalette[start].r >> 2; +dapal += 4; +} - return 0; +return 0; }*/ @@ -2287,7 +2247,7 @@ static int32_t setgammaramp(WORD gt[3][256]) hr = IDirectDrawSurface_QueryInterface(lpDDSPrimary, &IID_IDirectDrawGammaControl, (LPVOID)&gam); if (hr != DD_OK) { -// ShowDDrawErrorBox("Error querying gamma control", hr); + // ShowDDrawErrorBox("Error querying gamma control", hr); initprintf("Error querying gamma control: %s\n",GetDDrawError(hr)); return -1; } @@ -2297,7 +2257,7 @@ static int32_t setgammaramp(WORD gt[3][256]) { IDirectDrawGammaControl_Release(gam); initprintf("Error setting gamma ramp: %s\n",GetDDrawError(hr)); -// ShowDDrawErrorBox("Error setting gamma ramp", hr); + // ShowDDrawErrorBox("Error setting gamma ramp", hr); return -1; } @@ -2383,7 +2343,7 @@ static BOOL WINAPI InitDirectDraw_enum(GUID *lpGUID, LPSTR lpDesc, LPSTR lpName, UNREFERENCED_PARAMETER(lpName); UNREFERENCED_PARAMETER(lpContext); UNREFERENCED_PARAMETER(lpDesc); -// initprintf(" * %s\n", lpDesc); + // initprintf(" * %s\n", lpDesc); return 1; } @@ -2401,7 +2361,7 @@ static BOOL InitDirectDraw(void) // load up the DirectDraw DLL if (!hDDrawDLL) { -// initprintf(" - Loading DDRAW.DLL\n"); + // initprintf(" - Loading DDRAW.DLL\n"); hDDrawDLL = LoadLibrary("DDRAW.DLL"); if (!hDDrawDLL) { @@ -2420,7 +2380,7 @@ static BOOL InitDirectDraw(void) } // enumerate the devices to make us look fancy -// initprintf(" - Enumerating display devices\n"); + // initprintf(" - Enumerating display devices\n"); aDirectDrawEnumerate(InitDirectDraw_enum, NULL); // get the pointer to DirectDrawCreate @@ -2433,7 +2393,7 @@ static BOOL InitDirectDraw(void) } // create a new DirectDraw object -// initprintf(" - Creating DirectDraw object\n"); + // initprintf(" - Creating DirectDraw object\n"); result = aDirectDrawCreate(NULL, &lpDD, NULL); if (result != DD_OK) { @@ -2443,7 +2403,7 @@ static BOOL InitDirectDraw(void) } // fetch capabilities -// initprintf(" - Checking capabilities\n"); + // initprintf(" - Checking capabilities\n"); ddcaps.dwSize = sizeof(DDCAPS); result = IDirectDraw_GetCaps(lpDD, &ddcaps, NULL); if (result != DD_OK) @@ -2475,14 +2435,14 @@ static void UninitDirectDraw(void) if (lpDD) { -// initprintf(" - Releasing DirectDraw object\n"); + // initprintf(" - Releasing DirectDraw object\n"); IDirectDraw_Release(lpDD); lpDD = NULL; } if (hDDrawDLL) { -// initprintf(" - Unloading DDRAW.DLL\n"); + // initprintf(" - Unloading DDRAW.DLL\n"); FreeLibrary(hDDrawDLL); hDDrawDLL = NULL; } @@ -2533,28 +2493,28 @@ static void ReleaseDirectDrawSurfaces(void) { if (lpDDPalette) { -// initprintf(" - Releasing palette\n"); + // initprintf(" - Releasing palette\n"); IDirectDrawPalette_Release(lpDDPalette); lpDDPalette = NULL; } if (lpDDSBack) { -// initprintf(" - Releasing back-buffer surface\n"); + // initprintf(" - Releasing back-buffer surface\n"); IDirectDrawSurface_Release(lpDDSBack); lpDDSBack = NULL; } if (lpDDSPrimary) { -// initprintf(" - Releasing primary surface\n"); + // initprintf(" - Releasing primary surface\n"); IDirectDrawSurface_Release(lpDDSPrimary); lpDDSPrimary = NULL; } if (lpOffscreen) { -// initprintf(" - Freeing offscreen buffer\n"); + // initprintf(" - Freeing offscreen buffer\n"); Bfree(lpOffscreen); lpOffscreen = NULL; } @@ -2577,7 +2537,7 @@ static int32_t SetupDirectDraw(int32_t width, int32_t height) ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; ddsd.dwBackBufferCount = 2; // triple-buffer -// initprintf(" - Creating primary surface\n"); + // initprintf(" - Creating primary surface\n"); result = IDirectDraw_CreateSurface(lpDD, &ddsd, &lpDDSPrimary, NULL); if (result != DD_OK) { @@ -2590,7 +2550,7 @@ static int32_t SetupDirectDraw(int32_t width, int32_t height) ddsd.ddsCaps.dwCaps = DDSCAPS_BACKBUFFER; numpages = 1; // KJS 20031225 -// initprintf(" - Getting back buffer\n"); + // initprintf(" - Getting back buffer\n"); result = IDirectDrawSurface_GetAttachedSurface(lpDDSPrimary, &ddsd.ddsCaps, &lpDDSBack); if (result != DD_OK) { @@ -2599,7 +2559,7 @@ static int32_t SetupDirectDraw(int32_t width, int32_t height) return TRUE; } -// initprintf(" - Allocating offscreen buffer\n"); + // initprintf(" - Allocating offscreen buffer\n"); lpOffscreen = (char *)Bmalloc((width|1)*height); if (!lpOffscreen) { @@ -2609,7 +2569,7 @@ static int32_t SetupDirectDraw(int32_t width, int32_t height) } // attach a palette to the primary surface -// initprintf(" - Creating palette\n"); + // initprintf(" - Creating palette\n"); for (i=0; i<256; i++) curpalettefaded[i].f = PC_NOCOLLAPSE; result = IDirectDraw_CreatePalette(lpDD, DDPCAPS_8BIT | DDPCAPS_ALLOW256, (LPPALETTEENTRY)curpalettefaded, &lpDDPalette, NULL); @@ -3635,8 +3595,8 @@ static inline BOOL CheckWinVersion(void) static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { /* RECT rect; - POINT pt; - HRESULT result; */ + POINT pt; + HRESULT result; */ #if defined(POLYMOST) && defined(USE_OPENGL) if (hWnd == hGLWindow) return DefWindowProc(hWnd,uMsg,wParam,lParam); @@ -3700,7 +3660,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA } Bmemset(keystatus, 0, sizeof(keystatus)); - AcquireInputDevices(appactive,-1); + AcquireInputDevices(appactive); break; } @@ -3712,13 +3672,13 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA } Bmemset(keystatus, 0, sizeof(keystatus)); - AcquireInputDevices(appactive,-1); + AcquireInputDevices(appactive); break; case WM_SIZE: if (wParam == SIZE_MAXHIDE || wParam == SIZE_MINIMIZED) appactive = 0; else appactive = 1; - AcquireInputDevices(appactive,-1); + AcquireInputDevices(appactive); break; case WM_PALETTECHANGED: @@ -3758,8 +3718,8 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA return TRUE; case WM_MOVE: -// windowx = LOWORD(lParam); -// windowy = HIWORD(lParam); + // windowx = LOWORD(lParam); + // windowy = HIWORD(lParam); return 0; case WM_MOVING: @@ -3776,11 +3736,11 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA case WM_ENTERMENULOOP: case WM_ENTERSIZEMOVE: - AcquireInputDevices(0,-1); + AcquireInputDevices(0); return 0; case WM_EXITMENULOOP: case WM_EXITSIZEMOVE: - AcquireInputDevices(1,-1); + AcquireInputDevices(1); return 0; case WM_DESTROY: @@ -3814,7 +3774,7 @@ static BOOL RegisterWindowClass(void) wcx.cbWndExtra = 0; wcx.hInstance = hInstance; wcx.hIcon = LoadImage(hInstance, MAKEINTRESOURCE(100), IMAGE_ICON, - GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); + GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), LR_DEFAULTCOLOR); wcx.hCursor = LoadCursor(NULL, IDC_ARROW); wcx.hbrBackground = (HBRUSH)COLOR_GRAYTEXT; wcx.lpszMenuName = NULL; diff --git a/polymer/eduke32/nedmalloc.dll b/polymer/eduke32/nedmalloc.dll new file mode 100644 index 000000000..3b26a3fba Binary files /dev/null and b/polymer/eduke32/nedmalloc.dll differ diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index f78716754..3b6043f1a 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -9492,7 +9492,7 @@ static void G_ShowParameterHelp(void) "-connect [host]\tConnect to a multiplayer game\n" "-c#\t\tUse MP mode #, 1 = Dukematch, 2 = Coop, 3 = Dukematch(no spawn)\n" "-d[file.dmo]\tPlay a demo\n" - "-g[file.grp]\tUse an extra group file\n" + "-g[file.grp]\tUse additional game data\n" "-h[file.def]\tUse an alternate def\n" "-j[dir]\t\tAdds a directory to EDuke32's search list\n" "-l#\t\tWarp to level #, see -v\n" @@ -9595,7 +9595,7 @@ static void G_DoAutoload(const char *fn) while (findfiles) { Bsprintf(tempbuf,"autoload/%s/%s",fn,findfiles->name); - initprintf("Using group file '%s'.\n",tempbuf); + initprintf("Using file '%s' as game data.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } @@ -9716,10 +9716,10 @@ static int32_t parsedefinitions_game(scriptfile *script, const int32_t preload) int32_t j = initgroupfile(fn); if (j == -1) - initprintf("Could not find group file '%s'.\n",fn); + initprintf("Could not find file '%s'.\n",fn); else { - initprintf("Using group file '%s'.\n",fn); + initprintf("Using file '%s' as game data.\n",fn); if (!g_noAutoLoad && !ud.config.NoAutoLoad) G_DoAutoload(fn); } @@ -11470,9 +11470,9 @@ CLEAN_DIRECTORY: i = initgroupfile(g_grpNamePtr); if (i == -1) - initprintf("Warning: could not find main group file '%s'!\n",g_grpNamePtr); + initprintf("Warning: could not find main data file '%s'!\n",g_grpNamePtr); else - initprintf("Using '%s' as main group file.\n", g_grpNamePtr); + initprintf("Using '%s' as main game data file.\n", g_grpNamePtr); if (!g_noAutoLoad && !ud.config.NoAutoLoad) { @@ -11484,7 +11484,7 @@ CLEAN_DIRECTORY: while (findfiles) { Bsprintf(tempbuf,"autoload/%s",findfiles->name); - initprintf("Using group file '%s'.\n",tempbuf); + initprintf("Using file '%s' as game data.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } @@ -11505,7 +11505,7 @@ CLEAN_DIRECTORY: while (findfiles) { Bsprintf(tempbuf,"%s/%s",g_modDir,findfiles->name); - initprintf("Using group file '%s'.\n",tempbuf); + initprintf("Using file '%s' as game data.\n",tempbuf); initgroupfile(tempbuf); findfiles = findfiles->next; } @@ -11524,11 +11524,11 @@ CLEAN_DIRECTORY: { s = CommandGrps->next; j = initgroupfile(CommandGrps->str); - if (j == -1) initprintf("Could not find group file '%s'.\n",CommandGrps->str); + if (j == -1) initprintf("Could not find file '%s'.\n",CommandGrps->str); else { g_groupFileHandle = j; - initprintf("Using group file '%s'.\n",CommandGrps->str); + initprintf("Using file '%s' as game data.\n",CommandGrps->str); if (!g_noAutoLoad && !ud.config.NoAutoLoad) G_DoAutoload(CommandGrps->str); } diff --git a/polymer/eduke32/source/grpscan.c b/polymer/eduke32/source/grpscan.c index c3262d146..221b9547c 100644 --- a/polymer/eduke32/source/grpscan.c +++ b/polymer/eduke32/source/grpscan.c @@ -93,7 +93,7 @@ int32_t ScanGroups(void) return 0; } - initprintf("Scanning for game data...\n"); + initprintf("Searching for game data...\n"); LoadGroupsCache();