From 70593d1004b5e4d408f4f242d96d98ca2ad26520 Mon Sep 17 00:00:00 2001 From: Florent Castelli Date: Wed, 12 Oct 2016 11:13:16 +0200 Subject: [PATCH] android: Change preprocessor define to standard __ANDROID__ ANDROID is only standard to the old Makefile buildsystem, not the platform. --- CMakeLists.txt | 3 --- Common/ArmEmitter.cpp | 4 ++-- Common/CPUDetect.cpp | 2 +- Common/GL/GLInterface/EGL.h | 2 +- Common/GL/GLInterface/GLInterface.cpp | 4 ++-- Common/KeyMap.cpp | 6 +++--- Common/MemArena.cpp | 6 +++--- Common/MemoryUtil.cpp | 2 +- Common/Swap.h | 2 +- Common/Vulkan/VulkanContext.cpp | 8 ++++---- Common/Vulkan/VulkanContext.h | 8 ++++---- Common/Vulkan/VulkanLoader.cpp | 4 ++-- Common/Vulkan/VulkanLoader.h | 4 ++-- Core/Config.cpp | 4 ++-- Core/Dialog/SavedataParam.cpp | 2 +- Core/FileLoaders/DiskCachingFileLoader.cpp | 8 ++++---- Core/FileLoaders/LocalFileLoader.cpp | 6 +++--- Core/FileSystems/DirectoryFileSystem.cpp | 2 +- Core/HLE/sceRtc.cpp | 2 +- Core/MIPS/MIPSAsm.cpp | 8 ++++---- Core/Reporting.cpp | 2 +- GPU/Common/GPUStateUtils.cpp | 2 +- GPU/GLES/DepalettizeShader.cpp | 2 +- GPU/GLES/Framebuffer.cpp | 8 ++++---- GPU/GLES/GPU_GLES.cpp | 2 +- GPU/GLES/ShaderManager.cpp | 4 ++-- GPU/GLES/StencilBuffer.cpp | 6 +++--- GPU/GPUCommon.h | 8 ++++---- Qt/Platform/android.pri | 1 - UI/DevScreens.cpp | 6 +++--- UI/EmuScreen.cpp | 2 +- UI/GameSettingsScreen.cpp | 18 +++++++++--------- UI/MainScreen.cpp | 8 ++++---- UI/MiscScreens.cpp | 8 ++++---- UI/NativeApp.cpp | 20 ++++++++++---------- UI/TiltEventProcessor.cpp | 2 +- ext/disarm.cpp | 2 +- ext/native/base/QtMain.cpp | 4 ++-- ext/native/base/basictypes.h | 2 +- ext/native/base/logging.h | 2 +- ext/native/base/timeutil.cpp | 2 +- ext/native/ext/cityhash/city.cpp | 2 +- ext/native/file/file_util.cpp | 2 +- ext/native/file/free.cpp | 4 ++-- ext/native/file/path.h | 2 +- ext/native/file/zip_read.cpp | 6 +++--- ext/native/file/zip_read.h | 4 ++-- ext/native/gfx/gl_common.h | 2 +- ext/native/gfx_es2/gpu_features.cpp | 6 +++--- ext/native/image/zim_save.cpp | 2 +- ext/native/net/resolve.cpp | 2 +- ext/native/thread/thread.h | 2 +- ext/native/thread/threadutil.cpp | 6 +++--- headless/Headless.cpp | 4 ++-- 54 files changed, 119 insertions(+), 123 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 004024c4f9..6cae58ed76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,9 +177,6 @@ if(MIPS) add_definitions(-DMIPS) endif() -if(ANDROID) - add_definitions(-DANDROID) -endif() if(IOS) add_definitions(-DIOS) endif() diff --git a/Common/ArmEmitter.cpp b/Common/ArmEmitter.cpp index 7edc56e237..ebf5368775 100644 --- a/Common/ArmEmitter.cpp +++ b/Common/ArmEmitter.cpp @@ -34,7 +34,7 @@ #include "CPUDetect.h" // Want it in release builds too -#ifdef ANDROID +#ifdef __ANDROID__ #undef _dbg_assert_msg_ #define _dbg_assert_msg_ _assert_msg_ #endif @@ -628,7 +628,7 @@ void ARMXEmitter::FlushIcacheSection(u8 *start, u8 *end) sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start); #elif !defined(_WIN32) #if defined(ARM) -#if defined(__clang__) || defined(ANDROID) +#if defined(__clang__) || defined(__ANDROID__) __clear_cache(start, end); #else __builtin___clear_cache(start, end); diff --git a/Common/CPUDetect.cpp b/Common/CPUDetect.cpp index 97f39385da..7d996841a7 100644 --- a/Common/CPUDetect.cpp +++ b/Common/CPUDetect.cpp @@ -17,7 +17,7 @@ #if defined(_M_IX86) || defined(_M_X64) -#ifdef ANDROID +#ifdef __ANDROID__ #include #include #endif diff --git a/Common/GL/GLInterface/EGL.h b/Common/GL/GLInterface/EGL.h index beb7377449..65169b91da 100644 --- a/Common/GL/GLInterface/EGL.h +++ b/Common/GL/GLInterface/EGL.h @@ -9,7 +9,7 @@ #include "Common/GL/GLInterfaceBase.h" -#ifdef ANDROID +#ifdef __ANDROID__ // On Android, EGL creation is so early that our regular logging system is not // up and running yet. Use Android logging. #include "base/logging.h" diff --git a/Common/GL/GLInterface/GLInterface.cpp b/Common/GL/GLInterface/GLInterface.cpp index bf8d729745..6a8202aaf1 100644 --- a/Common/GL/GLInterface/GLInterface.cpp +++ b/Common/GL/GLInterface/GLInterface.cpp @@ -4,7 +4,7 @@ #include "Common/GL/GLInterfaceBase.h" -#ifdef ANDROID +#ifdef __ANDROID__ #include "Common/GL/GLInterface/EGLAndroid.h" #elif defined(__APPLE__) #include "Common/GL/GLInterface/AGL.h" @@ -21,7 +21,7 @@ #endif cInterfaceBase* HostGL_CreateGLInterface(){ - #ifdef ANDROID + #ifdef __ANDROID__ return new cInterfaceEGLAndroid; #elif defined(__APPLE__) return new cInterfaceAGL; diff --git a/Common/KeyMap.cpp b/Common/KeyMap.cpp index 97b1367521..bd81b1fe5b 100644 --- a/Common/KeyMap.cpp +++ b/Common/KeyMap.cpp @@ -184,7 +184,7 @@ static const DefMappingStruct defaultShieldKeyMap[] = { }; static const DefMappingStruct defaultPadMap[] = { -#if defined(ANDROID) +#if defined(__ANDROID__) {CTRL_CROSS , NKCODE_BUTTON_A}, {CTRL_CIRCLE , NKCODE_BUTTON_B}, {CTRL_SQUARE , NKCODE_BUTTON_X}, @@ -289,7 +289,7 @@ void UpdateNativeMenuKeys() { KeyFromPspButton(CTRL_LEFT, &leftKeys); KeyFromPspButton(CTRL_RIGHT, &rightKeys); -#ifdef ANDROID +#ifdef __ANDROID__ // Hardcode DPAD on Android upKeys.push_back(KeyDef(DEVICE_ID_ANY, NKCODE_DPAD_UP)); downKeys.push_back(KeyDef(DEVICE_ID_ANY, NKCODE_DPAD_DOWN)); @@ -835,7 +835,7 @@ void RestoreDefault() { SetDefaultKeyMap(DEFAULT_MAPPING_KEYBOARD, true); SetDefaultKeyMap(DEFAULT_MAPPING_X360, false); SetDefaultKeyMap(DEFAULT_MAPPING_PAD, false); -#elif defined(ANDROID) +#elif defined(__ANDROID__) // Autodetect a few common devices std::string name = System_GetProperty(SYSPROP_NAME); if (IsNvidiaShield(name) || IsNvidiaShieldTV(name)) { diff --git a/Common/MemArena.cpp b/Common/MemArena.cpp index 9613f7a973..fe58a6666c 100644 --- a/Common/MemArena.cpp +++ b/Common/MemArena.cpp @@ -29,13 +29,13 @@ #include #include #include -#ifdef ANDROID +#ifdef __ANDROID__ #include #include #endif #endif -#ifdef ANDROID +#ifdef __ANDROID__ // Hopefully this ABI will never change... @@ -131,7 +131,7 @@ void MemArena::GrabLowMemSpace(size_t size) hMemoryMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (DWORD)(size), NULL); GetSystemInfo(&sysInfo); #endif -#elif defined(ANDROID) +#elif defined(__ANDROID__) // Use ashmem so we don't have to allocate a file on disk! fd = ashmem_create_region("PPSSPP_RAM", size); // Note that it appears that ashmem is pinned by default, so no need to pin. diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index d16f71d767..8f31fc25ba 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -212,7 +212,7 @@ void *AllocateAlignedMemory(size_t size, size_t alignment) { void* ptr = _aligned_malloc(size,alignment); #else void* ptr = NULL; -#ifdef ANDROID +#ifdef __ANDROID__ ptr = memalign(alignment, size); #else if (posix_memalign(&ptr, alignment, size) != 0) diff --git a/Common/Swap.h b/Common/Swap.h index f499f84322..68b6893c14 100644 --- a/Common/Swap.h +++ b/Common/Swap.h @@ -18,7 +18,7 @@ #pragma once // Android -#if defined(ANDROID) +#if defined(__ANDROID__) #include #if _BYTE_ORDER == _LITTLE_ENDIAN && !defined(COMMON_LITTLE_ENDIAN) diff --git a/Common/Vulkan/VulkanContext.cpp b/Common/Vulkan/VulkanContext.cpp index d07cc7f6b1..1bf6e8d644 100644 --- a/Common/Vulkan/VulkanContext.cpp +++ b/Common/Vulkan/VulkanContext.cpp @@ -57,7 +57,7 @@ VulkanContext::VulkanContext(const char *app_name, int app_ver, uint32_t flags) #ifdef _WIN32 connection(nullptr), window(nullptr), -#elif defined(ANDROID) +#elif defined(__ANDROID__) native_window(nullptr), #endif graphics_queue_family_index_(-1), @@ -81,7 +81,7 @@ VulkanContext::VulkanContext(const char *app_name, int app_ver, uint32_t flags) instance_extension_names.push_back(VK_KHR_SURFACE_EXTENSION_NAME); #ifdef _WIN32 instance_extension_names.push_back(VK_KHR_WIN32_SURFACE_EXTENSION_NAME); -#elif defined(ANDROID) +#elif defined(__ANDROID__) instance_extension_names.push_back(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME); #endif device_extension_names.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME); @@ -830,7 +830,7 @@ void VulkanContext::ReinitSurfaceWin32() { assert(res == VK_SUCCESS); } -#elif defined(ANDROID) +#elif defined(__ANDROID__) void VulkanContext::InitSurfaceAndroid(ANativeWindow *wnd, int width, int height) { native_window = wnd; @@ -999,7 +999,7 @@ void VulkanContext::InitSwapchain(VkCommandBuffer cmd) { break; } } -#ifdef ANDROID +#ifdef __ANDROID__ // HACK swapchainPresentMode = VK_PRESENT_MODE_FIFO_KHR; #endif diff --git a/Common/Vulkan/VulkanContext.h b/Common/Vulkan/VulkanContext.h index befe805900..2b336f4239 100644 --- a/Common/Vulkan/VulkanContext.h +++ b/Common/Vulkan/VulkanContext.h @@ -1,7 +1,7 @@ #ifndef UTIL_INIT #define UTIL_INIT -#ifdef ANDROID +#ifdef __ANDROID__ #undef NDEBUG // asserts #endif #include @@ -17,7 +17,7 @@ #define NOMINMAX /* Don't let Windows define min() or max() */ #define APP_NAME_STR_LEN 80 #include -#elif defined(ANDROID) // _WIN32 +#elif defined(__ANDROID__) // _WIN32 #include #define VK_USE_PLATFORM_ANDROID_KHR #else @@ -201,7 +201,7 @@ public: #ifdef _WIN32 void InitSurfaceWin32(HINSTANCE conn, HWND wnd); void ReinitSurfaceWin32(); -#elif ANDROID +#elif __ANDROID__ void InitSurfaceAndroid(ANativeWindow *native_window, int width, int height); void ReinitSurfaceAndroid(int width, int height); #endif @@ -294,7 +294,7 @@ private: #ifdef _WIN32 HINSTANCE connection; // hInstance - Windows Instance HWND window; // hWnd - window handle -#elif ANDROID // _WIN32 +#elif __ANDROID__ // _WIN32 ANativeWindow *native_window; #endif // _WIN32 diff --git a/Common/Vulkan/VulkanLoader.cpp b/Common/Vulkan/VulkanLoader.cpp index 559a7bec88..97ea7d4fa7 100644 --- a/Common/Vulkan/VulkanLoader.cpp +++ b/Common/Vulkan/VulkanLoader.cpp @@ -161,7 +161,7 @@ PFN_vkCmdNextSubpass vkCmdNextSubpass; PFN_vkCmdEndRenderPass vkCmdEndRenderPass; PFN_vkCmdExecuteCommands vkCmdExecuteCommands; -#ifdef ANDROID +#ifdef __ANDROID__ PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; #elif defined(_WIN32) PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; @@ -366,7 +366,7 @@ void VulkanLoadInstanceFunctions(VkInstance instance) { #ifdef _WIN32 LOAD_INSTANCE_FUNC(instance, vkCreateWin32SurfaceKHR); -#elif defined(ANDROID) +#elif defined(__ANDROID__) LOAD_INSTANCE_FUNC(instance, vkCreateAndroidSurfaceKHR); #endif diff --git a/Common/Vulkan/VulkanLoader.h b/Common/Vulkan/VulkanLoader.h index 5c36804596..b6f8beaccf 100644 --- a/Common/Vulkan/VulkanLoader.h +++ b/Common/Vulkan/VulkanLoader.h @@ -17,7 +17,7 @@ #pragma once -#ifdef ANDROID +#ifdef __ANDROID__ #define VK_USE_PLATFORM_ANDROID_KHR #elif defined(_WIN32) #define VK_USE_PLATFORM_WIN32_KHR @@ -167,7 +167,7 @@ extern PFN_vkCmdNextSubpass vkCmdNextSubpass; extern PFN_vkCmdEndRenderPass vkCmdEndRenderPass; extern PFN_vkCmdExecuteCommands vkCmdExecuteCommands; -#ifdef ANDROID +#ifdef __ANDROID__ extern PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR; #elif defined(_WIN32) extern PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR; diff --git a/Core/Config.cpp b/Core/Config.cpp index c354c2faa5..546e600829 100644 --- a/Core/Config.cpp +++ b/Core/Config.cpp @@ -344,7 +344,7 @@ static ConfigSetting generalSettings[] = { ConfigSetting("CacheFullIsoInRam", &g_Config.bCacheFullIsoInRam, false, true, true), ConfigSetting("RemoteISOPort", &g_Config.iRemoteISOPort, 0, true, false), -#ifdef ANDROID +#ifdef __ANDROID__ ConfigSetting("ScreenRotation", &g_Config.iScreenRotation, 1), #endif ConfigSetting("InternalScreenRotation", &g_Config.iInternalScreenRotation, 1), @@ -411,7 +411,7 @@ static bool DefaultTimerHack() { } static int DefaultAndroidHwScale() { -#ifdef ANDROID +#ifdef __ANDROID__ // Get the real resolution as passed in during startup, not dp_xres and stuff int xres = System_GetPropertyInt(SYSPROP_DISPLAY_XRES); int yres = System_GetPropertyInt(SYSPROP_DISPLAY_YRES); diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 1722e7f877..3e762bd183 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -207,7 +207,7 @@ void SavedataParam::Init() pspFileSystem.MkDir(savePath); } // Create a nomedia file to hide save icons form Android image viewer -#ifdef ANDROID +#ifdef __ANDROID__ int handle = pspFileSystem.OpenFile(savePath + ".nomedia", (FileAccess)(FILEACCESS_CREATE | FILEACCESS_WRITE), 0); if (handle) { pspFileSystem.CloseFile(handle); diff --git a/Core/FileLoaders/DiskCachingFileLoader.cpp b/Core/FileLoaders/DiskCachingFileLoader.cpp index 27c512ce3f..749b7fefe9 100644 --- a/Core/FileLoaders/DiskCachingFileLoader.cpp +++ b/Core/FileLoaders/DiskCachingFileLoader.cpp @@ -455,7 +455,7 @@ bool DiskCachingFileLoaderCache::ReadBlockData(u8 *dest, BlockInfo &info, size_t fflush(f_); bool failed = false; -#ifdef ANDROID +#ifdef __ANDROID__ if (lseek64(fd_, blockOffset, SEEK_SET) != blockOffset) { failed = true; } else if (read(fd_, dest + offset, size) != (ssize_t)size) { @@ -483,7 +483,7 @@ void DiskCachingFileLoaderCache::WriteBlockData(BlockInfo &info, u8 *src) { s64 blockOffset = GetBlockOffset(info.block); bool failed = false; -#ifdef ANDROID +#ifdef __ANDROID__ if (lseek64(fd_, blockOffset, SEEK_SET) != blockOffset) { failed = true; } else if (write(fd_, src, blockSize_) != (ssize_t)blockSize_) { @@ -548,7 +548,7 @@ bool DiskCachingFileLoaderCache::LoadCacheFile(const std::string &path) { if (valid) { f_ = fp; -#ifdef ANDROID +#ifdef __ANDROID__ // Android NDK does not support 64-bit file I/O using C streams fd_ = fileno(f_); #endif @@ -626,7 +626,7 @@ void DiskCachingFileLoaderCache::CreateCacheFile(const std::string &path) { ERROR_LOG(LOADER, "Could not create disk cache file"); return; } -#ifdef ANDROID +#ifdef __ANDROID__ // Android NDK does not support 64-bit file I/O using C streams fd_ = fileno(f_); #endif diff --git a/Core/FileLoaders/LocalFileLoader.cpp b/Core/FileLoaders/LocalFileLoader.cpp index 4d94918e21..a6fe9abba2 100644 --- a/Core/FileLoaders/LocalFileLoader.cpp +++ b/Core/FileLoaders/LocalFileLoader.cpp @@ -27,7 +27,7 @@ LocalFileLoader::LocalFileLoader(const std::string &filename) return; } -#ifdef ANDROID +#ifdef __ANDROID__ // Android NDK does not support 64-bit file I/O using C streams // so we fall back onto syscalls fd_ = fileno(f_); @@ -74,7 +74,7 @@ std::string LocalFileLoader::Path() const { } void LocalFileLoader::Seek(s64 absolutePos) { -#ifdef ANDROID +#ifdef __ANDROID__ lseek64(fd_, absolutePos, SEEK_SET); #else fseeko(f_, absolutePos, SEEK_SET); @@ -82,7 +82,7 @@ void LocalFileLoader::Seek(s64 absolutePos) { } size_t LocalFileLoader::Read(size_t bytes, size_t count, void *data, Flags flags) { -#ifdef ANDROID +#ifdef __ANDROID__ return read(fd_, data, bytes * count) / bytes; #else return fread(data, bytes, count, f_); diff --git a/Core/FileSystems/DirectoryFileSystem.cpp b/Core/FileSystems/DirectoryFileSystem.cpp index 0ba37fbef5..b7639e9fcf 100644 --- a/Core/FileSystems/DirectoryFileSystem.cpp +++ b/Core/FileSystems/DirectoryFileSystem.cpp @@ -36,7 +36,7 @@ #include #include #include -#if defined(ANDROID) +#if defined(__ANDROID__) #include #include #define statvfs statfs diff --git a/Core/HLE/sceRtc.cpp b/Core/HLE/sceRtc.cpp index d368dec02a..4d23fc5661 100644 --- a/Core/HLE/sceRtc.cpp +++ b/Core/HLE/sceRtc.cpp @@ -97,7 +97,7 @@ time_t rtc_timegm(struct tm *tm) return _mkgmtime(tm); } -#elif (defined(__GLIBC__) && !defined(ANDROID)) +#elif (defined(__GLIBC__) && !defined(__ANDROID__)) #define rtc_timegm timegm #else diff --git a/Core/MIPS/MIPSAsm.cpp b/Core/MIPS/MIPSAsm.cpp index f176e293fd..de816a65b2 100644 --- a/Core/MIPS/MIPSAsm.cpp +++ b/Core/MIPS/MIPSAsm.cpp @@ -7,7 +7,7 @@ #include "Common/CommonTypes.h" -#if defined(_WIN32) || defined(ANDROID) +#if defined(_WIN32) || defined(__ANDROID__) // This has to be before basictypes to avoid a define conflict. #include "ext/armips/Core/Assembler.h" #endif @@ -27,7 +27,7 @@ std::wstring GetAssembleError() return errorText; } -#if defined(_WIN32) || defined(ANDROID) +#if defined(_WIN32) || defined(__ANDROID__) class PspAssemblerFile: public AssemblerFile { public: @@ -71,7 +71,7 @@ private: bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address) { -#if defined(_WIN32) || defined(ANDROID) +#if defined(_WIN32) || defined(__ANDROID__) PspAssemblerFile file; StringList errors; @@ -107,4 +107,4 @@ bool MipsAssembleOpcode(const char* line, DebugInterface* cpu, u32 address) #endif } -} \ No newline at end of file +} diff --git a/Core/Reporting.cpp b/Core/Reporting.cpp index 0ac9ac4aae..ada5a47d59 100644 --- a/Core/Reporting.cpp +++ b/Core/Reporting.cpp @@ -250,7 +250,7 @@ namespace Reporting std::string GetPlatformIdentifer() { // TODO: Do we care about OS version? -#if defined(ANDROID) +#if defined(__ANDROID__) return "Android"; #elif defined(_WIN64) return "Windows 64"; diff --git a/GPU/Common/GPUStateUtils.cpp b/GPU/Common/GPUStateUtils.cpp index 88467536e0..4ee8ba04a0 100644 --- a/GPU/Common/GPUStateUtils.cpp +++ b/GPU/Common/GPUStateUtils.cpp @@ -1105,7 +1105,7 @@ void ConvertBlendState(GenericBlendState &blendState, bool allowShaderBlend) { // Some Android devices (especially old Mali, it seems) composite badly if there's alpha in the backbuffer. // So in non-buffered rendering, we will simply consider the dest alpha to be zero in blending equations. -#ifdef ANDROID +#ifdef __ANDROID__ if (g_Config.iRenderingMode == FB_NON_BUFFERED_MODE) { if (glBlendFuncA == BlendFactor::DST_ALPHA) glBlendFuncA = BlendFactor::ZERO; if (glBlendFuncB == BlendFactor::DST_ALPHA) glBlendFuncB = BlendFactor::ZERO; diff --git a/GPU/GLES/DepalettizeShader.cpp b/GPU/GLES/DepalettizeShader.cpp index 65155778e0..0b21ab31b0 100644 --- a/GPU/GLES/DepalettizeShader.cpp +++ b/GPU/GLES/DepalettizeShader.cpp @@ -69,7 +69,7 @@ static bool CheckShaderCompileSuccess(GLuint shader, const char *code) { GLsizei len; glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog); infoLog[len] = '\0'; -#ifdef ANDROID +#ifdef __ANDROID__ ELOG("Error in shader compilation! %s\n", infoLog); ELOG("Shader source:\n%s\n", (const char *)code); #endif diff --git a/GPU/GLES/Framebuffer.cpp b/GPU/GLES/Framebuffer.cpp index fe208eed35..96047333c1 100644 --- a/GPU/GLES/Framebuffer.cpp +++ b/GPU/GLES/Framebuffer.cpp @@ -790,9 +790,9 @@ void FramebufferManager::BlitFramebufferDepth(VirtualFramebuffer *src, VirtualFr glstate.scissorTest.force(false); if (useNV) { -#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC. +#if defined(USING_GLES2) && defined(__ANDROID__) // We only support this extension on Android, it's not even available on PC. glBlitFramebufferNV(0, 0, w, h, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST); -#endif // defined(USING_GLES2) && defined(ANDROID) +#endif // defined(USING_GLES2) && defined(__ANDROID__) } else { glBlitFramebuffer(0, 0, w, h, 0, 0, w, h, GL_DEPTH_BUFFER_BIT, GL_NEAREST); } @@ -1331,9 +1331,9 @@ void FramebufferManager::BlitFramebuffer(VirtualFramebuffer *dst, int dstX, int if (!useNV) { glBlitFramebuffer(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, GL_COLOR_BUFFER_BIT, GL_NEAREST); } else { -#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC. +#if defined(USING_GLES2) && defined(__ANDROID__) // We only support this extension on Android, it's not even available on PC. glBlitFramebufferNV(srcX1, srcY1, srcX2, srcY2, dstX1, dstY1, dstX2, dstY2, GL_COLOR_BUFFER_BIT, GL_NEAREST); -#endif // defined(USING_GLES2) && defined(ANDROID) +#endif // defined(USING_GLES2) && defined(__ANDROID__) } fbo_unbind_read(); diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index e85b095453..43da9047d1 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -492,7 +492,7 @@ void GPU_GLES::CheckGPUFeatures() { // Don't use this extension to off on sub 3.0 OpenGL versions as it does not seem reliable // Also on Intel, see https://github.com/hrydgard/ppsspp/issues/4867 } else { -#ifdef ANDROID +#ifdef __ANDROID__ // This appears to be broken on nVidia Shield TV. if (gl_extensions.gpuVendor != GPU_VENDOR_NVIDIA) { features |= GPU_SUPPORTS_DUALSOURCE_BLEND; diff --git a/GPU/GLES/ShaderManager.cpp b/GPU/GLES/ShaderManager.cpp index 9e49c236dc..4f6e43fabb 100644 --- a/GPU/GLES/ShaderManager.cpp +++ b/GPU/GLES/ShaderManager.cpp @@ -66,7 +66,7 @@ Shader::Shader(const char *code, uint32_t glShaderType, bool useHWTransform) GLsizei len; glGetShaderInfoLog(shader, MAX_INFO_LOG_SIZE, &len, infoLog); infoLog[len] = '\0'; -#ifdef ANDROID +#ifdef __ANDROID__ ELOG("Error in shader compilation! %s\n", infoLog); ELOG("Shader source:\n%s\n", (const char *)code); #endif @@ -136,7 +136,7 @@ LinkedShader::LinkedShader(ShaderID VSID, Shader *vs, ShaderID FSID, Shader *fs, if (bufLength) { char* buf = new char[bufLength]; glGetProgramInfoLog(program, bufLength, NULL, buf); -#ifdef ANDROID +#ifdef __ANDROID__ ELOG("Could not link program:\n %s", buf); #endif ERROR_LOG(G3D, "Could not link program:\n %s", buf); diff --git a/GPU/GLES/StencilBuffer.cpp b/GPU/GLES/StencilBuffer.cpp index 5454876315..4c694145ff 100644 --- a/GPU/GLES/StencilBuffer.cpp +++ b/GPU/GLES/StencilBuffer.cpp @@ -226,12 +226,12 @@ bool FramebufferManager::NotifyStencilUpload(u32 addr, int size, bool skipZero) if (!useNV) { glBlitFramebuffer(0, 0, w, h, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, GL_STENCIL_BUFFER_BIT, GL_NEAREST); } else { -#if defined(USING_GLES2) && defined(ANDROID) // We only support this extension on Android, it's not even available on PC. +#if defined(USING_GLES2) && defined(__ANDROID__) // We only support this extension on Android, it's not even available on PC. glBlitFramebufferNV(0, 0, w, h, 0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight, GL_STENCIL_BUFFER_BIT, GL_NEAREST); -#endif // defined(USING_GLES2) && defined(ANDROID) +#endif // defined(USING_GLES2) && defined(__ANDROID__) } } RebindFramebuffer(); return true; -} \ No newline at end of file +} diff --git a/GPU/GPUCommon.h b/GPU/GPUCommon.h index bec039e544..cf63a877c4 100644 --- a/GPU/GPUCommon.h +++ b/GPU/GPUCommon.h @@ -6,7 +6,7 @@ #include "GPU/GPUInterface.h" #include "GPU/Common/GPUDebugInterface.h" -#if defined(ANDROID) +#if defined(__ANDROID__) #include #elif defined(_M_SSE) #include @@ -64,7 +64,7 @@ public: void Execute_End(u32 op, u32 diff); u64 GetTickEstimate() override { -#if defined(_M_X64) || defined(ANDROID) +#if defined(_M_X64) || defined(__ANDROID__) return curTickEst_; #elif defined(_M_SSE) __m64 result = *(__m64 *)&curTickEst_; @@ -195,7 +195,7 @@ protected: private: // For CPU/GPU sync. -#ifdef ANDROID +#ifdef __ANDROID__ std::atomic curTickEst_; #else volatile MEMORY_ALIGNED16(u64) curTickEst_; @@ -203,7 +203,7 @@ private: #endif inline void UpdateTickEstimate(u64 value) { -#if defined(_M_X64) || defined(ANDROID) +#if defined(_M_X64) || defined(__ANDROID__) curTickEst_ = value; #elif defined(_M_SSE) __m64 result = *(__m64 *)&value; diff --git a/Qt/Platform/android.pri b/Qt/Platform/android.pri index f7df4ab671..85f5bd548b 100644 --- a/Qt/Platform/android.pri +++ b/Qt/Platform/android.pri @@ -1,4 +1,3 @@ -DEFINES += ANDROID INCLUDEPATH += $$P/ext/native/ext/libzip !contains(CONFIG, staticlib) { diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 42712bc111..267b54fd9e 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -363,7 +363,7 @@ void SystemInfoScreen::CreateViews() { } #endif -#ifdef ANDROID +#ifdef __ANDROID__ deviceSpecs->Add(new ItemHeader("Audio Information")); deviceSpecs->Add(new InfoItem("Sample rate", StringFromFormat("%d Hz", System_GetPropertyInt(SYSPROP_AUDIO_SAMPLE_RATE)))); deviceSpecs->Add(new InfoItem("Frames per buffer", StringFromFormat("%d", System_GetPropertyInt(SYSPROP_AUDIO_FRAMES_PER_BUFFER)))); @@ -394,7 +394,7 @@ void SystemInfoScreen::CreateViews() { deviceSpecs->Add(new InfoItem("API Version", apiVersion)); deviceSpecs->Add(new InfoItem("Shading Language", thin3d->GetInfoString(T3DInfo::SHADELANGVERSION))); -#ifdef ANDROID +#ifdef __ANDROID__ std::string moga = System_GetProperty(SYSPROP_MOGA_VERSION); if (moga.empty()) { moga = "(none detected)"; @@ -402,7 +402,7 @@ void SystemInfoScreen::CreateViews() { deviceSpecs->Add(new InfoItem("Moga", moga)); #endif -#ifdef ANDROID +#ifdef __ANDROID__ char temp[256]; sprintf(temp, "%dx%d", System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)); deviceSpecs->Add(new InfoItem("Display resolution", temp)); diff --git a/UI/EmuScreen.cpp b/UI/EmuScreen.cpp index 5cd0d88463..1a1b630aa0 100644 --- a/UI/EmuScreen.cpp +++ b/UI/EmuScreen.cpp @@ -244,7 +244,7 @@ void EmuScreen::bootComplete() { if (Core_GetPowerSaving()) { I18NCategory *sy = GetI18NCategory("System"); -#ifdef ANDROID +#ifdef __ANDROID__ osm.Show(sy->T("WARNING: Android battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving"); #else osm.Show(sy->T("WARNING: Battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving"); diff --git a/UI/GameSettingsScreen.cpp b/UI/GameSettingsScreen.cpp index f2f53b333f..6d79944d5c 100644 --- a/UI/GameSettingsScreen.cpp +++ b/UI/GameSettingsScreen.cpp @@ -201,7 +201,7 @@ void GameSettingsScreen::CreateViews() { displayEditor_ = graphicsSettings->Add(new Choice(gr->T("Display layout editor"))); displayEditor_->OnClick.Handle(this, &GameSettingsScreen::OnDisplayLayoutEditor); -#ifdef ANDROID +#ifdef __ANDROID__ // Hide Immersive Mode on pre-kitkat Android if (System_GetPropertyInt(SYSPROP_SYSTEMVERSION) >= 19) { graphicsSettings->Add(new CheckBox(&g_Config.bImmersiveMode, gr->T("Immersive Mode")))->OnClick.Handle(this, &GameSettingsScreen::OnImmersiveModeChange); @@ -219,7 +219,7 @@ void GameSettingsScreen::CreateViews() { resolutionEnable_ = !g_Config.bSoftwareRendering && (g_Config.iRenderingMode != FB_NON_BUFFERED_MODE); resolutionChoice_->SetEnabledPtr(&resolutionEnable_); -#ifdef ANDROID +#ifdef __ANDROID__ static const char *deviceResolutions[] = { "Native device resolution", "Auto (same as Rendering)", "1x PSP", "2x PSP", "3x PSP", "4x PSP", "5x PSP" }; int max_res_temp = std::max(System_GetPropertyInt(SYSPROP_DISPLAY_XRES), System_GetPropertyInt(SYSPROP_DISPLAY_YRES)) / 480 + 2; if (max_res_temp == 3) @@ -318,7 +318,7 @@ void GameSettingsScreen::CreateViews() { static const char *bufFilters[] = { "Linear", "Nearest", }; graphicsSettings->Add(new PopupMultiChoice(&g_Config.iBufFilter, gr->T("Screen Scaling Filter"), bufFilters, 1, ARRAY_SIZE(bufFilters), gr->GetName(), screenManager())); -#ifdef ANDROID +#ifdef __ANDROID__ graphicsSettings->Add(new ItemHeader(gr->T("Cardboard Settings", "Cardboard Settings"))); CheckBox *cardboardMode = graphicsSettings->Add(new CheckBox(&g_Config.bEnableCardboard, gr->T("Enable Cardboard", "Enable Cardboard"))); cardboardMode->SetDisabledPtr(&g_Config.bSoftwareRendering); @@ -524,7 +524,7 @@ void GameSettingsScreen::CreateViews() { #ifdef _WIN32 networkingSettings->Add(new PopupTextInputChoice(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), "", 255, screenManager())); -#elif defined(ANDROID) +#elif defined(__ANDROID__) networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress); #else networkingSettings->Add(new ChoiceWithValueDisplay(&g_Config.proAdhocServer, n->T("Change proAdhocServer Address"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeproAdhocServerAddress); @@ -588,7 +588,7 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new ItemHeader(sy->T("General"))); -#ifdef ANDROID +#ifdef __ANDROID__ if (System_GetPropertyInt(SYSPROP_DEVICE_TYPE) == DEVICE_TYPE_MOBILE) { static const char *screenRotation[] = {"Auto", "Landscape", "Portrait", "Landscape Reversed", "Portrait Reversed"}; PopupMultiChoice *rot = systemSettings->Add(new PopupMultiChoice(&g_Config.iScreenRotation, co->T("Screen Rotation"), screenRotation, 0, ARRAY_SIZE(screenRotation), co->GetName(), screenManager())); @@ -652,7 +652,7 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new CheckBox(&g_Config.bCacheFullIsoInRam, sy->T("Cache ISO in RAM", "Cache full ISO in RAM"))); #endif -//#ifndef ANDROID +//#ifndef __ANDROID__ systemSettings->Add(new ItemHeader(sy->T("Cheats", "Cheats (experimental, see forums)"))); systemSettings->Add(new CheckBox(&g_Config.bEnableCheats, sy->T("Enable Cheats"))); //#endif @@ -667,7 +667,7 @@ void GameSettingsScreen::CreateViews() { systemSettings->Add(new PopupTextInputChoice(&g_Config.sNickName, sy->T("Change Nickname"), "", 32, screenManager())); #elif defined(USING_QT_UI) systemSettings->Add(new Choice(sy->T("Change Nickname")))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); -#elif defined(ANDROID) +#elif defined(__ANDROID__) systemSettings->Add(new ChoiceWithValueDisplay(&g_Config.sNickName, sy->T("Change Nickname"), nullptr))->OnClick.Handle(this, &GameSettingsScreen::OnChangeNickname); #endif #if defined(_WIN32) || (defined(USING_QT_UI) && !defined(MOBILE_DEVICE)) @@ -977,7 +977,7 @@ UI::EventReturn GameSettingsScreen::OnChangeNickname(UI::EventParams &e) { if (System_InputBoxGetString("Enter a new PSP nickname", g_Config.sNickName.c_str(), name, name_len)) { g_Config.sNickName = name; } -#elif defined(ANDROID) +#elif defined(__ANDROID__) System_SendMessage("inputbox", ("nickname:" + g_Config.sNickName).c_str()); #endif return UI::EVENT_DONE; @@ -997,7 +997,7 @@ UI::EventReturn GameSettingsScreen::OnChangeproAdhocServerAddress(UI::EventParam } else screenManager()->push(new ProAdhocServerScreen); -#elif defined(ANDROID) +#elif defined(__ANDROID__) System_SendMessage("inputbox", ("IP:" + g_Config.proAdhocServer).c_str()); #else screenManager()->push(new ProAdhocServerScreen); diff --git a/UI/MainScreen.cpp b/UI/MainScreen.cpp index bd6d2880db..cf5b53d9a8 100644 --- a/UI/MainScreen.cpp +++ b/UI/MainScreen.cpp @@ -420,7 +420,7 @@ UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) { } UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) { -#ifdef ANDROID +#ifdef __ANDROID__ path_.SetPath(g_Config.memStickDirectory); #elif defined(USING_QT_UI) I18NCategory *mm = GetI18NCategory("MainMenu"); @@ -900,7 +900,7 @@ UI::EventReturn MainScreen::OnAllowStorage(UI::EventParams &e) { } UI::EventReturn MainScreen::OnDownloadUpgrade(UI::EventParams &e) { -#ifdef ANDROID +#ifdef __ANDROID__ // Go to app store #ifdef GOLD LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); @@ -1116,7 +1116,7 @@ UI::EventReturn MainScreen::OnHomebrewStore(UI::EventParams &e) { } UI::EventReturn MainScreen::OnSupport(UI::EventParams &e) { -#ifdef ANDROID +#ifdef __ANDROID__ LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); #else LaunchBrowser("http://central.ppsspp.org/buygold"); @@ -1143,7 +1143,7 @@ UI::EventReturn MainScreen::OnExit(UI::EventParams &e) { // However, let's make sure the config was saved, since it may not have been. g_Config.Save(); -#ifdef ANDROID +#ifdef __ANDROID__ #ifdef ANDROID_NDK_PROFILER moncleanup(); #endif diff --git a/UI/MiscScreens.cpp b/UI/MiscScreens.cpp index 8e854558ef..e45434fe3e 100644 --- a/UI/MiscScreens.cpp +++ b/UI/MiscScreens.cpp @@ -494,7 +494,7 @@ void CreditsScreen::CreateViews() { #endif root_->Add(new Button(cr->T("PPSSPP Forums"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnForums); root_->Add(new Button("www.ppsspp.org", new AnchorLayoutParams(260, 64, 10, NONE, NONE, 158, false)))->OnClick.Handle(this, &CreditsScreen::OnPPSSPPOrg); -#ifdef ANDROID +#ifdef __ANDROID__ root_->Add(new Button(cr->T("Share PPSSPP"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnShare); root_->Add(new Button(cr->T("Twitter @PPSSPP_emu"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, 154, false)))->OnClick.Handle(this, &CreditsScreen::OnTwitter); #endif @@ -506,7 +506,7 @@ void CreditsScreen::CreateViews() { } UI::EventReturn CreditsScreen::OnSupport(UI::EventParams &e) { -#ifdef ANDROID +#ifdef __ANDROID__ LaunchBrowser("market://details?id=org.ppsspp.ppssppgold"); #else LaunchBrowser("http://central.ppsspp.org/buygold"); @@ -515,7 +515,7 @@ UI::EventReturn CreditsScreen::OnSupport(UI::EventParams &e) { } UI::EventReturn CreditsScreen::OnTwitter(UI::EventParams &e) { -#ifdef ANDROID +#ifdef __ANDROID__ System_SendMessage("showTwitter", "PPSSPP_emu"); #else LaunchBrowser("https://twitter.com/#!/PPSSPP_emu"); @@ -629,7 +629,7 @@ void CreditsScreen::render() { "", "", cr->T("tools", "Free tools used:"), -#ifdef ANDROID +#ifdef __ANDROID__ "Android SDK + NDK", #endif #if defined(USING_QT_UI) diff --git a/UI/NativeApp.cpp b/UI/NativeApp.cpp index 823dfd4145..eaf6da1d2b 100644 --- a/UI/NativeApp.cpp +++ b/UI/NativeApp.cpp @@ -99,9 +99,9 @@ static UI::Theme ui_theme; -#if defined(ARM) && defined(ANDROID) +#if defined(ARM) && defined(__ANDROID__) #include "../../android/jni/ArmEmitterTest.h" -#elif defined(ARM64) && defined(ANDROID) +#elif defined(ARM64) && defined(__ANDROID__) #include "../../android/jni/Arm64EmitterTest.h" #endif @@ -262,9 +262,9 @@ void NativeGetAppInfo(std::string *app_dir_name, std::string *app_nice_name, boo *landscape = true; *version = PPSSPP_GIT_VERSION; -#if defined(ARM) && defined(ANDROID) +#if defined(ARM) && defined(__ANDROID__) ArmEmitterTest(); -#elif defined(ARM64) && defined(ANDROID) +#elif defined(ARM64) && defined(__ANDROID__) Arm64EmitterTest(); #endif } @@ -329,7 +329,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch host = new NativeHost(); #endif -#if defined(ANDROID) +#if defined(__ANDROID__) g_Config.internalDataDirectory = savegame_dir; // Maybe there should be an option to use internal memory instead, but I think // that for most people, using external memory (SDCard/USB Storage) makes the @@ -370,7 +370,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch #endif LogManager *logman = LogManager::GetInstance(); -#ifdef ANDROID +#ifdef __ANDROID__ // On Android, create a PSP directory tree in the external_dir, // to hopefully reduce confusion a bit. ILOG("Creating %s", (g_Config.memStickDirectory + "PSP").c_str()); @@ -444,7 +444,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch #ifndef _WIN32 if (g_Config.currentDirectory == "") { -#if defined(ANDROID) +#if defined(__ANDROID__) g_Config.currentDirectory = external_dir; #elif defined(MAEMO) || defined(IOS) || defined(_WIN32) g_Config.currentDirectory = savegame_dir; @@ -460,7 +460,7 @@ void NativeInit(int argc, const char *argv[], const char *savegame_dir, const ch LogTypes::LOG_TYPE type = (LogTypes::LOG_TYPE)i; logman->SetEnable(type, true); logman->SetLogLevel(type, logLevel); -#ifdef ANDROID +#ifdef __ANDROID__ logman->AddListener(type, logger); #endif } @@ -790,7 +790,7 @@ void HandleGlobalMessage(const std::string &msg, const std::string &value) { if (msg == "core_powerSaving") { if (value != "false") { I18NCategory *sy = GetI18NCategory("System"); -#ifdef ANDROID +#ifdef __ANDROID__ osm.Show(sy->T("WARNING: Android battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving"); #else osm.Show(sy->T("WARNING: Battery save mode is on"), 2.0f, 0xFFFFFF, -1, true, "core_powerSaving"); @@ -1010,7 +1010,7 @@ void NativeShutdown() { // This means that the activity has been completely destroyed. PPSSPP does not // boot up correctly with "dirty" global variables currently, so we hack around that // by simply exiting. -#ifdef ANDROID +#ifdef __ANDROID__ exit(0); #endif diff --git a/UI/TiltEventProcessor.cpp b/UI/TiltEventProcessor.cpp index 8d8a9fb6f5..77c2fa2594 100644 --- a/UI/TiltEventProcessor.cpp +++ b/UI/TiltEventProcessor.cpp @@ -42,7 +42,7 @@ inline float clamp(float f) { Tilt TiltEventProcessor::NormalizeTilt(const Tilt &tilt){ // Normalise the accelerometer manually per-platform, to 'g' - #if defined(ANDROID) + #if defined(__ANDROID__) // Values are in metres per second. Divide by 9.8 to get 'g' value float maxX = 9.8f, maxY = 9.8f; #else diff --git a/ext/disarm.cpp b/ext/disarm.cpp index 26e0ba5b6c..37eeeb8c5c 100644 --- a/ext/disarm.cpp +++ b/ext/disarm.cpp @@ -132,7 +132,7 @@ int GetVm(uint32_t op, bool quad = false, bool dbl = false) { // Horrible array of hacks but hey. Can be cleaned up later. bool DisasmVFP(uint32_t op, char *text) { -#if defined(ANDROID) && defined(_M_IX86) +#if defined(__ANDROID__) && defined(_M_IX86) // Prevent linking errors with ArmEmitter which I've excluded on x86 android. strcpy(text, "ARM disasm not available"); #else diff --git a/ext/native/base/QtMain.cpp b/ext/native/base/QtMain.cpp index 6e973edb6e..0fc8c6fba9 100644 --- a/ext/native/base/QtMain.cpp +++ b/ext/native/base/QtMain.cpp @@ -44,7 +44,7 @@ std::string System_GetProperty(SystemProperty prop) { case SYSPROP_NAME: #if defined(MAEMO) return "Qt:Maemo"; -#elif defined(ANDROID) +#elif defined(__ANDROID__) return "Qt:Android"; #elif defined(Q_OS_LINUX) return "Qt:Linux"; @@ -71,7 +71,7 @@ int System_GetPropertyInt(SystemProperty prop) { case SYSPROP_DEVICE_TYPE: #if defined(MAEMO) return DEVICE_TYPE_MOBILE; -#elif defined(ANDROID) +#elif defined(__ANDROID__) return DEVICE_TYPE_MOBILE; #elif defined(Q_OS_LINUX) return DEVICE_TYPE_DESKTOP; diff --git a/ext/native/base/basictypes.h b/ext/native/base/basictypes.h index f095ffe43c..3b34991792 100644 --- a/ext/native/base/basictypes.h +++ b/ext/native/base/basictypes.h @@ -55,7 +55,7 @@ inline uint64_t swap64(uint64_t _data) {return _byteswap_uint64(_data);} 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) +#elif __linux__ && !defined(__ANDROID__) #include inline uint16_t swap16(uint16_t _data) {return bswap_16(_data);} inline uint32_t swap32(uint32_t _data) {return bswap_32(_data);} diff --git a/ext/native/base/logging.h b/ext/native/base/logging.h index 8198719013..2659aabbe4 100644 --- a/ext/native/base/logging.h +++ b/ext/native/base/logging.h @@ -46,7 +46,7 @@ inline void Crash() { // Just ILOGs on nonWindows. On Windows it outputs to the VS output console. void OutputDebugStringUTF8(const char *p); -#if defined(ANDROID) +#if defined(__ANDROID__) #include diff --git a/ext/native/base/timeutil.cpp b/ext/native/base/timeutil.cpp index b49a26d2e6..f1f7d6d30a 100644 --- a/ext/native/base/timeutil.cpp +++ b/ext/native/base/timeutil.cpp @@ -42,7 +42,7 @@ uint64_t _frequency = 0; uint64_t _starttime = 0; double real_time_now() { -#ifdef ANDROID +#ifdef __ANDROID__ if (false && gl_extensions.EGL_NV_system_time) { // This is needed to profile using PerfHUD on Tegra if (_frequency == 0) { diff --git a/ext/native/ext/cityhash/city.cpp b/ext/native/ext/cityhash/city.cpp index 06190d529f..8c62565da1 100644 --- a/ext/native/ext/cityhash/city.cpp +++ b/ext/native/ext/cityhash/city.cpp @@ -27,7 +27,7 @@ // possible hash functions, by using SIMD instructions, or by // compromising on hash quality. -#ifdef ANDROID +#ifdef __ANDROID__ #undef __SSE4_2__ #endif #include "city.h" diff --git a/ext/native/file/file_util.cpp b/ext/native/file/file_util.cpp index b6bea7924b..58b75fab28 100644 --- a/ext/native/file/file_util.cpp +++ b/ext/native/file/file_util.cpp @@ -72,7 +72,7 @@ uint64_t GetSize(FILE *f) { // This will only support 64-bit when large file support is available. // That won't be the case on some versions of Android, at least. -#if defined(ANDROID) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64) +#if defined(__ANDROID__) || (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS < 64) int fd = fileno(f); off64_t pos = lseek64(fd, 0, SEEK_CUR); diff --git a/ext/native/file/free.cpp b/ext/native/file/free.cpp index 010cd56865..3948008057 100644 --- a/ext/native/file/free.cpp +++ b/ext/native/file/free.cpp @@ -6,7 +6,7 @@ #include #include #include -#if defined(ANDROID) +#if defined(__ANDROID__) #include #include #define statvfs statfs @@ -33,7 +33,7 @@ bool free_disk_space(const std::string &dir, uint64_t &space) { int res = statvfs(dir.c_str(), &diskstat); if (res == 0) { -#ifndef ANDROID +#ifndef __ANDROID__ if (diskstat.f_flag & ST_RDONLY) { space = 0; return true; diff --git a/ext/native/file/path.h b/ext/native/file/path.h index 07567beeb1..42a291b032 100644 --- a/ext/native/file/path.h +++ b/ext/native/file/path.h @@ -27,7 +27,7 @@ public: } std::string GetFriendlyPath() { std::string str = GetPath(); -#if defined(ANDROID) +#if defined(__ANDROID__) // Do nothing #elif defined(__linux) char *home = getenv("HOME"); diff --git a/ext/native/file/zip_read.cpp b/ext/native/file/zip_read.cpp index 90f7dcf160..9174e489de 100644 --- a/ext/native/file/zip_read.cpp +++ b/ext/native/file/zip_read.cpp @@ -8,7 +8,7 @@ #include #endif -#ifdef ANDROID +#ifdef __ANDROID__ #include #endif @@ -16,7 +16,7 @@ #include "base/logging.h" #include "file/zip_read.h" -#ifdef ANDROID +#ifdef __ANDROID__ uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size) { // Figure out the file size first. struct zip_stat zstat; @@ -118,7 +118,7 @@ bool AssetsAssetReader::GetFileInfo(const char *path, FileInfo *info) { #endif -#ifdef ANDROID +#ifdef __ANDROID__ ZipAssetReader::ZipAssetReader(const char *zip_file, const char *in_zip_path) { zip_file_ = zip_open(zip_file, 0, NULL); diff --git a/ext/native/file/zip_read.h b/ext/native/file/zip_read.h index 57141f3216..7e2ecbbf45 100644 --- a/ext/native/file/zip_read.h +++ b/ext/native/file/zip_read.h @@ -1,7 +1,7 @@ // TODO: Move much of this code to vfs.cpp #pragma once -#ifdef ANDROID +#ifdef __ANDROID__ #include #endif @@ -41,7 +41,7 @@ public: }; #endif -#ifdef ANDROID +#ifdef __ANDROID__ uint8_t *ReadFromZip(zip *archive, const char* filename, size_t *size); class ZipAssetReader : public AssetReader { public: diff --git a/ext/native/gfx/gl_common.h b/ext/native/gfx/gl_common.h index 809cc23a2e..fd8711b647 100644 --- a/ext/native/gfx/gl_common.h +++ b/ext/native/gfx/gl_common.h @@ -36,7 +36,7 @@ typedef char GLchar; #define GL_MAX_EXT 0x8008 #endif -#if defined(ANDROID) +#if defined(__ANDROID__) #include // Additional extensions not included in GLES2/gl2ext.h from the NDK diff --git a/ext/native/gfx_es2/gpu_features.cpp b/ext/native/gfx_es2/gpu_features.cpp index 989652224a..6c625a7bde 100644 --- a/ext/native/gfx_es2/gpu_features.cpp +++ b/ext/native/gfx_es2/gpu_features.cpp @@ -10,7 +10,7 @@ #endif #if defined(USING_GLES2) -#if defined(ANDROID) +#if defined(__ANDROID__) PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC eglGetSystemTimeFrequencyNV; PFNEGLGETSYSTEMTIMENVPROC eglGetSystemTimeNV; PFNGLDRAWTEXTURENVPROC glDrawTextureNV; @@ -279,7 +279,7 @@ void CheckGLExtensions() { gl_extensions.NV_shader_framebuffer_fetch = strstr(extString, "GL_NV_shader_framebuffer_fetch") != 0; gl_extensions.ARM_shader_framebuffer_fetch = strstr(extString, "GL_ARM_shader_framebuffer_fetch") != 0; -#if defined(ANDROID) +#if defined(__ANDROID__) // On Android, incredibly, this is not consistently non-zero! It does seem to have the same value though. // https://twitter.com/ID_AA_Carmack/status/387383037794603008 #ifdef _DEBUG @@ -329,7 +329,7 @@ void CheckGLExtensions() { gl_extensions.EXT_unpack_subimage = true; } -#if defined(ANDROID) +#if defined(__ANDROID__) if (gl_extensions.OES_mapbuffer) { glMapBuffer = (PFNGLMAPBUFFERPROC)eglGetProcAddress("glMapBufferOES"); } diff --git a/ext/native/image/zim_save.cpp b/ext/native/image/zim_save.cpp index 9a807bcd22..c9bbb95916 100644 --- a/ext/native/image/zim_save.cpp +++ b/ext/native/image/zim_save.cpp @@ -121,7 +121,7 @@ void Convert(const uint8_t *image_data, int width, int height, int pitch, int fl int blockh = height/4; *data_size = blockw * blockh * 8; *data = new uint8_t[*data_size]; -#ifndef ANDROID +#ifndef __ANDROID__ #pragma omp parallel for #endif for (int y = 0; y < blockh; y++) { diff --git a/ext/native/net/resolve.cpp b/ext/native/net/resolve.cpp index 2f99cd2d27..2b5c129bd4 100644 --- a/ext/native/net/resolve.cpp +++ b/ext/native/net/resolve.cpp @@ -79,7 +79,7 @@ bool DNSResolve(const std::string &host, const std::string &service, addrinfo ** addrinfo hints = {0}; // TODO: Might be uses to lookup other values. hints.ai_socktype = SOCK_STREAM; -#if ANDROID +#ifdef __ANDROID__ hints.ai_flags = AI_ADDRCONFIG; #else // AI_V4MAPPED seems to have issues on some platforms, not sure we should include it: diff --git a/ext/native/thread/thread.h b/ext/native/thread/thread.h index 2596a0aa16..538c22029e 100644 --- a/ext/native/thread/thread.h +++ b/ext/native/thread/thread.h @@ -5,7 +5,7 @@ #define GCC_VER(x,y,z) ((x) * 10000 + (y) * 100 + (z)) #define GCC_VERSION GCC_VER(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) -#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !defined(ANDROID) +#if GCC_VERSION >= GCC_VER(4,4,0) && __GXX_EXPERIMENTAL_CXX0X__ && !defined(__ANDROID__) // GCC 4.4 provides #ifndef _GLIBCXX_USE_SCHED_YIELD #define _GLIBCXX_USE_SCHED_YIELD diff --git a/ext/native/thread/threadutil.cpp b/ext/native/thread/threadutil.cpp index c0ff13f044..722f3a4124 100644 --- a/ext/native/thread/threadutil.cpp +++ b/ext/native/thread/threadutil.cpp @@ -1,7 +1,7 @@ #ifdef _WIN32 #include #define TLS_SUPPORTED -#elif defined(ANDROID) +#elif defined(__ANDROID__) #define TLS_SUPPORTED #endif @@ -9,7 +9,7 @@ #include "base/logging.h" #include "thread/threadutil.h" -#ifdef ANDROID +#ifdef __ANDROID__ #include #endif @@ -43,7 +43,7 @@ void setCurrentThreadName(const char* threadName) { {} #else -#if defined(ANDROID) +#if defined(__ANDROID__) pthread_setname_np(pthread_self(), threadName); // #else // pthread_setname_np(thread_name); diff --git a/headless/Headless.cpp b/headless/Headless.cpp index c36f9052d9..286dd80c14 100644 --- a/headless/Headless.cpp +++ b/headless/Headless.cpp @@ -358,7 +358,7 @@ int main(int argc, const char* argv[]) InitSysDirectories(); #endif -#if !defined(ANDROID) && !defined(_WIN32) +#if !defined(__ANDROID__) && !defined(_WIN32) g_Config.memStickDirectory = std::string(getenv("HOME")) + "/.ppsspp/"; #endif @@ -375,7 +375,7 @@ int main(int argc, const char* argv[]) if (screenshotFilename != 0) headlessHost->SetComparisonScreenshot(screenshotFilename); -#ifdef ANDROID +#ifdef __ANDROID__ // For some reason the debugger installs it with this name? if (File::Exists("/data/app/org.ppsspp.ppsspp-2.apk")) { VFSRegister("", new ZipAssetReader("/data/app/org.ppsspp.ppsspp-2.apk", "assets/"));