Merge pull request #9053 from Orphis/android_define

android: Change preprocessor define to standard __ANDROID__
This commit is contained in:
Henrik Rydgård 2016-10-12 13:12:14 +02:00 committed by GitHub
commit 705627d6d3
54 changed files with 119 additions and 123 deletions

View File

@ -177,9 +177,6 @@ if(MIPS)
add_definitions(-DMIPS)
endif()
if(ANDROID)
add_definitions(-DANDROID)
endif()
if(IOS)
add_definitions(-DIOS)
endif()

View File

@ -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);

View File

@ -17,7 +17,7 @@
#if defined(_M_IX86) || defined(_M_X64)
#ifdef ANDROID
#ifdef __ANDROID__
#include <sys/stat.h>
#include <fcntl.h>
#endif

View File

@ -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"

View File

@ -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;

View File

@ -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)) {

View File

@ -29,13 +29,13 @@
#include <unistd.h>
#include <cerrno>
#include <cstring>
#ifdef ANDROID
#ifdef __ANDROID__
#include <sys/ioctl.h>
#include <linux/ashmem.h>
#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.

View File

@ -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)

View File

@ -18,7 +18,7 @@
#pragma once
// Android
#if defined(ANDROID)
#if defined(__ANDROID__)
#include <sys/endian.h>
#if _BYTE_ORDER == _LITTLE_ENDIAN && !defined(COMMON_LITTLE_ENDIAN)

View File

@ -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

View File

@ -1,7 +1,7 @@
#ifndef UTIL_INIT
#define UTIL_INIT
#ifdef ANDROID
#ifdef __ANDROID__
#undef NDEBUG // asserts
#endif
#include <cassert>
@ -17,7 +17,7 @@
#define NOMINMAX /* Don't let Windows define min() or max() */
#define APP_NAME_STR_LEN 80
#include <Windows.h>
#elif defined(ANDROID) // _WIN32
#elif defined(__ANDROID__) // _WIN32
#include <android/native_window_jni.h>
#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

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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_);

View File

@ -36,7 +36,7 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#if defined(ANDROID)
#if defined(__ANDROID__)
#include <sys/types.h>
#include <sys/vfs.h>
#define statvfs statfs

View File

@ -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

View File

@ -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
}
}
}

View File

@ -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";

View File

@ -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;

View File

@ -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

View File

@ -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();

View File

@ -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;

View File

@ -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);

View File

@ -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;
}
}

View File

@ -6,7 +6,7 @@
#include "GPU/GPUInterface.h"
#include "GPU/Common/GPUDebugInterface.h"
#if defined(ANDROID)
#if defined(__ANDROID__)
#include <atomic>
#elif defined(_M_SSE)
#include <xmmintrin.h>
@ -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<u64> 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;

View File

@ -1,4 +1,3 @@
DEFINES += ANDROID
INCLUDEPATH += $$P/ext/native/ext/libzip
!contains(CONFIG, staticlib) {

View File

@ -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));

View File

@ -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");

View File

@ -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);

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 <byteswap.h>
inline uint16_t swap16(uint16_t _data) {return bswap_16(_data);}
inline uint32_t swap32(uint32_t _data) {return bswap_32(_data);}

View File

@ -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 <android/log.h>

View File

@ -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) {

View File

@ -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"

View File

@ -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);

View File

@ -6,7 +6,7 @@
#include <dirent.h>
#include <unistd.h>
#include <sys/stat.h>
#if defined(ANDROID)
#if defined(__ANDROID__)
#include <sys/types.h>
#include <sys/vfs.h>
#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;

View File

@ -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");

View File

@ -8,7 +8,7 @@
#include <QDir>
#endif
#ifdef ANDROID
#ifdef __ANDROID__
#include <zip.h>
#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);

View File

@ -1,7 +1,7 @@
// TODO: Move much of this code to vfs.cpp
#pragma once
#ifdef ANDROID
#ifdef __ANDROID__
#include <zip.h>
#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:

View File

@ -36,7 +36,7 @@ typedef char GLchar;
#define GL_MAX_EXT 0x8008
#endif
#if defined(ANDROID)
#if defined(__ANDROID__)
#include <EGL/egl.h>
// Additional extensions not included in GLES2/gl2ext.h from the NDK

View File

@ -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");
}

View File

@ -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++) {

View File

@ -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:

View File

@ -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 <thread>
#ifndef _GLIBCXX_USE_SCHED_YIELD
#define _GLIBCXX_USE_SCHED_YIELD

View File

@ -1,7 +1,7 @@
#ifdef _WIN32
#include <windows.h>
#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 <pthread.h>
#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);

View File

@ -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/"));