Stub IUser::AttachAvailabilityChangeEvent

This commit is contained in:
mailwl 2018-06-04 17:51:52 +03:00
parent bb081dd1d2
commit 61fbf5c8e6
1 changed files with 23 additions and 5 deletions

View File

@ -41,7 +41,7 @@ public:
{20, &IUser::GetDeviceState, "GetDeviceState"}, {20, &IUser::GetDeviceState, "GetDeviceState"},
{21, &IUser::GetNpadId, "GetNpadId"}, {21, &IUser::GetNpadId, "GetNpadId"},
{22, nullptr, "GetApplicationArea2"}, {22, nullptr, "GetApplicationArea2"},
{23, nullptr, "AttachAvailabilityChangeEvent"}, {23, &IUser::AttachAvailabilityChangeEvent, "AttachAvailabilityChangeEvent"},
{24, nullptr, "RecreateApplicationArea"}, {24, nullptr, "RecreateApplicationArea"},
}; };
RegisterHandlers(functions); RegisterHandlers(functions);
@ -49,6 +49,8 @@ public:
activate_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:ActivateEvent"); activate_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:ActivateEvent");
deactivate_event = deactivate_event =
Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:DeactivateEvent"); Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:DeactivateEvent");
availability_change_event =
Kernel::Event::Create(Kernel::ResetType::OneShot, "IUser:AvailabilityChangeEvent");
} }
private: private:
@ -80,18 +82,24 @@ private:
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(1); rb.Push<u32>(0);
} }
void AttachActivateEvent(Kernel::HLERequestContext& ctx) { void AttachActivateEvent(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NFP, "(STUBBED) called"); IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(activate_event); rb.PushCopyObjects(activate_event);
} }
void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) { void AttachDeactivateEvent(Kernel::HLERequestContext& ctx) {
NGLOG_WARNING(Service_NFP, "(STUBBED) called"); IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1}; IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(deactivate_event); rb.PushCopyObjects(deactivate_event);
@ -114,19 +122,29 @@ private:
void GetNpadId(Kernel::HLERequestContext& ctx) { void GetNpadId(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx}; IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>(); const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle); NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 3}; IPC::ResponseBuilder rb{ctx, 3};
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
rb.Push<u32>(npad_id); rb.Push<u32>(npad_id);
} }
void AttachAvailabilityChangeEvent(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp{ctx};
const u64 dev_handle = rp.Pop<u64>();
NGLOG_WARNING(Service_NFP, "(STUBBED) called, dev_handle=0x{:X}", dev_handle);
IPC::ResponseBuilder rb{ctx, 2, 1};
rb.Push(RESULT_SUCCESS);
rb.PushCopyObjects(availability_change_event);
}
const u64 device_handle{0xDEAD}; const u64 device_handle{0xDEAD};
const HID::ControllerID npad_id{HID::Controller_Player1}; const HID::ControllerID npad_id{HID::Controller_Player1};
State state{State::NonInitialized}; State state{State::NonInitialized};
DeviceState device_state{DeviceState::Initialized}; DeviceState device_state{DeviceState::Initialized};
Kernel::SharedPtr<Kernel::Event> activate_event; Kernel::SharedPtr<Kernel::Event> activate_event;
Kernel::SharedPtr<Kernel::Event> deactivate_event; Kernel::SharedPtr<Kernel::Event> deactivate_event;
Kernel::SharedPtr<Kernel::Event> availability_change_event;
}; };
void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) { void Module::Interface::CreateUserInterface(Kernel::HLERequestContext& ctx) {