From 5119d790829b1ac2f9323b1ca74395f717666545 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Tue, 2 Mar 2021 20:57:25 -0800 Subject: [PATCH] Build: Remove IOS define. --- Common/ArmEmitter.cpp | 4 ++-- Common/File/FileUtil.cpp | 8 ++++---- Common/GPU/OpenGL/GLCommon.h | 4 ++-- Common/GPU/OpenGL/GLFeatures.cpp | 2 +- Common/GPU/OpenGL/GLQueueRunner.cpp | 9 +++++---- Common/GPU/OpenGL/GLRenderManager.cpp | 3 ++- Common/GPU/OpenGL/gl3stub.c | 2 +- Common/GPU/OpenGL/gl3stub.h | 2 +- Common/GPU/OpenGL/thin3d_gl.cpp | 2 +- Common/GPU/Vulkan/VulkanLoader.cpp | 2 +- Common/MemArenaDarwin.cpp | 4 ++-- Common/MemoryUtil.cpp | 2 +- Core/MIPS/ARM/ArmAsm.cpp | 2 +- Core/MIPS/MIPSAnalyst.cpp | 3 ++- Core/MemMap.cpp | 2 +- Core/Reporting.cpp | 3 ++- GPU/Common/TextureDecoderNEON.cpp | 2 +- GPU/GLES/StateMappingGLES.cpp | 4 ++-- UI/NativeApp.cpp | 14 +++++++------- android/jni/TestRunner.cpp | 4 ++-- ext/xbrz/xbrz.h | 3 ++- libretro/LibretroGLCoreContext.cpp | 4 ++-- libretro/Makefile | 3 +-- ppsspp_config.h | 8 -------- 24 files changed, 46 insertions(+), 50 deletions(-) diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index b3878fd443..73d28a1eb1 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -23,7 +23,7 @@ #include #include -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) #include #include #endif @@ -627,7 +627,7 @@ void ARMXEmitter::FlushIcache() void ARMXEmitter::FlushIcacheSection(u8 *start, u8 *end) { -#if defined(IOS) +#if PPSSPP_PLATFORM(IOS) // Header file says this is equivalent to: sys_icache_invalidate(start, end - start); sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start); #elif PPSSPP_PLATFORM(WINDOWS) diff --git a/Common/File/FileUtil.cpp b/Common/File/FileUtil.cpp index 2cef9f29f4..0cb921f0e0 100644 --- a/Common/File/FileUtil.cpp +++ b/Common/File/FileUtil.cpp @@ -63,9 +63,9 @@ #include #include #include -#if !defined(IOS) +#if !PPSSPP_PLATFORM(IOS) #include -#endif // !defined(IOS) +#endif // !PPSSPP_PLATFORM(IOS) #endif // __APPLE__ #include "Common/Data/Encoding/Utf8.h" @@ -844,13 +844,13 @@ const std::string &GetExeDirectory() ExePath = program_path; #endif -#elif (defined(__APPLE__) && !defined(IOS)) || defined(__linux__) || defined(KERN_PROC_PATHNAME) +#elif (defined(__APPLE__) && !PPSSPP_PLATFORM(IOS)) || defined(__linux__) || defined(KERN_PROC_PATHNAME) char program_path[4096]; uint32_t program_path_size = sizeof(program_path) - 1; #if defined(__linux__) if (readlink("/proc/self/exe", program_path, program_path_size) > 0) -#elif defined(__APPLE__) && !defined(IOS) +#elif defined(__APPLE__) && !PPSSPP_PLATFORM(IOS) if (_NSGetExecutablePath(program_path, &program_path_size) == 0) #elif defined(KERN_PROC_PATHNAME) int mib[4] = { diff --git a/Common/GPU/OpenGL/GLCommon.h b/Common/GPU/OpenGL/GLCommon.h index dd7bdeaa1c..26f9220d7f 100644 --- a/Common/GPU/OpenGL/GLCommon.h +++ b/Common/GPU/OpenGL/GLCommon.h @@ -2,7 +2,7 @@ #include "ppsspp_config.h" -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) #include #include #elif defined(USING_GLES2) @@ -58,7 +58,7 @@ typedef void (EGLAPIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) ( #endif extern PFNGLBLITFRAMEBUFFERNVPROC glBlitFramebufferNV; -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) extern PFNGLDISCARDFRAMEBUFFEREXTPROC glDiscardFramebufferEXT; extern PFNGLGENVERTEXARRAYSOESPROC glGenVertexArraysOES; extern PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES; diff --git a/Common/GPU/OpenGL/GLFeatures.cpp b/Common/GPU/OpenGL/GLFeatures.cpp index 5902ed6492..8628697766 100644 --- a/Common/GPU/OpenGL/GLFeatures.cpp +++ b/Common/GPU/OpenGL/GLFeatures.cpp @@ -31,7 +31,7 @@ PFNGLBINDVERTEXARRAYOESPROC glBindVertexArrayOES; PFNGLDELETEVERTEXARRAYSOESPROC glDeleteVertexArraysOES; PFNGLISVERTEXARRAYOESPROC glIsVertexArrayOES; #endif -#ifndef IOS +#if !PPSSPP_PLATFORM(IOS) #include "EGL/egl.h" #endif #endif diff --git a/Common/GPU/OpenGL/GLQueueRunner.cpp b/Common/GPU/OpenGL/GLQueueRunner.cpp index 80606241b5..487a335dd0 100644 --- a/Common/GPU/OpenGL/GLQueueRunner.cpp +++ b/Common/GPU/OpenGL/GLQueueRunner.cpp @@ -1,3 +1,4 @@ +#include "ppsspp_config.h" #include #include "Common/GPU/OpenGL/GLCommon.h" @@ -18,7 +19,7 @@ #define TEXCACHE_NAME_CACHE_SIZE 16 -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) extern void bindDefaultFBO(); #endif @@ -201,7 +202,7 @@ void GLQueueRunner::RunInitSteps(const std::vector &steps, bool ski } else if (gl_extensions.VersionGEThan(3, 3, 0)) { glBindFragDataLocation(program->program, 0, "fragColor0"); } -#elif !defined(IOS) +#elif !PPSSPP_PLATFORM(IOS) if (gl_extensions.GLES3 && step.create_program.support_dual_source) { glBindFragDataLocationIndexedEXT(program->program, 0, 0, "fragColor0"); glBindFragDataLocationIndexedEXT(program->program, 0, 1, "fragColor1"); @@ -1368,7 +1369,7 @@ void GLQueueRunner::PerformCopy(const GLRStep &step) { _dbg_assert_(dstTex); #if defined(USING_GLES2) -#ifndef IOS +#if !PPSSPP_PLATFORM(IOS) _assert_msg_(gl_extensions.OES_copy_image || gl_extensions.NV_copy_image || gl_extensions.EXT_copy_image, "Image copy extension expected"); glCopyImageSubDataOES( srcTex, target, srcLevel, srcRect.x, srcRect.y, srcZ, @@ -1682,7 +1683,7 @@ void GLQueueRunner::fbo_unbind() { glBindFramebuffer(GL_FRAMEBUFFER, g_defaultFBO); #endif -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) bindDefaultFBO(); #endif diff --git a/Common/GPU/OpenGL/GLRenderManager.cpp b/Common/GPU/OpenGL/GLRenderManager.cpp index bafc125ef9..6229aa676a 100644 --- a/Common/GPU/OpenGL/GLRenderManager.cpp +++ b/Common/GPU/OpenGL/GLRenderManager.cpp @@ -1,3 +1,4 @@ +#include "ppsspp_config.h" #include "GLRenderManager.h" #include "Common/GPU/OpenGL/GLFeatures.h" #include "Common/GPU/thin3d.h" @@ -889,7 +890,7 @@ void *GLRBuffer::Map(GLBufferStrategy strategy) { glBindBuffer(target_, buffer_); if (gl_extensions.ARB_buffer_storage || gl_extensions.EXT_buffer_storage) { -#ifndef IOS +#if !PPSSPP_PLATFORM(IOS) if (!hasStorage_) { GLbitfield storageFlags = access & ~(GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_FLUSH_EXPLICIT_BIT); #ifdef USING_GLES2 diff --git a/Common/GPU/OpenGL/gl3stub.c b/Common/GPU/OpenGL/gl3stub.c index 28bbcd774a..1caf54b685 100644 --- a/Common/GPU/OpenGL/gl3stub.c +++ b/Common/GPU/OpenGL/gl3stub.c @@ -382,7 +382,7 @@ GLboolean gl3stubInit() { return GL_TRUE; } -#endif // IOS +#endif // PPSPP_PLATFORM(IOS) #endif // GLES2 diff --git a/Common/GPU/OpenGL/gl3stub.h b/Common/GPU/OpenGL/gl3stub.h index 26b571b982..ba99aec6b2 100644 --- a/Common/GPU/OpenGL/gl3stub.h +++ b/Common/GPU/OpenGL/gl3stub.h @@ -514,7 +514,7 @@ extern GL_APICALL void (* GL_APIENTRY glBufferStorageEXT) (GLenum targ /* OES_copy_image, etc. */ extern GL_APICALL void (* GL_APIENTRY glCopyImageSubDataOES) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth); -#endif // IOS +#endif // PPSSPP_PLATFORM(IOS) #ifdef __cplusplus } diff --git a/Common/GPU/OpenGL/thin3d_gl.cpp b/Common/GPU/OpenGL/thin3d_gl.cpp index 508fe95822..29e8283d53 100644 --- a/Common/GPU/OpenGL/thin3d_gl.cpp +++ b/Common/GPU/OpenGL/thin3d_gl.cpp @@ -61,7 +61,7 @@ static const unsigned short blendFactorToGL[] = { GL_ONE_MINUS_SRC1_COLOR, GL_SRC1_ALPHA, GL_ONE_MINUS_SRC1_ALPHA, -#elif !defined(IOS) +#elif !PPSSPP_PLATFORM(IOS) GL_SRC1_COLOR_EXT, GL_ONE_MINUS_SRC1_COLOR_EXT, GL_SRC1_ALPHA_EXT, diff --git a/Common/GPU/Vulkan/VulkanLoader.cpp b/Common/GPU/Vulkan/VulkanLoader.cpp index 70e2abcd52..eede42ce48 100644 --- a/Common/GPU/Vulkan/VulkanLoader.cpp +++ b/Common/GPU/Vulkan/VulkanLoader.cpp @@ -238,7 +238,7 @@ static const char *device_name_blacklist[] = { #ifndef _WIN32 static const char *so_names[] = { -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) "@executable_path/Frameworks/libMoltenVK.dylib", #elif PPSSPP_PLATFORM(MAC) "@executable_path/../Frameworks/libMoltenVK.dylib", diff --git a/Common/MemArenaDarwin.cpp b/Common/MemArenaDarwin.cpp index d35fb7f84d..acac2957a1 100644 --- a/Common/MemArenaDarwin.cpp +++ b/Common/MemArenaDarwin.cpp @@ -84,7 +84,7 @@ void MemArena::ReleaseView(void* view, size_t size) { } bool MemArena::NeedsProbing() { -#if defined(IOS) && PPSSPP_ARCH(64BIT) +#if PPSSPP_PLATFORM(IOS) && PPSSPP_ARCH(64BIT) return true; #else return false; @@ -92,7 +92,7 @@ bool MemArena::NeedsProbing() { } u8* MemArena::Find4GBBase() { -#if defined(IOS) && PPSSPP_ARCH(64BIT) +#if PPSSPP_PLATFORM(IOS) && PPSSPP_ARCH(64BIT) // The caller will need to do probing, like on 32-bit Windows. return nullptr; #else diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index d99bebe956..9708f7a897 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -279,7 +279,7 @@ void FreeAlignedMemory(void* ptr) { bool PlatformIsWXExclusive() { // Needed on platforms that disable W^X pages for security. Even without block linking, still should be much faster than IR JIT. // This might also come in useful for UWP (Universal Windows Platform) if I'm understanding things correctly. -#if defined(IOS) || PPSSPP_PLATFORM(UWP) || defined(__OpenBSD__) +#if PPSSPP_PLATFORM(IOS) || PPSSPP_PLATFORM(UWP) || defined(__OpenBSD__) return true; #elif PPSSPP_PLATFORM(MAC) && PPSSPP_ARCH(ARM64) return true; diff --git a/Core/MIPS/ARM/ArmAsm.cpp b/Core/MIPS/ARM/ArmAsm.cpp index ed06c4065e..4f9fb1e2a3 100644 --- a/Core/MIPS/ARM/ArmAsm.cpp +++ b/Core/MIPS/ARM/ArmAsm.cpp @@ -213,7 +213,7 @@ void ArmJit::GenerateFixedCode() { // IDEA - we have 26 bits, why not just use offsets from base of code? // Another idea: Shift the bloc number left by two in the op, this would let us do // LDR(R0, R9, R0); here, replacing the next instructions. -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) // On iOS, R9 (JITBASEREG) is volatile. We have to reload it. MOVI2R(JITBASEREG, (u32)(uintptr_t)GetBasePtr()); #endif diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 6b6f02571f..6e88bbf63f 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "ppsspp_config.h" #include #include #include @@ -760,7 +761,7 @@ namespace MIPSAnalyst { std::lock_guard guard(functions_lock); hashToFunction.clear(); // Really need to detect C++11 features with better defines. -#if !defined(IOS) +#if !PPSSPP_PLATFORM(IOS) hashToFunction.reserve(functions.size()); #endif for (auto iter = functions.begin(); iter != functions.end(); iter++) { diff --git a/Core/MemMap.cpp b/Core/MemMap.cpp index 6d86bebd03..f69a46db6e 100644 --- a/Core/MemMap.cpp +++ b/Core/MemMap.cpp @@ -129,7 +129,7 @@ inline static bool CanIgnoreView(const MemoryView &view) { #endif } -#if defined(IOS) && PPSSPP_ARCH(64BIT) +#if PPSSPP_PLATFORM(IOS) && PPSSPP_ARCH(64BIT) #define SKIP(a_flags, b_flags) \ if ((b_flags) & MV_KERNEL) \ continue; diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 3a621a0825..d80992e3e6 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "ppsspp_config.h" #include #include #include @@ -301,7 +302,7 @@ namespace Reporting return "Windows ARM32"; #elif defined(_WIN32) return "Windows"; -#elif defined(IOS) +#elif PPSSPP_PLATFORM(IOS) return "iOS"; #elif defined(__APPLE__) return "Mac"; diff --git a/GPU/Common/TextureDecoderNEON.cpp b/GPU/Common/TextureDecoderNEON.cpp index 8e96223877..e0a427e65a 100644 --- a/GPU/Common/TextureDecoderNEON.cpp +++ b/GPU/Common/TextureDecoderNEON.cpp @@ -41,7 +41,7 @@ u32 QuickTexHashNEON(const void *checkp, u32 size) { __builtin_prefetch(checkp, 0, 0); if (((intptr_t)checkp & 0xf) == 0 && (size & 0x3f) == 0) { -#if defined(IOS) || PPSSPP_ARCH(ARM64) || defined(_MSC_VER) || !PPSSPP_ARCH(ARMV7) +#if PPSSPP_PLATFORM(IOS) || PPSSPP_ARCH(ARM64) || defined(_MSC_VER) || !PPSSPP_ARCH(ARMV7) uint32x4_t cursor = vdupq_n_u32(0); uint16x8_t cursor2 = vld1q_u16(QuickTexHashInitial); uint16x8_t update = vdupq_n_u16(0x2455U); diff --git a/GPU/GLES/StateMappingGLES.cpp b/GPU/GLES/StateMappingGLES.cpp index d72386d229..992695e4a5 100644 --- a/GPU/GLES/StateMappingGLES.cpp +++ b/GPU/GLES/StateMappingGLES.cpp @@ -19,7 +19,7 @@ // Alpha/stencil is a convoluted mess. Some good comments are here: // https://github.com/hrydgard/ppsspp/issues/3768 - +#include "ppsspp_config.h" #include "StateMappingGLES.h" #include "Common/Profiler/Profiler.h" #include "Common/GPU/OpenGL/GLDebugLog.h" @@ -58,7 +58,7 @@ static const GLushort glBlendFactorLookup[(size_t)BlendFactor::COUNT] = { GL_ONE_MINUS_SRC1_COLOR, GL_SRC1_ALPHA, GL_ONE_MINUS_SRC1_ALPHA, -#elif !defined(IOS) +#elif !PPSSPP_PLATFORM(IOS) GL_SRC1_COLOR_EXT, GL_ONE_MINUS_SRC1_COLOR_EXT, GL_SRC1_ALPHA_EXT, diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index d958181536..e36f59a016 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -133,7 +133,7 @@ Atlas g_ui_atlas; #include "../../android/jni/Arm64EmitterTest.h" #endif -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) #include "ios/iOSCoreAudio.h" #elif defined(__APPLE__) #include @@ -211,13 +211,13 @@ static LogListener *logger = nullptr; std::string boot_filename = ""; void NativeHost::InitSound() { -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) iOSCoreAudioInit(); #endif } void NativeHost::ShutdownSound() { -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) iOSCoreAudioShutdown(); #endif } @@ -323,7 +323,7 @@ static void PostLoadConfig() { if (g_Config.currentDirectory.empty()) { #if defined(__ANDROID__) g_Config.currentDirectory = g_Config.externalDirectory; -#elif defined(IOS) +#elif PPSSPP_PLATFORM(IOS) g_Config.currentDirectory = g_Config.internalDataDirectory; #elif PPSSPP_PLATFORM(SWITCH) g_Config.currentDirectory = "/"; @@ -454,12 +454,12 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch std::string user_data_path = savegame_dir; pendingMessages.clear(); pendingInputBoxes.clear(); -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) user_data_path += "/"; #endif // We want this to be FIRST. -#if defined(IOS) +#if PPSSPP_PLATFORM(IOS) // Packed assets are included in app VFSRegister("", new DirectoryAssetReader(external_dir)); #endif @@ -508,7 +508,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch g_Config.memStickDirectory = memstickDir + "/"; } } -#elif defined(IOS) +#elif PPSSPP_PLATFORM(IOS) g_Config.memStickDirectory = user_data_path; g_Config.flash0Directory = std::string(external_dir) + "/flash0/"; #elif PPSSPP_PLATFORM(SWITCH) diff --git a/android/jni/TestRunner.cpp b/android/jni/TestRunner.cpp index c050b21c77..3f9feed41a 100644 --- a/android/jni/TestRunner.cpp +++ b/android/jni/TestRunner.cpp @@ -59,7 +59,7 @@ static std::string TrimNewlines(const std::string &s) { } bool TestsAvailable() { -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) std::string testDirectory = g_Config.flash0Directory + "../"; #else std::string testDirectory = g_Config.memStickDirectory; @@ -74,7 +74,7 @@ bool TestsAvailable() { bool RunTests() { std::string output; -#ifdef IOS +#if PPSSPP_PLATFORM(IOS) std::string baseDirectory = g_Config.flash0Directory + "../"; #else std::string baseDirectory = g_Config.memStickDirectory; diff --git a/ext/xbrz/xbrz.h b/ext/xbrz/xbrz.h index 1f680110ee..e1e57930bb 100644 --- a/ext/xbrz/xbrz.h +++ b/ext/xbrz/xbrz.h @@ -19,8 +19,9 @@ #undef min #undef max +#include "ppsspp_config.h" #include //size_t -#if defined(IOS) +#if PPSSPP_PLATFORM(IOS) #include #else #include //uint32_t diff --git a/libretro/LibretroGLCoreContext.cpp b/libretro/LibretroGLCoreContext.cpp index 7b571bdaf0..0b5a57b91b 100644 --- a/libretro/LibretroGLCoreContext.cpp +++ b/libretro/LibretroGLCoreContext.cpp @@ -1,4 +1,4 @@ - +#include "ppsspp_config.h" #include "Common/Log.h" #include "Core/Config.h" #include "Core/ConfigValues.h" @@ -17,7 +17,7 @@ bool LibretroGLCoreContext::Init() { void LibretroGLCoreContext::CreateDrawContext() { if (!glewInitDone) { -#if !defined(IOS) && !defined(USING_GLES2) +#if !PPSSPP_PLATFORM(IOS) && !defined(USING_GLES2) if (glewInit() != GLEW_OK) { ERROR_LOG(G3D, "glewInit() failed.\n"); return; diff --git a/libretro/Makefile b/libretro/Makefile index 0497a5b1eb..b6d399a518 100644 --- a/libretro/Makefile +++ b/libretro/Makefile @@ -147,7 +147,6 @@ else ifneq (,$(findstring osx,$(platform))) # iOS else ifneq (,$(findstring ios,$(platform))) TARGET := $(TARGET_NAME)_libretro_ios.dylib - PLATCFLAGS += -DIOS LDFLAGS += -dynamiclib -marm fpic = -fPIC GLES = 1 @@ -171,7 +170,7 @@ else ifneq (,$(findstring ios,$(platform))) CXX += -miphoneos-version-min=5.0 PLATCFLAGS += -miphoneos-version-min=5.0 endif - PLATCFLAGS += -DIOS -DHAVE_POSIX_MEMALIGN + PLATCFLAGS += -DHAVE_POSIX_MEMALIGN CPUFLAGS += -DARMv5_ONLY -DARM PLATFORM_EXT := unix TARGET_ARCH = arm diff --git a/ppsspp_config.h b/ppsspp_config.h index e429e629cb..2d6efe6169 100644 --- a/ppsspp_config.h +++ b/ppsspp_config.h @@ -91,16 +91,8 @@ #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