summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar mailwl2018-06-04 12:27:32 +0300
committerGravatar mailwl2018-06-04 12:39:43 +0300
commit019778707dad948eafa62f8d8e01c06970470420 (patch)
tree8114f4162808bd91650a82fd4eed9ec8db9d34b1 /src
parentMerge pull request #499 from bunnei/am-stuff (diff)
downloadyuzu-019778707dad948eafa62f8d8e01c06970470420.tar.gz
yuzu-019778707dad948eafa62f8d8e01c06970470420.tar.xz
yuzu-019778707dad948eafa62f8d8e01c06970470420.zip
Service/nfp:user : stub some functions.
Used by Zelda: BoTW
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/nfp/nfp.cpp76
1 files changed, 70 insertions, 6 deletions
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp
index 2af4465de..ebb98144f 100644
--- a/src/core/hle/service/nfp/nfp.cpp
+++ b/src/core/hle/service/nfp/nfp.cpp
@@ -4,6 +4,7 @@
4 4
5#include "common/logging/log.h" 5#include "common/logging/log.h"
6#include "core/hle/ipc_helpers.h" 6#include "core/hle/ipc_helpers.h"
7#include "core/hle/kernel/event.h"
7#include "core/hle/service/nfp/nfp.h" 8#include "core/hle/service/nfp/nfp.h"
8#include "core/hle/service/nfp/nfp_user.h" 9#include "core/hle/service/nfp/nfp_user.h"
9 10
@@ -18,7 +19,7 @@ public:
18 static const FunctionInfo functions[] = { 19 static const FunctionInfo functions[] = {
19 {0, &IUser::Initialize, "Initialize"}, 20 {0, &IUser::Initialize, "Initialize"},
20 {1, nullptr, "Finalize"}, 21 {1, nullptr, "Finalize"},
21 {2, nullptr, "ListDevices"}, 22 {2, &IUser::ListDevices, "ListDevices"},
22 {3, nullptr, "StartDetection"}, 23 {3, nullptr, "StartDetection"},
23 {4, nullptr, "StopDetection"}, 24 {4, nullptr, "StopDetection"},
24 {5, nullptr, "Mount"}, 25 {5, nullptr, "Mount"},
@@ -33,24 +34,87 @@ public:
33 {14, nullptr, "GetRegisterInfo"}, 34 {14, nullptr, "GetRegisterInfo"},
34 {15, nullptr, "GetCommonInfo"}, 35 {15, nullptr, "GetCommonInfo"},
35 {16, nullptr, "GetModelInfo"}, 36 {16, nullptr, "GetModelInfo"},
36 {17, nullptr, "AttachActivateEvent"}, 37 {17, &IUser::AttachActivateEvent, "AttachActivateEvent"},
37 {18, nullptr, "AttachDeactivateEvent"}, 38 {18, &IUser::AttachDeactivateEvent, "AttachDeactivateEvent"},
38 {19, nullptr, "GetState"}, 39 {19, &IUser::GetState, "GetState"},
39 {20, nullptr, "GetDeviceState"}, 40 {20, &IUser::GetDeviceState, "GetDeviceState"},
40 {21, nullptr, "GetNpadId"}, 41 {21, &IUser::GetNpadId, "GetNpadId"},
41 {22, nullptr, "GetApplicationArea2"}, 42 {22, nullptr, "GetApplicationArea2"},
42 {23, nullptr, "AttachAvailabilityChangeEvent"}, 43 {23, nullptr, "AttachAvailabilityChangeEvent"},
43 {24, nullptr, "RecreateApplicationArea"}, 44 {24, nullptr, "RecreateApplicationArea"},
44 }; 45 };
45 RegisterHandlers(functions); 46 RegisterHandlers(functions);
47
48 activate_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:ActivateEvent");
49 deactivate_event =
50 Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:DeactivateEvent");
46 } 51 }
47 52
48private: 53private:
54 enum class State : u32 {
55 NonInitialized = 0,
56 Initialized = 1,
57 };
58
59 enum class DeviceState : u32 {
60 Initialized = 0,
61 };
62
49 void Initialize(Kernel::HLERequestContext& ctx) { 63 void Initialize(Kernel::HLERequestContext& ctx) {
50 NGLOG_WARNING(Service_NFP, "(STUBBED) called"); 64 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
65
66 state = State::Initialized;
67
51 IPC::ResponseBuilder rb{ctx, 2}; 68 IPC::ResponseBuilder rb{ctx, 2};
52 rb.Push(RESULT_SUCCESS); 69 rb.Push(RESULT_SUCCESS);
53 } 70 }
71
72 void ListDevices(Kernel::HLERequestContext& ctx) {
73 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
74 IPC::ResponseBuilder rb{ctx, 3};
75 rb.Push(RESULT_SUCCESS);
76 rb.Push<u32>(0);
77 }
78
79 void AttachActivateEvent(Kernel::HLERequestContext& ctx) {
80 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
81 IPC::ResponseBuilder rb{ctx, 2, 1};
82 rb.Push(RESULT_SUCCESS);
83 rb.PushCopyObjects(activate_event);
84 }
85
86 void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) {
87 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
88 IPC::ResponseBuilder rb{ctx, 2, 1};
89 rb.Push(RESULT_SUCCESS);
90 rb.PushCopyObjects(deactivate_event);
91 }
92
93 void GetState(Kernel::HLERequestContext& ctx) {
94 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
95 IPC::ResponseBuilder rb{ctx, 3};
96 rb.Push(RESULT_SUCCESS);
97 rb.Push<u32>(static_cast<u32>(state));
98 }
99
100 void GetDeviceState(Kernel::HLERequestContext& ctx) {
101 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
102 IPC::ResponseBuilder rb{ctx, 3};
103 rb.Push(RESULT_SUCCESS);
104 rb.Push<u32>(static_cast<u32>(device_state));
105 }
106
107 void GetNpadId(Kernel::HLERequestContext& ctx) {
108 NGLOG_WARNING(Service_NFP, "(STUBBED) called");
109 IPC::ResponseBuilder rb{ctx, 3};
110 rb.Push(RESULT_SUCCESS);
111 rb.Push<u32>(0);
112 }
113
114 State state{State::NonInitialized};
115 DeviceState device_state{DeviceState::Initialized};
116 Kernel::SharedPtr<Kernel::Event> activate_event;
117 Kernel::SharedPtr<Kernel::Event> deactivate_event;
54}; 118};
55 119
56void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { 120void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {