Subversion Repositories eduke32

Rev

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