diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dc7962c33..8247a34496 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -396,7 +396,7 @@ if(NOT MSVC) # This one is very useful but has many false positives. add_compile_options("$<$:-Wno-class-memaccess>") else() - add_compile_options(-Wno-deprecated-declarations) + add_compile_options(-Wno-deprecated-declarations -Wno-missing-braces) endif() if(ANDROID) @@ -2718,6 +2718,11 @@ set(WindowsFiles Windows/stdafx.h ) +if(ANDROID AND ARM64) + # Support 16kb page size on Android + target_link_options(${CoreLibName} PRIVATE "-Wl,-z,max-page-size=16384") +endif() + list(APPEND LinkCommon ${CoreLibName} ${CMAKE_THREAD_LIBS_INIT}) if(WIN32) @@ -2904,6 +2909,9 @@ if(TargetBin) else() add_executable(${TargetBin} ${NativeAppSource}) endif() + if(ANDROID AND ARM64) + target_link_options(${TargetBin} PRIVATE "-Wl,-z,max-page-size=16384") + endif() target_link_libraries(${TargetBin} ${LinkCommon} Common) endif() diff --git a/Common/Log/LogManager.cpp b/Common/Log/LogManager.cpp index d07e7c381b..3b9a896e28 100644 --- a/Common/Log/LogManager.cpp +++ b/Common/Log/LogManager.cpp @@ -263,7 +263,7 @@ void LogManager::LogLine(LogLevel level, Log type, const char *file, int line, c const char *hostThreadName = GetCurrentThreadName(); if ((hostThreadName && strcmp(hostThreadName, "EmuThread") != 0) || !hleCurrentThreadName) { // Use the host thread name. - threadName = hostThreadName; + threadName = hostThreadName ? hostThreadName : "unknown"; } else { // Use the PSP HLE thread name. threadName = hleCurrentThreadName; diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index 297290844a..be2a14ddbe 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -352,7 +352,12 @@ int GetMemoryProtectPageSize() { if (sys_info.dwPageSize == 0) GetSystemInfo(&sys_info); return sys_info.dwPageSize; +#else + static int pageSize = 0; + if (!pageSize) { + pageSize = sysconf(_SC_PAGE_SIZE); + } + return pageSize; #endif - return MEM_PAGE_SIZE; } #endif // !PPSSPP_PLATFORM(SWITCH) diff --git a/android/build.gradle b/android/build.gradle index a05779baae..0b23ecbd5d 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -18,7 +18,7 @@ dependencies { // Convenient wrapper around DocumentContract. Might look into writing our own // to see if there's some performance to squeeze at some point, but doubt it. - implementation "androidx.documentfile:documentfile:1.0.1" + implementation "androidx.documentfile:documentfile:1.1.0" } android { @@ -50,6 +50,11 @@ android { ndkVersion "27.2.12479018" + compileOptions { + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 + } + defaultConfig { /* configurations.all { @@ -73,7 +78,7 @@ android { file("versionname.txt").text = androidGitVersion.name() file("versioncode.txt").text = androidGitVersion.code().toString() - minSdk 9 + minSdk 21 targetSdk 35 if (project.hasProperty("ANDROID_VERSION_CODE") && project.hasProperty("ANDROID_VERSION_NAME")) { versionCode ANDROID_VERSION_CODE @@ -139,7 +144,7 @@ android { cmake { // Available arguments listed at https://developer.android.com/ndk/guides/cmake.html arguments '-DANDROID=true', - '-DANDROID_PLATFORM=android-16', + '-DANDROID_PLATFORM=android-21', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_CPP_FEATURES=', '-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON', @@ -157,7 +162,7 @@ android { cmake { // Available arguments listed at https://developer.android.com/ndk/guides/cmake.html arguments '-DANDROID=true', - '-DANDROID_PLATFORM=android-16', + '-DANDROID_PLATFORM=android-21', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_CPP_FEATURES=', '-DANDROID_STL=c++_static', @@ -178,7 +183,7 @@ android { cmake { // Available arguments listed at https://developer.android.com/ndk/guides/cmake.html arguments '-DANDROID=true', - '-DANDROID_PLATFORM=android-16', + '-DANDROID_PLATFORM=android-21', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_CPP_FEATURES=', '-DANDROID_STL=c++_static', @@ -198,14 +203,15 @@ android { cmake { // Available arguments listed at https://developer.android.com/ndk/guides/cmake.html arguments '-DANDROID=true', - '-DANDROID_PLATFORM=android-16', + '-DANDROID_PLATFORM=android-21', '-DANDROID_TOOLCHAIN=clang', '-DANDROID_CPP_FEATURES=', '-DANDROID_STL=c++_static', '-DANDROID_ARM_NEON=TRUE', '-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON', '-DOPENXR=TRUE', - '-DANDROID_LEGACY=TRUE' + '-DANDROID_LEGACY=TRUE', + '-DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON' } } ndk { diff --git a/android/jni/Locals.mk b/android/jni/Locals.mk index 6d3b83f52b..0b757e492b 100644 --- a/android/jni/Locals.mk +++ b/android/jni/Locals.mk @@ -68,4 +68,6 @@ ifeq ($(TARGET_ARCH_ABI),arm64-v8a) LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../ffmpeg/android/arm64/include LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../ext/libadrenotools/include LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../ext/libadrenotools/lib/linkernsbypass + + LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384" endif diff --git a/build.gradle b/build.gradle index ecf0fd7f51..b451c04b31 100644 --- a/build.gradle +++ b/build.gradle @@ -14,4 +14,8 @@ allprojects { google() mavenCentral() } + // The below can be used to show more deprecated stuff in the build output. + // tasks.withType(JavaCompile).configureEach { + // options.compilerArgs << "-Xlint:deprecation" + // } }