From 8715f21bc610ab587042e9cfd5e6dfce29a3596f Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 27 Nov 2022 02:38:07 +0100 Subject: [PATCH] early-access version 3158 --- README.md | 2 +- src/audio_core/sink/sink_stream.cpp | 9 ++++----- src/audio_core/sink/sink_stream.h | 8 +++++++- src/common/settings.h | 2 +- src/core/core.cpp | 11 +++++------ src/core/hid/emulated_devices.cpp | 1 + src/input_common/main.cpp | 10 ++++++++++ src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 2 ++ 8 files changed, 31 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index bedfa73a6..70fbb40c8 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3157. +This is the source code for early-access 3158. ## Legal Notice diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 53de42300..2f49110d0 100755 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -266,19 +266,18 @@ void SinkStream::ProcessAudioOutAndRender(std::span output_buffer, std::siz } void SinkStream::Stall() { - if (stalled) { + if (IsStalled()) { return; } - stalled = true; - system.StallProcesses(); + stalled_lock = system.StallProcesses(); } void SinkStream::Unstall() { - if (!stalled) { + if (!IsStalled()) { return; } system.UnstallProcesses(); - stalled = false; + stalled_lock.unlock(); } } // namespace AudioCore::Sink diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h index 3c9c84ad0..2f12a046e 100755 --- a/src/audio_core/sink/sink_stream.h +++ b/src/audio_core/sink/sink_stream.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -209,6 +210,11 @@ public: */ void Unstall(); +private: + [[nodiscard]] bool IsStalled() const { + return stalled_lock.owns_lock(); + } + protected: /// Core system Core::System& system; @@ -241,7 +247,7 @@ private: /// Set via IAudioDevice service calls f32 device_volume{1.0f}; /// True if coretiming has been stalled - bool stalled{false}; + std::unique_lock stalled_lock; }; using SinkStreamPtr = std::unique_ptr; diff --git a/src/common/settings.h b/src/common/settings.h index 0ba6242cf..256f5080e 100755 --- a/src/common/settings.h +++ b/src/common/settings.h @@ -443,7 +443,7 @@ struct Values { SwitchableSetting nvdec_emulation{NvdecEmulation::GPU, "nvdec_emulation"}; SwitchableSetting accelerate_astc{true, "accelerate_astc"}; SwitchableSetting use_vsync{true, "use_vsync"}; - SwitchableSetting shader_backend{ShaderBackend::GLASM, ShaderBackend::GLSL, + SwitchableSetting shader_backend{ShaderBackend::GLSL, ShaderBackend::GLSL, ShaderBackend::SPIRV, "shader_backend"}; SwitchableSetting use_asynchronous_shaders{false, "use_asynchronous_shaders"}; SwitchableSetting use_fast_gpu_time{true, "use_fast_gpu_time"}; diff --git a/src/core/core.cpp b/src/core/core.cpp index 0fe185b3f..d42b49083 100755 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -189,7 +189,7 @@ struct System::Impl { kernel.Suspend(false); core_timing.SyncPause(false); - is_paused = false; + is_paused.store(false, std::memory_order_relaxed); return status; } @@ -200,14 +200,13 @@ struct System::Impl { core_timing.SyncPause(true); kernel.Suspend(true); - is_paused = true; + is_paused.store(true, std::memory_order_relaxed); return status; } bool IsPaused() const { - std::unique_lock lk(suspend_guard); - return is_paused; + return is_paused.load(std::memory_order_relaxed); } std::unique_lock StallProcesses() { @@ -218,7 +217,7 @@ struct System::Impl { } void UnstallProcesses() { - if (!is_paused) { + if (!IsPaused()) { core_timing.SyncPause(false); kernel.Suspend(false); } @@ -465,7 +464,7 @@ struct System::Impl { } mutable std::mutex suspend_guard; - bool is_paused{}; + std::atomic_bool is_paused{}; std::atomic is_shutting_down{}; Timing::CoreTiming core_timing; diff --git a/src/core/hid/emulated_devices.cpp b/src/core/hid/emulated_devices.cpp index daa2417c7..786b7d87a 100755 --- a/src/core/hid/emulated_devices.cpp +++ b/src/core/hid/emulated_devices.cpp @@ -145,6 +145,7 @@ void EmulatedDevices::UnloadInput() { for (auto& button : keyboard_modifier_devices) { button.reset(); } + ring_analog_device.reset(); } void EmulatedDevices::EnableConfiguration() { diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 9b9deca2d..1c63d15fd 100755 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -138,6 +138,16 @@ struct InputSubsystem::Impl { Common::Input::UnregisterFactory(tas_input->GetEngineName()); tas_input.reset(); + Common::Input::UnregisterFactory(camera->GetEngineName()); + Common::Input::UnregisterFactory(camera->GetEngineName()); + camera.reset(); + + Common::Input::UnregisterFactory( + virtual_amiibo->GetEngineName()); + Common::Input::UnregisterFactory( + virtual_amiibo->GetEngineName()); + virtual_amiibo.reset(); + #ifdef HAVE_SDL2 Common::Input::UnregisterFactory(sdl->GetEngineName()); Common::Input::UnregisterFactory(sdl->GetEngineName()); diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index c6229c68d..a7cefe83f 100755 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp @@ -7,6 +7,7 @@ #include "common/scm_rev.h" #include "common/settings.h" #include "core/core.h" +#include "core/hid/hid_core.h" #include "core/perf_stats.h" #include "input_common/drivers/keyboard.h" #include "input_common/drivers/mouse.h" @@ -26,6 +27,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(InputCommon::InputSubsystem* input_subsystem_, Co } EmuWindow_SDL2::~EmuWindow_SDL2() { + system.HIDCore().UnloadInputDevices(); input_subsystem->Shutdown(); SDL_Quit(); }