misc/libphysfs/physfs.h
author unc0rr
Sun, 14 Jan 2018 23:30:42 +0100
branchqmlfrontend
changeset 12892 0088bcccd19a
parent 12213 bb5522e88ab2
permissions -rw-r--r--
Fix for freebsd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     1
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     2
 * \file physfs.h
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
 * Main header file for PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     8
 * \mainpage PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     9
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
 * The latest version of PhysicsFS can be found at:
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
    11
 *     https://icculus.org/physfs/
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    12
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
 * PhysicsFS; a portable, flexible file i/o abstraction.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    15
 * This API gives you access to a system file system in ways superior to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    16
 *  stdio or system i/o calls. The brief benefits:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
 *   - It's portable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
 *   - It's safe. No file access is permitted outside the specified dirs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
 *   - It's flexible. Archives (.ZIP files) can be used transparently as
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
 *      directory structures.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
 * With PhysicsFS, you have a single writing directory and multiple
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
 *  directories (the "search path") for reading. You can think of this as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
 *  filesystem within a filesystem. If (on Windows) you were to set the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
 *  writing directory to "C:\MyGame\MyWritingDirectory", then no PHYSFS calls
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    27
 *  could touch anything above this directory, including the "C:\MyGame" and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
 *  "C:\" directories. This prevents an application's internal scripting
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
 *  language from piddling over c:\\config.sys, for example. If you'd rather
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    30
 *  give PHYSFS full access to the system's REAL file system, set the writing
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    31
 *  dir to "C:\", but that's generally A Bad Thing for several reasons.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    32
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    33
 * Drive letters are hidden in PhysicsFS once you set up your initial paths.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    34
 *  The search path creates a single, hierarchical directory structure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    35
 *  Not only does this lend itself well to general abstraction with archives,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    36
 *  it also gives better support to operating systems like MacOS and Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    37
 *  Generally speaking, you shouldn't ever hardcode a drive letter; not only
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    38
 *  does this hurt portability to non-Microsoft OSes, but it limits your win32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    39
 *  users to a single drive, too. Use the PhysicsFS abstraction functions and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    40
 *  allow user-defined configuration options, too. When opening a file, you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    41
 *  specify it like it was on a Unix filesystem: if you want to write to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
 *  "C:\MyGame\MyConfigFiles\game.cfg", then you might set the write dir to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    43
 *  "C:\MyGame" and then open "MyConfigFiles/game.cfg". This gives an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    44
 *  abstraction across all platforms. Specifying a file in this way is termed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    45
 *  "platform-independent notation" in this documentation. Specifying a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    46
 *  a filename in a form such as "C:\mydir\myfile" or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    47
 *  "MacOS hard drive:My Directory:My File" is termed "platform-dependent
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    48
 *  notation". The only time you use platform-dependent notation is when
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    49
 *  setting up your write directory and search path; after that, all file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
 *  access into those directories are done with platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    51
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    52
 * All files opened for writing are opened in relation to the write directory,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    53
 *  which is the root of the writable filesystem. When opening a file for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    54
 *  reading, PhysicsFS goes through the search path. This is NOT the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
 *  same thing as the PATH environment variable. An application using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    56
 *  PhysicsFS specifies directories to be searched which may be actual
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    57
 *  directories, or archive files that contain files and subdirectories of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
 *  their own. See the end of these docs for currently supported archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    59
 *  formats.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
 * Once the search path is defined, you may open files for reading. If you've
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    62
 *  got the following search path defined (to use a win32 example again):
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    63
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    64
 *  - C:\\mygame
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
 *  - C:\\mygame\\myuserfiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
 *  - D:\\mygamescdromdatafiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    67
 *  - C:\\mygame\\installeddatafiles.zip
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    68
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
 * Then a call to PHYSFS_openRead("textfiles/myfile.txt") (note the directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
 *  separator, lack of drive letter, and lack of dir separator at the start of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
 *  the string; this is platform-independent notation) will check for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
 *  C:\\mygame\\textfiles\\myfile.txt, then
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
 *  C:\\mygame\\myuserfiles\\textfiles\\myfile.txt, then
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    74
 *  D:\\mygamescdromdatafiles\\textfiles\\myfile.txt, then, finally, for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
 *  textfiles\\myfile.txt inside of C:\\mygame\\installeddatafiles.zip.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
 *  Remember that most archive types and platform filesystems store their
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    77
 *  filenames in a case-sensitive manner, so you should be careful to specify
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
 *  it correctly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    80
 * Files opened through PhysicsFS may NOT contain "." or ".." or ":" as dir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
 *  elements. Not only are these meaningless on MacOS Classic and/or Unix,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    82
 *  they are a security hole. Also, symbolic links (which can be found in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
 *  some archive types and directly in the filesystem on Unix platforms) are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
 *  NOT followed until you call PHYSFS_permitSymbolicLinks(). That's left to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
 *  your own discretion, as following a symlink can allow for access outside
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
 *  the write dir and search paths. For portability, there is no mechanism for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    87
 *  creating new symlinks in PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
 * The write dir is not included in the search path unless you specifically
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    90
 *  add it. While you CAN change the write dir as many times as you like,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91
 *  you should probably set it once and stick to it. Remember that your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    92
 *  program will not have permission to write in every directory on Unix and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    93
 *  NT systems.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    94
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    95
 * All files are opened in binary mode; there is no endline conversion for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    96
 *  textfiles. Other than that, PhysicsFS has some convenience functions for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    97
 *  platform-independence. There is a function to tell you the current
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    98
 *  platform's dir separator ("\\" on windows, "/" on Unix, ":" on MacOS),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    99
 *  which is needed only to set up your search/write paths. There is a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   100
 *  function to tell you what CD-ROM drives contain accessible discs, and a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   101
 *  function to recommend a good search path, etc.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   102
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   103
 * A recommended order for the search path is the write dir, then the base dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   104
 *  then the cdrom dir, then any archives discovered. Quake 3 does something
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   105
 *  like this, but moves the archives to the start of the search path. Build
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   106
 *  Engine games, like Duke Nukem 3D and Blood, place the archives last, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   107
 *  use the base dir for both searching and writing. There is a helper
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   108
 *  function (PHYSFS_setSaneConfig()) that puts together a basic configuration
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   109
 *  for you, based on a few parameters. Also see the comments on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   110
 *  PHYSFS_getBaseDir(), and PHYSFS_getPrefDir() for info on what those
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   111
 *  are and how they can help you determine an optimal search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   112
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   113
 * PhysicsFS 2.0 adds the concept of "mounting" archives to arbitrary points
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   114
 *  in the search path. If a zipfile contains "maps/level.map" and you mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   115
 *  that archive at "mods/mymod", then you would have to open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   116
 *  "mods/mymod/maps/level.map" to access the file, even though "mods/mymod"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   117
 *  isn't actually specified in the .zip file. Unlike the Unix mentality of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   118
 *  mounting a filesystem, "mods/mymod" doesn't actually have to exist when
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   119
 *  mounting the zipfile. It's a "virtual" directory. The mounting mechanism
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   120
 *  allows the developer to seperate archives in the tree and avoid trampling
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   121
 *  over files when added new archives, such as including mod support in a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   122
 *  game...keeping external content on a tight leash in this manner can be of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   123
 *  utmost importance to some applications.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   124
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   125
 * PhysicsFS is mostly thread safe. The error messages returned by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   126
 *  PHYSFS_getLastError() are unique by thread, and library-state-setting
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   127
 *  functions are mutex'd. For efficiency, individual file accesses are 
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   128
 *  not locked, so you can not safely read/write/seek/close/etc the same 
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   129
 *  file from two threads at the same time. Other race conditions are bugs 
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   130
 *  that should be reported/patched.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   131
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   132
 * While you CAN use stdio/syscall file access in a program that has PHYSFS_*
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   133
 *  calls, doing so is not recommended, and you can not use system
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   134
 *  filehandles with PhysicsFS and vice versa.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   135
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   136
 * Note that archives need not be named as such: if you have a ZIP file and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   137
 *  rename it with a .PKG extension, the file will still be recognized as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   138
 *  ZIP archive by PhysicsFS; the file's contents are used to determine its
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   139
 *  type where possible.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   140
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   141
 * Currently supported archive types:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   142
 *   - .ZIP (pkZip/WinZip/Info-ZIP compatible)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   143
 *   - .7Z  (7zip archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   144
 *   - .ISO (ISO9660 files, CD-ROM images)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   145
 *   - .GRP (Build Engine groupfile archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   146
 *   - .PAK (Quake I/II archive format)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   147
 *   - .HOG (Descent I/II HOG file archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   148
 *   - .MVL (Descent II movielib archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   149
 *   - .WAD (DOOM engine archives)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   150
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   151
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   152
 * String policy for PhysicsFS 2.0 and later:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   153
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   154
 * PhysicsFS 1.0 could only deal with null-terminated ASCII strings. All high
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   155
 *  ASCII chars resulted in undefined behaviour, and there was no Unicode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   156
 *  support at all. PhysicsFS 2.0 supports Unicode without breaking binary
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   157
 *  compatibility with the 1.0 API by using UTF-8 encoding of all strings
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   158
 *  passed in and out of the library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   159
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   160
 * All strings passed through PhysicsFS are in null-terminated UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   161
 *  This means that if all you care about is English (ASCII characters <= 127)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   162
 *  then you just use regular C strings. If you care about Unicode (and you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   163
 *  should!) then you need to figure out what your platform wants, needs, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   164
 *  offers. If you are on Windows before Win2000 and build with Unicode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   165
 *  support, your TCHAR strings are two bytes per character (this is called
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   166
 *  "UCS-2 encoding"). Any modern Windows uses UTF-16, which is two bytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   167
 *  per character for most characters, but some characters are four. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   168
 *  should convert them to UTF-8 before handing them to PhysicsFS with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   169
 *  PHYSFS_utf8FromUtf16(), which handles both UTF-16 and UCS-2. If you're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   170
 *  using Unix or Mac OS X, your wchar_t strings are four bytes per character
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   171
 *  ("UCS-4 encoding"). Use PHYSFS_utf8FromUcs4(). Mac OS X can give you UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   172
 *  directly from a CFString or NSString, and many Unixes generally give you C
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   173
 *  strings in UTF-8 format everywhere. If you have a single-byte high ASCII
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   174
 *  charset, like so-many European "codepages" you may be out of luck. We'll
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   175
 *  convert from "Latin1" to UTF-8 only, and never back to Latin1. If you're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   176
 *  above ASCII 127, all bets are off: move to Unicode or use your platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   177
 *  facilities. Passing a C string with high-ASCII data that isn't UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   178
 *  encoded will NOT do what you expect!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   179
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   180
 * Naturally, there's also PHYSFS_utf8ToUcs2(), PHYSFS_utf8ToUtf16(), and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   181
 *  PHYSFS_utf8ToUcs4() to get data back into a format you like. Behind the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   182
 *  scenes, PhysicsFS will use Unicode where possible: the UTF-8 strings on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   183
 *  Windows will be converted and used with the multibyte Windows APIs, for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   184
 *  example.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   185
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   186
 * PhysicsFS offers basic encoding conversion support, but not a whole string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   187
 *  library. Get your stuff into whatever format you can work with.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   188
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   189
 * All platforms supported by PhysicsFS 2.1 and later fully support Unicode.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   190
 *  We have dropped platforms that don't (OS/2, Mac OS 9, Windows 95, etc), as
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   191
 *  even an OS that's over a decade old should be expected to handle this well.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   192
 *  If you absolutely must support one of these platforms, you should use an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   193
 *  older release of PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   194
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   195
 * Many game-specific archivers are seriously unprepared for Unicode (the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   196
 *  Descent HOG/MVL and Build Engine GRP archivers, for example, only offer a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   197
 *  DOS 8.3 filename, for example). Nothing can be done for these, but they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   198
 *  tend to be legacy formats for existing content that was all ASCII (and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   199
 *  thus, valid UTF-8) anyhow. Other formats, like .ZIP, don't explicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   200
 *  offer Unicode support, but unofficially expect filenames to be UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   201
 *  encoded, and thus Just Work. Most everything does the right thing without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   202
 *  bothering you, but it's good to be aware of these nuances in case they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   203
 *  don't.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   204
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   205
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   206
 * Other stuff:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   207
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   208
 * Please see the file LICENSE.txt in the source's root directory for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   209
 *  licensing and redistribution rights.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   210
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   211
 * Please see the file CREDITS.txt in the source's "docs" directory for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   212
 *  a more or less complete list of who's responsible for this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   213
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   214
 *  \author Ryan C. Gordon.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   215
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   216
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   217
#ifndef _INCLUDE_PHYSFS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   218
#define _INCLUDE_PHYSFS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   219
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   220
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   221
extern "C" {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   222
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   223
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   224
#if defined(PHYSFS_DECL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   225
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   226
#elif (defined SWIG)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   227
#define PHYSFS_DECL extern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   228
#elif (defined _MSC_VER)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   229
#define PHYSFS_DECL __declspec(dllexport)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   230
#elif (defined __SUNPRO_C)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   231
#define PHYSFS_DECL __global
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   232
#elif ((__GNUC__ >= 3) && (!__EMX__) && (!sun))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   233
#define PHYSFS_DECL __attribute__((visibility("default")))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   234
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   235
#define PHYSFS_DECL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   236
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   237
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   238
#if defined(PHYSFS_DEPRECATED)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   239
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   240
#elif (defined SWIG)  /* ignore deprecated, since bindings use everything. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   241
#define PHYSFS_DEPRECATED
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   242
#elif (__GNUC__ >= 4)  /* technically, this arrived in gcc 3.1, but oh well. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   243
#define PHYSFS_DEPRECATED __attribute__((deprecated))
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   244
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   245
#define PHYSFS_DEPRECATED
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   246
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   247
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   248
#if 0  /* !!! FIXME: look into this later. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   249
#if defined(PHYSFS_CALL)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   250
/* do nothing. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   251
#elif defined(__WIN32__) && !defined(__GNUC__)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   252
#define PHYSFS_CALL __cdecl
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   253
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   254
#define PHYSFS_CALL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   255
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   256
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   257
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   258
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   259
 * \typedef PHYSFS_uint8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   260
 * \brief An unsigned, 8-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   261
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   262
typedef unsigned char         PHYSFS_uint8;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   263
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   264
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   265
 * \typedef PHYSFS_sint8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   266
 * \brief A signed, 8-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   267
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   268
typedef signed char           PHYSFS_sint8;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   269
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   270
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   271
 * \typedef PHYSFS_uint16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   272
 * \brief An unsigned, 16-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   273
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   274
typedef unsigned short        PHYSFS_uint16;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   275
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   276
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   277
 * \typedef PHYSFS_sint16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   278
 * \brief A signed, 16-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   279
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   280
typedef signed short          PHYSFS_sint16;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   281
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   282
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   283
 * \typedef PHYSFS_uint32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   284
 * \brief An unsigned, 32-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   285
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   286
typedef unsigned int          PHYSFS_uint32;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   287
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   288
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   289
 * \typedef PHYSFS_sint32
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   290
 * \brief A signed, 32-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   291
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   292
typedef signed int            PHYSFS_sint32;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   293
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   294
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   295
 * \typedef PHYSFS_uint64
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   296
 * \brief An unsigned, 64-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   297
 * \warning on platforms without any sort of 64-bit datatype, this is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   298
 *           equivalent to PHYSFS_uint32!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   299
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   300
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   301
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   302
 * \typedef PHYSFS_sint64
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   303
 * \brief A signed, 64-bit integer type.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   304
 * \warning on platforms without any sort of 64-bit datatype, this is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   305
 *           equivalent to PHYSFS_sint32!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   306
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   307
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   308
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   309
#if (defined PHYSFS_NO_64BIT_SUPPORT)  /* oh well. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   310
typedef PHYSFS_uint32         PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   311
typedef PHYSFS_sint32         PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   312
#elif (defined _MSC_VER)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   313
typedef signed __int64        PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   314
typedef unsigned __int64      PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   315
#else
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   316
typedef unsigned long long    PHYSFS_uint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   317
typedef signed long long      PHYSFS_sint64;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   318
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   319
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   320
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   321
#ifndef SWIG
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   322
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   323
/* Make sure the types really have the right sizes */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   324
#define PHYSFS_COMPILE_TIME_ASSERT(name, x)               \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   325
       typedef int PHYSFS_dummy_ ## name[(x) * 2 - 1]
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   326
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   327
PHYSFS_COMPILE_TIME_ASSERT(uint8, sizeof(PHYSFS_uint8) == 1);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   328
PHYSFS_COMPILE_TIME_ASSERT(sint8, sizeof(PHYSFS_sint8) == 1);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   329
PHYSFS_COMPILE_TIME_ASSERT(uint16, sizeof(PHYSFS_uint16) == 2);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   330
PHYSFS_COMPILE_TIME_ASSERT(sint16, sizeof(PHYSFS_sint16) == 2);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   331
PHYSFS_COMPILE_TIME_ASSERT(uint32, sizeof(PHYSFS_uint32) == 4);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   332
PHYSFS_COMPILE_TIME_ASSERT(sint32, sizeof(PHYSFS_sint32) == 4);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   333
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   334
#ifndef PHYSFS_NO_64BIT_SUPPORT
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   335
PHYSFS_COMPILE_TIME_ASSERT(uint64, sizeof(PHYSFS_uint64) == 8);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   336
PHYSFS_COMPILE_TIME_ASSERT(sint64, sizeof(PHYSFS_sint64) == 8);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   337
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   338
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   339
#undef PHYSFS_COMPILE_TIME_ASSERT
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   340
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   341
#endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   342
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   343
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   344
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   345
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   346
 * \struct PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   347
 * \brief A PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   348
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   349
 * You get a pointer to one of these when you open a file for reading,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   350
 *  writing, or appending via PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   351
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   352
 * As you can see from the lack of meaningful fields, you should treat this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   353
 *  as opaque data. Don't try to manipulate the file handle, just pass the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   354
 *  pointer you got, unmolested, to various PhysicsFS APIs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   355
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   356
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   357
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   358
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   359
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   360
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   361
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   362
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   363
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   364
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   365
 * \sa PHYSFS_setBuffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   366
 * \sa PHYSFS_flush
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   367
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   368
typedef struct PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   369
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   370
    void *opaque;  /**< That's all you get. Don't touch. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   371
} PHYSFS_File;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   372
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   373
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   374
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   375
 * \def PHYSFS_file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   376
 * \brief 1.0 API compatibility define.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   377
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   378
 * PHYSFS_file is identical to PHYSFS_File. This #define is here for backwards
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   379
 *  compatibility with the 1.0 API, which had an inconsistent capitalization
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   380
 *  convention in this case. New code should use PHYSFS_File, as this #define
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   381
 *  may go away someday.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   382
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   383
 * \sa PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   384
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   385
#define PHYSFS_file PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   386
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   387
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   388
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   389
 * \struct PHYSFS_ArchiveInfo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   390
 * \brief Information on various PhysicsFS-supported archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   391
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   392
 * This structure gives you details on what sort of archives are supported
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   393
 *  by this implementation of PhysicsFS. Archives tend to be things like
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   394
 *  ZIP files and such.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   395
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   396
 * \warning Not all binaries are created equal! PhysicsFS can be built with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   397
 *          or without support for various archives. You can check with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   398
 *          PHYSFS_supportedArchiveTypes() to see if your archive type is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   399
 *          supported.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   400
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   401
 * \sa PHYSFS_supportedArchiveTypes
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   402
 * \sa PHYSFS_registerArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   403
 * \sa PHYSFS_deregisterArchiver
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   404
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   405
typedef struct PHYSFS_ArchiveInfo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   406
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   407
    const char *extension;   /**< Archive file extension: "ZIP", for example. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   408
    const char *description; /**< Human-readable archive description. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   409
    const char *author;      /**< Person who did support for this archive. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   410
    const char *url;         /**< URL related to this archive */
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   411
    int supportsSymlinks;    /**< non-zero if archive offers symbolic links. */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   412
} PHYSFS_ArchiveInfo;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   413
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   414
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   415
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   416
 * \struct PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   417
 * \brief Information the version of PhysicsFS in use.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   418
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   419
 * Represents the library's version as three levels: major revision
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   420
 *  (increments with massive changes, additions, and enhancements),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   421
 *  minor revision (increments with backwards-compatible changes to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   422
 *  major revision), and patchlevel (increments with fixes to the minor
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   423
 *  revision).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   424
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   425
 * \sa PHYSFS_VERSION
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   426
 * \sa PHYSFS_getLinkedVersion
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   427
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   428
typedef struct PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   429
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   430
    PHYSFS_uint8 major; /**< major revision */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   431
    PHYSFS_uint8 minor; /**< minor revision */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   432
    PHYSFS_uint8 patch; /**< patchlevel */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   433
} PHYSFS_Version;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   434
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   435
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   436
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   437
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   438
#ifndef DOXYGEN_SHOULD_IGNORE_THIS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   439
#define PHYSFS_VER_MAJOR 2
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   440
#define PHYSFS_VER_MINOR 1
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   441
#define PHYSFS_VER_PATCH 0
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   442
#endif  /* DOXYGEN_SHOULD_IGNORE_THIS */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   443
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   444
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   445
/* PhysicsFS state stuff ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   446
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   447
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   448
 * \def PHYSFS_VERSION(x)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   449
 * \brief Macro to determine PhysicsFS version program was compiled against.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   450
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   451
 * This macro fills in a PHYSFS_Version structure with the version of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   452
 *  library you compiled against. This is determined by what header the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   453
 *  compiler uses. Note that if you dynamically linked the library, you might
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   454
 *  have a slightly newer or older version at runtime. That version can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   455
 *  determined with PHYSFS_getLinkedVersion(), which, unlike PHYSFS_VERSION,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   456
 *  is not a macro.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   457
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   458
 * \param x A pointer to a PHYSFS_Version struct to initialize.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   459
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   460
 * \sa PHYSFS_Version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   461
 * \sa PHYSFS_getLinkedVersion
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   462
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   463
#define PHYSFS_VERSION(x) \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   464
{ \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   465
    (x)->major = PHYSFS_VER_MAJOR; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   466
    (x)->minor = PHYSFS_VER_MINOR; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   467
    (x)->patch = PHYSFS_VER_PATCH; \
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   468
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   469
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   470
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   471
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   472
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   473
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   474
 * \fn void PHYSFS_getLinkedVersion(PHYSFS_Version *ver)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   475
 * \brief Get the version of PhysicsFS that is linked against your program.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   476
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   477
 * If you are using a shared library (DLL) version of PhysFS, then it is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   478
 *  possible that it will be different than the version you compiled against.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   479
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   480
 * This is a real function; the macro PHYSFS_VERSION tells you what version
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   481
 *  of PhysFS you compiled against:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   482
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   483
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   484
 * PHYSFS_Version compiled;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   485
 * PHYSFS_Version linked;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   486
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   487
 * PHYSFS_VERSION(&compiled);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   488
 * PHYSFS_getLinkedVersion(&linked);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   489
 * printf("We compiled against PhysFS version %d.%d.%d ...\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   490
 *           compiled.major, compiled.minor, compiled.patch);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   491
 * printf("But we linked against PhysFS version %d.%d.%d.\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   492
 *           linked.major, linked.minor, linked.patch);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   493
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   494
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   495
 * This function may be called safely at any time, even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   496
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   497
 * \sa PHYSFS_VERSION
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   498
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   499
PHYSFS_DECL void PHYSFS_getLinkedVersion(PHYSFS_Version *ver);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   500
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   501
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   502
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   503
 * \fn int PHYSFS_init(const char *argv0)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   504
 * \brief Initialize the PhysicsFS library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   505
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   506
 * This must be called before any other PhysicsFS function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   507
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   508
 * This should be called prior to any attempts to change your process's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   509
 *  current working directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   510
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   511
 *   \param argv0 the argv[0] string passed to your program's mainline.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   512
 *          This may be NULL on most platforms (such as ones without a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   513
 *          standard main() function), but you should always try to pass
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   514
 *          something in here. Unix-like systems such as Linux _need_ to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   515
 *          pass argv[0] from main() in here.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   516
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   517
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   518
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   519
 * \sa PHYSFS_deinit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   520
 * \sa PHYSFS_isInit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   521
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   522
PHYSFS_DECL int PHYSFS_init(const char *argv0);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   523
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   524
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   525
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   526
 * \fn int PHYSFS_deinit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   527
 * \brief Deinitialize the PhysicsFS library.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   528
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   529
 * This closes any files opened via PhysicsFS, blanks the search/write paths,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   530
 *  frees memory, and invalidates all of your file handles.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   531
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   532
 * Note that this call can FAIL if there's a file open for writing that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   533
 *  refuses to close (for example, the underlying operating system was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   534
 *  buffering writes to network filesystem, and the fileserver has crashed,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   535
 *  or a hard drive has failed, etc). It is usually best to close all write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   536
 *  handles yourself before calling this function, so that you can gracefully
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   537
 *  handle a specific failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   538
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   539
 * Once successfully deinitialized, PHYSFS_init() can be called again to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   540
 *  restart the subsystem. All default API states are restored at this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   541
 *  point, with the exception of any custom allocator you might have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   542
 *  specified, which survives between initializations.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   543
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   544
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   545
 *          gleaned from PHYSFS_getLastError(). If failure, state of PhysFS is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   546
 *          undefined, and probably badly screwed up.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   547
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   548
 * \sa PHYSFS_init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   549
 * \sa PHYSFS_isInit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   550
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   551
PHYSFS_DECL int PHYSFS_deinit(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   552
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   553
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   554
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   555
 * \fn const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   556
 * \brief Get a list of supported archive types.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   557
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   558
 * Get a list of archive types supported by this implementation of PhysicFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   559
 *  These are the file formats usable for search path entries. This is for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   560
 *  informational purposes only. Note that the extension listed is merely
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   561
 *  convention: if we list "ZIP", you can open a PkZip-compatible archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   562
 *  with an extension of "XYZ", if you like.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   563
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   564
 * The returned value is an array of pointers to PHYSFS_ArchiveInfo structures,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   565
 *  with a NULL entry to signify the end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   566
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   567
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   568
 * PHYSFS_ArchiveInfo **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   569
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   570
 * for (i = PHYSFS_supportedArchiveTypes(); *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   571
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   572
 *     printf("Supported archive: [%s], which is [%s].\n",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   573
 *              (*i)->extension, (*i)->description);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   574
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   575
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   576
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   577
 * The return values are pointers to internal memory, and should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   578
 *  be considered READ ONLY, and never freed. The returned values are
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   579
 *  valid until the next call to PHYSFS_deinit(), PHYSFS_registerArchiver(),
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   580
 *  or PHYSFS_deregisterArchiver().
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   581
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   582
 *   \return READ ONLY Null-terminated array of READ ONLY structures.
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   583
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   584
 * \sa PHYSFS_registerArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
   585
 * \sa PHYSFS_deregisterArchiver
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   586
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   587
PHYSFS_DECL const PHYSFS_ArchiveInfo **PHYSFS_supportedArchiveTypes(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   588
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   589
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   590
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   591
 * \fn void PHYSFS_freeList(void *listVar)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   592
 * \brief Deallocate resources of lists returned by PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   593
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   594
 * Certain PhysicsFS functions return lists of information that are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   595
 *  dynamically allocated. Use this function to free those resources.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   596
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   597
 * It is safe to pass a NULL here, but doing so will cause a crash in versions
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   598
 *  before PhysicsFS 2.1.0.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   599
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   600
 *   \param listVar List of information specified as freeable by this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   601
 *                  Passing NULL is safe; it is a valid no-op.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   602
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   603
 * \sa PHYSFS_getCdRomDirs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   604
 * \sa PHYSFS_enumerateFiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   605
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   606
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   607
PHYSFS_DECL void PHYSFS_freeList(void *listVar);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   608
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   609
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   610
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   611
 * \fn const char *PHYSFS_getLastError(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   612
 * \brief Get human-readable error information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   613
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   614
 * \warning As of PhysicsFS 2.1, this function has been nerfed.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   615
 *          Before PhysicsFS 2.1, this function was the only way to get
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   616
 *          error details beyond a given function's basic return value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   617
 *          This was meant to be a human-readable string in one of several
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   618
 *          languages, and was not useful for application parsing. This was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   619
 *          a problem, because the developer and not the user chose the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   620
 *          language at compile time, and the PhysicsFS maintainers had
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   621
 *          to (poorly) maintain a significant amount of localization work.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   622
 *          The app couldn't parse the strings, even if they counted on a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   623
 *          specific language, since some were dynamically generated.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   624
 *          In 2.1 and later, this always returns a static string in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   625
 *          English; you may use it as a key string for your own
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   626
 *          localizations if you like, as we'll promise not to change
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   627
 *          existing error strings. Also, if your application wants to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   628
 *          look at specific errors, we now offer a better option:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   629
 *          use PHYSFS_getLastErrorCode() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   630
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   631
 * Get the last PhysicsFS error message as a human-readable, null-terminated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   632
 *  string. This will return NULL if there's been no error since the last call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   633
 *  to this function. The pointer returned by this call points to an internal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   634
 *  buffer. Each thread has a unique error state associated with it, but each
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   635
 *  time a new error message is set, it will overwrite the previous one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   636
 *  associated with that thread. It is safe to call this function at anytime,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   637
 *  even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   638
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   639
 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   640
 *  thread-specific error state. Calling one will wipe out the other's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   641
 *  data. If you need both, call PHYSFS_getLastErrorCode(), then pass that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   642
 *  value to PHYSFS_getErrorByCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   643
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   644
 * As of PhysicsFS 2.1, this function only presents text in the English
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   645
 *  language, but the strings are static, so you can use them as keys into
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   646
 *  your own localization dictionary. These strings are meant to be passed on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   647
 *  directly to the user.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   648
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   649
 * Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   650
 *  given function failed; however, if your code require more specifics, you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   651
 *  should use PHYSFS_getLastErrorCode() instead of this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   652
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   653
 *   \return READ ONLY string of last error message.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   654
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   655
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   656
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   657
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   658
PHYSFS_DECL const char *PHYSFS_getLastError(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   659
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   660
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   661
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   662
 * \fn const char *PHYSFS_getDirSeparator(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   663
 * \brief Get platform-dependent dir separator string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   664
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   665
 * This returns "\\" on win32, "/" on Unix, and ":" on MacOS. It may be more
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   666
 *  than one character, depending on the platform, and your code should take
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   667
 *  that into account. Note that this is only useful for setting up the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   668
 *  search/write paths, since access into those dirs always use '/'
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   669
 *  (platform-independent notation) to separate directories. This is also
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   670
 *  handy for getting platform-independent access when using stdio calls.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   671
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   672
 *   \return READ ONLY null-terminated string of platform's dir separator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   673
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   674
PHYSFS_DECL const char *PHYSFS_getDirSeparator(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   675
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   676
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   677
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   678
 * \fn void PHYSFS_permitSymbolicLinks(int allow)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   679
 * \brief Enable or disable following of symbolic links.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   680
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   681
 * Some physical filesystems and archives contain files that are just pointers
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   682
 *  to other files. On the physical filesystem, opening such a link will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   683
 *  (transparently) open the file that is pointed to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   684
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   685
 * By default, PhysicsFS will check if a file is really a symlink during open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   686
 *  calls and fail if it is. Otherwise, the link could take you outside the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   687
 *  write and search paths, and compromise security.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   688
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   689
 * If you want to take that risk, call this function with a non-zero parameter.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   690
 *  Note that this is more for sandboxing a program's scripting language, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   691
 *  case untrusted scripts try to compromise the system. Generally speaking,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   692
 *  a user could very well have a legitimate reason to set up a symlink, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   693
 *  unless you feel there's a specific danger in allowing them, you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   694
 *  permit them.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   695
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   696
 * Symlinks are only explicitly checked when dealing with filenames
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   697
 *  in platform-independent notation. That is, when setting up your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   698
 *  search and write paths, etc, symlinks are never checked for.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   699
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   700
 * Please note that PHYSFS_stat() will always check the path specified; if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   701
 *  that path is a symlink, it will not be followed in any case. If symlinks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   702
 *  aren't permitted through this function, PHYSFS_stat() ignores them, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   703
 *  would treat the query as if the path didn't exist at all.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   704
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   705
 * Symbolic link permission can be enabled or disabled at any time after
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   706
 *  you've called PHYSFS_init(), and is disabled by default.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   707
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   708
 *   \param allow nonzero to permit symlinks, zero to deny linking.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   709
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   710
 * \sa PHYSFS_symbolicLinksPermitted
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   711
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   712
PHYSFS_DECL void PHYSFS_permitSymbolicLinks(int allow);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   713
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   714
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   715
/* !!! FIXME: const this? */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   716
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   717
 * \fn char **PHYSFS_getCdRomDirs(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   718
 * \brief Get an array of paths to available CD-ROM drives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   719
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   720
 * The dirs returned are platform-dependent ("D:\" on Win32, "/cdrom" or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   721
 *  whatnot on Unix). Dirs are only returned if there is a disc ready and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   722
 *  accessible in the drive. So if you've got two drives (D: and E:), and only
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   723
 *  E: has a disc in it, then that's all you get. If the user inserts a disc
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   724
 *  in D: and you call this function again, you get both drives. If, on a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   725
 *  Unix box, the user unmounts a disc and remounts it elsewhere, the next
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   726
 *  call to this function will reflect that change.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   727
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   728
 * This function refers to "CD-ROM" media, but it really means "inserted disc
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   729
 *  media," such as DVD-ROM, HD-DVD, CDRW, and Blu-Ray discs. It looks for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   730
 *  filesystems, and as such won't report an audio CD, unless there's a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   731
 *  mounted filesystem track on it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   732
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   733
 * The returned value is an array of strings, with a NULL entry to signify the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   734
 *  end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   735
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   736
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   737
 * char **cds = PHYSFS_getCdRomDirs();
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   738
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   739
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   740
 * for (i = cds; *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   741
 *     printf("cdrom dir [%s] is available.\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   742
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   743
 * PHYSFS_freeList(cds);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   744
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   745
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   746
 * This call may block while drives spin up. Be forewarned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   747
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   748
 * When you are done with the returned information, you may dispose of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   749
 *  resources by calling PHYSFS_freeList() with the returned pointer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   750
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   751
 *   \return Null-terminated array of null-terminated strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   752
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   753
 * \sa PHYSFS_getCdRomDirsCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   754
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   755
PHYSFS_DECL char **PHYSFS_getCdRomDirs(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   756
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   757
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   758
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   759
 * \fn const char *PHYSFS_getBaseDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   760
 * \brief Get the path where the application resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   761
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   762
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   763
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   764
 * Get the "base dir". This is the directory where the application was run
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   765
 *  from, which is probably the installation directory, and may or may not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   766
 *  be the process's current working directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   767
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   768
 * You should probably use the base dir in your search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   769
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   770
 *  \return READ ONLY string of base dir in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   771
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   772
 * \sa PHYSFS_getPrefDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   773
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   774
PHYSFS_DECL const char *PHYSFS_getBaseDir(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   775
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   776
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   777
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   778
 * \fn const char *PHYSFS_getUserDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   779
 * \brief Get the path where user's home directory resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   780
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   781
 * \deprecated As of PhysicsFS 2.1, you probably want PHYSFS_getPrefDir().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   782
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   783
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   784
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   785
 * Get the "user dir". This is meant to be a suggestion of where a specific
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   786
 *  user of the system can store files. On Unix, this is her home directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   787
 *  On systems with no concept of multiple home directories (MacOS, win95),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   788
 *  this will default to something like "C:\mybasedir\users\username"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   789
 *  where "username" will either be the login name, or "default" if the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   790
 *  platform doesn't support multiple users, either.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   791
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   792
 *  \return READ ONLY string of user dir in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   793
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   794
 * \sa PHYSFS_getBaseDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   795
 * \sa PHYSFS_getPrefDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   796
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   797
PHYSFS_DECL const char *PHYSFS_getUserDir(void) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   798
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   799
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   800
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   801
 * \fn const char *PHYSFS_getWriteDir(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   802
 * \brief Get path where PhysicsFS will allow file writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   803
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   804
 * Get the current write dir. The default write dir is NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   805
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   806
 *  \return READ ONLY string of write dir in platform-dependent notation,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   807
 *           OR NULL IF NO WRITE PATH IS CURRENTLY SET.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   808
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   809
 * \sa PHYSFS_setWriteDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   810
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   811
PHYSFS_DECL const char *PHYSFS_getWriteDir(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   812
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   813
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   814
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   815
 * \fn int PHYSFS_setWriteDir(const char *newDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   816
 * \brief Tell PhysicsFS where it may write files.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   817
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   818
 * Set a new write dir. This will override the previous setting.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   819
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   820
 * This call will fail (and fail to change the write dir) if the current
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   821
 *  write dir still has files open in it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   822
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   823
 *   \param newDir The new directory to be the root of the write dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   824
 *                   specified in platform-dependent notation. Setting to NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   825
 *                   disables the write dir, so no files can be opened for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   826
 *                   writing via PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   827
 *  \return non-zero on success, zero on failure. All attempts to open a file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   828
 *           for writing via PhysicsFS will fail until this call succeeds.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   829
 *           Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   830
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   831
 * \sa PHYSFS_getWriteDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   832
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   833
PHYSFS_DECL int PHYSFS_setWriteDir(const char *newDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   834
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   835
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   836
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   837
 * \fn int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   838
 * \brief Add an archive or directory to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   839
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   840
 * \deprecated As of PhysicsFS 2.0, use PHYSFS_mount() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   841
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   842
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   843
 * This function is equivalent to:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   844
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   845
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   846
 *  PHYSFS_mount(newDir, NULL, appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   847
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   848
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   849
 * You must use this and not PHYSFS_mount if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   850
 *  PhysicsFS 1.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   851
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   852
 * \sa PHYSFS_mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   853
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   854
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   855
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   856
PHYSFS_DECL int PHYSFS_addToSearchPath(const char *newDir, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   857
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   858
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   859
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   860
 * \fn int PHYSFS_removeFromSearchPath(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   861
 * \brief Remove a directory or archive from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   862
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   863
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_unmount() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   864
 *             function just wraps it anyhow. There's no functional difference
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   865
 *             except the vocabulary changed from "adding to the search path"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   866
 *             to "mounting" when that functionality was extended, and thus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   867
 *             the preferred way to accomplish this function's work is now
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   868
 *             called "unmounting."
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   869
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   870
 * This function is equivalent to:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   871
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   872
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   873
 *  PHYSFS_unmount(oldDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   874
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   875
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   876
 * You must use this and not PHYSFS_unmount if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   877
 *  PhysicsFS 1.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   878
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   879
 * \sa PHYSFS_addToSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   880
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   881
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   882
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   883
PHYSFS_DECL int PHYSFS_removeFromSearchPath(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   884
                                            PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   885
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   886
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   887
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   888
 * \fn char **PHYSFS_getSearchPath(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   889
 * \brief Get the current search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   890
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   891
 * The default search path is an empty list.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   892
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   893
 * The returned value is an array of strings, with a NULL entry to signify the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   894
 *  end of the list:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   895
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   896
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   897
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   898
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   899
 * for (i = PHYSFS_getSearchPath(); *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   900
 *     printf("[%s] is in the search path.\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   901
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   902
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   903
 * When you are done with the returned information, you may dispose of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   904
 *  resources by calling PHYSFS_freeList() with the returned pointer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   905
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   906
 *   \return Null-terminated array of null-terminated strings. NULL if there
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   907
 *            was a problem (read: OUT OF MEMORY).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   908
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   909
 * \sa PHYSFS_getSearchPathCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   910
 * \sa PHYSFS_addToSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   911
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   912
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   913
PHYSFS_DECL char **PHYSFS_getSearchPath(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   914
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   915
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   916
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   917
 * \fn int PHYSFS_setSaneConfig(const char *organization, const char *appName, const char *archiveExt, int includeCdRoms, int archivesFirst)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   918
 * \brief Set up sane, default paths.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   919
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   920
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   921
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   922
 * The write dir will be set to the pref dir returned by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   923
 *  \code PHYSFS_getPrefDir(organization, appName) \endcode, which is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   924
 *  created if it doesn't exist.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   925
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   926
 * The above is sufficient to make sure your program's configuration directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   927
 *  is separated from other clutter, and platform-independent.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   928
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   929
 *  The search path will be:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   930
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   931
 *    - The Write Dir (created if it doesn't exist)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   932
 *    - The Base Dir (PHYSFS_getBaseDir())
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   933
 *    - All found CD-ROM dirs (optionally)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   934
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   935
 * These directories are then searched for files ending with the extension
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   936
 *  (archiveExt), which, if they are valid and supported archives, will also
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   937
 *  be added to the search path. If you specified "PKG" for (archiveExt), and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   938
 *  there's a file named data.PKG in the base dir, it'll be checked. Archives
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   939
 *  can either be appended or prepended to the search path in alphabetical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   940
 *  order, regardless of which directories they were found in. All archives
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   941
 *  are mounted in the root of the virtual file system ("/").
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   942
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   943
 * All of this can be accomplished from the application, but this just does it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   944
 *  all for you. Feel free to add more to the search path manually, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   945
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   946
 *    \param organization Name of your company/group/etc to be used as a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   947
 *                         dirname, so keep it small, and no-frills.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   948
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   949
 *    \param appName Program-specific name of your program, to separate it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   950
 *                   from other programs using PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   951
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   952
 *    \param archiveExt File extension used by your program to specify an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   953
 *                      archive. For example, Quake 3 uses "pk3", even though
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   954
 *                      they are just zipfiles. Specify NULL to not dig out
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   955
 *                      archives automatically. Do not specify the '.' char;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   956
 *                      If you want to look for ZIP files, specify "ZIP" and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   957
 *                      not ".ZIP" ... the archive search is case-insensitive.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   958
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   959
 *    \param includeCdRoms Non-zero to include CD-ROMs in the search path, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   960
 *                         (if (archiveExt) != NULL) search them for archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   961
 *                         This may cause a significant amount of blocking
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   962
 *                         while discs are accessed, and if there are no discs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   963
 *                         in the drive (or even not mounted on Unix systems),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   964
 *                         then they may not be made available anyhow. You may
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   965
 *                         want to specify zero and handle the disc setup
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   966
 *                         yourself.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   967
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   968
 *    \param archivesFirst Non-zero to prepend the archives to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   969
 *                          Zero to append them. Ignored if !(archiveExt).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   970
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   971
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   972
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   973
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   974
PHYSFS_DECL int PHYSFS_setSaneConfig(const char *organization,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   975
                                     const char *appName,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   976
                                     const char *archiveExt,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   977
                                     int includeCdRoms,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   978
                                     int archivesFirst);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   979
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   980
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   981
/* Directory management stuff ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   982
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   983
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   984
 * \fn int PHYSFS_mkdir(const char *dirName)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   985
 * \brief Create a directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   986
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   987
 * This is specified in platform-independent notation in relation to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   988
 *  write dir. All missing parent directories are also created if they
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   989
 *  don't exist.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   990
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   991
 * So if you've got the write dir set to "C:\mygame\writedir" and call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   992
 *  PHYSFS_mkdir("downloads/maps") then the directories
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   993
 *  "C:\mygame\writedir\downloads" and "C:\mygame\writedir\downloads\maps"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   994
 *  will be created if possible. If the creation of "maps" fails after we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   995
 *  have successfully created "downloads", then the function leaves the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   996
 *  created directory behind and reports failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   997
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   998
 *   \param dirName New dir to create.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
   999
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1000
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1001
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1002
 * \sa PHYSFS_delete
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1003
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1004
PHYSFS_DECL int PHYSFS_mkdir(const char *dirName);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1005
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1006
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1007
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1008
 * \fn int PHYSFS_delete(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1009
 * \brief Delete a file or directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1010
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1011
 * (filename) is specified in platform-independent notation in relation to the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1012
 *  write dir.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1013
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1014
 * A directory must be empty before this call can delete it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1015
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1016
 * Deleting a symlink will remove the link, not what it points to, regardless
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1017
 *  of whether you "permitSymLinks" or not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1018
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1019
 * So if you've got the write dir set to "C:\mygame\writedir" and call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1020
 *  PHYSFS_delete("downloads/maps/level1.map") then the file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1021
 *  "C:\mygame\writedir\downloads\maps\level1.map" is removed from the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1022
 *  physical filesystem, if it exists and the operating system permits the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1023
 *  deletion.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1024
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1025
 * Note that on Unix systems, deleting a file may be successful, but the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1026
 *  actual file won't be removed until all processes that have an open
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1027
 *  filehandle to it (including your program) close their handles.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1028
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1029
 * Chances are, the bits that make up the file still exist, they are just
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1030
 *  made available to be written over at a later point. Don't consider this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1031
 *  a security method or anything.  :)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1032
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1033
 *   \param filename Filename to delete.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1034
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1035
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1036
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1037
PHYSFS_DECL int PHYSFS_delete(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1038
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1039
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1040
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1041
 * \fn const char *PHYSFS_getRealDir(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1042
 * \brief Figure out where in the search path a file resides.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1043
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1044
 * The file is specified in platform-independent notation. The returned
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1045
 *  filename will be the element of the search path where the file was found,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1046
 *  which may be a directory, or an archive. Even if there are multiple
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1047
 *  matches in different parts of the search path, only the first one found
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1048
 *  is used, just like when opening a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1049
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1050
 * So, if you look for "maps/level1.map", and C:\\mygame is in your search
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1051
 *  path and C:\\mygame\\maps\\level1.map exists, then "C:\mygame" is returned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1052
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1053
 * If a any part of a match is a symbolic link, and you've not explicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1054
 *  permitted symlinks, then it will be ignored, and the search for a match
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1055
 *  will continue.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1056
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1057
 * If you specify a fake directory that only exists as a mount point, it'll
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1058
 *  be associated with the first archive mounted there, even though that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1059
 *  directory isn't necessarily contained in a real archive.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1060
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1061
 * \warning This will return NULL if there is no real directory associated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1062
 *          with (filename). Specifically, PHYSFS_mountIo(),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1063
 *          PHYSFS_mountMemory(), and PHYSFS_mountHandle() will return NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1064
 *          even if the filename is found in the search path. Plan accordingly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1065
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1066
 *     \param filename file to look for.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1067
 *    \return READ ONLY string of element of search path containing the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1068
 *             the file in question. NULL if not found.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1069
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1070
PHYSFS_DECL const char *PHYSFS_getRealDir(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1071
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1072
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1073
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1074
 * \fn char **PHYSFS_enumerateFiles(const char *dir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1075
 * \brief Get a file listing of a search path's directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1076
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1077
 * Matching directories are interpolated. That is, if "C:\mydir" is in the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1078
 *  search path and contains a directory "savegames" that contains "x.sav",
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1079
 *  "y.sav", and "z.sav", and there is also a "C:\userdir" in the search path
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1080
 *  that has a "savegames" subdirectory with "w.sav", then the following code:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1081
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1082
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1083
 * char **rc = PHYSFS_enumerateFiles("savegames");
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1084
 * char **i;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1085
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1086
 * for (i = rc; *i != NULL; i++)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1087
 *     printf(" * We've got [%s].\n", *i);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1088
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1089
 * PHYSFS_freeList(rc);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1090
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1091
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1092
 *  \...will print:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1093
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1094
 * \verbatim
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1095
 * We've got [x.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1096
 * We've got [y.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1097
 * We've got [z.sav].
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1098
 * We've got [w.sav].\endverbatim
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1099
 *
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  1100
 * Feel free to sort the list however you like. However, the returned data
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  1101
 *  will always contain no duplicates, and will be always sorted in alphabetic
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  1102
 *  (rather: Unicode) order for you.
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1103
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1104
 * Don't forget to call PHYSFS_freeList() with the return value from this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1105
 *  function when you are done with it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1106
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1107
 *    \param dir directory in platform-independent notation to enumerate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1108
 *   \return Null-terminated array of null-terminated strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1109
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1110
 * \sa PHYSFS_enumerateFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1111
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1112
PHYSFS_DECL char **PHYSFS_enumerateFiles(const char *dir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1113
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1114
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1115
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1116
 * \fn int PHYSFS_exists(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1117
 * \brief Determine if a file exists in the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1118
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1119
 * Reports true if there is an entry anywhere in the search path by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1120
 *  name of (fname).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1121
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1122
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1123
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1124
 *  might end up further down in the search path than expected.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1125
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1126
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1127
 *   \return non-zero if filename exists. zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1128
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1129
PHYSFS_DECL int PHYSFS_exists(const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1130
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1131
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1132
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1133
 * \fn int PHYSFS_isDirectory(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1134
 * \brief Determine if a file in the search path is really a directory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1135
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1136
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1137
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1138
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1139
 * Determine if the first occurence of (fname) in the search path is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1140
 *  really a directory entry.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1141
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1142
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1143
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1144
 *  might end up further down in the search path than expected.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1145
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1146
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1147
 *   \return non-zero if filename exists and is a directory.  zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1148
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1149
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1150
 * \sa PHYSFS_exists
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1151
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1152
PHYSFS_DECL int PHYSFS_isDirectory(const char *fname) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1153
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1154
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1155
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1156
 * \fn int PHYSFS_isSymbolicLink(const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1157
 * \brief Determine if a file in the search path is really a symbolic link.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1158
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1159
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1160
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1161
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1162
 * Determine if the first occurence of (fname) in the search path is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1163
 *  really a symbolic link.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1164
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1165
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1166
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and as such,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1167
 *  this function will always return 0 in that case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1168
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1169
 *    \param fname filename in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1170
 *   \return non-zero if filename exists and is a symlink.  zero otherwise.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1171
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1172
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1173
 * \sa PHYSFS_exists
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1174
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1175
PHYSFS_DECL int PHYSFS_isSymbolicLink(const char *fname) PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1176
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1177
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1178
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1179
 * \fn PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1180
 * \brief Get the last modification time of a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1181
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1182
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_stat() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1183
 *             function just wraps it anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1184
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1185
 * The modtime is returned as a number of seconds since the Unix epoch
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1186
 *  (midnight, Jan 1, 1970). The exact derivation and accuracy of this time
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1187
 *  depends on the particular archiver. If there is no reasonable way to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1188
 *  obtain this information for a particular archiver, or there was some sort
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1189
 *  of error, this function returns (-1).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1190
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1191
 * You must use this and not PHYSFS_stat() if binary compatibility with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1192
 *  PhysicsFS 2.0 is important (which it may not be for many people).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1193
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1194
 *   \param filename filename to check, in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1195
 *  \return last modified time of the file. -1 if it can't be determined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1196
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1197
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1198
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1199
PHYSFS_DECL PHYSFS_sint64 PHYSFS_getLastModTime(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1200
                                                PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1201
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1202
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1203
/* i/o stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1204
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1205
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1206
 * \fn PHYSFS_File *PHYSFS_openWrite(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1207
 * \brief Open a file for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1208
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1209
 * Open a file for writing, in platform-independent notation and in relation
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1210
 *  to the write dir as the root of the writable filesystem. The specified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1211
 *  file is created if it doesn't exist. If it does exist, it is truncated to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1212
 *  zero bytes, and the writing offset is set to the start.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1213
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1214
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1215
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1216
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1217
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1218
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1219
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1220
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1221
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1222
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1223
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1224
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1225
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1226
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1227
PHYSFS_DECL PHYSFS_File *PHYSFS_openWrite(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1228
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1229
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1230
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1231
 * \fn PHYSFS_File *PHYSFS_openAppend(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1232
 * \brief Open a file for appending.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1233
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1234
 * Open a file for writing, in platform-independent notation and in relation
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1235
 *  to the write dir as the root of the writable filesystem. The specified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1236
 *  file is created if it doesn't exist. If it does exist, the writing offset
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1237
 *  is set to the end of the file, so the first write will be the byte after
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1238
 *  the end.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1239
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1240
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1241
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1242
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1243
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1244
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1245
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1246
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1247
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1248
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1249
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1250
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1251
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1252
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1253
PHYSFS_DECL PHYSFS_File *PHYSFS_openAppend(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1254
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1255
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1256
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1257
 * \fn PHYSFS_File *PHYSFS_openRead(const char *filename)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1258
 * \brief Open a file for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1259
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1260
 * Open a file for reading, in platform-independent notation. The search path
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1261
 *  is checked one at a time until a matching file is found, in which case an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1262
 *  abstract filehandle is associated with it, and reading may be done.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1263
 *  The reading offset is set to the first byte of the file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1264
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1265
 * Note that entries that are symlinks are ignored if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1266
 *  PHYSFS_permitSymbolicLinks(1) hasn't been called, and opening a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1267
 *  symlink with this function will fail in such a case.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1268
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1269
 *   \param filename File to open.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1270
 *  \return A valid PhysicsFS filehandle on success, NULL on error. Specifics
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1271
 *           of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1272
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1273
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1274
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1275
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1276
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1277
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1278
PHYSFS_DECL PHYSFS_File *PHYSFS_openRead(const char *filename);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1279
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1280
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1281
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1282
 * \fn int PHYSFS_close(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1283
 * \brief Close a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1284
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1285
 * This call is capable of failing if the operating system was buffering
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1286
 *  writes to the physical media, and, now forced to write those changes to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1287
 *  physical media, can not store the data for some reason. In such a case,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1288
 *  the filehandle stays open. A well-written program should ALWAYS check the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1289
 *  return value from the close call in addition to every writing call!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1290
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1291
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1292
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1293
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1294
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1295
 * \sa PHYSFS_openRead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1296
 * \sa PHYSFS_openWrite
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1297
 * \sa PHYSFS_openAppend
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1298
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1299
PHYSFS_DECL int PHYSFS_close(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1300
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1301
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1302
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1303
 * \fn PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle, void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1304
 * \brief Read data from a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1305
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1306
 * The file must be opened for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1307
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1308
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_readBytes() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1309
 *             function just wraps it anyhow. This function never clarified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1310
 *             what would happen if you managed to read a partial object, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1311
 *             working at the byte level makes this cleaner for everyone,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1312
 *             especially now that PHYSFS_Io interfaces can be supplied by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1313
 *             application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1314
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1315
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1316
 *   \param buffer buffer to store read data into.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1317
 *   \param objSize size in bytes of objects being read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1318
 *   \param objCount number of (objSize) objects to read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1319
 *  \return number of objects read. PHYSFS_getLastError() can shed light on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1320
 *           the reason this might be < (objCount), as can PHYSFS_eof().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1321
 *            -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1322
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1323
 * \sa PHYSFS_readBytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1324
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1325
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1326
PHYSFS_DECL PHYSFS_sint64 PHYSFS_read(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1327
                                      void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1328
                                      PHYSFS_uint32 objSize,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1329
                                      PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1330
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1331
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1332
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1333
 * \fn PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle, const void *buffer, PHYSFS_uint32 objSize, PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1334
 * \brief Write data to a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1335
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1336
 * The file must be opened for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1337
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1338
 * \deprecated As of PhysicsFS 2.1, use PHYSFS_writeBytes() instead. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1339
 *             function just wraps it anyhow. This function never clarified
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1340
 *             what would happen if you managed to write a partial object, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1341
 *             working at the byte level makes this cleaner for everyone,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1342
 *             especially now that PHYSFS_Io interfaces can be supplied by the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1343
 *             application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1344
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1345
 *   \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1346
 *   \param buffer buffer of bytes to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1347
 *   \param objSize size in bytes of objects being written to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1348
 *   \param objCount number of (objSize) objects to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1349
 *  \return number of objects written. PHYSFS_getLastError() can shed light on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1350
 *           the reason this might be < (objCount). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1351
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1352
 * \sa PHYSFS_writeBytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1353
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1354
PHYSFS_DECL PHYSFS_sint64 PHYSFS_write(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1355
                                       const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1356
                                       PHYSFS_uint32 objSize,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1357
                                       PHYSFS_uint32 objCount)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1358
                                        PHYSFS_DEPRECATED;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1359
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1360
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1361
/* File position stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1362
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1363
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1364
 * \fn int PHYSFS_eof(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1365
 * \brief Check for end-of-file state on a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1366
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1367
 * Determine if the end of file has been reached in a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1368
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1369
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1370
 *  \return nonzero if EOF, zero if not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1371
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1372
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1373
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1374
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1375
PHYSFS_DECL int PHYSFS_eof(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1376
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1377
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1378
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1379
 * \fn PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1380
 * \brief Determine current position within a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1381
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1382
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1383
 *  \return offset in bytes from start of file. -1 if error occurred.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1384
 *           Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1385
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1386
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1387
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1388
PHYSFS_DECL PHYSFS_sint64 PHYSFS_tell(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1389
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1390
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1391
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1392
 * \fn int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1393
 * \brief Seek to a new position within a PhysicsFS filehandle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1394
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1395
 * The next read or write will occur at that place. Seeking past the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1396
 *  beginning or end of the file is not allowed, and causes an error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1397
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1398
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1399
 *   \param pos number of bytes from start of file to seek to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1400
 *  \return nonzero on success, zero on error. Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1401
 *          gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1402
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1403
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1404
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1405
PHYSFS_DECL int PHYSFS_seek(PHYSFS_File *handle, PHYSFS_uint64 pos);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1406
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1407
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1408
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1409
 * \fn PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1410
 * \brief Get total length of a file in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1411
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1412
 * Note that if another process/thread is writing to this file at the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1413
 *  time, then the information this function supplies could be incorrect
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1414
 *  before you get it. Use with caution, or better yet, don't use at all.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1415
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1416
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1417
 *  \return size in bytes of the file. -1 if can't be determined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1418
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1419
 * \sa PHYSFS_tell
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1420
 * \sa PHYSFS_seek
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1421
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1422
PHYSFS_DECL PHYSFS_sint64 PHYSFS_fileLength(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1423
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1424
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1425
/* Buffering stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1426
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1427
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1428
 * \fn int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1429
 * \brief Set up buffering for a PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1430
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1431
 * Define an i/o buffer for a file handle. A memory block of (bufsize) bytes
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1432
 *  will be allocated and associated with (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1433
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1434
 * For files opened for reading, up to (bufsize) bytes are read from (handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1435
 *  and stored in the internal buffer. Calls to PHYSFS_read() will pull
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1436
 *  from this buffer until it is empty, and then refill it for more reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1437
 *  Note that compressed files, like ZIP archives, will decompress while
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1438
 *  buffering, so this can be handy for offsetting CPU-intensive operations.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1439
 *  The buffer isn't filled until you do your next read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1440
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1441
 * For files opened for writing, data will be buffered to memory until the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1442
 *  buffer is full or the buffer is flushed. Closing a handle implicitly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1443
 *  causes a flush...check your return values!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1444
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1445
 * Seeking, etc transparently accounts for buffering.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1446
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1447
 * You can resize an existing buffer by calling this function more than once
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1448
 *  on the same file. Setting the buffer size to zero will free an existing
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1449
 *  buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1450
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1451
 * PhysicsFS file handles are unbuffered by default.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1452
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1453
 * Please check the return value of this function! Failures can include
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1454
 *  not being able to seek backwards in a read-only file when removing the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1455
 *  buffer, not being able to allocate the buffer, and not being able to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1456
 *  flush the buffer to disk, among other unexpected problems.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1457
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1458
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1459
 *   \param bufsize size, in bytes, of buffer to allocate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1460
 *  \return nonzero if successful, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1461
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1462
 * \sa PHYSFS_flush
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1463
 * \sa PHYSFS_read
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1464
 * \sa PHYSFS_write
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1465
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1466
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1467
PHYSFS_DECL int PHYSFS_setBuffer(PHYSFS_File *handle, PHYSFS_uint64 bufsize);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1468
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1469
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1470
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1471
 * \fn int PHYSFS_flush(PHYSFS_File *handle)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1472
 * \brief Flush a buffered PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1473
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1474
 * For buffered files opened for writing, this will put the current contents
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1475
 *  of the buffer to disk and flag the buffer as empty if possible.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1476
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1477
 * For buffered files opened for reading or unbuffered files, this is a safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1478
 *  no-op, and will report success.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1479
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1480
 *   \param handle handle returned from PHYSFS_open*().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1481
 *  \return nonzero if successful, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1482
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1483
 * \sa PHYSFS_setBuffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1484
 * \sa PHYSFS_close
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1485
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1486
PHYSFS_DECL int PHYSFS_flush(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1487
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1488
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1489
/* Byteorder stuff... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1490
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1491
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1492
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1493
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1494
 * \fn PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1495
 * \brief Swap littleendian signed 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1496
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1497
 * Take a 16-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1498
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1499
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1500
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1501
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1502
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1503
PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSLE16(PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1504
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1505
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1506
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1507
 * \fn PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1508
 * \brief Swap littleendian unsigned 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1509
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1510
 * Take a 16-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1511
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1512
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1513
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1514
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1515
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1516
PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapULE16(PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1517
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1518
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1519
 * \fn PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1520
 * \brief Swap littleendian signed 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1521
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1522
 * Take a 32-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1523
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1524
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1525
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1526
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1527
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1528
PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSLE32(PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1529
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1530
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1531
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1532
 * \fn PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1533
 * \brief Swap littleendian unsigned 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1534
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1535
 * Take a 32-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1536
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1537
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1538
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1539
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1540
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1541
PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapULE32(PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1542
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1543
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1544
 * \fn PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1545
 * \brief Swap littleendian signed 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1546
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1547
 * Take a 64-bit signed value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1548
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1549
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1550
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1551
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1552
 *
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  1553
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1554
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1555
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1556
PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSLE64(PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1557
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1558
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1559
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1560
 * \fn PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1561
 * \brief Swap littleendian unsigned 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1562
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1563
 * Take a 64-bit unsigned value in littleendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1564
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1565
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1566
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1567
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1568
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1569
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1570
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1571
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1572
PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapULE64(PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1573
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1574
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1575
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1576
 * \fn PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1577
 * \brief Swap bigendian signed 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1578
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1579
 * Take a 16-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1580
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1581
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1582
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1583
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1584
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1585
PHYSFS_DECL PHYSFS_sint16 PHYSFS_swapSBE16(PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1586
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1587
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1588
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1589
 * \fn PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1590
 * \brief Swap bigendian unsigned 16 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1591
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1592
 * Take a 16-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1593
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1594
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1595
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1596
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1597
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1598
PHYSFS_DECL PHYSFS_uint16 PHYSFS_swapUBE16(PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1599
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1600
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1601
 * \fn PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1602
 * \brief Swap bigendian signed 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1603
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1604
 * Take a 32-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1605
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1606
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1607
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1608
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1609
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1610
PHYSFS_DECL PHYSFS_sint32 PHYSFS_swapSBE32(PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1611
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1612
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1613
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1614
 * \fn PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1615
 * \brief Swap bigendian unsigned 32 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1616
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1617
 * Take a 32-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1618
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1619
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1620
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1621
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1622
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1623
PHYSFS_DECL PHYSFS_uint32 PHYSFS_swapUBE32(PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1624
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1625
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1626
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1627
 * \fn PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1628
 * \brief Swap bigendian signed 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1629
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1630
 * Take a 64-bit signed value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1631
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1632
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1633
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1634
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1635
 *
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  1636
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1637
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1638
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1639
PHYSFS_DECL PHYSFS_sint64 PHYSFS_swapSBE64(PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1640
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1641
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1642
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1643
 * \fn PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1644
 * \brief Swap bigendian unsigned 64 to platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1645
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1646
 * Take a 64-bit unsigned value in bigendian format and convert it to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1647
 *  the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1648
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1649
 *    \param val value to convert
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1650
 *   \return converted value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1651
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1652
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1653
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1654
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1655
PHYSFS_DECL PHYSFS_uint64 PHYSFS_swapUBE64(PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1656
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1657
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1658
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1659
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1660
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1661
 * \fn int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1662
 * \brief Read and convert a signed 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1663
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1664
 * Convenience function. Read a signed 16-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1665
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1666
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1667
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1668
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1669
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1670
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1671
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1672
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1673
PHYSFS_DECL int PHYSFS_readSLE16(PHYSFS_File *file, PHYSFS_sint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1674
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1675
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1676
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1677
 * \fn int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1678
 * \brief Read and convert an unsigned 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1679
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1680
 * Convenience function. Read an unsigned 16-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1681
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1682
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1683
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1684
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1685
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1686
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1687
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1688
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1689
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1690
PHYSFS_DECL int PHYSFS_readULE16(PHYSFS_File *file, PHYSFS_uint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1691
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1692
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1693
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1694
 * \fn int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1695
 * \brief Read and convert a signed 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1696
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1697
 * Convenience function. Read a signed 16-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1698
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1699
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1700
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1701
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1702
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1703
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1704
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1705
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1706
PHYSFS_DECL int PHYSFS_readSBE16(PHYSFS_File *file, PHYSFS_sint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1707
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1708
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1709
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1710
 * \fn int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1711
 * \brief Read and convert an unsigned 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1712
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1713
 * Convenience function. Read an unsigned 16-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1714
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1715
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1716
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1717
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1718
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1719
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1720
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1721
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1722
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1723
PHYSFS_DECL int PHYSFS_readUBE16(PHYSFS_File *file, PHYSFS_uint16 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1724
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1725
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1726
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1727
 * \fn int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1728
 * \brief Read and convert a signed 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1729
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1730
 * Convenience function. Read a signed 32-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1731
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1732
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1733
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1734
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1735
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1736
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1737
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1738
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1739
PHYSFS_DECL int PHYSFS_readSLE32(PHYSFS_File *file, PHYSFS_sint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1740
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1741
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1742
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1743
 * \fn int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1744
 * \brief Read and convert an unsigned 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1745
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1746
 * Convenience function. Read an unsigned 32-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1747
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1748
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1749
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1750
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1751
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1752
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1753
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1754
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1755
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1756
PHYSFS_DECL int PHYSFS_readULE32(PHYSFS_File *file, PHYSFS_uint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1757
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1758
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1759
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1760
 * \fn int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1761
 * \brief Read and convert a signed 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1762
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1763
 * Convenience function. Read a signed 32-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1764
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1765
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1766
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1767
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1768
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1769
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1770
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1771
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1772
PHYSFS_DECL int PHYSFS_readSBE32(PHYSFS_File *file, PHYSFS_sint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1773
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1774
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1775
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1776
 * \fn int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1777
 * \brief Read and convert an unsigned 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1778
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1779
 * Convenience function. Read an unsigned 32-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1780
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1781
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1782
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1783
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1784
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1785
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1786
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1787
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1788
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1789
PHYSFS_DECL int PHYSFS_readUBE32(PHYSFS_File *file, PHYSFS_uint32 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1790
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1791
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1792
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1793
 * \fn int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1794
 * \brief Read and convert a signed 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1795
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1796
 * Convenience function. Read a signed 64-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1797
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1798
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1799
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1800
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1801
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1802
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1803
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1804
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1805
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1806
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1807
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1808
PHYSFS_DECL int PHYSFS_readSLE64(PHYSFS_File *file, PHYSFS_sint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1809
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1810
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1811
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1812
 * \fn int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1813
 * \brief Read and convert an unsigned 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1814
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1815
 * Convenience function. Read an unsigned 64-bit littleendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1816
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1817
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1818
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1819
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1820
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1821
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1822
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1823
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1824
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1825
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1826
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1827
PHYSFS_DECL int PHYSFS_readULE64(PHYSFS_File *file, PHYSFS_uint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1828
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1829
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1830
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1831
 * \fn int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1832
 * \brief Read and convert a signed 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1833
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1834
 * Convenience function. Read a signed 64-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1835
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1836
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1837
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1838
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1839
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1840
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1841
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1842
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1843
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1844
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1845
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1846
PHYSFS_DECL int PHYSFS_readSBE64(PHYSFS_File *file, PHYSFS_sint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1847
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1848
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1849
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1850
 * \fn int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1851
 * \brief Read and convert an unsigned 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1852
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1853
 * Convenience function. Read an unsigned 64-bit bigendian value from a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1854
 *  file and convert it to the platform's native byte order.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1855
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1856
 *    \param file PhysicsFS file handle from which to read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1857
 *    \param val pointer to where value should be stored.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1858
 *   \return zero on failure, non-zero on success. If successful, (*val) will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1859
 *           store the result. On failure, you can find out what went wrong
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1860
 *           from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1861
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1862
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1863
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1864
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1865
PHYSFS_DECL int PHYSFS_readUBE64(PHYSFS_File *file, PHYSFS_uint64 *val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1866
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1867
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1868
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1869
 * \fn int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1870
 * \brief Convert and write a signed 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1871
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1872
 * Convenience function. Convert a signed 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1873
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1874
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1875
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1876
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1877
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1878
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1879
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1880
PHYSFS_DECL int PHYSFS_writeSLE16(PHYSFS_File *file, PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1881
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1882
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1883
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1884
 * \fn int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1885
 * \brief Convert and write an unsigned 16-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1886
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1887
 * Convenience function. Convert an unsigned 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1888
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1889
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1890
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1891
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1892
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1893
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1894
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1895
PHYSFS_DECL int PHYSFS_writeULE16(PHYSFS_File *file, PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1896
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1897
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1898
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1899
 * \fn int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1900
 * \brief Convert and write a signed 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1901
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1902
 * Convenience function. Convert a signed 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1903
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1904
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1905
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1906
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1907
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1908
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1909
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1910
PHYSFS_DECL int PHYSFS_writeSBE16(PHYSFS_File *file, PHYSFS_sint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1911
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1912
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1913
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1914
 * \fn int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1915
 * \brief Convert and write an unsigned 16-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1916
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1917
 * Convenience function. Convert an unsigned 16-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1918
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1919
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1920
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1921
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1922
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1923
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1924
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1925
PHYSFS_DECL int PHYSFS_writeUBE16(PHYSFS_File *file, PHYSFS_uint16 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1926
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1927
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1928
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1929
 * \fn int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1930
 * \brief Convert and write a signed 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1931
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1932
 * Convenience function. Convert a signed 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1933
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1934
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1935
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1936
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1937
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1938
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1939
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1940
PHYSFS_DECL int PHYSFS_writeSLE32(PHYSFS_File *file, PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1941
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1942
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1943
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1944
 * \fn int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1945
 * \brief Convert and write an unsigned 32-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1946
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1947
 * Convenience function. Convert an unsigned 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1948
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1949
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1950
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1951
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1952
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1953
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1954
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1955
PHYSFS_DECL int PHYSFS_writeULE32(PHYSFS_File *file, PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1956
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1957
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1958
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1959
 * \fn int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1960
 * \brief Convert and write a signed 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1961
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1962
 * Convenience function. Convert a signed 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1963
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1964
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1965
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1966
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1967
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1968
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1969
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1970
PHYSFS_DECL int PHYSFS_writeSBE32(PHYSFS_File *file, PHYSFS_sint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1971
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1972
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1973
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1974
 * \fn int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1975
 * \brief Convert and write an unsigned 32-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1976
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1977
 * Convenience function. Convert an unsigned 32-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1978
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1979
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1980
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1981
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1982
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1983
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1984
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1985
PHYSFS_DECL int PHYSFS_writeUBE32(PHYSFS_File *file, PHYSFS_uint32 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1986
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1987
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1988
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1989
 * \fn int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1990
 * \brief Convert and write a signed 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1991
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1992
 * Convenience function. Convert a signed 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1993
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1994
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1995
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1996
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1997
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1998
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  1999
 *
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2000
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2001
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2002
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2003
PHYSFS_DECL int PHYSFS_writeSLE64(PHYSFS_File *file, PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2004
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2005
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2006
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2007
 * \fn int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2008
 * \brief Convert and write an unsigned 64-bit littleendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2009
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2010
 * Convenience function. Convert an unsigned 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2011
 *  native byte order to littleendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2012
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2013
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2014
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2015
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2016
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2017
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2018
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2019
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2020
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2021
PHYSFS_DECL int PHYSFS_writeULE64(PHYSFS_File *file, PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2022
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2023
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2024
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2025
 * \fn int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2026
 * \brief Convert and write a signed 64-bit bigending value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2027
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2028
 * Convenience function. Convert a signed 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2029
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2030
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2031
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2032
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2033
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2034
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2035
 *
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2036
 * \warning Remember, PHYSFS_sint64 is only 32 bits on platforms without
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2037
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2038
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2039
PHYSFS_DECL int PHYSFS_writeSBE64(PHYSFS_File *file, PHYSFS_sint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2040
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2041
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2042
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2043
 * \fn int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2044
 * \brief Convert and write an unsigned 64-bit bigendian value.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2045
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2046
 * Convenience function. Convert an unsigned 64-bit value from the platform's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2047
 *  native byte order to bigendian and write it to a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2048
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2049
 *    \param file PhysicsFS file handle to which to write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2050
 *    \param val Value to convert and write.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2051
 *   \return zero on failure, non-zero on success. On failure, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2052
 *           find out what went wrong from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2053
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2054
 * \warning Remember, PHYSFS_uint64 is only 32 bits on platforms without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2055
 *          any sort of 64-bit support.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2056
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2057
PHYSFS_DECL int PHYSFS_writeUBE64(PHYSFS_File *file, PHYSFS_uint64 val);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2058
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2059
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2060
/* Everything above this line is part of the PhysicsFS 1.0 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2061
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2062
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2063
 * \fn int PHYSFS_isInit(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2064
 * \brief Determine if the PhysicsFS library is initialized.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2065
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2066
 * Once PHYSFS_init() returns successfully, this will return non-zero.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2067
 *  Before a successful PHYSFS_init() and after PHYSFS_deinit() returns
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2068
 *  successfully, this will return zero. This function is safe to call at
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2069
 *  any time.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2070
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2071
 *  \return non-zero if library is initialized, zero if library is not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2072
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2073
 * \sa PHYSFS_init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2074
 * \sa PHYSFS_deinit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2075
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2076
PHYSFS_DECL int PHYSFS_isInit(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2077
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2078
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2079
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2080
 * \fn int PHYSFS_symbolicLinksPermitted(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2081
 * \brief Determine if the symbolic links are permitted.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2082
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2083
 * This reports the setting from the last call to PHYSFS_permitSymbolicLinks().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2084
 *  If PHYSFS_permitSymbolicLinks() hasn't been called since the library was
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2085
 *  last initialized, symbolic links are implicitly disabled.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2086
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2087
 *  \return non-zero if symlinks are permitted, zero if not.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2088
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2089
 * \sa PHYSFS_permitSymbolicLinks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2090
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2091
PHYSFS_DECL int PHYSFS_symbolicLinksPermitted(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2092
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2093
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2094
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2095
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2096
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2097
 * \struct PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2098
 * \brief PhysicsFS allocation function pointers.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2099
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2100
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2101
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2102
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2103
 * You create one of these structures for use with PHYSFS_setAllocator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2104
 *  Allocators are assumed to be reentrant by the caller; please mutex
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2105
 *  accordingly.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2106
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2107
 * Allocations are always discussed in 64-bits, for future expansion...we're
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2108
 *  on the cusp of a 64-bit transition, and we'll probably be allocating 6
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2109
 *  gigabytes like it's nothing sooner or later, and I don't want to change
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2110
 *  this again at that point. If you're on a 32-bit platform and have to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2111
 *  downcast, it's okay to return NULL if the allocation is greater than
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2112
 *  4 gigabytes, since you'd have to do so anyhow.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2113
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2114
 * \sa PHYSFS_setAllocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2115
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2116
typedef struct PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2117
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2118
    int (*Init)(void);   /**< Initialize. Can be NULL. Zero on failure. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2119
    void (*Deinit)(void);  /**< Deinitialize your allocator. Can be NULL. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2120
    void *(*Malloc)(PHYSFS_uint64);  /**< Allocate like malloc(). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2121
    void *(*Realloc)(void *, PHYSFS_uint64); /**< Reallocate like realloc(). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2122
    void (*Free)(void *); /**< Free memory from Malloc or Realloc. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2123
} PHYSFS_Allocator;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2124
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2125
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2126
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2127
 * \fn int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2128
 * \brief Hook your own allocation routines into PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2129
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2130
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2131
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2132
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2133
 * By default, PhysicsFS will use whatever is reasonable for a platform
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2134
 *  to manage dynamic memory (usually ANSI C malloc/realloc/free, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2135
 *  some platforms might use something else), but in some uncommon cases, the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2136
 *  app might want more control over the library's memory management. This
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2137
 *  lets you redirect PhysicsFS to use your own allocation routines instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2138
 *  You can only call this function before PHYSFS_init(); if the library is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2139
 *  initialized, it'll reject your efforts to change the allocator mid-stream.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2140
 *  You may call this function after PHYSFS_deinit() if you are willing to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2141
 *  shut down the library and restart it with a new allocator; this is a safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2142
 *  and supported operation. The allocator remains intact between deinit/init
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2143
 *  calls. If you want to return to the platform's default allocator, pass a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2144
 *  NULL in here.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2145
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2146
 * If you aren't immediately sure what to do with this function, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2147
 *  safely ignore it altogether.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2148
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2149
 *    \param allocator Structure containing your allocator's entry points.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2150
 *   \return zero on failure, non-zero on success. This call only fails
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2151
 *           when used between PHYSFS_init() and PHYSFS_deinit() calls.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2152
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2153
PHYSFS_DECL int PHYSFS_setAllocator(const PHYSFS_Allocator *allocator);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2154
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2155
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2156
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2157
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2158
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2159
 * \fn int PHYSFS_mount(const char *newDir, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2160
 * \brief Add an archive or directory to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2161
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2162
 * If this is a duplicate, the entry is not added again, even though the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2163
 *  function succeeds. You may not add the same archive to two different
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2164
 *  mountpoints: duplicate checking is done against the archive and not the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2165
 *  mountpoint.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2166
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2167
 * When you mount an archive, it is added to a virtual file system...all files
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2168
 *  in all of the archives are interpolated into a single hierachical file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2169
 *  tree. Two archives mounted at the same place (or an archive with files
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2170
 *  overlapping another mountpoint) may have overlapping files: in such a case,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2171
 *  the file earliest in the search path is selected, and the other files are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2172
 *  inaccessible to the application. This allows archives to be used to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2173
 *  override previous revisions; you can use the mounting mechanism to place
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2174
 *  archives at a specific point in the file tree and prevent overlap; this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2175
 *  is useful for downloadable mods that might trample over application data
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2176
 *  or each other, for example.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2177
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2178
 * The mountpoint does not need to exist prior to mounting, which is different
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2179
 *  than those familiar with the Unix concept of "mounting" may not expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2180
 *  As well, more than one archive can be mounted to the same mountpoint, or
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2181
 *  mountpoints and archive contents can overlap...the interpolation mechanism
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2182
 *  still functions as usual.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2183
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2184
 *   \param newDir directory or archive to add to the path, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2185
 *                   platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2186
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2187
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2188
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2189
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2190
 *  \return nonzero if added to path, zero on failure (bogus archive, dir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2191
 *                   missing, etc). Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2192
 *                   gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2193
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2194
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2195
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2196
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2197
 * \sa PHYSFS_mountIo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2198
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2199
PHYSFS_DECL int PHYSFS_mount(const char *newDir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2200
                             const char *mountPoint,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2201
                             int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2202
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2203
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2204
 * \fn int PHYSFS_getMountPoint(const char *dir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2205
 * \brief Determine a mounted archive's mountpoint.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2206
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2207
 * You give this function the name of an archive or dir you successfully
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2208
 *  added to the search path, and it reports the location in the interpolated
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2209
 *  tree where it is mounted. Files mounted with a NULL mountpoint or through
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2210
 *  PHYSFS_addToSearchPath() will report "/". The return value is READ ONLY
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2211
 *  and valid until the archive is removed from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2212
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2213
 *   \param dir directory or archive previously added to the path, in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2214
 *              platform-dependent notation. This must match the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2215
 *              used when adding, even if your string would also reference
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2216
 *              the same file with a different string of characters.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2217
 *  \return READ-ONLY string of mount point if added to path, NULL on failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2218
 *          (bogus archive, etc) Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2219
 *          PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2220
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2221
 * \sa PHYSFS_removeFromSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2222
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2223
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2224
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2225
PHYSFS_DECL const char *PHYSFS_getMountPoint(const char *dir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2226
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2227
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2228
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2229
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2230
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2231
 * \typedef PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2232
 * \brief Function signature for callbacks that report strings.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2233
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2234
 * These are used to report a list of strings to an original caller, one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2235
 *  string per callback. All strings are UTF-8 encoded. Functions should not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2236
 *  try to modify or free the string's memory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2237
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2238
 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2239
 *  functions that would return lists that need to be cleaned up with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2240
 *  PHYSFS_freeList(). The callback means that the library doesn't need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2241
 *  allocate an entire list and all the strings up front.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2242
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2243
 * Be aware that promises data ordering in the list versions are not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2244
 *  necessarily so in the callback versions. Check the documentation on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2245
 *  specific APIs, but strings may not be sorted as you expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2246
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2247
 *    \param data User-defined data pointer, passed through from the API
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2248
 *                that eventually called the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2249
 *    \param str The string data about which the callback is meant to inform.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2250
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2251
 * \sa PHYSFS_getCdRomDirsCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2252
 * \sa PHYSFS_getSearchPathCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2253
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2254
typedef void (*PHYSFS_StringCallback)(void *data, const char *str);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2255
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2256
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2257
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2258
 * \typedef PHYSFS_EnumFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2259
 * \brief Function signature for callbacks that enumerate files.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2260
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2261
 * These are used to report a list of directory entries to an original caller,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2262
 *  one file/dir/symlink per callback. All strings are UTF-8 encoded.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2263
 *  Functions should not try to modify or free any string's memory.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2264
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2265
 * These callbacks are used, starting in PhysicsFS 1.1, as an alternative to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2266
 *  functions that would return lists that need to be cleaned up with
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2267
 *  PHYSFS_freeList(). The callback means that the library doesn't need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2268
 *  allocate an entire list and all the strings up front.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2269
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2270
 * Be aware that promises data ordering in the list versions are not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2271
 *  necessarily so in the callback versions. Check the documentation on
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2272
 *  specific APIs, but strings may not be sorted as you expect.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2273
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2274
 *    \param data User-defined data pointer, passed through from the API
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2275
 *                that eventually called the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2276
 *    \param origdir A string containing the full path, in platform-independent
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2277
 *                   notation, of the directory containing this file. In most
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2278
 *                   cases, this is the directory on which you requested
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2279
 *                   enumeration, passed in the callback for your convenience.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2280
 *    \param fname The filename that is being enumerated. It may not be in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2281
 *                 alphabetical order compared to other callbacks that have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2282
 *                 fired, and it will not contain the full path. You can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2283
 *                 recreate the fullpath with $origdir/$fname ... The file
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2284
 *                 can be a subdirectory, a file, a symlink, etc.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2285
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2286
 * \sa PHYSFS_enumerateFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2287
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2288
typedef void (*PHYSFS_EnumFilesCallback)(void *data, const char *origdir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2289
                                         const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2290
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2291
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2292
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2293
 * \fn void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2294
 * \brief Enumerate CD-ROM directories, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2295
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2296
 * Internally, PHYSFS_getCdRomDirs() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2297
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2298
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2299
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2300
 * Unlike PHYSFS_getCdRomDirs(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2301
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2302
 *  detected disc:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2303
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2304
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2305
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2306
 * static void foundDisc(void *data, const char *cddir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2307
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2308
 *     printf("cdrom dir [%s] is available.\n", cddir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2309
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2310
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2311
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2312
 * PHYSFS_getCdRomDirsCallback(foundDisc, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2313
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2314
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2315
 * This call may block while drives spin up. Be forewarned.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2316
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2317
 *    \param c Callback function to notify about detected drives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2318
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2319
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2320
 * \sa PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2321
 * \sa PHYSFS_getCdRomDirs
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2322
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2323
PHYSFS_DECL void PHYSFS_getCdRomDirsCallback(PHYSFS_StringCallback c, void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2324
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2325
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2326
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2327
 * \fn void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2328
 * \brief Enumerate the search path, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2329
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2330
 * Internally, PHYSFS_getSearchPath() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2331
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2332
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2333
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2334
 * Unlike PHYSFS_getSearchPath(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2335
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2336
 *  element of the search path:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2337
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2338
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2339
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2340
 * static void printSearchPath(void *data, const char *pathItem)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2341
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2342
 *     printf("[%s] is in the search path.\n", pathItem);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2343
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2344
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2345
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2346
 * PHYSFS_getSearchPathCallback(printSearchPath, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2347
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2348
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2349
 * Elements of the search path are reported in order search priority, so the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2350
 *  first archive/dir that would be examined when looking for a file is the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2351
 *  first element passed through the callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2352
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2353
 *    \param c Callback function to notify about search path elements.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2354
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2355
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2356
 * \sa PHYSFS_StringCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2357
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2358
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2359
PHYSFS_DECL void PHYSFS_getSearchPathCallback(PHYSFS_StringCallback c, void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2360
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2361
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2362
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2363
 * \fn void PHYSFS_enumerateFilesCallback(const char *dir, PHYSFS_EnumFilesCallback c, void *d)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2364
 * \brief Get a file listing of a search path's directory, using an application-defined callback.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2365
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2366
 * Internally, PHYSFS_enumerateFiles() just calls this function and then builds
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2367
 *  a list before returning to the application, so functionality is identical
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2368
 *  except for how the information is represented to the application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2369
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2370
 * Unlike PHYSFS_enumerateFiles(), this function does not return an array.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2371
 *  Rather, it calls a function specified by the application once per
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2372
 *  element of the search path:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2373
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2374
 * \code
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2375
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2376
 * static void printDir(void *data, const char *origdir, const char *fname)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2377
 * {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2378
 *     printf(" * We've got [%s] in [%s].\n", fname, origdir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2379
 * }
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2380
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2381
 * // ...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2382
 * PHYSFS_enumerateFilesCallback("/some/path", printDir, NULL);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2383
 * \endcode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2384
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2385
 * !!! FIXME: enumerateFiles() does not promise alphabetical sorting by
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2386
 * !!! FIXME:  case-sensitivity in the code, and doesn't promise sorting at
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2387
 * !!! FIXME:  all in the above docs.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2388
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2389
 * Items sent to the callback are not guaranteed to be in any order whatsoever.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2390
 *  There is no sorting done at this level, and if you need that, you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2391
 *  probably use PHYSFS_enumerateFiles() instead, which guarantees
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2392
 *  alphabetical sorting. This form reports whatever is discovered in each
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2393
 *  archive before moving on to the next. Even within one archive, we can't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2394
 *  guarantee what order it will discover data. <em>Any sorting you find in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2395
 *  these callbacks is just pure luck. Do not rely on it.</em> As this walks
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2396
 *  the entire list of archives, you may receive duplicate filenames.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2397
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2398
 *    \param dir Directory, in platform-independent notation, to enumerate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2399
 *    \param c Callback function to notify about search path elements.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2400
 *    \param d Application-defined data passed to callback. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2401
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2402
 * \sa PHYSFS_EnumFilesCallback
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2403
 * \sa PHYSFS_enumerateFiles
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2404
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2405
PHYSFS_DECL void PHYSFS_enumerateFilesCallback(const char *dir,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2406
                                               PHYSFS_EnumFilesCallback c,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2407
                                               void *d);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2408
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2409
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2410
 * \fn void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2411
 * \brief Convert a UCS-4 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2412
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2413
 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2414
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2415
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2416
 *  please allocate a buffer that is the same size as the source buffer. UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2417
 *  never uses more than 32-bits per character, so while it may shrink a UCS-4
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2418
 *  string, it will never expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2419
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2420
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2421
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2422
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2423
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2424
 *   \param src Null-terminated source string in UCS-4 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2425
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2426
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2427
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2428
PHYSFS_DECL void PHYSFS_utf8FromUcs4(const PHYSFS_uint32 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2429
                                     PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2430
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2431
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2432
 * \fn void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2433
 * \brief Convert a UTF-8 string to a UCS-4 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2434
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2435
 * UCS-4 strings are 32-bits per character: \c wchar_t on Unix.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2436
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2437
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2438
 *  please allocate a buffer that is four times the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2439
 *  UTF-8 uses from one to four bytes per character, but UCS-4 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2440
 *  four, so an entirely low-ASCII string will quadruple in size!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2441
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2442
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2443
 *  will always be null-terminated and never have an incomplete UCS-4
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2444
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2445
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2446
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2447
 *   \param dst Buffer to store converted UCS-4 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2448
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2449
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2450
PHYSFS_DECL void PHYSFS_utf8ToUcs4(const char *src, PHYSFS_uint32 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2451
                                   PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2452
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2453
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2454
 * \fn void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2455
 * \brief Convert a UCS-2 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2456
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2457
 * \warning you almost certainly should use PHYSFS_utf8FromUtf16(), which
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2458
 *  became available in PhysicsFS 2.1, unless you know what you're doing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2459
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2460
 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2461
 *  with Unicode support. Please note that modern versions of Windows use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2462
 *  UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2463
 *  almost certainly want PHYSFS_utf8FromUtf16() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2464
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2465
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2466
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2467
 *  UTF-8 never uses more than 32-bits per character, so while it may shrink
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2468
 *  a UCS-2 string, it may also expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2469
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2470
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2471
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2472
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2473
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2474
 *   \param src Null-terminated source string in UCS-2 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2475
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2476
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2477
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2478
 * \sa PHYSFS_utf8FromUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2479
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2480
PHYSFS_DECL void PHYSFS_utf8FromUcs2(const PHYSFS_uint16 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2481
                                     PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2482
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2483
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2484
 * \fn PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2485
 * \brief Convert a UTF-8 string to a UCS-2 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2486
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2487
 * \warning you almost certainly should use PHYSFS_utf8ToUtf16(), which
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2488
 *  became available in PhysicsFS 2.1, unless you know what you're doing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2489
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2490
 * UCS-2 strings are 16-bits per character: \c TCHAR on Windows, when building
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2491
 *  with Unicode support. Please note that modern versions of Windows use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2492
 *  UTF-16, which is an extended form of UCS-2, and not UCS-2 itself. You
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2493
 *  almost certainly want PHYSFS_utf8ToUtf16() instead, but you need to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2494
 *  understand how that changes things, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2495
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2496
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2497
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2498
 *  UTF-8 uses from one to four bytes per character, but UCS-2 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2499
 *  two, so an entirely low-ASCII string will double in size!
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2500
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2501
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2502
 *  will always be null-terminated and never have an incomplete UCS-2
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2503
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2504
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2505
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2506
 *   \param dst Buffer to store converted UCS-2 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2507
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2508
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2509
 * \sa PHYSFS_utf8ToUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2510
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2511
PHYSFS_DECL void PHYSFS_utf8ToUcs2(const char *src, PHYSFS_uint16 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2512
                                   PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2513
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2514
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2515
 * \fn void PHYSFS_utf8FromLatin1(const char *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2516
 * \brief Convert a UTF-8 string to a Latin1 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2517
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2518
 * Latin1 strings are 8-bits per character: a popular "high ASCII" encoding.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2519
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2520
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2521
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2522
 *  UTF-8 expands latin1 codepoints over 127 from 1 to 2 bytes, so the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2523
 *  may grow in some cases.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2524
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2525
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2526
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2527
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2528
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2529
 * Please note that we do not supply a UTF-8 to Latin1 converter, since Latin1
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2530
 *  can't express most Unicode codepoints. It's a legacy encoding; you should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2531
 *  be converting away from it at all times.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2532
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2533
 *   \param src Null-terminated source string in Latin1 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2534
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2535
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2536
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2537
PHYSFS_DECL void PHYSFS_utf8FromLatin1(const char *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2538
                                       PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2539
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2540
/* Everything above this line is part of the PhysicsFS 2.0 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2541
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2542
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2543
 * \fn int PHYSFS_unmount(const char *oldDir)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2544
 * \brief Remove a directory or archive from the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2545
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2546
 * This is functionally equivalent to PHYSFS_removeFromSearchPath(), but that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2547
 *  function is deprecated to keep the vocabulary paired with PHYSFS_mount().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2548
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2549
 * This must be a (case-sensitive) match to a dir or archive already in the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2550
 *  search path, specified in platform-dependent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2551
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2552
 * This call will fail (and fail to remove from the path) if the element still
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2553
 *  has files open in it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2554
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2555
 *    \param oldDir dir/archive to remove.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2556
 *   \return nonzero on success, zero on failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2557
 *            Specifics of the error can be gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2558
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2559
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2560
 * \sa PHYSFS_mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2561
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2562
PHYSFS_DECL int PHYSFS_unmount(const char *oldDir);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2563
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2564
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2565
 * \fn const PHYSFS_Allocator *PHYSFS_getAllocator(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2566
 * \brief Discover the current allocator.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2567
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2568
 * (This is for limited, hardcore use. If you don't immediately see a need
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2569
 *  for it, you can probably ignore this forever.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2570
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2571
 * This function exposes the function pointers that make up the currently used
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2572
 *  allocator. This can be useful for apps that want to access PhysicsFS's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2573
 *  internal, default allocation routines, as well as for external code that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2574
 *  wants to share the same allocator, even if the application specified their
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2575
 *  own.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2576
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2577
 * This call is only valid between PHYSFS_init() and PHYSFS_deinit() calls;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2578
 *  it will return NULL if the library isn't initialized. As we can't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2579
 *  guarantee the state of the internal allocators unless the library is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2580
 *  initialized, you shouldn't use any allocator returned here after a call
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2581
 *  to PHYSFS_deinit().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2582
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2583
 * Do not call the returned allocator's Init() or Deinit() methods under any
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2584
 *  circumstances.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2585
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2586
 * If you aren't immediately sure what to do with this function, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2587
 *  safely ignore it altogether.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2588
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2589
 *  \return Current allocator, as set by PHYSFS_setAllocator(), or PhysicsFS's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2590
 *          internal, default allocator if no application defined allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2591
 *          is currently set. Will return NULL if the library is not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2592
 *          initialized.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2593
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2594
 * \sa PHYSFS_Allocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2595
 * \sa PHYSFS_setAllocator
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2596
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2597
PHYSFS_DECL const PHYSFS_Allocator *PHYSFS_getAllocator(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2598
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2599
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2600
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2601
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2602
 * \enum PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2603
 * \brief Type of a File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2604
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2605
 * Possible types of a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2606
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2607
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2608
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2609
typedef enum PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2610
{
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2611
	PHYSFS_FILETYPE_REGULAR, /**< a normal file */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2612
	PHYSFS_FILETYPE_DIRECTORY, /**< a directory */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2613
	PHYSFS_FILETYPE_SYMLINK, /**< a symlink */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2614
	PHYSFS_FILETYPE_OTHER /**< something completely different like a device */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2615
} PHYSFS_FileType;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2616
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2617
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2618
 * \struct PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2619
 * \brief Meta data for a file or directory
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2620
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2621
 * Container for various meta data about a file in the virtual file system.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2622
 *  PHYSFS_stat() uses this structure for returning the information. The time
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2623
 *  data will be either the number of seconds since the Unix epoch (midnight,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2624
 *  Jan 1, 1970), or -1 if the information isn't available or applicable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2625
 *  The (filesize) field is measured in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2626
 *  The (readonly) field tells you whether when you open a file for writing you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2627
 *  are writing to the same file as if you were opening it, given you have
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2628
 *  enough filesystem rights to do that.  !!! FIXME: this might change.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2629
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2630
 * \sa PHYSFS_stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2631
 * \sa PHYSFS_FileType
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2632
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2633
typedef struct PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2634
{
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2635
	PHYSFS_sint64 filesize; /**< size in bytes, -1 for non-files and unknown */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2636
	PHYSFS_sint64 modtime;  /**< last modification time */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2637
	PHYSFS_sint64 createtime; /**< like modtime, but for file creation time */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2638
	PHYSFS_sint64 accesstime; /**< like modtime, but for file access time */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2639
	PHYSFS_FileType filetype; /**< File? Directory? Symlink? */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  2640
	int readonly; /**< non-zero if read only, zero if writable. */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2641
} PHYSFS_Stat;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2642
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2643
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2644
 * \fn int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2645
 * \brief Get various information about a directory or a file.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2646
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2647
 * Obtain various information about a file or directory from the meta data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2648
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2649
 * This function will never follow symbolic links. If you haven't enabled
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2650
 *  symlinks with PHYSFS_permitSymbolicLinks(), stat'ing a symlink will be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2651
 *  treated like stat'ing a non-existant file. If symlinks are enabled,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2652
 *  stat'ing a symlink will give you information on the link itself and not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2653
 *  what it points to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2654
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2655
 *    \param fname filename to check, in platform-indepedent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2656
 *    \param stat pointer to structure to fill in with data about (fname).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2657
 *   \return non-zero on success, zero on failure. On failure, (stat)'s
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2658
 *           contents are undefined.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2659
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2660
 * \sa PHYSFS_Stat
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2661
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2662
PHYSFS_DECL int PHYSFS_stat(const char *fname, PHYSFS_Stat *stat);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2663
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2664
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2665
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2666
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2667
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2668
 * \fn void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2669
 * \brief Convert a UTF-16 string to a UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2670
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2671
 * UTF-16 strings are 16-bits per character (except some chars, which are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2672
 *  32-bits): \c TCHAR on Windows, when building with Unicode support. Modern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2673
 *  Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2674
 *  only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2675
 *  are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2676
 *  aren't sure, you should be using UTF-16 at this point on Windows.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2677
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2678
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2679
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2680
 *  UTF-8 never uses more than 32-bits per character, so while it may shrink
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2681
 *  a UTF-16 string, it may also expand it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2682
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2683
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2684
 *  will always be null-terminated and never have an incomplete UTF-8
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2685
 *  sequence at the end. If the buffer length is 0, this function does nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2686
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2687
 *   \param src Null-terminated source string in UTF-16 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2688
 *   \param dst Buffer to store converted UTF-8 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2689
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2690
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2691
PHYSFS_DECL void PHYSFS_utf8FromUtf16(const PHYSFS_uint16 *src, char *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2692
                                      PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2693
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2694
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2695
 * \fn PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2696
 * \brief Convert a UTF-8 string to a UTF-16 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2697
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2698
 * UTF-16 strings are 16-bits per character (except some chars, which are
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2699
 *  32-bits): \c TCHAR on Windows, when building with Unicode support. Modern
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2700
 *  Windows releases use UTF-16. Windows releases before 2000 used TCHAR, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2701
 *  only handled UCS-2. UTF-16 _is_ UCS-2, except for the characters that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2702
 *  are 4 bytes, which aren't representable in UCS-2 at all anyhow. If you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2703
 *  aren't sure, you should be using UTF-16 at this point on Windows.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2704
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2705
 * To ensure that the destination buffer is large enough for the conversion,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2706
 *  please allocate a buffer that is double the size of the source buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2707
 *  UTF-8 uses from one to four bytes per character, but UTF-16 always uses
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2708
 *  two to four, so an entirely low-ASCII string will double in size! The
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2709
 *  UTF-16 characters that would take four bytes also take four bytes in UTF-8,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2710
 *  so you don't need to allocate 4x the space just in case: double will do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2711
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2712
 * Strings that don't fit in the destination buffer will be truncated, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2713
 *  will always be null-terminated and never have an incomplete UTF-16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2714
 *  surrogate pair at the end. If the buffer length is 0, this function does
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2715
 *  nothing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2716
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2717
 *   \param src Null-terminated source string in UTF-8 format.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2718
 *   \param dst Buffer to store converted UTF-16 string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2719
 *   \param len Size, in bytes, of destination buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2720
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2721
 * \sa PHYSFS_utf8ToUtf16
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2722
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2723
PHYSFS_DECL void PHYSFS_utf8ToUtf16(const char *src, PHYSFS_uint16 *dst,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2724
                                    PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2725
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2726
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2727
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2728
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2729
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2730
 * \fn PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2731
 * \brief Read bytes from a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2732
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2733
 * The file must be opened for reading.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2734
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2735
 *   \param handle handle returned from PHYSFS_openRead().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2736
 *   \param buffer buffer of at least (len) bytes to store read data into.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2737
 *   \param len number of bytes being read from (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2738
 *  \return number of bytes read. This may be less than (len); this does not
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2739
 *          signify an error, necessarily (a short read may mean EOF).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2740
 *          PHYSFS_getLastError() can shed light on the reason this might
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2741
 *          be < (len), as can PHYSFS_eof(). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2742
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2743
 * \sa PHYSFS_eof
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2744
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2745
PHYSFS_DECL PHYSFS_sint64 PHYSFS_readBytes(PHYSFS_File *handle, void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2746
                                           PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2747
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2748
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2749
 * \fn PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle, const void *buffer, PHYSFS_uint64 len)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2750
 * \brief Write data to a PhysicsFS filehandle
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2751
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2752
 * The file must be opened for writing.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2753
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2754
 * Please note that while (len) is an unsigned 64-bit integer, you are limited
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2755
 *  to 63 bits (9223372036854775807 bytes), so we can return a negative value
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2756
 *  on error. If length is greater than 0x7FFFFFFFFFFFFFFF, this function will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2757
 *  immediately fail. For systems without a 64-bit datatype, you are limited
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2758
 *  to 31 bits (0x7FFFFFFF, or 2147483647 bytes). We trust most things won't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2759
 *  need to do multiple gigabytes of i/o in one call anyhow, but why limit
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2760
 *  things?
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2761
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2762
 *   \param handle retval from PHYSFS_openWrite() or PHYSFS_openAppend().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2763
 *   \param buffer buffer of (len) bytes to write to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2764
 *   \param len number of bytes being written to (handle).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2765
 *  \return number of bytes written. This may be less than (len); in the case
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2766
 *          of an error, the system may try to write as many bytes as possible,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2767
 *          so an incomplete write might occur. PHYSFS_getLastError() can shed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2768
 *          light on the reason this might be < (len). -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2769
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2770
PHYSFS_DECL PHYSFS_sint64 PHYSFS_writeBytes(PHYSFS_File *handle,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2771
                                            const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2772
                                            PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2773
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2774
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2775
#ifndef SWIG  /* not available from scripting languages. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2776
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2777
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2778
 * \struct PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2779
 * \brief An abstract i/o interface.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2780
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2781
 * \warning This is advanced, hardcore stuff. You don't need this unless you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2782
 *          really know what you're doing. Most apps will not need this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2783
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2784
 * Historically, PhysicsFS provided access to the physical filesystem and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2785
 *  archives within that filesystem. However, sometimes you need more power
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2786
 *  than this. Perhaps you need to provide an archive that is entirely
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2787
 *  contained in RAM, or you need to bridge some other file i/o API to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2788
 *  PhysicsFS, or you need to translate the bits (perhaps you have a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2789
 *  a standard .zip file that's encrypted, and you need to decrypt on the fly
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2790
 *  for the unsuspecting zip archiver).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2791
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2792
 * A PHYSFS_Io is the interface that Archivers use to get archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2793
 *  Historically, this has mapped to file i/o to the physical filesystem, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2794
 *  as of PhysicsFS 2.1, applications can provide their own i/o implementations
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2795
 *  at runtime.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2796
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2797
 * This interface isn't necessarily a good universal fit for i/o. There are a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2798
 *  few requirements of note:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2799
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2800
 *  - They only do blocking i/o (at least, for now).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2801
 *  - They need to be able to duplicate. If you have a file handle from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2802
 *    fopen(), you need to be able to create a unique clone of it (so we
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2803
 *    have two handles to the same file that can both seek/read/etc without
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2804
 *    stepping on each other).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2805
 *  - They need to know the size of their entire data set.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2806
 *  - They need to be able to seek and rewind on demand.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2807
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2808
 * ...in short, you're probably not going to write an HTTP implementation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2809
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2810
 * Thread safety: TO BE DECIDED.  !!! FIXME
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2811
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2812
 * \sa PHYSFS_mountIo
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2813
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2814
typedef struct PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2815
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2816
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2817
     * \brief Binary compatibility information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2818
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2819
     * This must be set to zero at this time. Future versions of this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2820
     *  struct will increment this field, so we know what a given
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2821
     *  implementation supports. We'll presumably keep supporting older
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2822
     *  versions as we offer new features, though.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2823
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2824
    PHYSFS_uint32 version;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2825
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2826
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2827
     * \brief Instance data for this struct.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2828
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2829
     * Each instance has a pointer associated with it that can be used to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2830
     *  store anything it likes. This pointer is per-instance of the stream,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2831
     *  so presumably it will change when calling duplicate(). This can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2832
     *  deallocated during the destroy() method.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2833
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2834
    void *opaque;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2835
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2836
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2837
     * \brief Read more data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2838
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2839
     * Read (len) bytes from the interface, at the current i/o position, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2840
     *  store them in (buffer). The current i/o position should move ahead
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2841
     *  by the number of bytes successfully read.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2842
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2843
     * You don't have to implement this; set it to NULL if not implemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2844
     *  This will only be used if the file is opened for reading. If set to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2845
     *  NULL, a default implementation that immediately reports failure will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2846
     *  be used.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2847
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2848
     *   \param io The i/o instance to read from.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2849
     *   \param buf The buffer to store data into. It must be at least
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2850
     *                 (len) bytes long and can't be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2851
     *   \param len The number of bytes to read from the interface.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2852
     *  \return number of bytes read from file, 0 on EOF, -1 if complete
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2853
     *          failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2854
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2855
    PHYSFS_sint64 (*read)(struct PHYSFS_Io *io, void *buf, PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2856
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2857
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2858
     * \brief Write more data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2859
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2860
     * Write (len) bytes from (buffer) to the interface at the current i/o
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2861
     *  position. The current i/o position should move ahead by the number of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2862
     *  bytes successfully written.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2863
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2864
     * You don't have to implement this; set it to NULL if not implemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2865
     *  This will only be used if the file is opened for writing. If set to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2866
     *  NULL, a default implementation that immediately reports failure will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2867
     *  be used.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2868
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2869
     * You are allowed to buffer; a write can succeed here and then later
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2870
     *  fail when flushing. Note that PHYSFS_setBuffer() may be operating a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2871
     *  level above your i/o, so you should usually not implement your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2872
     *  own buffering routines.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2873
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2874
     *   \param io The i/o instance to write to.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2875
     *   \param buffer The buffer to read data from. It must be at least
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2876
     *                 (len) bytes long and can't be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2877
     *   \param len The number of bytes to read from (buffer).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2878
     *  \return number of bytes written to file, -1 if complete failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2879
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2880
    PHYSFS_sint64 (*write)(struct PHYSFS_Io *io, const void *buffer,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2881
                           PHYSFS_uint64 len);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2882
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2883
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2884
     * \brief Move i/o position to a given byte offset from start.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2885
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2886
     * This method moves the i/o position, so the next read/write will
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2887
     *  be of the byte at (offset) offset. Seeks past the end of file should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2888
     *  be treated as an error condition.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2889
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2890
     *   \param io The i/o instance to seek.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2891
     *   \param offset The new byte offset for the i/o position.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2892
     *  \return non-zero on success, zero on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2893
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2894
    int (*seek)(struct PHYSFS_Io *io, PHYSFS_uint64 offset);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2895
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2896
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2897
     * \brief Report current i/o position.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2898
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2899
     * Return bytes offset, or -1 if you aren't able to determine. A failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2900
     *  will almost certainly be fatal to further use of this stream, so you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2901
     *  may not leave this unimplemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2902
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2903
     *   \param io The i/o instance to query.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2904
     *  \return The current byte offset for the i/o position, -1 if unknown.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2905
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2906
    PHYSFS_sint64 (*tell)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2907
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2908
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2909
     * \brief Determine size of the i/o instance's dataset.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2910
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2911
     * Return number of bytes available in the file, or -1 if you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2912
     *  aren't able to determine. A failure will almost certainly be fatal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2913
     *  to further use of this stream, so you may not leave this unimplemented.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2914
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2915
     *   \param io The i/o instance to query.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2916
     *  \return Total size, in bytes, of the dataset.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2917
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2918
    PHYSFS_sint64 (*length)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2919
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2920
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2921
     * \brief Duplicate this i/o instance.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2922
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2923
     *  // !!! FIXME: write me.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2924
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2925
     *   \param io The i/o instance to duplicate.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2926
     *  \return A new value for a stream's (opaque) field, or NULL on error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2927
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2928
    struct PHYSFS_Io *(*duplicate)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2929
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2930
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2931
     * \brief Flush resources to media, or wherever.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2932
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2933
     * This is the chance to report failure for writes that had claimed
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2934
     *  success earlier, but still had a chance to actually fail. This method
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2935
     *  can be NULL if flushing isn't necessary.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2936
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2937
     * This function may be called before destroy(), as it can report failure
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2938
     *  and destroy() can not. It may be called at other times, too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2939
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2940
     *   \param io The i/o instance to flush.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2941
     *  \return Zero on error, non-zero on success.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2942
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2943
    int (*flush)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2944
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2945
    /**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2946
     * \brief Cleanup and deallocate i/o instance.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2947
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2948
     * Free associated resources, including (opaque) if applicable.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2949
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2950
     * This function must always succeed: as such, it returns void. The
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2951
     *  system may call your flush() method before this. You may report
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2952
     *  failure there if necessary. This method may still be called if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2953
     *  flush() fails, in which case you'll have to abandon unflushed data
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2954
     *  and other failing conditions and clean up.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2955
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2956
     * Once this method is called for a given instance, the system will assume
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2957
     *  it is unsafe to touch that instance again and will discard any
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2958
     *  references to it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2959
     *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2960
     *   \param s The i/o instance to destroy.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2961
     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2962
    void (*destroy)(struct PHYSFS_Io *io);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2963
} PHYSFS_Io;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2964
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2965
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2966
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2967
 * \fn int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2968
 * \brief Add an archive, built on a PHYSFS_Io, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2969
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2970
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2971
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2972
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2973
 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_Io
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2974
 *  instead of a pathname. Behind the scenes, PHYSFS_mount() calls this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2975
 *  function with a physical-filesystem-based PHYSFS_Io.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2976
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2977
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2978
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2979
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2980
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2981
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2982
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2983
 * (io) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2984
 *  unmounted, the system will call (io)->destroy(io), which will give you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2985
 *  a chance to free your resources.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2986
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2987
 * If this function fails, (io)->destroy(io) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2988
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2989
 *   \param io i/o instance for archive to add to the path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2990
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2991
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2992
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2993
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2994
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2995
 *  \return nonzero if added to path, zero on failure (bogus archive, stream
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2996
 *                   i/o issue, etc). Specifics of the error can be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2997
 *                   gleaned from PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2998
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  2999
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3000
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3001
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3002
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3003
PHYSFS_DECL int PHYSFS_mountIo(PHYSFS_Io *io, const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3004
                               const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3005
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3006
#endif  /* SWIG */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3007
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3008
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3009
 * \fn int PHYSFS_mountMemory(const void *ptr, PHYSFS_uint64 len, void (*del)(void *), const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3010
 * \brief Add an archive, contained in a memory buffer, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3011
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3012
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3013
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3014
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3015
 * This function operates just like PHYSFS_mount(), but takes a memory buffer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3016
 *  instead of a pathname. This buffer contains all the data of the archive,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3017
 *  and is used instead of a real file in the physical filesystem.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3018
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3019
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3020
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3021
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3022
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3023
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3024
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3025
 * (ptr) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3026
 *  unmounted, the system will call (del)(ptr), which will notify you that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3027
 *  the system is done with the buffer, and give you a chance to free your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3028
 *  resources. (del) can be NULL, in which case the system will make no
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3029
 *  attempt to free the buffer.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3030
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3031
 * If this function fails, (del) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3032
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3033
 *   \param ptr Address of the memory buffer containing the archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3034
 *   \param len Size of memory buffer, in bytes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3035
 *   \param del A callback that triggers upon unmount. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3036
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3037
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3038
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3039
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3040
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3041
 *  \return nonzero if added to path, zero on failure (bogus archive, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3042
 *                  Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3043
 *                  PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3044
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3045
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3046
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3047
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3048
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3049
PHYSFS_DECL int PHYSFS_mountMemory(const void *buf, PHYSFS_uint64 len,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3050
                                   void (*del)(void *), const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3051
                                   const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3052
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3053
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3054
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3055
 * \fn int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname, const char *mountPoint, int appendToPath)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3056
 * \brief Add an archive, contained in a PHYSFS_File handle, to the search path.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3057
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3058
 * \warning Unless you have some special, low-level need, you should be using
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3059
 *          PHYSFS_mount() instead of this.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3060
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3061
 * \warning Archives-in-archives may be very slow! While a PHYSFS_File can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3062
 *          seek even when the data is compressed, it may do so by rewinding
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3063
 *          to the start and decompressing everything before the seek point.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3064
 *          Normal archive usage may do a lot of seeking behind the scenes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3065
 *          As such, you might find normal archive usage extremely painful
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3066
 *          if mounted this way. Plan accordingly: if you, say, have a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3067
 *          self-extracting .zip file, and want to mount something in it,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3068
 *          compress the contents of the inner archive and make sure the outer
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3069
 *          .zip file doesn't compress the inner archive too.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3070
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3071
 * This function operates just like PHYSFS_mount(), but takes a PHYSFS_File
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3072
 *  handle instead of a pathname. This handle contains all the data of the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3073
 *  archive, and is used instead of a real file in the physical filesystem.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3074
 *  The PHYSFS_File may be backed by a real file in the physical filesystem,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3075
 *  but isn't necessarily. The most popular use for this is likely to mount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3076
 *  archives stored inside other archives.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3077
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3078
 * (filename) is only used here to optimize archiver selection (if you name it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3079
 *  XXXXX.zip, we might try the ZIP archiver first, for example). It doesn't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3080
 *  need to refer to a real file at all, and can even be NULL. If the filename
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3081
 *  isn't helpful, the system will try every archiver until one works or none
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3082
 *  of them do.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3083
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3084
 * (file) must remain until the archive is unmounted. When the archive is
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3085
 *  unmounted, the system will call PHYSFS_close(file). If you need this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3086
 *  handle to survive, you will have to wrap this in a PHYSFS_Io and use
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3087
 *  PHYSFS_mountIo() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3088
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3089
 * If this function fails, PHYSFS_close(file) is not called.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3090
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3091
 *   \param file The PHYSFS_File handle containing archive data.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3092
 *   \param fname Filename that can represent this stream. Can be NULL.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3093
 *   \param mountPoint Location in the interpolated tree that this archive
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3094
 *                     will be "mounted", in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3095
 *                     NULL or "" is equivalent to "/".
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3096
 *   \param appendToPath nonzero to append to search path, zero to prepend.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3097
 *  \return nonzero if added to path, zero on failure (bogus archive, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3098
 *                  Specifics of the error can be gleaned from
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3099
 *                  PHYSFS_getLastError().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3100
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3101
 * \sa PHYSFS_unmount
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3102
 * \sa PHYSFS_getSearchPath
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3103
 * \sa PHYSFS_getMountPoint
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3104
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3105
PHYSFS_DECL int PHYSFS_mountHandle(PHYSFS_File *file, const char *fname,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3106
                                   const char *mountPoint, int appendToPath);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3107
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3108
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3109
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3110
 * \enum PHYSFS_ErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3111
 * \brief Values that represent specific causes of failure.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3112
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3113
 * Most of the time, you should only concern yourself with whether a given
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3114
 *  operation failed or not, but there may be occasions where you plan to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3115
 *  handle a specific failure case gracefully, so we provide specific error
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3116
 *  codes.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3117
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3118
 * Most of these errors are a little vague, and most aren't things you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3119
 *  fix...if there's a permission error, for example, all you can really do
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3120
 *  is pass that information on to the user and let them figure out how to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3121
 *  handle it. In most these cases, your program should only care that it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3122
 *  failed to accomplish its goals, and not care specifically why.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3123
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3124
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3125
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3126
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3127
typedef enum PHYSFS_ErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3128
{
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3129
    PHYSFS_ERR_OK,               /**< Success; no error.                    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3130
    PHYSFS_ERR_OTHER_ERROR,      /**< Error not otherwise covered here.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3131
    PHYSFS_ERR_OUT_OF_MEMORY,    /**< Memory allocation failed.             */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3132
    PHYSFS_ERR_NOT_INITIALIZED,  /**< PhysicsFS is not initialized.         */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3133
    PHYSFS_ERR_IS_INITIALIZED,   /**< PhysicsFS is already initialized.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3134
    PHYSFS_ERR_ARGV0_IS_NULL,    /**< Needed argv[0], but it is NULL.       */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3135
    PHYSFS_ERR_UNSUPPORTED,      /**< Operation or feature unsupported.     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3136
    PHYSFS_ERR_PAST_EOF,         /**< Attempted to access past end of file. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3137
    PHYSFS_ERR_FILES_STILL_OPEN, /**< Files still open.                     */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3138
    PHYSFS_ERR_INVALID_ARGUMENT, /**< Bad parameter passed to an function.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3139
    PHYSFS_ERR_NOT_MOUNTED,      /**< Requested archive/dir not mounted.    */
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3140
    PHYSFS_ERR_NOT_FOUND,        /**< File (or whatever) not found.         */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3141
    PHYSFS_ERR_SYMLINK_FORBIDDEN,/**< Symlink seen when not permitted.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3142
    PHYSFS_ERR_NO_WRITE_DIR,     /**< No write dir has been specified.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3143
    PHYSFS_ERR_OPEN_FOR_READING, /**< Wrote to a file opened for reading.   */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3144
    PHYSFS_ERR_OPEN_FOR_WRITING, /**< Read from a file opened for writing.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3145
    PHYSFS_ERR_NOT_A_FILE,       /**< Needed a file, got a directory (etc). */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3146
    PHYSFS_ERR_READ_ONLY,        /**< Wrote to a read-only filesystem.      */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3147
    PHYSFS_ERR_CORRUPT,          /**< Corrupted data encountered.           */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3148
    PHYSFS_ERR_SYMLINK_LOOP,     /**< Infinite symbolic link loop.          */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3149
    PHYSFS_ERR_IO,               /**< i/o error (hardware failure, etc).    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3150
    PHYSFS_ERR_PERMISSION,       /**< Permission denied.                    */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3151
    PHYSFS_ERR_NO_SPACE,         /**< No space (disk full, over quota, etc) */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3152
    PHYSFS_ERR_BAD_FILENAME,     /**< Filename is bogus/insecure.           */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3153
    PHYSFS_ERR_BUSY,             /**< Tried to modify a file the OS needs.  */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3154
    PHYSFS_ERR_DIR_NOT_EMPTY,    /**< Tried to delete dir with files in it. */
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3155
    PHYSFS_ERR_OS_ERROR,         /**< Unspecified OS-level error.           */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3156
    PHYSFS_ERR_DUPLICATE,        /**< Duplicate entry.                      */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3157
    PHYSFS_ERR_BAD_PASSWORD      /**< Bad password.                         */
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3158
} PHYSFS_ErrorCode;
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3159
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3160
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3161
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3162
 * \fn PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3163
 * \brief Get machine-readable error information.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3164
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3165
 * Get the last PhysicsFS error message as an integer value. This will return
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3166
 *  PHYSFS_ERR_OK if there's been no error since the last call to this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3167
 *  function. Each thread has a unique error state associated with it, but
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3168
 *  each time a new error message is set, it will overwrite the previous one
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3169
 *  associated with that thread. It is safe to call this function at anytime,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3170
 *  even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3171
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3172
 * PHYSFS_getLastError() and PHYSFS_getLastErrorCode() both reset the same
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3173
 *  thread-specific error state. Calling one will wipe out the other's
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3174
 *  data. If you need both, call PHYSFS_getLastErrorCode(), then pass that
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3175
 *  value to PHYSFS_getErrorByCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3176
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3177
 * Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3178
 *  given function failed; however, if you require more specifics, you can
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3179
 *  try this function to glean information, if there's some specific problem
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3180
 *  you're expecting and plan to handle. But with most things that involve
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3181
 *  file systems, the best course of action is usually to give up, report the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3182
 *  problem to the user, and let them figure out what should be done about it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3183
 *  For that, you might prefer PHYSFS_getLastError() instead.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3184
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3185
 *   \return Enumeration value that represents last reported error.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3186
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3187
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3188
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3189
PHYSFS_DECL PHYSFS_ErrorCode PHYSFS_getLastErrorCode(void);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3190
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3191
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3192
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3193
 * \fn const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3194
 * \brief Get human-readable description string for a given error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3195
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3196
 * Get a static string, in UTF-8 format, that represents an English
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3197
 *  description of a given error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3198
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3199
 * This string is guaranteed to never change (although we may add new strings
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3200
 *  for new error codes in later versions of PhysicsFS), so you can use it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3201
 *  for keying a localization dictionary.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3202
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3203
 * It is safe to call this function at anytime, even before PHYSFS_init().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3204
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3205
 * These strings are meant to be passed on directly to the user.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3206
 *  Generally, applications should only concern themselves with whether a
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3207
 *  given function failed, but not care about the specifics much.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3208
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3209
 * Do not attempt to free the returned strings; they are read-only and you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3210
 *  don't own their memory pages.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3211
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3212
 *   \param code Error code to convert to a string.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3213
 *   \return READ ONLY string of requested error message, NULL if this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3214
 *           is not a valid PhysicsFS error code. Always check for NULL if
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3215
 *           you might be looking up an error code that didn't exist in an
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3216
 *           earlier version of PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3217
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3218
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3219
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3220
PHYSFS_DECL const char *PHYSFS_getErrorByCode(PHYSFS_ErrorCode code);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3221
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3222
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3223
 * \fn void PHYSFS_setErrorCode(PHYSFS_ErrorCode code)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3224
 * \brief Set the current thread's error code.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3225
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3226
 * This lets you set the value that will be returned by the next call to
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3227
 *  PHYSFS_getLastErrorCode(). This will replace any existing error code,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3228
 *  whether set by your application or internally by PhysicsFS.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3229
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3230
 * Error codes are stored per-thread; what you set here will not be
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3231
 *  accessible to another thread.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3232
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3233
 * Any call into PhysicsFS may change the current error code, so any code you
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3234
 *  set here is somewhat fragile, and thus you shouldn't build any serious
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3235
 *  error reporting framework on this function. The primary goal of this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3236
 *  function is to allow PHYSFS_Io implementations to set the error state,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3237
 *  which generally will be passed back to your application when PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3238
 *  makes a PHYSFS_Io call that fails internally.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3239
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3240
 * This function doesn't care if the error code is a value known to PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3241
 *  or not (but PHYSFS_getErrorByCode() will return NULL for unknown values).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3242
 *  The value will be reported unmolested by PHYSFS_getLastErrorCode().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3243
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3244
 *   \param code Error code to become the current thread's new error state.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3245
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3246
 * \sa PHYSFS_getLastErrorCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3247
 * \sa PHYSFS_getErrorByCode
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3248
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3249
PHYSFS_DECL void PHYSFS_setErrorCode(PHYSFS_ErrorCode code);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3250
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3251
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3252
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3253
 * \fn const char *PHYSFS_getPrefDir(const char *org, const char *app)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3254
 * \brief Get the user-and-app-specific path where files can be written.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3255
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3256
 * Helper function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3257
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3258
 * Get the "pref dir". This is meant to be where users can write personal
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3259
 *  files (preferences and save games, etc) that are specific to your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3260
 *  application. This directory is unique per user, per application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3261
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3262
 * This function will decide the appropriate location in the native filesystem,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3263
 *  create the directory if necessary, and return a string in
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3264
 *  platform-dependent notation, suitable for passing to PHYSFS_setWriteDir().
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3265
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3266
 * On Windows, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3267
 *  "C:\\Users\\bob\\AppData\\Roaming\\My Company\\My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3268
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3269
 * On Linux, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3270
 *  "/home/bob/.local/share/My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3271
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3272
 * On Mac OS X, this might look like:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3273
 *  "/Users/bob/Library/Application Support/My Program Name"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3274
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3275
 * (etc.)
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3276
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3277
 * You should probably use the pref dir for your write dir, and also put it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3278
 *  near the beginning of your search path. Older versions of PhysicsFS
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3279
 *  offered only PHYSFS_getUserDir() and left you to figure out where the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3280
 *  files should go under that tree. This finds the correct location
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3281
 *  for whatever platform, which not only changes between operating systems,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3282
 *  but also versions of the same operating system.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3283
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3284
 * You specify the name of your organization (if it's not a real organization,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3285
 *  your name or an Internet domain you own might do) and the name of your
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3286
 *  application. These should be proper names.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3287
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3288
 * Both the (org) and (app) strings may become part of a directory name, so
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3289
 *  please follow these rules:
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3290
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3291
 *    - Try to use the same org string (including case-sensitivity) for
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3292
 *      all your applications that use this function.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3293
 *    - Always use a unique app string for each one, and make sure it never
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3294
 *      changes for an app once you've decided on it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3295
 *    - Unicode characters are legal, as long as it's UTF-8 encoded, but...
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3296
 *    - ...only use letters, numbers, and spaces. Avoid punctuation like
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3297
 *      "Game Name 2: Bad Guy's Revenge!" ... "Game Name 2" is sufficient.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3298
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3299
 * The pointer returned by this function remains valid until you call this
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3300
 *  function again, or call PHYSFS_deinit(). This is not necessarily a fast
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3301
 *  call, though, so you should call this once at startup and copy the string
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3302
 *  if you need it.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3303
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3304
 * You should assume the path returned by this function is the only safe
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3305
 *  place to write files (and that PHYSFS_getUserDir() and PHYSFS_getBaseDir(),
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3306
 *  while they might be writable, or even parents of the returned path, aren't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3307
 *  where you should be writing things).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3308
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3309
 *   \param org The name of your organization.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3310
 *   \param app The name of your application.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3311
 *  \return READ ONLY string of user dir in platform-dependent notation. NULL
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3312
 *          if there's a problem (creating directory failed, etc).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3313
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3314
 * \sa PHYSFS_getBaseDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3315
 * \sa PHYSFS_getUserDir
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3316
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3317
PHYSFS_DECL const char *PHYSFS_getPrefDir(const char *org, const char *app);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3318
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3319
12213
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3320
/**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3321
 * \struct PHYSFS_Archiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3322
 * \brief Abstract interface to provide support for user-defined archives.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3323
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3324
 * \warning This is advanced, hardcore stuff. You don't need this unless you
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3325
 *          really know what you're doing. Most apps will not need this.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3326
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3327
 * Historically, PhysicsFS provided a means to mount various archive file
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3328
 *  formats, and physical directories in the native filesystem. However,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3329
 *  applications have been limited to the file formats provided by the
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3330
 *  library. This interface allows an application to provide their own
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3331
 *  archive file types.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3332
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3333
 * Conceptually, a PHYSFS_Archiver provides directory entries, while
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3334
 *  PHYSFS_Io provides data streams for those directory entries. The most
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3335
 *  obvious use of PHYSFS_Archiver is to provide support for an archive
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3336
 *  file type that isn't provided by PhysicsFS directly: perhaps some
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3337
 *  proprietary format that only your application needs to understand.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3338
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3339
 * Internally, all the built-in archive support uses this interface, so the
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3340
 *  best examples for building a PHYSFS_Archiver is the source code to
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3341
 *  PhysicsFS itself.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3342
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3343
 * An archiver is added to the system with PHYSFS_registerArchiver(), and then
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3344
 *  it will be available for use automatically with PHYSFS_mount(); if a
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3345
 *  given archive can be handled with your archiver, it will be given control
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3346
 *  as appropriate.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3347
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3348
 * These methods deal with dir handles. You have one instance of your
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3349
 *  archiver, and it generates a unique, opaque handle for each opened
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3350
 *  archive in its openArchive() method. Since the lifetime of an Archiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3351
 *  (not an archive) is generally the entire lifetime of the process, and it's
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3352
 *  assumed to be a singleton, we do not provide any instance data for the
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3353
 *  archiver itself; the app can just use some static variables if necessary.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3354
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3355
 * Symlinks should always be followed (except in stat()); PhysicsFS will
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3356
 *  use the stat() method to check for symlinks and make a judgement on
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3357
 *  whether to continue to call other methods based on that.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3358
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3359
 * Archivers, when necessary, should set the PhysicsFS error state with
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3360
 *  PHYSFS_setErrorCode() before returning. PhysicsFS will pass these errors
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3361
 *  back to the application unmolested in most cases.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3362
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3363
 * Thread safety: TO BE DECIDED.  !!! FIXME
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3364
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3365
 * \sa PHYSFS_registerArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3366
 * \sa PHYSFS_deregisterArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3367
 * \sa PHYSFS_supportedArchiveTypes
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3368
 */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3369
typedef struct PHYSFS_Archiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3370
{
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3371
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3372
// !!! FIXME: split read/write interfaces?
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3373
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3374
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3375
     * \brief Binary compatibility information.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3376
     *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3377
     * This must be set to zero at this time. Future versions of this
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3378
     *  struct will increment this field, so we know what a given
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3379
     *  implementation supports. We'll presumably keep supporting older
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3380
     *  versions as we offer new features, though.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3381
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3382
    PHYSFS_uint32 version;
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3383
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3384
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3385
     * \brief Basic info about this archiver.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3386
     *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3387
     * This is used to identify your archive, and is returned in
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3388
     *  PHYSFS_supportedArchiveTypes().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3389
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3390
    PHYSFS_ArchiveInfo info;
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3391
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3392
// !!! FIXME: documentation: \brief?
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3393
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3394
     * \brief
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3395
     *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3396
     * Open an archive provided by (io).
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3397
     *  (name) is a filename associated with (io), but doesn't necessarily
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3398
     *  map to anything, let alone a real filename. This possibly-
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3399
     *  meaningless name is in platform-dependent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3400
     * (forWrite) is non-zero if this is to be used for
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3401
     *  the write directory, and zero if this is to be used for an
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3402
     *  element of the search path.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3403
     * Return NULL on failure. We ignore any error code you set here;
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3404
     *  when PHYSFS_mount() returns, the error will be PHYSFS_ERR_UNSUPPORTED
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3405
     *  (no Archivers could handle this data).  // !!! FIXME: yeah?
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3406
     *  Returns non-NULL on success. The pointer returned will be
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3407
     *  passed as the "opaque" parameter for later calls.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3408
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3409
    void *(*openArchive)(PHYSFS_Io *io, const char *name, int forWrite);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3410
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3411
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3412
     * List all files in (dirname). Each file is passed to (cb),
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3413
     *  where a copy is made if appropriate, so you should dispose of
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3414
     *  it properly upon return from the callback.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3415
     * If you have a failure, report as much as you can.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3416
     *  (dirname) is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3417
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3418
    void (*enumerateFiles)(void *opaque, const char *dirname,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3419
                           PHYSFS_EnumFilesCallback cb,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3420
                           const char *origdir, void *callbackdata);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3421
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3422
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3423
     * Open file for reading.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3424
     *  This filename, (fnm), is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3425
     * If you can't handle multiple opens of the same file,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3426
     *  you can opt to fail for the second call.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3427
     * Fail if the file does not exist.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3428
     * Returns NULL on failure, and calls PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3429
     *  Returns non-NULL on success. The pointer returned will be
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3430
     *  passed as the "opaque" parameter for later file calls.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3431
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3432
    PHYSFS_Io *(*openRead)(void *opaque, const char *fnm);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3433
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3434
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3435
     * Open file for writing.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3436
     * If the file does not exist, it should be created. If it exists,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3437
     *  it should be truncated to zero bytes. The writing
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3438
     *  offset should be the start of the file.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3439
     * This filename is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3440
     * If you can't handle multiple opens of the same file,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3441
     *  you can opt to fail for the second call.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3442
     * Returns NULL on failure, and calls PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3443
     *  Returns non-NULL on success. The pointer returned will be
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3444
     *  passed as the "opaque" parameter for later file calls.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3445
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3446
    PHYSFS_Io *(*openWrite)(void *opaque, const char *filename);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3447
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3448
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3449
     * Open file for appending.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3450
     * If the file does not exist, it should be created. The writing
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3451
     *  offset should be the end of the file.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3452
     * This filename is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3453
     * If you can't handle multiple opens of the same file,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3454
     *  you can opt to fail for the second call.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3455
     * Returns NULL on failure, and calls PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3456
     *  Returns non-NULL on success. The pointer returned will be
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3457
     *  passed as the "opaque" parameter for later file calls.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3458
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3459
    PHYSFS_Io *(*openAppend)(void *opaque, const char *filename);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3460
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3461
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3462
     * Delete a file in the archive/directory.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3463
     *  Return non-zero on success, zero on failure.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3464
     *  This filename is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3465
     *  This method may be NULL.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3466
     * On failure, call PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3467
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3468
    int (*remove)(void *opaque, const char *filename);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3469
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3470
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3471
     * Create a directory in the archive/directory.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3472
     *  If the application is trying to make multiple dirs, PhysicsFS
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3473
     *  will split them up into multiple calls before passing them to
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3474
     *  your driver.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3475
     *  Return non-zero on success, zero on failure.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3476
     *  This filename is in platform-independent notation.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3477
     *  This method may be NULL.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3478
     * On failure, call PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3479
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3480
    int (*mkdir)(void *opaque, const char *filename);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3481
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3482
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3483
     * Obtain basic file metadata.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3484
     *  Returns non-zero on success, zero on failure.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3485
     *  On failure, call PHYSFS_setErrorCode().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3486
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3487
    int (*stat)(void *opaque, const char *fn, PHYSFS_Stat *stat);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3488
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3489
    /**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3490
     * Close directories/archives, and free any associated memory,
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3491
     *  including the original PHYSFS_Io and (opaque) itself, if
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3492
     *  applicable. Implementation can assume that it won't be called if
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3493
     *  there are still files open from this archive.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3494
     */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3495
    void (*closeArchive)(void *opaque);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3496
} PHYSFS_Archiver;
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3497
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3498
/**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3499
 * \fn int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver)
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3500
 * \brief Add a new archiver to the system.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3501
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3502
 * !!! FIXME: write me.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3503
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3504
 * You may not have two archivers that handle the same extension. If you are
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3505
 *  going to have a clash, you can deregister the other archiver (including
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3506
 *  built-in ones) with PHYSFS_deregisterArchiver().
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3507
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3508
 * The data in (archiver) is copied; you may free this pointer when this
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3509
 *  function returns.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3510
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3511
 *   \param archiver The archiver to register.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3512
 *  \return Zero on error, non-zero on success.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3513
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3514
 * \sa PHYSFS_Archiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3515
 * \sa PHYSFS_deregisterArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3516
 */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3517
PHYSFS_DECL int PHYSFS_registerArchiver(const PHYSFS_Archiver *archiver);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3518
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3519
/**
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3520
 * \fn int PHYSFS_deregisterArchiver(const char *ext)
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3521
 * \brief Remove an archiver from the system.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3522
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3523
 * !!! FIXME: write me.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3524
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3525
 * This fails if there are any archives still open that use this archiver.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3526
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3527
 *   \param ext Filename extension that the archiver handles.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3528
 *  \return Zero on error, non-zero on success.
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3529
 *
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3530
 * \sa PHYSFS_Archiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3531
 * \sa PHYSFS_registerArchiver
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3532
 */
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3533
PHYSFS_DECL int PHYSFS_deregisterArchiver(const char *ext);
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3534
bb5522e88ab2 bulk copy of latest physfs to our misc/libphysfs since this seems to fix an off-by-1 error reliably hit in readln read of 1 byte probably introduced in the addition of the buffered read. Whether this is excessive or whether libphysfs should even be maintained by us is another matter. But at least we shouldn't crash
nemo
parents: 10017
diff changeset
  3535
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3536
/* Everything above this line is part of the PhysicsFS 2.1 API. */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3537
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3538
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3539
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3540
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3541
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3542
#endif  /* !defined _INCLUDE_PHYSFS_H_ */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3543
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3544
/* end of physfs.h ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
  3545