34 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; |
30 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; |
35 function pfsEOF(f: PFSFile): boolean; |
31 function pfsEOF(f: PFSFile): boolean; |
36 |
32 |
37 function pfsExists(fname: shortstring): boolean; |
33 function pfsExists(fname: shortstring): boolean; |
38 |
34 |
39 function physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhysfsLibName; |
35 function physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName; |
40 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhysfsLibName; |
36 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName; |
41 |
37 |
42 {$IFNDEF PAS2C} |
38 {$IFNDEF PAS2C} |
43 //apparently pas2c doesn't render the functions below if it finds 'implementation' first |
39 //apparently pas2c doesn't render the functions below if it finds 'implementation' first |
44 implementation |
40 implementation |
45 uses uUtils, uVariables, sysutils; |
41 uses uUtils, uVariables, sysutils; |
46 {$ENDIF} |
42 {$ENDIF} |
47 |
43 |
48 function PHYSFS_init(argv: PChar): LongInt; cdecl; external PhysfsLibName; |
44 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName; |
49 function PHYSFS_deinit: LongInt; cdecl; external PhysfsLibName; |
45 function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName; |
50 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName; |
46 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl ; external PhyslayerLibName; |
51 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName; |
47 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; |
52 |
48 |
53 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName; |
49 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName; |
54 function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external PhysfsLibName; |
50 function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external PhysfsLibName; |
55 function PHYSFS_eof(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
51 function PHYSFS_eof(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
56 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName; |
52 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName; |
57 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
53 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
58 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName; |
54 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName; |
59 |
55 |
60 procedure hedgewarsMountPackages; cdecl; external PhysfsLibName; |
56 procedure hedgewarsMountPackages(); cdecl; external PhyslayerLibName; |
61 |
57 |
62 {$IFDEF PAS2C} |
58 {$IFDEF PAS2C} |
63 implementation |
59 implementation |
64 uses uUtils, uVariables; |
60 uses uUtils, uVariables; |
65 {$ENDIF} |
61 {$ENDIF} |
155 {$ENDIF} |
151 {$ENDIF} |
156 |
152 |
157 i:= PHYSFS_init(Str2PChar(cPhysfsId)); |
153 i:= PHYSFS_init(Str2PChar(cPhysfsId)); |
158 AddFileLog('[PhysFS] init: ' + inttostr(i)); |
154 AddFileLog('[PhysFS] init: ' + inttostr(i)); |
159 |
155 |
160 i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true); |
156 i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, false); |
161 AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i)); |
157 AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i)); |
162 i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, true); |
158 i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, false); |
163 AddFileLog('[PhysFS] mount ' + UserPathPrefix + '/Data: ' + inttostr(i)); |
159 AddFileLog('[PhysFS] mount ' + UserPathPrefix + '/Data: ' + inttostr(i)); |
164 |
160 |
165 hedgewarsMountPackages; |
161 hedgewarsMountPackages; |
166 end; |
162 end; |
167 |
163 |