hedgewars/uPhysFSLayer.pas
branchphysfslayer
changeset 8025 07862ab415c8
parent 8022 10b3b93c1f56
child 8028 dc30104660d3
--- a/hedgewars/uPhysFSLayer.pas	Wed Nov 14 00:41:29 2012 +0400
+++ b/hedgewars/uPhysFSLayer.pas	Wed Nov 14 22:45:36 2012 +0400
@@ -9,23 +9,39 @@
 procedure initModule;
 procedure freeModule;
 
-function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external;
-function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external;
+function rwopsOpenRead(fname: shortstring): PSDL_RWops;
+function rwopsOpenWrite(fname: shortstring): PSDL_RWops;
 
 implementation
 uses uUtils, uVariables;
 
 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external;
 function PHYSFS_deinit() : LongInt; cdecl; external;
+function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external;
+function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external;
 
 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external;
 
-procedure initModule;
+function rwopsOpenRead(fname: shortstring): PSDL_RWops;
+begin
+    exit(PHYSFSRWOPS_openRead(Str2PChar(fname)));
+end;
+
+function rwopsOpenWrite(fname: shortstring): PSDL_RWops;
 begin
-    PHYSFS_init(Str2PChar(ParamStr(0)));
+    exit(PHYSFSRWOPS_openWrite(Str2PChar(fname)));
+end;
 
-    PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
-    PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true);
+procedure initModule;
+var i: LongInt;
+begin
+    i:= PHYSFS_init(Str2PChar(ParamStr(0)));
+    AddFileLog('[PhysFS] init: ' + inttostr(i));
+
+    i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
+    AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i));
+    i:= PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true);
+    AddFileLog('[PhysFS] mount ' + UserPathPrefix + ': ' + inttostr(i));
 end;
 
 procedure freeModule;