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
00338 {
00339 void *opaque;
00340 } PHYSFS_File;
00341
00342
00354 #define PHYSFS_file PHYSFS_File
00355
00356
00372 typedef struct
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
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 1
00403 #define PHYSFS_VER_MINOR 1
00404 #define PHYSFS_VER_PATCH 1
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
00511 __EXPORT__ int PHYSFS_deinit(void);
00512
00513
00542 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00543
00544
00558 __EXPORT__ void PHYSFS_freeList(void *listVar);
00559
00560
00579 __EXPORT__ const char *PHYSFS_getLastError(void);
00580
00581
00595 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
00596
00597
00628 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
00629
00630
00631
00671 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
00672
00673
00690 __EXPORT__ const char *PHYSFS_getBaseDir(void);
00691
00692
00713 __EXPORT__ const char *PHYSFS_getUserDir(void);
00714
00715
00727 __EXPORT__ const char *PHYSFS_getWriteDir(void);
00728
00729
00749 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
00750
00751
00766 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
00767
00768
00786 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
00787
00788
00815 __EXPORT__ char **PHYSFS_getSearchPath(void);
00816
00817
00875 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
00876 const char *appName,
00877 const char *archiveExt,
00878 int includeCdRoms,
00879 int archivesFirst);
00880
00881
00882
00883
00905 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
00906
00907
00938 __EXPORT__ int PHYSFS_delete(const char *filename);
00939
00940
00966 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
00967
00968
01007 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
01008
01009
01027 __EXPORT__ int PHYSFS_exists(const char *fname);
01028
01029
01047 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
01048
01049
01067 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
01068
01069
01083 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
01084
01085
01086
01087
01110 __EXPORT__ PHYSFS_File *PHYSFS_openWrite(const char *filename);
01111
01112
01136 __EXPORT__ PHYSFS_File *PHYSFS_openAppend(const char *filename);
01137
01138
01161 __EXPORT__ PHYSFS_File *PHYSFS_openRead(const char *filename);
01162
01163
01182 __EXPORT__ int PHYSFS_close(PHYSFS_File *handle);
01183
01184
01201 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
01202 void *buffer,
01203 PHYSFS_uint32 objSize,
01204 PHYSFS_uint32 objCount);
01205
01219 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
01220 const void *buffer,
01221 PHYSFS_uint32 objSize,
01222 PHYSFS_uint32 objCount);
01223
01224
01225
01226
01239 __EXPORT__ int PHYSFS_eof(PHYSFS_File *handle);
01240
01241
01252 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
01253
01254
01269 __EXPORT__ int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
01270
01271
01288 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
01289
01290
01291
01292
01333 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
01334
01335
01352 __EXPORT__ int PHYSFS_flush(PHYSFS_File *handle);
01353
01354
01355
01356
01367 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01368
01369
01380 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01381
01392 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01393
01394
01405 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01406
01420 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01421
01422
01436 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01437
01438
01449 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01450
01451
01462 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01463
01474 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01475
01476
01487 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01488
01489
01503 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01504
01505
01519 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01520
01521
01535 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01536
01537
01552 __EXPORT__ int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01553
01554
01568 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01569
01570
01585 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01586
01587
01601 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01602
01603
01618 __EXPORT__ int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01619
01620
01634 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01635
01636
01651 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01652
01653
01670 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01671
01672
01689 __EXPORT__ int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01690
01691
01708 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01709
01710
01727 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01728
01729
01742 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
01743
01744
01757 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
01758
01759
01772 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
01773
01774
01787 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
01788
01789
01802 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
01803
01804
01817 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
01818
01819
01832 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
01833
01834
01847 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
01848
01849
01865 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
01866
01867
01883 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
01884
01885
01901 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
01902
01903
01919 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
01920
01921
01922
01923
01938 __EXPORT__ int PHYSFS_isInit(void);
01939
01940
01953 __EXPORT__ int PHYSFS_symbolicLinksPermitted(void);
01954
01955
01976 typedef struct
01977 {
01978 int (*Init)(void);
01979 void (*Deinit)(void);
01980 void *(*Malloc)(PHYSFS_uint64);
01981 void *(*Realloc)(void *, PHYSFS_uint64);
01982 void (*Free)(void *);
01983 } PHYSFS_Allocator;
01984
01985
02013 __EXPORT__ int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
02014
02015
02056 __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);
02057
02080 __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir);
02081
02082
02107 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
02108
02109
02141 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
02142 const char *fname);
02143
02144
02176 __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
02177
02178
02212 __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
02213
02214
02253 __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
02254 PHYSFS_EnumFilesCallback c,
02255 void *d);
02256
02276 __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
02277 PHYSFS_uint64 len);
02278
02298 __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
02299 PHYSFS_uint64 len);
02300
02324 __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
02325 PHYSFS_uint64 len);
02326
02350 __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
02351 PHYSFS_uint64 len);
02352
02377 __EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst,
02378 PHYSFS_uint64 len);
02379
02380
02381
02382
02383 #ifdef __cplusplus
02384 }
02385 #endif
02386
02387 #endif
02388
02389
02390