1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // filecache - code for background file reading/caching
4 //
5 /////////////////////////////////////////////////////////////////////////////
6 
7 #ifndef FILECACHE_H
8 #define FILECACHE_H
9 
10 /////////////////////////////////////////////////////////////////////////////
11 //
12 // BLOCKS MUST BE 255 OR LESS
13 //
14 // hint: if you set realfd to a negative number, that means it'll use the
15 // gdrom routines to read a pak file starting at that (positive) lba
16 //
17 void filecache_init(
18   int realfd,
19   int pakcdsectors,
20   int blocksize,
21   unsigned char blocks,
22   int vfds
23 );
24 
25 //
26 // Clear All Allocations
27 //
28 void filecache_term(void);
29 
30 //
31 // attempt to read a block
32 // returns the number of bytes read or 0 on error
33 //
34 int filecache_readpakblock(
35   unsigned char *dest,
36   int pakblock,
37   int startofs,
38   int bytes,
39   int blocking
40 );
41 
42 //
43 // set up where the vfd pointers are
44 //
45 void filecache_setvfd(int vfd, int start, int block, int readahead);
46 
47 //
48 // call this every now and then
49 //
50 void filecache_process(void);
51 
52 void filecache_wait_for_prebuffer(int vfd, int nblocks);
53 
54 /////////////////////////////////////////////////////////////////////////////
55 
56 #endif
57 
58