Subversion Repositories Games.Descent

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 pmbaty 1
/*
2
 * This file is part of the DXX-Rebirth project <https://www.dxx-rebirth.com/>.
3
 * It is copyright by its individual contributors, as recorded in the
4
 * project's Git history.  See COPYING.txt at the top level for license
5
 * terms and a link to the Git history.
6
 */
7
/*
8
 * This code provides a glue layer between PhysicsFS and Simple Directmedia
9
 *  Layer's (SDL) RWops i/o abstraction.
10
 *
11
 * License: this code is public domain. I make no warranty that it is useful,
12
 *  correct, harmless, or environmentally safe.
13
 *
14
 * This particular file may be used however you like, including copying it
15
 *  verbatim into a closed-source project, exploiting it commercially, and
16
 *  removing any trace of my name from the source (although I hope you won't
17
 *  do that). I welcome enhancements and corrections to this file, but I do
18
 *  not require you to send me patches if you make changes. This code has
19
 *  NO WARRANTY.
20
 *
21
 * Unless otherwise stated, the rest of PhysicsFS falls under the zlib license.
22
 *  Please see LICENSE in the root of the source tree.
23
 *
24
 * SDL falls under the LGPL license. You can get SDL at https://www.libsdl.org/
25
 *
26
 *  This file was written by Ryan C. Gordon. (icculus@clutteredmind.org).
27
 */
28
 
29
#pragma once
30
 
31
#if 1   //!(defined(__APPLE__) && defined(__MACH__))
32
#include <physfs.h>
33
#else
34
#include <physfs/physfs.h>
35
#endif
36
#include <SDL.h>
37
 
38
#ifdef __cplusplus
39
#include <memory>
40
 
41
struct RWops_delete
42
{
43
        void operator()(SDL_RWops *o) const
44
        {
45
                SDL_RWclose(o);
46
        }
47
};
48
 
49
//typedef std::unique_ptr<SDL_RWops, RWops_delete> RWops_ptr;
50
typedef SDL_RWops *RWops_ptr; // Pierre-Marie Baty -- don't overengineer stuff
51
 
52
/**
53
 * Open a platform-independent filename for reading, and make it accessible
54
 *  via an SDL_RWops structure. The file will be closed in PhysicsFS when the
55
 *  RWops is closed. PhysicsFS should be configured to your liking before
56
 *  opening files through this method.
57
 *
58
 *   @param filename File to open in platform-independent notation.
59
 *  @return A valid SDL_RWops structure on success, NULL on error. Specifics
60
 *           of the error can be gleaned from PHYSFS_getLastError().
61
 */
62
extern "C" RWops_ptr PHYSFSRWOPS_openRead(const char *fname); // Pierre-Marie Baty -- don't overengineer stuff
63
 
64
#endif
65
 
66
/* end of physfsrwops.h ... */
67