hedgewars/uPhysFSLayer.pas
branchwebgl
changeset 8833 c13ebed437cb
parent 8330 aaefa587e277
parent 8714 ab201a62d115
child 8839 caa57115d7ea
--- a/hedgewars/uPhysFSLayer.pas	Wed Feb 20 02:21:58 2013 +0100
+++ b/hedgewars/uPhysFSLayer.pas	Tue Apr 02 21:00:57 2013 +0200
@@ -3,21 +3,17 @@
 interface
 uses SDLh, LuaPas;
 
-{$IFDEF ANDROID}
+const PhysfsLibName = {$IFDEF PHYSFS_INTERNAL}'libhw_physfs'{$ELSE}'libphysfs'{$ENDIF};
+const PhyslayerLibName = 'libphyslayer';
+
+{$IFNDEF WIN32}
     {$linklib physfs}
-{$ELSE}
+    {$linklib physlayer}
     {$IFDEF DARWIN}
-        {$LINKFRAMEWORK IOKit}
+        {$linkframework IOKit}
     {$ENDIF}
 {$ENDIF}
 
-const
-{$IFDEF WIN32}
-    PhysfsLibName = 'libphysfs';
-{$ELSE}
-    PhysfsLibName = 'physfs';
-{$ENDIF}
-
 procedure initModule;
 procedure freeModule;
 
@@ -36,8 +32,8 @@
 
 function pfsExists(fname: shortstring): boolean;
 
-function  physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhysfsLibName;
-procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhysfsLibName;
+function  physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhyslayerLibName;
+procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhyslayerLibName;
 
 {$IFNDEF PAS2C}
 //apparently pas2c doesn't render the functions below if it finds 'implementation' first
@@ -45,10 +41,10 @@
 uses uUtils, uVariables, sysutils;
 {$ENDIF}
 
-function PHYSFS_init(argv: PChar): LongInt; cdecl; external PhysfsLibName;
-function PHYSFS_deinit: LongInt; cdecl; external PhysfsLibName;
-function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
-function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
+function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName;
+function PHYSFS_deinit() : LongInt; cdecl; external PhysfsLibName;
+function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl ; external PhyslayerLibName;
+function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhyslayerLibName;
 
 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName;
 function PHYSFS_openRead(fname: PChar): PFSFile; cdecl; external PhysfsLibName;
@@ -57,7 +53,7 @@
 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
 
-procedure hedgewarsMountPackages; cdecl; external PhysfsLibName;
+procedure hedgewarsMountPackages(); cdecl; external PhyslayerLibName;
 
 {$IFDEF PAS2C}
 implementation
@@ -157,9 +153,9 @@
     i:= PHYSFS_init(Str2PChar(cPhysfsId));
     AddFileLog('[PhysFS] init: ' + inttostr(i));
 
-    i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
+    i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, false);
     AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i));
-    i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, true);
+    i:= PHYSFS_mount(Str2PChar(UserPathPrefix + '/Data'), nil, false);
     AddFileLog('[PhysFS] mount ' + UserPathPrefix + '/Data: ' + inttostr(i));
 
     hedgewarsMountPackages;