mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-11-22 21:19:17 +01:00
Constexpr Maps for Service Functions
This commit is contained in:
parent
157c54f918
commit
4d6ae9aa26
@ -69,6 +69,7 @@ add_library(skyline SHARED
|
||||
${source_DIR}/skyline/kernel/types/KTransferMemory.cpp
|
||||
${source_DIR}/skyline/kernel/types/KPrivateMemory.cpp
|
||||
${source_DIR}/skyline/services/serviceman.cpp
|
||||
${source_DIR}/skyline/services/base_service.cpp
|
||||
${source_DIR}/skyline/services/common/parcel.cpp
|
||||
${source_DIR}/skyline/services/sm/IUserInterface.cpp
|
||||
${source_DIR}/skyline/services/fatalsrv/IService.cpp
|
||||
|
@ -7,15 +7,7 @@
|
||||
#include "IAccountServiceForApplication.h"
|
||||
|
||||
namespace skyline::service::account {
|
||||
IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x1, SFUNC(IAccountServiceForApplication::GetUserExistence)},
|
||||
{0x2, SFUNC(IAccountServiceForApplication::ListAllUsers)},
|
||||
{0x3, SFUNC(IAccountServiceForApplication::ListOpenUsers)},
|
||||
{0x4, SFUNC(IAccountServiceForApplication::GetLastOpenedUser)},
|
||||
{0x5, SFUNC(IAccountServiceForApplication::GetProfile)},
|
||||
{0x64, SFUNC(IAccountServiceForApplication::InitializeApplicationInfoV0)},
|
||||
{0x65, SFUNC(IAccountServiceForApplication::GetBaasAccountManagerForApplication)}
|
||||
}) {}
|
||||
IAccountServiceForApplication::IAccountServiceForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAccountServiceForApplication::GetUserExistence(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto id = request.Pop<UserId>();
|
||||
|
@ -16,7 +16,7 @@ namespace skyline {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This hold an account's user ID
|
||||
* @brief An HOS account's user ID
|
||||
*/
|
||||
struct UserId {
|
||||
u64 upper; //!< The upper 64 bits of the user ID
|
||||
@ -30,6 +30,7 @@ namespace skyline {
|
||||
return !(*this == userId);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief IAccountServiceForApplication or acc:u0 provides functions for reading user information (https://switchbrew.org/wiki/Account_services#acc:u0)
|
||||
*/
|
||||
@ -77,10 +78,20 @@ namespace skyline {
|
||||
* @brief This returns a handle to an IManagerForApplication which can be used for reading Nintendo Online info
|
||||
*/
|
||||
Result GetBaasAccountManagerForApplication(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, IAccountServiceForApplication, GetUserExistence),
|
||||
SFUNC(0x2, IAccountServiceForApplication, ListAllUsers),
|
||||
SFUNC(0x3, IAccountServiceForApplication, ListOpenUsers),
|
||||
SFUNC(0x4, IAccountServiceForApplication, GetLastOpenedUser),
|
||||
SFUNC(0x5, IAccountServiceForApplication, GetProfile),
|
||||
SFUNC(0x64, IAccountServiceForApplication, InitializeApplicationInfoV0),
|
||||
SFUNC(0x65, IAccountServiceForApplication, GetBaasAccountManagerForApplication)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
||||
namespace constant {
|
||||
constexpr service::account::UserId DefaultUserId = {0x0000000000000001, 0x0000000000000000}; //!< The default user ID
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IManagerForApplication.h"
|
||||
|
||||
namespace skyline::service::account {
|
||||
IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IManagerForApplication::IManagerForApplication(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -5,10 +5,7 @@
|
||||
#include "IProfile.h"
|
||||
|
||||
namespace skyline::service::account {
|
||||
IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IProfile::Get)},
|
||||
{0x1, SFUNC(IProfile::GetBase)}
|
||||
}) {}
|
||||
IProfile::IProfile(const DeviceState &state, ServiceManager &manager, const UserId &userId) : userId(userId), BaseService(state, manager) {}
|
||||
|
||||
Result IProfile::Get(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
struct AccountUserData {
|
||||
|
@ -27,5 +27,10 @@ namespace skyline::service::account {
|
||||
* @brief This returns an AccountProfileBase object that describe the user's information
|
||||
*/
|
||||
Result GetBase(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IProfile, Get),
|
||||
SFUNC(0x1, IProfile, GetBase)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -8,13 +8,7 @@
|
||||
#include "IAllSystemAppletProxiesService.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x64, SFUNC(IAllSystemAppletProxiesService::OpenSystemAppletProxy)},
|
||||
{0xC8, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)},
|
||||
{0xC9, SFUNC(IAllSystemAppletProxiesService::OpenLibraryAppletProxy)},
|
||||
{0x12C, SFUNC(IAllSystemAppletProxiesService::OpenOverlayAppletProxy)},
|
||||
{0x15E, SFUNC(IAllSystemAppletProxiesService::OpenApplicationProxy)}
|
||||
}) {}
|
||||
IAllSystemAppletProxiesService::IAllSystemAppletProxiesService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAllSystemAppletProxiesService::OpenLibraryAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ILibraryAppletProxy), session, response);
|
||||
|
@ -33,5 +33,13 @@ namespace skyline::service::am {
|
||||
* @brief This returns #ISystemAppletProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenSystemAppletProxy)
|
||||
*/
|
||||
Result OpenSystemAppletProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x64, IAllSystemAppletProxiesService, OpenSystemAppletProxy),
|
||||
SFUNC(0xC8, IAllSystemAppletProxiesService, OpenLibraryAppletProxy),
|
||||
SFUNC(0xC9, IAllSystemAppletProxiesService, OpenLibraryAppletProxy),
|
||||
SFUNC(0x12C, IAllSystemAppletProxiesService, OpenOverlayAppletProxy),
|
||||
SFUNC(0x15E, IAllSystemAppletProxiesService, OpenApplicationProxy)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IApplicationProxyService.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IApplicationProxyService::IApplicationProxyService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IApplicationProxyService::OpenApplicationProxy)}
|
||||
}) {}
|
||||
IApplicationProxyService::IApplicationProxyService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IApplicationProxyService::OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IApplicationProxy), session, response);
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::am {
|
||||
* @brief This returns #IApplicationProxy (https://switchbrew.org/wiki/Applet_Manager_services#OpenApplicationProxy)
|
||||
*/
|
||||
Result OpenApplicationProxy(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IApplicationProxyService, OpenApplicationProxy)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -7,13 +7,7 @@
|
||||
#include "ILibraryAppletAccessor.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ILibraryAppletAccessor::ILibraryAppletAccessor(const DeviceState &state, ServiceManager &manager) : stateChangeEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(ILibraryAppletAccessor::GetAppletStateChangedEvent)},
|
||||
{0xA, SFUNC(ILibraryAppletAccessor::Start)},
|
||||
{0x1E, SFUNC(ILibraryAppletAccessor::GetResult)},
|
||||
{0x64, SFUNC(ILibraryAppletAccessor::PushInData)},
|
||||
{0x65, SFUNC(ILibraryAppletAccessor::PopOutData)},
|
||||
}) {}
|
||||
ILibraryAppletAccessor::ILibraryAppletAccessor(const DeviceState &state, ServiceManager &manager) : stateChangeEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result ILibraryAppletAccessor::GetAppletStateChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
stateChangeEvent->Signal();
|
||||
|
@ -42,5 +42,13 @@ namespace skyline::service::am {
|
||||
* @brief This function receives data from the library applet (https://switchbrew.org/wiki/Applet_Manager_services#PopOutData)
|
||||
*/
|
||||
Result PopOutData(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ILibraryAppletAccessor, GetAppletStateChangedEvent),
|
||||
SFUNC(0xA, ILibraryAppletAccessor, Start),
|
||||
SFUNC(0x1E, ILibraryAppletAccessor, GetResult),
|
||||
SFUNC(0x64, ILibraryAppletAccessor, PushInData),
|
||||
SFUNC(0x65, ILibraryAppletAccessor, PopOutData)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IAppletCommonFunctions.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IAppletCommonFunctions::IAppletCommonFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -7,17 +7,7 @@
|
||||
#include "IApplicationFunctions.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : gpuErrorEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x1, SFUNC(IApplicationFunctions::PopLaunchParameter)},
|
||||
{0x14, SFUNC(IApplicationFunctions::EnsureSaveData)},
|
||||
{0x15, SFUNC(IApplicationFunctions::GetDesiredLanguage)},
|
||||
{0x28, SFUNC(IApplicationFunctions::NotifyRunning)},
|
||||
{0x32, SFUNC(IApplicationFunctions::GetPseudoDeviceId)},
|
||||
{0x42, SFUNC(IApplicationFunctions::InitializeGamePlayRecording)},
|
||||
{0x43, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)},
|
||||
{0x64, SFUNC(IApplicationFunctions::SetGamePlayRecordingState)},
|
||||
{0x82, SFUNC(IApplicationFunctions::GetGpuErrorDetectedSystemEvent)},
|
||||
}) {}
|
||||
IApplicationFunctions::IApplicationFunctions(const DeviceState &state, ServiceManager &manager) : gpuErrorEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result IApplicationFunctions::PopLaunchParameter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
constexpr u32 LaunchParameterMagic = 0xC79497CA; //!< This is the magic of the application launch parameters
|
||||
|
@ -57,5 +57,17 @@ namespace skyline::service::am {
|
||||
* @brief This obtains a handle to the system GPU error KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetGpuErrorDetectedSystemEvent)
|
||||
*/
|
||||
Result GetGpuErrorDetectedSystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, IApplicationFunctions, PopLaunchParameter),
|
||||
SFUNC(0x14, IApplicationFunctions, EnsureSaveData),
|
||||
SFUNC(0x15, IApplicationFunctions, GetDesiredLanguage),
|
||||
SFUNC(0x28, IApplicationFunctions, NotifyRunning),
|
||||
SFUNC(0x32, IApplicationFunctions, GetPseudoDeviceId),
|
||||
SFUNC(0x42, IApplicationFunctions, InitializeGamePlayRecording),
|
||||
SFUNC(0x43, IApplicationFunctions, SetGamePlayRecordingState),
|
||||
SFUNC(0x64, IApplicationFunctions, SetGamePlayRecordingState),
|
||||
SFUNC(0x82, IApplicationFunctions, GetGpuErrorDetectedSystemEvent)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,11 +4,7 @@
|
||||
#include "IAudioController.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioController::SetExpectedMasterVolume)},
|
||||
{0x1, SFUNC(IAudioController::GetMainAppletExpectedMasterVolume)},
|
||||
{0x2, SFUNC(IAudioController::GetLibraryAppletExpectedMasterVolume)}
|
||||
}) {}
|
||||
IAudioController::IAudioController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAudioController::SetExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
mainAppletVolume = request.Pop<float>();
|
||||
|
@ -32,5 +32,11 @@ namespace skyline::service::am {
|
||||
* @brief This returns the library applet volume that is expected by the application (https://switchbrew.org/wiki/Applet_Manager_services#GetLibraryAppletExpectedMasterVolume)
|
||||
*/
|
||||
Result GetLibraryAppletExpectedMasterVolume(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioController, SetExpectedMasterVolume),
|
||||
SFUNC(0x1, IAudioController, GetMainAppletExpectedMasterVolume),
|
||||
SFUNC(0x2, IAudioController, GetLibraryAppletExpectedMasterVolume)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -10,14 +10,7 @@ namespace skyline::service::am {
|
||||
messageEvent->Signal();
|
||||
}
|
||||
|
||||
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(ICommonStateGetter::GetEventHandle)},
|
||||
{0x1, SFUNC(ICommonStateGetter::ReceiveMessage)},
|
||||
{0x5, SFUNC(ICommonStateGetter::GetOperationMode)},
|
||||
{0x6, SFUNC(ICommonStateGetter::GetPerformanceMode)},
|
||||
{0x9, SFUNC(ICommonStateGetter::GetCurrentFocusState)},
|
||||
{0x3C, SFUNC(ICommonStateGetter::GetDefaultDisplayResolution)}
|
||||
}) {
|
||||
ICommonStateGetter::ICommonStateGetter(const DeviceState &state, ServiceManager &manager) : messageEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {
|
||||
operationMode = static_cast<OperationMode>(state.settings->GetBool("operation_mode"));
|
||||
state.logger->Info("Switch to mode: {}", static_cast<bool>(operationMode) ? "Docked" : "Handheld");
|
||||
QueueMessage(Message::FocusStateChange);
|
||||
|
@ -83,5 +83,14 @@ namespace skyline::service::am {
|
||||
* @brief This returns the current display width and height in two u32s (https://switchbrew.org/wiki/Applet_Manager_services#GetDefaultDisplayResolution)
|
||||
*/
|
||||
Result GetDefaultDisplayResolution(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ICommonStateGetter, GetEventHandle),
|
||||
SFUNC(0x1, ICommonStateGetter, ReceiveMessage),
|
||||
SFUNC(0x5, ICommonStateGetter, GetOperationMode),
|
||||
SFUNC(0x6, ICommonStateGetter, GetPerformanceMode),
|
||||
SFUNC(0x9, ICommonStateGetter, GetCurrentFocusState),
|
||||
SFUNC(0x3C, ICommonStateGetter, GetDefaultDisplayResolution)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IDebugFunctions.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IDebugFunctions::IDebugFunctions(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IDisplayController.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IDisplayController::IDisplayController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -6,10 +6,7 @@
|
||||
#include "ILibraryAppletCreator.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(ILibraryAppletCreator::CreateLibraryApplet)},
|
||||
{0xA, SFUNC(ILibraryAppletCreator::CreateStorage)}
|
||||
}) {}
|
||||
ILibraryAppletCreator::ILibraryAppletCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result ILibraryAppletCreator::CreateLibraryApplet(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ILibraryAppletAccessor), session, response);
|
||||
|
@ -23,5 +23,10 @@ namespace skyline::service::am {
|
||||
* @brief This function creates an IStorage that can be used by the application (https://switchbrew.org/wiki/Applet_Manager_services#CreateStorage)
|
||||
*/
|
||||
Result CreateStorage(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ILibraryAppletCreator, CreateLibraryApplet),
|
||||
SFUNC(0xA, ILibraryAppletCreator, CreateStorage)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,18 +6,7 @@
|
||||
#include "ISelfController.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state)), accumulatedSuspendedTickChangedEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x1, SFUNC(ISelfController::LockExit)},
|
||||
{0x2, SFUNC(ISelfController::UnlockExit)},
|
||||
{0x9, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)},
|
||||
{0xB, SFUNC(ISelfController::SetOperationModeChangedNotification)},
|
||||
{0xC, SFUNC(ISelfController::SetPerformanceModeChangedNotification)},
|
||||
{0xD, SFUNC(ISelfController::SetFocusHandlingMode)},
|
||||
{0xE, SFUNC(ISelfController::SetRestartMessageEnabled)},
|
||||
{0x10, SFUNC(ISelfController::SetOutOfFocusSuspendingEnabled)},
|
||||
{0x28, SFUNC(ISelfController::CreateManagedDisplayLayer)},
|
||||
{0x5B, SFUNC(ISelfController::GetLibraryAppletLaunchableEvent)}
|
||||
}) {}
|
||||
ISelfController::ISelfController(const DeviceState &state, ServiceManager &manager) : libraryAppletLaunchableEvent(std::make_shared<type::KEvent>(state)), accumulatedSuspendedTickChangedEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result ISelfController::LockExit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
|
@ -67,5 +67,18 @@ namespace skyline::service::am {
|
||||
* @brief This obtains a handle to the system sleep time change KEvent (https://switchbrew.org/wiki/Applet_Manager_services#GetAccumulatedSuspendedTickChangedEvent)
|
||||
*/
|
||||
Result GetAccumulatedSuspendedTickChangedEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, ISelfController, LockExit),
|
||||
SFUNC(0x2, ISelfController, UnlockExit),
|
||||
SFUNC(0x9, ISelfController, GetLibraryAppletLaunchableEvent),
|
||||
SFUNC(0xB, ISelfController, SetOperationModeChangedNotification),
|
||||
SFUNC(0xC, ISelfController, SetPerformanceModeChangedNotification),
|
||||
SFUNC(0xD, ISelfController, SetFocusHandlingMode),
|
||||
SFUNC(0xE, ISelfController, SetRestartMessageEnabled),
|
||||
SFUNC(0x10, ISelfController, SetOutOfFocusSuspendingEnabled),
|
||||
SFUNC(0x28, ISelfController, CreateManagedDisplayLayer),
|
||||
SFUNC(0x5B, ISelfController, GetLibraryAppletLaunchableEvent)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,10 +5,7 @@
|
||||
#include "IWindowController.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x1, SFUNC(IWindowController::GetAppletResourceUserId)},
|
||||
{0xA, SFUNC(IWindowController::AcquireForegroundRights)}
|
||||
}) {}
|
||||
IWindowController::IWindowController(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IWindowController::GetAppletResourceUserId(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push(static_cast<u64>(state.process->pid));
|
||||
|
@ -23,5 +23,10 @@ namespace skyline::service::am {
|
||||
* @brief This function has mo inputs or outputs (Stubbed) (https://switchbrew.org/wiki/Applet_Manager_services#AcquireForegroundRights)
|
||||
*/
|
||||
Result AcquireForegroundRights(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, IWindowController, GetAppletResourceUserId),
|
||||
SFUNC(0xA, IWindowController, AcquireForegroundRights)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,16 +5,7 @@
|
||||
#include "IApplicationProxy.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, {
|
||||
{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)}
|
||||
}) {}
|
||||
IApplicationProxy::IApplicationProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {}
|
||||
|
||||
Result IApplicationProxy::GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IApplicationFunctions), session, response);
|
||||
|
@ -17,5 +17,19 @@ namespace skyline::service::am {
|
||||
* @brief This returns #IApplicationFunctions (https://switchbrew.org/wiki/Applet_Manager_services#IApplicationFunctions)
|
||||
*/
|
||||
Result GetApplicationFunctions(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
//#undef SFUNC_BASE
|
||||
//#define SFUNC_BASE(id, Class, BaseClass, Function) std::pair<u32, std::pair<std::function<Result(Class*, type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view>>{id, {&CallBaseFunction<Class, BaseClass, BaseClass::Function>, #Function}}
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC_BASE(0x0, IApplicationProxy, BaseProxy, GetCommonStateGetter),
|
||||
SFUNC_BASE(0x1, IApplicationProxy, BaseProxy, GetSelfController),
|
||||
SFUNC_BASE(0x2, IApplicationProxy, BaseProxy, GetWindowController),
|
||||
SFUNC_BASE(0x3, IApplicationProxy, BaseProxy, GetAudioController),
|
||||
SFUNC_BASE(0x4, IApplicationProxy, BaseProxy, GetDisplayController),
|
||||
SFUNC_BASE(0xB, IApplicationProxy, BaseProxy, GetLibraryAppletCreator),
|
||||
SFUNC(0x14, IApplicationProxy, GetApplicationFunctions),
|
||||
SFUNC_BASE(0x3E8, IApplicationProxy, BaseProxy, GetDebugFunctions)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,13 +4,5 @@
|
||||
#include "ILibraryAppletProxy.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, {
|
||||
{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)}
|
||||
}) {}
|
||||
ILibraryAppletProxy::ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {}
|
||||
}
|
||||
|
@ -12,5 +12,15 @@ namespace skyline::service::am {
|
||||
class ILibraryAppletProxy : public BaseProxy {
|
||||
public:
|
||||
ILibraryAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, BaseProxy, GetCommonStateGetter),
|
||||
SFUNC(0x1, BaseProxy, GetSelfController),
|
||||
SFUNC(0x2, BaseProxy, GetWindowController),
|
||||
SFUNC(0x3, BaseProxy, GetAudioController),
|
||||
SFUNC(0x4, BaseProxy, GetDisplayController),
|
||||
SFUNC(0xB, BaseProxy, GetLibraryAppletCreator),
|
||||
SFUNC(0x3E8, BaseProxy, GetDebugFunctions)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,14 +4,5 @@
|
||||
#include "IOverlayAppletProxy.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, {
|
||||
{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)}
|
||||
}) {}
|
||||
IOverlayAppletProxy::IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {}
|
||||
}
|
||||
|
@ -12,5 +12,16 @@ namespace skyline::service::am {
|
||||
class IOverlayAppletProxy : public BaseProxy {
|
||||
public:
|
||||
IOverlayAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, BaseProxy, GetCommonStateGetter),
|
||||
SFUNC(0x1, BaseProxy, GetSelfController),
|
||||
SFUNC(0x2, BaseProxy, GetWindowController),
|
||||
SFUNC(0x3, BaseProxy, GetAudioController),
|
||||
SFUNC(0x4, BaseProxy, GetDisplayController),
|
||||
SFUNC(0xB, BaseProxy, GetLibraryAppletCreator),
|
||||
SFUNC(0x15, BaseProxy, GetAppletCommonFunctions),
|
||||
SFUNC(0x3E8, BaseProxy, GetDebugFunctions)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,14 +4,5 @@
|
||||
#include "ISystemAppletProxy.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager, {
|
||||
{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)}
|
||||
}) {}
|
||||
ISystemAppletProxy::ISystemAppletProxy(const DeviceState &state, ServiceManager &manager) : BaseProxy(state, manager) {}
|
||||
}
|
||||
|
@ -12,5 +12,16 @@ namespace skyline::service::am {
|
||||
class ISystemAppletProxy : public BaseProxy {
|
||||
public:
|
||||
ISystemAppletProxy(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, BaseProxy, GetCommonStateGetter),
|
||||
SFUNC(0x1, BaseProxy, GetSelfController),
|
||||
SFUNC(0x2, BaseProxy, GetWindowController),
|
||||
SFUNC(0x3, BaseProxy, GetAudioController),
|
||||
SFUNC(0x4, BaseProxy, GetDisplayController),
|
||||
SFUNC(0xB, BaseProxy, GetLibraryAppletCreator),
|
||||
SFUNC(0x17, BaseProxy, GetAppletCommonFunctions),
|
||||
SFUNC(0x3E8, BaseProxy, GetDebugFunctions)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "base_proxy.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager, const std::unordered_map<u32, std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable) : BaseService(state, manager, vTable) {}
|
||||
BaseProxy::BaseProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result BaseProxy::GetCommonStateGetter(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ICommonStateGetter), session, response);
|
||||
|
@ -12,7 +12,7 @@ namespace skyline::service::am {
|
||||
*/
|
||||
class BaseProxy : public BaseService {
|
||||
public:
|
||||
BaseProxy(const DeviceState &state, ServiceManager &manager, const std::unordered_map<u32, std::function<Result(type::KSession & , ipc::IpcRequest & , ipc::IpcResponse & )>> &vTable);
|
||||
BaseProxy(const DeviceState &state, ServiceManager &manager);
|
||||
|
||||
/**
|
||||
* @brief This returns #ICommonStateGetter (https://switchbrew.org/wiki/Applet_Manager_services#ICommonStateGetter)
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IStorage.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IStorage::IStorage(const DeviceState &state, ServiceManager &manager, size_t size) : content(size), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IStorage::Open)}
|
||||
}) {}
|
||||
IStorage::IStorage(const DeviceState &state, ServiceManager &manager, size_t size) : content(size), BaseService(state, manager) {}
|
||||
|
||||
Result IStorage::Open(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(std::make_shared<IStorageAccessor>(state, manager, shared_from_this()), session, response);
|
||||
|
@ -37,5 +37,9 @@ namespace skyline::service::am {
|
||||
std::memcpy(content.data() + offset, reinterpret_cast<const u8 *>(&value), sizeof(ValueType));
|
||||
offset += sizeof(ValueType);
|
||||
}
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IStorage, Open)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,11 +6,7 @@
|
||||
#include "IStorageAccessor.h"
|
||||
|
||||
namespace skyline::service::am {
|
||||
IStorageAccessor::IStorageAccessor(const DeviceState &state, ServiceManager &manager, std::shared_ptr<IStorage> parent) : parent(parent), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IStorageAccessor::GetSize)},
|
||||
{0xA, SFUNC(IStorageAccessor::Write)},
|
||||
{0xB, SFUNC(IStorageAccessor::Read)}
|
||||
}) {}
|
||||
IStorageAccessor::IStorageAccessor(const DeviceState &state, ServiceManager &manager, std::shared_ptr<IStorage> parent) : parent(parent), BaseService(state, manager) {}
|
||||
|
||||
Result IStorageAccessor::GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
response.Push<i64>(parent->content.size());
|
||||
|
@ -36,5 +36,11 @@ namespace skyline::service::am {
|
||||
* @brief This returns a buffer containing the contents of the storage at the specified offset
|
||||
*/
|
||||
Result Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IStorageAccessor, GetSize),
|
||||
SFUNC(0xA, IStorageAccessor, Write),
|
||||
SFUNC(0xB, IStorageAccessor, Read)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IAddOnContentManager.h"
|
||||
|
||||
namespace skyline::service::aocsrv {
|
||||
IAddOnContentManager::IAddOnContentManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IAddOnContentManager::IAddOnContentManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IManager.h"
|
||||
|
||||
namespace skyline::service::apm {
|
||||
IManager::IManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IManager::OpenSession)}
|
||||
}) {}
|
||||
IManager::IManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IManager::OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ISession), session, response);
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::apm {
|
||||
* @brief This returns an handle to ISession
|
||||
*/
|
||||
Result OpenSession(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IManager, OpenSession)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,10 +4,7 @@
|
||||
#include "ISession.h"
|
||||
|
||||
namespace skyline::service::apm {
|
||||
ISession::ISession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(ISession::SetPerformanceConfiguration)},
|
||||
{0x1, SFUNC(ISession::GetPerformanceConfiguration)}
|
||||
}) {}
|
||||
ISession::ISession(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result ISession::SetPerformanceConfiguration(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto mode = request.Pop<u32>();
|
||||
|
@ -26,5 +26,10 @@ namespace skyline::service::apm {
|
||||
* @brief This retrieves the particular performanceConfig for a mode and returns it to the client (https://switchbrew.org/wiki/PPC_services#SetPerformanceConfiguration)
|
||||
*/
|
||||
Result GetPerformanceConfiguration(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ISession, SetPerformanceConfiguration),
|
||||
SFUNC(0x1, ISession, GetPerformanceConfiguration)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,16 +6,7 @@
|
||||
#include "IAudioDevice.h"
|
||||
|
||||
namespace skyline::service::audio {
|
||||
IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager) : systemEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioDevice::ListAudioDeviceName)},
|
||||
{0x1, SFUNC(IAudioDevice::SetAudioDeviceOutputVolume)},
|
||||
{0x3, SFUNC(IAudioDevice::GetActiveAudioDeviceName)},
|
||||
{0x4, SFUNC(IAudioDevice::QueryAudioDeviceSystemEvent)},
|
||||
{0x5, SFUNC(IAudioDevice::GetActiveChannelCount)},
|
||||
{0x6, SFUNC(IAudioDevice::ListAudioDeviceName)},
|
||||
{0x7, SFUNC(IAudioDevice::SetAudioDeviceOutputVolume)},
|
||||
{0xA, SFUNC(IAudioDevice::GetActiveAudioDeviceName)}
|
||||
}) {}
|
||||
IAudioDevice::IAudioDevice(const DeviceState &state, ServiceManager &manager) : systemEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result IAudioDevice::ListAudioDeviceName(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
u64 offset{};
|
||||
|
@ -41,5 +41,16 @@ namespace skyline::service::audio {
|
||||
* @brief This returns the current output devices channel count
|
||||
*/
|
||||
Result GetActiveChannelCount(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioDevice, ListAudioDeviceName),
|
||||
SFUNC(0x1, IAudioDevice, SetAudioDeviceOutputVolume),
|
||||
SFUNC(0x3, IAudioDevice, GetActiveAudioDeviceName),
|
||||
SFUNC(0x4, IAudioDevice, QueryAudioDeviceSystemEvent),
|
||||
SFUNC(0x5, IAudioDevice, GetActiveChannelCount),
|
||||
SFUNC(0x6, IAudioDevice, ListAudioDeviceName),
|
||||
SFUNC(0x7, IAudioDevice, SetAudioDeviceOutputVolume),
|
||||
SFUNC(0xA, IAudioDevice, GetActiveAudioDeviceName)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,17 +5,7 @@
|
||||
#include "IAudioOut.h"
|
||||
|
||||
namespace skyline::service::audio {
|
||||
IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate) : sampleRate(sampleRate), channelCount(channelCount), releaseEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioOut::GetAudioOutState)},
|
||||
{0x1, SFUNC(IAudioOut::StartAudioOut)},
|
||||
{0x2, SFUNC(IAudioOut::StopAudioOut)},
|
||||
{0x3, SFUNC(IAudioOut::AppendAudioOutBuffer)},
|
||||
{0x4, SFUNC(IAudioOut::RegisterBufferEvent)},
|
||||
{0x5, SFUNC(IAudioOut::GetReleasedAudioOutBuffer)},
|
||||
{0x6, SFUNC(IAudioOut::ContainsAudioOutBuffer)},
|
||||
{0x7, SFUNC(IAudioOut::AppendAudioOutBuffer)},
|
||||
{0x8, SFUNC(IAudioOut::GetReleasedAudioOutBuffer)}
|
||||
}) {
|
||||
IAudioOut::IAudioOut(const DeviceState &state, ServiceManager &manager, u8 channelCount, u32 sampleRate) : sampleRate(sampleRate), channelCount(channelCount), releaseEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {
|
||||
track = state.audio->OpenTrack(channelCount, constant::SampleRate, [this]() { this->releaseEvent->Signal(); });
|
||||
}
|
||||
|
||||
|
@ -68,5 +68,17 @@ namespace skyline::service::audio {
|
||||
* @brief Checks if the given buffer ID is in the playback queue (https://switchbrew.org/wiki/Audio_services#ContainsAudioOutBuffer)
|
||||
*/
|
||||
Result ContainsAudioOutBuffer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioOut, GetAudioOutState),
|
||||
SFUNC(0x1, IAudioOut, StartAudioOut),
|
||||
SFUNC(0x2, IAudioOut, StopAudioOut),
|
||||
SFUNC(0x3, IAudioOut, AppendAudioOutBuffer),
|
||||
SFUNC(0x4, IAudioOut, RegisterBufferEvent),
|
||||
SFUNC(0x5, IAudioOut, GetReleasedAudioOutBuffer),
|
||||
SFUNC(0x6, IAudioOut, ContainsAudioOutBuffer),
|
||||
SFUNC(0x7, IAudioOut, AppendAudioOutBuffer),
|
||||
SFUNC(0x8, IAudioOut, GetReleasedAudioOutBuffer)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,12 +6,7 @@
|
||||
#include "IAudioOut.h"
|
||||
|
||||
namespace skyline::service::audio {
|
||||
IAudioOutManager::IAudioOutManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioOutManager::ListAudioOuts)},
|
||||
{0x1, SFUNC(IAudioOutManager::OpenAudioOut)},
|
||||
{0x2, SFUNC(IAudioOutManager::ListAudioOuts)},
|
||||
{0x3, SFUNC(IAudioOutManager::OpenAudioOut)}
|
||||
}) {}
|
||||
IAudioOutManager::IAudioOutManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAudioOutManager::ListAudioOuts(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
state.process->WriteMemory(reinterpret_cast<void *>(const_cast<char *>(constant::DefaultAudioOutName.data())), request.outputBuf.at(0).address, constant::DefaultAudioOutName.size());
|
||||
|
@ -29,6 +29,13 @@ namespace skyline {
|
||||
* @brief Creates a new audoutU::IAudioOut object and returns a handle to it (https://switchbrew.org/wiki/Audio_services#OpenAudioOut)
|
||||
*/
|
||||
Result OpenAudioOut(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioOutManager, ListAudioOuts),
|
||||
SFUNC(0x1, IAudioOutManager, OpenAudioOut),
|
||||
SFUNC(0x2, IAudioOutManager, ListAudioOuts),
|
||||
SFUNC(0x3, IAudioOutManager, OpenAudioOut)
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -6,17 +6,7 @@
|
||||
|
||||
namespace skyline::service::audio::IAudioRenderer {
|
||||
IAudioRenderer::IAudioRenderer(const DeviceState &state, ServiceManager &manager, AudioRendererParameters ¶meters)
|
||||
: systemEvent(std::make_shared<type::KEvent>(state)), parameters(parameters), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioRenderer::GetSampleRate)},
|
||||
{0x1, SFUNC(IAudioRenderer::GetSampleCount)},
|
||||
{0x2, SFUNC(IAudioRenderer::GetMixBufferCount)},
|
||||
{0x3, SFUNC(IAudioRenderer::GetState)},
|
||||
{0x4, SFUNC(IAudioRenderer::RequestUpdate)},
|
||||
{0x5, SFUNC(IAudioRenderer::Start)},
|
||||
{0x6, SFUNC(IAudioRenderer::Stop)},
|
||||
{0x7, SFUNC(IAudioRenderer::QuerySystemEvent)},
|
||||
{0xA, SFUNC(IAudioRenderer::RequestUpdate)},
|
||||
}) {
|
||||
: systemEvent(std::make_shared<type::KEvent>(state)), parameters(parameters), BaseService(state, manager) {
|
||||
track = state.audio->OpenTrack(constant::ChannelCount, constant::SampleRate, []() {});
|
||||
track->Start();
|
||||
|
||||
|
@ -134,6 +134,18 @@ namespace skyline {
|
||||
* @brief Returns a handle to the sample release KEvent
|
||||
*/
|
||||
Result QuerySystemEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioRenderer, GetSampleRate),
|
||||
SFUNC(0x1, IAudioRenderer, GetSampleCount),
|
||||
SFUNC(0x2, IAudioRenderer, GetMixBufferCount),
|
||||
SFUNC(0x3, IAudioRenderer, GetState),
|
||||
SFUNC(0x4, IAudioRenderer, RequestUpdate),
|
||||
SFUNC(0x5, IAudioRenderer, Start),
|
||||
SFUNC(0x6, IAudioRenderer, Stop),
|
||||
SFUNC(0x7, IAudioRenderer, QuerySystemEvent),
|
||||
SFUNC(0xA, IAudioRenderer, RequestUpdate)
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -7,12 +7,7 @@
|
||||
#include "IAudioRendererManager.h"
|
||||
|
||||
namespace skyline::service::audio {
|
||||
IAudioRendererManager::IAudioRendererManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAudioRendererManager::OpenAudioRenderer)},
|
||||
{0x1, SFUNC(IAudioRendererManager::GetAudioRendererWorkBufferSize)},
|
||||
{0x2, SFUNC(IAudioRendererManager::GetAudioDeviceService)},
|
||||
{0x4, SFUNC(IAudioRendererManager::GetAudioDeviceService)}
|
||||
}) {}
|
||||
IAudioRendererManager::IAudioRendererManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAudioRendererManager::OpenAudioRenderer(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
IAudioRenderer::AudioRendererParameters params = request.Pop<IAudioRenderer::AudioRendererParameters>();
|
||||
|
@ -28,5 +28,12 @@ namespace skyline::service::audio {
|
||||
* @brief This returns a handle to an instance of an IAudioDevice (https://switchbrew.org/wiki/Audio_services#GetAudioDeviceService)
|
||||
*/
|
||||
Result GetAudioDeviceService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAudioRendererManager, OpenAudioRenderer),
|
||||
SFUNC(0x1, IAudioRendererManager, GetAudioRendererWorkBufferSize),
|
||||
SFUNC(0x2, IAudioRendererManager, GetAudioDeviceService),
|
||||
SFUNC(0x4, IAudioRendererManager, GetAudioDeviceService)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
35
app/src/main/cpp/skyline/services/base_service.cpp
Normal file
35
app/src/main/cpp/skyline/services/base_service.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
// SPDX-License-Identifier: MPL-2.0
|
||||
// Copyright © 2020 Skyline Team and Contributors (https://github.com/skyline-emu/)
|
||||
|
||||
#include "base_service.h"
|
||||
|
||||
namespace skyline::service {
|
||||
const std::string &BaseService::GetName() {
|
||||
if (name.empty()) {
|
||||
auto mangledName = typeid(*this).name();
|
||||
|
||||
int status{};
|
||||
size_t length{};
|
||||
std::unique_ptr<char, decltype(&std::free)> demangled{abi::__cxa_demangle(mangledName, nullptr, &length, &status), std::free};
|
||||
|
||||
name = (status == 0) ? std::string(demangled.get() + std::char_traits<char>::length("skyline::service::")) : mangledName;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
Result service::BaseService::HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::pair<std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view> function;
|
||||
try {
|
||||
function = GetServiceFunction(request.payload->value);
|
||||
state.logger->Debug("Service: {} @ {}", function.second, GetName());
|
||||
} catch (const std::out_of_range &) {
|
||||
state.logger->Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast<u32>(request.payload->value));
|
||||
return {};
|
||||
}
|
||||
try {
|
||||
return function.first(session, request, response);
|
||||
} catch (const std::exception &e) {
|
||||
throw exception("{} (Service: {} @ {})", e.what(), function.second, GetName());
|
||||
}
|
||||
}
|
||||
}
|
@ -8,8 +8,16 @@
|
||||
#include <kernel/ipc.h>
|
||||
#include <common.h>
|
||||
|
||||
#define SFUNC(function) std::bind(&function, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)
|
||||
#define SRVREG(class) std::make_shared<class>(state, manager)
|
||||
#define SFUNC(id, Class, Function) std::pair<u32, std::pair<std::function<Result(Class*, type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view>>{id, {&Class::Function, #Function}}
|
||||
#define SFUNC_BASE(id, Class, BaseClass, Function) std::pair<u32, std::pair<std::function<Result(Class*, type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view>>{id, {&CallBaseFunction<Class, BaseClass, decltype(&BaseClass::Function), &BaseClass::Function>, #Function}}
|
||||
#define SERVICE_DECL_AUTO(name, value) decltype(value) name = value
|
||||
#define SERVICE_DECL(...) \
|
||||
SERVICE_DECL_AUTO(functions, frz::make_unordered_map({__VA_ARGS__})); \
|
||||
std::pair<std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view> GetServiceFunction(u32 id) { \
|
||||
auto& function = functions.at(id); \
|
||||
return std::make_pair(std::bind(function.first, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), function.second); \
|
||||
}
|
||||
#define SRVREG(class, ...) std::make_shared<class>(state, manager, ##__VA_ARGS__)
|
||||
|
||||
namespace skyline::kernel::type {
|
||||
class KSession;
|
||||
@ -22,55 +30,48 @@ namespace skyline::service {
|
||||
class ServiceManager;
|
||||
|
||||
/**
|
||||
* @brief The BaseService class is a class for all Services to inherit from
|
||||
* @brief The base class for all service interfaces hosted by sysmodules
|
||||
*/
|
||||
class BaseService {
|
||||
private:
|
||||
std::string name; //!< The name of the service
|
||||
|
||||
protected:
|
||||
const DeviceState &state; //!< The state of the device
|
||||
ServiceManager &manager; //!< A reference to the service manager
|
||||
std::unordered_map<u32, std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> vTable; //!< This holds the mapping from a function's CmdId to the actual function
|
||||
|
||||
template<typename Class, typename BaseClass, typename BaseFunctionType, BaseFunctionType BaseFunction>
|
||||
static constexpr Result CallBaseFunction(Class* clazz, type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return (static_cast<BaseClass*>(clazz)->*BaseFunction)(session, request, response);
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* @param state The state of the device
|
||||
* @param vTable The functions of the service
|
||||
*/
|
||||
BaseService(const DeviceState &state, ServiceManager &manager, const std::unordered_map<u32, std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>> &vTable) : state(state), manager(manager), vTable(vTable) {}
|
||||
BaseService(const DeviceState &state, ServiceManager &manager) : state(state), manager(manager) {}
|
||||
|
||||
/**
|
||||
* @note To be able to extract the name of the underlying class and ensure correct destruction order
|
||||
*/
|
||||
virtual ~BaseService() = default;
|
||||
|
||||
std::string GetName() {
|
||||
int status{};
|
||||
size_t length{};
|
||||
auto mangledName{typeid(*this).name()};
|
||||
|
||||
std::unique_ptr<char, decltype(&std::free)> demangled{ abi::__cxa_demangle(mangledName, nullptr, &length, &status), std::free};
|
||||
|
||||
return (status == 0) ? std::string(demangled.get() + std::char_traits<char>::length("skyline::service::")) : mangledName;
|
||||
virtual std::pair<std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)>, std::string_view> GetServiceFunction(u32 id) {
|
||||
throw std::out_of_range("GetServiceFunction not implemented");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The name of the class
|
||||
* @note The lifetime of the returned string is tied to that of the class
|
||||
*/
|
||||
const std::string &GetName();
|
||||
|
||||
/**
|
||||
* @brief This handles all IPC commands with type request to a service
|
||||
* @param request The corresponding IpcRequest object
|
||||
* @param response The corresponding IpcResponse object
|
||||
*/
|
||||
Result HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::function<Result(type::KSession &, ipc::IpcRequest &, ipc::IpcResponse &)> function;
|
||||
try {
|
||||
function = vTable.at(request.payload->value);
|
||||
} catch (std::out_of_range &) {
|
||||
state.logger->Warn("Cannot find function in service '{0}': 0x{1:X} ({1})", GetName(), static_cast<u32>(request.payload->value));
|
||||
return {};
|
||||
}
|
||||
|
||||
try {
|
||||
return function(session, request, response);
|
||||
} catch (std::exception &e) {
|
||||
throw exception("{} (Service: {})", e.what(), GetName());
|
||||
}
|
||||
};
|
||||
Result HandleRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);;
|
||||
};
|
||||
}
|
||||
|
@ -4,11 +4,7 @@
|
||||
#include "IService.h"
|
||||
|
||||
namespace skyline::service::fatalsrv {
|
||||
IService::IService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IService::ThrowFatal)},
|
||||
{0x1, SFUNC(IService::ThrowFatal)},
|
||||
{0x2, SFUNC(IService::ThrowFatal)}
|
||||
}) {}
|
||||
IService::IService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IService::ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
throw exception("A fatal error with code: 0x{:X} has caused emulation to stop", request.Pop<u32>());
|
||||
|
@ -18,5 +18,11 @@ namespace skyline::service::fatalsrv {
|
||||
* @brief This throws an exception that causes emulation to quit
|
||||
*/
|
||||
Result ThrowFatal(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IService, ThrowFatal),
|
||||
SFUNC(0x1, IService, ThrowFatal),
|
||||
SFUNC(0x2, IService, ThrowFatal)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IFriendService.h"
|
||||
|
||||
namespace skyline::service::friends {
|
||||
IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IFriendService::IFriendService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "INotificationService.h"
|
||||
|
||||
namespace skyline::service::friends {
|
||||
INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(INotificationService::GetEvent)},
|
||||
}) {}
|
||||
INotificationService::INotificationService(const DeviceState &state, ServiceManager &manager) : notificationEvent(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result INotificationService::GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
KHandle handle = state.process->InsertItem(notificationEvent);
|
||||
|
@ -22,5 +22,9 @@ namespace skyline::service::friends {
|
||||
* @brief This returns a handle to the notification event
|
||||
*/
|
||||
Result GetEvent(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, INotificationService, GetEvent)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,10 +6,7 @@
|
||||
#include "IServiceCreator.h"
|
||||
|
||||
namespace skyline::service::friends {
|
||||
IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IServiceCreator::CreateFriendService)},
|
||||
{0x1, SFUNC(IServiceCreator::CreateNotificationService)},
|
||||
}) {}
|
||||
IServiceCreator::IServiceCreator(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IServiceCreator::CreateFriendService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IFriendService), session, response);
|
||||
|
@ -23,5 +23,10 @@ namespace skyline::service::friends {
|
||||
* @brief This opens an INotificationService that can be used by applications to receive notifications
|
||||
*/
|
||||
Result CreateNotificationService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IServiceCreator, CreateFriendService),
|
||||
SFUNC(0x1, IServiceCreator, CreateNotificationService)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,13 +6,7 @@
|
||||
#include "IFile.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IFile::IFile(std::shared_ptr<vfs::Backing> &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IFile::Read)},
|
||||
{0x1, SFUNC(IFile::Write)},
|
||||
{0x2, SFUNC(IFile::Flush)},
|
||||
{0x3, SFUNC(IFile::SetSize)},
|
||||
{0x4, SFUNC(IFile::GetSize)}
|
||||
}) {}
|
||||
IFile::IFile(std::shared_ptr<vfs::Backing> &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {}
|
||||
|
||||
Result IFile::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto readOption = request.Pop<u32>();
|
||||
|
@ -42,5 +42,13 @@ namespace skyline::service::fssrv {
|
||||
* @brief This obtains the size of an IFile
|
||||
*/
|
||||
Result GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IFile, Read),
|
||||
SFUNC(0x1, IFile, Write),
|
||||
SFUNC(0x2, IFile, Flush),
|
||||
SFUNC(0x3, IFile, SetSize),
|
||||
SFUNC(0x4, IFile, GetSize)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -8,12 +8,7 @@
|
||||
#include "IFileSystem.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IFileSystem::IFileSystem(std::shared_ptr<vfs::FileSystem> backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IFileSystem::CreateFile)},
|
||||
{0x7, SFUNC(IFileSystem::GetEntryType)},
|
||||
{0x8, SFUNC(IFileSystem::OpenFile)},
|
||||
{0xA, SFUNC(IFileSystem::Commit)}
|
||||
}) {}
|
||||
IFileSystem::IFileSystem(std::shared_ptr<vfs::FileSystem> backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {}
|
||||
|
||||
Result IFileSystem::CreateFile(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
std::string path = std::string(state.process->GetPointer<char>(request.inputBuf.at(0).address));
|
||||
|
@ -37,5 +37,12 @@ namespace skyline::service::fssrv {
|
||||
* @brief This commits all changes to the filesystem (https://switchbrew.org/wiki/Filesystem_services#Commit)
|
||||
*/
|
||||
Result Commit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IFileSystem, CreateFile),
|
||||
SFUNC(0x7, IFileSystem, GetEntryType),
|
||||
SFUNC(0x8, IFileSystem, OpenFile),
|
||||
SFUNC(0xA, IFileSystem, Commit)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -9,13 +9,7 @@
|
||||
#include "IFileSystemProxy.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x1, SFUNC(IFileSystemProxy::SetCurrentProcess)},
|
||||
{0x12, SFUNC(IFileSystemProxy::OpenSdCardFileSystem)},
|
||||
{0x33, SFUNC(IFileSystemProxy::OpenSaveDataFileSystem)},
|
||||
{0xC8, SFUNC(IFileSystemProxy::OpenDataStorageByCurrentProcess)},
|
||||
{0x3ED, SFUNC(IFileSystemProxy::GetGlobalAccessLogMode)},
|
||||
}) {}
|
||||
IFileSystemProxy::IFileSystemProxy(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IFileSystemProxy::SetCurrentProcess(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
process = request.Pop<pid_t>();
|
||||
|
@ -89,5 +89,13 @@ namespace skyline::service::fssrv {
|
||||
* @brief This returns the filesystem log access mode (https://switchbrew.org/wiki/Filesystem_services#GetGlobalAccessLogMode)
|
||||
*/
|
||||
Result GetGlobalAccessLogMode(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x1, IFileSystemProxy, SetCurrentProcess),
|
||||
SFUNC(0x12, IFileSystemProxy, OpenSdCardFileSystem),
|
||||
SFUNC(0x33, IFileSystemProxy, OpenSaveDataFileSystem),
|
||||
SFUNC(0xC8, IFileSystemProxy, OpenDataStorageByCurrentProcess),
|
||||
SFUNC(0x3ED, IFileSystemProxy, GetGlobalAccessLogMode)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,10 +6,7 @@
|
||||
#include "IStorage.h"
|
||||
|
||||
namespace skyline::service::fssrv {
|
||||
IStorage::IStorage(std::shared_ptr<vfs::Backing> &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IStorage::Read)},
|
||||
{0x4, SFUNC(IStorage::GetSize)}
|
||||
}) {}
|
||||
IStorage::IStorage(std::shared_ptr<vfs::Backing> &backing, const DeviceState &state, ServiceManager &manager) : backing(backing), BaseService(state, manager) {}
|
||||
|
||||
Result IStorage::Read(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto offset = request.Pop<i64>();
|
||||
|
@ -27,5 +27,10 @@ namespace skyline::service::fssrv {
|
||||
* @brief This obtains the size of an IStorage (https://switchbrew.org/wiki/Filesystem_services#GetSize)
|
||||
*/
|
||||
Result GetSize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IStorage, Read),
|
||||
SFUNC(0x4, IStorage, GetSize)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -7,9 +7,7 @@
|
||||
using namespace skyline::input;
|
||||
|
||||
namespace skyline::service::hid {
|
||||
IActiveVibrationDeviceList::IActiveVibrationDeviceList(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IActiveVibrationDeviceList::ActivateVibrationDevice)}
|
||||
}) {}
|
||||
IActiveVibrationDeviceList::IActiveVibrationDeviceList(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IActiveVibrationDeviceList::ActivateVibrationDevice(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle = request.Pop<NpadDeviceHandle>();
|
||||
|
@ -19,5 +19,9 @@ namespace skyline::service::hid {
|
||||
* @brief Activates a vibration device with the specified #VibrationDeviceHandle (https://switchbrew.org/wiki/HID_services#ActivateVibrationDevice)
|
||||
*/
|
||||
Result ActivateVibrationDevice(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IActiveVibrationDeviceList, ActivateVibrationDevice)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IAppletResource.h"
|
||||
|
||||
namespace skyline::service::hid {
|
||||
IAppletResource::IAppletResource(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IAppletResource::GetSharedMemoryHandle)}
|
||||
}) {}
|
||||
IAppletResource::IAppletResource(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IAppletResource::GetSharedMemoryHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
auto handle = state.process->InsertItem<type::KSharedMemory>(state.input->kHid);
|
||||
|
@ -19,5 +19,9 @@ namespace skyline::service::hid {
|
||||
* @brief This opens a handle to HID shared memory (https://switchbrew.org/wiki/HID_services#GetSharedMemoryHandle)
|
||||
*/
|
||||
Result GetSharedMemoryHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IAppletResource, GetSharedMemoryHandle)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -8,26 +8,7 @@
|
||||
using namespace skyline::input;
|
||||
|
||||
namespace skyline::service::hid {
|
||||
IHidServer::IHidServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IHidServer::CreateAppletResource)},
|
||||
{0x1, SFUNC(IHidServer::ActivateDebugPad)},
|
||||
{0xB, SFUNC(IHidServer::ActivateTouchScreen)},
|
||||
{0x64, SFUNC(IHidServer::SetSupportedNpadStyleSet)},
|
||||
{0x65, SFUNC(IHidServer::GetSupportedNpadStyleSet)},
|
||||
{0x66, SFUNC(IHidServer::SetSupportedNpadIdType)},
|
||||
{0x67, SFUNC(IHidServer::ActivateNpad)},
|
||||
{0x68, SFUNC(IHidServer::DeactivateNpad)},
|
||||
{0x6A, SFUNC(IHidServer::AcquireNpadStyleSetUpdateEventHandle)},
|
||||
{0x6C, SFUNC(IHidServer::GetPlayerLedPattern)},
|
||||
{0x6D, SFUNC(IHidServer::ActivateNpadWithRevision)},
|
||||
{0x78, SFUNC(IHidServer::SetNpadJoyHoldType)},
|
||||
{0x79, SFUNC(IHidServer::GetNpadJoyHoldType)},
|
||||
{0x7A, SFUNC(IHidServer::SetNpadJoyAssignmentModeSingleByDefault)},
|
||||
{0x7B, SFUNC(IHidServer::SetNpadJoyAssignmentModeSingle)},
|
||||
{0x7C, SFUNC(IHidServer::SetNpadJoyAssignmentModeDual)},
|
||||
{0xCB, SFUNC(IHidServer::CreateActiveVibrationDeviceList)},
|
||||
{0xCE, SFUNC(IHidServer::SendVibrationValues)}
|
||||
}) {}
|
||||
IHidServer::IHidServer(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IHidServer::CreateAppletResource(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IAppletResource), session, response);
|
||||
|
@ -104,5 +104,26 @@ namespace skyline::service::hid {
|
||||
* @brief Send vibration values to an NPad (https://switchbrew.org/wiki/HID_services#SendVibrationValues)
|
||||
*/
|
||||
Result SendVibrationValues(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IHidServer, CreateAppletResource),
|
||||
SFUNC(0x1, IHidServer, ActivateDebugPad),
|
||||
SFUNC(0xB, IHidServer, ActivateTouchScreen),
|
||||
SFUNC(0x64, IHidServer, SetSupportedNpadStyleSet),
|
||||
SFUNC(0x65, IHidServer, GetSupportedNpadStyleSet),
|
||||
SFUNC(0x66, IHidServer, SetSupportedNpadIdType),
|
||||
SFUNC(0x67, IHidServer, ActivateNpad),
|
||||
SFUNC(0x68, IHidServer, DeactivateNpad),
|
||||
SFUNC(0x6A, IHidServer, AcquireNpadStyleSetUpdateEventHandle),
|
||||
SFUNC(0x6C, IHidServer, GetPlayerLedPattern),
|
||||
SFUNC(0x6D, IHidServer, ActivateNpadWithRevision),
|
||||
SFUNC(0x78, IHidServer, SetNpadJoyHoldType),
|
||||
SFUNC(0x79, IHidServer, GetNpadJoyHoldType),
|
||||
SFUNC(0x7A, IHidServer, SetNpadJoyAssignmentModeSingleByDefault),
|
||||
SFUNC(0x7B, IHidServer, SetNpadJoyAssignmentModeSingle),
|
||||
SFUNC(0x7C, IHidServer, SetNpadJoyAssignmentModeDual),
|
||||
SFUNC(0xCB, IHidServer, CreateActiveVibrationDeviceList),
|
||||
SFUNC(0xCE, IHidServer, SendVibrationValues)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -6,12 +6,7 @@
|
||||
#include "GraphicBufferProducer.h"
|
||||
|
||||
namespace skyline::service::hosbinder {
|
||||
IHOSBinderDriver::IHOSBinderDriver(const DeviceState &state, ServiceManager &manager) : producer(hosbinder::producer.expired() ? std::make_shared<GraphicBufferProducer>(state) : hosbinder::producer.lock()), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IHOSBinderDriver::TransactParcel)},
|
||||
{0x1, SFUNC(IHOSBinderDriver::AdjustRefcount)},
|
||||
{0x2, SFUNC(IHOSBinderDriver::GetNativeHandle)},
|
||||
{0x3, SFUNC(IHOSBinderDriver::TransactParcel)}
|
||||
}) {
|
||||
IHOSBinderDriver::IHOSBinderDriver(const DeviceState &state, ServiceManager &manager) : producer(hosbinder::producer.expired() ? std::make_shared<GraphicBufferProducer>(state) : hosbinder::producer.lock()), BaseService(state, manager) {
|
||||
if (hosbinder::producer.expired())
|
||||
hosbinder::producer = producer;
|
||||
}
|
||||
|
@ -33,5 +33,12 @@ namespace skyline::service::hosbinder {
|
||||
* @brief This adjusts the reference counts to the underlying binder, it is stubbed as we aren't using the real symbols (https://switchbrew.org/wiki/Nvnflinger_services#GetNativeHandle)
|
||||
*/
|
||||
Result GetNativeHandle(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IHOSBinderDriver, TransactParcel),
|
||||
SFUNC(0x1, IHOSBinderDriver, AdjustRefcount),
|
||||
SFUNC(0x2, IHOSBinderDriver, GetNativeHandle),
|
||||
SFUNC(0x3, IHOSBinderDriver, TransactParcel)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "ILogService.h"
|
||||
|
||||
namespace skyline::service::lm {
|
||||
ILogService::ILogService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(ILogService::OpenLogger)}
|
||||
}) {}
|
||||
ILogService::ILogService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result ILogService::OpenLogger(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(ILogger), session, response);
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::lm {
|
||||
* @brief This opens an ILogger that can be used by applications to print log messages (https://switchbrew.org/wiki/Log_services#OpenLogger)
|
||||
*/
|
||||
Result OpenLogger(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ILogService, OpenLogger)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,10 +5,7 @@
|
||||
#include "ILogger.h"
|
||||
|
||||
namespace skyline::service::lm {
|
||||
ILogger::ILogger(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(ILogger::Log)},
|
||||
{0x1, SFUNC(ILogger::SetDestination)}
|
||||
}) {}
|
||||
ILogger::ILogger(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
std::string ILogger::GetFieldName(LogFieldType type) {
|
||||
switch (type) {
|
||||
|
@ -59,5 +59,10 @@ namespace skyline::service::lm {
|
||||
* @brief This sets the log destination (https://switchbrew.org/wiki/Log_services#SetDestination)
|
||||
*/
|
||||
Result SetDestination(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, ILogger, Log),
|
||||
SFUNC(0x1, ILogger, SetDestination)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IUserManager.h"
|
||||
|
||||
namespace skyline::service::nfp {
|
||||
IUser::IUser(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IUser::Initialize)}
|
||||
}) {}
|
||||
IUser::IUser(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IUser::Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
return {};
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::nfp {
|
||||
* @brief This initializes an NFP session
|
||||
*/
|
||||
Result Initialize(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IUser, Initialize)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IUserManager.h"
|
||||
|
||||
namespace skyline::service::nfp {
|
||||
IUserManager::IUserManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IUserManager::CreateUserInterface)}
|
||||
}) {}
|
||||
IUserManager::IUserManager(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IUserManager::CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IUser), session, response);
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::nfp {
|
||||
* @brief This opens an IUser that can be used by applications to access NFC devices
|
||||
*/
|
||||
Result CreateUserInterface(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IUserManager, CreateUserInterface)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,9 +5,7 @@
|
||||
#include "IGeneralService.h"
|
||||
|
||||
namespace skyline::service::nifm {
|
||||
IGeneralService::IGeneralService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x4, SFUNC(IGeneralService::CreateRequest)}
|
||||
}) {}
|
||||
IGeneralService::IGeneralService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IGeneralService::CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IRequest), session, response);
|
||||
|
@ -18,5 +18,9 @@ namespace skyline::service::nifm {
|
||||
* @brief This creates an IRequest instance that can be used to bring up the network (https://switchbrew.org/wiki/Network_Interface_services#CreateRequest)
|
||||
*/
|
||||
Result CreateRequest(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x4, IGeneralService, CreateRequest)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,12 +5,7 @@
|
||||
#include "IRequest.h"
|
||||
|
||||
namespace skyline::service::nifm {
|
||||
IRequest::IRequest(const DeviceState &state, ServiceManager &manager) : event0(std::make_shared<type::KEvent>(state)), event1(std::make_shared<type::KEvent>(state)), BaseService(state, manager, {
|
||||
{0x0, SFUNC(IRequest::GetRequestState)},
|
||||
{0x1, SFUNC(IRequest::GetResult)},
|
||||
{0x2, SFUNC(IRequest::GetSystemEventReadableHandles)},
|
||||
{0x4, SFUNC(IRequest::Submit)},
|
||||
}) {}
|
||||
IRequest::IRequest(const DeviceState &state, ServiceManager &manager) : event0(std::make_shared<type::KEvent>(state)), event1(std::make_shared<type::KEvent>(state)), BaseService(state, manager) {}
|
||||
|
||||
Result IRequest::GetRequestState(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
constexpr u32 Unsubmitted = 1; //!< The request has not been submitted
|
||||
|
@ -38,5 +38,12 @@ namespace skyline::service::nifm {
|
||||
* @brief This submits a request to bring up a network (https://switchbrew.org/wiki/Network_Interface_services#Submit)
|
||||
*/
|
||||
Result Submit(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IRequest, GetRequestState),
|
||||
SFUNC(0x1, IRequest, GetResult),
|
||||
SFUNC(0x2, IRequest, GetSystemEventReadableHandles),
|
||||
SFUNC(0x4, IRequest, Submit)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -5,10 +5,7 @@
|
||||
#include "IStaticService.h"
|
||||
|
||||
namespace skyline::service::nifm {
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x4, SFUNC(IStaticService::CreateGeneralService)},
|
||||
{0x5, SFUNC(IStaticService::CreateGeneralService)}
|
||||
}) {}
|
||||
IStaticService::IStaticService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IStaticService::CreateGeneralService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IGeneralService), session, response);
|
||||
|
@ -18,5 +18,10 @@ namespace skyline::service::nifm {
|
||||
* @brief This opens an IGeneralService that can be used by applications to control the network connection (https://switchbrew.org/wiki/Network_Interface_services#CreateGeneralServiceOld)
|
||||
*/
|
||||
Result CreateGeneralService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x4, IStaticService, CreateGeneralService),
|
||||
SFUNC(0x5, IStaticService, CreateGeneralService)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -7,15 +7,7 @@
|
||||
#include "devices/nvdevice.h"
|
||||
|
||||
namespace skyline::service::nvdrv {
|
||||
INvDrvServices::INvDrvServices(const DeviceState &state, ServiceManager &manager) : driver(nvdrv::driver.expired() ? std::make_shared<Driver>(state) : nvdrv::driver.lock()), BaseService(state, manager, {
|
||||
{0x0, SFUNC(INvDrvServices::Open)},
|
||||
{0x1, SFUNC(INvDrvServices::Ioctl)},
|
||||
{0x2, SFUNC(INvDrvServices::Close)},
|
||||
{0x3, SFUNC(INvDrvServices::Initialize)},
|
||||
{0x4, SFUNC(INvDrvServices::QueryEvent)},
|
||||
{0x8, SFUNC(INvDrvServices::SetAruid)},
|
||||
{0xD, SFUNC(INvDrvServices::SetGraphicsFirmwareMemoryMarginEnabled)}
|
||||
}) {
|
||||
INvDrvServices::INvDrvServices(const DeviceState &state, ServiceManager &manager) : driver(nvdrv::driver.expired() ? std::make_shared<Driver>(state) : nvdrv::driver.lock()), BaseService(state, manager) {
|
||||
if (nvdrv::driver.expired())
|
||||
nvdrv::driver = driver;
|
||||
}
|
||||
|
@ -63,5 +63,15 @@ namespace skyline::service::nvdrv {
|
||||
* @brief This enables the graphics firmware memory margin (https://switchbrew.org/wiki/NV_services#SetGraphicsFirmwareMemoryMarginEnabled)
|
||||
*/
|
||||
Result SetGraphicsFirmwareMemoryMarginEnabled(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, INvDrvServices, Open),
|
||||
SFUNC(0x1, INvDrvServices, Ioctl),
|
||||
SFUNC(0x2, INvDrvServices, Close),
|
||||
SFUNC(0x3, INvDrvServices, Initialize),
|
||||
SFUNC(0x4, INvDrvServices, QueryEvent),
|
||||
SFUNC(0x8, INvDrvServices, SetAruid),
|
||||
SFUNC(0xD, INvDrvServices, SetGraphicsFirmwareMemoryMarginEnabled)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -4,6 +4,5 @@
|
||||
#include "IParentalControlService.h"
|
||||
|
||||
namespace skyline::service::pctl {
|
||||
IParentalControlService::IParentalControlService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
}) {}
|
||||
IParentalControlService::IParentalControlService(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
}
|
||||
|
@ -5,10 +5,7 @@
|
||||
#include "IParentalControlServiceFactory.h"
|
||||
|
||||
namespace skyline::service::pctl {
|
||||
IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager, {
|
||||
{0x0, SFUNC(IParentalControlServiceFactory::CreateService)},
|
||||
{0x1, SFUNC(IParentalControlServiceFactory::CreateService)}
|
||||
}) {}
|
||||
IParentalControlServiceFactory::IParentalControlServiceFactory(const DeviceState &state, ServiceManager &manager) : BaseService(state, manager) {}
|
||||
|
||||
Result IParentalControlServiceFactory::CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response) {
|
||||
manager.RegisterService(SRVREG(IParentalControlService), session, response);
|
||||
|
@ -18,5 +18,10 @@ namespace skyline::service::pctl {
|
||||
* @brief This creates and initializes an IParentalControlService instance that can be used to read parental control configuration
|
||||
*/
|
||||
Result CreateService(type::KSession &session, ipc::IpcRequest &request, ipc::IpcResponse &response);
|
||||
|
||||
SERVICE_DECL(
|
||||
SFUNC(0x0, IParentalControlServiceFactory, CreateService),
|
||||
SFUNC(0x1, IParentalControlServiceFactory, CreateService)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user