From c3db1c4681cabddf7df3a52444628b162f647a09 Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 5 Aug 2023 20:48:36 -0600 Subject: [PATCH] service: Add stubs for Qlaunch --- src/core/hle/service/btm/btm.cpp | 18 +++- src/core/hle/service/lbl/lbl.cpp | 9 +- src/core/hle/service/ns/ns.cpp | 152 +++++++++++++++++++++++++---- src/core/hle/service/ns/ns.h | 18 ++++ src/core/hle/service/olsc/olsc.cpp | 10 +- src/core/hle/service/vi/vi.cpp | 24 ++++- 6 files changed, 208 insertions(+), 23 deletions(-) diff --git a/src/core/hle/service/btm/btm.cpp b/src/core/hle/service/btm/btm.cpp index 2dc23e674..8bf65d560 100644 --- a/src/core/hle/service/btm/btm.cpp +++ b/src/core/hle/service/btm/btm.cpp @@ -260,7 +260,8 @@ public: class IBtmSystemCore final : public ServiceFramework { public: - explicit IBtmSystemCore(Core::System& system_) : ServiceFramework{system_, "IBtmSystemCore"} { + explicit IBtmSystemCore(Core::System& system_) + : ServiceFramework{system_, "IBtmSystemCore"}, service_context{system_, "IBtmSystemCore"} { // clang-format off static const FunctionInfo functions[] = { {0, &IBtmSystemCore::StartGamepadPairing, "StartGamepadPairing"}, @@ -270,7 +271,7 @@ public: {4, nullptr, "EnableRadio"}, {5, nullptr, "DisableRadio"}, {6, &IBtmSystemCore::IsRadioEnabled, "IsRadioEnabled"}, - {7, nullptr, "AcquireRadioEvent"}, + {7, &IBtmSystemCore::AcquireRadioEvent, "AcquireRadioEvent"}, {8, nullptr, "AcquireGamepadPairingEvent"}, {9, nullptr, "IsGamepadPairingStarted"}, {10, nullptr, "StartAudioDeviceDiscovery"}, @@ -291,6 +292,7 @@ public: // clang-format on RegisterHandlers(functions); + radio_event = service_context.CreateEvent("IBtmSystemCore::RadioEvent"); } private: @@ -338,7 +340,19 @@ private: LOG_WARNING(Service_BTM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); + } void AcquireRadioEvent(HLERequestContext& ctx) { + LOG_ERROR(Service_BTM, "called"); + + radio_event->Signal(); + + IPC::ResponseBuilder rb{ ctx, 3, 1 }; + rb.Push(ResultSuccess); + rb.Push(true); + rb.PushCopyObjects(radio_event->GetReadableEvent()); } + + Kernel::KEvent* radio_event; + KernelHelpers::ServiceContext service_context; }; class BTM_SYS final : public ServiceFramework { diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index 98a79365d..e06fd56e0 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -19,7 +19,7 @@ public: // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "SaveCurrentSetting"}, - {1, nullptr, "LoadCurrentSetting"}, + {1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, {4, nullptr, "ApplyCurrentBrightnessSettingToBacklight"}, @@ -60,6 +60,13 @@ private: On = 1, }; + void LoadCurrentSetting(HLERequestContext& ctx) { + LOG_WARNING(Service_LBL, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void SetCurrentBrightnessSetting(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; auto brightness = rp.Pop(); diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 19c3ff01b..aa9faa585 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -11,6 +11,7 @@ #include "core/hle/service/filesystem/filesystem.h" #include "core/hle/service/glue/glue_manager.h" #include "core/hle/service/ipc_helpers.h" +#include "core/hle/service/kernel_helpers.h" #include "core/hle/service/ns/errors.h" #include "core/hle/service/ns/iplatform_service_manager.h" #include "core/hle/service/ns/language.h" @@ -35,12 +36,13 @@ IAccountProxyInterface::IAccountProxyInterface(Core::System& system_) IAccountProxyInterface::~IAccountProxyInterface() = default; IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_) - : ServiceFramework{system_, "IApplicationManagerInterface"} { + : ServiceFramework{system_, "IApplicationManagerInterface"}, + service_context{system_, "IApplicationManagerInterface"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "ListApplicationRecord"}, + {0, &IApplicationManagerInterface::ListApplicationRecord, "ListApplicationRecord"}, {1, nullptr, "GenerateApplicationRecordCount"}, - {2, nullptr, "GetApplicationRecordUpdateSystemEvent"}, + {2, &IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent, "GetApplicationRecordUpdateSystemEvent"}, {3, nullptr, "GetApplicationViewDeprecated"}, {4, nullptr, "DeleteApplicationEntity"}, {5, nullptr, "DeleteApplicationCompletely"}, @@ -69,14 +71,14 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {40, nullptr, "GetApplicationLogoData"}, {41, nullptr, "CalculateApplicationDownloadRequiredSize"}, {42, nullptr, "CleanupSdCard"}, - {43, nullptr, "CheckSdCardMountStatus"}, - {44, nullptr, "GetSdCardMountStatusChangedEvent"}, + {43, &IApplicationManagerInterface::CheckSdCardMountStatus, "CheckSdCardMountStatus"}, + {44, &IApplicationManagerInterface::GetSdCardMountStatusChangedEvent, "GetSdCardMountStatusChangedEvent"}, {45, nullptr, "GetGameCardAttachmentEvent"}, {46, nullptr, "GetGameCardAttachmentInfo"}, {47, nullptr, "GetTotalSpaceSize"}, - {48, nullptr, "GetFreeSpaceSize"}, + {48, &IApplicationManagerInterface::GetFreeSpaceSize, "GetFreeSpaceSize"}, {49, nullptr, "GetSdCardRemovedEvent"}, - {52, nullptr, "GetGameCardUpdateDetectionEvent"}, + {52, &IApplicationManagerInterface::GetGameCardUpdateDetectionEvent, "GetGameCardUpdateDetectionEvent"}, {53, nullptr, "DisableApplicationAutoDelete"}, {54, nullptr, "EnableApplicationAutoDelete"}, {55, &IApplicationManagerInterface::GetApplicationDesiredLanguage, "GetApplicationDesiredLanguage"}, @@ -147,7 +149,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {502, nullptr, "RequestCheckGameCardRegistration"}, {503, nullptr, "RequestGameCardRegistrationGoldPoint"}, {504, nullptr, "RequestRegisterGameCard"}, - {505, nullptr, "GetGameCardMountFailureEvent"}, + {505, &IApplicationManagerInterface::GetGameCardMountFailureEvent, "GetGameCardMountFailureEvent"}, {506, nullptr, "IsGameCardInserted"}, {507, nullptr, "EnsureGameCardAccess"}, {508, nullptr, "GetLastGameCardMountFailureResult"}, @@ -327,10 +329,34 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ // clang-format on RegisterHandlers(functions); + + record_update_system_event = + service_context.CreateEvent("IApplicationManagerInterface::RecordUpdateSystemEvent"); + gamecard_update_detection_event = + service_context.CreateEvent("IApplicationManagerInterface::GamecardUpdateDetectionEvent"); + gamecard_mount_status_event = + service_context.CreateEvent("IApplicationManagerInterface::GamecardMountStatusEvent"); + gamecard_mount_failure_event = + service_context.CreateEvent("IApplicationManagerInterface::GamecardMountFailureEvent"); } IApplicationManagerInterface::~IApplicationManagerInterface() = default; +void IApplicationManagerInterface::ListApplicationRecord(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.Push(0); +} +void IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(record_update_system_event->GetReadableEvent()); +} + void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto flag = rp.PopRaw(); @@ -390,6 +416,45 @@ void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& rb.Push(static_cast(out.size())); } +void IApplicationManagerInterface::GetGameCardMountFailureEvent(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(gamecard_mount_failure_event->GetReadableEvent()); +} + +void IApplicationManagerInterface::CheckSdCardMountStatus(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IApplicationManagerInterface::GetSdCardMountStatusChangedEvent(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(gamecard_mount_status_event->GetReadableEvent()); +} + +void IApplicationManagerInterface::GetFreeSpaceSize(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(ResultSuccess); + rb.Push(1024UL * 1024UL * 1024UL); +} + +void IApplicationManagerInterface::GetGameCardUpdateDetectionEvent(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(gamecard_update_detection_event->GetReadableEvent()); +} + void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto supported_languages = rp.Pop(); @@ -503,7 +568,7 @@ IContentManagementInterface::IContentManagementInterface(Core::System& system_) // clang-format off static const FunctionInfo functions[] = { {11, nullptr, "CalculateApplicationOccupiedSize"}, - {43, nullptr, "CheckSdCardMountStatus"}, + {43, &IContentManagementInterface::CheckSdCardMountStatus, "CheckSdCardMountStatus"}, {47, &IContentManagementInterface::GetTotalSpaceSize, "GetTotalSpaceSize"}, {48, &IContentManagementInterface::GetFreeSpaceSize, "GetFreeSpaceSize"}, {600, nullptr, "CountApplicationContentMeta"}, @@ -518,24 +583,31 @@ IContentManagementInterface::IContentManagementInterface(Core::System& system_) IContentManagementInterface::~IContentManagementInterface() = default; +void IContentManagementInterface::CheckSdCardMountStatus(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IContentManagementInterface::GetTotalSpaceSize(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto storage{rp.PopEnum()}; + IPC::RequestParser rp{ ctx }; + const auto storage{ rp.PopEnum() }; LOG_INFO(Service_Capture, "called, storage={}", storage); - IPC::ResponseBuilder rb{ctx, 4}; + IPC::ResponseBuilder rb{ ctx, 4 }; rb.Push(ResultSuccess); rb.Push(system.GetFileSystemController().GetTotalSpaceSize(storage)); } void IContentManagementInterface::GetFreeSpaceSize(HLERequestContext& ctx) { - IPC::RequestParser rp{ctx}; - const auto storage{rp.PopEnum()}; + IPC::RequestParser rp{ ctx }; + const auto storage{ rp.PopEnum() }; LOG_INFO(Service_Capture, "called, storage={}", storage); - IPC::ResponseBuilder rb{ctx, 4}; + IPC::ResponseBuilder rb{ ctx, 4 }; rb.Push(ResultSuccess); rb.Push(system.GetFileSystemController().GetFreeSpaceSize(storage)); } @@ -591,7 +663,7 @@ IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) {704, nullptr, "ListDownloadTaskStatus"}, {705, nullptr, "RequestDownloadTaskListData"}, {706, nullptr, "TryCommitCurrentApplicationDownloadTask"}, - {707, nullptr, "EnableAutoCommit"}, + {707, &IDownloadTaskInterface::EnableAutoCommit, "EnableAutoCommit"}, {708, nullptr, "DisableAutoCommit"}, {709, nullptr, "TriggerDynamicCommitEvent"}, }; @@ -602,6 +674,12 @@ IDownloadTaskInterface::IDownloadTaskInterface(Core::System& system_) IDownloadTaskInterface::~IDownloadTaskInterface() = default; +void IDownloadTaskInterface::EnableAutoCommit(HLERequestContext& ctx) { + LOG_ERROR(Service_SET, "called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + IECommerceInterface::IECommerceInterface(Core::System& system_) : ServiceFramework{system_, "IECommerceInterface"} { // clang-format off @@ -814,7 +892,8 @@ public: class NS_SU final : public ServiceFramework { public: - explicit NS_SU(Core::System& system_) : ServiceFramework{system_, "ns:su"} { + explicit NS_SU(Core::System& system_) + : ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetBackgroundNetworkUpdateState"}, @@ -824,7 +903,7 @@ public: {4, nullptr, "RequestBackgroundNetworkUpdate"}, {5, nullptr, "NotifyBackgroundNetworkUpdate"}, {6, nullptr, "NotifyExFatDriverDownloadedForDebug"}, - {9, nullptr, "GetSystemUpdateNotificationEventForContentDelivery"}, + {9, &NS_SU::GetSystemUpdateNotificationEventForContentDelivery, "GetSystemUpdateNotificationEventForContentDelivery"}, {10, nullptr, "NotifySystemUpdateForContentDelivery"}, {11, nullptr, "PrepareShutdown"}, {12, nullptr, "Unknown12"}, @@ -838,9 +917,14 @@ public: // clang-format on RegisterHandlers(functions); + + update_notification_event = service_context.CreateEvent("NS_SU::UpdateNotificationEvent"); } private: + Kernel::KEvent* update_notification_event; + KernelHelpers::ServiceContext service_context; + void OpenSystemUpdateControl(HLERequestContext& ctx) { LOG_DEBUG(Service_NS, "called"); @@ -848,6 +932,14 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface(system); } + + void GetSystemUpdateNotificationEventForContentDelivery(HLERequestContext& ctx) { + LOG_ERROR(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(update_notification_event->GetReadableEvent()); + } }; class NS_VM final : public ServiceFramework { @@ -874,6 +966,27 @@ private: } }; +class ISenderService final : public ServiceFramework { +public: + explicit ISenderService(Core::System& system_) : ServiceFramework{system_, "ovln:snd"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ISenderService::OpenSender, "OpenSender"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void OpenSender(HLERequestContext& ctx) { + LOG_ERROR(Service_NS, "(STUBBED) called, check in out"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); @@ -893,6 +1006,9 @@ void LoopProcess(Core::System& system) { std::make_shared(system, "pl:s")); server_manager->RegisterNamedService("pl:u", std::make_shared(system, "pl:u")); + + server_manager->RegisterNamedService("ovln:snd", std::make_shared(system)); + ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 9ee306ef9..e35896a36 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -3,6 +3,7 @@ #pragma once +#include "core/hle/service/kernel_helpers.h" #include "core/hle/service/service.h" namespace Core { @@ -33,9 +34,22 @@ public: u8 application_language); private: + void ListApplicationRecord(HLERequestContext& ctx); + void GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx); void GetApplicationControlData(HLERequestContext& ctx); + void GetGameCardMountFailureEvent(HLERequestContext& ctx); + void CheckSdCardMountStatus(HLERequestContext& ctx); + void GetSdCardMountStatusChangedEvent(HLERequestContext& ctx); + void GetFreeSpaceSize(HLERequestContext& ctx); + void GetGameCardUpdateDetectionEvent(HLERequestContext& ctx); void GetApplicationDesiredLanguage(HLERequestContext& ctx); void ConvertApplicationLanguageToLanguageCode(HLERequestContext& ctx); + + Kernel::KEvent* record_update_system_event; + Kernel::KEvent* gamecard_update_detection_event; + Kernel::KEvent* gamecard_mount_status_event; + Kernel::KEvent* gamecard_mount_failure_event; + KernelHelpers::ServiceContext service_context; }; class IApplicationVersionInterface final : public ServiceFramework { @@ -50,6 +64,7 @@ public: ~IContentManagementInterface() override; private: + void CheckSdCardMountStatus(HLERequestContext& ctx); void GetTotalSpaceSize(HLERequestContext& ctx); void GetFreeSpaceSize(HLERequestContext& ctx); }; @@ -68,6 +83,9 @@ class IDownloadTaskInterface final : public ServiceFramework { diff --git a/src/core/hle/service/olsc/olsc.cpp b/src/core/hle/service/olsc/olsc.cpp index 889f27c31..726a36e98 100644 --- a/src/core/hle/service/olsc/olsc.cpp +++ b/src/core/hle/service/olsc/olsc.cpp @@ -79,12 +79,20 @@ public: : ServiceFramework{system_, "INativeHandleHolder"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "GetNativeHandle"}, + {0, &INativeHandleHolder::GetNativeHandle, "GetNativeHandle"}, }; // clang-format on RegisterHandlers(functions); } + + void GetNativeHandle(HLERequestContext& ctx) { + LOG_ERROR(Service_OLSC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } }; class ITransferTaskListController final : public ServiceFramework { diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp index d508ed28c..e7f6df08e 100644 --- a/src/core/hle/service/vi/vi.cpp +++ b/src/core/hle/service/vi/vi.cpp @@ -154,7 +154,7 @@ public: {2400, nullptr, "OpenIndirectLayer"}, {2401, nullptr, "CloseIndirectLayer"}, {2402, nullptr, "FlipIndirectLayer"}, - {3000, nullptr, "ListDisplayModes"}, + {3000, &ISystemDisplayService::ListDisplayModes, "ListDisplayModes"}, {3001, nullptr, "ListDisplayRgbRanges"}, {3002, nullptr, "ListDisplayContentTypes"}, {3200, &ISystemDisplayService::GetDisplayMode, "GetDisplayMode"}, @@ -321,6 +321,28 @@ private: rb.Push(ResultSuccess); } + void ListDisplayModes(HLERequestContext& ctx) { + struct DisplayInfo { + u8 unknownString[0x40]; + bool unknownBool; + INSERT_PADDING_BYTES(0x7); + u64 unknownU64_1; + u64 unknownU64_2; + u64 unknownU64_3; + }; + static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo is an invalid size"); + + LOG_WARNING(Service_VI, "(STUBBED) called"); + + std::vector display_modes(1); + + ctx.WriteBuffer(display_modes); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(1); + } + void GetDisplayMode(HLERequestContext& ctx) { LOG_WARNING(Service_VI, "(STUBBED) called");