Rev 5061 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5 | Plagman | 1 | // cache1d.h |
2 | |||
4747 | terminx | 3 | #ifndef cache1d_h_ |
4 | #define cache1d_h_ |
||
5 | Plagman | 5 | |
618 | terminx | 6 | #include "compat.h" |
1625 | terminx | 7 | #include "mutex.h" |
618 | terminx | 8 | |
4766 | hendricks2 | 9 | #ifdef __cplusplus |
5 | Plagman | 10 | extern "C" { |
11 | #endif |
||
12 | |||
3187 | helixhorne | 13 | #ifdef WITHKPLIB |
14 | int32_t cache1d_file_fromzip(int32_t fil); |
||
4639 | terminx | 15 | extern char *kpzbuf; |
16 | extern int32_t kpzbufsiz; |
||
3187 | helixhorne | 17 | #endif |
1586 | terminx | 18 | |
1205 | terminx | 19 | void initcache(intptr_t dacachestart, int32_t dacachesize); |
20 | void allocache(intptr_t *newhandle, int32_t newbytes, char *newlockptr); |
||
5 | Plagman | 21 | void agecache(void); |
22 | |||
1205 | terminx | 23 | extern int32_t pathsearchmode; // 0 = gamefs mode (default), 1 = localfs mode (editor's mode) |
4766 | hendricks2 | 24 | char *listsearchpath(int32_t initp); |
4886 | hendricks2 | 25 | #define addsearchpath(a) addsearchpath_user(a, 0) |
26 | int32_t addsearchpath_user(const char *p, int32_t user); |
||
3637 | terminx | 27 | int32_t removesearchpath(const char *p); |
4886 | hendricks2 | 28 | void removesearchpaths_withuser(int32_t usermask); |
1205 | terminx | 29 | int32_t findfrompath(const char *fn, char **where); |
30 | int32_t openfrompath(const char *fn, int32_t flags, int32_t mode); |
||
5 | Plagman | 31 | BFILE *fopenfrompath(const char *fn, const char *mode); |
32 | |||
1712 | helixhorne | 33 | int32_t initgroupfile(const char *filename); |
5 | Plagman | 34 | void uninitgroupfile(void); |
1712 | helixhorne | 35 | int32_t kopen4load(const char *filename, char searchfirst); // searchfirst: 0 = anywhere, 1 = first group, 2 = any group |
1205 | terminx | 36 | int32_t kread(int32_t handle, void *buffer, int32_t leng); |
37 | int32_t klseek(int32_t handle, int32_t offset, int32_t whence); |
||
38 | int32_t kfilelength(int32_t handle); |
||
39 | int32_t ktell(int32_t handle); |
||
40 | void kclose(int32_t handle); |
||
5 | Plagman | 41 | |
5064 | hendricks2 | 42 | void krename(int32_t crcval, int32_t filenum, const char *newname); |
5061 | hendricks2 | 43 | |
1677 | terminx | 44 | typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype; |
45 | |||
5 | Plagman | 46 | enum { |
47 | CACHE1D_FIND_FILE = 1, |
||
48 | CACHE1D_FIND_DIR = 2, |
||
49 | CACHE1D_FIND_DRIVE = 4, |
||
4188 | helixhorne | 50 | CACHE1D_FIND_NOCURDIR = 8, |
5 | Plagman | 51 | |
52 | CACHE1D_OPT_NOSTACK = 0x100, |
||
53 | |||
54 | // the lower the number, the higher the priority |
||
55 | CACHE1D_SOURCE_DRIVE = 0, |
||
56 | CACHE1D_SOURCE_CURDIR = 1, |
||
57 | CACHE1D_SOURCE_PATH = 2, // + path stack depth |
||
58 | CACHE1D_SOURCE_ZIP = 0x7ffffffe, |
||
59 | CACHE1D_SOURCE_GRP = 0x7fffffff, |
||
60 | }; |
||
61 | typedef struct _CACHE1D_FIND_REC { |
||
62 | char *name; |
||
1205 | terminx | 63 | int32_t type, source; |
5 | Plagman | 64 | struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb; |
65 | } CACHE1D_FIND_REC; |
||
66 | void klistfree(CACHE1D_FIND_REC *rec); |
||
1205 | terminx | 67 | CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int32_t type); |
5 | Plagman | 68 | |
1205 | terminx | 69 | int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil); |
2362 | helixhorne | 70 | #if 0 |
1205 | terminx | 71 | int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil); |
2361 | helixhorne | 72 | void kdfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil); |
2362 | helixhorne | 73 | #endif |
2361 | helixhorne | 74 | void dfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil); |
5 | Plagman | 75 | |
4766 | hendricks2 | 76 | #ifdef __cplusplus |
5 | Plagman | 77 | } |
78 | #endif |
||
79 | |||
4747 | terminx | 80 | #endif // cache1d_h_ |
5 | Plagman | 81 |