1 #pragma once
2 
3 // This file is included by C, C++ and ASM files
4 // So do not output any token!
5 
6 #define PPSSPP_ARCH(PPSSPP_FEATURE) (PPSSPP_ARCH_##PPSSPP_FEATURE)
7 #define PPSSPP_PLATFORM(PPSSPP_FEATURE) (PPSSPP_PLATFORM_##PPSSPP_FEATURE)
8 #define PPSSPP_API(PPSSPP_FEATURE) (PPSSPP_API_##PPSSPP_FEATURE)
9 
10 // ARCH defines
11 #if defined(_M_IX86) || defined(__i386__)
12     #define PPSSPP_ARCH_X86 1
13     #define PPSSPP_ARCH_32BIT 1
14     //TODO: Remove this compat define
15     #ifndef _M_IX86
16         #define _M_IX86 600
17     #endif
18 #endif
19 
20 #if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
21     #define PPSSPP_ARCH_AMD64 1
22     #define PPSSPP_ARCH_64BIT 1
23     //TODO: Remove this compat define
24     #ifndef _M_X64
25         #define _M_X64 1
26     #endif
27 #endif
28 
29 #if defined(__arm__) || defined(_M_ARM)
30     #define PPSSPP_ARCH_ARM 1
31     #define PPSSPP_ARCH_32BIT 1
32 
33     #if defined(__ARM_ARCH_7__) || \
34       defined(__ARM_ARCH_7A__) || \
35       defined(__ARM_ARCH_7S__)
36         #define PPSSPP_ARCH_ARMV7 1
37     #endif
38 
39     #if defined(__ARM_ARCH_7S__)
40         #define PPSSPP_ARCH_ARMV7S 1
41     #endif
42 
43     #if defined(__ARM_NEON) || defined(__ARM_NEON__)
44         #define PPSSPP_ARCH_ARM_NEON 1
45     #endif
46 
47     #if defined(_M_ARM)
48         #define PPSSPP_ARCH_ARMV7 1
49         #define PPSSPP_ARCH_ARM_NEON 1
50     #endif
51 #endif
52 
53 #if defined(__aarch64__) || defined(_M_ARM64)
54     #define PPSSPP_ARCH_ARM64 1
55     #define PPSSPP_ARCH_64BIT 1
56     #define PPSSPP_ARCH_ARM_NEON 1
57 #endif
58 
59 #if defined(__mips64__)
60     #define PPSSPP_ARCH_MIPS64 1
61     #define PPSSPP_ARCH_64BIT 1
62 #elif defined(__mips__)
63     #define PPSSPP_ARCH_MIPS 1
64     #define PPSSPP_ARCH_32BIT 1
65 #endif
66 
67 #if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
68     //https://github.com/riscv/riscv-c-api-doc/blob/master/riscv-c-api.md
69     #define PPSSPP_ARCH_RISCV64 1
70     #define PPSSPP_ARCH_64BIT 1
71 #endif
72 
73 
74 // PLATFORM defines
75 #if defined(_WIN32)
76     // Covers both 32 and 64bit Windows
77     #define PPSSPP_PLATFORM_WINDOWS 1
78 	#ifdef _M_ARM
79         #define PPSSPP_ARCH_ARM_HARDFP 1
80 	#endif
81 	// UWP trickery
82     #if defined(WINAPI_FAMILY) && defined(WINAPI_FAMILY_PARTITION)
83         #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP
84             #define PPSSPP_PLATFORM_UWP 1
85         #endif
86     #endif
87 #elif defined(__APPLE__)
88     #include <TargetConditionals.h>
89     #if TARGET_IPHONE_SIMULATOR
90         #define PPSSPP_PLATFORM_IOS 1
91         #define PPSSPP_PLATFORM_IOS_SIMULATOR 1
92     #elif TARGET_OS_IPHONE
93         #define PPSSPP_PLATFORM_IOS 1
94     #elif TARGET_OS_MAC
95         #define PPSSPP_PLATFORM_MAC 1
96     #else
97         #error "Unknown Apple platform"
98     #endif
99 #elif defined(__SWITCH__)
100     #define PPSSPP_PLATFORM_SWITCH 1
101 #elif defined(__ANDROID__)
102     #define PPSSPP_PLATFORM_ANDROID 1
103     #define PPSSPP_PLATFORM_LINUX 1
104 #elif defined(__linux__)
105     #define PPSSPP_PLATFORM_LINUX 1
106 #endif
107 
108 // Windows ARM/ARM64, and Windows UWP (all), are the only platform that don't do GL at all (until Apple finally removes it)
109 #if !PPSSPP_PLATFORM(WINDOWS) || ((!PPSSPP_ARCH(ARM) && !PPSSPP_ARCH(ARM64)) && !PPSSPP_PLATFORM(UWP))
110 #define PPSSPP_API_ANY_GL 1
111 #endif
112 
113 #if PPSSPP_PLATFORM(WINDOWS)
114 #if !PPSSPP_PLATFORM(UWP)
115 #define PPSSPP_API_D3D9 1
116 #endif
117 #define PPSSPP_API_D3D11 1
118 #endif
119 
120