core: fix warnings

This commit is contained in:
SachinVin 2023-06-09 22:48:42 +05:30
parent 796e8a9f24
commit 8eb89c260d
12 changed files with 55 additions and 42 deletions

View file

@ -45,7 +45,7 @@ struct ControllerState {
union {
struct {
union {
u16_le hex;
u16_le hex = 0;
BitField<0, 1, u16> a;
BitField<1, 1, u16> b;
@ -96,7 +96,7 @@ struct ControllerState {
struct {
union {
u32_le hex;
u32_le hex = 0;
BitField<0, 5, u32> battery_level;
BitField<5, 1, u32> zl_not_held;
@ -136,7 +136,7 @@ static u64 GetInputCount(const std::vector<u8>& input) {
break;
}
ControllerState state;
ControllerState state{};
std::memcpy(&state, input.data() + pos, sizeof(ControllerState));
if (state.type == ControllerStateType::PadAndCircle) {
input_count++;
@ -238,7 +238,7 @@ void Movie::CheckInputEnd() {
}
void Movie::Play(Service::HID::PadState& pad_state, s16& circle_pad_x, s16& circle_pad_y) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
current_input++;
@ -270,7 +270,7 @@ void Movie::Play(Service::HID::PadState& pad_state, s16& circle_pad_x, s16& circ
}
void Movie::Play(Service::HID::TouchDataEntry& touch_data) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
@ -287,7 +287,7 @@ void Movie::Play(Service::HID::TouchDataEntry& touch_data) {
}
void Movie::Play(Service::HID::AccelerometerDataEntry& accelerometer_data) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
@ -304,7 +304,7 @@ void Movie::Play(Service::HID::AccelerometerDataEntry& accelerometer_data) {
}
void Movie::Play(Service::HID::GyroscopeDataEntry& gyroscope_data) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
@ -321,7 +321,7 @@ void Movie::Play(Service::HID::GyroscopeDataEntry& gyroscope_data) {
}
void Movie::Play(Service::IR::PadState& pad_state, s16& c_stick_x, s16& c_stick_y) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
@ -339,7 +339,7 @@ void Movie::Play(Service::IR::PadState& pad_state, s16& c_stick_x, s16& c_stick_
}
void Movie::Play(Service::IR::ExtraHIDResponse& extra_hid_response) {
ControllerState s;
ControllerState s{};
std::memcpy(&s, &recorded_input[current_byte], sizeof(ControllerState));
current_byte += sizeof(ControllerState);
@ -371,7 +371,7 @@ void Movie::Record(const Service::HID::PadState& pad_state, const s16& circle_pa
const s16& circle_pad_y) {
current_input++;
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::PadAndCircle;
s.pad_and_circle.a.Assign(static_cast<u16>(pad_state.a));
@ -396,7 +396,7 @@ void Movie::Record(const Service::HID::PadState& pad_state, const s16& circle_pa
}
void Movie::Record(const Service::HID::TouchDataEntry& touch_data) {
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::Touch;
s.touch.x = touch_data.x;
@ -407,7 +407,7 @@ void Movie::Record(const Service::HID::TouchDataEntry& touch_data) {
}
void Movie::Record(const Service::HID::AccelerometerDataEntry& accelerometer_data) {
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::Accelerometer;
s.accelerometer.x = accelerometer_data.x;
@ -418,7 +418,7 @@ void Movie::Record(const Service::HID::AccelerometerDataEntry& accelerometer_dat
}
void Movie::Record(const Service::HID::GyroscopeDataEntry& gyroscope_data) {
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::Gyroscope;
s.gyroscope.x = gyroscope_data.x;
@ -430,7 +430,7 @@ void Movie::Record(const Service::HID::GyroscopeDataEntry& gyroscope_data) {
void Movie::Record(const Service::IR::PadState& pad_state, const s16& c_stick_x,
const s16& c_stick_y) {
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::IrRst;
s.ir_rst.x = c_stick_x;
@ -442,7 +442,7 @@ void Movie::Record(const Service::IR::PadState& pad_state, const s16& c_stick_x,
}
void Movie::Record(const Service::IR::ExtraHIDResponse& extra_hid_response) {
ControllerState s;
ControllerState s{};
s.type = ControllerStateType::ExtraHidResponse;
s.extra_hid_response.battery_level.Assign(extra_hid_response.buttons.battery_level);