From 16cad6759514db02e5d994cad83e4c59b185dce9 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Wed, 30 Nov 2022 18:07:45 +0100 Subject: [PATCH] early-access version 3170 --- CMakeLists.txt | 4 ---- README.md | 2 +- src/audio_core/precompiled_headers.h | 8 +------- src/audio_core/sink/sink_stream.cpp | 6 ++++-- src/audio_core/sink/sink_stream.h | 7 +------ src/common/CMakeLists.txt | 2 +- src/common/common_headers.h | 12 ++++++++++++ src/common/precompiled_headers.h | 8 +------- src/common/string_util.cpp | 4 ++-- src/core/precompiled_headers.h | 7 +------ src/dedicated_room/precompiled_headers.h | 8 +------- src/input_common/precompiled_headers.h | 8 +------- src/network/precompiled_headers.h | 8 +------- src/shader_recompiler/precompiled_headers.h | 8 +------- src/tests/precompiled_headers.h | 8 +------- src/video_core/precompiled_headers.h | 8 +------- src/web_service/precompiled_headers.h | 8 +------- src/yuzu/precompiled_headers.h | 8 +------- src/yuzu_cmd/precompiled_headers.h | 8 +------- 19 files changed, 33 insertions(+), 99 deletions(-) create mode 100755 src/common/common_headers.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 74e64f52a..6bbee2ecd 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,10 +67,6 @@ elseif(NOT "$ENV{VCPKG_TOOLCHAIN_FILE}" STREQUAL "") endif() if (YUZU_USE_PRECOMPILED_HEADERS) - if (MINGW) - message(WARNING "MINGW has compilation errors with Precompiled Headers. Disabling PCH") - set(YUZU_USE_PRECOMPILED_HEADERS OFF) - endif() if (MSVC AND CCACHE) # buildcache does not properly cache PCH files, leading to compilation errors. # See https://github.com/mbitsnbites/buildcache/discussions/230 diff --git a/README.md b/README.md index 9614c4193..03e095f62 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3169. +This is the source code for early-access 3170. ## Legal Notice diff --git a/src/audio_core/precompiled_headers.h b/src/audio_core/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/audio_core/precompiled_headers.h +++ b/src/audio_core/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/audio_core/sink/sink_stream.cpp b/src/audio_core/sink/sink_stream.cpp index 2f49110d0..8412983cc 100755 --- a/src/audio_core/sink/sink_stream.cpp +++ b/src/audio_core/sink/sink_stream.cpp @@ -266,14 +266,16 @@ void SinkStream::ProcessAudioOutAndRender(std::span output_buffer, std::siz } void SinkStream::Stall() { - if (IsStalled()) { + std::scoped_lock lk{stall_guard}; + if (stalled_lock) { return; } stalled_lock = system.StallProcesses(); } void SinkStream::Unstall() { - if (!IsStalled()) { + std::scoped_lock lk{stall_guard}; + if (!stalled_lock) { return; } system.UnstallProcesses(); diff --git a/src/audio_core/sink/sink_stream.h b/src/audio_core/sink/sink_stream.h index 2f12a046e..39b1bc3ca 100755 --- a/src/audio_core/sink/sink_stream.h +++ b/src/audio_core/sink/sink_stream.h @@ -210,11 +210,6 @@ public: */ void Unstall(); -private: - [[nodiscard]] bool IsStalled() const { - return stalled_lock.owns_lock(); - } - protected: /// Core system Core::System& system; @@ -246,7 +241,7 @@ private: f32 system_volume{1.0f}; /// Set via IAudioDevice service calls f32 device_volume{1.0f}; - /// True if coretiming has been stalled + std::mutex stall_guard; std::unique_lock stalled_lock; }; diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index ef54b4e40..b8aa482de 100755 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -37,6 +37,7 @@ add_library(common STATIC cache_management.cpp cache_management.h common_funcs.h + common_headers.h common_types.h concepts.h div_ceil.h @@ -187,5 +188,4 @@ endif() if (YUZU_USE_PRECOMPILED_HEADERS) target_precompile_headers(common PRIVATE precompiled_headers.h) - set(CMAKE_PCH_INSTANTIATE_TEMPLATES ON) endif() diff --git a/src/common/common_headers.h b/src/common/common_headers.h new file mode 100755 index 000000000..5f81bef98 --- /dev/null +++ b/src/common/common_headers.h @@ -0,0 +1,12 @@ +// SPDX-FileCopyrightText: 2022 yuzu Emulator Project +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include +#include +#include + +#include + +#include "common/assert.h" diff --git a/src/common/precompiled_headers.h b/src/common/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/common/precompiled_headers.h +++ b/src/common/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp index a2440da0d..e4bf6ef06 100755 --- a/src/common/string_util.cpp +++ b/src/common/string_util.cpp @@ -141,7 +141,7 @@ static std::wstring CPToUTF16(u32 code_page, const std::string& input) { MultiByteToWideChar(code_page, 0, input.data(), static_cast(input.size()), nullptr, 0); if (size == 0) { - return L""; + return std::wstring(size, L'\0'); } std::wstring output(size, L'\0'); @@ -158,7 +158,7 @@ std::string UTF16ToUTF8(const std::wstring& input) { const auto size = WideCharToMultiByte(CP_UTF8, 0, input.data(), static_cast(input.size()), nullptr, 0, nullptr, nullptr); if (size == 0) { - return ""; + return std::string(size, '\0'); } std::string output(size, '\0'); diff --git a/src/core/precompiled_headers.h b/src/core/precompiled_headers.h index d224877ea..292e15e5d 100755 --- a/src/core/precompiled_headers.h +++ b/src/core/precompiled_headers.h @@ -3,12 +3,7 @@ #pragma once -#include -#include -#include - #include // used by service.h which is heavily included #include // used by k_auto_object.h which is heavily included -#include -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/dedicated_room/precompiled_headers.h b/src/dedicated_room/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/dedicated_room/precompiled_headers.h +++ b/src/dedicated_room/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/input_common/precompiled_headers.h b/src/input_common/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/input_common/precompiled_headers.h +++ b/src/input_common/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/network/precompiled_headers.h b/src/network/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/network/precompiled_headers.h +++ b/src/network/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/shader_recompiler/precompiled_headers.h b/src/shader_recompiler/precompiled_headers.h index bd8f64a2e..fcdc5daf8 100755 --- a/src/shader_recompiler/precompiled_headers.h +++ b/src/shader_recompiler/precompiled_headers.h @@ -3,11 +3,5 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" #include "frontend/maxwell/translate/impl/impl.h" diff --git a/src/tests/precompiled_headers.h b/src/tests/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/tests/precompiled_headers.h +++ b/src/tests/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/video_core/precompiled_headers.h b/src/video_core/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/video_core/precompiled_headers.h +++ b/src/video_core/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/web_service/precompiled_headers.h b/src/web_service/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/web_service/precompiled_headers.h +++ b/src/web_service/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/yuzu/precompiled_headers.h b/src/yuzu/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/yuzu/precompiled_headers.h +++ b/src/yuzu/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h" diff --git a/src/yuzu_cmd/precompiled_headers.h b/src/yuzu_cmd/precompiled_headers.h index 5f81bef98..62a8da4b5 100755 --- a/src/yuzu_cmd/precompiled_headers.h +++ b/src/yuzu_cmd/precompiled_headers.h @@ -3,10 +3,4 @@ #pragma once -#include -#include -#include - -#include - -#include "common/assert.h" +#include "common/common_headers.h"