From 0e347605e139cc13fe9ce3714d29e76929cad58f Mon Sep 17 00:00:00 2001 From: SachinVin Date: Mon, 11 Apr 2022 00:30:51 +0530 Subject: [PATCH] Android: log device info and settings --- .../org/citra/citra_emu/CitraApplication.java | 1 + .../java/org/citra/citra_emu/NativeLibrary.java | 5 +++++ src/android/app/src/main/jni/native.cpp | 16 ++++++++++++++-- src/android/app/src/main/jni/native.h | 3 +++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java b/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java index 9d3f80465b..41ac7e27c0 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/CitraApplication.java @@ -44,6 +44,7 @@ public class CitraApplication extends Application { DirectoryInitialization.start(getApplicationContext()); } + NativeLibrary.LogDeviceInfo(); createNotificationChannel(); databaseHelper = new GameDatabase(this); diff --git a/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java b/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java index 48555252e2..d842a805f1 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/NativeLibrary.java @@ -617,6 +617,11 @@ public final class NativeLibrary { public static native void SaveState(int slot); public static native void LoadState(int slot); + /** + * Logs the Citra version, Android version and, CPU. + */ + public static native void LogDeviceInfo(); + /** * Button type for use in onTouchEvent */ diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 9b7fb27a43..b6a2e6ed83 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -7,9 +7,11 @@ #include #include +#include #include #include "audio_core/dsp_interface.h" +#include "common/aarch64/cpu_detect.h" #include "common/file_util.h" #include "common/logging/log.h" #include "common/microprofile.h" @@ -145,7 +147,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { // Citra core only supports a single running instance std::lock_guard lock(running_mutex); - LOG_INFO(Frontend, "Citra is Starting"); + LOG_INFO(Frontend, "Citra starting..."); MicroProfileOnThreadCreate("EmuThread"); @@ -169,6 +171,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { GameSettings::LoadOverrides(program_id); } Settings::Apply(); + Settings::LogSettings(); Camera::RegisterFactory("image", std::make_unique()); @@ -193,7 +196,7 @@ static Core::System::ResultStatus RunCitra(const std::string& filepath) { } auto& telemetry_session = Core::System::GetInstance().TelemetrySession(); - telemetry_session.AddField(Common::Telemetry::FieldType::App, "Frontend", "SDL"); + telemetry_session.AddField(Common::Telemetry::FieldType::App, "Frontend", "Android"); stop_run = false; pause_emulation = false; @@ -725,4 +728,13 @@ void Java_org_citra_citra_1emu_NativeLibrary_LoadState(JNIEnv* env, jclass clazz Core::System::GetInstance().SendSignal(Core::System::Signal::Load, slot); } +void Java_org_citra_citra_1emu_NativeLibrary_LogDeviceInfo(JNIEnv* env, jclass clazz) { + // TODO: Log the Common::g_build_fullname once the CI is setup for android + LOG_INFO(Frontend, "Citra Version: Android Beta | {}-{}", Common::g_scm_branch, + Common::g_scm_desc); + LOG_INFO(Frontend, "Host CPU: {}", Common::GetCPUCaps().cpu_string); + // There is no decent way to get the OS version, so we log the API level instead. + LOG_INFO(Frontend, "Host OS: Android API level {}", android_get_device_api_level()); +} + } // extern "C" diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index f02b15b350..52bfeeecbe 100644 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -155,6 +155,9 @@ JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_SaveState(JNIEnv* JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_LoadState(JNIEnv* env, jclass clazz, jint slot); +JNIEXPORT void JNICALL Java_org_citra_citra_1emu_NativeLibrary_LogDeviceInfo(JNIEnv* env, + jclass clazz); + #ifdef __cplusplus } #endif