From 17fb8f2f29675306560e53fc46804598a4601cc9 Mon Sep 17 00:00:00 2001 From: german77 Date: Sat, 5 Aug 2023 21:05:25 -0600 Subject: [PATCH] service: Add even more stubs for Qlaunch --- src/core/hle/api_version.h | 6 +- src/core/hle/service/acc/acc.cpp | 21 ++- src/core/hle/service/am/am.cpp | 164 +++++++++++++++++- src/core/hle/service/am/am.h | 24 +++ src/core/hle/service/am/applet_ae.cpp | 122 ++++++++++++- src/core/hle/service/am/applet_ae.h | 1 + src/core/hle/service/audio/audctl.cpp | 16 +- src/core/hle/service/audio/audctl.h | 6 + src/core/hle/service/bcat/bcat_module.cpp | 125 +++++++++++-- src/core/hle/service/caps/caps_a.cpp | 25 ++- src/core/hle/service/caps/caps_a.h | 1 + src/core/hle/service/erpt/erpt.cpp | 11 +- src/core/hle/service/friend/friend.cpp | 49 +++++- src/core/hle/service/glue/glue_manager.cpp | 8 +- src/core/hle/service/lbl/lbl.cpp | 20 ++- src/core/hle/service/ldn/ldn.cpp | 4 +- src/core/hle/service/nifm/nifm.cpp | 4 +- src/core/hle/service/npns/npns.cpp | 33 +++- src/core/hle/service/ns/ns.cpp | 143 +++++++++++++-- src/core/hle/service/ns/ns.h | 46 +++++ src/core/hle/service/pctl/pctl_module.cpp | 65 ++++++- src/core/hle/service/psc/psc.cpp | 40 +++++ src/core/hle/service/set/settings_server.cpp | 4 +- .../hle/service/set/system_settings_server.h | 1 + src/yuzu/game_list_worker.cpp | 16 ++ src/yuzu/main.cpp | 27 ++- src/yuzu/main.h | 1 + src/yuzu/main.ui | 6 + 28 files changed, 924 insertions(+), 65 deletions(-) diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h index bd15606e1..53822c221 100644 --- a/src/core/hle/api_version.h +++ b/src/core/hle/api_version.h @@ -11,7 +11,7 @@ namespace HLE::ApiVersion { // Horizon OS version constants. -constexpr u8 HOS_VERSION_MAJOR = 12; +constexpr u8 HOS_VERSION_MAJOR = 16; constexpr u8 HOS_VERSION_MINOR = 1; constexpr u8 HOS_VERSION_MICRO = 0; @@ -22,8 +22,8 @@ constexpr u8 SDK_REVISION_MINOR = 0; constexpr char PLATFORM_STRING[] = "NX"; constexpr char VERSION_HASH[] = "76b10c2dab7d3aa73fc162f8dff1655e6a21caf4"; -constexpr char DISPLAY_VERSION[] = "12.1.0"; -constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 12.1.0-1.0"; +constexpr char DISPLAY_VERSION[] = "16.1.0"; +constexpr char DISPLAY_TITLE[] = "NintendoSDK Firmware for NX 16.1.0-1.0"; // Atmosphere version constants. diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index f21553644..b71e9cbf0 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -96,9 +96,10 @@ public: {133, nullptr, "GetNintendoAccountVerificationUrlCache"}, // 9.0.0+ {134, nullptr, "RefreshNintendoAccountVerificationUrlCache"}, // 9.0.0+ {135, nullptr, "RefreshNintendoAccountVerificationUrlCacheAsyncIfSecondsElapsed"}, // 9.0.0+ - {140, nullptr, "GetNetworkServiceLicenseCache"}, // 5.0.0+ + {140, &IManagerForSystemService::GetNetworkServiceLicenseCache, "GetNetworkServiceLicenseCache"}, // 5.0.0+ {141, nullptr, "RefreshNetworkServiceLicenseCacheAsync"}, // 5.0.0+ {142, nullptr, "RefreshNetworkServiceLicenseCacheAsyncIfSecondsElapsed"}, // 5.0.0+ + {143, &IManagerForSystemService::Unknown143, "Unknown143"}, {150, nullptr, "CreateAuthorizationRequest"}, {160, nullptr, "RequiresUpdateNetworkServiceAccountIdTokenCache"}, {161, nullptr, "RequireReauthenticationOfNetworkServiceAccount"}, @@ -114,6 +115,24 @@ private: IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); } + + void GetNetworkServiceLicenseCache(HLERequestContext& ctx) { + LOG_ERROR(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.Push(0); + rb.Push(0); + } + + void Unknown143(HLERequestContext& ctx) { + LOG_ERROR(Service_ACC, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 6}; + rb.Push(ResultSuccess); + rb.Push(0); + rb.Push(0); + } }; // 3.0.0+ diff --git a/src/core/hle/service/am/am.cpp b/src/core/hle/service/am/am.cpp index f3a7e452c..99cf9b885 100644 --- a/src/core/hle/service/am/am.cpp +++ b/src/core/hle/service/am/am.cpp @@ -354,7 +354,7 @@ ISelfController::ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& {46, nullptr, "SetRecordingLayerCompositionEnabled"}, {50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"}, {51, &ISelfController::ApproveToDisplay, "ApproveToDisplay"}, - {60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"}, + {60, &ISelfController::OverrideAutoSleepTimeAndDimmingTime, "OverrideAutoSleepTimeAndDimmingTime"}, {61, nullptr, "SetMediaPlaybackState"}, {62, &ISelfController::SetIdleTimeDetectionExtension, "SetIdleTimeDetectionExtension"}, {63, &ISelfController::GetIdleTimeDetectionExtension, "GetIdleTimeDetectionExtension"}, @@ -366,7 +366,7 @@ ISelfController::ISelfController(Core::System& system_, Nvnflinger::Nvnflinger& {69, &ISelfController::IsAutoSleepDisabled, "IsAutoSleepDisabled"}, {70, nullptr, "ReportMultimediaError"}, {71, nullptr, "GetCurrentIlluminanceEx"}, - {72, nullptr, "SetInputDetectionPolicy"}, + {72, &ISelfController::SetInputDetectionPolicy, "SetInputDetectionPolicy"}, {80, nullptr, "SetWirelessPriorityMode"}, {90, &ISelfController::GetAccumulatedSuspendedTickValue, "GetAccumulatedSuspendedTickValue"}, {91, &ISelfController::GetAccumulatedSuspendedTickChangedEvent, "GetAccumulatedSuspendedTickChangedEvent"}, @@ -628,6 +628,18 @@ void ISelfController::ApproveToDisplay(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +void ISelfController::OverrideAutoSleepTimeAndDimmingTime(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto a = rp.Pop(); + const auto b = rp.Pop(); + const auto c = rp.Pop(); + const auto d = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called, a={}, b={}, c={}, d={}",a,b,c,d); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void ISelfController::SetIdleTimeDetectionExtension(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; idle_time_detection_extension = rp.Pop(); @@ -681,6 +693,13 @@ void ISelfController::IsAutoSleepDisabled(HLERequestContext& ctx) { rb.Push(is_auto_sleep_disabled); } +void ISelfController::SetInputDetectionPolicy(HLERequestContext& ctx) { + LOG_ERROR(Service_AM, "called."); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void ISelfController::GetAccumulatedSuspendedTickValue(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called."); @@ -890,7 +909,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, {20, nullptr, "PushToGeneralChannel"}, {30, nullptr, "GetHomeButtonReaderLockAccessor"}, {31, &ICommonStateGetter::GetReaderLockAccessorEx, "GetReaderLockAccessorEx"}, - {32, nullptr, "GetWriterLockAccessorEx"}, + {32, &ICommonStateGetter::GetWriterLockAccessorEx, "GetWriterLockAccessorEx"}, {40, nullptr, "GetCradleFwVersion"}, {50, &ICommonStateGetter::IsVrModeEnabled, "IsVrModeEnabled"}, {51, &ICommonStateGetter::SetVrModeEnabled, "SetVrModeEnabled"}, @@ -914,7 +933,7 @@ ICommonStateGetter::ICommonStateGetter(Core::System& system_, {100, nullptr, "SetHandlingHomeButtonShortPressedEnabled"}, {110, nullptr, "OpenMyGpuErrorHandler"}, {120, nullptr, "GetAppletLaunchedHistory"}, - {200, nullptr, "GetOperationModeSystemInfo"}, + {200, &ICommonStateGetter::GetOperationModeSystemInfo, "GetOperationModeSystemInfo"}, {300, &ICommonStateGetter::GetSettingsPlatformRegion, "GetSettingsPlatformRegion"}, {400, nullptr, "ActivateMigrationService"}, {401, nullptr, "DeactivateMigrationService"}, @@ -1010,6 +1029,15 @@ void ICommonStateGetter::GetAcquiredSleepLockEvent(HLERequestContext& ctx) { rb.PushCopyObjects(sleep_lock_event->GetReadableEvent()); } +void ICommonStateGetter::GetWriterLockAccessorEx(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); +} + void ICommonStateGetter::IsVrModeEnabled(HLERequestContext& ctx) { LOG_DEBUG(Service_AM, "called"); @@ -1104,6 +1132,14 @@ void ICommonStateGetter::PerformSystemButtonPressingIfInFocus(HLERequestContext& rb.Push(ResultSuccess); } +void ICommonStateGetter::GetOperationModeSystemInfo(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); +} + void ICommonStateGetter::GetSettingsPlatformRegion(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); @@ -1601,7 +1637,7 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) {120, nullptr, "GetLaunchStorageInfoForDebug"}, {130, nullptr, "GetGpuErrorDetectedSystemEvent"}, {140, nullptr, "SetApplicationMemoryReservation"}, - {150, &ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually, "ShouldSetGpuTimeSliceManually"}, + {150, &ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually, "ShouldSetGpuTimeSliceManually"}, }; // clang-format on RegisterHandlers(functions); @@ -1622,6 +1658,9 @@ ILibraryAppletSelfAccessor::ILibraryAppletSelfAccessor(Core::System& system_) case Applets::AppletId::Controller: PushInShowController(); break; + case Applets::AppletId::MyPage: + PushInShowMyPageData(); + break; default: PushInShow(); break; @@ -1727,6 +1766,12 @@ void ILibraryAppletSelfAccessor::GetDesirableKeyboardLayout(HLERequestContext& c rb.Push(0); } +void ILibraryAppletSelfAccessor::ShouldSetGpuTimeSliceManually(HLERequestContext& ctx) { + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.PushRaw(0); +} + void ILibraryAppletSelfAccessor::GetMainAppletAvailableUsers(HLERequestContext& ctx) { const Service::Account::ProfileManager manager{}; bool is_empty{true}; @@ -1820,6 +1865,30 @@ void ILibraryAppletSelfAccessor::PushInShowController() { queue_data.emplace_back(std::move(user_args_data)); } +void ILibraryAppletSelfAccessor::PushInShowMyPageData() { + const Applets::CommonArguments arguments{ + .arguments_version = Applets::CommonArgumentVersion::Version1, + .size = Applets::CommonArgumentSize::Version3, + .library_version = static_cast(Applets::CabinetAppletVersion::Version1), + .theme_color = Applets::ThemeColor::BasicBlack, + .play_startup_sound = true, + .system_tick = system.CoreTiming().GetClockTicks(), + }; + + std::vector argument_data(sizeof(arguments)); + std::vector settings_data{0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCE, + 0x9E, 0xF8, 0xAF, 0xB1, 0xE8, 0x95, 0x90, 0x33, 0x6C, + 0x0B, 0x22, 0x70, 0x07, 0xF4, 0xBB, 0x00}; + settings_data.resize(0x10a8); + std::memcpy(argument_data.data(), &arguments, sizeof(arguments)); + + + + + queue_data.emplace_back(std::move(argument_data)); + queue_data.emplace_back(std::move(settings_data)); +} + void ILibraryAppletSelfAccessor::PushInShowCabinetData() { const Applets::CommonArguments arguments{ .arguments_version = Applets::CommonArgumentVersion::Version3, @@ -2586,14 +2655,14 @@ IHomeMenuFunctions::IHomeMenuFunctions(Core::System& system_) // clang-format off static const FunctionInfo functions[] = { {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"}, - {11, nullptr, "LockForeground"}, - {12, nullptr, "UnlockForeground"}, + {11, &IHomeMenuFunctions::LockForeground, "LockForeground"}, + {12, &IHomeMenuFunctions::UnlockForeground, "UnlockForeground"}, {20, nullptr, "PopFromGeneralChannel"}, {21, &IHomeMenuFunctions::GetPopFromGeneralChannelEvent, "GetPopFromGeneralChannelEvent"}, {30, nullptr, "GetHomeButtonWriterLockAccessor"}, {31, nullptr, "GetWriterLockAccessorEx"}, {40, nullptr, "IsSleepEnabled"}, - {41, nullptr, "IsRebootEnabled"}, + {41, &IHomeMenuFunctions::IsRebootEnabled, "IsRebootEnabled"}, {50, nullptr, "LaunchSystemApplet"}, {51, nullptr, "LaunchStarter"}, {100, nullptr, "PopRequestLaunchApplicationForDebug"}, @@ -2620,6 +2689,19 @@ void IHomeMenuFunctions::RequestToGetForeground(HLERequestContext& ctx) { rb.Push(ResultSuccess); } +void IHomeMenuFunctions::LockForeground(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} +void IHomeMenuFunctions::UnlockForeground(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) { LOG_WARNING(Service_AM, "(STUBBED) called"); @@ -2628,6 +2710,62 @@ void IHomeMenuFunctions::GetPopFromGeneralChannelEvent(HLERequestContext& ctx) { rb.PushCopyObjects(pop_from_general_channel_event->GetReadableEvent()); } +void IHomeMenuFunctions::IsRebootEnabled(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + rb.Push(0); +} + +ICradleFirmwareUpdater::ICradleFirmwareUpdater(Core::System& system_) + : ServiceFramework{system_, "ICradleFirmwareUpdater"}, service_context{system, + "IHomeMenuFunctions"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "StartUpdate"}, + {1, &ICradleFirmwareUpdater::FinishUpdate, "FinishUpdate"}, + {2, &ICradleFirmwareUpdater::GetCradleDeviceInfo, "GetCradleDeviceInfo"}, + {3, &ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent, "GetCradleDeviceInfoChangeEvent"}, + {4, nullptr, "GetUpdateProgressInfo"}, + {5, nullptr, "GetLastInternalResult"}, + + }; + // clang-format on + + RegisterHandlers(functions); + + cradle_device_info_event = + service_context.CreateEvent("IHomeMenuFunctions:PopFromGeneralChannelEvent"); +} + +ICradleFirmwareUpdater::~ICradleFirmwareUpdater() { + service_context.CloseEvent(cradle_device_info_event); +} + +void ICradleFirmwareUpdater::FinishUpdate(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} +void ICradleFirmwareUpdater::GetCradleDeviceInfo(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 5}; + rb.Push(ResultSuccess); + rb.Push(0); + rb.Push(0); +} + +void ICradleFirmwareUpdater::GetCradleDeviceInfoChangeEvent(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(cradle_device_info_event->GetReadableEvent()); +} + IGlobalStateController::IGlobalStateController(Core::System& system_) : ServiceFramework{system_, "IGlobalStateController"}, service_context{system_, "IGlobalStateController"} { @@ -2645,7 +2783,7 @@ IGlobalStateController::IGlobalStateController(Core::System& system_) {13, nullptr, "UpdateDefaultDisplayResolution"}, {14, &IGlobalStateController::ShouldSleepOnBoot, "ShouldSleepOnBoot"}, {15, &IGlobalStateController::GetHdcpAuthenticationFailedEvent, "GetHdcpAuthenticationFailedEvent"}, - {30, nullptr, "OpenCradleFirmwareUpdater"}, + {30, &IGlobalStateController::OpenCradleFirmwareUpdater, "OpenCradleFirmwareUpdater"}, }; // clang-format on @@ -2673,6 +2811,14 @@ void IGlobalStateController::GetHdcpAuthenticationFailedEvent(HLERequestContext& rb.PushCopyObjects(hdcp_authentification_failed_event->GetReadableEvent()); } +void IGlobalStateController::OpenCradleFirmwareUpdater(HLERequestContext& ctx) { + LOG_ERROR(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); +} + IApplicationCreator::IApplicationCreator(Core::System& system_) : ServiceFramework{system_, "IApplicationCreator"} { // clang-format off diff --git a/src/core/hle/service/am/am.h b/src/core/hle/service/am/am.h index 13946bf87..d5a7c8ea6 100644 --- a/src/core/hle/service/am/am.h +++ b/src/core/hle/service/am/am.h @@ -163,11 +163,13 @@ private: void CreateManagedDisplaySeparableLayer(HLERequestContext& ctx); void SetHandlesRequestToDisplay(HLERequestContext& ctx); void ApproveToDisplay(HLERequestContext& ctx); + void OverrideAutoSleepTimeAndDimmingTime(HLERequestContext& ctx); void SetIdleTimeDetectionExtension(HLERequestContext& ctx); void GetIdleTimeDetectionExtension(HLERequestContext& ctx); void ReportUserIsActive(HLERequestContext& ctx); void SetAutoSleepDisabled(HLERequestContext& ctx); void IsAutoSleepDisabled(HLERequestContext& ctx); + void SetInputDetectionPolicy(HLERequestContext& ctx); void GetAccumulatedSuspendedTickValue(HLERequestContext& ctx); void GetAccumulatedSuspendedTickChangedEvent(HLERequestContext& ctx); void SetAlbumImageTakenNotificationEnabled(HLERequestContext& ctx); @@ -258,6 +260,7 @@ private: void RequestToAcquireSleepLock(HLERequestContext& ctx); void GetAcquiredSleepLockEvent(HLERequestContext& ctx); void GetReaderLockAccessorEx(HLERequestContext& ctx); + void GetWriterLockAccessorEx(HLERequestContext& ctx); void GetDefaultDisplayResolutionChangeEvent(HLERequestContext& ctx); void GetOperationMode(HLERequestContext& ctx); void GetPerformanceMode(HLERequestContext& ctx); @@ -271,6 +274,7 @@ private: void SetCpuBoostMode(HLERequestContext& ctx); void GetBuiltInDisplayType(HLERequestContext& ctx); void PerformSystemButtonPressingIfInFocus(HLERequestContext& ctx); + void GetOperationModeSystemInfo(HLERequestContext& ctx); void GetSettingsPlatformRegion(HLERequestContext& ctx); void SetRequestExitToLibraryAppletAtExecuteNextProgramEnabled(HLERequestContext& ctx); @@ -354,6 +358,7 @@ private: void ShouldSetGpuTimeSliceManually(HLERequestContext& ctx); void PushInShowAlbum(); + void PushInShowMyPageData(); void PushInShowCabinetData(); void PushInShow(); void PushInShowMiiEditData(); @@ -431,13 +436,31 @@ public: private: void RequestToGetForeground(HLERequestContext& ctx); + void LockForeground(HLERequestContext& ctx); + void UnlockForeground(HLERequestContext& ctx); void GetPopFromGeneralChannelEvent(HLERequestContext& ctx); + void IsRebootEnabled(HLERequestContext& ctx); KernelHelpers::ServiceContext service_context; Kernel::KEvent* pop_from_general_channel_event; }; +class ICradleFirmwareUpdater final : public ServiceFramework { +public: + explicit ICradleFirmwareUpdater(Core::System& system_); + ~ICradleFirmwareUpdater() override; + +private: + void FinishUpdate(HLERequestContext& ctx); + void GetCradleDeviceInfo(HLERequestContext& ctx); + void GetCradleDeviceInfoChangeEvent(HLERequestContext& ctx); + + KernelHelpers::ServiceContext service_context; + + Kernel::KEvent* cradle_device_info_event; +}; + class IGlobalStateController final : public ServiceFramework { public: explicit IGlobalStateController(Core::System& system_); @@ -446,6 +469,7 @@ public: private: void ShouldSleepOnBoot(HLERequestContext& ctx); void GetHdcpAuthenticationFailedEvent(HLERequestContext& ctx); + void OpenCradleFirmwareUpdater(HLERequestContext& ctx); Kernel::KEvent* hdcp_authentification_failed_event; KernelHelpers::ServiceContext service_context; diff --git a/src/core/hle/service/am/applet_ae.cpp b/src/core/hle/service/am/applet_ae.cpp index e30e6478a..d3e5ea9c6 100644 --- a/src/core/hle/service/am/applet_ae.cpp +++ b/src/core/hle/service/am/applet_ae.cpp @@ -138,6 +138,118 @@ private: std::shared_ptr msg_queue; }; +class IOverlayAppletProxy final : public ServiceFramework { +public: + explicit IOverlayAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_, + std::shared_ptr msg_queue_, + Core::System& system_) + : ServiceFramework{system_, "IOverlayAppletProxy"}, nvnflinger{nvnflinger_}, + msg_queue{std::move(msg_queue_)} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IOverlayAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"}, + {1, &IOverlayAppletProxy::GetSelfController, "GetSelfController"}, + {2, &IOverlayAppletProxy::GetWindowController, "GetWindowController"}, + {3, &IOverlayAppletProxy::GetAudioController, "GetAudioController"}, + {4, &IOverlayAppletProxy::GetDisplayController, "GetDisplayController"}, + {10, &IOverlayAppletProxy::GetProcessWindingController, "GetProcessWindingController"}, + {11, &IOverlayAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"}, + {20, &IOverlayAppletProxy::OpenLibraryAppletSelfAccessor, "OpenLibraryAppletSelfAccessor"}, + {21, &IOverlayAppletProxy::GetAppletCommonFunctions, "GetAppletCommonFunctions"}, + {22, nullptr, "GetHomeMenuFunctions"}, + {23, nullptr, "GetGlobalStateController"}, + {1000, &IOverlayAppletProxy::GetDebugFunctions, "GetDebugFunctions"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void GetCommonStateGetter(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system, msg_queue); + } + + void GetSelfController(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system, nvnflinger); + } + + void GetWindowController(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetAudioController(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetDisplayController(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetProcessWindingController(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetLibraryAppletCreator(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void OpenLibraryAppletSelfAccessor(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetAppletCommonFunctions(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + void GetDebugFunctions(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + + Nvnflinger::Nvnflinger& nvnflinger; + std::shared_ptr msg_queue; +}; + class ISystemAppletProxy final : public ServiceFramework { public: explicit ISystemAppletProxy(Nvnflinger::Nvnflinger& nvnflinger_, @@ -282,6 +394,14 @@ void AppletAE::OpenLibraryAppletProxyOld(HLERequestContext& ctx) { rb.PushIpcInterface(nvnflinger, msg_queue, system); } +void AppletAE::OpenOverlayAppletProxy(HLERequestContext& ctx) { + LOG_DEBUG(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(nvnflinger, msg_queue, system); +} + AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, std::shared_ptr msg_queue_, Core::System& system_) : ServiceFramework{system_, "appletAE"}, nvnflinger{nvnflinger_}, msg_queue{ @@ -291,7 +411,7 @@ AppletAE::AppletAE(Nvnflinger::Nvnflinger& nvnflinger_, {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"}, {200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"}, {201, &AppletAE::OpenLibraryAppletProxy, "OpenLibraryAppletProxy"}, - {300, nullptr, "OpenOverlayAppletProxy"}, + {300, &AppletAE::OpenOverlayAppletProxy, "OpenOverlayAppletProxy"}, {350, nullptr, "OpenSystemApplicationProxy"}, {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"}, {410, nullptr, "GetSystemAppletControllerForDebug"}, diff --git a/src/core/hle/service/am/applet_ae.h b/src/core/hle/service/am/applet_ae.h index 538ce2903..3b0adb2e4 100644 --- a/src/core/hle/service/am/applet_ae.h +++ b/src/core/hle/service/am/applet_ae.h @@ -32,6 +32,7 @@ private: void OpenSystemAppletProxy(HLERequestContext& ctx); void OpenLibraryAppletProxy(HLERequestContext& ctx); void OpenLibraryAppletProxyOld(HLERequestContext& ctx); + void OpenOverlayAppletProxy(HLERequestContext& ctx); Nvnflinger::Nvnflinger& nvnflinger; std::shared_ptr msg_queue; diff --git a/src/core/hle/service/audio/audctl.cpp b/src/core/hle/service/audio/audctl.cpp index 66dd64fd1..60c9d3f05 100644 --- a/src/core/hle/service/audio/audctl.cpp +++ b/src/core/hle/service/audio/audctl.cpp @@ -7,7 +7,8 @@ namespace Service::Audio { -AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { +AudCtl::AudCtl(Core::System& system_) + : ServiceFramework{system_, "audctl"}, service_context{system, "audctl"} { // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetTargetVolume"}, @@ -44,7 +45,7 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { {31, &AudCtl::IsSpeakerAutoMuteEnabled, "IsSpeakerAutoMuteEnabled"}, {32, nullptr, "GetActiveOutputTarget"}, {33, nullptr, "GetTargetDeviceInfo"}, - {34, nullptr, "AcquireTargetNotification"}, + {34, &AudCtl::AcquireTargetNotification, "AcquireTargetNotification"}, {35, nullptr, "SetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, {36, nullptr, "GetHearingProtectionSafeguardTimerRemainingTimeForDebug"}, {37, nullptr, "SetHearingProtectionSafeguardEnabled"}, @@ -68,6 +69,9 @@ AudCtl::AudCtl(Core::System& system_) : ServiceFramework{system_, "audctl"} { // clang-format on RegisterHandlers(functions); + + notification_event = + service_context.CreateEvent("audctl:NotificationEvent"); } AudCtl::~AudCtl() = default; @@ -134,4 +138,12 @@ void AudCtl::IsSpeakerAutoMuteEnabled(HLERequestContext& ctx) { rb.Push(is_speaker_auto_mute_enabled); } +void AudCtl::AcquireTargetNotification(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(notification_event->GetReadableEvent()); +} + } // namespace Service::Audio diff --git a/src/core/hle/service/audio/audctl.h b/src/core/hle/service/audio/audctl.h index d57abb383..8e6587459 100644 --- a/src/core/hle/service/audio/audctl.h +++ b/src/core/hle/service/audio/audctl.h @@ -4,6 +4,7 @@ #pragma once #include "core/hle/service/service.h" +#include "core/hle/service/kernel_helpers.h" namespace Core { class System; @@ -41,6 +42,11 @@ private: void GetOutputModeSetting(HLERequestContext& ctx); void GetHeadphoneOutputLevelMode(HLERequestContext& ctx); void IsSpeakerAutoMuteEnabled(HLERequestContext& ctx); + void AcquireTargetNotification(HLERequestContext& ctx); + + KernelHelpers::ServiceContext service_context; + + Kernel::KEvent* notification_event; }; } // namespace Service::Audio diff --git a/src/core/hle/service/bcat/bcat_module.cpp b/src/core/hle/service/bcat/bcat_module.cpp index f1c116b40..f6f3ca39c 100644 --- a/src/core/hle/service/bcat/bcat_module.cpp +++ b/src/core/hle/service/bcat/bcat_module.cpp @@ -596,12 +596,12 @@ public: explicit INewsService(Core::System& system_) : ServiceFramework{system_, "INewsService"} { // clang-format off static const FunctionInfo functions[] = { - {10100, nullptr, "PostLocalNews"}, + {10100, &INewsService::PostLocalNews, "PostLocalNews"}, {20100, nullptr, "SetPassphrase"}, {30100, &INewsService::GetSubscriptionStatus, "GetSubscriptionStatus"}, {30101, nullptr, "GetTopicList"}, {30110, nullptr, "Unknown30110"}, - {30200, nullptr, "IsSystemUpdateRequired"}, + {30200, &INewsService::IsSystemUpdateRequired, "IsSystemUpdateRequired"}, {30201, nullptr, "Unknown30201"}, {30210, nullptr, "Unknown30210"}, {30300, nullptr, "RequestImmediateReception"}, @@ -611,7 +611,7 @@ public: {30901, nullptr, "Unknown30901"}, {30902, nullptr, "Unknown30902"}, {40100, nullptr, "SetSubscriptionStatus"}, - {40101, nullptr, "RequestAutoSubscription"}, + {40101, &INewsService::RequestAutoSubscription, "RequestAutoSubscription"}, {40200, nullptr, "ClearStorage"}, {40201, nullptr, "ClearSubscriptionStatusAll"}, {90100, nullptr, "GetNewsDatabaseDump"}, @@ -622,6 +622,15 @@ public: } private: + void PostLocalNews(HLERequestContext& ctx) { + const auto buffer_data = ctx.ReadBuffer(); + + LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void GetSubscriptionStatus(HLERequestContext& ctx) { const auto buffer_data = ctx.ReadBuffer(); @@ -631,6 +640,54 @@ private: rb.Push(ResultSuccess); rb.Push(0); } + void IsSystemUpdateRequired(HLERequestContext& ctx) { + LOG_WARNING(Service_BCAT, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + void RequestAutoSubscription(HLERequestContext& ctx) { + LOG_WARNING(Service_BCAT, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } +}; + +class INewsDataService final : public ServiceFramework { +public: + explicit INewsDataService(Core::System& system_) + : ServiceFramework{system_, "INewsDataService"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Open"}, + {1, &INewsDataService::OpenWithNewsRecord, "OpenWithNewsRecordV1"}, + {2, &INewsDataService::Read, "Read"}, + {3, nullptr, "GetSize"}, + {1001, nullptr, "OpenWithNewsRecord"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void OpenWithNewsRecord(HLERequestContext& ctx) { + LOG_WARNING(Service_BCAT, "(STUBBED) called" + ); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void Read(HLERequestContext& ctx) { + LOG_WARNING(Service_BCAT, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 4}; + rb.Push(ResultSuccess); + rb.Push(0); + } }; class INewsDatabaseService final : public ServiceFramework { @@ -643,9 +700,9 @@ public: {1, &INewsDatabaseService::Count, "Count"}, {2, nullptr, "CountWithKey"}, {3, nullptr, "UpdateIntegerValue"}, - {4, nullptr, "UpdateIntegerValueWithAddition"}, + {4, &INewsDatabaseService::UpdateIntegerValueWithAddition, "UpdateIntegerValueWithAddition"}, {5, nullptr, "UpdateStringValue"}, - {1000, nullptr, "GetList"}, + {1000, &INewsDatabaseService::GetList, "GetList"}, }; // clang-format on @@ -658,6 +715,26 @@ private: LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={}", buffer_data.size()); + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + void UpdateIntegerValueWithAddition(HLERequestContext& ctx) { + const auto buffer_data = ctx.ReadBuffer(); + const auto buffer_data2 = ctx.ReadBuffer(); + + LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={} {}", buffer_data.size(), buffer_data2.size()); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void GetList(HLERequestContext& ctx) { + const auto buffer_data = ctx.ReadBuffer(); + const auto buffer_data2 = ctx.ReadBuffer(); + + LOG_WARNING(Service_BCAT, "(STUBBED) called, buffer_size={} {}", buffer_data.size(), + buffer_data2.size()); + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); rb.Push(0); @@ -667,9 +744,8 @@ private: class INewlyArrivedEventHolder final : public ServiceFramework { public: explicit INewlyArrivedEventHolder(Core::System& system_) - : ServiceFramework{system_, "INewlyArrivedEventHolder"}, service_context{ - system_, - "INewlyArrivedEventHolder"} { + : ServiceFramework{system_, "INewlyArrivedEventHolder"}, + service_context{system_, "INewlyArrivedEventHolder"} { // clang-format off static const FunctionInfo functions[] = { {0, &INewlyArrivedEventHolder::Get, "Get"}, @@ -696,9 +772,8 @@ private: class IOverwriteEventHolder final : public ServiceFramework { public: explicit IOverwriteEventHolder(Core::System& system_) - : ServiceFramework{system_, "IOverwriteEventHolder"}, service_context{ - system_, - "IOverwriteEventHolder"} { + : ServiceFramework{system_, "IOverwriteEventHolder"}, + service_context{system_, "IOverwriteEventHolder"} { // clang-format off static const FunctionInfo functions[] = { {0, &IOverwriteEventHolder::Get, "Get"}, @@ -729,7 +804,7 @@ public: static const FunctionInfo functions[] = { {0, &News::CreateNewsService, "CreateNewsService"}, {1, &News::CreateNewlyArrivedEventHolder, "CreateNewlyArrivedEventHolder"}, - {2, nullptr, "CreateNewsDataService"}, + {2, &News::CreateNewsDataService, "CreateNewsDataService"}, {3, &News::CreateNewsDatabaseService, "CreateNewsDatabaseService"}, {4, &News::CreateOverwriteEventHolder, "CreateOverwriteEventHolder"}, }; @@ -755,6 +830,14 @@ private: rb.PushIpcInterface(system); } + void CreateNewsDataService(HLERequestContext& ctx) { + LOG_INFO(Service_BCAT, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } + void CreateNewsDatabaseService(HLERequestContext& ctx) { LOG_INFO(Service_BCAT, "called"); @@ -772,6 +855,23 @@ private: } }; +class MNPPSYS final : public ServiceFramework { +public: + explicit MNPPSYS(Core::System& system_) : ServiceFramework{system_, "mnpp:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "Unknown0"}, + {100, nullptr, "Unknown100"}, + {200, nullptr, "Unknown200"}, + {300, nullptr, "Unknown300"}, + {400, nullptr, "Unknown400"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); auto module = std::make_shared(); @@ -790,6 +890,7 @@ void LoopProcess(Core::System& system) { std::make_shared(system, module, system.GetFileSystemController(), "bcat:s")); server_manager->RegisterNamedService("news:p", std::make_shared(system)); + server_manager->RegisterNamedService("mnpp:sys", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/caps/caps_a.cpp b/src/core/hle/service/caps/caps_a.cpp index 9925720a3..ccb53dfa1 100644 --- a/src/core/hle/service/caps/caps_a.cpp +++ b/src/core/hle/service/caps/caps_a.cpp @@ -16,7 +16,7 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, // clang-format off static const FunctionInfo functions[] = { {0, nullptr, "GetAlbumFileCount"}, - {1, nullptr, "GetAlbumFileList"}, + {1, &IAlbumAccessorService::GetAlbumFileList, "GetAlbumFileList"}, {2, nullptr, "LoadAlbumFile"}, {3, &IAlbumAccessorService::DeleteAlbumFile, "DeleteAlbumFile"}, {4, nullptr, "StorageCopyAlbumFile"}, @@ -62,6 +62,29 @@ IAlbumAccessorService::IAlbumAccessorService(Core::System& system_, IAlbumAccessorService::~IAlbumAccessorService() = default; +void IAlbumAccessorService::GetAlbumFileList(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto storage{rp.PopEnum()}; + const auto album_entry_size{ctx.GetWriteBufferNumElements()}; + + LOG_INFO(Service_Capture, "called, storage={}", storage); + + std::vector entries; + Result result = manager->GetAlbumFileList(entries, storage, 0); + result = TranslateResult(result); + + entries.resize(std::min(album_entry_size, entries.size())); + + if (!entries.empty()) { + ctx.WriteBuffer(entries); + } + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(result); + rb.Push(entries.size()); +} + + void IAlbumAccessorService::DeleteAlbumFile(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto file_id{rp.PopRaw()}; diff --git a/src/core/hle/service/caps/caps_a.h b/src/core/hle/service/caps/caps_a.h index c90cff71e..ddd16cdeb 100644 --- a/src/core/hle/service/caps/caps_a.h +++ b/src/core/hle/service/caps/caps_a.h @@ -19,6 +19,7 @@ public: ~IAlbumAccessorService() override; private: + void GetAlbumFileList(HLERequestContext& ctx); void DeleteAlbumFile(HLERequestContext& ctx); void IsAlbumMounted(HLERequestContext& ctx); void Unknown18(HLERequestContext& ctx); diff --git a/src/core/hle/service/erpt/erpt.cpp b/src/core/hle/service/erpt/erpt.cpp index 3ea862fad..99ff5885d 100644 --- a/src/core/hle/service/erpt/erpt.cpp +++ b/src/core/hle/service/erpt/erpt.cpp @@ -5,6 +5,7 @@ #include "core/hle/service/erpt/erpt.h" #include "core/hle/service/server_manager.h" +#include "core/hle/service/ipc_helpers.h" #include "core/hle/service/service.h" #include "core/hle/service/sm/sm.h" @@ -15,7 +16,7 @@ public: explicit ErrorReportContext(Core::System& system_) : ServiceFramework{system_, "erpt:c"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "SubmitContext"}, + {0, &ErrorReportContext::SubmitContext, "SubmitContext"}, {1, nullptr, "CreateReportV0"}, {2, nullptr, "SetInitialLaunchSettingsCompletionTime"}, {3, nullptr, "ClearInitialLaunchSettingsCompletionTime"}, @@ -36,6 +37,14 @@ public: RegisterHandlers(functions); } + +private: + void SubmitContext(HLERequestContext& ctx) { + LOG_WARNING(Service_SET, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } }; class ErrorReportSession final : public ServiceFramework { diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp index aeb849efa..318d7c1ae 100644 --- a/src/core/hle/service/friend/friend.cpp +++ b/src/core/hle/service/friend/friend.cpp @@ -42,13 +42,13 @@ public: {10701, nullptr, "GetPlayHistoryRegistrationKeyWithNetworkServiceAccountId"}, {10702, nullptr, "AddPlayHistory"}, {11000, nullptr, "GetProfileImageUrl"}, - {20100, nullptr, "GetFriendCount"}, - {20101, nullptr, "GetNewlyFriendCount"}, + {20100, &IFriendService::GetFriendCount, "GetFriendCount"}, + {20101, &IFriendService::GetNewlyFriendCount, "GetNewlyFriendCount"}, {20102, nullptr, "GetFriendDetailedInfo"}, {20103, nullptr, "SyncFriendList"}, {20104, nullptr, "RequestSyncFriendList"}, {20110, nullptr, "LoadFriendSetting"}, - {20200, nullptr, "GetReceivedFriendRequestCount"}, + {20200, &IFriendService::GetReceivedFriendRequestCount, "GetReceivedFriendRequestCount"}, {20201, nullptr, "GetFriendRequestList"}, {20300, nullptr, "GetFriendCandidateList"}, {20301, nullptr, "GetNintendoNetworkIdInfo"}, @@ -61,14 +61,14 @@ public: {20501, nullptr, "GetRelationship"}, {20600, nullptr, "GetUserPresenceView"}, {20700, nullptr, "GetPlayHistoryList"}, - {20701, nullptr, "GetPlayHistoryStatistics"}, + {20701, &IFriendService::GetPlayHistoryStatistics, "GetPlayHistoryStatistics"}, {20800, nullptr, "LoadUserSetting"}, {20801, nullptr, "SyncUserSetting"}, {20900, nullptr, "RequestListSummaryOverlayNotification"}, {21000, nullptr, "GetExternalApplicationCatalog"}, {22000, nullptr, "GetReceivedFriendInvitationList"}, {22001, nullptr, "GetReceivedFriendInvitationDetailedInfo"}, - {22010, nullptr, "GetReceivedFriendInvitationCountCache"}, + {22010, &IFriendService::GetReceivedFriendInvitationCountCache, "GetReceivedFriendInvitationCountCache"}, {30100, nullptr, "DropFriendNewlyFlags"}, {30101, nullptr, "DeleteFriend"}, {30110, nullptr, "DropFriendNewlyFlag"}, @@ -179,6 +179,30 @@ private: rb.Push(ResultSuccess); } + void GetFriendCount(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + + void GetNewlyFriendCount(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + + void GetReceivedFriendRequestCount(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + void GetFriendList(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto friend_offset = rp.Pop(); @@ -217,6 +241,21 @@ private: rb.Push(true); } + void GetPlayHistoryStatistics(HLERequestContext& ctx) { + LOG_ERROR(Service_Friend, "(STUBBED) called, check in out"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void GetReceivedFriendInvitationCountCache(HLERequestContext& ctx) { + LOG_DEBUG(Service_Friend, "(STUBBED) called, check in out"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + KernelHelpers::ServiceContext service_context; Kernel::KEvent* completion_event; diff --git a/src/core/hle/service/glue/glue_manager.cpp b/src/core/hle/service/glue/glue_manager.cpp index 22f001704..ccec09cd1 100644 --- a/src/core/hle/service/glue/glue_manager.cpp +++ b/src/core/hle/service/glue/glue_manager.cpp @@ -37,7 +37,13 @@ Result ARPManager::GetControlProperty(std::vector* out_control_property, u64 const auto iter = entries.find(title_id); if (iter == entries.end()) { - return Glue::ResultProcessIdNotRegistered; + if (entries.empty()) { + return Glue::ResultProcessIdNotRegistered; + } + + *out_control_property = entries.begin()->second.control; + return ResultSuccess; + } *out_control_property = iter->second.control; diff --git a/src/core/hle/service/lbl/lbl.cpp b/src/core/hle/service/lbl/lbl.cpp index e06fd56e0..7849706cb 100644 --- a/src/core/hle/service/lbl/lbl.cpp +++ b/src/core/hle/service/lbl/lbl.cpp @@ -18,7 +18,7 @@ public: explicit LBL(Core::System& system_) : ServiceFramework{system_, "lbl"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "SaveCurrentSetting"}, + {0, &LBL::SaveCurrentSetting, "SaveCurrentSetting"}, {1, &LBL::LoadCurrentSetting, "LoadCurrentSetting"}, {2, &LBL::SetCurrentBrightnessSetting, "SetCurrentBrightnessSetting"}, {3, &LBL::GetCurrentBrightnessSetting, "GetCurrentBrightnessSetting"}, @@ -47,7 +47,7 @@ public: {26, &LBL::EnableVrMode, "EnableVrMode"}, {27, &LBL::DisableVrMode, "DisableVrMode"}, {28, &LBL::IsVrModeEnabled, "IsVrModeEnabled"}, - {29, nullptr, "IsAutoBrightnessControlSupported"}, + {29, &LBL::IsAutoBrightnessControlSupported, "IsAutoBrightnessControlSupported"}, }; // clang-format on @@ -60,6 +60,13 @@ private: On = 1, }; + void SaveCurrentSetting(HLERequestContext& ctx) { + LOG_WARNING(Service_LBL, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + void LoadCurrentSetting(HLERequestContext& ctx) { LOG_WARNING(Service_LBL, "(STUBBED) called"); @@ -317,6 +324,14 @@ private: rb.Push(vr_mode_enabled); } + void IsAutoBrightnessControlSupported(HLERequestContext& ctx) { + LOG_DEBUG(Service_LBL, "called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(auto_brightness_supported); + } + bool vr_mode_enabled = false; float current_brightness = 1.0f; float ambient_light_value = 0.0f; @@ -325,6 +340,7 @@ private: bool backlight_enabled = true; bool update_instantly = false; bool auto_brightness = false; // TODO(ogniK): Move to system settings + bool auto_brightness_supported = true; }; void LoopProcess(Core::System& system) { diff --git a/src/core/hle/service/ldn/ldn.cpp b/src/core/hle/service/ldn/ldn.cpp index 961f89a14..b23934772 100644 --- a/src/core/hle/service/ldn/ldn.cpp +++ b/src/core/hle/service/ldn/ldn.cpp @@ -39,7 +39,7 @@ public: private: void GetStateForMonitor(HLERequestContext& ctx) { - LOG_INFO(Service_LDN, "called"); + LOG_DEBUG(Service_LDN, "called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -784,7 +784,7 @@ private: } void GetGroupInfo(HLERequestContext& ctx) { - LOG_WARNING(Service_LDN, "(STUBBED) called"); + LOG_DEBUG(Service_LDN, "(STUBBED) called"); struct GroupInfo { std::array info; diff --git a/src/core/hle/service/nifm/nifm.cpp b/src/core/hle/service/nifm/nifm.cpp index 22dc55a6d..870586b04 100644 --- a/src/core/hle/service/nifm/nifm.cpp +++ b/src/core/hle/service/nifm/nifm.cpp @@ -497,7 +497,7 @@ void IGeneralService::GetCurrentIpConfigInfo(HLERequestContext& ctx) { } void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { - LOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_DEBUG(Service_NIFM, "(STUBBED) called"); IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); @@ -505,7 +505,7 @@ void IGeneralService::IsWirelessCommunicationEnabled(HLERequestContext& ctx) { } void IGeneralService::GetInternetConnectionStatus(HLERequestContext& ctx) { - LOG_WARNING(Service_NIFM, "(STUBBED) called"); + LOG_DEBUG(Service_NIFM, "(STUBBED) called"); struct Output { u8 type{static_cast(NetworkInterfaceType::WiFi_Ieee80211)}; diff --git a/src/core/hle/service/npns/npns.cpp b/src/core/hle/service/npns/npns.cpp index a162e5c54..621e98be0 100644 --- a/src/core/hle/service/npns/npns.cpp +++ b/src/core/hle/service/npns/npns.cpp @@ -6,19 +6,23 @@ #include "core/hle/service/npns/npns.h" #include "core/hle/service/server_manager.h" #include "core/hle/service/service.h" +#include "core/hle/service/ipc_helpers.h" +#include "core/hle/kernel/k_event.h" +#include "core/hle/service/kernel_helpers.h" namespace Service::NPNS { class NPNS_S final : public ServiceFramework { public: - explicit NPNS_S(Core::System& system_) : ServiceFramework{system_, "npns:s"} { + explicit NPNS_S(Core::System& system_) + : ServiceFramework{system_, "npns:s"}, service_context{system, "npns:s"} { // clang-format off static const FunctionInfo functions[] = { {1, nullptr, "ListenAll"}, - {2, nullptr, "ListenTo"}, + {2, &NPNS_S::ListenTo, "ListenTo"}, {3, nullptr, "Receive"}, {4, nullptr, "ReceiveRaw"}, - {5, nullptr, "GetReceiveEvent"}, + {5, &NPNS_S::GetReceiveEvent, "GetReceiveEvent"}, {6, nullptr, "ListenUndelivered"}, {7, nullptr, "GetStateChangeEVent"}, {11, nullptr, "SubscribeTopic"}, @@ -59,7 +63,30 @@ public: // clang-format on RegisterHandlers(functions); + + get_recieve_event = service_context.CreateEvent("npns:s:GetReceiveEvent"); } + + private: + void ListenTo(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + const auto progam_id = rp.Pop(); + LOG_WARNING(Service_AM, "(STUBBED) called, progam_id={}", progam_id); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void GetReceiveEvent(HLERequestContext& ctx) { + LOG_WARNING(Service_AM, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2, 1}; + rb.Push(ResultSuccess); + rb.PushCopyObjects(get_recieve_event->GetReadableEvent()); + } + + KernelHelpers::ServiceContext service_context; + Kernel::KEvent* get_recieve_event; }; class NPNS_U final : public ServiceFramework { diff --git a/src/core/hle/service/ns/ns.cpp b/src/core/hle/service/ns/ns.cpp index 732ddcf29..258292a2e 100644 --- a/src/core/hle/service/ns/ns.cpp +++ b/src/core/hle/service/ns/ns.cpp @@ -95,7 +95,7 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {67, nullptr, "CancelApplicationApplyDelta"}, {68, nullptr, "ResumeApplicationApplyDelta"}, {69, nullptr, "CalculateApplicationApplyDeltaRequiredSize"}, - {70, nullptr, "ResumeAll"}, + {70, &IApplicationManagerInterface::ResumeAll, "ResumeAll"}, {71, nullptr, "GetStorageSize"}, {80, nullptr, "RequestDownloadApplication"}, {81, nullptr, "RequestDownloadAddOnContent"}, @@ -222,10 +222,10 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ {1600, nullptr, "GetSystemSeedForPseudoDeviceId"}, {1601, nullptr, "ResetSystemSeedForPseudoDeviceId"}, {1700, nullptr, "ListApplicationDownloadingContentMeta"}, - {1701, nullptr, "GetApplicationView"}, + {1701, &IApplicationManagerInterface::GetApplicationView, "GetApplicationView"}, {1702, nullptr, "GetApplicationDownloadTaskStatus"}, {1703, nullptr, "GetApplicationViewDownloadErrorContext"}, - {1704, nullptr, "GetApplicationViewWithPromotionInfo"}, + {1704, &IApplicationManagerInterface::GetApplicationViewWithPromotionInfo, "GetApplicationViewWithPromotionInfo"}, {1705, nullptr, "IsPatchAutoDeletableApplication"}, {1800, nullptr, "IsNotificationSetupCompleted"}, {1801, nullptr, "GetLastNotificationInfoCount"}, @@ -339,18 +339,73 @@ IApplicationManagerInterface::IApplicationManagerInterface(Core::System& system_ service_context.CreateEvent("IApplicationManagerInterface::GamecardMountFailureEvent"); } -IApplicationManagerInterface::~IApplicationManagerInterface() = default; +IApplicationManagerInterface::~IApplicationManagerInterface(){ + service_context.CloseEvent(record_update_system_event); + service_context.CloseEvent(gamecard_update_detection_event); + service_context.CloseEvent(gamecard_mount_status_event); + service_context.CloseEvent(gamecard_mount_failure_event); +}; void IApplicationManagerInterface::ListApplicationRecord(HLERequestContext& ctx) { + IPC::RequestParser rp{ctx}; + auto offset = rp.Pop(); + const auto limit = ctx.GetWriteBufferNumElements(); + LOG_ERROR(Service_NS, "(STUBBED) called"); - IPC::ResponseBuilder rb{ctx, 2, 1}; + std::vector application_records; + std::vector application_records2; + + application_records.push_back(ApplicationRecord{ + .application_id = 0x010074F013262000, + .type = 3, + .unknown = 2, + .unknown2 = 0, + }); + application_records.push_back(ApplicationRecord{ + .application_id = 0x01000F0002BB6000, + .type = 2, + .unknown = 2, + .unknown2 = 1, + }); + application_records.push_back(ApplicationRecord{ + .application_id = 0x0100A7F002830000, + .type = 1, + .unknown = 2, + .unknown2 = 2, + }); + application_records.push_back(ApplicationRecord{ + .application_id = 0x01008DF012A7A000, + .type = 3, + .unknown = 2, + .unknown2 = 3, + }); + + for (const auto& data : application_records) { + if (application_records2.size() >= limit) { + break; + } + if (offset > 0) { + offset--; + continue; + } + + application_records2.push_back(data); + } + + if (!application_records2.empty()) { + ctx.WriteBuffer(application_records2); + } + + IPC::ResponseBuilder rb{ctx, 3}; rb.Push(ResultSuccess); - rb.Push(0); + rb.Push(application_records2.size()); } void IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx) { LOG_ERROR(Service_NS, "(STUBBED) called"); + record_update_system_event->Signal(); + IPC::ResponseBuilder rb{ctx, 2, 1}; rb.Push(ResultSuccess); rb.PushCopyObjects(record_update_system_event->GetReadableEvent()); @@ -359,12 +414,11 @@ void IApplicationManagerInterface::GetApplicationRecordUpdateSystemEvent(HLERequ void IApplicationManagerInterface::GetApplicationControlData(HLERequestContext& ctx) { IPC::RequestParser rp{ctx}; const auto flag = rp.PopRaw(); - LOG_DEBUG(Service_NS, "called with flag={:016X}", flag); - const auto title_id = rp.PopRaw(); - const auto size = ctx.GetWriteBufferSize(); + LOG_ERROR(Service_NS, "called with flag={:016X}, title_id={:016X}", flag, title_id); + const FileSys::PatchManager pm{title_id, system.GetFileSystemController(), system.GetContentProvider()}; const auto control = pm.GetControlMetadata(); @@ -423,6 +477,50 @@ void IApplicationManagerInterface::GetGameCardMountFailureEvent(HLERequestContex rb.PushCopyObjects(gamecard_mount_failure_event->GetReadableEvent()); } +void IApplicationManagerInterface::GetApplicationView(HLERequestContext& ctx) { + std::vector application_id(ctx.GetReadBufferNumElements()); + const auto app_buffer = ctx.ReadBuffer(); + memcpy(application_id.data(), app_buffer.data(), app_buffer.size()); + + std::vector app_view; + + LOG_DEBUG(Service_NS, "(STUBBED) called, size={}", application_id.size()); + for (const u64& data : application_id) { + app_view.push_back(ApplicationView{ + .application_id = data, + }); + } + + ctx.WriteBuffer(app_view); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + +void IApplicationManagerInterface::GetApplicationViewWithPromotionInfo(HLERequestContext& ctx) { + std::vector application_id(ctx.GetReadBufferNumElements()); + const auto app_buffer = ctx.ReadBuffer(); + memcpy(application_id.data(), app_buffer.data(), app_buffer.size()); + + std::vector app_view; + + LOG_DEBUG(Service_NS, "(STUBBED) called, size={}", application_id.size()); + + for (const u64& data : application_id) { + app_view.push_back(ApplicationViewWithPromotionInfo{ + .view{ + .application_id = data, + }, + .promotion = {}, + }); + } + + ctx.WriteBuffer(app_view); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + void IApplicationManagerInterface::CheckSdCardMountStatus(HLERequestContext& ctx) { LOG_ERROR(Service_NS, "(STUBBED) called"); @@ -472,7 +570,7 @@ void IApplicationManagerInterface::GetApplicationDesiredLanguage(HLERequestConte Result IApplicationManagerInterface::GetApplicationDesiredLanguage(u8* out_desired_language, const u32 supported_languages) { - LOG_DEBUG(Service_NS, "called with supported_languages={:08X}", supported_languages); + LOG_ERROR(Service_NS, "called with supported_languages={:08X}", supported_languages); // Get language code from settings const auto language_code = @@ -524,6 +622,13 @@ void IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( } } +void IApplicationManagerInterface::ResumeAll(HLERequestContext& ctx) { + + LOG_WARNING(Service_AM, "(STUBBED) called"); + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); +} + Result IApplicationManagerInterface::ConvertApplicationLanguageToLanguageCode( u64* out_language_code, u8 application_language) { const auto language_code = @@ -835,7 +940,7 @@ public: : ServiceFramework{system_, "ns:su"}, service_context{system_, "ns:su"} { // clang-format off static const FunctionInfo functions[] = { - {0, nullptr, "GetBackgroundNetworkUpdateState"}, + {0, &NS_SU::GetBackgroundNetworkUpdateState, "GetBackgroundNetworkUpdateState"}, {1, &NS_SU::OpenSystemUpdateControl, "OpenSystemUpdateControl"}, {2, nullptr, "NotifyExFatDriverRequired"}, {3, nullptr, "ClearExFatDriverStatusForDebug"}, @@ -864,8 +969,22 @@ private: Kernel::KEvent* update_notification_event; KernelHelpers::ServiceContext service_context; + enum class BackgroundNetworkUpdateState { + None, + InProgress, + Ready, + }; + + void GetBackgroundNetworkUpdateState(HLERequestContext& ctx) { + LOG_ERROR(Service_AM, "called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.PushEnum(BackgroundNetworkUpdateState::None); + } + void OpenSystemUpdateControl(HLERequestContext& ctx) { - LOG_DEBUG(Service_NS, "called"); + LOG_ERROR(Service_NS, "called"); IPC::ResponseBuilder rb{ctx, 2, 0, 1}; rb.Push(ResultSuccess); diff --git a/src/core/hle/service/ns/ns.h b/src/core/hle/service/ns/ns.h index 0c827d999..8a128a162 100644 --- a/src/core/hle/service/ns/ns.h +++ b/src/core/hle/service/ns/ns.h @@ -34,16 +34,62 @@ public: u8 application_language); private: + struct ApplicationRecord { + u64 application_id; + u8 type; + u8 unknown; + INSERT_PADDING_BYTES(0x6); + u8 unknown2; + INSERT_PADDING_BYTES(0x7); + }; + + /// ApplicationView + struct ApplicationView { + u64 application_id; ///< ApplicationId. + u8 unk_x8[0x4]; ///< Unknown. + u32 flags; ///< Flags. + u8 unk_x10[0x10]; ///< Unknown. + u32 unk_x20; ///< Unknown. + u16 unk_x24; ///< Unknown. + u8 unk_x26[0x2]; ///< Unknown. + u8 unk_x28[0x8]; ///< Unknown. + u8 unk_x30[0x10]; ///< Unknown. + u32 unk_x40; ///< Unknown. + u8 unk_x44; ///< Unknown. + u8 unk_x45[0xb]; ///< Unknown. + }; + + /// NsPromotionInfo + struct PromotionInfo { + u64 start_timestamp; ///< POSIX timestamp for the promotion start. + u64 end_timestamp; ///< POSIX timestamp for the promotion end. + s64 remaining_time; ///< Remaining time until the promotion ends, in nanoseconds + ///< ({end_timestamp - current_time} converted to nanoseconds). + INSERT_PADDING_BYTES(0x4); + u8 flags; ///< Flags. Bit0: whether the PromotionInfo is valid (including bit1). Bit1 clear: + ///< remaining_time is set. + INSERT_PADDING_BYTES(0x3); + }; + + /// NsApplicationViewWithPromotionInfo + struct ApplicationViewWithPromotionInfo { + ApplicationView view; ///< \ref NsApplicationView + PromotionInfo promotion; ///< \ref NsPromotionInfo + }; + void ListApplicationRecord(HLERequestContext& ctx); void GetApplicationRecordUpdateSystemEvent(HLERequestContext& ctx); void GetApplicationControlData(HLERequestContext& ctx); void GetGameCardMountFailureEvent(HLERequestContext& ctx); + void GetApplicationView(HLERequestContext& ctx); + void GetApplicationViewWithPromotionInfo(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); + void ResumeAll(HLERequestContext& ctx); Kernel::KEvent* record_update_system_event; Kernel::KEvent* gamecard_update_detection_event; diff --git a/src/core/hle/service/pctl/pctl_module.cpp b/src/core/hle/service/pctl/pctl_module.cpp index 6a7fd72bc..f185209e3 100644 --- a/src/core/hle/service/pctl/pctl_module.cpp +++ b/src/core/hle/service/pctl/pctl_module.cpp @@ -39,7 +39,7 @@ public: {1007, nullptr, "RevertRestrictionTemporaryUnlocked"}, {1008, nullptr, "EnterRestrictedSystemSettings"}, {1009, nullptr, "LeaveRestrictedSystemSettings"}, - {1010, nullptr, "IsRestrictedSystemSettingsEntered"}, + {1010, &IParentalControlService::IsRestrictedSystemSettingsEntered, "IsRestrictedSystemSettingsEntered"}, {1011, nullptr, "RevertRestrictedSystemSettingsEntered"}, {1012, nullptr, "GetRestrictedFeatures"}, {1013, &IParentalControlService::ConfirmStereoVisionPermission, "ConfirmStereoVisionPermission"}, @@ -75,7 +75,7 @@ public: {1203, nullptr, "SetPinCode"}, {1204, nullptr, "GenerateInquiryCode"}, {1205, nullptr, "CheckMasterKey"}, - {1206, nullptr, "GetPinCodeLength"}, + {1206, &IParentalControlService::GetPinCodeLength, "GetPinCodeLength"}, {1207, nullptr, "GetPinCodeChangedEvent"}, {1208, nullptr, "GetPinCode"}, {1403, &IParentalControlService::IsPairingActive, "IsPairingActive"}, @@ -87,11 +87,11 @@ public: {1426, nullptr, "GetPostEventInterval"}, {1427, nullptr, "SetPostEventInterval"}, {1432, &IParentalControlService::GetSynchronizationEvent, "GetSynchronizationEvent"}, - {1451, nullptr, "StartPlayTimer"}, - {1452, nullptr, "StopPlayTimer"}, - {1453, nullptr, "IsPlayTimerEnabled"}, + {1451, &IParentalControlService::StartPlayTimer, "StartPlayTimer"}, + {1452, &IParentalControlService::StopPlayTimer, "StopPlayTimer"}, + {1453, &IParentalControlService::IsPlayTimerEnabled, "IsPlayTimerEnabled"}, {1454, nullptr, "GetPlayTimerRemainingTime"}, - {1455, nullptr, "IsRestrictedByPlayTimer"}, + {1455, &IParentalControlService::IsRestrictedByPlayTimer, "IsRestrictedByPlayTimer"}, {1456, &IParentalControlService::GetPlayTimerSettings, "GetPlayTimerSettings"}, {1457, &IParentalControlService::GetPlayTimerEventToRequestSuspension, "GetPlayTimerEventToRequestSuspension"}, {1458, &IParentalControlService::IsPlayTimerAlarmDisabled, "IsPlayTimerAlarmDisabled"}, @@ -259,6 +259,16 @@ private: rb.Push(ResultSuccess); rb.Push(is_temporary_unlocked); } + void IsRestrictedSystemSettingsEntered(HLERequestContext& ctx) { + const bool is_temporary_unlocked = false; + + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + is_temporary_unlocked); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_temporary_unlocked); + } void ConfirmStereoVisionPermission(HLERequestContext& ctx) { LOG_DEBUG(Service_PCTL, "called"); @@ -360,6 +370,16 @@ private: } } + void GetPinCodeLength(HLERequestContext& ctx) { + const bool is_pairing_active = false; + + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_pairing_active={}", is_pairing_active); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + void IsPairingActive(HLERequestContext& ctx) { const bool is_pairing_active = false; @@ -378,6 +398,39 @@ private: rb.PushCopyObjects(synchronization_event->GetReadableEvent()); } + void StartPlayTimer(HLERequestContext& ctx) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void StopPlayTimer(HLERequestContext& ctx) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 2}; + rb.Push(ResultSuccess); + } + + void IsPlayTimerEnabled(HLERequestContext& ctx) { + LOG_WARNING(Service_PCTL, "(STUBBED) called"); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(0); + } + + void IsRestrictedByPlayTimer(HLERequestContext& ctx) { + const bool is_temporary_unlocked = false; + + LOG_WARNING(Service_PCTL, "(STUBBED) called, is_temporary_unlocked={}", + is_temporary_unlocked); + + IPC::ResponseBuilder rb{ctx, 3}; + rb.Push(ResultSuccess); + rb.Push(is_temporary_unlocked); + } + void GetPlayTimerSettings(HLERequestContext& ctx) { LOG_WARNING(Service_PCTL, "(STUBBED) called"); diff --git a/src/core/hle/service/psc/psc.cpp b/src/core/hle/service/psc/psc.cpp index cd0cc9287..1773c316b 100644 --- a/src/core/hle/service/psc/psc.cpp +++ b/src/core/hle/service/psc/psc.cpp @@ -71,11 +71,51 @@ private: } }; +class IReceiver final : public ServiceFramework { +public: + explicit IReceiver(Core::System& system_) : ServiceFramework{system_, "IReceiver"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, nullptr, "AddSource"}, + {1, nullptr, "RemoveSource"}, + {2, nullptr, "GetReceiveEventHandle"}, + {3, nullptr, "Receive"}, + {4, nullptr, "ReceiveWithTick"}, + }; + // clang-format on + + RegisterHandlers(functions); + } +}; + +class OvlnRcv final : public ServiceFramework { +public: + explicit OvlnRcv(Core::System& system_) : ServiceFramework{system_, "ovln:rcv"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &OvlnRcv::OpenReceiver, "OpenReceiver"}, + }; + // clang-format on + + RegisterHandlers(functions); + } + +private: + void OpenReceiver(HLERequestContext& ctx) { + LOG_DEBUG(Service_PSC, "called"); + + IPC::ResponseBuilder rb{ctx, 2, 0, 1}; + rb.Push(ResultSuccess); + rb.PushIpcInterface(system); + } +}; + void LoopProcess(Core::System& system) { auto server_manager = std::make_unique(system); server_manager->RegisterNamedService("psc:c", std::make_shared(system)); server_manager->RegisterNamedService("psc:m", std::make_shared(system)); + server_manager->RegisterNamedService("ovln:rcv", std::make_shared(system)); ServerManager::RunServer(std::move(server_manager)); } diff --git a/src/core/hle/service/set/settings_server.cpp b/src/core/hle/service/set/settings_server.cpp index b2caa00ff..216e07285 100644 --- a/src/core/hle/service/set/settings_server.cpp +++ b/src/core/hle/service/set/settings_server.cpp @@ -158,9 +158,11 @@ void ISettingsServer::GetKeyCodeMap2(HLERequestContext& ctx) { void ISettingsServer::GetDeviceNickName(HLERequestContext& ctx) { LOG_DEBUG(Service_SET, "called"); + + ctx.WriteBuffer(Settings::values.device_name.GetValue()); + IPC::ResponseBuilder rb{ctx, 2}; rb.Push(ResultSuccess); - ctx.WriteBuffer(Settings::values.device_name.GetValue()); } } // namespace Service::Set diff --git a/src/core/hle/service/set/system_settings_server.h b/src/core/hle/service/set/system_settings_server.h index 32716f567..4a378077f 100644 --- a/src/core/hle/service/set/system_settings_server.h +++ b/src/core/hle/service/set/system_settings_server.h @@ -80,6 +80,7 @@ private: void SetExternalSteadyClockSourceId(HLERequestContext& ctx); void GetUserSystemClockContext(HLERequestContext& ctx); void SetUserSystemClockContext(HLERequestContext& ctx); + void GetLockScreenFlag(HLERequestContext& ctx); void GetAccountSettings(HLERequestContext& ctx); void SetAccountSettings(HLERequestContext& ctx); void GetEulaVersions(HLERequestContext& ctx); diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 9747e3fb3..f21bec28e 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp @@ -14,6 +14,7 @@ #include "common/fs/fs.h" #include "common/fs/path_util.h" #include "core/core.h" +#include "core/hle/service/glue/glue_manager.h" #include "core/file_sys/card_image.h" #include "core/file_sys/content_archive.h" #include "core/file_sys/control_metadata.h" @@ -326,6 +327,21 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) { const auto control = cache.GetEntry(game.title_id, ContentRecordType::Control); if (control != nullptr) { GetMetadataFromControlNCA(patch, *control, icon, name); + + std::vector nacp_data; + FileSys::NACP nacp; + if (loader->ReadControlData(nacp) == Loader::ResultStatus::Success) { + nacp_data = nacp.GetRawBytes(); + } else { + nacp_data.resize(sizeof(FileSys::RawNACP)); + } + Service::Glue::ApplicationLaunchProperty launch{}; + launch.title_id = program_id; + launch.version = patch.GetGameVersion().value_or(0); + launch.base_game_storage_id = FileSys::StorageId::NandUser; + launch.update_storage_id = FileSys::StorageId::NandSystem; + + system.GetARPManager().Register(launch.title_id, launch, std::move(nacp_data)); } auto entry = MakeGameListEntry(file->GetFullPath(), name, file->GetSize(), icon, *loader, diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 04a7aadcc..ca3152739 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp @@ -1585,6 +1585,7 @@ void GMainWindow::ConnectMenuEvents() { [this]() { OnCabinet(Service::NFP::CabinetMode::StartRestorer); }); connect_menu(ui->action_Load_Cabinet_Formatter, [this]() { OnCabinet(Service::NFP::CabinetMode::StartFormatter); }); + connect_menu(ui->action_Load_QLaunch, &GMainWindow::OnQlaunch); connect_menu(ui->action_Load_Mii_Edit, &GMainWindow::OnMiiEdit); connect_menu(ui->action_Open_Controller_Menu, &GMainWindow::OnOpenControllerMenu); connect_menu(ui->action_Capture_Screenshot, &GMainWindow::OnCaptureScreenshot); @@ -1620,6 +1621,7 @@ void GMainWindow::UpdateMenuState() { ui->action_Load_Cabinet_Restorer, ui->action_Load_Cabinet_Formatter, ui->action_Load_Mii_Edit, + ui->action_Load_QLaunch, ui->action_Open_Controller_Menu}; for (QAction* action : running_actions) { @@ -4201,6 +4203,29 @@ void GMainWindow::OnCabinet(Service::NFP::CabinetMode mode) { BootGame(filename, CabinetId); } +void GMainWindow::OnQlaunch() { + constexpr u64 MiiEditId = 0x0100000000001000ull; + auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); + if (!bis_system) { + QMessageBox::warning(this, tr("No firmware available"), + tr("Please install the firmware to use the Mii editor.")); + return; + } + + auto mii_applet_nca = bis_system->GetEntry(MiiEditId, FileSys::ContentRecordType::Program); + if (!mii_applet_nca) { + QMessageBox::warning(this, tr("Mii Edit Applet"), + tr("Mii editor is not available. Please reinstall firmware.")); + return; + } + + system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::QLaunch); + + const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); + UISettings::values.roms_path = QFileInfo(filename).path(); + BootGame(filename); +} + void GMainWindow::OnMiiEdit() { constexpr u64 MiiEditId = static_cast(Service::AM::Applets::AppletProgramId::MiiEdit); auto bis_system = system->GetFileSystemController().GetSystemNANDContents(); @@ -4217,7 +4242,7 @@ void GMainWindow::OnMiiEdit() { return; } - system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::QLaunch); + system->GetAppletManager().SetCurrentAppletId(Service::AM::Applets::AppletId::MiiEdit); const auto filename = QString::fromStdString((mii_applet_nca->GetFullPath())); UISettings::values.roms_path = QFileInfo(filename).path().toStdString(); diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 280fae5c3..6cc9b4c2d 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -396,6 +396,7 @@ private slots: void ResetWindowSize900(); void ResetWindowSize1080(); void OnAlbum(); + void OnQlaunch(); void OnCabinet(Service::NFP::CabinetMode mode); void OnMiiEdit(); void OnOpenControllerMenu(); diff --git a/src/yuzu/main.ui b/src/yuzu/main.ui index e53f9951e..35fd3a8e1 100644 --- a/src/yuzu/main.ui +++ b/src/yuzu/main.ui @@ -159,6 +159,7 @@ + @@ -407,6 +408,11 @@ &Format Amiibo + + + Open &Home menu + + Open &Mii Editor