00001
00216 #ifndef _INCLUDE_PHYSFS_H_
00217 #define _INCLUDE_PHYSFS_H_
00218
00219 #ifdef __cplusplus
00220 extern "C" {
00221 #endif
00222
00223 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00224 #if (defined _MSC_VER)
00225 #define __EXPORT__ __declspec(dllexport)
00226 #elif (__GNUC__ >= 3)
00227 #define __EXPORT__ __attribute__((visibility("default")))
00228 #else
00229 #define __EXPORT__
00230 #endif
00231 #endif
00232
00237 typedef unsigned char PHYSFS_uint8;
00238
00243 typedef signed char PHYSFS_sint8;
00244
00249 typedef unsigned short PHYSFS_uint16;
00250
00255 typedef signed short PHYSFS_sint16;
00256
00261 typedef unsigned int PHYSFS_uint32;
00262
00267 typedef signed int PHYSFS_sint32;
00268
00284 #if (defined PHYSFS_NO_64BIT_SUPPORT)
00285 typedef PHYSFS_uint32 PHYSFS_uint64;
00286 typedef PHYSFS_sint32 PHYSFS_sint64;
00287 #elif (defined _MSC_VER)
00288 typedef signed __int64 PHYSFS_sint64;
00289 typedef unsigned __int64 PHYSFS_uint64;
00290 #else
00291 typedef unsigned long long PHYSFS_uint64;
00292 typedef signed long long PHYSFS_sint64;
00293 #endif
00294
00295
00296 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00297
00298 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
00299 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
00300
00301 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
00302 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
00303 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
00304 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
00305 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
00306 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
00307
00308 #ifndef PHYSFS_NO_64BIT_SUPPORT
00309 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
00310 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
00311 #endif
00312
00313 #undef PHYSFS_COMPILE_TIME_ASSERT
00314
00315 #endif
00316
00317
00341 typedef struct PHYSFS_File
00342 {
00343 void *opaque;
00344 } PHYSFS_File;
00345
00346
00358 #define PHYSFS_file PHYSFS_File
00359
00360
00376 typedef struct PHYSFS_ArchiveInfo
00377 {
00378 const char *extension;
00379 const char *description;
00380 const char *author;
00381 const char *url;
00382 } PHYSFS_ArchiveInfo;
00383
00384
00398 typedef struct PHYSFS_Version
00399 {
00400 PHYSFS_uint8 major;
00401 PHYSFS_uint8 minor;
00402 PHYSFS_uint8 patch;
00403 } PHYSFS_Version;
00404
00405 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00406 #define PHYSFS_VER_MAJOR 2
00407 #define PHYSFS_VER_MINOR 0
00408 #define PHYSFS_VER_PATCH 1
00409 #endif
00410
00411
00412
00413
00430 #define PHYSFS_VERSION(x) \
00431 { \
00432 (x)->major = PHYSFS_VER_MAJOR; \
00433 (x)->minor = PHYSFS_VER_MINOR; \
00434 (x)->patch = PHYSFS_VER_PATCH; \
00435 }
00436
00437
00464 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
00465
00466
00487 __EXPORT__ int PHYSFS_init(const char *argv0);
00488
00489
00516 __EXPORT__ int PHYSFS_deinit(void);
00517
00518
00547 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00548
00549
00563 __EXPORT__ void PHYSFS_freeList(void *listVar);
00564
00565
00584 __EXPORT__ const char *PHYSFS_getLastError(void);
00585
00586
00600 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
00601
00602
00633 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
00634
00635
00636
00676 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
00677
00678
00695 __EXPORT__ const char *PHYSFS_getBaseDir(void);
00696
00697
00718 __EXPORT__ const char *PHYSFS_getUserDir(void);
00719
00720
00732 __EXPORT__ const char *PHYSFS_getWriteDir(void);
00733
00734
00754 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
00755
00756
00771 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
00772
00773
00791 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
00792
00793
00820 __EXPORT__ char **PHYSFS_getSearchPath(void);
00821
00822
00880 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
00881 const char *appName,
00882 const char *archiveExt,
00883 int includeCdRoms,
00884 int archivesFirst);
00885
00886
00887
00888
00910 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
00911
00912
00943 __EXPORT__ int PHYSFS_delete(const char *filename);
00944
00945
00971 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
00972
00973
01012 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
01013
01014
01032 __EXPORT__ int PHYSFS_exists(const char *fname);
01033
01034
01052 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
01053
01054
01072 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
01073
01074
01088 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
01089
01090
01091
01092
01115 __EXPORT__ PHYSFS_File *PHYSFS_openWrite(const char *filename);
01116
01117
01141 __EXPORT__ PHYSFS_File *PHYSFS_openAppend(const char *filename);
01142
01143
01166 __EXPORT__ PHYSFS_File *PHYSFS_openRead(const char *filename);
01167
01168
01187 __EXPORT__ int PHYSFS_close(PHYSFS_File *handle);
01188
01189
01206 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
01207 void *buffer,
01208 PHYSFS_uint32 objSize,
01209 PHYSFS_uint32 objCount);
01210
01224 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
01225 const void *buffer,
01226 PHYSFS_uint32 objSize,
01227 PHYSFS_uint32 objCount);
01228
01229
01230
01231
01244 __EXPORT__ int PHYSFS_eof(PHYSFS_File *handle);
01245
01246
01257 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
01258
01259
01274 __EXPORT__ int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
01275
01276
01293 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
01294
01295
01296
01297
01338 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
01339
01340
01357 __EXPORT__ int PHYSFS_flush(PHYSFS_File *handle);
01358
01359
01360
01361
01372 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01373
01374
01385 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01386
01397 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01398
01399
01410 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01411
01425 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01426
01427
01441 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01442
01443
01454 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01455
01456
01467 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01468
01479 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01480
01481
01492 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01493
01494
01508 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01509
01510
01524 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01525
01526
01540 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01541
01542
01557 __EXPORT__ int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01558
01559
01573 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
01574
01575
01590 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
01591
01592
01606 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01607
01608
01623 __EXPORT__ int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01624
01625
01639 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
01640
01641
01656 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
01657
01658
01675 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01676
01677
01694 __EXPORT__ int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01695
01696
01713 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
01714
01715
01732 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
01733
01734
01747 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
01748
01749
01762 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
01763
01764
01777 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
01778
01779
01792 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
01793
01794
01807 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
01808
01809
01822 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
01823
01824
01837 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
01838
01839
01852 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
01853
01854
01870 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
01871
01872
01888 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
01889
01890
01906 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
01907
01908
01924 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
01925
01926
01927
01928
01943 __EXPORT__ int PHYSFS_isInit(void);
01944
01945
01958 __EXPORT__ int PHYSFS_symbolicLinksPermitted(void);
01959
01960
01981 typedef struct PHYSFS_Allocator
01982 {
01983 int (*Init)(void);
01984 void (*Deinit)(void);
01985 void *(*Malloc)(PHYSFS_uint64);
01986 void *(*Realloc)(void *, PHYSFS_uint64);
01987 void (*Free)(void *);
01988 } PHYSFS_Allocator;
01989
01990
02018 __EXPORT__ int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
02019
02020
02061 __EXPORT__ int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath);
02062
02085 __EXPORT__ const char *PHYSFS_getMountPoint(const char *dir);
02086
02087
02112 typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
02113
02114
02146 typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
02147 const char *fname);
02148
02149
02181 __EXPORT__ void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
02182
02183
02217 __EXPORT__ void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
02218
02219
02258 __EXPORT__ void PHYSFS_enumerateFilesCallback(const char *dir,
02259 PHYSFS_EnumFilesCallback c,
02260 void *d);
02261
02281 __EXPORT__ void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
02282 PHYSFS_uint64 len);
02283
02303 __EXPORT__ void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
02304 PHYSFS_uint64 len);
02305
02329 __EXPORT__ void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
02330 PHYSFS_uint64 len);
02331
02355 __EXPORT__ void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
02356 PHYSFS_uint64 len);
02357
02382 __EXPORT__ void PHYSFS_utf8FromLatin1(const char *src, char *dst,
02383 PHYSFS_uint64 len);
02384
02385
02386
02387
02388 #ifdef __cplusplus
02389 }
02390 #endif
02391
02392 #endif
02393
02394
02395