# HG changeset patch # User unc0rr # Date 1485292652 -10800 # Node ID cc2d2f910d5a0efb672d62ab57f39d0a1e28da8b # Parent 1dbdf05b01ee3af62c8147793237a0899b212341 Add a buffer for files opened with physfs for reading, fixes slow engine start diff -r 1dbdf05b01ee -r cc2d2f910d5a hedgewars/uPhysFSLayer.pas --- a/hedgewars/uPhysFSLayer.pas Sun Jan 15 19:35:41 2017 -0500 +++ b/hedgewars/uPhysFSLayer.pas Wed Jan 25 00:17:32 2017 +0300 @@ -58,6 +58,7 @@ function PHYSFS_seek(f: PFSFile; pos: QWord): LongBool; cdecl; external PhysfsLibName; function PHYSFS_flush(f: PFSFile): LongBool; cdecl; external PhysfsLibName; function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName; +function PHYSFS_setBuffer(f: PFSFile; pos: QWord): LongBool; cdecl; external PhysfsLibName; function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName; function PHYSFS_mkdir(path: PChar): LongBool; cdecl; external PhysfsLibName; function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName; @@ -81,8 +82,12 @@ end; function pfsOpenRead(fname: shortstring): PFSFile; +var f: PFSFile; begin - exit(PHYSFS_openRead(Str2PChar(fname))); + f:= PHYSFS_openRead(Str2PChar(fname)); + if f <> nil then + PHYSFS_setBuffer(f, 4096); + exit(f); end; function pfsOpenWrite(fname: shortstring): PFSFile;