VERY experimental Nintendo Switch 2 emulator
C++
android: Use yuzu logging system
Charles Lombardo4c2a80254724
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.ktindex 07f1b48422..ed8fe6c3f0 100644--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/NativeLibrary.kt@@ -462,12 +462,12 @@ object NativeLibrary {}fun setEmulationActivity(emulationActivity: EmulationActivity?) {- Log.verbose("[NativeLibrary] Registering EmulationActivity.")+ Log.debug("[NativeLibrary] Registering EmulationActivity.")sEmulationActivity = WeakReference(emulationActivity)}fun clearEmulationActivity() {- Log.verbose("[NativeLibrary] Unregistering EmulationActivity.")+ Log.debug("[NativeLibrary] Unregistering EmulationActivity.")sEmulationActivity.clear()}diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.ktindex a193e82a4c..1d3c7dce36 100644--- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt+++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/Log.kt@@ -3,38 +3,14 @@package org.yuzu.yuzu_emu.utils-import android.util.Log-import org.yuzu.yuzu_emu.BuildConfig--/**- * Contains methods that call through to [android.util.Log], but- * with the same TAG automatically provided. Also no-ops VERBOSE and DEBUG log- * levels in release builds.- */object Log {- private const val TAG = "Yuzu Frontend"-- fun verbose(message: String) {- if (BuildConfig.DEBUG) {- Log.v(TAG, message)- }- }+ external fun debug(message: String)- fun debug(message: String) {- if (BuildConfig.DEBUG) {- Log.d(TAG, message)- }- }+ external fun warning(message: String)- fun info(message: String) {- Log.i(TAG, message)- }+ external fun info(message: String)- fun warning(message: String) {- Log.w(TAG, message)- }+ external fun error(message: String)- fun error(message: String) {- Log.e(TAG, message)- }+ external fun critical(message: String)}diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txtindex 1c36661f55..88a570f686 100644--- a/src/android/app/src/main/jni/CMakeLists.txt+++ b/src/android/app/src/main/jni/CMakeLists.txt@@ -18,6 +18,7 @@ add_library(yuzu-android SHAREDnative_config.cppuisettings.cppgame_metadata.cpp+ native_log.cpp)set_property(TARGET yuzu-android PROPERTY IMPORTED_LOCATION ${FFmpeg_LIBRARY_DIR})diff --git a/src/android/app/src/main/jni/native_log.cpp b/src/android/app/src/main/jni/native_log.cppnew file mode 100644index 0000000000..33d691dc88--- /dev/null+++ b/src/android/app/src/main/jni/native_log.cpp@@ -0,0 +1,31 @@+// SPDX-FileCopyrightText: 2023 yuzu Emulator Project+// SPDX-License-Identifier: GPL-2.0-or-later++#include <common/logging/log.h>+#include <jni.h>++#include "android_common/android_common.h"++extern "C" {++void Java_org_yuzu_yuzu_1emu_utils_Log_debug(JNIEnv* env, jobject obj, jstring jmessage) {+ LOG_DEBUG(Frontend, "{}", GetJString(env, jmessage));+}++void Java_org_yuzu_yuzu_1emu_utils_Log_warning(JNIEnv* env, jobject obj, jstring jmessage) {+ LOG_WARNING(Frontend, "{}", GetJString(env, jmessage));+}++void Java_org_yuzu_yuzu_1emu_utils_Log_info(JNIEnv* env, jobject obj, jstring jmessage) {+ LOG_INFO(Frontend, "{}", GetJString(env, jmessage));+}++void Java_org_yuzu_yuzu_1emu_utils_Log_error(JNIEnv* env, jobject obj, jstring jmessage) {+ LOG_ERROR(Frontend, "{}", GetJString(env, jmessage));+}++void Java_org_yuzu_yuzu_1emu_utils_Log_critical(JNIEnv* env, jobject obj, jstring jmessage) {+ LOG_CRITICAL(Frontend, "{}", GetJString(env, jmessage));+}++} // extern "C"