equal
deleted
inserted
replaced
1 #include "lua.h" |
|
2 #include "physfs.h" |
|
3 |
|
4 #define BUFSIZE 1024 |
|
5 |
|
6 void *physfsReaderBuffer; |
|
7 |
|
8 PHYSFS_DECL const char * physfsReader(lua_State *L, PHYSFS_File *f, size_t *size) |
|
9 { |
|
10 |
|
11 if(PHYSFS_eof(f)) |
|
12 { |
|
13 return NULL; |
|
14 } |
|
15 else |
|
16 { |
|
17 *size = PHYSFS_readBytes(f, physfsReaderBuffer, BUFSIZE); |
|
18 |
|
19 if(*size == 0) |
|
20 return NULL; |
|
21 else |
|
22 return physfsReaderBuffer; |
|
23 } |
|
24 } |
|
25 |
|
26 PHYSFS_DECL void physfsReaderSetBuffer(void *buffer) |
|
27 { |
|
28 physfsReaderBuffer = buffer; |
|
29 } |
|
30 |
|