27 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; |
29 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; |
28 function pfsEOF(f: PFSFile): boolean; |
30 function pfsEOF(f: PFSFile): boolean; |
29 |
31 |
30 function pfsExists(fname: shortstring): boolean; |
32 function pfsExists(fname: shortstring): boolean; |
31 |
33 |
32 {$IFNDEF PAS2C} |
|
33 function physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName; |
34 function physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName; |
34 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName; |
35 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName; |
35 procedure hedgewarsMountPackage(filename: PChar); cdecl; external PhyslayerLibName; |
36 procedure hedgewarsMountPackage(filename: PChar); cdecl; external PhyslayerLibName; |
36 {$ENDIF} |
|
37 |
37 |
38 implementation |
38 implementation |
39 uses uConsts, uUtils, uVariables{$IFNDEF PAS2C}, sysutils{$ENDIF}; |
39 uses uConsts, uUtils, uVariables{$IFNDEF PAS2C}, sysutils{$ELSE}, physfs{$ENDIF}; |
40 |
40 |
41 {$IFNDEF PAS2C} |
|
42 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName; |
|
43 function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName; |
|
44 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; |
41 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; |
45 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; |
42 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName; |
46 |
43 procedure hedgewarsMountPackages(); cdecl; external PhyslayerLibName; |
|
44 {$IFNDEF PAS2C} |
|
45 function PHYSFS_init(argv0: PChar): LongInt; cdecl; external PhysfsLibName; |
|
46 function PHYSFS_deinit(): LongInt; cdecl; external PhysfsLibName; |
47 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongBool; cdecl; external PhysfsLibName; |
47 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongBool; cdecl; external PhysfsLibName; |
48 function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external PhysfsLibName; |
48 function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external PhysfsLibName; |
49 function PHYSFS_eof(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
49 function PHYSFS_eof(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
50 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName; |
50 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName; |
51 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
51 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName; |
52 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName; |
52 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName; |
53 function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName; |
53 function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName; |
54 |
54 {$ELSE} |
55 procedure hedgewarsMountPackages(); cdecl; external PhyslayerLibName; |
55 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; |
|
56 begin |
|
57 PHYSFS_readBytes:= PHYSFS_read(f, buffer, 1, len); |
|
58 end; |
56 {$ENDIF} |
59 {$ENDIF} |
57 |
60 |
58 function rwopsOpenRead(fname: shortstring): PSDL_RWops; |
61 function rwopsOpenRead(fname: shortstring): PSDL_RWops; |
59 begin |
62 begin |
60 exit(PHYSFSRWOPS_openRead(Str2PChar(fname))); |
63 exit(PHYSFSRWOPS_openRead(Str2PChar(fname))); |