1 /*
2  * This file is part of EasyRPG Player.
3  *
4  * EasyRPG Player is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * EasyRPG Player is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef EP_SYSTEM_H
19 #define EP_SYSTEM_H
20 
21 /*
22  * Includes GNU Autotools build configuration parameters.
23  * This option may have defined USE_SDL and others.
24  */
25 #ifdef HAVE_CONFIG_H
26 #  include <config.h>
27 #endif
28 
29 #if !(defined(USE_SDL) || defined(_3DS) || defined(PSP2) || defined(__SWITCH__) || defined(USE_LIBRETRO))
30 #  error "This build doesn't target a backend"
31 #endif
32 
33 /*
34  * TODO?: Combine system.h and options.h ?
35  * options.h is oriented to configurations that the EasyRPG user might want
36  * to change.
37  * system.h is oriented to what used libraries and OS are capable of.
38  */
39 #include "options.h"
40 
41 // Smart pointer header.
42 #include "memory_management.h"
43 
44 #if defined(USE_LIBRETRO)
45 // libretro must be first to prevent conflicts with other defines
46 #  define SUPPORT_KEYBOARD
47 #  define SUPPORT_JOYSTICK
48 #  define SUPPORT_JOYSTICK_HAT
49 #  define SUPPORT_JOYSTICK_AXIS
50 #  define JOYSTICK_AXIS_SENSIBILITY 20000
51 #elif defined(OPENDINGUX)
52 #  include <sys/types.h>
53 #elif defined(__ANDROID__)
54 #  define SUPPORT_ZOOM
55 #  define SUPPORT_JOYSTICK
56 #  define SUPPORT_JOYSTICK_HAT
57 #  define SUPPORT_JOYSTICK_AXIS
58 #elif defined(EMSCRIPTEN)
59 #  define SUPPORT_MOUSE
60 #  define SUPPORT_TOUCH
61 #  define SUPPORT_JOYSTICK
62 #  define SUPPORT_JOYSTICK_HAT
63 #  define SUPPORT_JOYSTICK_AXIS
64 #elif defined(_3DS)
65 #  define SUPPORT_JOYSTICK_AXIS
66 #elif defined(PSP2)
67 #  define SUPPORT_JOYSTICK
68 #  define SUPPORT_JOYSTICK_AXIS
69 #elif defined(GEKKO)
70 #  include <cstdint>
71 #  define WORDS_BIGENDIAN
72 #  define SUPPORT_JOYSTICK
73 #  define SUPPORT_JOYSTICK_HAT
74 #  define SUPPORT_JOYSTICK_AXIS
75 #elif defined(_WIN32)
76 #  define SUPPORT_ZOOM
77 #  define SUPPORT_MOUSE
78 #  define SUPPORT_TOUCH
79 #  define SUPPORT_JOYSTICK
80 #  define SUPPORT_JOYSTICK_HAT
81 #  define SUPPORT_JOYSTICK_AXIS
82 #elif defined(__SWITCH__)
83 #elif defined(__MORPHOS__) || defined(__amigaos4__)
84 #  define SUPPORT_ZOOM
85 #  define SUPPORT_MOUSE
86 #  define WORDS_BIGENDIAN
87 #  define SUPPORT_JOYSTICK
88 #  define SUPPORT_JOYSTICK_HAT
89 #  define SUPPORT_JOYSTICK_AXIS
90 #else // Everything not catched above, e.g. Linux/*BSD/macOS
91 #  define USE_WINE_REGISTRY
92 #  define USE_XDG_RTP
93 #  define SUPPORT_ZOOM
94 #  define SUPPORT_MOUSE
95 #  define SUPPORT_TOUCH
96 #  define SUPPORT_JOYSTICK
97 #  define SUPPORT_JOYSTICK_HAT
98 #  define SUPPORT_JOYSTICK_AXIS
99 #endif
100 
101 #ifdef USE_SDL
102 
103 #  define SUPPORT_KEYBOARD
104 #  define JOYSTICK_AXIS_SENSIBILITY 20000
105 
106 #endif
107 
108 #if defined(HAVE_LIBSAMPLERATE) || defined(HAVE_LIBSPEEXDSP)
109 #  define USE_AUDIO_RESAMPLER
110 #endif
111 
112 #endif
113 
114 #if defined(__APPLE__) && defined(__MACH__)
115 #include <TargetConditionals.h>
116 #endif
117