mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-28 08:05:29 +03:00
Implement some appletOE calls
This commit is contained in:
parent
da74d8d78c
commit
45f4255ff6
@ -97,7 +97,7 @@ namespace skyline::kernel::ipc {
|
||||
std::array<u8, constant::TlsIpcSize> tls{};
|
||||
u8 *currPtr = tls.data();
|
||||
auto header = reinterpret_cast<CommandHeader *>(currPtr);
|
||||
header->raw_sz = static_cast<u32>((sizeof(PayloadHeader) + argVec.size() + constant::PaddingSum + (isDomain ? sizeof(DomainHeaderRequest) : 0)) / sizeof(u32)); // Size is in 32-bit units because Nintendo
|
||||
header->raw_sz = static_cast<u32>((sizeof(PayloadHeader) + argVec.size() + (domainObjects.size() * sizeof(handle_t)) + constant::PaddingSum + (isDomain ? sizeof(DomainHeaderRequest) : 0)) / sizeof(u32)); // Size is in 32-bit units because Nintendo
|
||||
header->handle_desc = (!copyHandles.empty() || !moveHandles.empty());
|
||||
currPtr += sizeof(CommandHeader);
|
||||
|
||||
|
@ -10,10 +10,37 @@ namespace skyline::kernel::service::am {
|
||||
}
|
||||
|
||||
IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager& manager) : BaseService(state, manager, false, Service::am_IApplicationProxy, {
|
||||
{0x0, SFunc(IApplicationProxy::GetCommonStateGetter)}
|
||||
{0x0, SFunc(IApplicationProxy::GetCommonStateGetter)},
|
||||
{0x1, SFunc(IApplicationProxy::GetSelfController)},
|
||||
{0xB, SFunc(IApplicationProxy::GetLibraryAppletCreator)},
|
||||
{0x14, SFunc(IApplicationProxy::GetApplicationFunctions)}
|
||||
}) {}
|
||||
|
||||
void IApplicationProxy::GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
// TODO: This
|
||||
manager.NewService(Service::am_ICommonStateGetter, session, response);
|
||||
}
|
||||
|
||||
void IApplicationProxy::GetSelfController(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.NewService(Service::am_ISelfController, session, response);
|
||||
}
|
||||
|
||||
void IApplicationProxy::GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.NewService(Service::am_ILibraryAppletCreator, session, response);
|
||||
}
|
||||
|
||||
void IApplicationProxy::GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.NewService(Service::am_IApplicationFunctions, session, response);
|
||||
}
|
||||
|
||||
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager& manager) : BaseService(state, manager, false, Service::am_IApplicationProxy, {
|
||||
}) {}
|
||||
|
||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager& manager) : BaseService(state, manager, false, Service::am_IApplicationProxy, {
|
||||
}) {}
|
||||
|
||||
ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager& manager) : BaseService(state, manager, false, Service::am_IApplicationProxy, {
|
||||
}) {}
|
||||
|
||||
IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager& manager) : BaseService(state, manager, false, Service::am_IApplicationProxy, {
|
||||
}) {}
|
||||
}
|
||||
|
@ -28,5 +28,40 @@ namespace skyline::kernel::service::am {
|
||||
* @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 #ILibraryAppletCreator (https://switchbrew.org/wiki/Applet_Manager_services#ILibraryAppletCreator)
|
||||
*/
|
||||
void GetLibraryAppletCreator(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
/**
|
||||
* @brief This returns #IApplicationFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
||||
*/
|
||||
void GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
};
|
||||
|
||||
class ICommonStateGetter : public BaseService {
|
||||
public:
|
||||
ICommonStateGetter(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
|
||||
class ISelfController : public BaseService {
|
||||
public:
|
||||
ISelfController(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
|
||||
class ILibraryAppletCreator : public BaseService {
|
||||
public:
|
||||
ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
|
||||
class IApplicationFunctions : public BaseService {
|
||||
public:
|
||||
IApplicationFunctions(const DeviceState &state, ServiceManager &manager);
|
||||
};
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ namespace skyline::kernel::service {
|
||||
* @brief This contains an enum for every service that's present
|
||||
*/
|
||||
enum class Service {
|
||||
sm, set_sys, apm, apm_ISession, am_appletOE, am_IApplicationProxy
|
||||
sm, set_sys, apm, apm_ISession, am_appletOE, am_IApplicationProxy, am_ICommonStateGetter, am_IApplicationFunctions, am_ISelfController, am_ILibraryAppletCreator
|
||||
};
|
||||
|
||||
/**
|
||||
@ -41,7 +41,7 @@ namespace skyline::kernel::service {
|
||||
public:
|
||||
Service serviceType; //!< Which service this is
|
||||
uint numSessions{}; //<! The amount of active sessions
|
||||
const bool hasLoop; //<! If the service has a loop or not
|
||||
const bool asLoop; //<! If the service has a loop or not
|
||||
|
||||
/**
|
||||
* @param state The state of the device
|
||||
@ -56,9 +56,12 @@ namespace skyline::kernel::service {
|
||||
*/
|
||||
void HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
try {
|
||||
for(auto& i : vTable)
|
||||
state.logger->Write(Logger::Info, "Service has cmdid [0x{:X}]", i.first);
|
||||
|
||||
vTable.at(request.payload->value)(session, request, response);
|
||||
} catch (std::out_of_range&) {
|
||||
state.logger->Write(Logger::Warn, "Cannot find function in service with type {}: 0x{:X}", serviceType, u32(request.payload->value));
|
||||
state.logger->Write(Logger::Warn, "Cannot find function in service with type {0}: 0x{1:X} ({1})", serviceType, u32(request.payload->value));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,18 @@ namespace skyline::kernel::service {
|
||||
case Service::am_IApplicationProxy:
|
||||
serviceMap[serviceType] = std::make_shared<am::IApplicationProxy>(state, *this);
|
||||
break;
|
||||
case Service::am_ICommonStateGetter:
|
||||
serviceMap[serviceType] = std::make_shared<am::ICommonStateGetter>(state, *this);
|
||||
break;
|
||||
case Service::am_ISelfController:
|
||||
serviceMap[serviceType] = std::make_shared<am::ISelfController>(state, *this);
|
||||
break;
|
||||
case Service::am_ILibraryAppletCreator:
|
||||
serviceMap[serviceType] = std::make_shared<am::ILibraryAppletCreator>(state, *this);
|
||||
break;
|
||||
case Service::am_IApplicationFunctions:
|
||||
serviceMap[serviceType] = std::make_shared<am::IApplicationFunctions>(state, *this);
|
||||
break;
|
||||
}
|
||||
serviceObj = serviceMap[serviceType];
|
||||
} else
|
||||
|
Loading…
Reference in New Issue
Block a user