summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/CMakeLists.txt7
-rw-r--r--src/core/cpu_manager.h1
-rw-r--r--src/core/debugger/debugger.cpp1
-rw-r--r--src/core/file_sys/content_archive.cpp1
-rw-r--r--src/core/frontend/applets/controller.h1
-rw-r--r--src/core/frontend/emu_window.h2
-rw-r--r--src/core/hid/emulated_controller.cpp4
-rw-r--r--src/core/hid/emulated_controller.h1
-rw-r--r--src/core/hid/emulated_devices.h1
-rw-r--r--src/core/hle/kernel/k_memory_manager.cpp4
-rw-r--r--src/core/hle/kernel/k_slab_heap.h6
-rw-r--r--src/core/hle/kernel/k_thread_local_page.h1
-rw-r--r--src/core/hle/kernel/service_thread.cpp15
-rw-r--r--src/core/hle/kernel/svc_wrap.h4
-rw-r--r--src/core/hle/service/acc/acc.cpp1
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp1
-rw-r--r--src/core/hle/service/am/am.cpp4
-rw-r--r--src/core/hle/service/audio/audin_u.cpp5
-rw-r--r--src/core/hle/service/audio/audout_u.cpp10
-rw-r--r--src/core/hle/service/audio/audren_u.cpp16
-rw-r--r--src/core/hle/service/nifm/nifm.cpp41
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h1
-rw-r--r--src/core/internal_network/network_interface.cpp1
-rw-r--r--src/core/precompiled_headers.h11
-rw-r--r--src/core/telemetry_session.cpp2
25 files changed, 97 insertions, 45 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 7819f9c51..c6b5ac196 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -773,6 +773,7 @@ add_library(core STATIC
memory.h
perf_stats.cpp
perf_stats.h
+ precompiled_headers.h
reporter.cpp
reporter.h
telemetry_session.cpp
@@ -825,5 +826,9 @@ if (ARCHITECTURE_x86_64 OR ARCHITECTURE_arm64)
hle/service/jit/jit.cpp
hle/service/jit/jit.h
)
- target_link_libraries(core PRIVATE dynarmic)
+ target_link_libraries(core PRIVATE dynarmic::dynarmic)
+endif()
+
+if (YUZU_USE_PRECOMPILED_HEADERS)
+ target_precompile_headers(core PRIVATE precompiled_headers.h)
endif()
diff --git a/src/core/cpu_manager.h b/src/core/cpu_manager.h
index 95ea3ef39..374367468 100644
--- a/src/core/cpu_manager.h
+++ b/src/core/cpu_manager.h
@@ -10,6 +10,7 @@
#include <thread>
#include "common/fiber.h"
+#include "common/polyfill_thread.h"
#include "common/thread.h"
#include "core/hardware_properties.h"
diff --git a/src/core/debugger/debugger.cpp b/src/core/debugger/debugger.cpp
index 1a8e02e6a..a9675df76 100644
--- a/src/core/debugger/debugger.cpp
+++ b/src/core/debugger/debugger.cpp
@@ -9,6 +9,7 @@
#include <boost/process/async_pipe.hpp>
#include "common/logging/log.h"
+#include "common/polyfill_thread.h"
#include "common/thread.h"
#include "core/core.h"
#include "core/debugger/debugger.h"
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp
index 78e56bbbd..50303fe42 100644
--- a/src/core/file_sys/content_archive.cpp
+++ b/src/core/file_sys/content_archive.cpp
@@ -7,6 +7,7 @@
#include <utility>
#include "common/logging/log.h"
+#include "common/polyfill_ranges.h"
#include "core/crypto/aes_util.h"
#include "core/crypto/ctr_encryption_layer.h"
#include "core/crypto/key_manager.h"
diff --git a/src/core/frontend/applets/controller.h b/src/core/frontend/applets/controller.h
index 1d2850ad5..71698df74 100644
--- a/src/core/frontend/applets/controller.h
+++ b/src/core/frontend/applets/controller.h
@@ -4,6 +4,7 @@
#pragma once
#include <functional>
+#include <vector>
#include "common/common_types.h"
diff --git a/src/core/frontend/emu_window.h b/src/core/frontend/emu_window.h
index ac1906d5e..95363b645 100644
--- a/src/core/frontend/emu_window.h
+++ b/src/core/frontend/emu_window.h
@@ -17,6 +17,8 @@ enum class WindowSystemType {
Windows,
X11,
Wayland,
+ Cocoa,
+ Android,
};
/**
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp
index c96d9eef3..74c877728 100644
--- a/src/core/hid/emulated_controller.cpp
+++ b/src/core/hid/emulated_controller.cpp
@@ -3,6 +3,7 @@
#include <algorithm>
+#include "common/polyfill_ranges.h"
#include "common/thread.h"
#include "core/hid/emulated_controller.h"
#include "core/hid/input_converter.h"
@@ -109,10 +110,9 @@ void EmulatedController::ReloadFromSettings() {
original_npad_type = npad_type;
}
+ Disconnect();
if (player.connected) {
Connect();
- } else {
- Disconnect();
}
ReloadInput();
diff --git a/src/core/hid/emulated_controller.h b/src/core/hid/emulated_controller.h
index d004ca56a..3f83108d3 100644
--- a/src/core/hid/emulated_controller.h
+++ b/src/core/hid/emulated_controller.h
@@ -8,6 +8,7 @@
#include <memory>
#include <mutex>
#include <unordered_map>
+#include <vector>
#include "common/common_types.h"
#include "common/input.h"
diff --git a/src/core/hid/emulated_devices.h b/src/core/hid/emulated_devices.h
index 4149eeced..4cdbf9dc6 100644
--- a/src/core/hid/emulated_devices.h
+++ b/src/core/hid/emulated_devices.h
@@ -8,6 +8,7 @@
#include <memory>
#include <mutex>
#include <unordered_map>
+#include <vector>
#include "common/common_types.h"
#include "common/input.h"
diff --git a/src/core/hle/kernel/k_memory_manager.cpp b/src/core/hle/kernel/k_memory_manager.cpp
index c4bf306e8..bd33571da 100644
--- a/src/core/hle/kernel/k_memory_manager.cpp
+++ b/src/core/hle/kernel/k_memory_manager.cpp
@@ -225,8 +225,8 @@ Result KMemoryManager::AllocatePageGroupImpl(KPageGroup* out, size_t num_pages,
ON_RESULT_FAILURE {
for (const auto& it : out->Nodes()) {
auto& manager = this->GetManager(it.GetAddress());
- const size_t node_num_pages =
- std::min(it.GetNumPages(), (manager.GetEndAddress() - it.GetAddress()) / PageSize);
+ const size_t node_num_pages = std::min<u64>(
+ it.GetNumPages(), (manager.GetEndAddress() - it.GetAddress()) / PageSize);
manager.Free(it.GetAddress(), node_num_pages);
}
out->Finalize();
diff --git a/src/core/hle/kernel/k_slab_heap.h b/src/core/hle/kernel/k_slab_heap.h
index a8c77a7d4..68469b041 100644
--- a/src/core/hle/kernel/k_slab_heap.h
+++ b/src/core/hle/kernel/k_slab_heap.h
@@ -6,6 +6,7 @@
#include <atomic>
#include "common/assert.h"
+#include "common/atomic_ops.h"
#include "common/common_funcs.h"
#include "common/common_types.h"
#include "common/spin_lock.h"
@@ -82,16 +83,13 @@ private:
private:
void UpdatePeakImpl(uintptr_t obj) {
- static_assert(std::atomic_ref<uintptr_t>::is_always_lock_free);
- std::atomic_ref<uintptr_t> peak_ref(m_peak);
-
const uintptr_t alloc_peak = obj + this->GetObjectSize();
uintptr_t cur_peak = m_peak;
do {
if (alloc_peak <= cur_peak) {
break;
}
- } while (!peak_ref.compare_exchange_strong(cur_peak, alloc_peak));
+ } while (!Common::AtomicCompareAndSwap(&m_peak, alloc_peak, cur_peak, cur_peak));
}
public:
diff --git a/src/core/hle/kernel/k_thread_local_page.h b/src/core/hle/kernel/k_thread_local_page.h
index 5d466ace7..fe0cff084 100644
--- a/src/core/hle/kernel/k_thread_local_page.h
+++ b/src/core/hle/kernel/k_thread_local_page.h
@@ -10,6 +10,7 @@
#include "common/assert.h"
#include "common/common_types.h"
#include "common/intrusive_red_black_tree.h"
+#include "common/polyfill_ranges.h"
#include "core/hle/kernel/memory_types.h"
#include "core/hle/kernel/slab_helpers.h"
#include "core/hle/result.h"
diff --git a/src/core/hle/kernel/service_thread.cpp b/src/core/hle/kernel/service_thread.cpp
index e6e41ac34..e72c3d35d 100644
--- a/src/core/hle/kernel/service_thread.cpp
+++ b/src/core/hle/kernel/service_thread.cpp
@@ -7,6 +7,7 @@
#include <thread>
#include <vector>
+#include "common/polyfill_thread.h"
#include "common/scope_exit.h"
#include "common/thread.h"
#include "core/hle/ipc_helpers.h"
@@ -35,14 +36,14 @@ public:
private:
KernelCore& kernel;
-
- std::jthread m_host_thread;
- std::mutex m_session_mutex;
- std::map<KServerSession*, std::shared_ptr<SessionRequestManager>> m_sessions;
- KEvent* m_wakeup_event;
- KThread* m_thread;
- std::atomic<bool> m_shutdown_requested;
const std::string m_service_name;
+
+ std::jthread m_host_thread{};
+ std::mutex m_session_mutex{};
+ std::map<KServerSession*, std::shared_ptr<SessionRequestManager>> m_sessions{};
+ KEvent* m_wakeup_event{};
+ KThread* m_thread{};
+ std::atomic<bool> m_shutdown_requested{};
};
void ServiceThread::Impl::WaitAndProcessImpl() {
diff --git a/src/core/hle/kernel/svc_wrap.h b/src/core/hle/kernel/svc_wrap.h
index 3730937fe..1ea8c7fbc 100644
--- a/src/core/hle/kernel/svc_wrap.h
+++ b/src/core/hle/kernel/svc_wrap.h
@@ -82,7 +82,7 @@ void SvcWrap64(Core::System& system) {
}
// Used by ControlCodeMemory
-template <Result func(Core::System&, Handle, u32, u64, u64, Svc::MemoryPermission)>
+template <Result func(Core::System&, Handle, u32, VAddr, size_t, Svc::MemoryPermission)>
void SvcWrap64(Core::System& system) {
FuncReturn(system, func(system, static_cast<Handle>(Param(system, 0)),
static_cast<u32>(Param(system, 1)), Param(system, 2), Param(system, 3),
@@ -327,7 +327,7 @@ void SvcWrap64(Core::System& system) {
}
// Used by CreateCodeMemory
-template <Result func(Core::System&, Handle*, u64, u64)>
+template <Result func(Core::System&, Handle*, VAddr, size_t)>
void SvcWrap64(Core::System& system) {
u32 param_1 = 0;
const u32 retval = func(system, &param_1, Param(system, 1), Param(system, 2)).raw;
diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp
index 85a3f0802..6d1084fd1 100644
--- a/src/core/hle/service/acc/acc.cpp
+++ b/src/core/hle/service/acc/acc.cpp
@@ -7,6 +7,7 @@
#include "common/fs/file.h"
#include "common/fs/path_util.h"
#include "common/logging/log.h"
+#include "common/polyfill_ranges.h"
#include "common/string_util.h"
#include "common/swap.h"
#include "core/constants.h"
diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp
index 481e0d141..97f7c6688 100644
--- a/src/core/hle/service/acc/profile_manager.cpp
+++ b/src/core/hle/service/acc/profile_manager.cpp
@@ -9,6 +9,7 @@
#include "common/fs/file.h"
#include "common/fs/fs.h"
#include "common/fs/path_util.h"
+#include "common/polyfill_ranges.h"
#include "common/settings.h"
#include "core/hle/service/acc/profile_manager.h"
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index 8ea7fd760..22999c942 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -1125,7 +1125,7 @@ void IStorageAccessor::Write(Kernel::HLERequestContext& ctx) {
const u64 offset{rp.Pop<u64>()};
const std::vector<u8> data{ctx.ReadBuffer()};
- const std::size_t size{std::min(data.size(), backing.GetSize() - offset)};
+ const std::size_t size{std::min<u64>(data.size(), backing.GetSize() - offset)};
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
@@ -1149,7 +1149,7 @@ void IStorageAccessor::Read(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 offset{rp.Pop<u64>()};
- const std::size_t size{std::min(ctx.GetWriteBufferSize(), backing.GetSize() - offset)};
+ const std::size_t size{std::min<u64>(ctx.GetWriteBufferSize(), backing.GetSize() - offset)};
LOG_DEBUG(Service_AM, "called, offset={}, size={}", offset, size);
diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp
index 053e8f9dd..26dec7147 100644
--- a/src/core/hle/service/audio/audin_u.cpp
+++ b/src/core/hle/service/audio/audin_u.cpp
@@ -203,9 +203,8 @@ private:
};
AudInU::AudInU(Core::System& system_)
- : ServiceFramework{system_, "audin:u", ServiceThreadType::CreateNew},
- service_context{system_, "AudInU"}, impl{std::make_unique<AudioCore::AudioIn::Manager>(
- system_)} {
+ : ServiceFramework{system_, "audin:u"}, service_context{system_, "AudInU"},
+ impl{std::make_unique<AudioCore::AudioIn::Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &AudInU::ListAudioIns, "ListAudioIns"},
diff --git a/src/core/hle/service/audio/audout_u.cpp b/src/core/hle/service/audio/audout_u.cpp
index 29751f075..991e30ba1 100644
--- a/src/core/hle/service/audio/audout_u.cpp
+++ b/src/core/hle/service/audio/audout_u.cpp
@@ -26,9 +26,8 @@ public:
explicit IAudioOut(Core::System& system_, AudioCore::AudioOut::Manager& manager,
size_t session_id, const std::string& device_name,
const AudioOutParameter& in_params, u32 handle, u64 applet_resource_user_id)
- : ServiceFramework{system_, "IAudioOut", ServiceThreadType::CreateNew},
- service_context{system_, "IAudioOut"}, event{service_context.CreateEvent(
- "AudioOutEvent")},
+ : ServiceFramework{system_, "IAudioOut"}, service_context{system_, "IAudioOut"},
+ event{service_context.CreateEvent("AudioOutEvent")},
impl{std::make_shared<AudioCore::AudioOut::Out>(system_, manager, event, session_id)} {
// clang-format off
@@ -221,9 +220,8 @@ private:
};
AudOutU::AudOutU(Core::System& system_)
- : ServiceFramework{system_, "audout:u", ServiceThreadType::CreateNew},
- service_context{system_, "AudOutU"}, impl{std::make_unique<AudioCore::AudioOut::Manager>(
- system_)} {
+ : ServiceFramework{system_, "audout:u"}, service_context{system_, "AudOutU"},
+ impl{std::make_unique<AudioCore::AudioOut::Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &AudOutU::ListAudioOuts, "ListAudioOuts"},
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 034ee273f..ead16c321 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -14,6 +14,7 @@
#include "common/bit_util.h"
#include "common/common_funcs.h"
#include "common/logging/log.h"
+#include "common/polyfill_ranges.h"
#include "common/string_util.h"
#include "core/core.h"
#include "core/hle/ipc_helpers.h"
@@ -34,10 +35,9 @@ public:
AudioCore::AudioRendererParameterInternal& params,
Kernel::KTransferMemory* transfer_memory, u64 transfer_memory_size,
u32 process_handle, u64 applet_resource_user_id, s32 session_id)
- : ServiceFramework{system_, "IAudioRenderer", ServiceThreadType::CreateNew},
- service_context{system_, "IAudioRenderer"}, rendered_event{service_context.CreateEvent(
- "IAudioRendererEvent")},
- manager{manager_}, impl{std::make_unique<Renderer>(system_, manager, rendered_event)} {
+ : ServiceFramework{system_, "IAudioRenderer"}, service_context{system_, "IAudioRenderer"},
+ rendered_event{service_context.CreateEvent("IAudioRendererEvent")}, manager{manager_},
+ impl{std::make_unique<Renderer>(system_, manager, rendered_event)} {
// clang-format off
static const FunctionInfo functions[] = {
{0, &IAudioRenderer::GetSampleRate, "GetSampleRate"},
@@ -242,10 +242,8 @@ class IAudioDevice final : public ServiceFramework<IAudioDevice> {
public:
explicit IAudioDevice(Core::System& system_, u64 applet_resource_user_id, u32 revision,
u32 device_num)
- : ServiceFramework{system_, "IAudioDevice", ServiceThreadType::CreateNew},
- service_context{system_, "IAudioDevice"}, impl{std::make_unique<AudioDevice>(
- system_, applet_resource_user_id,
- revision)},
+ : ServiceFramework{system_, "IAudioDevice"}, service_context{system_, "IAudioDevice"},
+ impl{std::make_unique<AudioDevice>(system_, applet_resource_user_id, revision)},
event{service_context.CreateEvent(fmt::format("IAudioDeviceEvent-{}", device_num))} {
static const FunctionInfo functions[] = {
{0, &IAudioDevice::ListAudioDeviceName, "ListAudioDeviceName"},
@@ -420,7 +418,7 @@ private:
};
AudRenU::AudRenU(Core::System& system_)
- : ServiceFramework{system_, "audren:u", ServiceThreadType::CreateNew},
+ : ServiceFramework{system_, "audren:u"},
service_context{system_, "audren:u"}, impl{std::make_unique<Manager>(system_)} {
// clang-format off
static const FunctionInfo functions[] = {
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index e3ef06481..4fa9f51a6 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -129,6 +129,9 @@ static_assert(sizeof(NifmNetworkProfileData) == 0x18E,
"NifmNetworkProfileData has incorrect size.");
#pragma pack(pop)
+constexpr Result ResultPendingConnection{ErrorModule::NIFM, 111};
+constexpr Result ResultNetworkCommunicationDisabled{ErrorModule::NIFM, 1111};
+
class IScanRequest final : public ServiceFramework<IScanRequest> {
public:
explicit IScanRequest(Core::System& system_) : ServiceFramework{system_, "IScanRequest"} {
@@ -192,6 +195,10 @@ private:
void Submit(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called");
+ if (state == RequestState::NotSubmitted) {
+ UpdateState(RequestState::Pending);
+ }
+
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
}
@@ -201,19 +208,32 @@ private:
IPC::ResponseBuilder rb{ctx, 3};
rb.Push(ResultSuccess);
-
- if (Network::GetHostIPv4Address().has_value()) {
- rb.PushEnum(RequestState::Connected);
- } else {
- rb.PushEnum(RequestState::NotSubmitted);
- }
+ rb.PushEnum(state);
}
void GetResult(Kernel::HLERequestContext& ctx) {
LOG_WARNING(Service_NIFM, "(STUBBED) called");
+ const auto result = [this] {
+ const auto has_connection = Network::GetHostIPv4Address().has_value();
+ switch (state) {
+ case RequestState::NotSubmitted:
+ return has_connection ? ResultSuccess : ResultNetworkCommunicationDisabled;
+ case RequestState::Pending:
+ if (has_connection) {
+ UpdateState(RequestState::Connected);
+ } else {
+ UpdateState(RequestState::Error);
+ }
+ return ResultPendingConnection;
+ case RequestState::Connected:
+ default:
+ return ResultSuccess;
+ }
+ }();
+
IPC::ResponseBuilder rb{ctx, 2};
- rb.Push(ResultSuccess);
+ rb.Push(result);
}
void GetSystemEventReadableHandles(Kernel::HLERequestContext& ctx) {
@@ -252,8 +272,15 @@ private:
rb.Push<u32>(0);
}
+ void UpdateState(RequestState new_state) {
+ state = new_state;
+ event1->Signal();
+ }
+
KernelHelpers::ServiceContext service_context;
+ RequestState state;
+
Kernel::KEvent* event1;
Kernel::KEvent* event2;
};
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 460bef976..9b22397db 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -11,6 +11,7 @@
#include <vector>
#include "common/common_types.h"
+#include "common/polyfill_thread.h"
#include "core/hle/result.h"
#include "core/hle/service/kernel_helpers.h"
diff --git a/src/core/internal_network/network_interface.cpp b/src/core/internal_network/network_interface.cpp
index 057fd3661..7b8e510a2 100644
--- a/src/core/internal_network/network_interface.cpp
+++ b/src/core/internal_network/network_interface.cpp
@@ -9,6 +9,7 @@
#include "common/bit_cast.h"
#include "common/common_types.h"
#include "common/logging/log.h"
+#include "common/polyfill_ranges.h"
#include "common/settings.h"
#include "common/string_util.h"
#include "core/internal_network/network_interface.h"
diff --git a/src/core/precompiled_headers.h b/src/core/precompiled_headers.h
new file mode 100644
index 000000000..30a31001d
--- /dev/null
+++ b/src/core/precompiled_headers.h
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+
+#include <boost/container/flat_map.hpp> // used by service.h which is heavily included
+#include <boost/intrusive/rbtree.hpp> // used by k_auto_object.h which is heavily included
+
+#include "common/common_precompiled_headers.h"
+
+#include "core/hle/kernel/k_process.h"
diff --git a/src/core/telemetry_session.cpp b/src/core/telemetry_session.cpp
index abcf6eb11..8d5f2be2f 100644
--- a/src/core/telemetry_session.cpp
+++ b/src/core/telemetry_session.cpp
@@ -55,6 +55,8 @@ static const char* TranslateRenderer(Settings::RendererBackend backend) {
return "OpenGL";
case Settings::RendererBackend::Vulkan:
return "Vulkan";
+ case Settings::RendererBackend::Null:
+ return "Null";
}
return "Unknown";
}