hedgewars/uPhysFSLayer.pas
branchwebgl
changeset 8105 d088be5ecdcb
parent 8099 a7f02b902b6f
child 8330 aaefa587e277
equal deleted inserted replaced
8102:20ef5bf0dc7f 8105:d088be5ecdcb
    20 
    20 
    21 procedure initModule;
    21 procedure initModule;
    22 procedure freeModule;
    22 procedure freeModule;
    23 
    23 
    24 type PFSFile = pointer;
    24 type PFSFile = pointer;
    25 {$IFDEF PAS2C}
       
    26      Int64 = LongInt; //FIXME!!!!!!!!!
       
    27      LongBool = boolean;
       
    28 {$ENDIF}
       
    29 
    25 
    30 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
    26 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
    31 function rwopsOpenWrite(fname: shortstring): PSDL_RWops;
    27 function rwopsOpenWrite(fname: shortstring): PSDL_RWops;
    32 
    28 
    33 function pfsOpenRead(fname: shortstring): PFSFile;
    29 function pfsOpenRead(fname: shortstring): PFSFile;
    40 function pfsExists(fname: shortstring): boolean;
    36 function pfsExists(fname: shortstring): boolean;
    41 
    37 
    42 function  physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhysfsLibName;
    38 function  physfsReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; cdecl; external PhysfsLibName;
    43 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhysfsLibName;
    39 procedure physfsReaderSetBuffer(buf: pointer); cdecl; external PhysfsLibName;
    44 
    40 
       
    41 {$IFNDEF PAS2C}
       
    42 //apparently pas2c doesn't render the functions below if it finds 'implementation' first
    45 implementation
    43 implementation
    46 uses uUtils, uVariables;
    44 uses uUtils, uVariables;
       
    45 {$ENDIF}
    47 
    46 
    48 {$IFNDEF PAS2C}
    47 function PHYSFS_init(argv: PChar): LongInt; cdecl; external PhysfsLibName;
    49 // pas2c unable to parse this section???
       
    50 
       
    51 function PHYSFS_init(argv0: PChar) : LongInt; cdecl; external PhysfsLibName;
       
    52 function PHYSFS_deinit: LongInt; cdecl; external PhysfsLibName;
    48 function PHYSFS_deinit: LongInt; cdecl; external PhysfsLibName;
    53 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
    49 function PHYSFSRWOPS_openRead(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
    54 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
    50 function PHYSFSRWOPS_openWrite(fname: PChar): PSDL_RWops; cdecl; external PhysfsLibName;
    55 
    51 
    56 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName;
    52 function PHYSFS_mount(newDir, mountPoint: PChar; appendToPath: LongBool) : LongInt; cdecl; external PhysfsLibName;
    59 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    55 function PHYSFS_readBytes(f: PFSFile; buffer: pointer; len: Int64): Int64; cdecl; external PhysfsLibName;
    60 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
    56 function PHYSFS_close(f: PFSFile): LongBool; cdecl; external PhysfsLibName;
    61 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
    57 function PHYSFS_exists(fname: PChar): LongBool; cdecl; external PhysfsLibName;
    62 
    58 
    63 procedure hedgewarsMountPackages; cdecl; external PhysfsLibName;
    59 procedure hedgewarsMountPackages; cdecl; external PhysfsLibName;
       
    60 
       
    61 {$IFDEF PAS2C}
       
    62 implementation
       
    63 uses uUtils, uVariables;
       
    64 {$ENDIF}
    64 
    65 
    65 (*****************************************************************)
    66 (*****************************************************************)
    66 
    67 
    67 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
    68 function rwopsOpenRead(fname: shortstring): PSDL_RWops;
    68 begin
    69 begin
   135 
   136 
   136 procedure freeModule;
   137 procedure freeModule;
   137 begin
   138 begin
   138     PHYSFS_deinit;
   139     PHYSFS_deinit;
   139 end;
   140 end;
   140 {$ENDIF}
       
   141 
   141 
   142 end.
   142 end.