diff options
| author | 2019-09-21 19:03:20 +1000 | |
|---|---|---|
| committer | 2019-09-22 16:30:32 +1000 | |
| commit | 8df2a98f755aa76cf0133d5a6f986183aa23c0cf (patch) | |
| tree | f30a78f1b3d024c3e6ca75209d708326c2bbb729 /src | |
| parent | Deglobalize System: LDR (diff) | |
| download | yuzu-8df2a98f755aa76cf0133d5a6f986183aa23c0cf.tar.gz yuzu-8df2a98f755aa76cf0133d5a6f986183aa23c0cf.tar.xz yuzu-8df2a98f755aa76cf0133d5a6f986183aa23c0cf.zip | |
Deglobalize System: NFP
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 19 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp_user.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp_user.h | 2 |
4 files changed, 16 insertions, 14 deletions
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index a5cb06f8a..a42c22d44 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp | |||
| @@ -23,9 +23,9 @@ constexpr ResultCode ERR_TAG_FAILED(ErrorModule::NFP, | |||
| 23 | constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152); | 23 | constexpr ResultCode ERR_NO_APPLICATION_AREA(ErrorModule::NFP, 152); |
| 24 | } // namespace ErrCodes | 24 | } // namespace ErrCodes |
| 25 | 25 | ||
| 26 | Module::Interface::Interface(std::shared_ptr<Module> module, const char* name) | 26 | Module::Interface::Interface(std::shared_ptr<Module> module, Core::System& system, const char* name) |
| 27 | : ServiceFramework(name), module(std::move(module)) { | 27 | : ServiceFramework(name), module(std::move(module)), system(system) { |
| 28 | auto& kernel = Core::System::GetInstance().Kernel(); | 28 | auto& kernel = system.Kernel(); |
| 29 | nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, | 29 | nfc_tag_load = Kernel::WritableEvent::CreateEventPair(kernel, Kernel::ResetType::Automatic, |
| 30 | "IUser:NFCTagDetected"); | 30 | "IUser:NFCTagDetected"); |
| 31 | } | 31 | } |
| @@ -34,8 +34,8 @@ Module::Interface::~Interface() = default; | |||
| 34 | 34 | ||
| 35 | class IUser final : public ServiceFramework<IUser> { | 35 | class IUser final : public ServiceFramework<IUser> { |
| 36 | public: | 36 | public: |
| 37 | IUser(Module::Interface& nfp_interface) | 37 | IUser(Module::Interface& nfp_interface, Core::System& system) |
| 38 | : ServiceFramework("NFP::IUser"), nfp_interface(nfp_interface) { | 38 | : ServiceFramework("NFP::IUser"), nfp_interface(nfp_interface), system(system) { |
| 39 | static const FunctionInfo functions[] = { | 39 | static const FunctionInfo functions[] = { |
| 40 | {0, &IUser::Initialize, "Initialize"}, | 40 | {0, &IUser::Initialize, "Initialize"}, |
| 41 | {1, &IUser::Finalize, "Finalize"}, | 41 | {1, &IUser::Finalize, "Finalize"}, |
| @@ -65,7 +65,7 @@ public: | |||
| 65 | }; | 65 | }; |
| 66 | RegisterHandlers(functions); | 66 | RegisterHandlers(functions); |
| 67 | 67 | ||
| 68 | auto& kernel = Core::System::GetInstance().Kernel(); | 68 | auto& kernel = system.Kernel(); |
| 69 | deactivate_event = Kernel::WritableEvent::CreateEventPair( | 69 | deactivate_event = Kernel::WritableEvent::CreateEventPair( |
| 70 | kernel, Kernel::ResetType::Automatic, "IUser:DeactivateEvent"); | 70 | kernel, Kernel::ResetType::Automatic, "IUser:DeactivateEvent"); |
| 71 | availability_change_event = Kernel::WritableEvent::CreateEventPair( | 71 | availability_change_event = Kernel::WritableEvent::CreateEventPair( |
| @@ -324,6 +324,7 @@ private: | |||
| 324 | Kernel::EventPair deactivate_event; | 324 | Kernel::EventPair deactivate_event; |
| 325 | Kernel::EventPair availability_change_event; | 325 | Kernel::EventPair availability_change_event; |
| 326 | const Module::Interface& nfp_interface; | 326 | const Module::Interface& nfp_interface; |
| 327 | Core::System& system; | ||
| 327 | }; | 328 | }; |
| 328 | 329 | ||
| 329 | void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { | 330 | void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { |
| @@ -331,7 +332,7 @@ void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { | |||
| 331 | 332 | ||
| 332 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | 333 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; |
| 333 | rb.Push(RESULT_SUCCESS); | 334 | rb.Push(RESULT_SUCCESS); |
| 334 | rb.PushIpcInterface<IUser>(*this); | 335 | rb.PushIpcInterface<IUser>(*this, system); |
| 335 | } | 336 | } |
| 336 | 337 | ||
| 337 | bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) { | 338 | bool Module::Interface::LoadAmiibo(const std::vector<u8>& buffer) { |
| @@ -353,9 +354,9 @@ const Module::Interface::AmiiboFile& Module::Interface::GetAmiiboBuffer() const | |||
| 353 | return amiibo; | 354 | return amiibo; |
| 354 | } | 355 | } |
| 355 | 356 | ||
| 356 | void InstallInterfaces(SM::ServiceManager& service_manager) { | 357 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { |
| 357 | auto module = std::make_shared<Module>(); | 358 | auto module = std::make_shared<Module>(); |
| 358 | std::make_shared<NFP_User>(module)->InstallAsService(service_manager); | 359 | std::make_shared<NFP_User>(module, system)->InstallAsService(service_manager); |
| 359 | } | 360 | } |
| 360 | 361 | ||
| 361 | } // namespace Service::NFP | 362 | } // namespace Service::NFP |
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index a1817e991..9718ef745 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h | |||
| @@ -16,7 +16,7 @@ class Module final { | |||
| 16 | public: | 16 | public: |
| 17 | class Interface : public ServiceFramework<Interface> { | 17 | class Interface : public ServiceFramework<Interface> { |
| 18 | public: | 18 | public: |
| 19 | explicit Interface(std::shared_ptr<Module> module, const char* name); | 19 | explicit Interface(std::shared_ptr<Module> module, Core::System& system, const char* name); |
| 20 | ~Interface() override; | 20 | ~Interface() override; |
| 21 | 21 | ||
| 22 | struct ModelInfo { | 22 | struct ModelInfo { |
| @@ -43,9 +43,10 @@ public: | |||
| 43 | 43 | ||
| 44 | protected: | 44 | protected: |
| 45 | std::shared_ptr<Module> module; | 45 | std::shared_ptr<Module> module; |
| 46 | Core::System& system; | ||
| 46 | }; | 47 | }; |
| 47 | }; | 48 | }; |
| 48 | 49 | ||
| 49 | void InstallInterfaces(SM::ServiceManager& service_manager); | 50 | void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system); |
| 50 | 51 | ||
| 51 | } // namespace Service::NFP | 52 | } // namespace Service::NFP |
diff --git a/src/core/hle/service/nfp/nfp_user.cpp b/src/core/hle/service/nfp/nfp_user.cpp index 784a87c1b..298184f17 100644 --- a/src/core/hle/service/nfp/nfp_user.cpp +++ b/src/core/hle/service/nfp/nfp_user.cpp | |||
| @@ -6,8 +6,8 @@ | |||
| 6 | 6 | ||
| 7 | namespace Service::NFP { | 7 | namespace Service::NFP { |
| 8 | 8 | ||
| 9 | NFP_User::NFP_User(std::shared_ptr<Module> module) | 9 | NFP_User::NFP_User(std::shared_ptr<Module> module, Core::System& system) |
| 10 | : Module::Interface(std::move(module), "nfp:user") { | 10 | : Module::Interface(std::move(module), system, "nfp:user") { |
| 11 | static const FunctionInfo functions[] = { | 11 | static const FunctionInfo functions[] = { |
| 12 | {0, &NFP_User::CreateUserInterface, "CreateUserInterface"}, | 12 | {0, &NFP_User::CreateUserInterface, "CreateUserInterface"}, |
| 13 | }; | 13 | }; |
diff --git a/src/core/hle/service/nfp/nfp_user.h b/src/core/hle/service/nfp/nfp_user.h index 65d9aaf48..1686ebf20 100644 --- a/src/core/hle/service/nfp/nfp_user.h +++ b/src/core/hle/service/nfp/nfp_user.h | |||
| @@ -10,7 +10,7 @@ namespace Service::NFP { | |||
| 10 | 10 | ||
| 11 | class NFP_User final : public Module::Interface { | 11 | class NFP_User final : public Module::Interface { |
| 12 | public: | 12 | public: |
| 13 | explicit NFP_User(std::shared_ptr<Module> module); | 13 | explicit NFP_User(std::shared_ptr<Module> module, Core::System& system); |
| 14 | ~NFP_User() override; | 14 | ~NFP_User() override; |
| 15 | }; | 15 | }; |
| 16 | 16 | ||