diff -r dc30104660d3 -r fc40b343c45c hedgewars/uPhysFSLayer.pas --- a/hedgewars/uPhysFSLayer.pas Wed Nov 14 23:27:33 2012 +0400 +++ b/hedgewars/uPhysFSLayer.pas Fri Nov 16 00:46:33 2012 +0400 @@ -15,10 +15,13 @@ function rwopsOpenWrite(fname: shortstring): PSDL_RWops; function pfsOpenRead(fname: shortstring): PFSFile; -function pfsEOF(f: PFSFile): boolean; function pfsClose(f: PFSFile): boolean; procedure pfsReadLn(f: PFSFile; var s: shortstring); +function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; +function pfsEOF(f: PFSFile): boolean; + +function pfsExists(fname: shortstring): boolean; implementation uses uUtils, uVariables; @@ -31,8 +34,9 @@ function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external; function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external; function PHYSFS_eof(f: PFSFile): LongBool; cdecl; external; -function PHYSFS_read(f: PFSFile; buf: pointer; objSize, objCount: Longword): Int64; cdecl; external; +function PHYSFS_read(f: PFSFile; buf: pointer; objSize: Longword; objCount: Longword): Int64; cdecl; external; function PHYSFS_close(f: PFSFile): LongBool; cdecl; external; +function PHYSFS_exists(fname: PChar): LongBool; cdecl; external; function rwopsOpenRead(fname: shortstring): PSDL_RWops; begin @@ -59,6 +63,11 @@ exit(PHYSFS_close(f)) end; +function pfsExists(fname: shortstring): boolean; +begin + exit(PHYSFS_exists(Str2PChar(fname))) +end; + procedure pfsReadLn(f: PFSFile; var s: shortstring); var c: char; @@ -73,6 +82,17 @@ end end; +function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64; +var r: Int64; +begin + r:= PHYSFS_read(f, buf, 1, size); + + if r <= 0 then + pfsBlockRead:= 0 + else + pfsBlockRead:= r +end; + procedure initModule; var i: LongInt; begin @@ -81,7 +101,7 @@ i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true); AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i)); - i:= PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true); + i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, true); AddFileLog('[PhysFS] mount ' + UserPathPrefix + ': ' + inttostr(i)); end;