00001
00212 #ifndef _INCLUDE_PHYSFS_H_
00213 #define _INCLUDE_PHYSFS_H_
00214
00215 #ifdef __cplusplus
00216 extern "C" {
00217 #endif
00218
00219 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00220 #if (defined _MSC_VER)
00221 #define __EXPORT__ __declspec(dllexport)
00222 #elif (__GNUC__ >= 3)
00223 #define __EXPORT__ __attribute__((visibility("default")))
00224 #else
00225 #define __EXPORT__
00226 #endif
00227 #endif
00228
00233 typedef unsigned char PHYSFS_uint8;
00234
00239 typedef signed char PHYSFS_sint8;
00240
00245 typedef unsigned short PHYSFS_uint16;
00246
00251 typedef signed short PHYSFS_sint16;
00252
00257 typedef unsigned int PHYSFS_uint32;
00258
00263 typedef signed int PHYSFS_sint32;
00264
00280 #if (defined PHYSFS_NO_64BIT_SUPPORT)
00281 typedef PHYSFS_uint32 PHYSFS_uint64;
00282 typedef PHYSFS_sint32 PHYSFS_sint64;
00283 #elif (defined _MSC_VER)
00284 typedef signed __int64 PHYSFS_sint64;
00285 typedef unsigned __int64 PHYSFS_uint64;
00286 #else
00287 typedef unsigned long long PHYSFS_uint64;
00288 typedef signed long long PHYSFS_sint64;
00289 #endif
00290
00291
00292 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00293
00294 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
00295 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
00296
00297 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
00298 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
00299 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
00300 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
00301 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
00302 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
00303
00304 #ifndef PHYSFS_NO_64BIT_SUPPORT
00305 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
00306 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
00307 #endif
00308
00309 #undef PHYSFS_COMPILE_TIME_ASSERT
00310
00311 #endif
00312
00313
00337 typedef struct PHYSFS_File
00338 {
00339 void *opaque;
00340 } PHYSFS_File;
00341
00342
00354 #define PHYSFS_file PHYSFS_File
00355
00356
00372 typedef struct PHYSFS_ArchiveInfo
00373 {
00374 const char *extension;
00375 const char *description;
00376 const char *author;
00377 const char *url;
00378 } PHYSFS_ArchiveInfo;
00379
00380
00394 typedef struct PHYSFS_Version
00395 {
00396 PHYSFS_uint8 major;
00397 PHYSFS_uint8 minor;
00398 PHYSFS_uint8 patch;
00399 } PHYSFS_Version;
00400
00401 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00402 #define PHYSFS_VER_MAJOR 2
00403 #define PHYSFS_VER_MINOR 0
00404 #define PHYSFS_VER_PATCH 0
00405 #endif
00406
00407
00408
00409
00426 #define PHYSFS_VERSION(x) \
00427 { \
00428 (x)->major = PHYSFS_VER_MAJOR; \
00429 (x)->minor = PHYSFS_VER_MINOR; \
00430 (x)->patch = PHYSFS_VER_PATCH; \
00431 }
00432
00433
00460 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
00461
00462
00483 __EXPORT__ int PHYSFS_init(const char *argv0);
00484
00485
00512 __EXPORT__ int PHYSFS_deinit(void);
00513
00514
00543 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00544
00545
00559 __EXPORT__ void PHYSFS_freeList(void *listVar);
00560
00561
00580 __EXPORT__ const char *PHYSFS_getLastError(void);
00581
00582
00596 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
00597
00598
00629 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
00630
00631
00632
00672 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
00673
00674
00691 __EXPORT__ const char *PHYSFS_getBaseDir(void);
00692
00693
00714 __EXPORT__ const char *PHYSFS_getUserDir(void);
00715
00716
00728 __EXPORT__ const char *PHYSFS_getWriteDir(void);
00729
00730
00750 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
00751
00752
00767 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
00768
00769
00787 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
00788
00789
00816 __EXPORT__ char **PHYSFS_getSearchPath(void);
00817
00818
00876 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
00877 const char *appName,
00878 const char *archiveExt,
00879 int includeCdRoms,
00880 int archivesFirst);
00881
00882
00883
00884
00906 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
00907
00908
00939 __EXPORT__ int PHYSFS_delete(const char *filename);
00940
00941
00967 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
00968
00969
01008 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
01009
01010
01028 __EXPORT__ int PHYSFS_exists(const char *fname);
01029
01030
01048 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
01049
01050
01068 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
01069
01070
01084 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
01085
01086
01087
01088
01111 __EXPORT__ PHYSFS_File *PHYSFS_openWrite(const char *filename);
01112
01113
01137 __EXPORT__ PHYSFS_File *PHYSFS_openAppend(const char *filename);
01138
01139
01162 __EXPORT__ PHYSFS_File *PHYSFS_openRead(const char *filename);
01163
01164
01183 __EXPORT__ int PHYSFS_close(PHYSFS_File *handle);
01184
01185
01202 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
01203 void *buffer,
01204 PHYSFS_uint32 objSize,
01205 PHYSFS_uint32 objCount);
01206
01220 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
01221 const void *buffer,
01222 PHYSFS_uint32 objSize,
01223 PHYSFS_uint32 objCount);
01224
01225
01226
01227
01240 __EXPORT__ int PHYSFS_eof(PHYSFS_File *handle);
01241
01242
01253 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
01254
01255
01270 __EXPORT__ int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
01271
01272
01289 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
01290
01291
01292
01293
01334 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
01335
01336
01353 __EXPORT__ int PHYSFS_flush(PHYSFS_File *handle);
01354
01355
01356
01357
01368 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01369
01370
01381 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01382
01393 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01394
01395
01406 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01407
01421 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01422
01423
01437 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01438
01439
01450 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01451
01452
01463 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01464
01475 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01476
01477
01488 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01489
01490
01504 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01505
01506
01520 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01521
01522
01536 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01537
01538
01553 __EXPORT__ int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01554
01555
01569 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01570
01571
01586 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01587
01588
01602 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01603
01604
01619 __EXPORT__ int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01620
01621
01635 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01636
01637
01652 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01653
01654
01671 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01672
01673
01690 __EXPORT__ int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01691
01692
01709 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01710
01711
01728 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01729
01730
01743 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
01744
01745
01758 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
01759
01760
01773 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
01774
01775
01788 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
01789
01790
01803 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
01804
01805
01818 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
01819
01820
01833 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
01834
01835
01848 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
01849
01850
01866 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
01867
01868
01884 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
01885
01886
01902 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
01903
01904
01920 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
01921
01922
01923
01924
01939 __EXPORT__ int PHYSFS_isInit(void);
01940
01941
01954 __EXPORT__ int PHYSFS_symbolicLinksPermitted(void);
01955
01956
01977 typedef struct PHYSFS_Allocator
01978 {
01979 int (*Init)(void);
01980 void (*Deinit)(void);
01981 void *(*Malloc)(PHYSFS_uint64);
01982 void *(*Realloc)(void *, PHYSFS_uint64);
01983 void (*Free)(void *);
01984 } PHYSFS_Allocator;
01985
01986
02014 __EXPORT__ int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
02015
02016
02057 __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);
02058
02081 __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir);
02082
02083
02108 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
02109
02110
02142 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
02143 const char *fname);
02144
02145
02177 __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
02178
02179
02213 __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
02214
02215
02254 __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
02255 PHYSFS_EnumFilesCallback c,
02256 void *d);
02257
02277 __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
02278 PHYSFS_uint64 len);
02279
02299 __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
02300 PHYSFS_uint64 len);
02301
02325 __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
02326 PHYSFS_uint64 len);
02327
02351 __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
02352 PHYSFS_uint64 len);
02353
02378 __EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst,
02379 PHYSFS_uint64 len);
02380
02381
02382
02383
02384 #ifdef __cplusplus
02385 }
02386 #endif
02387
02388 #endif
02389
02390
02391