00001
00146 #ifndef _INCLUDE_PHYSFS_H_
00147 #define _INCLUDE_PHYSFS_H_
00148
00149 #ifdef __cplusplus
00150 extern "C" {
00151 #endif
00152
00153 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00154 #if (defined _MSC_VER)
00155 #define __EXPORT__ __declspec(dllexport)
00156 #else
00157 #define __EXPORT__
00158 #endif
00159 #endif
00160
00165 typedef unsigned char PHYSFS_uint8;
00166
00171 typedef signed char PHYSFS_sint8;
00172
00177 typedef unsigned short PHYSFS_uint16;
00178
00183 typedef signed short PHYSFS_sint16;
00184
00189 typedef unsigned int PHYSFS_uint32;
00190
00195 typedef signed int PHYSFS_sint32;
00196
00212 #if (defined PHYSFS_NO_64BIT_SUPPORT)
00213 typedef PHYSFS_uint32 PHYSFS_uint64;
00214 typedef PHYSFS_sint32 PHYSFS_sint64;
00215 #elif (defined _MSC_VER)
00216 typedef signed __int64 PHYSFS_sint64;
00217 typedef unsigned __int64 PHYSFS_uint64;
00218 #else
00219 typedef unsigned long long PHYSFS_uint64;
00220 typedef signed long long PHYSFS_sint64;
00221 #endif
00222
00223
00224 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00225
00226 #define PHYSFS_COMPILE_TIME_ASSERT(name, x) \
00227 typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
00228
00229 PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
00230 PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
00231 PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
00232 PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
00233 PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
00234 PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
00235
00236 #ifndef PHYSFS_NO_64BIT_SUPPORT
00237 PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
00238 PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
00239 #endif
00240
00241 #undef PHYSFS_COMPILE_TIME_ASSERT
00242
00243 #endif
00244
00245
00269 typedef struct
00270 {
00271 void *opaque;
00272 } PHYSFS_File;
00273
00274 typedef PHYSFS_File PHYSFS_file;
00275
00276
00292 typedef struct
00293 {
00294 const char *extension;
00295 const char *description;
00296 const char *author;
00297 const char *url;
00298 } PHYSFS_ArchiveInfo;
00299
00300
00314 typedef struct
00315 {
00316 PHYSFS_uint8 major;
00317 PHYSFS_uint8 minor;
00318 PHYSFS_uint8 patch;
00319 } PHYSFS_Version;
00320
00321 #ifndef DOXYGEN_SHOULD_IGNORE_THIS
00322 #define PHYSFS_VER_MAJOR 1
00323 #define PHYSFS_VER_MINOR 0
00324 #define PHYSFS_VER_PATCH 1
00325 #endif
00326
00327
00328
00329
00346 #define PHYSFS_VERSION(x) \
00347 { \
00348 (x)->major = PHYSFS_VER_MAJOR; \
00349 (x)->minor = PHYSFS_VER_MINOR; \
00350 (x)->patch = PHYSFS_VER_PATCH; \
00351 }
00352
00353
00380 __EXPORT__ void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
00381
00382
00402 __EXPORT__ int PHYSFS_init(const char *argv0);
00403
00404
00429 __EXPORT__ int PHYSFS_deinit(void);
00430
00431
00460 __EXPORT__ const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
00461
00462
00476 __EXPORT__ void PHYSFS_freeList(void *listVar);
00477
00478
00493 __EXPORT__ const char *PHYSFS_getLastError(void);
00494
00495
00509 __EXPORT__ const char *PHYSFS_getDirSeparator(void);
00510
00511
00540 __EXPORT__ void PHYSFS_permitSymbolicLinks(int allow);
00541
00542
00575 __EXPORT__ char **PHYSFS_getCdRomDirs(void);
00576
00577
00594 __EXPORT__ const char *PHYSFS_getBaseDir(void);
00595
00596
00617 __EXPORT__ const char *PHYSFS_getUserDir(void);
00618
00619
00631 __EXPORT__ const char *PHYSFS_getWriteDir(void);
00632
00633
00655 __EXPORT__ int PHYSFS_setWriteDir(const char *newDir);
00656
00657
00675 __EXPORT__ int PHYSFS_addToSearchPath(const char *newDir, int appendToPath);
00676
00677
00695 __EXPORT__ int PHYSFS_removeFromSearchPath(const char *oldDir);
00696
00697
00723 __EXPORT__ char **PHYSFS_getSearchPath(void);
00724
00725
00783 __EXPORT__ int PHYSFS_setSaneConfig(const char *organization,
00784 const char *appName,
00785 const char *archiveExt,
00786 int includeCdRoms,
00787 int archivesFirst);
00788
00789
00790
00791
00813 __EXPORT__ int PHYSFS_mkdir(const char *dirName);
00814
00815
00846 __EXPORT__ int PHYSFS_delete(const char *filename);
00847
00848
00870 __EXPORT__ const char *PHYSFS_getRealDir(const char *filename);
00871
00872
00909 __EXPORT__ char **PHYSFS_enumerateFiles(const char *dir);
00910
00911
00929 __EXPORT__ int PHYSFS_exists(const char *fname);
00930
00931
00949 __EXPORT__ int PHYSFS_isDirectory(const char *fname);
00950
00951
00969 __EXPORT__ int PHYSFS_isSymbolicLink(const char *fname);
00970
00971
00985 __EXPORT__ PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename);
00986
00987
00988
00989
01012 __EXPORT__ PHYSFS_file *PHYSFS_openWrite(const char *filename);
01013
01014
01038 __EXPORT__ PHYSFS_file *PHYSFS_openAppend(const char *filename);
01039
01040
01063 __EXPORT__ PHYSFS_file *PHYSFS_openRead(const char *filename);
01064
01065
01084 __EXPORT__ int PHYSFS_close(PHYSFS_file *handle);
01085
01086
01103 __EXPORT__ PHYSFS_sint64 PHYSFS_read(PHYSFS_file *handle,
01104 void *buffer,
01105 PHYSFS_uint32 objSize,
01106 PHYSFS_uint32 objCount);
01107
01121 __EXPORT__ PHYSFS_sint64 PHYSFS_write(PHYSFS_file *handle,
01122 const void *buffer,
01123 PHYSFS_uint32 objSize,
01124 PHYSFS_uint32 objCount);
01125
01126
01127
01128
01141 __EXPORT__ int PHYSFS_eof(PHYSFS_file *handle);
01142
01143
01154 __EXPORT__ PHYSFS_sint64 PHYSFS_tell(PHYSFS_file *handle);
01155
01156
01171 __EXPORT__ int PHYSFS_seek(PHYSFS_file *handle, PHYSFS_uint64 pos);
01172
01173
01190 __EXPORT__ PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_file *handle);
01191
01192
01193
01194
01235 __EXPORT__ int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 bufsize);
01236
01237
01254 __EXPORT__ int PHYSFS_flush(PHYSFS_file *handle);
01255
01256
01257
01258
01269 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
01270
01271
01282 __EXPORT__ PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
01283
01294 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
01295
01296
01307 __EXPORT__ PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
01308
01322 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
01323
01324
01338 __EXPORT__ PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
01339
01340
01351 __EXPORT__ PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
01352
01353
01364 __EXPORT__ PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
01365
01376 __EXPORT__ PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
01377
01378
01389 __EXPORT__ PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
01390
01391
01405 __EXPORT__ PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
01406
01407
01421 __EXPORT__ PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
01422
01423
01437 __EXPORT__ int PHYSFS_readSLE16(PHYSFS_file *file, PHYSFS_sint16 *val);
01438
01439
01454 __EXPORT__ int PHYSFS_readULE16(PHYSFS_file *file, PHYSFS_uint16 *val);
01455
01456
01470 __EXPORT__ int PHYSFS_readSBE16(PHYSFS_file *file, PHYSFS_sint16 *val);
01471
01472
01487 __EXPORT__ int PHYSFS_readUBE16(PHYSFS_file *file, PHYSFS_uint16 *val);
01488
01489
01503 __EXPORT__ int PHYSFS_readSLE32(PHYSFS_file *file, PHYSFS_sint32 *val);
01504
01505
01520 __EXPORT__ int PHYSFS_readULE32(PHYSFS_file *file, PHYSFS_uint32 *val);
01521
01522
01536 __EXPORT__ int PHYSFS_readSBE32(PHYSFS_file *file, PHYSFS_sint32 *val);
01537
01538
01553 __EXPORT__ int PHYSFS_readUBE32(PHYSFS_file *file, PHYSFS_uint32 *val);
01554
01555
01572 __EXPORT__ int PHYSFS_readSLE64(PHYSFS_file *file, PHYSFS_sint64 *val);
01573
01574
01591 __EXPORT__ int PHYSFS_readULE64(PHYSFS_file *file, PHYSFS_uint64 *val);
01592
01593
01610 __EXPORT__ int PHYSFS_readSBE64(PHYSFS_file *file, PHYSFS_sint64 *val);
01611
01612
01629 __EXPORT__ int PHYSFS_readUBE64(PHYSFS_file *file, PHYSFS_uint64 *val);
01630
01631
01644 __EXPORT__ int PHYSFS_writeSLE16(PHYSFS_file *file, PHYSFS_sint16 val);
01645
01646
01659 __EXPORT__ int PHYSFS_writeULE16(PHYSFS_file *file, PHYSFS_uint16 val);
01660
01661
01674 __EXPORT__ int PHYSFS_writeSBE16(PHYSFS_file *file, PHYSFS_sint16 val);
01675
01676
01689 __EXPORT__ int PHYSFS_writeUBE16(PHYSFS_file *file, PHYSFS_uint16 val);
01690
01691
01704 __EXPORT__ int PHYSFS_writeSLE32(PHYSFS_file *file, PHYSFS_sint32 val);
01705
01706
01719 __EXPORT__ int PHYSFS_writeULE32(PHYSFS_file *file, PHYSFS_uint32 val);
01720
01721
01734 __EXPORT__ int PHYSFS_writeSBE32(PHYSFS_file *file, PHYSFS_sint32 val);
01735
01736
01749 __EXPORT__ int PHYSFS_writeUBE32(PHYSFS_file *file, PHYSFS_uint32 val);
01750
01751
01767 __EXPORT__ int PHYSFS_writeSLE64(PHYSFS_file *file, PHYSFS_sint64 val);
01768
01769
01785 __EXPORT__ int PHYSFS_writeULE64(PHYSFS_file *file, PHYSFS_uint64 val);
01786
01787
01803 __EXPORT__ int PHYSFS_writeSBE64(PHYSFS_file *file, PHYSFS_sint64 val);
01804
01805
01821 __EXPORT__ int PHYSFS_writeUBE64(PHYSFS_file *file, PHYSFS_uint64 val);
01822
01823
01824 #ifdef __cplusplus
01825 }
01826 #endif
01827
01828 #endif
01829
01830
01831