mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-29 14:15:29 +03:00
Refactor am services
Use the new service naming scheme. Remove redundant casts and template specifiers in response.Push.
This commit is contained in:
parent
616222a6db
commit
4af37c4367
@ -61,8 +61,22 @@ add_library(skyline SHARED
|
|||||||
${source_DIR}/skyline/services/settings/ISystemSettingsServer.cpp
|
${source_DIR}/skyline/services/settings/ISystemSettingsServer.cpp
|
||||||
${source_DIR}/skyline/services/apm/IManager.cpp
|
${source_DIR}/skyline/services/apm/IManager.cpp
|
||||||
${source_DIR}/skyline/services/apm/ISession.cpp
|
${source_DIR}/skyline/services/apm/ISession.cpp
|
||||||
${source_DIR}/skyline/services/am/applet.cpp
|
${source_DIR}/skyline/services/am/IAllSystemAppletProxiesService.cpp
|
||||||
${source_DIR}/skyline/services/am/appletController.cpp
|
${source_DIR}/skyline/services/am/IApplicationProxyService.cpp
|
||||||
|
${source_DIR}/skyline/services/am/proxy/base_proxy.cpp
|
||||||
|
${source_DIR}/skyline/services/am/proxy/IApplicationProxy.cpp
|
||||||
|
${source_DIR}/skyline/services/am/proxy/ILibraryAppletProxy.cpp
|
||||||
|
${source_DIR}/skyline/services/am/proxy/IOverlayAppletProxy.cpp
|
||||||
|
${source_DIR}/skyline/services/am/proxy/ISystemAppletProxy.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IAppletCommonFunctions.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IApplicationFunctions.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IAudioController.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/ICommonStateGetter.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IDebugFunctions.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IDisplayController.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/ILibraryAppletCreator.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/ISelfController.cpp
|
||||||
|
${source_DIR}/skyline/services/am/controller/IWindowController.cpp
|
||||||
${source_DIR}/skyline/services/hid/IHidServer.cpp
|
${source_DIR}/skyline/services/hid/IHidServer.cpp
|
||||||
${source_DIR}/skyline/services/hid/IAppletResource.cpp
|
${source_DIR}/skyline/services/hid/IAppletResource.cpp
|
||||||
${source_DIR}/skyline/services/timesrv/IStaticService.cpp
|
${source_DIR}/skyline/services/timesrv/IStaticService.cpp
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
#include "proxy/ILibraryAppletProxy.h"
|
||||||
|
#include "proxy/IApplicationProxy.h"
|
||||||
|
#include "proxy/IOverlayAppletProxy.h"
|
||||||
|
#include "proxy/ISystemAppletProxy.h"
|
||||||
|
#include "IAllSystemAppletProxiesService.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAllSystemAppletProxiesService, "am:IAllSystemAppletProxiesService", {
|
||||||
|
{0x64, SFUNC(IAllSystemAppletProxiesService::OpenSystemAppletProxy)},
|
||||||
|
{0xC8, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)},
|
||||||
|
{0xC9, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)},
|
||||||
|
{0x12C, SFUNC(IAllSystemAppletProxiesService::OpenOverlayAppletProxy)},
|
||||||
|
{0x15E, SFUNC(IAllSystemAppletProxiesService::OpenApplicationProxy)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IAllSystemAppletProxiesService::OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(ILibraryAppletProxy), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IAllSystemAppletProxiesService::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IApplicationProxy), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IAllSystemAppletProxiesService::OpenOverlayAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IOverlayAppletProxy), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IAllSystemAppletProxiesService::OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(ISystemAppletProxy), session, response);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief IAllSystemAppletProxiesService is used to open proxies (https://switchbrew.org/wiki/Applet_Manager_services#appletAE)
|
||||||
|
*/
|
||||||
|
class IAllSystemAppletProxiesService : public BaseService {
|
||||||
|
public:
|
||||||
|
IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #ILibraryAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenLibraryAppletProxy)
|
||||||
|
*/
|
||||||
|
void OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy)
|
||||||
|
*/
|
||||||
|
void OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IOverlayAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenOverlayAppletProxy)
|
||||||
|
*/
|
||||||
|
void OpenOverlayAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #ISystemAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenSystemAppletProxy)
|
||||||
|
*/
|
||||||
|
void OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
#include "proxy/IApplicationProxy.h"
|
||||||
|
#include "IApplicationProxyService.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IApplicationProxyService::IApplicationProxyService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IApplicationProxyService, "am:IApplicationProxyService", {
|
||||||
|
{0x0, SFUNC(IApplicationProxyService::OpenApplicationProxy)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IApplicationProxyService::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IApplicationProxy), session, response);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief IApplicationProxyService is used to open an application proxy (https://switchbrew.org/wiki/Applet_Manager_services#appletOE)
|
||||||
|
*/
|
||||||
|
class IApplicationProxyService : public BaseService {
|
||||||
|
public:
|
||||||
|
IApplicationProxyService(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy)
|
||||||
|
*/
|
||||||
|
void OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -1,117 +0,0 @@
|
|||||||
#include "applet.h"
|
|
||||||
#include "appletController.h"
|
|
||||||
|
|
||||||
namespace skyline::service::am {
|
|
||||||
appletOE::appletOE(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_appletOE, "am:appletOE", {
|
|
||||||
{0x0, SFUNC(appletOE::OpenApplicationProxy)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void appletOE::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IApplicationProxy), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
appletAE::appletAE(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_appletAE, "am:appletAE", {
|
|
||||||
{0x64, SFUNC(appletAE::OpenSystemAppletProxy)},
|
|
||||||
{0xC8, SFUNC(appletAE::OpenLibraryAppletProxy)},
|
|
||||||
{0xC9, SFUNC(appletAE::OpenLibraryAppletProxy)},
|
|
||||||
{0x12C, SFUNC(appletAE::OpenOverlayAppletProxy)},
|
|
||||||
{0x15E, SFUNC(appletAE::OpenApplicationProxy)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void appletAE::OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(ILibraryAppletProxy), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void appletAE::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IApplicationProxy), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void appletAE::OpenOverlayAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IOverlayAppletProxy), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void appletAE::OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(ISystemAppletProxy), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager, const Service serviceType, const std::string &serviceName, const std::unordered_map<u32, std::function<void(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable) : BaseService(state, manager, serviceType, serviceName, vTable) {}
|
|
||||||
|
|
||||||
void BaseProxy::GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(ICommonStateGetter), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetSelfController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(ISelfController), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetWindowController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IWindowController), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetAudioController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IAudioController), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetDisplayController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IDisplayController), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(ILibraryAppletCreator), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetDebugFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IDebugFunctions), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseProxy::GetAppletCommonFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IAppletCommonFunctions), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_IApplicationProxy, "am:IApplicationProxy", {
|
|
||||||
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
|
||||||
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
|
||||||
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
|
||||||
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
|
||||||
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
|
||||||
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
|
||||||
{0x14, SFUNC(IApplicationProxy::GetApplicationFunctions)},
|
|
||||||
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void IApplicationProxy::GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
manager.RegisterService(SRVREG(IApplicationFunctions), session, response);
|
|
||||||
}
|
|
||||||
|
|
||||||
ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_ILibraryAppletProxy, "am:ILibraryAppletProxy", {
|
|
||||||
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
|
||||||
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
|
||||||
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
|
||||||
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
|
||||||
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
|
||||||
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
|
||||||
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_ISystemAppletProxy, "am:ISystemAppletProxy", {
|
|
||||||
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
|
||||||
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
|
||||||
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
|
||||||
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
|
||||||
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
|
||||||
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
|
||||||
{0x17, SFUNC(BaseProxy::GetAppletCommonFunctions)},
|
|
||||||
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_IOverlayAppletProxy, "am:IOverlayAppletProxy", {
|
|
||||||
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
|
||||||
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
|
||||||
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
|
||||||
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
|
||||||
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
|
||||||
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
|
||||||
{0x15, SFUNC(BaseProxy::GetAppletCommonFunctions)},
|
|
||||||
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
|
||||||
}) {}
|
|
||||||
}
|
|
@ -1,132 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <services/base_service.h>
|
|
||||||
#include <services/serviceman.h>
|
|
||||||
|
|
||||||
namespace skyline::service::am {
|
|
||||||
/**
|
|
||||||
* @brief appletOE is used to open an application proxy (https://switchbrew.org/wiki/Applet_Manager_services#appletOE)
|
|
||||||
*/
|
|
||||||
class appletOE : public BaseService {
|
|
||||||
public:
|
|
||||||
appletOE(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy)
|
|
||||||
*/
|
|
||||||
void OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief appletAE is used to open proxies (https://switchbrew.org/wiki/Applet_Manager_services#appletAE)
|
|
||||||
*/
|
|
||||||
class appletAE : public BaseService {
|
|
||||||
public:
|
|
||||||
appletAE(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #ILibraryAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenLibraryAppletProxy)
|
|
||||||
*/
|
|
||||||
void OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy)
|
|
||||||
*/
|
|
||||||
void OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IOverlayAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenOverlayAppletProxy)
|
|
||||||
*/
|
|
||||||
void OpenOverlayAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #ISystemAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenSystemAppletProxy)
|
|
||||||
*/
|
|
||||||
void OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ILibraryAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletProxy)
|
|
||||||
*/
|
|
||||||
class BaseProxy : public BaseService {
|
|
||||||
public:
|
|
||||||
BaseProxy(const DeviceState &state, ServiceManager &manager, const Service serviceType, const std::string &serviceName, const std::unordered_map<u32, std::function<void(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #ICommonStateGetter (https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter)
|
|
||||||
*/
|
|
||||||
void GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #ISelfController (https://switchbrew.org/wiki/Applet_Manager_services#ISelfController)
|
|
||||||
*/
|
|
||||||
void GetSelfController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IWindowController (https://switchbrew.org/wiki/Applet_Manager_services#IWindowController)
|
|
||||||
*/
|
|
||||||
void GetWindowController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IAudioController (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController)
|
|
||||||
*/
|
|
||||||
void GetAudioController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IDisplayController (https://switchbrew.org/wiki/Applet_Manager_services#IDisplayController)
|
|
||||||
*/
|
|
||||||
void GetDisplayController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #ILibraryAppletCreator (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletCreator)
|
|
||||||
*/
|
|
||||||
void GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IDebugFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IDebugFunctions)
|
|
||||||
*/
|
|
||||||
void GetDebugFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IAppletCommonFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IAppletCommonFunctions)
|
|
||||||
*/
|
|
||||||
void GetAppletCommonFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IApplicationProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationProxy)
|
|
||||||
*/
|
|
||||||
class IApplicationProxy : public BaseProxy {
|
|
||||||
public:
|
|
||||||
IApplicationProxy(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns #IApplicationFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
|
||||||
*/
|
|
||||||
void GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief IOverlayAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#IOverlayAppletProxy)
|
|
||||||
*/
|
|
||||||
class IOverlayAppletProxy : public BaseProxy {
|
|
||||||
public:
|
|
||||||
IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ISystemAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#ISystemAppletProxy)
|
|
||||||
*/
|
|
||||||
class ISystemAppletProxy : public BaseProxy {
|
|
||||||
public:
|
|
||||||
ISystemAppletProxy(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief ILibraryAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletProxy)
|
|
||||||
*/
|
|
||||||
class ILibraryAppletProxy : public BaseProxy {
|
|
||||||
public:
|
|
||||||
ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
}
|
|
@ -1,116 +0,0 @@
|
|||||||
#include "appletController.h"
|
|
||||||
|
|
||||||
namespace skyline::service::am {
|
|
||||||
void ICommonStateGetter::QueueMessage(ICommonStateGetter::Message message) {
|
|
||||||
messageQueue.emplace(message);
|
|
||||||
messageEvent->Signal();
|
|
||||||
}
|
|
||||||
|
|
||||||
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, Service::am_ICommonStateGetter, "am:ICommonStateGetter", {
|
|
||||||
{0x0, SFUNC(ICommonStateGetter::GetEventHandle)},
|
|
||||||
{0x1, SFUNC(ICommonStateGetter::ReceiveMessage)},
|
|
||||||
{0x5, SFUNC(ICommonStateGetter::GetOperationMode)},
|
|
||||||
{0x6, SFUNC(ICommonStateGetter::GetPerformanceMode)},
|
|
||||||
{0x9, SFUNC(ICommonStateGetter::GetCurrentFocusState)},
|
|
||||||
{0x3C, SFUNC(ICommonStateGetter::GetDefaultDisplayResolution)}
|
|
||||||
}) {
|
|
||||||
operationMode = static_cast<OperationMode>(state.settings->GetBool("operation_mode"));
|
|
||||||
state.logger->Info("Switch on mode: {}", static_cast<bool>(operationMode) ? "Docked" : "Handheld");
|
|
||||||
QueueMessage(Message::FocusStateChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::GetEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
auto handle = state.process->InsertItem(messageEvent);
|
|
||||||
state.logger->Debug("Applet Event Handle: 0x{:X}", handle);
|
|
||||||
response.copyHandles.push_back(handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::ReceiveMessage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
if (messageQueue.empty()) {
|
|
||||||
response.errorCode = constant::status::NoMessages;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
response.Push<u32>(static_cast<u32>(messageQueue.front()));
|
|
||||||
messageQueue.pop();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::GetCurrentFocusState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
response.Push<u8>(static_cast<u8>(focusState));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::GetOperationMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
response.Push<u8>(static_cast<u8>(operationMode));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::GetPerformanceMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
response.Push<u32>(static_cast<u32>(operationMode));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ICommonStateGetter::GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
if (operationMode == OperationMode::Handheld) {
|
|
||||||
response.Push<u32>(constant::HandheldResolutionW);
|
|
||||||
response.Push<u32>(constant::HandheldResolutionH);
|
|
||||||
} else if (operationMode == OperationMode::Docked) {
|
|
||||||
response.Push<u32>(constant::DockedResolutionW);
|
|
||||||
response.Push<u32>(constant::DockedResolutionH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_ISelfController, "am:ISelfController", {
|
|
||||||
{0xB, SFUNC(ISelfController::SetOperationModeChangedNotification)},
|
|
||||||
{0xC, SFUNC(ISelfController::SetPerformanceModeChangedNotification)},
|
|
||||||
{0xD, SFUNC(ISelfController::SetFocusHandlingMode)},
|
|
||||||
{0x10, SFUNC(ISelfController::SetOutOfFocusSuspendingEnabled)},
|
|
||||||
{0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void ISelfController::SetOperationModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
|
||||||
|
|
||||||
void ISelfController::SetPerformanceModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
|
||||||
|
|
||||||
void ISelfController::SetFocusHandlingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
|
||||||
|
|
||||||
void ISelfController::SetOutOfFocusSuspendingEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
|
||||||
|
|
||||||
void ISelfController::CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
state.logger->Debug("Creating Managed Layer");
|
|
||||||
if (state.gpu->layerStatus == gpu::LayerStatus::Initialized)
|
|
||||||
throw exception("The application is creating more than one layer");
|
|
||||||
state.gpu->layerStatus = gpu::LayerStatus::Initialized;
|
|
||||||
response.Push<u64>(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IWindowController, "am:IWindowController", {
|
|
||||||
{0x1, SFUNC(IWindowController::GetAppletResourceUserId)},
|
|
||||||
{0xA, SFUNC(IWindowController::AcquireForegroundRights)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void IWindowController::GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
response.Push(static_cast<u64>(state.process->pid));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IWindowController::AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
|
||||||
|
|
||||||
IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAudioController, "am:IAudioController", {
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IDisplayController, "am:IDisplayController", {
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_ILibraryAppletCreator, "am:ILibraryAppletCreator", {
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IApplicationFunctions, "am:IApplicationFunctions", {
|
|
||||||
{0x28, SFUNC(IApplicationFunctions::NotifyRunning)}
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
void IApplicationFunctions::NotifyRunning(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
|
||||||
response.Push<u8>(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IDebugFunctions, "am:IDebugFunctions", {
|
|
||||||
}) {}
|
|
||||||
|
|
||||||
IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAppletCommonFunctions, "am:IAppletCommonFunctions", {
|
|
||||||
}) {}
|
|
||||||
}
|
|
@ -1,185 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <services/base_service.h>
|
|
||||||
#include <services/serviceman.h>
|
|
||||||
#include <kernel/types/KProcess.h>
|
|
||||||
#include <kernel/types/KEvent.h>
|
|
||||||
#include <gpu.h>
|
|
||||||
|
|
||||||
namespace skyline::service::am {
|
|
||||||
/**
|
|
||||||
* @brief https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter
|
|
||||||
*/
|
|
||||||
class ICommonStateGetter : public BaseService {
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* @brief This enumerates all the possible contents of a #AppletMessage (https://switchbrew.org/wiki/Applet_Manager_services#AppletMessage)
|
|
||||||
*/
|
|
||||||
enum class Message : u32 {
|
|
||||||
ExitRequested = 0x4, //!< The applet has been requested to exit
|
|
||||||
FocusStateChange = 0xF, //!< There was a change in the focus state of the applet
|
|
||||||
ExecutionResumed = 0x10, //!< The execution of the applet has resumed
|
|
||||||
OperationModeChange = 0x1E, //!< There was a change in the operation mode
|
|
||||||
PerformanceModeChange = 0x1F, //!< There was a change in the performance mode
|
|
||||||
RequestToDisplay = 0x33, //!< This indicates that ApproveToDisplay should be used
|
|
||||||
CaptureButtonShortPressed = 0x5A, //!< The Capture button was short pressed
|
|
||||||
ScreenshotTaken = 0x5C //!< A screenshot was taken
|
|
||||||
};
|
|
||||||
|
|
||||||
std::shared_ptr<type::KEvent> messageEvent; //!< The event signalled when there is a message available
|
|
||||||
std::queue<Message> messageQueue;
|
|
||||||
|
|
||||||
enum class FocusState : u8 {
|
|
||||||
InFocus = 1, //!< The application is in foreground
|
|
||||||
OutOfFocus = 2 //!< The application is in the background
|
|
||||||
} focusState{FocusState::InFocus};
|
|
||||||
|
|
||||||
enum class OperationMode : u8 {
|
|
||||||
Handheld = 0, //!< The device is in handheld mode
|
|
||||||
Docked = 1 //!< The device is in docked mode
|
|
||||||
} operationMode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This queues a message for the application to read via ReceiveMessage
|
|
||||||
* @param message The message to queue
|
|
||||||
*/
|
|
||||||
void QueueMessage(Message message);
|
|
||||||
|
|
||||||
public:
|
|
||||||
ICommonStateGetter(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns the handle to a KEvent object that is signalled whenever RecieveMessage has a message (https://switchbrew.org/wiki/Applet_Manager_services#GetEventHandle)
|
|
||||||
*/
|
|
||||||
void GetEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns an #AppletMessage or 0x680 to indicate the lack of a message (https://switchbrew.org/wiki/Applet_Manager_services#ReceiveMessage)
|
|
||||||
*/
|
|
||||||
void ReceiveMessage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns if an application is in focus or not. It always returns in focus on the emulator (https://switchbrew.org/wiki/Applet_Manager_services#GetCurrentFocusState)
|
|
||||||
*/
|
|
||||||
void GetCurrentFocusState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns the current OperationMode (https://switchbrew.org/wiki/Applet_Manager_services#GetOperationMode)
|
|
||||||
*/
|
|
||||||
void GetOperationMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns the current PerformanceMode (Same as operationMode but u32) (https://switchbrew.org/wiki/Applet_Manager_services#GetPerformanceMode)
|
|
||||||
*/
|
|
||||||
void GetPerformanceMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns the current display width and height in two u32s (https://switchbrew.org/wiki/Applet_Manager_services#GetDefaultDisplayResolution)
|
|
||||||
*/
|
|
||||||
void GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions relating to an application's own current status (https://switchbrew.org/wiki/Applet_Manager_services#ISelfController)
|
|
||||||
*/
|
|
||||||
class ISelfController : public BaseService {
|
|
||||||
public:
|
|
||||||
ISelfController(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function takes a u8 bool flag and no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetOperationModeChangedNotification)
|
|
||||||
*/
|
|
||||||
void SetOperationModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function takes a u8 bool flag and no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetPerformanceModeChangedNotification)
|
|
||||||
*/
|
|
||||||
void SetPerformanceModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function takes 3 unknown u8 values and has no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#GetCurrentFocusState)
|
|
||||||
*/
|
|
||||||
void SetFocusHandlingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function takes a u8 bool flag and has no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetOutOfFocusSuspendingEnabled)
|
|
||||||
*/
|
|
||||||
void SetOutOfFocusSuspendingEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function returns an output u64 LayerId (https://switchbrew.org/wiki/Applet_Manager_services#CreateManagedDisplayLayer)
|
|
||||||
*/
|
|
||||||
void CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions used to retrieve the status of the application's window (https://switchbrew.org/wiki/Applet_Manager_services#IWindowController)
|
|
||||||
*/
|
|
||||||
class IWindowController : public BaseService {
|
|
||||||
public:
|
|
||||||
IWindowController(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns the PID of the current application (https://switchbrew.org/wiki/Applet_Manager_services#GetAppletResourceUserId)
|
|
||||||
*/
|
|
||||||
void GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This function has mo inputs or outputs (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#AcquireForegroundRights)
|
|
||||||
*/
|
|
||||||
void AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions relating to volume control (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController)
|
|
||||||
*/
|
|
||||||
class IAudioController : public BaseService {
|
|
||||||
public:
|
|
||||||
IAudioController(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions used to capture the contents of a display (https://switchbrew.org/wiki/Applet_Manager_services#IDisplayController)
|
|
||||||
*/
|
|
||||||
class IDisplayController : public BaseService {
|
|
||||||
public:
|
|
||||||
IDisplayController(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletCreator
|
|
||||||
*/
|
|
||||||
class ILibraryAppletCreator : public BaseService {
|
|
||||||
public:
|
|
||||||
ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions that are used to notify an application about it's state (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
|
||||||
*/
|
|
||||||
class IApplicationFunctions : public BaseService {
|
|
||||||
public:
|
|
||||||
IApplicationFunctions(const DeviceState &state, ServiceManager &manager);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This returns if the application is running or not, always returns true (https://switchbrew.org/wiki/Applet_Manager_services#NotifyRunning)
|
|
||||||
*/
|
|
||||||
void NotifyRunning(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This has functions that are used for debugging purposes (https://switchbrew.org/wiki/Applet_Manager_services#IDebugFunctions)
|
|
||||||
*/
|
|
||||||
class IDebugFunctions : public BaseService {
|
|
||||||
public:
|
|
||||||
IDebugFunctions(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This contains common various functions (https://switchbrew.org/wiki/Applet_Manager_services#IAppletCommonFunctions)
|
|
||||||
*/
|
|
||||||
class IAppletCommonFunctions : public BaseService {
|
|
||||||
public:
|
|
||||||
IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager);
|
|
||||||
};
|
|
||||||
}
|
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "IAppletCommonFunctions.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAppletCommonFunctions, "am:IAppletCommonFunctions", {
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This contains common various functions (https://switchbrew.org/wiki/Applet_Manager_services#IAppletCommonFunctions)
|
||||||
|
*/
|
||||||
|
class IAppletCommonFunctions : public BaseService {
|
||||||
|
public:
|
||||||
|
IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
#include "IApplicationFunctions.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IApplicationFunctions, "am:IApplicationFunctions", {
|
||||||
|
{0x28, SFUNC(IApplicationFunctions::NotifyRunning)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IApplicationFunctions::NotifyRunning(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
response.Push<u8>(1);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions that are used to notify an application about it's state (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
||||||
|
*/
|
||||||
|
class IApplicationFunctions : public BaseService {
|
||||||
|
public:
|
||||||
|
IApplicationFunctions(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns if the application is running or not, always returns true (https://switchbrew.org/wiki/Applet_Manager_services#NotifyRunning)
|
||||||
|
*/
|
||||||
|
void NotifyRunning(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "IAudioController.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IAudioController, "am:IAudioController", {
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions relating to volume control (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController)
|
||||||
|
*/
|
||||||
|
class IAudioController : public BaseService {
|
||||||
|
public:
|
||||||
|
IAudioController(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
#include <kernel/types/KProcess.h>
|
||||||
|
#include "ICommonStateGetter.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
void ICommonStateGetter::QueueMessage(ICommonStateGetter::Message message) {
|
||||||
|
messageQueue.emplace(message);
|
||||||
|
messageEvent->Signal();
|
||||||
|
}
|
||||||
|
|
||||||
|
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, Service::am_ICommonStateGetter, "am:ICommonStateGetter", {
|
||||||
|
{0x0, SFUNC(ICommonStateGetter::GetEventHandle)},
|
||||||
|
{0x1, SFUNC(ICommonStateGetter::ReceiveMessage)},
|
||||||
|
{0x5, SFUNC(ICommonStateGetter::GetOperationMode)},
|
||||||
|
{0x6, SFUNC(ICommonStateGetter::GetPerformanceMode)},
|
||||||
|
{0x9, SFUNC(ICommonStateGetter::GetCurrentFocusState)},
|
||||||
|
{0x3C, SFUNC(ICommonStateGetter::GetDefaultDisplayResolution)}
|
||||||
|
}) {
|
||||||
|
operationMode = static_cast<OperationMode>(state.settings->GetBool("operation_mode"));
|
||||||
|
state.logger->Info("Switch to mode: {}", static_cast<bool>(operationMode) ? "Docked" : "Handheld");
|
||||||
|
QueueMessage(Message::FocusStateChange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::GetEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
auto handle = state.process->InsertItem(messageEvent);
|
||||||
|
state.logger->Debug("Applet Event Handle: 0x{:X}", handle);
|
||||||
|
response.copyHandles.push_back(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::ReceiveMessage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
if (messageQueue.empty()) {
|
||||||
|
response.errorCode = constant::status::NoMessages;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
response.Push(messageQueue.front());
|
||||||
|
messageQueue.pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::GetCurrentFocusState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
response.Push(focusState);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::GetOperationMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
response.Push(operationMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::GetPerformanceMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
response.Push(static_cast<u32>(operationMode));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ICommonStateGetter::GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
if (operationMode == OperationMode::Handheld) {
|
||||||
|
response.Push<u32>(constant::HandheldResolutionW);
|
||||||
|
response.Push<u32>(constant::HandheldResolutionH);
|
||||||
|
} else if (operationMode == OperationMode::Docked) {
|
||||||
|
response.Push<u32>(constant::DockedResolutionW);
|
||||||
|
response.Push<u32>(constant::DockedResolutionH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,80 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <kernel/types/KEvent.h>
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter
|
||||||
|
*/
|
||||||
|
class ICommonStateGetter : public BaseService {
|
||||||
|
private:
|
||||||
|
/**
|
||||||
|
* @brief This enumerates all the possible contents of a #AppletMessage (https://switchbrew.org/wiki/Applet_Manager_services#AppletMessage)
|
||||||
|
*/
|
||||||
|
enum class Message : u32 {
|
||||||
|
ExitRequested = 0x4, //!< The applet has been requested to exit
|
||||||
|
FocusStateChange = 0xF, //!< There was a change in the focus state of the applet
|
||||||
|
ExecutionResumed = 0x10, //!< The execution of the applet has resumed
|
||||||
|
OperationModeChange = 0x1E, //!< There was a change in the operation mode
|
||||||
|
PerformanceModeChange = 0x1F, //!< There was a change in the performance mode
|
||||||
|
RequestToDisplay = 0x33, //!< This indicates that ApproveToDisplay should be used
|
||||||
|
CaptureButtonShortPressed = 0x5A, //!< The Capture button was short pressed
|
||||||
|
ScreenshotTaken = 0x5C //!< A screenshot was taken
|
||||||
|
};
|
||||||
|
|
||||||
|
std::shared_ptr<type::KEvent> messageEvent; //!< The event signalled when there is a message available
|
||||||
|
std::queue<Message> messageQueue;
|
||||||
|
|
||||||
|
enum class FocusState : u8 {
|
||||||
|
InFocus = 1, //!< The application is in foreground
|
||||||
|
OutOfFocus = 2 //!< The application is in the background
|
||||||
|
} focusState{FocusState::InFocus};
|
||||||
|
|
||||||
|
enum class OperationMode : u8 {
|
||||||
|
Handheld = 0, //!< The device is in handheld mode
|
||||||
|
Docked = 1 //!< The device is in docked mode
|
||||||
|
} operationMode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This queues a message for the application to read via ReceiveMessage
|
||||||
|
* @param message The message to queue
|
||||||
|
*/
|
||||||
|
void QueueMessage(Message message);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ICommonStateGetter(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns the handle to a KEvent object that is signalled whenever RecieveMessage has a message (https://switchbrew.org/wiki/Applet_Manager_services#GetEventHandle)
|
||||||
|
*/
|
||||||
|
void GetEventHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns an #AppletMessage or 0x680 to indicate the lack of a message (https://switchbrew.org/wiki/Applet_Manager_services#ReceiveMessage)
|
||||||
|
*/
|
||||||
|
void ReceiveMessage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns if an application is in focus or not. It always returns in focus on the emulator (https://switchbrew.org/wiki/Applet_Manager_services#GetCurrentFocusState)
|
||||||
|
*/
|
||||||
|
void GetCurrentFocusState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns the current OperationMode (https://switchbrew.org/wiki/Applet_Manager_services#GetOperationMode)
|
||||||
|
*/
|
||||||
|
void GetOperationMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns the current PerformanceMode (Same as operationMode but u32) (https://switchbrew.org/wiki/Applet_Manager_services#GetPerformanceMode)
|
||||||
|
*/
|
||||||
|
void GetPerformanceMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns the current display width and height in two u32s (https://switchbrew.org/wiki/Applet_Manager_services#GetDefaultDisplayResolution)
|
||||||
|
*/
|
||||||
|
void GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "IDebugFunctions.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IDebugFunctions, "am:IDebugFunctions", {
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions that are used for debugging purposes (https://switchbrew.org/wiki/Applet_Manager_services#IDebugFunctions)
|
||||||
|
*/
|
||||||
|
class IDebugFunctions : public BaseService {
|
||||||
|
public:
|
||||||
|
IDebugFunctions(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "IDisplayController.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IDisplayController, "am:IDisplayController", {
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions used to capture the contents of a display (https://switchbrew.org/wiki/Applet_Manager_services#IDisplayController)
|
||||||
|
*/
|
||||||
|
class IDisplayController : public BaseService {
|
||||||
|
public:
|
||||||
|
IDisplayController(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
#include "ILibraryAppletCreator.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_ILibraryAppletCreator, "am:ILibraryAppletCreator", {
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletCreator
|
||||||
|
*/
|
||||||
|
class ILibraryAppletCreator : public BaseService {
|
||||||
|
public:
|
||||||
|
ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
#include <gpu.h>
|
||||||
|
#include "ISelfController.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_ISelfController, "am:ISelfController", {
|
||||||
|
{0xB, SFUNC(ISelfController::SetOperationModeChangedNotification)},
|
||||||
|
{0xC, SFUNC(ISelfController::SetPerformanceModeChangedNotification)},
|
||||||
|
{0xD, SFUNC(ISelfController::SetFocusHandlingMode)},
|
||||||
|
{0x10, SFUNC(ISelfController::SetOutOfFocusSuspendingEnabled)},
|
||||||
|
{0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void ISelfController::SetOperationModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
|
||||||
|
void ISelfController::SetPerformanceModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
|
||||||
|
void ISelfController::SetFocusHandlingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
|
||||||
|
void ISelfController::SetOutOfFocusSuspendingEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
|
||||||
|
void ISelfController::CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
state.logger->Debug("Creating Managed Layer");
|
||||||
|
if (state.gpu->layerStatus == gpu::LayerStatus::Initialized)
|
||||||
|
throw exception("The application is creating more than one layer");
|
||||||
|
state.gpu->layerStatus = gpu::LayerStatus::Initialized;
|
||||||
|
response.Push<u64>(0);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions relating to an application's own current status (https://switchbrew.org/wiki/Applet_Manager_services#ISelfController)
|
||||||
|
*/
|
||||||
|
class ISelfController : public BaseService {
|
||||||
|
public:
|
||||||
|
ISelfController(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function takes a u8 bool flag and no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetOperationModeChangedNotification)
|
||||||
|
*/
|
||||||
|
void SetOperationModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function takes a u8 bool flag and no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetPerformanceModeChangedNotification)
|
||||||
|
*/
|
||||||
|
void SetPerformanceModeChangedNotification(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function takes 3 unknown u8 values and has no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#GetCurrentFocusState)
|
||||||
|
*/
|
||||||
|
void SetFocusHandlingMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function takes a u8 bool flag and has no output (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#SetOutOfFocusSuspendingEnabled)
|
||||||
|
*/
|
||||||
|
void SetOutOfFocusSuspendingEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function returns an output u64 LayerId (https://switchbrew.org/wiki/Applet_Manager_services#CreateManagedDisplayLayer)
|
||||||
|
*/
|
||||||
|
void CreateManagedDisplayLayer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
#include <kernel/types/KProcess.h>
|
||||||
|
#include "IWindowController.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, Service::am_IWindowController, "am:IWindowController", {
|
||||||
|
{0x1, SFUNC(IWindowController::GetAppletResourceUserId)},
|
||||||
|
{0xA, SFUNC(IWindowController::AcquireForegroundRights)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IWindowController::GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
response.Push(static_cast<u64>(state.process->pid));
|
||||||
|
}
|
||||||
|
|
||||||
|
void IWindowController::AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief This has functions used to retrieve the status of the application's window (https://switchbrew.org/wiki/Applet_Manager_services#IWindowController)
|
||||||
|
*/
|
||||||
|
class IWindowController : public BaseService {
|
||||||
|
public:
|
||||||
|
IWindowController(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns the PID of the current application (https://switchbrew.org/wiki/Applet_Manager_services#GetAppletResourceUserId)
|
||||||
|
*/
|
||||||
|
void GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This function has mo inputs or outputs (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#AcquireForegroundRights)
|
||||||
|
*/
|
||||||
|
void AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
#include <services/am/controller/IApplicationFunctions.h>
|
||||||
|
#include "IApplicationProxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_IApplicationProxy, "am:IApplicationProxy", {
|
||||||
|
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
||||||
|
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
||||||
|
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
||||||
|
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
||||||
|
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
||||||
|
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
||||||
|
{0x14, SFUNC(IApplicationProxy::GetApplicationFunctions)},
|
||||||
|
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
||||||
|
}) {}
|
||||||
|
|
||||||
|
void IApplicationProxy::GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IApplicationFunctions), session, response);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base_proxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief IApplicationProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationProxy)
|
||||||
|
*/
|
||||||
|
class IApplicationProxy : public BaseProxy {
|
||||||
|
public:
|
||||||
|
IApplicationProxy(const DeviceState &state, ServiceManager &manager);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IApplicationFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
||||||
|
*/
|
||||||
|
void GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#include "ILibraryAppletProxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_ILibraryAppletProxy, "am:ILibraryAppletProxy", {
|
||||||
|
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
||||||
|
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
||||||
|
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
||||||
|
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
||||||
|
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
||||||
|
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
||||||
|
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base_proxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief ILibraryAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletProxy)
|
||||||
|
*/
|
||||||
|
class ILibraryAppletProxy : public BaseProxy {
|
||||||
|
public:
|
||||||
|
ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#include "IOverlayAppletProxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_IOverlayAppletProxy, "am:IOverlayAppletProxy", {
|
||||||
|
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
||||||
|
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
||||||
|
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
||||||
|
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
||||||
|
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
||||||
|
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
||||||
|
{0x15, SFUNC(BaseProxy::GetAppletCommonFunctions)},
|
||||||
|
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base_proxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief IOverlayAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#IOverlayAppletProxy)
|
||||||
|
*/
|
||||||
|
class IOverlayAppletProxy : public BaseProxy {
|
||||||
|
public:
|
||||||
|
IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
#include "ISystemAppletProxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, Service::am_ISystemAppletProxy, "am:ISystemAppletProxy", {
|
||||||
|
{0x0, SFUNC(BaseProxy::GetCommonStateGetter)},
|
||||||
|
{0x1, SFUNC(BaseProxy::GetSelfController)},
|
||||||
|
{0x2, SFUNC(BaseProxy::GetWindowController)},
|
||||||
|
{0x3, SFUNC(BaseProxy::GetAudioController)},
|
||||||
|
{0x4, SFUNC(BaseProxy::GetDisplayController)},
|
||||||
|
{0xB, SFUNC(BaseProxy::GetLibraryAppletCreator)},
|
||||||
|
{0x17, SFUNC(BaseProxy::GetAppletCommonFunctions)},
|
||||||
|
{0x3E8, SFUNC(BaseProxy::GetDebugFunctions)}
|
||||||
|
}) {}
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "base_proxy.h"
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief ISystemAppletProxy returns handles to various services (https://switchbrew.org/wiki/Applet_Manager_services#ISystemAppletProxy)
|
||||||
|
*/
|
||||||
|
class ISystemAppletProxy : public BaseProxy {
|
||||||
|
public:
|
||||||
|
ISystemAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||||
|
};
|
||||||
|
}
|
46
app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp
Normal file
46
app/src/main/cpp/skyline/services/am/proxy/base_proxy.cpp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
#include <services/am/controller/ICommonStateGetter.h>
|
||||||
|
#include <services/am/controller/ISelfController.h>
|
||||||
|
#include <services/am/controller/IWindowController.h>
|
||||||
|
#include <services/am/controller/IAudioController.h>
|
||||||
|
#include <services/am/controller/IDisplayController.h>
|
||||||
|
#include <services/am/controller/ILibraryAppletCreator.h>
|
||||||
|
#include <services/am/controller/IDebugFunctions.h>
|
||||||
|
#include <services/am/controller/IAppletCommonFunctions.h>
|
||||||
|
#include "base_proxy.h"
|
||||||
|
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager, const Service serviceType, const std::string &serviceName, const std::unordered_map<u32, std::function<void(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable) : BaseService(state, manager, serviceType, serviceName, vTable) {}
|
||||||
|
|
||||||
|
void BaseProxy::GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(ICommonStateGetter), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetSelfController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(ISelfController), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetWindowController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IWindowController), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetAudioController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IAudioController), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetDisplayController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IDisplayController), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(ILibraryAppletCreator), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetDebugFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IDebugFunctions), session, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
void BaseProxy::GetAppletCommonFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||||
|
manager.RegisterService(SRVREG(IAppletCommonFunctions), session, response);
|
||||||
|
}
|
||||||
|
}
|
54
app/src/main/cpp/skyline/services/am/proxy/base_proxy.h
Normal file
54
app/src/main/cpp/skyline/services/am/proxy/base_proxy.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <services/base_service.h>
|
||||||
|
#include <services/serviceman.h>
|
||||||
|
|
||||||
|
namespace skyline::service::am {
|
||||||
|
/**
|
||||||
|
* @brief BaseProxy contains common functions used by most service proxies
|
||||||
|
*/
|
||||||
|
class BaseProxy : public BaseService {
|
||||||
|
public:
|
||||||
|
BaseProxy(const DeviceState &state, ServiceManager &manager, const Service serviceType, const std::string &serviceName, const std::unordered_map<u32, std::function<void(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #ICommonStateGetter (https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter)
|
||||||
|
*/
|
||||||
|
void GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #ISelfController (https://switchbrew.org/wiki/Applet_Manager_services#ISelfController)
|
||||||
|
*/
|
||||||
|
void GetSelfController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IWindowController (https://switchbrew.org/wiki/Applet_Manager_services#IWindowController)
|
||||||
|
*/
|
||||||
|
void GetWindowController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IAudioController (https://switchbrew.org/wiki/Applet_Manager_services#IAudioController)
|
||||||
|
*/
|
||||||
|
void GetAudioController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IDisplayController (https://switchbrew.org/wiki/Applet_Manager_services#IDisplayController)
|
||||||
|
*/
|
||||||
|
void GetDisplayController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #ILibraryAppletCreator (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletCreator)
|
||||||
|
*/
|
||||||
|
void GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IDebugFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IDebugFunctions)
|
||||||
|
*/
|
||||||
|
void GetDebugFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief This returns #IAppletCommonFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IAppletCommonFunctions)
|
||||||
|
*/
|
||||||
|
void GetAppletCommonFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||||
|
};
|
||||||
|
}
|
@ -23,8 +23,8 @@ namespace skyline::service {
|
|||||||
settings_ISystemSettingsServer,
|
settings_ISystemSettingsServer,
|
||||||
apm_IManager,
|
apm_IManager,
|
||||||
apm_ISession,
|
apm_ISession,
|
||||||
am_appletOE,
|
am_IAllSystemAppletProxiesService,
|
||||||
am_appletAE,
|
am_IApplicationProxyService,
|
||||||
am_IApplicationProxy,
|
am_IApplicationProxy,
|
||||||
am_ILibraryAppletProxy,
|
am_ILibraryAppletProxy,
|
||||||
am_ISystemAppletProxy,
|
am_ISystemAppletProxy,
|
||||||
@ -64,8 +64,8 @@ namespace skyline::service {
|
|||||||
{"fatal:u", Service::fatalsrv_IService},
|
{"fatal:u", Service::fatalsrv_IService},
|
||||||
{"set:sys", Service::settings_ISystemSettingsServer},
|
{"set:sys", Service::settings_ISystemSettingsServer},
|
||||||
{"apm", Service::apm_IManager},
|
{"apm", Service::apm_IManager},
|
||||||
{"appletOE", Service::am_appletOE},
|
{"appletOE", Service::am_IApplicationProxyService},
|
||||||
{"appletAE", Service::am_appletAE},
|
{"appletAE", Service::am_IAllSystemAppletProxiesService},
|
||||||
{"audout:u", Service::audio_IAudioOutManager},
|
{"audout:u", Service::audio_IAudioOutManager},
|
||||||
{"audren:u", Service::audio_IAudioRendererManager},
|
{"audren:u", Service::audio_IAudioRendererManager},
|
||||||
{"hid", Service::hid_IHidServer},
|
{"hid", Service::hid_IHidServer},
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
#include "sm/IUserInterface.h"
|
#include "sm/IUserInterface.h"
|
||||||
#include "settings/ISystemSettingsServer.h"
|
#include "settings/ISystemSettingsServer.h"
|
||||||
#include "apm/IManager.h"
|
#include "apm/IManager.h"
|
||||||
#include "am/applet.h"
|
#include "am/IApplicationProxyService.h"
|
||||||
#include "am/appletController.h"
|
#include "am/IAllSystemAppletProxiesService.h"
|
||||||
#include "audio/IAudioOutManager.h"
|
#include "audio/IAudioOutManager.h"
|
||||||
#include "audio/IAudioRendererManager.h"
|
#include "audio/IAudioRendererManager.h"
|
||||||
#include "fatalsrv/IService.h"
|
#include "fatalsrv/IService.h"
|
||||||
@ -35,11 +35,11 @@ namespace skyline::service {
|
|||||||
case Service::apm_IManager:
|
case Service::apm_IManager:
|
||||||
serviceObj = std::make_shared<apm::IManager>(state, *this);
|
serviceObj = std::make_shared<apm::IManager>(state, *this);
|
||||||
break;
|
break;
|
||||||
case Service::am_appletOE:
|
case Service::am_IApplicationProxyService:
|
||||||
serviceObj = std::make_shared<am::appletOE>(state, *this);
|
serviceObj = std::make_shared<am::IApplicationProxyService>(state, *this);
|
||||||
break;
|
break;
|
||||||
case Service::am_appletAE:
|
case Service::am_IAllSystemAppletProxiesService:
|
||||||
serviceObj = std::make_shared<am::appletAE>(state, *this);
|
serviceObj = std::make_shared<am::IAllSystemAppletProxiesService>(state, *this);
|
||||||
break;
|
break;
|
||||||
case Service::audio_IAudioOutManager:
|
case Service::audio_IAudioOutManager:
|
||||||
serviceObj = std::make_shared<audio::IAudioOutManager>(state, *this);
|
serviceObj = std::make_shared<audio::IAudioOutManager>(state, *this);
|
||||||
|
Loading…
Reference in New Issue
Block a user