by adding a blacklist of folders logs, luafiles, replay etc shouldnt ever contain addons so those can be skipped entirely this massively speeds up searching for addons on windows also will make findfile try to search in the designated addon folders first so it doesent look in the home or kart folders before it this is probably not the best way to do things but idk what im even doing, im not a coder just some chao who likes to sleep all day
108 lines
2.4 KiB
C
108 lines
2.4 KiB
C
/// \file
|
|
/// \brief Support to find files
|
|
|
|
#ifndef __FILESRCH_H__
|
|
#define __FILESRCH_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "doomdef.h"
|
|
#include "d_netfil.h"
|
|
#include "m_menu.h" // MAXSTRINGLENGTH
|
|
#include "m_textinput.h"
|
|
|
|
extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
|
|
|
|
/** \brief The filesearch function
|
|
|
|
This function search files, manly WADs and return back the status of the file
|
|
|
|
\param filename the file to look for
|
|
\param startpath where to start look from
|
|
\param wantedmd5sum want to check with MD5
|
|
\param completepath want to return the complete path of the file?
|
|
\param maxsearchdepth the max depth to search for the file
|
|
\param skipexclude when true this skips certain named folders
|
|
|
|
\return filestatus_t
|
|
|
|
|
|
*/
|
|
|
|
filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum, boolean completepath, int maxsearchdepth, boolean skipexclude);
|
|
|
|
#define menudepth 20
|
|
|
|
extern char menupath[1024];
|
|
extern size_t menupathindex[menudepth];
|
|
extern size_t menudepthleft;
|
|
|
|
extern char menusearchbuf[MAXSTRINGLENGTH+1];
|
|
extern textinput_t menusearch;
|
|
|
|
extern char **dirmenu;
|
|
extern size_t sizedirmenu;
|
|
extern size_t dir_on[menudepth];
|
|
extern UINT8 refreshdirmenu;
|
|
extern char *refreshdirname;
|
|
|
|
typedef enum
|
|
{
|
|
EXT_FOLDER = 0,
|
|
EXT_UP,
|
|
EXT_NORESULTS,
|
|
EXT_START,
|
|
EXT_TXT = EXT_START,
|
|
EXT_CFG,
|
|
EXT_LOADSTART,
|
|
EXT_WAD = EXT_LOADSTART,
|
|
#ifdef USE_KART
|
|
EXT_KART,
|
|
#endif
|
|
EXT_PK3,
|
|
EXT_SOC,
|
|
EXT_LUA,
|
|
NUM_EXT,
|
|
NUM_EXT_TABLE = NUM_EXT-EXT_START,
|
|
EXT_LOADED = 0x80
|
|
/*
|
|
obviously there can only be 0x7F supported extensions in
|
|
addons menu because we're cramming this into a char out of
|
|
laziness/easy memory allocation (what's the difference?)
|
|
and have stolen a bit to show whether it's loaded or not
|
|
in practice the size of the data type is probably overkill
|
|
toast 02/05/17
|
|
*/
|
|
} ext_enum;
|
|
|
|
typedef enum
|
|
{
|
|
DIR_TYPE = 0,
|
|
DIR_LEN,
|
|
DIR_STRING
|
|
} dirname_enum;
|
|
|
|
typedef enum
|
|
{
|
|
REFRESHDIR_NORMAL = 1,
|
|
REFRESHDIR_ADDFILE = 2,
|
|
REFRESHDIR_WARNING = 4,
|
|
REFRESHDIR_ERROR = 8,
|
|
REFRESHDIR_NOTLOADED = 16,
|
|
REFRESHDIR_MAX = 32,
|
|
REFRESHDIR_GAMEDATA = 64
|
|
} refreshdir_enum;
|
|
|
|
INT32 pathisdirectory(const char *path);
|
|
void closefilemenu(boolean validsize);
|
|
void searchfilemenu(char *tempname);
|
|
boolean preparefilemenu(boolean samedepth, boolean replayhut);
|
|
|
|
#ifdef __cplusplus
|
|
} // extern "C"
|
|
#endif
|
|
|
|
#endif // __FILESRCH_H__
|