From ec04d0c3ffff03d5c69dc1b6f3a45e438471cf26 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 8 Nov 2023 04:40:02 +0100 Subject: [PATCH] early-access version 3969 --- README.md | 2 +- src/CMakeLists.txt | 6 ++-- .../yuzu_emu/fragments/EmulationFragment.kt | 29 ++----------------- src/android/app/src/main/jni/native.cpp | 9 ++---- src/android/app/src/main/jni/native.h | 3 +- .../main/res/layout/fragment_emulation.xml | 8 +++-- src/core/hle/kernel/k_page_table_base.cpp | 13 ++++++--- 7 files changed, 24 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index df9827c07..452a5453b 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3968. +This is the source code for early-access 3969. ## Legal Notice diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 057307a75..767790ade 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -21,7 +21,7 @@ if (MSVC) # Avoid windows.h from including some usually unused libs like winsocks.h, since this might cause some redefinition errors. add_definitions(-DWIN32_LEAN_AND_MEAN) - # Ensure that projects build with Unicode support. + # Ensure that projects are built with Unicode support. add_definitions(-DUNICODE -D_UNICODE) # /W4 - Level 4 warnings @@ -54,11 +54,11 @@ if (MSVC) /GT # Modules - /experimental:module- # Disable module support explicitly due to conflicts with precompiled headers + /experimental:module- # Explicitly disable module support due to conflicts with precompiled headers. # External headers diagnostics /external:anglebrackets # Treats all headers included by #include
, where the header file is enclosed in angle brackets (< >), as external headers - /external:W0 # Sets the default warning level to 0 for external headers, effectively turning off warnings for external headers + /external:W0 # Sets the default warning level to 0 for external headers, effectively disabling warnings for them. # Warnings /W4 diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt index c456c0592..c32fa0d7e 100755 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/fragments/EmulationFragment.kt @@ -10,7 +10,6 @@ import android.content.DialogInterface import android.content.SharedPreferences import android.content.pm.ActivityInfo import android.content.res.Configuration -import android.graphics.Color import android.net.Uri import android.os.Bundle import android.os.Handler @@ -155,7 +154,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { } binding.surfaceEmulation.holder.addCallback(this) - binding.showFpsText.setTextColor(Color.YELLOW) binding.doneControlConfig.setOnClickListener { stopConfiguringControls() } binding.drawerLayout.addDrawerListener(object : DrawerListener { @@ -414,12 +412,12 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { val FRAMETIME = 2 val SPEED = 3 perfStatsUpdater = { - if (emulationViewModel.emulationStarted.value == true) { + if (emulationViewModel.emulationStarted.value) { val perfStats = NativeLibrary.getPerfStats() - if (perfStats[FPS] > 0 && _binding != null) { + if (_binding != null) { binding.showFpsText.text = String.format("FPS: %.1f", perfStats[FPS]) } - perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 100) + perfStatsUpdateHandler.postDelayed(perfStatsUpdater!!, 800) } } perfStatsUpdateHandler.post(perfStatsUpdater!!) @@ -464,7 +462,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { if (it.orientation == FoldingFeature.Orientation.HORIZONTAL) { // Restrict emulation and overlays to the top of the screen binding.emulationContainer.layoutParams.height = it.bounds.top - binding.overlayContainer.layoutParams.height = it.bounds.top // Restrict input and menu drawer to the bottom of the screen binding.inputContainer.layoutParams.height = it.bounds.bottom binding.inGameMenu.layoutParams.height = it.bounds.bottom @@ -478,7 +475,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { if (!isFolding) { binding.emulationContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT binding.inputContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT - binding.overlayContainer.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT binding.inGameMenu.layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT isInFoldableLayout = false updateOrientation() @@ -486,7 +482,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { } binding.emulationContainer.requestLayout() binding.inputContainer.requestLayout() - binding.overlayContainer.requestLayout() binding.inGameMenu.requestLayout() } @@ -712,24 +707,6 @@ class EmulationFragment : Fragment(), SurfaceHolder.Callback { } v.setPadding(left, cutInsets.top, right, 0) - - // Ensure FPS text doesn't get cut off by rounded display corners - val sidePadding = resources.getDimensionPixelSize(R.dimen.spacing_xtralarge) - if (cutInsets.left == 0) { - binding.showFpsText.setPadding( - sidePadding, - cutInsets.top, - cutInsets.right, - cutInsets.bottom - ) - } else { - binding.showFpsText.setPadding( - cutInsets.left, - cutInsets.top, - cutInsets.right, - cutInsets.bottom - ) - } windowInsets } } diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 46438906e..1484cc224 100755 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -199,8 +199,8 @@ bool EmulationSession::IsPaused() const { return m_is_running && m_is_paused; } -const Core::PerfStatsResults& EmulationSession::PerfStats() const { - std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex); +const Core::PerfStatsResults& EmulationSession::PerfStats() { + m_perf_stats = m_system.GetAndResetPerfStats(); return m_perf_stats; } @@ -383,11 +383,6 @@ void EmulationSession::RunEmulation() { break; } } - { - // Refresh performance stats. - std::scoped_lock m_perf_stats_lock(m_perf_stats_mutex); - m_perf_stats = m_system.GetAndResetPerfStats(); - } } } diff --git a/src/android/app/src/main/jni/native.h b/src/android/app/src/main/jni/native.h index 3b9596459..6b02c44b5 100755 --- a/src/android/app/src/main/jni/native.h +++ b/src/android/app/src/main/jni/native.h @@ -41,7 +41,7 @@ public: void RunEmulation(); void ShutdownEmulation(); - const Core::PerfStatsResults& PerfStats() const; + const Core::PerfStatsResults& PerfStats(); void ConfigureFilesystemProvider(const std::string& filepath); void InitializeSystem(bool reload); Core::SystemResultStatus InitializeEmulation(const std::string& filepath); @@ -80,6 +80,5 @@ private: // Synchronization std::condition_variable_any m_cv; - mutable std::mutex m_perf_stats_mutex; mutable std::mutex m_mutex; }; diff --git a/src/android/app/src/main/res/layout/fragment_emulation.xml b/src/android/app/src/main/res/layout/fragment_emulation.xml index 750ce094a..cd6360b45 100755 --- a/src/android/app/src/main/res/layout/fragment_emulation.xml +++ b/src/android/app/src/main/res/layout/fragment_emulation.xml @@ -134,16 +134,18 @@ + android:layout_height="match_parent" + android:fitsSystemWindows="true"> - diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp index 1cc019c06..c97b4a6b7 100755 --- a/src/core/hle/kernel/k_page_table_base.cpp +++ b/src/core/hle/kernel/k_page_table_base.cpp @@ -72,6 +72,11 @@ void InvalidateEntireInstructionCache(Core::System& system) { system.InvalidateCpuInstructionCaches(); } +template +void InvalidateInstructionCache(Core::System& system, AddressType addr, u64 size) { + system.InvalidateCpuInstructionCacheRange(GetInteger(addr), size); +} + template Result InvalidateDataCache(AddressType addr, u64 size) { R_SUCCEED(); @@ -1245,7 +1250,7 @@ Result KPageTableBase::UnmapCodeMemory(KProcessAddress dst_address, KProcessAddr bool reprotected_pages = false; SCOPE_EXIT({ if (reprotected_pages && any_code_pages) { - InvalidateEntireInstructionCache(m_system); + InvalidateInstructionCache(m_system, dst_address, size); } }); @@ -1981,7 +1986,7 @@ Result KPageTableBase::SetProcessMemoryPermission(KProcessAddress addr, size_t s for (const auto& block : pg) { StoreDataCache(GetHeapVirtualPointer(m_kernel, block.GetAddress()), block.GetSize()); } - InvalidateEntireInstructionCache(m_system); + InvalidateInstructionCache(m_system, addr, size); } R_SUCCEED(); @@ -3222,8 +3227,8 @@ Result KPageTableBase::WriteDebugMemory(KProcessAddress dst_address, KProcessAdd // Perform copy for the last block. R_TRY(PerformCopy()); - // Invalidate the entire instruction cache, as this svc allows modifying executable pages. - InvalidateEntireInstructionCache(m_system); + // Invalidate the instruction cache, as this svc allows modifying executable pages. + InvalidateInstructionCache(m_system, dst_address, size); R_SUCCEED(); }