diff --git a/Android/app/.gitignore b/Android/app/.gitignore new file mode 100644 index 000000000..796b96d1c --- /dev/null +++ b/Android/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/Android/app/build.gradle b/Android/app/build.gradle new file mode 100644 index 000000000..b237473f7 --- /dev/null +++ b/Android/app/build.gradle @@ -0,0 +1,48 @@ +plugins { + id 'com.android.application' +} + +apply from: '../config/version.gradle' + +android { + + defaultConfig { + applicationId = "emu.Project64" + + externalNativeBuild { + cmake { + cppFlags '-std=c++11' + } + } + } + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + + compileOptions { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + + implementation 'com.google.android.material:material:1.1.0' + implementation "androidx.drawerlayout:drawerlayout:1.0.0" + implementation 'androidx.preference:preference:1.1.1' + testImplementation 'junit:junit:4.12' + implementation project(':jni:3rdParty:png') + implementation project(':jni:3rdParty:zlib') + implementation project(':jni:Common') + implementation project(':jni:Settings') + implementation project(':jni:Project64-core') + implementation project(':jni:Project64-bridge') + implementation project(':jni:Project64-video') + implementation project(':jni:Project64-audio') + implementation project(':jni:Plugin-input') + implementation project(':jni:Plugin-RspHle') +} diff --git a/Android/app/proguard-rules.pro b/Android/app/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/Android/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/app/src/main/AndroidManifest.xml b/Android/app/src/main/AndroidManifest.xml index e2e53a46d..14d7c5a79 100644 --- a/Android/app/src/main/AndroidManifest.xml +++ b/Android/app/src/main/AndroidManifest.xml @@ -55,11 +55,6 @@ - - + android:theme="@style/Theme.Project64.Settings"/> + android:theme="@style/Theme.Project64.Settings" /> diff --git a/Android/jni/3rdParty/zlib/.gitignore b/Android/jni/3rdParty/zlib/.gitignore index 5dcefbc71..702456a1a 100644 --- a/Android/jni/3rdParty/zlib/.gitignore +++ b/Android/jni/3rdParty/zlib/.gitignore @@ -1,12 +1,13 @@ +/.cxx +/build *.c *.cpp *.h *.vcproj *.vcxproj *.vcxproj.filters -*.dsp -*.plg -ChangeLog -INDEX -README -zconf.h.in +*.in +/ChangeLog +/INDEX +/README +/adler32.c diff --git a/Android/jni/3rdParty/zlib/AndroidManifest.xml b/Android/jni/3rdParty/zlib/AndroidManifest.xml new file mode 100644 index 000000000..50dd1f92e --- /dev/null +++ b/Android/jni/3rdParty/zlib/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/Android/jni/3rdParty/zlib/CMakeLists.txt b/Android/jni/3rdParty/zlib/CMakeLists.txt new file mode 100644 index 000000000..91e96bf9d --- /dev/null +++ b/Android/jni/3rdParty/zlib/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 2.8) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_C_STANDARD 99) + +project("zlib") + +add_library(zlib STATIC + adler32.c + compress.c + crc32.c + deflate.c + gzclose.c + gzlib.c + gzread.c + gzwrite.c + infback.c + inffast.c + inflate.c + inftrees.c + trees.c + uncompr.c + zutil.c + contrib/minizip/ioapi.c + contrib/minizip/miniunz.c + contrib/minizip/minizip.c + contrib/minizip/mztools.c + contrib/minizip/unzip.c + contrib/minizip/zip.c) + +add_definitions(-DANDROID) +add_definitions(-DUSE_FILE32API) +add_definitions(-DZ_BUFSIZE=46516) + +target_link_libraries(zlib) diff --git a/Android/jni/3rdParty/zlib/build.gradle b/Android/jni/3rdParty/zlib/build.gradle new file mode 100644 index 000000000..729d6173e --- /dev/null +++ b/Android/jni/3rdParty/zlib/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'com.android.library' +apply from: '../../../config/version.gradle' + +android { + + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + ndk { + debugSymbolLevel 'FULL' + } + } + debug { + minifyEnabled true + jniDebuggable true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + ndk { + debugSymbolLevel 'FULL' + } + } + } + + externalNativeBuild { + cmake { + version "3.10.2" + path "CMakeLists.txt" + } + } + + defaultConfig { + externalNativeBuild { + cmake { + arguments "-DANDROID=1", "-DCMAKE_BUILD_TYPE=Release", "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" + cppFlags "-fexceptions", "-ffast-math", "-ftree-vectorize" + cFlags "-ffast-math", "-ftree-vectorize" + abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" + } + } + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + } + } + + packagingOptions { + exclude 'lib/x86/libc++_shared.so' + exclude 'lib/x86_64/libc++_shared.so' + exclude 'lib/armeabi-v7a/libc++_shared.so' + exclude 'lib/arm64-v8a/libc++_shared.so' + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +} + diff --git a/Android/jni/3rdParty/zlib/proguard-rules.pro b/Android/jni/3rdParty/zlib/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/Android/jni/3rdParty/zlib/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/jni/3rdParty/zlib/zlib.mk b/Android/jni/3rdParty/zlib/zlib.mk deleted file mode 100644 index fa6e85acf..000000000 --- a/Android/jni/3rdParty/zlib/zlib.mk +++ /dev/null @@ -1,40 +0,0 @@ -######################### -# zlib -######################### -include $(CLEAR_VARS) -LOCAL_PATH := $(JNI_LOCAL_PATH) -SRCDIR := ./3rdParty/zlib - -LOCAL_MODULE := zlib - -LOCAL_C_INCLUDES := \ - -LOCAL_SRC_FILES := \ - $(SRCDIR)/adler32.c \ - $(SRCDIR)/compress.c \ - $(SRCDIR)/crc32.c \ - $(SRCDIR)/deflate.c \ - $(SRCDIR)/gzclose.c \ - $(SRCDIR)/gzlib.c \ - $(SRCDIR)/gzread.c \ - $(SRCDIR)/gzwrite.c \ - $(SRCDIR)/infback.c \ - $(SRCDIR)/inffast.c \ - $(SRCDIR)/inflate.c \ - $(SRCDIR)/inftrees.c \ - $(SRCDIR)/trees.c \ - $(SRCDIR)/uncompr.c \ - $(SRCDIR)/zutil.c \ - $(SRCDIR)/contrib/minizip/ioapi.c \ - $(SRCDIR)/contrib/minizip/miniunz.c \ - $(SRCDIR)/contrib/minizip/minizip.c \ - $(SRCDIR)/contrib/minizip/mztools.c \ - $(SRCDIR)/contrib/minizip/unzip.c \ - $(SRCDIR)/contrib/minizip/zip.c \ - -LOCAL_CFLAGS := $(COMMON_CFLAGS) \ - -DIOAPI_NO_64 \ - -LOCAL_CPPFLAGS := $(COMMON_CPPFLAGS) - -include $(BUILD_STATIC_LIBRARY) \ No newline at end of file diff --git a/Android/jni/Common/.gitignore b/Android/jni/Common/.gitignore index 65c39cd18..955be37a4 100644 --- a/Android/jni/Common/.gitignore +++ b/Android/jni/Common/.gitignore @@ -1,7 +1,8 @@ +/.cxx +/build *.cpp *.h *.vcproj *.vcxproj *.vcxproj.filters -*.dsp -*.plg \ No newline at end of file +*.in diff --git a/Android/jni/Common/proguard-rules.pro b/Android/jni/Common/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/Android/jni/Common/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/jni/Project64-bridge/.gitignore b/Android/jni/Project64-bridge/.gitignore index f77180dc4..955be37a4 100644 --- a/Android/jni/Project64-bridge/.gitignore +++ b/Android/jni/Project64-bridge/.gitignore @@ -1,9 +1,8 @@ +/.cxx +/build *.cpp *.h *.vcproj *.vcxproj *.vcxproj.filters -*.dsp -*.plg -*.txt -*.rc \ No newline at end of file +*.in diff --git a/Android/jni/Project64-bridge/CMakeLists.txt b/Android/jni/Project64-bridge/CMakeLists.txt new file mode 100644 index 000000000..47f03b126 --- /dev/null +++ b/Android/jni/Project64-bridge/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_C_STANDARD 99) + +project("Project64-bridge") +include_directories(..) + +add_library(Project64-bridge SHARED + JavaBridge.cpp + JavaRomList.cpp + jniBridge.cpp + jniBridgeSettings.cpp + Notification.cpp + SyncBridge.cpp + UISettings.cpp) + +add_definitions(-DANDROID) + +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../3rdParty/zlib ${CMAKE_CURRENT_BINARY_DIR}/3rdParty/zlib) +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Common ${CMAKE_CURRENT_BINARY_DIR}/Common) +ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/../Project64-core ${CMAKE_CURRENT_BINARY_DIR}/Project64-core) +target_link_libraries(Project64-bridge zlib Project64-core Common log) diff --git a/Android/jni/Project64-bridge/proguard-rules.pro b/Android/jni/Project64-bridge/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/Android/jni/Project64-bridge/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/jni/Project64-core/.gitignore b/Android/jni/Project64-core/.gitignore index 9054cb2eb..d4fa9d70d 100644 --- a/Android/jni/Project64-core/.gitignore +++ b/Android/jni/Project64-core/.gitignore @@ -1,8 +1,8 @@ +/.cxx +/build *.cpp *.h *.vcproj *.vcxproj *.vcxproj.filters -*.dsp -*.plg -*.h.in \ No newline at end of file +*.in \ No newline at end of file diff --git a/Android/jni/Project64-core/proguard-rules.pro b/Android/jni/Project64-core/proguard-rules.pro new file mode 100644 index 000000000..f1b424510 --- /dev/null +++ b/Android/jni/Project64-core/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/Android/jni/Project64-video/AndroidManifest.xml b/Android/jni/Project64-video/AndroidManifest.xml new file mode 100644 index 000000000..864c2e1d8 --- /dev/null +++ b/Android/jni/Project64-video/AndroidManifest.xml @@ -0,0 +1 @@ + diff --git a/Android/jni/Project64-video/Project64-video.mk b/Android/jni/Project64-video/Project64-video.mk deleted file mode 100644 index b9eff4ff1..000000000 --- a/Android/jni/Project64-video/Project64-video.mk +++ /dev/null @@ -1,100 +0,0 @@ -############################### -# Project64-gfx-Project64 -############################### -include $(CLEAR_VARS) -LOCAL_PATH := $(JNI_LOCAL_PATH) -SRCDIR := ./ - -LOCAL_MODULE := Project64-gfx -LOCAL_STATIC_LIBRARIES := common \ - zlib \ - Settings \ - png \ - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/$(SRCDIR)/Project64-video/Renderer/inc \ - $(LOCAL_PATH)/$(SRCDIR)/3rdParty \ - -LOCAL_SRC_FILES := \ - $(SRCDIR)/Project64-video/3dmath.cpp \ - $(SRCDIR)/Project64-video/Android.cpp \ - $(SRCDIR)/Project64-video/Combine.cpp \ - $(SRCDIR)/Project64-video/Config.cpp \ - $(SRCDIR)/Project64-video/CRC.cpp \ - $(SRCDIR)/Project64-video/Debugger.cpp \ - $(SRCDIR)/Project64-video/DepthBufferRender.cpp \ - $(SRCDIR)/Project64-video/F3DTEXA.cpp \ - $(SRCDIR)/Project64-video/FBtoScreen.cpp \ - $(SRCDIR)/Project64-video/Main.cpp \ - $(SRCDIR)/Project64-video/rdp.cpp \ - $(SRCDIR)/Project64-video/ScreenResolution.cpp \ - $(SRCDIR)/Project64-video/Settings.cpp \ - $(SRCDIR)/Project64-video/TexBuffer.cpp \ - $(SRCDIR)/Project64-video/TexCache.cpp \ - $(SRCDIR)/Project64-video/trace.cpp \ - $(SRCDIR)/Project64-video/turbo3D.cpp \ - $(SRCDIR)/Project64-video/ucode.cpp \ - $(SRCDIR)/Project64-video/ucode00.cpp \ - $(SRCDIR)/Project64-video/ucode01.cpp \ - $(SRCDIR)/Project64-video/ucode02.cpp \ - $(SRCDIR)/Project64-video/ucode03.cpp \ - $(SRCDIR)/Project64-video/ucode04.cpp \ - $(SRCDIR)/Project64-video/ucode05.cpp \ - $(SRCDIR)/Project64-video/ucode06.cpp \ - $(SRCDIR)/Project64-video/ucode07.cpp \ - $(SRCDIR)/Project64-video/ucode08.cpp \ - $(SRCDIR)/Project64-video/ucode09.cpp \ - $(SRCDIR)/Project64-video/ucode09rdp.cpp \ - $(SRCDIR)/Project64-video/ucodeFB.cpp \ - $(SRCDIR)/Project64-video/Util.cpp \ - $(SRCDIR)/Project64-video/Ext_TxFilter.cpp \ - $(SRCDIR)/Project64-video/Renderer/OGLEScombiner.cpp \ - $(SRCDIR)/Project64-video/Renderer/OGLESgeometry.cpp \ - $(SRCDIR)/Project64-video/Renderer/OGLESglitchmain.cpp \ - $(SRCDIR)/Project64-video/Renderer/OGLEStextures.cpp \ - $(SRCDIR)/Project64-video/Renderer/OGLESwrappers.cpp \ - $(SRCDIR)/Project64-video/Renderer/Renderer.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxFilterExport.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxFilter.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxCache.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxTexCache.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxHiResCache.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxQuantize.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxUtil.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TextureFilters.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TextureFilters_2xsai.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TextureFilters_hq2x.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TextureFilters_hq4x.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxImage.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxReSample.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/TxDbg.cpp \ - $(SRCDIR)/Project64-video/TextureEnhancer/tc-1.1+/fxt1.c \ - $(SRCDIR)/Project64-video/TextureEnhancer/tc-1.1+/dxtn.c \ - $(SRCDIR)/Project64-video/TextureEnhancer/tc-1.1+/wrapper.c \ - $(SRCDIR)/Project64-video/TextureEnhancer/tc-1.1+/texstore.c \ - -LOCAL_CFLAGS := \ - $(COMMON_CFLAGS) \ - -DUSE_FRAMESKIPPER \ - -DNOSSE \ - -DUSE_GLES \ - -fsigned-char \ - -LOCAL_CPPFLAGS := $(COMMON_CPPFLAGS) - -LOCAL_CPP_FEATURES := exceptions - -LOCAL_LDLIBS := \ - -ldl \ - -lGLESv2 \ - -llog \ - -latomic \ - -ifeq ($(TARGET_ARCH_ABI), armeabi-v7a) - # Use for ARM7a: - LOCAL_CFLAGS += -mfpu=vfp - LOCAL_CFLAGS += -mfloat-abi=softfp - -endif - -include $(BUILD_SHARED_LIBRARY) \ No newline at end of file diff --git a/Android/jni/Project64-video/build.gradle b/Android/jni/Project64-video/build.gradle new file mode 100644 index 000000000..38dab2657 --- /dev/null +++ b/Android/jni/Project64-video/build.gradle @@ -0,0 +1,63 @@ +apply plugin: 'com.android.library' +apply from: '../../config/version.gradle' + +android { + + buildTypes { + release { + minifyEnabled true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + ndk { + debugSymbolLevel 'FULL' + } + } + debug { + minifyEnabled true + jniDebuggable true + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + ndk { + debugSymbolLevel 'FULL' + } + } + } + + externalNativeBuild { + cmake { + version "3.10.2" + path "CMakeLists.txt" + } + } + + defaultConfig { + externalNativeBuild { + cmake { + arguments "-DANDROID=1", "-DCMAKE_BUILD_TYPE=Release", "-DANDROID_ARM_NEON=TRUE", "-DANDROID_TOOLCHAIN=clang" + cppFlags "-fexceptions", "-ffast-math", "-ftree-vectorize" + cFlags "-ffast-math", "-ftree-vectorize" + abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64" + } + } + } + + sourceSets { + main { + manifest.srcFile 'AndroidManifest.xml' + } + } + + packagingOptions { + exclude 'lib/x86/libc++_shared.so' + exclude 'lib/x86_64/libc++_shared.so' + exclude 'lib/armeabi-v7a/libc++_shared.so' + exclude 'lib/arm64-v8a/libc++_shared.so' + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) +} +