cmake: Detect features at compile time

Instead of relying on manually passed down flags from CMake,
we now have ppsspp_config.h file to create the platform defines for us.
This improves support for multiplatform builds (such as iOS).
This commit is contained in:
Florent Castelli 2016-10-12 17:32:52 +02:00
parent 912a58d6c8
commit 8c3552de74
70 changed files with 502 additions and 261 deletions

View file

@ -9,14 +9,6 @@ add_definitions(-DPPSSPP)
# None of these platforms support Vulkan yet. # None of these platforms support Vulkan yet.
add_definitions(-DNO_VULKAN) add_definitions(-DNO_VULKAN)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(_ARCH_64 1)
add_definitions(-D_ARCH_64=1)
else()
set(_ARCH_32 1)
add_definitions(-D_ARCH_32=1)
endif()
# Detect CPU from CMAKE configuration. Toolchains should set this up # Detect CPU from CMAKE configuration. Toolchains should set this up
if(CMAKE_SYSTEM_PROCESSOR) if(CMAKE_SYSTEM_PROCESSOR)
if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm")
@ -55,14 +47,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
set(ANDROID ON) set(ANDROID ON)
endif() endif()
if (X86 AND NOT MIPS)
if(_ARCH_64)
add_definitions(-D_M_X64)
else()
add_definitions(-D_M_IX86)
endif()
endif()
if(NOT DEFINED HEADLESS) if(NOT DEFINED HEADLESS)
set(HEADLESS OFF) set(HEADLESS OFF)
endif() endif()
@ -123,13 +107,6 @@ endif()
# Needed for Globals.h # Needed for Globals.h
include_directories("${CMAKE_SOURCE_DIR}") include_directories("${CMAKE_SOURCE_DIR}")
if(ARM)
add_definitions(-DARM)
endif()
if(MIPS)
add_definitions(-DMIPS)
endif()
if(USING_EGL) if(USING_EGL)
add_definitions(-DUSING_EGL) add_definitions(-DUSING_EGL)
endif() endif()
@ -172,6 +149,13 @@ if(NOT MSVC)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -D_NDEBUG") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -D_NDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG") set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -O2 -g -D_NDEBUG")
#TODO: Remove this and include the file properly everywhere it makes sense
# First step is too use the macros everywhere
# Second step is to remove the compatibility defines
# Third step is to include the file
# Fourth step is to remove that line!
add_compile_options(-include ${CMAKE_CURRENT_SOURCE_DIR}/ppsspp_config.h)
# Disable some warnings # Disable some warnings
add_definitions(-Wno-multichar) add_definitions(-Wno-multichar)
add_definitions(-fno-strict-aliasing) add_definitions(-fno-strict-aliasing)
@ -1036,74 +1020,72 @@ set(CoreExtra ${CoreExtra}
Core/MIPS/IR/IRRegCache.h Core/MIPS/IR/IRRegCache.h
) )
if(ARM) list(APPEND CoreExtra
set(CoreExtra ${CoreExtra} Core/MIPS/ARM/ArmAsm.cpp
Core/MIPS/ARM/ArmAsm.cpp Core/MIPS/ARM/ArmCompALU.cpp
Core/MIPS/ARM/ArmCompALU.cpp Core/MIPS/ARM/ArmCompBranch.cpp
Core/MIPS/ARM/ArmCompBranch.cpp Core/MIPS/ARM/ArmCompFPU.cpp
Core/MIPS/ARM/ArmCompFPU.cpp Core/MIPS/ARM/ArmCompLoadStore.cpp
Core/MIPS/ARM/ArmCompLoadStore.cpp Core/MIPS/ARM/ArmCompVFPU.cpp
Core/MIPS/ARM/ArmCompVFPU.cpp Core/MIPS/ARM/ArmCompVFPUNEON.cpp
Core/MIPS/ARM/ArmCompVFPUNEON.cpp Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp
Core/MIPS/ARM/ArmCompVFPUNEONUtil.cpp Core/MIPS/ARM/ArmCompReplace.cpp
Core/MIPS/ARM/ArmCompReplace.cpp Core/MIPS/ARM/ArmJit.cpp
Core/MIPS/ARM/ArmJit.cpp Core/MIPS/ARM/ArmJit.h
Core/MIPS/ARM/ArmJit.h Core/MIPS/ARM/ArmRegCache.cpp
Core/MIPS/ARM/ArmRegCache.cpp Core/MIPS/ARM/ArmRegCache.h
Core/MIPS/ARM/ArmRegCache.h Core/MIPS/ARM/ArmRegCacheFPU.cpp
Core/MIPS/ARM/ArmRegCacheFPU.cpp Core/MIPS/ARM/ArmRegCacheFPU.h
Core/MIPS/ARM/ArmRegCacheFPU.h GPU/Common/VertexDecoderArm.cpp
GPU/Common/VertexDecoderArm.cpp )
ext/disarm.cpp)
elseif(ARM64) list(APPEND CoreExtra
set(CoreExtra ${CoreExtra} Core/MIPS/ARM64/Arm64Asm.cpp
Core/MIPS/ARM64/Arm64Asm.cpp Core/MIPS/ARM64/Arm64CompALU.cpp
Core/MIPS/ARM64/Arm64CompALU.cpp Core/MIPS/ARM64/Arm64CompBranch.cpp
Core/MIPS/ARM64/Arm64CompBranch.cpp Core/MIPS/ARM64/Arm64CompFPU.cpp
Core/MIPS/ARM64/Arm64CompFPU.cpp Core/MIPS/ARM64/Arm64CompLoadStore.cpp
Core/MIPS/ARM64/Arm64CompLoadStore.cpp Core/MIPS/ARM64/Arm64CompVFPU.cpp
Core/MIPS/ARM64/Arm64CompVFPU.cpp Core/MIPS/ARM64/Arm64CompReplace.cpp
Core/MIPS/ARM64/Arm64CompReplace.cpp Core/MIPS/ARM64/Arm64Jit.cpp
Core/MIPS/ARM64/Arm64Jit.cpp Core/MIPS/ARM64/Arm64Jit.h
Core/MIPS/ARM64/Arm64Jit.h Core/MIPS/ARM64/Arm64RegCache.cpp
Core/MIPS/ARM64/Arm64RegCache.cpp Core/MIPS/ARM64/Arm64RegCache.h
Core/MIPS/ARM64/Arm64RegCache.h Core/MIPS/ARM64/Arm64RegCacheFPU.cpp
Core/MIPS/ARM64/Arm64RegCacheFPU.cpp Core/MIPS/ARM64/Arm64RegCacheFPU.h
Core/MIPS/ARM64/Arm64RegCacheFPU.h GPU/Common/VertexDecoderArm64.cpp
GPU/Common/VertexDecoderArm.cpp Core/Util/DisArm64.cpp)
Core/Util/DisArm64.cpp)
elseif(X86) list(APPEND CoreExtra
set(CoreExtra ${CoreExtra} Core/MIPS/x86/Asm.cpp
Core/MIPS/x86/Asm.cpp Core/MIPS/x86/CompALU.cpp
Core/MIPS/x86/CompALU.cpp Core/MIPS/x86/CompBranch.cpp
Core/MIPS/x86/CompBranch.cpp Core/MIPS/x86/CompFPU.cpp
Core/MIPS/x86/CompFPU.cpp Core/MIPS/x86/CompLoadStore.cpp
Core/MIPS/x86/CompLoadStore.cpp Core/MIPS/x86/CompVFPU.cpp
Core/MIPS/x86/CompVFPU.cpp Core/MIPS/x86/CompReplace.cpp
Core/MIPS/x86/CompReplace.cpp Core/MIPS/x86/Jit.cpp
Core/MIPS/x86/Jit.cpp Core/MIPS/x86/Jit.h
Core/MIPS/x86/Jit.h Core/MIPS/x86/JitSafeMem.cpp
Core/MIPS/x86/JitSafeMem.cpp Core/MIPS/x86/JitSafeMem.h
Core/MIPS/x86/JitSafeMem.h Core/MIPS/x86/RegCache.cpp
Core/MIPS/x86/RegCache.cpp Core/MIPS/x86/RegCache.h
Core/MIPS/x86/RegCache.h Core/MIPS/x86/RegCacheFPU.cpp
Core/MIPS/x86/RegCacheFPU.cpp Core/MIPS/x86/RegCacheFPU.h
Core/MIPS/x86/RegCacheFPU.h GPU/Common/VertexDecoderX86.cpp
GPU/Common/VertexDecoderX86.cpp )
ext/disarm.cpp)
elseif(MIPS) list(APPEND CoreExtra
set(CoreExtra ${CoreExtra} Core/MIPS/MIPS/MipsJit.cpp
Core/MIPS/MIPS/MipsJit.cpp Core/MIPS/MIPS/MipsJit.h
Core/MIPS/MIPS/MipsJit.h GPU/Common/VertexDecoderFake.cpp
GPU/Common/VertexDecoderFake.cpp )
ext/disarm.cpp)
else() #list(APPEND CoreExtra
set(CoreExtra ${CoreExtra} # Core/MIPS/fake/FakeJit.cpp
Core/MIPS/fake/FakeJit.cpp # Core/MIPS/fake/FakeJit.h
Core/MIPS/fake/FakeJit.h # GPU/Common/VertexDecoderFake.cpp
GPU/Common/VertexDecoderFake.cpp #)
ext/disarm.cpp)
endif()
if (NOT MOBILE_DEVICE) if (NOT MOBILE_DEVICE)
set(CoreExtra ${CoreExtra} set(CoreExtra ${CoreExtra}
@ -1506,7 +1488,9 @@ add_library(${CoreLibName} ${CoreLinkType}
${CORE_NEON} ${CORE_NEON}
${GPU_SOURCES} ${GPU_SOURCES}
Globals.h Globals.h
git-version.cpp) git-version.cpp
ext/disarm.cpp
)
target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash target_link_libraries(${CoreLibName} Common native kirk cityhash sfmt19937 xbrz xxhash
${CoreExtraLibs} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS}) ${CoreExtraLibs} ${GLEW_LIBRARIES} ${OPENGL_LIBRARIES} ${X11_LIBRARIES} ${CMAKE_DL_LIBS})
setup_target_project(${CoreLibName} Core) setup_target_project(${CoreLibName} Core)

