summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-10-21 00:17:50 +0200
committerGitHub <noreply@github.com>2021-10-21 00:17:50 +0200
commitb65314dc213b61218772bb75df6362b02666c88a (patch)
tree685813e5c402326e30bba9daf6aff9d55cfb8b1a
parentMerge pull request #7197 from Moonlacer/tas_help_link (diff)
parentcommon/alignment: Fix VS2022 compilation (diff)
downloadyuzu-b65314dc213b61218772bb75df6362b02666c88a.tar
yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.gz
yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.bz2
yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.lz
yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.xz
yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.zst
yuzu-b65314dc213b61218772bb75df6362b02666c88a.zip
-rw-r--r--CMakeLists.txt5
-rw-r--r--src/common/alignment.h7
-rw-r--r--src/input_common/udp/client.cpp74
3 files changed, 44 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 123a3082a..eb403205c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -411,12 +411,13 @@ if (CONAN_REQUIRED_LIBS)
# Download conan.cmake automatically, you can also just copy the conan.cmake file
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
- file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake"
+ # TODO: Use a tagged release. The latest tagged release does not support VS2022 as of this writing.
+ file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/43e385830ee35377dbd2dcbe8d5a9e750301ea00/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
- conan_check(VERSION 1.24.0 REQUIRED)
+ conan_check(VERSION 1.41.0 REQUIRED)
# Manually add iconv to fix a dep conflict between qt and sdl2
# We don't need to add it through find_package or anything since the other two can find it just fine
diff --git a/src/common/alignment.h b/src/common/alignment.h
index 1b56569d1..8570c7d3c 100644
--- a/src/common/alignment.h
+++ b/src/common/alignment.h
@@ -64,7 +64,7 @@ public:
using propagate_on_container_copy_assignment = std::true_type;
using propagate_on_container_move_assignment = std::true_type;
using propagate_on_container_swap = std::true_type;
- using is_always_equal = std::true_type;
+ using is_always_equal = std::false_type;
constexpr AlignmentAllocator() noexcept = default;
@@ -83,6 +83,11 @@ public:
struct rebind {
using other = AlignmentAllocator<T2, Align>;
};
+
+ template <typename T2, size_t Align2>
+ constexpr bool operator==(const AlignmentAllocator<T2, Align2>&) const noexcept {
+ return std::is_same_v<T, T2> && Align == Align2;
+ }
};
} // namespace Common
diff --git a/src/input_common/udp/client.cpp b/src/input_common/udp/client.cpp
index 9b0aec797..b9512aa2e 100644
--- a/src/input_common/udp/client.cpp
+++ b/src/input_common/udp/client.cpp
@@ -471,46 +471,42 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
std::function<void(u16, u16, u16, u16)> data_callback) {
std::thread([=, this] {
- constexpr u16 CALIBRATION_THRESHOLD = 100;
-
- u16 min_x{UINT16_MAX};
- u16 min_y{UINT16_MAX};
- u16 max_x{};
- u16 max_y{};
-
Status current_status{Status::Initialized};
- SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {},
- [&](Response::PadData data) {
- if (current_status == Status::Initialized) {
- // Receiving data means the communication is ready now
- current_status = Status::Ready;
- status_callback(current_status);
- }
- if (data.touch[0].is_active == 0) {
- return;
- }
- LOG_DEBUG(Input, "Current touch: {} {}", data.touch[0].x,
- data.touch[0].y);
- min_x = std::min(min_x, static_cast<u16>(data.touch[0].x));
- min_y = std::min(min_y, static_cast<u16>(data.touch[0].y));
- if (current_status == Status::Ready) {
- // First touch - min data (min_x/min_y)
- current_status = Status::Stage1Completed;
- status_callback(current_status);
- }
- if (data.touch[0].x - min_x > CALIBRATION_THRESHOLD &&
- data.touch[0].y - min_y > CALIBRATION_THRESHOLD) {
- // Set the current position as max value and finishes
- // configuration
- max_x = data.touch[0].x;
- max_y = data.touch[0].y;
- current_status = Status::Completed;
- data_callback(min_x, min_y, max_x, max_y);
- status_callback(current_status);
-
- complete_event.Set();
- }
- }};
+ SocketCallback callback{
+ [](Response::Version) {}, [](Response::PortInfo) {},
+ [&](Response::PadData data) {
+ static constexpr u16 CALIBRATION_THRESHOLD = 100;
+ static constexpr u16 MAX_VALUE = UINT16_MAX;
+
+ if (current_status == Status::Initialized) {
+ // Receiving data means the communication is ready now
+ current_status = Status::Ready;
+ status_callback(current_status);
+ }
+ const auto& touchpad_0 = data.touch[0];
+ if (touchpad_0.is_active == 0) {
+ return;
+ }
+ LOG_DEBUG(Input, "Current touch: {} {}", touchpad_0.x, touchpad_0.y);
+ const u16 min_x = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.x));
+ const u16 min_y = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.y));
+ if (current_status == Status::Ready) {
+ // First touch - min data (min_x/min_y)
+ current_status = Status::Stage1Completed;
+ status_callback(current_status);
+ }
+ if (touchpad_0.x - min_x > CALIBRATION_THRESHOLD &&
+ touchpad_0.y - min_y > CALIBRATION_THRESHOLD) {
+ // Set the current position as max value and finishes configuration
+ const u16 max_x = touchpad_0.x;
+ const u16 max_y = touchpad_0.y;
+ current_status = Status::Completed;
+ data_callback(min_x, min_y, max_x, max_y);
+ status_callback(current_status);
+
+ complete_event.Set();
+ }
+ }};
Socket socket{host, port, std::move(callback)};
std::thread worker_thread{SocketLoop, &socket};
complete_event.Wait();