core/hid: Add home and screenshot button support
This commit is contained in:
parent
7116a7d28b
commit
b94e947793
3 changed files with 46 additions and 1 deletions
|
@ -596,7 +596,10 @@ void EmulatedController::SetButton(const Common::Input::CallbackStatus& callback
|
||||||
controller.npad_button_state.right_sr.Assign(current_status.value);
|
controller.npad_button_state.right_sr.Assign(current_status.value);
|
||||||
break;
|
break;
|
||||||
case Settings::NativeButton::Home:
|
case Settings::NativeButton::Home:
|
||||||
|
controller.home_button_state.home.Assign(current_status.value);
|
||||||
|
break;
|
||||||
case Settings::NativeButton::Screenshot:
|
case Settings::NativeButton::Screenshot:
|
||||||
|
controller.capture_button_state.capture.Assign(current_status.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1077,6 +1080,20 @@ BatteryValues EmulatedController::GetBatteryValues() const {
|
||||||
return controller.battery_values;
|
return controller.battery_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HomeButtonState EmulatedController::GetHomeButtons() const {
|
||||||
|
if (is_configuring) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return controller.home_button_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
CaptureButtonState EmulatedController::GetCaptureButtons() const {
|
||||||
|
if (is_configuring) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
return controller.capture_button_state;
|
||||||
|
}
|
||||||
|
|
||||||
NpadButtonState EmulatedController::GetNpadButtons() const {
|
NpadButtonState EmulatedController::GetNpadButtons() const {
|
||||||
if (is_configuring) {
|
if (is_configuring) {
|
||||||
return {};
|
return {};
|
||||||
|
|
|
@ -101,6 +101,8 @@ struct ControllerStatus {
|
||||||
VibrationValues vibration_values{};
|
VibrationValues vibration_values{};
|
||||||
|
|
||||||
// Data for HID serices
|
// Data for HID serices
|
||||||
|
HomeButtonState home_button_state{};
|
||||||
|
CaptureButtonState capture_button_state{};
|
||||||
NpadButtonState npad_button_state{};
|
NpadButtonState npad_button_state{};
|
||||||
DebugPadButton debug_pad_button_state{};
|
DebugPadButton debug_pad_button_state{};
|
||||||
AnalogSticks analog_stick_state{};
|
AnalogSticks analog_stick_state{};
|
||||||
|
@ -261,7 +263,13 @@ public:
|
||||||
/// Returns the latest battery status from the controller with parameters
|
/// Returns the latest battery status from the controller with parameters
|
||||||
BatteryValues GetBatteryValues() const;
|
BatteryValues GetBatteryValues() const;
|
||||||
|
|
||||||
/// Returns the latest status of button input for the npad service
|
/// Returns the latest status of button input for the hid::HomeButton service
|
||||||
|
HomeButtonState GetHomeButtons() const;
|
||||||
|
|
||||||
|
/// Returns the latest status of button input for the hid::CaptureButton service
|
||||||
|
CaptureButtonState GetCaptureButtons() const;
|
||||||
|
|
||||||
|
/// Returns the latest status of button input for the hid::Npad service
|
||||||
NpadButtonState GetNpadButtons() const;
|
NpadButtonState GetNpadButtons() const;
|
||||||
|
|
||||||
/// Returns the latest status of button input for the debug pad service
|
/// Returns the latest status of button input for the debug pad service
|
||||||
|
|
|
@ -378,6 +378,26 @@ struct LedPattern {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct HomeButtonState {
|
||||||
|
union {
|
||||||
|
u64 raw{};
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
BitField<0, 1, u64> home;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(HomeButtonState) == 0x8, "HomeButtonState has incorrect size.");
|
||||||
|
|
||||||
|
struct CaptureButtonState {
|
||||||
|
union {
|
||||||
|
u64 raw{};
|
||||||
|
|
||||||
|
// Buttons
|
||||||
|
BitField<0, 1, u64> capture;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
static_assert(sizeof(CaptureButtonState) == 0x8, "CaptureButtonState has incorrect size.");
|
||||||
|
|
||||||
struct NpadButtonState {
|
struct NpadButtonState {
|
||||||
union {
|
union {
|
||||||
NpadButton raw{};
|
NpadButton raw{};
|
||||||
|
|
Loading…
Reference in a new issue