1 /// \file
2 /// \brief Support to find files
3 
4 #ifndef __FILESRCH_H__
5 #define __FILESRCH_H__
6 
7 #include "doomdef.h"
8 #include "d_netfil.h"
9 #include "m_menu.h" // MAXSTRINGLENGTH
10 
11 extern consvar_t cv_addons_option, cv_addons_folder, cv_addons_md5, cv_addons_showall, cv_addons_search_case, cv_addons_search_type;
12 
13 /**	\brief	The filesearch function
14 
15 	This function search files, manly WADs and return back the status of the file
16 
17 	\param	filename	the file to look for
18 	\param	startpath	where to start look from
19 	\param	wantedmd5sum	want to check with MD5
20 	\param	completepath	want to return the complete path of the file?
21 	\param	maxsearchdepth	the max depth to search for the file
22 
23 	\return	filestatus_t
24 
25 
26 */
27 
28 filestatus_t filesearch(char *filename, const char *startpath, const UINT8 *wantedmd5sum,
29 	boolean completepath, int maxsearchdepth);
30 
31 #define menudepth 20
32 
33 extern char menupath[1024];
34 extern size_t menupathindex[menudepth];
35 extern size_t menudepthleft;
36 
37 extern char menusearch[MAXSTRINGLENGTH+1];
38 
39 extern char **dirmenu;
40 extern size_t sizedirmenu;
41 extern size_t dir_on[menudepth];
42 extern UINT8 refreshdirmenu;
43 extern char *refreshdirname;
44 
45 extern size_t packetsizetally;
46 extern size_t mainwadstally;
47 
48 typedef enum
49 {
50 	EXT_FOLDER = 0,
51 	EXT_UP,
52 	EXT_NORESULTS,
53 	EXT_START,
54 	EXT_TXT = EXT_START,
55 	EXT_CFG,
56 	EXT_LOADSTART,
57 	EXT_WAD = EXT_LOADSTART,
58 #ifdef USE_KART
59 	EXT_KART,
60 #endif
61 	EXT_PK3,
62 	EXT_SOC,
63 	EXT_LUA,
64 	NUM_EXT,
65 	NUM_EXT_TABLE = NUM_EXT-EXT_START,
66 	EXT_LOADED = 0x80
67 	/*
68 	obviously there can only be 0x7F supported extensions in
69 	addons menu because we're cramming this into a char out of
70 	laziness/easy memory allocation (what's the difference?)
71 	and have stolen a bit to show whether it's loaded or not
72 	in practice the size of the data type is probably overkill
73 	toast 02/05/17
74 	*/
75 } ext_enum;
76 
77 typedef enum
78 {
79 	DIR_TYPE = 0,
80 	DIR_LEN,
81 	DIR_STRING
82 } dirname_enum;
83 
84 typedef enum
85 {
86 	REFRESHDIR_NORMAL = 1,
87 	REFRESHDIR_ADDFILE = 2,
88 	REFRESHDIR_WARNING = 4,
89 	REFRESHDIR_ERROR = 8,
90 	REFRESHDIR_NOTLOADED = 16,
91 	REFRESHDIR_MAX = 32
92 } refreshdir_enum;
93 
94 void closefilemenu(boolean validsize);
95 void searchfilemenu(char *tempname);
96 boolean preparefilemenu(boolean samedepth);
97 
98 #endif // __FILESRCH_H__
99