7768
|
1 |
/*
|
|
2 |
* This code provides a glue layer between PhysicsFS and Simple Directmedia
|
|
3 |
* Layer's (SDL) RWops i/o abstraction.
|
|
4 |
*
|
|
5 |
* License: this code is public domain. I make no warranty that it is useful,
|
|
6 |
* correct, harmless, or environmentally safe.
|
|
7 |
*
|
|
8 |
* This particular file may be used however you like, including copying it
|
|
9 |
* verbatim into a closed-source project, exploiting it commercially, and
|
|
10 |
* removing any trace of my name from the source (although I hope you won't
|
|
11 |
* do that). I welcome enhancements and corrections to this file, but I do
|
|
12 |
* not require you to send me patches if you make changes. This code has
|
|
13 |
* NO WARRANTY.
|
|
14 |
*
|
|
15 |
* Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
|
|
16 |
* Please see LICENSE.txt in the root of the source tree.
|
|
17 |
*
|
|
18 |
* SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
|
|
19 |
*
|
|
20 |
* This file was written by Ryan C. Gordon. (icculus@icculus.org).
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef _INCLUDE_PHYSFSRWOPS_H_
|
|
24 |
#define _INCLUDE_PHYSFSRWOPS_H_
|
|
25 |
|
|
26 |
#include "physfs.h"
|
10129
|
27 |
|
7768
|
28 |
#include "SDL.h"
|
|
29 |
|
9991
|
30 |
#include "physfscompat.h"
|
|
31 |
|
7768
|
32 |
#ifdef __cplusplus
|
|
33 |
extern "C" {
|
|
34 |
#endif
|
|
35 |
|
|
36 |
/**
|
|
37 |
* Open a platform-independent filename for reading, and make it accessible
|
|
38 |
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
|
|
39 |
* RWops is closed. PhysicsFS should be configured to your liking before
|
|
40 |
* opening files through this method.
|
|
41 |
*
|
|
42 |
* @param filename File to open in platform-independent notation.
|
|
43 |
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
|
|
44 |
* of the error can be gleaned from PHYSFS_getLastError().
|
|
45 |
*/
|
|
46 |
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
|
|
47 |
|
|
48 |
/**
|
|
49 |
* Open a platform-independent filename for writing, and make it accessible
|
|
50 |
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
|
|
51 |
* RWops is closed. PhysicsFS should be configured to your liking before
|
|
52 |
* opening files through this method.
|
|
53 |
*
|
|
54 |
* @param filename File to open in platform-independent notation.
|
|
55 |
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
|
|
56 |
* of the error can be gleaned from PHYSFS_getLastError().
|
|
57 |
*/
|
|
58 |
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Open a platform-independent filename for appending, and make it accessible
|
|
62 |
* via an SDL_RWops structure. The file will be closed in PhysicsFS when the
|
|
63 |
* RWops is closed. PhysicsFS should be configured to your liking before
|
|
64 |
* opening files through this method.
|
|
65 |
*
|
|
66 |
* @param filename File to open in platform-independent notation.
|
|
67 |
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
|
|
68 |
* of the error can be gleaned from PHYSFS_getLastError().
|
|
69 |
*/
|
|
70 |
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
|
|
71 |
|
|
72 |
/**
|
|
73 |
* Make a SDL_RWops from an existing PhysicsFS file handle. You should
|
|
74 |
* dispose of any references to the handle after successful creation of
|
|
75 |
* the RWops. The actual PhysicsFS handle will be destroyed when the
|
|
76 |
* RWops is closed.
|
|
77 |
*
|
|
78 |
* @param handle a valid PhysicsFS file handle.
|
|
79 |
* @return A valid SDL_RWops structure on success, NULL on error. Specifics
|
|
80 |
* of the error can be gleaned from PHYSFS_getLastError().
|
|
81 |
*/
|
|
82 |
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
|
|
83 |
|
|
84 |
#ifdef __cplusplus
|
|
85 |
}
|
|
86 |
#endif
|
|
87 |
|
|
88 |
#endif /* include-once blocker */
|
|
89 |
|
|
90 |
/* end of physfsrwops.h ... */
|
|
91 |
|