diff options
Diffstat (limited to '')
19 files changed, 93 insertions, 50 deletions
diff --git a/src/android/app/build.gradle.kts b/src/android/app/build.gradle.kts index 4aa19c91a..ec5f78746 100644 --- a/src/android/app/build.gradle.kts +++ b/src/android/app/build.gradle.kts @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + plugins { id("com.android.application") id("org.jetbrains.kotlin.android") diff --git a/src/android/app/proguard-rules.pro b/src/android/app/proguard-rules.pro index 13cfff1ba..691e08fd0 100644 --- a/src/android/app/proguard-rules.pro +++ b/src/android/app/proguard-rules.pro @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 yuzu Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + # To get usable stack traces -dontobfuscate diff --git a/src/android/app/src/main/AndroidManifest.xml b/src/android/app/src/main/AndroidManifest.xml index aed7f9dc4..43087f2c0 100644 --- a/src/android/app/src/main/AndroidManifest.xml +++ b/src/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> + +<!-- +SPDX-FileCopyrightText: 2023 yuzu Emulator Project +SPDX-License-Identifier: GPL-3.0-or-later +--> + <manifest xmlns:android="http://schemas.android.com/apk/res/android"> <uses-feature android:name="android.hardware.touchscreen" diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt index b959ae4ba..263ee7144 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/model/HomeViewModel.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + package org.yuzu.yuzu_emu.model import androidx.lifecycle.LiveData diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt index 95f358c21..f0b0af9e5 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/overlay/InputOverlay.kt @@ -866,9 +866,9 @@ class InputOverlay(context: Context, attrs: AttributeSet?) : SurfaceView(context * Initializes an [InputOverlayDrawableDpad] * * @param context The current [Context]. - * @param defaultResId The [Bitmap] resource ID of the default sate. - * @param pressedOneDirectionResId The [Bitmap] resource ID of the pressed sate in one direction. - * @param pressedTwoDirectionsResId The [Bitmap] resource ID of the pressed sate in two directions. + * @param defaultResId The [Bitmap] resource ID of the default state. + * @param pressedOneDirectionResId The [Bitmap] resource ID of the pressed state in one direction. + * @param pressedTwoDirectionsResId The [Bitmap] resource ID of the pressed state in two directions. * @return the initialized [InputOverlayDrawableDpad] */ private fun initializeOverlayDpad( diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt index 78b978fb5..24e999b29 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InputHandler.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + package org.yuzu.yuzu_emu.utils import android.view.KeyEvent diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt index e587fea06..19c53c481 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/InsetsHelper.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + package org.yuzu.yuzu_emu.utils import android.annotation.SuppressLint diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/NfcReader.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/NfcReader.kt index 1ce220d42..344dd8a0a 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/NfcReader.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/NfcReader.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + package org.yuzu.yuzu_emu.utils import android.app.Activity diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/SerializableHelper.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/SerializableHelper.kt index 23ffbaf68..87ee7f2e6 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/SerializableHelper.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/SerializableHelper.kt @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + package org.yuzu.yuzu_emu.utils import android.content.Intent diff --git a/src/android/app/src/main/jni/CMakeLists.txt b/src/android/app/src/main/jni/CMakeLists.txt index 3cf36b7d1..041781577 100644 --- a/src/android/app/src/main/jni/CMakeLists.txt +++ b/src/android/app/src/main/jni/CMakeLists.txt @@ -1,3 +1,6 @@ +# SPDX-FileCopyrightText: 2023 yuzu Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later + add_library(yuzu-android SHARED android_common/android_common.cpp android_common/android_common.h diff --git a/src/android/app/src/main/jni/applets/software_keyboard.cpp b/src/android/app/src/main/jni/applets/software_keyboard.cpp index c6fffbbab..74e040478 100644 --- a/src/android/app/src/main/jni/applets/software_keyboard.cpp +++ b/src/android/app/src/main/jni/applets/software_keyboard.cpp @@ -263,9 +263,9 @@ void InitJNI(JNIEnv* env) { s_software_keyboard_class, "executeNormal", "(Lorg/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard$KeyboardConfig;)Lorg/yuzu/yuzu_emu/" "applets/keyboard/SoftwareKeyboard$KeyboardData;"); - s_swkbd_execute_inline = - env->GetStaticMethodID(s_software_keyboard_class, "executeInline", - "(Lorg/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard$KeyboardConfig;)V"); + s_swkbd_execute_inline = env->GetStaticMethodID( + s_software_keyboard_class, "executeInline", + "(Lorg/yuzu/yuzu_emu/applets/keyboard/SoftwareKeyboard$KeyboardConfig;)V"); } void CleanupJNI(JNIEnv* env) { diff --git a/src/android/app/src/main/jni/config.cpp b/src/android/app/src/main/jni/config.cpp index 6b4c08145..2d622a048 100644 --- a/src/android/app/src/main/jni/config.cpp +++ b/src/android/app/src/main/jni/config.cpp @@ -232,7 +232,8 @@ void Config::ReadValues() { Settings::values.accelerate_astc = config->GetBoolean("Renderer", "accelerate_astc", false); // Enable asynchronous presentation by default on Android - Settings::values.async_presentation = config->GetBoolean("Renderer", "async_presentation", true); + Settings::values.async_presentation = + config->GetBoolean("Renderer", "async_presentation", true); // Enable force_max_clock by default on Android Settings::values.renderer_force_max_clock = diff --git a/src/android/app/src/main/jni/emu_window/emu_window.cpp b/src/android/app/src/main/jni/emu_window/emu_window.cpp index 926bb30e8..a890c6604 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window.cpp +++ b/src/android/app/src/main/jni/emu_window/emu_window.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #include <android/native_window_jni.h> #include "common/logging/log.h" diff --git a/src/android/app/src/main/jni/emu_window/emu_window.h b/src/android/app/src/main/jni/emu_window/emu_window.h index 36d46eb51..b38087f73 100644 --- a/src/android/app/src/main/jni/emu_window/emu_window.h +++ b/src/android/app/src/main/jni/emu_window/emu_window.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include <memory> diff --git a/src/android/app/src/main/jni/id_cache.cpp b/src/android/app/src/main/jni/id_cache.cpp index 7edadb94a..9cbbf23a3 100644 --- a/src/android/app/src/main/jni/id_cache.cpp +++ b/src/android/app/src/main/jni/id_cache.cpp @@ -107,7 +107,7 @@ void JNI_OnUnload(JavaVM* vm, void* reserved) { env->DeleteGlobalRef(s_disk_cache_progress_class); env->DeleteGlobalRef(s_load_callback_stage_class); - // UnInitialze applets + // UnInitialize applets SoftwareKeyboard::CleanupJNI(env); } diff --git a/src/android/app/src/main/jni/id_cache.h b/src/android/app/src/main/jni/id_cache.h index 9337cd254..be535fe1e 100644 --- a/src/android/app/src/main/jni/id_cache.h +++ b/src/android/app/src/main/jni/id_cache.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + #pragma once #include <jni.h> diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index a7321af2a..bbe6abdb0 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -37,8 +37,8 @@ #include "core/frontend/applets/profile_select.h" #include "core/frontend/applets/software_keyboard.h" #include "core/frontend/applets/web_browser.h" -#include "core/hid/hid_core.h" #include "core/hid/emulated_controller.h" +#include "core/hid/hid_core.h" #include "core/hid/hid_types.h" #include "core/hle/service/acc/profile_manager.h" #include "core/hle/service/am/applet_ae.h" @@ -276,7 +276,7 @@ public: m_rom_metadata_cache.clear(); } - bool IsHandheldOnly(){ + bool IsHandheldOnly() { const auto npad_style_set = m_system.HIDCore().GetSupportedStyleTag(); if (npad_style_set.fullkey == 1) { @@ -290,42 +290,43 @@ public: return !Settings::values.use_docked_mode.GetValue(); } - void SetDeviceType(int index, int type){ + void SetDeviceType(int index, int type) { auto controller = m_system.HIDCore().GetEmulatedControllerByIndex(index); controller->SetNpadStyleIndex(static_cast<Core::HID::NpadStyleIndex>(type)); } - void OnGamepadConnectEvent(int index){ + void OnGamepadConnectEvent(int index) { auto controller = m_system.HIDCore().GetEmulatedControllerByIndex(index); // Ensure that player1 is configured correctly and handheld disconnected - if(controller->GetNpadIdType() == Core::HID::NpadIdType::Player1){ - auto handheld = m_system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); - - if(controller->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::Handheld) { - handheld->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController); - controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController); - handheld->Disconnect(); - } + if (controller->GetNpadIdType() == Core::HID::NpadIdType::Player1) { + auto handheld = + m_system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Handheld); + + if (controller->GetNpadStyleIndex() == Core::HID::NpadStyleIndex::Handheld) { + handheld->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController); + controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::ProController); + handheld->Disconnect(); + } } // Ensure that handheld is configured correctly and player 1 disconnected - if(controller->GetNpadIdType() == Core::HID::NpadIdType::Handheld){ + if (controller->GetNpadIdType() == Core::HID::NpadIdType::Handheld) { auto player1 = m_system.HIDCore().GetEmulatedController(Core::HID::NpadIdType::Player1); - if(controller->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::Handheld) { + if (controller->GetNpadStyleIndex() != Core::HID::NpadStyleIndex::Handheld) { player1->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); controller->SetNpadStyleIndex(Core::HID::NpadStyleIndex::Handheld); player1->Disconnect(); } } - if(!controller->IsConnected()){ + if (!controller->IsConnected()) { controller->Connect(); } } - void OnGamepadDisconnectEvent(int index){ + void OnGamepadDisconnectEvent(int index) { auto controller = m_system.HIDCore().GetEmulatedControllerByIndex(index); controller->Disconnect(); } @@ -497,14 +498,13 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_isRunning([[maybe_unused]] JNIEnv } jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_isHandheldOnly([[maybe_unused]] JNIEnv* env, - [[maybe_unused]] jclass clazz) { + [[maybe_unused]] jclass clazz) { return EmulationSession::GetInstance().IsHandheldOnly(); } jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_setDeviceType([[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, - jint j_device, - jint j_type) { + jint j_device, jint j_type) { if (EmulationSession::GetInstance().IsRunning()) { EmulationSession::GetInstance().SetDeviceType(j_device, j_type); } @@ -512,17 +512,16 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_setDeviceType([[maybe_unused]] JN } jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadConnectEvent([[maybe_unused]] JNIEnv* env, - [[maybe_unused]] jclass clazz, - jint j_device) { + [[maybe_unused]] jclass clazz, + jint j_device) { if (EmulationSession::GetInstance().IsRunning()) { EmulationSession::GetInstance().OnGamepadConnectEvent(j_device); } return static_cast<jboolean>(true); } -jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadDisconnectEvent([[maybe_unused]] JNIEnv* env, - [[maybe_unused]] jclass clazz, - jint j_device) { +jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadDisconnectEvent( + [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, jint j_device) { if (EmulationSession::GetInstance().IsRunning()) { EmulationSession::GetInstance().OnGamepadDisconnectEvent(j_device); } @@ -562,10 +561,11 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadMotionEvent( return static_cast<jboolean>(true); } -jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onReadNfcTag( - [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz, jbyteArray j_data) { +jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onReadNfcTag([[maybe_unused]] JNIEnv* env, + [[maybe_unused]] jclass clazz, + jbyteArray j_data) { jboolean isCopy{false}; - std::span<u8> data(reinterpret_cast<u8 *>(env->GetByteArrayElements(j_data, &isCopy)), + std::span<u8> data(reinterpret_cast<u8*>(env->GetByteArrayElements(j_data, &isCopy)), static_cast<size_t>(env->GetArrayLength(j_data))); if (EmulationSession::GetInstance().IsRunning()) { @@ -574,8 +574,8 @@ jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onReadNfcTag( return static_cast<jboolean>(true); } -jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onRemoveNfcTag( - [[maybe_unused]] JNIEnv* env, [[maybe_unused]] jclass clazz) { +jboolean Java_org_yuzu_yuzu_1emu_NativeLibrary_onRemoveNfcTag([[maybe_unused]] JNIEnv* env, + [[maybe_unused]] jclass clazz) { if (EmulationSession::GetInstance().IsRunning()) { EmulationSession::GetInstance().Window().OnRemoveNfcTag(); } diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index d1e382a33..24dcbbcb8 100644 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -25,17 +25,19 @@ JNIEXPORT void JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_ResetRomMetadata(JN JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_IsRunning(JNIEnv* env, jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_isHandheldOnly( - JNIEnv* env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_isHandheldOnly(JNIEnv* env, + jclass clazz); -JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_setDeviceType( - JNIEnv* env, jclass clazz, jstring j_device, jstring j_type); +JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_setDeviceType(JNIEnv* env, + jclass clazz, + jstring j_device, + jstring j_type); JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadConnectEvent( - JNIEnv* env, jclass clazz, jstring j_device); + JNIEnv* env, jclass clazz, jstring j_device); JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadDisconnectEvent( - JNIEnv* env, jclass clazz, jstring j_device); + JNIEnv* env, jclass clazz, jstring j_device); JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadEvent( JNIEnv* env, jclass clazz, jstring j_device, jint j_button, jint action); @@ -44,13 +46,14 @@ JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadMoveEv JNIEnv* env, jclass clazz, jstring j_device, jint axis, jfloat x, jfloat y); JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onGamePadAxisEvent( - JNIEnv* env, jclass clazz, jstring j_device, jint axis_id, jfloat axis_val); + JNIEnv* env, jclass clazz, jstring j_device, jint axis_id, jfloat axis_val); -JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onReadNfcTag( - JNIEnv* env, jclass clazz, jbyteArray j_data); +JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onReadNfcTag(JNIEnv* env, + jclass clazz, + jbyteArray j_data); -JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onRemoveNfcTag( - JNIEnv* env, jclass clazz); +JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onRemoveNfcTag(JNIEnv* env, + jclass clazz); JNIEXPORT jboolean JNICALL Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchEvent(JNIEnv* env, jclass clazz, diff --git a/src/android/app/src/main/res/values/strings.xml b/src/android/app/src/main/res/values/strings.xml index dd1137b69..cffa3ff0b 100644 --- a/src/android/app/src/main/res/values/strings.xml +++ b/src/android/app/src/main/res/values/strings.xml @@ -78,7 +78,7 @@ <string name="open_user_folder_description">Manage yuzu\'s internal files</string> <string name="theme_and_color_description">Modify the look of the app</string> <string name="no_file_manager">No file manager found</string> - <string name="notification_no_directory_link">Couldn\'t open yuzu directory</string> + <string name="notification_no_directory_link">Could not open yuzu directory</string> <string name="notification_no_directory_link_description">Please locate the user folder with the file manager\'s side panel manually.</string> <!-- About screen strings --> @@ -249,7 +249,7 @@ <string name="language_latin_american_spanish">Latin American Spanish (Español latinoamericano)</string> <string name="language_simplified_chinese">Simplified Chinese (简体中文)</string> <string name="language_traditional_chinese">Traditional Chinese (正體中文)</string> - <string name="language_brazilian_portuguese">Brazilian Portuguese (Portugues do Brasil)</string> + <string name="language_brazilian_portuguese">Brazilian Portuguese (Português do Brasil)</string> <!-- Renderer APIs --> <string name="renderer_vulkan">Vulkan</string> |