misc/libphyslayer/physfsrwops.h
author Wuzzy <Wuzzy2@mail.ru>
Sat, 02 Nov 2019 13:01:28 +0100
changeset 15501 5a30396f8fb2
parent 13538 f8c0a62fa3ac
child 15853 fcea0f51d94f
permissions -rw-r--r--
ClimbHome: Change misleading Seed assignment to nil value This was "Seed = ClimbHome", but ClimbHome was a nil value. This code still worked as the engine interpreted the nil value as empty string. But it can be very misleading. This changeset makes the Seed assignment more explicit by assigning the empty string directly. The compability has been tested.
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
 * This code provides a glue layer between PhysicsFS and Simple Directmedia
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     3
 *  Layer's (SDL) RWops i/o abstraction.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     4
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     5
 * License: this code is public domain. I make no warranty that it is useful,
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     6
 *  correct, harmless, or environmentally safe.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     7
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     8
 * This particular file may be used however you like, including copying it
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
     9
 *  verbatim into a closed-source project, exploiting it commercially, and
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    10
 *  removing any trace of my name from the source (although I hope you won't
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    11
 *  do that). I welcome enhancements and corrections to this file, but I do
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    12
 *  not require you to send me patches if you make changes. This code has
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    13
 *  NO WARRANTY.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    14
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    15
 * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    16
 *  Please see LICENSE.txt in the root of the source tree.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    17
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    18
 * SDL falls under the LGPL license. You can get SDL at http://www.libsdl.org/
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    19
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    20
 *  This file was written by Ryan C. Gordon. (icculus@icculus.org).
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    21
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    22
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    23
#ifndef _INCLUDE_PHYSFSRWOPS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    24
#define _INCLUDE_PHYSFSRWOPS_H_
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    25
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    26
#include "physfs.h"
10129
cd2a64a1f4aa - Pas2C: make use of 'external' function decorator
unc0rr
parents: 9991
diff changeset
    27
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    28
#include "SDL.h"
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    29
9991
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
    30
#include "physfscompat.h"
3858d99476f5 add compatibility for physicsfs 2.0
sheepluva
parents: 8524
diff changeset
    31
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    32
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    33
extern "C" {
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    34
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    35
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    36
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    37
 * Open a platform-independent filename for reading, and make it accessible
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    38
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    39
 *  RWops is closed. PhysicsFS should be configured to your liking before
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    40
 *  opening files through this method.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    41
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    42
 *   @param filename File to open in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    43
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
13538
f8c0a62fa3ac Fix deprecation warnings in libphyslayer
Wuzzy <Wuzzy2@mail.ru>
parents: 10129
diff changeset
    44
 *           of the error can be gleaned from PHYSFS_getLastErrorCode().
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    45
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    46
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openRead(const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    47
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    48
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    49
 * Open a platform-independent filename for writing, and make it accessible
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    50
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    51
 *  RWops is closed. PhysicsFS should be configured to your liking before
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    52
 *  opening files through this method.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    53
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    54
 *   @param filename File to open in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    55
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
13538
f8c0a62fa3ac Fix deprecation warnings in libphyslayer
Wuzzy <Wuzzy2@mail.ru>
parents: 10129
diff changeset
    56
 *           of the error can be gleaned from PHYSFS_getLastErrorCode().
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    57
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    58
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openWrite(const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    59
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    60
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    61
 * Open a platform-independent filename for appending, and make it accessible
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    62
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    63
 *  RWops is closed. PhysicsFS should be configured to your liking before
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    64
 *  opening files through this method.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    65
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    66
 *   @param filename File to open in platform-independent notation.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    67
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
13538
f8c0a62fa3ac Fix deprecation warnings in libphyslayer
Wuzzy <Wuzzy2@mail.ru>
parents: 10129
diff changeset
    68
 *           of the error can be gleaned from PHYSFS_getLastErrorCode().
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    69
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    70
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_openAppend(const char *fname);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    71
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    72
/**
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    73
 * Make a SDL_RWops from an existing PhysicsFS file handle. You should
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    74
 *  dispose of any references to the handle after successful creation of
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    75
 *  the RWops. The actual PhysicsFS handle will be destroyed when the
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    76
 *  RWops is closed.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    77
 *
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    78
 *   @param handle a valid PhysicsFS file handle.
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    79
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
13538
f8c0a62fa3ac Fix deprecation warnings in libphyslayer
Wuzzy <Wuzzy2@mail.ru>
parents: 10129
diff changeset
    80
 *           of the error can be gleaned from PHYSFS_getLastErrorCode().
7768
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    81
 */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    82
PHYSFS_DECL SDL_RWops *PHYSFSRWOPS_makeRWops(PHYSFS_File *handle);
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    83
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    84
#ifdef __cplusplus
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    85
}
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    86
#endif
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    87
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    88
#endif /* include-once blocker */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    89
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    90
/* end of physfsrwops.h ... */
13e2037ebc79 Try using PhysicsFS.
unc0rr
parents:
diff changeset
    91