diff options
Diffstat (limited to 'src')
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: | |||
| 449 | loader->ReadTitle(entry.title); | 449 | loader->ReadTitle(entry.title); |
| 450 | loader->ReadIcon(entry.icon); | 450 | loader->ReadIcon(entry.icon); |
| 451 | if (loader->GetFileType() == Loader::FileType::NRO) { | 451 | if (loader->GetFileType() == Loader::FileType::NRO) { |
| 452 | jauto loader_nro = dynamic_cast<Loader::AppLoader_NRO*>(loader.get()); | 452 | jauto loader_nro = reinterpret_cast<Loader::AppLoader_NRO*>(loader.get()); |
| 453 | entry.isHomebrew = loader_nro->IsHomebrew(); | 453 | entry.isHomebrew = loader_nro->IsHomebrew(); |
| 454 | } else { | 454 | } else { |
| 455 | entry.isHomebrew = false; | 455 | 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) { | |||
| 23 | SCOPE_EXIT({ std::free(demangled); }); | 23 | SCOPE_EXIT({ std::free(demangled); }); |
| 24 | 24 | ||
| 25 | if (is_itanium(mangled)) { | 25 | if (is_itanium(mangled)) { |
| 26 | demangled = llvm::itaniumDemangle(mangled.c_str(), nullptr, nullptr, nullptr); | 26 | demangled = llvm::itaniumDemangle(mangled.c_str()); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | if (!demangled) { | 29 | 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() { | |||
| 30 | void DetachedTasks::AddTask(std::function<void()> task) { | 30 | void DetachedTasks::AddTask(std::function<void()> task) { |
| 31 | std::unique_lock lock{instance->mutex}; | 31 | std::unique_lock lock{instance->mutex}; |
| 32 | ++instance->count; | 32 | ++instance->count; |
| 33 | std::thread([task{std::move(task)}]() { | 33 | std::thread([task_{std::move(task)}]() { |
| 34 | task(); | 34 | task_(); |
| 35 | std::unique_lock thread_lock{instance->mutex}; | 35 | std::unique_lock thread_lock{instance->mutex}; |
| 36 | --instance->count; | 36 | --instance->count; |
| 37 | std::notify_all_at_thread_exit(instance->cv, std::move(thread_lock)); | 37 | 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() { | |||
| 26 | 26 | ||
| 27 | std::string location_name; | 27 | std::string location_name; |
| 28 | if (time_zone_index == 0) { // Auto | 28 | if (time_zone_index == 0) { // Auto |
| 29 | #if __cpp_lib_chrono >= 201907L | 29 | #if __cpp_lib_chrono >= 201907L && !defined(MINGW) |
| 30 | // Disabled for MinGW -- tzdb always returns Etc/UTC | ||
| 30 | try { | 31 | try { |
| 31 | const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb(); | 32 | const struct std::chrono::tzdb& time_zone_data = std::chrono::get_tzdb(); |
| 32 | const std::chrono::time_zone* current_zone = time_zone_data.current_zone(); | 33 | 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 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | ||
| 7 | |||
| 8 | #include <optional> | 6 | #include <optional> |
| 7 | #include <string> | ||
| 8 | |||
| 9 | #include "common/common_types.h" | ||
| 9 | 10 | ||
| 10 | namespace Network { | 11 | namespace Network { |
| 11 | 12 | ||
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 @@ | |||
| 4 | #include <chrono> | 4 | #include <chrono> |
| 5 | #include <exception> | 5 | #include <exception> |
| 6 | #include <iomanip> | 6 | #include <iomanip> |
| 7 | #include <map> | ||
| 7 | #include <sstream> | 8 | #include <sstream> |
| 8 | #include <stdexcept> | 9 | #include <stdexcept> |
| 9 | #include <fmt/chrono.h> | 10 | #include <fmt/chrono.h> |
| 10 | #include <fmt/core.h> | 11 | #include <fmt/core.h> |
| 11 | 12 | ||
| 12 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 13 | #include "common/settings.h" | ||
| 14 | #include "common/time_zone.h" | 14 | #include "common/time_zone.h" |
| 15 | 15 | ||
| 16 | namespace Common::TimeZone { | 16 | namespace Common::TimeZone { |
| @@ -33,32 +33,29 @@ std::string GetDefaultTimeZone() { | |||
| 33 | return "GMT"; | 33 | return "GMT"; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | static std::string GetOsTimeZoneOffset() { | 36 | // Results are not comparable to seconds since Epoch |
| 37 | const std::time_t t{std::time(nullptr)}; | 37 | static std::time_t TmSpecToSeconds(const struct std::tm& spec) { |
| 38 | const std::tm tm{*std::localtime(&t)}; | 38 | const int year = spec.tm_year - 1; // Years up to now |
| 39 | 39 | const int leap_years = year / 4 - year / 100; | |
| 40 | return fmt::format("{:%z}", tm); | 40 | std::time_t cumulative = spec.tm_year; |
| 41 | } | 41 | cumulative = cumulative * 365 + leap_years + spec.tm_yday; // Years to days |
| 42 | 42 | cumulative = cumulative * 24 + spec.tm_hour; // Days to hours | |
| 43 | static int ConvertOsTimeZoneOffsetToInt(const std::string& timezone) { | 43 | cumulative = cumulative * 60 + spec.tm_min; // Hours to minutes |
| 44 | try { | 44 | cumulative = cumulative * 60 + spec.tm_sec; // Minutes to seconds |
| 45 | return std::stoi(timezone); | 45 | return cumulative; |
| 46 | } catch (const std::invalid_argument&) { | ||
| 47 | LOG_CRITICAL(Common, "invalid_argument with {}!", timezone); | ||
| 48 | return 0; | ||
| 49 | } catch (const std::out_of_range&) { | ||
| 50 | LOG_CRITICAL(Common, "out_of_range with {}!", timezone); | ||
| 51 | return 0; | ||
| 52 | } | ||
| 53 | } | 46 | } |
| 54 | 47 | ||
| 55 | std::chrono::seconds GetCurrentOffsetSeconds() { | 48 | std::chrono::seconds GetCurrentOffsetSeconds() { |
| 56 | const int offset{ConvertOsTimeZoneOffsetToInt(GetOsTimeZoneOffset())}; | 49 | const std::time_t t{std::time(nullptr)}; |
| 50 | const std::tm local{*std::localtime(&t)}; | ||
| 51 | const std::tm gmt{*std::gmtime(&t)}; | ||
| 57 | 52 | ||
| 58 | int seconds{(offset / 100) * 60 * 60}; // Convert hour component to seconds | 53 | // gmt_seconds is a different offset than time(nullptr) |
| 59 | seconds += (offset % 100) * 60; // Convert minute component to seconds | 54 | const auto gmt_seconds = TmSpecToSeconds(gmt); |
| 55 | const auto local_seconds = TmSpecToSeconds(local); | ||
| 56 | const auto seconds_offset = local_seconds - gmt_seconds; | ||
| 60 | 57 | ||
| 61 | return std::chrono::seconds{seconds}; | 58 | return std::chrono::seconds{seconds_offset}; |
| 62 | } | 59 | } |
| 63 | 60 | ||
| 64 | // Key is [Hours * 100 + Minutes], multiplied by 100 if DST | 61 | // Key is [Hours * 100 + Minutes], multiplied by 100 if DST |
| @@ -71,11 +68,6 @@ const static std::map<s64, const char*> off_timezones = { | |||
| 71 | }; | 68 | }; |
| 72 | 69 | ||
| 73 | std::string FindSystemTimeZone() { | 70 | std::string FindSystemTimeZone() { |
| 74 | #if defined(MINGW) | ||
| 75 | // MinGW has broken strftime -- https://sourceforge.net/p/mingw-w64/bugs/793/ | ||
| 76 | // e.g. fmt::format("{:%z}") -- returns "Eastern Daylight Time" when it should be "-0400" | ||
| 77 | return timezones[0]; | ||
| 78 | #else | ||
| 79 | const s64 seconds = static_cast<s64>(GetCurrentOffsetSeconds().count()); | 71 | const s64 seconds = static_cast<s64>(GetCurrentOffsetSeconds().count()); |
| 80 | 72 | ||
| 81 | const s64 minutes = seconds / 60; | 73 | const s64 minutes = seconds / 60; |
| @@ -97,7 +89,6 @@ std::string FindSystemTimeZone() { | |||
| 97 | } | 89 | } |
| 98 | } | 90 | } |
| 99 | return fmt::format("Etc/GMT{:s}{:d}", hours > 0 ? "-" : "+", std::abs(hours)); | 91 | return fmt::format("Etc/GMT{:s}{:d}", hours > 0 ? "-" : "+", std::abs(hours)); |
| 100 | #endif | ||
| 101 | } | 92 | } |
| 102 | 93 | ||
| 103 | } // namespace Common::TimeZone | 94 | } // 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) | |||
| 876 | elseif (WIN32) | 876 | elseif (WIN32) |
| 877 | target_sources(core PRIVATE | 877 | target_sources(core PRIVATE |
| 878 | hle/service/ssl/ssl_backend_schannel.cpp) | 878 | hle/service/ssl/ssl_backend_schannel.cpp) |
| 879 | target_link_libraries(core PRIVATE secur32) | 879 | target_link_libraries(core PRIVATE crypt32 secur32) |
| 880 | else() | 880 | else() |
| 881 | target_sources(core PRIVATE | 881 | target_sources(core PRIVATE |
| 882 | hle/service/ssl/ssl_backend_none.cpp) | 882 | 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() { | |||
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, | 348 | ARM_Dynarmic_32::ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, |
| 349 | ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_) | 349 | DynarmicExclusiveMonitor& exclusive_monitor_, |
| 350 | std::size_t core_index_) | ||
| 350 | : ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)), | 351 | : ARM_Interface{system_, uses_wall_clock_}, cb(std::make_unique<DynarmicCallbacks32>(*this)), |
| 351 | cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_}, | 352 | cp15(std::make_shared<DynarmicCP15>(*this)), core_index{core_index_}, |
| 352 | exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)}, | 353 | exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {} |
| 353 | null_jit{MakeJit(nullptr)}, jit{null_jit.get()} {} | ||
| 354 | 354 | ||
| 355 | ARM_Dynarmic_32::~ARM_Dynarmic_32() = default; | 355 | ARM_Dynarmic_32::~ARM_Dynarmic_32() = default; |
| 356 | 356 | ||
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 @@ | |||
| 12 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/hash.h" | 13 | #include "common/hash.h" |
| 14 | #include "core/arm/arm_interface.h" | 14 | #include "core/arm/arm_interface.h" |
| 15 | #include "core/arm/exclusive_monitor.h" | 15 | #include "core/arm/dynarmic/dynarmic_exclusive_monitor.h" |
| 16 | 16 | ||
| 17 | namespace Core::Memory { | 17 | namespace Core::Memory { |
| 18 | class Memory; | 18 | class Memory; |
| @@ -28,8 +28,8 @@ class System; | |||
| 28 | 28 | ||
| 29 | class ARM_Dynarmic_32 final : public ARM_Interface { | 29 | class ARM_Dynarmic_32 final : public ARM_Interface { |
| 30 | public: | 30 | public: |
| 31 | ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, | 31 | ARM_Dynarmic_32(System& system_, bool uses_wall_clock_, |
| 32 | std::size_t core_index_); | 32 | DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_); |
| 33 | ~ARM_Dynarmic_32() override; | 33 | ~ARM_Dynarmic_32() override; |
| 34 | 34 | ||
| 35 | void SetPC(u64 pc) override; | 35 | 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() { | |||
| 405 | } | 405 | } |
| 406 | 406 | ||
| 407 | ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, | 407 | ARM_Dynarmic_64::ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, |
| 408 | ExclusiveMonitor& exclusive_monitor_, std::size_t core_index_) | 408 | DynarmicExclusiveMonitor& exclusive_monitor_, |
| 409 | std::size_t core_index_) | ||
| 409 | : ARM_Interface{system_, uses_wall_clock_}, | 410 | : ARM_Interface{system_, uses_wall_clock_}, |
| 410 | cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_}, | 411 | cb(std::make_unique<DynarmicCallbacks64>(*this)), core_index{core_index_}, |
| 411 | exclusive_monitor{dynamic_cast<DynarmicExclusiveMonitor&>(exclusive_monitor_)}, | 412 | exclusive_monitor{exclusive_monitor_}, null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {} |
| 412 | null_jit{MakeJit(nullptr, 48)}, jit{null_jit.get()} {} | ||
| 413 | 413 | ||
| 414 | ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; | 414 | ARM_Dynarmic_64::~ARM_Dynarmic_64() = default; |
| 415 | 415 | ||
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 @@ | |||
| 11 | #include "common/common_types.h" | 11 | #include "common/common_types.h" |
| 12 | #include "common/hash.h" | 12 | #include "common/hash.h" |
| 13 | #include "core/arm/arm_interface.h" | 13 | #include "core/arm/arm_interface.h" |
| 14 | #include "core/arm/exclusive_monitor.h" | 14 | #include "core/arm/dynarmic/dynarmic_exclusive_monitor.h" |
| 15 | 15 | ||
| 16 | namespace Core::Memory { | 16 | namespace Core::Memory { |
| 17 | class Memory; | 17 | class Memory; |
| @@ -25,8 +25,8 @@ class System; | |||
| 25 | 25 | ||
| 26 | class ARM_Dynarmic_64 final : public ARM_Interface { | 26 | class ARM_Dynarmic_64 final : public ARM_Interface { |
| 27 | public: | 27 | public: |
| 28 | ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, ExclusiveMonitor& exclusive_monitor_, | 28 | ARM_Dynarmic_64(System& system_, bool uses_wall_clock_, |
| 29 | std::size_t core_index_); | 29 | DynarmicExclusiveMonitor& exclusive_monitor_, std::size_t core_index_); |
| 30 | ~ARM_Dynarmic_64() override; | 30 | ~ARM_Dynarmic_64() override; |
| 31 | 31 | ||
| 32 | void SetPC(u64 pc) override; | 32 | 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 @@ | |||
| 6 | #include <dynarmic/interface/exclusive_monitor.h> | 6 | #include <dynarmic/interface/exclusive_monitor.h> |
| 7 | 7 | ||
| 8 | #include "common/common_types.h" | 8 | #include "common/common_types.h" |
| 9 | #include "core/arm/dynarmic/arm_dynarmic_32.h" | ||
| 10 | #include "core/arm/dynarmic/arm_dynarmic_64.h" | ||
| 11 | #include "core/arm/exclusive_monitor.h" | 9 | #include "core/arm/exclusive_monitor.h" |
| 12 | 10 | ||
| 13 | namespace Core::Memory { | 11 | namespace Core::Memory { |
| @@ -16,6 +14,9 @@ class Memory; | |||
| 16 | 14 | ||
| 17 | namespace Core { | 15 | namespace Core { |
| 18 | 16 | ||
| 17 | class ARM_Dynarmic_32; | ||
| 18 | class ARM_Dynarmic_64; | ||
| 19 | |||
| 19 | class DynarmicExclusiveMonitor final : public ExclusiveMonitor { | 20 | class DynarmicExclusiveMonitor final : public ExclusiveMonitor { |
| 20 | public: | 21 | public: |
| 21 | explicit DynarmicExclusiveMonitor(Memory::Memory& memory_, std::size_t core_count_); | 22 | 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 { | |||
| 880 | return *impl->content_provider; | 880 | return *impl->content_provider; |
| 881 | } | 881 | } |
| 882 | 882 | ||
| 883 | FileSys::ContentProviderUnion& System::GetContentProviderUnion() { | ||
| 884 | return *impl->content_provider; | ||
| 885 | } | ||
| 886 | |||
| 887 | const FileSys::ContentProviderUnion& System::GetContentProviderUnion() const { | ||
| 888 | return *impl->content_provider; | ||
| 889 | } | ||
| 890 | |||
| 883 | Service::FileSystem::FileSystemController& System::GetFileSystemController() { | 891 | Service::FileSystem::FileSystemController& System::GetFileSystemController() { |
| 884 | return impl->fs_controller; | 892 | return impl->fs_controller; |
| 885 | } | 893 | } |
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: | |||
| 381 | [[nodiscard]] FileSys::ContentProvider& GetContentProvider(); | 381 | [[nodiscard]] FileSys::ContentProvider& GetContentProvider(); |
| 382 | [[nodiscard]] const FileSys::ContentProvider& GetContentProvider() const; | 382 | [[nodiscard]] const FileSys::ContentProvider& GetContentProvider() const; |
| 383 | 383 | ||
| 384 | [[nodiscard]] FileSys::ContentProviderUnion& GetContentProviderUnion(); | ||
| 385 | [[nodiscard]] const FileSys::ContentProviderUnion& GetContentProviderUnion() const; | ||
| 386 | |||
| 384 | [[nodiscard]] Service::FileSystem::FileSystemController& GetFileSystemController(); | 387 | [[nodiscard]] Service::FileSystem::FileSystemController& GetFileSystemController(); |
| 385 | [[nodiscard]] const Service::FileSystem::FileSystemController& GetFileSystemController() const; | 388 | [[nodiscard]] const Service::FileSystem::FileSystemController& GetFileSystemController() const; |
| 386 | 389 | ||
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, | |||
| 302 | std::function<void()>&& func, s32 prio, s32 virt_core, | 302 | std::function<void()>&& func, s32 prio, s32 virt_core, |
| 303 | KProcess* owner) { | 303 | KProcess* owner) { |
| 304 | system.Kernel().GlobalSchedulerContext().AddThread(thread); | 304 | system.Kernel().GlobalSchedulerContext().AddThread(thread); |
| 305 | std::function<void()> func2{[&system, func{std::move(func)}] { | 305 | std::function<void()> func2{[&system, func_{std::move(func)}] { |
| 306 | // Similar to UserModeThreadStarter. | 306 | // Similar to UserModeThreadStarter. |
| 307 | system.Kernel().CurrentScheduler()->OnThreadStart(); | 307 | system.Kernel().CurrentScheduler()->OnThreadStart(); |
| 308 | 308 | ||
| 309 | // Run the guest function. | 309 | // Run the guest function. |
| 310 | func(); | 310 | func_(); |
| 311 | 311 | ||
| 312 | // Exit. | 312 | // Exit. |
| 313 | Svc::ExitThread(system); | 313 | 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, | |||
| 1089 | KThread::Register(kernel, thread); | 1089 | KThread::Register(kernel, thread); |
| 1090 | 1090 | ||
| 1091 | return std::jthread( | 1091 | return std::jthread( |
| 1092 | [&kernel, thread, thread_name{std::move(thread_name)}, func{std::move(func)}] { | 1092 | [&kernel, thread, thread_name_{std::move(thread_name)}, func_{std::move(func)}] { |
| 1093 | // Set the thread name. | 1093 | // Set the thread name. |
| 1094 | Common::SetCurrentThreadName(thread_name.c_str()); | 1094 | Common::SetCurrentThreadName(thread_name_.c_str()); |
| 1095 | 1095 | ||
| 1096 | // Set the thread as current. | 1096 | // Set the thread as current. |
| 1097 | kernel.RegisterHostThread(thread); | 1097 | kernel.RegisterHostThread(thread); |
| 1098 | 1098 | ||
| 1099 | // Run the callback. | 1099 | // Run the callback. |
| 1100 | func(); | 1100 | func_(); |
| 1101 | 1101 | ||
| 1102 | // Close the thread. | 1102 | // Close the thread. |
| 1103 | // This will free the process if it is the last reference. | 1103 | // 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 | |||
| 17 | // a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager. | 17 | // a 32-bit instance of Dynarmic. This should be abstracted out to a CPU manager. |
| 18 | auto& kernel = system.Kernel(); | 18 | auto& kernel = system.Kernel(); |
| 19 | m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>( | 19 | m_arm_interface = std::make_unique<Core::ARM_Dynarmic_64>( |
| 20 | system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index); | 20 | system, kernel.IsMulticore(), |
| 21 | reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()), | ||
| 22 | m_core_index); | ||
| 21 | #else | 23 | #else |
| 22 | #error Platform not supported yet. | 24 | #error Platform not supported yet. |
| 23 | #endif | 25 | #endif |
| @@ -31,7 +33,9 @@ void PhysicalCore::Initialize(bool is_64_bit) { | |||
| 31 | if (!is_64_bit) { | 33 | if (!is_64_bit) { |
| 32 | // We already initialized a 64-bit core, replace with a 32-bit one. | 34 | // We already initialized a 64-bit core, replace with a 32-bit one. |
| 33 | m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>( | 35 | m_arm_interface = std::make_unique<Core::ARM_Dynarmic_32>( |
| 34 | m_system, kernel.IsMulticore(), kernel.GetExclusiveMonitor(), m_core_index); | 36 | m_system, kernel.IsMulticore(), |
| 37 | reinterpret_cast<Core::DynarmicExclusiveMonitor&>(kernel.GetExclusiveMonitor()), | ||
| 38 | m_core_index); | ||
| 35 | } | 39 | } |
| 36 | #else | 40 | #else |
| 37 | #error Platform not supported yet. | 41 | #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) { | |||
| 506 | void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) { | 506 | void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) { |
| 507 | IPC::RequestParser rp{ctx}; | 507 | IPC::RequestParser rp{ctx}; |
| 508 | idle_time_detection_extension = rp.Pop<u32>(); | 508 | idle_time_detection_extension = rp.Pop<u32>(); |
| 509 | LOG_WARNING(Service_AM, "(STUBBED) called idle_time_detection_extension={}", | 509 | LOG_DEBUG(Service_AM, "(STUBBED) called idle_time_detection_extension={}", |
| 510 | idle_time_detection_extension); | 510 | idle_time_detection_extension); |
| 511 | 511 | ||
| 512 | IPC::ResponseBuilder rb{ctx, 2}; | 512 | IPC::ResponseBuilder rb{ctx, 2}; |
| 513 | rb.Push(ResultSuccess); | 513 | 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 | |||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key, | 182 | void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key, |
| 183 | const std::vector<u8>& seed) { | 183 | std::span<const u8> seed) { |
| 184 | // Initialize context | 184 | // Initialize context |
| 185 | ctx.used = false; | 185 | ctx.used = false; |
| 186 | ctx.counter = 0; | 186 | 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 | |||
| 75 | 75 | ||
| 76 | // Initializes mbedtls context | 76 | // Initializes mbedtls context |
| 77 | void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key, | 77 | void CryptoInit(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, const HmacKey& hmac_key, |
| 78 | const std::vector<u8>& seed); | 78 | std::span<const u8> seed); |
| 79 | 79 | ||
| 80 | // Feeds data to mbedtls context to generate the derived key | 80 | // Feeds data to mbedtls context to generate the derived key |
| 81 | void CryptoStep(CryptoCtx& ctx, mbedtls_md_context_t& hmac_ctx, DrgbOutput& output); | 81 | 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 @@ | |||
| 34 | #include "core/hle/service/nfc/mifare_result.h" | 34 | #include "core/hle/service/nfc/mifare_result.h" |
| 35 | #include "core/hle/service/nfc/nfc_result.h" | 35 | #include "core/hle/service/nfc/nfc_result.h" |
| 36 | #include "core/hle/service/time/time_manager.h" | 36 | #include "core/hle/service/time/time_manager.h" |
| 37 | #include "core/hle/service/time/time_zone_content_manager.h" | ||
| 38 | #include "core/hle/service/time/time_zone_types.h" | ||
| 39 | 37 | ||
| 40 | namespace Service::NFC { | 38 | namespace Service::NFC { |
| 41 | NfcDevice::NfcDevice(Core::HID::NpadIdType npad_id_, Core::System& system_, | 39 | NfcDevice::NfcDevice(Core::HID::NpadIdType npad_id_, Core::System& system_, |
| @@ -1486,6 +1484,7 @@ DeviceState NfcDevice::GetCurrentState() const { | |||
| 1486 | } | 1484 | } |
| 1487 | 1485 | ||
| 1488 | Result NfcDevice::GetNpadId(Core::HID::NpadIdType& out_npad_id) const { | 1486 | Result NfcDevice::GetNpadId(Core::HID::NpadIdType& out_npad_id) const { |
| 1487 | // TODO: This should get the npad id from nn::hid::system::GetXcdHandleForNpadWithNfc | ||
| 1489 | out_npad_id = npad_id; | 1488 | out_npad_id = npad_id; |
| 1490 | return ResultSuccess; | 1489 | return ResultSuccess; |
| 1491 | } | 1490 | } |
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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-3.0-or-later | 2 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 3 | 3 | ||
| 4 | #include <algorithm> | ||
| 5 | |||
| 4 | #include "common/logging/log.h" | 6 | #include "common/logging/log.h" |
| 5 | #include "core/core.h" | 7 | #include "core/core.h" |
| 6 | #include "core/hid/hid_types.h" | 8 | #include "core/hid/hid_types.h" |
| @@ -10,6 +12,7 @@ | |||
| 10 | #include "core/hle/service/nfc/common/device_manager.h" | 12 | #include "core/hle/service/nfc/common/device_manager.h" |
| 11 | #include "core/hle/service/nfc/nfc_result.h" | 13 | #include "core/hle/service/nfc/nfc_result.h" |
| 12 | #include "core/hle/service/time/clock_types.h" | 14 | #include "core/hle/service/time/clock_types.h" |
| 15 | #include "core/hle/service/time/time_manager.h" | ||
| 13 | 16 | ||
| 14 | namespace Service::NFC { | 17 | namespace Service::NFC { |
| 15 | 18 | ||
| @@ -51,22 +54,53 @@ Result DeviceManager::Finalize() { | |||
| 51 | return ResultSuccess; | 54 | return ResultSuccess; |
| 52 | } | 55 | } |
| 53 | 56 | ||
| 54 | Result DeviceManager::ListDevices(std::vector<u64>& nfp_devices, | 57 | Result DeviceManager::ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices, |
| 55 | std::size_t max_allowed_devices) const { | 58 | bool skip_fatal_errors) const { |
| 59 | std::scoped_lock lock{mutex}; | ||
| 60 | if (max_allowed_devices < 1) { | ||
| 61 | return ResultInvalidArgument; | ||
| 62 | } | ||
| 63 | |||
| 64 | Result result = IsNfcParameterSet(); | ||
| 65 | if (result.IsError()) { | ||
| 66 | return result; | ||
| 67 | } | ||
| 68 | |||
| 69 | result = IsNfcEnabled(); | ||
| 70 | if (result.IsError()) { | ||
| 71 | return result; | ||
| 72 | } | ||
| 73 | |||
| 74 | result = IsNfcInitialized(); | ||
| 75 | if (result.IsError()) { | ||
| 76 | return result; | ||
| 77 | } | ||
| 78 | |||
| 56 | for (auto& device : devices) { | 79 | for (auto& device : devices) { |
| 57 | if (nfp_devices.size() >= max_allowed_devices) { | 80 | if (nfp_devices.size() >= max_allowed_devices) { |
| 58 | continue; | 81 | continue; |
| 59 | } | 82 | } |
| 60 | if (device->GetCurrentState() != DeviceState::Unavailable) { | 83 | if (skip_fatal_errors) { |
| 61 | nfp_devices.push_back(device->GetHandle()); | 84 | constexpr u64 MinimumRecoveryTime = 60; |
| 85 | auto& standard_steady_clock{system.GetTimeManager().GetStandardSteadyClockCore()}; | ||
| 86 | const u64 elapsed_time = standard_steady_clock.GetCurrentTimePoint(system).time_point - | ||
| 87 | time_since_last_error; | ||
| 88 | |||
| 89 | if (time_since_last_error != 0 && elapsed_time < MinimumRecoveryTime) { | ||
| 90 | continue; | ||
| 91 | } | ||
| 62 | } | 92 | } |
| 93 | if (device->GetCurrentState() == DeviceState::Unavailable) { | ||
| 94 | continue; | ||
| 95 | } | ||
| 96 | nfp_devices.push_back(device->GetHandle()); | ||
| 63 | } | 97 | } |
| 64 | 98 | ||
| 65 | if (nfp_devices.empty()) { | 99 | if (nfp_devices.empty()) { |
| 66 | return ResultDeviceNotFound; | 100 | return ResultDeviceNotFound; |
| 67 | } | 101 | } |
| 68 | 102 | ||
| 69 | return ResultSuccess; | 103 | return result; |
| 70 | } | 104 | } |
| 71 | 105 | ||
| 72 | DeviceState DeviceManager::GetDeviceState(u64 device_handle) const { | 106 | DeviceState DeviceManager::GetDeviceState(u64 device_handle) const { |
| @@ -79,10 +113,10 @@ DeviceState DeviceManager::GetDeviceState(u64 device_handle) const { | |||
| 79 | return device->GetCurrentState(); | 113 | return device->GetCurrentState(); |
| 80 | } | 114 | } |
| 81 | 115 | ||
| 82 | return DeviceState::Unavailable; | 116 | return DeviceState::Finalized; |
| 83 | } | 117 | } |
| 84 | 118 | ||
| 85 | Result DeviceManager::GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) const { | 119 | Result DeviceManager::GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) { |
| 86 | std::scoped_lock lock{mutex}; | 120 | std::scoped_lock lock{mutex}; |
| 87 | 121 | ||
| 88 | std::shared_ptr<NfcDevice> device = nullptr; | 122 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -128,7 +162,7 @@ Result DeviceManager::StopDetection(u64 device_handle) { | |||
| 128 | return result; | 162 | return result; |
| 129 | } | 163 | } |
| 130 | 164 | ||
| 131 | Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) const { | 165 | Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) { |
| 132 | std::scoped_lock lock{mutex}; | 166 | std::scoped_lock lock{mutex}; |
| 133 | 167 | ||
| 134 | std::shared_ptr<NfcDevice> device = nullptr; | 168 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -142,24 +176,46 @@ Result DeviceManager::GetTagInfo(u64 device_handle, TagInfo& tag_info) const { | |||
| 142 | return result; | 176 | return result; |
| 143 | } | 177 | } |
| 144 | 178 | ||
| 145 | Kernel::KReadableEvent& DeviceManager::AttachActivateEvent(u64 device_handle) const { | 179 | Result DeviceManager::AttachActivateEvent(Kernel::KReadableEvent** out_event, |
| 146 | std::scoped_lock lock{mutex}; | 180 | u64 device_handle) const { |
| 147 | 181 | std::vector<u64> nfp_devices; | |
| 148 | std::shared_ptr<NfcDevice> device = nullptr; | 182 | std::shared_ptr<NfcDevice> device = nullptr; |
| 149 | GetDeviceFromHandle(device_handle, device, false); | 183 | Result result = ListDevices(nfp_devices, 9, false); |
| 150 | 184 | ||
| 151 | // TODO: Return proper error code on failure | 185 | if (result.IsSuccess()) { |
| 152 | return device->GetActivateEvent(); | 186 | result = CheckHandleOnList(device_handle, nfp_devices); |
| 153 | } | 187 | } |
| 154 | 188 | ||
| 155 | Kernel::KReadableEvent& DeviceManager::AttachDeactivateEvent(u64 device_handle) const { | 189 | if (result.IsSuccess()) { |
| 156 | std::scoped_lock lock{mutex}; | 190 | result = GetDeviceFromHandle(device_handle, device, false); |
| 191 | } | ||
| 192 | |||
| 193 | if (result.IsSuccess()) { | ||
| 194 | *out_event = &device->GetActivateEvent(); | ||
| 195 | } | ||
| 196 | |||
| 197 | return result; | ||
| 198 | } | ||
| 157 | 199 | ||
| 200 | Result DeviceManager::AttachDeactivateEvent(Kernel::KReadableEvent** out_event, | ||
| 201 | u64 device_handle) const { | ||
| 202 | std::vector<u64> nfp_devices; | ||
| 158 | std::shared_ptr<NfcDevice> device = nullptr; | 203 | std::shared_ptr<NfcDevice> device = nullptr; |
| 159 | GetDeviceFromHandle(device_handle, device, false); | 204 | Result result = ListDevices(nfp_devices, 9, false); |
| 160 | 205 | ||
| 161 | // TODO: Return proper error code on failure | 206 | if (result.IsSuccess()) { |
| 162 | return device->GetDeactivateEvent(); | 207 | result = CheckHandleOnList(device_handle, nfp_devices); |
| 208 | } | ||
| 209 | |||
| 210 | if (result.IsSuccess()) { | ||
| 211 | result = GetDeviceFromHandle(device_handle, device, false); | ||
| 212 | } | ||
| 213 | |||
| 214 | if (result.IsSuccess()) { | ||
| 215 | *out_event = &device->GetDeactivateEvent(); | ||
| 216 | } | ||
| 217 | |||
| 218 | return result; | ||
| 163 | } | 219 | } |
| 164 | 220 | ||
| 165 | Result DeviceManager::ReadMifare(u64 device_handle, | 221 | Result DeviceManager::ReadMifare(u64 device_handle, |
| @@ -253,7 +309,7 @@ Result DeviceManager::OpenApplicationArea(u64 device_handle, u32 access_id) { | |||
| 253 | return result; | 309 | return result; |
| 254 | } | 310 | } |
| 255 | 311 | ||
| 256 | Result DeviceManager::GetApplicationArea(u64 device_handle, std::span<u8> data) const { | 312 | Result DeviceManager::GetApplicationArea(u64 device_handle, std::span<u8> data) { |
| 257 | std::scoped_lock lock{mutex}; | 313 | std::scoped_lock lock{mutex}; |
| 258 | 314 | ||
| 259 | std::shared_ptr<NfcDevice> device = nullptr; | 315 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -324,7 +380,7 @@ Result DeviceManager::CreateApplicationArea(u64 device_handle, u32 access_id, | |||
| 324 | return result; | 380 | return result; |
| 325 | } | 381 | } |
| 326 | 382 | ||
| 327 | Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) const { | 383 | Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) { |
| 328 | std::scoped_lock lock{mutex}; | 384 | std::scoped_lock lock{mutex}; |
| 329 | 385 | ||
| 330 | std::shared_ptr<NfcDevice> device = nullptr; | 386 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -338,7 +394,7 @@ Result DeviceManager::GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& regi | |||
| 338 | return result; | 394 | return result; |
| 339 | } | 395 | } |
| 340 | 396 | ||
| 341 | Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) const { | 397 | Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) { |
| 342 | std::scoped_lock lock{mutex}; | 398 | std::scoped_lock lock{mutex}; |
| 343 | 399 | ||
| 344 | std::shared_ptr<NfcDevice> device = nullptr; | 400 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -352,7 +408,7 @@ Result DeviceManager::GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_i | |||
| 352 | return result; | 408 | return result; |
| 353 | } | 409 | } |
| 354 | 410 | ||
| 355 | Result DeviceManager::GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) const { | 411 | Result DeviceManager::GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) { |
| 356 | std::scoped_lock lock{mutex}; | 412 | std::scoped_lock lock{mutex}; |
| 357 | 413 | ||
| 358 | std::shared_ptr<NfcDevice> device = nullptr; | 414 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -399,7 +455,7 @@ Result DeviceManager::Format(u64 device_handle) { | |||
| 399 | return result; | 455 | return result; |
| 400 | } | 456 | } |
| 401 | 457 | ||
| 402 | Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) const { | 458 | Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) { |
| 403 | std::scoped_lock lock{mutex}; | 459 | std::scoped_lock lock{mutex}; |
| 404 | 460 | ||
| 405 | std::shared_ptr<NfcDevice> device = nullptr; | 461 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -414,7 +470,7 @@ Result DeviceManager::GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info | |||
| 414 | } | 470 | } |
| 415 | 471 | ||
| 416 | Result DeviceManager::GetRegisterInfoPrivate(u64 device_handle, | 472 | Result DeviceManager::GetRegisterInfoPrivate(u64 device_handle, |
| 417 | NFP::RegisterInfoPrivate& register_info) const { | 473 | NFP::RegisterInfoPrivate& register_info) { |
| 418 | std::scoped_lock lock{mutex}; | 474 | std::scoped_lock lock{mutex}; |
| 419 | 475 | ||
| 420 | std::shared_ptr<NfcDevice> device = nullptr; | 476 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -471,7 +527,7 @@ Result DeviceManager::DeleteApplicationArea(u64 device_handle) { | |||
| 471 | return result; | 527 | return result; |
| 472 | } | 528 | } |
| 473 | 529 | ||
| 474 | Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_application_area) const { | 530 | Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_application_area) { |
| 475 | std::scoped_lock lock{mutex}; | 531 | std::scoped_lock lock{mutex}; |
| 476 | 532 | ||
| 477 | std::shared_ptr<NfcDevice> device = nullptr; | 533 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -485,7 +541,7 @@ Result DeviceManager::ExistsApplicationArea(u64 device_handle, bool& has_applica | |||
| 485 | return result; | 541 | return result; |
| 486 | } | 542 | } |
| 487 | 543 | ||
| 488 | Result DeviceManager::GetAll(u64 device_handle, NFP::NfpData& nfp_data) const { | 544 | Result DeviceManager::GetAll(u64 device_handle, NFP::NfpData& nfp_data) { |
| 489 | std::scoped_lock lock{mutex}; | 545 | std::scoped_lock lock{mutex}; |
| 490 | 546 | ||
| 491 | std::shared_ptr<NfcDevice> device = nullptr; | 547 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -541,7 +597,7 @@ Result DeviceManager::BreakTag(u64 device_handle, NFP::BreakType break_type) { | |||
| 541 | return result; | 597 | return result; |
| 542 | } | 598 | } |
| 543 | 599 | ||
| 544 | Result DeviceManager::ReadBackupData(u64 device_handle, std::span<u8> data) const { | 600 | Result DeviceManager::ReadBackupData(u64 device_handle, std::span<u8> data) { |
| 545 | std::scoped_lock lock{mutex}; | 601 | std::scoped_lock lock{mutex}; |
| 546 | 602 | ||
| 547 | std::shared_ptr<NfcDevice> device = nullptr; | 603 | std::shared_ptr<NfcDevice> device = nullptr; |
| @@ -593,6 +649,19 @@ Result DeviceManager::WriteNtf(u64 device_handle, NFP::WriteType, std::span<cons | |||
| 593 | return result; | 649 | return result; |
| 594 | } | 650 | } |
| 595 | 651 | ||
| 652 | Result DeviceManager::CheckHandleOnList(u64 device_handle, | ||
| 653 | const std::span<const u64> device_list) const { | ||
| 654 | if (device_list.size() < 1) { | ||
| 655 | return ResultDeviceNotFound; | ||
| 656 | } | ||
| 657 | |||
| 658 | if (std::find(device_list.begin(), device_list.end(), device_handle) != device_list.end()) { | ||
| 659 | return ResultSuccess; | ||
| 660 | } | ||
| 661 | |||
| 662 | return ResultDeviceNotFound; | ||
| 663 | } | ||
| 664 | |||
| 596 | Result DeviceManager::GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& nfc_device, | 665 | Result DeviceManager::GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& nfc_device, |
| 597 | bool check_state) const { | 666 | bool check_state) const { |
| 598 | if (check_state) { | 667 | if (check_state) { |
| @@ -647,7 +716,7 @@ Result DeviceManager::GetDeviceHandle(u64 handle, std::shared_ptr<NfcDevice>& de | |||
| 647 | } | 716 | } |
| 648 | 717 | ||
| 649 | Result DeviceManager::VerifyDeviceResult(std::shared_ptr<NfcDevice> device, | 718 | Result DeviceManager::VerifyDeviceResult(std::shared_ptr<NfcDevice> device, |
| 650 | Result operation_result) const { | 719 | Result operation_result) { |
| 651 | if (operation_result.IsSuccess()) { | 720 | if (operation_result.IsSuccess()) { |
| 652 | return operation_result; | 721 | return operation_result; |
| 653 | } | 722 | } |
| @@ -669,6 +738,12 @@ Result DeviceManager::VerifyDeviceResult(std::shared_ptr<NfcDevice> device, | |||
| 669 | return device_state; | 738 | return device_state; |
| 670 | } | 739 | } |
| 671 | 740 | ||
| 741 | if (operation_result == ResultUnknown112 || operation_result == ResultUnknown114 || | ||
| 742 | operation_result == ResultUnknown115) { | ||
| 743 | auto& standard_steady_clock{system.GetTimeManager().GetStandardSteadyClockCore()}; | ||
| 744 | time_since_last_error = standard_steady_clock.GetCurrentTimePoint(system).time_point; | ||
| 745 | } | ||
| 746 | |||
| 672 | return operation_result; | 747 | return operation_result; |
| 673 | } | 748 | } |
| 674 | 749 | ||
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: | |||
| 27 | // Nfc device manager | 27 | // Nfc device manager |
| 28 | Result Initialize(); | 28 | Result Initialize(); |
| 29 | Result Finalize(); | 29 | Result Finalize(); |
| 30 | Result ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices) const; | 30 | Result ListDevices(std::vector<u64>& nfp_devices, std::size_t max_allowed_devices, |
| 31 | bool skip_fatal_errors) const; | ||
| 31 | DeviceState GetDeviceState(u64 device_handle) const; | 32 | DeviceState GetDeviceState(u64 device_handle) const; |
| 32 | Result GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id) const; | 33 | Result GetNpadId(u64 device_handle, Core::HID::NpadIdType& npad_id); |
| 33 | Kernel::KReadableEvent& AttachAvailabilityChangeEvent() const; | 34 | Kernel::KReadableEvent& AttachAvailabilityChangeEvent() const; |
| 34 | Result StartDetection(u64 device_handle, NfcProtocol tag_protocol); | 35 | Result StartDetection(u64 device_handle, NfcProtocol tag_protocol); |
| 35 | Result StopDetection(u64 device_handle); | 36 | Result StopDetection(u64 device_handle); |
| 36 | Result GetTagInfo(u64 device_handle, NFP::TagInfo& tag_info) const; | 37 | Result GetTagInfo(u64 device_handle, NFP::TagInfo& tag_info); |
| 37 | Kernel::KReadableEvent& AttachActivateEvent(u64 device_handle) const; | 38 | Result AttachActivateEvent(Kernel::KReadableEvent** event, u64 device_handle) const; |
| 38 | Kernel::KReadableEvent& AttachDeactivateEvent(u64 device_handle) const; | 39 | Result AttachDeactivateEvent(Kernel::KReadableEvent** event, u64 device_handle) const; |
| 39 | Result ReadMifare(u64 device_handle, | 40 | Result ReadMifare(u64 device_handle, |
| 40 | const std::span<const MifareReadBlockParameter> read_parameters, | 41 | const std::span<const MifareReadBlockParameter> read_parameters, |
| 41 | std::span<MifareReadBlockData> read_data); | 42 | std::span<MifareReadBlockData> read_data); |
| @@ -48,28 +49,28 @@ public: | |||
| 48 | Result Mount(u64 device_handle, NFP::ModelType model_type, NFP::MountTarget mount_target); | 49 | Result Mount(u64 device_handle, NFP::ModelType model_type, NFP::MountTarget mount_target); |
| 49 | Result Unmount(u64 device_handle); | 50 | Result Unmount(u64 device_handle); |
| 50 | Result OpenApplicationArea(u64 device_handle, u32 access_id); | 51 | Result OpenApplicationArea(u64 device_handle, u32 access_id); |
| 51 | Result GetApplicationArea(u64 device_handle, std::span<u8> data) const; | 52 | Result GetApplicationArea(u64 device_handle, std::span<u8> data); |
| 52 | Result SetApplicationArea(u64 device_handle, std::span<const u8> data); | 53 | Result SetApplicationArea(u64 device_handle, std::span<const u8> data); |
| 53 | Result Flush(u64 device_handle); | 54 | Result Flush(u64 device_handle); |
| 54 | Result Restore(u64 device_handle); | 55 | Result Restore(u64 device_handle); |
| 55 | Result CreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data); | 56 | Result CreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data); |
| 56 | Result GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info) const; | 57 | Result GetRegisterInfo(u64 device_handle, NFP::RegisterInfo& register_info); |
| 57 | Result GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info) const; | 58 | Result GetCommonInfo(u64 device_handle, NFP::CommonInfo& common_info); |
| 58 | Result GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info) const; | 59 | Result GetModelInfo(u64 device_handle, NFP::ModelInfo& model_info); |
| 59 | u32 GetApplicationAreaSize() const; | 60 | u32 GetApplicationAreaSize() const; |
| 60 | Result RecreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data); | 61 | Result RecreateApplicationArea(u64 device_handle, u32 access_id, std::span<const u8> data); |
| 61 | Result Format(u64 device_handle); | 62 | Result Format(u64 device_handle); |
| 62 | Result GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info) const; | 63 | Result GetAdminInfo(u64 device_handle, NFP::AdminInfo& admin_info); |
| 63 | Result GetRegisterInfoPrivate(u64 device_handle, NFP::RegisterInfoPrivate& register_info) const; | 64 | Result GetRegisterInfoPrivate(u64 device_handle, NFP::RegisterInfoPrivate& register_info); |
| 64 | Result SetRegisterInfoPrivate(u64 device_handle, const NFP::RegisterInfoPrivate& register_info); | 65 | Result SetRegisterInfoPrivate(u64 device_handle, const NFP::RegisterInfoPrivate& register_info); |
| 65 | Result DeleteRegisterInfo(u64 device_handle); | 66 | Result DeleteRegisterInfo(u64 device_handle); |
| 66 | Result DeleteApplicationArea(u64 device_handle); | 67 | Result DeleteApplicationArea(u64 device_handle); |
| 67 | Result ExistsApplicationArea(u64 device_handle, bool& has_application_area) const; | 68 | Result ExistsApplicationArea(u64 device_handle, bool& has_application_area); |
| 68 | Result GetAll(u64 device_handle, NFP::NfpData& nfp_data) const; | 69 | Result GetAll(u64 device_handle, NFP::NfpData& nfp_data); |
| 69 | Result SetAll(u64 device_handle, const NFP::NfpData& nfp_data); | 70 | Result SetAll(u64 device_handle, const NFP::NfpData& nfp_data); |
| 70 | Result FlushDebug(u64 device_handle); | 71 | Result FlushDebug(u64 device_handle); |
| 71 | Result BreakTag(u64 device_handle, NFP::BreakType break_type); | 72 | Result BreakTag(u64 device_handle, NFP::BreakType break_type); |
| 72 | Result ReadBackupData(u64 device_handle, std::span<u8> data) const; | 73 | Result ReadBackupData(u64 device_handle, std::span<u8> data); |
| 73 | Result WriteBackupData(u64 device_handle, std::span<const u8> data); | 74 | Result WriteBackupData(u64 device_handle, std::span<const u8> data); |
| 74 | Result WriteNtf(u64 device_handle, NFP::WriteType, std::span<const u8> data); | 75 | Result WriteNtf(u64 device_handle, NFP::WriteType, std::span<const u8> data); |
| 75 | 76 | ||
| @@ -78,17 +79,20 @@ private: | |||
| 78 | Result IsNfcParameterSet() const; | 79 | Result IsNfcParameterSet() const; |
| 79 | Result IsNfcInitialized() const; | 80 | Result IsNfcInitialized() const; |
| 80 | 81 | ||
| 82 | Result CheckHandleOnList(u64 device_handle, std::span<const u64> device_list) const; | ||
| 83 | |||
| 81 | Result GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& device, | 84 | Result GetDeviceFromHandle(u64 handle, std::shared_ptr<NfcDevice>& device, |
| 82 | bool check_state) const; | 85 | bool check_state) const; |
| 83 | 86 | ||
| 84 | Result GetDeviceHandle(u64 handle, std::shared_ptr<NfcDevice>& device) const; | 87 | Result GetDeviceHandle(u64 handle, std::shared_ptr<NfcDevice>& device) const; |
| 85 | Result VerifyDeviceResult(std::shared_ptr<NfcDevice> device, Result operation_result) const; | 88 | Result VerifyDeviceResult(std::shared_ptr<NfcDevice> device, Result operation_result); |
| 86 | Result CheckDeviceState(std::shared_ptr<NfcDevice> device) const; | 89 | Result CheckDeviceState(std::shared_ptr<NfcDevice> device) const; |
| 87 | 90 | ||
| 88 | std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle); | 91 | std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle); |
| 89 | const std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle) const; | 92 | const std::optional<std::shared_ptr<NfcDevice>> GetNfcDevice(u64 handle) const; |
| 90 | 93 | ||
| 91 | bool is_initialized = false; | 94 | bool is_initialized = false; |
| 95 | u64 time_since_last_error = 0; | ||
| 92 | mutable std::mutex mutex; | 96 | mutable std::mutex mutex; |
| 93 | std::array<std::shared_ptr<NfcDevice>, 10> devices{}; | 97 | std::array<std::shared_ptr<NfcDevice>, 10> devices{}; |
| 94 | 98 | ||
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) { | |||
| 79 | const std::size_t max_allowed_devices = ctx.GetWriteBufferNumElements<u64>(); | 79 | const std::size_t max_allowed_devices = ctx.GetWriteBufferNumElements<u64>(); |
| 80 | LOG_DEBUG(Service_NFC, "called"); | 80 | LOG_DEBUG(Service_NFC, "called"); |
| 81 | 81 | ||
| 82 | auto result = GetManager()->ListDevices(nfp_devices, max_allowed_devices); | 82 | auto result = GetManager()->ListDevices(nfp_devices, max_allowed_devices, true); |
| 83 | result = TranslateResultToServiceError(result); | 83 | result = TranslateResultToServiceError(result); |
| 84 | 84 | ||
| 85 | if (result.IsError()) { | 85 | if (result.IsError()) { |
| @@ -190,9 +190,13 @@ void NfcInterface::AttachActivateEvent(HLERequestContext& ctx) { | |||
| 190 | const auto device_handle{rp.Pop<u64>()}; | 190 | const auto device_handle{rp.Pop<u64>()}; |
| 191 | LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); | 191 | LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); |
| 192 | 192 | ||
| 193 | Kernel::KReadableEvent* out_event = nullptr; | ||
| 194 | auto result = GetManager()->AttachActivateEvent(&out_event, device_handle); | ||
| 195 | result = TranslateResultToServiceError(result); | ||
| 196 | |||
| 193 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 197 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 194 | rb.Push(ResultSuccess); | 198 | rb.Push(result); |
| 195 | rb.PushCopyObjects(GetManager()->AttachActivateEvent(device_handle)); | 199 | rb.PushCopyObjects(out_event); |
| 196 | } | 200 | } |
| 197 | 201 | ||
| 198 | void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) { | 202 | void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) { |
| @@ -200,9 +204,13 @@ void NfcInterface::AttachDeactivateEvent(HLERequestContext& ctx) { | |||
| 200 | const auto device_handle{rp.Pop<u64>()}; | 204 | const auto device_handle{rp.Pop<u64>()}; |
| 201 | LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); | 205 | LOG_DEBUG(Service_NFC, "called, device_handle={}", device_handle); |
| 202 | 206 | ||
| 207 | Kernel::KReadableEvent* out_event = nullptr; | ||
| 208 | auto result = GetManager()->AttachDeactivateEvent(&out_event, device_handle); | ||
| 209 | result = TranslateResultToServiceError(result); | ||
| 210 | |||
| 203 | IPC::ResponseBuilder rb{ctx, 2, 1}; | 211 | IPC::ResponseBuilder rb{ctx, 2, 1}; |
| 204 | rb.Push(ResultSuccess); | 212 | rb.Push(result); |
| 205 | rb.PushCopyObjects(GetManager()->AttachDeactivateEvent(device_handle)); | 213 | rb.PushCopyObjects(out_event); |
| 206 | } | 214 | } |
| 207 | 215 | ||
| 208 | void NfcInterface::ReadMifare(HLERequestContext& ctx) { | 216 | 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); | |||
| 17 | constexpr Result ResultNfcDisabled(ErrorModule::NFC, 80); | 17 | constexpr Result ResultNfcDisabled(ErrorModule::NFC, 80); |
| 18 | constexpr Result ResultWriteAmiiboFailed(ErrorModule::NFC, 88); | 18 | constexpr Result ResultWriteAmiiboFailed(ErrorModule::NFC, 88); |
| 19 | constexpr Result ResultTagRemoved(ErrorModule::NFC, 97); | 19 | constexpr Result ResultTagRemoved(ErrorModule::NFC, 97); |
| 20 | constexpr Result ResultUnknown112(ErrorModule::NFC, 112); | ||
| 20 | constexpr Result ResultUnableToAccessBackupFile(ErrorModule::NFC, 113); | 21 | constexpr Result ResultUnableToAccessBackupFile(ErrorModule::NFC, 113); |
| 22 | constexpr Result ResultUnknown114(ErrorModule::NFC, 114); | ||
| 23 | constexpr Result ResultUnknown115(ErrorModule::NFC, 115); | ||
| 21 | constexpr Result ResultRegistrationIsNotInitialized(ErrorModule::NFC, 120); | 24 | constexpr Result ResultRegistrationIsNotInitialized(ErrorModule::NFC, 120); |
| 22 | constexpr Result ResultApplicationAreaIsNotInitialized(ErrorModule::NFC, 128); | 25 | constexpr Result ResultApplicationAreaIsNotInitialized(ErrorModule::NFC, 128); |
| 23 | constexpr Result ResultCorruptedDataWithBackup(ErrorModule::NFC, 136); | 26 | 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 @@ | |||
| 7 | #include "core/hle/service/kernel_helpers.h" | 7 | #include "core/hle/service/kernel_helpers.h" |
| 8 | #include "core/hle/service/nifm/nifm.h" | 8 | #include "core/hle/service/nifm/nifm.h" |
| 9 | #include "core/hle/service/server_manager.h" | 9 | #include "core/hle/service/server_manager.h" |
| 10 | #include "network/network.h" | ||
| 10 | 11 | ||
| 11 | namespace { | 12 | namespace { |
| 12 | 13 | ||
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 @@ | |||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/service/service.h" | 6 | #include "core/hle/service/service.h" |
| 7 | #include "network/network.h" | ||
| 8 | #include "network/room.h" | ||
| 9 | #include "network/room_member.h" | ||
| 10 | 7 | ||
| 11 | namespace Core { | 8 | namespace Core { |
| 12 | class System; | 9 | class System; |
| 13 | } | 10 | } |
| 14 | 11 | ||
| 12 | namespace Network { | ||
| 13 | class RoomNetwork; | ||
| 14 | } | ||
| 15 | |||
| 15 | namespace Service::NIFM { | 16 | namespace Service::NIFM { |
| 16 | 17 | ||
| 17 | void LoopProcess(Core::System& system); | 18 | 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 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include "core/hle/result.h" | ||
| 7 | |||
| 8 | #include "common/common_types.h" | ||
| 9 | |||
| 10 | #include <memory> | 6 | #include <memory> |
| 11 | #include <span> | 7 | #include <span> |
| 12 | #include <string> | 8 | #include <string> |
| 13 | #include <vector> | 9 | #include <vector> |
| 14 | 10 | ||
| 11 | #include "common/common_types.h" | ||
| 12 | |||
| 13 | #include "core/hle/result.h" | ||
| 14 | |||
| 15 | namespace Network { | 15 | namespace Network { |
| 16 | class SocketBase; | 16 | class SocketBase; |
| 17 | } | 17 | } |
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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 5 | |||
| 6 | #include "common/logging/log.h" | 4 | #include "common/logging/log.h" |
| 7 | 5 | ||
| 6 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 7 | |||
| 8 | namespace Service::SSL { | 8 | namespace Service::SSL { |
| 9 | 9 | ||
| 10 | ResultVal<std::unique_ptr<SSLConnectionBackend>> CreateSSLConnectionBackend() { | 10 | 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 5 | #include "core/internal_network/network.h" | ||
| 6 | #include "core/internal_network/sockets.h" | ||
| 7 | |||
| 8 | #include "common/fs/file.h" | ||
| 9 | #include "common/hex_util.h" | ||
| 10 | #include "common/string_util.h" | ||
| 11 | |||
| 12 | #include <mutex> | 4 | #include <mutex> |
| 13 | 5 | ||
| 14 | #include <openssl/bio.h> | 6 | #include <openssl/bio.h> |
| @@ -16,6 +8,14 @@ | |||
| 16 | #include <openssl/ssl.h> | 8 | #include <openssl/ssl.h> |
| 17 | #include <openssl/x509.h> | 9 | #include <openssl/x509.h> |
| 18 | 10 | ||
| 11 | #include "common/fs/file.h" | ||
| 12 | #include "common/hex_util.h" | ||
| 13 | #include "common/string_util.h" | ||
| 14 | |||
| 15 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 16 | #include "core/internal_network/network.h" | ||
| 17 | #include "core/internal_network/sockets.h" | ||
| 18 | |||
| 19 | using namespace Common::FS; | 19 | using namespace Common::FS; |
| 20 | 20 | ||
| 21 | namespace Service::SSL { | 21 | 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/ssl/ssl_backend.h" | 4 | #include <mutex> |
| 5 | #include "core/internal_network/network.h" | ||
| 6 | #include "core/internal_network/sockets.h" | ||
| 7 | 5 | ||
| 8 | #include "common/error.h" | 6 | #include "common/error.h" |
| 9 | #include "common/fs/file.h" | 7 | #include "common/fs/file.h" |
| 10 | #include "common/hex_util.h" | 8 | #include "common/hex_util.h" |
| 11 | #include "common/string_util.h" | 9 | #include "common/string_util.h" |
| 12 | 10 | ||
| 13 | #include <mutex> | 11 | #include "core/hle/service/ssl/ssl_backend.h" |
| 12 | #include "core/internal_network/network.h" | ||
| 13 | #include "core/internal_network/sockets.h" | ||
| 14 | 14 | ||
| 15 | namespace { | 15 | namespace { |
| 16 | 16 | ||
| @@ -20,6 +20,7 @@ namespace { | |||
| 20 | #define SECURITY_WIN32 | 20 | #define SECURITY_WIN32 |
| 21 | #include <schnlsp.h> | 21 | #include <schnlsp.h> |
| 22 | #include <security.h> | 22 | #include <security.h> |
| 23 | #include <wincrypt.h> | ||
| 23 | 24 | ||
| 24 | std::once_flag one_time_init_flag; | 25 | std::once_flag one_time_init_flag; |
| 25 | bool one_time_init_success = false; | 26 | 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 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 5 | #include "core/internal_network/network.h" | ||
| 6 | #include "core/internal_network/sockets.h" | ||
| 7 | |||
| 8 | #include <mutex> | 4 | #include <mutex> |
| 9 | 5 | ||
| 10 | #include <Security/SecureTransport.h> | ||
| 11 | |||
| 12 | // SecureTransport has been deprecated in its entirety in favor of | 6 | // SecureTransport has been deprecated in its entirety in favor of |
| 13 | // Network.framework, but that does not allow layering TLS on top of an | 7 | // Network.framework, but that does not allow layering TLS on top of an |
| 14 | // arbitrary socket. | 8 | // arbitrary socket. |
| 9 | #if defined(__GNUC__) || defined(__clang__) | ||
| 10 | #pragma GCC diagnostic push | ||
| 15 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | 11 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
| 12 | #include <Security/SecureTransport.h> | ||
| 13 | #pragma GCC diagnostic pop | ||
| 14 | #endif | ||
| 15 | |||
| 16 | #include "core/hle/service/ssl/ssl_backend.h" | ||
| 17 | #include "core/internal_network/network.h" | ||
| 18 | #include "core/internal_network/sockets.h" | ||
| 16 | 19 | ||
| 17 | namespace { | 20 | namespace { |
| 18 | 21 | ||
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 @@ | |||
| 10 | #include "core/internal_network/network.h" | 10 | #include "core/internal_network/network.h" |
| 11 | #include "core/internal_network/network_interface.h" | 11 | #include "core/internal_network/network_interface.h" |
| 12 | #include "core/internal_network/socket_proxy.h" | 12 | #include "core/internal_network/socket_proxy.h" |
| 13 | #include "network/network.h" | ||
| 13 | 14 | ||
| 14 | #if YUZU_UNIX | 15 | #if YUZU_UNIX |
| 15 | #include <sys/socket.h> | 16 | #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 @@ | |||
| 10 | 10 | ||
| 11 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 12 | #include "core/internal_network/sockets.h" | 12 | #include "core/internal_network/sockets.h" |
| 13 | #include "network/network.h" | 13 | #include "network/room_member.h" |
| 14 | 14 | ||
| 15 | namespace Network { | 15 | namespace Network { |
| 16 | 16 | ||
| 17 | class RoomNetwork; | ||
| 18 | |||
| 17 | class ProxySocket : public SocketBase { | 19 | class ProxySocket : public SocketBase { |
| 18 | public: | 20 | public: |
| 19 | explicit ProxySocket(RoomNetwork& room_network_) noexcept; | 21 | 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 @@ | |||
| 15 | 15 | ||
| 16 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 17 | #include "core/internal_network/network.h" | 17 | #include "core/internal_network/network.h" |
| 18 | #include "network/network.h" | ||
| 19 | 18 | ||
| 20 | // TODO: C++20 Replace std::vector usages with std::span | 19 | // TODO: C++20 Replace std::vector usages with std::span |
| 21 | 20 | ||
| 22 | namespace Network { | 21 | namespace Network { |
| 23 | 22 | ||
| 23 | struct ProxyPacket; | ||
| 24 | |||
| 24 | class SocketBase { | 25 | class SocketBase { |
| 25 | public: | 26 | public: |
| 26 | #ifdef YUZU_UNIX | 27 | #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 | |||
| 38 | LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request"); | 38 | LOG_ERROR(Render, "A screenshot is already requested or in progress, ignoring the request"); |
| 39 | return; | 39 | return; |
| 40 | } | 40 | } |
| 41 | auto async_callback{[callback = std::move(callback)](bool invert_y) { | 41 | auto async_callback{[callback_ = std::move(callback)](bool invert_y) { |
| 42 | std::thread t{callback, invert_y}; | 42 | std::thread t{callback_, invert_y}; |
| 43 | t.detach(); | 43 | t.detach(); |
| 44 | }}; | 44 | }}; |
| 45 | renderer_settings.screenshot_bits = data; | 45 | 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 | |||
| 231 | } | 231 | } |
| 232 | const bool in_parallel = thread_worker != nullptr; | 232 | const bool in_parallel = thread_worker != nullptr; |
| 233 | const auto backend = device.GetShaderBackend(); | 233 | const auto backend = device.GetShaderBackend(); |
| 234 | auto func{[this, sources = std::move(sources), sources_spirv = std::move(sources_spirv), | 234 | auto func{[this, sources_ = std::move(sources), sources_spirv_ = std::move(sources_spirv), |
| 235 | shader_notify, backend, in_parallel, | 235 | shader_notify, backend, in_parallel, |
| 236 | force_context_flush](ShaderContext::Context*) mutable { | 236 | force_context_flush](ShaderContext::Context*) mutable { |
| 237 | for (size_t stage = 0; stage < 5; ++stage) { | 237 | for (size_t stage = 0; stage < 5; ++stage) { |
| 238 | switch (backend) { | 238 | switch (backend) { |
| 239 | case Settings::ShaderBackend::GLSL: | 239 | case Settings::ShaderBackend::GLSL: |
| 240 | if (!sources[stage].empty()) { | 240 | if (!sources_[stage].empty()) { |
| 241 | source_programs[stage] = CreateProgram(sources[stage], Stage(stage)); | 241 | source_programs[stage] = CreateProgram(sources_[stage], Stage(stage)); |
| 242 | } | 242 | } |
| 243 | break; | 243 | break; |
| 244 | case Settings::ShaderBackend::GLASM: | 244 | case Settings::ShaderBackend::GLASM: |
| 245 | if (!sources[stage].empty()) { | 245 | if (!sources_[stage].empty()) { |
| 246 | assembly_programs[stage] = CompileProgram(sources[stage], AssemblyStage(stage)); | 246 | assembly_programs[stage] = |
| 247 | CompileProgram(sources_[stage], AssemblyStage(stage)); | ||
| 247 | } | 248 | } |
| 248 | break; | 249 | break; |
| 249 | case Settings::ShaderBackend::SPIRV: | 250 | case Settings::ShaderBackend::SPIRV: |
| 250 | if (!sources_spirv[stage].empty()) { | 251 | if (!sources_spirv_[stage].empty()) { |
| 251 | source_programs[stage] = CreateProgram(sources_spirv[stage], Stage(stage)); | 252 | source_programs[stage] = CreateProgram(sources_spirv_[stage], Stage(stage)); |
| 252 | } | 253 | } |
| 253 | break; | 254 | break; |
| 254 | } | 255 | } |
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, | |||
| 288 | const auto load_compute{[&](std::ifstream& file, FileEnvironment env) { | 288 | const auto load_compute{[&](std::ifstream& file, FileEnvironment env) { |
| 289 | ComputePipelineKey key; | 289 | ComputePipelineKey key; |
| 290 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); | 290 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); |
| 291 | queue_work([this, key, env = std::move(env), &state, &callback](Context* ctx) mutable { | 291 | queue_work([this, key, env_ = std::move(env), &state, &callback](Context* ctx) mutable { |
| 292 | ctx->pools.ReleaseContents(); | 292 | ctx->pools.ReleaseContents(); |
| 293 | auto pipeline{CreateComputePipeline(ctx->pools, key, env, true)}; | 293 | auto pipeline{CreateComputePipeline(ctx->pools, key, env_, true)}; |
| 294 | std::scoped_lock lock{state.mutex}; | 294 | std::scoped_lock lock{state.mutex}; |
| 295 | if (pipeline) { | 295 | if (pipeline) { |
| 296 | compute_cache.emplace(key, std::move(pipeline)); | 296 | compute_cache.emplace(key, std::move(pipeline)); |
| @@ -305,9 +305,9 @@ void ShaderCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading, | |||
| 305 | const auto load_graphics{[&](std::ifstream& file, std::vector<FileEnvironment> envs) { | 305 | const auto load_graphics{[&](std::ifstream& file, std::vector<FileEnvironment> envs) { |
| 306 | GraphicsPipelineKey key; | 306 | GraphicsPipelineKey key; |
| 307 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); | 307 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); |
| 308 | queue_work([this, key, envs = std::move(envs), &state, &callback](Context* ctx) mutable { | 308 | queue_work([this, key, envs_ = std::move(envs), &state, &callback](Context* ctx) mutable { |
| 309 | boost::container::static_vector<Shader::Environment*, 5> env_ptrs; | 309 | boost::container::static_vector<Shader::Environment*, 5> env_ptrs; |
| 310 | for (auto& env : envs) { | 310 | for (auto& env : envs_) { |
| 311 | env_ptrs.push_back(&env); | 311 | env_ptrs.push_back(&env); |
| 312 | } | 312 | } |
| 313 | ctx->pools.ReleaseContents(); | 313 | 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: | |||
| 206 | const size_t sub_first_offset = static_cast<size_t>(first % 4) * GetQuadsNum(num_indices); | 206 | const size_t sub_first_offset = static_cast<size_t>(first % 4) * GetQuadsNum(num_indices); |
| 207 | const size_t offset = | 207 | const size_t offset = |
| 208 | (sub_first_offset + GetQuadsNum(first)) * 6ULL * BytesPerIndex(index_type); | 208 | (sub_first_offset + GetQuadsNum(first)) * 6ULL * BytesPerIndex(index_type); |
| 209 | scheduler.Record([buffer = *buffer, index_type_, offset](vk::CommandBuffer cmdbuf) { | 209 | scheduler.Record([buffer_ = *buffer, index_type_, offset](vk::CommandBuffer cmdbuf) { |
| 210 | cmdbuf.BindIndexBuffer(buffer, offset, index_type_); | 210 | cmdbuf.BindIndexBuffer(buffer_, offset, index_type_); |
| 211 | }); | 211 | }); |
| 212 | } | 212 | } |
| 213 | 213 | ||
| @@ -528,17 +528,18 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi | |||
| 528 | buffer_handles.push_back(handle); | 528 | buffer_handles.push_back(handle); |
| 529 | } | 529 | } |
| 530 | if (device.IsExtExtendedDynamicStateSupported()) { | 530 | if (device.IsExtExtendedDynamicStateSupported()) { |
| 531 | scheduler.Record([bindings = std::move(bindings), | 531 | scheduler.Record([bindings_ = std::move(bindings), |
| 532 | buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { | 532 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { |
| 533 | cmdbuf.BindVertexBuffers2EXT( | 533 | cmdbuf.BindVertexBuffers2EXT(bindings_.min_index, |
| 534 | bindings.min_index, bindings.max_index - bindings.min_index, buffer_handles.data(), | 534 | bindings_.max_index - bindings_.min_index, |
| 535 | bindings.offsets.data(), bindings.sizes.data(), bindings.strides.data()); | 535 | buffer_handles_.data(), bindings_.offsets.data(), |
| 536 | bindings_.sizes.data(), bindings_.strides.data()); | ||
| 536 | }); | 537 | }); |
| 537 | } else { | 538 | } else { |
| 538 | scheduler.Record([bindings = std::move(bindings), | 539 | scheduler.Record([bindings_ = std::move(bindings), |
| 539 | buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { | 540 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { |
| 540 | cmdbuf.BindVertexBuffers(bindings.min_index, bindings.max_index - bindings.min_index, | 541 | cmdbuf.BindVertexBuffers(bindings_.min_index, bindings_.max_index - bindings_.min_index, |
| 541 | buffer_handles.data(), bindings.offsets.data()); | 542 | buffer_handles_.data(), bindings_.offsets.data()); |
| 542 | }); | 543 | }); |
| 543 | } | 544 | } |
| 544 | } | 545 | } |
| @@ -573,11 +574,11 @@ void BufferCacheRuntime::BindTransformFeedbackBuffers(VideoCommon::HostBindings< | |||
| 573 | for (u32 index = 0; index < bindings.buffers.size(); ++index) { | 574 | for (u32 index = 0; index < bindings.buffers.size(); ++index) { |
| 574 | buffer_handles.push_back(bindings.buffers[index]->Handle()); | 575 | buffer_handles.push_back(bindings.buffers[index]->Handle()); |
| 575 | } | 576 | } |
| 576 | scheduler.Record([bindings = std::move(bindings), | 577 | scheduler.Record([bindings_ = std::move(bindings), |
| 577 | buffer_handles = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { | 578 | buffer_handles_ = std::move(buffer_handles)](vk::CommandBuffer cmdbuf) { |
| 578 | cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles.size()), | 579 | cmdbuf.BindTransformFeedbackBuffersEXT(0, static_cast<u32>(buffer_handles_.size()), |
| 579 | buffer_handles.data(), bindings.offsets.data(), | 580 | buffer_handles_.data(), bindings_.offsets.data(), |
| 580 | bindings.sizes.data()); | 581 | bindings_.sizes.data()); |
| 581 | }); | 582 | }); |
| 582 | } | 583 | } |
| 583 | 584 | ||
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 | |||
| 469 | ComputePipelineCacheKey key; | 469 | ComputePipelineCacheKey key; |
| 470 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); | 470 | file.read(reinterpret_cast<char*>(&key), sizeof(key)); |
| 471 | 471 | ||
| 472 | workers.QueueWork([this, key, env = std::move(env), &state, &callback]() mutable { | 472 | workers.QueueWork([this, key, env_ = std::move(env), &state, &callback]() mutable { |
| 473 | ShaderPools pools; | 473 | ShaderPools pools; |
| 474 | auto pipeline{CreateComputePipeline(pools, key, env, state.statistics.get(), false)}; | 474 | auto pipeline{CreateComputePipeline(pools, key, env_, state.statistics.get(), false)}; |
| 475 | std::scoped_lock lock{state.mutex}; | 475 | std::scoped_lock lock{state.mutex}; |
| 476 | if (pipeline) { | 476 | if (pipeline) { |
| 477 | compute_cache.emplace(key, std::move(pipeline)); | 477 | compute_cache.emplace(key, std::move(pipeline)); |
| @@ -500,10 +500,10 @@ void PipelineCache::LoadDiskResources(u64 title_id, std::stop_token stop_loading | |||
| 500 | (key.state.dynamic_vertex_input != 0) != dynamic_features.has_dynamic_vertex_input) { | 500 | (key.state.dynamic_vertex_input != 0) != dynamic_features.has_dynamic_vertex_input) { |
| 501 | return; | 501 | return; |
| 502 | } | 502 | } |
| 503 | workers.QueueWork([this, key, envs = std::move(envs), &state, &callback]() mutable { | 503 | workers.QueueWork([this, key, envs_ = std::move(envs), &state, &callback]() mutable { |
| 504 | ShaderPools pools; | 504 | ShaderPools pools; |
| 505 | boost::container::static_vector<Shader::Environment*, 5> env_ptrs; | 505 | boost::container::static_vector<Shader::Environment*, 5> env_ptrs; |
| 506 | for (auto& env : envs) { | 506 | for (auto& env : envs_) { |
| 507 | env_ptrs.push_back(&env); | 507 | env_ptrs.push_back(&env); |
| 508 | } | 508 | } |
| 509 | auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), | 509 | auto pipeline{CreateGraphicsPipeline(pools, key, MakeSpan(env_ptrs), |
| @@ -702,8 +702,8 @@ std::unique_ptr<ComputePipeline> PipelineCache::CreateComputePipeline( | |||
| 702 | if (!pipeline || pipeline_cache_filename.empty()) { | 702 | if (!pipeline || pipeline_cache_filename.empty()) { |
| 703 | return pipeline; | 703 | return pipeline; |
| 704 | } | 704 | } |
| 705 | serialization_thread.QueueWork([this, key, env = std::move(env)] { | 705 | serialization_thread.QueueWork([this, key, env_ = std::move(env)] { |
| 706 | SerializePipeline(key, std::array<const GenericEnvironment*, 1>{&env}, | 706 | SerializePipeline(key, std::array<const GenericEnvironment*, 1>{&env_}, |
| 707 | pipeline_cache_filename, CACHE_VERSION); | 707 | pipeline_cache_filename, CACHE_VERSION); |
| 708 | }); | 708 | }); |
| 709 | return pipeline; | 709 | 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 | |||
| 98 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, | 98 | : HostCounterBase{std::move(dependency_)}, cache{cache_}, type{type_}, |
| 99 | query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} { | 99 | query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} { |
| 100 | const vk::Device* logical = &cache.GetDevice().GetLogical(); | 100 | const vk::Device* logical = &cache.GetDevice().GetLogical(); |
| 101 | cache.GetScheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) { | 101 | cache.GetScheduler().Record([logical, query_ = query](vk::CommandBuffer cmdbuf) { |
| 102 | const bool use_precise = Settings::IsGPULevelHigh(); | 102 | const bool use_precise = Settings::IsGPULevelHigh(); |
| 103 | logical->ResetQueryPool(query.first, query.second, 1); | 103 | logical->ResetQueryPool(query_.first, query_.second, 1); |
| 104 | cmdbuf.BeginQuery(query.first, query.second, | 104 | cmdbuf.BeginQuery(query_.first, query_.second, |
| 105 | use_precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0); | 105 | use_precise ? VK_QUERY_CONTROL_PRECISE_BIT : 0); |
| 106 | }); | 106 | }); |
| 107 | } | 107 | } |
| @@ -111,8 +111,9 @@ HostCounter::~HostCounter() { | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | void HostCounter::EndQuery() { | 113 | void HostCounter::EndQuery() { |
| 114 | cache.GetScheduler().Record( | 114 | cache.GetScheduler().Record([query_ = query](vk::CommandBuffer cmdbuf) { |
| 115 | [query = query](vk::CommandBuffer cmdbuf) { cmdbuf.EndQuery(query.first, query.second); }); | 115 | cmdbuf.EndQuery(query_.first, query_.second); |
| 116 | }); | ||
| 116 | } | 117 | } |
| 117 | 118 | ||
| 118 | u64 HostCounter::BlockingQuery(bool async) const { | 119 | 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 | |||
| 1412 | } | 1412 | } |
| 1413 | scheduler->RequestOutsideRenderPassOperationContext(); | 1413 | scheduler->RequestOutsideRenderPassOperationContext(); |
| 1414 | scheduler->Record([buffers = std::move(buffers_vector), image = *original_image, | 1414 | scheduler->Record([buffers = std::move(buffers_vector), image = *original_image, |
| 1415 | aspect_mask = aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) { | 1415 | aspect_mask_ = aspect_mask, vk_copies](vk::CommandBuffer cmdbuf) { |
| 1416 | const VkImageMemoryBarrier read_barrier{ | 1416 | const VkImageMemoryBarrier read_barrier{ |
| 1417 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, | 1417 | .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, |
| 1418 | .pNext = nullptr, | 1418 | .pNext = nullptr, |
| @@ -1424,7 +1424,7 @@ void Image::DownloadMemory(std::span<VkBuffer> buffers_span, std::span<VkDeviceS | |||
| 1424 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 1424 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 1425 | .image = image, | 1425 | .image = image, |
| 1426 | .subresourceRange{ | 1426 | .subresourceRange{ |
| 1427 | .aspectMask = aspect_mask, | 1427 | .aspectMask = aspect_mask_, |
| 1428 | .baseMipLevel = 0, | 1428 | .baseMipLevel = 0, |
| 1429 | .levelCount = VK_REMAINING_MIP_LEVELS, | 1429 | .levelCount = VK_REMAINING_MIP_LEVELS, |
| 1430 | .baseArrayLayer = 0, | 1430 | .baseArrayLayer = 0, |
| @@ -1456,7 +1456,7 @@ void Image::DownloadMemory(std::span<VkBuffer> buffers_span, std::span<VkDeviceS | |||
| 1456 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, | 1456 | .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, |
| 1457 | .image = image, | 1457 | .image = image, |
| 1458 | .subresourceRange{ | 1458 | .subresourceRange{ |
| 1459 | .aspectMask = aspect_mask, | 1459 | .aspectMask = aspect_mask_, |
| 1460 | .baseMipLevel = 0, | 1460 | .baseMipLevel = 0, |
| 1461 | .levelCount = VK_REMAINING_MIP_LEVELS, | 1461 | .levelCount = VK_REMAINING_MIP_LEVELS, |
| 1462 | .baseArrayLayer = 0, | 1462 | .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() { | |||
| 135 | LOG_ERROR(WebService, "Room must be registered to be deleted"); | 135 | LOG_ERROR(WebService, "Room must be registered to be deleted"); |
| 136 | return; | 136 | return; |
| 137 | } | 137 | } |
| 138 | Common::DetachedTasks::AddTask( | 138 | Common::DetachedTasks::AddTask([host_{this->host}, username_{this->username}, |
| 139 | [host{this->host}, username{this->username}, token{this->token}, room_id{this->room_id}]() { | 139 | token_{this->token}, room_id_{this->room_id}]() { |
| 140 | // create a new client here because the this->client might be destroyed. | 140 | // create a new client here because the this->client might be destroyed. |
| 141 | Client{host, username, token}.DeleteJson(fmt::format("/lobby/{}", room_id), "", false); | 141 | Client{host_, username_, token_}.DeleteJson(fmt::format("/lobby/{}", room_id_), "", false); |
| 142 | }); | 142 | }); |
| 143 | } | 143 | } |
| 144 | 144 | ||
| 145 | } // namespace WebService | 145 | } // 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; | |||
| 235 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { | 235 | void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { |
| 236 | using namespace FileSys; | 236 | using namespace FileSys; |
| 237 | 237 | ||
| 238 | const auto& cache = dynamic_cast<ContentProviderUnion&>(system.GetContentProvider()); | 238 | const auto& cache = system.GetContentProviderUnion(); |
| 239 | 239 | ||
| 240 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, | 240 | auto installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, |
| 241 | ContentRecordType::Program); | 241 | ContentRecordType::Program); |