View file

@ -15,7 +15,8 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#if defined(__arm__) || defined(__aarch64__) #include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)
#include <ctype.h> #include <ctype.h>
#include "Common.h" #include "Common.h"
@ -24,7 +25,7 @@
#include "FileUtil.h" #include "FileUtil.h"
// Only Linux platforms have /proc/cpuinfo // Only Linux platforms have /proc/cpuinfo
#if defined(__linux__) #if PPSSPP_PLATFORM(LINUX)
const char procfile[] = "/proc/cpuinfo"; const char procfile[] = "/proc/cpuinfo";
// https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu // https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-devices-system-cpu
const char syscpupresentfile[] = "/sys/devices/system/cpu/present"; const char syscpupresentfile[] = "/sys/devices/system/cpu/present";
@ -184,7 +185,7 @@ void CPUInfo::Detect()
{ {
// Set some defaults here // Set some defaults here
HTT = false; HTT = false;
#ifdef ARM64 #if PPSSPP_ARCH(ARM64)
OS64bit = true; OS64bit = true;
CPU64bit = true; CPU64bit = true;
Mode64bit = true; Mode64bit = true;
@ -196,10 +197,10 @@ void CPUInfo::Detect()
vendor = VENDOR_ARM; vendor = VENDOR_ARM;
// Get the information about the CPU // Get the information about the CPU
#if !defined(__linux__) #if !PPSSPP_PLATFORM(LINUX)
bool isVFP3 = false; bool isVFP3 = false;
bool isVFP4 = false; bool isVFP4 = false;
#ifdef IOS #if PPSSPP_PLATFORM(IOS)
isVFP3 = true; isVFP3 = true;
// Check for swift arch (VFP4) // Check for swift arch (VFP4)
#ifdef __ARM_ARCH_7S__ #ifdef __ARM_ARCH_7S__
@ -207,7 +208,7 @@ void CPUInfo::Detect()
#endif #endif
strcpy(brand_string, "Apple A"); strcpy(brand_string, "Apple A");
num_cores = 2; num_cores = 2;
#else #else // !PPSSPP_PLATFORM(IOS)
strcpy(brand_string, "Unknown"); strcpy(brand_string, "Unknown");
num_cores = 1; num_cores = 1;
#endif #endif
@ -228,7 +229,7 @@ void CPUInfo::Detect()
bIDIVt = isVFP4; bIDIVt = isVFP4;
bFP = false; bFP = false;
bASIMD = false; bASIMD = false;
#else // __linux__ #else // PPSSPP_PLATFORM(LINUX)
strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string)); strncpy(cpu_string, GetCPUString().c_str(), sizeof(cpu_string));
strncpy(brand_string, GetCPUBrandString().c_str(), sizeof(brand_string)); strncpy(brand_string, GetCPUBrandString().c_str(), sizeof(brand_string));
@ -254,7 +255,7 @@ void CPUInfo::Detect()
bASIMD = CheckCPUFeature("asimd"); bASIMD = CheckCPUFeature("asimd");
num_cores = GetCoreCount(); num_cores = GetCoreCount();
#endif #endif
#ifdef ARM64 #if PPSSPP_ARCH(ARM64)
// Whether the above detection failed or not, on ARM64 we do have ASIMD/NEON. // Whether the above detection failed or not, on ARM64 we do have ASIMD/NEON.
bNEON = true; bNEON = true;
bASIMD = true; bASIMD = true;
@ -287,4 +288,4 @@ std::string CPUInfo::Summarize()
return sum; return sum;
} }
#endif // defined(__arm__) || defined(__aarch64__) #endif // PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)

View file

