summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/CMakeLists.txt32
-rw-r--r--src/common/input.h5
-rw-r--r--src/common/settings.h2
-rw-r--r--src/common/thread.h4
4 files changed, 15 insertions, 28 deletions
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 635fb85c8..3447fabd8 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -14,32 +14,7 @@ if (DEFINED ENV{DISPLAYVERSION})
14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION}) 14 set(DISPLAY_VERSION $ENV{DISPLAYVERSION})
15endif () 15endif ()
16 16
17# Pass the path to git to the GenerateSCMRev.cmake as well 17include(GenerateSCMRev)
18find_package(Git QUIET)
19
20add_custom_command(OUTPUT scm_rev.cpp
21 COMMAND ${CMAKE_COMMAND}
22 -DSRC_DIR=${CMAKE_SOURCE_DIR}
23 -DBUILD_REPOSITORY=${BUILD_REPOSITORY}
24 -DTITLE_BAR_FORMAT_IDLE=${TITLE_BAR_FORMAT_IDLE}
25 -DTITLE_BAR_FORMAT_RUNNING=${TITLE_BAR_FORMAT_RUNNING}
26 -DBUILD_TAG=${BUILD_TAG}
27 -DBUILD_ID=${DISPLAY_VERSION}
28 -DGIT_REF_SPEC=${GIT_REF_SPEC}
29 -DGIT_REV=${GIT_REV}
30 -DGIT_DESC=${GIT_DESC}
31 -DGIT_BRANCH=${GIT_BRANCH}
32 -DBUILD_FULLNAME=${BUILD_FULLNAME}
33 -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
34 -P ${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake
35 DEPENDS
36 # Check that the scm_rev files haven't changed
37 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.cpp.in"
38 "${CMAKE_CURRENT_SOURCE_DIR}/scm_rev.h"
39 # technically we should regenerate if the git version changed, but its not worth the effort imo
40 "${CMAKE_SOURCE_DIR}/CMakeModules/GenerateSCMRev.cmake"
41 VERBATIM
42)
43 18
44add_library(common STATIC 19add_library(common STATIC
45 algorithm.h 20 algorithm.h
@@ -117,7 +92,7 @@ add_library(common STATIC
117 quaternion.h 92 quaternion.h
118 reader_writer_queue.h 93 reader_writer_queue.h
119 ring_buffer.h 94 ring_buffer.h
120 scm_rev.cpp 95 ${CMAKE_CURRENT_BINARY_DIR}/scm_rev.cpp
121 scm_rev.h 96 scm_rev.h
122 scope_exit.h 97 scope_exit.h
123 settings.cpp 98 settings.cpp
@@ -166,6 +141,7 @@ if(ARCHITECTURE_x86_64)
166 x64/xbyak_abi.h 141 x64/xbyak_abi.h
167 x64/xbyak_util.h 142 x64/xbyak_util.h
168 ) 143 )
144 target_link_libraries(common PRIVATE xbyak)
169endif() 145endif()
170 146
171if (MSVC) 147if (MSVC)
@@ -189,7 +165,7 @@ endif()
189create_target_directory_groups(common) 165create_target_directory_groups(common)
190 166
191target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) 167target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
192target_link_libraries(common PRIVATE lz4::lz4 xbyak) 168target_link_libraries(common PRIVATE lz4::lz4)
193if (TARGET zstd::zstd) 169if (TARGET zstd::zstd)
194 target_link_libraries(common PRIVATE zstd::zstd) 170 target_link_libraries(common PRIVATE zstd::zstd)
195else() 171else()
diff --git a/src/common/input.h b/src/common/input.h
index 213aa2384..825b0d650 100644
--- a/src/common/input.h
+++ b/src/common/input.h
@@ -102,6 +102,8 @@ struct AnalogProperties {
102 float offset{}; 102 float offset{};
103 // Invert direction of the sensor data 103 // Invert direction of the sensor data
104 bool inverted{}; 104 bool inverted{};
105 // Press once to activate, press again to release
106 bool toggle{};
105}; 107};
106 108
107// Single analog sensor data 109// Single analog sensor data
@@ -115,8 +117,11 @@ struct AnalogStatus {
115struct ButtonStatus { 117struct ButtonStatus {
116 Common::UUID uuid{}; 118 Common::UUID uuid{};
117 bool value{}; 119 bool value{};
120 // Invert value of the button
118 bool inverted{}; 121 bool inverted{};
122 // Press once to activate, press again to release
119 bool toggle{}; 123 bool toggle{};
124 // Internal lock for the toggle status
120 bool locked{}; 125 bool locked{};
121}; 126};
122 127
diff --git a/src/common/settings.h b/src/common/settings.h
index 13651de57..d2452c93b 100644
--- a/src/common/settings.h
+++ b/src/common/settings.h
@@ -530,6 +530,8 @@ struct Values {
530 Setting<bool> use_debug_asserts{false, "use_debug_asserts"}; 530 Setting<bool> use_debug_asserts{false, "use_debug_asserts"};
531 Setting<bool> use_auto_stub{false, "use_auto_stub"}; 531 Setting<bool> use_auto_stub{false, "use_auto_stub"};
532 Setting<bool> enable_all_controllers{false, "enable_all_controllers"}; 532 Setting<bool> enable_all_controllers{false, "enable_all_controllers"};
533 Setting<bool> create_crash_dumps{false, "create_crash_dumps"};
534 Setting<bool> perform_vulkan_check{true, "perform_vulkan_check"};
533 535
534 // Miscellaneous 536 // Miscellaneous
535 Setting<std::string> log_filter{"*:Info", "log_filter"}; 537 Setting<std::string> log_filter{"*:Info", "log_filter"};
diff --git a/src/common/thread.h b/src/common/thread.h
index 1552f58e0..e17a7850f 100644
--- a/src/common/thread.h
+++ b/src/common/thread.h
@@ -54,6 +54,10 @@ public:
54 is_set = false; 54 is_set = false;
55 } 55 }
56 56
57 [[nodiscard]] bool IsSet() {
58 return is_set;
59 }
60
57private: 61private:
58 std::condition_variable condvar; 62 std::condition_variable condvar;
59 std::mutex mutex; 63 std::mutex mutex;