diff options
Diffstat (limited to 'src')
28 files changed, 373 insertions, 95 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index 2d4d2e9e7..4575df24d 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -212,6 +212,7 @@ void DebuggerBackend::Write(const Entry& entry) { SUB(Service, ARP) \ SUB(Service, BCAT) \ SUB(Service, BPC) \ + SUB(Service, BGTC) \ SUB(Service, BTDRV) \ SUB(Service, BTM) \ SUB(Service, Capture) \ diff --git a/src/common/logging/log.h b/src/common/logging/log.h index 835894918..3d7b7dab7 100644 --- a/src/common/logging/log.h +++ b/src/common/logging/log.h @@ -66,6 +66,7 @@ enum class Class : ClassType { Service_ARP, ///< The ARP service Service_Audio, ///< The Audio (Audio control) service Service_BCAT, ///< The BCAT service + Service_BGTC, ///< The BGTC (Background Task Controller) service Service_BPC, ///< The BPC service Service_BTDRV, ///< The Bluetooth driver service Service_BTM, ///< The BTM service diff --git a/src/common/threadsafe_queue.h b/src/common/threadsafe_queue.h index a4647314a..ad04df8ca 100644 --- a/src/common/threadsafe_queue.h +++ b/src/common/threadsafe_queue.h @@ -83,11 +83,15 @@ public: return true; } - T PopWait() { + void Wait() { if (Empty()) { std::unique_lock lock{cv_mutex}; cv.wait(lock, [this]() { return !Empty(); }); } + } + + T PopWait() { + Wait(); T t; Pop(t); return t; @@ -156,6 +160,10 @@ public: return spsc_queue.Pop(t); } + void Wait() { + spsc_queue.Wait(); + } + T PopWait() { return spsc_queue.PopWait(); } diff --git a/src/core/core.cpp b/src/core/core.cpp index 305f56ff1..56b47e671 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -296,7 +296,7 @@ struct System::Impl { exit_lock = false; if (gpu_core) { - gpu_core->WaitIdle(); + gpu_core->ShutDown(); } services.reset(); diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h index f595b9a5c..70d6bfcee 100644 --- a/src/core/hle/kernel/k_scheduler.h +++ b/src/core/hle/kernel/k_scheduler.h @@ -198,9 +198,9 @@ private: Common::SpinLock guard{}; }; -class KScopedSchedulerLock : KScopedLock<GlobalSchedulerContext::LockType> { +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 d7cc557b2..72c3b0252 100644 --- a/src/core/hle/kernel/k_scoped_lock.h +++ b/src/core/hle/kernel/k_scoped_lock.h @@ -20,19 +20,22 @@ concept KLockable = !std::is_reference_v<T> && requires(T & t) { }; template <typename T> -requires KLockable<T> class 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(); } KScopedLock(const KScopedLock&) = delete; - KScopedLock(KScopedLock&&) = delete; + KScopedLock& operator=(const KScopedLock&) = delete; + + KScopedLock(KScopedLock &&) = delete; + KScopedLock& operator=(KScopedLock&&) = delete; private: T* lock_ptr; 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 f8189e107..ebecf0c77 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 @@ -15,9 +15,9 @@ namespace Kernel { -class KScopedSchedulerLockAndSleep { +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/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 5b6c7792e..a1520e147 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -143,10 +143,10 @@ struct KernelCore::Impl { ASSERT(system_resource_limit->SetLimitValue(LimitableResource::PhysicalMemory, 0x100000000) .IsSuccess()); ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Threads, 800).IsSuccess()); - ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 700).IsSuccess()); + ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Events, 900).IsSuccess()); ASSERT(system_resource_limit->SetLimitValue(LimitableResource::TransferMemory, 200) .IsSuccess()); - ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 933).IsSuccess()); + ASSERT(system_resource_limit->SetLimitValue(LimitableResource::Sessions, 1133).IsSuccess()); // Derived from recent software updates. The kernel reserves 27MB constexpr u64 kernel_size{0x1b00000}; diff --git a/src/core/hle/service/aoc/aoc_u.cpp b/src/core/hle/service/aoc/aoc_u.cpp index 8d657c0bf..0f51e5871 100644 --- a/src/core/hle/service/aoc/aoc_u.cpp +++ b/src/core/hle/service/aoc/aoc_u.cpp @@ -118,8 +118,10 @@ AOC_U::AOC_U(Core::System& system_) {7, &AOC_U::PrepareAddOnContent, "PrepareAddOnContent"}, {8, &AOC_U::GetAddOnContentListChangedEvent, "GetAddOnContentListChangedEvent"}, {9, nullptr, "GetAddOnContentLostErrorCode"}, + {10, nullptr, "GetAddOnContentListChangedEventWithProcessId"}, {100, &AOC_U::CreateEcPurchasedEventManager, "CreateEcPurchasedEventManager"}, {101, &AOC_U::CreatePermanentEcPurchasedEventManager, "CreatePermanentEcPurchasedEventManager"}, + {110, nullptr, "CreateContentsServiceManager"}, }; // clang-format on diff --git a/src/core/hle/service/btdrv/btdrv.cpp b/src/core/hle/service/btdrv/btdrv.cpp index 17a2ac899..af3a5842d 100644 --- a/src/core/hle/service/btdrv/btdrv.cpp +++ b/src/core/hle/service/btdrv/btdrv.cpp @@ -156,6 +156,25 @@ public: {97, nullptr, "RegisterBleHidEvent"}, {98, nullptr, "SetBleScanParameter"}, {99, nullptr, "MoveToSecondaryPiconet"}, + {100, nullptr, "IsBluetoothEnabled"}, + {128, nullptr, "AcquireAudioEvent"}, + {129, nullptr, "GetAudioEventInfo"}, + {130, nullptr, "OpenAudioConnection"}, + {131, nullptr, "CloseAudioConnection"}, + {132, nullptr, "OpenAudioOut"}, + {133, nullptr, "CloseAudioOut"}, + {134, nullptr, "AcquireAudioOutStateChangedEvent"}, + {135, nullptr, "StartAudioOut"}, + {136, nullptr, "StopAudioOut"}, + {137, nullptr, "GetAudioOutState"}, + {138, nullptr, "GetAudioOutFeedingCodec"}, + {139, nullptr, "GetAudioOutFeedingParameter"}, + {140, nullptr, "AcquireAudioOutBufferAvailableEvent"}, + {141, nullptr, "SendAudioData"}, + {142, nullptr, "AcquireAudioControlInputStateChangedEvent"}, + {143, nullptr, "GetAudioControlInputState"}, + {144, nullptr, "AcquireAudioConnectionStateChangedEvent"}, + {145, nullptr, "GetConnectedAudioDevice"}, {256, nullptr, "IsManufacturingMode"}, {257, nullptr, "EmulateBluetoothCrash"}, {258, nullptr, "GetBleChannelMap"}, diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 9cf2ee92a..d1ebc2388 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -223,6 +223,7 @@ public: {10, nullptr, "GetGattClientDisconnectionReason"}, {11, nullptr, "GetBleConnectionParameter"}, {12, nullptr, "GetBleConnectionParameterRequest"}, + {13, nullptr, "Unknown13"}, }; // clang-format on diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 4924c61c3..c767926a4 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp @@ -16,7 +16,7 @@ public: // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "SubmitContext"}, - {1, nullptr, "CreateReport"}, + {1, nullptr, "CreateReportV0"}, {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, {4, nullptr, "UpdatePowerOnTime"}, @@ -26,6 +26,11 @@ public: {8, nullptr, "ClearApplicationLaunchTime"}, {9, nullptr, "SubmitAttachment"}, {10, nullptr, "CreateReportWithAttachments"}, + {11, nullptr, "CreateReport"}, + {20, nullptr, "RegisterRunningApplet"}, + {21, nullptr, "UnregisterRunningApplet"}, + {22, nullptr, "UpdateAppletSuspendedDuration"}, + {30, nullptr, "InvalidateForcedShutdownDetection"}, }; // clang-format on diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index 0a6621ef2..a35979053 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -38,7 +38,7 @@ public: {10600, nullptr, "DeclareOpenOnlinePlaySession"}, {10601, &IFriendService::DeclareCloseOnlinePlaySession, "DeclareCloseOnlinePlaySession"}, {10610, &IFriendService::UpdateUserPresence, "UpdateUserPresence"}, - {10700, nullptr, "GetPlayHistoryRegistrationKey"}, + {10700, &IFriendService::GetPlayHistoryRegistrationKey, "GetPlayHistoryRegistrationKey"}, {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, {10702, nullptr, "AddPlayHistory"}, {11000, nullptr, "GetProfileImageUrl"}, @@ -153,6 +153,18 @@ private: rb.Push(RESULT_SUCCESS); } + void GetPlayHistoryRegistrationKey(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto local_play = rp.Pop<bool>(); + const auto uuid = rp.PopRaw<Common::UUID>(); + + LOG_WARNING(Service_Friend, "(STUBBED) called local_play={} uuid={}", local_play, + uuid.Format()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); + } + void GetFriendList(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto friend_offset = rp.Pop<u32>(); diff --git a/src/core/hle/service/glue/bgtc.cpp b/src/core/hle/service/glue/bgtc.cpp index a478b68e1..daecfff15 100644 --- a/src/core/hle/service/glue/bgtc.cpp +++ b/src/core/hle/service/glue/bgtc.cpp @@ -2,6 +2,9 @@ // Licensed under GPLv2 or any later version // 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/service/glue/bgtc.h" namespace Service::Glue { @@ -9,6 +12,26 @@ namespace Service::Glue { BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { // clang-format off static const FunctionInfo functions[] = { + {100, &BGTC_T::OpenTaskService, "OpenTaskService"}, + }; + // clang-format on + + RegisterHandlers(functions); +} + +BGTC_T::~BGTC_T() = default; + +void BGTC_T::OpenTaskService(Kernel::HLERequestContext& ctx) { + LOG_DEBUG(Service_BGTC, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(RESULT_SUCCESS); + rb.PushIpcInterface<ITaskService>(system); +} + +ITaskService::ITaskService(Core::System& system_) : ServiceFramework{system_, "ITaskService"} { + // clang-format off + static const FunctionInfo functions[] = { {1, nullptr, "NotifyTaskStarting"}, {2, nullptr, "NotifyTaskFinished"}, {3, nullptr, "GetTriggerEvent"}, @@ -20,16 +43,18 @@ BGTC_T::BGTC_T(Core::System& system_) : ServiceFramework{system_, "bgtc:t"} { {13, nullptr, "UnscheduleTask"}, {14, nullptr, "GetScheduleEvent"}, {15, nullptr, "SchedulePeriodicTask"}, + {16, nullptr, "Unknown16"}, {101, nullptr, "GetOperationMode"}, {102, nullptr, "WillDisconnectNetworkWhenEnteringSleep"}, {103, nullptr, "WillStayHalfAwakeInsteadSleep"}, + {200, nullptr, "Unknown200"}, }; // clang-format on RegisterHandlers(functions); } -BGTC_T::~BGTC_T() = default; +ITaskService::~ITaskService() = default; BGTC_SC::BGTC_SC(Core::System& system_) : ServiceFramework{system_, "bgtc:sc"} { // clang-format off diff --git a/src/core/hle/service/glue/bgtc.h b/src/core/hle/service/glue/bgtc.h index 906116ba6..4c0142fd5 100644 --- a/src/core/hle/service/glue/bgtc.h +++ b/src/core/hle/service/glue/bgtc.h @@ -16,6 +16,14 @@ class BGTC_T final : public ServiceFramework<BGTC_T> { public: explicit BGTC_T(Core::System& system_); ~BGTC_T() override; + + void OpenTaskService(Kernel::HLERequestContext& ctx); +}; + +class ITaskService final : public ServiceFramework<ITaskService> { +public: + explicit ITaskService(Core::System& system_); + ~ITaskService() override; }; class BGTC_SC final : public ServiceFramework<BGTC_SC> { diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index 1df62f98e..673db68c7 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -1138,6 +1138,10 @@ void Controller_NPad::SetUnintendedHomeButtonInputProtectionEnabled(bool is_prot unintended_home_button_input_protection[NPadIdToIndex(npad_id)] = is_protection_enabled; } +void Controller_NPad::SetAnalogStickUseCenterClamp(bool use_center_clamp) { + analog_stick_use_center_clamp = use_center_clamp; +} + void Controller_NPad::ClearAllConnectedControllers() { for (auto& controller : connected_controllers) { if (controller.is_connected && controller.type != NPadControllerType::None) { diff --git a/src/core/hle/service/hid/controllers/npad.h b/src/core/hle/service/hid/controllers/npad.h index bc2e6779d..873a0a1e2 100644 --- a/src/core/hle/service/hid/controllers/npad.h +++ b/src/core/hle/service/hid/controllers/npad.h @@ -219,6 +219,7 @@ public: LedPattern GetLedPattern(u32 npad_id); bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const; void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id); + void SetAnalogStickUseCenterClamp(bool use_center_clamp); void ClearAllConnectedControllers(); void DisconnectAllConnectedControllers(); void ConnectAllDisconnectedControllers(); @@ -577,6 +578,7 @@ private: std::array<std::array<bool, 2>, 10> vibration_devices_mounted{}; std::array<ControllerHolder, 10> connected_controllers{}; std::array<bool, 10> unintended_home_button_input_protection{}; + bool analog_stick_use_center_clamp{}; GyroscopeZeroDriftMode gyroscope_zero_drift_mode{GyroscopeZeroDriftMode::Standard}; bool sixaxis_sensors_enabled{true}; f32 sixaxis_fusion_parameter1{}; diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index ba27bbb05..a1a779cc0 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -263,7 +263,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} { {131, &Hid::IsUnintendedHomeButtonInputProtectionEnabled, "IsUnintendedHomeButtonInputProtectionEnabled"}, {132, &Hid::EnableUnintendedHomeButtonInputProtection, "EnableUnintendedHomeButtonInputProtection"}, {133, nullptr, "SetNpadJoyAssignmentModeSingleWithDestination"}, - {134, nullptr, "SetNpadAnalogStickUseCenterClamp"}, + {134, &Hid::SetNpadAnalogStickUseCenterClamp, "SetNpadAnalogStickUseCenterClamp"}, {135, nullptr, "SetNpadCaptureButtonAssignment"}, {136, nullptr, "ClearNpadCaptureButtonAssignment"}, {200, &Hid::GetVibrationDeviceInfo, "GetVibrationDeviceInfo"}, @@ -278,6 +278,7 @@ Hid::Hid(Core::System& system_) : ServiceFramework{system_, "hid"} { {209, &Hid::BeginPermitVibrationSession, "BeginPermitVibrationSession"}, {210, &Hid::EndPermitVibrationSession, "EndPermitVibrationSession"}, {211, &Hid::IsVibrationDeviceMounted, "IsVibrationDeviceMounted"}, + {212, nullptr, "SendVibrationValueInBool"}, {300, &Hid::ActivateConsoleSixAxisSensor, "ActivateConsoleSixAxisSensor"}, {301, &Hid::StartConsoleSixAxisSensor, "StartConsoleSixAxisSensor"}, {302, &Hid::StopConsoleSixAxisSensor, "StopConsoleSixAxisSensor"}, @@ -1087,6 +1088,27 @@ void Hid::EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& c rb.Push(RESULT_SUCCESS); } +void Hid::SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + struct Parameters { + bool analog_stick_use_center_clamp; + u64 applet_resource_user_id; + }; + static_assert(sizeof(Parameters) == 0x10, "Parameters has incorrect size."); + + const auto parameters{rp.PopRaw<Parameters>()}; + + applet_resource->GetController<Controller_NPad>(HidController::NPad) + .SetAnalogStickUseCenterClamp(parameters.analog_stick_use_center_clamp); + + LOG_WARNING(Service_HID, + "(STUBBED) called, analog_stick_use_center_clamp={}, applet_resource_user_id={}", + parameters.analog_stick_use_center_clamp, parameters.applet_resource_user_id); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(RESULT_SUCCESS); +} + void Hid::GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto vibration_device_handle{rp.PopRaw<Controller_NPad::DeviceHandle>()}; @@ -1553,6 +1575,7 @@ public: {11, nullptr, "SetTouchScreenAutoPilotState"}, {12, nullptr, "UnsetTouchScreenAutoPilotState"}, {13, nullptr, "GetTouchScreenConfiguration"}, + {14, nullptr, "ProcessTouchScreenAutoTune"}, {20, nullptr, "DeactivateMouse"}, {21, nullptr, "SetMouseAutoPilotState"}, {22, nullptr, "UnsetMouseAutoPilotState"}, @@ -1562,6 +1585,7 @@ public: {50, nullptr, "DeactivateXpad"}, {51, nullptr, "SetXpadAutoPilotState"}, {52, nullptr, "UnsetXpadAutoPilotState"}, + {53, nullptr, "DeactivateJoyXpad"}, {60, nullptr, "ClearNpadSystemCommonPolicy"}, {61, nullptr, "DeactivateNpad"}, {62, nullptr, "ForceDisconnectNpad"}, @@ -1632,6 +1656,11 @@ public: {244, nullptr, "RequestKuinaFirmwareVersion"}, {245, nullptr, "GetKuinaFirmwareVersion"}, {246, nullptr, "GetVidPid"}, + {247, nullptr, "GetAnalogStickCalibrationValue"}, + {248, nullptr, "GetUniquePadIdsFull"}, + {249, nullptr, "ConnectUniquePad"}, + {250, nullptr, "IsVirtual"}, + {251, nullptr, "GetAnalogStickModuleParam"}, {301, nullptr, "GetAbstractedPadHandles"}, {302, nullptr, "GetAbstractedPadState"}, {303, nullptr, "GetAbstractedPadsState"}, @@ -1652,12 +1681,16 @@ public: {401, nullptr, "DisableRailDeviceFiltering"}, {402, nullptr, "EnableWiredPairing"}, {403, nullptr, "EnableShipmentModeAutoClear"}, + {404, nullptr, "SetRailEnabled"}, {500, nullptr, "SetFactoryInt"}, {501, nullptr, "IsFactoryBootEnabled"}, {550, nullptr, "SetAnalogStickModelDataTemporarily"}, {551, nullptr, "GetAnalogStickModelData"}, {552, nullptr, "ResetAnalogStickModelData"}, {600, nullptr, "ConvertPadState"}, + {650, nullptr, "AddButtonPlayData"}, + {651, nullptr, "StartButtonPlayData"}, + {652, nullptr, "StopButtonPlayData"}, {2000, nullptr, "DeactivateDigitizer"}, {2001, nullptr, "SetDigitizerAutoPilotState"}, {2002, nullptr, "UnsetDigitizerAutoPilotState"}, @@ -1689,6 +1722,8 @@ public: {215, nullptr, "IsNfcActivated"}, {230, nullptr, "AcquireIrSensorEventHandle"}, {231, nullptr, "ActivateIrSensor"}, + {232, nullptr, "GetIrSensorState"}, + {233, nullptr, "GetXcdHandleForNpadWithIrSensor"}, {301, nullptr, "ActivateNpadSystem"}, {303, nullptr, "ApplyNpadSystemCommonPolicy"}, {304, nullptr, "EnableAssigningSingleOnSlSrPress"}, @@ -1703,9 +1738,16 @@ public: {313, nullptr, "GetNpadCaptureButtonAssignment"}, {314, nullptr, "GetAppletFooterUiType"}, {315, nullptr, "GetAppletDetailedUiType"}, + {316, nullptr, "GetNpadInterfaceType"}, + {317, nullptr, "GetNpadLeftRightInterfaceType"}, + {318, nullptr, "HasBattery"}, + {319, nullptr, "HasLeftRightBattery"}, {321, nullptr, "GetUniquePadsFromNpad"}, {322, nullptr, "GetIrSensorState"}, {323, nullptr, "GetXcdHandleForNpadWithIrSensor"}, + {324, nullptr, "GetUniquePadButtonSet"}, + {325, nullptr, "GetUniquePadColor"}, + {326, nullptr, "GetUniquePadAppletDetailedUiType"}, {500, nullptr, "SetAppletResourceUserId"}, {501, nullptr, "RegisterAppletResourceUserId"}, {502, nullptr, "UnregisterAppletResourceUserId"}, @@ -1716,10 +1758,13 @@ public: {511, nullptr, "GetVibrationMasterVolume"}, {512, nullptr, "BeginPermitVibrationSession"}, {513, nullptr, "EndPermitVibrationSession"}, + {514, nullptr, "Unknown514"}, {520, nullptr, "EnableHandheldHids"}, {521, nullptr, "DisableHandheldHids"}, {522, nullptr, "SetJoyConRailEnabled"}, {523, nullptr, "IsJoyConRailEnabled"}, + {524, nullptr, "IsHandheldHidsEnabled"}, + {525, nullptr, "IsJoyConAttachedOnAllRail"}, {540, nullptr, "AcquirePlayReportControllerUsageUpdateEvent"}, {541, nullptr, "GetPlayReportControllerUsages"}, {542, nullptr, "AcquirePlayReportRegisteredDeviceUpdateEvent"}, @@ -1795,6 +1840,65 @@ public: {1154, nullptr, "IsFirmwareAvailableForNotification"}, {1155, nullptr, "SetForceHandheldStyleVibration"}, {1156, nullptr, "SendConnectionTriggerWithoutTimeoutEvent"}, + {1157, nullptr, "CancelConnectionTrigger"}, + {1200, nullptr, "IsButtonConfigSupported"}, + {1201, nullptr, "IsButtonConfigEmbeddedSupported"}, + {1202, nullptr, "DeleteButtonConfig"}, + {1203, nullptr, "DeleteButtonConfigEmbedded"}, + {1204, nullptr, "SetButtonConfigEnabled"}, + {1205, nullptr, "SetButtonConfigEmbeddedEnabled"}, + {1206, nullptr, "IsButtonConfigEnabled"}, + {1207, nullptr, "IsButtonConfigEmbeddedEnabled"}, + {1208, nullptr, "SetButtonConfigEmbedded"}, + {1209, nullptr, "SetButtonConfigFull"}, + {1210, nullptr, "SetButtonConfigLeft"}, + {1211, nullptr, "SetButtonConfigRight"}, + {1212, nullptr, "GetButtonConfigEmbedded"}, + {1213, nullptr, "GetButtonConfigFull"}, + {1214, nullptr, "GetButtonConfigLeft"}, + {1215, nullptr, "GetButtonConfigRight"}, + {1250, nullptr, "IsCustomButtonConfigSupported"}, + {1251, nullptr, "IsDefaultButtonConfigEmbedded"}, + {1252, nullptr, "IsDefaultButtonConfigFull"}, + {1253, nullptr, "IsDefaultButtonConfigLeft"}, + {1254, nullptr, "IsDefaultButtonConfigRight"}, + {1255, nullptr, "IsButtonConfigStorageEmbeddedEmpty"}, + {1256, nullptr, "IsButtonConfigStorageFullEmpty"}, + {1257, nullptr, "IsButtonConfigStorageLeftEmpty"}, + {1258, nullptr, "IsButtonConfigStorageRightEmpty"}, + {1259, nullptr, "GetButtonConfigStorageEmbeddedDeprecated"}, + {1260, nullptr, "GetButtonConfigStorageFullDeprecated"}, + {1261, nullptr, "GetButtonConfigStorageLeftDeprecated"}, + {1262, nullptr, "GetButtonConfigStorageRightDeprecated"}, + {1263, nullptr, "SetButtonConfigStorageEmbeddedDeprecated"}, + {1264, nullptr, "SetButtonConfigStorageFullDeprecated"}, + {1265, nullptr, "SetButtonConfigStorageLeftDeprecated"}, + {1266, nullptr, "SetButtonConfigStorageRightDeprecated"}, + {1267, nullptr, "DeleteButtonConfigStorageEmbedded"}, + {1268, nullptr, "DeleteButtonConfigStorageFull"}, + {1269, nullptr, "DeleteButtonConfigStorageLeft"}, + {1270, nullptr, "DeleteButtonConfigStorageRight"}, + {1271, nullptr, "IsUsingCustomButtonConfig"}, + {1272, nullptr, "IsAnyCustomButtonConfigEnabled"}, + {1273, nullptr, "SetAllCustomButtonConfigEnabled"}, + {1274, nullptr, "SetDefaultButtonConfig"}, + {1275, nullptr, "SetAllDefaultButtonConfig"}, + {1276, nullptr, "SetHidButtonConfigEmbedded"}, + {1277, nullptr, "SetHidButtonConfigFull"}, + {1278, nullptr, "SetHidButtonConfigLeft"}, + {1279, nullptr, "SetHidButtonConfigRight"}, + {1280, nullptr, "GetHidButtonConfigEmbedded"}, + {1281, nullptr, "GetHidButtonConfigFull"}, + {1282, nullptr, "GetHidButtonConfigLeft"}, + {1283, nullptr, "GetHidButtonConfigRight"}, + {1284, nullptr, "GetButtonConfigStorageEmbedded"}, + {1285, nullptr, "GetButtonConfigStorageFull"}, + {1286, nullptr, "GetButtonConfigStorageLeft"}, + {1287, nullptr, "GetButtonConfigStorageRight"}, + {1288, nullptr, "SetButtonConfigStorageEmbedded"}, + {1289, nullptr, "SetButtonConfigStorageFull"}, + {1290, nullptr, "DeleteButtonConfigStorageRight"}, + {1291, nullptr, "DeleteButtonConfigStorageRight"}, }; // clang-format on diff --git a/src/core/hle/service/hid/hid.h b/src/core/hle/service/hid/hid.h index 36ed228c8..c2bdd39a3 100644 --- a/src/core/hle/service/hid/hid.h +++ b/src/core/hle/service/hid/hid.h @@ -129,6 +129,7 @@ private: void SwapNpadAssignment(Kernel::HLERequestContext& ctx); void IsUnintendedHomeButtonInputProtectionEnabled(Kernel::HLERequestContext& ctx); void EnableUnintendedHomeButtonInputProtection(Kernel::HLERequestContext& ctx); + void SetNpadAnalogStickUseCenterClamp(Kernel::HLERequestContext& ctx); void GetVibrationDeviceInfo(Kernel::HLERequestContext& ctx); void SendVibrationValue(Kernel::HLERequestContext& ctx); void GetActualVibrationValue(Kernel::HLERequestContext& ctx); diff --git a/src/core/hle/service/hid/xcd.cpp b/src/core/hle/service/hid/xcd.cpp index 43a8840d0..b1efa3d05 100644 --- a/src/core/hle/service/hid/xcd.cpp +++ b/src/core/hle/service/hid/xcd.cpp @@ -28,6 +28,8 @@ XCD_SYS::XCD_SYS(Core::System& system_) : ServiceFramework{system_, "xcd:sys"} { {20, nullptr, "StartMifareWrite"}, {101, nullptr, "GetAwakeTriggerReasonForLeftRail"}, {102, nullptr, "GetAwakeTriggerReasonForRightRail"}, + {103, nullptr, "GetAwakeTriggerBatteryLevelTransitionForLeftRail"}, + {104, nullptr, "GetAwakeTriggerBatteryLevelTransitionForRightRail"}, }; // clang-format on diff --git a/src/core/hle/service/nim/nim.cpp b/src/core/hle/service/nim/nim.cpp index f3be0b878..fee360ab9 100644 --- a/src/core/hle/service/nim/nim.cpp +++ b/src/core/hle/service/nim/nim.cpp @@ -125,51 +125,51 @@ public: {39, nullptr, "PrepareShutdown"}, {40, nullptr, "ListApplyDeltaTask"}, {41, nullptr, "ClearNotEnoughSpaceStateOfApplyDeltaTask"}, - {42, nullptr, "Unknown42"}, - {43, nullptr, "Unknown43"}, - {44, nullptr, "Unknown44"}, - {45, nullptr, "Unknown45"}, - {46, nullptr, "Unknown46"}, - {47, nullptr, "Unknown47"}, - {48, nullptr, "Unknown48"}, - {49, nullptr, "Unknown49"}, - {50, nullptr, "Unknown50"}, - {51, nullptr, "Unknown51"}, - {52, nullptr, "Unknown52"}, - {53, nullptr, "Unknown53"}, - {54, nullptr, "Unknown54"}, - {55, nullptr, "Unknown55"}, - {56, nullptr, "Unknown56"}, - {57, nullptr, "Unknown57"}, - {58, nullptr, "Unknown58"}, - {59, nullptr, "Unknown59"}, - {60, nullptr, "Unknown60"}, - {61, nullptr, "Unknown61"}, - {62, nullptr, "Unknown62"}, - {63, nullptr, "Unknown63"}, - {64, nullptr, "Unknown64"}, - {65, nullptr, "Unknown65"}, - {66, nullptr, "Unknown66"}, - {67, nullptr, "Unknown67"}, - {68, nullptr, "Unknown68"}, - {69, nullptr, "Unknown69"}, - {70, nullptr, "Unknown70"}, - {71, nullptr, "Unknown71"}, - {72, nullptr, "Unknown72"}, - {73, nullptr, "Unknown73"}, - {74, nullptr, "Unknown74"}, - {75, nullptr, "Unknown75"}, - {76, nullptr, "Unknown76"}, - {77, nullptr, "Unknown77"}, - {78, nullptr, "Unknown78"}, - {79, nullptr, "Unknown79"}, - {80, nullptr, "Unknown80"}, - {81, nullptr, "Unknown81"}, - {82, nullptr, "Unknown82"}, - {83, nullptr, "Unknown83"}, + {42, nullptr, "CreateApplyDeltaTaskFromDownloadTask"}, + {43, nullptr, "GetBackgroundApplyDeltaStressTaskInfo"}, + {44, nullptr, "GetApplyDeltaTaskRequiredStorage"}, + {45, nullptr, "CalculateNetworkInstallTaskContentsSize"}, + {46, nullptr, "PrepareShutdownForSystemUpdate"}, + {47, nullptr, "FindMaxRequiredApplicationVersionOfTask"}, + {48, nullptr, "CommitNetworkInstallTaskPartially"}, + {49, nullptr, "ListNetworkInstallTaskCommittedContentMeta"}, + {50, nullptr, "ListNetworkInstallTaskNotCommittedContentMeta"}, + {51, nullptr, "FindMaxRequiredSystemVersionOfTask"}, + {52, nullptr, "GetNetworkInstallTaskErrorContext"}, + {53, nullptr, "CreateLocalCommunicationReceiveApplicationTask"}, + {54, nullptr, "DestroyLocalCommunicationReceiveApplicationTask"}, + {55, nullptr, "ListLocalCommunicationReceiveApplicationTask"}, + {56, nullptr, "RequestLocalCommunicationReceiveApplicationTaskRun"}, + {57, nullptr, "GetLocalCommunicationReceiveApplicationTaskInfo"}, + {58, nullptr, "CommitLocalCommunicationReceiveApplicationTask"}, + {59, nullptr, "ListLocalCommunicationReceiveApplicationTaskContentMeta"}, + {60, nullptr, "CreateLocalCommunicationSendApplicationTask"}, + {61, nullptr, "RequestLocalCommunicationSendApplicationTaskRun"}, + {62, nullptr, "GetLocalCommunicationReceiveApplicationTaskErrorContext"}, + {63, nullptr, "GetLocalCommunicationSendApplicationTaskInfo"}, + {64, nullptr, "DestroyLocalCommunicationSendApplicationTask"}, + {65, nullptr, "GetLocalCommunicationSendApplicationTaskErrorContext"}, + {66, nullptr, "CalculateLocalCommunicationReceiveApplicationTaskRequiredSize"}, + {67, nullptr, "ListApplicationLocalCommunicationReceiveApplicationTask"}, + {68, nullptr, "ListApplicationLocalCommunicationSendApplicationTask"}, + {69, nullptr, "CreateLocalCommunicationReceiveSystemUpdateTask"}, + {70, nullptr, "DestroyLocalCommunicationReceiveSystemUpdateTask"}, + {71, nullptr, "ListLocalCommunicationReceiveSystemUpdateTask"}, + {72, nullptr, "RequestLocalCommunicationReceiveSystemUpdateTaskRun"}, + {73, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskInfo"}, + {74, nullptr, "CommitLocalCommunicationReceiveSystemUpdateTask"}, + {75, nullptr, "GetLocalCommunicationReceiveSystemUpdateTaskErrorContext"}, + {76, nullptr, "CreateLocalCommunicationSendSystemUpdateTask"}, + {77, nullptr, "RequestLocalCommunicationSendSystemUpdateTaskRun"}, + {78, nullptr, "GetLocalCommunicationSendSystemUpdateTaskInfo"}, + {79, nullptr, "DestroyLocalCommunicationSendSystemUpdateTask"}, + {80, nullptr, "GetLocalCommunicationSendSystemUpdateTaskErrorContext"}, + {81, nullptr, "ListLocalCommunicationSendSystemUpdateTask"}, + {82, nullptr, "GetReceivedSystemDataPath"}, + {83, nullptr, "CalculateApplyDeltaTaskOccupiedSize"}, {84, nullptr, "Unknown84"}, - {85, nullptr, "Unknown85"}, - {86, nullptr, "Unknown86"}, + {85, nullptr, "ListNetworkInstallTaskContentMetaFromInstallMeta"}, + {86, nullptr, "ListNetworkInstallTaskOccupiedSize"}, {87, nullptr, "Unknown87"}, {88, nullptr, "Unknown88"}, {89, nullptr, "Unknown89"}, @@ -202,6 +202,17 @@ public: {116, nullptr, "Unknown116"}, {117, nullptr, "Unknown117"}, {118, nullptr, "Unknown118"}, + {119, nullptr, "Unknown119"}, + {120, nullptr, "Unknown120"}, + {121, nullptr, "Unknown121"}, + {122, nullptr, "Unknown122"}, + {123, nullptr, "Unknown123"}, + {124, nullptr, "Unknown124"}, + {125, nullptr, "Unknown125"}, + {126, nullptr, "Unknown126"}, + {127, nullptr, "Unknown127"}, + {128, nullptr, "Unknown128"}, + {129, nullptr, "Unknown129"}, }; // clang-format on diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index f7a58f659..e4c703da4 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -49,6 +49,8 @@ public: {151, nullptr, "GetStateWithHandover"}, {152, nullptr, "GetStateChangeEventWithHandover"}, {153, nullptr, "GetDropEventWithHandover"}, + {154, nullptr, "CreateTokenAsync"}, + {155, nullptr, "CreateTokenAsyncWithApplicationId"}, {161, nullptr, "GetRequestChangeStateCancelEvent"}, {162, nullptr, "RequestChangeStateForceTimedWithCancelEvent"}, {201, nullptr, "RequestChangeStateForceTimed"}, @@ -84,6 +86,7 @@ public: {151, nullptr, "GetStateWithHandover"}, {152, nullptr, "GetStateChangeEventWithHandover"}, {153, nullptr, "GetDropEventWithHandover"}, + {154, nullptr, "CreateTokenAsync"}, }; // clang-format on diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 6ccf8995c..5fe7a9189 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -55,6 +55,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {26, nullptr, "BeginInstallApplication"}, {27, nullptr, "DeleteApplicationRecord"}, {30, nullptr, "RequestApplicationUpdateInfo"}, + {31, nullptr, "Unknown31"}, {32, nullptr, "CancelApplicationDownload"}, {33, nullptr, "ResumeApplicationDownload"}, {35, nullptr, "UpdateVersionList"}, @@ -182,6 +183,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {913, nullptr, "ListAllApplicationRecord"}, {914, nullptr, "HideApplicationRecord"}, {915, nullptr, "ShowApplicationRecord"}, + {916, nullptr, "IsApplicationAutoDeleteDisabled"}, {1000, nullptr, "RequestVerifyApplicationDeprecated"}, {1001, nullptr, "CorruptApplicationForDebug"}, {1002, nullptr, "RequestVerifyAddOnContentsRights"}, @@ -201,6 +203,8 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {1310, nullptr, "RequestMoveApplicationEntity"}, {1311, nullptr, "EstimateSizeToMove"}, {1312, nullptr, "HasMovableEntity"}, + {1313, nullptr, "CleanupOrphanContents"}, + {1314, nullptr, "CheckPreconditionSatisfiedToMove"}, {1400, nullptr, "PrepareShutdown"}, {1500, nullptr, "FormatSdCard"}, {1501, nullptr, "NeedsSystemUpdateToFormatSdCard"}, @@ -215,6 +219,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {1702, nullptr, "GetApplicationDownloadTaskStatus"}, {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, {1704, nullptr, "GetApplicationViewWithPromotionInfo"}, + {1705, nullptr, "IsPatchAutoDeletableApplication"}, {1800, nullptr, "IsNotificationSetupCompleted"}, {1801, nullptr, "GetLastNotificationInfoCount"}, {1802, nullptr, "ListLastNotificationInfo"}, @@ -269,6 +274,9 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2351, nullptr, "RequestNoDownloadRightsErrorResolution"}, {2352, nullptr, "RequestResolveNoDownloadRightsError"}, {2353, nullptr, "GetApplicationDownloadTaskInfo"}, + {2354, nullptr, "PrioritizeApplicationBackgroundTask"}, + {2355, nullptr, "Unknown2355"}, + {2356, nullptr, "Unknown2356"}, {2400, nullptr, "GetPromotionInfo"}, {2401, nullptr, "CountPromotionInfo"}, {2402, nullptr, "ListPromotionInfo"}, @@ -282,6 +290,21 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {2515, nullptr, "CleanupAllPlaceHolderAndFragmentsIfNoTask"}, {2516, nullptr, "EnsureApplicationCertificate"}, {2800, nullptr, "GetApplicationIdOfPreomia"}, + {3000, nullptr, "RegisterDeviceLockKey"}, + {3001, nullptr, "UnregisterDeviceLockKey"}, + {3002, nullptr, "VerifyDeviceLockKey"}, + {3003, nullptr, "HideApplicationIcon"}, + {3004, nullptr, "ShowApplicationIcon"}, + {3005, nullptr, "HideApplicationTitle"}, + {3006, nullptr, "ShowApplicationTitle"}, + {3007, nullptr, "EnableGameCard"}, + {3008, nullptr, "DisableGameCard"}, + {3009, nullptr, "EnableLocalContentShare"}, + {3010, nullptr, "DisableLocalContentShare"}, + {3011, nullptr, "IsApplicationIconHidden"}, + {3012, nullptr, "IsApplicationTitleHidden"}, + {3013, nullptr, "IsGameCardEnabled"}, + {3014, nullptr, "IsLocalContentShareEnabled"}, {9999, nullptr, "GetApplicationCertificate"}, }; // clang-format on @@ -441,7 +464,11 @@ IApplicationVersionInterface::IApplicationVersionInterface(Core::System& system_ {800, nullptr, "RequestVersionList"}, {801, nullptr, "ListVersionList"}, {802, nullptr, "RequestVersionListData"}, + {900, nullptr, "ImportAutoUpdatePolicyJsonForDebug"}, + {901, nullptr, "ListDefaultAutoUpdatePolicy"}, + {902, nullptr, "ListAutoUpdatePolicyForSpecificApplication"}, {1000, nullptr, "PerformAutoUpdate"}, + {1001, nullptr, "ListAutoUpdateSchedule"}, }; // clang-format on @@ -547,6 +574,9 @@ IFactoryResetInterface::~IFactoryResetInterface() = default; NS::NS(const char* name, Core::System& system_) : ServiceFramework{system_, name} { // clang-format off static const FunctionInfo functions[] = { + {7988, nullptr, "GetDynamicRightsInterface"}, + {7989, nullptr, "GetReadOnlyApplicationControlDataInterface"}, + {7991, nullptr, "GetReadOnlyApplicationRecordInterface"}, {7992, &NS::PushInterface<IECommerceInterface>, "GetECommerceInterface"}, {7993, &NS::PushInterface<IApplicationVersionInterface>, "GetApplicationVersionInterface"}, {7994, &NS::PushInterface<IFactoryResetInterface>, "GetFactoryResetInterface"}, @@ -575,18 +605,22 @@ public: {0, nullptr, "LaunchProgram"}, {1, nullptr, "TerminateProcess"}, {2, nullptr, "TerminateProgram"}, - {4, nullptr, "GetShellEventHandle"}, + {4, nullptr, "GetShellEvent"}, {5, nullptr, "GetShellEventInfo"}, {6, nullptr, "TerminateApplication"}, {7, nullptr, "PrepareLaunchProgramFromHost"}, - {8, nullptr, "LaunchApplication"}, + {8, nullptr, "LaunchApplicationFromHost"}, {9, nullptr, "LaunchApplicationWithStorageIdForDevelop"}, {10, nullptr, "IsSystemMemoryResourceLimitBoosted"}, {11, nullptr, "GetRunningApplicationProcessIdForDevelop"}, - {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActive"}, + {12, nullptr, "SetCurrentApplicationRightsEnvironmentCanBeActiveForDevelop"}, {13, nullptr, "CreateApplicationResourceForDevelop"}, {14, nullptr, "IsPreomiaForDevelop"}, {15, nullptr, "GetApplicationProgramIdFromHost"}, + {16, nullptr, "RefreshCachedDebugValues"}, + {17, nullptr, "PrepareLaunchApplicationFromHost"}, + {18, nullptr, "GetLaunchEvent"}, + {19, nullptr, "GetLaunchResult"}, }; // clang-format on @@ -699,6 +733,7 @@ void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system std::make_shared<NS>("ns:rid", system)->InstallAsService(service_manager); std::make_shared<NS>("ns:rt", system)->InstallAsService(service_manager); std::make_shared<NS>("ns:web", system)->InstallAsService(service_manager); + std::make_shared<NS>("ns:ro", system)->InstallAsService(service_manager); std::make_shared<NS_DEV>(system)->InstallAsService(service_manager); std::make_shared<NS_SU>(system)->InstallAsService(service_manager); diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index 7423287ea..a1a7ac987 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -695,6 +695,7 @@ public: {2205, &ISystemDisplayService::SetLayerZ, "SetLayerZ"}, {2207, &ISystemDisplayService::SetLayerVisibility, "SetLayerVisibility"}, {2209, nullptr, "SetLayerAlpha"}, + {2210, nullptr, "SetLayerPositionAndSize"}, {2312, nullptr, "CreateStrayLayer"}, {2400, nullptr, "OpenIndirectLayer"}, {2401, nullptr, "CloseIndirectLayer"}, @@ -718,6 +719,7 @@ public: {3215, nullptr, "SetDisplayGamma"}, {3216, nullptr, "GetDisplayCmuLuma"}, {3217, nullptr, "SetDisplayCmuLuma"}, + {3218, nullptr, "SetDisplayCrcMode"}, {6013, nullptr, "GetLayerPresentationSubmissionTimestamps"}, {8225, nullptr, "GetSharedBufferMemoryHandleId"}, {8250, nullptr, "OpenSharedLayer"}, @@ -729,6 +731,7 @@ public: {8256, nullptr, "GetSharedFrameBufferAcquirableEvent"}, {8257, nullptr, "FillSharedFrameBufferColor"}, {8258, nullptr, "CancelSharedFrameBuffer"}, + {9000, nullptr, "GetDp2hdmiController"}, }; RegisterHandlers(functions); } @@ -808,10 +811,15 @@ public: {2402, nullptr, "GetDisplayHotplugState"}, {2501, nullptr, "GetCompositorErrorInfo"}, {2601, nullptr, "GetDisplayErrorEvent"}, + {2701, nullptr, "GetDisplayFatalErrorEvent"}, {4201, nullptr, "SetDisplayAlpha"}, {4203, nullptr, "SetDisplayLayerStack"}, {4205, nullptr, "SetDisplayPowerState"}, {4206, nullptr, "SetDefaultDisplay"}, + {4207, nullptr, "ResetDisplayPanel"}, + {4208, nullptr, "SetDisplayFatalErrorEnabled"}, + {4209, nullptr, "IsDisplayPanelOn"}, + {4300, nullptr, "GetInternalPanelId"}, {6000, &IManagerDisplayService::AddToLayerStack, "AddToLayerStack"}, {6001, nullptr, "RemoveFromLayerStack"}, {6002, &IManagerDisplayService::SetLayerVisibility, "SetLayerVisibility"}, diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index c61f44619..009c6f574 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -517,8 +517,8 @@ void GPU::TriggerCpuInterrupt(const u32 syncpoint_id, const u32 value) const { interrupt_manager.GPUInterruptSyncpt(syncpoint_id, value); } -void GPU::WaitIdle() const { - gpu_thread.WaitIdle(); +void GPU::ShutDown() { + gpu_thread.ShutDown(); } void GPU::OnCommandListEnd() { diff --git a/src/video_core/gpu.h b/src/video_core/gpu.h index b2ee45496..ecab35d3b 100644 --- a/src/video_core/gpu.h +++ b/src/video_core/gpu.h @@ -219,8 +219,8 @@ public: return *shader_notify; } - // Waits for the GPU to finish working - void WaitIdle() const; + // Stops the GPU execution and waits for the GPU to finish working + void ShutDown(); /// Allows the CPU/NvFlinger to wait on the GPU before presenting a frame. void WaitFence(u32 syncpoint_id, u32 value); diff --git a/src/video_core/gpu_thread.cpp b/src/video_core/gpu_thread.cpp index 99353f15f..7addfbc7b 100644 --- a/src/video_core/gpu_thread.cpp +++ b/src/video_core/gpu_thread.cpp @@ -29,8 +29,7 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, system.RegisterHostThread(); // Wait for first GPU command before acquiring the window context - while (state.queue.Empty()) - ; + state.queue.Wait(); // If emulation was stopped during disk shader loading, abort before trying to acquire context if (!state.is_running) { @@ -57,11 +56,17 @@ static void RunThread(Core::System& system, VideoCore::RendererBase& renderer, } else if (const auto* invalidate = std::get_if<InvalidateRegionCommand>(&next.data)) { rasterizer->OnCPUWrite(invalidate->addr, invalidate->size); } else if (std::holds_alternative<EndProcessingCommand>(next.data)) { - return; + ASSERT(state.is_running == false); } else { UNREACHABLE(); } state.signaled_fence.store(next.fence); + if (next.block) { + // We have to lock the write_lock to ensure that the condition_variable wait not get a + // race between the check and the lock itself. + std::lock_guard lk(state.write_lock); + state.cv.notify_all(); + } } } @@ -69,13 +74,7 @@ ThreadManager::ThreadManager(Core::System& system_, bool is_async_) : system{system_}, is_async{is_async_} {} ThreadManager::~ThreadManager() { - if (!thread.joinable()) { - return; - } - - // Notify GPU thread that a shutdown is pending - PushCommand(EndProcessingCommand()); - thread.join(); + ShutDown(); } void ThreadManager::StartThread(VideoCore::RendererBase& renderer, @@ -112,9 +111,8 @@ void ThreadManager::FlushRegion(VAddr addr, u64 size) { case Settings::GPUAccuracy::Extreme: { auto& gpu = system.GPU(); u64 fence = gpu.RequestFlush(addr, size); - PushCommand(GPUTickCommand()); - while (fence > gpu.CurrentFlushRequestFence()) { - } + PushCommand(GPUTickCommand(), true); + ASSERT(fence <= gpu.CurrentFlushRequestFence()); break; } default: @@ -131,23 +129,45 @@ void ThreadManager::FlushAndInvalidateRegion(VAddr addr, u64 size) { rasterizer->OnCPUWrite(addr, size); } -void ThreadManager::WaitIdle() const { - while (state.last_fence > state.signaled_fence.load(std::memory_order_relaxed) && - system.IsPoweredOn()) { +void ThreadManager::ShutDown() { + if (!state.is_running) { + return; } + + { + std::lock_guard lk(state.write_lock); + state.is_running = false; + state.cv.notify_all(); + } + + if (!thread.joinable()) { + return; + } + + // Notify GPU thread that a shutdown is pending + PushCommand(EndProcessingCommand()); + thread.join(); } void ThreadManager::OnCommandListEnd() { PushCommand(OnCommandListEndCommand()); } -u64 ThreadManager::PushCommand(CommandData&& command_data) { - const u64 fence{++state.last_fence}; - state.queue.Push(CommandDataContainer(std::move(command_data), fence)); - +u64 ThreadManager::PushCommand(CommandData&& command_data, bool block) { if (!is_async) { // In synchronous GPU mode, block the caller until the command has executed - WaitIdle(); + block = true; + } + + std::unique_lock lk(state.write_lock); + const u64 fence{++state.last_fence}; + state.queue.Push(CommandDataContainer(std::move(command_data), fence, block)); + + if (block) { + state.cv.wait(lk, [this, fence] { + return fence <= state.signaled_fence.load(std::memory_order_relaxed) || + !state.is_running; + }); } return fence; diff --git a/src/video_core/gpu_thread.h b/src/video_core/gpu_thread.h index 18269e51c..11a648f38 100644 --- a/src/video_core/gpu_thread.h +++ b/src/video_core/gpu_thread.h @@ -90,21 +90,24 @@ using CommandData = struct CommandDataContainer { CommandDataContainer() = default; - explicit CommandDataContainer(CommandData&& data_, u64 next_fence_) - : data{std::move(data_)}, fence{next_fence_} {} + explicit CommandDataContainer(CommandData&& data_, u64 next_fence_, bool block_) + : data{std::move(data_)}, fence{next_fence_}, block(block_) {} CommandData data; u64 fence{}; + bool block{}; }; /// Struct used to synchronize the GPU thread struct SynchState final { std::atomic_bool is_running{true}; - using CommandQueue = Common::MPSCQueue<CommandDataContainer>; + using CommandQueue = Common::SPSCQueue<CommandDataContainer>; + std::mutex write_lock; CommandQueue queue; u64 last_fence{}; std::atomic<u64> signaled_fence{}; + std::condition_variable cv; }; /// Class used to manage the GPU thread @@ -132,14 +135,14 @@ public: /// Notify rasterizer that any caches of the specified region should be flushed and invalidated void FlushAndInvalidateRegion(VAddr addr, u64 size); - // Wait until the gpu thread is idle. - void WaitIdle() const; + // Stops the GPU execution and waits for the GPU to finish working + void ShutDown(); void OnCommandListEnd(); private: /// Pushes a command to be executed by the GPU thread - u64 PushCommand(CommandData&& command_data); + u64 PushCommand(CommandData&& command_data, bool block = false); Core::System& system; const bool is_async; |