diff --git a/CMakeLists.txt b/CMakeLists.txt index f9669bad..b54a7a4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ DetectTargetCPUArchitectures(ISLE_CPUS) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +set(CMAKE_DISABLE_PRECOMPILE_HEADERS ON) if (NOT MINGW) set(NOT_MINGW ON) @@ -482,8 +483,13 @@ if (NOT ISLE_MINIWIN) endif() if (ISLE_BUILD_APP) - add_executable(isle WIN32 - ISLE/res/isle.rc + if(ANDROID) + add_library(isle SHARED) + else() + add_executable(isle WIN32) + target_sources(isle PRIVATE ISLE/res/isle.rc) + endif() + target_sources(isle PRIVATE ISLE/isleapp.cpp ISLE/islefiles.cpp ${CMAKE_SOURCE_DIR}/ISLE/res/arrow_bmp.h @@ -545,6 +551,9 @@ if (ISLE_BUILD_APP) ISLE/3ds/config.cpp ) endif() + if(ANDROID) + target_sources(isle PRIVATE ISLE/android/config.cpp) + endif() if(WINDOWS_STORE) target_sources(isle PRIVATE ISLE/xbox_one_series/config.cpp diff --git a/ISLE/android/config.cpp b/ISLE/android/config.cpp new file mode 100644 index 00000000..701ab55c --- /dev/null +++ b/ISLE/android/config.cpp @@ -0,0 +1,12 @@ +#include "config.h" + +#include +#include + +void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary) +{ + SDL_Log("Overriding default config for Android"); + + iniparser_set(p_dictionary, "isle:diskpath", "/data/data/org.legoisland.Isle.dev/files/DATA/disk/LEGO"); + iniparser_set(p_dictionary, "isle:cdpath", "/data/data/org.legoisland.Isle.dev/files/"); +} diff --git a/ISLE/android/config.h b/ISLE/android/config.h new file mode 100644 index 00000000..5b4ac3d0 --- /dev/null +++ b/ISLE/android/config.h @@ -0,0 +1,8 @@ +#ifndef ANDROID_CONFIG_H +#define ANDROID_CONFIG_H + +#include "dictionary.h" + +void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary); + +#endif // ANDROID_CONFIG_H diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index 5cc6c9c2..d2be8e60 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -58,6 +58,10 @@ #include "3ds/config.h" #endif +#ifdef __ANDROID__ +#include "android/config.h" +#endif + #ifdef WINDOWS_STORE #include "xbox_one_series/config.h" #endif @@ -994,6 +998,9 @@ bool IsleApp::LoadConfig() #ifdef __3DS__ N3DS_SetupDefaultConfigOverrides(dict); #endif +#ifdef __ANDROID__ + Android_SetupDefaultConfigOverrides(dict); +#endif #ifdef WINDOWS_STORE XBONE_SetupDefaultConfigOverrides(dict); #endif diff --git a/android-project/.gitignore b/android-project/.gitignore new file mode 100644 index 00000000..59dc5288 --- /dev/null +++ b/android-project/.gitignore @@ -0,0 +1,12 @@ +# Intellij +.idea/ + +# Gradle files +/.gradle/ +build/ + +# Android +/app/.cxx/ + +# Local configuration file (sdk path, etc) +/local.properties diff --git a/android-project/app/build.gradle b/android-project/app/build.gradle index 989ef34c..14e8d543 100644 --- a/android-project/app/build.gradle +++ b/android-project/app/build.gradle @@ -2,30 +2,27 @@ plugins { id 'com.android.application' } -def buildWithCMake = project.hasProperty('BUILD_WITH_CMAKE'); - android { namespace = "org.libsdl.app" + ndkVersion '28.0.13004108' compileSdkVersion 35 defaultConfig { + applicationId "org.legoisland.Isle" minSdkVersion 21 targetSdkVersion 35 versionCode 1 - versionName "1.0" + versionName "0.1" externalNativeBuild { - ndkBuild { - arguments "APP_PLATFORM=android-21" - // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - abiFilters 'arm64-v8a' - } cmake { - arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static" - // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' - abiFilters 'arm64-v8a' + arguments "-DANDROID_PLATFORM=android-21", "-DANDROID_STL=c++_static", "-DISLE_BUILD_CONFIG=OFF" + abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' } } } buildTypes { + debug { + applicationIdSuffix ".dev" + } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' @@ -40,15 +37,10 @@ android { jniLibs.srcDir 'libs' } externalNativeBuild { - if (buildWithCMake) { cmake { - path 'jni/CMakeLists.txt' + path '../../CMakeLists.txt' + version "3.31.6+" } - } else { - ndkBuild { - path 'jni/Android.mk' - } - } } } diff --git a/android-project/app/src/main/AndroidManifest.xml b/android-project/app/src/main/AndroidManifest.xml index f3a7cd5c..41ece2f9 100644 --- a/android-project/app/src/main/AndroidManifest.xml +++ b/android-project/app/src/main/AndroidManifest.xml @@ -10,23 +10,23 @@ + android:required="true" /> + android:required="true" /> + android:required="true" /> + android:required="true" /> + android:required="true" /> @@ -77,11 +77,12 @@ --> - diff --git a/android-project/app/src/main/ic_launcher-playstore.png b/android-project/app/src/main/ic_launcher-playstore.png new file mode 100644 index 00000000..d38af7d8 Binary files /dev/null and b/android-project/app/src/main/ic_launcher-playstore.png differ diff --git a/android-project/app/src/main/java/org/legoisland/Isle/IsleSDLActivity.java b/android-project/app/src/main/java/org/legoisland/Isle/IsleSDLActivity.java new file mode 100644 index 00000000..22e4b360 --- /dev/null +++ b/android-project/app/src/main/java/org/legoisland/Isle/IsleSDLActivity.java @@ -0,0 +1,13 @@ +package org.legoisland.Isle; + +import org.libsdl.app.SDLActivity; + +public class IsleSDLActivity extends SDLActivity { + protected String[] getLibraries() { + return new String[] { + "SDL3", + "lego1", + "isle" + }; + } +} diff --git a/android-project/app/src/main/res/drawable/ic_launcher_foreground.xml b/android-project/app/src/main/res/drawable/ic_launcher_foreground.xml new file mode 100644 index 00000000..14440e6a --- /dev/null +++ b/android-project/app/src/main/res/drawable/ic_launcher_foreground.xml @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 00000000..7353dbd1 --- /dev/null +++ b/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml new file mode 100644 index 00000000..7353dbd1 --- /dev/null +++ b/android-project/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index d50bdaae..00000000 Binary files a/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 00000000..f4d86bca Binary files /dev/null and b/android-project/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 00000000..60a5c417 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index 0a299eb3..00000000 Binary files a/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 00000000..4a3da27a Binary files /dev/null and b/android-project/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 00000000..047b4028 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index a336ad5c..00000000 Binary files a/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 00000000..22fb6853 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..043c7aa7 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index d423dac2..00000000 Binary files a/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 00000000..baea92cd Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..5555f64d Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index 959c384b..00000000 Binary files a/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 00000000..8df86ac9 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 00000000..320691a8 Binary files /dev/null and b/android-project/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/android-project/app/src/main/res/values/ic_launcher_background.xml b/android-project/app/src/main/res/values/ic_launcher_background.xml new file mode 100644 index 00000000..5e8204d2 --- /dev/null +++ b/android-project/app/src/main/res/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #39A0D9 + \ No newline at end of file diff --git a/android-project/app/src/main/res/values/strings.xml b/android-project/app/src/main/res/values/strings.xml index ab795330..fa00736c 100644 --- a/android-project/app/src/main/res/values/strings.xml +++ b/android-project/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - Game + LEGO Island diff --git a/android-project/build.gradle b/android-project/build.gradle index ed2299cb..39615ca3 100644 --- a/android-project/build.gradle +++ b/android-project/build.gradle @@ -6,7 +6,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:8.7.3' + classpath 'com.android.tools.build:gradle:8.11.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/android-project/gradle/wrapper/gradle-wrapper.properties b/android-project/gradle/wrapper/gradle-wrapper.properties index 99fbfa03..ec50cfcb 100644 --- a/android-project/gradle/wrapper/gradle-wrapper.properties +++ b/android-project/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Nov 11 18:20:34 PST 2021 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/miniwin/CMakeLists.txt b/miniwin/CMakeLists.txt index 1ed5e909..2199ee9d 100644 --- a/miniwin/CMakeLists.txt +++ b/miniwin/CMakeLists.txt @@ -39,18 +39,18 @@ if(OpenGL_FOUND AND NOT WINDOWS_STORE) src/d3drm/backends/opengl1/renderer.cpp ) target_compile_definitions(miniwin PRIVATE USE_OPENGL1) - target_link_libraries(miniwin PRIVATE OpenGL::GL) + target_link_libraries(miniwin PRIVATE ${OPENGL_LIBRARIES}) else() message(STATUS "🧩 OpenGL 1.x support not enabled — needs OpenGL") endif() find_library(OPENGL_ES2_LIBRARY NAMES GLESv2) -if(EMSCRIPTEN OR OPENGL_ES2_LIBRARY AND NOT WINDOWS_STORE) - message(STATUS "Found OpenGL: enabling OpenGL ES 2.x renderer") +if(EMSCRIPTEN OR (OPENGL_ES2_LIBRARY AND NOT WINDOWS_STORE)) + message(STATUS "Found OpenGL ES 2.x: enabling OpenGL ES 2.x renderer") target_sources(miniwin PRIVATE src/d3drm/backends/opengles2/renderer.cpp) target_compile_definitions(miniwin PRIVATE USE_OPENGLES2) if(OPENGL_ES2_LIBRARY) - target_link_libraries(miniwin PRIVATE OpenGL::GL) + target_link_libraries(miniwin PRIVATE ${OPENGL_ES2_LIBRARY}) endif() else() message(STATUS "🧩 OpenGL ES 2.x support not enabled")