@ -268,7 +268,7 @@ bool ARMXEmitter::TryANDI2R(ARMReg rd, ARMReg rs, u32 val)
} }
return true; return true;
} else { } else {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
// Check if we have a single pattern of sequential bits. // Check if we have a single pattern of sequential bits.
int seq = -1; int seq = -1;
for (int i = 0; i < 32; ++i) { for (int i = 0; i < 32; ++i) {
@ -300,7 +300,7 @@ bool ARMXEmitter::TryANDI2R(ARMReg rd, ARMReg rs, u32 val)
} }
// The worst case is 4 (e.g. 0x55555555.) // The worst case is 4 (e.g. 0x55555555.)
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
if (ops > 3) { if (ops > 3) {
return false; return false;
} }
@ -401,7 +401,7 @@ bool ARMXEmitter::TryORI2R(ARMReg rd, ARMReg rs, u32 val)
bool inversed; bool inversed;
if (TryMakeOperand2_AllowInverse(val, op2, &inversed) && ops >= 3) { if (TryMakeOperand2_AllowInverse(val, op2, &inversed) && ops >= 3) {
return false; return false;
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
} else if (ops > 3) { } else if (ops > 3) {
return false; return false;
#endif #endif
@ -488,7 +488,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
Operand2 op2; Operand2 op2;
bool inverse; bool inverse;
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
// Unused // Unused
if (!optimize) if (!optimize)
{ {
@ -502,7 +502,7 @@ void ARMXEmitter::MOVI2R(ARMReg reg, u32 val, bool optimize)
if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) { if (TryMakeOperand2_AllowInverse(val, op2, &inverse)) {
inverse ? MVN(reg, op2) : MOV(reg, op2); inverse ? MVN(reg, op2) : MOV(reg, op2);
} else { } else {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
// Use MOVW+MOVT for ARMv7+ // Use MOVW+MOVT for ARMv7+
MOVW(reg, val & 0xFFFF); MOVW(reg, val & 0xFFFF);
if(val & 0xFFFF0000) if(val & 0xFFFF0000)

View file

@ -18,11 +18,7 @@
// Detect the cpu, so we'll know which optimizations to use // Detect the cpu, so we'll know which optimizations to use
#pragma once #pragma once
// Every architecture has its own define. This needs to be added to. #include "ppsspp_config.h"
#if defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7S__)
#define HAVE_ARMV7 1
#endif
#include <string> #include <string>
enum CPUVendor { enum CPUVendor {

View file

@ -643,7 +643,7 @@ Convert16bppTo16bppFunc ConvertRGB565ToBGR565 = &ConvertRGB565ToBGR565Basic;
#endif #endif
void SetupColorConv() { void SetupColorConv() {
#if defined(HAVE_ARMV7) && !defined(ARM64) #if PPSSPP_ARCH(ARMV7) && PPSSPP_ARCH(ARM_NEON)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
ConvertRGBA4444ToABGR4444 = &ConvertRGBA4444ToABGR4444NEON; ConvertRGBA4444ToABGR4444 = &ConvertRGBA4444ToABGR4444NEON;
ConvertRGBA5551ToABGR1555 = &ConvertRGBA5551ToABGR1555NEON; ConvertRGBA5551ToABGR1555 = &ConvertRGBA5551ToABGR1555NEON;

View file

@ -15,7 +15,8 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#if defined(__arm__) || defined(__aarch64__) #include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)
#include <arm_neon.h> #include <arm_neon.h>
#include "ColorConvNEON.h" #include "ColorConvNEON.h"
@ -108,4 +109,4 @@ void ConvertRGB565ToBGR565NEON(u16 *dst, const u16 *src, const u32 numPixels) {
} }
} }
#endif // defined(__arm__) || defined(__aarch64__) #endif // PPSSPP_ARCH(ARM) || PPSSPP_ARCH(ARM64)

View file

@ -27,12 +27,6 @@
#pragma warning (disable:4100) #pragma warning (disable:4100)
#endif #endif
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
// Force enable logging in the right modes. For some reason, something had changed // Force enable logging in the right modes. For some reason, something had changed
// so that debugfast no longer logged. // so that debugfast no longer logged.
#if defined(_DEBUG) || defined(DEBUGFAST) #if defined(_DEBUG) || defined(DEBUGFAST)

View file

@ -22,12 +22,6 @@
#pragma once #pragma once
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
struct u24_be { struct u24_be {
unsigned char value[3]; unsigned char value[3];

View file

@ -19,12 +19,6 @@
#include "MsgHandler.h" #include "MsgHandler.h"
#ifdef __arm__
#if !defined(ARM)
#define ARM
#endif
#endif
#define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and debugprintfs from the game itself. #define NOTICE_LEVEL 1 // VERY important information that is NOT errors. Like startup and debugprintfs from the game itself.
#define ERROR_LEVEL 2 // Important errors. #define ERROR_LEVEL 2 // Important errors.
#define WARNING_LEVEL 3 // Something is suspicious. #define WARNING_LEVEL 3 // Something is suspicious.

View file

@ -158,7 +158,7 @@ void CPUInfo::Detect()
{ {
// Set some defaults here // Set some defaults here
HTT = false; HTT = false;
#ifdef _ARCH_64 #ifdef PPSSPP_ARCH(MIPS64)
OS64bit = true; OS64bit = true;
CPU64bit = true; CPU64bit = true;
Mode64bit = true; Mode64bit = true;

View file

@ -18,14 +18,12 @@
#ifndef _DOLPHIN_INTEL_CODEGEN_ #ifndef _DOLPHIN_INTEL_CODEGEN_
#define _DOLPHIN_INTEL_CODEGEN_ #define _DOLPHIN_INTEL_CODEGEN_
#include "ppsspp_config.h"
#include "Common.h" #include "Common.h"
#include "CodeBlock.h" #include "CodeBlock.h"
#if defined(_M_X64) && !defined(_ARCH_64) #if PPSSPP_ARCH(64BIT)
#define _ARCH_64
#endif
#ifdef _ARCH_64
#define PTRBITS 64 #define PTRBITS 64
#else #else
#define PTRBITS 32 #define PTRBITS 32
@ -275,6 +273,12 @@ inline OpArg Imm8 (u8 imm) {return OpArg(imm, SCALE_IMM8);}
inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used inline OpArg Imm16(u16 imm) {return OpArg(imm, SCALE_IMM16);} //rarely used
inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);} inline OpArg Imm32(u32 imm) {return OpArg(imm, SCALE_IMM32);}
inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);} inline OpArg Imm64(u64 imm) {return OpArg(imm, SCALE_IMM64);}
template<int N> OpArg ImmPtrTpl(const void *imm);
template<> inline OpArg ImmPtrTpl<8>(const void *imm) {return Imm64((u64)imm);}
template<> inline OpArg ImmPtrTpl<4>(const void *imm) {return Imm32((u32)(uintptr_t)imm);}
inline OpArg ImmPtr(const void* imm) {return ImmPtrTpl<sizeof(void*)>(imm);}
inline OpArg UImmAuto(u32 imm) { inline OpArg UImmAuto(u32 imm) {
return OpArg(imm, imm >= 128 ? SCALE_IMM32 : SCALE_IMM8); return OpArg(imm, imm >= 128 ? SCALE_IMM32 : SCALE_IMM8);
} }
@ -282,15 +286,8 @@ inline OpArg SImmAuto(s32 imm) {
return OpArg(imm, (imm >= 128 || imm < -128) ? SCALE_IMM32 : SCALE_IMM8); return OpArg(imm, (imm >= 128 || imm < -128) ? SCALE_IMM32 : SCALE_IMM8);
} }
#ifdef _ARCH_64 template<int N> u32 PtrOffsetTpl(const void* ptr, const void* base);
inline OpArg ImmPtr(const void* imm) {return Imm64((u64)imm);} template<> inline u32 PtrOffsetTpl<8>(const void *ptr, const void* base) {
#else
inline OpArg ImmPtr(const void* imm) {return Imm32((u32)imm);}
#endif
inline u32 PtrOffset(const void* ptr, const void* base)
{
#ifdef _ARCH_64
s64 distance = (s64)ptr-(s64)base; s64 distance = (s64)ptr-(s64)base;
if (distance >= 0x80000000LL || if (distance >= 0x80000000LL ||
distance < -0x80000000LL) distance < -0x80000000LL)
@ -300,9 +297,12 @@ inline u32 PtrOffset(const void* ptr, const void* base)
} }
return (u32)distance; return (u32)distance;
#else }
return (u32)ptr-(u32)base; template<> inline u32 PtrOffsetTpl<4>(const void *ptr, const void* base) {
#endif return (u32)(uintptr_t)ptr-(u32)(uintptr_t)base;
}
inline u32 PtrOffset(const void* ptr, const void* base) {
return PtrOffsetTpl<sizeof(void*)>(ptr, base);
} }
//usage: int a[]; ARRAY_OFFSET(a,10) //usage: int a[]; ARRAY_OFFSET(a,10)

View file

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
@ -190,7 +192,7 @@ void ArmJit::GenerateFixedCode() {
// IMPORTANT - We jump on negative, not carry!!! // IMPORTANT - We jump on negative, not carry!!!
FixupBranch bailCoreState = B_CC(CC_MI); FixupBranch bailCoreState = B_CC(CC_MI);
MOVI2R(R0, (u32)&coreState); MOVI2R(R0, (u32)(uintptr_t)&coreState);
LDR(R0, R0); LDR(R0, R0);
CMP(R0, 0); CMP(R0, 0);
FixupBranch badCoreState = B_CC(CC_NEQ); FixupBranch badCoreState = B_CC(CC_NEQ);
@ -231,7 +233,7 @@ void ArmJit::GenerateFixedCode() {
// LDR(R0, R9, R0); here, replacing the next instructions. // LDR(R0, R9, R0); here, replacing the next instructions.
#ifdef IOS #ifdef IOS
// On iOS, R9 (JITBASEREG) is volatile. We have to reload it. // On iOS, R9 (JITBASEREG) is volatile. We have to reload it.
MOVI2R(JITBASEREG, (u32)GetBasePtr()); MOVI2R(JITBASEREG, (u32)(uintptr_t)GetBasePtr());
#endif #endif
ADD(R0, R0, JITBASEREG); ADD(R0, R0, JITBASEREG);
B(R0); B(R0);
@ -249,7 +251,7 @@ void ArmJit::GenerateFixedCode() {
SetJumpTarget(bail); SetJumpTarget(bail);
SetJumpTarget(bailCoreState); SetJumpTarget(bailCoreState);
MOVI2R(R0, (u32)&coreState); MOVI2R(R0, (u32)(uintptr_t)&coreState);
LDR(R0, R0); LDR(R0, R0);
CMP(R0, 0); CMP(R0, 0);
B_CC(CC_EQ, outerLoop); B_CC(CC_EQ, outerLoop);
@ -287,3 +289,5 @@ void ArmJit::GenerateFixedCode() {
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include <algorithm> #include <algorithm>
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
#include "Core/MIPS/MIPSCodeUtils.h" #include "Core/MIPS/MIPSCodeUtils.h"
@ -547,7 +550,7 @@ namespace MIPSComp
} }
gpr.MapDirtyIn(rt, rs); gpr.MapDirtyIn(rt, rs);
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
UBFX(gpr.R(rt), gpr.R(rs), pos, size); UBFX(gpr.R(rt), gpr.R(rs), pos, size);
#else #else
MOV(gpr.R(rt), Operand2(gpr.R(rs), ST_LSR, pos)); MOV(gpr.R(rt), Operand2(gpr.R(rs), ST_LSR, pos));
@ -573,7 +576,7 @@ namespace MIPSComp
} }
} else { } else {
gpr.MapDirtyIn(rt, rs, false); gpr.MapDirtyIn(rt, rs, false);
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
BFI(gpr.R(rt), gpr.R(rs), pos, size - pos); BFI(gpr.R(rt), gpr.R(rs), pos, size - pos);
#else #else
ANDI2R(SCRATCHREG1, gpr.R(rs), sourcemask, SCRATCHREG2); ANDI2R(SCRATCHREG1, gpr.R(rs), sourcemask, SCRATCHREG2);
@ -627,7 +630,7 @@ namespace MIPSComp
return; return;
} }
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
gpr.MapDirtyIn(rd, rt); gpr.MapDirtyIn(rd, rt);
RBIT(gpr.R(rd), gpr.R(rt)); RBIT(gpr.R(rd), gpr.R(rt));
#else #else
@ -882,3 +885,5 @@ namespace MIPSComp
} }
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
@ -642,3 +645,5 @@ void ArmJit::Comp_Break(MIPSOpcode op)
} }
} // namespace Mipscomp } // namespace Mipscomp
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
@ -381,7 +384,7 @@ void ArmJit::Comp_mxc1(MIPSOpcode op)
} else { } else {
gpr.MapDirtyIn(rt, MIPS_REG_FPCOND); gpr.MapDirtyIn(rt, MIPS_REG_FPCOND);
LDR(gpr.R(rt), CTXREG, offsetof(MIPSState, fcr31)); LDR(gpr.R(rt), CTXREG, offsetof(MIPSState, fcr31));
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
BFI(gpr.R(rt), gpr.R(MIPS_REG_FPCOND), 23, 1); BFI(gpr.R(rt), gpr.R(MIPS_REG_FPCOND), 23, 1);
#else #else
AND(SCRATCHREG1, gpr.R(MIPS_REG_FPCOND), Operand2(1)); // Just in case AND(SCRATCHREG1, gpr.R(MIPS_REG_FPCOND), Operand2(1)); // Just in case
@ -424,7 +427,7 @@ void ArmJit::Comp_mxc1(MIPSOpcode op)
// TODO: Technically, should mask by 0x0181FFFF. Maybe just put all of FCR31 in the reg? // TODO: Technically, should mask by 0x0181FFFF. Maybe just put all of FCR31 in the reg?
STR(gpr.R(rt), CTXREG, offsetof(MIPSState, fcr31)); STR(gpr.R(rt), CTXREG, offsetof(MIPSState, fcr31));
if (!wasImm) { if (!wasImm) {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
UBFX(gpr.R(MIPS_REG_FPCOND), gpr.R(rt), 23, 1); UBFX(gpr.R(MIPS_REG_FPCOND), gpr.R(rt), 23, 1);
#else #else
MOV(SCRATCHREG1, Operand2(gpr.R(rt), ST_LSR, 23)); MOV(SCRATCHREG1, Operand2(gpr.R(rt), ST_LSR, 23));
@ -441,3 +444,5 @@ void ArmJit::Comp_mxc1(MIPSOpcode op)
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM)

View file

@ -36,6 +36,8 @@
// Also, if we kept track of the likely register content of a cached register, // Also, if we kept track of the likely register content of a cached register,
// (pointer or data), we could avoid many BIC instructions. // (pointer or data), we could avoid many BIC instructions.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -427,3 +429,5 @@ namespace MIPSComp
} }
} }
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/JitCommon/JitCommon.h" #include "Core/MIPS/JitCommon/JitCommon.h"
@ -29,4 +32,6 @@ int ArmJit::Replace_fabsf() {
return 4; // Number of instructions in the MIPS function return 4; // Number of instructions in the MIPS function
} }
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include <cmath> #include <cmath>
#include "math/math_util.h" #include "math/math_util.h"
@ -2323,3 +2326,5 @@ namespace MIPSComp
DISABLE; DISABLE;
} }
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -25,7 +25,8 @@
// are below Q8 (D16, S32) using regular VFP instructions but really not sure // are below Q8 (D16, S32) using regular VFP instructions but really not sure
// if it's worth it. // if it's worth it.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include <cmath> #include <cmath>
@ -1451,4 +1452,6 @@ void ArmJit::CompNEON_Vbfy(MIPSOpcode op) {
} }
} }
// namespace MIPSComp // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM)

