- cleaned out some chunks of unused or useless code, most importantly the Build cache which was only used by the sound code for permanently loading the data into memory.

This commit is contained in:
Christoph Oelckers 2019-10-30 21:51:04 +01:00
parent 535c68fac1
commit 2a7beeff69
11 changed files with 18 additions and 625 deletions

View file

@ -895,6 +895,7 @@ void ParseScript(const char *scriptFileName)
void sub_11C10(char *pzScriptDir, char *fileName, char flags, int ID) void sub_11C10(char *pzScriptDir, char *fileName, char flags, int ID)
{ {
#if 0 // This needs a more sophisticated approach inside the file system backend if it ever gets activated
char zDirectory[BMAX_PATH]; char zDirectory[BMAX_PATH];
char zFilename[BMAX_PATH]; char zFilename[BMAX_PATH];
char zType[BMAX_PATH]; char zType[BMAX_PATH];
@ -934,10 +935,12 @@ void sub_11C10(char *pzScriptDir, char *fileName, char flags, int ID)
} }
Bclosedir(dirr); Bclosedir(dirr);
} }
#endif
} }
void sub_11DF0(char *filePath, char flags, int ID) void sub_11DF0(char *filePath, char flags, int ID)
{ {
#if 0 // This needs a more sophisticated approach inside the file system backend if it ever gets activated
char zDirectory[BMAX_PATH]; char zDirectory[BMAX_PATH];
char zFilename[BMAX_PATH]; char zFilename[BMAX_PATH];
char zType[BMAX_PATH]; char zType[BMAX_PATH];
@ -948,6 +951,7 @@ void sub_11DF0(char *filePath, char flags, int ID)
gSoundRes.AddFromBuffer(zFilename, zType, buffer, nBytes, ID, flags); gSoundRes.AddFromBuffer(zFilename, zType, buffer, nBytes, ID, flags);
else else
gSysRes.AddFromBuffer(zFilename, zType, buffer, nBytes, ID, flags); gSysRes.AddFromBuffer(zFilename, zType, buffer, nBytes, ID, flags);
#endif
} }
END_BLD_NS END_BLD_NS

View file

