diff options
Diffstat (limited to 'src')
60 files changed, 422 insertions, 419 deletions
diff --git a/src/common/alignment.h b/src/common/alignment.h index 32d796ffa..1b56569d1 100644 --- a/src/common/alignment.h +++ b/src/common/alignment.h @@ -9,41 +9,48 @@ namespace Common { template <typename T> -requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUp(T value, size_t size) { +requires std::is_unsigned_v<T> +[[nodiscard]] constexpr T AlignUp(T value, size_t size) { auto mod{static_cast<T>(value % size)}; value -= mod; return static_cast<T>(mod == T{0} ? value : value + size); } template <typename T> -requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { +requires std::is_unsigned_v<T> +[[nodiscard]] constexpr T AlignUpLog2(T value, size_t align_log2) { return static_cast<T>((value + ((1ULL << align_log2) - 1)) >> align_log2 << align_log2); } template <typename T> -requires std::is_unsigned_v<T>[[nodiscard]] constexpr T AlignDown(T value, size_t size) { +requires std::is_unsigned_v<T> +[[nodiscard]] constexpr T AlignDown(T value, size_t size) { return static_cast<T>(value - value % size); } template <typename T> -requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool Is4KBAligned(T value) { +requires std::is_unsigned_v<T> +[[nodiscard]] constexpr bool Is4KBAligned(T value) { return (value & 0xFFF) == 0; } template <typename T> -requires std::is_unsigned_v<T>[[nodiscard]] constexpr bool IsWordAligned(T value) { +requires std::is_unsigned_v<T> +[[nodiscard]] constexpr bool IsWordAligned(T value) { return (value & 0b11) == 0; } template <typename T> -requires std::is_integral_v<T>[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { +requires std::is_integral_v<T> +[[nodiscard]] constexpr bool IsAligned(T value, size_t alignment) { using U = typename std::make_unsigned_t<T>; const U mask = static_cast<U>(alignment - 1); return (value & mask) == 0; } template <typename T, typename U> -requires std::is_integral_v<T>[[nodiscard]] constexpr T DivideUp(T x, U y) { +requires std::is_integral_v<T> +[[nodiscard]] constexpr T DivideUp(T x, U y) { return (x + (y - 1)) / y; } diff --git a/src/common/div_ceil.h b/src/common/div_ceil.h index 95e1489a9..e1db35464 100644 --- a/src/common/div_ceil.h +++ b/src/common/div_ceil.h @@ -11,15 +11,15 @@ namespace Common { /// Ceiled integer division. template <typename N, typename D> -requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeil(N number, - D divisor) { +requires std::is_integral_v<N> && std::is_unsigned_v<D> +[[nodiscard]] constexpr N DivCeil(N number, D divisor) { return static_cast<N>((static_cast<D>(number) + divisor - 1) / divisor); } /// Ceiled integer division with logarithmic divisor in base 2 template <typename N, typename D> -requires std::is_integral_v<N>&& std::is_unsigned_v<D>[[nodiscard]] constexpr N DivCeilLog2( - N value, D alignment_log2) { +requires std::is_integral_v<N> && std::is_unsigned_v<D> +[[nodiscard]] constexpr N DivCeilLog2(N value, D alignment_log2) { return static_cast<N>((static_cast<D>(value) + (D(1) << alignment_log2) - 1) >> alignment_log2); } diff --git a/src/common/host_memory.cpp b/src/common/host_memory.cpp index 6661244cf..b44a44949 100644 --- a/src/common/host_memory.cpp +++ b/src/common/host_memory.cpp @@ -314,8 +314,8 @@ private: } void UntrackPlaceholder(boost::icl::separate_interval_set<size_t>::iterator it) { - placeholders.erase(it); placeholder_host_pointers.erase(it->lower()); + placeholders.erase(it); } /// Return true when a given memory region is a "nieche" and the placeholders don't have to be diff --git a/src/common/intrusive_red_black_tree.h b/src/common/intrusive_red_black_tree.h index 1f696fe80..3173cc449 100644 --- a/src/common/intrusive_red_black_tree.h +++ b/src/common/intrusive_red_black_tree.h @@ -235,20 +235,19 @@ public: template <typename T> concept HasLightCompareType = requires { - { std::is_same<typename T::LightCompareType, void>::value } - ->std::convertible_to<bool>; + { std::is_same<typename T::LightCompareType, void>::value } -> std::convertible_to<bool>; }; namespace impl { -template <typename T, typename Default> -consteval auto* GetLightCompareType() { - if constexpr (HasLightCompareType<T>) { - return static_cast<typename T::LightCompareType*>(nullptr); - } else { - return static_cast<Default*>(nullptr); + template <typename T, typename Default> + consteval auto* GetLightCompareType() { + if constexpr (HasLightCompareType<T>) { + return static_cast<typename T::LightCompareType*>(nullptr); + } else { + return static_cast<Default*>(nullptr); + } } -} } // namespace impl diff --git a/src/common/uuid.h b/src/common/uuid.h index 2353179d8..8ea01f8da 100644 --- a/src/common/uuid.h +++ b/src/common/uuid.h @@ -58,6 +58,13 @@ struct UUID { uuid = INVALID_UUID; } + [[nodiscard]] constexpr bool IsInvalid() const { + return uuid == INVALID_UUID; + } + [[nodiscard]] constexpr bool IsValid() const { + return !IsInvalid(); + } + // TODO(ogniK): Properly generate a Nintendo ID [[nodiscard]] constexpr u64 GetNintendoID() const { return uuid[0]; diff --git a/src/common/vector_math.h b/src/common/vector_math.h index 22dba3c2d..ba7c363c1 100644 --- a/src/common/vector_math.h +++ b/src/common/vector_math.h @@ -667,8 +667,8 @@ template <typename T> // linear interpolation via float: 0.0=begin, 1.0=end template <typename X> -[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) Lerp(const X& begin, const X& end, - const float t) { +[[nodiscard]] constexpr decltype(X{} * float{} + X{} * float{}) + Lerp(const X& begin, const X& end, const float t) { return begin * (1.f - t) + end * t; } diff --git a/src/core/core.cpp b/src/core/core.cpp index 54ebed2c1..50d5dab4b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -305,7 +305,6 @@ struct System::Impl { is_powered_on = false; exit_lock = false; - gpu_core.reset(); services.reset(); service_manager.reset(); cheat_engine.reset(); @@ -315,6 +314,7 @@ struct System::Impl { core_timing.Shutdown(); app_loader.reset(); perf_stats.reset(); + gpu_core.reset(); kernel.Shutdown(); memory.Reset(); applet_manager.ClearAll(); diff --git a/src/core/file_sys/program_metadata.cpp b/src/core/file_sys/program_metadata.cpp index 01ae1a567..35a53d36c 100644 --- a/src/core/file_sys/program_metadata.cpp +++ b/src/core/file_sys/program_metadata.cpp @@ -77,7 +77,7 @@ void ProgramMetadata::LoadManual(bool is_64_bit, ProgramAddressSpaceType address aci_header.title_id = title_id; aci_file_access.permissions = filesystem_permissions; npdm_header.system_resource_size = system_resource_size; - aci_kernel_capabilities = std ::move(capabilities); + aci_kernel_capabilities = std::move(capabilities); } bool ProgramMetadata::Is64BitProgram() const { diff --git a/src/core/frontend/applets/profile_select.cpp b/src/core/frontend/applets/profile_select.cpp index 4c58c310f..3e4f90be2 100644 --- a/src/core/frontend/applets/profile_select.cpp +++ b/src/core/frontend/applets/profile_select.cpp @@ -13,7 +13,8 @@ ProfileSelectApplet::~ProfileSelectApplet() = default; void DefaultProfileSelectApplet::SelectProfile( std::function<void(std::optional<Common::UUID>)> callback) const { Service::Account::ProfileManager manager; - callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{})); + callback(manager.GetUser(Settings::values.current_user.GetValue()) + .value_or(Common::UUID{Common::INVALID_UUID})); LOG_INFO(Service_ACC, "called, selecting current user instead of prompting..."); } diff --git a/src/core/hle/kernel/k_handle_table.cpp b/src/core/hle/kernel/k_handle_table.cpp index 6a420d5b0..44d13169f 100644 --- a/src/core/hle/kernel/k_handle_table.cpp +++ b/src/core/hle/kernel/k_handle_table.cpp @@ -7,7 +7,7 @@ namespace Kernel { KHandleTable::KHandleTable(KernelCore& kernel_) : kernel{kernel_} {} -KHandleTable ::~KHandleTable() = default; +KHandleTable::~KHandleTable() = default; ResultCode KHandleTable::Finalize() { // Get the table and clear our record of it. diff --git a/src/core/hle/kernel/k_priority_queue.h b/src/core/hle/kernel/k_priority_queue.h index 4aa669d95..f4d71ad7e 100644 --- a/src/core/hle/kernel/k_priority_queue.h +++ b/src/core/hle/kernel/k_priority_queue.h @@ -22,12 +22,10 @@ class KThread; template <typename T> concept KPriorityQueueAffinityMask = !std::is_reference_v<T> && requires(T & t) { - { t.GetAffinityMask() } - ->Common::ConvertibleTo<u64>; + { t.GetAffinityMask() } -> Common::ConvertibleTo<u64>; {t.SetAffinityMask(0)}; - { t.GetAffinity(0) } - ->std::same_as<bool>; + { t.GetAffinity(0) } -> std::same_as<bool>; {t.SetAffinity(0, false)}; {t.SetAll()}; }; @@ -38,25 +36,20 @@ concept KPriorityQueueMember = !std::is_reference_v<T> && requires(T & t) { {(typename T::QueueEntry()).Initialize()}; {(typename T::QueueEntry()).SetPrev(std::addressof(t))}; {(typename T::QueueEntry()).SetNext(std::addressof(t))}; - { (typename T::QueueEntry()).GetNext() } - ->std::same_as<T*>; - { (typename T::QueueEntry()).GetPrev() } - ->std::same_as<T*>; - { t.GetPriorityQueueEntry(0) } - ->std::same_as<typename T::QueueEntry&>; + { (typename T::QueueEntry()).GetNext() } -> std::same_as<T*>; + { (typename T::QueueEntry()).GetPrev() } -> std::same_as<T*>; + { t.GetPriorityQueueEntry(0) } -> std::same_as<typename T::QueueEntry&>; {t.GetAffinityMask()}; - { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } - ->KPriorityQueueAffinityMask; + { std::remove_cvref_t<decltype(t.GetAffinityMask())>() } -> KPriorityQueueAffinityMask; - { t.GetActiveCore() } - ->Common::ConvertibleTo<s32>; - { t.GetPriority() } - ->Common::ConvertibleTo<s32>; + { t.GetActiveCore() } -> Common::ConvertibleTo<s32>; + { t.GetPriority() } -> Common::ConvertibleTo<s32>; }; template <typename Member, size_t NumCores_, int LowestPriority, int HighestPriority> -requires KPriorityQueueMember<Member> class KPriorityQueue { +requires KPriorityQueueMember<Member> +class KPriorityQueue { public: using AffinityMaskType = std::remove_cv_t< std::remove_reference_t<decltype(std::declval<Member>().GetAffinityMask())>>; diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index 12cfae919..c8ccc1ae4 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h @@ -197,7 +197,7 @@ private: class [[nodiscard]] KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { public: - explicit KScopedSchedulerLock(KernelCore & kernel); + explicit KScopedSchedulerLock(KernelCore& kernel); ~KScopedSchedulerLock(); }; diff --git a/src/core/hle/kernel/k_scoped_lock.h b/src/core/hle/kernel/k_scoped_lock.h index 72c3b0252..4fb180fc6 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -13,19 +13,18 @@ namespace Kernel { template <typename T> concept KLockable = !std::is_reference_v<T> && requires(T & t) { - { t.Lock() } - ->std::same_as<void>; - { t.Unlock() } - ->std::same_as<void>; + { t.Lock() } -> std::same_as<void>; + { t.Unlock() } -> std::same_as<void>; }; template <typename T> -requires KLockable<T> class [[nodiscard]] KScopedLock { +requires KLockable<T> +class [[nodiscard]] KScopedLock { public: - explicit KScopedLock(T * l) : lock_ptr(l) { + explicit KScopedLock(T* l) : lock_ptr(l) { this->lock_ptr->Lock(); } - explicit KScopedLock(T & l) : KScopedLock(std::addressof(l)) {} + explicit KScopedLock(T& l) : KScopedLock(std::addressof(l)) {} ~KScopedLock() { this->lock_ptr->Unlock(); @@ -34,7 +33,7 @@ public: KScopedLock(const KScopedLock&) = delete; KScopedLock& operator=(const KScopedLock&) = delete; - KScopedLock(KScopedLock &&) = delete; + KScopedLock(KScopedLock&&) = delete; KScopedLock& operator=(KScopedLock&&) = delete; private: diff --git a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h index a86af56dd..f6c75f2d9 100644 --- a/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h +++ b/src/core/hle/kernel/k_scoped_scheduler_lock_and_sleep.h @@ -17,7 +17,7 @@ namespace Kernel { class [[nodiscard]] KScopedSchedulerLockAndSleep { public: - explicit KScopedSchedulerLockAndSleep(KernelCore & kernel_, KThread * t, s64 timeout) + explicit KScopedSchedulerLockAndSleep(KernelCore& kernel_, KThread* t, s64 timeout) : kernel(kernel_), thread(t), timeout_tick(timeout) { // Lock the scheduler. kernel.GlobalSchedulerContext().scheduler_lock.Lock(); diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 6d9ec0a8a..689b36056 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -929,8 +929,7 @@ void Module::Interface::TrySelectUserWithoutInteraction(Kernel::HLERequestContex } const auto user_list = profile_manager->GetAllUsers(); - if (std::all_of(user_list.begin(), user_list.end(), - [](const auto& user) { return user.uuid == Common::INVALID_UUID; })) { + if (std::ranges::all_of(user_list, [](const auto& user) { return user.IsInvalid(); })) { rb.Push(ResultUnknown); // TODO(ogniK): Find the correct error code rb.PushRaw<u128>(Common::INVALID_UUID); return; diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 24a1c9157..568303ced 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -208,9 +208,10 @@ bool ProfileManager::UserExists(UUID uuid) const { } bool ProfileManager::UserExistsIndex(std::size_t index) const { - if (index >= MAX_USERS) + if (index >= MAX_USERS) { return false; - return profiles[index].user_uuid.uuid != Common::INVALID_UUID; + } + return profiles[index].user_uuid.IsValid(); } /// Opens a specific user @@ -304,7 +305,7 @@ bool ProfileManager::RemoveUser(UUID uuid) { bool ProfileManager::SetProfileBase(UUID uuid, const ProfileBase& profile_new) { const auto index = GetUserIndex(uuid); - if (!index || profile_new.user_uuid == UUID(Common::INVALID_UUID)) { + if (!index || profile_new.user_uuid.IsInvalid()) { return false; } @@ -346,7 +347,7 @@ void ProfileManager::ParseUserSaveFile() { } for (const auto& user : data.users) { - if (user.uuid == UUID(Common::INVALID_UUID)) { + if (user.uuid.IsInvalid()) { continue; } diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index c3ac73131..8c2e2f920 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -275,12 +275,14 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv {18, nullptr, "SetRequiresCaptureButtonShortPressedMessage"}, {19, &ISelfController::SetAlbumImageOrientation, "SetAlbumImageOrientation"}, {20, nullptr, "SetDesirableKeyboardLayout"}, + {21, nullptr, "GetScreenShotProgramId"}, {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"}, {41, nullptr, "IsSystemBufferSharingEnabled"}, {42, nullptr, "GetSystemSharedLayerHandle"}, {43, nullptr, "GetSystemSharedBufferHandle"}, {44, &ISelfController::CreateManagedDisplaySeparableLayer, "CreateManagedDisplaySeparableLayer"}, {45, nullptr, "SetManagedDisplayLayerSeparationMode"}, + {46, nullptr, "SetRecordingLayerCompositionEnabled"}, {50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"}, {51, nullptr, "ApproveToDisplay"}, {60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"}, @@ -302,6 +304,7 @@ ISelfController::ISelfController(Core::System& system_, NVFlinger::NVFlinger& nv {100, &ISelfController::SetAlbumImageTakenNotificationEnabled, "SetAlbumImageTakenNotificationEnabled"}, {110, nullptr, "SetApplicationAlbumUserData"}, {120, nullptr, "SaveCurrentScreenshot"}, + {130, nullptr, "SetRecordVolumeMuted"}, {1000, nullptr, "GetDebugStorageChannel"}, }; // clang-format on @@ -683,6 +686,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, {91, nullptr, "GetCurrentPerformanceConfiguration"}, {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, {110, nullptr, "OpenMyGpuErrorHandler"}, + {120, nullptr, "GetAppletLaunchedHistory"}, {200, nullptr, "GetOperationModeSystemInfo"}, {300, nullptr, "GetSettingsPlatformRegion"}, {400, nullptr, "ActivateMigrationService"}, diff --git a/src/core/hle/service/am/applets/applet_profile_select.cpp b/src/core/hle/service/am/applets/applet_profile_select.cpp index bdc21778e..a6e891944 100644 --- a/src/core/hle/service/am/applets/applet_profile_select.cpp +++ b/src/core/hle/service/am/applets/applet_profile_select.cpp @@ -60,7 +60,7 @@ void ProfileSelect::Execute() { void ProfileSelect::SelectionComplete(std::optional<Common::UUID> uuid) { UserSelectionOutput output{}; - if (uuid.has_value() && uuid->uuid != Common::INVALID_UUID) { + if (uuid.has_value() && uuid->IsValid()) { output.result = 0; output.uuid_selected = uuid->uuid; } else { diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 8c4c49b85..2e46e7161 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp @@ -41,6 +41,14 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { {27, nullptr, "SetVolumeMappingTableForDev"}, {28, nullptr, "GetAudioOutputChannelCountForPlayReport"}, {29, nullptr, "BindAudioOutputChannelCountUpdateEventForPlayReport"}, + {30, nullptr, "Unknown30"}, + {31, nullptr, "Unknown31"}, + {32, nullptr, "Unknown32"}, + {33, nullptr, "Unknown33"}, + {34, nullptr, "Unknown34"}, + {10000, nullptr, "Unknown10000"}, + {10001, nullptr, "Unknown10001"}, + {10002, nullptr, "Unknown10002"}, }; // clang-format on diff --git a/src/core/hle/service/audio/audin_u.cpp b/src/core/hle/service/audio/audin_u.cpp index 3e7fd6024..570525019 100644 --- a/src/core/hle/service/audio/audin_u.cpp +++ b/src/core/hle/service/audio/audin_u.cpp @@ -3,38 +3,65 @@ // Refer to the license.txt file included. #include "common/logging/log.h" +#include "core/core.h" #include "core/hle/ipc_helpers.h" #include "core/hle/kernel/hle_ipc.h" +#include "core/hle/kernel/k_event.h" #include "core/hle/service/audio/audin_u.h" namespace Service::Audio { -class IAudioIn final : public ServiceFramework<IAudioIn> { -public: - explicit IAudioIn(Core::System& system_) : ServiceFramework{system_, "IAudioIn"} { - // clang-format off - static const FunctionInfo functions[] = { - {0, nullptr, "GetAudioInState"}, - {1, nullptr, "Start"}, - {2, nullptr, "Stop"}, - {3, nullptr, "AppendAudioInBuffer"}, - {4, nullptr, "RegisterBufferEvent"}, - {5, nullptr, "GetReleasedAudioInBuffer"}, - {6, nullptr, "ContainsAudioInBuffer"}, - {7, nullptr, "AppendUacInBuffer"}, - {8, nullptr, "AppendAudioInBufferAuto"}, - {9, nullptr, "GetReleasedAudioInBuffersAuto"}, - {10, nullptr, "AppendUacInBufferAuto"}, - {11, nullptr, "GetAudioInBufferCount"}, - {12, nullptr, "SetDeviceGain"}, - {13, nullptr, "GetDeviceGain"}, - {14, nullptr, "FlushAudioInBuffers"}, - }; - // clang-format on - - RegisterHandlers(functions); - } -}; +IAudioIn::IAudioIn(Core::System& system_) + : ServiceFramework{system_, "IAudioIn"}, buffer_event{system_.Kernel()} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "GetAudioInState"}, + {1, &IAudioIn::Start, "Start"}, + {2, nullptr, "Stop"}, + {3, nullptr, "AppendAudioInBuffer"}, + {4, &IAudioIn::RegisterBufferEvent, "RegisterBufferEvent"}, + {5, nullptr, "GetReleasedAudioInBuffer"}, + {6, nullptr, "ContainsAudioInBuffer"}, + {7, nullptr, "AppendUacInBuffer"}, + {8, &IAudioIn::AppendAudioInBufferAuto, "AppendAudioInBufferAuto"}, + {9, nullptr, "GetReleasedAudioInBuffersAuto"}, + {10, nullptr, "AppendUacInBufferAuto"}, + {11, nullptr, "GetAudioInBufferCount"}, + {12, nullptr, "SetDeviceGain"}, + {13, nullptr, "GetDeviceGain"}, + {14, nullptr, "FlushAudioInBuffers"}, + }; + // clang-format on + + RegisterHandlers(functions); + + Kernel::KAutoObject::Create(std::addressof(buffer_event)); + buffer_event.Initialize("IAudioIn:BufferEvent"); +} + +IAudioIn::~IAudioIn() = default; + +void IAudioIn::Start(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_Audio, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IAudioIn::RegisterBufferEvent(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_Audio, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(buffer_event.GetReadableEvent()); +} + +void IAudioIn::AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx) { + LOG_WARNING(Service_Audio, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} AudInU::AudInU(Core::System& system_) : ServiceFramework{system_, "audin:u"} { // clang-format off diff --git a/src/core/hle/service/audio/audin_u.h b/src/core/hle/service/audio/audin_u.h index 0d75ae5ac..f2f7f9932 100644 --- a/src/core/hle/service/audio/audin_u.h +++ b/src/core/hle/service/audio/audin_u.h @@ -4,6 +4,7 @@ #pragma once +#include "core/hle/kernel/k_event.h" #include "core/hle/service/service.h" namespace Core { @@ -16,6 +17,19 @@ class HLERequestContext; namespace Service::Audio { +class IAudioIn final : public ServiceFramework<IAudioIn> { +public: + explicit IAudioIn(Core::System& system_); + ~IAudioIn() override; + +private: + void Start(Kernel::HLERequestContext& ctx); + void RegisterBufferEvent(Kernel::HLERequestContext& ctx); + void AppendAudioInBufferAuto(Kernel::HLERequestContext& ctx); + + Kernel::KEvent buffer_event; +}; + class AudInU final : public ServiceFramework<AudInU> { public: explicit AudInU(Core::System& system_); diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp index b769fe959..1a91719f5 100644 --- a/src/core/hle/service/audio/audren_u.cpp +++ b/src/core/hle/service/audio/audren_u.cpp @@ -187,7 +187,8 @@ public: {10, &IAudioDevice::GetActiveAudioDeviceName, "GetActiveAudioDeviceNameAuto"}, {11, &IAudioDevice::QueryAudioDeviceInputEvent, "QueryAudioDeviceInputEvent"}, {12, &IAudioDevice::QueryAudioDeviceOutputEvent, "QueryAudioDeviceOutputEvent"}, - {13, nullptr, "GetAudioSystemMasterVolumeSetting"}, + {13, nullptr, "GetActiveAudioOutputDeviceName"}, + {14, nullptr, "ListAudioOutputDeviceName"}, }; RegisterHandlers(functions); } diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index 46da438ef..acf791de2 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp @@ -175,6 +175,10 @@ public: {143, nullptr, "GetAudioControlInputState"}, {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, {145, nullptr, "GetConnectedAudioDevice"}, + {146, nullptr, "CloseAudioControlInput"}, + {147, nullptr, "RegisterAudioControlNotification"}, + {148, nullptr, "SendAudioControlPassthroughCommand"}, + {149, nullptr, "SendAudioControlSetAbsoluteVolumeCommand"}, {256, nullptr, "IsManufacturingMode"}, {257, nullptr, "EmulateBluetoothCrash"}, {258, nullptr, "GetBleChannelMap"}, diff --git a/src/core/hle/service/caps/caps_ss.cpp b/src/core/hle/service/caps/caps_ss.cpp index 2b5314691..33a976ddf 100644 --- a/src/core/hle/service/caps/caps_ss.cpp +++ b/src/core/hle/service/caps/caps_ss.cpp @@ -15,6 +15,7 @@ CAPS_SS::CAPS_SS(Core::System& system_) : ServiceFramework{system_, "caps:ss"} { {204, nullptr, "SaveEditedScreenShotEx0"}, {206, nullptr, "Unknown206"}, {208, nullptr, "SaveScreenShotOfMovieEx1"}, + {1000, nullptr, "Unknown1000"}, }; // clang-format on diff --git a/src/core/hle/service/es/es.cpp b/src/core/hle/service/es/es.cpp index 110c7cb1c..f6184acc9 100644 --- a/src/core/hle/service/es/es.cpp +++ b/src/core/hle/service/es/es.cpp @@ -55,6 +55,8 @@ public: {36, nullptr, "DeleteAllInactiveELicenseRequiredPersonalizedTicket"}, {37, nullptr, "OwnTicket2"}, {38, nullptr, "OwnTicket3"}, + {39, nullptr, "DeleteAllInactivePersonalizedTicket"}, + {40, nullptr, "DeletePrepurchaseRecordByNintendoAccountId"}, {501, nullptr, "Unknown501"}, {502, nullptr, "Unknown502"}, {503, nullptr, "GetTitleKey"}, @@ -88,11 +90,15 @@ public: {1503, nullptr, "Unknown1503"}, {1504, nullptr, "Unknown1504"}, {1505, nullptr, "Unknown1505"}, + {1506, nullptr, "Unknown1506"}, {2000, nullptr, "Unknown2000"}, {2001, nullptr, "Unknown2001"}, + {2002, nullptr, "Unknown2002"}, + {2003, nullptr, "Unknown2003"}, {2100, nullptr, "Unknown2100"}, {2501, nullptr, "Unknown2501"}, {2502, nullptr, "Unknown2502"}, + {2601, nullptr, "Unknown2601"}, {3001, nullptr, "Unknown3001"}, {3002, nullptr, "Unknown3002"}, }; diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index 4fcc6f93a..9ee146caf 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -507,6 +507,7 @@ private: LarkNesRight = 18, Lucia = 19, Verification = 20, + Lagon = 21, }; struct NPadEntry { diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index a1707a72a..8c363142c 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -106,7 +106,7 @@ void IAppletResource::DeactivateController(HidController controller) { controllers[static_cast<size_t>(controller)]->DeactivateController(); } -IAppletResource ::~IAppletResource() { +IAppletResource::~IAppletResource() { system.CoreTiming().UnscheduleEvent(pad_update_event, 0); system.CoreTiming().UnscheduleEvent(motion_update_event, 0); } @@ -239,6 +239,12 @@ Hid::Hid(Core::System& system_) {81, &Hid::ResetGyroscopeZeroDriftMode, "ResetGyroscopeZeroDriftMode"}, {82, &Hid::IsSixAxisSensorAtRest, "IsSixAxisSensorAtRest"}, {83, &Hid::IsFirmwareUpdateAvailableForSixAxisSensor, "IsFirmwareUpdateAvailableForSixAxisSensor"}, + {84, nullptr, "EnableSixAxisSensorUnalteredPassthrough"}, + {85, nullptr, "IsSixAxisSensorUnalteredPassthroughEnabled"}, + {86, nullptr, "StoreSixAxisSensorCalibrationParameter"}, + {87, nullptr, "LoadSixAxisSensorCalibrationParameter"}, + {88, nullptr, "GetSixAxisSensorIcInformation"}, + {89, nullptr, "ResetIsSixAxisSensorDeviceNewlyAssigned"}, {91, &Hid::ActivateGesture, "ActivateGesture"}, {100, &Hid::SetSupportedNpadStyleSet, "SetSupportedNpadStyleSet"}, {101, &Hid::GetSupportedNpadStyleSet, "GetSupportedNpadStyleSet"}, @@ -1656,6 +1662,9 @@ public: {12, nullptr, "UnsetTouchScreenAutoPilotState"}, {13, nullptr, "GetTouchScreenConfiguration"}, {14, nullptr, "ProcessTouchScreenAutoTune"}, + {15, nullptr, "ForceStopTouchScreenManagement"}, + {16, nullptr, "ForceRestartTouchScreenManagement"}, + {17, nullptr, "IsTouchScreenManaged"}, {20, nullptr, "DeactivateMouse"}, {21, nullptr, "SetMouseAutoPilotState"}, {22, nullptr, "UnsetMouseAutoPilotState"}, diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index e4c703da4..32533cd94 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -31,6 +31,7 @@ public: {24, nullptr, "DestroyTokenWithApplicationId"}, {25, nullptr, "QueryIsTokenValid"}, {26, nullptr, "ListenToMyApplicationId"}, + {27, nullptr, "DestroyTokenAll"}, {31, nullptr, "UploadTokenToBaaS"}, {32, nullptr, "DestroyTokenForBaaS"}, {33, nullptr, "CreateTokenForBaaS"}, diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index a33e47d0b..789000294 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp @@ -16,7 +16,7 @@ namespace Service::Nvidia::Devices { nvdisp_disp0::nvdisp_disp0(Core::System& system_, std::shared_ptr<nvmap> nvmap_dev_) : nvdevice{system_}, nvmap_dev{std::move(nvmap_dev_)} {} -nvdisp_disp0 ::~nvdisp_disp0() = default; +nvdisp_disp0::~nvdisp_disp0() = default; NvResult nvdisp_disp0::Ioctl1(DeviceFD fd, Ioctl command, const std::vector<u8>& input, std::vector<u8>& output) { diff --git a/src/core/hle/service/sockets/bsd.cpp b/src/core/hle/service/sockets/bsd.cpp index 7d85ecb6a..b9e765f1d 100644 --- a/src/core/hle/service/sockets/bsd.cpp +++ b/src/core/hle/service/sockets/bsd.cpp @@ -415,6 +415,18 @@ void BSD::Write(Kernel::HLERequestContext& ctx) { }); } +void BSD::Read(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const s32 fd = rp.Pop<s32>(); + + LOG_WARNING(Service, "(STUBBED) called. fd={} len={}", fd, ctx.GetWriteBufferSize()); + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(ResultSuccess); + rb.Push<u32>(0); // ret + rb.Push<u32>(0); // bsd errno +} + void BSD::Close(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const s32 fd = rp.Pop<s32>(); @@ -855,7 +867,7 @@ BSD::BSD(Core::System& system_, const char* name) : ServiceFramework{system_, na {22, &BSD::Shutdown, "Shutdown"}, {23, nullptr, "ShutdownAllSockets"}, {24, &BSD::Write, "Write"}, - {25, nullptr, "Read"}, + {25, &BSD::Read, "Read"}, {26, &BSD::Close, "Close"}, {27, nullptr, "DuplicateSocket"}, {28, nullptr, "GetResourceStatistics"}, diff --git a/src/core/hle/service/sockets/bsd.h b/src/core/hle/service/sockets/bsd.h index 1d2df9c61..d68beef5c 100644 --- a/src/core/hle/service/sockets/bsd.h +++ b/src/core/hle/service/sockets/bsd.h @@ -135,6 +135,7 @@ private: void Send(Kernel::HLERequestContext& ctx); void SendTo(Kernel::HLERequestContext& ctx); void Write(Kernel::HLERequestContext& ctx); + void Read(Kernel::HLERequestContext& ctx); void Close(Kernel::HLERequestContext& ctx); void EventFd(Kernel::HLERequestContext& ctx); diff --git a/src/core/hle/service/time/system_clock_core.cpp b/src/core/hle/service/time/system_clock_core.cpp index bd334bbef..5c2354cdd 100644 --- a/src/core/hle/service/time/system_clock_core.cpp +++ b/src/core/hle/service/time/system_clock_core.cpp @@ -13,7 +13,7 @@ SystemClockCore::SystemClockCore(SteadyClockCore& steady_clock_core_) context.steady_time_point.clock_source_id = steady_clock_core.GetClockSourceId(); } -SystemClockCore ::~SystemClockCore() = default; +SystemClockCore::~SystemClockCore() = default; ResultCode SystemClockCore::GetCurrentTime(Core::System& system, s64& posix_time) const { posix_time = 0; diff --git a/src/core/hle/service/time/time_zone_service.cpp b/src/core/hle/service/time/time_zone_service.cpp index 5c3108768..3871e7316 100644 --- a/src/core/hle/service/time/time_zone_service.cpp +++ b/src/core/hle/service/time/time_zone_service.cpp @@ -10,8 +10,8 @@ namespace Service::Time { -ITimeZoneService ::ITimeZoneService(Core::System& system_, - TimeZone::TimeZoneContentManager& time_zone_manager_) +ITimeZoneService::ITimeZoneService(Core::System& system_, + TimeZone::TimeZoneContentManager& time_zone_manager_) : ServiceFramework{system_, "ITimeZoneService"}, time_zone_content_manager{time_zone_manager_} { static const FunctionInfo functions[] = { {0, &ITimeZoneService::GetDeviceLocationName, "GetDeviceLocationName"}, diff --git a/src/core/hle/service/usb/usb.cpp b/src/core/hle/service/usb/usb.cpp index 7f436c3bb..2ee103b37 100644 --- a/src/core/hle/service/usb/usb.cpp +++ b/src/core/hle/service/usb/usb.cpp @@ -97,7 +97,7 @@ public: {3, nullptr, "GetAlternateInterface"}, {4, nullptr, "GetCurrentFrame"}, {5, nullptr, "CtrlXferAsync"}, - {6, nullptr, "Unknown6"}, + {6, nullptr, "GetCtrlXferCompletionEvent"}, {7, nullptr, "GetCtrlXferReport"}, {8, nullptr, "ResetDevice"}, {9, nullptr, "OpenUsbEp"}, @@ -183,8 +183,8 @@ public: {4, nullptr, "GetHostPdcFirmwareRevision"}, {5, nullptr, "GetHostPdcManufactureId"}, {6, nullptr, "GetHostPdcDeviceId"}, - {7, nullptr, "AwakeCradle"}, - {8, nullptr, "SleepCradle"}, + {7, nullptr, "EnableCradleRecovery"}, + {8, nullptr, "DisableCradleRecovery"}, }; // clang-format on diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 8e8fc40ca..be3d52d54 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -831,6 +831,7 @@ public: {6010, nullptr, "GetLayerPresentationAllFencesExpiredEvent"}, {6011, nullptr, "EnableLayerAutoClearTransitionBuffer"}, {6012, nullptr, "DisableLayerAutoClearTransitionBuffer"}, + {6013, nullptr, "SetLayerOpacity"}, {7000, nullptr, "SetContentVisibility"}, {8000, nullptr, "SetConductorLayer"}, {8001, nullptr, "SetTimestampTracking"}, diff --git a/src/input_common/main.cpp b/src/input_common/main.cpp index 18d7d8817..f3907c65a 100644 --- a/src/input_common/main.cpp +++ b/src/input_common/main.cpp @@ -346,8 +346,8 @@ void InputSubsystem::ReloadInputDevices() { impl->udp->ReloadSockets(); } -std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers([ - [maybe_unused]] Polling::DeviceType type) const { +std::vector<std::unique_ptr<Polling::DevicePoller>> InputSubsystem::GetPollers( + [[maybe_unused]] Polling::DeviceType type) const { #ifdef HAVE_SDL2 return impl->sdl->GetPollers(type); #else diff --git a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp index 580063fa9..170db269a 100644 --- a/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp +++ b/src/shader_recompiler/backend/glsl/emit_glsl_context_get_set.cpp @@ -58,8 +58,8 @@ void GetCbuf(EmitContext& ctx, std::string_view ret, const IR::Value& binding, const auto cbuf{fmt::format("{}_cbuf{}", ctx.stage_name, binding.U32())}; const auto cbuf_cast{fmt::format("{}({}[{}]{{}})", cast, cbuf, index)}; const auto extraction{num_bits == 32 ? cbuf_cast - : fmt ::format("bitfieldExtract({},int({}),{})", cbuf_cast, - bit_offset, num_bits)}; + : fmt::format("bitfieldExtract({},int({}),{})", cbuf_cast, + bit_offset, num_bits)}; if (!component_indexing_bug) { const auto result{fmt::format(fmt::runtime(extraction), swizzle)}; ctx.Add("{}={};", ret, result); diff --git a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp index 68f360b3c..6f60c6574 100644 --- a/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp +++ b/src/shader_recompiler/backend/spirv/emit_spirv_context_get_set.cpp @@ -477,7 +477,13 @@ void EmitSetSampleMask(EmitContext& ctx, Id value) { } void EmitSetFragDepth(EmitContext& ctx, Id value) { - ctx.OpStore(ctx.frag_depth, value); + if (!ctx.runtime_info.convert_depth_mode) { + ctx.OpStore(ctx.frag_depth, value); + return; + } + const Id unit{ctx.Const(0.5f)}; + const Id new_depth{ctx.OpFma(ctx.F32[1], value, unit, unit)}; + ctx.OpStore(ctx.frag_depth, new_depth); } void EmitGetZFlag(EmitContext&) { diff --git a/src/shader_recompiler/object_pool.h b/src/shader_recompiler/object_pool.h index f3b12d04b..a12ddcc8f 100644 --- a/src/shader_recompiler/object_pool.h +++ b/src/shader_recompiler/object_pool.h @@ -11,14 +11,16 @@ namespace Shader { template <typename T> -requires std::is_destructible_v<T> class ObjectPool { +requires std::is_destructible_v<T> +class ObjectPool { public: explicit ObjectPool(size_t chunk_size = 8192) : new_chunk_size{chunk_size} { node = &chunks.emplace_back(new_chunk_size); } template <typename... Args> - requires std::is_constructible_v<T, Args...>[[nodiscard]] T* Create(Args&&... args) { + requires std::is_constructible_v<T, Args...> + [[nodiscard]] T* Create(Args&&... args) { return std::construct_at(Memory(), std::forward<Args>(args)...); } diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index c9cff7450..20d748c12 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -6,7 +6,6 @@ set(SHADER_FILES convert_float_to_depth.frag full_screen_triangle.vert opengl_copy_bc4.comp - opengl_copy_bgra.comp opengl_present.frag opengl_present.vert pitch_unswizzle.comp diff --git a/src/video_core/host_shaders/opengl_copy_bgra.comp b/src/video_core/host_shaders/opengl_copy_bgra.comp deleted file mode 100644 index 2571a4abf..000000000 --- a/src/video_core/host_shaders/opengl_copy_bgra.comp +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2021 yuzu Emulator Project -// Licensed under GPLv2 or any later version -// Refer to the license.txt file included. - -#version 430 core - -layout (local_size_x = 4, local_size_y = 4) in; - -layout(binding = 0, rgba8) readonly uniform image2DArray bgr_input; -layout(binding = 1, rgba8) writeonly uniform image2DArray bgr_output; - -void main() { - vec4 color = imageLoad(bgr_input, ivec3(gl_GlobalInvocationID)); - imageStore(bgr_output, ivec3(gl_GlobalInvocationID), color.bgra); -} diff --git a/src/video_core/renderer_opengl/gl_texture_cache.cpp b/src/video_core/renderer_opengl/gl_texture_cache.cpp index b0aee6cc1..54dae2c41 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.cpp +++ b/src/video_core/renderer_opengl/gl_texture_cache.cpp @@ -461,7 +461,7 @@ bool TextureCacheRuntime::CanImageBeCopied(const Image& dst, const Image& src) { if (dst.info.type == ImageType::e3D && dst.info.format == PixelFormat::BC4_UNORM) { return false; } - if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { + if (IsPixelFormatBGR(dst.info.format) != IsPixelFormatBGR(src.info.format)) { return false; } return true; @@ -473,7 +473,7 @@ void TextureCacheRuntime::EmulateCopyImage(Image& dst, Image& src, ASSERT(src.info.type == ImageType::e3D); util_shaders.CopyBC4(dst, src, copies); } else if (IsPixelFormatBGR(dst.info.format) || IsPixelFormatBGR(src.info.format)) { - util_shaders.CopyBGR(dst, src, copies); + bgr_copy_pass.CopyBGR(dst, src, copies); } else { UNREACHABLE(); } @@ -1112,4 +1112,37 @@ Framebuffer::Framebuffer(TextureCacheRuntime& runtime, std::span<ImageView*, NUM framebuffer.handle = handle; } +void BGRCopyPass::CopyBGR(Image& dst_image, Image& src_image, + std::span<const VideoCommon::ImageCopy> copies) { + static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0}; + const u32 requested_pbo_size = + std::max(src_image.unswizzled_size_bytes, dst_image.unswizzled_size_bytes); + + if (bgr_pbo_size < requested_pbo_size) { + bgr_pbo.Create(); + bgr_pbo_size = requested_pbo_size; + glNamedBufferData(bgr_pbo.handle, bgr_pbo_size, nullptr, GL_STREAM_COPY); + } + for (const ImageCopy& copy : copies) { + ASSERT(copy.src_offset == zero_offset); + ASSERT(copy.dst_offset == zero_offset); + + // Copy from source to PBO + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width); + glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr_pbo.handle); + glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, + copy.src_subresource.num_layers, src_image.GlFormat(), + src_image.GlType(), static_cast<GLsizei>(bgr_pbo_size), nullptr); + + // Copy from PBO to destination in desired GL format + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width); + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr_pbo.handle); + glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, + copy.dst_subresource.num_layers, dst_image.GlFormat(), + dst_image.GlType(), nullptr); + } +} + } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/gl_texture_cache.h b/src/video_core/renderer_opengl/gl_texture_cache.h index 4a4f6301c..c498a8a8f 100644 --- a/src/video_core/renderer_opengl/gl_texture_cache.h +++ b/src/video_core/renderer_opengl/gl_texture_cache.h @@ -47,6 +47,19 @@ struct FormatProperties { bool is_compressed; }; +class BGRCopyPass { +public: + BGRCopyPass() = default; + ~BGRCopyPass() = default; + + void CopyBGR(Image& dst_image, Image& src_image, + std::span<const VideoCommon::ImageCopy> copies); + +private: + OGLBuffer bgr_pbo; + size_t bgr_pbo_size{}; +}; + class TextureCacheRuntime { friend Framebuffer; friend Image; @@ -118,6 +131,7 @@ private: const Device& device; StateTracker& state_tracker; UtilShaders util_shaders; + BGRCopyPass bgr_copy_pass; std::array<std::unordered_map<GLenum, FormatProperties>, 3> format_properties; bool has_broken_texture_view_formats = false; @@ -162,6 +176,14 @@ public: return texture.handle; } + GLuint GlFormat() const noexcept { + return gl_format; + } + + GLuint GlType() const noexcept { + return gl_type; + } + private: void CopyBufferToImage(const VideoCommon::BufferImageCopy& copy, size_t buffer_offset); diff --git a/src/video_core/renderer_opengl/maxwell_to_gl.h b/src/video_core/renderer_opengl/maxwell_to_gl.h index 672f94bfc..39158aa3e 100644 --- a/src/video_core/renderer_opengl/maxwell_to_gl.h +++ b/src/video_core/renderer_opengl/maxwell_to_gl.h @@ -52,7 +52,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB {GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT}, // BC6H_UFLOAT {GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT}, // BC6H_SFLOAT {GL_COMPRESSED_RGBA_ASTC_4x4_KHR}, // ASTC_2D_4X4_UNORM - {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_UNORM + {GL_RGBA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_UNORM {GL_RGBA32F, GL_RGBA, GL_FLOAT}, // R32G32B32A32_FLOAT {GL_RGBA32I, GL_RGBA_INTEGER, GL_INT}, // R32G32B32A32_SINT {GL_RG32F, GL_RG, GL_FLOAT}, // R32G32_FLOAT @@ -81,7 +81,7 @@ constexpr std::array<FormatTuple, VideoCore::Surface::MaxPixelFormat> FORMAT_TAB {GL_COMPRESSED_RGBA_ASTC_8x8_KHR}, // ASTC_2D_8X8_UNORM {GL_COMPRESSED_RGBA_ASTC_8x5_KHR}, // ASTC_2D_8X5_UNORM {GL_COMPRESSED_RGBA_ASTC_5x4_KHR}, // ASTC_2D_5X4_UNORM - {GL_SRGB8_ALPHA8, GL_RGBA, GL_UNSIGNED_BYTE}, // B8G8R8A8_SRGB + {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV}, // B8G8R8A8_SRGB {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT}, // BC1_RGBA_SRGB {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT}, // BC2_SRGB {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}, // BC3_SRGB diff --git a/src/video_core/renderer_opengl/util_shaders.cpp b/src/video_core/renderer_opengl/util_shaders.cpp index 333f35a1c..897c380b3 100644 --- a/src/video_core/renderer_opengl/util_shaders.cpp +++ b/src/video_core/renderer_opengl/util_shaders.cpp @@ -14,7 +14,6 @@ #include "video_core/host_shaders/block_linear_unswizzle_2d_comp.h" #include "video_core/host_shaders/block_linear_unswizzle_3d_comp.h" #include "video_core/host_shaders/opengl_copy_bc4_comp.h" -#include "video_core/host_shaders/opengl_copy_bgra_comp.h" #include "video_core/host_shaders/pitch_unswizzle_comp.h" #include "video_core/renderer_opengl/gl_shader_manager.h" #include "video_core/renderer_opengl/gl_shader_util.h" @@ -44,11 +43,6 @@ namespace { OGLProgram MakeProgram(std::string_view source) { return CreateProgram(source, GL_COMPUTE_SHADER); } - -size_t NumPixelsInCopy(const VideoCommon::ImageCopy& copy) { - return static_cast<size_t>(copy.extent.width * copy.extent.height * - copy.src_subresource.num_layers); -} } // Anonymous namespace UtilShaders::UtilShaders(ProgramManager& program_manager_) @@ -56,7 +50,6 @@ UtilShaders::UtilShaders(ProgramManager& program_manager_) block_linear_unswizzle_2d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_2D_COMP)), block_linear_unswizzle_3d_program(MakeProgram(BLOCK_LINEAR_UNSWIZZLE_3D_COMP)), pitch_unswizzle_program(MakeProgram(PITCH_UNSWIZZLE_COMP)), - copy_bgra_program(MakeProgram(OPENGL_COPY_BGRA_COMP)), copy_bc4_program(MakeProgram(OPENGL_COPY_BC4_COMP)) { const auto swizzle_table = Tegra::Texture::MakeSwizzleTable(); swizzle_table_buffer.Create(); @@ -255,43 +248,6 @@ void UtilShaders::CopyBC4(Image& dst_image, Image& src_image, std::span<const Im program_manager.RestoreGuestCompute(); } -void UtilShaders::CopyBGR(Image& dst_image, Image& src_image, - std::span<const VideoCommon::ImageCopy> copies) { - static constexpr GLuint BINDING_INPUT_IMAGE = 0; - static constexpr GLuint BINDING_OUTPUT_IMAGE = 1; - static constexpr VideoCommon::Offset3D zero_offset{0, 0, 0}; - const u32 bytes_per_block = BytesPerBlock(dst_image.info.format); - switch (bytes_per_block) { - case 2: - // BGR565 copy - for (const ImageCopy& copy : copies) { - ASSERT(copy.src_offset == zero_offset); - ASSERT(copy.dst_offset == zero_offset); - bgr_copy_pass.Execute(dst_image, src_image, copy); - } - break; - case 4: { - // BGRA8 copy - program_manager.BindComputeProgram(copy_bgra_program.handle); - constexpr GLenum FORMAT = GL_RGBA8; - for (const ImageCopy& copy : copies) { - ASSERT(copy.src_offset == zero_offset); - ASSERT(copy.dst_offset == zero_offset); - glBindImageTexture(BINDING_INPUT_IMAGE, src_image.StorageHandle(), - copy.src_subresource.base_level, GL_FALSE, 0, GL_READ_ONLY, FORMAT); - glBindImageTexture(BINDING_OUTPUT_IMAGE, dst_image.StorageHandle(), - copy.dst_subresource.base_level, GL_FALSE, 0, GL_WRITE_ONLY, FORMAT); - glDispatchCompute(copy.extent.width, copy.extent.height, copy.extent.depth); - } - program_manager.RestoreGuestCompute(); - break; - } - default: - UNREACHABLE(); - break; - } -} - GLenum StoreFormat(u32 bytes_per_block) { switch (bytes_per_block) { case 1: @@ -309,36 +265,4 @@ GLenum StoreFormat(u32 bytes_per_block) { return GL_R8UI; } -void Bgr565CopyPass::Execute(const Image& dst_image, const Image& src_image, - const ImageCopy& copy) { - if (CopyBufferCreationNeeded(copy)) { - CreateNewCopyBuffer(copy, GL_TEXTURE_2D_ARRAY, GL_RGB565); - } - // Copy from source to PBO - glPixelStorei(GL_PACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ROW_LENGTH, copy.extent.width); - glBindBuffer(GL_PIXEL_PACK_BUFFER, bgr16_pbo.handle); - glGetTextureSubImage(src_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, - copy.src_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, - static_cast<GLsizei>(bgr16_pbo_size), nullptr); - - // Copy from PBO to destination in reverse order - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_UNPACK_ROW_LENGTH, copy.extent.width); - glBindBuffer(GL_PIXEL_UNPACK_BUFFER, bgr16_pbo.handle); - glTextureSubImage3D(dst_image.Handle(), 0, 0, 0, 0, copy.extent.width, copy.extent.height, - copy.dst_subresource.num_layers, GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV, - nullptr); -} - -bool Bgr565CopyPass::CopyBufferCreationNeeded(const ImageCopy& copy) { - return bgr16_pbo_size < NumPixelsInCopy(copy) * sizeof(u16); -} - -void Bgr565CopyPass::CreateNewCopyBuffer(const ImageCopy& copy, GLenum target, GLuint format) { - bgr16_pbo.Create(); - bgr16_pbo_size = NumPixelsInCopy(copy) * sizeof(u16); - glNamedBufferData(bgr16_pbo.handle, bgr16_pbo_size, nullptr, GL_STREAM_COPY); -} - } // namespace OpenGL diff --git a/src/video_core/renderer_opengl/util_shaders.h b/src/video_core/renderer_opengl/util_shaders.h index ef881e35f..5de95ea7a 100644 --- a/src/video_core/renderer_opengl/util_shaders.h +++ b/src/video_core/renderer_opengl/util_shaders.h @@ -19,22 +19,6 @@ class ProgramManager; struct ImageBufferMap; -class Bgr565CopyPass { -public: - Bgr565CopyPass() = default; - ~Bgr565CopyPass() = default; - - void Execute(const Image& dst_image, const Image& src_image, - const VideoCommon::ImageCopy& copy); - -private: - [[nodiscard]] bool CopyBufferCreationNeeded(const VideoCommon::ImageCopy& copy); - void CreateNewCopyBuffer(const VideoCommon::ImageCopy& copy, GLenum target, GLuint format); - - OGLBuffer bgr16_pbo; - size_t bgr16_pbo_size{}; -}; - class UtilShaders { public: explicit UtilShaders(ProgramManager& program_manager); @@ -55,9 +39,6 @@ public: void CopyBC4(Image& dst_image, Image& src_image, std::span<const VideoCommon::ImageCopy> copies); - void CopyBGR(Image& dst_image, Image& src_image, - std::span<const VideoCommon::ImageCopy> copies); - private: ProgramManager& program_manager; @@ -67,10 +48,7 @@ private: OGLProgram block_linear_unswizzle_2d_program; OGLProgram block_linear_unswizzle_3d_program; OGLProgram pitch_unswizzle_program; - OGLProgram copy_bgra_program; OGLProgram copy_bc4_program; - - Bgr565CopyPass bgr_copy_pass; }; GLenum StoreFormat(u32 bytes_per_block); diff --git a/src/video_core/renderer_vulkan/renderer_vulkan.cpp b/src/video_core/renderer_vulkan/renderer_vulkan.cpp index 9ff0a28cd..74822814d 100644 --- a/src/video_core/renderer_vulkan/renderer_vulkan.cpp +++ b/src/video_core/renderer_vulkan/renderer_vulkan.cpp @@ -97,19 +97,14 @@ RendererVulkan::RendererVulkan(Core::TelemetrySession& telemetry_session_, Core::Frontend::EmuWindow& emu_window, Core::Memory::Memory& cpu_memory_, Tegra::GPU& gpu_, std::unique_ptr<Core::Frontend::GraphicsContext> context_) try - : RendererBase(emu_window, std::move(context_)), - telemetry_session(telemetry_session_), - cpu_memory(cpu_memory_), - gpu(gpu_), - library(OpenLibrary()), + : RendererBase(emu_window, std::move(context_)), telemetry_session(telemetry_session_), + cpu_memory(cpu_memory_), gpu(gpu_), library(OpenLibrary()), instance(CreateInstance(library, dld, VK_API_VERSION_1_1, render_window.GetWindowInfo().type, true, Settings::values.renderer_debug.GetValue())), debug_callback(Settings::values.renderer_debug ? CreateDebugCallback(instance) : nullptr), surface(CreateSurface(instance, render_window)), - device(CreateDevice(instance, dld, *surface)), - memory_allocator(device, false), - state_tracker(gpu), - scheduler(device, state_tracker), + device(CreateDevice(instance, dld, *surface)), memory_allocator(device, false), + state_tracker(gpu), scheduler(device, state_tracker), swapchain(*surface, device, scheduler, render_window.GetFramebufferLayout().width, render_window.GetFramebufferLayout().height, false), blit_screen(cpu_memory, render_window, device, memory_allocator, swapchain, scheduler, @@ -149,7 +144,7 @@ void RendererVulkan::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { const Layout::FramebufferLayout layout = render_window.GetFramebufferLayout(); swapchain.Create(layout.width, layout.height, is_srgb); }; - if (swapchain.IsSubOptimal() || swapchain.HasColorSpaceChanged(is_srgb)) { + if (swapchain.NeedsRecreation(is_srgb)) { recreate_swapchain(); } bool is_outdated; diff --git a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp index 7c0f91007..11cd41ad7 100644 --- a/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp +++ b/src/video_core/renderer_vulkan/vk_graphics_pipeline.cpp @@ -507,8 +507,9 @@ void GraphicsPipeline::MakePipeline(VkRenderPass render_pass) { vertex_attributes.push_back({ .location = static_cast<u32>(index), .binding = 0, - .format = type == 1 ? VK_FORMAT_R32_SFLOAT - : type == 2 ? VK_FORMAT_R32_SINT : VK_FORMAT_R32_UINT, + .format = type == 1 ? VK_FORMAT_R32_SFLOAT + : type == 2 ? VK_FORMAT_R32_SINT + : VK_FORMAT_R32_UINT, .offset = 0, }); } diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index bd22e4e83..85fc1712f 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h @@ -212,7 +212,6 @@ private: vk::CommandBuffer current_cmdbuf; std::unique_ptr<CommandChunk> chunk; - std::jthread worker_thread; State state; @@ -226,6 +225,7 @@ private: std::mutex work_mutex; std::condition_variable_any work_cv; std::condition_variable wait_cv; + std::jthread worker_thread; }; } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_swapchain.cpp b/src/video_core/renderer_vulkan/vk_swapchain.cpp index aadf03cb0..8972a6921 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.cpp +++ b/src/video_core/renderer_vulkan/vk_swapchain.cpp @@ -9,6 +9,7 @@ #include "common/assert.h" #include "common/logging/log.h" +#include "common/settings.h" #include "core/core.h" #include "core/frontend/framebuffer_layout.h" #include "video_core/renderer_vulkan/vk_scheduler.h" @@ -36,8 +37,19 @@ VkSurfaceFormatKHR ChooseSwapSurfaceFormat(vk::Span<VkSurfaceFormatKHR> formats) VkPresentModeKHR ChooseSwapPresentMode(vk::Span<VkPresentModeKHR> modes) { // Mailbox doesn't lock the application like fifo (vsync), prefer it - const auto found = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); - return found != modes.end() ? *found : VK_PRESENT_MODE_FIFO_KHR; + const auto found_mailbox = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_MAILBOX_KHR); + if (found_mailbox != modes.end()) { + return VK_PRESENT_MODE_MAILBOX_KHR; + } + if (Settings::values.disable_fps_limit.GetValue()) { + // FIFO present mode locks the framerate to the monitor's refresh rate, + // Find an alternative to surpass this limitation if FPS is unlocked. + const auto found_imm = std::find(modes.begin(), modes.end(), VK_PRESENT_MODE_IMMEDIATE_KHR); + if (found_imm != modes.end()) { + return VK_PRESENT_MODE_IMMEDIATE_KHR; + } + } + return VK_PRESENT_MODE_FIFO_KHR; } VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 width, u32 height) { @@ -143,7 +155,7 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, const auto present_modes{physical_device.GetSurfacePresentModesKHR(surface)}; const VkSurfaceFormatKHR surface_format{ChooseSwapSurfaceFormat(formats)}; - const VkPresentModeKHR present_mode{ChooseSwapPresentMode(present_modes)}; + present_mode = ChooseSwapPresentMode(present_modes); u32 requested_image_count{capabilities.minImageCount + 1}; if (capabilities.maxImageCount > 0 && requested_image_count > capabilities.maxImageCount) { @@ -196,6 +208,7 @@ void VKSwapchain::CreateSwapchain(const VkSurfaceCapabilitiesKHR& capabilities, extent = swapchain_ci.imageExtent; current_srgb = srgb; + current_fps_unlocked = Settings::values.disable_fps_limit.GetValue(); images = swapchain.GetImages(); image_count = static_cast<u32>(images.size()); @@ -248,4 +261,14 @@ void VKSwapchain::Destroy() { swapchain.reset(); } +bool VKSwapchain::HasFpsUnlockChanged() const { + return current_fps_unlocked != Settings::values.disable_fps_limit.GetValue(); +} + +bool VKSwapchain::NeedsPresentModeUpdate() const { + // Mailbox present mode is the ideal for all scenarios. If it is not available, + // A different present mode is needed to support unlocked FPS above the monitor's refresh rate. + return present_mode != VK_PRESENT_MODE_MAILBOX_KHR && HasFpsUnlockChanged(); +} + } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_swapchain.h b/src/video_core/renderer_vulkan/vk_swapchain.h index 5bce41e21..61a6d959e 100644 --- a/src/video_core/renderer_vulkan/vk_swapchain.h +++ b/src/video_core/renderer_vulkan/vk_swapchain.h @@ -33,6 +33,11 @@ public: /// Presents the rendered image to the swapchain. void Present(VkSemaphore render_semaphore); + /// Returns true when the swapchain needs to be recreated. + bool NeedsRecreation(bool is_srgb) const { + return HasColorSpaceChanged(is_srgb) || IsSubOptimal() || NeedsPresentModeUpdate(); + } + /// Returns true when the color space has changed. bool HasColorSpaceChanged(bool is_srgb) const { return current_srgb != is_srgb; @@ -84,6 +89,10 @@ private: void Destroy(); + bool HasFpsUnlockChanged() const; + + bool NeedsPresentModeUpdate() const; + const VkSurfaceKHR surface; const Device& device; VKScheduler& scheduler; @@ -102,8 +111,10 @@ private: VkFormat image_view_format{}; VkExtent2D extent{}; + VkPresentModeKHR present_mode{}; bool current_srgb{}; + bool current_fps_unlocked{}; bool is_outdated{}; bool is_suboptimal{}; }; diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index ff979a7ac..3b87640b5 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -127,7 +127,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array<float, 4>& color) { const auto format_info = MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format); VkImageCreateFlags flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; if (info.type == ImageType::e2D && info.resources.layers >= 6 && - info.size.width == info.size.height) { + info.size.width == info.size.height && !device.HasBrokenCubeImageCompability()) { flags |= VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT; } if (info.type == ImageType::e3D) { diff --git a/src/video_core/texture_cache/slot_vector.h b/src/video_core/texture_cache/slot_vector.h index 74cd3c9d8..50df06409 100644 --- a/src/video_core/texture_cache/slot_vector.h +++ b/src/video_core/texture_cache/slot_vector.h @@ -31,8 +31,8 @@ struct SlotId { }; template <class T> -requires std::is_nothrow_move_assignable_v<T>&& - std::is_nothrow_move_constructible_v<T> class SlotVector { +requires std::is_nothrow_move_assignable_v<T> && std::is_nothrow_move_constructible_v<T> +class SlotVector { public: class Iterator { friend SlotVector<T>; diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cpp index c2ec9f76a..6388ed2eb 100644 --- a/src/video_core/vulkan_common/vulkan_device.cpp +++ b/src/video_core/vulkan_common/vulkan_device.cpp @@ -588,22 +588,27 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR ext_extended_dynamic_state = false; } } - sets_per_pool = 64; - if (driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE) { + + const bool is_amd = + driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; + if (is_amd) { // AMD drivers need a higher amount of Sets per Pool in certain circunstances like in XC2. sets_per_pool = 96; - } - - const bool is_amd = driver_id == VK_DRIVER_ID_AMD_PROPRIETARY || - driver_id == VK_DRIVER_ID_MESA_RADV || - driver_id == VK_DRIVER_ID_AMD_OPEN_SOURCE; - if (ext_sampler_filter_minmax && is_amd) { - // Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken. + // Disable VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT on AMD GCN4 and lower as it is broken. if (!is_float16_supported) { LOG_WARNING( Render_Vulkan, - "Blacklisting AMD GCN4 and lower for VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME"); + "AMD GCN4 and earlier do not properly support VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT"); + has_broken_cube_compatibility = true; + } + } + const bool is_amd_or_radv = is_amd || driver_id == VK_DRIVER_ID_MESA_RADV; + if (ext_sampler_filter_minmax && is_amd_or_radv) { + // Disable ext_sampler_filter_minmax on AMD GCN4 and lower as it is broken. + if (!is_float16_supported) { + LOG_WARNING(Render_Vulkan, + "Blacklisting AMD GCN4 and earlier for VK_EXT_sampler_filter_minmax"); ext_sampler_filter_minmax = false; } } diff --git a/src/video_core/vulkan_common/vulkan_device.h b/src/video_core/vulkan_common/vulkan_device.h index bc180a32a..d9e74f1aa 100644 --- a/src/video_core/vulkan_common/vulkan_device.h +++ b/src/video_core/vulkan_common/vulkan_device.h @@ -309,6 +309,11 @@ public: return has_renderdoc || has_nsight_graphics; } + /// Returns true when the device does not properly support cube compatibility. + bool HasBrokenCubeImageCompability() const { + return has_broken_cube_compatibility; + } + /// Returns the vendor name reported from Vulkan. std::string_view GetVendorName() const { return vendor_name; @@ -417,6 +422,7 @@ private: bool ext_conservative_rasterization{}; ///< Support for VK_EXT_conservative_rasterization. bool ext_provoking_vertex{}; ///< Support for VK_EXT_provoking_vertex. bool nv_device_diagnostics_config{}; ///< Support for VK_NV_device_diagnostics_config. + bool has_broken_cube_compatibility{}; ///< Has broken cube compatiblity bit bool has_renderdoc{}; ///< Has RenderDoc attached bool has_nsight_graphics{}; ///< Has Nsight Graphics attached diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index 27b67fd9e..b5796a8fc 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp @@ -562,7 +562,11 @@ void Config::ReadControlValues() { ReadTouchscreenValues(); ReadMotionTouchValues(); +#ifdef _WIN32 ReadBasicSetting(Settings::values.enable_raw_input); +#else + Settings::values.enable_raw_input = false; +#endif ReadBasicSetting(Settings::values.emulate_analog_keyboard); Settings::values.mouse_panning = false; ReadBasicSetting(Settings::values.mouse_panning_sensitivity); diff --git a/src/yuzu/configuration/configure_debug.ui b/src/yuzu/configuration/configure_debug.ui index 3fe9ff7de..b884a56b0 100644 --- a/src/yuzu/configuration/configure_debug.ui +++ b/src/yuzu/configuration/configure_debug.ui @@ -2,85 +2,55 @@ <ui version="4.0"> <class>ConfigureDebug</class> <widget class="QWidget" name="ConfigureDebug"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>400</width> - <height>777</height> - </rect> - </property> - <property name="windowTitle"> - <string>Form</string> - </property> <layout class="QVBoxLayout" name="verticalLayout_1"> <item> <widget class="QGroupBox" name="groupBox_2"> <property name="title"> <string>Logging</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <item> - <widget class="QLabel" name="label_1"> - <property name="text"> - <string>Global Log Filter</string> + <layout class="QGridLayout" name="gridLayout_1"> + <item row="0" column="0" colspan="2"> + <layout class="QHBoxLayout" name="horizontalLayout_1"> + <item> + <widget class="QLabel" name="label_1"> + <property name="text"> + <string>Global Log Filter</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="log_filter_edit"/> + </item> + </layout> + </item> + <item row="1" column="0"> + <widget class="QCheckBox" name="toggle_console"> + <property name="text"> + <string>Show Log in Console</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QPushButton" name="open_log_button"> + <property name="text"> + <string>Open Log Location</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QCheckBox" name="extended_logging"> + <property name="enabled"> + <bool>true</bool> </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="log_filter_edit"/> - </item> - </layout> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <widget class="QCheckBox" name="toggle_console"> - <property name="text"> - <string>Show Log in Console</string> + <property name="toolTip"> + <string>When checked, the max size of the log increases from 100 MB to 1 GB</string> </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="open_log_button"> <property name="text"> - <string>Open Log Location</string> + <string>Enable Extended Logging**</string> </property> - </widget> - </item> - </layout> - </item> - <item> - <widget class="QCheckBox" name="extended_logging"> - <property name="enabled"> - <bool>true</bool> - </property> - <property name="toolTip"> - <string>When checked, the max size of the log increases from 100 MB to 1 GB</string> - </property> - <property name="text"> - <string>Enable Extended Logging</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_2"> - <property name="font"> - <font> - <italic>true</italic> - </font> - </property> - <property name="text"> - <string>This will be reset automatically when yuzu closes.</string> - </property> - <property name="indent"> - <number>20</number> - </property> - </widget> - </item> - </layout> + </widget> + </item> + </layout> </widget> </item> <item> @@ -111,7 +81,7 @@ <property name="title"> <string>Graphics</string> </property> - <layout class="QGridLayout" name="gridLayout_3"> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0"> <widget class="QCheckBox" name="enable_graphics_debugging"> <property name="enabled"> @@ -176,33 +146,18 @@ <property name="title"> <string>Debugging</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_7"> - <item> + <layout class="QGridLayout" name="gridLayout_3"> + <item row="0" column="0"> <widget class="QCheckBox" name="fs_access_log"> <property name="text"> <string>Enable FS Access Log</string> </property> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QCheckBox" name="reporting_services"> <property name="text"> - <string>Enable Verbose Reporting Services</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_4"> - <property name="font"> - <font> - <italic>true</italic> - </font> - </property> - <property name="text"> - <string>This will be reset automatically when yuzu closes.</string> - </property> - <property name="indent"> - <number>20</number> + <string>Enable Verbose Reporting Services**</string> </property> </widget> </item> @@ -214,47 +169,32 @@ <property name="title"> <string>Advanced</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> + <layout class="QGridLayout" name="gridLayout_4"> + <item> row="0" column="0"> <widget class="QCheckBox" name="quest_flag"> <property name="text"> <string>Kiosk (Quest) Mode</string> </property> </widget> </item> - <item> + <item row="1" column="0"> <widget class="QCheckBox" name="enable_cpu_debugging"> <property name="text"> <string>Enable CPU Debugging</string> </property> </widget> </item> - <item> + <item row="2" column="0"> <widget class="QCheckBox" name="use_debug_asserts"> <property name="text"> <string>Enable Debug Asserts</string> </property> </widget> </item> - <item> + <item row="0" column="1"> <widget class="QCheckBox" name="use_auto_stub"> <property name="text"> - <string>Enable Auto-Stub</string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_5"> - <property name="font"> - <font> - <italic>true</italic> - </font> - </property> - <property name="text"> - <string>This will be reset automatically when yuzu closes.</string> - </property> - <property name="indent"> - <number>20</number> + <string>Enable Auto-Stub**</string> </property> </widget> </item> @@ -262,20 +202,19 @@ </widget> </item> <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> + <widget class="QLabel" name="label_5"> + <property name="font"> + <font> + <italic>true</italic> + </font> </property> - <property name="sizeType"> - <enum>QSizePolicy::Expanding</enum> + <property name="text"> + <string>**This will be reset automatically when yuzu closes.</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> + <property name="indent"> + <number>20</number> </property> - </spacer> + </widget> </item> </layout> </widget> diff --git a/src/yuzu/configuration/configure_input_advanced.cpp b/src/yuzu/configuration/configure_input_advanced.cpp index d20fd86b6..b30f09013 100644 --- a/src/yuzu/configuration/configure_input_advanced.cpp +++ b/src/yuzu/configuration/configure_input_advanced.cpp @@ -88,6 +88,10 @@ ConfigureInputAdvanced::ConfigureInputAdvanced(QWidget* parent) connect(ui->buttonMotionTouch, &QPushButton::clicked, this, &ConfigureInputAdvanced::CallMotionTouchConfigDialog); +#ifndef _WIN32 + ui->enable_raw_input->setVisible(false); +#endif + LoadConfiguration(); } diff --git a/src/yuzu/configuration/configure_profile_manager.cpp b/src/yuzu/configuration/configure_profile_manager.cpp index ac849b01d..136614bf8 100644 --- a/src/yuzu/configuration/configure_profile_manager.cpp +++ b/src/yuzu/configuration/configure_profile_manager.cpp @@ -76,7 +76,7 @@ QString GetProfileUsernameFromUser(QWidget* parent, const QString& description_t } } // Anonymous namespace -ConfigureProfileManager ::ConfigureProfileManager(QWidget* parent) +ConfigureProfileManager::ConfigureProfileManager(QWidget* parent) : QWidget(parent), ui(new Ui::ConfigureProfileManager), profile_manager(std::make_unique<Service::Account::ProfileManager>()) { ui->setupUi(this); diff --git a/src/yuzu/configuration/configure_tas.ui b/src/yuzu/configuration/configure_tas.ui index 8a3ecb834..95575ed9d 100644 --- a/src/yuzu/configuration/configure_tas.ui +++ b/src/yuzu/configuration/configure_tas.ui @@ -2,37 +2,23 @@ <ui version="4.0"> <class>ConfigureTas</class> <widget class="QDialog" name="ConfigureTas"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>800</width> - <height>300</height> - </rect> - </property> - <property name="windowTitle"> - <string>Dialog</string> - </property> <layout class="QVBoxLayout" name="verticalLayout_1"> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_1"> <item> - <widget class="QGroupBox" name="groupBox"> + <widget class="QGroupBox" name="groupBox_1"> <property name="title"> <string>TAS</string> </property> - <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0" colspan="1"> + <layout class="QGridLayout" name="gridLayout_1"> + <item row="0" column="0" colspan="4"> <widget class="QLabel" name="label_1"> <property name="text"> - <string>Reads controller input from scripts in the same format as TAS-nx scripts. For a more detailed explanation please consult the FAQ on the yuzu website.</string> - </property> - <property name="wordWrap"> - <bool>true</bool> + <string>Reads controller input from scripts in the same format as TAS-nx scripts.<br/>For a more detailed explanation please consult the FAQ on the yuzu website.</string> </property> </widget> </item> - <item row="1" column="0" colspan="1"> + <item row="1" column="0" colspan="4"> <widget class="QLabel" name="label_2"> <property name="text"> <string>To check which hotkeys control the playback/recording, please refer to the Hotkey settings (General -> Hotkeys).</string> @@ -42,10 +28,10 @@ </property> </widget> </item> - <item row="2" column="0" colspan="1"> - <widget class="QLabel" name="label_2"> + <item row="2" column="0" colspan="4"> + <widget class="QLabel" name="label_3"> <property name="text"> - <string>WARNING: This is an experimental feature. It will not play back scripts frame perfectly with the current, imperfect syncing method.</string> + <string>WARNING: This is an experimental feature.<br/>It will not play back scripts frame perfectly with the current, imperfect syncing method.</string> </property> <property name="wordWrap"> <bool>true</bool> @@ -58,13 +44,13 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> <item> - <widget class="QGroupBox" name="groupBox"> + <widget class="QGroupBox" name="groupBox_2"> <property name="title"> <string>Settings</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_2"> <item row="0" column="0" colspan="4"> <widget class="QCheckBox" name="tas_enable"> <property name="text"> @@ -102,15 +88,15 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_3"> <item> - <widget class="QGroupBox" name="groupBox"> + <widget class="QGroupBox" name="groupBox_3"> <property name="title"> <string>Script Directory</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_4"> <property name="text"> <string>Path</string> </property> @@ -126,22 +112,6 @@ <item row="0" column="2"> <widget class="QLineEdit" name="tas_path_edit"/> </item> - <item row="0" column="1"> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Maximum</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>60</width> - <height>20</height> - </size> - </property> - </spacer> - </item> </layout> </widget> </item> |