2026-09-26 10:59:22

Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
lizzie
2026-09-26 10:59:22 +00:00
parent 8c55f80612
commit a77f91ee48
19 changed files with 515 additions and 528 deletions
+17 -21
View File
@@ -343,28 +343,8 @@ public:
class IProfileCommon : public ServiceFramework<IProfileCommon> {
public:
explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands,
Common::UUID user_id_, ProfileManager& profile_manager_)
explicit IProfileCommon(Core::System& system_, const char* name, bool editor_commands, Common::UUID user_id_, ProfileManager& profile_manager_)
: ServiceFramework{system_, name}, profile_manager{profile_manager_}, user_id{user_id_} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &IProfileCommon::Get, "Get"},
FunctionInfo{1, &IProfileCommon::GetBase, "GetBase"},
FunctionInfo{10, &IProfileCommon::GetImageSize, "GetImageSize"},
FunctionInfo{11, &IProfileCommon::LoadImage, "LoadImage"},
FunctionInfo{20, &IProfileCommon::Unknown20, "Unknown20"},
FunctionInfo{21, &IProfileCommon::Unknown21, "Unknown21"},
FunctionInfo{30, &IProfileCommon::Unknown30, "Unknown30"}
};
RegisterHandlers(functions);
if (editor_commands) {
static const FunctionInfo editor_functions[] = {
FunctionInfo{100, &IProfileCommon::Store, "Store"},
FunctionInfo{101, &IProfileCommon::StoreWithImage, "StoreWithImage"},
FunctionInfo{110, &IProfileCommon::Unknown110, "Unknown110"}
};
RegisterHandlers(editor_functions);
}
}
protected:
@@ -591,6 +571,22 @@ protected:
rb.Push(ResultSuccess);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &IProfileCommon::Get, "Get"},
FunctionInfo{1, &IProfileCommon::GetBase, "GetBase"},
FunctionInfo{10, &IProfileCommon::GetImageSize, "GetImageSize"},
FunctionInfo{11, &IProfileCommon::LoadImage, "LoadImage"},
FunctionInfo{20, &IProfileCommon::Unknown20, "Unknown20"},
FunctionInfo{21, &IProfileCommon::Unknown21, "Unknown21"},
FunctionInfo{30, &IProfileCommon::Unknown30, "Unknown30"},
// Editor commands
FunctionInfo{100, &IProfileCommon::Store, "Store"},
FunctionInfo{101, &IProfileCommon::StoreWithImage, "StoreWithImage"},
FunctionInfo{110, &IProfileCommon::Unknown110, "Unknown110"}
);
ProfileManager& profile_manager;
Common::UUID user_id{}; ///< The user id this profile refers to.
};
+9 -9
View File
@@ -14,15 +14,7 @@ namespace Service::APM {
class ISession final : public ServiceFramework<ISession> {
public:
explicit ISession(Core::System& system_, Controller& controller_)
: ServiceFramework{system_, "ISession"}, controller{controller_} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
FunctionInfo{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
FunctionInfo{2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"}
};
RegisterHandlers(functions);
}
explicit ISession(Core::System& system_, Controller& controller_) : ServiceFramework{system_, "ISession"}, controller{controller_} {}
private:
void SetPerformanceConfiguration(HLERequestContext& ctx) {
@@ -61,6 +53,14 @@ private:
rb.Push(ResultSuccess);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &ISession::SetPerformanceConfiguration, "SetPerformanceConfiguration"},
FunctionInfo{1, &ISession::GetPerformanceConfiguration, "GetPerformanceConfiguration"},
FunctionInfo{2, &ISession::SetCpuOverclockEnabled, "SetCpuOverclockEnabled"}
);
Controller& controller;
};
+8 -8
View File
@@ -13,15 +13,15 @@ namespace Service::GPIO {
class GPIO final : public ServiceFramework<GPIO> {
public:
explicit GPIO(Core::System& system_)
: ServiceFramework{system_, "gpio"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "Cmd0"}
};
RegisterHandlers(functions);
}
explicit GPIO(Core::System& system_) : ServiceFramework{system_, "gpio"} {}
~GPIO() override = default;
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Cmd0"}
);
};
void LoopProcess(Core::System& system) {
+28 -26
View File
@@ -17,25 +17,26 @@ namespace Service::I2C {
class I2CSession final : public ServiceFramework<I2CSession> {
public:
explicit I2CSession(Core::System& system_)
: ServiceFramework{system_, "I2CSession"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "SendOld"},
FunctionInfo{1, nullptr, "ReceiveOld"},
FunctionInfo{2, nullptr, "ExecuteCommandListOld"},
FunctionInfo{10, C<&I2CSession::Send>, "Send"},
FunctionInfo{11, nullptr, "Receive"},
FunctionInfo{12, nullptr, "ExecuteCommandList"},
FunctionInfo{13, nullptr, "SetRetryPolicy"}
};
RegisterHandlers(functions);
}
explicit I2CSession(Core::System& system_) : ServiceFramework{system_, "I2CSession"} {}
~I2CSession() override = default;
Result Send(InBuffer<BufferAttr_HipcMapAlias> in_data, u32 transaction_option) {
LOG_WARNING(Service, "(stubbed) topt={}", transaction_option);
R_THROW(ResultUnknown);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "SendOld"},
FunctionInfo{1, nullptr, "ReceiveOld"},
FunctionInfo{2, nullptr, "ExecuteCommandListOld"},
FunctionInfo{10, C<&I2CSession::Send>, "Send"},
FunctionInfo{11, nullptr, "Receive"},
FunctionInfo{12, nullptr, "ExecuteCommandList"},
FunctionInfo{13, nullptr, "SetRetryPolicy"}
);
};
enum class I2CDevice : u32 {
@@ -45,19 +46,9 @@ enum class I2CDevice : u32 {
class I2C final : public ServiceFramework<I2C> {
public:
explicit I2C(Core::System& system_)
: ServiceFramework{system_, "i2c"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"},
FunctionInfo{1, C<&I2C::OpenSession>, "OpenSession"},
FunctionInfo{2, C<&I2C::HasDevice>, "HasDevice"},
FunctionInfo{3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"},
FunctionInfo{4, C<&I2C::OpenSession2>, "OpenSession2"}
};
RegisterHandlers(functions);
}
explicit I2C(Core::System& system_) : ServiceFramework{system_, "i2c"} {}
~I2C() override = default;
Result OpenSessionForDev(OutInterface<I2CSession> out_session, s32 bus_idx, u32 slave_address, u32 addressing_mode, u32 speed_mode) {
LOG_DEBUG(Service, "(stubbed)");
*out_session = std::make_shared<I2CSession>(system);
@@ -83,6 +74,17 @@ public:
*out_session = std::make_shared<I2CSession>(system);
R_SUCCEED();
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, C<&I2C::OpenSessionForDev>, "OpenSessionForDev"},
FunctionInfo{1, C<&I2C::OpenSession>, "OpenSession"},
FunctionInfo{2, C<&I2C::HasDevice>, "HasDevice"},
FunctionInfo{3, C<&I2C::HasDeviceForDev>, "HasDeviceForDev"},
FunctionInfo{4, C<&I2C::OpenSession2>, "OpenSession2"}
);
};
void LoopProcess(Core::System& system) {
+10 -10
View File
@@ -87,16 +87,7 @@ DECLARE_ENUM_FLAG_OPERATORS(LogPacketFlags);
class ILogger final : public ServiceFramework<ILogger> {
public:
explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &ILogger::Log, "Log"},
FunctionInfo{1, &ILogger::SetDestination, "SetDestination"},
FunctionInfo{2, nullptr, "TransmitHashedLog"}, //20.0.0+
FunctionInfo{3, nullptr, "DevNotify"}, //20.0.0+
};
RegisterHandlers(functions);
}
explicit ILogger(Core::System& system_) : ServiceFramework{system_, "ILogger"} {}
private:
void Log(HLERequestContext& ctx) {
std::size_t offset{};
@@ -331,6 +322,15 @@ private:
};
static_assert(sizeof(LogPacketHeader) == 0x18, "LogPacketHeader is an invalid size");
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &ILogger::Log, "Log"},
FunctionInfo{1, &ILogger::SetDestination, "SetDestination"},
FunctionInfo{2, nullptr, "TransmitHashedLog"}, //20.0.0+
FunctionInfo{3, nullptr, "DevNotify"} //20.0.0+
);
::Common::unordered_map<LogPacketHeaderEntry, std::vector<u8>> entries{};
LogDestination destination{LogDestination::All};
};
+7 -5
View File
@@ -425,12 +425,14 @@ class NCM_V final : public ServiceFramework<NCM_V> {
public:
explicit NCM_V(Core::System& system_)
: ServiceFramework{system_, "ncm:v"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "GetSystemVersion"}
};
RegisterHandlers(functions);
{}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "GetSystemVersion"}
);
};
void LoopProcess(Core::System& system) {
+79 -74
View File
@@ -18,68 +18,71 @@ namespace Service::NFC {
class IUser final : public NfcInterface {
public:
explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) {
static const FunctionInfoTyped<IUser> functions[] = {
FunctionInfoTyped<IUser>{0, &NfcInterface::Initialize, "InitializeOld"},
FunctionInfoTyped<IUser>{1, &NfcInterface::Finalize, "FinalizeOld"},
FunctionInfoTyped<IUser>{2, &NfcInterface::GetState, "GetStateOld"},
FunctionInfoTyped<IUser>{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
FunctionInfoTyped<IUser>{400, &NfcInterface::Initialize, "Initialize"},
FunctionInfoTyped<IUser>{401, &NfcInterface::Finalize, "Finalize"},
FunctionInfoTyped<IUser>{402, &NfcInterface::GetState, "GetState"},
FunctionInfoTyped<IUser>{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"},
FunctionInfoTyped<IUser>{404, &NfcInterface::ListDevices, "ListDevices"},
FunctionInfoTyped<IUser>{405, &NfcInterface::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IUser>{406, &NfcInterface::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IUser>{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IUser>{408, &NfcInterface::StartDetection, "StartDetection"},
FunctionInfoTyped<IUser>{409, &NfcInterface::StopDetection, "StopDetection"},
FunctionInfoTyped<IUser>{410, &NfcInterface::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IUser>{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IUser>{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IUser>{1000, &NfcInterface::ReadMifare, "ReadMifare"},
FunctionInfoTyped<IUser>{1001, &NfcInterface::WriteMifare ,"WriteMifare"},
FunctionInfoTyped<IUser>{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"},
FunctionInfoTyped<IUser>{1301, nullptr, "KeepPassThroughSession"},
FunctionInfoTyped<IUser>{1302, nullptr, "ReleasePassThroughSession"}
};
RegisterHandlers(functions);
explicit IUser(Core::System& system_) : NfcInterface(system_, "NFC::IUser", BackendType::Nfc) {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<IUser>(
FunctionInfoTyped<IUser>{0, &NfcInterface::Initialize, "InitializeOld"},
FunctionInfoTyped<IUser>{1, &NfcInterface::Finalize, "FinalizeOld"},
FunctionInfoTyped<IUser>{2, &NfcInterface::GetState, "GetStateOld"},
FunctionInfoTyped<IUser>{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
FunctionInfoTyped<IUser>{400, &NfcInterface::Initialize, "Initialize"},
FunctionInfoTyped<IUser>{401, &NfcInterface::Finalize, "Finalize"},
FunctionInfoTyped<IUser>{402, &NfcInterface::GetState, "GetState"},
FunctionInfoTyped<IUser>{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"},
FunctionInfoTyped<IUser>{404, &NfcInterface::ListDevices, "ListDevices"},
FunctionInfoTyped<IUser>{405, &NfcInterface::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IUser>{406, &NfcInterface::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IUser>{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IUser>{408, &NfcInterface::StartDetection, "StartDetection"},
FunctionInfoTyped<IUser>{409, &NfcInterface::StopDetection, "StopDetection"},
FunctionInfoTyped<IUser>{410, &NfcInterface::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IUser>{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IUser>{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IUser>{1000, &NfcInterface::ReadMifare, "ReadMifare"},
FunctionInfoTyped<IUser>{1001, &NfcInterface::WriteMifare ,"WriteMifare"},
FunctionInfoTyped<IUser>{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"},
FunctionInfoTyped<IUser>{1301, nullptr, "KeepPassThroughSession"},
FunctionInfoTyped<IUser>{1302, nullptr, "ReleasePassThroughSession"}
);
};
class ISystem final : public NfcInterface {
public:
explicit ISystem(Core::System& system_)
: NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} {
static const FunctionInfoTyped<ISystem> functions[] = {
FunctionInfoTyped<ISystem>{0, &NfcInterface::Initialize, "InitializeOld"},
FunctionInfoTyped<ISystem>{1, &NfcInterface::Finalize, "FinalizeOld"},
FunctionInfoTyped<ISystem>{2, &NfcInterface::GetState, "GetStateOld"},
FunctionInfoTyped<ISystem>{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
FunctionInfoTyped<ISystem>{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"},
FunctionInfoTyped<ISystem>{400, &NfcInterface::Initialize, "Initialize"},
FunctionInfoTyped<ISystem>{401, &NfcInterface::Finalize, "Finalize"},
FunctionInfoTyped<ISystem>{402, &NfcInterface::GetState, "GetState"},
FunctionInfoTyped<ISystem>{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"},
FunctionInfoTyped<ISystem>{404, &NfcInterface::ListDevices, "ListDevices"},
FunctionInfoTyped<ISystem>{405, &NfcInterface::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<ISystem>{406, &NfcInterface::GetNpadId, "GetNpadId"},
FunctionInfoTyped<ISystem>{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<ISystem>{408, &NfcInterface::StartDetection, "StartDetection"},
FunctionInfoTyped<ISystem>{409, &NfcInterface::StopDetection, "StopDetection"},
FunctionInfoTyped<ISystem>{410, &NfcInterface::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<ISystem>{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<ISystem>{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<ISystem>{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"},
FunctionInfoTyped<ISystem>{510, nullptr, "OutputTestWave"},
FunctionInfoTyped<ISystem>{1000, &NfcInterface::ReadMifare, "ReadMifare"},
FunctionInfoTyped<ISystem>{1001, &NfcInterface::WriteMifare, "WriteMifare"},
FunctionInfoTyped<ISystem>{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"},
FunctionInfoTyped<ISystem>{1301, nullptr, "KeepPassThroughSession"},
FunctionInfoTyped<ISystem>{1302, nullptr, "ReleasePassThroughSession"}
};
RegisterHandlers(functions);
explicit ISystem(Core::System& system_) : NfcInterface{system_, "NFC::ISystem", BackendType::Nfc} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<ISystem>(
FunctionInfoTyped<ISystem>{0, &NfcInterface::Initialize, "InitializeOld"},
FunctionInfoTyped<ISystem>{1, &NfcInterface::Finalize, "FinalizeOld"},
FunctionInfoTyped<ISystem>{2, &NfcInterface::GetState, "GetStateOld"},
FunctionInfoTyped<ISystem>{3, &NfcInterface::IsNfcEnabled, "IsNfcEnabledOld"},
FunctionInfoTyped<ISystem>{100, &NfcInterface::SetNfcEnabled, "SetNfcEnabledOld"},
FunctionInfoTyped<ISystem>{400, &NfcInterface::Initialize, "Initialize"},
FunctionInfoTyped<ISystem>{401, &NfcInterface::Finalize, "Finalize"},
FunctionInfoTyped<ISystem>{402, &NfcInterface::GetState, "GetState"},
FunctionInfoTyped<ISystem>{403, &NfcInterface::IsNfcEnabled, "IsNfcEnabled"},
FunctionInfoTyped<ISystem>{404, &NfcInterface::ListDevices, "ListDevices"},
FunctionInfoTyped<ISystem>{405, &NfcInterface::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<ISystem>{406, &NfcInterface::GetNpadId, "GetNpadId"},
FunctionInfoTyped<ISystem>{407, &NfcInterface::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<ISystem>{408, &NfcInterface::StartDetection, "StartDetection"},
FunctionInfoTyped<ISystem>{409, &NfcInterface::StopDetection, "StopDetection"},
FunctionInfoTyped<ISystem>{410, &NfcInterface::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<ISystem>{411, &NfcInterface::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<ISystem>{412, &NfcInterface::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<ISystem>{500, &NfcInterface::SetNfcEnabled, "SetNfcEnabled"},
FunctionInfoTyped<ISystem>{510, nullptr, "OutputTestWave"},
FunctionInfoTyped<ISystem>{1000, &NfcInterface::ReadMifare, "ReadMifare"},
FunctionInfoTyped<ISystem>{1001, &NfcInterface::WriteMifare, "WriteMifare"},
FunctionInfoTyped<ISystem>{1300, &NfcInterface::SendCommandByPassThrough, "SendCommandByPassThrough"},
FunctionInfoTyped<ISystem>{1301, nullptr, "KeepPassThroughSession"},
FunctionInfoTyped<ISystem>{1302, nullptr, "ReleasePassThroughSession"}
);
};
// MFInterface has an unique interface but it's identical to NfcInterface so we can keep the code
@@ -87,25 +90,27 @@ public:
using MFInterface = NfcInterface;
class MFIUser final : public MFInterface {
public:
explicit MFIUser(Core::System& system_) : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} {
static const FunctionInfoTyped<MFIUser> functions[] = {
FunctionInfoTyped<MFIUser>{0, &MFIUser::Initialize, "Initialize"},
FunctionInfoTyped<MFIUser>{1, &MFIUser::Finalize, "Finalize"},
FunctionInfoTyped<MFIUser>{2, &MFIUser::ListDevices, "ListDevices"},
FunctionInfoTyped<MFIUser>{3, &MFIUser::StartDetection, "StartDetection"},
FunctionInfoTyped<MFIUser>{4, &MFIUser::StopDetection, "StopDetection"},
FunctionInfoTyped<MFIUser>{5, &MFIUser::ReadMifare, "Read"},
FunctionInfoTyped<MFIUser>{6, &MFIUser::WriteMifare, "Write"},
FunctionInfoTyped<MFIUser>{7, &MFIUser::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<MFIUser>{8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"},
FunctionInfoTyped<MFIUser>{9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"},
FunctionInfoTyped<MFIUser>{10, &MFIUser::GetState, "GetState"},
FunctionInfoTyped<MFIUser>{11, &MFIUser::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<MFIUser>{12, &MFIUser::GetNpadId, "GetNpadId"},
FunctionInfoTyped<MFIUser>{13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"}
};
RegisterHandlers(functions);
explicit MFIUser(Core::System& system_) : MFInterface{system_, "NFC::MFInterface", BackendType::Mifare} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<MFIUser>(
FunctionInfoTyped<MFIUser>{0, &MFIUser::Initialize, "Initialize"},
FunctionInfoTyped<MFIUser>{1, &MFIUser::Finalize, "Finalize"},
FunctionInfoTyped<MFIUser>{2, &MFIUser::ListDevices, "ListDevices"},
FunctionInfoTyped<MFIUser>{3, &MFIUser::StartDetection, "StartDetection"},
FunctionInfoTyped<MFIUser>{4, &MFIUser::StopDetection, "StopDetection"},
FunctionInfoTyped<MFIUser>{5, &MFIUser::ReadMifare, "Read"},
FunctionInfoTyped<MFIUser>{6, &MFIUser::WriteMifare, "Write"},
FunctionInfoTyped<MFIUser>{7, &MFIUser::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<MFIUser>{8, &MFIUser::AttachActivateEvent, "GetActivateEventHandle"},
FunctionInfoTyped<MFIUser>{9, &MFIUser::AttachDeactivateEvent, "GetDeactivateEventHandle"},
FunctionInfoTyped<MFIUser>{10, &MFIUser::GetState, "GetState"},
FunctionInfoTyped<MFIUser>{11, &MFIUser::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<MFIUser>{12, &MFIUser::GetNpadId, "GetNpadId"},
FunctionInfoTyped<MFIUser>{13, &MFIUser::AttachAvailabilityChangeEvent, "GetAvailabilityChangeEventHandle"}
);
};
class IAm final : public ServiceFramework<IAm> {
+115 -110
View File
@@ -14,133 +14,135 @@ namespace Service::NFP {
class IUser final : public Interface {
public:
explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") {
static const FunctionInfoTyped<IUser> functions[] = {
FunctionInfoTyped<IUser>{0, &IUser::Initialize, "Initialize"},
FunctionInfoTyped<IUser>{1, &IUser::Finalize, "Finalize"},
FunctionInfoTyped<IUser>{2, &IUser::ListDevices, "ListDevices"},
FunctionInfoTyped<IUser>{3, &IUser::StartDetection, "StartDetection"},
FunctionInfoTyped<IUser>{4, &IUser::StopDetection, "StopDetection"},
FunctionInfoTyped<IUser>{5, &IUser::Mount, "Mount"},
FunctionInfoTyped<IUser>{6, &IUser::Unmount, "Unmount"},
FunctionInfoTyped<IUser>{7, &IUser::OpenApplicationArea, "OpenApplicationArea"},
FunctionInfoTyped<IUser>{8, &IUser::GetApplicationArea, "GetApplicationArea"},
FunctionInfoTyped<IUser>{9, &IUser::SetApplicationArea, "SetApplicationArea"},
FunctionInfoTyped<IUser>{10, &IUser::Flush, "Flush"},
FunctionInfoTyped<IUser>{11, &IUser::Restore, "Restore"},
FunctionInfoTyped<IUser>{12, &IUser::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<IUser>{13, &IUser::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IUser>{14, &IUser::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<IUser>{15, &IUser::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<IUser>{16, &IUser::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<IUser>{17, &IUser::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IUser>{18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IUser>{19, &IUser::GetState, "GetState"},
FunctionInfoTyped<IUser>{20, &IUser::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IUser>{21, &IUser::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IUser>{22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"},
FunctionInfoTyped<IUser>{23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IUser>{24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"},
FunctionInfoTyped<IUser>{25, &IUser::StartDetection, "StartDetectionWithFilter"}
};
RegisterHandlers(functions);
explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<IUser>(
FunctionInfoTyped<IUser>{0, &IUser::Initialize, "Initialize"},
FunctionInfoTyped<IUser>{1, &IUser::Finalize, "Finalize"},
FunctionInfoTyped<IUser>{2, &IUser::ListDevices, "ListDevices"},
FunctionInfoTyped<IUser>{3, &IUser::StartDetection, "StartDetection"},
FunctionInfoTyped<IUser>{4, &IUser::StopDetection, "StopDetection"},
FunctionInfoTyped<IUser>{5, &IUser::Mount, "Mount"},
FunctionInfoTyped<IUser>{6, &IUser::Unmount, "Unmount"},
FunctionInfoTyped<IUser>{7, &IUser::OpenApplicationArea, "OpenApplicationArea"},
FunctionInfoTyped<IUser>{8, &IUser::GetApplicationArea, "GetApplicationArea"},
FunctionInfoTyped<IUser>{9, &IUser::SetApplicationArea, "SetApplicationArea"},
FunctionInfoTyped<IUser>{10, &IUser::Flush, "Flush"},
FunctionInfoTyped<IUser>{11, &IUser::Restore, "Restore"},
FunctionInfoTyped<IUser>{12, &IUser::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<IUser>{13, &IUser::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IUser>{14, &IUser::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<IUser>{15, &IUser::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<IUser>{16, &IUser::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<IUser>{17, &IUser::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IUser>{18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IUser>{19, &IUser::GetState, "GetState"},
FunctionInfoTyped<IUser>{20, &IUser::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IUser>{21, &IUser::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IUser>{22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"},
FunctionInfoTyped<IUser>{23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IUser>{24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"},
FunctionInfoTyped<IUser>{25, &IUser::StartDetection, "StartDetectionWithFilter"}
);
};
class ISystem final : public Interface {
public:
explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") {
static const FunctionInfoTyped<ISystem> functions[] = {
FunctionInfoTyped<ISystem>{0, &ISystem::InitializeSystem, "InitializeSystem"},
FunctionInfoTyped<ISystem>{1, &ISystem::FinalizeSystem, "FinalizeSystem"},
FunctionInfoTyped<ISystem>{2, &ISystem::ListDevices, "ListDevices"},
FunctionInfoTyped<ISystem>{3, &ISystem::StartDetection, "StartDetection"},
FunctionInfoTyped<ISystem>{4, &ISystem::StopDetection, "StopDetection"},
FunctionInfoTyped<ISystem>{5, &ISystem::Mount, "Mount"},
FunctionInfoTyped<ISystem>{6, &ISystem::Unmount, "Unmount"},
FunctionInfoTyped<ISystem>{10, &ISystem::Flush, "Flush"},
FunctionInfoTyped<ISystem>{11, &ISystem::Restore, "Restore"},
FunctionInfoTyped<ISystem>{12, &ISystem::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<ISystem>{13, &ISystem::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<ISystem>{14, &ISystem::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<ISystem>{15, &ISystem::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<ISystem>{16, &ISystem::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<ISystem>{17, &ISystem::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<ISystem>{18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<ISystem>{19, &ISystem::GetState, "GetState"},
FunctionInfoTyped<ISystem>{20, &ISystem::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<ISystem>{21, &ISystem::GetNpadId, "GetNpadId"},
FunctionInfoTyped<ISystem>{23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<ISystem>{25, &ISystem::StartDetection, "StartDetectionWithFilter"},
FunctionInfoTyped<ISystem>{100, &ISystem::Format, "Format"},
FunctionInfoTyped<ISystem>{101, &ISystem::GetAdminInfo, "GetAdminInfo"},
FunctionInfoTyped<ISystem>{102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"},
FunctionInfoTyped<ISystem>{103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"},
FunctionInfoTyped<ISystem>{104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"},
FunctionInfoTyped<ISystem>{105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"},
FunctionInfoTyped<ISystem>{106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"}
};
RegisterHandlers(functions);
explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<ISystem>(
FunctionInfoTyped<ISystem>{0, &ISystem::InitializeSystem, "InitializeSystem"},
FunctionInfoTyped<ISystem>{1, &ISystem::FinalizeSystem, "FinalizeSystem"},
FunctionInfoTyped<ISystem>{2, &ISystem::ListDevices, "ListDevices"},
FunctionInfoTyped<ISystem>{3, &ISystem::StartDetection, "StartDetection"},
FunctionInfoTyped<ISystem>{4, &ISystem::StopDetection, "StopDetection"},
FunctionInfoTyped<ISystem>{5, &ISystem::Mount, "Mount"},
FunctionInfoTyped<ISystem>{6, &ISystem::Unmount, "Unmount"},
FunctionInfoTyped<ISystem>{10, &ISystem::Flush, "Flush"},
FunctionInfoTyped<ISystem>{11, &ISystem::Restore, "Restore"},
FunctionInfoTyped<ISystem>{12, &ISystem::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<ISystem>{13, &ISystem::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<ISystem>{14, &ISystem::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<ISystem>{15, &ISystem::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<ISystem>{16, &ISystem::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<ISystem>{17, &ISystem::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<ISystem>{18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<ISystem>{19, &ISystem::GetState, "GetState"},
FunctionInfoTyped<ISystem>{20, &ISystem::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<ISystem>{21, &ISystem::GetNpadId, "GetNpadId"},
FunctionInfoTyped<ISystem>{23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<ISystem>{25, &ISystem::StartDetection, "StartDetectionWithFilter"},
FunctionInfoTyped<ISystem>{100, &ISystem::Format, "Format"},
FunctionInfoTyped<ISystem>{101, &ISystem::GetAdminInfo, "GetAdminInfo"},
FunctionInfoTyped<ISystem>{102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"},
FunctionInfoTyped<ISystem>{103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"},
FunctionInfoTyped<ISystem>{104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"},
FunctionInfoTyped<ISystem>{105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"},
FunctionInfoTyped<ISystem>{106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"}
);
};
class IDebug final : public Interface {
public:
explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") {
static const FunctionInfoTyped<IDebug> functions[] = {
FunctionInfoTyped<IDebug>{0, &IDebug::InitializeDebug, "InitializeDebug"},
FunctionInfoTyped<IDebug>{1, &IDebug::FinalizeDebug, "FinalizeDebug"},
FunctionInfoTyped<IDebug>{2, &IDebug::ListDevices, "ListDevices"},
FunctionInfoTyped<IDebug>{3, &IDebug::StartDetection, "StartDetection"},
FunctionInfoTyped<IDebug>{4, &IDebug::StopDetection, "StopDetection"},
FunctionInfoTyped<IDebug>{5, &IDebug::Mount, "Mount"},
FunctionInfoTyped<IDebug>{6, &IDebug::Unmount, "Unmount"},
FunctionInfoTyped<IDebug>{7, &IDebug::OpenApplicationArea, "OpenApplicationArea"},
FunctionInfoTyped<IDebug>{8, &IDebug::GetApplicationArea, "GetApplicationArea"},
FunctionInfoTyped<IDebug>{9, &IDebug::SetApplicationArea, "SetApplicationArea"},
FunctionInfoTyped<IDebug>{10, &IDebug::Flush, "Flush"},
FunctionInfoTyped<IDebug>{11, &IDebug::Restore, "Restore"},
FunctionInfoTyped<IDebug>{12, &IDebug::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<IDebug>{13, &IDebug::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IDebug>{14, &IDebug::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<IDebug>{15, &IDebug::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<IDebug>{16, &IDebug::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<IDebug>{17, &IDebug::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IDebug>{18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IDebug>{19, &IDebug::GetState, "GetState"},
FunctionInfoTyped<IDebug>{20, &IDebug::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IDebug>{21, &IDebug::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IDebug>{22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"},
FunctionInfoTyped<IDebug>{23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IDebug>{24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"},
FunctionInfoTyped<IDebug>{25, &IDebug::StartDetection, "StartDetectionWithFilter"},
FunctionInfoTyped<IDebug>{100, &IDebug::Format, "Format"},
FunctionInfoTyped<IDebug>{101, &IDebug::GetAdminInfo, "GetAdminInfo"},
FunctionInfoTyped<IDebug>{102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"},
FunctionInfoTyped<IDebug>{103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"},
FunctionInfoTyped<IDebug>{104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"},
FunctionInfoTyped<IDebug>{105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"},
FunctionInfoTyped<IDebug>{106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"},
FunctionInfoTyped<IDebug>{200, &IDebug::GetAll, "GetAll"},
FunctionInfoTyped<IDebug>{201, &IDebug::SetAll, "SetAll"},
FunctionInfoTyped<IDebug>{202, &IDebug::FlushDebug, "FlushDebug"},
FunctionInfoTyped<IDebug>{203, &IDebug::BreakTag, "BreakTag"},
FunctionInfoTyped<IDebug>{204, &IDebug::ReadBackupData, "ReadBackupData"},
FunctionInfoTyped<IDebug>{205, &IDebug::WriteBackupData, "WriteBackupData"},
FunctionInfoTyped<IDebug>{206, &IDebug::WriteNtf, "WriteNtf"}
};
RegisterHandlers(functions);
explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMapWithClass<IDebug>(
FunctionInfoTyped<IDebug>{0, &IDebug::InitializeDebug, "InitializeDebug"},
FunctionInfoTyped<IDebug>{1, &IDebug::FinalizeDebug, "FinalizeDebug"},
FunctionInfoTyped<IDebug>{2, &IDebug::ListDevices, "ListDevices"},
FunctionInfoTyped<IDebug>{3, &IDebug::StartDetection, "StartDetection"},
FunctionInfoTyped<IDebug>{4, &IDebug::StopDetection, "StopDetection"},
FunctionInfoTyped<IDebug>{5, &IDebug::Mount, "Mount"},
FunctionInfoTyped<IDebug>{6, &IDebug::Unmount, "Unmount"},
FunctionInfoTyped<IDebug>{7, &IDebug::OpenApplicationArea, "OpenApplicationArea"},
FunctionInfoTyped<IDebug>{8, &IDebug::GetApplicationArea, "GetApplicationArea"},
FunctionInfoTyped<IDebug>{9, &IDebug::SetApplicationArea, "SetApplicationArea"},
FunctionInfoTyped<IDebug>{10, &IDebug::Flush, "Flush"},
FunctionInfoTyped<IDebug>{11, &IDebug::Restore, "Restore"},
FunctionInfoTyped<IDebug>{12, &IDebug::CreateApplicationArea, "CreateApplicationArea"},
FunctionInfoTyped<IDebug>{13, &IDebug::GetTagInfo, "GetTagInfo"},
FunctionInfoTyped<IDebug>{14, &IDebug::GetRegisterInfo, "GetRegisterInfo"},
FunctionInfoTyped<IDebug>{15, &IDebug::GetCommonInfo, "GetCommonInfo"},
FunctionInfoTyped<IDebug>{16, &IDebug::GetModelInfo, "GetModelInfo"},
FunctionInfoTyped<IDebug>{17, &IDebug::AttachActivateEvent, "AttachActivateEvent"},
FunctionInfoTyped<IDebug>{18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"},
FunctionInfoTyped<IDebug>{19, &IDebug::GetState, "GetState"},
FunctionInfoTyped<IDebug>{20, &IDebug::GetDeviceState, "GetDeviceState"},
FunctionInfoTyped<IDebug>{21, &IDebug::GetNpadId, "GetNpadId"},
FunctionInfoTyped<IDebug>{22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"},
FunctionInfoTyped<IDebug>{23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
FunctionInfoTyped<IDebug>{24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"},
FunctionInfoTyped<IDebug>{25, &IDebug::StartDetection, "StartDetectionWithFilter"},
FunctionInfoTyped<IDebug>{100, &IDebug::Format, "Format"},
FunctionInfoTyped<IDebug>{101, &IDebug::GetAdminInfo, "GetAdminInfo"},
FunctionInfoTyped<IDebug>{102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"},
FunctionInfoTyped<IDebug>{103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"},
FunctionInfoTyped<IDebug>{104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"},
FunctionInfoTyped<IDebug>{105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"},
FunctionInfoTyped<IDebug>{106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"},
FunctionInfoTyped<IDebug>{200, &IDebug::GetAll, "GetAll"},
FunctionInfoTyped<IDebug>{201, &IDebug::SetAll, "SetAll"},
FunctionInfoTyped<IDebug>{202, &IDebug::FlushDebug, "FlushDebug"},
FunctionInfoTyped<IDebug>{203, &IDebug::BreakTag, "BreakTag"},
FunctionInfoTyped<IDebug>{204, &IDebug::ReadBackupData, "ReadBackupData"},
FunctionInfoTyped<IDebug>{205, &IDebug::WriteBackupData, "WriteBackupData"},
FunctionInfoTyped<IDebug>{206, &IDebug::WriteNtf, "WriteNtf"}
);
};
class IUserManager final : public ServiceFramework<IUserManager> {
public:
explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
void CreateUserInterface(HLERequestContext& ctx) {
LOG_DEBUG(Service_NFP, "called");
@@ -150,6 +152,9 @@ private:
rb.PushIpcInterface<IUser>(ctx, system);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &IUserManager::CreateUserInterface, "CreateUserInterface"}
);
+60 -56
View File
@@ -235,15 +235,6 @@ public:
explicit IScanRequest(Core::System& system_)
: ServiceFramework{system_, "IScanRequest"}, svc_ctx{system_, "IScanRequest"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &IScanRequest::Submit, "Submit"},
FunctionInfo{1, &IScanRequest::IsProcessing, "IsProcessing"},
FunctionInfo{2, &IScanRequest::GetResult, "GetResult"},
FunctionInfo{3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"},
FunctionInfo{4, &IScanRequest::SetChannels, "SetChannels"}
};
RegisterHandlers(functions);
evt_scan_complete = CreateKEvent(svc_ctx, "IScanRequest:Complete");
evt_processing = CreateKEvent(svc_ctx, "IScanRequest:Processing");
}
@@ -257,8 +248,6 @@ public:
}
private:
std::vector<Network::ScanData> scan_results;
void Submit(HLERequestContext& ctx) {
if (state.load() == State::Finished) {
@@ -329,6 +318,17 @@ private:
evt_scan_complete->Signal(system.Kernel());
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &IScanRequest::Submit, "Submit"},
FunctionInfo{1, &IScanRequest::IsProcessing, "IsProcessing"},
FunctionInfo{2, &IScanRequest::GetResult, "GetResult"},
FunctionInfo{3, &IScanRequest::GetSystemEventReadableHandle, "GetSystemEventReadableHandle"},
FunctionInfo{4, &IScanRequest::SetChannels, "SetChannels"}
);
std::vector<Network::ScanData> scan_results;
KernelHelpers::ServiceContext svc_ctx;
Kernel::KEvent* evt_scan_complete{};
@@ -342,36 +342,6 @@ class IRequest final : public ServiceFramework<IRequest> {
public:
explicit IRequest(Core::System& system_)
: ServiceFramework{system_, "IRequest"}, service_context{system_, "IRequest"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &IRequest::GetRequestState, "GetRequestState"},
FunctionInfo{1, &IRequest::GetResult, "GetResult"},
FunctionInfo{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"},
FunctionInfo{3, &IRequest::Cancel, "Cancel"},
FunctionInfo{4, &IRequest::Submit, "Submit"},
FunctionInfo{5, nullptr, "SetRequirement"},
FunctionInfo{6, &IRequest::SetRequirementPreset, "SetRequirementPreset"},
FunctionInfo{8, nullptr, "SetPriority"},
FunctionInfo{9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"},
FunctionInfo{10, nullptr, "SetRejectable"},
FunctionInfo{11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"},
FunctionInfo{12, nullptr, "SetPersistent"},
FunctionInfo{13, nullptr, "SetInstant"},
FunctionInfo{14, nullptr, "SetSustainable"},
FunctionInfo{15, nullptr, "SetRawPriority"},
FunctionInfo{16, nullptr, "SetGreedy"},
FunctionInfo{17, nullptr, "SetSharable"},
FunctionInfo{18, nullptr, "SetRequirementByRevision"},
FunctionInfo{19, nullptr, "GetRequirement"},
FunctionInfo{20, nullptr, "GetRevision"},
FunctionInfo{21, &IRequest::GetAppletInfo, "GetAppletInfo"},
FunctionInfo{22, nullptr, "GetAdditionalInfo"},
FunctionInfo{23, nullptr, "SetKeptInSleep"},
FunctionInfo{24, nullptr, "RegisterSocketDescriptor"},
FunctionInfo{25, nullptr, "UnregisterSocketDescriptor"},
FunctionInfo{26, nullptr, "GetNetworkAccessStatus"}, //21.0.0+
};
RegisterHandlers(functions);
event1 = CreateKEvent(service_context, "IRequest:Event1");
event2 = CreateKEvent(service_context, "IRequest:Event2");
state = RequestState::NotSubmitted;
@@ -494,6 +464,37 @@ private:
event1->Signal(system.Kernel());
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &IRequest::GetRequestState, "GetRequestState"},
FunctionInfo{1, &IRequest::GetResult, "GetResult"},
FunctionInfo{2, &IRequest::GetSystemEventReadableHandles, "GetSystemEventReadableHandles"},
FunctionInfo{3, &IRequest::Cancel, "Cancel"},
FunctionInfo{4, &IRequest::Submit, "Submit"},
FunctionInfo{5, nullptr, "SetRequirement"},
FunctionInfo{6, &IRequest::SetRequirementPreset, "SetRequirementPreset"},
FunctionInfo{8, nullptr, "SetPriority"},
FunctionInfo{9, &IRequest::SetNetworkProfileId, "SetNetworkProfileId"},
FunctionInfo{10, nullptr, "SetRejectable"},
FunctionInfo{11, &IRequest::SetConnectionConfirmationOption, "SetConnectionConfirmationOption"},
FunctionInfo{12, nullptr, "SetPersistent"},
FunctionInfo{13, nullptr, "SetInstant"},
FunctionInfo{14, nullptr, "SetSustainable"},
FunctionInfo{15, nullptr, "SetRawPriority"},
FunctionInfo{16, nullptr, "SetGreedy"},
FunctionInfo{17, nullptr, "SetSharable"},
FunctionInfo{18, nullptr, "SetRequirementByRevision"},
FunctionInfo{19, nullptr, "GetRequirement"},
FunctionInfo{20, nullptr, "GetRevision"},
FunctionInfo{21, &IRequest::GetAppletInfo, "GetAppletInfo"},
FunctionInfo{22, nullptr, "GetAdditionalInfo"},
FunctionInfo{23, nullptr, "SetKeptInSleep"},
FunctionInfo{24, nullptr, "RegisterSocketDescriptor"},
FunctionInfo{25, nullptr, "UnregisterSocketDescriptor"},
FunctionInfo{26, nullptr, "GetNetworkAccessStatus"} //21.0.0+
);
KernelHelpers::ServiceContext service_context;
RequestState state;
@@ -508,14 +509,16 @@ private:
class INetworkProfile final : public ServiceFramework<INetworkProfile> {
public:
explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "Update"},
FunctionInfo{1, nullptr, "PersistOld"},
FunctionInfo{2, nullptr, "Persist"}
};
RegisterHandlers(functions);
explicit INetworkProfile(Core::System& system_) : ServiceFramework{system_, "INetworkProfile"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Update"},
FunctionInfo{1, nullptr, "PersistOld"},
FunctionInfo{2, nullptr, "Persist"}
);
};
void IGeneralService::GetClientId(HLERequestContext& ctx) {
@@ -1113,14 +1116,7 @@ IGeneralService::~IGeneralService() = default;
class NetworkInterface final : public ServiceFramework<NetworkInterface> {
public:
explicit NetworkInterface(const char* name, Core::System& system_)
: ServiceFramework{system_, name} {
static const FunctionInfo functions[] = {
FunctionInfo{4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
FunctionInfo{5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}
};
RegisterHandlers(functions);
}
explicit NetworkInterface(const char* name, Core::System& system_) : ServiceFramework{system_, name} {}
private:
void CreateGeneralServiceOld(HLERequestContext& ctx) {
@@ -1138,6 +1134,14 @@ private:
rb.Push(ResultSuccess);
rb.PushIpcInterface<IGeneralService>(ctx, system);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{4, &NetworkInterface::CreateGeneralServiceOld, "CreateGeneralServiceOld"},
FunctionInfo{5, &NetworkInterface::CreateGeneralService, "CreateGeneralService"}
);
};
void LoopProcess(Core::System& system) {
+12 -14
View File
@@ -506,19 +506,7 @@ public:
explicit IEnsureNetworkClockAvailabilityService(Core::System& system_)
: ServiceFramework{system_, "IEnsureNetworkClockAvailabilityService"},
service_context{system_, "IEnsureNetworkClockAvailabilityService"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"},
FunctionInfo{1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent,
"GetFinishNotificationEvent"},
FunctionInfo{2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"},
FunctionInfo{3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"},
FunctionInfo{4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"},
FunctionInfo{5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"}
};
RegisterHandlers(functions);
finished_event =
service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent");
finished_event = service_context.CreateEvent("IEnsureNetworkClockAvailabilityService:FinishEvent");
}
~IEnsureNetworkClockAvailabilityService() override {
@@ -575,8 +563,18 @@ private:
rb.PushRaw<s64>(server_time);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &IEnsureNetworkClockAvailabilityService::StartTask, "StartTask"},
FunctionInfo{1, &IEnsureNetworkClockAvailabilityService::GetFinishNotificationEvent, "GetFinishNotificationEvent"},
FunctionInfo{2, &IEnsureNetworkClockAvailabilityService::GetResult, "GetResult"},
FunctionInfo{3, &IEnsureNetworkClockAvailabilityService::Cancel, "Cancel"},
FunctionInfo{4, &IEnsureNetworkClockAvailabilityService::IsProcessing, "IsProcessing"},
FunctionInfo{5, &IEnsureNetworkClockAvailabilityService::GetServerTime, "GetServerTime"}
);
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* finished_event;
};
@@ -99,13 +99,6 @@ public:
, data_offset{offset}
, data_size{size}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, D<&IAsyncValue::GetSize>, "GetSize"},
FunctionInfo{1, D<&IAsyncValue::Get>, "Get"},
FunctionInfo{2, D<&IAsyncValue::Cancel>, "Cancel"},
FunctionInfo{3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"}
};
RegisterHandlers(functions);
completion_event = service_context.CreateEvent("IAsyncValue:Completion");
completion_event->GetReadableEvent().Signal(system.Kernel());
}
@@ -137,6 +130,16 @@ private:
LOG_DEBUG(Service_NS, "called");
R_SUCCEED();
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, D<&IAsyncValue::GetSize>, "GetSize"},
FunctionInfo{1, D<&IAsyncValue::Get>, "Get"},
FunctionInfo{2, D<&IAsyncValue::Cancel>, "Cancel"},
FunctionInfo{3, D<&IAsyncValue::GetErrorContext>, "GetErrorContext"}
);
KernelHelpers::ServiceContext service_context;
Kernel::KEvent* completion_event{};
s32 data_offset;
+40 -34
View File
@@ -50,55 +50,61 @@ class NVGEM_C final : public ServiceFramework<NVGEM_C> {
public:
explicit NVGEM_C(Core::System& system_)
: ServiceFramework{system_, "nvgem:c"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "GetEventHandle"},
FunctionInfo{2, nullptr, "ControlNotification"},
FunctionInfo{3, nullptr, "SetNotificationPerm"},
FunctionInfo{4, nullptr, "SetCoreDumpPerm"},
FunctionInfo{5, nullptr, "GetAruid"},
FunctionInfo{6, nullptr, "Reset"},
FunctionInfo{7, nullptr, "GetAruid2"}
};
RegisterHandlers(functions);
{}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "GetEventHandle"},
FunctionInfo{2, nullptr, "ControlNotification"},
FunctionInfo{3, nullptr, "SetNotificationPerm"},
FunctionInfo{4, nullptr, "SetCoreDumpPerm"},
FunctionInfo{5, nullptr, "GetAruid"},
FunctionInfo{6, nullptr, "Reset"},
FunctionInfo{7, nullptr, "GetAruid2"}
);
};
class NVGEM_CD final : public ServiceFramework<NVGEM_CD> {
public:
explicit NVGEM_CD(Core::System& system_)
: ServiceFramework{system_, "nvgem:cd"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "GetAruid"},
FunctionInfo{2, nullptr, "ReadNextBlock"},
FunctionInfo{3, nullptr, "GetNextBlockSize"},
FunctionInfo{4, nullptr, "ReadNextBlock2"}
};
RegisterHandlers(functions);
{}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Initialize"},
FunctionInfo{1, nullptr, "GetAruid"},
FunctionInfo{2, nullptr, "ReadNextBlock"},
FunctionInfo{3, nullptr, "GetNextBlockSize"},
FunctionInfo{4, nullptr, "ReadNextBlock2"}
);
};
class NVDBG_D final : public ServiceFramework<NVDBG_D> {
public:
explicit NVDBG_D(Core::System& system_)
: ServiceFramework{system_, "nvdbg:d"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "Open"},
FunctionInfo{1, nullptr, "Ioctl"},
FunctionInfo{2, nullptr, "Close"},
FunctionInfo{4, nullptr, "QueryEvent"},
FunctionInfo{9, nullptr, "DumpStatus"},
FunctionInfo{10, nullptr, "InitializeDevtools"},
FunctionInfo{11, nullptr, "Ioctl2"},
FunctionInfo{12, nullptr, "Ioctl3"},
FunctionInfo{13, nullptr, "SetConfiguration"}
};
RegisterHandlers(functions);
{}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "Open"},
FunctionInfo{1, nullptr, "Ioctl"},
FunctionInfo{2, nullptr, "Close"},
FunctionInfo{4, nullptr, "QueryEvent"},
FunctionInfo{9, nullptr, "DumpStatus"},
FunctionInfo{10, nullptr, "InitializeDevtools"},
FunctionInfo{11, nullptr, "Ioctl2"},
FunctionInfo{12, nullptr, "Ioctl3"},
FunctionInfo{13, nullptr, "SetConfiguration"}
);
};
void LoopProcess(Core::System& system) {
+22 -20
View File
@@ -47,13 +47,7 @@ void GetApplicationPidGeneric(Kernel::KernelCore& kernel, HLERequestContext& ctx
class BootMode final : public ServiceFramework<BootMode> {
public:
explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &BootMode::GetBootMode, "GetBootMode"},
FunctionInfo{1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}
};
RegisterHandlers(functions);
}
explicit BootMode(Core::System& system_) : ServiceFramework{system_, "pm:bm"} {}
private:
void GetBootMode(HLERequestContext& ctx) {
@@ -73,6 +67,13 @@ private:
rb.Push(ResultSuccess);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &BootMode::GetBootMode, "GetBootMode"},
FunctionInfo{1, &BootMode::SetMaintenanceBoot, "SetMaintenanceBoot"}
);
SystemBootMode boot_mode = SystemBootMode::Normal;
};
@@ -80,10 +81,6 @@ class DebugMonitor final : public ServiceFramework<DebugMonitor> {
public:
explicit DebugMonitor(Core::System& system_) : ServiceFramework{system_, "pm:dmnt"} {}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
private:
void GetProcessId(HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
@@ -153,6 +150,9 @@ private:
rb.PushRaw(override_status);
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "GetJitDebugProcessIdList"},
FunctionInfo{1, nullptr, "StartProcess"},
@@ -168,15 +168,7 @@ private:
class Info final : public ServiceFramework<Info> {
public:
explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &Info::GetProgramId, "GetProgramId"},
FunctionInfo{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"},
FunctionInfo{65001, nullptr, "AtmosphereHasLaunchedProgram"},
FunctionInfo{65002, nullptr, "AtmosphereGetProcessInfo"}
};
RegisterHandlers(functions);
}
explicit Info(Core::System& system_) : ServiceFramework{system_, "pm:info"} {}
private:
void GetProgramId(HLERequestContext& ctx) {
@@ -218,6 +210,16 @@ private:
rb.Push(ResultSuccess);
rb.Push(process->GetProcessId());
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &Info::GetProgramId, "GetProgramId"},
FunctionInfo{65000, &Info::AtmosphereGetProcessId, "AtmosphereGetProcessId"},
FunctionInfo{65001, nullptr, "AtmosphereHasLaunchedProgram"},
FunctionInfo{65002, nullptr, "AtmosphereGetProcessInfo"}
);
};
class Shell final : public ServiceFramework<Shell> {
+13 -42
View File
@@ -109,7 +109,6 @@ private:
virtual FunctionInfoBase const* FindRequestTipc(u32 key) = 0;
void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n);
void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n);
void ReportUnimplementedFunction(HLERequestContext& ctx, const FunctionInfoBase* info);
protected:
@@ -172,6 +171,15 @@ protected:
};
}
// Used exclusively by NFC
template<typename T, typename ...Ts>
requires (std::same_as<Ts, FunctionInfoTyped<T>> && ...)
static constexpr frozen::map<u32, FunctionInfoTyped<T>, sizeof...(Ts)> CreateStaticMapWithClass(Ts... args) {
return frozen::map<u32, FunctionInfoTyped<T>, sizeof...(args)>{
{args.expected_header, FunctionInfoTyped<T>(args)}...
};
}
template<typename T>
static FunctionInfoBase const* HandlerTableGenerateWithFind(u32 key, T const& map) {
auto const it = map.find(key);
@@ -192,49 +200,13 @@ protected:
return it != handlers.end() ? std::addressof(it->second) : nullptr;
}
FunctionInfoBase const* FindRequestTipc(u32 key) override {
auto it = handlers_tipc.find(key);
return it != handlers_tipc.end() ? std::addressof(it->second) : nullptr;
}
constexpr void RegisterHandlersBase(const FunctionInfoBase* functions, std::size_t n) {
// Usually this array is sorted by id already, so hint to insert at the end
handlers.reserve(handlers.size() + n);
for (std::size_t i = 0; i < n; ++i)
handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]);
}
constexpr void RegisterHandlersBaseTipc(const FunctionInfoBase* functions, std::size_t n) {
// Usually this array is sorted by id already, so hint to insert at the end
handlers_tipc.reserve(handlers_tipc.size() + n);
for (std::size_t i = 0; i < n; ++i)
handlers_tipc.emplace_hint(handlers_tipc.cend(), functions[i].expected_header, functions[i]);
}
/// Registers handlers in the service.
template <typename T = Self, std::size_t N>
constexpr void RegisterHandlers(const FunctionInfoTyped<T> (&functions)[N]) {
RegisterHandlers(functions, N);
}
/// @brief Registers handlers in the service. Usually prefer using the other RegisterHandlers
/// overload in order to avoid needing to specify the array size.
template <typename T = Self>
constexpr void RegisterHandlers(const FunctionInfoTyped<T>* functions, std::size_t n) {
RegisterHandlersBase(functions, n);
}
/// @brief Registers handlers in the service.
template <typename T = Self, std::size_t N>
constexpr void RegisterHandlersTipc(const FunctionInfoTyped<T> (&functions)[N]) {
RegisterHandlersTipc(functions, N);
}
/// @brief Registers handlers in the service. Usually prefer using the other RegisterHandlers
/// overload in order to avoid needing to specify the array size.
template <typename T = Self>
constexpr void RegisterHandlersTipc(const FunctionInfoTyped<T>* functions, std::size_t n) {
RegisterHandlersBaseTipc(functions, n);
// Usually this array is sorted by id already, so hint to insert at the end
handlers.reserve(handlers.size() + N);
for (std::size_t i = 0; i < N; ++i)
handlers.emplace_hint(handlers.cend(), functions[i].expected_header, functions[i]);
}
protected:
@@ -267,7 +239,6 @@ private:
}
::Common::unordered_map<u32, FunctionInfoBase> handlers;
::Common::unordered_map<u32, FunctionInfoBase> handlers_tipc;
};
} // namespace Service
+47 -37
View File
@@ -112,6 +112,51 @@ Result ServiceManager::GetServicePort(Kernel::KClientPort** out_client_port,
return ResultSuccess;
}
/// Interface to "sm:" service
class SM final : public ServiceFramework<SM> {
public:
explicit SM(ServiceManager& service_manager_, Core::System& system_);
~SM() override;
private:
void Initialize(HLERequestContext& ctx);
void GetServiceCmif(HLERequestContext& ctx);
void GetServiceTipc(HLERequestContext& ctx);
void RegisterServiceCmif(HLERequestContext& ctx);
void RegisterServiceTipc(HLERequestContext& ctx);
void UnregisterService(HLERequestContext& ctx);
void AtmosphereHasService(HLERequestContext& ctx);
Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx);
void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count, bool is_light);
// TODO: We reuse function list for both TIPC and non-TIPC
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
FunctionInfoBase const* FindRequestTipc(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &SM::Initialize, "Initialize"},
FunctionInfo{1, &SM::GetServiceTipc, "GetService"},
FunctionInfo{2, &SM::RegisterServiceTipc, "RegisterService"},
FunctionInfo{3, &SM::UnregisterService, "UnregisterService"},
FunctionInfo{4, nullptr, "DetachClient"},
FunctionInfo{65000, nullptr, "AtmosphereInstallMitm"},
FunctionInfo{65001, nullptr, "AtmosphereUninstallMitm"},
FunctionInfo{65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"},
FunctionInfo{65003, nullptr, "AtmosphereAcknowledgeMitmSession"},
FunctionInfo{65004, nullptr, "AtmosphereHasMitm"},
FunctionInfo{65005, nullptr, "AtmosphereWaitMitm"},
FunctionInfo{65006, nullptr, "AtmosphereDeclareFutureMitm"},
FunctionInfo{65100, &SM::AtmosphereHasService, "AtmosphereHasService"},
FunctionInfo{65101, nullptr, "AtmosphereWaitService"}
);
ServiceManager& service_manager;
};
/**
* SM::Initialize service function
* Inputs:
@@ -194,7 +239,7 @@ Result SM::GetServiceImpl(Kernel::KClientSession** out_client_session, HLEReques
// Create a new session.
Kernel::KClientSession* session{};
if (const auto result = client_port->CreateSession(kernel, &session); result.IsError()) {
if (const auto result = client_port->CreateSession(system.Kernel(), &session); result.IsError()) {
LOG_ERROR(Service_SM, "called service={} -> error {:#08x}", name, result.raw);
return result;
}
@@ -265,42 +310,7 @@ void SM::AtmosphereHasService(HLERequestContext& ctx) {
SM::SM(ServiceManager& service_manager_, Core::System& system_)
: ServiceFramework{system_, "sm:", 64}
, service_manager{service_manager_}
, kernel{system_.Kernel()}
{
RegisterHandlers({
FunctionInfo{0, &SM::Initialize, "Initialize"},
FunctionInfo{1, &SM::GetServiceCmif, "GetService"},
FunctionInfo{2, &SM::RegisterServiceCmif, "RegisterService"},
FunctionInfo{3, &SM::UnregisterService, "UnregisterService"},
FunctionInfo{4, nullptr, "DetachClient"},
// TODO: are these non-TIPC as well?
FunctionInfo{65000, nullptr, "AtmosphereInstallMitm"},
FunctionInfo{65001, nullptr, "AtmosphereUninstallMitm"},
FunctionInfo{65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"},
FunctionInfo{65003, nullptr, "AtmosphereAcknowledgeMitmSession"},
FunctionInfo{65004, nullptr, "AtmosphereHasMitm"},
FunctionInfo{65005, nullptr, "AtmosphereWaitMitm"},
FunctionInfo{65006, nullptr, "AtmosphereDeclareFutureMitm"},
FunctionInfo{65100, &SM::AtmosphereHasService, "AtmosphereHasService"},
FunctionInfo{65101, nullptr, "AtmosphereWaitService"},
});
RegisterHandlersTipc({
FunctionInfo{0, &SM::Initialize, "Initialize"},
FunctionInfo{1, &SM::GetServiceTipc, "GetService"},
FunctionInfo{2, &SM::RegisterServiceTipc, "RegisterService"},
FunctionInfo{3, &SM::UnregisterService, "UnregisterService"},
FunctionInfo{4, nullptr, "DetachClient"},
FunctionInfo{65000, nullptr, "AtmosphereInstallMitm"},
FunctionInfo{65001, nullptr, "AtmosphereUninstallMitm"},
FunctionInfo{65002, nullptr, "Deprecated_AtmosphereAssociatePidTidForMitm"},
FunctionInfo{65003, nullptr, "AtmosphereAcknowledgeMitmSession"},
FunctionInfo{65004, nullptr, "AtmosphereHasMitm"},
FunctionInfo{65005, nullptr, "AtmosphereWaitMitm"},
FunctionInfo{65006, nullptr, "AtmosphereDeclareFutureMitm"},
FunctionInfo{65100, &SM::AtmosphereHasService, "AtmosphereHasService"},
FunctionInfo{65101, nullptr, "AtmosphereWaitService"},
});
}
{}
SM::~SM() = default;
+1 -23
View File
@@ -33,29 +33,7 @@ class SessionRequestHandler;
namespace Service::SM {
class Controller;
/// Interface to "sm:" service
class SM final : public ServiceFramework<SM> {
public:
explicit SM(ServiceManager& service_manager_, Core::System& system_);
~SM() override;
private:
void Initialize(HLERequestContext& ctx);
void GetServiceCmif(HLERequestContext& ctx);
void GetServiceTipc(HLERequestContext& ctx);
void RegisterServiceCmif(HLERequestContext& ctx);
void RegisterServiceTipc(HLERequestContext& ctx);
void UnregisterService(HLERequestContext& ctx);
void AtmosphereHasService(HLERequestContext& ctx);
Result GetServiceImpl(Kernel::KClientSession** out_client_session, HLERequestContext& ctx);
void RegisterServiceImpl(HLERequestContext& ctx, std::string name, u32 max_session_count,
bool is_light);
ServiceManager& service_manager;
Kernel::KernelCore& kernel;
};
class SM;
class ServiceManager {
public:
+8 -7
View File
@@ -204,14 +204,15 @@ Result Module::Interface::GetConfigImpl(u64* out_config, ConfigItem config_item)
class CSRNG final : public Module::Interface {
public:
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_)
: Interface(system_, std::move(module_), "csrng") {
static const FunctionInfo functions[] = {
FunctionInfo{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"}
};
RegisterHandlers(functions);
}
explicit CSRNG(Core::System& system_, std::shared_ptr<Module> module_) : Interface(system_, std::move(module_), "csrng") {}
~CSRNG() override = default;
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &CSRNG::GenerateRandomBytes, "GenerateRandomBytes"}
);
};
void LoopProcess(Core::System& system) {
+22 -20
View File
@@ -450,29 +450,9 @@ public:
explicit ISslContext(Core::System& system_, SslVersion version)
: ServiceFramework{system_, "ISslContext"}, ssl_version{version},
shared_data{std::make_shared<SslContextSharedData>()} {
static const FunctionInfo functions[] = {
FunctionInfo{0, &ISslContext::SetOption, "SetOption"},
FunctionInfo{1, &ISslContext::GetOption, "GetOption"},
FunctionInfo{2, &ISslContext::CreateConnection, "CreateConnection"},
FunctionInfo{3, &ISslContext::GetConnectionCount, "GetConnectionCount"},
FunctionInfo{4, &ISslContext::ImportServerPki, "ImportServerPki"},
FunctionInfo{5, &ISslContext::ImportClientPki, "ImportClientPki"},
FunctionInfo{6, nullptr, "RemoveServerPki"},
FunctionInfo{7, nullptr, "RemoveClientPki"},
FunctionInfo{8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"},
FunctionInfo{9, nullptr, "AddPolicyOid"},
FunctionInfo{10, nullptr, "ImportCrl"},
FunctionInfo{11, nullptr, "RemoveCrl"},
FunctionInfo{12, nullptr, "ImportClientCertKeyPki"},
FunctionInfo{13, nullptr, "GeneratePrivateKeyAndCert"}
};
RegisterHandlers(functions);
}
private:
SslVersion ssl_version;
std::shared_ptr<SslContextSharedData> shared_data;
void SetOption(HLERequestContext& ctx) {
struct Parameters {
ContextOption option;
@@ -559,6 +539,28 @@ private:
LOG_WARNING(Service_SSL, "(STUBBED) called");
R_SUCCEED();
}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, &ISslContext::SetOption, "SetOption"},
FunctionInfo{1, &ISslContext::GetOption, "GetOption"},
FunctionInfo{2, &ISslContext::CreateConnection, "CreateConnection"},
FunctionInfo{3, &ISslContext::GetConnectionCount, "GetConnectionCount"},
FunctionInfo{4, &ISslContext::ImportServerPki, "ImportServerPki"},
FunctionInfo{5, &ISslContext::ImportClientPki, "ImportClientPki"},
FunctionInfo{6, nullptr, "RemoveServerPki"},
FunctionInfo{7, nullptr, "RemoveClientPki"},
FunctionInfo{8, D<&ISslContext::RegisterInternalPki>, "RegisterInternalPki"},
FunctionInfo{9, nullptr, "AddPolicyOid"},
FunctionInfo{10, nullptr, "ImportCrl"},
FunctionInfo{11, nullptr, "RemoveCrl"},
FunctionInfo{12, nullptr, "ImportClientCertKeyPki"},
FunctionInfo{13, nullptr, "GeneratePrivateKeyAndCert"}
);
SslVersion ssl_version;
std::shared_ptr<SslContextSharedData> shared_data;
};
class ISslService final : public ServiceFramework<ISslService> {
+7 -5
View File
@@ -19,12 +19,14 @@ class HTC_TENV final : public ServiceFramework<HTC_TENV> {
public:
explicit HTC_TENV(Core::System& system_)
: ServiceFramework{system_, "htc:tenv"}
{
static const FunctionInfo functions[] = {
FunctionInfo{0, nullptr, "GetServiceInterface"}
};
RegisterHandlers(functions);
{}
FunctionInfoBase const* FindRequest(u32 key) override {
return HandlerTableGenerateWithFind(key, functions);
}
static constexpr auto functions = CreateStaticMap(
FunctionInfo{0, nullptr, "GetServiceInterface"}
);
};
void LoopProcess(Core::System& system) {