diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2023-11-04 16:14:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-04 16:14:21 +0100 |
commit | 211b67668d6ea7d96448deec096baeec4391f3fc (patch) | |
tree | 788e1fc9174f05f4a0dbe161e3b7fa40a56c124e | |
parent | Merge pull request #11881 from liamwhite/sockets-safe-access (diff) | |
parent | android: Don't reload log/system after loading firmware/backup (diff) | |
download | yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar.gz yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar.bz2 yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar.lz yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar.xz yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.tar.zst yuzu-211b67668d6ea7d96448deec096baeec4391f3fc.zip |
5 files changed, 18 insertions, 13 deletions
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.kt index ed8fe6c3f..9ebd6c732 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 @@ -252,7 +252,7 @@ object NativeLibrary { external fun reloadKeys(): Boolean - external fun initializeSystem() + external fun initializeSystem(reload: Boolean) external fun defaultCPUCore(): Int diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt index ba1177426..211b7cf69 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/ui/main/MainActivity.kt @@ -403,7 +403,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider { } else { firmwarePath.deleteRecursively() cacheFirmwareDir.copyRecursively(firmwarePath, true) - NativeLibrary.initializeSystem() + NativeLibrary.initializeSystem(true) getString(R.string.save_file_imported_success) } } catch (e: Exception) { @@ -649,7 +649,7 @@ class MainActivity : AppCompatActivity(), ThemeProvider { } // Reinitialize relevant data - NativeLibrary.initializeSystem() + NativeLibrary.initializeSystem(true) gamesViewModel.reloadGames(false) return@newInstance getString(R.string.user_data_import_success) diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryInitialization.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryInitialization.kt index 79a07f7ef..5e9a1176a 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryInitialization.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/utils/DirectoryInitialization.kt @@ -15,7 +15,7 @@ object DirectoryInitialization { fun start() { if (!areDirectoriesReady) { initializeInternalStorage() - NativeLibrary.initializeSystem() + NativeLibrary.initializeSystem(false) areDirectoriesReady = true } } diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 294e41045..46438906e 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -247,11 +247,13 @@ void EmulationSession::ConfigureFilesystemProvider(const std::string& filepath) } } -void EmulationSession::InitializeSystem() { - // Initialize logging system - Common::Log::Initialize(); - Common::Log::SetColorConsoleBackendEnabled(true); - Common::Log::Start(); +void EmulationSession::InitializeSystem(bool reload) { + if (!reload) { + // Initialize logging system + Common::Log::Initialize(); + Common::Log::SetColorConsoleBackendEnabled(true); + Common::Log::Start(); + } // Initialize filesystem. m_system.SetFilesystem(m_vfs); @@ -667,12 +669,15 @@ void Java_org_yuzu_yuzu_1emu_NativeLibrary_onTouchReleased(JNIEnv* env, jclass c } } -void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeSystem(JNIEnv* env, jclass clazz) { +void Java_org_yuzu_yuzu_1emu_NativeLibrary_initializeSystem(JNIEnv* env, jclass clazz, + jboolean reload) { // Create the default config.ini. Config{}; // Initialize the emulated system. - EmulationSession::GetInstance().System().Initialize(); - EmulationSession::GetInstance().InitializeSystem(); + if (!reload) { + EmulationSession::GetInstance().System().Initialize(); + } + EmulationSession::GetInstance().InitializeSystem(reload); } jint Java_org_yuzu_yuzu_1emu_NativeLibrary_defaultCPUCore(JNIEnv* env, jclass clazz) { diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index 0aa2b085b..3b9596459 100644 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -43,7 +43,7 @@ public: const Core::PerfStatsResults& PerfStats() const; void ConfigureFilesystemProvider(const std::string& filepath); - void InitializeSystem(); + void InitializeSystem(bool reload); Core::SystemResultStatus InitializeEmulation(const std::string& filepath); bool IsHandheldOnly(); |