hedgewars/uPhysFSLayer.pas
changeset 12127 cc2d2f910d5a
parent 11837 f2ab65d97242
child 12860 1b2b84315d27
child 13511 36f3f77e9b1b
--- 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;