00001
00214 #ifndef _INCLUDE_PHYSFS_H_
00215 #define _INCLUDE_PHYSFS_H_
00216
00217 #ifdef __cplusplus
00218 extern "C" {
00219 #endif
00220
00221 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00222 #if (defined _MSC_VER)
00223 #define __EXPORT__ __declspec(dllexport)
00224 #elif (__GNUC__ >= 3)
00225 #define __EXPORT__ __attribute__((visibility("default")))
00226 #else
00227 #define __EXPORT__
00228 #endif
00229 #endif
00230
00235 typedef unsigned char PHYSFS_uint8;
00236
00241 typedef signed char PHYSFS_sint8;
00242
00247 typedef unsigned short PHYSFS_uint16;
00248
00253 typedef signed short PHYSFS_sint16;
00254
00259 typedef unsigned int PHYSFS_uint32;
00260
00265 typedef signed int PHYSFS_sint32;
00266
00282 #if (defined PHYSFS_NO_64BIT_SUPPORT)
00283 typedef PHYSFS_uint32 PHYSFS_uint64;
00284 typedef PHYSFS_sint32 PHYSFS_sint64;
00285 #elif (defined _MSC_VER)
00286 typedef signed __int64 PHYSFS_sint64;
00287 typedef unsigned __int64 PHYSFS_uint64;
00288 #else
00289 typedef unsigned long long PHYSFS_uint64;
00290 typedef signed long long PHYSFS_sint64;
00291 #endif
00292
00293
00294 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00295
00296 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
00297 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
00298
00299 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
00300 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
00301 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
00302 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
00303 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
00304 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
00305
00306 #ifndef PHYSFS_NO_64BIT_SUPPORT
00307 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
00308 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
00309 #endif
00310
00311 #undef PHYSFS_COMPILE_TIME_ASSERT
00312
00313 #endif
00314
00315
00339 typedef struct PHYSFS_File
00340 {
00341 void *opaque;
00342 } PHYSFS_File;
00343
00344
00356 #define PHYSFS_file PHYSFS_File
00357
00358
00374 typedef struct PHYSFS_ArchiveInfo
00375 {
00376 const char *extension;
00377 const char *description;
00378 const char *author;
00379 const char *url;
00380 } PHYSFS_ArchiveInfo;
00381
00382
00396 typedef struct PHYSFS_Version
00397 {
00398 PHYSFS_uint8 major;
00399 PHYSFS_uint8 minor;
00400 PHYSFS_uint8 patch;
00401 } PHYSFS_Version;
00402
00403 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00404 #define PHYSFS_VER_MAJOR 2
00405 #define PHYSFS_VER_MINOR 0
00406 #define PHYSFS_VER_PATCH 0
00407 #endif
00408
00409
00410
00411
00428 #define PHYSFS_VERSION(x) \
00429 { \
00430 (x)->major = PHYSFS_VER_MAJOR; \
00431 (x)->minor = PHYSFS_VER_MINOR; \
00432 (x)->patch = PHYSFS_VER_PATCH; \
00433 }
00434
00435
00462 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
00463
00464
00485 __EXPORT__ int PHYSFS_init(const char *argv0);
00486
00487
00514 __EXPORT__ int PHYSFS_deinit(void);
00515
00516
00545 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00546
00547
00561 __EXPORT__ void PHYSFS_freeList(void *listVar);
00562
00563
00582 __EXPORT__ const char *PHYSFS_getLastError(void);
00583
00584
00598 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
00599
00600
00631 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
00632
00633
00634
00674 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
00675
00676
00693 __EXPORT__ const char *PHYSFS_getBaseDir(void);
00694
00695
00716 __EXPORT__ const char *PHYSFS_getUserDir(void);
00717
00718
00730 __EXPORT__ const char *PHYSFS_getWriteDir(void);
00731
00732
00752 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
00753
00754
00769 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
00770
00771
00789 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
00790
00791
00818 __EXPORT__ char **PHYSFS_getSearchPath(void);
00819
00820
00878 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
00879 const char *appName,
00880 const char *archiveExt,
00881 int includeCdRoms,
00882 int archivesFirst);
00883
00884
00885
00886
00908 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
00909
00910
00941 __EXPORT__ int PHYSFS_delete(const char *filename);
00942
00943
00969 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
00970
00971
01010 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
01011
01012
01030 __EXPORT__ int PHYSFS_exists(const char *fname);
01031
01032
01050 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
01051
01052
01070 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
01071
01072
01086 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
01087
01088
01089
01090
01113 __EXPORT__ PHYSFS_File *PHYSFS_openWrite(const char *filename);
01114
01115
01139 __EXPORT__ PHYSFS_File *PHYSFS_openAppend(const char *filename);
01140
01141
01164 __EXPORT__ PHYSFS_File *PHYSFS_openRead(const char *filename);
01165
01166
01185 __EXPORT__ int PHYSFS_close(PHYSFS_File *handle);
01186
01187
01204 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
01205 void *buffer,
01206 PHYSFS_uint32 objSize,
01207 PHYSFS_uint32 objCount);
01208
01222 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
01223 const void *buffer,
01224 PHYSFS_uint32 objSize,
01225 PHYSFS_uint32 objCount);
01226
01227
01228
01229
01242 __EXPORT__ int PHYSFS_eof(PHYSFS_File *handle);
01243
01244
01255 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
01256
01257
01272 __EXPORT__ int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
01273
01274
01291 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
01292
01293
01294
01295
01336 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
01337
01338
01355 __EXPORT__ int PHYSFS_flush(PHYSFS_File *handle);
01356
01357
01358
01359
01370 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01371
01372
01383 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01384
01395 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01396
01397
01408 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01409
01423 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01424
01425
01439 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01440
01441
01452 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01453
01454
01465 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01466
01477 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01478
01479
01490 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01491
01492
01506 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01507
01508
01522 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01523
01524
01538 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01539
01540
01555 __EXPORT__ int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01556
01557
01571 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01572
01573
01588 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01589
01590
01604 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01605
01606
01621 __EXPORT__ int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01622
01623
01637 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01638
01639
01654 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01655
01656
01673 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01674
01675
01692 __EXPORT__ int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01693
01694
01711 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01712
01713
01730 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01731
01732
01745 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
01746
01747
01760 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
01761
01762
01775 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
01776
01777
01790 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
01791
01792
01805 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
01806
01807
01820 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
01821
01822
01835 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
01836
01837
01850 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
01851
01852
01868 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
01869
01870
01886 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
01887
01888
01904 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
01905
01906
01922 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
01923
01924
01925
01926
01941 __EXPORT__ int PHYSFS_isInit(void);
01942
01943
01956 __EXPORT__ int PHYSFS_symbolicLinksPermitted(void);
01957
01958
01979 typedef struct PHYSFS_Allocator
01980 {
01981 int (*Init)(void);
01982 void (*Deinit)(void);
01983 void *(*Malloc)(PHYSFS_uint64);
01984 void *(*Realloc)(void *, PHYSFS_uint64);
01985 void (*Free)(void *);
01986 } PHYSFS_Allocator;
01987
01988
02016 __EXPORT__ int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
02017
02018
02059 __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);
02060
02083 __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir);
02084
02085
02110 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
02111
02112
02144 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
02145 const char *fname);
02146
02147
02179 __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
02180
02181
02215 __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
02216
02217
02256 __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
02257 PHYSFS_EnumFilesCallback c,
02258 void *d);
02259
02279 __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
02280 PHYSFS_uint64 len);
02281
02301 __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
02302 PHYSFS_uint64 len);
02303
02327 __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
02328 PHYSFS_uint64 len);
02329
02353 __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
02354 PHYSFS_uint64 len);
02355
02380 __EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst,
02381 PHYSFS_uint64 len);
02382
02383
02384
02385
02386 #ifdef __cplusplus
02387 }
02388 #endif
02389
02390 #endif
02391
02392
02393