7 uses SDLh; |
7 uses SDLh; |
8 |
8 |
9 procedure initModule; |
9 procedure initModule; |
10 procedure freeModule; |
10 procedure freeModule; |
11 |
11 |
12 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external; |
12 function rwopsOpenRead(fname: shortstring): PSDL_RWops; |
13 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external; |
13 function rwopsOpenWrite(fname: shortstring): PSDL_RWops; |
14 |
14 |
15 implementation |
15 implementation |
16 uses uUtils, uVariables; |
16 uses uUtils, uVariables; |
17 |
17 |
18 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external; |
18 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external; |
19 function PHYSFS_deinit() : LongInt; cdecl; external; |
19 function PHYSFS_deinit() : LongInt; cdecl; external; |
|
20 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external; |
|
21 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external; |
20 |
22 |
21 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external; |
23 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external; |
22 |
24 |
|
25 function rwopsOpenRead(fname: shortstring): PSDL_RWops; |
|
26 begin |
|
27 exit(PHYSFSRWOPS_openRead(Str2PChar(fname))); |
|
28 end; |
|
29 |
|
30 function rwopsOpenWrite(fname: shortstring): PSDL_RWops; |
|
31 begin |
|
32 exit(PHYSFSRWOPS_openWrite(Str2PChar(fname))); |
|
33 end; |
|
34 |
23 procedure initModule; |
35 procedure initModule; |
|
36 var i: LongInt; |
24 begin |
37 begin |
25 PHYSFS_init(Str2PChar(ParamStr(0))); |
38 i:= PHYSFS_init(Str2PChar(ParamStr(0))); |
|
39 AddFileLog('[PhysFS] init: ' + inttostr(i)); |
26 |
40 |
27 PHYSFS_mount(Str2PChar(PathPrefix), nil, true); |
41 i:= PHYSFS_mount(Str2PChar(PathPrefix), nil, true); |
28 PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true); |
42 AddFileLog('[PhysFS] mount ' + PathPrefix + ': ' + inttostr(i)); |
|
43 i:= PHYSFS_mount(Str2PChar(UserPathPrefix), nil, true); |
|
44 AddFileLog('[PhysFS] mount ' + UserPathPrefix + ': ' + inttostr(i)); |
29 end; |
45 end; |
30 |
46 |
31 procedure freeModule; |
47 procedure freeModule; |
32 begin |
48 begin |
33 PHYSFS_deinit; |
49 PHYSFS_deinit; |