@ -106,50 +106,6 @@ static int osdcmd_map(osdcmdptr_t parm)
{ {
char filename[BMAX_PATH]; char filename[BMAX_PATH];
const int32_t wildcardp = parm->numparms==1 &&
(Bstrchr(parm->parms[0], '*') != NULL);
if (parm->numparms != 1 || wildcardp)
{
BUILDVFS_FIND_REC *r;
fnlist_t fnlist = FNLIST_INITIALIZER;
int32_t maxwidth = 0;
if (wildcardp)
maybe_append_ext(filename, sizeof(filename), parm->parms[0], ".map");
else
Bstrcpy(filename, "*.MAP");
fnlist_getnames(&fnlist, "/", filename, -1, 0);
gSysRes.FNAddFiles(&fnlist, filename);
for (r=fnlist.findfiles; r; r=r->next)
maxwidth = max<int>(maxwidth, Bstrlen(r->name));
if (maxwidth > 0)
{
int32_t x = 0;
maxwidth += 3;
OSD_Printf(OSDTEXT_RED "Map listing:\n");
for (r=fnlist.findfiles; r; r=r->next)
{
OSD_Printf("%-*s",maxwidth,r->name);
x += maxwidth;
if (x > OSD_GetCols() - maxwidth)
{
x = 0;
OSD_Printf("\n");
}
}
if (x) OSD_Printf("\n");
OSD_Printf(OSDTEXT_RED "Found %d maps\n", fnlist.numfiles);
}
fnlist_clearnames(&fnlist);
return OSDCMD_SHOWHELP;
}
strcpy(filename, parm->parms[0]); strcpy(filename, parm->parms[0]);
ChangeExtension(filename, ""); ChangeExtension(filename, "");

View file

@ -172,53 +172,6 @@ void Resource::Init(const char *filename)
memset(dict, 0, buffSize * sizeof(DICTNODE)); memset(dict, 0, buffSize * sizeof(DICTNODE));
} }
Reindex(); Reindex();
#if 0
if (external)
{
char fname[BMAX_PATH];
char type[BMAX_PATH];
BDIR *dirr;
struct Bdirent *dirent;
dirr = Bopendir("./");
if (dirr)
{
while (dirent = Breaddir(dirr))
{
if (!Bwildmatch(dirent->name, external))
continue;
_splitpath(dirent->name, NULL, NULL, fname, type);
if (type[0] == '.')
{
AddExternalResource(fname, &type[1], dirent->size);
}
else
{
AddExternalResource(fname, "", dirent->size);
}
}
Bclosedir(dirr);
}
#if 0
_splitpath2(external, out, &dir, &node, NULL, NULL);
_makepath(ext, dir, node, NULL, NULL);
int status = _dos_findfirst(external, 0, &info);
while (!status)
{
_splitpath2(info.name, out, NULL, NULL, &fname, &type);
if (*type == '.')
{
AddExternalResource(*fname, (char*)(type + 1), info.size);
}
else
{
AddExternalResource(*fname, "", info.size);
}
status = _dos_findnext(&info);
}
_dos_findclose(&info);
#endif
}
#endif
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
{ {
if (dict[i].flags & DICT_LOCK) if (dict[i].flags & DICT_LOCK)
@ -886,24 +839,6 @@ void Resource::RemoveMRU(CACHENODE *h)
void Resource::FNAddFiles(fnlist_t * fnlist, const char *pattern) void Resource::FNAddFiles(fnlist_t * fnlist, const char *pattern)
{ {
char filename[BMAX_PATH];
for (unsigned int i = 0; i < count; i++)
{
DICTNODE *pNode = &dict[i];
if (pNode->flags & DICT_EXTERNAL)
continue;
sprintf(filename, "%s.%s", pNode->name, pNode->type);
if (!Bwildmatch(filename, pattern))
continue;
switch (klistaddentry(&fnlist->findfiles, filename, BUILDVFS_FIND_FILE, BUILDVFS_SOURCE_GRP))
{
case -1:
return;
case 0:
fnlist->numfiles++;
break;
}
}
} }
void Resource::PurgeCache(void) void Resource::PurgeCache(void)

View file

@ -6,73 +6,6 @@
#include "compat.h" #include "compat.h"
#ifdef USE_PHYSFS
#include "physfs.h"
using buildvfs_FILE = PHYSFS_File *;
#define buildvfs_EOF (-1)
#define buildvfs_fread(p, s, n, fp) PHYSFS_readBytes((fp), (p), (s)*(n))
#define buildvfs_fwrite(p, s, n, fp) PHYSFS_writeBytes((fp), (p), (s)*(n))
#define buildvfs_fopen_read(fn) PHYSFS_openRead(fn)
#define buildvfs_fopen_write(fn) PHYSFS_openWrite(fn)
#define buildvfs_fopen_write_text(fn) PHYSFS_openWrite(fn)
#define buildvfs_fopen_append(fn) PHYSFS_openAppend(fn)
static inline int buildvfs_fgetc(buildvfs_FILE fp)
{
unsigned char c;
return buildvfs_fread(&c, 1, 1, fp) != 1 ? buildvfs_EOF : c;
}
static inline int buildvfs_fputc(char c, buildvfs_FILE fp)
{
return PHYSFS_writeBytes(fp, &c, 1) != 1 ? buildvfs_EOF : c;
}
#define buildvfs_fclose(fp) PHYSFS_close(fp)
#define buildvfs_feof(fp) PHYSFS_eof(fp)
#define buildvfs_ftell(fp) PHYSFS_tell(fp)
#define buildvfs_fseek_abs(fp, o) PHYSFS_seek((fp), (o))
#define buildvfs_fseek_rel(fp, o) PHYSFS_seek((fp), PHYSFS_tell(fp) + (o))
#define buildvfs_rewind(fp) PHYSFS_seek((fp), 0)
#define buildvfs_flength(fp) PHYSFS_fileLength(fp)
#define buildvfs_chdir(dir) (-1)
#define buildvfs_mkdir(dir, x) (!PHYSFS_mkdir(dir))
static inline char *buildvfs_getcwd(char *buf, size_t size)
{
if (buf == nullptr || size == 0)
return nullptr;
buf[0] = '\0';
return buf;
}
using buildvfs_fd = PHYSFS_File *;
#define buildvfs_fd_invalid (nullptr)
#define buildvfs_read(fd, p, s) PHYSFS_readBytes((fd), (p), (s))
#define buildvfs_write(fd, p, s) PHYSFS_writeBytes((fd), (p), (s))
#define buildvfs_open_read(fn) PHYSFS_openRead(fn)
#define buildvfs_open_write(fn) PHYSFS_openWrite(fn)
#define buildvfs_open_append(fn) PHYSFS_openAppend(fn)
#define buildvfs_close(fd) PHYSFS_close(fd)
#define buildvfs_tell(fd) PHYSFS_tell(fd)
static inline int64_t buildvfs_lseek_abs(buildvfs_fd fd, int64_t o)
{
PHYSFS_seek(fd, o);
return PHYSFS_tell(fd);
}
static inline int64_t buildvfs_lseek_rel(buildvfs_fd fd, int64_t o)
{
PHYSFS_seek(fd, PHYSFS_tell(fd) + o);
return PHYSFS_tell(fd);
}
#define buildvfs_length(fd) PHYSFS_fileLength(fd)
#define buildvfs_exists(fn) PHYSFS_exists(fn)
#define buildvfs_isdir(path) PHYSFS_isDirectory(path)
#define buildvfs_unlink(path) PHYSFS_delete(path)
#else
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
@ -109,8 +42,6 @@ static inline int64_t buildvfs_length(int fd)
#endif #endif
} }
#define buildvfs_chdir(dir) chdir(dir)
#define buildvfs_mkdir(dir, x) Bmkdir(dir, x)
#define buildvfs_getcwd(buf, size) getcwd((buf), (size)) #define buildvfs_getcwd(buf, size) getcwd((buf), (size))
using buildvfs_fd = int; using buildvfs_fd = int;
@ -121,9 +52,6 @@ using buildvfs_fd = int;
#define buildvfs_open_write(fn) open((fn), O_BINARY|O_TRUNC|O_CREAT|O_WRONLY, S_IREAD|S_IWRITE) #define buildvfs_open_write(fn) open((fn), O_BINARY|O_TRUNC|O_CREAT|O_WRONLY, S_IREAD|S_IWRITE)
// #define buildvfs_open_append(fn) todo(fn) // #define buildvfs_open_append(fn) todo(fn)
#define buildvfs_close(fd) close(fd) #define buildvfs_close(fd) close(fd)
#define buildvfs_tell(fd) lseek((fd), 0, SEEK_CUR)
#define buildvfs_lseek_abs(fd, o) lseek((fd), (o), SEEK_SET)
#define buildvfs_lseek_rel(fd, o) lseek((fd), (o), SEEK_CUR)
static inline int64_t buildvfs_flength(FILE * f) static inline int64_t buildvfs_flength(FILE * f)
{ {
@ -141,7 +69,7 @@ static inline int buildvfs_isdir(char const *path)
} }
#define buildvfs_unlink(path) unlink(path) #define buildvfs_unlink(path) unlink(path)
#endif
#define MAYBE_FCLOSE_AND_NULL(fileptr) do { \ #define MAYBE_FCLOSE_AND_NULL(fileptr) do { \
if (fileptr) { buildvfs_fclose(fileptr); fileptr = buildvfs_FILE{}; } \ if (fileptr) { buildvfs_fclose(fileptr); fileptr = buildvfs_FILE{}; } \

