diff options
| author | 2021-10-20 15:17:50 -0700 | |
|---|---|---|
| committer | 2021-10-20 15:17:50 -0700 | |
| commit | b65314dc213b61218772bb75df6362b02666c88a (patch) | |
| tree | 685813e5c402326e30bba9daf6aff9d55cfb8b1a | |
| parent | Merge pull request #7197 from Moonlacer/tas_help_link (diff) | |
| parent | common/alignment: Fix VS2022 compilation (diff) | |
| download | yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.gz yuzu-b65314dc213b61218772bb75df6362b02666c88a.tar.xz yuzu-b65314dc213b61218772bb75df6362b02666c88a.zip | |
Merge pull request #7207 from ameerj/vs-2022
cmake: Update conan to support Visual Studio 2022
| -rw-r--r-- | CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/common/alignment.h | 7 | ||||
| -rw-r--r-- | src/input_common/udp/client.cpp | 74 |
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) | |||
| 411 | # Download conan.cmake automatically, you can also just copy the conan.cmake file | 411 | # Download conan.cmake automatically, you can also just copy the conan.cmake file |
| 412 | if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") | 412 | if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") |
| 413 | message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") | 413 | message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") |
| 414 | file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake" | 414 | # TODO: Use a tagged release. The latest tagged release does not support VS2022 as of this writing. |
| 415 | file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/43e385830ee35377dbd2dcbe8d5a9e750301ea00/conan.cmake" | ||
| 415 | "${CMAKE_BINARY_DIR}/conan.cmake") | 416 | "${CMAKE_BINARY_DIR}/conan.cmake") |
| 416 | endif() | 417 | endif() |
| 417 | include(${CMAKE_BINARY_DIR}/conan.cmake) | 418 | include(${CMAKE_BINARY_DIR}/conan.cmake) |
| 418 | 419 | ||
| 419 | conan_check(VERSION 1.24.0 REQUIRED) | 420 | conan_check(VERSION 1.41.0 REQUIRED) |
| 420 | 421 | ||
| 421 | # Manually add iconv to fix a dep conflict between qt and sdl2 | 422 | # Manually add iconv to fix a dep conflict between qt and sdl2 |
| 422 | # We don't need to add it through find_package or anything since the other two can find it just fine | 423 | # 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: | |||
| 64 | using propagate_on_container_copy_assignment = std::true_type; | 64 | using propagate_on_container_copy_assignment = std::true_type; |
| 65 | using propagate_on_container_move_assignment = std::true_type; | 65 | using propagate_on_container_move_assignment = std::true_type; |
| 66 | using propagate_on_container_swap = std::true_type; | 66 | using propagate_on_container_swap = std::true_type; |
| 67 | using is_always_equal = std::true_type; | 67 | using is_always_equal = std::false_type; |
| 68 | 68 | ||
| 69 | constexpr AlignmentAllocator() noexcept = default; | 69 | constexpr AlignmentAllocator() noexcept = default; |
| 70 | 70 | ||
| @@ -83,6 +83,11 @@ public: | |||
| 83 | struct rebind { | 83 | struct rebind { |
| 84 | using other = AlignmentAllocator<T2, Align>; | 84 | using other = AlignmentAllocator<T2, Align>; |
| 85 | }; | 85 | }; |
| 86 | |||
| 87 | template <typename T2, size_t Align2> | ||
| 88 | constexpr bool operator==(const AlignmentAllocator<T2, Align2>&) const noexcept { | ||
| 89 | return std::is_same_v<T, T2> && Align == Align2; | ||
| 90 | } | ||
| 86 | }; | 91 | }; |
| 87 | 92 | ||
| 88 | } // namespace Common | 93 | } // 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( | |||
| 471 | std::function<void(u16, u16, u16, u16)> data_callback) { | 471 | std::function<void(u16, u16, u16, u16)> data_callback) { |
| 472 | 472 | ||
| 473 | std::thread([=, this] { | 473 | std::thread([=, this] { |
| 474 | constexpr u16 CALIBRATION_THRESHOLD = 100; | ||
| 475 | |||
| 476 | u16 min_x{UINT16_MAX}; | ||
| 477 | u16 min_y{UINT16_MAX}; | ||
| 478 | u16 max_x{}; | ||
| 479 | u16 max_y{}; | ||
| 480 | |||
| 481 | Status current_status{Status::Initialized}; | 474 | Status current_status{Status::Initialized}; |
| 482 | SocketCallback callback{[](Response::Version) {}, [](Response::PortInfo) {}, | 475 | SocketCallback callback{ |
| 483 | [&](Response::PadData data) { | 476 | [](Response::Version) {}, [](Response::PortInfo) {}, |
| 484 | if (current_status == Status::Initialized) { | 477 | [&](Response::PadData data) { |
| 485 | // Receiving data means the communication is ready now | 478 | static constexpr u16 CALIBRATION_THRESHOLD = 100; |
| 486 | current_status = Status::Ready; | 479 | static constexpr u16 MAX_VALUE = UINT16_MAX; |
| 487 | status_callback(current_status); | 480 | |
| 488 | } | 481 | if (current_status == Status::Initialized) { |
| 489 | if (data.touch[0].is_active == 0) { | 482 | // Receiving data means the communication is ready now |
| 490 | return; | 483 | current_status = Status::Ready; |
| 491 | } | 484 | status_callback(current_status); |
| 492 | LOG_DEBUG(Input, "Current touch: {} {}", data.touch[0].x, | 485 | } |
| 493 | data.touch[0].y); | 486 | const auto& touchpad_0 = data.touch[0]; |
| 494 | min_x = std::min(min_x, static_cast<u16>(data.touch[0].x)); | 487 | if (touchpad_0.is_active == 0) { |
| 495 | min_y = std::min(min_y, static_cast<u16>(data.touch[0].y)); | 488 | return; |
| 496 | if (current_status == Status::Ready) { | 489 | } |
| 497 | // First touch - min data (min_x/min_y) | 490 | LOG_DEBUG(Input, "Current touch: {} {}", touchpad_0.x, touchpad_0.y); |
| 498 | current_status = Status::Stage1Completed; | 491 | const u16 min_x = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.x)); |
| 499 | status_callback(current_status); | 492 | const u16 min_y = std::min(MAX_VALUE, static_cast<u16>(touchpad_0.y)); |
| 500 | } | 493 | if (current_status == Status::Ready) { |
| 501 | if (data.touch[0].x - min_x > CALIBRATION_THRESHOLD && | 494 | // First touch - min data (min_x/min_y) |
| 502 | data.touch[0].y - min_y > CALIBRATION_THRESHOLD) { | 495 | current_status = Status::Stage1Completed; |
| 503 | // Set the current position as max value and finishes | 496 | status_callback(current_status); |
| 504 | // configuration | 497 | } |
| 505 | max_x = data.touch[0].x; | 498 | if (touchpad_0.x - min_x > CALIBRATION_THRESHOLD && |
| 506 | max_y = data.touch[0].y; | 499 | touchpad_0.y - min_y > CALIBRATION_THRESHOLD) { |
| 507 | current_status = Status::Completed; | 500 | // Set the current position as max value and finishes configuration |
| 508 | data_callback(min_x, min_y, max_x, max_y); | 501 | const u16 max_x = touchpad_0.x; |
| 509 | status_callback(current_status); | 502 | const u16 max_y = touchpad_0.y; |
| 510 | 503 | current_status = Status::Completed; | |
| 511 | complete_event.Set(); | 504 | data_callback(min_x, min_y, max_x, max_y); |
| 512 | } | 505 | status_callback(current_status); |
| 513 | }}; | 506 | |
| 507 | complete_event.Set(); | ||
| 508 | } | ||
| 509 | }}; | ||
| 514 | Socket socket{host, port, std::move(callback)}; | 510 | Socket socket{host, port, std::move(callback)}; |
| 515 | std::thread worker_thread{SocketLoop, &socket}; | 511 | std::thread worker_thread{SocketLoop, &socket}; |
| 516 | complete_event.Wait(); | 512 | complete_event.Wait(); |