├── docs └── images │ ├── hmdq_128.png │ └── hmdv_128.png ├── res ├── save_data.cmd ├── gitversion.h.in └── misc.h.in ├── src ├── hmdq │ ├── res │ │ ├── hmdq_icon.ico │ │ ├── hmdq_misc.h.in │ │ └── hmdq.rc.in │ ├── oculus_collector.h │ ├── openvr_collector.h │ └── CMakeLists.txt ├── hmdv │ ├── res │ │ ├── hmdv_icon.ico │ │ ├── hmdv_misc.h.in │ │ └── hmdv.rc.in │ ├── hmdfix.h │ └── CMakeLists.txt ├── common │ ├── json_proxy.h │ ├── verhlp.h │ ├── oculus_config.h │ ├── openvr_config.h │ ├── config.h │ ├── xtdef.cpp │ ├── fmthlp.h │ ├── jkeys.cpp │ ├── prtstl.h │ ├── oculus_processor.h │ ├── CMakeLists.txt │ ├── calcview.h │ ├── openvr_common.h │ ├── base_common.h │ ├── prtdef.h │ ├── openvr_processor.h │ ├── except.h │ ├── oculus_config.cpp │ ├── oculus_props.h │ ├── verhlp.cpp │ ├── prtdata.h │ ├── wintools.h │ ├── xtdef.h │ ├── geom.h │ ├── optmesh.h │ ├── oculus_common.h │ ├── geom.cpp │ ├── openvr_config.cpp │ ├── jtools.h │ ├── openvr_common.cpp │ ├── base_classes.h │ ├── geom2.h │ └── oculus_common.cpp ├── hmdq_test │ ├── CMakeLists.txt │ ├── verhlp_test.cpp │ ├── geos_test.cpp │ └── geom_test.cpp └── CMakeLists.txt ├── conan ├── packages │ ├── catch2 │ │ ├── test_package │ │ │ ├── 100-standalone.cpp │ │ │ ├── 300-standalone-with-prefix.cpp │ │ │ ├── 200-benchmark.cpp │ │ │ ├── 400-benchmark-with-prefix.cpp │ │ │ ├── CMakeLists.txt │ │ │ └── conanfile.py │ │ ├── conan_build_and_cache_bin_non_shared_packages.cmd │ │ └── conandata.yml │ ├── xtl │ │ ├── conan_build_and_cache_source_only_package.cmd │ │ ├── test_package │ │ │ ├── CMakeLists.txt │ │ │ ├── test_package.cpp │ │ │ └── conanfile.py │ │ ├── conandata.yml │ │ └── conanfile.py │ ├── clipp │ │ ├── conan_build_and_cache_source_only_package.cmd │ │ └── conanfile.py │ ├── xtensor │ │ ├── conan_build_and_cache_source_only_package.cmd │ │ ├── test_package │ │ │ ├── test_package.cpp │ │ │ ├── CMakeLists.txt │ │ │ └── conanfile.py │ │ ├── patches │ │ │ ├── 0.23.9-cxx11-abi.patch │ │ │ └── 0.21.5-cxx11-abi.patch │ │ ├── conandata.yml │ │ └── conanfile.py │ ├── nlohmann_json │ │ ├── conan_build_and_cache_source_only_package.cmd │ │ ├── test_package │ │ │ ├── CMakeLists.txt │ │ │ ├── test_package.cpp │ │ │ └── conanfile.py │ │ ├── conanfile.py │ │ └── conandata.yml │ ├── botan │ │ ├── conan_build_and_cache_bin_shared_packages.cmd │ │ ├── test_package │ │ │ ├── test_package.cpp │ │ │ ├── CMakeLists.txt │ │ │ └── conanfile.py │ │ ├── conan_build_and_cache_bin_non_shared_packages.cmd │ │ ├── patches │ │ │ ├── fix-amalgamation-build.patch │ │ │ ├── backport-getrandom-via-syscall-to-3.0.0.patch │ │ │ └── backport-getrandom-via-syscall-to-3.1.0.patch │ │ └── conandata.yml │ ├── fmt │ │ ├── conan_build_and_cache_bin_non_shared_packages.cmd │ │ ├── test_package │ │ │ ├── test_ranges.cpp │ │ │ ├── CMakeLists.txt │ │ │ ├── conanfile.py │ │ │ └── test_package.cpp │ │ ├── patches │ │ │ └── fix-install-5.3.0.patch │ │ └── conandata.yml │ ├── openvr │ │ ├── conan_build_and_cache_bin_shared_packages.cmd │ │ ├── conan_build_and_cache_bin_non_shared_packages.cmd │ │ ├── conandata.yml │ │ ├── patches │ │ │ └── 1.26.7 │ │ │ │ └── 0001-openvr-Public-API-fix-for-C-unity-vrshared_double-do.patch │ │ └── conanfile.py │ └── geos │ │ ├── conan_build_and_cache_bin_non_shared_packages.cmd │ │ ├── test_package │ │ ├── CMakeLists.txt │ │ ├── test_package.c │ │ └── conanfile.py │ │ └── conandata.yml ├── scripts │ ├── conan_build_and_cache_source_only_package.cmd │ ├── conan_build_and_cache_bin_packages.cmd │ └── conan_build_and_cache_bin_shared_packages.cmd ├── profiles │ ├── host_msvc_v193_crtdll.txt │ └── build_msvc_v193_crtdll.txt └── conan_install_all.cmd ├── .gitignore ├── conanfile.txt ├── clang-reformat.ps1 ├── cmake ├── build.cmake ├── gitversion.cmake └── utils.cmake ├── LICENSE ├── CMakeLists.txt ├── CMakePresets.json ├── python └── hmdv_batch.py └── .clang-format /docs/images/hmdq_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/risa2000/hmdq/HEAD/docs/images/hmdq_128.png -------------------------------------------------------------------------------- /docs/images/hmdv_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/risa2000/hmdq/HEAD/docs/images/hmdv_128.png -------------------------------------------------------------------------------- /res/save_data.cmd: -------------------------------------------------------------------------------- 1 | PUSHD %CD% 2 | cd %~dp0 3 | hmdq.exe -n --out_json hmdq_data.json 4 | POPD 5 | -------------------------------------------------------------------------------- /src/hmdq/res/hmdq_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/risa2000/hmdq/HEAD/src/hmdq/res/hmdq_icon.ico -------------------------------------------------------------------------------- /src/hmdv/res/hmdv_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/risa2000/hmdq/HEAD/src/hmdv/res/hmdv_icon.ico -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/100-standalone.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | TEST_CASE( "compiles and runs" ) { 4 | REQUIRE( true == !false ); 5 | } 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Build results 2 | build/ 3 | out/ 4 | 5 | # Visual Studio 2019 cache/options directory 6 | .vs/ 7 | 8 | # Visual Studio Code cache/options directory 9 | .vscode/ 10 | -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/300-standalone-with-prefix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | CATCH_TEST_CASE( "compiles and runs" ) { 4 | CATCH_REQUIRE( true == !false ); 5 | } 6 | -------------------------------------------------------------------------------- /conan/scripts/conan_build_and_cache_source_only_package.cmd: -------------------------------------------------------------------------------- 1 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None %RECIPE% %PACKAGE%/%VERSION%@ 2 | -------------------------------------------------------------------------------- /conan/packages/xtl/conan_build_and_cache_source_only_package.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=0.8.0) ELSE (SET VERSION=%1) 2 | SET PACKAGE=xtl 3 | SET RECIPE=. 4 | ..\..\scripts\conan_build_and_cache_source_only_package.cmd 5 | -------------------------------------------------------------------------------- /conan/packages/clipp/conan_build_and_cache_source_only_package.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=cci.20230831) ELSE (SET VERSION=%1) 2 | SET PACKAGE=clipp 3 | SET RECIPE=. 4 | ..\..\scripts\conan_build_and_cache_source_only_package.cmd 5 | -------------------------------------------------------------------------------- /conan/packages/xtensor/conan_build_and_cache_source_only_package.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=0.26.0) ELSE (SET VERSION=%1) 2 | SET PACKAGE=xtensor 3 | SET RECIPE=. 4 | ..\..\scripts\conan_build_and_cache_source_only_package.cmd 5 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/conan_build_and_cache_source_only_package.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=3.12.0) ELSE (SET VERSION=%1) 2 | SET PACKAGE=nlohmann_json 3 | SET RECIPE=. 4 | ..\..\scripts\conan_build_and_cache_source_only_package.cmd 5 | -------------------------------------------------------------------------------- /conan/packages/botan/conan_build_and_cache_bin_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=3.7.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=botan 3 | SET RECIPE=. 4 | SET SHARED=True 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/botan/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | std::vector key = Botan::hex_decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F"); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /conan/packages/fmt/conan_build_and_cache_bin_non_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=11.1.4) ELSE (SET VERSION=%1) 2 | SET PACKAGE=fmt 3 | SET RECIPE=. 4 | SET SHARED=False 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/openvr/conan_build_and_cache_bin_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=2.5.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=openvr 3 | SET RECIPE=. 4 | SET SHARED=True 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/botan/conan_build_and_cache_bin_non_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=3.7.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=botan 3 | SET RECIPE=. 4 | SET SHARED=False 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/catch2/conan_build_and_cache_bin_non_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=3.8.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=catch2 3 | SET RECIPE=. 4 | SET SHARED=False 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/geos/conan_build_and_cache_bin_non_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=3.13.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=geos 3 | SET RECIPE=. 4 | SET SHARED=False 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/openvr/conan_build_and_cache_bin_non_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | IF [%~1] EQU [] (SET VERSION=2.5.1) ELSE (SET VERSION=%1) 2 | SET PACKAGE=openvr 3 | SET RECIPE=. 4 | SET SHARED=False 5 | ..\..\scripts\conan_build_and_cache_bin_shared_packages.cmd 6 | -------------------------------------------------------------------------------- /conan/packages/geos/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES C) 3 | 4 | find_package(geos CONFIG REQUIRED geos_c) 5 | 6 | add_executable(${PROJECT_NAME} test_package.c) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE GEOS::geos_c) 8 | -------------------------------------------------------------------------------- /conanfile.txt: -------------------------------------------------------------------------------- 1 | [requires] 2 | clipp/cci.20230831 3 | fmt/11.1.4 4 | nlohmann_json/3.12.0 5 | xtensor/0.25.0 6 | eigen/3.4.0 7 | openvr/2.5.1 8 | catch2/3.8.1 9 | botan/3.7.1 10 | geos/3.13.1 11 | 12 | [generators] 13 | CMakeToolchain 14 | CMakeDeps 15 | 16 | [options] 17 | 18 | [imports] 19 | bin, *.dll -> . 20 | -------------------------------------------------------------------------------- /conan/packages/xtl/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(xtl REQUIRED CONFIG) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE xtl) 8 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) 9 | -------------------------------------------------------------------------------- /conan/profiles/host_msvc_v193_crtdll.txt: -------------------------------------------------------------------------------- 1 | [settings] 2 | os=Windows 3 | os_build=Windows 4 | arch=x86_64 5 | arch_build=x86_64 6 | compiler=msvc 7 | compiler.version=193 8 | compiler.runtime=dynamic 9 | compiler.cppstd=20 10 | build_type=Release 11 | 12 | [conf] 13 | tools.cmake.cmaketoolchain:generator=Ninja 14 | 15 | [options] 16 | [build_requires] 17 | [env] 18 | -------------------------------------------------------------------------------- /conan/profiles/build_msvc_v193_crtdll.txt: -------------------------------------------------------------------------------- 1 | [settings] 2 | os=Windows 3 | os_build=Windows 4 | arch=x86_64 5 | arch_build=x86_64 6 | compiler=msvc 7 | compiler.version=193 8 | compiler.runtime=dynamic 9 | compiler.cppstd=20 10 | build_type=Release 11 | 12 | [conf] 13 | tools.cmake.cmaketoolchain:generator=Ninja 14 | 15 | [options] 16 | [build_requires] 17 | [env] 18 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(nlohmann_json REQUIRED CONFIG) 5 | 6 | add_executable(${PROJECT_NAME} test_package.cpp) 7 | target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) 8 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) 9 | -------------------------------------------------------------------------------- /conan/packages/xtl/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) { 5 | xtl::variant v, w; 6 | 7 | v = 12; 8 | int i = xtl::get(v); 9 | w = xtl::get(v); 10 | 11 | std::cout << xtl::get(v) << "\n"; 12 | std::cout << xtl::get(w) << "\n"; 13 | 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/200-benchmark.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | unsigned int Factorial( unsigned int number ) { 5 | return number > 1 ? Factorial(number-1)*number : 1; 6 | } 7 | 8 | TEST_CASE( "compiles and runs" ) { 9 | BENCHMARK("factorial 25"){ 10 | return Factorial(25); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /conan/packages/fmt/test_package/test_ranges.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "fmt/ranges.h" 4 | 5 | int main() { 6 | std::vector numbers; 7 | fmt::format_to(std::back_inserter(numbers), "{}{}{}", 1, 2, 3); 8 | const std::string str_numbers = fmt::format("{}", numbers); 9 | fmt::print("numbers: {}\n", str_numbers); 10 | return EXIT_SUCCESS; 11 | } 12 | -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/400-benchmark-with-prefix.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | unsigned int Factorial( unsigned int number ) { 5 | return number > 1 ? Factorial(number-1)*number : 1; 6 | } 7 | 8 | CATCH_TEST_CASE( "compiles and runs" ) { 9 | CATCH_BENCHMARK("factorial 25"){ 10 | return Factorial(25); 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /conan/packages/xtensor/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include "xtensor/xarray.hpp" 2 | #include "xtensor/xio.hpp" 3 | #include "xtensor/xview.hpp" 4 | #include 5 | 6 | int main(int argc, char *argv[]) { 7 | xt::xarray arr1{{1.0, 2.0, 3.0}, {2.0, 5.0, 7.0}, {2.0, 5.0, 7.0}}; 8 | 9 | xt::xarray arr2{5.0, 6.0, 7.0}; 10 | 11 | xt::xarray res = xt::view(arr1, 1) + arr2; 12 | 13 | std::cout << res << std::endl; 14 | 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /conan/packages/botan/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | 3 | project(test_package CXX) 4 | 5 | find_package(botan REQUIRED CONFIG) 6 | 7 | add_executable(${PROJECT_NAME} test_package.cpp) 8 | target_link_libraries(${PROJECT_NAME} botan::botan) 9 | if(botan_VERSION_STRING VERSION_LESS "3.0.0") 10 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) 11 | else() 12 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) 13 | endif() 14 | -------------------------------------------------------------------------------- /conan/packages/fmt/patches/fix-install-5.3.0.patch: -------------------------------------------------------------------------------- 1 | --- a/CMakeLists.txt 2 | +++ b/CMakeLists.txt 3 | @@ -235,7 +235,9 @@ if (FMT_INSTALL) 4 | 5 | # Install the library and headers. 6 | install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name} 7 | - DESTINATION ${FMT_LIB_DIR}) 8 | + LIBRARY DESTINATION ${FMT_LIB_DIR} 9 | + ARCHIVE DESTINATION ${FMT_LIB_DIR} 10 | + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) 11 | 12 | install(FILES $ DESTINATION ${FMT_LIB_DIR} OPTIONAL) 13 | install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR}) 14 | -------------------------------------------------------------------------------- /clang-reformat.ps1: -------------------------------------------------------------------------------- 1 | $fileTypes = '*.cpp', '*.h' 2 | $sourceDirs = 'src' 3 | $exclude = 4 | 5 | $clangFormatFile = "file" 6 | if ($args.Count -ge 1) { 7 | $clangFormatFile = "file:" + $args[0] 8 | } 9 | 10 | $scriptDir = Split-Path -Path $PSCommandPath 11 | $cores = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors 12 | 13 | foreach ($dir in $sourceDirs) { 14 | Get-ChildItem -Path (Join-Path $scriptDir $dir) -Recurse -Include $fileTypes -Exclude $exclude | 15 | Foreach-Object -ThrottleLimit $cores -Parallel { 16 | & clang-format $cmdArgs --style=$using:clangFormatFile --verbose -i $_.FullName 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /conan/packages/xtensor/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | include(CheckCXXCompilerFlag) 5 | 6 | find_package(xtensor REQUIRED CONFIG) 7 | 8 | add_executable(${PROJECT_NAME} test_package.cpp) 9 | target_link_libraries(${PROJECT_NAME} PRIVATE xtensor) 10 | target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) 11 | 12 | foreach(flag "-march=native" "-mtune=native") 13 | check_cxx_compiler_flag(${flag} COMPILER_SUPPORTS_MARCH_NATIVE) 14 | if(COMPILER_SUPPORTS_MARCH_NATIVE) 15 | target_compile_options(${PROJECT_NAME} PRIVATE ${flag}) 16 | endif() 17 | endforeach() 18 | -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(Catch2 REQUIRED CONFIG) 5 | 6 | if(WITH_PREFIX) 7 | add_executable(standalone 300-standalone-with-prefix.cpp) 8 | add_executable(benchmark 400-benchmark-with-prefix.cpp) 9 | else() 10 | add_executable(standalone 100-standalone.cpp) 11 | add_executable(benchmark 200-benchmark.cpp) 12 | endif() 13 | target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) 14 | target_compile_features(standalone PRIVATE cxx_std_14) 15 | target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) 16 | target_compile_features(benchmark PRIVATE cxx_std_14) 17 | -------------------------------------------------------------------------------- /conan/packages/fmt/test_package/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.15) 2 | project(test_package LANGUAGES CXX) 3 | 4 | find_package(fmt REQUIRED CONFIG) 5 | 6 | add_executable(test_package test_package.cpp) 7 | target_compile_features(test_package PRIVATE cxx_std_14) 8 | if(FMT_HEADER_ONLY) 9 | target_link_libraries(test_package PRIVATE fmt::fmt-header-only) 10 | else() 11 | target_link_libraries(test_package PRIVATE fmt::fmt) 12 | endif() 13 | 14 | add_executable(test_ranges test_ranges.cpp) 15 | target_compile_features(test_ranges PRIVATE cxx_std_14) 16 | if(FMT_HEADER_ONLY) 17 | target_link_libraries(test_ranges PRIVATE fmt::fmt-header-only) 18 | else() 19 | target_link_libraries(test_ranges PRIVATE fmt::fmt) 20 | endif() 21 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | using json = nlohmann::json; 6 | 7 | int main() { 8 | const json data = { 9 | {"pi", 3.141}, 10 | {"happy", true}, 11 | {"name", "Niels"}, 12 | {"nothing", nullptr}, 13 | {"answer", { 14 | {"everything", 42} 15 | }}, 16 | {"list", {1, 0, 2}}, 17 | {"object", { 18 | {"currency", "USD"}, 19 | {"value", 42.99} 20 | }} 21 | }; 22 | 23 | #if JSON_USE_IMPLICIT_CONVERSIONS 24 | float f = data["pi"]; 25 | #else 26 | auto f = data["pi"].get(); 27 | #endif 28 | std::cout << data.dump(4) << "\n"; 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /conan/packages/geos/test_package/test_package.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | void notice(const char *fmt, ...) { 8 | va_list ap; 9 | 10 | fprintf(stdout, "NOTICE: "); 11 | 12 | va_start(ap, fmt); 13 | vfprintf(stdout, fmt, ap); 14 | va_end(ap); 15 | fprintf(stdout, "\n"); 16 | } 17 | 18 | void log_and_exit(const char *fmt, ...) { 19 | va_list ap; 20 | 21 | fprintf(stdout, "ERROR: "); 22 | 23 | va_start(ap, fmt); 24 | vfprintf(stdout, fmt, ap); 25 | va_end(ap); 26 | fprintf(stdout, "\n"); 27 | exit(1); 28 | } 29 | 30 | int main() { 31 | initGEOS(notice, log_and_exit); 32 | printf("GEOS version %s\n", GEOSversion()); 33 | 34 | finishGEOS(); 35 | 36 | return EXIT_SUCCESS; 37 | } 38 | -------------------------------------------------------------------------------- /conan/conan_install_all.cmd: -------------------------------------------------------------------------------- 1 | conan install -if ../out/conan/x64-DLL-Debug -pr:h ./profiles/host_msvc_v193_crtdll.txt -pr:b ./profiles/build_msvc_v193_crtdll.txt --build=missing -s compiler.runtime=dynamic -s build_type=Debug .. 2 | conan install -if ../out/conan/x64-DLL-Release -pr:h ./profiles/host_msvc_v193_crtdll.txt -pr:b ./profiles/build_msvc_v193_crtdll.txt --build=missing -s compiler.runtime=dynamic -s build_type=Release .. 3 | conan install -if ../out/conan/x64-Static-Debug -pr:h ./profiles/host_msvc_v193_crtdll.txt -pr:b ./profiles/build_msvc_v193_crtdll.txt --build=missing -s compiler.runtime=static -s build_type=Debug .. 4 | conan install -if ../out/conan/x64-Static-Release -pr:h ./profiles/host_msvc_v193_crtdll.txt -pr:b ./profiles/build_msvc_v193_crtdll.txt --build=missing -s compiler.runtime=static -s build_type=Release .. 5 | -------------------------------------------------------------------------------- /conan/packages/xtl/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import CMake, cmake_layout 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" 10 | 11 | def requirements(self): 12 | self.requires(self.tested_reference_str) 13 | 14 | def layout(self): 15 | cmake_layout(self) 16 | 17 | def build(self): 18 | cmake = CMake(self) 19 | cmake.configure() 20 | cmake.build() 21 | 22 | def test(self): 23 | if can_run(self): 24 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 25 | self.run(bin_path, env="conanrun") 26 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from conan import ConanFile 4 | from conan.tools.build import can_run 5 | from conan.tools.cmake import CMake, cmake_layout 6 | 7 | 8 | class TestPackageConan(ConanFile): 9 | settings = "os", "compiler", "build_type", "arch" 10 | generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" 11 | test_type = "explicit" 12 | 13 | def requirements(self): 14 | self.requires(self.tested_reference_str) 15 | 16 | def layout(self): 17 | cmake_layout(self) 18 | 19 | def build(self): 20 | cmake = CMake(self) 21 | cmake.configure() 22 | cmake.build() 23 | 24 | def test(self): 25 | if can_run(self): 26 | self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") 27 | -------------------------------------------------------------------------------- /conan/packages/geos/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import CMake, cmake_layout 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" 10 | test_type = "explicit" 11 | 12 | def layout(self): 13 | cmake_layout(self) 14 | 15 | def requirements(self): 16 | self.requires(self.tested_reference_str) 17 | 18 | def build(self): 19 | cmake = CMake(self) 20 | cmake.configure() 21 | cmake.build() 22 | 23 | def test(self): 24 | if can_run(self): 25 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 26 | self.run(bin_path, env="conanrun") 27 | -------------------------------------------------------------------------------- /conan/packages/xtensor/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import CMake, cmake_layout 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" 10 | test_type = "explicit" 11 | 12 | def layout(self): 13 | cmake_layout(self) 14 | 15 | def requirements(self): 16 | self.requires(self.tested_reference_str) 17 | 18 | def build(self): 19 | cmake = CMake(self) 20 | cmake.configure() 21 | cmake.build() 22 | 23 | def test(self): 24 | if can_run(self): 25 | bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") 26 | self.run(bin_path, env="conanrun") 27 | -------------------------------------------------------------------------------- /conan/scripts/conan_build_and_cache_bin_packages.cmd: -------------------------------------------------------------------------------- 1 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -s compiler.runtime=static -s build_type=Debug %RECIPE% %PACKAGE%/%VERSION%@ 2 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -s compiler.runtime=static -s build_type=Release %RECIPE% %PACKAGE%/%VERSION%@ 3 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -s compiler.runtime=dynamic -s build_type=Debug %RECIPE% %PACKAGE%/%VERSION%@ 4 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -s compiler.runtime=dynamic -s build_type=Release %RECIPE% %PACKAGE%/%VERSION%@ 5 | -------------------------------------------------------------------------------- /conan/packages/xtensor/patches/0.23.9-cxx11-abi.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp 2 | index 85d8d18..fe3d0f6 100644 3 | --- a/include/xtensor/xutils.hpp 4 | +++ b/include/xtensor/xutils.hpp 5 | @@ -638,11 +638,16 @@ namespace xt 6 | * xtrivial_default_construct implemenation * 7 | ********************************************/ 8 | 9 | +#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 7 10 | +// has_trivial_default_constructor has not been available since libstdc++-7. 11 | +#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 12 | +#else 13 | #if defined(_GLIBCXX_USE_CXX11_ABI) 14 | #if _GLIBCXX_USE_CXX11_ABI || (defined(_GLIBCXX_USE_DUAL_ABI) && !_GLIBCXX_USE_DUAL_ABI) 15 | #define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 16 | #endif 17 | #endif 18 | +#endif 19 | 20 | #if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(XTENSOR_GLIBCXX_USE_CXX11_ABI) 21 | 22 | -------------------------------------------------------------------------------- /conan/scripts/conan_build_and_cache_bin_shared_packages.cmd: -------------------------------------------------------------------------------- 1 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -o shared=%SHARED% -s compiler.runtime=dynamic -s build_type=Debug %RECIPE% %PACKAGE%/%VERSION%@ 2 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -o shared=%SHARED% -s compiler.runtime=dynamic -s build_type=Release %RECIPE% %PACKAGE%/%VERSION%@ 3 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -o shared=%SHARED% -s compiler.runtime=static -s build_type=Debug %RECIPE% %PACKAGE%/%VERSION%@ 4 | conan create -pr:h=..\..\profiles\host_msvc_v193_crtdll.txt -pr:b=..\..\profiles\build_msvc_v193_crtdll.txt --test-folder None -o shared=%SHARED% -s compiler.runtime=static -s build_type=Release %RECIPE% %PACKAGE%/%VERSION%@ 5 | -------------------------------------------------------------------------------- /src/common/json_proxy.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | using json = nlohmann::ordered_json; 17 | -------------------------------------------------------------------------------- /conan/packages/xtensor/patches/0.21.5-cxx11-abi.patch: -------------------------------------------------------------------------------- 1 | diff --git a/include/xtensor/xutils.hpp b/include/xtensor/xutils.hpp 2 | index 5a3f31b..1e99c9b 100644 3 | --- a/include/xtensor/xutils.hpp 4 | +++ b/include/xtensor/xutils.hpp 5 | @@ -612,12 +612,16 @@ namespace xt 6 | /******************************************** 7 | * xtrivial_default_construct implemenation * 8 | ********************************************/ 9 | - 10 | +#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 7 11 | +// has_trivial_default_constructor has not been available since libstdc++-7. 12 | +#define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 13 | +#else 14 | #if defined(_GLIBCXX_USE_CXX11_ABI) 15 | #if _GLIBCXX_USE_CXX11_ABI || (defined(_GLIBCXX_USE_DUAL_ABI) && !_GLIBCXX_USE_DUAL_ABI) 16 | #define XTENSOR_GLIBCXX_USE_CXX11_ABI 1 17 | #endif 18 | #endif 19 | +#endif 20 | 21 | #if !defined(__GNUG__) || defined(_LIBCPP_VERSION) || defined(XTENSOR_GLIBCXX_USE_CXX11_ABI) 22 | 23 | -------------------------------------------------------------------------------- /conan/packages/openvr/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "2.5.1": 3 | url: "https://github.com/ValveSoftware/openvr/archive/refs/tags/v2.5.1.tar.gz" 4 | sha256: "54f654fce001682d8ac608f544a6c41e03a672b005c1deca3579fa36480a537c" 5 | "2.2.3": 6 | url: "https://github.com/ValveSoftware/openvr/archive/refs/tags/v2.2.3.tar.gz" 7 | sha256: "4da20c2c33e7488703802eafd7f2e6c92dd0f324e887711e1e11e9b9d3dd3daa" 8 | "1.26.7": 9 | url: "https://github.com/ValveSoftware/openvr/archive/refs/tags/v1.26.7.tar.gz" 10 | sha256: "e7391f1129db777b2754f5b017cfa356d7811a7bcaf57f09805b47c2e630a725" 11 | patches: 12 | "2.5.1": 13 | - patch_file: "patches/2.5.1/0001-Changes-for-local-build-v2.5.1.patch" 14 | "2.2.3": 15 | - patch_file: "patches/2.2.3/0001-Changes-for-local-build.patch" 16 | "1.26.7": 17 | - patch_file: "patches/1.26.7/0001-openvr-Public-API-fix-for-C-unity-vrshared_double-do.patch" 18 | - patch_file: "patches/1.26.7/0002-Changes-for-local-build-for-v1.26.7.patch" 19 | -------------------------------------------------------------------------------- /conan/packages/botan/patches/fix-amalgamation-build.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp b/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp 2 | index c7f1914a3..620b83eaa 100644 3 | --- a/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp 4 | +++ b/src/lib/hash/sha3/sha3_bmi2/sha3_bmi2.cpp 5 | @@ -28,7 +28,7 @@ namespace { 6 | #endif 7 | 8 | BOTAN_WORKAROUND_MAYBE_INLINE std::tuple 9 | - xor_CNs(const uint64_t A[25]) 10 | + xor_CNs_BMI2(const uint64_t A[25]) 11 | { 12 | return { 13 | A[0] ^ A[5] ^ A[10] ^ A[15] ^ A[20], 14 | @@ -42,7 +42,7 @@ BOTAN_WORKAROUND_MAYBE_INLINE std::tuple(std::get<0>(Cs)) ^ std::get<3>(Cs); 22 | const uint64_t D1 = rotl<1>(std::get<1>(Cs)) ^ std::get<4>(Cs); 23 | -------------------------------------------------------------------------------- /conan/packages/botan/patches/backport-getrandom-via-syscall-to-3.0.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp 2 | index 8a24ed9f6..45af0c507 100644 3 | --- a/src/lib/rng/system_rng/system_rng.cpp 4 | +++ b/src/lib/rng/system_rng/system_rng.cpp 5 | @@ -25,6 +25,7 @@ 6 | #include 7 | #elif defined(BOTAN_TARGET_OS_HAS_GETRANDOM) 8 | #include 9 | + #include 10 | #include 11 | #elif defined(BOTAN_TARGET_OS_HAS_DEV_RANDOM) 12 | #include 13 | @@ -216,7 +217,11 @@ class System_RNG_Impl final : public RandomNumberGenerator 14 | size_t len = output.size(); 15 | while(len > 0) 16 | { 17 | +#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 25 18 | + const ssize_t got = ::syscall(SYS_getrandom, buf, len, flags); 19 | +#else 20 | const ssize_t got = ::getrandom(buf, len, flags); 21 | +#endif 22 | 23 | if(got < 0) 24 | { 25 | -------------------------------------------------------------------------------- /conan/packages/botan/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "3.7.1": 3 | url: "https://github.com/randombit/botan/archive/3.7.1.tar.gz" 4 | sha256: "8d2a072c7cdca6cadd16f89bb966fce1b3ec77cb4614bf1d87dec1337a3d2330" 5 | "3.6.1": 6 | url: "https://github.com/randombit/botan/archive/3.6.1.tar.gz" 7 | sha256: "a6c4e8dcb6c7f4b9b67e2c8b43069d65b548970ca17847e3b1e031d3ffdd874a" 8 | "3.5.0": 9 | url: "https://github.com/randombit/botan/archive/3.5.0.tar.gz" 10 | sha256: "7d91d3349e6029e1a6929a50ab587f9fd4e29a9af3f3d698553451365564001f" 11 | "3.4.0": 12 | url: "https://github.com/randombit/botan/archive/3.4.0.tar.gz" 13 | sha256: "6ef2a16a0527b1cfc9648a644877f7b95c4d07e8ef237273b030c623418c5e5b" 14 | "3.3.0": 15 | url: "https://github.com/randombit/botan/archive/3.3.0.tar.gz" 16 | sha256: "57fefda7b9ab6f8409329620cdaf26d2d7e962b6a10eb321d331e9ecb796f804" 17 | "2.19.5": 18 | url: "https://github.com/randombit/botan/archive/2.19.5.tar.gz" 19 | sha256: "8d4a3826787f9febbdc225172ad2d39d7d3960346c5721fe46cb27d480d7e1de" 20 | -------------------------------------------------------------------------------- /cmake/build.cmake: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2025, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | string (TIMESTAMP BUILD_TIMESTAMP "%Y-%m-%d %H:%M:%S") 13 | message (STATUS "BUILD_TIMESTAMP = ${BUILD_TIMESTAMP}") 14 | 15 | string (TIMESTAMP BUILD_YEAR "%Y") 16 | message (STATUS "BUILD_YEAR = ${BUILD_YEAR}") 17 | 18 | -------------------------------------------------------------------------------- /conan/packages/catch2/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "3.8.1": 3 | url: "https://github.com/catchorg/Catch2/archive/v3.8.1.tar.gz" 4 | sha256: "18b3f70ac80fccc340d8c6ff0f339b2ae64944782f8d2fca2bd705cf47cadb79" 5 | "3.8.0": 6 | url: "https://github.com/catchorg/Catch2/archive/v3.8.0.tar.gz" 7 | sha256: "1ab2de20460d4641553addfdfe6acd4109d871d5531f8f519a52ea4926303087" 8 | "3.7.1": 9 | url: "https://github.com/catchorg/Catch2/archive/v3.7.1.tar.gz" 10 | sha256: "c991b247a1a0d7bb9c39aa35faf0fe9e19764213f28ffba3109388e62ee0269c" 11 | "3.6.0": 12 | url: "https://github.com/catchorg/Catch2/archive/v3.6.0.tar.gz" 13 | sha256: "485932259a75c7c6b72d4b874242c489ea5155d17efa345eb8cc72159f49f356" 14 | "3.5.4": 15 | url: "https://github.com/catchorg/Catch2/archive/v3.5.4.tar.gz" 16 | sha256: "b7754b711242c167d8f60b890695347f90a1ebc95949a045385114165d606dbb" 17 | "3.4.0": 18 | url: "https://github.com/catchorg/Catch2/archive/v3.4.0.tar.gz" 19 | sha256: "122928b814b75717316c71af69bd2b43387643ba076a6ec16e7882bfb2dfacbb" 20 | -------------------------------------------------------------------------------- /conan/packages/botan/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import cmake_layout, CMake 4 | from conan.tools.microsoft import is_msvc, VCVars 5 | import os 6 | 7 | 8 | class TestPackageConan(ConanFile): 9 | settings = "os", "arch", "compiler", "build_type" 10 | generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" 11 | test_type = "explicit" 12 | 13 | def requirements(self): 14 | self.requires(self.tested_reference_str) 15 | 16 | def layout(self): 17 | cmake_layout(self) 18 | 19 | def generate(self): 20 | if is_msvc(self): 21 | ms = VCVars(self) 22 | ms.generate() 23 | 24 | def build(self): 25 | cmake = CMake(self) 26 | cmake.configure() 27 | cmake.build() 28 | 29 | def test(self): 30 | if can_run(self): 31 | bin_path = os.path.join(self.build_folder, self.cpp.build.bindirs[0], "test_package") 32 | self.run(bin_path, env="conanrun") 33 | -------------------------------------------------------------------------------- /conan/packages/botan/patches/backport-getrandom-via-syscall-to-3.1.0.patch: -------------------------------------------------------------------------------- 1 | diff --git a/src/lib/rng/system_rng/system_rng.cpp b/src/lib/rng/system_rng/system_rng.cpp 2 | index b42ea5543..dcff78931 100644 3 | --- a/src/lib/rng/system_rng/system_rng.cpp 4 | +++ b/src/lib/rng/system_rng/system_rng.cpp 5 | @@ -26,6 +26,7 @@ 6 | #elif defined(BOTAN_TARGET_OS_HAS_GETRANDOM) 7 | #include 8 | #include 9 | + #include 10 | #elif defined(BOTAN_TARGET_OS_HAS_DEV_RANDOM) 11 | #include 12 | #include 13 | @@ -211,7 +212,11 @@ class System_RNG_Impl final : public RandomNumberGenerator { 14 | uint8_t* buf = output.data(); 15 | size_t len = output.size(); 16 | while(len > 0) { 17 | + #if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 25 18 | + const ssize_t got = ::syscall(SYS_getrandom, buf, len, flags); 19 | + #else 20 | const ssize_t got = ::getrandom(buf, len, flags); 21 | + #endif 22 | 23 | if(got < 0) { 24 | if(errno == EINTR) { 25 | -------------------------------------------------------------------------------- /conan/packages/catch2/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import can_run 3 | from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout 4 | import os 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "arch", "compiler", "build_type" 9 | generators = "CMakeDeps", "VirtualRunEnv" 10 | test_type = "explicit" 11 | 12 | def layout(self): 13 | cmake_layout(self) 14 | 15 | def requirements(self): 16 | self.requires(self.tested_reference_str) 17 | 18 | def generate(self): 19 | tc = CMakeToolchain(self) 20 | tc.variables["WITH_PREFIX"] = self.dependencies[self.tested_reference_str].options.with_prefix 21 | tc.generate() 22 | 23 | def build(self): 24 | cmake = CMake(self) 25 | cmake.configure() 26 | cmake.build() 27 | 28 | def test(self): 29 | if can_run(self): 30 | self.run(os.path.join(self.cpp.build.bindirs[0], "standalone"), env="conanrun") 31 | self.run(os.path.join(self.cpp.build.bindirs[0], "benchmark"), env="conanrun") 32 | -------------------------------------------------------------------------------- /conan/packages/fmt/test_package/conanfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | from conan import ConanFile 3 | from conan.tools.build import can_run 4 | from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout 5 | 6 | 7 | class TestPackageConan(ConanFile): 8 | settings = "os", "compiler", "build_type", "arch" 9 | generators = "CMakeDeps", "VirtualRunEnv" 10 | test_type = "explicit" 11 | 12 | def layout(self): 13 | cmake_layout(self) 14 | 15 | def requirements(self): 16 | self.requires(self.tested_reference_str) 17 | 18 | def generate(self): 19 | tc = CMakeToolchain(self) 20 | tc.variables["FMT_HEADER_ONLY"] = self.dependencies[self.tested_reference_str].options.header_only 21 | tc.generate() 22 | 23 | def build(self): 24 | cmake = CMake(self) 25 | cmake.configure() 26 | cmake.build() 27 | 28 | def test(self): 29 | if can_run(self): 30 | self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") 31 | self.run(os.path.join(self.cpp.build.bindirs[0], "test_ranges"), env="conanrun") 32 | -------------------------------------------------------------------------------- /src/hmdv/hmdfix.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | // functions 17 | //------------------------------------------------------------------------------ 18 | // Check and run all fixes (return true if there was any) 19 | bool apply_all_relevant_fixes(json& jd); 20 | -------------------------------------------------------------------------------- /src/common/verhlp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | // functions 17 | //------------------------------------------------------------------------------ 18 | // Compare two versions `va` and `vb`. 19 | // Return: 20 | // -1 : va < vb 21 | // 0 : va == vb 22 | // 1 : va > vb 23 | int comp_ver(const std::string& va, const std::string& vb); 24 | -------------------------------------------------------------------------------- /src/common/oculus_config.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace oculus { 17 | 18 | // OculusVR Config class (default config) 19 | //------------------------------------------------------------------------------ 20 | class Config : public BaseVRConfig 21 | { 22 | public: 23 | Config(); 24 | }; 25 | 26 | } // namespace oculus 27 | -------------------------------------------------------------------------------- /src/common/openvr_config.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | namespace openvr { 17 | 18 | // OpenVR Config class (default config) 19 | //------------------------------------------------------------------------------ 20 | class Config : public BaseVRConfig 21 | { 22 | public: 23 | Config(); 24 | }; 25 | 26 | } // namespace openvr 27 | -------------------------------------------------------------------------------- /src/hmdq/res/hmdq_misc.h.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2025, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | // hmdq details 13 | constexpr int HMDQ_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@; 14 | constexpr int HMDQ_VERSION_MINOR = @PROJECT_VERSION_MINOR@; 15 | constexpr int HMDQ_VERSION_PATCH = @PROJECT_VERSION_PATCH@; 16 | constexpr const char* HMDQ_VERSION = "@PROJECT_VERSION@"; 17 | constexpr const char* HMDQ_DESCRIPTION = "@PROJECT_DESCRIPTION@"; 18 | constexpr const char* HMDQ_URL = "@PROJECT_HOMEPAGE_URL@"; 19 | constexpr const char* HMDQ_NAME = "@PROJECT_NAME@"; 20 | -------------------------------------------------------------------------------- /src/hmdv/res/hmdv_misc.h.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2025, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | // hmdv details 13 | constexpr int HMDV_VERSION_MAJOR = @PROJECT_VERSION_MAJOR@; 14 | constexpr int HMDV_VERSION_MINOR = @PROJECT_VERSION_MINOR@; 15 | constexpr int HMDV_VERSION_PATCH = @PROJECT_VERSION_PATCH@; 16 | constexpr const char* HMDV_VERSION = "@PROJECT_VERSION@"; 17 | constexpr const char* HMDV_DESCRIPTION = "@PROJECT_DESCRIPTION@"; 18 | constexpr const char* HMDV_URL = "@PROJECT_HOMEPAGE_URL@"; 19 | constexpr const char* HMDV_NAME = "@PROJECT_NAME@"; 20 | -------------------------------------------------------------------------------- /res/gitversion.h.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | constexpr const char* GIT_REPO_VERSION = "@GIT_REPO_VERSION@"; 13 | constexpr int GIT_REPO_VERSION_MAJOR = @GIT_REPO_VERSION_MAJOR@; 14 | constexpr int GIT_REPO_VERSION_MINOR = @GIT_REPO_VERSION_MINOR@; 15 | constexpr int GIT_REPO_VERSION_PATCH = @GIT_REPO_VERSION_PATCH@; 16 | constexpr int GIT_REPO_VERSION_NCOMM = @GIT_REPO_VERSION_NCOMM@; 17 | constexpr const char* GIT_REPO_VERSION_GHASH = "@GIT_REPO_VERSION_GHASH@"; 18 | constexpr bool GIT_REPO_VERSION_DIRTY = @GIT_REPO_VERSION_DIRTY@; 19 | -------------------------------------------------------------------------------- /src/common/config.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | // globals 21 | //------------------------------------------------------------------------------ 22 | extern json g_cfg; 23 | 24 | // functions 25 | //------------------------------------------------------------------------------ 26 | // Initialize config options either from the file or from the defaults. 27 | bool init_config(const std::filesystem::path& argv0, const cfgmap_t& cfgs); 28 | -------------------------------------------------------------------------------- /src/common/xtdef.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | // functions 18 | //------------------------------------------------------------------------------ 19 | // Build the 2D-array from std::vector of 1D-arrays. 20 | harray2d_t build_array(const hveclist_t& vecs) 21 | { 22 | // at least one vector should always be present 23 | HMDQ_ASSERT(vecs.size() > 0); 24 | harray2d_t res({vecs.size(), vecs[0].shape(0)}); 25 | for (size_t i = 0, e = vecs.size(); i < e; ++i) { 26 | xt::view(res, i) = vecs[i]; 27 | } 28 | return res; 29 | } 30 | -------------------------------------------------------------------------------- /src/common/fmthlp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | // These functions are attributed to vitaut@github as per this discussion 20 | // https://github.com/fmtlib/fmt/issues/1260 21 | template 22 | void iprint(int indent, fmt::format_string format_str, T&&... args) 23 | { 24 | fmt::print("{:{}}", "", indent); 25 | fmt::print(format_str, std::forward(args)...); 26 | } 27 | 28 | template 29 | void iprint(std::FILE* f, int indent, fmt::format_string format_str, T&&... args) 30 | { 31 | fmt::print(f, "{:{}}", "", indent); 32 | fmt::print(f, format_str, std::forward(args)...); 33 | } 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2019, Richard Musil. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of the copyright holder nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /res/misc.h.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | // Project details 13 | constexpr const char* TOOLS_VERSION = "@PROJECT_VERSION@"; 14 | 15 | // Host system and toolchain ids 16 | constexpr const char* CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@"; 17 | constexpr const char* CXX_COMPILER_VERSION = "@CMAKE_CXX_COMPILER_VERSION@"; 18 | constexpr const char* CXX_COMPILER_ARCHITECTURE_ID = "@CMAKE_CXX_COMPILER_ARCHITECTURE_ID@"; 19 | constexpr const char* HOST_SYSTEM = "@CMAKE_HOST_SYSTEM@"; 20 | constexpr const char* HOST_SYSTEM_NAME = "@CMAKE_HOST_SYSTEM_NAME@"; 21 | constexpr const char* HOST_SYSTEM_PROCESSOR = "@CMAKE_HOST_SYSTEM_PROCESSOR@"; 22 | constexpr const char* HOST_SYSTEM_VERSION = "@CMAKE_HOST_SYSTEM_VERSION@"; 23 | 24 | // Build attributes 25 | constexpr const char* BUILD_TIMESTAMP = "@BUILD_TIMESTAMP@"; 26 | constexpr const char* BUILD_YEAR = "@BUILD_YEAR@"; 27 | -------------------------------------------------------------------------------- /src/common/jkeys.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | // Print friendly names for keys 18 | //------------------------------------------------------------------------------ 19 | const std::map j_key2pretty = {{j_max_fov, "Maximum FOV"}, 20 | {j_default_fov, "Default FOV"}, 21 | {j_oculus, "Oculus"}, 22 | {j_openvr, "OpenVR"}}; 23 | 24 | const std::string& get_jkey_pretty(const std::string& jkey) 25 | { 26 | const auto iter = j_key2pretty.find(jkey); 27 | if (iter != j_key2pretty.cend()) { 28 | return iter->second; 29 | } else { 30 | return jkey; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /conan/packages/xtensor/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "0.26.0": 3 | url: "https://github.com/xtensor-stack/xtensor/archive/0.26.0.tar.gz" 4 | sha256: "f5f42267d850f781d71097b50567a480a82cd6875a5ec3e6238555e0ef987dc6" 5 | "0.25.0": 6 | url: "https://github.com/xtensor-stack/xtensor/archive/0.25.0.tar.gz" 7 | sha256: "32d5d9fd23998c57e746c375a544edf544b74f0a18ad6bc3c38cbba968d5e6c7" 8 | "0.24.7": 9 | url: "https://github.com/xtensor-stack/xtensor/archive/0.24.7.tar.gz" 10 | sha256: "0fbbd524dde2199b731b6af99b16063780de6cf1d0d6cb1f3f4d4ceb318f3106" 11 | "0.24.6": 12 | url: "https://github.com/xtensor-stack/xtensor/archive/0.24.6.tar.gz" 13 | sha256: "f87259b51aabafdd1183947747edfff4cff75d55375334f2e81cee6dc68ef655" 14 | "0.23.10": 15 | url: "https://github.com/xtensor-stack/xtensor/archive/0.23.10.tar.gz" 16 | sha256: "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c" 17 | "0.21.5": 18 | url: "https://github.com/xtensor-stack/xtensor/archive/0.21.5.tar.gz" 19 | sha256: "30cb896b6686683ddaefb12c98bf1109fdfe666136dd027aba1a1e9aa825c241" 20 | patches: 21 | "0.23.10": 22 | - patch_file: "patches/0.23.9-cxx11-abi.patch" 23 | patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" 24 | patch_type: "bugfix" 25 | patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" 26 | "0.21.5": 27 | - patch_file: "patches/0.21.5-cxx11-abi.patch" 28 | patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" 29 | patch_type: "bugfix" 30 | patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" 31 | -------------------------------------------------------------------------------- /conan/packages/geos/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "3.13.1": 3 | url: "https://github.com/libgeos/geos/releases/download/3.13.1/geos-3.13.1.tar.bz2" 4 | sha256: "df2c50503295f325e7c8d7b783aca8ba4773919cde984193850cf9e361dfd28c" 5 | "3.13.0": 6 | url: "https://github.com/libgeos/geos/releases/download/3.13.0/geos-3.13.0.tar.bz2" 7 | sha256: "47ec83ff334d672b9e4426695f15da6e6368244214971fabf386ff8ef6df39e4" 8 | "3.12.2": 9 | url: "https://github.com/libgeos/geos/releases/download/3.12.2/geos-3.12.2.tar.bz2" 10 | sha256: "34c7770bf0090ee88488af98767d08e779f124fa33437e0aabec8abd4609fec6" 11 | "3.12.0": 12 | url: "https://github.com/libgeos/geos/releases/download/3.12.0/geos-3.12.0.tar.bz2" 13 | sha256: "d96db96011259178a35555a0f6d6e75a739e52a495a6b2aa5efb3d75390fbc39" 14 | "3.11.2": 15 | url: "https://github.com/libgeos/geos/releases/download/3.11.2/geos-3.11.2.tar.bz2" 16 | sha256: "b1f077669481c5a3e62affc49e96eb06f281987a5d36fdab225217e5b825e4cc" 17 | "3.11.1": 18 | url: "https://github.com/libgeos/geos/releases/download/3.11.1/geos-3.11.1.tar.bz2" 19 | sha256: "be83ed195ffb82373710c90befc580911ea0eb57003a2d703e30101c5b262f62" 20 | "3.11.0": 21 | url: "https://github.com/libgeos/geos/releases/download/3.11.0/geos-3.11.0.tar.bz2" 22 | sha256: "79ab8cabf4aa8604d161557b52e3e4d84575acdc0d08cb09ab3f7aaefa4d858a" 23 | "3.10.3": 24 | url: "https://download.osgeo.org/geos/geos-3.10.3.tar.bz2" 25 | sha256: "3c141b07d61958a758345d5f54e3c735834b2f4303edb9f67fb26914f0d44770" 26 | "3.10.2": 27 | url: "https://download.osgeo.org/geos/geos-3.10.2.tar.bz2" 28 | sha256: "50bbc599ac386b4c2b3962dcc411f0040a61f204aaef4eba7225ecdd0cf45715" 29 | -------------------------------------------------------------------------------- /src/common/prtstl.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | // template functions 18 | //------------------------------------------------------------------------------ 19 | // Write std::pair to stdout 20 | template 21 | std::ostream& operator<<(std::ostream& os, const std::pair& input) 22 | { 23 | os << "{" << input.first << ", " << input.second << "}"; 24 | return os; 25 | } 26 | 27 | template 28 | // Write std::vector to stdout 29 | std::ostream& operator<<(std::ostream& os, const std::vector& input) 30 | { 31 | os << "{"; 32 | bool more = false; 33 | for (auto const& i : input) { 34 | if (more) 35 | os << ", "; 36 | else 37 | more = true; 38 | os << i; 39 | } 40 | os << "}"; 41 | return os; 42 | } 43 | -------------------------------------------------------------------------------- /conan/packages/fmt/test_package/test_package.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | 15 | void vreport(const char *format, fmt::format_args args) { 16 | fmt::vprint(format, args); 17 | } 18 | 19 | template 20 | void report(const char *format, const Args & ... args) { 21 | vreport(format, fmt::make_format_args(args...)); 22 | } 23 | 24 | class Date { 25 | int year_, month_, day_; 26 | public: 27 | Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} 28 | 29 | friend std::ostream &operator<<(std::ostream &os, const Date &d) { 30 | return os << d.year_ << '-' << d.month_ << '-' << d.day_; 31 | } 32 | }; 33 | 34 | #if FMT_VERSION >= 90000 35 | namespace fmt { 36 | template <> struct formatter : ostream_formatter {}; 37 | } 38 | #endif 39 | 40 | int main() { 41 | const std::string thing("World"); 42 | fmt::print("PRINT: Hello {}!\n", thing); 43 | 44 | const std::string formatted = fmt::format("{0}{1}{0}", "abra", "cad"); 45 | fmt::print("{}\n", formatted); 46 | 47 | fmt::memory_buffer buf; 48 | fmt::format_to(std::back_inserter(buf), "{}", 2.7182818); 49 | fmt::print("Euler number: {}\n", fmt::to_string(buf)); 50 | 51 | fmt::print("The date is {}\n", Date(2012, 12, 9)); 52 | 53 | report("{} {} {}\n", "Conan", 42, 3.14159); 54 | 55 | fmt::print(std::cout, "{} {}\n", "Magic number", 42); 56 | 57 | fmt::print(fg(fmt::color::aqua), "Bincrafters\n"); 58 | 59 | return EXIT_SUCCESS; 60 | } 61 | -------------------------------------------------------------------------------- /src/hmdq_test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.15) 13 | 14 | include(utils) 15 | 16 | # Project def 17 | # ============ 18 | project (hmdq_test 19 | DESCRIPTION "Unit tests for hmdq tool" 20 | ) 21 | 22 | # Dependencies 23 | # ============ 24 | find_package (fmt REQUIRED) 25 | find_package (xtensor REQUIRED) 26 | find_package (Eigen3 REQUIRED) 27 | find_package (geos REQUIRED) 28 | find_package (Catch2 REQUIRED) 29 | 30 | set (hmdq_dir ../hmdq) 31 | set (hmdv_dir ../hmdv) 32 | 33 | set (hmdq_test_SOURCES 34 | geom_test.cpp # this one defines main 35 | optmesh_test.cpp 36 | verhlp_test.cpp 37 | geos_test.cpp 38 | ) 39 | 40 | # Add unity tests 41 | add_executable (hmdq_test ${hmdq_test_SOURCES}) 42 | 43 | target_link_libraries (hmdq_test PRIVATE build_proxy hmdq_common) 44 | target_link_libraries (hmdq_test PRIVATE fmt::fmt Catch2::Catch2WithMain Eigen3::Eigen xtensor GEOS::geos) 45 | 46 | catch_discover_tests(hmdq_test) 47 | 48 | print_variables ("hmdq_test*") 49 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Custom files 2 | # ============ 3 | configure_file ( 4 | ${CMAKE_SOURCE_DIR}/res/misc.h.in 5 | ${CMAKE_BINARY_DIR}/res/misc.h 6 | ) 7 | 8 | # Global build defs (proxy target) 9 | # ================================ 10 | add_library (build_proxy INTERFACE) 11 | #target_compile_definitions (build_proxy INTERFACE XTENSOR_FORCE_TEMPORARY_MEMORY_IN_ASSIGNMENTS) 12 | target_compile_options (build_proxy INTERFACE /Zc:inline /Zc:__cplusplus /utf-8) 13 | # turn on linker optimization back on in RelWithDebInfo config 14 | target_link_options (build_proxy INTERFACE $<$>:/INCREMENTAL:NO /OPT:REF /OPT:ICF>) 15 | target_include_directories (build_proxy INTERFACE 16 | "$" 17 | "$" 18 | ) 19 | target_include_directories (build_proxy INTERFACE ${CMAKE_BINARY_DIR}/res) 20 | 21 | if (DEBUG_INFO) 22 | target_compile_options (build_proxy /Zi) 23 | target_link_options (/DEBUG) 24 | endif() 25 | 26 | # LibOVR stub (proxy target) 27 | # ========================== 28 | # set the path to OVR_SDK 29 | if (NOT OVR_SDK) 30 | set (OVR_SDK $ENV{OVR_SDK}) 31 | endif() 32 | 33 | if (OVR_SDK) 34 | add_library (LibOVR INTERFACE) 35 | target_compile_definitions (LibOVR INTERFACE OVR_SDK=${OVR_SDK}) 36 | target_include_directories (LibOVR INTERFACE ${OVR_SDK}/LibOVR/Include) 37 | target_link_directories (LibOVR INTERFACE ${OVR_SDK}/LibOVR/Lib/Windows/x64/Release/VS2017) 38 | target_link_libraries (LibOVR INTERFACE LibOVR.lib) 39 | endif() 40 | 41 | # Include sub-projects 42 | # ==================== 43 | add_subdirectory ("common") 44 | add_subdirectory ("hmdq") 45 | add_subdirectory ("hmdv") 46 | 47 | if (BUILD_TESTS) 48 | add_subdirectory ("hmdq_test") 49 | endif (BUILD_TESTS) 50 | 51 | -------------------------------------------------------------------------------- /conan/packages/xtl/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "0.8.0": 3 | url: "https://github.com/xtensor-stack/xtl/archive/0.8.0.tar.gz" 4 | sha256: "ee38153b7dd0ec84cee3361f5488a4e7e6ddd26392612ac8821cbc76e740273a" 5 | "0.7.6": 6 | url: "https://github.com/xtensor-stack/xtl/archive/0.7.6.tar.gz" 7 | sha256: "dda442dc81f390f77561913062471c39b6ef19ffc6f64d3cd12b5c4b4607c957" 8 | "0.7.5": 9 | url: "https://github.com/xtensor-stack/xtl/archive/0.7.5.tar.gz" 10 | sha256: "3286fef5fee5d58f82f7b91375cd449c819848584bae9367893501114d923cbe" 11 | "0.7.4": 12 | url: "https://github.com/xtensor-stack/xtl/archive/0.7.4.tar.gz" 13 | sha256: "3c88be0e696b64150c4de7a70f9f09c00a335186b0b0b409771ef9f56bca7d9a" 14 | "0.7.3": 15 | url: "https://github.com/xtensor-stack/xtl/archive/0.7.3.tar.gz" 16 | sha256: "f4a81e3c9ca9ddb42bd4373967d4859ecfdca1aba60b9fa6ced6c84d8b9824ff" 17 | "0.7.2": 18 | url: "https://github.com/xtensor-stack/xtl/archive/0.7.2.tar.gz" 19 | sha256: "95c221bdc6eaba592878090916383e5b9390a076828552256693d5d97f78357c" 20 | "0.6.21": 21 | url: "https://github.com/xtensor-stack/xtl/archive/0.6.21.tar.gz" 22 | sha256: "97137014fa5da2a3598a267d06c8e28490b2e1c75b8f52358738bedb526fc771" 23 | "0.6.12": 24 | url: "https://github.com/xtensor-stack/xtl/archive/0.6.12.tar.gz" 25 | sha256: "25a16958195f939e6fb7c8feccad89b3e450a18124be6aee119c69a1ee2b308c" 26 | "0.6.11": 27 | url: "https://github.com/xtensor-stack/xtl/archive/0.6.11.tar.gz" 28 | sha256: "e3cb622def174b76547c29ce0d63ae1407ed19fcbbd233913613e9859568eadd" 29 | "0.6.10": 30 | url: "https://github.com/xtensor-stack/xtl/archive/0.6.10.tar.gz" 31 | sha256: "9de012e06a6c24561b2c50cf7650cb32ffcf2c22f73b0314deeba9c775e5036f" 32 | "0.6.9": 33 | url: "https://github.com/xtensor-stack/xtl/archive/0.6.9.tar.gz" 34 | sha256: "c348fcf53dd2b355d143ad28e77f1ede7e1d5e6a196d2d5b9c478b1c005dedd0" 35 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.build import check_min_cppstd 3 | from conan.tools.files import copy, get 4 | from conan.tools.layout import basic_layout 5 | import os 6 | 7 | required_conan_version = ">=1.50.0" 8 | 9 | 10 | class NlohmannJsonConan(ConanFile): 11 | name = "nlohmann_json" 12 | homepage = "https://github.com/nlohmann/json" 13 | description = "JSON for Modern C++ parser and generator." 14 | topics = "json", "header-only" 15 | url = "https://github.com/conan-io/conan-center-index" 16 | license = "MIT" 17 | package_type = "header-library" 18 | settings = "os", "arch", "compiler", "build_type" 19 | no_copy_source = True 20 | 21 | @property 22 | def _minimum_cpp_standard(self): 23 | return 11 24 | 25 | def layout(self): 26 | basic_layout(self, src_folder="src") 27 | 28 | def package_id(self): 29 | self.info.clear() 30 | 31 | def validate(self): 32 | if self.settings.compiler.cppstd: 33 | check_min_cppstd(self, self._minimum_cpp_standard) 34 | 35 | def source(self): 36 | get(self, **self.conan_data["sources"][self.version], strip_root=True) 37 | 38 | def generate(self): 39 | pass 40 | 41 | def build(self): 42 | pass 43 | 44 | def package(self): 45 | copy(self, "LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) 46 | copy(self, "*", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) 47 | 48 | def package_info(self): 49 | self.cpp_info.set_property("cmake_file_name", "nlohmann_json") 50 | self.cpp_info.set_property("cmake_target_name", "nlohmann_json::nlohmann_json") 51 | self.cpp_info.set_property("pkg_config_name", "nlohmann_json") 52 | self.cpp_info.bindirs = [] 53 | self.cpp_info.libdirs = [] 54 | -------------------------------------------------------------------------------- /src/common/oculus_processor.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | namespace oculus { 22 | 23 | // OculusVR Processor class 24 | //------------------------------------------------------------------------------ 25 | class Processor : public BaseVRProcessor 26 | { 27 | public: 28 | Processor(const std::shared_ptr& pjdata) 29 | : BaseVRProcessor(j_oculus, pjdata) 30 | {} 31 | 32 | public: 33 | // Initialize the processor 34 | virtual bool init() override; 35 | // Calculate complementary data 36 | virtual void calculate() override; 37 | // Anonymize sensitive data 38 | virtual void anonymize() override; 39 | // Print the collected data 40 | // mode: props, geom, all 41 | // verb: verbosity 42 | // ind: indentation 43 | // ts: indent (tab) size 44 | virtual void print(const print_options& opts, int ind, int ts) const override; 45 | // Clean up the data before saving 46 | virtual void purge() override; 47 | }; 48 | 49 | } // namespace oculus 50 | -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.15) 13 | 14 | # Dependencies 15 | # ============ 16 | find_package (fmt REQUIRED) 17 | find_package (nlohmann_json REQUIRED) 18 | find_package (xtensor REQUIRED) 19 | find_package (Eigen3 REQUIRED) 20 | find_package (openvr REQUIRED) 21 | find_package (botan REQUIRED) 22 | find_package (geos REQUIRED) 23 | 24 | # Targets 25 | # ============ 26 | set (hmdq_common_SOURCES 27 | base_common.cpp 28 | calcview.cpp 29 | config.cpp 30 | geom.cpp 31 | geom2.cpp 32 | jtools.cpp 33 | jkeys.cpp 34 | openvr_common.cpp 35 | openvr_config.cpp 36 | openvr_processor.cpp 37 | oculus_common.cpp 38 | oculus_config.cpp 39 | oculus_processor.cpp 40 | optmesh.cpp 41 | prtdata.cpp 42 | verhlp.cpp 43 | wintools.cpp 44 | xtdef.cpp 45 | ) 46 | 47 | # Add sources to `hmdq` executable. 48 | add_library (hmdq_common STATIC ${hmdq_common_SOURCES}) 49 | target_link_libraries (hmdq_common PUBLIC build_proxy) 50 | target_link_libraries (hmdq_common PUBLIC 51 | fmt::fmt 52 | nlohmann_json::nlohmann_json 53 | xtensor 54 | Eigen3::Eigen 55 | openvr::openvr 56 | botan::botan 57 | GEOS::geos 58 | LibOVR 59 | ) 60 | -------------------------------------------------------------------------------- /src/common/calcview.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | // functions 18 | //------------------------------------------------------------------------------ 19 | // load or build verts and faces from recorded data 20 | std::tuple calc_resolve_verts_and_faces(const json& ham_mesh); 21 | 22 | // Calculate optimized HAM mesh topology 23 | json calc_opt_ham_mesh(const json& ham_mesh); 24 | 25 | // Calculate HAM area 26 | double calc_ham_area(const json& ham_mesh); 27 | 28 | // Calculate partial FOVs for the projection (new version). 29 | json calc_fov(const json& raw, const json& mesh, const harray2d_t* rot = nullptr); 30 | 31 | // Calculate total FOV, vertical, horizontal and diagonal. 32 | json calc_total_fov(const json& fov_head); 33 | 34 | // Calculate the angle of the canted views and the IPD from eye to head transformation 35 | // matrices. 36 | json calc_view_geom(const json& e2h); 37 | 38 | // Calculate the additional data in the geometry data object (json) 39 | json calc_geometry(const json& jd); 40 | 41 | // Do sanity check on geometry data (Quest 2 - firmware major 10579) 42 | // Augment the JSON data with the error code if one is found. 43 | bool geometry_sanity_check(json& geom); 44 | -------------------------------------------------------------------------------- /conan/packages/clipp/conanfile.py: -------------------------------------------------------------------------------- 1 | import os 2 | import errno 3 | import stat 4 | import shutil 5 | from pathlib import Path 6 | from datetime import datetime 7 | 8 | from conan import ConanFile 9 | from conan.tools.scm import Git 10 | 11 | required_conan_version = ">=1.51.0" 12 | 13 | def handleRemoveReadonly(func, path, exc): 14 | excvalue = exc[1] 15 | if excvalue.errno == errno.EACCES: 16 | os.chmod(path, stat.S_IRWXU| stat.S_IRWXG| stat.S_IRWXO) # 0777 17 | func(path) 18 | else: 19 | raise 20 | 21 | class ClippConan(ConanFile): 22 | name = "clipp" 23 | description = "Command line interfaces for Modern C++" 24 | license = "MIT" 25 | topics = ("Windows", "c++") 26 | homepage = "https://github.com/risa2000/clipp" 27 | url = "https://github.com/risa2000/clipp" 28 | branch = "master" 29 | commit = "337f2264f240862bdc1eed3e9b0fc71107cacda8" 30 | exports_sources = "include/*" 31 | no_copy_source = True 32 | 33 | def _fix_isodatetime(self, tms): 34 | if len(tms) > 5 and (tms[-5] in ('+', '-')): 35 | return tms[:-2] + ':' + tms[-2:] 36 | 37 | def _get_commit_datetime(self): 38 | self.source() 39 | git = Git(self) 40 | return datetime.fromisoformat(self._fix_isodatetime(git.run(f'-C {self.branch} show -s --format="%ci" .'))) 41 | 42 | def set_version(self): 43 | commit_datetime = self._get_commit_datetime() 44 | self.version = f'cci.{commit_datetime:%Y%m%d}' 45 | 46 | def source(self): 47 | git = Git(self) 48 | if Path(self.branch).exists(): 49 | shutil.rmtree(self.branch, ignore_errors=False, onerror=handleRemoveReadonly) 50 | git.clone(url=self.url, target=self.branch) 51 | git.run(f"-C {self.branch} checkout {self.commit}") 52 | 53 | def layout(self): 54 | self.folders.source = self.branch 55 | 56 | def package(self): 57 | self.copy("LICENSE", src=self.folders.source, dst="licenses") 58 | self.copy("*.h", dst="include/clipp", src=os.path.join(self.folders.source, "include")) 59 | 60 | def package_id(self): 61 | self.info.clear() 62 | -------------------------------------------------------------------------------- /src/common/openvr_common.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace openvr { 24 | 25 | // typedefs 26 | //------------------------------------------------------------------------------ 27 | typedef std::vector> heyes_t; 28 | typedef std::vector hproplist_t; 29 | typedef std::pair hdevpair_t; 30 | typedef std::vector hdevlist_t; 31 | 32 | // globals 33 | //------------------------------------------------------------------------------ 34 | // Eye nomenclature 35 | extern const heyes_t EYES; 36 | 37 | // generic functions 38 | //------------------------------------------------------------------------------ 39 | // Return the version of the OpenVR API used in the build. 40 | std::tuple get_sdk_ver(); 41 | 42 | // Parse OpenVR JSON API definition, where jd = json.load("openvr_api.json") 43 | json parse_json_oapi(const json& jd); 44 | 45 | // Convert common property types to OpenVR property types 46 | vr::PropertyTypeTag_t ptype_to_ptag(basevr::PropType ptype); 47 | 48 | } // namespace openvr 49 | -------------------------------------------------------------------------------- /src/common/base_common.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | namespace basevr { 20 | 21 | // property types 22 | //------------------------------------------------------------------------------ 23 | // Use these enums to define common types used in VR subsystems 24 | enum class PropType : int { 25 | Invalid, 26 | 27 | Float, 28 | Double, 29 | 30 | Int16, 31 | Uint16, 32 | Int32, 33 | Uint32, 34 | Int64, 35 | Uint64, 36 | 37 | Bool, 38 | String, 39 | 40 | Vector2, 41 | Vector3, 42 | Vector4, 43 | 44 | Matrix33, 45 | Matrix34, 46 | Matrix44, 47 | 48 | Quaternion, 49 | 50 | Quad, 51 | }; 52 | 53 | // Generic functions. 54 | //------------------------------------------------------------------------------ 55 | // Return {, , , } 56 | std::tuple 57 | parse_prop_name(const std::string& pname); 58 | 59 | // Print functions. 60 | //------------------------------------------------------------------------------ 61 | // Print one property out (do not print PID < 0) 62 | void print_one_prop(const std::string& pname, const json& pval, int pid, 63 | const json& verb_props, int verb, int ind, int ts); 64 | 65 | } // namespace basevr 66 | -------------------------------------------------------------------------------- /conan/packages/openvr/patches/1.26.7/0001-openvr-Public-API-fix-for-C-unity-vrshared_double-do.patch: -------------------------------------------------------------------------------- 1 | From 5e45960cf44d6eb19bbadcae4a3d32578a380c17 Mon Sep 17 00:00:00 2001 2 | From: Aaron Leiby 3 | Date: Thu, 24 Aug 2023 16:06:12 -0800 4 | Subject: [PATCH 1/2] [openvr] Public API fix for C# (unity) (vrshared_double 5 | -> double) 6 | 7 | CLs 8 | 8290392 9 | 10 | Merging using vr_steamvr_rel_hotfix_to_sdk_release 11 | 12 | [git-p4: depot-paths = "//vr/steamvr/sdk_release/": change = 8291348] 13 | --- 14 | codegen/api_shared.py | 4 ++++ 15 | headers/openvr_api.cs | 10 +++++----- 16 | 2 files changed, 9 insertions(+), 5 deletions(-) 17 | 18 | diff --git a/codegen/api_shared.py b/codegen/api_shared.py 19 | index af064d6..2098054 100755 20 | --- a/codegen/api_shared.py 21 | +++ b/codegen/api_shared.py 22 | @@ -247,6 +247,10 @@ def converttype(thetype): 23 | thetype = 'int' 24 | if(thetype == 'WebConsoleHandle_t'): 25 | thetype = 'ulong' 26 | + if(thetype == 'vrshared_double'): 27 | + thetype = 'double' 28 | + if(thetype == 'vrshared_uint64_t'): 29 | + thetype = 'ulong' 30 | 31 | if(thetype[0:7] == 'struct '): 32 | thetype = thetype[7:] 33 | diff --git a/headers/openvr_api.cs b/headers/openvr_api.cs 34 | index a579471..2c3dfb9 100644 35 | --- a/headers/openvr_api.cs 36 | +++ b/headers/openvr_api.cs 37 | @@ -6480,11 +6480,11 @@ public enum EBlockQueueCreationFlag 38 | public uint m_nNumDroppedFramesTimedOut; 39 | public uint m_nNumReprojectedFramesTimedOut; 40 | public uint m_nNumFrameSubmits; 41 | - public vrshared_double m_flSumCompositorCPUTimeMS; 42 | - public vrshared_double m_flSumCompositorGPUTimeMS; 43 | - public vrshared_double m_flSumTargetFrameTimes; 44 | - public vrshared_double m_flSumApplicationCPUTimeMS; 45 | - public vrshared_double m_flSumApplicationGPUTimeMS; 46 | + public double m_flSumCompositorCPUTimeMS; 47 | + public double m_flSumCompositorGPUTimeMS; 48 | + public double m_flSumTargetFrameTimes; 49 | + public double m_flSumApplicationCPUTimeMS; 50 | + public double m_flSumApplicationGPUTimeMS; 51 | public uint m_nNumFramesWithDepth; 52 | } 53 | [StructLayout(LayoutKind.Sequential)] public struct Compositor_StageRenderSettings 54 | -- 55 | 2.40.0.windows.1 56 | 57 | -------------------------------------------------------------------------------- /src/common/prtdef.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | // globals 15 | //------------------------------------------------------------------------------ 16 | // Error reporting pre-defs 17 | constexpr const char* MSG_TYPE_NOT_IMPL = "{:s} type not implemented"; 18 | 19 | // Error message format 20 | constexpr const char* ERR_MSG_FMT_JSON = "[error: {:s}]\n"; 21 | constexpr const char* ERR_MSG_FMT_OUT = "Error: {:s}\n"; 22 | 23 | // typedefs 24 | //------------------------------------------------------------------------------ 25 | // print mode 26 | enum class pmode { geom, props, all }; 27 | 28 | // Command line options passed to the program 29 | struct print_options { 30 | print_options() 31 | : anonymize(false) 32 | , oculus(true) 33 | , openvr(true) 34 | , ovr_def_fov(true) 35 | , ovr_max_fov(false) 36 | , dbg_raw_in(false) 37 | , dbg_raw_out(false) 38 | , verbosity(0) 39 | , mode(pmode::all) 40 | {} 41 | bool anonymize; // anonymize the sensitive data 42 | bool oculus; // show Oculus data 43 | bool openvr; // show OpenVR data 44 | bool ovr_def_fov; // show Oculus default FOV 45 | bool ovr_max_fov; // show Oculus max FOV 46 | bool dbg_raw_in; // read collected data from JSON file into the processor 47 | bool dbg_raw_out; // write collected data into JSON file without any processing 48 | int verbosity; // output verbosity 49 | pmode mode; // print mode 50 | }; 51 | -------------------------------------------------------------------------------- /src/common/openvr_processor.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | namespace openvr { 22 | 23 | // OpenVR Processor class 24 | //------------------------------------------------------------------------------ 25 | // Printer for OpenVR subsystem 26 | class Processor : public BaseVRProcessor 27 | { 28 | public: 29 | Processor(const std::filesystem::path& apiPath, const std::shared_ptr& pjdata) 30 | : BaseVRProcessor(j_openvr, pjdata) 31 | , m_apiPath(apiPath) 32 | {} 33 | Processor(const std::shared_ptr& pjapi, const std::shared_ptr& pjdata) 34 | : BaseVRProcessor(j_openvr, pjdata) 35 | , m_pjApi(pjapi) 36 | {} 37 | 38 | public: 39 | // Initialize the processor 40 | virtual bool init() override; 41 | // Calculate complementary data 42 | virtual void calculate() override; 43 | // Anonymize sensitive data 44 | virtual void anonymize() override; 45 | // Print the collected data 46 | // mode: props, geom, all 47 | // verb: verbosity 48 | // ind: indentation 49 | // ts: indent (tab) size 50 | virtual void print(const print_options& opts, int ind, int ts) const override; 51 | // Clean up the data before saving 52 | virtual void purge() override; 53 | 54 | private: 55 | // OpenVR API JSON file path 56 | std::filesystem::path m_apiPath; 57 | // API extract 58 | std::shared_ptr m_pjApi; 59 | }; 60 | 61 | } // namespace openvr 62 | -------------------------------------------------------------------------------- /src/common/except.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | // custom runtime exception 17 | //------------------------------------------------------------------------------ 18 | class hmdq_exception : public std::runtime_error 19 | { 20 | using std::runtime_error::runtime_error; 21 | }; 22 | 23 | class hmdq_error : public std::runtime_error 24 | { 25 | using std::runtime_error::runtime_error; 26 | }; 27 | 28 | #define HMDQ_EXCEPTION(_msg) \ 29 | { \ 30 | auto _file = std::string(__FILE__); \ 31 | auto _line = std::to_string(__LINE__); \ 32 | auto _smsg = std::string(_msg); \ 33 | auto _res = std::string("hmdq runtime error:") + std::string("\nfile: ") + _file \ 34 | + std::string("\nline: ") + _line + std::string("\n") + _smsg; \ 35 | throw hmdq_exception(_res); \ 36 | } 37 | 38 | #define HMDQ_ASSERT(_expr) \ 39 | { \ 40 | if (!(_expr)) { \ 41 | HMDQ_EXCEPTION("assert: (" #_expr ")"); \ 42 | } \ 43 | } 44 | -------------------------------------------------------------------------------- /src/common/oculus_config.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | namespace oculus { 19 | 20 | // OculusVR defaults 21 | //------------------------------------------------------------------------------ 22 | static constexpr auto INIT_FLAGS = ovrInit_Invisible; 23 | 24 | // clang-format off 25 | static const json VERB_PROPS = { 26 | {Prop::HmdType_Uint32, 0}, 27 | {Prop::ProductName_String, 0}, 28 | {Prop::Manufacturer_String, 0}, 29 | {Prop::VendorId_Uint16, 2}, 30 | {Prop::ProductId_Uint16, 2}, 31 | {Prop::SerialNumber_String, 0}, 32 | {Prop::FirmwareMajor_Uint16, 2}, 33 | {Prop::FirmwareMinor_Uint16, 2}, 34 | {Prop::AvailableHmdCaps_Uint32, 2}, 35 | {Prop::DefaultHmdCaps_Uint32, 2}, 36 | {Prop::AvailableTrackingCaps_Uint32, 2}, 37 | {Prop::DefaultTrackingCaps_Uint32, 2}, 38 | {Prop::DisplayRefreshRate_Float, 0}, 39 | }; 40 | // clang-format on 41 | 42 | // clang-format off 43 | // currently identified properties with serial numbers 44 | static const json ANON_PROPS = { 45 | Prop::SerialNumber_String, 46 | }; 47 | // clang-format on 48 | 49 | // OculusVR Config class (default config) 50 | //------------------------------------------------------------------------------ 51 | // Initialize the VR subsystem default config data 52 | Config::Config() 53 | : BaseVRConfig(j_oculus, std::make_shared()) 54 | { 55 | json& cfg = *m_pjData; 56 | cfg[j_init_flags] = INIT_FLAGS; 57 | cfg[j_verbosity][j_properties] = VERB_PROPS; 58 | cfg[j_anonymize][j_properties] = ANON_PROPS; 59 | } 60 | 61 | } // namespace oculus 62 | -------------------------------------------------------------------------------- /src/common/oculus_props.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | namespace oculus { 15 | 16 | // property type defs 17 | //------------------------------------------------------------------------------ 18 | namespace Prop { 19 | 20 | constexpr const char* HmdType_Uint32 = "Prop_HmdType_Uint32"; 21 | constexpr const char* ProductName_String = "Prop_ProductName_String"; 22 | constexpr const char* Manufacturer_String = "Prop_Manufacturer_String"; 23 | constexpr const char* VendorId_Uint16 = "Prop_VendorId_Uint16"; 24 | constexpr const char* ProductId_Uint16 = "Prop_ProductId_Uint16"; 25 | constexpr const char* SerialNumber_String = "Prop_SerialNumber_String"; 26 | constexpr const char* FirmwareMajor_Uint16 = "Prop_FirmwareMajor_Uint16"; 27 | constexpr const char* FirmwareMinor_Uint16 = "Prop_FirmwareMinor_Uint16"; 28 | constexpr const char* AvailableHmdCaps_Uint32 = "Prop_AvailableHmdCaps_Uint32"; 29 | constexpr const char* DefaultHmdCaps_Uint32 = "Prop_DefaultHmdCaps_Uint32"; 30 | constexpr const char* AvailableTrackingCaps_Uint32 31 | = "Prop_AvailableTrackingCaps_Uint32"; 32 | constexpr const char* DefaultTrackingCaps_Uint32 = "Prop_DefaultTrackingCaps_Uint32"; 33 | constexpr const char* DisplayRefreshRate_Float = "Prop_DisplayRefreshRate_Float"; 34 | constexpr const char* FrustumHFovInRadians_Float = "Prop_FrustumHFovInRadians_Float"; 35 | constexpr const char* FrustumVFovInRadians_Float = "Prop_FrustumVFovInRadians_Float"; 36 | constexpr const char* FrustumNearZInMeters_Float = "Prop_FrustumNearZInMeters_Float"; 37 | constexpr const char* FrustumFarZInMeters_Float = "Prop_FrustumFarZInMeters_Float"; 38 | 39 | } // namespace Prop 40 | 41 | } // namespace oculus 42 | -------------------------------------------------------------------------------- /src/common/verhlp.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | // locals 16 | //------------------------------------------------------------------------------ 17 | static constexpr const char DOT = '.'; 18 | 19 | // functions 20 | //------------------------------------------------------------------------------ 21 | // Get the first number from the version string. 22 | std::tuple first_num(const std::string& vs, size_t pos) 23 | { 24 | if (pos == vs.size()) { 25 | return {0, pos}; 26 | } 27 | const auto dpos = vs.find(DOT, pos); 28 | int num = 0; 29 | if (dpos == 0) { 30 | // starts with DOT, assume 0 31 | pos += 1; 32 | } else if (dpos == std::string::npos) { 33 | // did not find DOT, it is all the number 34 | num = std::stoi(vs.substr(pos)); 35 | pos = vs.size(); 36 | } else { 37 | // parse the number until dot 38 | num = std::stoi(vs.substr(pos, dpos - pos)); 39 | pos = dpos + 1; 40 | } 41 | return {num, pos}; 42 | } 43 | 44 | // Compare two versions `va` and `vb`. 45 | // Return: 46 | // -1 : va < vb 47 | // 0 : va == vb 48 | // 1 : va > vb 49 | int comp_ver(const std::string& va, const std::string& vb) 50 | { 51 | size_t posa = 0; 52 | size_t posb = 0; 53 | int res = 0; 54 | 55 | while (posa < va.size() || posb < vb.size()) { 56 | const auto [numa, nposa] = first_num(va, posa); 57 | const auto [numb, nposb] = first_num(vb, posb); 58 | if (numa < numb) { 59 | res = -1; 60 | break; 61 | } else if (numa > numb) { 62 | res = 1; 63 | break; 64 | } 65 | posa = nposa; 66 | posb = nposb; 67 | } 68 | return res; 69 | } 70 | -------------------------------------------------------------------------------- /src/hmdq/res/hmdq.rc.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | 14 | #pragma code_page(65001) // UTF-8 15 | 16 | #define VER_FILEVERSION @GIT_REPO_VERSION_MAJOR@,@GIT_REPO_VERSION_MINOR@,@GIT_REPO_VERSION_PATCH@,@GIT_REPO_VERSION_NCOMM@ 17 | #define VER_FILEVERSION_STR "@GIT_REPO_VERSION@" 18 | 19 | #define VER_PRODUCTVERSION @GIT_REPO_VERSION_MAJOR@,@GIT_REPO_VERSION_MINOR@,@GIT_REPO_VERSION_PATCH@,@GIT_REPO_VERSION_NCOMM@ 20 | #define VER_PRODUCTVERSION_STR "@GIT_REPO_VERSION@" 21 | 22 | #cmakedefine VI_DEBUG 23 | 24 | #ifndef VI_DEBUG 25 | #define VER_DEBUG 0 26 | #else 27 | #define VER_DEBUG VS_FF_DEBUG 28 | #endif 29 | 30 | // add an icon to the executable 31 | 1 ICON "${CMAKE_CURRENT_SOURCE_DIR}/res/hmdq_icon.ico" 32 | 33 | // define version info 34 | VS_VERSION_INFO VERSIONINFO 35 | FILEVERSION VER_FILEVERSION 36 | PRODUCTVERSION VER_PRODUCTVERSION 37 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 38 | FILEFLAGS VER_DEBUG 39 | FILEOS VOS__WINDOWS32 40 | FILETYPE VFT_APP 41 | FILESUBTYPE VFT2_UNKNOWN 42 | BEGIN 43 | BLOCK "StringFileInfo" 44 | BEGIN 45 | BLOCK "040904E4" 46 | BEGIN 47 | VALUE "CompanyName", "Richard Musil" 48 | VALUE "FileDescription", "VR headset data collecting utility" 49 | VALUE "FileVersion", VER_FILEVERSION_STR 50 | VALUE "InternalName", "${PROJECT_NAME}" 51 | VALUE "LegalCopyright", "© 2019-${BUILD_YEAR} Richard Musil" 52 | VALUE "OriginalFilename", "${PROJECT_NAME}.exe" 53 | VALUE "ProductName", "${PROJECT_NAME}" 54 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 55 | END 56 | END 57 | BLOCK "VarFileInfo" 58 | BEGIN 59 | VALUE "Translation", 0x409, 1252 60 | END 61 | END 62 | -------------------------------------------------------------------------------- /src/hmdv/res/hmdv.rc.in: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | 14 | #pragma code_page(65001) // UTF-8 15 | 16 | #define VER_FILEVERSION @GIT_REPO_VERSION_MAJOR@,@GIT_REPO_VERSION_MINOR@,@GIT_REPO_VERSION_PATCH@,@GIT_REPO_VERSION_NCOMM@ 17 | #define VER_FILEVERSION_STR "@GIT_REPO_VERSION@" 18 | 19 | #define VER_PRODUCTVERSION @GIT_REPO_VERSION_MAJOR@,@GIT_REPO_VERSION_MINOR@,@GIT_REPO_VERSION_PATCH@,@GIT_REPO_VERSION_NCOMM@ 20 | #define VER_PRODUCTVERSION_STR "@GIT_REPO_VERSION@" 21 | 22 | #cmakedefine VI_DEBUG 23 | 24 | #ifndef VI_DEBUG 25 | #define VER_DEBUG 0 26 | #else 27 | #define VER_DEBUG VS_FF_DEBUG 28 | #endif 29 | 30 | // add an icon to the executable 31 | 1 ICON "${CMAKE_CURRENT_SOURCE_DIR}/res/hmdv_icon.ico" 32 | 33 | // define version info 34 | VS_VERSION_INFO VERSIONINFO 35 | FILEVERSION VER_FILEVERSION 36 | PRODUCTVERSION VER_PRODUCTVERSION 37 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 38 | FILEFLAGS VER_DEBUG 39 | FILEOS VOS__WINDOWS32 40 | FILETYPE VFT_APP 41 | FILESUBTYPE VFT2_UNKNOWN 42 | BEGIN 43 | BLOCK "StringFileInfo" 44 | BEGIN 45 | BLOCK "040904E4" 46 | BEGIN 47 | VALUE "CompanyName", "Richard Musil" 48 | VALUE "FileDescription", "VR headset data processing utility" 49 | VALUE "FileVersion", VER_FILEVERSION_STR 50 | VALUE "InternalName", "${PROJECT_NAME}" 51 | VALUE "LegalCopyright", "© 2019-${BUILD_YEAR} Richard Musil" 52 | VALUE "OriginalFilename", "${PROJECT_NAME}.exe" 53 | VALUE "ProductName", "${PROJECT_NAME}" 54 | VALUE "ProductVersion", VER_PRODUCTVERSION_STR 55 | END 56 | END 57 | BLOCK "VarFileInfo" 58 | BEGIN 59 | VALUE "Translation", 0x409, 1252 60 | END 61 | END 62 | -------------------------------------------------------------------------------- /src/common/prtdata.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | // functions (miscellanous) 19 | //------------------------------------------------------------------------------ 20 | // Print header (displayed when the execution starts) needs verbosity=silent 21 | void print_header(const char* prog_name, const char* prog_ver, const char* prog_desc, 22 | int verb, int ind, int ts); 23 | 24 | // Print miscellanous info. 25 | void print_misc(const json& jd, const char* prog_name, int verb, int ind, int ts); 26 | 27 | // functions (geometry) 28 | //------------------------------------------------------------------------------ 29 | // Print out the raw (tangent) LRBT values. 30 | void print_raw_lrbt(const json& jd, int ind, int ts); 31 | 32 | // Print single eye FOV values in degrees. 33 | void print_fov(const json& jd, int ind, int ts); 34 | 35 | // Print total stereo FOV values in degrees. 36 | void print_fov_total(const json& jd, int ind, int ts); 37 | 38 | // Print view geometry (panel rotation, IPD). 39 | void print_view_geom(const json& jd, int ind, int ts); 40 | 41 | // Print the hidden area mask mesh statistics. 42 | void print_ham_mesh(const json& ham_mesh, const char* neye, int verb, int vgeom, int ind, 43 | int ts); 44 | 45 | // Print all the info about the view geometry, calculated FOVs, hidden area mesh, etc. 46 | void print_geometry(const json& jd, int verb, int ind, int ts); 47 | 48 | // functions (all print) 49 | //------------------------------------------------------------------------------ 50 | // Print the complete data file. 51 | void print_all(const print_options& opts, const json& out, const procmap_t& processors, 52 | int ind, int ts); 53 | -------------------------------------------------------------------------------- /cmake/gitversion.cmake: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.8) 13 | 14 | include (utils) 15 | 16 | message (STATUS "Resolving GIT Version") 17 | 18 | find_package (Git) 19 | if (GIT_FOUND) 20 | execute_process ( 21 | COMMAND ${GIT_EXECUTABLE} describe --tags --long --always --dirty --match "v*" 22 | WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" 23 | OUTPUT_VARIABLE GIT_REPO_VERSION 24 | ERROR_QUIET 25 | OUTPUT_STRIP_TRAILING_WHITESPACE 26 | ) 27 | message (STATUS "GIT tag: ${GIT_REPO_VERSION}") 28 | else() 29 | set (GIT_REPO_VERSION "unknown") 30 | message (STATUS "GIT not found") 31 | endif() 32 | 33 | if (GIT_REPO_VERSION MATCHES "^v([0-9]+).([0-9]+).([0-9]+)($|(-([0-9]+)-([a-h0-9]+)))") 34 | set (GIT_REPO_VERSION_MAJOR ${CMAKE_MATCH_1}) 35 | set (GIT_REPO_VERSION_MINOR ${CMAKE_MATCH_2}) 36 | set (GIT_REPO_VERSION_PATCH ${CMAKE_MATCH_3}) 37 | set (GIT_REPO_VERSION_NCOMM ${CMAKE_MATCH_6}) 38 | set (GIT_REPO_VERSION_GHASH ${CMAKE_MATCH_7}) 39 | if (CMAKE_MATCH_9) 40 | set (GIT_REPO_VERSION_DIRTY "true") 41 | else() 42 | set (GIT_REPO_VERSION_DIRTY "false") 43 | endif() 44 | foreach (i RANGE ${CMAKE_MATCH_COUNT}) 45 | message (STATUS "CMAKE_MATCH_${i} = ${CMAKE_MATCH_${i}}") 46 | endforeach() 47 | print_variables("GIT_.*") 48 | else() 49 | message (STATUS "No valid GIT version found, supplying 0.1.0") 50 | set (GIT_REPO_VERSION_MAJOR 0) 51 | set (GIT_REPO_VERSION_MINOR 1) 52 | set (GIT_REPO_VERSION_PATCH 0) 53 | endif() 54 | 55 | configure_file (${CMAKE_CURRENT_SOURCE_DIR}/res/gitversion.h.in 56 | ${CMAKE_CURRENT_BINARY_DIR}/res/gitversion.h 57 | @ONLY 58 | ) 59 | 60 | # add output dir to the search path so the other subprojects find it 61 | include_directories (${CMAKE_CURRENT_BINARY_DIR}/res) 62 | -------------------------------------------------------------------------------- /src/hmdq_test/verhlp_test.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | 14 | // Already defined in geom_test.cpp 15 | // #define CATCH_CONFIG_MAIN 16 | 17 | #include 18 | 19 | // tests 20 | //------------------------------------------------------------------------------ 21 | TEST_CASE("Version string comparison module", "[verhlp]") 22 | { 23 | SECTION("naive test", "[naive]") 24 | { 25 | REQUIRE(comp_ver("1", "1") == 0); 26 | REQUIRE(comp_ver("1", "1") == 0); 27 | REQUIRE(comp_ver("1", "1.0") == 0); 28 | REQUIRE(comp_ver("1.0.0", "1.0") == 0); 29 | REQUIRE(comp_ver("1.0.0", "1.0.0.0") == 0); 30 | } 31 | 32 | SECTION("missing test", "[missing]") 33 | { 34 | REQUIRE(comp_ver(".", ".") == 0); 35 | REQUIRE(comp_ver(".", "0.") == 0); 36 | REQUIRE(comp_ver(".", ".0") == 0); 37 | REQUIRE(comp_ver(".0", "0.") == 0); 38 | REQUIRE(comp_ver(".1", "0.1") == 0); 39 | REQUIRE(comp_ver("1.", "1") == 0); 40 | } 41 | 42 | SECTION("length test", "[length]") 43 | { 44 | REQUIRE(comp_ver("1.0", "1.0.1") == -1); 45 | REQUIRE(comp_ver("1.0", "1.0.1.0") == -1); 46 | REQUIRE(comp_ver("1.0.0.1", "1.0.0.001.") == 0); 47 | REQUIRE(comp_ver("1.0.1", "1.0") == 1); 48 | REQUIRE(comp_ver("1.0.1.0", "1.0") == 1); 49 | REQUIRE(comp_ver("1.0.0.0.1", "1.0") == 1); 50 | } 51 | 52 | SECTION("main test", "[main]") 53 | { 54 | REQUIRE(comp_ver("1.2.3", "1.2.2") == 1); 55 | REQUIRE(comp_ver("1.2.1", "1.2.2") == -1); 56 | REQUIRE(comp_ver("1.2.1", "1.1.2") == 1); 57 | REQUIRE(comp_ver("1.0.1", "1.1.2") == -1); 58 | REQUIRE(comp_ver("1.0", "1.1.2") == -1); 59 | REQUIRE(comp_ver("1", "1.1.2") == -1); 60 | REQUIRE(comp_ver("1.0.1", "1.1") == -1); 61 | REQUIRE(comp_ver("1.0.1", "1") == 1); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/common/wintools.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | // Print system error message for ::GetLastError to stderr, add `message` as contextual 19 | // info. 20 | bool print_sys_error(const char* message); 21 | 22 | // Get OS version or "n/a" if the attempt fails (print error in DEBUG build) 23 | std::string get_os_ver(); 24 | 25 | // Init console output code page 26 | void init_console_cp(); 27 | 28 | // Set console output code page, if installed 29 | void set_console_cp(unsigned int codepage); 30 | 31 | // Convert wstring to UTF-8 string 32 | std::string wstr_to_utf8(const wchar_t* wstr); 33 | 34 | // Convert UTF-8 string to wstring 35 | std::wstring utf8_to_wstr(const char* u8str); 36 | 37 | // Return command line arguments as UTF-8 string list (in vector). 38 | std::vector get_u8args(); 39 | 40 | // Return the full path of the executable which created the process 41 | std::filesystem::path get_full_prog_path(); 42 | 43 | // Print command line arguments (for debugging purposes) 44 | void print_u8args(std::vector u8args); 45 | 46 | // Convert wstring to UTF-8 string 47 | inline std::string wstr_to_utf8(const std::wstring& wstr) 48 | { 49 | return wstr_to_utf8(wstr.c_str()); 50 | } 51 | 52 | // Convert UTF-8 string to wstring 53 | inline std::wstring utf8_to_wstr(const std::string& u8str) 54 | { 55 | return utf8_to_wstr(u8str.c_str()); 56 | } 57 | 58 | // Convert UTF-8 string to filepath 59 | inline std::filesystem::path utf8_to_path(const char* u8str) 60 | { 61 | return std::filesystem::path(utf8_to_wstr(u8str)); 62 | } 63 | 64 | inline std::filesystem::path utf8_to_path(const std::string& u8str) 65 | { 66 | return utf8_to_path(u8str.c_str()); 67 | } 68 | 69 | // Convert filepath to UTF-8 string 70 | inline std::string path_to_utf8(const std::filesystem::path& path) 71 | { 72 | return wstr_to_utf8(path.wstring()); 73 | } 74 | -------------------------------------------------------------------------------- /src/hmdq/oculus_collector.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | namespace oculus { 24 | 25 | // OculusVR Collector class 26 | //------------------------------------------------------------------------------ 27 | class Collector : public BaseVRCollector 28 | { 29 | public: 30 | Collector(ovrInitFlags initFlags) 31 | : BaseVRCollector(j_oculus, std::make_shared()) 32 | , m_initFlags(initFlags) 33 | , m_session(nullptr) 34 | , m_inited(false) 35 | {} 36 | virtual ~Collector() override; 37 | 38 | public: 39 | // Check if the OculusVR subsystem is present and initialize it 40 | // Return: true if present and initialized, otherwise false 41 | virtual bool try_init() override; 42 | // Collect the OculusVR subsystem data 43 | virtual void collect() override; 44 | // Return the last OculusVR subsystem error 45 | virtual int get_last_error() const override; 46 | // Return the last OculusVR subsystem error message 47 | virtual std::string get_last_error_msg() const override; 48 | 49 | public: 50 | // Shutdown the OculusVR subsystem 51 | void shutdown(); 52 | 53 | private: 54 | // Check the error and get the context info. 55 | bool check_failure(ovrResult ores); 56 | 57 | private: 58 | // Lib was initialized flag 59 | bool m_inited; 60 | // OculusVR init flags 61 | ovrInitFlags m_initFlags; 62 | // OculusVR graphics LUID 63 | ovrGraphicsLuid m_graphicsLuid; 64 | // OculusVR session 65 | ovrSession m_session; 66 | // The last OculusVR error 67 | ovrResult m_error; 68 | // Error info corresponding to the last error 69 | ovrErrorInfo m_errorInfo; 70 | // ovrHmdDesc 71 | std::unique_ptr m_pHmdDesc; 72 | }; 73 | 74 | } // namespace oculus 75 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.15) 13 | # Set policy to accept MSVC runtime selector (requires CMake >= 3.15) 14 | cmake_policy (SET CMP0091 NEW) 15 | 16 | # Add path for modules (helpers) 17 | list (APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") 18 | 19 | # Versioning 20 | # ============ 21 | include (gitversion) 22 | include (build) 23 | message (STATUS "GIT_REPO_VERSION = ${GIT_REPO_VERSION}") 24 | 25 | # Standards 26 | # ============ 27 | set (CMAKE_CXX_STANDARD 20) 28 | set (CMAKE_CXX_STANDARD_REQUIRED ON) 29 | 30 | # Project root 31 | # ============ 32 | project (hmdq_tools 33 | VERSION ${GIT_REPO_VERSION_MAJOR}.${GIT_REPO_VERSION_MINOR}.${GIT_REPO_VERSION_PATCH} 34 | DESCRIPTION "Tools for VR headset and other hardware introspection." 35 | HOMEPAGE_URL "https://github.com/risa2000/hmdq" 36 | ) 37 | 38 | # CMake options 39 | # ============ 40 | option (BUILD_TESTS "Build optional unit tests (needs Catch2 lib)" ON) 41 | 42 | if (BUILD_TESTS) 43 | include (CTest) 44 | include (Catch) 45 | endif (BUILD_TESTS) 46 | 47 | add_subdirectory (src) 48 | 49 | # Install 50 | # ============ 51 | install (FILES 52 | ${CMAKE_SOURCE_DIR}/api/openvr_api.json 53 | ${CMAKE_SOURCE_DIR}/res/save_data.cmd 54 | ${CMAKE_SOURCE_DIR}/README.md 55 | ${CMAKE_SOURCE_DIR}/Changelog.md 56 | ${CMAKE_SOURCE_DIR}/LICENSE 57 | DESTINATION . 58 | ) 59 | 60 | set (CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF) 61 | set (CPACK_PACKAGE_VENDOR $ENV{USERNAME}) 62 | set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) 63 | set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) 64 | set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) 65 | set (CPACK_PACKAGE_DESCRIPTION ${PROJECT_DESCRIPTION}) 66 | set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "hmdq tools package") 67 | set (CPACK_PACKAGE_HOMEPAGE_URL ${PROJECT_HOMEPAGE_URL}) 68 | set (CPACK_GENERATOR "ZIP" CACHE STRING "Generators to support. semi-colon delimited list") 69 | include(CPack) 70 | -------------------------------------------------------------------------------- /src/hmdq/openvr_collector.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | namespace openvr { 24 | 25 | // OpenVR Collector class 26 | //------------------------------------------------------------------------------ 27 | class Collector : public BaseVRCollector 28 | { 29 | public: 30 | Collector(const std::filesystem::path& apiPath, vr::EVRApplicationType appType) 31 | : BaseVRCollector(j_openvr, std::make_shared()) 32 | , m_appType(appType) 33 | , m_ivrSystem(nullptr) 34 | , m_err(vr::VRInitError_None) 35 | , m_apiPath(apiPath) 36 | , m_pjApi(std::make_shared()) 37 | {} 38 | virtual ~Collector() override; 39 | 40 | public: 41 | // Check if the OpenVR subsystem is present and initialize it 42 | // Return: true if present and initialized, otherwise false 43 | virtual bool try_init() override; 44 | // Collect the OpenVR subsystem data 45 | virtual void collect() override; 46 | // Return the last OpenVR subsystem error 47 | virtual int get_last_error() const override; 48 | // Return the last OpenVR subsystem error message 49 | virtual std::string get_last_error_msg() const override; 50 | 51 | public: 52 | // Return OpenVR API extract (for printer) 53 | virtual std::shared_ptr get_xapi(); 54 | // Shutdown the OpenVR subsystem 55 | void shutdown(); 56 | 57 | private: 58 | // OpenVR app type to initialize the subsystem 59 | vr::EVRApplicationType m_appType; 60 | // Initialized system 61 | vr::IVRSystem* m_ivrSystem; 62 | // The last OpenVR error 63 | vr::EVRInitError m_err; 64 | // OpenVR API JSON file path 65 | std::filesystem::path m_apiPath; 66 | // API extract 67 | std::shared_ptr m_pjApi; 68 | }; 69 | 70 | } // namespace openvr 71 | -------------------------------------------------------------------------------- /src/common/xtdef.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | // typedefs 27 | //------------------------------------------------------------------------------ 28 | typedef xt::xtensor harray2d_t; 29 | typedef xt::xarray harray_t; 30 | typedef xt::xtensor hvector_t; 31 | typedef std::vector hface_t; 32 | typedef std::vector hfaces_t; 33 | typedef std::vector hveclist_t; 34 | typedef std::pair hvecpair_t; 35 | typedef std::pair hedge_t; 36 | typedef std::vector hedgelist_t; 37 | 38 | // utility functions 39 | //------------------------------------------------------------------------------ 40 | // Build the 2D-array from std::vector of 1D-arrays. 41 | harray2d_t build_array(const hveclist_t& vecs); 42 | 43 | // Indent print xarray. 44 | template 45 | std::vector format_tensor(const xt::xtensor& a) 46 | { 47 | // stringstream to dump the xarray 48 | std::stringstream temp; 49 | temp << a; 50 | 51 | std::vector res; 52 | for (std::string line; getline(temp, line);) { 53 | res.push_back(line); 54 | } 55 | return res; 56 | } 57 | 58 | inline void print_multiline(const std::vector& lines, int ind, int ts) 59 | { 60 | const auto sf = ind * ts; 61 | for (const auto line : lines) { 62 | iprint(sf, "{}\n", line); 63 | } 64 | } 65 | 66 | // Indent print xarray. 67 | template 68 | void print_tensor(const xt::xtensor& a, int ind, int ts) 69 | { 70 | const auto fval = format_tensor(a); 71 | print_multiline(fval, ind, ts); 72 | } 73 | 74 | inline void print_harray(const harray2d_t& a, int ind, int ts) 75 | { 76 | print_tensor(a, ind, ts); 77 | } 78 | -------------------------------------------------------------------------------- /src/common/geom.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | 18 | // functions 19 | //------------------------------------------------------------------------------ 20 | // Compute degrees out of radians. 21 | inline double degrees(double rad) 22 | { 23 | return (rad * 180) / xt::numeric_constants::PI; 24 | } 25 | 26 | // Compute dot product of two 2-D vectors. 27 | template 28 | double dot_prod(const TArray& v1, const TArray& v2) 29 | { 30 | auto sres = xt::sum(v1 * v2); 31 | return sres[0]; 32 | } 33 | 34 | // Compute vector length. 35 | template 36 | double gnorm(const TArray& v) 37 | { 38 | return sqrt(dot_prod(v, v)); 39 | } 40 | 41 | // Compute the angle between the two vectors in radians. 42 | inline double angle(const hvector_t& v1, const hvector_t& v2) 43 | { 44 | double tres = dot_prod(v1, v2) / (gnorm(v1) * gnorm(v2)); 45 | if (tres > 1.0) { 46 | tres = 1.0; 47 | } else if (tres < -1.0) { 48 | tres = -1.0; 49 | } 50 | return acos(tres); 51 | } 52 | 53 | // Compute the angle between the two vectors in degrees. 54 | inline double angle_deg(const hvector_t& v1, const hvector_t& v2) 55 | { 56 | return degrees(angle(v1, v2)); 57 | } 58 | 59 | // Calculate the distance between two 3D points. 60 | inline double point_dist(const hvector_t& p1, const hvector_t& p2) 61 | { 62 | return gnorm(xt::eval(p1 - p2)); 63 | } 64 | 65 | // Calculate the area of the triangle given by the vertices. 66 | double area_triangle(const hvector_t& v1, const hvector_t& v2, const hvector_t& v3); 67 | 68 | // Calculate the mesh area from given triangles. Triangle are specified by vertices 69 | // indexed by an index array. 70 | double area_mesh_tris_idx(const harray2d_t& verts, const hfaces_t& tris); 71 | 72 | // Calculate the mesh area from given triangles. Triangle are specified by vertices 73 | // indexed by an index array (using GEOS library) 74 | double area_mesh_tris_idx_geos(const harray2d_t& verts, const hfaces_t& tris); 75 | -------------------------------------------------------------------------------- /src/common/optmesh.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | // functions 17 | //------------------------------------------------------------------------------ 18 | // Test if vertex `v` is in `verts` vertices. Return index or -1. 19 | long long v_in_verts(const hvector_t& v, const std::vector& verts); 20 | // 21 | // Remove duplicate vertices in `verts` and rearrange `faces`. 22 | std::pair reduce_verts(const harray2d_t& verts, 23 | const hfaces_t& faces); 24 | 25 | // Return edges in the face. 26 | hedgelist_t face2edges(const hface_t& face); 27 | 28 | // Sort edges orientation, so the first vertex has lower index. 29 | hedgelist_t sort_edges(const hedgelist_t& edges); 30 | 31 | // Return shared edges. 32 | hedgelist_t shared_edges(const hedgelist_t& edges1, const hedgelist_t& edges2); 33 | 34 | // Reverse the orientation of the edges in the face. 35 | hedgelist_t reverse_edges(const hedgelist_t& edges); 36 | 37 | // Build face from edges. 38 | hface_t build_face(const hedgelist_t& edges1, const hedgelist_t& edges2); 39 | 40 | // Return true if the edges match regardless the direction. 41 | inline bool match_edges(const hedge_t& e1, const hedge_t& e2) 42 | { 43 | return (e1 == e2 || (e1.first == e2.second && e1.second == e2.first)); 44 | } 45 | 46 | // Remove continous chain of edges (sorted) from `edges` and return what 47 | // remains again continous. 48 | hedgelist_t remove_chain(const hedgelist_t& chain, const hedgelist_t& edges); 49 | 50 | // Check if the edges are chained. If they are, shift the sequence so 51 | // it starts with the first edge in the chain and ends with the last one. 52 | // Otherwise return []. 53 | hedgelist_t check_chained(const hedgelist_t& edges); 54 | 55 | // Build a new face from two edge lists and the shared chain. 56 | hface_t merge_edges(const hedgelist_t& edges1, const hedgelist_t& edges2, 57 | const hedgelist_t& chain); 58 | 59 | // Reduce faces by removing duplicate edges. 60 | hfaces_t reduce_faces(const hfaces_t& faces); 61 | -------------------------------------------------------------------------------- /src/common/oculus_common.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | namespace oculus { 24 | 25 | // typedefs 26 | //------------------------------------------------------------------------------ 27 | typedef std::vector> eyes_t; 28 | 29 | // common constants 30 | //------------------------------------------------------------------------------ 31 | // Controller types names 32 | extern const nlohmann::ordered_map g_bmControllerTypes; 33 | // HMD capabilities names 34 | extern const nlohmann::ordered_map g_bmHmdCaps; 35 | // Tracker capabilites names 36 | extern const nlohmann::ordered_map g_bmTrackingCaps; 37 | // HMD types names 38 | extern const nlohmann::ordered_map g_mHmdTypes; 39 | 40 | // Eye nomenclature 41 | extern const eyes_t EYES; 42 | 43 | } // namespace oculus 44 | 45 | // nlohmann/json serializers 46 | //------------------------------------------------------------------------------ 47 | // ovrVector2i serializers 48 | void to_json(json& j, const ovrVector2i& v2i); 49 | void from_json(const json& j, ovrVector2i& v2i); 50 | // ovrVector2f serializers 51 | void to_json(json& j, const ovrVector2f& v2f); 52 | void from_json(const json& j, ovrVector2f& v2f); 53 | // ovrVector3f serializers 54 | void to_json(json& j, const ovrVector3f& v3f); 55 | void from_json(const json& j, ovrVector3f& v3f); 56 | // ovrQuatf serializers 57 | void to_json(json& j, const ovrQuatf& quat); 58 | void from_json(const json& j, ovrQuatf& quat); 59 | // ovrFovPort serializers 60 | void to_json(json& j, const ovrFovPort& fovPort); 61 | void from_json(const json& j, ovrFovPort& fovPort); 62 | // ovrSizei serializers 63 | void to_json(json& j, const ovrSizei& size); 64 | void from_json(const json& j, ovrSizei& size); 65 | // ovrRecti serializers 66 | void to_json(json& j, const ovrRecti& rect); 67 | void from_json(const json& j, ovrRecti& rect); 68 | // ovrPosef serializers 69 | void to_json(json& j, const ovrPosef& pose); 70 | void from_json(const json& j, ovrPosef& pose); 71 | -------------------------------------------------------------------------------- /src/common/geom.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | #include 19 | 20 | // functions 21 | //------------------------------------------------------------------------------ 22 | // Calculate the area of the triangle given by the vertices. 23 | double area_triangle(const hvector_t& v1, const hvector_t& v2, const hvector_t& v3) 24 | { 25 | const auto ab = v2 - v1; 26 | const auto ac = v3 - v1; 27 | return sqrt(dot_prod(ab, ab) * dot_prod(ac, ac) - pow(dot_prod(ab, ac), 2)) / 2; 28 | } 29 | 30 | // Calculate the mesh area from given triangles. Triangle are specified by vertices 31 | // indexed by an index array. 32 | double area_mesh_tris_idx(const harray2d_t& verts, const hfaces_t& tris) 33 | { 34 | double a = 0; 35 | for (const auto& face : tris) { 36 | HMDQ_ASSERT(face.size() == 3); 37 | a += area_triangle(xt::view(verts, face[0]), xt::view(verts, face[1]), 38 | xt::view(verts, face[2])); 39 | } 40 | return a; 41 | } 42 | 43 | double area_mesh_tris_idx_geos(const harray2d_t& verts, const hfaces_t& tris) 44 | { 45 | using namespace geos::geom; 46 | 47 | GeometryFactory::Ptr factory = GeometryFactory::create(); 48 | auto canvas{factory->createPolygon( 49 | CoordinateSequence({CoordinateXY{0, 0}, CoordinateXY{0, 1}, CoordinateXY{1, 1}, 50 | CoordinateXY{1, 0}, CoordinateXY{0, 0}}))}; 51 | double a = 0.0; 52 | for (const auto& face : tris) { 53 | HMDQ_ASSERT(face.size() == 3); 54 | auto t_coords{CoordinateSequence( 55 | {CoordinateXY{xt::view(verts, face[0])[0], xt::view(verts, face[0])[1]}, 56 | CoordinateXY{xt::view(verts, face[1])[0], xt::view(verts, face[1])[1]}, 57 | CoordinateXY{xt::view(verts, face[2])[0], xt::view(verts, face[2])[1]}, 58 | CoordinateXY{xt::view(verts, face[0])[0], xt::view(verts, face[0])[1]}})}; 59 | auto triangle{factory->createPolygon(std::move(t_coords))}; 60 | auto isection = canvas->intersection(triangle.get()); 61 | a += isection->getArea(); 62 | } 63 | return a; 64 | } 65 | -------------------------------------------------------------------------------- /conan/packages/openvr/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.tools.layout import cmake_layout 3 | from conan.tools.files import apply_conandata_patches, get, collect_libs 4 | from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps 5 | 6 | required_conan_version = ">=1.43.0" 7 | 8 | class OpenVrConan(ConanFile): 9 | name = "openvr" 10 | description = "OpenVR SDK" 11 | license = "BSD-3-Clause" 12 | topics = ("openvr", "vr") 13 | homepage = "https://github.com/ValveSoftware/openvr" 14 | url = "https://github.com/ValveSoftware/openvr" 15 | 16 | settings = "os", "arch", "compiler", "build_type" 17 | options = { 18 | "shared": [True, False], 19 | } 20 | default_options = { 21 | "shared": False, 22 | } 23 | 24 | generators = "CMakeToolchain" 25 | exports_sources = ["patches/**"] 26 | 27 | def layout(self): 28 | cmake_layout(self, src_folder=f"{self.name}-{self.version}") 29 | 30 | def source(self): 31 | get(self, **self.conan_data["sources"][self.version], strip_root=True) 32 | apply_conandata_patches(self) 33 | 34 | def build(self): 35 | cmake = CMake(self) 36 | cmake.configure() 37 | cmake.build() 38 | 39 | def generate(self): 40 | toolchain = CMakeToolchain(self) 41 | toolchain.generate() 42 | 43 | deps = CMakeDeps(self) 44 | deps.generate() 45 | 46 | def package_id(self): 47 | del self.info.settings.compiler.cppstd 48 | 49 | def package(self): 50 | self.copy("LICENSE", dst="licenses", src=self.folders.source) 51 | cmake = CMake(self) 52 | cmake.install() 53 | 54 | def package_info(self): 55 | self.cpp_info.names["generator_name"] = "openvr" 56 | self.cpp_info.includedirs = ['include'] # Ordered list of include paths 57 | self.cpp_info.libs = collect_libs(self) # The libs to link against 58 | self.cpp_info.system_libs = [] # System libs to link against 59 | self.cpp_info.libdirs = ['lib'] # Directories where libraries can be found 60 | self.cpp_info.resdirs = ['res'] # Directories where resources, data, etc. can be found 61 | self.cpp_info.bindirs = ['bin'] # Directories where executables and shared libs can be found 62 | self.cpp_info.srcdirs = [] # Directories where sources can be found (debugging, reusing sources) 63 | self.cpp_info.build_modules = {} # Build system utility module files 64 | if not self.options.shared: 65 | self.cpp_info.defines = ['OPENVR_BUILD_STATIC'] # preprocessor definitions 66 | else: 67 | self.cpp_info.defines = [] # preprocessor definitions 68 | self.cpp_info.cflags = [] # pure C flags 69 | self.cpp_info.cxxflags = [] # C++ compilation flags 70 | self.cpp_info.sharedlinkflags = [] # linker flags 71 | self.cpp_info.exelinkflags = [] # linker flags 72 | self.cpp_info.components = {} # Dictionary with the different components a package may have 73 | self.cpp_info.requires = [] # List of components from requirements 74 | -------------------------------------------------------------------------------- /conan/packages/nlohmann_json/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "3.12.0": 3 | url: "https://github.com/nlohmann/json/archive/v3.12.0.tar.gz" 4 | sha256: "4b92eb0c06d10683f7447ce9406cb97cd4b453be18d7279320f7b2f025c10187" 5 | "3.11.3": 6 | url: "https://github.com/nlohmann/json/archive/v3.11.3.tar.gz" 7 | sha256: "0d8ef5af7f9794e3263480193c491549b2ba6cc74bb018906202ada498a79406" 8 | "3.11.2": 9 | url: "https://github.com/nlohmann/json/archive/v3.11.2.tar.gz" 10 | sha256: "d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273" 11 | "3.11.1": 12 | url: "https://github.com/nlohmann/json/archive/v3.11.1.tar.gz" 13 | sha256: "598becb62ee0e01cf32795073c8ae09b6e95335cd43a4417b785d93ce105b0d0" 14 | "3.11.0": 15 | url: "https://github.com/nlohmann/json/archive/v3.11.0.tar.gz" 16 | sha256: "e0c4fbd03c0bb7e99b40791e0276be61e5f531106e1486e8f0d771a7ed6d754a" 17 | "3.10.5": 18 | url: "https://github.com/nlohmann/json/archive/v3.10.5.tar.gz" 19 | sha256: "5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" 20 | "3.10.4": 21 | url: "https://github.com/nlohmann/json/archive/v3.10.4.tar.gz" 22 | sha256: "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3" 23 | "3.10.3": 24 | url: "https://github.com/nlohmann/json/archive/v3.10.3.tar.gz" 25 | sha256: "e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c" 26 | "3.10.2": 27 | sha256: 081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c 28 | url: https://github.com/nlohmann/json/archive/v3.10.2.tar.gz 29 | "3.10.0": 30 | sha256: eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084 31 | url: https://github.com/nlohmann/json/archive/v3.10.0.tar.gz 32 | "3.9.1": 33 | sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b 34 | url: https://github.com/nlohmann/json/archive/v3.9.1.tar.gz 35 | "3.9.0": 36 | sha256: 9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b 37 | url: https://github.com/nlohmann/json/archive/v3.9.0.tar.gz 38 | "3.8.0": 39 | sha256: 7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba 40 | url: https://github.com/nlohmann/json/archive/v3.8.0.tar.gz 41 | "3.7.3": 42 | sha256: 249548F4867417D66AE46B338DFE0A2805F3323E81C9E9B83C89F3ADBFDE6F31 43 | url: https://github.com/nlohmann/json/archive/v3.7.3.tar.gz 44 | "3.7.0": 45 | sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 46 | url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz 47 | "3.5.0": 48 | sha256: E0B1FC6CC6CA05706CCE99118A87ACA5248BD9DB3113E703023D23F044995C1D 49 | url: https://github.com/nlohmann/json/archive/v3.5.0.tar.gz 50 | "3.4.0": 51 | sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 52 | url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz 53 | "3.2.0": 54 | sha256: 2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1 55 | url: https://github.com/nlohmann/json/archive/v3.2.0.tar.gz 56 | "3.1.1": 57 | sha256: 9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47 58 | url: https://github.com/nlohmann/json/archive/v3.1.1.tar.gz 59 | -------------------------------------------------------------------------------- /conan/packages/fmt/conandata.yml: -------------------------------------------------------------------------------- 1 | sources: 2 | "11.1.4": 3 | url: "https://github.com/fmtlib/fmt/releases/download/11.1.4/fmt-11.1.4.zip" 4 | sha256: "49b039601196e1a765e81c5c9a05a61ed3d33f23b3961323d7322e4fe213d3e6" 5 | "11.1.3": 6 | url: "https://github.com/fmtlib/fmt/releases/download/11.1.3/fmt-11.1.3.zip" 7 | sha256: "7df2fd3426b18d552840c071c977dc891efe274051d2e7c47e2c83c3918ba6df" 8 | "11.1.1": 9 | url: "https://github.com/fmtlib/fmt/releases/download/11.1.1/fmt-11.1.1.zip" 10 | sha256: "a25124e41c15c290b214c4dec588385153c91b47198dbacda6babce27edc4b45" 11 | "11.0.2": 12 | url: "https://github.com/fmtlib/fmt/releases/download/11.0.2/fmt-11.0.2.zip" 13 | sha256: "40fc58bebcf38c759e11a7bd8fdc163507d2423ef5058bba7f26280c5b9c5465" 14 | "11.0.1": 15 | url: "https://github.com/fmtlib/fmt/releases/download/11.0.1/fmt-11.0.1.zip" 16 | sha256: "62ca45531814109b5d6cef0cf2fd17db92c32a30dd23012976e768c685534814" 17 | "11.0.0": 18 | url: "https://github.com/fmtlib/fmt/releases/download/11.0.0/fmt-11.0.0.zip" 19 | sha256: "583ce480ef07fad76ef86e1e2a639fc231c3daa86c4aa6bcba524ce908f30699" 20 | "10.2.1": 21 | url: "https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip" 22 | sha256: "312151a2d13c8327f5c9c586ac6cf7cddc1658e8f53edae0ec56509c8fa516c9" 23 | "10.2.0": 24 | url: "https://github.com/fmtlib/fmt/releases/download/10.2.0/fmt-10.2.0.zip" 25 | sha256: "8a942861a94f8461a280f823041cde8f620a6d8b0e0aacc98c15bb5a9dd92399" 26 | "10.1.1": 27 | url: "https://github.com/fmtlib/fmt/releases/download/10.1.1/fmt-10.1.1.zip" 28 | sha256: "b84e58a310c9b50196cda48d5678d5fa0849bca19e5fdba6b684f0ee93ed9d1b" 29 | "10.1.0": 30 | url: "https://github.com/fmtlib/fmt/releases/download/10.1.0/fmt-10.1.0.zip" 31 | sha256: "d725fa83a8b57a3cedf238828fa6b167f963041e8f9f7327649bddc68ae316f4" 32 | "10.0.0": 33 | url: "https://github.com/fmtlib/fmt/releases/download/10.0.0/fmt-10.0.0.zip" 34 | sha256: "4943cb165f3f587f26da834d3056ee8733c397e024145ca7d2a8a96bb71ac281" 35 | "9.1.0": 36 | url: "https://github.com/fmtlib/fmt/releases/download/9.1.0/fmt-9.1.0.zip" 37 | sha256: "cceb4cb9366e18a5742128cb3524ce5f50e88b476f1e54737a47ffdf4df4c996" 38 | "9.0.0": 39 | url: "https://github.com/fmtlib/fmt/releases/download/9.0.0/fmt-9.0.0.zip" 40 | sha256: "fc96dd2d2fdf2bded630787adba892c23cb9e35c6fd3273c136b0c57d4651ad6" 41 | "8.1.1": 42 | url: "https://github.com/fmtlib/fmt/releases/download/8.1.1/fmt-8.1.1.zip" 43 | sha256: "23778bad8edba12d76e4075da06db591f3b0e3c6c04928ced4a7282ca3400e5d" 44 | "8.0.1": 45 | url: "https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip" 46 | sha256: "a627a56eab9554fc1e5dd9a623d0768583b3a383ff70a4312ba68f94c9d415bf" 47 | "7.1.3": 48 | url: "https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip" 49 | sha256: "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f" 50 | "6.2.1": 51 | url: "https://github.com/fmtlib/fmt/releases/download/6.2.1/fmt-6.2.1.zip" 52 | sha256: "94fea742ddcccab6607b517f6e608b1e5d63d712ddbc5982e44bafec5279881a" 53 | "5.3.0": 54 | url: "https://github.com/fmtlib/fmt/releases/download/5.3.0/fmt-5.3.0.zip" 55 | sha256: "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c" 56 | patches: 57 | "5.3.0": 58 | - patch_file: "patches/fix-install-5.3.0.patch" 59 | -------------------------------------------------------------------------------- /src/common/openvr_config.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace openvr { 18 | 19 | // OpenVR defaults 20 | //------------------------------------------------------------------------------ 21 | static constexpr auto APP_TYPE = vr::VRApplication_Background; 22 | 23 | // clang-format off 24 | static const json VERB_PROPS = { 25 | {"Prop_TrackingSystemName_String", 0}, 26 | {"Prop_ModelNumber_String", 0}, 27 | {"Prop_SerialNumber_String", 0}, 28 | {"Prop_RenderModelName_String", 0}, 29 | {"Prop_ManufacturerName_String", 0}, 30 | {"Prop_TrackingFirmwareVersion_String", 0}, 31 | {"Prop_HardwareRevision_String", 0}, 32 | {"Prop_ConnectedWirelessDongle_String", 2}, 33 | {"Prop_DeviceIsWireless_Bool", 2}, 34 | {"Prop_DeviceIsCharging_Bool", 2}, 35 | {"Prop_DeviceBatteryPercentage_Float", 0}, 36 | {"Prop_Firmware_UpdateAvailable_Bool", 2}, 37 | {"Prop_Firmware_ManualUpdate_Bool", 2}, 38 | {"Prop_Firmware_ManualUpdateURL_String", 2}, 39 | {"Prop_HardwareRevision_Uint64", 2}, 40 | {"Prop_FirmwareVersion_Uint64", 2}, 41 | {"Prop_FPGAVersion_Uint64", 2}, 42 | {"Prop_VRCVersion_Uint64", 2}, 43 | {"Prop_RadioVersion_Uint64", 2}, 44 | {"Prop_DongleVersion_Uint64", 2}, 45 | {"Prop_DeviceProvidesBatteryStatus_Bool", 2}, 46 | {"Prop_Firmware_ProgrammingTarget_String", 2}, 47 | {"Prop_RegisteredDeviceType_String", 2}, 48 | {"Prop_InputProfilePath_String", 2}, 49 | {"Prop_SecondsFromVsyncToPhotons_Float", 2}, 50 | {"Prop_DisplayFrequency_Float", 0}, 51 | {"Prop_FieldOfViewLeftDegrees_Float", 2}, 52 | {"Prop_FieldOfViewRightDegrees_Float", 2}, 53 | {"Prop_FieldOfViewTopDegrees_Float", 2}, 54 | {"Prop_FieldOfViewBottomDegrees_Float", 2}, 55 | {"Prop_TrackingRangeMinimumMeters_Float", 2}, 56 | {"Prop_TrackingRangeMaximumMeters_Float", 2}, 57 | {"Prop_ModeLabel_String", 0} 58 | }; 59 | // clang-format on 60 | 61 | // clang-format off 62 | // currently identified properties with serial numbers 63 | static const json ANON_PROPS = { 64 | "Prop_SerialNumber_String", 65 | "Prop_AllWirelessDongleDescriptions_String", 66 | "Prop_ConnectedWirelessDongle_String", 67 | "Prop_Firmware_ProgrammingTarget_String", 68 | "Prop_RegisteredDeviceType_String" 69 | }; 70 | // clang-format on 71 | 72 | // OpenVR Config class (default config) 73 | //------------------------------------------------------------------------------ 74 | // Initialize the VR subsystem default config data 75 | Config::Config() 76 | : BaseVRConfig(j_openvr, std::make_shared()) 77 | { 78 | json& cfg = *m_pjData; 79 | cfg[j_app_type] = APP_TYPE; 80 | cfg[j_verbosity][j_properties] = VERB_PROPS; 81 | cfg[j_anonymize][j_properties] = ANON_PROPS; 82 | } 83 | 84 | } // namespace openvr 85 | -------------------------------------------------------------------------------- /cmake/utils.cmake: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.8) 13 | 14 | function (print_variables) 15 | message (STATUS "print_variables------------------------------------------{") 16 | message (STATUS "print_variables (\"${ARGV0}\")") 17 | if (${ARGC}) 18 | set (match ${ARGV0}) 19 | else() 20 | set (match "^.*$") 21 | endif() 22 | get_cmake_property (var_names VARIABLES) 23 | foreach (var_name ${var_names}) 24 | if (var_name MATCHES ${match}) 25 | message (STATUS "${var_name} = ${${var_name}}") 26 | endif() 27 | endforeach() 28 | message (STATUS "print_variables------------------------------------------}") 29 | endfunction() 30 | 31 | # Find DLL specified in 'dllname' in 'bin' and 'lib' subpaths 32 | function (find_dll var dllname) 33 | # check first the 'bin' paths 34 | unset (_dllpath) 35 | unset (_dllpath CACHE) 36 | find_program (_dllpath ${dllname}) 37 | if (NOT _dllpath) 38 | # now check the 'lib' paths 39 | set (CMAKE_FIND_LIBRARY_SUFFIXES "") 40 | find_library (_dllpath ${dllname}) 41 | set (CMAKE_FIND_LIBRARY_SUFFIXES .lib) 42 | if (NOT _dllpath) 43 | message (SEND_ERROR "find_dll(${var} ${dllname}) cannot find ${dllname}") 44 | endif() 45 | endif() 46 | set (${var} ${_dllpath} PARENT_SCOPE) 47 | message (STATUS "find_dll(${var} ${dllname}) -> ${_dllpath}") 48 | endfunction() 49 | 50 | # Find all DLLs specified after 'var' in 'bin' and 'lib' subpaths 51 | function (find_dlls var) 52 | foreach (dll IN ITEMS ${ARGN}) 53 | find_dll (dllpath ${dll}) 54 | list (APPEND dllpaths ${dllpath}) 55 | endforeach() 56 | set (${var} ${dllpaths} PARENT_SCOPE) 57 | endfunction() 58 | 59 | # Collect all DLLs for libs specified after 'tgt_name' 60 | # libs: are specified without any suffix 61 | # tgt_name: is the name of the target which requires the DLLs 62 | # found_dlls: will be copied into the same folder as the target binary. 63 | function (collect_dlls tgt_name) 64 | foreach (lib IN ITEMS ${ARGN}) 65 | add_library (${lib}_tgt SHARED IMPORTED) 66 | find_dll(dllpath "${lib}d.dll") 67 | set_property (TARGET ${lib}_tgt PROPERTY IMPORTED_LOCATION_DEBUG ${dllpath}) 68 | find_dll(dllpath "${lib}.dll") 69 | set_property (TARGET ${lib}_tgt PROPERTY IMPORTED_LOCATION_RELEASE ${dllpath}) 70 | set_property (TARGET ${lib}_tgt PROPERTY IMPORTED_LOCATION_RELWITHDEBINFO ${dllpath}) 71 | list (APPEND EXT_LIBS_DLLS "$") 72 | install (FILES "$" 73 | DESTINATION . 74 | ) 75 | endforeach() 76 | 77 | add_custom_command (TARGET ${tgt_name} 78 | POST_BUILD 79 | COMMAND ${CMAKE_COMMAND} -E copy_if_different 80 | ${EXT_LIBS_DLLS} 81 | $ 82 | ) 83 | endfunction() 84 | -------------------------------------------------------------------------------- /CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 5, 3 | "configurePresets": [ 4 | { 5 | "name": "arch_x64", 6 | "hidden": true, 7 | "architecture": { 8 | "value": "x64", 9 | "strategy": "external" 10 | } 11 | }, 12 | { 13 | "name": "generic-base", 14 | "hidden": true, 15 | "generator": "Ninja", 16 | "binaryDir": "${sourceDir}/out/build/${presetName}", 17 | "installDir": "${sourceDir}/out/install/${presetName}", 18 | "cacheVariables": { 19 | "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", 20 | "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/out/conan/${presetName}/conan_toolchain.cmake" 21 | } 22 | }, 23 | { 24 | "name": "clang-cl", 25 | "hidden": true, 26 | "cacheVariables": { 27 | "CMAKE_C_COMPILER": "clang-cl.exe", 28 | "CMAKE_CXX_COMPILER": "clang-cl.exe" 29 | }, 30 | "condition": { 31 | "type": "equals", 32 | "lhs": "${hostSystemName}", 33 | "rhs": "Windows" 34 | } 35 | }, 36 | { 37 | "name": "shared_libs", 38 | "hidden": true, 39 | "cacheVariables": { 40 | "BUILD_SHARED_LIBS": "ON" 41 | } 42 | }, 43 | { 44 | "name": "x64-DLL-Debug", 45 | "displayName": "x64-DLL-Debug", 46 | "inherits": ["generic-base", "arch_x64", "shared_libs"], 47 | "cacheVariables": { 48 | "CMAKE_BUILD_TYPE": "Debug" 49 | } 50 | }, 51 | { 52 | "name": "x64-DLL-Release", 53 | "displayName": "x64-DLL-Release", 54 | "inherits": ["generic-base", "arch_x64", "shared_libs"], 55 | "cacheVariables": { 56 | "CMAKE_BUILD_TYPE": "Release" 57 | } 58 | }, 59 | { 60 | "name": "x64-Static-Debug", 61 | "displayName": "x64-Static-Debug", 62 | "inherits": ["generic-base", "arch_x64"], 63 | "cacheVariables": { 64 | "CMAKE_BUILD_TYPE": "Debug" 65 | } 66 | }, 67 | { 68 | "name": "x64-Static-Release", 69 | "displayName": "x64-Static-Release", 70 | "inherits": ["generic-base", "arch_x64"], 71 | "cacheVariables": { 72 | "CMAKE_BUILD_TYPE": "Release" 73 | } 74 | }, 75 | { 76 | "name": "x64-xClang-Static-Debug", 77 | "displayName": "x64-xClang-Static-Debug", 78 | "inherits": ["clang-cl", "generic-base", "arch_x64"], 79 | "cacheVariables": { 80 | "CMAKE_BUILD_TYPE": "Debug", 81 | "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/out/conan/x64-Static-Debug/conan_toolchain.cmake" 82 | } 83 | }, 84 | { 85 | "name": "x64-xClang-Static-Release", 86 | "displayName": "x64-xClang-Static-Release", 87 | "inherits": ["clang-cl", "generic-base", "arch_x64"], 88 | "cacheVariables": { 89 | "CMAKE_BUILD_TYPE": "Release", 90 | "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/out/conan/x64-Static-Release/conan_toolchain.cmake" 91 | } 92 | } 93 | ], 94 | "buildPresets" : [ 95 | { 96 | "name": "x64-DLL-Debug", 97 | "configurePreset": "x64-DLL-Debug" 98 | }, 99 | { 100 | "name": "x64-DLL-Release", 101 | "configurePreset": "x64-DLL-Release" 102 | }, 103 | { 104 | "name": "x64-Static-Debug", 105 | "configurePreset": "x64-Static-Debug" 106 | }, 107 | { 108 | "name": "x64-Static-Release", 109 | "configurePreset": "x64-Static-Release" 110 | }, 111 | { 112 | "name": "x64-xClang-Static-Debug", 113 | "configurePreset": "x64-xClang-Static-Debug" 114 | }, 115 | { 116 | "name": "x64-xClang-Static-Release", 117 | "configurePreset": "x64-xClang-Static-Release" 118 | } 119 | ] 120 | } 121 | -------------------------------------------------------------------------------- /src/hmdv/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.15) 13 | 14 | include(utils) 15 | 16 | # Project def 17 | # ============ 18 | project (hmdv 19 | VERSION ${GIT_REPO_VERSION_MAJOR}.${GIT_REPO_VERSION_MINOR}.${GIT_REPO_VERSION_PATCH} 20 | DESCRIPTION "displaying hmdq output data in no time" 21 | HOMEPAGE_URL "https://github.com/risa2000/hmdq" 22 | ) 23 | 24 | # Dependencies 25 | # ============ 26 | find_package (clipp REQUIRED) 27 | find_package (fmt REQUIRED) 28 | find_package (nlohmann_json REQUIRED) 29 | find_package (xtensor REQUIRED) 30 | find_package (Eigen3 REQUIRED) 31 | find_package (openvr REQUIRED) 32 | find_package (botan REQUIRED) 33 | find_package (geos REQUIRED) 34 | 35 | # Custom files 36 | # ============ 37 | # copy the OpenVR API json file so the exe can run directly from there 38 | configure_file ( 39 | ${CMAKE_SOURCE_DIR}/api/openvr_api.json 40 | ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.json 41 | COPYONLY 42 | ) 43 | 44 | # needed for version info 45 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") 46 | set (VI_DEBUG ON) 47 | endif() 48 | 49 | # process version info and the icon 50 | configure_file ( 51 | ${CMAKE_CURRENT_SOURCE_DIR}/res/hmdv.rc.in 52 | ${CMAKE_CURRENT_BINARY_DIR}/hmdv.rc 53 | ) 54 | 55 | # prcess tool info 56 | configure_file ( 57 | ${CMAKE_CURRENT_SOURCE_DIR}/res/hmdv_misc.h.in 58 | ${CMAKE_CURRENT_BINARY_DIR}/hmdv_misc.h 59 | ) 60 | 61 | # Targets 62 | # ============ 63 | set (hmdv_SOURCES 64 | hmdv.cpp 65 | hmdfix.cpp 66 | ${CMAKE_CURRENT_BINARY_DIR}/hmdv.rc 67 | ) 68 | 69 | # 3rd party libs (linked as .lib, but needed as .dll in DLL CRT linkage) 70 | set (EXT_LIBS botan) 71 | 72 | # Add sources to `hmdv` executable. 73 | add_executable (hmdv ${hmdv_SOURCES}) 74 | target_include_directories (hmdv PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) 75 | 76 | target_link_libraries (hmdv PRIVATE build_proxy hmdq_common) 77 | target_link_libraries (hmdv PRIVATE version.lib) 78 | target_link_libraries (hmdv PRIVATE 79 | clipp::clipp 80 | fmt::fmt 81 | nlohmann_json::nlohmann_json 82 | xtensor 83 | Eigen3::Eigen 84 | botan::botan 85 | openvr::openvr 86 | GEOS::geos 87 | ) 88 | 89 | # Generate a binary dump for a quick check of a CRT linkage type 90 | add_custom_command (TARGET hmdv 91 | POST_BUILD 92 | COMMAND dumpbin /headers /symbols /imports "$" > "$.txt" 93 | ) 94 | 95 | # Check the CRT linkage, add DLLs if needed 96 | #if (${CMAKE_MSVC_RUNTIME_LIBRARY} MATCHES "^.*DLL>?$" OR NOT CMAKE_MSVC_RUNTIME_LIBRARY) 97 | # collect_dlls(hmdv ${EXT_LIBS}) 98 | #endif() 99 | 100 | # Install 101 | # ============ 102 | install (FILES 103 | ${CMAKE_SOURCE_DIR}/docs/images/hmdv_128.png 104 | DESTINATION ./docs/images 105 | ) 106 | 107 | install (TARGETS hmdv 108 | DESTINATION . 109 | ) 110 | 111 | print_variables ("hmdv_.*") 112 | -------------------------------------------------------------------------------- /conan/packages/xtl/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.errors import ConanInvalidConfiguration 3 | from conan.tools.build import check_min_cppstd 4 | from conan.tools.files import copy, get, save 5 | from conan.tools.layout import basic_layout 6 | import os 7 | import textwrap 8 | 9 | required_conan_version = ">=1.50.0" 10 | 11 | 12 | class XtlConan(ConanFile): 13 | name = "xtl" 14 | license = "BSD-3-Clause" 15 | url = "https://github.com/conan-io/conan-center-index" 16 | homepage = "https://github.com/xtensor-stack/xtl" 17 | description = "The x template library" 18 | topics = ("templates", "containers", "algorithms") 19 | settings = "os", "arch", "compiler", "build_type" 20 | no_copy_source = True 21 | 22 | @property 23 | def _compilers_minimum_version(self): 24 | return { 25 | "clang": "3.9", 26 | "gcc": "6", 27 | "Visual Studio": "15", 28 | "msvc": "191", 29 | } 30 | 31 | def package_id(self): 32 | self.info.clear() 33 | 34 | def validate(self): 35 | if self.settings.compiler.get_safe("cppstd"): 36 | check_min_cppstd(self, "14") 37 | 38 | def loose_lt_semver(v1, v2): 39 | lv1 = [int(v) for v in v1.split(".")] 40 | lv2 = [int(v) for v in v2.split(".")] 41 | min_length = min(len(lv1), len(lv2)) 42 | return lv1[:min_length] < lv2[:min_length] 43 | 44 | minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) 45 | if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): 46 | raise ConanInvalidConfiguration( 47 | f"{self.name} {self.version} requires C++14, which your compiler does not support.", 48 | ) 49 | 50 | def layout(self): 51 | basic_layout(self, src_folder="src") 52 | 53 | def source(self): 54 | get(self, **self.conan_data["sources"][self.version], 55 | destination=self.source_folder, strip_root=True) 56 | 57 | def build(self): 58 | pass 59 | 60 | def package(self): 61 | copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) 62 | copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) 63 | 64 | # TODO: to remove in conan v2 once cmake_find_package_* generators removed 65 | self._create_cmake_module_alias_targets( 66 | os.path.join(self.package_folder, self._module_file_rel_path), 67 | {"xtl": "xtl::xtl"}, 68 | ) 69 | 70 | def _create_cmake_module_alias_targets(self, module_file, targets): 71 | content = "" 72 | for alias, aliased in targets.items(): 73 | content += textwrap.dedent(f"""\ 74 | if(TARGET {aliased} AND NOT TARGET {alias}) 75 | add_library({alias} INTERFACE IMPORTED) 76 | set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) 77 | endif() 78 | """) 79 | save(self, module_file, content) 80 | 81 | @property 82 | def _module_file_rel_path(self): 83 | return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") 84 | 85 | def package_info(self): 86 | self.cpp_info.set_property("cmake_file_name", "xtl") 87 | self.cpp_info.set_property("cmake_target_name", "xtl") 88 | self.cpp_info.set_property("pkg_config_name", "xtl") 89 | self.cpp_info.bindirs = [] 90 | self.cpp_info.frameworkdirs = [] 91 | self.cpp_info.libdirs = [] 92 | self.cpp_info.resdirs = [] 93 | 94 | # TODO: to remove in conan v2 once cmake_find_package_* generators removed 95 | self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] 96 | self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] 97 | -------------------------------------------------------------------------------- /python/hmdv_batch.py: -------------------------------------------------------------------------------- 1 | import os 2 | import subprocess 3 | import sys 4 | 5 | from argparse import Namespace 6 | from collections import namedtuple 7 | from concurrent.futures import ThreadPoolExecutor 8 | from functools import partial 9 | from glob import glob 10 | from pathlib import Path 11 | from shutil import which 12 | 13 | # globals 14 | #------------------------------------------------------------------------------- 15 | COMMANDS = ['verify', 'transform'] 16 | DEFAULT_COMMAND = 'verify' 17 | HMDV_EXE = 'hmdv.exe' 18 | 19 | # classes 20 | #------------------------------------------------------------------------------- 21 | # result of the one datamark processing 22 | Result = namedtuple('Result', ('fpath', 'result', 'text')) 23 | 24 | # functions 25 | #------------------------------------------------------------------------------- 26 | def process_one_file(fpath: Path, args: Namespace) -> Result: 27 | """Process one hmdq data file.""" 28 | cargs = [args.hmdv_exe] 29 | if args.cmd == 'transform': 30 | #outfile = fpath.with_suffix('.hmdv.json') 31 | outfile = fpath 32 | cargs += ['all', '--out_json', str(outfile), f'-v{args.verbose}'] 33 | else: 34 | cargs += ['verify'] 35 | cargs.append(str(fpath)) 36 | if args.verbose > 0: 37 | print(f'Processing: {cargs}') 38 | res = subprocess.run(cargs, capture_output=True) 39 | tres = 'OK' if res.returncode == 0 else 'ERROR' 40 | text = f'[{tres}] {str(fpath)}' 41 | return Result(fpath, res.stdout, text) 42 | 43 | def process_one_file_done(future, results): 44 | """Print the data from the process_one_file. 45 | This is future callback attached by `future.add_done_callback`.""" 46 | res = future.result() 47 | print(res.text) 48 | results.append(res) 49 | 50 | def runner(args: Namespace) -> None: 51 | """run hmdv on each file in the directory structure""" 52 | ifiles = args.dir_path.rglob('*.json') 53 | # get the defaults for the render_hmdq.main 54 | results = [] 55 | if args.parallel: 56 | worker_count = os.cpu_count() * 3 // 2 57 | if args.verbose > 0: 58 | print(f'Running {worker_count} workers in parallel') 59 | with ThreadPoolExecutor(max_workers=worker_count) as e: 60 | for f in ifiles: 61 | future = e.submit(process_one_file, f, args) 62 | future.add_done_callback(partial(process_one_file_done, results=results)) 63 | else: 64 | for f in ifiles: 65 | result = process_one_file(f, args) 66 | results.append(result) 67 | print(result.text) 68 | print('Finished...') 69 | print() 70 | for r in results: 71 | if not r.result: 72 | print(f'ERROR: {r.text}') 73 | return results 74 | 75 | # main 76 | #------------------------------------------------------------------------------- 77 | if __name__ == '__main__': 78 | 79 | from argparse import ArgumentParser 80 | 81 | ap = ArgumentParser(description='run hmdv on a directory for verify or transform.') 82 | 83 | ap.add_argument('cmd', default=DEFAULT_COMMAND, choices=COMMANDS, help=f'command [%(default)s] out of {COMMANDS}') 84 | ap.add_argument('dir_path', help='input file/directory with JSON data files') 85 | ap.add_argument('-v', '--verbose', action='count', default=0, help='verbose level [%(default)s]') 86 | ap.add_argument('-p', '--parallel', action='store_true', help='run parallel jobs') 87 | ap.add_argument('-x', '--hmdv_exe', help='path to hmdv executable [%(default)s]', default=HMDV_EXE) 88 | 89 | args = ap.parse_args() 90 | args.prog_dir = Path(sys.argv[0]).parent 91 | 92 | if Path(args.dir_path).exists(): 93 | args.dir_path = Path(args.dir_path) 94 | else: 95 | print(f'Directory {args.dir_path} does not exist', file=sys.stderr) 96 | sys.exit(1) 97 | 98 | args.hmdv_exe = which(args.hmdv_exe) 99 | 100 | runner(args) 101 | 102 | -------------------------------------------------------------------------------- /src/common/jtools.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | #include 21 | 22 | // globals 23 | //------------------------------------------------------------------------------ 24 | // Checksum pre-defs 25 | constexpr int CHKSUM_BITSIZE = 128; 26 | 27 | // Anonymizing pre-defs 28 | constexpr auto ANON_BITSIZE = 96; 29 | 30 | // JSON file I/O 31 | //------------------------------------------------------------------------------ 32 | // Extract relevant data from OpenVR API 33 | json read_json(const std::filesystem::path& inpath); 34 | 35 | // Save JSON data into file with indentation. 36 | void write_json(const std::filesystem::path& outpath, const json& jdata, int indent); 37 | 38 | // JSON data manipulation 39 | //------------------------------------------------------------------------------ 40 | // Remove all properties with errors reported from the dict. 41 | void purge_jdprops_errors(json& jd); 42 | 43 | // Add an error message to JSON item 44 | void add_error(json& jd, const char* msg); 45 | 46 | // Add an error message to JSON item 47 | void add_error(json& jd, const std::string& msg); 48 | 49 | // Add an error message to JSON item in an array container 50 | void add_error_array(json& jd, const char* msg); 51 | 52 | // Check for the error in JSON item 53 | inline bool has_error(const json& jd) 54 | { 55 | return jd.contains(ERROR_PREFIX); 56 | } 57 | 58 | // Return the error 59 | inline json get_error(const json& jd) 60 | { 61 | HMDQ_ASSERT(jd.contains(ERROR_PREFIX)); 62 | return jd.at(ERROR_PREFIX); 63 | } 64 | 65 | // Return the error message 66 | std::string get_error_msg(const json& jd); 67 | 68 | // Make error object 69 | inline json make_error_obj(const std::string& msg) 70 | { 71 | return json::object({{ERROR_PREFIX, msg}}); 72 | } 73 | 74 | // Anonymize functions 75 | //------------------------------------------------------------------------------ 76 | // Anonymize the message in `in` to `out` 77 | void anonymize(std::vector& out, const std::vector& in); 78 | 79 | // Anonymize properties in JSON list 80 | void anonymize_jdprops(json& jdprops, const std::vector& anon_prop_names, 81 | const std::vector& seed_prop_names); 82 | 83 | // Checksum functions 84 | //------------------------------------------------------------------------------ 85 | // Calculate the hash over the JSON string dump using Blake2b(CHKSUM_BITSIZE). 86 | // The returned value is an upper case string of a binhex encoded hash. 87 | std::string calculate_checksum(const json& jd); 88 | 89 | // Verify the checksum in the JSON dics (if there is one) 90 | bool verify_checksum(const json& jd); 91 | 92 | // Add secure checksum to the JSON dict. 93 | inline void add_checksum(json& jd) 94 | { 95 | // just do it 96 | jd[j_checksum] = calculate_checksum(jd); 97 | } 98 | 99 | // Verify if the file has the checksum written in it 100 | inline bool has_checksum(const json& jd) 101 | { 102 | return jd.count(j_checksum); 103 | } 104 | -------------------------------------------------------------------------------- /src/hmdq/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------------------------+ 2 | # HMDQ Tools - tools for VR headsets and other hardware introspection | 3 | # https://github.com/risa2000/hmdq | 4 | # | 5 | # Copyright (c) 2019, Richard Musil. All rights reserved. | 6 | # | 7 | # This source code is licensed under the BSD 3-Clause "New" or "Revised" | 8 | # License found in the LICENSE file in the root directory of this project. | 9 | # SPDX-License-Identifier: BSD-3-Clause | 10 | #----------------------------------------------------------------------------+ 11 | 12 | cmake_minimum_required (VERSION 3.15) 13 | 14 | include(utils) 15 | 16 | # Project def 17 | # ============ 18 | project (hmdq 19 | VERSION ${GIT_REPO_VERSION_MAJOR}.${GIT_REPO_VERSION_MINOR}.${GIT_REPO_VERSION_PATCH} 20 | DESCRIPTION "collecting VR headsets characteristics in no time" 21 | HOMEPAGE_URL "https://github.com/risa2000/hmdq" 22 | ) 23 | 24 | # Dependencies 25 | # ============ 26 | find_package (clipp REQUIRED) 27 | find_package (fmt REQUIRED) 28 | find_package (nlohmann_json REQUIRED) 29 | find_package (xtensor REQUIRED) 30 | find_package (Eigen3 REQUIRED) 31 | find_package (openvr REQUIRED) 32 | find_package (botan REQUIRED) 33 | find_package (geos REQUIRED) 34 | 35 | # Custom files 36 | # ============ 37 | # copy the OpenVR API json file so the exe can run directly from there 38 | configure_file ( 39 | ${CMAKE_SOURCE_DIR}/api/openvr_api.json 40 | ${CMAKE_CURRENT_BINARY_DIR}/openvr_api.json 41 | COPYONLY 42 | ) 43 | 44 | # copy the batch file to save the hmdq data into .json file 45 | configure_file ( 46 | ${CMAKE_SOURCE_DIR}/res/save_data.cmd 47 | ${CMAKE_CURRENT_BINARY_DIR}/save_data.cmd 48 | COPYONLY 49 | ) 50 | 51 | # needed for version info 52 | if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") 53 | set (VI_DEBUG ON) 54 | endif() 55 | 56 | # process version info and the icon 57 | configure_file ( 58 | ${CMAKE_CURRENT_SOURCE_DIR}/res/hmdq.rc.in 59 | ${CMAKE_CURRENT_BINARY_DIR}/hmdq.rc 60 | ) 61 | 62 | # prcess tool info 63 | configure_file ( 64 | ${CMAKE_CURRENT_SOURCE_DIR}/res/hmdq_misc.h.in 65 | ${CMAKE_CURRENT_BINARY_DIR}/hmdq_misc.h 66 | ) 67 | 68 | # Targets 69 | # ============ 70 | set (hmdq_SOURCES 71 | hmdq.cpp 72 | oculus_collector.cpp 73 | openvr_collector.cpp 74 | ${CMAKE_CURRENT_BINARY_DIR}/hmdq.rc 75 | ) 76 | 77 | # 3rd party libs (linked as .lib, but needed as .dll in DLL CRT linkage) 78 | set (EXT_LIBS botan openvr_api64) 79 | 80 | # Add sources to `hmdq` executable. 81 | add_executable (hmdq ${hmdq_SOURCES}) 82 | target_include_directories (hmdq PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) 83 | 84 | target_link_libraries (hmdq PRIVATE build_proxy hmdq_common) 85 | target_link_libraries (hmdq PRIVATE version.lib) 86 | target_link_libraries (hmdq PRIVATE 87 | clipp::clipp 88 | fmt::fmt 89 | nlohmann_json::nlohmann_json 90 | xtensor 91 | Eigen3::Eigen 92 | openvr::openvr 93 | botan::botan 94 | GEOS::geos 95 | ) 96 | 97 | if (OVR_SDK) 98 | target_link_libraries (hmdq PRIVATE LibOVR) 99 | endif() 100 | 101 | # Generate a binary dump for a quick check of a CRT linkage type 102 | add_custom_command (TARGET hmdq 103 | POST_BUILD 104 | COMMAND dumpbin /headers /symbols /imports "$" > "$.txt" 105 | ) 106 | 107 | # Check the CRT linkage, add DLLs if needed 108 | #if (${CMAKE_MSVC_RUNTIME_LIBRARY} MATCHES "^.*DLL>?$" OR NOT CMAKE_MSVC_RUNTIME_LIBRARY) 109 | # collect_dlls(hmdq ${EXT_LIBS}) 110 | #endif() 111 | 112 | # Install 113 | # ============ 114 | install (FILES 115 | ${CMAKE_SOURCE_DIR}/docs/images/hmdq_128.png 116 | DESTINATION ./docs/images 117 | ) 118 | 119 | install (TARGETS hmdq 120 | DESTINATION . 121 | ) 122 | 123 | print_variables ("eigen3_.*") 124 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | Language: Cpp 3 | # BasedOnStyle: WebKit 4 | AccessModifierOffset: -2 5 | AlignAfterOpenBracket: Align 6 | # AlignConsecutiveMacros: false 7 | AlignConsecutiveAssignments: false 8 | AlignConsecutiveDeclarations: false 9 | AlignEscapedNewlines: Right 10 | AlignOperands: false 11 | AlignTrailingComments: false 12 | AllowAllArgumentsOnNextLine: true 13 | AllowAllConstructorInitializersOnNextLine: true 14 | AllowAllParametersOfDeclarationOnNextLine: true 15 | AllowShortBlocksOnASingleLine: false 16 | AllowShortCaseLabelsOnASingleLine: false 17 | AllowShortFunctionsOnASingleLine: Empty 18 | AllowShortLambdasOnASingleLine: All 19 | AllowShortIfStatementsOnASingleLine: Never 20 | AllowShortLoopsOnASingleLine: false 21 | AlwaysBreakAfterDefinitionReturnType: None 22 | AlwaysBreakAfterReturnType: None 23 | AlwaysBreakBeforeMultilineStrings: false 24 | AlwaysBreakTemplateDeclarations: Yes 25 | BinPackArguments: true 26 | BinPackParameters: true 27 | BraceWrapping: 28 | AfterCaseLabel: false 29 | AfterClass: true 30 | AfterControlStatement: false 31 | AfterEnum: false 32 | AfterFunction: true 33 | AfterNamespace: false 34 | AfterObjCDeclaration: false 35 | AfterStruct: false 36 | AfterUnion: false 37 | AfterExternBlock: false 38 | BeforeCatch: false 39 | BeforeElse: false 40 | IndentBraces: false 41 | SplitEmptyFunction: false 42 | SplitEmptyRecord: false 43 | SplitEmptyNamespace: false 44 | BreakBeforeBinaryOperators: All 45 | BreakBeforeBraces: Custom 46 | BreakBeforeInheritanceComma: false 47 | BreakInheritanceList: BeforeColon 48 | BreakBeforeTernaryOperators: true 49 | BreakConstructorInitializersBeforeComma: true 50 | BreakConstructorInitializers: BeforeColon 51 | BreakAfterJavaFieldAnnotations: false 52 | BreakStringLiterals: true 53 | ColumnLimit: 90 54 | CommentPragmas: '^ IWYU pragma:' 55 | CompactNamespaces: true 56 | ConstructorInitializerAllOnOneLineOrOnePerLine: false 57 | ConstructorInitializerIndentWidth: 4 58 | ContinuationIndentWidth: 4 59 | Cpp11BracedListStyle: true 60 | DerivePointerAlignment: false 61 | DisableFormat: false 62 | ExperimentalAutoDetectBinPacking: false 63 | FixNamespaceComments: true 64 | ForEachMacros: 65 | - foreach 66 | - Q_FOREACH 67 | - BOOST_FOREACH 68 | IncludeBlocks: Preserve 69 | IncludeCategories: 70 | - Regex: '^"(llvm|llvm-c|clang|clang-c)/' 71 | Priority: 2 72 | - Regex: '^(<|"(gtest|gmock|isl|json)/)' 73 | Priority: 3 74 | - Regex: '.*' 75 | Priority: 1 76 | IncludeIsMainRegex: '(Test)?$' 77 | IndentCaseLabels: true 78 | IndentPPDirectives: None 79 | IndentWidth: 4 80 | IndentWrappedFunctionNames: false 81 | JavaScriptQuotes: Leave 82 | JavaScriptWrapImports: true 83 | KeepEmptyLinesAtTheStartOfBlocks: true 84 | MacroBlockBegin: '' 85 | MacroBlockEnd: '' 86 | MaxEmptyLinesToKeep: 1 87 | NamespaceIndentation: Inner 88 | ObjCBinPackProtocolList: Auto 89 | ObjCBlockIndentWidth: 2 90 | ObjCSpaceAfterProperty: false 91 | ObjCSpaceBeforeProtocolList: true 92 | PenaltyBreakAssignment: 2 93 | PenaltyBreakBeforeFirstCallParameter: 19 94 | PenaltyBreakComment: 300 95 | PenaltyBreakFirstLessLess: 120 96 | PenaltyBreakString: 1000 97 | PenaltyBreakTemplateDeclaration: 10 98 | PenaltyExcessCharacter: 1000000 99 | PenaltyReturnTypeOnItsOwnLine: 60 100 | PointerAlignment: Left 101 | ReflowComments: true 102 | SortIncludes: true 103 | SortUsingDeclarations: true 104 | SpaceAfterCStyleCast: false 105 | SpaceAfterLogicalNot: false 106 | SpaceAfterTemplateKeyword: true 107 | SpaceBeforeAssignmentOperators: true 108 | SpaceBeforeCpp11BracedList: false 109 | SpaceBeforeCtorInitializerColon: true 110 | SpaceBeforeInheritanceColon: true 111 | SpaceBeforeParens: ControlStatements 112 | SpaceBeforeRangeBasedForLoopColon: true 113 | SpaceInEmptyParentheses: false 114 | SpacesBeforeTrailingComments: 1 115 | SpacesInAngles: false 116 | SpacesInContainerLiterals: false 117 | SpacesInCStyleCastParentheses: false 118 | SpacesInParentheses: false 119 | SpacesInSquareBrackets: false 120 | Standard: Cpp11 121 | StatementMacros: 122 | - Q_UNUSED 123 | - QT_REQUIRE_VERSION 124 | TabWidth: 8 125 | UseTab: Never 126 | ... 127 | 128 | -------------------------------------------------------------------------------- /src/hmdq_test/geos_test.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2025, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | /* For geometry operations */ 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | /* For WKT read/write */ 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | // global setup 32 | //------------------------------------------------------------------------------ 33 | /* New factory with default (float) precision model */ 34 | geos::geom::GeometryFactory::Ptr factory = geos::geom::GeometryFactory::create(); 35 | 36 | /* 37 | * Reader requires a factory to bind the geometry to 38 | * for shared resources like the PrecisionModel 39 | */ 40 | geos::io::WKTReader reader(*factory); 41 | /* Convert Geometry to WKT */ 42 | geos::io::WKTWriter writer; 43 | 44 | /* Input WKT strings */ 45 | std::string wkt_a("POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))"); 46 | std::string wkt_b("POLYGON ((5 5, 15 5, 15 15, 5 15, 5 5))"); 47 | 48 | /* Convert WKT to Geometry */ 49 | std::unique_ptr geom_a(reader.read(wkt_a)); 50 | std::unique_ptr geom_b(reader.read(wkt_b)); 51 | 52 | // tests 53 | //------------------------------------------------------------------------------ 54 | TEST_CASE("GEOS testing", "[geos]") 55 | { 56 | SECTION("intersection", "[polygons]") 57 | { 58 | /* Calculate intersection */ 59 | std::unique_ptr inter = geom_a->intersection(geom_b.get()); 60 | 61 | writer.setTrim(true); /* Only needed before GEOS 3.12 */ 62 | std::string inter_wkt = writer.write(inter.get()); 63 | 64 | /* Print out results */ 65 | fmt::print("Geometry A: {}\n", wkt_a); 66 | fmt::print("Geometry B: {}\n", wkt_b); 67 | fmt::print("Intersection(A, B): {}\n", inter_wkt); 68 | } 69 | 70 | SECTION("surface", "[polygons]") 71 | { 72 | auto surf_a = geom_a->getArea(); 73 | auto surf_b = geom_b->getArea(); 74 | 75 | /* Calculate intersection */ 76 | std::unique_ptr inter = geom_a->intersection(geom_b.get()); 77 | auto surf_i = inter->getArea(); 78 | 79 | /* Print out results */ 80 | fmt::print("Surface A: {}\n", surf_a); 81 | fmt::print("Surface B: {}\n", surf_b); 82 | fmt::print("Surface (A, B): {}\n", surf_i); 83 | } 84 | 85 | SECTION("intersection", "[triangles]") 86 | { 87 | using namespace geos::geom; 88 | 89 | auto t1{factory->createPolygon( 90 | CoordinateSequence({CoordinateXY{0, 0}, CoordinateXY{1, 0}, 91 | CoordinateXY{0, 1}, CoordinateXY{0, 0}}))}; 92 | auto canvas{factory->createPolygon(CoordinateSequence( 93 | {CoordinateXY{0, 0}, CoordinateXY{0, 1}, CoordinateXY{1, 1}, 94 | CoordinateXY{1, 0}, CoordinateXY{0, 0}}))}; 95 | auto isect = canvas->intersection(t1.get()); 96 | std::string isect_wkt = writer.write(isect.get()); 97 | 98 | /* Print out results */ 99 | fmt::print("Triangle A: {}\n", writer.write(t1.get())); 100 | fmt::print("Polygon B: {}\n", writer.write(canvas.get())); 101 | fmt::print("Intersection(A, B): {}\n", writer.write(isect.get())); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/common/openvr_common.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | namespace openvr { 18 | 19 | // globals 20 | //------------------------------------------------------------------------------ 21 | // Eye nomenclature 22 | const heyes_t EYES = {{vr::Eye_Left, j_leye}, {vr::Eye_Right, j_reye}}; 23 | 24 | // generic functions 25 | //------------------------------------------------------------------------------ 26 | // Return the version of the OpenVR API used in the build. 27 | std::tuple get_sdk_ver() 28 | { 29 | return {vr::k_nSteamVRVersionMajor, vr::k_nSteamVRVersionMinor, 30 | vr::k_nSteamVRVersionBuild}; 31 | } 32 | 33 | // Parse OpenVR JSON API definition, where jd = json.load("openvr_api.json") 34 | json parse_json_oapi(const json& jd) 35 | { 36 | json tdprops; 37 | json tdcls; 38 | for (const auto& e : jd[j_enums]) { 39 | if (e[j_enumname].get() == "vr::ETrackedDeviceProperty") { 40 | for (const auto& v : e[j_values]) { 41 | const auto name = v[j_name].get(); 42 | // val type is actually vr::ETrackedDeviceProperty 43 | const auto val = std::stoi(v[j_value].get()); 44 | const auto cat = static_cast(val) / 1000; 45 | tdprops[std::to_string(cat)][std::to_string(val)] = name; 46 | tdprops[j_name2id][name] = val; 47 | } 48 | } else if (e[j_enumname].get() == "vr::ETrackedDeviceClass") { 49 | for (const auto& v : e[j_values]) { 50 | auto name = v[j_name].get(); 51 | // val type is actually vr::ETrackedDeviceClass 52 | const auto val = std::stoi(v[j_value].get()); 53 | const auto fs = name.find('_'); 54 | if (fs != std::string::npos) { 55 | name = name.substr(fs + 1, std::string::npos); 56 | } 57 | tdcls[std::to_string(val)] = name; 58 | } 59 | } 60 | } 61 | return json({{j_classes, tdcls}, {j_properties, tdprops}}); 62 | } 63 | 64 | // Convert common property types to OpenVR property types 65 | vr::PropertyTypeTag_t ptype_to_ptag(basevr::PropType ptype) 66 | { 67 | switch (ptype) { 68 | case basevr::PropType::Float: 69 | return vr::k_unFloatPropertyTag; 70 | case basevr::PropType::Double: 71 | return vr::k_unDoublePropertyTag; 72 | case basevr::PropType::Int32: 73 | return vr::k_unInt32PropertyTag; 74 | case basevr::PropType::Uint64: 75 | return vr::k_unUint64PropertyTag; 76 | case basevr::PropType::Bool: 77 | return vr::k_unBoolPropertyTag; 78 | case basevr::PropType::String: 79 | return vr::k_unStringPropertyTag; 80 | case basevr::PropType::Vector2: 81 | return vr::k_unHmdVector2PropertyTag; 82 | case basevr::PropType::Vector3: 83 | return vr::k_unHmdVector3PropertyTag; 84 | case basevr::PropType::Vector4: 85 | return vr::k_unHmdVector4PropertyTag; 86 | case basevr::PropType::Matrix34: 87 | return vr::k_unHmdMatrix34PropertyTag; 88 | case basevr::PropType::Matrix44: 89 | return vr::k_unHmdMatrix44PropertyTag; 90 | case basevr::PropType::Quad: 91 | return vr::k_unHmdQuadPropertyTag; 92 | default: 93 | return vr::k_unInvalidPropertyTag; 94 | } 95 | } 96 | 97 | } // namespace openvr 98 | -------------------------------------------------------------------------------- /src/common/base_classes.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | 19 | #include 20 | #include 21 | 22 | // forward declarations 23 | //------------------------------------------------------------------------------ 24 | class BaseVRProcessor; 25 | class BaseVRCollector; 26 | class BaseVRConfig; 27 | 28 | // typedefs 29 | //------------------------------------------------------------------------------ 30 | // collector buffer 31 | typedef nlohmann::ordered_map> colmap_t; 32 | // processor buffer 33 | typedef nlohmann::ordered_map> procmap_t; 34 | // config buffer 35 | typedef nlohmann::ordered_map> cfgmap_t; 36 | 37 | // BaseVR class 38 | //------------------------------------------------------------------------------ 39 | class BaseVR 40 | { 41 | protected: 42 | BaseVR(const char* id, const std::shared_ptr& pjdata) 43 | : m_id(id) 44 | , m_pjData(pjdata) 45 | {} 46 | 47 | // Use virtual destructor to ensure proper object destruction 48 | virtual ~BaseVR() = default; 49 | 50 | public: 51 | // Return VR subystem ID 52 | virtual const std::string& get_id() const final 53 | { 54 | return m_id; 55 | } 56 | // Return VR subystem data 57 | virtual std::shared_ptr get_data() final 58 | { 59 | return m_pjData; 60 | } 61 | 62 | protected: 63 | // Collected data 64 | std::shared_ptr m_pjData; 65 | // Subsystem id 66 | const std::string m_id; 67 | }; 68 | 69 | // BaseVRConfig class 70 | //------------------------------------------------------------------------------ 71 | class BaseVRConfig : public BaseVR 72 | { 73 | protected: 74 | BaseVRConfig(const char* id, const std::shared_ptr& pjdata) 75 | : BaseVR(id, pjdata) 76 | {} 77 | }; 78 | 79 | // BaseVRProcessor class 80 | //------------------------------------------------------------------------------ 81 | class BaseVRProcessor : public BaseVR 82 | { 83 | protected: 84 | BaseVRProcessor(const char* id, const std::shared_ptr& pjdata) 85 | : BaseVR(id, pjdata) 86 | {} 87 | 88 | public: 89 | // Initialize the VR subsystem data processor 90 | virtual bool init() = 0; 91 | // Calculate complementary data 92 | virtual void calculate() = 0; 93 | // Anonymize sensitive data 94 | virtual void anonymize() = 0; 95 | // Print the collected data 96 | // mode: props, geom, all 97 | // verb: verbosity 98 | // ind: indentation 99 | // ts: indent (tab) size 100 | virtual void print(const print_options& opts, int ind, int ts) const = 0; 101 | // Clean up the (temporary) data before saving 102 | virtual void purge() = 0; 103 | }; 104 | 105 | // BaseVRCollector class 106 | //------------------------------------------------------------------------------ 107 | class BaseVRCollector : public BaseVR 108 | { 109 | protected: 110 | BaseVRCollector(const char* id, const std::shared_ptr& pjdata) 111 | : BaseVR(id, pjdata) 112 | {} 113 | 114 | public: 115 | // Check if the VR subsystem is present and initialize it 116 | // Return: true if present and initialized, otherwise false 117 | virtual bool try_init() = 0; 118 | // Collect the VR subsystem data 119 | virtual void collect() = 0; 120 | // Return the last VR subsystem error 121 | virtual int get_last_error() const = 0; 122 | // Return the last VR subsystem error message 123 | virtual std::string get_last_error_msg() const = 0; 124 | }; 125 | -------------------------------------------------------------------------------- /src/common/geom2.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #pragma once 13 | 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #include 22 | 23 | namespace geom { 24 | 25 | // globals 26 | //------------------------------------------------------------------------------ 27 | constexpr double DOUBLE_EPS_100 = std::numeric_limits::epsilon() * 100; 28 | constexpr double DOUBLE_MAX = std::numeric_limits::max(); 29 | 30 | // typedefs 31 | //------------------------------------------------------------------------------ 32 | using Point3 = Eigen::Vector; 33 | using Plane = Eigen::Hyperplane; 34 | using Line = Eigen::ParametrizedLine; 35 | using Rotation = Eigen::AngleAxis; 36 | using Transform2 = Eigen::Transform; 37 | using Point3Array = std::vector>; 38 | using PlaneArray = std::vector; 39 | 40 | // helper functions 41 | //------------------------------------------------------------------------------ 42 | // Convert faces to edges 43 | hedgelist_t faces_to_edges(const hfaces_t& faces); 44 | // Calculate point "polarity" to the plane (whether it is above, below, or in the plane) 45 | int polarity(const Plane& plane, const Point3& point); 46 | 47 | // class Meshd 48 | //------------------------------------------------------------------------------ 49 | // Calculates the frustum FOV while incorporating the hidden area mesh (HAM) if present. 50 | class Meshd 51 | { 52 | public: 53 | Meshd() = default; 54 | Meshd(const Meshd& mesh) = default; 55 | Meshd(const harray2d_t& verts, const hedgelist_t& edges) 56 | : m_edges(edges) 57 | , m_verts(verts) 58 | {} 59 | 60 | // Add another mesh to this to form one mesh 61 | void add_mesh(const harray2d_t& verts, const hedgelist_t& edges); 62 | 63 | const harray2d_t& get_verts() const 64 | { 65 | return m_verts; 66 | } 67 | 68 | const hedgelist_t& get_edges() const 69 | { 70 | return m_edges; 71 | } 72 | 73 | private: 74 | harray2d_t m_verts; 75 | hedgelist_t m_edges; 76 | }; 77 | 78 | // class Frustum 79 | //------------------------------------------------------------------------------ 80 | // Calculates the frustum FOV while incorporating the hidden area mesh (HAM) if present. 81 | class Frustum 82 | { 83 | public: 84 | Frustum(double left, double right, double bottom, double top, 85 | const Rotation* pRot = nullptr, const Meshd* pHam = nullptr); 86 | 87 | // Calculate all FOV points and put them into one array (LB, B, RB, ..) 88 | harray2d_t get_fov_points(bool projected = false); 89 | 90 | private: 91 | // Construct plane which cuts the frustum through center, given point and is aligned 92 | // with the view direction (vector forward). 93 | Plane get_point_plane(const Point3& point) 94 | { 95 | return Plane::Through(m_center, point, m_forward); 96 | } 97 | 98 | // Create transformation from UV space into frustum LRBT rectangle 99 | Transform2 get_uv_to_lrbt_transform() 100 | { 101 | Transform2 res = Eigen::Translation2d(m_leftTan, m_bottomTan) 102 | * Eigen::Scaling(m_rightTan - m_leftTan, m_topTan - m_bottomTan); 103 | return res; 104 | } 105 | 106 | // Build 3D representation of the HAM inside the frustum from 2D UV definition 107 | void get_ham_3d(const Meshd& ham2d, Meshd& ham3d); 108 | 109 | // Calculate one "raw" FOV point as an intersection of a "point-plane" and the HAM 110 | Point3 get_raw_fov_point(size_t n); 111 | 112 | private: 113 | double m_leftTan; 114 | double m_rightTan; 115 | double m_bottomTan; 116 | double m_topTan; 117 | 118 | Point3 m_center; 119 | Point3 m_forward; 120 | Point3 m_leftBottom; 121 | Point3 m_bottom; 122 | Point3 m_rightBottom; 123 | Point3 m_right; 124 | Point3 m_rightTop; 125 | Point3 m_top; 126 | Point3 m_leftTop; 127 | Point3 m_left; 128 | 129 | const Rotation* m_pRot; 130 | Meshd m_ham3d; 131 | 132 | Point3Array m_outPoints; 133 | PlaneArray m_pointPlanes; 134 | 135 | std::vector m_polarityPlaneIndexes; 136 | }; 137 | 138 | } // namespace geom 139 | -------------------------------------------------------------------------------- /src/hmdq_test/geom_test.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2019, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | 14 | #include 15 | #include 16 | 17 | #define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this 18 | // in one cpp file 19 | #include 20 | 21 | // global setup 22 | //------------------------------------------------------------------------------ 23 | // generic test samples 24 | static const hvector_t o2 = {0, 0}; 25 | static const hvector_t a1 = {1, 0}; 26 | static const hvector_t a2 = {1, 1}; 27 | static const hvector_t a3 = {0, 1}; 28 | static const hvector_t a4 = {-1, 1}; 29 | static const hvector_t a5 = {-1, 0}; 30 | static const hvector_t a6 = {-1, -1}; 31 | static const hvector_t a7 = {0, -1}; 32 | static const hvector_t a8 = {1, -1}; 33 | 34 | static const hvector_t o3 = {0, 0, 0}; 35 | static const hvector_t b1 = {1, 0, 0}; 36 | static const hvector_t b2 = {1, 1, 1}; 37 | static const hvector_t b3 = {0, 1, 0}; 38 | static const hvector_t b4 = {-1, 1, -1}; 39 | static const hvector_t b5 = {-1, 0, 1}; 40 | static const hvector_t b6 = {-1, -1, -1}; 41 | static const hvector_t b7 = {0, -1, 0}; 42 | static const hvector_t b8 = {1, -1, 0}; 43 | 44 | static constexpr auto PI = xt::numeric_constants::PI; 45 | 46 | static harray2d_t mat1 = {{1, 2}, {3, 5}}; 47 | static harray2d_t mat2 = {{4, 10}, {2, 5}}; 48 | static harray2d_t mat3 = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; 49 | 50 | // tests 51 | //------------------------------------------------------------------------------ 52 | TEST_CASE("geometry module", "[geometry]") 53 | { 54 | SECTION("radians to degrees", "[rad_to_deg]") 55 | { 56 | 57 | REQUIRE(degrees(PI) == 180); 58 | REQUIRE(degrees(0) == 0); 59 | REQUIRE(degrees(PI / 2) == 90); 60 | } 61 | 62 | SECTION("vector dot product", "[dot_prod]") 63 | { 64 | REQUIRE(dot_prod(a2, o2) == 0); 65 | REQUIRE(dot_prod(a1, a3) == 0); 66 | REQUIRE(dot_prod(a2, a6) == -2); 67 | REQUIRE(dot_prod(a4, a5) == 1); 68 | REQUIRE(dot_prod(a7, a8) == 1); 69 | 70 | REQUIRE(dot_prod(b1, b2) == 1); 71 | REQUIRE(dot_prod(b2, b2) == 3); 72 | REQUIRE(dot_prod(b6, b6) == 3); 73 | REQUIRE(dot_prod(b5, b4) == 0); 74 | REQUIRE(dot_prod(o3, b7) == 0); 75 | } 76 | 77 | SECTION("vector magnitude", "[norm]") 78 | { 79 | REQUIRE(gnorm(o2) == 0.0); 80 | REQUIRE(gnorm(a1) == 1.0); 81 | REQUIRE(gnorm(a2) == 1.4142135623730951); 82 | REQUIRE(gnorm(a4) == 1.4142135623730951); 83 | REQUIRE(gnorm(a7) == 1.0); 84 | REQUIRE(gnorm(a8) == 1.4142135623730951); 85 | } 86 | 87 | SECTION("vector angle", "[angle]") 88 | { 89 | REQUIRE(angle(a1, a2) == 0.7853981633974484); 90 | REQUIRE(std::isnan(angle(o2, a3))); 91 | REQUIRE(angle(a3, a3) == 0); 92 | REQUIRE(angle(b1, b2) == 0.9553166181245092); 93 | REQUIRE(angle(b4, b6) == 1.2309594173407747); 94 | REQUIRE(angle(b2, b6) == PI); 95 | } 96 | 97 | SECTION("vector angle degrees", "[angle_deg]") 98 | { 99 | using Approx = Catch::Approx; 100 | REQUIRE(angle_deg(b7, b8) == Approx(45.0)); 101 | REQUIRE(std::isnan(angle(o3, b1))); 102 | REQUIRE(angle_deg(b1, b3) == Approx(90.0)); 103 | REQUIRE(angle_deg(b4, b5) == angle_deg(b5, b4)); 104 | REQUIRE(angle(b2, b6) == angle(b6, b2)); 105 | REQUIRE(angle(b1, b8) == angle(b8, b1)); 106 | } 107 | 108 | SECTION("traingle surface calculation", "[area_triangle]") 109 | { 110 | using Approx = Catch::Approx; 111 | REQUIRE(area_triangle(a1 * 3, o2, a3 * 4) == Approx(6.0)); 112 | REQUIRE(area_triangle(o2, a3 * 4, a1 * 3) == Approx(6.0)); 113 | REQUIRE(area_triangle(a3 * 4, a1 * 3, o2) == Approx(6.0)); 114 | REQUIRE(area_triangle(a5 * 5, a6 * 5, o2) == Approx(25.0 / 2)); 115 | REQUIRE(area_triangle(a5 * 5, a6 * 5, a7 * 5) == Approx(25.0 / 2)); 116 | REQUIRE(area_triangle(a7, o2, a2) == Approx(1.0 / 2.0)); 117 | REQUIRE(area_triangle(o2, a3, a2) == Approx(1.0 / 2.0)); 118 | REQUIRE(area_triangle(o2, o2, a2) == Approx(0)); 119 | REQUIRE(area_triangle(a2, o2, o2) == Approx(0)); 120 | REQUIRE(area_triangle(o2, a2, o2) == Approx(0)); 121 | REQUIRE(area_triangle(a5, a1, a7 * 2) == Approx(2.0)); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /src/common/oculus_common.cpp: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * HMDQ Tools - tools for VR headsets and other hardware introspection * 3 | * https://github.com/risa2000/hmdq * 4 | * * 5 | * Copyright (c) 2020, Richard Musil. All rights reserved. * 6 | * * 7 | * This source code is licensed under the BSD 3-Clause "New" or "Revised" * 8 | * License found in the LICENSE file in the root directory of this project. * 9 | * SPDX-License-Identifier: BSD-3-Clause * 10 | ******************************************************************************/ 11 | 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | 19 | namespace oculus { 20 | 21 | // common constants 22 | //------------------------------------------------------------------------------ 23 | // Eye nomenclature 24 | const eyes_t EYES = {{ovrEye_Left, j_leye}, {ovrEye_Right, j_reye}}; 25 | 26 | // Controller types names 27 | // clang-format off 28 | const nlohmann::ordered_map g_bmControllerTypes = { 29 | {ovrControllerType_None, "None"}, 30 | {ovrControllerType_LTouch, "LTouch"}, 31 | {ovrControllerType_RTouch, "RTouch"}, 32 | {ovrControllerType_Remote, "Remote"}, 33 | {ovrControllerType_XBox, "XBox"}, 34 | {ovrControllerType_Object0, "Object0"}, 35 | {ovrControllerType_Object1, "Object1"}, 36 | {ovrControllerType_Object2, "Object2"}, 37 | {ovrControllerType_Object3, "Object3"}, 38 | }; 39 | // clang-format on 40 | 41 | // HMD capabilities names 42 | const nlohmann::ordered_map g_bmHmdCaps = { 43 | /// (read only) Specifies that the HMD is a virtual debug device. 44 | {ovrHmdCap_DebugDevice, "DebugDevice"}, 45 | }; 46 | 47 | // Tracker capabilites names 48 | const nlohmann::ordered_map g_bmTrackingCaps = { 49 | {ovrTrackingCap_Orientation, "Orientation"}, 50 | {ovrTrackingCap_MagYawCorrection, "MagYawCorrection"}, 51 | {ovrTrackingCap_Position, "Position"}, 52 | }; 53 | 54 | // HMD types names 55 | const nlohmann::ordered_map g_mHmdTypes = { 56 | {ovrHmd_None, "None"}, {ovrHmd_DK2, "DK2"}, {ovrHmd_CB, "CB"}, 57 | {ovrHmd_Other, "Other"}, {ovrHmd_E3_2015, "E3_2015"}, {ovrHmd_ES06, "ES06"}, 58 | {ovrHmd_ES09, "ES09"}, {ovrHmd_ES11, "ES11"}, {ovrHmd_CV1, "CV1"}, 59 | {ovrHmd_RiftS, "RiftS"}, {ovrHmd_Quest, "Quest"}, {ovrHmd_Quest2, "Quest2"}, 60 | }; 61 | 62 | } // namespace oculus 63 | 64 | // nlohmann/json serializers 65 | //------------------------------------------------------------------------------ 66 | // ovrVector2i serializers 67 | void to_json(json& j, const ovrVector2i& v2i) 68 | { 69 | j = json::array({v2i.x, v2i.y}); 70 | } 71 | 72 | void from_json(const json& j, ovrVector2i& v2i) 73 | { 74 | j.at(0).get_to(v2i.x); 75 | j.at(1).get_to(v2i.y); 76 | } 77 | 78 | // ovrVector2f serializers 79 | void to_json(json& j, const ovrVector2f& v2f) 80 | { 81 | j = json::array({v2f.x, v2f.y}); 82 | } 83 | 84 | void from_json(const json& j, ovrVector2f& v2f) 85 | { 86 | j.at(0).get_to(v2f.x); 87 | j.at(1).get_to(v2f.y); 88 | } 89 | 90 | // ovrVector3f serializers 91 | void to_json(json& j, const ovrVector3f& v3f) 92 | { 93 | j = json::array({v3f.x, v3f.y, v3f.z}); 94 | } 95 | 96 | void from_json(const json& j, ovrVector3f& v3f) 97 | { 98 | j.at(0).get_to(v3f.x); 99 | j.at(1).get_to(v3f.y); 100 | j.at(2).get_to(v3f.z); 101 | } 102 | 103 | // ovrQuatf serializers 104 | void to_json(json& j, const ovrQuatf& quat) 105 | { 106 | j = json::array({quat.x, quat.y, quat.z, quat.w}); 107 | } 108 | 109 | void from_json(const json& j, ovrQuatf& quat) 110 | { 111 | j.at(0).get_to(quat.x); 112 | j.at(1).get_to(quat.y); 113 | j.at(2).get_to(quat.z); 114 | j.at(3).get_to(quat.w); 115 | } 116 | 117 | // ovrFovPort serializers 118 | void to_json(json& j, const ovrFovPort& fovPort) 119 | { 120 | j[j_tan_left] = -fovPort.LeftTan; 121 | j[j_tan_right] = fovPort.RightTan; 122 | j[j_tan_bottom] = -fovPort.DownTan; 123 | j[j_tan_top] = fovPort.UpTan; 124 | } 125 | 126 | void from_json(const json& j, ovrFovPort& fovPort) 127 | { 128 | fovPort.LeftTan = -j.at(j_tan_left).get(); 129 | j.at(j_tan_right).get_to(fovPort.RightTan); 130 | fovPort.DownTan = -j.at(j_tan_bottom).get(); 131 | j.at(j_tan_top).get_to(fovPort.UpTan); 132 | } 133 | 134 | // ovrSizei serializers 135 | void to_json(json& j, const ovrSizei& size) 136 | { 137 | j = json::array({size.w, size.h}); 138 | } 139 | 140 | void from_json(const json& j, ovrSizei& size) 141 | { 142 | j.at(0).get_to(size.w); 143 | j.at(1).get_to(size.h); 144 | } 145 | 146 | // ovrRecti serializers 147 | void to_json(json& j, const ovrRecti& rect) 148 | { 149 | j = json::array(); 150 | j[0] = rect.Pos; 151 | j[1] = rect.Size; 152 | } 153 | 154 | void from_json(const json& j, ovrRecti& rect) 155 | { 156 | j.at(0).get_to(rect.Pos); 157 | j.at(1).get_to(rect.Size); 158 | } 159 | 160 | // ovrPosef serializers 161 | void to_json(json& j, const ovrPosef& pose) 162 | { 163 | j[j_orientation] = pose.Orientation; 164 | j[j_position] = pose.Position; 165 | } 166 | 167 | void from_json(const json& j, ovrPosef& pose) 168 | { 169 | j.at(j_position).get_to(pose.Position); 170 | j.at(j_orientation).get_to(pose.Orientation); 171 | } 172 | -------------------------------------------------------------------------------- /conan/packages/xtensor/conanfile.py: -------------------------------------------------------------------------------- 1 | from conan import ConanFile 2 | from conan.errors import ConanInvalidConfiguration 3 | from conan.tools.build import check_min_cppstd 4 | from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, save 5 | from conan.tools.layout import basic_layout 6 | from conan.tools.scm import Version 7 | import os 8 | import textwrap 9 | 10 | required_conan_version = ">=1.52.0" 11 | 12 | 13 | class XtensorConan(ConanFile): 14 | name = "xtensor" 15 | package_type = "header-library" 16 | description = "C++ tensors with broadcasting and lazy computing" 17 | license = "BSD-3-Clause" 18 | url = "https://github.com/conan-io/conan-center-index" 19 | homepage = "https://github.com/xtensor-stack/xtensor" 20 | topics = ("numpy", "multidimensional-arrays", "tensors") 21 | settings = "os", "arch", "compiler", "build_type" 22 | options = { 23 | "xsimd": [True, False], 24 | "tbb": [True, False], 25 | "openmp": [True, False], 26 | } 27 | default_options = { 28 | "xsimd": True, 29 | "tbb": False, 30 | "openmp": False, 31 | } 32 | 33 | @property 34 | def _min_cppstd(self): 35 | if Version(self.version) < "0.26.0": 36 | return "14" 37 | else: 38 | return "17" 39 | 40 | @property 41 | def _compilers_minimum_version(self): 42 | # https://github.com/xtensor-stack/xtensor/blob/master/README.md 43 | return { 44 | "Visual Studio": "14", 45 | "msvc": "190", 46 | "gcc": "4.9", 47 | "clang": "4", 48 | } 49 | 50 | def export_sources(self): 51 | export_conandata_patches(self) 52 | 53 | def layout(self): 54 | basic_layout(self, src_folder="src") 55 | 56 | def requirements(self): 57 | if Version(self.version) < "0.26.0": 58 | self.requires("xtl/0.7.5") 59 | else: 60 | self.requires("xtl/0.8.0") 61 | self.requires("nlohmann_json/3.11.3") 62 | if self.options.xsimd: 63 | if Version(self.version) < "0.24.0": 64 | self.requires("xsimd/7.5.0") 65 | else: 66 | self.requires("xsimd/13.0.0") 67 | if self.options.tbb: 68 | self.requires("onetbb/2021.10.0") 69 | 70 | def package_id(self): 71 | self.info.clear() 72 | 73 | def validate(self): 74 | if self.options.tbb and self.options.openmp: 75 | raise ConanInvalidConfiguration( 76 | "The options 'tbb' and 'openmp' can not be used together." 77 | ) 78 | 79 | if self.settings.compiler.get_safe("cppstd"): 80 | check_min_cppstd(self, self._min_cppstd) 81 | 82 | def loose_lt_semver(v1, v2): 83 | lv1 = [int(v) for v in v1.split(".")] 84 | lv2 = [int(v) for v in v2.split(".")] 85 | min_length = min(len(lv1), len(lv2)) 86 | return lv1[:min_length] < lv2[:min_length] 87 | 88 | minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) 89 | if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): 90 | raise ConanInvalidConfiguration( 91 | f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", 92 | ) 93 | 94 | def source(self): 95 | get(self, **self.conan_data["sources"][self.version], 96 | destination=self.source_folder, strip_root=True) 97 | 98 | def build(self): 99 | apply_conandata_patches(self) 100 | 101 | def package(self): 102 | copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) 103 | copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) 104 | 105 | # TODO: to remove in conan v2 once cmake_find_package* generators removed 106 | self._create_cmake_module_alias_targets( 107 | os.path.join(self.package_folder, self._module_file_rel_path), 108 | {"xtensor": "xtensor::xtensor"} 109 | ) 110 | 111 | def _create_cmake_module_alias_targets(self, module_file, targets): 112 | content = "" 113 | for alias, aliased in targets.items(): 114 | content += textwrap.dedent(f"""\ 115 | if(TARGET {aliased} AND NOT TARGET {alias}) 116 | add_library({alias} INTERFACE IMPORTED) 117 | set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) 118 | endif() 119 | """) 120 | save(self, module_file, content) 121 | 122 | @property 123 | def _module_file_rel_path(self): 124 | return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") 125 | 126 | def package_info(self): 127 | self.cpp_info.set_property("cmake_file_name", "xtensor") 128 | self.cpp_info.set_property("cmake_target_name", "xtensor") 129 | self.cpp_info.set_property("pkg_config_name", "xtensor") 130 | self.cpp_info.bindirs = [] 131 | self.cpp_info.libdirs = [] 132 | if self.options.xsimd: 133 | self.cpp_info.defines.append("XTENSOR_USE_XSIMD") 134 | if self.options.tbb: 135 | self.cpp_info.defines.append("XTENSOR_USE_TBB") 136 | if self.options.openmp: 137 | self.cpp_info.defines.append("XTENSOR_USE_OPENMP") 138 | 139 | # TODO: to remove in conan v2 once cmake_find_package* generators removed 140 | self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] 141 | self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] 142 | --------------------------------------------------------------------------------