core/hid: Add output devices

This commit is contained in:
german77 2021-10-11 00:43:11 -05:00 committed by Narr the Reg
parent e14ae06391
commit 06a5ef5874
20 changed files with 313 additions and 145 deletions

View file

@ -796,7 +796,7 @@ void Controller_NPad::InitializeVibrationDeviceAtIndex(std::size_t npad_index,
}
controller.vibration[device_index].device_mounted =
controller.device->TestVibration(device_index) == 1;
controller.device->TestVibration(device_index);
}
void Controller_NPad::SetPermitVibrationSession(bool permit_vibration_session) {
@ -954,31 +954,12 @@ bool Controller_NPad::SwapNpadAssignment(u32 npad_id_1, u32 npad_id_2) {
return true;
}
Controller_NPad::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) {
Core::HID::LedPattern Controller_NPad::GetLedPattern(u32 npad_id) {
if (npad_id == npad_id_list.back() || npad_id == npad_id_list[npad_id_list.size() - 2]) {
// These are controllers without led patterns
return LedPattern{0, 0, 0, 0};
}
switch (npad_id) {
case 0:
return LedPattern{1, 0, 0, 0};
case 1:
return LedPattern{1, 1, 0, 0};
case 2:
return LedPattern{1, 1, 1, 0};
case 3:
return LedPattern{1, 1, 1, 1};
case 4:
return LedPattern{1, 0, 0, 1};
case 5:
return LedPattern{1, 0, 1, 0};
case 6:
return LedPattern{1, 0, 1, 1};
case 7:
return LedPattern{0, 1, 1, 0};
default:
return LedPattern{0, 0, 0, 0};
return Core::HID::LedPattern{0, 0, 0, 0};
}
return controller_data[npad_id].device->GetLedPattern();
}
bool Controller_NPad::IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const {

View file

@ -115,22 +115,6 @@ public:
.freq_high = 320.0f,
};
struct LedPattern {
explicit LedPattern(u64 light1, u64 light2, u64 light3, u64 light4) {
position1.Assign(light1);
position2.Assign(light2);
position3.Assign(light3);
position4.Assign(light4);
}
union {
u64 raw{};
BitField<0, 1, u64> position1;
BitField<1, 1, u64> position2;
BitField<2, 1, u64> position3;
BitField<3, 1, u64> position4;
};
};
void SetSupportedStyleSet(Core::HID::NpadStyleTag style_set);
Core::HID::NpadStyleTag GetSupportedStyleSet() const;
@ -186,7 +170,7 @@ public:
void SetSixAxisFusionParameters(f32 parameter1, f32 parameter2);
std::pair<f32, f32> GetSixAxisFusionParameters();
void ResetSixAxisFusionParameters();
LedPattern GetLedPattern(u32 npad_id);
Core::HID::LedPattern GetLedPattern(u32 npad_id);
bool IsUnintendedHomeButtonInputProtectionEnabled(u32 npad_id) const;
void SetUnintendedHomeButtonInputProtectionEnabled(bool is_protection_enabled, u32 npad_id);
void SetAnalogStickUseCenterClamp(bool use_center_clamp);