View file

@ -25,6 +25,9 @@
// are below Q8 (D16, S32) using regular VFP instructions but really not sure // are below Q8 (D16, S32) using regular VFP instructions but really not sure
// if it's worth it. // if it's worth it.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include <cmath> #include <cmath>
#include "base/logging.h" #include "base/logging.h"
@ -414,4 +417,6 @@ void ArmJit::NEONTranspose4x4(ARMReg cols[4]) {
VSWP(D_1(cols[1]), D_0(cols[3])); VSWP(D_1(cols[1]), D_0(cols[3]));
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "base/logging.h" #include "base/logging.h"
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
@ -317,7 +320,7 @@ const u8 *ArmJit::DoJit(u32 em_address, JitBlock *b)
js.compilerPC += 4; js.compilerPC += 4;
js.numInstructions++; js.numInstructions++;
#ifndef HAVE_ARMV7 #if !PPSSPP_ARCH(ARMV7)
if ((GetCodePtr() - b->checkedEntry - partialFlushOffset) > 3200) if ((GetCodePtr() - b->checkedEntry - partialFlushOffset) > 3200)
{ {
// We need to prematurely flush as we are out of range // We need to prematurely flush as we are out of range
@ -705,3 +708,5 @@ MIPSOpcode ArmJit::GetOriginalOp(MIPSOpcode op) {
} }
} // namespace } // namespace
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/ARM/ArmRegCache.h" #include "Core/MIPS/ARM/ArmRegCache.h"
#include "Core/MIPS/ARM/ArmJit.h" #include "Core/MIPS/ARM/ArmJit.h"
@ -632,3 +635,4 @@ ARMReg ArmRegCache::RPtr(MIPSGPReg mipsReg) {
} }
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "base/logging.h" #include "base/logging.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
@ -324,3 +327,5 @@ void Arm64Jit::GenerateFixedCode(const JitOptions &jo) {
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include <algorithm> #include <algorithm>
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
@ -721,3 +724,5 @@ void Arm64Jit::Comp_MulDivType(MIPSOpcode op) {
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
@ -622,3 +625,5 @@ void Arm64Jit::Comp_Break(MIPSOpcode op)
} }
} // namespace Mipscomp } // namespace Mipscomp
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
@ -400,3 +403,5 @@ void Arm64Jit::Comp_mxc1(MIPSOpcode op)
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(ARM64)

View file

