hid: service: Implement Last active Npad
This commit is contained in:
parent
c8b9467f50
commit
8950fe79ad
4 changed files with 20 additions and 1 deletions
|
@ -154,6 +154,14 @@ NpadIdType HIDCore::GetFirstDisconnectedNpadId() const {
|
||||||
return NpadIdType::Player1;
|
return NpadIdType::Player1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HIDCore::SetLastActiveController(NpadIdType npad_id) {
|
||||||
|
last_active_controller = npad_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
NpadIdType HIDCore::GetLastActiveController() const {
|
||||||
|
return last_active_controller;
|
||||||
|
}
|
||||||
|
|
||||||
void HIDCore::EnableAllControllerConfiguration() {
|
void HIDCore::EnableAllControllerConfiguration() {
|
||||||
player_1->EnableConfiguration();
|
player_1->EnableConfiguration();
|
||||||
player_2->EnableConfiguration();
|
player_2->EnableConfiguration();
|
||||||
|
|
|
@ -48,6 +48,12 @@ public:
|
||||||
/// Returns the first disconnected npad id
|
/// Returns the first disconnected npad id
|
||||||
NpadIdType GetFirstDisconnectedNpadId() const;
|
NpadIdType GetFirstDisconnectedNpadId() const;
|
||||||
|
|
||||||
|
/// Sets the npad id of the last active controller
|
||||||
|
void SetLastActiveController(NpadIdType npad_id);
|
||||||
|
|
||||||
|
/// Returns the npad id of the last controller that pushed a button
|
||||||
|
NpadIdType GetLastActiveController() const;
|
||||||
|
|
||||||
/// Sets all emulated controllers into configuring mode.
|
/// Sets all emulated controllers into configuring mode.
|
||||||
void EnableAllControllerConfiguration();
|
void EnableAllControllerConfiguration();
|
||||||
|
|
||||||
|
@ -77,6 +83,7 @@ private:
|
||||||
std::unique_ptr<EmulatedConsole> console;
|
std::unique_ptr<EmulatedConsole> console;
|
||||||
std::unique_ptr<EmulatedDevices> devices;
|
std::unique_ptr<EmulatedDevices> devices;
|
||||||
NpadStyleTag supported_style_tag{NpadStyleSet::All};
|
NpadStyleTag supported_style_tag{NpadStyleSet::All};
|
||||||
|
NpadIdType last_active_controller{NpadIdType::Handheld};
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::HID
|
} // namespace Core::HID
|
||||||
|
|
|
@ -476,6 +476,10 @@ void Controller_NPad::RequestPadStateUpdate(Core::HID::NpadIdType npad_id) {
|
||||||
pad_entry.npad_buttons.l.Assign(button_state.zl);
|
pad_entry.npad_buttons.l.Assign(button_state.zl);
|
||||||
pad_entry.npad_buttons.r.Assign(button_state.zr);
|
pad_entry.npad_buttons.r.Assign(button_state.zr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pad_entry.npad_buttons.raw != Core::HID::NpadButton::None) {
|
||||||
|
hid_core.SetLastActiveController(npad_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing) {
|
||||||
|
|
|
@ -2768,7 +2768,7 @@ private:
|
||||||
|
|
||||||
IPC::ResponseBuilder rb{ctx, 3};
|
IPC::ResponseBuilder rb{ctx, 3};
|
||||||
rb.Push(ResultSuccess);
|
rb.Push(ResultSuccess);
|
||||||
rb.PushEnum(Core::HID::NpadIdType::Handheld);
|
rb.PushEnum(system.HIDCore().GetLastActiveController());
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetUniquePadsFromNpad(HLERequestContext& ctx) {
|
void GetUniquePadsFromNpad(HLERequestContext& ctx) {
|
||||||
|
|
Loading…
Reference in a new issue