mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
- removed the remaining parts of cache1d. The only thing left is the dummy cacheAllocateBlock function that needs to stick around until a working cache is present.
- disabled the user maps menu because it is hopelessly dependent on functionality that cannot be fixed. Better wait until the menu refactor to do it right - it'd be a waste of time fixing the current menus.
This commit is contained in:
parent
1149b4f4aa
commit
c54ae1be83
18 changed files with 87 additions and 491 deletions
|
@ -429,14 +429,14 @@ typedef struct MenuFileSelect_t
|
|||
char *destination;
|
||||
|
||||
// state
|
||||
CACHE1D_FIND_REC *findhigh[2];
|
||||
//CACHE1D_FIND_REC *findhigh[2];
|
||||
int32_t scrollPos[2];
|
||||
|
||||
// appearance
|
||||
int32_t marginBottom[2];
|
||||
|
||||
// state
|
||||
fnlist_t fnlist;
|
||||
//fnlist_t fnlist;
|
||||
int32_t currentList;
|
||||
|
||||
int32_t getMarginBottom(size_t index) const { return mulscale16(marginBottom[index], font[index]->zoom); }
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
#include "vfs.h"
|
||||
|
||||
extern char *kpzbuf;
|
||||
|
||||
void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, uint8_t *newlockptr);
|
||||
|
||||
using buildvfs_kfd = int32_t;
|
||||
|
@ -23,36 +21,6 @@ using buildvfs_kfd = int32_t;
|
|||
extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode)
|
||||
|
||||
|
||||
enum {
|
||||
CACHE1D_FIND_FILE = 1,
|
||||
CACHE1D_FIND_DIR = 2,
|
||||
CACHE1D_FIND_DRIVE = 4,
|
||||
CACHE1D_FIND_NOCURDIR = 8,
|
||||
|
||||
BUILDVFS_FIND_FILE = 1,
|
||||
BUILDVFS_FIND_DIR = 2,
|
||||
BUILDVFS_FIND_DRIVE = 4,
|
||||
BUILDVFS_FIND_NOCURDIR = 8,
|
||||
|
||||
CACHE1D_OPT_NOSTACK = 0x100,
|
||||
|
||||
// the lower the number, the higher the priority
|
||||
CACHE1D_SOURCE_DRIVE = 0,
|
||||
CACHE1D_SOURCE_CURDIR = 1,
|
||||
CACHE1D_SOURCE_PATH = 2, // + path stack depth
|
||||
CACHE1D_SOURCE_ZIP = 0x7ffffffe,
|
||||
CACHE1D_SOURCE_GRP = 0x7fffffff,
|
||||
BUILDVFS_SOURCE_GRP = 0x7fffffff,
|
||||
};
|
||||
typedef struct _CACHE1D_FIND_REC {
|
||||
char *name;
|
||||
int32_t type, source;
|
||||
struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
|
||||
} CACHE1D_FIND_REC, BUILDVFS_FIND_REC;
|
||||
int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source);
|
||||
void klistfree(CACHE1D_FIND_REC *rec);
|
||||
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int type);
|
||||
|
||||
// compression disabled pending a better process for saving. Per-block compression as done here was not that great.
|
||||
int32_t kdfread_LZ4(void* buffer, int dasizeof, int count, buildvfs_kfd fil) = delete;
|
||||
|
||||
|
|
|
@ -30,14 +30,6 @@ typedef struct
|
|||
}
|
||||
tokenlist;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
CACHE1D_FIND_REC *finddirs, *findfiles;
|
||||
int32_t numdirs, numfiles;
|
||||
}
|
||||
fnlist_t;
|
||||
|
||||
#define FNLIST_INITIALIZER { NULL, NULL, 0, 0 }
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -77,11 +69,6 @@ int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens);
|
|||
|
||||
int32_t G_CheckCmdSwitch(int32_t argc, char const * const * argv, const char *str);
|
||||
|
||||
void fnlist_clearnames(fnlist_t *fnl);
|
||||
int32_t fnlist_getnames(fnlist_t *fnl, const char *dirname, const char *pattern,
|
||||
int32_t dirflags, int32_t fileflags);
|
||||
|
||||
|
||||
int32_t maybe_append_ext(char *wbuf, int32_t wbufsiz, const char *fn, const char *ext);
|
||||
|
||||
// Approximations to 2D and 3D Euclidean distances. Initial EDuke32 SVN import says
|
||||
|
|
|
@ -20,57 +20,6 @@
|
|||
|
||||
#include "vfs.h"
|
||||
|
||||
#ifdef WITHKPLIB
|
||||
#include "kplib.h"
|
||||
#include "zstring.h"
|
||||
|
||||
//Insert '|' in front of filename
|
||||
//Doing this tells kzopen to load the file only if inside a .ZIP file
|
||||
static intptr_t kzipopen(const char *filnam)
|
||||
{
|
||||
uint32_t i;
|
||||
char newst[BMAX_PATH+8];
|
||||
|
||||
newst[0] = '|';
|
||||
for (i=0; i < BMAX_PATH+4 && filnam[i]; i++) newst[i+1] = filnam[i];
|
||||
newst[i+1] = 0;
|
||||
return kzopen(newst);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
char *kpzbuf = NULL;
|
||||
|
||||
|
||||
// This module keeps track of a standard linear cacheing system.
|
||||
// To use this module, here's all you need to do:
|
||||
//
|
||||
// Step 1: Allocate a nice BIG buffer, like from 1MB-4MB and
|
||||
// Call initcache(int32_t cachestart, int32_t cachesize) where
|
||||
//
|
||||
// cachestart = (intptr_t)(pointer to start of BIG buffer)
|
||||
// cachesize = length of BIG buffer
|
||||
//
|
||||
// Step 2: Call allocache(intptr_t *bufptr, int32_t bufsiz, char *lockptr)
|
||||
// whenever you need to allocate a buffer, where:
|
||||
//
|
||||
// *bufptr = pointer to multi-byte pointer to buffer
|
||||
// Confused? Using this method, cache2d can remove
|
||||
// previously allocated things from the cache safely by
|
||||
// setting the multi-byte pointer to 0.
|
||||
// bufsiz = number of bytes to allocate
|
||||
// *lockptr = pointer to locking char which tells whether
|
||||
// the region can be removed or not. If *lockptr = 0 then
|
||||
// the region is not locked else its locked.
|
||||
//
|
||||
// Step 3: If you need to remove everything from the cache, or every
|
||||
// unlocked item from the cache, you can call uninitcache();
|
||||
// Call uninitcache(0) to remove all unlocked items, or
|
||||
// Call uninitcache(1) to remove everything.
|
||||
// After calling uninitcache, it is still ok to call allocache
|
||||
// without first calling initcache.
|
||||
|
||||
|
||||
|
||||
uint8_t toupperlookup[256] =
|
||||
{
|
||||
|
@ -107,220 +56,3 @@ void cacheAllocateBlock(intptr_t *newhandle, int32_t newbytes, uint8_t *)
|
|||
*newhandle = reinterpret_cast<intptr_t>(buffer.Data());
|
||||
}
|
||||
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct _searchpath
|
||||
{
|
||||
struct _searchpath *next;
|
||||
char *path;
|
||||
size_t pathlen; // to save repeated calls to strlen()
|
||||
int32_t user;
|
||||
} searchpath_t;
|
||||
static searchpath_t *searchpathhead = NULL;
|
||||
static size_t maxsearchpathlen = 0;
|
||||
int32_t pathsearchmode = 0;
|
||||
|
||||
|
||||
|
||||
int32_t klistaddentry(CACHE1D_FIND_REC **rec, const char *name, int32_t type, int32_t source)
|
||||
{
|
||||
CACHE1D_FIND_REC *r = NULL, *attach = NULL;
|
||||
|
||||
if (*rec)
|
||||
{
|
||||
int32_t insensitive, v;
|
||||
CACHE1D_FIND_REC *last = NULL;
|
||||
|
||||
for (attach = *rec; attach; last = attach, attach = attach->next)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
insensitive = 1;
|
||||
#else
|
||||
if (source == CACHE1D_SOURCE_GRP || attach->source == CACHE1D_SOURCE_GRP)
|
||||
insensitive = 1;
|
||||
else if (source == CACHE1D_SOURCE_ZIP || attach->source == CACHE1D_SOURCE_ZIP)
|
||||
insensitive = 1;
|
||||
else
|
||||
{
|
||||
extern int16_t editstatus; // XXX
|
||||
insensitive = !editstatus;
|
||||
}
|
||||
// ^ in the game, don't show file list case-sensitive
|
||||
#endif
|
||||
if (insensitive) v = Bstrcasecmp(name, attach->name);
|
||||
else v = Bstrcmp(name, attach->name);
|
||||
|
||||
// sorted list
|
||||
if (v > 0) continue; // item to add is bigger than the current one
|
||||
// so look for something bigger than us
|
||||
if (v < 0) // item to add is smaller than the current one
|
||||
{
|
||||
attach = NULL; // so wedge it between the current item and the one before
|
||||
break;
|
||||
}
|
||||
|
||||
// matched
|
||||
if (source >= attach->source) return 1; // item to add is of lower priority
|
||||
r = attach;
|
||||
break;
|
||||
}
|
||||
|
||||
// wasn't found in the list, so attach to the end
|
||||
if (!attach) attach = last;
|
||||
}
|
||||
|
||||
if (r)
|
||||
{
|
||||
r->type = type;
|
||||
r->source = source;
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = (CACHE1D_FIND_REC *)Xmalloc(sizeof(CACHE1D_FIND_REC)+strlen(name)+1);
|
||||
|
||||
r->name = (char *)r + sizeof(CACHE1D_FIND_REC); strcpy(r->name, name);
|
||||
r->type = type;
|
||||
r->source = source;
|
||||
r->usera = r->userb = NULL;
|
||||
|
||||
if (!attach) // we are the first item
|
||||
{
|
||||
r->prev = NULL;
|
||||
r->next = *rec;
|
||||
if (*rec)(*rec)->prev = r;
|
||||
*rec = r;
|
||||
}
|
||||
else
|
||||
{
|
||||
r->prev = attach;
|
||||
r->next = attach->next;
|
||||
if (attach->next) attach->next->prev = r;
|
||||
attach->next = r;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void klistfree(CACHE1D_FIND_REC *rec)
|
||||
{
|
||||
CACHE1D_FIND_REC *n;
|
||||
|
||||
while (rec)
|
||||
{
|
||||
n = rec->next;
|
||||
Xfree(rec);
|
||||
rec = n;
|
||||
}
|
||||
}
|
||||
|
||||
CACHE1D_FIND_REC *klistpath(const char *_path, const char *mask, int32_t type)
|
||||
{
|
||||
CACHE1D_FIND_REC *rec = NULL;
|
||||
char *path;
|
||||
|
||||
// pathsearchmode == 0: enumerates a path in the virtual filesystem
|
||||
// pathsearchmode == 1: enumerates the system filesystem path passed in
|
||||
|
||||
path = Xstrdup(_path);
|
||||
|
||||
// we don't need any leading dots and slashes or trailing slashes either
|
||||
{
|
||||
int32_t i,j;
|
||||
for (i=0; path[i] == '.' || toupperlookup[path[i]] == '/';) i++;
|
||||
for (j=0; (path[j] = path[i]); j++,i++) ;
|
||||
while (j>0 && toupperlookup[path[j-1]] == '/') j--;
|
||||
path[j] = 0;
|
||||
//initprintf("Cleaned up path = \"%s\"\n",path);
|
||||
}
|
||||
|
||||
if (*path && (type & CACHE1D_FIND_DIR))
|
||||
{
|
||||
if (klistaddentry(&rec, "..", CACHE1D_FIND_DIR, CACHE1D_SOURCE_CURDIR) < 0)
|
||||
{
|
||||
Xfree(path);
|
||||
klistfree(rec);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(type & CACHE1D_OPT_NOSTACK)) // current directory and paths in the search stack
|
||||
{
|
||||
|
||||
int32_t stackdepth = CACHE1D_SOURCE_CURDIR;
|
||||
|
||||
|
||||
static const char *const CUR_DIR = "./";
|
||||
// Adjusted for the following "autoload" dir fix - NY00123
|
||||
searchpath_t *search = NULL;
|
||||
const char *d = pathsearchmode ? _path : CUR_DIR;
|
||||
char buf[BMAX_PATH];
|
||||
BDIR *dir;
|
||||
struct Bdirent *dirent;
|
||||
do
|
||||
{
|
||||
if (d==CUR_DIR && (type & CACHE1D_FIND_NOCURDIR))
|
||||
goto next;
|
||||
|
||||
strcpy(buf, d);
|
||||
if (!pathsearchmode)
|
||||
{
|
||||
// Fix for "autoload" dir in multi-user environments - NY00123
|
||||
strcat(buf, path);
|
||||
if (*path) strcat(buf, "/");
|
||||
}
|
||||
dir = Bopendir(buf);
|
||||
if (dir)
|
||||
{
|
||||
while ((dirent = Breaddir(dir)))
|
||||
{
|
||||
if ((dirent->name[0] == '.' && dirent->name[1] == 0) ||
|
||||
(dirent->name[0] == '.' && dirent->name[1] == '.' && dirent->name[2] == 0))
|
||||
continue;
|
||||
if ((type & CACHE1D_FIND_DIR) && !(dirent->mode & BS_IFDIR)) continue;
|
||||
if ((type & CACHE1D_FIND_FILE) && (dirent->mode & BS_IFDIR)) continue;
|
||||
if (!Bwildmatch(dirent->name, mask)) continue;
|
||||
switch (klistaddentry(&rec, dirent->name,
|
||||
(dirent->mode & BS_IFDIR) ? CACHE1D_FIND_DIR : CACHE1D_FIND_FILE,
|
||||
stackdepth))
|
||||
{
|
||||
case -1: goto failure;
|
||||
//case 1: initprintf("%s:%s dropped for lower priority\n", d,dirent->name); break;
|
||||
//case 0: initprintf("%s:%s accepted\n", d,dirent->name); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
Bclosedir(dir);
|
||||
}
|
||||
next:
|
||||
if (pathsearchmode)
|
||||
break;
|
||||
|
||||
if (!search)
|
||||
{
|
||||
search = searchpathhead;
|
||||
stackdepth = CACHE1D_SOURCE_PATH;
|
||||
}
|
||||
else
|
||||
{
|
||||
search = search->next;
|
||||
stackdepth++;
|
||||
}
|
||||
|
||||
if (search)
|
||||
d = search->path;
|
||||
}
|
||||
while (search);
|
||||
}
|
||||
|
||||
Xfree(path);
|
||||
// XXX: may be NULL if no file was listed, and thus indistinguishable from
|
||||
// an error condition.
|
||||
return rec;
|
||||
failure:
|
||||
Xfree(path);
|
||||
klistfree(rec);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,40 +72,6 @@ int32_t G_CheckCmdSwitch(int32_t argc, char const * const * argv, const char *st
|
|||
}
|
||||
|
||||
|
||||
//// FILE NAME / DIRECTORY LISTS ////
|
||||
void fnlist_clearnames(fnlist_t *fnl)
|
||||
{
|
||||
klistfree(fnl->finddirs);
|
||||
klistfree(fnl->findfiles);
|
||||
|
||||
fnl->finddirs = fnl->findfiles = NULL;
|
||||
fnl->numfiles = fnl->numdirs = 0;
|
||||
}
|
||||
|
||||
// dirflags, fileflags:
|
||||
// -1 means "don't get dirs/files",
|
||||
// otherwise ORed to flags for respective klistpath
|
||||
int32_t fnlist_getnames(fnlist_t *fnl, const char *dirname, const char *pattern,
|
||||
int32_t dirflags, int32_t fileflags)
|
||||
{
|
||||
CACHE1D_FIND_REC *r;
|
||||
|
||||
fnlist_clearnames(fnl);
|
||||
|
||||
if (dirflags != -1)
|
||||
fnl->finddirs = klistpath(dirname, "*", CACHE1D_FIND_DIR|dirflags);
|
||||
if (fileflags != -1)
|
||||
fnl->findfiles = klistpath(dirname, pattern, CACHE1D_FIND_FILE|fileflags);
|
||||
|
||||
for (r=fnl->finddirs; r; r=r->next)
|
||||
fnl->numdirs++;
|
||||
for (r=fnl->findfiles; r; r=r->next)
|
||||
fnl->numfiles++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
////
|
||||
|
||||
// Copy FN to WBUF and append an extension if it's not there, which is checked
|
||||
|
|
|
@ -8261,8 +8261,6 @@ void engineUnInit(void)
|
|||
Bmemset(basepaltable, 0, sizeof(basepaltable));
|
||||
basepaltable[0] = palette;
|
||||
|
||||
DO_FREE_AND_NULL(kpzbuf);
|
||||
|
||||
uninitsystem();
|
||||
|
||||
for (bssize_t i = 0; i < num_usermaphacks; i++)
|
||||
|
|
|
@ -759,6 +759,28 @@ FileReader FileSystem::ReopenFileReader(int lump, bool alwayscache)
|
|||
return rl->NewReader(); // This always gets a reader to the cache
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetAllFilesOfType
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
TArray<FString> FileSystem::GetAllFilesOfType(FName type, bool withsubdirs)
|
||||
{
|
||||
TArray<FString> found;
|
||||
for (unsigned i = 0; i < FileInfo.Size(); i++)
|
||||
{
|
||||
auto& fi = FileInfo[i];
|
||||
if (fi.lump->ResType() == type)
|
||||
{
|
||||
if (!withsubdirs && fi.lump->LumpName[FResourceLump::BaseNameNoExtType] != fi.lump->LumpName[FResourceLump::FullNameNoExtType]) continue;
|
||||
auto check = FindFile(fi.lump->FullName());
|
||||
if (check == i) found.Push(fi.lump->FullName());
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetResourceFileName
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <stdexcept>
|
||||
#include "files.h"
|
||||
#include "tarray.h"
|
||||
#include "name.h"
|
||||
#include "zstring.h"
|
||||
|
||||
#ifdef FindResource
|
||||
|
@ -107,6 +108,7 @@ public:
|
|||
void AddFromBuffer(const char* name, const char* type, char* data, int size, int id, int flags);
|
||||
|
||||
|
||||
TArray<FString> GetAllFilesOfType(FName type, bool withsubdirs = false);
|
||||
TArray<uint8_t> GetFileData(int file, int pad = 0); // reads file into a writable buffer and optionally adds some padding at the end. (FileData isn't writable!)
|
||||
FileData ReadFile (int file);
|
||||
FileData ReadFile (const char *name) { return ReadFile (GetFile (name)); }
|
||||
|
|
|
@ -463,6 +463,7 @@ CUSTOM_CVAR(String, rtsname, "", CVAR_ARCHIVE | CVAR_USERINFO)
|
|||
RTS_Init(self);
|
||||
}
|
||||
|
||||
CVAR(String, usermapfolder, "", CVAR_ARCHIVE);
|
||||
|
||||
#if 0
|
||||
|
||||
|
|
|
@ -106,6 +106,7 @@ EXTERN_CVAR(Int, ScreenBPP)
|
|||
EXTERN_CVAR(Bool, adult_lockout)
|
||||
EXTERN_CVAR(String, playername)
|
||||
EXTERN_CVAR(String, rtsname)
|
||||
EXTERN_CVAR(String, usermapfolder)
|
||||
|
||||
extern bool gNoAutoLoad;
|
||||
extern float r_ambientlightrecip;
|
||||
|
|
|
@ -7,3 +7,4 @@ xx(QAV)
|
|||
xx(SEQ)
|
||||
xx(SFX)
|
||||
xx(RAW)
|
||||
xx(MAP)
|
||||
|
|
|
@ -1410,16 +1410,16 @@ static MenuTextForm_t M_CHEATENTRY = { NULL, "Enter Cheat Code:", MAXCHEATLEN, 0
|
|||
static MenuTextForm_t M_CHEAT_WARP = { NULL, "Enter Warp #:", 3, 0 };
|
||||
static MenuTextForm_t M_CHEAT_SKILL = { NULL, "Enter Skill #:", 1, 0 };
|
||||
|
||||
#define MAKE_MENUFILESELECT(a, dir, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, dir, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
|
||||
//#define MAKE_MENUFILESELECT(a, dir, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, dir, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
|
||||
|
||||
static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "./usermaps/", "*.map", boardfilename );
|
||||
//static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "./usermaps/", "*.map", boardfilename );
|
||||
|
||||
// MUST be in ascending order of MenuID enum values due to binary search
|
||||
static Menu_t Menus[] = {
|
||||
{ &M_MAIN, MENU_MAIN, MENU_CLOSE, MA_None, Menu },
|
||||
{ &M_MAIN_INGAME, MENU_MAIN_INGAME, MENU_CLOSE, MA_None, Menu },
|
||||
{ &M_EPISODE, MENU_EPISODE, MENU_MAIN, MA_Return, Menu },
|
||||
{ &M_USERMAP, MENU_USERMAP, MENU_PREVIOUS, MA_Return, FileSelect },
|
||||
//{ &M_USERMAP, MENU_USERMAP, MENU_PREVIOUS, MA_Return, FileSelect },
|
||||
{ &M_NEWGAMECUSTOM, MENU_NEWGAMECUSTOM, MENU_MAIN, MA_Return, Menu },
|
||||
{ &M_NEWGAMECUSTOMSUB, MENU_NEWGAMECUSTOMSUB, MENU_NEWGAMECUSTOM, MA_Return, Menu },
|
||||
{ &M_SKILL, MENU_SKILL, MENU_PREVIOUS, MA_Return, Menu },
|
||||
|
@ -1500,7 +1500,7 @@ static Menu_t Menus[] = {
|
|||
{ &M_MACROS, MENU_MACROS, MENU_PLAYER, MA_Return, Menu },
|
||||
{ &M_NETHOST, MENU_NETHOST, MENU_NETWORK, MA_Return, Menu },
|
||||
{ &M_NETOPTIONS, MENU_NETOPTIONS, MENU_NETWORK, MA_Return, Menu },
|
||||
{ &M_USERMAP, MENU_NETUSERMAP, MENU_NETOPTIONS, MA_Return, FileSelect },
|
||||
// { &M_USERMAP, MENU_NETUSERMAP, MENU_NETOPTIONS, MA_Return, FileSelect },
|
||||
{ &M_NETJOIN, MENU_NETJOIN, MENU_NETWORK, MA_Return, Menu },
|
||||
};
|
||||
|
||||
|
@ -3820,32 +3820,18 @@ static void Menu_TextFormSubmit(char *input)
|
|||
}
|
||||
}
|
||||
|
||||
void klistbookends(CACHE1D_FIND_REC *start)
|
||||
{
|
||||
auto end = start;
|
||||
|
||||
if (!start)
|
||||
return;
|
||||
|
||||
while (start->prev)
|
||||
start = start->prev;
|
||||
|
||||
while (end->next)
|
||||
end = end->next;
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (auto n = start; n; n = n->next)
|
||||
{
|
||||
n->type = i; // overload this...
|
||||
n->usera = start;
|
||||
n->userb = end;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
||||
{
|
||||
// Same crap as everywhere - it expects the user to dump all the shit in the game directory so that it gets in the way of everything.
|
||||
// Needs to be redone - or removed.
|
||||
if (usermapfolder)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
#if 0
|
||||
fnlist_clearnames(&object->fnlist);
|
||||
|
||||
if (object->destination[0] == 0)
|
||||
|
@ -3875,6 +3861,7 @@ static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
|||
if (object->findhigh[1])
|
||||
object->currentList = 1;
|
||||
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
}
|
||||
|
||||
|
@ -5639,6 +5626,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
|||
|
||||
case FileSelect:
|
||||
{
|
||||
#if 0
|
||||
auto object = (MenuFileSelect_t*)cm->object;
|
||||
const int32_t MenuFileSelect_scrollbar_rightedge[2] = { 160<<16, 284<<16 };
|
||||
int32_t i, selected = 0;
|
||||
|
@ -5757,7 +5745,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
|||
|
||||
m_mousecaught = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6249,6 +6237,7 @@ static void Menu_RunInput_EntryString_Cancel(/*MenuEntry_t *entry, */MenuString_
|
|||
|
||||
static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
|
||||
{
|
||||
#if 0
|
||||
const int32_t listytop = object->format[object->currentList]->pos.y;
|
||||
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
|
||||
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->get_yline() + object->getMarginBottom(object->currentList));
|
||||
|
@ -6258,10 +6247,12 @@ static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
|
|||
object->scrollPos[object->currentList] = ybottom - listybottom;
|
||||
else if (ytop - object->scrollPos[object->currentList] < listytop)
|
||||
object->scrollPos[object->currentList] = ytop - listytop;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMovement_t direction)
|
||||
{
|
||||
#if 0
|
||||
switch (direction)
|
||||
{
|
||||
case MM_Up:
|
||||
|
@ -6299,10 +6290,12 @@ static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMove
|
|||
}
|
||||
|
||||
Menu_RunInput_FileSelect_MovementVerify(object);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object)
|
||||
{
|
||||
#if 0
|
||||
if (!object->findhigh[object->currentList])
|
||||
return;
|
||||
|
||||
|
@ -6319,6 +6312,7 @@ static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object)
|
|||
{
|
||||
Menu_FileSelect(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput(Menu_t *cm)
|
||||
|
@ -6386,6 +6380,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
case FileSelect:
|
||||
{
|
||||
#if 0
|
||||
auto object = (MenuFileSelect_t*)cm->object;
|
||||
|
||||
if (I_ReturnTrigger() || Menu_RunInput_MouseReturn())
|
||||
|
@ -6528,7 +6523,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Menu_PreInput(NULL);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -417,14 +417,14 @@ typedef struct MenuFileSelect_t
|
|||
char *destination;
|
||||
|
||||
// state
|
||||
CACHE1D_FIND_REC *findhigh[2];
|
||||
//CACHE1D_FIND_REC *findhigh[2];
|
||||
int32_t scrollPos[2];
|
||||
|
||||
// appearance
|
||||
int32_t marginBottom[2];
|
||||
|
||||
// state
|
||||
fnlist_t fnlist;
|
||||
//fnlist_t fnlist;
|
||||
int32_t currentList;
|
||||
|
||||
int32_t getMarginBottom(size_t index) const { return mulscale16(marginBottom[index], font[index]->zoom); }
|
||||
|
|
|
@ -166,41 +166,6 @@ static int osdcmd_map(osdcmdptr_t parm)
|
|||
|
||||
if (parm->numparms != 1 || wildcardp)
|
||||
{
|
||||
CACHE1D_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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -73,12 +73,9 @@ static int mode = TAB_CONFIG;
|
|||
|
||||
static TArray<GrpEntry> *gamedata;
|
||||
|
||||
static CACHE1D_FIND_REC *finddirs;
|
||||
|
||||
static inline void clearfilenames(void)
|
||||
{
|
||||
klistfree(finddirs);
|
||||
finddirs = NULL;
|
||||
}
|
||||
|
||||
static inline void getfilenames(char const *path)
|
||||
|
|
|
@ -1380,16 +1380,16 @@ static MenuTextForm_t M_CHEATENTRY = { NULL, "Enter Cheat Code:", MAXCHEATLEN, 0
|
|||
static MenuTextForm_t M_CHEAT_WARP = { NULL, "Enter Warp #:", 3, 0 };
|
||||
static MenuTextForm_t M_CHEAT_SKILL = { NULL, "Enter Skill #:", 1, 0 };
|
||||
|
||||
#define MAKE_MENUFILESELECT(a, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
|
||||
//#define MAKE_MENUFILESELECT(a, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
|
||||
|
||||
static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "*.map", boardfilename );
|
||||
//static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "*.map", boardfilename );
|
||||
|
||||
// MUST be in ascending order of MenuID enum values due to binary search
|
||||
static Menu_t Menus[] = {
|
||||
{ &M_MAIN, MENU_MAIN, MENU_CLOSE, MA_None, Menu },
|
||||
{ &M_MAIN_INGAME, MENU_MAIN_INGAME, MENU_CLOSE, MA_None, Menu },
|
||||
{ &M_EPISODE, MENU_EPISODE, MENU_MAIN, MA_Return, Menu },
|
||||
{ &M_USERMAP, MENU_USERMAP, MENU_EPISODE, MA_Return, FileSelect },
|
||||
//{ &M_USERMAP, MENU_USERMAP, MENU_EPISODE, MA_Return, FileSelect },
|
||||
{ &M_SKILL, MENU_SKILL, MENU_EPISODE, MA_Return, Menu },
|
||||
#ifndef EDUKE32_SIMPLE_MENU
|
||||
{ &M_GAMESETUP, MENU_GAMESETUP, MENU_OPTIONS, MA_Return, Menu },
|
||||
|
@ -1492,7 +1492,7 @@ static Menu_t Menus[] = {
|
|||
{ &M_MACROS, MENU_MACROS, MENU_PLAYER, MA_Return, Menu },
|
||||
{ &M_NETHOST, MENU_NETHOST, MENU_NETWORK, MA_Return, Menu },
|
||||
{ &M_NETOPTIONS, MENU_NETOPTIONS, MENU_NETWORK, MA_Return, Menu },
|
||||
{ &M_USERMAP, MENU_NETUSERMAP, MENU_NETOPTIONS, MA_Return, FileSelect },
|
||||
//{ &M_USERMAP, MENU_NETUSERMAP, MENU_NETOPTIONS, MA_Return, FileSelect },
|
||||
{ &M_NETJOIN, MENU_NETJOIN, MENU_NETWORK, MA_Return, Menu },
|
||||
};
|
||||
|
||||
|
@ -4169,32 +4169,17 @@ static void Menu_TextFormSubmit(char *input)
|
|||
}
|
||||
}
|
||||
|
||||
void klistbookends(CACHE1D_FIND_REC *start)
|
||||
{
|
||||
auto end = start;
|
||||
|
||||
if (!start)
|
||||
return;
|
||||
|
||||
while (start->prev)
|
||||
start = start->prev;
|
||||
|
||||
while (end->next)
|
||||
end = end->next;
|
||||
|
||||
int i = 0;
|
||||
|
||||
for (auto n = start; n; n = n->next)
|
||||
{
|
||||
n->type = i; // overload this...
|
||||
n->usera = start;
|
||||
n->userb = end;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
||||
{
|
||||
// Same crap as everywhere - it expects the user to dump all the shit in the game directory so that it gets in the way of everything.
|
||||
// Needs to be redone - or removed.
|
||||
if (usermapfolder)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
#if 0
|
||||
fnlist_clearnames(&object->fnlist);
|
||||
|
||||
if (object->destination[0] == 0)
|
||||
|
@ -4215,11 +4200,13 @@ static void Menu_FileSelectInit(MenuFileSelect_t *object)
|
|||
if (object->findhigh[1])
|
||||
object->currentList = 1;
|
||||
|
||||
#endif
|
||||
KB_FlushKeyboardQueue();
|
||||
}
|
||||
|
||||
static void Menu_FileSelect(int32_t input)
|
||||
{
|
||||
#if 0
|
||||
switch (g_currentMenu)
|
||||
{
|
||||
case MENU_NETUSERMAP:
|
||||
|
@ -4242,6 +4229,7 @@ static void Menu_FileSelect(int32_t input)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -6028,6 +6016,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
|||
|
||||
case FileSelect:
|
||||
{
|
||||
#if 0
|
||||
auto *object = (MenuFileSelect_t*)cm->object;
|
||||
const int32_t MenuFileSelect_scrollbar_rightedge[2] = { 160<<16, 284<<16 };
|
||||
int32_t i, selected = 0;
|
||||
|
@ -6144,7 +6133,7 @@ static void Menu_Run(Menu_t *cm, const vec2_t origin)
|
|||
|
||||
m_mousecaught = 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6656,6 +6645,7 @@ static void Menu_RunInput_EntryString_Cancel(/*MenuEntry_t *entry, */MenuString_
|
|||
|
||||
static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
|
||||
{
|
||||
#if 0
|
||||
const int32_t listytop = object->format[object->currentList]->pos.y;
|
||||
const int32_t listybottom = klabs(object->format[object->currentList]->bottomcutoff);
|
||||
const int32_t ytop = listytop + object->findhigh[object->currentList]->type * (object->font[object->currentList]->get_yline() + object->getMarginBottom(object->currentList));
|
||||
|
@ -6665,10 +6655,12 @@ static void Menu_RunInput_FileSelect_MovementVerify(MenuFileSelect_t *object)
|
|||
object->scrollPos[object->currentList] = ybottom - listybottom;
|
||||
else if (ytop - object->scrollPos[object->currentList] < listytop)
|
||||
object->scrollPos[object->currentList] = ytop - listytop;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMovement_t direction)
|
||||
{
|
||||
#if 0
|
||||
switch (direction)
|
||||
{
|
||||
case MM_Up:
|
||||
|
@ -6706,10 +6698,12 @@ static void Menu_RunInput_FileSelect_Movement(MenuFileSelect_t *object, MenuMove
|
|||
}
|
||||
|
||||
Menu_RunInput_FileSelect_MovementVerify(object);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object)
|
||||
{
|
||||
#if 0
|
||||
if (!object->findhigh[object->currentList])
|
||||
return;
|
||||
|
||||
|
@ -6726,6 +6720,7 @@ static void Menu_RunInput_FileSelect_Select(MenuFileSelect_t *object)
|
|||
{
|
||||
Menu_FileSelect(1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void Menu_RunInput(Menu_t *cm)
|
||||
|
@ -6793,6 +6788,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
|
||||
case FileSelect:
|
||||
{
|
||||
#if 0
|
||||
auto *object = (MenuFileSelect_t*)cm->object;
|
||||
|
||||
if (I_ReturnTrigger() || Menu_RunInput_MouseReturn())
|
||||
|
@ -6935,7 +6931,7 @@ static void Menu_RunInput(Menu_t *cm)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Menu_PreInput(NULL);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -439,14 +439,14 @@ typedef struct MenuFileSelect_t
|
|||
char *destination;
|
||||
|
||||
// state
|
||||
CACHE1D_FIND_REC *findhigh[2];
|
||||
//CACHE1D_FIND_REC *findhigh[2];
|
||||
int32_t scrollPos[2];
|
||||
|
||||
// appearance
|
||||
int32_t marginBottom[2];
|
||||
|
||||
// state
|
||||
fnlist_t fnlist;
|
||||
//fnlist_t fnlist;
|
||||
int32_t currentList;
|
||||
|
||||
int32_t getMarginBottom(size_t index) const { return mulscale16(marginBottom[index], font[index]->zoom); }
|
||||
|
|
|
@ -161,41 +161,6 @@ static int osdcmd_map(osdcmdptr_t parm)
|
|||
|
||||
if (parm->numparms != 1 || wildcardp)
|
||||
{
|
||||
CACHE1D_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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue