diff --git a/proj-android/README.md b/proj-android/README.md index a2da278..73567ed 100644 --- a/proj-android/README.md +++ b/proj-android/README.md @@ -1 +1 @@ -### Перед запуском в папке ```app/jni/```(рядом с src) нужно создать три папки с исходниками библиотек ```libpng```, ```SDL```, ```zlib``` +### Android version diff --git a/proj-android/app/build.gradle b/proj-android/app/build.gradle index 71b3cb2..a8c0158 100644 --- a/proj-android/app/build.gradle +++ b/proj-android/app/build.gradle @@ -9,7 +9,7 @@ else { android { if (buildAsApplication) { - namespace "org.libsdl.app" + namespace "fishrungames.shadowoverbishkek" } compileSdkVersion 37 defaultConfig { @@ -62,7 +62,7 @@ android { libraryVariants.all { variant -> variant.outputs.all { output -> if (output.outputFileName != null && output.outputFileName.endsWith(".aar")) { - output.outputFileName = "org.libsdl.app.aar" + output.outputFileName = "fishrungames.shadowoverbishkek.aar" } } } @@ -70,5 +70,6 @@ android { } dependencies { + implementation 'androidx.core:core-splashscreen:1.0.1' implementation fileTree(include: ['*.jar'], dir: 'libs') } diff --git a/proj-android/app/proguard-rules.pro b/proj-android/app/proguard-rules.pro index a4c9886..e4dda64 100644 --- a/proj-android/app/proguard-rules.pro +++ b/proj-android/app/proguard-rules.pro @@ -16,18 +16,18 @@ # public *; #} --keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLInputConnection { +-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLInputConnection { void nativeCommitText(java.lang.String, int); void nativeGenerateScancodeForUnichar(char); } --keep,includedescriptorclasses class org.libsdl.app.SDLActivity { +-keep,includedescriptorclasses class fishrungames.shadowoverbishkek.SDLActivity { # for some reason these aren't compatible with allowoptimization modifier boolean supportsRelativeMouse(); void setWindowStyle(boolean); } --keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLActivity { +-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLActivity { java.lang.String nativeGetHint(java.lang.String); # Java-side doesn't use this, so it gets minified, but C-side still tries to register it boolean onNativeSoftReturnKey(); void onNativeKeyboardFocusLost(); @@ -62,7 +62,7 @@ boolean showTextInput(int, int, int, int); } --keep,includedescriptorclasses,allowoptimization class org.libsdl.app.HIDDeviceManager { +-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.HIDDeviceManager { boolean initialize(boolean, boolean); boolean openDevice(int); int sendOutputReport(int, byte[]); @@ -71,7 +71,7 @@ void closeDevice(int); } --keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLAudioManager { +-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLAudioManager { int[] getAudioOutputDevices(); int[] getAudioInputDevices(); int[] audioOpen(int, int, int, int, int); @@ -90,7 +90,7 @@ native void addAudioDevice(boolean, int); } --keep,includedescriptorclasses,allowoptimization class org.libsdl.app.SDLControllerManager { +-keep,includedescriptorclasses,allowoptimization class fishrungames.shadowoverbishkek.SDLControllerManager { void pollInputDevices(); void pollHapticDevices(); void hapticRun(int, float, int); diff --git a/proj-android/app/src/main/AndroidManifest.xml b/proj-android/app/src/main/AndroidManifest.xml index 3b0863e..9cd6e45 100644 --- a/proj-android/app/src/main/AndroidManifest.xml +++ b/proj-android/app/src/main/AndroidManifest.xml @@ -52,7 +52,7 @@ - + Тень над Бишкеком + diff --git a/proj-android/app/src/main/res/values/strings.xml b/proj-android/app/src/main/res/values/strings.xml index ab79533..e4872a2 100644 --- a/proj-android/app/src/main/res/values/strings.xml +++ b/proj-android/app/src/main/res/values/strings.xml @@ -1,3 +1,3 @@ - Game + Shadow Over Bishkek diff --git a/proj-android/app/src/main/res/values/styles.xml b/proj-android/app/src/main/res/values/styles.xml index 7456b1b..f8ece68 100644 --- a/proj-android/app/src/main/res/values/styles.xml +++ b/proj-android/app/src/main/res/values/styles.xml @@ -4,4 +4,13 @@ + + diff --git a/proj-android/gradle.properties b/proj-android/gradle.properties index 556c61a..f9aa32d 100644 --- a/proj-android/gradle.properties +++ b/proj-android/gradle.properties @@ -18,9 +18,9 @@ android.r8.optimizedResourceShrinking=false android.r8.strictFullModeForKeepRules=false android.sdk.defaultTargetSdkToCompileSdkIfUnset=false android.uniquePackageNames=false -android.useAndroidX=false android.usesSdkInManifest.disallowed=false org.gradle.jvmargs=-Xmx1536m +android.useAndroidX=true # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit diff --git a/proj-android/gradle/gradle-daemon-jvm.properties b/proj-android/gradle/gradle-daemon-jvm.properties new file mode 100644 index 0000000..6c1139e --- /dev/null +++ b/proj-android/gradle/gradle-daemon-jvm.properties @@ -0,0 +1,12 @@ +#This file is generated by updateDaemonJvm +toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/73bcfb608d1fde9fb62e462f834a3299/redirect +toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/846ee0d876d26a26f37aa1ce8de73224/redirect +toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/ec7520a1e057cd116f9544c42142a16b/redirect +toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/4c4f879899012ff0a8b2e2117df03b0e/redirect +toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/9482ddec596298c84656d31d16652665/redirect +toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/39701d92e1756bb2f141eb67cd4c660e/redirect +toolchainVersion=21 diff --git a/src/utils/Utils.cpp b/src/utils/Utils.cpp index d66376a..ded4116 100644 --- a/src/utils/Utils.cpp +++ b/src/utils/Utils.cpp @@ -388,6 +388,33 @@ namespace FRG // --- Глобальные переменные логгера --- namespace { std::ofstream g_logFile; +#ifdef __ANDROID__ + class AndroidLogBuffer : public std::streambuf { + private: + std::string buffer; + protected: + int overflow(int c) override { + if (c == '\n') { + __android_log_print(ANDROID_LOG_INFO, "ShadowOverBishkek", "%s", buffer.c_str()); + buffer.clear(); + } + else if (c != EOF) { + buffer += static_cast(c); + } + return c; + } + int sync() override { + if (!buffer.empty()) { + __android_log_print(ANDROID_LOG_INFO, "ShadowOverBishkek", "%s", buffer.c_str()); + buffer.clear(); + } + return 0; + } + }; + AndroidLogBuffer g_androidLogBuffer; + std::ostream g_androidStream(&g_androidLogBuffer); +#endif + std::unique_ptr g_teeBuffer; std::unique_ptr g_teeStream;