Subversion Repositories eduke32

Rev

Rev 5058 | 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
 
1677 terminx 42
typedef struct { intptr_t *hand; int32_t leng; char *lock ; } cactype;
43
 
5 Plagman 44
enum {
45
        CACHE1D_FIND_FILE = 1,
46
        CACHE1D_FIND_DIR = 2,
47
        CACHE1D_FIND_DRIVE = 4,
4188 helixhorne 48
        CACHE1D_FIND_NOCURDIR = 8,
5 Plagman 49
 
50
        CACHE1D_OPT_NOSTACK = 0x100,
51
 
52
        // the lower the number, the higher the priority
53
        CACHE1D_SOURCE_DRIVE = 0,
54
        CACHE1D_SOURCE_CURDIR = 1,
55
        CACHE1D_SOURCE_PATH = 2,        // + path stack depth
56
        CACHE1D_SOURCE_ZIP = 0x7ffffffe,
57
        CACHE1D_SOURCE_GRP = 0x7fffffff,
58
};
59
typedef struct _CACHE1D_FIND_REC {
60
        char *name;
1205 terminx 61
        int32_t type, source;
5 Plagman 62
        struct _CACHE1D_FIND_REC *next, *prev, *usera, *userb;
63
} CACHE1D_FIND_REC;
64
void klistfree(CACHE1D_FIND_REC *rec);
1205 terminx 65
CACHE1D_FIND_REC *klistpath(const char *path, const char *mask, int32_t type);
5 Plagman 66
 
1205 terminx 67
int32_t kdfread(void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil);
2362 helixhorne 68
#if 0
1205 terminx 69
int32_t dfread(void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
2361 helixhorne 70
void    kdfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, int32_t fil);
2362 helixhorne 71
#endif
2361 helixhorne 72
void    dfwrite(const void *buffer, bsize_t dasizeof, bsize_t count, BFILE *fil);
5 Plagman 73
 
4766 hendricks2 74
#ifdef __cplusplus
5 Plagman 75
}
76
#endif
77
 
4747 terminx 78
#endif // cache1d_h_
5 Plagman 79