View file

@ -100,17 +100,7 @@ int32_t kpzbufload(char const * const filnam)
// After calling uninitcache, it is still ok to call allocache // After calling uninitcache, it is still ok to call allocache
// without first calling initcache. // without first calling initcache.
#define MAXCACHEOBJECTS 16384
#if !defined DEBUG_ALLOCACHE_AS_MALLOC
static uint8_t zerochar = 0;
static TArray<uint8_t> cache;
static intptr_t cachestart = 0;
static int32_t lockrecip[200];
int32_t cacnum = 0;
cactype cac[MAXCACHEOBJECTS];
#endif
uint8_t toupperlookup[256] = uint8_t toupperlookup[256] =
{ {
@ -132,231 +122,21 @@ uint8_t toupperlookup[256] =
0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
}; };
static void reportandexit(const char *errormessage);
void cacheInitBuffer(int32_t dacachesize) // Only the sound code still uses this - but it never frees the data.
// So we may just toss out the cache and do regular allocations.
// The TArray is merely for taking down the data before shutdown.
static TArray<TArray<uint8_t>> pseudocache;
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, uint8_t *)
{ {
#ifndef DEBUG_ALLOCACHE_AS_MALLOC pseudocache.Reserve(1);
int32_t i; auto& buffer = pseudocache.Last();
buffer.Resize(newbytes);
for (i=1; i<200; i++) *newhandle = reinterpret_cast<intptr_t>(buffer.Data());
lockrecip[i] = tabledivide32_noinline(1<<28, 200-i);
cache.Resize(dacachesize);
cac[0].leng = cache.Size();
cac[0].lock = &zerochar;
cachestart = (intptr_t)cache.Data();
cacnum = 1;
initprintf("Initialized %.1fM cache\n", (float)(dacachesize/1024.f/1024.f));
#else
UNREFERENCED_PARAMETER(dacachestart);
UNREFERENCED_PARAMETER(dacachesize);
#endif
} }
#ifdef DEBUG_ALLOCACHE_AS_MALLOC
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, uint8_t *newlockptr)
{
UNREFERENCED_PARAMETER(newlockptr);
*newhandle = (intptr_t)Xmalloc(newbytes);
}
#else
static inline void inc_and_check_cacnum(void)
{
if (EDUKE32_PREDICT_FALSE(++cacnum > MAXCACHEOBJECTS))
reportandexit("Too many objects in cache! (cacnum > MAXCACHEOBJECTS)");
}
int32_t cacheFindBlock(int32_t newbytes, int32_t *besto, int32_t *bestz)
{
int32_t bestval = 0x7fffffff;
for (native_t z=cacnum-1, o1=cache.Size(); z>=0; z--)
{
o1 -= cac[z].leng;
int32_t const o2 = o1 + newbytes;
if (o2 > cache.Size())
continue;
int32_t daval = 0;
for (native_t i=o1, zz=z; i<o2; i+=cac[zz++].leng)
{
if (*cac[zz].lock == 0)
continue;
else if (*cac[zz].lock >= 200)
{
daval = 0x7fffffff;
break;
}
// Potential for eviction increases with
// - smaller item size
// - smaller lock byte value (but in [1 .. 199])
daval += mulscale32(cac[zz].leng + 65536, lockrecip[*cac[zz].lock]);
if (daval >= bestval)
break;
}
if (daval < bestval)
{
bestval = daval;
*besto = o1;
*bestz = z;
if (bestval == 0)
break;
}
}
return bestval;
}
void cacheAllocateBlock(intptr_t* newhandle, int32_t newbytes, uint8_t* newlockptr)
{
// Make all requests a multiple of the system page size
// No, no, no! This wastes exorbitant amounts of memory for precisely nothing!
//int const pageSize = Bgetpagesize();
//newbytes = (newbytes + pageSize-1) & ~(pageSize-1);
#ifdef DEBUGGINGAIDS
if (EDUKE32_PREDICT_FALSE(!newlockptr || *newlockptr == 0))
reportandexit("ALLOCACHE CALLED WITH LOCK OF 0!");
#endif
if ((unsigned)newbytes > (unsigned)cache.Size())
{
initprintf("Cachesize: %u\n", cache.Size());
initprintf("*Newhandle: 0x%" PRIxPTR ", Newbytes: %d, *Newlock: %d\n",(intptr_t)newhandle,newbytes,*newlockptr);
reportandexit("BUFFER TOO BIG TO FIT IN CACHE!");
}
int32_t bestz = 0;
int32_t besto = 0;
int cnt = cacnum-1;
// if we can't find a block, try to age the cache until we can
// it's better than the alternative of aborting the entire program
while (cacheFindBlock(newbytes, &besto, &bestz) == 0x7fffffff)
{
cacheAgeEntries();
if (!cnt--) reportandexit("CACHE SPACE ALL LOCKED UP!");
}
//printf("%d %d %d\n",besto,newbytes,*newlockptr);
//Suck things out
int32_t sucklen = -newbytes;
int32_t suckz = bestz;
for (;sucklen<0; sucklen+=cac[suckz++].leng)
if (*cac[suckz].lock)
*cac[suckz].hand = 0;
//Remove all blocks except 1
suckz -= bestz+1;
cacnum -= suckz;
Bmemmove(&cac[bestz], &cac[bestz + suckz], (cacnum - bestz) * sizeof(cactype));
cac[bestz].hand = newhandle;
*newhandle = cachestart + besto;
cac[bestz].leng = newbytes;
cac[bestz].lock = newlockptr;
//Add new empty block if necessary
if (sucklen <= 0)
return;
if (++bestz == cacnum)
{
inc_and_check_cacnum();
cac[bestz].leng = sucklen;
cac[bestz].lock = &zerochar;
return;
}
if (*cac[bestz].lock == 0)
{
cac[bestz].leng += sucklen;
return;
}
inc_and_check_cacnum();
for (native_t z=cacnum-1; z>bestz; z--)
cac[z] = cac[z-1];
cac[bestz].leng = sucklen;
cac[bestz].lock = &zerochar;
}
#endif
void cacheAgeEntries(void)
{
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
static int agecount;
if (agecount >= cacnum)
agecount = cacnum-1;
int cnt = min(MAXCACHEOBJECTS >> 5, cacnum-1);
while(cnt--)
{
// If we have pointer to lock char and it's in [2 .. 199], decrease.
if (cac[agecount].lock)
{
if ((((*cac[agecount].lock)-2)&255) < 198)
(*cac[agecount].lock)--;
else if (*cac[agecount].lock == 255)
cnt++;
}
if (--agecount < 0)
agecount = cacnum-1;
}
#endif
}
static void reportandexit(const char *errormessage)
{
#ifndef DEBUG_ALLOCACHE_AS_MALLOC
//setvmode(0x3);
int32_t j = 0;
for (native_t i = 0; i < cacnum; i++)
{
buildprint(i, "- ");
if (cac[i].hand)
initprintf("ptr: 0x%" PRIxPTR ", ", *cac[i].hand);
else
initprintf("ptr: NULL, ");
initprintf("leng: %d, ", cac[i].leng);
if (cac[i].lock)
initprintf("lock: %d\n", *cac[i].lock);
else
initprintf("lock: NULL\n");
j += cac[i].leng;
}
initprintf("Cachesize = %u\n", cache.Size());
initprintf("Cacnum = %d\n", cacnum);
initprintf("Cache length sum = %d\n", j);
#endif
initprintf("ERROR: %s\n", errormessage);
Bexit(1);
}
#include <errno.h> #include <errno.h>
@ -1319,7 +1099,6 @@ int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, in
for (attach = *rec; attach; last = attach, attach = attach->next) for (attach = *rec; attach; last = attach, attach = attach->next)
{ {
if (type == CACHE1D_FIND_DRIVE) continue; // we just want to get to the end for drives
#ifdef _WIN32 #ifdef _WIN32
insensitive = 1; insensitive = 1;
#else #else
@ -1634,24 +1413,6 @@ next:
} }
#endif #endif
if (pathsearchmode && (type & CACHE1D_FIND_DRIVE))
{
char *drives, *drp;
drives = Bgetsystemdrives();
if (drives)
{
for (drp=drives; *drp; drp+=strlen(drp)+1)
{
if (klistaddentry(&rec, drp, CACHE1D_FIND_DRIVE, CACHE1D_SOURCE_DRIVE) < 0)
{
Xfree(drives);
goto failure;
}
}
Xfree(drives);
}
}
Xfree(path); Xfree(path);
// XXX: may be NULL if no file was listed, and thus indistinguishable from // XXX: may be NULL if no file was listed, and thus indistinguishable from
// an error condition. // an error condition.

