hedgewars/uPhysFSLayer.pas
branchqmlfrontend
changeset 12855 1b2b84315d27
parent 11841 6adf27e85cae
parent 12122 cc2d2f910d5a
equal deleted inserted replaced
11843:01f88c3b7b66 12855:1b2b84315d27
    59 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    59 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    60 function PHYSFS_writeBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    60 function PHYSFS_writeBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    61 function PHYSFS_seek(f: PFSFile; pos: QWord): LongBool; cdecl; external PhysfsLibName;
    61 function PHYSFS_seek(f: PFSFile; pos: QWord): LongBool; cdecl; external PhysfsLibName;
    62 function PHYSFS_flush(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
    62 function PHYSFS_flush(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
    63 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
    63 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
       
    64 function PHYSFS_setBuffer(f: PFSFile; pos: QWord): LongBool; cdecl; external PhysfsLibName;
    64 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
    65 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
    65 function PHYSFS_mkdir(path: PChar): LongBool; cdecl; external PhysfsLibName;
    66 function PHYSFS_mkdir(path: PChar): LongBool; cdecl; external PhysfsLibName;
    66 function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName;
    67 function PHYSFS_getLastError(): PChar; cdecl; external PhysfsLibName;
    67 function PHYSFS_enumerateFiles(dir: PChar): PPChar; cdecl; external PhysfsLibName;
    68 function PHYSFS_enumerateFiles(dir: PChar): PPChar; cdecl; external PhysfsLibName;
    68 procedure PHYSFS_freeList(list: PPChar); cdecl; external PhysfsLibName;
    69 procedure PHYSFS_freeList(list: PPChar); cdecl; external PhysfsLibName;
    82 begin
    83 begin
    83     exit(PHYSFSRWOPS_openWrite(Str2PChar(fname)));
    84     exit(PHYSFSRWOPS_openWrite(Str2PChar(fname)));
    84 end;
    85 end;
    85 
    86 
    86 function pfsOpenRead(fname: shortstring): PFSFile;
    87 function pfsOpenRead(fname: shortstring): PFSFile;
    87 begin
    88 var f: PFSFile;
    88     exit(PHYSFS_openRead(Str2PChar(fname)));
    89 begin
       
    90     f:= PHYSFS_openRead(Str2PChar(fname));
       
    91     if f <> nil then
       
    92         PHYSFS_setBuffer(f, 4096);
       
    93     exit(f);
    89 end;
    94 end;
    90 
    95 
    91 function pfsOpenWrite(fname: shortstring): PFSFile;
    96 function pfsOpenWrite(fname: shortstring): PFSFile;
    92 begin
    97 begin
    93     exit(PHYSFS_openWrite(Str2PChar(fname)));
    98     exit(PHYSFS_openWrite(Str2PChar(fname)));
   187         pfsBlockRead:= r
   192         pfsBlockRead:= r
   188 end;
   193 end;
   189 
   194 
   190 procedure pfsMount(path: PChar; mountpoint: PChar);
   195 procedure pfsMount(path: PChar; mountpoint: PChar);
   191 begin
   196 begin
       
   197     system.writeln('Mounting ',path,' at ', mountpoint);
   192     PHYSFS_mount(path, mountpoint, false)
   198     PHYSFS_mount(path, mountpoint, false)
   193 end;
   199 end;
   194 
   200 
   195 procedure pfsMountAtRoot(path: PChar);
   201 procedure pfsMountAtRoot(path: PChar);
   196 begin
   202 begin
       
   203     system.writeln('Mounting ',path,' at root');
   197     pfsMount(path, PChar(_S'/'));
   204     pfsMount(path, PChar(_S'/'));
   198 end;
   205 end;
   199 
   206 
   200 procedure initModule(localPrefix, userPrefix: PChar);
   207 procedure initModule(localPrefix, userPrefix: PChar);
   201 var i: LongInt;
   208 var i: LongInt;