diff options
| author | PavelBARABANOV <pavelbarabanov94@gmail.com> | 2026-10-15 08:45:15 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-10-15 08:45:15 +0200 |
| commit | e255c20db4111485d228c10478bda63aabcfdde5 (patch) | |
| tree | 1f8c88981b60e9a4db4ed306742196b1c4b68116 /src/core/hle/service/nfp/nfp.cpp | |
| parent | 14da4482a4668928bad43bb67ef12f96b9c9d972 (diff) | |
Revert "[hle] constexpr handler dispatch maps, introduce version gating (#4480)" (#4532)
This reverts commit 218c6705d950635bc18f8458d738a1996fb592b6.
- [x] I have read and followed the [Contribution Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/CONTRIBUTING.md#code-contributions).
- [x] I have read and followed the [AI Policy](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/AI.md).
- [x] I have read and followed the [Coding Guidelines](https://git.eden-emu.dev/eden-emu/eden/src/branch/master/docs/policies/Coding.md) to the best of my ability.
-------------------
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4532
Reviewed-by: lizzie <lizzie@eden-emu.dev>
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Reviewed-by: Maufeat <sahyno1996@gmail.com>
Diffstat (limited to 'src/core/hle/service/nfp/nfp.cpp')
| -rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 276 |
1 files changed, 140 insertions, 136 deletions
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index bfeb7d5553..e0c24679ab 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp @@ -14,134 +14,145 @@ namespace Service::NFP { class IUser final : public Interface { public: - explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") {} - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IUser(Core::System& system_) : Interface(system_, "NFP:IUser") { + // clang-format off + static const FunctionInfoTyped<IUser> functions[] = { + {0, &IUser::Initialize, "Initialize"}, + {1, &IUser::Finalize, "Finalize"}, + {2, &IUser::ListDevices, "ListDevices"}, + {3, &IUser::StartDetection, "StartDetection"}, + {4, &IUser::StopDetection, "StopDetection"}, + {5, &IUser::Mount, "Mount"}, + {6, &IUser::Unmount, "Unmount"}, + {7, &IUser::OpenApplicationArea, "OpenApplicationArea"}, + {8, &IUser::GetApplicationArea, "GetApplicationArea"}, + {9, &IUser::SetApplicationArea, "SetApplicationArea"}, + {10, &IUser::Flush, "Flush"}, + {11, &IUser::Restore, "Restore"}, + {12, &IUser::CreateApplicationArea, "CreateApplicationArea"}, + {13, &IUser::GetTagInfo, "GetTagInfo"}, + {14, &IUser::GetRegisterInfo, "GetRegisterInfo"}, + {15, &IUser::GetCommonInfo, "GetCommonInfo"}, + {16, &IUser::GetModelInfo, "GetModelInfo"}, + {17, &IUser::AttachActivateEvent, "AttachActivateEvent"}, + {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &IUser::GetState, "GetState"}, + {20, &IUser::GetDeviceState, "GetDeviceState"}, + {21, &IUser::GetNpadId, "GetNpadId"}, + {22, &IUser::GetApplicationAreaSize, "GetApplicationAreaSize"}, + {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {24, &IUser::RecreateApplicationArea, "RecreateApplicationArea"}, + {25, &IUser::StartDetection, "StartDetectionWithFilter"}, + }; + // clang-format on + + RegisterHandlers(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") {} - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit ISystem(Core::System& system_) : Interface(system_, "NFP:ISystem") { + // clang-format off + static const FunctionInfoTyped<ISystem> functions[] = { + {0, &ISystem::InitializeSystem, "InitializeSystem"}, + {1, &ISystem::FinalizeSystem, "FinalizeSystem"}, + {2, &ISystem::ListDevices, "ListDevices"}, + {3, &ISystem::StartDetection, "StartDetection"}, + {4, &ISystem::StopDetection, "StopDetection"}, + {5, &ISystem::Mount, "Mount"}, + {6, &ISystem::Unmount, "Unmount"}, + {10, &ISystem::Flush, "Flush"}, + {11, &ISystem::Restore, "Restore"}, + {12, &ISystem::CreateApplicationArea, "CreateApplicationArea"}, + {13, &ISystem::GetTagInfo, "GetTagInfo"}, + {14, &ISystem::GetRegisterInfo, "GetRegisterInfo"}, + {15, &ISystem::GetCommonInfo, "GetCommonInfo"}, + {16, &ISystem::GetModelInfo, "GetModelInfo"}, + {17, &ISystem::AttachActivateEvent, "AttachActivateEvent"}, + {18, &ISystem::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &ISystem::GetState, "GetState"}, + {20, &ISystem::GetDeviceState, "GetDeviceState"}, + {21, &ISystem::GetNpadId, "GetNpadId"}, + {23, &ISystem::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {25, &ISystem::StartDetection, "StartDetectionWithFilter"}, + {100, &ISystem::Format, "Format"}, + {101, &ISystem::GetAdminInfo, "GetAdminInfo"}, + {102, &ISystem::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + {103, &ISystem::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + {104, &ISystem::DeleteRegisterInfo, "DeleteRegisterInfo"}, + {105, &ISystem::DeleteApplicationArea, "DeleteApplicationArea"}, + {106, &ISystem::ExistsApplicationArea, "ExistsApplicationArea"}, + }; + // clang-format on + + RegisterHandlers(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") {} - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IDebug(Core::System& system_) : Interface(system_, "NFP:IDebug") { + // clang-format off + static const FunctionInfoTyped<IDebug> functions[] = { + {0, &IDebug::InitializeDebug, "InitializeDebug"}, + {1, &IDebug::FinalizeDebug, "FinalizeDebug"}, + {2, &IDebug::ListDevices, "ListDevices"}, + {3, &IDebug::StartDetection, "StartDetection"}, + {4, &IDebug::StopDetection, "StopDetection"}, + {5, &IDebug::Mount, "Mount"}, + {6, &IDebug::Unmount, "Unmount"}, + {7, &IDebug::OpenApplicationArea, "OpenApplicationArea"}, + {8, &IDebug::GetApplicationArea, "GetApplicationArea"}, + {9, &IDebug::SetApplicationArea, "SetApplicationArea"}, + {10, &IDebug::Flush, "Flush"}, + {11, &IDebug::Restore, "Restore"}, + {12, &IDebug::CreateApplicationArea, "CreateApplicationArea"}, + {13, &IDebug::GetTagInfo, "GetTagInfo"}, + {14, &IDebug::GetRegisterInfo, "GetRegisterInfo"}, + {15, &IDebug::GetCommonInfo, "GetCommonInfo"}, + {16, &IDebug::GetModelInfo, "GetModelInfo"}, + {17, &IDebug::AttachActivateEvent, "AttachActivateEvent"}, + {18, &IDebug::AttachDeactivateEvent, "AttachDeactivateEvent"}, + {19, &IDebug::GetState, "GetState"}, + {20, &IDebug::GetDeviceState, "GetDeviceState"}, + {21, &IDebug::GetNpadId, "GetNpadId"}, + {22, &IDebug::GetApplicationAreaSize, "GetApplicationAreaSize"}, + {23, &IDebug::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"}, + {24, &IDebug::RecreateApplicationArea, "RecreateApplicationArea"}, + {25, &IDebug::StartDetection, "StartDetectionWithFilter"}, + {100, &IDebug::Format, "Format"}, + {101, &IDebug::GetAdminInfo, "GetAdminInfo"}, + {102, &IDebug::GetRegisterInfoPrivate, "GetRegisterInfoPrivate"}, + {103, &IDebug::SetRegisterInfoPrivate, "SetRegisterInfoPrivate"}, + {104, &IDebug::DeleteRegisterInfo, "DeleteRegisterInfo"}, + {105, &IDebug::DeleteApplicationArea, "DeleteApplicationArea"}, + {106, &IDebug::ExistsApplicationArea, "ExistsApplicationArea"}, + {200, &IDebug::GetAll, "GetAll"}, + {201, &IDebug::SetAll, "SetAll"}, + {202, &IDebug::FlushDebug, "FlushDebug"}, + {203, &IDebug::BreakTag, "BreakTag"}, + {204, &IDebug::ReadBackupData, "ReadBackupData"}, + {205, &IDebug::WriteBackupData, "WriteBackupData"}, + {206, &IDebug::WriteNtf, "WriteNtf"}, + }; + // clang-format on + + RegisterHandlers(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"} {} + explicit IUserManager(Core::System& system_) : ServiceFramework{system_, "nfp:user"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IUserManager::CreateUserInterface, "CreateUserInterface"}, + }; + // clang-format on + + RegisterHandlers(functions); + } private: void CreateUserInterface(HLERequestContext& ctx) { @@ -151,21 +162,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface<IUser>(ctx, system); } - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); - } - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IUserManager::CreateUserInterface, "CreateUserInterface"} - ); }; class ISystemManager final : public ServiceFramework<ISystemManager> { public: - explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} {} - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit ISystemManager(Core::System& system_) : ServiceFramework{system_, "nfp:sys"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"}, + }; + // clang-format on + + RegisterHandlers(functions); } private: @@ -176,18 +184,18 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface<ISystem>(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &ISystemManager::CreateSystemInterface, "CreateSystemInterface"} - ); }; class IDebugManager final : public ServiceFramework<IDebugManager> { public: - explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} {} - - std::optional<FunctionInfoBase> FindRequest(u32 key) override { - return HandlerTableGenerateWithFind(key, functions); + explicit IDebugManager(Core::System& system_) : ServiceFramework{system_, "nfp:dbg"} { + // clang-format off + static const FunctionInfo functions[] = { + {0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"}, + }; + // clang-format on + + RegisterHandlers(functions); } private: @@ -198,10 +206,6 @@ private: rb.Push(ResultSuccess); rb.PushIpcInterface<IDebug>(ctx, system); } - - static constexpr auto functions = CreateStaticMap( - FunctionInfo{0, &IDebugManager::CreateDebugInterface, "CreateDebugInterface"} - ); }; void LoopProcess(Core::System& system) { |