View file

@ -195,108 +195,7 @@ int32_t Bcorrectfilename(char *filename, int32_t removefn)
return 0; return 0;
} }
#ifndef USE_PHYSFS
int32_t Bcanonicalisefilename(char *filename, int32_t removefn)
{
char cwd[BMAX_PATH];
char *fnp = filename;
#ifdef _WIN32
int drv = 0;
if (filename[0] && filename[1] == ':')
{
// filename is prefixed with a drive
drv = toupper(filename[0]) - 'A' + 1;
fnp += 2;
}
if (!_getdcwd(drv, cwd, sizeof(cwd)))
return -1;
for (char *p = cwd; *p; p++)
if (*p == '\\')
*p = '/';
#else
if (!buildvfs_getcwd(cwd, sizeof(cwd)))
return -1;
#endif
char *p = Bstrrchr(cwd, '/');
if (!p || p[1])
Bstrcat(cwd, "/");
char fn[BMAX_PATH];
Bstrcpy(fn, fnp);
#ifdef _WIN32
for (p = fn; *p; p++)
if (*p == '\\')
*p = '/';
#endif
if (fn[0] != '/')
{
// we are dealing with a path relative to the current directory
Bstrcpy(filename, cwd);
Bstrcat(filename, fn);
}
else
{
#ifdef _WIN32
filename[0] = cwd[0];
filename[1] = ':';
filename[2] = 0;
Bstrcat(filename, fn);
#else
Bstrcpy(filename, fn);
#endif
}
fnp = filename;
#ifdef _WIN32
fnp += 2; // skip the drive
#endif
UNREFERENCED_PARAMETER(removefn); // change the call below to use removefn instead of 1?
return Bcorrectfilename(fnp, 1);
}
#endif
char *Bgetsystemdrives(void)
{
#ifdef _WIN32
char *str, *p;
DWORD drv, mask;
int32_t number = 0;
drv = GetLogicalDrives();
if (drv == 0)
return NULL;
for (mask = 1; mask < 0x8000000l; mask <<= 1)
{
if ((drv & mask) == 0)
continue;
number++;
}
str = p = (char *)Xmalloc(1 + (3 * number));
number = 0;
for (mask = 1; mask < 0x8000000l; mask <<= 1, number++)
{
if ((drv & mask) == 0)
continue;
*(p++) = 'A' + number;
*(p++) = ':';
*(p++) = 0;
}
*(p++) = 0;
return str;
#else
// Perhaps have Unix OS's put /, /home/user, and /mnt/* in the "drives" list?
return NULL;
#endif
}
#ifndef USE_PHYSFS #ifndef USE_PHYSFS
@ -547,57 +446,3 @@ char *Bstrupr(char *s)
} }
#endif #endif
#define BMAXPAGESIZE 16384
int Bgetpagesize(void)
{
static int pageSize = -1;
if (pageSize == -1)
{
#ifdef _WIN32
SYSTEM_INFO system_info;
GetSystemInfo(&system_info);
pageSize = system_info.dwPageSize;
#else
pageSize = sysconf(_SC_PAGESIZE);
#endif
}
return (unsigned)pageSize < BMAXPAGESIZE ? pageSize : BMAXPAGESIZE;
}
//
// Bgetsysmemsize() -- gets the amount of system memory in the machine
//
uint32_t Bgetsysmemsize(void)
{
uint32_t siz = UINT32_MAX;
#ifdef _WIN32
//WinNT
MEMORYSTATUSEX memst;
memst.dwLength = sizeof(MEMORYSTATUSEX);
if (GlobalMemoryStatusEx(&memst))
siz = min<decltype(memst.ullTotalPhys)>(UINT32_MAX, memst.ullTotalPhys);
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES) && !defined(GEKKO)
#ifdef _SC_PAGE_SIZE
int64_t const scpagesiz = sysconf(_SC_PAGE_SIZE);
#else
int64_t const scpagesiz = sysconf(_SC_PAGESIZE);
#endif
int64_t const scphyspages = sysconf(_SC_PHYS_PAGES);
if (scpagesiz >= 0 && scphyspages >= 0)
siz = (uint32_t)min<uint64_t>(UINT32_MAX, scpagesiz * scphyspages);
//initprintf("Bgetsysmemsize(): %d pages of %d bytes, %d bytes of system memory\n",
// scphyspages, scpagesiz, siz);
#endif
return siz;
}

