From 53b321c945d7e6782a6011b7ee55035da8f54dbc Mon Sep 17 00:00:00 2001 From: Narr the Reg Date: Mon, 22 Jan 2024 23:30:34 -0600 Subject: service: set: Implement more settings functions for Qlaunch --- src/core/hle/service/hid/hid.cpp | 2 +- src/core/hle/service/hid/hid_server.cpp | 4 +- src/core/hle/service/hid/hid_system_server.cpp | 54 ++++++++++++++++++++++---- src/core/hle/service/hid/hid_system_server.h | 9 ++++- 4 files changed, 58 insertions(+), 11 deletions(-) (limited to 'src/core/hle/service/hid') diff --git a/src/core/hle/service/hid/hid.cpp b/src/core/hle/service/hid/hid.cpp index 595a3372e..5b28be577 100644 --- a/src/core/hle/service/hid/hid.cpp +++ b/src/core/hle/service/hid/hid.cpp @@ -33,7 +33,7 @@ void LoopProcess(Core::System& system) { server_manager->RegisterNamedService( "hid:dbg", std::make_shared(system, resource_manager)); server_manager->RegisterNamedService( - "hid:sys", std::make_shared(system, resource_manager)); + "hid:sys", std::make_shared(system, resource_manager, firmware_settings)); server_manager->RegisterNamedService("hidbus", std::make_shared(system)); diff --git a/src/core/hle/service/hid/hid_server.cpp b/src/core/hle/service/hid/hid_server.cpp index 30afed812..09c47b5e3 100644 --- a/src/core/hle/service/hid/hid_server.cpp +++ b/src/core/hle/service/hid/hid_server.cpp @@ -1419,8 +1419,8 @@ void IHidServer::EnableUnintendedHomeButtonInputProtection(HLERequestContext& ct const auto parameters{rp.PopRaw()}; - LOG_INFO(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}", - parameters.is_enabled, parameters.npad_id, parameters.applet_resource_user_id); + LOG_DEBUG(Service_HID, "called, is_enabled={}, npad_id={}, applet_resource_user_id={}", + parameters.is_enabled, parameters.npad_id, parameters.applet_resource_user_id); if (!IsNpadIdValid(parameters.npad_id)) { IPC::ResponseBuilder rb{ctx, 3}; diff --git a/src/core/hle/service/hid/hid_system_server.cpp b/src/core/hle/service/hid/hid_system_server.cpp index bf27ddfbf..d1ec42edc 100644 --- a/src/core/hle/service/hid/hid_system_server.cpp +++ b/src/core/hle/service/hid/hid_system_server.cpp @@ -3,8 +3,10 @@ #include "core/hle/service/hid/hid_system_server.h" #include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/set/settings_types.h" #include "hid_core/hid_result.h" #include "hid_core/resource_manager.h" +#include "hid_core/resources/hid_firmware_settings.h" #include "hid_core/resources/npad/npad.h" #include "hid_core/resources/npad/npad_types.h" #include "hid_core/resources/npad/npad_vibration.h" @@ -13,9 +15,10 @@ namespace Service::HID { -IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr resource) +IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings) : ServiceFramework{system_, "hid:sys"}, service_context{system_, service_name}, - resource_manager{resource} { + resource_manager{resource}, firmware_settings{settings} { // clang-format off static const FunctionInfo functions[] = { {31, nullptr, "SendKeyboardLockKeyEvent"}, @@ -25,7 +28,7 @@ IHidSystemServer::IHidSystemServer(Core::System& system_, std::shared_ptrGetPlatformConfig(); + + LOG_INFO(Service_HID, "called, platform_config={}", platform_config.raw); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.PushRaw(platform_config); +} + void IHidSystemServer::ApplyNpadSystemCommonPolicy(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto applet_resource_user_id{rp.Pop()}; @@ -674,6 +687,16 @@ void IHidSystemServer::EndPermitVibrationSession(HLERequestContext& ctx) { rb.Push(result); } +void IHidSystemServer::IsJoyConRailEnabled(HLERequestContext& ctx) { + const bool is_attached = true; + + LOG_WARNING(Service_HID, "(STUBBED) called, is_attached={}", is_attached); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_attached); +} + void IHidSystemServer::IsJoyConAttachedOnAllRail(HLERequestContext& ctx) { const bool is_attached = true; @@ -727,7 +750,7 @@ void IHidSystemServer::AcquireUniquePadConnectionEventHandle(HLERequestContext& } void IHidSystemServer::GetUniquePadIds(HLERequestContext& ctx) { - LOG_WARNING(Service_HID, "(STUBBED) called"); + LOG_DEBUG(Service_HID, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 4}; rb.Push(ResultSuccess); @@ -752,6 +775,16 @@ void IHidSystemServer::IsUsbFullKeyControllerEnabled(HLERequestContext& ctx) { rb.Push(is_enabled); } +void IHidSystemServer::EnableUsbFullKeyController(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto is_enabled{rp.Pop()}; + + LOG_WARNING(Service_HID, "(STUBBED) called, is_enabled={}", is_enabled); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IHidSystemServer::IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx) { const bool button_pressed = false; @@ -798,6 +831,13 @@ void IHidSystemServer::FinalizeUsbFirmwareUpdate(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +void IHidSystemServer::CheckUsbFirmwareUpdateRequired(HLERequestContext& ctx) { + LOG_WARNING(Service_HID, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IHidSystemServer::InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx) { LOG_WARNING(Service_HID, "(STUBBED) called"); diff --git a/src/core/hle/service/hid/hid_system_server.h b/src/core/hle/service/hid/hid_system_server.h index 90a719f02..4ab4d3931 100644 --- a/src/core/hle/service/hid/hid_system_server.h +++ b/src/core/hle/service/hid/hid_system_server.h @@ -16,13 +16,16 @@ class KEvent; namespace Service::HID { class ResourceManager; +class HidFirmwareSettings; class IHidSystemServer final : public ServiceFramework { public: - explicit IHidSystemServer(Core::System& system_, std::shared_ptr resource); + explicit IHidSystemServer(Core::System& system_, std::shared_ptr resource, + std::shared_ptr settings); ~IHidSystemServer() override; private: + void GetPlatformConfig(HLERequestContext& ctx); void ApplyNpadSystemCommonPolicy(HLERequestContext& ctx); void EnableAssigningSingleOnSlSrPress(HLERequestContext& ctx); void DisableAssigningSingleOnSlSrPress(HLERequestContext& ctx); @@ -50,6 +53,7 @@ private: void GetVibrationMasterVolume(HLERequestContext& ctx); void BeginPermitVibrationSession(HLERequestContext& ctx); void EndPermitVibrationSession(HLERequestContext& ctx); + void IsJoyConRailEnabled(HLERequestContext& ctx); void IsJoyConAttachedOnAllRail(HLERequestContext& ctx); void AcquireConnectionTriggerTimeoutEvent(HLERequestContext& ctx); void AcquireDeviceRegisteredEventForControllerSupport(HLERequestContext& ctx); @@ -58,12 +62,14 @@ private: void GetUniquePadIds(HLERequestContext& ctx); void AcquireJoyDetachOnBluetoothOffEventHandle(HLERequestContext& ctx); void IsUsbFullKeyControllerEnabled(HLERequestContext& ctx); + void EnableUsbFullKeyController(HLERequestContext& ctx); void IsHandheldButtonPressedOnConsoleMode(HLERequestContext& ctx); void InitializeFirmwareUpdate(HLERequestContext& ctx); void CheckFirmwareUpdateRequired(HLERequestContext& ctx); void SetFirmwareHotfixUpdateSkipEnabled(HLERequestContext& ctx); void InitializeUsbFirmwareUpdate(HLERequestContext& ctx); void FinalizeUsbFirmwareUpdate(HLERequestContext& ctx); + void CheckUsbFirmwareUpdateRequired(HLERequestContext& ctx); void InitializeUsbFirmwareUpdateWithoutMemory(HLERequestContext& ctx); void GetTouchScreenDefaultConfiguration(HLERequestContext& ctx); void SetForceHandheldStyleVibration(HLERequestContext& ctx); @@ -77,6 +83,7 @@ private: Kernel::KEvent* unique_pad_connection_event; KernelHelpers::ServiceContext service_context; std::shared_ptr resource_manager; + std::shared_ptr firmware_settings; }; } // namespace Service::HID -- cgit v1.2.3