hedgewars/uPhysFSLayer.pas
branchphysfslayer
changeset 8022 10b3b93c1f56
parent 7963 9910f303f5b6
child 8025 07862ab415c8
equal deleted inserted replaced
8019:b216953c2617 8022:10b3b93c1f56
     1 unit uPhysFSLayer;
     1 unit uPhysFSLayer;
     2 
     2 
     3 {$LINKLIB ../bin/libphysfs.a}
     3 {$LINKLIB ../bin/libphysfs.a}
       
     4 {$LINKLIB ../bin/libphysfsrwops.a}
     4 
     5 
     5 interface
     6 interface
       
     7 uses SDLh;
     6 
     8 
     7 procedure initModule;
     9 procedure initModule;
     8 procedure freeModule;
    10 procedure freeModule;
     9 
    11 
       
    12 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external;
       
    13 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external;
       
    14 
    10 implementation
    15 implementation
    11 uses uUtils;
    16 uses uUtils, uVariables;
    12 
    17 
    13 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external;
    18 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external;
    14 function PHYSFS_deinit() : LongInt; cdecl; external;
    19 function PHYSFS_deinit() : LongInt; cdecl; external;
    15 
    20 
    16 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external;
    21 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external;
    17 
    22 
    18 procedure initModule;
    23 procedure initModule;
    19 begin
    24 begin
    20     PHYSFS_init(Str2PChar(ParamStr(0)));
    25     PHYSFS_init(Str2PChar(ParamStr(0)));
       
    26 
       
    27     PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
       
    28     PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true);
    21 end;
    29 end;
    22 
    30 
    23 procedure freeModule;
    31 procedure freeModule;
    24 begin
    32 begin
    25     PHYSFS_deinit;
    33     PHYSFS_deinit;