Przeglądaj źródła

Stubs for QLaunch (#428)

* Stubs for QLaunch

* Wiped unrelated stuff

* Addressed comment

* Dropped GetPopFromGeneralChannelEvent
Hexagon12 8 lat temu
rodzic
commit
5e9c547952

+ 77 - 2
src/core/hle/service/am/am.cpp

@@ -103,7 +103,7 @@ ISelfController::ISelfController(std::shared_ptr<NVFlinger::NVFlinger> nvflinger
         {40, &ISelfController::CreateManagedDisplayLayer, "CreateManagedDisplayLayer"},
         {41, nullptr, "IsSystemBufferSharingEnabled"},
         {42, nullptr, "GetSystemSharedLayerHandle"},
-        {50, nullptr, "SetHandlesRequestToDisplay"},
+        {50, &ISelfController::SetHandlesRequestToDisplay, "SetHandlesRequestToDisplay"},
         {51, nullptr, "ApproveToDisplay"},
         {60, nullptr, "OverrideAutoSleepTimeAndDimmingTime"},
         {61, nullptr, "SetMediaPlaybackState"},
@@ -229,6 +229,13 @@ void ISelfController::CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx)
     NGLOG_WARNING(Service_AM, "(STUBBED) called");
 }
 
+void ISelfController::SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx) {
+    IPC::ResponseBuilder rb{ctx, 2};
+    rb.Push(RESULT_SUCCESS);
+
+    NGLOG_WARNING(Service_AM, "(STUBBED) called");
+}
+
 ICommonStateGetter::ICommonStateGetter() : ServiceFramework("ICommonStateGetter") {
     static const FunctionInfo functions[] = {
         {0, &ICommonStateGetter::GetEventHandle, "GetEventHandle"},
@@ -445,7 +452,8 @@ IApplicationFunctions::IApplicationFunctions() : ServiceFramework("IApplicationF
         {10, nullptr, "CreateApplicationAndPushAndRequestToStart"},
         {11, nullptr, "CreateApplicationAndPushAndRequestToStartForQuest"},
         {12, nullptr, "CreateApplicationAndRequestToStart"},
-        {13, nullptr, "CreateApplicationAndRequestToStartForQuest"},
+        {13, &IApplicationFunctions::CreateApplicationAndRequestToStartForQuest,
+         "CreateApplicationAndRequestToStartForQuest"},
         {20, &IApplicationFunctions::EnsureSaveData, "EnsureSaveData"},
         {21, &IApplicationFunctions::GetDesiredLanguage, "GetDesiredLanguage"},
         {22, &IApplicationFunctions::SetTerminateResult, "SetTerminateResult"},
@@ -502,6 +510,13 @@ void IApplicationFunctions::PopLaunchParameter(Kernel::HLERequestContext& ctx) {
     NGLOG_DEBUG(Service_AM, "called");
 }
 
+void IApplicationFunctions::CreateApplicationAndRequestToStartForQuest(
+    Kernel::HLERequestContext& ctx) {
+    IPC::ResponseBuilder rb{ctx, 2};
+    rb.Push(RESULT_SUCCESS);
+    NGLOG_WARNING(Service_AM, "(STUBBED) called");
+}
+
 void IApplicationFunctions::EnsureSaveData(Kernel::HLERequestContext& ctx) {
     IPC::RequestParser rp{ctx};
     u128 uid = rp.PopRaw<u128>();
@@ -572,4 +587,64 @@ void InstallInterfaces(SM::ServiceManager& service_manager,
     std::make_shared<AppletOE>(nvflinger)->InstallAsService(service_manager);
 }
 
+IHomeMenuFunctions::IHomeMenuFunctions() : ServiceFramework("IHomeMenuFunctions") {
+    static const FunctionInfo functions[] = {
+        {10, &IHomeMenuFunctions::RequestToGetForeground, "RequestToGetForeground"},
+        {11, nullptr, "LockForeground"},
+        {12, nullptr, "UnlockForeground"},
+        {20, nullptr, "PopFromGeneralChannel"},
+        {21, nullptr, "GetPopFromGeneralChannelEvent"},
+        {30, nullptr, "GetHomeButtonWriterLockAccessor"},
+        {31, nullptr, "GetWriterLockAccessorEx"},
+    };
+    RegisterHandlers(functions);
+}
+
+void IHomeMenuFunctions::RequestToGetForeground(Kernel::HLERequestContext& ctx) {
+    IPC::ResponseBuilder rb{ctx, 2};
+    rb.Push(RESULT_SUCCESS);
+    NGLOG_WARNING(Service_AM, "(STUBBED) called");
+}
+
+IGlobalStateController::IGlobalStateController() : ServiceFramework("IGlobalStateController") {
+    static const FunctionInfo functions[] = {
+        {0, nullptr, "RequestToEnterSleep"},
+        {1, nullptr, "EnterSleep"},
+        {2, nullptr, "StartSleepSequence"},
+        {3, nullptr, "StartShutdownSequence"},
+        {4, nullptr, "StartRebootSequence"},
+        {10, nullptr, "LoadAndApplyIdlePolicySettings"},
+        {11, nullptr, "NotifyCecSettingsChanged"},
+        {12, nullptr, "SetDefaultHomeButtonLongPressTime"},
+        {13, nullptr, "UpdateDefaultDisplayResolution"},
+        {14, nullptr, "ShouldSleepOnBoot"},
+        {15, nullptr, "GetHdcpAuthenticationFailedEvent"},
+    };
+    RegisterHandlers(functions);
+}
+
+IApplicationCreator::IApplicationCreator() : ServiceFramework("IApplicationCreator") {
+    static const FunctionInfo functions[] = {
+        {0, nullptr, "CreateApplication"},
+        {1, nullptr, "PopLaunchRequestedApplication"},
+        {10, nullptr, "CreateSystemApplication"},
+        {100, nullptr, "PopFloatingApplicationForDevelopment"},
+    };
+    RegisterHandlers(functions);
+}
+
+IProcessWindingController::IProcessWindingController()
+    : ServiceFramework("IProcessWindingController") {
+    static const FunctionInfo functions[] = {
+        {0, nullptr, "GetLaunchReason"},
+        {11, nullptr, "OpenCallingLibraryApplet"},
+        {21, nullptr, "PushContext"},
+        {22, nullptr, "PopContext"},
+        {23, nullptr, "CancelWindingReservation"},
+        {30, nullptr, "WindAndDoReserved"},
+        {40, nullptr, "ReserveToStartAndWaitAndUnwindThis"},
+        {41, nullptr, "ReserveToStartAndWait"},
+    };
+    RegisterHandlers(functions);
+}
 } // namespace Service::AM

+ 25 - 0
src/core/hle/service/am/am.h

@@ -70,6 +70,7 @@ private:
     void GetLibraryAppletLaunchableEvent(Kernel::HLERequestContext& ctx);
     void CreateManagedDisplayLayer(Kernel::HLERequestContext& ctx);
     void SetScreenShotPermission(Kernel::HLERequestContext& ctx);
+    void SetHandlesRequestToDisplay(Kernel::HLERequestContext& ctx);
 
     std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
     Kernel::SharedPtr<Kernel::Event> launchable_event;
@@ -113,6 +114,7 @@ public:
 
 private:
     void PopLaunchParameter(Kernel::HLERequestContext& ctx);
+    void CreateApplicationAndRequestToStartForQuest(Kernel::HLERequestContext& ctx);
     void EnsureSaveData(Kernel::HLERequestContext& ctx);
     void SetTerminateResult(Kernel::HLERequestContext& ctx);
     void GetDesiredLanguage(Kernel::HLERequestContext& ctx);
@@ -121,6 +123,29 @@ private:
     void NotifyRunning(Kernel::HLERequestContext& ctx);
 };
 
+class IHomeMenuFunctions final : public ServiceFramework<IHomeMenuFunctions> {
+public:
+    IHomeMenuFunctions();
+
+private:
+    void RequestToGetForeground(Kernel::HLERequestContext& ctx);
+};
+
+class IGlobalStateController final : public ServiceFramework<IGlobalStateController> {
+public:
+    IGlobalStateController();
+};
+
+class IApplicationCreator final : public ServiceFramework<IApplicationCreator> {
+public:
+    IApplicationCreator();
+};
+
+class IProcessWindingController final : public ServiceFramework<IProcessWindingController> {
+public:
+    IProcessWindingController();
+};
+
 /// Registers all AM services with the specified service manager.
 void InstallInterfaces(SM::ServiceManager& service_manager,
                        std::shared_ptr<NVFlinger::NVFlinger> nvflinger);

+ 117 - 3
src/core/hle/service/am/applet_ae.cpp

@@ -20,7 +20,7 @@ public:
             {2, &ILibraryAppletProxy::GetWindowController, "GetWindowController"},
             {3, &ILibraryAppletProxy::GetAudioController, "GetAudioController"},
             {4, &ILibraryAppletProxy::GetDisplayController, "GetDisplayController"},
-            {10, nullptr, "GetProcessWindingController"},
+            {10, &ILibraryAppletProxy::GetProcessWindingController, "GetProcessWindingController"},
             {11, &ILibraryAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
             {20, &ILibraryAppletProxy::GetApplicationFunctions, "GetApplicationFunctions"},
             {1000, &ILibraryAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
@@ -64,6 +64,13 @@ private:
         NGLOG_DEBUG(Service_AM, "called");
     }
 
+    void GetProcessWindingController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IProcessWindingController>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
     void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
         IPC::ResponseBuilder rb{ctx, 2, 0, 1};
         rb.Push(RESULT_SUCCESS);
@@ -88,6 +95,113 @@ private:
     std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
 };
 
+class ISystemAppletProxy final : public ServiceFramework<ISystemAppletProxy> {
+public:
+    explicit ISystemAppletProxy(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
+        : ServiceFramework("ISystemAppletProxy"), nvflinger(std::move(nvflinger)) {
+        static const FunctionInfo functions[] = {
+            {0, &ISystemAppletProxy::GetCommonStateGetter, "GetCommonStateGetter"},
+            {1, &ISystemAppletProxy::GetSelfController, "GetSelfController"},
+            {2, &ISystemAppletProxy::GetWindowController, "GetWindowController"},
+            {3, &ISystemAppletProxy::GetAudioController, "GetAudioController"},
+            {4, &ISystemAppletProxy::GetDisplayController, "GetDisplayController"},
+            {10, nullptr, "GetProcessWindingController"},
+            {11, &ISystemAppletProxy::GetLibraryAppletCreator, "GetLibraryAppletCreator"},
+            {20, &ISystemAppletProxy::GetHomeMenuFunctions, "GetHomeMenuFunctions"},
+            {21, &ISystemAppletProxy::GetGlobalStateController, "GetGlobalStateController"},
+            {22, &ISystemAppletProxy::GetApplicationCreator, "GetApplicationCreator"},
+            {1000, &ISystemAppletProxy::GetDebugFunctions, "GetDebugFunctions"},
+        };
+        RegisterHandlers(functions);
+    }
+
+private:
+    void GetCommonStateGetter(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<ICommonStateGetter>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetSelfController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<ISelfController>(nvflinger);
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetWindowController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IWindowController>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetAudioController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IAudioController>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetDisplayController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IDisplayController>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetDebugFunctions(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IDebugFunctions>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetLibraryAppletCreator(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<ILibraryAppletCreator>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetHomeMenuFunctions(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IHomeMenuFunctions>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetGlobalStateController(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IGlobalStateController>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+
+    void GetApplicationCreator(Kernel::HLERequestContext& ctx) {
+        IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+        rb.Push(RESULT_SUCCESS);
+        rb.PushIpcInterface<IApplicationCreator>();
+        NGLOG_DEBUG(Service_AM, "called");
+    }
+    std::shared_ptr<NVFlinger::NVFlinger> nvflinger;
+};
+
+void AppletAE::OpenSystemAppletProxy(Kernel::HLERequestContext& ctx) {
+    IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+    rb.Push(RESULT_SUCCESS);
+    rb.PushIpcInterface<ISystemAppletProxy>(nvflinger);
+    NGLOG_DEBUG(Service_AM, "called");
+}
+
+void AppletAE::OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx) {
+    IPC::ResponseBuilder rb{ctx, 2, 0, 1};
+    rb.Push(RESULT_SUCCESS);
+    rb.PushIpcInterface<ILibraryAppletProxy>(nvflinger);
+    NGLOG_DEBUG(Service_AM, "called");
+}
+
 void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
     IPC::ResponseBuilder rb{ctx, 2, 0, 1};
     rb.Push(RESULT_SUCCESS);
@@ -98,9 +212,9 @@ void AppletAE::OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx) {
 AppletAE::AppletAE(std::shared_ptr<NVFlinger::NVFlinger> nvflinger)
     : ServiceFramework("appletAE"), nvflinger(std::move(nvflinger)) {
     static const FunctionInfo functions[] = {
-        {100, nullptr, "OpenSystemAppletProxy"},
+        {100, &AppletAE::OpenSystemAppletProxy, "OpenSystemAppletProxy"},
         {200, &AppletAE::OpenLibraryAppletProxyOld, "OpenLibraryAppletProxyOld"},
-        {201, nullptr, "OpenLibraryAppletProxy"},
+        {201, &AppletAE::OpenLibraryAppletProxy, "OpenLibraryAppletProxy"},
         {300, nullptr, "OpenOverlayAppletProxy"},
         {350, nullptr, "OpenSystemApplicationProxy"},
         {400, nullptr, "CreateSelfLibraryAppletCreatorForDevelop"},

+ 2 - 0
src/core/hle/service/am/applet_ae.h

@@ -21,6 +21,8 @@ public:
     ~AppletAE() = default;
 
 private:
+    void OpenSystemAppletProxy(Kernel::HLERequestContext& ctx);
+    void OpenLibraryAppletProxy(Kernel::HLERequestContext& ctx);
     void OpenLibraryAppletProxyOld(Kernel::HLERequestContext& ctx);
 
     std::shared_ptr<NVFlinger::NVFlinger> nvflinger;