From be1954e04cb5a0c3a526f78ed5490a5e65310280 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 15 Oct 2020 14:49:45 -0400 Subject: core: Fix clang build Recent changes to the build system that made more warnings be flagged as errors caused building via clang to break. Fixes #4795 --- src/core/hle/service/hid/controllers/debug_pad.cpp | 8 ++- src/core/hle/service/hid/controllers/gesture.cpp | 8 ++- src/core/hle/service/hid/controllers/keyboard.cpp | 8 ++- src/core/hle/service/hid/controllers/mouse.cpp | 8 ++- src/core/hle/service/hid/controllers/npad.cpp | 69 +++++++++++++--------- src/core/hle/service/hid/controllers/stubbed.cpp | 12 ++-- .../hle/service/hid/controllers/touchscreen.cpp | 9 ++- src/core/hle/service/hid/controllers/touchscreen.h | 2 +- src/core/hle/service/hid/controllers/xpad.cpp | 8 ++- 9 files changed, 80 insertions(+), 52 deletions(-) (limited to 'src/core/hle/service/hid/controllers') diff --git a/src/core/hle/service/hid/controllers/debug_pad.cpp b/src/core/hle/service/hid/controllers/debug_pad.cpp index ad251ed4a..c2c1470a5 100644 --- a/src/core/hle/service/hid/controllers/debug_pad.cpp +++ b/src/core/hle/service/hid/controllers/debug_pad.cpp @@ -23,7 +23,7 @@ void Controller_DebugPad::OnRelease() {} void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { - shared_memory.header.timestamp = core_timing.GetCPUTicks(); + shared_memory.header.timestamp = static_cast(core_timing.GetCPUTicks()); shared_memory.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -33,9 +33,11 @@ void Controller_DebugPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, } shared_memory.header.entry_count = 16; - const auto& last_entry = shared_memory.pad_states[shared_memory.header.last_entry_index]; + const auto& last_entry = + shared_memory.pad_states[static_cast(shared_memory.header.last_entry_index)]; shared_memory.header.last_entry_index = (shared_memory.header.last_entry_index + 1) % 17; - auto& cur_entry = shared_memory.pad_states[shared_memory.header.last_entry_index]; + auto& cur_entry = + shared_memory.pad_states[static_cast(shared_memory.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; diff --git a/src/core/hle/service/hid/controllers/gesture.cpp b/src/core/hle/service/hid/controllers/gesture.cpp index b7b7bfeae..0618b2a05 100644 --- a/src/core/hle/service/hid/controllers/gesture.cpp +++ b/src/core/hle/service/hid/controllers/gesture.cpp @@ -19,7 +19,7 @@ void Controller_Gesture::OnRelease() {} void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { - shared_memory.header.timestamp = core_timing.GetCPUTicks(); + shared_memory.header.timestamp = static_cast(core_timing.GetCPUTicks()); shared_memory.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -29,9 +29,11 @@ void Controller_Gesture::OnUpdate(const Core::Timing::CoreTiming& core_timing, u } shared_memory.header.entry_count = 16; - const auto& last_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index]; + const auto& last_entry = + shared_memory.gesture_states[static_cast(shared_memory.header.last_entry_index)]; shared_memory.header.last_entry_index = (shared_memory.header.last_entry_index + 1) % 17; - auto& cur_entry = shared_memory.gesture_states[shared_memory.header.last_entry_index]; + auto& cur_entry = + shared_memory.gesture_states[static_cast(shared_memory.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; diff --git a/src/core/hle/service/hid/controllers/keyboard.cpp b/src/core/hle/service/hid/controllers/keyboard.cpp index 59b694cd4..0624be316 100644 --- a/src/core/hle/service/hid/controllers/keyboard.cpp +++ b/src/core/hle/service/hid/controllers/keyboard.cpp @@ -21,7 +21,7 @@ void Controller_Keyboard::OnRelease() {} void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { - shared_memory.header.timestamp = core_timing.GetCPUTicks(); + shared_memory.header.timestamp = static_cast(core_timing.GetCPUTicks()); shared_memory.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -31,9 +31,11 @@ void Controller_Keyboard::OnUpdate(const Core::Timing::CoreTiming& core_timing, } shared_memory.header.entry_count = 16; - const auto& last_entry = shared_memory.pad_states[shared_memory.header.last_entry_index]; + const auto& last_entry = + shared_memory.pad_states[static_cast(shared_memory.header.last_entry_index)]; shared_memory.header.last_entry_index = (shared_memory.header.last_entry_index + 1) % 17; - auto& cur_entry = shared_memory.pad_states[shared_memory.header.last_entry_index]; + auto& cur_entry = + shared_memory.pad_states[static_cast(shared_memory.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; diff --git a/src/core/hle/service/hid/controllers/mouse.cpp b/src/core/hle/service/hid/controllers/mouse.cpp index ac40989c5..10e2373bc 100644 --- a/src/core/hle/service/hid/controllers/mouse.cpp +++ b/src/core/hle/service/hid/controllers/mouse.cpp @@ -19,7 +19,7 @@ void Controller_Mouse::OnRelease() {} void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { - shared_memory.header.timestamp = core_timing.GetCPUTicks(); + shared_memory.header.timestamp = static_cast(core_timing.GetCPUTicks()); shared_memory.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -29,9 +29,11 @@ void Controller_Mouse::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* } shared_memory.header.entry_count = 16; - auto& last_entry = shared_memory.mouse_states[shared_memory.header.last_entry_index]; + auto& last_entry = + shared_memory.mouse_states[static_cast(shared_memory.header.last_entry_index)]; shared_memory.header.last_entry_index = (shared_memory.header.last_entry_index + 1) % 17; - auto& cur_entry = shared_memory.mouse_states[shared_memory.header.last_entry_index]; + auto& cur_entry = + shared_memory.mouse_states[static_cast(shared_memory.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; diff --git a/src/core/hle/service/hid/controllers/npad.cpp b/src/core/hle/service/hid/controllers/npad.cpp index e311bc18c..2422c0190 100644 --- a/src/core/hle/service/hid/controllers/npad.cpp +++ b/src/core/hle/service/hid/controllers/npad.cpp @@ -341,26 +341,29 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* } for (std::size_t i = 0; i < shared_memory_entries.size(); i++) { auto& npad = shared_memory_entries[i]; - const std::array controller_npads{&npad.main_controller_states, - &npad.handheld_states, - &npad.dual_states, - &npad.left_joy_states, - &npad.right_joy_states, - &npad.pokeball_states, - &npad.libnx}; + const std::array controller_npads{ + &npad.main_controller_states, + &npad.handheld_states, + &npad.dual_states, + &npad.left_joy_states, + &npad.right_joy_states, + &npad.pokeball_states, + &npad.libnx, + }; for (auto* main_controller : controller_npads) { main_controller->common.entry_count = 16; main_controller->common.total_entry_count = 17; const auto& last_entry = - main_controller->npad[main_controller->common.last_entry_index]; + main_controller->npad[static_cast(main_controller->common.last_entry_index)]; - main_controller->common.timestamp = core_timing.GetCPUTicks(); + main_controller->common.timestamp = static_cast(core_timing.GetCPUTicks()); main_controller->common.last_entry_index = (main_controller->common.last_entry_index + 1) % 17; - auto& cur_entry = main_controller->npad[main_controller->common.last_entry_index]; + auto& cur_entry = + main_controller->npad[static_cast(main_controller->common.last_entry_index)]; cur_entry.timestamp = last_entry.timestamp + 1; cur_entry.timestamp2 = cur_entry.timestamp; @@ -371,22 +374,29 @@ void Controller_NPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* if (controller_type == NPadControllerType::None || !connected_controllers[i].is_connected) { continue; } - const u32 npad_index = static_cast(i); + const auto npad_index = static_cast(i); RequestPadStateUpdate(npad_index); auto& pad_state = npad_pad_states[npad_index]; auto& main_controller = - npad.main_controller_states.npad[npad.main_controller_states.common.last_entry_index]; + npad.main_controller_states + .npad[static_cast(npad.main_controller_states.common.last_entry_index)]; auto& handheld_entry = - npad.handheld_states.npad[npad.handheld_states.common.last_entry_index]; - auto& dual_entry = npad.dual_states.npad[npad.dual_states.common.last_entry_index]; - auto& left_entry = npad.left_joy_states.npad[npad.left_joy_states.common.last_entry_index]; + npad.handheld_states + .npad[static_cast(npad.handheld_states.common.last_entry_index)]; + auto& dual_entry = + npad.dual_states.npad[static_cast(npad.dual_states.common.last_entry_index)]; + auto& left_entry = + npad.left_joy_states + .npad[static_cast(npad.left_joy_states.common.last_entry_index)]; auto& right_entry = - npad.right_joy_states.npad[npad.right_joy_states.common.last_entry_index]; + npad.right_joy_states + .npad[static_cast(npad.right_joy_states.common.last_entry_index)]; auto& pokeball_entry = - npad.pokeball_states.npad[npad.pokeball_states.common.last_entry_index]; - auto& libnx_entry = npad.libnx.npad[npad.libnx.common.last_entry_index]; + npad.pokeball_states + .npad[static_cast(npad.pokeball_states.common.last_entry_index)]; + auto& libnx_entry = npad.libnx.npad[static_cast(npad.libnx.common.last_entry_index)]; libnx_entry.connection_status.raw = 0; libnx_entry.connection_status.IsConnected.Assign(1); @@ -500,13 +510,14 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing sixaxis_sensor->common.total_entry_count = 17; const auto& last_entry = - sixaxis_sensor->sixaxis[sixaxis_sensor->common.last_entry_index]; + sixaxis_sensor->sixaxis[static_cast(sixaxis_sensor->common.last_entry_index)]; - sixaxis_sensor->common.timestamp = core_timing.GetCPUTicks(); + sixaxis_sensor->common.timestamp = static_cast(core_timing.GetCPUTicks()); sixaxis_sensor->common.last_entry_index = (sixaxis_sensor->common.last_entry_index + 1) % 17; - auto& cur_entry = sixaxis_sensor->sixaxis[sixaxis_sensor->common.last_entry_index]; + auto& cur_entry = + sixaxis_sensor->sixaxis[static_cast(sixaxis_sensor->common.last_entry_index)]; cur_entry.timestamp = last_entry.timestamp + 1; cur_entry.timestamp2 = cur_entry.timestamp; @@ -529,17 +540,21 @@ void Controller_NPad::OnMotionUpdate(const Core::Timing::CoreTiming& core_timing } auto& full_sixaxis_entry = - npad.sixaxis_full.sixaxis[npad.sixaxis_full.common.last_entry_index]; + npad.sixaxis_full.sixaxis[static_cast(npad.sixaxis_full.common.last_entry_index)]; auto& handheld_sixaxis_entry = - npad.sixaxis_handheld.sixaxis[npad.sixaxis_handheld.common.last_entry_index]; + npad.sixaxis_handheld + .sixaxis[static_cast(npad.sixaxis_handheld.common.last_entry_index)]; auto& dual_left_sixaxis_entry = - npad.sixaxis_dual_left.sixaxis[npad.sixaxis_dual_left.common.last_entry_index]; + npad.sixaxis_dual_left + .sixaxis[static_cast(npad.sixaxis_dual_left.common.last_entry_index)]; auto& dual_right_sixaxis_entry = - npad.sixaxis_dual_right.sixaxis[npad.sixaxis_dual_right.common.last_entry_index]; + npad.sixaxis_dual_right + .sixaxis[static_cast(npad.sixaxis_dual_right.common.last_entry_index)]; auto& left_sixaxis_entry = - npad.sixaxis_left.sixaxis[npad.sixaxis_left.common.last_entry_index]; + npad.sixaxis_left.sixaxis[static_cast(npad.sixaxis_left.common.last_entry_index)]; auto& right_sixaxis_entry = - npad.sixaxis_right.sixaxis[npad.sixaxis_right.common.last_entry_index]; + npad.sixaxis_right + .sixaxis[static_cast(npad.sixaxis_right.common.last_entry_index)]; switch (controller_type) { case NPadControllerType::None: diff --git a/src/core/hle/service/hid/controllers/stubbed.cpp b/src/core/hle/service/hid/controllers/stubbed.cpp index e7483bfa2..f9cb61667 100644 --- a/src/core/hle/service/hid/controllers/stubbed.cpp +++ b/src/core/hle/service/hid/controllers/stubbed.cpp @@ -22,12 +22,12 @@ void Controller_Stubbed::OnUpdate(const Core::Timing::CoreTiming& core_timing, u return; } - CommonHeader header{}; - header.timestamp = core_timing.GetCPUTicks(); - header.total_entry_count = 17; - header.entry_count = 0; - header.last_entry_index = 0; - + const CommonHeader header{ + .timestamp = static_cast(core_timing.GetCPUTicks()), + .total_entry_count = 17, + .last_entry_index = 0, + .entry_count = 0, + }; std::memcpy(data + common_offset, &header, sizeof(CommonHeader)); } diff --git a/src/core/hle/service/hid/controllers/touchscreen.cpp b/src/core/hle/service/hid/controllers/touchscreen.cpp index 0df395e85..06f4134a2 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.cpp +++ b/src/core/hle/service/hid/controllers/touchscreen.cpp @@ -22,7 +22,7 @@ void Controller_Touchscreen::OnRelease() {} void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { - shared_memory.header.timestamp = core_timing.GetCPUTicks(); + shared_memory.header.timestamp = static_cast(core_timing.GetCPUTicks()); shared_memory.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -33,9 +33,12 @@ void Controller_Touchscreen::OnUpdate(const Core::Timing::CoreTiming& core_timin shared_memory.header.entry_count = 16; const auto& last_entry = - shared_memory.shared_memory_entries[shared_memory.header.last_entry_index]; + shared_memory + .shared_memory_entries[static_cast(shared_memory.header.last_entry_index)]; shared_memory.header.last_entry_index = (shared_memory.header.last_entry_index + 1) % 17; - auto& cur_entry = shared_memory.shared_memory_entries[shared_memory.header.last_entry_index]; + auto& cur_entry = + shared_memory + .shared_memory_entries[static_cast(shared_memory.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; diff --git a/src/core/hle/service/hid/controllers/touchscreen.h b/src/core/hle/service/hid/controllers/touchscreen.h index 4d9042adc..746acbd1c 100644 --- a/src/core/hle/service/hid/controllers/touchscreen.h +++ b/src/core/hle/service/hid/controllers/touchscreen.h @@ -69,6 +69,6 @@ private: TouchScreenSharedMemory shared_memory{}; std::unique_ptr touch_device; std::unique_ptr touch_btn_device; - s64_le last_touch{}; + u64_le last_touch{}; }; } // namespace Service::HID diff --git a/src/core/hle/service/hid/controllers/xpad.cpp b/src/core/hle/service/hid/controllers/xpad.cpp index 2503ef241..60417abb8 100644 --- a/src/core/hle/service/hid/controllers/xpad.cpp +++ b/src/core/hle/service/hid/controllers/xpad.cpp @@ -20,7 +20,7 @@ void Controller_XPad::OnRelease() {} void Controller_XPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* data, std::size_t size) { for (auto& xpad_entry : shared_memory.shared_memory_entries) { - xpad_entry.header.timestamp = core_timing.GetCPUTicks(); + xpad_entry.header.timestamp = static_cast(core_timing.GetCPUTicks()); xpad_entry.header.total_entry_count = 17; if (!IsControllerActivated()) { @@ -30,9 +30,11 @@ void Controller_XPad::OnUpdate(const Core::Timing::CoreTiming& core_timing, u8* } xpad_entry.header.entry_count = 16; - const auto& last_entry = xpad_entry.pad_states[xpad_entry.header.last_entry_index]; + const auto& last_entry = + xpad_entry.pad_states[static_cast(xpad_entry.header.last_entry_index)]; xpad_entry.header.last_entry_index = (xpad_entry.header.last_entry_index + 1) % 17; - auto& cur_entry = xpad_entry.pad_states[xpad_entry.header.last_entry_index]; + auto& cur_entry = + xpad_entry.pad_states[static_cast(xpad_entry.header.last_entry_index)]; cur_entry.sampling_number = last_entry.sampling_number + 1; cur_entry.sampling_number2 = cur_entry.sampling_number; -- cgit v1.2.3