hedgewars/uPhysFSLayer.pas
changeset 8107 ee21b816394f
parent 8080 a6fc5396b3d6
child 8134 38e163cc3bfd
equal deleted inserted replaced
8104:09c38cdf380d 8107:ee21b816394f
    28 
    28 
    29 function pfsOpenRead(fname: shortstring): PFSFile;
    29 function pfsOpenRead(fname: shortstring): PFSFile;
    30 function pfsClose(f: PFSFile): boolean;
    30 function pfsClose(f: PFSFile): boolean;
    31 
    31 
    32 procedure pfsReadLn(f: PFSFile; var s: shortstring);
    32 procedure pfsReadLn(f: PFSFile; var s: shortstring);
       
    33 procedure pfsReadLnA(f: PFSFile; var s: ansistring);
    33 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
    34 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
    34 function pfsEOF(f: PFSFile): boolean;
    35 function pfsEOF(f: PFSFile): boolean;
    35 
    36 
    36 function pfsExists(fname: shortstring): boolean;
    37 function pfsExists(fname: shortstring): boolean;
    37 
    38 
    97         inc(s[0]);
    98         inc(s[0]);
    98         s[byte(s[0])]:= c
    99         s[byte(s[0])]:= c
    99         end
   100         end
   100 end;
   101 end;
   101 
   102 
       
   103 procedure pfsReadLnA(f: PFSFile; var s: ansistring);
       
   104 var c: char;
       
   105     b: shortstring;
       
   106 begin
       
   107 s:= '';
       
   108 b[0]:= #0;
       
   109 
       
   110 while (PHYSFS_readBytes(f, @c, 1) = 1) and (c <> #10) do
       
   111     if (c <> #13) then
       
   112         begin
       
   113         inc(b[0]);
       
   114         b[byte(b[0])]:= c;
       
   115         if b[0] = #255 then
       
   116             begin
       
   117             s:= s + b;
       
   118             b[0]:= #0
       
   119             end
       
   120         end;
       
   121         
       
   122 s:= s + b
       
   123 end;
       
   124 
   102 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
   125 function pfsBlockRead(f: PFSFile; buf: pointer; size: Int64): Int64;
   103 var r: Int64;
   126 var r: Int64;
   104 begin
   127 begin
   105     r:= PHYSFS_readBytes(f, buf, size);
   128     r:= PHYSFS_readBytes(f, buf, size);
   106 
   129