@ -36,6 +36,8 @@
// Also, if we kept track of the likely register content of a cached register, // Also, if we kept track of the likely register content of a cached register,
// (pointer or data), we could avoid many BIC instructions. // (pointer or data), we could avoid many BIC instructions.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -468,3 +470,5 @@ namespace MIPSComp {
} }
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/JitCommon/JitCommon.h" #include "Core/MIPS/JitCommon/JitCommon.h"
@ -29,4 +32,6 @@ int Arm64Jit::Replace_fabsf() {
return 4; // Number of instructions in the MIPS function return 4; // Number of instructions in the MIPS function
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include <cmath> #include <cmath>
#include "math/math_util.h" #include "math/math_util.h"
@ -1977,3 +1980,5 @@ namespace MIPSComp {
DISABLE; DISABLE;
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "base/logging.h" #include "base/logging.h"
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
@ -663,3 +666,5 @@ MIPSOpcode Arm64Jit::GetOriginalOp(MIPSOpcode op) {
} }
} // namespace } // namespace
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include "base/logging.h" #include "base/logging.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/ARM64/Arm64RegCache.h" #include "Core/MIPS/ARM64/Arm64RegCache.h"
@ -802,3 +805,5 @@ ARM64Reg Arm64RegCache::RPtr(MIPSGPReg mipsReg) {
return INVALID_REG; // BAAAD return INVALID_REG; // BAAAD
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
#include <cstring> #include <cstring>
#include "base/logging.h" #include "base/logging.h"
@ -526,3 +529,5 @@ ARM64Reg Arm64RegCacheFPU::R(int mipsReg) {
return INVALID_REG; // BAAAD return INVALID_REG; // BAAAD
} }
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -28,13 +28,13 @@
#include "Core/MIPS/JitCommon/JitState.h" #include "Core/MIPS/JitCommon/JitState.h"
#include "Core/MIPS/IR/IRJit.h" #include "Core/MIPS/IR/IRJit.h"
#if defined(ARM) #if PPSSPP_ARCH(ARM)
#include "../ARM/ArmJit.h" #include "../ARM/ArmJit.h"
#elif defined(ARM64) #elif PPSSPP_ARCH(ARM64)
#include "../ARM64/Arm64Jit.h" #include "../ARM64/Arm64Jit.h"
#elif defined(_M_IX86) || defined(_M_X64) #elif PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "../x86/Jit.h" #include "../x86/Jit.h"
#elif defined(MIPS) #elif PPSSPP_ARCH(MIPS)
#include "../MIPS/MipsJit.h" #include "../MIPS/MipsJit.h"
#else #else
#include "../fake/FakeJit.h" #include "../fake/FakeJit.h"
@ -47,13 +47,13 @@ namespace MIPSComp {
} }
JitInterface *CreateNativeJit(MIPSState *mips) { JitInterface *CreateNativeJit(MIPSState *mips) {
#if defined(ARM) #if PPSSPP_ARCH(ARM)
return new MIPSComp::ArmJit(mips); return new MIPSComp::ArmJit(mips);
#elif defined(ARM64) #elif PPSSPP_ARCH(ARM64)
return new MIPSComp::Arm64Jit(mips); return new MIPSComp::Arm64Jit(mips);
#elif defined(_M_IX86) || defined(_M_X64) #elif PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
return new MIPSComp::Jit(mips); return new MIPSComp::Jit(mips);
#elif defined(MIPS) #elif PPSSPP_ARCH(MIPS)
return new MIPSComp::MipsJit(mips); return new MIPSComp::MipsJit(mips);
#else #else
return new MIPSComp::FakeJit(mips); return new MIPSComp::FakeJit(mips);
@ -61,11 +61,11 @@ namespace MIPSComp {
} }
} }
#if (defined(_M_IX86) || defined(_M_X64)) && defined(_WIN32) #if PPSSPP_PLATFORM(WINDOWS)
#define DISASM_ALL 1 #define DISASM_ALL 1
#endif #endif
#if defined(ARM) || defined(DISASM_ALL) #if PPSSPP_ARCH(ARM) || defined(DISASM_ALL)
// We compile this for x86 as well because it may be useful when developing the ARM JIT on a PC. // We compile this for x86 as well because it may be useful when developing the ARM JIT on a PC.
std::vector<std::string> DisassembleArm2(const u8 *data, int size) { std::vector<std::string> DisassembleArm2(const u8 *data, int size) {
std::vector<std::string> lines; std::vector<std::string> lines;
@ -114,7 +114,7 @@ std::string AddAddress(const std::string &buf, uint64_t addr) {
return std::string(buf2) + " " + buf; return std::string(buf2) + " " + buf;
} }
#if defined(ARM64) || defined(DISASM_ALL) #if PPSSPP_ARCH(ARM64) || defined(DISASM_ALL)
static bool Arm64SymbolCallback(char *buffer, int bufsize, uint8_t *address) { static bool Arm64SymbolCallback(char *buffer, int bufsize, uint8_t *address) {
if (MIPSComp::jit) { if (MIPSComp::jit) {
@ -173,7 +173,7 @@ std::vector<std::string> DisassembleArm64(const u8 *data, int size) {
} }
#endif #endif
#if defined(_M_IX86) || defined(_M_X64) #if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
const char *ppsspp_resolver(struct ud*, const char *ppsspp_resolver(struct ud*,
uint64_t addr, uint64_t addr,
@ -220,11 +220,7 @@ std::vector<std::string> DisassembleX86(const u8 *data, int size) {
std::vector<std::string> lines; std::vector<std::string> lines;
ud_t ud_obj; ud_t ud_obj;
ud_init(&ud_obj); ud_init(&ud_obj);
#ifdef _M_X64 ud_set_mode(&ud_obj, sizeof(void*) * 8);
ud_set_mode(&ud_obj, 64);
#else
ud_set_mode(&ud_obj, 32);
#endif
ud_set_pc(&ud_obj, (intptr_t)data); ud_set_pc(&ud_obj, (intptr_t)data);
ud_set_vendor(&ud_obj, UD_VENDOR_ANY); ud_set_vendor(&ud_obj, UD_VENDOR_ANY);
ud_set_syntax(&ud_obj, UD_SYN_INTEL); ud_set_syntax(&ud_obj, UD_SYN_INTEL);

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(MIPS)
#include "base/logging.h" #include "base/logging.h"
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Common/ChunkFile.h" #include "Common/ChunkFile.h"
@ -358,3 +361,5 @@ void MipsJit::WriteSyscallExit()
// mov dreg, [eax+offreg] // mov dreg, [eax+offreg]
} }
#endif // PPSSPP_ARCH(MIPS)

View file

@ -15,6 +15,9 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "math/math_util.h" #include "math/math_util.h"
#include "ABI.h" #include "ABI.h"
@ -223,4 +226,6 @@ void Jit::GenerateFixedCode(JitOptions &jo) {
EndWrite(); EndWrite();
} }
} // namespace } // namespace
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/MIPS/MIPSCodeUtils.h" #include "Core/MIPS/MIPSCodeUtils.h"
#include "Core/MIPS/x86/Jit.h" #include "Core/MIPS/x86/Jit.h"
#include "Core/MIPS/x86/RegCache.h" #include "Core/MIPS/x86/RegCache.h"
@ -1123,4 +1126,6 @@ namespace MIPSComp
DISABLE; DISABLE;
} }
} }
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
@ -805,3 +808,5 @@ void Jit::Comp_Break(MIPSOpcode op)
} }
} // namespace Mipscomp } // namespace Mipscomp
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Common/Common.h" #include "Common/Common.h"
@ -451,3 +454,5 @@ void Jit::Comp_mxc1(MIPSOpcode op) {
} }
} // namespace MIPSComp } // namespace MIPSComp
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/MIPSAnalyst.h" #include "Core/MIPS/MIPSAnalyst.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -402,3 +405,5 @@ namespace MIPSComp {
DISABLE; DISABLE;
} }
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/MIPS/JitCommon/JitCommon.h" #include "Core/MIPS/JitCommon/JitCommon.h"
#include "Core/MIPS/x86/RegCache.h" #include "Core/MIPS/x86/RegCache.h"
@ -35,3 +38,5 @@ int Jit::Replace_fabsf() {
} }
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <xmmintrin.h> #include <xmmintrin.h>
@ -3543,3 +3546,5 @@ void Jit::Comp_ColorConv(MIPSOpcode op) {
} }
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -1,3 +1,6 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/MIPS/x86/IRToX86.h" #include "Core/MIPS/x86/IRToX86.h"
namespace MIPSComp { namespace MIPSComp {
@ -291,4 +294,6 @@ void IRToX86::ConvertIRToNative(const IRInst *instructions, int count, const u32
} }
} // namespace } // namespace
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <algorithm> #include <algorithm>
#include <iterator> #include <iterator>
@ -860,3 +863,5 @@ MIPSOpcode Jit::GetOriginalOp(MIPSOpcode op) {
} }
} // namespace } // namespace
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -21,10 +21,6 @@
#include "Common/Thunk.h" #include "Common/Thunk.h"
#include "Common/x64Emitter.h" #include "Common/x64Emitter.h"
#if defined(ARM)
#error DO NOT BUILD X86 JIT ON ARM
#endif
#include "Common/x64Emitter.h" #include "Common/x64Emitter.h"
#include "Core/MIPS/JitCommon/JitBlockCache.h" #include "Core/MIPS/JitCommon/JitBlockCache.h"
#include "Core/MIPS/JitCommon/JitState.h" #include "Core/MIPS/JitCommon/JitState.h"

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/Breakpoints.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
@ -529,3 +532,5 @@ void JitSafeMemFuncs::StartDirectAccess() {
} }
}; };
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <cstring> #include <cstring>
#include "Common/x64Emitter.h" #include "Common/x64Emitter.h"
@ -441,3 +444,5 @@ void GPRRegCache::RestoreState(const GPRRegCacheState& state) {
memcpy(regs, state.regs, sizeof(regs)); memcpy(regs, state.regs, sizeof(regs));
memcpy(xregs, state.xregs, sizeof(xregs)); memcpy(xregs, state.xregs, sizeof(xregs));
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <cstring> #include <cstring>
#include <xmmintrin.h> #include <xmmintrin.h>
@ -1101,3 +1104,5 @@ void FPURegCache::RestoreState(const FPURegCacheState& state) {
memcpy(xregs, state.xregs, sizeof(xregs)); memcpy(xregs, state.xregs, sizeof(xregs));
pendingFlush = true; pendingFlush = true;
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -17,6 +17,7 @@
#include <algorithm> #include <algorithm>
#include "ppsspp_config.h"
#include "base/mutex.h" #include "base/mutex.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
@ -118,7 +119,7 @@ static MemoryView views[] =
static const int num_views = sizeof(views) / sizeof(MemoryView); static const int num_views = sizeof(views) / sizeof(MemoryView);
inline static bool CanIgnoreView(const MemoryView &view) { inline static bool CanIgnoreView(const MemoryView &view) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
// Basically, 32-bit platforms can ignore views that are masked out anyway. // Basically, 32-bit platforms can ignore views that are masked out anyway.
return (view.flags & MV_MIRROR_PREVIOUS) && (view.virtual_address & ~MEMVIEW32_MASK) != 0; return (view.flags & MV_MIRROR_PREVIOUS) && (view.virtual_address & ~MEMVIEW32_MASK) != 0;
#else #else
@ -175,7 +176,7 @@ static bool Memory_TryBase(u32 flags) {
if (!*view.out_ptr_low) if (!*view.out_ptr_low)
goto bail; goto bail;
} }
#if defined(_ARCH_64) #if PPSSPP_ARCH(64BIT)
*view.out_ptr = (u8*)g_arena.CreateView( *view.out_ptr = (u8*)g_arena.CreateView(
position, view.size, base + view.virtual_address); position, view.size, base + view.virtual_address);
#else #else

View file

@ -17,6 +17,8 @@
#pragma once #pragma once
#include "ppsspp_config.h"
#include <cstring> #include <cstring>
#ifndef offsetof #ifndef offsetof
#include <stddef.h> #include <stddef.h>
@ -27,10 +29,6 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/Opcode.h" #include "Core/Opcode.h"
#if defined(_M_IX86) && !defined(_ARCH_32)
#error Make sure _ARCH_32 is defined correctly.
#endif
// PPSSPP is very aggressive about trying to do memory accesses directly, for speed. // PPSSPP is very aggressive about trying to do memory accesses directly, for speed.
// This can be a problem when debugging though, as stray memory reads and writes will // This can be a problem when debugging though, as stray memory reads and writes will
// crash the whole emulator. // crash the whole emulator.
@ -94,7 +92,7 @@ enum
SCRATCHPAD_SIZE = 0x00004000, SCRATCHPAD_SIZE = 0x00004000,
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
// This wraparound should work for PSP too. // This wraparound should work for PSP too.
MEMVIEW32_MASK = 0x3FFFFFFF, MEMVIEW32_MASK = 0x3FFFFFFF,
#endif #endif
@ -160,7 +158,7 @@ u64 Read_U64(const u32 _Address);
#endif #endif
inline u8* GetPointerUnchecked(const u32 address) { inline u8* GetPointerUnchecked(const u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return (u8 *)(base + (address & MEMVIEW32_MASK)); return (u8 *)(base + (address & MEMVIEW32_MASK));
#else #else
return (u8 *)(base + address); return (u8 *)(base + address);
@ -178,7 +176,7 @@ void WriteUnchecked_U32(const u32 _Data, const u32 _Address);
#else #else
inline u32 ReadUnchecked_U32(const u32 address) { inline u32 ReadUnchecked_U32(const u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return *(u32_le *)(base + (address & MEMVIEW32_MASK)); return *(u32_le *)(base + (address & MEMVIEW32_MASK));
#else #else
return *(u32_le *)(base + address); return *(u32_le *)(base + address);
@ -186,7 +184,7 @@ inline u32 ReadUnchecked_U32(const u32 address) {
} }
inline float ReadUnchecked_Float(const u32 address) { inline float ReadUnchecked_Float(const u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return *(float *)(base + (address & MEMVIEW32_MASK)); return *(float *)(base + (address & MEMVIEW32_MASK));
#else #else
return *(float *)(base + address); return *(float *)(base + address);
@ -194,7 +192,7 @@ inline float ReadUnchecked_Float(const u32 address) {
} }
inline u16 ReadUnchecked_U16(const u32 address) { inline u16 ReadUnchecked_U16(const u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return *(u16_le *)(base + (address & MEMVIEW32_MASK)); return *(u16_le *)(base + (address & MEMVIEW32_MASK));
#else #else
return *(u16_le *)(base + address); return *(u16_le *)(base + address);
@ -202,7 +200,7 @@ inline u16 ReadUnchecked_U16(const u32 address) {
} }
inline u8 ReadUnchecked_U8(const u32 address) { inline u8 ReadUnchecked_U8(const u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return (*(u8 *)(base + (address & MEMVIEW32_MASK))); return (*(u8 *)(base + (address & MEMVIEW32_MASK)));
#else #else
return (*(u8 *)(base + address)); return (*(u8 *)(base + address));
@ -210,7 +208,7 @@ inline u8 ReadUnchecked_U8(const u32 address) {
} }
inline void WriteUnchecked_U32(u32 data, u32 address) { inline void WriteUnchecked_U32(u32 data, u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
*(u32_le *)(base + (address & MEMVIEW32_MASK)) = data; *(u32_le *)(base + (address & MEMVIEW32_MASK)) = data;
#else #else
*(u32_le *)(base + address) = data; *(u32_le *)(base + address) = data;
@ -218,7 +216,7 @@ inline void WriteUnchecked_U32(u32 data, u32 address) {
} }
inline void WriteUnchecked_Float(float data, u32 address) { inline void WriteUnchecked_Float(float data, u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
*(float *)(base + (address & MEMVIEW32_MASK)) = data; *(float *)(base + (address & MEMVIEW32_MASK)) = data;
#else #else
*(float *)(base + address) = data; *(float *)(base + address) = data;
@ -226,7 +224,7 @@ inline void WriteUnchecked_Float(float data, u32 address) {
} }
inline void WriteUnchecked_U16(u16 data, u32 address) { inline void WriteUnchecked_U16(u16 data, u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
*(u16_le *)(base + (address & MEMVIEW32_MASK)) = data; *(u16_le *)(base + (address & MEMVIEW32_MASK)) = data;
#else #else
*(u16_le *)(base + address) = data; *(u16_le *)(base + address) = data;
@ -234,7 +232,7 @@ inline void WriteUnchecked_U16(u16 data, u32 address) {
} }
inline void WriteUnchecked_U8(u8 data, u32 address) { inline void WriteUnchecked_U8(u8 data, u32 address) {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
(*(u8 *)(base + (address & MEMVIEW32_MASK))) = data; (*(u8 *)(base + (address & MEMVIEW32_MASK))) = data;
#else #else
(*(u8 *)(base + address)) = data; (*(u8 *)(base + address)) = data;
@ -341,7 +339,7 @@ struct PSPPointer
inline T &operator*() const inline T &operator*() const
{ {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return *(T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)); return *(T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));
#else #else
return *(T *)(Memory::base + ptr); return *(T *)(Memory::base + ptr);
@ -350,7 +348,7 @@ struct PSPPointer
inline T &operator[](int i) const inline T &operator[](int i) const
{ {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return *((T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)) + i); return *((T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)) + i);
#else #else
return *((T *)(Memory::base + ptr) + i); return *((T *)(Memory::base + ptr) + i);
@ -359,7 +357,7 @@ struct PSPPointer
inline T *operator->() const inline T *operator->() const
{ {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)); return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));
#else #else
return (T *)(Memory::base + ptr); return (T *)(Memory::base + ptr);
@ -428,7 +426,7 @@ struct PSPPointer
inline operator T*() inline operator T*()
{ {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)); return (T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));
#else #else
return (T *)(Memory::base + ptr); return (T *)(Memory::base + ptr);
@ -437,7 +435,7 @@ struct PSPPointer
inline operator const T*() const inline operator const T*() const
{ {
#ifdef _ARCH_32 #if PPSSPP_ARCH(32BIT)
return (const T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK)); return (const T *)(Memory::base + (ptr & Memory::MEMVIEW32_MASK));
#else #else
return (const T *)(Memory::base + ptr); return (const T *)(Memory::base + ptr);

View file

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CPUDetect.h"
#include "Core/Util/AudioFormat.h" #include "Core/Util/AudioFormat.h"
#include "Core/Util/AudioFormatNEON.h" #include "Core/Util/AudioFormatNEON.h"
#include "Globals.h" #include "Globals.h"
@ -94,7 +95,7 @@ AdjustVolumeBlockFunc AdjustVolumeBlock = &AdjustVolumeBlockStandard;
// This has to be done after CPUDetect has done its magic. // This has to be done after CPUDetect has done its magic.
void SetupAudioFormats() { void SetupAudioFormats() {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7) && PPSSPP_ARCH(ARM_NEON)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
AdjustVolumeBlock = &AdjustVolumeBlockNEON; AdjustVolumeBlock = &AdjustVolumeBlockNEON;
} }

View file

@ -17,11 +17,12 @@
#pragma once #pragma once
#include "ppsspp_config.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Globals.h" #include "Globals.h"
static inline s16 ApplySampleVolume(s16 sample, int vol) { static inline s16 ApplySampleVolume(s16 sample, int vol) {
#ifdef ARM #if PPSSPP_ARCH(ARM)
register int r; register int r;
asm volatile("smulwb %0, %1, %2\n\t" \ asm volatile("smulwb %0, %1, %2\n\t" \
"ssat %0, #16, %0" \ "ssat %0, #16, %0" \

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM_NEON)
#include <arm_neon.h> #include <arm_neon.h>
#include "Common/Common.h" #include "Common/Common.h"
#include "Core/Util/AudioFormat.h" #include "Core/Util/AudioFormat.h"
@ -56,4 +59,6 @@ void AdjustVolumeBlockNEON(s16 *out, s16 *in, size_t size, int leftVol, int righ
out[i] = ApplySampleVolume(in[i], leftVol); out[i] = ApplySampleVolume(in[i], leftVol);
out[i + 1] = ApplySampleVolume(in[i + 1], rightVol); out[i + 1] = ApplySampleVolume(in[i + 1], rightVol);
} }
} }
#endif // PPSSPP_ARCH(ARM_NEON)

View file

@ -21,6 +21,7 @@
#include "profiler/profiler.h" #include "profiler/profiler.h"
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/MemoryUtil.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "GPU/Common/SplineCommon.h" #include "GPU/Common/SplineCommon.h"

View file

@ -152,7 +152,7 @@ u32 QuickTexHashNonSSE(const void *checkp, u32 size) {
} }
static u32 QuickTexHashBasic(const void *checkp, u32 size) { static u32 QuickTexHashBasic(const void *checkp, u32 size) {
#if defined(ARM) && defined(__GNUC__) #if PPSSPP_ARCH(ARM) && defined(__GNUC__)
__builtin_prefetch(checkp, 0, 0); __builtin_prefetch(checkp, 0, 0);
u32 check; u32 check;
@ -299,7 +299,7 @@ void DoUnswizzleTex16Basic(const u8 *texptr, u32 *ydestp, int bxc, int byc, u32
} }
#ifndef _M_SSE #ifndef _M_SSE
#ifndef ARM64 #if !PPSSPP_ARCH(ARM64)
QuickTexHashFunc DoQuickTexHash = &QuickTexHashBasic; QuickTexHashFunc DoQuickTexHash = &QuickTexHashBasic;
QuickTexHashFunc StableQuickTexHash = &QuickTexHashNonSSE; QuickTexHashFunc StableQuickTexHash = &QuickTexHashNonSSE;
UnswizzleTex16Func DoUnswizzleTex16 = &DoUnswizzleTex16Basic; UnswizzleTex16Func DoUnswizzleTex16 = &DoUnswizzleTex16Basic;
@ -310,12 +310,12 @@ ReliableHash64Func DoReliableHash64 = &XXH64;
// This has to be done after CPUDetect has done its magic. // This has to be done after CPUDetect has done its magic.
void SetupTextureDecoder() { void SetupTextureDecoder() {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARM)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
DoQuickTexHash = &QuickTexHashNEON; DoQuickTexHash = &QuickTexHashNEON;
StableQuickTexHash = &QuickTexHashNEON; StableQuickTexHash = &QuickTexHashNEON;
DoUnswizzleTex16 = &DoUnswizzleTex16NEON; DoUnswizzleTex16 = &DoUnswizzleTex16NEON;
#ifndef IOS #if !PPSSPP_PLATFORM(IOS)
// Not sure if this is safe on iOS, it's had issues with xxhash. // Not sure if this is safe on iOS, it's had issues with xxhash.
DoReliableHash32 = &ReliableHash32NEON; DoReliableHash32 = &ReliableHash32NEON;
#endif #endif
@ -614,7 +614,7 @@ CheckAlphaResult CheckAlphaRGBA8888Basic(const u32 *pixelData, int stride, int w
if ((w & 3) == 0 && (stride & 3) == 0) { if ((w & 3) == 0 && (stride & 3) == 0) {
#ifdef _M_SSE #ifdef _M_SSE
return CheckAlphaRGBA8888SSE2(pixelData, stride, w, h); return CheckAlphaRGBA8888SSE2(pixelData, stride, w, h);
#elif (defined(ARM) && defined(HAVE_ARMV7)) || defined(ARM64) #elif PPSSPP_ARCH(ARMV7) || PPSSPP_ARCH(ARM64)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
return CheckAlphaRGBA8888NEON(pixelData, stride, w, h); return CheckAlphaRGBA8888NEON(pixelData, stride, w, h);
} }
@ -648,7 +648,7 @@ CheckAlphaResult CheckAlphaABGR4444Basic(const u32 *pixelData, int stride, int w
if ((w & 7) == 0 && (stride & 7) == 0) { if ((w & 7) == 0 && (stride & 7) == 0) {
#ifdef _M_SSE #ifdef _M_SSE
return CheckAlphaABGR4444SSE2(pixelData, stride, w, h); return CheckAlphaABGR4444SSE2(pixelData, stride, w, h);
#elif (defined(ARM) && defined(HAVE_ARMV7)) || defined(ARM64) #elif PPSSPP_ARCH(ARMV7) || PPSSPP_ARCH(ARM64)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
return CheckAlphaABGR4444NEON(pixelData, stride, w, h); return CheckAlphaABGR4444NEON(pixelData, stride, w, h);
} }
@ -685,7 +685,7 @@ CheckAlphaResult CheckAlphaABGR1555Basic(const u32 *pixelData, int stride, int w
if ((w & 7) == 0 && (stride & 7) == 0) { if ((w & 7) == 0 && (stride & 7) == 0) {
#ifdef _M_SSE #ifdef _M_SSE
return CheckAlphaABGR1555SSE2(pixelData, stride, w, h); return CheckAlphaABGR1555SSE2(pixelData, stride, w, h);
#elif (defined(ARM) && defined(HAVE_ARMV7)) || defined(ARM64) #elif PPSSPP_ARCH(ARMV7) || PPSSPP_ARCH(ARM64)
if (cpu_info.bNEON) { if (cpu_info.bNEON) {
return CheckAlphaABGR1555NEON(pixelData, stride, w, h); return CheckAlphaABGR1555NEON(pixelData, stride, w, h);
} }

View file

@ -15,15 +15,14 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM_NEON)
#include <arm_neon.h> #include <arm_neon.h>
#include "GPU/GPUState.h" #include "GPU/GPUState.h"
#include "GPU/Common/TextureDecoder.h" #include "GPU/Common/TextureDecoder.h"
#if !defined(ARM) && !defined(ARM64)
#error Should not be compiled on non-ARM.
#endif
static const u16 MEMORY_ALIGNED16(QuickTexHashInitial[8]) = {0xc00bU, 0x9bd9U, 0x4b73U, 0xb651U, 0x4d9bU, 0x4309U, 0x0083U, 0x0001U}; static const u16 MEMORY_ALIGNED16(QuickTexHashInitial[8]) = {0xc00bU, 0x9bd9U, 0x4b73U, 0xb651U, 0x4d9bU, 0x4309U, 0x0083U, 0x0001U};
u32 QuickTexHashNEON(const void *checkp, u32 size) { u32 QuickTexHashNEON(const void *checkp, u32 size) {
@ -367,3 +366,5 @@ CheckAlphaResult CheckAlphaABGR1555NEON(const u32 *pixelData, int stride, int w,
return CHECKALPHA_FULL; return CHECKALPHA_FULL;
} }
#endif

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM)
// This allows highlighting to work. Yay. // This allows highlighting to work. Yay.
#ifdef __INTELLISENSE__ #ifdef __INTELLISENSE__
#define ARM #define ARM
@ -1608,3 +1611,5 @@ bool VertexDecoderJitCache::CompileStep(const VertexDecoder &dec, int step) {
} }
return false; return false;
} }
#endif // PPSSPP_ARCH(ARM)

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM64)
// This allows highlighting to work. Yay. // This allows highlighting to work. Yay.
#ifdef __INTELLISENSE__ #ifdef __INTELLISENSE__
#define ARM64 #define ARM64
@ -783,3 +786,5 @@ void VertexDecoderJitCache::Jit_WriteMatrixMul(int outOff, bool pos) {
} }
fp.STUR(128, accNEON, dstReg, outOff); fp.STUR(128, accNEON, dstReg, outOff);
} }
#endif // PPSSPP_ARCH(ARM64)

View file

@ -1403,7 +1403,7 @@ std::string VertexDecoder::GetString(DebugShaderStringType stringType) {
} }
VertexDecoderJitCache::VertexDecoderJitCache() VertexDecoderJitCache::VertexDecoderJitCache()
#ifdef ARM64 #if PPSSPP_ARCH(ARM64)
: fp(this) : fp(this)
#endif #endif
{ {

View file

@ -18,19 +18,20 @@
#pragma once #pragma once
#include <cstring> #include <cstring>
#include "ppsspp_config.h"
#include "base/basictypes.h" #include "base/basictypes.h"
#include "Common/Log.h" #include "Common/Log.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "GPU/ge_constants.h" #include "GPU/ge_constants.h"
#include "GPU/Common/ShaderCommon.h" #include "GPU/Common/ShaderCommon.h"
#ifdef ARM #if PPSSPP_ARCH(ARM)
#include "Common/ArmEmitter.h" #include "Common/ArmEmitter.h"
#elif defined(ARM64) #elif PPSSPP_ARCH(ARM64)
#include "Common/Arm64Emitter.h" #include "Common/Arm64Emitter.h"
#elif defined(_M_IX86) || defined(_M_X64) #elif PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include "Common/x64Emitter.h" #include "Common/x64Emitter.h"
#elif defined(MIPS) #elif PPSSPP_ARCH(MIPS)
#include "Common/MipsEmitter.h" #include "Common/MipsEmitter.h"
#else #else
#include "Common/FakeEmitter.h" #include "Common/FakeEmitter.h"
@ -602,13 +603,13 @@ public:
// that's it! // that's it!
#ifdef ARM #if PPSSPP_ARCH(ARM)
class VertexDecoderJitCache : public ArmGen::ARMXCodeBlock { class VertexDecoderJitCache : public ArmGen::ARMXCodeBlock {
#elif defined(ARM64) #elif PPSSPP_ARCH(ARM64)
class VertexDecoderJitCache : public Arm64Gen::ARM64CodeBlock { class VertexDecoderJitCache : public Arm64Gen::ARM64CodeBlock {
#elif defined(_M_IX86) || defined(_M_X64) #elif PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
class VertexDecoderJitCache : public Gen::XCodeBlock { class VertexDecoderJitCache : public Gen::XCodeBlock {
#elif defined(MIPS) #elif PPSSPP_ARCH(MIPS)
class VertexDecoderJitCache : public MIPSGen::MIPSCodeBlock { class VertexDecoderJitCache : public MIPSGen::MIPSCodeBlock {
#else #else
class VertexDecoderJitCache : public FakeGen::FakeXCodeBlock { class VertexDecoderJitCache : public FakeGen::FakeXCodeBlock {
@ -707,7 +708,7 @@ private:
void Jit_AnyFloatMorph(int srcoff, int dstoff); void Jit_AnyFloatMorph(int srcoff, int dstoff);
const VertexDecoder *dec_; const VertexDecoder *dec_;
#ifdef ARM64 #if PPSSPP_ARCH(ARM64)
Arm64Gen::ARM64FloatEmitter fp; Arm64Gen::ARM64FloatEmitter fp;
#endif #endif
}; };

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
//TODO: Doesn't build, FIXME!
#if 0
#include "base/logging.h" #include "base/logging.h"
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -270,3 +273,4 @@ bool VertexDecoderJitCache::CompileStep(const VertexDecoder &dec, int step) {
return false; return false;
} }
#endif

View file

@ -15,6 +15,9 @@
// Official git repository and contact information can be found at // Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "ppsspp_config.h"
#if PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)
#include <emmintrin.h> #include <emmintrin.h>
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
@ -1626,3 +1629,5 @@ bool VertexDecoderJitCache::CompileStep(const VertexDecoder &dec, int step) {
} }
return false; return false;
} }
#endif // PPSSPP_ARCH(X86) || PPSSPP_ARCH(AMD64)

View file

@ -23,6 +23,7 @@
#include <string> #include <string>
#include <utility> #include <utility>
#include "ppsspp_config.h"
#include "Log.h" #include "Log.h"
#include "CommonTypes.h" #include "CommonTypes.h"
@ -31,7 +32,7 @@
#define IS_BIG_ENDIAN (*(const u16 *)"\0\xff" < 0x100) #define IS_BIG_ENDIAN (*(const u16 *)"\0\xff" < 0x100)
static inline u8 clamp_u8(int i) { static inline u8 clamp_u8(int i) {
#ifdef ARM #if PPSSPP_ARCH(ARM)
asm("usat %0, #8, %1" : "=r"(i) : "r"(i)); asm("usat %0, #8, %1" : "=r"(i) : "r"(i));
#else #else
if (i > 255) if (i > 255)
@ -43,7 +44,7 @@ static inline u8 clamp_u8(int i) {
} }
static inline s16 clamp_s16(int i) { static inline s16 clamp_s16(int i) {
#ifdef ARM #if PPSSPP_ARCH(ARM)
asm("ssat %0, #16, %1" : "=r"(i) : "r"(i)); asm("ssat %0, #16, %1" : "=r"(i) : "r"(i));
#else #else
if (i > 32767) if (i > 32767)

View file

@ -298,15 +298,15 @@ void LogLevelScreen::OnCompleted(DialogResult result) {
} }
const char *GetCompilerABI() { const char *GetCompilerABI() {
#ifdef HAVE_ARMV7 #if PPSSPP_ARCH(ARMV7)
return "armeabi-v7a"; return "armeabi-v7a";
#elif defined(ARM) #elif PPSSPP_ARCH(ARM)
return "armeabi"; return "armeabi";
#elif defined(ARM64) #elif PPSSPP_ARCH(ARM64)
return "arm64"; return "arm64";
#elif defined(_M_IX86) #elif PPSSPP_ARCH(X86)
return "x86"; return "x86";
#elif defined(_M_X64) #elif PPSSPP_ARCH(AMD64)
return "x86-64"; return "x86-64";
#else #else
return "other"; return "other";

View file

@ -14,7 +14,6 @@ set(MOBILE_DEVICE ON)
set(USING_GLES2 ON) set(USING_GLES2 ON)
set(IPHONEOS_DEPLOYMENT_TARGET 6.0) set(IPHONEOS_DEPLOYMENT_TARGET 6.0)
add_definitions( add_definitions(
-DIOS
-DGL_ETC1_RGB8_OES=0 -DGL_ETC1_RGB8_OES=0
-U__STRICT_ANSI__ -U__STRICT_ANSI__
) )

View file

@ -13,7 +13,7 @@ link_directories(
) )
add_definitions( add_definitions(
-DRPI -DPPSSPP_PLATFORM_RPI=1
) )
set(ARCH_FLAGS "-mfpu=vfp -march=armv6j -mfloat-abi=hard") set(ARCH_FLAGS "-mfpu=vfp -march=armv6j -mfloat-abi=hard")

View file

@ -13,7 +13,7 @@ link_directories(
) )
add_definitions( add_definitions(
-DRPI -DPPSSPP_PLATFORM_RPI=1
-U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 -U__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2
) )

View file

@ -22,7 +22,7 @@
SDLJoystick *joystick = NULL; SDLJoystick *joystick = NULL;
#endif #endif
#ifdef RPI #if PPSSPP_PLATFORM(RPI)
#include <bcm_host.h> #include <bcm_host.h>
#endif #endif
@ -410,7 +410,7 @@ void ToggleFullScreenIfFlagSet() {
#undef main #undef main
#endif #endif
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
#ifdef RPI #if PPSSPP_PLATFORM(RPI)
bcm_host_init(); bcm_host_init();
#endif #endif
putenv((char*)"SDL_VIDEO_CENTERED=1"); putenv((char*)"SDL_VIDEO_CENTERED=1");
@ -924,7 +924,7 @@ int main(int argc, char *argv[]) {
SDL_GL_DeleteContext(glContext); SDL_GL_DeleteContext(glContext);
SDL_Quit(); SDL_Quit();
net::Shutdown(); net::Shutdown();
#ifdef RPI #if PPSSPP_PLATFORM(RPI)
bcm_host_deinit(); bcm_host_deinit();
#endif #endif

View file

@ -51,22 +51,8 @@ inline uint8_t swap8(uint8_t _data) {return _data;}
inline uint16_t swap16(uint16_t _data) {return _byteswap_ushort(_data);} inline uint16_t swap16(uint16_t _data) {return _byteswap_ushort(_data);}
inline uint32_t swap32(uint32_t _data) {return _byteswap_ulong (_data);} inline uint32_t swap32(uint32_t _data) {return _byteswap_ulong (_data);}
inline uint64_t swap64(uint64_t _data) {return _byteswap_uint64(_data);} inline uint64_t swap64(uint64_t _data) {return _byteswap_uint64(_data);}
#elif defined(ARM)
inline uint16_t swap16 (uint16_t _data) { uint32_t data = _data; __asm__ ("rev16 %0, %1\n" : "=l" (data) : "l" (data)); return (uint16_t)data;}
inline uint32_t swap32 (uint32_t _data) {__asm__ ("rev %0, %1\n" : "=l" (_data) : "l" (_data)); return _data;}
inline uint64_t swap64(uint64_t _data) {return ((uint64_t)swap32(_data) << 32) | swap32(_data >> 32);}
#elif __linux__ && !defined(__ANDROID__)
#include <byteswap.h>
inline uint16_t swap16(uint16_t _data) {return bswap_16(_data);}
inline uint32_t swap32(uint32_t _data) {return bswap_32(_data);}
inline uint64_t swap64(uint64_t _data) {return bswap_64(_data);}
#elif defined(__DragonFly__) || defined(__FreeBSD__)
#include <sys/endian.h>
inline uint16_t swap16(uint16_t _data) {return bswap16(_data);}
inline uint32_t swap32(uint32_t _data) {return bswap32(_data);}
inline uint64_t swap64(uint64_t _data) {return bswap64(_data);}
#elif defined(__GNUC__) #elif defined(__GNUC__)
inline uint16_t swap16(uint16_t _data) {return (_data >> 8) | (_data << 8);} inline uint16_t swap16(uint16_t _data) {return __builtin_bswap16(_data);}
inline uint32_t swap32(uint32_t _data) {return __builtin_bswap32(_data);} inline uint32_t swap32(uint32_t _data) {return __builtin_bswap32(_data);}
inline uint64_t swap64(uint64_t _data) {return __builtin_bswap64(_data);} inline uint64_t swap64(uint64_t _data) {return __builtin_bswap64(_data);}
#else #else

View file

@ -1,3 +1,6 @@
#include "ppsspp_config.h"
#if PPSSPP_ARCH(ARM) && PPSSPP_ARCH(ARM_NEON)
.syntax unified // Allow both ARM and Thumb-2 instructions .syntax unified // Allow both ARM and Thumb-2 instructions
.text .text
.align 2 // Align the function code to a 4-byte (2^n) word boundary. .align 2 // Align the function code to a 4-byte (2^n) word boundary.
@ -48,3 +51,4 @@ fast_matrix_mul_4x4_neon:
vst1.32 {d28-d31}, [r0]! @ store second eight elements of result vst1.32 {d28-d31}, [r0]! @ store second eight elements of result
bx lr bx lr
#endif

103
ppsspp_config.h Normal file
View file

@ -0,0 +1,103 @@
#pragma once
// This file is included by C, C++ and ASM files
// So do not output any token!
#define PPSSPP_ARCH(PPSSPP_FEATURE) (PPSSPP_ARCH_##PPSSPP_FEATURE)
#define PPSSPP_PLATFORM(PPSSPP_FEATURE) (PPSSPP_PLATFORM_##PPSSPP_FEATURE)
// ARCH defines
#if defined(_M_IX86) || defined(__i386__)
#define PPSSPP_ARCH_X86 1
#define PPSSPP_ARCH_32BIT 1
//TODO: Remove this compat define
#ifndef _M_IX86
#define _M_IX86 600
#endif
#endif
#if defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)
#define PPSSPP_ARCH_AMD64 1
#define PPSSPP_ARCH_64BIT 1
//TODO: Remove this compat define
#ifndef _M_X64
#define _M_X64 1
#endif
#endif
#if defined(__arm__)
#define PPSSPP_ARCH_ARM 1
#define PPSSPP_ARCH_32BIT 1
#if defined(__ARM_ARCH_7__) || \
defined(__ARM_ARCH_7A__) || \
defined(__ARM_ARCH_7S__)
#define PPSSPP_ARCH_ARMV7 1
#endif
#if defined(__ARM_ARCH_7S__)
#define PPSSPP_ARCH_ARMV7S 1
#endif
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
#define PPSSPP_ARCH_ARM_NEON 1
#endif
//TODO: Remove this compat define
#ifndef ARM
#define ARM 1
#endif
#endif
#if defined(__aarch64__)
#define PPSSPP_ARCH_ARM64 1
#define PPSSPP_ARCH_64BIT 1
#define PPSSPP_ARCH_ARM_NEON 1
//TODO: Remove this compat define
#ifndef ARM64
#define ARM64 1
#endif
#endif
#if defined(__mips64__)
#define PPSSPP_ARCH_MIPS64 1
#define PPSSPP_ARCH_64BIT 1
#elif defined(__mips__)
#define PPSSPP_ARCH_MIPS 1
#define PPSSPP_ARCH_32BIT 1
//TODO: Remove this compat define
#ifndef MIPS
#define MIPS 1
#endif
#endif
// PLATFORM defines
#if defined(_WIN32)
// Covers both 32 and 64bit Windows
#define PPSSPP_PLATFORM_WINDOWS 1
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#if TARGET_IPHONE_SIMULATOR
#define PPSSPP_PLATFORM_IOS 1
#define PPSSPP_PLATFORM_IOS_SIMULATOR 1
//TODO: Remove this compat define
#ifndef IOS
#define IOS 1
#endif
#elif TARGET_OS_IPHONE
#define PPSSPP_PLATFORM_IOS 1
//TODO: Remove this compat define
#ifndef IOS
#define IOS 1
#endif
#elif TARGET_OS_MAC
#define PPSSPP_PLATFORM_MAC 1
#else
#error "Unknown Apple platform"
#endif
#elif defined(__ANDROID__)
#define PPSSPP_PLATFORM_ANDROID 1
#elif defined(__linux__)
#define PPSSPP_PLATFORM_LINUX 1
#endif