mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Merge pull request #9043 from german77/vector_data
input_common: have an unique vector in callback status
This commit is contained in:
commit
c3cae9d992
|
@ -277,8 +277,9 @@ struct CallbackStatus {
|
||||||
BodyColorStatus color_status{};
|
BodyColorStatus color_status{};
|
||||||
BatteryStatus battery_status{};
|
BatteryStatus battery_status{};
|
||||||
VibrationStatus vibration_status{};
|
VibrationStatus vibration_status{};
|
||||||
CameraStatus camera_status{};
|
CameraFormat camera_status{CameraFormat::None};
|
||||||
NfcStatus nfc_status{};
|
NfcState nfc_status{NfcState::Unknown};
|
||||||
|
std::vector<u8> raw_data{};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Triggered once every input change
|
// Triggered once every input change
|
||||||
|
|
|
@ -277,7 +277,10 @@ Common::Input::CameraStatus TransformToCamera(const Common::Input::CallbackStatu
|
||||||
Common::Input::CameraStatus camera{};
|
Common::Input::CameraStatus camera{};
|
||||||
switch (callback.type) {
|
switch (callback.type) {
|
||||||
case Common::Input::InputType::IrSensor:
|
case Common::Input::InputType::IrSensor:
|
||||||
camera = callback.camera_status;
|
camera = {
|
||||||
|
.format = callback.camera_status,
|
||||||
|
.data = callback.raw_data,
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Input, "Conversion from type {} to camera not implemented", callback.type);
|
LOG_ERROR(Input, "Conversion from type {} to camera not implemented", callback.type);
|
||||||
|
@ -291,7 +294,10 @@ Common::Input::NfcStatus TransformToNfc(const Common::Input::CallbackStatus& cal
|
||||||
Common::Input::NfcStatus nfc{};
|
Common::Input::NfcStatus nfc{};
|
||||||
switch (callback.type) {
|
switch (callback.type) {
|
||||||
case Common::Input::InputType::Nfc:
|
case Common::Input::InputType::Nfc:
|
||||||
return callback.nfc_status;
|
nfc = {
|
||||||
|
.state = callback.nfc_status,
|
||||||
|
.data = callback.raw_data,
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR(Input, "Conversion from type {} to NFC not implemented", callback.type);
|
LOG_ERROR(Input, "Conversion from type {} to NFC not implemented", callback.type);
|
||||||
|
|
|
@ -691,9 +691,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChange() {
|
void OnChange() {
|
||||||
|
const auto camera_status = GetStatus();
|
||||||
|
|
||||||
const Common::Input::CallbackStatus status{
|
const Common::Input::CallbackStatus status{
|
||||||
.type = Common::Input::InputType::IrSensor,
|
.type = Common::Input::InputType::IrSensor,
|
||||||
.camera_status = GetStatus(),
|
.camera_status = camera_status.format,
|
||||||
|
.raw_data = camera_status.data,
|
||||||
};
|
};
|
||||||
|
|
||||||
TriggerOnChange(status);
|
TriggerOnChange(status);
|
||||||
|
@ -732,9 +735,12 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnChange() {
|
void OnChange() {
|
||||||
|
const auto nfc_status = GetStatus();
|
||||||
|
|
||||||
const Common::Input::CallbackStatus status{
|
const Common::Input::CallbackStatus status{
|
||||||
.type = Common::Input::InputType::Nfc,
|
.type = Common::Input::InputType::Nfc,
|
||||||
.nfc_status = GetStatus(),
|
.nfc_status = nfc_status.state,
|
||||||
|
.raw_data = nfc_status.data,
|
||||||
};
|
};
|
||||||
|
|
||||||
TriggerOnChange(status);
|
TriggerOnChange(status);
|
||||||
|
|
Loading…
Reference in a new issue