View file

@ -10539,7 +10539,6 @@ void videoNextPage(void)
} }
faketimerhandler(); faketimerhandler();
cacheAgeEntries();
#ifdef USE_OPENGL #ifdef USE_OPENGL
omdtims = mdtims; omdtims = mdtims;

View file

@ -397,7 +397,6 @@ int32_t BuildTiles::artLoadFiles(const char* filename)
{ {
TileFiles.LoadArtSet(filename); TileFiles.LoadArtSet(filename);
memset(gotpic, 0, sizeof(gotpic)); memset(gotpic, 0, sizeof(gotpic));
cacheInitBuffer(MAXCACHE1DSIZE);
return 0; return 0;
} }

View file

@ -74,8 +74,6 @@ enum ECreateTexBufferFlags
enum enum
{ {
MAXCACHE1DSIZE = (200 * 1024 * 1024),// Ion Fury really needs this much (and allocating less makes no difference for the other games on systems with multiple gigabytes of RAM)
MAXTILES = 30720, MAXTILES = 30720,
MAXUSERTILES = (MAXTILES-16) // reserve 16 tiles at the end MAXUSERTILES = (MAXTILES-16) // reserve 16 tiles at the end

View file

@ -279,34 +279,6 @@ void G_ExtInit(void)
CommandPaths = s; CommandPaths = s;
} }
} }
if (buildvfs_exists("user_profiles_enabled"))
{
char *homedir;
int32_t asperr;
if ((homedir = Bgethomedir()))
{
Bsnprintf(cwd, ARRAY_SIZE(cwd), "%s/"
#if defined(_WIN32)
APPNAME
#elif defined(GEKKO)
"apps/" APPBASENAME
#else
".config/" APPBASENAME
#endif
,homedir);
asperr = addsearchpath(cwd);
if (asperr == -2)
{
if (buildvfs_mkdir(cwd,S_IRWXU) == 0) asperr = addsearchpath(cwd);
else asperr = -1;
}
if (asperr == 0)
buildvfs_chdir(cwd);
Xfree(homedir);
}
}
} }
void G_ScanGroups(void) void G_ScanGroups(void)
@ -375,8 +347,6 @@ void G_LoadGroups()
Bsnprintf(path, sizeof(path), "%s/%s", cwd, g_modDir); Bsnprintf(path, sizeof(path), "%s/%s", cwd, g_modDir);
if (!Bstrcmp(g_rootDir, path)) if (!Bstrcmp(g_rootDir, path))
{ {
if (addsearchpath(path) == -2)
if (buildvfs_mkdir(path, S_IRWXU) == 0)
addsearchpath(path); addsearchpath(path);
} }
} }

View file

@ -2808,8 +2808,6 @@ GameIntro(void)
void void
Control(int32_t argc, char const * const * argv) Control(int32_t argc, char const * const * argv)
{ {
cacheInitBuffer(50'000'000);
InitGame(argc, argv); InitGame(argc, argv);
MONO_PRINT("InitGame done"); MONO_PRINT("InitGame done");