hedgewars/uPhysFSLayer.pas
author unc0rr
Wed, 14 Nov 2012 00:41:29 +0400
branchphysfslayer
changeset 8022 10b3b93c1f56
parent 7963 9910f303f5b6
child 8025 07862ab415c8
permissions -rw-r--r--
- Add physfsrwops library - Load images via physfs (crashes)

unit uPhysFSLayer;

{$LINKLIB ../bin/libphysfs.a}
{$LINKLIB ../bin/libphysfsrwops.a}

interface
uses SDLh;

procedure initModule;
procedure freeModule;

function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external;
function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external;

implementation
uses uUtils, uVariables;

function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external;
function PHYSFS_deinit() : LongInt; cdecl; external;

function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external;

procedure initModule;
begin
    PHYSFS_init(Str2PChar(ParamStr(0)));

    PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
    PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true);
end;

procedure freeModule;
begin
    PHYSFS_deinit;
end;

end.