summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/android/app/src/main/jni/native.cpp2
-rw-r--r--src/common/demangle.cpp2
-rw-r--r--src/common/detached_tasks.cpp4
-rw-r--r--src/common/settings.cpp3
-rw-r--r--src/common/socket_types.h5
-rw-r--r--src/common/time_zone.cpp47
-rw-r--r--src/core/CMakeLists.txt2
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.cpp6
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_32.h6
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.cpp6
-rw-r--r--src/core/arm/dynarmic/arm_dynarmic_64.h6
-rw-r--r--src/core/arm/dynarmic/dynarmic_exclusive_monitor.h5
-rw-r--r--src/core/core.cpp8
-rw-r--r--src/core/core.h3
-rw-r--r--src/core/hle/kernel/k_thread.cpp4
-rw-r--r--src/core/hle/kernel/kernel.cpp6
-rw-r--r--src/core/hle/kernel/physical_core.cpp8
-rw-r--r--src/core/hle/service/am/am.cpp4
-rw-r--r--src/core/hle/service/nfc/common/amiibo_crypto.cpp2
-rw-r--r--src/core/hle/service/nfc/common/amiibo_crypto.h2
-rw-r--r--src/core/hle/service/nfc/common/device.cpp3
-rw-r--r--src/core/hle/service/nfc/common/device_manager.cpp135
-rw-r--r--src/core/hle/service/nfc/common/device_manager.h34
-rw-r--r--src/core/hle/service/nfc/nfc_interface.cpp18
-rw-r--r--src/core/hle/service/nfc/nfc_result.h3
-rw-r--r--src/core/hle/service/nifm/nifm.cpp1
-rw-r--r--src/core/hle/service/nifm/nifm.h7
-rw-r--r--src/core/hle/service/ssl/ssl_backend.h8
-rw-r--r--src/core/hle/service/ssl/ssl_backend_none.cpp4
-rw-r--r--src/core/hle/service/ssl/ssl_backend_openssl.cpp16
-rw-r--r--src/core/hle/service/ssl/ssl_backend_schannel.cpp9
-rw-r--r--src/core/hle/service/ssl/ssl_backend_securetransport.cpp15
-rw-r--r--src/core/internal_network/socket_proxy.cpp1
-rw-r--r--src/core/internal_network/socket_proxy.h4
-rw-r--r--src/core/internal_network/sockets.h3
-rw-r--r--src/video_core/renderer_base.cpp4
-rw-r--r--src/video_core/renderer_opengl/gl_graphics_pipeline.cpp15
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp8
-rw-r--r--src/video_core/renderer_vulkan/vk_buffer_cache.cpp33
-rw-r--r--src/video_core/renderer_vulkan/vk_pipeline_cache.cpp12
-rw-r--r--src/video_core/renderer_vulkan/vk_query_cache.cpp11
-rw-r--r--src/video_core/renderer_vulkan/vk_texture_cache.cpp6
-rw-r--r--src/web_service/announce_room_json.cpp10
-rw-r--r--src/yuzu/game_list_worker.cpp2
44 files changed, 302 insertions, 191 deletions
diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 8bc6a4a04..c23b2f19e 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -449,7 +449,7 @@ private:
loader->ReadTitle(entry.title);
loader->ReadIcon(entry.icon);
if (loader->GetFileType() == Loader::FileType::NRO) {
- jauto loader_nro = dynamic_cast<Loader::AppLoader_NRO*>(loader.get());
+ jauto loader_nro = reinterpret_cast<Loader::AppLoader_NRO*>(loader.get());
entry.isHomebrew = loader_nro->IsHomebrew();
} else {
entry.isHomebrew = false;
diff --git a/src/common/demangle.cpp b/src/common/demangle.cpp
index 3310faf86..6e117cb41 100644
--- a/src/common/demangle.cpp
+++ b/src/common/demangle.cpp
@@ -23,7 +23,7 @@ std::string DemangleSymbol(const std::string& mangled) {
SCOPE_EXIT({ std::free(demangled); });
if (is_itanium(mangled)) {
- demangled = llvm::itaniumDemangle(mangled.c_str(), nullptr, nullptr, nullptr);
+ demangled = llvm::itaniumDemangle(mangled.c_str());
}
if (!demangled) {
diff --git a/src/common/detached_tasks.cpp b/src/common/detached_tasks.cpp
index da64848da..f2ed795cc 100644
--- a/src/common/detached_tasks.cpp
+++ b/src/common/detached_tasks.cpp
@@ -30,8 +30,8 @@ DetachedTasks::~DetachedTasks() {
void DetachedTasks::AddTask(std::function<void()> task) {
std::unique_lock lock{instance->mutex};
++instance->count;
- std::thread([task{std::move(task)}]() {
- task();
+ std::thread([task_{std::move(task)}]() {
+ task_();
std::unique_lock thread_lock{instance->mutex};
--instance->count;
std::notify_all_at_thread_exit(instance->cv, std::move(thread_lock));
diff --git a/src/common/settings.cpp b/src/common/settings.cpp
index 5972480e5..d4e55f988 100644
--- a/src/common/settings.cpp
+++ b/src/common/settings.cpp
@@ -26,7 +26,8 @@ std::string GetTimeZoneString() {
std::string location_name;
if (time_zone_index == 0) { // Auto
-#if __cpp_lib_chrono >= 201907L
+#if __cpp_lib_chrono >= 201907L && !defined(MINGW)
+ // Disabled for MinGW -- tzdb always returns Etc/UTC
try {
const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb();
const std::chrono::time_zone* current_zone = time_zone_data.current_zone();
diff --git a/src/common/socket_types.h b/src/common/socket_types.h
index b2191c2e8..63824a5c4 100644
--- a/src/common/socket_types.h
+++ b/src/common/socket_types.h
@@ -3,9 +3,10 @@
#pragma once
-#include "common/common_types.h"
-
#include <optional>
+#include <string>
+
+#include "common/common_types.h"
namespace Network {
diff --git a/src/common/time_zone.cpp b/src/common/time_zone.cpp
index d8d7896c6..69e728a9d 100644
--- a/src/common/time_zone.cpp
+++ b/src/common/time_zone.cpp
@@ -4,13 +4,13 @@
#include <chrono>
#include <exception>
#include <iomanip>
+#include <map>
#include <sstream>
#include <stdexcept>
#include <fmt/chrono.h>
#include <fmt/core.h>
#include "common/logging/log.h"
-#include "common/settings.h"
#include "common/time_zone.h"
namespace Common::TimeZone {
@@ -33,32 +33,29 @@ std::string GetDefaultTimeZone() {
return "GMT";
}
-static std::string GetOsTimeZoneOffset() {
- const std::time_t t{std::time(nullptr)};
- const std::tm tm{*std::localtime(&t)};
-
- return fmt::format("{:%z}", tm);
-}
-
-static int ConvertOsTimeZoneOffsetToInt(const std::string& timezone) {
- try {
- return std::stoi(timezone);
- } catch (const std::invalid_argument&) {
- LOG_CRITICAL(Common, "invalid_argument with {}!", timezone);
- return 0;
- } catch (const std::out_of_range&) {
- LOG_CRITICAL(Common, "out_of_range with {}!", timezone);
- return 0;
- }
+// Results are not comparable to seconds since Epoch
+static std::time_t TmSpecToSeconds(const struct std::tm& spec) {
+ const int year = spec.tm_year - 1; // Years up to now
+ const int leap_years = year / 4 - year / 100;
+ std::time_t cumulative = spec.tm_year;
+ cumulative = cumulative * 365 + leap_years + spec.tm_yday; // Years to days
+ cumulative = cumulative * 24 + spec.tm_hour; // Days to hours
+ cumulative = cumulative * 60 + spec.tm_min; // Hours to minutes
+ cumulative = cumulative * 60 + spec.tm_sec; // Minutes to seconds
+ return cumulative;
}
std::chrono::seconds GetCurrentOffsetSeconds() {
- const int offset{ConvertOsTimeZoneOffsetToInt(GetOsTimeZoneOffset())};
+ const std::time_t t{std::time(nullptr)};
+ const std::tm local{*std::localtime(&t)};
+ const std::tm gmt{*std::gmtime(&t)};
- int seconds{(offset / 100) * 60 * 60}; // Convert hour component to seconds
- seconds += (offset % 100) * 60; // Convert minute component to seconds
+ // gmt_seconds is a different offset than time(nullptr)
+ const auto gmt_seconds = TmSpecToSeconds(gmt);
+ const auto local_seconds = TmSpecToSeconds(local);
+ const auto seconds_offset = local_seconds - gmt_seconds;
- return std::chrono::seconds{seconds};
+ return std::chrono::seconds{seconds_offset};
}
// Key is [Hours * 100 + Minutes], multiplied by 100 if DST
@@ -71,11 +68,6 @@ const static std::map<s64, const char*> off_timezones = {
};
std::string FindSystemTimeZone() {
-#if defined(MINGW)
- // MinGW has broken strftime -- https://sourceforge.net/p/mingw-w64/bugs/793/
- // e.g. fmt::format("{:%z}") -- returns "Eastern Daylight Time" when it should be "-0400"
- return timezones[0];
-#else
const s64 seconds = static_cast<s64>(GetCurrentOffsetSeconds().count());
const s64 minutes = seconds / 60;
@@ -97,7 +89,6 @@ std::string FindSystemTimeZone() {
}
}
return fmt::format("Etc/GMT{:s}{:d}", hours > 0 ? "-" : "+", std::abs(hours));
-#endif
}
} // namespace Common::TimeZone
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index c3b688c5d..4b7395be8 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -876,7 +876,7 @@ elseif (APPLE)
elseif (WIN32)
target_sources(core PRIVATE
hle/service/ssl/ssl_backend_schannel.cpp)
- target_link_libraries(core PRIVATE secur32)
+ target_link_libraries(core PRIVATE crypt32 secur32)
else()
target_sources(core PRIVATE
hle/service/ssl/ssl_backend_none.cpp)
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.cpp b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
index 3b82fb73c..c97158a71 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.cpp
@@ -346,11 +346,11 @@ void ARM_Dynarmic_32::RewindBreakpointInstruction() {
}
ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_,
- ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_)
+ DynarmicExclusiveMonitor& exclusive_monitor_,
+ std::size_t core_index_)
: ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)),
cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_},
- exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
- null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {}
+ exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {}
ARM_Dynarmic_32::~ARM_Dynarmic_32() = default;
diff --git a/src/core/arm/dynarmic/arm_dynarmic_32.h b/src/core/arm/dynarmic/arm_dynarmic_32.h
index a990845cb..92fb3f836 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_32.h
+++ b/src/core/arm/dynarmic/arm_dynarmic_32.h
@@ -12,7 +12,7 @@
#include "common/common_types.h"
#include "common/hash.h"
#include "core/arm/arm_interface.h"
-#include "core/arm/exclusive_monitor.h"
+#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
namespace Core::Memory {
class Memory;
@@ -28,8 +28,8 @@ class System;
class ARM_Dynarmic_32 final : public ARM_Interface {
public:
- ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
- std::size_t core_index_);
+ ARM_Dynarmic_32(System& system_, bool uses_wall_clock_,
+ DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
~ARM_Dynarmic_32() override;
void SetPC(u64 pc) override;
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.cpp b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
index bb97ed5bc..791d466ca 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.cpp
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.cpp
@@ -405,11 +405,11 @@ void ARM_Dynarmic_64::RewindBreakpointInstruction() {
}
ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_,
- ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_)
+ DynarmicExclusiveMonitor& exclusive_monitor_,
+ std::size_t core_index_)
: ARM_Interface{system_, uses_wall_clock_},
cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_},
- exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)},
- null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {}
+ exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {}
ARM_Dynarmic_64::~ARM_Dynarmic_64() = default;
diff --git a/src/core/arm/dynarmic/arm_dynarmic_64.h b/src/core/arm/dynarmic/arm_dynarmic_64.h
index af2aa1f1c..2b88a08e2 100644
--- a/src/core/arm/dynarmic/arm_dynarmic_64.h
+++ b/src/core/arm/dynarmic/arm_dynarmic_64.h
@@ -11,7 +11,7 @@
#include "common/common_types.h"
#include "common/hash.h"
#include "core/arm/arm_interface.h"
-#include "core/arm/exclusive_monitor.h"
+#include "core/arm/dynarmic/dynarmic_exclusive_monitor.h"
namespace Core::Memory {
class Memory;
@@ -25,8 +25,8 @@ class System;
class ARM_Dynarmic_64 final : public ARM_Interface {
public:
- ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_,
- std::size_t core_index_);
+ ARM_Dynarmic_64(System& system_, bool uses_wall_clock_,
+ DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_);
~ARM_Dynarmic_64() override;
void SetPC(u64 pc) override;
diff --git a/src/core/arm/dynarmic/dynarmic_exclusive_monitor.h b/src/core/arm/dynarmic/dynarmic_exclusive_monitor.h
index 57e6dd0d0..fbfcd8d95 100644
--- a/src/core/arm/dynarmic/dynarmic_exclusive_monitor.h
+++ b/src/core/arm/dynarmic/dynarmic_exclusive_monitor.h
@@ -6,8 +6,6 @@
#include <dynarmic/interface/exclusive_monitor.h>
#include "common/common_types.h"
-#include "core/arm/dynarmic/arm_dynarmic_32.h"
-#include "core/arm/dynarmic/arm_dynarmic_64.h"
#include "core/arm/exclusive_monitor.h"
namespace Core::Memory {
@@ -16,6 +14,9 @@ class Memory;
namespace Core {
+class ARM_Dynarmic_32;
+class ARM_Dynarmic_64;
+
class DynarmicExclusiveMonitor final : public ExclusiveMonitor {
public:
explicit DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_);
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 9e3eb3795..48233d7c8 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -880,6 +880,14 @@ const FileSys::ContentProvider& System::GetContentProvider() const {
return *impl->content_provider;
}
+FileSys::ContentProviderUnion& System::GetContentProviderUnion() {
+ return *impl->content_provider;
+}
+
+const FileSys::ContentProviderUnion& System::GetContentProviderUnion() const {
+ return *impl->content_provider;
+}
+
Service::FileSystem::FileSystemController& System::GetFileSystemController() {
return impl->fs_controller;
}
diff --git a/src/core/core.h b/src/core/core.h
index 14b2f7785..c70ea1965 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -381,6 +381,9 @@ public:
[[nodiscard]] FileSys::ContentProvider& GetContentProvider();
[[nodiscard]] const FileSys::ContentProvider& GetContentProvider() const;
+ [[nodiscard]] FileSys::ContentProviderUnion& GetContentProviderUnion();
+ [[nodiscard]] const FileSys::ContentProviderUnion& GetContentProviderUnion() const;
+
[[nodiscard]] Service::FileSystem::FileSystemController& GetFileSystemController();
[[nodiscard]] const Service::FileSystem::FileSystemController& GetFileSystemController() const;
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index adb6ec581..d88909889 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -302,12 +302,12 @@ Result KThread::InitializeServiceThread(Core::System& system, KThread* thread,
std::function<void()>&& func, s32 prio, s32 virt_core,
KProcess* owner) {
system.Kernel().GlobalSchedulerContext().AddThread(thread);
- std::function<void()> func2{[&system, func{std::move(func)}] {
+ std::function<void()> func2{[&system, func_{std::move(func)}] {
// Similar to UserModeThreadStarter.
system.Kernel().CurrentScheduler()->OnThreadStart();
// Run the guest function.
- func();
+ func_();
// Exit.
Svc::ExitThread(system);
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index f33600ca5..ebe7582c6 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -1089,15 +1089,15 @@ static std::jthread RunHostThreadFunc(KernelCore& kernel, KProcess* process,
KThread::Register(kernel, thread);
return std::jthread(
- [&kernel, thread, thread_name{std::move(thread_name)}, func{std::move(func)}] {
+ [&kernel, thread, thread_name_{std::move(thread_name)}, func_{std::move(func)}] {
// Set the thread name.
- Common::SetCurrentThreadName(thread_name.c_str());
+ Common::SetCurrentThreadName(thread_name_.c_str());
// Set the thread as current.
kernel.RegisterHostThread(thread);
// Run the callback.
- func();
+ func_();
// Close the thread.
// This will free the process if it is the last reference.
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 2e0c36129..5ee869fa2 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -17,7 +17,9 @@ PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system, KSchedu
// a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager.
auto& kernel = system.Kernel();
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
- system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
+ system, kernel.IsMulticore(),
+ reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()),
+ m_core_index);
#else
#error Platform not supported yet.
#endif
@@ -31,7 +33,9 @@ void PhysicalCore::Initialize(bool is_64_bit) {
if (!is_64_bit) {
// We already initialized a 64-bit core, replace with a 32-bit one.
m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
- m_system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index);
+ m_system, kernel.IsMulticore(),
+ reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()),
+ m_core_index);
}
#else
#error Platform not supported yet.
diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp
index a2375508a..4f400d341 100644
--- a/src/core/hle/service/am/am.cpp
+++ b/src/core/hle/service/am/am.cpp
@@ -506,8 +506,8 @@ void ISelfController::SetHandlesRequestToDisplay(HLERequestContext& ctx) {
void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
idle_time_detection_extension = rp.Pop<u32>();
- LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}",
- idle_time_detection_extension);
+ LOG_DEBUG(Service_AM, "(STUBBED) called idle_time_detection_extension={}",
+ idle_time_detection_extension);
IPC::ResponseBuilder rb{ctx, 2};
rb.Push(ResultSuccess);
diff --git a/src/core/hle/service/nfc/common/amiibo_crypto.cpp b/src/core/hle/service/nfc/common/amiibo_crypto.cpp
index bc232c334..9556e9193 100644
--- a/src/core/hle/service/nfc/common/amiibo_crypto.cpp
+++ b/src/core/hle/service/nfc/common/amiibo_crypto.cpp
@@ -180,7 +180,7 @@ std::vector<u8> GenerateInternalKey(const InternalKey& key, const HashSeed& seed
}
void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key,
- const std::vector<u8>& seed) {
+ std::span<const u8> seed) {
// Initialize context
ctx.used = false;
ctx.counter = 0;
diff --git a/src/core/hle/service/nfc/common/amiibo_crypto.h b/src/core/hle/service/nfc/common/amiibo_crypto.h
index 6a3e0841e..2cc0e4d51 100644
--- a/src/core/hle/service/nfc/common/amiibo_crypto.h
+++ b/src/core/hle/service/nfc/common/amiibo_crypto.h
@@ -75,7 +75,7 @@ std::vector<u8> GenerateInternalKey(const InternalKey& key, const HashSeed& seed
// Initializes mbedtls context
void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key,
- const std::vector<u8>& seed);
+ std::span<const u8> seed);
// Feeds data to mbedtls context to generate the derived key
void CryptoStep(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, DrgbOutput& output);
diff --git a/src/core/hle/service/nfc/common/device.cpp b/src/core/hle/service/nfc/common/device.cpp
index 2d633b03f..49446bc42 100644
--- a/src/core/hle/service/nfc/common/device.cpp
+++ b/src/core/hle/service/nfc/common/device.cpp
@@ -34,8 +34,6 @@
#include "core/hle/service/nfc/mifare_result.h"
#include "core/hle/service/nfc/nfc_result.h"
#include "core/hle/service/time/time_manager.h"
-#include "core/hle/service/time/time_zone_content_manager.h"
-#include "core/hle/service/time/time_zone_types.h"
namespace Service::NFC {
NfcDevice::NfcDevice(Core::HID::NpadIdType npad_id_, Core::System& system_,
@@ -1486,6 +1484,7 @@ DeviceState NfcDevice::GetCurrentState() const {
}
Result NfcDevice::GetNpadId(Core::HID::NpadIdType& out_npad_id) const {
+ // TODO: This should get the npad id from nn::hid::system::GetXcdHandleForNpadWithNfc
out_npad_id = npad_id;
return ResultSuccess;
}
diff --git a/src/core/hle/service/nfc/common/device_manager.cpp b/src/core/hle/service/nfc/common/device_manager.cpp
index 562f3a28e..a71d26157 100644
--- a/src/core/hle/service/nfc/common/device_manager.cpp
+++ b/src/core/hle/service/nfc/common/device_manager.cpp
@@ -1,6 +1,8 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
+#include <algorithm>
+
#include "common/logging/log.h"
#include "core/core.h"
#include "core/hid/hid_types.h"
@@ -10,6 +12,7 @@
#include "core/hle/service/nfc/common/device_manager.h"
#include "core/hle/service/nfc/nfc_result.h"
#include "core/hle/service/time/clock_types.h"
+#include "core/hle/service/time/time_manager.h"
namespace Service::NFC {
@@ -51,22 +54,53 @@ Result DeviceManager::Finalize() {
return ResultSuccess;
}
-Result DeviceManager::ListDevices(std::vector<u64>& nfp_devices,
- std::size_t max_allowed_devices) const {
+Result DeviceManager::ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices,
+ bool skip_fatal_errors) const {
+ std::scoped_lock lock{mutex};
+ if (max_allowed_devices < 1) {
+ return ResultInvalidArgument;
+ }
+
+ Result result = IsNfcParameterSet();
+ if (result.IsError()) {
+ return result;
+ }
+
+ result = IsNfcEnabled();
+ if (result.IsError()) {
+ return result;
+ }
+
+ result = IsNfcInitialized();
+ if (result.IsError()) {
+ return result;
+ }
+
for (auto& device : devices) {
if (nfp_devices.size() >= max_allowed_devices) {
continue;
}
- if (device->GetCurrentState() != DeviceState::Unavailable) {
- nfp_devices.push_back(device->GetHandle());
+ if (skip_fatal_errors) {
+ constexpr u64 MinimumRecoveryTime = 60;
+ auto& standard_steady_clock{system.GetTimeManager().GetStandardSteadyClockCore()};
+ const u64 elapsed_time = standard_steady_clock.GetCurrentTimePoint(system).time_point -
+ time_since_last_error;
+
+ if (time_since_last_error != 0 && elapsed_time < MinimumRecoveryTime) {
+ continue;
+ }
}
+ if (device->GetCurrentState() == DeviceState::Unavailable) {
+ continue;
+ }
+ nfp_devices.push_back(device->GetHandle());
}
if (nfp_devices.empty()) {
return ResultDeviceNotFound;
}
- return ResultSuccess;
+ return result;
}
DeviceState DeviceManager::GetDeviceState(u64 device_handle) const {
@@ -79,10 +113,10 @@ DeviceState DeviceManager::GetDeviceState(u64 device_handle) const {
return device->GetCurrentState();
}
- return DeviceState::Unavailable;
+ return DeviceState::Finalized;
}
-Result DeviceManager::GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) const {
+Result DeviceManager::GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -128,7 +162,7 @@ Result DeviceManager::StopDetection(u64 device_handle) {
return result;
}
-Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) const {
+Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -142,24 +176,46 @@ Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) const {
return result;
}
-Kernel::KReadableEvent& DeviceManager::AttachActivateEvent(u64 device_handle) const {
- std::scoped_lock lock{mutex};
-
+Result DeviceManager::AttachActivateEvent(Kernel::KReadableEvent** out_event,
+ u64 device_handle) const {
+ std::vector<u64> nfp_devices;
std::shared_ptr<NfcDevice> device = nullptr;
- GetDeviceFromHandle(device_handle, device, false);
+ Result result = ListDevices(nfp_devices, 9, false);
- // TODO: Return proper error code on failure
- return device->GetActivateEvent();
-}
+ if (result.IsSuccess()) {
+ result = CheckHandleOnList(device_handle, nfp_devices);
+ }
-Kernel::KReadableEvent& DeviceManager::AttachDeactivateEvent(u64 device_handle) const {
- std::scoped_lock lock{mutex};
+ if (result.IsSuccess()) {
+ result = GetDeviceFromHandle(device_handle, device, false);
+ }
+
+ if (result.IsSuccess()) {
+ *out_event = &device->GetActivateEvent();
+ }
+
+ return result;
+}
+Result DeviceManager::AttachDeactivateEvent(Kernel::KReadableEvent** out_event,
+ u64 device_handle) const {
+ std::vector<u64> nfp_devices;
std::shared_ptr<NfcDevice> device = nullptr;
- GetDeviceFromHandle(device_handle, device, false);
+ Result result = ListDevices(nfp_devices, 9, false);
- // TODO: Return proper error code on failure
- return device->GetDeactivateEvent();
+ if (result.IsSuccess()) {
+ result = CheckHandleOnList(device_handle, nfp_devices);
+ }
+
+ if (result.IsSuccess()) {
+ result = GetDeviceFromHandle(device_handle, device, false);
+ }
+
+ if (result.IsSuccess()) {
+ *out_event = &device->GetDeactivateEvent();
+ }
+
+ return result;
}
Result DeviceManager::ReadMifare(u64 device_handle,
@@ -253,7 +309,7 @@ Result DeviceManager::OpenApplicationArea(u64 device_handle, u32 access_id) {
return result;
}
-Result DeviceManager::GetApplicationArea(u64 device_handle, std::span<u8> data) const {
+Result DeviceManager::GetApplicationArea(u64 device_handle, std::span<u8> data) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -324,7 +380,7 @@ Result DeviceManager::CreateApplicationArea(u64 device_handle, u32 access_id,
return result;
}
-Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) const {
+Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -338,7 +394,7 @@ Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& regi
return result;
}
-Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) const {
+Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -352,7 +408,7 @@ Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_i
return result;
}
-Result DeviceManager::GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) const {
+Result DeviceManager::GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -399,7 +455,7 @@ Result DeviceManager::Format(u64 device_handle) {
return result;
}
-Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) const {
+Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -414,7 +470,7 @@ Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info
}
Result DeviceManager::GetRegisterInfoPrivate(u64 device_handle,
- NFP::RegisterInfoPrivate& register_info) const {
+ NFP::RegisterInfoPrivate& register_info) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -471,7 +527,7 @@ Result DeviceManager::DeleteApplicationArea(u64 device_handle) {
return result;
}
-Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_application_area) const {
+Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_application_area) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -485,7 +541,7 @@ Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_applica
return result;
}
-Result DeviceManager::GetAll(u64 device_handle, NFP::NfpData& nfp_data) const {
+Result DeviceManager::GetAll(u64 device_handle, NFP::NfpData& nfp_data) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -541,7 +597,7 @@ Result DeviceManager::BreakTag(u64 device_handle, NFP::BreakType break_type) {
return result;
}
-Result DeviceManager::ReadBackupData(u64 device_handle, std::span<u8> data) const {
+Result DeviceManager::ReadBackupData(u64 device_handle, std::span<u8> data) {
std::scoped_lock lock{mutex};
std::shared_ptr<NfcDevice> device = nullptr;
@@ -593,6 +649,19 @@ Result DeviceManager::WriteNtf(u64 device_handle, NFP::WriteType, std::span<cons
return result;
}
+Result DeviceManager::CheckHandleOnList(u64 device_handle,
+ const std::span<const u64> device_list) const {
+ if (device_list.size() < 1) {
+ return ResultDeviceNotFound;
+ }
+
+ if (std::find(device_list.begin(), device_list.end(), device_handle) != device_list.end()) {
+ return ResultSuccess;
+ }
+
+ return ResultDeviceNotFound;
+}
+
Result DeviceManager::GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& nfc_device,
bool check_state) const {
if (check_state) {
@@ -647,7 +716,7 @@ Result DeviceManager::GetDeviceHandle(u64 handle, std::shared_ptr<NfcDevice>& de
}
Result DeviceManager::VerifyDeviceResult(std::shared_ptr<NfcDevice> device,
- Result operation_result) const {
+ Result operation_result) {
if (operation_result.IsSuccess()) {
return operation_result;
}
@@ -669,6 +738,12 @@ Result DeviceManager::VerifyDeviceResult(std::shared_ptr<NfcDevice> device,
return device_state;
}
+ if (operation_result == ResultUnknown112 || operation_result == ResultUnknown114 ||
+ operation_result == ResultUnknown115) {
+ auto& standard_steady_clock{system.GetTimeManager().GetStandardSteadyClockCore()};
+ time_since_last_error = standard_steady_clock.GetCurrentTimePoint(system).time_point;
+ }
+
return operation_result;
}
diff --git a/src/core/hle/service/nfc/common/device_manager.h b/src/core/hle/service/nfc/common/device_manager.h
index c61ba0cf3..c9f038e32 100644
--- a/src/core/hle/service/nfc/common/device_manager.h
+++ b/src/core/hle/service/nfc/common/device_manager.h
@@ -27,15 +27,16 @@ public:
// Nfc device manager
Result Initialize();
Result Finalize();
- Result ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices) const;
+ Result ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices,
+ bool skip_fatal_errors) const;
DeviceState GetDeviceState(u64 device_handle) const;
- Result GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) const;
+ Result GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id);
Kernel::KReadableEvent& AttachAvailabilityChangeEvent() const;
Result StartDetection(u64 device_handle, NfcProtocol tag_protocol);
Result StopDetection(u64 device_handle);
- Result GetTagInfo(u64 device_handle, NFP::TagInfo& tag_info) const;
- Kernel::KReadableEvent& AttachActivateEvent(u64 device_handle) const;
- Kernel::KReadableEvent& AttachDeactivateEvent(u64 device_handle) const;
+ Result GetTagInfo(u64 device_handle, NFP::TagInfo& tag_info);
+ Result AttachActivateEvent(Kernel::KReadableEvent** event, u64 device_handle) const;
+ Result AttachDeactivateEvent(Kernel::KReadableEvent** event, u64 device_handle) const;
Result ReadMifare(u64 device_handle,
const std::span<const MifareReadBlockParameter> read_parameters,
std::span<MifareReadBlockData> read_data);
@@ -48,28 +49,28 @@ public:
Result Mount(u64 device_handle, NFP::ModelType model_type, NFP::MountTarget mount_target);
Result Unmount(u64 device_handle);
Result OpenApplicationArea(u64 device_handle, u32 access_id);
- Result GetApplicationArea(u64 device_handle, std::span<u8> data) const;
+ Result GetApplicationArea(u64 device_handle, std::span<u8> data);
Result SetApplicationArea(u64 device_handle, std::span<const u8> data);
Result Flush(u64 device_handle);
Result Restore(u64 device_handle);
Result CreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data);
- Result GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) const;
- Result GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) const;
- Result GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) const;
+ Result GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info);
+ Result GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info);
+ Result GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info);
u32 GetApplicationAreaSize() const;
Result RecreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data);
Result Format(u64 device_handle);
- Result GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) const;
- Result GetRegisterInfoPrivate(u64 device_handle, NFP::RegisterInfoPrivate& register_info) const;
+ Result GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info);
+ Result GetRegisterInfoPrivate(u64 device_handle, NFP::RegisterInfoPrivate& register_info);
Result SetRegisterInfoPrivate(u64 device_handle, const NFP::RegisterInfoPrivate& register_info);
Result DeleteRegisterInfo(u64 device_handle);
Result DeleteApplicationArea(u64 device_handle);
- Result ExistsApplicationArea(u64 device_handle, bool& has_application_area) const;
- Result GetAll(u64 device_handle, NFP::NfpData& nfp_data) const;
+ Result ExistsApplicationArea(u64 device_handle, bool& has_application_area);
+ Result GetAll(u64 device_handle, NFP::NfpData& nfp_data);
Result SetAll(u64 device_handle, const NFP::NfpData& nfp_data);
Result FlushDebug(u64 device_handle);
Result BreakTag(u64 device_handle, NFP::BreakType break_type);
- Result ReadBackupData(u64 device_handle, std::span<u8> data) const;
+ Result ReadBackupData(u64 device_handle, std::span<u8> data);
Result WriteBackupData(u64 device_handle, std::span<const u8> data);
Result WriteNtf(u64 device_handle, NFP::WriteType, std::span<const u8> data);
@@ -78,17 +79,20 @@ private:
Result IsNfcParameterSet() const;
Result IsNfcInitialized() const;
+ Result CheckHandleOnList(u64 device_handle, std::span<const u64> device_list) const;
+
Result GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& device,
bool check_state) const;
Result GetDeviceHandle(u64 handle, std::shared_ptr<NfcDevice>& device) const;
- Result VerifyDeviceResult(std::shared_ptr<NfcDevice> device, Result operation_result) const;
+ Result VerifyDeviceResult(std::shared_ptr<NfcDevice> device, Result operation_result);
Result CheckDeviceState(std::shared_ptr<NfcDevice> device) const;
std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle);
const std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle) const;
bool is_initialized = false;
+ u64 time_since_last_error = 0;
mutable std::mutex mutex;
std::array<std::shared_ptr<NfcDevice>, 10> devices{};
diff --git a/src/core/hle/service/nfc/nfc_interface.cpp b/src/core/hle/service/nfc/nfc_interface.cpp
index e7ca7582e..179c7ba2c 100644
--- a/src/core/hle/service/nfc/nfc_interface.cpp
+++ b/src/core/hle/service/nfc/nfc_interface.cpp
@@ -79,7 +79,7 @@ void NfcInterface::ListDevices(HLERequestContext& ctx) {
const std::size_t max_allowed_devices = ctx.GetWriteBufferNumElements<u64>();
LOG_DEBUG(Service_NFC, "called");
- auto result = GetManager()->ListDevices(nfp_devices, max_allowed_devices);
+ auto result = GetManager()->ListDevices(nfp_devices, max_allowed_devices, true);
result = TranslateResultToServiceError(result);
if (result.IsError()) {
@@ -190,9 +190,13 @@ void NfcInterface::AttachActivateEvent(HLERequestContext& ctx) {
const auto device_handle{rp.Pop<u64>()};
LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
+ Kernel::KReadableEvent* out_event = nullptr;
+ auto result = GetManager()->AttachActivateEvent(&out_event, device_handle);
+ result = TranslateResultToServiceError(result);
+
IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(GetManager()->AttachActivateEvent(device_handle));
+ rb.Push(result);
+ rb.PushCopyObjects(out_event);
}
void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) {
@@ -200,9 +204,13 @@ void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) {
const auto device_handle{rp.Pop<u64>()};
LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle);
+ Kernel::KReadableEvent* out_event = nullptr;
+ auto result = GetManager()->AttachDeactivateEvent(&out_event, device_handle);
+ result = TranslateResultToServiceError(result);
+
IPC::ResponseBuilder rb{ctx, 2, 1};
- rb.Push(ResultSuccess);
- rb.PushCopyObjects(GetManager()->AttachDeactivateEvent(device_handle));
+ rb.Push(result);
+ rb.PushCopyObjects(out_event);
}
void NfcInterface::ReadMifare(HLERequestContext& ctx) {
diff --git a/src/core/hle/service/nfc/nfc_result.h b/src/core/hle/service/nfc/nfc_result.h
index 715c0e80c..464b5fd69 100644
--- a/src/core/hle/service/nfc/nfc_result.h
+++ b/src/core/hle/service/nfc/nfc_result.h
@@ -17,7 +17,10 @@ constexpr Result ResultNfcNotInitialized(ErrorModule::NFC, 77);
constexpr Result ResultNfcDisabled(ErrorModule::NFC, 80);
constexpr Result ResultWriteAmiiboFailed(ErrorModule::NFC, 88);
constexpr Result ResultTagRemoved(ErrorModule::NFC, 97);
+constexpr Result ResultUnknown112(ErrorModule::NFC, 112);
constexpr Result ResultUnableToAccessBackupFile(ErrorModule::NFC, 113);
+constexpr Result ResultUnknown114(ErrorModule::NFC, 114);
+constexpr Result ResultUnknown115(ErrorModule::NFC, 115);
constexpr Result ResultRegistrationIsNotInitialized(ErrorModule::NFC, 120);
constexpr Result ResultApplicationAreaIsNotInitialized(ErrorModule::NFC, 128);
constexpr Result ResultCorruptedDataWithBackup(ErrorModule::NFC, 136);
diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp
index 91d42853e..21b06d10b 100644
--- a/src/core/hle/service/nifm/nifm.cpp
+++ b/src/core/hle/service/nifm/nifm.cpp
@@ -7,6 +7,7 @@
#include "core/hle/service/kernel_helpers.h"
#include "core/hle/service/nifm/nifm.h"
#include "core/hle/service/server_manager.h"
+#include "network/network.h"
namespace {
diff --git a/src/core/hle/service/nifm/nifm.h b/src/core/hle/service/nifm/nifm.h
index 9b20e6823..ae99c4695 100644
--- a/src/core/hle/service/nifm/nifm.h
+++ b/src/core/hle/service/nifm/nifm.h
@@ -4,14 +4,15 @@
#pragma once
#include "core/hle/service/service.h"
-#include "network/network.h"
-#include "network/room.h"
-#include "network/room_member.h"
namespace Core {
class System;
}
+namespace Network {
+class RoomNetwork;
+}
+
namespace Service::NIFM {
void LoopProcess(Core::System& system);
diff --git a/src/core/hle/service/ssl/ssl_backend.h b/src/core/hle/service/ssl/ssl_backend.h
index 25c16bcc1..409f4367c 100644
--- a/src/core/hle/service/ssl/ssl_backend.h
+++ b/src/core/hle/service/ssl/ssl_backend.h
@@ -3,15 +3,15 @@
#pragma once
-#include "core/hle/result.h"
-
-#include "common/common_types.h"
-
#include <memory>
#include <span>
#include <string>
#include <vector>
+#include "common/common_types.h"
+
+#include "core/hle/result.h"
+
namespace Network {
class SocketBase;
}
diff --git a/src/core/hle/service/ssl/ssl_backend_none.cpp b/src/core/hle/service/ssl/ssl_backend_none.cpp
index f2f0ef706..2f4f23c42 100644
--- a/src/core/hle/service/ssl/ssl_backend_none.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_none.cpp
@@ -1,10 +1,10 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hle/service/ssl/ssl_backend.h"
-
#include "common/logging/log.h"
+#include "core/hle/service/ssl/ssl_backend.h"
+
namespace Service::SSL {
ResultVal<std::unique_ptr<SSLConnectionBackend>> CreateSSLConnectionBackend() {
diff --git a/src/core/hle/service/ssl/ssl_backend_openssl.cpp b/src/core/hle/service/ssl/ssl_backend_openssl.cpp
index f69674f77..6ca869dbf 100644
--- a/src/core/hle/service/ssl/ssl_backend_openssl.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_openssl.cpp
@@ -1,14 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hle/service/ssl/ssl_backend.h"
-#include "core/internal_network/network.h"
-#include "core/internal_network/sockets.h"
-
-#include "common/fs/file.h"
-#include "common/hex_util.h"
-#include "common/string_util.h"
-
#include <mutex>
#include <openssl/bio.h>
@@ -16,6 +8,14 @@
#include <openssl/ssl.h>
#include <openssl/x509.h>
+#include "common/fs/file.h"
+#include "common/hex_util.h"
+#include "common/string_util.h"
+
+#include "core/hle/service/ssl/ssl_backend.h"
+#include "core/internal_network/network.h"
+#include "core/internal_network/sockets.h"
+
using namespace Common::FS;
namespace Service::SSL {
diff --git a/src/core/hle/service/ssl/ssl_backend_schannel.cpp b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
index a1d6a186e..d8074339a 100644
--- a/src/core/hle/service/ssl/ssl_backend_schannel.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_schannel.cpp
@@ -1,16 +1,16 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hle/service/ssl/ssl_backend.h"
-#include "core/internal_network/network.h"
-#include "core/internal_network/sockets.h"
+#include <mutex>
#include "common/error.h"
#include "common/fs/file.h"
#include "common/hex_util.h"
#include "common/string_util.h"
-#include <mutex>
+#include "core/hle/service/ssl/ssl_backend.h"
+#include "core/internal_network/network.h"
+#include "core/internal_network/sockets.h"
namespace {
@@ -20,6 +20,7 @@ namespace {
#define SECURITY_WIN32
#include <schnlsp.h>
#include <security.h>
+#include <wincrypt.h>
std::once_flag one_time_init_flag;
bool one_time_init_success = false;
diff --git a/src/core/hle/service/ssl/ssl_backend_securetransport.cpp b/src/core/hle/service/ssl/ssl_backend_securetransport.cpp
index be40a5aeb..b3083cbad 100644
--- a/src/core/hle/service/ssl/ssl_backend_securetransport.cpp
+++ b/src/core/hle/service/ssl/ssl_backend_securetransport.cpp
@@ -1,18 +1,21 @@
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
-#include "core/hle/service/ssl/ssl_backend.h"
-#include "core/internal_network/network.h"
-#include "core/internal_network/sockets.h"
-
#include <mutex>
-#include <Security/SecureTransport.h>
-
// SecureTransport has been deprecated in its entirety in favor of
// Network.framework, but that does not allow layering TLS on top of an
// arbitrary socket.
+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#include <Security/SecureTransport.h>
+#pragma GCC diagnostic pop
+#endif
+
+#include "core/hle/service/ssl/ssl_backend.h"
+#include "core/internal_network/network.h"
+#include "core/internal_network/sockets.h"
namespace {
diff --git a/src/core/internal_network/socket_proxy.cpp b/src/core/internal_network/socket_proxy.cpp
index 44e9e3093..ce0dee970 100644
--- a/src/core/internal_network/socket_proxy.cpp
+++ b/src/core/internal_network/socket_proxy.cpp
@@ -10,6 +10,7 @@
#include "core/internal_network/network.h"
#include "core/internal_network/network_interface.h"
#include "core/internal_network/socket_proxy.h"
+#include "network/network.h"
#if YUZU_UNIX
#include <sys/socket.h>
diff --git a/src/core/internal_network/socket_proxy.h b/src/core/internal_network/socket_proxy.h
index e12c413d1..70500cf4a 100644
--- a/src/core/internal_network/socket_proxy.h
+++ b/src/core/internal_network/socket_proxy.h
@@ -10,10 +10,12 @@
#include "common/common_funcs.h"
#include "core/internal_network/sockets.h"
-#include "network/network.h"
+#include "network/room_member.h"
namespace Network {
+class RoomNetwork;
+
class ProxySocket : public SocketBase {
public:
explicit ProxySocket(RoomNetwork& room_network_) noexcept;
diff --git a/src/core/internal_network/sockets.h b/src/core/internal_network/sockets.h
index 46a53ef79..4ba51f62c 100644
--- a/src/core/internal_network/sockets.h
+++ b/src/core/internal_network/sockets.h
@@ -15,12 +15,13 @@
#include "common/common_types.h"
#include "core/internal_network/network.h"
-#include "network/network.h"
// TODO: C++20 Replace std::vector usages with std::span
namespace Network {
+struct ProxyPacket;
+
class SocketBase {
public:
#ifdef YUZU_UNIX
diff --git a/src/video_core/renderer_base.cpp b/src/video_core/renderer_base.cpp
index 2d3f58201..4002fa72b 100644
--- a/src/video_core/renderer_base.cpp
+++ b/src/video_core/renderer_base.cpp
@@ -38,8 +38,8 @@ void RendererBase::RequestScreenshot(void* data, std::function<void(bool)> callb
LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request");
return;
}
- auto async_callback{[callback = std::move(callback)](bool invert_y) {
- std::thread t{callback, invert_y};
+ auto async_callback{[callback_ = std::move(callback)](bool invert_y) {
+ std::thread t{callback_, invert_y};
t.detach();
}};
renderer_settings.screenshot_bits = data;
diff --git a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
index 23a48c6fe..71f720c63 100644
--- a/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
+++ b/src/video_core/renderer_opengl/gl_graphics_pipeline.cpp
@@ -231,24 +231,25 @@ GraphicsPipeline::GraphicsPipeline(const Device& device, TextureCache& texture_c
}
const bool in_parallel = thread_worker != nullptr;
const auto backend = device.GetShaderBackend();
- auto func{[this, sources = std::move(sources), sources_spirv = std::move(sources_spirv),
+ auto func{[this, sources_ = std::move(sources), sources_spirv_ = std::move(sources_spirv),
shader_notify, backend, in_parallel,
force_context_flush](ShaderContext::Context*) mutable {
for (size_t stage = 0; stage < 5; ++stage) {
switch (backend) {
case Settings::ShaderBackend::GLSL:
- if (!sources[stage].empty()) {
- source_programs[stage] = CreateProgram(sources[stage], Stage(stage));
+ if (!sources_[stage].empty()) {
+ source_programs[stage] = CreateProgram(sources_[stage], Stage(stage));
}
break;
case Settings::ShaderBackend::GLASM:
- if (!sources[stage].empty()) {
- assembly_programs[stage] = CompileProgram(sources[stage], AssemblyStage(stage));
+ if (!sources_[stage].empty()) {
+ assembly_programs[stage] =
+ CompileProgram(sources_[stage], AssemblyStage(stage));
}
break;
case Settings::ShaderBackend::SPIRV:
- if (!sources_spirv[stage].empty()) {
- source_programs[stage] = CreateProgram(sources_spirv[stage], Stage(stage));
+ if (!sources_spirv_[stage].empty()) {
+ source_programs[stage] = CreateProgram(sources_spirv_[stage], Stage(stage));
}
break;
}
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 0329ed820..7e1d7f92e 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -288,9 +288,9 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
const auto load_compute{[&](std::ifstream& file, FileEnvironment env) {
ComputePipelineKey key;
file.read(reinterpret_cast<char*>(&key), sizeof(key));
- queue_work([this, key, env = std::move(env), &state, &callback](Context* ctx) mutable {
+ queue_work([this, key, env_ = std::move(env), &state, &callback](Context* ctx) mutable {
ctx->pools.ReleaseContents();
- auto pipeline{CreateComputePipeline(ctx->pools, key, env, true)};
+ auto pipeline{CreateComputePipeline(ctx->pools, key, env_, true)};
std::scoped_lock lock{state.mutex};
if (pipeline) {
compute_cache.emplace(key, std::move(pipeline));
@@ -305,9 +305,9 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading,
const auto load_graphics{[&](std::ifstream& file, std::vector<FileEnvironment> envs) {
GraphicsPipelineKey key;
file.read(reinterpret_cast<char*>(&key), sizeof(key));
- queue_work([this, key, envs = std::move(envs), &state, &callback](Context* ctx) mutable {
+ queue_work([this, key, envs_ = std::move(envs), &state, &callback](Context* ctx) mutable {
boost::container::static_vector<Shader::Environment*, 5> env_ptrs;
- for (auto& env : envs) {
+ for (auto& env : envs_) {
env_ptrs.push_back(&env);
}
ctx->pools.ReleaseContents();
diff --git a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
index 51df18ec3..f8cd2a5d8 100644
--- a/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_buffer_cache.cpp
@@ -206,8 +206,8 @@ public:
const size_t sub_first_offset = static_cast<size_t>(first % 4) * GetQuadsNum(num_indices);
const size_t offset =
(sub_first_offset + GetQuadsNum(first)) * 6ULL * BytesPerIndex(index_type);
- scheduler.Record([buffer = *buffer, index_type_, offset](vk::CommandBuffer cmdbuf) {
- cmdbuf.BindIndexBuffer(buffer, offset, index_type_);
+ scheduler.Record([buffer_ = *buffer, index_type_, offset](vk::CommandBuffer cmdbuf) {
+ cmdbuf.BindIndexBuffer(buffer_, offset, index_type_);
});
}
@@ -528,17 +528,18 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
buffer_handles.push_back(handle);
}
if (device.IsExtExtendedDynamicStateSupported()) {
- scheduler.Record([bindings = std::move(bindings),
- buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
- cmdbuf.BindVertexBuffers2EXT(
- bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(),
- bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data());
+ scheduler.Record([bindings_ = std::move(bindings),
+ buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
+ cmdbuf.BindVertexBuffers2EXT(bindings_.min_index,
+ bindings_.max_index - bindings_.min_index,
+ buffer_handles_.data(), bindings_.offsets.data(),
+ bindings_.sizes.data(), bindings_.strides.data());
});
} else {
- scheduler.Record([bindings = std::move(bindings),
- buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
- cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index,
- buffer_handles.data(), bindings.offsets.data());
+ scheduler.Record([bindings_ = std::move(bindings),
+ buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
+ cmdbuf.BindVertexBuffers(bindings_.min_index, bindings_.max_index - bindings_.min_index,
+ buffer_handles_.data(), bindings_.offsets.data());
});
}
}
@@ -573,11 +574,11 @@ void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings<
for (u32 index = 0; index < bindings.buffers.size(); ++index) {
buffer_handles.push_back(bindings.buffers[index]->Handle());
}
- scheduler.Record([bindings = std::move(bindings),
- buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
- cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()),
- buffer_handles.data(), bindings.offsets.data(),
- bindings.sizes.data());
+ scheduler.Record([bindings_ = std::move(bindings),
+ buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) {
+ cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles_.size()),
+ buffer_handles_.data(), bindings_.offsets.data(),
+ bindings_.sizes.data());
});
}
diff --git a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
index d600c4e61..4f84d8497 100644
--- a/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_pipeline_cache.cpp
@@ -469,9 +469,9 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
ComputePipelineCacheKey key;
file.read(reinterpret_cast<char*>(&key), sizeof(key));
- workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable {
+ workers.QueueWork([this, key, env_ = std::move(env), &state, &callback]() mutable {
ShaderPools pools;
- auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)};
+ auto pipeline{CreateComputePipeline(pools, key, env_, state.statistics.get(), false)};
std::scoped_lock lock{state.mutex};
if (pipeline) {
compute_cache.emplace(key, std::move(pipeline));
@@ -500,10 +500,10 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading
(key.state.dynamic_vertex_input != 0) != dynamic_features.has_dynamic_vertex_input) {
return;
}
- workers.QueueWork([this, key, envs = std::move(envs), &state, &callback]() mutable {
+ workers.QueueWork([this, key, envs_ = std::move(envs), &state, &callback]() mutable {
ShaderPools pools;
boost::container::static_vector<Shader::Environment*, 5> env_ptrs;
- for (auto& env : envs) {
+ for (auto& env : envs_) {
env_ptrs.push_back(&env);
}
auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs),
@@ -702,8 +702,8 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline(
if (!pipeline || pipeline_cache_filename.empty()) {
return pipeline;
}
- serialization_thread.QueueWork([this, key, env = std::move(env)] {
- SerializePipeline(key, std::array<const GenericEnvironment*, 1>{&env},
+ serialization_thread.QueueWork([this, key, env_ = std::move(env)] {
+ SerializePipeline(key, std::array<const GenericEnvironment*, 1>{&env_},
pipeline_cache_filename, CACHE_VERSION);
});
return pipeline;
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp
index d67490449..29e0b797b 100644
--- a/src/video_core/renderer_vulkan/vk_query_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp
@@ -98,10 +98,10 @@ HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> depend
: HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_},
query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
const vk::Device* logical = &cache.GetDevice().GetLogical();
- cache.GetScheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) {
+ cache.GetScheduler().Record([logical, query_ = query](vk::CommandBuffer cmdbuf) {
const bool use_precise = Settings::IsGPULevelHigh();
- logical->ResetQueryPool(query.first, query.second, 1);
- cmdbuf.BeginQuery(query.first, query.second,
+ logical->ResetQueryPool(query_.first, query_.second, 1);
+ cmdbuf.BeginQuery(query_.first, query_.second,
use_precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0);
});
}
@@ -111,8 +111,9 @@ HostCounter::~HostCounter() {
}
void HostCounter::EndQuery() {
- cache.GetScheduler().Record(
- [query = query](vk::CommandBuffer cmdbuf) { cmdbuf.EndQuery(query.first, query.second); });
+ cache.GetScheduler().Record([query_ = query](vk::CommandBuffer cmdbuf) {
+ cmdbuf.EndQuery(query_.first, query_.second);
+ });
}
u64 HostCounter::BlockingQuery(bool async) const {
diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
index 3aac3cfab..bf6ad6c79 100644
--- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp
+++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp
@@ -1412,7 +1412,7 @@ void Image::DownloadMemory(std::span<VkBuffer> buffers_span, std::span<VkDeviceS
}
scheduler->RequestOutsideRenderPassOperationContext();
scheduler->Record([buffers = std::move(buffers_vector), image = *original_image,
- aspect_mask = aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) {
+ aspect_mask_ = aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) {
const VkImageMemoryBarrier read_barrier{
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.pNext = nullptr,
@@ -1424,7 +1424,7 @@ void Image::DownloadMemory(std::span<VkBuffer> buffers_span, std::span<VkDeviceS
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = image,
.subresourceRange{
- .aspectMask = aspect_mask,
+ .aspectMask = aspect_mask_,
.baseMipLevel = 0,
.levelCount = VK_REMAINING_MIP_LEVELS,
.baseArrayLayer = 0,
@@ -1456,7 +1456,7 @@ void Image::DownloadMemory(std::span<VkBuffer> buffers_span, std::span<VkDeviceS
.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
.image = image,
.subresourceRange{
- .aspectMask = aspect_mask,
+ .aspectMask = aspect_mask_,
.baseMipLevel = 0,
.levelCount = VK_REMAINING_MIP_LEVELS,
.baseArrayLayer = 0,
diff --git a/src/web_service/announce_room_json.cpp b/src/web_service/announce_room_json.cpp
index 4c3195efd..f1020a5b8 100644
--- a/src/web_service/announce_room_json.cpp
+++ b/src/web_service/announce_room_json.cpp
@@ -135,11 +135,11 @@ void RoomJson::Delete() {
LOG_ERROR(WebService, "Room must be registered to be deleted");
return;
}
- Common::DetachedTasks::AddTask(
- [host{this->host}, username{this->username}, token{this->token}, room_id{this->room_id}]() {
- // create a new client here because the this->client might be destroyed.
- Client{host, username, token}.DeleteJson(fmt::format("/lobby/{}", room_id), "", false);
- });
+ Common::DetachedTasks::AddTask([host_{this->host}, username_{this->username},
+ token_{this->token}, room_id_{this->room_id}]() {
+ // create a new client here because the this->client might be destroyed.
+ Client{host_, username_, token_}.DeleteJson(fmt::format("/lobby/{}", room_id_), "", false);
+ });
}
} // namespace WebService
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index 63326968b..5c910c9e0 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -235,7 +235,7 @@ GameListWorker::~GameListWorker() = default;
void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
using namespace FileSys;
- const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider());
+ const auto& cache = system.GetContentProviderUnion();
auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
ContentRecordType::Program);