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)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     1
unit uPhysFSLayer;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     2
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     3
{$LINKLIB ../bin/libphysfs.a}
8022
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
     4
{$LINKLIB ../bin/libphysfsrwops.a}
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     5
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     6
interface
8022
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
     7
uses SDLh;
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     8
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
     9
procedure initModule;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    10
procedure freeModule;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    11
8022
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    12
function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external;
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    13
function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external;
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    14
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    15
implementation
8022
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    16
uses uUtils, uVariables;
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    17
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    18
function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    19
function PHYSFS_deinit() : LongInt; cdecl; external;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    20
7963
9910f303f5b6 Fix function prototype
unc0rr
parents: 7959
diff changeset
    21
function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external;
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    22
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    23
procedure initModule;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    24
begin
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    25
    PHYSFS_init(Str2PChar(ParamStr(0)));
8022
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    26
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    27
    PHYSFS_mount(Str2PChar(PathPrefix), nil, true);
10b3b93c1f56 - Add physfsrwops library
unc0rr
parents: 7963
diff changeset
    28
    PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true);
7959
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    29
end;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    30
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    31
procedure freeModule;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    32
begin
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    33
    PHYSFS_deinit;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    34
end;
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    35
644b757d20e6 Start work on physfs support in engine
unc0rr
parents:
diff changeset
    36
end.