diff --git a/.drone.yml b/.drone.yml index 9a9ad6c..2dbec96 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,162 +1,54 @@ --- kind: pipeline type: docker -name: linux-release +name: linux-build steps: - - name: build - image: feather:linux + - name: linux-build + image: wowlet/wowlet-linux:v0.1 volumes: - - name: ccache_linux_release - path: /root/.ccache - - name: files_linux_release - path: /files + - name: cache + path: /drone/src/monero + - name: files + path: /tmp/wowlet_linux commands: - - git config --global url."http://gitea:3000/tor/".insteadOf https://git.torproject.org/ - - git config --global url."http://gitea:3000/".insteadOf https://github.com/ - - git config --global url."http://gitea:3000/".insteadOf https://git.wownero.com/ - - git submodule update --init monero - - git submodule update --init --depth 1 --recursive monero - - TOR_BIN="/usr/local/tor/bin/tor" make -j8 release-static - environment: - OPENSSL_ROOT_DIR: /usr/local/openssl/ - CMAKEFLAGS_EXTRA: -DFETCH_DEPS=Off - - name: deploy - image: feather:linux - volumes: - - name: ccache_linux_release - path: /root/.ccache - - name: files_linux_release - path: /files - commands: - - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" - - mkdir -p "$TARGET_DIR" - - echo "writing to $TARGET_DIR/$FN" - - strip -s build/bin/feather - - zip -j "$TARGET_DIR/$FN" build/feather.log build/bin/feather - - echo "[*] written to https://build.featherwallet.org/files/linux-release/$DRONE_SOURCE_BRANCH/$FN" - + - make release-static -j3 + - export WOW="wowlet-`echo $DRONE_COMMIT_AFTER | cut -c 1-10`" + - cp build/bin/wowlet /tmp/wowlet_linux/$WOW volumes: -- name: ccache_linux_release +- name: cache host: - path: /var/drone/ccache_linux_release/ -- name: files_linux_release + path: /home/wow/wowlet_wownero +- name: files host: - path: /build/feather_files/files/linux-release/ + path: /home/wow/wowlet_linux --- kind: pipeline type: docker -name: linux-release-appimage +name: windows-deploy steps: - - name: build - image: feather:appimage + - name: windows-deploy + image: wowlet/wowlet-win:v0.1 volumes: - - name: files_linux_release - path: /files + - name: cache + path: /drone/src/monero + - name: files + path: /tmp/wowlet_windows commands: - - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export BRANCH="$DRONE_SOURCE_BRANCH" - - cp /files/$BRANCH/$FN feather.zip - - bash ./contrib/build-appimage.sh - - name: deploy - image: feather:appimage - volumes: - - name: files_linux_appimage - path: /files - commands: - - export FN="feather-`git rev-parse --short HEAD`.AppImage" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" - - mkdir -p "$TARGET_DIR" - - echo "writing to $TARGET_DIR/$FN" - - mv "Feather-1.0-x86_64.AppImage" "$TARGET_DIR/$FN" - - echo "[*] written to https://build.featherwallet.org/files/linux-release-appimage/$DRONE_SOURCE_BRANCH/$FN" + - make depends root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j3 + - export WOW="wowlet-`echo $DRONE_COMMIT_AFTER | cut -c 1-10`.exe" + - cp build/x86_64-w64-mingw32/release/bin/wowlet.exe /tmp/wowlet_windows/$WOW volumes: - - name: files_linux_appimage - host: - path: /build/feather_files/files/linux-release-appimage/ - - name: files_linux_release - host: - path: /build/feather_files/files/linux-release/ - ---- -kind: pipeline -type: docker -name: windows-mxe-release -steps: - - name: build - image: feather:win - volumes: - - name: ccache_win_release - path: /root/.ccache - - name: files_win_release - path: /files - commands: - - git config --global url."http://gitea:3000/tor/".insteadOf https://git.torproject.org/ - - git config --global url."http://gitea:3000/".insteadOf https://github.com/ - - git config --global url."http://gitea:3000/".insteadOf https://git.wownero.com/ - - git submodule update --init monero - - git submodule update --init --depth 1 --recursive monero - - PATH="/mxe/usr/bin/:$PATH" TOR_BIN="/mxe/usr/x86_64-w64-mingw32.static/bin/tor.exe" make -j8 windows-mxe-release - environment: - CMAKEFLAGS_EXTRA: -DFETCH_DEPS=Off - - name: deploy - image: feather:win - volumes: - - name: ccache_win_release - path: /root/.ccache - - name: files_win_release - path: /files - commands: - - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" - - mkdir -p "$TARGET_DIR" - - echo "writing to $TARGET_DIR/$FN" - - zip -j "$TARGET_DIR/$FN" build/feather.log build/bin/feather.exe - - echo "[*] written to https://build.featherwallet.org/files/windows-mxe-release/$DRONE_SOURCE_BRANCH/$FN" -volumes: -- name: ccache_win_release +- name: cache host: - path: /var/drone/ccache_win_release/ -- name: files_win_release + path: /home/wow/wowlet_wownero +- name: files host: - path: /build/feather_files/files/windows-mxe-release/ - ---- -kind: pipeline -type: docker -name: mac-release - -steps: - - name: build - image: feather:mac - volumes: - - name: files_mac_release - path: /files - commands: - - mkdir -p build - - ssh administrator@steve.jobs.xmr.pm "chmod +x build_macos.sh && PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin ~/build_macos.sh $DRONE_COMMIT_SHA" - - scp -P22 administrator@steve.jobs.xmr.pm:feather.zip build/feather.zip - - name: deploy - image: feather:mac - volumes: - - name: files_mac_release - path: /files - commands: - - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" - - mkdir -p "$TARGET_DIR" - - echo "writing to $TARGET_DIR/$FN" - - mv build/feather.zip "$TARGET_DIR/$FN" - - echo "[*] written to https://build.featherwallet.org/files/mac-release/$DRONE_SOURCE_BRANCH/$FN" - -volumes: -- name: files_mac_release - host: - path: /build/feather_files/files/mac-release/ ---- -kind: signature -hmac: f16a0379280e2e89987930d635ec6fb938d67732fdaf4ddc488f2a9db64bda2c - + path: /home/wow/wowlet_windows +trigger: + branch: + - master + event: + - tag ... diff --git a/.gitignore b/.gitignore index 0a00d97..a7a3ee0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,8 +8,8 @@ build/* CMakeCache.txt CMakeFiles cmake_install.cmake -feather_autogen/ -feather.cbp +wowlet_autogen/ +wowlet.cbp src/tor/* !src/tor/.gitkeep -src/config-feather.h +src/config-wowlet.h diff --git a/.gitmodules b/.gitmodules index d3f35eb..296b01a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ -[submodule "monero"] - path = monero - url = https://git.wownero.com/feather/monero.git -[submodule "contrib/tor"] - path = contrib/tor - url = https://git.torproject.org/tor.git [submodule "contrib/KDMacTouchBar"] path = contrib/KDMacTouchBar url = https://github.com/KDAB/KDMacTouchBar.git +[submodule "contrib/quirc"] + path = contrib/quirc + url = https://github.com/dlbeer/quirc.git +[submodule "wownero"] + path = wownero + url = https://git.wownero.com/wownero/wownero.git diff --git a/BUILDING.md b/BUILDING.md deleted file mode 100644 index 6b4fb74..0000000 --- a/BUILDING.md +++ /dev/null @@ -1,106 +0,0 @@ -# Buildbot builds - -The docker build bins can be found here: https://build.featherwallet.org/files/ - -## Docker static builds - -Static builds via Docker are done in 3 steps: - -1. Cloning this repository (+submodules) -2. Creating a base Docker image -3. Using the base image to compile a build - -### Linux (reproducible) - -The docker image for reproducible Linux static builds uses Ubuntu 16.04 and compiles the required libraries statically -so that the resulting Feather binary is static. For more information, check the Dockerfile: `Dockerfile`. - -#### 1. Clone - -```bash -git clone --branch master --recursive https://git.wownero.com/feather/feather.git -cd feather -``` - -Replace `master` with the desired version tag (e.g. `beta-1`) to build the release binary. - -#### 2. Base image - -```bash -docker build --tag feather:linux --build-arg THREADS=4 . -``` - -Building the base image takes a while. You only need to build the base image once. - -#### 3. Build - -```bash -docker run --rm -it -v $PWD:/feather --env OPENSSL_ROOT_DIR=/usr/local/openssl/ -w /feather feather:linux sh -c 'TOR_BIN="/usr/local/tor/bin/tor" make release-static -j4' -``` - -If you're re-running a build make sure to `rm -rf build/` first. - -The resulting binary can be found in `build/bin/feather`. - -Hashes for tagged commits should match: - -``` -beta-1: d1a52e3bac1abbae4adda1fc88cb2a7a06fbd61085868421897c6a4f3f4eb091 feather -``` - -### Windows - -The docker image for Windows static compiles uses Ubuntu 18.04 and installs [mxe](https://mxe.cc) from [our git](https://git.wownero.com/feather/mxe/src/branch/feather-patch), -which comes with: OpenSSL 1.1.1g, Qt 5.15.0 (OpenGL via mesa). For more information, check the Dockerfile: `Dockerfile_windows`. - -#### 1. Clone - -```bash -git clone --recursive https://git.wownero.com/feather/feather.git -cd feather -``` - -#### 2. Base image - -Warning: Building the MXE base image takes up to a hour, so go watch a movie. - -```bash -docker build -f Dockerfile_windows --tag feather:win --build-arg THREADS=8 . -``` - -Note: You only need to build the base image once. - -#### 3. Build - -```bash -docker run --rm -it -v /tmp/ccache:/root/.ccache -v PATH_TO_FEATHER:/feather -w /feather feather:win /bin/bash -c 'PATH="/mxe/usr/bin/:$PATH" TOR_BIN="/mxe/usr/x86_64-w64-mingw32.static/bin/tor.exe" make windows-mxe-release -j8' -``` - -Replace `PATH_TO_FEATHER` with the absolute path to Feather locally. - -The resulting binary can be found in `build/bin/feather.exe`. - -## macOS - -For MacOS it's easiest to leverage [brew](https://brew.sh) to install the required dependencies. - -```bash -HOMEBREW_OPTFLAGS="-march=core2" HOMEBREW_OPTIMIZATION_LEVEL="O0" \ - brew install boost zmq openssl libpgm miniupnpc libsodium expat libunwind-headers protobuf libgcrypt qrencode ccache cmake pkgconfig git -``` - -Clone the repository. - -```bash -git clone --recursive https://git.wownero.com/feather/feather.git -``` - -Get the latest LTS from here: https://www.qt.io/offline-installers and install. - -Build Feather. - -```bash -CMAKE_PREFIX_PATH=~/Qt5.15.1/5.15.1/clang_64 make mac-release -``` - -The resulting Mac OS application can be found `build/bin/feather.app` and will **not** have Tor embedded. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c01e9f..3ac80fa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,22 +1,21 @@ cmake_minimum_required(VERSION 3.13) -project(feather) +project(wowlet) message(STATUS "Initiating compile using CMake ${CMAKE_VERSION}") set(THREADS_PREFER_PTHREAD_FLAG ON) -set(VERSION_MAJOR "0") +set(VERSION_MAJOR "4") set(VERSION_MINOR "1") -set(VERSION_REVISION "0") -set(VERSION "beta-3") +set(VERSION_REVISION "1") +set(VERSION "beta-8") option(FETCH_DEPS "Download dependencies if they are not found" ON) -option(XMRTO "Include Xmr.To module" ON) -option(XMRIG "Include XMRig module" ON) -option(TOR_BIN "Path to Tor binary to embed inside Feather" OFF) - +option(OPENVR "Include OpenVR support") +option(ANDROID "Android deployment") +option(ANDROID_DEBUG "View the Android app on desktop") +option(TOR_BIN "Path to Tor binary to embed inside WOWlet") option(STATIC "Link libraries statically, requires static Qt") -option(USE_DEVICE_TREZOR "Trezor support compilation" OFF) -option(DONATE_BEG "Prompt donation window every once in a while" ON) +option(USE_DEVICE_TREZOR "Trezor support compilation") list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_SOURCE_DIR}/cmake") include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) @@ -26,17 +25,20 @@ include(FindCcache) include(CheckIncludeFile) include(CheckSymbolExists) -if(DEBUG) - set(CMAKE_VERBOSE_MAKEFILE ON) -endif() - -set(MONERO_HEAD "85b0b4f73aa6114e3ff91207aa94ad2a15c939a2") +set(WOWNERO_HEAD "a21819cc22587e16af00e2c3d8f70156c11310a0") set(BUILD_GUI_DEPS ON) -set(ARCH "x86-64") -set(BUILD_64 ON) +set(BUILD_64 ON CACHE BOOL "Build 64-bit binaries") set(INSTALL_VENDORED_LIBUNBOUND ${STATIC}) set(USE_SINGLE_BUILDDIR ON) +# Are we in debug mode? +set(_CMAKE_BUILD_TYPE "") +string(TOUPPER "${CMAKE_BUILD_TYPE}" _CMAKE_BUILD_TYPE) +if("${_CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") + set(DEBUG ON) + set(CMAKE_VERBOSE_MAKEFILE ON) +endif() + check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H) check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL) @@ -49,7 +51,7 @@ if(STATIC) # manually set the unbound submodule the right commit that has the fix. # This only works with -DMANUAL_SUBMODULES=1 message(STATUS "applying unbound static build fix contrib/unbound_static.patch") - execute_process(COMMAND bash -c "git -C ${CMAKE_SOURCE_DIR}/monero/external/unbound apply ${CMAKE_SOURCE_DIR}/contrib/unbound_static.patch") + execute_process(COMMAND bash -c "git -C ${CMAKE_SOURCE_DIR}/wownero/external/unbound apply ${CMAKE_SOURCE_DIR}/contrib/unbound_static.patch") set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_STATIC_RUNTIME ON) @@ -82,31 +84,18 @@ function (add_linker_flag_if_supported flag var) endfunction() find_package(Git) -if(GIT_FOUND) - execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/monero OUTPUT_VARIABLE _MONERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT _MONERO_HEAD STREQUAL MONERO_HEAD) - message(FATAL_ERROR "[submodule] Monero HEAD was at ${_MONERO_HEAD} but should be at ${MONERO_HEAD}") - else() - message(STATUS "[submodule] Monero HEAD @ ${MONERO_HEAD}") - endif() -endif() -add_subdirectory(monero) -set_property(TARGET wallet_merged PROPERTY FOLDER "monero") -get_directory_property(ARCH_WIDTH DIRECTORY "monero" DEFINITION ARCH_WIDTH) -get_directory_property(UNBOUND_LIBRARY DIRECTORY "monero" DEFINITION UNBOUND_LIBRARY) +add_subdirectory(wownero) +get_directory_property(ARCH_WIDTH DIRECTORY "wownero" DEFINITION ARCH_WIDTH) include(CMakePackageConfigHelpers) include(VersionMonero) -include(VersionFeather) +include(VersionWowlet) include_directories(${EASYLOGGING_INCLUDE}) link_directories(${EASYLOGGING_LIBRARY_DIRS}) # OpenSSL -if(APPLE AND NOT OPENSSL_ROOT_DIR) - execute_process(COMMAND brew --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() find_package(OpenSSL REQUIRED) message(STATUS "OpenSSL: Version ${OPENSSL_VERSION}") message(STATUS "OpenSSL: include dir at ${OPENSSL_INCLUDE_DIR}") @@ -119,46 +108,28 @@ message(STATUS "libsodium: libraries at ${SODIUM_LIBRARY}") # HIDApi set(HIDAPI_FOUND OFF) +# Unbound +find_package(Unbound REQUIRED) + # QrEncode find_package(QREncode REQUIRED) -# Tevador 14 word Monero seed -find_package(monero-seed CONFIG) -if(NOT monero-seed_FOUND) - if(FETCH_DEPS) - FetchContent_Declare(monero-seed - GIT_REPOSITORY https://git.wownero.com/feather/monero-seed.git) - FetchContent_GetProperties(monero-seed) - if(NOT monero-seed_POPULATED) - message(STATUS "Fetching monero-seed") - FetchContent_Populate(monero-seed) - add_subdirectory(${monero-seed_SOURCE_DIR} ${monero-seed_BINARY_DIR}) - endif() - add_library(monero-seed::monero-seed ALIAS monero-seed) - else() - message(FATAL_ERROR "monero-seed was not installed and fetching deps is disabled") - endif() -endif() +# Tevador 14 word seed (https://git.wownero.com/wowlet/wownero-seed) +find_package(wownero-seed CONFIG REQUIRED) # Boost if(DEBUG) set(Boost_DEBUG ON) endif() -if(APPLE AND NOT BOOST_ROOT) - execute_process(COMMAND brew --prefix boost OUTPUT_VARIABLE BOOST_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE) -endif() -find_package(Boost 1.58 REQUIRED COMPONENTS - system - filesystem - thread - date_time - chrono - regex - serialization - program_options - locale) -if(UNIX AND NOT APPLE) +if(MINGW) + set(Boost_THREADAPI win32) +endif() +set(_BOOST_COMPONENTS system filesystem thread date_time chrono regex serialization program_options locale) + +find_package(Boost 1.58 REQUIRED COMPONENTS ${_BOOST_COMPONENTS}) + +if(UNIX AND NOT ANDROID) if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # https://github.com/monero-project/monero-gui/issues/3142#issuecomment-705940446 set(CMAKE_SKIP_RPATH ON) @@ -180,29 +151,57 @@ if("$ENV{DRONE}" STREQUAL "true") message(STATUS "We are inside a static compile with Drone CI") endif() -# To build Feather with embedded (and static) Tor, pass CMake -DTOR_BIN=/path/to/tor +if(UNIX) + if(NOT CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH}) + message(STATUS "Using CMAKE_PREFIX_PATH environment variable: '$ENV{CMAKE_PREFIX_PATH}'") + set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) + endif() + if(APPLE AND NOT CMAKE_PREFIX_PATH) + execute_process(COMMAND brew --prefix qt5 OUTPUT_VARIABLE QT5_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + list(APPEND CMAKE_PREFIX_PATH ${QT5_DIR}) + endif() +endif() + if(TOR_BIN) - if(APPLE) - execute_process(COMMAND bash -c "touch ${CMAKE_CURRENT_SOURCE_DIR}/src/tor/libevent-2.1.7.dylib") + # To build WOWlet with embedded & static Tor, pass CMake -DTOR_BIN=/path/to/tor_executable + # The CMake below will copy the Tor binary into src/assets/exec + # + # For release: + # ## Linux / Window + # on the buildbot(s) Tor is baked into the image + # - linux: See `Dockerfile` + # - windows: See `Dockerfile.windows` + if(NOT EXISTS "${TOR_BIN}") + message(FATAL_ERROR "TOR_BIN is set, but file does not exist: '${TOR_BIN}'") endif() - # on the buildbot Tor is baked into the image - # - linux: See `Dockerfile` - # - windows: https://github.com/mxe/mxe/blob/1024dc7d2db5eb7d5d3c64a2c12b5f592572f1ce/plugins/apps/tor.mk - # - macos: taken from Tor Browser official release - set(TOR_COPY_CMD "cp -u ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor") - message(STATUS "${TOR_COPY_CMD}") + # copy the Tor executable over + set(TOR_COPY_CMD "cp ${TOR_BIN} ${CMAKE_CURRENT_SOURCE_DIR}/src/assets/exec/tor") + message(STATUS "Tor cmd: ${TOR_COPY_CMD}") + execute_process(COMMAND bash -c "${TOR_COPY_CMD}" RESULT_VARIABLE ret) if(ret EQUAL "1") message(FATAL_ERROR "Tor copy failure: ${TOR_COPY_CMD}") endif() + # get Tor version while we're at it + if(NOT TOR_VERSION) + execute_process(COMMAND bash -c "${TOR_BIN} --version --quiet | head -n1" OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE out RESULT_VARIABLE ret) + if (ret EQUAL "0") + set(TOR_VERSION "${out}") + endif() + endif() + message(STATUS "Tor version: ${TOR_VERSION}") + configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h") + message(STATUS "Embedding Tor binary at ${TOR_BIN}") else() message(STATUS "Skipping Tor inclusion because -DTOR_BIN=Off") endif() if(MINGW) + find_package(Iconv REQUIRED) + string(REGEX MATCH "^[^/]:/[^/]*" msys2_install_path "${CMAKE_C_COMPILER}") message(STATUS "MSYS location: ${msys2_install_path}") set(CMAKE_INCLUDE_PATH "${msys2_install_path}/mingw${ARCH_WIDTH}/include") @@ -223,12 +222,10 @@ if(MINGW) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wa,-mbig-obj") set(EXTRA_LIBRARIES mswsock;ws2_32;iphlpapi;crypt32;bcrypt) if(DEPENDS) - set(ICU_LIBRARIES icuio icui18n icuuc icudata icutu iconv) + set(ICU_LIBRARIES iconv) else() set(ICU_LIBRARIES icuio icuin icuuc icudt icutu iconv) endif() -elseif(APPLE) - set(EXTRA_LIBRARIES "-framework AppKit") elseif(OPENBSD) set(EXTRA_LIBRARIES "") elseif(FREEBSD) @@ -238,30 +235,13 @@ elseif(DRAGONFLY) set(EXTRA_LIBRARIES execinfo ${COMPAT}) elseif(CMAKE_SYSTEM_NAME MATCHES "(SunOS|Solaris)") set(EXTRA_LIBRARIES socket nsl resolv) -elseif(NOT MSVC AND NOT DEPENDS) +elseif(NOT MSVC AND NOT DEPENDS AND NOT ANDROID) find_library(RT rt) set(EXTRA_LIBRARIES ${RT}) endif() list(APPEND EXTRA_LIBRARIES ${CMAKE_DL_LIBS}) -if(APPLE) - include_directories(SYSTEM /usr/include/malloc) - if(POLICY CMP0042) - cmake_policy(SET CMP0042 NEW) - endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0") -endif() - -if (APPLE AND NOT IOS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=x86-64 -fvisibility=default -std=c++11") -endif() - -if(APPLE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0") -endif() - # warnings # @TODO: enable these 2 for migration to Qt 6 #add_c_flag_if_supported(-Werror C_SECURITY_FLAGS) @@ -296,12 +276,7 @@ if (NOT (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VER endif() # linker -if (APPLE) - add_linker_flag_if_supported(-Wl,-bind_at_load LD_SECURITY_FLAGS) - add_linker_flag_if_supported(-Wl,-dead_strip LD_SECURITY_FLAGS) - add_linker_flag_if_supported(-Wl,-dead_strip_dylibs LD_SECURITY_FLAGS) -endif() -if (NOT APPLE AND NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU")) +if (NOT (WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "GNU")) # Windows binaries die on startup with PIE when compiled with GCC add_linker_flag_if_supported(-pie LD_SECURITY_FLAGS) endif() @@ -331,6 +306,11 @@ if(STATIC) endif() endif() +if(LINUX_ACTIVATION) + find_package(Cairo REQUIRED) + find_package(Xfixes REQUIRED) +endif() + # With GCC 6.1.1 the compiled binary malfunctions due to aliasing. Until that # is fixed in the code (Issue #847), force compiler to be conservative. add_c_flag_if_supported(-fno-strict-aliasing C_SECURITY_FLAGS) @@ -347,8 +327,21 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${C_SECURITY_FLAGS}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${CXX_SECURITY_FLAGS}") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LD_SECURITY_FLAGS} ${STATIC_FLAGS}") -if(APPLE) - add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/KDMacTouchBar") +if(OPENVR) + # Add contrib/openvr as library + add_definitions(-DVR_API_PUBLIC) + add_definitions(-DOPENVR_BUILD_STATIC) # is this needed? + add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/contrib/openvr") +endif() + +if(WITH_SCANNER) + add_library(quirc STATIC + contrib/quirc/lib/decode.c + contrib/quirc/lib/identify.c + contrib/quirc/lib/quirc.c + contrib/quirc/lib/version_db.c + ) + target_include_directories(quirc PUBLIC contrib/quirc/lib) endif() add_subdirectory(src) diff --git a/Dockerfile b/Dockerfile index 7a53a1d..d1004be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,21 +1,125 @@ -FROM ubuntu:16.04 +FROM ubuntu:18.04 AS tor + +ENV CFLAGS="-fPIC" +ENV CPPFLAGS="-fPIC" +ENV CXXFLAGS="-fPIC" +ENV SOURCE_DATE_EPOCH=1397818193 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y build-essential wget git automake pkg-config python python3 && \ + rm -rf /var/lib/apt/lists/* + +RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \ + echo "e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242 openssl-1.1.1i.tar.gz" | sha256sum -c && \ + tar -xzf openssl-1.1.1i.tar.gz && \ + rm openssl-1.1.1i.tar.gz && \ + cd openssl-1.1.1i && \ + ./config no-shared no-dso --prefix=/usr/local/openssl && \ + make -j$THREADS && \ + make -j$THREADS install_sw && \ + rm -rf $(pwd) + +RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz && \ + echo "92e6de1be9ec176428fd2367677e61ceffc2ee1cb119035037a27d346b0403bb libevent-2.1.12-stable.tar.gz" | sha256sum -c && \ + tar -zxvf libevent-2.1.12-stable.tar.gz && \ + cd libevent-2.1.12-stable && \ + PKG_CONFIG_PATH=/usr/local/openssl/lib/pkgconfig/ \ + ./configure --prefix=/usr/local/libevent \ + --disable-shared \ + --enable-static \ + --with-pic && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \ + cd zlib && \ + git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \ + ./configure --static --prefix=/usr/local/zlib && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b tor-0.4.5.5-rc --depth 1 https://git.torproject.org/tor.git && \ + cd tor && \ + git reset --hard b36a00e9a9d3eb4b2949951afaa72e45fb7e68cd && \ + ./autogen.sh && \ + ./configure \ + --disable-asciidoc \ + --disable-manpage \ + --disable-html-manual \ + --disable-system-torrc \ + --disable-module-relay \ + --disable-lzma \ + --disable-zstd \ + --enable-static-tor \ + --with-libevent-dir=/usr/local/libevent \ + --with-openssl-dir=/usr/local/openssl \ + --with-zlib-dir=/usr/local/zlib \ + --disable-tool-name-check \ + --enable-fatal-warnings \ + --prefix=/usr/local/tor && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) && \ + strip -s -D /usr/local/tor/bin/tor + +FROM ubuntu:18.04 ARG THREADS=1 -ARG QT_VERSION=5.15.2 +ARG QT_VERSION=v5.15.2 ENV CFLAGS="-fPIC" ENV CPPFLAGS="-fPIC" ENV CXXFLAGS="-fPIC" ENV SOURCE_DATE_EPOCH=1397818193 -RUN apt-get update -RUN apt-get install -y nano vim ccache software-properties-common +ENV OPENSSL_ROOT_DIR=/usr/local/openssl/ +ENV TOR_BIN=/usr/local/tor/bin/tor -RUN add-apt-repository ppa:git-core/ppa -RUN apt-get update +COPY --from=tor ${TOR_BIN} /usr/local/tor/bin/tor -RUN apt install -y automake git pkg-config python xutils-dev && \ - git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \ +RUN apt-get update && \ + apt-get install -y \ +# dev tools + nano vim ccache \ +# build tools + software-properties-common automake pkg-config python \ + libtool-bin wget zip \ +# dependencies + libusb-1.0-0-dev \ +# Qt + libgl1-mesa-dev libglib2.0-dev mesa-common-dev \ +# libusb + libudev-dev \ +# fontconfig + autopoint gettext gperf libpng-dev \ +# libxcb + libpthread-stubs0-dev \ +# xorgproto + xutils-dev \ +# libxkbcommon + bison \ +# zeromq + libsodium-dev \ +# AppImage tools + file squashfs-tools desktop-file-utils patchelf + +RUN add-apt-repository ppa:git-core/ppa && \ + apt-get update && \ + apt-get install -y git && \ + rm -rf /var/lib/apt/lists/* + +RUN mkdir appimagetool && \ + cd appimagetool && \ + wget https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage && \ + echo "d918b4df547b388ef253f3c9e7f6529ca81a885395c31f619d9aaf7030499a13 appimagetool-x86_64.AppImage" | sha256sum -c && \ + chmod +x appimagetool-x86_64.AppImage && \ + ./appimagetool-x86_64.AppImage --appimage-extract && \ + rm appimagetool-x86_64.AppImage + +RUN git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \ cd xorgproto && \ git reset --hard c62e8203402cafafa5ba0357b6d1c019156c9f36 && \ ./autogen.sh && \ @@ -31,8 +135,7 @@ RUN git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xcbpro make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libtool-bin && \ - git clone -b libXau-1.0.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxau && \ +RUN git clone -b libXau-1.0.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxau && \ cd libxau && \ git reset --hard d9443b2c57b512cfb250b35707378654d86c7dea && \ ./autogen.sh --enable-shared --disable-static && \ @@ -40,8 +143,7 @@ RUN apt install -y libtool-bin && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libpthread-stubs0-dev && \ - git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb && \ +RUN git clone -b 1.12 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb && \ cd libxcb && \ git reset --hard d34785a34f28fa6a00f8ce00d87e3132ff0f6467 && \ ./autogen.sh --enable-shared --disable-static && \ @@ -58,7 +160,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb- cd libxcb-util && \ git reset --hard acf790d7752f36e450d476ad79807d4012ec863b && \ git submodule init && \ - git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ + git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \ ./autogen.sh --enable-shared --disable-static && \ make -j$THREADS && \ @@ -69,7 +171,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb- cd libxcb-image && \ git reset --hard d882052fb2ce439c6483fce944ba8f16f7294639 && \ git submodule init && \ - git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ + git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \ ./autogen.sh --enable-shared --disable-static && \ make -j$THREADS && \ @@ -80,7 +182,7 @@ RUN git clone -b 0.4.0 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb- cd libxcb-keysyms && \ git reset --hard 0e51ee5570a6a80bdf98770b975dfe8a57f4eeb1 && \ git submodule init && \ - git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ + git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \ ./autogen.sh --enable-shared --disable-static && \ make -j$THREADS && \ @@ -91,7 +193,7 @@ RUN git clone -b 0.3.9 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb- cd libxcb-render-util && \ git reset --hard 0317caf63de532fd7a0493ed6afa871a67253747 && \ git submodule init && \ - git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ + git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \ ./autogen.sh --enable-shared --disable-static && \ make -j$THREADS && \ @@ -102,15 +204,14 @@ RUN git clone -b 0.4.1 --depth 1 https://gitlab.freedesktop.org/xorg/lib/libxcb- cd libxcb-wm && \ git reset --hard 24eb17df2e1245885e72c9d4bbb0a0f69f0700f2 && \ git submodule init && \ - git clone --depth 1 https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ + git clone https://gitlab.freedesktop.org/xorg/util/xcb-util-m4 m4 && \ git -C m4 reset --hard f662e3a93ebdec3d1c9374382dcc070093a42fed && \ ./autogen.sh --enable-shared --disable-static && \ make -j$THREADS && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y bison && \ - git clone -b xkbcommon-0.5.0 --depth 1 https://github.com/xkbcommon/libxkbcommon && \ +RUN git clone -b xkbcommon-0.5.0 --depth 1 https://github.com/xkbcommon/libxkbcommon && \ cd libxkbcommon && \ git reset --hard c43c3c866eb9d52cd8f61e75cbef1c30d07f3a28 && \ ./autogen.sh --prefix=/usr --enable-shared --disable-static --enable-x11 --disable-docs && \ @@ -121,9 +222,6 @@ RUN apt install -y bison && \ RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \ cd zlib && \ git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \ - ./configure --static && \ - make -j$THREADS && \ - make -j$THREADS install && \ ./configure --static --prefix=/usr/local/zlib && \ make -j$THREADS && \ make -j$THREADS install && \ @@ -147,8 +245,7 @@ RUN git clone -b R_2_2_9 --depth 1 https://github.com/libexpat/libexpat && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y autopoint gettext gperf libpng12-dev && \ - git clone -b 2.13.92 --depth 1 https://gitlab.freedesktop.org/fontconfig/fontconfig && \ +RUN git clone -b 2.13.92 --depth 1 https://gitlab.freedesktop.org/fontconfig/fontconfig && \ cd fontconfig && \ git reset --hard b1df1101a643ae16cdfa1d83b939de2497b1bf27 && \ ./autogen.sh --disable-shared --enable-static --sysconfdir=/etc --localstatedir=/var && \ @@ -164,8 +261,7 @@ RUN git clone -b release-64-2 --depth 1 https://github.com/unicode-org/icu && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y wget && \ - wget https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.gz && \ +RUN wget https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.gz && \ echo "9995e192e68528793755692917f9eb6422f3052a53c5e13ba278a228af6c7acf boost_1_73_0.tar.gz" | sha256sum -c && \ tar -xzf boost_1_73_0.tar.gz && \ rm boost_1_73_0.tar.gz && \ @@ -179,27 +275,48 @@ RUN wget https://www.openssl.org/source/openssl-1.1.1i.tar.gz && \ tar -xzf openssl-1.1.1i.tar.gz && \ rm openssl-1.1.1i.tar.gz && \ cd openssl-1.1.1i && \ - ./config no-shared no-zlib-dynamic --prefix=/usr/local/openssl && \ + ./config no-shared no-dso --prefix=/usr/local/openssl && \ make -j$THREADS && \ - make -j$THREADS install && \ - ./config no-shared no-zlib-dynamic --openssldir=/usr && \ + make -j$THREADS install_sw && \ + rm -rf $(pwd) + +RUN wget https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.bz2 && \ + echo "a247a7f6bbb21cf2ca81ea4cbb916bfb9717ca523631675f99b3d4a5678dcd16 expat-2.4.8.tar.bz2" | sha256sum -c && \ + tar -xf expat-2.4.8.tar.bz2 && \ + rm expat-2.4.8.tar.bz2 && \ + cd expat-2.4.8 && \ + ./configure --enable-static --disable-shared --prefix=/usr/local/expat/ && \ make -j$THREADS && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libgl1-mesa-dev libglib2.0-dev mesa-common-dev && \ - rm /usr/lib/x86_64-linux-gnu/libX11.a && \ +RUN wget https://www.nlnetlabs.nl/downloads/unbound/unbound-1.16.2.tar.gz && \ + echo "2e32f283820c24c51ca1dd8afecfdb747c7385a137abe865c99db4b257403581 unbound-1.16.2.tar.gz" | sha256sum -c && \ + tar -xzf unbound-1.16.2.tar.gz && \ + rm unbound-1.16.2.tar.gz && \ + cd unbound-1.16.2 && \ + ./configure --disable-shared --enable-static --without-pyunbound --with-libexpat=/usr/local/expat/ --with-ssl=/usr/local/openssl/ --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only --with-pic && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN rm /usr/lib/x86_64-linux-gnu/libX11.a && \ rm /usr/lib/x86_64-linux-gnu/libXext.a && \ rm /usr/lib/x86_64-linux-gnu/libX11-xcb.a && \ git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \ cd qt5 && \ git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qtx11extras.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \ git clone git://code.qt.io/qt/qtwebsockets.git -b ${QT_VERSION} --depth 1 && \ sed -ri s/\(Libs:.*\)/\\1\ -lexpat/ /usr/local/lib/pkgconfig/fontconfig.pc && \ sed -ri s/\(Libs:.*\)/\\1\ -lz/ /usr/local/lib/pkgconfig/freetype2.pc && \ @@ -207,18 +324,14 @@ RUN apt install -y libgl1-mesa-dev libglib2.0-dev mesa-common-dev && \ sed -i s/\\/usr\\/X11R6\\/lib64/\\/usr\\/local\\/lib/ qtbase/mkspecs/linux-g++-64/qmake.conf && \ OPENSSL_LIBS="-lssl -lcrypto -lpthread -ldl" \ ./configure --prefix=/usr -platform linux-g++-64 -opensource -confirm-license -release -static -no-avx \ - -no-opengl -qpa xcb --xcb -xcb-xlib -feature-xlib -openssl-linked -I /usr/local/openssl/include \ - -L /usr/local/openssl/lib -system-freetype -fontconfig -glib \ - -no-dbus -no-sql-sqlite -no-use-gold-linker -no-kms \ + -opengl desktop -qpa xcb -xcb -xcb-xlib -feature-xlib -system-freetype -fontconfig -glib \ + -no-dbus -no-feature-qml-worker-script -no-linuxfb -no-openssl -no-sql-sqlite -no-kms -no-use-gold-linker \ -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \ -skip qt3d -skip qtandroidextras -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d \ - -skip qtdoc -skip qtquickcontrols -skip qtquickcontrols2 -skip qtspeech -skip qtgamepad \ - -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing -optimize-size \ + -skip qtdoc -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \ -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttools \ -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebview \ -skip qtwinextras -skip qtx11extras -skip gamepad -skip serialbus -skip location -skip webengine \ - -skip qtdeclarative \ - -no-feature-cups -no-feature-ftp -no-feature-pdf -no-feature-animation \ -nomake examples -nomake tests -nomake tools && \ make -j$THREADS && \ make -j$THREADS install && \ @@ -229,8 +342,7 @@ RUN apt install -y libgl1-mesa-dev libglib2.0-dev mesa-common-dev && \ cd ../../../.. && \ rm -rf $(pwd) -RUN apt install -y libudev-dev && \ - git clone -b v1.0.23 --depth 1 https://github.com/libusb/libusb && \ +RUN git clone -b v1.0.23 --depth 1 https://github.com/libusb/libusb && \ cd libusb && \ git reset --hard e782eeb2514266f6738e242cdcb18e3ae1ed06fa && \ ./autogen.sh --disable-shared --enable-static && \ @@ -247,8 +359,7 @@ RUN git clone -b hidapi-0.9.0 --depth 1 https://github.com/libusb/hidapi && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libsodium-dev && \ - git clone -b v4.3.2 --depth 1 https://github.com/zeromq/libzmq && \ +RUN git clone -b v4.3.2 --depth 1 https://github.com/zeromq/libzmq && \ cd libzmq && \ git reset --hard a84ffa12b2eb3569ced199660bac5ad128bff1f0 && \ ./autogen.sh && \ @@ -292,9 +403,7 @@ RUN git clone -b v3.18.4 --depth 1 https://github.com/Kitware/CMake && \ make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libusb-1.0-0-dev - -RUN apt install -y zip && git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git && \ +RUN git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git && \ cd libqrencode && \ git reset --hard 59ee597f913fcfda7a010a6e106fbee2595f68e4 && \ cmake -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/usr . && \ @@ -302,47 +411,29 @@ RUN apt install -y zip && git clone -b v4.0.2 --depth 1 https://github.com/fukuc make -j$THREADS install && \ rm -rf $(pwd) -RUN apt install -y libmbedtls-dev && git clone -b release-2.1.12-stable --depth 1 https://github.com/libevent/libevent.git && \ - cd libevent && \ - git reset --hard 5df3037d10556bfcb675bc73e516978b75fc7bc7 && \ - mkdir build && cd build && \ - cmake -DEVENT_LIBRARY_STATIC=ON -DOPENSSL_ROOT_DIR=/usr/local/openssl -DCMAKE_INSTALL_PREFIX=/usr/local/libevent .. && \ - make -j$THREADS && \ - make -j$THREADS install && \ - rm -rf $(pwd) - -RUN git clone -b tor-0.4.4.6 --depth 1 https://git.torproject.org/tor.git && \ - cd tor && \ - git reset --hard 2a8b789ea6f308d081f369d78fa7cfdc9d00bf90 && \ - bash autogen.sh && \ - LDFLAGS="-L/usr/local/openssl/lib/" LIBS="-lssl -lcrypto -lpthread -ldl" CPPFLAGS="-I/usr/local/openssl/include/" ./configure \ - --enable-static-zlib \ - --enable-static-openssl \ - --enable-static-libevent \ - --disable-system-torrc \ - --with-libevent-dir=/usr/local/libevent \ - --with-openssl-dir=/usr/local/openssl/ \ - --with-zlib-dir=/usr/local/zlib \ - --disable-system-torrc \ - --disable-tool-name-check \ - --disable-systemd \ - --disable-lzma \ - --disable-unittests \ - --disable-zstd \ - --disable-seccomp \ - --disable-asciidoc \ - --disable-manpage \ - --disable-html-manual \ - --disable-system-torrc \ - --prefix=/usr/local/tor && \ - make -j$THREADS && \ - make -j$THREADS install && \ - rm -rf $(pwd) - -RUN git clone https://git.wownero.com/feather/monero-seed.git && \ - cd monero-seed && \ - git reset --hard 4674ef09b6faa6fe602ab5ae0b9ca8e1fd7d5e1b && \ +RUN git clone https://git.wownero.com/wowlet/wownero-seed.git && \ + cd wownero-seed && \ + git reset --hard ef6910b6bb3b61757c36e2e5db0927d75f1731c8 && \ cmake -DCMAKE_BUILD_TYPE=Release -Bbuild && \ make -Cbuild -j$THREADS && \ make -Cbuild install && \ rm -rf $(pwd) + +RUN git clone https://github.com/plougher/squashfs-tools.git && \ + cd squashfs-tools/squashfs-tools && \ + git reset --hard 38fa0720526222827da44b3b6c3f7eb63e8f5c2f && \ + make && \ + make install && \ + rm -rf $(pwd) + +RUN mkdir linuxdeployqt && \ + cd linuxdeployqt && \ + wget https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage && \ + echo "645276306a801d7154d59e5b4b3c2fac3d34e09be57ec31f6d9a09814c6c162a linuxdeployqt-7-x86_64.AppImage" | sha256sum -c && \ + chmod +x linuxdeployqt-7-x86_64.AppImage && \ + ./linuxdeployqt-7-x86_64.AppImage --appimage-extract && \ + rm linuxdeployqt-7-x86_64.AppImage + +RUN apt-get update && \ + apt-get -o Dpkg::Options::="--force-confold" install -q -y --force-yes libcairo2-dev libxinerama-dev +RUN git config --global --add safe.directory /wowlet \ No newline at end of file diff --git a/Dockerfile.android b/Dockerfile.android new file mode 100644 index 0000000..d093b02 --- /dev/null +++ b/Dockerfile.android @@ -0,0 +1,244 @@ +FROM debian:stretch + +ARG THREADS=1 +ARG ANDROID_NDK_REVISION=21d +ARG ANDROID_NDK_HASH=bcf4023eb8cb6976a4c7cff0a8a8f145f162bf4d +ARG ANDROID_SDK_REVISION=4333796 +ARG ANDROID_SDK_HASH=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9 +ARG QT_VERSION=5.15.2 + +WORKDIR /opt/android +ENV WORKDIR=/opt/android + +ENV ANDROID_NATIVE_API_LEVEL=28 +ENV ANDROID_API=android-${ANDROID_NATIVE_API_LEVEL} +ENV ANDROID_CLANG=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang +ENV ANDROID_CLANGPP=aarch64-linux-android${ANDROID_NATIVE_API_LEVEL}-clang++ +ENV ANDROID_NDK_ROOT=${WORKDIR}/android-ndk-r${ANDROID_NDK_REVISION} +ENV ANDROID_SDK_ROOT=${WORKDIR}/tools +ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 +ENV PATH=${JAVA_HOME}/bin:${PATH} +ENV PREFIX=${WORKDIR}/prefix +ENV TOOLCHAIN_DIR=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64 + +RUN apt-get update \ + && apt-get install -y ant automake build-essential ca-certificates-java file gettext git libc6 libncurses5 \ + libssl-dev libstdc++6 libtinfo5 libtool libz1 openjdk-8-jdk-headless openjdk-8-jre-headless pkg-config python3 \ + unzip wget + +RUN wget -q https://dl.google.com/android/repository/sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \ + && unzip -q sdk-tools-linux-${ANDROID_SDK_REVISION}.zip \ + && rm -f sdk-tools-linux-${ANDROID_SDK_REVISION}.zip + +RUN wget -q https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \ + && unzip -q android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip \ + && rm -f android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip + +RUN cd ${ANDROID_SDK_ROOT} && echo y | ./bin/sdkmanager "platform-tools" "platforms;${ANDROID_API}" "tools" > /dev/null +RUN cp -r ${WORKDIR}/platforms ${WORKDIR}/platform-tools ${ANDROID_SDK_ROOT} + +ENV HOST_PATH=${PATH} +ENV PATH=${TOOLCHAIN_DIR}/aarch64-linux-android/bin:${TOOLCHAIN_DIR}/bin:${PATH} + +ARG ZLIB_VERSION=1.2.11 +ARG ZLIB_HASH=c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1 +RUN wget -q https://zlib.net/zlib-${ZLIB_VERSION}.tar.gz \ + && tar -xzf zlib-${ZLIB_VERSION}.tar.gz \ + && rm zlib-${ZLIB_VERSION}.tar.gz \ + && cd zlib-${ZLIB_VERSION} \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --static \ + && make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 \ + && cd qt5 \ + && perl init-repository --module-subset=default,-qtwebengine \ + && PATH=${HOST_PATH} ./configure -v -developer-build -release \ + -xplatform android-clang \ + -android-ndk-platform ${ANDROID_API} \ + -android-ndk ${ANDROID_NDK_ROOT} \ + -android-sdk ${ANDROID_SDK_ROOT} \ + -android-ndk-host linux-x86_64 \ + -no-dbus \ + -opengl es2 \ + -no-use-gold-linker \ + -no-sql-mysql \ + -opensource -confirm-license \ + -android-arch arm64-v8a \ + -prefix ${PREFIX} \ + -nomake tools -nomake tests -nomake examples \ + -skip qtwebengine \ + -skip qtserialport \ + -skip qtconnectivity \ + -skip qttranslations \ + -skip qtpurchasing \ + -skip qtgamepad -skip qtscript -skip qtdoc \ + -no-warnings-are-errors \ + && sed -i '213,215d' qtbase/src/3rdparty/pcre2/src/sljit/sljitConfigInternal.h \ + && PATH=${HOST_PATH} make -j${THREADS} \ + && PATH=${HOST_PATH} make -j${THREADS} install \ + && cd qttools/src/linguist/lrelease \ + && ../../../../qtbase/bin/qmake \ + && PATH=${HOST_PATH} make -j${THREADS} install \ + && cd ../../../.. \ + && rm -rf $(pwd) + +ARG ICONV_VERSION=1.16 +ARG ICONV_HASH=e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04 +RUN wget -q http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${ICONV_VERSION}.tar.gz \ + && echo "${ICONV_HASH} libiconv-${ICONV_VERSION}.tar.gz" | sha256sum -c \ + && tar -xzf libiconv-${ICONV_VERSION}.tar.gz \ + && rm -f libiconv-${ICONV_VERSION}.tar.gz \ + && cd libiconv-${ICONV_VERSION} \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --build=x86_64-linux-gnu --host=aarch64 --prefix=${PREFIX} --disable-rpath \ + && make -j${THREADS} \ + && make -j${THREADS} install + +ARG BOOST_VERSION=1_74_0 +ARG BOOST_VERSION_DOT=1.74.0 +ARG BOOST_HASH=83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1 +RUN wget -q https://dl.bintray.com/boostorg/release/${BOOST_VERSION_DOT}/source/boost_${BOOST_VERSION}.tar.bz2 \ + && echo "${BOOST_HASH} boost_${BOOST_VERSION}.tar.bz2" | sha256sum -c \ + && tar -xf boost_${BOOST_VERSION}.tar.bz2 \ + && rm -f boost_${BOOST_VERSION}.tar.bz2 \ + && cd boost_${BOOST_VERSION} \ + && PATH=${HOST_PATH} ./bootstrap.sh --prefix=${PREFIX} \ + && PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} ./b2 --build-type=minimal link=static runtime-link=static \ + --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization \ + --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi \ + threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} \ + cflags='--target=aarch64-linux-android' \ + cxxflags='--target=aarch64-linux-android' \ + linkflags='--target=aarch64-linux-android --sysroot=${ANDROID_NDK_ROOT}/platforms/${ANDROID_API}/arch-arm64 ${ANDROID_NDK_ROOT}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so -nostdlib++' \ + install -j${THREADS} \ + && rm -rf $(pwd) + +ARG OPENSSL_VERSION=1.1.1g +ARG OPENSSL_HASH=ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46 +RUN wget -q https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz \ + && tar -xzf openssl-${OPENSSL_VERSION}.tar.gz \ + && rm openssl-${OPENSSL_VERSION}.tar.gz \ + && cd openssl-${OPENSSL_VERSION} \ + && ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} ./Configure CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} \ + android-arm64 no-asm no-shared --static \ + --with-zlib-include=${PREFIX}/include --with-zlib-lib=${PREFIX}/lib \ + --prefix=${PREFIX} --openssldir=${PREFIX} \ + && sed -i 's/CNF_EX_LIBS=-ldl -pthread//g;s/BIN_CFLAGS=-pie $(CNF_CFLAGS) $(CFLAGS)//g' Makefile \ + && ANDROID_NDK_HOME=${ANDROID_NDK_ROOT} make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +ARG ZMQ_VERSION=v4.3.3 +ARG ZMQ_HASH=04f5bbedee58c538934374dc45182d8fc5926fa3 +RUN git clone https://github.com/zeromq/libzmq.git -b ${ZMQ_VERSION} --depth 1 \ + && cd libzmq \ + && git checkout ${ZMQ_HASH} \ + && ./autogen.sh \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android \ + --enable-static --disable-shared \ + && make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +ARG SODIUM_VERSION=1.0.18 +ARG SODIUM_HASH=4f5e89fa84ce1d178a6765b8b46f2b6f91216677 +RUN set -ex \ + && git clone https://github.com/jedisct1/libsodium.git -b ${SODIUM_VERSION} --depth 1 \ + && cd libsodium \ + && test `git rev-parse HEAD` = ${SODIUM_HASH} || exit 1 \ + && ./autogen.sh \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --prefix=${PREFIX} --host=aarch64-linux-android --enable-static --disable-shared \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git \ + && cd libgpg-error \ + && git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 \ + && ./autogen.sh \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --disable-rpath --disable-shared --enable-static --disable-doc --disable-tests \ + && PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git \ + && cd libgcrypt \ + && git reset --hard 56606331bc2a80536db9fc11ad53695126007298 \ + && ./autogen.sh \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --host=aarch64-linux-android --prefix=${PREFIX} --with-gpg-error-prefix=${PREFIX} --disable-shared --enable-static --disable-doc --disable-tests \ + && PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +RUN cd tools \ + && wget -q http://dl-ssl.google.com/android/repository/tools_r25.2.5-linux.zip \ + && unzip -q tools_r25.2.5-linux.zip \ + && rm -f tools_r25.2.5-linux.zip \ + && echo y | ${ANDROID_SDK_ROOT}/tools/android update sdk --no-ui --all --filter build-tools-28.0.3 + +RUN git clone -b v3.19.7 --depth 1 https://github.com/Kitware/CMake \ + && cd CMake \ + && git reset --hard 22612dd53a46c7f9b4c3f4b7dbe5c78f9afd9581 \ + && PATH=${HOST_PATH} ./bootstrap \ + && PATH=${HOST_PATH} make -j${THREADS} \ + && PATH=${HOST_PATH} make -j${THREADS} install \ + && rm -rf $(pwd) + +RUN git clone -b v1.6.35 --depth 1 https://github.com/glennrp/libpng.git && \ + cd libpng && \ + git reset --hard c17d164b4467f099b4484dfd4a279da0bc1dbd4a \ + && CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} ./configure --with-zlib-prefix="${PREFIX}" --host=aarch64-linux-android --prefix=${PREFIX} --disable-shared --enable-static \ + && PATH=${TOOLCHAIN_DIR}/bin:${HOST_PATH} make -j${THREADS} \ + && make -j${THREADS} install \ + && rm -rf $(pwd) + +# @TODO: don't hardcode ANDROID_PLATFORM +RUN git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git && \ + cd libqrencode && \ + git reset --hard 59ee597f913fcfda7a010a6e106fbee2595f68e4 && \ + CC=${ANDROID_CLANG} CXX=${ANDROID_CLANGPP} cmake \ + -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" \ + -DANDROID_PLATFORM="28" \ + -DBUILD_SHARED_LIBS=OFF \ + -DARCH="armv8-a" \ + -DANDROID_ABI="arm64-v8a" \ + -DANDROID_TOOLCHAIN=clang \ + -DCMAKE_PREFIX_PATH="${PREFIX}" \ + -DPNG_PNG_INCLUDE_DIR="${PREFIX}/include/libpng16/" \ + -DPNG_LIBRARY="${PREFIX}/lib/libqtlibpng_arm64-v8a.a" \ + -DICONV_LIBRARY=/opt/android/prefix/lib/libiconv.a \ + -DICONV_INCLUDE_DIR=/opt/android/prefix/include/ \ + -DCMAKE_INSTALL_PREFIX="${PREFIX}" && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN ls -al && uname -a + +# @TODO: switch to Release +CMD set -ex \ + && cd /wowlet \ + && mkdir -p build/Android/release \ + && cd build/Android/release \ + && E=1 cmake \ + -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_ROOT}/build/cmake/android.toolchain.cmake" \ + -DCMAKE_PREFIX_PATH="${PREFIX}" \ + -DCMAKE_FIND_ROOT_PATH="${PREFIX}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DARCH="armv8-a" \ + -DANDROID_NATIVE_API_LEVEL=${ANDROID_NATIVE_API_LEVEL} \ + -DANDROID_ABI="arm64-v8a" \ + -DANDROID_TOOLCHAIN=clang \ + -DBoost_USE_STATIC_RUNTIME=ON \ + -DLRELEASE_PATH="${PREFIX}/bin" \ + -DQT_ANDROID_APPLICATION_BINARY="wowlet" \ + -DWITH_SCANNER=ON \ + -DUSE_DEVICE_TREZOR=OFF \ + -DUSE_SINGLE_BUILDDIR=ON \ + -DMANUAL_SUBMODULES=1 \ + -DUSE_SINGLE_BUILDDIR=ON \ + -DANDROID=ON \ + ../../.. \ + && PATH=${HOST_PATH} make generate_translations_header \ + && make -j${THREADS} -C src \ + && make -j${THREADS} apk diff --git a/Dockerfile.windows b/Dockerfile.windows new file mode 100644 index 0000000..13f0968 --- /dev/null +++ b/Dockerfile.windows @@ -0,0 +1,189 @@ +FROM ubuntu:20.04 + +ARG THREADS=1 +ARG QT_VERSION=v5.15.2 +ENV SOURCE_DATE_EPOCH=1397818193 + +ENV OPENSSL_ROOT_DIR=/usr/local/openssl/ +ENV TOR_BIN=/usr/local/tor/bin/tor.exe +ENV TOR_VERSION='tor-0.4.5.7' + +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive apt install -y curl nano wget zip automake build-essential cmake gcc-mingw-w64 g++-mingw-w64 gettext git libtool pkg-config \ + python && \ + rm -rf /var/lib/apt/lists/* + +RUN update-alternatives --set x86_64-w64-mingw32-g++ $(which x86_64-w64-mingw32-g++-posix) && \ + update-alternatives --set x86_64-w64-mingw32-gcc $(which x86_64-w64-mingw32-gcc-posix) + +RUN git clone -b v0.18.2.0 --depth 1 https://github.com/monero-project/monero && \ + cd monero && \ + git reset --hard 99be9a044f3854f339548e2d99c539c18d7b1b01 && \ + cp -a contrib/depends / && \ + cd .. && \ + rm -rf monero + +RUN make -j$THREADS -C /depends HOST=x86_64-w64-mingw32 NO_QT=1 + +RUN git clone git://code.qt.io/qt/qt5.git -b ${QT_VERSION} --depth 1 && \ + cd qt5 && \ + git clone git://code.qt.io/qt/qtbase.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtdeclarative.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtgraphicaleffects.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtimageformats.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtmultimedia.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtquickcontrols.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtquickcontrols2.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtsvg.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qttools.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qttranslations.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtxmlpatterns.git -b ${QT_VERSION} --depth 1 && \ + git clone git://code.qt.io/qt/qtwebsockets.git -b ${QT_VERSION} --depth 1 && \ + OPENSSL_LIBS="-lssl -lcrypto -lpthread -ldl" \ + ./configure --prefix=/depends/x86_64-w64-mingw32 -xplatform win32-g++ \ + -device-option CROSS_COMPILE=/usr/bin/x86_64-w64-mingw32- \ + -I $(pwd)/qtbase/src/3rdparty/angle/include \ + -opensource -confirm-license -release -static -static-runtime -opengl dynamic -no-angle \ + -no-feature-qml-worker-script -no-avx -openssl -I /depends/x86_64-w64-mingw32/include -L /depends/x86_64-w64-mingw32/lib \ + -qt-freetype -qt-harfbuzz -qt-libjpeg -qt-libpng -qt-pcre -qt-zlib \ + -skip gamepad -skip location -skip qt3d -skip qtactiveqt -skip qtandroidextras \ + -skip qtcanvas3d -skip qtcharts -skip qtconnectivity -skip qtdatavis3d -skip qtdoc \ + -skip qtgamepad -skip qtlocation -skip qtmacextras -skip qtnetworkauth -skip qtpurchasing \ + -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport \ + -skip qtspeech -skip qttools -skip qtvirtualkeyboard -skip qtwayland -skip qtwebchannel \ + -skip qtwebengine -skip qtwebview -skip qtwinextras -skip qtx11extras \ + -skip serialbus -skip webengine \ + -nomake examples -nomake tests -nomake tools && \ + make -j$THREADS && \ + make -j$THREADS install && \ + cd qttools/src/linguist/lrelease && \ + ../../../../qtbase/bin/qmake && \ + make -j$THREADS && \ + make -j$THREADS install && \ + cd ../../../.. && \ + rm -rf $(pwd) + +RUN git clone -b libgpg-error-1.38 --depth 1 git://git.gnupg.org/libgpg-error.git && \ + cd libgpg-error && \ + git reset --hard 71d278824c5fe61865f7927a2ed1aa3115f9e439 && \ + ./autogen.sh && \ + ./configure --disable-shared --enable-static --disable-doc --disable-tests \ + --host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + cd .. && \ + rm -rf libgpg-error + +RUN git clone -b libgcrypt-1.8.5 --depth 1 git://git.gnupg.org/libgcrypt.git && \ + cd libgcrypt && \ + git reset --hard 56606331bc2a80536db9fc11ad53695126007298 && \ + ./autogen.sh && \ + ./configure --disable-shared --enable-static --disable-doc \ + --host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 \ + --with-gpg-error-prefix=/depends/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + cd .. && \ + rm -rf libgcrypt + +# zlib -> libpng, Tor +RUN git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib && \ + cd zlib && \ + git reset --hard cacf7f1d4e3d44d871b605da3b647f07d718623f && \ + CC=x86_64-w64-mingw32-gcc AR=x86_64-w64-mingw32-ar ./configure --static --prefix=/usr/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +# libpng -> libqrencode +RUN git clone -b libpng16 https://github.com/glennrp/libpng.git && \ + cd libpng && \ + git reset --hard a37d4836519517bdce6cb9d956092321eca3e73b && \ + CPPFLAGS="-I/depends/x86_64-w64-mingw32/include" LDFLAGS="-L/depends/x86_64-w64-mingw32/lib" \ + ./configure --host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b v4.0.2 --depth 1 https://github.com/fukuchi/libqrencode.git && \ + cd libqrencode && \ + git reset --hard 59ee597f913fcfda7a010a6e106fbee2595f68e4 && \ + ./autogen.sh && \ + CPPFLAGS="-I/depends/x86_64-w64-mingw32/include" LDFLAGS="-L/depends/x86_64-w64-mingw32/lib" \ + ./configure --disable-shared --enable-static --host=x86_64-w64-mingw32 --prefix=/depends/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz && \ + echo "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04 libiconv-1.16.tar.gz" | sha256sum -c && \ + tar -xzf libiconv-1.16.tar.gz && \ + rm libiconv-1.16.tar.gz && \ + cd libiconv-1.16 && \ + ./configure --enable-static --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +# OpenSSL -> Tor +RUN wget https://www.openssl.org/source/openssl-1.1.1k.tar.gz && \ + echo "892a0875b9872acd04a9fde79b1f943075d5ea162415de3047c327df33fbaee5 openssl-1.1.1k.tar.gz" | sha256sum -c && \ + tar -xzf openssl-1.1.1k.tar.gz && \ + rm openssl-1.1.1k.tar.gz && \ + cd openssl-1.1.1k && \ + ./Configure mingw64 no-shared no-dso --cross-compile-prefix=x86_64-w64-mingw32- --prefix=/usr/local/openssl && \ + make -j$THREADS && \ + make -j$THREADS install_sw && \ + rm -rf $(pwd) + +# libevent -> Tor +RUN wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gz && \ + echo "a65bac6202ea8c5609fd5c7e480e6d25de467ea1917c08290c521752f147283d libevent-2.1.11-stable.tar.gz" | sha256sum -c && \ + tar -zxvf libevent-2.1.11-stable.tar.gz && \ + cd libevent-2.1.11-stable && \ + ./configure --prefix=/usr/local/libevent \ + --disable-shared \ + --enable-static \ + --with-pic \ + --host=x86_64-w64-mingw32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) + +RUN git clone -b tor-0.4.5.7 --depth 1 https://git.torproject.org/tor.git && \ + cd tor && \ + git reset --hard 83f895c015de55201e5f226f84a866f30f5ee14b && \ + ./autogen.sh && \ + ./configure --host=x86_64-w64-mingw32 \ + --disable-asciidoc \ + --disable-zstd \ + --disable-lzma \ + --disable-manpage \ + --disable-html-manual \ + --disable-system-torrc \ + --disable-module-relay \ + --enable-static-tor \ + --with-libevent-dir=/usr/local/libevent \ + --with-openssl-dir=/usr/local/openssl \ + --with-zlib-dir=/usr/x86_64-w64-mingw32 \ + --disable-tool-name-check \ + --enable-fatal-warnings \ + --prefix=/usr/local/tor \ + LIBS=-lcrypt32 && \ + make -j$THREADS && \ + make -j$THREADS install && \ + rm -rf $(pwd) && \ + strip -s -D /usr/local/tor/bin/tor.exe + +RUN git clone https://git.wownero.com/wowlet/wownero-seed.git && \ + cd wownero-seed && \ + git reset --hard ef6910b6bb3b61757c36e2e5db0927d75f1731c8 && \ + cmake -DCMAKE_INSTALL_PREFIX=/depends/x86_64-w64-mingw32 \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_TOOLCHAIN_FILE=/depends/x86_64-w64-mingw32/share/toolchain.cmake -Bbuild && \ + make -Cbuild -j$THREADS && \ + make -Cbuild install && \ + rm -rf $(pwd) + +RUN git config --global --add safe.directory /wowlet +RUN git config --global --add safe.directory /wowlet/wownero diff --git a/Dockerfile_windows b/Dockerfile.windows_mxe similarity index 92% rename from Dockerfile_windows rename to Dockerfile.windows_mxe index e81fa5e..7361268 100644 --- a/Dockerfile_windows +++ b/Dockerfile.windows_mxe @@ -48,7 +48,7 @@ RUN apt install -y \ wget \ xz-utils -RUN git clone -b feather-patch --depth 1 https://git.wownero.com/feather/mxe.git && \ +RUN git clone -b wowlet-patch --depth 1 https://git.wownero.com/wowlet/mxe.git && \ cd mxe && \ make -j$THREADS MXE_TARGETS='x86_64-w64-mingw32.static' gcc libqrencode pkgconf libgpg_error libgcrypt cmake libsodium lzma readline libzmq boost qtbase qtsvg qtwebsockets qtimageformats qtmultimedia @@ -67,7 +67,7 @@ RUN ln -s /mxe/usr/x86_64-w64-mingw32.static/lib/libsicuin.a /mxe/usr/x86_64-w64 ENV PATH="/mxe/usr/bin/:$PATH" -RUN git clone https://git.wownero.com/feather/monero-seed.git && \ +RUN git clone https://git.wownero.com/wowlet/monero-seed.git && \ cd monero-seed && \ cmake -DCMAKE_BUILD_TYPE=Release -Bbuild && \ make -Cbuild -j$THREADS && \ diff --git a/Dockerfile_appimage b/Dockerfile_appimage deleted file mode 100644 index 07efe28..0000000 --- a/Dockerfile_appimage +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt clean && apt update -RUN apt install -y golang git build-essential wget curl ngrep unzip file squashfs-tools desktop-file-utils patchelf libxkbcommon-x11-dev libx11-xcb-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-shm0 libxcb-keysyms1 libxcb-xkb1 - -RUN go get github.com/probonopd/go-appimage/src/appimagetool -RUN go build -trimpath -ldflags="-s -w" github.com/probonopd/go-appimage/src/appimagetool -RUN chmod +x appimagetool - -RUN cd /usr/bin && \ - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh -O uploadtool && \ - chmod +x uploadtool - -RUN cd / && \ - wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64 && \ - chmod +x runtime-x86_64 diff --git a/Dockerfile_macos b/Dockerfile_macos deleted file mode 100644 index f94f367..0000000 --- a/Dockerfile_macos +++ /dev/null @@ -1,13 +0,0 @@ -# this image is used internally for the buildbot -FROM ubuntu:20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt clean && apt update -RUN apt install -y git build-essential wget curl ngrep unzip file ssh zip - -RUN cat /dev/zero | ssh-keygen -q -N "" - -RUN cat ~/.ssh/id_rsa.pub - -RUN printf "Host *\n StrictHostKeyChecking no" > ~/.ssh/config \ No newline at end of file diff --git a/HACKING.md b/HACKING.md deleted file mode 100644 index fd27af9..0000000 --- a/HACKING.md +++ /dev/null @@ -1,105 +0,0 @@ -# Documentation for developers - -Feather is developed primarily on Linux. It uses Qt 5.15.* and chances are that your -distro's package manager has a lower version. It is therefore recommended that you install -Qt manually using the online installer, which can be found here: https://www.qt.io/download -(under open-source). - -## Jetbrains Clion - -Feather was developed using JetBrains Clion since it integrates nicely -with CMake and comes with a built-in debugger. To pass CMake flags to CLion, -go to `File->Settings->Build->CMake`, set Build Type to `Debug` and set your -preferred CMake options/definitions. - -## Requirements - -### Ubuntu/Debian - -```bash -apt install -y git cmake libqrencode-dev build-essential cmake libboost-all-dev \ -miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev \ -libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev \ -libprotobuf-dev protobuf-compiler libgcrypt20-dev -``` - -## Mac OS - -```bash -brew install boost zmq openssl libpgm miniupnpc libsodium expat libunwind-headers \ -protobuf libgcrypt qrencode ccache cmake pkgconfig git -``` - -## CMake - -After installing Qt you might have a folder called `/home/$user/Qt/`. You need to pass this to CMake -via the `CMAKE_PREFIX_PATH` definition. For me this is: - -``` --DCMAKE_PREFIX_PATH=/home/dsc/QtNew/5.15.0/gcc_64 -``` - -There are some Monero/Feather related options/definitions that you may pass: - -- `-DXMRTO=OFF` - disable Xmr.To feature -- `-DXMRIG=OFF` - disable XMRig feature -- `-DTOR_BIN=/path/to/tor` - Embed a Tor executable inside Feather -- `-DDONATE_BEG=OFF` - disable the dreaded donate requests - -And: - -``` --DMANUAL_SUBMODULES=1 --DUSE_DEVICE_TREZOR=OFF --DUSE_SINGLE_BUILDDIR=ON --DDEV_MODE=ON -``` - -If you have OpenSSL installed in a custom location, try: - -``` --DOPENSSL_INCLUDE_DIR=/usr/local/lib/openssl-1.1.1g/include --DOPENSSL_SSL_LIBRARY=/usr/local/lib/openssl-1.1.1g/libssl.so.1.1 --DOPENSSL_CRYPTO_LIBRARY=/usr/local/lib/openssl-1.1.1g/libcrypto.so.1.1 -``` - -I prefer also enabling verbose makefiles, which may be useful in some situations. - -``` --DCMAKE_VERBOSE_MAKEFILE=ON -``` - -Enable debugging symbols: - -```bash --DCMAKE_BUILD_TYPE=Debug -``` - -## Feather - -It's best to install Tor locally as a service and start Feather with `--use-local-tor`, this -prevents the child process from starting up and saves time. - -#### Ubuntu/Debian - -```bash -apt install -y tor -sudo service tor start -``` - -#### Mac OS - -```bash -brew install tor -brew services start tor -``` - -To skip the wizards and open a wallet directly use `--wallet-file`: - -```bash -./feather --use-local-tor --wallet-file /home/user/Monero/wallets/bla.keys -``` - -It is recommended that you use `--stagenet` for development. Testnet is also possible, -but you'll have to provide Feather a testnet node of your own. - diff --git a/LICENSE b/LICENSE index b99f64a..01aafe9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2020, The Monero Project +Copyright (c) 2020-2021, The Monero Project All rights reserved. diff --git a/Makefile b/Makefile index fe1a511..e6fa0d6 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,9 @@ # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY CMAKEFLAGS = \ - -DARCH=x86_64 \ -DBUILD_64=On \ -DBUILD_TESTS=Off \ - -DXMRTO=On \ - -DXMRIG=On \ + -DOPENVR=Off \ -DTOR_BIN=Off \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_VERBOSE_MAKEFILE=On \ @@ -42,14 +40,27 @@ CMAKEFLAGS = \ $(CMAKEFLAGS_EXTRA) release-static: CMAKEFLAGS += -DBUILD_TAG="linux-x64" +release-static: CMAKEFLAGS += -DXMRIG=OFF +release-static: CMAKEFLAGS += -DARCH=x86-64 release-static: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) release-static: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release +release-static: CMAKEFLAGS += -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) release-static: cmake -Bbuild $(CMAKEFLAGS) $(MAKE) -Cbuild +depends: + mkdir -p build/$(target)/release + cd build/$(target)/release && cmake -D STATIC=ON -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DTOR_BIN=$(or ${TOR_BIN},OFF) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE) + +windows: + mkdir -p build/$(target)/release + cd build/$(target)/release && cmake -D STATIC=ON -DZLIB_ROOT=/usr/x86_64-w64-mingw32/ -DREPRODUCIBLE=$(or ${SOURCE_DATE_EPOCH},OFF) -DTOR_VERSION=$(or ${TOR_VERSION}, OFF) -DOPENVR=ON -DWITH_SCANNER=ON -DTOR_BIN=$(or ${TOR_BIN},OFF) -D DEV_MODE=$(or ${DEV_MODE},OFF) -D BUILD_TAG=$(tag) -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=$(root)/$(target)/share/toolchain.cmake ../../.. && $(MAKE) + + windows-mxe-release: CMAKEFLAGS += -DBUILD_TAG="win-x64" windows-mxe-release: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) +windows-mxe-debug: CMAKEFLAGS += -DOPENVR=On windows-mxe-release: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release windows-mxe-release: cmake -Bbuild $(CMAKEFLAGS) @@ -57,16 +68,8 @@ windows-mxe-release: windows-mxe-debug: CMAKEFLAGS += -DBUILD_TAG="win-x64" windows-mxe-debug: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) +windows-mxe-debug: CMAKEFLAGS += -DOPENVR=On windows-mxe-debug: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Debug windows-mxe-debug: cmake -Bbuild $(CMAKEFLAGS) $(MAKE) -Cbuild - -mac-release: CMAKEFLAGS += -DSTATIC=Off -mac-release: CMAKEFLAGS += -DTOR_BIN=$(or ${TOR_BIN},OFF) -mac-release: CMAKEFLAGS += -DBUILD_TAG="mac-x64" -mac-release: CMAKEFLAGS += -DCMAKE_BUILD_TYPE=Release -mac-release: - cmake -Bbuild $(CMAKEFLAGS) - $(MAKE) -Cbuild - $(MAKE) -Cbuild deploy \ No newline at end of file diff --git a/README.md b/README.md index c8a1d01..a04633e 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,14 @@ -# Feather - a free Monero desktop wallet +# WOWlet- a free Wownero desktop wallet -[![Build Status](https://build.featherwallet.org/api/badges/feather/feather/status.svg)](https://build.featherwallet.org/feather/feather) +WOWlet is a free, open-source Wownero client for Linux, Mac OS, and Windows. -Feather is a free, open-source Monero client Linux with ports for Mac OS and Windows written in C++ with the Qt framework. It is created and maintained by [dsc](dsc@xmr.pm) and [tobtoht](thotbot@protonmail.com). +![https://i.imgur.com/l7fUf0f.png](https://i.imgur.com/l7fUf0f.png) ## Development resources -* Web: [featherwallet.org](https://featherwallet.org) -* Git: [git.wownero.com/feather/feather](https://git.wownero.com/feather/feather) -* IRC: `#feather` on OFTC -* Development builds: [build.featherwallet.org/files](https://build.featherwallet.org/files/) + +* Git: [git.wownero.com/wowlet/wowlet](https://git.wownero.com/wowlet/wowlet) +* IRC: `#wownero-dev` on [OFTC](https://oftc.net/) +* [Building WOWlet from source](https://git.wownero.com/wowlet/wowlet/src/branch/master/docs/BUILDING.md) +* [Working on WOWlet](https://git.wownero.com/wowlet/wowlet/src/branch/master/docs/HACKING.md) Copyright (c) 2020-2021 The Monero Project. - -## Compiling Feather from source - -Feather uses Monero, as such it requires the same dependencies as outlined in [Monero's README](https://github.com/monero-project/monero#compiling-monero-from-source). Additionally, Feather uses: - -- Qt 5.15.0 -- libqrencode -- openpgp - -See [BUILDING.md](https://git.wownero.com/feather/feather/src/branch/master/BUILDING.md) for information on how to compile a build. - -## Supporting the project - -Feather is a 100% community-sponsored endeavor. If you want to join our efforts, the easiest thing you can do is support the project financially. - -`47ntfT2Z5384zku39pTM6hGcnLnvpRYW2Azm87GiAAH2bcTidtq278TL6HmwyL8yjMeERqGEBs3cqC8vvHPJd1cWQrGC65f` - -## Developers - -See [HACKING.md](https://git.wownero.com/feather/feather/src/branch/master/HACKING.md) for useful development resources. - -It is HIGHLY recommended that you join the `#feather` IRC channel on OFTC if you are hacking on Feather. Due to the nature of this open source software project, joining this channel and idling is the best way to stay updated on best practices and new developments. diff --git a/cmake/Deploy.cmake b/cmake/Deploy.cmake index 1a1e76b..96d6446 100644 --- a/cmake/Deploy.cmake +++ b/cmake/Deploy.cmake @@ -2,27 +2,4 @@ if(APPLE OR (WIN32 AND NOT STATIC)) add_custom_target(deploy) get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) - - if(APPLE AND NOT IOS) - find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") - add_custom_command(TARGET deploy - POST_BUILD - COMMAND "${MACDEPLOYQT_EXECUTABLE}" "$/../.." -always-overwrite - COMMENT "Running macdeployqt..." - ) - - # workaround for a Qt bug that requires manually adding libqsvg.dylib to bundle - find_file(_qt_svg_dylib "libqsvg.dylib" PATHS "${CMAKE_PREFIX_PATH}/plugins/imageformats" NO_DEFAULT_PATH) - if(_qt_svg_dylib) - add_custom_command(TARGET deploy - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${_qt_svg_dylib} $/../PlugIns/imageformats/ - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtGui.framework/Versions/5/QtGui" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtWidgets.framework/Versions/5/QtWidgets" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtSvg.framework/Versions/5/QtSvg" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -change "${CMAKE_PREFIX_PATH}/lib/QtCore.framework/Versions/5/QtCore" "@executable_path/../Frameworks/QtGui.framework/Versions/5/QtGui" $/../PlugIns/imageformats/libqsvg.dylib - COMMENT "Copying libqsvg.dylib, running install_name_tool" - ) - endif() - endif() -endif() \ No newline at end of file +endif() diff --git a/cmake/FindCairo.cmake b/cmake/FindCairo.cmake new file mode 100644 index 0000000..cbda752 --- /dev/null +++ b/cmake/FindCairo.cmake @@ -0,0 +1,81 @@ +# - Try to find Cairo +# Once done, this will define +# +# CAIRO_FOUND - system has Cairo +# CAIRO_INCLUDE_DIRS - the Cairo include directories +# CAIRO_LIBRARIES - link these to use Cairo +# +# Copyright (C) 2012 Raphael Kubo da Costa +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND ITS CONTRIBUTORS ``AS +# IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR ITS +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +FIND_PACKAGE(PkgConfig) +PKG_CHECK_MODULES(PC_CAIRO cairo) # FIXME: After we require CMake 2.8.2 we can pass QUIET to this call. + +FIND_PATH(CAIRO_INCLUDE_DIRS + NAMES cairo.h + HINTS ${PC_CAIRO_INCLUDEDIR} + ${PC_CAIRO_INCLUDE_DIRS} + PATH_SUFFIXES cairo + ) + +FIND_LIBRARY(CAIRO_LIBRARIES + NAMES cairo + HINTS ${PC_CAIRO_LIBDIR} + ${PC_CAIRO_LIBRARY_DIRS} + ) + +IF (CAIRO_INCLUDE_DIRS) + IF (EXISTS "${CAIRO_INCLUDE_DIRS}/cairo-version.h") + FILE(READ "${CAIRO_INCLUDE_DIRS}/cairo-version.h" CAIRO_VERSION_CONTENT) + + STRING(REGEX MATCH "#define +CAIRO_VERSION_MAJOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + SET(CAIRO_VERSION_MAJOR "${CMAKE_MATCH_1}") + + STRING(REGEX MATCH "#define +CAIRO_VERSION_MINOR +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + SET(CAIRO_VERSION_MINOR "${CMAKE_MATCH_1}") + + STRING(REGEX MATCH "#define +CAIRO_VERSION_MICRO +([0-9]+)" _dummy "${CAIRO_VERSION_CONTENT}") + SET(CAIRO_VERSION_MICRO "${CMAKE_MATCH_1}") + + SET(CAIRO_VERSION "${CAIRO_VERSION_MAJOR}.${CAIRO_VERSION_MINOR}.${CAIRO_VERSION_MICRO}") + ENDIF () +ENDIF () + +# FIXME: Should not be needed anymore once we start depending on CMake 2.8.3 +SET(VERSION_OK TRUE) +IF (Cairo_FIND_VERSION) + IF (Cairo_FIND_VERSION_EXACT) + IF ("${Cairo_FIND_VERSION}" VERSION_EQUAL "${CAIRO_VERSION}") + # FIXME: Use IF (NOT ...) with CMake 2.8.2+ to get rid of the ELSE block + ELSE () + SET(VERSION_OK FALSE) + ENDIF () + ELSE () + IF ("${Cairo_FIND_VERSION}" VERSION_GREATER "${CAIRO_VERSION}") + SET(VERSION_OK FALSE) + ENDIF () + ENDIF () +ENDIF () + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cairo DEFAULT_MSG CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES VERSION_OK) diff --git a/cmake/FindQREncode.cmake b/cmake/FindQREncode.cmake index 2f93c2b..8fe6bbb 100644 --- a/cmake/FindQREncode.cmake +++ b/cmake/FindQREncode.cmake @@ -1,5 +1,8 @@ find_path(QRENCODE_INCLUDE_DIR qrencode.h) +message(STATUS "QRENCODE PATH ${QRENCODE_INCLUDE_DIR}") + find_library(QRENCODE_LIBRARY qrencode) +message(STATUS "QRENCODE LIBARY ${QRENCODE_LIBRARY}") mark_as_advanced(QRENCODE_LIBRARY QRENCODE_INCLUDE_DIR) diff --git a/cmake/FindXfixes.cmake b/cmake/FindXfixes.cmake new file mode 100644 index 0000000..6bb6d6e --- /dev/null +++ b/cmake/FindXfixes.cmake @@ -0,0 +1,26 @@ +# - Find XFixes +# Find the XFixes libraries +# +# This module defines the following variables: +# XFIXES_FOUND - 1 if XFIXES_INCLUDE_DIR & XFIXES_LIBRARY are found, 0 otherwise +# XFIXES_INCLUDE_DIR - where to find Xlib.h, etc. +# XFIXES_LIBRARY - the X11 library +# + +find_path( XFIXES_INCLUDE_DIR + NAMES X11/extensions/Xfixes.h + PATH_SUFFIXES X11/extensions + DOC "The XFixes include directory" ) + +find_library( XFIXES_LIBRARY + NAMES Xfixes + PATHS /usr/lib /lib + DOC "The XFixes library" ) + +if( XFIXES_INCLUDE_DIR AND XFIXES_LIBRARY ) + set( XFIXES_FOUND 1 ) +else() + set( XFIXES_FOUND 0 ) +endif() + +mark_as_advanced( XFIXES_INCLUDE_DIR XFIXES_LIBRARY ) \ No newline at end of file diff --git a/cmake/GenVersion.cmake b/cmake/GenVersion.cmake index 220a03a..f2f83f7 100644 --- a/cmake/GenVersion.cmake +++ b/cmake/GenVersion.cmake @@ -35,7 +35,7 @@ if(RET) message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.") set(VERSIONTAG "unknown") set(VERSION_IS_RELEASE "false") - configure_file("monero/src/version.cpp.in" "${TO}") + configure_file("wownero/src/version.cpp.in" "${TO}") else() string(SUBSTRING ${COMMIT} 0 9 COMMIT) message(STATUS "You are currently on commit ${COMMIT}") @@ -61,5 +61,5 @@ else() set(VERSION_IS_RELEASE "false") endif() endif() - configure_file("monero/src/version.cpp.in" "${TO}") + configure_file("wownero/src/version.cpp.in" "${TO}") endif() \ No newline at end of file diff --git a/cmake/VersionMonero.cmake b/cmake/VersionMonero.cmake index 4600c7c..f7361c1 100644 --- a/cmake/VersionMonero.cmake +++ b/cmake/VersionMonero.cmake @@ -4,7 +4,7 @@ find_package(Git QUIET) # Check what commit we're on execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short=9 HEAD RESULT_VARIABLE RET OUTPUT_VARIABLE COMMIT OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/monero) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero) if(RET) # Something went wrong, set the version tag to -unknown @@ -37,7 +37,7 @@ endif() # Check latest tagged release execute_process(COMMAND "${GIT_EXECUTABLE}" describe --abbrev=0 RESULT_VARIABLE RET OUTPUT_VARIABLE TAG OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/monero) + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero) if(RET) message(WARNING "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.") @@ -46,4 +46,4 @@ else () set(MONERO_VERSION "${TAG}") endif() -configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h") \ No newline at end of file +configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h") \ No newline at end of file diff --git a/cmake/VersionFeather.cmake b/cmake/VersionWowlet.cmake similarity index 78% rename from cmake/VersionFeather.cmake rename to cmake/VersionWowlet.cmake index fc12faf..2c15345 100644 --- a/cmake/VersionFeather.cmake +++ b/cmake/VersionWowlet.cmake @@ -10,8 +10,8 @@ if(RET) # Something went wrong, set the version tag to -unknown message(WARNING "Cannot determine current commit. Make sure that you are building either from a Git working tree or from a source archive.") - set(FEATHER_BRANCH "unknown") - configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h") + set(WOWLET_BRANCH "unknown") + configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h") else() string(SUBSTRING ${COMMIT} 0 9 COMMIT) message(STATUS "You are currently on commit ${COMMIT}") @@ -21,19 +21,19 @@ else() if(NOT TAGGEDCOMMIT) message(STATUS "Cannot determine most recent tag. Make sure that you are building either from a Git working tree or from a source archive.") - set(FEATHER_BRANCH "${COMMIT}") + set(WOWLET_BRANCH "${COMMIT}") else() message(STATUS "The most recent tag was at ${TAGGEDCOMMIT}") # Check if we're building that tagged commit or a different one if(COMMIT STREQUAL TAGGEDCOMMIT) message(STATUS "You are building a tagged release") - set(FEATHER_BRANCH "release") + set(WOWLET_BRANCH "release") else() message(STATUS "You are ahead of or behind a tagged release") - set(FEATHER_BRANCH "${COMMIT}") + set(WOWLET_BRANCH "${COMMIT}") endif() endif() - configure_file("cmake/config-feather.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-feather.h") + configure_file("cmake/config-wowlet.h.cmake" "${CMAKE_CURRENT_SOURCE_DIR}/src/config-wowlet.h") endif() diff --git a/cmake/config-feather.h.cmake b/cmake/config-feather.h.cmake deleted file mode 100644 index f2aef1e..0000000 --- a/cmake/config-feather.h.cmake +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef FEATHER_VERSION_H -#define FEATHER_VERSION_H - -#define FEATHER_VERSION "@VERSION@" -#define FEATHER_BRANCH "@FEATHER_BRANCH@" - -#define MONERO_VERSION "@MONERO_VERSION@" -#define MONERO_BRANCH "@MONERO_BRANCH@" - -#endif //FEATHER_VERSION_H diff --git a/cmake/config-wowlet.h.cmake b/cmake/config-wowlet.h.cmake new file mode 100644 index 0000000..cd8681e --- /dev/null +++ b/cmake/config-wowlet.h.cmake @@ -0,0 +1,13 @@ +#ifndef WOWLET_VERSION_H +#define WOWLET_VERSION_H + +#define WOWLET_VERSION "@VERSION@" +#define WOWLET_BRANCH "@WOWLET_BRANCH@" +#define WOWLET_VERSION_SEMVER "@VERSION_MAJOR@.@VERSION_MINOR@.@VERSION_REVISION@" + +#define MONERO_VERSION "@MONERO_VERSION@" +#define MONERO_BRANCH "@MONERO_BRANCH@" + +#define TOR_VERSION "@TOR_VERSION@" + +#endif //WOWLET_VERSION_H diff --git a/PKGBUILD b/contrib/PKGBUILD similarity index 96% rename from PKGBUILD rename to contrib/PKGBUILD index e271d9e..43b3add 100644 --- a/PKGBUILD +++ b/contrib/PKGBUILD @@ -7,7 +7,7 @@ pkgrel=1 pkgdesc='a free Monero desktop wallet' license=('BSD') arch=('x86_64') -url="https://featherwallet.org" +url="https://wownero.org" depends=('boost-libs' 'libunwind' 'openssl' 'readline' 'pcsclite' 'hidapi' 'protobuf' 'miniupnpc' 'libgcrypt' 'qrencode' 'libsodium' 'libpgm' 'expat' 'qt5-base' 'qt5-websockets' 'tor') makedepends=('git' 'cmake' 'boost') diff --git a/contrib/build-appimage.sh b/contrib/build-appimage.sh deleted file mode 100644 index 9143d94..0000000 --- a/contrib/build-appimage.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -set -e - -APPDIR="$PWD/feather.AppDir" -mkdir -p "$APPDIR" -mkdir -p "$APPDIR/usr/share/applications/" -mkdir -p "$APPDIR/usr/bin" - -unzip -q feather.zip - -cp "$PWD/src/assets/feather.desktop" "$APPDIR/usr/share/applications/feather.desktop" -cp "$PWD/src/assets/images/appicons/64x64.png" "$APPDIR/feather.png" -cp "$PWD/feather" "$APPDIR/usr/bin/feather" - -/appimagetool deploy "$APPDIR/usr/share/applications/feather.desktop" -VERSION=1.0 /appimagetool ./feather.AppDir - diff --git a/contrib/debian/build-deb.sh b/contrib/debian/build-deb.sh new file mode 100755 index 0000000..60a655f --- /dev/null +++ b/contrib/debian/build-deb.sh @@ -0,0 +1,46 @@ +#!/bin/bash +set -e + +# Make directories + +DEBDIR="$PWD/wowlet.DebDir" +mkdir -p "$DEBDIR" +mkdir -p "$DEBDIR/DEBIAN/" +mkdir -p "$DEBDIR/debian/" +mkdir -p "$DEBDIR/usr/bin/" +mkdir -p "$DEBDIR/usr/share/doc/wowlet/" +mkdir -p "$DEBDIR/usr/share/metainfo/" +mkdir -p "$DEBDIR/usr/share/applications/" +mkdir -p "$DEBDIR/usr/share/man/man1/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/scalable/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/48x48/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/64x64/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/96x96/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/128x128/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/192x192/apps/" +mkdir -p "$DEBDIR/usr/share/icons/hicolor/256x256/apps/" + +# Copy over assets + +cp "$PWD/contrib/debian/control" "$DEBDIR/DEBIAN/control" +cp "$PWD/contrib/debian/copyright" "$DEBDIR/debian/copyright" +cp "$PWD/contrib/debian/copyright" "$DEBDIR/usr/share/doc/wowlet/copyright" +cp "$PWD/contrib/debian/changelog.gz" "$DEBDIR/usr/share/doc/wowlet/changelog.gz" +cp "$PWD/src/assets/org.wowlet.wowlet.metainfo.xml" "$DEBDIR/usr/share/metainfo/org.wowlet.wowlet.metainfo.xml" +cp "$PWD/README.md" "$DEBDIR/usr/share/doc/wowlet/README" +cp "$PWD/docs/SECURITY.md" "$DEBDIR/usr/share/doc/wowlet/SECURITY" +cp "$PWD/build/bin/wowlet" "$DEBDIR/usr/bin/wowlet" +cp "$PWD/src/assets/org.wowlet.wowlet.desktop" "$DEBDIR/usr/share/applications/org.wowlet.wowlet.desktop" +cp "$PWD/src/assets/wowlet.1.gz" "$DEBDIR/usr/share/man/man1/wowlet.1.gz" +cp "$PWD/src/assets/images/appicons/wowlet.svg" "$DEBDIR/usr/share/icons/hicolor/scalable/apps/wowlet.svg" +cp "$PWD/src/assets/images/appicons/48x48.png" "$DEBDIR/usr/share/icons/hicolor/48x48/apps/wowlet.png" +cp "$PWD/src/assets/images/appicons/64x64.png" "$DEBDIR/usr/share/icons/hicolor/64x64/apps/wowlet.png" +cp "$PWD/src/assets/images/appicons/96x96.png" "$DEBDIR/usr/share/icons/hicolor/96x96/apps/wowlet.png" +cp "$PWD/src/assets/images/appicons/128x128.png" "$DEBDIR/usr/share/icons/hicolor/128x128/apps/wowlet.png" +cp "$PWD/src/assets/images/appicons/192x192.png" "$DEBDIR/usr/share/icons/hicolor/192x192/apps/wowlet.png" +cp "$PWD/src/assets/images/appicons/256x256.png" "$DEBDIR/usr/share/icons/hicolor/256x256/apps/wowlet.png" + +# Build deb package + +dpkg-deb --build $DEBDIR +mv wowlet.DebDir.deb wowlet_2.1_amd64.deb diff --git a/contrib/debian/changelog.gz b/contrib/debian/changelog.gz new file mode 100644 index 0000000..90f6c7d Binary files /dev/null and b/contrib/debian/changelog.gz differ diff --git a/contrib/debian/control b/contrib/debian/control new file mode 100644 index 0000000..b133597 --- /dev/null +++ b/contrib/debian/control @@ -0,0 +1,12 @@ +Package: wowlet +Version: 2.1 +Section: net +Priority: optional +Architecture: amd64 +Essential: no +Installed-Size: 76800 +Maintainer: wowario +Description: WOWlet is a free, open-source Wownero client for Linux with ports for Mac OS and Windows. +Tag: office::finance +Homepage: https://git.wownero.com/wowlet/wowlet +Depends: libxcb-icccm4, libxcb-image0, libxcb-keysyms1, libxcb-render-util0, libxcb-xkb1, libxkbcommon-x11-0 diff --git a/contrib/debian/copyright b/contrib/debian/copyright new file mode 100644 index 0000000..4b7aae8 --- /dev/null +++ b/contrib/debian/copyright @@ -0,0 +1,31 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: wowlet +Source: https://git.wownero.com/wowlet/wowlet + +Files: * +Copyright: (c) 2020-2021 The Monero Project +License: BSD-3-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/contrib/openvr/CMakeLists.txt b/contrib/openvr/CMakeLists.txt new file mode 100755 index 0000000..4991ee5 --- /dev/null +++ b/contrib/openvr/CMakeLists.txt @@ -0,0 +1,93 @@ +# Set project name. +project(OpenVRSDK) + +# Fetch the version from the headers +set(VERSION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/headers/openvr.h") + +set(VERSION_MAJOR_REGEX "\tstatic const uint32_t k_nSteamVRVersionMajor = (.+);") +set(VERSION_MINOR_REGEX "\tstatic const uint32_t k_nSteamVRVersionMinor = (.+);") +set(VERSION_BUILD_REGEX "\tstatic const uint32_t k_nSteamVRVersionBuild = (.+);") + +file(STRINGS "${VERSION_FILE}" VERSION_MAJOR_STRING REGEX "${VERSION_MAJOR_REGEX}") +file(STRINGS "${VERSION_FILE}" VERSION_MINOR_STRING REGEX "${VERSION_MINOR_REGEX}") +file(STRINGS "${VERSION_FILE}" VERSION_BUILD_STRING REGEX "${VERSION_BUILD_REGEX}") + +string(REGEX REPLACE "${VERSION_MAJOR_REGEX}" "\\1" VERSION_MAJOR ${VERSION_MAJOR_STRING}) +string(REGEX REPLACE "${VERSION_MINOR_REGEX}" "\\1" VERSION_MINOR ${VERSION_MINOR_STRING}) +string(REGEX REPLACE "${VERSION_BUILD_REGEX}" "\\1" VERSION_BUILD ${VERSION_BUILD_STRING}) + +set(OPENVR_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_BUILD}") + +# Setup some options. +option(BUILD_SHARED "Builds the library as shared library" OFF) +option(BUILD_FRAMEWORK "Builds the library as an apple Framework" OFF) +option(BUILD_UNIVERSAL "Builds the shared or framework as a universal (fat, 32- & 64-bit) binary" ON) +option(BUILD_OSX_I386 "Builds the shared or framework as a 32-bit binary, even on a 64-bit platform" OFF) +option(USE_LIBCXX "Uses libc++ instead of libstdc++" ON) +option(USE_CUSTOM_LIBCXX "Uses a custom libc++" OFF) + +add_definitions( -DVR_API_PUBLIC ) + +# Check if 32 or 64 bit system. +set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P}) +if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(PROCESSOR_ARCH "64") +else() + set(PROCESSOR_ARCH "32") +endif() + +# Get platform. +if(WIN32) + set(PLATFORM_NAME "win") + if(NOT BUILD_SHARED) + add_definitions(-DOPENVR_BUILD_STATIC) + endif() +elseif(UNIX AND NOT APPLE) + if(CMAKE_SYSTEM_NAME MATCHES ".*Linux") + set(PLATFORM_NAME "linux") + add_definitions(-DLINUX -DPOSIX) + if(PROCESSOR_ARCH MATCHES "64") + add_definitions(-DLINUX64) + endif() + endif() +elseif(APPLE) + if(CMAKE_SYSTEM_NAME MATCHES ".*Darwin.*" OR CMAKE_SYSTEM_NAME MATCHES ".*MacOS.*") + set(PLATFORM_NAME "osx") + add_definitions(-DOSX -DPOSIX) + if(BUILD_UNIVERSAL) + set(CMAKE_OSX_ARCHITECTURES "i386;x86_64") + endif() + if(BUILD_OSX_I386) + set(PROCESSOR_ARCH "32") + set(CMAKE_OSX_ARCHITECTURES "i386") + endif() + endif() +endif() + +# Set output folder for static and shared libraries +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${PLATFORM_NAME}${PROCESSOR_ARCH}) + +# Enable some properties. +if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") + # Enable c++11 and hide symbols which shouldn't be visible + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -fvisibility=hidden") + + # Set custom libc++ usage here + if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND USE_LIBCXX) + if(USE_CUSTOM_LIBCXX) + if(BUILD_SHARED) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -stdlib=libc++") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++") + include_directories( ${LIBCXX_INCLUDE} ${LIBCXX_ABI_INCLUDE}) + message(STATUS "Using custom libc++") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") + message(STATUS "Using libc++") + endif() + endif() +endif() + +add_subdirectory(src) diff --git a/contrib/openvr/LICENSE b/contrib/openvr/LICENSE new file mode 100755 index 0000000..ee83337 --- /dev/null +++ b/contrib/openvr/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2015, Valve Corporation +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors +may be used to endorse or promote products derived from this software without +specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/contrib/openvr/README.md b/contrib/openvr/README.md new file mode 100755 index 0000000..a1fbe77 --- /dev/null +++ b/contrib/openvr/README.md @@ -0,0 +1,19 @@ +### Warning + +**Hard forked from commit `4c85abcb7f7f1f02adaf3812018c99fc593bc341` @ openvr**. + +At the time of writing, the above version does not compile. Had to make several changes. In addition, +binary blobs where removed from the repository. + +### OpenVR SDK + +OpenVR is an API and runtime that allows access to VR hardware from multiple +vendors without requiring that applications have specific knowledge of the +hardware they are targeting. This repository is an SDK that contains the API +and samples. The runtime is under SteamVR in Tools on Steam. + +### Documentation + +Documentation for the API is available on the [GitHub Wiki](https://github.com/ValveSoftware/openvr/wiki/API-Documentation) + +More information on OpenVR and SteamVR can be found on http://steamvr.com diff --git a/contrib/openvr/Toolchain-clang.cmake b/contrib/openvr/Toolchain-clang.cmake new file mode 100755 index 0000000..fb6b0ac --- /dev/null +++ b/contrib/openvr/Toolchain-clang.cmake @@ -0,0 +1,9 @@ +set(CMAKE_SYSTEM_NAME Linux) + +set(CMAKE_C_COMPILER clang) +set(CMAKE_CXX_COMPILER clang++) + +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) diff --git a/contrib/openvr/headers/openvr.h b/contrib/openvr/headers/openvr.h new file mode 100755 index 0000000..ff6d1fe --- /dev/null +++ b/contrib/openvr/headers/openvr.h @@ -0,0 +1,5624 @@ +#pragma once + +// openvr.h +//========= Copyright Valve Corporation ============// +// Dynamically generated file. Do not modify this file directly. + +#ifndef _OPENVR_API +#define _OPENVR_API + +#include + + + +// version.h + +namespace vr +{ + static const uint32_t k_nSteamVRVersionMajor = 1; + static const uint32_t k_nSteamVRVersionMinor = 16; + static const uint32_t k_nSteamVRVersionBuild = 8; +} // namespace vr + +// public_vrtypes.h + +#ifndef _INCLUDE_CORE_VRTYPES_PUBLIC_H +#define _INCLUDE_CORE_VRTYPES_PUBLIC_H + +namespace vr +{ +#pragma pack( push, 8 ) + +// right-handed system +// +y is up +// +x is to the right +// -z is forward +// Distance unit is meters +struct HmdMatrix34_t +{ + float m[3][4]; +}; + +struct HmdMatrix33_t +{ + float m[3][3]; +}; + +struct HmdMatrix44_t +{ + float m[4][4]; +}; + +struct HmdVector3_t +{ + float v[3]; +}; + +struct HmdVector4_t +{ + float v[4]; +}; + +struct HmdVector3d_t +{ + double v[3]; +}; + +struct HmdVector2_t +{ + float v[2]; +}; + +struct HmdQuaternion_t +{ + double w, x, y, z; +}; + +struct HmdQuaternionf_t +{ + float w, x, y, z; +}; + +struct HmdColor_t +{ + float r, g, b, a; +}; + +struct HmdQuad_t +{ + HmdVector3_t vCorners[ 4 ]; +}; + +struct HmdRect2_t +{ + HmdVector2_t vTopLeft; + HmdVector2_t vBottomRight; +}; + +/** Holds the transform for a single bone */ +struct VRBoneTransform_t +{ + HmdVector4_t position; + HmdQuaternionf_t orientation; +}; + +#pragma pack( pop ) + +} // namespace vr + +#endif + +// vrtypes.h + +#ifndef _INCLUDE_VRTYPES_H +#define _INCLUDE_VRTYPES_H + +// Forward declarations to avoid requiring vulkan.h +struct VkDevice_T; +struct VkPhysicalDevice_T; +struct VkInstance_T; +struct VkQueue_T; + +// Forward declarations to avoid requiring d3d12.h +struct ID3D12Resource; +struct ID3D12CommandQueue; + +namespace vr +{ +#pragma pack( push, 8 ) + +/** A handle for a spatial anchor. This handle is only valid during the session it was created in. +* Anchors that live beyond one session should be saved by their string descriptors. */ +typedef uint32_t SpatialAnchorHandle_t; + +typedef void* glSharedTextureHandle_t; +typedef int32_t glInt_t; +typedef uint32_t glUInt_t; + + +/** Used to return the post-distortion UVs for each color channel. +* UVs range from 0 to 1 with 0,0 in the upper left corner of the +* source render target. The 0,0 to 1,1 range covers a single eye. */ +struct DistortionCoordinates_t +{ + float rfRed[2]; + float rfGreen[2]; + float rfBlue[2]; +}; + +enum EVREye +{ + Eye_Left = 0, + Eye_Right = 1 +}; + +enum ETextureType +{ + TextureType_Invalid = -1, // Handle has been invalidated + TextureType_DirectX = 0, // Handle is an ID3D11Texture + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms + TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure + TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. + // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it + TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which + // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right + // eye texture (vr::EVREye::Eye_Right) +}; + +enum EColorSpace +{ + ColorSpace_Auto = 0, // Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants. + ColorSpace_Gamma = 1, // Texture data can be displayed directly on the display without any conversion (a.k.a. display native format). + ColorSpace_Linear = 2, // Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm. +}; + +struct Texture_t +{ + void* handle; // See ETextureType definition above + ETextureType eType; + EColorSpace eColorSpace; +}; + +// Handle to a shared texture (HANDLE on Windows obtained using OpenSharedResource). +typedef uint64_t SharedTextureHandle_t; +#define INVALID_SHARED_TEXTURE_HANDLE ((vr::SharedTextureHandle_t)0) + +enum ETrackingResult +{ + TrackingResult_Uninitialized = 1, + + TrackingResult_Calibrating_InProgress = 100, + TrackingResult_Calibrating_OutOfRange = 101, + + TrackingResult_Running_OK = 200, + TrackingResult_Running_OutOfRange = 201, + + TrackingResult_Fallback_RotationOnly = 300, +}; + +typedef uint32_t DriverId_t; +static const uint32_t k_nDriverNone = 0xFFFFFFFF; + +static const uint32_t k_unMaxDriverDebugResponseSize = 32768; + +/** Used to pass device IDs to API calls */ +typedef uint32_t TrackedDeviceIndex_t; +static const uint32_t k_unTrackedDeviceIndex_Hmd = 0; +static const uint32_t k_unMaxTrackedDeviceCount = 64; +static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE; +static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF; + +/** Describes what kind of object is being tracked at a given ID */ +enum ETrackedDeviceClass +{ + TrackedDeviceClass_Invalid = 0, // the ID was not valid. + TrackedDeviceClass_HMD = 1, // Head-Mounted Displays + TrackedDeviceClass_Controller = 2, // Tracked controllers + TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers + TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points + TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices + + TrackedDeviceClass_Max +}; + + +/** Describes what specific role associated with a tracked device */ +enum ETrackedControllerRole +{ + TrackedControllerRole_Invalid = 0, // Invalid value for controller type + TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand + TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand + TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection + TrackedControllerRole_Treadmill = 4, // Tracked device is a treadmill or other locomotion device + TrackedControllerRole_Stylus = 5, // Tracked device is a stylus + TrackedControllerRole_Max = 5 +}; + + +/** Returns true if the tracked controller role is allowed to be a hand */ +inline bool IsRoleAllowedAsHand( ETrackedControllerRole eRole ) +{ + switch ( eRole ) + { + case TrackedControllerRole_Invalid: + case TrackedControllerRole_LeftHand: + case TrackedControllerRole_RightHand: + return true; + default: + return false; + } +} + + +/** describes a single pose for a tracked object */ +struct TrackedDevicePose_t +{ + HmdMatrix34_t mDeviceToAbsoluteTracking; + HmdVector3_t vVelocity; // velocity in tracker space in m/s + HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?) + ETrackingResult eTrackingResult; + bool bPoseIsValid; + + // This indicates that there is a device connected for this spot in the pose array. + // It could go from true to false if the user unplugs the device. + bool bDeviceIsConnected; +}; + +/** Identifies which style of tracking origin the application wants to use +* for the poses it is requesting */ +enum ETrackingUniverseOrigin +{ + TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose + TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user + TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. +}; + +enum EAdditionalRadioFeatures +{ + AdditionalRadioFeatures_None = 0x00000000, + AdditionalRadioFeatures_HTCLinkBox = 0x00000001, + AdditionalRadioFeatures_InternalDongle = 0x00000002, + AdditionalRadioFeatures_ExternalDongle = 0x00000004, +}; + +typedef uint64_t WebConsoleHandle_t; +#define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0) + +// Refers to a single container of properties +typedef uint64_t PropertyContainerHandle_t; +typedef uint32_t PropertyTypeTag_t; + +static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; +static const PropertyTypeTag_t k_unInvalidPropertyTag = 0; + +typedef PropertyContainerHandle_t DriverHandle_t; +static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0; + +// Use these tags to set/get common types as struct properties +static const PropertyTypeTag_t k_unFloatPropertyTag = 1; +static const PropertyTypeTag_t k_unInt32PropertyTag = 2; +static const PropertyTypeTag_t k_unUint64PropertyTag = 3; +static const PropertyTypeTag_t k_unBoolPropertyTag = 4; +static const PropertyTypeTag_t k_unStringPropertyTag = 5; +static const PropertyTypeTag_t k_unErrorPropertyTag = 6; +static const PropertyTypeTag_t k_unDoublePropertyTag = 7; + +static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20; +static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21; +static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22; +static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; +static const PropertyTypeTag_t k_unHmdVector2PropertyTag = 24; +static const PropertyTypeTag_t k_unHmdQuadPropertyTag = 25; + +static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; +static const PropertyTypeTag_t k_unPathHandleInfoTag = 31; +static const PropertyTypeTag_t k_unActionPropertyTag = 32; +static const PropertyTypeTag_t k_unInputValuePropertyTag = 33; +static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; +static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; +static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36; + +static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40; +static const PropertyTypeTag_t k_unJsonPropertyTag = 41; +static const PropertyTypeTag_t k_unActiveActionSetPropertyTag = 42; + +static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; +static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; + + +/** Each entry in this enum represents a property that can be retrieved about a +* tracked device. Many fields are only valid for one ETrackedDeviceClass. */ +enum ETrackedDeviceProperty +{ + Prop_Invalid = 0, + + // general properties that apply to all device classes + Prop_TrackingSystemName_String = 1000, + Prop_ModelNumber_String = 1001, + Prop_SerialNumber_String = 1002, + Prop_RenderModelName_String = 1003, + Prop_WillDriftInYaw_Bool = 1004, + Prop_ManufacturerName_String = 1005, + Prop_TrackingFirmwareVersion_String = 1006, + Prop_HardwareRevision_String = 1007, + Prop_AllWirelessDongleDescriptions_String = 1008, + Prop_ConnectedWirelessDongle_String = 1009, + Prop_DeviceIsWireless_Bool = 1010, + Prop_DeviceIsCharging_Bool = 1011, + Prop_DeviceBatteryPercentage_Float = 1012, // 0 is empty, 1 is full + Prop_StatusDisplayTransform_Matrix34 = 1013, + Prop_Firmware_UpdateAvailable_Bool = 1014, + Prop_Firmware_ManualUpdate_Bool = 1015, + Prop_Firmware_ManualUpdateURL_String = 1016, + Prop_HardwareRevision_Uint64 = 1017, + Prop_FirmwareVersion_Uint64 = 1018, + Prop_FPGAVersion_Uint64 = 1019, + Prop_VRCVersion_Uint64 = 1020, + Prop_RadioVersion_Uint64 = 1021, + Prop_DongleVersion_Uint64 = 1022, + Prop_BlockServerShutdown_Bool = 1023, + Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, + Prop_ContainsProximitySensor_Bool = 1025, + Prop_DeviceProvidesBatteryStatus_Bool = 1026, + Prop_DeviceCanPowerOff_Bool = 1027, + Prop_Firmware_ProgrammingTarget_String = 1028, + Prop_DeviceClass_Int32 = 1029, + Prop_HasCamera_Bool = 1030, + Prop_DriverVersion_String = 1031, + Prop_Firmware_ForceUpdateRequired_Bool = 1032, + Prop_ViveSystemButtonFixRequired_Bool = 1033, + Prop_ParentDriver_Uint64 = 1034, + Prop_ResourceRoot_String = 1035, + Prop_RegisteredDeviceType_String = 1036, + Prop_InputProfilePath_String = 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided + Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design + Prop_NumCameras_Int32 = 1039, + Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value + Prop_CameraStreamFormat_Int32 = 1041, // ECameraVideoStreamFormat value + Prop_AdditionalDeviceSettingsPath_String = 1042, // driver-relative path to additional device and global configuration settings + Prop_Identifiable_Bool = 1043, // Whether device supports being identified from vrmonitor (e.g. blink LED, vibrate haptics, etc) + Prop_BootloaderVersion_Uint64 = 1044, + Prop_AdditionalSystemReportData_String = 1045, // additional string to include in system reports about a tracked device + Prop_CompositeFirmwareVersion_String = 1046, // additional FW components from a device that gets propagated into reports + Prop_Firmware_RemindUpdate_Bool = 1047, + Prop_PeripheralApplicationVersion_Uint64 = 1048, + Prop_ManufacturerSerialNumber_String = 1049, + Prop_ComputedSerialNumber_String = 1050, + Prop_EstimatedDeviceFirstUseTime_Int32 = 1051, + + // Properties that are unique to TrackedDeviceClass_HMD + Prop_ReportsTimeSinceVSync_Bool = 2000, + Prop_SecondsFromVsyncToPhotons_Float = 2001, + Prop_DisplayFrequency_Float = 2002, + Prop_UserIpdMeters_Float = 2003, + Prop_CurrentUniverseId_Uint64 = 2004, + Prop_PreviousUniverseId_Uint64 = 2005, + Prop_DisplayFirmwareVersion_Uint64 = 2006, + Prop_IsOnDesktop_Bool = 2007, + Prop_DisplayMCType_Int32 = 2008, + Prop_DisplayMCOffset_Float = 2009, + Prop_DisplayMCScale_Float = 2010, + Prop_EdidVendorID_Int32 = 2011, + Prop_DisplayMCImageLeft_String = 2012, + Prop_DisplayMCImageRight_String = 2013, + Prop_DisplayGCBlackClamp_Float = 2014, + Prop_EdidProductID_Int32 = 2015, + Prop_CameraToHeadTransform_Matrix34 = 2016, + Prop_DisplayGCType_Int32 = 2017, + Prop_DisplayGCOffset_Float = 2018, + Prop_DisplayGCScale_Float = 2019, + Prop_DisplayGCPrescale_Float = 2020, + Prop_DisplayGCImage_String = 2021, + Prop_LensCenterLeftU_Float = 2022, + Prop_LensCenterLeftV_Float = 2023, + Prop_LensCenterRightU_Float = 2024, + Prop_LensCenterRightV_Float = 2025, + Prop_UserHeadToEyeDepthMeters_Float = 2026, + Prop_CameraFirmwareVersion_Uint64 = 2027, + Prop_CameraFirmwareDescription_String = 2028, + Prop_DisplayFPGAVersion_Uint64 = 2029, + Prop_DisplayBootloaderVersion_Uint64 = 2030, + Prop_DisplayHardwareVersion_Uint64 = 2031, + Prop_AudioFirmwareVersion_Uint64 = 2032, + Prop_CameraCompatibilityMode_Int32 = 2033, + Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, + Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, + Prop_DisplaySuppressed_Bool = 2036, + Prop_DisplayAllowNightMode_Bool = 2037, + Prop_DisplayMCImageWidth_Int32 = 2038, + Prop_DisplayMCImageHeight_Int32 = 2039, + Prop_DisplayMCImageNumChannels_Int32 = 2040, + Prop_DisplayMCImageData_Binary = 2041, + Prop_SecondsFromPhotonsToVblank_Float = 2042, + Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, + Prop_DisplayDebugMode_Bool = 2044, + Prop_GraphicsAdapterLuid_Uint64 = 2045, + Prop_DriverProvidedChaperonePath_String = 2048, + Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for + Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for + Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded + Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded + Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded + Prop_DoNotApplyPrediction_Bool = 2054, // currently no effect. was used to disable HMD pose prediction on MR, which is now done by MR driver setting velocity=0 + Prop_CameraToHeadTransforms_Matrix34_Array = 2055, + Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion + Prop_DriverIsDrawingControllers_Bool = 2057, + Prop_DriverRequestsApplicationPause_Bool = 2058, + Prop_DriverRequestsReducedRendering_Bool = 2059, + Prop_MinimumIpdStepMeters_Float = 2060, + Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, + Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, + Prop_ImuToHeadTransform_Matrix34 = 2063, + Prop_ImuFactoryGyroBias_Vector3 = 2064, + Prop_ImuFactoryGyroScale_Vector3 = 2065, + Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, + Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + // reserved 2068 + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + Prop_AdditionalRadioFeatures_Uint64 = 2070, + Prop_CameraWhiteBalance_Vector4_Array = 2071, // Prop_NumCameras_Int32-sized array of float[4] RGBG white balance calibration data (max size is vr::k_unMaxCameras) + Prop_CameraDistortionFunction_Int32_Array = 2072, // Prop_NumCameras_Int32-sized array of vr::EVRDistortionFunctionType values (max size is vr::k_unMaxCameras) + Prop_CameraDistortionCoefficients_Float_Array = 2073, // Prop_NumCameras_Int32-sized array of double[vr::k_unMaxDistortionFunctionParameters] (max size is vr::k_unMaxCameras) + Prop_ExpectedControllerType_String = 2074, + Prop_HmdTrackingStyle_Int32 = 2075, // one of EHmdTrackingStyle + Prop_DriverProvidedChaperoneVisibility_Bool = 2076, + Prop_HmdColumnCorrectionSettingPrefix_String = 2077, + Prop_CameraSupportsCompatibilityModes_Bool = 2078, + Prop_SupportsRoomViewDepthProjection_Bool = 2079, + Prop_DisplayAvailableFrameRates_Float_Array = 2080, // populated by compositor from actual EDID list when available from GPU driver + Prop_DisplaySupportsMultipleFramerates_Bool = 2081, // if this is true but Prop_DisplayAvailableFrameRates_Float_Array is empty, explain to user + Prop_DisplayColorMultLeft_Vector3 = 2082, + Prop_DisplayColorMultRight_Vector3 = 2083, + Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084, + Prop_DisplaySupportsAnalogGain_Bool = 2085, + Prop_DisplayMinAnalogGain_Float = 2086, + Prop_DisplayMaxAnalogGain_Float = 2087, + Prop_CameraExposureTime_Float = 2088, + Prop_CameraGlobalGain_Float = 2089, + // Prop_DashboardLayoutPathName_String = 2090, // DELETED + Prop_DashboardScale_Float = 2091, + Prop_IpdUIRangeMinMeters_Float = 2100, + Prop_IpdUIRangeMaxMeters_Float = 2101, + Prop_Hmd_SupportsHDCP14LegacyCompat_Bool = 2102, + Prop_Hmd_SupportsMicMonitoring_Bool = 2103, + + // Driver requested mura correction properties + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, + + Prop_Audio_DefaultPlaybackDeviceId_String = 2300, + Prop_Audio_DefaultRecordingDeviceId_String = 2301, + Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302, + Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool = 2303, + + // Properties that are unique to TrackedDeviceClass_Controller + Prop_AttachedDeviceId_String = 3000, + Prop_SupportedButtons_Uint64 = 3001, + Prop_Axis0Type_Int32 = 3002, // Return value is of type EVRControllerAxisType + Prop_Axis1Type_Int32 = 3003, // Return value is of type EVRControllerAxisType + Prop_Axis2Type_Int32 = 3004, // Return value is of type EVRControllerAxisType + Prop_Axis3Type_Int32 = 3005, // Return value is of type EVRControllerAxisType + Prop_Axis4Type_Int32 = 3006, // Return value is of type EVRControllerAxisType + Prop_ControllerRoleHint_Int32 = 3007, // Return value is of type ETrackedControllerRole + + // Properties that are unique to TrackedDeviceClass_TrackingReference + Prop_FieldOfViewLeftDegrees_Float = 4000, + Prop_FieldOfViewRightDegrees_Float = 4001, + Prop_FieldOfViewTopDegrees_Float = 4002, + Prop_FieldOfViewBottomDegrees_Float = 4003, + Prop_TrackingRangeMinimumMeters_Float = 4004, + Prop_TrackingRangeMaximumMeters_Float = 4005, + Prop_ModeLabel_String = 4006, + Prop_CanWirelessIdentify_Bool = 4007, // volatile, based on radio presence and fw discovery + Prop_Nonce_Int32 = 4008, + + // Properties that are used for user interface like icons names + Prop_IconPathName_String = 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties. + Prop_NamedIconPathDeviceOff_String = 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearching_String = 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearchingAlert_String = 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReady_String = 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReadyAlert_String = 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceNotReady_String = 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceStandby_String = 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceAlertLow_String = 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceStandbyAlert_String = 5009, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + + // Properties that are used by helpers, but are opaque to applications + Prop_DisplayHiddenArea_Binary_Start = 5100, + Prop_DisplayHiddenArea_Binary_End = 5150, + Prop_ParentContainer = 5151, + Prop_OverrideContainer_Uint64 = 5152, + + // Properties that are unique to drivers + Prop_UserConfigPath_String = 6000, + Prop_InstallPath_String = 6001, + Prop_HasDisplayComponent_Bool = 6002, + Prop_HasControllerComponent_Bool = 6003, + Prop_HasCameraComponent_Bool = 6004, + Prop_HasDriverDirectModeComponent_Bool = 6005, + Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, + + // Properties that are set internally based on other information provided by drivers + Prop_ControllerType_String = 7000, + //Prop_LegacyInputProfile_String = 7001, // This is no longer used. See "legacy_binding" in the input profile instead. + Prop_ControllerHandSelectionPriority_Int32 = 7002, // Allows hand assignments to prefer some controllers over others. High numbers are selected over low numbers + + // Vendors are free to expose private debug data in this reserved region + Prop_VendorSpecific_Reserved_Start = 10000, + Prop_VendorSpecific_Reserved_End = 10999, + + Prop_TrackedDeviceProperty_Max = 1000000, +}; + +/** No string property will ever be longer than this length */ +static const uint32_t k_unMaxPropertyStringSize = 32 * 1024; + +/** Used to return errors that occur when reading properties. */ +enum ETrackedPropertyError +{ + TrackedProp_Success = 0, + TrackedProp_WrongDataType = 1, + TrackedProp_WrongDeviceClass = 2, + TrackedProp_BufferTooSmall = 3, + TrackedProp_UnknownProperty = 4, // Driver has not set the property (and may not ever). + TrackedProp_InvalidDevice = 5, + TrackedProp_CouldNotContactServer = 6, + TrackedProp_ValueNotProvidedByDevice = 7, + TrackedProp_StringExceedsMaximumLength = 8, + TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. + TrackedProp_PermissionDenied = 10, + TrackedProp_InvalidOperation = 11, + TrackedProp_CannotWriteToWildcards = 12, + TrackedProp_IPCReadFailure = 13, + TrackedProp_OutOfMemory = 14, + TrackedProp_InvalidContainer = 15, +}; + +/** Used to drive certain text in the UI when talking about the tracking system for the HMD */ +enum EHmdTrackingStyle +{ + HmdTrackingStyle_Unknown = 0, + + HmdTrackingStyle_Lighthouse = 1, // base stations and lasers + HmdTrackingStyle_OutsideInCameras = 2, // Cameras and LED, Rift 1 style + HmdTrackingStyle_InsideOutCameras = 3, // Cameras on HMD looking at the world +}; + +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; + +static const VRActionHandle_t k_ulInvalidActionHandle = 0; +static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; +static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; + + +/** Allows the application to control what part of the provided texture will be used in the +* frame buffer. */ +struct VRTextureBounds_t +{ + float uMin, vMin; + float uMax, vMax; +}; + +/** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */ +struct VRTextureWithPose_t : public Texture_t +{ + HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures. +}; + +struct VRTextureDepthInfo_t +{ + void* handle; // See ETextureType definition above + HmdMatrix44_t mProjection; + HmdVector2_t vRange; // 0..1 +}; + +struct VRTextureWithDepth_t : public Texture_t +{ + VRTextureDepthInfo_t depth; +}; + +struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t +{ + VRTextureDepthInfo_t depth; +}; + +/** Allows the application to control how scene textures are used by the compositor when calling Submit. */ +enum EVRSubmitFlags +{ + // Simple render path. App submits rendered left and right eye images with no lens distortion correction applied. + Submit_Default = 0x00, + + // App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear + // barrel distorted with chromatic aberration correction applied). The app would have used the data returned by + // vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit(). + Submit_LensDistortionAlreadyApplied = 0x01, + + // If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag. + Submit_GlRenderBuffer = 0x02, + + // Do not use + Submit_Reserved = 0x04, + + // Set to indicate that pTexture is a pointer to a VRTextureWithPose_t. + // This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t. + Submit_TextureWithPose = 0x08, + + // Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t. + // This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t. + Submit_TextureWithDepth = 0x10, + + // Set to indicate a discontinuity between this and the last frame. + // This will prevent motion smoothing from attempting to extrapolate using the pair. + Submit_FrameDiscontinuty = 0x20, + + // Set to indicate that pTexture->handle is a contains VRVulkanTextureArrayData_t + Submit_VulkanTextureWithArrayData = 0x40, + + // If the texture pointer passed in is an OpenGL Array texture, set this flag + Submit_GlArrayTexture = 0x80, + + // Do not use + Submit_Reserved2 = 0x8000, + + +}; + +/** Data required for passing Vulkan textures to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ +struct VRVulkanTextureData_t +{ + uint64_t m_nImage; // VkImage + VkDevice_T *m_pDevice; + VkPhysicalDevice_T *m_pPhysicalDevice; + VkInstance_T *m_pInstance; + VkQueue_T *m_pQueue; + uint32_t m_nQueueFamilyIndex; + uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount; +}; + +/** Data required for passing Vulkan texture arrays to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ +struct VRVulkanTextureArrayData_t : public VRVulkanTextureData_t +{ + uint32_t m_unArrayIndex; + uint32_t m_unArraySize; +}; + +/** Data required for passing D3D12 textures to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. */ +struct D3D12TextureData_t +{ + ID3D12Resource *m_pResource; + ID3D12CommandQueue *m_pCommandQueue; + uint32_t m_nNodeMask; +}; + +/** Status of the overall system or tracked objects */ +enum EVRState +{ + VRState_Undefined = -1, + VRState_Off = 0, + VRState_Searching = 1, + VRState_Searching_Alert = 2, + VRState_Ready = 3, + VRState_Ready_Alert = 4, + VRState_NotReady = 5, + VRState_Standby = 6, + VRState_Ready_Alert_Low = 7, +}; + +/** The types of events that could be posted (and what the parameters mean for each event type) */ +enum EVREventType +{ + VREvent_None = 0, + + VREvent_TrackedDeviceActivated = 100, + VREvent_TrackedDeviceDeactivated = 101, + VREvent_TrackedDeviceUpdated = 102, + VREvent_TrackedDeviceUserInteractionStarted = 103, + VREvent_TrackedDeviceUserInteractionEnded = 104, + VREvent_IpdChanged = 105, + VREvent_EnterStandbyMode = 106, + VREvent_LeaveStandbyMode = 107, + VREvent_TrackedDeviceRoleChanged = 108, + VREvent_WatchdogWakeUpRequested = 109, + VREvent_LensDistortionChanged = 110, + VREvent_PropertyChanged = 111, + VREvent_WirelessDisconnect = 112, + VREvent_WirelessReconnect = 113, + + VREvent_ButtonPress = 200, // data is controller + VREvent_ButtonUnpress = 201, // data is controller + VREvent_ButtonTouch = 202, // data is controller + VREvent_ButtonUntouch = 203, // data is controller + + // VREvent_DualAnalog_Press = 250, // No longer sent + // VREvent_DualAnalog_Unpress = 251, // No longer sent + // VREvent_DualAnalog_Touch = 252, // No longer sent + // VREvent_DualAnalog_Untouch = 253, // No longer sent + // VREvent_DualAnalog_Move = 254, // No longer sent + // VREvent_DualAnalog_ModeSwitch1 = 255, // No longer sent + // VREvent_DualAnalog_ModeSwitch2 = 256, // No longer sent + VREvent_Modal_Cancel = 257, // Sent to overlays with the + + VREvent_MouseMove = 300, // data is mouse + VREvent_MouseButtonDown = 301, // data is mouse + VREvent_MouseButtonUp = 302, // data is mouse + VREvent_FocusEnter = 303, // data is overlay + VREvent_FocusLeave = 304, // data is overlay + VREvent_ScrollDiscrete = 305, // data is scroll + VREvent_TouchPadMove = 306, // data is mouse + VREvent_OverlayFocusChanged = 307, // data is overlay, global event + VREvent_ReloadOverlays = 308, + VREvent_ScrollSmooth = 309, // data is scroll + VREvent_LockMousePosition = 310, + VREvent_UnlockMousePosition = 311, + + VREvent_InputFocusCaptured = 400, // data is process DEPRECATED + VREvent_InputFocusReleased = 401, // data is process DEPRECATED + // VREvent_SceneFocusLost = 402, // data is process + // VREvent_SceneFocusGained = 403, // data is process + VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor) + VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene + VREvent_InputFocusChanged = 406, // data is process + // VREvent_SceneApplicationSecondaryRenderingStarted = 407, + VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process + VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for + + VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily + VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility + + VREvent_SceneApplicationStateChanged = 412, // No data; but query VRApplications()->GetSceneApplicationState(); + + VREvent_ConsoleOpened = 420, + VREvent_ConsoleClosed = 421, + + VREvent_OverlayShown = 500, + VREvent_OverlayHidden = 501, + VREvent_DashboardActivated = 502, + VREvent_DashboardDeactivated = 503, + //VREvent_DashboardThumbSelected = 504, // Sent to the overlay manager - data is overlay - No longer sent + VREvent_DashboardRequested = 505, // Sent to the overlay manager - data is overlay + VREvent_ResetDashboard = 506, // Send to the overlay manager + //VREvent_RenderToast = 507, // Send to the dashboard to render a toast - data is the notification ID -- no longer sent + VREvent_ImageLoaded = 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading + VREvent_ShowKeyboard = 509, // Sent to keyboard renderer in the dashboard to invoke it + VREvent_HideKeyboard = 510, // Sent to keyboard renderer in the dashboard to hide it + VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it + VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else + VREvent_OverlaySharedTextureChanged = 513, + //VREvent_DashboardGuideButtonDown = 514, // These are no longer sent + //VREvent_DashboardGuideButtonUp = 515, + VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot + VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load + VREvent_DashboardOverlayCreated = 518, + VREvent_SwitchGamepadFocus = 519, + + // Screenshot API + VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot + VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken + VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken + VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted + VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted + + VREvent_PrimaryDashboardDeviceChanged = 525, + VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled + VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled + VREvent_ShowUI = 528, // data is showUi + VREvent_ShowDevTools = 529, // data is showDevTools + VREvent_DesktopViewUpdating = 530, + VREvent_DesktopViewReady = 531, + + VREvent_Notification_Shown = 600, + VREvent_Notification_Hidden = 601, + VREvent_Notification_BeginInteraction = 602, + VREvent_Notification_Destroyed = 603, + + VREvent_Quit = 700, // data is process + VREvent_ProcessQuit = 701, // data is process + //VREvent_QuitAborted_UserPrompt = 702, // data is process + VREvent_QuitAcknowledged = 703, // data is process + VREvent_DriverRequestedQuit = 704, // The driver has requested that SteamVR shut down + VREvent_RestartRequested = 705, // A driver or other component wants the user to restart SteamVR + + VREvent_ChaperoneDataHasChanged = 800, // this will never happen with the new chaperone system + VREvent_ChaperoneUniverseHasChanged = 801, + VREvent_ChaperoneTempDataHasChanged = 802, // this will never happen with the new chaperone system + VREvent_ChaperoneSettingsHaveChanged = 803, + VREvent_SeatedZeroPoseReset = 804, + VREvent_ChaperoneFlushCache = 805, // Sent when the process needs to reload any cached data it retrieved from VRChaperone() + VREvent_ChaperoneRoomSetupStarting = 806, // Triggered by CVRChaperoneClient::RoomSetupStarting + VREvent_ChaperoneRoomSetupFinished = 807, // Triggered by CVRChaperoneClient::CommitWorkingCopy + VREvent_StandingZeroPoseReset = 808, + + VREvent_AudioSettingsHaveChanged = 820, + + VREvent_BackgroundSettingHasChanged = 850, + VREvent_CameraSettingsHaveChanged = 851, + VREvent_ReprojectionSettingHasChanged = 852, + VREvent_ModelSkinSettingsHaveChanged = 853, + VREvent_EnvironmentSettingsHaveChanged = 854, + VREvent_PowerSettingsHaveChanged = 855, + VREvent_EnableHomeAppSettingsHaveChanged = 856, + VREvent_SteamVRSectionSettingChanged = 857, + VREvent_LighthouseSectionSettingChanged = 858, + VREvent_NullSectionSettingChanged = 859, + VREvent_UserInterfaceSectionSettingChanged = 860, + VREvent_NotificationsSectionSettingChanged = 861, + VREvent_KeyboardSectionSettingChanged = 862, + VREvent_PerfSectionSettingChanged = 863, + VREvent_DashboardSectionSettingChanged = 864, + VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, + VREvent_LastKnownSectionSettingChanged = 867, + VREvent_DismissedWarningsSectionSettingChanged = 868, + VREvent_GpuSpeedSectionSettingChanged = 869, + VREvent_WindowsMRSectionSettingChanged = 870, + VREvent_OtherSectionSettingChanged = 871, + + VREvent_StatusUpdate = 900, + + VREvent_WebInterface_InstallDriverCompleted = 950, + + VREvent_MCImageUpdated = 1000, + + VREvent_FirmwareUpdateStarted = 1100, + VREvent_FirmwareUpdateFinished = 1101, + + VREvent_KeyboardClosed = 1200, + VREvent_KeyboardCharInput = 1201, + VREvent_KeyboardDone = 1202, // Sent when DONE button clicked on keyboard + + //VREvent_ApplicationTransitionStarted = 1300, + //VREvent_ApplicationTransitionAborted = 1301, + //VREvent_ApplicationTransitionNewAppStarted = 1302, + VREvent_ApplicationListUpdated = 1303, + VREvent_ApplicationMimeTypeLoad = 1304, + // VREvent_ApplicationTransitionNewAppLaunchComplete = 1305, + VREvent_ProcessConnected = 1306, + VREvent_ProcessDisconnected = 1307, + + //VREvent_Compositor_MirrorWindowShown = 1400, // DEPRECATED + //VREvent_Compositor_MirrorWindowHidden = 1401, // DEPRECATED + VREvent_Compositor_ChaperoneBoundsShown = 1410, + VREvent_Compositor_ChaperoneBoundsHidden = 1411, + VREvent_Compositor_DisplayDisconnected = 1412, + VREvent_Compositor_DisplayReconnected = 1413, + VREvent_Compositor_HDCPError = 1414, // data is hdcpError + VREvent_Compositor_ApplicationNotResponding = 1415, + VREvent_Compositor_ApplicationResumed = 1416, + VREvent_Compositor_OutOfVideoMemory = 1417, + VREvent_Compositor_DisplayModeNotSupported = 1418, // k_pch_SteamVR_PreferredRefreshRate + VREvent_Compositor_StageOverrideReady = 1419, + + VREvent_TrackedCamera_StartVideoStream = 1500, + VREvent_TrackedCamera_StopVideoStream = 1501, + VREvent_TrackedCamera_PauseVideoStream = 1502, + VREvent_TrackedCamera_ResumeVideoStream = 1503, + VREvent_TrackedCamera_EditingSurface = 1550, + + VREvent_PerformanceTest_EnableCapture = 1600, + VREvent_PerformanceTest_DisableCapture = 1601, + VREvent_PerformanceTest_FidelityLevel = 1602, + + VREvent_MessageOverlay_Closed = 1650, + VREvent_MessageOverlayCloseRequested = 1651, + + VREvent_Input_HapticVibration = 1700, // data is hapticVibration + VREvent_Input_BindingLoadFailed = 1701, // data is inputBinding + VREvent_Input_BindingLoadSuccessful = 1702, // data is inputBinding + VREvent_Input_ActionManifestReloaded = 1703, // no data + VREvent_Input_ActionManifestLoadFailed = 1704, // data is actionManifest + VREvent_Input_ProgressUpdate = 1705, // data is progressUpdate + VREvent_Input_TrackerActivated = 1706, + VREvent_Input_BindingsUpdated = 1707, + VREvent_Input_BindingSubscriptionChanged = 1708, + + VREvent_SpatialAnchors_PoseUpdated = 1800, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_DescriptorUpdated = 1801, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, // data is spatialAnchor. sent to specific driver + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver + + VREvent_SystemReport_Started = 1900, // user or system initiated generation of a system report. broadcast + + VREvent_Monitor_ShowHeadsetView = 2000, // data is process + VREvent_Monitor_HideHeadsetView = 2001, // data is process + + // Vendors are free to expose private events in this reserved region + VREvent_VendorSpecific_Reserved_Start = 10000, + VREvent_VendorSpecific_Reserved_End = 19999, +}; + + +/** Level of Hmd activity */ +// UserInteraction_Timeout means the device is in the process of timing out. +// InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout ) +// VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction. +// VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle +enum EDeviceActivityLevel +{ + k_EDeviceActivityLevel_Unknown = -1, + k_EDeviceActivityLevel_Idle = 0, // No activity for the last 10 seconds + k_EDeviceActivityLevel_UserInteraction = 1, // Activity (movement or prox sensor) is happening now + k_EDeviceActivityLevel_UserInteraction_Timeout = 2, // No activity for the last 0.5 seconds + k_EDeviceActivityLevel_Standby = 3, // Idle for at least 5 seconds (configurable in Settings -> Power Management) + k_EDeviceActivityLevel_Idle_Timeout = 4, +}; + + +/** VR controller button and axis IDs */ +enum EVRButtonId +{ + k_EButton_System = 0, + k_EButton_ApplicationMenu = 1, + k_EButton_Grip = 2, + k_EButton_DPad_Left = 3, + k_EButton_DPad_Up = 4, + k_EButton_DPad_Right = 5, + k_EButton_DPad_Down = 6, + k_EButton_A = 7, + + k_EButton_ProximitySensor = 31, + + k_EButton_Axis0 = 32, + k_EButton_Axis1 = 33, + k_EButton_Axis2 = 34, + k_EButton_Axis3 = 35, + k_EButton_Axis4 = 36, + + // aliases for well known controllers + k_EButton_SteamVR_Touchpad = k_EButton_Axis0, + k_EButton_SteamVR_Trigger = k_EButton_Axis1, + + k_EButton_Dashboard_Back = k_EButton_Grip, + + k_EButton_IndexController_A = k_EButton_Grip, + k_EButton_IndexController_B = k_EButton_ApplicationMenu, + k_EButton_IndexController_JoyStick = k_EButton_Axis3, + + k_EButton_Max = 64 +}; + +inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; } + +/** used for controller button events */ +struct VREvent_Controller_t +{ + uint32_t button; // EVRButtonId enum +}; + + +/** used for simulated mouse events in overlay space */ +enum EVRMouseButton +{ + VRMouseButton_Left = 0x0001, + VRMouseButton_Right = 0x0002, + VRMouseButton_Middle = 0x0004, +}; + + +/** used for simulated mouse events in overlay space */ +struct VREvent_Mouse_t +{ + float x, y; // co-ords are in GL space, bottom left of the texture is 0,0 + uint32_t button; // EVRMouseButton enum +}; + +/** used for simulated mouse wheel scroll */ +struct VREvent_Scroll_t +{ + float xdelta, ydelta; + uint32_t unused; + float viewportscale; // For scrolling on an overlay with laser mouse, this is the overlay's vertical size relative to the overlay height. Range: [0,1] +}; + +/** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger + is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents + flag set. +**/ +struct VREvent_TouchPadMove_t +{ + // true if the users finger is detected on the touch pad + bool bFingerDown; + + // How long the finger has been down in seconds + float flSecondsFingerDown; + + // These values indicate the starting finger position (so you can do some basic swipe stuff) + float fValueXFirst; + float fValueYFirst; + + // This is the raw sampled coordinate without deadzoning + float fValueXRaw; + float fValueYRaw; +}; + +/** notification related events. Details will still change at this point */ +struct VREvent_Notification_t +{ + uint64_t ulUserValue; + uint32_t notificationId; +}; + +/** Used for events about processes */ +struct VREvent_Process_t +{ + uint32_t pid; + uint32_t oldPid; + bool bForced; + // If the associated event was triggered by a connection loss + bool bConnectionLost; +}; + + +/** Used for a few events about overlays */ +struct VREvent_Overlay_t +{ + uint64_t overlayHandle; + uint64_t devicePath; + uint64_t memoryBlockId; +}; + + +/** Used for a few events about overlays */ +struct VREvent_Status_t +{ + uint32_t statusState; // EVRState enum +}; + +/** Used for keyboard events **/ +struct VREvent_Keyboard_t +{ + char cNewInput[8]; // Up to 11 bytes of new input + uint64_t uUserValue; // Possible flags about the new input +}; + +struct VREvent_Ipd_t +{ + float ipdMeters; +}; + +struct VREvent_Chaperone_t +{ + uint64_t m_nPreviousUniverse; + uint64_t m_nCurrentUniverse; +}; + +/** Not actually used for any events */ +struct VREvent_Reserved_t +{ + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; + uint64_t reserved4; + uint64_t reserved5; +}; + +struct VREvent_PerformanceTest_t +{ + uint32_t m_nFidelityLevel; +}; + +struct VREvent_SeatedZeroPoseReset_t +{ + bool bResetBySystemMenu; +}; + +struct VREvent_Screenshot_t +{ + uint32_t handle; + uint32_t type; +}; + +struct VREvent_ScreenshotProgress_t +{ + float progress; +}; + +struct VREvent_ApplicationLaunch_t +{ + uint32_t pid; + uint32_t unArgsHandle; +}; + +struct VREvent_EditingCameraSurface_t +{ + uint64_t overlayHandle; + uint32_t nVisualMode; +}; + +struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum +}; + +struct VREvent_Property_t +{ + PropertyContainerHandle_t container; + ETrackedDeviceProperty prop; +}; + +struct VREvent_HapticVibration_t +{ + uint64_t containerHandle; // property container handle of the device with the haptic component + uint64_t componentHandle; // Which haptic component needs to vibrate + float fDurationSeconds; + float fFrequency; + float fAmplitude; +}; + +struct VREvent_WebConsole_t +{ + WebConsoleHandle_t webConsoleHandle; +}; + +struct VREvent_InputBindingLoad_t +{ + vr::PropertyContainerHandle_t ulAppContainer; + uint64_t pathMessage; + uint64_t pathUrl; + uint64_t pathControllerType; +}; + +struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; +}; + +struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +}; + +struct VREvent_ProgressUpdate_t +{ + uint64_t ulApplicationPropertyContainer; + uint64_t pathDevice; + uint64_t pathInputSource; + uint64_t pathProgressAction; + uint64_t pathIcon; + float fProgress; +}; + +enum EShowUIType +{ + ShowUI_ControllerBinding = 0, + ShowUI_ManageTrackers = 1, + // ShowUI_QuickStart = 2, // Deprecated + ShowUI_Pairing = 3, + ShowUI_Settings = 4, + ShowUI_DebugCommands = 5, + ShowUI_FullControllerBinding = 6, + ShowUI_ManageDrivers = 7, +}; + +struct VREvent_ShowUI_t +{ + EShowUIType eType; +}; + +struct VREvent_ShowDevTools_t +{ + int32_t nBrowserIdentifier; +}; + +enum EHDCPError +{ + HDCPError_None = 0, + HDCPError_LinkLost = 1, + HDCPError_Tampered = 2, + HDCPError_DeviceRevoked = 3, + HDCPError_Unknown = 4 +}; + +struct VREvent_HDCPError_t +{ + EHDCPError eCode; +}; + +typedef union +{ + VREvent_Reserved_t reserved; + VREvent_Controller_t controller; + VREvent_Mouse_t mouse; + VREvent_Scroll_t scroll; + VREvent_Process_t process; + VREvent_Notification_t notification; + VREvent_Overlay_t overlay; + VREvent_Status_t status; + VREvent_Keyboard_t keyboard; + VREvent_Ipd_t ipd; + VREvent_Chaperone_t chaperone; + VREvent_PerformanceTest_t performanceTest; + VREvent_TouchPadMove_t touchPadMove; + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + VREvent_Screenshot_t screenshot; + VREvent_ScreenshotProgress_t screenshotProgress; + VREvent_ApplicationLaunch_t applicationLaunch; + VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; + VREvent_Property_t property; + VREvent_HapticVibration_t hapticVibration; + VREvent_WebConsole_t webConsole; + VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; + VREvent_ProgressUpdate_t progressUpdate; + VREvent_ShowUI_t showUi; + VREvent_ShowDevTools_t showDevTools; + VREvent_HDCPError_t hdcpError; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ +} VREvent_Data_t; + + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +/** An event posted by the server to all running applications */ +struct VREvent_t +{ + uint32_t eventType; // EVREventType enum + TrackedDeviceIndex_t trackedDeviceIndex; + float eventAgeSeconds; + // event data must be the end of the struct as its size is variable + VREvent_Data_t data; +}; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + +typedef uint32_t VRComponentProperties; + +enum EVRComponentProperty +{ + VRComponentProperty_IsStatic = (1 << 0), + VRComponentProperty_IsVisible = (1 << 1), + VRComponentProperty_IsTouched = (1 << 2), + VRComponentProperty_IsPressed = (1 << 3), + VRComponentProperty_IsScrolled = (1 << 4), + VRComponentProperty_IsHighlighted = (1 << 5), +}; + + +/** Describes state information about a render-model component, including transforms and other dynamic properties */ +struct RenderModel_ComponentState_t +{ + HmdMatrix34_t mTrackingToComponentRenderModel; // Transform required when drawing the component render model + HmdMatrix34_t mTrackingToComponentLocal; // Transform available for attaching to a local component coordinate system (-Z out from surface ) + VRComponentProperties uProperties; +}; + + +enum EVRInputError +{ + VRInputError_None = 0, + VRInputError_NameNotFound = 1, + VRInputError_WrongType = 2, + VRInputError_InvalidHandle = 3, + VRInputError_InvalidParam = 4, + VRInputError_NoSteam = 5, + VRInputError_MaxCapacityReached = 6, + VRInputError_IPCError = 7, + VRInputError_NoActiveActionSet = 8, + VRInputError_InvalidDevice = 9, + VRInputError_InvalidSkeleton = 10, + VRInputError_InvalidBoneCount = 11, + VRInputError_InvalidCompressedData = 12, + VRInputError_NoData = 13, + VRInputError_BufferTooSmall = 14, + VRInputError_MismatchedActionManifest = 15, + VRInputError_MissingSkeletonData = 16, + VRInputError_InvalidBoneIndex = 17, + VRInputError_InvalidPriority = 18, + VRInputError_PermissionDenied = 19, + VRInputError_InvalidRenderModel = 20, +}; + +enum EVRSpatialAnchorError +{ + VRSpatialAnchorError_Success = 0, + VRSpatialAnchorError_Internal = 1, + VRSpatialAnchorError_UnknownHandle = 2, + VRSpatialAnchorError_ArrayTooSmall = 3, + VRSpatialAnchorError_InvalidDescriptorChar = 4, + VRSpatialAnchorError_NotYetAvailable = 5, + VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + VRSpatialAnchorError_PermanentlyUnavailable = 7, + VRSpatialAnchorError_WrongDriver = 8, + VRSpatialAnchorError_DescriptorTooLong = 9, + VRSpatialAnchorError_Unknown = 10, + VRSpatialAnchorError_NoRoomCalibration = 11, + VRSpatialAnchorError_InvalidArgument = 12, + VRSpatialAnchorError_UnknownDriver = 13, +}; + +/** The mesh to draw into the stencil (or depth) buffer to perform +* early stencil (or depth) kills of pixels that will never appear on the HMD. +* This mesh draws on all the pixels that will be hidden after distortion. +* +* If the HMD does not provide a visible area mesh pVertexData will be +* NULL and unTriangleCount will be 0. */ +struct HiddenAreaMesh_t +{ + const HmdVector2_t *pVertexData; + uint32_t unTriangleCount; +}; + + +enum EHiddenAreaMeshType +{ + k_eHiddenAreaMesh_Standard = 0, + k_eHiddenAreaMesh_Inverse = 1, + k_eHiddenAreaMesh_LineLoop = 2, + + k_eHiddenAreaMesh_Max = 3, +}; + + +/** Identifies what kind of axis is on the controller at index n. Read this type +* with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n ); +*/ +enum EVRControllerAxisType +{ + k_eControllerAxis_None = 0, + k_eControllerAxis_TrackPad = 1, + k_eControllerAxis_Joystick = 2, + k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis +}; + + +/** contains information about one axis on the controller */ +struct VRControllerAxis_t +{ + float x; // Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released. + float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers. +}; + + +/** the number of axes in the controller state */ +static const uint32_t k_unControllerStateAxisCount = 5; + + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +/** Holds all the state of a controller at one moment in time. */ +struct VRControllerState001_t +{ + // If packet num matches that on your prior call, then the controller state hasn't been changed since + // your last call and there is no need to process it + uint32_t unPacketNum; + + // bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask + uint64_t ulButtonPressed; + uint64_t ulButtonTouched; + + // Axis data for the controller's analog inputs + VRControllerAxis_t rAxis[ k_unControllerStateAxisCount ]; +}; +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + + +typedef VRControllerState001_t VRControllerState_t; + + +/** determines how to provide output to the application of various event processing functions. */ +enum EVRControllerEventOutputType +{ + ControllerEventOutput_OSEvents = 0, + ControllerEventOutput_VREvents = 1, +}; + + + +/** Collision Bounds Style */ +enum ECollisionBoundsStyle +{ + COLLISION_BOUNDS_STYLE_BEGINNER = 0, + COLLISION_BOUNDS_STYLE_INTERMEDIATE, + COLLISION_BOUNDS_STYLE_SQUARES, + COLLISION_BOUNDS_STYLE_ADVANCED, + COLLISION_BOUNDS_STYLE_NONE, + + COLLISION_BOUNDS_STYLE_COUNT +}; + +/** used to refer to a single VR overlay */ +typedef uint64_t VROverlayHandle_t; + +static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0; + +/** Errors that can occur around VR overlays */ +enum EVROverlayError +{ + VROverlayError_None = 0, + + VROverlayError_UnknownOverlay = 10, + VROverlayError_InvalidHandle = 11, + VROverlayError_PermissionDenied = 12, + VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist + VROverlayError_WrongVisibilityType = 14, + VROverlayError_KeyTooLong = 15, + VROverlayError_NameTooLong = 16, + VROverlayError_KeyInUse = 17, + VROverlayError_WrongTransformType = 18, + VROverlayError_InvalidTrackedDevice = 19, + VROverlayError_InvalidParameter = 20, + VROverlayError_ThumbnailCantBeDestroyed = 21, + VROverlayError_ArrayTooSmall = 22, + VROverlayError_RequestFailed = 23, + VROverlayError_InvalidTexture = 24, + VROverlayError_UnableToLoadFile = 25, + VROverlayError_KeyboardAlreadyInUse = 26, + VROverlayError_NoNeighbor = 27, + VROverlayError_TooManyMaskPrimitives = 29, + VROverlayError_BadMaskPrimitive = 30, + VROverlayError_TextureAlreadyLocked = 31, + VROverlayError_TextureLockCapacityReached = 32, + VROverlayError_TextureNotLocked = 33, +}; + +/** enum values to pass in to VR_Init to identify whether the application will +* draw a 3D scene. */ +enum EVRApplicationType +{ + VRApplication_Other = 0, // Some other kind of application that isn't covered by the other entries + VRApplication_Scene = 1, // Application will submit 3D frames + VRApplication_Overlay = 2, // Application only interacts with overlays + VRApplication_Background = 3, // Application should not start SteamVR if it's not already running, and should not + // keep it running if everything else quits. + VRApplication_Utility = 4, // Init should not try to load any drivers. The application needs access to utility + // interfaces (like IVRSettings and IVRApplications) but not hardware. + VRApplication_VRMonitor = 5, // Reserved for vrmonitor + VRApplication_SteamWatchdog = 6,// Reserved for Steam + VRApplication_Bootstrapper = 7, // reserved for vrstartup + VRApplication_WebHelper = 8, // reserved for vrwebhelper + VRApplication_OpenXRInstance = 9, // reserved for openxr (created instance, but not session yet) + VRApplication_OpenXRScene = 10, // reserved for openxr (started session) + VRApplication_OpenXROverlay = 11, // reserved for openxr (started overlay session) + VRApplication_Prism = 12, // reserved for the vrprismhost process + + VRApplication_Max +}; + + +/** returns true if the specified application type is one of the +* OpenXR types */ +inline bool IsOpenXRAppType( EVRApplicationType eType ) +{ + return eType == VRApplication_OpenXRInstance + || eType == VRApplication_OpenXRScene + || eType == VRApplication_OpenXROverlay; +} + + +/** error codes for firmware */ +enum EVRFirmwareError +{ + VRFirmwareError_None = 0, + VRFirmwareError_Success = 1, + VRFirmwareError_Fail = 2, +}; + + +/** error codes for notifications */ +enum EVRNotificationError +{ + VRNotificationError_OK = 0, + VRNotificationError_InvalidNotificationId = 100, + VRNotificationError_NotificationQueueFull = 101, + VRNotificationError_InvalidOverlayHandle = 102, + VRNotificationError_SystemWithUserValueAlreadyExists = 103, +}; + + +enum EVRSkeletalMotionRange +{ + // The range of motion of the skeleton takes into account any physical limits imposed by + // the controller itself. This will tend to be the most accurate pose compared to the user's + // actual hand pose, but might not allow a closed fist for example + VRSkeletalMotionRange_WithController = 0, + + // Retarget the range of motion provided by the input device to make the hand appear to move + // as if it was not holding a controller. eg: map "hand grasping controller" to "closed fist" + VRSkeletalMotionRange_WithoutController = 1, +}; + +enum EVRSkeletalTrackingLevel +{ + // body part location can't be directly determined by the device. Any skeletal pose provided by + // the device is estimated by assuming the position required to active buttons, triggers, joysticks, + // or other input sensors. + // E.g. Vive Controller, Gamepad + VRSkeletalTracking_Estimated = 0, + + // body part location can be measured directly but with fewer degrees of freedom than the actual body + // part. Certain body part positions may be unmeasured by the device and estimated from other input data. + // E.g. Index Controllers, gloves that only measure finger curl + VRSkeletalTracking_Partial = 1, + + // Body part location can be measured directly throughout the entire range of motion of the body part. + // E.g. Mocap suit for the full body, gloves that measure rotation of each finger segment + VRSkeletalTracking_Full = 2, + + VRSkeletalTrackingLevel_Count, + VRSkeletalTrackingLevel_Max = VRSkeletalTrackingLevel_Count - 1 +}; + + +/** Type used for referring to bones by their index */ +typedef int32_t BoneIndex_t; +const BoneIndex_t k_unInvalidBoneIndex = -1; + + +/** error codes returned by Vr_Init */ + +// Please add adequate error description to https://developer.valvesoftware.com/w/index.php?title=Category:SteamVRHelp +enum EVRInitError +{ + VRInitError_None = 0, + VRInitError_Unknown = 1, + + VRInitError_Init_InstallationNotFound = 100, + VRInitError_Init_InstallationCorrupt = 101, + VRInitError_Init_VRClientDLLNotFound = 102, + VRInitError_Init_FileNotFound = 103, + VRInitError_Init_FactoryNotFound = 104, + VRInitError_Init_InterfaceNotFound = 105, + VRInitError_Init_InvalidInterface = 106, + VRInitError_Init_UserConfigDirectoryInvalid = 107, + VRInitError_Init_HmdNotFound = 108, + VRInitError_Init_NotInitialized = 109, + VRInitError_Init_PathRegistryNotFound = 110, + VRInitError_Init_NoConfigPath = 111, + VRInitError_Init_NoLogPath = 112, + VRInitError_Init_PathRegistryNotWritable = 113, + VRInitError_Init_AppInfoInitFailed = 114, + VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver + VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup + VRInitError_Init_AnotherAppLaunching = 117, + VRInitError_Init_SettingsInitFailed = 118, + VRInitError_Init_ShuttingDown = 119, + VRInitError_Init_TooManyObjects = 120, + VRInitError_Init_NoServerForBackgroundApp = 121, + VRInitError_Init_NotSupportedWithCompositor = 122, + VRInitError_Init_NotAvailableToUtilityApps = 123, + VRInitError_Init_Internal = 124, + VRInitError_Init_HmdDriverIdIsNone = 125, + VRInitError_Init_HmdNotFoundPresenceFailed = 126, + VRInitError_Init_VRMonitorNotFound = 127, + VRInitError_Init_VRMonitorStartupFailed = 128, + VRInitError_Init_LowPowerWatchdogNotSupported = 129, + VRInitError_Init_InvalidApplicationType = 130, + VRInitError_Init_NotAvailableToWatchdogApps = 131, + VRInitError_Init_WatchdogDisabledInSettings = 132, + VRInitError_Init_VRDashboardNotFound = 133, + VRInitError_Init_VRDashboardStartupFailed = 134, + VRInitError_Init_VRHomeNotFound = 135, + VRInitError_Init_VRHomeStartupFailed = 136, + VRInitError_Init_RebootingBusy = 137, + VRInitError_Init_FirmwareUpdateBusy = 138, + VRInitError_Init_FirmwareRecoveryBusy = 139, + VRInitError_Init_USBServiceBusy = 140, + VRInitError_Init_VRWebHelperStartupFailed = 141, + VRInitError_Init_TrackerManagerInitFailed = 142, + VRInitError_Init_AlreadyRunning = 143, + VRInitError_Init_FailedForVrMonitor = 144, + VRInitError_Init_PropertyManagerInitFailed = 145, + VRInitError_Init_WebServerFailed = 146, + VRInitError_Init_IllegalTypeTransition = 147, + VRInitError_Init_MismatchedRuntimes = 148, + VRInitError_Init_InvalidProcessId = 149, + VRInitError_Init_VRServiceStartupFailed = 150, + VRInitError_Init_PrismNeedsNewDrivers = 151, + VRInitError_Init_PrismStartupTimedOut = 152, + VRInitError_Init_CouldNotStartPrism = 153, + VRInitError_Init_CreateDriverDirectDeviceFailed = 154, + VRInitError_Init_PrismExitedUnexpectedly = 155, + + VRInitError_Driver_Failed = 200, + VRInitError_Driver_Unknown = 201, + VRInitError_Driver_HmdUnknown = 202, + VRInitError_Driver_NotLoaded = 203, + VRInitError_Driver_RuntimeOutOfDate = 204, + VRInitError_Driver_HmdInUse = 205, + VRInitError_Driver_NotCalibrated = 206, + VRInitError_Driver_CalibrationInvalid = 207, + VRInitError_Driver_HmdDisplayNotFound = 208, + VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, + // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons + VRInitError_Driver_HmdDriverIdOutOfBounds = 211, + VRInitError_Driver_HmdDisplayMirrored = 212, + VRInitError_Driver_HmdDisplayNotFoundLaptop = 213, + // Never make error 259 because we return it from main and it would conflict with STILL_ACTIVE + + VRInitError_IPC_ServerInitFailed = 300, + VRInitError_IPC_ConnectFailed = 301, + VRInitError_IPC_SharedStateInitFailed = 302, + VRInitError_IPC_CompositorInitFailed = 303, + VRInitError_IPC_MutexInitFailed = 304, + VRInitError_IPC_Failed = 305, + VRInitError_IPC_CompositorConnectFailed = 306, + VRInitError_IPC_CompositorInvalidConnectResponse = 307, + VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, + VRInitError_IPC_ConnectFailedAfterTargetExited = 309, + VRInitError_IPC_NamespaceUnavailable = 310, + + VRInitError_Compositor_Failed = 400, + VRInitError_Compositor_D3D11HardwareRequired = 401, + VRInitError_Compositor_FirmwareRequiresUpdate = 402, + VRInitError_Compositor_OverlayInitFailed = 403, + VRInitError_Compositor_ScreenshotsInitFailed = 404, + VRInitError_Compositor_UnableToCreateDevice = 405, + VRInitError_Compositor_SharedStateIsNull = 406, + VRInitError_Compositor_NotificationManagerIsNull = 407, + VRInitError_Compositor_ResourceManagerClientIsNull = 408, + VRInitError_Compositor_MessageOverlaySharedStateInitFailure = 409, + VRInitError_Compositor_PropertiesInterfaceIsNull = 410, + VRInitError_Compositor_CreateFullscreenWindowFailed = 411, + VRInitError_Compositor_SettingsInterfaceIsNull = 412, + VRInitError_Compositor_FailedToShowWindow = 413, + VRInitError_Compositor_DistortInterfaceIsNull = 414, + VRInitError_Compositor_DisplayFrequencyFailure = 415, + VRInitError_Compositor_RendererInitializationFailed = 416, + VRInitError_Compositor_DXGIFactoryInterfaceIsNull = 417, + VRInitError_Compositor_DXGIFactoryCreateFailed = 418, + VRInitError_Compositor_DXGIFactoryQueryFailed = 419, + VRInitError_Compositor_InvalidAdapterDesktop = 420, + VRInitError_Compositor_InvalidHmdAttachment = 421, + VRInitError_Compositor_InvalidOutputDesktop = 422, + VRInitError_Compositor_InvalidDeviceProvided = 423, + VRInitError_Compositor_D3D11RendererInitializationFailed = 424, + VRInitError_Compositor_FailedToFindDisplayMode = 425, + VRInitError_Compositor_FailedToCreateSwapChain = 426, + VRInitError_Compositor_FailedToGetBackBuffer = 427, + VRInitError_Compositor_FailedToCreateRenderTarget = 428, + VRInitError_Compositor_FailedToCreateDXGI2SwapChain = 429, + VRInitError_Compositor_FailedtoGetDXGI2BackBuffer = 430, + VRInitError_Compositor_FailedToCreateDXGI2RenderTarget = 431, + VRInitError_Compositor_FailedToGetDXGIDeviceInterface = 432, + VRInitError_Compositor_SelectDisplayMode = 433, + VRInitError_Compositor_FailedToCreateNvAPIRenderTargets = 434, + VRInitError_Compositor_NvAPISetDisplayMode = 435, + VRInitError_Compositor_FailedToCreateDirectModeDisplay = 436, + VRInitError_Compositor_InvalidHmdPropertyContainer = 437, + VRInitError_Compositor_UpdateDisplayFrequency = 438, + VRInitError_Compositor_CreateRasterizerState = 439, + VRInitError_Compositor_CreateWireframeRasterizerState = 440, + VRInitError_Compositor_CreateSamplerState = 441, + VRInitError_Compositor_CreateClampToBorderSamplerState = 442, + VRInitError_Compositor_CreateAnisoSamplerState = 443, + VRInitError_Compositor_CreateOverlaySamplerState = 444, + VRInitError_Compositor_CreatePanoramaSamplerState = 445, + VRInitError_Compositor_CreateFontSamplerState = 446, + VRInitError_Compositor_CreateNoBlendState = 447, + VRInitError_Compositor_CreateBlendState = 448, + VRInitError_Compositor_CreateAlphaBlendState = 449, + VRInitError_Compositor_CreateBlendStateMaskR = 450, + VRInitError_Compositor_CreateBlendStateMaskG = 451, + VRInitError_Compositor_CreateBlendStateMaskB = 452, + VRInitError_Compositor_CreateDepthStencilState = 453, + VRInitError_Compositor_CreateDepthStencilStateNoWrite = 454, + VRInitError_Compositor_CreateDepthStencilStateNoDepth = 455, + VRInitError_Compositor_CreateFlushTexture = 456, + VRInitError_Compositor_CreateDistortionSurfaces = 457, + VRInitError_Compositor_CreateConstantBuffer = 458, + VRInitError_Compositor_CreateHmdPoseConstantBuffer = 459, + VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer = 460, + VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer = 461, + VRInitError_Compositor_CreateOverlayConstantBuffer = 462, + VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer = 463, + VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464, + VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465, + VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466, + VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467, + VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer = 468, + VRInitError_Compositor_CreateGeomConstantBuffer = 469, + VRInitError_Compositor_CreatePanelMaskConstantBuffer = 470, + VRInitError_Compositor_CreatePixelSimUBO = 471, + VRInitError_Compositor_CreateMSAARenderTextures = 472, + VRInitError_Compositor_CreateResolveRenderTextures = 473, + VRInitError_Compositor_CreateComputeResolveRenderTextures = 474, + VRInitError_Compositor_CreateDriverDirectModeResolveTextures = 475, + VRInitError_Compositor_OpenDriverDirectModeResolveTextures = 476, + VRInitError_Compositor_CreateFallbackSyncTexture = 477, + VRInitError_Compositor_ShareFallbackSyncTexture = 478, + VRInitError_Compositor_CreateOverlayIndexBuffer = 479, + VRInitError_Compositor_CreateOverlayVertexBuffer = 480, + VRInitError_Compositor_CreateTextVertexBuffer = 481, + VRInitError_Compositor_CreateTextIndexBuffer = 482, + VRInitError_Compositor_CreateMirrorTextures = 483, + VRInitError_Compositor_CreateLastFrameRenderTexture = 484, + VRInitError_Compositor_CreateMirrorOverlay = 485, + VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer = 486, + VRInitError_Compositor_DisplayModeNotSupported = 487, + VRInitError_Compositor_CreateOverlayInvalidCall = 488, + VRInitError_Compositor_CreateOverlayAlreadyInitialized = 489, + VRInitError_Compositor_FailedToCreateMailbox = 490, + VRInitError_Compositor_WindowInterfaceIsNull = 491, + VRInitError_Compositor_SystemLayerCreateInstance = 492, + VRInitError_Compositor_SystemLayerCreateSession = 493, + + VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, + VRInitError_VendorSpecific_WindowsNotInDevMode = 1001, + + VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, + VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, + VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, + VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, + VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, + VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, + VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, + VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, + VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, + VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, + VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, + VRInitError_VendorSpecific_OculusRuntimeBadInstall = 1114, + + VRInitError_Steam_SteamInstallationNotFound = 2000, + + // Strictly a placeholder + VRInitError_LastError +}; + +enum EVRScreenshotType +{ + VRScreenshotType_None = 0, + VRScreenshotType_Mono = 1, // left eye only + VRScreenshotType_Stereo = 2, + VRScreenshotType_Cubemap = 3, + VRScreenshotType_MonoPanorama = 4, + VRScreenshotType_StereoPanorama = 5 +}; + +enum EVRScreenshotPropertyFilenames +{ + VRScreenshotPropertyFilenames_Preview = 0, + VRScreenshotPropertyFilenames_VR = 1, +}; + +enum EVRTrackedCameraError +{ + VRTrackedCameraError_None = 0, + VRTrackedCameraError_OperationFailed = 100, + VRTrackedCameraError_InvalidHandle = 101, + VRTrackedCameraError_InvalidFrameHeaderVersion = 102, + VRTrackedCameraError_OutOfHandles = 103, + VRTrackedCameraError_IPCFailure = 104, + VRTrackedCameraError_NotSupportedForThisDevice = 105, + VRTrackedCameraError_SharedMemoryFailure = 106, + VRTrackedCameraError_FrameBufferingFailure = 107, + VRTrackedCameraError_StreamSetupFailure = 108, + VRTrackedCameraError_InvalidGLTextureId = 109, + VRTrackedCameraError_InvalidSharedTextureHandle = 110, + VRTrackedCameraError_FailedToGetGLTextureId = 111, + VRTrackedCameraError_SharedTextureFailure = 112, + VRTrackedCameraError_NoFrameAvailable = 113, + VRTrackedCameraError_InvalidArgument = 114, + VRTrackedCameraError_InvalidFrameBufferSize = 115, +}; + +enum EVRTrackedCameraFrameLayout +{ + EVRTrackedCameraFrameLayout_Mono = 0x0001, + EVRTrackedCameraFrameLayout_Stereo = 0x0002, + EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right) + EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right +}; + +enum EVRTrackedCameraFrameType +{ + VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted. + VRTrackedCameraFrameType_Undistorted, // In pixels, an undistorted inscribed rectangle region without invalid regions. This size is subject to changes shortly. + VRTrackedCameraFrameType_MaximumUndistorted, // In pixels, maximum undistorted with invalid regions. Non zero alpha component identifies valid regions. + MAX_CAMERA_FRAME_TYPES +}; + +enum EVRDistortionFunctionType +{ + VRDistortionFunctionType_None, + VRDistortionFunctionType_FTheta, + VRDistortionFunctionType_Extended_FTheta, + MAX_DISTORTION_FUNCTION_TYPES, +}; + +static const uint32_t k_unMaxDistortionFunctionParameters = 8; + +typedef uint64_t TrackedCameraHandle_t; +#define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0) + +struct CameraVideoStreamFrameHeader_t +{ + EVRTrackedCameraFrameType eFrameType; + + uint32_t nWidth; + uint32_t nHeight; + uint32_t nBytesPerPixel; + + uint32_t nFrameSequence; + + TrackedDevicePose_t trackedDevicePose; + + uint64_t ulFrameExposureTime; // mid-point of the exposure of the image in host system ticks +}; + +// Screenshot types +typedef uint32_t ScreenshotHandle_t; + +static const uint32_t k_unScreenshotHandleInvalid = 0; + +/** Compositor frame timing reprojection flags. */ +const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01; +const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02; +const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active, + // but does not indicate if reprojection actually happened or not. + // Use the ReprojectionReason flags above to check if reprojection + // was actually applied (i.e. scene texture was reused). + // NumFramePresents > 1 also indicates the scene texture was reused, + // and also the number of times that it was presented in total. + +const uint32_t VRCompositor_ReprojectionMotion = 0x08; // This flag indicates whether or not motion smoothing was triggered for this frame + +const uint32_t VRCompositor_PredictionMask = 0xF0; // The runtime may predict more than one frame (up to four) ahead if + // it detects the application is taking too long to render. These two + // bits will contain the count of additional frames (normally zero). + // Use the VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES macro to read from + // the latest frame timing entry. + +const uint32_t VRCompositor_ThrottleMask = 0xF00; // Number of frames the compositor is throttling the application. + // Use the VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES macro to read from + // the latest frame timing entry. + +#define VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_PredictionMask ) >> 4 ) +#define VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_ThrottleMask ) >> 8 ) + +/** Provides a single frame's timing information to the app */ +struct Compositor_FrameTiming +{ + uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming ) + uint32_t m_nFrameIndex; + uint32_t m_nNumFramePresents; // number of times this frame was presented + uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out + uint32_t m_nReprojectionFlags; + + /** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */ + double m_flSystemTimeInSeconds; + + /** These times may include work from other processes due to OS scheduling. + * The fewer packets of work these are broken up into, the less likely this will happen. + * GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started + * processing that work earlier in the frame. */ + float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit) + float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window) + float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work + float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc. + float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame + float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time) + + /** Miscellaneous measured intervals. */ + float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses + float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long) + float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure) + float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue) + + /** The following are all relative to this frame's SystemTimeInSeconds */ + float m_flWaitGetPosesCalledMs; + float m_flNewPosesReadyMs; + float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit + float m_flCompositorUpdateStartMs; + float m_flCompositorUpdateEndMs; + float m_flCompositorRenderStartMs; + + vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame + + uint32_t m_nNumVSyncsReadyForUse; + uint32_t m_nNumVSyncsToFirstView; +}; + +/** Provides compositor benchmark results to the app */ +struct Compositor_BenchmarkResults +{ + float m_flMegaPixelsPerSecond; // Measurement of GPU MP/s performed by compositor benchmark + float m_flHmdRecommendedMegaPixelsPerSecond; // Recommended default MP/s given the HMD resolution, refresh, and panel mask. +}; + +/** Frame timing data provided by direct mode drivers. */ +struct DriverDirectMode_FrameTiming +{ + uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming ) + uint32_t m_nNumFramePresents; // number of times frame was presented + uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync) + uint32_t m_nReprojectionFlags; +}; + +/** These flags will be set on DriverDirectMode_FrameTiming::m_nReprojectionFlags when IVRDriverDirectModeComponent::GetFrameTiming is called for drivers to optionally respond to. */ +const uint32_t VRCompositor_ReprojectionMotion_Enabled = 0x100; // Motion Smoothing is enabled in the UI for the currently running application +const uint32_t VRCompositor_ReprojectionMotion_ForcedOn = 0x200; // Motion Smoothing is forced on in the UI for the currently running application +const uint32_t VRCompositor_ReprojectionMotion_AppThrottled = 0x400; // Application is requesting throttling via ForceInterleavedReprojectionOn + + +enum EVSync +{ + VSync_None, + VSync_WaitRender, // block following render work until vsync + VSync_NoWaitRender, // do not block following render work (allow to get started early) +}; + +enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection +}; + +/** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */ +enum Imu_OffScaleFlags +{ + OffScale_AccelX = 0x01, + OffScale_AccelY = 0x02, + OffScale_AccelZ = 0x04, + OffScale_GyroX = 0x08, + OffScale_GyroY = 0x10, + OffScale_GyroZ = 0x20, +}; + +struct ImuSample_t +{ + double fSampleTime; + HmdVector3d_t vAccel; + HmdVector3d_t vGyro; + uint32_t unOffScaleFlags; +}; + +#pragma pack( pop ) + +// figure out how to import from the VR API dll +#if defined(_WIN32) + + #if !defined(OPENVR_BUILD_STATIC) + #ifdef VR_API_EXPORT + #define VR_INTERFACE extern "C" __declspec( dllexport ) + #else + #define VR_INTERFACE extern "C" __declspec( dllimport ) + #endif + #else + #define VR_INTERFACE extern "C" + #endif + +#elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__) + +#ifdef VR_API_EXPORT + #define VR_INTERFACE extern "C" __attribute__((visibility("default"))) +#else + #define VR_INTERFACE extern "C" +#endif + +#else + #error "Unsupported Platform." +#endif + + +#if defined( _WIN32 ) + #define VR_CALLTYPE __cdecl +#else + #define VR_CALLTYPE +#endif + +} // namespace vr +#endif // _INCLUDE_VRTYPES_H + +// vrannotation.h + +#ifdef API_GEN +# define VR_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) +#else +# define VR_CLANG_ATTR(ATTR) +#endif + +#define VR_METHOD_DESC(DESC) VR_CLANG_ATTR( "desc:" #DESC ";" ) +#define VR_IGNOREATTR() VR_CLANG_ATTR( "ignore" ) +#define VR_OUT_STRUCT() VR_CLANG_ATTR( "out_struct: ;" ) +#define VR_OUT_STRING() VR_CLANG_ATTR( "out_string: ;" ) +#define VR_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) VR_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) +#define VR_OUT_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "out_array_count:" #COUNTER ";" ) +#define VR_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "array_count:" #COUNTER ";" ) +#define VR_ARRAY_COUNT_D(COUNTER, DESC) VR_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) +#define VR_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "buffer_count:" #COUNTER ";" ) +#define VR_OUT_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) +#define VR_OUT_STRING_COUNT(COUNTER) VR_CLANG_ATTR( "out_string_count:" #COUNTER ";" ) + +// ivrsystem.h + +namespace vr +{ + +class IVRSystem +{ +public: + + + // ------------------------------------ + // Display Methods + // ------------------------------------ + + /** Suggested size for the intermediate render target that the distortion pulls from. */ + virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** The projection matrix for the specified eye */ + virtual HmdMatrix44_t GetProjectionMatrix( EVREye eEye, float fNearZ, float fFarZ ) = 0; + + /** The components necessary to build your own projection matrix in case your + * application is doing something fancy like infinite Z */ + virtual void GetProjectionRaw( EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; + + /** Gets the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in + * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. + * Returns true for success. Otherwise, returns false, and distortion coordinates are not suitable. */ + virtual bool ComputeDistortion( EVREye eEye, float fU, float fV, DistortionCoordinates_t *pDistortionCoordinates ) = 0; + + /** Returns the transform from eye space to the head space. Eye space is the per-eye flavor of head + * space that provides stereo disparity. Instead of Model * View * Projection the sequence is Model * View * Eye^-1 * Projection. + * Normally View and Eye^-1 will be multiplied together and treated as View in your application. + */ + virtual HmdMatrix34_t GetEyeToHeadTransform( EVREye eEye ) = 0; + + /** Returns the number of elapsed seconds since the last recorded vsync event. This + * will come from a vsync timer event in the timer if possible or from the application-reported + * time if that is not available. If no vsync times are available the function will + * return zero for vsync time and frame counter and return false from the method. */ + virtual bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter ) = 0; + + /** [D3D9 Only] + * Returns the adapter index that the user should pass into CreateDevice to set up D3D9 in such + * a way that it can go full screen exclusive on the HMD. Returns -1 if there was an error. + */ + virtual int32_t GetD3D9AdapterIndex() = 0; + + /** [D3D10/11 Only] + * Returns the adapter index that the user should pass into EnumAdapters to create the device + * and swap chain in DX10 and DX11. If an error occurs the index will be set to -1. + */ + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex ) = 0; + + /** + * Returns platform- and texture-type specific adapter identification so that applications and the + * compositor are creating textures and swap chains on the same GPU. If an error occurs the device + * will be set to 0. + * pInstance is an optional parameter that is required only when textureType is TextureType_Vulkan. + * [D3D10/11/12 Only (D3D9 Not Supported)] + * Returns the adapter LUID that identifies the GPU attached to the HMD. The user should + * enumerate all adapters using IDXGIFactory::EnumAdapters and IDXGIAdapter::GetDesc to find + * the adapter with the matching LUID, or use IDXGIFactory4::EnumAdapterByLuid. + * The discovered IDXGIAdapter should be used to create the device and swap chain. + * [Vulkan Only] + * Returns the VkPhysicalDevice that should be used by the application. + * pInstance must be the instance the application will use to query for the VkPhysicalDevice. The application + * must create the VkInstance with extensions returned by IVRCompositor::GetVulkanInstanceExtensionsRequired enabled. + * [macOS Only] + * For TextureType_IOSurface returns the id that should be used by the application. + * On 10.13+ for TextureType_OpenGL returns the 'registryId' of the renderer which should be used + * by the application. See Apple Technical Q&A QA1168 for information on enumerating GL Renderers, and the + * new kCGLRPRegistryIDLow and kCGLRPRegistryIDHigh CGLRendererProperty values in the 10.13 SDK. + * Pre 10.13 for TextureType_OpenGL returns 0, as there is no dependable way to correlate the HMDs MTLDevice + * with a GL Renderer. + */ + virtual void GetOutputDevice( uint64_t *pnDevice, ETextureType textureType, VkInstance_T *pInstance = nullptr ) = 0; + + // ------------------------------------ + // Display Mode methods + // ------------------------------------ + + /** Use to determine if the headset display is part of the desktop (i.e. extended) or hidden (i.e. direct mode). */ + virtual bool IsDisplayOnDesktop() = 0; + + /** Set the display visibility (true = extended, false = direct mode). Return value of true indicates that the change was successful. */ + virtual bool SetDisplayVisibility( bool bIsVisibleOnDesktop ) = 0; + + // ------------------------------------ + // Tracking Methods + // ------------------------------------ + + /** The pose that the tracker thinks that the HMD will be in at the specified number of seconds into the + * future. Pass 0 to get the state at the instant the method is called. Most of the time the application should + * calculate the time until the photons will be emitted from the display and pass that time into the method. + * + * This is roughly analogous to the inverse of the view matrix in most applications, though + * many games will need to do some additional rotation or translation on top of the rotation + * and translation provided by the head pose. + * + * For devices where bPoseIsValid is true the application can use the pose to position the device + * in question. The provided array can be any size up to k_unMaxTrackedDeviceCount. + * + * Seated experiences should call this method with TrackingUniverseSeated and receive poses relative + * to the seated zero pose. Standing experiences should call this method with TrackingUniverseStanding + * and receive poses relative to the Chaperone Play Area. TrackingUniverseRawAndUncalibrated should + * probably not be used unless the application is the Chaperone calibration tool itself, but will provide + * poses relative to the hardware-specific coordinate system in the driver. + */ + virtual void GetDeviceToAbsoluteTrackingPose( ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, VR_ARRAY_COUNT(unTrackedDevicePoseArrayCount) TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount ) = 0; + + /** Returns the transform from the seated zero pose to the standing absolute tracking system. This allows + * applications to represent the seated origin to used or transform object positions from one coordinate + * system to the other. + * + * The seated origin may or may not be inside the Play Area or Collision Bounds returned by IVRChaperone. Its position + * depends on what the user has set from the Dashboard settings and previous calls to ResetSeatedZeroPose. */ + virtual HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose() = 0; + + /** Returns the transform from the tracking origin to the standing absolute tracking system. This allows + * applications to convert from raw tracking space to the calibrated standing coordinate system. */ + virtual HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose() = 0; + + /** Get a sorted array of device indices of a given class of tracked devices (e.g. controllers). Devices are sorted right to left + * relative to the specified tracked device (default: hmd -- pass in -1 for absolute tracking space). Returns the number of devices + * in the list, or the size of the array needed if not large enough. */ + virtual uint32_t GetSortedTrackedDeviceIndicesOfClass( ETrackedDeviceClass eTrackedDeviceClass, VR_ARRAY_COUNT(unTrackedDeviceIndexArrayCount) vr::TrackedDeviceIndex_t *punTrackedDeviceIndexArray, uint32_t unTrackedDeviceIndexArrayCount, vr::TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex = k_unTrackedDeviceIndex_Hmd ) = 0; + + /** Returns the level of activity on the device. */ + virtual EDeviceActivityLevel GetTrackedDeviceActivityLevel( vr::TrackedDeviceIndex_t unDeviceId ) = 0; + + /** Convenience utility to apply the specified transform to the specified pose. + * This properly transforms all pose components, including velocity and angular velocity + */ + virtual void ApplyTransform( TrackedDevicePose_t *pOutputPose, const TrackedDevicePose_t *pTrackedDevicePose, const HmdMatrix34_t *pTransform ) = 0; + + /** Returns the device index associated with a specific role, for example the left hand or the right hand. This function is deprecated in favor of the new IVRInput system. */ + virtual vr::TrackedDeviceIndex_t GetTrackedDeviceIndexForControllerRole( vr::ETrackedControllerRole unDeviceType ) = 0; + + /** Returns the controller type associated with a device index. This function is deprecated in favor of the new IVRInput system. */ + virtual vr::ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; + + // ------------------------------------ + // Property methods + // ------------------------------------ + + /** Returns the device class of a tracked device. If there has not been a device connected in this slot + * since the application started this function will return TrackedDevice_Invalid. For previous detected + * devices the function will return the previously observed device class. + * + * To determine which devices exist on the system, just loop from 0 to k_unMaxTrackedDeviceCount and check + * the device class. Every device with something other than TrackedDevice_Invalid is associated with an + * actual tracked device. */ + virtual ETrackedDeviceClass GetTrackedDeviceClass( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; + + /** Returns true if there is a device connected in this slot. */ + virtual bool IsTrackedDeviceConnected( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; + + /** Returns a bool property. If the device index is not valid or the property is not a bool type this function will return false. */ + virtual bool GetBoolTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns a float property. If the device index is not valid or the property is not a float type this function will return 0. */ + virtual float GetFloatTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns an int property. If the device index is not valid or the property is not a int type this function will return 0. */ + virtual int32_t GetInt32TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns a uint64 property. If the device index is not valid or the property is not a uint64 type this function will return 0. */ + virtual uint64_t GetUint64TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns a matrix property. If the device index is not valid or the property is not a matrix type, this function will return identity. */ + virtual HmdMatrix34_t GetMatrix34TrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns an array of one type of property. If the device index is not valid or the property is not a single value or an array of the specified type, + * this function will return 0. Otherwise it returns the number of bytes necessary to hold the array of properties. If unBufferSize is + * greater than the returned size and pBuffer is non-NULL, pBuffer is filled with the contents of array of properties. */ + virtual uint32_t GetArrayTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void *pBuffer, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; + + /** Returns a string property. If the device index is not valid or the property is not a string type this function will + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ + virtual uint32_t GetStringTrackedDeviceProperty( vr::TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ) = 0; + + /** returns a string that corresponds with the specified property error. The string will be the name + * of the error enum value for all valid error codes */ + virtual const char *GetPropErrorNameFromEnum( ETrackedPropertyError error ) = 0; + + // ------------------------------------ + // Event methods + // ------------------------------------ + + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events + * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; + + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events + * this method returns false. Fills in the pose of the associated tracked device in the provided pose struct. + * This pose will always be older than the call to this function and should not be used to render the device. + uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextEventWithPose( ETrackingUniverseOrigin eOrigin, VREvent_t *pEvent, uint32_t uncbVREvent, vr::TrackedDevicePose_t *pTrackedDevicePose ) = 0; + + /** returns the name of an EVREvent enum value */ + virtual const char *GetEventTypeNameFromEnum( EVREventType eType ) = 0; + + // ------------------------------------ + // Rendering helper methods + // ------------------------------------ + + /** Returns the hidden area mesh for the current HMD. The pixels covered by this mesh will never be seen by the user after the lens distortion is + * applied based on visibility to the panels. If this HMD does not have a hidden area mesh, the vertex data and count will be NULL and 0 respectively. + * This mesh is meant to be rendered into the stencil buffer (or into the depth buffer setting nearz) before rendering each eye's view. + * This will improve performance by letting the GPU early-reject pixels the user will never see before running the pixel shader. + * NOTE: Render this mesh with backface culling disabled since the winding order of the vertices can be different per-HMD or per-eye. + * Setting the bInverse argument to true will produce the visible area mesh that is commonly used in place of full-screen quads. The visible area mesh covers all of the pixels the hidden area mesh does not cover. + * Setting the bLineLoop argument will return a line loop of vertices in HiddenAreaMesh_t->pVertexData with HiddenAreaMesh_t->unTriangleCount set to the number of vertices. + */ + virtual HiddenAreaMesh_t GetHiddenAreaMesh( EVREye eEye, EHiddenAreaMeshType type = k_eHiddenAreaMesh_Standard ) = 0; + + // ------------------------------------ + // Controller methods + // ------------------------------------ + + /** Fills the supplied struct with the current state of the controller. Returns false if the controller index + * is invalid. This function is deprecated in favor of the new IVRInput system. */ + virtual bool GetControllerState( vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize ) = 0; + + /** fills the supplied struct with the current state of the controller and the provided pose with the pose of + * the controller when the controller state was updated most recently. Use this form if you need a precise controller + * pose as input to your application when the user presses or releases a button. This function is deprecated in favor of the new IVRInput system. */ + virtual bool GetControllerStateWithPose( ETrackingUniverseOrigin eOrigin, vr::TrackedDeviceIndex_t unControllerDeviceIndex, vr::VRControllerState_t *pControllerState, uint32_t unControllerStateSize, TrackedDevicePose_t *pTrackedDevicePose ) = 0; + + /** Trigger a single haptic pulse on a controller. After this call the application may not trigger another haptic pulse on this controller + * and axis combination for 5ms. This function is deprecated in favor of the new IVRInput system. */ + virtual void TriggerHapticPulse( vr::TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec ) = 0; + + /** returns the name of an EVRButtonId enum value. This function is deprecated in favor of the new IVRInput system. */ + virtual const char *GetButtonIdNameFromEnum( EVRButtonId eButtonId ) = 0; + + /** returns the name of an EVRControllerAxisType enum value. This function is deprecated in favor of the new IVRInput system. */ + virtual const char *GetControllerAxisTypeNameFromEnum( EVRControllerAxisType eAxisType ) = 0; + + /** Returns true if this application is receiving input from the system. This would return false if + * system-related functionality is consuming the input stream. */ + virtual bool IsInputAvailable() = 0; + + /** Returns true SteamVR is drawing controllers on top of the application. Applications should consider + * not drawing anything attached to the user's hands in this case. */ + virtual bool IsSteamVRDrawingControllers() = 0; + + /** Returns true if the user has put SteamVR into a mode that is distracting them from the application. + * For applications where this is appropriate, the application should pause ongoing activity. */ + virtual bool ShouldApplicationPause() = 0; + + /** Returns true if SteamVR is doing significant rendering work and the game should do what it can to reduce + * its own workload. One common way to do this is to reduce the size of the render target provided for each eye. */ + virtual bool ShouldApplicationReduceRenderingWork() = 0; + + // ------------------------------------ + // Firmware methods + // ------------------------------------ + + /** Performs the actual firmware update if applicable. + * The following events will be sent, if VRFirmwareError_None was returned: VREvent_FirmwareUpdateStarted, VREvent_FirmwareUpdateFinished + * Use the properties Prop_Firmware_UpdateAvailable_Bool, Prop_Firmware_ManualUpdate_Bool, and Prop_Firmware_ManualUpdateURL_String + * to figure our whether a firmware update is available, and to figure out whether its a manual update + * Prop_Firmware_ManualUpdateURL_String should point to an URL describing the manual update process */ + virtual vr::EVRFirmwareError PerformFirmwareUpdate( vr::TrackedDeviceIndex_t unDeviceIndex ) = 0; + + // ------------------------------------ + // Application life cycle methods + // ------------------------------------ + + /** Call this to acknowledge to the system that VREvent_Quit has been received and that the process is exiting. + * This extends the timeout until the process is killed. */ + virtual void AcknowledgeQuit_Exiting() = 0; + + // ------------------------------------- + // App container sandbox methods + // ------------------------------------- + + /** Retrieves a null-terminated, semicolon-delimited list of UTF8 file paths that an application + * must have read access to when running inside of an app container. Returns the number of bytes + * needed to hold the list. */ + virtual uint32_t GetAppContainerFilePaths( VR_OUT_STRING() char *pchBuffer, uint32_t unBufferSize ) = 0; + + // ------------------------------------- + // System methods + // ------------------------------------- + + /** Returns the current version of the SteamVR runtime. The returned string will remain valid until VR_Shutdown is called. + * + * NOTE: Is it not appropriate to use this version to test for the presence of any SteamVR feature. Only use this version + * number for logging or showing to a user, and not to try to detect anything at runtime. When appropriate, feature-specific + * presence information is provided by other APIs. */ + virtual const char *GetRuntimeVersion() = 0; + +}; + +static const char * const IVRSystem_Version = "IVRSystem_022"; + +} + + +// ivrapplications.h + +namespace vr +{ + + /** Used for all errors reported by the IVRApplications interface */ + enum EVRApplicationError + { + VRApplicationError_None = 0, + + VRApplicationError_AppKeyAlreadyExists = 100, // Only one application can use any given key + VRApplicationError_NoManifest = 101, // the running application does not have a manifest + VRApplicationError_NoApplication = 102, // No application is running + VRApplicationError_InvalidIndex = 103, + VRApplicationError_UnknownApplication = 104, // the application could not be found + VRApplicationError_IPCFailed = 105, // An IPC failure caused the request to fail + VRApplicationError_ApplicationAlreadyRunning = 106, + VRApplicationError_InvalidManifest = 107, + VRApplicationError_InvalidApplication = 108, + VRApplicationError_LaunchFailed = 109, // the process didn't start + VRApplicationError_ApplicationAlreadyStarting = 110, // the system was already starting the same application + VRApplicationError_LaunchInProgress = 111, // The system was already starting a different application + VRApplicationError_OldApplicationQuitting = 112, + VRApplicationError_TransitionAborted = 113, + VRApplicationError_IsTemplate = 114, // error when you try to call LaunchApplication() on a template type app (use LaunchTemplateApplication) + VRApplicationError_SteamVRIsExiting = 115, + + VRApplicationError_BufferTooSmall = 200, // The provided buffer was too small to fit the requested data + VRApplicationError_PropertyNotSet = 201, // The requested property was not set + VRApplicationError_UnknownProperty = 202, + VRApplicationError_InvalidParameter = 203, + + VRApplicationError_NotImplemented = 300, // Fcn is not implemented in current interface + }; + + /** The maximum length of an application key */ + static const uint32_t k_unMaxApplicationKeyLength = 128; + + /** these are the properties available on applications. */ + enum EVRApplicationProperty + { + VRApplicationProperty_Name_String = 0, + + VRApplicationProperty_LaunchType_String = 11, + VRApplicationProperty_WorkingDirectory_String = 12, + VRApplicationProperty_BinaryPath_String = 13, + VRApplicationProperty_Arguments_String = 14, + VRApplicationProperty_URL_String = 15, + + VRApplicationProperty_Description_String = 50, + VRApplicationProperty_NewsURL_String = 51, + VRApplicationProperty_ImagePath_String = 52, + VRApplicationProperty_Source_String = 53, + VRApplicationProperty_ActionManifestURL_String = 54, + + VRApplicationProperty_IsDashboardOverlay_Bool = 60, + VRApplicationProperty_IsTemplate_Bool = 61, + VRApplicationProperty_IsInstanced_Bool = 62, + VRApplicationProperty_IsInternal_Bool = 63, + VRApplicationProperty_WantsCompositorPauseInStandby_Bool = 64, + VRApplicationProperty_IsHidden_Bool = 65, + + VRApplicationProperty_LastLaunchTime_Uint64 = 70, + }; + + enum EVRSceneApplicationState + { + EVRSceneApplicationState_None = 0, // Scene Application is not running + EVRSceneApplicationState_Starting = 1, // Scene Application is starting + EVRSceneApplicationState_Quitting = 2, // Scene Application is quitting + EVRSceneApplicationState_Running = 3, // Scene Application is running, and submitting frames, a custom skybox, or a visible overlay + EVRSceneApplicationState_Waiting = 4, // Scene Application is running, but not drawing anything + }; + + struct AppOverrideKeys_t + { + const char *pchKey; + const char *pchValue; + }; + + /** Currently recognized mime types */ + static const char * const k_pch_MimeType_HomeApp = "vr/home"; + static const char * const k_pch_MimeType_GameTheater = "vr/game_theater"; + + class IVRApplications + { + public: + + // --------------- Application management --------------- // + + /** Adds an application manifest to the list to load when building the list of installed applications. + * Temporary manifests are not automatically loaded */ + virtual EVRApplicationError AddApplicationManifest( const char *pchApplicationManifestFullPath, bool bTemporary = false ) = 0; + + /** Removes an application manifest from the list to load when building the list of installed applications. */ + virtual EVRApplicationError RemoveApplicationManifest( const char *pchApplicationManifestFullPath ) = 0; + + /** Returns true if an application is installed */ + virtual bool IsApplicationInstalled( const char *pchAppKey ) = 0; + + /** Returns the number of applications available in the list */ + virtual uint32_t GetApplicationCount() = 0; + + /** Returns the key of the specified application. The index is at least 0 and is less than the return + * value of GetApplicationCount(). The buffer should be at least k_unMaxApplicationKeyLength in order to + * fit the key. */ + virtual EVRApplicationError GetApplicationKeyByIndex( uint32_t unApplicationIndex, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; + + /** Returns the key of the application for the specified Process Id. The buffer should be at least + * k_unMaxApplicationKeyLength in order to fit the key. */ + virtual EVRApplicationError GetApplicationKeyByProcessId( uint32_t unProcessId, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; + + /** Launches the application. The existing scene application will exit and then the new application will start. + * This call is not valid for dashboard overlay applications. */ + virtual EVRApplicationError LaunchApplication( const char *pchAppKey ) = 0; + + /** Launches an instance of an application of type template, with its app key being pchNewAppKey (which must be unique) and optionally override sections + * from the manifest file via AppOverrideKeys_t + */ + virtual EVRApplicationError LaunchTemplateApplication( const char *pchTemplateAppKey, const char *pchNewAppKey, VR_ARRAY_COUNT( unKeys ) const AppOverrideKeys_t *pKeys, uint32_t unKeys ) = 0; + + /** launches the application currently associated with this mime type and passes it the option args, typically the filename or object name of the item being launched */ + virtual vr::EVRApplicationError LaunchApplicationFromMimeType( const char *pchMimeType, const char *pchArgs ) = 0; + + /** Launches the dashboard overlay application if it is not already running. This call is only valid for + * dashboard overlay applications. */ + virtual EVRApplicationError LaunchDashboardOverlay( const char *pchAppKey ) = 0; + + /** Cancel a pending launch for an application */ + virtual bool CancelApplicationLaunch( const char *pchAppKey ) = 0; + + /** Identifies a running application. OpenVR can't always tell which process started in response + * to a URL. This function allows a URL handler (or the process itself) to identify the app key + * for the now running application. Passing a process ID of 0 identifies the calling process. + * The application must be one that's known to the system via a call to AddApplicationManifest. */ + virtual EVRApplicationError IdentifyApplication( uint32_t unProcessId, const char *pchAppKey ) = 0; + + /** Returns the process ID for an application. Return 0 if the application was not found or is not running. */ + virtual uint32_t GetApplicationProcessId( const char *pchAppKey ) = 0; + + /** Returns a string for an applications error */ + virtual const char *GetApplicationsErrorNameFromEnum( EVRApplicationError error ) = 0; + + // --------------- Application properties --------------- // + + /** Returns a value for an application property. The required buffer size to fit this value will be returned. */ + virtual uint32_t GetApplicationPropertyString( const char *pchAppKey, EVRApplicationProperty eProperty, VR_OUT_STRING() char *pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError *peError = nullptr ) = 0; + + /** Returns a bool value for an application property. Returns false in all error cases. */ + virtual bool GetApplicationPropertyBool( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; + + /** Returns a uint64 value for an application property. Returns 0 in all error cases. */ + virtual uint64_t GetApplicationPropertyUint64( const char *pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError *peError = nullptr ) = 0; + + /** Sets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ + virtual EVRApplicationError SetApplicationAutoLaunch( const char *pchAppKey, bool bAutoLaunch ) = 0; + + /** Gets the application auto-launch flag. This is only valid for applications which return true for VRApplicationProperty_IsDashboardOverlay_Bool. */ + virtual bool GetApplicationAutoLaunch( const char *pchAppKey ) = 0; + + /** Adds this mime-type to the list of supported mime types for this application*/ + virtual EVRApplicationError SetDefaultApplicationForMimeType( const char *pchAppKey, const char *pchMimeType ) = 0; + + /** return the app key that will open this mime type */ + virtual bool GetDefaultApplicationForMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; + + /** Get the list of supported mime types for this application, comma-delimited */ + virtual bool GetApplicationSupportedMimeTypes( const char *pchAppKey, VR_OUT_STRING() char *pchMimeTypesBuffer, uint32_t unMimeTypesBuffer ) = 0; + + /** Get the list of app-keys that support this mime type, comma-delimited, the return value is number of bytes you need to return the full string */ + virtual uint32_t GetApplicationsThatSupportMimeType( const char *pchMimeType, VR_OUT_STRING() char *pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer ) = 0; + + /** Get the args list from an app launch that had the process already running, you call this when you get a VREvent_ApplicationMimeTypeLoad */ + virtual uint32_t GetApplicationLaunchArguments( uint32_t unHandle, VR_OUT_STRING() char *pchArgs, uint32_t unArgs ) = 0; + + // --------------- Transition methods --------------- // + + /** Returns the app key for the application that is starting up */ + virtual EVRApplicationError GetStartingApplication( VR_OUT_STRING() char *pchAppKeyBuffer, uint32_t unAppKeyBufferLen ) = 0; + + /** Returns the application transition state */ + virtual EVRSceneApplicationState GetSceneApplicationState() = 0; + + /** Returns errors that would prevent the specified application from launching immediately. Calling this function will + * cause the current scene application to quit, so only call it when you are actually about to launch something else. + * What the caller should do about these failures depends on the failure: + * VRApplicationError_OldApplicationQuitting - An existing application has been told to quit. Wait for a VREvent_ProcessQuit + * and try again. + * VRApplicationError_ApplicationAlreadyStarting - This application is already starting. This is a permanent failure. + * VRApplicationError_LaunchInProgress - A different application is already starting. This is a permanent failure. + * VRApplicationError_None - Go ahead and launch. Everything is clear. + */ + virtual EVRApplicationError PerformApplicationPrelaunchCheck( const char *pchAppKey ) = 0; + + /** Returns a string for an application transition state */ + virtual const char *GetSceneApplicationStateNameFromEnum( EVRSceneApplicationState state ) = 0; + + /** Starts a subprocess within the calling application. This + * suppresses all application transition UI and automatically identifies the new executable + * as part of the same application. On success the calling process should exit immediately. + * If working directory is NULL or "" the directory portion of the binary path will be + * the working directory. */ + virtual EVRApplicationError LaunchInternalProcess( const char *pchBinaryPath, const char *pchArguments, const char *pchWorkingDirectory ) = 0; + + /** Returns the current scene process ID according to the application system. A scene process will get scene + * focus once it starts rendering, but it will appear here once it calls VR_Init with the Scene application + * type. */ + virtual uint32_t GetCurrentSceneProcessId() = 0; + }; + + static const char * const IVRApplications_Version = "IVRApplications_007"; + +} // namespace vr + +// ivrsettings.h + +#include + +namespace vr +{ + enum EVRSettingsError + { + VRSettingsError_None = 0, + VRSettingsError_IPCFailed = 1, + VRSettingsError_WriteFailed = 2, + VRSettingsError_ReadFailed = 3, + VRSettingsError_JsonParseFailed = 4, + VRSettingsError_UnsetSettingHasNoDefault = 5, // This will be returned if the setting does not appear in the appropriate default file and has not been set + }; + + // The maximum length of a settings key + static const uint32_t k_unMaxSettingsKeyLength = 128; + + class IVRSettings + { + public: + virtual const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) = 0; + + virtual void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) = 0; + + // Users of the system need to provide a proper default in default.vrsettings in the resources/settings/ directory + // of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or "" + virtual bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) = 0; + + virtual void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) = 0; + virtual void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + }; + + //----------------------------------------------------------------------------- + static const char * const IVRSettings_Version = "IVRSettings_003"; + + class CVRSettingHelper + { + IVRSettings *m_pSettings; + public: + CVRSettingHelper( IVRSettings *pSettings ) + { + m_pSettings = pSettings; + } + + const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) + { + return m_pSettings->GetSettingsErrorNameFromEnum( eError ); + } + + void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError ); + } + + void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError ); + } + void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError ); + } + void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError ); + } + void SetString( const std::string & sSection, const std::string & sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError ); + } + + bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetBool( pchSection, pchSettingsKey, peError ); + } + int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError ); + } + float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError ); + } + void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) + { + m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError ); + } + std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr ) + { + char buf[4096]; + vr::EVRSettingsError eError; + m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError ); + if ( peError ) + *peError = eError; + if ( eError == vr::VRSettingsError_None ) + return buf; + else + return ""; + } + + void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveSection( pchSection, peError ); + } + void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError ); + } + }; + + + //----------------------------------------------------------------------------- + // steamvr keys + static const char * const k_pch_SteamVR_Section = "steamvr"; + static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; + static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; + static const char * const k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; + static const char * const k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; + static const char * const k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; + static const char * const k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; + static const char * const k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; + static const char * const k_pch_SteamVR_SendSystemButtonToAllApps_Bool= "sendSystemButtonToAllApps"; + static const char * const k_pch_SteamVR_LogLevel_Int32 = "loglevel"; + static const char * const k_pch_SteamVR_IPD_Float = "ipd"; + static const char * const k_pch_SteamVR_Background_String = "background"; + static const char * const k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; + static const char * const k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; + static const char * const k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; + static const char * const k_pch_SteamVR_GridColor_String = "gridColor"; + static const char * const k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; + static const char * const k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor"; + static const char * const k_pch_SteamVR_ShowStage_Bool = "showStage"; + static const char * const k_pch_SteamVR_DrawTrackingReferences_Bool = "drawTrackingReferences"; + static const char * const k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; + static const char * const k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; + static const char * const k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; + static const char * const k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement"; + static const char * const k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip"; + static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; + static const char * const k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; + static const char * const k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution"; + static const char * const k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing"; + static const char * const k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride"; + static const char * const k_pch_SteamVR_FramesToThrottle_Int32 = "framesToThrottle"; + static const char * const k_pch_SteamVR_AdditionalFramesToPredict_Int32 = "additionalFramesToPredict"; + static const char * const k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync"; + static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; + static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView"; + static const char * const k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView"; + static const char * const k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView"; + static const char * const k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode"; + static const char * const k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye"; + static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; + static const char * const k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized"; + static const char * const k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph"; + static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; + static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; + static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; + static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; + static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; + static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; + static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; + static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; + static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; + static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; + static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; + static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + static const char * const k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid"; + static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; + static const char * const k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling"; + static const char * const k_pch_SteamVR_EnableSafeMode = "enableSafeMode"; + static const char * const k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate"; + static const char * const k_pch_SteamVR_LastVersionNotice = "lastVersionNotice"; + static const char * const k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB"; + static const char * const k_pch_SteamVR_CustomIconStyle_String = "customIconStyle"; + static const char * const k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle"; + static const char * const k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate"; + static const char * const k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority"; + static const char * const k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2"; + static const char * const k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption"; + static const char * const k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches"; + static const char * const k_pch_SteamVR_HDCPLegacyCompatibility_Bool = "hdcp14legacyCompatibility"; + static const char * const k_pch_SteamVR_UsePrism_Bool = "usePrism"; + + //----------------------------------------------------------------------------- + // direct mode keys + static const char * const k_pch_DirectMode_Section = "direct_mode"; + static const char * const k_pch_DirectMode_Enable_Bool = "enable"; + static const char * const k_pch_DirectMode_Count_Int32 = "count"; + static const char * const k_pch_DirectMode_EdidVid_Int32 = "edidVid"; + static const char * const k_pch_DirectMode_EdidPid_Int32 = "edidPid"; + + //----------------------------------------------------------------------------- + // lighthouse keys + static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; + static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; + static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; + static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; + static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; + static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; + static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; + static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; + static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; + static const char * const k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2"; + static const char * const k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations"; + static const char * const k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback"; + + //----------------------------------------------------------------------------- + // null keys + static const char * const k_pch_Null_Section = "driver_null"; + static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; + static const char * const k_pch_Null_ModelNumber_String = "modelNumber"; + static const char * const k_pch_Null_WindowX_Int32 = "windowX"; + static const char * const k_pch_Null_WindowY_Int32 = "windowY"; + static const char * const k_pch_Null_WindowWidth_Int32 = "windowWidth"; + static const char * const k_pch_Null_WindowHeight_Int32 = "windowHeight"; + static const char * const k_pch_Null_RenderWidth_Int32 = "renderWidth"; + static const char * const k_pch_Null_RenderHeight_Int32 = "renderHeight"; + static const char * const k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; + static const char * const k_pch_Null_DisplayFrequency_Float = "displayFrequency"; + + //----------------------------------------------------------------------------- + // Windows MR keys + static const char * const k_pch_WindowsMR_Section = "driver_holographic"; + + //----------------------------------------------------------------------------- + // user interface keys + static const char * const k_pch_UserInterface_Section = "userinterface"; + static const char * const k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; + static const char * const k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; + static const char * const k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized"; + static const char * const k_pch_UserInterface_Screenshots_Bool = "screenshots"; + static const char * const k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; + + //----------------------------------------------------------------------------- + // notification keys + static const char * const k_pch_Notifications_Section = "notifications"; + static const char * const k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; + + //----------------------------------------------------------------------------- + // keyboard keys + static const char * const k_pch_Keyboard_Section = "keyboard"; + static const char * const k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; + static const char * const k_pch_Keyboard_ScaleX = "ScaleX"; + static const char * const k_pch_Keyboard_ScaleY = "ScaleY"; + static const char * const k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; + static const char * const k_pch_Keyboard_OffsetRightX = "OffsetRightX"; + static const char * const k_pch_Keyboard_OffsetY = "OffsetY"; + static const char * const k_pch_Keyboard_Smoothing = "Smoothing"; + + //----------------------------------------------------------------------------- + // perf keys + static const char * const k_pch_Perf_Section = "perfcheck"; + static const char * const k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD"; + static const char * const k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; + static const char * const k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; + static const char * const k_pch_Perf_TestData_Float = "perfTestData"; + static const char * const k_pch_Perf_GPUProfiling_Bool = "GPUProfiling"; + + //----------------------------------------------------------------------------- + // collision bounds keys + static const char * const k_pch_CollisionBounds_Section = "collisionBounds"; + static const char * const k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; + static const char * const k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; + static const char * const k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; + static const char * const k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; + static const char * const k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; + static const char * const k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight"; + static const char * const k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; + static const char * const k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; + static const char * const k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; + static const char * const k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; + static const char * const k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport"; + + //----------------------------------------------------------------------------- + // camera keys + static const char * const k_pch_Camera_Section = "camera"; + static const char * const k_pch_Camera_EnableCamera_Bool = "enableCamera"; + static const char * const k_pch_Camera_ShowOnController_Bool = "showOnController"; + static const char * const k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; + static const char * const k_pch_Camera_RoomView_Int32 = "roomView"; + static const char * const k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; + static const char * const k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; + static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; + static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; + static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; + static const char * const k_pch_Camera_RoomViewStyle_Int32 = "roomViewStyle"; + + //----------------------------------------------------------------------------- + // audio keys + static const char * const k_pch_audio_Section = "audio"; + static const char * const k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice"; + static const char * const k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride"; + static const char * const k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride"; + static const char * const k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName"; + static const char * const k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice"; + static const char * const k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride"; + static const char * const k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride"; + static const char * const k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName"; + static const char * const k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror"; + static const char * const k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice"; + static const char * const k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName"; + static const char * const k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; + static const char * const k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice"; + static const char * const k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume"; + static const char * const k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId"; + static const char * const k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; + static const char * const k_pch_audio_DualSpeakerAndJackOutput_Bool = "dualSpeakerAndJackOutput"; + static const char * const k_pch_audio_MuteMicMonitor_Bool = "muteMicMonitor"; + + //----------------------------------------------------------------------------- + // power management keys + static const char * const k_pch_Power_Section = "power"; + static const char * const k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; + static const char * const k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; + static const char * const k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; + static const char * const k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; + static const char * const k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; + static const char * const k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; + + //----------------------------------------------------------------------------- + // dashboard keys + static const char * const k_pch_Dashboard_Section = "dashboard"; + static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; + static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; + static const char * const k_pch_Dashboard_Position = "position"; + static const char * const k_pch_Dashboard_DesktopScale = "desktopScale"; + static const char * const k_pch_Dashboard_DashboardScale = "dashboardScale"; + static const char * const k_pch_Dashboard_UseStandaloneSystemLayer = "standaloneSystemLayer"; + + //----------------------------------------------------------------------------- + // model skin keys + static const char * const k_pch_modelskin_Section = "modelskins"; + + //----------------------------------------------------------------------------- + // driver keys - These could be checked in any driver_ section + static const char * const k_pch_Driver_Enable_Bool = "enable"; + static const char * const k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode"; + static const char * const k_pch_Driver_LoadPriority_Int32 = "loadPriority"; + + //----------------------------------------------------------------------------- + // web interface keys + static const char* const k_pch_WebInterface_Section = "WebInterface"; + + //----------------------------------------------------------------------------- + // vrwebhelper keys + static const char* const k_pch_VRWebHelper_Section = "VRWebHelper"; + static const char* const k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled"; + static const char* const k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort"; + + //----------------------------------------------------------------------------- + // tracking overrides - keys are device paths, values are the device paths their + // tracking/pose information overrides + static const char* const k_pch_TrackingOverride_Section = "TrackingOverrides"; + + //----------------------------------------------------------------------------- + // per-app keys - the section name for these is the app key itself. Some of these are prefixed by the controller type + static const char* const k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; + static const char* const k_pch_App_BindingLegacyAPISuffix_String = "_legacy"; + static const char* const k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput"; + static const char* const k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; + static const char* const k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL"; + static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; + static const char* const k_pch_App_DominantHand_Int32 = "DominantHand"; + static const char* const k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK"; + + //----------------------------------------------------------------------------- + // configuration for trackers + static const char * const k_pch_Trackers_Section = "trackers"; + + //----------------------------------------------------------------------------- + // configuration for desktop UI windows + static const char * const k_pch_DesktopUI_Section = "DesktopUI"; + + //----------------------------------------------------------------------------- + // Last known keys for righting recovery + static const char * const k_pch_LastKnown_Section = "LastKnown"; + static const char* const k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer"; + static const char* const k_pch_LastKnown_HMDModel_String = "HMDModel"; + + //----------------------------------------------------------------------------- + // Dismissed warnings + static const char * const k_pch_DismissedWarnings_Section = "DismissedWarnings"; + + //----------------------------------------------------------------------------- + // Input Settings + static const char * const k_pch_Input_Section = "input"; + static const char* const k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation"; + static const char* const k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation"; + static const char* const k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone"; + + //----------------------------------------------------------------------------- + // Log of GPU performance + static const char * const k_pch_GpuSpeed_Section = "GpuSpeed"; + +} // namespace vr + +// ivrchaperone.h + +namespace vr +{ + +#pragma pack( push, 8 ) + +enum ChaperoneCalibrationState +{ + // OK! + ChaperoneCalibrationState_OK = 1, // Chaperone is fully calibrated and working correctly + + // Warnings + ChaperoneCalibrationState_Warning = 100, + ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101, // A base station thinks that it might have moved + ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, // There are less base stations than when calibrated + ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, // Seated bounds haven't been calibrated for the current tracking center + + // Errors + ChaperoneCalibrationState_Error = 200, // The UniverseID is invalid + ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, // Tracking center hasn't be calibrated for at least one of the base stations + ChaperoneCalibrationState_Error_BaseStationConflict = 202, // Tracking center is calibrated, but base stations disagree on the tracking space + ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, // Play Area hasn't been calibrated for the current tracking center + ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, // Collision Bounds haven't been calibrated for the current tracking center +}; + + +/** HIGH LEVEL TRACKING SPACE ASSUMPTIONS: +* 0,0,0 is the preferred standing area center. +* 0Y is the floor height. +* -Z is the preferred forward facing direction. */ +class IVRChaperone +{ +public: + + /** Get the current state of Chaperone calibration. This state can change at any time during a session due to physical base station changes. **/ + virtual ChaperoneCalibrationState GetCalibrationState() = 0; + + /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z. + * Tracking space center (0,0,0) is the center of the Play Area. **/ + virtual bool GetPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; + + /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds). + * Corners are in counter-clockwise order. + * Standing center (0,0,0) is the center of the Play Area. + * It's a rectangle. + * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. + * Height of every corner is 0Y (on the floor). **/ + virtual bool GetPlayAreaRect( HmdQuad_t *rect ) = 0; + + /** Reload Chaperone data from the .vrchap file on disk. */ + virtual void ReloadInfo( void ) = 0; + + /** Optionally give the chaperone system a hit about the color and brightness in the scene **/ + virtual void SetSceneColor( HmdColor_t color ) = 0; + + /** Get the current chaperone bounds draw color and brightness **/ + virtual void GetBoundsColor( HmdColor_t *pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, HmdColor_t *pOutputCameraColor ) = 0; + + /** Determine whether the bounds are showing right now **/ + virtual bool AreBoundsVisible() = 0; + + /** Force the bounds to show, mostly for utilities **/ + virtual void ForceBoundsVisible( bool bForce ) = 0; + + /** Sets the zero pose for the given tracker coordinate system to the current position and yaw of the HMD. After + * ResetZeroPose all GetDeviceToAbsoluteTrackingPose calls as the origin will be relative to this new zero pose. + * The new zero coordinate system will not change the fact that the Y axis is up in the real world, so the next + * pose returned from GetDeviceToAbsoluteTrackingPose after a call to ResetZeroPose may not be exactly an + * identity matrix. + * + * NOTE: This function overrides the user's previously saved zero pose and should only be called as the result of a user action. + * Users are also able to set their zero pose via the OpenVR Dashboard. + **/ + virtual void ResetZeroPose( ETrackingUniverseOrigin eTrackingUniverseOrigin ) = 0; +}; + +static const char * const IVRChaperone_Version = "IVRChaperone_004"; + +#pragma pack( pop ) + +} + +// ivrchaperonesetup.h + +namespace vr +{ + +enum EChaperoneConfigFile +{ + EChaperoneConfigFile_Live = 1, // The live chaperone config, used by most applications and games + EChaperoneConfigFile_Temp = 2, // The temporary chaperone config, used to live-preview collision bounds in room setup +}; + +enum EChaperoneImportFlags +{ + EChaperoneImport_BoundsOnly = 0x0001, +}; + +/** Manages the working copy of the chaperone info. By default this will be the same as the +* live copy. Any changes made with this interface will stay in the working copy until +* CommitWorkingCopy() is called, at which point the working copy and the live copy will be +* the same again. */ +class IVRChaperoneSetup +{ +public: + + /** Saves the current working copy to disk */ + virtual bool CommitWorkingCopy( EChaperoneConfigFile configFile ) = 0; + + /** Reverts the working copy to match the live chaperone calibration. + * To modify existing data this MUST be do WHILE getting a non-error ChaperoneCalibrationStatus. + * Only after this should you do gets and sets on the existing data. */ + virtual void RevertWorkingCopy() = 0; + + /** Returns the width and depth of the Play Area (formerly named Soft Bounds) in X and Z from the working copy. + * Tracking space center (0,0,0) is the center of the Play Area. */ + virtual bool GetWorkingPlayAreaSize( float *pSizeX, float *pSizeZ ) = 0; + + /** Returns the 4 corner positions of the Play Area (formerly named Soft Bounds) from the working copy. + * Corners are in clockwise order. + * Tracking space center (0,0,0) is the center of the Play Area. + * It's a rectangle. + * 2 sides are parallel to the X axis and 2 sides are parallel to the Z axis. + * Height of every corner is 0Y (on the floor). **/ + virtual bool GetWorkingPlayAreaRect( HmdQuad_t *rect ) = 0; + + /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads + * into the buffer up to the max specified from the working copy. */ + virtual bool GetWorkingCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; + + /** Returns the number of Quads if the buffer points to null. Otherwise it returns Quads + * into the buffer up to the max specified. */ + virtual bool GetLiveCollisionBoundsInfo( VR_OUT_ARRAY_COUNT(punQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t* punQuadsCount ) = 0; + + /** Returns the preferred seated position from the working copy. */ + virtual bool GetWorkingSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; + + /** Returns the standing origin from the working copy. */ + virtual bool GetWorkingStandingZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatStandingZeroPoseToRawTrackingPose ) = 0; + + /** Sets the Play Area in the working copy. */ + virtual void SetWorkingPlayAreaSize( float sizeX, float sizeZ ) = 0; + + /** Sets the Collision Bounds in the working copy. Note: ceiling height is ignored. */ + virtual void SetWorkingCollisionBoundsInfo( VR_ARRAY_COUNT(unQuadsCount) HmdQuad_t *pQuadsBuffer, uint32_t unQuadsCount ) = 0; + + /** Sets the Collision Bounds in the working copy. */ + virtual void SetWorkingPerimeter( VR_ARRAY_COUNT( unPointCount ) HmdVector2_t *pPointBuffer, uint32_t unPointCount ) = 0; + + /** Sets the preferred seated position in the working copy. */ + virtual void SetWorkingSeatedZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatSeatedZeroPoseToRawTrackingPose ) = 0; + + /** Sets the preferred standing position in the working copy. */ + virtual void SetWorkingStandingZeroPoseToRawTrackingPose( const HmdMatrix34_t *pMatStandingZeroPoseToRawTrackingPose ) = 0; + + /** Tear everything down and reload it from the file on disk */ + virtual void ReloadFromDisk( EChaperoneConfigFile configFile ) = 0; + + /** Returns the preferred seated position. */ + virtual bool GetLiveSeatedZeroPoseToRawTrackingPose( HmdMatrix34_t *pmatSeatedZeroPoseToRawTrackingPose ) = 0; + + virtual bool ExportLiveToBuffer( VR_OUT_STRING() char *pBuffer, uint32_t *pnBufferLength ) = 0; + virtual bool ImportFromBufferToWorking( const char *pBuffer, uint32_t nImportFlags ) = 0; + + /** Shows the chaperone data in the working set to preview in the compositor.*/ + virtual void ShowWorkingSetPreview() = 0; + + /** Hides the chaperone data in the working set to preview in the compositor (if it was visible).*/ + virtual void HideWorkingSetPreview() = 0; + + /** Fire an event that the tracking system can use to know room setup is about to begin. This lets the tracking + * system make any last minute adjustments that should be incorporated into the new setup. If the user is adjusting + * live in HMD using a tweak tool, keep in mind that calling this might cause the user to see the room jump. */ + virtual void RoomSetupStarting() = 0; +}; + +static const char * const IVRChaperoneSetup_Version = "IVRChaperoneSetup_006"; + + +} + +// ivrcompositor.h + +namespace vr +{ + +#pragma pack( push, 8 ) + +/** Errors that can occur with the VR compositor */ +enum EVRCompositorError +{ + VRCompositorError_None = 0, + VRCompositorError_RequestFailed = 1, + VRCompositorError_IncompatibleVersion = 100, + VRCompositorError_DoNotHaveFocus = 101, + VRCompositorError_InvalidTexture = 102, + VRCompositorError_IsNotSceneApplication = 103, + VRCompositorError_TextureIsOnWrongDevice = 104, + VRCompositorError_TextureUsesUnsupportedFormat = 105, + VRCompositorError_SharedTexturesNotSupported = 106, + VRCompositorError_IndexOutOfRange = 107, + VRCompositorError_AlreadySubmitted = 108, + VRCompositorError_InvalidBounds = 109, + VRCompositorError_AlreadySet = 110, +}; + +/** Timing mode passed to SetExplicitTimingMode(); see that function for documentation */ +enum EVRCompositorTimingMode +{ + VRCompositorTimingMode_Implicit = 0, + VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1, + VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2, +}; + +/** Cumulative stats for current application. These are not cleared until a new app connects, +* but they do stop accumulating once the associated app disconnects. */ +struct Compositor_CumulativeStats +{ + uint32_t m_nPid; // Process id associated with these stats (may no longer be running). + uint32_t m_nNumFramePresents; // total number of times we called present (includes reprojected frames) + uint32_t m_nNumDroppedFrames; // total number of times an old frame was re-scanned out (without reprojection) + uint32_t m_nNumReprojectedFrames; // total number of times a frame was scanned out a second time (with reprojection) + + /** Values recorded at startup before application has fully faded in the first time. */ + uint32_t m_nNumFramePresentsOnStartup; + uint32_t m_nNumDroppedFramesOnStartup; + uint32_t m_nNumReprojectedFramesOnStartup; + + /** Applications may explicitly fade to the compositor. This is usually to handle level transitions, and loading often causes + * system wide hitches. The following stats are collected during this period. Does not include values recorded during startup. */ + uint32_t m_nNumLoading; + uint32_t m_nNumFramePresentsLoading; + uint32_t m_nNumDroppedFramesLoading; + uint32_t m_nNumReprojectedFramesLoading; + + /** If we don't get a new frame from the app in less than 2.5 frames, then we assume the app has hung and start + * fading back to the compositor. The following stats are a result of this, and are a subset of those recorded above. + * Does not include values recorded during start up or loading. */ + uint32_t m_nNumTimedOut; + uint32_t m_nNumFramePresentsTimedOut; + uint32_t m_nNumDroppedFramesTimedOut; + uint32_t m_nNumReprojectedFramesTimedOut; +}; + +struct Compositor_StageRenderSettings +{ + /** Primary color is applied as a tint to (i.e. multiplied with) the model's texture */ + HmdColor_t m_PrimaryColor; + HmdColor_t m_SecondaryColor; + + /** Vignette radius is in meters and is used to fade to the specified secondary solid color over + * that 3D distance from the origin of the playspace. */ + float m_flVignetteInnerRadius; + float m_flVignetteOuterRadius; + + /** Fades to the secondary color based on view incidence. This variable controls the linearity + * of the effect. It is mutually exclusive with vignette. Additionally, it treats the mesh as faceted. */ + float m_flFresnelStrength; + + /** Controls backface culling. */ + bool m_bBackfaceCulling; + + /** Converts the render model's texture to luma and applies to rgb equally. This is useful to + * combat compression artifacts that can occur on desaturated source material. */ + bool m_bGreyscale; + + /** Renders mesh as a wireframe. */ + bool m_bWireframe; +}; + +static inline Compositor_StageRenderSettings DefaultStageRenderSettings() +{ + Compositor_StageRenderSettings settings; + settings.m_PrimaryColor.r = 1.0f; + settings.m_PrimaryColor.g = 1.0f; + settings.m_PrimaryColor.b = 1.0f; + settings.m_PrimaryColor.a = 1.0f; + settings.m_SecondaryColor.r = 1.0f; + settings.m_SecondaryColor.g = 1.0f; + settings.m_SecondaryColor.b = 1.0f; + settings.m_SecondaryColor.a = 1.0f; + settings.m_flVignetteInnerRadius = 0.0f; + settings.m_flVignetteOuterRadius = 0.0f; + settings.m_flFresnelStrength = 0.0f; + settings.m_bBackfaceCulling = false; + settings.m_bGreyscale = false; + settings.m_bWireframe = false; + return settings; +} + +#pragma pack( pop ) + +/** Allows the application to interact with the compositor */ +class IVRCompositor +{ +public: + /** Sets tracking space returned by WaitGetPoses */ + virtual void SetTrackingSpace( ETrackingUniverseOrigin eOrigin ) = 0; + + /** Gets current tracking space returned by WaitGetPoses */ + virtual ETrackingUniverseOrigin GetTrackingSpace() = 0; + + /** Scene applications should call this function to get poses to render with (and optionally poses predicted an additional frame out to use for gameplay). + * This function will block until "running start" milliseconds before the start of the frame, and should be called at the last moment before needing to + * start rendering. + * + * Return codes: + * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) + * - DoNotHaveFocus (some other app has taken focus - this will throttle the call to 10hz to reduce the impact on that app) + */ + virtual EVRCompositorError WaitGetPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, + VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; + + /** Get the last set of poses returned by WaitGetPoses. */ + virtual EVRCompositorError GetLastPoses( VR_ARRAY_COUNT( unRenderPoseArrayCount ) TrackedDevicePose_t* pRenderPoseArray, uint32_t unRenderPoseArrayCount, + VR_ARRAY_COUNT( unGamePoseArrayCount ) TrackedDevicePose_t* pGamePoseArray, uint32_t unGamePoseArrayCount ) = 0; + + /** Interface for accessing last set of poses returned by WaitGetPoses one at a time. + * Returns VRCompositorError_IndexOutOfRange if unDeviceIndex not less than k_unMaxTrackedDeviceCount otherwise VRCompositorError_None. + * It is okay to pass NULL for either pose if you only want one of the values. */ + virtual EVRCompositorError GetLastPoseForTrackedDeviceIndex( TrackedDeviceIndex_t unDeviceIndex, TrackedDevicePose_t *pOutputPose, TrackedDevicePose_t *pOutputGamePose ) = 0; + + /** Updated scene texture to display. If pBounds is NULL the entire texture will be used. If called from an OpenGL app, consider adding a glFlush after + * Submitting both frames to signal the driver to start processing, otherwise it may wait until the command buffer fills up, causing the app to miss frames. + * + * OpenGL dirty state: + * glBindTexture + * + * Return codes: + * - IsNotSceneApplication (make sure to call VR_Init with VRApplicaiton_Scene) + * - DoNotHaveFocus (some other app has taken focus) + * - TextureIsOnWrongDevice (application did not use proper AdapterIndex - see IVRSystem.GetDXGIOutputInfo) + * - SharedTexturesNotSupported (application needs to call CreateDXGIFactory1 or later before creating DX device) + * - TextureUsesUnsupportedFormat (scene textures must be compatible with DXGI sharing rules - e.g. uncompressed, no mips, etc.) + * - InvalidTexture (usually means bad arguments passed in) + * - AlreadySubmitted (app has submitted two left textures or two right textures in a single frame - i.e. before calling WaitGetPoses again) + */ + virtual EVRCompositorError Submit( EVREye eEye, const Texture_t *pTexture, const VRTextureBounds_t* pBounds = 0, EVRSubmitFlags nSubmitFlags = Submit_Default ) = 0; + + /** Clears the frame that was sent with the last call to Submit. This will cause the + * compositor to show the grid until Submit is called again. */ + virtual void ClearLastSubmittedFrame() = 0; + + /** Call immediately after presenting your app's window (i.e. companion window) to unblock the compositor. + * This is an optional call, which only needs to be used if you can't instead call WaitGetPoses immediately after Present. + * For example, if your engine's render and game loop are not on separate threads, or blocking the render thread until 3ms before the next vsync would + * introduce a deadlock of some sort. This function tells the compositor that you have finished all rendering after having Submitted buffers for both + * eyes, and it is free to start its rendering work. This should only be called from the same thread you are rendering on. */ + virtual void PostPresentHandoff() = 0; + + /** Returns true if timing data is filled it. Sets oldest timing info if nFramesAgo is larger than the stored history. + * Be sure to set timing.size = sizeof(Compositor_FrameTiming) on struct passed in before calling this function. */ + virtual bool GetFrameTiming( Compositor_FrameTiming *pTiming, uint32_t unFramesAgo = 0 ) = 0; + + /** Interface for copying a range of timing data. Frames are returned in ascending order (oldest to newest) with the last being the most recent frame. + * Only the first entry's m_nSize needs to be set, as the rest will be inferred from that. Returns total number of entries filled out. */ + virtual uint32_t GetFrameTimings( VR_ARRAY_COUNT( nFrames ) Compositor_FrameTiming *pTiming, uint32_t nFrames ) = 0; + + /** Returns the time in seconds left in the current (as identified by FrameTiming's frameIndex) frame. + * Due to "running start", this value may roll over to the next frame before ever reaching 0.0. */ + virtual float GetFrameTimeRemaining() = 0; + + /** Fills out stats accumulated for the last connected application. Pass in sizeof( Compositor_CumulativeStats ) as second parameter. */ + virtual void GetCumulativeStats( Compositor_CumulativeStats *pStats, uint32_t nStatsSizeInBytes ) = 0; + + /** Fades the view on the HMD to the specified color. The fade will take fSeconds, and the color values are between + * 0.0 and 1.0. This color is faded on top of the scene based on the alpha parameter. Removing the fade color instantly + * would be FadeToColor( 0.0, 0.0, 0.0, 0.0, 0.0 ). Values are in un-premultiplied alpha space. */ + virtual void FadeToColor( float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground = false ) = 0; + + /** Get current fade color value. */ + virtual HmdColor_t GetCurrentFadeColor( bool bBackground = false ) = 0; + + /** Fading the Grid in or out in fSeconds */ + virtual void FadeGrid( float fSeconds, bool bFadeGridIn ) = 0; + + /** Get current alpha value of grid. */ + virtual float GetCurrentGridAlpha() = 0; + + /** Override the skybox used in the compositor (e.g. for during level loads when the app can't feed scene images fast enough) + * Order is Front, Back, Left, Right, Top, Bottom. If only a single texture is passed, it is assumed in lat-long format. + * If two are passed, it is assumed a lat-long stereo pair. */ + virtual EVRCompositorError SetSkyboxOverride( VR_ARRAY_COUNT( unTextureCount ) const Texture_t *pTextures, uint32_t unTextureCount ) = 0; + + /** Resets compositor skybox back to defaults. */ + virtual void ClearSkyboxOverride() = 0; + + /** Brings the compositor window to the front. This is useful for covering any other window that may be on the HMD + * and is obscuring the compositor window. */ + virtual void CompositorBringToFront() = 0; + + /** Pushes the compositor window to the back. This is useful for allowing other applications to draw directly to the HMD. */ + virtual void CompositorGoToBack() = 0; + + /** DEPRECATED: Tells the compositor process to clean up and exit. You do not need to call this function at shutdown. + * Under normal circumstances the compositor will manage its own life cycle based on what applications are running. */ + virtual void CompositorQuit() = 0; + + /** Return whether the compositor is fullscreen */ + virtual bool IsFullscreen() = 0; + + /** Returns the process ID of the process that is currently rendering the scene */ + virtual uint32_t GetCurrentSceneFocusProcess() = 0; + + /** Returns the process ID of the process that rendered the last frame (or 0 if the compositor itself rendered the frame.) + * Returns 0 when fading out from an app and the app's process Id when fading into an app. */ + virtual uint32_t GetLastFrameRenderer() = 0; + + /** Returns true if the current process has the scene focus */ + virtual bool CanRenderScene() = 0; + + /** DEPRECATED: Opens the headset view (as either a window or docked widget depending on user's preferences) that displays what the user + * sees in the headset. */ + virtual void ShowMirrorWindow() = 0; + + /** DEPRECATED: Closes the headset view, either as a window or docked widget. */ + virtual void HideMirrorWindow() = 0; + + /** DEPRECATED: Returns true if the headset view (either as a window or docked widget) is shown. */ + virtual bool IsMirrorWindowVisible() = 0; + + /** Writes back buffer and stereo left/right pair from the application to a 'screenshots' folder in the SteamVR runtime root. */ + virtual void CompositorDumpImages() = 0; + + /** Let an app know it should be rendering with low resources. */ + virtual bool ShouldAppRenderWithLowResources() = 0; + + /** Override interleaved reprojection logic to force on. */ + virtual void ForceInterleavedReprojectionOn( bool bOverride ) = 0; + + /** Force reconnecting to the compositor process. */ + virtual void ForceReconnectProcess() = 0; + + /** Temporarily suspends rendering (useful for finer control over scene transitions). */ + virtual void SuspendRendering( bool bSuspend ) = 0; + + /** Opens a shared D3D11 texture with the undistorted composited image for each eye. Use ReleaseMirrorTextureD3D11 when finished + * instead of calling Release on the resource itself. */ + virtual vr::EVRCompositorError GetMirrorTextureD3D11( vr::EVREye eEye, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView ) = 0; + virtual void ReleaseMirrorTextureD3D11( void *pD3D11ShaderResourceView ) = 0; + + /** Access to mirror textures from OpenGL. */ + virtual vr::EVRCompositorError GetMirrorTextureGL( vr::EVREye eEye, vr::glUInt_t *pglTextureId, vr::glSharedTextureHandle_t *pglSharedTextureHandle ) = 0; + virtual bool ReleaseSharedGLTexture( vr::glUInt_t glTextureId, vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; + virtual void LockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; + virtual void UnlockGLSharedTextureForAccess( vr::glSharedTextureHandle_t glSharedTextureHandle ) = 0; + + /** [Vulkan Only] + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. The string will be a space separated list of-required instance extensions to enable in VkCreateInstance */ + virtual uint32_t GetVulkanInstanceExtensionsRequired( VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + + /** [Vulkan only] + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. The string will be a space separated list of required device extensions to enable in VkCreateDevice */ + virtual uint32_t GetVulkanDeviceExtensionsRequired( VkPhysicalDevice_T *pPhysicalDevice, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + + /** [ Vulkan/D3D12 Only ] + * There are two purposes for SetExplicitTimingMode: + * 1. To get a more accurate GPU timestamp for when the frame begins in Vulkan/D3D12 applications. + * 2. (Optional) To avoid having WaitGetPoses access the Vulkan queue so that the queue can be accessed from + * another thread while WaitGetPoses is executing. + * + * More accurate GPU timestamp for the start of the frame is achieved by the application calling + * SubmitExplicitTimingData immediately before its first submission to the Vulkan/D3D12 queue. + * This is more accurate because normally this GPU timestamp is recorded during WaitGetPoses. In D3D11, + * WaitGetPoses queues a GPU timestamp write, but it does not actually get submitted to the GPU until the + * application flushes. By using SubmitExplicitTimingData, the timestamp is recorded at the same place for + * Vulkan/D3D12 as it is for D3D11, resulting in a more accurate GPU time measurement for the frame. + * + * Avoiding WaitGetPoses accessing the Vulkan queue can be achieved using SetExplicitTimingMode as well. If this is desired, + * the application should set the timing mode to Explicit_ApplicationPerformsPostPresentHandoff and *MUST* call PostPresentHandoff + * itself. If these conditions are met, then WaitGetPoses is guaranteed not to access the queue. Note that PostPresentHandoff + * and SubmitExplicitTimingData will access the queue, so only WaitGetPoses becomes safe for accessing the queue from another + * thread. */ + virtual void SetExplicitTimingMode( EVRCompositorTimingMode eTimingMode ) = 0; + + /** [ Vulkan/D3D12 Only ] + * Submit explicit timing data. When SetExplicitTimingMode is true, this must be called immediately before + * the application's first vkQueueSubmit (Vulkan) or ID3D12CommandQueue::ExecuteCommandLists (D3D12) of each frame. + * This function will insert a GPU timestamp write just before the application starts its rendering. This function + * will perform a vkQueueSubmit on Vulkan so must not be done simultaneously with VkQueue operations on another thread. + * Returns VRCompositorError_RequestFailed if SetExplicitTimingMode is not enabled. */ + virtual EVRCompositorError SubmitExplicitTimingData() = 0; + + /** Indicates whether or not motion smoothing is enabled by the user settings. + * If you want to know if motion smoothing actually triggered due to a late frame, check Compositor_FrameTiming + * m_nReprojectionFlags & VRCompositor_ReprojectionMotion instead. */ + virtual bool IsMotionSmoothingEnabled() = 0; + + /** Indicates whether or not motion smoothing is supported by the current hardware. */ + virtual bool IsMotionSmoothingSupported() = 0; + + /** Indicates whether or not the current scene focus app is currently loading. This is inferred from its use of FadeGrid to + * explicitly fade to the compositor to cover up the fact that it cannot render at a sustained full framerate during this time. */ + virtual bool IsCurrentSceneFocusAppLoading() = 0; + + /** Override the stage model used in the compositor to replace the grid. RenderModelPath is a full path the an OBJ file to load. + * This file will be loaded asynchronously from disk and uploaded to the gpu by the runtime. Once ready for rendering, the + * VREvent StageOverrideReady will be sent. Use FadeToGrid to reveal. Call ClearStageOverride to free the associated resources when finished. */ + virtual EVRCompositorError SetStageOverride_Async( const char *pchRenderModelPath, const HmdMatrix34_t *pTransform = 0, + const Compositor_StageRenderSettings *pRenderSettings = 0, uint32_t nSizeOfRenderSettings = 0 ) = 0; + + /** Resets the stage to its default user specified setting. */ + virtual void ClearStageOverride() = 0; + + /** Returns true if pBenchmarkResults is filled it. Sets pBenchmarkResults with the result of the compositor benchmark. + * nSizeOfBenchmarkResults should be set to sizeof(Compositor_BenchmarkResults) */ + virtual bool GetCompositorBenchmarkResults( Compositor_BenchmarkResults *pBenchmarkResults, uint32_t nSizeOfBenchmarkResults ) = 0; + + /** Returns the frame id associated with the poses last returned by WaitGetPoses. Deltas between IDs correspond to number of headset vsync intervals. */ + virtual EVRCompositorError GetLastPosePredictionIDs( uint32_t *pRenderPosePredictionID, uint32_t *pGamePosePredictionID ) = 0; + + /** Get the most up-to-date predicted (or recorded - up to 100ms old) set of poses for a given frame id. */ + virtual EVRCompositorError GetPosesForFrame( uint32_t unPosePredictionID, VR_ARRAY_COUNT( unPoseArrayCount ) TrackedDevicePose_t* pPoseArray, uint32_t unPoseArrayCount ) = 0; +}; + +static const char * const IVRCompositor_Version = "IVRCompositor_027"; + +} // namespace vr + + + +// ivrheadsetview.h + +namespace vr +{ + enum HeadsetViewMode_t + { + HeadsetViewMode_Left = 0, + HeadsetViewMode_Right, + HeadsetViewMode_Both + }; + + class IVRHeadsetView + { + public: + /** Sets the resolution in pixels to render the headset view. These values are clamped to k_unHeadsetViewMaxWidth + * and k_unHeadsetViewMaxHeight respectively. For cropped views, the rendered output will be fit to aspect ratio + * defined by the the specified dimensions. For uncropped views, the caller should use GetHeadsetViewAspectRation + * to adjust the requested render size to avoid squashing or stretching, and then apply letterboxing to compensate + * when displaying the results. */ + virtual void SetHeadsetViewSize( uint32_t nWidth, uint32_t nHeight ) = 0; + + /** Gets the current resolution used to render the headset view. */ + virtual void GetHeadsetViewSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Set the mode used to render the headset view. */ + virtual void SetHeadsetViewMode( HeadsetViewMode_t eHeadsetViewMode ) = 0; + + /** Get the current mode used to render the headset view. */ + virtual HeadsetViewMode_t GetHeadsetViewMode() = 0; + + /** Set whether or not the headset view should be rendered cropped to hide the hidden area mesh or not. */ + virtual void SetHeadsetViewCropped( bool bCropped ) = 0; + + /** Get the current cropping status of the headset view. */ + virtual bool GetHeadsetViewCropped() = 0; + + /** Get the aspect ratio (width:height) of the uncropped headset view (accounting for the current set mode). */ + virtual float GetHeadsetViewAspectRatio() = 0; + + /** Set the range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */ + virtual void SetHeadsetViewBlendRange( float flStartPct, float flEndPct ) = 0; + + /** Get the current range [0..1] that the headset view blends across the stereo overlapped area in cropped both mode. */ + virtual void GetHeadsetViewBlendRange( float *pStartPct, float *pEndPct ) = 0; + }; + + static const uint32_t k_unHeadsetViewMaxWidth = 3840; + static const uint32_t k_unHeadsetViewMaxHeight = 2160; + static const char * const k_pchHeadsetViewOverlayKey = "system.HeadsetView"; + + static const char * const IVRHeadsetView_Version = "IVRHeadsetView_001"; + + /** Returns the current IVRHeadsetView pointer or NULL the interface could not be found. */ + VR_INTERFACE vr::IVRHeadsetView *VR_CALLTYPE VRHeadsetView(); + +} // namespace vr + + +// ivrnotifications.h + +namespace vr +{ + +#pragma pack( push, 8 ) + +// Used for passing graphic data +struct NotificationBitmap_t +{ + NotificationBitmap_t() + : m_pImageData( nullptr ) + , m_nWidth( 0 ) + , m_nHeight( 0 ) + , m_nBytesPerPixel( 0 ) + { + } + + void *m_pImageData; + int32_t m_nWidth; + int32_t m_nHeight; + int32_t m_nBytesPerPixel; +}; + + +/** Be aware that the notification type is used as 'priority' to pick the next notification */ +enum EVRNotificationType +{ + /** Transient notifications are automatically hidden after a period of time set by the user. + * They are used for things like information and chat messages that do not require user interaction. */ + EVRNotificationType_Transient = 0, + + /** Persistent notifications are shown to the user until they are hidden by calling RemoveNotification(). + * They are used for things like phone calls and alarms that require user interaction. */ + EVRNotificationType_Persistent = 1, + + /** System notifications are shown no matter what. It is expected, that the ulUserValue is used as ID. + * If there is already a system notification in the queue with that ID it is not accepted into the queue + * to prevent spamming with system notification */ + EVRNotificationType_Transient_SystemWithUserValue = 2, +}; + +enum EVRNotificationStyle +{ + /** Creates a notification with minimal external styling. */ + EVRNotificationStyle_None = 0, + + /** Used for notifications about overlay-level status. In Steam this is used for events like downloads completing. */ + EVRNotificationStyle_Application = 100, + + /** Used for notifications about contacts that are unknown or not available. In Steam this is used for friend invitations and offline friends. */ + EVRNotificationStyle_Contact_Disabled = 200, + + /** Used for notifications about contacts that are available but inactive. In Steam this is used for friends that are online but not playing a game. */ + EVRNotificationStyle_Contact_Enabled = 201, + + /** Used for notifications about contacts that are available and active. In Steam this is used for friends that are online and currently running a game. */ + EVRNotificationStyle_Contact_Active = 202, +}; + +static const uint32_t k_unNotificationTextMaxSize = 256; + +typedef uint32_t VRNotificationId; + + + +#pragma pack( pop ) + +/** Allows notification sources to interact with the VR system + This current interface is not yet implemented. Do not use yet. */ +class IVRNotifications +{ +public: + /** Create a notification and enqueue it to be shown to the user. + * An overlay handle is required to create a notification, as otherwise it would be impossible for a user to act on it. + * To create a two-line notification, use a line break ('\n') to split the text into two lines. + * The pImage argument may be NULL, in which case the specified overlay's icon will be used instead. */ + virtual EVRNotificationError CreateNotification( VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, const char *pchText, EVRNotificationStyle style, const NotificationBitmap_t *pImage, /* out */ VRNotificationId *pNotificationId ) = 0; + + /** Destroy a notification, hiding it first if it currently shown to the user. */ + virtual EVRNotificationError RemoveNotification( VRNotificationId notificationId ) = 0; + +}; + +static const char * const IVRNotifications_Version = "IVRNotifications_002"; + +} // namespace vr + + + +// ivroverlay.h + +namespace vr +{ + + /** The maximum length of an overlay key in bytes, counting the terminating null character. */ + static const uint32_t k_unVROverlayMaxKeyLength = 128; + + /** The maximum length of an overlay name in bytes, counting the terminating null character. */ + static const uint32_t k_unVROverlayMaxNameLength = 128; + + /** The maximum number of overlays that can exist in the system at one time. */ + static const uint32_t k_unMaxOverlayCount = 128; + + /** The maximum number of overlay intersection mask primitives per overlay */ + static const uint32_t k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; + + /** Types of input supported by VR Overlays */ + enum VROverlayInputMethod + { + VROverlayInputMethod_None = 0, // No input events will be generated automatically for this overlay + VROverlayInputMethod_Mouse = 1, // Tracked controllers will get mouse events automatically + // VROverlayInputMethod_DualAnalog = 2, // No longer supported + }; + + /** Allows the caller to figure out which overlay transform getter to call. */ + enum VROverlayTransformType + { + VROverlayTransform_Invalid = -1, + VROverlayTransform_Absolute = 0, + VROverlayTransform_TrackedDeviceRelative = 1, + VROverlayTransform_SystemOverlay = 2, + VROverlayTransform_TrackedComponent = 3, + VROverlayTransform_Cursor = 4, + VROverlayTransform_DashboardTab = 5, + VROverlayTransform_DashboardThumb = 6, + VROverlayTransform_Mountable = 7, + VROverlayTransform_Projection = 8, + }; + + /** Overlay control settings */ + enum VROverlayFlags + { + // Set this flag on a dashboard overlay to prevent a tab from showing up for that overlay + VROverlayFlags_NoDashboardTab = 1 << 3, + + // When this is set the overlay will receive VREvent_ScrollDiscrete events like a mouse wheel. + // Requires mouse input mode. + VROverlayFlags_SendVRDiscreteScrollEvents = 1 << 6, + + // Indicates that the overlay would like to receive + VROverlayFlags_SendVRTouchpadEvents = 1 << 7, + + // If set this will render a vertical scroll wheel on the primary controller, + // only needed if not using VROverlayFlags_SendVRScrollEvents but you still want to represent a scroll wheel + VROverlayFlags_ShowTouchPadScrollWheel = 1 << 8, + + // If this is set ownership and render access to the overlay are transferred + // to the new scene process on a call to IVRApplications::LaunchInternalProcess + VROverlayFlags_TransferOwnershipToInternalProcess = 1 << 9, + + // If set, renders 50% of the texture in each eye, side by side + VROverlayFlags_SideBySide_Parallel = 1 << 10, // Texture is left/right + VROverlayFlags_SideBySide_Crossed = 1 << 11, // Texture is crossed and right/left + + VROverlayFlags_Panorama = 1 << 12, // Texture is a panorama + VROverlayFlags_StereoPanorama = 1 << 13, // Texture is a stereo panorama + + // If this is set on an overlay owned by the scene application that overlay + // will be sorted with the "Other" overlays on top of all other scene overlays + VROverlayFlags_SortWithNonSceneOverlays = 1 << 14, + + // If set, the overlay will be shown in the dashboard, otherwise it will be hidden. + VROverlayFlags_VisibleInDashboard = 1 << 15, + + // If this is set and the overlay's input method is not none, the system-wide laser mouse + // mode will be activated whenever this overlay is visible. + VROverlayFlags_MakeOverlaysInteractiveIfVisible = 1 << 16, + + // If this is set the overlay will receive smooth VREvent_ScrollSmooth that emulate trackpad scrolling. + // Requires mouse input mode. + VROverlayFlags_SendVRSmoothScrollEvents = 1 << 17, + + // If this is set, the overlay texture will be protected content, preventing unauthorized reads. + VROverlayFlags_ProtectedContent = 1 << 18, + + // If this is set, the laser mouse splat will not be drawn over this overlay. The overlay will + // be responsible for drawing its own "cursor". + VROverlayFlags_HideLaserIntersection = 1 << 19, + + // If this is set, clicking away from the overlay will cause it to receive a VREvent_Modal_Cancel event. + // This is ignored for dashboard overlays. + VROverlayFlags_WantsModalBehavior = 1 << 20, + + // If this is set, alpha composition assumes the texture is pre-multiplied + VROverlayFlags_IsPremultiplied = 1 << 21, + }; + + enum VRMessageOverlayResponse + { + VRMessageOverlayResponse_ButtonPress_0 = 0, + VRMessageOverlayResponse_ButtonPress_1 = 1, + VRMessageOverlayResponse_ButtonPress_2 = 2, + VRMessageOverlayResponse_ButtonPress_3 = 3, + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay= 5, + VRMessageOverlayResponse_ApplicationQuit = 6 + }; + + struct VROverlayIntersectionParams_t + { + HmdVector3_t vSource; + HmdVector3_t vDirection; + ETrackingUniverseOrigin eOrigin; + }; + + struct VROverlayIntersectionResults_t + { + HmdVector3_t vPoint; + HmdVector3_t vNormal; + HmdVector2_t vUVs; + float fDistance; + }; + + // Input modes for the Big Picture gamepad text entry + enum EGamepadTextInputMode + { + k_EGamepadTextInputModeNormal = 0, + k_EGamepadTextInputModePassword = 1, + k_EGamepadTextInputModeSubmit = 2, + }; + + // Controls number of allowed lines for the Big Picture gamepad text entry + enum EGamepadTextInputLineMode + { + k_EGamepadTextInputLineModeSingleLine = 0, + k_EGamepadTextInputLineModeMultipleLines = 1 + }; + + enum EVROverlayIntersectionMaskPrimitiveType + { + OverlayIntersectionPrimitiveType_Rectangle, + OverlayIntersectionPrimitiveType_Circle, + }; + + struct IntersectionMaskRectangle_t + { + float m_flTopLeftX; + float m_flTopLeftY; + float m_flWidth; + float m_flHeight; + }; + + struct IntersectionMaskCircle_t + { + float m_flCenterX; + float m_flCenterY; + float m_flRadius; + }; + + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py and openvr_api_flat.h.py */ + typedef union + { + IntersectionMaskRectangle_t m_Rectangle; + IntersectionMaskCircle_t m_Circle; + } VROverlayIntersectionMaskPrimitive_Data_t; + + struct VROverlayIntersectionMaskPrimitive_t + { + EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; + VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; + }; + + enum EKeyboardFlags + { + KeyboardFlag_Minimal = 1 << 0, // makes the keyboard send key events immediately instead of accumulating a buffer + KeyboardFlag_Modal = 2 << 0, // makes the keyboard take all focus and dismiss when clicking off the panel + }; + + /** Defines the project used in an overlay that is using SetOverlayTransformProjection */ + struct VROverlayProjection_t + { + /** Tangent of the sides of the frustum */ + float fLeft; + float fRight; + float fTop; + float fBottom; + }; + + class IVROverlay + { + public: + + // --------------------------------------------- + // Overlay management methods + // --------------------------------------------- + + /** Finds an existing overlay with the specified key. */ + virtual EVROverlayError FindOverlay( const char *pchOverlayKey, VROverlayHandle_t * pOverlayHandle ) = 0; + + /** Creates a new named overlay. All overlays start hidden and with default settings. */ + virtual EVROverlayError CreateOverlay( const char *pchOverlayKey, const char *pchOverlayName, VROverlayHandle_t * pOverlayHandle ) = 0; + + /** Destroys the specified overlay. When an application calls VR_Shutdown all overlays created by that app are + * automatically destroyed. */ + virtual EVROverlayError DestroyOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Fills the provided buffer with the string key of the overlay. Returns the size of buffer required to store the key, including + * the terminating null character. k_unVROverlayMaxKeyLength will be enough bytes to fit the string. */ + virtual uint32_t GetOverlayKey( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; + + /** Fills the provided buffer with the friendly name of the overlay. Returns the size of buffer required to store the key, including + * the terminating null character. k_unVROverlayMaxNameLength will be enough bytes to fit the string. */ + virtual uint32_t GetOverlayName( VROverlayHandle_t ulOverlayHandle, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, EVROverlayError *pError = 0L ) = 0; + + /** set the name to use for this overlay */ + virtual EVROverlayError SetOverlayName( VROverlayHandle_t ulOverlayHandle, const char *pchName ) = 0; + + /** Gets the raw image data from an overlay. Overlay image data is always returned as RGBA data, 4 bytes per pixel. If the buffer is not large enough, width and height + * will be set and VROverlayError_ArrayTooSmall is returned. */ + virtual EVROverlayError GetOverlayImageData( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unBufferSize, uint32_t *punWidth, uint32_t *punHeight ) = 0; + + /** returns a string that corresponds with the specified overlay error. The string will be the name + * of the error enum value for all valid error codes */ + virtual const char *GetOverlayErrorNameFromEnum( EVROverlayError error ) = 0; + + // --------------------------------------------- + // Overlay rendering methods + // --------------------------------------------- + + /** Sets the pid that is allowed to render to this overlay (the creator pid is always allow to render), + * by default this is the pid of the process that made the overlay */ + virtual EVROverlayError SetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle, uint32_t unPID ) = 0; + + /** Gets the pid that is allowed to render to this overlay */ + virtual uint32_t GetOverlayRenderingPid( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Specify flag setting for a given overlay */ + virtual EVROverlayError SetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled ) = 0; + + /** Sets flag setting for a given overlay */ + virtual EVROverlayError GetOverlayFlag( VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool *pbEnabled ) = 0; + + /** Gets all the flags for a given overlay */ + virtual EVROverlayError GetOverlayFlags( VROverlayHandle_t ulOverlayHandle, uint32_t *pFlags ) = 0; + + /** Sets the color tint of the overlay quad. Use 0.0 to 1.0 per channel. */ + virtual EVROverlayError SetOverlayColor( VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue ) = 0; + + /** Gets the color tint of the overlay quad. */ + virtual EVROverlayError GetOverlayColor( VROverlayHandle_t ulOverlayHandle, float *pfRed, float *pfGreen, float *pfBlue ) = 0; + + /** Sets the alpha of the overlay quad. Use 1.0 for 100 percent opacity to 0.0 for 0 percent opacity. */ + virtual EVROverlayError SetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float fAlpha ) = 0; + + /** Gets the alpha of the overlay quad. By default overlays are rendering at 100 percent alpha (1.0). */ + virtual EVROverlayError GetOverlayAlpha( VROverlayHandle_t ulOverlayHandle, float *pfAlpha ) = 0; + + /** Sets the aspect ratio of the texels in the overlay. 1.0 means the texels are square. 2.0 means the texels + * are twice as wide as they are tall. Defaults to 1.0. */ + virtual EVROverlayError SetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float fTexelAspect ) = 0; + + /** Gets the aspect ratio of the texels in the overlay. Defaults to 1.0 */ + virtual EVROverlayError GetOverlayTexelAspect( VROverlayHandle_t ulOverlayHandle, float *pfTexelAspect ) = 0; + + /** Sets the rendering sort order for the overlay. Overlays are rendered this order: + * Overlays owned by the scene application + * Overlays owned by some other application + * + * Within a category overlays are rendered lowest sort order to highest sort order. Overlays with the same + * sort order are rendered back to front base on distance from the HMD. + * + * Sort order defaults to 0. */ + virtual EVROverlayError SetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder ) = 0; + + /** Gets the sort order of the overlay. See SetOverlaySortOrder for how this works. */ + virtual EVROverlayError GetOverlaySortOrder( VROverlayHandle_t ulOverlayHandle, uint32_t *punSortOrder ) = 0; + + /** Sets the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ + virtual EVROverlayError SetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float fWidthInMeters ) = 0; + + /** Returns the width of the overlay quad in meters. By default overlays are rendered on a quad that is 1 meter across */ + virtual EVROverlayError GetOverlayWidthInMeters( VROverlayHandle_t ulOverlayHandle, float *pfWidthInMeters ) = 0; + + /** Use to draw overlay as a curved surface. Curvature is a percentage from (0..1] where 1 is a fully closed cylinder. + * For a specific radius, curvature can be computed as: overlay.width / (2 PI r). */ + virtual EVROverlayError SetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float fCurvature ) = 0; + + /** Returns the curvature of the overlay as a percentage from (0..1] where 1 is a fully closed cylinder. */ + virtual EVROverlayError GetOverlayCurvature( VROverlayHandle_t ulOverlayHandle, float *pfCurvature ) = 0; + + /** Sets the colorspace the overlay texture's data is in. Defaults to 'auto'. + * If the texture needs to be resolved, you should call SetOverlayTexture with the appropriate colorspace instead. */ + virtual EVROverlayError SetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace ) = 0; + + /** Gets the overlay's current colorspace setting. */ + virtual EVROverlayError GetOverlayTextureColorSpace( VROverlayHandle_t ulOverlayHandle, EColorSpace *peTextureColorSpace ) = 0; + + /** Sets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */ + virtual EVROverlayError SetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, const VRTextureBounds_t *pOverlayTextureBounds ) = 0; + + /** Gets the part of the texture to use for the overlay. UV Min is the upper left corner and UV Max is the lower right corner. */ + virtual EVROverlayError GetOverlayTextureBounds( VROverlayHandle_t ulOverlayHandle, VRTextureBounds_t *pOverlayTextureBounds ) = 0; + + /** Returns the transform type of this overlay. */ + virtual EVROverlayError GetOverlayTransformType( VROverlayHandle_t ulOverlayHandle, VROverlayTransformType *peTransformType ) = 0; + + /** Sets the transform to absolute tracking origin. */ + virtual EVROverlayError SetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; + + /** Gets the transform if it is absolute. Returns an error if the transform is some other type. */ + virtual EVROverlayError GetOverlayTransformAbsolute( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin *peTrackingOrigin, HmdMatrix34_t *pmatTrackingOriginToOverlayTransform ) = 0; + + /** Sets the transform to relative to the transform of the specified tracked device. */ + virtual EVROverlayError SetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, const HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; + + /** Gets the transform if it is relative to a tracked device. Returns an error if the transform is some other type. */ + virtual EVROverlayError GetOverlayTransformTrackedDeviceRelative( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punTrackedDevice, HmdMatrix34_t *pmatTrackedDeviceToOverlayTransform ) = 0; + + /** Sets the transform to draw the overlay on a rendermodel component mesh instead of a quad. This will only draw when the system is + * drawing the device. Overlays with this transform type cannot receive mouse events. */ + virtual EVROverlayError SetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, const char *pchComponentName ) = 0; + + /** Gets the transform information when the overlay is rendering on a component. */ + virtual EVROverlayError GetOverlayTransformTrackedDeviceComponent( VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t *punDeviceIndex, VR_OUT_STRING() char *pchComponentName, uint32_t unComponentNameSize ) = 0; + + /** Gets the transform if it is relative to another overlay. Returns an error if the transform is some other type. */ + virtual vr::EVROverlayError GetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t *ulOverlayHandleParent, HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; + + /** Sets the transform to relative to the transform of the specified overlay. This overlays visibility will also track the parents visibility */ + virtual vr::EVROverlayError SetOverlayTransformOverlayRelative( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, const HmdMatrix34_t *pmatParentOverlayToOverlayTransform ) = 0; + + /** Sets the hotspot for the specified overlay when that overlay is used as a cursor. These are in texture space with 0,0 in the upper left corner of + * the texture and 1,1 in the lower right corner of the texture. */ + virtual EVROverlayError SetOverlayTransformCursor( VROverlayHandle_t ulCursorOverlayHandle, const HmdVector2_t *pvHotspot ) = 0; + + /** Gets cursor hotspot/transform for the specified overlay */ + virtual vr::EVROverlayError GetOverlayTransformCursor( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvHotspot ) = 0; + + /** Sets the overlay as a projection overlay */ + virtual vr::EVROverlayError SetOverlayTransformProjection( VROverlayHandle_t ulOverlayHandle, + ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t* pmatTrackingOriginToOverlayTransform, + const VROverlayProjection_t *pProjection, vr::EVREye eEye ) = 0; + + /** Shows the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ + virtual EVROverlayError ShowOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Hides the VR overlay. For dashboard overlays, only the Dashboard Manager is allowed to call this. */ + virtual EVROverlayError HideOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Returns true if the overlay is visible. */ + virtual bool IsOverlayVisible( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Get the transform in 3d space associated with a specific 2d point in the overlay's coordinate space (where 0,0 is the lower left). -Z points out of the overlay */ + virtual EVROverlayError GetTransformForOverlayCoordinates( VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, HmdMatrix34_t *pmatTransform ) = 0; + + // --------------------------------------------- + // Overlay input methods + // --------------------------------------------- + + /** Returns true and fills the event with the next event on the overlay's event queue, if there is one. + * If there are no events this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextOverlayEvent( VROverlayHandle_t ulOverlayHandle, VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; + + /** Returns the current input settings for the specified overlay. */ + virtual EVROverlayError GetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod *peInputMethod ) = 0; + + /** Sets the input settings for the specified overlay. */ + virtual EVROverlayError SetOverlayInputMethod( VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod ) = 0; + + /** Gets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is + * typically the size of the underlying UI in pixels. */ + virtual EVROverlayError GetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, HmdVector2_t *pvecMouseScale ) = 0; + + /** Sets the mouse scaling factor that is used for mouse events. The actual texture may be a different size, but this is + * typically the size of the underlying UI in pixels (not in world space). */ + virtual EVROverlayError SetOverlayMouseScale( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvecMouseScale ) = 0; + + /** Computes the overlay-space pixel coordinates of where the ray intersects the overlay with the + * specified settings. Returns false if there is no intersection. */ + virtual bool ComputeOverlayIntersection( VROverlayHandle_t ulOverlayHandle, const VROverlayIntersectionParams_t *pParams, VROverlayIntersectionResults_t *pResults ) = 0; + + /** Returns true if the specified overlay is the hover target. An overlay is the hover target when it is the last overlay "moused over" + * by the virtual mouse pointer */ + virtual bool IsHoverTargetOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Sets a list of primitives to be used for controller ray intersection + * typically the size of the underlying UI in pixels (not in world space). */ + virtual EVROverlayError SetOverlayIntersectionMask( VROverlayHandle_t ulOverlayHandle, VROverlayIntersectionMaskPrimitive_t *pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize = sizeof( VROverlayIntersectionMaskPrimitive_t ) ) = 0; + + /** Triggers a haptic event on the laser mouse controller for the specified overlay */ + virtual EVROverlayError TriggerLaserMouseHapticVibration( VROverlayHandle_t ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude ) = 0; + + /** Sets the cursor to use for the specified overlay. This will be drawn instead of the generic blob when the laser mouse is pointed at the specified overlay */ + virtual EVROverlayError SetOverlayCursor( VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulCursorHandle ) = 0; + + /** Sets the override cursor position to use for this overlay in overlay mouse coordinates. This position will be used to draw the cursor + * instead of whatever the laser mouse cursor position is. */ + virtual EVROverlayError SetOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle, const HmdVector2_t *pvCursor ) = 0; + + /** Clears the override cursor position for this overlay */ + virtual EVROverlayError ClearOverlayCursorPositionOverride( VROverlayHandle_t ulOverlayHandle ) = 0; + + // --------------------------------------------- + // Overlay texture methods + // --------------------------------------------- + + /** Texture to draw for the overlay. This function can only be called by the overlay's creator or renderer process (see SetOverlayRenderingPid) . + * + * OpenGL dirty state: + * glBindTexture + */ + virtual EVROverlayError SetOverlayTexture( VROverlayHandle_t ulOverlayHandle, const Texture_t *pTexture ) = 0; + + /** Use this to tell the overlay system to release the texture set for this overlay. */ + virtual EVROverlayError ClearOverlayTexture( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Separate interface for providing the data as a stream of bytes, but there is an upper bound on data + * that can be sent. This function can only be called by the overlay's renderer process. */ + virtual EVROverlayError SetOverlayRaw( VROverlayHandle_t ulOverlayHandle, void *pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unBytesPerPixel ) = 0; + + /** Separate interface for providing the image through a filename: can be png or jpg, and should not be bigger than 1920x1080. + * This function can only be called by the overlay's renderer process */ + virtual EVROverlayError SetOverlayFromFile( VROverlayHandle_t ulOverlayHandle, const char *pchFilePath ) = 0; + + /** Get the native texture handle/device for an overlay you have created. + * On windows this handle will be a ID3D11ShaderResourceView with a ID3D11Texture2D bound. + * + * The texture will always be sized to match the backing texture you supplied in SetOverlayTexture above. + * + * You MUST call ReleaseNativeOverlayHandle() with pNativeTextureHandle once you are done with this texture. + * + * pNativeTextureHandle is an OUTPUT, it will be a pointer to a ID3D11ShaderResourceView *. + * pNativeTextureRef is an INPUT and should be a ID3D11Resource *. The device used by pNativeTextureRef will be used to bind pNativeTextureHandle. + */ + virtual EVROverlayError GetOverlayTexture( VROverlayHandle_t ulOverlayHandle, void **pNativeTextureHandle, void *pNativeTextureRef, uint32_t *pWidth, uint32_t *pHeight, uint32_t *pNativeFormat, ETextureType *pAPIType, EColorSpace *pColorSpace, VRTextureBounds_t *pTextureBounds ) = 0; + + /** Release the pNativeTextureHandle provided from the GetOverlayTexture call, this allows the system to free the underlying GPU resources for this object, + * so only do it once you stop rendering this texture. + */ + virtual EVROverlayError ReleaseNativeOverlayHandle( VROverlayHandle_t ulOverlayHandle, void *pNativeTextureHandle ) = 0; + + /** Get the size of the overlay texture */ + virtual EVROverlayError GetOverlayTextureSize( VROverlayHandle_t ulOverlayHandle, uint32_t *pWidth, uint32_t *pHeight ) = 0; + + // ---------------------------------------------- + // Dashboard Overlay Methods + // ---------------------------------------------- + + /** Creates a dashboard overlay and returns its handle */ + virtual EVROverlayError CreateDashboardOverlay( const char *pchOverlayKey, const char *pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t *pThumbnailHandle ) = 0; + + /** Returns true if the dashboard is visible */ + virtual bool IsDashboardVisible() = 0; + + /** returns true if the dashboard is visible and the specified overlay is the active system Overlay */ + virtual bool IsActiveDashboardOverlay( VROverlayHandle_t ulOverlayHandle ) = 0; + + /** Sets the dashboard overlay to only appear when the specified process ID has scene focus */ + virtual EVROverlayError SetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId ) = 0; + + /** Gets the process ID that this dashboard overlay requires to have scene focus */ + virtual EVROverlayError GetDashboardOverlaySceneProcess( VROverlayHandle_t ulOverlayHandle, uint32_t *punProcessId ) = 0; + + /** Shows the dashboard. */ + virtual void ShowDashboard( const char *pchOverlayToShow ) = 0; + + /** Returns the tracked device that has the laser pointer in the dashboard */ + virtual vr::TrackedDeviceIndex_t GetPrimaryDashboardDevice() = 0; + + // --------------------------------------------- + // Keyboard methods + // --------------------------------------------- + + /** Show the virtual keyboard to accept input. In most cases, you should pass KeyboardFlag_Modal to enable modal overlay + * behavior on the keyboard itself. See EKeyboardFlags for more. */ + virtual EVROverlayError ShowKeyboard( EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, + const char *pchDescription, uint32_t unCharMax, const char *pchExistingText, uint64_t uUserValue ) = 0; + + /** Show the virtual keyboard to accept input for an overlay. In most cases, you should pass KeyboardFlag_Modal to enable modal + * overlay behavior on the keyboard itself. See EKeyboardFlags for more. */ + virtual EVROverlayError ShowKeyboardForOverlay( VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, + EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, const char *pchDescription, uint32_t unCharMax, + const char *pchExistingText, uint64_t uUserValue ) = 0; + + /** Get the text that was entered into the text input **/ + virtual uint32_t GetKeyboardText( VR_OUT_STRING() char *pchText, uint32_t cchText ) = 0; + + /** Hide the virtual keyboard **/ + virtual void HideKeyboard() = 0; + + /** Set the position of the keyboard in world space **/ + virtual void SetKeyboardTransformAbsolute( ETrackingUniverseOrigin eTrackingOrigin, const HmdMatrix34_t *pmatTrackingOriginToKeyboardTransform ) = 0; + + /** Set the position of the keyboard in overlay space by telling it to avoid a rectangle in the overlay. Rectangle coords have (0,0) in the bottom left **/ + virtual void SetKeyboardPositionForOverlay( VROverlayHandle_t ulOverlayHandle, HmdRect2_t avoidRect ) = 0; + + // --------------------------------------------- + // Message box methods + // --------------------------------------------- + + /** Show the message overlay. This will block and return you a result. **/ + virtual VRMessageOverlayResponse ShowMessageOverlay( const char* pchText, const char* pchCaption, const char* pchButton0Text, const char* pchButton1Text = nullptr, const char* pchButton2Text = nullptr, const char* pchButton3Text = nullptr ) = 0; + + /** If the calling process owns the overlay and it's open, this will close it. **/ + virtual void CloseMessageOverlay() = 0; + }; + + static const char * const IVROverlay_Version = "IVROverlay_025"; + +} // namespace vr + +// ivroverlayview.h + +namespace vr +{ + struct VROverlayView_t + { + VROverlayHandle_t overlayHandle; + Texture_t texture; + VRTextureBounds_t textureBounds; + }; + + enum EDeviceType + { + DeviceType_Invalid = -1, // Invalid handle + DeviceType_DirectX11 = 0, // Handle is an ID3D11Device + DeviceType_Vulkan = 1, // Handle is a pointer to a VRVulkanDevice_t structure + }; + + struct VRVulkanDevice_t + { + VkInstance_T *m_pInstance; + VkDevice_T *m_pDevice; + VkPhysicalDevice_T *m_pPhysicalDevice; + VkQueue_T *m_pQueue; + uint32_t m_uQueueFamilyIndex; + }; + + struct VRNativeDevice_t + { + void *handle; // See EDeviceType definition above + EDeviceType eType; + }; + + class IVROverlayView + { + public: + /** Acquire an OverlayView_t from an overlay handle + * + * The overlay view can be used to sample the contents directly by a native API. The + * contents of the OverlayView_t will remain unchanged through the lifetime of the + * OverlayView_t. + * + * The caller acquires read privileges over the OverlayView_t, but should not + * write to it. + * + * AcquireOverlayView() may be called on the same ulOverlayHandle multiple times to + * refresh the image contents. In this case the caller is strongly encouraged to re-use + * the same pOverlayView for all re-acquisition calls. + * + * If the producer has not yet queued an image, AcquireOverlayView will return success, + * and the Texture_t will have the expected ETextureType. However, the Texture_t->handle + * will be nullptr. Once the producer generates the first overlay frame, Texture_t->handle + * will become a valid handle. + */ + virtual EVROverlayError AcquireOverlayView(VROverlayHandle_t ulOverlayHandle, VRNativeDevice_t *pNativeDevice, VROverlayView_t *pOverlayView, uint32_t unOverlayViewSize ) = 0; + + /** Release an acquired OverlayView_t + * + * Denotes that pOverlayView will no longer require access to the resources it acquired in + * all previous calls to AcquireOverlayView(). + * + * All OverlayView_t*'s provided to AcquireOverlayView() as pOverlayViews must be + * passed into ReleaseOverlayView() in order for the underlying GPU resources to be freed. + */ + virtual EVROverlayError ReleaseOverlayView(VROverlayView_t *pOverlayView) = 0; + + /** Posts an overlay event */ + virtual void PostOverlayEvent(VROverlayHandle_t ulOverlayHandle, const VREvent_t *pvrEvent) = 0; + + /** Determines whether this process is permitted to view an overlay's content. */ + virtual bool IsViewingPermitted( VROverlayHandle_t ulOverlayHandle ) = 0; + + }; + + static const char * const IVROverlayView_Version = "IVROverlayView_003"; + +} + +// ivrrendermodels.h + +namespace vr +{ + +static const char * const k_pch_Controller_Component_GDC2015 = "gdc2015"; // Canonical coordinate system of the gdc 2015 wired controller, provided for backwards compatibility +static const char * const k_pch_Controller_Component_Base = "base"; // For controllers with an unambiguous 'base'. +static const char * const k_pch_Controller_Component_Tip = "tip"; // For controllers with an unambiguous 'tip' (used for 'laser-pointing') +static const char * const k_pch_Controller_Component_HandGrip = "handgrip"; // Neutral, ambidextrous hand-pose when holding controller. On plane between neutrally posed index finger and thumb +static const char * const k_pch_Controller_Component_Status = "status"; // 1:1 aspect ratio status area, with canonical [0,1] uv mapping + +#pragma pack( push, 8 ) + +/** Errors that can occur with the VR compositor */ +enum EVRRenderModelError +{ + VRRenderModelError_None = 0, + VRRenderModelError_Loading = 100, + VRRenderModelError_NotSupported = 200, + VRRenderModelError_InvalidArg = 300, + VRRenderModelError_InvalidModel = 301, + VRRenderModelError_NoShapes = 302, + VRRenderModelError_MultipleShapes = 303, + VRRenderModelError_TooManyVertices = 304, + VRRenderModelError_MultipleTextures = 305, + VRRenderModelError_BufferTooSmall = 306, + VRRenderModelError_NotEnoughNormals = 307, + VRRenderModelError_NotEnoughTexCoords = 308, + + VRRenderModelError_InvalidTexture = 400, +}; + +enum EVRRenderModelTextureFormat +{ + VRRenderModelTextureFormat_RGBA8_SRGB = 0, // RGBA with 8 bits per channel per pixel. Data size is width * height * 4ub + VRRenderModelTextureFormat_BC2, + VRRenderModelTextureFormat_BC4, + VRRenderModelTextureFormat_BC7, + VRRenderModelTextureFormat_BC7_SRGB +}; + +/** A single vertex in a render model */ +struct RenderModel_Vertex_t +{ + HmdVector3_t vPosition; // position in meters in device space + HmdVector3_t vNormal; + float rfTextureCoord[2]; +}; + +/** A texture map for use on a render model */ +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +struct RenderModel_TextureMap_t +{ + uint16_t unWidth, unHeight; // width and height of the texture map in pixels + const uint8_t *rubTextureMapData; // Map texture data. + EVRRenderModelTextureFormat format; // Refer to EVRRenderModelTextureFormat +}; +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + +/** Session unique texture identifier. Rendermodels which share the same texture will have the same id. +IDs <0 denote the texture is not present */ + +typedef int32_t TextureID_t; + +const TextureID_t INVALID_TEXTURE_ID = -1; + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +struct RenderModel_t +{ + const RenderModel_Vertex_t *rVertexData; // Vertex data for the mesh + uint32_t unVertexCount; // Number of vertices in the vertex data + const uint16_t *rIndexData; // Indices into the vertex data for each triangle + uint32_t unTriangleCount; // Number of triangles in the mesh. Index count is 3 * TriangleCount + TextureID_t diffuseTextureId; // Session unique texture identifier. Rendermodels which share the same texture will have the same id. <0 == texture not present +}; +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + + +struct RenderModel_ControllerMode_State_t +{ + bool bScrollWheelVisible; // is this controller currently set to be in a scroll wheel mode +}; + +#pragma pack( pop ) + +class IVRRenderModels +{ +public: + + /** Loads and returns a render model for use in the application. pchRenderModelName should be a render model name + * from the Prop_RenderModelName_String property or an absolute path name to a render model on disk. + * + * The resulting render model is valid until VR_Shutdown() is called or until FreeRenderModel() is called. When the + * application is finished with the render model it should call FreeRenderModel() to free the memory associated + * with the model. + * + * The method returns VRRenderModelError_Loading while the render model is still being loaded. + * The method returns VRRenderModelError_None once loaded successfully, otherwise will return an error. */ + virtual EVRRenderModelError LoadRenderModel_Async( const char *pchRenderModelName, RenderModel_t **ppRenderModel ) = 0; + + /** Frees a previously returned render model + * It is safe to call this on a null ptr. */ + virtual void FreeRenderModel( RenderModel_t *pRenderModel ) = 0; + + /** Loads and returns a texture for use in the application. */ + virtual EVRRenderModelError LoadTexture_Async( TextureID_t textureId, RenderModel_TextureMap_t **ppTexture ) = 0; + + /** Frees a previously returned texture + * It is safe to call this on a null ptr. */ + virtual void FreeTexture( RenderModel_TextureMap_t *pTexture ) = 0; + + /** Creates a D3D11 texture and loads data into it. */ + virtual EVRRenderModelError LoadTextureD3D11_Async( TextureID_t textureId, void *pD3D11Device, void **ppD3D11Texture2D ) = 0; + + /** Helper function to copy the bits into an existing texture. */ + virtual EVRRenderModelError LoadIntoTextureD3D11_Async( TextureID_t textureId, void *pDstTexture ) = 0; + + /** Use this to free textures created with LoadTextureD3D11_Async instead of calling Release on them. */ + virtual void FreeTextureD3D11( void *pD3D11Texture2D ) = 0; + + /** Use this to get the names of available render models. Index does not correlate to a tracked device index, but + * is only used for iterating over all available render models. If the index is out of range, this function will return 0. + * Otherwise, it will return the size of the buffer required for the name. */ + virtual uint32_t GetRenderModelName( uint32_t unRenderModelIndex, VR_OUT_STRING() char *pchRenderModelName, uint32_t unRenderModelNameLen ) = 0; + + /** Returns the number of available render models. */ + virtual uint32_t GetRenderModelCount() = 0; + + + /** Returns the number of components of the specified render model. + * Components are useful when client application wish to draw, label, or otherwise interact with components of tracked objects. + * Examples controller components: + * renderable things such as triggers, buttons + * non-renderable things which include coordinate systems such as 'tip', 'base', a neutral controller agnostic hand-pose + * If all controller components are enumerated and rendered, it will be equivalent to drawing the traditional render model + * Returns 0 if components not supported, >0 otherwise */ + virtual uint32_t GetComponentCount( const char *pchRenderModelName ) = 0; + + /** Use this to get the names of available components. Index does not correlate to a tracked device index, but + * is only used for iterating over all available components. If the index is out of range, this function will return 0. + * Otherwise, it will return the size of the buffer required for the name. */ + virtual uint32_t GetComponentName( const char *pchRenderModelName, uint32_t unComponentIndex, VR_OUT_STRING( ) char *pchComponentName, uint32_t unComponentNameLen ) = 0; + + /** Get the button mask for all buttons associated with this component + * If no buttons (or axes) are associated with this component, return 0 + * Note: multiple components may be associated with the same button. Ex: two grip buttons on a single controller. + * Note: A single component may be associated with multiple buttons. Ex: A trackpad which also provides "D-pad" functionality */ + virtual uint64_t GetComponentButtonMask( const char *pchRenderModelName, const char *pchComponentName ) = 0; + + /** Use this to get the render model name for the specified rendermode/component combination, to be passed to LoadRenderModel. + * If the component name is out of range, this function will return 0. + * Otherwise, it will return the size of the buffer required for the name. */ + virtual uint32_t GetComponentRenderModelName( const char *pchRenderModelName, const char *pchComponentName, VR_OUT_STRING( ) char *pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen ) = 0; + + /** Use this to query information about the component, as a function of the controller state. + * + * For dynamic controller components (ex: trigger) values will reflect component motions + * For static components this will return a consistent value independent of the VRControllerState_t + * + * If the pchRenderModelName or pchComponentName is invalid, this will return false (and transforms will be set to identity). + * Otherwise, return true + * Note: For dynamic objects, visibility may be dynamic. (I.e., true/false will be returned based on controller state and controller mode state ) */ + virtual bool GetComponentStateForDevicePath( const char *pchRenderModelName, const char *pchComponentName, vr::VRInputValueHandle_t devicePath, const vr::RenderModel_ControllerMode_State_t *pState, vr::RenderModel_ComponentState_t *pComponentState ) = 0; + + /** This version of GetComponentState takes a controller state block instead of an action origin. This function is deprecated. You should use the new input system and GetComponentStateForDevicePath instead. */ + virtual bool GetComponentState( const char *pchRenderModelName, const char *pchComponentName, const vr::VRControllerState_t *pControllerState, const RenderModel_ControllerMode_State_t *pState, RenderModel_ComponentState_t *pComponentState ) = 0; + + /** Returns true if the render model has a component with the specified name */ + virtual bool RenderModelHasComponent( const char *pchRenderModelName, const char *pchComponentName ) = 0; + + /** Returns the URL of the thumbnail image for this rendermodel */ + virtual uint32_t GetRenderModelThumbnailURL( const char *pchRenderModelName, VR_OUT_STRING() char *pchThumbnailURL, uint32_t unThumbnailURLLen, vr::EVRRenderModelError *peError ) = 0; + + /** Provides a render model path that will load the unskinned model if the model name provided has been replace by the user. If the model + * hasn't been replaced the path value will still be a valid path to load the model. Pass this to LoadRenderModel_Async, etc. to load the + * model. */ + virtual uint32_t GetRenderModelOriginalPath( const char *pchRenderModelName, VR_OUT_STRING() char *pchOriginalPath, uint32_t unOriginalPathLen, vr::EVRRenderModelError *peError ) = 0; + + /** Returns a string for a render model error */ + virtual const char *GetRenderModelErrorNameFromEnum( vr::EVRRenderModelError error ) = 0; +}; + +static const char * const IVRRenderModels_Version = "IVRRenderModels_006"; + +} + + +// ivrextendeddisplay.h + +namespace vr +{ + + /** NOTE: Use of this interface is not recommended in production applications. It will not work for displays which use + * direct-to-display mode. Creating our own window is also incompatible with the VR compositor and is not available when the compositor is running. */ + class IVRExtendedDisplay + { + public: + + /** Size and position that the window needs to be on the VR display. */ + virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Gets the viewport in the frame buffer to draw the output of the distortion into */ + virtual void GetEyeOutputViewport( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** [D3D10/11 Only] + * Returns the adapter index and output index that the user should pass into EnumAdapters and EnumOutputs + * to create the device and swap chain in DX10 and DX11. If an error occurs both indices will be set to -1. + */ + virtual void GetDXGIOutputInfo( int32_t *pnAdapterIndex, int32_t *pnAdapterOutputIndex ) = 0; + + }; + + static const char * const IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; + +} + + +// ivrtrackedcamera.h + +namespace vr +{ + +class IVRTrackedCamera +{ +public: + /** Returns a string for an error */ + virtual const char *GetCameraErrorNameFromEnum( vr::EVRTrackedCameraError eCameraError ) = 0; + + /** For convenience, same as tracked property request Prop_HasCamera_Bool */ + virtual vr::EVRTrackedCameraError HasCamera( vr::TrackedDeviceIndex_t nDeviceIndex, bool *pHasCamera ) = 0; + + /** Gets size of the image frame. */ + virtual vr::EVRTrackedCameraError GetCameraFrameSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pnWidth, uint32_t *pnHeight, uint32_t *pnFrameBufferSize ) = 0; + + virtual vr::EVRTrackedCameraError GetCameraIntrinsics( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::HmdVector2_t *pFocalLength, vr::HmdVector2_t *pCenter ) = 0; + + virtual vr::EVRTrackedCameraError GetCameraProjection( vr::TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0; + + /** Acquiring streaming service permits video streaming for the caller. Releasing hints the system that video services do not need to be maintained for this client. + * If the camera has not already been activated, a one time spin up may incur some auto exposure as well as initial streaming frame delays. + * The camera should be considered a global resource accessible for shared consumption but not exclusive to any caller. + * The camera may go inactive due to lack of active consumers or headset idleness. */ + virtual vr::EVRTrackedCameraError AcquireVideoStreamingService( vr::TrackedDeviceIndex_t nDeviceIndex, vr::TrackedCameraHandle_t *pHandle ) = 0; + virtual vr::EVRTrackedCameraError ReleaseVideoStreamingService( vr::TrackedCameraHandle_t hTrackedCamera ) = 0; + + /** Copies the image frame into a caller's provided buffer. The image data is currently provided as RGBA data, 4 bytes per pixel. + * A caller can provide null for the framebuffer or frameheader if not desired. Requesting the frame header first, followed by the frame buffer allows + * the caller to determine if the frame as advanced per the frame header sequence. + * If there is no frame available yet, due to initial camera spinup or re-activation, the error will be VRTrackedCameraError_NoFrameAvailable. + * Ideally a caller should be polling at ~16ms intervals */ + virtual vr::EVRTrackedCameraError GetVideoStreamFrameBuffer( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pFrameBuffer, uint32_t nFrameBufferSize, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; + + /** Gets size of the image frame. */ + virtual vr::EVRTrackedCameraError GetVideoStreamTextureSize( vr::TrackedDeviceIndex_t nDeviceIndex, vr::EVRTrackedCameraFrameType eFrameType, vr::VRTextureBounds_t *pTextureBounds, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Access a shared D3D11 texture for the specified tracked camera stream. + * The camera frame type VRTrackedCameraFrameType_Undistorted is not supported directly as a shared texture. It is an interior subregion of the shared texture VRTrackedCameraFrameType_MaximumUndistorted. + * Instead, use GetVideoStreamTextureSize() with VRTrackedCameraFrameType_Undistorted to determine the proper interior subregion bounds along with GetVideoStreamTextureD3D11() with + * VRTrackedCameraFrameType_MaximumUndistorted to provide the texture. The VRTrackedCameraFrameType_MaximumUndistorted will yield an image where the invalid regions are decoded + * by the alpha channel having a zero component. The valid regions all have a non-zero alpha component. The subregion as described by VRTrackedCameraFrameType_Undistorted + * guarantees a rectangle where all pixels are valid. */ + virtual vr::EVRTrackedCameraError GetVideoStreamTextureD3D11( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, void *pD3D11DeviceOrResource, void **ppD3D11ShaderResourceView, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; + + /** Access a shared GL texture for the specified tracked camera stream */ + virtual vr::EVRTrackedCameraError GetVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::EVRTrackedCameraFrameType eFrameType, vr::glUInt_t *pglTextureId, vr::CameraVideoStreamFrameHeader_t *pFrameHeader, uint32_t nFrameHeaderSize ) = 0; + virtual vr::EVRTrackedCameraError ReleaseVideoStreamTextureGL( vr::TrackedCameraHandle_t hTrackedCamera, vr::glUInt_t glTextureId ) = 0; + virtual void SetCameraTrackingSpace( vr::ETrackingUniverseOrigin eUniverse ) = 0; + virtual vr::ETrackingUniverseOrigin GetCameraTrackingSpace( ) = 0; +}; + +static const char * const IVRTrackedCamera_Version = "IVRTrackedCamera_006"; + +} // namespace vr + + +// ivrscreenshots.h + +namespace vr +{ + +/** Errors that can occur with the VR compositor */ +enum EVRScreenshotError +{ + VRScreenshotError_None = 0, + VRScreenshotError_RequestFailed = 1, + VRScreenshotError_IncompatibleVersion = 100, + VRScreenshotError_NotFound = 101, + VRScreenshotError_BufferTooSmall = 102, + VRScreenshotError_ScreenshotAlreadyInProgress = 108, +}; + +/** Allows the application to generate screenshots */ +class IVRScreenshots +{ +public: + /** Request a screenshot of the requested type. + * A request of the VRScreenshotType_Stereo type will always + * work. Other types will depend on the underlying application + * support. + * The first file name is for the preview image and should be a + * regular screenshot (ideally from the left eye). The second + * is the VR screenshot in the correct format. They should be + * in the same aspect ratio. Formats per type: + * VRScreenshotType_Mono: the VR filename is ignored (can be + * nullptr), this is a normal flat single shot. + * VRScreenshotType_Stereo: The VR image should be a + * side-by-side with the left eye image on the left. + * VRScreenshotType_Cubemap: The VR image should be six square + * images composited horizontally. + * VRScreenshotType_StereoPanorama: above/below with left eye + * panorama being the above image. Image is typically square + * with the panorama being 2x horizontal. + * + * Note that the VR dashboard will call this function when + * the user presses the screenshot binding (currently System + * Button + Trigger). If Steam is running, the destination + * file names will be in %TEMP% and will be copied into + * Steam's screenshot library for the running application + * once SubmitScreenshot() is called. + * If Steam is not running, the paths will be in the user's + * documents folder under Documents\SteamVR\Screenshots. + * Other VR applications can call this to initiate a + * screenshot outside of user control. + * The destination file names do not need an extension, + * will be replaced with the correct one for the format + * which is currently .png. */ + virtual vr::EVRScreenshotError RequestScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, vr::EVRScreenshotType type, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; + + /** Called by the running VR application to indicate that it + * wishes to be in charge of screenshots. If the + * application does not call this, the Compositor will only + * support VRScreenshotType_Stereo screenshots that will be + * captured without notification to the running app. + * Once hooked your application will receive a + * VREvent_RequestScreenshot event when the user presses the + * buttons to take a screenshot. */ + virtual vr::EVRScreenshotError HookScreenshot( VR_ARRAY_COUNT( numTypes ) const vr::EVRScreenshotType *pSupportedTypes, int numTypes ) = 0; + + /** When your application receives a + * VREvent_RequestScreenshot event, call these functions to get + * the details of the screenshot request. */ + virtual vr::EVRScreenshotType GetScreenshotPropertyType( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotError *pError ) = 0; + + /** Get the filename for the preview or vr image (see + * vr::EScreenshotPropertyFilenames). The return value is + * the size of the string. */ + virtual uint32_t GetScreenshotPropertyFilename( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotPropertyFilenames filenameType, VR_OUT_STRING() char *pchFilename, uint32_t cchFilename, vr::EVRScreenshotError *pError ) = 0; + + /** Call this if the application is taking the screen shot + * will take more than a few ms processing. This will result + * in an overlay being presented that shows a completion + * bar. */ + virtual vr::EVRScreenshotError UpdateScreenshotProgress( vr::ScreenshotHandle_t screenshotHandle, float flProgress ) = 0; + + /** Tells the compositor to take an internal screenshot of + * type VRScreenshotType_Stereo. It will take the current + * submitted scene textures of the running application and + * write them into the preview image and a side-by-side file + * for the VR image. + * This is similar to request screenshot, but doesn't ever + * talk to the application, just takes the shot and submits. */ + virtual vr::EVRScreenshotError TakeStereoScreenshot( vr::ScreenshotHandle_t *pOutScreenshotHandle, const char *pchPreviewFilename, const char *pchVRFilename ) = 0; + + /** Submit the completed screenshot. If Steam is running + * this will call into the Steam client and upload the + * screenshot to the screenshots section of the library for + * the running application. If Steam is not running, this + * function will display a notification to the user that the + * screenshot was taken. The paths should be full paths with + * extensions. + * File paths should be absolute including extensions. + * screenshotHandle can be k_unScreenshotHandleInvalid if this + * was a new shot taking by the app to be saved and not + * initiated by a user (achievement earned or something) */ + virtual vr::EVRScreenshotError SubmitScreenshot( vr::ScreenshotHandle_t screenshotHandle, vr::EVRScreenshotType type, const char *pchSourcePreviewFilename, const char *pchSourceVRFilename ) = 0; +}; + +static const char * const IVRScreenshots_Version = "IVRScreenshots_001"; + +} // namespace vr + + + +// ivrresources.h + +namespace vr +{ + +class IVRResources +{ +public: + + // ------------------------------------ + // Shared Resource Methods + // ------------------------------------ + + /** Loads the specified resource into the provided buffer if large enough. + * Returns the size in bytes of the buffer required to hold the specified resource. */ + virtual uint32_t LoadSharedResource( const char *pchResourceName, char *pchBuffer, uint32_t unBufferLen ) = 0; + + /** Provides the full path to the specified resource. Resource names can include named directories for + * drivers and other things, and this resolves all of those and returns the actual physical path. + * pchResourceTypeDirectory is the subdirectory of resources to look in. */ + virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0; +}; + +static const char * const IVRResources_Version = "IVRResources_001"; + + +} + +// ivrdrivermanager.h + +namespace vr +{ + +class IVRDriverManager +{ +public: + virtual uint32_t GetDriverCount() const = 0; + + /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */ + virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + + virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0; + + virtual bool IsEnabled( vr::DriverId_t nDriver ) const = 0; +}; + +static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; + +} // namespace vr + + + +// ivrinput.h + +namespace vr +{ + // Maximum number of characters in an action name, including the trailing null + static const uint32_t k_unMaxActionNameLength = 64; + + // Maximum number of characters in an action set name, including the trailing null + static const uint32_t k_unMaxActionSetNameLength = 64; + + // Maximum number of origins for an action + static const uint32_t k_unMaxActionOriginCount = 16; + + // Maximum number of characters in a bone name, including the trailing null + static const uint32_t k_unMaxBoneNameLength = 32; + + enum EVRSkeletalTransformSpace + { + VRSkeletalTransformSpace_Model = 0, + VRSkeletalTransformSpace_Parent = 1 + }; + + enum EVRSkeletalReferencePose + { + VRSkeletalReferencePose_BindPose = 0, + VRSkeletalReferencePose_OpenHand, + VRSkeletalReferencePose_Fist, + VRSkeletalReferencePose_GripLimit + }; + + enum EVRFinger + { + VRFinger_Thumb = 0, + VRFinger_Index, + VRFinger_Middle, + VRFinger_Ring, + VRFinger_Pinky, + VRFinger_Count + }; + + enum EVRFingerSplay + { + VRFingerSplay_Thumb_Index = 0, + VRFingerSplay_Index_Middle, + VRFingerSplay_Middle_Ring, + VRFingerSplay_Ring_Pinky, + VRFingerSplay_Count + }; + + enum EVRSummaryType + { + // The skeletal summary data will match the animated bone transforms for the action. + VRSummaryType_FromAnimation = 0, + + // The skeletal summary data will include unprocessed data directly from the device when available. + // This data is generally less latent than the data that is computed from the animations. + VRSummaryType_FromDevice = 1, + }; + + enum EVRInputFilterCancelType + { + VRInputFilterCancel_Timers = 0, + VRInputFilterCancel_Momentum = 1, + }; + + enum EVRInputStringBits + { + VRInputString_Hand = 0x01, + VRInputString_ControllerType = 0x02, + VRInputString_InputSource = 0x04, + + VRInputString_All = 0xFFFFFFFF + }; + + struct InputAnalogActionData_t + { + /** Whether or not this action is currently available to be bound in the active action set */ + bool bActive; + + /** The origin that caused this action's current state */ + VRInputValueHandle_t activeOrigin; + + /** The current state of this action; will be delta updates for mouse actions */ + float x, y, z; + + /** Deltas since the previous call to UpdateActionState() */ + float deltaX, deltaY, deltaZ; + + /** Time relative to now when this event happened. Will be negative to indicate a past time. */ + float fUpdateTime; + }; + + struct InputDigitalActionData_t + { + /** Whether or not this action is currently available to be bound in the active action set */ + bool bActive; + + /** The origin that caused this action's current state */ + VRInputValueHandle_t activeOrigin; + + /** The current state of this action; will be true if currently pressed */ + bool bState; + + /** This is true if the state has changed since the last frame */ + bool bChanged; + + /** Time relative to now when this event happened. Will be negative to indicate a past time. */ + float fUpdateTime; + }; + + struct InputPoseActionData_t + { + /** Whether or not this action is currently available to be bound in the active action set */ + bool bActive; + + /** The origin that caused this action's current state */ + VRInputValueHandle_t activeOrigin; + + /** The current state of this action */ + TrackedDevicePose_t pose; + }; + + struct InputSkeletalActionData_t + { + /** Whether or not this action is currently available to be bound in the active action set */ + bool bActive; + + /** The origin that caused this action's current state */ + VRInputValueHandle_t activeOrigin; + }; + + struct InputOriginInfo_t + { + VRInputValueHandle_t devicePath; + TrackedDeviceIndex_t trackedDeviceIndex; + char rchRenderModelComponentName[128]; + }; + + struct InputBindingInfo_t + { + char rchDevicePathName[128]; + char rchInputPathName[128]; + char rchModeName[128]; + char rchSlotName[128]; + char rchInputSourceType[ 32 ]; + }; + + // * Experimental global action set priority * + // These constants are part of the experimental support in SteamVR for overlay + // apps selectively overriding input in the base scene application. This may be + // useful for overlay applications that need to use part or all of a controller + // without taking away all input to the game. This system must be enabled by the + // "Experimental overlay input overrides" setting in the developer section of + // SteamVR settings. + // + // To use this system, set the nPriority field of an action set to any number in + // this range. + static const int32_t k_nActionSetOverlayGlobalPriorityMin = 0x01000000; + static const int32_t k_nActionSetOverlayGlobalPriorityMax = 0x01FFFFFF; + + static const int32_t k_nActionSetPriorityReservedMin = 0x02000000; + + struct VRActiveActionSet_t + { + /** This is the handle of the action set to activate for this frame. */ + VRActionSetHandle_t ulActionSet; + + /** This is the handle of a device path that this action set should be active for. To + * activate for all devices, set this to k_ulInvalidInputValueHandle. */ + VRInputValueHandle_t ulRestrictedToDevice; + + /** The action set to activate for all devices other than ulRestrictedDevice. If + * ulRestrictedToDevice is set to k_ulInvalidInputValueHandle, this parameter is + * ignored. */ + VRActionSetHandle_t ulSecondaryActionSet; + + // This field is ignored + uint32_t unPadding; + + /** The priority of this action set relative to other action sets. Any inputs + * bound to a source (e.g. trackpad, joystick, trigger) will disable bindings in + * other active action sets with a smaller priority. + * + * Overlay applications (i.e. ApplicationType_Overlay) may set their action set priority + * to a value between k_nActionSetOverlayGlobalPriorityMin and k_nActionSetOverlayGlobalPriorityMax + * to cause any inputs bound to a source used by that action set to be disabled in scene applications. + * + * No action set priority may value may be larger than k_nActionSetPriorityReservedMin + */ + int32_t nPriority; + }; + + /** Contains summary information about the current skeletal pose */ + struct VRSkeletalSummaryData_t + { + /** The amount that each finger is 'curled' inwards towards the palm. In the case of the thumb, + * this represents how much the thumb is wrapped around the fist. + * 0 means straight, 1 means fully curled */ + float flFingerCurl[ VRFinger_Count ]; + + /** The amount that each pair of adjacent fingers are separated. + * 0 means the digits are touching, 1 means they are fully separated. + */ + float flFingerSplay[ VRFingerSplay_Count ]; + }; + + + class IVRInput + { + public: + + // --------------- Handle management --------------- // + + /** Sets the path to the action manifest JSON file that is used by this application. If this information + * was set on the Steam partner site, calls to this function are ignored. If the Steam partner site + * setting and the path provided by this call are different, VRInputError_MismatchedActionManifest is returned. + * This call must be made before the first call to UpdateActionState or IVRSystem::PollNextEvent. */ + virtual EVRInputError SetActionManifestPath( const char *pchActionManifestPath ) = 0; + + /** Returns a handle for an action set. This handle is used for all performance-sensitive calls. */ + virtual EVRInputError GetActionSetHandle( const char *pchActionSetName, VRActionSetHandle_t *pHandle ) = 0; + + /** Returns a handle for an action. This handle is used for all performance-sensitive calls. */ + virtual EVRInputError GetActionHandle( const char *pchActionName, VRActionHandle_t *pHandle ) = 0; + + /** Returns a handle for any path in the input system. E.g. /user/hand/right */ + virtual EVRInputError GetInputSourceHandle( const char *pchInputSourcePath, VRInputValueHandle_t *pHandle ) = 0; + + + + // --------------- Reading action state ------------------- // + + /** Reads the current state into all actions. After this call, the results of Get*Action calls + * will be the same until the next call to UpdateActionState. */ + virtual EVRInputError UpdateActionState( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount ) = 0; + + /** Reads the state of a digital action given its handle. This will return VRInputError_WrongType if the type of + * action is something other than digital */ + virtual EVRInputError GetDigitalActionData( VRActionHandle_t action, InputDigitalActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + /** Reads the state of an analog action given its handle. This will return VRInputError_WrongType if the type of + * action is something other than analog */ + virtual EVRInputError GetAnalogActionData( VRActionHandle_t action, InputAnalogActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + /** Reads the state of a pose action given its handle for the number of seconds relative to now. This + * will generally be called with negative times from the fUpdateTime fields in other actions. */ + virtual EVRInputError GetPoseActionDataRelativeToNow( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + /** Reads the state of a pose action given its handle. The returned values will match the values returned + * by the last call to IVRCompositor::WaitGetPoses(). */ + virtual EVRInputError GetPoseActionDataForNextFrame( VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, InputPoseActionData_t *pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + /** Reads the state of a skeletal action given its handle. */ + virtual EVRInputError GetSkeletalActionData( VRActionHandle_t action, InputSkeletalActionData_t *pActionData, uint32_t unActionDataSize ) = 0; + + /** Returns the current dominant hand for the user for this application. This function will only return success for applications + * which include "supports_dominant_hand_setting": true in their action manifests. The dominant hand will only change after + * a call to UpdateActionState, and the action data returned after that point will use the new dominant hand. */ + virtual EVRInputError GetDominantHand( ETrackedControllerRole *peDominantHand ) = 0; + + /** Sets the dominant hand for the user for this application. */ + virtual EVRInputError SetDominantHand( ETrackedControllerRole eDominantHand ) = 0; + + // --------------- Static Skeletal Data ------------------- // + + /** Reads the number of bones in skeleton associated with the given action */ + virtual EVRInputError GetBoneCount( VRActionHandle_t action, uint32_t* pBoneCount ) = 0; + + /** Fills the given array with the index of each bone's parent in the skeleton associated with the given action */ + virtual EVRInputError GetBoneHierarchy( VRActionHandle_t action, VR_ARRAY_COUNT( unIndexArayCount ) BoneIndex_t* pParentIndices, uint32_t unIndexArayCount ) = 0; + + /** Fills the given buffer with the name of the bone at the given index in the skeleton associated with the given action */ + virtual EVRInputError GetBoneName( VRActionHandle_t action, BoneIndex_t nBoneIndex, VR_OUT_STRING() char* pchBoneName, uint32_t unNameBufferSize ) = 0; + + /** Fills the given buffer with the transforms for a specific static skeletal reference pose */ + virtual EVRInputError GetSkeletalReferenceTransforms( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; + + /** Reads the level of accuracy to which the controller is able to track the user to recreate a skeletal pose */ + virtual EVRInputError GetSkeletalTrackingLevel( VRActionHandle_t action, EVRSkeletalTrackingLevel* pSkeletalTrackingLevel ) = 0; + + // --------------- Dynamic Skeletal Data ------------------- // + + /** Reads the state of the skeletal bone data associated with this action and copies it into the given buffer. */ + virtual EVRInputError GetSkeletalBoneData( VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; + + /** Reads summary information about the current pose of the skeleton associated with the given action. */ + virtual EVRInputError GetSkeletalSummaryData( VRActionHandle_t action, EVRSummaryType eSummaryType, VRSkeletalSummaryData_t * pSkeletalSummaryData ) = 0; + + /** Reads the state of the skeletal bone data in a compressed form that is suitable for + * sending over the network. The required buffer size will never exceed ( sizeof(VR_BoneTransform_t)*boneCount + 2). + * Usually the size will be much smaller. */ + virtual EVRInputError GetSkeletalBoneDataCompressed( VRActionHandle_t action, EVRSkeletalMotionRange eMotionRange, VR_OUT_BUFFER_COUNT( unCompressedSize ) void *pvCompressedData, uint32_t unCompressedSize, uint32_t *punRequiredCompressedSize ) = 0; + + /** Turns a compressed buffer from GetSkeletalBoneDataCompressed and turns it back into a bone transform array. */ + virtual EVRInputError DecompressSkeletalBoneData( const void *pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, VR_ARRAY_COUNT( unTransformArrayCount ) VRBoneTransform_t *pTransformArray, uint32_t unTransformArrayCount ) = 0; + + // --------------- Haptics ------------------- // + + /** Triggers a haptic event as described by the specified action */ + virtual EVRInputError TriggerHapticVibrationAction( VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice ) = 0; + + // --------------- Action Origins ---------------- // + + /** Retrieve origin handles for an action */ + virtual EVRInputError GetActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VR_ARRAY_COUNT( originOutCount ) VRInputValueHandle_t *originsOut, uint32_t originOutCount ) = 0; + + /** Retrieves the name of the origin in the current language. unStringSectionsToInclude is a bitfield of values in EVRInputStringBits that allows the + application to specify which parts of the origin's information it wants a string for. */ + virtual EVRInputError GetOriginLocalizedName( VRInputValueHandle_t origin, VR_OUT_STRING() char *pchNameArray, uint32_t unNameArraySize, int32_t unStringSectionsToInclude ) = 0; + + /** Retrieves useful information for the origin of this action */ + virtual EVRInputError GetOriginTrackedDeviceInfo( VRInputValueHandle_t origin, InputOriginInfo_t *pOriginInfo, uint32_t unOriginInfoSize ) = 0; + + /** Retrieves useful information about the bindings for an action */ + virtual EVRInputError GetActionBindingInfo( VRActionHandle_t action, InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, uint32_t *punReturnedBindingInfoCount ) = 0; + + /** Shows the current binding for the action in-headset */ + virtual EVRInputError ShowActionOrigins( VRActionSetHandle_t actionSetHandle, VRActionHandle_t ulActionHandle ) = 0; + + /** Shows the current binding all the actions in the specified action sets */ + virtual EVRInputError ShowBindingsForActionSet( VR_ARRAY_COUNT( unSetCount ) VRActiveActionSet_t *pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight ) = 0; + + /** Use this to query what action on the component returned by GetOriginTrackedDeviceInfo would trigger this binding. */ + virtual EVRInputError GetComponentStateForBinding( const char *pchRenderModelName, const char *pchComponentName, + const InputBindingInfo_t *pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, + vr::RenderModel_ComponentState_t *pComponentState ) = 0; + + + // --------------- Legacy Input ------------------- // + virtual bool IsUsingLegacyInput() = 0; + + + // --------------- Utilities ------------------- // + + /** Opens the binding user interface. If no app key is provided it will use the key from the calling process. + * If no set is provided it will open to the root of the app binding page. */ + virtual EVRInputError OpenBindingUI( const char* pchAppKey, VRActionSetHandle_t ulActionSetHandle, VRInputValueHandle_t ulDeviceHandle, bool bShowOnDesktop ) = 0; + + /** Returns the variant set in the current bindings. If the binding doesn't include a variant setting, this function + * will return an empty string */ + virtual EVRInputError GetBindingVariant( vr::VRInputValueHandle_t ulDevicePath, + VR_OUT_STRING() char *pchVariantArray, uint32_t unVariantArraySize ) = 0; + + }; + + static const char * const IVRInput_Version = "IVRInput_010"; + +} // namespace vr + +// ivriobuffer.h + +namespace vr +{ + +typedef uint64_t IOBufferHandle_t; +static const uint64_t k_ulInvalidIOBufferHandle = 0; + + enum EIOBufferError + { + IOBuffer_Success = 0, + IOBuffer_OperationFailed = 100, + IOBuffer_InvalidHandle = 101, + IOBuffer_InvalidArgument = 102, + IOBuffer_PathExists = 103, + IOBuffer_PathDoesNotExist = 104, + IOBuffer_Permission = 105, + }; + + enum EIOBufferMode + { + IOBufferMode_Read = 0x0001, + IOBufferMode_Write = 0x0002, + IOBufferMode_Create = 0x0200, + }; + + // ---------------------------------------------------------------------------------------------- + // Purpose: + // ---------------------------------------------------------------------------------------------- + class IVRIOBuffer + { + public: + /** opens an existing or creates a new IOBuffer of unSize bytes */ + virtual vr::EIOBufferError Open( const char *pchPath, vr::EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, vr::IOBufferHandle_t *pulBuffer ) = 0; + + /** closes a previously opened or created buffer */ + virtual vr::EIOBufferError Close( vr::IOBufferHandle_t ulBuffer ) = 0; + + /** reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead */ + virtual vr::EIOBufferError Read( vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead ) = 0; + + /** writes unBytes of data from *pSrc into a buffer. */ + virtual vr::EIOBufferError Write( vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes ) = 0; + + /** retrieves the property container of an buffer. */ + virtual vr::PropertyContainerHandle_t PropertyContainer( vr::IOBufferHandle_t ulBuffer ) = 0; + + /** inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and writes. */ + virtual bool HasReaders( vr::IOBufferHandle_t ulBuffer ) = 0; + }; + + static const char *IVRIOBuffer_Version = "IVRIOBuffer_002"; +} + +// ivrspatialanchors.h + +namespace vr +{ + static const SpatialAnchorHandle_t k_ulInvalidSpatialAnchorHandle = 0; + + struct SpatialAnchorPose_t + { + HmdMatrix34_t mAnchorToAbsoluteTracking; + }; + + class IVRSpatialAnchors + { + public: + + /** Returns a handle for an spatial anchor described by "descriptor". On success, pHandle + * will contain a handle valid for this session. Caller can wait for an event or occasionally + * poll GetSpatialAnchorPose() to find the virtual coordinate associated with this anchor. */ + virtual EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor( const char *pchDescriptor, SpatialAnchorHandle_t *pHandleOut ) = 0; + + /** Returns a handle for an new spatial anchor at pPose. On success, pHandle + * will contain a handle valid for this session. Caller can wait for an event or occasionally + * poll GetSpatialAnchorDescriptor() to find the permanent descriptor for this pose. + * The result of GetSpatialAnchorPose() may evolve from this initial position if the driver chooses + * to update it. + * The anchor will be associated with the driver that provides unDeviceIndex, and the driver may use that specific + * device as a hint for how to best create the anchor. + * The eOrigin must match whatever tracking origin you are working in (seated/standing/raw). + * This should be called when the user is close to (and ideally looking at/interacting with) the target physical + * location. At that moment, the driver will have the most information about how to recover that physical point + * in the future, and the quality of the anchor (when the descriptor is re-used) will be highest. + * The caller may decide to apply offsets from this initial pose, but is advised to stay relatively close to the + * original pose location for highest fidelity. */ + virtual EVRSpatialAnchorError CreateSpatialAnchorFromPose( TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPose, SpatialAnchorHandle_t *pHandleOut ) = 0; + + /** Get the pose for a given handle. This is intended to be cheap enough to call every frame (or fairly often) + * so that the driver can refine this position when it has more information available. */ + virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, SpatialAnchorPose_t *pPoseOut ) = 0; + + /** Get the descriptor for a given handle. This will be empty for handles where the driver has not + * yet built a descriptor. It will be the application-supplied descriptor for previously saved anchors + * that the application is requesting poses for. If the driver has called UpdateSpatialAnchorDescriptor() + * already in this session, it will be the descriptor provided by the driver. + * Returns true if the descriptor fits into the buffer, else false. Buffer size should be at least + * k_unMaxSpatialAnchorDescriptorSize. */ + virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut ) = 0; + + }; + + static const char * const IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; + +} // namespace vr + +// ivrdebug.h + +namespace vr +{ + enum EVRDebugError + { + VRDebugError_Success = 0, + VRDebugError_BadParameter + }; + + /** Handle for vr profiler events */ + typedef uint64_t VrProfilerEventHandle_t; + + class IVRDebug + { + public: + + /** Create a vr profiler discrete event (point) + * The event will be associated with the message provided in pchMessage, and the current + * time will be used as the event timestamp. */ + virtual EVRDebugError EmitVrProfilerEvent( const char *pchMessage ) = 0; + + /** Create an vr profiler duration event (line) + * The current time will be used as the timestamp for the start of the line. + * On success, pHandleOut will contain a handle valid for terminating this event. */ + virtual EVRDebugError BeginVrProfilerEvent( VrProfilerEventHandle_t *pHandleOut ) = 0; + + /** Terminate a vr profiler event + * The event associated with hHandle will be considered completed when this method is called. + * The current time will be used assocaited to the termination time of the event, and + * pchMessage will be used as the event title. */ + virtual EVRDebugError FinishVrProfilerEvent( VrProfilerEventHandle_t hHandle, const char *pchMessage ) = 0; + + /** Sends a request to the driver for the specified device and returns the response. The maximum response size is 32k, + * but this method can be called with a smaller buffer. If the response exceeds the size of the buffer, it is truncated. + * The size of the response including its terminating null is returned. */ + virtual uint32_t DriverDebugRequest( vr::TrackedDeviceIndex_t unDeviceIndex, const char *pchRequest, VR_OUT_STRING() char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0; + + }; + + static const char * const IVRDebug_Version = "IVRDebug_001"; + +} // namespace vr +// End + +#endif // _OPENVR_API + + + +namespace vr +{ +#if !defined( OPENVR_INTERFACE_INTERNAL ) + + /** Finds the active installation of the VR API and initializes it. The provided path must be absolute + * or relative to the current working directory. These are the local install versions of the equivalent + * functions in steamvr.h and will work without a local Steam install. + * + * This path is to the "root" of the VR API install. That's the directory with + * the "drivers" directory and a platform (i.e. "win32") directory in it, not the directory with the DLL itself. + * + * pStartupInfo is reserved for future use. + */ + inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo = nullptr ); + + /** unloads vrclient.dll. Any interface pointers from the interface are + * invalid after this point */ + inline void VR_Shutdown(); + + /** Returns true if there is an HMD attached. This check is as lightweight as possible and + * can be called outside of VR_Init/VR_Shutdown. It should be used when an application wants + * to know if initializing VR is a possibility but isn't ready to take that step yet. + */ + VR_INTERFACE bool VR_CALLTYPE VR_IsHmdPresent(); + + /** Returns true if the OpenVR runtime is installed. */ + VR_INTERFACE bool VR_CALLTYPE VR_IsRuntimeInstalled(); + + /** Returns where the OpenVR runtime is installed. */ + VR_INTERFACE bool VR_GetRuntimePath( VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferSize, uint32_t *punRequiredBufferSize ); + + /** Returns the name of the enum value for an EVRInitError. This function may be called outside of VR_Init()/VR_Shutdown(). */ + VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsSymbol( EVRInitError error ); + + /** Returns an English string for an EVRInitError. Applications should call VR_GetVRInitErrorAsSymbol instead and + * use that as a key to look up their own localized error message. This function may be called outside of VR_Init()/VR_Shutdown(). */ + VR_INTERFACE const char *VR_CALLTYPE VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ); + + /** Returns the interface of the specified version. This method must be called after VR_Init. The + * pointer returned is valid until VR_Shutdown is called. + */ + VR_INTERFACE void *VR_CALLTYPE VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError ); + + /** Returns whether the interface of the specified version exists. + */ + VR_INTERFACE bool VR_CALLTYPE VR_IsInterfaceVersionValid( const char *pchInterfaceVersion ); + + /** Returns a token that represents whether the VR interface handles need to be reloaded */ + VR_INTERFACE uint32_t VR_CALLTYPE VR_GetInitToken(); + + // These typedefs allow old enum names from SDK 0.9.11 to be used in applications. + // They will go away in the future. + typedef EVRInitError HmdError; + typedef EVREye Hmd_Eye; + typedef EColorSpace ColorSpace; + typedef ETrackingResult HmdTrackingResult; + typedef ETrackedDeviceClass TrackedDeviceClass; + typedef ETrackingUniverseOrigin TrackingUniverseOrigin; + typedef ETrackedDeviceProperty TrackedDeviceProperty; + typedef ETrackedPropertyError TrackedPropertyError; + typedef EVRSubmitFlags VRSubmitFlags_t; + typedef EVRState VRState_t; + typedef ECollisionBoundsStyle CollisionBoundsStyle_t; + typedef EVROverlayError VROverlayError; + typedef EVRFirmwareError VRFirmwareError; + typedef EVRCompositorError VRCompositorError; + typedef EVRScreenshotError VRScreenshotsError; + + inline uint32_t &VRToken() + { + static uint32_t token; + return token; + } + + class COpenVRContext + { + public: + COpenVRContext() { Clear(); } + void Clear(); + + inline void CheckClear() + { + if ( VRToken() != VR_GetInitToken() ) + { + Clear(); + VRToken() = VR_GetInitToken(); + } + } + + IVRSystem *VRSystem() + { + CheckClear(); + if ( m_pVRSystem == nullptr ) + { + EVRInitError eError; + m_pVRSystem = ( IVRSystem * )VR_GetGenericInterface( IVRSystem_Version, &eError ); + } + return m_pVRSystem; + } + IVRChaperone *VRChaperone() + { + CheckClear(); + if ( m_pVRChaperone == nullptr ) + { + EVRInitError eError; + m_pVRChaperone = ( IVRChaperone * )VR_GetGenericInterface( IVRChaperone_Version, &eError ); + } + return m_pVRChaperone; + } + + IVRChaperoneSetup *VRChaperoneSetup() + { + CheckClear(); + if ( m_pVRChaperoneSetup == nullptr ) + { + EVRInitError eError; + m_pVRChaperoneSetup = ( IVRChaperoneSetup * )VR_GetGenericInterface( IVRChaperoneSetup_Version, &eError ); + } + return m_pVRChaperoneSetup; + } + + IVRCompositor *VRCompositor() + { + CheckClear(); + if ( m_pVRCompositor == nullptr ) + { + EVRInitError eError; + m_pVRCompositor = ( IVRCompositor * )VR_GetGenericInterface( IVRCompositor_Version, &eError ); + } + return m_pVRCompositor; + } + + IVROverlay *VROverlay() + { + CheckClear(); + if ( m_pVROverlay == nullptr ) + { + EVRInitError eError; + m_pVROverlay = ( IVROverlay * )VR_GetGenericInterface( IVROverlay_Version, &eError ); + } + return m_pVROverlay; + } + + IVROverlayView *VROverlayView() + { + CheckClear(); + if ( m_pVROverlayView == nullptr ) + { + EVRInitError eError; + m_pVROverlayView = ( IVROverlayView * ) VR_GetGenericInterface( IVROverlayView_Version, &eError ); + } + return m_pVROverlayView; + } + + IVRHeadsetView *VRHeadsetView() + { + CheckClear(); + if ( m_pVRHeadsetView == nullptr ) + { + EVRInitError eError; + m_pVRHeadsetView = ( IVRHeadsetView * ) VR_GetGenericInterface( IVRHeadsetView_Version, &eError ); + } + return m_pVRHeadsetView; + } + + IVRResources *VRResources() + { + CheckClear(); + if ( m_pVRResources == nullptr ) + { + EVRInitError eError; + m_pVRResources = (IVRResources *)VR_GetGenericInterface( IVRResources_Version, &eError ); + } + return m_pVRResources; + } + + IVRScreenshots *VRScreenshots() + { + CheckClear(); + if ( m_pVRScreenshots == nullptr ) + { + EVRInitError eError; + m_pVRScreenshots = ( IVRScreenshots * )VR_GetGenericInterface( IVRScreenshots_Version, &eError ); + } + return m_pVRScreenshots; + } + + IVRRenderModels *VRRenderModels() + { + CheckClear(); + if ( m_pVRRenderModels == nullptr ) + { + EVRInitError eError; + m_pVRRenderModels = ( IVRRenderModels * )VR_GetGenericInterface( IVRRenderModels_Version, &eError ); + } + return m_pVRRenderModels; + } + + IVRExtendedDisplay *VRExtendedDisplay() + { + CheckClear(); + if ( m_pVRExtendedDisplay == nullptr ) + { + EVRInitError eError; + m_pVRExtendedDisplay = ( IVRExtendedDisplay * )VR_GetGenericInterface( IVRExtendedDisplay_Version, &eError ); + } + return m_pVRExtendedDisplay; + } + + IVRSettings *VRSettings() + { + CheckClear(); + if ( m_pVRSettings == nullptr ) + { + EVRInitError eError; + m_pVRSettings = ( IVRSettings * )VR_GetGenericInterface( IVRSettings_Version, &eError ); + } + return m_pVRSettings; + } + + IVRApplications *VRApplications() + { + CheckClear(); + if ( m_pVRApplications == nullptr ) + { + EVRInitError eError; + m_pVRApplications = ( IVRApplications * )VR_GetGenericInterface( IVRApplications_Version, &eError ); + } + return m_pVRApplications; + } + + IVRTrackedCamera *VRTrackedCamera() + { + CheckClear(); + if ( m_pVRTrackedCamera == nullptr ) + { + EVRInitError eError; + m_pVRTrackedCamera = ( IVRTrackedCamera * )VR_GetGenericInterface( IVRTrackedCamera_Version, &eError ); + } + return m_pVRTrackedCamera; + } + + IVRDriverManager *VRDriverManager() + { + CheckClear(); + if ( !m_pVRDriverManager ) + { + EVRInitError eError; + m_pVRDriverManager = ( IVRDriverManager * )VR_GetGenericInterface( IVRDriverManager_Version, &eError ); + } + return m_pVRDriverManager; + } + + IVRInput *VRInput() + { + CheckClear(); + if ( !m_pVRInput ) + { + EVRInitError eError; + m_pVRInput = (IVRInput *)VR_GetGenericInterface( IVRInput_Version, &eError ); + } + return m_pVRInput; + } + + IVRIOBuffer *VRIOBuffer() + { + if ( !m_pVRIOBuffer ) + { + EVRInitError eError; + m_pVRIOBuffer = ( IVRIOBuffer * )VR_GetGenericInterface( IVRIOBuffer_Version, &eError ); + } + return m_pVRIOBuffer; + } + + IVRSpatialAnchors *VRSpatialAnchors() + { + CheckClear(); + if ( !m_pVRSpatialAnchors ) + { + EVRInitError eError; + m_pVRSpatialAnchors = (IVRSpatialAnchors *)VR_GetGenericInterface( IVRSpatialAnchors_Version, &eError ); + } + return m_pVRSpatialAnchors; + } + + IVRDebug *VRDebug() + { + CheckClear(); + if ( !m_pVRDebug ) + { + EVRInitError eError; + m_pVRDebug = (IVRDebug *)VR_GetGenericInterface( IVRDebug_Version, &eError ); + } + return m_pVRDebug; + } + + IVRNotifications *VRNotifications() + { + CheckClear(); + if ( !m_pVRNotifications ) + { + EVRInitError eError; + m_pVRNotifications = ( IVRNotifications * )VR_GetGenericInterface( IVRNotifications_Version, &eError ); + } + return m_pVRNotifications; + } + + private: + IVRSystem *m_pVRSystem; + IVRChaperone *m_pVRChaperone; + IVRChaperoneSetup *m_pVRChaperoneSetup; + IVRCompositor *m_pVRCompositor; + IVRHeadsetView *m_pVRHeadsetView; + IVROverlay *m_pVROverlay; + IVROverlayView *m_pVROverlayView; + IVRResources *m_pVRResources; + IVRRenderModels *m_pVRRenderModels; + IVRExtendedDisplay *m_pVRExtendedDisplay; + IVRSettings *m_pVRSettings; + IVRApplications *m_pVRApplications; + IVRTrackedCamera *m_pVRTrackedCamera; + IVRScreenshots *m_pVRScreenshots; + IVRDriverManager *m_pVRDriverManager; + IVRInput *m_pVRInput; + IVRIOBuffer *m_pVRIOBuffer; + IVRSpatialAnchors *m_pVRSpatialAnchors; + IVRDebug *m_pVRDebug; + IVRNotifications *m_pVRNotifications; + }; + + inline COpenVRContext &OpenVRInternal_ModuleContext() + { + static void *ctx[ sizeof( COpenVRContext ) / sizeof( void * ) ]; + return *( COpenVRContext * )ctx; // bypass zero-init constructor + } + + inline IVRSystem *VR_CALLTYPE VRSystem() { return OpenVRInternal_ModuleContext().VRSystem(); } + inline IVRChaperone *VR_CALLTYPE VRChaperone() { return OpenVRInternal_ModuleContext().VRChaperone(); } + inline IVRChaperoneSetup *VR_CALLTYPE VRChaperoneSetup() { return OpenVRInternal_ModuleContext().VRChaperoneSetup(); } + inline IVRCompositor *VR_CALLTYPE VRCompositor() { return OpenVRInternal_ModuleContext().VRCompositor(); } + inline IVROverlay *VR_CALLTYPE VROverlay() { return OpenVRInternal_ModuleContext().VROverlay(); } + inline IVROverlayView *VR_CALLTYPE VROverlayView() { return OpenVRInternal_ModuleContext().VROverlayView(); } + inline IVRHeadsetView *VR_CALLTYPE VRHeadsetView() { return OpenVRInternal_ModuleContext().VRHeadsetView(); } + inline IVRScreenshots *VR_CALLTYPE VRScreenshots() { return OpenVRInternal_ModuleContext().VRScreenshots(); } + inline IVRRenderModels *VR_CALLTYPE VRRenderModels() { return OpenVRInternal_ModuleContext().VRRenderModels(); } + inline IVRApplications *VR_CALLTYPE VRApplications() { return OpenVRInternal_ModuleContext().VRApplications(); } + inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleContext().VRSettings(); } + inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleContext().VRResources(); } + inline IVRExtendedDisplay *VR_CALLTYPE VRExtendedDisplay() { return OpenVRInternal_ModuleContext().VRExtendedDisplay(); } + inline IVRTrackedCamera *VR_CALLTYPE VRTrackedCamera() { return OpenVRInternal_ModuleContext().VRTrackedCamera(); } + inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleContext().VRDriverManager(); } + inline IVRInput *VR_CALLTYPE VRInput() { return OpenVRInternal_ModuleContext().VRInput(); } + inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleContext().VRIOBuffer(); } + inline IVRSpatialAnchors *VR_CALLTYPE VRSpatialAnchors() { return OpenVRInternal_ModuleContext().VRSpatialAnchors(); } + inline IVRNotifications *VR_CALLTYPE VRNotifications() { return OpenVRInternal_ModuleContext().VRNotifications(); } + inline IVRDebug *VR_CALLTYPE VRDebug() { return OpenVRInternal_ModuleContext().VRDebug(); } + + inline void COpenVRContext::Clear() + { + m_pVRSystem = nullptr; + m_pVRChaperone = nullptr; + m_pVRChaperoneSetup = nullptr; + m_pVRCompositor = nullptr; + m_pVROverlay = nullptr; + m_pVROverlayView = nullptr; + m_pVRHeadsetView = nullptr; + m_pVRRenderModels = nullptr; + m_pVRExtendedDisplay = nullptr; + m_pVRSettings = nullptr; + m_pVRApplications = nullptr; + m_pVRTrackedCamera = nullptr; + m_pVRResources = nullptr; + m_pVRScreenshots = nullptr; + m_pVRDriverManager = nullptr; + m_pVRInput = nullptr; + m_pVRIOBuffer = nullptr; + m_pVRSpatialAnchors = nullptr; + m_pVRNotifications = nullptr; + m_pVRDebug = nullptr; + } + + VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal2( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ); + VR_INTERFACE void VR_CALLTYPE VR_ShutdownInternal(); + + /** Finds the active installation of vrclient.dll and initializes it */ + inline IVRSystem *VR_Init( EVRInitError *peError, EVRApplicationType eApplicationType, const char *pStartupInfo ) + { + IVRSystem *pVRSystem = nullptr; + + EVRInitError eError; + VRToken() = VR_InitInternal2( &eError, eApplicationType, pStartupInfo ); + COpenVRContext &ctx = OpenVRInternal_ModuleContext(); + ctx.Clear(); + + if ( eError == VRInitError_None ) + { + if ( VR_IsInterfaceVersionValid( IVRSystem_Version ) ) + { + pVRSystem = VRSystem(); + } + else + { + VR_ShutdownInternal(); + eError = VRInitError_Init_InterfaceNotFound; + } + } + + if ( peError ) + *peError = eError; + return pVRSystem; + } + + /** unloads vrclient.dll. Any interface pointers from the interface are + * invalid after this point */ + inline void VR_Shutdown() + { + VR_ShutdownInternal(); + } + +#endif // OPENVR_INTERFACE_INTERNAL +} diff --git a/contrib/openvr/headers/openvr_api.cs b/contrib/openvr/headers/openvr_api.cs new file mode 100755 index 0000000..4732b62 --- /dev/null +++ b/contrib/openvr/headers/openvr_api.cs @@ -0,0 +1,8220 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: This file contains C#/managed code bindings for the OpenVR interfaces +// This file is auto-generated, do not edit it. +// +//============================================================================= +#if !OPENVR_XR_API + +using System; +using System.Runtime.InteropServices; +using Valve.VR; + +#if UNITY_5_3_OR_NEWER +using UnityEngine; +#endif + +namespace Valve.VR +{ + +[StructLayout(LayoutKind.Sequential)] +public struct IVRSystem +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetRecommendedRenderTargetSize(ref uint pnWidth, ref uint pnHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRecommendedRenderTargetSize GetRecommendedRenderTargetSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdMatrix44_t _GetProjectionMatrix(EVREye eEye, float fNearZ, float fFarZ); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetProjectionMatrix GetProjectionMatrix; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetProjectionRaw(EVREye eEye, ref float pfLeft, ref float pfRight, ref float pfTop, ref float pfBottom); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetProjectionRaw GetProjectionRaw; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ComputeDistortion(EVREye eEye, float fU, float fV, ref DistortionCoordinates_t pDistortionCoordinates); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ComputeDistortion ComputeDistortion; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdMatrix34_t _GetEyeToHeadTransform(EVREye eEye); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetEyeToHeadTransform GetEyeToHeadTransform; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync, ref ulong pulFrameCounter); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTimeSinceLastVsync GetTimeSinceLastVsync; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate int _GetD3D9AdapterIndex(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetD3D9AdapterIndex GetD3D9AdapterIndex; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDXGIOutputInfo GetDXGIOutputInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetOutputDevice(ref ulong pnDevice, ETextureType textureType, IntPtr pInstance); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOutputDevice GetOutputDevice; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsDisplayOnDesktop(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsDisplayOnDesktop IsDisplayOnDesktop; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _SetDisplayVisibility(bool bIsVisibleOnDesktop); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetDisplayVisibility SetDisplayVisibility; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, [In, Out] TrackedDevicePose_t[] pTrackedDevicePoseArray, uint unTrackedDevicePoseArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDeviceToAbsoluteTrackingPose GetDeviceToAbsoluteTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdMatrix34_t _GetSeatedZeroPoseToStandingAbsoluteTrackingPose(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSeatedZeroPoseToStandingAbsoluteTrackingPose GetSeatedZeroPoseToStandingAbsoluteTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdMatrix34_t _GetRawZeroPoseToStandingAbsoluteTrackingPose(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRawZeroPoseToStandingAbsoluteTrackingPose GetRawZeroPoseToStandingAbsoluteTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass, [In, Out] uint[] punTrackedDeviceIndexArray, uint unTrackedDeviceIndexArrayCount, uint unRelativeToTrackedDeviceIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSortedTrackedDeviceIndicesOfClass GetSortedTrackedDeviceIndicesOfClass; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EDeviceActivityLevel _GetTrackedDeviceActivityLevel(uint unDeviceId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTrackedDeviceActivityLevel GetTrackedDeviceActivityLevel; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ApplyTransform(ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pTrackedDevicePose, ref HmdMatrix34_t pTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ApplyTransform ApplyTransform; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTrackedDeviceIndexForControllerRole GetTrackedDeviceIndexForControllerRole; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedControllerRole _GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetControllerRoleForTrackedDeviceIndex GetControllerRoleForTrackedDeviceIndex; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedDeviceClass _GetTrackedDeviceClass(uint unDeviceIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTrackedDeviceClass GetTrackedDeviceClass; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsTrackedDeviceConnected(uint unDeviceIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsTrackedDeviceConnected IsTrackedDeviceConnected; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetBoolTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBoolTrackedDeviceProperty GetBoolTrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate float _GetFloatTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetFloatTrackedDeviceProperty GetFloatTrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate int _GetInt32TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetInt32TrackedDeviceProperty GetInt32TrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _GetUint64TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetUint64TrackedDeviceProperty GetUint64TrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdMatrix34_t _GetMatrix34TrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetMatrix34TrackedDeviceProperty GetMatrix34TrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetArrayTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, uint propType, IntPtr pBuffer, uint unBufferSize, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetArrayTrackedDeviceProperty GetArrayTrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetStringTrackedDeviceProperty(uint unDeviceIndex, ETrackedDeviceProperty prop, System.Text.StringBuilder pchValue, uint unBufferSize, ref ETrackedPropertyError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetStringTrackedDeviceProperty GetStringTrackedDeviceProperty; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _PollNextEvent(ref VREvent_t pEvent, uint uncbVREvent); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PollNextEvent PollNextEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _PollNextEventWithPose(ETrackingUniverseOrigin eOrigin, ref VREvent_t pEvent, uint uncbVREvent, ref TrackedDevicePose_t pTrackedDevicePose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PollNextEventWithPose PollNextEventWithPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetEventTypeNameFromEnum(EVREventType eType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetEventTypeNameFromEnum GetEventTypeNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HiddenAreaMesh_t _GetHiddenAreaMesh(EVREye eEye, EHiddenAreaMeshType type); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHiddenAreaMesh GetHiddenAreaMesh; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetControllerState(uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetControllerState GetControllerState; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin, uint unControllerDeviceIndex, ref VRControllerState_t pControllerState, uint unControllerStateSize, ref TrackedDevicePose_t pTrackedDevicePose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetControllerStateWithPose GetControllerStateWithPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, ushort usDurationMicroSec); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _TriggerHapticPulse TriggerHapticPulse; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetButtonIdNameFromEnum(EVRButtonId eButtonId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetButtonIdNameFromEnum GetButtonIdNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetControllerAxisTypeNameFromEnum GetControllerAxisTypeNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsInputAvailable(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsInputAvailable IsInputAvailable; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsSteamVRDrawingControllers(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsSteamVRDrawingControllers IsSteamVRDrawingControllers; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ShouldApplicationPause(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShouldApplicationPause ShouldApplicationPause; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ShouldApplicationReduceRenderingWork(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShouldApplicationReduceRenderingWork ShouldApplicationReduceRenderingWork; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRFirmwareError _PerformFirmwareUpdate(uint unDeviceIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PerformFirmwareUpdate PerformFirmwareUpdate; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _AcknowledgeQuit_Exiting(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AcknowledgeQuit_Exiting AcknowledgeQuit_Exiting; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetAppContainerFilePaths(System.Text.StringBuilder pchBuffer, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetAppContainerFilePaths GetAppContainerFilePaths; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetRuntimeVersion(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRuntimeVersion GetRuntimeVersion; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRExtendedDisplay +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetWindowBounds(ref int pnX, ref int pnY, ref uint pnWidth, ref uint pnHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWindowBounds GetWindowBounds; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetEyeOutputViewport(EVREye eEye, ref uint pnX, ref uint pnY, ref uint pnWidth, ref uint pnHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetEyeOutputViewport GetEyeOutputViewport; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetDXGIOutputInfo(ref int pnAdapterIndex, ref int pnAdapterOutputIndex); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDXGIOutputInfo GetDXGIOutputInfo; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRTrackedCamera +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetCameraErrorNameFromEnum(EVRTrackedCameraError eCameraError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCameraErrorNameFromEnum GetCameraErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _HasCamera(uint nDeviceIndex, ref bool pHasCamera); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HasCamera HasCamera; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetCameraFrameSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref uint pnWidth, ref uint pnHeight, ref uint pnFrameBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCameraFrameSize GetCameraFrameSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetCameraIntrinsics(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, ref HmdVector2_t pFocalLength, ref HmdVector2_t pCenter); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCameraIntrinsics GetCameraIntrinsics; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetCameraProjection(uint nDeviceIndex, uint nCameraIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, ref HmdMatrix44_t pProjection); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCameraProjection GetCameraProjection; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _AcquireVideoStreamingService(uint nDeviceIndex, ref ulong pHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AcquireVideoStreamingService AcquireVideoStreamingService; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _ReleaseVideoStreamingService(ulong hTrackedCamera); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseVideoStreamingService ReleaseVideoStreamingService; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetVideoStreamFrameBuffer(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pFrameBuffer, uint nFrameBufferSize, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVideoStreamFrameBuffer GetVideoStreamFrameBuffer; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetVideoStreamTextureSize(uint nDeviceIndex, EVRTrackedCameraFrameType eFrameType, ref VRTextureBounds_t pTextureBounds, ref uint pnWidth, ref uint pnHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVideoStreamTextureSize GetVideoStreamTextureSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetVideoStreamTextureD3D11(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVideoStreamTextureD3D11 GetVideoStreamTextureD3D11; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _GetVideoStreamTextureGL(ulong hTrackedCamera, EVRTrackedCameraFrameType eFrameType, ref uint pglTextureId, ref CameraVideoStreamFrameHeader_t pFrameHeader, uint nFrameHeaderSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVideoStreamTextureGL GetVideoStreamTextureGL; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRTrackedCameraError _ReleaseVideoStreamTextureGL(ulong hTrackedCamera, uint glTextureId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseVideoStreamTextureGL ReleaseVideoStreamTextureGL; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetCameraTrackingSpace(ETrackingUniverseOrigin eUniverse); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetCameraTrackingSpace SetCameraTrackingSpace; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackingUniverseOrigin _GetCameraTrackingSpace(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCameraTrackingSpace GetCameraTrackingSpace; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRApplications +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _AddApplicationManifest(IntPtr pchApplicationManifestFullPath, bool bTemporary); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AddApplicationManifest AddApplicationManifest; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _RemoveApplicationManifest(IntPtr pchApplicationManifestFullPath); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RemoveApplicationManifest RemoveApplicationManifest; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsApplicationInstalled(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsApplicationInstalled IsApplicationInstalled; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetApplicationCount(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationCount GetApplicationCount; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _GetApplicationKeyByIndex(uint unApplicationIndex, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationKeyByIndex GetApplicationKeyByIndex; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _GetApplicationKeyByProcessId(uint unProcessId, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationKeyByProcessId GetApplicationKeyByProcessId; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _LaunchApplication(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LaunchApplication LaunchApplication; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _LaunchTemplateApplication(IntPtr pchTemplateAppKey, IntPtr pchNewAppKey, [In, Out] AppOverrideKeys_t[] pKeys, uint unKeys); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LaunchTemplateApplication LaunchTemplateApplication; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _LaunchApplicationFromMimeType(IntPtr pchMimeType, IntPtr pchArgs); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LaunchApplicationFromMimeType LaunchApplicationFromMimeType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _LaunchDashboardOverlay(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LaunchDashboardOverlay LaunchDashboardOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _CancelApplicationLaunch(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CancelApplicationLaunch CancelApplicationLaunch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _IdentifyApplication(uint unProcessId, IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IdentifyApplication IdentifyApplication; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetApplicationProcessId(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationProcessId GetApplicationProcessId; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetApplicationsErrorNameFromEnum(EVRApplicationError error); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationsErrorNameFromEnum GetApplicationsErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetApplicationPropertyString(IntPtr pchAppKey, EVRApplicationProperty eProperty, System.Text.StringBuilder pchPropertyValueBuffer, uint unPropertyValueBufferLen, ref EVRApplicationError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationPropertyString GetApplicationPropertyString; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetApplicationPropertyBool(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationPropertyBool GetApplicationPropertyBool; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _GetApplicationPropertyUint64(IntPtr pchAppKey, EVRApplicationProperty eProperty, ref EVRApplicationError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationPropertyUint64 GetApplicationPropertyUint64; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _SetApplicationAutoLaunch(IntPtr pchAppKey, bool bAutoLaunch); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetApplicationAutoLaunch SetApplicationAutoLaunch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetApplicationAutoLaunch(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationAutoLaunch GetApplicationAutoLaunch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _SetDefaultApplicationForMimeType(IntPtr pchAppKey, IntPtr pchMimeType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetDefaultApplicationForMimeType SetDefaultApplicationForMimeType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetDefaultApplicationForMimeType(IntPtr pchMimeType, System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDefaultApplicationForMimeType GetDefaultApplicationForMimeType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetApplicationSupportedMimeTypes(IntPtr pchAppKey, System.Text.StringBuilder pchMimeTypesBuffer, uint unMimeTypesBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationSupportedMimeTypes GetApplicationSupportedMimeTypes; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetApplicationsThatSupportMimeType(IntPtr pchMimeType, System.Text.StringBuilder pchAppKeysThatSupportBuffer, uint unAppKeysThatSupportBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationsThatSupportMimeType GetApplicationsThatSupportMimeType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetApplicationLaunchArguments(uint unHandle, System.Text.StringBuilder pchArgs, uint unArgs); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetApplicationLaunchArguments GetApplicationLaunchArguments; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _GetStartingApplication(System.Text.StringBuilder pchAppKeyBuffer, uint unAppKeyBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetStartingApplication GetStartingApplication; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSceneApplicationState _GetSceneApplicationState(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSceneApplicationState GetSceneApplicationState; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _PerformApplicationPrelaunchCheck(IntPtr pchAppKey); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PerformApplicationPrelaunchCheck PerformApplicationPrelaunchCheck; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetSceneApplicationStateNameFromEnum(EVRSceneApplicationState state); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSceneApplicationStateNameFromEnum GetSceneApplicationStateNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRApplicationError _LaunchInternalProcess(IntPtr pchBinaryPath, IntPtr pchArguments, IntPtr pchWorkingDirectory); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LaunchInternalProcess LaunchInternalProcess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetCurrentSceneProcessId(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCurrentSceneProcessId GetCurrentSceneProcessId; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRChaperone +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ChaperoneCalibrationState _GetCalibrationState(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCalibrationState GetCalibrationState; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetPlayAreaSize(ref float pSizeX, ref float pSizeZ); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPlayAreaSize GetPlayAreaSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetPlayAreaRect(ref HmdQuad_t rect); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPlayAreaRect GetPlayAreaRect; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ReloadInfo(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReloadInfo ReloadInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetSceneColor(HmdColor_t color); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetSceneColor SetSceneColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetBoundsColor(ref HmdColor_t pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, ref HmdColor_t pOutputCameraColor); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBoundsColor GetBoundsColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _AreBoundsVisible(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AreBoundsVisible AreBoundsVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ForceBoundsVisible(bool bForce); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ForceBoundsVisible ForceBoundsVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ResetZeroPose(ETrackingUniverseOrigin eTrackingUniverseOrigin); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ResetZeroPose ResetZeroPose; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRChaperoneSetup +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _CommitWorkingCopy(EChaperoneConfigFile configFile); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CommitWorkingCopy CommitWorkingCopy; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _RevertWorkingCopy(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RevertWorkingCopy RevertWorkingCopy; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetWorkingPlayAreaSize(ref float pSizeX, ref float pSizeZ); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWorkingPlayAreaSize GetWorkingPlayAreaSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetWorkingPlayAreaRect(ref HmdQuad_t rect); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWorkingPlayAreaRect GetWorkingPlayAreaRect; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetWorkingCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWorkingCollisionBoundsInfo GetWorkingCollisionBoundsInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetLiveCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, ref uint punQuadsCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLiveCollisionBoundsInfo GetLiveCollisionBoundsInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWorkingSeatedZeroPoseToRawTrackingPose GetWorkingSeatedZeroPoseToRawTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatStandingZeroPoseToRawTrackingPose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetWorkingStandingZeroPoseToRawTrackingPose GetWorkingStandingZeroPoseToRawTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetWorkingPlayAreaSize(float sizeX, float sizeZ); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetWorkingPlayAreaSize SetWorkingPlayAreaSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetWorkingCollisionBoundsInfo([In, Out] HmdQuad_t[] pQuadsBuffer, uint unQuadsCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetWorkingCollisionBoundsInfo SetWorkingCollisionBoundsInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetWorkingPerimeter([In, Out] HmdVector2_t[] pPointBuffer, uint unPointCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetWorkingPerimeter SetWorkingPerimeter; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatSeatedZeroPoseToRawTrackingPose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetWorkingSeatedZeroPoseToRawTrackingPose SetWorkingSeatedZeroPoseToRawTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatStandingZeroPoseToRawTrackingPose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetWorkingStandingZeroPoseToRawTrackingPose SetWorkingStandingZeroPoseToRawTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ReloadFromDisk(EChaperoneConfigFile configFile); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReloadFromDisk ReloadFromDisk; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetLiveSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLiveSeatedZeroPoseToRawTrackingPose GetLiveSeatedZeroPoseToRawTrackingPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ExportLiveToBuffer(System.Text.StringBuilder pBuffer, ref uint pnBufferLength); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ExportLiveToBuffer ExportLiveToBuffer; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ImportFromBufferToWorking(IntPtr pBuffer, uint nImportFlags); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ImportFromBufferToWorking ImportFromBufferToWorking; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ShowWorkingSetPreview(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowWorkingSetPreview ShowWorkingSetPreview; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _HideWorkingSetPreview(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HideWorkingSetPreview HideWorkingSetPreview; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _RoomSetupStarting(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RoomSetupStarting RoomSetupStarting; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRCompositor +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetTrackingSpace(ETrackingUniverseOrigin eOrigin); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetTrackingSpace SetTrackingSpace; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackingUniverseOrigin _GetTrackingSpace(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTrackingSpace GetTrackingSpace; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _WaitGetPoses([In, Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In, Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _WaitGetPoses WaitGetPoses; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetLastPoses([In, Out] TrackedDevicePose_t[] pRenderPoseArray, uint unRenderPoseArrayCount, [In, Out] TrackedDevicePose_t[] pGamePoseArray, uint unGamePoseArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLastPoses GetLastPoses; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex, ref TrackedDevicePose_t pOutputPose, ref TrackedDevicePose_t pOutputGamePose); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLastPoseForTrackedDeviceIndex GetLastPoseForTrackedDeviceIndex; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _Submit(EVREye eEye, ref Texture_t pTexture, ref VRTextureBounds_t pBounds, EVRSubmitFlags nSubmitFlags); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Submit Submit; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ClearLastSubmittedFrame(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ClearLastSubmittedFrame ClearLastSubmittedFrame; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _PostPresentHandoff(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PostPresentHandoff PostPresentHandoff; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetFrameTiming(ref Compositor_FrameTiming pTiming, uint unFramesAgo); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetFrameTiming GetFrameTiming; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetFrameTimings([In, Out] Compositor_FrameTiming[] pTiming, uint nFrames); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetFrameTimings GetFrameTimings; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate float _GetFrameTimeRemaining(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetFrameTimeRemaining GetFrameTimeRemaining; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetCumulativeStats(ref Compositor_CumulativeStats pStats, uint nStatsSizeInBytes); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCumulativeStats GetCumulativeStats; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _FadeToColor(float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FadeToColor FadeToColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate HmdColor_t _GetCurrentFadeColor(bool bBackground); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCurrentFadeColor GetCurrentFadeColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _FadeGrid(float fSeconds, bool bFadeGridIn); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FadeGrid FadeGrid; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate float _GetCurrentGridAlpha(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCurrentGridAlpha GetCurrentGridAlpha; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _SetSkyboxOverride([In, Out] Texture_t[] pTextures, uint unTextureCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetSkyboxOverride SetSkyboxOverride; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ClearSkyboxOverride(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ClearSkyboxOverride ClearSkyboxOverride; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _CompositorBringToFront(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CompositorBringToFront CompositorBringToFront; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _CompositorGoToBack(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CompositorGoToBack CompositorGoToBack; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _CompositorQuit(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CompositorQuit CompositorQuit; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsFullscreen(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsFullscreen IsFullscreen; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetCurrentSceneFocusProcess(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCurrentSceneFocusProcess GetCurrentSceneFocusProcess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetLastFrameRenderer(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLastFrameRenderer GetLastFrameRenderer; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _CanRenderScene(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CanRenderScene CanRenderScene; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ShowMirrorWindow(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowMirrorWindow ShowMirrorWindow; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _HideMirrorWindow(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HideMirrorWindow HideMirrorWindow; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsMirrorWindowVisible(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsMirrorWindowVisible IsMirrorWindowVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _CompositorDumpImages(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CompositorDumpImages CompositorDumpImages; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ShouldAppRenderWithLowResources(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShouldAppRenderWithLowResources ShouldAppRenderWithLowResources; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ForceInterleavedReprojectionOn(bool bOverride); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ForceInterleavedReprojectionOn ForceInterleavedReprojectionOn; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ForceReconnectProcess(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ForceReconnectProcess ForceReconnectProcess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SuspendRendering(bool bSuspend); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SuspendRendering SuspendRendering; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetMirrorTextureD3D11(EVREye eEye, IntPtr pD3D11DeviceOrResource, ref IntPtr ppD3D11ShaderResourceView); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetMirrorTextureD3D11 GetMirrorTextureD3D11; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ReleaseMirrorTextureD3D11(IntPtr pD3D11ShaderResourceView); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseMirrorTextureD3D11 ReleaseMirrorTextureD3D11; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetMirrorTextureGL(EVREye eEye, ref uint pglTextureId, IntPtr pglSharedTextureHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetMirrorTextureGL GetMirrorTextureGL; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ReleaseSharedGLTexture(uint glTextureId, IntPtr glSharedTextureHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseSharedGLTexture ReleaseSharedGLTexture; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _LockGLSharedTextureForAccess(IntPtr glSharedTextureHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LockGLSharedTextureForAccess LockGLSharedTextureForAccess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _UnlockGLSharedTextureForAccess(IntPtr glSharedTextureHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _UnlockGLSharedTextureForAccess UnlockGLSharedTextureForAccess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVulkanInstanceExtensionsRequired GetVulkanInstanceExtensionsRequired; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice, System.Text.StringBuilder pchValue, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetVulkanDeviceExtensionsRequired GetVulkanDeviceExtensionsRequired; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetExplicitTimingMode(EVRCompositorTimingMode eTimingMode); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetExplicitTimingMode SetExplicitTimingMode; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _SubmitExplicitTimingData(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SubmitExplicitTimingData SubmitExplicitTimingData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsMotionSmoothingEnabled(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsMotionSmoothingEnabled IsMotionSmoothingEnabled; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsMotionSmoothingSupported(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsMotionSmoothingSupported IsMotionSmoothingSupported; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsCurrentSceneFocusAppLoading(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsCurrentSceneFocusAppLoading IsCurrentSceneFocusAppLoading; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _SetStageOverride_Async(IntPtr pchRenderModelPath, ref HmdMatrix34_t pTransform, ref Compositor_StageRenderSettings pRenderSettings, uint nSizeOfRenderSettings); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetStageOverride_Async SetStageOverride_Async; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ClearStageOverride(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ClearStageOverride ClearStageOverride; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetCompositorBenchmarkResults(ref Compositor_BenchmarkResults pBenchmarkResults, uint nSizeOfBenchmarkResults); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetCompositorBenchmarkResults GetCompositorBenchmarkResults; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetLastPosePredictionIDs(ref uint pRenderPosePredictionID, ref uint pGamePosePredictionID); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetLastPosePredictionIDs GetLastPosePredictionIDs; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRCompositorError _GetPosesForFrame(uint unPosePredictionID, [In, Out] TrackedDevicePose_t[] pPoseArray, uint unPoseArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPosesForFrame GetPosesForFrame; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVROverlay +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _FindOverlay(IntPtr pchOverlayKey, ref ulong pOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FindOverlay FindOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _CreateOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayName, ref ulong pOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateOverlay CreateOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _DestroyOverlay(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _DestroyOverlay DestroyOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetOverlayKey(ulong ulOverlayHandle, System.Text.StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayKey GetOverlayKey; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetOverlayName(ulong ulOverlayHandle, System.Text.StringBuilder pchValue, uint unBufferSize, ref EVROverlayError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayName GetOverlayName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayName(ulong ulOverlayHandle, IntPtr pchName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayName SetOverlayName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayImageData(ulong ulOverlayHandle, IntPtr pvBuffer, uint unBufferSize, ref uint punWidth, ref uint punHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayImageData GetOverlayImageData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetOverlayErrorNameFromEnum(EVROverlayError error); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayErrorNameFromEnum GetOverlayErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayRenderingPid(ulong ulOverlayHandle, uint unPID); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayRenderingPid SetOverlayRenderingPid; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetOverlayRenderingPid(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayRenderingPid GetOverlayRenderingPid; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayFlag SetOverlayFlag; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayFlag(ulong ulOverlayHandle, VROverlayFlags eOverlayFlag, ref bool pbEnabled); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayFlag GetOverlayFlag; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayFlags(ulong ulOverlayHandle, ref uint pFlags); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayFlags GetOverlayFlags; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayColor(ulong ulOverlayHandle, float fRed, float fGreen, float fBlue); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayColor SetOverlayColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayColor(ulong ulOverlayHandle, ref float pfRed, ref float pfGreen, ref float pfBlue); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayColor GetOverlayColor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayAlpha(ulong ulOverlayHandle, float fAlpha); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayAlpha SetOverlayAlpha; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayAlpha(ulong ulOverlayHandle, ref float pfAlpha); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayAlpha GetOverlayAlpha; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTexelAspect(ulong ulOverlayHandle, float fTexelAspect); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTexelAspect SetOverlayTexelAspect; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTexelAspect(ulong ulOverlayHandle, ref float pfTexelAspect); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTexelAspect GetOverlayTexelAspect; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlaySortOrder(ulong ulOverlayHandle, uint unSortOrder); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlaySortOrder SetOverlaySortOrder; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlaySortOrder(ulong ulOverlayHandle, ref uint punSortOrder); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlaySortOrder GetOverlaySortOrder; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayWidthInMeters(ulong ulOverlayHandle, float fWidthInMeters); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayWidthInMeters SetOverlayWidthInMeters; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayWidthInMeters(ulong ulOverlayHandle, ref float pfWidthInMeters); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayWidthInMeters GetOverlayWidthInMeters; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayCurvature(ulong ulOverlayHandle, float fCurvature); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayCurvature SetOverlayCurvature; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayCurvature(ulong ulOverlayHandle, ref float pfCurvature); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayCurvature GetOverlayCurvature; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTextureColorSpace(ulong ulOverlayHandle, EColorSpace eTextureColorSpace); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTextureColorSpace SetOverlayTextureColorSpace; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTextureColorSpace(ulong ulOverlayHandle, ref EColorSpace peTextureColorSpace); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTextureColorSpace GetOverlayTextureColorSpace; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTextureBounds SetOverlayTextureBounds; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTextureBounds(ulong ulOverlayHandle, ref VRTextureBounds_t pOverlayTextureBounds); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTextureBounds GetOverlayTextureBounds; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformType(ulong ulOverlayHandle, ref VROverlayTransformType peTransformType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformType GetOverlayTransformType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformAbsolute(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformAbsolute SetOverlayTransformAbsolute; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformAbsolute(ulong ulOverlayHandle, ref ETrackingUniverseOrigin peTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformAbsolute GetOverlayTransformAbsolute; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, uint unTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformTrackedDeviceRelative SetOverlayTransformTrackedDeviceRelative; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle, ref uint punTrackedDevice, ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformTrackedDeviceRelative GetOverlayTransformTrackedDeviceRelative; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, uint unDeviceIndex, IntPtr pchComponentName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformTrackedDeviceComponent SetOverlayTransformTrackedDeviceComponent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle, ref uint punDeviceIndex, System.Text.StringBuilder pchComponentName, uint unComponentNameSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformTrackedDeviceComponent GetOverlayTransformTrackedDeviceComponent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ref ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformOverlayRelative GetOverlayTransformOverlayRelative; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformOverlayRelative(ulong ulOverlayHandle, ulong ulOverlayHandleParent, ref HmdMatrix34_t pmatParentOverlayToOverlayTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformOverlayRelative SetOverlayTransformOverlayRelative; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformCursor(ulong ulCursorOverlayHandle, ref HmdVector2_t pvHotspot); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformCursor SetOverlayTransformCursor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTransformCursor(ulong ulOverlayHandle, ref HmdVector2_t pvHotspot); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTransformCursor GetOverlayTransformCursor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTransformProjection(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform, ref VROverlayProjection_t pProjection, EVREye eEye); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTransformProjection SetOverlayTransformProjection; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ShowOverlay(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowOverlay ShowOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _HideOverlay(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HideOverlay HideOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsOverlayVisible(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsOverlayVisible IsOverlayVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetTransformForOverlayCoordinates(ulong ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, HmdVector2_t coordinatesInOverlay, ref HmdMatrix34_t pmatTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetTransformForOverlayCoordinates GetTransformForOverlayCoordinates; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _PollNextOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pEvent, uint uncbVREvent); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PollNextOverlayEvent PollNextOverlayEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayInputMethod(ulong ulOverlayHandle, ref VROverlayInputMethod peInputMethod); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayInputMethod GetOverlayInputMethod; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayInputMethod(ulong ulOverlayHandle, VROverlayInputMethod eInputMethod); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayInputMethod SetOverlayInputMethod; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayMouseScale GetOverlayMouseScale; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayMouseScale(ulong ulOverlayHandle, ref HmdVector2_t pvecMouseScale); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayMouseScale SetOverlayMouseScale; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _ComputeOverlayIntersection(ulong ulOverlayHandle, ref VROverlayIntersectionParams_t pParams, ref VROverlayIntersectionResults_t pResults); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ComputeOverlayIntersection ComputeOverlayIntersection; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsHoverTargetOverlay(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsHoverTargetOverlay IsHoverTargetOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayIntersectionMask(ulong ulOverlayHandle, ref VROverlayIntersectionMaskPrimitive_t pMaskPrimitives, uint unNumMaskPrimitives, uint unPrimitiveSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayIntersectionMask SetOverlayIntersectionMask; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _TriggerLaserMouseHapticVibration(ulong ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _TriggerLaserMouseHapticVibration TriggerLaserMouseHapticVibration; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayCursor(ulong ulOverlayHandle, ulong ulCursorHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayCursor SetOverlayCursor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayCursorPositionOverride(ulong ulOverlayHandle, ref HmdVector2_t pvCursor); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayCursorPositionOverride SetOverlayCursorPositionOverride; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ClearOverlayCursorPositionOverride(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ClearOverlayCursorPositionOverride ClearOverlayCursorPositionOverride; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayTexture(ulong ulOverlayHandle, ref Texture_t pTexture); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayTexture SetOverlayTexture; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ClearOverlayTexture(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ClearOverlayTexture ClearOverlayTexture; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayRaw(ulong ulOverlayHandle, IntPtr pvBuffer, uint unWidth, uint unHeight, uint unBytesPerPixel); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayRaw SetOverlayRaw; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetOverlayFromFile(ulong ulOverlayHandle, IntPtr pchFilePath); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetOverlayFromFile SetOverlayFromFile; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTexture(ulong ulOverlayHandle, ref IntPtr pNativeTextureHandle, IntPtr pNativeTextureRef, ref uint pWidth, ref uint pHeight, ref uint pNativeFormat, ref ETextureType pAPIType, ref EColorSpace pColorSpace, ref VRTextureBounds_t pTextureBounds); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTexture GetOverlayTexture; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ReleaseNativeOverlayHandle(ulong ulOverlayHandle, IntPtr pNativeTextureHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseNativeOverlayHandle ReleaseNativeOverlayHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetOverlayTextureSize(ulong ulOverlayHandle, ref uint pWidth, ref uint pHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOverlayTextureSize GetOverlayTextureSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _CreateDashboardOverlay(IntPtr pchOverlayKey, IntPtr pchOverlayFriendlyName, ref ulong pMainHandle, ref ulong pThumbnailHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateDashboardOverlay CreateDashboardOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsDashboardVisible(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsDashboardVisible IsDashboardVisible; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsActiveDashboardOverlay(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsActiveDashboardOverlay IsActiveDashboardOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _SetDashboardOverlaySceneProcess(ulong ulOverlayHandle, uint unProcessId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetDashboardOverlaySceneProcess SetDashboardOverlaySceneProcess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _GetDashboardOverlaySceneProcess(ulong ulOverlayHandle, ref uint punProcessId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDashboardOverlaySceneProcess GetDashboardOverlaySceneProcess; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _ShowDashboard(IntPtr pchOverlayToShow); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowDashboard ShowDashboard; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetPrimaryDashboardDevice(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPrimaryDashboardDevice GetPrimaryDashboardDevice; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ShowKeyboard(int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowKeyboard ShowKeyboard; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ShowKeyboardForOverlay(ulong ulOverlayHandle, int eInputMode, int eLineInputMode, uint unFlags, IntPtr pchDescription, uint unCharMax, IntPtr pchExistingText, ulong uUserValue); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowKeyboardForOverlay ShowKeyboardForOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetKeyboardText(System.Text.StringBuilder pchText, uint cchText); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetKeyboardText GetKeyboardText; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _HideKeyboard(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HideKeyboard HideKeyboard; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin, ref HmdMatrix34_t pmatTrackingOriginToKeyboardTransform); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetKeyboardTransformAbsolute SetKeyboardTransformAbsolute; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetKeyboardPositionForOverlay(ulong ulOverlayHandle, HmdRect2_t avoidRect); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetKeyboardPositionForOverlay SetKeyboardPositionForOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate VRMessageOverlayResponse _ShowMessageOverlay(IntPtr pchText, IntPtr pchCaption, IntPtr pchButton0Text, IntPtr pchButton1Text, IntPtr pchButton2Text, IntPtr pchButton3Text); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowMessageOverlay ShowMessageOverlay; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _CloseMessageOverlay(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CloseMessageOverlay CloseMessageOverlay; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVROverlayView +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _AcquireOverlayView(ulong ulOverlayHandle, ref VRNativeDevice_t pNativeDevice, ref VROverlayView_t pOverlayView, uint unOverlayViewSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AcquireOverlayView AcquireOverlayView; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVROverlayError _ReleaseOverlayView(ref VROverlayView_t pOverlayView); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseOverlayView ReleaseOverlayView; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _PostOverlayEvent(ulong ulOverlayHandle, ref VREvent_t pvrEvent); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PostOverlayEvent PostOverlayEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsViewingPermitted(ulong ulOverlayHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsViewingPermitted IsViewingPermitted; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRHeadsetView +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetHeadsetViewSize(uint nWidth, uint nHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetHeadsetViewSize SetHeadsetViewSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetHeadsetViewSize(ref uint pnWidth, ref uint pnHeight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHeadsetViewSize GetHeadsetViewSize; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetHeadsetViewMode(uint eHeadsetViewMode); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetHeadsetViewMode SetHeadsetViewMode; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetHeadsetViewMode(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHeadsetViewMode GetHeadsetViewMode; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetHeadsetViewCropped(bool bCropped); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetHeadsetViewCropped SetHeadsetViewCropped; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetHeadsetViewCropped(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHeadsetViewCropped GetHeadsetViewCropped; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate float _GetHeadsetViewAspectRatio(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHeadsetViewAspectRatio GetHeadsetViewAspectRatio; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetHeadsetViewBlendRange(float flStartPct, float flEndPct); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetHeadsetViewBlendRange SetHeadsetViewBlendRange; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetHeadsetViewBlendRange(ref float pStartPct, ref float pEndPct); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetHeadsetViewBlendRange GetHeadsetViewBlendRange; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRRenderModels +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRRenderModelError _LoadRenderModel_Async(IntPtr pchRenderModelName, ref IntPtr ppRenderModel); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LoadRenderModel_Async LoadRenderModel_Async; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _FreeRenderModel(IntPtr pRenderModel); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FreeRenderModel FreeRenderModel; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRRenderModelError _LoadTexture_Async(int textureId, ref IntPtr ppTexture); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LoadTexture_Async LoadTexture_Async; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _FreeTexture(IntPtr pTexture); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FreeTexture FreeTexture; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRRenderModelError _LoadTextureD3D11_Async(int textureId, IntPtr pD3D11Device, ref IntPtr ppD3D11Texture2D); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LoadTextureD3D11_Async LoadTextureD3D11_Async; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRRenderModelError _LoadIntoTextureD3D11_Async(int textureId, IntPtr pDstTexture); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LoadIntoTextureD3D11_Async LoadIntoTextureD3D11_Async; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _FreeTextureD3D11(IntPtr pD3D11Texture2D); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FreeTextureD3D11 FreeTextureD3D11; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetRenderModelName(uint unRenderModelIndex, System.Text.StringBuilder pchRenderModelName, uint unRenderModelNameLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRenderModelName GetRenderModelName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetRenderModelCount(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRenderModelCount GetRenderModelCount; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetComponentCount(IntPtr pchRenderModelName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentCount GetComponentCount; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetComponentName(IntPtr pchRenderModelName, uint unComponentIndex, System.Text.StringBuilder pchComponentName, uint unComponentNameLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentName GetComponentName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _GetComponentButtonMask(IntPtr pchRenderModelName, IntPtr pchComponentName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentButtonMask GetComponentButtonMask; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetComponentRenderModelName(IntPtr pchRenderModelName, IntPtr pchComponentName, System.Text.StringBuilder pchComponentRenderModelName, uint unComponentRenderModelNameLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentRenderModelName GetComponentRenderModelName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetComponentStateForDevicePath(IntPtr pchRenderModelName, IntPtr pchComponentName, ulong devicePath, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentStateForDevicePath GetComponentStateForDevicePath; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetComponentState(IntPtr pchRenderModelName, IntPtr pchComponentName, ref VRControllerState_t pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentState GetComponentState; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _RenderModelHasComponent(IntPtr pchRenderModelName, IntPtr pchComponentName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RenderModelHasComponent RenderModelHasComponent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetRenderModelThumbnailURL(IntPtr pchRenderModelName, System.Text.StringBuilder pchThumbnailURL, uint unThumbnailURLLen, ref EVRRenderModelError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRenderModelThumbnailURL GetRenderModelThumbnailURL; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetRenderModelOriginalPath(IntPtr pchRenderModelName, System.Text.StringBuilder pchOriginalPath, uint unOriginalPathLen, ref EVRRenderModelError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRenderModelOriginalPath GetRenderModelOriginalPath; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetRenderModelErrorNameFromEnum(EVRRenderModelError error); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetRenderModelErrorNameFromEnum GetRenderModelErrorNameFromEnum; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRNotifications +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRNotificationError _CreateNotification(ulong ulOverlayHandle, ulong ulUserValue, EVRNotificationType type, IntPtr pchText, EVRNotificationStyle style, ref NotificationBitmap_t pImage, ref uint pNotificationId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateNotification CreateNotification; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRNotificationError _RemoveNotification(uint notificationId); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RemoveNotification RemoveNotification; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRSettings +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetSettingsErrorNameFromEnum(EVRSettingsError eError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSettingsErrorNameFromEnum GetSettingsErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetBool(IntPtr pchSection, IntPtr pchSettingsKey, bool bValue, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetBool SetBool; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetInt32(IntPtr pchSection, IntPtr pchSettingsKey, int nValue, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetInt32 SetInt32; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetFloat(IntPtr pchSection, IntPtr pchSettingsKey, float flValue, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetFloat SetFloat; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _SetString(IntPtr pchSection, IntPtr pchSettingsKey, IntPtr pchValue, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetString SetString; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetBool(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBool GetBool; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate int _GetInt32(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetInt32 GetInt32; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate float _GetFloat(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetFloat GetFloat; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _GetString(IntPtr pchSection, IntPtr pchSettingsKey, System.Text.StringBuilder pchValue, uint unValueLen, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetString GetString; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _RemoveSection(IntPtr pchSection, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RemoveSection RemoveSection; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate void _RemoveKeyInSection(IntPtr pchSection, IntPtr pchSettingsKey, ref EVRSettingsError peError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RemoveKeyInSection RemoveKeyInSection; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRScreenshots +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotError _RequestScreenshot(ref uint pOutScreenshotHandle, EVRScreenshotType type, IntPtr pchPreviewFilename, IntPtr pchVRFilename); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _RequestScreenshot RequestScreenshot; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotError _HookScreenshot([In, Out] EVRScreenshotType[] pSupportedTypes, int numTypes); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HookScreenshot HookScreenshot; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotType _GetScreenshotPropertyType(uint screenshotHandle, ref EVRScreenshotError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetScreenshotPropertyType GetScreenshotPropertyType; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetScreenshotPropertyFilename(uint screenshotHandle, EVRScreenshotPropertyFilenames filenameType, System.Text.StringBuilder pchFilename, uint cchFilename, ref EVRScreenshotError pError); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetScreenshotPropertyFilename GetScreenshotPropertyFilename; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotError _UpdateScreenshotProgress(uint screenshotHandle, float flProgress); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _UpdateScreenshotProgress UpdateScreenshotProgress; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotError _TakeStereoScreenshot(ref uint pOutScreenshotHandle, IntPtr pchPreviewFilename, IntPtr pchVRFilename); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _TakeStereoScreenshot TakeStereoScreenshot; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRScreenshotError _SubmitScreenshot(uint screenshotHandle, EVRScreenshotType type, IntPtr pchSourcePreviewFilename, IntPtr pchSourceVRFilename); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SubmitScreenshot SubmitScreenshot; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRResources +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _LoadSharedResource(IntPtr pchResourceName, string pchBuffer, uint unBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _LoadSharedResource LoadSharedResource; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetResourceFullPath(IntPtr pchResourceName, IntPtr pchResourceTypeDirectory, System.Text.StringBuilder pchPathBuffer, uint unBufferLen); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetResourceFullPath GetResourceFullPath; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRDriverManager +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetDriverCount(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDriverCount GetDriverCount; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _GetDriverName(uint nDriver, System.Text.StringBuilder pchValue, uint unBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDriverName GetDriverName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _GetDriverHandle(IntPtr pchDriverName); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDriverHandle GetDriverHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsEnabled(uint nDriver); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsEnabled IsEnabled; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRInput +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _SetActionManifestPath(IntPtr pchActionManifestPath); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetActionManifestPath SetActionManifestPath; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetActionSetHandle(IntPtr pchActionSetName, ref ulong pHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetActionSetHandle GetActionSetHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetActionHandle(IntPtr pchActionName, ref ulong pHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetActionHandle GetActionHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetInputSourceHandle(IntPtr pchInputSourcePath, ref ulong pHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetInputSourceHandle GetInputSourceHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _UpdateActionState([In, Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _UpdateActionState UpdateActionState; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetDigitalActionData(ulong action, ref InputDigitalActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDigitalActionData GetDigitalActionData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetAnalogActionData(ulong action, ref InputAnalogActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetAnalogActionData GetAnalogActionData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetPoseActionDataRelativeToNow(ulong action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPoseActionDataRelativeToNow GetPoseActionDataRelativeToNow; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetPoseActionDataForNextFrame(ulong action, ETrackingUniverseOrigin eOrigin, ref InputPoseActionData_t pActionData, uint unActionDataSize, ulong ulRestrictToDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPoseActionDataForNextFrame GetPoseActionDataForNextFrame; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalActionData(ulong action, ref InputSkeletalActionData_t pActionData, uint unActionDataSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalActionData GetSkeletalActionData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetDominantHand(ref ETrackedControllerRole peDominantHand); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetDominantHand GetDominantHand; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _SetDominantHand(ETrackedControllerRole eDominantHand); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _SetDominantHand SetDominantHand; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetBoneCount(ulong action, ref uint pBoneCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBoneCount GetBoneCount; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetBoneHierarchy(ulong action, [In, Out] int[] pParentIndices, uint unIndexArayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBoneHierarchy GetBoneHierarchy; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetBoneName(ulong action, int nBoneIndex, System.Text.StringBuilder pchBoneName, uint unNameBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBoneName GetBoneName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalReferenceTransforms(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalReferenceTransforms GetSkeletalReferenceTransforms; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalTrackingLevel(ulong action, ref EVRSkeletalTrackingLevel pSkeletalTrackingLevel); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalTrackingLevel GetSkeletalTrackingLevel; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalBoneData(ulong action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalBoneData GetSkeletalBoneData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalSummaryData(ulong action, EVRSummaryType eSummaryType, ref VRSkeletalSummaryData_t pSkeletalSummaryData); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalSummaryData GetSkeletalSummaryData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetSkeletalBoneDataCompressed(ulong action, EVRSkeletalMotionRange eMotionRange, IntPtr pvCompressedData, uint unCompressedSize, ref uint punRequiredCompressedSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSkeletalBoneDataCompressed GetSkeletalBoneDataCompressed; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _DecompressSkeletalBoneData(IntPtr pvCompressedBuffer, uint unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, [In, Out] VRBoneTransform_t[] pTransformArray, uint unTransformArrayCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _DecompressSkeletalBoneData DecompressSkeletalBoneData; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _TriggerHapticVibrationAction(ulong action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, ulong ulRestrictToDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _TriggerHapticVibrationAction TriggerHapticVibrationAction; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetActionOrigins(ulong actionSetHandle, ulong digitalActionHandle, [In, Out] ulong[] originsOut, uint originOutCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetActionOrigins GetActionOrigins; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetOriginLocalizedName(ulong origin, System.Text.StringBuilder pchNameArray, uint unNameArraySize, int unStringSectionsToInclude); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOriginLocalizedName GetOriginLocalizedName; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetOriginTrackedDeviceInfo(ulong origin, ref InputOriginInfo_t pOriginInfo, uint unOriginInfoSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetOriginTrackedDeviceInfo GetOriginTrackedDeviceInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetActionBindingInfo(ulong action, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref uint punReturnedBindingInfoCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetActionBindingInfo GetActionBindingInfo; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _ShowActionOrigins(ulong actionSetHandle, ulong ulActionHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowActionOrigins ShowActionOrigins; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _ShowBindingsForActionSet([In, Out] VRActiveActionSet_t[] pSets, uint unSizeOfVRSelectedActionSet_t, uint unSetCount, ulong originToHighlight); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ShowBindingsForActionSet ShowBindingsForActionSet; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetComponentStateForBinding(IntPtr pchRenderModelName, IntPtr pchComponentName, ref InputBindingInfo_t pOriginInfo, uint unBindingInfoSize, uint unBindingInfoCount, ref RenderModel_ComponentState_t pComponentState); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetComponentStateForBinding GetComponentStateForBinding; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _IsUsingLegacyInput(); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _IsUsingLegacyInput IsUsingLegacyInput; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _OpenBindingUI(IntPtr pchAppKey, ulong ulActionSetHandle, ulong ulDeviceHandle, bool bShowOnDesktop); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _OpenBindingUI OpenBindingUI; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRInputError _GetBindingVariant(ulong ulDevicePath, System.Text.StringBuilder pchVariantArray, uint unVariantArraySize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetBindingVariant GetBindingVariant; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRIOBuffer +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EIOBufferError _Open(IntPtr pchPath, EIOBufferMode mode, uint unElementSize, uint unElements, ref ulong pulBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Open Open; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EIOBufferError _Close(ulong ulBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Close Close; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EIOBufferError _Read(ulong ulBuffer, IntPtr pDst, uint unBytes, ref uint punRead); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Read Read; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EIOBufferError _Write(ulong ulBuffer, IntPtr pSrc, uint unBytes); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Write Write; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _PropertyContainer(ulong ulBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _PropertyContainer PropertyContainer; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _HasReaders(ulong ulBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HasReaders HasReaders; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRSpatialAnchors +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromDescriptor(IntPtr pchDescriptor, ref uint pHandleOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateSpatialAnchorFromDescriptor CreateSpatialAnchorFromDescriptor; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _CreateSpatialAnchorFromPose(uint unDeviceIndex, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPose, ref uint pHandleOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _CreateSpatialAnchorFromPose CreateSpatialAnchorFromPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _GetSpatialAnchorPose(uint unHandle, ETrackingUniverseOrigin eOrigin, ref SpatialAnchorPose_t pPoseOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSpatialAnchorPose GetSpatialAnchorPose; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRSpatialAnchorError _GetSpatialAnchorDescriptor(uint unHandle, System.Text.StringBuilder pchDescriptorOut, ref uint punDescriptorBufferLenInOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetSpatialAnchorDescriptor GetSpatialAnchorDescriptor; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRDebug +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRDebugError _EmitVrProfilerEvent(IntPtr pchMessage); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _EmitVrProfilerEvent EmitVrProfilerEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRDebugError _BeginVrProfilerEvent(ref ulong pHandleOut); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _BeginVrProfilerEvent BeginVrProfilerEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EVRDebugError _FinishVrProfilerEvent(ulong hHandle, IntPtr pchMessage); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _FinishVrProfilerEvent FinishVrProfilerEvent; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate uint _DriverDebugRequest(uint unDeviceIndex, IntPtr pchRequest, System.Text.StringBuilder pchResponseBuffer, uint unResponseBufferSize); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _DriverDebugRequest DriverDebugRequest; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRProperties +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _ReadPropertyBatch(ulong ulContainerHandle, ref PropertyRead_t pBatch, uint unBatchEntryCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReadPropertyBatch ReadPropertyBatch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _WritePropertyBatch(ulong ulContainerHandle, ref PropertyWrite_t pBatch, uint unBatchEntryCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _WritePropertyBatch WritePropertyBatch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate IntPtr _GetPropErrorNameFromEnum(ETrackedPropertyError error); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _GetPropErrorNameFromEnum GetPropErrorNameFromEnum; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ulong _TrackedDeviceToPropertyContainer(uint nDevice); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _TrackedDeviceToPropertyContainer TrackedDeviceToPropertyContainer; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRPaths +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _ReadPathBatch(ulong ulRootHandle, ref PathRead_t pBatch, uint unBatchEntryCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReadPathBatch ReadPathBatch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _WritePathBatch(ulong ulRootHandle, ref PathWrite_t pBatch, uint unBatchEntryCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _WritePathBatch WritePathBatch; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _StringToHandle(ref ulong pHandle, IntPtr pchPath); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _StringToHandle StringToHandle; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate ETrackedPropertyError _HandleToString(ulong pHandle, string pchBuffer, uint unBufferSize, ref uint punBufferSizeUsed); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _HandleToString HandleToString; + +} + +[StructLayout(LayoutKind.Sequential)] +public struct IVRBlockQueue +{ + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _Create(ref ulong pulQueueHandle, IntPtr pchPath, uint unBlockDataSize, uint unBlockHeaderSize, uint unBlockCount); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Create Create; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _Connect(ref ulong pulQueueHandle, IntPtr pchPath); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Connect Connect; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _Destroy(ulong ulQueueHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _Destroy Destroy; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _AcquireWriteOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AcquireWriteOnlyBlock AcquireWriteOnlyBlock; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _ReleaseWriteOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseWriteOnlyBlock ReleaseWriteOnlyBlock; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _WaitAndAcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType, uint unTimeoutMs); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _WaitAndAcquireReadOnlyBlock WaitAndAcquireReadOnlyBlock; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _AcquireReadOnlyBlock(ulong ulQueueHandle, ref ulong pulBlockHandle, ref IntPtr ppvBuffer, EBlockQueueReadType eReadType); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _AcquireReadOnlyBlock AcquireReadOnlyBlock; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _ReleaseReadOnlyBlock(ulong ulQueueHandle, ulong ulBlockHandle); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _ReleaseReadOnlyBlock ReleaseReadOnlyBlock; + + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate EBlockQueueError _QueueHasReader(ulong ulQueueHandle, ref bool pbHasReaders); + [MarshalAs(UnmanagedType.FunctionPtr)] + internal _QueueHasReader QueueHasReader; + +} + + +public class Utils +{ + public static IntPtr ToUtf8(string managedString) + { + if (managedString == null) + { + return IntPtr.Zero; + } + + int size = System.Text.Encoding.UTF8.GetByteCount(managedString) + 1; + if (buffer.Length < size) buffer = new byte[size]; + int written = System.Text.Encoding.UTF8.GetBytes(managedString, 0, managedString.Length, buffer, 0); + buffer[written] = 0x00; // null terminate + IntPtr nativeUtf8 = Marshal.AllocHGlobal(written+1); + Marshal.Copy(buffer, 0, nativeUtf8, written+1); + return nativeUtf8; + } + private static byte[] buffer = new byte[1024]; +} + +public class CVRSystem +{ + IVRSystem FnTable; + internal CVRSystem(IntPtr pInterface) + { + FnTable = (IVRSystem)Marshal.PtrToStructure(pInterface, typeof(IVRSystem)); + } + public void GetRecommendedRenderTargetSize(ref uint pnWidth,ref uint pnHeight) + { + pnWidth = 0; + pnHeight = 0; + FnTable.GetRecommendedRenderTargetSize(ref pnWidth,ref pnHeight); + } + public HmdMatrix44_t GetProjectionMatrix(EVREye eEye,float fNearZ,float fFarZ) + { + HmdMatrix44_t result = FnTable.GetProjectionMatrix(eEye,fNearZ,fFarZ); + return result; + } + public void GetProjectionRaw(EVREye eEye,ref float pfLeft,ref float pfRight,ref float pfTop,ref float pfBottom) + { + pfLeft = 0; + pfRight = 0; + pfTop = 0; + pfBottom = 0; + FnTable.GetProjectionRaw(eEye,ref pfLeft,ref pfRight,ref pfTop,ref pfBottom); + } + public bool ComputeDistortion(EVREye eEye,float fU,float fV,ref DistortionCoordinates_t pDistortionCoordinates) + { + bool result = FnTable.ComputeDistortion(eEye,fU,fV,ref pDistortionCoordinates); + return result; + } + public HmdMatrix34_t GetEyeToHeadTransform(EVREye eEye) + { + HmdMatrix34_t result = FnTable.GetEyeToHeadTransform(eEye); + return result; + } + public bool GetTimeSinceLastVsync(ref float pfSecondsSinceLastVsync,ref ulong pulFrameCounter) + { + pfSecondsSinceLastVsync = 0; + pulFrameCounter = 0; + bool result = FnTable.GetTimeSinceLastVsync(ref pfSecondsSinceLastVsync,ref pulFrameCounter); + return result; + } + public int GetD3D9AdapterIndex() + { + int result = FnTable.GetD3D9AdapterIndex(); + return result; + } + public void GetDXGIOutputInfo(ref int pnAdapterIndex) + { + pnAdapterIndex = 0; + FnTable.GetDXGIOutputInfo(ref pnAdapterIndex); + } + public void GetOutputDevice(ref ulong pnDevice,ETextureType textureType,IntPtr pInstance) + { + pnDevice = 0; + FnTable.GetOutputDevice(ref pnDevice,textureType,pInstance); + } + public bool IsDisplayOnDesktop() + { + bool result = FnTable.IsDisplayOnDesktop(); + return result; + } + public bool SetDisplayVisibility(bool bIsVisibleOnDesktop) + { + bool result = FnTable.SetDisplayVisibility(bIsVisibleOnDesktop); + return result; + } + public void GetDeviceToAbsoluteTrackingPose(ETrackingUniverseOrigin eOrigin,float fPredictedSecondsToPhotonsFromNow,TrackedDevicePose_t [] pTrackedDevicePoseArray) + { + FnTable.GetDeviceToAbsoluteTrackingPose(eOrigin,fPredictedSecondsToPhotonsFromNow,pTrackedDevicePoseArray,(uint) pTrackedDevicePoseArray.Length); + } + public HmdMatrix34_t GetSeatedZeroPoseToStandingAbsoluteTrackingPose() + { + HmdMatrix34_t result = FnTable.GetSeatedZeroPoseToStandingAbsoluteTrackingPose(); + return result; + } + public HmdMatrix34_t GetRawZeroPoseToStandingAbsoluteTrackingPose() + { + HmdMatrix34_t result = FnTable.GetRawZeroPoseToStandingAbsoluteTrackingPose(); + return result; + } + public uint GetSortedTrackedDeviceIndicesOfClass(ETrackedDeviceClass eTrackedDeviceClass,uint [] punTrackedDeviceIndexArray,uint unRelativeToTrackedDeviceIndex) + { + uint result = FnTable.GetSortedTrackedDeviceIndicesOfClass(eTrackedDeviceClass,punTrackedDeviceIndexArray,(uint) punTrackedDeviceIndexArray.Length,unRelativeToTrackedDeviceIndex); + return result; + } + public EDeviceActivityLevel GetTrackedDeviceActivityLevel(uint unDeviceId) + { + EDeviceActivityLevel result = FnTable.GetTrackedDeviceActivityLevel(unDeviceId); + return result; + } + public void ApplyTransform(ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pTrackedDevicePose,ref HmdMatrix34_t pTransform) + { + FnTable.ApplyTransform(ref pOutputPose,ref pTrackedDevicePose,ref pTransform); + } + public uint GetTrackedDeviceIndexForControllerRole(ETrackedControllerRole unDeviceType) + { + uint result = FnTable.GetTrackedDeviceIndexForControllerRole(unDeviceType); + return result; + } + public ETrackedControllerRole GetControllerRoleForTrackedDeviceIndex(uint unDeviceIndex) + { + ETrackedControllerRole result = FnTable.GetControllerRoleForTrackedDeviceIndex(unDeviceIndex); + return result; + } + public ETrackedDeviceClass GetTrackedDeviceClass(uint unDeviceIndex) + { + ETrackedDeviceClass result = FnTable.GetTrackedDeviceClass(unDeviceIndex); + return result; + } + public bool IsTrackedDeviceConnected(uint unDeviceIndex) + { + bool result = FnTable.IsTrackedDeviceConnected(unDeviceIndex); + return result; + } + public bool GetBoolTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError) + { + bool result = FnTable.GetBoolTrackedDeviceProperty(unDeviceIndex,prop,ref pError); + return result; + } + public float GetFloatTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError) + { + float result = FnTable.GetFloatTrackedDeviceProperty(unDeviceIndex,prop,ref pError); + return result; + } + public int GetInt32TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError) + { + int result = FnTable.GetInt32TrackedDeviceProperty(unDeviceIndex,prop,ref pError); + return result; + } + public ulong GetUint64TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError) + { + ulong result = FnTable.GetUint64TrackedDeviceProperty(unDeviceIndex,prop,ref pError); + return result; + } + public HmdMatrix34_t GetMatrix34TrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,ref ETrackedPropertyError pError) + { + HmdMatrix34_t result = FnTable.GetMatrix34TrackedDeviceProperty(unDeviceIndex,prop,ref pError); + return result; + } + public uint GetArrayTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,uint propType,IntPtr pBuffer,uint unBufferSize,ref ETrackedPropertyError pError) + { + uint result = FnTable.GetArrayTrackedDeviceProperty(unDeviceIndex,prop,propType,pBuffer,unBufferSize,ref pError); + return result; + } + public uint GetStringTrackedDeviceProperty(uint unDeviceIndex,ETrackedDeviceProperty prop,System.Text.StringBuilder pchValue,uint unBufferSize,ref ETrackedPropertyError pError) + { + uint result = FnTable.GetStringTrackedDeviceProperty(unDeviceIndex,prop,pchValue,unBufferSize,ref pError); + return result; + } + public string GetPropErrorNameFromEnum(ETrackedPropertyError error) + { + IntPtr result = FnTable.GetPropErrorNameFromEnum(error); + return Marshal.PtrToStringAnsi(result); + } +// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were +// originally mis-compiled with the wrong packing for Linux and OSX. + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _PollNextEventPacked(ref VREvent_t_Packed pEvent,uint uncbVREvent); + [StructLayout(LayoutKind.Explicit)] + struct PollNextEventUnion + { + [FieldOffset(0)] + public IVRSystem._PollNextEvent pPollNextEvent; + [FieldOffset(0)] + public _PollNextEventPacked pPollNextEventPacked; + } + public bool PollNextEvent(ref VREvent_t pEvent,uint uncbVREvent) + { +#if !UNITY_METRO + if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || + (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) + { + PollNextEventUnion u; + VREvent_t_Packed event_packed = new VREvent_t_Packed(); + u.pPollNextEventPacked = null; + u.pPollNextEvent = FnTable.PollNextEvent; + bool packed_result = u.pPollNextEventPacked(ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed))); + + event_packed.Unpack(ref pEvent); + return packed_result; + } +#endif + bool result = FnTable.PollNextEvent(ref pEvent,uncbVREvent); + return result; + } + public bool PollNextEventWithPose(ETrackingUniverseOrigin eOrigin,ref VREvent_t pEvent,uint uncbVREvent,ref TrackedDevicePose_t pTrackedDevicePose) + { + bool result = FnTable.PollNextEventWithPose(eOrigin,ref pEvent,uncbVREvent,ref pTrackedDevicePose); + return result; + } + public string GetEventTypeNameFromEnum(EVREventType eType) + { + IntPtr result = FnTable.GetEventTypeNameFromEnum(eType); + return Marshal.PtrToStringAnsi(result); + } + public HiddenAreaMesh_t GetHiddenAreaMesh(EVREye eEye,EHiddenAreaMeshType type) + { + HiddenAreaMesh_t result = FnTable.GetHiddenAreaMesh(eEye,type); + return result; + } +// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were +// originally mis-compiled with the wrong packing for Linux and OSX. + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetControllerStatePacked(uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize); + [StructLayout(LayoutKind.Explicit)] + struct GetControllerStateUnion + { + [FieldOffset(0)] + public IVRSystem._GetControllerState pGetControllerState; + [FieldOffset(0)] + public _GetControllerStatePacked pGetControllerStatePacked; + } + public bool GetControllerState(uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,uint unControllerStateSize) + { +#if !UNITY_METRO + if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || + (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) + { + GetControllerStateUnion u; + VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState); + u.pGetControllerStatePacked = null; + u.pGetControllerState = FnTable.GetControllerState; + bool packed_result = u.pGetControllerStatePacked(unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed))); + + state_packed.Unpack(ref pControllerState); + return packed_result; + } +#endif + bool result = FnTable.GetControllerState(unControllerDeviceIndex,ref pControllerState,unControllerStateSize); + return result; + } +// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were +// originally mis-compiled with the wrong packing for Linux and OSX. + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetControllerStateWithPosePacked(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t_Packed pControllerState,uint unControllerStateSize,ref TrackedDevicePose_t pTrackedDevicePose); + [StructLayout(LayoutKind.Explicit)] + struct GetControllerStateWithPoseUnion + { + [FieldOffset(0)] + public IVRSystem._GetControllerStateWithPose pGetControllerStateWithPose; + [FieldOffset(0)] + public _GetControllerStateWithPosePacked pGetControllerStateWithPosePacked; + } + public bool GetControllerStateWithPose(ETrackingUniverseOrigin eOrigin,uint unControllerDeviceIndex,ref VRControllerState_t pControllerState,uint unControllerStateSize,ref TrackedDevicePose_t pTrackedDevicePose) + { +#if !UNITY_METRO + if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || + (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) + { + GetControllerStateWithPoseUnion u; + VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState); + u.pGetControllerStateWithPosePacked = null; + u.pGetControllerStateWithPose = FnTable.GetControllerStateWithPose; + bool packed_result = u.pGetControllerStateWithPosePacked(eOrigin,unControllerDeviceIndex,ref state_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VRControllerState_t_Packed)),ref pTrackedDevicePose); + + state_packed.Unpack(ref pControllerState); + return packed_result; + } +#endif + bool result = FnTable.GetControllerStateWithPose(eOrigin,unControllerDeviceIndex,ref pControllerState,unControllerStateSize,ref pTrackedDevicePose); + return result; + } + public void TriggerHapticPulse(uint unControllerDeviceIndex,uint unAxisId,ushort usDurationMicroSec) + { + FnTable.TriggerHapticPulse(unControllerDeviceIndex,unAxisId,usDurationMicroSec); + } + public string GetButtonIdNameFromEnum(EVRButtonId eButtonId) + { + IntPtr result = FnTable.GetButtonIdNameFromEnum(eButtonId); + return Marshal.PtrToStringAnsi(result); + } + public string GetControllerAxisTypeNameFromEnum(EVRControllerAxisType eAxisType) + { + IntPtr result = FnTable.GetControllerAxisTypeNameFromEnum(eAxisType); + return Marshal.PtrToStringAnsi(result); + } + public bool IsInputAvailable() + { + bool result = FnTable.IsInputAvailable(); + return result; + } + public bool IsSteamVRDrawingControllers() + { + bool result = FnTable.IsSteamVRDrawingControllers(); + return result; + } + public bool ShouldApplicationPause() + { + bool result = FnTable.ShouldApplicationPause(); + return result; + } + public bool ShouldApplicationReduceRenderingWork() + { + bool result = FnTable.ShouldApplicationReduceRenderingWork(); + return result; + } + public EVRFirmwareError PerformFirmwareUpdate(uint unDeviceIndex) + { + EVRFirmwareError result = FnTable.PerformFirmwareUpdate(unDeviceIndex); + return result; + } + public void AcknowledgeQuit_Exiting() + { + FnTable.AcknowledgeQuit_Exiting(); + } + public uint GetAppContainerFilePaths(System.Text.StringBuilder pchBuffer,uint unBufferSize) + { + uint result = FnTable.GetAppContainerFilePaths(pchBuffer,unBufferSize); + return result; + } + public string GetRuntimeVersion() + { + IntPtr result = FnTable.GetRuntimeVersion(); + return Marshal.PtrToStringAnsi(result); + } +} + + +public class CVRExtendedDisplay +{ + IVRExtendedDisplay FnTable; + internal CVRExtendedDisplay(IntPtr pInterface) + { + FnTable = (IVRExtendedDisplay)Marshal.PtrToStructure(pInterface, typeof(IVRExtendedDisplay)); + } + public void GetWindowBounds(ref int pnX,ref int pnY,ref uint pnWidth,ref uint pnHeight) + { + pnX = 0; + pnY = 0; + pnWidth = 0; + pnHeight = 0; + FnTable.GetWindowBounds(ref pnX,ref pnY,ref pnWidth,ref pnHeight); + } + public void GetEyeOutputViewport(EVREye eEye,ref uint pnX,ref uint pnY,ref uint pnWidth,ref uint pnHeight) + { + pnX = 0; + pnY = 0; + pnWidth = 0; + pnHeight = 0; + FnTable.GetEyeOutputViewport(eEye,ref pnX,ref pnY,ref pnWidth,ref pnHeight); + } + public void GetDXGIOutputInfo(ref int pnAdapterIndex,ref int pnAdapterOutputIndex) + { + pnAdapterIndex = 0; + pnAdapterOutputIndex = 0; + FnTable.GetDXGIOutputInfo(ref pnAdapterIndex,ref pnAdapterOutputIndex); + } +} + + +public class CVRTrackedCamera +{ + IVRTrackedCamera FnTable; + internal CVRTrackedCamera(IntPtr pInterface) + { + FnTable = (IVRTrackedCamera)Marshal.PtrToStructure(pInterface, typeof(IVRTrackedCamera)); + } + public string GetCameraErrorNameFromEnum(EVRTrackedCameraError eCameraError) + { + IntPtr result = FnTable.GetCameraErrorNameFromEnum(eCameraError); + return Marshal.PtrToStringAnsi(result); + } + public EVRTrackedCameraError HasCamera(uint nDeviceIndex,ref bool pHasCamera) + { + pHasCamera = false; + EVRTrackedCameraError result = FnTable.HasCamera(nDeviceIndex,ref pHasCamera); + return result; + } + public EVRTrackedCameraError GetCameraFrameSize(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref uint pnWidth,ref uint pnHeight,ref uint pnFrameBufferSize) + { + pnWidth = 0; + pnHeight = 0; + pnFrameBufferSize = 0; + EVRTrackedCameraError result = FnTable.GetCameraFrameSize(nDeviceIndex,eFrameType,ref pnWidth,ref pnHeight,ref pnFrameBufferSize); + return result; + } + public EVRTrackedCameraError GetCameraIntrinsics(uint nDeviceIndex,uint nCameraIndex,EVRTrackedCameraFrameType eFrameType,ref HmdVector2_t pFocalLength,ref HmdVector2_t pCenter) + { + EVRTrackedCameraError result = FnTable.GetCameraIntrinsics(nDeviceIndex,nCameraIndex,eFrameType,ref pFocalLength,ref pCenter); + return result; + } + public EVRTrackedCameraError GetCameraProjection(uint nDeviceIndex,uint nCameraIndex,EVRTrackedCameraFrameType eFrameType,float flZNear,float flZFar,ref HmdMatrix44_t pProjection) + { + EVRTrackedCameraError result = FnTable.GetCameraProjection(nDeviceIndex,nCameraIndex,eFrameType,flZNear,flZFar,ref pProjection); + return result; + } + public EVRTrackedCameraError AcquireVideoStreamingService(uint nDeviceIndex,ref ulong pHandle) + { + pHandle = 0; + EVRTrackedCameraError result = FnTable.AcquireVideoStreamingService(nDeviceIndex,ref pHandle); + return result; + } + public EVRTrackedCameraError ReleaseVideoStreamingService(ulong hTrackedCamera) + { + EVRTrackedCameraError result = FnTable.ReleaseVideoStreamingService(hTrackedCamera); + return result; + } + public EVRTrackedCameraError GetVideoStreamFrameBuffer(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pFrameBuffer,uint nFrameBufferSize,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize) + { + EVRTrackedCameraError result = FnTable.GetVideoStreamFrameBuffer(hTrackedCamera,eFrameType,pFrameBuffer,nFrameBufferSize,ref pFrameHeader,nFrameHeaderSize); + return result; + } + public EVRTrackedCameraError GetVideoStreamTextureSize(uint nDeviceIndex,EVRTrackedCameraFrameType eFrameType,ref VRTextureBounds_t pTextureBounds,ref uint pnWidth,ref uint pnHeight) + { + pnWidth = 0; + pnHeight = 0; + EVRTrackedCameraError result = FnTable.GetVideoStreamTextureSize(nDeviceIndex,eFrameType,ref pTextureBounds,ref pnWidth,ref pnHeight); + return result; + } + public EVRTrackedCameraError GetVideoStreamTextureD3D11(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,IntPtr pD3D11DeviceOrResource,ref IntPtr ppD3D11ShaderResourceView,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize) + { + EVRTrackedCameraError result = FnTable.GetVideoStreamTextureD3D11(hTrackedCamera,eFrameType,pD3D11DeviceOrResource,ref ppD3D11ShaderResourceView,ref pFrameHeader,nFrameHeaderSize); + return result; + } + public EVRTrackedCameraError GetVideoStreamTextureGL(ulong hTrackedCamera,EVRTrackedCameraFrameType eFrameType,ref uint pglTextureId,ref CameraVideoStreamFrameHeader_t pFrameHeader,uint nFrameHeaderSize) + { + pglTextureId = 0; + EVRTrackedCameraError result = FnTable.GetVideoStreamTextureGL(hTrackedCamera,eFrameType,ref pglTextureId,ref pFrameHeader,nFrameHeaderSize); + return result; + } + public EVRTrackedCameraError ReleaseVideoStreamTextureGL(ulong hTrackedCamera,uint glTextureId) + { + EVRTrackedCameraError result = FnTable.ReleaseVideoStreamTextureGL(hTrackedCamera,glTextureId); + return result; + } + public void SetCameraTrackingSpace(ETrackingUniverseOrigin eUniverse) + { + FnTable.SetCameraTrackingSpace(eUniverse); + } + public ETrackingUniverseOrigin GetCameraTrackingSpace() + { + ETrackingUniverseOrigin result = FnTable.GetCameraTrackingSpace(); + return result; + } +} + + +public class CVRApplications +{ + IVRApplications FnTable; + internal CVRApplications(IntPtr pInterface) + { + FnTable = (IVRApplications)Marshal.PtrToStructure(pInterface, typeof(IVRApplications)); + } + public EVRApplicationError AddApplicationManifest(string pchApplicationManifestFullPath,bool bTemporary) + { + IntPtr pchApplicationManifestFullPathUtf8 = Utils.ToUtf8(pchApplicationManifestFullPath); + EVRApplicationError result = FnTable.AddApplicationManifest(pchApplicationManifestFullPathUtf8,bTemporary); + Marshal.FreeHGlobal(pchApplicationManifestFullPathUtf8); + return result; + } + public EVRApplicationError RemoveApplicationManifest(string pchApplicationManifestFullPath) + { + IntPtr pchApplicationManifestFullPathUtf8 = Utils.ToUtf8(pchApplicationManifestFullPath); + EVRApplicationError result = FnTable.RemoveApplicationManifest(pchApplicationManifestFullPathUtf8); + Marshal.FreeHGlobal(pchApplicationManifestFullPathUtf8); + return result; + } + public bool IsApplicationInstalled(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + bool result = FnTable.IsApplicationInstalled(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public uint GetApplicationCount() + { + uint result = FnTable.GetApplicationCount(); + return result; + } + public EVRApplicationError GetApplicationKeyByIndex(uint unApplicationIndex,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen) + { + EVRApplicationError result = FnTable.GetApplicationKeyByIndex(unApplicationIndex,pchAppKeyBuffer,unAppKeyBufferLen); + return result; + } + public EVRApplicationError GetApplicationKeyByProcessId(uint unProcessId,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen) + { + EVRApplicationError result = FnTable.GetApplicationKeyByProcessId(unProcessId,pchAppKeyBuffer,unAppKeyBufferLen); + return result; + } + public EVRApplicationError LaunchApplication(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRApplicationError result = FnTable.LaunchApplication(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public EVRApplicationError LaunchTemplateApplication(string pchTemplateAppKey,string pchNewAppKey,AppOverrideKeys_t [] pKeys) + { + IntPtr pchTemplateAppKeyUtf8 = Utils.ToUtf8(pchTemplateAppKey); + IntPtr pchNewAppKeyUtf8 = Utils.ToUtf8(pchNewAppKey); + EVRApplicationError result = FnTable.LaunchTemplateApplication(pchTemplateAppKeyUtf8,pchNewAppKeyUtf8,pKeys,(uint) pKeys.Length); + Marshal.FreeHGlobal(pchTemplateAppKeyUtf8); + Marshal.FreeHGlobal(pchNewAppKeyUtf8); + return result; + } + public EVRApplicationError LaunchApplicationFromMimeType(string pchMimeType,string pchArgs) + { + IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType); + IntPtr pchArgsUtf8 = Utils.ToUtf8(pchArgs); + EVRApplicationError result = FnTable.LaunchApplicationFromMimeType(pchMimeTypeUtf8,pchArgsUtf8); + Marshal.FreeHGlobal(pchMimeTypeUtf8); + Marshal.FreeHGlobal(pchArgsUtf8); + return result; + } + public EVRApplicationError LaunchDashboardOverlay(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRApplicationError result = FnTable.LaunchDashboardOverlay(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public bool CancelApplicationLaunch(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + bool result = FnTable.CancelApplicationLaunch(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public EVRApplicationError IdentifyApplication(uint unProcessId,string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRApplicationError result = FnTable.IdentifyApplication(unProcessId,pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public uint GetApplicationProcessId(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + uint result = FnTable.GetApplicationProcessId(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public string GetApplicationsErrorNameFromEnum(EVRApplicationError error) + { + IntPtr result = FnTable.GetApplicationsErrorNameFromEnum(error); + return Marshal.PtrToStringAnsi(result); + } + public uint GetApplicationPropertyString(string pchAppKey,EVRApplicationProperty eProperty,System.Text.StringBuilder pchPropertyValueBuffer,uint unPropertyValueBufferLen,ref EVRApplicationError peError) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + uint result = FnTable.GetApplicationPropertyString(pchAppKeyUtf8,eProperty,pchPropertyValueBuffer,unPropertyValueBufferLen,ref peError); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public bool GetApplicationPropertyBool(string pchAppKey,EVRApplicationProperty eProperty,ref EVRApplicationError peError) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + bool result = FnTable.GetApplicationPropertyBool(pchAppKeyUtf8,eProperty,ref peError); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public ulong GetApplicationPropertyUint64(string pchAppKey,EVRApplicationProperty eProperty,ref EVRApplicationError peError) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + ulong result = FnTable.GetApplicationPropertyUint64(pchAppKeyUtf8,eProperty,ref peError); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public EVRApplicationError SetApplicationAutoLaunch(string pchAppKey,bool bAutoLaunch) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRApplicationError result = FnTable.SetApplicationAutoLaunch(pchAppKeyUtf8,bAutoLaunch); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public bool GetApplicationAutoLaunch(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + bool result = FnTable.GetApplicationAutoLaunch(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public EVRApplicationError SetDefaultApplicationForMimeType(string pchAppKey,string pchMimeType) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType); + EVRApplicationError result = FnTable.SetDefaultApplicationForMimeType(pchAppKeyUtf8,pchMimeTypeUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchMimeTypeUtf8); + return result; + } + public bool GetDefaultApplicationForMimeType(string pchMimeType,System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen) + { + IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType); + bool result = FnTable.GetDefaultApplicationForMimeType(pchMimeTypeUtf8,pchAppKeyBuffer,unAppKeyBufferLen); + Marshal.FreeHGlobal(pchMimeTypeUtf8); + return result; + } + public bool GetApplicationSupportedMimeTypes(string pchAppKey,System.Text.StringBuilder pchMimeTypesBuffer,uint unMimeTypesBuffer) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + bool result = FnTable.GetApplicationSupportedMimeTypes(pchAppKeyUtf8,pchMimeTypesBuffer,unMimeTypesBuffer); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public uint GetApplicationsThatSupportMimeType(string pchMimeType,System.Text.StringBuilder pchAppKeysThatSupportBuffer,uint unAppKeysThatSupportBuffer) + { + IntPtr pchMimeTypeUtf8 = Utils.ToUtf8(pchMimeType); + uint result = FnTable.GetApplicationsThatSupportMimeType(pchMimeTypeUtf8,pchAppKeysThatSupportBuffer,unAppKeysThatSupportBuffer); + Marshal.FreeHGlobal(pchMimeTypeUtf8); + return result; + } + public uint GetApplicationLaunchArguments(uint unHandle,System.Text.StringBuilder pchArgs,uint unArgs) + { + uint result = FnTable.GetApplicationLaunchArguments(unHandle,pchArgs,unArgs); + return result; + } + public EVRApplicationError GetStartingApplication(System.Text.StringBuilder pchAppKeyBuffer,uint unAppKeyBufferLen) + { + EVRApplicationError result = FnTable.GetStartingApplication(pchAppKeyBuffer,unAppKeyBufferLen); + return result; + } + public EVRSceneApplicationState GetSceneApplicationState() + { + EVRSceneApplicationState result = FnTable.GetSceneApplicationState(); + return result; + } + public EVRApplicationError PerformApplicationPrelaunchCheck(string pchAppKey) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRApplicationError result = FnTable.PerformApplicationPrelaunchCheck(pchAppKeyUtf8); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public string GetSceneApplicationStateNameFromEnum(EVRSceneApplicationState state) + { + IntPtr result = FnTable.GetSceneApplicationStateNameFromEnum(state); + return Marshal.PtrToStringAnsi(result); + } + public EVRApplicationError LaunchInternalProcess(string pchBinaryPath,string pchArguments,string pchWorkingDirectory) + { + IntPtr pchBinaryPathUtf8 = Utils.ToUtf8(pchBinaryPath); + IntPtr pchArgumentsUtf8 = Utils.ToUtf8(pchArguments); + IntPtr pchWorkingDirectoryUtf8 = Utils.ToUtf8(pchWorkingDirectory); + EVRApplicationError result = FnTable.LaunchInternalProcess(pchBinaryPathUtf8,pchArgumentsUtf8,pchWorkingDirectoryUtf8); + Marshal.FreeHGlobal(pchBinaryPathUtf8); + Marshal.FreeHGlobal(pchArgumentsUtf8); + Marshal.FreeHGlobal(pchWorkingDirectoryUtf8); + return result; + } + public uint GetCurrentSceneProcessId() + { + uint result = FnTable.GetCurrentSceneProcessId(); + return result; + } +} + + +public class CVRChaperone +{ + IVRChaperone FnTable; + internal CVRChaperone(IntPtr pInterface) + { + FnTable = (IVRChaperone)Marshal.PtrToStructure(pInterface, typeof(IVRChaperone)); + } + public ChaperoneCalibrationState GetCalibrationState() + { + ChaperoneCalibrationState result = FnTable.GetCalibrationState(); + return result; + } + public bool GetPlayAreaSize(ref float pSizeX,ref float pSizeZ) + { + pSizeX = 0; + pSizeZ = 0; + bool result = FnTable.GetPlayAreaSize(ref pSizeX,ref pSizeZ); + return result; + } + public bool GetPlayAreaRect(ref HmdQuad_t rect) + { + bool result = FnTable.GetPlayAreaRect(ref rect); + return result; + } + public void ReloadInfo() + { + FnTable.ReloadInfo(); + } + public void SetSceneColor(HmdColor_t color) + { + FnTable.SetSceneColor(color); + } + public void GetBoundsColor(ref HmdColor_t pOutputColorArray,int nNumOutputColors,float flCollisionBoundsFadeDistance,ref HmdColor_t pOutputCameraColor) + { + FnTable.GetBoundsColor(ref pOutputColorArray,nNumOutputColors,flCollisionBoundsFadeDistance,ref pOutputCameraColor); + } + public bool AreBoundsVisible() + { + bool result = FnTable.AreBoundsVisible(); + return result; + } + public void ForceBoundsVisible(bool bForce) + { + FnTable.ForceBoundsVisible(bForce); + } + public void ResetZeroPose(ETrackingUniverseOrigin eTrackingUniverseOrigin) + { + FnTable.ResetZeroPose(eTrackingUniverseOrigin); + } +} + + +public class CVRChaperoneSetup +{ + IVRChaperoneSetup FnTable; + internal CVRChaperoneSetup(IntPtr pInterface) + { + FnTable = (IVRChaperoneSetup)Marshal.PtrToStructure(pInterface, typeof(IVRChaperoneSetup)); + } + public bool CommitWorkingCopy(EChaperoneConfigFile configFile) + { + bool result = FnTable.CommitWorkingCopy(configFile); + return result; + } + public void RevertWorkingCopy() + { + FnTable.RevertWorkingCopy(); + } + public bool GetWorkingPlayAreaSize(ref float pSizeX,ref float pSizeZ) + { + pSizeX = 0; + pSizeZ = 0; + bool result = FnTable.GetWorkingPlayAreaSize(ref pSizeX,ref pSizeZ); + return result; + } + public bool GetWorkingPlayAreaRect(ref HmdQuad_t rect) + { + bool result = FnTable.GetWorkingPlayAreaRect(ref rect); + return result; + } + public bool GetWorkingCollisionBoundsInfo(out HmdQuad_t [] pQuadsBuffer) + { + uint punQuadsCount = 0; + bool result = FnTable.GetWorkingCollisionBoundsInfo(null,ref punQuadsCount); + pQuadsBuffer= new HmdQuad_t[punQuadsCount]; + result = FnTable.GetWorkingCollisionBoundsInfo(pQuadsBuffer,ref punQuadsCount); + return result; + } + public bool GetLiveCollisionBoundsInfo(out HmdQuad_t [] pQuadsBuffer) + { + uint punQuadsCount = 0; + bool result = FnTable.GetLiveCollisionBoundsInfo(null,ref punQuadsCount); + pQuadsBuffer= new HmdQuad_t[punQuadsCount]; + result = FnTable.GetLiveCollisionBoundsInfo(pQuadsBuffer,ref punQuadsCount); + return result; + } + public bool GetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose) + { + bool result = FnTable.GetWorkingSeatedZeroPoseToRawTrackingPose(ref pmatSeatedZeroPoseToRawTrackingPose); + return result; + } + public bool GetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatStandingZeroPoseToRawTrackingPose) + { + bool result = FnTable.GetWorkingStandingZeroPoseToRawTrackingPose(ref pmatStandingZeroPoseToRawTrackingPose); + return result; + } + public void SetWorkingPlayAreaSize(float sizeX,float sizeZ) + { + FnTable.SetWorkingPlayAreaSize(sizeX,sizeZ); + } + public void SetWorkingCollisionBoundsInfo(HmdQuad_t [] pQuadsBuffer) + { + FnTable.SetWorkingCollisionBoundsInfo(pQuadsBuffer,(uint) pQuadsBuffer.Length); + } + public void SetWorkingPerimeter(HmdVector2_t [] pPointBuffer) + { + FnTable.SetWorkingPerimeter(pPointBuffer,(uint) pPointBuffer.Length); + } + public void SetWorkingSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatSeatedZeroPoseToRawTrackingPose) + { + FnTable.SetWorkingSeatedZeroPoseToRawTrackingPose(ref pMatSeatedZeroPoseToRawTrackingPose); + } + public void SetWorkingStandingZeroPoseToRawTrackingPose(ref HmdMatrix34_t pMatStandingZeroPoseToRawTrackingPose) + { + FnTable.SetWorkingStandingZeroPoseToRawTrackingPose(ref pMatStandingZeroPoseToRawTrackingPose); + } + public void ReloadFromDisk(EChaperoneConfigFile configFile) + { + FnTable.ReloadFromDisk(configFile); + } + public bool GetLiveSeatedZeroPoseToRawTrackingPose(ref HmdMatrix34_t pmatSeatedZeroPoseToRawTrackingPose) + { + bool result = FnTable.GetLiveSeatedZeroPoseToRawTrackingPose(ref pmatSeatedZeroPoseToRawTrackingPose); + return result; + } + public bool ExportLiveToBuffer(System.Text.StringBuilder pBuffer,ref uint pnBufferLength) + { + pnBufferLength = 0; + bool result = FnTable.ExportLiveToBuffer(pBuffer,ref pnBufferLength); + return result; + } + public bool ImportFromBufferToWorking(string pBuffer,uint nImportFlags) + { + IntPtr pBufferUtf8 = Utils.ToUtf8(pBuffer); + bool result = FnTable.ImportFromBufferToWorking(pBufferUtf8,nImportFlags); + Marshal.FreeHGlobal(pBufferUtf8); + return result; + } + public void ShowWorkingSetPreview() + { + FnTable.ShowWorkingSetPreview(); + } + public void HideWorkingSetPreview() + { + FnTable.HideWorkingSetPreview(); + } + public void RoomSetupStarting() + { + FnTable.RoomSetupStarting(); + } +} + + +public class CVRCompositor +{ + IVRCompositor FnTable; + internal CVRCompositor(IntPtr pInterface) + { + FnTable = (IVRCompositor)Marshal.PtrToStructure(pInterface, typeof(IVRCompositor)); + } + public void SetTrackingSpace(ETrackingUniverseOrigin eOrigin) + { + FnTable.SetTrackingSpace(eOrigin); + } + public ETrackingUniverseOrigin GetTrackingSpace() + { + ETrackingUniverseOrigin result = FnTable.GetTrackingSpace(); + return result; + } + public EVRCompositorError WaitGetPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray) + { + EVRCompositorError result = FnTable.WaitGetPoses(pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length); + return result; + } + public EVRCompositorError GetLastPoses(TrackedDevicePose_t [] pRenderPoseArray,TrackedDevicePose_t [] pGamePoseArray) + { + EVRCompositorError result = FnTable.GetLastPoses(pRenderPoseArray,(uint) pRenderPoseArray.Length,pGamePoseArray,(uint) pGamePoseArray.Length); + return result; + } + public EVRCompositorError GetLastPoseForTrackedDeviceIndex(uint unDeviceIndex,ref TrackedDevicePose_t pOutputPose,ref TrackedDevicePose_t pOutputGamePose) + { + EVRCompositorError result = FnTable.GetLastPoseForTrackedDeviceIndex(unDeviceIndex,ref pOutputPose,ref pOutputGamePose); + return result; + } + public EVRCompositorError Submit(EVREye eEye,ref Texture_t pTexture,ref VRTextureBounds_t pBounds,EVRSubmitFlags nSubmitFlags) + { + EVRCompositorError result = FnTable.Submit(eEye,ref pTexture,ref pBounds,nSubmitFlags); + return result; + } + public void ClearLastSubmittedFrame() + { + FnTable.ClearLastSubmittedFrame(); + } + public void PostPresentHandoff() + { + FnTable.PostPresentHandoff(); + } + public bool GetFrameTiming(ref Compositor_FrameTiming pTiming,uint unFramesAgo) + { + bool result = FnTable.GetFrameTiming(ref pTiming,unFramesAgo); + return result; + } + public uint GetFrameTimings(Compositor_FrameTiming [] pTiming) + { + uint result = FnTable.GetFrameTimings(pTiming,(uint) pTiming.Length); + return result; + } + public float GetFrameTimeRemaining() + { + float result = FnTable.GetFrameTimeRemaining(); + return result; + } + public void GetCumulativeStats(ref Compositor_CumulativeStats pStats,uint nStatsSizeInBytes) + { + FnTable.GetCumulativeStats(ref pStats,nStatsSizeInBytes); + } + public void FadeToColor(float fSeconds,float fRed,float fGreen,float fBlue,float fAlpha,bool bBackground) + { + FnTable.FadeToColor(fSeconds,fRed,fGreen,fBlue,fAlpha,bBackground); + } + public HmdColor_t GetCurrentFadeColor(bool bBackground) + { + HmdColor_t result = FnTable.GetCurrentFadeColor(bBackground); + return result; + } + public void FadeGrid(float fSeconds,bool bFadeGridIn) + { + FnTable.FadeGrid(fSeconds,bFadeGridIn); + } + public float GetCurrentGridAlpha() + { + float result = FnTable.GetCurrentGridAlpha(); + return result; + } + public EVRCompositorError SetSkyboxOverride(Texture_t [] pTextures) + { + EVRCompositorError result = FnTable.SetSkyboxOverride(pTextures,(uint) pTextures.Length); + return result; + } + public void ClearSkyboxOverride() + { + FnTable.ClearSkyboxOverride(); + } + public void CompositorBringToFront() + { + FnTable.CompositorBringToFront(); + } + public void CompositorGoToBack() + { + FnTable.CompositorGoToBack(); + } + public void CompositorQuit() + { + FnTable.CompositorQuit(); + } + public bool IsFullscreen() + { + bool result = FnTable.IsFullscreen(); + return result; + } + public uint GetCurrentSceneFocusProcess() + { + uint result = FnTable.GetCurrentSceneFocusProcess(); + return result; + } + public uint GetLastFrameRenderer() + { + uint result = FnTable.GetLastFrameRenderer(); + return result; + } + public bool CanRenderScene() + { + bool result = FnTable.CanRenderScene(); + return result; + } + public void ShowMirrorWindow() + { + FnTable.ShowMirrorWindow(); + } + public void HideMirrorWindow() + { + FnTable.HideMirrorWindow(); + } + public bool IsMirrorWindowVisible() + { + bool result = FnTable.IsMirrorWindowVisible(); + return result; + } + public void CompositorDumpImages() + { + FnTable.CompositorDumpImages(); + } + public bool ShouldAppRenderWithLowResources() + { + bool result = FnTable.ShouldAppRenderWithLowResources(); + return result; + } + public void ForceInterleavedReprojectionOn(bool bOverride) + { + FnTable.ForceInterleavedReprojectionOn(bOverride); + } + public void ForceReconnectProcess() + { + FnTable.ForceReconnectProcess(); + } + public void SuspendRendering(bool bSuspend) + { + FnTable.SuspendRendering(bSuspend); + } + public EVRCompositorError GetMirrorTextureD3D11(EVREye eEye,IntPtr pD3D11DeviceOrResource,ref IntPtr ppD3D11ShaderResourceView) + { + EVRCompositorError result = FnTable.GetMirrorTextureD3D11(eEye,pD3D11DeviceOrResource,ref ppD3D11ShaderResourceView); + return result; + } + public void ReleaseMirrorTextureD3D11(IntPtr pD3D11ShaderResourceView) + { + FnTable.ReleaseMirrorTextureD3D11(pD3D11ShaderResourceView); + } + public EVRCompositorError GetMirrorTextureGL(EVREye eEye,ref uint pglTextureId,IntPtr pglSharedTextureHandle) + { + pglTextureId = 0; + EVRCompositorError result = FnTable.GetMirrorTextureGL(eEye,ref pglTextureId,pglSharedTextureHandle); + return result; + } + public bool ReleaseSharedGLTexture(uint glTextureId,IntPtr glSharedTextureHandle) + { + bool result = FnTable.ReleaseSharedGLTexture(glTextureId,glSharedTextureHandle); + return result; + } + public void LockGLSharedTextureForAccess(IntPtr glSharedTextureHandle) + { + FnTable.LockGLSharedTextureForAccess(glSharedTextureHandle); + } + public void UnlockGLSharedTextureForAccess(IntPtr glSharedTextureHandle) + { + FnTable.UnlockGLSharedTextureForAccess(glSharedTextureHandle); + } + public uint GetVulkanInstanceExtensionsRequired(System.Text.StringBuilder pchValue,uint unBufferSize) + { + uint result = FnTable.GetVulkanInstanceExtensionsRequired(pchValue,unBufferSize); + return result; + } + public uint GetVulkanDeviceExtensionsRequired(IntPtr pPhysicalDevice,System.Text.StringBuilder pchValue,uint unBufferSize) + { + uint result = FnTable.GetVulkanDeviceExtensionsRequired(pPhysicalDevice,pchValue,unBufferSize); + return result; + } + public void SetExplicitTimingMode(EVRCompositorTimingMode eTimingMode) + { + FnTable.SetExplicitTimingMode(eTimingMode); + } + public EVRCompositorError SubmitExplicitTimingData() + { + EVRCompositorError result = FnTable.SubmitExplicitTimingData(); + return result; + } + public bool IsMotionSmoothingEnabled() + { + bool result = FnTable.IsMotionSmoothingEnabled(); + return result; + } + public bool IsMotionSmoothingSupported() + { + bool result = FnTable.IsMotionSmoothingSupported(); + return result; + } + public bool IsCurrentSceneFocusAppLoading() + { + bool result = FnTable.IsCurrentSceneFocusAppLoading(); + return result; + } + public EVRCompositorError SetStageOverride_Async(string pchRenderModelPath,ref HmdMatrix34_t pTransform,ref Compositor_StageRenderSettings pRenderSettings,uint nSizeOfRenderSettings) + { + IntPtr pchRenderModelPathUtf8 = Utils.ToUtf8(pchRenderModelPath); + EVRCompositorError result = FnTable.SetStageOverride_Async(pchRenderModelPathUtf8,ref pTransform,ref pRenderSettings,nSizeOfRenderSettings); + Marshal.FreeHGlobal(pchRenderModelPathUtf8); + return result; + } + public void ClearStageOverride() + { + FnTable.ClearStageOverride(); + } + public bool GetCompositorBenchmarkResults(ref Compositor_BenchmarkResults pBenchmarkResults,uint nSizeOfBenchmarkResults) + { + bool result = FnTable.GetCompositorBenchmarkResults(ref pBenchmarkResults,nSizeOfBenchmarkResults); + return result; + } + public EVRCompositorError GetLastPosePredictionIDs(ref uint pRenderPosePredictionID,ref uint pGamePosePredictionID) + { + pRenderPosePredictionID = 0; + pGamePosePredictionID = 0; + EVRCompositorError result = FnTable.GetLastPosePredictionIDs(ref pRenderPosePredictionID,ref pGamePosePredictionID); + return result; + } + public EVRCompositorError GetPosesForFrame(uint unPosePredictionID,TrackedDevicePose_t [] pPoseArray) + { + EVRCompositorError result = FnTable.GetPosesForFrame(unPosePredictionID,pPoseArray,(uint) pPoseArray.Length); + return result; + } +} + + +public class CVROverlay +{ + IVROverlay FnTable; + internal CVROverlay(IntPtr pInterface) + { + FnTable = (IVROverlay)Marshal.PtrToStructure(pInterface, typeof(IVROverlay)); + } + public EVROverlayError FindOverlay(string pchOverlayKey,ref ulong pOverlayHandle) + { + IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey); + pOverlayHandle = 0; + EVROverlayError result = FnTable.FindOverlay(pchOverlayKeyUtf8,ref pOverlayHandle); + Marshal.FreeHGlobal(pchOverlayKeyUtf8); + return result; + } + public EVROverlayError CreateOverlay(string pchOverlayKey,string pchOverlayName,ref ulong pOverlayHandle) + { + IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey); + IntPtr pchOverlayNameUtf8 = Utils.ToUtf8(pchOverlayName); + pOverlayHandle = 0; + EVROverlayError result = FnTable.CreateOverlay(pchOverlayKeyUtf8,pchOverlayNameUtf8,ref pOverlayHandle); + Marshal.FreeHGlobal(pchOverlayKeyUtf8); + Marshal.FreeHGlobal(pchOverlayNameUtf8); + return result; + } + public EVROverlayError DestroyOverlay(ulong ulOverlayHandle) + { + EVROverlayError result = FnTable.DestroyOverlay(ulOverlayHandle); + return result; + } + public uint GetOverlayKey(ulong ulOverlayHandle,System.Text.StringBuilder pchValue,uint unBufferSize,ref EVROverlayError pError) + { + uint result = FnTable.GetOverlayKey(ulOverlayHandle,pchValue,unBufferSize,ref pError); + return result; + } + public uint GetOverlayName(ulong ulOverlayHandle,System.Text.StringBuilder pchValue,uint unBufferSize,ref EVROverlayError pError) + { + uint result = FnTable.GetOverlayName(ulOverlayHandle,pchValue,unBufferSize,ref pError); + return result; + } + public EVROverlayError SetOverlayName(ulong ulOverlayHandle,string pchName) + { + IntPtr pchNameUtf8 = Utils.ToUtf8(pchName); + EVROverlayError result = FnTable.SetOverlayName(ulOverlayHandle,pchNameUtf8); + Marshal.FreeHGlobal(pchNameUtf8); + return result; + } + public EVROverlayError GetOverlayImageData(ulong ulOverlayHandle,IntPtr pvBuffer,uint unBufferSize,ref uint punWidth,ref uint punHeight) + { + punWidth = 0; + punHeight = 0; + EVROverlayError result = FnTable.GetOverlayImageData(ulOverlayHandle,pvBuffer,unBufferSize,ref punWidth,ref punHeight); + return result; + } + public string GetOverlayErrorNameFromEnum(EVROverlayError error) + { + IntPtr result = FnTable.GetOverlayErrorNameFromEnum(error); + return Marshal.PtrToStringAnsi(result); + } + public EVROverlayError SetOverlayRenderingPid(ulong ulOverlayHandle,uint unPID) + { + EVROverlayError result = FnTable.SetOverlayRenderingPid(ulOverlayHandle,unPID); + return result; + } + public uint GetOverlayRenderingPid(ulong ulOverlayHandle) + { + uint result = FnTable.GetOverlayRenderingPid(ulOverlayHandle); + return result; + } + public EVROverlayError SetOverlayFlag(ulong ulOverlayHandle,VROverlayFlags eOverlayFlag,bool bEnabled) + { + EVROverlayError result = FnTable.SetOverlayFlag(ulOverlayHandle,eOverlayFlag,bEnabled); + return result; + } + public EVROverlayError GetOverlayFlag(ulong ulOverlayHandle,VROverlayFlags eOverlayFlag,ref bool pbEnabled) + { + pbEnabled = false; + EVROverlayError result = FnTable.GetOverlayFlag(ulOverlayHandle,eOverlayFlag,ref pbEnabled); + return result; + } + public EVROverlayError GetOverlayFlags(ulong ulOverlayHandle,ref uint pFlags) + { + pFlags = 0; + EVROverlayError result = FnTable.GetOverlayFlags(ulOverlayHandle,ref pFlags); + return result; + } + public EVROverlayError SetOverlayColor(ulong ulOverlayHandle,float fRed,float fGreen,float fBlue) + { + EVROverlayError result = FnTable.SetOverlayColor(ulOverlayHandle,fRed,fGreen,fBlue); + return result; + } + public EVROverlayError GetOverlayColor(ulong ulOverlayHandle,ref float pfRed,ref float pfGreen,ref float pfBlue) + { + pfRed = 0; + pfGreen = 0; + pfBlue = 0; + EVROverlayError result = FnTable.GetOverlayColor(ulOverlayHandle,ref pfRed,ref pfGreen,ref pfBlue); + return result; + } + public EVROverlayError SetOverlayAlpha(ulong ulOverlayHandle,float fAlpha) + { + EVROverlayError result = FnTable.SetOverlayAlpha(ulOverlayHandle,fAlpha); + return result; + } + public EVROverlayError GetOverlayAlpha(ulong ulOverlayHandle,ref float pfAlpha) + { + pfAlpha = 0; + EVROverlayError result = FnTable.GetOverlayAlpha(ulOverlayHandle,ref pfAlpha); + return result; + } + public EVROverlayError SetOverlayTexelAspect(ulong ulOverlayHandle,float fTexelAspect) + { + EVROverlayError result = FnTable.SetOverlayTexelAspect(ulOverlayHandle,fTexelAspect); + return result; + } + public EVROverlayError GetOverlayTexelAspect(ulong ulOverlayHandle,ref float pfTexelAspect) + { + pfTexelAspect = 0; + EVROverlayError result = FnTable.GetOverlayTexelAspect(ulOverlayHandle,ref pfTexelAspect); + return result; + } + public EVROverlayError SetOverlaySortOrder(ulong ulOverlayHandle,uint unSortOrder) + { + EVROverlayError result = FnTable.SetOverlaySortOrder(ulOverlayHandle,unSortOrder); + return result; + } + public EVROverlayError GetOverlaySortOrder(ulong ulOverlayHandle,ref uint punSortOrder) + { + punSortOrder = 0; + EVROverlayError result = FnTable.GetOverlaySortOrder(ulOverlayHandle,ref punSortOrder); + return result; + } + public EVROverlayError SetOverlayWidthInMeters(ulong ulOverlayHandle,float fWidthInMeters) + { + EVROverlayError result = FnTable.SetOverlayWidthInMeters(ulOverlayHandle,fWidthInMeters); + return result; + } + public EVROverlayError GetOverlayWidthInMeters(ulong ulOverlayHandle,ref float pfWidthInMeters) + { + pfWidthInMeters = 0; + EVROverlayError result = FnTable.GetOverlayWidthInMeters(ulOverlayHandle,ref pfWidthInMeters); + return result; + } + public EVROverlayError SetOverlayCurvature(ulong ulOverlayHandle,float fCurvature) + { + EVROverlayError result = FnTable.SetOverlayCurvature(ulOverlayHandle,fCurvature); + return result; + } + public EVROverlayError GetOverlayCurvature(ulong ulOverlayHandle,ref float pfCurvature) + { + pfCurvature = 0; + EVROverlayError result = FnTable.GetOverlayCurvature(ulOverlayHandle,ref pfCurvature); + return result; + } + public EVROverlayError SetOverlayTextureColorSpace(ulong ulOverlayHandle,EColorSpace eTextureColorSpace) + { + EVROverlayError result = FnTable.SetOverlayTextureColorSpace(ulOverlayHandle,eTextureColorSpace); + return result; + } + public EVROverlayError GetOverlayTextureColorSpace(ulong ulOverlayHandle,ref EColorSpace peTextureColorSpace) + { + EVROverlayError result = FnTable.GetOverlayTextureColorSpace(ulOverlayHandle,ref peTextureColorSpace); + return result; + } + public EVROverlayError SetOverlayTextureBounds(ulong ulOverlayHandle,ref VRTextureBounds_t pOverlayTextureBounds) + { + EVROverlayError result = FnTable.SetOverlayTextureBounds(ulOverlayHandle,ref pOverlayTextureBounds); + return result; + } + public EVROverlayError GetOverlayTextureBounds(ulong ulOverlayHandle,ref VRTextureBounds_t pOverlayTextureBounds) + { + EVROverlayError result = FnTable.GetOverlayTextureBounds(ulOverlayHandle,ref pOverlayTextureBounds); + return result; + } + public EVROverlayError GetOverlayTransformType(ulong ulOverlayHandle,ref VROverlayTransformType peTransformType) + { + EVROverlayError result = FnTable.GetOverlayTransformType(ulOverlayHandle,ref peTransformType); + return result; + } + public EVROverlayError SetOverlayTransformAbsolute(ulong ulOverlayHandle,ETrackingUniverseOrigin eTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform) + { + EVROverlayError result = FnTable.SetOverlayTransformAbsolute(ulOverlayHandle,eTrackingOrigin,ref pmatTrackingOriginToOverlayTransform); + return result; + } + public EVROverlayError GetOverlayTransformAbsolute(ulong ulOverlayHandle,ref ETrackingUniverseOrigin peTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform) + { + EVROverlayError result = FnTable.GetOverlayTransformAbsolute(ulOverlayHandle,ref peTrackingOrigin,ref pmatTrackingOriginToOverlayTransform); + return result; + } + public EVROverlayError SetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle,uint unTrackedDevice,ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform) + { + EVROverlayError result = FnTable.SetOverlayTransformTrackedDeviceRelative(ulOverlayHandle,unTrackedDevice,ref pmatTrackedDeviceToOverlayTransform); + return result; + } + public EVROverlayError GetOverlayTransformTrackedDeviceRelative(ulong ulOverlayHandle,ref uint punTrackedDevice,ref HmdMatrix34_t pmatTrackedDeviceToOverlayTransform) + { + punTrackedDevice = 0; + EVROverlayError result = FnTable.GetOverlayTransformTrackedDeviceRelative(ulOverlayHandle,ref punTrackedDevice,ref pmatTrackedDeviceToOverlayTransform); + return result; + } + public EVROverlayError SetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle,uint unDeviceIndex,string pchComponentName) + { + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + EVROverlayError result = FnTable.SetOverlayTransformTrackedDeviceComponent(ulOverlayHandle,unDeviceIndex,pchComponentNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public EVROverlayError GetOverlayTransformTrackedDeviceComponent(ulong ulOverlayHandle,ref uint punDeviceIndex,System.Text.StringBuilder pchComponentName,uint unComponentNameSize) + { + punDeviceIndex = 0; + EVROverlayError result = FnTable.GetOverlayTransformTrackedDeviceComponent(ulOverlayHandle,ref punDeviceIndex,pchComponentName,unComponentNameSize); + return result; + } + public EVROverlayError GetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ref ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform) + { + ulOverlayHandleParent = 0; + EVROverlayError result = FnTable.GetOverlayTransformOverlayRelative(ulOverlayHandle,ref ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform); + return result; + } + public EVROverlayError SetOverlayTransformOverlayRelative(ulong ulOverlayHandle,ulong ulOverlayHandleParent,ref HmdMatrix34_t pmatParentOverlayToOverlayTransform) + { + EVROverlayError result = FnTable.SetOverlayTransformOverlayRelative(ulOverlayHandle,ulOverlayHandleParent,ref pmatParentOverlayToOverlayTransform); + return result; + } + public EVROverlayError SetOverlayTransformCursor(ulong ulCursorOverlayHandle,ref HmdVector2_t pvHotspot) + { + EVROverlayError result = FnTable.SetOverlayTransformCursor(ulCursorOverlayHandle,ref pvHotspot); + return result; + } + public EVROverlayError GetOverlayTransformCursor(ulong ulOverlayHandle,ref HmdVector2_t pvHotspot) + { + EVROverlayError result = FnTable.GetOverlayTransformCursor(ulOverlayHandle,ref pvHotspot); + return result; + } + public EVROverlayError SetOverlayTransformProjection(ulong ulOverlayHandle,ETrackingUniverseOrigin eTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToOverlayTransform,ref VROverlayProjection_t pProjection,EVREye eEye) + { + EVROverlayError result = FnTable.SetOverlayTransformProjection(ulOverlayHandle,eTrackingOrigin,ref pmatTrackingOriginToOverlayTransform,ref pProjection,eEye); + return result; + } + public EVROverlayError ShowOverlay(ulong ulOverlayHandle) + { + EVROverlayError result = FnTable.ShowOverlay(ulOverlayHandle); + return result; + } + public EVROverlayError HideOverlay(ulong ulOverlayHandle) + { + EVROverlayError result = FnTable.HideOverlay(ulOverlayHandle); + return result; + } + public bool IsOverlayVisible(ulong ulOverlayHandle) + { + bool result = FnTable.IsOverlayVisible(ulOverlayHandle); + return result; + } + public EVROverlayError GetTransformForOverlayCoordinates(ulong ulOverlayHandle,ETrackingUniverseOrigin eTrackingOrigin,HmdVector2_t coordinatesInOverlay,ref HmdMatrix34_t pmatTransform) + { + EVROverlayError result = FnTable.GetTransformForOverlayCoordinates(ulOverlayHandle,eTrackingOrigin,coordinatesInOverlay,ref pmatTransform); + return result; + } +// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were +// originally mis-compiled with the wrong packing for Linux and OSX. + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _PollNextOverlayEventPacked(ulong ulOverlayHandle,ref VREvent_t_Packed pEvent,uint uncbVREvent); + [StructLayout(LayoutKind.Explicit)] + struct PollNextOverlayEventUnion + { + [FieldOffset(0)] + public IVROverlay._PollNextOverlayEvent pPollNextOverlayEvent; + [FieldOffset(0)] + public _PollNextOverlayEventPacked pPollNextOverlayEventPacked; + } + public bool PollNextOverlayEvent(ulong ulOverlayHandle,ref VREvent_t pEvent,uint uncbVREvent) + { +#if !UNITY_METRO + if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || + (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) + { + PollNextOverlayEventUnion u; + VREvent_t_Packed event_packed = new VREvent_t_Packed(); + u.pPollNextOverlayEventPacked = null; + u.pPollNextOverlayEvent = FnTable.PollNextOverlayEvent; + bool packed_result = u.pPollNextOverlayEventPacked(ulOverlayHandle,ref event_packed,(uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(VREvent_t_Packed))); + + event_packed.Unpack(ref pEvent); + return packed_result; + } +#endif + bool result = FnTable.PollNextOverlayEvent(ulOverlayHandle,ref pEvent,uncbVREvent); + return result; + } + public EVROverlayError GetOverlayInputMethod(ulong ulOverlayHandle,ref VROverlayInputMethod peInputMethod) + { + EVROverlayError result = FnTable.GetOverlayInputMethod(ulOverlayHandle,ref peInputMethod); + return result; + } + public EVROverlayError SetOverlayInputMethod(ulong ulOverlayHandle,VROverlayInputMethod eInputMethod) + { + EVROverlayError result = FnTable.SetOverlayInputMethod(ulOverlayHandle,eInputMethod); + return result; + } + public EVROverlayError GetOverlayMouseScale(ulong ulOverlayHandle,ref HmdVector2_t pvecMouseScale) + { + EVROverlayError result = FnTable.GetOverlayMouseScale(ulOverlayHandle,ref pvecMouseScale); + return result; + } + public EVROverlayError SetOverlayMouseScale(ulong ulOverlayHandle,ref HmdVector2_t pvecMouseScale) + { + EVROverlayError result = FnTable.SetOverlayMouseScale(ulOverlayHandle,ref pvecMouseScale); + return result; + } + public bool ComputeOverlayIntersection(ulong ulOverlayHandle,ref VROverlayIntersectionParams_t pParams,ref VROverlayIntersectionResults_t pResults) + { + bool result = FnTable.ComputeOverlayIntersection(ulOverlayHandle,ref pParams,ref pResults); + return result; + } + public bool IsHoverTargetOverlay(ulong ulOverlayHandle) + { + bool result = FnTable.IsHoverTargetOverlay(ulOverlayHandle); + return result; + } + public EVROverlayError SetOverlayIntersectionMask(ulong ulOverlayHandle,ref VROverlayIntersectionMaskPrimitive_t pMaskPrimitives,uint unNumMaskPrimitives,uint unPrimitiveSize) + { + EVROverlayError result = FnTable.SetOverlayIntersectionMask(ulOverlayHandle,ref pMaskPrimitives,unNumMaskPrimitives,unPrimitiveSize); + return result; + } + public EVROverlayError TriggerLaserMouseHapticVibration(ulong ulOverlayHandle,float fDurationSeconds,float fFrequency,float fAmplitude) + { + EVROverlayError result = FnTable.TriggerLaserMouseHapticVibration(ulOverlayHandle,fDurationSeconds,fFrequency,fAmplitude); + return result; + } + public EVROverlayError SetOverlayCursor(ulong ulOverlayHandle,ulong ulCursorHandle) + { + EVROverlayError result = FnTable.SetOverlayCursor(ulOverlayHandle,ulCursorHandle); + return result; + } + public EVROverlayError SetOverlayCursorPositionOverride(ulong ulOverlayHandle,ref HmdVector2_t pvCursor) + { + EVROverlayError result = FnTable.SetOverlayCursorPositionOverride(ulOverlayHandle,ref pvCursor); + return result; + } + public EVROverlayError ClearOverlayCursorPositionOverride(ulong ulOverlayHandle) + { + EVROverlayError result = FnTable.ClearOverlayCursorPositionOverride(ulOverlayHandle); + return result; + } + public EVROverlayError SetOverlayTexture(ulong ulOverlayHandle,ref Texture_t pTexture) + { + EVROverlayError result = FnTable.SetOverlayTexture(ulOverlayHandle,ref pTexture); + return result; + } + public EVROverlayError ClearOverlayTexture(ulong ulOverlayHandle) + { + EVROverlayError result = FnTable.ClearOverlayTexture(ulOverlayHandle); + return result; + } + public EVROverlayError SetOverlayRaw(ulong ulOverlayHandle,IntPtr pvBuffer,uint unWidth,uint unHeight,uint unBytesPerPixel) + { + EVROverlayError result = FnTable.SetOverlayRaw(ulOverlayHandle,pvBuffer,unWidth,unHeight,unBytesPerPixel); + return result; + } + public EVROverlayError SetOverlayFromFile(ulong ulOverlayHandle,string pchFilePath) + { + IntPtr pchFilePathUtf8 = Utils.ToUtf8(pchFilePath); + EVROverlayError result = FnTable.SetOverlayFromFile(ulOverlayHandle,pchFilePathUtf8); + Marshal.FreeHGlobal(pchFilePathUtf8); + return result; + } + public EVROverlayError GetOverlayTexture(ulong ulOverlayHandle,ref IntPtr pNativeTextureHandle,IntPtr pNativeTextureRef,ref uint pWidth,ref uint pHeight,ref uint pNativeFormat,ref ETextureType pAPIType,ref EColorSpace pColorSpace,ref VRTextureBounds_t pTextureBounds) + { + pWidth = 0; + pHeight = 0; + pNativeFormat = 0; + EVROverlayError result = FnTable.GetOverlayTexture(ulOverlayHandle,ref pNativeTextureHandle,pNativeTextureRef,ref pWidth,ref pHeight,ref pNativeFormat,ref pAPIType,ref pColorSpace,ref pTextureBounds); + return result; + } + public EVROverlayError ReleaseNativeOverlayHandle(ulong ulOverlayHandle,IntPtr pNativeTextureHandle) + { + EVROverlayError result = FnTable.ReleaseNativeOverlayHandle(ulOverlayHandle,pNativeTextureHandle); + return result; + } + public EVROverlayError GetOverlayTextureSize(ulong ulOverlayHandle,ref uint pWidth,ref uint pHeight) + { + pWidth = 0; + pHeight = 0; + EVROverlayError result = FnTable.GetOverlayTextureSize(ulOverlayHandle,ref pWidth,ref pHeight); + return result; + } + public EVROverlayError CreateDashboardOverlay(string pchOverlayKey,string pchOverlayFriendlyName,ref ulong pMainHandle,ref ulong pThumbnailHandle) + { + IntPtr pchOverlayKeyUtf8 = Utils.ToUtf8(pchOverlayKey); + IntPtr pchOverlayFriendlyNameUtf8 = Utils.ToUtf8(pchOverlayFriendlyName); + pMainHandle = 0; + pThumbnailHandle = 0; + EVROverlayError result = FnTable.CreateDashboardOverlay(pchOverlayKeyUtf8,pchOverlayFriendlyNameUtf8,ref pMainHandle,ref pThumbnailHandle); + Marshal.FreeHGlobal(pchOverlayKeyUtf8); + Marshal.FreeHGlobal(pchOverlayFriendlyNameUtf8); + return result; + } + public bool IsDashboardVisible() + { + bool result = FnTable.IsDashboardVisible(); + return result; + } + public bool IsActiveDashboardOverlay(ulong ulOverlayHandle) + { + bool result = FnTable.IsActiveDashboardOverlay(ulOverlayHandle); + return result; + } + public EVROverlayError SetDashboardOverlaySceneProcess(ulong ulOverlayHandle,uint unProcessId) + { + EVROverlayError result = FnTable.SetDashboardOverlaySceneProcess(ulOverlayHandle,unProcessId); + return result; + } + public EVROverlayError GetDashboardOverlaySceneProcess(ulong ulOverlayHandle,ref uint punProcessId) + { + punProcessId = 0; + EVROverlayError result = FnTable.GetDashboardOverlaySceneProcess(ulOverlayHandle,ref punProcessId); + return result; + } + public void ShowDashboard(string pchOverlayToShow) + { + IntPtr pchOverlayToShowUtf8 = Utils.ToUtf8(pchOverlayToShow); + FnTable.ShowDashboard(pchOverlayToShowUtf8); + Marshal.FreeHGlobal(pchOverlayToShowUtf8); + } + public uint GetPrimaryDashboardDevice() + { + uint result = FnTable.GetPrimaryDashboardDevice(); + return result; + } + public EVROverlayError ShowKeyboard(int eInputMode,int eLineInputMode,uint unFlags,string pchDescription,uint unCharMax,string pchExistingText,ulong uUserValue) + { + IntPtr pchDescriptionUtf8 = Utils.ToUtf8(pchDescription); + IntPtr pchExistingTextUtf8 = Utils.ToUtf8(pchExistingText); + EVROverlayError result = FnTable.ShowKeyboard(eInputMode,eLineInputMode,unFlags,pchDescriptionUtf8,unCharMax,pchExistingTextUtf8,uUserValue); + Marshal.FreeHGlobal(pchDescriptionUtf8); + Marshal.FreeHGlobal(pchExistingTextUtf8); + return result; + } + public EVROverlayError ShowKeyboardForOverlay(ulong ulOverlayHandle,int eInputMode,int eLineInputMode,uint unFlags,string pchDescription,uint unCharMax,string pchExistingText,ulong uUserValue) + { + IntPtr pchDescriptionUtf8 = Utils.ToUtf8(pchDescription); + IntPtr pchExistingTextUtf8 = Utils.ToUtf8(pchExistingText); + EVROverlayError result = FnTable.ShowKeyboardForOverlay(ulOverlayHandle,eInputMode,eLineInputMode,unFlags,pchDescriptionUtf8,unCharMax,pchExistingTextUtf8,uUserValue); + Marshal.FreeHGlobal(pchDescriptionUtf8); + Marshal.FreeHGlobal(pchExistingTextUtf8); + return result; + } + public uint GetKeyboardText(System.Text.StringBuilder pchText,uint cchText) + { + uint result = FnTable.GetKeyboardText(pchText,cchText); + return result; + } + public void HideKeyboard() + { + FnTable.HideKeyboard(); + } + public void SetKeyboardTransformAbsolute(ETrackingUniverseOrigin eTrackingOrigin,ref HmdMatrix34_t pmatTrackingOriginToKeyboardTransform) + { + FnTable.SetKeyboardTransformAbsolute(eTrackingOrigin,ref pmatTrackingOriginToKeyboardTransform); + } + public void SetKeyboardPositionForOverlay(ulong ulOverlayHandle,HmdRect2_t avoidRect) + { + FnTable.SetKeyboardPositionForOverlay(ulOverlayHandle,avoidRect); + } + public VRMessageOverlayResponse ShowMessageOverlay(string pchText,string pchCaption,string pchButton0Text,string pchButton1Text,string pchButton2Text,string pchButton3Text) + { + IntPtr pchTextUtf8 = Utils.ToUtf8(pchText); + IntPtr pchCaptionUtf8 = Utils.ToUtf8(pchCaption); + IntPtr pchButton0TextUtf8 = Utils.ToUtf8(pchButton0Text); + IntPtr pchButton1TextUtf8 = Utils.ToUtf8(pchButton1Text); + IntPtr pchButton2TextUtf8 = Utils.ToUtf8(pchButton2Text); + IntPtr pchButton3TextUtf8 = Utils.ToUtf8(pchButton3Text); + VRMessageOverlayResponse result = FnTable.ShowMessageOverlay(pchTextUtf8,pchCaptionUtf8,pchButton0TextUtf8,pchButton1TextUtf8,pchButton2TextUtf8,pchButton3TextUtf8); + Marshal.FreeHGlobal(pchTextUtf8); + Marshal.FreeHGlobal(pchCaptionUtf8); + Marshal.FreeHGlobal(pchButton0TextUtf8); + Marshal.FreeHGlobal(pchButton1TextUtf8); + Marshal.FreeHGlobal(pchButton2TextUtf8); + Marshal.FreeHGlobal(pchButton3TextUtf8); + return result; + } + public void CloseMessageOverlay() + { + FnTable.CloseMessageOverlay(); + } +} + + +public class CVROverlayView +{ + IVROverlayView FnTable; + internal CVROverlayView(IntPtr pInterface) + { + FnTable = (IVROverlayView)Marshal.PtrToStructure(pInterface, typeof(IVROverlayView)); + } + public EVROverlayError AcquireOverlayView(ulong ulOverlayHandle,ref VRNativeDevice_t pNativeDevice,ref VROverlayView_t pOverlayView,uint unOverlayViewSize) + { + EVROverlayError result = FnTable.AcquireOverlayView(ulOverlayHandle,ref pNativeDevice,ref pOverlayView,unOverlayViewSize); + return result; + } + public EVROverlayError ReleaseOverlayView(ref VROverlayView_t pOverlayView) + { + EVROverlayError result = FnTable.ReleaseOverlayView(ref pOverlayView); + return result; + } + public void PostOverlayEvent(ulong ulOverlayHandle,ref VREvent_t pvrEvent) + { + FnTable.PostOverlayEvent(ulOverlayHandle,ref pvrEvent); + } + public bool IsViewingPermitted(ulong ulOverlayHandle) + { + bool result = FnTable.IsViewingPermitted(ulOverlayHandle); + return result; + } +} + + +public class CVRHeadsetView +{ + IVRHeadsetView FnTable; + internal CVRHeadsetView(IntPtr pInterface) + { + FnTable = (IVRHeadsetView)Marshal.PtrToStructure(pInterface, typeof(IVRHeadsetView)); + } + public void SetHeadsetViewSize(uint nWidth,uint nHeight) + { + FnTable.SetHeadsetViewSize(nWidth,nHeight); + } + public void GetHeadsetViewSize(ref uint pnWidth,ref uint pnHeight) + { + pnWidth = 0; + pnHeight = 0; + FnTable.GetHeadsetViewSize(ref pnWidth,ref pnHeight); + } + public void SetHeadsetViewMode(uint eHeadsetViewMode) + { + FnTable.SetHeadsetViewMode(eHeadsetViewMode); + } + public uint GetHeadsetViewMode() + { + uint result = FnTable.GetHeadsetViewMode(); + return result; + } + public void SetHeadsetViewCropped(bool bCropped) + { + FnTable.SetHeadsetViewCropped(bCropped); + } + public bool GetHeadsetViewCropped() + { + bool result = FnTable.GetHeadsetViewCropped(); + return result; + } + public float GetHeadsetViewAspectRatio() + { + float result = FnTable.GetHeadsetViewAspectRatio(); + return result; + } + public void SetHeadsetViewBlendRange(float flStartPct,float flEndPct) + { + FnTable.SetHeadsetViewBlendRange(flStartPct,flEndPct); + } + public void GetHeadsetViewBlendRange(ref float pStartPct,ref float pEndPct) + { + pStartPct = 0; + pEndPct = 0; + FnTable.GetHeadsetViewBlendRange(ref pStartPct,ref pEndPct); + } +} + + +public class CVRRenderModels +{ + IVRRenderModels FnTable; + internal CVRRenderModels(IntPtr pInterface) + { + FnTable = (IVRRenderModels)Marshal.PtrToStructure(pInterface, typeof(IVRRenderModels)); + } + public EVRRenderModelError LoadRenderModel_Async(string pchRenderModelName,ref IntPtr ppRenderModel) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + EVRRenderModelError result = FnTable.LoadRenderModel_Async(pchRenderModelNameUtf8,ref ppRenderModel); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + return result; + } + public void FreeRenderModel(IntPtr pRenderModel) + { + FnTable.FreeRenderModel(pRenderModel); + } + public EVRRenderModelError LoadTexture_Async(int textureId,ref IntPtr ppTexture) + { + EVRRenderModelError result = FnTable.LoadTexture_Async(textureId,ref ppTexture); + return result; + } + public void FreeTexture(IntPtr pTexture) + { + FnTable.FreeTexture(pTexture); + } + public EVRRenderModelError LoadTextureD3D11_Async(int textureId,IntPtr pD3D11Device,ref IntPtr ppD3D11Texture2D) + { + EVRRenderModelError result = FnTable.LoadTextureD3D11_Async(textureId,pD3D11Device,ref ppD3D11Texture2D); + return result; + } + public EVRRenderModelError LoadIntoTextureD3D11_Async(int textureId,IntPtr pDstTexture) + { + EVRRenderModelError result = FnTable.LoadIntoTextureD3D11_Async(textureId,pDstTexture); + return result; + } + public void FreeTextureD3D11(IntPtr pD3D11Texture2D) + { + FnTable.FreeTextureD3D11(pD3D11Texture2D); + } + public uint GetRenderModelName(uint unRenderModelIndex,System.Text.StringBuilder pchRenderModelName,uint unRenderModelNameLen) + { + uint result = FnTable.GetRenderModelName(unRenderModelIndex,pchRenderModelName,unRenderModelNameLen); + return result; + } + public uint GetRenderModelCount() + { + uint result = FnTable.GetRenderModelCount(); + return result; + } + public uint GetComponentCount(string pchRenderModelName) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + uint result = FnTable.GetComponentCount(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + return result; + } + public uint GetComponentName(string pchRenderModelName,uint unComponentIndex,System.Text.StringBuilder pchComponentName,uint unComponentNameLen) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + uint result = FnTable.GetComponentName(pchRenderModelNameUtf8,unComponentIndex,pchComponentName,unComponentNameLen); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + return result; + } + public ulong GetComponentButtonMask(string pchRenderModelName,string pchComponentName) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + ulong result = FnTable.GetComponentButtonMask(pchRenderModelNameUtf8,pchComponentNameUtf8); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public uint GetComponentRenderModelName(string pchRenderModelName,string pchComponentName,System.Text.StringBuilder pchComponentRenderModelName,uint unComponentRenderModelNameLen) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + uint result = FnTable.GetComponentRenderModelName(pchRenderModelNameUtf8,pchComponentNameUtf8,pchComponentRenderModelName,unComponentRenderModelNameLen); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public bool GetComponentStateForDevicePath(string pchRenderModelName,string pchComponentName,ulong devicePath,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + bool result = FnTable.GetComponentStateForDevicePath(pchRenderModelNameUtf8,pchComponentNameUtf8,devicePath,ref pState,ref pComponentState); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } +// This is a terrible hack to workaround the fact that VRControllerState_t and VREvent_t were +// originally mis-compiled with the wrong packing for Linux and OSX. + [UnmanagedFunctionPointer(CallingConvention.StdCall)] + internal delegate bool _GetComponentStatePacked(IntPtr pchRenderModelName,IntPtr pchComponentName,ref VRControllerState_t_Packed pControllerState,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState); + [StructLayout(LayoutKind.Explicit)] + struct GetComponentStateUnion + { + [FieldOffset(0)] + public IVRRenderModels._GetComponentState pGetComponentState; + [FieldOffset(0)] + public _GetComponentStatePacked pGetComponentStatePacked; + } + public bool GetComponentState(string pchRenderModelName,string pchComponentName,ref VRControllerState_t pControllerState,ref RenderModel_ControllerMode_State_t pState,ref RenderModel_ComponentState_t pComponentState) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); +#if !UNITY_METRO + if ((System.Environment.OSVersion.Platform == System.PlatformID.MacOSX) || + (System.Environment.OSVersion.Platform == System.PlatformID.Unix)) + { + GetComponentStateUnion u; + VRControllerState_t_Packed state_packed = new VRControllerState_t_Packed(pControllerState); + u.pGetComponentStatePacked = null; + u.pGetComponentState = FnTable.GetComponentState; + bool packed_result = u.pGetComponentStatePacked(pchRenderModelNameUtf8,pchComponentNameUtf8,ref state_packed,ref pState,ref pComponentState); + + state_packed.Unpack(ref pControllerState); + return packed_result; + } +#endif + bool result = FnTable.GetComponentState(pchRenderModelNameUtf8,pchComponentNameUtf8,ref pControllerState,ref pState,ref pComponentState); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public bool RenderModelHasComponent(string pchRenderModelName,string pchComponentName) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + bool result = FnTable.RenderModelHasComponent(pchRenderModelNameUtf8,pchComponentNameUtf8); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public uint GetRenderModelThumbnailURL(string pchRenderModelName,System.Text.StringBuilder pchThumbnailURL,uint unThumbnailURLLen,ref EVRRenderModelError peError) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + uint result = FnTable.GetRenderModelThumbnailURL(pchRenderModelNameUtf8,pchThumbnailURL,unThumbnailURLLen,ref peError); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + return result; + } + public uint GetRenderModelOriginalPath(string pchRenderModelName,System.Text.StringBuilder pchOriginalPath,uint unOriginalPathLen,ref EVRRenderModelError peError) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + uint result = FnTable.GetRenderModelOriginalPath(pchRenderModelNameUtf8,pchOriginalPath,unOriginalPathLen,ref peError); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + return result; + } + public string GetRenderModelErrorNameFromEnum(EVRRenderModelError error) + { + IntPtr result = FnTable.GetRenderModelErrorNameFromEnum(error); + return Marshal.PtrToStringAnsi(result); + } +} + + +public class CVRNotifications +{ + IVRNotifications FnTable; + internal CVRNotifications(IntPtr pInterface) + { + FnTable = (IVRNotifications)Marshal.PtrToStructure(pInterface, typeof(IVRNotifications)); + } + public EVRNotificationError CreateNotification(ulong ulOverlayHandle,ulong ulUserValue,EVRNotificationType type,string pchText,EVRNotificationStyle style,ref NotificationBitmap_t pImage,ref uint pNotificationId) + { + IntPtr pchTextUtf8 = Utils.ToUtf8(pchText); + pNotificationId = 0; + EVRNotificationError result = FnTable.CreateNotification(ulOverlayHandle,ulUserValue,type,pchTextUtf8,style,ref pImage,ref pNotificationId); + Marshal.FreeHGlobal(pchTextUtf8); + return result; + } + public EVRNotificationError RemoveNotification(uint notificationId) + { + EVRNotificationError result = FnTable.RemoveNotification(notificationId); + return result; + } +} + + +public class CVRSettings +{ + IVRSettings FnTable; + internal CVRSettings(IntPtr pInterface) + { + FnTable = (IVRSettings)Marshal.PtrToStructure(pInterface, typeof(IVRSettings)); + } + public string GetSettingsErrorNameFromEnum(EVRSettingsError eError) + { + IntPtr result = FnTable.GetSettingsErrorNameFromEnum(eError); + return Marshal.PtrToStringAnsi(result); + } + public void SetBool(string pchSection,string pchSettingsKey,bool bValue,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + FnTable.SetBool(pchSectionUtf8,pchSettingsKeyUtf8,bValue,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + } + public void SetInt32(string pchSection,string pchSettingsKey,int nValue,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + FnTable.SetInt32(pchSectionUtf8,pchSettingsKeyUtf8,nValue,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + } + public void SetFloat(string pchSection,string pchSettingsKey,float flValue,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + FnTable.SetFloat(pchSectionUtf8,pchSettingsKeyUtf8,flValue,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + } + public void SetString(string pchSection,string pchSettingsKey,string pchValue,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + IntPtr pchValueUtf8 = Utils.ToUtf8(pchValue); + FnTable.SetString(pchSectionUtf8,pchSettingsKeyUtf8,pchValueUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + Marshal.FreeHGlobal(pchValueUtf8); + } + public bool GetBool(string pchSection,string pchSettingsKey,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + bool result = FnTable.GetBool(pchSectionUtf8,pchSettingsKeyUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + return result; + } + public int GetInt32(string pchSection,string pchSettingsKey,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + int result = FnTable.GetInt32(pchSectionUtf8,pchSettingsKeyUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + return result; + } + public float GetFloat(string pchSection,string pchSettingsKey,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + float result = FnTable.GetFloat(pchSectionUtf8,pchSettingsKeyUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + return result; + } + public void GetString(string pchSection,string pchSettingsKey,System.Text.StringBuilder pchValue,uint unValueLen,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + FnTable.GetString(pchSectionUtf8,pchSettingsKeyUtf8,pchValue,unValueLen,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + } + public void RemoveSection(string pchSection,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + FnTable.RemoveSection(pchSectionUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + } + public void RemoveKeyInSection(string pchSection,string pchSettingsKey,ref EVRSettingsError peError) + { + IntPtr pchSectionUtf8 = Utils.ToUtf8(pchSection); + IntPtr pchSettingsKeyUtf8 = Utils.ToUtf8(pchSettingsKey); + FnTable.RemoveKeyInSection(pchSectionUtf8,pchSettingsKeyUtf8,ref peError); + Marshal.FreeHGlobal(pchSectionUtf8); + Marshal.FreeHGlobal(pchSettingsKeyUtf8); + } +} + + +public class CVRScreenshots +{ + IVRScreenshots FnTable; + internal CVRScreenshots(IntPtr pInterface) + { + FnTable = (IVRScreenshots)Marshal.PtrToStructure(pInterface, typeof(IVRScreenshots)); + } + public EVRScreenshotError RequestScreenshot(ref uint pOutScreenshotHandle,EVRScreenshotType type,string pchPreviewFilename,string pchVRFilename) + { + pOutScreenshotHandle = 0; + IntPtr pchPreviewFilenameUtf8 = Utils.ToUtf8(pchPreviewFilename); + IntPtr pchVRFilenameUtf8 = Utils.ToUtf8(pchVRFilename); + EVRScreenshotError result = FnTable.RequestScreenshot(ref pOutScreenshotHandle,type,pchPreviewFilenameUtf8,pchVRFilenameUtf8); + Marshal.FreeHGlobal(pchPreviewFilenameUtf8); + Marshal.FreeHGlobal(pchVRFilenameUtf8); + return result; + } + public EVRScreenshotError HookScreenshot(EVRScreenshotType [] pSupportedTypes) + { + EVRScreenshotError result = FnTable.HookScreenshot(pSupportedTypes,(int) pSupportedTypes.Length); + return result; + } + public EVRScreenshotType GetScreenshotPropertyType(uint screenshotHandle,ref EVRScreenshotError pError) + { + EVRScreenshotType result = FnTable.GetScreenshotPropertyType(screenshotHandle,ref pError); + return result; + } + public uint GetScreenshotPropertyFilename(uint screenshotHandle,EVRScreenshotPropertyFilenames filenameType,System.Text.StringBuilder pchFilename,uint cchFilename,ref EVRScreenshotError pError) + { + uint result = FnTable.GetScreenshotPropertyFilename(screenshotHandle,filenameType,pchFilename,cchFilename,ref pError); + return result; + } + public EVRScreenshotError UpdateScreenshotProgress(uint screenshotHandle,float flProgress) + { + EVRScreenshotError result = FnTable.UpdateScreenshotProgress(screenshotHandle,flProgress); + return result; + } + public EVRScreenshotError TakeStereoScreenshot(ref uint pOutScreenshotHandle,string pchPreviewFilename,string pchVRFilename) + { + pOutScreenshotHandle = 0; + IntPtr pchPreviewFilenameUtf8 = Utils.ToUtf8(pchPreviewFilename); + IntPtr pchVRFilenameUtf8 = Utils.ToUtf8(pchVRFilename); + EVRScreenshotError result = FnTable.TakeStereoScreenshot(ref pOutScreenshotHandle,pchPreviewFilenameUtf8,pchVRFilenameUtf8); + Marshal.FreeHGlobal(pchPreviewFilenameUtf8); + Marshal.FreeHGlobal(pchVRFilenameUtf8); + return result; + } + public EVRScreenshotError SubmitScreenshot(uint screenshotHandle,EVRScreenshotType type,string pchSourcePreviewFilename,string pchSourceVRFilename) + { + IntPtr pchSourcePreviewFilenameUtf8 = Utils.ToUtf8(pchSourcePreviewFilename); + IntPtr pchSourceVRFilenameUtf8 = Utils.ToUtf8(pchSourceVRFilename); + EVRScreenshotError result = FnTable.SubmitScreenshot(screenshotHandle,type,pchSourcePreviewFilenameUtf8,pchSourceVRFilenameUtf8); + Marshal.FreeHGlobal(pchSourcePreviewFilenameUtf8); + Marshal.FreeHGlobal(pchSourceVRFilenameUtf8); + return result; + } +} + + +public class CVRResources +{ + IVRResources FnTable; + internal CVRResources(IntPtr pInterface) + { + FnTable = (IVRResources)Marshal.PtrToStructure(pInterface, typeof(IVRResources)); + } + public uint LoadSharedResource(string pchResourceName,string pchBuffer,uint unBufferLen) + { + IntPtr pchResourceNameUtf8 = Utils.ToUtf8(pchResourceName); + uint result = FnTable.LoadSharedResource(pchResourceNameUtf8,pchBuffer,unBufferLen); + Marshal.FreeHGlobal(pchResourceNameUtf8); + return result; + } + public uint GetResourceFullPath(string pchResourceName,string pchResourceTypeDirectory,System.Text.StringBuilder pchPathBuffer,uint unBufferLen) + { + IntPtr pchResourceNameUtf8 = Utils.ToUtf8(pchResourceName); + IntPtr pchResourceTypeDirectoryUtf8 = Utils.ToUtf8(pchResourceTypeDirectory); + uint result = FnTable.GetResourceFullPath(pchResourceNameUtf8,pchResourceTypeDirectoryUtf8,pchPathBuffer,unBufferLen); + Marshal.FreeHGlobal(pchResourceNameUtf8); + Marshal.FreeHGlobal(pchResourceTypeDirectoryUtf8); + return result; + } +} + + +public class CVRDriverManager +{ + IVRDriverManager FnTable; + internal CVRDriverManager(IntPtr pInterface) + { + FnTable = (IVRDriverManager)Marshal.PtrToStructure(pInterface, typeof(IVRDriverManager)); + } + public uint GetDriverCount() + { + uint result = FnTable.GetDriverCount(); + return result; + } + public uint GetDriverName(uint nDriver,System.Text.StringBuilder pchValue,uint unBufferSize) + { + uint result = FnTable.GetDriverName(nDriver,pchValue,unBufferSize); + return result; + } + public ulong GetDriverHandle(string pchDriverName) + { + IntPtr pchDriverNameUtf8 = Utils.ToUtf8(pchDriverName); + ulong result = FnTable.GetDriverHandle(pchDriverNameUtf8); + Marshal.FreeHGlobal(pchDriverNameUtf8); + return result; + } + public bool IsEnabled(uint nDriver) + { + bool result = FnTable.IsEnabled(nDriver); + return result; + } +} + + +public class CVRInput +{ + IVRInput FnTable; + internal CVRInput(IntPtr pInterface) + { + FnTable = (IVRInput)Marshal.PtrToStructure(pInterface, typeof(IVRInput)); + } + public EVRInputError SetActionManifestPath(string pchActionManifestPath) + { + IntPtr pchActionManifestPathUtf8 = Utils.ToUtf8(pchActionManifestPath); + EVRInputError result = FnTable.SetActionManifestPath(pchActionManifestPathUtf8); + Marshal.FreeHGlobal(pchActionManifestPathUtf8); + return result; + } + public EVRInputError GetActionSetHandle(string pchActionSetName,ref ulong pHandle) + { + IntPtr pchActionSetNameUtf8 = Utils.ToUtf8(pchActionSetName); + pHandle = 0; + EVRInputError result = FnTable.GetActionSetHandle(pchActionSetNameUtf8,ref pHandle); + Marshal.FreeHGlobal(pchActionSetNameUtf8); + return result; + } + public EVRInputError GetActionHandle(string pchActionName,ref ulong pHandle) + { + IntPtr pchActionNameUtf8 = Utils.ToUtf8(pchActionName); + pHandle = 0; + EVRInputError result = FnTable.GetActionHandle(pchActionNameUtf8,ref pHandle); + Marshal.FreeHGlobal(pchActionNameUtf8); + return result; + } + public EVRInputError GetInputSourceHandle(string pchInputSourcePath,ref ulong pHandle) + { + IntPtr pchInputSourcePathUtf8 = Utils.ToUtf8(pchInputSourcePath); + pHandle = 0; + EVRInputError result = FnTable.GetInputSourceHandle(pchInputSourcePathUtf8,ref pHandle); + Marshal.FreeHGlobal(pchInputSourcePathUtf8); + return result; + } + public EVRInputError UpdateActionState(VRActiveActionSet_t [] pSets,uint unSizeOfVRSelectedActionSet_t) + { + EVRInputError result = FnTable.UpdateActionState(pSets,unSizeOfVRSelectedActionSet_t,(uint) pSets.Length); + return result; + } + public EVRInputError GetDigitalActionData(ulong action,ref InputDigitalActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.GetDigitalActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice); + return result; + } + public EVRInputError GetAnalogActionData(ulong action,ref InputAnalogActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.GetAnalogActionData(action,ref pActionData,unActionDataSize,ulRestrictToDevice); + return result; + } + public EVRInputError GetPoseActionDataRelativeToNow(ulong action,ETrackingUniverseOrigin eOrigin,float fPredictedSecondsFromNow,ref InputPoseActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.GetPoseActionDataRelativeToNow(action,eOrigin,fPredictedSecondsFromNow,ref pActionData,unActionDataSize,ulRestrictToDevice); + return result; + } + public EVRInputError GetPoseActionDataForNextFrame(ulong action,ETrackingUniverseOrigin eOrigin,ref InputPoseActionData_t pActionData,uint unActionDataSize,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.GetPoseActionDataForNextFrame(action,eOrigin,ref pActionData,unActionDataSize,ulRestrictToDevice); + return result; + } + public EVRInputError GetSkeletalActionData(ulong action,ref InputSkeletalActionData_t pActionData,uint unActionDataSize) + { + EVRInputError result = FnTable.GetSkeletalActionData(action,ref pActionData,unActionDataSize); + return result; + } + public EVRInputError GetDominantHand(ref ETrackedControllerRole peDominantHand) + { + EVRInputError result = FnTable.GetDominantHand(ref peDominantHand); + return result; + } + public EVRInputError SetDominantHand(ETrackedControllerRole eDominantHand) + { + EVRInputError result = FnTable.SetDominantHand(eDominantHand); + return result; + } + public EVRInputError GetBoneCount(ulong action,ref uint pBoneCount) + { + pBoneCount = 0; + EVRInputError result = FnTable.GetBoneCount(action,ref pBoneCount); + return result; + } + public EVRInputError GetBoneHierarchy(ulong action,int [] pParentIndices) + { + EVRInputError result = FnTable.GetBoneHierarchy(action,pParentIndices,(uint) pParentIndices.Length); + return result; + } + public EVRInputError GetBoneName(ulong action,int nBoneIndex,System.Text.StringBuilder pchBoneName,uint unNameBufferSize) + { + EVRInputError result = FnTable.GetBoneName(action,nBoneIndex,pchBoneName,unNameBufferSize); + return result; + } + public EVRInputError GetSkeletalReferenceTransforms(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalReferencePose eReferencePose,VRBoneTransform_t [] pTransformArray) + { + EVRInputError result = FnTable.GetSkeletalReferenceTransforms(action,eTransformSpace,eReferencePose,pTransformArray,(uint) pTransformArray.Length); + return result; + } + public EVRInputError GetSkeletalTrackingLevel(ulong action,ref EVRSkeletalTrackingLevel pSkeletalTrackingLevel) + { + EVRInputError result = FnTable.GetSkeletalTrackingLevel(action,ref pSkeletalTrackingLevel); + return result; + } + public EVRInputError GetSkeletalBoneData(ulong action,EVRSkeletalTransformSpace eTransformSpace,EVRSkeletalMotionRange eMotionRange,VRBoneTransform_t [] pTransformArray) + { + EVRInputError result = FnTable.GetSkeletalBoneData(action,eTransformSpace,eMotionRange,pTransformArray,(uint) pTransformArray.Length); + return result; + } + public EVRInputError GetSkeletalSummaryData(ulong action,EVRSummaryType eSummaryType,ref VRSkeletalSummaryData_t pSkeletalSummaryData) + { + EVRInputError result = FnTable.GetSkeletalSummaryData(action,eSummaryType,ref pSkeletalSummaryData); + return result; + } + public EVRInputError GetSkeletalBoneDataCompressed(ulong action,EVRSkeletalMotionRange eMotionRange,IntPtr pvCompressedData,uint unCompressedSize,ref uint punRequiredCompressedSize) + { + punRequiredCompressedSize = 0; + EVRInputError result = FnTable.GetSkeletalBoneDataCompressed(action,eMotionRange,pvCompressedData,unCompressedSize,ref punRequiredCompressedSize); + return result; + } + public EVRInputError DecompressSkeletalBoneData(IntPtr pvCompressedBuffer,uint unCompressedBufferSize,EVRSkeletalTransformSpace eTransformSpace,VRBoneTransform_t [] pTransformArray) + { + EVRInputError result = FnTable.DecompressSkeletalBoneData(pvCompressedBuffer,unCompressedBufferSize,eTransformSpace,pTransformArray,(uint) pTransformArray.Length); + return result; + } + public EVRInputError TriggerHapticVibrationAction(ulong action,float fStartSecondsFromNow,float fDurationSeconds,float fFrequency,float fAmplitude,ulong ulRestrictToDevice) + { + EVRInputError result = FnTable.TriggerHapticVibrationAction(action,fStartSecondsFromNow,fDurationSeconds,fFrequency,fAmplitude,ulRestrictToDevice); + return result; + } + public EVRInputError GetActionOrigins(ulong actionSetHandle,ulong digitalActionHandle,ulong [] originsOut) + { + EVRInputError result = FnTable.GetActionOrigins(actionSetHandle,digitalActionHandle,originsOut,(uint) originsOut.Length); + return result; + } + public EVRInputError GetOriginLocalizedName(ulong origin,System.Text.StringBuilder pchNameArray,uint unNameArraySize,int unStringSectionsToInclude) + { + EVRInputError result = FnTable.GetOriginLocalizedName(origin,pchNameArray,unNameArraySize,unStringSectionsToInclude); + return result; + } + public EVRInputError GetOriginTrackedDeviceInfo(ulong origin,ref InputOriginInfo_t pOriginInfo,uint unOriginInfoSize) + { + EVRInputError result = FnTable.GetOriginTrackedDeviceInfo(origin,ref pOriginInfo,unOriginInfoSize); + return result; + } + public EVRInputError GetActionBindingInfo(ulong action,ref InputBindingInfo_t pOriginInfo,uint unBindingInfoSize,uint unBindingInfoCount,ref uint punReturnedBindingInfoCount) + { + punReturnedBindingInfoCount = 0; + EVRInputError result = FnTable.GetActionBindingInfo(action,ref pOriginInfo,unBindingInfoSize,unBindingInfoCount,ref punReturnedBindingInfoCount); + return result; + } + public EVRInputError ShowActionOrigins(ulong actionSetHandle,ulong ulActionHandle) + { + EVRInputError result = FnTable.ShowActionOrigins(actionSetHandle,ulActionHandle); + return result; + } + public EVRInputError ShowBindingsForActionSet(VRActiveActionSet_t [] pSets,uint unSizeOfVRSelectedActionSet_t,ulong originToHighlight) + { + EVRInputError result = FnTable.ShowBindingsForActionSet(pSets,unSizeOfVRSelectedActionSet_t,(uint) pSets.Length,originToHighlight); + return result; + } + public EVRInputError GetComponentStateForBinding(string pchRenderModelName,string pchComponentName,ref InputBindingInfo_t pOriginInfo,uint unBindingInfoSize,uint unBindingInfoCount,ref RenderModel_ComponentState_t pComponentState) + { + IntPtr pchRenderModelNameUtf8 = Utils.ToUtf8(pchRenderModelName); + IntPtr pchComponentNameUtf8 = Utils.ToUtf8(pchComponentName); + EVRInputError result = FnTable.GetComponentStateForBinding(pchRenderModelNameUtf8,pchComponentNameUtf8,ref pOriginInfo,unBindingInfoSize,unBindingInfoCount,ref pComponentState); + Marshal.FreeHGlobal(pchRenderModelNameUtf8); + Marshal.FreeHGlobal(pchComponentNameUtf8); + return result; + } + public bool IsUsingLegacyInput() + { + bool result = FnTable.IsUsingLegacyInput(); + return result; + } + public EVRInputError OpenBindingUI(string pchAppKey,ulong ulActionSetHandle,ulong ulDeviceHandle,bool bShowOnDesktop) + { + IntPtr pchAppKeyUtf8 = Utils.ToUtf8(pchAppKey); + EVRInputError result = FnTable.OpenBindingUI(pchAppKeyUtf8,ulActionSetHandle,ulDeviceHandle,bShowOnDesktop); + Marshal.FreeHGlobal(pchAppKeyUtf8); + return result; + } + public EVRInputError GetBindingVariant(ulong ulDevicePath,System.Text.StringBuilder pchVariantArray,uint unVariantArraySize) + { + EVRInputError result = FnTable.GetBindingVariant(ulDevicePath,pchVariantArray,unVariantArraySize); + return result; + } +} + + +public class CVRIOBuffer +{ + IVRIOBuffer FnTable; + internal CVRIOBuffer(IntPtr pInterface) + { + FnTable = (IVRIOBuffer)Marshal.PtrToStructure(pInterface, typeof(IVRIOBuffer)); + } + public EIOBufferError Open(string pchPath,EIOBufferMode mode,uint unElementSize,uint unElements,ref ulong pulBuffer) + { + IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath); + pulBuffer = 0; + EIOBufferError result = FnTable.Open(pchPathUtf8,mode,unElementSize,unElements,ref pulBuffer); + Marshal.FreeHGlobal(pchPathUtf8); + return result; + } + public EIOBufferError Close(ulong ulBuffer) + { + EIOBufferError result = FnTable.Close(ulBuffer); + return result; + } + public EIOBufferError Read(ulong ulBuffer,IntPtr pDst,uint unBytes,ref uint punRead) + { + punRead = 0; + EIOBufferError result = FnTable.Read(ulBuffer,pDst,unBytes,ref punRead); + return result; + } + public EIOBufferError Write(ulong ulBuffer,IntPtr pSrc,uint unBytes) + { + EIOBufferError result = FnTable.Write(ulBuffer,pSrc,unBytes); + return result; + } + public ulong PropertyContainer(ulong ulBuffer) + { + ulong result = FnTable.PropertyContainer(ulBuffer); + return result; + } + public bool HasReaders(ulong ulBuffer) + { + bool result = FnTable.HasReaders(ulBuffer); + return result; + } +} + + +public class CVRSpatialAnchors +{ + IVRSpatialAnchors FnTable; + internal CVRSpatialAnchors(IntPtr pInterface) + { + FnTable = (IVRSpatialAnchors)Marshal.PtrToStructure(pInterface, typeof(IVRSpatialAnchors)); + } + public EVRSpatialAnchorError CreateSpatialAnchorFromDescriptor(string pchDescriptor,ref uint pHandleOut) + { + IntPtr pchDescriptorUtf8 = Utils.ToUtf8(pchDescriptor); + pHandleOut = 0; + EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromDescriptor(pchDescriptorUtf8,ref pHandleOut); + Marshal.FreeHGlobal(pchDescriptorUtf8); + return result; + } + public EVRSpatialAnchorError CreateSpatialAnchorFromPose(uint unDeviceIndex,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPose,ref uint pHandleOut) + { + pHandleOut = 0; + EVRSpatialAnchorError result = FnTable.CreateSpatialAnchorFromPose(unDeviceIndex,eOrigin,ref pPose,ref pHandleOut); + return result; + } + public EVRSpatialAnchorError GetSpatialAnchorPose(uint unHandle,ETrackingUniverseOrigin eOrigin,ref SpatialAnchorPose_t pPoseOut) + { + EVRSpatialAnchorError result = FnTable.GetSpatialAnchorPose(unHandle,eOrigin,ref pPoseOut); + return result; + } + public EVRSpatialAnchorError GetSpatialAnchorDescriptor(uint unHandle,System.Text.StringBuilder pchDescriptorOut,ref uint punDescriptorBufferLenInOut) + { + punDescriptorBufferLenInOut = 0; + EVRSpatialAnchorError result = FnTable.GetSpatialAnchorDescriptor(unHandle,pchDescriptorOut,ref punDescriptorBufferLenInOut); + return result; + } +} + + +public class CVRDebug +{ + IVRDebug FnTable; + internal CVRDebug(IntPtr pInterface) + { + FnTable = (IVRDebug)Marshal.PtrToStructure(pInterface, typeof(IVRDebug)); + } + public EVRDebugError EmitVrProfilerEvent(string pchMessage) + { + IntPtr pchMessageUtf8 = Utils.ToUtf8(pchMessage); + EVRDebugError result = FnTable.EmitVrProfilerEvent(pchMessageUtf8); + Marshal.FreeHGlobal(pchMessageUtf8); + return result; + } + public EVRDebugError BeginVrProfilerEvent(ref ulong pHandleOut) + { + pHandleOut = 0; + EVRDebugError result = FnTable.BeginVrProfilerEvent(ref pHandleOut); + return result; + } + public EVRDebugError FinishVrProfilerEvent(ulong hHandle,string pchMessage) + { + IntPtr pchMessageUtf8 = Utils.ToUtf8(pchMessage); + EVRDebugError result = FnTable.FinishVrProfilerEvent(hHandle,pchMessageUtf8); + Marshal.FreeHGlobal(pchMessageUtf8); + return result; + } + public uint DriverDebugRequest(uint unDeviceIndex,string pchRequest,System.Text.StringBuilder pchResponseBuffer,uint unResponseBufferSize) + { + IntPtr pchRequestUtf8 = Utils.ToUtf8(pchRequest); + uint result = FnTable.DriverDebugRequest(unDeviceIndex,pchRequestUtf8,pchResponseBuffer,unResponseBufferSize); + Marshal.FreeHGlobal(pchRequestUtf8); + return result; + } +} + + +public class CVRProperties +{ + IVRProperties FnTable; + internal CVRProperties(IntPtr pInterface) + { + FnTable = (IVRProperties)Marshal.PtrToStructure(pInterface, typeof(IVRProperties)); + } + public ETrackedPropertyError ReadPropertyBatch(ulong ulContainerHandle,ref PropertyRead_t pBatch,uint unBatchEntryCount) + { + ETrackedPropertyError result = FnTable.ReadPropertyBatch(ulContainerHandle,ref pBatch,unBatchEntryCount); + return result; + } + public ETrackedPropertyError WritePropertyBatch(ulong ulContainerHandle,ref PropertyWrite_t pBatch,uint unBatchEntryCount) + { + ETrackedPropertyError result = FnTable.WritePropertyBatch(ulContainerHandle,ref pBatch,unBatchEntryCount); + return result; + } + public string GetPropErrorNameFromEnum(ETrackedPropertyError error) + { + IntPtr result = FnTable.GetPropErrorNameFromEnum(error); + return Marshal.PtrToStringAnsi(result); + } + public ulong TrackedDeviceToPropertyContainer(uint nDevice) + { + ulong result = FnTable.TrackedDeviceToPropertyContainer(nDevice); + return result; + } +} + + +public class CVRPaths +{ + IVRPaths FnTable; + internal CVRPaths(IntPtr pInterface) + { + FnTable = (IVRPaths)Marshal.PtrToStructure(pInterface, typeof(IVRPaths)); + } + public ETrackedPropertyError ReadPathBatch(ulong ulRootHandle,ref PathRead_t pBatch,uint unBatchEntryCount) + { + ETrackedPropertyError result = FnTable.ReadPathBatch(ulRootHandle,ref pBatch,unBatchEntryCount); + return result; + } + public ETrackedPropertyError WritePathBatch(ulong ulRootHandle,ref PathWrite_t pBatch,uint unBatchEntryCount) + { + ETrackedPropertyError result = FnTable.WritePathBatch(ulRootHandle,ref pBatch,unBatchEntryCount); + return result; + } + public ETrackedPropertyError StringToHandle(ref ulong pHandle,string pchPath) + { + pHandle = 0; + IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath); + ETrackedPropertyError result = FnTable.StringToHandle(ref pHandle,pchPathUtf8); + Marshal.FreeHGlobal(pchPathUtf8); + return result; + } + public ETrackedPropertyError HandleToString(ulong pHandle,string pchBuffer,uint unBufferSize,ref uint punBufferSizeUsed) + { + punBufferSizeUsed = 0; + ETrackedPropertyError result = FnTable.HandleToString(pHandle,pchBuffer,unBufferSize,ref punBufferSizeUsed); + return result; + } +} + + +public class CVRBlockQueue +{ + IVRBlockQueue FnTable; + internal CVRBlockQueue(IntPtr pInterface) + { + FnTable = (IVRBlockQueue)Marshal.PtrToStructure(pInterface, typeof(IVRBlockQueue)); + } + public EBlockQueueError Create(ref ulong pulQueueHandle,string pchPath,uint unBlockDataSize,uint unBlockHeaderSize,uint unBlockCount) + { + pulQueueHandle = 0; + IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath); + EBlockQueueError result = FnTable.Create(ref pulQueueHandle,pchPathUtf8,unBlockDataSize,unBlockHeaderSize,unBlockCount); + Marshal.FreeHGlobal(pchPathUtf8); + return result; + } + public EBlockQueueError Connect(ref ulong pulQueueHandle,string pchPath) + { + pulQueueHandle = 0; + IntPtr pchPathUtf8 = Utils.ToUtf8(pchPath); + EBlockQueueError result = FnTable.Connect(ref pulQueueHandle,pchPathUtf8); + Marshal.FreeHGlobal(pchPathUtf8); + return result; + } + public EBlockQueueError Destroy(ulong ulQueueHandle) + { + EBlockQueueError result = FnTable.Destroy(ulQueueHandle); + return result; + } + public EBlockQueueError AcquireWriteOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer) + { + pulBlockHandle = 0; + EBlockQueueError result = FnTable.AcquireWriteOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer); + return result; + } + public EBlockQueueError ReleaseWriteOnlyBlock(ulong ulQueueHandle,ulong ulBlockHandle) + { + EBlockQueueError result = FnTable.ReleaseWriteOnlyBlock(ulQueueHandle,ulBlockHandle); + return result; + } + public EBlockQueueError WaitAndAcquireReadOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer,EBlockQueueReadType eReadType,uint unTimeoutMs) + { + pulBlockHandle = 0; + EBlockQueueError result = FnTable.WaitAndAcquireReadOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer,eReadType,unTimeoutMs); + return result; + } + public EBlockQueueError AcquireReadOnlyBlock(ulong ulQueueHandle,ref ulong pulBlockHandle,ref IntPtr ppvBuffer,EBlockQueueReadType eReadType) + { + pulBlockHandle = 0; + EBlockQueueError result = FnTable.AcquireReadOnlyBlock(ulQueueHandle,ref pulBlockHandle,ref ppvBuffer,eReadType); + return result; + } + public EBlockQueueError ReleaseReadOnlyBlock(ulong ulQueueHandle,ulong ulBlockHandle) + { + EBlockQueueError result = FnTable.ReleaseReadOnlyBlock(ulQueueHandle,ulBlockHandle); + return result; + } + public EBlockQueueError QueueHasReader(ulong ulQueueHandle,ref bool pbHasReaders) + { + pbHasReaders = false; + EBlockQueueError result = FnTable.QueueHasReader(ulQueueHandle,ref pbHasReaders); + return result; + } +} + + +public class OpenVRInterop +{ + [DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType); + [DllImportAttribute("openvr_api", EntryPoint = "VR_InitInternal2", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType,[In, MarshalAs(UnmanagedType.LPStr)] string pStartupInfo); + [DllImportAttribute("openvr_api", EntryPoint = "VR_ShutdownInternal", CallingConvention = CallingConvention.Cdecl)] + internal static extern void ShutdownInternal(); + [DllImportAttribute("openvr_api", EntryPoint = "VR_IsHmdPresent", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool IsHmdPresent(); + [DllImportAttribute("openvr_api", EntryPoint = "VR_IsRuntimeInstalled", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool IsRuntimeInstalled(); + [DllImportAttribute("openvr_api", EntryPoint = "VR_RuntimePath", CallingConvention = CallingConvention.Cdecl)] + internal static extern string RuntimePath(); + [DllImportAttribute("openvr_api", EntryPoint = "VR_GetRuntimePath", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool GetRuntimePath(System.Text.StringBuilder pchPathBuffer, uint unBufferSize, ref uint punRequiredBufferSize); + [DllImportAttribute("openvr_api", EntryPoint = "VR_GetStringForHmdError", CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr GetStringForHmdError(EVRInitError error); + [DllImportAttribute("openvr_api", EntryPoint = "VR_GetGenericInterface", CallingConvention = CallingConvention.Cdecl)] + internal static extern IntPtr GetGenericInterface([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion, ref EVRInitError peError); + [DllImportAttribute("openvr_api", EntryPoint = "VR_IsInterfaceVersionValid", CallingConvention = CallingConvention.Cdecl)] + internal static extern bool IsInterfaceVersionValid([In, MarshalAs(UnmanagedType.LPStr)] string pchInterfaceVersion); + [DllImportAttribute("openvr_api", EntryPoint = "VR_GetInitToken", CallingConvention = CallingConvention.Cdecl)] + internal static extern uint GetInitToken(); +} + + +public enum EVREye +{ + Eye_Left = 0, + Eye_Right = 1, +} +public enum ETextureType +{ + Invalid = -1, + DirectX = 0, + OpenGL = 1, + Vulkan = 2, + IOSurface = 3, + DirectX12 = 4, + DXGISharedHandle = 5, + Metal = 6, +} +public enum EColorSpace +{ + Auto = 0, + Gamma = 1, + Linear = 2, +} +public enum ETrackingResult +{ + Uninitialized = 1, + Calibrating_InProgress = 100, + Calibrating_OutOfRange = 101, + Running_OK = 200, + Running_OutOfRange = 201, + Fallback_RotationOnly = 300, +} +public enum ETrackedDeviceClass +{ + Invalid = 0, + HMD = 1, + Controller = 2, + GenericTracker = 3, + TrackingReference = 4, + DisplayRedirect = 5, + Max = 6, +} +public enum ETrackedControllerRole +{ + Invalid = 0, + LeftHand = 1, + RightHand = 2, + OptOut = 3, + Treadmill = 4, + Stylus = 5, + Max = 5, +} +public enum ETrackingUniverseOrigin +{ + TrackingUniverseSeated = 0, + TrackingUniverseStanding = 1, + TrackingUniverseRawAndUncalibrated = 2, +} +public enum EAdditionalRadioFeatures +{ + None = 0, + HTCLinkBox = 1, + InternalDongle = 2, + ExternalDongle = 4, +} +public enum ETrackedDeviceProperty +{ + Prop_Invalid = 0, + Prop_TrackingSystemName_String = 1000, + Prop_ModelNumber_String = 1001, + Prop_SerialNumber_String = 1002, + Prop_RenderModelName_String = 1003, + Prop_WillDriftInYaw_Bool = 1004, + Prop_ManufacturerName_String = 1005, + Prop_TrackingFirmwareVersion_String = 1006, + Prop_HardwareRevision_String = 1007, + Prop_AllWirelessDongleDescriptions_String = 1008, + Prop_ConnectedWirelessDongle_String = 1009, + Prop_DeviceIsWireless_Bool = 1010, + Prop_DeviceIsCharging_Bool = 1011, + Prop_DeviceBatteryPercentage_Float = 1012, + Prop_StatusDisplayTransform_Matrix34 = 1013, + Prop_Firmware_UpdateAvailable_Bool = 1014, + Prop_Firmware_ManualUpdate_Bool = 1015, + Prop_Firmware_ManualUpdateURL_String = 1016, + Prop_HardwareRevision_Uint64 = 1017, + Prop_FirmwareVersion_Uint64 = 1018, + Prop_FPGAVersion_Uint64 = 1019, + Prop_VRCVersion_Uint64 = 1020, + Prop_RadioVersion_Uint64 = 1021, + Prop_DongleVersion_Uint64 = 1022, + Prop_BlockServerShutdown_Bool = 1023, + Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, + Prop_ContainsProximitySensor_Bool = 1025, + Prop_DeviceProvidesBatteryStatus_Bool = 1026, + Prop_DeviceCanPowerOff_Bool = 1027, + Prop_Firmware_ProgrammingTarget_String = 1028, + Prop_DeviceClass_Int32 = 1029, + Prop_HasCamera_Bool = 1030, + Prop_DriverVersion_String = 1031, + Prop_Firmware_ForceUpdateRequired_Bool = 1032, + Prop_ViveSystemButtonFixRequired_Bool = 1033, + Prop_ParentDriver_Uint64 = 1034, + Prop_ResourceRoot_String = 1035, + Prop_RegisteredDeviceType_String = 1036, + Prop_InputProfilePath_String = 1037, + Prop_NeverTracked_Bool = 1038, + Prop_NumCameras_Int32 = 1039, + Prop_CameraFrameLayout_Int32 = 1040, + Prop_CameraStreamFormat_Int32 = 1041, + Prop_AdditionalDeviceSettingsPath_String = 1042, + Prop_Identifiable_Bool = 1043, + Prop_BootloaderVersion_Uint64 = 1044, + Prop_AdditionalSystemReportData_String = 1045, + Prop_CompositeFirmwareVersion_String = 1046, + Prop_Firmware_RemindUpdate_Bool = 1047, + Prop_PeripheralApplicationVersion_Uint64 = 1048, + Prop_ManufacturerSerialNumber_String = 1049, + Prop_ComputedSerialNumber_String = 1050, + Prop_EstimatedDeviceFirstUseTime_Int32 = 1051, + Prop_ReportsTimeSinceVSync_Bool = 2000, + Prop_SecondsFromVsyncToPhotons_Float = 2001, + Prop_DisplayFrequency_Float = 2002, + Prop_UserIpdMeters_Float = 2003, + Prop_CurrentUniverseId_Uint64 = 2004, + Prop_PreviousUniverseId_Uint64 = 2005, + Prop_DisplayFirmwareVersion_Uint64 = 2006, + Prop_IsOnDesktop_Bool = 2007, + Prop_DisplayMCType_Int32 = 2008, + Prop_DisplayMCOffset_Float = 2009, + Prop_DisplayMCScale_Float = 2010, + Prop_EdidVendorID_Int32 = 2011, + Prop_DisplayMCImageLeft_String = 2012, + Prop_DisplayMCImageRight_String = 2013, + Prop_DisplayGCBlackClamp_Float = 2014, + Prop_EdidProductID_Int32 = 2015, + Prop_CameraToHeadTransform_Matrix34 = 2016, + Prop_DisplayGCType_Int32 = 2017, + Prop_DisplayGCOffset_Float = 2018, + Prop_DisplayGCScale_Float = 2019, + Prop_DisplayGCPrescale_Float = 2020, + Prop_DisplayGCImage_String = 2021, + Prop_LensCenterLeftU_Float = 2022, + Prop_LensCenterLeftV_Float = 2023, + Prop_LensCenterRightU_Float = 2024, + Prop_LensCenterRightV_Float = 2025, + Prop_UserHeadToEyeDepthMeters_Float = 2026, + Prop_CameraFirmwareVersion_Uint64 = 2027, + Prop_CameraFirmwareDescription_String = 2028, + Prop_DisplayFPGAVersion_Uint64 = 2029, + Prop_DisplayBootloaderVersion_Uint64 = 2030, + Prop_DisplayHardwareVersion_Uint64 = 2031, + Prop_AudioFirmwareVersion_Uint64 = 2032, + Prop_CameraCompatibilityMode_Int32 = 2033, + Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, + Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, + Prop_DisplaySuppressed_Bool = 2036, + Prop_DisplayAllowNightMode_Bool = 2037, + Prop_DisplayMCImageWidth_Int32 = 2038, + Prop_DisplayMCImageHeight_Int32 = 2039, + Prop_DisplayMCImageNumChannels_Int32 = 2040, + Prop_DisplayMCImageData_Binary = 2041, + Prop_SecondsFromPhotonsToVblank_Float = 2042, + Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, + Prop_DisplayDebugMode_Bool = 2044, + Prop_GraphicsAdapterLuid_Uint64 = 2045, + Prop_DriverProvidedChaperonePath_String = 2048, + Prop_ExpectedTrackingReferenceCount_Int32 = 2049, + Prop_ExpectedControllerCount_Int32 = 2050, + Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, + Prop_NamedIconPathControllerRightDeviceOff_String = 2052, + Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, + Prop_DoNotApplyPrediction_Bool = 2054, + Prop_CameraToHeadTransforms_Matrix34_Array = 2055, + Prop_DistortionMeshResolution_Int32 = 2056, + Prop_DriverIsDrawingControllers_Bool = 2057, + Prop_DriverRequestsApplicationPause_Bool = 2058, + Prop_DriverRequestsReducedRendering_Bool = 2059, + Prop_MinimumIpdStepMeters_Float = 2060, + Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, + Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, + Prop_ImuToHeadTransform_Matrix34 = 2063, + Prop_ImuFactoryGyroBias_Vector3 = 2064, + Prop_ImuFactoryGyroScale_Vector3 = 2065, + Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, + Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + Prop_AdditionalRadioFeatures_Uint64 = 2070, + Prop_CameraWhiteBalance_Vector4_Array = 2071, + Prop_CameraDistortionFunction_Int32_Array = 2072, + Prop_CameraDistortionCoefficients_Float_Array = 2073, + Prop_ExpectedControllerType_String = 2074, + Prop_HmdTrackingStyle_Int32 = 2075, + Prop_DriverProvidedChaperoneVisibility_Bool = 2076, + Prop_HmdColumnCorrectionSettingPrefix_String = 2077, + Prop_CameraSupportsCompatibilityModes_Bool = 2078, + Prop_SupportsRoomViewDepthProjection_Bool = 2079, + Prop_DisplayAvailableFrameRates_Float_Array = 2080, + Prop_DisplaySupportsMultipleFramerates_Bool = 2081, + Prop_DisplayColorMultLeft_Vector3 = 2082, + Prop_DisplayColorMultRight_Vector3 = 2083, + Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084, + Prop_DisplaySupportsAnalogGain_Bool = 2085, + Prop_DisplayMinAnalogGain_Float = 2086, + Prop_DisplayMaxAnalogGain_Float = 2087, + Prop_CameraExposureTime_Float = 2088, + Prop_CameraGlobalGain_Float = 2089, + Prop_DashboardScale_Float = 2091, + Prop_IpdUIRangeMinMeters_Float = 2100, + Prop_IpdUIRangeMaxMeters_Float = 2101, + Prop_Hmd_SupportsHDCP14LegacyCompat_Bool = 2102, + Prop_Hmd_SupportsMicMonitoring_Bool = 2103, + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, + Prop_Audio_DefaultPlaybackDeviceId_String = 2300, + Prop_Audio_DefaultRecordingDeviceId_String = 2301, + Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302, + Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool = 2303, + Prop_AttachedDeviceId_String = 3000, + Prop_SupportedButtons_Uint64 = 3001, + Prop_Axis0Type_Int32 = 3002, + Prop_Axis1Type_Int32 = 3003, + Prop_Axis2Type_Int32 = 3004, + Prop_Axis3Type_Int32 = 3005, + Prop_Axis4Type_Int32 = 3006, + Prop_ControllerRoleHint_Int32 = 3007, + Prop_FieldOfViewLeftDegrees_Float = 4000, + Prop_FieldOfViewRightDegrees_Float = 4001, + Prop_FieldOfViewTopDegrees_Float = 4002, + Prop_FieldOfViewBottomDegrees_Float = 4003, + Prop_TrackingRangeMinimumMeters_Float = 4004, + Prop_TrackingRangeMaximumMeters_Float = 4005, + Prop_ModeLabel_String = 4006, + Prop_CanWirelessIdentify_Bool = 4007, + Prop_Nonce_Int32 = 4008, + Prop_IconPathName_String = 5000, + Prop_NamedIconPathDeviceOff_String = 5001, + Prop_NamedIconPathDeviceSearching_String = 5002, + Prop_NamedIconPathDeviceSearchingAlert_String = 5003, + Prop_NamedIconPathDeviceReady_String = 5004, + Prop_NamedIconPathDeviceReadyAlert_String = 5005, + Prop_NamedIconPathDeviceNotReady_String = 5006, + Prop_NamedIconPathDeviceStandby_String = 5007, + Prop_NamedIconPathDeviceAlertLow_String = 5008, + Prop_NamedIconPathDeviceStandbyAlert_String = 5009, + Prop_DisplayHiddenArea_Binary_Start = 5100, + Prop_DisplayHiddenArea_Binary_End = 5150, + Prop_ParentContainer = 5151, + Prop_OverrideContainer_Uint64 = 5152, + Prop_UserConfigPath_String = 6000, + Prop_InstallPath_String = 6001, + Prop_HasDisplayComponent_Bool = 6002, + Prop_HasControllerComponent_Bool = 6003, + Prop_HasCameraComponent_Bool = 6004, + Prop_HasDriverDirectModeComponent_Bool = 6005, + Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, + Prop_ControllerType_String = 7000, + Prop_ControllerHandSelectionPriority_Int32 = 7002, + Prop_VendorSpecific_Reserved_Start = 10000, + Prop_VendorSpecific_Reserved_End = 10999, + Prop_TrackedDeviceProperty_Max = 1000000, +} +public enum ETrackedPropertyError +{ + TrackedProp_Success = 0, + TrackedProp_WrongDataType = 1, + TrackedProp_WrongDeviceClass = 2, + TrackedProp_BufferTooSmall = 3, + TrackedProp_UnknownProperty = 4, + TrackedProp_InvalidDevice = 5, + TrackedProp_CouldNotContactServer = 6, + TrackedProp_ValueNotProvidedByDevice = 7, + TrackedProp_StringExceedsMaximumLength = 8, + TrackedProp_NotYetAvailable = 9, + TrackedProp_PermissionDenied = 10, + TrackedProp_InvalidOperation = 11, + TrackedProp_CannotWriteToWildcards = 12, + TrackedProp_IPCReadFailure = 13, + TrackedProp_OutOfMemory = 14, + TrackedProp_InvalidContainer = 15, +} +public enum EHmdTrackingStyle +{ + Unknown = 0, + Lighthouse = 1, + OutsideInCameras = 2, + InsideOutCameras = 3, +} +public enum EVRSubmitFlags +{ + Submit_Default = 0, + Submit_LensDistortionAlreadyApplied = 1, + Submit_GlRenderBuffer = 2, + Submit_Reserved = 4, + Submit_TextureWithPose = 8, + Submit_TextureWithDepth = 16, + Submit_FrameDiscontinuty = 32, + Submit_VulkanTextureWithArrayData = 64, + Submit_GlArrayTexture = 128, + Submit_Reserved2 = 32768, +} +public enum EVRState +{ + Undefined = -1, + Off = 0, + Searching = 1, + Searching_Alert = 2, + Ready = 3, + Ready_Alert = 4, + NotReady = 5, + Standby = 6, + Ready_Alert_Low = 7, +} +public enum EVREventType +{ + VREvent_None = 0, + VREvent_TrackedDeviceActivated = 100, + VREvent_TrackedDeviceDeactivated = 101, + VREvent_TrackedDeviceUpdated = 102, + VREvent_TrackedDeviceUserInteractionStarted = 103, + VREvent_TrackedDeviceUserInteractionEnded = 104, + VREvent_IpdChanged = 105, + VREvent_EnterStandbyMode = 106, + VREvent_LeaveStandbyMode = 107, + VREvent_TrackedDeviceRoleChanged = 108, + VREvent_WatchdogWakeUpRequested = 109, + VREvent_LensDistortionChanged = 110, + VREvent_PropertyChanged = 111, + VREvent_WirelessDisconnect = 112, + VREvent_WirelessReconnect = 113, + VREvent_ButtonPress = 200, + VREvent_ButtonUnpress = 201, + VREvent_ButtonTouch = 202, + VREvent_ButtonUntouch = 203, + VREvent_Modal_Cancel = 257, + VREvent_MouseMove = 300, + VREvent_MouseButtonDown = 301, + VREvent_MouseButtonUp = 302, + VREvent_FocusEnter = 303, + VREvent_FocusLeave = 304, + VREvent_ScrollDiscrete = 305, + VREvent_TouchPadMove = 306, + VREvent_OverlayFocusChanged = 307, + VREvent_ReloadOverlays = 308, + VREvent_ScrollSmooth = 309, + VREvent_LockMousePosition = 310, + VREvent_UnlockMousePosition = 311, + VREvent_InputFocusCaptured = 400, + VREvent_InputFocusReleased = 401, + VREvent_SceneApplicationChanged = 404, + VREvent_SceneFocusChanged = 405, + VREvent_InputFocusChanged = 406, + VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, + VREvent_ActionBindingReloaded = 409, + VREvent_HideRenderModels = 410, + VREvent_ShowRenderModels = 411, + VREvent_SceneApplicationStateChanged = 412, + VREvent_ConsoleOpened = 420, + VREvent_ConsoleClosed = 421, + VREvent_OverlayShown = 500, + VREvent_OverlayHidden = 501, + VREvent_DashboardActivated = 502, + VREvent_DashboardDeactivated = 503, + VREvent_DashboardRequested = 505, + VREvent_ResetDashboard = 506, + VREvent_ImageLoaded = 508, + VREvent_ShowKeyboard = 509, + VREvent_HideKeyboard = 510, + VREvent_OverlayGamepadFocusGained = 511, + VREvent_OverlayGamepadFocusLost = 512, + VREvent_OverlaySharedTextureChanged = 513, + VREvent_ScreenshotTriggered = 516, + VREvent_ImageFailed = 517, + VREvent_DashboardOverlayCreated = 518, + VREvent_SwitchGamepadFocus = 519, + VREvent_RequestScreenshot = 520, + VREvent_ScreenshotTaken = 521, + VREvent_ScreenshotFailed = 522, + VREvent_SubmitScreenshotToDashboard = 523, + VREvent_ScreenshotProgressToDashboard = 524, + VREvent_PrimaryDashboardDeviceChanged = 525, + VREvent_RoomViewShown = 526, + VREvent_RoomViewHidden = 527, + VREvent_ShowUI = 528, + VREvent_ShowDevTools = 529, + VREvent_DesktopViewUpdating = 530, + VREvent_DesktopViewReady = 531, + VREvent_Notification_Shown = 600, + VREvent_Notification_Hidden = 601, + VREvent_Notification_BeginInteraction = 602, + VREvent_Notification_Destroyed = 603, + VREvent_Quit = 700, + VREvent_ProcessQuit = 701, + VREvent_QuitAcknowledged = 703, + VREvent_DriverRequestedQuit = 704, + VREvent_RestartRequested = 705, + VREvent_ChaperoneDataHasChanged = 800, + VREvent_ChaperoneUniverseHasChanged = 801, + VREvent_ChaperoneTempDataHasChanged = 802, + VREvent_ChaperoneSettingsHaveChanged = 803, + VREvent_SeatedZeroPoseReset = 804, + VREvent_ChaperoneFlushCache = 805, + VREvent_ChaperoneRoomSetupStarting = 806, + VREvent_ChaperoneRoomSetupFinished = 807, + VREvent_StandingZeroPoseReset = 808, + VREvent_AudioSettingsHaveChanged = 820, + VREvent_BackgroundSettingHasChanged = 850, + VREvent_CameraSettingsHaveChanged = 851, + VREvent_ReprojectionSettingHasChanged = 852, + VREvent_ModelSkinSettingsHaveChanged = 853, + VREvent_EnvironmentSettingsHaveChanged = 854, + VREvent_PowerSettingsHaveChanged = 855, + VREvent_EnableHomeAppSettingsHaveChanged = 856, + VREvent_SteamVRSectionSettingChanged = 857, + VREvent_LighthouseSectionSettingChanged = 858, + VREvent_NullSectionSettingChanged = 859, + VREvent_UserInterfaceSectionSettingChanged = 860, + VREvent_NotificationsSectionSettingChanged = 861, + VREvent_KeyboardSectionSettingChanged = 862, + VREvent_PerfSectionSettingChanged = 863, + VREvent_DashboardSectionSettingChanged = 864, + VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, + VREvent_LastKnownSectionSettingChanged = 867, + VREvent_DismissedWarningsSectionSettingChanged = 868, + VREvent_GpuSpeedSectionSettingChanged = 869, + VREvent_WindowsMRSectionSettingChanged = 870, + VREvent_OtherSectionSettingChanged = 871, + VREvent_StatusUpdate = 900, + VREvent_WebInterface_InstallDriverCompleted = 950, + VREvent_MCImageUpdated = 1000, + VREvent_FirmwareUpdateStarted = 1100, + VREvent_FirmwareUpdateFinished = 1101, + VREvent_KeyboardClosed = 1200, + VREvent_KeyboardCharInput = 1201, + VREvent_KeyboardDone = 1202, + VREvent_ApplicationListUpdated = 1303, + VREvent_ApplicationMimeTypeLoad = 1304, + VREvent_ProcessConnected = 1306, + VREvent_ProcessDisconnected = 1307, + VREvent_Compositor_ChaperoneBoundsShown = 1410, + VREvent_Compositor_ChaperoneBoundsHidden = 1411, + VREvent_Compositor_DisplayDisconnected = 1412, + VREvent_Compositor_DisplayReconnected = 1413, + VREvent_Compositor_HDCPError = 1414, + VREvent_Compositor_ApplicationNotResponding = 1415, + VREvent_Compositor_ApplicationResumed = 1416, + VREvent_Compositor_OutOfVideoMemory = 1417, + VREvent_Compositor_DisplayModeNotSupported = 1418, + VREvent_Compositor_StageOverrideReady = 1419, + VREvent_TrackedCamera_StartVideoStream = 1500, + VREvent_TrackedCamera_StopVideoStream = 1501, + VREvent_TrackedCamera_PauseVideoStream = 1502, + VREvent_TrackedCamera_ResumeVideoStream = 1503, + VREvent_TrackedCamera_EditingSurface = 1550, + VREvent_PerformanceTest_EnableCapture = 1600, + VREvent_PerformanceTest_DisableCapture = 1601, + VREvent_PerformanceTest_FidelityLevel = 1602, + VREvent_MessageOverlay_Closed = 1650, + VREvent_MessageOverlayCloseRequested = 1651, + VREvent_Input_HapticVibration = 1700, + VREvent_Input_BindingLoadFailed = 1701, + VREvent_Input_BindingLoadSuccessful = 1702, + VREvent_Input_ActionManifestReloaded = 1703, + VREvent_Input_ActionManifestLoadFailed = 1704, + VREvent_Input_ProgressUpdate = 1705, + VREvent_Input_TrackerActivated = 1706, + VREvent_Input_BindingsUpdated = 1707, + VREvent_Input_BindingSubscriptionChanged = 1708, + VREvent_SpatialAnchors_PoseUpdated = 1800, + VREvent_SpatialAnchors_DescriptorUpdated = 1801, + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, + VREvent_SystemReport_Started = 1900, + VREvent_Monitor_ShowHeadsetView = 2000, + VREvent_Monitor_HideHeadsetView = 2001, + VREvent_VendorSpecific_Reserved_Start = 10000, + VREvent_VendorSpecific_Reserved_End = 19999, +} +public enum EDeviceActivityLevel +{ + k_EDeviceActivityLevel_Unknown = -1, + k_EDeviceActivityLevel_Idle = 0, + k_EDeviceActivityLevel_UserInteraction = 1, + k_EDeviceActivityLevel_UserInteraction_Timeout = 2, + k_EDeviceActivityLevel_Standby = 3, + k_EDeviceActivityLevel_Idle_Timeout = 4, +} +public enum EVRButtonId +{ + k_EButton_System = 0, + k_EButton_ApplicationMenu = 1, + k_EButton_Grip = 2, + k_EButton_DPad_Left = 3, + k_EButton_DPad_Up = 4, + k_EButton_DPad_Right = 5, + k_EButton_DPad_Down = 6, + k_EButton_A = 7, + k_EButton_ProximitySensor = 31, + k_EButton_Axis0 = 32, + k_EButton_Axis1 = 33, + k_EButton_Axis2 = 34, + k_EButton_Axis3 = 35, + k_EButton_Axis4 = 36, + k_EButton_SteamVR_Touchpad = 32, + k_EButton_SteamVR_Trigger = 33, + k_EButton_Dashboard_Back = 2, + k_EButton_IndexController_A = 2, + k_EButton_IndexController_B = 1, + k_EButton_IndexController_JoyStick = 35, + k_EButton_Max = 64, +} +public enum EVRMouseButton +{ + Left = 1, + Right = 2, + Middle = 4, +} +public enum EShowUIType +{ + ShowUI_ControllerBinding = 0, + ShowUI_ManageTrackers = 1, + ShowUI_Pairing = 3, + ShowUI_Settings = 4, + ShowUI_DebugCommands = 5, + ShowUI_FullControllerBinding = 6, + ShowUI_ManageDrivers = 7, +} +public enum EHDCPError +{ + None = 0, + LinkLost = 1, + Tampered = 2, + DeviceRevoked = 3, + Unknown = 4, +} +public enum EVRComponentProperty +{ + IsStatic = 1, + IsVisible = 2, + IsTouched = 4, + IsPressed = 8, + IsScrolled = 16, + IsHighlighted = 32, +} +public enum EVRInputError +{ + None = 0, + NameNotFound = 1, + WrongType = 2, + InvalidHandle = 3, + InvalidParam = 4, + NoSteam = 5, + MaxCapacityReached = 6, + IPCError = 7, + NoActiveActionSet = 8, + InvalidDevice = 9, + InvalidSkeleton = 10, + InvalidBoneCount = 11, + InvalidCompressedData = 12, + NoData = 13, + BufferTooSmall = 14, + MismatchedActionManifest = 15, + MissingSkeletonData = 16, + InvalidBoneIndex = 17, + InvalidPriority = 18, + PermissionDenied = 19, + InvalidRenderModel = 20, +} +public enum EVRSpatialAnchorError +{ + Success = 0, + Internal = 1, + UnknownHandle = 2, + ArrayTooSmall = 3, + InvalidDescriptorChar = 4, + NotYetAvailable = 5, + NotAvailableInThisUniverse = 6, + PermanentlyUnavailable = 7, + WrongDriver = 8, + DescriptorTooLong = 9, + Unknown = 10, + NoRoomCalibration = 11, + InvalidArgument = 12, + UnknownDriver = 13, +} +public enum EHiddenAreaMeshType +{ + k_eHiddenAreaMesh_Standard = 0, + k_eHiddenAreaMesh_Inverse = 1, + k_eHiddenAreaMesh_LineLoop = 2, + k_eHiddenAreaMesh_Max = 3, +} +public enum EVRControllerAxisType +{ + k_eControllerAxis_None = 0, + k_eControllerAxis_TrackPad = 1, + k_eControllerAxis_Joystick = 2, + k_eControllerAxis_Trigger = 3, +} +public enum EVRControllerEventOutputType +{ + ControllerEventOutput_OSEvents = 0, + ControllerEventOutput_VREvents = 1, +} +public enum ECollisionBoundsStyle +{ + COLLISION_BOUNDS_STYLE_BEGINNER = 0, + COLLISION_BOUNDS_STYLE_INTERMEDIATE = 1, + COLLISION_BOUNDS_STYLE_SQUARES = 2, + COLLISION_BOUNDS_STYLE_ADVANCED = 3, + COLLISION_BOUNDS_STYLE_NONE = 4, + COLLISION_BOUNDS_STYLE_COUNT = 5, +} +public enum EVROverlayError +{ + None = 0, + UnknownOverlay = 10, + InvalidHandle = 11, + PermissionDenied = 12, + OverlayLimitExceeded = 13, + WrongVisibilityType = 14, + KeyTooLong = 15, + NameTooLong = 16, + KeyInUse = 17, + WrongTransformType = 18, + InvalidTrackedDevice = 19, + InvalidParameter = 20, + ThumbnailCantBeDestroyed = 21, + ArrayTooSmall = 22, + RequestFailed = 23, + InvalidTexture = 24, + UnableToLoadFile = 25, + KeyboardAlreadyInUse = 26, + NoNeighbor = 27, + TooManyMaskPrimitives = 29, + BadMaskPrimitive = 30, + TextureAlreadyLocked = 31, + TextureLockCapacityReached = 32, + TextureNotLocked = 33, +} +public enum EVRApplicationType +{ + VRApplication_Other = 0, + VRApplication_Scene = 1, + VRApplication_Overlay = 2, + VRApplication_Background = 3, + VRApplication_Utility = 4, + VRApplication_VRMonitor = 5, + VRApplication_SteamWatchdog = 6, + VRApplication_Bootstrapper = 7, + VRApplication_WebHelper = 8, + VRApplication_OpenXRInstance = 9, + VRApplication_OpenXRScene = 10, + VRApplication_OpenXROverlay = 11, + VRApplication_Prism = 12, + VRApplication_Max = 13, +} +public enum EVRFirmwareError +{ + None = 0, + Success = 1, + Fail = 2, +} +public enum EVRNotificationError +{ + OK = 0, + InvalidNotificationId = 100, + NotificationQueueFull = 101, + InvalidOverlayHandle = 102, + SystemWithUserValueAlreadyExists = 103, +} +public enum EVRSkeletalMotionRange +{ + WithController = 0, + WithoutController = 1, +} +public enum EVRSkeletalTrackingLevel +{ + VRSkeletalTracking_Estimated = 0, + VRSkeletalTracking_Partial = 1, + VRSkeletalTracking_Full = 2, + Count = 3, + Max = 2, +} +public enum EVRInitError +{ + None = 0, + Unknown = 1, + Init_InstallationNotFound = 100, + Init_InstallationCorrupt = 101, + Init_VRClientDLLNotFound = 102, + Init_FileNotFound = 103, + Init_FactoryNotFound = 104, + Init_InterfaceNotFound = 105, + Init_InvalidInterface = 106, + Init_UserConfigDirectoryInvalid = 107, + Init_HmdNotFound = 108, + Init_NotInitialized = 109, + Init_PathRegistryNotFound = 110, + Init_NoConfigPath = 111, + Init_NoLogPath = 112, + Init_PathRegistryNotWritable = 113, + Init_AppInfoInitFailed = 114, + Init_Retry = 115, + Init_InitCanceledByUser = 116, + Init_AnotherAppLaunching = 117, + Init_SettingsInitFailed = 118, + Init_ShuttingDown = 119, + Init_TooManyObjects = 120, + Init_NoServerForBackgroundApp = 121, + Init_NotSupportedWithCompositor = 122, + Init_NotAvailableToUtilityApps = 123, + Init_Internal = 124, + Init_HmdDriverIdIsNone = 125, + Init_HmdNotFoundPresenceFailed = 126, + Init_VRMonitorNotFound = 127, + Init_VRMonitorStartupFailed = 128, + Init_LowPowerWatchdogNotSupported = 129, + Init_InvalidApplicationType = 130, + Init_NotAvailableToWatchdogApps = 131, + Init_WatchdogDisabledInSettings = 132, + Init_VRDashboardNotFound = 133, + Init_VRDashboardStartupFailed = 134, + Init_VRHomeNotFound = 135, + Init_VRHomeStartupFailed = 136, + Init_RebootingBusy = 137, + Init_FirmwareUpdateBusy = 138, + Init_FirmwareRecoveryBusy = 139, + Init_USBServiceBusy = 140, + Init_VRWebHelperStartupFailed = 141, + Init_TrackerManagerInitFailed = 142, + Init_AlreadyRunning = 143, + Init_FailedForVrMonitor = 144, + Init_PropertyManagerInitFailed = 145, + Init_WebServerFailed = 146, + Init_IllegalTypeTransition = 147, + Init_MismatchedRuntimes = 148, + Init_InvalidProcessId = 149, + Init_VRServiceStartupFailed = 150, + Init_PrismNeedsNewDrivers = 151, + Init_PrismStartupTimedOut = 152, + Init_CouldNotStartPrism = 153, + Init_CreateDriverDirectDeviceFailed = 154, + Init_PrismExitedUnexpectedly = 155, + Driver_Failed = 200, + Driver_Unknown = 201, + Driver_HmdUnknown = 202, + Driver_NotLoaded = 203, + Driver_RuntimeOutOfDate = 204, + Driver_HmdInUse = 205, + Driver_NotCalibrated = 206, + Driver_CalibrationInvalid = 207, + Driver_HmdDisplayNotFound = 208, + Driver_TrackedDeviceInterfaceUnknown = 209, + Driver_HmdDriverIdOutOfBounds = 211, + Driver_HmdDisplayMirrored = 212, + Driver_HmdDisplayNotFoundLaptop = 213, + IPC_ServerInitFailed = 300, + IPC_ConnectFailed = 301, + IPC_SharedStateInitFailed = 302, + IPC_CompositorInitFailed = 303, + IPC_MutexInitFailed = 304, + IPC_Failed = 305, + IPC_CompositorConnectFailed = 306, + IPC_CompositorInvalidConnectResponse = 307, + IPC_ConnectFailedAfterMultipleAttempts = 308, + IPC_ConnectFailedAfterTargetExited = 309, + IPC_NamespaceUnavailable = 310, + Compositor_Failed = 400, + Compositor_D3D11HardwareRequired = 401, + Compositor_FirmwareRequiresUpdate = 402, + Compositor_OverlayInitFailed = 403, + Compositor_ScreenshotsInitFailed = 404, + Compositor_UnableToCreateDevice = 405, + Compositor_SharedStateIsNull = 406, + Compositor_NotificationManagerIsNull = 407, + Compositor_ResourceManagerClientIsNull = 408, + Compositor_MessageOverlaySharedStateInitFailure = 409, + Compositor_PropertiesInterfaceIsNull = 410, + Compositor_CreateFullscreenWindowFailed = 411, + Compositor_SettingsInterfaceIsNull = 412, + Compositor_FailedToShowWindow = 413, + Compositor_DistortInterfaceIsNull = 414, + Compositor_DisplayFrequencyFailure = 415, + Compositor_RendererInitializationFailed = 416, + Compositor_DXGIFactoryInterfaceIsNull = 417, + Compositor_DXGIFactoryCreateFailed = 418, + Compositor_DXGIFactoryQueryFailed = 419, + Compositor_InvalidAdapterDesktop = 420, + Compositor_InvalidHmdAttachment = 421, + Compositor_InvalidOutputDesktop = 422, + Compositor_InvalidDeviceProvided = 423, + Compositor_D3D11RendererInitializationFailed = 424, + Compositor_FailedToFindDisplayMode = 425, + Compositor_FailedToCreateSwapChain = 426, + Compositor_FailedToGetBackBuffer = 427, + Compositor_FailedToCreateRenderTarget = 428, + Compositor_FailedToCreateDXGI2SwapChain = 429, + Compositor_FailedtoGetDXGI2BackBuffer = 430, + Compositor_FailedToCreateDXGI2RenderTarget = 431, + Compositor_FailedToGetDXGIDeviceInterface = 432, + Compositor_SelectDisplayMode = 433, + Compositor_FailedToCreateNvAPIRenderTargets = 434, + Compositor_NvAPISetDisplayMode = 435, + Compositor_FailedToCreateDirectModeDisplay = 436, + Compositor_InvalidHmdPropertyContainer = 437, + Compositor_UpdateDisplayFrequency = 438, + Compositor_CreateRasterizerState = 439, + Compositor_CreateWireframeRasterizerState = 440, + Compositor_CreateSamplerState = 441, + Compositor_CreateClampToBorderSamplerState = 442, + Compositor_CreateAnisoSamplerState = 443, + Compositor_CreateOverlaySamplerState = 444, + Compositor_CreatePanoramaSamplerState = 445, + Compositor_CreateFontSamplerState = 446, + Compositor_CreateNoBlendState = 447, + Compositor_CreateBlendState = 448, + Compositor_CreateAlphaBlendState = 449, + Compositor_CreateBlendStateMaskR = 450, + Compositor_CreateBlendStateMaskG = 451, + Compositor_CreateBlendStateMaskB = 452, + Compositor_CreateDepthStencilState = 453, + Compositor_CreateDepthStencilStateNoWrite = 454, + Compositor_CreateDepthStencilStateNoDepth = 455, + Compositor_CreateFlushTexture = 456, + Compositor_CreateDistortionSurfaces = 457, + Compositor_CreateConstantBuffer = 458, + Compositor_CreateHmdPoseConstantBuffer = 459, + Compositor_CreateHmdPoseStagingConstantBuffer = 460, + Compositor_CreateSharedFrameInfoConstantBuffer = 461, + Compositor_CreateOverlayConstantBuffer = 462, + Compositor_CreateSceneTextureIndexConstantBuffer = 463, + Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464, + Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465, + Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466, + Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467, + Compositor_CreateComputeHmdPoseConstantBuffer = 468, + Compositor_CreateGeomConstantBuffer = 469, + Compositor_CreatePanelMaskConstantBuffer = 470, + Compositor_CreatePixelSimUBO = 471, + Compositor_CreateMSAARenderTextures = 472, + Compositor_CreateResolveRenderTextures = 473, + Compositor_CreateComputeResolveRenderTextures = 474, + Compositor_CreateDriverDirectModeResolveTextures = 475, + Compositor_OpenDriverDirectModeResolveTextures = 476, + Compositor_CreateFallbackSyncTexture = 477, + Compositor_ShareFallbackSyncTexture = 478, + Compositor_CreateOverlayIndexBuffer = 479, + Compositor_CreateOverlayVertexBuffer = 480, + Compositor_CreateTextVertexBuffer = 481, + Compositor_CreateTextIndexBuffer = 482, + Compositor_CreateMirrorTextures = 483, + Compositor_CreateLastFrameRenderTexture = 484, + Compositor_CreateMirrorOverlay = 485, + Compositor_FailedToCreateVirtualDisplayBackbuffer = 486, + Compositor_DisplayModeNotSupported = 487, + Compositor_CreateOverlayInvalidCall = 488, + Compositor_CreateOverlayAlreadyInitialized = 489, + Compositor_FailedToCreateMailbox = 490, + Compositor_WindowInterfaceIsNull = 491, + Compositor_SystemLayerCreateInstance = 492, + Compositor_SystemLayerCreateSession = 493, + VendorSpecific_UnableToConnectToOculusRuntime = 1000, + VendorSpecific_WindowsNotInDevMode = 1001, + VendorSpecific_HmdFound_CantOpenDevice = 1101, + VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, + VendorSpecific_HmdFound_NoStoredConfig = 1103, + VendorSpecific_HmdFound_ConfigTooBig = 1104, + VendorSpecific_HmdFound_ConfigTooSmall = 1105, + VendorSpecific_HmdFound_UnableToInitZLib = 1106, + VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, + VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, + VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, + VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, + VendorSpecific_HmdFound_UserDataAddressRange = 1111, + VendorSpecific_HmdFound_UserDataError = 1112, + VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, + VendorSpecific_OculusRuntimeBadInstall = 1114, + Steam_SteamInstallationNotFound = 2000, + LastError = 2001, +} +public enum EVRScreenshotType +{ + None = 0, + Mono = 1, + Stereo = 2, + Cubemap = 3, + MonoPanorama = 4, + StereoPanorama = 5, +} +public enum EVRScreenshotPropertyFilenames +{ + Preview = 0, + VR = 1, +} +public enum EVRTrackedCameraError +{ + None = 0, + OperationFailed = 100, + InvalidHandle = 101, + InvalidFrameHeaderVersion = 102, + OutOfHandles = 103, + IPCFailure = 104, + NotSupportedForThisDevice = 105, + SharedMemoryFailure = 106, + FrameBufferingFailure = 107, + StreamSetupFailure = 108, + InvalidGLTextureId = 109, + InvalidSharedTextureHandle = 110, + FailedToGetGLTextureId = 111, + SharedTextureFailure = 112, + NoFrameAvailable = 113, + InvalidArgument = 114, + InvalidFrameBufferSize = 115, +} +public enum EVRTrackedCameraFrameLayout +{ + Mono = 1, + Stereo = 2, + VerticalLayout = 16, + HorizontalLayout = 32, +} +public enum EVRTrackedCameraFrameType +{ + Distorted = 0, + Undistorted = 1, + MaximumUndistorted = 2, + MAX_CAMERA_FRAME_TYPES = 3, +} +public enum EVRDistortionFunctionType +{ + None = 0, + FTheta = 1, + Extended_FTheta = 2, + MAX_DISTORTION_FUNCTION_TYPES = 3, +} +public enum EVSync +{ + None = 0, + WaitRender = 1, + NoWaitRender = 2, +} +public enum EVRMuraCorrectionMode +{ + Default = 0, + NoCorrection = 1, +} +public enum Imu_OffScaleFlags +{ + OffScale_AccelX = 1, + OffScale_AccelY = 2, + OffScale_AccelZ = 4, + OffScale_GyroX = 8, + OffScale_GyroY = 16, + OffScale_GyroZ = 32, +} +public enum EVRApplicationError +{ + None = 0, + AppKeyAlreadyExists = 100, + NoManifest = 101, + NoApplication = 102, + InvalidIndex = 103, + UnknownApplication = 104, + IPCFailed = 105, + ApplicationAlreadyRunning = 106, + InvalidManifest = 107, + InvalidApplication = 108, + LaunchFailed = 109, + ApplicationAlreadyStarting = 110, + LaunchInProgress = 111, + OldApplicationQuitting = 112, + TransitionAborted = 113, + IsTemplate = 114, + SteamVRIsExiting = 115, + BufferTooSmall = 200, + PropertyNotSet = 201, + UnknownProperty = 202, + InvalidParameter = 203, + NotImplemented = 300, +} +public enum EVRApplicationProperty +{ + Name_String = 0, + LaunchType_String = 11, + WorkingDirectory_String = 12, + BinaryPath_String = 13, + Arguments_String = 14, + URL_String = 15, + Description_String = 50, + NewsURL_String = 51, + ImagePath_String = 52, + Source_String = 53, + ActionManifestURL_String = 54, + IsDashboardOverlay_Bool = 60, + IsTemplate_Bool = 61, + IsInstanced_Bool = 62, + IsInternal_Bool = 63, + WantsCompositorPauseInStandby_Bool = 64, + IsHidden_Bool = 65, + LastLaunchTime_Uint64 = 70, +} +public enum EVRSceneApplicationState +{ + None = 0, + Starting = 1, + Quitting = 2, + Running = 3, + Waiting = 4, +} +public enum ChaperoneCalibrationState +{ + OK = 1, + Warning = 100, + Warning_BaseStationMayHaveMoved = 101, + Warning_BaseStationRemoved = 102, + Warning_SeatedBoundsInvalid = 103, + Error = 200, + Error_BaseStationUninitialized = 201, + Error_BaseStationConflict = 202, + Error_PlayAreaInvalid = 203, + Error_CollisionBoundsInvalid = 204, +} +public enum EChaperoneConfigFile +{ + Live = 1, + Temp = 2, +} +public enum EChaperoneImportFlags +{ + EChaperoneImport_BoundsOnly = 1, +} +public enum EVRCompositorError +{ + None = 0, + RequestFailed = 1, + IncompatibleVersion = 100, + DoNotHaveFocus = 101, + InvalidTexture = 102, + IsNotSceneApplication = 103, + TextureIsOnWrongDevice = 104, + TextureUsesUnsupportedFormat = 105, + SharedTexturesNotSupported = 106, + IndexOutOfRange = 107, + AlreadySubmitted = 108, + InvalidBounds = 109, + AlreadySet = 110, +} +public enum EVRCompositorTimingMode +{ + Implicit = 0, + Explicit_RuntimePerformsPostPresentHandoff = 1, + Explicit_ApplicationPerformsPostPresentHandoff = 2, +} +public enum VROverlayInputMethod +{ + None = 0, + Mouse = 1, +} +public enum VROverlayTransformType +{ + VROverlayTransform_Invalid = -1, + VROverlayTransform_Absolute = 0, + VROverlayTransform_TrackedDeviceRelative = 1, + VROverlayTransform_SystemOverlay = 2, + VROverlayTransform_TrackedComponent = 3, + VROverlayTransform_Cursor = 4, + VROverlayTransform_DashboardTab = 5, + VROverlayTransform_DashboardThumb = 6, + VROverlayTransform_Mountable = 7, + VROverlayTransform_Projection = 8, +} +public enum VROverlayFlags +{ + NoDashboardTab = 8, + SendVRDiscreteScrollEvents = 64, + SendVRTouchpadEvents = 128, + ShowTouchPadScrollWheel = 256, + TransferOwnershipToInternalProcess = 512, + SideBySide_Parallel = 1024, + SideBySide_Crossed = 2048, + Panorama = 4096, + StereoPanorama = 8192, + SortWithNonSceneOverlays = 16384, + VisibleInDashboard = 32768, + MakeOverlaysInteractiveIfVisible = 65536, + SendVRSmoothScrollEvents = 131072, + ProtectedContent = 262144, + HideLaserIntersection = 524288, + WantsModalBehavior = 1048576, + IsPremultiplied = 2097152, +} +public enum VRMessageOverlayResponse +{ + ButtonPress_0 = 0, + ButtonPress_1 = 1, + ButtonPress_2 = 2, + ButtonPress_3 = 3, + CouldntFindSystemOverlay = 4, + CouldntFindOrCreateClientOverlay = 5, + ApplicationQuit = 6, +} +public enum EGamepadTextInputMode +{ + k_EGamepadTextInputModeNormal = 0, + k_EGamepadTextInputModePassword = 1, + k_EGamepadTextInputModeSubmit = 2, +} +public enum EGamepadTextInputLineMode +{ + k_EGamepadTextInputLineModeSingleLine = 0, + k_EGamepadTextInputLineModeMultipleLines = 1, +} +public enum EVROverlayIntersectionMaskPrimitiveType +{ + OverlayIntersectionPrimitiveType_Rectangle = 0, + OverlayIntersectionPrimitiveType_Circle = 1, +} +public enum EKeyboardFlags +{ + KeyboardFlag_Minimal = 1, + KeyboardFlag_Modal = 2, +} +public enum EDeviceType +{ + Invalid = -1, + DirectX11 = 0, + Vulkan = 1, +} +public enum HeadsetViewMode_t +{ + HeadsetViewMode_Left = 0, + HeadsetViewMode_Right = 1, + HeadsetViewMode_Both = 2, +} +public enum EVRRenderModelError +{ + None = 0, + Loading = 100, + NotSupported = 200, + InvalidArg = 300, + InvalidModel = 301, + NoShapes = 302, + MultipleShapes = 303, + TooManyVertices = 304, + MultipleTextures = 305, + BufferTooSmall = 306, + NotEnoughNormals = 307, + NotEnoughTexCoords = 308, + InvalidTexture = 400, +} +public enum EVRRenderModelTextureFormat +{ + RGBA8_SRGB = 0, + BC2 = 1, + BC4 = 2, + BC7 = 3, + BC7_SRGB = 4, +} +public enum EVRNotificationType +{ + Transient = 0, + Persistent = 1, + Transient_SystemWithUserValue = 2, +} +public enum EVRNotificationStyle +{ + None = 0, + Application = 100, + Contact_Disabled = 200, + Contact_Enabled = 201, + Contact_Active = 202, +} +public enum EVRSettingsError +{ + None = 0, + IPCFailed = 1, + WriteFailed = 2, + ReadFailed = 3, + JsonParseFailed = 4, + UnsetSettingHasNoDefault = 5, +} +public enum EVRScreenshotError +{ + None = 0, + RequestFailed = 1, + IncompatibleVersion = 100, + NotFound = 101, + BufferTooSmall = 102, + ScreenshotAlreadyInProgress = 108, +} +public enum EVRSkeletalTransformSpace +{ + Model = 0, + Parent = 1, +} +public enum EVRSkeletalReferencePose +{ + BindPose = 0, + OpenHand = 1, + Fist = 2, + GripLimit = 3, +} +public enum EVRFinger +{ + Thumb = 0, + Index = 1, + Middle = 2, + Ring = 3, + Pinky = 4, + Count = 5, +} +public enum EVRFingerSplay +{ + Thumb_Index = 0, + Index_Middle = 1, + Middle_Ring = 2, + Ring_Pinky = 3, + Count = 4, +} +public enum EVRSummaryType +{ + FromAnimation = 0, + FromDevice = 1, +} +public enum EVRInputFilterCancelType +{ + VRInputFilterCancel_Timers = 0, + VRInputFilterCancel_Momentum = 1, +} +public enum EVRInputStringBits +{ + VRInputString_Hand = 1, + VRInputString_ControllerType = 2, + VRInputString_InputSource = 4, + VRInputString_All = -1, +} +public enum EIOBufferError +{ + IOBuffer_Success = 0, + IOBuffer_OperationFailed = 100, + IOBuffer_InvalidHandle = 101, + IOBuffer_InvalidArgument = 102, + IOBuffer_PathExists = 103, + IOBuffer_PathDoesNotExist = 104, + IOBuffer_Permission = 105, +} +public enum EIOBufferMode +{ + Read = 1, + Write = 2, + Create = 512, +} +public enum EVRDebugError +{ + Success = 0, + BadParameter = 1, +} +public enum EPropertyWriteType +{ + PropertyWrite_Set = 0, + PropertyWrite_Erase = 1, + PropertyWrite_SetError = 2, +} +public enum EBlockQueueError +{ + None = 0, + QueueAlreadyExists = 1, + QueueNotFound = 2, + BlockNotAvailable = 3, + InvalidHandle = 4, + InvalidParam = 5, + ParamMismatch = 6, + InternalError = 7, + AlreadyInitialized = 8, + OperationIsServerOnly = 9, + TooManyConnections = 10, +} +public enum EBlockQueueReadType +{ + BlockQueueRead_Latest = 0, + BlockQueueRead_New = 1, + BlockQueueRead_Next = 2, +} + +[StructLayout(LayoutKind.Explicit)] public struct VREvent_Data_t +{ + [FieldOffset(0)] public VREvent_Reserved_t reserved; + [FieldOffset(0)] public VREvent_Controller_t controller; + [FieldOffset(0)] public VREvent_Mouse_t mouse; + [FieldOffset(0)] public VREvent_Scroll_t scroll; + [FieldOffset(0)] public VREvent_Process_t process; + [FieldOffset(0)] public VREvent_Notification_t notification; + [FieldOffset(0)] public VREvent_Overlay_t overlay; + [FieldOffset(0)] public VREvent_Status_t status; + [FieldOffset(0)] public VREvent_Ipd_t ipd; + [FieldOffset(0)] public VREvent_Chaperone_t chaperone; + [FieldOffset(0)] public VREvent_PerformanceTest_t performanceTest; + [FieldOffset(0)] public VREvent_TouchPadMove_t touchPadMove; + [FieldOffset(0)] public VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + [FieldOffset(0)] public VREvent_Screenshot_t screenshot; + [FieldOffset(0)] public VREvent_ScreenshotProgress_t screenshotProgress; + [FieldOffset(0)] public VREvent_ApplicationLaunch_t applicationLaunch; + [FieldOffset(0)] public VREvent_EditingCameraSurface_t cameraSurface; + [FieldOffset(0)] public VREvent_MessageOverlay_t messageOverlay; + [FieldOffset(0)] public VREvent_Property_t property; + [FieldOffset(0)] public VREvent_HapticVibration_t hapticVibration; + [FieldOffset(0)] public VREvent_WebConsole_t webConsole; + [FieldOffset(0)] public VREvent_InputBindingLoad_t inputBinding; + [FieldOffset(0)] public VREvent_SpatialAnchor_t spatialAnchor; + [FieldOffset(0)] public VREvent_InputActionManifestLoad_t actionManifest; + [FieldOffset(0)] public VREvent_ProgressUpdate_t progressUpdate; + [FieldOffset(0)] public VREvent_ShowUI_t showUi; + [FieldOffset(0)] public VREvent_ShowDevTools_t showDevTools; + [FieldOffset(0)] public VREvent_HDCPError_t hdcpError; + [FieldOffset(0)] public VREvent_Keyboard_t keyboard; // This has to be at the end due to a mono bug +} + + +[StructLayout(LayoutKind.Explicit)] public struct VROverlayIntersectionMaskPrimitive_Data_t +{ + [FieldOffset(0)] public IntersectionMaskRectangle_t m_Rectangle; + [FieldOffset(0)] public IntersectionMaskCircle_t m_Circle; +} + +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix34_t +{ + public float m0; //float[3][4] + public float m1; + public float m2; + public float m3; + public float m4; + public float m5; + public float m6; + public float m7; + public float m8; + public float m9; + public float m10; + public float m11; +#if UNITY_5_3_OR_NEWER + + public Vector3 GetPosition() + { + return new Vector3(m3, m7, -m11); + } + + public bool IsRotationValid() + { + return ((m2 != 0 || m6 != 0 || m10 != 0) && (m1 != 0 || m5 != 0 || m9 != 0)); + } + + public Quaternion GetRotation() + { + if (IsRotationValid()) + { + float w = Mathf.Sqrt(Mathf.Max(0, 1 + m0 + m5 + m10)) / 2; + float x = Mathf.Sqrt(Mathf.Max(0, 1 + m0 - m5 - m10)) / 2; + float y = Mathf.Sqrt(Mathf.Max(0, 1 - m0 + m5 - m10)) / 2; + float z = Mathf.Sqrt(Mathf.Max(0, 1 - m0 - m5 + m10)) / 2; + + _copysign(ref x, -m9 - -m6); + _copysign(ref y, -m2 - -m8); + _copysign(ref z, m4 - m1); + + return new Quaternion(x, y, z, w); + } + return Quaternion.identity; + } + + private static void _copysign(ref float sizeval, float signval) + { + if (signval > 0 != sizeval > 0) + sizeval = -sizeval; + } +#endif +} +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix33_t +{ + public float m0; //float[3][3] + public float m1; + public float m2; + public float m3; + public float m4; + public float m5; + public float m6; + public float m7; + public float m8; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdMatrix44_t +{ + public float m0; //float[4][4] + public float m1; + public float m2; + public float m3; + public float m4; + public float m5; + public float m6; + public float m7; + public float m8; + public float m9; + public float m10; + public float m11; + public float m12; + public float m13; + public float m14; + public float m15; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdVector3_t +{ + public float v0; //float[3] + public float v1; + public float v2; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdVector4_t +{ + public float v0; //float[4] + public float v1; + public float v2; + public float v3; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdVector3d_t +{ + public double v0; //double[3] + public double v1; + public double v2; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdVector2_t +{ + public float v0; //float[2] + public float v1; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdQuaternion_t +{ + public double w; + public double x; + public double y; + public double z; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdQuaternionf_t +{ + public float w; + public float x; + public float y; + public float z; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdColor_t +{ + public float r; + public float g; + public float b; + public float a; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdQuad_t +{ + public HmdVector3_t vCorners0; //HmdVector3_t[4] + public HmdVector3_t vCorners1; + public HmdVector3_t vCorners2; + public HmdVector3_t vCorners3; +} +[StructLayout(LayoutKind.Sequential)] public struct HmdRect2_t +{ + public HmdVector2_t vTopLeft; + public HmdVector2_t vBottomRight; +} +[StructLayout(LayoutKind.Sequential)] public struct VRBoneTransform_t +{ + public HmdVector4_t position; + public HmdQuaternionf_t orientation; +} +[StructLayout(LayoutKind.Sequential)] public struct DistortionCoordinates_t +{ + public float rfRed0; //float[2] + public float rfRed1; + public float rfGreen0; //float[2] + public float rfGreen1; + public float rfBlue0; //float[2] + public float rfBlue1; +} +[StructLayout(LayoutKind.Sequential)] public struct Texture_t +{ + public IntPtr handle; // void * + public ETextureType eType; + public EColorSpace eColorSpace; +} +[StructLayout(LayoutKind.Sequential)] public struct TrackedDevicePose_t +{ + public HmdMatrix34_t mDeviceToAbsoluteTracking; + public HmdVector3_t vVelocity; + public HmdVector3_t vAngularVelocity; + public ETrackingResult eTrackingResult; + [MarshalAs(UnmanagedType.I1)] + public bool bPoseIsValid; + [MarshalAs(UnmanagedType.I1)] + public bool bDeviceIsConnected; +} +[StructLayout(LayoutKind.Sequential)] public struct VRTextureBounds_t +{ + public float uMin; + public float vMin; + public float uMax; + public float vMax; +} +[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithPose_t +{ + public IntPtr handle; // void * + public ETextureType eType; + public EColorSpace eColorSpace; + public HmdMatrix34_t mDeviceToAbsoluteTracking; +} +[StructLayout(LayoutKind.Sequential)] public struct VRTextureDepthInfo_t +{ + public IntPtr handle; // void * + public HmdMatrix44_t mProjection; + public HmdVector2_t vRange; +} +[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithDepth_t +{ + public IntPtr handle; // void * + public ETextureType eType; + public EColorSpace eColorSpace; + public VRTextureDepthInfo_t depth; +} +[StructLayout(LayoutKind.Sequential)] public struct VRTextureWithPoseAndDepth_t +{ + public IntPtr handle; // void * + public ETextureType eType; + public EColorSpace eColorSpace; + public HmdMatrix34_t mDeviceToAbsoluteTracking; + public VRTextureDepthInfo_t depth; +} +[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureData_t +{ + public ulong m_nImage; + public IntPtr m_pDevice; // struct VkDevice_T * + public IntPtr m_pPhysicalDevice; // struct VkPhysicalDevice_T * + public IntPtr m_pInstance; // struct VkInstance_T * + public IntPtr m_pQueue; // struct VkQueue_T * + public uint m_nQueueFamilyIndex; + public uint m_nWidth; + public uint m_nHeight; + public uint m_nFormat; + public uint m_nSampleCount; +} +[StructLayout(LayoutKind.Sequential)] public struct VRVulkanTextureArrayData_t +{ + public uint m_unArrayIndex; + public uint m_unArraySize; +} +[StructLayout(LayoutKind.Sequential)] public struct D3D12TextureData_t +{ + public IntPtr m_pResource; // struct ID3D12Resource * + public IntPtr m_pCommandQueue; // struct ID3D12CommandQueue * + public uint m_nNodeMask; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Controller_t +{ + public uint button; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Mouse_t +{ + public float x; + public float y; + public uint button; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Scroll_t +{ + public float xdelta; + public float ydelta; + public uint unused; + public float viewportscale; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_TouchPadMove_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bFingerDown; + public float flSecondsFingerDown; + public float fValueXFirst; + public float fValueYFirst; + public float fValueXRaw; + public float fValueYRaw; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Notification_t +{ + public ulong ulUserValue; + public uint notificationId; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Process_t +{ + public uint pid; + public uint oldPid; + [MarshalAs(UnmanagedType.I1)] + public bool bForced; + [MarshalAs(UnmanagedType.I1)] + public bool bConnectionLost; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Overlay_t +{ + public ulong overlayHandle; + public ulong devicePath; + public ulong memoryBlockId; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Status_t +{ + public uint statusState; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Keyboard_t +{ + public byte cNewInput0,cNewInput1,cNewInput2,cNewInput3,cNewInput4,cNewInput5,cNewInput6,cNewInput7; + public string cNewInput + { + get + { + return new string(new char[] { + (char)cNewInput0, + (char)cNewInput1, + (char)cNewInput2, + (char)cNewInput3, + (char)cNewInput4, + (char)cNewInput5, + (char)cNewInput6, + (char)cNewInput7 + }).TrimEnd('\0'); + } + } + public ulong uUserValue; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Ipd_t +{ + public float ipdMeters; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Chaperone_t +{ + public ulong m_nPreviousUniverse; + public ulong m_nCurrentUniverse; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Reserved_t +{ + public ulong reserved0; + public ulong reserved1; + public ulong reserved2; + public ulong reserved3; + public ulong reserved4; + public ulong reserved5; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_PerformanceTest_t +{ + public uint m_nFidelityLevel; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_SeatedZeroPoseReset_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bResetBySystemMenu; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Screenshot_t +{ + public uint handle; + public uint type; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_ScreenshotProgress_t +{ + public float progress; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_ApplicationLaunch_t +{ + public uint pid; + public uint unArgsHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_EditingCameraSurface_t +{ + public ulong overlayHandle; + public uint nVisualMode; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_MessageOverlay_t +{ + public uint unVRMessageOverlayResponse; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_Property_t +{ + public ulong container; + public ETrackedDeviceProperty prop; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_HapticVibration_t +{ + public ulong containerHandle; + public ulong componentHandle; + public float fDurationSeconds; + public float fFrequency; + public float fAmplitude; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_WebConsole_t +{ + public ulong webConsoleHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_InputBindingLoad_t +{ + public ulong ulAppContainer; + public ulong pathMessage; + public ulong pathUrl; + public ulong pathControllerType; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_InputActionManifestLoad_t +{ + public ulong pathAppKey; + public ulong pathMessage; + public ulong pathMessageParam; + public ulong pathManifestPath; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_SpatialAnchor_t +{ + public uint unHandle; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_ProgressUpdate_t +{ + public ulong ulApplicationPropertyContainer; + public ulong pathDevice; + public ulong pathInputSource; + public ulong pathProgressAction; + public ulong pathIcon; + public float fProgress; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_ShowUI_t +{ + public EShowUIType eType; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_ShowDevTools_t +{ + public int nBrowserIdentifier; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_HDCPError_t +{ + public EHDCPError eCode; +} +[StructLayout(LayoutKind.Sequential)] public struct VREvent_t +{ + public uint eventType; + public uint trackedDeviceIndex; + public float eventAgeSeconds; + public VREvent_Data_t data; +} +// This structure is for backwards binary compatibility on Linux and OSX only +[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct VREvent_t_Packed +{ + public uint eventType; + public uint trackedDeviceIndex; + public float eventAgeSeconds; + public VREvent_Data_t data; + public VREvent_t_Packed(VREvent_t unpacked) + { + this.eventType = unpacked.eventType; + this.trackedDeviceIndex = unpacked.trackedDeviceIndex; + this.eventAgeSeconds = unpacked.eventAgeSeconds; + this.data = unpacked.data; + } + public void Unpack(ref VREvent_t unpacked) + { + unpacked.eventType = this.eventType; + unpacked.trackedDeviceIndex = this.trackedDeviceIndex; + unpacked.eventAgeSeconds = this.eventAgeSeconds; + unpacked.data = this.data; + } +} +[StructLayout(LayoutKind.Sequential)] public struct RenderModel_ComponentState_t +{ + public HmdMatrix34_t mTrackingToComponentRenderModel; + public HmdMatrix34_t mTrackingToComponentLocal; + public uint uProperties; +} +[StructLayout(LayoutKind.Sequential)] public struct HiddenAreaMesh_t +{ + public IntPtr pVertexData; // const struct vr::HmdVector2_t * + public uint unTriangleCount; +} +[StructLayout(LayoutKind.Sequential)] public struct VRControllerAxis_t +{ + public float x; + public float y; +} +[StructLayout(LayoutKind.Sequential)] public struct VRControllerState_t +{ + public uint unPacketNum; + public ulong ulButtonPressed; + public ulong ulButtonTouched; + public VRControllerAxis_t rAxis0; //VRControllerAxis_t[5] + public VRControllerAxis_t rAxis1; + public VRControllerAxis_t rAxis2; + public VRControllerAxis_t rAxis3; + public VRControllerAxis_t rAxis4; +} +// This structure is for backwards binary compatibility on Linux and OSX only +[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct VRControllerState_t_Packed +{ + public uint unPacketNum; + public ulong ulButtonPressed; + public ulong ulButtonTouched; + public VRControllerAxis_t rAxis0; //VRControllerAxis_t[5] + public VRControllerAxis_t rAxis1; + public VRControllerAxis_t rAxis2; + public VRControllerAxis_t rAxis3; + public VRControllerAxis_t rAxis4; + public VRControllerState_t_Packed(VRControllerState_t unpacked) + { + this.unPacketNum = unpacked.unPacketNum; + this.ulButtonPressed = unpacked.ulButtonPressed; + this.ulButtonTouched = unpacked.ulButtonTouched; + this.rAxis0 = unpacked.rAxis0; + this.rAxis1 = unpacked.rAxis1; + this.rAxis2 = unpacked.rAxis2; + this.rAxis3 = unpacked.rAxis3; + this.rAxis4 = unpacked.rAxis4; + } + public void Unpack(ref VRControllerState_t unpacked) + { + unpacked.unPacketNum = this.unPacketNum; + unpacked.ulButtonPressed = this.ulButtonPressed; + unpacked.ulButtonTouched = this.ulButtonTouched; + unpacked.rAxis0 = this.rAxis0; + unpacked.rAxis1 = this.rAxis1; + unpacked.rAxis2 = this.rAxis2; + unpacked.rAxis3 = this.rAxis3; + unpacked.rAxis4 = this.rAxis4; + } +} +[StructLayout(LayoutKind.Sequential)] public struct CameraVideoStreamFrameHeader_t +{ + public EVRTrackedCameraFrameType eFrameType; + public uint nWidth; + public uint nHeight; + public uint nBytesPerPixel; + public uint nFrameSequence; + public TrackedDevicePose_t trackedDevicePose; + public ulong ulFrameExposureTime; +} +[StructLayout(LayoutKind.Sequential)] public struct Compositor_FrameTiming +{ + public uint m_nSize; + public uint m_nFrameIndex; + public uint m_nNumFramePresents; + public uint m_nNumMisPresented; + public uint m_nNumDroppedFrames; + public uint m_nReprojectionFlags; + public double m_flSystemTimeInSeconds; + public float m_flPreSubmitGpuMs; + public float m_flPostSubmitGpuMs; + public float m_flTotalRenderGpuMs; + public float m_flCompositorRenderGpuMs; + public float m_flCompositorRenderCpuMs; + public float m_flCompositorIdleCpuMs; + public float m_flClientFrameIntervalMs; + public float m_flPresentCallCpuMs; + public float m_flWaitForPresentCpuMs; + public float m_flSubmitFrameMs; + public float m_flWaitGetPosesCalledMs; + public float m_flNewPosesReadyMs; + public float m_flNewFrameReadyMs; + public float m_flCompositorUpdateStartMs; + public float m_flCompositorUpdateEndMs; + public float m_flCompositorRenderStartMs; + public TrackedDevicePose_t m_HmdPose; + public uint m_nNumVSyncsReadyForUse; + public uint m_nNumVSyncsToFirstView; +} +[StructLayout(LayoutKind.Sequential)] public struct Compositor_BenchmarkResults +{ + public float m_flMegaPixelsPerSecond; + public float m_flHmdRecommendedMegaPixelsPerSecond; +} +[StructLayout(LayoutKind.Sequential)] public struct DriverDirectMode_FrameTiming +{ + public uint m_nSize; + public uint m_nNumFramePresents; + public uint m_nNumMisPresented; + public uint m_nNumDroppedFrames; + public uint m_nReprojectionFlags; +} +[StructLayout(LayoutKind.Sequential)] public struct ImuSample_t +{ + public double fSampleTime; + public HmdVector3d_t vAccel; + public HmdVector3d_t vGyro; + public uint unOffScaleFlags; +} +[StructLayout(LayoutKind.Sequential)] public struct AppOverrideKeys_t +{ + public IntPtr pchKey; // const char * + public IntPtr pchValue; // const char * +} +[StructLayout(LayoutKind.Sequential)] public struct Compositor_CumulativeStats +{ + public uint m_nPid; + public uint m_nNumFramePresents; + public uint m_nNumDroppedFrames; + public uint m_nNumReprojectedFrames; + public uint m_nNumFramePresentsOnStartup; + public uint m_nNumDroppedFramesOnStartup; + public uint m_nNumReprojectedFramesOnStartup; + public uint m_nNumLoading; + public uint m_nNumFramePresentsLoading; + public uint m_nNumDroppedFramesLoading; + public uint m_nNumReprojectedFramesLoading; + public uint m_nNumTimedOut; + public uint m_nNumFramePresentsTimedOut; + public uint m_nNumDroppedFramesTimedOut; + public uint m_nNumReprojectedFramesTimedOut; +} +[StructLayout(LayoutKind.Sequential)] public struct Compositor_StageRenderSettings +{ + public HmdColor_t m_PrimaryColor; + public HmdColor_t m_SecondaryColor; + public float m_flVignetteInnerRadius; + public float m_flVignetteOuterRadius; + public float m_flFresnelStrength; + [MarshalAs(UnmanagedType.I1)] + public bool m_bBackfaceCulling; + [MarshalAs(UnmanagedType.I1)] + public bool m_bGreyscale; + [MarshalAs(UnmanagedType.I1)] + public bool m_bWireframe; +} +[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionParams_t +{ + public HmdVector3_t vSource; + public HmdVector3_t vDirection; + public ETrackingUniverseOrigin eOrigin; +} +[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionResults_t +{ + public HmdVector3_t vPoint; + public HmdVector3_t vNormal; + public HmdVector2_t vUVs; + public float fDistance; +} +[StructLayout(LayoutKind.Sequential)] public struct IntersectionMaskRectangle_t +{ + public float m_flTopLeftX; + public float m_flTopLeftY; + public float m_flWidth; + public float m_flHeight; +} +[StructLayout(LayoutKind.Sequential)] public struct IntersectionMaskCircle_t +{ + public float m_flCenterX; + public float m_flCenterY; + public float m_flRadius; +} +[StructLayout(LayoutKind.Sequential)] public struct VROverlayIntersectionMaskPrimitive_t +{ + public EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; + public VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; +} +[StructLayout(LayoutKind.Sequential)] public struct VROverlayProjection_t +{ + public float fLeft; + public float fRight; + public float fTop; + public float fBottom; +} +[StructLayout(LayoutKind.Sequential)] public struct VROverlayView_t +{ + public ulong overlayHandle; + public Texture_t texture; + public VRTextureBounds_t textureBounds; +} +[StructLayout(LayoutKind.Sequential)] public struct VRVulkanDevice_t +{ + public IntPtr m_pInstance; // struct VkInstance_T * + public IntPtr m_pDevice; // struct VkDevice_T * + public IntPtr m_pPhysicalDevice; // struct VkPhysicalDevice_T * + public IntPtr m_pQueue; // struct VkQueue_T * + public uint m_uQueueFamilyIndex; +} +[StructLayout(LayoutKind.Sequential)] public struct VRNativeDevice_t +{ + public IntPtr handle; // void * + public EDeviceType eType; +} +[StructLayout(LayoutKind.Sequential)] public struct RenderModel_Vertex_t +{ + public HmdVector3_t vPosition; + public HmdVector3_t vNormal; + public float rfTextureCoord0; //float[2] + public float rfTextureCoord1; +} +[StructLayout(LayoutKind.Sequential)] public struct RenderModel_TextureMap_t +{ + public ushort unWidth; + public ushort unHeight; + public IntPtr rubTextureMapData; // const uint8_t * + public EVRRenderModelTextureFormat format; +} +// This structure is for backwards binary compatibility on Linux and OSX only +[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct RenderModel_TextureMap_t_Packed +{ + public ushort unWidth; + public ushort unHeight; + public IntPtr rubTextureMapData; // const uint8_t * + public EVRRenderModelTextureFormat format; + public RenderModel_TextureMap_t_Packed(RenderModel_TextureMap_t unpacked) + { + this.unWidth = unpacked.unWidth; + this.unHeight = unpacked.unHeight; + this.rubTextureMapData = unpacked.rubTextureMapData; + this.format = unpacked.format; + } + public void Unpack(ref RenderModel_TextureMap_t unpacked) + { + unpacked.unWidth = this.unWidth; + unpacked.unHeight = this.unHeight; + unpacked.rubTextureMapData = this.rubTextureMapData; + unpacked.format = this.format; + } +} +[StructLayout(LayoutKind.Sequential)] public struct RenderModel_t +{ + public IntPtr rVertexData; // const struct vr::RenderModel_Vertex_t * + public uint unVertexCount; + public IntPtr rIndexData; // const uint16_t * + public uint unTriangleCount; + public int diffuseTextureId; +} +// This structure is for backwards binary compatibility on Linux and OSX only +[StructLayout(LayoutKind.Sequential, Pack = 4)] public struct RenderModel_t_Packed +{ + public IntPtr rVertexData; // const struct vr::RenderModel_Vertex_t * + public uint unVertexCount; + public IntPtr rIndexData; // const uint16_t * + public uint unTriangleCount; + public int diffuseTextureId; + public RenderModel_t_Packed(RenderModel_t unpacked) + { + this.rVertexData = unpacked.rVertexData; + this.unVertexCount = unpacked.unVertexCount; + this.rIndexData = unpacked.rIndexData; + this.unTriangleCount = unpacked.unTriangleCount; + this.diffuseTextureId = unpacked.diffuseTextureId; + } + public void Unpack(ref RenderModel_t unpacked) + { + unpacked.rVertexData = this.rVertexData; + unpacked.unVertexCount = this.unVertexCount; + unpacked.rIndexData = this.rIndexData; + unpacked.unTriangleCount = this.unTriangleCount; + unpacked.diffuseTextureId = this.diffuseTextureId; + } +} +[StructLayout(LayoutKind.Sequential)] public struct RenderModel_ControllerMode_State_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bScrollWheelVisible; +} +[StructLayout(LayoutKind.Sequential)] public struct NotificationBitmap_t +{ + public IntPtr m_pImageData; // void * + public int m_nWidth; + public int m_nHeight; + public int m_nBytesPerPixel; +} +[StructLayout(LayoutKind.Sequential)] public struct CVRSettingHelper +{ + public IntPtr m_pSettings; // class vr::IVRSettings * +} +[StructLayout(LayoutKind.Sequential)] public struct InputAnalogActionData_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bActive; + public ulong activeOrigin; + public float x; + public float y; + public float z; + public float deltaX; + public float deltaY; + public float deltaZ; + public float fUpdateTime; +} +[StructLayout(LayoutKind.Sequential)] public struct InputDigitalActionData_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bActive; + public ulong activeOrigin; + [MarshalAs(UnmanagedType.I1)] + public bool bState; + [MarshalAs(UnmanagedType.I1)] + public bool bChanged; + public float fUpdateTime; +} +[StructLayout(LayoutKind.Sequential)] public struct InputPoseActionData_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bActive; + public ulong activeOrigin; + public TrackedDevicePose_t pose; +} +[StructLayout(LayoutKind.Sequential)] public struct InputSkeletalActionData_t +{ + [MarshalAs(UnmanagedType.I1)] + public bool bActive; + public ulong activeOrigin; +} +[StructLayout(LayoutKind.Sequential)] public struct InputOriginInfo_t +{ + public ulong devicePath; + public uint trackedDeviceIndex; + public byte rchRenderModelComponentName0,rchRenderModelComponentName1,rchRenderModelComponentName2,rchRenderModelComponentName3,rchRenderModelComponentName4,rchRenderModelComponentName5,rchRenderModelComponentName6,rchRenderModelComponentName7,rchRenderModelComponentName8,rchRenderModelComponentName9,rchRenderModelComponentName10,rchRenderModelComponentName11,rchRenderModelComponentName12,rchRenderModelComponentName13,rchRenderModelComponentName14,rchRenderModelComponentName15,rchRenderModelComponentName16,rchRenderModelComponentName17,rchRenderModelComponentName18,rchRenderModelComponentName19,rchRenderModelComponentName20,rchRenderModelComponentName21,rchRenderModelComponentName22,rchRenderModelComponentName23,rchRenderModelComponentName24,rchRenderModelComponentName25,rchRenderModelComponentName26,rchRenderModelComponentName27,rchRenderModelComponentName28,rchRenderModelComponentName29,rchRenderModelComponentName30,rchRenderModelComponentName31,rchRenderModelComponentName32,rchRenderModelComponentName33,rchRenderModelComponentName34,rchRenderModelComponentName35,rchRenderModelComponentName36,rchRenderModelComponentName37,rchRenderModelComponentName38,rchRenderModelComponentName39,rchRenderModelComponentName40,rchRenderModelComponentName41,rchRenderModelComponentName42,rchRenderModelComponentName43,rchRenderModelComponentName44,rchRenderModelComponentName45,rchRenderModelComponentName46,rchRenderModelComponentName47,rchRenderModelComponentName48,rchRenderModelComponentName49,rchRenderModelComponentName50,rchRenderModelComponentName51,rchRenderModelComponentName52,rchRenderModelComponentName53,rchRenderModelComponentName54,rchRenderModelComponentName55,rchRenderModelComponentName56,rchRenderModelComponentName57,rchRenderModelComponentName58,rchRenderModelComponentName59,rchRenderModelComponentName60,rchRenderModelComponentName61,rchRenderModelComponentName62,rchRenderModelComponentName63,rchRenderModelComponentName64,rchRenderModelComponentName65,rchRenderModelComponentName66,rchRenderModelComponentName67,rchRenderModelComponentName68,rchRenderModelComponentName69,rchRenderModelComponentName70,rchRenderModelComponentName71,rchRenderModelComponentName72,rchRenderModelComponentName73,rchRenderModelComponentName74,rchRenderModelComponentName75,rchRenderModelComponentName76,rchRenderModelComponentName77,rchRenderModelComponentName78,rchRenderModelComponentName79,rchRenderModelComponentName80,rchRenderModelComponentName81,rchRenderModelComponentName82,rchRenderModelComponentName83,rchRenderModelComponentName84,rchRenderModelComponentName85,rchRenderModelComponentName86,rchRenderModelComponentName87,rchRenderModelComponentName88,rchRenderModelComponentName89,rchRenderModelComponentName90,rchRenderModelComponentName91,rchRenderModelComponentName92,rchRenderModelComponentName93,rchRenderModelComponentName94,rchRenderModelComponentName95,rchRenderModelComponentName96,rchRenderModelComponentName97,rchRenderModelComponentName98,rchRenderModelComponentName99,rchRenderModelComponentName100,rchRenderModelComponentName101,rchRenderModelComponentName102,rchRenderModelComponentName103,rchRenderModelComponentName104,rchRenderModelComponentName105,rchRenderModelComponentName106,rchRenderModelComponentName107,rchRenderModelComponentName108,rchRenderModelComponentName109,rchRenderModelComponentName110,rchRenderModelComponentName111,rchRenderModelComponentName112,rchRenderModelComponentName113,rchRenderModelComponentName114,rchRenderModelComponentName115,rchRenderModelComponentName116,rchRenderModelComponentName117,rchRenderModelComponentName118,rchRenderModelComponentName119,rchRenderModelComponentName120,rchRenderModelComponentName121,rchRenderModelComponentName122,rchRenderModelComponentName123,rchRenderModelComponentName124,rchRenderModelComponentName125,rchRenderModelComponentName126,rchRenderModelComponentName127; + public string rchRenderModelComponentName + { + get + { + return new string(new char[] { + (char)rchRenderModelComponentName0, + (char)rchRenderModelComponentName1, + (char)rchRenderModelComponentName2, + (char)rchRenderModelComponentName3, + (char)rchRenderModelComponentName4, + (char)rchRenderModelComponentName5, + (char)rchRenderModelComponentName6, + (char)rchRenderModelComponentName7, + (char)rchRenderModelComponentName8, + (char)rchRenderModelComponentName9, + (char)rchRenderModelComponentName10, + (char)rchRenderModelComponentName11, + (char)rchRenderModelComponentName12, + (char)rchRenderModelComponentName13, + (char)rchRenderModelComponentName14, + (char)rchRenderModelComponentName15, + (char)rchRenderModelComponentName16, + (char)rchRenderModelComponentName17, + (char)rchRenderModelComponentName18, + (char)rchRenderModelComponentName19, + (char)rchRenderModelComponentName20, + (char)rchRenderModelComponentName21, + (char)rchRenderModelComponentName22, + (char)rchRenderModelComponentName23, + (char)rchRenderModelComponentName24, + (char)rchRenderModelComponentName25, + (char)rchRenderModelComponentName26, + (char)rchRenderModelComponentName27, + (char)rchRenderModelComponentName28, + (char)rchRenderModelComponentName29, + (char)rchRenderModelComponentName30, + (char)rchRenderModelComponentName31, + (char)rchRenderModelComponentName32, + (char)rchRenderModelComponentName33, + (char)rchRenderModelComponentName34, + (char)rchRenderModelComponentName35, + (char)rchRenderModelComponentName36, + (char)rchRenderModelComponentName37, + (char)rchRenderModelComponentName38, + (char)rchRenderModelComponentName39, + (char)rchRenderModelComponentName40, + (char)rchRenderModelComponentName41, + (char)rchRenderModelComponentName42, + (char)rchRenderModelComponentName43, + (char)rchRenderModelComponentName44, + (char)rchRenderModelComponentName45, + (char)rchRenderModelComponentName46, + (char)rchRenderModelComponentName47, + (char)rchRenderModelComponentName48, + (char)rchRenderModelComponentName49, + (char)rchRenderModelComponentName50, + (char)rchRenderModelComponentName51, + (char)rchRenderModelComponentName52, + (char)rchRenderModelComponentName53, + (char)rchRenderModelComponentName54, + (char)rchRenderModelComponentName55, + (char)rchRenderModelComponentName56, + (char)rchRenderModelComponentName57, + (char)rchRenderModelComponentName58, + (char)rchRenderModelComponentName59, + (char)rchRenderModelComponentName60, + (char)rchRenderModelComponentName61, + (char)rchRenderModelComponentName62, + (char)rchRenderModelComponentName63, + (char)rchRenderModelComponentName64, + (char)rchRenderModelComponentName65, + (char)rchRenderModelComponentName66, + (char)rchRenderModelComponentName67, + (char)rchRenderModelComponentName68, + (char)rchRenderModelComponentName69, + (char)rchRenderModelComponentName70, + (char)rchRenderModelComponentName71, + (char)rchRenderModelComponentName72, + (char)rchRenderModelComponentName73, + (char)rchRenderModelComponentName74, + (char)rchRenderModelComponentName75, + (char)rchRenderModelComponentName76, + (char)rchRenderModelComponentName77, + (char)rchRenderModelComponentName78, + (char)rchRenderModelComponentName79, + (char)rchRenderModelComponentName80, + (char)rchRenderModelComponentName81, + (char)rchRenderModelComponentName82, + (char)rchRenderModelComponentName83, + (char)rchRenderModelComponentName84, + (char)rchRenderModelComponentName85, + (char)rchRenderModelComponentName86, + (char)rchRenderModelComponentName87, + (char)rchRenderModelComponentName88, + (char)rchRenderModelComponentName89, + (char)rchRenderModelComponentName90, + (char)rchRenderModelComponentName91, + (char)rchRenderModelComponentName92, + (char)rchRenderModelComponentName93, + (char)rchRenderModelComponentName94, + (char)rchRenderModelComponentName95, + (char)rchRenderModelComponentName96, + (char)rchRenderModelComponentName97, + (char)rchRenderModelComponentName98, + (char)rchRenderModelComponentName99, + (char)rchRenderModelComponentName100, + (char)rchRenderModelComponentName101, + (char)rchRenderModelComponentName102, + (char)rchRenderModelComponentName103, + (char)rchRenderModelComponentName104, + (char)rchRenderModelComponentName105, + (char)rchRenderModelComponentName106, + (char)rchRenderModelComponentName107, + (char)rchRenderModelComponentName108, + (char)rchRenderModelComponentName109, + (char)rchRenderModelComponentName110, + (char)rchRenderModelComponentName111, + (char)rchRenderModelComponentName112, + (char)rchRenderModelComponentName113, + (char)rchRenderModelComponentName114, + (char)rchRenderModelComponentName115, + (char)rchRenderModelComponentName116, + (char)rchRenderModelComponentName117, + (char)rchRenderModelComponentName118, + (char)rchRenderModelComponentName119, + (char)rchRenderModelComponentName120, + (char)rchRenderModelComponentName121, + (char)rchRenderModelComponentName122, + (char)rchRenderModelComponentName123, + (char)rchRenderModelComponentName124, + (char)rchRenderModelComponentName125, + (char)rchRenderModelComponentName126, + (char)rchRenderModelComponentName127 + }).TrimEnd('\0'); + } + } +} +[StructLayout(LayoutKind.Sequential)] public struct InputBindingInfo_t +{ + public byte rchDevicePathName0,rchDevicePathName1,rchDevicePathName2,rchDevicePathName3,rchDevicePathName4,rchDevicePathName5,rchDevicePathName6,rchDevicePathName7,rchDevicePathName8,rchDevicePathName9,rchDevicePathName10,rchDevicePathName11,rchDevicePathName12,rchDevicePathName13,rchDevicePathName14,rchDevicePathName15,rchDevicePathName16,rchDevicePathName17,rchDevicePathName18,rchDevicePathName19,rchDevicePathName20,rchDevicePathName21,rchDevicePathName22,rchDevicePathName23,rchDevicePathName24,rchDevicePathName25,rchDevicePathName26,rchDevicePathName27,rchDevicePathName28,rchDevicePathName29,rchDevicePathName30,rchDevicePathName31,rchDevicePathName32,rchDevicePathName33,rchDevicePathName34,rchDevicePathName35,rchDevicePathName36,rchDevicePathName37,rchDevicePathName38,rchDevicePathName39,rchDevicePathName40,rchDevicePathName41,rchDevicePathName42,rchDevicePathName43,rchDevicePathName44,rchDevicePathName45,rchDevicePathName46,rchDevicePathName47,rchDevicePathName48,rchDevicePathName49,rchDevicePathName50,rchDevicePathName51,rchDevicePathName52,rchDevicePathName53,rchDevicePathName54,rchDevicePathName55,rchDevicePathName56,rchDevicePathName57,rchDevicePathName58,rchDevicePathName59,rchDevicePathName60,rchDevicePathName61,rchDevicePathName62,rchDevicePathName63,rchDevicePathName64,rchDevicePathName65,rchDevicePathName66,rchDevicePathName67,rchDevicePathName68,rchDevicePathName69,rchDevicePathName70,rchDevicePathName71,rchDevicePathName72,rchDevicePathName73,rchDevicePathName74,rchDevicePathName75,rchDevicePathName76,rchDevicePathName77,rchDevicePathName78,rchDevicePathName79,rchDevicePathName80,rchDevicePathName81,rchDevicePathName82,rchDevicePathName83,rchDevicePathName84,rchDevicePathName85,rchDevicePathName86,rchDevicePathName87,rchDevicePathName88,rchDevicePathName89,rchDevicePathName90,rchDevicePathName91,rchDevicePathName92,rchDevicePathName93,rchDevicePathName94,rchDevicePathName95,rchDevicePathName96,rchDevicePathName97,rchDevicePathName98,rchDevicePathName99,rchDevicePathName100,rchDevicePathName101,rchDevicePathName102,rchDevicePathName103,rchDevicePathName104,rchDevicePathName105,rchDevicePathName106,rchDevicePathName107,rchDevicePathName108,rchDevicePathName109,rchDevicePathName110,rchDevicePathName111,rchDevicePathName112,rchDevicePathName113,rchDevicePathName114,rchDevicePathName115,rchDevicePathName116,rchDevicePathName117,rchDevicePathName118,rchDevicePathName119,rchDevicePathName120,rchDevicePathName121,rchDevicePathName122,rchDevicePathName123,rchDevicePathName124,rchDevicePathName125,rchDevicePathName126,rchDevicePathName127; + public string rchDevicePathName + { + get + { + return new string(new char[] { + (char)rchDevicePathName0, + (char)rchDevicePathName1, + (char)rchDevicePathName2, + (char)rchDevicePathName3, + (char)rchDevicePathName4, + (char)rchDevicePathName5, + (char)rchDevicePathName6, + (char)rchDevicePathName7, + (char)rchDevicePathName8, + (char)rchDevicePathName9, + (char)rchDevicePathName10, + (char)rchDevicePathName11, + (char)rchDevicePathName12, + (char)rchDevicePathName13, + (char)rchDevicePathName14, + (char)rchDevicePathName15, + (char)rchDevicePathName16, + (char)rchDevicePathName17, + (char)rchDevicePathName18, + (char)rchDevicePathName19, + (char)rchDevicePathName20, + (char)rchDevicePathName21, + (char)rchDevicePathName22, + (char)rchDevicePathName23, + (char)rchDevicePathName24, + (char)rchDevicePathName25, + (char)rchDevicePathName26, + (char)rchDevicePathName27, + (char)rchDevicePathName28, + (char)rchDevicePathName29, + (char)rchDevicePathName30, + (char)rchDevicePathName31, + (char)rchDevicePathName32, + (char)rchDevicePathName33, + (char)rchDevicePathName34, + (char)rchDevicePathName35, + (char)rchDevicePathName36, + (char)rchDevicePathName37, + (char)rchDevicePathName38, + (char)rchDevicePathName39, + (char)rchDevicePathName40, + (char)rchDevicePathName41, + (char)rchDevicePathName42, + (char)rchDevicePathName43, + (char)rchDevicePathName44, + (char)rchDevicePathName45, + (char)rchDevicePathName46, + (char)rchDevicePathName47, + (char)rchDevicePathName48, + (char)rchDevicePathName49, + (char)rchDevicePathName50, + (char)rchDevicePathName51, + (char)rchDevicePathName52, + (char)rchDevicePathName53, + (char)rchDevicePathName54, + (char)rchDevicePathName55, + (char)rchDevicePathName56, + (char)rchDevicePathName57, + (char)rchDevicePathName58, + (char)rchDevicePathName59, + (char)rchDevicePathName60, + (char)rchDevicePathName61, + (char)rchDevicePathName62, + (char)rchDevicePathName63, + (char)rchDevicePathName64, + (char)rchDevicePathName65, + (char)rchDevicePathName66, + (char)rchDevicePathName67, + (char)rchDevicePathName68, + (char)rchDevicePathName69, + (char)rchDevicePathName70, + (char)rchDevicePathName71, + (char)rchDevicePathName72, + (char)rchDevicePathName73, + (char)rchDevicePathName74, + (char)rchDevicePathName75, + (char)rchDevicePathName76, + (char)rchDevicePathName77, + (char)rchDevicePathName78, + (char)rchDevicePathName79, + (char)rchDevicePathName80, + (char)rchDevicePathName81, + (char)rchDevicePathName82, + (char)rchDevicePathName83, + (char)rchDevicePathName84, + (char)rchDevicePathName85, + (char)rchDevicePathName86, + (char)rchDevicePathName87, + (char)rchDevicePathName88, + (char)rchDevicePathName89, + (char)rchDevicePathName90, + (char)rchDevicePathName91, + (char)rchDevicePathName92, + (char)rchDevicePathName93, + (char)rchDevicePathName94, + (char)rchDevicePathName95, + (char)rchDevicePathName96, + (char)rchDevicePathName97, + (char)rchDevicePathName98, + (char)rchDevicePathName99, + (char)rchDevicePathName100, + (char)rchDevicePathName101, + (char)rchDevicePathName102, + (char)rchDevicePathName103, + (char)rchDevicePathName104, + (char)rchDevicePathName105, + (char)rchDevicePathName106, + (char)rchDevicePathName107, + (char)rchDevicePathName108, + (char)rchDevicePathName109, + (char)rchDevicePathName110, + (char)rchDevicePathName111, + (char)rchDevicePathName112, + (char)rchDevicePathName113, + (char)rchDevicePathName114, + (char)rchDevicePathName115, + (char)rchDevicePathName116, + (char)rchDevicePathName117, + (char)rchDevicePathName118, + (char)rchDevicePathName119, + (char)rchDevicePathName120, + (char)rchDevicePathName121, + (char)rchDevicePathName122, + (char)rchDevicePathName123, + (char)rchDevicePathName124, + (char)rchDevicePathName125, + (char)rchDevicePathName126, + (char)rchDevicePathName127 + }).TrimEnd('\0'); + } + } + public byte rchInputPathName0,rchInputPathName1,rchInputPathName2,rchInputPathName3,rchInputPathName4,rchInputPathName5,rchInputPathName6,rchInputPathName7,rchInputPathName8,rchInputPathName9,rchInputPathName10,rchInputPathName11,rchInputPathName12,rchInputPathName13,rchInputPathName14,rchInputPathName15,rchInputPathName16,rchInputPathName17,rchInputPathName18,rchInputPathName19,rchInputPathName20,rchInputPathName21,rchInputPathName22,rchInputPathName23,rchInputPathName24,rchInputPathName25,rchInputPathName26,rchInputPathName27,rchInputPathName28,rchInputPathName29,rchInputPathName30,rchInputPathName31,rchInputPathName32,rchInputPathName33,rchInputPathName34,rchInputPathName35,rchInputPathName36,rchInputPathName37,rchInputPathName38,rchInputPathName39,rchInputPathName40,rchInputPathName41,rchInputPathName42,rchInputPathName43,rchInputPathName44,rchInputPathName45,rchInputPathName46,rchInputPathName47,rchInputPathName48,rchInputPathName49,rchInputPathName50,rchInputPathName51,rchInputPathName52,rchInputPathName53,rchInputPathName54,rchInputPathName55,rchInputPathName56,rchInputPathName57,rchInputPathName58,rchInputPathName59,rchInputPathName60,rchInputPathName61,rchInputPathName62,rchInputPathName63,rchInputPathName64,rchInputPathName65,rchInputPathName66,rchInputPathName67,rchInputPathName68,rchInputPathName69,rchInputPathName70,rchInputPathName71,rchInputPathName72,rchInputPathName73,rchInputPathName74,rchInputPathName75,rchInputPathName76,rchInputPathName77,rchInputPathName78,rchInputPathName79,rchInputPathName80,rchInputPathName81,rchInputPathName82,rchInputPathName83,rchInputPathName84,rchInputPathName85,rchInputPathName86,rchInputPathName87,rchInputPathName88,rchInputPathName89,rchInputPathName90,rchInputPathName91,rchInputPathName92,rchInputPathName93,rchInputPathName94,rchInputPathName95,rchInputPathName96,rchInputPathName97,rchInputPathName98,rchInputPathName99,rchInputPathName100,rchInputPathName101,rchInputPathName102,rchInputPathName103,rchInputPathName104,rchInputPathName105,rchInputPathName106,rchInputPathName107,rchInputPathName108,rchInputPathName109,rchInputPathName110,rchInputPathName111,rchInputPathName112,rchInputPathName113,rchInputPathName114,rchInputPathName115,rchInputPathName116,rchInputPathName117,rchInputPathName118,rchInputPathName119,rchInputPathName120,rchInputPathName121,rchInputPathName122,rchInputPathName123,rchInputPathName124,rchInputPathName125,rchInputPathName126,rchInputPathName127; + public string rchInputPathName + { + get + { + return new string(new char[] { + (char)rchInputPathName0, + (char)rchInputPathName1, + (char)rchInputPathName2, + (char)rchInputPathName3, + (char)rchInputPathName4, + (char)rchInputPathName5, + (char)rchInputPathName6, + (char)rchInputPathName7, + (char)rchInputPathName8, + (char)rchInputPathName9, + (char)rchInputPathName10, + (char)rchInputPathName11, + (char)rchInputPathName12, + (char)rchInputPathName13, + (char)rchInputPathName14, + (char)rchInputPathName15, + (char)rchInputPathName16, + (char)rchInputPathName17, + (char)rchInputPathName18, + (char)rchInputPathName19, + (char)rchInputPathName20, + (char)rchInputPathName21, + (char)rchInputPathName22, + (char)rchInputPathName23, + (char)rchInputPathName24, + (char)rchInputPathName25, + (char)rchInputPathName26, + (char)rchInputPathName27, + (char)rchInputPathName28, + (char)rchInputPathName29, + (char)rchInputPathName30, + (char)rchInputPathName31, + (char)rchInputPathName32, + (char)rchInputPathName33, + (char)rchInputPathName34, + (char)rchInputPathName35, + (char)rchInputPathName36, + (char)rchInputPathName37, + (char)rchInputPathName38, + (char)rchInputPathName39, + (char)rchInputPathName40, + (char)rchInputPathName41, + (char)rchInputPathName42, + (char)rchInputPathName43, + (char)rchInputPathName44, + (char)rchInputPathName45, + (char)rchInputPathName46, + (char)rchInputPathName47, + (char)rchInputPathName48, + (char)rchInputPathName49, + (char)rchInputPathName50, + (char)rchInputPathName51, + (char)rchInputPathName52, + (char)rchInputPathName53, + (char)rchInputPathName54, + (char)rchInputPathName55, + (char)rchInputPathName56, + (char)rchInputPathName57, + (char)rchInputPathName58, + (char)rchInputPathName59, + (char)rchInputPathName60, + (char)rchInputPathName61, + (char)rchInputPathName62, + (char)rchInputPathName63, + (char)rchInputPathName64, + (char)rchInputPathName65, + (char)rchInputPathName66, + (char)rchInputPathName67, + (char)rchInputPathName68, + (char)rchInputPathName69, + (char)rchInputPathName70, + (char)rchInputPathName71, + (char)rchInputPathName72, + (char)rchInputPathName73, + (char)rchInputPathName74, + (char)rchInputPathName75, + (char)rchInputPathName76, + (char)rchInputPathName77, + (char)rchInputPathName78, + (char)rchInputPathName79, + (char)rchInputPathName80, + (char)rchInputPathName81, + (char)rchInputPathName82, + (char)rchInputPathName83, + (char)rchInputPathName84, + (char)rchInputPathName85, + (char)rchInputPathName86, + (char)rchInputPathName87, + (char)rchInputPathName88, + (char)rchInputPathName89, + (char)rchInputPathName90, + (char)rchInputPathName91, + (char)rchInputPathName92, + (char)rchInputPathName93, + (char)rchInputPathName94, + (char)rchInputPathName95, + (char)rchInputPathName96, + (char)rchInputPathName97, + (char)rchInputPathName98, + (char)rchInputPathName99, + (char)rchInputPathName100, + (char)rchInputPathName101, + (char)rchInputPathName102, + (char)rchInputPathName103, + (char)rchInputPathName104, + (char)rchInputPathName105, + (char)rchInputPathName106, + (char)rchInputPathName107, + (char)rchInputPathName108, + (char)rchInputPathName109, + (char)rchInputPathName110, + (char)rchInputPathName111, + (char)rchInputPathName112, + (char)rchInputPathName113, + (char)rchInputPathName114, + (char)rchInputPathName115, + (char)rchInputPathName116, + (char)rchInputPathName117, + (char)rchInputPathName118, + (char)rchInputPathName119, + (char)rchInputPathName120, + (char)rchInputPathName121, + (char)rchInputPathName122, + (char)rchInputPathName123, + (char)rchInputPathName124, + (char)rchInputPathName125, + (char)rchInputPathName126, + (char)rchInputPathName127 + }).TrimEnd('\0'); + } + } + public byte rchModeName0,rchModeName1,rchModeName2,rchModeName3,rchModeName4,rchModeName5,rchModeName6,rchModeName7,rchModeName8,rchModeName9,rchModeName10,rchModeName11,rchModeName12,rchModeName13,rchModeName14,rchModeName15,rchModeName16,rchModeName17,rchModeName18,rchModeName19,rchModeName20,rchModeName21,rchModeName22,rchModeName23,rchModeName24,rchModeName25,rchModeName26,rchModeName27,rchModeName28,rchModeName29,rchModeName30,rchModeName31,rchModeName32,rchModeName33,rchModeName34,rchModeName35,rchModeName36,rchModeName37,rchModeName38,rchModeName39,rchModeName40,rchModeName41,rchModeName42,rchModeName43,rchModeName44,rchModeName45,rchModeName46,rchModeName47,rchModeName48,rchModeName49,rchModeName50,rchModeName51,rchModeName52,rchModeName53,rchModeName54,rchModeName55,rchModeName56,rchModeName57,rchModeName58,rchModeName59,rchModeName60,rchModeName61,rchModeName62,rchModeName63,rchModeName64,rchModeName65,rchModeName66,rchModeName67,rchModeName68,rchModeName69,rchModeName70,rchModeName71,rchModeName72,rchModeName73,rchModeName74,rchModeName75,rchModeName76,rchModeName77,rchModeName78,rchModeName79,rchModeName80,rchModeName81,rchModeName82,rchModeName83,rchModeName84,rchModeName85,rchModeName86,rchModeName87,rchModeName88,rchModeName89,rchModeName90,rchModeName91,rchModeName92,rchModeName93,rchModeName94,rchModeName95,rchModeName96,rchModeName97,rchModeName98,rchModeName99,rchModeName100,rchModeName101,rchModeName102,rchModeName103,rchModeName104,rchModeName105,rchModeName106,rchModeName107,rchModeName108,rchModeName109,rchModeName110,rchModeName111,rchModeName112,rchModeName113,rchModeName114,rchModeName115,rchModeName116,rchModeName117,rchModeName118,rchModeName119,rchModeName120,rchModeName121,rchModeName122,rchModeName123,rchModeName124,rchModeName125,rchModeName126,rchModeName127; + public string rchModeName + { + get + { + return new string(new char[] { + (char)rchModeName0, + (char)rchModeName1, + (char)rchModeName2, + (char)rchModeName3, + (char)rchModeName4, + (char)rchModeName5, + (char)rchModeName6, + (char)rchModeName7, + (char)rchModeName8, + (char)rchModeName9, + (char)rchModeName10, + (char)rchModeName11, + (char)rchModeName12, + (char)rchModeName13, + (char)rchModeName14, + (char)rchModeName15, + (char)rchModeName16, + (char)rchModeName17, + (char)rchModeName18, + (char)rchModeName19, + (char)rchModeName20, + (char)rchModeName21, + (char)rchModeName22, + (char)rchModeName23, + (char)rchModeName24, + (char)rchModeName25, + (char)rchModeName26, + (char)rchModeName27, + (char)rchModeName28, + (char)rchModeName29, + (char)rchModeName30, + (char)rchModeName31, + (char)rchModeName32, + (char)rchModeName33, + (char)rchModeName34, + (char)rchModeName35, + (char)rchModeName36, + (char)rchModeName37, + (char)rchModeName38, + (char)rchModeName39, + (char)rchModeName40, + (char)rchModeName41, + (char)rchModeName42, + (char)rchModeName43, + (char)rchModeName44, + (char)rchModeName45, + (char)rchModeName46, + (char)rchModeName47, + (char)rchModeName48, + (char)rchModeName49, + (char)rchModeName50, + (char)rchModeName51, + (char)rchModeName52, + (char)rchModeName53, + (char)rchModeName54, + (char)rchModeName55, + (char)rchModeName56, + (char)rchModeName57, + (char)rchModeName58, + (char)rchModeName59, + (char)rchModeName60, + (char)rchModeName61, + (char)rchModeName62, + (char)rchModeName63, + (char)rchModeName64, + (char)rchModeName65, + (char)rchModeName66, + (char)rchModeName67, + (char)rchModeName68, + (char)rchModeName69, + (char)rchModeName70, + (char)rchModeName71, + (char)rchModeName72, + (char)rchModeName73, + (char)rchModeName74, + (char)rchModeName75, + (char)rchModeName76, + (char)rchModeName77, + (char)rchModeName78, + (char)rchModeName79, + (char)rchModeName80, + (char)rchModeName81, + (char)rchModeName82, + (char)rchModeName83, + (char)rchModeName84, + (char)rchModeName85, + (char)rchModeName86, + (char)rchModeName87, + (char)rchModeName88, + (char)rchModeName89, + (char)rchModeName90, + (char)rchModeName91, + (char)rchModeName92, + (char)rchModeName93, + (char)rchModeName94, + (char)rchModeName95, + (char)rchModeName96, + (char)rchModeName97, + (char)rchModeName98, + (char)rchModeName99, + (char)rchModeName100, + (char)rchModeName101, + (char)rchModeName102, + (char)rchModeName103, + (char)rchModeName104, + (char)rchModeName105, + (char)rchModeName106, + (char)rchModeName107, + (char)rchModeName108, + (char)rchModeName109, + (char)rchModeName110, + (char)rchModeName111, + (char)rchModeName112, + (char)rchModeName113, + (char)rchModeName114, + (char)rchModeName115, + (char)rchModeName116, + (char)rchModeName117, + (char)rchModeName118, + (char)rchModeName119, + (char)rchModeName120, + (char)rchModeName121, + (char)rchModeName122, + (char)rchModeName123, + (char)rchModeName124, + (char)rchModeName125, + (char)rchModeName126, + (char)rchModeName127 + }).TrimEnd('\0'); + } + } + public byte rchSlotName0,rchSlotName1,rchSlotName2,rchSlotName3,rchSlotName4,rchSlotName5,rchSlotName6,rchSlotName7,rchSlotName8,rchSlotName9,rchSlotName10,rchSlotName11,rchSlotName12,rchSlotName13,rchSlotName14,rchSlotName15,rchSlotName16,rchSlotName17,rchSlotName18,rchSlotName19,rchSlotName20,rchSlotName21,rchSlotName22,rchSlotName23,rchSlotName24,rchSlotName25,rchSlotName26,rchSlotName27,rchSlotName28,rchSlotName29,rchSlotName30,rchSlotName31,rchSlotName32,rchSlotName33,rchSlotName34,rchSlotName35,rchSlotName36,rchSlotName37,rchSlotName38,rchSlotName39,rchSlotName40,rchSlotName41,rchSlotName42,rchSlotName43,rchSlotName44,rchSlotName45,rchSlotName46,rchSlotName47,rchSlotName48,rchSlotName49,rchSlotName50,rchSlotName51,rchSlotName52,rchSlotName53,rchSlotName54,rchSlotName55,rchSlotName56,rchSlotName57,rchSlotName58,rchSlotName59,rchSlotName60,rchSlotName61,rchSlotName62,rchSlotName63,rchSlotName64,rchSlotName65,rchSlotName66,rchSlotName67,rchSlotName68,rchSlotName69,rchSlotName70,rchSlotName71,rchSlotName72,rchSlotName73,rchSlotName74,rchSlotName75,rchSlotName76,rchSlotName77,rchSlotName78,rchSlotName79,rchSlotName80,rchSlotName81,rchSlotName82,rchSlotName83,rchSlotName84,rchSlotName85,rchSlotName86,rchSlotName87,rchSlotName88,rchSlotName89,rchSlotName90,rchSlotName91,rchSlotName92,rchSlotName93,rchSlotName94,rchSlotName95,rchSlotName96,rchSlotName97,rchSlotName98,rchSlotName99,rchSlotName100,rchSlotName101,rchSlotName102,rchSlotName103,rchSlotName104,rchSlotName105,rchSlotName106,rchSlotName107,rchSlotName108,rchSlotName109,rchSlotName110,rchSlotName111,rchSlotName112,rchSlotName113,rchSlotName114,rchSlotName115,rchSlotName116,rchSlotName117,rchSlotName118,rchSlotName119,rchSlotName120,rchSlotName121,rchSlotName122,rchSlotName123,rchSlotName124,rchSlotName125,rchSlotName126,rchSlotName127; + public string rchSlotName + { + get + { + return new string(new char[] { + (char)rchSlotName0, + (char)rchSlotName1, + (char)rchSlotName2, + (char)rchSlotName3, + (char)rchSlotName4, + (char)rchSlotName5, + (char)rchSlotName6, + (char)rchSlotName7, + (char)rchSlotName8, + (char)rchSlotName9, + (char)rchSlotName10, + (char)rchSlotName11, + (char)rchSlotName12, + (char)rchSlotName13, + (char)rchSlotName14, + (char)rchSlotName15, + (char)rchSlotName16, + (char)rchSlotName17, + (char)rchSlotName18, + (char)rchSlotName19, + (char)rchSlotName20, + (char)rchSlotName21, + (char)rchSlotName22, + (char)rchSlotName23, + (char)rchSlotName24, + (char)rchSlotName25, + (char)rchSlotName26, + (char)rchSlotName27, + (char)rchSlotName28, + (char)rchSlotName29, + (char)rchSlotName30, + (char)rchSlotName31, + (char)rchSlotName32, + (char)rchSlotName33, + (char)rchSlotName34, + (char)rchSlotName35, + (char)rchSlotName36, + (char)rchSlotName37, + (char)rchSlotName38, + (char)rchSlotName39, + (char)rchSlotName40, + (char)rchSlotName41, + (char)rchSlotName42, + (char)rchSlotName43, + (char)rchSlotName44, + (char)rchSlotName45, + (char)rchSlotName46, + (char)rchSlotName47, + (char)rchSlotName48, + (char)rchSlotName49, + (char)rchSlotName50, + (char)rchSlotName51, + (char)rchSlotName52, + (char)rchSlotName53, + (char)rchSlotName54, + (char)rchSlotName55, + (char)rchSlotName56, + (char)rchSlotName57, + (char)rchSlotName58, + (char)rchSlotName59, + (char)rchSlotName60, + (char)rchSlotName61, + (char)rchSlotName62, + (char)rchSlotName63, + (char)rchSlotName64, + (char)rchSlotName65, + (char)rchSlotName66, + (char)rchSlotName67, + (char)rchSlotName68, + (char)rchSlotName69, + (char)rchSlotName70, + (char)rchSlotName71, + (char)rchSlotName72, + (char)rchSlotName73, + (char)rchSlotName74, + (char)rchSlotName75, + (char)rchSlotName76, + (char)rchSlotName77, + (char)rchSlotName78, + (char)rchSlotName79, + (char)rchSlotName80, + (char)rchSlotName81, + (char)rchSlotName82, + (char)rchSlotName83, + (char)rchSlotName84, + (char)rchSlotName85, + (char)rchSlotName86, + (char)rchSlotName87, + (char)rchSlotName88, + (char)rchSlotName89, + (char)rchSlotName90, + (char)rchSlotName91, + (char)rchSlotName92, + (char)rchSlotName93, + (char)rchSlotName94, + (char)rchSlotName95, + (char)rchSlotName96, + (char)rchSlotName97, + (char)rchSlotName98, + (char)rchSlotName99, + (char)rchSlotName100, + (char)rchSlotName101, + (char)rchSlotName102, + (char)rchSlotName103, + (char)rchSlotName104, + (char)rchSlotName105, + (char)rchSlotName106, + (char)rchSlotName107, + (char)rchSlotName108, + (char)rchSlotName109, + (char)rchSlotName110, + (char)rchSlotName111, + (char)rchSlotName112, + (char)rchSlotName113, + (char)rchSlotName114, + (char)rchSlotName115, + (char)rchSlotName116, + (char)rchSlotName117, + (char)rchSlotName118, + (char)rchSlotName119, + (char)rchSlotName120, + (char)rchSlotName121, + (char)rchSlotName122, + (char)rchSlotName123, + (char)rchSlotName124, + (char)rchSlotName125, + (char)rchSlotName126, + (char)rchSlotName127 + }).TrimEnd('\0'); + } + } + public byte rchInputSourceType0,rchInputSourceType1,rchInputSourceType2,rchInputSourceType3,rchInputSourceType4,rchInputSourceType5,rchInputSourceType6,rchInputSourceType7,rchInputSourceType8,rchInputSourceType9,rchInputSourceType10,rchInputSourceType11,rchInputSourceType12,rchInputSourceType13,rchInputSourceType14,rchInputSourceType15,rchInputSourceType16,rchInputSourceType17,rchInputSourceType18,rchInputSourceType19,rchInputSourceType20,rchInputSourceType21,rchInputSourceType22,rchInputSourceType23,rchInputSourceType24,rchInputSourceType25,rchInputSourceType26,rchInputSourceType27,rchInputSourceType28,rchInputSourceType29,rchInputSourceType30,rchInputSourceType31; + public string rchInputSourceType + { + get + { + return new string(new char[] { + (char)rchInputSourceType0, + (char)rchInputSourceType1, + (char)rchInputSourceType2, + (char)rchInputSourceType3, + (char)rchInputSourceType4, + (char)rchInputSourceType5, + (char)rchInputSourceType6, + (char)rchInputSourceType7, + (char)rchInputSourceType8, + (char)rchInputSourceType9, + (char)rchInputSourceType10, + (char)rchInputSourceType11, + (char)rchInputSourceType12, + (char)rchInputSourceType13, + (char)rchInputSourceType14, + (char)rchInputSourceType15, + (char)rchInputSourceType16, + (char)rchInputSourceType17, + (char)rchInputSourceType18, + (char)rchInputSourceType19, + (char)rchInputSourceType20, + (char)rchInputSourceType21, + (char)rchInputSourceType22, + (char)rchInputSourceType23, + (char)rchInputSourceType24, + (char)rchInputSourceType25, + (char)rchInputSourceType26, + (char)rchInputSourceType27, + (char)rchInputSourceType28, + (char)rchInputSourceType29, + (char)rchInputSourceType30, + (char)rchInputSourceType31 + }).TrimEnd('\0'); + } + } +} +[StructLayout(LayoutKind.Sequential)] public struct VRActiveActionSet_t +{ + public ulong ulActionSet; + public ulong ulRestrictedToDevice; + public ulong ulSecondaryActionSet; + public uint unPadding; + public int nPriority; +} +[StructLayout(LayoutKind.Sequential)] public struct VRSkeletalSummaryData_t +{ + public float flFingerCurl0; //float[5] + public float flFingerCurl1; + public float flFingerCurl2; + public float flFingerCurl3; + public float flFingerCurl4; + public float flFingerSplay0; //float[4] + public float flFingerSplay1; + public float flFingerSplay2; + public float flFingerSplay3; +} +[StructLayout(LayoutKind.Sequential)] public struct SpatialAnchorPose_t +{ + public HmdMatrix34_t mAnchorToAbsoluteTracking; +} +[StructLayout(LayoutKind.Sequential)] public struct COpenVRContext +{ + public IntPtr m_pVRSystem; // class vr::IVRSystem * + public IntPtr m_pVRChaperone; // class vr::IVRChaperone * + public IntPtr m_pVRChaperoneSetup; // class vr::IVRChaperoneSetup * + public IntPtr m_pVRCompositor; // class vr::IVRCompositor * + public IntPtr m_pVRHeadsetView; // class vr::IVRHeadsetView * + public IntPtr m_pVROverlay; // class vr::IVROverlay * + public IntPtr m_pVROverlayView; // class vr::IVROverlayView * + public IntPtr m_pVRResources; // class vr::IVRResources * + public IntPtr m_pVRRenderModels; // class vr::IVRRenderModels * + public IntPtr m_pVRExtendedDisplay; // class vr::IVRExtendedDisplay * + public IntPtr m_pVRSettings; // class vr::IVRSettings * + public IntPtr m_pVRApplications; // class vr::IVRApplications * + public IntPtr m_pVRTrackedCamera; // class vr::IVRTrackedCamera * + public IntPtr m_pVRScreenshots; // class vr::IVRScreenshots * + public IntPtr m_pVRDriverManager; // class vr::IVRDriverManager * + public IntPtr m_pVRInput; // class vr::IVRInput * + public IntPtr m_pVRIOBuffer; // class vr::IVRIOBuffer * + public IntPtr m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors * + public IntPtr m_pVRDebug; // class vr::IVRDebug * + public IntPtr m_pVRNotifications; // class vr::IVRNotifications * +} +[StructLayout(LayoutKind.Sequential)] public struct PropertyWrite_t +{ + public ETrackedDeviceProperty prop; + public EPropertyWriteType writeType; + public ETrackedPropertyError eSetError; + public IntPtr pvBuffer; // void * + public uint unBufferSize; + public uint unTag; + public ETrackedPropertyError eError; +} +[StructLayout(LayoutKind.Sequential)] public struct PropertyRead_t +{ + public ETrackedDeviceProperty prop; + public IntPtr pvBuffer; // void * + public uint unBufferSize; + public uint unTag; + public uint unRequiredBufferSize; + public ETrackedPropertyError eError; +} +[StructLayout(LayoutKind.Sequential)] public struct CVRPropertyHelpers +{ + public IntPtr m_pProperties; // class vr::IVRProperties * +} +[StructLayout(LayoutKind.Sequential)] public struct PathWrite_t +{ + public ulong ulPath; + public EPropertyWriteType writeType; + public ETrackedPropertyError eSetError; + public IntPtr pvBuffer; // void * + public uint unBufferSize; + public uint unTag; + public ETrackedPropertyError eError; + public IntPtr pszPath; // const char * +} +[StructLayout(LayoutKind.Sequential)] public struct PathRead_t +{ + public ulong ulPath; + public IntPtr pvBuffer; // void * + public uint unBufferSize; + public uint unTag; + public uint unRequiredBufferSize; + public ETrackedPropertyError eError; + public IntPtr pszPath; // const char * +} + +public class OpenVR +{ + + public static uint InitInternal(ref EVRInitError peError, EVRApplicationType eApplicationType) + { + return OpenVRInterop.InitInternal(ref peError, eApplicationType); + } + + public static uint InitInternal2(ref EVRInitError peError, EVRApplicationType eApplicationType, string pchStartupInfo) + { + return OpenVRInterop.InitInternal2(ref peError, eApplicationType, pchStartupInfo); + } + + public static void ShutdownInternal() + { + OpenVRInterop.ShutdownInternal(); + } + + public static bool IsHmdPresent() + { + return OpenVRInterop.IsHmdPresent(); + } + + public static bool IsRuntimeInstalled() + { + return OpenVRInterop.IsRuntimeInstalled(); + } + + public static string RuntimePath() + { + try + { + uint pathSize = 512; + uint requiredPathSize = 512; + System.Text.StringBuilder path = new System.Text.StringBuilder((int)pathSize); + bool success = OpenVRInterop.GetRuntimePath(path, pathSize, ref requiredPathSize); + if (success == false) + { + return null; + } + + return path.ToString(); + } catch + { + return OpenVRInterop.RuntimePath(); //this api is deprecated but here to support older unity versions + } + } + + public static string GetStringForHmdError(EVRInitError error) + { + return Marshal.PtrToStringAnsi(OpenVRInterop.GetStringForHmdError(error)); + } + + public static IntPtr GetGenericInterface(string pchInterfaceVersion, ref EVRInitError peError) + { + return OpenVRInterop.GetGenericInterface(pchInterfaceVersion, ref peError); + } + + public static bool IsInterfaceVersionValid(string pchInterfaceVersion) + { + return OpenVRInterop.IsInterfaceVersionValid(pchInterfaceVersion); + } + + public static uint GetInitToken() + { + return OpenVRInterop.GetInitToken(); + } + + public const uint k_nDriverNone = 4294967295; + public const uint k_unMaxDriverDebugResponseSize = 32768; + public const uint k_unTrackedDeviceIndex_Hmd = 0; + public const uint k_unMaxTrackedDeviceCount = 64; + public const uint k_unTrackedDeviceIndexOther = 4294967294; + public const uint k_unTrackedDeviceIndexInvalid = 4294967295; + public const ulong k_ulInvalidPropertyContainer = 0; + public const uint k_unInvalidPropertyTag = 0; + public const ulong k_ulInvalidDriverHandle = 0; + public const uint k_unFloatPropertyTag = 1; + public const uint k_unInt32PropertyTag = 2; + public const uint k_unUint64PropertyTag = 3; + public const uint k_unBoolPropertyTag = 4; + public const uint k_unStringPropertyTag = 5; + public const uint k_unErrorPropertyTag = 6; + public const uint k_unDoublePropertyTag = 7; + public const uint k_unHmdMatrix34PropertyTag = 20; + public const uint k_unHmdMatrix44PropertyTag = 21; + public const uint k_unHmdVector3PropertyTag = 22; + public const uint k_unHmdVector4PropertyTag = 23; + public const uint k_unHmdVector2PropertyTag = 24; + public const uint k_unHmdQuadPropertyTag = 25; + public const uint k_unHiddenAreaPropertyTag = 30; + public const uint k_unPathHandleInfoTag = 31; + public const uint k_unActionPropertyTag = 32; + public const uint k_unInputValuePropertyTag = 33; + public const uint k_unWildcardPropertyTag = 34; + public const uint k_unHapticVibrationPropertyTag = 35; + public const uint k_unSkeletonPropertyTag = 36; + public const uint k_unSpatialAnchorPosePropertyTag = 40; + public const uint k_unJsonPropertyTag = 41; + public const uint k_unActiveActionSetPropertyTag = 42; + public const uint k_unOpenVRInternalReserved_Start = 1000; + public const uint k_unOpenVRInternalReserved_End = 10000; + public const uint k_unMaxPropertyStringSize = 32768; + public const ulong k_ulInvalidActionHandle = 0; + public const ulong k_ulInvalidActionSetHandle = 0; + public const ulong k_ulInvalidInputValueHandle = 0; + public const uint k_unControllerStateAxisCount = 5; + public const ulong k_ulOverlayHandleInvalid = 0; + public const uint k_unMaxDistortionFunctionParameters = 8; + public const uint k_unScreenshotHandleInvalid = 0; + public const string IVRSystem_Version = "IVRSystem_022"; + public const string IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; + public const string IVRTrackedCamera_Version = "IVRTrackedCamera_006"; + public const uint k_unMaxApplicationKeyLength = 128; + public const string k_pch_MimeType_HomeApp = "vr/home"; + public const string k_pch_MimeType_GameTheater = "vr/game_theater"; + public const string IVRApplications_Version = "IVRApplications_007"; + public const string IVRChaperone_Version = "IVRChaperone_004"; + public const string IVRChaperoneSetup_Version = "IVRChaperoneSetup_006"; + public const string IVRCompositor_Version = "IVRCompositor_027"; + public const uint k_unVROverlayMaxKeyLength = 128; + public const uint k_unVROverlayMaxNameLength = 128; + public const uint k_unMaxOverlayCount = 128; + public const uint k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; + public const string IVROverlay_Version = "IVROverlay_025"; + public const string IVROverlayView_Version = "IVROverlayView_003"; + public const uint k_unHeadsetViewMaxWidth = 3840; + public const uint k_unHeadsetViewMaxHeight = 2160; + public const string k_pchHeadsetViewOverlayKey = "system.HeadsetView"; + public const string IVRHeadsetView_Version = "IVRHeadsetView_001"; + public const string k_pch_Controller_Component_GDC2015 = "gdc2015"; + public const string k_pch_Controller_Component_Base = "base"; + public const string k_pch_Controller_Component_Tip = "tip"; + public const string k_pch_Controller_Component_HandGrip = "handgrip"; + public const string k_pch_Controller_Component_Status = "status"; + public const string IVRRenderModels_Version = "IVRRenderModels_006"; + public const uint k_unNotificationTextMaxSize = 256; + public const string IVRNotifications_Version = "IVRNotifications_002"; + public const uint k_unMaxSettingsKeyLength = 128; + public const string IVRSettings_Version = "IVRSettings_003"; + public const string k_pch_SteamVR_Section = "steamvr"; + public const string k_pch_SteamVR_RequireHmd_String = "requireHmd"; + public const string k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; + public const string k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; + public const string k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; + public const string k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; + public const string k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; + public const string k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; + public const string k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps"; + public const string k_pch_SteamVR_LogLevel_Int32 = "loglevel"; + public const string k_pch_SteamVR_IPD_Float = "ipd"; + public const string k_pch_SteamVR_Background_String = "background"; + public const string k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; + public const string k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; + public const string k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; + public const string k_pch_SteamVR_GridColor_String = "gridColor"; + public const string k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; + public const string k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor"; + public const string k_pch_SteamVR_ShowStage_Bool = "showStage"; + public const string k_pch_SteamVR_DrawTrackingReferences_Bool = "drawTrackingReferences"; + public const string k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; + public const string k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; + public const string k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; + public const string k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement"; + public const string k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip"; + public const string k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; + public const string k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; + public const string k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution"; + public const string k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing"; + public const string k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride"; + public const string k_pch_SteamVR_FramesToThrottle_Int32 = "framesToThrottle"; + public const string k_pch_SteamVR_AdditionalFramesToPredict_Int32 = "additionalFramesToPredict"; + public const string k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync"; + public const string k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; + public const string k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView"; + public const string k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView"; + public const string k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView"; + public const string k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode"; + public const string k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye"; + public const string k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; + public const string k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized"; + public const string k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph"; + public const string k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + public const string k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + public const string k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + public const string k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; + public const string k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; + public const string k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; + public const string k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; + public const string k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; + public const string k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; + public const string k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; + public const string k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; + public const string k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; + public const string k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; + public const string k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; + public const string k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + public const string k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid"; + public const string k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; + public const string k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling"; + public const string k_pch_SteamVR_EnableSafeMode = "enableSafeMode"; + public const string k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate"; + public const string k_pch_SteamVR_LastVersionNotice = "lastVersionNotice"; + public const string k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate"; + public const string k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR"; + public const string k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG"; + public const string k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB"; + public const string k_pch_SteamVR_CustomIconStyle_String = "customIconStyle"; + public const string k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle"; + public const string k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate"; + public const string k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority"; + public const string k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2"; + public const string k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption"; + public const string k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches"; + public const string k_pch_SteamVR_HDCPLegacyCompatibility_Bool = "hdcp14legacyCompatibility"; + public const string k_pch_SteamVR_UsePrism_Bool = "usePrism"; + public const string k_pch_DirectMode_Section = "direct_mode"; + public const string k_pch_DirectMode_Enable_Bool = "enable"; + public const string k_pch_DirectMode_Count_Int32 = "count"; + public const string k_pch_DirectMode_EdidVid_Int32 = "edidVid"; + public const string k_pch_DirectMode_EdidPid_Int32 = "edidPid"; + public const string k_pch_Lighthouse_Section = "driver_lighthouse"; + public const string k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; + public const string k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; + public const string k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; + public const string k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; + public const string k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; + public const string k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; + public const string k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; + public const string k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; + public const string k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2"; + public const string k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations"; + public const string k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback"; + public const string k_pch_Null_Section = "driver_null"; + public const string k_pch_Null_SerialNumber_String = "serialNumber"; + public const string k_pch_Null_ModelNumber_String = "modelNumber"; + public const string k_pch_Null_WindowX_Int32 = "windowX"; + public const string k_pch_Null_WindowY_Int32 = "windowY"; + public const string k_pch_Null_WindowWidth_Int32 = "windowWidth"; + public const string k_pch_Null_WindowHeight_Int32 = "windowHeight"; + public const string k_pch_Null_RenderWidth_Int32 = "renderWidth"; + public const string k_pch_Null_RenderHeight_Int32 = "renderHeight"; + public const string k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; + public const string k_pch_Null_DisplayFrequency_Float = "displayFrequency"; + public const string k_pch_WindowsMR_Section = "driver_holographic"; + public const string k_pch_UserInterface_Section = "userinterface"; + public const string k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; + public const string k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; + public const string k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized"; + public const string k_pch_UserInterface_Screenshots_Bool = "screenshots"; + public const string k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; + public const string k_pch_Notifications_Section = "notifications"; + public const string k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; + public const string k_pch_Keyboard_Section = "keyboard"; + public const string k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; + public const string k_pch_Keyboard_ScaleX = "ScaleX"; + public const string k_pch_Keyboard_ScaleY = "ScaleY"; + public const string k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; + public const string k_pch_Keyboard_OffsetRightX = "OffsetRightX"; + public const string k_pch_Keyboard_OffsetY = "OffsetY"; + public const string k_pch_Keyboard_Smoothing = "Smoothing"; + public const string k_pch_Perf_Section = "perfcheck"; + public const string k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD"; + public const string k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; + public const string k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; + public const string k_pch_Perf_TestData_Float = "perfTestData"; + public const string k_pch_Perf_GPUProfiling_Bool = "GPUProfiling"; + public const string k_pch_CollisionBounds_Section = "collisionBounds"; + public const string k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; + public const string k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; + public const string k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; + public const string k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; + public const string k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; + public const string k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight"; + public const string k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; + public const string k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; + public const string k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; + public const string k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; + public const string k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport"; + public const string k_pch_Camera_Section = "camera"; + public const string k_pch_Camera_EnableCamera_Bool = "enableCamera"; + public const string k_pch_Camera_ShowOnController_Bool = "showOnController"; + public const string k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; + public const string k_pch_Camera_RoomView_Int32 = "roomView"; + public const string k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; + public const string k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; + public const string k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; + public const string k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; + public const string k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; + public const string k_pch_Camera_RoomViewStyle_Int32 = "roomViewStyle"; + public const string k_pch_audio_Section = "audio"; + public const string k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice"; + public const string k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride"; + public const string k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride"; + public const string k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName"; + public const string k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice"; + public const string k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride"; + public const string k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride"; + public const string k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName"; + public const string k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror"; + public const string k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice"; + public const string k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName"; + public const string k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; + public const string k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice"; + public const string k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume"; + public const string k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId"; + public const string k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; + public const string k_pch_audio_DualSpeakerAndJackOutput_Bool = "dualSpeakerAndJackOutput"; + public const string k_pch_audio_MuteMicMonitor_Bool = "muteMicMonitor"; + public const string k_pch_Power_Section = "power"; + public const string k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; + public const string k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; + public const string k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; + public const string k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; + public const string k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; + public const string k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; + public const string k_pch_Dashboard_Section = "dashboard"; + public const string k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; + public const string k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; + public const string k_pch_Dashboard_Position = "position"; + public const string k_pch_Dashboard_DesktopScale = "desktopScale"; + public const string k_pch_Dashboard_DashboardScale = "dashboardScale"; + public const string k_pch_Dashboard_UseStandaloneSystemLayer = "standaloneSystemLayer"; + public const string k_pch_modelskin_Section = "modelskins"; + public const string k_pch_Driver_Enable_Bool = "enable"; + public const string k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode"; + public const string k_pch_Driver_LoadPriority_Int32 = "loadPriority"; + public const string k_pch_WebInterface_Section = "WebInterface"; + public const string k_pch_VRWebHelper_Section = "VRWebHelper"; + public const string k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled"; + public const string k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort"; + public const string k_pch_TrackingOverride_Section = "TrackingOverrides"; + public const string k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; + public const string k_pch_App_BindingLegacyAPISuffix_String = "_legacy"; + public const string k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput"; + public const string k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; + public const string k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL"; + public const string k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; + public const string k_pch_App_DominantHand_Int32 = "DominantHand"; + public const string k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK"; + public const string k_pch_Trackers_Section = "trackers"; + public const string k_pch_DesktopUI_Section = "DesktopUI"; + public const string k_pch_LastKnown_Section = "LastKnown"; + public const string k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer"; + public const string k_pch_LastKnown_HMDModel_String = "HMDModel"; + public const string k_pch_DismissedWarnings_Section = "DismissedWarnings"; + public const string k_pch_Input_Section = "input"; + public const string k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation"; + public const string k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation"; + public const string k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone"; + public const string k_pch_GpuSpeed_Section = "GpuSpeed"; + public const string IVRScreenshots_Version = "IVRScreenshots_001"; + public const string IVRResources_Version = "IVRResources_001"; + public const string IVRDriverManager_Version = "IVRDriverManager_001"; + public const uint k_unMaxActionNameLength = 64; + public const uint k_unMaxActionSetNameLength = 64; + public const uint k_unMaxActionOriginCount = 16; + public const uint k_unMaxBoneNameLength = 32; + public const int k_nActionSetOverlayGlobalPriorityMin = 16777216; + public const int k_nActionSetOverlayGlobalPriorityMax = 33554431; + public const int k_nActionSetPriorityReservedMin = 33554432; + public const string IVRInput_Version = "IVRInput_010"; + public const ulong k_ulInvalidIOBufferHandle = 0; + public const string IVRIOBuffer_Version = "IVRIOBuffer_002"; + public const uint k_ulInvalidSpatialAnchorHandle = 0; + public const string IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; + public const string IVRDebug_Version = "IVRDebug_001"; + public const ulong k_ulDisplayRedirectContainer = 25769803779; + public const string IVRProperties_Version = "IVRProperties_001"; + public const string k_pchPathUserHandRight = "/user/hand/right"; + public const string k_pchPathUserHandLeft = "/user/hand/left"; + public const string k_pchPathUserHandPrimary = "/user/hand/primary"; + public const string k_pchPathUserHandSecondary = "/user/hand/secondary"; + public const string k_pchPathUserHead = "/user/head"; + public const string k_pchPathUserGamepad = "/user/gamepad"; + public const string k_pchPathUserTreadmill = "/user/treadmill"; + public const string k_pchPathUserStylus = "/user/stylus"; + public const string k_pchPathDevices = "/devices"; + public const string k_pchPathDevicePath = "/device_path"; + public const string k_pchPathBestAliasPath = "/best_alias_path"; + public const string k_pchPathBoundTrackerAliasPath = "/bound_tracker_path"; + public const string k_pchPathBoundTrackerRole = "/bound_tracker_role"; + public const string k_pchPathPoseRaw = "/pose/raw"; + public const string k_pchPathPoseTip = "/pose/tip"; + public const string k_pchPathPoseGrip = "/pose/grip"; + public const string k_pchPathSystemButtonClick = "/input/system/click"; + public const string k_pchPathProximity = "/proximity"; + public const string k_pchPathControllerTypePrefix = "/controller_type/"; + public const string k_pchPathInputProfileSuffix = "/input_profile"; + public const string k_pchPathBindingNameSuffix = "/binding_name"; + public const string k_pchPathBindingUrlSuffix = "/binding_url"; + public const string k_pchPathBindingErrorSuffix = "/binding_error"; + public const string k_pchPathActiveActionSets = "/active_action_sets"; + public const string k_pchPathComponentUpdates = "/total_component_updates"; + public const string k_pchPathUserFootLeft = "/user/foot/left"; + public const string k_pchPathUserFootRight = "/user/foot/right"; + public const string k_pchPathUserShoulderLeft = "/user/shoulder/left"; + public const string k_pchPathUserShoulderRight = "/user/shoulder/right"; + public const string k_pchPathUserElbowLeft = "/user/elbow/left"; + public const string k_pchPathUserElbowRight = "/user/elbow/right"; + public const string k_pchPathUserKneeLeft = "/user/knee/left"; + public const string k_pchPathUserKneeRight = "/user/knee/right"; + public const string k_pchPathUserWaist = "/user/waist"; + public const string k_pchPathUserChest = "/user/chest"; + public const string k_pchPathUserCamera = "/user/camera"; + public const string k_pchPathUserKeyboard = "/user/keyboard"; + public const string k_pchPathClientAppKey = "/client_info/app_key"; + public const ulong k_ulInvalidPathHandle = 0; + public const string IVRPaths_Version = "IVRPaths_001"; + public const string IVRBlockQueue_Version = "IVRBlockQueue_004"; + + static uint VRToken { get; set; } + + const string FnTable_Prefix = "FnTable:"; + + class COpenVRContext + { + public COpenVRContext() { Clear(); } + + public void Clear() + { + m_pVRSystem = null; + m_pVRChaperone = null; + m_pVRChaperoneSetup = null; + m_pVRCompositor = null; + m_pVRHeadsetView = null; + m_pVROverlay = null; + m_pVROverlayView = null; + m_pVRRenderModels = null; + m_pVRExtendedDisplay = null; + m_pVRSettings = null; + m_pVRApplications = null; + m_pVRScreenshots = null; + m_pVRTrackedCamera = null; + m_pVRInput = null; + m_pVRIOBuffer = null; + m_pVRSpatialAnchors = null; + m_pVRNotifications = null; + m_pVRDebug = null; + } + + void CheckClear() + { + if (VRToken != GetInitToken()) + { + Clear(); + VRToken = GetInitToken(); + } + } + + public CVRSystem VRSystem() + { + CheckClear(); + if (m_pVRSystem == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSystem_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRSystem = new CVRSystem(pInterface); + } + return m_pVRSystem; + } + + public CVRChaperone VRChaperone() + { + CheckClear(); + if (m_pVRChaperone == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperone_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRChaperone = new CVRChaperone(pInterface); + } + return m_pVRChaperone; + } + + public CVRChaperoneSetup VRChaperoneSetup() + { + CheckClear(); + if (m_pVRChaperoneSetup == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRChaperoneSetup_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRChaperoneSetup = new CVRChaperoneSetup(pInterface); + } + return m_pVRChaperoneSetup; + } + + public CVRCompositor VRCompositor() + { + CheckClear(); + if (m_pVRCompositor == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRCompositor_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRCompositor = new CVRCompositor(pInterface); + } + return m_pVRCompositor; + } + + public CVRHeadsetView VRHeadsetView() + { + CheckClear(); + if (m_pVRHeadsetView == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRHeadsetView_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRHeadsetView = new CVRHeadsetView(pInterface); + } + return m_pVRHeadsetView; + } + + public CVROverlay VROverlay() + { + CheckClear(); + if (m_pVROverlay == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlay_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVROverlay = new CVROverlay(pInterface); + } + return m_pVROverlay; + } + + public CVROverlayView VROverlayView() + { + CheckClear(); + if (m_pVROverlayView == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVROverlayView_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVROverlayView = new CVROverlayView(pInterface); + } + return m_pVROverlayView; + } + + public CVRRenderModels VRRenderModels() + { + CheckClear(); + if (m_pVRRenderModels == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRRenderModels_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRRenderModels = new CVRRenderModels(pInterface); + } + return m_pVRRenderModels; + } + + public CVRExtendedDisplay VRExtendedDisplay() + { + CheckClear(); + if (m_pVRExtendedDisplay == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRExtendedDisplay_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRExtendedDisplay = new CVRExtendedDisplay(pInterface); + } + return m_pVRExtendedDisplay; + } + + public CVRSettings VRSettings() + { + CheckClear(); + if (m_pVRSettings == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRSettings_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRSettings = new CVRSettings(pInterface); + } + return m_pVRSettings; + } + + public CVRApplications VRApplications() + { + CheckClear(); + if (m_pVRApplications == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRApplications_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRApplications = new CVRApplications(pInterface); + } + return m_pVRApplications; + } + + public CVRScreenshots VRScreenshots() + { + CheckClear(); + if (m_pVRScreenshots == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRScreenshots_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRScreenshots = new CVRScreenshots(pInterface); + } + return m_pVRScreenshots; + } + + public CVRTrackedCamera VRTrackedCamera() + { + CheckClear(); + if (m_pVRTrackedCamera == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRTrackedCamera_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRTrackedCamera = new CVRTrackedCamera(pInterface); + } + return m_pVRTrackedCamera; + } + + public CVRInput VRInput() + { + CheckClear(); + if (m_pVRInput == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix+IVRInput_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRInput = new CVRInput(pInterface); + } + return m_pVRInput; + } + + public CVRIOBuffer VRIOBuffer() + { + CheckClear(); + if (m_pVRIOBuffer == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRIOBuffer_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRIOBuffer = new CVRIOBuffer(pInterface); + } + return m_pVRIOBuffer; + } + + public CVRSpatialAnchors VRSpatialAnchors() + { + CheckClear(); + if (m_pVRSpatialAnchors == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRSpatialAnchors_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRSpatialAnchors = new CVRSpatialAnchors(pInterface); + } + return m_pVRSpatialAnchors; + } + + public CVRDebug VRDebug() + { + CheckClear(); + if (m_pVRDebug == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRDebug_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRDebug = new CVRDebug(pInterface); + } + return m_pVRDebug; + } + + public CVRNotifications VRNotifications() + { + CheckClear(); + if (m_pVRNotifications == null) + { + var eError = EVRInitError.None; + var pInterface = OpenVRInterop.GetGenericInterface(FnTable_Prefix + IVRNotifications_Version, ref eError); + if (pInterface != IntPtr.Zero && eError == EVRInitError.None) + m_pVRNotifications = new CVRNotifications(pInterface); + } + return m_pVRNotifications; + } + + private CVRSystem m_pVRSystem; + private CVRChaperone m_pVRChaperone; + private CVRChaperoneSetup m_pVRChaperoneSetup; + private CVRCompositor m_pVRCompositor; + private CVRHeadsetView m_pVRHeadsetView; + private CVROverlay m_pVROverlay; + private CVROverlayView m_pVROverlayView; + private CVRRenderModels m_pVRRenderModels; + private CVRExtendedDisplay m_pVRExtendedDisplay; + private CVRSettings m_pVRSettings; + private CVRApplications m_pVRApplications; + private CVRScreenshots m_pVRScreenshots; + private CVRTrackedCamera m_pVRTrackedCamera; + private CVRInput m_pVRInput; + private CVRIOBuffer m_pVRIOBuffer; + private CVRSpatialAnchors m_pVRSpatialAnchors; + private CVRNotifications m_pVRNotifications; + private CVRDebug m_pVRDebug; + }; + + private static COpenVRContext _OpenVRInternal_ModuleContext = null; + static COpenVRContext OpenVRInternal_ModuleContext + { + get + { + if (_OpenVRInternal_ModuleContext == null) + _OpenVRInternal_ModuleContext = new COpenVRContext(); + return _OpenVRInternal_ModuleContext; + } + } + + public static CVRSystem System { get { return OpenVRInternal_ModuleContext.VRSystem(); } } + public static CVRChaperone Chaperone { get { return OpenVRInternal_ModuleContext.VRChaperone(); } } + public static CVRChaperoneSetup ChaperoneSetup { get { return OpenVRInternal_ModuleContext.VRChaperoneSetup(); } } + public static CVRCompositor Compositor { get { return OpenVRInternal_ModuleContext.VRCompositor(); } } + public static CVRHeadsetView HeadsetView { get { return OpenVRInternal_ModuleContext.VRHeadsetView(); } } + public static CVROverlay Overlay { get { return OpenVRInternal_ModuleContext.VROverlay(); } } + public static CVROverlayView OverlayView { get { return OpenVRInternal_ModuleContext.VROverlayView(); } } + public static CVRRenderModels RenderModels { get { return OpenVRInternal_ModuleContext.VRRenderModels(); } } + public static CVRExtendedDisplay ExtendedDisplay { get { return OpenVRInternal_ModuleContext.VRExtendedDisplay(); } } + public static CVRSettings Settings { get { return OpenVRInternal_ModuleContext.VRSettings(); } } + public static CVRApplications Applications { get { return OpenVRInternal_ModuleContext.VRApplications(); } } + public static CVRScreenshots Screenshots { get { return OpenVRInternal_ModuleContext.VRScreenshots(); } } + public static CVRTrackedCamera TrackedCamera { get { return OpenVRInternal_ModuleContext.VRTrackedCamera(); } } + public static CVRInput Input { get { return OpenVRInternal_ModuleContext.VRInput(); } } + public static CVRIOBuffer IOBuffer { get { return OpenVRInternal_ModuleContext.VRIOBuffer(); } } + public static CVRSpatialAnchors SpatialAnchors { get { return OpenVRInternal_ModuleContext.VRSpatialAnchors(); } } + public static CVRNotifications Notifications { get { return OpenVRInternal_ModuleContext.VRNotifications(); } } + public static CVRDebug Debug { get { return OpenVRInternal_ModuleContext.VRDebug(); } } + + + /** Finds the active installation of vrclient.dll and initializes it */ + public static CVRSystem Init(ref EVRInitError peError, EVRApplicationType eApplicationType = EVRApplicationType.VRApplication_Scene, string pchStartupInfo= "") + { + try + { + VRToken = InitInternal2(ref peError, eApplicationType, pchStartupInfo); + } + catch (EntryPointNotFoundException) + { + VRToken = InitInternal(ref peError, eApplicationType); + } + + OpenVRInternal_ModuleContext.Clear(); + + if (peError != EVRInitError.None) + return null; + + bool bInterfaceValid = IsInterfaceVersionValid(IVRSystem_Version); + if (!bInterfaceValid) + { + ShutdownInternal(); + peError = EVRInitError.Init_InterfaceNotFound; + return null; + } + + return OpenVR.System; + } + + /** unloads vrclient.dll. Any interface pointers from the interface are + * invalid after this point */ + public static void Shutdown() + { + ShutdownInternal(); + } + +} + + + +} +#endif + diff --git a/contrib/openvr/headers/openvr_api.json b/contrib/openvr/headers/openvr_api.json new file mode 100755 index 0000000..463243b --- /dev/null +++ b/contrib/openvr/headers/openvr_api.json @@ -0,0 +1,5761 @@ +{"typedefs":[{"typedef": "vr::SpatialAnchorHandle_t","type": "uint32_t"} +,{"typedef": "vr::glSharedTextureHandle_t","type": "void *"} +,{"typedef": "vr::glInt_t","type": "int32_t"} +,{"typedef": "vr::glUInt_t","type": "uint32_t"} +,{"typedef": "vr::SharedTextureHandle_t","type": "uint64_t"} +,{"typedef": "vr::DriverId_t","type": "uint32_t"} +,{"typedef": "vr::TrackedDeviceIndex_t","type": "uint32_t"} +,{"typedef": "vr::WebConsoleHandle_t","type": "uint64_t"} +,{"typedef": "vr::PropertyContainerHandle_t","type": "uint64_t"} +,{"typedef": "vr::PropertyTypeTag_t","type": "uint32_t"} +,{"typedef": "vr::DriverHandle_t","type": "PropertyContainerHandle_t"} +,{"typedef": "vr::VRActionHandle_t","type": "uint64_t"} +,{"typedef": "vr::VRActionSetHandle_t","type": "uint64_t"} +,{"typedef": "vr::VRInputValueHandle_t","type": "uint64_t"} +,{"typedef": "vr::VREvent_Data_t","type": "union VREvent_Data_t"} +,{"typedef": "vr::VRComponentProperties","type": "uint32_t"} +,{"typedef": "vr::VRControllerState_t","type": "struct vr::VRControllerState001_t"} +,{"typedef": "vr::VROverlayHandle_t","type": "uint64_t"} +,{"typedef": "vr::BoneIndex_t","type": "int32_t"} +,{"typedef": "vr::TrackedCameraHandle_t","type": "uint64_t"} +,{"typedef": "vr::ScreenshotHandle_t","type": "uint32_t"} +,{"typedef": "vr::VROverlayIntersectionMaskPrimitive_Data_t","type": "union VROverlayIntersectionMaskPrimitive_Data_t"} +,{"typedef": "vr::TextureID_t","type": "int32_t"} +,{"typedef": "vr::VRNotificationId","type": "uint32_t"} +,{"typedef": "vr::IOBufferHandle_t","type": "uint64_t"} +,{"typedef": "vr::VrProfilerEventHandle_t","type": "uint64_t"} +,{"typedef": "vr::HmdError","type": "enum vr::EVRInitError"} +,{"typedef": "vr::Hmd_Eye","type": "enum vr::EVREye"} +,{"typedef": "vr::ColorSpace","type": "enum vr::EColorSpace"} +,{"typedef": "vr::HmdTrackingResult","type": "enum vr::ETrackingResult"} +,{"typedef": "vr::TrackedDeviceClass","type": "enum vr::ETrackedDeviceClass"} +,{"typedef": "vr::TrackingUniverseOrigin","type": "enum vr::ETrackingUniverseOrigin"} +,{"typedef": "vr::TrackedDeviceProperty","type": "enum vr::ETrackedDeviceProperty"} +,{"typedef": "vr::TrackedPropertyError","type": "enum vr::ETrackedPropertyError"} +,{"typedef": "vr::VRSubmitFlags_t","type": "enum vr::EVRSubmitFlags"} +,{"typedef": "vr::VRState_t","type": "enum vr::EVRState"} +,{"typedef": "vr::CollisionBoundsStyle_t","type": "enum vr::ECollisionBoundsStyle"} +,{"typedef": "vr::VROverlayError","type": "enum vr::EVROverlayError"} +,{"typedef": "vr::VRFirmwareError","type": "enum vr::EVRFirmwareError"} +,{"typedef": "vr::VRCompositorError","type": "enum vr::EVRCompositorError"} +,{"typedef": "vr::VRScreenshotsError","type": "enum vr::EVRScreenshotError"} +,{"typedef": "vr::PathHandle_t","type": "uint64_t"} +], +"enums":[ + {"enumname": "vr::EVREye","values": [ + {"name": "Eye_Left","value": "0"} + ,{"name": "Eye_Right","value": "1"} +]} +, {"enumname": "vr::ETextureType","values": [ + {"name": "TextureType_Invalid","value": "-1"} + ,{"name": "TextureType_DirectX","value": "0"} + ,{"name": "TextureType_OpenGL","value": "1"} + ,{"name": "TextureType_Vulkan","value": "2"} + ,{"name": "TextureType_IOSurface","value": "3"} + ,{"name": "TextureType_DirectX12","value": "4"} + ,{"name": "TextureType_DXGISharedHandle","value": "5"} + ,{"name": "TextureType_Metal","value": "6"} +]} +, {"enumname": "vr::EColorSpace","values": [ + {"name": "ColorSpace_Auto","value": "0"} + ,{"name": "ColorSpace_Gamma","value": "1"} + ,{"name": "ColorSpace_Linear","value": "2"} +]} +, {"enumname": "vr::ETrackingResult","values": [ + {"name": "TrackingResult_Uninitialized","value": "1"} + ,{"name": "TrackingResult_Calibrating_InProgress","value": "100"} + ,{"name": "TrackingResult_Calibrating_OutOfRange","value": "101"} + ,{"name": "TrackingResult_Running_OK","value": "200"} + ,{"name": "TrackingResult_Running_OutOfRange","value": "201"} + ,{"name": "TrackingResult_Fallback_RotationOnly","value": "300"} +]} +, {"enumname": "vr::ETrackedDeviceClass","values": [ + {"name": "TrackedDeviceClass_Invalid","value": "0"} + ,{"name": "TrackedDeviceClass_HMD","value": "1"} + ,{"name": "TrackedDeviceClass_Controller","value": "2"} + ,{"name": "TrackedDeviceClass_GenericTracker","value": "3"} + ,{"name": "TrackedDeviceClass_TrackingReference","value": "4"} + ,{"name": "TrackedDeviceClass_DisplayRedirect","value": "5"} + ,{"name": "TrackedDeviceClass_Max","value": "6"} +]} +, {"enumname": "vr::ETrackedControllerRole","values": [ + {"name": "TrackedControllerRole_Invalid","value": "0"} + ,{"name": "TrackedControllerRole_LeftHand","value": "1"} + ,{"name": "TrackedControllerRole_RightHand","value": "2"} + ,{"name": "TrackedControllerRole_OptOut","value": "3"} + ,{"name": "TrackedControllerRole_Treadmill","value": "4"} + ,{"name": "TrackedControllerRole_Stylus","value": "5"} + ,{"name": "TrackedControllerRole_Max","value": "5"} +]} +, {"enumname": "vr::ETrackingUniverseOrigin","values": [ + {"name": "TrackingUniverseSeated","value": "0"} + ,{"name": "TrackingUniverseStanding","value": "1"} + ,{"name": "TrackingUniverseRawAndUncalibrated","value": "2"} +]} +, {"enumname": "vr::EAdditionalRadioFeatures","values": [ + {"name": "AdditionalRadioFeatures_None","value": "0"} + ,{"name": "AdditionalRadioFeatures_HTCLinkBox","value": "1"} + ,{"name": "AdditionalRadioFeatures_InternalDongle","value": "2"} + ,{"name": "AdditionalRadioFeatures_ExternalDongle","value": "4"} +]} +, {"enumname": "vr::ETrackedDeviceProperty","values": [ + {"name": "Prop_Invalid","value": "0"} + ,{"name": "Prop_TrackingSystemName_String","value": "1000"} + ,{"name": "Prop_ModelNumber_String","value": "1001"} + ,{"name": "Prop_SerialNumber_String","value": "1002"} + ,{"name": "Prop_RenderModelName_String","value": "1003"} + ,{"name": "Prop_WillDriftInYaw_Bool","value": "1004"} + ,{"name": "Prop_ManufacturerName_String","value": "1005"} + ,{"name": "Prop_TrackingFirmwareVersion_String","value": "1006"} + ,{"name": "Prop_HardwareRevision_String","value": "1007"} + ,{"name": "Prop_AllWirelessDongleDescriptions_String","value": "1008"} + ,{"name": "Prop_ConnectedWirelessDongle_String","value": "1009"} + ,{"name": "Prop_DeviceIsWireless_Bool","value": "1010"} + ,{"name": "Prop_DeviceIsCharging_Bool","value": "1011"} + ,{"name": "Prop_DeviceBatteryPercentage_Float","value": "1012"} + ,{"name": "Prop_StatusDisplayTransform_Matrix34","value": "1013"} + ,{"name": "Prop_Firmware_UpdateAvailable_Bool","value": "1014"} + ,{"name": "Prop_Firmware_ManualUpdate_Bool","value": "1015"} + ,{"name": "Prop_Firmware_ManualUpdateURL_String","value": "1016"} + ,{"name": "Prop_HardwareRevision_Uint64","value": "1017"} + ,{"name": "Prop_FirmwareVersion_Uint64","value": "1018"} + ,{"name": "Prop_FPGAVersion_Uint64","value": "1019"} + ,{"name": "Prop_VRCVersion_Uint64","value": "1020"} + ,{"name": "Prop_RadioVersion_Uint64","value": "1021"} + ,{"name": "Prop_DongleVersion_Uint64","value": "1022"} + ,{"name": "Prop_BlockServerShutdown_Bool","value": "1023"} + ,{"name": "Prop_CanUnifyCoordinateSystemWithHmd_Bool","value": "1024"} + ,{"name": "Prop_ContainsProximitySensor_Bool","value": "1025"} + ,{"name": "Prop_DeviceProvidesBatteryStatus_Bool","value": "1026"} + ,{"name": "Prop_DeviceCanPowerOff_Bool","value": "1027"} + ,{"name": "Prop_Firmware_ProgrammingTarget_String","value": "1028"} + ,{"name": "Prop_DeviceClass_Int32","value": "1029"} + ,{"name": "Prop_HasCamera_Bool","value": "1030"} + ,{"name": "Prop_DriverVersion_String","value": "1031"} + ,{"name": "Prop_Firmware_ForceUpdateRequired_Bool","value": "1032"} + ,{"name": "Prop_ViveSystemButtonFixRequired_Bool","value": "1033"} + ,{"name": "Prop_ParentDriver_Uint64","value": "1034"} + ,{"name": "Prop_ResourceRoot_String","value": "1035"} + ,{"name": "Prop_RegisteredDeviceType_String","value": "1036"} + ,{"name": "Prop_InputProfilePath_String","value": "1037"} + ,{"name": "Prop_NeverTracked_Bool","value": "1038"} + ,{"name": "Prop_NumCameras_Int32","value": "1039"} + ,{"name": "Prop_CameraFrameLayout_Int32","value": "1040"} + ,{"name": "Prop_CameraStreamFormat_Int32","value": "1041"} + ,{"name": "Prop_AdditionalDeviceSettingsPath_String","value": "1042"} + ,{"name": "Prop_Identifiable_Bool","value": "1043"} + ,{"name": "Prop_BootloaderVersion_Uint64","value": "1044"} + ,{"name": "Prop_AdditionalSystemReportData_String","value": "1045"} + ,{"name": "Prop_CompositeFirmwareVersion_String","value": "1046"} + ,{"name": "Prop_Firmware_RemindUpdate_Bool","value": "1047"} + ,{"name": "Prop_PeripheralApplicationVersion_Uint64","value": "1048"} + ,{"name": "Prop_ManufacturerSerialNumber_String","value": "1049"} + ,{"name": "Prop_ComputedSerialNumber_String","value": "1050"} + ,{"name": "Prop_EstimatedDeviceFirstUseTime_Int32","value": "1051"} + ,{"name": "Prop_ReportsTimeSinceVSync_Bool","value": "2000"} + ,{"name": "Prop_SecondsFromVsyncToPhotons_Float","value": "2001"} + ,{"name": "Prop_DisplayFrequency_Float","value": "2002"} + ,{"name": "Prop_UserIpdMeters_Float","value": "2003"} + ,{"name": "Prop_CurrentUniverseId_Uint64","value": "2004"} + ,{"name": "Prop_PreviousUniverseId_Uint64","value": "2005"} + ,{"name": "Prop_DisplayFirmwareVersion_Uint64","value": "2006"} + ,{"name": "Prop_IsOnDesktop_Bool","value": "2007"} + ,{"name": "Prop_DisplayMCType_Int32","value": "2008"} + ,{"name": "Prop_DisplayMCOffset_Float","value": "2009"} + ,{"name": "Prop_DisplayMCScale_Float","value": "2010"} + ,{"name": "Prop_EdidVendorID_Int32","value": "2011"} + ,{"name": "Prop_DisplayMCImageLeft_String","value": "2012"} + ,{"name": "Prop_DisplayMCImageRight_String","value": "2013"} + ,{"name": "Prop_DisplayGCBlackClamp_Float","value": "2014"} + ,{"name": "Prop_EdidProductID_Int32","value": "2015"} + ,{"name": "Prop_CameraToHeadTransform_Matrix34","value": "2016"} + ,{"name": "Prop_DisplayGCType_Int32","value": "2017"} + ,{"name": "Prop_DisplayGCOffset_Float","value": "2018"} + ,{"name": "Prop_DisplayGCScale_Float","value": "2019"} + ,{"name": "Prop_DisplayGCPrescale_Float","value": "2020"} + ,{"name": "Prop_DisplayGCImage_String","value": "2021"} + ,{"name": "Prop_LensCenterLeftU_Float","value": "2022"} + ,{"name": "Prop_LensCenterLeftV_Float","value": "2023"} + ,{"name": "Prop_LensCenterRightU_Float","value": "2024"} + ,{"name": "Prop_LensCenterRightV_Float","value": "2025"} + ,{"name": "Prop_UserHeadToEyeDepthMeters_Float","value": "2026"} + ,{"name": "Prop_CameraFirmwareVersion_Uint64","value": "2027"} + ,{"name": "Prop_CameraFirmwareDescription_String","value": "2028"} + ,{"name": "Prop_DisplayFPGAVersion_Uint64","value": "2029"} + ,{"name": "Prop_DisplayBootloaderVersion_Uint64","value": "2030"} + ,{"name": "Prop_DisplayHardwareVersion_Uint64","value": "2031"} + ,{"name": "Prop_AudioFirmwareVersion_Uint64","value": "2032"} + ,{"name": "Prop_CameraCompatibilityMode_Int32","value": "2033"} + ,{"name": "Prop_ScreenshotHorizontalFieldOfViewDegrees_Float","value": "2034"} + ,{"name": "Prop_ScreenshotVerticalFieldOfViewDegrees_Float","value": "2035"} + ,{"name": "Prop_DisplaySuppressed_Bool","value": "2036"} + ,{"name": "Prop_DisplayAllowNightMode_Bool","value": "2037"} + ,{"name": "Prop_DisplayMCImageWidth_Int32","value": "2038"} + ,{"name": "Prop_DisplayMCImageHeight_Int32","value": "2039"} + ,{"name": "Prop_DisplayMCImageNumChannels_Int32","value": "2040"} + ,{"name": "Prop_DisplayMCImageData_Binary","value": "2041"} + ,{"name": "Prop_SecondsFromPhotonsToVblank_Float","value": "2042"} + ,{"name": "Prop_DriverDirectModeSendsVsyncEvents_Bool","value": "2043"} + ,{"name": "Prop_DisplayDebugMode_Bool","value": "2044"} + ,{"name": "Prop_GraphicsAdapterLuid_Uint64","value": "2045"} + ,{"name": "Prop_DriverProvidedChaperonePath_String","value": "2048"} + ,{"name": "Prop_ExpectedTrackingReferenceCount_Int32","value": "2049"} + ,{"name": "Prop_ExpectedControllerCount_Int32","value": "2050"} + ,{"name": "Prop_NamedIconPathControllerLeftDeviceOff_String","value": "2051"} + ,{"name": "Prop_NamedIconPathControllerRightDeviceOff_String","value": "2052"} + ,{"name": "Prop_NamedIconPathTrackingReferenceDeviceOff_String","value": "2053"} + ,{"name": "Prop_DoNotApplyPrediction_Bool","value": "2054"} + ,{"name": "Prop_CameraToHeadTransforms_Matrix34_Array","value": "2055"} + ,{"name": "Prop_DistortionMeshResolution_Int32","value": "2056"} + ,{"name": "Prop_DriverIsDrawingControllers_Bool","value": "2057"} + ,{"name": "Prop_DriverRequestsApplicationPause_Bool","value": "2058"} + ,{"name": "Prop_DriverRequestsReducedRendering_Bool","value": "2059"} + ,{"name": "Prop_MinimumIpdStepMeters_Float","value": "2060"} + ,{"name": "Prop_AudioBridgeFirmwareVersion_Uint64","value": "2061"} + ,{"name": "Prop_ImageBridgeFirmwareVersion_Uint64","value": "2062"} + ,{"name": "Prop_ImuToHeadTransform_Matrix34","value": "2063"} + ,{"name": "Prop_ImuFactoryGyroBias_Vector3","value": "2064"} + ,{"name": "Prop_ImuFactoryGyroScale_Vector3","value": "2065"} + ,{"name": "Prop_ImuFactoryAccelerometerBias_Vector3","value": "2066"} + ,{"name": "Prop_ImuFactoryAccelerometerScale_Vector3","value": "2067"} + ,{"name": "Prop_ConfigurationIncludesLighthouse20Features_Bool","value": "2069"} + ,{"name": "Prop_AdditionalRadioFeatures_Uint64","value": "2070"} + ,{"name": "Prop_CameraWhiteBalance_Vector4_Array","value": "2071"} + ,{"name": "Prop_CameraDistortionFunction_Int32_Array","value": "2072"} + ,{"name": "Prop_CameraDistortionCoefficients_Float_Array","value": "2073"} + ,{"name": "Prop_ExpectedControllerType_String","value": "2074"} + ,{"name": "Prop_HmdTrackingStyle_Int32","value": "2075"} + ,{"name": "Prop_DriverProvidedChaperoneVisibility_Bool","value": "2076"} + ,{"name": "Prop_HmdColumnCorrectionSettingPrefix_String","value": "2077"} + ,{"name": "Prop_CameraSupportsCompatibilityModes_Bool","value": "2078"} + ,{"name": "Prop_SupportsRoomViewDepthProjection_Bool","value": "2079"} + ,{"name": "Prop_DisplayAvailableFrameRates_Float_Array","value": "2080"} + ,{"name": "Prop_DisplaySupportsMultipleFramerates_Bool","value": "2081"} + ,{"name": "Prop_DisplayColorMultLeft_Vector3","value": "2082"} + ,{"name": "Prop_DisplayColorMultRight_Vector3","value": "2083"} + ,{"name": "Prop_DisplaySupportsRuntimeFramerateChange_Bool","value": "2084"} + ,{"name": "Prop_DisplaySupportsAnalogGain_Bool","value": "2085"} + ,{"name": "Prop_DisplayMinAnalogGain_Float","value": "2086"} + ,{"name": "Prop_DisplayMaxAnalogGain_Float","value": "2087"} + ,{"name": "Prop_CameraExposureTime_Float","value": "2088"} + ,{"name": "Prop_CameraGlobalGain_Float","value": "2089"} + ,{"name": "Prop_DashboardScale_Float","value": "2091"} + ,{"name": "Prop_IpdUIRangeMinMeters_Float","value": "2100"} + ,{"name": "Prop_IpdUIRangeMaxMeters_Float","value": "2101"} + ,{"name": "Prop_Hmd_SupportsHDCP14LegacyCompat_Bool","value": "2102"} + ,{"name": "Prop_Hmd_SupportsMicMonitoring_Bool","value": "2103"} + ,{"name": "Prop_DriverRequestedMuraCorrectionMode_Int32","value": "2200"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerLeft_Int32","value": "2201"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerRight_Int32","value": "2202"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerTop_Int32","value": "2203"} + ,{"name": "Prop_DriverRequestedMuraFeather_InnerBottom_Int32","value": "2204"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterLeft_Int32","value": "2205"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterRight_Int32","value": "2206"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterTop_Int32","value": "2207"} + ,{"name": "Prop_DriverRequestedMuraFeather_OuterBottom_Int32","value": "2208"} + ,{"name": "Prop_Audio_DefaultPlaybackDeviceId_String","value": "2300"} + ,{"name": "Prop_Audio_DefaultRecordingDeviceId_String","value": "2301"} + ,{"name": "Prop_Audio_DefaultPlaybackDeviceVolume_Float","value": "2302"} + ,{"name": "Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool","value": "2303"} + ,{"name": "Prop_AttachedDeviceId_String","value": "3000"} + ,{"name": "Prop_SupportedButtons_Uint64","value": "3001"} + ,{"name": "Prop_Axis0Type_Int32","value": "3002"} + ,{"name": "Prop_Axis1Type_Int32","value": "3003"} + ,{"name": "Prop_Axis2Type_Int32","value": "3004"} + ,{"name": "Prop_Axis3Type_Int32","value": "3005"} + ,{"name": "Prop_Axis4Type_Int32","value": "3006"} + ,{"name": "Prop_ControllerRoleHint_Int32","value": "3007"} + ,{"name": "Prop_FieldOfViewLeftDegrees_Float","value": "4000"} + ,{"name": "Prop_FieldOfViewRightDegrees_Float","value": "4001"} + ,{"name": "Prop_FieldOfViewTopDegrees_Float","value": "4002"} + ,{"name": "Prop_FieldOfViewBottomDegrees_Float","value": "4003"} + ,{"name": "Prop_TrackingRangeMinimumMeters_Float","value": "4004"} + ,{"name": "Prop_TrackingRangeMaximumMeters_Float","value": "4005"} + ,{"name": "Prop_ModeLabel_String","value": "4006"} + ,{"name": "Prop_CanWirelessIdentify_Bool","value": "4007"} + ,{"name": "Prop_Nonce_Int32","value": "4008"} + ,{"name": "Prop_IconPathName_String","value": "5000"} + ,{"name": "Prop_NamedIconPathDeviceOff_String","value": "5001"} + ,{"name": "Prop_NamedIconPathDeviceSearching_String","value": "5002"} + ,{"name": "Prop_NamedIconPathDeviceSearchingAlert_String","value": "5003"} + ,{"name": "Prop_NamedIconPathDeviceReady_String","value": "5004"} + ,{"name": "Prop_NamedIconPathDeviceReadyAlert_String","value": "5005"} + ,{"name": "Prop_NamedIconPathDeviceNotReady_String","value": "5006"} + ,{"name": "Prop_NamedIconPathDeviceStandby_String","value": "5007"} + ,{"name": "Prop_NamedIconPathDeviceAlertLow_String","value": "5008"} + ,{"name": "Prop_NamedIconPathDeviceStandbyAlert_String","value": "5009"} + ,{"name": "Prop_DisplayHiddenArea_Binary_Start","value": "5100"} + ,{"name": "Prop_DisplayHiddenArea_Binary_End","value": "5150"} + ,{"name": "Prop_ParentContainer","value": "5151"} + ,{"name": "Prop_OverrideContainer_Uint64","value": "5152"} + ,{"name": "Prop_UserConfigPath_String","value": "6000"} + ,{"name": "Prop_InstallPath_String","value": "6001"} + ,{"name": "Prop_HasDisplayComponent_Bool","value": "6002"} + ,{"name": "Prop_HasControllerComponent_Bool","value": "6003"} + ,{"name": "Prop_HasCameraComponent_Bool","value": "6004"} + ,{"name": "Prop_HasDriverDirectModeComponent_Bool","value": "6005"} + ,{"name": "Prop_HasVirtualDisplayComponent_Bool","value": "6006"} + ,{"name": "Prop_HasSpatialAnchorsSupport_Bool","value": "6007"} + ,{"name": "Prop_ControllerType_String","value": "7000"} + ,{"name": "Prop_ControllerHandSelectionPriority_Int32","value": "7002"} + ,{"name": "Prop_VendorSpecific_Reserved_Start","value": "10000"} + ,{"name": "Prop_VendorSpecific_Reserved_End","value": "10999"} + ,{"name": "Prop_TrackedDeviceProperty_Max","value": "1000000"} +]} +, {"enumname": "vr::ETrackedPropertyError","values": [ + {"name": "TrackedProp_Success","value": "0"} + ,{"name": "TrackedProp_WrongDataType","value": "1"} + ,{"name": "TrackedProp_WrongDeviceClass","value": "2"} + ,{"name": "TrackedProp_BufferTooSmall","value": "3"} + ,{"name": "TrackedProp_UnknownProperty","value": "4"} + ,{"name": "TrackedProp_InvalidDevice","value": "5"} + ,{"name": "TrackedProp_CouldNotContactServer","value": "6"} + ,{"name": "TrackedProp_ValueNotProvidedByDevice","value": "7"} + ,{"name": "TrackedProp_StringExceedsMaximumLength","value": "8"} + ,{"name": "TrackedProp_NotYetAvailable","value": "9"} + ,{"name": "TrackedProp_PermissionDenied","value": "10"} + ,{"name": "TrackedProp_InvalidOperation","value": "11"} + ,{"name": "TrackedProp_CannotWriteToWildcards","value": "12"} + ,{"name": "TrackedProp_IPCReadFailure","value": "13"} + ,{"name": "TrackedProp_OutOfMemory","value": "14"} + ,{"name": "TrackedProp_InvalidContainer","value": "15"} +]} +, {"enumname": "vr::EHmdTrackingStyle","values": [ + {"name": "HmdTrackingStyle_Unknown","value": "0"} + ,{"name": "HmdTrackingStyle_Lighthouse","value": "1"} + ,{"name": "HmdTrackingStyle_OutsideInCameras","value": "2"} + ,{"name": "HmdTrackingStyle_InsideOutCameras","value": "3"} +]} +, {"enumname": "vr::EVRSubmitFlags","values": [ + {"name": "Submit_Default","value": "0"} + ,{"name": "Submit_LensDistortionAlreadyApplied","value": "1"} + ,{"name": "Submit_GlRenderBuffer","value": "2"} + ,{"name": "Submit_Reserved","value": "4"} + ,{"name": "Submit_TextureWithPose","value": "8"} + ,{"name": "Submit_TextureWithDepth","value": "16"} + ,{"name": "Submit_FrameDiscontinuty","value": "32"} + ,{"name": "Submit_VulkanTextureWithArrayData","value": "64"} + ,{"name": "Submit_GlArrayTexture","value": "128"} + ,{"name": "Submit_Reserved2","value": "32768"} +]} +, {"enumname": "vr::EVRState","values": [ + {"name": "VRState_Undefined","value": "-1"} + ,{"name": "VRState_Off","value": "0"} + ,{"name": "VRState_Searching","value": "1"} + ,{"name": "VRState_Searching_Alert","value": "2"} + ,{"name": "VRState_Ready","value": "3"} + ,{"name": "VRState_Ready_Alert","value": "4"} + ,{"name": "VRState_NotReady","value": "5"} + ,{"name": "VRState_Standby","value": "6"} + ,{"name": "VRState_Ready_Alert_Low","value": "7"} +]} +, {"enumname": "vr::EVREventType","values": [ + {"name": "VREvent_None","value": "0"} + ,{"name": "VREvent_TrackedDeviceActivated","value": "100"} + ,{"name": "VREvent_TrackedDeviceDeactivated","value": "101"} + ,{"name": "VREvent_TrackedDeviceUpdated","value": "102"} + ,{"name": "VREvent_TrackedDeviceUserInteractionStarted","value": "103"} + ,{"name": "VREvent_TrackedDeviceUserInteractionEnded","value": "104"} + ,{"name": "VREvent_IpdChanged","value": "105"} + ,{"name": "VREvent_EnterStandbyMode","value": "106"} + ,{"name": "VREvent_LeaveStandbyMode","value": "107"} + ,{"name": "VREvent_TrackedDeviceRoleChanged","value": "108"} + ,{"name": "VREvent_WatchdogWakeUpRequested","value": "109"} + ,{"name": "VREvent_LensDistortionChanged","value": "110"} + ,{"name": "VREvent_PropertyChanged","value": "111"} + ,{"name": "VREvent_WirelessDisconnect","value": "112"} + ,{"name": "VREvent_WirelessReconnect","value": "113"} + ,{"name": "VREvent_ButtonPress","value": "200"} + ,{"name": "VREvent_ButtonUnpress","value": "201"} + ,{"name": "VREvent_ButtonTouch","value": "202"} + ,{"name": "VREvent_ButtonUntouch","value": "203"} + ,{"name": "VREvent_Modal_Cancel","value": "257"} + ,{"name": "VREvent_MouseMove","value": "300"} + ,{"name": "VREvent_MouseButtonDown","value": "301"} + ,{"name": "VREvent_MouseButtonUp","value": "302"} + ,{"name": "VREvent_FocusEnter","value": "303"} + ,{"name": "VREvent_FocusLeave","value": "304"} + ,{"name": "VREvent_ScrollDiscrete","value": "305"} + ,{"name": "VREvent_TouchPadMove","value": "306"} + ,{"name": "VREvent_OverlayFocusChanged","value": "307"} + ,{"name": "VREvent_ReloadOverlays","value": "308"} + ,{"name": "VREvent_ScrollSmooth","value": "309"} + ,{"name": "VREvent_LockMousePosition","value": "310"} + ,{"name": "VREvent_UnlockMousePosition","value": "311"} + ,{"name": "VREvent_InputFocusCaptured","value": "400"} + ,{"name": "VREvent_InputFocusReleased","value": "401"} + ,{"name": "VREvent_SceneApplicationChanged","value": "404"} + ,{"name": "VREvent_SceneFocusChanged","value": "405"} + ,{"name": "VREvent_InputFocusChanged","value": "406"} + ,{"name": "VREvent_SceneApplicationUsingWrongGraphicsAdapter","value": "408"} + ,{"name": "VREvent_ActionBindingReloaded","value": "409"} + ,{"name": "VREvent_HideRenderModels","value": "410"} + ,{"name": "VREvent_ShowRenderModels","value": "411"} + ,{"name": "VREvent_SceneApplicationStateChanged","value": "412"} + ,{"name": "VREvent_ConsoleOpened","value": "420"} + ,{"name": "VREvent_ConsoleClosed","value": "421"} + ,{"name": "VREvent_OverlayShown","value": "500"} + ,{"name": "VREvent_OverlayHidden","value": "501"} + ,{"name": "VREvent_DashboardActivated","value": "502"} + ,{"name": "VREvent_DashboardDeactivated","value": "503"} + ,{"name": "VREvent_DashboardRequested","value": "505"} + ,{"name": "VREvent_ResetDashboard","value": "506"} + ,{"name": "VREvent_ImageLoaded","value": "508"} + ,{"name": "VREvent_ShowKeyboard","value": "509"} + ,{"name": "VREvent_HideKeyboard","value": "510"} + ,{"name": "VREvent_OverlayGamepadFocusGained","value": "511"} + ,{"name": "VREvent_OverlayGamepadFocusLost","value": "512"} + ,{"name": "VREvent_OverlaySharedTextureChanged","value": "513"} + ,{"name": "VREvent_ScreenshotTriggered","value": "516"} + ,{"name": "VREvent_ImageFailed","value": "517"} + ,{"name": "VREvent_DashboardOverlayCreated","value": "518"} + ,{"name": "VREvent_SwitchGamepadFocus","value": "519"} + ,{"name": "VREvent_RequestScreenshot","value": "520"} + ,{"name": "VREvent_ScreenshotTaken","value": "521"} + ,{"name": "VREvent_ScreenshotFailed","value": "522"} + ,{"name": "VREvent_SubmitScreenshotToDashboard","value": "523"} + ,{"name": "VREvent_ScreenshotProgressToDashboard","value": "524"} + ,{"name": "VREvent_PrimaryDashboardDeviceChanged","value": "525"} + ,{"name": "VREvent_RoomViewShown","value": "526"} + ,{"name": "VREvent_RoomViewHidden","value": "527"} + ,{"name": "VREvent_ShowUI","value": "528"} + ,{"name": "VREvent_ShowDevTools","value": "529"} + ,{"name": "VREvent_DesktopViewUpdating","value": "530"} + ,{"name": "VREvent_DesktopViewReady","value": "531"} + ,{"name": "VREvent_Notification_Shown","value": "600"} + ,{"name": "VREvent_Notification_Hidden","value": "601"} + ,{"name": "VREvent_Notification_BeginInteraction","value": "602"} + ,{"name": "VREvent_Notification_Destroyed","value": "603"} + ,{"name": "VREvent_Quit","value": "700"} + ,{"name": "VREvent_ProcessQuit","value": "701"} + ,{"name": "VREvent_QuitAcknowledged","value": "703"} + ,{"name": "VREvent_DriverRequestedQuit","value": "704"} + ,{"name": "VREvent_RestartRequested","value": "705"} + ,{"name": "VREvent_ChaperoneDataHasChanged","value": "800"} + ,{"name": "VREvent_ChaperoneUniverseHasChanged","value": "801"} + ,{"name": "VREvent_ChaperoneTempDataHasChanged","value": "802"} + ,{"name": "VREvent_ChaperoneSettingsHaveChanged","value": "803"} + ,{"name": "VREvent_SeatedZeroPoseReset","value": "804"} + ,{"name": "VREvent_ChaperoneFlushCache","value": "805"} + ,{"name": "VREvent_ChaperoneRoomSetupStarting","value": "806"} + ,{"name": "VREvent_ChaperoneRoomSetupFinished","value": "807"} + ,{"name": "VREvent_StandingZeroPoseReset","value": "808"} + ,{"name": "VREvent_AudioSettingsHaveChanged","value": "820"} + ,{"name": "VREvent_BackgroundSettingHasChanged","value": "850"} + ,{"name": "VREvent_CameraSettingsHaveChanged","value": "851"} + ,{"name": "VREvent_ReprojectionSettingHasChanged","value": "852"} + ,{"name": "VREvent_ModelSkinSettingsHaveChanged","value": "853"} + ,{"name": "VREvent_EnvironmentSettingsHaveChanged","value": "854"} + ,{"name": "VREvent_PowerSettingsHaveChanged","value": "855"} + ,{"name": "VREvent_EnableHomeAppSettingsHaveChanged","value": "856"} + ,{"name": "VREvent_SteamVRSectionSettingChanged","value": "857"} + ,{"name": "VREvent_LighthouseSectionSettingChanged","value": "858"} + ,{"name": "VREvent_NullSectionSettingChanged","value": "859"} + ,{"name": "VREvent_UserInterfaceSectionSettingChanged","value": "860"} + ,{"name": "VREvent_NotificationsSectionSettingChanged","value": "861"} + ,{"name": "VREvent_KeyboardSectionSettingChanged","value": "862"} + ,{"name": "VREvent_PerfSectionSettingChanged","value": "863"} + ,{"name": "VREvent_DashboardSectionSettingChanged","value": "864"} + ,{"name": "VREvent_WebInterfaceSectionSettingChanged","value": "865"} + ,{"name": "VREvent_TrackersSectionSettingChanged","value": "866"} + ,{"name": "VREvent_LastKnownSectionSettingChanged","value": "867"} + ,{"name": "VREvent_DismissedWarningsSectionSettingChanged","value": "868"} + ,{"name": "VREvent_GpuSpeedSectionSettingChanged","value": "869"} + ,{"name": "VREvent_WindowsMRSectionSettingChanged","value": "870"} + ,{"name": "VREvent_OtherSectionSettingChanged","value": "871"} + ,{"name": "VREvent_StatusUpdate","value": "900"} + ,{"name": "VREvent_WebInterface_InstallDriverCompleted","value": "950"} + ,{"name": "VREvent_MCImageUpdated","value": "1000"} + ,{"name": "VREvent_FirmwareUpdateStarted","value": "1100"} + ,{"name": "VREvent_FirmwareUpdateFinished","value": "1101"} + ,{"name": "VREvent_KeyboardClosed","value": "1200"} + ,{"name": "VREvent_KeyboardCharInput","value": "1201"} + ,{"name": "VREvent_KeyboardDone","value": "1202"} + ,{"name": "VREvent_ApplicationListUpdated","value": "1303"} + ,{"name": "VREvent_ApplicationMimeTypeLoad","value": "1304"} + ,{"name": "VREvent_ProcessConnected","value": "1306"} + ,{"name": "VREvent_ProcessDisconnected","value": "1307"} + ,{"name": "VREvent_Compositor_ChaperoneBoundsShown","value": "1410"} + ,{"name": "VREvent_Compositor_ChaperoneBoundsHidden","value": "1411"} + ,{"name": "VREvent_Compositor_DisplayDisconnected","value": "1412"} + ,{"name": "VREvent_Compositor_DisplayReconnected","value": "1413"} + ,{"name": "VREvent_Compositor_HDCPError","value": "1414"} + ,{"name": "VREvent_Compositor_ApplicationNotResponding","value": "1415"} + ,{"name": "VREvent_Compositor_ApplicationResumed","value": "1416"} + ,{"name": "VREvent_Compositor_OutOfVideoMemory","value": "1417"} + ,{"name": "VREvent_Compositor_DisplayModeNotSupported","value": "1418"} + ,{"name": "VREvent_Compositor_StageOverrideReady","value": "1419"} + ,{"name": "VREvent_TrackedCamera_StartVideoStream","value": "1500"} + ,{"name": "VREvent_TrackedCamera_StopVideoStream","value": "1501"} + ,{"name": "VREvent_TrackedCamera_PauseVideoStream","value": "1502"} + ,{"name": "VREvent_TrackedCamera_ResumeVideoStream","value": "1503"} + ,{"name": "VREvent_TrackedCamera_EditingSurface","value": "1550"} + ,{"name": "VREvent_PerformanceTest_EnableCapture","value": "1600"} + ,{"name": "VREvent_PerformanceTest_DisableCapture","value": "1601"} + ,{"name": "VREvent_PerformanceTest_FidelityLevel","value": "1602"} + ,{"name": "VREvent_MessageOverlay_Closed","value": "1650"} + ,{"name": "VREvent_MessageOverlayCloseRequested","value": "1651"} + ,{"name": "VREvent_Input_HapticVibration","value": "1700"} + ,{"name": "VREvent_Input_BindingLoadFailed","value": "1701"} + ,{"name": "VREvent_Input_BindingLoadSuccessful","value": "1702"} + ,{"name": "VREvent_Input_ActionManifestReloaded","value": "1703"} + ,{"name": "VREvent_Input_ActionManifestLoadFailed","value": "1704"} + ,{"name": "VREvent_Input_ProgressUpdate","value": "1705"} + ,{"name": "VREvent_Input_TrackerActivated","value": "1706"} + ,{"name": "VREvent_Input_BindingsUpdated","value": "1707"} + ,{"name": "VREvent_Input_BindingSubscriptionChanged","value": "1708"} + ,{"name": "VREvent_SpatialAnchors_PoseUpdated","value": "1800"} + ,{"name": "VREvent_SpatialAnchors_DescriptorUpdated","value": "1801"} + ,{"name": "VREvent_SpatialAnchors_RequestPoseUpdate","value": "1802"} + ,{"name": "VREvent_SpatialAnchors_RequestDescriptorUpdate","value": "1803"} + ,{"name": "VREvent_SystemReport_Started","value": "1900"} + ,{"name": "VREvent_Monitor_ShowHeadsetView","value": "2000"} + ,{"name": "VREvent_Monitor_HideHeadsetView","value": "2001"} + ,{"name": "VREvent_VendorSpecific_Reserved_Start","value": "10000"} + ,{"name": "VREvent_VendorSpecific_Reserved_End","value": "19999"} +]} +, {"enumname": "vr::EDeviceActivityLevel","values": [ + {"name": "k_EDeviceActivityLevel_Unknown","value": "-1"} + ,{"name": "k_EDeviceActivityLevel_Idle","value": "0"} + ,{"name": "k_EDeviceActivityLevel_UserInteraction","value": "1"} + ,{"name": "k_EDeviceActivityLevel_UserInteraction_Timeout","value": "2"} + ,{"name": "k_EDeviceActivityLevel_Standby","value": "3"} + ,{"name": "k_EDeviceActivityLevel_Idle_Timeout","value": "4"} +]} +, {"enumname": "vr::EVRButtonId","values": [ + {"name": "k_EButton_System","value": "0"} + ,{"name": "k_EButton_ApplicationMenu","value": "1"} + ,{"name": "k_EButton_Grip","value": "2"} + ,{"name": "k_EButton_DPad_Left","value": "3"} + ,{"name": "k_EButton_DPad_Up","value": "4"} + ,{"name": "k_EButton_DPad_Right","value": "5"} + ,{"name": "k_EButton_DPad_Down","value": "6"} + ,{"name": "k_EButton_A","value": "7"} + ,{"name": "k_EButton_ProximitySensor","value": "31"} + ,{"name": "k_EButton_Axis0","value": "32"} + ,{"name": "k_EButton_Axis1","value": "33"} + ,{"name": "k_EButton_Axis2","value": "34"} + ,{"name": "k_EButton_Axis3","value": "35"} + ,{"name": "k_EButton_Axis4","value": "36"} + ,{"name": "k_EButton_SteamVR_Touchpad","value": "32"} + ,{"name": "k_EButton_SteamVR_Trigger","value": "33"} + ,{"name": "k_EButton_Dashboard_Back","value": "2"} + ,{"name": "k_EButton_IndexController_A","value": "2"} + ,{"name": "k_EButton_IndexController_B","value": "1"} + ,{"name": "k_EButton_IndexController_JoyStick","value": "35"} + ,{"name": "k_EButton_Max","value": "64"} +]} +, {"enumname": "vr::EVRMouseButton","values": [ + {"name": "VRMouseButton_Left","value": "1"} + ,{"name": "VRMouseButton_Right","value": "2"} + ,{"name": "VRMouseButton_Middle","value": "4"} +]} +, {"enumname": "vr::EShowUIType","values": [ + {"name": "ShowUI_ControllerBinding","value": "0"} + ,{"name": "ShowUI_ManageTrackers","value": "1"} + ,{"name": "ShowUI_Pairing","value": "3"} + ,{"name": "ShowUI_Settings","value": "4"} + ,{"name": "ShowUI_DebugCommands","value": "5"} + ,{"name": "ShowUI_FullControllerBinding","value": "6"} + ,{"name": "ShowUI_ManageDrivers","value": "7"} +]} +, {"enumname": "vr::EHDCPError","values": [ + {"name": "HDCPError_None","value": "0"} + ,{"name": "HDCPError_LinkLost","value": "1"} + ,{"name": "HDCPError_Tampered","value": "2"} + ,{"name": "HDCPError_DeviceRevoked","value": "3"} + ,{"name": "HDCPError_Unknown","value": "4"} +]} +, {"enumname": "vr::EVRComponentProperty","values": [ + {"name": "VRComponentProperty_IsStatic","value": "1"} + ,{"name": "VRComponentProperty_IsVisible","value": "2"} + ,{"name": "VRComponentProperty_IsTouched","value": "4"} + ,{"name": "VRComponentProperty_IsPressed","value": "8"} + ,{"name": "VRComponentProperty_IsScrolled","value": "16"} + ,{"name": "VRComponentProperty_IsHighlighted","value": "32"} +]} +, {"enumname": "vr::EVRInputError","values": [ + {"name": "VRInputError_None","value": "0"} + ,{"name": "VRInputError_NameNotFound","value": "1"} + ,{"name": "VRInputError_WrongType","value": "2"} + ,{"name": "VRInputError_InvalidHandle","value": "3"} + ,{"name": "VRInputError_InvalidParam","value": "4"} + ,{"name": "VRInputError_NoSteam","value": "5"} + ,{"name": "VRInputError_MaxCapacityReached","value": "6"} + ,{"name": "VRInputError_IPCError","value": "7"} + ,{"name": "VRInputError_NoActiveActionSet","value": "8"} + ,{"name": "VRInputError_InvalidDevice","value": "9"} + ,{"name": "VRInputError_InvalidSkeleton","value": "10"} + ,{"name": "VRInputError_InvalidBoneCount","value": "11"} + ,{"name": "VRInputError_InvalidCompressedData","value": "12"} + ,{"name": "VRInputError_NoData","value": "13"} + ,{"name": "VRInputError_BufferTooSmall","value": "14"} + ,{"name": "VRInputError_MismatchedActionManifest","value": "15"} + ,{"name": "VRInputError_MissingSkeletonData","value": "16"} + ,{"name": "VRInputError_InvalidBoneIndex","value": "17"} + ,{"name": "VRInputError_InvalidPriority","value": "18"} + ,{"name": "VRInputError_PermissionDenied","value": "19"} + ,{"name": "VRInputError_InvalidRenderModel","value": "20"} +]} +, {"enumname": "vr::EVRSpatialAnchorError","values": [ + {"name": "VRSpatialAnchorError_Success","value": "0"} + ,{"name": "VRSpatialAnchorError_Internal","value": "1"} + ,{"name": "VRSpatialAnchorError_UnknownHandle","value": "2"} + ,{"name": "VRSpatialAnchorError_ArrayTooSmall","value": "3"} + ,{"name": "VRSpatialAnchorError_InvalidDescriptorChar","value": "4"} + ,{"name": "VRSpatialAnchorError_NotYetAvailable","value": "5"} + ,{"name": "VRSpatialAnchorError_NotAvailableInThisUniverse","value": "6"} + ,{"name": "VRSpatialAnchorError_PermanentlyUnavailable","value": "7"} + ,{"name": "VRSpatialAnchorError_WrongDriver","value": "8"} + ,{"name": "VRSpatialAnchorError_DescriptorTooLong","value": "9"} + ,{"name": "VRSpatialAnchorError_Unknown","value": "10"} + ,{"name": "VRSpatialAnchorError_NoRoomCalibration","value": "11"} + ,{"name": "VRSpatialAnchorError_InvalidArgument","value": "12"} + ,{"name": "VRSpatialAnchorError_UnknownDriver","value": "13"} +]} +, {"enumname": "vr::EHiddenAreaMeshType","values": [ + {"name": "k_eHiddenAreaMesh_Standard","value": "0"} + ,{"name": "k_eHiddenAreaMesh_Inverse","value": "1"} + ,{"name": "k_eHiddenAreaMesh_LineLoop","value": "2"} + ,{"name": "k_eHiddenAreaMesh_Max","value": "3"} +]} +, {"enumname": "vr::EVRControllerAxisType","values": [ + {"name": "k_eControllerAxis_None","value": "0"} + ,{"name": "k_eControllerAxis_TrackPad","value": "1"} + ,{"name": "k_eControllerAxis_Joystick","value": "2"} + ,{"name": "k_eControllerAxis_Trigger","value": "3"} +]} +, {"enumname": "vr::EVRControllerEventOutputType","values": [ + {"name": "ControllerEventOutput_OSEvents","value": "0"} + ,{"name": "ControllerEventOutput_VREvents","value": "1"} +]} +, {"enumname": "vr::ECollisionBoundsStyle","values": [ + {"name": "COLLISION_BOUNDS_STYLE_BEGINNER","value": "0"} + ,{"name": "COLLISION_BOUNDS_STYLE_INTERMEDIATE","value": "1"} + ,{"name": "COLLISION_BOUNDS_STYLE_SQUARES","value": "2"} + ,{"name": "COLLISION_BOUNDS_STYLE_ADVANCED","value": "3"} + ,{"name": "COLLISION_BOUNDS_STYLE_NONE","value": "4"} + ,{"name": "COLLISION_BOUNDS_STYLE_COUNT","value": "5"} +]} +, {"enumname": "vr::EVROverlayError","values": [ + {"name": "VROverlayError_None","value": "0"} + ,{"name": "VROverlayError_UnknownOverlay","value": "10"} + ,{"name": "VROverlayError_InvalidHandle","value": "11"} + ,{"name": "VROverlayError_PermissionDenied","value": "12"} + ,{"name": "VROverlayError_OverlayLimitExceeded","value": "13"} + ,{"name": "VROverlayError_WrongVisibilityType","value": "14"} + ,{"name": "VROverlayError_KeyTooLong","value": "15"} + ,{"name": "VROverlayError_NameTooLong","value": "16"} + ,{"name": "VROverlayError_KeyInUse","value": "17"} + ,{"name": "VROverlayError_WrongTransformType","value": "18"} + ,{"name": "VROverlayError_InvalidTrackedDevice","value": "19"} + ,{"name": "VROverlayError_InvalidParameter","value": "20"} + ,{"name": "VROverlayError_ThumbnailCantBeDestroyed","value": "21"} + ,{"name": "VROverlayError_ArrayTooSmall","value": "22"} + ,{"name": "VROverlayError_RequestFailed","value": "23"} + ,{"name": "VROverlayError_InvalidTexture","value": "24"} + ,{"name": "VROverlayError_UnableToLoadFile","value": "25"} + ,{"name": "VROverlayError_KeyboardAlreadyInUse","value": "26"} + ,{"name": "VROverlayError_NoNeighbor","value": "27"} + ,{"name": "VROverlayError_TooManyMaskPrimitives","value": "29"} + ,{"name": "VROverlayError_BadMaskPrimitive","value": "30"} + ,{"name": "VROverlayError_TextureAlreadyLocked","value": "31"} + ,{"name": "VROverlayError_TextureLockCapacityReached","value": "32"} + ,{"name": "VROverlayError_TextureNotLocked","value": "33"} +]} +, {"enumname": "vr::EVRApplicationType","values": [ + {"name": "VRApplication_Other","value": "0"} + ,{"name": "VRApplication_Scene","value": "1"} + ,{"name": "VRApplication_Overlay","value": "2"} + ,{"name": "VRApplication_Background","value": "3"} + ,{"name": "VRApplication_Utility","value": "4"} + ,{"name": "VRApplication_VRMonitor","value": "5"} + ,{"name": "VRApplication_SteamWatchdog","value": "6"} + ,{"name": "VRApplication_Bootstrapper","value": "7"} + ,{"name": "VRApplication_WebHelper","value": "8"} + ,{"name": "VRApplication_OpenXRInstance","value": "9"} + ,{"name": "VRApplication_OpenXRScene","value": "10"} + ,{"name": "VRApplication_OpenXROverlay","value": "11"} + ,{"name": "VRApplication_Prism","value": "12"} + ,{"name": "VRApplication_Max","value": "13"} +]} +, {"enumname": "vr::EVRFirmwareError","values": [ + {"name": "VRFirmwareError_None","value": "0"} + ,{"name": "VRFirmwareError_Success","value": "1"} + ,{"name": "VRFirmwareError_Fail","value": "2"} +]} +, {"enumname": "vr::EVRNotificationError","values": [ + {"name": "VRNotificationError_OK","value": "0"} + ,{"name": "VRNotificationError_InvalidNotificationId","value": "100"} + ,{"name": "VRNotificationError_NotificationQueueFull","value": "101"} + ,{"name": "VRNotificationError_InvalidOverlayHandle","value": "102"} + ,{"name": "VRNotificationError_SystemWithUserValueAlreadyExists","value": "103"} +]} +, {"enumname": "vr::EVRSkeletalMotionRange","values": [ + {"name": "VRSkeletalMotionRange_WithController","value": "0"} + ,{"name": "VRSkeletalMotionRange_WithoutController","value": "1"} +]} +, {"enumname": "vr::EVRSkeletalTrackingLevel","values": [ + {"name": "VRSkeletalTracking_Estimated","value": "0"} + ,{"name": "VRSkeletalTracking_Partial","value": "1"} + ,{"name": "VRSkeletalTracking_Full","value": "2"} + ,{"name": "VRSkeletalTrackingLevel_Count","value": "3"} + ,{"name": "VRSkeletalTrackingLevel_Max","value": "2"} +]} +, {"enumname": "vr::EVRInitError","values": [ + {"name": "VRInitError_None","value": "0"} + ,{"name": "VRInitError_Unknown","value": "1"} + ,{"name": "VRInitError_Init_InstallationNotFound","value": "100"} + ,{"name": "VRInitError_Init_InstallationCorrupt","value": "101"} + ,{"name": "VRInitError_Init_VRClientDLLNotFound","value": "102"} + ,{"name": "VRInitError_Init_FileNotFound","value": "103"} + ,{"name": "VRInitError_Init_FactoryNotFound","value": "104"} + ,{"name": "VRInitError_Init_InterfaceNotFound","value": "105"} + ,{"name": "VRInitError_Init_InvalidInterface","value": "106"} + ,{"name": "VRInitError_Init_UserConfigDirectoryInvalid","value": "107"} + ,{"name": "VRInitError_Init_HmdNotFound","value": "108"} + ,{"name": "VRInitError_Init_NotInitialized","value": "109"} + ,{"name": "VRInitError_Init_PathRegistryNotFound","value": "110"} + ,{"name": "VRInitError_Init_NoConfigPath","value": "111"} + ,{"name": "VRInitError_Init_NoLogPath","value": "112"} + ,{"name": "VRInitError_Init_PathRegistryNotWritable","value": "113"} + ,{"name": "VRInitError_Init_AppInfoInitFailed","value": "114"} + ,{"name": "VRInitError_Init_Retry","value": "115"} + ,{"name": "VRInitError_Init_InitCanceledByUser","value": "116"} + ,{"name": "VRInitError_Init_AnotherAppLaunching","value": "117"} + ,{"name": "VRInitError_Init_SettingsInitFailed","value": "118"} + ,{"name": "VRInitError_Init_ShuttingDown","value": "119"} + ,{"name": "VRInitError_Init_TooManyObjects","value": "120"} + ,{"name": "VRInitError_Init_NoServerForBackgroundApp","value": "121"} + ,{"name": "VRInitError_Init_NotSupportedWithCompositor","value": "122"} + ,{"name": "VRInitError_Init_NotAvailableToUtilityApps","value": "123"} + ,{"name": "VRInitError_Init_Internal","value": "124"} + ,{"name": "VRInitError_Init_HmdDriverIdIsNone","value": "125"} + ,{"name": "VRInitError_Init_HmdNotFoundPresenceFailed","value": "126"} + ,{"name": "VRInitError_Init_VRMonitorNotFound","value": "127"} + ,{"name": "VRInitError_Init_VRMonitorStartupFailed","value": "128"} + ,{"name": "VRInitError_Init_LowPowerWatchdogNotSupported","value": "129"} + ,{"name": "VRInitError_Init_InvalidApplicationType","value": "130"} + ,{"name": "VRInitError_Init_NotAvailableToWatchdogApps","value": "131"} + ,{"name": "VRInitError_Init_WatchdogDisabledInSettings","value": "132"} + ,{"name": "VRInitError_Init_VRDashboardNotFound","value": "133"} + ,{"name": "VRInitError_Init_VRDashboardStartupFailed","value": "134"} + ,{"name": "VRInitError_Init_VRHomeNotFound","value": "135"} + ,{"name": "VRInitError_Init_VRHomeStartupFailed","value": "136"} + ,{"name": "VRInitError_Init_RebootingBusy","value": "137"} + ,{"name": "VRInitError_Init_FirmwareUpdateBusy","value": "138"} + ,{"name": "VRInitError_Init_FirmwareRecoveryBusy","value": "139"} + ,{"name": "VRInitError_Init_USBServiceBusy","value": "140"} + ,{"name": "VRInitError_Init_VRWebHelperStartupFailed","value": "141"} + ,{"name": "VRInitError_Init_TrackerManagerInitFailed","value": "142"} + ,{"name": "VRInitError_Init_AlreadyRunning","value": "143"} + ,{"name": "VRInitError_Init_FailedForVrMonitor","value": "144"} + ,{"name": "VRInitError_Init_PropertyManagerInitFailed","value": "145"} + ,{"name": "VRInitError_Init_WebServerFailed","value": "146"} + ,{"name": "VRInitError_Init_IllegalTypeTransition","value": "147"} + ,{"name": "VRInitError_Init_MismatchedRuntimes","value": "148"} + ,{"name": "VRInitError_Init_InvalidProcessId","value": "149"} + ,{"name": "VRInitError_Init_VRServiceStartupFailed","value": "150"} + ,{"name": "VRInitError_Init_PrismNeedsNewDrivers","value": "151"} + ,{"name": "VRInitError_Init_PrismStartupTimedOut","value": "152"} + ,{"name": "VRInitError_Init_CouldNotStartPrism","value": "153"} + ,{"name": "VRInitError_Init_CreateDriverDirectDeviceFailed","value": "154"} + ,{"name": "VRInitError_Init_PrismExitedUnexpectedly","value": "155"} + ,{"name": "VRInitError_Driver_Failed","value": "200"} + ,{"name": "VRInitError_Driver_Unknown","value": "201"} + ,{"name": "VRInitError_Driver_HmdUnknown","value": "202"} + ,{"name": "VRInitError_Driver_NotLoaded","value": "203"} + ,{"name": "VRInitError_Driver_RuntimeOutOfDate","value": "204"} + ,{"name": "VRInitError_Driver_HmdInUse","value": "205"} + ,{"name": "VRInitError_Driver_NotCalibrated","value": "206"} + ,{"name": "VRInitError_Driver_CalibrationInvalid","value": "207"} + ,{"name": "VRInitError_Driver_HmdDisplayNotFound","value": "208"} + ,{"name": "VRInitError_Driver_TrackedDeviceInterfaceUnknown","value": "209"} + ,{"name": "VRInitError_Driver_HmdDriverIdOutOfBounds","value": "211"} + ,{"name": "VRInitError_Driver_HmdDisplayMirrored","value": "212"} + ,{"name": "VRInitError_Driver_HmdDisplayNotFoundLaptop","value": "213"} + ,{"name": "VRInitError_IPC_ServerInitFailed","value": "300"} + ,{"name": "VRInitError_IPC_ConnectFailed","value": "301"} + ,{"name": "VRInitError_IPC_SharedStateInitFailed","value": "302"} + ,{"name": "VRInitError_IPC_CompositorInitFailed","value": "303"} + ,{"name": "VRInitError_IPC_MutexInitFailed","value": "304"} + ,{"name": "VRInitError_IPC_Failed","value": "305"} + ,{"name": "VRInitError_IPC_CompositorConnectFailed","value": "306"} + ,{"name": "VRInitError_IPC_CompositorInvalidConnectResponse","value": "307"} + ,{"name": "VRInitError_IPC_ConnectFailedAfterMultipleAttempts","value": "308"} + ,{"name": "VRInitError_IPC_ConnectFailedAfterTargetExited","value": "309"} + ,{"name": "VRInitError_IPC_NamespaceUnavailable","value": "310"} + ,{"name": "VRInitError_Compositor_Failed","value": "400"} + ,{"name": "VRInitError_Compositor_D3D11HardwareRequired","value": "401"} + ,{"name": "VRInitError_Compositor_FirmwareRequiresUpdate","value": "402"} + ,{"name": "VRInitError_Compositor_OverlayInitFailed","value": "403"} + ,{"name": "VRInitError_Compositor_ScreenshotsInitFailed","value": "404"} + ,{"name": "VRInitError_Compositor_UnableToCreateDevice","value": "405"} + ,{"name": "VRInitError_Compositor_SharedStateIsNull","value": "406"} + ,{"name": "VRInitError_Compositor_NotificationManagerIsNull","value": "407"} + ,{"name": "VRInitError_Compositor_ResourceManagerClientIsNull","value": "408"} + ,{"name": "VRInitError_Compositor_MessageOverlaySharedStateInitFailure","value": "409"} + ,{"name": "VRInitError_Compositor_PropertiesInterfaceIsNull","value": "410"} + ,{"name": "VRInitError_Compositor_CreateFullscreenWindowFailed","value": "411"} + ,{"name": "VRInitError_Compositor_SettingsInterfaceIsNull","value": "412"} + ,{"name": "VRInitError_Compositor_FailedToShowWindow","value": "413"} + ,{"name": "VRInitError_Compositor_DistortInterfaceIsNull","value": "414"} + ,{"name": "VRInitError_Compositor_DisplayFrequencyFailure","value": "415"} + ,{"name": "VRInitError_Compositor_RendererInitializationFailed","value": "416"} + ,{"name": "VRInitError_Compositor_DXGIFactoryInterfaceIsNull","value": "417"} + ,{"name": "VRInitError_Compositor_DXGIFactoryCreateFailed","value": "418"} + ,{"name": "VRInitError_Compositor_DXGIFactoryQueryFailed","value": "419"} + ,{"name": "VRInitError_Compositor_InvalidAdapterDesktop","value": "420"} + ,{"name": "VRInitError_Compositor_InvalidHmdAttachment","value": "421"} + ,{"name": "VRInitError_Compositor_InvalidOutputDesktop","value": "422"} + ,{"name": "VRInitError_Compositor_InvalidDeviceProvided","value": "423"} + ,{"name": "VRInitError_Compositor_D3D11RendererInitializationFailed","value": "424"} + ,{"name": "VRInitError_Compositor_FailedToFindDisplayMode","value": "425"} + ,{"name": "VRInitError_Compositor_FailedToCreateSwapChain","value": "426"} + ,{"name": "VRInitError_Compositor_FailedToGetBackBuffer","value": "427"} + ,{"name": "VRInitError_Compositor_FailedToCreateRenderTarget","value": "428"} + ,{"name": "VRInitError_Compositor_FailedToCreateDXGI2SwapChain","value": "429"} + ,{"name": "VRInitError_Compositor_FailedtoGetDXGI2BackBuffer","value": "430"} + ,{"name": "VRInitError_Compositor_FailedToCreateDXGI2RenderTarget","value": "431"} + ,{"name": "VRInitError_Compositor_FailedToGetDXGIDeviceInterface","value": "432"} + ,{"name": "VRInitError_Compositor_SelectDisplayMode","value": "433"} + ,{"name": "VRInitError_Compositor_FailedToCreateNvAPIRenderTargets","value": "434"} + ,{"name": "VRInitError_Compositor_NvAPISetDisplayMode","value": "435"} + ,{"name": "VRInitError_Compositor_FailedToCreateDirectModeDisplay","value": "436"} + ,{"name": "VRInitError_Compositor_InvalidHmdPropertyContainer","value": "437"} + ,{"name": "VRInitError_Compositor_UpdateDisplayFrequency","value": "438"} + ,{"name": "VRInitError_Compositor_CreateRasterizerState","value": "439"} + ,{"name": "VRInitError_Compositor_CreateWireframeRasterizerState","value": "440"} + ,{"name": "VRInitError_Compositor_CreateSamplerState","value": "441"} + ,{"name": "VRInitError_Compositor_CreateClampToBorderSamplerState","value": "442"} + ,{"name": "VRInitError_Compositor_CreateAnisoSamplerState","value": "443"} + ,{"name": "VRInitError_Compositor_CreateOverlaySamplerState","value": "444"} + ,{"name": "VRInitError_Compositor_CreatePanoramaSamplerState","value": "445"} + ,{"name": "VRInitError_Compositor_CreateFontSamplerState","value": "446"} + ,{"name": "VRInitError_Compositor_CreateNoBlendState","value": "447"} + ,{"name": "VRInitError_Compositor_CreateBlendState","value": "448"} + ,{"name": "VRInitError_Compositor_CreateAlphaBlendState","value": "449"} + ,{"name": "VRInitError_Compositor_CreateBlendStateMaskR","value": "450"} + ,{"name": "VRInitError_Compositor_CreateBlendStateMaskG","value": "451"} + ,{"name": "VRInitError_Compositor_CreateBlendStateMaskB","value": "452"} + ,{"name": "VRInitError_Compositor_CreateDepthStencilState","value": "453"} + ,{"name": "VRInitError_Compositor_CreateDepthStencilStateNoWrite","value": "454"} + ,{"name": "VRInitError_Compositor_CreateDepthStencilStateNoDepth","value": "455"} + ,{"name": "VRInitError_Compositor_CreateFlushTexture","value": "456"} + ,{"name": "VRInitError_Compositor_CreateDistortionSurfaces","value": "457"} + ,{"name": "VRInitError_Compositor_CreateConstantBuffer","value": "458"} + ,{"name": "VRInitError_Compositor_CreateHmdPoseConstantBuffer","value": "459"} + ,{"name": "VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer","value": "460"} + ,{"name": "VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer","value": "461"} + ,{"name": "VRInitError_Compositor_CreateOverlayConstantBuffer","value": "462"} + ,{"name": "VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer","value": "463"} + ,{"name": "VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer","value": "464"} + ,{"name": "VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer","value": "465"} + ,{"name": "VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer","value": "466"} + ,{"name": "VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer","value": "467"} + ,{"name": "VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer","value": "468"} + ,{"name": "VRInitError_Compositor_CreateGeomConstantBuffer","value": "469"} + ,{"name": "VRInitError_Compositor_CreatePanelMaskConstantBuffer","value": "470"} + ,{"name": "VRInitError_Compositor_CreatePixelSimUBO","value": "471"} + ,{"name": "VRInitError_Compositor_CreateMSAARenderTextures","value": "472"} + ,{"name": "VRInitError_Compositor_CreateResolveRenderTextures","value": "473"} + ,{"name": "VRInitError_Compositor_CreateComputeResolveRenderTextures","value": "474"} + ,{"name": "VRInitError_Compositor_CreateDriverDirectModeResolveTextures","value": "475"} + ,{"name": "VRInitError_Compositor_OpenDriverDirectModeResolveTextures","value": "476"} + ,{"name": "VRInitError_Compositor_CreateFallbackSyncTexture","value": "477"} + ,{"name": "VRInitError_Compositor_ShareFallbackSyncTexture","value": "478"} + ,{"name": "VRInitError_Compositor_CreateOverlayIndexBuffer","value": "479"} + ,{"name": "VRInitError_Compositor_CreateOverlayVertexBuffer","value": "480"} + ,{"name": "VRInitError_Compositor_CreateTextVertexBuffer","value": "481"} + ,{"name": "VRInitError_Compositor_CreateTextIndexBuffer","value": "482"} + ,{"name": "VRInitError_Compositor_CreateMirrorTextures","value": "483"} + ,{"name": "VRInitError_Compositor_CreateLastFrameRenderTexture","value": "484"} + ,{"name": "VRInitError_Compositor_CreateMirrorOverlay","value": "485"} + ,{"name": "VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer","value": "486"} + ,{"name": "VRInitError_Compositor_DisplayModeNotSupported","value": "487"} + ,{"name": "VRInitError_Compositor_CreateOverlayInvalidCall","value": "488"} + ,{"name": "VRInitError_Compositor_CreateOverlayAlreadyInitialized","value": "489"} + ,{"name": "VRInitError_Compositor_FailedToCreateMailbox","value": "490"} + ,{"name": "VRInitError_Compositor_WindowInterfaceIsNull","value": "491"} + ,{"name": "VRInitError_Compositor_SystemLayerCreateInstance","value": "492"} + ,{"name": "VRInitError_Compositor_SystemLayerCreateSession","value": "493"} + ,{"name": "VRInitError_VendorSpecific_UnableToConnectToOculusRuntime","value": "1000"} + ,{"name": "VRInitError_VendorSpecific_WindowsNotInDevMode","value": "1001"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_CantOpenDevice","value": "1101"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart","value": "1102"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_NoStoredConfig","value": "1103"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_ConfigTooBig","value": "1104"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_ConfigTooSmall","value": "1105"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToInitZLib","value": "1106"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion","value": "1107"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart","value": "1108"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart","value": "1109"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext","value": "1110"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UserDataAddressRange","value": "1111"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_UserDataError","value": "1112"} + ,{"name": "VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck","value": "1113"} + ,{"name": "VRInitError_VendorSpecific_OculusRuntimeBadInstall","value": "1114"} + ,{"name": "VRInitError_Steam_SteamInstallationNotFound","value": "2000"} + ,{"name": "VRInitError_LastError","value": "2001"} +]} +, {"enumname": "vr::EVRScreenshotType","values": [ + {"name": "VRScreenshotType_None","value": "0"} + ,{"name": "VRScreenshotType_Mono","value": "1"} + ,{"name": "VRScreenshotType_Stereo","value": "2"} + ,{"name": "VRScreenshotType_Cubemap","value": "3"} + ,{"name": "VRScreenshotType_MonoPanorama","value": "4"} + ,{"name": "VRScreenshotType_StereoPanorama","value": "5"} +]} +, {"enumname": "vr::EVRScreenshotPropertyFilenames","values": [ + {"name": "VRScreenshotPropertyFilenames_Preview","value": "0"} + ,{"name": "VRScreenshotPropertyFilenames_VR","value": "1"} +]} +, {"enumname": "vr::EVRTrackedCameraError","values": [ + {"name": "VRTrackedCameraError_None","value": "0"} + ,{"name": "VRTrackedCameraError_OperationFailed","value": "100"} + ,{"name": "VRTrackedCameraError_InvalidHandle","value": "101"} + ,{"name": "VRTrackedCameraError_InvalidFrameHeaderVersion","value": "102"} + ,{"name": "VRTrackedCameraError_OutOfHandles","value": "103"} + ,{"name": "VRTrackedCameraError_IPCFailure","value": "104"} + ,{"name": "VRTrackedCameraError_NotSupportedForThisDevice","value": "105"} + ,{"name": "VRTrackedCameraError_SharedMemoryFailure","value": "106"} + ,{"name": "VRTrackedCameraError_FrameBufferingFailure","value": "107"} + ,{"name": "VRTrackedCameraError_StreamSetupFailure","value": "108"} + ,{"name": "VRTrackedCameraError_InvalidGLTextureId","value": "109"} + ,{"name": "VRTrackedCameraError_InvalidSharedTextureHandle","value": "110"} + ,{"name": "VRTrackedCameraError_FailedToGetGLTextureId","value": "111"} + ,{"name": "VRTrackedCameraError_SharedTextureFailure","value": "112"} + ,{"name": "VRTrackedCameraError_NoFrameAvailable","value": "113"} + ,{"name": "VRTrackedCameraError_InvalidArgument","value": "114"} + ,{"name": "VRTrackedCameraError_InvalidFrameBufferSize","value": "115"} +]} +, {"enumname": "vr::EVRTrackedCameraFrameLayout","values": [ + {"name": "EVRTrackedCameraFrameLayout_Mono","value": "1"} + ,{"name": "EVRTrackedCameraFrameLayout_Stereo","value": "2"} + ,{"name": "EVRTrackedCameraFrameLayout_VerticalLayout","value": "16"} + ,{"name": "EVRTrackedCameraFrameLayout_HorizontalLayout","value": "32"} +]} +, {"enumname": "vr::EVRTrackedCameraFrameType","values": [ + {"name": "VRTrackedCameraFrameType_Distorted","value": "0"} + ,{"name": "VRTrackedCameraFrameType_Undistorted","value": "1"} + ,{"name": "VRTrackedCameraFrameType_MaximumUndistorted","value": "2"} + ,{"name": "MAX_CAMERA_FRAME_TYPES","value": "3"} +]} +, {"enumname": "vr::EVRDistortionFunctionType","values": [ + {"name": "VRDistortionFunctionType_None","value": "0"} + ,{"name": "VRDistortionFunctionType_FTheta","value": "1"} + ,{"name": "VRDistortionFunctionType_Extended_FTheta","value": "2"} + ,{"name": "MAX_DISTORTION_FUNCTION_TYPES","value": "3"} +]} +, {"enumname": "vr::EVSync","values": [ + {"name": "VSync_None","value": "0"} + ,{"name": "VSync_WaitRender","value": "1"} + ,{"name": "VSync_NoWaitRender","value": "2"} +]} +, {"enumname": "vr::EVRMuraCorrectionMode","values": [ + {"name": "EVRMuraCorrectionMode_Default","value": "0"} + ,{"name": "EVRMuraCorrectionMode_NoCorrection","value": "1"} +]} +, {"enumname": "vr::Imu_OffScaleFlags","values": [ + {"name": "OffScale_AccelX","value": "1"} + ,{"name": "OffScale_AccelY","value": "2"} + ,{"name": "OffScale_AccelZ","value": "4"} + ,{"name": "OffScale_GyroX","value": "8"} + ,{"name": "OffScale_GyroY","value": "16"} + ,{"name": "OffScale_GyroZ","value": "32"} +]} +, {"enumname": "vr::EVRApplicationError","values": [ + {"name": "VRApplicationError_None","value": "0"} + ,{"name": "VRApplicationError_AppKeyAlreadyExists","value": "100"} + ,{"name": "VRApplicationError_NoManifest","value": "101"} + ,{"name": "VRApplicationError_NoApplication","value": "102"} + ,{"name": "VRApplicationError_InvalidIndex","value": "103"} + ,{"name": "VRApplicationError_UnknownApplication","value": "104"} + ,{"name": "VRApplicationError_IPCFailed","value": "105"} + ,{"name": "VRApplicationError_ApplicationAlreadyRunning","value": "106"} + ,{"name": "VRApplicationError_InvalidManifest","value": "107"} + ,{"name": "VRApplicationError_InvalidApplication","value": "108"} + ,{"name": "VRApplicationError_LaunchFailed","value": "109"} + ,{"name": "VRApplicationError_ApplicationAlreadyStarting","value": "110"} + ,{"name": "VRApplicationError_LaunchInProgress","value": "111"} + ,{"name": "VRApplicationError_OldApplicationQuitting","value": "112"} + ,{"name": "VRApplicationError_TransitionAborted","value": "113"} + ,{"name": "VRApplicationError_IsTemplate","value": "114"} + ,{"name": "VRApplicationError_SteamVRIsExiting","value": "115"} + ,{"name": "VRApplicationError_BufferTooSmall","value": "200"} + ,{"name": "VRApplicationError_PropertyNotSet","value": "201"} + ,{"name": "VRApplicationError_UnknownProperty","value": "202"} + ,{"name": "VRApplicationError_InvalidParameter","value": "203"} + ,{"name": "VRApplicationError_NotImplemented","value": "300"} +]} +, {"enumname": "vr::EVRApplicationProperty","values": [ + {"name": "VRApplicationProperty_Name_String","value": "0"} + ,{"name": "VRApplicationProperty_LaunchType_String","value": "11"} + ,{"name": "VRApplicationProperty_WorkingDirectory_String","value": "12"} + ,{"name": "VRApplicationProperty_BinaryPath_String","value": "13"} + ,{"name": "VRApplicationProperty_Arguments_String","value": "14"} + ,{"name": "VRApplicationProperty_URL_String","value": "15"} + ,{"name": "VRApplicationProperty_Description_String","value": "50"} + ,{"name": "VRApplicationProperty_NewsURL_String","value": "51"} + ,{"name": "VRApplicationProperty_ImagePath_String","value": "52"} + ,{"name": "VRApplicationProperty_Source_String","value": "53"} + ,{"name": "VRApplicationProperty_ActionManifestURL_String","value": "54"} + ,{"name": "VRApplicationProperty_IsDashboardOverlay_Bool","value": "60"} + ,{"name": "VRApplicationProperty_IsTemplate_Bool","value": "61"} + ,{"name": "VRApplicationProperty_IsInstanced_Bool","value": "62"} + ,{"name": "VRApplicationProperty_IsInternal_Bool","value": "63"} + ,{"name": "VRApplicationProperty_WantsCompositorPauseInStandby_Bool","value": "64"} + ,{"name": "VRApplicationProperty_IsHidden_Bool","value": "65"} + ,{"name": "VRApplicationProperty_LastLaunchTime_Uint64","value": "70"} +]} +, {"enumname": "vr::EVRSceneApplicationState","values": [ + {"name": "EVRSceneApplicationState_None","value": "0"} + ,{"name": "EVRSceneApplicationState_Starting","value": "1"} + ,{"name": "EVRSceneApplicationState_Quitting","value": "2"} + ,{"name": "EVRSceneApplicationState_Running","value": "3"} + ,{"name": "EVRSceneApplicationState_Waiting","value": "4"} +]} +, {"enumname": "vr::ChaperoneCalibrationState","values": [ + {"name": "ChaperoneCalibrationState_OK","value": "1"} + ,{"name": "ChaperoneCalibrationState_Warning","value": "100"} + ,{"name": "ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved","value": "101"} + ,{"name": "ChaperoneCalibrationState_Warning_BaseStationRemoved","value": "102"} + ,{"name": "ChaperoneCalibrationState_Warning_SeatedBoundsInvalid","value": "103"} + ,{"name": "ChaperoneCalibrationState_Error","value": "200"} + ,{"name": "ChaperoneCalibrationState_Error_BaseStationUninitialized","value": "201"} + ,{"name": "ChaperoneCalibrationState_Error_BaseStationConflict","value": "202"} + ,{"name": "ChaperoneCalibrationState_Error_PlayAreaInvalid","value": "203"} + ,{"name": "ChaperoneCalibrationState_Error_CollisionBoundsInvalid","value": "204"} +]} +, {"enumname": "vr::EChaperoneConfigFile","values": [ + {"name": "EChaperoneConfigFile_Live","value": "1"} + ,{"name": "EChaperoneConfigFile_Temp","value": "2"} +]} +, {"enumname": "vr::EChaperoneImportFlags","values": [ + {"name": "EChaperoneImport_BoundsOnly","value": "1"} +]} +, {"enumname": "vr::EVRCompositorError","values": [ + {"name": "VRCompositorError_None","value": "0"} + ,{"name": "VRCompositorError_RequestFailed","value": "1"} + ,{"name": "VRCompositorError_IncompatibleVersion","value": "100"} + ,{"name": "VRCompositorError_DoNotHaveFocus","value": "101"} + ,{"name": "VRCompositorError_InvalidTexture","value": "102"} + ,{"name": "VRCompositorError_IsNotSceneApplication","value": "103"} + ,{"name": "VRCompositorError_TextureIsOnWrongDevice","value": "104"} + ,{"name": "VRCompositorError_TextureUsesUnsupportedFormat","value": "105"} + ,{"name": "VRCompositorError_SharedTexturesNotSupported","value": "106"} + ,{"name": "VRCompositorError_IndexOutOfRange","value": "107"} + ,{"name": "VRCompositorError_AlreadySubmitted","value": "108"} + ,{"name": "VRCompositorError_InvalidBounds","value": "109"} + ,{"name": "VRCompositorError_AlreadySet","value": "110"} +]} +, {"enumname": "vr::EVRCompositorTimingMode","values": [ + {"name": "VRCompositorTimingMode_Implicit","value": "0"} + ,{"name": "VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff","value": "1"} + ,{"name": "VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff","value": "2"} +]} +, {"enumname": "vr::VROverlayInputMethod","values": [ + {"name": "VROverlayInputMethod_None","value": "0"} + ,{"name": "VROverlayInputMethod_Mouse","value": "1"} +]} +, {"enumname": "vr::VROverlayTransformType","values": [ + {"name": "VROverlayTransform_Invalid","value": "-1"} + ,{"name": "VROverlayTransform_Absolute","value": "0"} + ,{"name": "VROverlayTransform_TrackedDeviceRelative","value": "1"} + ,{"name": "VROverlayTransform_SystemOverlay","value": "2"} + ,{"name": "VROverlayTransform_TrackedComponent","value": "3"} + ,{"name": "VROverlayTransform_Cursor","value": "4"} + ,{"name": "VROverlayTransform_DashboardTab","value": "5"} + ,{"name": "VROverlayTransform_DashboardThumb","value": "6"} + ,{"name": "VROverlayTransform_Mountable","value": "7"} + ,{"name": "VROverlayTransform_Projection","value": "8"} +]} +, {"enumname": "vr::VROverlayFlags","values": [ + {"name": "VROverlayFlags_NoDashboardTab","value": "8"} + ,{"name": "VROverlayFlags_SendVRDiscreteScrollEvents","value": "64"} + ,{"name": "VROverlayFlags_SendVRTouchpadEvents","value": "128"} + ,{"name": "VROverlayFlags_ShowTouchPadScrollWheel","value": "256"} + ,{"name": "VROverlayFlags_TransferOwnershipToInternalProcess","value": "512"} + ,{"name": "VROverlayFlags_SideBySide_Parallel","value": "1024"} + ,{"name": "VROverlayFlags_SideBySide_Crossed","value": "2048"} + ,{"name": "VROverlayFlags_Panorama","value": "4096"} + ,{"name": "VROverlayFlags_StereoPanorama","value": "8192"} + ,{"name": "VROverlayFlags_SortWithNonSceneOverlays","value": "16384"} + ,{"name": "VROverlayFlags_VisibleInDashboard","value": "32768"} + ,{"name": "VROverlayFlags_MakeOverlaysInteractiveIfVisible","value": "65536"} + ,{"name": "VROverlayFlags_SendVRSmoothScrollEvents","value": "131072"} + ,{"name": "VROverlayFlags_ProtectedContent","value": "262144"} + ,{"name": "VROverlayFlags_HideLaserIntersection","value": "524288"} + ,{"name": "VROverlayFlags_WantsModalBehavior","value": "1048576"} + ,{"name": "VROverlayFlags_IsPremultiplied","value": "2097152"} +]} +, {"enumname": "vr::VRMessageOverlayResponse","values": [ + {"name": "VRMessageOverlayResponse_ButtonPress_0","value": "0"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_1","value": "1"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_2","value": "2"} + ,{"name": "VRMessageOverlayResponse_ButtonPress_3","value": "3"} + ,{"name": "VRMessageOverlayResponse_CouldntFindSystemOverlay","value": "4"} + ,{"name": "VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay","value": "5"} + ,{"name": "VRMessageOverlayResponse_ApplicationQuit","value": "6"} +]} +, {"enumname": "vr::EGamepadTextInputMode","values": [ + {"name": "k_EGamepadTextInputModeNormal","value": "0"} + ,{"name": "k_EGamepadTextInputModePassword","value": "1"} + ,{"name": "k_EGamepadTextInputModeSubmit","value": "2"} +]} +, {"enumname": "vr::EGamepadTextInputLineMode","values": [ + {"name": "k_EGamepadTextInputLineModeSingleLine","value": "0"} + ,{"name": "k_EGamepadTextInputLineModeMultipleLines","value": "1"} +]} +, {"enumname": "vr::EVROverlayIntersectionMaskPrimitiveType","values": [ + {"name": "OverlayIntersectionPrimitiveType_Rectangle","value": "0"} + ,{"name": "OverlayIntersectionPrimitiveType_Circle","value": "1"} +]} +, {"enumname": "vr::EKeyboardFlags","values": [ + {"name": "KeyboardFlag_Minimal","value": "1"} + ,{"name": "KeyboardFlag_Modal","value": "2"} +]} +, {"enumname": "vr::EDeviceType","values": [ + {"name": "DeviceType_Invalid","value": "-1"} + ,{"name": "DeviceType_DirectX11","value": "0"} + ,{"name": "DeviceType_Vulkan","value": "1"} +]} +, {"enumname": "vr::HeadsetViewMode_t","values": [ + {"name": "HeadsetViewMode_Left","value": "0"} + ,{"name": "HeadsetViewMode_Right","value": "1"} + ,{"name": "HeadsetViewMode_Both","value": "2"} +]} +, {"enumname": "vr::EVRRenderModelError","values": [ + {"name": "VRRenderModelError_None","value": "0"} + ,{"name": "VRRenderModelError_Loading","value": "100"} + ,{"name": "VRRenderModelError_NotSupported","value": "200"} + ,{"name": "VRRenderModelError_InvalidArg","value": "300"} + ,{"name": "VRRenderModelError_InvalidModel","value": "301"} + ,{"name": "VRRenderModelError_NoShapes","value": "302"} + ,{"name": "VRRenderModelError_MultipleShapes","value": "303"} + ,{"name": "VRRenderModelError_TooManyVertices","value": "304"} + ,{"name": "VRRenderModelError_MultipleTextures","value": "305"} + ,{"name": "VRRenderModelError_BufferTooSmall","value": "306"} + ,{"name": "VRRenderModelError_NotEnoughNormals","value": "307"} + ,{"name": "VRRenderModelError_NotEnoughTexCoords","value": "308"} + ,{"name": "VRRenderModelError_InvalidTexture","value": "400"} +]} +, {"enumname": "vr::EVRRenderModelTextureFormat","values": [ + {"name": "VRRenderModelTextureFormat_RGBA8_SRGB","value": "0"} + ,{"name": "VRRenderModelTextureFormat_BC2","value": "1"} + ,{"name": "VRRenderModelTextureFormat_BC4","value": "2"} + ,{"name": "VRRenderModelTextureFormat_BC7","value": "3"} + ,{"name": "VRRenderModelTextureFormat_BC7_SRGB","value": "4"} +]} +, {"enumname": "vr::EVRNotificationType","values": [ + {"name": "EVRNotificationType_Transient","value": "0"} + ,{"name": "EVRNotificationType_Persistent","value": "1"} + ,{"name": "EVRNotificationType_Transient_SystemWithUserValue","value": "2"} +]} +, {"enumname": "vr::EVRNotificationStyle","values": [ + {"name": "EVRNotificationStyle_None","value": "0"} + ,{"name": "EVRNotificationStyle_Application","value": "100"} + ,{"name": "EVRNotificationStyle_Contact_Disabled","value": "200"} + ,{"name": "EVRNotificationStyle_Contact_Enabled","value": "201"} + ,{"name": "EVRNotificationStyle_Contact_Active","value": "202"} +]} +, {"enumname": "vr::EVRSettingsError","values": [ + {"name": "VRSettingsError_None","value": "0"} + ,{"name": "VRSettingsError_IPCFailed","value": "1"} + ,{"name": "VRSettingsError_WriteFailed","value": "2"} + ,{"name": "VRSettingsError_ReadFailed","value": "3"} + ,{"name": "VRSettingsError_JsonParseFailed","value": "4"} + ,{"name": "VRSettingsError_UnsetSettingHasNoDefault","value": "5"} +]} +, {"enumname": "vr::EVRScreenshotError","values": [ + {"name": "VRScreenshotError_None","value": "0"} + ,{"name": "VRScreenshotError_RequestFailed","value": "1"} + ,{"name": "VRScreenshotError_IncompatibleVersion","value": "100"} + ,{"name": "VRScreenshotError_NotFound","value": "101"} + ,{"name": "VRScreenshotError_BufferTooSmall","value": "102"} + ,{"name": "VRScreenshotError_ScreenshotAlreadyInProgress","value": "108"} +]} +, {"enumname": "vr::EVRSkeletalTransformSpace","values": [ + {"name": "VRSkeletalTransformSpace_Model","value": "0"} + ,{"name": "VRSkeletalTransformSpace_Parent","value": "1"} +]} +, {"enumname": "vr::EVRSkeletalReferencePose","values": [ + {"name": "VRSkeletalReferencePose_BindPose","value": "0"} + ,{"name": "VRSkeletalReferencePose_OpenHand","value": "1"} + ,{"name": "VRSkeletalReferencePose_Fist","value": "2"} + ,{"name": "VRSkeletalReferencePose_GripLimit","value": "3"} +]} +, {"enumname": "vr::EVRFinger","values": [ + {"name": "VRFinger_Thumb","value": "0"} + ,{"name": "VRFinger_Index","value": "1"} + ,{"name": "VRFinger_Middle","value": "2"} + ,{"name": "VRFinger_Ring","value": "3"} + ,{"name": "VRFinger_Pinky","value": "4"} + ,{"name": "VRFinger_Count","value": "5"} +]} +, {"enumname": "vr::EVRFingerSplay","values": [ + {"name": "VRFingerSplay_Thumb_Index","value": "0"} + ,{"name": "VRFingerSplay_Index_Middle","value": "1"} + ,{"name": "VRFingerSplay_Middle_Ring","value": "2"} + ,{"name": "VRFingerSplay_Ring_Pinky","value": "3"} + ,{"name": "VRFingerSplay_Count","value": "4"} +]} +, {"enumname": "vr::EVRSummaryType","values": [ + {"name": "VRSummaryType_FromAnimation","value": "0"} + ,{"name": "VRSummaryType_FromDevice","value": "1"} +]} +, {"enumname": "vr::EVRInputFilterCancelType","values": [ + {"name": "VRInputFilterCancel_Timers","value": "0"} + ,{"name": "VRInputFilterCancel_Momentum","value": "1"} +]} +, {"enumname": "vr::EVRInputStringBits","values": [ + {"name": "VRInputString_Hand","value": "1"} + ,{"name": "VRInputString_ControllerType","value": "2"} + ,{"name": "VRInputString_InputSource","value": "4"} + ,{"name": "VRInputString_All","value": "-1"} +]} +, {"enumname": "vr::EIOBufferError","values": [ + {"name": "IOBuffer_Success","value": "0"} + ,{"name": "IOBuffer_OperationFailed","value": "100"} + ,{"name": "IOBuffer_InvalidHandle","value": "101"} + ,{"name": "IOBuffer_InvalidArgument","value": "102"} + ,{"name": "IOBuffer_PathExists","value": "103"} + ,{"name": "IOBuffer_PathDoesNotExist","value": "104"} + ,{"name": "IOBuffer_Permission","value": "105"} +]} +, {"enumname": "vr::EIOBufferMode","values": [ + {"name": "IOBufferMode_Read","value": "1"} + ,{"name": "IOBufferMode_Write","value": "2"} + ,{"name": "IOBufferMode_Create","value": "512"} +]} +, {"enumname": "vr::EVRDebugError","values": [ + {"name": "VRDebugError_Success","value": "0"} + ,{"name": "VRDebugError_BadParameter","value": "1"} +]} +, {"enumname": "vr::EPropertyWriteType","values": [ + {"name": "PropertyWrite_Set","value": "0"} + ,{"name": "PropertyWrite_Erase","value": "1"} + ,{"name": "PropertyWrite_SetError","value": "2"} +]} +, {"enumname": "vr::EBlockQueueError","values": [ + {"name": "BlockQueueError_None","value": "0"} + ,{"name": "BlockQueueError_QueueAlreadyExists","value": "1"} + ,{"name": "BlockQueueError_QueueNotFound","value": "2"} + ,{"name": "BlockQueueError_BlockNotAvailable","value": "3"} + ,{"name": "BlockQueueError_InvalidHandle","value": "4"} + ,{"name": "BlockQueueError_InvalidParam","value": "5"} + ,{"name": "BlockQueueError_ParamMismatch","value": "6"} + ,{"name": "BlockQueueError_InternalError","value": "7"} + ,{"name": "BlockQueueError_AlreadyInitialized","value": "8"} + ,{"name": "BlockQueueError_OperationIsServerOnly","value": "9"} + ,{"name": "BlockQueueError_TooManyConnections","value": "10"} +]} +, {"enumname": "vr::EBlockQueueReadType","values": [ + {"name": "BlockQueueRead_Latest","value": "0"} + ,{"name": "BlockQueueRead_New","value": "1"} + ,{"name": "BlockQueueRead_Next","value": "2"} +]} +], +"consts":[{ + "constname": "k_nDriverNone","consttype": "const uint32_t", "constval": "4294967295"} +,{ + "constname": "k_unMaxDriverDebugResponseSize","consttype": "const uint32_t", "constval": "32768"} +,{ + "constname": "k_unTrackedDeviceIndex_Hmd","consttype": "const uint32_t", "constval": "0"} +,{ + "constname": "k_unMaxTrackedDeviceCount","consttype": "const uint32_t", "constval": "64"} +,{ + "constname": "k_unTrackedDeviceIndexOther","consttype": "const uint32_t", "constval": "4294967294"} +,{ + "constname": "k_unTrackedDeviceIndexInvalid","consttype": "const uint32_t", "constval": "4294967295"} +,{ + "constname": "k_ulInvalidPropertyContainer","consttype": "const PropertyContainerHandle_t", "constval": "0"} +,{ + "constname": "k_unInvalidPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "0"} +,{ + "constname": "k_ulInvalidDriverHandle","consttype": "const PropertyContainerHandle_t", "constval": "0"} +,{ + "constname": "k_unFloatPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "1"} +,{ + "constname": "k_unInt32PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "2"} +,{ + "constname": "k_unUint64PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "3"} +,{ + "constname": "k_unBoolPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "4"} +,{ + "constname": "k_unStringPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "5"} +,{ + "constname": "k_unErrorPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "6"} +,{ + "constname": "k_unDoublePropertyTag","consttype": "const PropertyTypeTag_t", "constval": "7"} +,{ + "constname": "k_unHmdMatrix34PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "20"} +,{ + "constname": "k_unHmdMatrix44PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "21"} +,{ + "constname": "k_unHmdVector3PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "22"} +,{ + "constname": "k_unHmdVector4PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "23"} +,{ + "constname": "k_unHmdVector2PropertyTag","consttype": "const PropertyTypeTag_t", "constval": "24"} +,{ + "constname": "k_unHmdQuadPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "25"} +,{ + "constname": "k_unHiddenAreaPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "30"} +,{ + "constname": "k_unPathHandleInfoTag","consttype": "const PropertyTypeTag_t", "constval": "31"} +,{ + "constname": "k_unActionPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "32"} +,{ + "constname": "k_unInputValuePropertyTag","consttype": "const PropertyTypeTag_t", "constval": "33"} +,{ + "constname": "k_unWildcardPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "34"} +,{ + "constname": "k_unHapticVibrationPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "35"} +,{ + "constname": "k_unSkeletonPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "36"} +,{ + "constname": "k_unSpatialAnchorPosePropertyTag","consttype": "const PropertyTypeTag_t", "constval": "40"} +,{ + "constname": "k_unJsonPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "41"} +,{ + "constname": "k_unActiveActionSetPropertyTag","consttype": "const PropertyTypeTag_t", "constval": "42"} +,{ + "constname": "k_unOpenVRInternalReserved_Start","consttype": "const PropertyTypeTag_t", "constval": "1000"} +,{ + "constname": "k_unOpenVRInternalReserved_End","consttype": "const PropertyTypeTag_t", "constval": "10000"} +,{ + "constname": "k_unMaxPropertyStringSize","consttype": "const uint32_t", "constval": "32768"} +,{ + "constname": "k_ulInvalidActionHandle","consttype": "const VRActionHandle_t", "constval": "0"} +,{ + "constname": "k_ulInvalidActionSetHandle","consttype": "const VRActionSetHandle_t", "constval": "0"} +,{ + "constname": "k_ulInvalidInputValueHandle","consttype": "const VRInputValueHandle_t", "constval": "0"} +,{ + "constname": "k_unControllerStateAxisCount","consttype": "const uint32_t", "constval": "5"} +,{ + "constname": "k_ulOverlayHandleInvalid","consttype": "const VROverlayHandle_t", "constval": "0"} +,{ + "constname": "k_unMaxDistortionFunctionParameters","consttype": "const uint32_t", "constval": "8"} +,{ + "constname": "k_unScreenshotHandleInvalid","consttype": "const uint32_t", "constval": "0"} +,{ + "constname": "IVRSystem_Version","consttype": "const char *const", "constval": "IVRSystem_022"} +,{ + "constname": "IVRExtendedDisplay_Version","consttype": "const char *const", "constval": "IVRExtendedDisplay_001"} +,{ + "constname": "IVRTrackedCamera_Version","consttype": "const char *const", "constval": "IVRTrackedCamera_006"} +,{ + "constname": "k_unMaxApplicationKeyLength","consttype": "const uint32_t", "constval": "128"} +,{ + "constname": "k_pch_MimeType_HomeApp","consttype": "const char *const", "constval": "vr/home"} +,{ + "constname": "k_pch_MimeType_GameTheater","consttype": "const char *const", "constval": "vr/game_theater"} +,{ + "constname": "IVRApplications_Version","consttype": "const char *const", "constval": "IVRApplications_007"} +,{ + "constname": "IVRChaperone_Version","consttype": "const char *const", "constval": "IVRChaperone_004"} +,{ + "constname": "IVRChaperoneSetup_Version","consttype": "const char *const", "constval": "IVRChaperoneSetup_006"} +,{ + "constname": "IVRCompositor_Version","consttype": "const char *const", "constval": "IVRCompositor_027"} +,{ + "constname": "k_unVROverlayMaxKeyLength","consttype": "const uint32_t", "constval": "128"} +,{ + "constname": "k_unVROverlayMaxNameLength","consttype": "const uint32_t", "constval": "128"} +,{ + "constname": "k_unMaxOverlayCount","consttype": "const uint32_t", "constval": "128"} +,{ + "constname": "k_unMaxOverlayIntersectionMaskPrimitivesCount","consttype": "const uint32_t", "constval": "32"} +,{ + "constname": "IVROverlay_Version","consttype": "const char *const", "constval": "IVROverlay_025"} +,{ + "constname": "IVROverlayView_Version","consttype": "const char *const", "constval": "IVROverlayView_003"} +,{ + "constname": "k_unHeadsetViewMaxWidth","consttype": "const uint32_t", "constval": "3840"} +,{ + "constname": "k_unHeadsetViewMaxHeight","consttype": "const uint32_t", "constval": "2160"} +,{ + "constname": "k_pchHeadsetViewOverlayKey","consttype": "const char *const", "constval": "system.HeadsetView"} +,{ + "constname": "IVRHeadsetView_Version","consttype": "const char *const", "constval": "IVRHeadsetView_001"} +,{ + "constname": "k_pch_Controller_Component_GDC2015","consttype": "const char *const", "constval": "gdc2015"} +,{ + "constname": "k_pch_Controller_Component_Base","consttype": "const char *const", "constval": "base"} +,{ + "constname": "k_pch_Controller_Component_Tip","consttype": "const char *const", "constval": "tip"} +,{ + "constname": "k_pch_Controller_Component_HandGrip","consttype": "const char *const", "constval": "handgrip"} +,{ + "constname": "k_pch_Controller_Component_Status","consttype": "const char *const", "constval": "status"} +,{ + "constname": "IVRRenderModels_Version","consttype": "const char *const", "constval": "IVRRenderModels_006"} +,{ + "constname": "k_unNotificationTextMaxSize","consttype": "const uint32_t", "constval": "256"} +,{ + "constname": "IVRNotifications_Version","consttype": "const char *const", "constval": "IVRNotifications_002"} +,{ + "constname": "k_unMaxSettingsKeyLength","consttype": "const uint32_t", "constval": "128"} +,{ + "constname": "IVRSettings_Version","consttype": "const char *const", "constval": "IVRSettings_003"} +,{ + "constname": "k_pch_SteamVR_Section","consttype": "const char *const", "constval": "steamvr"} +,{ + "constname": "k_pch_SteamVR_RequireHmd_String","consttype": "const char *const", "constval": "requireHmd"} +,{ + "constname": "k_pch_SteamVR_ForcedDriverKey_String","consttype": "const char *const", "constval": "forcedDriver"} +,{ + "constname": "k_pch_SteamVR_ForcedHmdKey_String","consttype": "const char *const", "constval": "forcedHmd"} +,{ + "constname": "k_pch_SteamVR_DisplayDebug_Bool","consttype": "const char *const", "constval": "displayDebug"} +,{ + "constname": "k_pch_SteamVR_DebugProcessPipe_String","consttype": "const char *const", "constval": "debugProcessPipe"} +,{ + "constname": "k_pch_SteamVR_DisplayDebugX_Int32","consttype": "const char *const", "constval": "displayDebugX"} +,{ + "constname": "k_pch_SteamVR_DisplayDebugY_Int32","consttype": "const char *const", "constval": "displayDebugY"} +,{ + "constname": "k_pch_SteamVR_SendSystemButtonToAllApps_Bool","consttype": "const char *const", "constval": "sendSystemButtonToAllApps"} +,{ + "constname": "k_pch_SteamVR_LogLevel_Int32","consttype": "const char *const", "constval": "loglevel"} +,{ + "constname": "k_pch_SteamVR_IPD_Float","consttype": "const char *const", "constval": "ipd"} +,{ + "constname": "k_pch_SteamVR_Background_String","consttype": "const char *const", "constval": "background"} +,{ + "constname": "k_pch_SteamVR_BackgroundUseDomeProjection_Bool","consttype": "const char *const", "constval": "backgroundUseDomeProjection"} +,{ + "constname": "k_pch_SteamVR_BackgroundCameraHeight_Float","consttype": "const char *const", "constval": "backgroundCameraHeight"} +,{ + "constname": "k_pch_SteamVR_BackgroundDomeRadius_Float","consttype": "const char *const", "constval": "backgroundDomeRadius"} +,{ + "constname": "k_pch_SteamVR_GridColor_String","consttype": "const char *const", "constval": "gridColor"} +,{ + "constname": "k_pch_SteamVR_PlayAreaColor_String","consttype": "const char *const", "constval": "playAreaColor"} +,{ + "constname": "k_pch_SteamVR_TrackingLossColor_String","consttype": "const char *const", "constval": "trackingLossColor"} +,{ + "constname": "k_pch_SteamVR_ShowStage_Bool","consttype": "const char *const", "constval": "showStage"} +,{ + "constname": "k_pch_SteamVR_DrawTrackingReferences_Bool","consttype": "const char *const", "constval": "drawTrackingReferences"} +,{ + "constname": "k_pch_SteamVR_ActivateMultipleDrivers_Bool","consttype": "const char *const", "constval": "activateMultipleDrivers"} +,{ + "constname": "k_pch_SteamVR_UsingSpeakers_Bool","consttype": "const char *const", "constval": "usingSpeakers"} +,{ + "constname": "k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float","consttype": "const char *const", "constval": "speakersForwardYawOffsetDegrees"} +,{ + "constname": "k_pch_SteamVR_BaseStationPowerManagement_Int32","consttype": "const char *const", "constval": "basestationPowerManagement"} +,{ + "constname": "k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32","consttype": "const char *const", "constval": "ShowBaseStationPowerManagementTip"} +,{ + "constname": "k_pch_SteamVR_NeverKillProcesses_Bool","consttype": "const char *const", "constval": "neverKillProcesses"} +,{ + "constname": "k_pch_SteamVR_SupersampleScale_Float","consttype": "const char *const", "constval": "supersampleScale"} +,{ + "constname": "k_pch_SteamVR_MaxRecommendedResolution_Int32","consttype": "const char *const", "constval": "maxRecommendedResolution"} +,{ + "constname": "k_pch_SteamVR_MotionSmoothing_Bool","consttype": "const char *const", "constval": "motionSmoothing"} +,{ + "constname": "k_pch_SteamVR_MotionSmoothingOverride_Int32","consttype": "const char *const", "constval": "motionSmoothingOverride"} +,{ + "constname": "k_pch_SteamVR_FramesToThrottle_Int32","consttype": "const char *const", "constval": "framesToThrottle"} +,{ + "constname": "k_pch_SteamVR_AdditionalFramesToPredict_Int32","consttype": "const char *const", "constval": "additionalFramesToPredict"} +,{ + "constname": "k_pch_SteamVR_DisableAsyncReprojection_Bool","consttype": "const char *const", "constval": "disableAsync"} +,{ + "constname": "k_pch_SteamVR_ForceFadeOnBadTracking_Bool","consttype": "const char *const", "constval": "forceFadeOnBadTracking"} +,{ + "constname": "k_pch_SteamVR_DefaultMirrorView_Int32","consttype": "const char *const", "constval": "mirrorView"} +,{ + "constname": "k_pch_SteamVR_ShowLegacyMirrorView_Bool","consttype": "const char *const", "constval": "showLegacyMirrorView"} +,{ + "constname": "k_pch_SteamVR_MirrorViewVisibility_Bool","consttype": "const char *const", "constval": "showMirrorView"} +,{ + "constname": "k_pch_SteamVR_MirrorViewDisplayMode_Int32","consttype": "const char *const", "constval": "mirrorViewDisplayMode"} +,{ + "constname": "k_pch_SteamVR_MirrorViewEye_Int32","consttype": "const char *const", "constval": "mirrorViewEye"} +,{ + "constname": "k_pch_SteamVR_MirrorViewGeometry_String","consttype": "const char *const", "constval": "mirrorViewGeometry"} +,{ + "constname": "k_pch_SteamVR_MirrorViewGeometryMaximized_String","consttype": "const char *const", "constval": "mirrorViewGeometryMaximized"} +,{ + "constname": "k_pch_SteamVR_PerfGraphVisibility_Bool","consttype": "const char *const", "constval": "showPerfGraph"} +,{ + "constname": "k_pch_SteamVR_StartMonitorFromAppLaunch","consttype": "const char *const", "constval": "startMonitorFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartCompositorFromAppLaunch_Bool","consttype": "const char *const", "constval": "startCompositorFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartDashboardFromAppLaunch_Bool","consttype": "const char *const", "constval": "startDashboardFromAppLaunch"} +,{ + "constname": "k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool","consttype": "const char *const", "constval": "startOverlayAppsFromDashboard"} +,{ + "constname": "k_pch_SteamVR_EnableHomeApp","consttype": "const char *const", "constval": "enableHomeApp"} +,{ + "constname": "k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32","consttype": "const char *const", "constval": "CycleBackgroundImageTimeSec"} +,{ + "constname": "k_pch_SteamVR_RetailDemo_Bool","consttype": "const char *const", "constval": "retailDemo"} +,{ + "constname": "k_pch_SteamVR_IpdOffset_Float","consttype": "const char *const", "constval": "ipdOffset"} +,{ + "constname": "k_pch_SteamVR_AllowSupersampleFiltering_Bool","consttype": "const char *const", "constval": "allowSupersampleFiltering"} +,{ + "constname": "k_pch_SteamVR_SupersampleManualOverride_Bool","consttype": "const char *const", "constval": "supersampleManualOverride"} +,{ + "constname": "k_pch_SteamVR_EnableLinuxVulkanAsync_Bool","consttype": "const char *const", "constval": "enableLinuxVulkanAsync"} +,{ + "constname": "k_pch_SteamVR_AllowDisplayLockedMode_Bool","consttype": "const char *const", "constval": "allowDisplayLockedMode"} +,{ + "constname": "k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool","consttype": "const char *const", "constval": "haveStartedTutorialForNativeChaperoneDriver"} +,{ + "constname": "k_pch_SteamVR_ForceWindows32bitVRMonitor","consttype": "const char *const", "constval": "forceWindows32BitVRMonitor"} +,{ + "constname": "k_pch_SteamVR_DebugInputBinding","consttype": "const char *const", "constval": "debugInputBinding"} +,{ + "constname": "k_pch_SteamVR_DoNotFadeToGrid","consttype": "const char *const", "constval": "doNotFadeToGrid"} +,{ + "constname": "k_pch_SteamVR_RenderCameraMode","consttype": "const char *const", "constval": "renderCameraMode"} +,{ + "constname": "k_pch_SteamVR_EnableSharedResourceJournaling","consttype": "const char *const", "constval": "enableSharedResourceJournaling"} +,{ + "constname": "k_pch_SteamVR_EnableSafeMode","consttype": "const char *const", "constval": "enableSafeMode"} +,{ + "constname": "k_pch_SteamVR_PreferredRefreshRate","consttype": "const char *const", "constval": "preferredRefreshRate"} +,{ + "constname": "k_pch_SteamVR_LastVersionNotice","consttype": "const char *const", "constval": "lastVersionNotice"} +,{ + "constname": "k_pch_SteamVR_LastVersionNoticeDate","consttype": "const char *const", "constval": "lastVersionNoticeDate"} +,{ + "constname": "k_pch_SteamVR_HmdDisplayColorGainR_Float","consttype": "const char *const", "constval": "hmdDisplayColorGainR"} +,{ + "constname": "k_pch_SteamVR_HmdDisplayColorGainG_Float","consttype": "const char *const", "constval": "hmdDisplayColorGainG"} +,{ + "constname": "k_pch_SteamVR_HmdDisplayColorGainB_Float","consttype": "const char *const", "constval": "hmdDisplayColorGainB"} +,{ + "constname": "k_pch_SteamVR_CustomIconStyle_String","consttype": "const char *const", "constval": "customIconStyle"} +,{ + "constname": "k_pch_SteamVR_CustomOffIconStyle_String","consttype": "const char *const", "constval": "customOffIconStyle"} +,{ + "constname": "k_pch_SteamVR_CustomIconForceUpdate_String","consttype": "const char *const", "constval": "customIconForceUpdate"} +,{ + "constname": "k_pch_SteamVR_AllowGlobalActionSetPriority","consttype": "const char *const", "constval": "globalActionSetPriority"} +,{ + "constname": "k_pch_SteamVR_OverlayRenderQuality","consttype": "const char *const", "constval": "overlayRenderQuality_2"} +,{ + "constname": "k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool","consttype": "const char *const", "constval": "blockOculusSDKOnOpenVRLaunchOption"} +,{ + "constname": "k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool","consttype": "const char *const", "constval": "blockOculusSDKOnAllLaunches"} +,{ + "constname": "k_pch_SteamVR_HDCPLegacyCompatibility_Bool","consttype": "const char *const", "constval": "hdcp14legacyCompatibility"} +,{ + "constname": "k_pch_SteamVR_UsePrism_Bool","consttype": "const char *const", "constval": "usePrism"} +,{ + "constname": "k_pch_DirectMode_Section","consttype": "const char *const", "constval": "direct_mode"} +,{ + "constname": "k_pch_DirectMode_Enable_Bool","consttype": "const char *const", "constval": "enable"} +,{ + "constname": "k_pch_DirectMode_Count_Int32","consttype": "const char *const", "constval": "count"} +,{ + "constname": "k_pch_DirectMode_EdidVid_Int32","consttype": "const char *const", "constval": "edidVid"} +,{ + "constname": "k_pch_DirectMode_EdidPid_Int32","consttype": "const char *const", "constval": "edidPid"} +,{ + "constname": "k_pch_Lighthouse_Section","consttype": "const char *const", "constval": "driver_lighthouse"} +,{ + "constname": "k_pch_Lighthouse_DisableIMU_Bool","consttype": "const char *const", "constval": "disableimu"} +,{ + "constname": "k_pch_Lighthouse_DisableIMUExceptHMD_Bool","consttype": "const char *const", "constval": "disableimuexcepthmd"} +,{ + "constname": "k_pch_Lighthouse_UseDisambiguation_String","consttype": "const char *const", "constval": "usedisambiguation"} +,{ + "constname": "k_pch_Lighthouse_DisambiguationDebug_Int32","consttype": "const char *const", "constval": "disambiguationdebug"} +,{ + "constname": "k_pch_Lighthouse_PrimaryBasestation_Int32","consttype": "const char *const", "constval": "primarybasestation"} +,{ + "constname": "k_pch_Lighthouse_DBHistory_Bool","consttype": "const char *const", "constval": "dbhistory"} +,{ + "constname": "k_pch_Lighthouse_EnableBluetooth_Bool","consttype": "const char *const", "constval": "enableBluetooth"} +,{ + "constname": "k_pch_Lighthouse_PowerManagedBaseStations_String","consttype": "const char *const", "constval": "PowerManagedBaseStations"} +,{ + "constname": "k_pch_Lighthouse_PowerManagedBaseStations2_String","consttype": "const char *const", "constval": "PowerManagedBaseStations2"} +,{ + "constname": "k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32","consttype": "const char *const", "constval": "InactivityTimeoutForBaseStations"} +,{ + "constname": "k_pch_Lighthouse_EnableImuFallback_Bool","consttype": "const char *const", "constval": "enableImuFallback"} +,{ + "constname": "k_pch_Null_Section","consttype": "const char *const", "constval": "driver_null"} +,{ + "constname": "k_pch_Null_SerialNumber_String","consttype": "const char *const", "constval": "serialNumber"} +,{ + "constname": "k_pch_Null_ModelNumber_String","consttype": "const char *const", "constval": "modelNumber"} +,{ + "constname": "k_pch_Null_WindowX_Int32","consttype": "const char *const", "constval": "windowX"} +,{ + "constname": "k_pch_Null_WindowY_Int32","consttype": "const char *const", "constval": "windowY"} +,{ + "constname": "k_pch_Null_WindowWidth_Int32","consttype": "const char *const", "constval": "windowWidth"} +,{ + "constname": "k_pch_Null_WindowHeight_Int32","consttype": "const char *const", "constval": "windowHeight"} +,{ + "constname": "k_pch_Null_RenderWidth_Int32","consttype": "const char *const", "constval": "renderWidth"} +,{ + "constname": "k_pch_Null_RenderHeight_Int32","consttype": "const char *const", "constval": "renderHeight"} +,{ + "constname": "k_pch_Null_SecondsFromVsyncToPhotons_Float","consttype": "const char *const", "constval": "secondsFromVsyncToPhotons"} +,{ + "constname": "k_pch_Null_DisplayFrequency_Float","consttype": "const char *const", "constval": "displayFrequency"} +,{ + "constname": "k_pch_WindowsMR_Section","consttype": "const char *const", "constval": "driver_holographic"} +,{ + "constname": "k_pch_UserInterface_Section","consttype": "const char *const", "constval": "userinterface"} +,{ + "constname": "k_pch_UserInterface_StatusAlwaysOnTop_Bool","consttype": "const char *const", "constval": "StatusAlwaysOnTop"} +,{ + "constname": "k_pch_UserInterface_MinimizeToTray_Bool","consttype": "const char *const", "constval": "MinimizeToTray"} +,{ + "constname": "k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool","consttype": "const char *const", "constval": "HidePopupsWhenStatusMinimized"} +,{ + "constname": "k_pch_UserInterface_Screenshots_Bool","consttype": "const char *const", "constval": "screenshots"} +,{ + "constname": "k_pch_UserInterface_ScreenshotType_Int","consttype": "const char *const", "constval": "screenshotType"} +,{ + "constname": "k_pch_Notifications_Section","consttype": "const char *const", "constval": "notifications"} +,{ + "constname": "k_pch_Notifications_DoNotDisturb_Bool","consttype": "const char *const", "constval": "DoNotDisturb"} +,{ + "constname": "k_pch_Keyboard_Section","consttype": "const char *const", "constval": "keyboard"} +,{ + "constname": "k_pch_Keyboard_TutorialCompletions","consttype": "const char *const", "constval": "TutorialCompletions"} +,{ + "constname": "k_pch_Keyboard_ScaleX","consttype": "const char *const", "constval": "ScaleX"} +,{ + "constname": "k_pch_Keyboard_ScaleY","consttype": "const char *const", "constval": "ScaleY"} +,{ + "constname": "k_pch_Keyboard_OffsetLeftX","consttype": "const char *const", "constval": "OffsetLeftX"} +,{ + "constname": "k_pch_Keyboard_OffsetRightX","consttype": "const char *const", "constval": "OffsetRightX"} +,{ + "constname": "k_pch_Keyboard_OffsetY","consttype": "const char *const", "constval": "OffsetY"} +,{ + "constname": "k_pch_Keyboard_Smoothing","consttype": "const char *const", "constval": "Smoothing"} +,{ + "constname": "k_pch_Perf_Section","consttype": "const char *const", "constval": "perfcheck"} +,{ + "constname": "k_pch_Perf_PerfGraphInHMD_Bool","consttype": "const char *const", "constval": "perfGraphInHMD"} +,{ + "constname": "k_pch_Perf_AllowTimingStore_Bool","consttype": "const char *const", "constval": "allowTimingStore"} +,{ + "constname": "k_pch_Perf_SaveTimingsOnExit_Bool","consttype": "const char *const", "constval": "saveTimingsOnExit"} +,{ + "constname": "k_pch_Perf_TestData_Float","consttype": "const char *const", "constval": "perfTestData"} +,{ + "constname": "k_pch_Perf_GPUProfiling_Bool","consttype": "const char *const", "constval": "GPUProfiling"} +,{ + "constname": "k_pch_CollisionBounds_Section","consttype": "const char *const", "constval": "collisionBounds"} +,{ + "constname": "k_pch_CollisionBounds_Style_Int32","consttype": "const char *const", "constval": "CollisionBoundsStyle"} +,{ + "constname": "k_pch_CollisionBounds_GroundPerimeterOn_Bool","consttype": "const char *const", "constval": "CollisionBoundsGroundPerimeterOn"} +,{ + "constname": "k_pch_CollisionBounds_CenterMarkerOn_Bool","consttype": "const char *const", "constval": "CollisionBoundsCenterMarkerOn"} +,{ + "constname": "k_pch_CollisionBounds_PlaySpaceOn_Bool","consttype": "const char *const", "constval": "CollisionBoundsPlaySpaceOn"} +,{ + "constname": "k_pch_CollisionBounds_FadeDistance_Float","consttype": "const char *const", "constval": "CollisionBoundsFadeDistance"} +,{ + "constname": "k_pch_CollisionBounds_WallHeight_Float","consttype": "const char *const", "constval": "CollisionBoundsWallHeight"} +,{ + "constname": "k_pch_CollisionBounds_ColorGammaR_Int32","consttype": "const char *const", "constval": "CollisionBoundsColorGammaR"} +,{ + "constname": "k_pch_CollisionBounds_ColorGammaG_Int32","consttype": "const char *const", "constval": "CollisionBoundsColorGammaG"} +,{ + "constname": "k_pch_CollisionBounds_ColorGammaB_Int32","consttype": "const char *const", "constval": "CollisionBoundsColorGammaB"} +,{ + "constname": "k_pch_CollisionBounds_ColorGammaA_Int32","consttype": "const char *const", "constval": "CollisionBoundsColorGammaA"} +,{ + "constname": "k_pch_CollisionBounds_EnableDriverImport","consttype": "const char *const", "constval": "enableDriverBoundsImport"} +,{ + "constname": "k_pch_Camera_Section","consttype": "const char *const", "constval": "camera"} +,{ + "constname": "k_pch_Camera_EnableCamera_Bool","consttype": "const char *const", "constval": "enableCamera"} +,{ + "constname": "k_pch_Camera_ShowOnController_Bool","consttype": "const char *const", "constval": "showOnController"} +,{ + "constname": "k_pch_Camera_EnableCameraForCollisionBounds_Bool","consttype": "const char *const", "constval": "enableCameraForCollisionBounds"} +,{ + "constname": "k_pch_Camera_RoomView_Int32","consttype": "const char *const", "constval": "roomView"} +,{ + "constname": "k_pch_Camera_BoundsColorGammaR_Int32","consttype": "const char *const", "constval": "cameraBoundsColorGammaR"} +,{ + "constname": "k_pch_Camera_BoundsColorGammaG_Int32","consttype": "const char *const", "constval": "cameraBoundsColorGammaG"} +,{ + "constname": "k_pch_Camera_BoundsColorGammaB_Int32","consttype": "const char *const", "constval": "cameraBoundsColorGammaB"} +,{ + "constname": "k_pch_Camera_BoundsColorGammaA_Int32","consttype": "const char *const", "constval": "cameraBoundsColorGammaA"} +,{ + "constname": "k_pch_Camera_BoundsStrength_Int32","consttype": "const char *const", "constval": "cameraBoundsStrength"} +,{ + "constname": "k_pch_Camera_RoomViewStyle_Int32","consttype": "const char *const", "constval": "roomViewStyle"} +,{ + "constname": "k_pch_audio_Section","consttype": "const char *const", "constval": "audio"} +,{ + "constname": "k_pch_audio_SetOsDefaultPlaybackDevice_Bool","consttype": "const char *const", "constval": "setOsDefaultPlaybackDevice"} +,{ + "constname": "k_pch_audio_EnablePlaybackDeviceOverride_Bool","consttype": "const char *const", "constval": "enablePlaybackDeviceOverride"} +,{ + "constname": "k_pch_audio_PlaybackDeviceOverride_String","consttype": "const char *const", "constval": "playbackDeviceOverride"} +,{ + "constname": "k_pch_audio_PlaybackDeviceOverrideName_String","consttype": "const char *const", "constval": "playbackDeviceOverrideName"} +,{ + "constname": "k_pch_audio_SetOsDefaultRecordingDevice_Bool","consttype": "const char *const", "constval": "setOsDefaultRecordingDevice"} +,{ + "constname": "k_pch_audio_EnableRecordingDeviceOverride_Bool","consttype": "const char *const", "constval": "enableRecordingDeviceOverride"} +,{ + "constname": "k_pch_audio_RecordingDeviceOverride_String","consttype": "const char *const", "constval": "recordingDeviceOverride"} +,{ + "constname": "k_pch_audio_RecordingDeviceOverrideName_String","consttype": "const char *const", "constval": "recordingDeviceOverrideName"} +,{ + "constname": "k_pch_audio_EnablePlaybackMirror_Bool","consttype": "const char *const", "constval": "enablePlaybackMirror"} +,{ + "constname": "k_pch_audio_PlaybackMirrorDevice_String","consttype": "const char *const", "constval": "playbackMirrorDevice"} +,{ + "constname": "k_pch_audio_PlaybackMirrorDeviceName_String","consttype": "const char *const", "constval": "playbackMirrorDeviceName"} +,{ + "constname": "k_pch_audio_OldPlaybackMirrorDevice_String","consttype": "const char *const", "constval": "onPlaybackMirrorDevice"} +,{ + "constname": "k_pch_audio_ActiveMirrorDevice_String","consttype": "const char *const", "constval": "activePlaybackMirrorDevice"} +,{ + "constname": "k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool","consttype": "const char *const", "constval": "enablePlaybackMirrorIndependentVolume"} +,{ + "constname": "k_pch_audio_LastHmdPlaybackDeviceId_String","consttype": "const char *const", "constval": "lastHmdPlaybackDeviceId"} +,{ + "constname": "k_pch_audio_VIVEHDMIGain","consttype": "const char *const", "constval": "viveHDMIGain"} +,{ + "constname": "k_pch_audio_DualSpeakerAndJackOutput_Bool","consttype": "const char *const", "constval": "dualSpeakerAndJackOutput"} +,{ + "constname": "k_pch_audio_MuteMicMonitor_Bool","consttype": "const char *const", "constval": "muteMicMonitor"} +,{ + "constname": "k_pch_Power_Section","consttype": "const char *const", "constval": "power"} +,{ + "constname": "k_pch_Power_PowerOffOnExit_Bool","consttype": "const char *const", "constval": "powerOffOnExit"} +,{ + "constname": "k_pch_Power_TurnOffScreensTimeout_Float","consttype": "const char *const", "constval": "turnOffScreensTimeout"} +,{ + "constname": "k_pch_Power_TurnOffControllersTimeout_Float","consttype": "const char *const", "constval": "turnOffControllersTimeout"} +,{ + "constname": "k_pch_Power_ReturnToWatchdogTimeout_Float","consttype": "const char *const", "constval": "returnToWatchdogTimeout"} +,{ + "constname": "k_pch_Power_AutoLaunchSteamVROnButtonPress","consttype": "const char *const", "constval": "autoLaunchSteamVROnButtonPress"} +,{ + "constname": "k_pch_Power_PauseCompositorOnStandby_Bool","consttype": "const char *const", "constval": "pauseCompositorOnStandby"} +,{ + "constname": "k_pch_Dashboard_Section","consttype": "const char *const", "constval": "dashboard"} +,{ + "constname": "k_pch_Dashboard_EnableDashboard_Bool","consttype": "const char *const", "constval": "enableDashboard"} +,{ + "constname": "k_pch_Dashboard_ArcadeMode_Bool","consttype": "const char *const", "constval": "arcadeMode"} +,{ + "constname": "k_pch_Dashboard_Position","consttype": "const char *const", "constval": "position"} +,{ + "constname": "k_pch_Dashboard_DesktopScale","consttype": "const char *const", "constval": "desktopScale"} +,{ + "constname": "k_pch_Dashboard_DashboardScale","consttype": "const char *const", "constval": "dashboardScale"} +,{ + "constname": "k_pch_Dashboard_UseStandaloneSystemLayer","consttype": "const char *const", "constval": "standaloneSystemLayer"} +,{ + "constname": "k_pch_modelskin_Section","consttype": "const char *const", "constval": "modelskins"} +,{ + "constname": "k_pch_Driver_Enable_Bool","consttype": "const char *const", "constval": "enable"} +,{ + "constname": "k_pch_Driver_BlockedBySafemode_Bool","consttype": "const char *const", "constval": "blocked_by_safe_mode"} +,{ + "constname": "k_pch_Driver_LoadPriority_Int32","consttype": "const char *const", "constval": "loadPriority"} +,{ + "constname": "k_pch_WebInterface_Section","consttype": "const char *const", "constval": "WebInterface"} +,{ + "constname": "k_pch_VRWebHelper_Section","consttype": "const char *const", "constval": "VRWebHelper"} +,{ + "constname": "k_pch_VRWebHelper_DebuggerEnabled_Bool","consttype": "const char *const", "constval": "DebuggerEnabled"} +,{ + "constname": "k_pch_VRWebHelper_DebuggerPort_Int32","consttype": "const char *const", "constval": "DebuggerPort"} +,{ + "constname": "k_pch_TrackingOverride_Section","consttype": "const char *const", "constval": "TrackingOverrides"} +,{ + "constname": "k_pch_App_BindingAutosaveURLSuffix_String","consttype": "const char *const", "constval": "AutosaveURL"} +,{ + "constname": "k_pch_App_BindingLegacyAPISuffix_String","consttype": "const char *const", "constval": "_legacy"} +,{ + "constname": "k_pch_App_BindingSteamVRInputAPISuffix_String","consttype": "const char *const", "constval": "_steamvrinput"} +,{ + "constname": "k_pch_App_BindingCurrentURLSuffix_String","consttype": "const char *const", "constval": "CurrentURL"} +,{ + "constname": "k_pch_App_BindingPreviousURLSuffix_String","consttype": "const char *const", "constval": "PreviousURL"} +,{ + "constname": "k_pch_App_NeedToUpdateAutosaveSuffix_Bool","consttype": "const char *const", "constval": "NeedToUpdateAutosave"} +,{ + "constname": "k_pch_App_DominantHand_Int32","consttype": "const char *const", "constval": "DominantHand"} +,{ + "constname": "k_pch_App_BlockOculusSDK_Bool","consttype": "const char *const", "constval": "blockOculusSDK"} +,{ + "constname": "k_pch_Trackers_Section","consttype": "const char *const", "constval": "trackers"} +,{ + "constname": "k_pch_DesktopUI_Section","consttype": "const char *const", "constval": "DesktopUI"} +,{ + "constname": "k_pch_LastKnown_Section","consttype": "const char *const", "constval": "LastKnown"} +,{ + "constname": "k_pch_LastKnown_HMDManufacturer_String","consttype": "const char *const", "constval": "HMDManufacturer"} +,{ + "constname": "k_pch_LastKnown_HMDModel_String","consttype": "const char *const", "constval": "HMDModel"} +,{ + "constname": "k_pch_DismissedWarnings_Section","consttype": "const char *const", "constval": "DismissedWarnings"} +,{ + "constname": "k_pch_Input_Section","consttype": "const char *const", "constval": "input"} +,{ + "constname": "k_pch_Input_LeftThumbstickRotation_Float","consttype": "const char *const", "constval": "leftThumbstickRotation"} +,{ + "constname": "k_pch_Input_RightThumbstickRotation_Float","consttype": "const char *const", "constval": "rightThumbstickRotation"} +,{ + "constname": "k_pch_Input_ThumbstickDeadzone_Float","consttype": "const char *const", "constval": "thumbstickDeadzone"} +,{ + "constname": "k_pch_GpuSpeed_Section","consttype": "const char *const", "constval": "GpuSpeed"} +,{ + "constname": "IVRScreenshots_Version","consttype": "const char *const", "constval": "IVRScreenshots_001"} +,{ + "constname": "IVRResources_Version","consttype": "const char *const", "constval": "IVRResources_001"} +,{ + "constname": "IVRDriverManager_Version","consttype": "const char *const", "constval": "IVRDriverManager_001"} +,{ + "constname": "k_unMaxActionNameLength","consttype": "const uint32_t", "constval": "64"} +,{ + "constname": "k_unMaxActionSetNameLength","consttype": "const uint32_t", "constval": "64"} +,{ + "constname": "k_unMaxActionOriginCount","consttype": "const uint32_t", "constval": "16"} +,{ + "constname": "k_unMaxBoneNameLength","consttype": "const uint32_t", "constval": "32"} +,{ + "constname": "k_nActionSetOverlayGlobalPriorityMin","consttype": "const int32_t", "constval": "16777216"} +,{ + "constname": "k_nActionSetOverlayGlobalPriorityMax","consttype": "const int32_t", "constval": "33554431"} +,{ + "constname": "k_nActionSetPriorityReservedMin","consttype": "const int32_t", "constval": "33554432"} +,{ + "constname": "IVRInput_Version","consttype": "const char *const", "constval": "IVRInput_010"} +,{ + "constname": "k_ulInvalidIOBufferHandle","consttype": "const uint64_t", "constval": "0"} +,{ + "constname": "IVRIOBuffer_Version","consttype": "const char *", "constval": "IVRIOBuffer_002"} +,{ + "constname": "k_ulInvalidSpatialAnchorHandle","consttype": "const SpatialAnchorHandle_t", "constval": "0"} +,{ + "constname": "IVRSpatialAnchors_Version","consttype": "const char *const", "constval": "IVRSpatialAnchors_001"} +,{ + "constname": "IVRDebug_Version","consttype": "const char *const", "constval": "IVRDebug_001"} +,{ + "constname": "k_ulDisplayRedirectContainer","consttype": "const PropertyContainerHandle_t", "constval": "25769803779"} +,{ + "constname": "IVRProperties_Version","consttype": "const char *const", "constval": "IVRProperties_001"} +,{ + "constname": "k_pchPathUserHandRight","consttype": "const char *", "constval": "/user/hand/right"} +,{ + "constname": "k_pchPathUserHandLeft","consttype": "const char *", "constval": "/user/hand/left"} +,{ + "constname": "k_pchPathUserHandPrimary","consttype": "const char *", "constval": "/user/hand/primary"} +,{ + "constname": "k_pchPathUserHandSecondary","consttype": "const char *", "constval": "/user/hand/secondary"} +,{ + "constname": "k_pchPathUserHead","consttype": "const char *", "constval": "/user/head"} +,{ + "constname": "k_pchPathUserGamepad","consttype": "const char *", "constval": "/user/gamepad"} +,{ + "constname": "k_pchPathUserTreadmill","consttype": "const char *", "constval": "/user/treadmill"} +,{ + "constname": "k_pchPathUserStylus","consttype": "const char *", "constval": "/user/stylus"} +,{ + "constname": "k_pchPathDevices","consttype": "const char *", "constval": "/devices"} +,{ + "constname": "k_pchPathDevicePath","consttype": "const char *", "constval": "/device_path"} +,{ + "constname": "k_pchPathBestAliasPath","consttype": "const char *", "constval": "/best_alias_path"} +,{ + "constname": "k_pchPathBoundTrackerAliasPath","consttype": "const char *", "constval": "/bound_tracker_path"} +,{ + "constname": "k_pchPathBoundTrackerRole","consttype": "const char *", "constval": "/bound_tracker_role"} +,{ + "constname": "k_pchPathPoseRaw","consttype": "const char *", "constval": "/pose/raw"} +,{ + "constname": "k_pchPathPoseTip","consttype": "const char *", "constval": "/pose/tip"} +,{ + "constname": "k_pchPathPoseGrip","consttype": "const char *", "constval": "/pose/grip"} +,{ + "constname": "k_pchPathSystemButtonClick","consttype": "const char *", "constval": "/input/system/click"} +,{ + "constname": "k_pchPathProximity","consttype": "const char *", "constval": "/proximity"} +,{ + "constname": "k_pchPathControllerTypePrefix","consttype": "const char *", "constval": "/controller_type/"} +,{ + "constname": "k_pchPathInputProfileSuffix","consttype": "const char *", "constval": "/input_profile"} +,{ + "constname": "k_pchPathBindingNameSuffix","consttype": "const char *", "constval": "/binding_name"} +,{ + "constname": "k_pchPathBindingUrlSuffix","consttype": "const char *", "constval": "/binding_url"} +,{ + "constname": "k_pchPathBindingErrorSuffix","consttype": "const char *", "constval": "/binding_error"} +,{ + "constname": "k_pchPathActiveActionSets","consttype": "const char *", "constval": "/active_action_sets"} +,{ + "constname": "k_pchPathComponentUpdates","consttype": "const char *", "constval": "/total_component_updates"} +,{ + "constname": "k_pchPathUserFootLeft","consttype": "const char *", "constval": "/user/foot/left"} +,{ + "constname": "k_pchPathUserFootRight","consttype": "const char *", "constval": "/user/foot/right"} +,{ + "constname": "k_pchPathUserShoulderLeft","consttype": "const char *", "constval": "/user/shoulder/left"} +,{ + "constname": "k_pchPathUserShoulderRight","consttype": "const char *", "constval": "/user/shoulder/right"} +,{ + "constname": "k_pchPathUserElbowLeft","consttype": "const char *", "constval": "/user/elbow/left"} +,{ + "constname": "k_pchPathUserElbowRight","consttype": "const char *", "constval": "/user/elbow/right"} +,{ + "constname": "k_pchPathUserKneeLeft","consttype": "const char *", "constval": "/user/knee/left"} +,{ + "constname": "k_pchPathUserKneeRight","consttype": "const char *", "constval": "/user/knee/right"} +,{ + "constname": "k_pchPathUserWaist","consttype": "const char *", "constval": "/user/waist"} +,{ + "constname": "k_pchPathUserChest","consttype": "const char *", "constval": "/user/chest"} +,{ + "constname": "k_pchPathUserCamera","consttype": "const char *", "constval": "/user/camera"} +,{ + "constname": "k_pchPathUserKeyboard","consttype": "const char *", "constval": "/user/keyboard"} +,{ + "constname": "k_pchPathClientAppKey","consttype": "const char *", "constval": "/client_info/app_key"} +,{ + "constname": "k_ulInvalidPathHandle","consttype": "const PathHandle_t", "constval": "0"} +,{ + "constname": "IVRPaths_Version","consttype": "const char *const", "constval": "IVRPaths_001"} +,{ + "constname": "IVRBlockQueue_Version","consttype": "const char *", "constval": "IVRBlockQueue_004"} +], +"structs":[{"struct": "vr::HmdMatrix34_t","fields": [ +{ "fieldname": "m", "fieldtype": "float [3][4]"}]} +,{"struct": "vr::HmdMatrix33_t","fields": [ +{ "fieldname": "m", "fieldtype": "float [3][3]"}]} +,{"struct": "vr::HmdMatrix44_t","fields": [ +{ "fieldname": "m", "fieldtype": "float [4][4]"}]} +,{"struct": "vr::HmdVector3_t","fields": [ +{ "fieldname": "v", "fieldtype": "float [3]"}]} +,{"struct": "vr::HmdVector4_t","fields": [ +{ "fieldname": "v", "fieldtype": "float [4]"}]} +,{"struct": "vr::HmdVector3d_t","fields": [ +{ "fieldname": "v", "fieldtype": "double [3]"}]} +,{"struct": "vr::HmdVector2_t","fields": [ +{ "fieldname": "v", "fieldtype": "float [2]"}]} +,{"struct": "vr::HmdQuaternion_t","fields": [ +{ "fieldname": "w", "fieldtype": "double"}, +{ "fieldname": "x", "fieldtype": "double"}, +{ "fieldname": "y", "fieldtype": "double"}, +{ "fieldname": "z", "fieldtype": "double"}]} +,{"struct": "vr::HmdQuaternionf_t","fields": [ +{ "fieldname": "w", "fieldtype": "float"}, +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}, +{ "fieldname": "z", "fieldtype": "float"}]} +,{"struct": "vr::HmdColor_t","fields": [ +{ "fieldname": "r", "fieldtype": "float"}, +{ "fieldname": "g", "fieldtype": "float"}, +{ "fieldname": "b", "fieldtype": "float"}, +{ "fieldname": "a", "fieldtype": "float"}]} +,{"struct": "vr::HmdQuad_t","fields": [ +{ "fieldname": "vCorners", "fieldtype": "struct vr::HmdVector3_t [4]"}]} +,{"struct": "vr::HmdRect2_t","fields": [ +{ "fieldname": "vTopLeft", "fieldtype": "struct vr::HmdVector2_t"}, +{ "fieldname": "vBottomRight", "fieldtype": "struct vr::HmdVector2_t"}]} +,{"struct": "vr::VRBoneTransform_t","fields": [ +{ "fieldname": "position", "fieldtype": "struct vr::HmdVector4_t"}, +{ "fieldname": "orientation", "fieldtype": "struct vr::HmdQuaternionf_t"}]} +,{"struct": "vr::DistortionCoordinates_t","fields": [ +{ "fieldname": "rfRed", "fieldtype": "float [2]"}, +{ "fieldname": "rfGreen", "fieldtype": "float [2]"}, +{ "fieldname": "rfBlue", "fieldtype": "float [2]"}]} +,{"struct": "vr::Texture_t","fields": [ +{ "fieldname": "handle", "fieldtype": "void *"}, +{ "fieldname": "eType", "fieldtype": "enum vr::ETextureType"}, +{ "fieldname": "eColorSpace", "fieldtype": "enum vr::EColorSpace"}]} +,{"struct": "vr::TrackedDevicePose_t","fields": [ +{ "fieldname": "mDeviceToAbsoluteTracking", "fieldtype": "struct vr::HmdMatrix34_t"}, +{ "fieldname": "vVelocity", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "vAngularVelocity", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "eTrackingResult", "fieldtype": "enum vr::ETrackingResult"}, +{ "fieldname": "bPoseIsValid", "fieldtype": "_Bool"}, +{ "fieldname": "bDeviceIsConnected", "fieldtype": "_Bool"}]} +,{"struct": "vr::VRTextureBounds_t","fields": [ +{ "fieldname": "uMin", "fieldtype": "float"}, +{ "fieldname": "vMin", "fieldtype": "float"}, +{ "fieldname": "uMax", "fieldtype": "float"}, +{ "fieldname": "vMax", "fieldtype": "float"}]} +,{"struct": "vr::VRTextureWithPose_t","fields": [ +{ "fieldname": "mDeviceToAbsoluteTracking", "fieldtype": "struct vr::HmdMatrix34_t"}]} +,{"struct": "vr::VRTextureDepthInfo_t","fields": [ +{ "fieldname": "handle", "fieldtype": "void *"}, +{ "fieldname": "mProjection", "fieldtype": "struct vr::HmdMatrix44_t"}, +{ "fieldname": "vRange", "fieldtype": "struct vr::HmdVector2_t"}]} +,{"struct": "vr::VRTextureWithDepth_t","fields": [ +{ "fieldname": "depth", "fieldtype": "struct vr::VRTextureDepthInfo_t"}]} +,{"struct": "vr::VRTextureWithPoseAndDepth_t","fields": [ +{ "fieldname": "depth", "fieldtype": "struct vr::VRTextureDepthInfo_t"}]} +,{"struct": "vr::VRVulkanTextureData_t","fields": [ +{ "fieldname": "m_nImage", "fieldtype": "uint64_t"}, +{ "fieldname": "m_pDevice", "fieldtype": "struct VkDevice_T *"}, +{ "fieldname": "m_pPhysicalDevice", "fieldtype": "struct VkPhysicalDevice_T *"}, +{ "fieldname": "m_pInstance", "fieldtype": "struct VkInstance_T *"}, +{ "fieldname": "m_pQueue", "fieldtype": "struct VkQueue_T *"}, +{ "fieldname": "m_nQueueFamilyIndex", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nWidth", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nHeight", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nFormat", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nSampleCount", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VRVulkanTextureArrayData_t","fields": [ +{ "fieldname": "m_unArrayIndex", "fieldtype": "uint32_t"}, +{ "fieldname": "m_unArraySize", "fieldtype": "uint32_t"}]} +,{"struct": "vr::D3D12TextureData_t","fields": [ +{ "fieldname": "m_pResource", "fieldtype": "struct ID3D12Resource *"}, +{ "fieldname": "m_pCommandQueue", "fieldtype": "struct ID3D12CommandQueue *"}, +{ "fieldname": "m_nNodeMask", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Controller_t","fields": [ +{ "fieldname": "button", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Mouse_t","fields": [ +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}, +{ "fieldname": "button", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Scroll_t","fields": [ +{ "fieldname": "xdelta", "fieldtype": "float"}, +{ "fieldname": "ydelta", "fieldtype": "float"}, +{ "fieldname": "unused", "fieldtype": "uint32_t"}, +{ "fieldname": "viewportscale", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_TouchPadMove_t","fields": [ +{ "fieldname": "bFingerDown", "fieldtype": "_Bool"}, +{ "fieldname": "flSecondsFingerDown", "fieldtype": "float"}, +{ "fieldname": "fValueXFirst", "fieldtype": "float"}, +{ "fieldname": "fValueYFirst", "fieldtype": "float"}, +{ "fieldname": "fValueXRaw", "fieldtype": "float"}, +{ "fieldname": "fValueYRaw", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_Notification_t","fields": [ +{ "fieldname": "ulUserValue", "fieldtype": "uint64_t"}, +{ "fieldname": "notificationId", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Process_t","fields": [ +{ "fieldname": "pid", "fieldtype": "uint32_t"}, +{ "fieldname": "oldPid", "fieldtype": "uint32_t"}, +{ "fieldname": "bForced", "fieldtype": "_Bool"}, +{ "fieldname": "bConnectionLost", "fieldtype": "_Bool"}]} +,{"struct": "vr::VREvent_Overlay_t","fields": [ +{ "fieldname": "overlayHandle", "fieldtype": "uint64_t"}, +{ "fieldname": "devicePath", "fieldtype": "uint64_t"}, +{ "fieldname": "memoryBlockId", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_Status_t","fields": [ +{ "fieldname": "statusState", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Keyboard_t","fields": [ +{ "fieldname": "cNewInput", "fieldtype": "char [8]"}, +{ "fieldname": "uUserValue", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_Ipd_t","fields": [ +{ "fieldname": "ipdMeters", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_Chaperone_t","fields": [ +{ "fieldname": "m_nPreviousUniverse", "fieldtype": "uint64_t"}, +{ "fieldname": "m_nCurrentUniverse", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_Reserved_t","fields": [ +{ "fieldname": "reserved0", "fieldtype": "uint64_t"}, +{ "fieldname": "reserved1", "fieldtype": "uint64_t"}, +{ "fieldname": "reserved2", "fieldtype": "uint64_t"}, +{ "fieldname": "reserved3", "fieldtype": "uint64_t"}, +{ "fieldname": "reserved4", "fieldtype": "uint64_t"}, +{ "fieldname": "reserved5", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_PerformanceTest_t","fields": [ +{ "fieldname": "m_nFidelityLevel", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_SeatedZeroPoseReset_t","fields": [ +{ "fieldname": "bResetBySystemMenu", "fieldtype": "_Bool"}]} +,{"struct": "vr::VREvent_Screenshot_t","fields": [ +{ "fieldname": "handle", "fieldtype": "uint32_t"}, +{ "fieldname": "type", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_ScreenshotProgress_t","fields": [ +{ "fieldname": "progress", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_ApplicationLaunch_t","fields": [ +{ "fieldname": "pid", "fieldtype": "uint32_t"}, +{ "fieldname": "unArgsHandle", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_EditingCameraSurface_t","fields": [ +{ "fieldname": "overlayHandle", "fieldtype": "uint64_t"}, +{ "fieldname": "nVisualMode", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_MessageOverlay_t","fields": [ +{ "fieldname": "unVRMessageOverlayResponse", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VREvent_Property_t","fields": [ +{ "fieldname": "container", "fieldtype": "PropertyContainerHandle_t"}, +{ "fieldname": "prop", "fieldtype": "enum vr::ETrackedDeviceProperty"}]} +,{"struct": "vr::VREvent_HapticVibration_t","fields": [ +{ "fieldname": "containerHandle", "fieldtype": "uint64_t"}, +{ "fieldname": "componentHandle", "fieldtype": "uint64_t"}, +{ "fieldname": "fDurationSeconds", "fieldtype": "float"}, +{ "fieldname": "fFrequency", "fieldtype": "float"}, +{ "fieldname": "fAmplitude", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_WebConsole_t","fields": [ +{ "fieldname": "webConsoleHandle", "fieldtype": "WebConsoleHandle_t"}]} +,{"struct": "vr::VREvent_InputBindingLoad_t","fields": [ +{ "fieldname": "ulAppContainer", "fieldtype": "vr::PropertyContainerHandle_t"}, +{ "fieldname": "pathMessage", "fieldtype": "uint64_t"}, +{ "fieldname": "pathUrl", "fieldtype": "uint64_t"}, +{ "fieldname": "pathControllerType", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_InputActionManifestLoad_t","fields": [ +{ "fieldname": "pathAppKey", "fieldtype": "uint64_t"}, +{ "fieldname": "pathMessage", "fieldtype": "uint64_t"}, +{ "fieldname": "pathMessageParam", "fieldtype": "uint64_t"}, +{ "fieldname": "pathManifestPath", "fieldtype": "uint64_t"}]} +,{"struct": "vr::VREvent_SpatialAnchor_t","fields": [ +{ "fieldname": "unHandle", "fieldtype": "SpatialAnchorHandle_t"}]} +,{"struct": "vr::VREvent_ProgressUpdate_t","fields": [ +{ "fieldname": "ulApplicationPropertyContainer", "fieldtype": "uint64_t"}, +{ "fieldname": "pathDevice", "fieldtype": "uint64_t"}, +{ "fieldname": "pathInputSource", "fieldtype": "uint64_t"}, +{ "fieldname": "pathProgressAction", "fieldtype": "uint64_t"}, +{ "fieldname": "pathIcon", "fieldtype": "uint64_t"}, +{ "fieldname": "fProgress", "fieldtype": "float"}]} +,{"struct": "vr::VREvent_ShowUI_t","fields": [ +{ "fieldname": "eType", "fieldtype": "enum vr::EShowUIType"}]} +,{"struct": "vr::VREvent_ShowDevTools_t","fields": [ +{ "fieldname": "nBrowserIdentifier", "fieldtype": "int32_t"}]} +,{"struct": "vr::VREvent_HDCPError_t","fields": [ +{ "fieldname": "eCode", "fieldtype": "enum vr::EHDCPError"}]} +,{"struct": "vr::(anonymous)","fields": [ +{ "fieldname": "reserved", "fieldtype": "struct vr::VREvent_Reserved_t"}, +{ "fieldname": "controller", "fieldtype": "struct vr::VREvent_Controller_t"}, +{ "fieldname": "mouse", "fieldtype": "struct vr::VREvent_Mouse_t"}, +{ "fieldname": "scroll", "fieldtype": "struct vr::VREvent_Scroll_t"}, +{ "fieldname": "process", "fieldtype": "struct vr::VREvent_Process_t"}, +{ "fieldname": "notification", "fieldtype": "struct vr::VREvent_Notification_t"}, +{ "fieldname": "overlay", "fieldtype": "struct vr::VREvent_Overlay_t"}, +{ "fieldname": "status", "fieldtype": "struct vr::VREvent_Status_t"}, +{ "fieldname": "keyboard", "fieldtype": "struct vr::VREvent_Keyboard_t"}, +{ "fieldname": "ipd", "fieldtype": "struct vr::VREvent_Ipd_t"}, +{ "fieldname": "chaperone", "fieldtype": "struct vr::VREvent_Chaperone_t"}, +{ "fieldname": "performanceTest", "fieldtype": "struct vr::VREvent_PerformanceTest_t"}, +{ "fieldname": "touchPadMove", "fieldtype": "struct vr::VREvent_TouchPadMove_t"}, +{ "fieldname": "seatedZeroPoseReset", "fieldtype": "struct vr::VREvent_SeatedZeroPoseReset_t"}, +{ "fieldname": "screenshot", "fieldtype": "struct vr::VREvent_Screenshot_t"}, +{ "fieldname": "screenshotProgress", "fieldtype": "struct vr::VREvent_ScreenshotProgress_t"}, +{ "fieldname": "applicationLaunch", "fieldtype": "struct vr::VREvent_ApplicationLaunch_t"}, +{ "fieldname": "cameraSurface", "fieldtype": "struct vr::VREvent_EditingCameraSurface_t"}, +{ "fieldname": "messageOverlay", "fieldtype": "struct vr::VREvent_MessageOverlay_t"}, +{ "fieldname": "property", "fieldtype": "struct vr::VREvent_Property_t"}, +{ "fieldname": "hapticVibration", "fieldtype": "struct vr::VREvent_HapticVibration_t"}, +{ "fieldname": "webConsole", "fieldtype": "struct vr::VREvent_WebConsole_t"}, +{ "fieldname": "inputBinding", "fieldtype": "struct vr::VREvent_InputBindingLoad_t"}, +{ "fieldname": "actionManifest", "fieldtype": "struct vr::VREvent_InputActionManifestLoad_t"}, +{ "fieldname": "spatialAnchor", "fieldtype": "struct vr::VREvent_SpatialAnchor_t"}, +{ "fieldname": "progressUpdate", "fieldtype": "struct vr::VREvent_ProgressUpdate_t"}, +{ "fieldname": "showUi", "fieldtype": "struct vr::VREvent_ShowUI_t"}, +{ "fieldname": "showDevTools", "fieldtype": "struct vr::VREvent_ShowDevTools_t"}, +{ "fieldname": "hdcpError", "fieldtype": "struct vr::VREvent_HDCPError_t"}]} +,{"struct": "vr::VREvent_t","fields": [ +{ "fieldname": "eventType", "fieldtype": "uint32_t"}, +{ "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"}, +{ "fieldname": "eventAgeSeconds", "fieldtype": "float"}, +{ "fieldname": "data", "fieldtype": "VREvent_Data_t"}]} +,{"struct": "vr::RenderModel_ComponentState_t","fields": [ +{ "fieldname": "mTrackingToComponentRenderModel", "fieldtype": "struct vr::HmdMatrix34_t"}, +{ "fieldname": "mTrackingToComponentLocal", "fieldtype": "struct vr::HmdMatrix34_t"}, +{ "fieldname": "uProperties", "fieldtype": "VRComponentProperties"}]} +,{"struct": "vr::HiddenAreaMesh_t","fields": [ +{ "fieldname": "pVertexData", "fieldtype": "const struct vr::HmdVector2_t *"}, +{ "fieldname": "unTriangleCount", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VRControllerAxis_t","fields": [ +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}]} +,{"struct": "vr::VRControllerState001_t","fields": [ +{ "fieldname": "unPacketNum", "fieldtype": "uint32_t"}, +{ "fieldname": "ulButtonPressed", "fieldtype": "uint64_t"}, +{ "fieldname": "ulButtonTouched", "fieldtype": "uint64_t"}, +{ "fieldname": "rAxis", "fieldtype": "struct vr::VRControllerAxis_t [5]"}]} +,{"struct": "vr::CameraVideoStreamFrameHeader_t","fields": [ +{ "fieldname": "eFrameType", "fieldtype": "enum vr::EVRTrackedCameraFrameType"}, +{ "fieldname": "nWidth", "fieldtype": "uint32_t"}, +{ "fieldname": "nHeight", "fieldtype": "uint32_t"}, +{ "fieldname": "nBytesPerPixel", "fieldtype": "uint32_t"}, +{ "fieldname": "nFrameSequence", "fieldtype": "uint32_t"}, +{ "fieldname": "trackedDevicePose", "fieldtype": "struct vr::TrackedDevicePose_t"}, +{ "fieldname": "ulFrameExposureTime", "fieldtype": "uint64_t"}]} +,{"struct": "vr::Compositor_FrameTiming","fields": [ +{ "fieldname": "m_nSize", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nFrameIndex", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresents", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumMisPresented", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFrames", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nReprojectionFlags", "fieldtype": "uint32_t"}, +{ "fieldname": "m_flSystemTimeInSeconds", "fieldtype": "double"}, +{ "fieldname": "m_flPreSubmitGpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flPostSubmitGpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flTotalRenderGpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorRenderGpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorRenderCpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorIdleCpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flClientFrameIntervalMs", "fieldtype": "float"}, +{ "fieldname": "m_flPresentCallCpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flWaitForPresentCpuMs", "fieldtype": "float"}, +{ "fieldname": "m_flSubmitFrameMs", "fieldtype": "float"}, +{ "fieldname": "m_flWaitGetPosesCalledMs", "fieldtype": "float"}, +{ "fieldname": "m_flNewPosesReadyMs", "fieldtype": "float"}, +{ "fieldname": "m_flNewFrameReadyMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorUpdateStartMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorUpdateEndMs", "fieldtype": "float"}, +{ "fieldname": "m_flCompositorRenderStartMs", "fieldtype": "float"}, +{ "fieldname": "m_HmdPose", "fieldtype": "vr::TrackedDevicePose_t"}, +{ "fieldname": "m_nNumVSyncsReadyForUse", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumVSyncsToFirstView", "fieldtype": "uint32_t"}]} +,{"struct": "vr::Compositor_BenchmarkResults","fields": [ +{ "fieldname": "m_flMegaPixelsPerSecond", "fieldtype": "float"}, +{ "fieldname": "m_flHmdRecommendedMegaPixelsPerSecond", "fieldtype": "float"}]} +,{"struct": "vr::DriverDirectMode_FrameTiming","fields": [ +{ "fieldname": "m_nSize", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresents", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumMisPresented", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFrames", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nReprojectionFlags", "fieldtype": "uint32_t"}]} +,{"struct": "vr::ImuSample_t","fields": [ +{ "fieldname": "fSampleTime", "fieldtype": "double"}, +{ "fieldname": "vAccel", "fieldtype": "struct vr::HmdVector3d_t"}, +{ "fieldname": "vGyro", "fieldtype": "struct vr::HmdVector3d_t"}, +{ "fieldname": "unOffScaleFlags", "fieldtype": "uint32_t"}]} +,{"struct": "vr::AppOverrideKeys_t","fields": [ +{ "fieldname": "pchKey", "fieldtype": "const char *"}, +{ "fieldname": "pchValue", "fieldtype": "const char *"}]} +,{"struct": "vr::Compositor_CumulativeStats","fields": [ +{ "fieldname": "m_nPid", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresents", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFrames", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumReprojectedFrames", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresentsOnStartup", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFramesOnStartup", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumReprojectedFramesOnStartup", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumLoading", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresentsLoading", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFramesLoading", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumReprojectedFramesLoading", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumTimedOut", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumFramePresentsTimedOut", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumDroppedFramesTimedOut", "fieldtype": "uint32_t"}, +{ "fieldname": "m_nNumReprojectedFramesTimedOut", "fieldtype": "uint32_t"}]} +,{"struct": "vr::Compositor_StageRenderSettings","fields": [ +{ "fieldname": "m_PrimaryColor", "fieldtype": "struct vr::HmdColor_t"}, +{ "fieldname": "m_SecondaryColor", "fieldtype": "struct vr::HmdColor_t"}, +{ "fieldname": "m_flVignetteInnerRadius", "fieldtype": "float"}, +{ "fieldname": "m_flVignetteOuterRadius", "fieldtype": "float"}, +{ "fieldname": "m_flFresnelStrength", "fieldtype": "float"}, +{ "fieldname": "m_bBackfaceCulling", "fieldtype": "_Bool"}, +{ "fieldname": "m_bGreyscale", "fieldtype": "_Bool"}, +{ "fieldname": "m_bWireframe", "fieldtype": "_Bool"}]} +,{"struct": "vr::VROverlayIntersectionParams_t","fields": [ +{ "fieldname": "vSource", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "vDirection", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "eOrigin", "fieldtype": "enum vr::ETrackingUniverseOrigin"}]} +,{"struct": "vr::VROverlayIntersectionResults_t","fields": [ +{ "fieldname": "vPoint", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "vNormal", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "vUVs", "fieldtype": "struct vr::HmdVector2_t"}, +{ "fieldname": "fDistance", "fieldtype": "float"}]} +,{"struct": "vr::IntersectionMaskRectangle_t","fields": [ +{ "fieldname": "m_flTopLeftX", "fieldtype": "float"}, +{ "fieldname": "m_flTopLeftY", "fieldtype": "float"}, +{ "fieldname": "m_flWidth", "fieldtype": "float"}, +{ "fieldname": "m_flHeight", "fieldtype": "float"}]} +,{"struct": "vr::IntersectionMaskCircle_t","fields": [ +{ "fieldname": "m_flCenterX", "fieldtype": "float"}, +{ "fieldname": "m_flCenterY", "fieldtype": "float"}, +{ "fieldname": "m_flRadius", "fieldtype": "float"}]} +,{"struct": "vr::(anonymous)","fields": [ +{ "fieldname": "m_Rectangle", "fieldtype": "struct vr::IntersectionMaskRectangle_t"}, +{ "fieldname": "m_Circle", "fieldtype": "struct vr::IntersectionMaskCircle_t"}]} +,{"struct": "vr::VROverlayIntersectionMaskPrimitive_t","fields": [ +{ "fieldname": "m_nPrimitiveType", "fieldtype": "enum vr::EVROverlayIntersectionMaskPrimitiveType"}, +{ "fieldname": "m_Primitive", "fieldtype": "VROverlayIntersectionMaskPrimitive_Data_t"}]} +,{"struct": "vr::VROverlayProjection_t","fields": [ +{ "fieldname": "fLeft", "fieldtype": "float"}, +{ "fieldname": "fRight", "fieldtype": "float"}, +{ "fieldname": "fTop", "fieldtype": "float"}, +{ "fieldname": "fBottom", "fieldtype": "float"}]} +,{"struct": "vr::VROverlayView_t","fields": [ +{ "fieldname": "overlayHandle", "fieldtype": "VROverlayHandle_t"}, +{ "fieldname": "texture", "fieldtype": "struct vr::Texture_t"}, +{ "fieldname": "textureBounds", "fieldtype": "struct vr::VRTextureBounds_t"}]} +,{"struct": "vr::VRVulkanDevice_t","fields": [ +{ "fieldname": "m_pInstance", "fieldtype": "struct VkInstance_T *"}, +{ "fieldname": "m_pDevice", "fieldtype": "struct VkDevice_T *"}, +{ "fieldname": "m_pPhysicalDevice", "fieldtype": "struct VkPhysicalDevice_T *"}, +{ "fieldname": "m_pQueue", "fieldtype": "struct VkQueue_T *"}, +{ "fieldname": "m_uQueueFamilyIndex", "fieldtype": "uint32_t"}]} +,{"struct": "vr::VRNativeDevice_t","fields": [ +{ "fieldname": "handle", "fieldtype": "void *"}, +{ "fieldname": "eType", "fieldtype": "enum vr::EDeviceType"}]} +,{"struct": "vr::RenderModel_Vertex_t","fields": [ +{ "fieldname": "vPosition", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "vNormal", "fieldtype": "struct vr::HmdVector3_t"}, +{ "fieldname": "rfTextureCoord", "fieldtype": "float [2]"}]} +,{"struct": "vr::RenderModel_TextureMap_t","fields": [ +{ "fieldname": "unWidth", "fieldtype": "uint16_t"}, +{ "fieldname": "unHeight", "fieldtype": "uint16_t"}, +{ "fieldname": "rubTextureMapData", "fieldtype": "const uint8_t *"}, +{ "fieldname": "format", "fieldtype": "enum vr::EVRRenderModelTextureFormat"}]} +,{"struct": "vr::RenderModel_t","fields": [ +{ "fieldname": "rVertexData", "fieldtype": "const struct vr::RenderModel_Vertex_t *"}, +{ "fieldname": "unVertexCount", "fieldtype": "uint32_t"}, +{ "fieldname": "rIndexData", "fieldtype": "const uint16_t *"}, +{ "fieldname": "unTriangleCount", "fieldtype": "uint32_t"}, +{ "fieldname": "diffuseTextureId", "fieldtype": "TextureID_t"}]} +,{"struct": "vr::RenderModel_ControllerMode_State_t","fields": [ +{ "fieldname": "bScrollWheelVisible", "fieldtype": "_Bool"}]} +,{"struct": "vr::NotificationBitmap_t","fields": [ +{ "fieldname": "m_pImageData", "fieldtype": "void *"}, +{ "fieldname": "m_nWidth", "fieldtype": "int32_t"}, +{ "fieldname": "m_nHeight", "fieldtype": "int32_t"}, +{ "fieldname": "m_nBytesPerPixel", "fieldtype": "int32_t"}]} +,{"struct": "vr::CVRSettingHelper","fields": [ +{ "fieldname": "m_pSettings", "fieldtype": "class vr::IVRSettings *"}]} +,{"struct": "vr::InputAnalogActionData_t","fields": [ +{ "fieldname": "bActive", "fieldtype": "_Bool"}, +{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "x", "fieldtype": "float"}, +{ "fieldname": "y", "fieldtype": "float"}, +{ "fieldname": "z", "fieldtype": "float"}, +{ "fieldname": "deltaX", "fieldtype": "float"}, +{ "fieldname": "deltaY", "fieldtype": "float"}, +{ "fieldname": "deltaZ", "fieldtype": "float"}, +{ "fieldname": "fUpdateTime", "fieldtype": "float"}]} +,{"struct": "vr::InputDigitalActionData_t","fields": [ +{ "fieldname": "bActive", "fieldtype": "_Bool"}, +{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "bState", "fieldtype": "_Bool"}, +{ "fieldname": "bChanged", "fieldtype": "_Bool"}, +{ "fieldname": "fUpdateTime", "fieldtype": "float"}]} +,{"struct": "vr::InputPoseActionData_t","fields": [ +{ "fieldname": "bActive", "fieldtype": "_Bool"}, +{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "pose", "fieldtype": "struct vr::TrackedDevicePose_t"}]} +,{"struct": "vr::InputSkeletalActionData_t","fields": [ +{ "fieldname": "bActive", "fieldtype": "_Bool"}, +{ "fieldname": "activeOrigin", "fieldtype": "VRInputValueHandle_t"}]} +,{"struct": "vr::InputOriginInfo_t","fields": [ +{ "fieldname": "devicePath", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "trackedDeviceIndex", "fieldtype": "TrackedDeviceIndex_t"}, +{ "fieldname": "rchRenderModelComponentName", "fieldtype": "char [128]"}]} +,{"struct": "vr::InputBindingInfo_t","fields": [ +{ "fieldname": "rchDevicePathName", "fieldtype": "char [128]"}, +{ "fieldname": "rchInputPathName", "fieldtype": "char [128]"}, +{ "fieldname": "rchModeName", "fieldtype": "char [128]"}, +{ "fieldname": "rchSlotName", "fieldtype": "char [128]"}, +{ "fieldname": "rchInputSourceType", "fieldtype": "char [32]"}]} +,{"struct": "vr::VRActiveActionSet_t","fields": [ +{ "fieldname": "ulActionSet", "fieldtype": "VRActionSetHandle_t"}, +{ "fieldname": "ulRestrictedToDevice", "fieldtype": "VRInputValueHandle_t"}, +{ "fieldname": "ulSecondaryActionSet", "fieldtype": "VRActionSetHandle_t"}, +{ "fieldname": "unPadding", "fieldtype": "uint32_t"}, +{ "fieldname": "nPriority", "fieldtype": "int32_t"}]} +,{"struct": "vr::VRSkeletalSummaryData_t","fields": [ +{ "fieldname": "flFingerCurl", "fieldtype": "float [5]"}, +{ "fieldname": "flFingerSplay", "fieldtype": "float [4]"}]} +,{"struct": "vr::SpatialAnchorPose_t","fields": [ +{ "fieldname": "mAnchorToAbsoluteTracking", "fieldtype": "struct vr::HmdMatrix34_t"}]} +,{"struct": "vr::COpenVRContext","fields": [ +{ "fieldname": "m_pVRSystem", "fieldtype": "class vr::IVRSystem *"}, +{ "fieldname": "m_pVRChaperone", "fieldtype": "class vr::IVRChaperone *"}, +{ "fieldname": "m_pVRChaperoneSetup", "fieldtype": "class vr::IVRChaperoneSetup *"}, +{ "fieldname": "m_pVRCompositor", "fieldtype": "class vr::IVRCompositor *"}, +{ "fieldname": "m_pVRHeadsetView", "fieldtype": "class vr::IVRHeadsetView *"}, +{ "fieldname": "m_pVROverlay", "fieldtype": "class vr::IVROverlay *"}, +{ "fieldname": "m_pVROverlayView", "fieldtype": "class vr::IVROverlayView *"}, +{ "fieldname": "m_pVRResources", "fieldtype": "class vr::IVRResources *"}, +{ "fieldname": "m_pVRRenderModels", "fieldtype": "class vr::IVRRenderModels *"}, +{ "fieldname": "m_pVRExtendedDisplay", "fieldtype": "class vr::IVRExtendedDisplay *"}, +{ "fieldname": "m_pVRSettings", "fieldtype": "class vr::IVRSettings *"}, +{ "fieldname": "m_pVRApplications", "fieldtype": "class vr::IVRApplications *"}, +{ "fieldname": "m_pVRTrackedCamera", "fieldtype": "class vr::IVRTrackedCamera *"}, +{ "fieldname": "m_pVRScreenshots", "fieldtype": "class vr::IVRScreenshots *"}, +{ "fieldname": "m_pVRDriverManager", "fieldtype": "class vr::IVRDriverManager *"}, +{ "fieldname": "m_pVRInput", "fieldtype": "class vr::IVRInput *"}, +{ "fieldname": "m_pVRIOBuffer", "fieldtype": "class vr::IVRIOBuffer *"}, +{ "fieldname": "m_pVRSpatialAnchors", "fieldtype": "class vr::IVRSpatialAnchors *"}, +{ "fieldname": "m_pVRDebug", "fieldtype": "class vr::IVRDebug *"}, +{ "fieldname": "m_pVRNotifications", "fieldtype": "class vr::IVRNotifications *"}]} +,{"struct": "vr::PropertyWrite_t","fields": [ +{ "fieldname": "prop", "fieldtype": "enum vr::ETrackedDeviceProperty"}, +{ "fieldname": "writeType", "fieldtype": "enum vr::EPropertyWriteType"}, +{ "fieldname": "eSetError", "fieldtype": "enum vr::ETrackedPropertyError"}, +{ "fieldname": "pvBuffer", "fieldtype": "void *"}, +{ "fieldname": "unBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "unTag", "fieldtype": "PropertyTypeTag_t"}, +{ "fieldname": "eError", "fieldtype": "enum vr::ETrackedPropertyError"}]} +,{"struct": "vr::PropertyRead_t","fields": [ +{ "fieldname": "prop", "fieldtype": "enum vr::ETrackedDeviceProperty"}, +{ "fieldname": "pvBuffer", "fieldtype": "void *"}, +{ "fieldname": "unBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "unTag", "fieldtype": "PropertyTypeTag_t"}, +{ "fieldname": "unRequiredBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "eError", "fieldtype": "enum vr::ETrackedPropertyError"}]} +,{"struct": "vr::CVRPropertyHelpers","fields": [ +{ "fieldname": "m_pProperties", "fieldtype": "class vr::IVRProperties *"}]} +,{"struct": "vr::PathWrite_t","fields": [ +{ "fieldname": "ulPath", "fieldtype": "PathHandle_t"}, +{ "fieldname": "writeType", "fieldtype": "enum vr::EPropertyWriteType"}, +{ "fieldname": "eSetError", "fieldtype": "enum vr::ETrackedPropertyError"}, +{ "fieldname": "pvBuffer", "fieldtype": "void *"}, +{ "fieldname": "unBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "unTag", "fieldtype": "PropertyTypeTag_t"}, +{ "fieldname": "eError", "fieldtype": "enum vr::ETrackedPropertyError"}, +{ "fieldname": "pszPath", "fieldtype": "const char *"}]} +,{"struct": "vr::PathRead_t","fields": [ +{ "fieldname": "ulPath", "fieldtype": "PathHandle_t"}, +{ "fieldname": "pvBuffer", "fieldtype": "void *"}, +{ "fieldname": "unBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "unTag", "fieldtype": "PropertyTypeTag_t"}, +{ "fieldname": "unRequiredBufferSize", "fieldtype": "uint32_t"}, +{ "fieldname": "eError", "fieldtype": "enum vr::ETrackedPropertyError"}, +{ "fieldname": "pszPath", "fieldtype": "const char *"}]} +], +"methods":[{ + "classname": "vr::IVRSystem", + "methodname": "GetRecommendedRenderTargetSize", + "returntype": "void", + "params": [ +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetProjectionMatrix", + "returntype": "struct vr::HmdMatrix44_t", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "fNearZ" ,"paramtype": "float"}, +{ "paramname": "fFarZ" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetProjectionRaw", + "returntype": "void", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "pfLeft" ,"paramtype": "float *"}, +{ "paramname": "pfRight" ,"paramtype": "float *"}, +{ "paramname": "pfTop" ,"paramtype": "float *"}, +{ "paramname": "pfBottom" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "ComputeDistortion", + "returntype": "bool", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "fU" ,"paramtype": "float"}, +{ "paramname": "fV" ,"paramtype": "float"}, +{ "paramname": "pDistortionCoordinates" ,"paramtype": "struct vr::DistortionCoordinates_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetEyeToHeadTransform", + "returntype": "struct vr::HmdMatrix34_t", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetTimeSinceLastVsync", + "returntype": "bool", + "params": [ +{ "paramname": "pfSecondsSinceLastVsync" ,"paramtype": "float *"}, +{ "paramname": "pulFrameCounter" ,"paramtype": "uint64_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetD3D9AdapterIndex", + "returntype": "int32_t" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetDXGIOutputInfo", + "returntype": "void", + "params": [ +{ "paramname": "pnAdapterIndex" ,"paramtype": "int32_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetOutputDevice", + "returntype": "void", + "params": [ +{ "paramname": "pnDevice" ,"paramtype": "uint64_t *"}, +{ "paramname": "textureType" ,"paramtype": "vr::ETextureType"}, +{ "paramname": "pInstance" ,"paramtype": "struct VkInstance_T *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "IsDisplayOnDesktop", + "returntype": "bool" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "SetDisplayVisibility", + "returntype": "bool", + "params": [ +{ "paramname": "bIsVisibleOnDesktop" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetDeviceToAbsoluteTrackingPose", + "returntype": "void", + "params": [ +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "fPredictedSecondsToPhotonsFromNow" ,"paramtype": "float"}, +{ "paramname": "pTrackedDevicePoseArray" ,"array_count": "unTrackedDevicePoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unTrackedDevicePoseArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetSeatedZeroPoseToStandingAbsoluteTrackingPose", + "returntype": "struct vr::HmdMatrix34_t" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetRawZeroPoseToStandingAbsoluteTrackingPose", + "returntype": "struct vr::HmdMatrix34_t" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetSortedTrackedDeviceIndicesOfClass", + "returntype": "uint32_t", + "params": [ +{ "paramname": "eTrackedDeviceClass" ,"paramtype": "vr::ETrackedDeviceClass"}, +{ "paramname": "punTrackedDeviceIndexArray" ,"array_count": "unTrackedDeviceIndexArrayCount" ,"paramtype": "vr::TrackedDeviceIndex_t *"}, +{ "paramname": "unTrackedDeviceIndexArrayCount" ,"paramtype": "uint32_t"}, +{ "paramname": "unRelativeToTrackedDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetTrackedDeviceActivityLevel", + "returntype": "vr::EDeviceActivityLevel", + "params": [ +{ "paramname": "unDeviceId" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "ApplyTransform", + "returntype": "void", + "params": [ +{ "paramname": "pOutputPose" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "pTrackedDevicePose" ,"paramtype": "const struct vr::TrackedDevicePose_t *"}, +{ "paramname": "pTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetTrackedDeviceIndexForControllerRole", + "returntype": "vr::TrackedDeviceIndex_t", + "params": [ +{ "paramname": "unDeviceType" ,"paramtype": "vr::ETrackedControllerRole"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetControllerRoleForTrackedDeviceIndex", + "returntype": "vr::ETrackedControllerRole", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetTrackedDeviceClass", + "returntype": "vr::ETrackedDeviceClass", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "IsTrackedDeviceConnected", + "returntype": "bool", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetBoolTrackedDeviceProperty", + "returntype": "bool", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetFloatTrackedDeviceProperty", + "returntype": "float", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetInt32TrackedDeviceProperty", + "returntype": "int32_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetUint64TrackedDeviceProperty", + "returntype": "uint64_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetMatrix34TrackedDeviceProperty", + "returntype": "struct vr::HmdMatrix34_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetArrayTrackedDeviceProperty", + "returntype": "uint32_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "propType" ,"paramtype": "vr::PropertyTypeTag_t"}, +{ "paramname": "pBuffer" ,"paramtype": "void *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetStringTrackedDeviceProperty", + "returntype": "uint32_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "prop" ,"paramtype": "vr::ETrackedDeviceProperty"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pError" ,"paramtype": "vr::ETrackedPropertyError *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetPropErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "error" ,"paramtype": "vr::ETrackedPropertyError"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "PollNextEvent", + "returntype": "bool", + "params": [ +{ "paramname": "pEvent" ,"paramtype": "struct vr::VREvent_t *"}, +{ "paramname": "uncbVREvent" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "PollNextEventWithPose", + "returntype": "bool", + "params": [ +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pEvent" ,"paramtype": "struct vr::VREvent_t *"}, +{ "paramname": "uncbVREvent" ,"paramtype": "uint32_t"}, +{ "paramname": "pTrackedDevicePose" ,"paramtype": "vr::TrackedDevicePose_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetEventTypeNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "eType" ,"paramtype": "vr::EVREventType"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetHiddenAreaMesh", + "returntype": "struct vr::HiddenAreaMesh_t", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "type" ,"paramtype": "vr::EHiddenAreaMeshType"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetControllerState", + "returntype": "bool", + "params": [ +{ "paramname": "unControllerDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pControllerState" ,"paramtype": "vr::VRControllerState_t *"}, +{ "paramname": "unControllerStateSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetControllerStateWithPose", + "returntype": "bool", + "params": [ +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "unControllerDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pControllerState" ,"paramtype": "vr::VRControllerState_t *"}, +{ "paramname": "unControllerStateSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pTrackedDevicePose" ,"paramtype": "struct vr::TrackedDevicePose_t *"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "TriggerHapticPulse", + "returntype": "void", + "params": [ +{ "paramname": "unControllerDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "unAxisId" ,"paramtype": "uint32_t"}, +{ "paramname": "usDurationMicroSec" ,"paramtype": "unsigned short"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetButtonIdNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "eButtonId" ,"paramtype": "vr::EVRButtonId"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetControllerAxisTypeNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "eAxisType" ,"paramtype": "vr::EVRControllerAxisType"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "IsInputAvailable", + "returntype": "bool" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "IsSteamVRDrawingControllers", + "returntype": "bool" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "ShouldApplicationPause", + "returntype": "bool" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "ShouldApplicationReduceRenderingWork", + "returntype": "bool" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "PerformFirmwareUpdate", + "returntype": "vr::EVRFirmwareError", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "AcknowledgeQuit_Exiting", + "returntype": "void" +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetAppContainerFilePaths", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRSystem", + "methodname": "GetRuntimeVersion", + "returntype": "const char *" +} +,{ + "classname": "vr::IVRExtendedDisplay", + "methodname": "GetWindowBounds", + "returntype": "void", + "params": [ +{ "paramname": "pnX" ,"paramtype": "int32_t *"}, +{ "paramname": "pnY" ,"paramtype": "int32_t *"}, +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRExtendedDisplay", + "methodname": "GetEyeOutputViewport", + "returntype": "void", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "pnX" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnY" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRExtendedDisplay", + "methodname": "GetDXGIOutputInfo", + "returntype": "void", + "params": [ +{ "paramname": "pnAdapterIndex" ,"paramtype": "int32_t *"}, +{ "paramname": "pnAdapterOutputIndex" ,"paramtype": "int32_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetCameraErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "eCameraError" ,"paramtype": "vr::EVRTrackedCameraError"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "HasCamera", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pHasCamera" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetCameraFrameSize", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnFrameBufferSize" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetCameraIntrinsics", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "nCameraIndex" ,"paramtype": "uint32_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pFocalLength" ,"paramtype": "vr::HmdVector2_t *"}, +{ "paramname": "pCenter" ,"paramtype": "vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetCameraProjection", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "nCameraIndex" ,"paramtype": "uint32_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "flZNear" ,"paramtype": "float"}, +{ "paramname": "flZFar" ,"paramtype": "float"}, +{ "paramname": "pProjection" ,"paramtype": "vr::HmdMatrix44_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "AcquireVideoStreamingService", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pHandle" ,"paramtype": "vr::TrackedCameraHandle_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "ReleaseVideoStreamingService", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "hTrackedCamera" ,"paramtype": "vr::TrackedCameraHandle_t"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetVideoStreamFrameBuffer", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "hTrackedCamera" ,"paramtype": "vr::TrackedCameraHandle_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pFrameBuffer" ,"paramtype": "void *"}, +{ "paramname": "nFrameBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pFrameHeader" ,"paramtype": "vr::CameraVideoStreamFrameHeader_t *"}, +{ "paramname": "nFrameHeaderSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetVideoStreamTextureSize", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "nDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pTextureBounds" ,"paramtype": "vr::VRTextureBounds_t *"}, +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetVideoStreamTextureD3D11", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "hTrackedCamera" ,"paramtype": "vr::TrackedCameraHandle_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pD3D11DeviceOrResource" ,"paramtype": "void *"}, +{ "paramname": "ppD3D11ShaderResourceView" ,"paramtype": "void **"}, +{ "paramname": "pFrameHeader" ,"paramtype": "vr::CameraVideoStreamFrameHeader_t *"}, +{ "paramname": "nFrameHeaderSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetVideoStreamTextureGL", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "hTrackedCamera" ,"paramtype": "vr::TrackedCameraHandle_t"}, +{ "paramname": "eFrameType" ,"paramtype": "vr::EVRTrackedCameraFrameType"}, +{ "paramname": "pglTextureId" ,"paramtype": "vr::glUInt_t *"}, +{ "paramname": "pFrameHeader" ,"paramtype": "vr::CameraVideoStreamFrameHeader_t *"}, +{ "paramname": "nFrameHeaderSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "ReleaseVideoStreamTextureGL", + "returntype": "vr::EVRTrackedCameraError", + "params": [ +{ "paramname": "hTrackedCamera" ,"paramtype": "vr::TrackedCameraHandle_t"}, +{ "paramname": "glTextureId" ,"paramtype": "vr::glUInt_t"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "SetCameraTrackingSpace", + "returntype": "void", + "params": [ +{ "paramname": "eUniverse" ,"paramtype": "vr::ETrackingUniverseOrigin"} + ] +} +,{ + "classname": "vr::IVRTrackedCamera", + "methodname": "GetCameraTrackingSpace", + "returntype": "vr::ETrackingUniverseOrigin" +} +,{ + "classname": "vr::IVRApplications", + "methodname": "AddApplicationManifest", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchApplicationManifestFullPath" ,"paramtype": "const char *"}, +{ "paramname": "bTemporary" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "RemoveApplicationManifest", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchApplicationManifestFullPath" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "IsApplicationInstalled", + "returntype": "bool", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationCount", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationKeyByIndex", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "unApplicationIndex" ,"paramtype": "uint32_t"}, +{ "paramname": "pchAppKeyBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unAppKeyBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationKeyByProcessId", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "unProcessId" ,"paramtype": "uint32_t"}, +{ "paramname": "pchAppKeyBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unAppKeyBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "LaunchApplication", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "LaunchTemplateApplication", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchTemplateAppKey" ,"paramtype": "const char *"}, +{ "paramname": "pchNewAppKey" ,"paramtype": "const char *"}, +{ "paramname": "pKeys" ,"array_count": "unKeys" ,"paramtype": "const struct vr::AppOverrideKeys_t *"}, +{ "paramname": "unKeys" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "LaunchApplicationFromMimeType", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchMimeType" ,"paramtype": "const char *"}, +{ "paramname": "pchArgs" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "LaunchDashboardOverlay", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "CancelApplicationLaunch", + "returntype": "bool", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "IdentifyApplication", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "unProcessId" ,"paramtype": "uint32_t"}, +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationProcessId", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationsErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "error" ,"paramtype": "vr::EVRApplicationError"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationPropertyString", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "eProperty" ,"paramtype": "vr::EVRApplicationProperty"}, +{ "paramname": "pchPropertyValueBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unPropertyValueBufferLen" ,"paramtype": "uint32_t"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRApplicationError *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationPropertyBool", + "returntype": "bool", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "eProperty" ,"paramtype": "vr::EVRApplicationProperty"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRApplicationError *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationPropertyUint64", + "returntype": "uint64_t", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "eProperty" ,"paramtype": "vr::EVRApplicationProperty"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRApplicationError *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "SetApplicationAutoLaunch", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "bAutoLaunch" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationAutoLaunch", + "returntype": "bool", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "SetDefaultApplicationForMimeType", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "pchMimeType" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetDefaultApplicationForMimeType", + "returntype": "bool", + "params": [ +{ "paramname": "pchMimeType" ,"paramtype": "const char *"}, +{ "paramname": "pchAppKeyBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unAppKeyBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationSupportedMimeTypes", + "returntype": "bool", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "pchMimeTypesBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unMimeTypesBuffer" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationsThatSupportMimeType", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchMimeType" ,"paramtype": "const char *"}, +{ "paramname": "pchAppKeysThatSupportBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unAppKeysThatSupportBuffer" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetApplicationLaunchArguments", + "returntype": "uint32_t", + "params": [ +{ "paramname": "unHandle" ,"paramtype": "uint32_t"}, +{ "paramname": "pchArgs" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unArgs" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetStartingApplication", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKeyBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unAppKeyBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetSceneApplicationState", + "returntype": "vr::EVRSceneApplicationState" +} +,{ + "classname": "vr::IVRApplications", + "methodname": "PerformApplicationPrelaunchCheck", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetSceneApplicationStateNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "state" ,"paramtype": "vr::EVRSceneApplicationState"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "LaunchInternalProcess", + "returntype": "vr::EVRApplicationError", + "params": [ +{ "paramname": "pchBinaryPath" ,"paramtype": "const char *"}, +{ "paramname": "pchArguments" ,"paramtype": "const char *"}, +{ "paramname": "pchWorkingDirectory" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRApplications", + "methodname": "GetCurrentSceneProcessId", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "GetCalibrationState", + "returntype": "vr::ChaperoneCalibrationState" +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "GetPlayAreaSize", + "returntype": "bool", + "params": [ +{ "paramname": "pSizeX" ,"paramtype": "float *"}, +{ "paramname": "pSizeZ" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "GetPlayAreaRect", + "returntype": "bool", + "params": [ +{ "paramname": "rect" ,"paramtype": "struct vr::HmdQuad_t *"} + ] +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "ReloadInfo", + "returntype": "void" +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "SetSceneColor", + "returntype": "void", + "params": [ +{ "paramname": "color" ,"paramtype": "struct vr::HmdColor_t"} + ] +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "GetBoundsColor", + "returntype": "void", + "params": [ +{ "paramname": "pOutputColorArray" ,"paramtype": "struct vr::HmdColor_t *"}, +{ "paramname": "nNumOutputColors" ,"paramtype": "int"}, +{ "paramname": "flCollisionBoundsFadeDistance" ,"paramtype": "float"}, +{ "paramname": "pOutputCameraColor" ,"paramtype": "struct vr::HmdColor_t *"} + ] +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "AreBoundsVisible", + "returntype": "bool" +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "ForceBoundsVisible", + "returntype": "void", + "params": [ +{ "paramname": "bForce" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRChaperone", + "methodname": "ResetZeroPose", + "returntype": "void", + "params": [ +{ "paramname": "eTrackingUniverseOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "CommitWorkingCopy", + "returntype": "bool", + "params": [ +{ "paramname": "configFile" ,"paramtype": "vr::EChaperoneConfigFile"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "RevertWorkingCopy", + "returntype": "void" +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetWorkingPlayAreaSize", + "returntype": "bool", + "params": [ +{ "paramname": "pSizeX" ,"paramtype": "float *"}, +{ "paramname": "pSizeZ" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetWorkingPlayAreaRect", + "returntype": "bool", + "params": [ +{ "paramname": "rect" ,"paramtype": "struct vr::HmdQuad_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetWorkingCollisionBoundsInfo", + "returntype": "bool", + "params": [ +{ "paramname": "pQuadsBuffer" ,"out_array_count": "punQuadsCount" ,"paramtype": "struct vr::HmdQuad_t *"}, +{ "paramname": "punQuadsCount" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetLiveCollisionBoundsInfo", + "returntype": "bool", + "params": [ +{ "paramname": "pQuadsBuffer" ,"out_array_count": "punQuadsCount" ,"paramtype": "struct vr::HmdQuad_t *"}, +{ "paramname": "punQuadsCount" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetWorkingSeatedZeroPoseToRawTrackingPose", + "returntype": "bool", + "params": [ +{ "paramname": "pmatSeatedZeroPoseToRawTrackingPose" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetWorkingStandingZeroPoseToRawTrackingPose", + "returntype": "bool", + "params": [ +{ "paramname": "pmatStandingZeroPoseToRawTrackingPose" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "SetWorkingPlayAreaSize", + "returntype": "void", + "params": [ +{ "paramname": "sizeX" ,"paramtype": "float"}, +{ "paramname": "sizeZ" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "SetWorkingCollisionBoundsInfo", + "returntype": "void", + "params": [ +{ "paramname": "pQuadsBuffer" ,"array_count": "unQuadsCount" ,"paramtype": "struct vr::HmdQuad_t *"}, +{ "paramname": "unQuadsCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "SetWorkingPerimeter", + "returntype": "void", + "params": [ +{ "paramname": "pPointBuffer" ,"array_count": "unPointCount" ,"paramtype": "struct vr::HmdVector2_t *"}, +{ "paramname": "unPointCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "SetWorkingSeatedZeroPoseToRawTrackingPose", + "returntype": "void", + "params": [ +{ "paramname": "pMatSeatedZeroPoseToRawTrackingPose" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "SetWorkingStandingZeroPoseToRawTrackingPose", + "returntype": "void", + "params": [ +{ "paramname": "pMatStandingZeroPoseToRawTrackingPose" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "ReloadFromDisk", + "returntype": "void", + "params": [ +{ "paramname": "configFile" ,"paramtype": "vr::EChaperoneConfigFile"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "GetLiveSeatedZeroPoseToRawTrackingPose", + "returntype": "bool", + "params": [ +{ "paramname": "pmatSeatedZeroPoseToRawTrackingPose" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "ExportLiveToBuffer", + "returntype": "bool", + "params": [ +{ "paramname": "pBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "pnBufferLength" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "ImportFromBufferToWorking", + "returntype": "bool", + "params": [ +{ "paramname": "pBuffer" ,"paramtype": "const char *"}, +{ "paramname": "nImportFlags" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "ShowWorkingSetPreview", + "returntype": "void" +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "HideWorkingSetPreview", + "returntype": "void" +} +,{ + "classname": "vr::IVRChaperoneSetup", + "methodname": "RoomSetupStarting", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SetTrackingSpace", + "returntype": "void", + "params": [ +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetTrackingSpace", + "returntype": "vr::ETrackingUniverseOrigin" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "WaitGetPoses", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "pRenderPoseArray" ,"array_count": "unRenderPoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unRenderPoseArrayCount" ,"paramtype": "uint32_t"}, +{ "paramname": "pGamePoseArray" ,"array_count": "unGamePoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unGamePoseArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetLastPoses", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "pRenderPoseArray" ,"array_count": "unRenderPoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unRenderPoseArrayCount" ,"paramtype": "uint32_t"}, +{ "paramname": "pGamePoseArray" ,"array_count": "unGamePoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unGamePoseArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetLastPoseForTrackedDeviceIndex", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pOutputPose" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "pOutputGamePose" ,"paramtype": "struct vr::TrackedDevicePose_t *"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "Submit", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "pTexture" ,"paramtype": "const struct vr::Texture_t *"}, +{ "paramname": "pBounds" ,"paramtype": "const struct vr::VRTextureBounds_t *"}, +{ "paramname": "nSubmitFlags" ,"paramtype": "vr::EVRSubmitFlags"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ClearLastSubmittedFrame", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "PostPresentHandoff", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetFrameTiming", + "returntype": "bool", + "params": [ +{ "paramname": "pTiming" ,"paramtype": "struct vr::Compositor_FrameTiming *"}, +{ "paramname": "unFramesAgo" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetFrameTimings", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pTiming" ,"array_count": "nFrames" ,"paramtype": "struct vr::Compositor_FrameTiming *"}, +{ "paramname": "nFrames" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetFrameTimeRemaining", + "returntype": "float" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetCumulativeStats", + "returntype": "void", + "params": [ +{ "paramname": "pStats" ,"paramtype": "struct vr::Compositor_CumulativeStats *"}, +{ "paramname": "nStatsSizeInBytes" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "FadeToColor", + "returntype": "void", + "params": [ +{ "paramname": "fSeconds" ,"paramtype": "float"}, +{ "paramname": "fRed" ,"paramtype": "float"}, +{ "paramname": "fGreen" ,"paramtype": "float"}, +{ "paramname": "fBlue" ,"paramtype": "float"}, +{ "paramname": "fAlpha" ,"paramtype": "float"}, +{ "paramname": "bBackground" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetCurrentFadeColor", + "returntype": "struct vr::HmdColor_t", + "params": [ +{ "paramname": "bBackground" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "FadeGrid", + "returntype": "void", + "params": [ +{ "paramname": "fSeconds" ,"paramtype": "float"}, +{ "paramname": "bFadeGridIn" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetCurrentGridAlpha", + "returntype": "float" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SetSkyboxOverride", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "pTextures" ,"array_count": "unTextureCount" ,"paramtype": "const struct vr::Texture_t *"}, +{ "paramname": "unTextureCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ClearSkyboxOverride", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "CompositorBringToFront", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "CompositorGoToBack", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "CompositorQuit", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "IsFullscreen", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetCurrentSceneFocusProcess", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetLastFrameRenderer", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "CanRenderScene", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ShowMirrorWindow", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "HideMirrorWindow", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "IsMirrorWindowVisible", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "CompositorDumpImages", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ShouldAppRenderWithLowResources", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ForceInterleavedReprojectionOn", + "returntype": "void", + "params": [ +{ "paramname": "bOverride" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ForceReconnectProcess", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SuspendRendering", + "returntype": "void", + "params": [ +{ "paramname": "bSuspend" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetMirrorTextureD3D11", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "pD3D11DeviceOrResource" ,"paramtype": "void *"}, +{ "paramname": "ppD3D11ShaderResourceView" ,"paramtype": "void **"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ReleaseMirrorTextureD3D11", + "returntype": "void", + "params": [ +{ "paramname": "pD3D11ShaderResourceView" ,"paramtype": "void *"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetMirrorTextureGL", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"}, +{ "paramname": "pglTextureId" ,"paramtype": "vr::glUInt_t *"}, +{ "paramname": "pglSharedTextureHandle" ,"paramtype": "vr::glSharedTextureHandle_t *"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ReleaseSharedGLTexture", + "returntype": "bool", + "params": [ +{ "paramname": "glTextureId" ,"paramtype": "vr::glUInt_t"}, +{ "paramname": "glSharedTextureHandle" ,"paramtype": "vr::glSharedTextureHandle_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "LockGLSharedTextureForAccess", + "returntype": "void", + "params": [ +{ "paramname": "glSharedTextureHandle" ,"paramtype": "vr::glSharedTextureHandle_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "UnlockGLSharedTextureForAccess", + "returntype": "void", + "params": [ +{ "paramname": "glSharedTextureHandle" ,"paramtype": "vr::glSharedTextureHandle_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetVulkanInstanceExtensionsRequired", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetVulkanDeviceExtensionsRequired", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pPhysicalDevice" ,"paramtype": "struct VkPhysicalDevice_T *"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SetExplicitTimingMode", + "returntype": "void", + "params": [ +{ "paramname": "eTimingMode" ,"paramtype": "vr::EVRCompositorTimingMode"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SubmitExplicitTimingData", + "returntype": "vr::EVRCompositorError" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "IsMotionSmoothingEnabled", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "IsMotionSmoothingSupported", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "IsCurrentSceneFocusAppLoading", + "returntype": "bool" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "SetStageOverride_Async", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "pchRenderModelPath" ,"paramtype": "const char *"}, +{ "paramname": "pTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"}, +{ "paramname": "pRenderSettings" ,"paramtype": "const struct vr::Compositor_StageRenderSettings *"}, +{ "paramname": "nSizeOfRenderSettings" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "ClearStageOverride", + "returntype": "void" +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetCompositorBenchmarkResults", + "returntype": "bool", + "params": [ +{ "paramname": "pBenchmarkResults" ,"paramtype": "struct vr::Compositor_BenchmarkResults *"}, +{ "paramname": "nSizeOfBenchmarkResults" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetLastPosePredictionIDs", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "pRenderPosePredictionID" ,"paramtype": "uint32_t *"}, +{ "paramname": "pGamePosePredictionID" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRCompositor", + "methodname": "GetPosesForFrame", + "returntype": "vr::EVRCompositorError", + "params": [ +{ "paramname": "unPosePredictionID" ,"paramtype": "uint32_t"}, +{ "paramname": "pPoseArray" ,"array_count": "unPoseArrayCount" ,"paramtype": "struct vr::TrackedDevicePose_t *"}, +{ "paramname": "unPoseArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "FindOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "pchOverlayKey" ,"paramtype": "const char *"}, +{ "paramname": "pOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "CreateOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "pchOverlayKey" ,"paramtype": "const char *"}, +{ "paramname": "pchOverlayName" ,"paramtype": "const char *"}, +{ "paramname": "pOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "DestroyOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayKey", + "returntype": "uint32_t", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pError" ,"paramtype": "vr::EVROverlayError *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayName", + "returntype": "uint32_t", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "pError" ,"paramtype": "vr::EVROverlayError *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayName", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pchName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayImageData", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "punWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "punHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "error" ,"paramtype": "vr::EVROverlayError"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayRenderingPid", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "unPID" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayRenderingPid", + "returntype": "uint32_t", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayFlag", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eOverlayFlag" ,"paramtype": "vr::VROverlayFlags"}, +{ "paramname": "bEnabled" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayFlag", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eOverlayFlag" ,"paramtype": "vr::VROverlayFlags"}, +{ "paramname": "pbEnabled" ,"paramtype": "bool *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayFlags", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pFlags" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayColor", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fRed" ,"paramtype": "float"}, +{ "paramname": "fGreen" ,"paramtype": "float"}, +{ "paramname": "fBlue" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayColor", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pfRed" ,"paramtype": "float *"}, +{ "paramname": "pfGreen" ,"paramtype": "float *"}, +{ "paramname": "pfBlue" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayAlpha", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fAlpha" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayAlpha", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pfAlpha" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTexelAspect", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fTexelAspect" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTexelAspect", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pfTexelAspect" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlaySortOrder", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "unSortOrder" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlaySortOrder", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "punSortOrder" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayWidthInMeters", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fWidthInMeters" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayWidthInMeters", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pfWidthInMeters" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayCurvature", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fCurvature" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayCurvature", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pfCurvature" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTextureColorSpace", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eTextureColorSpace" ,"paramtype": "vr::EColorSpace"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTextureColorSpace", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "peTextureColorSpace" ,"paramtype": "vr::EColorSpace *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTextureBounds", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pOverlayTextureBounds" ,"paramtype": "const struct vr::VRTextureBounds_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTextureBounds", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pOverlayTextureBounds" ,"paramtype": "struct vr::VRTextureBounds_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformType", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "peTransformType" ,"paramtype": "vr::VROverlayTransformType *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformAbsolute", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eTrackingOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pmatTrackingOriginToOverlayTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformAbsolute", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "peTrackingOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin *"}, +{ "paramname": "pmatTrackingOriginToOverlayTransform" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformTrackedDeviceRelative", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "unTrackedDevice" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pmatTrackedDeviceToOverlayTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformTrackedDeviceRelative", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "punTrackedDevice" ,"paramtype": "vr::TrackedDeviceIndex_t *"}, +{ "paramname": "pmatTrackedDeviceToOverlayTransform" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformTrackedDeviceComponent", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformTrackedDeviceComponent", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "punDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t *"}, +{ "paramname": "pchComponentName" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unComponentNameSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformOverlayRelative", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "ulOverlayHandleParent" ,"paramtype": "vr::VROverlayHandle_t *"}, +{ "paramname": "pmatParentOverlayToOverlayTransform" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformOverlayRelative", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "ulOverlayHandleParent" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pmatParentOverlayToOverlayTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformCursor", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulCursorOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvHotspot" ,"paramtype": "const struct vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTransformCursor", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvHotspot" ,"paramtype": "struct vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTransformProjection", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eTrackingOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pmatTrackingOriginToOverlayTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"}, +{ "paramname": "pProjection" ,"paramtype": "const struct vr::VROverlayProjection_t *"}, +{ "paramname": "eEye" ,"paramtype": "vr::EVREye"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "HideOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "IsOverlayVisible", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetTransformForOverlayCoordinates", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eTrackingOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "coordinatesInOverlay" ,"paramtype": "struct vr::HmdVector2_t"}, +{ "paramname": "pmatTransform" ,"paramtype": "struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "PollNextOverlayEvent", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pEvent" ,"paramtype": "struct vr::VREvent_t *"}, +{ "paramname": "uncbVREvent" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayInputMethod", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "peInputMethod" ,"paramtype": "vr::VROverlayInputMethod *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayInputMethod", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eInputMethod" ,"paramtype": "vr::VROverlayInputMethod"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayMouseScale", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvecMouseScale" ,"paramtype": "struct vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayMouseScale", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvecMouseScale" ,"paramtype": "const struct vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ComputeOverlayIntersection", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pParams" ,"paramtype": "const struct vr::VROverlayIntersectionParams_t *"}, +{ "paramname": "pResults" ,"paramtype": "struct vr::VROverlayIntersectionResults_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "IsHoverTargetOverlay", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayIntersectionMask", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pMaskPrimitives" ,"paramtype": "struct vr::VROverlayIntersectionMaskPrimitive_t *"}, +{ "paramname": "unNumMaskPrimitives" ,"paramtype": "uint32_t"}, +{ "paramname": "unPrimitiveSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "TriggerLaserMouseHapticVibration", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "fDurationSeconds" ,"paramtype": "float"}, +{ "paramname": "fFrequency" ,"paramtype": "float"}, +{ "paramname": "fAmplitude" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayCursor", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "ulCursorHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayCursorPositionOverride", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvCursor" ,"paramtype": "const struct vr::HmdVector2_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ClearOverlayCursorPositionOverride", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayTexture", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pTexture" ,"paramtype": "const struct vr::Texture_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ClearOverlayTexture", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayRaw", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvBuffer" ,"paramtype": "void *"}, +{ "paramname": "unWidth" ,"paramtype": "uint32_t"}, +{ "paramname": "unHeight" ,"paramtype": "uint32_t"}, +{ "paramname": "unBytesPerPixel" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetOverlayFromFile", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pchFilePath" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTexture", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pNativeTextureHandle" ,"paramtype": "void **"}, +{ "paramname": "pNativeTextureRef" ,"paramtype": "void *"}, +{ "paramname": "pWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pHeight" ,"paramtype": "uint32_t *"}, +{ "paramname": "pNativeFormat" ,"paramtype": "uint32_t *"}, +{ "paramname": "pAPIType" ,"paramtype": "vr::ETextureType *"}, +{ "paramname": "pColorSpace" ,"paramtype": "vr::EColorSpace *"}, +{ "paramname": "pTextureBounds" ,"paramtype": "struct vr::VRTextureBounds_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ReleaseNativeOverlayHandle", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pNativeTextureHandle" ,"paramtype": "void *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetOverlayTextureSize", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "CreateDashboardOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "pchOverlayKey" ,"paramtype": "const char *"}, +{ "paramname": "pchOverlayFriendlyName" ,"paramtype": "const char *"}, +{ "paramname": "pMainHandle" ,"paramtype": "vr::VROverlayHandle_t *"}, +{ "paramname": "pThumbnailHandle" ,"paramtype": "vr::VROverlayHandle_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "IsDashboardVisible", + "returntype": "bool" +} +,{ + "classname": "vr::IVROverlay", + "methodname": "IsActiveDashboardOverlay", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetDashboardOverlaySceneProcess", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "unProcessId" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetDashboardOverlaySceneProcess", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "punProcessId" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowDashboard", + "returntype": "void", + "params": [ +{ "paramname": "pchOverlayToShow" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetPrimaryDashboardDevice", + "returntype": "vr::TrackedDeviceIndex_t" +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowKeyboard", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "eInputMode" ,"paramtype": "vr::EGamepadTextInputMode"}, +{ "paramname": "eLineInputMode" ,"paramtype": "vr::EGamepadTextInputLineMode"}, +{ "paramname": "unFlags" ,"paramtype": "uint32_t"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"}, +{ "paramname": "unCharMax" ,"paramtype": "uint32_t"}, +{ "paramname": "pchExistingText" ,"paramtype": "const char *"}, +{ "paramname": "uUserValue" ,"paramtype": "uint64_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowKeyboardForOverlay", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "eInputMode" ,"paramtype": "vr::EGamepadTextInputMode"}, +{ "paramname": "eLineInputMode" ,"paramtype": "vr::EGamepadTextInputLineMode"}, +{ "paramname": "unFlags" ,"paramtype": "uint32_t"}, +{ "paramname": "pchDescription" ,"paramtype": "const char *"}, +{ "paramname": "unCharMax" ,"paramtype": "uint32_t"}, +{ "paramname": "pchExistingText" ,"paramtype": "const char *"}, +{ "paramname": "uUserValue" ,"paramtype": "uint64_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "GetKeyboardText", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchText" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "cchText" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "HideKeyboard", + "returntype": "void" +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetKeyboardTransformAbsolute", + "returntype": "void", + "params": [ +{ "paramname": "eTrackingOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pmatTrackingOriginToKeyboardTransform" ,"paramtype": "const struct vr::HmdMatrix34_t *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "SetKeyboardPositionForOverlay", + "returntype": "void", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "avoidRect" ,"paramtype": "struct vr::HmdRect2_t"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "ShowMessageOverlay", + "returntype": "vr::VRMessageOverlayResponse", + "params": [ +{ "paramname": "pchText" ,"paramtype": "const char *"}, +{ "paramname": "pchCaption" ,"paramtype": "const char *"}, +{ "paramname": "pchButton0Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton1Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton2Text" ,"paramtype": "const char *"}, +{ "paramname": "pchButton3Text" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVROverlay", + "methodname": "CloseMessageOverlay", + "returntype": "void" +} +,{ + "classname": "vr::IVROverlayView", + "methodname": "AcquireOverlayView", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pNativeDevice" ,"paramtype": "struct vr::VRNativeDevice_t *"}, +{ "paramname": "pOverlayView" ,"paramtype": "struct vr::VROverlayView_t *"}, +{ "paramname": "unOverlayViewSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVROverlayView", + "methodname": "ReleaseOverlayView", + "returntype": "vr::EVROverlayError", + "params": [ +{ "paramname": "pOverlayView" ,"paramtype": "struct vr::VROverlayView_t *"} + ] +} +,{ + "classname": "vr::IVROverlayView", + "methodname": "PostOverlayEvent", + "returntype": "void", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "pvrEvent" ,"paramtype": "const struct vr::VREvent_t *"} + ] +} +,{ + "classname": "vr::IVROverlayView", + "methodname": "IsViewingPermitted", + "returntype": "bool", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "SetHeadsetViewSize", + "returntype": "void", + "params": [ +{ "paramname": "nWidth" ,"paramtype": "uint32_t"}, +{ "paramname": "nHeight" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "GetHeadsetViewSize", + "returntype": "void", + "params": [ +{ "paramname": "pnWidth" ,"paramtype": "uint32_t *"}, +{ "paramname": "pnHeight" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "SetHeadsetViewMode", + "returntype": "void", + "params": [ +{ "paramname": "eHeadsetViewMode" ,"paramtype": "vr::HeadsetViewMode_t"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "GetHeadsetViewMode", + "returntype": "vr::HeadsetViewMode_t" +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "SetHeadsetViewCropped", + "returntype": "void", + "params": [ +{ "paramname": "bCropped" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "GetHeadsetViewCropped", + "returntype": "bool" +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "GetHeadsetViewAspectRatio", + "returntype": "float" +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "SetHeadsetViewBlendRange", + "returntype": "void", + "params": [ +{ "paramname": "flStartPct" ,"paramtype": "float"}, +{ "paramname": "flEndPct" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVRHeadsetView", + "methodname": "GetHeadsetViewBlendRange", + "returntype": "void", + "params": [ +{ "paramname": "pStartPct" ,"paramtype": "float *"}, +{ "paramname": "pEndPct" ,"paramtype": "float *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "LoadRenderModel_Async", + "returntype": "vr::EVRRenderModelError", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "ppRenderModel" ,"paramtype": "struct vr::RenderModel_t **"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "FreeRenderModel", + "returntype": "void", + "params": [ +{ "paramname": "pRenderModel" ,"paramtype": "struct vr::RenderModel_t *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "LoadTexture_Async", + "returntype": "vr::EVRRenderModelError", + "params": [ +{ "paramname": "textureId" ,"paramtype": "vr::TextureID_t"}, +{ "paramname": "ppTexture" ,"paramtype": "struct vr::RenderModel_TextureMap_t **"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "FreeTexture", + "returntype": "void", + "params": [ +{ "paramname": "pTexture" ,"paramtype": "struct vr::RenderModel_TextureMap_t *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "LoadTextureD3D11_Async", + "returntype": "vr::EVRRenderModelError", + "params": [ +{ "paramname": "textureId" ,"paramtype": "vr::TextureID_t"}, +{ "paramname": "pD3D11Device" ,"paramtype": "void *"}, +{ "paramname": "ppD3D11Texture2D" ,"paramtype": "void **"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "LoadIntoTextureD3D11_Async", + "returntype": "vr::EVRRenderModelError", + "params": [ +{ "paramname": "textureId" ,"paramtype": "vr::TextureID_t"}, +{ "paramname": "pDstTexture" ,"paramtype": "void *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "FreeTextureD3D11", + "returntype": "void", + "params": [ +{ "paramname": "pD3D11Texture2D" ,"paramtype": "void *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetRenderModelName", + "returntype": "uint32_t", + "params": [ +{ "paramname": "unRenderModelIndex" ,"paramtype": "uint32_t"}, +{ "paramname": "pchRenderModelName" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unRenderModelNameLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetRenderModelCount", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentCount", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentName", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "unComponentIndex" ,"paramtype": "uint32_t"}, +{ "paramname": "pchComponentName" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unComponentNameLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentButtonMask", + "returntype": "uint64_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentRenderModelName", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentRenderModelName" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unComponentRenderModelNameLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentStateForDevicePath", + "returntype": "bool", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"}, +{ "paramname": "devicePath" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "pState" ,"paramtype": "const vr::RenderModel_ControllerMode_State_t *"}, +{ "paramname": "pComponentState" ,"paramtype": "vr::RenderModel_ComponentState_t *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetComponentState", + "returntype": "bool", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"}, +{ "paramname": "pControllerState" ,"paramtype": "const vr::VRControllerState_t *"}, +{ "paramname": "pState" ,"paramtype": "const struct vr::RenderModel_ControllerMode_State_t *"}, +{ "paramname": "pComponentState" ,"paramtype": "struct vr::RenderModel_ComponentState_t *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "RenderModelHasComponent", + "returntype": "bool", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetRenderModelThumbnailURL", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchThumbnailURL" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unThumbnailURLLen" ,"paramtype": "uint32_t"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRRenderModelError *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetRenderModelOriginalPath", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchOriginalPath" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unOriginalPathLen" ,"paramtype": "uint32_t"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRRenderModelError *"} + ] +} +,{ + "classname": "vr::IVRRenderModels", + "methodname": "GetRenderModelErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "error" ,"paramtype": "vr::EVRRenderModelError"} + ] +} +,{ + "classname": "vr::IVRNotifications", + "methodname": "CreateNotification", + "returntype": "vr::EVRNotificationError", + "params": [ +{ "paramname": "ulOverlayHandle" ,"paramtype": "vr::VROverlayHandle_t"}, +{ "paramname": "ulUserValue" ,"paramtype": "uint64_t"}, +{ "paramname": "type" ,"paramtype": "vr::EVRNotificationType"}, +{ "paramname": "pchText" ,"paramtype": "const char *"}, +{ "paramname": "style" ,"paramtype": "vr::EVRNotificationStyle"}, +{ "paramname": "pImage" ,"paramtype": "const struct vr::NotificationBitmap_t *"}, +{ "paramname": "pNotificationId" ,"paramtype": "vr::VRNotificationId *"} + ] +} +,{ + "classname": "vr::IVRNotifications", + "methodname": "RemoveNotification", + "returntype": "vr::EVRNotificationError", + "params": [ +{ "paramname": "notificationId" ,"paramtype": "vr::VRNotificationId"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "GetSettingsErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "eError" ,"paramtype": "vr::EVRSettingsError"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "SetBool", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "bValue" ,"paramtype": "bool"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "SetInt32", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "nValue" ,"paramtype": "int32_t"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "SetFloat", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "flValue" ,"paramtype": "float"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "SetString", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "GetBool", + "returntype": "bool", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "GetInt32", + "returntype": "int32_t", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "GetFloat", + "returntype": "float", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "GetString", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unValueLen" ,"paramtype": "uint32_t"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "RemoveSection", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRSettings", + "methodname": "RemoveKeyInSection", + "returntype": "void", + "params": [ +{ "paramname": "pchSection" ,"paramtype": "const char *"}, +{ "paramname": "pchSettingsKey" ,"paramtype": "const char *"}, +{ "paramname": "peError" ,"paramtype": "vr::EVRSettingsError *"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "RequestScreenshot", + "returntype": "vr::EVRScreenshotError", + "params": [ +{ "paramname": "pOutScreenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t *"}, +{ "paramname": "type" ,"paramtype": "vr::EVRScreenshotType"}, +{ "paramname": "pchPreviewFilename" ,"paramtype": "const char *"}, +{ "paramname": "pchVRFilename" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "HookScreenshot", + "returntype": "vr::EVRScreenshotError", + "params": [ +{ "paramname": "pSupportedTypes" ,"array_count": "numTypes" ,"paramtype": "const vr::EVRScreenshotType *"}, +{ "paramname": "numTypes" ,"paramtype": "int"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "GetScreenshotPropertyType", + "returntype": "vr::EVRScreenshotType", + "params": [ +{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"}, +{ "paramname": "pError" ,"paramtype": "vr::EVRScreenshotError *"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "GetScreenshotPropertyFilename", + "returntype": "uint32_t", + "params": [ +{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"}, +{ "paramname": "filenameType" ,"paramtype": "vr::EVRScreenshotPropertyFilenames"}, +{ "paramname": "pchFilename" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "cchFilename" ,"paramtype": "uint32_t"}, +{ "paramname": "pError" ,"paramtype": "vr::EVRScreenshotError *"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "UpdateScreenshotProgress", + "returntype": "vr::EVRScreenshotError", + "params": [ +{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"}, +{ "paramname": "flProgress" ,"paramtype": "float"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "TakeStereoScreenshot", + "returntype": "vr::EVRScreenshotError", + "params": [ +{ "paramname": "pOutScreenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t *"}, +{ "paramname": "pchPreviewFilename" ,"paramtype": "const char *"}, +{ "paramname": "pchVRFilename" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRScreenshots", + "methodname": "SubmitScreenshot", + "returntype": "vr::EVRScreenshotError", + "params": [ +{ "paramname": "screenshotHandle" ,"paramtype": "vr::ScreenshotHandle_t"}, +{ "paramname": "type" ,"paramtype": "vr::EVRScreenshotType"}, +{ "paramname": "pchSourcePreviewFilename" ,"paramtype": "const char *"}, +{ "paramname": "pchSourceVRFilename" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRResources", + "methodname": "LoadSharedResource", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchResourceName" ,"paramtype": "const char *"}, +{ "paramname": "pchBuffer" ,"paramtype": "char *"}, +{ "paramname": "unBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRResources", + "methodname": "GetResourceFullPath", + "returntype": "uint32_t", + "params": [ +{ "paramname": "pchResourceName" ,"paramtype": "const char *"}, +{ "paramname": "pchResourceTypeDirectory" ,"paramtype": "const char *"}, +{ "paramname": "pchPathBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferLen" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRDriverManager", + "methodname": "GetDriverCount", + "returntype": "uint32_t" +} +,{ + "classname": "vr::IVRDriverManager", + "methodname": "GetDriverName", + "returntype": "uint32_t", + "params": [ +{ "paramname": "nDriver" ,"paramtype": "vr::DriverId_t"}, +{ "paramname": "pchValue" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRDriverManager", + "methodname": "GetDriverHandle", + "returntype": "DriverHandle_t", + "params": [ +{ "paramname": "pchDriverName" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRDriverManager", + "methodname": "IsEnabled", + "returntype": "bool", + "params": [ +{ "paramname": "nDriver" ,"paramtype": "vr::DriverId_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "SetActionManifestPath", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchActionManifestPath" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetActionSetHandle", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchActionSetName" ,"paramtype": "const char *"}, +{ "paramname": "pHandle" ,"paramtype": "vr::VRActionSetHandle_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetActionHandle", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchActionName" ,"paramtype": "const char *"}, +{ "paramname": "pHandle" ,"paramtype": "vr::VRActionHandle_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetInputSourceHandle", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchInputSourcePath" ,"paramtype": "const char *"}, +{ "paramname": "pHandle" ,"paramtype": "vr::VRInputValueHandle_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "UpdateActionState", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pSets" ,"array_count": "unSetCount" ,"paramtype": "struct vr::VRActiveActionSet_t *"}, +{ "paramname": "unSizeOfVRSelectedActionSet_t" ,"paramtype": "uint32_t"}, +{ "paramname": "unSetCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetDigitalActionData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputDigitalActionData_t *"}, +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetAnalogActionData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputAnalogActionData_t *"}, +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetPoseActionDataRelativeToNow", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "fPredictedSecondsFromNow" ,"paramtype": "float"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputPoseActionData_t *"}, +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetPoseActionDataForNextFrame", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputPoseActionData_t *"}, +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalActionData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pActionData" ,"paramtype": "struct vr::InputSkeletalActionData_t *"}, +{ "paramname": "unActionDataSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetDominantHand", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "peDominantHand" ,"paramtype": "vr::ETrackedControllerRole *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "SetDominantHand", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "eDominantHand" ,"paramtype": "vr::ETrackedControllerRole"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetBoneCount", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pBoneCount" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetBoneHierarchy", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pParentIndices" ,"array_count": "unIndexArayCount" ,"paramtype": "vr::BoneIndex_t *"}, +{ "paramname": "unIndexArayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetBoneName", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "nBoneIndex" ,"paramtype": "vr::BoneIndex_t"}, +{ "paramname": "pchBoneName" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unNameBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalReferenceTransforms", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, +{ "paramname": "eReferencePose" ,"paramtype": "vr::EVRSkeletalReferencePose"}, +{ "paramname": "pTransformArray" ,"array_count": "unTransformArrayCount" ,"paramtype": "struct vr::VRBoneTransform_t *"}, +{ "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalTrackingLevel", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pSkeletalTrackingLevel" ,"paramtype": "vr::EVRSkeletalTrackingLevel *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalBoneData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, +{ "paramname": "eMotionRange" ,"paramtype": "vr::EVRSkeletalMotionRange"}, +{ "paramname": "pTransformArray" ,"array_count": "unTransformArrayCount" ,"paramtype": "struct vr::VRBoneTransform_t *"}, +{ "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalSummaryData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eSummaryType" ,"paramtype": "vr::EVRSummaryType"}, +{ "paramname": "pSkeletalSummaryData" ,"paramtype": "struct vr::VRSkeletalSummaryData_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetSkeletalBoneDataCompressed", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "eMotionRange" ,"paramtype": "vr::EVRSkeletalMotionRange"}, +{ "paramname": "pvCompressedData" ,"out_buffer_count": "unCompressedSize" ,"paramtype": "void *"}, +{ "paramname": "unCompressedSize" ,"paramtype": "uint32_t"}, +{ "paramname": "punRequiredCompressedSize" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "DecompressSkeletalBoneData", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pvCompressedBuffer" ,"paramtype": "const void *"}, +{ "paramname": "unCompressedBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "eTransformSpace" ,"paramtype": "vr::EVRSkeletalTransformSpace"}, +{ "paramname": "pTransformArray" ,"array_count": "unTransformArrayCount" ,"paramtype": "struct vr::VRBoneTransform_t *"}, +{ "paramname": "unTransformArrayCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "TriggerHapticVibrationAction", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "fStartSecondsFromNow" ,"paramtype": "float"}, +{ "paramname": "fDurationSeconds" ,"paramtype": "float"}, +{ "paramname": "fFrequency" ,"paramtype": "float"}, +{ "paramname": "fAmplitude" ,"paramtype": "float"}, +{ "paramname": "ulRestrictToDevice" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetActionOrigins", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "actionSetHandle" ,"paramtype": "vr::VRActionSetHandle_t"}, +{ "paramname": "digitalActionHandle" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "originsOut" ,"array_count": "originOutCount" ,"paramtype": "vr::VRInputValueHandle_t *"}, +{ "paramname": "originOutCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetOriginLocalizedName", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "origin" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "pchNameArray" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unNameArraySize" ,"paramtype": "uint32_t"}, +{ "paramname": "unStringSectionsToInclude" ,"paramtype": "int32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetOriginTrackedDeviceInfo", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "origin" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "pOriginInfo" ,"paramtype": "struct vr::InputOriginInfo_t *"}, +{ "paramname": "unOriginInfoSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetActionBindingInfo", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "action" ,"paramtype": "vr::VRActionHandle_t"}, +{ "paramname": "pOriginInfo" ,"paramtype": "struct vr::InputBindingInfo_t *"}, +{ "paramname": "unBindingInfoSize" ,"paramtype": "uint32_t"}, +{ "paramname": "unBindingInfoCount" ,"paramtype": "uint32_t"}, +{ "paramname": "punReturnedBindingInfoCount" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "ShowActionOrigins", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "actionSetHandle" ,"paramtype": "vr::VRActionSetHandle_t"}, +{ "paramname": "ulActionHandle" ,"paramtype": "vr::VRActionHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "ShowBindingsForActionSet", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pSets" ,"array_count": "unSetCount" ,"paramtype": "struct vr::VRActiveActionSet_t *"}, +{ "paramname": "unSizeOfVRSelectedActionSet_t" ,"paramtype": "uint32_t"}, +{ "paramname": "unSetCount" ,"paramtype": "uint32_t"}, +{ "paramname": "originToHighlight" ,"paramtype": "vr::VRInputValueHandle_t"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetComponentStateForBinding", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchRenderModelName" ,"paramtype": "const char *"}, +{ "paramname": "pchComponentName" ,"paramtype": "const char *"}, +{ "paramname": "pOriginInfo" ,"paramtype": "const struct vr::InputBindingInfo_t *"}, +{ "paramname": "unBindingInfoSize" ,"paramtype": "uint32_t"}, +{ "paramname": "unBindingInfoCount" ,"paramtype": "uint32_t"}, +{ "paramname": "pComponentState" ,"paramtype": "vr::RenderModel_ComponentState_t *"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "IsUsingLegacyInput", + "returntype": "bool" +} +,{ + "classname": "vr::IVRInput", + "methodname": "OpenBindingUI", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "pchAppKey" ,"paramtype": "const char *"}, +{ "paramname": "ulActionSetHandle" ,"paramtype": "vr::VRActionSetHandle_t"}, +{ "paramname": "ulDeviceHandle" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "bShowOnDesktop" ,"paramtype": "bool"} + ] +} +,{ + "classname": "vr::IVRInput", + "methodname": "GetBindingVariant", + "returntype": "vr::EVRInputError", + "params": [ +{ "paramname": "ulDevicePath" ,"paramtype": "vr::VRInputValueHandle_t"}, +{ "paramname": "pchVariantArray" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unVariantArraySize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "Open", + "returntype": "vr::EIOBufferError", + "params": [ +{ "paramname": "pchPath" ,"paramtype": "const char *"}, +{ "paramname": "mode" ,"paramtype": "vr::EIOBufferMode"}, +{ "paramname": "unElementSize" ,"paramtype": "uint32_t"}, +{ "paramname": "unElements" ,"paramtype": "uint32_t"}, +{ "paramname": "pulBuffer" ,"paramtype": "vr::IOBufferHandle_t *"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "Close", + "returntype": "vr::EIOBufferError", + "params": [ +{ "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "Read", + "returntype": "vr::EIOBufferError", + "params": [ +{ "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"}, +{ "paramname": "pDst" ,"paramtype": "void *"}, +{ "paramname": "unBytes" ,"paramtype": "uint32_t"}, +{ "paramname": "punRead" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "Write", + "returntype": "vr::EIOBufferError", + "params": [ +{ "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"}, +{ "paramname": "pSrc" ,"paramtype": "void *"}, +{ "paramname": "unBytes" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "PropertyContainer", + "returntype": "vr::PropertyContainerHandle_t", + "params": [ +{ "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"} + ] +} +,{ + "classname": "vr::IVRIOBuffer", + "methodname": "HasReaders", + "returntype": "bool", + "params": [ +{ "paramname": "ulBuffer" ,"paramtype": "vr::IOBufferHandle_t"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "CreateSpatialAnchorFromDescriptor", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "pchDescriptor" ,"paramtype": "const char *"}, +{ "paramname": "pHandleOut" ,"paramtype": "vr::SpatialAnchorHandle_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "CreateSpatialAnchorFromPose", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pPose" ,"paramtype": "struct vr::SpatialAnchorPose_t *"}, +{ "paramname": "pHandleOut" ,"paramtype": "vr::SpatialAnchorHandle_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "GetSpatialAnchorPose", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unHandle" ,"paramtype": "vr::SpatialAnchorHandle_t"}, +{ "paramname": "eOrigin" ,"paramtype": "vr::ETrackingUniverseOrigin"}, +{ "paramname": "pPoseOut" ,"paramtype": "struct vr::SpatialAnchorPose_t *"} + ] +} +,{ + "classname": "vr::IVRSpatialAnchors", + "methodname": "GetSpatialAnchorDescriptor", + "returntype": "vr::EVRSpatialAnchorError", + "params": [ +{ "paramname": "unHandle" ,"paramtype": "vr::SpatialAnchorHandle_t"}, +{ "paramname": "pchDescriptorOut" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "punDescriptorBufferLenInOut" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRDebug", + "methodname": "EmitVrProfilerEvent", + "returntype": "vr::EVRDebugError", + "params": [ +{ "paramname": "pchMessage" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRDebug", + "methodname": "BeginVrProfilerEvent", + "returntype": "vr::EVRDebugError", + "params": [ +{ "paramname": "pHandleOut" ,"paramtype": "vr::VrProfilerEventHandle_t *"} + ] +} +,{ + "classname": "vr::IVRDebug", + "methodname": "FinishVrProfilerEvent", + "returntype": "vr::EVRDebugError", + "params": [ +{ "paramname": "hHandle" ,"paramtype": "vr::VrProfilerEventHandle_t"}, +{ "paramname": "pchMessage" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRDebug", + "methodname": "DriverDebugRequest", + "returntype": "uint32_t", + "params": [ +{ "paramname": "unDeviceIndex" ,"paramtype": "vr::TrackedDeviceIndex_t"}, +{ "paramname": "pchRequest" ,"paramtype": "const char *"}, +{ "paramname": "pchResponseBuffer" ,"out_string": " " ,"paramtype": "char *"}, +{ "paramname": "unResponseBufferSize" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRProperties", + "methodname": "ReadPropertyBatch", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "ulContainerHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pBatch" ,"paramtype": "struct vr::PropertyRead_t *"}, +{ "paramname": "unBatchEntryCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRProperties", + "methodname": "WritePropertyBatch", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "ulContainerHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pBatch" ,"paramtype": "struct vr::PropertyWrite_t *"}, +{ "paramname": "unBatchEntryCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRProperties", + "methodname": "GetPropErrorNameFromEnum", + "returntype": "const char *", + "params": [ +{ "paramname": "error" ,"paramtype": "vr::ETrackedPropertyError"} + ] +} +,{ + "classname": "vr::IVRProperties", + "methodname": "TrackedDeviceToPropertyContainer", + "returntype": "PropertyContainerHandle_t", + "params": [ +{ "paramname": "nDevice" ,"paramtype": "vr::TrackedDeviceIndex_t"} + ] +} +,{ + "classname": "vr::IVRPaths", + "methodname": "ReadPathBatch", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "ulRootHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pBatch" ,"paramtype": "struct vr::PathRead_t *"}, +{ "paramname": "unBatchEntryCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRPaths", + "methodname": "WritePathBatch", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "ulRootHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pBatch" ,"paramtype": "struct vr::PathWrite_t *"}, +{ "paramname": "unBatchEntryCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRPaths", + "methodname": "StringToHandle", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "pHandle" ,"paramtype": "vr::PathHandle_t *"}, +{ "paramname": "pchPath" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRPaths", + "methodname": "HandleToString", + "returntype": "vr::ETrackedPropertyError", + "params": [ +{ "paramname": "pHandle" ,"paramtype": "vr::PathHandle_t"}, +{ "paramname": "pchBuffer" ,"paramtype": "char *"}, +{ "paramname": "unBufferSize" ,"paramtype": "uint32_t"}, +{ "paramname": "punBufferSizeUsed" ,"paramtype": "uint32_t *"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "Create", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "pulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t *"}, +{ "paramname": "pchPath" ,"paramtype": "const char *"}, +{ "paramname": "unBlockDataSize" ,"paramtype": "uint32_t"}, +{ "paramname": "unBlockHeaderSize" ,"paramtype": "uint32_t"}, +{ "paramname": "unBlockCount" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "Connect", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "pulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t *"}, +{ "paramname": "pchPath" ,"paramtype": "const char *"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "Destroy", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "AcquireWriteOnlyBlock", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pulBlockHandle" ,"paramtype": "vr::PropertyContainerHandle_t *"}, +{ "paramname": "ppvBuffer" ,"paramtype": "void **"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "ReleaseWriteOnlyBlock", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "ulBlockHandle" ,"paramtype": "vr::PropertyContainerHandle_t"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "WaitAndAcquireReadOnlyBlock", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pulBlockHandle" ,"paramtype": "vr::PropertyContainerHandle_t *"}, +{ "paramname": "ppvBuffer" ,"paramtype": "const void **"}, +{ "paramname": "eReadType" ,"paramtype": "vr::EBlockQueueReadType"}, +{ "paramname": "unTimeoutMs" ,"paramtype": "uint32_t"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "AcquireReadOnlyBlock", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pulBlockHandle" ,"paramtype": "vr::PropertyContainerHandle_t *"}, +{ "paramname": "ppvBuffer" ,"paramtype": "const void **"}, +{ "paramname": "eReadType" ,"paramtype": "vr::EBlockQueueReadType"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "ReleaseReadOnlyBlock", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "ulBlockHandle" ,"paramtype": "vr::PropertyContainerHandle_t"} + ] +} +,{ + "classname": "vr::IVRBlockQueue", + "methodname": "QueueHasReader", + "returntype": "vr::EBlockQueueError", + "params": [ +{ "paramname": "ulQueueHandle" ,"paramtype": "vr::PropertyContainerHandle_t"}, +{ "paramname": "pbHasReaders" ,"paramtype": "bool *"} + ] +} +] +} \ No newline at end of file diff --git a/contrib/openvr/headers/openvr_capi.h b/contrib/openvr/headers/openvr_capi.h new file mode 100755 index 0000000..3c32c59 --- /dev/null +++ b/contrib/openvr/headers/openvr_capi.h @@ -0,0 +1,3125 @@ +//======= Copyright (c) Valve Corporation, All rights reserved. =============== +// +// Purpose: Header for flatted SteamAPI. Use this for binding to other languages. +// This file is auto-generated, do not edit it. +// +//============================================================================= + +#ifndef __OPENVR_API_FLAT_H__ +#define __OPENVR_API_FLAT_H__ +#if defined( _WIN32 ) || defined( __clang__ ) +#pragma once +#endif + +#ifdef __cplusplus +#define EXTERN_C extern "C" +#else +#define EXTERN_C +#endif + +#if defined( _WIN32 ) +#define OPENVR_FNTABLE_CALLTYPE __stdcall +#else +#define OPENVR_FNTABLE_CALLTYPE +#endif + +// OPENVR API export macro +#if defined( _WIN32 ) && !defined( _X360 ) + #if defined( OPENVR_API_EXPORTS ) + #define S_API EXTERN_C __declspec( dllexport ) + #elif defined( OPENVR_API_NODLL ) + #define S_API EXTERN_C + #else + #define S_API extern "C" __declspec( dllimport ) + #endif // OPENVR_API_EXPORTS +#elif defined( __GNUC__ ) + #if defined( OPENVR_API_EXPORTS ) + #define S_API EXTERN_C __attribute__ ((visibility("default"))) + #else + #define S_API EXTERN_C + #endif // OPENVR_API_EXPORTS +#else // !WIN32 + #if defined( OPENVR_API_EXPORTS ) + #define S_API EXTERN_C + #else + #define S_API EXTERN_C + #endif // OPENVR_API_EXPORTS +#endif + +#include + +#if defined( __WIN32 ) +typedef char bool; +#else +#include +#endif + +typedef uint64_t PropertyContainerHandle_t; +typedef uint32_t PropertyTypeTag_t; +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; +typedef uint64_t PathHandle_t; + + +// OpenVR Constants + +static const unsigned long k_nDriverNone = 4294967295; +static const unsigned long k_unMaxDriverDebugResponseSize = 32768; +static const unsigned long k_unTrackedDeviceIndex_Hmd = 0; +static const unsigned long k_unMaxTrackedDeviceCount = 64; +static const unsigned long k_unTrackedDeviceIndexOther = 4294967294; +static const unsigned long k_unTrackedDeviceIndexInvalid = 4294967295; +static const unsigned long long k_ulInvalidPropertyContainer = 0; +static const unsigned long k_unInvalidPropertyTag = 0; +static const unsigned long long k_ulInvalidDriverHandle = 0; +static const unsigned long k_unFloatPropertyTag = 1; +static const unsigned long k_unInt32PropertyTag = 2; +static const unsigned long k_unUint64PropertyTag = 3; +static const unsigned long k_unBoolPropertyTag = 4; +static const unsigned long k_unStringPropertyTag = 5; +static const unsigned long k_unErrorPropertyTag = 6; +static const unsigned long k_unDoublePropertyTag = 7; +static const unsigned long k_unHmdMatrix34PropertyTag = 20; +static const unsigned long k_unHmdMatrix44PropertyTag = 21; +static const unsigned long k_unHmdVector3PropertyTag = 22; +static const unsigned long k_unHmdVector4PropertyTag = 23; +static const unsigned long k_unHmdVector2PropertyTag = 24; +static const unsigned long k_unHmdQuadPropertyTag = 25; +static const unsigned long k_unHiddenAreaPropertyTag = 30; +static const unsigned long k_unPathHandleInfoTag = 31; +static const unsigned long k_unActionPropertyTag = 32; +static const unsigned long k_unInputValuePropertyTag = 33; +static const unsigned long k_unWildcardPropertyTag = 34; +static const unsigned long k_unHapticVibrationPropertyTag = 35; +static const unsigned long k_unSkeletonPropertyTag = 36; +static const unsigned long k_unSpatialAnchorPosePropertyTag = 40; +static const unsigned long k_unJsonPropertyTag = 41; +static const unsigned long k_unActiveActionSetPropertyTag = 42; +static const unsigned long k_unOpenVRInternalReserved_Start = 1000; +static const unsigned long k_unOpenVRInternalReserved_End = 10000; +static const unsigned long k_unMaxPropertyStringSize = 32768; +static const unsigned long long k_ulInvalidActionHandle = 0; +static const unsigned long long k_ulInvalidActionSetHandle = 0; +static const unsigned long long k_ulInvalidInputValueHandle = 0; +static const unsigned long k_unControllerStateAxisCount = 5; +static const unsigned long long k_ulOverlayHandleInvalid = 0; +static const unsigned long k_unMaxDistortionFunctionParameters = 8; +static const unsigned long k_unScreenshotHandleInvalid = 0; +static const char * IVRSystem_Version = "IVRSystem_022"; +static const char * IVRExtendedDisplay_Version = "IVRExtendedDisplay_001"; +static const char * IVRTrackedCamera_Version = "IVRTrackedCamera_006"; +static const unsigned long k_unMaxApplicationKeyLength = 128; +static const char * k_pch_MimeType_HomeApp = "vr/home"; +static const char * k_pch_MimeType_GameTheater = "vr/game_theater"; +static const char * IVRApplications_Version = "IVRApplications_007"; +static const char * IVRChaperone_Version = "IVRChaperone_004"; +static const char * IVRChaperoneSetup_Version = "IVRChaperoneSetup_006"; +static const char * IVRCompositor_Version = "IVRCompositor_027"; +static const unsigned long k_unVROverlayMaxKeyLength = 128; +static const unsigned long k_unVROverlayMaxNameLength = 128; +static const unsigned long k_unMaxOverlayCount = 128; +static const unsigned long k_unMaxOverlayIntersectionMaskPrimitivesCount = 32; +static const char * IVROverlay_Version = "IVROverlay_025"; +static const char * IVROverlayView_Version = "IVROverlayView_003"; +static const unsigned long k_unHeadsetViewMaxWidth = 3840; +static const unsigned long k_unHeadsetViewMaxHeight = 2160; +static const char * k_pchHeadsetViewOverlayKey = "system.HeadsetView"; +static const char * IVRHeadsetView_Version = "IVRHeadsetView_001"; +static const char * k_pch_Controller_Component_GDC2015 = "gdc2015"; +static const char * k_pch_Controller_Component_Base = "base"; +static const char * k_pch_Controller_Component_Tip = "tip"; +static const char * k_pch_Controller_Component_HandGrip = "handgrip"; +static const char * k_pch_Controller_Component_Status = "status"; +static const char * IVRRenderModels_Version = "IVRRenderModels_006"; +static const unsigned long k_unNotificationTextMaxSize = 256; +static const char * IVRNotifications_Version = "IVRNotifications_002"; +static const unsigned long k_unMaxSettingsKeyLength = 128; +static const char * IVRSettings_Version = "IVRSettings_003"; +static const char * k_pch_SteamVR_Section = "steamvr"; +static const char * k_pch_SteamVR_RequireHmd_String = "requireHmd"; +static const char * k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; +static const char * k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; +static const char * k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; +static const char * k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; +static const char * k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; +static const char * k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; +static const char * k_pch_SteamVR_SendSystemButtonToAllApps_Bool = "sendSystemButtonToAllApps"; +static const char * k_pch_SteamVR_LogLevel_Int32 = "loglevel"; +static const char * k_pch_SteamVR_IPD_Float = "ipd"; +static const char * k_pch_SteamVR_Background_String = "background"; +static const char * k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; +static const char * k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; +static const char * k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; +static const char * k_pch_SteamVR_GridColor_String = "gridColor"; +static const char * k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; +static const char * k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor"; +static const char * k_pch_SteamVR_ShowStage_Bool = "showStage"; +static const char * k_pch_SteamVR_DrawTrackingReferences_Bool = "drawTrackingReferences"; +static const char * k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; +static const char * k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; +static const char * k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; +static const char * k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement"; +static const char * k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip"; +static const char * k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; +static const char * k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; +static const char * k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution"; +static const char * k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing"; +static const char * k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride"; +static const char * k_pch_SteamVR_FramesToThrottle_Int32 = "framesToThrottle"; +static const char * k_pch_SteamVR_AdditionalFramesToPredict_Int32 = "additionalFramesToPredict"; +static const char * k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync"; +static const char * k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; +static const char * k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView"; +static const char * k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView"; +static const char * k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView"; +static const char * k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode"; +static const char * k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye"; +static const char * k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; +static const char * k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized"; +static const char * k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph"; +static const char * k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; +static const char * k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; +static const char * k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; +static const char * k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; +static const char * k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; +static const char * k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; +static const char * k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; +static const char * k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; +static const char * k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; +static const char * k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; +static const char * k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; +static const char * k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; +static const char * k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; +static const char * k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; +static const char * k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; +static const char * k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid"; +static const char * k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; +static const char * k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling"; +static const char * k_pch_SteamVR_EnableSafeMode = "enableSafeMode"; +static const char * k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate"; +static const char * k_pch_SteamVR_LastVersionNotice = "lastVersionNotice"; +static const char * k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate"; +static const char * k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR"; +static const char * k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG"; +static const char * k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB"; +static const char * k_pch_SteamVR_CustomIconStyle_String = "customIconStyle"; +static const char * k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle"; +static const char * k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate"; +static const char * k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority"; +static const char * k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2"; +static const char * k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption"; +static const char * k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches"; +static const char * k_pch_SteamVR_HDCPLegacyCompatibility_Bool = "hdcp14legacyCompatibility"; +static const char * k_pch_SteamVR_UsePrism_Bool = "usePrism"; +static const char * k_pch_DirectMode_Section = "direct_mode"; +static const char * k_pch_DirectMode_Enable_Bool = "enable"; +static const char * k_pch_DirectMode_Count_Int32 = "count"; +static const char * k_pch_DirectMode_EdidVid_Int32 = "edidVid"; +static const char * k_pch_DirectMode_EdidPid_Int32 = "edidPid"; +static const char * k_pch_Lighthouse_Section = "driver_lighthouse"; +static const char * k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; +static const char * k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; +static const char * k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; +static const char * k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; +static const char * k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; +static const char * k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; +static const char * k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; +static const char * k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; +static const char * k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2"; +static const char * k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations"; +static const char * k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback"; +static const char * k_pch_Null_Section = "driver_null"; +static const char * k_pch_Null_SerialNumber_String = "serialNumber"; +static const char * k_pch_Null_ModelNumber_String = "modelNumber"; +static const char * k_pch_Null_WindowX_Int32 = "windowX"; +static const char * k_pch_Null_WindowY_Int32 = "windowY"; +static const char * k_pch_Null_WindowWidth_Int32 = "windowWidth"; +static const char * k_pch_Null_WindowHeight_Int32 = "windowHeight"; +static const char * k_pch_Null_RenderWidth_Int32 = "renderWidth"; +static const char * k_pch_Null_RenderHeight_Int32 = "renderHeight"; +static const char * k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; +static const char * k_pch_Null_DisplayFrequency_Float = "displayFrequency"; +static const char * k_pch_WindowsMR_Section = "driver_holographic"; +static const char * k_pch_UserInterface_Section = "userinterface"; +static const char * k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; +static const char * k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; +static const char * k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized"; +static const char * k_pch_UserInterface_Screenshots_Bool = "screenshots"; +static const char * k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; +static const char * k_pch_Notifications_Section = "notifications"; +static const char * k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; +static const char * k_pch_Keyboard_Section = "keyboard"; +static const char * k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; +static const char * k_pch_Keyboard_ScaleX = "ScaleX"; +static const char * k_pch_Keyboard_ScaleY = "ScaleY"; +static const char * k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; +static const char * k_pch_Keyboard_OffsetRightX = "OffsetRightX"; +static const char * k_pch_Keyboard_OffsetY = "OffsetY"; +static const char * k_pch_Keyboard_Smoothing = "Smoothing"; +static const char * k_pch_Perf_Section = "perfcheck"; +static const char * k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD"; +static const char * k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; +static const char * k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; +static const char * k_pch_Perf_TestData_Float = "perfTestData"; +static const char * k_pch_Perf_GPUProfiling_Bool = "GPUProfiling"; +static const char * k_pch_CollisionBounds_Section = "collisionBounds"; +static const char * k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; +static const char * k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; +static const char * k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; +static const char * k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; +static const char * k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; +static const char * k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight"; +static const char * k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; +static const char * k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; +static const char * k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; +static const char * k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; +static const char * k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport"; +static const char * k_pch_Camera_Section = "camera"; +static const char * k_pch_Camera_EnableCamera_Bool = "enableCamera"; +static const char * k_pch_Camera_ShowOnController_Bool = "showOnController"; +static const char * k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; +static const char * k_pch_Camera_RoomView_Int32 = "roomView"; +static const char * k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; +static const char * k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; +static const char * k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; +static const char * k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; +static const char * k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; +static const char * k_pch_Camera_RoomViewStyle_Int32 = "roomViewStyle"; +static const char * k_pch_audio_Section = "audio"; +static const char * k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice"; +static const char * k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride"; +static const char * k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride"; +static const char * k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName"; +static const char * k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice"; +static const char * k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride"; +static const char * k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride"; +static const char * k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName"; +static const char * k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror"; +static const char * k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice"; +static const char * k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName"; +static const char * k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; +static const char * k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice"; +static const char * k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume"; +static const char * k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId"; +static const char * k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; +static const char * k_pch_audio_DualSpeakerAndJackOutput_Bool = "dualSpeakerAndJackOutput"; +static const char * k_pch_audio_MuteMicMonitor_Bool = "muteMicMonitor"; +static const char * k_pch_Power_Section = "power"; +static const char * k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; +static const char * k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; +static const char * k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; +static const char * k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; +static const char * k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; +static const char * k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; +static const char * k_pch_Dashboard_Section = "dashboard"; +static const char * k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; +static const char * k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; +static const char * k_pch_Dashboard_Position = "position"; +static const char * k_pch_Dashboard_DesktopScale = "desktopScale"; +static const char * k_pch_Dashboard_DashboardScale = "dashboardScale"; +static const char * k_pch_Dashboard_UseStandaloneSystemLayer = "standaloneSystemLayer"; +static const char * k_pch_modelskin_Section = "modelskins"; +static const char * k_pch_Driver_Enable_Bool = "enable"; +static const char * k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode"; +static const char * k_pch_Driver_LoadPriority_Int32 = "loadPriority"; +static const char * k_pch_WebInterface_Section = "WebInterface"; +static const char * k_pch_VRWebHelper_Section = "VRWebHelper"; +static const char * k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled"; +static const char * k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort"; +static const char * k_pch_TrackingOverride_Section = "TrackingOverrides"; +static const char * k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; +static const char * k_pch_App_BindingLegacyAPISuffix_String = "_legacy"; +static const char * k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput"; +static const char * k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; +static const char * k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL"; +static const char * k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; +static const char * k_pch_App_DominantHand_Int32 = "DominantHand"; +static const char * k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK"; +static const char * k_pch_Trackers_Section = "trackers"; +static const char * k_pch_DesktopUI_Section = "DesktopUI"; +static const char * k_pch_LastKnown_Section = "LastKnown"; +static const char * k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer"; +static const char * k_pch_LastKnown_HMDModel_String = "HMDModel"; +static const char * k_pch_DismissedWarnings_Section = "DismissedWarnings"; +static const char * k_pch_Input_Section = "input"; +static const char * k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation"; +static const char * k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation"; +static const char * k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone"; +static const char * k_pch_GpuSpeed_Section = "GpuSpeed"; +static const char * IVRScreenshots_Version = "IVRScreenshots_001"; +static const char * IVRResources_Version = "IVRResources_001"; +static const char * IVRDriverManager_Version = "IVRDriverManager_001"; +static const unsigned long k_unMaxActionNameLength = 64; +static const unsigned long k_unMaxActionSetNameLength = 64; +static const unsigned long k_unMaxActionOriginCount = 16; +static const unsigned long k_unMaxBoneNameLength = 32; +static const int k_nActionSetOverlayGlobalPriorityMin = 16777216; +static const int k_nActionSetOverlayGlobalPriorityMax = 33554431; +static const int k_nActionSetPriorityReservedMin = 33554432; +static const char * IVRInput_Version = "IVRInput_010"; +static const unsigned long long k_ulInvalidIOBufferHandle = 0; +static const char * IVRIOBuffer_Version = "IVRIOBuffer_002"; +static const unsigned long k_ulInvalidSpatialAnchorHandle = 0; +static const char * IVRSpatialAnchors_Version = "IVRSpatialAnchors_001"; +static const char * IVRDebug_Version = "IVRDebug_001"; +static const unsigned long long k_ulDisplayRedirectContainer = 25769803779; +static const char * IVRProperties_Version = "IVRProperties_001"; +static const char * k_pchPathUserHandRight = "/user/hand/right"; +static const char * k_pchPathUserHandLeft = "/user/hand/left"; +static const char * k_pchPathUserHandPrimary = "/user/hand/primary"; +static const char * k_pchPathUserHandSecondary = "/user/hand/secondary"; +static const char * k_pchPathUserHead = "/user/head"; +static const char * k_pchPathUserGamepad = "/user/gamepad"; +static const char * k_pchPathUserTreadmill = "/user/treadmill"; +static const char * k_pchPathUserStylus = "/user/stylus"; +static const char * k_pchPathDevices = "/devices"; +static const char * k_pchPathDevicePath = "/device_path"; +static const char * k_pchPathBestAliasPath = "/best_alias_path"; +static const char * k_pchPathBoundTrackerAliasPath = "/bound_tracker_path"; +static const char * k_pchPathBoundTrackerRole = "/bound_tracker_role"; +static const char * k_pchPathPoseRaw = "/pose/raw"; +static const char * k_pchPathPoseTip = "/pose/tip"; +static const char * k_pchPathPoseGrip = "/pose/grip"; +static const char * k_pchPathSystemButtonClick = "/input/system/click"; +static const char * k_pchPathProximity = "/proximity"; +static const char * k_pchPathControllerTypePrefix = "/controller_type/"; +static const char * k_pchPathInputProfileSuffix = "/input_profile"; +static const char * k_pchPathBindingNameSuffix = "/binding_name"; +static const char * k_pchPathBindingUrlSuffix = "/binding_url"; +static const char * k_pchPathBindingErrorSuffix = "/binding_error"; +static const char * k_pchPathActiveActionSets = "/active_action_sets"; +static const char * k_pchPathComponentUpdates = "/total_component_updates"; +static const char * k_pchPathUserFootLeft = "/user/foot/left"; +static const char * k_pchPathUserFootRight = "/user/foot/right"; +static const char * k_pchPathUserShoulderLeft = "/user/shoulder/left"; +static const char * k_pchPathUserShoulderRight = "/user/shoulder/right"; +static const char * k_pchPathUserElbowLeft = "/user/elbow/left"; +static const char * k_pchPathUserElbowRight = "/user/elbow/right"; +static const char * k_pchPathUserKneeLeft = "/user/knee/left"; +static const char * k_pchPathUserKneeRight = "/user/knee/right"; +static const char * k_pchPathUserWaist = "/user/waist"; +static const char * k_pchPathUserChest = "/user/chest"; +static const char * k_pchPathUserCamera = "/user/camera"; +static const char * k_pchPathUserKeyboard = "/user/keyboard"; +static const char * k_pchPathClientAppKey = "/client_info/app_key"; +static const unsigned long long k_ulInvalidPathHandle = 0; +static const char * IVRPaths_Version = "IVRPaths_001"; +static const char * IVRBlockQueue_Version = "IVRBlockQueue_004"; + +// OpenVR Enums + +typedef enum EVREye +{ + EVREye_Eye_Left = 0, + EVREye_Eye_Right = 1, +} EVREye; + +typedef enum ETextureType +{ + ETextureType_TextureType_Invalid = -1, + ETextureType_TextureType_DirectX = 0, + ETextureType_TextureType_OpenGL = 1, + ETextureType_TextureType_Vulkan = 2, + ETextureType_TextureType_IOSurface = 3, + ETextureType_TextureType_DirectX12 = 4, + ETextureType_TextureType_DXGISharedHandle = 5, + ETextureType_TextureType_Metal = 6, +} ETextureType; + +typedef enum EColorSpace +{ + EColorSpace_ColorSpace_Auto = 0, + EColorSpace_ColorSpace_Gamma = 1, + EColorSpace_ColorSpace_Linear = 2, +} EColorSpace; + +typedef enum ETrackingResult +{ + ETrackingResult_TrackingResult_Uninitialized = 1, + ETrackingResult_TrackingResult_Calibrating_InProgress = 100, + ETrackingResult_TrackingResult_Calibrating_OutOfRange = 101, + ETrackingResult_TrackingResult_Running_OK = 200, + ETrackingResult_TrackingResult_Running_OutOfRange = 201, + ETrackingResult_TrackingResult_Fallback_RotationOnly = 300, +} ETrackingResult; + +typedef enum ETrackedDeviceClass +{ + ETrackedDeviceClass_TrackedDeviceClass_Invalid = 0, + ETrackedDeviceClass_TrackedDeviceClass_HMD = 1, + ETrackedDeviceClass_TrackedDeviceClass_Controller = 2, + ETrackedDeviceClass_TrackedDeviceClass_GenericTracker = 3, + ETrackedDeviceClass_TrackedDeviceClass_TrackingReference = 4, + ETrackedDeviceClass_TrackedDeviceClass_DisplayRedirect = 5, + ETrackedDeviceClass_TrackedDeviceClass_Max = 6, +} ETrackedDeviceClass; + +typedef enum ETrackedControllerRole +{ + ETrackedControllerRole_TrackedControllerRole_Invalid = 0, + ETrackedControllerRole_TrackedControllerRole_LeftHand = 1, + ETrackedControllerRole_TrackedControllerRole_RightHand = 2, + ETrackedControllerRole_TrackedControllerRole_OptOut = 3, + ETrackedControllerRole_TrackedControllerRole_Treadmill = 4, + ETrackedControllerRole_TrackedControllerRole_Stylus = 5, + ETrackedControllerRole_TrackedControllerRole_Max = 5, +} ETrackedControllerRole; + +typedef enum ETrackingUniverseOrigin +{ + ETrackingUniverseOrigin_TrackingUniverseSeated = 0, + ETrackingUniverseOrigin_TrackingUniverseStanding = 1, + ETrackingUniverseOrigin_TrackingUniverseRawAndUncalibrated = 2, +} ETrackingUniverseOrigin; + +typedef enum EAdditionalRadioFeatures +{ + EAdditionalRadioFeatures_AdditionalRadioFeatures_None = 0, + EAdditionalRadioFeatures_AdditionalRadioFeatures_HTCLinkBox = 1, + EAdditionalRadioFeatures_AdditionalRadioFeatures_InternalDongle = 2, + EAdditionalRadioFeatures_AdditionalRadioFeatures_ExternalDongle = 4, +} EAdditionalRadioFeatures; + +typedef enum ETrackedDeviceProperty +{ + ETrackedDeviceProperty_Prop_Invalid = 0, + ETrackedDeviceProperty_Prop_TrackingSystemName_String = 1000, + ETrackedDeviceProperty_Prop_ModelNumber_String = 1001, + ETrackedDeviceProperty_Prop_SerialNumber_String = 1002, + ETrackedDeviceProperty_Prop_RenderModelName_String = 1003, + ETrackedDeviceProperty_Prop_WillDriftInYaw_Bool = 1004, + ETrackedDeviceProperty_Prop_ManufacturerName_String = 1005, + ETrackedDeviceProperty_Prop_TrackingFirmwareVersion_String = 1006, + ETrackedDeviceProperty_Prop_HardwareRevision_String = 1007, + ETrackedDeviceProperty_Prop_AllWirelessDongleDescriptions_String = 1008, + ETrackedDeviceProperty_Prop_ConnectedWirelessDongle_String = 1009, + ETrackedDeviceProperty_Prop_DeviceIsWireless_Bool = 1010, + ETrackedDeviceProperty_Prop_DeviceIsCharging_Bool = 1011, + ETrackedDeviceProperty_Prop_DeviceBatteryPercentage_Float = 1012, + ETrackedDeviceProperty_Prop_StatusDisplayTransform_Matrix34 = 1013, + ETrackedDeviceProperty_Prop_Firmware_UpdateAvailable_Bool = 1014, + ETrackedDeviceProperty_Prop_Firmware_ManualUpdate_Bool = 1015, + ETrackedDeviceProperty_Prop_Firmware_ManualUpdateURL_String = 1016, + ETrackedDeviceProperty_Prop_HardwareRevision_Uint64 = 1017, + ETrackedDeviceProperty_Prop_FirmwareVersion_Uint64 = 1018, + ETrackedDeviceProperty_Prop_FPGAVersion_Uint64 = 1019, + ETrackedDeviceProperty_Prop_VRCVersion_Uint64 = 1020, + ETrackedDeviceProperty_Prop_RadioVersion_Uint64 = 1021, + ETrackedDeviceProperty_Prop_DongleVersion_Uint64 = 1022, + ETrackedDeviceProperty_Prop_BlockServerShutdown_Bool = 1023, + ETrackedDeviceProperty_Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, + ETrackedDeviceProperty_Prop_ContainsProximitySensor_Bool = 1025, + ETrackedDeviceProperty_Prop_DeviceProvidesBatteryStatus_Bool = 1026, + ETrackedDeviceProperty_Prop_DeviceCanPowerOff_Bool = 1027, + ETrackedDeviceProperty_Prop_Firmware_ProgrammingTarget_String = 1028, + ETrackedDeviceProperty_Prop_DeviceClass_Int32 = 1029, + ETrackedDeviceProperty_Prop_HasCamera_Bool = 1030, + ETrackedDeviceProperty_Prop_DriverVersion_String = 1031, + ETrackedDeviceProperty_Prop_Firmware_ForceUpdateRequired_Bool = 1032, + ETrackedDeviceProperty_Prop_ViveSystemButtonFixRequired_Bool = 1033, + ETrackedDeviceProperty_Prop_ParentDriver_Uint64 = 1034, + ETrackedDeviceProperty_Prop_ResourceRoot_String = 1035, + ETrackedDeviceProperty_Prop_RegisteredDeviceType_String = 1036, + ETrackedDeviceProperty_Prop_InputProfilePath_String = 1037, + ETrackedDeviceProperty_Prop_NeverTracked_Bool = 1038, + ETrackedDeviceProperty_Prop_NumCameras_Int32 = 1039, + ETrackedDeviceProperty_Prop_CameraFrameLayout_Int32 = 1040, + ETrackedDeviceProperty_Prop_CameraStreamFormat_Int32 = 1041, + ETrackedDeviceProperty_Prop_AdditionalDeviceSettingsPath_String = 1042, + ETrackedDeviceProperty_Prop_Identifiable_Bool = 1043, + ETrackedDeviceProperty_Prop_BootloaderVersion_Uint64 = 1044, + ETrackedDeviceProperty_Prop_AdditionalSystemReportData_String = 1045, + ETrackedDeviceProperty_Prop_CompositeFirmwareVersion_String = 1046, + ETrackedDeviceProperty_Prop_Firmware_RemindUpdate_Bool = 1047, + ETrackedDeviceProperty_Prop_PeripheralApplicationVersion_Uint64 = 1048, + ETrackedDeviceProperty_Prop_ManufacturerSerialNumber_String = 1049, + ETrackedDeviceProperty_Prop_ComputedSerialNumber_String = 1050, + ETrackedDeviceProperty_Prop_EstimatedDeviceFirstUseTime_Int32 = 1051, + ETrackedDeviceProperty_Prop_ReportsTimeSinceVSync_Bool = 2000, + ETrackedDeviceProperty_Prop_SecondsFromVsyncToPhotons_Float = 2001, + ETrackedDeviceProperty_Prop_DisplayFrequency_Float = 2002, + ETrackedDeviceProperty_Prop_UserIpdMeters_Float = 2003, + ETrackedDeviceProperty_Prop_CurrentUniverseId_Uint64 = 2004, + ETrackedDeviceProperty_Prop_PreviousUniverseId_Uint64 = 2005, + ETrackedDeviceProperty_Prop_DisplayFirmwareVersion_Uint64 = 2006, + ETrackedDeviceProperty_Prop_IsOnDesktop_Bool = 2007, + ETrackedDeviceProperty_Prop_DisplayMCType_Int32 = 2008, + ETrackedDeviceProperty_Prop_DisplayMCOffset_Float = 2009, + ETrackedDeviceProperty_Prop_DisplayMCScale_Float = 2010, + ETrackedDeviceProperty_Prop_EdidVendorID_Int32 = 2011, + ETrackedDeviceProperty_Prop_DisplayMCImageLeft_String = 2012, + ETrackedDeviceProperty_Prop_DisplayMCImageRight_String = 2013, + ETrackedDeviceProperty_Prop_DisplayGCBlackClamp_Float = 2014, + ETrackedDeviceProperty_Prop_EdidProductID_Int32 = 2015, + ETrackedDeviceProperty_Prop_CameraToHeadTransform_Matrix34 = 2016, + ETrackedDeviceProperty_Prop_DisplayGCType_Int32 = 2017, + ETrackedDeviceProperty_Prop_DisplayGCOffset_Float = 2018, + ETrackedDeviceProperty_Prop_DisplayGCScale_Float = 2019, + ETrackedDeviceProperty_Prop_DisplayGCPrescale_Float = 2020, + ETrackedDeviceProperty_Prop_DisplayGCImage_String = 2021, + ETrackedDeviceProperty_Prop_LensCenterLeftU_Float = 2022, + ETrackedDeviceProperty_Prop_LensCenterLeftV_Float = 2023, + ETrackedDeviceProperty_Prop_LensCenterRightU_Float = 2024, + ETrackedDeviceProperty_Prop_LensCenterRightV_Float = 2025, + ETrackedDeviceProperty_Prop_UserHeadToEyeDepthMeters_Float = 2026, + ETrackedDeviceProperty_Prop_CameraFirmwareVersion_Uint64 = 2027, + ETrackedDeviceProperty_Prop_CameraFirmwareDescription_String = 2028, + ETrackedDeviceProperty_Prop_DisplayFPGAVersion_Uint64 = 2029, + ETrackedDeviceProperty_Prop_DisplayBootloaderVersion_Uint64 = 2030, + ETrackedDeviceProperty_Prop_DisplayHardwareVersion_Uint64 = 2031, + ETrackedDeviceProperty_Prop_AudioFirmwareVersion_Uint64 = 2032, + ETrackedDeviceProperty_Prop_CameraCompatibilityMode_Int32 = 2033, + ETrackedDeviceProperty_Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, + ETrackedDeviceProperty_Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, + ETrackedDeviceProperty_Prop_DisplaySuppressed_Bool = 2036, + ETrackedDeviceProperty_Prop_DisplayAllowNightMode_Bool = 2037, + ETrackedDeviceProperty_Prop_DisplayMCImageWidth_Int32 = 2038, + ETrackedDeviceProperty_Prop_DisplayMCImageHeight_Int32 = 2039, + ETrackedDeviceProperty_Prop_DisplayMCImageNumChannels_Int32 = 2040, + ETrackedDeviceProperty_Prop_DisplayMCImageData_Binary = 2041, + ETrackedDeviceProperty_Prop_SecondsFromPhotonsToVblank_Float = 2042, + ETrackedDeviceProperty_Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, + ETrackedDeviceProperty_Prop_DisplayDebugMode_Bool = 2044, + ETrackedDeviceProperty_Prop_GraphicsAdapterLuid_Uint64 = 2045, + ETrackedDeviceProperty_Prop_DriverProvidedChaperonePath_String = 2048, + ETrackedDeviceProperty_Prop_ExpectedTrackingReferenceCount_Int32 = 2049, + ETrackedDeviceProperty_Prop_ExpectedControllerCount_Int32 = 2050, + ETrackedDeviceProperty_Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, + ETrackedDeviceProperty_Prop_NamedIconPathControllerRightDeviceOff_String = 2052, + ETrackedDeviceProperty_Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, + ETrackedDeviceProperty_Prop_DoNotApplyPrediction_Bool = 2054, + ETrackedDeviceProperty_Prop_CameraToHeadTransforms_Matrix34_Array = 2055, + ETrackedDeviceProperty_Prop_DistortionMeshResolution_Int32 = 2056, + ETrackedDeviceProperty_Prop_DriverIsDrawingControllers_Bool = 2057, + ETrackedDeviceProperty_Prop_DriverRequestsApplicationPause_Bool = 2058, + ETrackedDeviceProperty_Prop_DriverRequestsReducedRendering_Bool = 2059, + ETrackedDeviceProperty_Prop_MinimumIpdStepMeters_Float = 2060, + ETrackedDeviceProperty_Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, + ETrackedDeviceProperty_Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, + ETrackedDeviceProperty_Prop_ImuToHeadTransform_Matrix34 = 2063, + ETrackedDeviceProperty_Prop_ImuFactoryGyroBias_Vector3 = 2064, + ETrackedDeviceProperty_Prop_ImuFactoryGyroScale_Vector3 = 2065, + ETrackedDeviceProperty_Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, + ETrackedDeviceProperty_Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + ETrackedDeviceProperty_Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + ETrackedDeviceProperty_Prop_AdditionalRadioFeatures_Uint64 = 2070, + ETrackedDeviceProperty_Prop_CameraWhiteBalance_Vector4_Array = 2071, + ETrackedDeviceProperty_Prop_CameraDistortionFunction_Int32_Array = 2072, + ETrackedDeviceProperty_Prop_CameraDistortionCoefficients_Float_Array = 2073, + ETrackedDeviceProperty_Prop_ExpectedControllerType_String = 2074, + ETrackedDeviceProperty_Prop_HmdTrackingStyle_Int32 = 2075, + ETrackedDeviceProperty_Prop_DriverProvidedChaperoneVisibility_Bool = 2076, + ETrackedDeviceProperty_Prop_HmdColumnCorrectionSettingPrefix_String = 2077, + ETrackedDeviceProperty_Prop_CameraSupportsCompatibilityModes_Bool = 2078, + ETrackedDeviceProperty_Prop_SupportsRoomViewDepthProjection_Bool = 2079, + ETrackedDeviceProperty_Prop_DisplayAvailableFrameRates_Float_Array = 2080, + ETrackedDeviceProperty_Prop_DisplaySupportsMultipleFramerates_Bool = 2081, + ETrackedDeviceProperty_Prop_DisplayColorMultLeft_Vector3 = 2082, + ETrackedDeviceProperty_Prop_DisplayColorMultRight_Vector3 = 2083, + ETrackedDeviceProperty_Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084, + ETrackedDeviceProperty_Prop_DisplaySupportsAnalogGain_Bool = 2085, + ETrackedDeviceProperty_Prop_DisplayMinAnalogGain_Float = 2086, + ETrackedDeviceProperty_Prop_DisplayMaxAnalogGain_Float = 2087, + ETrackedDeviceProperty_Prop_CameraExposureTime_Float = 2088, + ETrackedDeviceProperty_Prop_CameraGlobalGain_Float = 2089, + ETrackedDeviceProperty_Prop_DashboardScale_Float = 2091, + ETrackedDeviceProperty_Prop_IpdUIRangeMinMeters_Float = 2100, + ETrackedDeviceProperty_Prop_IpdUIRangeMaxMeters_Float = 2101, + ETrackedDeviceProperty_Prop_Hmd_SupportsHDCP14LegacyCompat_Bool = 2102, + ETrackedDeviceProperty_Prop_Hmd_SupportsMicMonitoring_Bool = 2103, + ETrackedDeviceProperty_Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + ETrackedDeviceProperty_Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, + ETrackedDeviceProperty_Prop_Audio_DefaultPlaybackDeviceId_String = 2300, + ETrackedDeviceProperty_Prop_Audio_DefaultRecordingDeviceId_String = 2301, + ETrackedDeviceProperty_Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302, + ETrackedDeviceProperty_Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool = 2303, + ETrackedDeviceProperty_Prop_AttachedDeviceId_String = 3000, + ETrackedDeviceProperty_Prop_SupportedButtons_Uint64 = 3001, + ETrackedDeviceProperty_Prop_Axis0Type_Int32 = 3002, + ETrackedDeviceProperty_Prop_Axis1Type_Int32 = 3003, + ETrackedDeviceProperty_Prop_Axis2Type_Int32 = 3004, + ETrackedDeviceProperty_Prop_Axis3Type_Int32 = 3005, + ETrackedDeviceProperty_Prop_Axis4Type_Int32 = 3006, + ETrackedDeviceProperty_Prop_ControllerRoleHint_Int32 = 3007, + ETrackedDeviceProperty_Prop_FieldOfViewLeftDegrees_Float = 4000, + ETrackedDeviceProperty_Prop_FieldOfViewRightDegrees_Float = 4001, + ETrackedDeviceProperty_Prop_FieldOfViewTopDegrees_Float = 4002, + ETrackedDeviceProperty_Prop_FieldOfViewBottomDegrees_Float = 4003, + ETrackedDeviceProperty_Prop_TrackingRangeMinimumMeters_Float = 4004, + ETrackedDeviceProperty_Prop_TrackingRangeMaximumMeters_Float = 4005, + ETrackedDeviceProperty_Prop_ModeLabel_String = 4006, + ETrackedDeviceProperty_Prop_CanWirelessIdentify_Bool = 4007, + ETrackedDeviceProperty_Prop_Nonce_Int32 = 4008, + ETrackedDeviceProperty_Prop_IconPathName_String = 5000, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceOff_String = 5001, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearching_String = 5002, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceSearchingAlert_String = 5003, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceReady_String = 5004, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceReadyAlert_String = 5005, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceNotReady_String = 5006, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceStandby_String = 5007, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceAlertLow_String = 5008, + ETrackedDeviceProperty_Prop_NamedIconPathDeviceStandbyAlert_String = 5009, + ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_Start = 5100, + ETrackedDeviceProperty_Prop_DisplayHiddenArea_Binary_End = 5150, + ETrackedDeviceProperty_Prop_ParentContainer = 5151, + ETrackedDeviceProperty_Prop_OverrideContainer_Uint64 = 5152, + ETrackedDeviceProperty_Prop_UserConfigPath_String = 6000, + ETrackedDeviceProperty_Prop_InstallPath_String = 6001, + ETrackedDeviceProperty_Prop_HasDisplayComponent_Bool = 6002, + ETrackedDeviceProperty_Prop_HasControllerComponent_Bool = 6003, + ETrackedDeviceProperty_Prop_HasCameraComponent_Bool = 6004, + ETrackedDeviceProperty_Prop_HasDriverDirectModeComponent_Bool = 6005, + ETrackedDeviceProperty_Prop_HasVirtualDisplayComponent_Bool = 6006, + ETrackedDeviceProperty_Prop_HasSpatialAnchorsSupport_Bool = 6007, + ETrackedDeviceProperty_Prop_ControllerType_String = 7000, + ETrackedDeviceProperty_Prop_ControllerHandSelectionPriority_Int32 = 7002, + ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_Start = 10000, + ETrackedDeviceProperty_Prop_VendorSpecific_Reserved_End = 10999, + ETrackedDeviceProperty_Prop_TrackedDeviceProperty_Max = 1000000, +} ETrackedDeviceProperty; + +typedef enum ETrackedPropertyError +{ + ETrackedPropertyError_TrackedProp_Success = 0, + ETrackedPropertyError_TrackedProp_WrongDataType = 1, + ETrackedPropertyError_TrackedProp_WrongDeviceClass = 2, + ETrackedPropertyError_TrackedProp_BufferTooSmall = 3, + ETrackedPropertyError_TrackedProp_UnknownProperty = 4, + ETrackedPropertyError_TrackedProp_InvalidDevice = 5, + ETrackedPropertyError_TrackedProp_CouldNotContactServer = 6, + ETrackedPropertyError_TrackedProp_ValueNotProvidedByDevice = 7, + ETrackedPropertyError_TrackedProp_StringExceedsMaximumLength = 8, + ETrackedPropertyError_TrackedProp_NotYetAvailable = 9, + ETrackedPropertyError_TrackedProp_PermissionDenied = 10, + ETrackedPropertyError_TrackedProp_InvalidOperation = 11, + ETrackedPropertyError_TrackedProp_CannotWriteToWildcards = 12, + ETrackedPropertyError_TrackedProp_IPCReadFailure = 13, + ETrackedPropertyError_TrackedProp_OutOfMemory = 14, + ETrackedPropertyError_TrackedProp_InvalidContainer = 15, +} ETrackedPropertyError; + +typedef enum EHmdTrackingStyle +{ + EHmdTrackingStyle_HmdTrackingStyle_Unknown = 0, + EHmdTrackingStyle_HmdTrackingStyle_Lighthouse = 1, + EHmdTrackingStyle_HmdTrackingStyle_OutsideInCameras = 2, + EHmdTrackingStyle_HmdTrackingStyle_InsideOutCameras = 3, +} EHmdTrackingStyle; + +typedef enum EVRSubmitFlags +{ + EVRSubmitFlags_Submit_Default = 0, + EVRSubmitFlags_Submit_LensDistortionAlreadyApplied = 1, + EVRSubmitFlags_Submit_GlRenderBuffer = 2, + EVRSubmitFlags_Submit_Reserved = 4, + EVRSubmitFlags_Submit_TextureWithPose = 8, + EVRSubmitFlags_Submit_TextureWithDepth = 16, + EVRSubmitFlags_Submit_FrameDiscontinuty = 32, + EVRSubmitFlags_Submit_VulkanTextureWithArrayData = 64, + EVRSubmitFlags_Submit_GlArrayTexture = 128, + EVRSubmitFlags_Submit_Reserved2 = 32768, +} EVRSubmitFlags; + +typedef enum EVRState +{ + EVRState_VRState_Undefined = -1, + EVRState_VRState_Off = 0, + EVRState_VRState_Searching = 1, + EVRState_VRState_Searching_Alert = 2, + EVRState_VRState_Ready = 3, + EVRState_VRState_Ready_Alert = 4, + EVRState_VRState_NotReady = 5, + EVRState_VRState_Standby = 6, + EVRState_VRState_Ready_Alert_Low = 7, +} EVRState; + +typedef enum EVREventType +{ + EVREventType_VREvent_None = 0, + EVREventType_VREvent_TrackedDeviceActivated = 100, + EVREventType_VREvent_TrackedDeviceDeactivated = 101, + EVREventType_VREvent_TrackedDeviceUpdated = 102, + EVREventType_VREvent_TrackedDeviceUserInteractionStarted = 103, + EVREventType_VREvent_TrackedDeviceUserInteractionEnded = 104, + EVREventType_VREvent_IpdChanged = 105, + EVREventType_VREvent_EnterStandbyMode = 106, + EVREventType_VREvent_LeaveStandbyMode = 107, + EVREventType_VREvent_TrackedDeviceRoleChanged = 108, + EVREventType_VREvent_WatchdogWakeUpRequested = 109, + EVREventType_VREvent_LensDistortionChanged = 110, + EVREventType_VREvent_PropertyChanged = 111, + EVREventType_VREvent_WirelessDisconnect = 112, + EVREventType_VREvent_WirelessReconnect = 113, + EVREventType_VREvent_ButtonPress = 200, + EVREventType_VREvent_ButtonUnpress = 201, + EVREventType_VREvent_ButtonTouch = 202, + EVREventType_VREvent_ButtonUntouch = 203, + EVREventType_VREvent_Modal_Cancel = 257, + EVREventType_VREvent_MouseMove = 300, + EVREventType_VREvent_MouseButtonDown = 301, + EVREventType_VREvent_MouseButtonUp = 302, + EVREventType_VREvent_FocusEnter = 303, + EVREventType_VREvent_FocusLeave = 304, + EVREventType_VREvent_ScrollDiscrete = 305, + EVREventType_VREvent_TouchPadMove = 306, + EVREventType_VREvent_OverlayFocusChanged = 307, + EVREventType_VREvent_ReloadOverlays = 308, + EVREventType_VREvent_ScrollSmooth = 309, + EVREventType_VREvent_LockMousePosition = 310, + EVREventType_VREvent_UnlockMousePosition = 311, + EVREventType_VREvent_InputFocusCaptured = 400, + EVREventType_VREvent_InputFocusReleased = 401, + EVREventType_VREvent_SceneApplicationChanged = 404, + EVREventType_VREvent_SceneFocusChanged = 405, + EVREventType_VREvent_InputFocusChanged = 406, + EVREventType_VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, + EVREventType_VREvent_ActionBindingReloaded = 409, + EVREventType_VREvent_HideRenderModels = 410, + EVREventType_VREvent_ShowRenderModels = 411, + EVREventType_VREvent_SceneApplicationStateChanged = 412, + EVREventType_VREvent_ConsoleOpened = 420, + EVREventType_VREvent_ConsoleClosed = 421, + EVREventType_VREvent_OverlayShown = 500, + EVREventType_VREvent_OverlayHidden = 501, + EVREventType_VREvent_DashboardActivated = 502, + EVREventType_VREvent_DashboardDeactivated = 503, + EVREventType_VREvent_DashboardRequested = 505, + EVREventType_VREvent_ResetDashboard = 506, + EVREventType_VREvent_ImageLoaded = 508, + EVREventType_VREvent_ShowKeyboard = 509, + EVREventType_VREvent_HideKeyboard = 510, + EVREventType_VREvent_OverlayGamepadFocusGained = 511, + EVREventType_VREvent_OverlayGamepadFocusLost = 512, + EVREventType_VREvent_OverlaySharedTextureChanged = 513, + EVREventType_VREvent_ScreenshotTriggered = 516, + EVREventType_VREvent_ImageFailed = 517, + EVREventType_VREvent_DashboardOverlayCreated = 518, + EVREventType_VREvent_SwitchGamepadFocus = 519, + EVREventType_VREvent_RequestScreenshot = 520, + EVREventType_VREvent_ScreenshotTaken = 521, + EVREventType_VREvent_ScreenshotFailed = 522, + EVREventType_VREvent_SubmitScreenshotToDashboard = 523, + EVREventType_VREvent_ScreenshotProgressToDashboard = 524, + EVREventType_VREvent_PrimaryDashboardDeviceChanged = 525, + EVREventType_VREvent_RoomViewShown = 526, + EVREventType_VREvent_RoomViewHidden = 527, + EVREventType_VREvent_ShowUI = 528, + EVREventType_VREvent_ShowDevTools = 529, + EVREventType_VREvent_DesktopViewUpdating = 530, + EVREventType_VREvent_DesktopViewReady = 531, + EVREventType_VREvent_Notification_Shown = 600, + EVREventType_VREvent_Notification_Hidden = 601, + EVREventType_VREvent_Notification_BeginInteraction = 602, + EVREventType_VREvent_Notification_Destroyed = 603, + EVREventType_VREvent_Quit = 700, + EVREventType_VREvent_ProcessQuit = 701, + EVREventType_VREvent_QuitAcknowledged = 703, + EVREventType_VREvent_DriverRequestedQuit = 704, + EVREventType_VREvent_RestartRequested = 705, + EVREventType_VREvent_ChaperoneDataHasChanged = 800, + EVREventType_VREvent_ChaperoneUniverseHasChanged = 801, + EVREventType_VREvent_ChaperoneTempDataHasChanged = 802, + EVREventType_VREvent_ChaperoneSettingsHaveChanged = 803, + EVREventType_VREvent_SeatedZeroPoseReset = 804, + EVREventType_VREvent_ChaperoneFlushCache = 805, + EVREventType_VREvent_ChaperoneRoomSetupStarting = 806, + EVREventType_VREvent_ChaperoneRoomSetupFinished = 807, + EVREventType_VREvent_StandingZeroPoseReset = 808, + EVREventType_VREvent_AudioSettingsHaveChanged = 820, + EVREventType_VREvent_BackgroundSettingHasChanged = 850, + EVREventType_VREvent_CameraSettingsHaveChanged = 851, + EVREventType_VREvent_ReprojectionSettingHasChanged = 852, + EVREventType_VREvent_ModelSkinSettingsHaveChanged = 853, + EVREventType_VREvent_EnvironmentSettingsHaveChanged = 854, + EVREventType_VREvent_PowerSettingsHaveChanged = 855, + EVREventType_VREvent_EnableHomeAppSettingsHaveChanged = 856, + EVREventType_VREvent_SteamVRSectionSettingChanged = 857, + EVREventType_VREvent_LighthouseSectionSettingChanged = 858, + EVREventType_VREvent_NullSectionSettingChanged = 859, + EVREventType_VREvent_UserInterfaceSectionSettingChanged = 860, + EVREventType_VREvent_NotificationsSectionSettingChanged = 861, + EVREventType_VREvent_KeyboardSectionSettingChanged = 862, + EVREventType_VREvent_PerfSectionSettingChanged = 863, + EVREventType_VREvent_DashboardSectionSettingChanged = 864, + EVREventType_VREvent_WebInterfaceSectionSettingChanged = 865, + EVREventType_VREvent_TrackersSectionSettingChanged = 866, + EVREventType_VREvent_LastKnownSectionSettingChanged = 867, + EVREventType_VREvent_DismissedWarningsSectionSettingChanged = 868, + EVREventType_VREvent_GpuSpeedSectionSettingChanged = 869, + EVREventType_VREvent_WindowsMRSectionSettingChanged = 870, + EVREventType_VREvent_OtherSectionSettingChanged = 871, + EVREventType_VREvent_StatusUpdate = 900, + EVREventType_VREvent_WebInterface_InstallDriverCompleted = 950, + EVREventType_VREvent_MCImageUpdated = 1000, + EVREventType_VREvent_FirmwareUpdateStarted = 1100, + EVREventType_VREvent_FirmwareUpdateFinished = 1101, + EVREventType_VREvent_KeyboardClosed = 1200, + EVREventType_VREvent_KeyboardCharInput = 1201, + EVREventType_VREvent_KeyboardDone = 1202, + EVREventType_VREvent_ApplicationListUpdated = 1303, + EVREventType_VREvent_ApplicationMimeTypeLoad = 1304, + EVREventType_VREvent_ProcessConnected = 1306, + EVREventType_VREvent_ProcessDisconnected = 1307, + EVREventType_VREvent_Compositor_ChaperoneBoundsShown = 1410, + EVREventType_VREvent_Compositor_ChaperoneBoundsHidden = 1411, + EVREventType_VREvent_Compositor_DisplayDisconnected = 1412, + EVREventType_VREvent_Compositor_DisplayReconnected = 1413, + EVREventType_VREvent_Compositor_HDCPError = 1414, + EVREventType_VREvent_Compositor_ApplicationNotResponding = 1415, + EVREventType_VREvent_Compositor_ApplicationResumed = 1416, + EVREventType_VREvent_Compositor_OutOfVideoMemory = 1417, + EVREventType_VREvent_Compositor_DisplayModeNotSupported = 1418, + EVREventType_VREvent_Compositor_StageOverrideReady = 1419, + EVREventType_VREvent_TrackedCamera_StartVideoStream = 1500, + EVREventType_VREvent_TrackedCamera_StopVideoStream = 1501, + EVREventType_VREvent_TrackedCamera_PauseVideoStream = 1502, + EVREventType_VREvent_TrackedCamera_ResumeVideoStream = 1503, + EVREventType_VREvent_TrackedCamera_EditingSurface = 1550, + EVREventType_VREvent_PerformanceTest_EnableCapture = 1600, + EVREventType_VREvent_PerformanceTest_DisableCapture = 1601, + EVREventType_VREvent_PerformanceTest_FidelityLevel = 1602, + EVREventType_VREvent_MessageOverlay_Closed = 1650, + EVREventType_VREvent_MessageOverlayCloseRequested = 1651, + EVREventType_VREvent_Input_HapticVibration = 1700, + EVREventType_VREvent_Input_BindingLoadFailed = 1701, + EVREventType_VREvent_Input_BindingLoadSuccessful = 1702, + EVREventType_VREvent_Input_ActionManifestReloaded = 1703, + EVREventType_VREvent_Input_ActionManifestLoadFailed = 1704, + EVREventType_VREvent_Input_ProgressUpdate = 1705, + EVREventType_VREvent_Input_TrackerActivated = 1706, + EVREventType_VREvent_Input_BindingsUpdated = 1707, + EVREventType_VREvent_Input_BindingSubscriptionChanged = 1708, + EVREventType_VREvent_SpatialAnchors_PoseUpdated = 1800, + EVREventType_VREvent_SpatialAnchors_DescriptorUpdated = 1801, + EVREventType_VREvent_SpatialAnchors_RequestPoseUpdate = 1802, + EVREventType_VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, + EVREventType_VREvent_SystemReport_Started = 1900, + EVREventType_VREvent_Monitor_ShowHeadsetView = 2000, + EVREventType_VREvent_Monitor_HideHeadsetView = 2001, + EVREventType_VREvent_VendorSpecific_Reserved_Start = 10000, + EVREventType_VREvent_VendorSpecific_Reserved_End = 19999, +} EVREventType; + +typedef enum EDeviceActivityLevel +{ + EDeviceActivityLevel_k_EDeviceActivityLevel_Unknown = -1, + EDeviceActivityLevel_k_EDeviceActivityLevel_Idle = 0, + EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction = 1, + EDeviceActivityLevel_k_EDeviceActivityLevel_UserInteraction_Timeout = 2, + EDeviceActivityLevel_k_EDeviceActivityLevel_Standby = 3, + EDeviceActivityLevel_k_EDeviceActivityLevel_Idle_Timeout = 4, +} EDeviceActivityLevel; + +typedef enum EVRButtonId +{ + EVRButtonId_k_EButton_System = 0, + EVRButtonId_k_EButton_ApplicationMenu = 1, + EVRButtonId_k_EButton_Grip = 2, + EVRButtonId_k_EButton_DPad_Left = 3, + EVRButtonId_k_EButton_DPad_Up = 4, + EVRButtonId_k_EButton_DPad_Right = 5, + EVRButtonId_k_EButton_DPad_Down = 6, + EVRButtonId_k_EButton_A = 7, + EVRButtonId_k_EButton_ProximitySensor = 31, + EVRButtonId_k_EButton_Axis0 = 32, + EVRButtonId_k_EButton_Axis1 = 33, + EVRButtonId_k_EButton_Axis2 = 34, + EVRButtonId_k_EButton_Axis3 = 35, + EVRButtonId_k_EButton_Axis4 = 36, + EVRButtonId_k_EButton_SteamVR_Touchpad = 32, + EVRButtonId_k_EButton_SteamVR_Trigger = 33, + EVRButtonId_k_EButton_Dashboard_Back = 2, + EVRButtonId_k_EButton_IndexController_A = 2, + EVRButtonId_k_EButton_IndexController_B = 1, + EVRButtonId_k_EButton_IndexController_JoyStick = 35, + EVRButtonId_k_EButton_Max = 64, +} EVRButtonId; + +typedef enum EVRMouseButton +{ + EVRMouseButton_VRMouseButton_Left = 1, + EVRMouseButton_VRMouseButton_Right = 2, + EVRMouseButton_VRMouseButton_Middle = 4, +} EVRMouseButton; + +typedef enum EShowUIType +{ + EShowUIType_ShowUI_ControllerBinding = 0, + EShowUIType_ShowUI_ManageTrackers = 1, + EShowUIType_ShowUI_Pairing = 3, + EShowUIType_ShowUI_Settings = 4, + EShowUIType_ShowUI_DebugCommands = 5, + EShowUIType_ShowUI_FullControllerBinding = 6, + EShowUIType_ShowUI_ManageDrivers = 7, +} EShowUIType; + +typedef enum EHDCPError +{ + EHDCPError_HDCPError_None = 0, + EHDCPError_HDCPError_LinkLost = 1, + EHDCPError_HDCPError_Tampered = 2, + EHDCPError_HDCPError_DeviceRevoked = 3, + EHDCPError_HDCPError_Unknown = 4, +} EHDCPError; + +typedef enum EVRComponentProperty +{ + EVRComponentProperty_VRComponentProperty_IsStatic = 1, + EVRComponentProperty_VRComponentProperty_IsVisible = 2, + EVRComponentProperty_VRComponentProperty_IsTouched = 4, + EVRComponentProperty_VRComponentProperty_IsPressed = 8, + EVRComponentProperty_VRComponentProperty_IsScrolled = 16, + EVRComponentProperty_VRComponentProperty_IsHighlighted = 32, +} EVRComponentProperty; + +typedef enum EVRInputError +{ + EVRInputError_VRInputError_None = 0, + EVRInputError_VRInputError_NameNotFound = 1, + EVRInputError_VRInputError_WrongType = 2, + EVRInputError_VRInputError_InvalidHandle = 3, + EVRInputError_VRInputError_InvalidParam = 4, + EVRInputError_VRInputError_NoSteam = 5, + EVRInputError_VRInputError_MaxCapacityReached = 6, + EVRInputError_VRInputError_IPCError = 7, + EVRInputError_VRInputError_NoActiveActionSet = 8, + EVRInputError_VRInputError_InvalidDevice = 9, + EVRInputError_VRInputError_InvalidSkeleton = 10, + EVRInputError_VRInputError_InvalidBoneCount = 11, + EVRInputError_VRInputError_InvalidCompressedData = 12, + EVRInputError_VRInputError_NoData = 13, + EVRInputError_VRInputError_BufferTooSmall = 14, + EVRInputError_VRInputError_MismatchedActionManifest = 15, + EVRInputError_VRInputError_MissingSkeletonData = 16, + EVRInputError_VRInputError_InvalidBoneIndex = 17, + EVRInputError_VRInputError_InvalidPriority = 18, + EVRInputError_VRInputError_PermissionDenied = 19, + EVRInputError_VRInputError_InvalidRenderModel = 20, +} EVRInputError; + +typedef enum EVRSpatialAnchorError +{ + EVRSpatialAnchorError_VRSpatialAnchorError_Success = 0, + EVRSpatialAnchorError_VRSpatialAnchorError_Internal = 1, + EVRSpatialAnchorError_VRSpatialAnchorError_UnknownHandle = 2, + EVRSpatialAnchorError_VRSpatialAnchorError_ArrayTooSmall = 3, + EVRSpatialAnchorError_VRSpatialAnchorError_InvalidDescriptorChar = 4, + EVRSpatialAnchorError_VRSpatialAnchorError_NotYetAvailable = 5, + EVRSpatialAnchorError_VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + EVRSpatialAnchorError_VRSpatialAnchorError_PermanentlyUnavailable = 7, + EVRSpatialAnchorError_VRSpatialAnchorError_WrongDriver = 8, + EVRSpatialAnchorError_VRSpatialAnchorError_DescriptorTooLong = 9, + EVRSpatialAnchorError_VRSpatialAnchorError_Unknown = 10, + EVRSpatialAnchorError_VRSpatialAnchorError_NoRoomCalibration = 11, + EVRSpatialAnchorError_VRSpatialAnchorError_InvalidArgument = 12, + EVRSpatialAnchorError_VRSpatialAnchorError_UnknownDriver = 13, +} EVRSpatialAnchorError; + +typedef enum EHiddenAreaMeshType +{ + EHiddenAreaMeshType_k_eHiddenAreaMesh_Standard = 0, + EHiddenAreaMeshType_k_eHiddenAreaMesh_Inverse = 1, + EHiddenAreaMeshType_k_eHiddenAreaMesh_LineLoop = 2, + EHiddenAreaMeshType_k_eHiddenAreaMesh_Max = 3, +} EHiddenAreaMeshType; + +typedef enum EVRControllerAxisType +{ + EVRControllerAxisType_k_eControllerAxis_None = 0, + EVRControllerAxisType_k_eControllerAxis_TrackPad = 1, + EVRControllerAxisType_k_eControllerAxis_Joystick = 2, + EVRControllerAxisType_k_eControllerAxis_Trigger = 3, +} EVRControllerAxisType; + +typedef enum EVRControllerEventOutputType +{ + EVRControllerEventOutputType_ControllerEventOutput_OSEvents = 0, + EVRControllerEventOutputType_ControllerEventOutput_VREvents = 1, +} EVRControllerEventOutputType; + +typedef enum ECollisionBoundsStyle +{ + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_BEGINNER = 0, + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_INTERMEDIATE = 1, + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_SQUARES = 2, + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_ADVANCED = 3, + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_NONE = 4, + ECollisionBoundsStyle_COLLISION_BOUNDS_STYLE_COUNT = 5, +} ECollisionBoundsStyle; + +typedef enum EVROverlayError +{ + EVROverlayError_VROverlayError_None = 0, + EVROverlayError_VROverlayError_UnknownOverlay = 10, + EVROverlayError_VROverlayError_InvalidHandle = 11, + EVROverlayError_VROverlayError_PermissionDenied = 12, + EVROverlayError_VROverlayError_OverlayLimitExceeded = 13, + EVROverlayError_VROverlayError_WrongVisibilityType = 14, + EVROverlayError_VROverlayError_KeyTooLong = 15, + EVROverlayError_VROverlayError_NameTooLong = 16, + EVROverlayError_VROverlayError_KeyInUse = 17, + EVROverlayError_VROverlayError_WrongTransformType = 18, + EVROverlayError_VROverlayError_InvalidTrackedDevice = 19, + EVROverlayError_VROverlayError_InvalidParameter = 20, + EVROverlayError_VROverlayError_ThumbnailCantBeDestroyed = 21, + EVROverlayError_VROverlayError_ArrayTooSmall = 22, + EVROverlayError_VROverlayError_RequestFailed = 23, + EVROverlayError_VROverlayError_InvalidTexture = 24, + EVROverlayError_VROverlayError_UnableToLoadFile = 25, + EVROverlayError_VROverlayError_KeyboardAlreadyInUse = 26, + EVROverlayError_VROverlayError_NoNeighbor = 27, + EVROverlayError_VROverlayError_TooManyMaskPrimitives = 29, + EVROverlayError_VROverlayError_BadMaskPrimitive = 30, + EVROverlayError_VROverlayError_TextureAlreadyLocked = 31, + EVROverlayError_VROverlayError_TextureLockCapacityReached = 32, + EVROverlayError_VROverlayError_TextureNotLocked = 33, +} EVROverlayError; + +typedef enum EVRApplicationType +{ + EVRApplicationType_VRApplication_Other = 0, + EVRApplicationType_VRApplication_Scene = 1, + EVRApplicationType_VRApplication_Overlay = 2, + EVRApplicationType_VRApplication_Background = 3, + EVRApplicationType_VRApplication_Utility = 4, + EVRApplicationType_VRApplication_VRMonitor = 5, + EVRApplicationType_VRApplication_SteamWatchdog = 6, + EVRApplicationType_VRApplication_Bootstrapper = 7, + EVRApplicationType_VRApplication_WebHelper = 8, + EVRApplicationType_VRApplication_OpenXRInstance = 9, + EVRApplicationType_VRApplication_OpenXRScene = 10, + EVRApplicationType_VRApplication_OpenXROverlay = 11, + EVRApplicationType_VRApplication_Prism = 12, + EVRApplicationType_VRApplication_Max = 13, +} EVRApplicationType; + +typedef enum EVRFirmwareError +{ + EVRFirmwareError_VRFirmwareError_None = 0, + EVRFirmwareError_VRFirmwareError_Success = 1, + EVRFirmwareError_VRFirmwareError_Fail = 2, +} EVRFirmwareError; + +typedef enum EVRNotificationError +{ + EVRNotificationError_VRNotificationError_OK = 0, + EVRNotificationError_VRNotificationError_InvalidNotificationId = 100, + EVRNotificationError_VRNotificationError_NotificationQueueFull = 101, + EVRNotificationError_VRNotificationError_InvalidOverlayHandle = 102, + EVRNotificationError_VRNotificationError_SystemWithUserValueAlreadyExists = 103, +} EVRNotificationError; + +typedef enum EVRSkeletalMotionRange +{ + EVRSkeletalMotionRange_VRSkeletalMotionRange_WithController = 0, + EVRSkeletalMotionRange_VRSkeletalMotionRange_WithoutController = 1, +} EVRSkeletalMotionRange; + +typedef enum EVRSkeletalTrackingLevel +{ + EVRSkeletalTrackingLevel_VRSkeletalTracking_Estimated = 0, + EVRSkeletalTrackingLevel_VRSkeletalTracking_Partial = 1, + EVRSkeletalTrackingLevel_VRSkeletalTracking_Full = 2, + EVRSkeletalTrackingLevel_VRSkeletalTrackingLevel_Count = 3, + EVRSkeletalTrackingLevel_VRSkeletalTrackingLevel_Max = 2, +} EVRSkeletalTrackingLevel; + +typedef enum EVRInitError +{ + EVRInitError_VRInitError_None = 0, + EVRInitError_VRInitError_Unknown = 1, + EVRInitError_VRInitError_Init_InstallationNotFound = 100, + EVRInitError_VRInitError_Init_InstallationCorrupt = 101, + EVRInitError_VRInitError_Init_VRClientDLLNotFound = 102, + EVRInitError_VRInitError_Init_FileNotFound = 103, + EVRInitError_VRInitError_Init_FactoryNotFound = 104, + EVRInitError_VRInitError_Init_InterfaceNotFound = 105, + EVRInitError_VRInitError_Init_InvalidInterface = 106, + EVRInitError_VRInitError_Init_UserConfigDirectoryInvalid = 107, + EVRInitError_VRInitError_Init_HmdNotFound = 108, + EVRInitError_VRInitError_Init_NotInitialized = 109, + EVRInitError_VRInitError_Init_PathRegistryNotFound = 110, + EVRInitError_VRInitError_Init_NoConfigPath = 111, + EVRInitError_VRInitError_Init_NoLogPath = 112, + EVRInitError_VRInitError_Init_PathRegistryNotWritable = 113, + EVRInitError_VRInitError_Init_AppInfoInitFailed = 114, + EVRInitError_VRInitError_Init_Retry = 115, + EVRInitError_VRInitError_Init_InitCanceledByUser = 116, + EVRInitError_VRInitError_Init_AnotherAppLaunching = 117, + EVRInitError_VRInitError_Init_SettingsInitFailed = 118, + EVRInitError_VRInitError_Init_ShuttingDown = 119, + EVRInitError_VRInitError_Init_TooManyObjects = 120, + EVRInitError_VRInitError_Init_NoServerForBackgroundApp = 121, + EVRInitError_VRInitError_Init_NotSupportedWithCompositor = 122, + EVRInitError_VRInitError_Init_NotAvailableToUtilityApps = 123, + EVRInitError_VRInitError_Init_Internal = 124, + EVRInitError_VRInitError_Init_HmdDriverIdIsNone = 125, + EVRInitError_VRInitError_Init_HmdNotFoundPresenceFailed = 126, + EVRInitError_VRInitError_Init_VRMonitorNotFound = 127, + EVRInitError_VRInitError_Init_VRMonitorStartupFailed = 128, + EVRInitError_VRInitError_Init_LowPowerWatchdogNotSupported = 129, + EVRInitError_VRInitError_Init_InvalidApplicationType = 130, + EVRInitError_VRInitError_Init_NotAvailableToWatchdogApps = 131, + EVRInitError_VRInitError_Init_WatchdogDisabledInSettings = 132, + EVRInitError_VRInitError_Init_VRDashboardNotFound = 133, + EVRInitError_VRInitError_Init_VRDashboardStartupFailed = 134, + EVRInitError_VRInitError_Init_VRHomeNotFound = 135, + EVRInitError_VRInitError_Init_VRHomeStartupFailed = 136, + EVRInitError_VRInitError_Init_RebootingBusy = 137, + EVRInitError_VRInitError_Init_FirmwareUpdateBusy = 138, + EVRInitError_VRInitError_Init_FirmwareRecoveryBusy = 139, + EVRInitError_VRInitError_Init_USBServiceBusy = 140, + EVRInitError_VRInitError_Init_VRWebHelperStartupFailed = 141, + EVRInitError_VRInitError_Init_TrackerManagerInitFailed = 142, + EVRInitError_VRInitError_Init_AlreadyRunning = 143, + EVRInitError_VRInitError_Init_FailedForVrMonitor = 144, + EVRInitError_VRInitError_Init_PropertyManagerInitFailed = 145, + EVRInitError_VRInitError_Init_WebServerFailed = 146, + EVRInitError_VRInitError_Init_IllegalTypeTransition = 147, + EVRInitError_VRInitError_Init_MismatchedRuntimes = 148, + EVRInitError_VRInitError_Init_InvalidProcessId = 149, + EVRInitError_VRInitError_Init_VRServiceStartupFailed = 150, + EVRInitError_VRInitError_Init_PrismNeedsNewDrivers = 151, + EVRInitError_VRInitError_Init_PrismStartupTimedOut = 152, + EVRInitError_VRInitError_Init_CouldNotStartPrism = 153, + EVRInitError_VRInitError_Init_CreateDriverDirectDeviceFailed = 154, + EVRInitError_VRInitError_Init_PrismExitedUnexpectedly = 155, + EVRInitError_VRInitError_Driver_Failed = 200, + EVRInitError_VRInitError_Driver_Unknown = 201, + EVRInitError_VRInitError_Driver_HmdUnknown = 202, + EVRInitError_VRInitError_Driver_NotLoaded = 203, + EVRInitError_VRInitError_Driver_RuntimeOutOfDate = 204, + EVRInitError_VRInitError_Driver_HmdInUse = 205, + EVRInitError_VRInitError_Driver_NotCalibrated = 206, + EVRInitError_VRInitError_Driver_CalibrationInvalid = 207, + EVRInitError_VRInitError_Driver_HmdDisplayNotFound = 208, + EVRInitError_VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, + EVRInitError_VRInitError_Driver_HmdDriverIdOutOfBounds = 211, + EVRInitError_VRInitError_Driver_HmdDisplayMirrored = 212, + EVRInitError_VRInitError_Driver_HmdDisplayNotFoundLaptop = 213, + EVRInitError_VRInitError_IPC_ServerInitFailed = 300, + EVRInitError_VRInitError_IPC_ConnectFailed = 301, + EVRInitError_VRInitError_IPC_SharedStateInitFailed = 302, + EVRInitError_VRInitError_IPC_CompositorInitFailed = 303, + EVRInitError_VRInitError_IPC_MutexInitFailed = 304, + EVRInitError_VRInitError_IPC_Failed = 305, + EVRInitError_VRInitError_IPC_CompositorConnectFailed = 306, + EVRInitError_VRInitError_IPC_CompositorInvalidConnectResponse = 307, + EVRInitError_VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, + EVRInitError_VRInitError_IPC_ConnectFailedAfterTargetExited = 309, + EVRInitError_VRInitError_IPC_NamespaceUnavailable = 310, + EVRInitError_VRInitError_Compositor_Failed = 400, + EVRInitError_VRInitError_Compositor_D3D11HardwareRequired = 401, + EVRInitError_VRInitError_Compositor_FirmwareRequiresUpdate = 402, + EVRInitError_VRInitError_Compositor_OverlayInitFailed = 403, + EVRInitError_VRInitError_Compositor_ScreenshotsInitFailed = 404, + EVRInitError_VRInitError_Compositor_UnableToCreateDevice = 405, + EVRInitError_VRInitError_Compositor_SharedStateIsNull = 406, + EVRInitError_VRInitError_Compositor_NotificationManagerIsNull = 407, + EVRInitError_VRInitError_Compositor_ResourceManagerClientIsNull = 408, + EVRInitError_VRInitError_Compositor_MessageOverlaySharedStateInitFailure = 409, + EVRInitError_VRInitError_Compositor_PropertiesInterfaceIsNull = 410, + EVRInitError_VRInitError_Compositor_CreateFullscreenWindowFailed = 411, + EVRInitError_VRInitError_Compositor_SettingsInterfaceIsNull = 412, + EVRInitError_VRInitError_Compositor_FailedToShowWindow = 413, + EVRInitError_VRInitError_Compositor_DistortInterfaceIsNull = 414, + EVRInitError_VRInitError_Compositor_DisplayFrequencyFailure = 415, + EVRInitError_VRInitError_Compositor_RendererInitializationFailed = 416, + EVRInitError_VRInitError_Compositor_DXGIFactoryInterfaceIsNull = 417, + EVRInitError_VRInitError_Compositor_DXGIFactoryCreateFailed = 418, + EVRInitError_VRInitError_Compositor_DXGIFactoryQueryFailed = 419, + EVRInitError_VRInitError_Compositor_InvalidAdapterDesktop = 420, + EVRInitError_VRInitError_Compositor_InvalidHmdAttachment = 421, + EVRInitError_VRInitError_Compositor_InvalidOutputDesktop = 422, + EVRInitError_VRInitError_Compositor_InvalidDeviceProvided = 423, + EVRInitError_VRInitError_Compositor_D3D11RendererInitializationFailed = 424, + EVRInitError_VRInitError_Compositor_FailedToFindDisplayMode = 425, + EVRInitError_VRInitError_Compositor_FailedToCreateSwapChain = 426, + EVRInitError_VRInitError_Compositor_FailedToGetBackBuffer = 427, + EVRInitError_VRInitError_Compositor_FailedToCreateRenderTarget = 428, + EVRInitError_VRInitError_Compositor_FailedToCreateDXGI2SwapChain = 429, + EVRInitError_VRInitError_Compositor_FailedtoGetDXGI2BackBuffer = 430, + EVRInitError_VRInitError_Compositor_FailedToCreateDXGI2RenderTarget = 431, + EVRInitError_VRInitError_Compositor_FailedToGetDXGIDeviceInterface = 432, + EVRInitError_VRInitError_Compositor_SelectDisplayMode = 433, + EVRInitError_VRInitError_Compositor_FailedToCreateNvAPIRenderTargets = 434, + EVRInitError_VRInitError_Compositor_NvAPISetDisplayMode = 435, + EVRInitError_VRInitError_Compositor_FailedToCreateDirectModeDisplay = 436, + EVRInitError_VRInitError_Compositor_InvalidHmdPropertyContainer = 437, + EVRInitError_VRInitError_Compositor_UpdateDisplayFrequency = 438, + EVRInitError_VRInitError_Compositor_CreateRasterizerState = 439, + EVRInitError_VRInitError_Compositor_CreateWireframeRasterizerState = 440, + EVRInitError_VRInitError_Compositor_CreateSamplerState = 441, + EVRInitError_VRInitError_Compositor_CreateClampToBorderSamplerState = 442, + EVRInitError_VRInitError_Compositor_CreateAnisoSamplerState = 443, + EVRInitError_VRInitError_Compositor_CreateOverlaySamplerState = 444, + EVRInitError_VRInitError_Compositor_CreatePanoramaSamplerState = 445, + EVRInitError_VRInitError_Compositor_CreateFontSamplerState = 446, + EVRInitError_VRInitError_Compositor_CreateNoBlendState = 447, + EVRInitError_VRInitError_Compositor_CreateBlendState = 448, + EVRInitError_VRInitError_Compositor_CreateAlphaBlendState = 449, + EVRInitError_VRInitError_Compositor_CreateBlendStateMaskR = 450, + EVRInitError_VRInitError_Compositor_CreateBlendStateMaskG = 451, + EVRInitError_VRInitError_Compositor_CreateBlendStateMaskB = 452, + EVRInitError_VRInitError_Compositor_CreateDepthStencilState = 453, + EVRInitError_VRInitError_Compositor_CreateDepthStencilStateNoWrite = 454, + EVRInitError_VRInitError_Compositor_CreateDepthStencilStateNoDepth = 455, + EVRInitError_VRInitError_Compositor_CreateFlushTexture = 456, + EVRInitError_VRInitError_Compositor_CreateDistortionSurfaces = 457, + EVRInitError_VRInitError_Compositor_CreateConstantBuffer = 458, + EVRInitError_VRInitError_Compositor_CreateHmdPoseConstantBuffer = 459, + EVRInitError_VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer = 460, + EVRInitError_VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer = 461, + EVRInitError_VRInitError_Compositor_CreateOverlayConstantBuffer = 462, + EVRInitError_VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer = 463, + EVRInitError_VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464, + EVRInitError_VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465, + EVRInitError_VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466, + EVRInitError_VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467, + EVRInitError_VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer = 468, + EVRInitError_VRInitError_Compositor_CreateGeomConstantBuffer = 469, + EVRInitError_VRInitError_Compositor_CreatePanelMaskConstantBuffer = 470, + EVRInitError_VRInitError_Compositor_CreatePixelSimUBO = 471, + EVRInitError_VRInitError_Compositor_CreateMSAARenderTextures = 472, + EVRInitError_VRInitError_Compositor_CreateResolveRenderTextures = 473, + EVRInitError_VRInitError_Compositor_CreateComputeResolveRenderTextures = 474, + EVRInitError_VRInitError_Compositor_CreateDriverDirectModeResolveTextures = 475, + EVRInitError_VRInitError_Compositor_OpenDriverDirectModeResolveTextures = 476, + EVRInitError_VRInitError_Compositor_CreateFallbackSyncTexture = 477, + EVRInitError_VRInitError_Compositor_ShareFallbackSyncTexture = 478, + EVRInitError_VRInitError_Compositor_CreateOverlayIndexBuffer = 479, + EVRInitError_VRInitError_Compositor_CreateOverlayVertexBuffer = 480, + EVRInitError_VRInitError_Compositor_CreateTextVertexBuffer = 481, + EVRInitError_VRInitError_Compositor_CreateTextIndexBuffer = 482, + EVRInitError_VRInitError_Compositor_CreateMirrorTextures = 483, + EVRInitError_VRInitError_Compositor_CreateLastFrameRenderTexture = 484, + EVRInitError_VRInitError_Compositor_CreateMirrorOverlay = 485, + EVRInitError_VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer = 486, + EVRInitError_VRInitError_Compositor_DisplayModeNotSupported = 487, + EVRInitError_VRInitError_Compositor_CreateOverlayInvalidCall = 488, + EVRInitError_VRInitError_Compositor_CreateOverlayAlreadyInitialized = 489, + EVRInitError_VRInitError_Compositor_FailedToCreateMailbox = 490, + EVRInitError_VRInitError_Compositor_WindowInterfaceIsNull = 491, + EVRInitError_VRInitError_Compositor_SystemLayerCreateInstance = 492, + EVRInitError_VRInitError_Compositor_SystemLayerCreateSession = 493, + EVRInitError_VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, + EVRInitError_VRInitError_VendorSpecific_WindowsNotInDevMode = 1001, + EVRInitError_VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, + EVRInitError_VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, + EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, + EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, + EVRInitError_VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, + EVRInitError_VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, + EVRInitError_VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, + EVRInitError_VRInitError_VendorSpecific_OculusRuntimeBadInstall = 1114, + EVRInitError_VRInitError_Steam_SteamInstallationNotFound = 2000, + EVRInitError_VRInitError_LastError = 2001, +} EVRInitError; + +typedef enum EVRScreenshotType +{ + EVRScreenshotType_VRScreenshotType_None = 0, + EVRScreenshotType_VRScreenshotType_Mono = 1, + EVRScreenshotType_VRScreenshotType_Stereo = 2, + EVRScreenshotType_VRScreenshotType_Cubemap = 3, + EVRScreenshotType_VRScreenshotType_MonoPanorama = 4, + EVRScreenshotType_VRScreenshotType_StereoPanorama = 5, +} EVRScreenshotType; + +typedef enum EVRScreenshotPropertyFilenames +{ + EVRScreenshotPropertyFilenames_VRScreenshotPropertyFilenames_Preview = 0, + EVRScreenshotPropertyFilenames_VRScreenshotPropertyFilenames_VR = 1, +} EVRScreenshotPropertyFilenames; + +typedef enum EVRTrackedCameraError +{ + EVRTrackedCameraError_VRTrackedCameraError_None = 0, + EVRTrackedCameraError_VRTrackedCameraError_OperationFailed = 100, + EVRTrackedCameraError_VRTrackedCameraError_InvalidHandle = 101, + EVRTrackedCameraError_VRTrackedCameraError_InvalidFrameHeaderVersion = 102, + EVRTrackedCameraError_VRTrackedCameraError_OutOfHandles = 103, + EVRTrackedCameraError_VRTrackedCameraError_IPCFailure = 104, + EVRTrackedCameraError_VRTrackedCameraError_NotSupportedForThisDevice = 105, + EVRTrackedCameraError_VRTrackedCameraError_SharedMemoryFailure = 106, + EVRTrackedCameraError_VRTrackedCameraError_FrameBufferingFailure = 107, + EVRTrackedCameraError_VRTrackedCameraError_StreamSetupFailure = 108, + EVRTrackedCameraError_VRTrackedCameraError_InvalidGLTextureId = 109, + EVRTrackedCameraError_VRTrackedCameraError_InvalidSharedTextureHandle = 110, + EVRTrackedCameraError_VRTrackedCameraError_FailedToGetGLTextureId = 111, + EVRTrackedCameraError_VRTrackedCameraError_SharedTextureFailure = 112, + EVRTrackedCameraError_VRTrackedCameraError_NoFrameAvailable = 113, + EVRTrackedCameraError_VRTrackedCameraError_InvalidArgument = 114, + EVRTrackedCameraError_VRTrackedCameraError_InvalidFrameBufferSize = 115, +} EVRTrackedCameraError; + +typedef enum EVRTrackedCameraFrameLayout +{ + EVRTrackedCameraFrameLayout_Mono = 1, + EVRTrackedCameraFrameLayout_Stereo = 2, + EVRTrackedCameraFrameLayout_VerticalLayout = 16, + EVRTrackedCameraFrameLayout_HorizontalLayout = 32, +} EVRTrackedCameraFrameLayout; + +typedef enum EVRTrackedCameraFrameType +{ + EVRTrackedCameraFrameType_VRTrackedCameraFrameType_Distorted = 0, + EVRTrackedCameraFrameType_VRTrackedCameraFrameType_Undistorted = 1, + EVRTrackedCameraFrameType_VRTrackedCameraFrameType_MaximumUndistorted = 2, + EVRTrackedCameraFrameType_MAX_CAMERA_FRAME_TYPES = 3, +} EVRTrackedCameraFrameType; + +typedef enum EVRDistortionFunctionType +{ + EVRDistortionFunctionType_VRDistortionFunctionType_None = 0, + EVRDistortionFunctionType_VRDistortionFunctionType_FTheta = 1, + EVRDistortionFunctionType_VRDistortionFunctionType_Extended_FTheta = 2, + EVRDistortionFunctionType_MAX_DISTORTION_FUNCTION_TYPES = 3, +} EVRDistortionFunctionType; + +typedef enum EVSync +{ + EVSync_VSync_None = 0, + EVSync_VSync_WaitRender = 1, + EVSync_VSync_NoWaitRender = 2, +} EVSync; + +typedef enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection = 1, +} EVRMuraCorrectionMode; + +typedef enum Imu_OffScaleFlags +{ + Imu_OffScaleFlags_OffScale_AccelX = 1, + Imu_OffScaleFlags_OffScale_AccelY = 2, + Imu_OffScaleFlags_OffScale_AccelZ = 4, + Imu_OffScaleFlags_OffScale_GyroX = 8, + Imu_OffScaleFlags_OffScale_GyroY = 16, + Imu_OffScaleFlags_OffScale_GyroZ = 32, +} Imu_OffScaleFlags; + +typedef enum EVRApplicationError +{ + EVRApplicationError_VRApplicationError_None = 0, + EVRApplicationError_VRApplicationError_AppKeyAlreadyExists = 100, + EVRApplicationError_VRApplicationError_NoManifest = 101, + EVRApplicationError_VRApplicationError_NoApplication = 102, + EVRApplicationError_VRApplicationError_InvalidIndex = 103, + EVRApplicationError_VRApplicationError_UnknownApplication = 104, + EVRApplicationError_VRApplicationError_IPCFailed = 105, + EVRApplicationError_VRApplicationError_ApplicationAlreadyRunning = 106, + EVRApplicationError_VRApplicationError_InvalidManifest = 107, + EVRApplicationError_VRApplicationError_InvalidApplication = 108, + EVRApplicationError_VRApplicationError_LaunchFailed = 109, + EVRApplicationError_VRApplicationError_ApplicationAlreadyStarting = 110, + EVRApplicationError_VRApplicationError_LaunchInProgress = 111, + EVRApplicationError_VRApplicationError_OldApplicationQuitting = 112, + EVRApplicationError_VRApplicationError_TransitionAborted = 113, + EVRApplicationError_VRApplicationError_IsTemplate = 114, + EVRApplicationError_VRApplicationError_SteamVRIsExiting = 115, + EVRApplicationError_VRApplicationError_BufferTooSmall = 200, + EVRApplicationError_VRApplicationError_PropertyNotSet = 201, + EVRApplicationError_VRApplicationError_UnknownProperty = 202, + EVRApplicationError_VRApplicationError_InvalidParameter = 203, + EVRApplicationError_VRApplicationError_NotImplemented = 300, +} EVRApplicationError; + +typedef enum EVRApplicationProperty +{ + EVRApplicationProperty_VRApplicationProperty_Name_String = 0, + EVRApplicationProperty_VRApplicationProperty_LaunchType_String = 11, + EVRApplicationProperty_VRApplicationProperty_WorkingDirectory_String = 12, + EVRApplicationProperty_VRApplicationProperty_BinaryPath_String = 13, + EVRApplicationProperty_VRApplicationProperty_Arguments_String = 14, + EVRApplicationProperty_VRApplicationProperty_URL_String = 15, + EVRApplicationProperty_VRApplicationProperty_Description_String = 50, + EVRApplicationProperty_VRApplicationProperty_NewsURL_String = 51, + EVRApplicationProperty_VRApplicationProperty_ImagePath_String = 52, + EVRApplicationProperty_VRApplicationProperty_Source_String = 53, + EVRApplicationProperty_VRApplicationProperty_ActionManifestURL_String = 54, + EVRApplicationProperty_VRApplicationProperty_IsDashboardOverlay_Bool = 60, + EVRApplicationProperty_VRApplicationProperty_IsTemplate_Bool = 61, + EVRApplicationProperty_VRApplicationProperty_IsInstanced_Bool = 62, + EVRApplicationProperty_VRApplicationProperty_IsInternal_Bool = 63, + EVRApplicationProperty_VRApplicationProperty_WantsCompositorPauseInStandby_Bool = 64, + EVRApplicationProperty_VRApplicationProperty_IsHidden_Bool = 65, + EVRApplicationProperty_VRApplicationProperty_LastLaunchTime_Uint64 = 70, +} EVRApplicationProperty; + +typedef enum EVRSceneApplicationState +{ + EVRSceneApplicationState_None = 0, + EVRSceneApplicationState_Starting = 1, + EVRSceneApplicationState_Quitting = 2, + EVRSceneApplicationState_Running = 3, + EVRSceneApplicationState_Waiting = 4, +} EVRSceneApplicationState; + +typedef enum ChaperoneCalibrationState +{ + ChaperoneCalibrationState_OK = 1, + ChaperoneCalibrationState_Warning = 100, + ChaperoneCalibrationState_Warning_BaseStationMayHaveMoved = 101, + ChaperoneCalibrationState_Warning_BaseStationRemoved = 102, + ChaperoneCalibrationState_Warning_SeatedBoundsInvalid = 103, + ChaperoneCalibrationState_Error = 200, + ChaperoneCalibrationState_Error_BaseStationUninitialized = 201, + ChaperoneCalibrationState_Error_BaseStationConflict = 202, + ChaperoneCalibrationState_Error_PlayAreaInvalid = 203, + ChaperoneCalibrationState_Error_CollisionBoundsInvalid = 204, +} ChaperoneCalibrationState; + +typedef enum EChaperoneConfigFile +{ + EChaperoneConfigFile_Live = 1, + EChaperoneConfigFile_Temp = 2, +} EChaperoneConfigFile; + +typedef enum EChaperoneImportFlags +{ + EChaperoneImportFlags_EChaperoneImport_BoundsOnly = 1, +} EChaperoneImportFlags; + +typedef enum EVRCompositorError +{ + EVRCompositorError_VRCompositorError_None = 0, + EVRCompositorError_VRCompositorError_RequestFailed = 1, + EVRCompositorError_VRCompositorError_IncompatibleVersion = 100, + EVRCompositorError_VRCompositorError_DoNotHaveFocus = 101, + EVRCompositorError_VRCompositorError_InvalidTexture = 102, + EVRCompositorError_VRCompositorError_IsNotSceneApplication = 103, + EVRCompositorError_VRCompositorError_TextureIsOnWrongDevice = 104, + EVRCompositorError_VRCompositorError_TextureUsesUnsupportedFormat = 105, + EVRCompositorError_VRCompositorError_SharedTexturesNotSupported = 106, + EVRCompositorError_VRCompositorError_IndexOutOfRange = 107, + EVRCompositorError_VRCompositorError_AlreadySubmitted = 108, + EVRCompositorError_VRCompositorError_InvalidBounds = 109, + EVRCompositorError_VRCompositorError_AlreadySet = 110, +} EVRCompositorError; + +typedef enum EVRCompositorTimingMode +{ + EVRCompositorTimingMode_VRCompositorTimingMode_Implicit = 0, + EVRCompositorTimingMode_VRCompositorTimingMode_Explicit_RuntimePerformsPostPresentHandoff = 1, + EVRCompositorTimingMode_VRCompositorTimingMode_Explicit_ApplicationPerformsPostPresentHandoff = 2, +} EVRCompositorTimingMode; + +typedef enum VROverlayInputMethod +{ + VROverlayInputMethod_None = 0, + VROverlayInputMethod_Mouse = 1, +} VROverlayInputMethod; + +typedef enum VROverlayTransformType +{ + VROverlayTransformType_VROverlayTransform_Invalid = -1, + VROverlayTransformType_VROverlayTransform_Absolute = 0, + VROverlayTransformType_VROverlayTransform_TrackedDeviceRelative = 1, + VROverlayTransformType_VROverlayTransform_SystemOverlay = 2, + VROverlayTransformType_VROverlayTransform_TrackedComponent = 3, + VROverlayTransformType_VROverlayTransform_Cursor = 4, + VROverlayTransformType_VROverlayTransform_DashboardTab = 5, + VROverlayTransformType_VROverlayTransform_DashboardThumb = 6, + VROverlayTransformType_VROverlayTransform_Mountable = 7, + VROverlayTransformType_VROverlayTransform_Projection = 8, +} VROverlayTransformType; + +typedef enum VROverlayFlags +{ + VROverlayFlags_NoDashboardTab = 8, + VROverlayFlags_SendVRDiscreteScrollEvents = 64, + VROverlayFlags_SendVRTouchpadEvents = 128, + VROverlayFlags_ShowTouchPadScrollWheel = 256, + VROverlayFlags_TransferOwnershipToInternalProcess = 512, + VROverlayFlags_SideBySide_Parallel = 1024, + VROverlayFlags_SideBySide_Crossed = 2048, + VROverlayFlags_Panorama = 4096, + VROverlayFlags_StereoPanorama = 8192, + VROverlayFlags_SortWithNonSceneOverlays = 16384, + VROverlayFlags_VisibleInDashboard = 32768, + VROverlayFlags_MakeOverlaysInteractiveIfVisible = 65536, + VROverlayFlags_SendVRSmoothScrollEvents = 131072, + VROverlayFlags_ProtectedContent = 262144, + VROverlayFlags_HideLaserIntersection = 524288, + VROverlayFlags_WantsModalBehavior = 1048576, + VROverlayFlags_IsPremultiplied = 2097152, +} VROverlayFlags; + +typedef enum VRMessageOverlayResponse +{ + VRMessageOverlayResponse_ButtonPress_0 = 0, + VRMessageOverlayResponse_ButtonPress_1 = 1, + VRMessageOverlayResponse_ButtonPress_2 = 2, + VRMessageOverlayResponse_ButtonPress_3 = 3, + VRMessageOverlayResponse_CouldntFindSystemOverlay = 4, + VRMessageOverlayResponse_CouldntFindOrCreateClientOverlay = 5, + VRMessageOverlayResponse_ApplicationQuit = 6, +} VRMessageOverlayResponse; + +typedef enum EGamepadTextInputMode +{ + EGamepadTextInputMode_k_EGamepadTextInputModeNormal = 0, + EGamepadTextInputMode_k_EGamepadTextInputModePassword = 1, + EGamepadTextInputMode_k_EGamepadTextInputModeSubmit = 2, +} EGamepadTextInputMode; + +typedef enum EGamepadTextInputLineMode +{ + EGamepadTextInputLineMode_k_EGamepadTextInputLineModeSingleLine = 0, + EGamepadTextInputLineMode_k_EGamepadTextInputLineModeMultipleLines = 1, +} EGamepadTextInputLineMode; + +typedef enum EVROverlayIntersectionMaskPrimitiveType +{ + EVROverlayIntersectionMaskPrimitiveType_OverlayIntersectionPrimitiveType_Rectangle = 0, + EVROverlayIntersectionMaskPrimitiveType_OverlayIntersectionPrimitiveType_Circle = 1, +} EVROverlayIntersectionMaskPrimitiveType; + +typedef enum EKeyboardFlags +{ + EKeyboardFlags_KeyboardFlag_Minimal = 1, + EKeyboardFlags_KeyboardFlag_Modal = 2, +} EKeyboardFlags; + +typedef enum EDeviceType +{ + EDeviceType_DeviceType_Invalid = -1, + EDeviceType_DeviceType_DirectX11 = 0, + EDeviceType_DeviceType_Vulkan = 1, +} EDeviceType; + +typedef enum HeadsetViewMode_t +{ + HeadsetViewMode_t_HeadsetViewMode_Left = 0, + HeadsetViewMode_t_HeadsetViewMode_Right = 1, + HeadsetViewMode_t_HeadsetViewMode_Both = 2, +} HeadsetViewMode_t; + +typedef enum EVRRenderModelError +{ + EVRRenderModelError_VRRenderModelError_None = 0, + EVRRenderModelError_VRRenderModelError_Loading = 100, + EVRRenderModelError_VRRenderModelError_NotSupported = 200, + EVRRenderModelError_VRRenderModelError_InvalidArg = 300, + EVRRenderModelError_VRRenderModelError_InvalidModel = 301, + EVRRenderModelError_VRRenderModelError_NoShapes = 302, + EVRRenderModelError_VRRenderModelError_MultipleShapes = 303, + EVRRenderModelError_VRRenderModelError_TooManyVertices = 304, + EVRRenderModelError_VRRenderModelError_MultipleTextures = 305, + EVRRenderModelError_VRRenderModelError_BufferTooSmall = 306, + EVRRenderModelError_VRRenderModelError_NotEnoughNormals = 307, + EVRRenderModelError_VRRenderModelError_NotEnoughTexCoords = 308, + EVRRenderModelError_VRRenderModelError_InvalidTexture = 400, +} EVRRenderModelError; + +typedef enum EVRRenderModelTextureFormat +{ + EVRRenderModelTextureFormat_VRRenderModelTextureFormat_RGBA8_SRGB = 0, + EVRRenderModelTextureFormat_VRRenderModelTextureFormat_BC2 = 1, + EVRRenderModelTextureFormat_VRRenderModelTextureFormat_BC4 = 2, + EVRRenderModelTextureFormat_VRRenderModelTextureFormat_BC7 = 3, + EVRRenderModelTextureFormat_VRRenderModelTextureFormat_BC7_SRGB = 4, +} EVRRenderModelTextureFormat; + +typedef enum EVRNotificationType +{ + EVRNotificationType_Transient = 0, + EVRNotificationType_Persistent = 1, + EVRNotificationType_Transient_SystemWithUserValue = 2, +} EVRNotificationType; + +typedef enum EVRNotificationStyle +{ + EVRNotificationStyle_None = 0, + EVRNotificationStyle_Application = 100, + EVRNotificationStyle_Contact_Disabled = 200, + EVRNotificationStyle_Contact_Enabled = 201, + EVRNotificationStyle_Contact_Active = 202, +} EVRNotificationStyle; + +typedef enum EVRSettingsError +{ + EVRSettingsError_VRSettingsError_None = 0, + EVRSettingsError_VRSettingsError_IPCFailed = 1, + EVRSettingsError_VRSettingsError_WriteFailed = 2, + EVRSettingsError_VRSettingsError_ReadFailed = 3, + EVRSettingsError_VRSettingsError_JsonParseFailed = 4, + EVRSettingsError_VRSettingsError_UnsetSettingHasNoDefault = 5, +} EVRSettingsError; + +typedef enum EVRScreenshotError +{ + EVRScreenshotError_VRScreenshotError_None = 0, + EVRScreenshotError_VRScreenshotError_RequestFailed = 1, + EVRScreenshotError_VRScreenshotError_IncompatibleVersion = 100, + EVRScreenshotError_VRScreenshotError_NotFound = 101, + EVRScreenshotError_VRScreenshotError_BufferTooSmall = 102, + EVRScreenshotError_VRScreenshotError_ScreenshotAlreadyInProgress = 108, +} EVRScreenshotError; + +typedef enum EVRSkeletalTransformSpace +{ + EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Model = 0, + EVRSkeletalTransformSpace_VRSkeletalTransformSpace_Parent = 1, +} EVRSkeletalTransformSpace; + +typedef enum EVRSkeletalReferencePose +{ + EVRSkeletalReferencePose_VRSkeletalReferencePose_BindPose = 0, + EVRSkeletalReferencePose_VRSkeletalReferencePose_OpenHand = 1, + EVRSkeletalReferencePose_VRSkeletalReferencePose_Fist = 2, + EVRSkeletalReferencePose_VRSkeletalReferencePose_GripLimit = 3, +} EVRSkeletalReferencePose; + +typedef enum EVRFinger +{ + EVRFinger_VRFinger_Thumb = 0, + EVRFinger_VRFinger_Index = 1, + EVRFinger_VRFinger_Middle = 2, + EVRFinger_VRFinger_Ring = 3, + EVRFinger_VRFinger_Pinky = 4, + EVRFinger_VRFinger_Count = 5, +} EVRFinger; + +typedef enum EVRFingerSplay +{ + EVRFingerSplay_VRFingerSplay_Thumb_Index = 0, + EVRFingerSplay_VRFingerSplay_Index_Middle = 1, + EVRFingerSplay_VRFingerSplay_Middle_Ring = 2, + EVRFingerSplay_VRFingerSplay_Ring_Pinky = 3, + EVRFingerSplay_VRFingerSplay_Count = 4, +} EVRFingerSplay; + +typedef enum EVRSummaryType +{ + EVRSummaryType_VRSummaryType_FromAnimation = 0, + EVRSummaryType_VRSummaryType_FromDevice = 1, +} EVRSummaryType; + +typedef enum EVRInputFilterCancelType +{ + EVRInputFilterCancelType_VRInputFilterCancel_Timers = 0, + EVRInputFilterCancelType_VRInputFilterCancel_Momentum = 1, +} EVRInputFilterCancelType; + +typedef enum EVRInputStringBits +{ + EVRInputStringBits_VRInputString_Hand = 1, + EVRInputStringBits_VRInputString_ControllerType = 2, + EVRInputStringBits_VRInputString_InputSource = 4, + EVRInputStringBits_VRInputString_All = -1, +} EVRInputStringBits; + +typedef enum EIOBufferError +{ + EIOBufferError_IOBuffer_Success = 0, + EIOBufferError_IOBuffer_OperationFailed = 100, + EIOBufferError_IOBuffer_InvalidHandle = 101, + EIOBufferError_IOBuffer_InvalidArgument = 102, + EIOBufferError_IOBuffer_PathExists = 103, + EIOBufferError_IOBuffer_PathDoesNotExist = 104, + EIOBufferError_IOBuffer_Permission = 105, +} EIOBufferError; + +typedef enum EIOBufferMode +{ + EIOBufferMode_IOBufferMode_Read = 1, + EIOBufferMode_IOBufferMode_Write = 2, + EIOBufferMode_IOBufferMode_Create = 512, +} EIOBufferMode; + +typedef enum EVRDebugError +{ + EVRDebugError_VRDebugError_Success = 0, + EVRDebugError_VRDebugError_BadParameter = 1, +} EVRDebugError; + +typedef enum EPropertyWriteType +{ + EPropertyWriteType_PropertyWrite_Set = 0, + EPropertyWriteType_PropertyWrite_Erase = 1, + EPropertyWriteType_PropertyWrite_SetError = 2, +} EPropertyWriteType; + +typedef enum EBlockQueueError +{ + EBlockQueueError_BlockQueueError_None = 0, + EBlockQueueError_BlockQueueError_QueueAlreadyExists = 1, + EBlockQueueError_BlockQueueError_QueueNotFound = 2, + EBlockQueueError_BlockQueueError_BlockNotAvailable = 3, + EBlockQueueError_BlockQueueError_InvalidHandle = 4, + EBlockQueueError_BlockQueueError_InvalidParam = 5, + EBlockQueueError_BlockQueueError_ParamMismatch = 6, + EBlockQueueError_BlockQueueError_InternalError = 7, + EBlockQueueError_BlockQueueError_AlreadyInitialized = 8, + EBlockQueueError_BlockQueueError_OperationIsServerOnly = 9, + EBlockQueueError_BlockQueueError_TooManyConnections = 10, +} EBlockQueueError; + +typedef enum EBlockQueueReadType +{ + EBlockQueueReadType_BlockQueueRead_Latest = 0, + EBlockQueueReadType_BlockQueueRead_New = 1, + EBlockQueueReadType_BlockQueueRead_Next = 2, +} EBlockQueueReadType; + + +// OpenVR typedefs + +typedef uint32_t TrackedDeviceIndex_t; +typedef uint32_t VRNotificationId; +typedef uint64_t VROverlayHandle_t; + +typedef uint32_t SpatialAnchorHandle_t; +typedef void * glSharedTextureHandle_t; +typedef int32_t glInt_t; +typedef uint32_t glUInt_t; +typedef uint64_t SharedTextureHandle_t; +typedef uint32_t DriverId_t; +typedef uint32_t TrackedDeviceIndex_t; +typedef uint64_t WebConsoleHandle_t; +typedef uint64_t PropertyContainerHandle_t; +typedef uint32_t PropertyTypeTag_t; +typedef PropertyContainerHandle_t DriverHandle_t; +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; +typedef uint32_t VRComponentProperties; +typedef uint64_t VROverlayHandle_t; +typedef int32_t BoneIndex_t; +typedef uint64_t TrackedCameraHandle_t; +typedef uint32_t ScreenshotHandle_t; +typedef int32_t TextureID_t; +typedef uint32_t VRNotificationId; +typedef uint64_t IOBufferHandle_t; +typedef uint64_t VrProfilerEventHandle_t; +typedef EVRInitError HmdError; +typedef EVREye Hmd_Eye; +typedef EColorSpace ColorSpace; +typedef ETrackingResult HmdTrackingResult; +typedef ETrackedDeviceClass TrackedDeviceClass; +typedef ETrackingUniverseOrigin TrackingUniverseOrigin; +typedef ETrackedDeviceProperty TrackedDeviceProperty; +typedef ETrackedPropertyError TrackedPropertyError; +typedef EVRSubmitFlags VRSubmitFlags_t; +typedef EVRState VRState_t; +typedef ECollisionBoundsStyle CollisionBoundsStyle_t; +typedef EVROverlayError VROverlayError; +typedef EVRFirmwareError VRFirmwareError; +typedef EVRCompositorError VRCompositorError; +typedef EVRScreenshotError VRScreenshotsError; +typedef uint64_t PathHandle_t; + +// OpenVR Structs + +typedef struct HmdMatrix34_t +{ + float m[3][4]; //float[3][4] +} HmdMatrix34_t; + +typedef struct HmdMatrix33_t +{ + float m[3][3]; //float[3][3] +} HmdMatrix33_t; + +typedef struct HmdMatrix44_t +{ + float m[4][4]; //float[4][4] +} HmdMatrix44_t; + +typedef struct HmdVector3_t +{ + float v[3]; //float[3] +} HmdVector3_t; + +typedef struct HmdVector4_t +{ + float v[4]; //float[4] +} HmdVector4_t; + +typedef struct HmdVector3d_t +{ + double v[3]; //double[3] +} HmdVector3d_t; + +typedef struct HmdVector2_t +{ + float v[2]; //float[2] +} HmdVector2_t; + +typedef struct HmdQuaternion_t +{ + double w; + double x; + double y; + double z; +} HmdQuaternion_t; + +typedef struct HmdQuaternionf_t +{ + float w; + float x; + float y; + float z; +} HmdQuaternionf_t; + +typedef struct HmdColor_t +{ + float r; + float g; + float b; + float a; +} HmdColor_t; + +typedef struct HmdQuad_t +{ + struct HmdVector3_t vCorners[4]; //struct vr::HmdVector3_t[4] +} HmdQuad_t; + +typedef struct HmdRect2_t +{ + struct HmdVector2_t vTopLeft; + struct HmdVector2_t vBottomRight; +} HmdRect2_t; + +typedef struct VRBoneTransform_t +{ + struct HmdVector4_t position; + struct HmdQuaternionf_t orientation; +} VRBoneTransform_t; + +typedef struct DistortionCoordinates_t +{ + float rfRed[2]; //float[2] + float rfGreen[2]; //float[2] + float rfBlue[2]; //float[2] +} DistortionCoordinates_t; + +typedef struct Texture_t +{ + void * handle; // void * + enum ETextureType eType; + enum EColorSpace eColorSpace; +} Texture_t; + +typedef struct TrackedDevicePose_t +{ + struct HmdMatrix34_t mDeviceToAbsoluteTracking; + struct HmdVector3_t vVelocity; + struct HmdVector3_t vAngularVelocity; + enum ETrackingResult eTrackingResult; + bool bPoseIsValid; + bool bDeviceIsConnected; +} TrackedDevicePose_t; + +typedef struct VRTextureBounds_t +{ + float uMin; + float vMin; + float uMax; + float vMax; +} VRTextureBounds_t; + +typedef struct VRTextureWithPose_t +{ + void * handle; // void * + enum ETextureType eType; + enum EColorSpace eColorSpace; + struct HmdMatrix34_t mDeviceToAbsoluteTracking; +} VRTextureWithPose_t; + +typedef struct VRTextureDepthInfo_t +{ + void * handle; // void * + struct HmdMatrix44_t mProjection; + struct HmdVector2_t vRange; +} VRTextureDepthInfo_t; + +typedef struct VRTextureWithDepth_t +{ + void * handle; // void * + enum ETextureType eType; + enum EColorSpace eColorSpace; + struct VRTextureDepthInfo_t depth; +} VRTextureWithDepth_t; + +typedef struct VRTextureWithPoseAndDepth_t +{ + void * handle; // void * + enum ETextureType eType; + enum EColorSpace eColorSpace; + struct HmdMatrix34_t mDeviceToAbsoluteTracking; + struct VRTextureDepthInfo_t depth; +} VRTextureWithPoseAndDepth_t; + +typedef struct VRVulkanTextureData_t +{ + uint64_t m_nImage; + struct VkDevice_T * m_pDevice; // struct VkDevice_T * + struct VkPhysicalDevice_T * m_pPhysicalDevice; // struct VkPhysicalDevice_T * + struct VkInstance_T * m_pInstance; // struct VkInstance_T * + struct VkQueue_T * m_pQueue; // struct VkQueue_T * + uint32_t m_nQueueFamilyIndex; + uint32_t m_nWidth; + uint32_t m_nHeight; + uint32_t m_nFormat; + uint32_t m_nSampleCount; +} VRVulkanTextureData_t; + +typedef struct VRVulkanTextureArrayData_t +{ + uint32_t m_unArrayIndex; + uint32_t m_unArraySize; +} VRVulkanTextureArrayData_t; + +typedef struct D3D12TextureData_t +{ + struct ID3D12Resource * m_pResource; // struct ID3D12Resource * + struct ID3D12CommandQueue * m_pCommandQueue; // struct ID3D12CommandQueue * + uint32_t m_nNodeMask; +} D3D12TextureData_t; + +typedef struct VREvent_Controller_t +{ + uint32_t button; +} VREvent_Controller_t; + +typedef struct VREvent_Mouse_t +{ + float x; + float y; + uint32_t button; +} VREvent_Mouse_t; + +typedef struct VREvent_Scroll_t +{ + float xdelta; + float ydelta; + uint32_t unused; + float viewportscale; +} VREvent_Scroll_t; + +typedef struct VREvent_TouchPadMove_t +{ + bool bFingerDown; + float flSecondsFingerDown; + float fValueXFirst; + float fValueYFirst; + float fValueXRaw; + float fValueYRaw; +} VREvent_TouchPadMove_t; + +typedef struct VREvent_Notification_t +{ + uint64_t ulUserValue; + uint32_t notificationId; +} VREvent_Notification_t; + +typedef struct VREvent_Process_t +{ + uint32_t pid; + uint32_t oldPid; + bool bForced; + bool bConnectionLost; +} VREvent_Process_t; + +typedef struct VREvent_Overlay_t +{ + uint64_t overlayHandle; + uint64_t devicePath; + uint64_t memoryBlockId; +} VREvent_Overlay_t; + +typedef struct VREvent_Status_t +{ + uint32_t statusState; +} VREvent_Status_t; + +typedef struct VREvent_Keyboard_t +{ + char cNewInput[8]; //char[8] + uint64_t uUserValue; +} VREvent_Keyboard_t; + +typedef struct VREvent_Ipd_t +{ + float ipdMeters; +} VREvent_Ipd_t; + +typedef struct VREvent_Chaperone_t +{ + uint64_t m_nPreviousUniverse; + uint64_t m_nCurrentUniverse; +} VREvent_Chaperone_t; + +typedef struct VREvent_Reserved_t +{ + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; + uint64_t reserved4; + uint64_t reserved5; +} VREvent_Reserved_t; + +typedef struct VREvent_PerformanceTest_t +{ + uint32_t m_nFidelityLevel; +} VREvent_PerformanceTest_t; + +typedef struct VREvent_SeatedZeroPoseReset_t +{ + bool bResetBySystemMenu; +} VREvent_SeatedZeroPoseReset_t; + +typedef struct VREvent_Screenshot_t +{ + uint32_t handle; + uint32_t type; +} VREvent_Screenshot_t; + +typedef struct VREvent_ScreenshotProgress_t +{ + float progress; +} VREvent_ScreenshotProgress_t; + +typedef struct VREvent_ApplicationLaunch_t +{ + uint32_t pid; + uint32_t unArgsHandle; +} VREvent_ApplicationLaunch_t; + +typedef struct VREvent_EditingCameraSurface_t +{ + uint64_t overlayHandle; + uint32_t nVisualMode; +} VREvent_EditingCameraSurface_t; + +typedef struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; +} VREvent_MessageOverlay_t; + +typedef struct VREvent_Property_t +{ + PropertyContainerHandle_t container; + enum ETrackedDeviceProperty prop; +} VREvent_Property_t; + +typedef struct VREvent_HapticVibration_t +{ + uint64_t containerHandle; + uint64_t componentHandle; + float fDurationSeconds; + float fFrequency; + float fAmplitude; +} VREvent_HapticVibration_t; + +typedef struct VREvent_WebConsole_t +{ + WebConsoleHandle_t webConsoleHandle; +} VREvent_WebConsole_t; + +typedef struct VREvent_InputBindingLoad_t +{ + PropertyContainerHandle_t ulAppContainer; + uint64_t pathMessage; + uint64_t pathUrl; + uint64_t pathControllerType; +} VREvent_InputBindingLoad_t; + +typedef struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; +} VREvent_InputActionManifestLoad_t; + +typedef struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +} VREvent_SpatialAnchor_t; + +typedef struct VREvent_ProgressUpdate_t +{ + uint64_t ulApplicationPropertyContainer; + uint64_t pathDevice; + uint64_t pathInputSource; + uint64_t pathProgressAction; + uint64_t pathIcon; + float fProgress; +} VREvent_ProgressUpdate_t; + +typedef struct VREvent_ShowUI_t +{ + enum EShowUIType eType; +} VREvent_ShowUI_t; + +typedef struct VREvent_ShowDevTools_t +{ + int32_t nBrowserIdentifier; +} VREvent_ShowDevTools_t; + +typedef struct VREvent_HDCPError_t +{ + enum EHDCPError eCode; +} VREvent_HDCPError_t; + +typedef struct RenderModel_ComponentState_t +{ + struct HmdMatrix34_t mTrackingToComponentRenderModel; + struct HmdMatrix34_t mTrackingToComponentLocal; + VRComponentProperties uProperties; +} RenderModel_ComponentState_t; + +typedef struct HiddenAreaMesh_t +{ + struct HmdVector2_t * pVertexData; // const struct vr::HmdVector2_t * + uint32_t unTriangleCount; +} HiddenAreaMesh_t; + +typedef struct VRControllerAxis_t +{ + float x; + float y; +} VRControllerAxis_t; + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif +typedef struct VRControllerState_t +{ + uint32_t unPacketNum; + uint64_t ulButtonPressed; + uint64_t ulButtonTouched; + struct VRControllerAxis_t rAxis[5]; //struct vr::VRControllerAxis_t[5] +} VRControllerState_t; +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + +typedef struct CameraVideoStreamFrameHeader_t +{ + enum EVRTrackedCameraFrameType eFrameType; + uint32_t nWidth; + uint32_t nHeight; + uint32_t nBytesPerPixel; + uint32_t nFrameSequence; + struct TrackedDevicePose_t trackedDevicePose; + uint64_t ulFrameExposureTime; +} CameraVideoStreamFrameHeader_t; + +typedef struct Compositor_FrameTiming +{ + uint32_t m_nSize; + uint32_t m_nFrameIndex; + uint32_t m_nNumFramePresents; + uint32_t m_nNumMisPresented; + uint32_t m_nNumDroppedFrames; + uint32_t m_nReprojectionFlags; + double m_flSystemTimeInSeconds; + float m_flPreSubmitGpuMs; + float m_flPostSubmitGpuMs; + float m_flTotalRenderGpuMs; + float m_flCompositorRenderGpuMs; + float m_flCompositorRenderCpuMs; + float m_flCompositorIdleCpuMs; + float m_flClientFrameIntervalMs; + float m_flPresentCallCpuMs; + float m_flWaitForPresentCpuMs; + float m_flSubmitFrameMs; + float m_flWaitGetPosesCalledMs; + float m_flNewPosesReadyMs; + float m_flNewFrameReadyMs; + float m_flCompositorUpdateStartMs; + float m_flCompositorUpdateEndMs; + float m_flCompositorRenderStartMs; + TrackedDevicePose_t m_HmdPose; + uint32_t m_nNumVSyncsReadyForUse; + uint32_t m_nNumVSyncsToFirstView; +} Compositor_FrameTiming; + +typedef struct Compositor_BenchmarkResults +{ + float m_flMegaPixelsPerSecond; + float m_flHmdRecommendedMegaPixelsPerSecond; +} Compositor_BenchmarkResults; + +typedef struct DriverDirectMode_FrameTiming +{ + uint32_t m_nSize; + uint32_t m_nNumFramePresents; + uint32_t m_nNumMisPresented; + uint32_t m_nNumDroppedFrames; + uint32_t m_nReprojectionFlags; +} DriverDirectMode_FrameTiming; + +typedef struct ImuSample_t +{ + double fSampleTime; + struct HmdVector3d_t vAccel; + struct HmdVector3d_t vGyro; + uint32_t unOffScaleFlags; +} ImuSample_t; + +typedef struct AppOverrideKeys_t +{ + char * pchKey; // const char * + char * pchValue; // const char * +} AppOverrideKeys_t; + +typedef struct Compositor_CumulativeStats +{ + uint32_t m_nPid; + uint32_t m_nNumFramePresents; + uint32_t m_nNumDroppedFrames; + uint32_t m_nNumReprojectedFrames; + uint32_t m_nNumFramePresentsOnStartup; + uint32_t m_nNumDroppedFramesOnStartup; + uint32_t m_nNumReprojectedFramesOnStartup; + uint32_t m_nNumLoading; + uint32_t m_nNumFramePresentsLoading; + uint32_t m_nNumDroppedFramesLoading; + uint32_t m_nNumReprojectedFramesLoading; + uint32_t m_nNumTimedOut; + uint32_t m_nNumFramePresentsTimedOut; + uint32_t m_nNumDroppedFramesTimedOut; + uint32_t m_nNumReprojectedFramesTimedOut; +} Compositor_CumulativeStats; + +typedef struct Compositor_StageRenderSettings +{ + struct HmdColor_t m_PrimaryColor; + struct HmdColor_t m_SecondaryColor; + float m_flVignetteInnerRadius; + float m_flVignetteOuterRadius; + float m_flFresnelStrength; + bool m_bBackfaceCulling; + bool m_bGreyscale; + bool m_bWireframe; +} Compositor_StageRenderSettings; + +typedef struct VROverlayIntersectionParams_t +{ + struct HmdVector3_t vSource; + struct HmdVector3_t vDirection; + enum ETrackingUniverseOrigin eOrigin; +} VROverlayIntersectionParams_t; + +typedef struct VROverlayIntersectionResults_t +{ + struct HmdVector3_t vPoint; + struct HmdVector3_t vNormal; + struct HmdVector2_t vUVs; + float fDistance; +} VROverlayIntersectionResults_t; + +typedef struct IntersectionMaskRectangle_t +{ + float m_flTopLeftX; + float m_flTopLeftY; + float m_flWidth; + float m_flHeight; +} IntersectionMaskRectangle_t; + +typedef struct IntersectionMaskCircle_t +{ + float m_flCenterX; + float m_flCenterY; + float m_flRadius; +} IntersectionMaskCircle_t; + +typedef struct VROverlayProjection_t +{ + float fLeft; + float fRight; + float fTop; + float fBottom; +} VROverlayProjection_t; + +typedef struct VROverlayView_t +{ + VROverlayHandle_t overlayHandle; + struct Texture_t texture; + struct VRTextureBounds_t textureBounds; +} VROverlayView_t; + +typedef struct VRVulkanDevice_t +{ + struct VkInstance_T * m_pInstance; // struct VkInstance_T * + struct VkDevice_T * m_pDevice; // struct VkDevice_T * + struct VkPhysicalDevice_T * m_pPhysicalDevice; // struct VkPhysicalDevice_T * + struct VkQueue_T * m_pQueue; // struct VkQueue_T * + uint32_t m_uQueueFamilyIndex; +} VRVulkanDevice_t; + +typedef struct VRNativeDevice_t +{ + void * handle; // void * + enum EDeviceType eType; +} VRNativeDevice_t; + +typedef struct RenderModel_Vertex_t +{ + struct HmdVector3_t vPosition; + struct HmdVector3_t vNormal; + float rfTextureCoord[2]; //float[2] +} RenderModel_Vertex_t; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( push, 4 ) +#endif +typedef struct RenderModel_TextureMap_t +{ + uint16_t unWidth; + uint16_t unHeight; + uint8_t * rubTextureMapData; // const uint8_t * + enum EVRRenderModelTextureFormat format; +} RenderModel_TextureMap_t; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( push, 4 ) +#endif +typedef struct RenderModel_t +{ + struct RenderModel_Vertex_t * rVertexData; // const struct vr::RenderModel_Vertex_t * + uint32_t unVertexCount; + uint16_t * rIndexData; // const uint16_t * + uint32_t unTriangleCount; + TextureID_t diffuseTextureId; +} RenderModel_t; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif +typedef struct RenderModel_ControllerMode_State_t +{ + bool bScrollWheelVisible; +} RenderModel_ControllerMode_State_t; + +typedef struct NotificationBitmap_t +{ + void * m_pImageData; // void * + int32_t m_nWidth; + int32_t m_nHeight; + int32_t m_nBytesPerPixel; +} NotificationBitmap_t; + +typedef struct CVRSettingHelper +{ + intptr_t m_pSettings; // class vr::IVRSettings * +} CVRSettingHelper; + +typedef struct InputAnalogActionData_t +{ + bool bActive; + VRInputValueHandle_t activeOrigin; + float x; + float y; + float z; + float deltaX; + float deltaY; + float deltaZ; + float fUpdateTime; +} InputAnalogActionData_t; + +typedef struct InputDigitalActionData_t +{ + bool bActive; + VRInputValueHandle_t activeOrigin; + bool bState; + bool bChanged; + float fUpdateTime; +} InputDigitalActionData_t; + +typedef struct InputPoseActionData_t +{ + bool bActive; + VRInputValueHandle_t activeOrigin; + struct TrackedDevicePose_t pose; +} InputPoseActionData_t; + +typedef struct InputSkeletalActionData_t +{ + bool bActive; + VRInputValueHandle_t activeOrigin; +} InputSkeletalActionData_t; + +typedef struct InputOriginInfo_t +{ + VRInputValueHandle_t devicePath; + TrackedDeviceIndex_t trackedDeviceIndex; + char rchRenderModelComponentName[128]; //char[128] +} InputOriginInfo_t; + +typedef struct InputBindingInfo_t +{ + char rchDevicePathName[128]; //char[128] + char rchInputPathName[128]; //char[128] + char rchModeName[128]; //char[128] + char rchSlotName[128]; //char[128] + char rchInputSourceType[32]; //char[32] +} InputBindingInfo_t; + +typedef struct VRActiveActionSet_t +{ + VRActionSetHandle_t ulActionSet; + VRInputValueHandle_t ulRestrictedToDevice; + VRActionSetHandle_t ulSecondaryActionSet; + uint32_t unPadding; + int32_t nPriority; +} VRActiveActionSet_t; + +typedef struct VRSkeletalSummaryData_t +{ + float flFingerCurl[5]; //float[5] + float flFingerSplay[4]; //float[4] +} VRSkeletalSummaryData_t; + +typedef struct SpatialAnchorPose_t +{ + struct HmdMatrix34_t mAnchorToAbsoluteTracking; +} SpatialAnchorPose_t; + +typedef struct COpenVRContext +{ + intptr_t m_pVRSystem; // class vr::IVRSystem * + intptr_t m_pVRChaperone; // class vr::IVRChaperone * + intptr_t m_pVRChaperoneSetup; // class vr::IVRChaperoneSetup * + intptr_t m_pVRCompositor; // class vr::IVRCompositor * + intptr_t m_pVRHeadsetView; // class vr::IVRHeadsetView * + intptr_t m_pVROverlay; // class vr::IVROverlay * + intptr_t m_pVROverlayView; // class vr::IVROverlayView * + intptr_t m_pVRResources; // class vr::IVRResources * + intptr_t m_pVRRenderModels; // class vr::IVRRenderModels * + intptr_t m_pVRExtendedDisplay; // class vr::IVRExtendedDisplay * + intptr_t m_pVRSettings; // class vr::IVRSettings * + intptr_t m_pVRApplications; // class vr::IVRApplications * + intptr_t m_pVRTrackedCamera; // class vr::IVRTrackedCamera * + intptr_t m_pVRScreenshots; // class vr::IVRScreenshots * + intptr_t m_pVRDriverManager; // class vr::IVRDriverManager * + intptr_t m_pVRInput; // class vr::IVRInput * + intptr_t m_pVRIOBuffer; // class vr::IVRIOBuffer * + intptr_t m_pVRSpatialAnchors; // class vr::IVRSpatialAnchors * + intptr_t m_pVRDebug; // class vr::IVRDebug * + intptr_t m_pVRNotifications; // class vr::IVRNotifications * +} COpenVRContext; + +typedef struct PropertyWrite_t +{ + enum ETrackedDeviceProperty prop; + enum EPropertyWriteType writeType; + enum ETrackedPropertyError eSetError; + void * pvBuffer; // void * + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + enum ETrackedPropertyError eError; +} PropertyWrite_t; + +typedef struct PropertyRead_t +{ + enum ETrackedDeviceProperty prop; + void * pvBuffer; // void * + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + uint32_t unRequiredBufferSize; + enum ETrackedPropertyError eError; +} PropertyRead_t; + +typedef struct CVRPropertyHelpers +{ + intptr_t m_pProperties; // class vr::IVRProperties * +} CVRPropertyHelpers; + +typedef struct PathWrite_t +{ + PathHandle_t ulPath; + enum EPropertyWriteType writeType; + enum ETrackedPropertyError eSetError; + void * pvBuffer; // void * + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + enum ETrackedPropertyError eError; + char * pszPath; // const char * +} PathWrite_t; + +typedef struct PathRead_t +{ + PathHandle_t ulPath; + void * pvBuffer; // void * + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + uint32_t unRequiredBufferSize; + enum ETrackedPropertyError eError; + char * pszPath; // const char * +} PathRead_t; + + +typedef union +{ + VREvent_Reserved_t reserved; + VREvent_Controller_t controller; + VREvent_Mouse_t mouse; + VREvent_Scroll_t scroll; + VREvent_Process_t process; + VREvent_Notification_t notification; + VREvent_Overlay_t overlay; + VREvent_Status_t status; + VREvent_Keyboard_t keyboard; + VREvent_Ipd_t ipd; + VREvent_Chaperone_t chaperone; + VREvent_PerformanceTest_t performanceTest; + VREvent_TouchPadMove_t touchPadMove; + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + VREvent_Screenshot_t screenshot; + VREvent_ScreenshotProgress_t screenshotProgress; + VREvent_ApplicationLaunch_t applicationLaunch; + VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; + VREvent_Property_t property; + VREvent_HapticVibration_t hapticVibration; + VREvent_WebConsole_t webConsole; + VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; +} VREvent_Data_t; + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +/** An event posted by the server to all running applications */ +struct VREvent_t +{ + uint32_t eventType; // EVREventType enum + TrackedDeviceIndex_t trackedDeviceIndex; + float eventAgeSeconds; + // event data must be the end of the struct as its size is variable + VREvent_Data_t data; +}; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + + +typedef union +{ + IntersectionMaskRectangle_t m_Rectangle; + IntersectionMaskCircle_t m_Circle; +} VROverlayIntersectionMaskPrimitive_Data_t; + +struct VROverlayIntersectionMaskPrimitive_t +{ + EVROverlayIntersectionMaskPrimitiveType m_nPrimitiveType; + VROverlayIntersectionMaskPrimitive_Data_t m_Primitive; +}; + + +// OpenVR Function Pointer Tables + +struct VR_IVRSystem_FnTable +{ + void (OPENVR_FNTABLE_CALLTYPE *GetRecommendedRenderTargetSize)(uint32_t * pnWidth, uint32_t * pnHeight); + struct HmdMatrix44_t (OPENVR_FNTABLE_CALLTYPE *GetProjectionMatrix)(EVREye eEye, float fNearZ, float fFarZ); + void (OPENVR_FNTABLE_CALLTYPE *GetProjectionRaw)(EVREye eEye, float * pfLeft, float * pfRight, float * pfTop, float * pfBottom); + bool (OPENVR_FNTABLE_CALLTYPE *ComputeDistortion)(EVREye eEye, float fU, float fV, struct DistortionCoordinates_t * pDistortionCoordinates); + struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetEyeToHeadTransform)(EVREye eEye); + bool (OPENVR_FNTABLE_CALLTYPE *GetTimeSinceLastVsync)(float * pfSecondsSinceLastVsync, uint64_t * pulFrameCounter); + int32_t (OPENVR_FNTABLE_CALLTYPE *GetD3D9AdapterIndex)(); + void (OPENVR_FNTABLE_CALLTYPE *GetDXGIOutputInfo)(int32_t * pnAdapterIndex); + void (OPENVR_FNTABLE_CALLTYPE *GetOutputDevice)(uint64_t * pnDevice, ETextureType textureType, struct VkInstance_T * pInstance); + bool (OPENVR_FNTABLE_CALLTYPE *IsDisplayOnDesktop)(); + bool (OPENVR_FNTABLE_CALLTYPE *SetDisplayVisibility)(bool bIsVisibleOnDesktop); + void (OPENVR_FNTABLE_CALLTYPE *GetDeviceToAbsoluteTrackingPose)(ETrackingUniverseOrigin eOrigin, float fPredictedSecondsToPhotonsFromNow, struct TrackedDevicePose_t * pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount); + struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetSeatedZeroPoseToStandingAbsoluteTrackingPose)(); + struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetRawZeroPoseToStandingAbsoluteTrackingPose)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetSortedTrackedDeviceIndicesOfClass)(ETrackedDeviceClass eTrackedDeviceClass, TrackedDeviceIndex_t * punTrackedDeviceIndexArray, uint32_t unTrackedDeviceIndexArrayCount, TrackedDeviceIndex_t unRelativeToTrackedDeviceIndex); + EDeviceActivityLevel (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceActivityLevel)(TrackedDeviceIndex_t unDeviceId); + void (OPENVR_FNTABLE_CALLTYPE *ApplyTransform)(struct TrackedDevicePose_t * pOutputPose, struct TrackedDevicePose_t * pTrackedDevicePose, struct HmdMatrix34_t * pTransform); + TrackedDeviceIndex_t (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceIndexForControllerRole)(ETrackedControllerRole unDeviceType); + ETrackedControllerRole (OPENVR_FNTABLE_CALLTYPE *GetControllerRoleForTrackedDeviceIndex)(TrackedDeviceIndex_t unDeviceIndex); + ETrackedDeviceClass (OPENVR_FNTABLE_CALLTYPE *GetTrackedDeviceClass)(TrackedDeviceIndex_t unDeviceIndex); + bool (OPENVR_FNTABLE_CALLTYPE *IsTrackedDeviceConnected)(TrackedDeviceIndex_t unDeviceIndex); + bool (OPENVR_FNTABLE_CALLTYPE *GetBoolTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); + float (OPENVR_FNTABLE_CALLTYPE *GetFloatTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); + int32_t (OPENVR_FNTABLE_CALLTYPE *GetInt32TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); + uint64_t (OPENVR_FNTABLE_CALLTYPE *GetUint64TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); + struct HmdMatrix34_t (OPENVR_FNTABLE_CALLTYPE *GetMatrix34TrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, ETrackedPropertyError * pError); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetArrayTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, PropertyTypeTag_t propType, void * pBuffer, uint32_t unBufferSize, ETrackedPropertyError * pError); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetStringTrackedDeviceProperty)(TrackedDeviceIndex_t unDeviceIndex, ETrackedDeviceProperty prop, char * pchValue, uint32_t unBufferSize, ETrackedPropertyError * pError); + char * (OPENVR_FNTABLE_CALLTYPE *GetPropErrorNameFromEnum)(ETrackedPropertyError error); + bool (OPENVR_FNTABLE_CALLTYPE *PollNextEvent)(struct VREvent_t * pEvent, uint32_t uncbVREvent); + bool (OPENVR_FNTABLE_CALLTYPE *PollNextEventWithPose)(ETrackingUniverseOrigin eOrigin, struct VREvent_t * pEvent, uint32_t uncbVREvent, TrackedDevicePose_t * pTrackedDevicePose); + char * (OPENVR_FNTABLE_CALLTYPE *GetEventTypeNameFromEnum)(EVREventType eType); + struct HiddenAreaMesh_t (OPENVR_FNTABLE_CALLTYPE *GetHiddenAreaMesh)(EVREye eEye, EHiddenAreaMeshType type); + bool (OPENVR_FNTABLE_CALLTYPE *GetControllerState)(TrackedDeviceIndex_t unControllerDeviceIndex, VRControllerState_t * pControllerState, uint32_t unControllerStateSize); + bool (OPENVR_FNTABLE_CALLTYPE *GetControllerStateWithPose)(ETrackingUniverseOrigin eOrigin, TrackedDeviceIndex_t unControllerDeviceIndex, VRControllerState_t * pControllerState, uint32_t unControllerStateSize, struct TrackedDevicePose_t * pTrackedDevicePose); + void (OPENVR_FNTABLE_CALLTYPE *TriggerHapticPulse)(TrackedDeviceIndex_t unControllerDeviceIndex, uint32_t unAxisId, unsigned short usDurationMicroSec); + char * (OPENVR_FNTABLE_CALLTYPE *GetButtonIdNameFromEnum)(EVRButtonId eButtonId); + char * (OPENVR_FNTABLE_CALLTYPE *GetControllerAxisTypeNameFromEnum)(EVRControllerAxisType eAxisType); + bool (OPENVR_FNTABLE_CALLTYPE *IsInputAvailable)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsSteamVRDrawingControllers)(); + bool (OPENVR_FNTABLE_CALLTYPE *ShouldApplicationPause)(); + bool (OPENVR_FNTABLE_CALLTYPE *ShouldApplicationReduceRenderingWork)(); + EVRFirmwareError (OPENVR_FNTABLE_CALLTYPE *PerformFirmwareUpdate)(TrackedDeviceIndex_t unDeviceIndex); + void (OPENVR_FNTABLE_CALLTYPE *AcknowledgeQuit_Exiting)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetAppContainerFilePaths)(char * pchBuffer, uint32_t unBufferSize); + char * (OPENVR_FNTABLE_CALLTYPE *GetRuntimeVersion)(); +}; + +struct VR_IVRExtendedDisplay_FnTable +{ + void (OPENVR_FNTABLE_CALLTYPE *GetWindowBounds)(int32_t * pnX, int32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); + void (OPENVR_FNTABLE_CALLTYPE *GetEyeOutputViewport)(EVREye eEye, uint32_t * pnX, uint32_t * pnY, uint32_t * pnWidth, uint32_t * pnHeight); + void (OPENVR_FNTABLE_CALLTYPE *GetDXGIOutputInfo)(int32_t * pnAdapterIndex, int32_t * pnAdapterOutputIndex); +}; + +struct VR_IVRTrackedCamera_FnTable +{ + char * (OPENVR_FNTABLE_CALLTYPE *GetCameraErrorNameFromEnum)(EVRTrackedCameraError eCameraError); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *HasCamera)(TrackedDeviceIndex_t nDeviceIndex, bool * pHasCamera); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraFrameSize)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, uint32_t * pnWidth, uint32_t * pnHeight, uint32_t * pnFrameBufferSize); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraIntrinsics)(TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, EVRTrackedCameraFrameType eFrameType, HmdVector2_t * pFocalLength, HmdVector2_t * pCenter); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetCameraProjection)(TrackedDeviceIndex_t nDeviceIndex, uint32_t nCameraIndex, EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, HmdMatrix44_t * pProjection); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *AcquireVideoStreamingService)(TrackedDeviceIndex_t nDeviceIndex, TrackedCameraHandle_t * pHandle); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *ReleaseVideoStreamingService)(TrackedCameraHandle_t hTrackedCamera); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetVideoStreamFrameBuffer)(TrackedCameraHandle_t hTrackedCamera, EVRTrackedCameraFrameType eFrameType, void * pFrameBuffer, uint32_t nFrameBufferSize, CameraVideoStreamFrameHeader_t * pFrameHeader, uint32_t nFrameHeaderSize); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetVideoStreamTextureSize)(TrackedDeviceIndex_t nDeviceIndex, EVRTrackedCameraFrameType eFrameType, VRTextureBounds_t * pTextureBounds, uint32_t * pnWidth, uint32_t * pnHeight); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetVideoStreamTextureD3D11)(TrackedCameraHandle_t hTrackedCamera, EVRTrackedCameraFrameType eFrameType, void * pD3D11DeviceOrResource, void ** ppD3D11ShaderResourceView, CameraVideoStreamFrameHeader_t * pFrameHeader, uint32_t nFrameHeaderSize); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *GetVideoStreamTextureGL)(TrackedCameraHandle_t hTrackedCamera, EVRTrackedCameraFrameType eFrameType, glUInt_t * pglTextureId, CameraVideoStreamFrameHeader_t * pFrameHeader, uint32_t nFrameHeaderSize); + EVRTrackedCameraError (OPENVR_FNTABLE_CALLTYPE *ReleaseVideoStreamTextureGL)(TrackedCameraHandle_t hTrackedCamera, glUInt_t glTextureId); + void (OPENVR_FNTABLE_CALLTYPE *SetCameraTrackingSpace)(ETrackingUniverseOrigin eUniverse); + ETrackingUniverseOrigin (OPENVR_FNTABLE_CALLTYPE *GetCameraTrackingSpace)(); +}; + +struct VR_IVRApplications_FnTable +{ + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *AddApplicationManifest)(char * pchApplicationManifestFullPath, bool bTemporary); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *RemoveApplicationManifest)(char * pchApplicationManifestFullPath); + bool (OPENVR_FNTABLE_CALLTYPE *IsApplicationInstalled)(char * pchAppKey); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationCount)(); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetApplicationKeyByIndex)(uint32_t unApplicationIndex, char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetApplicationKeyByProcessId)(uint32_t unProcessId, char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchApplication)(char * pchAppKey); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchTemplateApplication)(char * pchTemplateAppKey, char * pchNewAppKey, struct AppOverrideKeys_t * pKeys, uint32_t unKeys); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchApplicationFromMimeType)(char * pchMimeType, char * pchArgs); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchDashboardOverlay)(char * pchAppKey); + bool (OPENVR_FNTABLE_CALLTYPE *CancelApplicationLaunch)(char * pchAppKey); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *IdentifyApplication)(uint32_t unProcessId, char * pchAppKey); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationProcessId)(char * pchAppKey); + char * (OPENVR_FNTABLE_CALLTYPE *GetApplicationsErrorNameFromEnum)(EVRApplicationError error); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyString)(char * pchAppKey, EVRApplicationProperty eProperty, char * pchPropertyValueBuffer, uint32_t unPropertyValueBufferLen, EVRApplicationError * peError); + bool (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyBool)(char * pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError * peError); + uint64_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationPropertyUint64)(char * pchAppKey, EVRApplicationProperty eProperty, EVRApplicationError * peError); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *SetApplicationAutoLaunch)(char * pchAppKey, bool bAutoLaunch); + bool (OPENVR_FNTABLE_CALLTYPE *GetApplicationAutoLaunch)(char * pchAppKey); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *SetDefaultApplicationForMimeType)(char * pchAppKey, char * pchMimeType); + bool (OPENVR_FNTABLE_CALLTYPE *GetDefaultApplicationForMimeType)(char * pchMimeType, char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); + bool (OPENVR_FNTABLE_CALLTYPE *GetApplicationSupportedMimeTypes)(char * pchAppKey, char * pchMimeTypesBuffer, uint32_t unMimeTypesBuffer); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationsThatSupportMimeType)(char * pchMimeType, char * pchAppKeysThatSupportBuffer, uint32_t unAppKeysThatSupportBuffer); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetApplicationLaunchArguments)(uint32_t unHandle, char * pchArgs, uint32_t unArgs); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *GetStartingApplication)(char * pchAppKeyBuffer, uint32_t unAppKeyBufferLen); + EVRSceneApplicationState (OPENVR_FNTABLE_CALLTYPE *GetSceneApplicationState)(); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *PerformApplicationPrelaunchCheck)(char * pchAppKey); + char * (OPENVR_FNTABLE_CALLTYPE *GetSceneApplicationStateNameFromEnum)(EVRSceneApplicationState state); + EVRApplicationError (OPENVR_FNTABLE_CALLTYPE *LaunchInternalProcess)(char * pchBinaryPath, char * pchArguments, char * pchWorkingDirectory); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetCurrentSceneProcessId)(); +}; + +struct VR_IVRChaperone_FnTable +{ + ChaperoneCalibrationState (OPENVR_FNTABLE_CALLTYPE *GetCalibrationState)(); + bool (OPENVR_FNTABLE_CALLTYPE *GetPlayAreaSize)(float * pSizeX, float * pSizeZ); + bool (OPENVR_FNTABLE_CALLTYPE *GetPlayAreaRect)(struct HmdQuad_t * rect); + void (OPENVR_FNTABLE_CALLTYPE *ReloadInfo)(); + void (OPENVR_FNTABLE_CALLTYPE *SetSceneColor)(struct HmdColor_t color); + void (OPENVR_FNTABLE_CALLTYPE *GetBoundsColor)(struct HmdColor_t * pOutputColorArray, int nNumOutputColors, float flCollisionBoundsFadeDistance, struct HmdColor_t * pOutputCameraColor); + bool (OPENVR_FNTABLE_CALLTYPE *AreBoundsVisible)(); + void (OPENVR_FNTABLE_CALLTYPE *ForceBoundsVisible)(bool bForce); + void (OPENVR_FNTABLE_CALLTYPE *ResetZeroPose)(ETrackingUniverseOrigin eTrackingUniverseOrigin); +}; + +struct VR_IVRChaperoneSetup_FnTable +{ + bool (OPENVR_FNTABLE_CALLTYPE *CommitWorkingCopy)(EChaperoneConfigFile configFile); + void (OPENVR_FNTABLE_CALLTYPE *RevertWorkingCopy)(); + bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingPlayAreaSize)(float * pSizeX, float * pSizeZ); + bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingPlayAreaRect)(struct HmdQuad_t * rect); + bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount); + bool (OPENVR_FNTABLE_CALLTYPE *GetLiveCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t * punQuadsCount); + bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose); + bool (OPENVR_FNTABLE_CALLTYPE *GetWorkingStandingZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatStandingZeroPoseToRawTrackingPose); + void (OPENVR_FNTABLE_CALLTYPE *SetWorkingPlayAreaSize)(float sizeX, float sizeZ); + void (OPENVR_FNTABLE_CALLTYPE *SetWorkingCollisionBoundsInfo)(struct HmdQuad_t * pQuadsBuffer, uint32_t unQuadsCount); + void (OPENVR_FNTABLE_CALLTYPE *SetWorkingPerimeter)(struct HmdVector2_t * pPointBuffer, uint32_t unPointCount); + void (OPENVR_FNTABLE_CALLTYPE *SetWorkingSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pMatSeatedZeroPoseToRawTrackingPose); + void (OPENVR_FNTABLE_CALLTYPE *SetWorkingStandingZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pMatStandingZeroPoseToRawTrackingPose); + void (OPENVR_FNTABLE_CALLTYPE *ReloadFromDisk)(EChaperoneConfigFile configFile); + bool (OPENVR_FNTABLE_CALLTYPE *GetLiveSeatedZeroPoseToRawTrackingPose)(struct HmdMatrix34_t * pmatSeatedZeroPoseToRawTrackingPose); + bool (OPENVR_FNTABLE_CALLTYPE *ExportLiveToBuffer)(char * pBuffer, uint32_t * pnBufferLength); + bool (OPENVR_FNTABLE_CALLTYPE *ImportFromBufferToWorking)(char * pBuffer, uint32_t nImportFlags); + void (OPENVR_FNTABLE_CALLTYPE *ShowWorkingSetPreview)(); + void (OPENVR_FNTABLE_CALLTYPE *HideWorkingSetPreview)(); + void (OPENVR_FNTABLE_CALLTYPE *RoomSetupStarting)(); +}; + +struct VR_IVRCompositor_FnTable +{ + void (OPENVR_FNTABLE_CALLTYPE *SetTrackingSpace)(ETrackingUniverseOrigin eOrigin); + ETrackingUniverseOrigin (OPENVR_FNTABLE_CALLTYPE *GetTrackingSpace)(); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *WaitGetPoses)(struct TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, struct TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetLastPoses)(struct TrackedDevicePose_t * pRenderPoseArray, uint32_t unRenderPoseArrayCount, struct TrackedDevicePose_t * pGamePoseArray, uint32_t unGamePoseArrayCount); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetLastPoseForTrackedDeviceIndex)(TrackedDeviceIndex_t unDeviceIndex, struct TrackedDevicePose_t * pOutputPose, struct TrackedDevicePose_t * pOutputGamePose); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *Submit)(EVREye eEye, struct Texture_t * pTexture, struct VRTextureBounds_t * pBounds, EVRSubmitFlags nSubmitFlags); + void (OPENVR_FNTABLE_CALLTYPE *ClearLastSubmittedFrame)(); + void (OPENVR_FNTABLE_CALLTYPE *PostPresentHandoff)(); + bool (OPENVR_FNTABLE_CALLTYPE *GetFrameTiming)(struct Compositor_FrameTiming * pTiming, uint32_t unFramesAgo); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetFrameTimings)(struct Compositor_FrameTiming * pTiming, uint32_t nFrames); + float (OPENVR_FNTABLE_CALLTYPE *GetFrameTimeRemaining)(); + void (OPENVR_FNTABLE_CALLTYPE *GetCumulativeStats)(struct Compositor_CumulativeStats * pStats, uint32_t nStatsSizeInBytes); + void (OPENVR_FNTABLE_CALLTYPE *FadeToColor)(float fSeconds, float fRed, float fGreen, float fBlue, float fAlpha, bool bBackground); + struct HmdColor_t (OPENVR_FNTABLE_CALLTYPE *GetCurrentFadeColor)(bool bBackground); + void (OPENVR_FNTABLE_CALLTYPE *FadeGrid)(float fSeconds, bool bFadeGridIn); + float (OPENVR_FNTABLE_CALLTYPE *GetCurrentGridAlpha)(); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *SetSkyboxOverride)(struct Texture_t * pTextures, uint32_t unTextureCount); + void (OPENVR_FNTABLE_CALLTYPE *ClearSkyboxOverride)(); + void (OPENVR_FNTABLE_CALLTYPE *CompositorBringToFront)(); + void (OPENVR_FNTABLE_CALLTYPE *CompositorGoToBack)(); + void (OPENVR_FNTABLE_CALLTYPE *CompositorQuit)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsFullscreen)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetCurrentSceneFocusProcess)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetLastFrameRenderer)(); + bool (OPENVR_FNTABLE_CALLTYPE *CanRenderScene)(); + void (OPENVR_FNTABLE_CALLTYPE *ShowMirrorWindow)(); + void (OPENVR_FNTABLE_CALLTYPE *HideMirrorWindow)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsMirrorWindowVisible)(); + void (OPENVR_FNTABLE_CALLTYPE *CompositorDumpImages)(); + bool (OPENVR_FNTABLE_CALLTYPE *ShouldAppRenderWithLowResources)(); + void (OPENVR_FNTABLE_CALLTYPE *ForceInterleavedReprojectionOn)(bool bOverride); + void (OPENVR_FNTABLE_CALLTYPE *ForceReconnectProcess)(); + void (OPENVR_FNTABLE_CALLTYPE *SuspendRendering)(bool bSuspend); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetMirrorTextureD3D11)(EVREye eEye, void * pD3D11DeviceOrResource, void ** ppD3D11ShaderResourceView); + void (OPENVR_FNTABLE_CALLTYPE *ReleaseMirrorTextureD3D11)(void * pD3D11ShaderResourceView); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetMirrorTextureGL)(EVREye eEye, glUInt_t * pglTextureId, glSharedTextureHandle_t * pglSharedTextureHandle); + bool (OPENVR_FNTABLE_CALLTYPE *ReleaseSharedGLTexture)(glUInt_t glTextureId, glSharedTextureHandle_t glSharedTextureHandle); + void (OPENVR_FNTABLE_CALLTYPE *LockGLSharedTextureForAccess)(glSharedTextureHandle_t glSharedTextureHandle); + void (OPENVR_FNTABLE_CALLTYPE *UnlockGLSharedTextureForAccess)(glSharedTextureHandle_t glSharedTextureHandle); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetVulkanInstanceExtensionsRequired)(char * pchValue, uint32_t unBufferSize); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetVulkanDeviceExtensionsRequired)(struct VkPhysicalDevice_T * pPhysicalDevice, char * pchValue, uint32_t unBufferSize); + void (OPENVR_FNTABLE_CALLTYPE *SetExplicitTimingMode)(EVRCompositorTimingMode eTimingMode); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *SubmitExplicitTimingData)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsMotionSmoothingEnabled)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsMotionSmoothingSupported)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsCurrentSceneFocusAppLoading)(); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *SetStageOverride_Async)(char * pchRenderModelPath, struct HmdMatrix34_t * pTransform, struct Compositor_StageRenderSettings * pRenderSettings, uint32_t nSizeOfRenderSettings); + void (OPENVR_FNTABLE_CALLTYPE *ClearStageOverride)(); + bool (OPENVR_FNTABLE_CALLTYPE *GetCompositorBenchmarkResults)(struct Compositor_BenchmarkResults * pBenchmarkResults, uint32_t nSizeOfBenchmarkResults); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetLastPosePredictionIDs)(uint32_t * pRenderPosePredictionID, uint32_t * pGamePosePredictionID); + EVRCompositorError (OPENVR_FNTABLE_CALLTYPE *GetPosesForFrame)(uint32_t unPosePredictionID, struct TrackedDevicePose_t * pPoseArray, uint32_t unPoseArrayCount); +}; + +struct VR_IVROverlay_FnTable +{ + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *FindOverlay)(char * pchOverlayKey, VROverlayHandle_t * pOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *CreateOverlay)(char * pchOverlayKey, char * pchOverlayName, VROverlayHandle_t * pOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *DestroyOverlay)(VROverlayHandle_t ulOverlayHandle); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayKey)(VROverlayHandle_t ulOverlayHandle, char * pchValue, uint32_t unBufferSize, EVROverlayError * pError); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayName)(VROverlayHandle_t ulOverlayHandle, char * pchValue, uint32_t unBufferSize, EVROverlayError * pError); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayName)(VROverlayHandle_t ulOverlayHandle, char * pchName); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayImageData)(VROverlayHandle_t ulOverlayHandle, void * pvBuffer, uint32_t unBufferSize, uint32_t * punWidth, uint32_t * punHeight); + char * (OPENVR_FNTABLE_CALLTYPE *GetOverlayErrorNameFromEnum)(EVROverlayError error); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayRenderingPid)(VROverlayHandle_t ulOverlayHandle, uint32_t unPID); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetOverlayRenderingPid)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayFlag)(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool bEnabled); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayFlag)(VROverlayHandle_t ulOverlayHandle, VROverlayFlags eOverlayFlag, bool * pbEnabled); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayFlags)(VROverlayHandle_t ulOverlayHandle, uint32_t * pFlags); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayColor)(VROverlayHandle_t ulOverlayHandle, float fRed, float fGreen, float fBlue); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayColor)(VROverlayHandle_t ulOverlayHandle, float * pfRed, float * pfGreen, float * pfBlue); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayAlpha)(VROverlayHandle_t ulOverlayHandle, float fAlpha); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayAlpha)(VROverlayHandle_t ulOverlayHandle, float * pfAlpha); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTexelAspect)(VROverlayHandle_t ulOverlayHandle, float fTexelAspect); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTexelAspect)(VROverlayHandle_t ulOverlayHandle, float * pfTexelAspect); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlaySortOrder)(VROverlayHandle_t ulOverlayHandle, uint32_t unSortOrder); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlaySortOrder)(VROverlayHandle_t ulOverlayHandle, uint32_t * punSortOrder); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayWidthInMeters)(VROverlayHandle_t ulOverlayHandle, float fWidthInMeters); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayWidthInMeters)(VROverlayHandle_t ulOverlayHandle, float * pfWidthInMeters); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayCurvature)(VROverlayHandle_t ulOverlayHandle, float fCurvature); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayCurvature)(VROverlayHandle_t ulOverlayHandle, float * pfCurvature); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTextureColorSpace)(VROverlayHandle_t ulOverlayHandle, EColorSpace eTextureColorSpace); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureColorSpace)(VROverlayHandle_t ulOverlayHandle, EColorSpace * peTextureColorSpace); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTextureBounds)(VROverlayHandle_t ulOverlayHandle, struct VRTextureBounds_t * pOverlayTextureBounds); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureBounds)(VROverlayHandle_t ulOverlayHandle, struct VRTextureBounds_t * pOverlayTextureBounds); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformType)(VROverlayHandle_t ulOverlayHandle, VROverlayTransformType * peTransformType); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformAbsolute)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformAbsolute)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin * peTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformTrackedDeviceRelative)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unTrackedDevice, struct HmdMatrix34_t * pmatTrackedDeviceToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformTrackedDeviceRelative)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t * punTrackedDevice, struct HmdMatrix34_t * pmatTrackedDeviceToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformTrackedDeviceComponent)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t unDeviceIndex, char * pchComponentName); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformTrackedDeviceComponent)(VROverlayHandle_t ulOverlayHandle, TrackedDeviceIndex_t * punDeviceIndex, char * pchComponentName, uint32_t unComponentNameSize); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformOverlayRelative)(VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t * ulOverlayHandleParent, struct HmdMatrix34_t * pmatParentOverlayToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformOverlayRelative)(VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulOverlayHandleParent, struct HmdMatrix34_t * pmatParentOverlayToOverlayTransform); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformCursor)(VROverlayHandle_t ulCursorOverlayHandle, struct HmdVector2_t * pvHotspot); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTransformCursor)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvHotspot); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTransformProjection)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToOverlayTransform, struct VROverlayProjection_t * pProjection, EVREye eEye); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowOverlay)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *HideOverlay)(VROverlayHandle_t ulOverlayHandle); + bool (OPENVR_FNTABLE_CALLTYPE *IsOverlayVisible)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetTransformForOverlayCoordinates)(VROverlayHandle_t ulOverlayHandle, ETrackingUniverseOrigin eTrackingOrigin, struct HmdVector2_t coordinatesInOverlay, struct HmdMatrix34_t * pmatTransform); + bool (OPENVR_FNTABLE_CALLTYPE *PollNextOverlayEvent)(VROverlayHandle_t ulOverlayHandle, struct VREvent_t * pEvent, uint32_t uncbVREvent); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayInputMethod)(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod * peInputMethod); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayInputMethod)(VROverlayHandle_t ulOverlayHandle, VROverlayInputMethod eInputMethod); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayMouseScale)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvecMouseScale); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayMouseScale)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvecMouseScale); + bool (OPENVR_FNTABLE_CALLTYPE *ComputeOverlayIntersection)(VROverlayHandle_t ulOverlayHandle, struct VROverlayIntersectionParams_t * pParams, struct VROverlayIntersectionResults_t * pResults); + bool (OPENVR_FNTABLE_CALLTYPE *IsHoverTargetOverlay)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayIntersectionMask)(VROverlayHandle_t ulOverlayHandle, struct VROverlayIntersectionMaskPrimitive_t * pMaskPrimitives, uint32_t unNumMaskPrimitives, uint32_t unPrimitiveSize); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *TriggerLaserMouseHapticVibration)(VROverlayHandle_t ulOverlayHandle, float fDurationSeconds, float fFrequency, float fAmplitude); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayCursor)(VROverlayHandle_t ulOverlayHandle, VROverlayHandle_t ulCursorHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayCursorPositionOverride)(VROverlayHandle_t ulOverlayHandle, struct HmdVector2_t * pvCursor); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ClearOverlayCursorPositionOverride)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, struct Texture_t * pTexture); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ClearOverlayTexture)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayRaw)(VROverlayHandle_t ulOverlayHandle, void * pvBuffer, uint32_t unWidth, uint32_t unHeight, uint32_t unBytesPerPixel); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetOverlayFromFile)(VROverlayHandle_t ulOverlayHandle, char * pchFilePath); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTexture)(VROverlayHandle_t ulOverlayHandle, void ** pNativeTextureHandle, void * pNativeTextureRef, uint32_t * pWidth, uint32_t * pHeight, uint32_t * pNativeFormat, ETextureType * pAPIType, EColorSpace * pColorSpace, struct VRTextureBounds_t * pTextureBounds); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ReleaseNativeOverlayHandle)(VROverlayHandle_t ulOverlayHandle, void * pNativeTextureHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetOverlayTextureSize)(VROverlayHandle_t ulOverlayHandle, uint32_t * pWidth, uint32_t * pHeight); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *CreateDashboardOverlay)(char * pchOverlayKey, char * pchOverlayFriendlyName, VROverlayHandle_t * pMainHandle, VROverlayHandle_t * pThumbnailHandle); + bool (OPENVR_FNTABLE_CALLTYPE *IsDashboardVisible)(); + bool (OPENVR_FNTABLE_CALLTYPE *IsActiveDashboardOverlay)(VROverlayHandle_t ulOverlayHandle); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *SetDashboardOverlaySceneProcess)(VROverlayHandle_t ulOverlayHandle, uint32_t unProcessId); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *GetDashboardOverlaySceneProcess)(VROverlayHandle_t ulOverlayHandle, uint32_t * punProcessId); + void (OPENVR_FNTABLE_CALLTYPE *ShowDashboard)(char * pchOverlayToShow); + TrackedDeviceIndex_t (OPENVR_FNTABLE_CALLTYPE *GetPrimaryDashboardDevice)(); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowKeyboard)(EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, char * pchDescription, uint32_t unCharMax, char * pchExistingText, uint64_t uUserValue); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ShowKeyboardForOverlay)(VROverlayHandle_t ulOverlayHandle, EGamepadTextInputMode eInputMode, EGamepadTextInputLineMode eLineInputMode, uint32_t unFlags, char * pchDescription, uint32_t unCharMax, char * pchExistingText, uint64_t uUserValue); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetKeyboardText)(char * pchText, uint32_t cchText); + void (OPENVR_FNTABLE_CALLTYPE *HideKeyboard)(); + void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardTransformAbsolute)(ETrackingUniverseOrigin eTrackingOrigin, struct HmdMatrix34_t * pmatTrackingOriginToKeyboardTransform); + void (OPENVR_FNTABLE_CALLTYPE *SetKeyboardPositionForOverlay)(VROverlayHandle_t ulOverlayHandle, struct HmdRect2_t avoidRect); + VRMessageOverlayResponse (OPENVR_FNTABLE_CALLTYPE *ShowMessageOverlay)(char * pchText, char * pchCaption, char * pchButton0Text, char * pchButton1Text, char * pchButton2Text, char * pchButton3Text); + void (OPENVR_FNTABLE_CALLTYPE *CloseMessageOverlay)(); +}; + +struct VR_IVROverlayView_FnTable +{ + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *AcquireOverlayView)(VROverlayHandle_t ulOverlayHandle, struct VRNativeDevice_t * pNativeDevice, struct VROverlayView_t * pOverlayView, uint32_t unOverlayViewSize); + EVROverlayError (OPENVR_FNTABLE_CALLTYPE *ReleaseOverlayView)(struct VROverlayView_t * pOverlayView); + void (OPENVR_FNTABLE_CALLTYPE *PostOverlayEvent)(VROverlayHandle_t ulOverlayHandle, struct VREvent_t * pvrEvent); + bool (OPENVR_FNTABLE_CALLTYPE *IsViewingPermitted)(VROverlayHandle_t ulOverlayHandle); +}; + +struct VR_IVRHeadsetView_FnTable +{ + void (OPENVR_FNTABLE_CALLTYPE *SetHeadsetViewSize)(uint32_t nWidth, uint32_t nHeight); + void (OPENVR_FNTABLE_CALLTYPE *GetHeadsetViewSize)(uint32_t * pnWidth, uint32_t * pnHeight); + void (OPENVR_FNTABLE_CALLTYPE *SetHeadsetViewMode)(HeadsetViewMode_t eHeadsetViewMode); + HeadsetViewMode_t (OPENVR_FNTABLE_CALLTYPE *GetHeadsetViewMode)(); + void (OPENVR_FNTABLE_CALLTYPE *SetHeadsetViewCropped)(bool bCropped); + bool (OPENVR_FNTABLE_CALLTYPE *GetHeadsetViewCropped)(); + float (OPENVR_FNTABLE_CALLTYPE *GetHeadsetViewAspectRatio)(); + void (OPENVR_FNTABLE_CALLTYPE *SetHeadsetViewBlendRange)(float flStartPct, float flEndPct); + void (OPENVR_FNTABLE_CALLTYPE *GetHeadsetViewBlendRange)(float * pStartPct, float * pEndPct); +}; + +struct VR_IVRRenderModels_FnTable +{ + EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadRenderModel_Async)(char * pchRenderModelName, struct RenderModel_t ** ppRenderModel); + void (OPENVR_FNTABLE_CALLTYPE *FreeRenderModel)(struct RenderModel_t * pRenderModel); + EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadTexture_Async)(TextureID_t textureId, struct RenderModel_TextureMap_t ** ppTexture); + void (OPENVR_FNTABLE_CALLTYPE *FreeTexture)(struct RenderModel_TextureMap_t * pTexture); + EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadTextureD3D11_Async)(TextureID_t textureId, void * pD3D11Device, void ** ppD3D11Texture2D); + EVRRenderModelError (OPENVR_FNTABLE_CALLTYPE *LoadIntoTextureD3D11_Async)(TextureID_t textureId, void * pDstTexture); + void (OPENVR_FNTABLE_CALLTYPE *FreeTextureD3D11)(void * pD3D11Texture2D); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelName)(uint32_t unRenderModelIndex, char * pchRenderModelName, uint32_t unRenderModelNameLen); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelCount)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentCount)(char * pchRenderModelName); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentName)(char * pchRenderModelName, uint32_t unComponentIndex, char * pchComponentName, uint32_t unComponentNameLen); + uint64_t (OPENVR_FNTABLE_CALLTYPE *GetComponentButtonMask)(char * pchRenderModelName, char * pchComponentName); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetComponentRenderModelName)(char * pchRenderModelName, char * pchComponentName, char * pchComponentRenderModelName, uint32_t unComponentRenderModelNameLen); + bool (OPENVR_FNTABLE_CALLTYPE *GetComponentStateForDevicePath)(char * pchRenderModelName, char * pchComponentName, VRInputValueHandle_t devicePath, RenderModel_ControllerMode_State_t * pState, RenderModel_ComponentState_t * pComponentState); + bool (OPENVR_FNTABLE_CALLTYPE *GetComponentState)(char * pchRenderModelName, char * pchComponentName, VRControllerState_t * pControllerState, struct RenderModel_ControllerMode_State_t * pState, struct RenderModel_ComponentState_t * pComponentState); + bool (OPENVR_FNTABLE_CALLTYPE *RenderModelHasComponent)(char * pchRenderModelName, char * pchComponentName); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelThumbnailURL)(char * pchRenderModelName, char * pchThumbnailURL, uint32_t unThumbnailURLLen, EVRRenderModelError * peError); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetRenderModelOriginalPath)(char * pchRenderModelName, char * pchOriginalPath, uint32_t unOriginalPathLen, EVRRenderModelError * peError); + char * (OPENVR_FNTABLE_CALLTYPE *GetRenderModelErrorNameFromEnum)(EVRRenderModelError error); +}; + +struct VR_IVRNotifications_FnTable +{ + EVRNotificationError (OPENVR_FNTABLE_CALLTYPE *CreateNotification)(VROverlayHandle_t ulOverlayHandle, uint64_t ulUserValue, EVRNotificationType type, char * pchText, EVRNotificationStyle style, struct NotificationBitmap_t * pImage, VRNotificationId * pNotificationId); + EVRNotificationError (OPENVR_FNTABLE_CALLTYPE *RemoveNotification)(VRNotificationId notificationId); +}; + +struct VR_IVRSettings_FnTable +{ + char * (OPENVR_FNTABLE_CALLTYPE *GetSettingsErrorNameFromEnum)(EVRSettingsError eError); + void (OPENVR_FNTABLE_CALLTYPE *SetBool)(char * pchSection, char * pchSettingsKey, bool bValue, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *SetInt32)(char * pchSection, char * pchSettingsKey, int32_t nValue, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *SetFloat)(char * pchSection, char * pchSettingsKey, float flValue, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *SetString)(char * pchSection, char * pchSettingsKey, char * pchValue, EVRSettingsError * peError); + bool (OPENVR_FNTABLE_CALLTYPE *GetBool)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError); + int32_t (OPENVR_FNTABLE_CALLTYPE *GetInt32)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError); + float (OPENVR_FNTABLE_CALLTYPE *GetFloat)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *GetString)(char * pchSection, char * pchSettingsKey, char * pchValue, uint32_t unValueLen, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *RemoveSection)(char * pchSection, EVRSettingsError * peError); + void (OPENVR_FNTABLE_CALLTYPE *RemoveKeyInSection)(char * pchSection, char * pchSettingsKey, EVRSettingsError * peError); +}; + +struct VR_IVRScreenshots_FnTable +{ + EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *RequestScreenshot)(ScreenshotHandle_t * pOutScreenshotHandle, EVRScreenshotType type, char * pchPreviewFilename, char * pchVRFilename); + EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *HookScreenshot)(EVRScreenshotType * pSupportedTypes, int numTypes); + EVRScreenshotType (OPENVR_FNTABLE_CALLTYPE *GetScreenshotPropertyType)(ScreenshotHandle_t screenshotHandle, EVRScreenshotError * pError); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetScreenshotPropertyFilename)(ScreenshotHandle_t screenshotHandle, EVRScreenshotPropertyFilenames filenameType, char * pchFilename, uint32_t cchFilename, EVRScreenshotError * pError); + EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *UpdateScreenshotProgress)(ScreenshotHandle_t screenshotHandle, float flProgress); + EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *TakeStereoScreenshot)(ScreenshotHandle_t * pOutScreenshotHandle, char * pchPreviewFilename, char * pchVRFilename); + EVRScreenshotError (OPENVR_FNTABLE_CALLTYPE *SubmitScreenshot)(ScreenshotHandle_t screenshotHandle, EVRScreenshotType type, char * pchSourcePreviewFilename, char * pchSourceVRFilename); +}; + +struct VR_IVRResources_FnTable +{ + uint32_t (OPENVR_FNTABLE_CALLTYPE *LoadSharedResource)(char * pchResourceName, char * pchBuffer, uint32_t unBufferLen); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetResourceFullPath)(char * pchResourceName, char * pchResourceTypeDirectory, char * pchPathBuffer, uint32_t unBufferLen); +}; + +struct VR_IVRDriverManager_FnTable +{ + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetDriverCount)(); + uint32_t (OPENVR_FNTABLE_CALLTYPE *GetDriverName)(DriverId_t nDriver, char * pchValue, uint32_t unBufferSize); + DriverHandle_t (OPENVR_FNTABLE_CALLTYPE *GetDriverHandle)(char * pchDriverName); + bool (OPENVR_FNTABLE_CALLTYPE *IsEnabled)(DriverId_t nDriver); +}; + +struct VR_IVRInput_FnTable +{ + EVRInputError (OPENVR_FNTABLE_CALLTYPE *SetActionManifestPath)(char * pchActionManifestPath); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionSetHandle)(char * pchActionSetName, VRActionSetHandle_t * pHandle); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionHandle)(char * pchActionName, VRActionHandle_t * pHandle); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetInputSourceHandle)(char * pchInputSourcePath, VRInputValueHandle_t * pHandle); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *UpdateActionState)(struct VRActiveActionSet_t * pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetDigitalActionData)(VRActionHandle_t action, struct InputDigitalActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetAnalogActionData)(VRActionHandle_t action, struct InputAnalogActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetPoseActionDataRelativeToNow)(VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, float fPredictedSecondsFromNow, struct InputPoseActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetPoseActionDataForNextFrame)(VRActionHandle_t action, ETrackingUniverseOrigin eOrigin, struct InputPoseActionData_t * pActionData, uint32_t unActionDataSize, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalActionData)(VRActionHandle_t action, struct InputSkeletalActionData_t * pActionData, uint32_t unActionDataSize); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetDominantHand)(ETrackedControllerRole * peDominantHand); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *SetDominantHand)(ETrackedControllerRole eDominantHand); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetBoneCount)(VRActionHandle_t action, uint32_t * pBoneCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetBoneHierarchy)(VRActionHandle_t action, BoneIndex_t * pParentIndices, uint32_t unIndexArayCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetBoneName)(VRActionHandle_t action, BoneIndex_t nBoneIndex, char * pchBoneName, uint32_t unNameBufferSize); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalReferenceTransforms)(VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalReferencePose eReferencePose, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalTrackingLevel)(VRActionHandle_t action, EVRSkeletalTrackingLevel * pSkeletalTrackingLevel); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalBoneData)(VRActionHandle_t action, EVRSkeletalTransformSpace eTransformSpace, EVRSkeletalMotionRange eMotionRange, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalSummaryData)(VRActionHandle_t action, EVRSummaryType eSummaryType, struct VRSkeletalSummaryData_t * pSkeletalSummaryData); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetSkeletalBoneDataCompressed)(VRActionHandle_t action, EVRSkeletalMotionRange eMotionRange, void * pvCompressedData, uint32_t unCompressedSize, uint32_t * punRequiredCompressedSize); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *DecompressSkeletalBoneData)(void * pvCompressedBuffer, uint32_t unCompressedBufferSize, EVRSkeletalTransformSpace eTransformSpace, struct VRBoneTransform_t * pTransformArray, uint32_t unTransformArrayCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *TriggerHapticVibrationAction)(VRActionHandle_t action, float fStartSecondsFromNow, float fDurationSeconds, float fFrequency, float fAmplitude, VRInputValueHandle_t ulRestrictToDevice); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionOrigins)(VRActionSetHandle_t actionSetHandle, VRActionHandle_t digitalActionHandle, VRInputValueHandle_t * originsOut, uint32_t originOutCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetOriginLocalizedName)(VRInputValueHandle_t origin, char * pchNameArray, uint32_t unNameArraySize, int32_t unStringSectionsToInclude); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetOriginTrackedDeviceInfo)(VRInputValueHandle_t origin, struct InputOriginInfo_t * pOriginInfo, uint32_t unOriginInfoSize); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetActionBindingInfo)(VRActionHandle_t action, struct InputBindingInfo_t * pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, uint32_t * punReturnedBindingInfoCount); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *ShowActionOrigins)(VRActionSetHandle_t actionSetHandle, VRActionHandle_t ulActionHandle); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *ShowBindingsForActionSet)(struct VRActiveActionSet_t * pSets, uint32_t unSizeOfVRSelectedActionSet_t, uint32_t unSetCount, VRInputValueHandle_t originToHighlight); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetComponentStateForBinding)(char * pchRenderModelName, char * pchComponentName, struct InputBindingInfo_t * pOriginInfo, uint32_t unBindingInfoSize, uint32_t unBindingInfoCount, RenderModel_ComponentState_t * pComponentState); + bool (OPENVR_FNTABLE_CALLTYPE *IsUsingLegacyInput)(); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *OpenBindingUI)(char * pchAppKey, VRActionSetHandle_t ulActionSetHandle, VRInputValueHandle_t ulDeviceHandle, bool bShowOnDesktop); + EVRInputError (OPENVR_FNTABLE_CALLTYPE *GetBindingVariant)(VRInputValueHandle_t ulDevicePath, char * pchVariantArray, uint32_t unVariantArraySize); +}; + +struct VR_IVRIOBuffer_FnTable +{ + EIOBufferError (OPENVR_FNTABLE_CALLTYPE *Open)(char * pchPath, EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, IOBufferHandle_t * pulBuffer); + EIOBufferError (OPENVR_FNTABLE_CALLTYPE *Close)(IOBufferHandle_t ulBuffer); + EIOBufferError (OPENVR_FNTABLE_CALLTYPE *Read)(IOBufferHandle_t ulBuffer, void * pDst, uint32_t unBytes, uint32_t * punRead); + EIOBufferError (OPENVR_FNTABLE_CALLTYPE *Write)(IOBufferHandle_t ulBuffer, void * pSrc, uint32_t unBytes); + PropertyContainerHandle_t (OPENVR_FNTABLE_CALLTYPE *PropertyContainer)(IOBufferHandle_t ulBuffer); + bool (OPENVR_FNTABLE_CALLTYPE *HasReaders)(IOBufferHandle_t ulBuffer); +}; + +struct VR_IVRSpatialAnchors_FnTable +{ + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *CreateSpatialAnchorFromDescriptor)(char * pchDescriptor, SpatialAnchorHandle_t * pHandleOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *CreateSpatialAnchorFromPose)(TrackedDeviceIndex_t unDeviceIndex, ETrackingUniverseOrigin eOrigin, struct SpatialAnchorPose_t * pPose, SpatialAnchorHandle_t * pHandleOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *GetSpatialAnchorPose)(SpatialAnchorHandle_t unHandle, ETrackingUniverseOrigin eOrigin, struct SpatialAnchorPose_t * pPoseOut); + EVRSpatialAnchorError (OPENVR_FNTABLE_CALLTYPE *GetSpatialAnchorDescriptor)(SpatialAnchorHandle_t unHandle, char * pchDescriptorOut, uint32_t * punDescriptorBufferLenInOut); +}; + +struct VR_IVRDebug_FnTable +{ + EVRDebugError (OPENVR_FNTABLE_CALLTYPE *EmitVrProfilerEvent)(char * pchMessage); + EVRDebugError (OPENVR_FNTABLE_CALLTYPE *BeginVrProfilerEvent)(VrProfilerEventHandle_t * pHandleOut); + EVRDebugError (OPENVR_FNTABLE_CALLTYPE *FinishVrProfilerEvent)(VrProfilerEventHandle_t hHandle, char * pchMessage); + uint32_t (OPENVR_FNTABLE_CALLTYPE *DriverDebugRequest)(TrackedDeviceIndex_t unDeviceIndex, char * pchRequest, char * pchResponseBuffer, uint32_t unResponseBufferSize); +}; + +struct VR_IVRProperties_FnTable +{ + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *ReadPropertyBatch)(PropertyContainerHandle_t ulContainerHandle, struct PropertyRead_t * pBatch, uint32_t unBatchEntryCount); + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *WritePropertyBatch)(PropertyContainerHandle_t ulContainerHandle, struct PropertyWrite_t * pBatch, uint32_t unBatchEntryCount); + char * (OPENVR_FNTABLE_CALLTYPE *GetPropErrorNameFromEnum)(ETrackedPropertyError error); + PropertyContainerHandle_t (OPENVR_FNTABLE_CALLTYPE *TrackedDeviceToPropertyContainer)(TrackedDeviceIndex_t nDevice); +}; + +struct VR_IVRPaths_FnTable +{ + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *ReadPathBatch)(PropertyContainerHandle_t ulRootHandle, struct PathRead_t * pBatch, uint32_t unBatchEntryCount); + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *WritePathBatch)(PropertyContainerHandle_t ulRootHandle, struct PathWrite_t * pBatch, uint32_t unBatchEntryCount); + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *StringToHandle)(PathHandle_t * pHandle, char * pchPath); + ETrackedPropertyError (OPENVR_FNTABLE_CALLTYPE *HandleToString)(PathHandle_t pHandle, char * pchBuffer, uint32_t unBufferSize, uint32_t * punBufferSizeUsed); +}; + +struct VR_IVRBlockQueue_FnTable +{ + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *Create)(PropertyContainerHandle_t * pulQueueHandle, char * pchPath, uint32_t unBlockDataSize, uint32_t unBlockHeaderSize, uint32_t unBlockCount); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *Connect)(PropertyContainerHandle_t * pulQueueHandle, char * pchPath); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *Destroy)(PropertyContainerHandle_t ulQueueHandle); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *AcquireWriteOnlyBlock)(PropertyContainerHandle_t ulQueueHandle, PropertyContainerHandle_t * pulBlockHandle, void ** ppvBuffer); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *ReleaseWriteOnlyBlock)(PropertyContainerHandle_t ulQueueHandle, PropertyContainerHandle_t ulBlockHandle); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *WaitAndAcquireReadOnlyBlock)(PropertyContainerHandle_t ulQueueHandle, PropertyContainerHandle_t * pulBlockHandle, void ** ppvBuffer, EBlockQueueReadType eReadType, uint32_t unTimeoutMs); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *AcquireReadOnlyBlock)(PropertyContainerHandle_t ulQueueHandle, PropertyContainerHandle_t * pulBlockHandle, void ** ppvBuffer, EBlockQueueReadType eReadType); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *ReleaseReadOnlyBlock)(PropertyContainerHandle_t ulQueueHandle, PropertyContainerHandle_t ulBlockHandle); + EBlockQueueError (OPENVR_FNTABLE_CALLTYPE *QueueHasReader)(PropertyContainerHandle_t ulQueueHandle, bool * pbHasReaders); +}; + + +#if 0 +// Global entry points +S_API intptr_t VR_InitInternal( EVRInitError *peError, EVRApplicationType eType ); +S_API void VR_ShutdownInternal(); +S_API bool VR_IsHmdPresent(); +S_API intptr_t VR_GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError ); +S_API bool VR_IsRuntimeInstalled(); +S_API const char * VR_GetVRInitErrorAsSymbol( EVRInitError error ); +S_API const char * VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ); +#endif + +#endif // __OPENVR_API_FLAT_H__ + + diff --git a/contrib/openvr/headers/openvr_driver.h b/contrib/openvr/headers/openvr_driver.h new file mode 100755 index 0000000..34b7053 --- /dev/null +++ b/contrib/openvr/headers/openvr_driver.h @@ -0,0 +1,4212 @@ +#pragma once + +// openvr_driver.h +//========= Copyright Valve Corporation ============// +// Dynamically generated file. Do not modify this file directly. + +#ifndef _OPENVR_DRIVER_API +#define _OPENVR_DRIVER_API + +#include + + + +// version.h + +namespace vr +{ + static const uint32_t k_nSteamVRVersionMajor = 1; + static const uint32_t k_nSteamVRVersionMinor = 16; + static const uint32_t k_nSteamVRVersionBuild = 8; +} // namespace vr + +// public_vrtypes.h + +#ifndef _INCLUDE_CORE_VRTYPES_PUBLIC_H +#define _INCLUDE_CORE_VRTYPES_PUBLIC_H + +namespace vr +{ +#pragma pack( push, 8 ) + +// right-handed system +// +y is up +// +x is to the right +// -z is forward +// Distance unit is meters +struct HmdMatrix34_t +{ + float m[3][4]; +}; + +struct HmdMatrix33_t +{ + float m[3][3]; +}; + +struct HmdMatrix44_t +{ + float m[4][4]; +}; + +struct HmdVector3_t +{ + float v[3]; +}; + +struct HmdVector4_t +{ + float v[4]; +}; + +struct HmdVector3d_t +{ + double v[3]; +}; + +struct HmdVector2_t +{ + float v[2]; +}; + +struct HmdQuaternion_t +{ + double w, x, y, z; +}; + +struct HmdQuaternionf_t +{ + float w, x, y, z; +}; + +struct HmdColor_t +{ + float r, g, b, a; +}; + +struct HmdQuad_t +{ + HmdVector3_t vCorners[ 4 ]; +}; + +struct HmdRect2_t +{ + HmdVector2_t vTopLeft; + HmdVector2_t vBottomRight; +}; + +/** Holds the transform for a single bone */ +struct VRBoneTransform_t +{ + HmdVector4_t position; + HmdQuaternionf_t orientation; +}; + +#pragma pack( pop ) + +} // namespace vr + +#endif + +// vrtypes.h + +#ifndef _INCLUDE_VRTYPES_H +#define _INCLUDE_VRTYPES_H + +// Forward declarations to avoid requiring vulkan.h +struct VkDevice_T; +struct VkPhysicalDevice_T; +struct VkInstance_T; +struct VkQueue_T; + +// Forward declarations to avoid requiring d3d12.h +struct ID3D12Resource; +struct ID3D12CommandQueue; + +namespace vr +{ +#pragma pack( push, 8 ) + +/** A handle for a spatial anchor. This handle is only valid during the session it was created in. +* Anchors that live beyond one session should be saved by their string descriptors. */ +typedef uint32_t SpatialAnchorHandle_t; + +typedef void* glSharedTextureHandle_t; +typedef int32_t glInt_t; +typedef uint32_t glUInt_t; + + +/** Used to return the post-distortion UVs for each color channel. +* UVs range from 0 to 1 with 0,0 in the upper left corner of the +* source render target. The 0,0 to 1,1 range covers a single eye. */ +struct DistortionCoordinates_t +{ + float rfRed[2]; + float rfGreen[2]; + float rfBlue[2]; +}; + +enum EVREye +{ + Eye_Left = 0, + Eye_Right = 1 +}; + +enum ETextureType +{ + TextureType_Invalid = -1, // Handle has been invalidated + TextureType_DirectX = 0, // Handle is an ID3D11Texture + TextureType_OpenGL = 1, // Handle is an OpenGL texture name or an OpenGL render buffer name, depending on submit flags + TextureType_Vulkan = 2, // Handle is a pointer to a VRVulkanTextureData_t structure + TextureType_IOSurface = 3, // Handle is a macOS cross-process-sharable IOSurfaceRef, deprecated in favor of TextureType_Metal on supported platforms + TextureType_DirectX12 = 4, // Handle is a pointer to a D3D12TextureData_t structure + TextureType_DXGISharedHandle = 5, // Handle is a HANDLE DXGI share handle, only supported for Overlay render targets. + // this texture is used directly by our renderer, so only perform atomic (copyresource or resolve) on it + TextureType_Metal = 6, // Handle is a MTLTexture conforming to the MTLSharedTexture protocol. Textures submitted to IVRCompositor::Submit which + // are of type MTLTextureType2DArray assume layer 0 is the left eye texture (vr::EVREye::Eye_left), layer 1 is the right + // eye texture (vr::EVREye::Eye_Right) +}; + +enum EColorSpace +{ + ColorSpace_Auto = 0, // Assumes 'gamma' for 8-bit per component formats, otherwise 'linear'. This mirrors the DXGI formats which have _SRGB variants. + ColorSpace_Gamma = 1, // Texture data can be displayed directly on the display without any conversion (a.k.a. display native format). + ColorSpace_Linear = 2, // Same as gamma but has been converted to a linear representation using DXGI's sRGB conversion algorithm. +}; + +struct Texture_t +{ + void* handle; // See ETextureType definition above + ETextureType eType; + EColorSpace eColorSpace; +}; + +// Handle to a shared texture (HANDLE on Windows obtained using OpenSharedResource). +typedef uint64_t SharedTextureHandle_t; +#define INVALID_SHARED_TEXTURE_HANDLE ((vr::SharedTextureHandle_t)0) + +enum ETrackingResult +{ + TrackingResult_Uninitialized = 1, + + TrackingResult_Calibrating_InProgress = 100, + TrackingResult_Calibrating_OutOfRange = 101, + + TrackingResult_Running_OK = 200, + TrackingResult_Running_OutOfRange = 201, + + TrackingResult_Fallback_RotationOnly = 300, +}; + +typedef uint32_t DriverId_t; +static const uint32_t k_nDriverNone = 0xFFFFFFFF; + +static const uint32_t k_unMaxDriverDebugResponseSize = 32768; + +/** Used to pass device IDs to API calls */ +typedef uint32_t TrackedDeviceIndex_t; +static const uint32_t k_unTrackedDeviceIndex_Hmd = 0; +static const uint32_t k_unMaxTrackedDeviceCount = 64; +static const uint32_t k_unTrackedDeviceIndexOther = 0xFFFFFFFE; +static const uint32_t k_unTrackedDeviceIndexInvalid = 0xFFFFFFFF; + +/** Describes what kind of object is being tracked at a given ID */ +enum ETrackedDeviceClass +{ + TrackedDeviceClass_Invalid = 0, // the ID was not valid. + TrackedDeviceClass_HMD = 1, // Head-Mounted Displays + TrackedDeviceClass_Controller = 2, // Tracked controllers + TrackedDeviceClass_GenericTracker = 3, // Generic trackers, similar to controllers + TrackedDeviceClass_TrackingReference = 4, // Camera and base stations that serve as tracking reference points + TrackedDeviceClass_DisplayRedirect = 5, // Accessories that aren't necessarily tracked themselves, but may redirect video output from other tracked devices + + TrackedDeviceClass_Max +}; + + +/** Describes what specific role associated with a tracked device */ +enum ETrackedControllerRole +{ + TrackedControllerRole_Invalid = 0, // Invalid value for controller type + TrackedControllerRole_LeftHand = 1, // Tracked device associated with the left hand + TrackedControllerRole_RightHand = 2, // Tracked device associated with the right hand + TrackedControllerRole_OptOut = 3, // Tracked device is opting out of left/right hand selection + TrackedControllerRole_Treadmill = 4, // Tracked device is a treadmill or other locomotion device + TrackedControllerRole_Stylus = 5, // Tracked device is a stylus + TrackedControllerRole_Max = 5 +}; + + +/** Returns true if the tracked controller role is allowed to be a hand */ +inline bool IsRoleAllowedAsHand( ETrackedControllerRole eRole ) +{ + switch ( eRole ) + { + case TrackedControllerRole_Invalid: + case TrackedControllerRole_LeftHand: + case TrackedControllerRole_RightHand: + return true; + default: + return false; + } +} + + +/** describes a single pose for a tracked object */ +struct TrackedDevicePose_t +{ + HmdMatrix34_t mDeviceToAbsoluteTracking; + HmdVector3_t vVelocity; // velocity in tracker space in m/s + HmdVector3_t vAngularVelocity; // angular velocity in radians/s (?) + ETrackingResult eTrackingResult; + bool bPoseIsValid; + + // This indicates that there is a device connected for this spot in the pose array. + // It could go from true to false if the user unplugs the device. + bool bDeviceIsConnected; +}; + +/** Identifies which style of tracking origin the application wants to use +* for the poses it is requesting */ +enum ETrackingUniverseOrigin +{ + TrackingUniverseSeated = 0, // Poses are provided relative to the seated zero pose + TrackingUniverseStanding = 1, // Poses are provided relative to the safe bounds configured by the user + TrackingUniverseRawAndUncalibrated = 2, // Poses are provided in the coordinate system defined by the driver. It has Y up and is unified for devices of the same driver. You usually don't want this one. +}; + +enum EAdditionalRadioFeatures +{ + AdditionalRadioFeatures_None = 0x00000000, + AdditionalRadioFeatures_HTCLinkBox = 0x00000001, + AdditionalRadioFeatures_InternalDongle = 0x00000002, + AdditionalRadioFeatures_ExternalDongle = 0x00000004, +}; + +typedef uint64_t WebConsoleHandle_t; +#define INVALID_WEB_CONSOLE_HANDLE ((vr::WebConsoleHandle_t)0) + +// Refers to a single container of properties +typedef uint64_t PropertyContainerHandle_t; +typedef uint32_t PropertyTypeTag_t; + +static const PropertyContainerHandle_t k_ulInvalidPropertyContainer = 0; +static const PropertyTypeTag_t k_unInvalidPropertyTag = 0; + +typedef PropertyContainerHandle_t DriverHandle_t; +static const PropertyContainerHandle_t k_ulInvalidDriverHandle = 0; + +// Use these tags to set/get common types as struct properties +static const PropertyTypeTag_t k_unFloatPropertyTag = 1; +static const PropertyTypeTag_t k_unInt32PropertyTag = 2; +static const PropertyTypeTag_t k_unUint64PropertyTag = 3; +static const PropertyTypeTag_t k_unBoolPropertyTag = 4; +static const PropertyTypeTag_t k_unStringPropertyTag = 5; +static const PropertyTypeTag_t k_unErrorPropertyTag = 6; +static const PropertyTypeTag_t k_unDoublePropertyTag = 7; + +static const PropertyTypeTag_t k_unHmdMatrix34PropertyTag = 20; +static const PropertyTypeTag_t k_unHmdMatrix44PropertyTag = 21; +static const PropertyTypeTag_t k_unHmdVector3PropertyTag = 22; +static const PropertyTypeTag_t k_unHmdVector4PropertyTag = 23; +static const PropertyTypeTag_t k_unHmdVector2PropertyTag = 24; +static const PropertyTypeTag_t k_unHmdQuadPropertyTag = 25; + +static const PropertyTypeTag_t k_unHiddenAreaPropertyTag = 30; +static const PropertyTypeTag_t k_unPathHandleInfoTag = 31; +static const PropertyTypeTag_t k_unActionPropertyTag = 32; +static const PropertyTypeTag_t k_unInputValuePropertyTag = 33; +static const PropertyTypeTag_t k_unWildcardPropertyTag = 34; +static const PropertyTypeTag_t k_unHapticVibrationPropertyTag = 35; +static const PropertyTypeTag_t k_unSkeletonPropertyTag = 36; + +static const PropertyTypeTag_t k_unSpatialAnchorPosePropertyTag = 40; +static const PropertyTypeTag_t k_unJsonPropertyTag = 41; +static const PropertyTypeTag_t k_unActiveActionSetPropertyTag = 42; + +static const PropertyTypeTag_t k_unOpenVRInternalReserved_Start = 1000; +static const PropertyTypeTag_t k_unOpenVRInternalReserved_End = 10000; + + +/** Each entry in this enum represents a property that can be retrieved about a +* tracked device. Many fields are only valid for one ETrackedDeviceClass. */ +enum ETrackedDeviceProperty +{ + Prop_Invalid = 0, + + // general properties that apply to all device classes + Prop_TrackingSystemName_String = 1000, + Prop_ModelNumber_String = 1001, + Prop_SerialNumber_String = 1002, + Prop_RenderModelName_String = 1003, + Prop_WillDriftInYaw_Bool = 1004, + Prop_ManufacturerName_String = 1005, + Prop_TrackingFirmwareVersion_String = 1006, + Prop_HardwareRevision_String = 1007, + Prop_AllWirelessDongleDescriptions_String = 1008, + Prop_ConnectedWirelessDongle_String = 1009, + Prop_DeviceIsWireless_Bool = 1010, + Prop_DeviceIsCharging_Bool = 1011, + Prop_DeviceBatteryPercentage_Float = 1012, // 0 is empty, 1 is full + Prop_StatusDisplayTransform_Matrix34 = 1013, + Prop_Firmware_UpdateAvailable_Bool = 1014, + Prop_Firmware_ManualUpdate_Bool = 1015, + Prop_Firmware_ManualUpdateURL_String = 1016, + Prop_HardwareRevision_Uint64 = 1017, + Prop_FirmwareVersion_Uint64 = 1018, + Prop_FPGAVersion_Uint64 = 1019, + Prop_VRCVersion_Uint64 = 1020, + Prop_RadioVersion_Uint64 = 1021, + Prop_DongleVersion_Uint64 = 1022, + Prop_BlockServerShutdown_Bool = 1023, + Prop_CanUnifyCoordinateSystemWithHmd_Bool = 1024, + Prop_ContainsProximitySensor_Bool = 1025, + Prop_DeviceProvidesBatteryStatus_Bool = 1026, + Prop_DeviceCanPowerOff_Bool = 1027, + Prop_Firmware_ProgrammingTarget_String = 1028, + Prop_DeviceClass_Int32 = 1029, + Prop_HasCamera_Bool = 1030, + Prop_DriverVersion_String = 1031, + Prop_Firmware_ForceUpdateRequired_Bool = 1032, + Prop_ViveSystemButtonFixRequired_Bool = 1033, + Prop_ParentDriver_Uint64 = 1034, + Prop_ResourceRoot_String = 1035, + Prop_RegisteredDeviceType_String = 1036, + Prop_InputProfilePath_String = 1037, // input profile to use for this device in the input system. Will default to tracking system name if this isn't provided + Prop_NeverTracked_Bool = 1038, // Used for devices that will never have a valid pose by design + Prop_NumCameras_Int32 = 1039, + Prop_CameraFrameLayout_Int32 = 1040, // EVRTrackedCameraFrameLayout value + Prop_CameraStreamFormat_Int32 = 1041, // ECameraVideoStreamFormat value + Prop_AdditionalDeviceSettingsPath_String = 1042, // driver-relative path to additional device and global configuration settings + Prop_Identifiable_Bool = 1043, // Whether device supports being identified from vrmonitor (e.g. blink LED, vibrate haptics, etc) + Prop_BootloaderVersion_Uint64 = 1044, + Prop_AdditionalSystemReportData_String = 1045, // additional string to include in system reports about a tracked device + Prop_CompositeFirmwareVersion_String = 1046, // additional FW components from a device that gets propagated into reports + Prop_Firmware_RemindUpdate_Bool = 1047, + Prop_PeripheralApplicationVersion_Uint64 = 1048, + Prop_ManufacturerSerialNumber_String = 1049, + Prop_ComputedSerialNumber_String = 1050, + Prop_EstimatedDeviceFirstUseTime_Int32 = 1051, + + // Properties that are unique to TrackedDeviceClass_HMD + Prop_ReportsTimeSinceVSync_Bool = 2000, + Prop_SecondsFromVsyncToPhotons_Float = 2001, + Prop_DisplayFrequency_Float = 2002, + Prop_UserIpdMeters_Float = 2003, + Prop_CurrentUniverseId_Uint64 = 2004, + Prop_PreviousUniverseId_Uint64 = 2005, + Prop_DisplayFirmwareVersion_Uint64 = 2006, + Prop_IsOnDesktop_Bool = 2007, + Prop_DisplayMCType_Int32 = 2008, + Prop_DisplayMCOffset_Float = 2009, + Prop_DisplayMCScale_Float = 2010, + Prop_EdidVendorID_Int32 = 2011, + Prop_DisplayMCImageLeft_String = 2012, + Prop_DisplayMCImageRight_String = 2013, + Prop_DisplayGCBlackClamp_Float = 2014, + Prop_EdidProductID_Int32 = 2015, + Prop_CameraToHeadTransform_Matrix34 = 2016, + Prop_DisplayGCType_Int32 = 2017, + Prop_DisplayGCOffset_Float = 2018, + Prop_DisplayGCScale_Float = 2019, + Prop_DisplayGCPrescale_Float = 2020, + Prop_DisplayGCImage_String = 2021, + Prop_LensCenterLeftU_Float = 2022, + Prop_LensCenterLeftV_Float = 2023, + Prop_LensCenterRightU_Float = 2024, + Prop_LensCenterRightV_Float = 2025, + Prop_UserHeadToEyeDepthMeters_Float = 2026, + Prop_CameraFirmwareVersion_Uint64 = 2027, + Prop_CameraFirmwareDescription_String = 2028, + Prop_DisplayFPGAVersion_Uint64 = 2029, + Prop_DisplayBootloaderVersion_Uint64 = 2030, + Prop_DisplayHardwareVersion_Uint64 = 2031, + Prop_AudioFirmwareVersion_Uint64 = 2032, + Prop_CameraCompatibilityMode_Int32 = 2033, + Prop_ScreenshotHorizontalFieldOfViewDegrees_Float = 2034, + Prop_ScreenshotVerticalFieldOfViewDegrees_Float = 2035, + Prop_DisplaySuppressed_Bool = 2036, + Prop_DisplayAllowNightMode_Bool = 2037, + Prop_DisplayMCImageWidth_Int32 = 2038, + Prop_DisplayMCImageHeight_Int32 = 2039, + Prop_DisplayMCImageNumChannels_Int32 = 2040, + Prop_DisplayMCImageData_Binary = 2041, + Prop_SecondsFromPhotonsToVblank_Float = 2042, + Prop_DriverDirectModeSendsVsyncEvents_Bool = 2043, + Prop_DisplayDebugMode_Bool = 2044, + Prop_GraphicsAdapterLuid_Uint64 = 2045, + Prop_DriverProvidedChaperonePath_String = 2048, + Prop_ExpectedTrackingReferenceCount_Int32 = 2049, // expected number of sensors or basestations to reserve UI space for + Prop_ExpectedControllerCount_Int32 = 2050, // expected number of tracked controllers to reserve UI space for + Prop_NamedIconPathControllerLeftDeviceOff_String = 2051, // placeholder icon for "left" controller if not yet detected/loaded + Prop_NamedIconPathControllerRightDeviceOff_String = 2052, // placeholder icon for "right" controller if not yet detected/loaded + Prop_NamedIconPathTrackingReferenceDeviceOff_String = 2053, // placeholder icon for sensor/base if not yet detected/loaded + Prop_DoNotApplyPrediction_Bool = 2054, // currently no effect. was used to disable HMD pose prediction on MR, which is now done by MR driver setting velocity=0 + Prop_CameraToHeadTransforms_Matrix34_Array = 2055, + Prop_DistortionMeshResolution_Int32 = 2056, // custom resolution of compositor calls to IVRSystem::ComputeDistortion + Prop_DriverIsDrawingControllers_Bool = 2057, + Prop_DriverRequestsApplicationPause_Bool = 2058, + Prop_DriverRequestsReducedRendering_Bool = 2059, + Prop_MinimumIpdStepMeters_Float = 2060, + Prop_AudioBridgeFirmwareVersion_Uint64 = 2061, + Prop_ImageBridgeFirmwareVersion_Uint64 = 2062, + Prop_ImuToHeadTransform_Matrix34 = 2063, + Prop_ImuFactoryGyroBias_Vector3 = 2064, + Prop_ImuFactoryGyroScale_Vector3 = 2065, + Prop_ImuFactoryAccelerometerBias_Vector3 = 2066, + Prop_ImuFactoryAccelerometerScale_Vector3 = 2067, + // reserved 2068 + Prop_ConfigurationIncludesLighthouse20Features_Bool = 2069, + Prop_AdditionalRadioFeatures_Uint64 = 2070, + Prop_CameraWhiteBalance_Vector4_Array = 2071, // Prop_NumCameras_Int32-sized array of float[4] RGBG white balance calibration data (max size is vr::k_unMaxCameras) + Prop_CameraDistortionFunction_Int32_Array = 2072, // Prop_NumCameras_Int32-sized array of vr::EVRDistortionFunctionType values (max size is vr::k_unMaxCameras) + Prop_CameraDistortionCoefficients_Float_Array = 2073, // Prop_NumCameras_Int32-sized array of double[vr::k_unMaxDistortionFunctionParameters] (max size is vr::k_unMaxCameras) + Prop_ExpectedControllerType_String = 2074, + Prop_HmdTrackingStyle_Int32 = 2075, // one of EHmdTrackingStyle + Prop_DriverProvidedChaperoneVisibility_Bool = 2076, + Prop_HmdColumnCorrectionSettingPrefix_String = 2077, + Prop_CameraSupportsCompatibilityModes_Bool = 2078, + Prop_SupportsRoomViewDepthProjection_Bool = 2079, + Prop_DisplayAvailableFrameRates_Float_Array = 2080, // populated by compositor from actual EDID list when available from GPU driver + Prop_DisplaySupportsMultipleFramerates_Bool = 2081, // if this is true but Prop_DisplayAvailableFrameRates_Float_Array is empty, explain to user + Prop_DisplayColorMultLeft_Vector3 = 2082, + Prop_DisplayColorMultRight_Vector3 = 2083, + Prop_DisplaySupportsRuntimeFramerateChange_Bool = 2084, + Prop_DisplaySupportsAnalogGain_Bool = 2085, + Prop_DisplayMinAnalogGain_Float = 2086, + Prop_DisplayMaxAnalogGain_Float = 2087, + Prop_CameraExposureTime_Float = 2088, + Prop_CameraGlobalGain_Float = 2089, + // Prop_DashboardLayoutPathName_String = 2090, // DELETED + Prop_DashboardScale_Float = 2091, + Prop_IpdUIRangeMinMeters_Float = 2100, + Prop_IpdUIRangeMaxMeters_Float = 2101, + Prop_Hmd_SupportsHDCP14LegacyCompat_Bool = 2102, + Prop_Hmd_SupportsMicMonitoring_Bool = 2103, + + // Driver requested mura correction properties + Prop_DriverRequestedMuraCorrectionMode_Int32 = 2200, + Prop_DriverRequestedMuraFeather_InnerLeft_Int32 = 2201, + Prop_DriverRequestedMuraFeather_InnerRight_Int32 = 2202, + Prop_DriverRequestedMuraFeather_InnerTop_Int32 = 2203, + Prop_DriverRequestedMuraFeather_InnerBottom_Int32 = 2204, + Prop_DriverRequestedMuraFeather_OuterLeft_Int32 = 2205, + Prop_DriverRequestedMuraFeather_OuterRight_Int32 = 2206, + Prop_DriverRequestedMuraFeather_OuterTop_Int32 = 2207, + Prop_DriverRequestedMuraFeather_OuterBottom_Int32 = 2208, + + Prop_Audio_DefaultPlaybackDeviceId_String = 2300, + Prop_Audio_DefaultRecordingDeviceId_String = 2301, + Prop_Audio_DefaultPlaybackDeviceVolume_Float = 2302, + Prop_Audio_SupportsDualSpeakerAndJackOutput_Bool = 2303, + + // Properties that are unique to TrackedDeviceClass_Controller + Prop_AttachedDeviceId_String = 3000, + Prop_SupportedButtons_Uint64 = 3001, + Prop_Axis0Type_Int32 = 3002, // Return value is of type EVRControllerAxisType + Prop_Axis1Type_Int32 = 3003, // Return value is of type EVRControllerAxisType + Prop_Axis2Type_Int32 = 3004, // Return value is of type EVRControllerAxisType + Prop_Axis3Type_Int32 = 3005, // Return value is of type EVRControllerAxisType + Prop_Axis4Type_Int32 = 3006, // Return value is of type EVRControllerAxisType + Prop_ControllerRoleHint_Int32 = 3007, // Return value is of type ETrackedControllerRole + + // Properties that are unique to TrackedDeviceClass_TrackingReference + Prop_FieldOfViewLeftDegrees_Float = 4000, + Prop_FieldOfViewRightDegrees_Float = 4001, + Prop_FieldOfViewTopDegrees_Float = 4002, + Prop_FieldOfViewBottomDegrees_Float = 4003, + Prop_TrackingRangeMinimumMeters_Float = 4004, + Prop_TrackingRangeMaximumMeters_Float = 4005, + Prop_ModeLabel_String = 4006, + Prop_CanWirelessIdentify_Bool = 4007, // volatile, based on radio presence and fw discovery + Prop_Nonce_Int32 = 4008, + + // Properties that are used for user interface like icons names + Prop_IconPathName_String = 5000, // DEPRECATED. Value not referenced. Now expected to be part of icon path properties. + Prop_NamedIconPathDeviceOff_String = 5001, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearching_String = 5002, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceSearchingAlert_String = 5003, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReady_String = 5004, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceReadyAlert_String = 5005, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceNotReady_String = 5006, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceStandby_String = 5007, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceAlertLow_String = 5008, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + Prop_NamedIconPathDeviceStandbyAlert_String = 5009, // {driver}/icons/icon_filename - PNG for static icon, or GIF for animation, 50x32 for headsets and 32x32 for others + + // Properties that are used by helpers, but are opaque to applications + Prop_DisplayHiddenArea_Binary_Start = 5100, + Prop_DisplayHiddenArea_Binary_End = 5150, + Prop_ParentContainer = 5151, + Prop_OverrideContainer_Uint64 = 5152, + + // Properties that are unique to drivers + Prop_UserConfigPath_String = 6000, + Prop_InstallPath_String = 6001, + Prop_HasDisplayComponent_Bool = 6002, + Prop_HasControllerComponent_Bool = 6003, + Prop_HasCameraComponent_Bool = 6004, + Prop_HasDriverDirectModeComponent_Bool = 6005, + Prop_HasVirtualDisplayComponent_Bool = 6006, + Prop_HasSpatialAnchorsSupport_Bool = 6007, + + // Properties that are set internally based on other information provided by drivers + Prop_ControllerType_String = 7000, + //Prop_LegacyInputProfile_String = 7001, // This is no longer used. See "legacy_binding" in the input profile instead. + Prop_ControllerHandSelectionPriority_Int32 = 7002, // Allows hand assignments to prefer some controllers over others. High numbers are selected over low numbers + + // Vendors are free to expose private debug data in this reserved region + Prop_VendorSpecific_Reserved_Start = 10000, + Prop_VendorSpecific_Reserved_End = 10999, + + Prop_TrackedDeviceProperty_Max = 1000000, +}; + +/** No string property will ever be longer than this length */ +static const uint32_t k_unMaxPropertyStringSize = 32 * 1024; + +/** Used to return errors that occur when reading properties. */ +enum ETrackedPropertyError +{ + TrackedProp_Success = 0, + TrackedProp_WrongDataType = 1, + TrackedProp_WrongDeviceClass = 2, + TrackedProp_BufferTooSmall = 3, + TrackedProp_UnknownProperty = 4, // Driver has not set the property (and may not ever). + TrackedProp_InvalidDevice = 5, + TrackedProp_CouldNotContactServer = 6, + TrackedProp_ValueNotProvidedByDevice = 7, + TrackedProp_StringExceedsMaximumLength = 8, + TrackedProp_NotYetAvailable = 9, // The property value isn't known yet, but is expected soon. Call again later. + TrackedProp_PermissionDenied = 10, + TrackedProp_InvalidOperation = 11, + TrackedProp_CannotWriteToWildcards = 12, + TrackedProp_IPCReadFailure = 13, + TrackedProp_OutOfMemory = 14, + TrackedProp_InvalidContainer = 15, +}; + +/** Used to drive certain text in the UI when talking about the tracking system for the HMD */ +enum EHmdTrackingStyle +{ + HmdTrackingStyle_Unknown = 0, + + HmdTrackingStyle_Lighthouse = 1, // base stations and lasers + HmdTrackingStyle_OutsideInCameras = 2, // Cameras and LED, Rift 1 style + HmdTrackingStyle_InsideOutCameras = 3, // Cameras on HMD looking at the world +}; + +typedef uint64_t VRActionHandle_t; +typedef uint64_t VRActionSetHandle_t; +typedef uint64_t VRInputValueHandle_t; + +static const VRActionHandle_t k_ulInvalidActionHandle = 0; +static const VRActionSetHandle_t k_ulInvalidActionSetHandle = 0; +static const VRInputValueHandle_t k_ulInvalidInputValueHandle = 0; + + +/** Allows the application to control what part of the provided texture will be used in the +* frame buffer. */ +struct VRTextureBounds_t +{ + float uMin, vMin; + float uMax, vMax; +}; + +/** Allows specifying pose used to render provided scene texture (if different from value returned by WaitGetPoses). */ +struct VRTextureWithPose_t : public Texture_t +{ + HmdMatrix34_t mDeviceToAbsoluteTracking; // Actual pose used to render scene textures. +}; + +struct VRTextureDepthInfo_t +{ + void* handle; // See ETextureType definition above + HmdMatrix44_t mProjection; + HmdVector2_t vRange; // 0..1 +}; + +struct VRTextureWithDepth_t : public Texture_t +{ + VRTextureDepthInfo_t depth; +}; + +struct VRTextureWithPoseAndDepth_t : public VRTextureWithPose_t +{ + VRTextureDepthInfo_t depth; +}; + +/** Allows the application to control how scene textures are used by the compositor when calling Submit. */ +enum EVRSubmitFlags +{ + // Simple render path. App submits rendered left and right eye images with no lens distortion correction applied. + Submit_Default = 0x00, + + // App submits final left and right eye images with lens distortion already applied (lens distortion makes the images appear + // barrel distorted with chromatic aberration correction applied). The app would have used the data returned by + // vr::IVRSystem::ComputeDistortion() to apply the correct distortion to the rendered images before calling Submit(). + Submit_LensDistortionAlreadyApplied = 0x01, + + // If the texture pointer passed in is actually a renderbuffer (e.g. for MSAA in OpenGL) then set this flag. + Submit_GlRenderBuffer = 0x02, + + // Do not use + Submit_Reserved = 0x04, + + // Set to indicate that pTexture is a pointer to a VRTextureWithPose_t. + // This flag can be combined with Submit_TextureWithDepth to pass a VRTextureWithPoseAndDepth_t. + Submit_TextureWithPose = 0x08, + + // Set to indicate that pTexture is a pointer to a VRTextureWithDepth_t. + // This flag can be combined with Submit_TextureWithPose to pass a VRTextureWithPoseAndDepth_t. + Submit_TextureWithDepth = 0x10, + + // Set to indicate a discontinuity between this and the last frame. + // This will prevent motion smoothing from attempting to extrapolate using the pair. + Submit_FrameDiscontinuty = 0x20, + + // Set to indicate that pTexture->handle is a contains VRVulkanTextureArrayData_t + Submit_VulkanTextureWithArrayData = 0x40, + + // If the texture pointer passed in is an OpenGL Array texture, set this flag + Submit_GlArrayTexture = 0x80, + + // Do not use + Submit_Reserved2 = 0x8000, + + +}; + +/** Data required for passing Vulkan textures to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ +struct VRVulkanTextureData_t +{ + uint64_t m_nImage; // VkImage + VkDevice_T *m_pDevice; + VkPhysicalDevice_T *m_pPhysicalDevice; + VkInstance_T *m_pInstance; + VkQueue_T *m_pQueue; + uint32_t m_nQueueFamilyIndex; + uint32_t m_nWidth, m_nHeight, m_nFormat, m_nSampleCount; +}; + +/** Data required for passing Vulkan texture arrays to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. +* Please see https://github.com/ValveSoftware/openvr/wiki/Vulkan for Vulkan-specific documentation */ +struct VRVulkanTextureArrayData_t : public VRVulkanTextureData_t +{ + uint32_t m_unArrayIndex; + uint32_t m_unArraySize; +}; + +/** Data required for passing D3D12 textures to IVRCompositor::Submit. +* Be sure to call OpenVR_Shutdown before destroying these resources. */ +struct D3D12TextureData_t +{ + ID3D12Resource *m_pResource; + ID3D12CommandQueue *m_pCommandQueue; + uint32_t m_nNodeMask; +}; + +/** Status of the overall system or tracked objects */ +enum EVRState +{ + VRState_Undefined = -1, + VRState_Off = 0, + VRState_Searching = 1, + VRState_Searching_Alert = 2, + VRState_Ready = 3, + VRState_Ready_Alert = 4, + VRState_NotReady = 5, + VRState_Standby = 6, + VRState_Ready_Alert_Low = 7, +}; + +/** The types of events that could be posted (and what the parameters mean for each event type) */ +enum EVREventType +{ + VREvent_None = 0, + + VREvent_TrackedDeviceActivated = 100, + VREvent_TrackedDeviceDeactivated = 101, + VREvent_TrackedDeviceUpdated = 102, + VREvent_TrackedDeviceUserInteractionStarted = 103, + VREvent_TrackedDeviceUserInteractionEnded = 104, + VREvent_IpdChanged = 105, + VREvent_EnterStandbyMode = 106, + VREvent_LeaveStandbyMode = 107, + VREvent_TrackedDeviceRoleChanged = 108, + VREvent_WatchdogWakeUpRequested = 109, + VREvent_LensDistortionChanged = 110, + VREvent_PropertyChanged = 111, + VREvent_WirelessDisconnect = 112, + VREvent_WirelessReconnect = 113, + + VREvent_ButtonPress = 200, // data is controller + VREvent_ButtonUnpress = 201, // data is controller + VREvent_ButtonTouch = 202, // data is controller + VREvent_ButtonUntouch = 203, // data is controller + + // VREvent_DualAnalog_Press = 250, // No longer sent + // VREvent_DualAnalog_Unpress = 251, // No longer sent + // VREvent_DualAnalog_Touch = 252, // No longer sent + // VREvent_DualAnalog_Untouch = 253, // No longer sent + // VREvent_DualAnalog_Move = 254, // No longer sent + // VREvent_DualAnalog_ModeSwitch1 = 255, // No longer sent + // VREvent_DualAnalog_ModeSwitch2 = 256, // No longer sent + VREvent_Modal_Cancel = 257, // Sent to overlays with the + + VREvent_MouseMove = 300, // data is mouse + VREvent_MouseButtonDown = 301, // data is mouse + VREvent_MouseButtonUp = 302, // data is mouse + VREvent_FocusEnter = 303, // data is overlay + VREvent_FocusLeave = 304, // data is overlay + VREvent_ScrollDiscrete = 305, // data is scroll + VREvent_TouchPadMove = 306, // data is mouse + VREvent_OverlayFocusChanged = 307, // data is overlay, global event + VREvent_ReloadOverlays = 308, + VREvent_ScrollSmooth = 309, // data is scroll + VREvent_LockMousePosition = 310, + VREvent_UnlockMousePosition = 311, + + VREvent_InputFocusCaptured = 400, // data is process DEPRECATED + VREvent_InputFocusReleased = 401, // data is process DEPRECATED + // VREvent_SceneFocusLost = 402, // data is process + // VREvent_SceneFocusGained = 403, // data is process + VREvent_SceneApplicationChanged = 404, // data is process - The App actually drawing the scene changed (usually to or from the compositor) + VREvent_SceneFocusChanged = 405, // data is process - New app got access to draw the scene + VREvent_InputFocusChanged = 406, // data is process + // VREvent_SceneApplicationSecondaryRenderingStarted = 407, + VREvent_SceneApplicationUsingWrongGraphicsAdapter = 408, // data is process + VREvent_ActionBindingReloaded = 409, // data is process - The App that action binds reloaded for + + VREvent_HideRenderModels = 410, // Sent to the scene application to request hiding render models temporarily + VREvent_ShowRenderModels = 411, // Sent to the scene application to request restoring render model visibility + + VREvent_SceneApplicationStateChanged = 412, // No data; but query VRApplications()->GetSceneApplicationState(); + + VREvent_ConsoleOpened = 420, + VREvent_ConsoleClosed = 421, + + VREvent_OverlayShown = 500, + VREvent_OverlayHidden = 501, + VREvent_DashboardActivated = 502, + VREvent_DashboardDeactivated = 503, + //VREvent_DashboardThumbSelected = 504, // Sent to the overlay manager - data is overlay - No longer sent + VREvent_DashboardRequested = 505, // Sent to the overlay manager - data is overlay + VREvent_ResetDashboard = 506, // Send to the overlay manager + //VREvent_RenderToast = 507, // Send to the dashboard to render a toast - data is the notification ID -- no longer sent + VREvent_ImageLoaded = 508, // Sent to overlays when a SetOverlayRaw or SetOverlayFromFile call finishes loading + VREvent_ShowKeyboard = 509, // Sent to keyboard renderer in the dashboard to invoke it + VREvent_HideKeyboard = 510, // Sent to keyboard renderer in the dashboard to hide it + VREvent_OverlayGamepadFocusGained = 511, // Sent to an overlay when IVROverlay::SetFocusOverlay is called on it + VREvent_OverlayGamepadFocusLost = 512, // Send to an overlay when it previously had focus and IVROverlay::SetFocusOverlay is called on something else + VREvent_OverlaySharedTextureChanged = 513, + //VREvent_DashboardGuideButtonDown = 514, // These are no longer sent + //VREvent_DashboardGuideButtonUp = 515, + VREvent_ScreenshotTriggered = 516, // Screenshot button combo was pressed, Dashboard should request a screenshot + VREvent_ImageFailed = 517, // Sent to overlays when a SetOverlayRaw or SetOverlayfromFail fails to load + VREvent_DashboardOverlayCreated = 518, + VREvent_SwitchGamepadFocus = 519, + + // Screenshot API + VREvent_RequestScreenshot = 520, // Sent by vrclient application to compositor to take a screenshot + VREvent_ScreenshotTaken = 521, // Sent by compositor to the application that the screenshot has been taken + VREvent_ScreenshotFailed = 522, // Sent by compositor to the application that the screenshot failed to be taken + VREvent_SubmitScreenshotToDashboard = 523, // Sent by compositor to the dashboard that a completed screenshot was submitted + VREvent_ScreenshotProgressToDashboard = 524, // Sent by compositor to the dashboard that a completed screenshot was submitted + + VREvent_PrimaryDashboardDeviceChanged = 525, + VREvent_RoomViewShown = 526, // Sent by compositor whenever room-view is enabled + VREvent_RoomViewHidden = 527, // Sent by compositor whenever room-view is disabled + VREvent_ShowUI = 528, // data is showUi + VREvent_ShowDevTools = 529, // data is showDevTools + VREvent_DesktopViewUpdating = 530, + VREvent_DesktopViewReady = 531, + + VREvent_Notification_Shown = 600, + VREvent_Notification_Hidden = 601, + VREvent_Notification_BeginInteraction = 602, + VREvent_Notification_Destroyed = 603, + + VREvent_Quit = 700, // data is process + VREvent_ProcessQuit = 701, // data is process + //VREvent_QuitAborted_UserPrompt = 702, // data is process + VREvent_QuitAcknowledged = 703, // data is process + VREvent_DriverRequestedQuit = 704, // The driver has requested that SteamVR shut down + VREvent_RestartRequested = 705, // A driver or other component wants the user to restart SteamVR + + VREvent_ChaperoneDataHasChanged = 800, // this will never happen with the new chaperone system + VREvent_ChaperoneUniverseHasChanged = 801, + VREvent_ChaperoneTempDataHasChanged = 802, // this will never happen with the new chaperone system + VREvent_ChaperoneSettingsHaveChanged = 803, + VREvent_SeatedZeroPoseReset = 804, + VREvent_ChaperoneFlushCache = 805, // Sent when the process needs to reload any cached data it retrieved from VRChaperone() + VREvent_ChaperoneRoomSetupStarting = 806, // Triggered by CVRChaperoneClient::RoomSetupStarting + VREvent_ChaperoneRoomSetupFinished = 807, // Triggered by CVRChaperoneClient::CommitWorkingCopy + VREvent_StandingZeroPoseReset = 808, + + VREvent_AudioSettingsHaveChanged = 820, + + VREvent_BackgroundSettingHasChanged = 850, + VREvent_CameraSettingsHaveChanged = 851, + VREvent_ReprojectionSettingHasChanged = 852, + VREvent_ModelSkinSettingsHaveChanged = 853, + VREvent_EnvironmentSettingsHaveChanged = 854, + VREvent_PowerSettingsHaveChanged = 855, + VREvent_EnableHomeAppSettingsHaveChanged = 856, + VREvent_SteamVRSectionSettingChanged = 857, + VREvent_LighthouseSectionSettingChanged = 858, + VREvent_NullSectionSettingChanged = 859, + VREvent_UserInterfaceSectionSettingChanged = 860, + VREvent_NotificationsSectionSettingChanged = 861, + VREvent_KeyboardSectionSettingChanged = 862, + VREvent_PerfSectionSettingChanged = 863, + VREvent_DashboardSectionSettingChanged = 864, + VREvent_WebInterfaceSectionSettingChanged = 865, + VREvent_TrackersSectionSettingChanged = 866, + VREvent_LastKnownSectionSettingChanged = 867, + VREvent_DismissedWarningsSectionSettingChanged = 868, + VREvent_GpuSpeedSectionSettingChanged = 869, + VREvent_WindowsMRSectionSettingChanged = 870, + VREvent_OtherSectionSettingChanged = 871, + + VREvent_StatusUpdate = 900, + + VREvent_WebInterface_InstallDriverCompleted = 950, + + VREvent_MCImageUpdated = 1000, + + VREvent_FirmwareUpdateStarted = 1100, + VREvent_FirmwareUpdateFinished = 1101, + + VREvent_KeyboardClosed = 1200, + VREvent_KeyboardCharInput = 1201, + VREvent_KeyboardDone = 1202, // Sent when DONE button clicked on keyboard + + //VREvent_ApplicationTransitionStarted = 1300, + //VREvent_ApplicationTransitionAborted = 1301, + //VREvent_ApplicationTransitionNewAppStarted = 1302, + VREvent_ApplicationListUpdated = 1303, + VREvent_ApplicationMimeTypeLoad = 1304, + // VREvent_ApplicationTransitionNewAppLaunchComplete = 1305, + VREvent_ProcessConnected = 1306, + VREvent_ProcessDisconnected = 1307, + + //VREvent_Compositor_MirrorWindowShown = 1400, // DEPRECATED + //VREvent_Compositor_MirrorWindowHidden = 1401, // DEPRECATED + VREvent_Compositor_ChaperoneBoundsShown = 1410, + VREvent_Compositor_ChaperoneBoundsHidden = 1411, + VREvent_Compositor_DisplayDisconnected = 1412, + VREvent_Compositor_DisplayReconnected = 1413, + VREvent_Compositor_HDCPError = 1414, // data is hdcpError + VREvent_Compositor_ApplicationNotResponding = 1415, + VREvent_Compositor_ApplicationResumed = 1416, + VREvent_Compositor_OutOfVideoMemory = 1417, + VREvent_Compositor_DisplayModeNotSupported = 1418, // k_pch_SteamVR_PreferredRefreshRate + VREvent_Compositor_StageOverrideReady = 1419, + + VREvent_TrackedCamera_StartVideoStream = 1500, + VREvent_TrackedCamera_StopVideoStream = 1501, + VREvent_TrackedCamera_PauseVideoStream = 1502, + VREvent_TrackedCamera_ResumeVideoStream = 1503, + VREvent_TrackedCamera_EditingSurface = 1550, + + VREvent_PerformanceTest_EnableCapture = 1600, + VREvent_PerformanceTest_DisableCapture = 1601, + VREvent_PerformanceTest_FidelityLevel = 1602, + + VREvent_MessageOverlay_Closed = 1650, + VREvent_MessageOverlayCloseRequested = 1651, + + VREvent_Input_HapticVibration = 1700, // data is hapticVibration + VREvent_Input_BindingLoadFailed = 1701, // data is inputBinding + VREvent_Input_BindingLoadSuccessful = 1702, // data is inputBinding + VREvent_Input_ActionManifestReloaded = 1703, // no data + VREvent_Input_ActionManifestLoadFailed = 1704, // data is actionManifest + VREvent_Input_ProgressUpdate = 1705, // data is progressUpdate + VREvent_Input_TrackerActivated = 1706, + VREvent_Input_BindingsUpdated = 1707, + VREvent_Input_BindingSubscriptionChanged = 1708, + + VREvent_SpatialAnchors_PoseUpdated = 1800, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_DescriptorUpdated = 1801, // data is spatialAnchor. broadcast + VREvent_SpatialAnchors_RequestPoseUpdate = 1802, // data is spatialAnchor. sent to specific driver + VREvent_SpatialAnchors_RequestDescriptorUpdate = 1803, // data is spatialAnchor. sent to specific driver + + VREvent_SystemReport_Started = 1900, // user or system initiated generation of a system report. broadcast + + VREvent_Monitor_ShowHeadsetView = 2000, // data is process + VREvent_Monitor_HideHeadsetView = 2001, // data is process + + // Vendors are free to expose private events in this reserved region + VREvent_VendorSpecific_Reserved_Start = 10000, + VREvent_VendorSpecific_Reserved_End = 19999, +}; + + +/** Level of Hmd activity */ +// UserInteraction_Timeout means the device is in the process of timing out. +// InUse = ( k_EDeviceActivityLevel_UserInteraction || k_EDeviceActivityLevel_UserInteraction_Timeout ) +// VREvent_TrackedDeviceUserInteractionStarted fires when the devices transitions from Standby -> UserInteraction or Idle -> UserInteraction. +// VREvent_TrackedDeviceUserInteractionEnded fires when the devices transitions from UserInteraction_Timeout -> Idle +enum EDeviceActivityLevel +{ + k_EDeviceActivityLevel_Unknown = -1, + k_EDeviceActivityLevel_Idle = 0, // No activity for the last 10 seconds + k_EDeviceActivityLevel_UserInteraction = 1, // Activity (movement or prox sensor) is happening now + k_EDeviceActivityLevel_UserInteraction_Timeout = 2, // No activity for the last 0.5 seconds + k_EDeviceActivityLevel_Standby = 3, // Idle for at least 5 seconds (configurable in Settings -> Power Management) + k_EDeviceActivityLevel_Idle_Timeout = 4, +}; + + +/** VR controller button and axis IDs */ +enum EVRButtonId +{ + k_EButton_System = 0, + k_EButton_ApplicationMenu = 1, + k_EButton_Grip = 2, + k_EButton_DPad_Left = 3, + k_EButton_DPad_Up = 4, + k_EButton_DPad_Right = 5, + k_EButton_DPad_Down = 6, + k_EButton_A = 7, + + k_EButton_ProximitySensor = 31, + + k_EButton_Axis0 = 32, + k_EButton_Axis1 = 33, + k_EButton_Axis2 = 34, + k_EButton_Axis3 = 35, + k_EButton_Axis4 = 36, + + // aliases for well known controllers + k_EButton_SteamVR_Touchpad = k_EButton_Axis0, + k_EButton_SteamVR_Trigger = k_EButton_Axis1, + + k_EButton_Dashboard_Back = k_EButton_Grip, + + k_EButton_IndexController_A = k_EButton_Grip, + k_EButton_IndexController_B = k_EButton_ApplicationMenu, + k_EButton_IndexController_JoyStick = k_EButton_Axis3, + + k_EButton_Max = 64 +}; + +inline uint64_t ButtonMaskFromId( EVRButtonId id ) { return 1ull << id; } + +/** used for controller button events */ +struct VREvent_Controller_t +{ + uint32_t button; // EVRButtonId enum +}; + + +/** used for simulated mouse events in overlay space */ +enum EVRMouseButton +{ + VRMouseButton_Left = 0x0001, + VRMouseButton_Right = 0x0002, + VRMouseButton_Middle = 0x0004, +}; + + +/** used for simulated mouse events in overlay space */ +struct VREvent_Mouse_t +{ + float x, y; // co-ords are in GL space, bottom left of the texture is 0,0 + uint32_t button; // EVRMouseButton enum +}; + +/** used for simulated mouse wheel scroll */ +struct VREvent_Scroll_t +{ + float xdelta, ydelta; + uint32_t unused; + float viewportscale; // For scrolling on an overlay with laser mouse, this is the overlay's vertical size relative to the overlay height. Range: [0,1] +}; + +/** when in mouse input mode you can receive data from the touchpad, these events are only sent if the users finger + is on the touchpad (or just released from it). These events are sent to overlays with the VROverlayFlags_SendVRTouchpadEvents + flag set. +**/ +struct VREvent_TouchPadMove_t +{ + // true if the users finger is detected on the touch pad + bool bFingerDown; + + // How long the finger has been down in seconds + float flSecondsFingerDown; + + // These values indicate the starting finger position (so you can do some basic swipe stuff) + float fValueXFirst; + float fValueYFirst; + + // This is the raw sampled coordinate without deadzoning + float fValueXRaw; + float fValueYRaw; +}; + +/** notification related events. Details will still change at this point */ +struct VREvent_Notification_t +{ + uint64_t ulUserValue; + uint32_t notificationId; +}; + +/** Used for events about processes */ +struct VREvent_Process_t +{ + uint32_t pid; + uint32_t oldPid; + bool bForced; + // If the associated event was triggered by a connection loss + bool bConnectionLost; +}; + + +/** Used for a few events about overlays */ +struct VREvent_Overlay_t +{ + uint64_t overlayHandle; + uint64_t devicePath; + uint64_t memoryBlockId; +}; + + +/** Used for a few events about overlays */ +struct VREvent_Status_t +{ + uint32_t statusState; // EVRState enum +}; + +/** Used for keyboard events **/ +struct VREvent_Keyboard_t +{ + char cNewInput[8]; // Up to 11 bytes of new input + uint64_t uUserValue; // Possible flags about the new input +}; + +struct VREvent_Ipd_t +{ + float ipdMeters; +}; + +struct VREvent_Chaperone_t +{ + uint64_t m_nPreviousUniverse; + uint64_t m_nCurrentUniverse; +}; + +/** Not actually used for any events */ +struct VREvent_Reserved_t +{ + uint64_t reserved0; + uint64_t reserved1; + uint64_t reserved2; + uint64_t reserved3; + uint64_t reserved4; + uint64_t reserved5; +}; + +struct VREvent_PerformanceTest_t +{ + uint32_t m_nFidelityLevel; +}; + +struct VREvent_SeatedZeroPoseReset_t +{ + bool bResetBySystemMenu; +}; + +struct VREvent_Screenshot_t +{ + uint32_t handle; + uint32_t type; +}; + +struct VREvent_ScreenshotProgress_t +{ + float progress; +}; + +struct VREvent_ApplicationLaunch_t +{ + uint32_t pid; + uint32_t unArgsHandle; +}; + +struct VREvent_EditingCameraSurface_t +{ + uint64_t overlayHandle; + uint32_t nVisualMode; +}; + +struct VREvent_MessageOverlay_t +{ + uint32_t unVRMessageOverlayResponse; // vr::VRMessageOverlayResponse enum +}; + +struct VREvent_Property_t +{ + PropertyContainerHandle_t container; + ETrackedDeviceProperty prop; +}; + +struct VREvent_HapticVibration_t +{ + uint64_t containerHandle; // property container handle of the device with the haptic component + uint64_t componentHandle; // Which haptic component needs to vibrate + float fDurationSeconds; + float fFrequency; + float fAmplitude; +}; + +struct VREvent_WebConsole_t +{ + WebConsoleHandle_t webConsoleHandle; +}; + +struct VREvent_InputBindingLoad_t +{ + vr::PropertyContainerHandle_t ulAppContainer; + uint64_t pathMessage; + uint64_t pathUrl; + uint64_t pathControllerType; +}; + +struct VREvent_InputActionManifestLoad_t +{ + uint64_t pathAppKey; + uint64_t pathMessage; + uint64_t pathMessageParam; + uint64_t pathManifestPath; +}; + +struct VREvent_SpatialAnchor_t +{ + SpatialAnchorHandle_t unHandle; +}; + +struct VREvent_ProgressUpdate_t +{ + uint64_t ulApplicationPropertyContainer; + uint64_t pathDevice; + uint64_t pathInputSource; + uint64_t pathProgressAction; + uint64_t pathIcon; + float fProgress; +}; + +enum EShowUIType +{ + ShowUI_ControllerBinding = 0, + ShowUI_ManageTrackers = 1, + // ShowUI_QuickStart = 2, // Deprecated + ShowUI_Pairing = 3, + ShowUI_Settings = 4, + ShowUI_DebugCommands = 5, + ShowUI_FullControllerBinding = 6, + ShowUI_ManageDrivers = 7, +}; + +struct VREvent_ShowUI_t +{ + EShowUIType eType; +}; + +struct VREvent_ShowDevTools_t +{ + int32_t nBrowserIdentifier; +}; + +enum EHDCPError +{ + HDCPError_None = 0, + HDCPError_LinkLost = 1, + HDCPError_Tampered = 2, + HDCPError_DeviceRevoked = 3, + HDCPError_Unknown = 4 +}; + +struct VREvent_HDCPError_t +{ + EHDCPError eCode; +}; + +typedef union +{ + VREvent_Reserved_t reserved; + VREvent_Controller_t controller; + VREvent_Mouse_t mouse; + VREvent_Scroll_t scroll; + VREvent_Process_t process; + VREvent_Notification_t notification; + VREvent_Overlay_t overlay; + VREvent_Status_t status; + VREvent_Keyboard_t keyboard; + VREvent_Ipd_t ipd; + VREvent_Chaperone_t chaperone; + VREvent_PerformanceTest_t performanceTest; + VREvent_TouchPadMove_t touchPadMove; + VREvent_SeatedZeroPoseReset_t seatedZeroPoseReset; + VREvent_Screenshot_t screenshot; + VREvent_ScreenshotProgress_t screenshotProgress; + VREvent_ApplicationLaunch_t applicationLaunch; + VREvent_EditingCameraSurface_t cameraSurface; + VREvent_MessageOverlay_t messageOverlay; + VREvent_Property_t property; + VREvent_HapticVibration_t hapticVibration; + VREvent_WebConsole_t webConsole; + VREvent_InputBindingLoad_t inputBinding; + VREvent_InputActionManifestLoad_t actionManifest; + VREvent_SpatialAnchor_t spatialAnchor; + VREvent_ProgressUpdate_t progressUpdate; + VREvent_ShowUI_t showUi; + VREvent_ShowDevTools_t showDevTools; + VREvent_HDCPError_t hdcpError; + /** NOTE!!! If you change this you MUST manually update openvr_interop.cs.py */ +} VREvent_Data_t; + + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +/** An event posted by the server to all running applications */ +struct VREvent_t +{ + uint32_t eventType; // EVREventType enum + TrackedDeviceIndex_t trackedDeviceIndex; + float eventAgeSeconds; + // event data must be the end of the struct as its size is variable + VREvent_Data_t data; +}; + +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + +typedef uint32_t VRComponentProperties; + +enum EVRComponentProperty +{ + VRComponentProperty_IsStatic = (1 << 0), + VRComponentProperty_IsVisible = (1 << 1), + VRComponentProperty_IsTouched = (1 << 2), + VRComponentProperty_IsPressed = (1 << 3), + VRComponentProperty_IsScrolled = (1 << 4), + VRComponentProperty_IsHighlighted = (1 << 5), +}; + + +/** Describes state information about a render-model component, including transforms and other dynamic properties */ +struct RenderModel_ComponentState_t +{ + HmdMatrix34_t mTrackingToComponentRenderModel; // Transform required when drawing the component render model + HmdMatrix34_t mTrackingToComponentLocal; // Transform available for attaching to a local component coordinate system (-Z out from surface ) + VRComponentProperties uProperties; +}; + + +enum EVRInputError +{ + VRInputError_None = 0, + VRInputError_NameNotFound = 1, + VRInputError_WrongType = 2, + VRInputError_InvalidHandle = 3, + VRInputError_InvalidParam = 4, + VRInputError_NoSteam = 5, + VRInputError_MaxCapacityReached = 6, + VRInputError_IPCError = 7, + VRInputError_NoActiveActionSet = 8, + VRInputError_InvalidDevice = 9, + VRInputError_InvalidSkeleton = 10, + VRInputError_InvalidBoneCount = 11, + VRInputError_InvalidCompressedData = 12, + VRInputError_NoData = 13, + VRInputError_BufferTooSmall = 14, + VRInputError_MismatchedActionManifest = 15, + VRInputError_MissingSkeletonData = 16, + VRInputError_InvalidBoneIndex = 17, + VRInputError_InvalidPriority = 18, + VRInputError_PermissionDenied = 19, + VRInputError_InvalidRenderModel = 20, +}; + +enum EVRSpatialAnchorError +{ + VRSpatialAnchorError_Success = 0, + VRSpatialAnchorError_Internal = 1, + VRSpatialAnchorError_UnknownHandle = 2, + VRSpatialAnchorError_ArrayTooSmall = 3, + VRSpatialAnchorError_InvalidDescriptorChar = 4, + VRSpatialAnchorError_NotYetAvailable = 5, + VRSpatialAnchorError_NotAvailableInThisUniverse = 6, + VRSpatialAnchorError_PermanentlyUnavailable = 7, + VRSpatialAnchorError_WrongDriver = 8, + VRSpatialAnchorError_DescriptorTooLong = 9, + VRSpatialAnchorError_Unknown = 10, + VRSpatialAnchorError_NoRoomCalibration = 11, + VRSpatialAnchorError_InvalidArgument = 12, + VRSpatialAnchorError_UnknownDriver = 13, +}; + +/** The mesh to draw into the stencil (or depth) buffer to perform +* early stencil (or depth) kills of pixels that will never appear on the HMD. +* This mesh draws on all the pixels that will be hidden after distortion. +* +* If the HMD does not provide a visible area mesh pVertexData will be +* NULL and unTriangleCount will be 0. */ +struct HiddenAreaMesh_t +{ + const HmdVector2_t *pVertexData; + uint32_t unTriangleCount; +}; + + +enum EHiddenAreaMeshType +{ + k_eHiddenAreaMesh_Standard = 0, + k_eHiddenAreaMesh_Inverse = 1, + k_eHiddenAreaMesh_LineLoop = 2, + + k_eHiddenAreaMesh_Max = 3, +}; + + +/** Identifies what kind of axis is on the controller at index n. Read this type +* with pVRSystem->Get( nControllerDeviceIndex, Prop_Axis0Type_Int32 + n ); +*/ +enum EVRControllerAxisType +{ + k_eControllerAxis_None = 0, + k_eControllerAxis_TrackPad = 1, + k_eControllerAxis_Joystick = 2, + k_eControllerAxis_Trigger = 3, // Analog trigger data is in the X axis +}; + + +/** contains information about one axis on the controller */ +struct VRControllerAxis_t +{ + float x; // Ranges from -1.0 to 1.0 for joysticks and track pads. Ranges from 0.0 to 1.0 for triggers were 0 is fully released. + float y; // Ranges from -1.0 to 1.0 for joysticks and track pads. Is always 0.0 for triggers. +}; + + +/** the number of axes in the controller state */ +static const uint32_t k_unControllerStateAxisCount = 5; + + +#if defined(__linux__) || defined(__APPLE__) +// This structure was originally defined mis-packed on Linux, preserved for +// compatibility. +#pragma pack( push, 4 ) +#endif + +/** Holds all the state of a controller at one moment in time. */ +struct VRControllerState001_t +{ + // If packet num matches that on your prior call, then the controller state hasn't been changed since + // your last call and there is no need to process it + uint32_t unPacketNum; + + // bit flags for each of the buttons. Use ButtonMaskFromId to turn an ID into a mask + uint64_t ulButtonPressed; + uint64_t ulButtonTouched; + + // Axis data for the controller's analog inputs + VRControllerAxis_t rAxis[ k_unControllerStateAxisCount ]; +}; +#if defined(__linux__) || defined(__APPLE__) +#pragma pack( pop ) +#endif + + +typedef VRControllerState001_t VRControllerState_t; + + +/** determines how to provide output to the application of various event processing functions. */ +enum EVRControllerEventOutputType +{ + ControllerEventOutput_OSEvents = 0, + ControllerEventOutput_VREvents = 1, +}; + + + +/** Collision Bounds Style */ +enum ECollisionBoundsStyle +{ + COLLISION_BOUNDS_STYLE_BEGINNER = 0, + COLLISION_BOUNDS_STYLE_INTERMEDIATE, + COLLISION_BOUNDS_STYLE_SQUARES, + COLLISION_BOUNDS_STYLE_ADVANCED, + COLLISION_BOUNDS_STYLE_NONE, + + COLLISION_BOUNDS_STYLE_COUNT +}; + +/** used to refer to a single VR overlay */ +typedef uint64_t VROverlayHandle_t; + +static const VROverlayHandle_t k_ulOverlayHandleInvalid = 0; + +/** Errors that can occur around VR overlays */ +enum EVROverlayError +{ + VROverlayError_None = 0, + + VROverlayError_UnknownOverlay = 10, + VROverlayError_InvalidHandle = 11, + VROverlayError_PermissionDenied = 12, + VROverlayError_OverlayLimitExceeded = 13, // No more overlays could be created because the maximum number already exist + VROverlayError_WrongVisibilityType = 14, + VROverlayError_KeyTooLong = 15, + VROverlayError_NameTooLong = 16, + VROverlayError_KeyInUse = 17, + VROverlayError_WrongTransformType = 18, + VROverlayError_InvalidTrackedDevice = 19, + VROverlayError_InvalidParameter = 20, + VROverlayError_ThumbnailCantBeDestroyed = 21, + VROverlayError_ArrayTooSmall = 22, + VROverlayError_RequestFailed = 23, + VROverlayError_InvalidTexture = 24, + VROverlayError_UnableToLoadFile = 25, + VROverlayError_KeyboardAlreadyInUse = 26, + VROverlayError_NoNeighbor = 27, + VROverlayError_TooManyMaskPrimitives = 29, + VROverlayError_BadMaskPrimitive = 30, + VROverlayError_TextureAlreadyLocked = 31, + VROverlayError_TextureLockCapacityReached = 32, + VROverlayError_TextureNotLocked = 33, +}; + +/** enum values to pass in to VR_Init to identify whether the application will +* draw a 3D scene. */ +enum EVRApplicationType +{ + VRApplication_Other = 0, // Some other kind of application that isn't covered by the other entries + VRApplication_Scene = 1, // Application will submit 3D frames + VRApplication_Overlay = 2, // Application only interacts with overlays + VRApplication_Background = 3, // Application should not start SteamVR if it's not already running, and should not + // keep it running if everything else quits. + VRApplication_Utility = 4, // Init should not try to load any drivers. The application needs access to utility + // interfaces (like IVRSettings and IVRApplications) but not hardware. + VRApplication_VRMonitor = 5, // Reserved for vrmonitor + VRApplication_SteamWatchdog = 6,// Reserved for Steam + VRApplication_Bootstrapper = 7, // reserved for vrstartup + VRApplication_WebHelper = 8, // reserved for vrwebhelper + VRApplication_OpenXRInstance = 9, // reserved for openxr (created instance, but not session yet) + VRApplication_OpenXRScene = 10, // reserved for openxr (started session) + VRApplication_OpenXROverlay = 11, // reserved for openxr (started overlay session) + VRApplication_Prism = 12, // reserved for the vrprismhost process + + VRApplication_Max +}; + + +/** returns true if the specified application type is one of the +* OpenXR types */ +inline bool IsOpenXRAppType( EVRApplicationType eType ) +{ + return eType == VRApplication_OpenXRInstance + || eType == VRApplication_OpenXRScene + || eType == VRApplication_OpenXROverlay; +} + + +/** error codes for firmware */ +enum EVRFirmwareError +{ + VRFirmwareError_None = 0, + VRFirmwareError_Success = 1, + VRFirmwareError_Fail = 2, +}; + + +/** error codes for notifications */ +enum EVRNotificationError +{ + VRNotificationError_OK = 0, + VRNotificationError_InvalidNotificationId = 100, + VRNotificationError_NotificationQueueFull = 101, + VRNotificationError_InvalidOverlayHandle = 102, + VRNotificationError_SystemWithUserValueAlreadyExists = 103, +}; + + +enum EVRSkeletalMotionRange +{ + // The range of motion of the skeleton takes into account any physical limits imposed by + // the controller itself. This will tend to be the most accurate pose compared to the user's + // actual hand pose, but might not allow a closed fist for example + VRSkeletalMotionRange_WithController = 0, + + // Retarget the range of motion provided by the input device to make the hand appear to move + // as if it was not holding a controller. eg: map "hand grasping controller" to "closed fist" + VRSkeletalMotionRange_WithoutController = 1, +}; + +enum EVRSkeletalTrackingLevel +{ + // body part location can't be directly determined by the device. Any skeletal pose provided by + // the device is estimated by assuming the position required to active buttons, triggers, joysticks, + // or other input sensors. + // E.g. Vive Controller, Gamepad + VRSkeletalTracking_Estimated = 0, + + // body part location can be measured directly but with fewer degrees of freedom than the actual body + // part. Certain body part positions may be unmeasured by the device and estimated from other input data. + // E.g. Index Controllers, gloves that only measure finger curl + VRSkeletalTracking_Partial = 1, + + // Body part location can be measured directly throughout the entire range of motion of the body part. + // E.g. Mocap suit for the full body, gloves that measure rotation of each finger segment + VRSkeletalTracking_Full = 2, + + VRSkeletalTrackingLevel_Count, + VRSkeletalTrackingLevel_Max = VRSkeletalTrackingLevel_Count - 1 +}; + + +/** Type used for referring to bones by their index */ +typedef int32_t BoneIndex_t; +const BoneIndex_t k_unInvalidBoneIndex = -1; + + +/** error codes returned by Vr_Init */ + +// Please add adequate error description to https://developer.valvesoftware.com/w/index.php?title=Category:SteamVRHelp +enum EVRInitError +{ + VRInitError_None = 0, + VRInitError_Unknown = 1, + + VRInitError_Init_InstallationNotFound = 100, + VRInitError_Init_InstallationCorrupt = 101, + VRInitError_Init_VRClientDLLNotFound = 102, + VRInitError_Init_FileNotFound = 103, + VRInitError_Init_FactoryNotFound = 104, + VRInitError_Init_InterfaceNotFound = 105, + VRInitError_Init_InvalidInterface = 106, + VRInitError_Init_UserConfigDirectoryInvalid = 107, + VRInitError_Init_HmdNotFound = 108, + VRInitError_Init_NotInitialized = 109, + VRInitError_Init_PathRegistryNotFound = 110, + VRInitError_Init_NoConfigPath = 111, + VRInitError_Init_NoLogPath = 112, + VRInitError_Init_PathRegistryNotWritable = 113, + VRInitError_Init_AppInfoInitFailed = 114, + VRInitError_Init_Retry = 115, // Used internally to cause retries to vrserver + VRInitError_Init_InitCanceledByUser = 116, // The calling application should silently exit. The user canceled app startup + VRInitError_Init_AnotherAppLaunching = 117, + VRInitError_Init_SettingsInitFailed = 118, + VRInitError_Init_ShuttingDown = 119, + VRInitError_Init_TooManyObjects = 120, + VRInitError_Init_NoServerForBackgroundApp = 121, + VRInitError_Init_NotSupportedWithCompositor = 122, + VRInitError_Init_NotAvailableToUtilityApps = 123, + VRInitError_Init_Internal = 124, + VRInitError_Init_HmdDriverIdIsNone = 125, + VRInitError_Init_HmdNotFoundPresenceFailed = 126, + VRInitError_Init_VRMonitorNotFound = 127, + VRInitError_Init_VRMonitorStartupFailed = 128, + VRInitError_Init_LowPowerWatchdogNotSupported = 129, + VRInitError_Init_InvalidApplicationType = 130, + VRInitError_Init_NotAvailableToWatchdogApps = 131, + VRInitError_Init_WatchdogDisabledInSettings = 132, + VRInitError_Init_VRDashboardNotFound = 133, + VRInitError_Init_VRDashboardStartupFailed = 134, + VRInitError_Init_VRHomeNotFound = 135, + VRInitError_Init_VRHomeStartupFailed = 136, + VRInitError_Init_RebootingBusy = 137, + VRInitError_Init_FirmwareUpdateBusy = 138, + VRInitError_Init_FirmwareRecoveryBusy = 139, + VRInitError_Init_USBServiceBusy = 140, + VRInitError_Init_VRWebHelperStartupFailed = 141, + VRInitError_Init_TrackerManagerInitFailed = 142, + VRInitError_Init_AlreadyRunning = 143, + VRInitError_Init_FailedForVrMonitor = 144, + VRInitError_Init_PropertyManagerInitFailed = 145, + VRInitError_Init_WebServerFailed = 146, + VRInitError_Init_IllegalTypeTransition = 147, + VRInitError_Init_MismatchedRuntimes = 148, + VRInitError_Init_InvalidProcessId = 149, + VRInitError_Init_VRServiceStartupFailed = 150, + VRInitError_Init_PrismNeedsNewDrivers = 151, + VRInitError_Init_PrismStartupTimedOut = 152, + VRInitError_Init_CouldNotStartPrism = 153, + VRInitError_Init_CreateDriverDirectDeviceFailed = 154, + VRInitError_Init_PrismExitedUnexpectedly = 155, + + VRInitError_Driver_Failed = 200, + VRInitError_Driver_Unknown = 201, + VRInitError_Driver_HmdUnknown = 202, + VRInitError_Driver_NotLoaded = 203, + VRInitError_Driver_RuntimeOutOfDate = 204, + VRInitError_Driver_HmdInUse = 205, + VRInitError_Driver_NotCalibrated = 206, + VRInitError_Driver_CalibrationInvalid = 207, + VRInitError_Driver_HmdDisplayNotFound = 208, + VRInitError_Driver_TrackedDeviceInterfaceUnknown = 209, + // VRInitError_Driver_HmdDisplayNotFoundAfterFix = 210, // not needed: here for historic reasons + VRInitError_Driver_HmdDriverIdOutOfBounds = 211, + VRInitError_Driver_HmdDisplayMirrored = 212, + VRInitError_Driver_HmdDisplayNotFoundLaptop = 213, + // Never make error 259 because we return it from main and it would conflict with STILL_ACTIVE + + VRInitError_IPC_ServerInitFailed = 300, + VRInitError_IPC_ConnectFailed = 301, + VRInitError_IPC_SharedStateInitFailed = 302, + VRInitError_IPC_CompositorInitFailed = 303, + VRInitError_IPC_MutexInitFailed = 304, + VRInitError_IPC_Failed = 305, + VRInitError_IPC_CompositorConnectFailed = 306, + VRInitError_IPC_CompositorInvalidConnectResponse = 307, + VRInitError_IPC_ConnectFailedAfterMultipleAttempts = 308, + VRInitError_IPC_ConnectFailedAfterTargetExited = 309, + VRInitError_IPC_NamespaceUnavailable = 310, + + VRInitError_Compositor_Failed = 400, + VRInitError_Compositor_D3D11HardwareRequired = 401, + VRInitError_Compositor_FirmwareRequiresUpdate = 402, + VRInitError_Compositor_OverlayInitFailed = 403, + VRInitError_Compositor_ScreenshotsInitFailed = 404, + VRInitError_Compositor_UnableToCreateDevice = 405, + VRInitError_Compositor_SharedStateIsNull = 406, + VRInitError_Compositor_NotificationManagerIsNull = 407, + VRInitError_Compositor_ResourceManagerClientIsNull = 408, + VRInitError_Compositor_MessageOverlaySharedStateInitFailure = 409, + VRInitError_Compositor_PropertiesInterfaceIsNull = 410, + VRInitError_Compositor_CreateFullscreenWindowFailed = 411, + VRInitError_Compositor_SettingsInterfaceIsNull = 412, + VRInitError_Compositor_FailedToShowWindow = 413, + VRInitError_Compositor_DistortInterfaceIsNull = 414, + VRInitError_Compositor_DisplayFrequencyFailure = 415, + VRInitError_Compositor_RendererInitializationFailed = 416, + VRInitError_Compositor_DXGIFactoryInterfaceIsNull = 417, + VRInitError_Compositor_DXGIFactoryCreateFailed = 418, + VRInitError_Compositor_DXGIFactoryQueryFailed = 419, + VRInitError_Compositor_InvalidAdapterDesktop = 420, + VRInitError_Compositor_InvalidHmdAttachment = 421, + VRInitError_Compositor_InvalidOutputDesktop = 422, + VRInitError_Compositor_InvalidDeviceProvided = 423, + VRInitError_Compositor_D3D11RendererInitializationFailed = 424, + VRInitError_Compositor_FailedToFindDisplayMode = 425, + VRInitError_Compositor_FailedToCreateSwapChain = 426, + VRInitError_Compositor_FailedToGetBackBuffer = 427, + VRInitError_Compositor_FailedToCreateRenderTarget = 428, + VRInitError_Compositor_FailedToCreateDXGI2SwapChain = 429, + VRInitError_Compositor_FailedtoGetDXGI2BackBuffer = 430, + VRInitError_Compositor_FailedToCreateDXGI2RenderTarget = 431, + VRInitError_Compositor_FailedToGetDXGIDeviceInterface = 432, + VRInitError_Compositor_SelectDisplayMode = 433, + VRInitError_Compositor_FailedToCreateNvAPIRenderTargets = 434, + VRInitError_Compositor_NvAPISetDisplayMode = 435, + VRInitError_Compositor_FailedToCreateDirectModeDisplay = 436, + VRInitError_Compositor_InvalidHmdPropertyContainer = 437, + VRInitError_Compositor_UpdateDisplayFrequency = 438, + VRInitError_Compositor_CreateRasterizerState = 439, + VRInitError_Compositor_CreateWireframeRasterizerState = 440, + VRInitError_Compositor_CreateSamplerState = 441, + VRInitError_Compositor_CreateClampToBorderSamplerState = 442, + VRInitError_Compositor_CreateAnisoSamplerState = 443, + VRInitError_Compositor_CreateOverlaySamplerState = 444, + VRInitError_Compositor_CreatePanoramaSamplerState = 445, + VRInitError_Compositor_CreateFontSamplerState = 446, + VRInitError_Compositor_CreateNoBlendState = 447, + VRInitError_Compositor_CreateBlendState = 448, + VRInitError_Compositor_CreateAlphaBlendState = 449, + VRInitError_Compositor_CreateBlendStateMaskR = 450, + VRInitError_Compositor_CreateBlendStateMaskG = 451, + VRInitError_Compositor_CreateBlendStateMaskB = 452, + VRInitError_Compositor_CreateDepthStencilState = 453, + VRInitError_Compositor_CreateDepthStencilStateNoWrite = 454, + VRInitError_Compositor_CreateDepthStencilStateNoDepth = 455, + VRInitError_Compositor_CreateFlushTexture = 456, + VRInitError_Compositor_CreateDistortionSurfaces = 457, + VRInitError_Compositor_CreateConstantBuffer = 458, + VRInitError_Compositor_CreateHmdPoseConstantBuffer = 459, + VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer = 460, + VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer = 461, + VRInitError_Compositor_CreateOverlayConstantBuffer = 462, + VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer = 463, + VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer = 464, + VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer = 465, + VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer = 466, + VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer = 467, + VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer = 468, + VRInitError_Compositor_CreateGeomConstantBuffer = 469, + VRInitError_Compositor_CreatePanelMaskConstantBuffer = 470, + VRInitError_Compositor_CreatePixelSimUBO = 471, + VRInitError_Compositor_CreateMSAARenderTextures = 472, + VRInitError_Compositor_CreateResolveRenderTextures = 473, + VRInitError_Compositor_CreateComputeResolveRenderTextures = 474, + VRInitError_Compositor_CreateDriverDirectModeResolveTextures = 475, + VRInitError_Compositor_OpenDriverDirectModeResolveTextures = 476, + VRInitError_Compositor_CreateFallbackSyncTexture = 477, + VRInitError_Compositor_ShareFallbackSyncTexture = 478, + VRInitError_Compositor_CreateOverlayIndexBuffer = 479, + VRInitError_Compositor_CreateOverlayVertexBuffer = 480, + VRInitError_Compositor_CreateTextVertexBuffer = 481, + VRInitError_Compositor_CreateTextIndexBuffer = 482, + VRInitError_Compositor_CreateMirrorTextures = 483, + VRInitError_Compositor_CreateLastFrameRenderTexture = 484, + VRInitError_Compositor_CreateMirrorOverlay = 485, + VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer = 486, + VRInitError_Compositor_DisplayModeNotSupported = 487, + VRInitError_Compositor_CreateOverlayInvalidCall = 488, + VRInitError_Compositor_CreateOverlayAlreadyInitialized = 489, + VRInitError_Compositor_FailedToCreateMailbox = 490, + VRInitError_Compositor_WindowInterfaceIsNull = 491, + VRInitError_Compositor_SystemLayerCreateInstance = 492, + VRInitError_Compositor_SystemLayerCreateSession = 493, + + VRInitError_VendorSpecific_UnableToConnectToOculusRuntime = 1000, + VRInitError_VendorSpecific_WindowsNotInDevMode = 1001, + + VRInitError_VendorSpecific_HmdFound_CantOpenDevice = 1101, + VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart = 1102, + VRInitError_VendorSpecific_HmdFound_NoStoredConfig = 1103, + VRInitError_VendorSpecific_HmdFound_ConfigTooBig = 1104, + VRInitError_VendorSpecific_HmdFound_ConfigTooSmall = 1105, + VRInitError_VendorSpecific_HmdFound_UnableToInitZLib = 1106, + VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion = 1107, + VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart = 1108, + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart = 1109, + VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext = 1110, + VRInitError_VendorSpecific_HmdFound_UserDataAddressRange = 1111, + VRInitError_VendorSpecific_HmdFound_UserDataError = 1112, + VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck = 1113, + VRInitError_VendorSpecific_OculusRuntimeBadInstall = 1114, + + VRInitError_Steam_SteamInstallationNotFound = 2000, + + // Strictly a placeholder + VRInitError_LastError +}; + +enum EVRScreenshotType +{ + VRScreenshotType_None = 0, + VRScreenshotType_Mono = 1, // left eye only + VRScreenshotType_Stereo = 2, + VRScreenshotType_Cubemap = 3, + VRScreenshotType_MonoPanorama = 4, + VRScreenshotType_StereoPanorama = 5 +}; + +enum EVRScreenshotPropertyFilenames +{ + VRScreenshotPropertyFilenames_Preview = 0, + VRScreenshotPropertyFilenames_VR = 1, +}; + +enum EVRTrackedCameraError +{ + VRTrackedCameraError_None = 0, + VRTrackedCameraError_OperationFailed = 100, + VRTrackedCameraError_InvalidHandle = 101, + VRTrackedCameraError_InvalidFrameHeaderVersion = 102, + VRTrackedCameraError_OutOfHandles = 103, + VRTrackedCameraError_IPCFailure = 104, + VRTrackedCameraError_NotSupportedForThisDevice = 105, + VRTrackedCameraError_SharedMemoryFailure = 106, + VRTrackedCameraError_FrameBufferingFailure = 107, + VRTrackedCameraError_StreamSetupFailure = 108, + VRTrackedCameraError_InvalidGLTextureId = 109, + VRTrackedCameraError_InvalidSharedTextureHandle = 110, + VRTrackedCameraError_FailedToGetGLTextureId = 111, + VRTrackedCameraError_SharedTextureFailure = 112, + VRTrackedCameraError_NoFrameAvailable = 113, + VRTrackedCameraError_InvalidArgument = 114, + VRTrackedCameraError_InvalidFrameBufferSize = 115, +}; + +enum EVRTrackedCameraFrameLayout +{ + EVRTrackedCameraFrameLayout_Mono = 0x0001, + EVRTrackedCameraFrameLayout_Stereo = 0x0002, + EVRTrackedCameraFrameLayout_VerticalLayout = 0x0010, // Stereo frames are Top/Bottom (left/right) + EVRTrackedCameraFrameLayout_HorizontalLayout = 0x0020, // Stereo frames are Left/Right +}; + +enum EVRTrackedCameraFrameType +{ + VRTrackedCameraFrameType_Distorted = 0, // This is the camera video frame size in pixels, still distorted. + VRTrackedCameraFrameType_Undistorted, // In pixels, an undistorted inscribed rectangle region without invalid regions. This size is subject to changes shortly. + VRTrackedCameraFrameType_MaximumUndistorted, // In pixels, maximum undistorted with invalid regions. Non zero alpha component identifies valid regions. + MAX_CAMERA_FRAME_TYPES +}; + +enum EVRDistortionFunctionType +{ + VRDistortionFunctionType_None, + VRDistortionFunctionType_FTheta, + VRDistortionFunctionType_Extended_FTheta, + MAX_DISTORTION_FUNCTION_TYPES, +}; + +static const uint32_t k_unMaxDistortionFunctionParameters = 8; + +typedef uint64_t TrackedCameraHandle_t; +#define INVALID_TRACKED_CAMERA_HANDLE ((vr::TrackedCameraHandle_t)0) + +struct CameraVideoStreamFrameHeader_t +{ + EVRTrackedCameraFrameType eFrameType; + + uint32_t nWidth; + uint32_t nHeight; + uint32_t nBytesPerPixel; + + uint32_t nFrameSequence; + + TrackedDevicePose_t trackedDevicePose; + + uint64_t ulFrameExposureTime; // mid-point of the exposure of the image in host system ticks +}; + +// Screenshot types +typedef uint32_t ScreenshotHandle_t; + +static const uint32_t k_unScreenshotHandleInvalid = 0; + +/** Compositor frame timing reprojection flags. */ +const uint32_t VRCompositor_ReprojectionReason_Cpu = 0x01; +const uint32_t VRCompositor_ReprojectionReason_Gpu = 0x02; +const uint32_t VRCompositor_ReprojectionAsync = 0x04; // This flag indicates the async reprojection mode is active, + // but does not indicate if reprojection actually happened or not. + // Use the ReprojectionReason flags above to check if reprojection + // was actually applied (i.e. scene texture was reused). + // NumFramePresents > 1 also indicates the scene texture was reused, + // and also the number of times that it was presented in total. + +const uint32_t VRCompositor_ReprojectionMotion = 0x08; // This flag indicates whether or not motion smoothing was triggered for this frame + +const uint32_t VRCompositor_PredictionMask = 0xF0; // The runtime may predict more than one frame (up to four) ahead if + // it detects the application is taking too long to render. These two + // bits will contain the count of additional frames (normally zero). + // Use the VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES macro to read from + // the latest frame timing entry. + +const uint32_t VRCompositor_ThrottleMask = 0xF00; // Number of frames the compositor is throttling the application. + // Use the VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES macro to read from + // the latest frame timing entry. + +#define VR_COMPOSITOR_ADDITIONAL_PREDICTED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_PredictionMask ) >> 4 ) +#define VR_COMPOSITOR_NUMBER_OF_THROTTLED_FRAMES( timing ) ( ( ( timing ).m_nReprojectionFlags & vr::VRCompositor_ThrottleMask ) >> 8 ) + +/** Provides a single frame's timing information to the app */ +struct Compositor_FrameTiming +{ + uint32_t m_nSize; // Set to sizeof( Compositor_FrameTiming ) + uint32_t m_nFrameIndex; + uint32_t m_nNumFramePresents; // number of times this frame was presented + uint32_t m_nNumMisPresented; // number of times this frame was presented on a vsync other than it was originally predicted to + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out + uint32_t m_nReprojectionFlags; + + /** Absolute time reference for comparing frames. This aligns with the vsync that running start is relative to. */ + double m_flSystemTimeInSeconds; + + /** These times may include work from other processes due to OS scheduling. + * The fewer packets of work these are broken up into, the less likely this will happen. + * GPU work can be broken up by calling Flush. This can sometimes be useful to get the GPU started + * processing that work earlier in the frame. */ + float m_flPreSubmitGpuMs; // time spent rendering the scene (gpu work submitted between WaitGetPoses and second Submit) + float m_flPostSubmitGpuMs; // additional time spent rendering by application (e.g. companion window) + float m_flTotalRenderGpuMs; // time between work submitted immediately after present (ideally vsync) until the end of compositor submitted work + float m_flCompositorRenderGpuMs; // time spend performing distortion correction, rendering chaperone, overlays, etc. + float m_flCompositorRenderCpuMs; // time spent on cpu submitting the above work for this frame + float m_flCompositorIdleCpuMs; // time spent waiting for running start (application could have used this much more time) + + /** Miscellaneous measured intervals. */ + float m_flClientFrameIntervalMs; // time between calls to WaitGetPoses + float m_flPresentCallCpuMs; // time blocked on call to present (usually 0.0, but can go long) + float m_flWaitForPresentCpuMs; // time spent spin-waiting for frame index to change (not near-zero indicates wait object failure) + float m_flSubmitFrameMs; // time spent in IVRCompositor::Submit (not near-zero indicates driver issue) + + /** The following are all relative to this frame's SystemTimeInSeconds */ + float m_flWaitGetPosesCalledMs; + float m_flNewPosesReadyMs; + float m_flNewFrameReadyMs; // second call to IVRCompositor::Submit + float m_flCompositorUpdateStartMs; + float m_flCompositorUpdateEndMs; + float m_flCompositorRenderStartMs; + + vr::TrackedDevicePose_t m_HmdPose; // pose used by app to render this frame + + uint32_t m_nNumVSyncsReadyForUse; + uint32_t m_nNumVSyncsToFirstView; +}; + +/** Provides compositor benchmark results to the app */ +struct Compositor_BenchmarkResults +{ + float m_flMegaPixelsPerSecond; // Measurement of GPU MP/s performed by compositor benchmark + float m_flHmdRecommendedMegaPixelsPerSecond; // Recommended default MP/s given the HMD resolution, refresh, and panel mask. +}; + +/** Frame timing data provided by direct mode drivers. */ +struct DriverDirectMode_FrameTiming +{ + uint32_t m_nSize; // Set to sizeof( DriverDirectMode_FrameTiming ) + uint32_t m_nNumFramePresents; // number of times frame was presented + uint32_t m_nNumMisPresented; // number of times frame was presented on a vsync other than it was originally predicted to + uint32_t m_nNumDroppedFrames; // number of additional times previous frame was scanned out (i.e. compositor missed vsync) + uint32_t m_nReprojectionFlags; +}; + +/** These flags will be set on DriverDirectMode_FrameTiming::m_nReprojectionFlags when IVRDriverDirectModeComponent::GetFrameTiming is called for drivers to optionally respond to. */ +const uint32_t VRCompositor_ReprojectionMotion_Enabled = 0x100; // Motion Smoothing is enabled in the UI for the currently running application +const uint32_t VRCompositor_ReprojectionMotion_ForcedOn = 0x200; // Motion Smoothing is forced on in the UI for the currently running application +const uint32_t VRCompositor_ReprojectionMotion_AppThrottled = 0x400; // Application is requesting throttling via ForceInterleavedReprojectionOn + + +enum EVSync +{ + VSync_None, + VSync_WaitRender, // block following render work until vsync + VSync_NoWaitRender, // do not block following render work (allow to get started early) +}; + +enum EVRMuraCorrectionMode +{ + EVRMuraCorrectionMode_Default = 0, + EVRMuraCorrectionMode_NoCorrection +}; + +/** raw IMU data provided by IVRIOBuffer from paths to tracked devices with IMUs */ +enum Imu_OffScaleFlags +{ + OffScale_AccelX = 0x01, + OffScale_AccelY = 0x02, + OffScale_AccelZ = 0x04, + OffScale_GyroX = 0x08, + OffScale_GyroY = 0x10, + OffScale_GyroZ = 0x20, +}; + +struct ImuSample_t +{ + double fSampleTime; + HmdVector3d_t vAccel; + HmdVector3d_t vGyro; + uint32_t unOffScaleFlags; +}; + +#pragma pack( pop ) + +// figure out how to import from the VR API dll +#if defined(_WIN32) + + #if !defined(OPENVR_BUILD_STATIC) + #ifdef VR_API_EXPORT + #define VR_INTERFACE extern "C" __declspec( dllexport ) + #else + #define VR_INTERFACE extern "C" __declspec( dllimport ) + #endif + #else + #define VR_INTERFACE extern "C" + #endif + +#elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__) + +#ifdef VR_API_EXPORT + #define VR_INTERFACE extern "C" __attribute__((visibility("default"))) +#else + #define VR_INTERFACE extern "C" +#endif + +#else + #error "Unsupported Platform." +#endif + + +#if defined( _WIN32 ) + #define VR_CALLTYPE __cdecl +#else + #define VR_CALLTYPE +#endif + +} // namespace vr +#endif // _INCLUDE_VRTYPES_H + +// vrannotation.h + +#ifdef API_GEN +# define VR_CLANG_ATTR(ATTR) __attribute__((annotate( ATTR ))) +#else +# define VR_CLANG_ATTR(ATTR) +#endif + +#define VR_METHOD_DESC(DESC) VR_CLANG_ATTR( "desc:" #DESC ";" ) +#define VR_IGNOREATTR() VR_CLANG_ATTR( "ignore" ) +#define VR_OUT_STRUCT() VR_CLANG_ATTR( "out_struct: ;" ) +#define VR_OUT_STRING() VR_CLANG_ATTR( "out_string: ;" ) +#define VR_OUT_ARRAY_CALL(COUNTER,FUNCTION,PARAMS) VR_CLANG_ATTR( "out_array_call:" #COUNTER "," #FUNCTION "," #PARAMS ";" ) +#define VR_OUT_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "out_array_count:" #COUNTER ";" ) +#define VR_ARRAY_COUNT(COUNTER) VR_CLANG_ATTR( "array_count:" #COUNTER ";" ) +#define VR_ARRAY_COUNT_D(COUNTER, DESC) VR_CLANG_ATTR( "array_count:" #COUNTER ";desc:" #DESC ) +#define VR_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "buffer_count:" #COUNTER ";" ) +#define VR_OUT_BUFFER_COUNT(COUNTER) VR_CLANG_ATTR( "out_buffer_count:" #COUNTER ";" ) +#define VR_OUT_STRING_COUNT(COUNTER) VR_CLANG_ATTR( "out_string_count:" #COUNTER ";" ) + +// vrtrackedcameratypes.h + +#ifndef _VRTRACKEDCAMERATYPES_H +#define _VRTRACKEDCAMERATYPES_H + +namespace vr +{ + +#pragma pack( push, 8 ) + +enum ECameraVideoStreamFormat +{ + CVS_FORMAT_UNKNOWN = 0, + CVS_FORMAT_RAW10 = 1, // 10 bits per pixel + CVS_FORMAT_NV12 = 2, // 12 bits per pixel + CVS_FORMAT_RGB24 = 3, // 24 bits per pixel + CVS_FORMAT_NV12_2 = 4, // 12 bits per pixel, 2x height + CVS_FORMAT_YUYV16 = 5, // 16 bits per pixel + CVS_FORMAT_BAYER16BG = 6, // 16 bits per pixel, 10-bit BG-format Bayer, see https://docs.opencv.org/3.1.0/de/d25/imgproc_color_conversions.html + CVS_FORMAT_MJPEG = 7, // variable-sized MJPEG Open DML format, see https://www.loc.gov/preservation/digital/formats/fdd/fdd000063.shtml + CVS_MAX_FORMATS +}; + +enum ECameraCompatibilityMode +{ + CAMERA_COMPAT_MODE_BULK_DEFAULT = 0, + CAMERA_COMPAT_MODE_BULK_64K_DMA = 1, + CAMERA_COMPAT_MODE_BULK_16K_DMA = 2, + CAMERA_COMPAT_MODE_BULK_8K_DMA = 3, + CAMERA_COMPAT_MODE_ISO_52FPS = 4, + CAMERA_COMPAT_MODE_ISO_50FPS = 5, + CAMERA_COMPAT_MODE_ISO_48FPS = 6, + CAMERA_COMPAT_MODE_ISO_46FPS = 7, + CAMERA_COMPAT_MODE_ISO_44FPS = 8, + CAMERA_COMPAT_MODE_ISO_42FPS = 9, + CAMERA_COMPAT_MODE_ISO_40FPS = 10, + CAMERA_COMPAT_MODE_ISO_35FPS = 11, + CAMERA_COMPAT_MODE_ISO_30FPS = 12, + CAMERA_COMPAT_MODE_ISO_15FPS = 13, + MAX_CAMERA_COMPAT_MODES +}; + +enum ECameraRoomViewStyle +{ + CAMERA_ROOMVIEW_STYLE_DEFAULT = 0, + CAMERA_ROOMVIEW_STYLE_EDGE_A = 1, + CAMERA_ROOMVIEW_STYLE_EDGE_B = 2, + CAMERA_ROOMVIEW_STYLE_VIDEO_TRANSLUSCENT = 3, + CAMERA_ROOMVIEW_STYLE_VIDEO_OPAQUE = 4, + CAMERA_ROOMVIEW_STYLE_COUNT = 5, +}; + +#ifdef _MSC_VER +#define VR_CAMERA_DECL_ALIGN( x ) __declspec( align( x ) ) +#else +#define VR_CAMERA_DECL_ALIGN( x ) // +#endif + +static const uint32_t k_unMaxCameras = 4; +static const uint32_t k_unMaxCameraFrameSharedHandles = 4; + +VR_CAMERA_DECL_ALIGN( 8 ) struct CameraVideoStreamFrame_t +{ + ECameraVideoStreamFormat m_nStreamFormat; + + uint32_t m_nWidth; + uint32_t m_nHeight; + + uint32_t m_nImageDataSize; // Based on stream format, width, height + + uint32_t m_nFrameSequence; // Starts from 0 when stream starts. + + uint32_t m_nBufferIndex; // Identifies which buffer the image data is hosted + uint32_t m_nBufferCount; // Total number of configured buffers + + uint32_t m_nExposureTime; + + uint32_t m_nISPFrameTimeStamp; // Driver provided time stamp per driver centric time base + uint32_t m_nISPReferenceTimeStamp; + uint32_t m_nSyncCounter; + + uint32_t m_nCamSyncEvents; + uint32_t m_nISPSyncEvents; + + double m_flReferenceCamSyncTime; + + double m_flFrameElapsedTime; // Starts from 0 when stream starts. In seconds. + double m_flFrameDeliveryRate; + + double m_flFrameCaptureTime_DriverAbsolute; // In USB time, via AuxEvent + double m_flFrameCaptureTime_ServerRelative; // In System time within the server + uint64_t m_nFrameCaptureTicks_ServerAbsolute; // In system ticks within the server + double m_flFrameCaptureTime_ClientRelative; // At the client, relative to when the frame was exposed/captured. + + double m_flSyncMarkerError; + + TrackedDevicePose_t m_RawTrackedDevicePose; // Raw-and-uncalibrated pose, supplied by HMD layer when used as a tracked camera + + uint64_t m_pImageData; +}; + +#pragma pack( pop ) + +} + +#endif // _VRTRACKEDCAMERATYPES_H + +// ivrsettings.h + +#include + +namespace vr +{ + enum EVRSettingsError + { + VRSettingsError_None = 0, + VRSettingsError_IPCFailed = 1, + VRSettingsError_WriteFailed = 2, + VRSettingsError_ReadFailed = 3, + VRSettingsError_JsonParseFailed = 4, + VRSettingsError_UnsetSettingHasNoDefault = 5, // This will be returned if the setting does not appear in the appropriate default file and has not been set + }; + + // The maximum length of a settings key + static const uint32_t k_unMaxSettingsKeyLength = 128; + + class IVRSettings + { + public: + virtual const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) = 0; + + virtual void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) = 0; + virtual void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) = 0; + + // Users of the system need to provide a proper default in default.vrsettings in the resources/settings/ directory + // of either the runtime or the driver_xxx directory. Otherwise the default will be false, 0, 0.0 or "" + virtual bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + virtual void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) = 0; + + virtual void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) = 0; + virtual void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) = 0; + }; + + //----------------------------------------------------------------------------- + static const char * const IVRSettings_Version = "IVRSettings_003"; + + class CVRSettingHelper + { + IVRSettings *m_pSettings; + public: + CVRSettingHelper( IVRSettings *pSettings ) + { + m_pSettings = pSettings; + } + + const char *GetSettingsErrorNameFromEnum( EVRSettingsError eError ) + { + return m_pSettings->GetSettingsErrorNameFromEnum( eError ); + } + + void SetBool( const char *pchSection, const char *pchSettingsKey, bool bValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetBool( pchSection, pchSettingsKey, bValue, peError ); + } + + void SetInt32( const char *pchSection, const char *pchSettingsKey, int32_t nValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetInt32( pchSection, pchSettingsKey, nValue, peError ); + } + void SetFloat( const char *pchSection, const char *pchSettingsKey, float flValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetFloat( pchSection, pchSettingsKey, flValue, peError ); + } + void SetString( const char *pchSection, const char *pchSettingsKey, const char *pchValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( pchSection, pchSettingsKey, pchValue, peError ); + } + void SetString( const std::string & sSection, const std::string & sSettingsKey, const std::string & sValue, EVRSettingsError *peError = nullptr ) + { + m_pSettings->SetString( sSection.c_str(), sSettingsKey.c_str(), sValue.c_str(), peError ); + } + + bool GetBool( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetBool( pchSection, pchSettingsKey, peError ); + } + int32_t GetInt32( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetInt32( pchSection, pchSettingsKey, peError ); + } + float GetFloat( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + return m_pSettings->GetFloat( pchSection, pchSettingsKey, peError ); + } + void GetString( const char *pchSection, const char *pchSettingsKey, VR_OUT_STRING() char *pchValue, uint32_t unValueLen, EVRSettingsError *peError = nullptr ) + { + m_pSettings->GetString( pchSection, pchSettingsKey, pchValue, unValueLen, peError ); + } + std::string GetString( const std::string & sSection, const std::string & sSettingsKey, EVRSettingsError *peError = nullptr ) + { + char buf[4096]; + vr::EVRSettingsError eError; + m_pSettings->GetString( sSection.c_str(), sSettingsKey.c_str(), buf, sizeof( buf ), &eError ); + if ( peError ) + *peError = eError; + if ( eError == vr::VRSettingsError_None ) + return buf; + else + return ""; + } + + void RemoveSection( const char *pchSection, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveSection( pchSection, peError ); + } + void RemoveKeyInSection( const char *pchSection, const char *pchSettingsKey, EVRSettingsError *peError = nullptr ) + { + m_pSettings->RemoveKeyInSection( pchSection, pchSettingsKey, peError ); + } + }; + + + //----------------------------------------------------------------------------- + // steamvr keys + static const char * const k_pch_SteamVR_Section = "steamvr"; + static const char * const k_pch_SteamVR_RequireHmd_String = "requireHmd"; + static const char * const k_pch_SteamVR_ForcedDriverKey_String = "forcedDriver"; + static const char * const k_pch_SteamVR_ForcedHmdKey_String = "forcedHmd"; + static const char * const k_pch_SteamVR_DisplayDebug_Bool = "displayDebug"; + static const char * const k_pch_SteamVR_DebugProcessPipe_String = "debugProcessPipe"; + static const char * const k_pch_SteamVR_DisplayDebugX_Int32 = "displayDebugX"; + static const char * const k_pch_SteamVR_DisplayDebugY_Int32 = "displayDebugY"; + static const char * const k_pch_SteamVR_SendSystemButtonToAllApps_Bool= "sendSystemButtonToAllApps"; + static const char * const k_pch_SteamVR_LogLevel_Int32 = "loglevel"; + static const char * const k_pch_SteamVR_IPD_Float = "ipd"; + static const char * const k_pch_SteamVR_Background_String = "background"; + static const char * const k_pch_SteamVR_BackgroundUseDomeProjection_Bool = "backgroundUseDomeProjection"; + static const char * const k_pch_SteamVR_BackgroundCameraHeight_Float = "backgroundCameraHeight"; + static const char * const k_pch_SteamVR_BackgroundDomeRadius_Float = "backgroundDomeRadius"; + static const char * const k_pch_SteamVR_GridColor_String = "gridColor"; + static const char * const k_pch_SteamVR_PlayAreaColor_String = "playAreaColor"; + static const char * const k_pch_SteamVR_TrackingLossColor_String = "trackingLossColor"; + static const char * const k_pch_SteamVR_ShowStage_Bool = "showStage"; + static const char * const k_pch_SteamVR_DrawTrackingReferences_Bool = "drawTrackingReferences"; + static const char * const k_pch_SteamVR_ActivateMultipleDrivers_Bool = "activateMultipleDrivers"; + static const char * const k_pch_SteamVR_UsingSpeakers_Bool = "usingSpeakers"; + static const char * const k_pch_SteamVR_SpeakersForwardYawOffsetDegrees_Float = "speakersForwardYawOffsetDegrees"; + static const char * const k_pch_SteamVR_BaseStationPowerManagement_Int32 = "basestationPowerManagement"; + static const char * const k_pch_SteamVR_ShowBaseStationPowerManagementTip_Int32 = "ShowBaseStationPowerManagementTip"; + static const char * const k_pch_SteamVR_NeverKillProcesses_Bool = "neverKillProcesses"; + static const char * const k_pch_SteamVR_SupersampleScale_Float = "supersampleScale"; + static const char * const k_pch_SteamVR_MaxRecommendedResolution_Int32 = "maxRecommendedResolution"; + static const char * const k_pch_SteamVR_MotionSmoothing_Bool = "motionSmoothing"; + static const char * const k_pch_SteamVR_MotionSmoothingOverride_Int32 = "motionSmoothingOverride"; + static const char * const k_pch_SteamVR_FramesToThrottle_Int32 = "framesToThrottle"; + static const char * const k_pch_SteamVR_AdditionalFramesToPredict_Int32 = "additionalFramesToPredict"; + static const char * const k_pch_SteamVR_DisableAsyncReprojection_Bool = "disableAsync"; + static const char * const k_pch_SteamVR_ForceFadeOnBadTracking_Bool = "forceFadeOnBadTracking"; + static const char * const k_pch_SteamVR_DefaultMirrorView_Int32 = "mirrorView"; + static const char * const k_pch_SteamVR_ShowLegacyMirrorView_Bool = "showLegacyMirrorView"; + static const char * const k_pch_SteamVR_MirrorViewVisibility_Bool = "showMirrorView"; + static const char * const k_pch_SteamVR_MirrorViewDisplayMode_Int32 = "mirrorViewDisplayMode"; + static const char * const k_pch_SteamVR_MirrorViewEye_Int32 = "mirrorViewEye"; + static const char * const k_pch_SteamVR_MirrorViewGeometry_String = "mirrorViewGeometry"; + static const char * const k_pch_SteamVR_MirrorViewGeometryMaximized_String = "mirrorViewGeometryMaximized"; + static const char * const k_pch_SteamVR_PerfGraphVisibility_Bool = "showPerfGraph"; + static const char * const k_pch_SteamVR_StartMonitorFromAppLaunch = "startMonitorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartCompositorFromAppLaunch_Bool = "startCompositorFromAppLaunch"; + static const char * const k_pch_SteamVR_StartDashboardFromAppLaunch_Bool = "startDashboardFromAppLaunch"; + static const char * const k_pch_SteamVR_StartOverlayAppsFromDashboard_Bool = "startOverlayAppsFromDashboard"; + static const char * const k_pch_SteamVR_EnableHomeApp = "enableHomeApp"; + static const char * const k_pch_SteamVR_CycleBackgroundImageTimeSec_Int32 = "CycleBackgroundImageTimeSec"; + static const char * const k_pch_SteamVR_RetailDemo_Bool = "retailDemo"; + static const char * const k_pch_SteamVR_IpdOffset_Float = "ipdOffset"; + static const char * const k_pch_SteamVR_AllowSupersampleFiltering_Bool = "allowSupersampleFiltering"; + static const char * const k_pch_SteamVR_SupersampleManualOverride_Bool = "supersampleManualOverride"; + static const char * const k_pch_SteamVR_EnableLinuxVulkanAsync_Bool = "enableLinuxVulkanAsync"; + static const char * const k_pch_SteamVR_AllowDisplayLockedMode_Bool = "allowDisplayLockedMode"; + static const char * const k_pch_SteamVR_HaveStartedTutorialForNativeChaperoneDriver_Bool = "haveStartedTutorialForNativeChaperoneDriver"; + static const char * const k_pch_SteamVR_ForceWindows32bitVRMonitor = "forceWindows32BitVRMonitor"; + static const char * const k_pch_SteamVR_DebugInputBinding = "debugInputBinding"; + static const char * const k_pch_SteamVR_DoNotFadeToGrid = "doNotFadeToGrid"; + static const char * const k_pch_SteamVR_RenderCameraMode = "renderCameraMode"; + static const char * const k_pch_SteamVR_EnableSharedResourceJournaling = "enableSharedResourceJournaling"; + static const char * const k_pch_SteamVR_EnableSafeMode = "enableSafeMode"; + static const char * const k_pch_SteamVR_PreferredRefreshRate = "preferredRefreshRate"; + static const char * const k_pch_SteamVR_LastVersionNotice = "lastVersionNotice"; + static const char * const k_pch_SteamVR_LastVersionNoticeDate = "lastVersionNoticeDate"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainR_Float = "hmdDisplayColorGainR"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainG_Float = "hmdDisplayColorGainG"; + static const char * const k_pch_SteamVR_HmdDisplayColorGainB_Float = "hmdDisplayColorGainB"; + static const char * const k_pch_SteamVR_CustomIconStyle_String = "customIconStyle"; + static const char * const k_pch_SteamVR_CustomOffIconStyle_String = "customOffIconStyle"; + static const char * const k_pch_SteamVR_CustomIconForceUpdate_String = "customIconForceUpdate"; + static const char * const k_pch_SteamVR_AllowGlobalActionSetPriority = "globalActionSetPriority"; + static const char * const k_pch_SteamVR_OverlayRenderQuality = "overlayRenderQuality_2"; + static const char * const k_pch_SteamVR_BlockOculusSDKOnOpenVRLaunchOption_Bool = "blockOculusSDKOnOpenVRLaunchOption"; + static const char * const k_pch_SteamVR_BlockOculusSDKOnAllLaunches_Bool = "blockOculusSDKOnAllLaunches"; + static const char * const k_pch_SteamVR_HDCPLegacyCompatibility_Bool = "hdcp14legacyCompatibility"; + static const char * const k_pch_SteamVR_UsePrism_Bool = "usePrism"; + + //----------------------------------------------------------------------------- + // direct mode keys + static const char * const k_pch_DirectMode_Section = "direct_mode"; + static const char * const k_pch_DirectMode_Enable_Bool = "enable"; + static const char * const k_pch_DirectMode_Count_Int32 = "count"; + static const char * const k_pch_DirectMode_EdidVid_Int32 = "edidVid"; + static const char * const k_pch_DirectMode_EdidPid_Int32 = "edidPid"; + + //----------------------------------------------------------------------------- + // lighthouse keys + static const char * const k_pch_Lighthouse_Section = "driver_lighthouse"; + static const char * const k_pch_Lighthouse_DisableIMU_Bool = "disableimu"; + static const char * const k_pch_Lighthouse_DisableIMUExceptHMD_Bool = "disableimuexcepthmd"; + static const char * const k_pch_Lighthouse_UseDisambiguation_String = "usedisambiguation"; + static const char * const k_pch_Lighthouse_DisambiguationDebug_Int32 = "disambiguationdebug"; + static const char * const k_pch_Lighthouse_PrimaryBasestation_Int32 = "primarybasestation"; + static const char * const k_pch_Lighthouse_DBHistory_Bool = "dbhistory"; + static const char * const k_pch_Lighthouse_EnableBluetooth_Bool = "enableBluetooth"; + static const char * const k_pch_Lighthouse_PowerManagedBaseStations_String = "PowerManagedBaseStations"; + static const char * const k_pch_Lighthouse_PowerManagedBaseStations2_String = "PowerManagedBaseStations2"; + static const char * const k_pch_Lighthouse_InactivityTimeoutForBaseStations_Int32 = "InactivityTimeoutForBaseStations"; + static const char * const k_pch_Lighthouse_EnableImuFallback_Bool = "enableImuFallback"; + + //----------------------------------------------------------------------------- + // null keys + static const char * const k_pch_Null_Section = "driver_null"; + static const char * const k_pch_Null_SerialNumber_String = "serialNumber"; + static const char * const k_pch_Null_ModelNumber_String = "modelNumber"; + static const char * const k_pch_Null_WindowX_Int32 = "windowX"; + static const char * const k_pch_Null_WindowY_Int32 = "windowY"; + static const char * const k_pch_Null_WindowWidth_Int32 = "windowWidth"; + static const char * const k_pch_Null_WindowHeight_Int32 = "windowHeight"; + static const char * const k_pch_Null_RenderWidth_Int32 = "renderWidth"; + static const char * const k_pch_Null_RenderHeight_Int32 = "renderHeight"; + static const char * const k_pch_Null_SecondsFromVsyncToPhotons_Float = "secondsFromVsyncToPhotons"; + static const char * const k_pch_Null_DisplayFrequency_Float = "displayFrequency"; + + //----------------------------------------------------------------------------- + // Windows MR keys + static const char * const k_pch_WindowsMR_Section = "driver_holographic"; + + //----------------------------------------------------------------------------- + // user interface keys + static const char * const k_pch_UserInterface_Section = "userinterface"; + static const char * const k_pch_UserInterface_StatusAlwaysOnTop_Bool = "StatusAlwaysOnTop"; + static const char * const k_pch_UserInterface_MinimizeToTray_Bool = "MinimizeToTray"; + static const char * const k_pch_UserInterface_HidePopupsWhenStatusMinimized_Bool = "HidePopupsWhenStatusMinimized"; + static const char * const k_pch_UserInterface_Screenshots_Bool = "screenshots"; + static const char * const k_pch_UserInterface_ScreenshotType_Int = "screenshotType"; + + //----------------------------------------------------------------------------- + // notification keys + static const char * const k_pch_Notifications_Section = "notifications"; + static const char * const k_pch_Notifications_DoNotDisturb_Bool = "DoNotDisturb"; + + //----------------------------------------------------------------------------- + // keyboard keys + static const char * const k_pch_Keyboard_Section = "keyboard"; + static const char * const k_pch_Keyboard_TutorialCompletions = "TutorialCompletions"; + static const char * const k_pch_Keyboard_ScaleX = "ScaleX"; + static const char * const k_pch_Keyboard_ScaleY = "ScaleY"; + static const char * const k_pch_Keyboard_OffsetLeftX = "OffsetLeftX"; + static const char * const k_pch_Keyboard_OffsetRightX = "OffsetRightX"; + static const char * const k_pch_Keyboard_OffsetY = "OffsetY"; + static const char * const k_pch_Keyboard_Smoothing = "Smoothing"; + + //----------------------------------------------------------------------------- + // perf keys + static const char * const k_pch_Perf_Section = "perfcheck"; + static const char * const k_pch_Perf_PerfGraphInHMD_Bool = "perfGraphInHMD"; + static const char * const k_pch_Perf_AllowTimingStore_Bool = "allowTimingStore"; + static const char * const k_pch_Perf_SaveTimingsOnExit_Bool = "saveTimingsOnExit"; + static const char * const k_pch_Perf_TestData_Float = "perfTestData"; + static const char * const k_pch_Perf_GPUProfiling_Bool = "GPUProfiling"; + + //----------------------------------------------------------------------------- + // collision bounds keys + static const char * const k_pch_CollisionBounds_Section = "collisionBounds"; + static const char * const k_pch_CollisionBounds_Style_Int32 = "CollisionBoundsStyle"; + static const char * const k_pch_CollisionBounds_GroundPerimeterOn_Bool = "CollisionBoundsGroundPerimeterOn"; + static const char * const k_pch_CollisionBounds_CenterMarkerOn_Bool = "CollisionBoundsCenterMarkerOn"; + static const char * const k_pch_CollisionBounds_PlaySpaceOn_Bool = "CollisionBoundsPlaySpaceOn"; + static const char * const k_pch_CollisionBounds_FadeDistance_Float = "CollisionBoundsFadeDistance"; + static const char * const k_pch_CollisionBounds_WallHeight_Float = "CollisionBoundsWallHeight"; + static const char * const k_pch_CollisionBounds_ColorGammaR_Int32 = "CollisionBoundsColorGammaR"; + static const char * const k_pch_CollisionBounds_ColorGammaG_Int32 = "CollisionBoundsColorGammaG"; + static const char * const k_pch_CollisionBounds_ColorGammaB_Int32 = "CollisionBoundsColorGammaB"; + static const char * const k_pch_CollisionBounds_ColorGammaA_Int32 = "CollisionBoundsColorGammaA"; + static const char * const k_pch_CollisionBounds_EnableDriverImport = "enableDriverBoundsImport"; + + //----------------------------------------------------------------------------- + // camera keys + static const char * const k_pch_Camera_Section = "camera"; + static const char * const k_pch_Camera_EnableCamera_Bool = "enableCamera"; + static const char * const k_pch_Camera_ShowOnController_Bool = "showOnController"; + static const char * const k_pch_Camera_EnableCameraForCollisionBounds_Bool = "enableCameraForCollisionBounds"; + static const char * const k_pch_Camera_RoomView_Int32 = "roomView"; + static const char * const k_pch_Camera_BoundsColorGammaR_Int32 = "cameraBoundsColorGammaR"; + static const char * const k_pch_Camera_BoundsColorGammaG_Int32 = "cameraBoundsColorGammaG"; + static const char * const k_pch_Camera_BoundsColorGammaB_Int32 = "cameraBoundsColorGammaB"; + static const char * const k_pch_Camera_BoundsColorGammaA_Int32 = "cameraBoundsColorGammaA"; + static const char * const k_pch_Camera_BoundsStrength_Int32 = "cameraBoundsStrength"; + static const char * const k_pch_Camera_RoomViewStyle_Int32 = "roomViewStyle"; + + //----------------------------------------------------------------------------- + // audio keys + static const char * const k_pch_audio_Section = "audio"; + static const char * const k_pch_audio_SetOsDefaultPlaybackDevice_Bool = "setOsDefaultPlaybackDevice"; + static const char * const k_pch_audio_EnablePlaybackDeviceOverride_Bool = "enablePlaybackDeviceOverride"; + static const char * const k_pch_audio_PlaybackDeviceOverride_String = "playbackDeviceOverride"; + static const char * const k_pch_audio_PlaybackDeviceOverrideName_String = "playbackDeviceOverrideName"; + static const char * const k_pch_audio_SetOsDefaultRecordingDevice_Bool = "setOsDefaultRecordingDevice"; + static const char * const k_pch_audio_EnableRecordingDeviceOverride_Bool = "enableRecordingDeviceOverride"; + static const char * const k_pch_audio_RecordingDeviceOverride_String = "recordingDeviceOverride"; + static const char * const k_pch_audio_RecordingDeviceOverrideName_String = "recordingDeviceOverrideName"; + static const char * const k_pch_audio_EnablePlaybackMirror_Bool = "enablePlaybackMirror"; + static const char * const k_pch_audio_PlaybackMirrorDevice_String = "playbackMirrorDevice"; + static const char * const k_pch_audio_PlaybackMirrorDeviceName_String = "playbackMirrorDeviceName"; + static const char * const k_pch_audio_OldPlaybackMirrorDevice_String = "onPlaybackMirrorDevice"; + static const char * const k_pch_audio_ActiveMirrorDevice_String = "activePlaybackMirrorDevice"; + static const char * const k_pch_audio_EnablePlaybackMirrorIndependentVolume_Bool = "enablePlaybackMirrorIndependentVolume"; + static const char * const k_pch_audio_LastHmdPlaybackDeviceId_String = "lastHmdPlaybackDeviceId"; + static const char * const k_pch_audio_VIVEHDMIGain = "viveHDMIGain"; + static const char * const k_pch_audio_DualSpeakerAndJackOutput_Bool = "dualSpeakerAndJackOutput"; + static const char * const k_pch_audio_MuteMicMonitor_Bool = "muteMicMonitor"; + + //----------------------------------------------------------------------------- + // power management keys + static const char * const k_pch_Power_Section = "power"; + static const char * const k_pch_Power_PowerOffOnExit_Bool = "powerOffOnExit"; + static const char * const k_pch_Power_TurnOffScreensTimeout_Float = "turnOffScreensTimeout"; + static const char * const k_pch_Power_TurnOffControllersTimeout_Float = "turnOffControllersTimeout"; + static const char * const k_pch_Power_ReturnToWatchdogTimeout_Float = "returnToWatchdogTimeout"; + static const char * const k_pch_Power_AutoLaunchSteamVROnButtonPress = "autoLaunchSteamVROnButtonPress"; + static const char * const k_pch_Power_PauseCompositorOnStandby_Bool = "pauseCompositorOnStandby"; + + //----------------------------------------------------------------------------- + // dashboard keys + static const char * const k_pch_Dashboard_Section = "dashboard"; + static const char * const k_pch_Dashboard_EnableDashboard_Bool = "enableDashboard"; + static const char * const k_pch_Dashboard_ArcadeMode_Bool = "arcadeMode"; + static const char * const k_pch_Dashboard_Position = "position"; + static const char * const k_pch_Dashboard_DesktopScale = "desktopScale"; + static const char * const k_pch_Dashboard_DashboardScale = "dashboardScale"; + static const char * const k_pch_Dashboard_UseStandaloneSystemLayer = "standaloneSystemLayer"; + + //----------------------------------------------------------------------------- + // model skin keys + static const char * const k_pch_modelskin_Section = "modelskins"; + + //----------------------------------------------------------------------------- + // driver keys - These could be checked in any driver_ section + static const char * const k_pch_Driver_Enable_Bool = "enable"; + static const char * const k_pch_Driver_BlockedBySafemode_Bool = "blocked_by_safe_mode"; + static const char * const k_pch_Driver_LoadPriority_Int32 = "loadPriority"; + + //----------------------------------------------------------------------------- + // web interface keys + static const char* const k_pch_WebInterface_Section = "WebInterface"; + + //----------------------------------------------------------------------------- + // vrwebhelper keys + static const char* const k_pch_VRWebHelper_Section = "VRWebHelper"; + static const char* const k_pch_VRWebHelper_DebuggerEnabled_Bool = "DebuggerEnabled"; + static const char* const k_pch_VRWebHelper_DebuggerPort_Int32 = "DebuggerPort"; + + //----------------------------------------------------------------------------- + // tracking overrides - keys are device paths, values are the device paths their + // tracking/pose information overrides + static const char* const k_pch_TrackingOverride_Section = "TrackingOverrides"; + + //----------------------------------------------------------------------------- + // per-app keys - the section name for these is the app key itself. Some of these are prefixed by the controller type + static const char* const k_pch_App_BindingAutosaveURLSuffix_String = "AutosaveURL"; + static const char* const k_pch_App_BindingLegacyAPISuffix_String = "_legacy"; + static const char* const k_pch_App_BindingSteamVRInputAPISuffix_String = "_steamvrinput"; + static const char* const k_pch_App_BindingCurrentURLSuffix_String = "CurrentURL"; + static const char* const k_pch_App_BindingPreviousURLSuffix_String = "PreviousURL"; + static const char* const k_pch_App_NeedToUpdateAutosaveSuffix_Bool = "NeedToUpdateAutosave"; + static const char* const k_pch_App_DominantHand_Int32 = "DominantHand"; + static const char* const k_pch_App_BlockOculusSDK_Bool = "blockOculusSDK"; + + //----------------------------------------------------------------------------- + // configuration for trackers + static const char * const k_pch_Trackers_Section = "trackers"; + + //----------------------------------------------------------------------------- + // configuration for desktop UI windows + static const char * const k_pch_DesktopUI_Section = "DesktopUI"; + + //----------------------------------------------------------------------------- + // Last known keys for righting recovery + static const char * const k_pch_LastKnown_Section = "LastKnown"; + static const char* const k_pch_LastKnown_HMDManufacturer_String = "HMDManufacturer"; + static const char* const k_pch_LastKnown_HMDModel_String = "HMDModel"; + + //----------------------------------------------------------------------------- + // Dismissed warnings + static const char * const k_pch_DismissedWarnings_Section = "DismissedWarnings"; + + //----------------------------------------------------------------------------- + // Input Settings + static const char * const k_pch_Input_Section = "input"; + static const char* const k_pch_Input_LeftThumbstickRotation_Float = "leftThumbstickRotation"; + static const char* const k_pch_Input_RightThumbstickRotation_Float = "rightThumbstickRotation"; + static const char* const k_pch_Input_ThumbstickDeadzone_Float = "thumbstickDeadzone"; + + //----------------------------------------------------------------------------- + // Log of GPU performance + static const char * const k_pch_GpuSpeed_Section = "GpuSpeed"; + +} // namespace vr + +// iservertrackeddevicedriver.h + +namespace vr +{ + + +struct DriverPoseQuaternion_t +{ + double w, x, y, z; +}; + +struct DriverPose_t +{ + /* Time offset of this pose, in seconds from the actual time of the pose, + * relative to the time of the PoseUpdated() call made by the driver. + */ + double poseTimeOffset; + + /* Generally, the pose maintained by a driver + * is in an inertial coordinate system different + * from the world system of x+ right, y+ up, z+ back. + * Also, the driver is not usually tracking the "head" position, + * but instead an internal IMU or another reference point in the HMD. + * The following two transforms transform positions and orientations + * to app world space from driver world space, + * and to HMD head space from driver local body space. + * + * We maintain the driver pose state in its internal coordinate system, + * so we can do the pose prediction math without having to + * use angular acceleration. A driver's angular acceleration is generally not measured, + * and is instead calculated from successive samples of angular velocity. + * This leads to a noisy angular acceleration values, which are also + * lagged due to the filtering required to reduce noise to an acceptable level. + */ + vr::HmdQuaternion_t qWorldFromDriverRotation; + double vecWorldFromDriverTranslation[ 3 ]; + + vr::HmdQuaternion_t qDriverFromHeadRotation; + double vecDriverFromHeadTranslation[ 3 ]; + + /* State of driver pose, in meters and radians. */ + /* Position of the driver tracking reference in driver world space + * +[0] (x) is right + * +[1] (y) is up + * -[2] (z) is forward + */ + double vecPosition[ 3 ]; + + /* Velocity of the pose in meters/second */ + double vecVelocity[ 3 ]; + + /* Acceleration of the pose in meters/second */ + double vecAcceleration[ 3 ]; + + /* Orientation of the tracker, represented as a quaternion */ + vr::HmdQuaternion_t qRotation; + + /* Angular velocity of the pose in axis-angle + * representation. The direction is the angle of + * rotation and the magnitude is the angle around + * that axis in radians/second. */ + double vecAngularVelocity[ 3 ]; + + /* Angular acceleration of the pose in axis-angle + * representation. The direction is the angle of + * rotation and the magnitude is the angle around + * that axis in radians/second^2. */ + double vecAngularAcceleration[ 3 ]; + + ETrackingResult result; + + bool poseIsValid; + bool willDriftInYaw; + bool shouldApplyHeadModel; + bool deviceIsConnected; +}; + + +// ---------------------------------------------------------------------------------------------- +// Purpose: Represents a single tracked device in a driver +// ---------------------------------------------------------------------------------------------- +class ITrackedDeviceServerDriver +{ +public: + + // ------------------------------------ + // Management Methods + // ------------------------------------ + /** This is called before an HMD is returned to the application. It will always be + * called before any display or tracking methods. Memory and processor use by the + * ITrackedDeviceServerDriver object should be kept to a minimum until it is activated. + * The pose listener is guaranteed to be valid until Deactivate is called, but + * should not be used after that point. */ + virtual EVRInitError Activate( uint32_t unObjectId ) = 0; + + /** This is called when The VR system is switching from this Hmd being the active display + * to another Hmd being the active display. The driver should clean whatever memory + * and thread use it can when it is deactivated */ + virtual void Deactivate() = 0; + + /** Handles a request from the system to put this device into standby mode. What that means is defined per-device. */ + virtual void EnterStandby() = 0; + + /** Requests a component interface of the driver for device-specific functionality. The driver should return NULL + * if the requested interface or version is not supported. */ + virtual void *GetComponent( const char *pchComponentNameAndVersion ) = 0; + + /** A VR Client has made this debug request of the driver. The set of valid requests is entirely + * up to the driver and the client to figure out, as is the format of the response. Responses that + * exceed the length of the supplied buffer should be truncated and null terminated */ + virtual void DebugRequest( const char *pchRequest, char *pchResponseBuffer, uint32_t unResponseBufferSize ) = 0; + + // ------------------------------------ + // Tracking Methods + // ------------------------------------ + virtual DriverPose_t GetPose() = 0; +}; + + + +static const char *ITrackedDeviceServerDriver_Version = "ITrackedDeviceServerDriver_005"; + +} + +// ivrdisplaycomponent.h + +namespace vr +{ + + + // ---------------------------------------------------------------------------------------------- + // Purpose: The display component on a single tracked device + // ---------------------------------------------------------------------------------------------- + class IVRDisplayComponent + { + public: + + // ------------------------------------ + // Display Methods + // ------------------------------------ + + /** Size and position that the window needs to be on the VR display. */ + virtual void GetWindowBounds( int32_t *pnX, int32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Returns true if the display is extending the desktop. */ + virtual bool IsDisplayOnDesktop( ) = 0; + + /** Returns true if the display is real and not a fictional display. */ + virtual bool IsDisplayRealDisplay( ) = 0; + + /** Suggested size for the intermediate render target that the distortion pulls from. */ + virtual void GetRecommendedRenderTargetSize( uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** Gets the viewport in the frame buffer to draw the output of the distortion into */ + virtual void GetEyeOutputViewport( EVREye eEye, uint32_t *pnX, uint32_t *pnY, uint32_t *pnWidth, uint32_t *pnHeight ) = 0; + + /** The components necessary to build your own projection matrix in case your + * application is doing something fancy like infinite Z */ + virtual void GetProjectionRaw( EVREye eEye, float *pfLeft, float *pfRight, float *pfTop, float *pfBottom ) = 0; + + /** Returns the result of the distortion function for the specified eye and input UVs. UVs go from 0,0 in + * the upper left of that eye's viewport and 1,1 in the lower right of that eye's viewport. */ + virtual DistortionCoordinates_t ComputeDistortion( EVREye eEye, float fU, float fV ) = 0; + + }; + + static const char *IVRDisplayComponent_Version = "IVRDisplayComponent_002"; + +} + +// ivrdriverdirectmodecomponent.h + +namespace vr +{ + enum VRSwapTextureFlag + { + // Specify that the shared texture resource was created with the SHARED_NTHANDLE option (Windows) + VRSwapTextureFlag_Shared_NTHandle = 1 << 0, + }; + + // ---------------------------------------------------------------------------------------------- + // Purpose: This component is used for drivers that implement direct mode entirely on their own + // without allowing the VR Compositor to own the window/device. + // ---------------------------------------------------------------------------------------------- + class IVRDriverDirectModeComponent + { + public: + + // ----------------------------------- + // Direct mode methods + // ----------------------------------- + + struct SwapTextureSetDesc_t + { + uint32_t nWidth; + uint32_t nHeight; + uint32_t nFormat; + uint32_t nSampleCount; + }; + + struct SwapTextureSet_t + { + vr::SharedTextureHandle_t rSharedTextureHandles[ 3 ]; + uint32_t unTextureFlags; + }; + + /** Called to allocate textures for applications to render into. One of these per eye will be passed back to SubmitLayer each frame. */ + virtual void CreateSwapTextureSet( uint32_t unPid, const SwapTextureSetDesc_t *pSwapTextureSetDesc, SwapTextureSet_t *pOutSwapTextureSet ) {} + + /** Used to textures created using CreateSwapTextureSet. Only one of the set's handles needs to be used to destroy the entire set. */ + virtual void DestroySwapTextureSet( vr::SharedTextureHandle_t sharedTextureHandle ) {} + + /** Used to purge all texture sets for a given process. */ + virtual void DestroyAllSwapTextureSets( uint32_t unPid ) {} + + /** After Present returns, calls this to get the next index to use for rendering. */ + virtual void GetNextSwapTextureSetIndex( vr::SharedTextureHandle_t sharedTextureHandles[ 2 ], uint32_t( *pIndices )[ 2 ] ) {} + + /** Call once per layer to draw for this frame. One shared texture handle per eye. Textures must be created + * using CreateSwapTextureSet and should be alternated per frame. Call Present once all layers have been submitted. */ + struct SubmitLayerPerEye_t + { + // Shared texture handles (depth not always provided). + vr::SharedTextureHandle_t hTexture, hDepthTexture; + + // Valid region of provided texture (and depth). + vr::VRTextureBounds_t bounds; + + // Projection matrix used to render the depth buffer. + vr::HmdMatrix44_t mProjection; + + // Hmd pose used to render this layer. + vr::HmdMatrix34_t mHmdPose; + }; + virtual void SubmitLayer( const SubmitLayerPerEye_t( &perEye )[ 2 ] ) {} + + /** Submits queued layers for display. */ + virtual void Present( vr::SharedTextureHandle_t syncTexture ) {} + + /** Called after Present to allow driver to take more time until vsync after they've successfully acquired the sync texture in Present.*/ + virtual void PostPresent() {} + + /** Called to get additional frame timing stats from driver. Check m_nSize for versioning (new members will be added to end only). */ + virtual void GetFrameTiming( DriverDirectMode_FrameTiming *pFrameTiming ) {} + }; + + static const char *IVRDriverDirectModeComponent_Version = "IVRDriverDirectModeComponent_007"; + +} + +// ivrcameracomponent.h + +namespace vr +{ + //----------------------------------------------------------------------------- + //----------------------------------------------------------------------------- + class ICameraVideoSinkCallback + { + public: + virtual void OnCameraVideoSinkCallback() = 0; + }; + + // ---------------------------------------------------------------------------------------------- + // Purpose: The camera on a single tracked device + // ---------------------------------------------------------------------------------------------- + class IVRCameraComponent + { + public: + // ------------------------------------ + // Camera Methods + // ------------------------------------ + virtual bool GetCameraFrameDimensions( vr::ECameraVideoStreamFormat nVideoStreamFormat, uint32_t *pWidth, uint32_t *pHeight ) = 0; + virtual bool GetCameraFrameBufferingRequirements( int *pDefaultFrameQueueSize, uint32_t *pFrameBufferDataSize ) = 0; + virtual bool SetCameraFrameBuffering( int nFrameBufferCount, void **ppFrameBuffers, uint32_t nFrameBufferDataSize ) = 0; + virtual bool SetCameraVideoStreamFormat( vr::ECameraVideoStreamFormat nVideoStreamFormat ) = 0; + virtual vr::ECameraVideoStreamFormat GetCameraVideoStreamFormat() = 0; + virtual bool StartVideoStream() = 0; + virtual void StopVideoStream() = 0; + virtual bool IsVideoStreamActive( bool *pbPaused, float *pflElapsedTime ) = 0; + virtual const vr::CameraVideoStreamFrame_t *GetVideoStreamFrame() = 0; + virtual void ReleaseVideoStreamFrame( const vr::CameraVideoStreamFrame_t *pFrameImage ) = 0; + virtual bool SetAutoExposure( bool bEnable ) = 0; + virtual bool PauseVideoStream() = 0; + virtual bool ResumeVideoStream() = 0; + virtual bool GetCameraDistortion( uint32_t nCameraIndex, float flInputU, float flInputV, float *pflOutputU, float *pflOutputV ) = 0; + virtual bool GetCameraProjection( uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, float flZNear, float flZFar, vr::HmdMatrix44_t *pProjection ) = 0; + virtual bool SetFrameRate( int nISPFrameRate, int nSensorFrameRate ) = 0; + virtual bool SetCameraVideoSinkCallback( vr::ICameraVideoSinkCallback *pCameraVideoSinkCallback ) = 0; + virtual bool GetCameraCompatibilityMode( vr::ECameraCompatibilityMode *pCameraCompatibilityMode ) = 0; + virtual bool SetCameraCompatibilityMode( vr::ECameraCompatibilityMode nCameraCompatibilityMode ) = 0; + virtual bool GetCameraFrameBounds( vr::EVRTrackedCameraFrameType eFrameType, uint32_t *pLeft, uint32_t *pTop, uint32_t *pWidth, uint32_t *pHeight ) = 0; + virtual bool GetCameraIntrinsics( uint32_t nCameraIndex, vr::EVRTrackedCameraFrameType eFrameType, HmdVector2_t *pFocalLength, HmdVector2_t *pCenter, vr::EVRDistortionFunctionType *peDistortionType, double rCoefficients[ k_unMaxDistortionFunctionParameters ] ) = 0; + }; + + static const char *IVRCameraComponent_Version = "IVRCameraComponent_003"; +} + +// itrackeddevicedriverprovider.h + +namespace vr +{ + +class ITrackedDeviceServerDriver; +struct TrackedDeviceDriverInfo_t; +struct DriverPose_t; + +/** This interface is provided by vrserver to allow the driver to notify +* the system when something changes about a device. These changes must +* not change the serial number or class of the device because those values +* are permanently associated with the device's index. */ +class IVRDriverContext +{ +public: + /** Returns the requested interface. If the interface was not available it will return NULL and fill + * out the error. */ + virtual void *GetGenericInterface( const char *pchInterfaceVersion, EVRInitError *peError = nullptr ) = 0; + + /** Returns the property container handle for this driver */ + virtual DriverHandle_t GetDriverHandle() = 0; +}; + + +/** This interface must be implemented in each driver. It will be loaded in vrserver.exe */ +class IServerTrackedDeviceProvider +{ +public: + /** initializes the driver. This will be called before any other methods are called. + * If Init returns anything other than VRInitError_None the driver DLL will be unloaded. + * + * pDriverHost will never be NULL, and will always be a pointer to a IServerDriverHost interface + * + * pchUserDriverConfigDir - The absolute path of the directory where the driver should store user + * config files. + * pchDriverInstallDir - The absolute path of the root directory for the driver. + */ + virtual EVRInitError Init( IVRDriverContext *pDriverContext ) = 0; + + /** cleans up the driver right before it is unloaded */ + virtual void Cleanup() = 0; + + /** Returns the version of the ITrackedDeviceServerDriver interface used by this driver */ + virtual const char * const *GetInterfaceVersions() = 0; + + /** Allows the driver do to some work in the main loop of the server. */ + virtual void RunFrame() = 0; + + + // ------------ Power State Functions ----------------------- // + + /** Returns true if the driver wants to block Standby mode. */ + virtual bool ShouldBlockStandbyMode() = 0; + + /** Called when the system is entering Standby mode. The driver should switch itself into whatever sort of low-power + * state it has. */ + virtual void EnterStandby() = 0; + + /** Called when the system is leaving Standby mode. The driver should switch itself back to + full operation. */ + virtual void LeaveStandby() = 0; + +}; + + +static const char *IServerTrackedDeviceProvider_Version = "IServerTrackedDeviceProvider_004"; + + + + +/** This interface must be implemented in each driver. It will be loaded in vrclient.dll */ +class IVRWatchdogProvider +{ +public: + /** initializes the driver in watchdog mode. */ + virtual EVRInitError Init( IVRDriverContext *pDriverContext ) = 0; + + /** cleans up the driver right before it is unloaded */ + virtual void Cleanup() = 0; +}; + +static const char *IVRWatchdogProvider_Version = "IVRWatchdogProvider_001"; + + + + +/** This is an optional interface drivers may implement. It will be loaded in vrcompositor.exe */ +class IVRCompositorPluginProvider +{ +public: + /** initializes the driver when used to load compositor plugins */ + virtual EVRInitError Init( IVRDriverContext *pDriverContext ) = 0; + + /** cleans up the driver right before it is unloaded */ + virtual void Cleanup() = 0; + + /** Returns the versions of interfaces used by this driver */ + virtual const char * const *GetInterfaceVersions() = 0; + + /** Requests a component interface of the driver for specific functionality. The driver should return NULL + * if the requested interface or version is not supported. */ + virtual void *GetComponent( const char *pchComponentNameAndVersion ) = 0; +}; + +static const char *IVRCompositorPluginProvider_Version = "IVRCompositorPluginProvider_001"; + +} + +// ivrproperties.h + +#include +#include + +namespace vr +{ + + /** This container is automatically created before a display redirect device is activated. + * Any properties in this container will be returned when that property is read from the HMD's + * property container. */ + static const PropertyContainerHandle_t k_ulDisplayRedirectContainer = 0x600000003; + + enum EPropertyWriteType + { + PropertyWrite_Set = 0, + PropertyWrite_Erase = 1, + PropertyWrite_SetError = 2 + }; + + struct PropertyWrite_t + { + ETrackedDeviceProperty prop; + EPropertyWriteType writeType; + ETrackedPropertyError eSetError; + void *pvBuffer; + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + ETrackedPropertyError eError; + }; + + struct PropertyRead_t + { + ETrackedDeviceProperty prop; + void *pvBuffer; + uint32_t unBufferSize; + PropertyTypeTag_t unTag; + uint32_t unRequiredBufferSize; + ETrackedPropertyError eError; + }; + + +class IVRProperties +{ +public: + + /** Reads a set of properties atomically. See the PropertyReadBatch_t struct for more information. */ + virtual ETrackedPropertyError ReadPropertyBatch( PropertyContainerHandle_t ulContainerHandle, PropertyRead_t *pBatch, uint32_t unBatchEntryCount ) = 0; + + /** Writes a set of properties atomically. See the PropertyWriteBatch_t struct for more information. */ + virtual ETrackedPropertyError WritePropertyBatch( PropertyContainerHandle_t ulContainerHandle, PropertyWrite_t *pBatch, uint32_t unBatchEntryCount ) = 0; + + /** returns a string that corresponds with the specified property error. The string will be the name + * of the error enum value for all valid error codes */ + virtual const char *GetPropErrorNameFromEnum( ETrackedPropertyError error ) = 0; + + /** Returns a container handle given a tracked device index */ + virtual PropertyContainerHandle_t TrackedDeviceToPropertyContainer( TrackedDeviceIndex_t nDevice ) = 0; +}; + +static const char * const IVRProperties_Version = "IVRProperties_001"; + +class CVRPropertyHelpers +{ +public: + CVRPropertyHelpers( IVRProperties * pProperties ) : m_pProperties( pProperties ) {} + + /** Returns a scaler property. If the device index is not valid or the property value type does not match, + * this function will return false. */ + bool GetBoolProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + float GetFloatProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + int32_t GetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + uint64_t GetUint64Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + HmdVector2_t GetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + HmdVector3_t GetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + HmdVector4_t GetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + double GetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError = 0L ); + + /** Returns a single typed property. If the device index is not valid or the property is not a string type this function will + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ + uint32_t GetProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, VR_OUT_STRING() void *pvBuffer, uint32_t unBufferSize, PropertyTypeTag_t *punTag, ETrackedPropertyError *pError = 0L ); + + + /** Returns a string property. If the device index is not valid or the property is not a string type this function will + * return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing + * null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ + uint32_t GetStringProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError = 0L ); + + /** Returns a string property as a std::string. If the device index is not valid or the property is not a string type this function will + * return an empty string. */ + std::string GetStringProperty( vr::PropertyContainerHandle_t ulContainer, vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError *peError = nullptr ); + + /** Reads a std::vector of data from a property. */ + template< typename T> + ETrackedPropertyError GetPropertyVector( PropertyContainerHandle_t ulContainer, ETrackedDeviceProperty prop, PropertyTypeTag_t unExpectedTag, std::vector *pvecResults ); + + /** Sets a scaler property. The new value will be returned on any subsequent call to get this property in any process. */ + ETrackedPropertyError SetBoolProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, bool bNewValue ); + ETrackedPropertyError SetFloatProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, float fNewValue ); + ETrackedPropertyError SetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, int32_t nNewValue ); + ETrackedPropertyError SetUint64Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, uint64_t ulNewValue ); + ETrackedPropertyError SetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector2_t & vNewValue ); + ETrackedPropertyError SetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector3_t & vNewValue ); + ETrackedPropertyError SetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector4_t & vNewValue ); + ETrackedPropertyError SetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, double vNewValue ); + + /** Sets a string property. The new value will be returned on any subsequent call to get this property in any process. */ + ETrackedPropertyError SetStringProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const char *pchNewValue ); + + /** Sets a single typed property. The new value will be returned on any subsequent call to get this property in any process. */ + ETrackedPropertyError SetProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, void *pvNewValue, uint32_t unNewValueSize, PropertyTypeTag_t unTag ); + + /** Sets the error return value for a property. This value will be returned on all subsequent requests to get the property */ + ETrackedPropertyError SetPropertyError( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError eError ); + + /** Clears any value or error set for the property. */ + ETrackedPropertyError EraseProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop ); + + /* Turns a device index into a property container handle. */ + PropertyContainerHandle_t TrackedDeviceToPropertyContainer( TrackedDeviceIndex_t nDevice ) { return m_pProperties->TrackedDeviceToPropertyContainer( nDevice ); } + + /** Sets a std::vector of typed data to a property. */ + template< typename T> + ETrackedPropertyError SetPropertyVector( PropertyContainerHandle_t ulContainer, ETrackedDeviceProperty prop, PropertyTypeTag_t unExpectedTag, std::vector *vecProperties ); + + /** Returns true if the specified property is set on the specified container */ + bool IsPropertySet( PropertyContainerHandle_t ulContainer, ETrackedDeviceProperty prop, ETrackedPropertyError *peError = nullptr ); +private: + template + T GetPropertyHelper( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError, T bDefault, PropertyTypeTag_t unTypeTag ); + + IVRProperties *m_pProperties; +}; + + +inline uint32_t CVRPropertyHelpers::GetProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, VR_OUT_STRING() void *pvBuffer, uint32_t unBufferSize, PropertyTypeTag_t *punTag, ETrackedPropertyError *pError ) +{ + PropertyRead_t batch; + batch.prop = prop; + batch.pvBuffer = pvBuffer; + batch.unBufferSize = unBufferSize; + + m_pProperties->ReadPropertyBatch( ulContainerHandle, &batch, 1 ); + + if ( pError ) + { + *pError = batch.eError; + } + + if ( punTag ) + { + *punTag = batch.unTag; + } + + return batch.unRequiredBufferSize; +} + + +/** Sets a single typed property. The new value will be returned on any subsequent call to get this property in any process. */ +inline ETrackedPropertyError CVRPropertyHelpers::SetProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, void *pvNewValue, uint32_t unNewValueSize, PropertyTypeTag_t unTag ) +{ + PropertyWrite_t batch; + batch.writeType = PropertyWrite_Set; + batch.prop = prop; + batch.pvBuffer = pvNewValue; + batch.unBufferSize = unNewValueSize; + batch.unTag = unTag; + + m_pProperties->WritePropertyBatch( ulContainerHandle, &batch, 1 ); + + return batch.eError; +} + + +/** Returns a string property. If the device index is not valid or the property is not a string type this function will +* return 0. Otherwise it returns the length of the number of bytes necessary to hold this string including the trailing +* null. Strings will always fit in buffers of k_unMaxPropertyStringSize characters. */ +inline uint32_t CVRPropertyHelpers::GetStringProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize, ETrackedPropertyError *pError ) +{ + PropertyTypeTag_t unTag; + ETrackedPropertyError error; + uint32_t unRequiredSize = GetProperty( ulContainerHandle, prop, pchValue, unBufferSize, &unTag, &error ); + if ( unTag != k_unStringPropertyTag && error == TrackedProp_Success ) + { + error = TrackedProp_WrongDataType; + } + + if ( pError ) + { + *pError = error; + } + + if ( error != TrackedProp_Success ) + { + if ( pchValue && unBufferSize ) + { + *pchValue = '\0'; + } + } + + return unRequiredSize; +} + + +/** Returns a string property as a std::string. If the device index is not valid or the property is not a string type this function will +* return an empty string. */ +inline std::string CVRPropertyHelpers::GetStringProperty( vr::PropertyContainerHandle_t ulContainer, vr::ETrackedDeviceProperty prop, vr::ETrackedPropertyError *peError ) +{ + char buf[1024]; + vr::ETrackedPropertyError err; + uint32_t unRequiredBufferLen = GetStringProperty( ulContainer, prop, buf, sizeof(buf), &err ); + + std::string sResult; + + if ( err == TrackedProp_Success ) + { + sResult = buf; + } + else if ( err == TrackedProp_BufferTooSmall ) + { + char *pchBuffer = new char[unRequiredBufferLen]; + unRequiredBufferLen = GetStringProperty( ulContainer, prop, pchBuffer, unRequiredBufferLen, &err ); + sResult = pchBuffer; + delete[] pchBuffer; + } + + if ( peError ) + { + *peError = err; + } + + return sResult; +} + + +/** Sets a string property. The new value will be returned on any subsequent call to get this property in any process. */ +inline ETrackedPropertyError CVRPropertyHelpers::SetStringProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const char *pchNewValue ) +{ + if ( !pchNewValue ) + return TrackedProp_InvalidOperation; + + // this is strlen without the dependency on string.h + const char *pchCurr = pchNewValue; + while ( *pchCurr ) + { + pchCurr++; + } + + return SetProperty( ulContainerHandle, prop, (void *)pchNewValue, (uint32_t)(pchCurr - pchNewValue) + 1, k_unStringPropertyTag ); +} + + +template +inline T CVRPropertyHelpers::GetPropertyHelper( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError, T bDefault, PropertyTypeTag_t unTypeTag ) +{ + T bValue; + ETrackedPropertyError eError; + PropertyTypeTag_t unReadTag; + GetProperty( ulContainerHandle, prop, &bValue, sizeof( bValue ), &unReadTag, &eError ); + if ( unReadTag != unTypeTag && eError == TrackedProp_Success ) + { + eError = TrackedProp_WrongDataType; + }; + + if ( pError ) + *pError = eError; + if ( eError != TrackedProp_Success ) + { + return bDefault; + } + else + { + return bValue; + } +} + + +inline bool CVRPropertyHelpers::GetBoolProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + return GetPropertyHelper( ulContainerHandle, prop, pError, false, k_unBoolPropertyTag ); +} + +inline float CVRPropertyHelpers::GetFloatProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + return GetPropertyHelper( ulContainerHandle, prop, pError, 0.f, k_unFloatPropertyTag ); +} + +inline double CVRPropertyHelpers::GetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + return GetPropertyHelper( ulContainerHandle, prop, pError, 0., k_unDoublePropertyTag ); +} + +inline int32_t CVRPropertyHelpers::GetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + return GetPropertyHelper( ulContainerHandle, prop, pError, 0, k_unInt32PropertyTag ); +} + +inline uint64_t CVRPropertyHelpers::GetUint64Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + return GetPropertyHelper( ulContainerHandle, prop, pError, 0, k_unUint64PropertyTag ); +} + +inline HmdVector2_t CVRPropertyHelpers::GetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + HmdVector2_t defaultval = { 0 }; + return GetPropertyHelper( ulContainerHandle, prop, pError, defaultval, k_unHmdVector2PropertyTag ); +} + +inline HmdVector3_t CVRPropertyHelpers::GetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + HmdVector3_t defaultval = { 0 }; + return GetPropertyHelper( ulContainerHandle, prop, pError, defaultval, k_unHmdVector3PropertyTag ); +} + +inline HmdVector4_t CVRPropertyHelpers::GetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError *pError ) +{ + HmdVector4_t defaultval = { 0 }; + return GetPropertyHelper( ulContainerHandle, prop, pError, defaultval, k_unHmdVector4PropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetBoolProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, bool bNewValue ) +{ + return SetProperty( ulContainerHandle, prop, &bNewValue, sizeof( bNewValue ), k_unBoolPropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetFloatProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, float fNewValue ) +{ + return SetProperty( ulContainerHandle, prop, &fNewValue, sizeof( fNewValue ), k_unFloatPropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetDoubleProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, double fNewValue ) +{ + return SetProperty( ulContainerHandle, prop, &fNewValue, sizeof( fNewValue ), k_unDoublePropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetInt32Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, int32_t nNewValue ) +{ + return SetProperty( ulContainerHandle, prop, &nNewValue, sizeof( nNewValue ), k_unInt32PropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetUint64Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, uint64_t ulNewValue ) +{ + return SetProperty( ulContainerHandle, prop, &ulNewValue, sizeof( ulNewValue ), k_unUint64PropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetVec2Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector2_t & vNewValue ) +{ + return SetProperty( ulContainerHandle, prop, ( void * ) &vNewValue, sizeof( HmdVector2_t ), k_unHmdVector2PropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetVec3Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector3_t & vNewValue ) +{ + return SetProperty( ulContainerHandle, prop, ( void * ) &vNewValue, sizeof( HmdVector3_t ), k_unHmdVector3PropertyTag ); +} + +inline ETrackedPropertyError CVRPropertyHelpers::SetVec4Property( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, const HmdVector4_t & vNewValue ) +{ + return SetProperty( ulContainerHandle, prop, ( void * ) &vNewValue, sizeof( HmdVector4_t ), k_unHmdVector4PropertyTag ); +} + +/** Sets the error return value for a property. This value will be returned on all subsequent requests to get the property */ +inline ETrackedPropertyError CVRPropertyHelpers::SetPropertyError( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop, ETrackedPropertyError eError ) +{ + PropertyWrite_t batch; + batch.writeType = PropertyWrite_SetError; + batch.prop = prop; + batch.eSetError = eError; + + m_pProperties->WritePropertyBatch( ulContainerHandle, &batch, 1 ); + + return batch.eError; +} + +/** Clears any value or error set for the property. */ +inline ETrackedPropertyError CVRPropertyHelpers::EraseProperty( PropertyContainerHandle_t ulContainerHandle, ETrackedDeviceProperty prop ) +{ + PropertyWrite_t batch; + batch.writeType = PropertyWrite_Erase; + batch.prop = prop; + + m_pProperties->WritePropertyBatch( ulContainerHandle, &batch, 1 ); + + return batch.eError; + +} + +template< typename T > +ETrackedPropertyError CVRPropertyHelpers::SetPropertyVector(PropertyContainerHandle_t ulContainer, vr::ETrackedDeviceProperty prop, PropertyTypeTag_t unTag, std::vector *pvecProperties) +{ + return SetProperty( ulContainer, prop, &(*pvecProperties)[0], (uint32_t)(pvecProperties->size() * sizeof( T )), unTag ); +} + +template< typename T > +ETrackedPropertyError CVRPropertyHelpers::GetPropertyVector( PropertyContainerHandle_t ulContainer, ETrackedDeviceProperty prop, PropertyTypeTag_t unExpectedTag, std::vector *pvecResults ) +{ + ETrackedPropertyError err; + PropertyTypeTag_t unTag; + uint32_t unNeeded; + if ( pvecResults->empty() ) + unNeeded = GetProperty( ulContainer, prop, nullptr, 0, &unTag, &err ); + else + unNeeded = GetProperty( ulContainer, prop, &(*pvecResults)[0], (uint32_t)(pvecResults->size() * sizeof( T )), &unTag, &err ); + uint32_t unFound = unNeeded / sizeof( T ); + if ( err == TrackedProp_Success ) + { + if ( unTag != unExpectedTag && unFound > 0 ) + { + return TrackedProp_WrongDataType; + } + + pvecResults->resize( unFound ); + return TrackedProp_Success; + } + else if ( err == TrackedProp_BufferTooSmall ) + { + pvecResults->resize( unFound ); + unNeeded = GetProperty( ulContainer, prop, &(*pvecResults)[0], (uint32_t)(pvecResults->size() * sizeof( T )), &unTag, &err ); + unFound = unNeeded / sizeof( T ); + + if ( err == TrackedProp_Success ) + { + if ( unTag != unExpectedTag ) + { + return TrackedProp_WrongDataType; + } + + pvecResults->resize( unFound ); + return TrackedProp_Success; + } + } + return err; +} + +inline bool CVRPropertyHelpers::IsPropertySet( PropertyContainerHandle_t ulContainer, ETrackedDeviceProperty prop, ETrackedPropertyError *peError ) +{ + ETrackedPropertyError error; + GetProperty( ulContainer, prop, nullptr, 0, nullptr, &error ); + if ( peError ) + *peError = error; + return error == TrackedProp_Success || error == TrackedProp_BufferTooSmall; +} + +} + + + +// ivrdriverinput.h + +namespace vr +{ + + typedef uint64_t VRInputComponentHandle_t; + static const VRInputComponentHandle_t k_ulInvalidInputComponentHandle = 0; + + enum EVRScalarType + { + VRScalarType_Absolute = 0, + VRScalarType_Relative = 1, + }; + + + enum EVRScalarUnits + { + VRScalarUnits_NormalizedOneSided = 0, // Value ranges from 0 to 1 + VRScalarUnits_NormalizedTwoSided = 1, // Value ranges from -1 to 1 + }; + + class IVRDriverInput + { + public: + + /** Creates a boolean input component for the device */ + virtual EVRInputError CreateBooleanComponent( PropertyContainerHandle_t ulContainer, const char *pchName, VRInputComponentHandle_t *pHandle ) = 0; + + /** Updates a boolean component */ + virtual EVRInputError UpdateBooleanComponent( VRInputComponentHandle_t ulComponent, bool bNewValue, double fTimeOffset ) = 0; + + /** Creates a scalar input component for the device */ + virtual EVRInputError CreateScalarComponent( PropertyContainerHandle_t ulContainer, const char *pchName, VRInputComponentHandle_t *pHandle, EVRScalarType eType, EVRScalarUnits eUnits ) = 0; + + /** Updates a boolean component */ + virtual EVRInputError UpdateScalarComponent( VRInputComponentHandle_t ulComponent, float fNewValue, double fTimeOffset ) = 0; + + /** Creates a haptic component for the device */ + virtual EVRInputError CreateHapticComponent( PropertyContainerHandle_t ulContainer, const char *pchName, VRInputComponentHandle_t *pHandle ) = 0; + + /** Creates a skeleton component. */ + virtual EVRInputError CreateSkeletonComponent( PropertyContainerHandle_t ulContainer, const char *pchName, const char *pchSkeletonPath, const char *pchBasePosePath, EVRSkeletalTrackingLevel eSkeletalTrackingLevel, const VRBoneTransform_t *pGripLimitTransforms, uint32_t unGripLimitTransformCount, VRInputComponentHandle_t *pHandle ) = 0; + + /** Updates a skeleton component. */ + virtual EVRInputError UpdateSkeletonComponent( VRInputComponentHandle_t ulComponent, EVRSkeletalMotionRange eMotionRange, const VRBoneTransform_t *pTransforms, uint32_t unTransformCount ) = 0; + + }; + + static const char * const IVRDriverInput_Version = "IVRDriverInput_003"; + +} // namespace vr + +// ivrdriverlog.h + +namespace vr +{ + +class IVRDriverLog +{ +public: + /** Writes a log message to the log file prefixed with the driver name */ + virtual void Log( const char *pchLogMessage ) = 0; +}; + + +static const char *IVRDriverLog_Version = "IVRDriverLog_001"; + +} + +// ivrserverdriverhost.h + +namespace vr +{ + +class ITrackedDeviceServerDriver; +struct TrackedDeviceDriverInfo_t; +struct DriverPose_t; + +/** This interface is provided by vrserver to allow the driver to notify +* the system when something changes about a device. These changes must +* not change the serial number or class of the device because those values +* are permanently associated with the device's index. */ +class IVRServerDriverHost +{ +public: + /** Notifies the server that a tracked device has been added. If this function returns true + * the server will call Activate on the device. If it returns false some kind of error + * has occurred and the device will not be activated. */ + virtual bool TrackedDeviceAdded( const char *pchDeviceSerialNumber, ETrackedDeviceClass eDeviceClass, ITrackedDeviceServerDriver *pDriver ) = 0; + + /** Notifies the server that a tracked device's pose has been updated */ + virtual void TrackedDevicePoseUpdated( uint32_t unWhichDevice, const DriverPose_t & newPose, uint32_t unPoseStructSize ) = 0; + + /** Notifies the server that vsync has occurred on the the display attached to the device. This is + * only permitted on devices of the HMD class. */ + virtual void VsyncEvent( double vsyncTimeOffsetSeconds ) = 0; + + /** Sends a vendor specific event (VREvent_VendorSpecific_Reserved_Start..VREvent_VendorSpecific_Reserved_End */ + virtual void VendorSpecificEvent( uint32_t unWhichDevice, vr::EVREventType eventType, const VREvent_Data_t & eventData, double eventTimeOffset ) = 0; + + /** Returns true if SteamVR is exiting */ + virtual bool IsExiting() = 0; + + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events + * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; + + /** Provides access to device poses for drivers. Poses are in their "raw" tracking space which is uniquely + * defined by each driver providing poses for its devices. It is up to clients of this function to correlate + * poses across different drivers. Poses are indexed by their device id, and their associated driver and + * other properties can be looked up via IVRProperties. */ + virtual void GetRawTrackedDevicePoses( float fPredictedSecondsFromNow, TrackedDevicePose_t *pTrackedDevicePoseArray, uint32_t unTrackedDevicePoseArrayCount ) = 0; + + /** Requests that SteamVR be restarted. The provided reason will be displayed to the user and should be in the current locale. */ + virtual void RequestRestart( const char *pchLocalizedReason, const char *pchExecutableToStart, const char *pchArguments, const char *pchWorkingDirectory ) = 0; + + /** Interface for copying a range of timing data. Frames are returned in ascending order (oldest to newest) with the last being the most recent frame. + * Only the first entry's m_nSize needs to be set, as the rest will be inferred from that. Returns total number of entries filled out. */ + virtual uint32_t GetFrameTimings( Compositor_FrameTiming *pTiming, uint32_t nFrames ) = 0; + + /** Notifies the server that a tracked device's display component transforms have been updated. + * only permitted on devices of the HMD class. */ + virtual void SetDisplayEyeToHead( uint32_t unWhichDevice, const HmdMatrix34_t & eyeToHeadLeft, const HmdMatrix34_t & eyeToHeadRight ) = 0; + + /** Notifies the server that a tracked device's display projection has changed. + * only permitted on devices of the HMD class. */ + virtual void SetDisplayProjectionRaw( uint32_t unWhichDevice, const HmdRect2_t & eyeLeft, const HmdRect2_t & eyeRight ) = 0; + + /** Notifies the server that a tracked device's recommended render target resolution has changed. + * only permitted on devices of the HMD class. */ + virtual void SetRecommendedRenderTargetSize( uint32_t unWhichDevice, uint32_t nWidth, uint32_t nHeight ) = 0; +}; + +static const char *IVRServerDriverHost_Version = "IVRServerDriverHost_006"; + +} + +// ivrcompositordriverhost.h + +namespace vr +{ + +class IVRCompositorDriverHost +{ +public: + /** Returns true and fills the event with the next event on the queue if there is one. If there are no events + * this method returns false. uncbVREvent should be the size in bytes of the VREvent_t struct */ + virtual bool PollNextEvent( VREvent_t *pEvent, uint32_t uncbVREvent ) = 0; +}; + +static const char *IVRCompositorDriverHost_Version = "IVRCompositorDriverHost_001"; + +} + +// ivrhiddenarea.h + +namespace vr +{ + +class CVRHiddenAreaHelpers +{ +public: + CVRHiddenAreaHelpers( IVRProperties *pProperties ) : m_pProperties( pProperties ) {} + + /** Stores a hidden area mesh in a property */ + ETrackedPropertyError SetHiddenArea( EVREye eEye, EHiddenAreaMeshType type, HmdVector2_t *pVerts, uint32_t unVertCount ); + + /** retrieves a hidden area mesh from a property. Returns the vert count read out of the property. */ + uint32_t GetHiddenArea( EVREye eEye, EHiddenAreaMeshType type, HmdVector2_t *pVerts, uint32_t unVertCount, ETrackedPropertyError *peError ); + +private: + ETrackedDeviceProperty GetPropertyEnum( EVREye eEye, EHiddenAreaMeshType type ) + { + return (ETrackedDeviceProperty)(Prop_DisplayHiddenArea_Binary_Start + ((int)type * 2) + (int)eEye); + } + + IVRProperties *m_pProperties; +}; + + +inline ETrackedPropertyError CVRHiddenAreaHelpers::SetHiddenArea( EVREye eEye, EHiddenAreaMeshType type, HmdVector2_t *pVerts, uint32_t unVertCount ) +{ + ETrackedDeviceProperty prop = GetPropertyEnum( eEye, type ); + CVRPropertyHelpers propHelpers( m_pProperties ); + return propHelpers.SetProperty( propHelpers.TrackedDeviceToPropertyContainer( k_unTrackedDeviceIndex_Hmd ), prop, pVerts, sizeof( HmdVector2_t ) * unVertCount, k_unHiddenAreaPropertyTag ); +} + + +inline uint32_t CVRHiddenAreaHelpers::GetHiddenArea( EVREye eEye, EHiddenAreaMeshType type, HmdVector2_t *pVerts, uint32_t unVertCount, ETrackedPropertyError *peError ) +{ + ETrackedDeviceProperty prop = GetPropertyEnum( eEye, type ); + CVRPropertyHelpers propHelpers( m_pProperties ); + ETrackedPropertyError propError; + PropertyTypeTag_t unTag; + uint32_t unBytesNeeded = propHelpers.GetProperty( propHelpers.TrackedDeviceToPropertyContainer( k_unTrackedDeviceIndex_Hmd ), prop, pVerts, sizeof( HmdVector2_t )*unVertCount, &unTag, &propError ); + if ( propError == TrackedProp_Success && unTag != k_unHiddenAreaPropertyTag ) + { + propError = TrackedProp_WrongDataType; + unBytesNeeded = 0; + } + + if ( peError ) + { + *peError = propError; + } + + return unBytesNeeded / sizeof( HmdVector2_t ); +} + +} + +// ivrwatchdoghost.h + +namespace vr +{ + +/** This interface is provided by vrclient to allow the driver to make everything wake up */ +class IVRWatchdogHost +{ +public: + /** Client drivers in watchdog mode should call this when they have received a signal from hardware that should + * cause SteamVR to start */ + virtual void WatchdogWakeUp( vr::ETrackedDeviceClass eDeviceClass ) = 0; +}; + +static const char *IVRWatchdogHost_Version = "IVRWatchdogHost_002"; + +}; + + + +// ivrvirtualdisplay.h + +namespace vr +{ + struct PresentInfo_t + { + SharedTextureHandle_t backbufferTextureHandle; + EVSync vsync; + uint64_t nFrameId; + double flVSyncTimeInSeconds; + }; + + // ---------------------------------------------------------------------------------------------- + // Purpose: This component is used for drivers that implement a virtual display (e.g. wireless). + // ---------------------------------------------------------------------------------------------- + class IVRVirtualDisplay + { + public: + + /** Submits final backbuffer for display. */ + virtual void Present( const PresentInfo_t *pPresentInfo, uint32_t unPresentInfoSize ) = 0; + + /** Block until the last presented buffer start scanning out. */ + virtual void WaitForPresent() = 0; + + /** Provides timing data for synchronizing with display. */ + virtual bool GetTimeSinceLastVsync( float *pfSecondsSinceLastVsync, uint64_t *pulFrameCounter ) = 0; + }; + + static const char *IVRVirtualDisplay_Version = "IVRVirtualDisplay_002"; +} + + +// ivrresources.h + +namespace vr +{ + +class IVRResources +{ +public: + + // ------------------------------------ + // Shared Resource Methods + // ------------------------------------ + + /** Loads the specified resource into the provided buffer if large enough. + * Returns the size in bytes of the buffer required to hold the specified resource. */ + virtual uint32_t LoadSharedResource( const char *pchResourceName, char *pchBuffer, uint32_t unBufferLen ) = 0; + + /** Provides the full path to the specified resource. Resource names can include named directories for + * drivers and other things, and this resolves all of those and returns the actual physical path. + * pchResourceTypeDirectory is the subdirectory of resources to look in. */ + virtual uint32_t GetResourceFullPath( const char *pchResourceName, const char *pchResourceTypeDirectory, VR_OUT_STRING() char *pchPathBuffer, uint32_t unBufferLen ) = 0; +}; + +static const char * const IVRResources_Version = "IVRResources_001"; + + +} + +// ivriobuffer.h + +namespace vr +{ + +typedef uint64_t IOBufferHandle_t; +static const uint64_t k_ulInvalidIOBufferHandle = 0; + + enum EIOBufferError + { + IOBuffer_Success = 0, + IOBuffer_OperationFailed = 100, + IOBuffer_InvalidHandle = 101, + IOBuffer_InvalidArgument = 102, + IOBuffer_PathExists = 103, + IOBuffer_PathDoesNotExist = 104, + IOBuffer_Permission = 105, + }; + + enum EIOBufferMode + { + IOBufferMode_Read = 0x0001, + IOBufferMode_Write = 0x0002, + IOBufferMode_Create = 0x0200, + }; + + // ---------------------------------------------------------------------------------------------- + // Purpose: + // ---------------------------------------------------------------------------------------------- + class IVRIOBuffer + { + public: + /** opens an existing or creates a new IOBuffer of unSize bytes */ + virtual vr::EIOBufferError Open( const char *pchPath, vr::EIOBufferMode mode, uint32_t unElementSize, uint32_t unElements, vr::IOBufferHandle_t *pulBuffer ) = 0; + + /** closes a previously opened or created buffer */ + virtual vr::EIOBufferError Close( vr::IOBufferHandle_t ulBuffer ) = 0; + + /** reads up to unBytes from buffer into *pDst, returning number of bytes read in *punRead */ + virtual vr::EIOBufferError Read( vr::IOBufferHandle_t ulBuffer, void *pDst, uint32_t unBytes, uint32_t *punRead ) = 0; + + /** writes unBytes of data from *pSrc into a buffer. */ + virtual vr::EIOBufferError Write( vr::IOBufferHandle_t ulBuffer, void *pSrc, uint32_t unBytes ) = 0; + + /** retrieves the property container of an buffer. */ + virtual vr::PropertyContainerHandle_t PropertyContainer( vr::IOBufferHandle_t ulBuffer ) = 0; + + /** inexpensively checks for readers to allow writers to fast-fail potentially expensive copies and writes. */ + virtual bool HasReaders( vr::IOBufferHandle_t ulBuffer ) = 0; + }; + + static const char *IVRIOBuffer_Version = "IVRIOBuffer_002"; +} + +// ivrdrivermanager.h + +namespace vr +{ + +class IVRDriverManager +{ +public: + virtual uint32_t GetDriverCount() const = 0; + + /** Returns the length of the number of bytes necessary to hold this string including the trailing null. */ + virtual uint32_t GetDriverName( vr::DriverId_t nDriver, VR_OUT_STRING() char *pchValue, uint32_t unBufferSize ) = 0; + + virtual DriverHandle_t GetDriverHandle( const char *pchDriverName ) = 0; + + virtual bool IsEnabled( vr::DriverId_t nDriver ) const = 0; +}; + +static const char * const IVRDriverManager_Version = "IVRDriverManager_001"; + +} // namespace vr + + + +// ivrdriverspatialanchors.h + +namespace vr +{ + struct SpatialAnchorDriverPose_t + { + /** This position is in the same "world" space (+Y up) as provided by DriverPose_t. */ + vr::HmdQuaternion_t qWorldRotation; + vr::HmdVector3d_t vWorldTranslation; + + /** The pose will automatically start returning VRSpatialAnchorError_NotAvailableInThisUniverse + * if this is nonzero and does not match the current universe ID. */ + uint64_t ulRequiredUniverseId; + + /** When this time expires, SteamVR will start generating + * VREvent_SpatialAnchors_RequestPoseUpdate when the pose is read by an application + * to let the driver know it is still worth updating. + * You can use this facility in several ways: + * 1. Set to -1 to never receive an update request for this pose. The driver + * may still update poses at any time. + * 2. Set to 0 to always receive an update request *after* each time the pose + * is read. The rate of requests could be very high if the application gets + * the pose at framerate. + * 3. If the driver knows there is no reason to update the pose for some amount of + * time, it can set that time here and receive the update request reminder later. + * 4. If the driver plans to automatically update this pose for some amount of time + * (as it gets better information about the virtual location of this anchor) it can + * set that duration here to indicate that no "update requested" reminders are needed. + * When that automatic update period expires, any future interest in the pose will + * be indicated by a pose update request. + * The driver may always update the pose, including during the valid duration. */ + double fValidDuration; // seconds + }; + + class IVRDriverSpatialAnchors + { + public: + + /* NOTE: You must declare support for spatial anchors in your driver manifest. Add + * "spatialAnchorsSupport": true to your manifest. Without that setting, SteamVR + * will short-circuit anchor requests from applications and provide a generic descriptor + * that does not have any of the advantages of true spatial anchors. */ + + /* The driver should monitor for events VREvent_SpatialAnchors_RequestPoseUpdate (for new + * descriptors from applications that need UpdateSpatialAnchorPose()) and for + * VREvent_SpatialAnchors_RequestDescriptorUpdate (for new poses that need UpdateSpatialAnchorDescriptor()). + * For automatic pose updates over time, the driver should keep track of the handles it + * has seen and provide updates when conditions change. If the driver uses fValidDuration, + * it may wait for VREvent_SpatialAnchors_RequestPoseUpdate instead of keeping track itself. */ + + /** Update a pose for a spatial anchor. Should be called when an event notifies the driver that a + * new descriptor has been registered by an application. May be called for any anchor whenever the + * driver has better information about the best virtual coordinate to represent the anchor. Should + * be called on all active handles whenever driver state changes in a way that changes how physical + * world locations map to virtual coordinates (e.g. anything that would cause a universe ID change). + * This fires an event when it is called for the first time (to alert whoever submitted the descriptor). */ + virtual EVRSpatialAnchorError UpdateSpatialAnchorPose( SpatialAnchorHandle_t unHandle, const SpatialAnchorDriverPose_t *pPose ) = 0; + + /** Invalidate any pose associated with the handle and cause future calls to GetSpatialAnchorPose (on + * both the client and driver side) to return the specified error. eError must be one of + * VRSpatialAnchorError_NotYetAvailable, VRSpatialAnchorError_NotAvailableInThisUniverse, or + * VRSpatialAnchorError_PermanentlyUnavailable */ + virtual EVRSpatialAnchorError SetSpatialAnchorPoseError( SpatialAnchorHandle_t unHandle, EVRSpatialAnchorError eError, double fValidDuration ) = 0; + + /** Update the descriptor for a spatial anchor. Should be called when an event notifies the driver + * that a new pose has been registered by an application. May be called for any anchor whenever the + * driver has better or additional information it wants to include in the anchor descriptor. Note, + * however, that the application may never fetch the updated anchor descriptor and may request the + * original descriptor in a future session having ignored the update. + * The supplied descriptor should be only the driver's opaque internal data, not the decorated form that + * is used by clients (wrapped by runtime metadata). The descriptor must not contain non-ASCII characters or + * the two special characters ~ or " + * This fires an event every time it is called. */ + virtual EVRSpatialAnchorError UpdateSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, const char *pchDescriptor ) = 0; + + /** Get the pose for a given handle. */ + virtual EVRSpatialAnchorError GetSpatialAnchorPose( SpatialAnchorHandle_t unHandle, SpatialAnchorDriverPose_t *pDriverPoseOut ) = 0; + + /** Get the descriptor for a given handle. This will be VRSpatialAnchorError_NotYetAvailable for handles + * where the driver has not yet built a descriptor. It will be the application-supplied descriptor for previously + * saved anchors that the application is requesting poses for. If the driver has called UpdateSpatialAnchorDescriptor() + * already in this session, it will be the descriptor provided by the driver. + * If bDecorated, returns the descriptor wrapped with runtime metadata suitable for a client to save. Else returns only + * the driver's opaque internal data. + */ + virtual EVRSpatialAnchorError GetSpatialAnchorDescriptor( SpatialAnchorHandle_t unHandle, VR_OUT_STRING() char *pchDescriptorOut, uint32_t *punDescriptorBufferLenInOut, bool bDecorated ) = 0; + + }; + + static const char * const IVRDriverSpatialAnchors_Version = "IVRDriverSpatialAnchors_001"; + +} // namespace vr + + + +namespace vr +{ +#if !defined( OPENVR_INTERFACE_INTERNAL ) + static const char * const k_InterfaceVersions[] = + { + IVRSettings_Version, + ITrackedDeviceServerDriver_Version, + IVRDisplayComponent_Version, + IVRDriverDirectModeComponent_Version, + IVRCameraComponent_Version, + IServerTrackedDeviceProvider_Version, + IVRWatchdogProvider_Version, + IVRVirtualDisplay_Version, + IVRDriverManager_Version, + IVRResources_Version, + IVRCompositorPluginProvider_Version, + nullptr + }; + + inline IVRDriverContext *&VRDriverContext() + { + static IVRDriverContext *pHost; + return pHost; + } + + class COpenVRDriverContext + { + public: + COpenVRDriverContext() : m_propertyHelpers(nullptr), m_hiddenAreaHelpers(nullptr) { Clear(); } + void Clear(); + + EVRInitError InitServer(); + EVRInitError InitWatchdog(); + EVRInitError InitCompositor(); + + IVRSettings *VRSettings() + { + if ( m_pVRSettings == nullptr ) + { + EVRInitError eError; + m_pVRSettings = (IVRSettings *)VRDriverContext()->GetGenericInterface( IVRSettings_Version, &eError ); + } + return m_pVRSettings; + } + + IVRProperties *VRPropertiesRaw() + { + if ( m_pVRProperties == nullptr ) + { + EVRInitError eError; + m_pVRProperties = (IVRProperties *)VRDriverContext()->GetGenericInterface( IVRProperties_Version, &eError ); + m_propertyHelpers = CVRPropertyHelpers( m_pVRProperties ); + m_hiddenAreaHelpers = CVRHiddenAreaHelpers( m_pVRProperties ); + } + return m_pVRProperties; + } + + CVRPropertyHelpers *VRProperties() + { + VRPropertiesRaw(); + return &m_propertyHelpers; + } + + CVRHiddenAreaHelpers *VRHiddenArea() + { + VRPropertiesRaw(); + return &m_hiddenAreaHelpers; + } + + IVRServerDriverHost *VRServerDriverHost() + { + if ( m_pVRServerDriverHost == nullptr ) + { + EVRInitError eError; + m_pVRServerDriverHost = (IVRServerDriverHost *)VRDriverContext()->GetGenericInterface( IVRServerDriverHost_Version, &eError ); + } + return m_pVRServerDriverHost; + } + + IVRWatchdogHost *VRWatchdogHost() + { + if ( m_pVRWatchdogHost == nullptr ) + { + EVRInitError eError; + m_pVRWatchdogHost = (IVRWatchdogHost *)VRDriverContext()->GetGenericInterface( IVRWatchdogHost_Version, &eError ); + } + return m_pVRWatchdogHost; + } + + IVRCompositorDriverHost *VRCompositorDriverHost() + { + if ( m_pVRCompositorDriverHost == nullptr ) + { + EVRInitError eError; + m_pVRCompositorDriverHost = ( IVRCompositorDriverHost * )VRDriverContext()->GetGenericInterface( IVRCompositorDriverHost_Version, &eError ); + } + return m_pVRCompositorDriverHost; + } + + IVRDriverLog *VRDriverLog() + { + if ( m_pVRDriverLog == nullptr ) + { + EVRInitError eError; + m_pVRDriverLog = (IVRDriverLog *)VRDriverContext()->GetGenericInterface( IVRDriverLog_Version, &eError ); + } + return m_pVRDriverLog; + } + + DriverHandle_t VR_CALLTYPE VRDriverHandle() + { + return VRDriverContext()->GetDriverHandle(); + } + + IVRDriverManager *VRDriverManager() + { + if ( !m_pVRDriverManager ) + { + EVRInitError eError; + m_pVRDriverManager = (IVRDriverManager *)VRDriverContext()->GetGenericInterface( IVRDriverManager_Version, &eError ); + } + return m_pVRDriverManager; + } + + IVRResources *VRResources() + { + if ( !m_pVRResources ) + { + EVRInitError eError; + m_pVRResources = (IVRResources *)VRDriverContext()->GetGenericInterface( IVRResources_Version, &eError ); + } + return m_pVRResources; + } + + IVRDriverInput *VRDriverInput() + { + if ( !m_pVRDriverInput ) + { + EVRInitError eError; + m_pVRDriverInput = (IVRDriverInput *)VRDriverContext()->GetGenericInterface( IVRDriverInput_Version, &eError ); + } + return m_pVRDriverInput; + } + + IVRIOBuffer *VRIOBuffer() + { + if ( !m_pVRIOBuffer ) + { + EVRInitError eError; + m_pVRIOBuffer = (IVRIOBuffer *)VRDriverContext()->GetGenericInterface( IVRIOBuffer_Version, &eError ); + } + return m_pVRIOBuffer; + } + + IVRDriverSpatialAnchors *VRDriverSpatialAnchors() + { + if ( !m_pVRDriverSpatialAnchors ) + { + EVRInitError eError; + m_pVRDriverSpatialAnchors = (IVRDriverSpatialAnchors *)VRDriverContext()->GetGenericInterface( IVRDriverSpatialAnchors_Version, &eError ); + } + return m_pVRDriverSpatialAnchors; + } + + private: + CVRPropertyHelpers m_propertyHelpers; + CVRHiddenAreaHelpers m_hiddenAreaHelpers; + + IVRSettings *m_pVRSettings; + IVRProperties *m_pVRProperties; + IVRServerDriverHost *m_pVRServerDriverHost; + IVRWatchdogHost *m_pVRWatchdogHost; + IVRCompositorDriverHost *m_pVRCompositorDriverHost; + IVRDriverLog *m_pVRDriverLog; + IVRDriverManager *m_pVRDriverManager; + IVRResources *m_pVRResources; + IVRDriverInput *m_pVRDriverInput; + IVRIOBuffer *m_pVRIOBuffer; + IVRDriverSpatialAnchors *m_pVRDriverSpatialAnchors; + }; + + inline COpenVRDriverContext &OpenVRInternal_ModuleServerDriverContext() + { + static void *ctx[sizeof( COpenVRDriverContext ) / sizeof( void * )]; + return *(COpenVRDriverContext *)ctx; // bypass zero-init constructor + } + + inline IVRSettings *VR_CALLTYPE VRSettings() { return OpenVRInternal_ModuleServerDriverContext().VRSettings(); } + inline IVRProperties *VR_CALLTYPE VRPropertiesRaw() { return OpenVRInternal_ModuleServerDriverContext().VRPropertiesRaw(); } + inline CVRPropertyHelpers *VR_CALLTYPE VRProperties() { return OpenVRInternal_ModuleServerDriverContext().VRProperties(); } + inline CVRHiddenAreaHelpers *VR_CALLTYPE VRHiddenArea() { return OpenVRInternal_ModuleServerDriverContext().VRHiddenArea(); } + inline IVRDriverLog *VR_CALLTYPE VRDriverLog() { return OpenVRInternal_ModuleServerDriverContext().VRDriverLog(); } + inline IVRServerDriverHost *VR_CALLTYPE VRServerDriverHost() { return OpenVRInternal_ModuleServerDriverContext().VRServerDriverHost(); } + inline IVRWatchdogHost *VR_CALLTYPE VRWatchdogHost() { return OpenVRInternal_ModuleServerDriverContext().VRWatchdogHost(); } + inline IVRCompositorDriverHost *VR_CALLTYPE VRCompositorDriverHost() { return OpenVRInternal_ModuleServerDriverContext().VRCompositorDriverHost(); } + inline DriverHandle_t VR_CALLTYPE VRDriverHandle() { return OpenVRInternal_ModuleServerDriverContext().VRDriverHandle(); } + inline IVRDriverManager *VR_CALLTYPE VRDriverManager() { return OpenVRInternal_ModuleServerDriverContext().VRDriverManager(); } + inline IVRResources *VR_CALLTYPE VRResources() { return OpenVRInternal_ModuleServerDriverContext().VRResources(); } + inline IVRDriverInput *VR_CALLTYPE VRDriverInput() { return OpenVRInternal_ModuleServerDriverContext().VRDriverInput(); } + inline IVRIOBuffer *VR_CALLTYPE VRIOBuffer() { return OpenVRInternal_ModuleServerDriverContext().VRIOBuffer(); } + inline IVRDriverSpatialAnchors *VR_CALLTYPE VRDriverSpatialAnchors() { return OpenVRInternal_ModuleServerDriverContext().VRDriverSpatialAnchors(); } + + inline void COpenVRDriverContext::Clear() + { + m_pVRSettings = nullptr; + m_pVRProperties = nullptr; + m_pVRServerDriverHost = nullptr; + m_pVRWatchdogHost = nullptr; + m_pVRCompositorDriverHost = nullptr; + m_pVRDriverLog = nullptr; + m_pVRDriverManager = nullptr; + m_pVRResources = nullptr; + m_pVRDriverInput = nullptr; + m_pVRIOBuffer = nullptr; + m_pVRDriverSpatialAnchors = nullptr; + } + + inline EVRInitError COpenVRDriverContext::InitServer() + { + Clear(); + if ( !VRServerDriverHost() + || !VRSettings() + || !VRProperties() + || !VRDriverLog() + || !VRDriverManager() + || !VRResources() ) + return VRInitError_Init_InterfaceNotFound; + return VRInitError_None; + } + + inline EVRInitError COpenVRDriverContext::InitWatchdog() + { + Clear(); + if ( !VRWatchdogHost() + || !VRSettings() + || !VRDriverLog() ) + return VRInitError_Init_InterfaceNotFound; + return VRInitError_None; + } + + inline EVRInitError COpenVRDriverContext::InitCompositor() + { + Clear(); + if ( !VRCompositorDriverHost() + || !VRSettings() + || !VRProperties() + || !VRDriverLog() + || !VRDriverManager() + || !VRResources() ) + return VRInitError_Init_InterfaceNotFound; + return VRInitError_None; + } + + inline EVRInitError InitServerDriverContext( IVRDriverContext *pContext ) + { + VRDriverContext() = pContext; + return OpenVRInternal_ModuleServerDriverContext().InitServer(); + } + + inline EVRInitError InitWatchdogDriverContext( IVRDriverContext *pContext ) + { + VRDriverContext() = pContext; + return OpenVRInternal_ModuleServerDriverContext().InitWatchdog(); + } + + inline EVRInitError InitCompositorDriverContext( IVRDriverContext *pContext ) + { + VRDriverContext() = pContext; + return OpenVRInternal_ModuleServerDriverContext().InitCompositor(); + } + + inline void CleanupDriverContext() + { + VRDriverContext() = nullptr; + OpenVRInternal_ModuleServerDriverContext().Clear(); + } + + #define VR_INIT_SERVER_DRIVER_CONTEXT( pContext ) \ + { \ + vr::EVRInitError eError = vr::InitServerDriverContext( pContext ); \ + if( eError != vr::VRInitError_None ) \ + return eError; \ + } + + #define VR_CLEANUP_SERVER_DRIVER_CONTEXT() \ + vr::CleanupDriverContext(); + + #define VR_INIT_WATCHDOG_DRIVER_CONTEXT( pContext ) \ + { \ + vr::EVRInitError eError = vr::InitWatchdogDriverContext( pContext ); \ + if( eError != vr::VRInitError_None ) \ + return eError; \ + } + + #define VR_CLEANUP_WATCHDOG_DRIVER_CONTEXT() \ + vr::CleanupDriverContext(); + +#define VR_INIT_COMPOSITOR_DRIVER_CONTEXT( pContext ) \ + { \ + vr::EVRInitError eError = vr::InitCompositorDriverContext( pContext ); \ + if( eError != vr::VRInitError_None ) \ + return eError; \ + } + +#define VR_CLEANUP_COMPOSITOR_DRIVER_CONTEXT() \ + vr::CleanupDriverContext(); + + +#endif // OPENVR_INTERFACE_INTERNAL + +} +// End + +#endif // _OPENVR_DRIVER_API + + diff --git a/contrib/openvr/src/CMakeLists.txt b/contrib/openvr/src/CMakeLists.txt new file mode 100755 index 0000000..29b69c5 --- /dev/null +++ b/contrib/openvr/src/CMakeLists.txt @@ -0,0 +1,116 @@ +# Project name. +project(openvr_api) + +set( LIBNAME "openvr_api" ) +set(OPENVR_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../headers) + +# Set some properies for specific files. +if(APPLE) + set(CMAKE_MACOSX_RPATH 1) + if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + set_source_files_properties(vrcommon/pathtools_public.cpp vrcommon/vrpathregistry_public.cpp PROPERTIES COMPILE_FLAGS "-x objective-c++") + endif() + if(BUILD_SHARED OR BUILD_FRAMEWORK) + find_library(FOUNDATION_FRAMEWORK Foundation) + mark_as_advanced(FOUNDATION_FRAMEWORK) + set(EXTRA_LIBS ${EXTRA_LIBS} ${FOUNDATION_FRAMEWORK}) + endif(BUILD_SHARED OR BUILD_FRAMEWORK) +elseif(WIN32) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + add_definitions( -DWIN64 ) + set( LIBNAME "openvr_api64" ) + endif() +endif() + +# Add include folders. +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/../headers ${CMAKE_CURRENT_SOURCE_DIR}/vrcommon) + +if(USE_CUSTOM_LIBCXX) + link_directories( + ${LIBCXX_LIB_DIR} + ) +endif() + +# Set the source group and files. +set(CORE_FILES + openvr_api_public.cpp + jsoncpp.cpp +) +set(VRCOMMON_FILES + vrcommon/dirtools_public.cpp + vrcommon/envvartools_public.cpp + vrcommon/pathtools_public.cpp + vrcommon/sharedlibtools_public.cpp + vrcommon/hmderrors_public.cpp + vrcommon/vrpathregistry_public.cpp + vrcommon/strtools_public.cpp +) + +set(SOURCE_FILES + ${CORE_FILES} + ${VRCOMMON_FILES} +) + +set(PUBLIC_HEADER_FILES + ${OPENVR_HEADER_DIR}/openvr_driver.h + ${OPENVR_HEADER_DIR}/openvr_capi.h + ${OPENVR_HEADER_DIR}/openvr.h +) + +source_group("Src" FILES + ${CORE_FILES} +) + +source_group("VRCommon" FILES + ${VRCOMMON_FILES} +) + +# Build the library. +if(BUILD_SHARED) + add_library(${LIBNAME} SHARED ${SOURCE_FILES}) +elseif(BUILD_FRAMEWORK) + set( LIBNAME "OpenVR" ) + add_library( ${LIBNAME} + SHARED ${SOURCE_FILES} + ${CMAKE_SOURCE_DIR}/headers/openvr.h + ${CMAKE_SOURCE_DIR}/headers/openvr_api.cs + ${CMAKE_SOURCE_DIR}/headers/openvr_api.json + ${CMAKE_SOURCE_DIR}/headers/openvr_capi.h + ${CMAKE_SOURCE_DIR}/headers/openvr_driver.h + ) + set_target_properties(OpenVR PROPERTIES + FRAMEWORK TRUE + FRAMEWORK_VERSION A + MACOSX_FRAMEWORK_IDENTIFIER com.valvesoftware.OpenVR.framework + MACOSX_FRAMEWORK_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/Info.plist + # "current version" in semantic format in Mach-O binary file + VERSION 1.0.6 + # "compatibility version" in semantic format in Mach-O binary file + SOVERSION 1.0.0 + PUBLIC_HEADER "${CMAKE_SOURCE_DIR}/headers/openvr.h;${CMAKE_SOURCE_DIR}/headers/openvr_api.cs;${CMAKE_SOURCE_DIR}/headers/openvr_api.json;${CMAKE_SOURCE_DIR}/headers/openvr_capi.h;${CMAKE_SOURCE_DIR}/headers/openvr_driver.h" + LINKER_LANGUAGE CXX + ) +else() + add_library(${LIBNAME} STATIC ${SOURCE_FILES}) +endif() + +if(USE_CUSTOM_LIBCXX) + set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi) +endif() + +target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS}) +target_include_directories(${LIBNAME} PUBLIC ${OPENVR_HEADER_DIR}) + +install(TARGETS ${LIBNAME} DESTINATION lib) +install(FILES ${PUBLIC_HEADER_FILES} DESTINATION include/openvr) + +# Generate a .pc file for linux environments +if(PLATFORM_NAME MATCHES "linux") + set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files") + CONFIGURE_FILE("openvr.pc.in" "openvr.pc" @ONLY) + + set(OPENVR_PC ${CMAKE_CURRENT_BINARY_DIR}/openvr.pc) + if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) + install(FILES ${OPENVR_PC} DESTINATION "${INSTALL_PKGCONFIG_DIR}") + endif() +endif() diff --git a/contrib/openvr/src/Info.plist b/contrib/openvr/src/Info.plist new file mode 100755 index 0000000..50ff90a --- /dev/null +++ b/contrib/openvr/src/Info.plist @@ -0,0 +1,18 @@ + + + + + CFBundleIdentifier + com.valvesoftware.OpenVR.framework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + OpenVR + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + + diff --git a/contrib/openvr/src/README b/contrib/openvr/src/README new file mode 100755 index 0000000..826c58d --- /dev/null +++ b/contrib/openvr/src/README @@ -0,0 +1,39 @@ +This is the source code for the OpenVR API client binding library which connects +OpenVR applications to the SteamVR runtime, taking into account the version +of the OpenVR interface they were compiled against. + +The client binding library - openvr_api.dll on Windows, openvr_api.so on +Linux, and openvr_api.dylib or OpenVR.framework on macOS - knows how to find +and read the SteamVR runtime installation information which allows it to +find and dynamically connect to the installed runtime. In combination with the +interface version identifiers from /include/openvr.h which are baked +into applications at the time they are built, the OpenVR API client +binding library captures and conveys to the SteamVR runtime the version +of the OpenVR API interface behavior that the application expects. + +Applications carry with them a private/local copy of the client binding +library when they ship, and they should install it locally to their +application. Applications should not install the client binding library +globally or attempt to link to a globally installed client binding library. +Doing so negates at least part of the ability for the client binding library +to accurately reflect the version of the OpenVR API that the application +was built against, and so hinders compatibility support in the face of +API changes. + +Most applications should simply link to and redistribute with their application +the pre-built client binding library found in the /bin directory of this +repository. Some small number of applications which have specific requirements +around redistributing only binaries they build themselves should build +the client library from this source and either statically link it into +their application or redistribute the binary they build. + +This is a cmake project, to build it use the version of cmake appropriate +for your platform. For example, to build on a POSIX system simply perform + + cd src; mkdir _build; cd _build; cmake ..; make + +and you will end up with the static library /src/bin//libopenvr_api.a + +To build a shared library, pass -DBUILD_SHARED=1 to cmake. +To build as a framework on apple platforms, pass -DBUILD_FRAMEWORK=1 to cmake. +To see a complete list of configurable build options, use `cmake -LAH` diff --git a/contrib/openvr/src/ivrclientcore.h b/contrib/openvr/src/ivrclientcore.h new file mode 100755 index 0000000..6884e7f --- /dev/null +++ b/contrib/openvr/src/ivrclientcore.h @@ -0,0 +1,35 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +namespace vr +{ + +class IVRClientCore +{ +public: + /** Initializes the system */ + virtual EVRInitError Init( vr::EVRApplicationType eApplicationType, const char *pStartupInfo ) = 0; + + /** cleans up everything in vrclient.dll and prepares the DLL to be unloaded */ + virtual void Cleanup() = 0; + + /** checks to see if the specified interface/version is supported in this vrclient.dll */ + virtual EVRInitError IsInterfaceVersionValid( const char *pchInterfaceVersion ) = 0; + + /** Retrieves any interface from vrclient.dll */ + virtual void *GetGenericInterface( const char *pchNameAndVersion, EVRInitError *peError ) = 0; + + /** Returns true if any driver has an HMD attached. Can be called outside of Init/Cleanup */ + virtual bool BIsHmdPresent() = 0; + + /** Returns an English error string from inside vrclient.dll which might be newer than the API DLL */ + virtual const char *GetEnglishStringForHmdError( vr::EVRInitError eError ) = 0; + + /** Returns an error symbol from inside vrclient.dll which might be newer than the API DLL */ + virtual const char *GetIDForVRInitError( vr::EVRInitError eError ) = 0; +}; + +static const char * const IVRClientCore_Version = "IVRClientCore_003"; + + +} diff --git a/contrib/openvr/src/json/json-forwards.h b/contrib/openvr/src/json/json-forwards.h new file mode 100755 index 0000000..910c7de --- /dev/null +++ b/contrib/openvr/src/json/json-forwards.h @@ -0,0 +1,284 @@ +/// Json-cpp amalgated forward header (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json-forwards.h" +/// This header provides forward declaration for all JsonCpp types. + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + +#ifndef JSON_FORWARD_AMALGATED_H_INCLUDED +# define JSON_FORWARD_AMALGATED_H_INCLUDED +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +#define JSON_IS_AMALGAMATION + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +#define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of +/// std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +#ifndef JSON_USE_EXCEPTION +#define JSON_USE_EXCEPTION 1 +#endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + +#ifdef JSON_IN_CPPTL +#include +#ifndef JSON_USE_CPPTL +#define JSON_USE_CPPTL 1 +#endif +#endif + +#ifdef JSON_IN_CPPTL +#define JSON_API CPPTL_API +#elif defined(JSON_DLL_BUILD) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllexport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#elif defined(JSON_DLL) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllimport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#endif // ifdef JSON_IN_CPPTL +#if !defined(JSON_API) +#define JSON_API +#endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for +// integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) // MSVC +# if _MSC_VER <= 1200 // MSVC 6 + // Microsoft Visual Studio 6 only support conversion from __int64 to double + // (no conversion from unsigned __int64). +# define JSON_USE_INT64_DOUBLE_CONVERSION 1 + // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' + // characters in the debug information) + // All projects I've ever seen with VS6 were using this globally (not bothering + // with pragma push/pop). +# pragma warning(disable : 4786) +# endif // MSVC 6 + +# if _MSC_VER >= 1500 // MSVC 2008 + /// Indicates that the following function is deprecated. +# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +# endif + +#endif // defined(_MSC_VER) + + +#ifndef JSON_HAS_RVALUE_REFERENCES + +#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // MSVC >= 2010 + +#ifdef __clang__ +#if __has_feature(cxx_rvalue_references) +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // has_feature + +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // GXX_EXPERIMENTAL + +#endif // __clang__ || __GNUC__ + +#endif // not defined JSON_HAS_RVALUE_REFERENCES + +#ifndef JSON_HAS_RVALUE_REFERENCES +#define JSON_HAS_RVALUE_REFERENCES 0 +#endif + +#ifdef __clang__ +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) +# endif // GNUC version +#endif // __clang__ || __GNUC__ + +#if !defined(JSONCPP_DEPRECATED) +#define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { +typedef int Int; +typedef unsigned int UInt; +#if defined(JSON_NO_INT64) +typedef int LargestInt; +typedef unsigned int LargestUInt; +#undef JSON_HAS_INT64 +#else // if defined(JSON_NO_INT64) +// For Microsoft Visual use specific types as long long is not supported +#if defined(_MSC_VER) // Microsoft Visual Studio +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#else // if defined(_MSC_VER) // Other platforms, use long long +typedef long long int Int64; +typedef unsigned long long int UInt64; +#endif // if defined(_MSC_VER) +typedef Int64 LargestInt; +typedef UInt64 LargestUInt; +#define JSON_HAS_INT64 +#endif // if defined(JSON_NO_INT64) +} // end namespace Json + +#endif // JSON_CONFIG_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +#define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// writer.h +class FastWriter; +class StyledWriter; + +// reader.h +class Reader; + +// features.h +class Features; + +// value.h +typedef unsigned int ArrayIndex; +class StaticString; +class Path; +class PathArgument; +class Value; +class ValueIteratorBase; +class ValueIterator; +class ValueConstIterator; + +} // namespace Json + +#endif // JSON_FORWARDS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + + + + + +#endif //ifndef JSON_FORWARD_AMALGATED_H_INCLUDED diff --git a/contrib/openvr/src/json/json.h b/contrib/openvr/src/json/json.h new file mode 100755 index 0000000..d27f65d --- /dev/null +++ b/contrib/openvr/src/json/json.h @@ -0,0 +1,2077 @@ +/// Json-cpp amalgated header (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json.h" + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + +#ifndef JSON_AMALGATED_H_INCLUDED +# define JSON_AMALGATED_H_INCLUDED +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +#define JSON_IS_AMALGAMATION + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/version.h +// ////////////////////////////////////////////////////////////////////// + +// DO NOT EDIT. This file (and "version") is generated by CMake. +// Run CMake configure step to update it. +#ifndef JSON_VERSION_H_INCLUDED +# define JSON_VERSION_H_INCLUDED + +# define JSONCPP_VERSION_STRING "1.6.5" +# define JSONCPP_VERSION_MAJOR 1 +# define JSONCPP_VERSION_MINOR 6 +# define JSONCPP_VERSION_PATCH 5 +# define JSONCPP_VERSION_QUALIFIER +# define JSONCPP_VERSION_HEXA ((JSONCPP_VERSION_MAJOR << 24) | (JSONCPP_VERSION_MINOR << 16) | (JSONCPP_VERSION_PATCH << 8)) + +#endif // JSON_VERSION_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/version.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_CONFIG_H_INCLUDED +#define JSON_CONFIG_H_INCLUDED + +/// If defined, indicates that json library is embedded in CppTL library. +//# define JSON_IN_CPPTL 1 + +/// If defined, indicates that json may leverage CppTL library +//# define JSON_USE_CPPTL 1 +/// If defined, indicates that cpptl vector based map should be used instead of +/// std::map +/// as Value container. +//# define JSON_USE_CPPTL_SMALLMAP 1 + +// If non-zero, the library uses exceptions to report bad input instead of C +// assertion macros. The default is to use exceptions. +#ifndef JSON_USE_EXCEPTION +#define JSON_USE_EXCEPTION 1 +#endif + +/// If defined, indicates that the source file is amalgated +/// to prevent private header inclusion. +/// Remarks: it is automatically defined in the generated amalgated header. +// #define JSON_IS_AMALGAMATION + +#ifdef JSON_IN_CPPTL +#include +#ifndef JSON_USE_CPPTL +#define JSON_USE_CPPTL 1 +#endif +#endif + +#ifdef JSON_IN_CPPTL +#define JSON_API CPPTL_API +#elif defined(JSON_DLL_BUILD) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllexport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#elif defined(JSON_DLL) +#if defined(_MSC_VER) +#define JSON_API __declspec(dllimport) +#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING +#endif // if defined(_MSC_VER) +#endif // ifdef JSON_IN_CPPTL +#if !defined(JSON_API) +#define JSON_API +#endif + +// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for +// integer +// Storages, and 64 bits integer support is disabled. +// #define JSON_NO_INT64 1 + +#if defined(_MSC_VER) // MSVC +# if _MSC_VER <= 1200 // MSVC 6 + // Microsoft Visual Studio 6 only support conversion from __int64 to double + // (no conversion from unsigned __int64). +# define JSON_USE_INT64_DOUBLE_CONVERSION 1 + // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255' + // characters in the debug information) + // All projects I've ever seen with VS6 were using this globally (not bothering + // with pragma push/pop). +# pragma warning(disable : 4786) +# endif // MSVC 6 + +# if _MSC_VER >= 1500 // MSVC 2008 + /// Indicates that the following function is deprecated. +# define JSONCPP_DEPRECATED(message) __declspec(deprecated(message)) +# endif + +#endif // defined(_MSC_VER) + + +#ifndef JSON_HAS_RVALUE_REFERENCES + +#if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010 +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // MSVC >= 2010 + +#ifdef __clang__ +#if __has_feature(cxx_rvalue_references) +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // has_feature + +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) +#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L) +#define JSON_HAS_RVALUE_REFERENCES 1 +#endif // GXX_EXPERIMENTAL + +#endif // __clang__ || __GNUC__ + +#endif // not defined JSON_HAS_RVALUE_REFERENCES + +#ifndef JSON_HAS_RVALUE_REFERENCES +#define JSON_HAS_RVALUE_REFERENCES 0 +#endif + +#ifdef __clang__ +#elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc) +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)) +# define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message))) +# elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +# define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__)) +# endif // GNUC version +#endif // __clang__ || __GNUC__ + +#if !defined(JSONCPP_DEPRECATED) +#define JSONCPP_DEPRECATED(message) +#endif // if !defined(JSONCPP_DEPRECATED) + +namespace Json { +typedef int Int; +typedef unsigned int UInt; +#if defined(JSON_NO_INT64) +typedef int LargestInt; +typedef unsigned int LargestUInt; +#undef JSON_HAS_INT64 +#else // if defined(JSON_NO_INT64) +// For Microsoft Visual use specific types as long long is not supported +#if defined(_MSC_VER) // Microsoft Visual Studio +typedef __int64 Int64; +typedef unsigned __int64 UInt64; +#else // if defined(_MSC_VER) // Other platforms, use long long +typedef long long int Int64; +typedef unsigned long long int UInt64; +#endif // if defined(_MSC_VER) +typedef Int64 LargestInt; +typedef UInt64 LargestUInt; +#define JSON_HAS_INT64 +#endif // if defined(JSON_NO_INT64) +} // end namespace Json + +#endif // JSON_CONFIG_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/config.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_FORWARDS_H_INCLUDED +#define JSON_FORWARDS_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +// writer.h +class FastWriter; +class StyledWriter; + +// reader.h +class Reader; + +// features.h +class Features; + +// value.h +typedef unsigned int ArrayIndex; +class StaticString; +class Path; +class PathArgument; +class Value; +class ValueIteratorBase; +class ValueIterator; +class ValueConstIterator; + +} // namespace Json + +#endif // JSON_FORWARDS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/forwards.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_FEATURES_H_INCLUDED +#define CPPTL_JSON_FEATURES_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +/** \brief Configuration passed to reader and writer. + * This configuration object can be used to force the Reader or Writer + * to behave in a standard conforming way. + */ +class JSON_API Features { +public: + /** \brief A configuration that allows all features and assumes all strings + * are UTF-8. + * - C & C++ comments are allowed + * - Root object can be any JSON value + * - Assumes Value strings are encoded in UTF-8 + */ + static Features all(); + + /** \brief A configuration that is strictly compatible with the JSON + * specification. + * - Comments are forbidden. + * - Root object must be either an array or an object value. + * - Assumes Value strings are encoded in UTF-8 + */ + static Features strictMode(); + + /** \brief Initialize the configuration like JsonConfig::allFeatures; + */ + Features(); + + /// \c true if comments are allowed. Default: \c true. + bool allowComments_; + + /// \c true if root must be either an array or an object value. Default: \c + /// false. + bool strictRoot_; + + /// \c true if dropped null placeholders are allowed. Default: \c false. + bool allowDroppedNullPlaceholders_; + + /// \c true if numeric object key are allowed. Default: \c false. + bool allowNumericKeys_; +}; + +} // namespace Json + +#endif // CPPTL_JSON_FEATURES_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/features.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_H_INCLUDED +#define CPPTL_JSON_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "forwards.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include + +#ifndef JSON_USE_CPPTL_SMALLMAP +#include +#else +#include +#endif +#ifdef JSON_USE_CPPTL +#include +#endif + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +/** \brief JSON (JavaScript Object Notation). + */ +namespace Json { + +/** Base class for all exceptions we throw. + * + * We use nothing but these internally. Of course, STL can throw others. + */ +class JSON_API Exception : public std::exception { +public: + Exception(std::string const& msg); + ~Exception() throw(); + char const* what() const throw(); +protected: + std::string msg_; +}; + +/** Exceptions which the user cannot easily avoid. + * + * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input + * + * \remark derived from Json::Exception + */ +class JSON_API RuntimeError : public Exception { +public: + RuntimeError(std::string const& msg); +}; + +/** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros. + * + * These are precondition-violations (user bugs) and internal errors (our bugs). + * + * \remark derived from Json::Exception + */ +class JSON_API LogicError : public Exception { +public: + LogicError(std::string const& msg); +}; + +/// used internally +void throwRuntimeError(std::string const& msg); +/// used internally +void throwLogicError(std::string const& msg); + +/** \brief Type of the value held by a Value object. + */ +enum ValueType { + nullValue = 0, ///< 'null' value + intValue, ///< signed integer value + uintValue, ///< unsigned integer value + realValue, ///< double value + stringValue, ///< UTF-8 string value + booleanValue, ///< bool value + arrayValue, ///< array value (ordered list) + objectValue ///< object value (collection of name/value pairs). +}; + +enum CommentPlacement { + commentBefore = 0, ///< a comment placed on the line before a value + commentAfterOnSameLine, ///< a comment just after a value on the same line + commentAfter, ///< a comment on the line after a value (only make sense for + /// root value) + numberOfCommentPlacement +}; + +//# ifdef JSON_USE_CPPTL +// typedef CppTL::AnyEnumerator EnumMemberNames; +// typedef CppTL::AnyEnumerator EnumValues; +//# endif + +/** \brief Lightweight wrapper to tag static string. + * + * Value constructor and objectValue member assignement takes advantage of the + * StaticString and avoid the cost of string duplication when storing the + * string or the member name. + * + * Example of usage: + * \code + * Json::Value aValue( StaticString("some text") ); + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ +class JSON_API StaticString { +public: + explicit StaticString(const char* czstring) : c_str_(czstring) {} + + operator const char*() const { return c_str_; } + + const char* c_str() const { return c_str_; } + +private: + const char* c_str_; +}; + +/** \brief Represents a JSON value. + * + * This class is a discriminated union wrapper that can represents a: + * - signed integer [range: Value::minInt - Value::maxInt] + * - unsigned integer (range: 0 - Value::maxUInt) + * - double + * - UTF-8 string + * - boolean + * - 'null' + * - an ordered list of Value + * - collection of name/value pairs (javascript object) + * + * The type of the held value is represented by a #ValueType and + * can be obtained using type(). + * + * Values of an #objectValue or #arrayValue can be accessed using operator[]() + * methods. + * Non-const methods will automatically create the a #nullValue element + * if it does not exist. + * The sequence of an #arrayValue will be automatically resized and initialized + * with #nullValue. resize() can be used to enlarge or truncate an #arrayValue. + * + * The get() methods can be used to obtain default value in the case the + * required element does not exist. + * + * It is possible to iterate over the list of a #objectValue values using + * the getMemberNames() method. + * + * \note #Value string-length fit in size_t, but keys must be < 2^30. + * (The reason is an implementation detail.) A #CharReader will raise an + * exception if a bound is exceeded to avoid security holes in your app, + * but the Value API does *not* check bounds. That is the responsibility + * of the caller. + */ +class JSON_API Value { + friend class ValueIteratorBase; +public: + typedef std::vector Members; + typedef ValueIterator iterator; + typedef ValueConstIterator const_iterator; + typedef Json::UInt UInt; + typedef Json::Int Int; +#if defined(JSON_HAS_INT64) + typedef Json::UInt64 UInt64; + typedef Json::Int64 Int64; +#endif // defined(JSON_HAS_INT64) + typedef Json::LargestInt LargestInt; + typedef Json::LargestUInt LargestUInt; + typedef Json::ArrayIndex ArrayIndex; + + static const Value& null; ///< We regret this reference to a global instance; prefer the simpler Value(). + static const Value& nullRef; ///< just a kludge for binary-compatibility; same as null + /// Minimum signed integer value that can be stored in a Json::Value. + static const LargestInt minLargestInt; + /// Maximum signed integer value that can be stored in a Json::Value. + static const LargestInt maxLargestInt; + /// Maximum unsigned integer value that can be stored in a Json::Value. + static const LargestUInt maxLargestUInt; + + /// Minimum signed int value that can be stored in a Json::Value. + static const Int minInt; + /// Maximum signed int value that can be stored in a Json::Value. + static const Int maxInt; + /// Maximum unsigned int value that can be stored in a Json::Value. + static const UInt maxUInt; + +#if defined(JSON_HAS_INT64) + /// Minimum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 minInt64; + /// Maximum signed 64 bits int value that can be stored in a Json::Value. + static const Int64 maxInt64; + /// Maximum unsigned 64 bits int value that can be stored in a Json::Value. + static const UInt64 maxUInt64; +#endif // defined(JSON_HAS_INT64) + +private: +#ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + class CZString { + public: + enum DuplicationPolicy { + noDuplication = 0, + duplicate, + duplicateOnCopy + }; + CZString(ArrayIndex index); + CZString(char const* str, unsigned length, DuplicationPolicy allocate); + CZString(CZString const& other); +#if JSON_HAS_RVALUE_REFERENCES + CZString(CZString&& other); +#endif + ~CZString(); + CZString& operator=(CZString other); + bool operator<(CZString const& other) const; + bool operator==(CZString const& other) const; + ArrayIndex index() const; + //const char* c_str() const; ///< \deprecated + char const* data() const; + unsigned length() const; + bool isStaticString() const; + + private: + void swap(CZString& other); + + struct StringStorage { + unsigned policy_: 2; + unsigned length_: 30; // 1GB max + }; + + char const* cstr_; // actually, a prefixed string, unless policy is noDup + union { + ArrayIndex index_; + StringStorage storage_; + }; + }; + +public: +#ifndef JSON_USE_CPPTL_SMALLMAP + typedef std::map ObjectValues; +#else + typedef CppTL::SmallMap ObjectValues; +#endif // ifndef JSON_USE_CPPTL_SMALLMAP +#endif // ifndef JSONCPP_DOC_EXCLUDE_IMPLEMENTATION + +public: + /** \brief Create a default Value of the given type. + + This is a very useful constructor. + To create an empty array, pass arrayValue. + To create an empty object, pass objectValue. + Another Value can then be set to this one by assignment. +This is useful since clear() and resize() will not alter types. + + Examples: +\code +Json::Value null_value; // null +Json::Value arr_value(Json::arrayValue); // [] +Json::Value obj_value(Json::objectValue); // {} +\endcode + */ + Value(ValueType type = nullValue); + Value(Int value); + Value(UInt value); +#if defined(JSON_HAS_INT64) + Value(Int64 value); + Value(UInt64 value); +#endif // if defined(JSON_HAS_INT64) + Value(double value); + Value(const char* value); ///< Copy til first 0. (NULL causes to seg-fault.) + Value(const char* begin, const char* end); ///< Copy all, incl zeroes. + /** \brief Constructs a value from a static string. + + * Like other value string constructor but do not duplicate the string for + * internal storage. The given string must remain alive after the call to this + * constructor. + * \note This works only for null-terminated strings. (We cannot change the + * size of this class, so we have nowhere to store the length, + * which might be computed later for various operations.) + * + * Example of usage: + * \code + * static StaticString foo("some text"); + * Json::Value aValue(foo); + * \endcode + */ + Value(const StaticString& value); + Value(const std::string& value); ///< Copy data() til size(). Embedded zeroes too. +#ifdef JSON_USE_CPPTL + Value(const CppTL::ConstString& value); +#endif + Value(bool value); + /// Deep copy. + Value(const Value& other); +#if JSON_HAS_RVALUE_REFERENCES + /// Move constructor + Value(Value&& other); +#endif + ~Value(); + + /// Deep copy, then swap(other). + /// \note Over-write existing comments. To preserve comments, use #swapPayload(). + Value& operator=(Value other); + /// Swap everything. + void swap(Value& other); + /// Swap values but leave comments and source offsets in place. + void swapPayload(Value& other); + + ValueType type() const; + + /// Compare payload only, not comments etc. + bool operator<(const Value& other) const; + bool operator<=(const Value& other) const; + bool operator>=(const Value& other) const; + bool operator>(const Value& other) const; + bool operator==(const Value& other) const; + bool operator!=(const Value& other) const; + int compare(const Value& other) const; + + const char* asCString() const; ///< Embedded zeroes could cause you trouble! + std::string asString() const; ///< Embedded zeroes are possible. + /** Get raw char* of string-value. + * \return false if !string. (Seg-fault if str or end are NULL.) + */ + bool getString( + char const** begin, char const** end) const; +#ifdef JSON_USE_CPPTL + CppTL::ConstString asConstString() const; +#endif + Int asInt() const; + UInt asUInt() const; +#if defined(JSON_HAS_INT64) + Int64 asInt64() const; + UInt64 asUInt64() const; +#endif // if defined(JSON_HAS_INT64) + LargestInt asLargestInt() const; + LargestUInt asLargestUInt() const; + float asFloat() const; + double asDouble() const; + bool asBool() const; + + bool isNull() const; + bool isBool() const; + bool isInt() const; + bool isInt64() const; + bool isUInt() const; + bool isUInt64() const; + bool isIntegral() const; + bool isDouble() const; + bool isNumeric() const; + bool isString() const; + bool isArray() const; + bool isObject() const; + + bool isConvertibleTo(ValueType other) const; + + /// Number of values in array or object + ArrayIndex size() const; + + /// \brief Return true if empty array, empty object, or null; + /// otherwise, false. + bool empty() const; + + /// Return isNull() + bool operator!() const; + + /// Remove all object members and array elements. + /// \pre type() is arrayValue, objectValue, or nullValue + /// \post type() is unchanged + void clear(); + + /// Resize the array to size elements. + /// New elements are initialized to null. + /// May only be called on nullValue or arrayValue. + /// \pre type() is arrayValue or nullValue + /// \post type() is arrayValue + void resize(ArrayIndex size); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value& operator[](ArrayIndex index); + + /// Access an array element (zero based index ). + /// If the array contains less than index element, then null value are + /// inserted + /// in the array so that its size is index+1. + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + Value& operator[](int index); + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value& operator[](ArrayIndex index) const; + + /// Access an array element (zero based index ) + /// (You may need to say 'value[0u]' to get your compiler to distinguish + /// this from the operator[] which takes a string.) + const Value& operator[](int index) const; + + /// If the array contains at least index+1 elements, returns the element + /// value, + /// otherwise returns defaultValue. + Value get(ArrayIndex index, const Value& defaultValue) const; + /// Return true if index < size(). + bool isValidIndex(ArrayIndex index) const; + /// \brief Append value to array at the end. + /// + /// Equivalent to jsonvalue[jsonvalue.size()] = value; + Value& append(const Value& value); + + /// Access an object value by name, create a null member if it does not exist. + /// \note Because of our implementation, keys are limited to 2^30 -1 chars. + /// Exceeding that will cause an exception. + Value& operator[](const char* key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value& operator[](const char* key) const; + /// Access an object value by name, create a null member if it does not exist. + /// \param key may contain embedded nulls. + Value& operator[](const std::string& key); + /// Access an object value by name, returns null if there is no member with + /// that name. + /// \param key may contain embedded nulls. + const Value& operator[](const std::string& key) const; + /** \brief Access an object value by name, create a null member if it does not + exist. + + * If the object has no entry for that name, then the member name used to store + * the new entry is not duplicated. + * Example of use: + * \code + * Json::Value object; + * static const StaticString code("code"); + * object[code] = 1234; + * \endcode + */ + Value& operator[](const StaticString& key); +#ifdef JSON_USE_CPPTL + /// Access an object value by name, create a null member if it does not exist. + Value& operator[](const CppTL::ConstString& key); + /// Access an object value by name, returns null if there is no member with + /// that name. + const Value& operator[](const CppTL::ConstString& key) const; +#endif + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + Value get(const char* key, const Value& defaultValue) const; + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + /// \note key may contain embedded nulls. + Value get(const char* begin, const char* end, const Value& defaultValue) const; + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + /// \param key may contain embedded nulls. + Value get(const std::string& key, const Value& defaultValue) const; +#ifdef JSON_USE_CPPTL + /// Return the member named key if it exist, defaultValue otherwise. + /// \note deep copy + Value get(const CppTL::ConstString& key, const Value& defaultValue) const; +#endif + /// Most general and efficient version of isMember()const, get()const, + /// and operator[]const + /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 + Value const* find(char const* begin, char const* end) const; + /// Most general and efficient version of object-mutators. + /// \note As stated elsewhere, behavior is undefined if (end-begin) >= 2^30 + /// \return non-zero, but JSON_ASSERT if this is neither object nor nullValue. + Value const* demand(char const* begin, char const* end); + /// \brief Remove and return the named member. + /// + /// Do nothing if it did not exist. + /// \return the removed Value, or null. + /// \pre type() is objectValue or nullValue + /// \post type() is unchanged + /// \deprecated + Value removeMember(const char* key); + /// Same as removeMember(const char*) + /// \param key may contain embedded nulls. + /// \deprecated + Value removeMember(const std::string& key); + /// Same as removeMember(const char* begin, const char* end, Value* removed), + /// but 'key' is null-terminated. + bool removeMember(const char* key, Value* removed); + /** \brief Remove the named map member. + + Update 'removed' iff removed. + \param key may contain embedded nulls. + \return true iff removed (no exceptions) + */ + bool removeMember(std::string const& key, Value* removed); + /// Same as removeMember(std::string const& key, Value* removed) + bool removeMember(const char* begin, const char* end, Value* removed); + /** \brief Remove the indexed array element. + + O(n) expensive operations. + Update 'removed' iff removed. + \return true iff removed (no exceptions) + */ + bool removeIndex(ArrayIndex i, Value* removed); + + /// Return true if the object has a member named key. + /// \note 'key' must be null-terminated. + bool isMember(const char* key) const; + /// Return true if the object has a member named key. + /// \param key may contain embedded nulls. + bool isMember(const std::string& key) const; + /// Same as isMember(std::string const& key)const + bool isMember(const char* begin, const char* end) const; +#ifdef JSON_USE_CPPTL + /// Return true if the object has a member named key. + bool isMember(const CppTL::ConstString& key) const; +#endif + + /// \brief Return a list of the member names. + /// + /// If null, return an empty list. + /// \pre type() is objectValue or nullValue + /// \post if type() was nullValue, it remains nullValue + Members getMemberNames() const; + + //# ifdef JSON_USE_CPPTL + // EnumMemberNames enumMemberNames() const; + // EnumValues enumValues() const; + //# endif + + /// \deprecated Always pass len. + JSONCPP_DEPRECATED("Use setComment(std::string const&) instead.") + void setComment(const char* comment, CommentPlacement placement); + /// Comments must be //... or /* ... */ + void setComment(const char* comment, size_t len, CommentPlacement placement); + /// Comments must be //... or /* ... */ + void setComment(const std::string& comment, CommentPlacement placement); + bool hasComment(CommentPlacement placement) const; + /// Include delimiters and embedded newlines. + std::string getComment(CommentPlacement placement) const; + + std::string toStyledString() const; + + const_iterator begin() const; + const_iterator end() const; + + iterator begin(); + iterator end(); + + // Accessors for the [start, limit) range of bytes within the JSON text from + // which this value was parsed, if any. + void setOffsetStart(size_t start); + void setOffsetLimit(size_t limit); + size_t getOffsetStart() const; + size_t getOffsetLimit() const; + +private: + void initBasic(ValueType type, bool allocated = false); + + Value& resolveReference(const char* key); + Value& resolveReference(const char* key, const char* end); + + struct CommentInfo { + CommentInfo(); + ~CommentInfo(); + + void setComment(const char* text, size_t len); + + char* comment_; + }; + + // struct MemberNamesTransform + //{ + // typedef const char *result_type; + // const char *operator()( const CZString &name ) const + // { + // return name.c_str(); + // } + //}; + + union ValueHolder { + LargestInt int_; + LargestUInt uint_; + double real_; + bool bool_; + char* string_; // actually ptr to unsigned, followed by str, unless !allocated_ + ObjectValues* map_; + } value_; + ValueType type_ : 8; + unsigned int allocated_ : 1; // Notes: if declared as bool, bitfield is useless. + // If not allocated_, string_ must be null-terminated. + CommentInfo* comments_; + Value *default_value_; // if via .get( "key", default ), this was the default + + // [start, limit) byte offsets in the source JSON text from which this Value + // was extracted. + size_t start_; + size_t limit_; +}; + +/** \brief Experimental and untested: represents an element of the "path" to + * access a node. + */ +class JSON_API PathArgument { +public: + friend class Path; + + PathArgument(); + PathArgument(ArrayIndex index); + PathArgument(const char* key); + PathArgument(const std::string& key); + +private: + enum Kind { + kindNone = 0, + kindIndex, + kindKey + }; + std::string key_; + ArrayIndex index_; + Kind kind_; +}; + +/** \brief Experimental and untested: represents a "path" to access a node. + * + * Syntax: + * - "." => root node + * - ".[n]" => elements at index 'n' of root node (an array value) + * - ".name" => member named 'name' of root node (an object value) + * - ".name1.name2.name3" + * - ".[0][1][2].name1[3]" + * - ".%" => member name is provided as parameter + * - ".[%]" => index is provied as parameter + */ +class JSON_API Path { +public: + Path(const std::string& path, + const PathArgument& a1 = PathArgument(), + const PathArgument& a2 = PathArgument(), + const PathArgument& a3 = PathArgument(), + const PathArgument& a4 = PathArgument(), + const PathArgument& a5 = PathArgument()); + + const Value& resolve(const Value& root) const; + Value resolve(const Value& root, const Value& defaultValue) const; + /// Creates the "path" to access the specified node and returns a reference on + /// the node. + Value& make(Value& root) const; + +private: + typedef std::vector InArgs; + typedef std::vector Args; + + void makePath(const std::string& path, const InArgs& in); + void addPathInArg(const std::string& path, + const InArgs& in, + InArgs::const_iterator& itInArg, + PathArgument::Kind kind); + void invalidPath(const std::string& path, int location); + + Args args_; +}; + +/** \brief base class for Value iterators. + * + */ +class JSON_API ValueIteratorBase { +public: + typedef std::bidirectional_iterator_tag iterator_category; + typedef unsigned int size_t; + typedef int difference_type; + typedef ValueIteratorBase SelfType; + + bool operator==(const SelfType& other) const { return isEqual(other); } + + bool operator!=(const SelfType& other) const { return !isEqual(other); } + + difference_type operator-(const SelfType& other) const { + return other.computeDistance(*this); + } + + /// Return either the index or the member name of the referenced value as a + /// Value. + Value key() const; + + /// Return the index of the referenced Value, or -1 if it is not an arrayValue. + UInt index() const; + + /// Return the member name of the referenced Value, or "" if it is not an + /// objectValue. + /// \note Avoid `c_str()` on result, as embedded zeroes are possible. + std::string name() const; + + /// Return the member name of the referenced Value. "" if it is not an + /// objectValue. + /// \deprecated This cannot be used for UTF-8 strings, since there can be embedded nulls. + JSONCPP_DEPRECATED("Use `key = name();` instead.") + char const* memberName() const; + /// Return the member name of the referenced Value, or NULL if it is not an + /// objectValue. + /// \note Better version than memberName(). Allows embedded nulls. + char const* memberName(char const** end) const; + +protected: + Value& deref() const; + + void increment(); + + void decrement(); + + difference_type computeDistance(const SelfType& other) const; + + bool isEqual(const SelfType& other) const; + + void copy(const SelfType& other); + +private: + Value::ObjectValues::iterator current_; + // Indicates that iterator is for a null value. + bool isNull_; + +public: + // For some reason, BORLAND needs these at the end, rather + // than earlier. No idea why. + ValueIteratorBase(); + explicit ValueIteratorBase(const Value::ObjectValues::iterator& current); +}; + +/** \brief const iterator for object and array value. + * + */ +class JSON_API ValueConstIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef const Value value_type; + //typedef unsigned int size_t; + //typedef int difference_type; + typedef const Value& reference; + typedef const Value* pointer; + typedef ValueConstIterator SelfType; + + ValueConstIterator(); + ValueConstIterator(ValueIterator const& other); + +private: +/*! \internal Use by Value to create an iterator. + */ + explicit ValueConstIterator(const Value::ObjectValues::iterator& current); +public: + SelfType& operator=(const ValueIteratorBase& other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType& operator--() { + decrement(); + return *this; + } + + SelfType& operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } + + pointer operator->() const { return &deref(); } +}; + +/** \brief Iterator for object and array value. + */ +class JSON_API ValueIterator : public ValueIteratorBase { + friend class Value; + +public: + typedef Value value_type; + typedef unsigned int size_t; + typedef int difference_type; + typedef Value& reference; + typedef Value* pointer; + typedef ValueIterator SelfType; + + ValueIterator(); + explicit ValueIterator(const ValueConstIterator& other); + ValueIterator(const ValueIterator& other); + +private: +/*! \internal Use by Value to create an iterator. + */ + explicit ValueIterator(const Value::ObjectValues::iterator& current); +public: + SelfType& operator=(const SelfType& other); + + SelfType operator++(int) { + SelfType temp(*this); + ++*this; + return temp; + } + + SelfType operator--(int) { + SelfType temp(*this); + --*this; + return temp; + } + + SelfType& operator--() { + decrement(); + return *this; + } + + SelfType& operator++() { + increment(); + return *this; + } + + reference operator*() const { return deref(); } + + pointer operator->() const { return &deref(); } +}; + +} // namespace Json + + +namespace std { +/// Specialize std::swap() for Json::Value. +template<> +inline void swap(Json::Value& a, Json::Value& b) { a.swap(b); } +} + + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/value.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_READER_H_INCLUDED +#define CPPTL_JSON_READER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "features.h" +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +/** \brief Unserialize a JSON document into a + *Value. + * + * \deprecated Use CharReader and CharReaderBuilder. + */ +class JSON_API Reader { +public: + typedef char Char; + typedef const Char* Location; + + /** \brief An error tagged with where in the JSON text it was encountered. + * + * The offsets give the [start, limit) range of bytes within the text. Note + * that this is bytes, not codepoints. + * + */ + struct StructuredError { + size_t offset_start; + size_t offset_limit; + std::string message; + }; + + /** \brief Constructs a Reader allowing all features + * for parsing. + */ + Reader(); + + /** \brief Constructs a Reader allowing the specified feature set + * for parsing. + */ + Reader(const Features& features); + + /** \brief Read a Value from a JSON + * document. + * \param document UTF-8 encoded string containing the document to read. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + * back during + * serialization, \c false to discard comments. + * This parameter is ignored if + * Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + * error occurred. + */ + bool + parse(const std::string& document, Value& root, bool collectComments = true); + + /** \brief Read a Value from a JSON + document. + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the + document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the + document to read. + * Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param collectComments \c true to collect comment and allow writing them + back during + * serialization, \c false to discard comments. + * This parameter is ignored if + Features::allowComments_ + * is \c false. + * \return \c true if the document was successfully parsed, \c false if an + error occurred. + */ + bool parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments = true); + + /// \brief Parse from input stream. + /// \see Json::operator>>(std::istream&, Json::Value&). + bool parse(std::istream& is, Value& root, bool collectComments = true); + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + * \deprecated Use getFormattedErrorMessages() instead (typo fix). + */ + JSONCPP_DEPRECATED("Use getFormattedErrorMessages() instead.") + std::string getFormatedErrorMessages() const; + + /** \brief Returns a user friendly string that list errors in the parsed + * document. + * \return Formatted error message with the list of errors with their location + * in + * the parsed document. An empty string is returned if no error + * occurred + * during parsing. + */ + std::string getFormattedErrorMessages() const; + + /** \brief Returns a vector of structured erros encounted while parsing. + * \return A (possibly empty) vector of StructuredError objects. Currently + * only one error can be returned, but the caller should tolerate + * multiple + * errors. This can occur if the parser recovers from a non-fatal + * parse error and then encounters additional errors. + */ + std::vector getStructuredErrors() const; + + /** \brief Add a semantic error message. + * \param value JSON Value location associated with the error + * \param message The error message. + * \return \c true if the error was successfully added, \c false if the + * Value offset exceeds the document size. + */ + bool pushError(const Value& value, const std::string& message); + + /** \brief Add a semantic error message with extra context. + * \param value JSON Value location associated with the error + * \param message The error message. + * \param extra Additional JSON Value location to contextualize the error + * \return \c true if the error was successfully added, \c false if either + * Value offset exceeds the document size. + */ + bool pushError(const Value& value, const std::string& message, const Value& extra); + + /** \brief Return whether there are any errors. + * \return \c true if there are no errors to report \c false if + * errors have occurred. + */ + bool good() const; + +private: + enum TokenType { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool readToken(Token& token); + void skipSpaces(); + bool match(Location pattern, int patternLength); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + void readNumber(); + bool readValue(); + bool readObject(Token& token); + bool readArray(Token& token); + bool decodeNumber(Token& token); + bool decodeNumber(Token& token, Value& decoded); + bool decodeString(Token& token); + bool decodeString(Token& token, std::string& decoded); + bool decodeDouble(Token& token); + bool decodeDouble(Token& token, Value& decoded); + bool decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool addError(const std::string& message, Token& token, Location extra = 0); + bool recoverFromError(TokenType skipUntilToken); + bool addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken); + void skipUntilSpace(); + Value& currentValue(); + Char getNextChar(); + void + getLocationLineAndColumn(Location location, int& line, int& column) const; + std::string getLocationLineAndColumn(Location location) const; + std::string getLocationSnippet(Location location) const; + void addComment(Location begin, Location end, CommentPlacement placement); + void skipCommentTokens(Token& token); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value* lastValue_; + std::string commentsBefore_; + Features features_; + bool collectComments_; +}; // Reader + +/** Interface for reading JSON from a char array. + */ +class JSON_API CharReader { +public: + virtual ~CharReader() {} + /** \brief Read a Value from a JSON + document. + * The document must be a UTF-8 encoded string containing the document to read. + * + * \param beginDoc Pointer on the beginning of the UTF-8 encoded string of the + document to read. + * \param endDoc Pointer on the end of the UTF-8 encoded string of the + document to read. + * Must be >= beginDoc. + * \param root [out] Contains the root value of the document if it was + * successfully parsed. + * \param errs [out] Formatted error messages (if not NULL) + * a user friendly string that lists errors in the parsed + * document. + * \return \c true if the document was successfully parsed, \c false if an + error occurred. + */ + virtual bool parse( + char const* beginDoc, char const* endDoc, + Value* root, std::string* errs) = 0; + + class JSON_API Factory { + public: + virtual ~Factory() {} + /** \brief Allocate a CharReader via operator new(). + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + virtual CharReader* newCharReader() const = 0; + }; // Factory +}; // CharReader + +/** \brief Build a CharReader implementation. + +Usage: +\code + using namespace Json; + CharReaderBuilder builder; + builder["collectComments"] = false; + Value value; + std::string errs; + bool ok = parseFromStream(builder, std::cin, &value, &errs); +\endcode +*/ +class JSON_API CharReaderBuilder : public CharReader::Factory { +public: + // Note: We use a Json::Value so that we can add data-members to this class + // without a major version bump. + /** Configuration of this builder. + These are case-sensitive. + Available settings (case-sensitive): + - `"collectComments": false or true` + - true to collect comment and allow writing them + back during serialization, false to discard comments. + This parameter is ignored if allowComments is false. + - `"allowComments": false or true` + - true if comments are allowed. + - `"strictRoot": false or true` + - true if root must be either an array or an object value + - `"allowDroppedNullPlaceholders": false or true` + - true if dropped null placeholders are allowed. (See StreamWriterBuilder.) + - `"allowNumericKeys": false or true` + - true if numeric object keys are allowed. + - `"allowSingleQuotes": false or true` + - true if '' are allowed for strings (both keys and values) + - `"stackLimit": integer` + - Exceeding stackLimit (recursive depth of `readValue()`) will + cause an exception. + - This is a security issue (seg-faults caused by deeply nested JSON), + so the default is low. + - `"failIfExtra": false or true` + - If true, `parse()` returns false when extra non-whitespace trails + the JSON value in the input string. + - `"rejectDupKeys": false or true` + - If true, `parse()` returns false when a key is duplicated within an object. + - `"allowSpecialFloats": false or true` + - If true, special float values (NaNs and infinities) are allowed + and their values are lossfree restorable. + + You can examine 'settings_` yourself + to see the defaults. You can also write and read them just like any + JSON Value. + \sa setDefaults() + */ + Json::Value settings_; + + CharReaderBuilder(); + ~CharReaderBuilder(); + + CharReader* newCharReader() const; + + /** \return true if 'settings' are legal and consistent; + * otherwise, indicate bad settings via 'invalid'. + */ + bool validate(Json::Value* invalid) const; + + /** A simple way to update a specific setting. + */ + Value& operator[](std::string key); + + /** Called by ctor, but you can use this to reset settings_. + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderDefaults + */ + static void setDefaults(Json::Value* settings); + /** Same as old Features::strictMode(). + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_reader.cpp CharReaderBuilderStrictMode + */ + static void strictMode(Json::Value* settings); +}; + +/** Consume entire stream and use its begin/end. + * Someday we might have a real StreamReader, but for now this + * is convenient. + */ +bool JSON_API parseFromStream( + CharReader::Factory const&, + std::istream&, + Value* root, std::string* errs); + +/** \brief Read from 'sin' into 'root'. + + Always keep comments from the input JSON. + + This can be used to read a file into a particular sub-object. + For example: + \code + Json::Value root; + cin >> root["dir"]["file"]; + cout << root; + \endcode + Result: + \verbatim + { + "dir": { + "file": { + // The input stream JSON would be nested here. + } + } + } + \endverbatim + \throw std::exception on parse error. + \see Json::operator<<() +*/ +JSON_API std::istream& operator>>(std::istream&, Value&); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // CPPTL_JSON_READER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/reader.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef JSON_WRITER_H_INCLUDED +#define JSON_WRITER_H_INCLUDED + +#if !defined(JSON_IS_AMALGAMATION) +#include "value.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include + +// Disable warning C4251: : needs to have dll-interface to +// be used by... +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(push) +#pragma warning(disable : 4251) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +namespace Json { + +class Value; + +/** + +Usage: +\code + using namespace Json; + void writeToStdout(StreamWriter::Factory const& factory, Value const& value) { + std::unique_ptr const writer( + factory.newStreamWriter()); + writer->write(value, &std::cout); + std::cout << std::endl; // add lf and flush + } +\endcode +*/ +class JSON_API StreamWriter { +protected: + std::ostream* sout_; // not owned; will not delete +public: + StreamWriter(); + virtual ~StreamWriter(); + /** Write Value into document as configured in sub-class. + Do not take ownership of sout, but maintain a reference during function. + \pre sout != NULL + \return zero on success (For now, we always return zero, so check the stream instead.) + \throw std::exception possibly, depending on configuration + */ + virtual int write(Value const& root, std::ostream* sout) = 0; + + /** \brief A simple abstract factory. + */ + class JSON_API Factory { + public: + virtual ~Factory(); + /** \brief Allocate a CharReader via operator new(). + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + virtual StreamWriter* newStreamWriter() const = 0; + }; // Factory +}; // StreamWriter + +/** \brief Write into stringstream, then return string, for convenience. + * A StreamWriter will be created from the factory, used, and then deleted. + */ +std::string JSON_API writeString(StreamWriter::Factory const& factory, Value const& root); + + +/** \brief Build a StreamWriter implementation. + +Usage: +\code + using namespace Json; + Value value = ...; + StreamWriterBuilder builder; + builder["commentStyle"] = "None"; + builder["indentation"] = " "; // or whatever you like + std::unique_ptr writer( + builder.newStreamWriter()); + writer->write(value, &std::cout); + std::cout << std::endl; // add lf and flush +\endcode +*/ +class JSON_API StreamWriterBuilder : public StreamWriter::Factory { +public: + // Note: We use a Json::Value so that we can add data-members to this class + // without a major version bump. + /** Configuration of this builder. + Available settings (case-sensitive): + - "commentStyle": "None" or "All" + - "indentation": "" + - "enableYAMLCompatibility": false or true + - slightly change the whitespace around colons + - "dropNullPlaceholders": false or true + - Drop the "null" string from the writer's output for nullValues. + Strictly speaking, this is not valid JSON. But when the output is being + fed to a browser's Javascript, it makes for smaller output and the + browser can handle the output just fine. + - "useSpecialFloats": false or true + - If true, outputs non-finite floating point values in the following way: + NaN values as "NaN", positive infinity as "Infinity", and negative infinity + as "-Infinity". + + You can examine 'settings_` yourself + to see the defaults. You can also write and read them just like any + JSON Value. + \sa setDefaults() + */ + Json::Value settings_; + + StreamWriterBuilder(); + ~StreamWriterBuilder(); + + /** + * \throw std::exception if something goes wrong (e.g. invalid settings) + */ + StreamWriter* newStreamWriter() const; + + /** \return true if 'settings' are legal and consistent; + * otherwise, indicate bad settings via 'invalid'. + */ + bool validate(Json::Value* invalid) const; + /** A simple way to update a specific setting. + */ + Value& operator[](std::string key); + + /** Called by ctor, but you can use this to reset settings_. + * \pre 'settings' != NULL (but Json::null is fine) + * \remark Defaults: + * \snippet src/lib_json/json_writer.cpp StreamWriterBuilderDefaults + */ + static void setDefaults(Json::Value* settings); +}; + +/** \brief Abstract class for writers. + * \deprecated Use StreamWriter. (And really, this is an implementation detail.) + */ +class JSON_API Writer { +public: + virtual ~Writer(); + + virtual std::string write(const Value& root) = 0; +}; + +/** \brief Outputs a Value in JSON format + *without formatting (not human friendly). + * + * The JSON document is written in a single line. It is not intended for 'human' + *consumption, + * but may be usefull to support feature such as RPC where bandwith is limited. + * \sa Reader, Value + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API FastWriter : public Writer { + +public: + FastWriter(); + ~FastWriter() {} + + void enableYAMLCompatibility(); + + /** \brief Drop the "null" string from the writer's output for nullValues. + * Strictly speaking, this is not valid JSON. But when the output is being + * fed to a browser's Javascript, it makes for smaller output and the + * browser can handle the output just fine. + */ + void dropNullPlaceholders(); + + void omitEndingLineFeed(); + +public: // overridden from Writer + std::string write(const Value& root); + +private: + void writeValue(const Value& value); + + std::string document_; + bool yamlCompatiblityEnabled_; + bool dropNullPlaceholders_; + bool omitEndingLineFeed_; +}; + +/** \brief Writes a Value in JSON format in a + *human friendly way. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + *line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + *types, + * and all the values fit on one lines, then print the array on a single + *line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + *#CommentPlacement. + * + * \sa Reader, Value, Value::setComment() + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API StyledWriter : public Writer { +public: + StyledWriter(); + ~StyledWriter() {} + +public: // overridden from Writer + /** \brief Serialize a Value in JSON format. + * \param root Value to serialize. + * \return String containing the JSON document that represents the root value. + */ + std::string write(const Value& root); + +private: + void writeValue(const Value& value); + void writeArrayValue(const Value& value); + bool isMultineArray(const Value& value); + void pushValue(const std::string& value); + void writeIndent(); + void writeWithIndent(const std::string& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value& root); + void writeCommentAfterValueOnSameLine(const Value& root); + bool hasCommentForValue(const Value& value); + static std::string normalizeEOL(const std::string& text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string document_; + std::string indentString_; + int rightMargin_; + int indentSize_; + bool addChildValues_; +}; + +/** \brief Writes a Value in JSON format in a + human friendly way, + to a stream rather than to a string. + * + * The rules for line break and indent are as follow: + * - Object value: + * - if empty then print {} without indent and line break + * - if not empty the print '{', line break & indent, print one value per + line + * and then unindent and line break and print '}'. + * - Array value: + * - if empty then print [] without indent and line break + * - if the array contains no object value, empty array or some other value + types, + * and all the values fit on one lines, then print the array on a single + line. + * - otherwise, it the values do not fit on one line, or the array contains + * object or non empty array, then print one value per line. + * + * If the Value have comments then they are outputed according to their + #CommentPlacement. + * + * \param indentation Each level will be indented by this amount extra. + * \sa Reader, Value, Value::setComment() + * \deprecated Use StreamWriterBuilder. + */ +class JSON_API StyledStreamWriter { +public: + StyledStreamWriter(std::string indentation = "\t"); + ~StyledStreamWriter() {} + +public: + /** \brief Serialize a Value in JSON format. + * \param out Stream to write to. (Can be ostringstream, e.g.) + * \param root Value to serialize. + * \note There is no point in deriving from Writer, since write() should not + * return a value. + */ + void write(std::ostream& out, const Value& root); + +private: + void writeValue(const Value& value); + void writeArrayValue(const Value& value); + bool isMultineArray(const Value& value); + void pushValue(const std::string& value); + void writeIndent(); + void writeWithIndent(const std::string& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(const Value& root); + void writeCommentAfterValueOnSameLine(const Value& root); + bool hasCommentForValue(const Value& value); + static std::string normalizeEOL(const std::string& text); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::ostream* document_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + bool addChildValues_ : 1; + bool indented_ : 1; +}; + +#if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(Int value); +std::string JSON_API valueToString(UInt value); +#endif // if defined(JSON_HAS_INT64) +std::string JSON_API valueToString(LargestInt value); +std::string JSON_API valueToString(LargestUInt value); +std::string JSON_API valueToString(double value); +std::string JSON_API valueToString(bool value); +std::string JSON_API valueToQuotedString(const char* value); + +/// \brief Output using the StyledStreamWriter. +/// \see Json::operator>>() +JSON_API std::ostream& operator<<(std::ostream&, const Value& root); + +} // namespace Json + +#if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) +#pragma warning(pop) +#endif // if defined(JSONCPP_DISABLE_DLL_INTERFACE_WARNING) + +#endif // JSON_WRITER_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/writer.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED +#define CPPTL_JSON_ASSERTIONS_H_INCLUDED + +#include +#include + +#if !defined(JSON_IS_AMALGAMATION) +#include "config.h" +#endif // if !defined(JSON_IS_AMALGAMATION) + +/** It should not be possible for a maliciously designed file to + * cause an abort() or seg-fault, so these macros are used only + * for pre-condition violations and internal logic errors. + */ +#if JSON_USE_EXCEPTION + +// @todo <= add detail about condition in exception +# define JSON_ASSERT(condition) \ + {if (!(condition)) {Json::throwLogicError( "assert json failed" );}} + +# define JSON_FAIL_MESSAGE(message) \ + { \ + std::ostringstream oss; oss << message; \ + Json::throwLogicError(oss.str()); \ + abort(); \ + } + +#else // JSON_USE_EXCEPTION + +# define JSON_ASSERT(condition) assert(condition) + +// The call to assert() will show the failure message in debug builds. In +// release builds we abort, for a core-dump or debugger. +# define JSON_FAIL_MESSAGE(message) \ + { \ + std::ostringstream oss; oss << message; \ + assert(false && oss.str().c_str()); \ + abort(); \ + } + + +#endif + +#define JSON_ASSERT_MESSAGE(condition, message) \ + if (!(condition)) { \ + JSON_FAIL_MESSAGE(message); \ + } + +#endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: include/json/assertions.h +// ////////////////////////////////////////////////////////////////////// + + + + + +#endif //ifndef JSON_AMALGATED_H_INCLUDED diff --git a/contrib/openvr/src/jsoncpp.cpp b/contrib/openvr/src/jsoncpp.cpp new file mode 100755 index 0000000..e67d353 --- /dev/null +++ b/contrib/openvr/src/jsoncpp.cpp @@ -0,0 +1,5266 @@ +/// Json-cpp amalgated source (http://jsoncpp.sourceforge.net/). +/// It is intended to be used with #include "json/json.h" + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + +/* +The JsonCpp library's source code, including accompanying documentation, +tests and demonstration applications, are licensed under the following +conditions... + +The author (Baptiste Lepilleur) explicitly disclaims copyright in all +jurisdictions which recognize such a disclaimer. In such jurisdictions, +this software is released into the Public Domain. + +In jurisdictions which do not recognize Public Domain property (e.g. Germany as of +2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is +released under the terms of the MIT License (see below). + +In jurisdictions which recognize Public Domain property, the user of this +software may choose to accept it either as 1) Public Domain, 2) under the +conditions of the MIT License (see below), or 3) under the terms of dual +Public Domain/MIT License conditions described here, as they choose. + +The MIT License is about as close to Public Domain as a license can get, and is +described in clear, concise terms at: + + http://en.wikipedia.org/wiki/MIT_License + +The full text of the MIT License follows: + +======================================================================== +Copyright (c) 2007-2010 Baptiste Lepilleur + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +======================================================================== +(END LICENSE TEXT) + +The MIT license is compatible with both the GPL and commercial +software, affording one all of the rights of Public Domain with the +minor nuisance of being required to keep the above copyright notice +and license text in the source code. Note also that by accepting the +Public Domain "license" you can re-license your copy using whatever +license you like. + +*/ + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: LICENSE +// ////////////////////////////////////////////////////////////////////// + + + + + + +#include "json/json.h" + +#ifndef JSON_IS_AMALGAMATION +#error "Compile with -I PATH_TO_JSON_DIRECTORY" +#endif + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#ifndef LIB_JSONCPP_JSON_TOOL_H_INCLUDED +#define LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +/* This header provides common string manipulation support, such as UTF-8, + * portable conversion from/to string... + * + * It is an internal header that must not be exposed. + */ + +namespace Json { + +/// Converts a unicode code-point to UTF-8. +static inline std::string codePointToUTF8(unsigned int cp) { + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) { + result.resize(1); + result[0] = static_cast(cp); + } else if (cp <= 0x7FF) { + result.resize(2); + result[1] = static_cast(0x80 | (0x3f & cp)); + result[0] = static_cast(0xC0 | (0x1f & (cp >> 6))); + } else if (cp <= 0xFFFF) { + result.resize(3); + result[2] = static_cast(0x80 | (0x3f & cp)); + result[1] = static_cast(0x80 | (0x3f & (cp >> 6))); + result[0] = static_cast(0xE0 | (0xf & (cp >> 12))); + } else if (cp <= 0x10FFFF) { + result.resize(4); + result[3] = static_cast(0x80 | (0x3f & cp)); + result[2] = static_cast(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + +/// Returns true if ch is a control character (in range [1,31]). +static inline bool isControlCharacter(char ch) { return ch > 0 && ch <= 0x1F; } + +enum { + /// Constant that specify the size of the buffer that must be passed to + /// uintToString. + uintToStringBufferSize = 3 * sizeof(LargestUInt) + 1 +}; + +// Defines a char buffer for use with uintToString(). +typedef char UIntToStringBuffer[uintToStringBufferSize]; + +/** Converts an unsigned integer to string. + * @param value Unsigned interger to convert to string + * @param current Input/Output string buffer. + * Must have at least uintToStringBufferSize chars free. + */ +static inline void uintToString(LargestUInt value, char*& current) { + *--current = 0; + do { + *--current = static_cast(value % 10U + static_cast('0')); + value /= 10; + } while (value != 0); +} + +/** Change ',' to '.' everywhere in buffer. + * + * We had a sophisticated way, but it did not work in WinCE. + * @see https://github.com/open-source-parsers/jsoncpp/pull/9 + */ +static inline void fixNumericLocale(char* begin, char* end) { + while (begin < end) { + if (*begin == ',') { + *begin = '.'; + } + ++begin; + } +} + +} // namespace Json { + +#endif // LIB_JSONCPP_JSON_TOOL_H_INCLUDED + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_tool.h +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above +#define snprintf sprintf_s +#elif _MSC_VER >= 1900 // VC++ 14.0 and above +#define snprintf std::snprintf +#else +#define snprintf _snprintf +#endif +#elif defined(__ANDROID__) || defined(__QNXNTO__) +#define snprintf snprintf +#elif __cplusplus >= 201103L +#define snprintf std::snprintf +#endif + +#if defined(__QNXNTO__) +#define sscanf std::sscanf +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +static int const stackLimit_g = 1000; +static int stackDepth_g = 0; // see readValue() + +namespace Json { + +#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) +typedef std::unique_ptr CharReaderPtr; +#else +typedef std::auto_ptr CharReaderPtr; +#endif + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_(true), strictRoot_(false), + allowDroppedNullPlaceholders_(false), allowNumericKeys_(false) {} + +Features Features::all() { return Features(); } + +Features Features::strictMode() { + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + features.allowDroppedNullPlaceholders_ = false; + features.allowNumericKeys_ = false; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + +static bool containsNewLine(Reader::Location begin, Reader::Location end) { + for (; begin < end; ++begin) + if (*begin == '\n' || *begin == '\r') + return true; + return false; +} + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(Features::all()), + collectComments_() {} + +Reader::Reader(const Features& features) + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), features_(features), collectComments_() { +} + +bool +Reader::parse(const std::string& document, Value& root, bool collectComments) { + document_ = document; + const char* begin = document_.c_str(); + const char* end = begin + document_.length(); + return parse(begin, end, root, collectComments); +} + +bool Reader::parse(std::istream& sin, Value& root, bool collectComments) { + // std::istream_iterator begin(sin); + // std::istream_iterator end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse(doc, root, collectComments); +} + +bool Reader::parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments) { + if (!features_.allowComments_) { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while (!nodes_.empty()) + nodes_.pop(); + nodes_.push(&root); + + stackDepth_g = 0; // Yes, this is bad coding, but options are limited. + bool successful = readValue(); + Token token; + skipCommentTokens(token); + if (collectComments_ && !commentsBefore_.empty()) + root.setComment(commentsBefore_, commentAfter); + if (features_.strictRoot_) { + if (!root.isArray() && !root.isObject()) { + // Set error location to start of doc, ideally should be first token found + // in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( + "A valid JSON document must be either an array or an object value.", + token); + return false; + } + } + return successful; +} + +bool Reader::readValue() { + // This is a non-reentrant way to support a stackLimit. Terrible! + // But this deprecated class has a security problem: Bad input can + // cause a seg-fault. This seems like a fair, binary-compatible way + // to prevent the problem. + if (stackDepth_g >= stackLimit_g) throwRuntimeError("Exceeded stackLimit in readValue()."); + ++stackDepth_g; + + Token token; + skipCommentTokens(token); + bool successful = true; + + if (collectComments_ && !commentsBefore_.empty()) { + currentValue().setComment(commentsBefore_, commentBefore); + commentsBefore_ = ""; + } + + switch (token.type_) { + case tokenObjectBegin: + successful = readObject(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenArrayBegin: + successful = readArray(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenNumber: + successful = decodeNumber(token); + break; + case tokenString: + successful = decodeString(token); + break; + case tokenTrue: + { + Value v(true); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenFalse: + { + Value v(false); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNull: + { + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenArraySeparator: + case tokenObjectEnd: + case tokenArrayEnd: + if (features_.allowDroppedNullPlaceholders_) { + // "Un-read" the current token and mark the current value as a null + // token. + current_--; + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(current_ - begin_ - 1); + currentValue().setOffsetLimit(current_ - begin_); + break; + } // Else, fall through... + default: + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return addError("Syntax error: value, object or array expected.", token); + } + + if (collectComments_) { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + --stackDepth_g; + return successful; +} + +void Reader::skipCommentTokens(Token& token) { + if (features_.allowComments_) { + do { + readToken(token); + } while (token.type_ == tokenComment); + } else { + readToken(token); + } +} + +bool Reader::readToken(Token& token) { + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch (c) { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match("rue", 3); + break; + case 'f': + token.type_ = tokenFalse; + ok = match("alse", 4); + break; + case 'n': + token.type_ = tokenNull; + ok = match("ull", 3); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if (!ok) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + +void Reader::skipSpaces() { + while (current_ != end_) { + Char c = *current_; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + ++current_; + else + break; + } +} + +bool Reader::match(Location pattern, int patternLength) { + if (end_ - current_ < patternLength) + return false; + int index = patternLength; + while (index--) + if (current_[index] != pattern[index]) + return false; + current_ += patternLength; + return true; +} + +bool Reader::readComment() { + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if (c == '*') + successful = readCStyleComment(); + else if (c == '/') + successful = readCppStyleComment(); + if (!successful) + return false; + + if (collectComments_) { + CommentPlacement placement = commentBefore; + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { + if (c != '*' || !containsNewLine(commentBegin, current_)) + placement = commentAfterOnSameLine; + } + + addComment(commentBegin, current_, placement); + } + return true; +} + +static std::string normalizeEOL(Reader::Location begin, Reader::Location end) { + std::string normalized; + normalized.reserve(end - begin); + Reader::Location current = begin; + while (current != end) { + char c = *current++; + if (c == '\r') { + if (current != end && *current == '\n') + // convert dos EOL + ++current; + // convert Mac EOL + normalized += '\n'; + } else { + normalized += c; + } + } + return normalized; +} + +void +Reader::addComment(Location begin, Location end, CommentPlacement placement) { + assert(collectComments_); + const std::string& normalized = normalizeEOL(begin, end); + if (placement == commentAfterOnSameLine) { + assert(lastValue_ != 0); + lastValue_->setComment(normalized, placement); + } else { + commentsBefore_ += normalized; + } +} + +bool Reader::readCStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '*' && *current_ == '/') + break; + } + return getNextChar() == '/'; +} + +bool Reader::readCppStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '\n') + break; + if (c == '\r') { + // Consume DOS EOL. It will be normalized in addComment. + if (current_ != end_ && *current_ == '\n') + getNextChar(); + // Break on Moc OS 9 EOL. + break; + } + } + return true; +} + +void Reader::readNumber() { + const char *p = current_; + char c = '0'; // stopgap for already consumed character + // integral part + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + // fractional part + if (c == '.') { + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } + // exponential part + if (c == 'e' || c == 'E') { + c = (current_ = p) < end_ ? *p++ : 0; + if (c == '+' || c == '-') + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } +} + +bool Reader::readString() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '"') + break; + } + return c == '"'; +} + +bool Reader::readObject(Token& tokenStart) { + Token tokenName; + std::string name; + Value init(objectValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + while (readToken(tokenName)) { + bool initialTokenOk = true; + while (tokenName.type_ == tokenComment && initialTokenOk) + initialTokenOk = readToken(tokenName); + if (!initialTokenOk) + break; + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object + return true; + name = ""; + if (tokenName.type_ == tokenString) { + if (!decodeString(tokenName, name)) + return recoverFromError(tokenObjectEnd); + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { + Value numberName; + if (!decodeNumber(tokenName, numberName)) + return recoverFromError(tokenObjectEnd); + name = numberName.asString(); + } else { + break; + } + + Token colon; + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { + return addErrorAndRecover( + "Missing ':' after object member name", colon, tokenObjectEnd); + } + Value& value = currentValue()[name]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenObjectEnd); + + Token comma; + if (!readToken(comma) || + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment)) { + return addErrorAndRecover( + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); + } + bool finalizeTokenOk = true; + while (comma.type_ == tokenComment && finalizeTokenOk) + finalizeTokenOk = readToken(comma); + if (comma.type_ == tokenObjectEnd) + return true; + } + return addErrorAndRecover( + "Missing '}' or object member name", tokenName, tokenObjectEnd); +} + +bool Reader::readArray(Token& tokenStart) { + Value init(arrayValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + skipSpaces(); + if (*current_ == ']') // empty array + { + Token endArray; + readToken(endArray); + return true; + } + int index = 0; + for (;;) { + Value& value = currentValue()[index++]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenArrayEnd); + + Token token; + // Accept Comment after last item in the array. + ok = readToken(token); + while (token.type_ == tokenComment && ok) { + ok = readToken(token); + } + bool badTokenType = + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); + if (!ok || badTokenType) { + return addErrorAndRecover( + "Missing ',' or ']' in array declaration", token, tokenArrayEnd); + } + if (token.type_ == tokenArrayEnd) + break; + } + return true; +} + +bool Reader::decodeNumber(Token& token) { + Value decoded; + if (!decodeNumber(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeNumber(Token& token, Value& decoded) { + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if (isNegative) + ++current; + // TODO: Help the compiler do the div and mod at compile time or get rid of them. + Value::LargestUInt maxIntegerValue = + isNegative ? Value::LargestUInt(Value::maxLargestInt) + 1 + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while (current < token.end_) { + Char c = *current++; + if (c < '0' || c > '9') + return decodeDouble(token, decoded); + Value::UInt digit(c - '0'); + if (value >= threshold) { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || current != token.end_ || + digit > maxIntegerValue % 10) { + return decodeDouble(token, decoded); + } + } + value = value * 10 + digit; + } + if (isNegative && value == maxIntegerValue) + decoded = Value::minLargestInt; + else if (isNegative) + decoded = -Value::LargestInt(value); + else if (value <= Value::LargestUInt(Value::maxInt)) + decoded = Value::LargestInt(value); + else + decoded = value; + return true; +} + +bool Reader::decodeDouble(Token& token) { + Value decoded; + if (!decodeDouble(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeDouble(Token& token, Value& decoded) { + double value = 0; + std::string buffer(token.start_, token.end_); + std::istringstream is(buffer); + if (!(is >> value)) + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + decoded = value; + return true; +} + +bool Reader::decodeString(Token& token) { + std::string decoded_string; + if (!decodeString(token, decoded_string)) + return false; + Value decoded(decoded_string); + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool Reader::decodeString(Token& token, std::string& decoded) { + decoded.reserve(token.end_ - token.start_ - 2); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while (current != end) { + Char c = *current++; + if (c == '"') + break; + else if (c == '\\') { + if (current == end) + return addError("Empty escape sequence in string", token, current); + Char escape = *current++; + switch (escape) { + case '"': + decoded += '"'; + break; + case '/': + decoded += '/'; + break; + case '\\': + decoded += '\\'; + break; + case 'b': + decoded += '\b'; + break; + case 'f': + decoded += '\f'; + break; + case 'n': + decoded += '\n'; + break; + case 'r': + decoded += '\r'; + break; + case 't': + decoded += '\t'; + break; + case 'u': { + unsigned int unicode; + if (!decodeUnicodeCodePoint(token, current, end, unicode)) + return false; + decoded += codePointToUTF8(unicode); + } break; + default: + return addError("Bad escape sequence in string", token, current); + } + } else { + decoded += c; + } + } + return true; +} + +bool Reader::decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + + if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) { + // surrogate pairs + if (end - current < 6) + return addError( + "additional six characters expected to parse unicode surrogate pair.", + token, + current); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++) == 'u') { + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } else + return false; + } else + return addError("expecting another \\u token to begin the second half of " + "a unicode surrogate pair", + token, + current); + } + return true; +} + +bool Reader::decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + if (end - current < 4) + return addError( + "Bad unicode escape sequence in string: four digits expected.", + token, + current); + unicode = 0; + for (int index = 0; index < 4; ++index) { + Char c = *current++; + unicode *= 16; + if (c >= '0' && c <= '9') + unicode += c - '0'; + else if (c >= 'a' && c <= 'f') + unicode += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + unicode += c - 'A' + 10; + else + return addError( + "Bad unicode escape sequence in string: hexadecimal digit expected.", + token, + current); + } + return true; +} + +bool +Reader::addError(const std::string& message, Token& token, Location extra) { + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back(info); + return false; +} + +bool Reader::recoverFromError(TokenType skipUntilToken) { + int errorCount = int(errors_.size()); + Token skip; + for (;;) { + if (!readToken(skip)) + errors_.resize(errorCount); // discard errors caused by recovery + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) + break; + } + errors_.resize(errorCount); + return false; +} + +bool Reader::addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken) { + addError(message, token); + return recoverFromError(skipUntilToken); +} + +Value& Reader::currentValue() { return *(nodes_.top()); } + +Reader::Char Reader::getNextChar() { + if (current_ == end_) + return 0; + return *current_++; +} + +void Reader::getLocationLineAndColumn(Location location, + int& line, + int& column) const { + Location current = begin_; + Location lastLineStart = current; + line = 0; + while (current < location && current != end_) { + Char c = *current++; + if (c == '\r') { + if (*current == '\n') + ++current; + lastLineStart = current; + ++line; + } else if (c == '\n') { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + +std::string Reader::getLocationLineAndColumn(Location location) const { + int line, column; + getLocationLineAndColumn(location, line, column); + char buffer[18 + 16 + 16 + 1]; + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); + return buffer; +} + +std::string Reader::getLocationSnippet(Location location) const { + std::string snippet = ""; + std::istringstream docStream(document_); + int lin, col; + getLocationLineAndColumn(location, lin, col); + std::string line; + for (int i=1; i Reader::getStructuredErrors() const { + std::vector allErrors; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + Reader::StructuredError structured; + structured.offset_start = error.token_.start_ - begin_; + structured.offset_limit = error.token_.end_ - begin_; + structured.message = error.message_; + allErrors.push_back(structured); + } + return allErrors; +} + +bool Reader::pushError(const Value& value, const std::string& message) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = end_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = 0; + errors_.push_back(info); + return true; +} + +bool Reader::pushError(const Value& value, const std::string& message, const Value& extra) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length + || extra.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = begin_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = begin_ + extra.getOffsetStart(); + errors_.push_back(info); + return true; +} + +bool Reader::good() const { + return !errors_.size(); +} + +// exact copy of Features +class OurFeatures { +public: + static OurFeatures all(); + bool allowComments_; + bool strictRoot_; + bool allowDroppedNullPlaceholders_; + bool allowNumericKeys_; + bool allowSingleQuotes_; + bool failIfExtra_; + bool rejectDupKeys_; + bool allowSpecialFloats_; + int stackLimit_; +}; // OurFeatures + +// exact copy of Implementation of class Features +// //////////////////////////////// + +OurFeatures OurFeatures::all() { return OurFeatures(); } + +// Implementation of class Reader +// //////////////////////////////// + +// exact copy of Reader, renamed to OurReader +class OurReader { +public: + typedef char Char; + typedef const Char* Location; + struct StructuredError { + size_t offset_start; + size_t offset_limit; + std::string message; + }; + + OurReader(OurFeatures const& features); + bool parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments = true); + std::string getFormattedErrorMessages() const; + std::vector getStructuredErrors() const; + bool pushError(const Value& value, const std::string& message); + bool pushError(const Value& value, const std::string& message, const Value& extra); + bool good() const; + +private: + OurReader(OurReader const&); // no impl + void operator=(OurReader const&); // no impl + + enum TokenType { + tokenEndOfStream = 0, + tokenObjectBegin, + tokenObjectEnd, + tokenArrayBegin, + tokenArrayEnd, + tokenString, + tokenNumber, + tokenTrue, + tokenFalse, + tokenNull, + tokenNaN, + tokenPosInf, + tokenNegInf, + tokenArraySeparator, + tokenMemberSeparator, + tokenComment, + tokenError + }; + + class Token { + public: + TokenType type_; + Location start_; + Location end_; + }; + + class ErrorInfo { + public: + Token token_; + std::string message_; + Location extra_; + }; + + typedef std::deque Errors; + + bool readToken(Token& token); + void skipSpaces(); + bool match(Location pattern, int patternLength); + bool readComment(); + bool readCStyleComment(); + bool readCppStyleComment(); + bool readString(); + bool readStringSingleQuote(); + bool readNumber(bool checkInf); + bool readValue(); + bool readObject(Token& token); + bool readArray(Token& token); + bool decodeNumber(Token& token); + bool decodeNumber(Token& token, Value& decoded); + bool decodeString(Token& token); + bool decodeString(Token& token, std::string& decoded); + bool decodeDouble(Token& token); + bool decodeDouble(Token& token, Value& decoded); + bool decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode); + bool addError(const std::string& message, Token& token, Location extra = 0); + bool recoverFromError(TokenType skipUntilToken); + bool addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken); + void skipUntilSpace(); + Value& currentValue(); + Char getNextChar(); + void + getLocationLineAndColumn(Location location, int& line, int& column) const; + std::string getLocationLineAndColumn(Location location) const; + void addComment(Location begin, Location end, CommentPlacement placement); + void skipCommentTokens(Token& token); + + typedef std::stack Nodes; + Nodes nodes_; + Errors errors_; + std::string document_; + Location begin_; + Location end_; + Location current_; + Location lastValueEnd_; + Value* lastValue_; + std::string commentsBefore_; + int stackDepth_; + + OurFeatures const features_; + bool collectComments_; +}; // OurReader + +// complete copy of Read impl, for OurReader + +OurReader::OurReader(OurFeatures const& features) + : errors_(), document_(), begin_(), end_(), current_(), lastValueEnd_(), + lastValue_(), commentsBefore_(), + stackDepth_(0), + features_(features), collectComments_() { +} + +bool OurReader::parse(const char* beginDoc, + const char* endDoc, + Value& root, + bool collectComments) { + if (!features_.allowComments_) { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while (!nodes_.empty()) + nodes_.pop(); + nodes_.push(&root); + + stackDepth_ = 0; + bool successful = readValue(); + Token token; + skipCommentTokens(token); + if (features_.failIfExtra_) { + if (token.type_ != tokenError && token.type_ != tokenEndOfStream) { + addError("Extra non-whitespace after JSON value.", token); + return false; + } + } + if (collectComments_ && !commentsBefore_.empty()) + root.setComment(commentsBefore_, commentAfter); + if (features_.strictRoot_) { + if (!root.isArray() && !root.isObject()) { + // Set error location to start of doc, ideally should be first token found + // in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( + "A valid JSON document must be either an array or an object value.", + token); + return false; + } + } + return successful; +} + +bool OurReader::readValue() { + if (stackDepth_ >= features_.stackLimit_) throwRuntimeError("Exceeded stackLimit in readValue()."); + ++stackDepth_; + Token token; + skipCommentTokens(token); + bool successful = true; + + if (collectComments_ && !commentsBefore_.empty()) { + currentValue().setComment(commentsBefore_, commentBefore); + commentsBefore_ = ""; + } + + switch (token.type_) { + case tokenObjectBegin: + successful = readObject(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenArrayBegin: + successful = readArray(token); + currentValue().setOffsetLimit(current_ - begin_); + break; + case tokenNumber: + successful = decodeNumber(token); + break; + case tokenString: + successful = decodeString(token); + break; + case tokenTrue: + { + Value v(true); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenFalse: + { + Value v(false); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNull: + { + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNaN: + { + Value v(std::numeric_limits::quiet_NaN()); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenPosInf: + { + Value v(std::numeric_limits::infinity()); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenNegInf: + { + Value v(-std::numeric_limits::infinity()); + currentValue().swapPayload(v); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + } + break; + case tokenArraySeparator: + case tokenObjectEnd: + case tokenArrayEnd: + if (features_.allowDroppedNullPlaceholders_) { + // "Un-read" the current token and mark the current value as a null + // token. + current_--; + Value v; + currentValue().swapPayload(v); + currentValue().setOffsetStart(current_ - begin_ - 1); + currentValue().setOffsetLimit(current_ - begin_); + break; + } // else, fall through ... + default: + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return addError("Syntax error: value, object or array expected.", token); + } + + if (collectComments_) { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + --stackDepth_; + return successful; +} + +void OurReader::skipCommentTokens(Token& token) { + if (features_.allowComments_) { + do { + readToken(token); + } while (token.type_ == tokenComment); + } else { + readToken(token); + } +} + +bool OurReader::readToken(Token& token) { + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch (c) { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '\'': + if (features_.allowSingleQuotes_) { + token.type_ = tokenString; + ok = readStringSingleQuote(); + break; + } // else continue + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + token.type_ = tokenNumber; + readNumber(false); + break; + case '-': + if (readNumber(true)) { + token.type_ = tokenNumber; + } else { + token.type_ = tokenNegInf; + ok = features_.allowSpecialFloats_ && match("nfinity", 7); + } + break; + case 't': + token.type_ = tokenTrue; + ok = match("rue", 3); + break; + case 'f': + token.type_ = tokenFalse; + ok = match("alse", 4); + break; + case 'n': + token.type_ = tokenNull; + ok = match("ull", 3); + break; + case 'N': + if (features_.allowSpecialFloats_) { + token.type_ = tokenNaN; + ok = match("aN", 2); + } else { + ok = false; + } + break; + case 'I': + if (features_.allowSpecialFloats_) { + token.type_ = tokenPosInf; + ok = match("nfinity", 7); + } else { + ok = false; + } + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if (!ok) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + +void OurReader::skipSpaces() { + while (current_ != end_) { + Char c = *current_; + if (c == ' ' || c == '\t' || c == '\r' || c == '\n') + ++current_; + else + break; + } +} + +bool OurReader::match(Location pattern, int patternLength) { + if (end_ - current_ < patternLength) + return false; + int index = patternLength; + while (index--) + if (current_[index] != pattern[index]) + return false; + current_ += patternLength; + return true; +} + +bool OurReader::readComment() { + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if (c == '*') + successful = readCStyleComment(); + else if (c == '/') + successful = readCppStyleComment(); + if (!successful) + return false; + + if (collectComments_) { + CommentPlacement placement = commentBefore; + if (lastValueEnd_ && !containsNewLine(lastValueEnd_, commentBegin)) { + if (c != '*' || !containsNewLine(commentBegin, current_)) + placement = commentAfterOnSameLine; + } + + addComment(commentBegin, current_, placement); + } + return true; +} + +void +OurReader::addComment(Location begin, Location end, CommentPlacement placement) { + assert(collectComments_); + const std::string& normalized = normalizeEOL(begin, end); + if (placement == commentAfterOnSameLine) { + assert(lastValue_ != 0); + lastValue_->setComment(normalized, placement); + } else { + commentsBefore_ += normalized; + } +} + +bool OurReader::readCStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '*' && *current_ == '/') + break; + } + return getNextChar() == '/'; +} + +bool OurReader::readCppStyleComment() { + while (current_ != end_) { + Char c = getNextChar(); + if (c == '\n') + break; + if (c == '\r') { + // Consume DOS EOL. It will be normalized in addComment. + if (current_ != end_ && *current_ == '\n') + getNextChar(); + // Break on Moc OS 9 EOL. + break; + } + } + return true; +} + +bool OurReader::readNumber(bool checkInf) { + const char *p = current_; + if (checkInf && p != end_ && *p == 'I') { + current_ = ++p; + return false; + } + char c = '0'; // stopgap for already consumed character + // integral part + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + // fractional part + if (c == '.') { + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } + // exponential part + if (c == 'e' || c == 'E') { + c = (current_ = p) < end_ ? *p++ : 0; + if (c == '+' || c == '-') + c = (current_ = p) < end_ ? *p++ : 0; + while (c >= '0' && c <= '9') + c = (current_ = p) < end_ ? *p++ : 0; + } + return true; +} +bool OurReader::readString() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '"') + break; + } + return c == '"'; +} + + +bool OurReader::readStringSingleQuote() { + Char c = 0; + while (current_ != end_) { + c = getNextChar(); + if (c == '\\') + getNextChar(); + else if (c == '\'') + break; + } + return c == '\''; +} + +bool OurReader::readObject(Token& tokenStart) { + Token tokenName; + std::string name; + Value init(objectValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + while (readToken(tokenName)) { + bool initialTokenOk = true; + while (tokenName.type_ == tokenComment && initialTokenOk) + initialTokenOk = readToken(tokenName); + if (!initialTokenOk) + break; + if (tokenName.type_ == tokenObjectEnd && name.empty()) // empty object + return true; + name = ""; + if (tokenName.type_ == tokenString) { + if (!decodeString(tokenName, name)) + return recoverFromError(tokenObjectEnd); + } else if (tokenName.type_ == tokenNumber && features_.allowNumericKeys_) { + Value numberName; + if (!decodeNumber(tokenName, numberName)) + return recoverFromError(tokenObjectEnd); + name = numberName.asString(); + } else { + break; + } + + Token colon; + if (!readToken(colon) || colon.type_ != tokenMemberSeparator) { + return addErrorAndRecover( + "Missing ':' after object member name", colon, tokenObjectEnd); + } + if (name.length() >= (1U<<30)) throwRuntimeError("keylength >= 2^30"); + if (features_.rejectDupKeys_ && currentValue().isMember(name)) { + std::string msg = "Duplicate key: '" + name + "'"; + return addErrorAndRecover( + msg, tokenName, tokenObjectEnd); + } + Value& value = currentValue()[name]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenObjectEnd); + + Token comma; + if (!readToken(comma) || + (comma.type_ != tokenObjectEnd && comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment)) { + return addErrorAndRecover( + "Missing ',' or '}' in object declaration", comma, tokenObjectEnd); + } + bool finalizeTokenOk = true; + while (comma.type_ == tokenComment && finalizeTokenOk) + finalizeTokenOk = readToken(comma); + if (comma.type_ == tokenObjectEnd) + return true; + } + return addErrorAndRecover( + "Missing '}' or object member name", tokenName, tokenObjectEnd); +} + +bool OurReader::readArray(Token& tokenStart) { + Value init(arrayValue); + currentValue().swapPayload(init); + currentValue().setOffsetStart(tokenStart.start_ - begin_); + skipSpaces(); + if (*current_ == ']') // empty array + { + Token endArray; + readToken(endArray); + return true; + } + int index = 0; + for (;;) { + Value& value = currentValue()[index++]; + nodes_.push(&value); + bool ok = readValue(); + nodes_.pop(); + if (!ok) // error already set + return recoverFromError(tokenArrayEnd); + + Token token; + // Accept Comment after last item in the array. + ok = readToken(token); + while (token.type_ == tokenComment && ok) { + ok = readToken(token); + } + bool badTokenType = + (token.type_ != tokenArraySeparator && token.type_ != tokenArrayEnd); + if (!ok || badTokenType) { + return addErrorAndRecover( + "Missing ',' or ']' in array declaration", token, tokenArrayEnd); + } + if (token.type_ == tokenArrayEnd) + break; + } + return true; +} + +bool OurReader::decodeNumber(Token& token) { + Value decoded; + if (!decodeNumber(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeNumber(Token& token, Value& decoded) { + // Attempts to parse the number as an integer. If the number is + // larger than the maximum supported value of an integer then + // we decode the number as a double. + Location current = token.start_; + bool isNegative = *current == '-'; + if (isNegative) + ++current; + // TODO: Help the compiler do the div and mod at compile time or get rid of them. + Value::LargestUInt maxIntegerValue = + isNegative ? Value::LargestUInt(-Value::minLargestInt) + : Value::maxLargestUInt; + Value::LargestUInt threshold = maxIntegerValue / 10; + Value::LargestUInt value = 0; + while (current < token.end_) { + Char c = *current++; + if (c < '0' || c > '9') + return decodeDouble(token, decoded); + Value::UInt digit(c - '0'); + if (value >= threshold) { + // We've hit or exceeded the max value divided by 10 (rounded down). If + // a) we've only just touched the limit, b) this is the last digit, and + // c) it's small enough to fit in that rounding delta, we're okay. + // Otherwise treat this number as a double to avoid overflow. + if (value > threshold || current != token.end_ || + digit > maxIntegerValue % 10) { + return decodeDouble(token, decoded); + } + } + value = value * 10 + digit; + } + if (isNegative) + decoded = -Value::LargestInt(value); + else if (value <= Value::LargestUInt(Value::maxInt)) + decoded = Value::LargestInt(value); + else + decoded = value; + return true; +} + +bool OurReader::decodeDouble(Token& token) { + Value decoded; + if (!decodeDouble(token, decoded)) + return false; + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeDouble(Token& token, Value& decoded) { + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + + // Sanity check to avoid buffer overflow exploits. + if (length < 0) { + return addError("Unable to parse token length", token); + } + + // Avoid using a string constant for the format control string given to + // sscanf, as this can cause hard to debug crashes on OS X. See here for more + // info: + // + // http://developer.apple.com/library/mac/#DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Incompatibilities.html + char format[] = "%lf"; + + if (length <= bufferSize) { + Char buffer[bufferSize + 1]; + memcpy(buffer, token.start_, length); + buffer[length] = 0; + count = sscanf(buffer, format, &value); + } else { + std::string buffer(token.start_, token.end_); + count = sscanf(buffer.c_str(), format, &value); + } + + if (count != 1) + return addError("'" + std::string(token.start_, token.end_) + + "' is not a number.", + token); + decoded = value; + return true; +} + +bool OurReader::decodeString(Token& token) { + std::string decoded_string; + if (!decodeString(token, decoded_string)) + return false; + Value decoded(decoded_string); + currentValue().swapPayload(decoded); + currentValue().setOffsetStart(token.start_ - begin_); + currentValue().setOffsetLimit(token.end_ - begin_); + return true; +} + +bool OurReader::decodeString(Token& token, std::string& decoded) { + decoded.reserve(token.end_ - token.start_ - 2); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while (current != end) { + Char c = *current++; + if (c == '"') + break; + else if (c == '\\') { + if (current == end) + return addError("Empty escape sequence in string", token, current); + Char escape = *current++; + switch (escape) { + case '"': + decoded += '"'; + break; + case '/': + decoded += '/'; + break; + case '\\': + decoded += '\\'; + break; + case 'b': + decoded += '\b'; + break; + case 'f': + decoded += '\f'; + break; + case 'n': + decoded += '\n'; + break; + case 'r': + decoded += '\r'; + break; + case 't': + decoded += '\t'; + break; + case 'u': { + unsigned int unicode; + if (!decodeUnicodeCodePoint(token, current, end, unicode)) + return false; + decoded += codePointToUTF8(unicode); + } break; + default: + return addError("Bad escape sequence in string", token, current); + } + } else { + decoded += c; + } + } + return true; +} + +bool OurReader::decodeUnicodeCodePoint(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + + if (!decodeUnicodeEscapeSequence(token, current, end, unicode)) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) { + // surrogate pairs + if (end - current < 6) + return addError( + "additional six characters expected to parse unicode surrogate pair.", + token, + current); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++) == 'u') { + if (decodeUnicodeEscapeSequence(token, current, end, surrogatePair)) { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } else + return false; + } else + return addError("expecting another \\u token to begin the second half of " + "a unicode surrogate pair", + token, + current); + } + return true; +} + +bool OurReader::decodeUnicodeEscapeSequence(Token& token, + Location& current, + Location end, + unsigned int& unicode) { + if (end - current < 4) + return addError( + "Bad unicode escape sequence in string: four digits expected.", + token, + current); + unicode = 0; + for (int index = 0; index < 4; ++index) { + Char c = *current++; + unicode *= 16; + if (c >= '0' && c <= '9') + unicode += c - '0'; + else if (c >= 'a' && c <= 'f') + unicode += c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + unicode += c - 'A' + 10; + else + return addError( + "Bad unicode escape sequence in string: hexadecimal digit expected.", + token, + current); + } + return true; +} + +bool +OurReader::addError(const std::string& message, Token& token, Location extra) { + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back(info); + return false; +} + +bool OurReader::recoverFromError(TokenType skipUntilToken) { + int errorCount = int(errors_.size()); + Token skip; + for (;;) { + if (!readToken(skip)) + errors_.resize(errorCount); // discard errors caused by recovery + if (skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream) + break; + } + errors_.resize(errorCount); + return false; +} + +bool OurReader::addErrorAndRecover(const std::string& message, + Token& token, + TokenType skipUntilToken) { + addError(message, token); + return recoverFromError(skipUntilToken); +} + +Value& OurReader::currentValue() { return *(nodes_.top()); } + +OurReader::Char OurReader::getNextChar() { + if (current_ == end_) + return 0; + return *current_++; +} + +void OurReader::getLocationLineAndColumn(Location location, + int& line, + int& column) const { + Location current = begin_; + Location lastLineStart = current; + line = 0; + while (current < location && current != end_) { + Char c = *current++; + if (c == '\r') { + if (*current == '\n') + ++current; + lastLineStart = current; + ++line; + } else if (c == '\n') { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + +std::string OurReader::getLocationLineAndColumn(Location location) const { + int line, column; + getLocationLineAndColumn(location, line, column); + char buffer[18 + 16 + 16 + 1]; + snprintf(buffer, sizeof(buffer), "Line %d, Column %d", line, column); + return buffer; +} + +std::string OurReader::getFormattedErrorMessages() const { + std::string formattedMessage; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + formattedMessage += + "* " + getLocationLineAndColumn(error.token_.start_) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if (error.extra_) + formattedMessage += + "See " + getLocationLineAndColumn(error.extra_) + " for detail.\n"; + } + return formattedMessage; +} + +std::vector OurReader::getStructuredErrors() const { + std::vector allErrors; + for (Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError) { + const ErrorInfo& error = *itError; + OurReader::StructuredError structured; + structured.offset_start = error.token_.start_ - begin_; + structured.offset_limit = error.token_.end_ - begin_; + structured.message = error.message_; + allErrors.push_back(structured); + } + return allErrors; +} + +bool OurReader::pushError(const Value& value, const std::string& message) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = end_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = 0; + errors_.push_back(info); + return true; +} + +bool OurReader::pushError(const Value& value, const std::string& message, const Value& extra) { + size_t length = end_ - begin_; + if(value.getOffsetStart() > length + || value.getOffsetLimit() > length + || extra.getOffsetLimit() > length) + return false; + Token token; + token.type_ = tokenError; + token.start_ = begin_ + value.getOffsetStart(); + token.end_ = begin_ + value.getOffsetLimit(); + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = begin_ + extra.getOffsetStart(); + errors_.push_back(info); + return true; +} + +bool OurReader::good() const { + return !errors_.size(); +} + + +class OurCharReader : public CharReader { + bool const collectComments_; + OurReader reader_; +public: + OurCharReader( + bool collectComments, + OurFeatures const& features) + : collectComments_(collectComments) + , reader_(features) + {} + bool parse( + char const* beginDoc, char const* endDoc, + Value* root, std::string* errs) { + bool ok = reader_.parse(beginDoc, endDoc, *root, collectComments_); + if (errs) { + *errs = reader_.getFormattedErrorMessages(); + } + return ok; + } +}; + +CharReaderBuilder::CharReaderBuilder() +{ + setDefaults(&settings_); +} +CharReaderBuilder::~CharReaderBuilder() +{} +CharReader* CharReaderBuilder::newCharReader() const +{ + bool collectComments = settings_["collectComments"].asBool(); + OurFeatures features = OurFeatures::all(); + features.allowComments_ = settings_["allowComments"].asBool(); + features.strictRoot_ = settings_["strictRoot"].asBool(); + features.allowDroppedNullPlaceholders_ = settings_["allowDroppedNullPlaceholders"].asBool(); + features.allowNumericKeys_ = settings_["allowNumericKeys"].asBool(); + features.allowSingleQuotes_ = settings_["allowSingleQuotes"].asBool(); + features.stackLimit_ = settings_["stackLimit"].asInt(); + features.failIfExtra_ = settings_["failIfExtra"].asBool(); + features.rejectDupKeys_ = settings_["rejectDupKeys"].asBool(); + features.allowSpecialFloats_ = settings_["allowSpecialFloats"].asBool(); + return new OurCharReader(collectComments, features); +} +static void getValidReaderKeys(std::set* valid_keys) +{ + valid_keys->clear(); + valid_keys->insert("collectComments"); + valid_keys->insert("allowComments"); + valid_keys->insert("strictRoot"); + valid_keys->insert("allowDroppedNullPlaceholders"); + valid_keys->insert("allowNumericKeys"); + valid_keys->insert("allowSingleQuotes"); + valid_keys->insert("stackLimit"); + valid_keys->insert("failIfExtra"); + valid_keys->insert("rejectDupKeys"); + valid_keys->insert("allowSpecialFloats"); +} +bool CharReaderBuilder::validate(Json::Value* invalid) const +{ + Json::Value my_invalid; + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL + Json::Value& inv = *invalid; + std::set valid_keys; + getValidReaderKeys(&valid_keys); + Value::Members keys = settings_.getMemberNames(); + size_t n = keys.size(); + for (size_t i = 0; i < n; ++i) { + std::string const& key = keys[i]; + if (valid_keys.find(key) == valid_keys.end()) { + inv[key] = settings_[key]; + } + } + return 0u == inv.size(); +} +Value& CharReaderBuilder::operator[](std::string key) +{ + return settings_[key]; +} +// static +void CharReaderBuilder::strictMode(Json::Value* settings) +{ +//! [CharReaderBuilderStrictMode] + (*settings)["allowComments"] = false; + (*settings)["strictRoot"] = true; + (*settings)["allowDroppedNullPlaceholders"] = false; + (*settings)["allowNumericKeys"] = false; + (*settings)["allowSingleQuotes"] = false; + (*settings)["stackLimit"] = 1000; + (*settings)["failIfExtra"] = true; + (*settings)["rejectDupKeys"] = true; + (*settings)["allowSpecialFloats"] = false; +//! [CharReaderBuilderStrictMode] +} +// static +void CharReaderBuilder::setDefaults(Json::Value* settings) +{ +//! [CharReaderBuilderDefaults] + (*settings)["collectComments"] = true; + (*settings)["allowComments"] = true; + (*settings)["strictRoot"] = false; + (*settings)["allowDroppedNullPlaceholders"] = false; + (*settings)["allowNumericKeys"] = false; + (*settings)["allowSingleQuotes"] = false; + (*settings)["stackLimit"] = 1000; + (*settings)["failIfExtra"] = false; + (*settings)["rejectDupKeys"] = false; + (*settings)["allowSpecialFloats"] = false; +//! [CharReaderBuilderDefaults] +} + +////////////////////////////////// +// global functions + +bool parseFromStream( + CharReader::Factory const& fact, std::istream& sin, + Value* root, std::string* errs) +{ + std::ostringstream ssin; + ssin << sin.rdbuf(); + std::string doc = ssin.str(); + char const* begin = doc.data(); + char const* end = begin + doc.size(); + // Note that we do not actually need a null-terminator. + CharReaderPtr const reader(fact.newCharReader()); + return reader->parse(begin, end, root, errs); +} + +std::istream& operator>>(std::istream& sin, Value& root) { + CharReaderBuilder b; + std::string errs; + bool ok = parseFromStream(b, sin, &root, &errs); + if (!ok) { + fprintf(stderr, + "Error from reader: %s", + errs.c_str()); + + throwRuntimeError(errs); + } + return sin; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_reader.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2007-2010 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +// included by json_value.cpp + +namespace Json { + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIteratorBase +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIteratorBase::ValueIteratorBase() + : current_(), isNull_(true) { +} + +ValueIteratorBase::ValueIteratorBase( + const Value::ObjectValues::iterator& current) + : current_(current), isNull_(false) {} + +Value& ValueIteratorBase::deref() const { + return current_->second; +} + +void ValueIteratorBase::increment() { + ++current_; +} + +void ValueIteratorBase::decrement() { + --current_; +} + +ValueIteratorBase::difference_type +ValueIteratorBase::computeDistance(const SelfType& other) const { +#ifdef JSON_USE_CPPTL_SMALLMAP + return other.current_ - current_; +#else + // Iterator for null value are initialized using the default + // constructor, which initialize current_ to the default + // std::map::iterator. As begin() and end() are two instance + // of the default std::map::iterator, they can not be compared. + // To allow this, we handle this comparison specifically. + if (isNull_ && other.isNull_) { + return 0; + } + + // Usage of std::distance is not portable (does not compile with Sun Studio 12 + // RogueWave STL, + // which is the one used by default). + // Using a portable hand-made version for non random iterator instead: + // return difference_type( std::distance( current_, other.current_ ) ); + difference_type myDistance = 0; + for (Value::ObjectValues::iterator it = current_; it != other.current_; + ++it) { + ++myDistance; + } + return myDistance; +#endif +} + +bool ValueIteratorBase::isEqual(const SelfType& other) const { + if (isNull_) { + return other.isNull_; + } + return current_ == other.current_; +} + +void ValueIteratorBase::copy(const SelfType& other) { + current_ = other.current_; + isNull_ = other.isNull_; +} + +Value ValueIteratorBase::key() const { + const Value::CZString czstring = (*current_).first; + if (czstring.data()) { + if (czstring.isStaticString()) + return Value(StaticString(czstring.data())); + return Value(czstring.data(), czstring.data() + czstring.length()); + } + return Value(czstring.index()); +} + +UInt ValueIteratorBase::index() const { + const Value::CZString czstring = (*current_).first; + if (!czstring.data()) + return czstring.index(); + return Value::UInt(-1); +} + +std::string ValueIteratorBase::name() const { + char const* keey; + char const* end; + keey = memberName(&end); + if (!keey) return std::string(); + return std::string(keey, end); +} + +char const* ValueIteratorBase::memberName() const { + const char* cname = (*current_).first.data(); + return cname ? cname : ""; +} + +char const* ValueIteratorBase::memberName(char const** end) const { + const char* cname = (*current_).first.data(); + if (!cname) { + *end = NULL; + return NULL; + } + *end = cname + (*current_).first.length(); + return cname; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueConstIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueConstIterator::ValueConstIterator() {} + +ValueConstIterator::ValueConstIterator( + const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueConstIterator::ValueConstIterator(ValueIterator const& other) + : ValueIteratorBase(other) {} + +ValueConstIterator& ValueConstIterator:: +operator=(const ValueIteratorBase& other) { + copy(other); + return *this; +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class ValueIterator +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +ValueIterator::ValueIterator() {} + +ValueIterator::ValueIterator(const Value::ObjectValues::iterator& current) + : ValueIteratorBase(current) {} + +ValueIterator::ValueIterator(const ValueConstIterator& other) + : ValueIteratorBase(other) { + throwRuntimeError("ConstIterator to Iterator should never be allowed."); +} + +ValueIterator::ValueIterator(const ValueIterator& other) + : ValueIteratorBase(other) {} + +ValueIterator& ValueIterator::operator=(const SelfType& other) { + copy(other); + return *this; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_valueiterator.inl +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#ifdef JSON_USE_CPPTL +#include +#endif +#include // size_t +#include // min() + +#define JSON_ASSERT_UNREACHABLE assert(false) + +/* +-- Valve 1/7/16 +4702 unreachable code +*/ +#pragma warning (push) +#pragma warning (disable: 4702) + +namespace Json { + +// This is a walkaround to avoid the static initialization of Value::null. +// kNull must be word-aligned to avoid crashing on ARM. We use an alignment of +// 8 (instead of 4) as a bit of future-proofing. +#if defined(__ARMEL__) +#define ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) +#else +#define ALIGNAS(byte_alignment) +#endif +static const unsigned char ALIGNAS(8) kNull[sizeof(Value)] = { 0 }; +const unsigned char& kNullRef = kNull[0]; +const Value& Value::null = reinterpret_cast(kNullRef); +const Value& Value::nullRef = null; + +const Int Value::minInt = Int(~(UInt(-1) / 2)); +const Int Value::maxInt = Int(UInt(-1) / 2); +const UInt Value::maxUInt = UInt(-1); +#if defined(JSON_HAS_INT64) +const Int64 Value::minInt64 = Int64(~(UInt64(-1) / 2)); +const Int64 Value::maxInt64 = Int64(UInt64(-1) / 2); +const UInt64 Value::maxUInt64 = UInt64(-1); +// The constant is hard-coded because some compiler have trouble +// converting Value::maxUInt64 to a double correctly (AIX/xlC). +// Assumes that UInt64 is a 64 bits integer. +static const double maxUInt64AsDouble = 18446744073709551615.0; +#endif // defined(JSON_HAS_INT64) +const LargestInt Value::minLargestInt = LargestInt(~(LargestUInt(-1) / 2)); +const LargestInt Value::maxLargestInt = LargestInt(LargestUInt(-1) / 2); +const LargestUInt Value::maxLargestUInt = LargestUInt(-1); + +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +template +static inline bool InRange(double d, T min, U max) { + return d >= min && d <= max; +} +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) +static inline double integerToDouble(Json::UInt64 value) { + return static_cast(Int64(value / 2)) * 2.0 + Int64(value & 1); +} + +template static inline double integerToDouble(T value) { + return static_cast(value); +} + +template +static inline bool InRange(double d, T min, U max) { + return d >= integerToDouble(min) && d <= integerToDouble(max); +} +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + +/** Duplicates the specified string value. + * @param value Pointer to the string to duplicate. Must be zero-terminated if + * length is "unknown". + * @param length Length of the value. if equals to unknown, then it will be + * computed using strlen(value). + * @return Pointer on the duplicate instance of string. + */ +static inline char* duplicateStringValue(const char* value, + size_t length) { + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + if (length >= (size_t)Value::maxInt) + length = Value::maxInt - 1; + + char* newString = static_cast(malloc(length + 1)); + if (newString == NULL) { + throwRuntimeError( + "in Json::Value::duplicateStringValue(): " + "Failed to allocate string value buffer"); + } + memcpy(newString, value, length); + newString[length] = 0; + return newString; +} + +/* Record the length as a prefix. + */ +static inline char* duplicateAndPrefixStringValue( + const char* value, + unsigned int length) +{ + // Avoid an integer overflow in the call to malloc below by limiting length + // to a sane value. + JSON_ASSERT_MESSAGE(length <= (unsigned)Value::maxInt - sizeof(unsigned) - 1U, + "in Json::Value::duplicateAndPrefixStringValue(): " + "length too big for prefixing"); + unsigned actualLength = length + static_cast(sizeof(unsigned)) + 1U; + char* newString = static_cast(malloc(actualLength)); + if (newString == 0) { + throwRuntimeError( + "in Json::Value::duplicateAndPrefixStringValue(): " + "Failed to allocate string value buffer"); + } + *reinterpret_cast(newString) = length; + memcpy(newString + sizeof(unsigned), value, length); + newString[actualLength - 1U] = 0; // to avoid buffer over-run accidents by users later + return newString; +} +inline static void decodePrefixedString( + bool isPrefixed, char const* prefixed, + unsigned* length, char const** value) +{ + if (!isPrefixed) { + *length = static_cast(strlen(prefixed)); + *value = prefixed; + } else { + *length = *reinterpret_cast(prefixed); + *value = prefixed + sizeof(unsigned); + } +} +/** Free the string duplicated by duplicateStringValue()/duplicateAndPrefixStringValue(). + */ +static inline void releaseStringValue(char* value) { free(value); } + +} // namespace Json + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#if !defined(JSON_IS_AMALGAMATION) + +#include "json_valueiterator.inl" +#endif // if !defined(JSON_IS_AMALGAMATION) + +namespace Json { + +Exception::Exception(std::string const& msg) + : msg_(msg) +{} +Exception::~Exception() throw() +{} +char const* Exception::what() const throw() +{ + return msg_.c_str(); +} +RuntimeError::RuntimeError(std::string const& msg) + : Exception(msg) +{} +LogicError::LogicError(std::string const& msg) + : Exception(msg) +{} +void throwRuntimeError(std::string const& msg) +{ + throw RuntimeError(msg); +} +void throwLogicError(std::string const& msg) +{ + throw LogicError(msg); +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +Value::CommentInfo::CommentInfo() : comment_(0) {} + +Value::CommentInfo::~CommentInfo() { + if (comment_) + releaseStringValue(comment_); +} + +void Value::CommentInfo::setComment(const char* text, size_t len) { + if (comment_) { + releaseStringValue(comment_); + comment_ = 0; + } + JSON_ASSERT(text != 0); + JSON_ASSERT_MESSAGE( + text[0] == '\0' || text[0] == '/', + "in Json::Value::setComment(): Comments must start with /"); + // It seems that /**/ style comments are acceptable as well. + comment_ = duplicateStringValue(text, len); +} + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +// Notes: policy_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString(ArrayIndex aindex) : cstr_(0), index_(aindex) {} + +Value::CZString::CZString(char const* str, unsigned ulength, DuplicationPolicy allocate) + : cstr_(str) { + // allocate != duplicate + storage_.policy_ = allocate & 0x3; + storage_.length_ = ulength & 0x3FFFFFFF; +} + +Value::CZString::CZString(const CZString& other) + : cstr_(other.storage_.policy_ != noDuplication && other.cstr_ != 0 + ? duplicateStringValue(other.cstr_, other.storage_.length_) + : other.cstr_) { + storage_.policy_ = (other.cstr_ + ? (static_cast(other.storage_.policy_) == noDuplication + ? noDuplication : duplicate) + : static_cast(other.storage_.policy_)); + storage_.length_ = other.storage_.length_; +} + +#if JSON_HAS_RVALUE_REFERENCES +Value::CZString::CZString(CZString&& other) + : cstr_(other.cstr_), index_(other.index_) { + other.cstr_ = nullptr; +} +#endif + +Value::CZString::~CZString() { + if (cstr_ && storage_.policy_ == duplicate) + releaseStringValue(const_cast(cstr_)); +} + +void Value::CZString::swap(CZString& other) { + std::swap(cstr_, other.cstr_); + std::swap(index_, other.index_); +} + +Value::CZString& Value::CZString::operator=(CZString other) { + swap(other); + return *this; +} + +bool Value::CZString::operator<(const CZString& other) const { + if (!cstr_) return index_ < other.index_; + //return strcmp(cstr_, other.cstr_) < 0; + // Assume both are strings. + unsigned this_len = this->storage_.length_; + unsigned other_len = other.storage_.length_; + unsigned min_len = std::min(this_len, other_len); + int comp = memcmp(this->cstr_, other.cstr_, min_len); + if (comp < 0) return true; + if (comp > 0) return false; + return (this_len < other_len); +} + +bool Value::CZString::operator==(const CZString& other) const { + if (!cstr_) return index_ == other.index_; + //return strcmp(cstr_, other.cstr_) == 0; + // Assume both are strings. + unsigned this_len = this->storage_.length_; + unsigned other_len = other.storage_.length_; + if (this_len != other_len) return false; + int comp = memcmp(this->cstr_, other.cstr_, this_len); + return comp == 0; +} + +ArrayIndex Value::CZString::index() const { return index_; } + +//const char* Value::CZString::c_str() const { return cstr_; } +const char* Value::CZString::data() const { return cstr_; } +unsigned Value::CZString::length() const { return storage_.length_; } +bool Value::CZString::isStaticString() const { return storage_.policy_ == noDuplication; } + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value(ValueType vtype) { + initBasic(vtype); + switch (vtype) { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + +Value::Value(Int value) { + initBasic(intValue); + value_.int_ = value; +} + +Value::Value(UInt value) { + initBasic(uintValue); + value_.uint_ = value; +} +#if defined(JSON_HAS_INT64) +Value::Value(Int64 value) { + initBasic(intValue); + value_.int_ = value; +} +Value::Value(UInt64 value) { + initBasic(uintValue); + value_.uint_ = value; +} +#endif // defined(JSON_HAS_INT64) + +Value::Value(double value) { + initBasic(realValue); + value_.real_ = value; +} + +Value::Value(const char* value) { + initBasic(stringValue, true); + value_.string_ = duplicateAndPrefixStringValue(value, static_cast(strlen(value))); +} + +Value::Value(const char* beginValue, const char* endValue) { + initBasic(stringValue, true); + value_.string_ = + duplicateAndPrefixStringValue(beginValue, static_cast(endValue - beginValue)); +} + +Value::Value(const std::string& value) { + initBasic(stringValue, true); + value_.string_ = + duplicateAndPrefixStringValue(value.data(), static_cast(value.length())); +} + +Value::Value(const StaticString& value) { + initBasic(stringValue); + value_.string_ = const_cast(value.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value::Value(const CppTL::ConstString& value) { + initBasic(stringValue, true); + value_.string_ = duplicateAndPrefixStringValue(value, static_cast(value.length())); +} +#endif + +Value::Value(bool value) { + initBasic(booleanValue); + value_.bool_ = value; +} + +Value::Value(Value const& other) + : type_(other.type_), allocated_(false) + , + comments_(nullptr), default_value_(nullptr), start_(other.start_), limit_(other.limit_) +{ + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if (other.value_.string_ && other.allocated_) { + unsigned len; + char const* str; + decodePrefixedString(other.allocated_, other.value_.string_, + &len, &str); + value_.string_ = duplicateAndPrefixStringValue(str, len); + allocated_ = true; + } else { + value_.string_ = other.value_.string_; + allocated_ = false; + } + break; + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(*other.value_.map_); + break; + default: + JSON_ASSERT_UNREACHABLE; + } + if (other.comments_) { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for (int comment = 0; comment < numberOfCommentPlacement; ++comment) { + const CommentInfo& otherComment = other.comments_[comment]; + if (otherComment.comment_) + comments_[comment].setComment( + otherComment.comment_, strlen(otherComment.comment_)); + } + } + + if ( other.default_value_ ) + { + default_value_ = new Value( *other.default_value_ ); + } + +} + +#if JSON_HAS_RVALUE_REFERENCES +// Move constructor +Value::Value(Value&& other) { + initBasic(nullValue); + swap(other); +} +#endif + +Value::~Value() { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if (allocated_) + releaseStringValue(value_.string_); + break; + case arrayValue: + case objectValue: + delete value_.map_; + break; + default: + JSON_ASSERT_UNREACHABLE; + } + + if (comments_) + delete[] comments_; + + if ( default_value_) + delete default_value_; +} + +Value& Value::operator=(Value other) { + swap(other); + return *this; +} + +void Value::swapPayload(Value& other) { + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap(value_, other.value_); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2 & 0x1; +} + +void Value::swap(Value& other) { + swapPayload(other); + std::swap(comments_, other.comments_); + std::swap(default_value_, other.default_value_); + std::swap(start_, other.start_); + std::swap(limit_, other.limit_); +} + +ValueType Value::type() const { return type_; } + +int Value::compare(const Value& other) const { + if (*this < other) + return -1; + if (*this > other) + return 1; + return 0; +} + +bool Value::operator<(const Value& other) const { + int typeDelta = type_ - other.type_; + if (typeDelta) + return typeDelta < 0 ? true : false; + switch (type_) { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + { + if ((value_.string_ == 0) || (other.value_.string_ == 0)) { + if (other.value_.string_) return true; + else return false; + } + unsigned this_len; + unsigned other_len; + char const* this_str; + char const* other_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); + unsigned min_len = std::min(this_len, other_len); + int comp = memcmp(this_str, other_str, min_len); + if (comp < 0) return true; + if (comp > 0) return false; + return (this_len < other_len); + } + case arrayValue: + case objectValue: { + int delta = int(value_.map_->size() - other.value_.map_->size()); + if (delta) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator<=(const Value& other) const { return !(other < *this); } + +bool Value::operator>=(const Value& other) const { return !(*this < other); } + +bool Value::operator>(const Value& other) const { return other < *this; } + +bool Value::operator==(const Value& other) const { + // if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if (type_ != temp) + return false; + switch (type_) { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + { + if ((value_.string_ == 0) || (other.value_.string_ == 0)) { + return (value_.string_ == other.value_.string_); + } + unsigned this_len; + unsigned other_len; + char const* this_str; + char const* other_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + decodePrefixedString(other.allocated_, other.value_.string_, &other_len, &other_str); + if (this_len != other_len) return false; + int comp = memcmp(this_str, other_str, this_len); + return comp == 0; + } + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() && + (*value_.map_) == (*other.value_.map_); + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable +} + +bool Value::operator!=(const Value& other) const { return !(*this == other); } + +const char* Value::asCString() const { + JSON_ASSERT_MESSAGE(type_ == stringValue, + "in Json::Value::asCString(): requires stringValue"); + if (value_.string_ == 0) return 0; + unsigned this_len; + char const* this_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + return this_str; +} + +bool Value::getString(char const** str, char const** cend) const { + if (type_ != stringValue) return false; + if (value_.string_ == 0) return false; + unsigned length; + decodePrefixedString(this->allocated_, this->value_.string_, &length, str); + *cend = *str + length; + return true; +} + +std::string Value::asString() const { + switch (type_) { + case nullValue: + return ""; + case stringValue: + { + if (value_.string_ == 0) return ""; + unsigned this_len; + char const* this_str; + decodePrefixedString(this->allocated_, this->value_.string_, &this_len, &this_str); + return std::string(this_str, this_len); + } + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + return valueToString(value_.int_); + case uintValue: + return valueToString(value_.uint_); + case realValue: + return valueToString(value_.real_); + default: + if ( default_value_ ) + return default_value_->asString(); + else + return ""; + } +} + +#ifdef JSON_USE_CPPTL +CppTL::ConstString Value::asConstString() const { + unsigned len; + char const* str; + decodePrefixedString(allocated_, value_.string_, + &len, &str); + return CppTL::ConstString(str, len); +} +#endif + +Value::Int Value::asInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestInt out of Int range"); + return Int(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt(), "LargestUInt out of Int range"); + return Int(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt, maxInt), + "double out of Int range"); + return Int(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + if ( default_value_ ) + return default_value_->asInt(); + else + return 0; + } +} + +Value::UInt Value::asUInt() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestInt out of UInt range"); + return UInt(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isUInt(), "LargestUInt out of UInt range"); + return UInt(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt), + "double out of UInt range"); + return UInt(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + if ( default_value_ ) + return default_value_->asUInt(); + else + return 0u; + } +} + +#if defined(JSON_HAS_INT64) + +Value::Int64 Value::asInt64() const { + switch (type_) { + case intValue: + return Int64(value_.int_); + case uintValue: + JSON_ASSERT_MESSAGE(isInt64(), "LargestUInt out of Int64 range"); + return Int64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, minInt64, maxInt64), + "double out of Int64 range"); + return Int64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + if ( default_value_ ) + return default_value_->asInt64(); + else + return 0l; + } +} + +Value::UInt64 Value::asUInt64() const { + switch (type_) { + case intValue: + JSON_ASSERT_MESSAGE(isUInt64(), "LargestInt out of UInt64 range"); + return UInt64(value_.int_); + case uintValue: + return UInt64(value_.uint_); + case realValue: + JSON_ASSERT_MESSAGE(InRange(value_.real_, 0, maxUInt64), + "double out of UInt64 range"); + return UInt64(value_.real_); + case nullValue: + return 0; + case booleanValue: + return value_.bool_ ? 1 : 0; + default: + if ( default_value_ ) + return default_value_->asUInt64(); + else + return 0ul; + } +} +#endif // if defined(JSON_HAS_INT64) + +LargestInt Value::asLargestInt() const { +#if defined(JSON_NO_INT64) + return asInt(); +#else + return asInt64(); +#endif +} + +LargestUInt Value::asLargestUInt() const { +#if defined(JSON_NO_INT64) + return asUInt(); +#else + return asUInt64(); +#endif +} + +double Value::asDouble() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return value_.real_; + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + default: + if ( default_value_ ) + return default_value_->asDouble(); + else + return 0.0; + } +} + +float Value::asFloat() const { + switch (type_) { + case intValue: + return static_cast(value_.int_); + case uintValue: +#if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return static_cast(value_.uint_); +#else // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + return integerToDouble(value_.uint_); +#endif // if !defined(JSON_USE_INT64_DOUBLE_CONVERSION) + case realValue: + return static_cast(value_.real_); + case nullValue: + return 0.0; + case booleanValue: + return value_.bool_ ? 1.0f : 0.0f; + default: + if ( default_value_ ) + return default_value_->asFloat(); + else + return 0.0f; + } +} + +bool Value::asBool() const { + switch (type_) { + case booleanValue: + return value_.bool_; + case nullValue: + return false; + case intValue: + return value_.int_ ? true : false; + case uintValue: + return value_.uint_ ? true : false; + case realValue: + // This is kind of strange. Not recommended. + return (value_.real_ != 0.0) ? true : false; + default: + if ( default_value_ ) + return default_value_->asBool(); + else + return false; + } +} + +bool Value::isConvertibleTo(ValueType other) const { + switch (other) { + case nullValue: + return (isNumeric() && asDouble() == 0.0) || + (type_ == booleanValue && value_.bool_ == false) || + (type_ == stringValue && asString() == "") || + (type_ == arrayValue && value_.map_->size() == 0) || + (type_ == objectValue && value_.map_->size() == 0) || + type_ == nullValue; + case intValue: + return isInt() || + (type_ == realValue && InRange(value_.real_, minInt, maxInt)) || + type_ == booleanValue || type_ == nullValue; + case uintValue: + return isUInt() || + (type_ == realValue && InRange(value_.real_, 0, maxUInt)) || + type_ == booleanValue || type_ == nullValue; + case realValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case booleanValue: + return isNumeric() || type_ == booleanValue || type_ == nullValue; + case stringValue: + return isNumeric() || type_ == booleanValue || type_ == stringValue || + type_ == nullValue; + case arrayValue: + return type_ == arrayValue || type_ == nullValue; + case objectValue: + return type_ == objectValue || type_ == nullValue; + } + JSON_ASSERT_UNREACHABLE; + return false; +} + +/// Number of values in array or object +ArrayIndex Value::size() const { + switch (type_) { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; + case arrayValue: // size of the array is highest index + 1 + if (!value_.map_->empty()) { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index() + 1; + } + return 0; + case objectValue: + return ArrayIndex(value_.map_->size()); + } + JSON_ASSERT_UNREACHABLE; + return 0; // unreachable; +} + +bool Value::empty() const { + if (isNull() || isArray() || isObject()) + return size() == 0u; + else + return false; +} + +bool Value::operator!() const { return isNull(); } + +void Value::clear() { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue || + type_ == objectValue, + "in Json::Value::clear(): requires complex value"); + start_ = 0; + limit_ = 0; + delete default_value_; + default_value_ = nullptr; + switch (type_) { + case arrayValue: + case objectValue: + value_.map_->clear(); + break; + default: + break; + } +} + +void Value::resize(ArrayIndex newSize) { + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == arrayValue, + "in Json::Value::resize(): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); + ArrayIndex oldSize = size(); + if (newSize == 0) + clear(); + else if (newSize > oldSize) + (*this)[newSize - 1]; + else { + for (ArrayIndex index = newSize; index < oldSize; ++index) { + value_.map_->erase(index); + } + assert(size() == newSize); + } +} + +Value& Value::operator[](ArrayIndex index) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex): requires arrayValue"); + if (type_ == nullValue) + *this = Value(arrayValue); + CZString key(index); + ObjectValues::iterator it = value_.map_->lower_bound(key); + if (it != value_.map_->end() && (*it).first == key) + return (*it).second; + + ObjectValues::value_type defaultValue(key, nullRef); + it = value_.map_->insert(it, defaultValue); + return (*it).second; +} + +Value& Value::operator[](int index) { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index): index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +const Value& Value::operator[](ArrayIndex index) const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == arrayValue, + "in Json::Value::operator[](ArrayIndex)const: requires arrayValue"); + if (type_ == nullValue) + return nullRef; + CZString key(index); + ObjectValues::const_iterator it = value_.map_->find(key); + if (it == value_.map_->end()) + return nullRef; + return (*it).second; +} + +const Value& Value::operator[](int index) const { + JSON_ASSERT_MESSAGE( + index >= 0, + "in Json::Value::operator[](int index) const: index cannot be negative"); + return (*this)[ArrayIndex(index)]; +} + +void Value::initBasic(ValueType vtype, bool allocated) { + type_ = vtype; + allocated_ = allocated; + comments_ = 0; + start_ = 0; + limit_ = 0; + default_value_ = nullptr; +} + +// Access an object value by name, create a null member if it does not exist. +// @pre Type of '*this' is object or null. +// @param key is null-terminated. +Value& Value::resolveReference(const char* key) { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::resolveReference(): requires objectValue"); + if (type_ == nullValue) + *this = Value(objectValue); + CZString actualKey( + key, static_cast(strlen(key)), CZString::noDuplication); // NOTE! + ObjectValues::iterator it = value_.map_->lower_bound(actualKey); + if (it != value_.map_->end() && (*it).first == actualKey) + return (*it).second; + + ObjectValues::value_type defaultValue(actualKey, nullRef); + it = value_.map_->insert(it, defaultValue); + Value& value = (*it).second; + return value; +} + +// @param key is not null-terminated. +Value& Value::resolveReference(char const* key, char const* cend) +{ + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::resolveReference(key, end): requires objectValue"); + if (type_ == nullValue) + *this = Value(objectValue); + CZString actualKey( + key, static_cast(cend-key), CZString::duplicateOnCopy); + ObjectValues::iterator it = value_.map_->lower_bound(actualKey); + if (it != value_.map_->end() && (*it).first == actualKey) + return (*it).second; + + ObjectValues::value_type defaultValue(actualKey, nullRef); + it = value_.map_->insert(it, defaultValue); + Value& value = (*it).second; + return value; +} + +Value Value::get(ArrayIndex index, const Value& defaultValue) const { + const Value* value = &((*this)[index]); + if ( value == &nullRef ) + { + return defaultValue; + } + else + { + Value result = *value; + result.default_value_ = new Value( defaultValue ); + return result; + } +} + +bool Value::isValidIndex(ArrayIndex index) const { return index < size(); } + +Value const* Value::find(char const* key, char const* cend) const +{ + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::find(key, end, found): requires objectValue or nullValue"); + if (type_ == nullValue) return NULL; + CZString actualKey(key, static_cast(cend-key), CZString::noDuplication); + ObjectValues::const_iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) return NULL; + return &(*it).second; +} +const Value& Value::operator[](const char* key) const +{ + Value const* found = find(key, key + strlen(key)); + if (!found) return nullRef; + return *found; +} +Value const& Value::operator[](std::string const& key) const +{ + Value const* found = find(key.data(), key.data() + key.length()); + if (!found) return nullRef; + return *found; +} + +Value& Value::operator[](const char* key) { + return resolveReference(key, key + strlen(key)); +} + +Value& Value::operator[](const std::string& key) { + return resolveReference(key.data(), key.data() + key.length()); +} + +Value& Value::operator[](const StaticString& key) { + return resolveReference(key.c_str()); +} + +#ifdef JSON_USE_CPPTL +Value& Value::operator[](const CppTL::ConstString& key) { + return resolveReference(key.c_str(), key.end_c_str()); +} +Value const& Value::operator[](CppTL::ConstString const& key) const +{ + Value const* found = find(key.c_str(), key.end_c_str()); + if (!found) return nullRef; + return *found; +} +#endif + +Value& Value::append(const Value& value) { return (*this)[size()] = value; } + +Value Value::get(char const* key, char const* cend, Value const& defaultValue) const +{ + Value const* found = find(key, cend); + if ( !found ) + { + return defaultValue; + } + else + { + Value result = *found; + result.default_value_ = new Value( defaultValue ); + return result; + } +} +Value Value::get(char const* key, Value const& defaultValue) const +{ + return get(key, key + strlen(key), defaultValue); +} +Value Value::get(std::string const& key, Value const& defaultValue) const +{ + return get(key.data(), key.data() + key.length(), defaultValue); +} + + +bool Value::removeMember(const char* key, const char* cend, Value* removed) +{ + if (type_ != objectValue) { + return false; + } + CZString actualKey(key, static_cast(cend-key), CZString::noDuplication); + ObjectValues::iterator it = value_.map_->find(actualKey); + if (it == value_.map_->end()) + return false; + *removed = it->second; + value_.map_->erase(it); + return true; +} +bool Value::removeMember(const char* key, Value* removed) +{ + return removeMember(key, key + strlen(key), removed); +} +bool Value::removeMember(std::string const& key, Value* removed) +{ + return removeMember(key.data(), key.data() + key.length(), removed); +} +Value Value::removeMember(const char* key) +{ + JSON_ASSERT_MESSAGE(type_ == nullValue || type_ == objectValue, + "in Json::Value::removeMember(): requires objectValue"); + if (type_ == nullValue) + return nullRef; + + Value removed; // null + removeMember(key, key + strlen(key), &removed); + return removed; // still null if removeMember() did nothing +} +Value Value::removeMember(const std::string& key) +{ + return removeMember(key.c_str()); +} + +bool Value::removeIndex(ArrayIndex index, Value* removed) { + if (type_ != arrayValue) { + return false; + } + CZString key(index); + ObjectValues::iterator it = value_.map_->find(key); + if (it == value_.map_->end()) { + return false; + } + *removed = it->second; + ArrayIndex oldSize = size(); + // shift left all items left, into the place of the "removed" + for (ArrayIndex i = index; i < (oldSize - 1); ++i){ + CZString keey(i); + (*value_.map_)[keey] = (*this)[i + 1]; + } + // erase the last one ("leftover") + CZString keyLast(oldSize - 1); + ObjectValues::iterator itLast = value_.map_->find(keyLast); + value_.map_->erase(itLast); + return true; +} + +#ifdef JSON_USE_CPPTL +Value Value::get(const CppTL::ConstString& key, + const Value& defaultValue) const { + return get(key.c_str(), key.end_c_str(), defaultValue); +} +#endif + +bool Value::isMember(char const* key, char const* cend) const +{ + Value const* value = find(key, cend); + return NULL != value; +} +bool Value::isMember(char const* key) const +{ + return isMember(key, key + strlen(key)); +} +bool Value::isMember(std::string const& key) const +{ + return isMember(key.data(), key.data() + key.length()); +} + +#ifdef JSON_USE_CPPTL +bool Value::isMember(const CppTL::ConstString& key) const { + return isMember(key.c_str(), key.end_c_str()); +} +#endif + +Value::Members Value::getMemberNames() const { + JSON_ASSERT_MESSAGE( + type_ == nullValue || type_ == objectValue, + "in Json::Value::getMemberNames(), value must be objectValue"); + if (type_ == nullValue) + return Value::Members(); + Members members; + members.reserve(value_.map_->size()); + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for (; it != itEnd; ++it) { + members.push_back(std::string((*it).first.data(), + (*it).first.length())); + } + return members; +} +// +//# ifdef JSON_USE_CPPTL +// EnumMemberNames +// Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +// EnumValues +// Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type() ); +// return EnumValues(); +//} +// +//# endif + +static bool IsIntegral(double d) { + double integral_part; + return modf(d, &integral_part) == 0.0; +} + +bool Value::isNull() const { return type_ == nullValue; } + +bool Value::isBool() const { return type_ == booleanValue; } + +bool Value::isInt() const { + switch (type_) { + case intValue: + return value_.int_ >= minInt && value_.int_ <= maxInt; + case uintValue: + return value_.uint_ <= UInt(maxInt); + case realValue: + return value_.real_ >= minInt && value_.real_ <= maxInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isUInt() const { + switch (type_) { + case intValue: + return value_.int_ >= 0 && LargestUInt(value_.int_) <= LargestUInt(maxUInt); + case uintValue: + return value_.uint_ <= maxUInt; + case realValue: + return value_.real_ >= 0 && value_.real_ <= maxUInt && + IsIntegral(value_.real_); + default: + break; + } + return false; +} + +bool Value::isInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return true; + case uintValue: + return value_.uint_ <= UInt64(maxInt64); + case realValue: + // Note that maxInt64 (= 2^63 - 1) is not exactly representable as a + // double, so double(maxInt64) will be rounded up to 2^63. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= double(minInt64) && + value_.real_ < double(maxInt64) && IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isUInt64() const { +#if defined(JSON_HAS_INT64) + switch (type_) { + case intValue: + return value_.int_ >= 0; + case uintValue: + return true; + case realValue: + // Note that maxUInt64 (= 2^64 - 1) is not exactly representable as a + // double, so double(maxUInt64) will be rounded up to 2^64. Therefore we + // require the value to be strictly less than the limit. + return value_.real_ >= 0 && value_.real_ < maxUInt64AsDouble && + IsIntegral(value_.real_); + default: + break; + } +#endif // JSON_HAS_INT64 + return false; +} + +bool Value::isIntegral() const { +#if defined(JSON_HAS_INT64) + return isInt64() || isUInt64(); +#else + return isInt() || isUInt(); +#endif +} + +bool Value::isDouble() const { return type_ == realValue || isIntegral(); } + +bool Value::isNumeric() const { return isIntegral() || isDouble(); } + +bool Value::isString() const { return type_ == stringValue; } + +bool Value::isArray() const { return type_ == arrayValue; } + +bool Value::isObject() const { return type_ == objectValue; } + +void Value::setComment(const char* comment, size_t len, CommentPlacement placement) { + if (!comments_) + comments_ = new CommentInfo[numberOfCommentPlacement]; + if ((len > 0) && (comment[len-1] == '\n')) { + // Always discard trailing newline, to aid indentation. + len -= 1; + } + comments_[placement].setComment(comment, len); +} + +void Value::setComment(const char* comment, CommentPlacement placement) { + setComment(comment, strlen(comment), placement); +} + +void Value::setComment(const std::string& comment, CommentPlacement placement) { + setComment(comment.c_str(), comment.length(), placement); +} + +bool Value::hasComment(CommentPlacement placement) const { + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string Value::getComment(CommentPlacement placement) const { + if (hasComment(placement)) + return comments_[placement].comment_; + return ""; +} + +void Value::setOffsetStart(size_t start) { start_ = start; } + +void Value::setOffsetLimit(size_t limit) { limit_ = limit; } + +size_t Value::getOffsetStart() const { return start_; } + +size_t Value::getOffsetLimit() const { return limit_; } + +std::string Value::toStyledString() const { + StyledWriter writer; + return writer.write(*this); +} + +Value::const_iterator Value::begin() const { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->begin()); + break; + default: + break; + } + return const_iterator(); +} + +Value::const_iterator Value::end() const { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return const_iterator(value_.map_->end()); + break; + default: + break; + } + return const_iterator(); +} + +Value::iterator Value::begin() { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->begin()); + break; + default: + break; + } + return iterator(); +} + +Value::iterator Value::end() { + switch (type_) { + case arrayValue: + case objectValue: + if (value_.map_) + return iterator(value_.map_->end()); + break; + default: + break; + } + return iterator(); +} + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() : key_(), index_(), kind_(kindNone) {} + +PathArgument::PathArgument(ArrayIndex index) + : key_(), index_(index), kind_(kindIndex) {} + +PathArgument::PathArgument(const char* key) + : key_(key), index_(), kind_(kindKey) {} + +PathArgument::PathArgument(const std::string& key) + : key_(key.c_str()), index_(), kind_(kindKey) {} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path(const std::string& path, + const PathArgument& a1, + const PathArgument& a2, + const PathArgument& a3, + const PathArgument& a4, + const PathArgument& a5) { + InArgs in; + in.push_back(&a1); + in.push_back(&a2); + in.push_back(&a3); + in.push_back(&a4); + in.push_back(&a5); + makePath(path, in); +} + +void Path::makePath(const std::string& path, const InArgs& in) { + const char* current = path.c_str(); + const char* end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while (current != end) { + if (*current == '[') { + ++current; + if (*current == '%') + addPathInArg(path, in, itInArg, PathArgument::kindIndex); + else { + ArrayIndex index = 0; + for (; current != end && *current >= '0' && *current <= '9'; ++current) + index = index * 10 + ArrayIndex(*current - '0'); + args_.push_back(index); + } + if (current == end || *current++ != ']') + invalidPath(path, int(current - path.c_str())); + } else if (*current == '%') { + addPathInArg(path, in, itInArg, PathArgument::kindKey); + ++current; + } else if (*current == '.') { + ++current; + } else { + const char* beginName = current; + while (current != end && !strchr("[.", *current)) + ++current; + args_.push_back(std::string(beginName, current)); + } + } +} + +void Path::addPathInArg(const std::string& /*path*/, + const InArgs& in, + InArgs::const_iterator& itInArg, + PathArgument::Kind kind) { + if (itInArg == in.end()) { + // Error: missing argument %d + } else if ((*itInArg)->kind_ != kind) { + // Error: bad argument type + } else { + args_.push_back(**itInArg); + } +} + +void Path::invalidPath(const std::string& /*path*/, int /*location*/) { + // Error: invalid path. +} + +const Value& Path::resolve(const Value& root) const { + const Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if (node == &Value::nullRef) { + // Error: unable to resolve path (object has no member named '' at + // position...) + } + } + } + return *node; +} + +Value Path::resolve(const Value& root, const Value& defaultValue) const { + const Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray() || !node->isValidIndex(arg.index_)) + return defaultValue; + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) + return defaultValue; + node = &((*node)[arg.key_]); + if (node == &Value::nullRef) + return defaultValue; + } + } + return *node; +} + +Value& Path::make(Value& root) const { + Value* node = &root; + for (Args::const_iterator it = args_.begin(); it != args_.end(); ++it) { + const PathArgument& arg = *it; + if (arg.kind_ == PathArgument::kindIndex) { + if (!node->isArray()) { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } else if (arg.kind_ == PathArgument::kindKey) { + if (!node->isObject()) { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + +} // namespace Json + +#pragma warning (pop) + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_value.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + + +// ////////////////////////////////////////////////////////////////////// +// Beginning of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + +// Copyright 2011 Baptiste Lepilleur +// Distributed under MIT license, or public domain if desired and +// recognized in your jurisdiction. +// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE + +#if !defined(JSON_IS_AMALGAMATION) +#include +#include "json_tool.h" +#endif // if !defined(JSON_IS_AMALGAMATION) +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(_MSC_VER) && _MSC_VER >= 1200 && _MSC_VER < 1800 // Between VC++ 6.0 and VC++ 11.0 +#include +#define isfinite _finite +#elif defined(__sun) && defined(__SVR4) //Solaris +#if !defined(isfinite) +#include +#define isfinite finite +#endif +#elif defined(_AIX) +#if !defined(isfinite) +#include +#define isfinite finite +#endif +#elif defined(__hpux) +#if !defined(isfinite) +#if defined(__ia64) && !defined(finite) +#define isfinite(x) ((sizeof(x) == sizeof(float) ? \ + _Isfinitef(x) : _IsFinite(x))) +#else +#include +#define isfinite finite +#endif +#endif +#else +#include +#if !(defined(__QNXNTO__)) // QNX already defines isfinite +#define isfinite std::isfinite +#endif +#endif + +#if defined(_MSC_VER) +#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above +#define snprintf sprintf_s +#elif _MSC_VER >= 1900 // VC++ 14.0 and above +#define snprintf std::snprintf +#else +#define snprintf _snprintf +#endif +#elif defined(__ANDROID__) || defined(__QNXNTO__) +#define snprintf snprintf +#elif __cplusplus >= 201103L +#define snprintf std::snprintf +#endif + +#if defined(__BORLANDC__) +#include +#define isfinite _finite +#define snprintf _snprintf +#endif + +#if defined(_MSC_VER) && _MSC_VER >= 1400 // VC++ 8.0 +// Disable warning about strdup being deprecated. +#pragma warning(disable : 4996) +#endif + +namespace Json { + +#if __cplusplus >= 201103L || (defined(_CPPLIB_VER) && _CPPLIB_VER >= 520) +typedef std::unique_ptr StreamWriterPtr; +#else +typedef std::auto_ptr StreamWriterPtr; +#endif + +static bool containsControlCharacter(const char* str) { + while (*str) { + if (isControlCharacter(*(str++))) + return true; + } + return false; +} + +static bool containsControlCharacter0(const char* str, unsigned len) { + char const* end = str + len; + while (end != str) { + if (isControlCharacter(*str) || 0==*str) + return true; + ++str; + } + return false; +} + +std::string valueToString(LargestInt value) { + UIntToStringBuffer buffer; + char* current = buffer + sizeof(buffer); + if (value == Value::minLargestInt) { + uintToString(LargestUInt(Value::maxLargestInt) + 1, current); + *--current = '-'; + } else if (value < 0) { + uintToString(LargestUInt(-value), current); + *--current = '-'; + } else { + uintToString(LargestUInt(value), current); + } + assert(current >= buffer); + return current; +} + +std::string valueToString(LargestUInt value) { + UIntToStringBuffer buffer; + char* current = buffer + sizeof(buffer); + uintToString(value, current); + assert(current >= buffer); + return current; +} + +#if defined(JSON_HAS_INT64) + +std::string valueToString(Int value) { + return valueToString(LargestInt(value)); +} + +std::string valueToString(UInt value) { + return valueToString(LargestUInt(value)); +} + +#endif // # if defined(JSON_HAS_INT64) + +std::string valueToString(double value, bool useSpecialFloats, unsigned int precision) { + // Allocate a buffer that is more than large enough to store the 16 digits of + // precision requested below. + char buffer[32]; + int len = -1; + + char formatString[6]; + sprintf(formatString, "%%.%dg", precision); + + // Print into the buffer. We need not request the alternative representation + // that always has a decimal point because JSON doesn't distingish the + // concepts of reals and integers. + if (isfinite(value)) { + len = snprintf(buffer, sizeof(buffer), formatString, value); + } else { + // IEEE standard states that NaN values will not compare to themselves + if (value != value) { + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "NaN" : "null"); + } else if (value < 0) { + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "-Infinity" : "-1e+9999"); + } else { + len = snprintf(buffer, sizeof(buffer), useSpecialFloats ? "Infinity" : "1e+9999"); + } + // For those, we do not need to call fixNumLoc, but it is fast. + } + assert(len >= 0); + fixNumericLocale(buffer, buffer + len); + return buffer; +} + +std::string valueToString(double value) { return valueToString(value, false, 17); } + +std::string valueToString(bool value) { return value ? "true" : "false"; } + +std::string valueToQuotedString(const char* value) { + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && + !containsControlCharacter(value)) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = + strlen(value) * 2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char* c = value; *c != 0; ++c) { + switch (*c) { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + // case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } else { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// https://github.com/upcaste/upcaste/blob/master/src/upcore/src/cstring/strnpbrk.cpp +static char const* strnpbrk(char const* s, char const* accept, size_t n) { + assert((s || !n) && accept); + + char const* const end = s + n; + for (char const* cur = s; cur < end; ++cur) { + int const c = *cur; + for (char const* a = accept; *a; ++a) { + if (*a == c) { + return cur; + } + } + } + return NULL; +} +static std::string valueToQuotedStringN(const char* value, unsigned length) { + if (value == NULL) + return ""; + // Not sure how to handle unicode... + if (strnpbrk(value, "\"\\\b\f\n\r\t", length) == NULL && + !containsControlCharacter0(value, length)) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + std::string::size_type maxsize = + length * 2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + char const* end = value + length; + for (const char* c = value; c != end; ++c) { + switch (*c) { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + // case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something.) + // blep notes: actually escaping \/ may be useful in javascript to avoid (*c); + result += oss.str(); + } else { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() {} + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_(false), dropNullPlaceholders_(false), + omitEndingLineFeed_(false) {} + +void FastWriter::enableYAMLCompatibility() { yamlCompatiblityEnabled_ = true; } + +void FastWriter::dropNullPlaceholders() { dropNullPlaceholders_ = true; } + +void FastWriter::omitEndingLineFeed() { omitEndingLineFeed_ = true; } + +std::string FastWriter::write(const Value& root) { + document_ = ""; + writeValue(root); + if (!omitEndingLineFeed_) + document_ += "\n"; + return document_; +} + +void FastWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + if (!dropNullPlaceholders_) + document_ += "null"; + break; + case intValue: + document_ += valueToString(value.asLargestInt()); + break; + case uintValue: + document_ += valueToString(value.asLargestUInt()); + break; + case realValue: + document_ += valueToString(value.asDouble()); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) document_ += valueToQuotedStringN(str, static_cast(end-str)); + break; + } + case booleanValue: + document_ += valueToString(value.asBool()); + break; + case arrayValue: { + document_ += '['; + int size = value.size(); + for (int index = 0; index < size; ++index) { + if (index > 0) + document_ += ','; + writeValue(value[index]); + } + document_ += ']'; + } break; + case objectValue: { + Value::Members members(value.getMemberNames()); + document_ += '{'; + for (Value::Members::iterator it = members.begin(); it != members.end(); + ++it) { + const std::string& name = *it; + if (it != members.begin()) + document_ += ','; + document_ += valueToQuotedStringN(name.data(), static_cast(name.length())); + document_ += yamlCompatiblityEnabled_ ? ": " : ":"; + writeValue(value[name]); + } + document_ += '}'; + } break; + } +} + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_(74), indentSize_(3), addChildValues_() {} + +std::string StyledWriter::write(const Value& root) { + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue(root); + writeValue(root); + writeCommentAfterValueOnSameLine(root); + document_ += "\n"; + return document_; +} + +void StyledWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string& name = *it; + const Value& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + document_ += " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ','; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledWriter::writeArrayValue(const Value& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + writeIndent(); + writeValue(childValue); + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + document_ += ','; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + document_ += "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + +bool StyledWriter::isMultineArray(const Value& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value& childValue = value[index]; + isMultiLine = ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledWriter::pushValue(const std::string& value) { + if (addChildValues_) + childValues_.push_back(value); + else + document_ += value; +} + +void StyledWriter::writeIndent() { + if (!document_.empty()) { + char last = document_[document_.length() - 1]; + if (last == ' ') // already indented + return; + if (last != '\n') // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + +void StyledWriter::writeWithIndent(const std::string& value) { + writeIndent(); + document_ += value; +} + +void StyledWriter::indent() { indentString_ += std::string(indentSize_, ' '); } + +void StyledWriter::unindent() { + assert(int(indentString_.size()) >= indentSize_); + indentString_.resize(indentString_.size() - indentSize_); +} + +void StyledWriter::writeCommentBeforeValue(const Value& root) { + if (!root.hasComment(commentBefore)) + return; + + document_ += "\n"; + writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + document_ += *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + writeIndent(); + ++iter; + } + + // Comments are stripped of trailing newlines, so add one here + document_ += "\n"; +} + +void StyledWriter::writeCommentAfterValueOnSameLine(const Value& root) { + if (root.hasComment(commentAfterOnSameLine)) + document_ += " " + root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + document_ += "\n"; + document_ += root.getComment(commentAfter); + document_ += "\n"; + } +} + +bool StyledWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter(std::string indentation) + : document_(NULL), rightMargin_(74), indentation_(indentation), + addChildValues_() {} + +void StyledStreamWriter::write(std::ostream& out, const Value& root) { + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + indented_ = true; + writeCommentBeforeValue(root); + if (!indented_) writeIndent(); + indented_ = true; + writeValue(root); + writeCommentAfterValueOnSameLine(root); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + +void StyledStreamWriter::writeValue(const Value& value) { + switch (value.type()) { + case nullValue: + pushValue("null"); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble())); + break; + case stringValue: + { + // Is NULL possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + const std::string& name = *it; + const Value& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedString(name.c_str())); + *document_ << " : "; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void StyledStreamWriter::writeArrayValue(const Value& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isArrayMultiLine = isMultineArray(value); + if (isArrayMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + const Value& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + if (!indented_) writeIndent(); + indented_ = true; + writeValue(childValue); + indented_ = false; + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + *document_ << "[ "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + +bool StyledStreamWriter::isMultineArray(const Value& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + const Value& childValue = value[index]; + isMultiLine = ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void StyledStreamWriter::pushValue(const std::string& value) { + if (addChildValues_) + childValues_.push_back(value); + else + *document_ << value; +} + +void StyledStreamWriter::writeIndent() { + // blep intended this to look at the so-far-written string + // to determine whether we are already indented, but + // with a stream we cannot do that. So we rely on some saved state. + // The caller checks indented_. + *document_ << '\n' << indentString_; +} + +void StyledStreamWriter::writeWithIndent(const std::string& value) { + if (!indented_) writeIndent(); + *document_ << value; + indented_ = false; +} + +void StyledStreamWriter::indent() { indentString_ += indentation_; } + +void StyledStreamWriter::unindent() { + assert(indentString_.size() >= indentation_.size()); + indentString_.resize(indentString_.size() - indentation_.size()); +} + +void StyledStreamWriter::writeCommentBeforeValue(const Value& root) { + if (!root.hasComment(commentBefore)) + return; + + if (!indented_) writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + *document_ << *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + // writeIndent(); // would include newline + *document_ << indentString_; + ++iter; + } + indented_ = false; +} + +void StyledStreamWriter::writeCommentAfterValueOnSameLine(const Value& root) { + if (root.hasComment(commentAfterOnSameLine)) + *document_ << ' ' << root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + writeIndent(); + *document_ << root.getComment(commentAfter); + } + indented_ = false; +} + +bool StyledStreamWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +////////////////////////// +// BuiltStyledStreamWriter + +/// Scoped enums are not available until C++11. +struct CommentStyle { + /// Decide whether to write comments. + enum Enum { + None, ///< Drop all comments. + Most, ///< Recover odd behavior of previous versions (not implemented yet). + All ///< Keep all comments. + }; +}; + +struct BuiltStyledStreamWriter : public StreamWriter +{ + BuiltStyledStreamWriter( + std::string const& indentation, + CommentStyle::Enum cs, + std::string const& colonSymbol, + std::string const& nullSymbol, + std::string const& endingLineFeedSymbol, + bool useSpecialFloats, + unsigned int precision); + int write(Value const& root, std::ostream* sout); +private: + void writeValue(Value const& value); + void writeArrayValue(Value const& value); + bool isMultineArray(Value const& value); + void pushValue(std::string const& value); + void writeIndent(); + void writeWithIndent(std::string const& value); + void indent(); + void unindent(); + void writeCommentBeforeValue(Value const& root); + void writeCommentAfterValueOnSameLine(Value const& root); + static bool hasCommentForValue(const Value& value); + + typedef std::vector ChildValues; + + ChildValues childValues_; + std::string indentString_; + int rightMargin_; + std::string indentation_; + CommentStyle::Enum cs_; + std::string colonSymbol_; + std::string nullSymbol_; + std::string endingLineFeedSymbol_; + bool addChildValues_ : 1; + bool indented_ : 1; + bool useSpecialFloats_ : 1; + unsigned int precision_; +}; +BuiltStyledStreamWriter::BuiltStyledStreamWriter( + std::string const& indentation, + CommentStyle::Enum cs, + std::string const& colonSymbol, + std::string const& nullSymbol, + std::string const& endingLineFeedSymbol, + bool useSpecialFloats, + unsigned int precision) + : rightMargin_(74) + , indentation_(indentation) + , cs_(cs) + , colonSymbol_(colonSymbol) + , nullSymbol_(nullSymbol) + , endingLineFeedSymbol_(endingLineFeedSymbol) + , addChildValues_(false) + , indented_(false) + , useSpecialFloats_(useSpecialFloats) + , precision_(precision) +{ +} +int BuiltStyledStreamWriter::write(Value const& root, std::ostream* sout) +{ + sout_ = sout; + addChildValues_ = false; + indented_ = true; + indentString_ = ""; + writeCommentBeforeValue(root); + if (!indented_) writeIndent(); + indented_ = true; + writeValue(root); + writeCommentAfterValueOnSameLine(root); + *sout_ << endingLineFeedSymbol_; + sout_ = NULL; + return 0; +} +void BuiltStyledStreamWriter::writeValue(Value const& value) { + switch (value.type()) { + case nullValue: + pushValue(nullSymbol_); + break; + case intValue: + pushValue(valueToString(value.asLargestInt())); + break; + case uintValue: + pushValue(valueToString(value.asLargestUInt())); + break; + case realValue: + pushValue(valueToString(value.asDouble(), useSpecialFloats_, precision_)); + break; + case stringValue: + { + // Is NULL is possible for value.string_? + char const* str; + char const* end; + bool ok = value.getString(&str, &end); + if (ok) pushValue(valueToQuotedStringN(str, static_cast(end-str))); + else pushValue(""); + break; + } + case booleanValue: + pushValue(valueToString(value.asBool())); + break; + case arrayValue: + writeArrayValue(value); + break; + case objectValue: { + Value::Members members(value.getMemberNames()); + if (members.empty()) + pushValue("{}"); + else { + writeWithIndent("{"); + indent(); + Value::Members::iterator it = members.begin(); + for (;;) { + std::string const& name = *it; + Value const& childValue = value[name]; + writeCommentBeforeValue(childValue); + writeWithIndent(valueToQuotedStringN(name.data(), static_cast(name.length()))); + *sout_ << colonSymbol_; + writeValue(childValue); + if (++it == members.end()) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *sout_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("}"); + } + } break; + } +} + +void BuiltStyledStreamWriter::writeArrayValue(Value const& value) { + unsigned size = value.size(); + if (size == 0) + pushValue("[]"); + else { + bool isMultiLine = (cs_ == CommentStyle::All) || isMultineArray(value); + if (isMultiLine) { + writeWithIndent("["); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index = 0; + for (;;) { + Value const& childValue = value[index]; + writeCommentBeforeValue(childValue); + if (hasChildValue) + writeWithIndent(childValues_[index]); + else { + if (!indented_) writeIndent(); + indented_ = true; + writeValue(childValue); + indented_ = false; + } + if (++index == size) { + writeCommentAfterValueOnSameLine(childValue); + break; + } + *sout_ << ","; + writeCommentAfterValueOnSameLine(childValue); + } + unindent(); + writeWithIndent("]"); + } else // output on a single line + { + assert(childValues_.size() == size); + *sout_ << "["; + if (!indentation_.empty()) *sout_ << " "; + for (unsigned index = 0; index < size; ++index) { + if (index > 0) + *sout_ << ", "; + *sout_ << childValues_[index]; + } + if (!indentation_.empty()) *sout_ << " "; + *sout_ << "]"; + } + } +} + +bool BuiltStyledStreamWriter::isMultineArray(Value const& value) { + int size = value.size(); + bool isMultiLine = size * 3 >= rightMargin_; + childValues_.clear(); + for (int index = 0; index < size && !isMultiLine; ++index) { + Value const& childValue = value[index]; + isMultiLine = ((childValue.isArray() || childValue.isObject()) && + childValue.size() > 0); + } + if (!isMultiLine) // check if line length > max line length + { + childValues_.reserve(size); + addChildValues_ = true; + int lineLength = 4 + (size - 1) * 2; // '[ ' + ', '*n + ' ]' + for (int index = 0; index < size; ++index) { + if (hasCommentForValue(value[index])) { + isMultiLine = true; + } + writeValue(value[index]); + lineLength += int(childValues_[index].length()); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + +void BuiltStyledStreamWriter::pushValue(std::string const& value) { + if (addChildValues_) + childValues_.push_back(value); + else + *sout_ << value; +} + +void BuiltStyledStreamWriter::writeIndent() { + // blep intended this to look at the so-far-written string + // to determine whether we are already indented, but + // with a stream we cannot do that. So we rely on some saved state. + // The caller checks indented_. + + if (!indentation_.empty()) { + // In this case, drop newlines too. + *sout_ << '\n' << indentString_; + } +} + +void BuiltStyledStreamWriter::writeWithIndent(std::string const& value) { + if (!indented_) writeIndent(); + *sout_ << value; + indented_ = false; +} + +void BuiltStyledStreamWriter::indent() { indentString_ += indentation_; } + +void BuiltStyledStreamWriter::unindent() { + assert(indentString_.size() >= indentation_.size()); + indentString_.resize(indentString_.size() - indentation_.size()); +} + +void BuiltStyledStreamWriter::writeCommentBeforeValue(Value const& root) { + if (cs_ == CommentStyle::None) return; + if (!root.hasComment(commentBefore)) + return; + + if (!indented_) writeIndent(); + const std::string& comment = root.getComment(commentBefore); + std::string::const_iterator iter = comment.begin(); + while (iter != comment.end()) { + *sout_ << *iter; + if (*iter == '\n' && + (iter != comment.end() && *(iter + 1) == '/')) + // writeIndent(); // would write extra newline + *sout_ << indentString_; + ++iter; + } + indented_ = false; +} + +void BuiltStyledStreamWriter::writeCommentAfterValueOnSameLine(Value const& root) { + if (cs_ == CommentStyle::None) return; + if (root.hasComment(commentAfterOnSameLine)) + *sout_ << " " + root.getComment(commentAfterOnSameLine); + + if (root.hasComment(commentAfter)) { + writeIndent(); + *sout_ << root.getComment(commentAfter); + } +} + +// static +bool BuiltStyledStreamWriter::hasCommentForValue(const Value& value) { + return value.hasComment(commentBefore) || + value.hasComment(commentAfterOnSameLine) || + value.hasComment(commentAfter); +} + +/////////////// +// StreamWriter + +StreamWriter::StreamWriter() + : sout_(NULL) +{ +} +StreamWriter::~StreamWriter() +{ +} +StreamWriter::Factory::~Factory() +{} +StreamWriterBuilder::StreamWriterBuilder() +{ + setDefaults(&settings_); +} +StreamWriterBuilder::~StreamWriterBuilder() +{} +StreamWriter* StreamWriterBuilder::newStreamWriter() const +{ + std::string indentation = settings_["indentation"].asString(); + std::string cs_str = settings_["commentStyle"].asString(); + bool eyc = settings_["enableYAMLCompatibility"].asBool(); + bool dnp = settings_["dropNullPlaceholders"].asBool(); + bool usf = settings_["useSpecialFloats"].asBool(); + unsigned int pre = settings_["precision"].asUInt(); + CommentStyle::Enum cs = CommentStyle::All; + if (cs_str == "All") { + cs = CommentStyle::All; + } else if (cs_str == "None") { + cs = CommentStyle::None; + } else { + throwRuntimeError("commentStyle must be 'All' or 'None'"); + } + std::string colonSymbol = " : "; + if (eyc) { + colonSymbol = ": "; + } else if (indentation.empty()) { + colonSymbol = ":"; + } + std::string nullSymbol = "null"; + if (dnp) { + nullSymbol = ""; + } + if (pre > 17) pre = 17; + std::string endingLineFeedSymbol = ""; + return new BuiltStyledStreamWriter( + indentation, cs, + colonSymbol, nullSymbol, endingLineFeedSymbol, usf, pre); +} +static void getValidWriterKeys(std::set* valid_keys) +{ + valid_keys->clear(); + valid_keys->insert("indentation"); + valid_keys->insert("commentStyle"); + valid_keys->insert("enableYAMLCompatibility"); + valid_keys->insert("dropNullPlaceholders"); + valid_keys->insert("useSpecialFloats"); + valid_keys->insert("precision"); +} +bool StreamWriterBuilder::validate(Json::Value* invalid) const +{ + Json::Value my_invalid; + if (!invalid) invalid = &my_invalid; // so we do not need to test for NULL + Json::Value& inv = *invalid; + std::set valid_keys; + getValidWriterKeys(&valid_keys); + Value::Members keys = settings_.getMemberNames(); + size_t n = keys.size(); + for (size_t i = 0; i < n; ++i) { + std::string const& key = keys[i]; + if (valid_keys.find(key) == valid_keys.end()) { + inv[key] = settings_[key]; + } + } + return 0u == inv.size(); +} +Value& StreamWriterBuilder::operator[](std::string key) +{ + return settings_[key]; +} +// static +void StreamWriterBuilder::setDefaults(Json::Value* settings) +{ + //! [StreamWriterBuilderDefaults] + (*settings)["commentStyle"] = "All"; + (*settings)["indentation"] = "\t"; + (*settings)["enableYAMLCompatibility"] = false; + (*settings)["dropNullPlaceholders"] = false; + (*settings)["useSpecialFloats"] = false; + (*settings)["precision"] = 17; + //! [StreamWriterBuilderDefaults] +} + +std::string writeString(StreamWriter::Factory const& builder, Value const& root) { + std::ostringstream sout; + StreamWriterPtr const writer(builder.newStreamWriter()); + writer->write(root, &sout); + return sout.str(); +} + +std::ostream& operator<<(std::ostream& sout, Value const& root) { + StreamWriterBuilder builder; + StreamWriterPtr const writer(builder.newStreamWriter()); + writer->write(root, &sout); + return sout; +} + +} // namespace Json + +// ////////////////////////////////////////////////////////////////////// +// End of content of file: src/lib_json/json_writer.cpp +// ////////////////////////////////////////////////////////////////////// + + + + + diff --git a/contrib/openvr/src/openvr.pc.in b/contrib/openvr/src/openvr.pc.in new file mode 100755 index 0000000..3edba91 --- /dev/null +++ b/contrib/openvr/src/openvr.pc.in @@ -0,0 +1,11 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include/openvr + +Name: openvr +Description: OpenVR is an API and runtime that allos access to VR hardware. +Version: @OPENVR_VERSION@ + +Libs: -L${libdir} -lopenvr_api -ldl +Cflags: -I${includedir} diff --git a/contrib/openvr/src/openvr_api_public.cpp b/contrib/openvr/src/openvr_api_public.cpp new file mode 100755 index 0000000..8143b1e --- /dev/null +++ b/contrib/openvr/src/openvr_api_public.cpp @@ -0,0 +1,356 @@ +//========= Copyright Valve Corporation ============// +#define VR_API_EXPORT 1 +#define VR_API_PUBLIC 1 +#include "openvr.h" +#include "ivrclientcore.h" +#include +#include +#include +#include "hmderrors_public.h" +#include +#include +#include + +using vr::EVRInitError; +using vr::IVRSystem; +using vr::IVRClientCore; +using vr::VRInitError_None; + +// figure out how to import from the VR API dll +#if defined(_WIN32) +#define DYNAMIC_LIB_EXT ".dll" +#define PROGRAM_EXT ".exe" + +#if !defined(OPENVR_BUILD_STATIC) +#define VR_EXPORT_INTERFACE extern "C" __declspec( dllexport ) +#else +#define VR_EXPORT_INTERFACE extern "C" +#endif + +#elif defined(__GNUC__) || defined(COMPILER_GCC) || defined(__APPLE__) + +#define VR_EXPORT_INTERFACE extern "C" __attribute__((visibility("default"))) + +#else +#error "Unsupported Platform." +#endif + +namespace vr +{ + +static void *g_pVRModule = NULL; +static IVRClientCore *g_pHmdSystem = NULL; +static std::recursive_mutex g_mutexSystem; + + +typedef void* (*VRClientCoreFactoryFn)(const char *pInterfaceName, int *pReturnCode); + +static uint32_t g_nVRToken = 0; + +uint32_t VR_GetInitToken() +{ + return g_nVRToken; +} + +EVRInitError VR_LoadHmdSystemInternal(); +void CleanupInternalInterfaces(); + + +uint32_t VR_InitInternal2( EVRInitError *peError, vr::EVRApplicationType eApplicationType, const char *pStartupInfo ) +{ + std::lock_guard lock( g_mutexSystem ); + + EVRInitError err = VR_LoadHmdSystemInternal(); + if ( err == vr::VRInitError_None ) + { + err = g_pHmdSystem->Init( eApplicationType, pStartupInfo ); + } + + if ( peError ) + *peError = err; + + if ( err != VRInitError_None ) + { + SharedLib_Unload( g_pVRModule ); + g_pHmdSystem = NULL; + g_pVRModule = NULL; + + return 0; + } + + return ++g_nVRToken; +} + +VR_INTERFACE uint32_t VR_CALLTYPE VR_InitInternal( EVRInitError *peError, EVRApplicationType eApplicationType ); + +uint32_t VR_InitInternal( EVRInitError *peError, vr::EVRApplicationType eApplicationType ) +{ + return VR_InitInternal2( peError, eApplicationType, nullptr ); +} + +void VR_ShutdownInternal() +{ + std::lock_guard lock( g_mutexSystem ); + +#if !defined( VR_API_PUBLIC ) + CleanupInternalInterfaces(); +#endif + + if ( g_pHmdSystem ) + { + g_pHmdSystem->Cleanup(); + g_pHmdSystem = NULL; + } + + if ( g_pVRModule ) + { + SharedLib_Unload( g_pVRModule ); + g_pVRModule = NULL; + } + + ++g_nVRToken; +} + +EVRInitError VR_LoadHmdSystemInternal() +{ + std::string sRuntimePath, sConfigPath, sLogPath; + + bool bReadPathRegistry = CVRPathRegistry_Public::GetPaths( &sRuntimePath, &sConfigPath, &sLogPath, NULL, NULL ); + if( !bReadPathRegistry ) + { + return vr::VRInitError_Init_PathRegistryNotFound; + } + + // figure out where we're going to look for vrclient.dll + // see if the specified path actually exists. + if( !Path_IsDirectory( sRuntimePath ) ) + { + return vr::VRInitError_Init_InstallationNotFound; + } + + // Because we don't have a way to select debug vs. release yet we'll just + // use debug if it's there +#if defined( LINUX64 ) || defined( LINUXARM64 ) + std::string sTestPath = Path_Join( sRuntimePath, "bin", PLATSUBDIR ); +#else + std::string sTestPath = Path_Join( sRuntimePath, "bin" ); +#endif + if( !Path_IsDirectory( sTestPath ) ) + { + return vr::VRInitError_Init_InstallationCorrupt; + } + +#if defined( WIN64 ) + std::string sDLLPath = Path_Join( sTestPath, "vrclient_x64" DYNAMIC_LIB_EXT ); +#else + std::string sDLLPath = Path_Join( sTestPath, "vrclient" DYNAMIC_LIB_EXT ); +#endif + + // only look in the override + void *pMod = SharedLib_Load( sDLLPath.c_str() ); + // nothing more to do if we can't load the DLL + if( !pMod ) + { + return vr::VRInitError_Init_VRClientDLLNotFound; + } + + VRClientCoreFactoryFn fnFactory = ( VRClientCoreFactoryFn )( SharedLib_GetFunction( pMod, "VRClientCoreFactory" ) ); + if( !fnFactory ) + { + SharedLib_Unload( pMod ); + return vr::VRInitError_Init_FactoryNotFound; + } + + int nReturnCode = 0; + g_pHmdSystem = static_cast< IVRClientCore * > ( fnFactory( vr::IVRClientCore_Version, &nReturnCode ) ); + if( !g_pHmdSystem ) + { + SharedLib_Unload( pMod ); + return vr::VRInitError_Init_InterfaceNotFound; + } + + g_pVRModule = pMod; + return VRInitError_None; +} + + +void *VR_GetGenericInterface(const char *pchInterfaceVersion, EVRInitError *peError) +{ + std::lock_guard lock( g_mutexSystem ); + + if (!g_pHmdSystem) + { + if (peError) + *peError = vr::VRInitError_Init_NotInitialized; + return NULL; + } + + return g_pHmdSystem->GetGenericInterface(pchInterfaceVersion, peError); +} + +bool VR_IsInterfaceVersionValid(const char *pchInterfaceVersion) +{ + std::lock_guard lock( g_mutexSystem ); + + if (!g_pHmdSystem) + { + return false; + } + + return g_pHmdSystem->IsInterfaceVersionValid(pchInterfaceVersion) == VRInitError_None; +} + +bool VR_IsHmdPresent() +{ + std::lock_guard lock( g_mutexSystem ); + + if( g_pHmdSystem ) + { + // if we're already initialized, just call through + return g_pHmdSystem->BIsHmdPresent(); + } + else + { + // otherwise we need to do a bit more work + EVRInitError err = VR_LoadHmdSystemInternal(); + if( err != VRInitError_None ) + return false; + + bool bHasHmd = g_pHmdSystem->BIsHmdPresent(); + + g_pHmdSystem = NULL; + SharedLib_Unload( g_pVRModule ); + g_pVRModule = NULL; + + return bHasHmd; + } +} + +/** Returns true if the OpenVR runtime is installed. */ +bool VR_IsRuntimeInstalled() +{ + std::lock_guard lock( g_mutexSystem ); + + if( g_pHmdSystem ) + { + // if we're already initialized, OpenVR is obviously installed + return true; + } + else + { + // otherwise we need to do a bit more work + std::string sRuntimePath, sConfigPath, sLogPath; + + bool bReadPathRegistry = CVRPathRegistry_Public::GetPaths( &sRuntimePath, &sConfigPath, &sLogPath, NULL, NULL ); + if( !bReadPathRegistry ) + { + return false; + } + + // figure out where we're going to look for vrclient.dll + // see if the specified path actually exists. + if( !Path_IsDirectory( sRuntimePath ) ) + { + return false; + } + + // the installation may be corrupt in some way, but it certainly looks installed + return true; + } +} + + +// ------------------------------------------------------------------------------- +// Purpose: This is the old Runtime Path interface that is no longer exported in the +// latest header. We still want to export it from the DLL, though, so updating +// to a new DLL doesn't break old compiled code. This version was not thread +// safe and could change the buffer pointer to by a previous result on a +// subsequent call +// ------------------------------------------------------------------------------- +VR_EXPORT_INTERFACE const char *VR_CALLTYPE VR_RuntimePath(); + +/** Returns where OpenVR runtime is installed. */ +const char *VR_RuntimePath() +{ + static char rchBuffer[1024]; + uint32_t unRequiredSize; + if ( VR_GetRuntimePath( rchBuffer, sizeof( rchBuffer ), &unRequiredSize ) && unRequiredSize < sizeof( rchBuffer ) ) + { + return rchBuffer; + } + else + { + return nullptr; + } +} + + +/** Returns where OpenVR runtime is installed. */ +bool VR_GetRuntimePath( char *pchPathBuffer, uint32_t unBufferSize, uint32_t *punRequiredBufferSize ) +{ + // otherwise we need to do a bit more work + std::string sRuntimePath; + + *punRequiredBufferSize = 0; + + bool bReadPathRegistry = CVRPathRegistry_Public::GetPaths( &sRuntimePath, nullptr, nullptr, nullptr, nullptr ); + if ( !bReadPathRegistry ) + { + return false; + } + + // figure out where we're going to look for vrclient.dll + // see if the specified path actually exists. + if ( !Path_IsDirectory( sRuntimePath ) ) + { + return false; + } + + *punRequiredBufferSize = (uint32_t)sRuntimePath.size() + 1; + if ( sRuntimePath.size() >= unBufferSize ) + { + *pchPathBuffer = '\0'; + } + else + { + strcpy_safe( pchPathBuffer, unBufferSize, sRuntimePath.c_str() ); + } + + return true; +} + + +/** Returns the symbol version of an HMD error. */ +const char *VR_GetVRInitErrorAsSymbol( EVRInitError error ) +{ + std::lock_guard lock( g_mutexSystem ); + + if( g_pHmdSystem ) + return g_pHmdSystem->GetIDForVRInitError( error ); + else + return GetIDForVRInitError( error ); +} + + +/** Returns the english string version of an HMD error. */ +const char *VR_GetVRInitErrorAsEnglishDescription( EVRInitError error ) +{ + std::lock_guard lock( g_mutexSystem ); + + if ( g_pHmdSystem ) + return g_pHmdSystem->GetEnglishStringForHmdError( error ); + else + return GetEnglishStringForHmdError( error ); +} + + +VR_INTERFACE const char *VR_CALLTYPE VR_GetStringForHmdError( vr::EVRInitError error ); + +/** Returns the english string version of an HMD error. */ +const char *VR_GetStringForHmdError( EVRInitError error ) +{ + return VR_GetVRInitErrorAsEnglishDescription( error ); +} + +} + diff --git a/contrib/openvr/src/vrcommon/dirtools_public.cpp b/contrib/openvr/src/vrcommon/dirtools_public.cpp new file mode 100755 index 0000000..a9ab8a4 --- /dev/null +++ b/contrib/openvr/src/vrcommon/dirtools_public.cpp @@ -0,0 +1,101 @@ +//========= Copyright Valve Corporation ============// +#include +#include +#include + +#include +#include + +#ifdef _WIN32 +#include "windows.h" +#else +#include +#include +#include +#include +#endif + +#if defined( OSX ) +#include +#endif + + +//----------------------------------------------------------------------------- +// Purpose: utility function to create dirs & subdirs +//----------------------------------------------------------------------------- +bool BCreateDirectoryRecursive( const char *pchPath ) +{ + // Does it already exist? + if ( Path_IsDirectory( pchPath ) ) + return true; + + // copy the path into something we can munge + int len = (int)strlen( pchPath ); + char *path = (char *)malloc( len + 1 ); + strcpy( path, pchPath ); + + // Walk backwards to first non-existing dir that we find + char *s = path + len - 1; + + const char slash = Path_GetSlash(); + while ( s > path ) + { + if ( *s == slash ) + { + *s = '\0'; + bool bExists = Path_IsDirectory( path ); + *s = slash; + + if ( bExists ) + { + ++s; + break; + } + } + --s; + } + + // and then move forwards from there + + while ( *s ) + { + if ( *s == slash ) + { + *s = '\0'; + BCreateDirectory( path ); + *s = slash; + } + s++; + } + + bool bRetVal = BCreateDirectory( path ); + free( path ); + return bRetVal; +} + + +//----------------------------------------------------------------------------- +// Purpose: Creates the directory, returning true if it is created, or if it already existed +//----------------------------------------------------------------------------- +bool BCreateDirectory( const char *pchPath ) +{ +#ifdef WIN32 + std::wstring wPath = UTF8to16( pchPath ); + if ( ::CreateDirectoryW( wPath.c_str(), NULL ) ) + return true; + + if ( ::GetLastError() == ERROR_ALREADY_EXISTS ) + return true; + + return false; +#else + int i = mkdir( pchPath, S_IRWXU | S_IRWXG | S_IRWXO ); + if ( i == 0 ) + return true; + if ( errno == EEXIST ) + return true; + + return false; +#endif +} + diff --git a/contrib/openvr/src/vrcommon/dirtools_public.h b/contrib/openvr/src/vrcommon/dirtools_public.h new file mode 100755 index 0000000..b048b41 --- /dev/null +++ b/contrib/openvr/src/vrcommon/dirtools_public.h @@ -0,0 +1,17 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include +#include + + +#if !defined(_WIN32) +#include +#include +#endif + + +extern bool BCreateDirectoryRecursive( const char *pchPath ); +extern bool BCreateDirectory( const char *pchPath ); + + diff --git a/contrib/openvr/src/vrcommon/envvartools_public.cpp b/contrib/openvr/src/vrcommon/envvartools_public.cpp new file mode 100755 index 0000000..b8522e7 --- /dev/null +++ b/contrib/openvr/src/vrcommon/envvartools_public.cpp @@ -0,0 +1,88 @@ +//========= Copyright Valve Corporation ============// +#include +#include +#include +#include +#include + +#if defined(_WIN32) +#include + +#undef GetEnvironmentVariable +#undef SetEnvironmentVariable +#endif + + +std::string GetEnvironmentVariable( const char *pchVarName ) +{ +#if defined(_WIN32) + char rchValue[32767]; // max size for an env var on Windows + DWORD cChars = GetEnvironmentVariableA( pchVarName, rchValue, sizeof( rchValue ) ); + if( cChars == 0 ) + return ""; + else + return rchValue; +#elif defined(POSIX) + char *pchValue = getenv( pchVarName ); + if( pchValue ) + return pchValue; + else + return ""; +#else +#error "Unsupported Platform" +#endif +} + +bool GetEnvironmentVariableAsBool( const char *pchVarName, bool bDefault ) +{ + std::string sValue = GetEnvironmentVariable( pchVarName ); + + if ( sValue.empty() ) + { + return bDefault; + } + + sValue = StringToLower( sValue ); + std::string sYesValues[] = { "y", "yes", "true" }; + std::string sNoValues[] = { "n", "no", "false" }; + + for ( std::string &sMatch : sYesValues ) + { + if ( sMatch == sValue ) + { + return true; + } + } + + for ( std::string &sMatch : sNoValues ) + { + if ( sMatch == sValue ) + { + return false; + } + } + + if ( std::isdigit( sValue.at(0) ) ) + { + return atoi( sValue.c_str() ) != 0; + } + + fprintf( stderr, + "GetEnvironmentVariableAsBool(%s): Unable to parse value '%s', using default %d\n", + pchVarName, sValue.c_str(), bDefault ); + return bDefault; +} + +bool SetEnvironmentVariable( const char *pchVarName, const char *pchVarValue ) +{ +#if defined(_WIN32) + return 0 != SetEnvironmentVariableA( pchVarName, pchVarValue ); +#elif defined(POSIX) + if( pchVarValue == NULL ) + return 0 == unsetenv( pchVarName ); + else + return 0 == setenv( pchVarName, pchVarValue, 1 ); +#else +#error "Unsupported Platform" +#endif +} diff --git a/contrib/openvr/src/vrcommon/envvartools_public.h b/contrib/openvr/src/vrcommon/envvartools_public.h new file mode 100755 index 0000000..7cd4c20 --- /dev/null +++ b/contrib/openvr/src/vrcommon/envvartools_public.h @@ -0,0 +1,8 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include + +std::string GetEnvironmentVariable( const char *pchVarName ); +bool GetEnvironmentVariableAsBool( const char *pchVarName, bool bDefault ); +bool SetEnvironmentVariable( const char *pchVarName, const char *pchVarValue ); diff --git a/contrib/openvr/src/vrcommon/hmderrors_public.cpp b/contrib/openvr/src/vrcommon/hmderrors_public.cpp new file mode 100755 index 0000000..6f44d3a --- /dev/null +++ b/contrib/openvr/src/vrcommon/hmderrors_public.cpp @@ -0,0 +1,338 @@ +//========= Copyright Valve Corporation ============// +#include "openvr.h" +#include "hmderrors_public.h" +#include +#include + +using namespace vr; + +#define RETURN_ENUM_AS_STRING(enumValue) case enumValue: return #enumValue; + + +const char *GetEnglishStringForHmdError( vr::EVRInitError eError ) +{ + switch( eError ) + { + case VRInitError_None: return "No Error (0)"; + + case VRInitError_Init_InstallationNotFound: return "Installation Not Found (100)"; + case VRInitError_Init_InstallationCorrupt: return "Installation Corrupt (101)"; + case VRInitError_Init_VRClientDLLNotFound: return "vrclient Shared Lib Not Found (102)"; + case VRInitError_Init_FileNotFound: return "File Not Found (103)"; + case VRInitError_Init_FactoryNotFound: return "Factory Function Not Found (104)"; + case VRInitError_Init_InterfaceNotFound: return "Interface Not Found (105)"; + case VRInitError_Init_InvalidInterface: return "Invalid Interface (106)"; + case VRInitError_Init_UserConfigDirectoryInvalid: return "User Config Directory Invalid (107)"; + case VRInitError_Init_HmdNotFound: return "Hmd Not Found (108)"; + case VRInitError_Init_NotInitialized: return "Not Initialized (109)"; + case VRInitError_Init_PathRegistryNotFound: return "Installation path could not be located (110)"; + case VRInitError_Init_NoConfigPath: return "Config path could not be located (111)"; + case VRInitError_Init_NoLogPath: return "Log path could not be located (112)"; + case VRInitError_Init_PathRegistryNotWritable: return "Unable to write path registry (113)"; + case VRInitError_Init_AppInfoInitFailed: return "App info manager init failed (114)"; + case VRInitError_Init_Retry: return "Internal Retry (115)"; + case VRInitError_Init_InitCanceledByUser: return "User Canceled Init (116)"; + case VRInitError_Init_AnotherAppLaunching: return "Another app was already launching (117)"; + case VRInitError_Init_SettingsInitFailed: return "Settings manager init failed (118)"; + case VRInitError_Init_ShuttingDown: return "VR system shutting down (119)"; + case VRInitError_Init_TooManyObjects: return "Too many tracked objects (120)"; + case VRInitError_Init_NoServerForBackgroundApp: return "Not starting vrserver for background app (121)"; + case VRInitError_Init_NotSupportedWithCompositor: return "The requested interface is incompatible with the compositor and the compositor is running (122)"; + case VRInitError_Init_NotAvailableToUtilityApps: return "This interface is not available to utility applications (123)"; + case VRInitError_Init_Internal: return "vrserver internal error (124)"; + case VRInitError_Init_HmdDriverIdIsNone: return "Hmd DriverId is invalid (125)"; + case VRInitError_Init_HmdNotFoundPresenceFailed: return "Hmd Not Found Presence Failed (126)"; + case VRInitError_Init_VRMonitorNotFound: return "VR Monitor Not Found (127)"; + case VRInitError_Init_VRMonitorStartupFailed: return "VR Monitor startup failed (128)"; + case VRInitError_Init_LowPowerWatchdogNotSupported: return "Low Power Watchdog Not Supported (129)"; + case VRInitError_Init_InvalidApplicationType: return "Invalid Application Type (130)"; + case VRInitError_Init_NotAvailableToWatchdogApps: return "Not available to watchdog apps (131)"; + case VRInitError_Init_WatchdogDisabledInSettings: return "Watchdog disabled in settings (132)"; + case VRInitError_Init_VRDashboardNotFound: return "VR Dashboard Not Found (133)"; + case VRInitError_Init_VRDashboardStartupFailed: return "VR Dashboard startup failed (134)"; + case VRInitError_Init_VRHomeNotFound: return "VR Home Not Found (135)"; + case VRInitError_Init_VRHomeStartupFailed: return "VR home startup failed (136)"; + case VRInitError_Init_RebootingBusy: return "Rebooting In Progress (137)"; + case VRInitError_Init_FirmwareUpdateBusy: return "Firmware Update In Progress (138)"; + case VRInitError_Init_FirmwareRecoveryBusy: return "Firmware Recovery In Progress (139)"; + case VRInitError_Init_USBServiceBusy: return "USB Service Busy (140)"; + + case VRInitError_Driver_Failed: return "Driver Failed (200)"; + case VRInitError_Driver_Unknown: return "Driver Not Known (201)"; + case VRInitError_Driver_HmdUnknown: return "HMD Not Known (202)"; + case VRInitError_Driver_NotLoaded: return "Driver Not Loaded (203)"; + case VRInitError_Driver_RuntimeOutOfDate: return "Driver runtime is out of date (204)"; + case VRInitError_Driver_HmdInUse: return "HMD already in use by another application (205)"; + case VRInitError_Driver_NotCalibrated: return "Device is not calibrated (206)"; + case VRInitError_Driver_CalibrationInvalid: return "Device Calibration is invalid (207)"; + case VRInitError_Driver_HmdDisplayNotFound: return "HMD detected over USB, but Monitor not found (208)"; + case VRInitError_Driver_TrackedDeviceInterfaceUnknown: return "Driver Tracked Device Interface unknown (209)"; + // case VRInitError_Driver_HmdDisplayNotFoundAfterFix: return "HMD detected over USB, but Monitor not found after attempt to fix (210)"; // taken out upon Ben's request: He thinks that there is no need to separate that error from 208 + case VRInitError_Driver_HmdDriverIdOutOfBounds: return "Hmd DriverId is our of bounds (211)"; + case VRInitError_Driver_HmdDisplayMirrored: return "HMD detected over USB, but Monitor may be mirrored instead of extended (212)"; + case VRInitError_Driver_HmdDisplayNotFoundLaptop: return "On laptop, HMD detected over USB, but Monitor not found (213)"; + + case VRInitError_IPC_ServerInitFailed: return "VR Server Init Failed (300)"; + case VRInitError_IPC_ConnectFailed: return "Connect to VR Server Failed (301)"; + case VRInitError_IPC_SharedStateInitFailed: return "Shared IPC State Init Failed (302)"; + case VRInitError_IPC_CompositorInitFailed: return "Shared IPC Compositor Init Failed (303)"; + case VRInitError_IPC_MutexInitFailed: return "Shared IPC Mutex Init Failed (304)"; + case VRInitError_IPC_Failed: return "Shared IPC Failed (305)"; + case VRInitError_IPC_CompositorConnectFailed: return "Shared IPC Compositor Connect Failed (306)"; + case VRInitError_IPC_CompositorInvalidConnectResponse: return "Shared IPC Compositor Invalid Connect Response (307)"; + case VRInitError_IPC_ConnectFailedAfterMultipleAttempts: return "Shared IPC Connect Failed After Multiple Attempts (308)"; + case VRInitError_IPC_ConnectFailedAfterTargetExited: return "Shared IPC Connect Failed After Target Exited (309)"; + case VRInitError_IPC_NamespaceUnavailable: return "Shared IPC Namespace Unavailable (310)"; + + case VRInitError_Compositor_Failed: return "Compositor failed to initialize (400)"; + case VRInitError_Compositor_D3D11HardwareRequired: return "Compositor failed to find DX11 hardware (401)"; + case VRInitError_Compositor_FirmwareRequiresUpdate: return "Compositor requires mandatory firmware update (402)"; + case VRInitError_Compositor_OverlayInitFailed: return "Compositor initialization succeeded, but overlay init failed (403)"; + case VRInitError_Compositor_ScreenshotsInitFailed: return "Compositor initialization succeeded, but screenshot init failed (404)"; + case VRInitError_Compositor_UnableToCreateDevice: return "Compositor unable to create graphics device (405)"; + + // Oculus + case VRInitError_VendorSpecific_UnableToConnectToOculusRuntime: return "Unable to connect to Oculus Runtime (1000)"; + case VRInitError_VendorSpecific_OculusRuntimeBadInstall: return "Unable to connect to Oculus Runtime, possible bad install (1114)"; + + // Lighthouse + case VRInitError_VendorSpecific_HmdFound_CantOpenDevice: return "HMD found, but can not open device (1101)"; + case VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart: return "HMD found, but unable to request config (1102)"; + case VRInitError_VendorSpecific_HmdFound_NoStoredConfig: return "HMD found, but no stored config (1103)"; + case VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck: return "HMD found, but failed configuration check (1113)"; + case VRInitError_VendorSpecific_HmdFound_ConfigTooBig: return "HMD found, but config too big (1104)"; + case VRInitError_VendorSpecific_HmdFound_ConfigTooSmall: return "HMD found, but config too small (1105)"; + case VRInitError_VendorSpecific_HmdFound_UnableToInitZLib: return "HMD found, but unable to init ZLib (1106)"; + case VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion: return "HMD found, but problems with the data (1107)"; + case VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart: return "HMD found, but problems with the data (1108)"; + case VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart: return "HMD found, but problems with the data (1109)"; + case VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext: return "HMD found, but problems with the data (1110)"; + case VRInitError_VendorSpecific_HmdFound_UserDataAddressRange: return "HMD found, but problems with the data (1111)"; + case VRInitError_VendorSpecific_HmdFound_UserDataError: return "HMD found, but problems with the data (1112)"; + + case VRInitError_Steam_SteamInstallationNotFound: return "Unable to find Steam installation (2000)"; + + default: + return GetIDForVRInitError( eError ); + } + +} + + +const char *GetIDForVRInitError( vr::EVRInitError eError ) +{ + switch( eError ) + { + RETURN_ENUM_AS_STRING( VRInitError_None ); + RETURN_ENUM_AS_STRING( VRInitError_Unknown ); + + RETURN_ENUM_AS_STRING( VRInitError_Init_InstallationNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InstallationCorrupt ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRClientDLLNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_FileNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_FactoryNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InterfaceNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InvalidInterface ); + RETURN_ENUM_AS_STRING( VRInitError_Init_UserConfigDirectoryInvalid ); + RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NotInitialized ); + RETURN_ENUM_AS_STRING( VRInitError_Init_PathRegistryNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NoConfigPath ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NoLogPath ); + RETURN_ENUM_AS_STRING( VRInitError_Init_PathRegistryNotWritable ); + RETURN_ENUM_AS_STRING( VRInitError_Init_AppInfoInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_Retry ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InitCanceledByUser ); + RETURN_ENUM_AS_STRING( VRInitError_Init_AnotherAppLaunching ); + RETURN_ENUM_AS_STRING( VRInitError_Init_SettingsInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_ShuttingDown ); + RETURN_ENUM_AS_STRING( VRInitError_Init_TooManyObjects ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NoServerForBackgroundApp ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NotSupportedWithCompositor ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToUtilityApps ); + RETURN_ENUM_AS_STRING( VRInitError_Init_Internal ); + RETURN_ENUM_AS_STRING( VRInitError_Init_HmdDriverIdIsNone ); + RETURN_ENUM_AS_STRING( VRInitError_Init_HmdNotFoundPresenceFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRMonitorStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_LowPowerWatchdogNotSupported ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InvalidApplicationType ); + RETURN_ENUM_AS_STRING( VRInitError_Init_NotAvailableToWatchdogApps ); + RETURN_ENUM_AS_STRING( VRInitError_Init_WatchdogDisabledInSettings ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRDashboardStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeNotFound ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRHomeStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_RebootingBusy ); + RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareUpdateBusy ); + RETURN_ENUM_AS_STRING( VRInitError_Init_FirmwareRecoveryBusy ); + RETURN_ENUM_AS_STRING( VRInitError_Init_USBServiceBusy ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRWebHelperStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_TrackerManagerInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_AlreadyRunning ); + RETURN_ENUM_AS_STRING( VRInitError_Init_FailedForVrMonitor); + RETURN_ENUM_AS_STRING( VRInitError_Init_PropertyManagerInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_WebServerFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_IllegalTypeTransition ); + RETURN_ENUM_AS_STRING( VRInitError_Init_MismatchedRuntimes ); + RETURN_ENUM_AS_STRING( VRInitError_Init_InvalidProcessId ); + RETURN_ENUM_AS_STRING( VRInitError_Init_VRServiceStartupFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_PrismNeedsNewDrivers ); + RETURN_ENUM_AS_STRING( VRInitError_Init_PrismStartupTimedOut ); + RETURN_ENUM_AS_STRING( VRInitError_Init_CouldNotStartPrism ); + RETURN_ENUM_AS_STRING( VRInitError_Init_CreateDriverDirectDeviceFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Init_PrismExitedUnexpectedly ); + + RETURN_ENUM_AS_STRING( VRInitError_Driver_Failed ); + RETURN_ENUM_AS_STRING( VRInitError_Driver_Unknown ); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdUnknown); + RETURN_ENUM_AS_STRING( VRInitError_Driver_NotLoaded); + RETURN_ENUM_AS_STRING( VRInitError_Driver_RuntimeOutOfDate); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdInUse); + RETURN_ENUM_AS_STRING( VRInitError_Driver_NotCalibrated); + RETURN_ENUM_AS_STRING( VRInitError_Driver_CalibrationInvalid); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayNotFound); + RETURN_ENUM_AS_STRING( VRInitError_Driver_TrackedDeviceInterfaceUnknown ); + // RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayNotFoundAfterFix ); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDriverIdOutOfBounds ); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayMirrored ); + RETURN_ENUM_AS_STRING( VRInitError_Driver_HmdDisplayNotFoundLaptop ); + + RETURN_ENUM_AS_STRING( VRInitError_IPC_ServerInitFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_SharedStateInitFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorInitFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_MutexInitFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_Failed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorConnectFailed); + RETURN_ENUM_AS_STRING( VRInitError_IPC_CompositorInvalidConnectResponse); + RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterMultipleAttempts ); + RETURN_ENUM_AS_STRING( VRInitError_IPC_ConnectFailedAfterTargetExited ); + RETURN_ENUM_AS_STRING( VRInitError_IPC_NamespaceUnavailable ); + + RETURN_ENUM_AS_STRING( VRInitError_Compositor_Failed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_D3D11HardwareRequired ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FirmwareRequiresUpdate ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_OverlayInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_ScreenshotsInitFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_UnableToCreateDevice ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_SharedStateIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_NotificationManagerIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_ResourceManagerClientIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_MessageOverlaySharedStateInitFailure ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_PropertiesInterfaceIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateFullscreenWindowFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_SettingsInterfaceIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToShowWindow ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DistortInterfaceIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DisplayFrequencyFailure ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_RendererInitializationFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DXGIFactoryInterfaceIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DXGIFactoryCreateFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DXGIFactoryQueryFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_InvalidAdapterDesktop ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_InvalidHmdAttachment ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_InvalidOutputDesktop ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_InvalidDeviceProvided ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_D3D11RendererInitializationFailed ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToFindDisplayMode ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateSwapChain ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToGetBackBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateRenderTarget ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateDXGI2SwapChain ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedtoGetDXGI2BackBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateDXGI2RenderTarget ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToGetDXGIDeviceInterface ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_SelectDisplayMode ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateNvAPIRenderTargets ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_NvAPISetDisplayMode ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateDirectModeDisplay ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_InvalidHmdPropertyContainer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_UpdateDisplayFrequency ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateRasterizerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateWireframeRasterizerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateSamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateClampToBorderSamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateAnisoSamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlaySamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreatePanoramaSamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateFontSamplerState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateNoBlendState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateBlendState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateAlphaBlendState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateBlendStateMaskR ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateBlendStateMaskG ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateBlendStateMaskB ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateDepthStencilState ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateDepthStencilStateNoWrite ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateDepthStencilStateNoDepth ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateFlushTexture ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateDistortionSurfaces ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateHmdPoseConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateHmdPoseStagingConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateSharedFrameInfoConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateSceneTextureIndexConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateReadableSceneTextureIndexConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateLayerGraphicsTextureIndexConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateLayerComputeTextureIndexConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateLayerComputeSceneTextureIndexConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateComputeHmdPoseConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateGeomConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreatePanelMaskConstantBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreatePixelSimUBO ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateMSAARenderTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateResolveRenderTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateComputeResolveRenderTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateDriverDirectModeResolveTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_OpenDriverDirectModeResolveTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateFallbackSyncTexture ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_ShareFallbackSyncTexture ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayIndexBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayVertexBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateTextVertexBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateTextIndexBuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateMirrorTextures ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateLastFrameRenderTexture ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateMirrorOverlay ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateVirtualDisplayBackbuffer ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_DisplayModeNotSupported ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayInvalidCall ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_CreateOverlayAlreadyInitialized ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_FailedToCreateMailbox ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_WindowInterfaceIsNull ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_SystemLayerCreateInstance ); + RETURN_ENUM_AS_STRING( VRInitError_Compositor_SystemLayerCreateSession ); + + // Vendor-specific errors + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_UnableToConnectToOculusRuntime); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_WindowsNotInDevMode ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_OculusRuntimeBadInstall ); + + // Lighthouse + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantOpenDevice); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToRequestConfigStart); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_NoStoredConfig); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigFailedSanityCheck ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigTooBig ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_ConfigTooSmall ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToInitZLib ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_CantReadFirmwareVersion ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToSendUserDataStart ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataStart ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UnableToGetUserDataNext ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UserDataAddressRange ); + RETURN_ENUM_AS_STRING( VRInitError_VendorSpecific_HmdFound_UserDataError ); + + RETURN_ENUM_AS_STRING( VRInitError_Steam_SteamInstallationNotFound ); + + default: + { + static char buf[128]; + sprintf( buf, "Unknown error (%d)", eError ); + return buf; + } + } +} + diff --git a/contrib/openvr/src/vrcommon/hmderrors_public.h b/contrib/openvr/src/vrcommon/hmderrors_public.h new file mode 100755 index 0000000..ccd6c8a --- /dev/null +++ b/contrib/openvr/src/vrcommon/hmderrors_public.h @@ -0,0 +1,6 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +const char *GetEnglishStringForHmdError( vr::EVRInitError eError ); +const char *GetIDForVRInitError( vr::EVRInitError eError ); + diff --git a/contrib/openvr/src/vrcommon/pathtools_public.cpp b/contrib/openvr/src/vrcommon/pathtools_public.cpp new file mode 100755 index 0000000..a2fa8b9 --- /dev/null +++ b/contrib/openvr/src/vrcommon/pathtools_public.cpp @@ -0,0 +1,988 @@ +//========= Copyright Valve Corporation ============// +#include +#include + +#if defined( _WIN32) +#include +#include +#include +#include +#include +#include + +#undef GetEnvironmentVariable +#else +#include +#include +#include +#include +#include +#endif + +#if defined OSX +#include +#include +#include +#define _S_IFDIR S_IFDIR // really from tier0/platform.h which we dont have yet +#endif + +#include + +#include + +/** Returns the path (including filename) to the current executable */ +std::string Path_GetExecutablePath() +{ +#if defined( _WIN32 ) + wchar_t *pwchPath = new wchar_t[MAX_UNICODE_PATH]; + char *pchPath = new char[MAX_UNICODE_PATH_IN_UTF8]; + ::GetModuleFileNameW( NULL, pwchPath, MAX_UNICODE_PATH ); + WideCharToMultiByte( CP_UTF8, 0, pwchPath, -1, pchPath, MAX_UNICODE_PATH_IN_UTF8, NULL, NULL ); + delete[] pwchPath; + + std::string sPath = pchPath; + delete[] pchPath; + return sPath; +#elif defined( OSX ) + char rchPath[1024]; + uint32_t nBuff = sizeof( rchPath ); + bool bSuccess = _NSGetExecutablePath(rchPath, &nBuff) == 0; + rchPath[nBuff-1] = '\0'; + if( bSuccess ) + return rchPath; + else + return ""; +#elif defined LINUX + char rchPath[1024]; + size_t nBuff = sizeof( rchPath ); + ssize_t nRead = readlink("/proc/self/exe", rchPath, nBuff-1 ); + if ( nRead != -1 ) + { + rchPath[ nRead ] = 0; + return rchPath; + } + else + { + return ""; + } +#else + AssertMsg( false, "Implement Plat_GetExecutablePath" ); + return ""; +#endif + +} + +/** Returns the path of the current working directory */ +std::string Path_GetWorkingDirectory() +{ + std::string sPath; +#if defined( _WIN32 ) + wchar_t buf[MAX_UNICODE_PATH]; + sPath = UTF16to8( _wgetcwd( buf, MAX_UNICODE_PATH ) ); +#else + char buf[ 1024 ]; + sPath = getcwd( buf, sizeof( buf ) ); +#endif + return sPath; +} + +/** Sets the path of the current working directory. Returns true if this was successful. */ +bool Path_SetWorkingDirectory( const std::string & sPath ) +{ + bool bSuccess; +#if defined( _WIN32 ) + std::wstring wsPath = UTF8to16( sPath.c_str() ); + bSuccess = 0 == _wchdir( wsPath.c_str() ); +#else + bSuccess = 0 == chdir( sPath.c_str() ); +#endif + return bSuccess; +} + +/** Gets the path to a temporary directory. */ +std::string Path_GetTemporaryDirectory() +{ +#if defined( _WIN32 ) + wchar_t buf[MAX_UNICODE_PATH]; + if ( GetTempPathW( MAX_UNICODE_PATH, buf ) == 0 ) + return Path_GetWorkingDirectory(); + return UTF16to8( buf ); +#else + const char *pchTmpDir = getenv( "TMPDIR" ); + if ( pchTmpDir == NULL ) + { + return ""; + } + return pchTmpDir; +#endif +} + +/** Returns the specified path without its filename */ +std::string Path_StripFilename( const std::string & sPath, char slash ) +{ + if( slash == 0 ) + slash = Path_GetSlash(); + + std::string::size_type n = sPath.find_last_of( slash ); + if( n == std::string::npos ) + return sPath; + else + return std::string( sPath.begin(), sPath.begin() + n ); +} + +/** returns just the filename from the provided full or relative path. */ +std::string Path_StripDirectory( const std::string & sPath, char slash ) +{ + if( slash == 0 ) + slash = Path_GetSlash(); + + std::string::size_type n = sPath.find_last_of( slash ); + if( n == std::string::npos ) + return sPath; + else + return std::string( sPath.begin() + n + 1, sPath.end() ); +} + +/** returns just the filename with no extension of the provided filename. +* If there is a path the path is left intact. */ +std::string Path_StripExtension( const std::string & sPath ) +{ + for( std::string::const_reverse_iterator i = sPath.rbegin(); i != sPath.rend(); i++ ) + { + if( *i == '.' ) + { + return std::string( sPath.begin(), i.base() - 1 ); + } + + // if we find a slash there is no extension + if( *i == '\\' || *i == '/' ) + break; + } + + // we didn't find an extension + return sPath; +} + +/** returns just extension of the provided filename (if any). */ +std::string Path_GetExtension( const std::string & sPath ) +{ + for ( std::string::const_reverse_iterator i = sPath.rbegin(); i != sPath.rend(); i++ ) + { + if ( *i == '.' ) + { + return std::string( i.base(), sPath.end() ); + } + + // if we find a slash there is no extension + if ( *i == '\\' || *i == '/' ) + break; + } + + // we didn't find an extension + return ""; +} + +bool Path_IsAbsolute( const std::string & sPath ) +{ + if( sPath.empty() ) + return false; + +#ifdef _WIN32 + if ( sPath.size() < 3 ) // must be c:\x or \\x at least + return false; + + if ( sPath[1] == ':' ) // drive letter plus slash, but must test both slash cases + { + if ( sPath[2] == '\\' || sPath[2] == '/' ) + return true; + } + else if ( sPath[0] == '\\' && sPath[1] == '\\' ) // UNC path + return true; +#else + if( sPath[0] == '\\' || sPath[0] == '/' ) // any leading slash + return true; +#endif + + return false; +} + + +/** Makes an absolute path from a relative path and a base path */ +std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath ) +{ + if( Path_IsAbsolute( sRelativePath ) ) + return Path_Compact( sRelativePath ); + else + { + if( !Path_IsAbsolute( sBasePath ) ) + return ""; + + std::string sCompacted = Path_Compact( Path_Join( sBasePath, sRelativePath ) ); + if( Path_IsAbsolute( sCompacted ) ) + return sCompacted; + else + return ""; + } +} + + +/** Fixes the directory separators for the current platform */ +std::string Path_FixSlashes( const std::string & sPath, char slash ) +{ + if( slash == 0 ) + slash = Path_GetSlash(); + + std::string sFixed = sPath; + for( std::string::iterator i = sFixed.begin(); i != sFixed.end(); i++ ) + { + if( *i == '/' || *i == '\\' ) + *i = slash; + } + + return sFixed; +} + + +char Path_GetSlash() +{ +#if defined(_WIN32) + return '\\'; +#else + return '/'; +#endif +} + +/** Jams two paths together with the right kind of slash */ +std::string Path_Join( const std::string & first, const std::string & second, char slash ) +{ + if( slash == 0 ) + slash = Path_GetSlash(); + + // only insert a slash if we don't already have one + std::string::size_type nLen = first.length(); + if( !nLen ) + return second; +#if defined(_WIN32) + if( first.back() == '\\' || first.back() == '/' ) + nLen--; +#else + char last_char = first[first.length()-1]; + if (last_char == '\\' || last_char == '/') + nLen--; +#endif + + return first.substr( 0, nLen ) + std::string( 1, slash ) + second; +} + + +std::string Path_Join( const std::string & first, const std::string & second, const std::string & third, char slash ) +{ + return Path_Join( Path_Join( first, second, slash ), third, slash ); +} + +std::string Path_Join( const std::string & first, const std::string & second, const std::string & third, const std::string &fourth, char slash ) +{ + return Path_Join( Path_Join( Path_Join( first, second, slash ), third, slash ), fourth, slash ); +} + +std::string Path_Join( + const std::string & first, + const std::string & second, + const std::string & third, + const std::string & fourth, + const std::string & fifth, + char slash ) +{ + return Path_Join( Path_Join( Path_Join( Path_Join( first, second, slash ), third, slash ), fourth, slash ), fifth, slash ); +} + + +std::string Path_RemoveTrailingSlash( const std::string & sRawPath, char slash ) +{ + if ( slash == 0 ) + slash = Path_GetSlash(); + + std::string sPath = sRawPath; + std::string::size_type nCurrent = sRawPath.length(); + if ( nCurrent == 0 ) + return sPath; + + int nLastFound = -1; + nCurrent--; + while( nCurrent != 0 ) + { + if ( sRawPath[ nCurrent ] == slash ) + { + nLastFound = (int)nCurrent; + nCurrent--; + } + else + { + break; + } + } + + if ( nLastFound >= 0 ) + { + sPath.erase( nLastFound, std::string::npos ); + } + + return sPath; +} + + +/** Removes redundant /.. elements in the path. Returns an empty path if the +* specified path has a broken number of directories for its number of ..s */ +std::string Path_Compact( const std::string & sRawPath, char slash ) +{ + if( slash == 0 ) + slash = Path_GetSlash(); + + std::string sPath = Path_FixSlashes( sRawPath, slash ); + std::string sSlashString( 1, slash ); + + // strip out all /./ + for( std::string::size_type i = 0; (i + 3) < sPath.length(); ) + { + if( sPath[ i ] == slash && sPath[ i+1 ] == '.' && sPath[ i+2 ] == slash ) + { + sPath.replace( i, 3, sSlashString ); + } + else + { + ++i; + } + } + + + // get rid of trailing /. but leave the path separator + if( sPath.length() > 2 ) + { + std::string::size_type len = sPath.length(); + if( sPath[ len-1 ] == '.' && sPath[ len-2 ] == slash ) + { + sPath.pop_back(); + //Not sure why the following line of code was used for a while. It causes problems with strlen. + //sPath[len-1] = 0; // for now, at least + } + } + + // get rid of leading ./ + if( sPath.length() > 2 ) + { + if( sPath[ 0 ] == '.' && sPath[ 1 ] == slash ) + { + sPath.replace( 0, 2, "" ); + } + } + + // each time we encounter .. back up until we've found the previous directory name + // then get rid of both + std::string::size_type i = 0; + while( i < sPath.length() ) + { + if( i > 0 && sPath.length() - i >= 2 + && sPath[i] == '.' + && sPath[i+1] == '.' + && ( i + 2 == sPath.length() || sPath[ i+2 ] == slash ) + && sPath[ i-1 ] == slash ) + { + // check if we've hit the start of the string and have a bogus path + if( i == 1 ) + return ""; + + // find the separator before i-1 + std::string::size_type iDirStart = i-2; + while( iDirStart > 0 && sPath[ iDirStart - 1 ] != slash ) + --iDirStart; + + // remove everything from iDirStart to i+2 + sPath.replace( iDirStart, (i - iDirStart) + 3, "" ); + + // start over + i = 0; + } + else + { + ++i; + } + } + + return sPath; +} + + +/** Returns true if these two paths are the same without respect for internal . or .. +* sequences, slash type, or case (on case-insensitive platforms). */ +bool Path_IsSamePath( const std::string & sPath1, const std::string & sPath2 ) +{ + std::string sCompact1 = Path_Compact( sPath1 ); + std::string sCompact2 = Path_Compact( sPath2 ); +#if defined(WIN32) + return !stricmp( sCompact1.c_str(), sCompact2.c_str() ); +#else + return !strcmp( sCompact1.c_str(), sCompact2.c_str() ); +#endif +} + + +/** Returns the path to the current DLL or exe */ +std::string Path_GetThisModulePath() +{ + // gets the path of vrclient.dll itself +#ifdef WIN32 + HMODULE hmodule = NULL; + + ::GetModuleHandleEx( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, reinterpret_cast(Path_GetThisModulePath), &hmodule ); + + wchar_t *pwchPath = new wchar_t[MAX_UNICODE_PATH]; + char *pchPath = new char[ MAX_UNICODE_PATH_IN_UTF8 ]; + ::GetModuleFileNameW( hmodule, pwchPath, MAX_UNICODE_PATH ); + WideCharToMultiByte( CP_UTF8, 0, pwchPath, -1, pchPath, MAX_UNICODE_PATH_IN_UTF8, NULL, NULL ); + delete[] pwchPath; + + std::string sPath = pchPath; + delete [] pchPath; + return sPath; + +#elif defined( OSX ) || defined( LINUX ) + // get the addr of a function in vrclient.so and then ask the dlopen system about it + Dl_info info; + dladdr( (void *)Path_GetThisModulePath, &info ); + return info.dli_fname; +#endif + +} + + +/** returns true if the specified path exists and is a directory */ +bool Path_IsDirectory( const std::string & sPath ) +{ + std::string sFixedPath = Path_FixSlashes( sPath ); + if( sFixedPath.empty() ) + return false; + char cLast = sFixedPath[ sFixedPath.length() - 1 ]; + if( cLast == '/' || cLast == '\\' ) + sFixedPath.erase( sFixedPath.end() - 1, sFixedPath.end() ); + + // see if the specified path actually exists. + +#if defined(POSIX) + struct stat buf; + if ( stat( sFixedPath.c_str(), &buf ) == -1 ) + { + return false; + } + +#if defined( LINUX ) || defined( OSX ) + return S_ISDIR( buf.st_mode ); +#else + return (buf.st_mode & _S_IFDIR) != 0; +#endif + +#else + struct _stat buf; + std::wstring wsFixedPath = UTF8to16( sFixedPath.c_str() ); + if ( _wstat( wsFixedPath.c_str(), &buf ) == -1 ) + { + return false; + } + + return (buf.st_mode & _S_IFDIR) != 0; +#endif +} + +/** returns true if the specified path represents an app bundle */ +bool Path_IsAppBundle( const std::string & sPath ) +{ +#if defined(OSX) + @autoreleasepool { + NSBundle *bundle = [ NSBundle bundleWithPath: [ NSString stringWithUTF8String:sPath.c_str() ] ]; + bool bisAppBundle = ( nullptr != bundle ); + return bisAppBundle; + } +#else + return false; +#endif +} + +//----------------------------------------------------------------------------- +// Purpose: returns true if the the path exists +//----------------------------------------------------------------------------- +bool Path_Exists( const std::string & sPath ) +{ + std::string sFixedPath = Path_FixSlashes( sPath ); + if( sFixedPath.empty() ) + return false; + +#ifdef _WIN32 + struct _stat buf; + std::wstring wsFixedPath = UTF8to16( sFixedPath.c_str() ); + if ( _wstat( wsFixedPath.c_str(), &buf ) == -1 ) + { + return false; + } +#else + struct stat buf; + if ( stat ( sFixedPath.c_str(), &buf ) == -1) + { + return false; + } +#endif + + return true; +} + + +//----------------------------------------------------------------------------- +// Purpose: helper to find a directory upstream from a given path +//----------------------------------------------------------------------------- +std::string Path_FindParentDirectoryRecursively( const std::string &strStartDirectory, const std::string &strDirectoryName ) +{ + std::string strFoundPath = ""; + std::string strCurrentPath = Path_FixSlashes( strStartDirectory ); + if ( strCurrentPath.length() == 0 ) + return ""; + + bool bExists = Path_Exists( strCurrentPath ); + std::string strCurrentDirectoryName = Path_StripDirectory( strCurrentPath ); + if ( bExists && stricmp( strCurrentDirectoryName.c_str(), strDirectoryName.c_str() ) == 0 ) + return strCurrentPath; + + while( bExists && strCurrentPath.length() != 0 ) + { + strCurrentPath = Path_StripFilename( strCurrentPath ); + strCurrentDirectoryName = Path_StripDirectory( strCurrentPath ); + bExists = Path_Exists( strCurrentPath ); + if ( bExists && stricmp( strCurrentDirectoryName.c_str(), strDirectoryName.c_str() ) == 0 ) + return strCurrentPath; + } + + return ""; +} + + +//----------------------------------------------------------------------------- +// Purpose: helper to find a subdirectory upstream from a given path +//----------------------------------------------------------------------------- +std::string Path_FindParentSubDirectoryRecursively( const std::string &strStartDirectory, const std::string &strDirectoryName ) +{ + std::string strFoundPath = ""; + std::string strCurrentPath = Path_FixSlashes( strStartDirectory ); + if ( strCurrentPath.length() == 0 ) + return ""; + + bool bExists = Path_Exists( strCurrentPath ); + while( bExists && strCurrentPath.length() != 0 ) + { + strCurrentPath = Path_StripFilename( strCurrentPath ); + bExists = Path_Exists( strCurrentPath ); + + if( Path_Exists( Path_Join( strCurrentPath, strDirectoryName ) ) ) + { + strFoundPath = Path_Join( strCurrentPath, strDirectoryName ); + break; + } + } + return strFoundPath; +} + + +//----------------------------------------------------------------------------- +// Purpose: reading and writing files in the vortex directory +//----------------------------------------------------------------------------- +std::vector Path_ReadBinaryFile( const std::string & strFilename ) +{ + FILE *f; +#if defined( POSIX ) + f = fopen( strFilename.c_str(), "rb" ); +#else + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + // the open operation needs to be sharable, therefore use of _wfsopen instead of _wfopen_s + f = _wfsopen( wstrFilename.c_str(), L"rb", _SH_DENYNO ); +#endif + + std::vector vecFileContents; + + if ( f != NULL ) + { + fseek( f, 0, SEEK_END ); + int size = ftell( f ); + fseek( f, 0, SEEK_SET ); + + vecFileContents.resize( size ); + if ( fread( &vecFileContents[ 0 ], size, 1, f ) == 1 ) + { + } + else + { + vecFileContents.clear(); + } + + fclose( f ); + } + + return vecFileContents ; +} + + +unsigned char * Path_ReadBinaryFile( const std::string &strFilename, int *pSize ) +{ + FILE *f; +#if defined( POSIX ) + f = fopen( strFilename.c_str(), "rb" ); +#else + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + // the open operation needs to be sharable, therefore use of _wfsopen instead of _wfopen_s + f = _wfsopen( wstrFilename.c_str(), L"rb", _SH_DENYNO ); +#endif + + unsigned char* buf = NULL; + + if ( f != NULL ) + { + fseek(f, 0, SEEK_END); + int size = ftell(f); + fseek(f, 0, SEEK_SET); + + buf = new unsigned char[size]; + if (buf && fread(buf, size, 1, f) == 1) + { + if (pSize) + *pSize = size; + } + else + { + delete[] buf; + buf = 0; + } + + fclose(f); + } + + return buf; +} + +uint32_t Path_ReadBinaryFile( const std::string &strFilename, unsigned char *pBuffer, uint32_t unSize ) +{ + FILE *f; +#if defined( POSIX ) + f = fopen( strFilename.c_str(), "rb" ); +#else + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + errno_t err = _wfopen_s( &f, wstrFilename.c_str(), L"rb" ); + if ( err != 0 ) + { + f = NULL; + } +#endif + + uint32_t unSizeToReturn = 0; + + if ( f != NULL ) + { + fseek( f, 0, SEEK_END ); + uint32_t size = (uint32_t)ftell( f ); + fseek( f, 0, SEEK_SET ); + + if ( size > unSize || !pBuffer ) + { + unSizeToReturn = (uint32_t)size; + } + else + { + if ( fread( pBuffer, size, 1, f ) == 1 ) + { + unSizeToReturn = (uint32_t)size; + } + } + + fclose( f ); + } + + return unSizeToReturn; +} + +bool Path_WriteBinaryFile(const std::string &strFilename, unsigned char *pData, unsigned nSize) +{ + FILE *f; +#if defined( POSIX ) + f = fopen(strFilename.c_str(), "wb"); +#else + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + errno_t err = _wfopen_s( &f, wstrFilename.c_str(), L"wb" ); + if (err != 0) + { + f = NULL; + } +#endif + + size_t written = 0; + if (f != NULL) { + written = fwrite(pData, sizeof(unsigned char), nSize, f); + fclose(f); + } + + return written == nSize ? true : false; +} + +std::string Path_ReadTextFile( const std::string &strFilename ) +{ + // doing it this way seems backwards, but I don't + // see an easy way to do this with C/C++ style IO + // that isn't worse... + int size; + unsigned char* buf = Path_ReadBinaryFile( strFilename, &size ); + if (!buf) + return ""; + + // convert CRLF -> LF + size_t outsize = 1; + for (int i=1; i < size; i++) + { + if (buf[i] == '\n' && buf[i-1] == '\r') // CRLF + buf[outsize-1] = '\n'; // ->LF + else + buf[outsize++] = buf[i]; // just copy + } + + std::string ret((char *)buf, outsize); + delete[] buf; + return ret; +} + + +bool Path_MakeWritable( const std::string &strFilename ) +{ +#if defined ( _WIN32 ) + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + + DWORD dwAttrs = GetFileAttributesW( wstrFilename.c_str() ); + if ( dwAttrs != INVALID_FILE_ATTRIBUTES && ( dwAttrs & FILE_ATTRIBUTE_READONLY ) ) + { + return SetFileAttributesW( wstrFilename.c_str(), dwAttrs & ~FILE_ATTRIBUTE_READONLY ); + } +#else + struct stat sb; + + if ( stat( strFilename.c_str(), &sb ) == 0 && !( sb.st_mode & S_IWUSR ) ) + { + return ( chmod( strFilename.c_str(), sb.st_mode | S_IWUSR ) == 0 ); + } +#endif + + return true; +} + +bool Path_WriteStringToTextFile( const std::string &strFilename, const char *pchData ) +{ + FILE *f; +#if defined( POSIX ) + f = fopen( strFilename.c_str(), "w" ); +#else + std::wstring wstrFilename = UTF8to16( strFilename.c_str() ); + errno_t err = _wfopen_s( &f, wstrFilename.c_str(), L"w" ); + if ( err != 0 ) + { + f = NULL; + } +#endif + + bool ok = false; + + if ( f != NULL ) + { + ok = fputs( pchData, f) >= 0; + fclose(f); + } + + return ok; +} + +bool Path_WriteStringToTextFileAtomic( const std::string &strFilename, const char *pchData ) +{ + std::string strTmpFilename = strFilename + ".tmp"; + + if ( !Path_WriteStringToTextFile( strTmpFilename, pchData ) ) + return false; + + // Platform specific atomic file replacement +#if defined( _WIN32 ) + std::wstring wsFilename = UTF8to16( strFilename.c_str() ); + std::wstring wsTmpFilename = UTF8to16( strTmpFilename.c_str() ); + if ( !::ReplaceFileW( wsFilename.c_str(), wsTmpFilename.c_str(), nullptr, 0, 0, 0 ) ) + { + // if we couldn't ReplaceFile, try a non-atomic write as a fallback + if ( !Path_WriteStringToTextFile( strFilename, pchData ) ) + return false; + } +#elif defined( POSIX ) + if ( rename( strTmpFilename.c_str(), strFilename.c_str() ) == -1 ) + return false; +#else +#error Do not know how to write atomic file +#endif + + return true; +} + + +#if defined(WIN32) +#define FILE_URL_PREFIX "file:///" +#else +#define FILE_URL_PREFIX "file://" +#endif + +// ---------------------------------------------------------------------------------------------------------------------------- +// Purpose: Turns a path to a file on disk into a URL (or just returns the value if it's already a URL) +// ---------------------------------------------------------------------------------------------------------------------------- +std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath ) +{ + if ( StringHasPrefix( sRelativePath, "http://" ) + || StringHasPrefix( sRelativePath, "https://" ) + || StringHasPrefix( sRelativePath, "vr-input-workshop://" ) + || StringHasPrefix( sRelativePath, "file://" ) + ) + { + return sRelativePath; + } + else + { + std::string sAbsolute = Path_MakeAbsolute( sRelativePath, sBasePath ); + if ( sAbsolute.empty() ) + return sAbsolute; + sAbsolute = Path_FixSlashes( sAbsolute, '/' ); + + size_t unBufferSize = sAbsolute.length() * 3; + char *pchBuffer = (char *)alloca( unBufferSize ); + V_URLEncodeFullPath( pchBuffer, (int)unBufferSize, sAbsolute.c_str(), (int)sAbsolute.length() ); + + return std::string( FILE_URL_PREFIX ) + pchBuffer; + } +} + +// ----------------------------------------------------------------------------------------------------- +// Purpose: Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned +// ----------------------------------------------------------------------------------------------------- +std::string Path_UrlToFilePath( const std::string & sFileUrl ) +{ + if ( !strnicmp( sFileUrl.c_str(), FILE_URL_PREFIX, strlen( FILE_URL_PREFIX ) ) ) + { + char *pchBuffer = (char *)alloca( sFileUrl.length() ); + V_URLDecodeNoPlusForSpace( pchBuffer, (int)sFileUrl.length(), + sFileUrl.c_str() + strlen( FILE_URL_PREFIX ), (int)( sFileUrl.length() - strlen( FILE_URL_PREFIX ) ) ); + + return Path_FixSlashes( pchBuffer ); + } + else + { + return ""; + } +} + + +// ----------------------------------------------------------------------------------------------------- +// Purpose: Returns the root of the directory the system wants us to store user documents in +// ----------------------------------------------------------------------------------------------------- +std::string GetUserDocumentsPath() +{ +#ifdef _WIN32 + WCHAR rwchPath[MAX_PATH]; + + if ( !SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_MYDOCUMENTS | CSIDL_FLAG_CREATE, NULL, 0, rwchPath ) ) ) + { + return ""; + } + + // Convert the path to UTF-8 and store in the output + std::string sUserPath = UTF16to8( rwchPath ); + + return sUserPath; +#elif defined( OSX ) + @autoreleasepool { + NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES ); + if ( [paths count] == 0 ) + { + return ""; + } + + return [[paths objectAtIndex:0] UTF8String]; + } +#elif defined( LINUX ) + // @todo: not solved/changed as part of OSX - still not real - just removed old class based steam cut and paste + const char *pchHome = getenv( "HOME" ); + if ( pchHome == NULL ) + { + return ""; + } + return pchHome; +#endif +} + + +// ----------------------------------------------------------------------------------------------------- +// Purpose: deletes / unlinks a single file +// ----------------------------------------------------------------------------------------------------- +bool Path_UnlinkFile( const std::string &strFilename ) +{ +#ifdef _WIN32 + std::wstring wsFilename = UTF8to16( strFilename.c_str() ); + return ( 0 != DeleteFileW( wsFilename.c_str() ) ); +#else + return ( 0 == unlink( strFilename.c_str() ) ); +#endif +} + + +// ----------------------------------------------------------------------------------------------------- +// Limits the set of characters that are allowed in filenames +// ----------------------------------------------------------------------------------------------------- +std::string Path_SanitizeFilename( const std::string& sFilename ) +{ + std::string sFixed = sFilename; + std::string::iterator iLastDot = sFixed.end(); + for ( std::string::iterator i = sFixed.begin(); i != sFixed.end(); i++ ) + { + if ( *i == '.' ) + { + iLastDot = i; + } + + // path-related characters are forbidden (except the last period) + switch ( *i ) + { + case '\0': + case '.': + case '\\': + case '/': + case ':': + case '|': + case '?': + case '>': + case '<': + case '&': + case '%': + case '@': + case '$': + case '*': + case '\"': + *i = '_'; + break; + + default: + if ( *i < 32 ) + { + *i = '_'; + } + break; + } + } + + if ( iLastDot != sFixed.end() && iLastDot != sFixed.begin() + && iLastDot+1 != sFixed.end() ) + { + *iLastDot = '.'; + } + + return sFixed; +} diff --git a/contrib/openvr/src/vrcommon/pathtools_public.h b/contrib/openvr/src/vrcommon/pathtools_public.h new file mode 100755 index 0000000..8bad50a --- /dev/null +++ b/contrib/openvr/src/vrcommon/pathtools_public.h @@ -0,0 +1,153 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include +#include +#include + +/** Returns the path (including filename) to the current executable */ +std::string Path_GetExecutablePath(); + +/** Returns the path of the current working directory */ +std::string Path_GetWorkingDirectory(); + +/** Sets the path of the current working directory. Returns true if this was successful. */ +bool Path_SetWorkingDirectory( const std::string & sPath ); + +/** Gets the path to a temporary directory. */ +std::string Path_GetTemporaryDirectory(); + +/** returns the path (including filename) of the current shared lib or DLL */ +std::string Path_GetThisModulePath(); + +/** Returns the specified path without its filename. +* If slash is unspecified the native path separator of the current platform +* will be used. */ +std::string Path_StripFilename( const std::string & sPath, char slash = 0 ); + +/** returns just the filename from the provided full or relative path. */ +std::string Path_StripDirectory( const std::string & sPath, char slash = 0 ); + +/** returns just the filename with no extension of the provided filename. +* If there is a path the path is left intact. */ +std::string Path_StripExtension( const std::string & sPath ); + +/** returns just extension of the provided filename (if any). */ +std::string Path_GetExtension( const std::string & sPath ); + +/** Returns true if the path is absolute */ +bool Path_IsAbsolute( const std::string & sPath ); + +/** Makes an absolute path from a relative path and a base path */ +std::string Path_MakeAbsolute( const std::string & sRelativePath, const std::string & sBasePath ); + +/** Fixes the directory separators for the current platform. +* If slash is unspecified the native path separator of the current platform +* will be used. */ +std::string Path_FixSlashes( const std::string & sPath, char slash = 0 ); + +/** Returns the path separator for the current platform */ +char Path_GetSlash(); + +/** Jams two paths together with the right kind of slash */ +std::string Path_Join( const std::string & first, const std::string & second, char slash = 0 ); +std::string Path_Join( const std::string & first, const std::string & second, const std::string & third, char slash = 0 ); +std::string Path_Join( const std::string & first, const std::string & second, const std::string & third, const std::string &fourth, char slash = 0 ); +std::string Path_Join( + const std::string & first, + const std::string & second, + const std::string & third, + const std::string & fourth, + const std::string & fifth, + char slash = 0 ); + + +/** Removes redundant /.. elements in the path. Returns an empty path if the +* specified path has a broken number of directories for its number of ..s. +* If slash is unspecified the native path separator of the current platform +* will be used. */ +std::string Path_Compact( const std::string & sRawPath, char slash = 0 ); + +/** Returns true if these two paths are the same without respect for internal . or .. +* sequences, slash type, or case (on case-insensitive platforms). */ +bool Path_IsSamePath( const std::string & sPath1, const std::string & sPath2 ); + +//** Removed trailing slashes */ +std::string Path_RemoveTrailingSlash( const std::string & sRawPath, char slash = 0 ); + +/** returns true if the specified path exists and is a directory */ +bool Path_IsDirectory( const std::string & sPath ); + +/** returns true if the specified path represents an app bundle */ +bool Path_IsAppBundle( const std::string & sPath ); + +/** returns true if the the path exists */ +bool Path_Exists( const std::string & sPath ); + +/** Helper functions to find parent directories or subdirectories of parent directories */ +std::string Path_FindParentDirectoryRecursively( const std::string &strStartDirectory, const std::string &strDirectoryName ); +std::string Path_FindParentSubDirectoryRecursively( const std::string &strStartDirectory, const std::string &strDirectoryName ); + +/** Make a text file writable. */ +bool Path_MakeWritable( const std::string &strFilename ); + +/** Path operations to read or write text/binary files */ +unsigned char * Path_ReadBinaryFile( const std::string &strFilename, int *pSize ); +uint32_t Path_ReadBinaryFile( const std::string &strFilename, unsigned char *pBuffer, uint32_t unSize ); +std::vector Path_ReadBinaryFile( const std::string & strFilename ); +bool Path_WriteBinaryFile( const std::string &strFilename, unsigned char *pData, unsigned nSize ); +std::string Path_ReadTextFile( const std::string &strFilename ); +bool Path_WriteStringToTextFile( const std::string &strFilename, const char *pchData ); +bool Path_WriteStringToTextFileAtomic( const std::string &strFilename, const char *pchData ); + +/** Returns a file:// url for paths, or an http or https url if that's what was provided */ +std::string Path_FilePathToUrl( const std::string & sRelativePath, const std::string & sBasePath ); + +/** Strips off file:// off a URL and returns the path. For other kinds of URLs an empty string is returned */ +std::string Path_UrlToFilePath( const std::string & sFileUrl ); + +/** Returns the root of the directory the system wants us to store user documents in */ +std::string GetUserDocumentsPath(); + +/** deletes / unlinks a single file */ +bool Path_UnlinkFile( const std::string &strFilename ); + +std::string Path_SanitizeFilename( const std::string& sFilename ); + +#ifndef MAX_UNICODE_PATH + #define MAX_UNICODE_PATH 32767 +#endif + +#ifndef MAX_UNICODE_PATH_IN_UTF8 + #define MAX_UNICODE_PATH_IN_UTF8 (MAX_UNICODE_PATH * 4) +#endif + +//----------------------------------------------------------------------------- +#if defined(WIN32) +#define DYNAMIC_LIB_EXT ".dll" +#define PROGRAM_EXT ".exe" +#ifdef _WIN64 +#define PLATSUBDIR "win64" +#else +#define PLATSUBDIR "win32" +#endif +#elif defined(OSX) +#define DYNAMIC_LIB_EXT ".dylib" +#define PLATSUBDIR "osx32" +#define PROGRAM_EXT "" +#elif defined(LINUX) +#define DYNAMIC_LIB_EXT ".so" +#define PROGRAM_EXT "" +#if defined( LINUX32 ) +#define PLATSUBDIR "linux32" +#elif defined( ANDROIDARM64 ) +#define PLATSUBDIR "androidarm64" +#elif defined( LINUXARM64 ) +#define PLATSUBDIR "linuxarm64" +#else +#define PLATSUBDIR "linux64" +#endif +#else +#warning "Unknown platform for PLATSUBDIR" +#define PLATSUBDIR "unknown_platform" +#endif diff --git a/contrib/openvr/src/vrcommon/sharedlibtools_public.cpp b/contrib/openvr/src/vrcommon/sharedlibtools_public.cpp new file mode 100755 index 0000000..35bbe86 --- /dev/null +++ b/contrib/openvr/src/vrcommon/sharedlibtools_public.cpp @@ -0,0 +1,63 @@ +//========= Copyright Valve Corporation ============// +#include +#include + +#if defined(_WIN32) +#include +#endif + +#if defined(POSIX) +#include +#endif + + +SharedLibHandle SharedLib_Load( const char *pchPath, uint32_t *pErrorCode ) +{ + SharedLibHandle pHandle = nullptr; +#if defined( _WIN32) + pHandle = ( SharedLibHandle )LoadLibraryEx( pchPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH ); +#elif defined(POSIX) + pHandle = (SharedLibHandle) dlopen(pchPath, RTLD_LOCAL|RTLD_NOW); +#endif + + if ( pErrorCode ) + { + if ( pHandle == nullptr ) + { +#if defined( _WIN32) + *pErrorCode = ( uint32_t ) GetLastError(); +#elif defined(POSIX) + *pErrorCode = 1; +#endif + } + else + { + *pErrorCode = 0; + } + } + + return pHandle; +} + +void *SharedLib_GetFunction( SharedLibHandle lib, const char *pchFunctionName) +{ +#if defined( _WIN32) + return (void*)GetProcAddress( (HMODULE)lib, pchFunctionName ); +#elif defined(POSIX) + return dlsym( lib, pchFunctionName ); +#endif +} + + +void SharedLib_Unload( SharedLibHandle lib ) +{ + if ( !lib ) + return; +#if defined( _WIN32) + FreeLibrary( (HMODULE)lib ); +#elif defined(POSIX) + dlclose( lib ); +#endif +} + + diff --git a/contrib/openvr/src/vrcommon/sharedlibtools_public.h b/contrib/openvr/src/vrcommon/sharedlibtools_public.h new file mode 100755 index 0000000..38e7c29 --- /dev/null +++ b/contrib/openvr/src/vrcommon/sharedlibtools_public.h @@ -0,0 +1,12 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include + +typedef void *SharedLibHandle; + +SharedLibHandle SharedLib_Load( const char *pchPath, uint32_t *pErrorCode = nullptr ); +void *SharedLib_GetFunction( SharedLibHandle lib, const char *pchFunctionName); +void SharedLib_Unload( SharedLibHandle lib ); + + diff --git a/contrib/openvr/src/vrcommon/strtools_public.cpp b/contrib/openvr/src/vrcommon/strtools_public.cpp new file mode 100755 index 0000000..d4757d8 --- /dev/null +++ b/contrib/openvr/src/vrcommon/strtools_public.cpp @@ -0,0 +1,606 @@ +//========= Copyright Valve Corporation ============// +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined( _WIN32 ) +#include +#endif + +#if defined( OSX ) || defined( LINUX ) +//----------------------------------------------------------------------------- +// Purpose: stricmp -> strcasecmp bridge +//----------------------------------------------------------------------------- +int stricmp( const char *pStr1, const char *pStr2 ) +{ + return strcasecmp( pStr1, pStr2 ); +} + +//----------------------------------------------------------------------------- +// Purpose: strincmp -> strncasecmp bridge +//----------------------------------------------------------------------------- +int strnicmp( const char *pStr1, const char *pStr2, size_t unBufferLen ) +{ + return strncasecmp( pStr1, pStr2, unBufferLen ); +} +#endif + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool StringHasPrefix( const std::string & sString, const std::string & sPrefix ) +{ + return 0 == strnicmp( sString.c_str(), sPrefix.c_str(), sPrefix.length() ); +} + +bool StringHasPrefixCaseSensitive( const std::string & sString, const std::string & sPrefix ) +{ + return 0 == strncmp( sString.c_str(), sPrefix.c_str(), sPrefix.length() ); +} + + +bool StringHasSuffix( const std::string &sString, const std::string &sSuffix ) +{ + size_t cStrLen = sString.length(); + size_t cSuffixLen = sSuffix.length(); + + if ( cSuffixLen > cStrLen ) + return false; + + std::string sStringSuffix = sString.substr( cStrLen - cSuffixLen, cSuffixLen ); + + return 0 == stricmp( sStringSuffix.c_str(), sSuffix.c_str() ); +} + +bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string &sSuffix ) +{ + size_t cStrLen = sString.length(); + size_t cSuffixLen = sSuffix.length(); + + if ( cSuffixLen > cStrLen ) + return false; + + std::string sStringSuffix = sString.substr( cStrLen - cSuffixLen, cSuffixLen ); + + return 0 == strncmp( sStringSuffix.c_str(), sSuffix.c_str(),cSuffixLen ); +} + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +typedef std::codecvt_utf8< wchar_t > convert_type; + +std::string UTF16to8(const wchar_t * in) +{ + static std::wstring_convert< convert_type, wchar_t > s_converter; // construction of this can be expensive (or even serialized) depending on locale + + try + { + return s_converter.to_bytes( in ); + } + catch ( ... ) + { + return std::string(); + } +} + +std::string UTF16to8( const std::wstring & in ) { return UTF16to8( in.c_str() ); } + + +std::wstring UTF8to16(const char * in) +{ + static std::wstring_convert< convert_type, wchar_t > s_converter; // construction of this can be expensive (or even serialized) depending on locale + + try + { + return s_converter.from_bytes( in ); + } + catch ( ... ) + { + return std::wstring(); + } +} + +std::wstring UTF8to16( const std::string & in ) { return UTF8to16( in.c_str() ); } + +//----------------------------------------------------------------------------- +// Purpose: Format string to std::string converter +//----------------------------------------------------------------------------- +std::string Format( const char *pchFormat, ... ) +{ + static constexpr size_t k_ulMaxStackString = 4096; + + va_list args; + char pchBuffer[k_ulMaxStackString]; + + va_start( args, pchFormat ); + int unSize = vsnprintf( pchBuffer, sizeof( pchBuffer ), pchFormat, args ); + va_end( args ); + + // Something went fairly wrong + if ( unSize < 0 ) + { + //AssertMsg( false, "Format string parse failure" ); + return ""; + } + + // Processing on the stack worked, success + if ( unSize < k_ulMaxStackString ) + { + return pchBuffer; + } + + // If processing on the stack failed, fallback to a dynamic allocation + std::vector< char > vecChar{}; + vecChar.resize( unSize + 1 ); + + va_start( args, pchFormat ); + unSize = vsnprintf( vecChar.data(), vecChar.size(), pchFormat, args ); + va_end( args ); + + // Double check, just in case + if ( unSize < 0 ) + { + //AssertMsg( false, "Format string parse failure" ); + return ""; + } + + return vecChar.data(); +} + + + + +#if defined( _WIN32 ) +//----------------------------------------------------------------------------- +// Purpose: Convert LPSTR in the default CodePage to UTF8 +//----------------------------------------------------------------------------- +std::string DefaultACPtoUTF8( const char *pszStr ) +{ + if ( GetACP() == CP_UTF8 ) + { + return pszStr; + } + else + { + std::vector vecBuf( strlen( pszStr ) + 1 ); // should be guaranteed to be enough + MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, pszStr, -1, vecBuf.data(), (int) vecBuf.size() ); + return UTF16to8( vecBuf.data() ); + } +} +#endif + +// -------------------------------------------------------------------- +// Purpose: +// -------------------------------------------------------------------- +void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource ) +{ + strncpy( pchBuffer, pchSource, unBufferSizeBytes - 1 ); + pchBuffer[unBufferSizeBytes - 1] = '\0'; +} + +// -------------------------------------------------------------------- +// Purpose: converts a string to upper case +// -------------------------------------------------------------------- +std::string StringToUpper( const std::string & sString ) +{ + std::string sOut; + sOut.reserve( sString.size() + 1 ); + for( std::string::const_iterator i = sString.begin(); i != sString.end(); i++ ) + { + sOut.push_back( (char)toupper( *i ) ); + } + + return sOut; +} + + +// -------------------------------------------------------------------- +// Purpose: converts a string to lower case +// -------------------------------------------------------------------- +std::string StringToLower( const std::string & sString ) +{ + std::string sOut; + sOut.reserve( sString.size() + 1 ); + for( std::string::const_iterator i = sString.begin(); i != sString.end(); i++ ) + { + sOut.push_back( (char)tolower( *i ) ); + } + + return sOut; +} + + +uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen ) +{ + uint32_t unLen = (uint32_t)sValue.length() + 1; + if( !pchBuffer || !unBufferLen ) + return unLen; + + if( unBufferLen < unLen ) + { + pchBuffer[0] = '\0'; + } + else + { + memcpy( pchBuffer, sValue.c_str(), unLen ); + } + + return unLen; +} + + +/** Returns a std::string from a uint64_t */ +std::string Uint64ToString( uint64_t ulValue ) +{ + char buf[ 22 ]; +#if defined( _WIN32 ) + sprintf_s( buf, "%llu", ulValue ); +#else + snprintf( buf, sizeof( buf ), "%llu", (long long unsigned int ) ulValue ); +#endif + return buf; +} + + +/** returns a uint64_t from a string */ +uint64_t StringToUint64( const std::string & sValue ) +{ + return strtoull( sValue.c_str(), NULL, 0 ); +} + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a numeric value to a hex digit, value should be 0-15. +//----------------------------------------------------------------------------- +char cIntToHexDigit( int nValue ) +{ + //Assert( nValue >= 0 && nValue <= 15 ); + return "0123456789ABCDEF"[ nValue & 15 ]; +} + +//----------------------------------------------------------------------------- +// Purpose: Helper for converting a hex char value to numeric, return -1 if the char +// is not a valid hex digit. +//----------------------------------------------------------------------------- +int iHexCharToInt( char cValue ) +{ + int32_t iValue = cValue; + if ( (uint32_t)( iValue - '0' ) < 10 ) + return iValue - '0'; + + iValue |= 0x20; + if ( (uint32_t)( iValue - 'a' ) < 6 ) + return iValue - 'a' + 10; + + return -1; +} + + +//----------------------------------------------------------------------------- +// Purpose: These define the set of characters to filter for components (which +// need all the escaping we can muster) vs. paths (which don't want +// / and : escaped so we don't break less compliant URL handling code. +//----------------------------------------------------------------------------- +static bool CharNeedsEscape_Component( const char c ) +{ + return (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') + && c != '-' && c != '_' && c != '.'); +} +static bool CharNeedsEscape_FullPath( const char c ) +{ + return (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') + && c != '-' && c != '_' && c != '.' && c != '/' && c != ':' ); +} + + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of encode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +//----------------------------------------------------------------------------- +void V_URLEncodeInternal( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen, + bool bUsePlusForSpace, std::function< bool(const char)> fnNeedsEscape ) +{ + //AssertMsg( nDestLen > 3*nSourceLen, "Target buffer for V_URLEncode should be 3x source length, plus one for terminating null\n" ); + + int iDestPos = 0; + for ( int i=0; i < nSourceLen; ++i ) + { + // worst case we need 3 additional chars + if( (iDestPos+3) > nDestLen ) + { + pchDest[0] = '\0'; +// AssertMsg( false, "Target buffer too short\n" ); + return; + } + + // We allow only a-z, A-Z, 0-9, period, underscore, and hyphen to pass through unescaped. + // These are the characters allowed by both the original RFC 1738 and the latest RFC 3986. + // Current specs also allow '~', but that is forbidden under original RFC 1738. + if ( fnNeedsEscape( pchSource[i] ) ) + { + if ( bUsePlusForSpace && pchSource[i] == ' ' ) + { + pchDest[iDestPos++] = '+'; + } + else + { + pchDest[iDestPos++] = '%'; + uint8_t iValue = pchSource[i]; + if ( iValue == 0 ) + { + pchDest[iDestPos++] = '0'; + pchDest[iDestPos++] = '0'; + } + else + { + char cHexDigit1 = cIntToHexDigit( iValue % 16 ); + iValue /= 16; + char cHexDigit2 = cIntToHexDigit( iValue ); + pchDest[iDestPos++] = cHexDigit2; + pchDest[iDestPos++] = cHexDigit1; + } + } + } + else + { + pchDest[iDestPos++] = pchSource[i]; + } + } + + if( (iDestPos+1) > nDestLen ) + { + pchDest[0] = '\0'; + //AssertMsg( false, "Target buffer too short to terminate\n" ); + return; + } + + // Null terminate + pchDest[iDestPos++] = 0; +} + + +//----------------------------------------------------------------------------- +// Purpose: Internal implementation of decode, works in the strict RFC manner, or +// with spaces turned to + like HTML form encoding. +// +// Returns the amount of space used in the output buffer. +//----------------------------------------------------------------------------- +size_t V_URLDecodeInternal( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen, bool bUsePlusForSpace ) +{ + if ( nDecodeDestLen < nEncodedSourceLen ) + { + //AssertMsg( false, "V_URLDecode needs a dest buffer at least as large as the source" ); + return 0; + } + + int iDestPos = 0; + for( int i=0; i < nEncodedSourceLen; ++i ) + { + if ( bUsePlusForSpace && pchEncodedSource[i] == '+' ) + { + pchDecodeDest[ iDestPos++ ] = ' '; + } + else if ( pchEncodedSource[i] == '%' ) + { + // Percent signifies an encoded value, look ahead for the hex code, convert to numeric, and use that + + // First make sure we have 2 more chars + if ( i < nEncodedSourceLen - 2 ) + { + char cHexDigit1 = pchEncodedSource[i+1]; + char cHexDigit2 = pchEncodedSource[i+2]; + + // Turn the chars into a hex value, if they are not valid, then we'll + // just place the % and the following two chars direct into the string, + // even though this really shouldn't happen, who knows what bad clients + // may do with encoding. + bool bValid = false; + int iValue = iHexCharToInt( cHexDigit1 ); + if ( iValue != -1 ) + { + iValue *= 16; + int iValue2 = iHexCharToInt( cHexDigit2 ); + if ( iValue2 != -1 ) + { + iValue += iValue2; + pchDecodeDest[ iDestPos++ ] = (char)iValue; + bValid = true; + } + } + + if ( !bValid ) + { + pchDecodeDest[ iDestPos++ ] = '%'; + pchDecodeDest[ iDestPos++ ] = cHexDigit1; + pchDecodeDest[ iDestPos++ ] = cHexDigit2; + } + } + + // Skip ahead + i += 2; + } + else + { + pchDecodeDest[ iDestPos++ ] = pchEncodedSource[i]; + } + } + + // We may not have extra room to NULL terminate, since this can be used on raw data, but if we do + // go ahead and do it as this can avoid bugs. + if ( iDestPos < nDecodeDestLen ) + { + pchDecodeDest[iDestPos] = 0; + } + + return (size_t)iDestPos; +} + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void V_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return V_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, true, CharNeedsEscape_Component ); +} + + +void V_URLEncodeNoPlusForSpace( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return V_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false, CharNeedsEscape_Component ); +} + +void V_URLEncodeFullPath( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ) +{ + return V_URLEncodeInternal( pchDest, nDestLen, pchSource, nSourceLen, false, CharNeedsEscape_FullPath ); +} + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return V_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, true ); +} + +size_t V_URLDecodeNoPlusForSpace( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ) +{ + return V_URLDecodeInternal( pchDecodeDest, nDecodeDestLen, pchEncodedSource, nEncodedSourceLen, false ); +} + +//----------------------------------------------------------------------------- +void V_StripExtension( std::string &in ) +{ + // Find the last dot. If it's followed by a dot or a slash, then it's part of a + // directory specifier like ../../somedir/./blah. + std::string::size_type test = in.rfind( '.' ); + if ( test != std::string::npos ) + { + // This handles things like ".\blah" or "c:\my@email.com\abc\def\geh" + // Which would otherwise wind up with "" and "c:\my@email", respectively. + if ( in.rfind( '\\' ) < test && in.rfind( '/' ) < test ) + { + in.resize( test ); + } + } +} + + +//----------------------------------------------------------------------------- +// Purpose: Tokenizes a string into a vector of strings +//----------------------------------------------------------------------------- +std::vector TokenizeString( const std::string & sString, char cToken ) +{ + std::vector vecStrings; + std::istringstream stream( sString ); + std::string s; + while ( std::getline( stream, s, cToken ) ) + { + vecStrings.push_back( s ); + } + + if ( !sString.empty() && sString.back() == cToken ) + { + vecStrings.push_back( "" ); + } + + return vecStrings; +} + +//----------------------------------------------------------------------------- +// Purpose: Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere +//----------------------------------------------------------------------------- +bool RepairUTF8( const char *pbegin, const char *pend, std::string & sOutputUtf8 ) +{ + typedef std::codecvt_utf8 facet_type; + facet_type myfacet; + + std::mbstate_t mystate = std::mbstate_t(); + + sOutputUtf8.clear(); + sOutputUtf8.reserve( pend - pbegin ); + bool bSqueakyClean = true; + + const char *pmid = pbegin; + while ( pmid != pend ) + { + bool bHasError = false; + bool bHasValidData = false; + + char32_t out = 0xdeadbeef, *pout; + pbegin = pmid; + switch ( myfacet.in( mystate, pbegin, pend, pmid, &out, &out + 1, pout ) ) + { + case facet_type::ok: + bHasValidData = true; + break; + + case facet_type::noconv: + // unexpected! always converting type + bSqueakyClean = false; + break; + + case facet_type::partial: + bHasError = pbegin == pmid; + if ( bHasError ) + { + bSqueakyClean = false; + } + else + { + bHasValidData = true; + } + break; + + case facet_type::error: + bHasError = true; + bSqueakyClean = false; + break; + } + + if ( bHasValidData ) + { + // could convert back, but no need + for ( const char *p = pbegin; p != pmid; ++p ) + { + sOutputUtf8 += *p; + } + } + + if ( bHasError ) + { + sOutputUtf8 += '?'; + } + + if ( pmid == pbegin ) + { + pmid++; + } + } + + return bSqueakyClean; +} + +//----------------------------------------------------------------------------- +// Purpose: Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere +//----------------------------------------------------------------------------- +bool RepairUTF8( const std::string & sInputUtf8, std::string & sOutputUtf8 ) +{ + return RepairUTF8( sInputUtf8.data(), sInputUtf8.data() + sInputUtf8.size(), sOutputUtf8 ); +} diff --git a/contrib/openvr/src/vrcommon/strtools_public.h b/contrib/openvr/src/vrcommon/strtools_public.h new file mode 100755 index 0000000..0e8e349 --- /dev/null +++ b/contrib/openvr/src/vrcommon/strtools_public.h @@ -0,0 +1,154 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include +#include +#include +#include + +/** returns true if the string has the prefix */ +bool StringHasPrefix( const std::string & sString, const std::string & sPrefix ); +bool StringHasPrefixCaseSensitive( const std::string & sString, const std::string & sPrefix ); + +/** returns if the string has the suffix */ +bool StringHasSuffix( const std::string &sString, const std::string &sSuffix ); +bool StringHasSuffixCaseSensitive( const std::string &sString, const std::string &sSuffix ); + +/** converts a UTF-16 string to a UTF-8 string */ +std::string UTF16to8( const wchar_t * in ); +std::string UTF16to8( const std::wstring & in ); + +/** converts a UTF-8 string to a UTF-16 string */ +std::wstring UTF8to16(const char * in); +std::wstring UTF8to16( const std::string & in ); +#define Utf16FromUtf8 UTF8to16 + +#if defined( _WIN32 ) +std::string DefaultACPtoUTF8( const char *pszStr ); +#endif + +/** Repairs a should-be-UTF-8 string to a for-sure-is-UTF-8 string, plus return boolean if we subbed in '?' somewhere */ +bool RepairUTF8( const char *begin, const char *end, std::string & sOutputUtf8 ); +bool RepairUTF8( const std::string & sInputUtf8, std::string & sOutputUtf8 ); + +/** safely copy a string into a buffer */ +void strcpy_safe( char *pchBuffer, size_t unBufferSizeBytes, const char *pchSource ); +template< size_t bufferSize > +void strcpy_safe( char (& buffer) [ bufferSize ], const char *pchSource ) +{ + strcpy_safe( buffer, bufferSize, pchSource ); +} + +/** Turns printf-style format args into a std::string */ +std::string Format( const char *pchFormat, ... ); + + +/** converts a string to upper case */ +std::string StringToUpper( const std::string & sString ); + +/** converts a string to lower case */ +std::string StringToLower( const std::string & sString ); + +// we stricmp (from WIN) but it isn't POSIX - OSX/LINUX have strcasecmp so just inline bridge to it +#if defined( OSX ) || defined( LINUX ) +int stricmp(const char *pStr1, const char *pStr2); +#ifndef _stricmp +#define _stricmp stricmp +#endif +int strnicmp( const char *pStr1, const char *pStr2, size_t unBufferLen ); +#ifndef _strnicmp +#define _strnicmp strnicmp +#endif + +#ifndef _vsnprintf_s +#define _vsnprintf_s vsnprintf +#endif + +#define _TRUNCATE ((size_t)-1) + +#endif + +#if defined( OSX ) +// behaviors ensure NULL-termination at least as well as _TRUNCATE does, but +// wcsncpy_s/strncpy_s can non-NULL-terminate, wcslcpy/strlcpy can not. +inline errno_t wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count) +{ + return wcslcpy(strDest, strSource, numberOfElements); +} + +inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count) +{ + return strlcpy(strDest, strSource, numberOfElements); +} + +#endif + +#if defined( LINUX ) +// this implementation does not return whether or not the destination was +// truncated, but that is straightforward to fix if anybody actually needs the +// return code. +#include "string.h" +inline void wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count) +{ + wcsncpy(strDest, strSource, numberOfElements); + strDest[numberOfElements-1] = '\0'; +} + +inline void strncpy_s(char *strDest, size_t numberOfElements, const char *strSource, size_t count) +{ + strncpy(strDest, strSource, numberOfElements); + strDest[numberOfElements-1] = '\0'; +} + +#endif + +#if defined( _WIN32 ) && _MSC_VER < 1800 +inline uint64_t strtoull(const char *str, char **endptr, int base) { return _strtoui64( str, endptr, base ); } +#endif + +/* Handles copying a std::string into a buffer as would be provided in an API */ +uint32_t ReturnStdString( const std::string & sValue, char *pchBuffer, uint32_t unBufferLen ); + +/** Returns a std::string from a uint64_t */ +std::string Uint64ToString( uint64_t ulValue ); + +/** returns a uint64_t from a string */ +uint64_t StringToUint64( const std::string & sValue ); + +//----------------------------------------------------------------------------- +// Purpose: Encodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +//----------------------------------------------------------------------------- +void V_URLEncode( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +/** Same as V_URLEncode, but without plus for space. */ +void V_URLEncodeNoPlusForSpace( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + +/** Same as V_URLEncodeNoPlusForSpace, but without escaping / and : */ +void V_URLEncodeFullPath( char *pchDest, int nDestLen, const char *pchSource, int nSourceLen ); + + +//----------------------------------------------------------------------------- +// Purpose: Decodes a string (or binary data) from URL encoding format, see rfc1738 section 2.2. +// This version of the call isn't a strict RFC implementation, but uses + for space as is +// the standard in HTML form encoding, despite it not being part of the RFC. +// +// Dest buffer should be at least as large as source buffer to guarantee room for decode. +// Dest buffer being the same as the source buffer (decode in-place) is explicitly allowed. +//----------------------------------------------------------------------------- +size_t V_URLDecode( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); + +/** Same as V_URLDecode, but without plus for space. */ +size_t V_URLDecodeNoPlusForSpace( char *pchDecodeDest, int nDecodeDestLen, const char *pchEncodedSource, int nEncodedSourceLen ); + +//----------------------------------------------------------------------------- +// Purpose: strip extension from a path +//----------------------------------------------------------------------------- +void V_StripExtension( std::string &in ); + + +/** Tokenizes a string into a vector of strings */ +std::vector TokenizeString( const std::string & sString, char cToken ); diff --git a/contrib/openvr/src/vrcommon/vrpathregistry_public.cpp b/contrib/openvr/src/vrcommon/vrpathregistry_public.cpp new file mode 100755 index 0000000..675ea94 --- /dev/null +++ b/contrib/openvr/src/vrcommon/vrpathregistry_public.cpp @@ -0,0 +1,483 @@ +//========= Copyright Valve Corporation ============// + +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#include + +#undef GetEnvironmentVariable +#elif defined OSX +#include +#include +#elif defined(LINUX) +#include +#include +#endif + +#include +#include + +#ifndef VRLog + #if defined( __MINGW32__ ) + #define VRLog(args...) fprintf(stderr, args) + #elif defined( WIN32 ) + #define VRLog(fmt, ...) fprintf(stderr, fmt, __VA_ARGS__) + #else + #define VRLog(args...) fprintf(stderr, args) + #endif +#endif + +/** Returns the root of the directory the system wants us to store user config data in */ +static std::string GetAppSettingsPath() +{ +#ifdef _WIN32 + WCHAR rwchPath[MAX_PATH]; + + if( !SUCCEEDED( SHGetFolderPathW( NULL, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, rwchPath ) ) ) + { + return ""; + } + + // Convert the path to UTF-8 and store in the output + std::string sUserPath = UTF16to8( rwchPath ); + + return sUserPath; +#elif defined( OSX ) + std::string sSettingsDir; + @autoreleasepool { + // Search for the path + NSArray *paths = NSSearchPathForDirectoriesInDomains( NSApplicationSupportDirectory, NSUserDomainMask, YES ); + if ( [paths count] == 0 ) + { + return ""; + } + + NSString *resolvedPath = [paths objectAtIndex:0]; + resolvedPath = [resolvedPath stringByAppendingPathComponent: @"OpenVR"]; + + if ( ![[NSFileManager defaultManager] createDirectoryAtPath: resolvedPath withIntermediateDirectories:YES attributes:nil error:nil] ) + { + return ""; + } + + sSettingsDir.assign( [resolvedPath UTF8String] ); + } + return sSettingsDir; +#elif defined( LINUX ) + + // As defined by XDG Base Directory Specification + // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html + + const char *pchHome = getenv("XDG_CONFIG_HOME"); + if ( ( pchHome != NULL) && ( pchHome[0] != '\0' ) ) + { + return pchHome; + } + + // + // XDG_CONFIG_HOME is not defined, use ~/.config instead + // + pchHome = getenv( "HOME" ); + if ( pchHome == NULL ) + { + return ""; + } + + std::string sUserPath( pchHome ); + sUserPath = Path_Join( sUserPath, ".config" ); + return sUserPath; +#else + #warning "Unsupported platform" +#endif +} + + +// --------------------------------------------------------------------------- +// Purpose: Constructor +// --------------------------------------------------------------------------- +CVRPathRegistry_Public::CVRPathRegistry_Public() +{ + +} + +// --------------------------------------------------------------------------- +// Purpose: Computes the registry filename +// --------------------------------------------------------------------------- +std::string CVRPathRegistry_Public::GetOpenVRConfigPath() +{ + std::string sConfigPath = GetAppSettingsPath(); + if( sConfigPath.empty() ) + return ""; + +#if defined( _WIN32 ) || defined( LINUX ) + sConfigPath = Path_Join( sConfigPath, "openvr" ); +#elif defined ( OSX ) + sConfigPath = Path_Join( sConfigPath, ".openvr" ); +#else + #warning "Unsupported platform" +#endif + sConfigPath = Path_FixSlashes( sConfigPath ); + return sConfigPath; +} + + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +std::string CVRPathRegistry_Public::GetVRPathRegistryFilename() +{ + std::string sOverridePath = GetEnvironmentVariable( "VR_PATHREG_OVERRIDE" ); + if ( !sOverridePath.empty() ) + return sOverridePath; + + std::string sPath = GetOpenVRConfigPath(); + if ( sPath.empty() ) + return ""; + +#if defined( _WIN32 ) + sPath = Path_Join( sPath, "openvrpaths.vrpath" ); +#elif defined ( POSIX ) + sPath = Path_Join( sPath, "openvrpaths.vrpath" ); +#else + #error "Unsupported platform" +#endif + sPath = Path_FixSlashes( sPath ); + return sPath; +} + + +// --------------------------------------------------------------------------- +// Purpose: Converts JSON to a history array +// --------------------------------------------------------------------------- +static void ParseStringListFromJson( std::vector< std::string > *pvecHistory, const Json::Value & root, const char *pchArrayName ) +{ + if( !root.isMember( pchArrayName ) ) + return; + + const Json::Value & arrayNode = root[ pchArrayName ]; + if( !arrayNode ) + { + VRLog( "VR Path Registry node %s is not an array\n", pchArrayName ); + return; + } + + pvecHistory->clear(); + pvecHistory->reserve( arrayNode.size() ); + for( uint32_t unIndex = 0; unIndex < arrayNode.size(); unIndex++ ) + { + std::string sPath( arrayNode[ unIndex ].asString() ); + pvecHistory->push_back( sPath ); + } +} + + +// --------------------------------------------------------------------------- +// Purpose: Converts a history array to JSON +// --------------------------------------------------------------------------- +static void StringListToJson( const std::vector< std::string > & vecHistory, Json::Value & root, const char *pchArrayName ) +{ + Json::Value & arrayNode = root[ pchArrayName ]; + for( auto i = vecHistory.begin(); i != vecHistory.end(); i++ ) + { + arrayNode.append( *i ); + } +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +bool CVRPathRegistry_Public::ToJsonString( std::string &sJsonString ) +{ + std::string sRegPath = GetVRPathRegistryFilename(); + if( sRegPath.empty() ) + return false; + + std::string sRegistryContents = Path_ReadTextFile( sRegPath ); + if( sRegistryContents.empty() ) + return false; + + sJsonString = sRegistryContents; + + return true; +} + + +// --------------------------------------------------------------------------- +// Purpose: Loads the config file from its well known location +// --------------------------------------------------------------------------- +bool CVRPathRegistry_Public::BLoadFromFile( std::string *psLoadError ) +{ + std::string sRegPath = GetVRPathRegistryFilename(); + if( sRegPath.empty() ) + { + if ( psLoadError ) + { + *psLoadError = "Unable to determine VR Path Registry filename"; + } + return false; + } + + std::string sRegistryContents = Path_ReadTextFile( sRegPath ); + if( sRegistryContents.empty() ) + { + if ( psLoadError ) + { + *psLoadError = "Unable to read VR Path Registry from " + sRegPath; + } + return false; + } + + Json::Value root; + Json::CharReaderBuilder builder; + std::istringstream istream( sRegistryContents ); + std::string sErrors; + + try { + if ( !parseFromStream( builder, istream, &root, &sErrors ) ) + { + if ( psLoadError ) + { + *psLoadError = "Unable to parse " + sRegPath + ": " + sErrors; + } + return false; + } + + ParseStringListFromJson( &m_vecRuntimePath, root, "runtime" ); + ParseStringListFromJson( &m_vecConfigPath, root, "config" ); + ParseStringListFromJson( &m_vecLogPath, root, "log" ); + if ( root.isMember( "external_drivers" ) && root["external_drivers"].isArray() ) + { + ParseStringListFromJson( &m_vecExternalDrivers, root, "external_drivers" ); + } + } + catch ( ... ) + { + if ( psLoadError ) + { + *psLoadError = "Unable to parse " + sRegPath + ": exception thrown in JSON library"; + } + return false; + } + + return true; +} + + +// --------------------------------------------------------------------------- +// Purpose: Saves the config file to its well known location +// --------------------------------------------------------------------------- +bool CVRPathRegistry_Public::BSaveToFile() const +{ + std::string sRegPath = GetVRPathRegistryFilename(); + if( sRegPath.empty() ) + return false; + + Json::Value root; + + root[ "version" ] = 1; + root[ "jsonid" ] = "vrpathreg"; + + StringListToJson( m_vecRuntimePath, root, "runtime" ); + StringListToJson( m_vecConfigPath, root, "config" ); + StringListToJson( m_vecLogPath, root, "log" ); + StringListToJson( m_vecExternalDrivers, root, "external_drivers" ); + + Json::StreamWriterBuilder builder; + std::string sRegistryContents = Json::writeString( builder, root ); + + // make sure the directory we're writing into actually exists + std::string sRegDirectory = Path_StripFilename( sRegPath ); + if( !BCreateDirectoryRecursive( sRegDirectory.c_str() ) ) + { + VRLog( "Unable to create path registry directory %s\n", sRegDirectory.c_str() ); + return false; + } + + if( !Path_WriteStringToTextFile( sRegPath, sRegistryContents.c_str() ) ) + { + VRLog( "Unable to write VR path registry to %s\n", sRegPath.c_str() ); + return false; + } + + return true; +} + + +// --------------------------------------------------------------------------- +// Purpose: Returns the current runtime path or NULL if no path is configured. +// --------------------------------------------------------------------------- +std::string CVRPathRegistry_Public::GetRuntimePath() const +{ + if( m_vecRuntimePath.empty() ) + return ""; + else + return m_vecRuntimePath.front().c_str(); +} + + +// --------------------------------------------------------------------------- +// Purpose: Returns the current config path or NULL if no path is configured. +// --------------------------------------------------------------------------- +std::string CVRPathRegistry_Public::GetConfigPath() const +{ + if( m_vecConfigPath.empty() ) + return ""; + else + return m_vecConfigPath.front().c_str(); +} + + +// --------------------------------------------------------------------------- +// Purpose: Returns the current log path or NULL if no path is configured. +// --------------------------------------------------------------------------- +std::string CVRPathRegistry_Public::GetLogPath() const +{ + if( m_vecLogPath.empty() ) + return ""; + else + return m_vecLogPath.front().c_str(); +} + + + +// --------------------------------------------------------------------------- +// Purpose: Returns paths using the path registry and the provided override +// values. Pass NULL for any paths you don't care about. +// --------------------------------------------------------------------------- +bool CVRPathRegistry_Public::GetPaths( std::string *psRuntimePath, std::string *psConfigPath, std::string *psLogPath, const char *pchConfigPathOverride, const char *pchLogPathOverride, std::vector *pvecExternalDrivers ) +{ + std::string sLoadError; + CVRPathRegistry_Public pathReg; + bool bLoadedRegistry = pathReg.BLoadFromFile( &sLoadError ); + int nCountEnvironmentVariables = 0; + int nRequestedPaths = 0; + + if( psRuntimePath ) + { + nRequestedPaths++; + if ( GetEnvironmentVariable( k_pchRuntimeOverrideVar ).length() != 0 ) + { + *psRuntimePath = GetEnvironmentVariable( k_pchRuntimeOverrideVar ); + nCountEnvironmentVariables++; + } + else if( !pathReg.GetRuntimePath().empty() ) + { + *psRuntimePath = pathReg.GetRuntimePath(); + } + else + { + *psRuntimePath = ""; + } + } + + if( psConfigPath ) + { + nRequestedPaths++; + if ( GetEnvironmentVariable( k_pchConfigOverrideVar ).length() != 0 ) + { + *psConfigPath = GetEnvironmentVariable( k_pchConfigOverrideVar ); + nCountEnvironmentVariables++; + } + else if( pchConfigPathOverride ) + { + *psConfigPath = pchConfigPathOverride; + } + else if( !pathReg.GetConfigPath().empty() ) + { + *psConfigPath = pathReg.GetConfigPath(); + } + else + { + *psConfigPath = ""; + } + } + + if( psLogPath ) + { + nRequestedPaths++; + if ( GetEnvironmentVariable( k_pchLogOverrideVar ).length() != 0 ) + { + *psLogPath = GetEnvironmentVariable( k_pchLogOverrideVar ); + nCountEnvironmentVariables++; + } + else if( pchLogPathOverride ) + { + *psLogPath = pchLogPathOverride; + } + else if( !pathReg.GetLogPath().empty() ) + { + *psLogPath = pathReg.GetLogPath(); + } + else + { + *psLogPath = ""; + } + } + + if ( pvecExternalDrivers ) + { + *pvecExternalDrivers = pathReg.m_vecExternalDrivers; + } + + if ( nCountEnvironmentVariables == nRequestedPaths ) + { + // all three environment variables were set, so we don't need the physical file + return true; + } + else if( !bLoadedRegistry ) + { + VRLog( "%s\n", sLoadError.c_str() ); + } + + return bLoadedRegistry; +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +uint32_t CVRPathRegistry_Public::GetSteamAppId() +{ +#if !defined( REL_BRANCH_ONLY ) + uint32_t nSteamAppId = k_unSteamVRMainAppId; +#else + uint32_t nSteamAppId = k_unSteamVRAppId; +#endif + + return nSteamAppId; +} + + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +bool CVRPathRegistry_Public::IsSteamVRMain() +{ +#if defined( REL_BRANCH_ONLY ) + return false; +#else + return true; +#endif +} + +//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- +uint32_t CVRPathRegistry_Public::InitSteamAppId() +{ + uint32_t nSteamAppId = CVRPathRegistry_Public::GetSteamAppId(); + + // Forcefully setting to what it should be before SteamAPI_Init() since SteamVR is more often + // started as child processes of the game app and otherwise Steam then considers us as the + // wrong app id. + SetEnvironmentVariable( "SteamAppId", std::to_string( nSteamAppId ).c_str() ); + SetEnvironmentVariable( "SteamGameId", std::to_string( nSteamAppId ).c_str() ); + + return nSteamAppId; +} + diff --git a/contrib/openvr/src/vrcommon/vrpathregistry_public.h b/contrib/openvr/src/vrcommon/vrpathregistry_public.h new file mode 100755 index 0000000..6563286 --- /dev/null +++ b/contrib/openvr/src/vrcommon/vrpathregistry_public.h @@ -0,0 +1,52 @@ +//========= Copyright Valve Corporation ============// +#pragma once + +#include +#include +#include + +static const char *k_pchRuntimeOverrideVar = "VR_OVERRIDE"; +static const char *k_pchConfigOverrideVar = "VR_CONFIG_PATH"; +static const char *k_pchLogOverrideVar = "VR_LOG_PATH"; + +static const uint32_t k_unSteamVRAppId = 250820; +static const uint32_t k_unSteamVRMainAppId = 330050; + + +class CVRPathRegistry_Public +{ +public: + static std::string GetVRPathRegistryFilename(); + static std::string GetOpenVRConfigPath(); + static uint32_t GetSteamAppId(); + static bool IsSteamVRMain(); + static uint32_t InitSteamAppId(); + +public: + CVRPathRegistry_Public(); + + /** Returns paths using the path registry and the provided override values. Pass NULL for any paths you don't care about. + * Returns false if the path registry could not be read. Valid paths might still be returned based on environment variables. */ + static bool GetPaths( std::string *psRuntimePath, std::string *psConfigPath, std::string *psLogPath, const char *pchConfigPathOverride, const char *pchLogPathOverride, std::vector *pvecExternalDrivers = NULL ); + + bool BLoadFromFile( std::string *psError = nullptr ); + bool BSaveToFile() const; + + bool ToJsonString( std::string &sJsonString ); + + // methods to get the current values + std::string GetRuntimePath() const; + std::string GetConfigPath() const; + std::string GetLogPath() const; + +protected: + typedef std::vector< std::string > StringVector_t; + + // index 0 is the current setting + StringVector_t m_vecRuntimePath; + StringVector_t m_vecLogPath; + StringVector_t m_vecConfigPath; + + // full list of external drivers + StringVector_t m_vecExternalDrivers; +}; diff --git a/contrib/quirc b/contrib/quirc new file mode 160000 index 0000000..9c0f555 --- /dev/null +++ b/contrib/quirc @@ -0,0 +1 @@ +Subproject commit 9c0f555acb2531d818f2c405044418fc75379fb2 diff --git a/contrib/tor b/contrib/tor deleted file mode 160000 index e687707..0000000 --- a/contrib/tor +++ /dev/null @@ -1 +0,0 @@ -Subproject commit e68770719ef4d3d3b83398715b1e10391ab6a1b4 diff --git a/docs/BUILDING.md b/docs/BUILDING.md new file mode 100644 index 0000000..15ef6b6 --- /dev/null +++ b/docs/BUILDING.md @@ -0,0 +1,71 @@ +# Building WOWlet + +Building for Linux and Windows via Docker is done in 3 steps: + +1. Cloning this repository (+submodules) +2. Creating a base Docker image +3. Using the base image to compile a build + +**important:** you only have to do step 2 (base docker image) once. + +For Mac OS, scroll down. + +# Linux + +For more information, check the Dockerfile: `Dockerfile`. + +### 1. Clone + +```bash +git clone --branch master --recursive https://git.wownero.com/wowlet/wowlet.git +cd wowlet +``` + +Replace `master` with the desired version tag (e.g. `v3.1.0`) to build the release binary. + +### 2. Base image + +```bash +docker build --tag wowlet:linux --build-arg THREADS=6 . +``` + +Building the base image takes a while. **You only need to build the base image once.** + +### 3. Build + +```bash +docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:linux sh -c 'make release-static -j6' +``` + +If you're re-running a build make sure to `rm -rf build/` first. + +The resulting binary can be found in `build/bin/wowlet`. + +# Windows + +### 1. Clone + +```bash +git clone --branch master --recursive https://git.wownero.com/wowlet/wowlet.git +cd wowlet +``` + +Replace `master` with the desired version tag (e.g. `v3.1.0`) to build the release binary. + +### 2. Base image + +```bash +docker build -f Dockerfile.windows --tag wowlet:win --build-arg THREADS=6 . +``` + +Building the base image takes a while. **You only need to build the base image once.** + +### 3. Build + +```bash +docker run --rm -it -v $PWD:/wowlet -w /wowlet wowlet:win sh -c 'make windows root=/depends target=x86_64-w64-mingw32 tag=win-x64 -j6' +``` + +If you're re-running a build make sure to `rm -rf build/` first. + +The resulting binary can be found in `build/x86_64-w64-mingw32/release/bin/wowlet.exe`. diff --git a/docs/HACKING.md b/docs/HACKING.md new file mode 100644 index 0000000..4c8a9a5 --- /dev/null +++ b/docs/HACKING.md @@ -0,0 +1,89 @@ +# Documentation for developers + +WOWlet is developed primarily on Linux. It uses Qt 5.15.* and chances are that your +distro's package manager has a lower version. It is therefore recommended that you install +Qt manually using the online installer, which can be found here: https://www.qt.io/download +(under open-source). + +## Jetbrains Clion + +WOWlet was developed using JetBrains Clion since it integrates nicely +with CMake and comes with a built-in debugger. To pass CMake flags to CLion, +go to `File->Settings->Build->CMake`, set Build Type to `Debug` and set your +preferred CMake options/definitions. + +## Man Page + +There is a WOWlet's manual page, which can be accessed with: `man wowlet` + +If a new option is introduced, please be sure to update the options section in +`src/assets/wowlet.1.md`, the month and year in line 3, and "manify" the document +by running this command: `pandoc wowlet.1.md -s -t man -o wowlet.1 && gzip wowlet.1` + +## Requirements + +(Possibly out-of-date) + +### Ubuntu/Debian + +```bash +apt install -y git cmake libqrencode-dev build-essential cmake libboost-all-dev \ +miniupnpc libunbound-dev graphviz doxygen libunwind8-dev pkg-config libssl-dev \ +libzmq3-dev libsodium-dev libhidapi-dev libnorm-dev libusb-1.0-0-dev libpgm-dev \ +libprotobuf-dev protobuf-compiler libgcrypt20-dev libpng-dev +``` + +## CMake + +After installing Qt you might have a folder called `/home/$USER/Qt/`. You need to pass this to CMake +via the `CMAKE_PREFIX_PATH` definition. + +``` +-DCMAKE_PREFIX_PATH=/home/$USER/QtFooBar/5.15.0/gcc_64 +``` + +There are some Wownero/WOWlet related options/definitions that you may pass, see also `CMakeLists.txt`. + +At a bare minimum, recommended: + +`-DMANUAL_SUBMODULES=1 -DUSE_DEVICE_TREZOR=OFF -DUSE_SINGLE_BUILDDIR=ON -DDEV_MODE=ON` + +If you have OpenSSL installed at a custom location, try: + +``` +-DOPENSSL_INCLUDE_DIR=/usr/local/lib/openssl-1.1.1g/include +-DOPENSSL_SSL_LIBRARY=/usr/local/lib/openssl-1.1.1g/libssl.so.1.1 +-DOPENSSL_CRYPTO_LIBRARY=/usr/local/lib/openssl-1.1.1g/libcrypto.so.1.1 +``` + +I prefer also enabling verbose makefiles, which may be useful in some situations. + +``` +-DCMAKE_VERBOSE_MAKEFILE=ON +``` + +Enable debugging symbols: + +```bash +-DCMAKE_BUILD_TYPE=Debug +``` + +## Wowlet + +It's best to install Tor locally as a service and start `wowlet` with `--use-local-tor`, this +prevents the child process from starting up each time you launch WOWlet and thus saves time. + +#### Ubuntu/Debian + +```bash +apt install -y tor +sudo service tor start +``` + +To skip the wizards and open a wallet directly use `--wallet-file`: + +```bash +./wowlet --use-local-tor --wallet-file /home/user/Wownero/wallets/bla.keys +``` + + diff --git a/SECURITY.md b/docs/SECURITY.md similarity index 72% rename from SECURITY.md rename to docs/SECURITY.md index 250d74d..f034c0e 100644 --- a/SECURITY.md +++ b/docs/SECURITY.md @@ -4,13 +4,12 @@ Please do not open an issue to report security issues. -To report a vulnerability send an email to dev@featherwallet.org +To report a vulnerability send an email to dev@wownero.org The following keys may be used to communicate sensitive information to developers: | Name | Fingerprint | |------|-------------| | dsc | 1BFD 40F9 B0E2 B40D C8C7 FD4A 521F 1E79 91AA 42DC | -| tobtoht | C5AB E5C0 E50F A2B3 F14A B92D 1CAD D27F 41F4 5C3C | Public keys can be found in `utils/pubkeys`. diff --git a/monero b/monero deleted file mode 160000 index 85b0b4f..0000000 --- a/monero +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 85b0b4f73aa6114e3ff91207aa94ad2a15c939a2 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 99c870a..c87dc44 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,19 +2,11 @@ set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_AUTOUIC ON) -# pthread find_package(Threads REQUIRED) +find_package(ZLIB REQUIRED) +find_package(PNG REQUIRED) -find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Svg Xml WebSockets) - -add_subdirectory(libwalletqt) -add_subdirectory(model) -add_subdirectory(utils) -add_subdirectory(openpgp) - -qt5_add_resources(RESOURCES assets.qrc) - -# Compile source files (.h/.cpp) +# Compile these source files (.h/.cpp) file(GLOB SOURCE_FILES "*.h" "*.cpp" @@ -42,12 +34,43 @@ file(GLOB SOURCE_FILES "dialog/*.cpp" ) +find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Network Svg Xml WebSockets Quick QuickWidgets Qml QuickControls2 QuickCompiler QmlImportScanner Multimedia) + +if(OPENVR) + # include some extra files + qt5_add_resources(RESOURCES vr/qml.qrc) + file(GLOB SOURCE_FILES_QML + "vr/*.h" + "vr/*.cpp" + "vr/utils/*.h" + "vr/utils/*.cpp" + ) + list(APPEND SOURCE_FILES ${SOURCE_FILES_QML}) +endif() + +if(ANDROID OR ANDROID_DEBUG) + qt5_add_resources(RESOURCES mobile/qml.qrc) + file(GLOB SOURCE_FILES_QML + "mobile/*.h" + "mobile/*.cpp" + ) + list(APPEND SOURCE_FILES ${SOURCE_FILES_QML}) +endif() + +set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wno-deprecated-declarations") # @TODO: removeme + +add_subdirectory(libwalletqt) +add_subdirectory(model) +add_subdirectory(utils) + +if(WITH_SCANNER) + add_subdirectory(QR-Code-scanner) +endif() + +qt5_add_resources(RESOURCES assets.qrc) + if(TOR_BIN) - if(APPLE) - set(ASSETS_TOR "assets_tor_macos.qrc") - else() - set(ASSETS_TOR "assets_tor.qrc") - endif() + set(ASSETS_TOR "assets_tor.qrc") endif() set(EXECUTABLE_FLAG) @@ -58,7 +81,8 @@ if(MINGW) set(ICON_RC ${CMAKE_CURRENT_BINARY_DIR}/icon.rc) set(ICON_RES ${CMAKE_CURRENT_BINARY_DIR}/icon.o) file(WRITE ${ICON_RC} "IDI_ICON1 ICON DISCARDABLE \"${ICON}\"") - add_custom_command(OUTPUT ${ICON_RES} COMMAND windres ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC}) + find_program(Qt5_WINDRES_EXECUTABLE NAMES windres x86_64-w64-mingw32-windres REQUIRED CMAKE_FIND_ROOT_PATH_BOTH) + add_custom_command(OUTPUT ${ICON_RES} COMMAND ${Qt5_WINDRES_EXECUTABLE} ${ICON_RC} ${ICON_RES} MAIN_DEPENDENCY ${ICON_RC}) list(APPEND RESOURCES ${ICON_RES}) endif() @@ -69,33 +93,39 @@ if(APPLE) list(APPEND RESOURCES ${ICON}) endif() -add_executable(feather ${EXECUTABLE_FLAG} main.cpp - ${SOURCE_FILES} - ${RESOURCES} - ${ASSETS_TOR} -) +if(NOT ANDROID) + add_executable(wowlet ${EXECUTABLE_FLAG} main.cpp + ${SOURCE_FILES} + ${RESOURCES} + ${ASSETS_TOR} + ) +else() + add_library(wowlet SHARED ${SOURCE_FILES} ${RESOURCES}) + set_target_properties(wowlet PROPERTIES COMPILE_DEFINITIONS "ANDROID") +endif() # mac os bundle -set_target_properties(feather PROPERTIES +set_target_properties(wowlet PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" MACOSX_BUNDLE TRUE MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/utils/Info.plist" + LINK_FLAGS_RELEASE -s ) -set_property(TARGET feather PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") +set_property(TARGET wowlet PROPERTY RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -target_include_directories(feather PUBLIC ${OPENGL_INCLUDE_DIR}) -target_include_directories(feather PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) +target_include_directories(wowlet PUBLIC ${OPENGL_INCLUDE_DIR}) +target_include_directories(wowlet PUBLIC ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) file(GLOB_RECURSE SRC_SOURCES *.cpp) file(GLOB_RECURSE SRC_HEADERS *.h) -target_include_directories(feather PUBLIC - ${CMAKE_BINARY_DIR}/src/feather_autogen/include - ${CMAKE_SOURCE_DIR}/monero/include - ${CMAKE_SOURCE_DIR}/monero/src - ${CMAKE_SOURCE_DIR}/monero/external/easylogging++ - ${CMAKE_SOURCE_DIR}/monero/contrib/epee/include +target_include_directories(wowlet PUBLIC + ${CMAKE_BINARY_DIR}/src/wowlet_autogen/include + ${CMAKE_SOURCE_DIR}/wownero/include + ${CMAKE_SOURCE_DIR}/wownero/src + ${CMAKE_SOURCE_DIR}/wownero/external/easylogging++ + ${CMAKE_SOURCE_DIR}/wownero/contrib/epee/include ${CMAKE_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/daemon @@ -105,7 +135,9 @@ target_include_directories(feather PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/tor ${CMAKE_CURRENT_SOURCE_DIR}/qrcode ${X11_INCLUDE_DIR} + ${QRENCODE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} + ${Iconv_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${Qt5Core_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} @@ -116,39 +148,64 @@ target_include_directories(feather PUBLIC ${Qt5WebSockets_INCLUDE_DIRS} ) -if(DONATE_BEG) - target_compile_definitions(feather PRIVATE DONATE_BEG=1) +if(LINUX_ACTIVATION) + target_include_directories(wowlet PUBLIC + ${CAIRO_INCLUDE_DIRS} + ${XFIXES_INCLUDE_DIR} + ) endif() -if(XMRTO) - target_compile_definitions(feather PRIVATE HAS_XMRTO=1) +if(OPENVR) + target_include_directories(wowlet PUBLIC ${CMAKE_SOURCE_DIR}/contrib/) endif() if(TOR_BIN) - target_compile_definitions(feather PRIVATE HAS_TOR_BIN=1) + target_compile_definitions(wowlet PRIVATE HAS_TOR_BIN=1) endif() -if(XMRIG) - target_compile_definitions(feather PRIVATE HAS_XMRIG=1) +if(ANDROID) + target_compile_definitions(wowlet PRIVATE HAS_ANDROID=1) +endif() + +if(ANDROID_DEBUG) + target_compile_definitions(wowlet PRIVATE HAS_ANDROID_DEBUG=1) +endif() + +if(OPENVR) + target_compile_definitions(wowlet PRIVATE HAS_OPENVR=1) + target_compile_definitions(wowlet PUBLIC VR_API_PUBLIC) endif() if(HAVE_SYS_PRCTL_H) - target_compile_definitions(feather PRIVATE HAVE_SYS_PRCTL_H=1) + target_compile_definitions(wowlet PRIVATE HAVE_SYS_PRCTL_H=1) endif() if(STATIC) - target_compile_definitions(feather PRIVATE STATIC=1) + target_compile_definitions(wowlet PRIVATE STATIC=1) +endif() + +if(LINUX_ACTIVATION) + target_compile_definitions(wowlet PRIVATE LINUX_ACTIVATION=1) endif() if("$ENV{DRONE}" STREQUAL "true") - target_compile_definitions(feather PRIVATE DRONE=1) + target_compile_definitions(wowlet PRIVATE DRONE=1) endif() if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - target_compile_definitions(feather PRIVATE QT_NO_DEBUG=1) + target_compile_definitions(wowlet PRIVATE QT_NO_DEBUG=1) endif() -target_compile_definitions(feather +add_definitions(${QT_DEFINITIONS}) +if(NOT "${CMAKE_BUILD_TYPE}" EQUAL "Debug") + add_definitions(-DQT_NO_DEBUG) +endif() + +target_compile_definitions(wowlet PUBLIC VR_API_PUBLIC) + +qt5_import_qml_plugins(${PROJECT_NAME}) + +target_compile_definitions(wowlet PUBLIC ${Qt5Core_DEFINITIONS} ${Qt5Widgets_DEFINITIONS} @@ -161,74 +218,181 @@ target_compile_definitions(feather set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") -if(UNIX AND NOT APPLE) +if(UNIX) # https://stackoverflow.com/questions/57766620/cmake-add-library-doesnt-initialize-static-global-variable # so that contrib/monero-seed/src/gf_elem.cpp properly initializes. A better solution is welcome. - target_link_libraries(feather -Wl,--whole-archive monero-seed::monero-seed -Wl,--no-whole-archive) -else() - target_link_libraries(feather monero-seed::monero-seed) + target_link_libraries(wowlet PUBLIC -Wl,--whole-archive wownero-seed::wownero-seed -Wl,--no-whole-archive) endif() -target_link_libraries(feather - wallet_merged - ${LMDB_LIBRARY} +if(ANDROID) + # yolo some hardcoded paths + target_include_directories(wowlet PUBLIC + /opt/android/prefix/include/QtAndroidExtras/ + ) +endif() + +# Link Wownero core libraries +target_link_libraries(wowlet PUBLIC epee - ${UNBOUND_LIBRARY} - ${SODIUM_LIBRARY} + wallet_api easylogging - blockchain_db - randomx - hardforks ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} - ${EXTRA_LIBRARIES} + ${Iconv_LIBRARIES} + ${UNBOUND_LIBRARIES} +# /usr/local/lib/libunbound.a + ${EXTRA_LIBRARIES}) + +# Link Qt libraries +target_link_libraries(wowlet PUBLIC Qt5::Core Qt5::Widgets Qt5::Gui Qt5::Network Qt5::Svg + Qt5::QSvgPlugin + Qt5::QSvgIconPlugin Qt5::Xml Qt5::WebSockets - ${ICU_LIBRARIES} - openpgp + Qt5::Quick + Qt5::Qml + Qt5::QuickControls2 + Qt5::QuickWidgets) + +if(ANDROID) + # yolo some hardcoded paths + target_link_libraries(wowlet PUBLIC + /opt/android/prefix/lib/libQt5QuickTemplates2_arm64-v8a.so + /opt/android/prefix/lib/libQt5Quick_arm64-v8a.so + /opt/android/prefix/lib/libQt5QmlModels_arm64-v8a.so + /opt/android/prefix/lib/libQt5Qml_arm64-v8a.so + /opt/android/prefix/lib/libQt5Svg_arm64-v8a.so + /opt/android/prefix/lib/libQt5Widgets_arm64-v8a.so + /opt/android/prefix/lib/libQt5Gui_arm64-v8a.so + /opt/android/prefix/lib/libQt5Xml_arm64-v8a.so + /opt/android/prefix/lib/libQt5XmlPatterns_arm64-v8a.so + /opt/android/prefix/lib/libQt5Network_arm64-v8a.so + /opt/android/prefix/lib/libQt5Core_arm64-v8a.so + /opt/android/prefix/lib/libQt5VirtualKeyboard_arm64-v8a.so + /opt/android/prefix/lib/libQt5AndroidExtras_arm64-v8a.so + /opt/android/prefix/plugins/bearer/libplugins_bearer_qandroidbearer_arm64-v8a.so + GLESv2 + log + z + jnigraphics + android + EGL + c++_shared + ) +endif() + +# Link random other stuff +target_link_libraries(wowlet PUBLIC Threads::Threads ${QRENCODE_LIBRARY} ) -if(APPLE) - target_link_libraries(feather - KDMacTouchBar +# Link Cairo and Xfixes +if(LINUX_ACTIVATION) + target_link_libraries(wowlet PUBLIC + ${CAIRO_LIBRARIES} + ${XFIXES_LIBRARY} + ${X11_Xinerama_LIB} ) - target_include_directories(feather - PUBLIC ../contrib/KDMacTouchBar) endif() -if(NOT APPLE) - target_link_libraries(feather - Qt5::QSvgIconPlugin - Qt5::QSvgPlugin - ) +# Link scanner +if(WITH_SCANNER) + target_link_libraries(wowlet PUBLIC qrdecoder qrscanner) + if(LINUX AND NOT ANDROID) + target_link_libraries(wowlet PUBLIC + jpeg + v4l2 + v4lconvert + rt + ) + endif() endif() +# Link OpenVR +if(OPENVR) + if(MINGW) + target_link_libraries(wowlet PUBLIC + openvr_api64 + gcc stdc++ winpthread ssp glu32 opengl32 glmf32 -dynamic) + else() + target_link_libraries(wowlet PUBLIC openvr_api) + endif() +endif() + +target_link_libraries(wowlet PUBLIC + Qt5::QSvgIconPlugin + Qt5::QSvgPlugin +) + if(STATIC) - target_link_libraries(feather + target_link_libraries(wowlet PUBLIC Qt5::QSvgIconPlugin Qt5::QSvgPlugin) - if(UNIX AND NOT APPLE) - target_link_libraries(feather - Qt5::QXcbIntegrationPlugin) + if(UNIX) + target_link_libraries(wowlet PUBLIC + Qt5::QXcbIntegrationPlugin) endif() endif() if(X11_FOUND) - target_link_libraries(feather ${X11_LIBRARIES}) + target_link_libraries(wowlet PUBLIC ${X11_LIBRARIES}) endif() -if(APPLE) - include(Deploy) -endif() - -install(TARGETS feather +install(TARGETS wowlet DESTINATION ${CMAKE_INSTALL_PREFIX} ) + + +message(STATUS "\n====================================== SUMMARY") +if(GIT_FOUND) + execute_process(COMMAND git rev-parse "HEAD" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wownero OUTPUT_VARIABLE _WOWNERO_HEAD OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT _WOWNERO_HEAD STREQUAL WOWNERO_HEAD) + message(STATUS "[+] WOWNERO HEAD: ${_WOWNERO_HEAD} ... while CMake requested ${WOWNERO_HEAD}") + else() + message(STATUS "[+] WOWNERO HEAD: ${WOWNERO_HEAD}") + endif() +endif() +message(STATUS "[+] VERSION: ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_REVISION}-${VERSION}") +message(STATUS "[+] STATIC: ${STATIC}") +message(STATUS "[+] Include Valve's OpenVR library: ${OPENVR}") +message(STATUS "[+] This build is for Android: ${ANDROID}") +message(STATUS "[+] This build is for testing the Android app on desktop: ${ANDROID_DEBUG}") +message(STATUS "[+] TOR_BIN: ${TOR_BIN}") +message(STATUS "[+] LINUX_ACTIVATION: ${LINUX_ACTIVATION}") + +message(STATUS "[+] OpenSSL") +message(STATUS " - version: ${OPENSSL_VERSION}") +message(STATUS " - dirs: ${OPENSSL_INCLUDE_DIR}") +message(STATUS " - libs: ${OPENSSL_LIBRARIES} ${OPENSSL_SSL_LIBRARIES}") + +if(CAIRO_FOUND) + message(STATUS "[+] Cairo") + message(STATUS " - version: ${CAIRO_VERSION}") + message(STATUS " - dirs: ${CAIRO_INCLUDE_DIRS}") + message(STATUS " - libs: ${CAIRO_LIBRARIES}") +endif() + +if(XFIXES_FOUND) + message(STATUS "[+] Xfixes") + message(STATUS " - dirs: ${XFIXES_INCLUDE_DIR}") + message(STATUS " - libs: ${XFIXES_LIBRARY}") +endif() + +message(STATUS "[+] Boost") +message(STATUS " - version: ${Boost_VERSION}") +message(STATUS " - dirs: ${Boost_INCLUDE_DIRS}") +message(STATUS " - libs: ${Boost_LIBRARIES}") + +if(Iconv_FOUND) + message(STATUS "[+] Iconv") + message(STATUS " - version: ${Iconv_VERSION}") + message(STATUS " - libs: ${Iconv_LIBRARIES}") + message(STATUS " - dirs: ${Iconv_INCLUDE_DIRS}") +endif() diff --git a/src/QR-Code-scanner/CMakeLists.txt b/src/QR-Code-scanner/CMakeLists.txt new file mode 100644 index 0000000..110e543 --- /dev/null +++ b/src/QR-Code-scanner/CMakeLists.txt @@ -0,0 +1,22 @@ +add_library(qrdecoder STATIC + Decoder.cpp +) +target_link_libraries(qrdecoder + PUBLIC + Qt5::Gui + PNG::PNG + PRIVATE + quirc +) + +if(WITH_SCANNER) + add_library(qrscanner + QrCodeScanner.cpp + QrScanThread.cpp + ) + target_link_libraries(qrscanner + PUBLIC + Qt5::Multimedia + qrdecoder + ) +endif() diff --git a/src/QR-Code-scanner/Decoder.cpp b/src/QR-Code-scanner/Decoder.cpp new file mode 100644 index 0000000..44f6d9a --- /dev/null +++ b/src/QR-Code-scanner/Decoder.cpp @@ -0,0 +1,359 @@ +// Copyright (c) 2020, The Monero Project +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are +// permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list +// of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#include +#include +#include +#include +#include +#include "Decoder.h" +#include "quirc.h" + + +QrDecoder::QrDecoder() + : m_qr(quirc_new()) +{ + if (m_qr == nullptr) + { + throw std::runtime_error("QUIRC: failed to allocate memory"); + } +} + +QrDecoder::~QrDecoder() +{ + quirc_destroy(m_qr); +} + +std::vector QrDecoder::decode(const QImage &image) +{ + if (image.format() == QImage::Format_Grayscale8) + { + return decodeGrayscale8(image); + } + return decodeGrayscale8(image.convertToFormat(QImage::Format_Grayscale8)); +} + +std::vector QrDecoder::decodePNG(QString pngPath) { + struct quirc *q; + std::vector result; + auto pngPathStd = pngPath.toStdString(); + auto pngPathCstr = pngPathStd.c_str(); + + q = quirc_new(); + if (!q) { + qWarning() << "can't create quirc object"; + return result; + } + + int status = -1; + if (check_if_png(pngPathCstr)) { + status = load_png(q, pngPathCstr); + } else { + qWarning() << QString("Image is not a PNG: %1").arg(pngPath); + return result; + } + if (status < 0) { + quirc_destroy(q); + return result; + } + + quirc_end(q); + auto count = quirc_count(q); + result.reserve(static_cast(count)); + + for (int index = 0; index < count; ++index) + { + quirc_code code; + quirc_extract(q, index, &code); + + quirc_data data; + const quirc_decode_error_t err = quirc_decode(&code, &data); + if (err == QUIRC_SUCCESS) + { + result.emplace_back(&data.payload[0], &data.payload[data.payload_len]); + } + } + + quirc_destroy(q); + return result; +} + +// I can't seem to get this function to work, we'll use dgbutil.h instead +std::vector QrDecoder::decodeGrayscale8(const QImage &image) +{ + if (quirc_resize(m_qr, image.width(), image.height()) < 0) + { + throw std::runtime_error("QUIRC: failed to allocate video memory"); + } + + uint8_t *rawImage = quirc_begin(m_qr, nullptr, nullptr); + if (rawImage == nullptr) + { + throw std::runtime_error("QUIRC: failed to get image buffer"); + } +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) + std::copy(image.constBits(), image.constBits() + image.sizeInBytes(), rawImage); +#else + std::copy(image.constBits(), image.constBits() + image.byteCount(), rawImage); +#endif + quirc_end(m_qr); + + const int count = quirc_count(m_qr); + if (count < 0) + { + throw std::runtime_error("QUIRC: failed to get the number of recognized QR-codes"); + } + + std::vector result; + result.reserve(static_cast(count)); + for (int index = 0; index < count; ++index) + { + quirc_code code; + quirc_extract(m_qr, index, &code); + + quirc_data data; + const quirc_decode_error_t err = quirc_decode(&code, &data); + if (err == QUIRC_SUCCESS) + { + result.emplace_back(&data.payload[0], &data.payload[data.payload_len]); + } + } + + return result; +} + +/* quirc -- QR-code recognition library + * Copyright (C) 2010-2012 Daniel Beer + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +static const char *data_type_str(int dt) +{ + switch (dt) { + case QUIRC_DATA_TYPE_NUMERIC: return "NUMERIC"; + case QUIRC_DATA_TYPE_ALPHA: return "ALPHA"; + case QUIRC_DATA_TYPE_BYTE: return "BYTE"; + case QUIRC_DATA_TYPE_KANJI: return "KANJI"; + } + + return "unknown"; +} + +void QrDecoder::dump_data(const struct quirc_data *data) +{ + printf(" Version: %d\n", data->version); + printf(" ECC level: %c\n", "MLHQ"[data->ecc_level]); + printf(" Mask: %d\n", data->mask); + printf(" Data type: %d (%s)\n", + data->data_type, data_type_str(data->data_type)); + printf(" Length: %d\n", data->payload_len); + printf(" Payload: %s\n", data->payload); + + if (data->eci) + printf(" ECI: %d\n", data->eci); +} + +void QrDecoder::dump_cells(const struct quirc_code *code) +{ + int u, v; + + printf(" %d cells, corners:", code->size); + for (u = 0; u < 4; u++) + printf(" (%d,%d)", code->corners[u].x, + code->corners[u].y); + printf("\n"); + + for (v = 0; v < code->size; v++) { + printf(" "); + for (u = 0; u < code->size; u++) { + int p = v * code->size + u; + + if (code->cell_bitmap[p >> 3] & (1 << (p & 7))) + printf("[]"); + else + printf(" "); + } + printf("\n"); + } +} + +/* hacked from https://dev.w3.org/Amaya/libpng/example.c + * + * Check if a file is a PNG image using png_sig_cmp(). Returns 1 if the given + * file is a PNG and 0 otherwise. + */ +#define PNG_BYTES_TO_CHECK 4 +int QrDecoder::check_if_png(const char *filename) +{ + int ret = 0; + FILE *infile = NULL; + unsigned char buf[PNG_BYTES_TO_CHECK]; + + /* Open the prospective PNG file. */ + if ((infile = fopen(filename, "rb")) == NULL) + goto out; + + /* Read in some of the signature bytes */ + if (fread(buf, 1, PNG_BYTES_TO_CHECK, infile) != PNG_BYTES_TO_CHECK) + goto out; + + /* + * Compare the first PNG_BYTES_TO_CHECK bytes of the signature. + * png_sig_cmp() returns zero if the image is a PNG and nonzero if it + * isn't a PNG. + */ + if (png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK) == 0) + ret = 1; + + /* FALLTHROUGH */ + out: + if (infile) + fclose(infile); + return (ret); +} + +int QrDecoder::load_png(struct quirc *q, const char *filename) +{ + int width, height, rowbytes, interlace_type, number_passes = 1; + png_uint_32 trns; + png_byte color_type, bit_depth; + png_structp png_ptr = NULL; + png_infop info_ptr = NULL; + FILE *infile = NULL; + uint8_t *image; + int ret = -1; + int pass; + + if ((infile = fopen(filename, "rb")) == NULL) + goto out; + + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + if (!png_ptr) + goto out; + + info_ptr = png_create_info_struct(png_ptr); + if (!info_ptr) + goto out; + + if (setjmp(png_jmpbuf(png_ptr))) + goto out; + + png_init_io(png_ptr, infile); + + png_read_info(png_ptr, info_ptr); + + color_type = png_get_color_type(png_ptr, info_ptr); + bit_depth = png_get_bit_depth(png_ptr, info_ptr); + interlace_type = png_get_interlace_type(png_ptr, info_ptr); + + // Read any color_type into 8bit depth, Grayscale format. + // See http://www.libpng.org/pub/png/libpng-manual.txt + + // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth. + if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + png_set_expand_gray_1_2_4_to_8(png_ptr); + + if ((trns = png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) + png_set_tRNS_to_alpha(png_ptr); + + if (bit_depth == 16) +#if PNG_LIBPNG_VER >= 10504 + png_set_scale_16(png_ptr); +#else + png_set_strip_16(png_ptr); +#endif + + if ((trns) || color_type & PNG_COLOR_MASK_ALPHA) + png_set_strip_alpha(png_ptr); + + if (color_type == PNG_COLOR_TYPE_PALETTE) + png_set_palette_to_rgb(png_ptr); + + if (color_type == PNG_COLOR_TYPE_PALETTE || + color_type == PNG_COLOR_TYPE_RGB || + color_type == PNG_COLOR_TYPE_RGB_ALPHA) { + png_set_rgb_to_gray_fixed(png_ptr, 1, -1, -1); + } + + if (interlace_type != PNG_INTERLACE_NONE) + number_passes = png_set_interlace_handling(png_ptr); + + png_read_update_info(png_ptr, info_ptr); + + width = png_get_image_width(png_ptr, info_ptr); + height = png_get_image_height(png_ptr, info_ptr); + rowbytes = png_get_rowbytes(png_ptr, info_ptr); + if (rowbytes != width) { + fprintf(stderr, + "load_png: expected rowbytes to be %u but got %u\n", + width, rowbytes); + goto out; + } + + if (quirc_resize(q, width, height) < 0) + goto out; + + image = quirc_begin(q, NULL, NULL); + + for (pass = 0; pass < number_passes; pass++) { + int y; + + for (y = 0; y < height; y++) { + png_bytep row_pointer = image + y * width; + png_read_rows(png_ptr, &row_pointer, NULL, 1); + } + } + + png_read_end(png_ptr, info_ptr); + + ret = 0; + /* FALLTHROUGH */ + out: + /* cleanup */ + if (png_ptr) { + if (info_ptr) + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL); + else + png_destroy_read_struct(&png_ptr, (png_infopp)NULL, (png_infopp)NULL); + } + if (infile) + fclose(infile); + return (ret); +} diff --git a/src/openpgp/packet_stream.h b/src/QR-Code-scanner/Decoder.h similarity index 57% rename from src/openpgp/packet_stream.h rename to src/QR-Code-scanner/Decoder.h index 6a993e9..665fdfd 100644 --- a/src/openpgp/packet_stream.h +++ b/src/QR-Code-scanner/Decoder.h @@ -26,63 +26,47 @@ // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#pragma once +#include -#include +#include -#include +struct quirc; -#include "serialization.h" - -namespace openpgp -{ - -class packet_stream +class QrDecoder { public: - packet_stream(const epee::span buffer) - : packet_stream(deserializer>(buffer)) - { - } + QrDecoder(const QrDecoder &) = delete; + QrDecoder &operator=(const QrDecoder &) = delete; - template < - typename byte_container, - typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type> - packet_stream(deserializer buffer) - { - while (!buffer.empty()) - { - packet_tag tag = buffer.read_packet_tag(); - packets.push_back({std::move(tag), buffer.read(tag.length)}); - } - } + QrDecoder(); + ~QrDecoder(); - const std::vector *find_first(packet_tag::type type) const - { - for (const auto &packet : packets) - { - if (packet.first.packet_type == type) - { - return &packet.second; - } - } - return nullptr; - } - - template - void for_each(packet_tag::type type, Callback &callback) const - { - for (const auto &packet : packets) - { - if (packet.first.packet_type == type) - { - callback(packet.second); - } - } - } + std::vector decode(const QImage &image); + std::vector decodePNG(QString pngPath); private: - std::vector>> packets; -}; + /* Dump decoded information on stdout. */ + void dump_data(const struct quirc_data *data); -} // namespace openpgp + /* Dump a grid cell map on stdout. */ + void dump_cells(const struct quirc_code *code); + + /* Check if a file is a PNG image. + * + * returns 1 if the given file is a PNG and 0 otherwise. + */ + int check_if_png(const char *filename); + + /* Read a PNG image into the decoder. + * + * Note that you must call quirc_end() if the function returns + * successfully (0). + */ + int load_png(struct quirc *q, const char *filename); + +private: + std::vector decodeGrayscale8(const QImage &image); + +private: + quirc *m_qr; +}; diff --git a/src/QR-Code-scanner/QrCodeScanner.cpp b/src/QR-Code-scanner/QrCodeScanner.cpp new file mode 100644 index 0000000..2e8bde9 --- /dev/null +++ b/src/QR-Code-scanner/QrCodeScanner.cpp @@ -0,0 +1,92 @@ +// Copyright (c) 2014-2019, The Monero Project +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are +// permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list +// of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include "QrCodeScanner.h" +#include +#include + +QrCodeScanner::QrCodeScanner(QObject *parent) + : QObject(parent) + , m_processTimerId(-1) + , m_processInterval(750) + , m_enabled(true) +{ + m_probe = new QVideoProbe(this); + m_thread = new QrScanThread(this); + m_thread->start(); + QObject::connect(m_thread, SIGNAL(decoded(QString)), this, SIGNAL(decoded(QString))); + QObject::connect(m_thread, SIGNAL(notifyError(const QString &, bool)), this, SIGNAL(notifyError(const QString &, bool))); + connect(m_probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame))); +} +void QrCodeScanner::setSource(QCamera *camera) +{ + m_probe->setSource(camera); +} +void QrCodeScanner::processFrame(QVideoFrame frame) +{ + if(frame.isValid()){ + m_curFrame = frame; + } +} +bool QrCodeScanner::enabled() const +{ + return m_enabled; +} +void QrCodeScanner::setEnabled(bool enabled) +{ + m_enabled = enabled; + if(!enabled && (m_processTimerId != -1) ) + { + this->killTimer(m_processTimerId); + m_processTimerId = -1; + } + else if (enabled && (m_processTimerId == -1) ) + { + m_processTimerId = this->startTimer(m_processInterval); + } + emit enabledChanged(); +} +void QrCodeScanner::timerEvent(QTimerEvent *event) +{ + if( (event->timerId() == m_processTimerId) ){ + m_thread->addFrame(m_curFrame); + } +} + +QrCodeScanner::~QrCodeScanner() +{ + m_thread->stop(); + m_thread->quit(); + if(!m_thread->wait(5000)) + { + m_thread->terminate(); + m_thread->wait(); + } + +} + diff --git a/src/openpgp/mpi.h b/src/QR-Code-scanner/QrCodeScanner.h similarity index 62% rename from src/openpgp/mpi.h rename to src/QR-Code-scanner/QrCodeScanner.h index 800bcac..10cf776 100644 --- a/src/openpgp/mpi.h +++ b/src/QR-Code-scanner/QrCodeScanner.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020, The Monero Project +// Copyright (c) 2014-2019, The Monero Project // // All rights reserved. // @@ -26,53 +26,48 @@ // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#pragma once +#ifndef QRCODESCANNER_H_ +#define QRCODESCANNER_H_ -#include +#include +#include +#include "QrScanThread.h" -namespace openpgp +class QVideoProbe; +class QCamera; + +class QrCodeScanner : public QObject { + Q_OBJECT + + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) -class mpi -{ public: - mpi(const mpi &) = delete; - mpi &operator=(const mpi &) = delete; + QrCodeScanner(QObject *parent = Q_NULLPTR); + ~QrCodeScanner(); + void setSource(QCamera*); - mpi(mpi &&other) - : data(other.data) - { - other.data = nullptr; - } + bool enabled() const; + void setEnabled(bool enabled); - template < - typename byte_container, - typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type> - mpi(const byte_container &buffer, gcry_mpi_format format = GCRYMPI_FMT_USG) - : mpi(&buffer[0], buffer.size(), format) - { - } +public Q_SLOTS: + void processFrame(QVideoFrame); - mpi(const void *buffer, size_t size, gcry_mpi_format format = GCRYMPI_FMT_USG) - { - if (gcry_mpi_scan(&data, format, buffer, size, nullptr) != GPG_ERR_NO_ERROR) - { - throw std::runtime_error("failed to read mpi from buffer"); - } - } +Q_SIGNALS: + void enabledChanged(); - ~mpi() - { - gcry_mpi_release(data); - } + void decoded(const QString &data); + void notifyError(const QString &error, bool warning = false); - const gcry_mpi_t &get() const - { - return data; - } - -private: - gcry_mpi_t data; +protected: + void timerEvent(QTimerEvent *); + QrScanThread *m_thread; + int m_processTimerId; + int m_processInterval; + int m_enabled; + QVideoFrame m_curFrame; + QVideoProbe *m_probe; }; -} // namespace openpgp +#endif + diff --git a/src/openpgp/hash.h b/src/QR-Code-scanner/QrScanThread.cpp similarity index 53% rename from src/openpgp/hash.h rename to src/QR-Code-scanner/QrScanThread.cpp index 4f69851..6421321 100644 --- a/src/openpgp/hash.h +++ b/src/QR-Code-scanner/QrScanThread.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2020, The Monero Project +// Copyright (c) 2014-2019, The Monero Project // // All rights reserved. // @@ -26,82 +26,65 @@ // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#pragma once +#include "QrScanThread.h" +#include +#include -#include +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) +extern QImage qt_imageFromVideoFrame(const QVideoFrame &f); +#endif -#include -#include - -namespace openpgp +QrScanThread::QrScanThread(QObject *parent) + : QThread(parent) + ,m_running(true) { - -class hash -{ -public: - enum algorithm : uint8_t - { - sha256 = 8, - }; - - hash(const hash &) = delete; - hash &operator=(const hash &) = delete; - - hash(uint8_t algorithm) - : algo(algorithm) - , consumed(0) - { - if (gcry_md_open(&md, algo, 0) != GPG_ERR_NO_ERROR) - { - throw std::runtime_error("failed to create message digest object"); - } - } - - ~hash() - { - gcry_md_close(md); - } - - hash &operator<<(uint8_t byte) - { - gcry_md_putc(md, byte); - ++consumed; - return *this; - } - - hash &operator<<(const epee::span &bytes) - { - gcry_md_write(md, &bytes[0], bytes.size()); - consumed += bytes.size(); - return *this; - } - - hash &operator<<(const std::vector &bytes) - { - return *this << epee::to_span(bytes); - } - - std::vector finish() const - { - std::vector result(gcry_md_get_algo_dlen(algo)); - const void *digest = gcry_md_read(md, algo); - if (digest == nullptr) - { - throw std::runtime_error("failed to read the digest"); - } - memcpy(&result[0], digest, result.size()); - return result; - } - - size_t consumed_bytes() const - { - return consumed; - } - -private: - const uint8_t algo; - gcry_md_hd_t md; - size_t consumed; -}; - } + +void QrScanThread::processQImage(const QImage &qimg) +{ + try { + for (const std::string &code : m_decoder.decode(qimg)) + { + emit decoded(QString::fromStdString(code)); + } + } + catch(std::exception &e) { + qDebug() << "ERROR: " << e.what(); + emit notifyError(e.what()); + } +} + +void QrScanThread::processVideoFrame(const QVideoFrame &frame) +{ +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + processQImage( qt_imageFromVideoFrame(frame) ); +#else + processQImage(frame.image()); +#endif +} + +void QrScanThread::stop() +{ + m_running = false; + m_waitCondition.wakeOne(); +} + +void QrScanThread::addFrame(const QVideoFrame &frame) +{ + QMutexLocker locker(&m_mutex); + m_queue.append(frame); + m_waitCondition.wakeOne(); +} + +void QrScanThread::run() +{ + QVideoFrame frame; + while(m_running) { + QMutexLocker locker(&m_mutex); + while(m_queue.isEmpty() && m_running) + m_waitCondition.wait(&m_mutex); + if(!m_queue.isEmpty()) + processVideoFrame(m_queue.takeFirst()); + } +} + diff --git a/src/openpgp/s_expression.h b/src/QR-Code-scanner/QrScanThread.h similarity index 66% rename from src/openpgp/s_expression.h rename to src/QR-Code-scanner/QrScanThread.h index b46bf21..7dfffc5 100644 --- a/src/openpgp/s_expression.h +++ b/src/QR-Code-scanner/QrScanThread.h @@ -1,4 +1,4 @@ -// Copyright (c) 2020, The Monero Project +// Copyright (c) 2014-2019, The Monero Project // // All rights reserved. // @@ -26,53 +26,41 @@ // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#pragma once +#ifndef _QRSCANTHREAD_H_ +#define _QRSCANTHREAD_H_ -#include -#include +#include +#include +#include +#include +#include +#include -#include +#include "Decoder.h" -namespace openpgp +class QrScanThread : public QThread { + Q_OBJECT -class s_expression -{ public: - s_expression(const s_expression &) = delete; - s_expression &operator=(const s_expression &) = delete; + QrScanThread(QObject *parent = Q_NULLPTR); + void addFrame(const QVideoFrame &frame); + virtual void stop(); - template - s_expression(Args... args) - { - if (gcry_sexp_build(&data, nullptr, args...) != GPG_ERR_NO_ERROR) - { - throw std::runtime_error("failed to build S-expression"); - } - } +Q_SIGNALS: + void decoded(const QString &data); + void notifyError(const QString &error, bool warning = false); - s_expression(s_expression &&other) - { - std::swap(data, other.data); - } - - s_expression(gcry_sexp_t data) - : data(data) - { - } - - ~s_expression() - { - gcry_sexp_release(data); - } - - const gcry_sexp_t &get() const - { - return data; - } +protected: + virtual void run(); + void processVideoFrame(const QVideoFrame &); + void processQImage(const QImage &); private: - gcry_sexp_t data = nullptr; + QrDecoder m_decoder; + bool m_running; + QMutex m_mutex; + QWaitCondition m_waitCondition; + QList m_queue; }; - -} // namespace openpgp +#endif diff --git a/src/appcontext.cpp b/src/appcontext.cpp index 2541f25..7389e83 100644 --- a/src/appcontext.cpp +++ b/src/appcontext.cpp @@ -1,35 +1,19 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include #include -#include #include -#include -#include #include "appcontext.h" #include "globals.h" -#include "utils/tails.h" -#include "utils/whonix.h" -#include "utils/utils.h" -#include "utils/prices.h" -#include "utils/networktype.h" -#include "utils/wsclient.h" -#include "utils/config.h" +#include "config-wowlet.h" // libwalletqt -#include "libwalletqt/WalletManager.h" -#include "libwalletqt/Wallet.h" #include "libwalletqt/TransactionHistory.h" -#include "libwalletqt/SubaddressAccount.h" #include "libwalletqt/Subaddress.h" #include "libwalletqt/Coins.h" #include "model/TransactionHistoryModel.h" -#include "model/SubaddressAccountModel.h" #include "model/SubaddressModel.h" -#include "utils/keysfiles.h" -#include "utils/networktype.h" Prices *AppContext::prices = nullptr; @@ -38,81 +22,77 @@ TxFiatHistory *AppContext::txFiatHistory = nullptr; double AppContext::balance = 0; QMap AppContext::txDescriptionCache; QMap AppContext::txCache; +bool AppContext::isQML = false; AppContext::AppContext(QCommandLineParser *cmdargs) { + this->m_walletKeysFilesModel = new WalletKeysFilesModel(this, this); this->network = new QNetworkAccessManager(); this->networkClearnet = new QNetworkAccessManager(); this->cmdargs = cmdargs; + AppContext::isQML = false; + // OS & env #if defined(Q_OS_MAC) + this->isMac = true; this->isTorSocks = qgetenv("DYLD_INSERT_LIBRARIES").indexOf("libtorsocks") >= 0; +#elif __ANDROID__ + this->isAndroid = true; #elif defined(Q_OS_LINUX) + this->isLinux = true; this->isTorSocks = qgetenv("LD_PRELOAD").indexOf("libtorsocks") >= 0; -#elif defined(Q_OS_WIN) - this->isTorSocks = false; -#endif - this->isTails = TailsOS::detect(); this->isWhonix = WhonixOS::detect(); +#elif defined(Q_OS_WIN) + this->isWindows = true; + this->isTorSocks = false; +#endif + this->androidDebug = cmdargs->isSet("android-debug"); - //Paths + // Paths + this->pathGenericData = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); this->configRoot = QDir::homePath(); - if (isTails) { // #if defined(PORTABLE) - QString portablePath = []{ - QString appImagePath = qgetenv("APPIMAGE"); - if (appImagePath.isEmpty()) { - qDebug() << "Not an appimage, using currentPath()"; - return QDir::currentPath() + "/.feather"; - } - - QFileInfo appImageDir(appImagePath); - return appImageDir.absoluteDir().path() + "/.feather"; - }(); - - - if (QDir().mkpath(portablePath)) { - this->configRoot = portablePath; - } else { - qCritical() << "Unable to create portable directory: " << portablePath; - } - } - this->accountName = Utils::getUnixAccountName(); this->homeDir = QDir::homePath(); + this->configDirectory = QString("%1/.config/wowlet/").arg(this->configRoot); + this->configDirectoryVR = QString("%1%2").arg(this->configDirectory, "vr"); + + if (isTails) this->setupPathsTails(); + QString walletDir = config()->get(Config::walletDirectory).toString(); - if (walletDir.isEmpty()) { -#if defined(Q_OS_LINUX) or defined(Q_OS_MAC) - this->defaultWalletDir = QString("%1/Monero/wallets").arg(this->configRoot); - this->defaultWalletDirRoot = QString("%1/Monero").arg(this->configRoot); -#elif defined(Q_OS_WIN) - this->defaultWalletDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/Monero"; - this->defaultWalletDirRoot = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); -#endif + if(walletDir.isEmpty()) { + if (isAndroid && !androidDebug) setupPathsAndroid(); + else if (isWindows) setupPathsWindows(); + else if (isLinux || isMac) setupPathsUnix(); } else { this->defaultWalletDir = walletDir; this->defaultWalletDirRoot = walletDir; } +#ifdef __ANDROID__ + // can haz disk I/O? + QVector perms = { + "android.permission.WRITE_EXTERNAL_STORAGE", + "android.permission.READ_EXTERNAL_STORAGE" + }; + Utils::androidAskPermissions(perms); +#endif + // Create wallet dirs + qDebug() << "creating " << defaultWalletDir; if (!QDir().mkpath(defaultWalletDir)) qCritical() << "Unable to create dir: " << defaultWalletDir; - this->configDirectory = QString("%1/.config/feather/").arg(this->configRoot); -#if defined(Q_OS_UNIX) - if(!this->configDirectory.endsWith('/')) - this->configDirectory = QString("%1/").arg(this->configDirectory); -#endif - - // Config + // Create some directories createConfigDirectory(this->configDirectory); + this->networkType = NetworkType::MAINNET; - if(this->cmdargs->isSet("stagenet")) - this->networkType = NetworkType::STAGENET; - else if(this->cmdargs->isSet("testnet")) - this->networkType = NetworkType::TESTNET; - else - this->networkType = NetworkType::MAINNET; + qDebug() << "configRoot: " << this->configRoot; + qDebug() << "homeDir: " << this->homeDir; + qDebug() << "customWalletDir: " << walletDir; + qDebug() << "defaultWalletDir: " << this->defaultWalletDir; + qDebug() << "defaultWalletDirRoot: " << this->defaultWalletDirRoot; + qDebug() << "configDirectory: " << this->configDirectory; // auto nodeSourceUInt = config()->get(Config::nodeSource).toUInt(); // AppContext::nodeSource = static_cast(nodeSourceUInt); @@ -120,17 +100,47 @@ AppContext::AppContext(QCommandLineParser *cmdargs) { connect(this, &AppContext::nodeSourceChanged, this->nodes, &Nodes::onNodeSourceChanged); connect(this, &AppContext::setCustomNodes, this->nodes, &Nodes::setCustomNodes); - // Tor & socks proxy - this->ws = new WSClient(this, m_wsUrl); - connect(this->ws, &WSClient::WSMessage, this, &AppContext::onWSMessage); + // init backend URLs + if(cmdargs->isSet("backend-host")) + this->backendHost = cmdargs->value("backend-host"); + if(cmdargs->isSet("backend-host")) + this->backendPort = cmdargs->value("backend-port").toUInt(); + if(cmdargs->isSet("backend-tls")) + this->backendTLS = true; - // timers - m_storeTimer->setSingleShot(true); - connect(this->m_storeTimer, &QTimer::timeout, [this](){ - if (!this->currentWallet) - return; - qDebug() << "Storing wallet"; - this->currentWallet->store(); + backendWSUrl = this->backendTLS ? "wss://" : "ws://"; + backendWSUrl += QString("%1:%2").arg(this->backendHost).arg(this->backendPort); + backendHTTPUrl = this->backendTLS ? "https://" : "http://"; + backendHTTPUrl += QString("%1:%2").arg(this->backendHost).arg(this->backendPort); + + // init websocket client + this->ws = new WSClient(this); + connect(this->ws, &WSClient::WSMessage, this, &AppContext::onWSMessage); + connect(this->ws, &WSClient::connectionEstablished, this, &AppContext::wsConnected); + connect(this->ws, &WSClient::closed, this, &AppContext::wsDisconnected); + + // Store the wallet every 2 minutes + m_storeTimer.start(2 * 60 * 1000); + connect(&m_storeTimer, &QTimer::timeout, [this](){ + this->storeWallet(); + }); + + // If system clock skewed for >= 300 seconds, assume a wake-up from hibernate and reload the websocket connection + if(!this->isAndroid) + m_hibernateTimer.start(3 * 1000); + + m_hibernatePreviousTime = std::chrono::steady_clock::now(); + connect(&m_hibernateTimer, &QTimer::timeout, [this]() { + const auto now = std::chrono::steady_clock::now(); + const auto elapsed = now - m_hibernatePreviousTime; + + if(elapsed >= m_hibernateDetectInterval) { + qCritical() << "Clock skew detected, resetting websocket connection"; + this->ws->webSocket.abort(); + this->ws->start(); + } + + m_hibernatePreviousTime = now; }); // restore height lookup @@ -152,21 +162,14 @@ AppContext::AppContext(QCommandLineParser *cmdargs) { // fiat/crypto lookup AppContext::prices = new Prices(); - // xmr.to -#ifdef HAS_XMRTO - this->XMRTo = new XmrTo(this); -#endif - // XMRig -#ifdef HAS_XMRIG this->XMRig = new XmRig(this->configDirectory, this); this->XMRig->prepare(); -#endif this->walletManager = WalletManager::instance(); QString logPath = QString("%1/daemon.log").arg(configDirectory); Monero::Utils::onStartup(); - Monero::Wallet::init("", "feather", logPath.toStdString(), true); + Monero::Wallet::init("", "wowlet", logPath.toStdString(), true); bool logLevelFromEnv; int logLevel = qEnvironmentVariableIntValue("MONERO_LOG_LEVEL", &logLevelFromEnv); @@ -179,26 +182,32 @@ AppContext::AppContext(QCommandLineParser *cmdargs) { // libwallet connects connect(this->walletManager, &WalletManager::walletOpened, this, &AppContext::onWalletOpened); + + // hideOnClose + auto hideOnClose = config()->get(Config::hideOnClose).toBool(); + if(hideOnClose) + QApplication::setQuitOnLastWindowClosed(false); } void AppContext::initTor() { this->tor = new Tor(this, this); this->tor->start(); - if (!(isWhonix)) { - auto networkProxy = new QNetworkProxy(QNetworkProxy::Socks5Proxy, Tor::torHost, Tor::torPort); - this->network->setProxy(*networkProxy); - if (m_wsUrl.host().endsWith(".onion")) - this->ws->webSocket.setProxy(*networkProxy); + if (!isWhonix && !backendHost.contains(".onion")) { + qDebug() << "'backend-host' did not contain '.onion' - running without Tor proxy."; + return; } + this->networkProxy = new QNetworkProxy(QNetworkProxy::Socks5Proxy, Tor::torHost, Tor::torPort); + this->network->setProxy(*networkProxy); + this->ws->webSocket.setProxy(*networkProxy); } void AppContext::initWS() { this->ws->start(); } -void AppContext::onCancelTransaction(PendingTransaction *tx, const QString &address) { +void AppContext::onCancelTransaction(PendingTransaction *tx, const QVector &address) { // tx cancelled by user double amount = tx->amount() / globals::cdiv; emit createTransactionCancelled(address, amount); @@ -219,13 +228,7 @@ void AppContext::onSweepOutput(const QString &keyImage, QString address, bool ch this->currentWallet->createTransactionSingleAsync(keyImage, address, outputs, this->tx_priority); } -void AppContext::onCreateTransaction(XmrToOrder *order) { - // tx creation via xmr.to - const QString description = QString("XmrTo order %1").arg(order->uuid); - this->onCreateTransaction(order->receiving_subaddress, order->incoming_amount_total, description, false); -} - -void AppContext::onCreateTransaction(const QString &address, const double amount, const QString &description, bool all) { +void AppContext::onCreateTransaction(QString address, quint64 amount, QString description, bool all) { // tx creation this->tmpTxDescription = description; @@ -234,13 +237,13 @@ void AppContext::onCreateTransaction(const QString &address, const double amount return; } - if (!all && amount <= 0) { + if (!all && amount == 0) { emit createTransactionError("Cannot send nothing"); return; } - auto balance = this->currentWallet->balance() / globals::cdiv; - auto unlocked_balance = this->currentWallet->unlockedBalance() / globals::cdiv; + auto balance = this->currentWallet->balance(); + auto unlocked_balance = this->currentWallet->unlockedBalance(); if(!all && amount > unlocked_balance) { emit createTransactionError("Not enough money to spend"); return; @@ -249,12 +252,35 @@ void AppContext::onCreateTransaction(const QString &address, const double amount return; } - auto amount_num = static_cast(amount * globals::cdiv); qDebug() << "creating tx"; - if(all || amount == balance) + if (all) this->currentWallet->createTransactionAllAsync(address, "", this->tx_mixin, this->tx_priority); else - this->currentWallet->createTransactionAsync(address, "", amount_num, this->tx_mixin, this->tx_priority); + this->currentWallet->createTransactionAsync(address, "", amount, this->tx_mixin, this->tx_priority); + + emit initiateTransaction(); +} + +void AppContext::onCreateTransactionMultiDest(const QVector &addresses, const QVector &amounts, const QString &description) { + this->tmpTxDescription = description; + + if (this->currentWallet == nullptr) { + emit createTransactionError("Cannot create transaction; no wallet loaded"); + return; + } + + quint64 total_amount = 0; + for (auto &amount : amounts) { + total_amount += amount; + } + + auto unlocked_balance = this->currentWallet->unlockedBalance(); + if (total_amount > unlocked_balance) { + emit createTransactionError("Not enough money to spend"); + } + + qDebug() << "Creating tx"; + this->currentWallet->createTransactionMultiDestAsync(addresses, amounts, this->tx_priority); emit initiateTransaction(); } @@ -264,15 +290,21 @@ void AppContext::onCreateTransactionError(const QString &msg) { emit endTransaction(); } -void AppContext::walletClose(bool emitClosedSignal) { - if(this->currentWallet == nullptr) return; - emit walletClosing(); - //ctx->currentWallet->store(); @TODO: uncomment to store on wallet close +void AppContext::closeWallet(bool emitClosedSignal, bool storeWallet) { + if (this->currentWallet == nullptr) + return; + + emit walletAboutToClose(); + + if (storeWallet) { + this->storeWallet(); + } + this->currentWallet->disconnect(); this->walletManager->closeWallet(); - if(this->currentWallet != nullptr) - this->currentWallet = nullptr; - if(emitClosedSignal) + this->currentWallet = nullptr; + + if (emitClosedSignal) emit walletClosed(); } @@ -301,8 +333,8 @@ void AppContext::onPreferredFiatCurrencyChanged(const QString &symbol) { if(this->currentWallet) { auto *model = this->currentWallet->transactionHistoryModel(); if(model != nullptr) { - model->preferredFiatSign = AppContext::prices->fiat[symbol]; model->preferredFiatSymbol = symbol; + this->currentWallet->transactionHistoryModel()->transactionHistory()->calcFiatInfo(); } } } @@ -314,24 +346,27 @@ void AppContext::onWalletOpened(Wallet *wallet) { if(errMsg == QString("basic_string::_M_replace_aux") || errMsg == QString("std::bad_alloc")) { qCritical() << errMsg; this->walletManager->clearWalletCache(this->walletPath); - errMsg = QString("%1\n\nAttempted to clean wallet cache. Please restart Feather.").arg(errMsg); - this->walletClose(false); + errMsg = QString("%1\n\nAttempted to clean wallet cache. Please restart WOWlet.").arg(errMsg); + this->closeWallet(false); emit walletOpenedError(errMsg); } else if(errMsg.contains("wallet cannot be opened as")) { - this->walletClose(false); + this->closeWallet(false); emit walletOpenedError(errMsg); } else if(errMsg.contains("is opened by another wallet program")) { - this->walletClose(false); + this->closeWallet(false); emit walletOpenedError(errMsg); } else { - this->walletClose(false); + this->closeWallet(false); emit walletOpenPasswordNeeded(!this->walletPassword.isEmpty(), wallet->path()); } return; } + this->refreshed = false; this->currentWallet = wallet; this->walletPath = this->currentWallet->path() + ".keys"; + QFileInfo fileInfo(this->currentWallet->path()); + this->walletName = fileInfo.fileName(); this->walletViewOnly = this->currentWallet->viewOnly(); config()->set(Config::walletPath, this->walletPath); @@ -344,9 +379,15 @@ void AppContext::onWalletOpened(Wallet *wallet) { connect(this->currentWallet, &Wallet::transactionCommitted, this, &AppContext::onTransactionCommitted); connect(this->currentWallet, &Wallet::heightRefreshed, this, &AppContext::onHeightRefreshed); connect(this->currentWallet, &Wallet::transactionCreated, this, &AppContext::onTransactionCreated); - connect(this->currentWallet, &Wallet::connectionStatusChanged, this, &AppContext::onConnectionStatusChanged); - emit walletOpened(); + this->currentWallet->historyModel(); // load historyModel + auto *txHistory = this->currentWallet->history(); + txHistory->refresh(this->currentWallet->currentSubaddressAccount()); + + connect(AppContext::prices, &Prices::fiatPricesUpdated, txHistory, &TransactionHistory::calcFiatInfo); + connect(AppContext::prices, &Prices::cryptoPricesUpdated, txHistory, &TransactionHistory::calcFiatInfo); + + emit walletOpened(wallet); connect(this->currentWallet, &Wallet::connectionStatusChanged, [this]{ this->nodes->autoConnect(); @@ -354,10 +395,6 @@ void AppContext::onWalletOpened(Wallet *wallet) { this->nodes->connectToNode(); this->updateBalance(); -#ifdef DONATE_BEG - this->donateBeg(); -#endif - // force trigger preferredFiat signal for history model this->onPreferredFiatCurrencyChanged(config()->get(Config::preferredFiatCurrency).toString()); this->setWindowTitle(); @@ -365,7 +402,7 @@ void AppContext::onWalletOpened(Wallet *wallet) { void AppContext::setWindowTitle(bool mining) { QFileInfo fileInfo(this->walletPath); - auto title = QString("Feather - [%1]").arg(fileInfo.fileName()); + auto title = QString("WOWlet - [%1]").arg(fileInfo.fileName()); if(this->walletViewOnly) title += " [view-only]"; if(mining) @@ -407,48 +444,81 @@ void AppContext::onWSMessage(const QJsonObject &msg) { if(changed) emit blockHeightWSUpdated(this->heights); } - - else if(cmd == "nodes") { + else if(cmd == "yellwow") { + this->yellowPagesData = msg.value("data").toArray(); + emit yellowUpdated(); + } + else if(cmd == "rpc_nodes") { this->onWSNodes(msg.value("data").toArray()); } -#if defined(HAS_XMRIG) else if(cmd == "xmrig") { this->XMRigDownloads(msg.value("data").toObject()); } -#endif + else if(cmd == "wownerod_releases") { + emit WownerodDownloads(msg.value("data").toObject()); + } else if(cmd == "crypto_rates") { QJsonArray crypto_rates = msg.value("data").toArray(); AppContext::prices->cryptoPricesReceived(crypto_rates); } - else if(cmd == "fiat_rates") { QJsonObject fiat_rates = msg.value("data").toObject(); AppContext::prices->fiatPricesReceived(fiat_rates); } -#if defined(HAS_XMRTO) - else if(cmd == "xmrto_rates") { - auto xmr_rates = msg.value("data").toObject(); - this->XMRTo->onRatesReceived(xmr_rates); - } -#endif else if(cmd == "reddit") { QJsonArray reddit_data = msg.value("data").toArray(); this->onWSReddit(reddit_data); } - - else if(cmd == "ccs") { + else if(cmd == "forum") { + QJsonArray forum_data = msg.value("data").toArray(); + this->onWSForum(forum_data); + } + else if(cmd == "funding_proposals") { auto ccs_data = msg.value("data").toArray(); this->onWSCCS(ccs_data); } - + else if(cmd == "suchwow") { + QJsonArray such_data = msg.value("data").toArray(); + emit suchWowUpdated(such_data); + } else if(cmd == "txFiatHistory") { auto txFiatHistory_data = msg.value("data").toObject(); AppContext::txFiatHistory->onWSData(txFiatHistory_data); } + else if(cmd == "wowlet_releases") { + versionPending = msg.value("data").toObject(); + auto version_str = versionPending.value("version").toString(); + + if(Utils::versionOutdated(WOWLET_VERSION_SEMVER, version_str)) + emit versionOutdated(version_str, versionPending); + } + else if(cmd == "kill") { + // used *only* in dire emergencies + auto killme = msg.value("data").toBool(); + if(killme) + QCoreApplication::quit(); + } +#if defined(HAS_OPENVR) + else if(cmd == "requestPIN") { + auto pin = msg.value("data").toString(); + emit pinReceived(pin); + } + + else if(cmd == "lookupPIN") { + auto lookup_data = msg.value("data").toObject(); + auto address = lookup_data.value("address").toString(); + auto pin = lookup_data.value("PIN").toString(); + + if(address.isEmpty()) + emit pinLookupErrorReceived(); + else + emit pinLookupReceived(address, pin); + } +#endif } void AppContext::onWSNodes(const QJsonArray &nodes) { - QList> l; + QList> l; for (auto &&entry: nodes) { auto obj = entry.toObject(); auto nettype = obj.value("nettype"); @@ -467,17 +537,34 @@ void AppContext::onWSNodes(const QJsonArray &nodes) { if(type == "tor" && (!(this->isTails || this->isWhonix || this->isTorSocks))) continue; - auto node = new FeatherNode( + auto node = new WowletNode( obj.value("address").toString(), obj.value("height").toInt(), obj.value("target_height").toInt(), obj.value("online").toBool()); - QSharedPointer r = QSharedPointer(node); + QSharedPointer r = QSharedPointer(node); l.append(r); } this->nodes->onWSNodesReceived(l); } +void AppContext::onWSForum(const QJsonArray& forum_data) { + QList> l; + + for (auto &&entry: forum_data) { + auto obj = entry.toObject(); + auto forumPost = new ForumPost( + obj.value("thread").toString(), + obj.value("member_name").toString(), + obj.value("permalink").toString(), + obj.value("member_name").toString()); + QSharedPointer r = QSharedPointer(forumPost); + l.append(r); + } + + emit forumUpdated(l); +} + void AppContext::onWSReddit(const QJsonArray& reddit_data) { QList> l; @@ -486,7 +573,7 @@ void AppContext::onWSReddit(const QJsonArray& reddit_data) { auto redditPost = new RedditPost( obj.value("title").toString(), obj.value("author").toString(), - obj.value("url").toString(), + obj.value("permalink").toString(), obj.value("comments").toInt()); QSharedPointer r = QSharedPointer(redditPost); l.append(r); @@ -523,15 +610,12 @@ void AppContext::onWSCCS(const QJsonArray &ccs_data) { l.append(c); } - if(l.count() == 0) - emit ccsEmpty(); - emit ccsUpdated(l); } void AppContext::createConfigDirectory(const QString &dir) { - QString config_dir_tor = QString("%1%2").arg(dir).arg("tor"); - QString config_dir_tordata = QString("%1%2").arg(dir).arg("tor/data"); + auto config_dir_tor = QString("%1%2").arg(dir).arg("tor"); + auto config_dir_tordata = QString("%1%2").arg(dir).arg("tor/data"); QStringList createDirs({dir, config_dir_tor, config_dir_tordata}); for(const auto &d: createDirs) { @@ -541,9 +625,24 @@ void AppContext::createConfigDirectory(const QString &dir) { throw std::runtime_error("Could not create directory " + d.toStdString()); } } + +#ifdef HAS_OPENVR + auto config_dir_vr = QString("%1%2").arg(dir, "vr"); + if(!Utils::dirExists(config_dir_vr)) { + qDebug() << QString("Creating directory: %1").arg(config_dir_vr); + if (!QDir().mkpath(config_dir_vr)) + throw std::runtime_error("Could not create directory " + config_dir_vr.toStdString()); + } +#endif } -void AppContext::createWallet(FeatherSeed seed, const QString &path, const QString &password) { +void AppContext::createWalletWithoutSpecifyingSeed(const QString &name, const QString &password) { + WowletSeed seed = WowletSeed(this->restoreHeights[this->networkType], this->coinName, this->seedLanguage); + auto path = QDir(this->defaultWalletDir).filePath(name); + this->createWallet(seed, path, password); +} + +void AppContext::createWallet(WowletSeed seed, const QString &path, const QString &password) { if(Utils::fileExists(path)) { auto err = QString("Failed to write wallet to path: \"%1\"; file already exists.").arg(path); qCritical() << err; @@ -551,12 +650,21 @@ void AppContext::createWallet(FeatherSeed seed, const QString &path, const QStri return; } - if(seed.mnemonicSeed.isEmpty()) { + if(seed.mnemonic.isEmpty()) { emit walletCreatedError("Mnemonic seed error. Failed to write wallet."); return; } - this->currentWallet = seed.writeWallet(this->walletManager, this->networkType, path, password, this->kdfRounds); + Wallet *wallet = nullptr; + if (seed.seedType == SeedType::TEVADOR) { + wallet = this->walletManager->createDeterministicWalletFromSpendKey(path, password, seed.language, this->networkType, seed.spendKey, seed.restoreHeight, this->kdfRounds); + wallet->setCacheAttribute("wowlet.seed", seed.mnemonic.join(" ")); + } + if (seed.seedType == SeedType::WOWNERO) { + wallet = this->walletManager->recoveryWallet(path, password, seed.mnemonic.join(" "), "", this->networkType, seed.restoreHeight, this->kdfRounds); + } + + this->currentWallet = wallet; if(this->currentWallet == nullptr) { emit walletCreatedError("Failed to write wallet"); return; @@ -603,16 +711,19 @@ void AppContext::createWalletFinish(const QString &password) { this->currentWallet->store(); this->walletPassword = password; emit walletCreated(this->currentWallet); + + // emit signal on behalf of walletManager, open wallet + this->walletManager->walletOpened(this->currentWallet); } void AppContext::initRestoreHeights() { - restoreHeights[NetworkType::TESTNET] = new RestoreHeightLookup(NetworkType::TESTNET); - restoreHeights[NetworkType::STAGENET] = RestoreHeightLookup::fromFile(":/assets/restore_heights_monero_stagenet.txt", NetworkType::STAGENET); - restoreHeights[NetworkType::MAINNET] = RestoreHeightLookup::fromFile(":/assets/restore_heights_monero_mainnet.txt", NetworkType::MAINNET); + restoreHeights[NetworkType::TESTNET] = RestoreHeightLookup::fromFile(":/assets/restore_heights_wownero_mainnet.txt", NetworkType::TESTNET); + restoreHeights[NetworkType::STAGENET] = RestoreHeightLookup::fromFile(":/assets/restore_heights_wownero_mainnet.txt", NetworkType::STAGENET); + restoreHeights[NetworkType::MAINNET] = RestoreHeightLookup::fromFile(":/assets/restore_heights_wownero_mainnet.txt", NetworkType::MAINNET); } void AppContext::onSetRestoreHeight(quint64 height){ - auto seed = this->currentWallet->getCacheAttribute("feather.seed"); + auto seed = this->currentWallet->getCacheAttribute("wowlet.seed"); if(!seed.isEmpty()) { const auto msg = "This wallet has a 14 word mnemonic seed which has the restore height embedded."; emit setRestoreHeightError(msg); @@ -671,24 +782,7 @@ void AppContext::onOpenAliasResolve(const QString &openAlias) { emit openAliasResolveError(msg); } -void AppContext::donateBeg() { - if(this->currentWallet == nullptr) return; - if(this->networkType != NetworkType::Type::MAINNET) return; - if(this->currentWallet->viewOnly()) return; - - auto donationCounter = config()->get(Config::donateBeg).toInt(); - if(donationCounter == -1) - return; // previously donated - - donationCounter += 1; - if (donationCounter % m_donationBoundary == 0) - emit donationNag(); - config()->set(Config::donateBeg, donationCounter); -} - -AppContext::~AppContext() { - this->walletClose(false); -} +AppContext::~AppContext() {} // ############################################## LIBWALLET QT ######################################################### @@ -709,7 +803,7 @@ void AppContext::onUnconfirmedMoneyReceived(const QString &txId, quint64 amount) qDebug() << Q_FUNC_INFO << txId << " " << QString::number(amount_num); if(this->currentWallet->synchronized()) { - auto notify = QString("%1 XMR (pending)").arg(amount_num); + auto notify = QString("%1 WOW (pending)").arg(amount_num); Utils::desktopNotify("Payment received", notify, 5000); } } @@ -717,16 +811,17 @@ void AppContext::onUnconfirmedMoneyReceived(const QString &txId, quint64 amount) void AppContext::onWalletUpdate() { if (this->currentWallet->synchronized()) { this->refreshModels(); + this->storeWallet(); } this->updateBalance(); - this->storeWallet(); } void AppContext::onWalletRefreshed(bool success) { if (!this->refreshed) { refreshModels(); this->refreshed = true; + emit walletRefreshed(); // store wallet immediately upon finishing synchronization this->currentWallet->store(); } @@ -760,15 +855,84 @@ void AppContext::onHeightRefreshed(quint64 walletHeight, quint64 daemonHeight, q } } -void AppContext::onTransactionCreated(PendingTransaction *tx, const QString &address, const QString &paymentId, quint32 mixin) { - if(address == this->donationAddress) - this->donationSending = true; - +void AppContext::onTransactionCreated(PendingTransaction *tx, const QVector &address) { // Let UI know that the transaction was constructed emit endTransaction(); + // Some validation + auto tx_status = tx->status(); + auto err = QString("Can't create transaction: "); + + if(tx_status != PendingTransaction::Status_Ok){ + auto tx_err = tx->errorString(); + qCritical() << tx_err; + + if (this->currentWallet->connectionStatus() == Wallet::ConnectionStatus_WrongVersion) + err = QString("%1 Wrong daemon version: %2").arg(err).arg(tx_err); + else + err = QString("%1 %2").arg(err).arg(tx_err); + + qDebug() << Q_FUNC_INFO << err; + emit createTransactionError(err); + this->currentWallet->disposeTransaction(tx); + return; + } else if (tx->txCount() == 0) { + err = QString("%1 %2").arg(err).arg("No unmixable outputs to sweep."); + qDebug() << Q_FUNC_INFO << err; + emit createTransactionError(err); + this->currentWallet->disposeTransaction(tx); + return; + } + // tx created, but not sent yet. ask user to verify first. - emit createTransactionSuccess(tx, address, mixin); + emit createTransactionSuccess(tx, address); + + if(this->autoCommitTx) { + this->currentWallet->commitTransactionAsync(tx); + } +} + +QString AppContext::getAddress(quint32 accountIndex, quint32 addressIndex) { + return this->currentWallet->address(accountIndex, addressIndex); +} + +void AppContext::onAskReceivingPIN() { + // request new receiving PIN from wowlet-backend + if(this->currentWallet == nullptr) + return; + + auto address = this->currentWallet->address(0, 1); + QString signature = this->currentWallet->signMessage(address, false, address); + + QJsonObject data; + data["signature"] = signature; + data["address"] = address; + + QJsonObject obj; + obj["cmd"] = "requestPIN"; + obj["data"] = data; + + QJsonDocument doc = QJsonDocument(obj); + this->ws->sendMsg(doc.toJson(QJsonDocument::Compact)); +} + +void AppContext::onLookupReceivingPIN(QString pin) { + // lookup PIN -> address + if(this->currentWallet == nullptr) + return; + + auto address = this->currentWallet->address(0, 1); + QString signature = this->currentWallet->signMessage(address, false, address); + + QJsonObject data; + data["PIN"] = pin; + + QJsonObject obj; + obj["cmd"] = "lookupPIN"; + obj["data"] = data; + + QJsonDocument doc = QJsonDocument(obj); + this->ws->sendMsg(doc.toJson(QJsonDocument::Compact)); } void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid){ @@ -778,24 +942,18 @@ void AppContext::onTransactionCommitted(bool status, PendingTransaction *tx, con // Store wallet immediately so we don't risk losing tx key if wallet crashes this->currentWallet->store(); + this->updateBalance(); + emit transactionCommitted(status, tx, txid); - - // this tx was a donation to Feather, stop our nagging - if(this->donationSending) { - this->donationSending = false; - config()->set(Config::donateBeg, -1); - } -} - -void AppContext::onConnectionStatusChanged(int status) { - } void AppContext::storeWallet() { - if (m_storeTimer->isActive()) + // Do not store a synchronizing wallet: store() is NOT thread safe and may crash the wallet + if (this->currentWallet == nullptr || !this->currentWallet->synchronized()) return; - m_storeTimer->start(60000); + qDebug() << "Storing wallet"; + this->currentWallet->store(); } void AppContext::updateBalance() { @@ -806,7 +964,13 @@ void AppContext::updateBalance() { AppContext::balance = balance_u / globals::cdiv; double spendable = this->currentWallet->unlockedBalance(); + // formatted + QString fmt_str = QString("Balance: %1 WOW").arg(Utils::balanceFormat(spendable)); + if (balance > spendable) + fmt_str += QString(" (+%1 WOW unconfirmed)").arg(Utils::balanceFormat(balance - spendable)); + emit balanceUpdated(balance_u, spendable); + emit balanceUpdatedFormatted(fmt_str); } void AppContext::syncStatusUpdated(quint64 height, quint64 target) { @@ -828,3 +992,38 @@ void AppContext::refreshModels() { this->currentWallet->coins()->refresh(this->currentWallet->currentSubaddressAccount()); // Todo: set timer for refreshes } + +void AppContext::setupPathsUnix() { + this->defaultWalletDir = QString("%1/Wownero/wallets").arg(this->configRoot); + this->defaultWalletDirRoot = QString("%1/Wownero").arg(this->configRoot); +} + +void AppContext::setupPathsWindows() { + this->defaultWalletDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + "/Wownero"; + this->defaultWalletDirRoot = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); +} + +void AppContext::setupPathsAndroid() { + this->defaultWalletDir = QString("%1/Wownero/wallets").arg(this->pathGenericData); + this->defaultWalletDirRoot = QString("%1/Wownero").arg(this->pathGenericData); +} + +void AppContext::setupPathsTails() { + QString portablePath = []{ + QString appImagePath = qgetenv("APPIMAGE"); + if (appImagePath.isEmpty()) { + qDebug() << "Not an appimage, using currentPath()"; + return QDir::currentPath() + "/.wowlet"; + } + + QFileInfo appImageDir(appImagePath); + return appImageDir.absoluteDir().path() + "/.wowlet"; + }(); + + if (QDir().mkpath(portablePath)) { + this->configRoot = portablePath; + } else { + qCritical() << "Unable to create portable directory: " << portablePath; + } +} + diff --git a/src/appcontext.h b/src/appcontext.h index 71d80f6..23a2326 100644 --- a/src/appcontext.h +++ b/src/appcontext.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_APPCONTEXT_H -#define FEATHER_APPCONTEXT_H +#ifndef WOWLET_APPCONTEXT_H +#define WOWLET_APPCONTEXT_H #include #include @@ -10,16 +10,18 @@ #include #include "utils/tails.h" +#include "utils/whonix.h" #include "utils/prices.h" #include "utils/networking.h" #include "utils/tor.h" -#include "utils/xmrto.h" #include "utils/xmrig.h" #include "utils/wsclient.h" #include "utils/txfiathistory.h" +#include "utils/WowletSeed.h" #include "widgets/RedditPost.h" +#include "widgets/ForumPost.h" #include "widgets/CCSEntry.h" -#include "utils/seeds.h" +#include "utils/RestoreHeightLookup.h" #include "utils/nodes.h" #include "libwalletqt/WalletManager.h" @@ -35,33 +37,50 @@ Q_OBJECT public: explicit AppContext(QCommandLineParser *cmdargs); - ~AppContext(); + ~AppContext() override; bool isTails = false; bool isWhonix = false; + bool isAndroid = false; + bool isLinux = false; + bool isMac = false; + bool isWindows = false; bool isDebug = false; + static bool isQML; + bool androidDebug = false; // Donation config - const QString donationAddress = "47ntfT2Z5384zku39pTM6hGcnLnvpRYW2Azm87GiAAH2bcTidtq278TL6HmwyL8yjMeERqGEBs3cqC8vvHPJd1cWQrGC65f"; + const QString donationAddress = "Wo3MWeKwtA918DU4c69hVSNgejdWFCRCuWjShRY66mJkU2Hv58eygJWDJS1MNa2Ge5M1WjUkGHuLqHkweDxwZZU42d16v94mP"; const int donationAmount = 25; // euro - bool donationSending = false; QCommandLineParser *cmdargs; - QString coinName = "monero"; + QString coinName = "wownero"; bool isTorSocks = false; + QString pathGenericData; QString homeDir; QString accountName; QString configRoot; QString configDirectory; + QString configDirectoryVR; QString defaultWalletDir; QString defaultWalletDirRoot; QString tmpTxDescription; + // https://git.wownero.com/wowlet/wowlet-backend/ + QString backendHost = "l3hkasj5nnrh24yzj4acj5dgqlscq56o5xjvvqsftj55fkonqly5aiid.onion"; + unsigned int backendPort = 80; + bool backendTLS = false; + QString backendWSUrl; + QString backendHTTPUrl; + QString walletPath; QString walletPassword = ""; + QString walletName; bool walletViewOnly = false; NetworkType::Type networkType; + Q_PROPERTY(QString walletName MEMBER walletName); + QString applicationPath; static void createConfigDirectory(const QString &dir) ; @@ -72,14 +91,18 @@ public: PendingTransaction::Priority tx_priority = PendingTransaction::Priority::Priority_Low; quint32 tx_mixin = static_cast(10); QString seedLanguage = "English"; // 14 word `monero-seed` only has English + // turn this on if you want to auto commit tx's after they have + // been created. Caution while using this setting is advised. This + // probably also breaks the default QtWidgets GUI. It is meant for + // alternative users of AppContext. + bool autoCommitTx = false; QNetworkAccessManager *network; QNetworkAccessManager *networkClearnet; - QNetworkProxy *networkProxy; + QNetworkProxy *networkProxy{}; - Tor *tor; + Tor *tor{}; WSClient *ws; - XmrTo *XMRTo; XmRig *XMRig; Nodes *nodes; static Prices *prices; @@ -88,41 +111,63 @@ public: static QMap txDescriptionCache; static QMap txCache; static TxFiatHistory *txFiatHistory; + QJsonArray yellowPagesData; + QJsonObject versionPending; // libwalletqt bool refreshed = false; + WalletManager *walletManager; Wallet *currentWallet = nullptr; - void createWallet(FeatherSeed seed, const QString &path, const QString &password); + void createWallet(WowletSeed seed, const QString &path, const QString &password); + Q_INVOKABLE void createWalletWithoutSpecifyingSeed(const QString &name, const QString &password); void createWalletViewOnly(const QString &path, const QString &password, const QString &address, const QString &viewkey, const QString &spendkey, quint64 restoreHeight); void createWalletFinish(const QString &password); void syncStatusUpdated(quint64 height, quint64 target); void updateBalance(); - void initTor(); + Q_INVOKABLE void initTor(); + Q_INVOKABLE void initWS(); void initRestoreHeights(); - void initWS(); - void donateBeg(); - void walletClose(bool emitClosedSignal = true); - void storeWallet(); void refreshModels(); void setWindowTitle(bool mining = false); + // Closes the currently opened wallet + Q_INVOKABLE void closeWallet(bool emitClosedSignal = true, bool storeWallet = false); + void storeWallet(); + + Q_INVOKABLE QVariantList listWallets() { + m_walletKeysFilesModel->refresh(); + + QVariantList list; + for(const WalletKeysFiles &wallet: m_walletKeysFilesModel->listWallets()) + list << wallet.toVariant(); + return list; + } + + Q_INVOKABLE QString displayAmount(quint64 amount) { + return Utils::balanceFormat(amount); + } + public slots: - void onOpenWallet(const QString& path, const QString &password); - void onCreateTransaction(const QString &address, const double amount, const QString &description, bool all); - void onCreateTransaction(XmrToOrder *order); - void onCancelTransaction(PendingTransaction *tx, const QString &address); + Q_INVOKABLE void onOpenWallet(const QString& path, const QString &password); + void onCreateTransaction(QString address, quint64 amount, const QString description, bool all); + void onCreateTransactionMultiDest(const QVector &addresses, const QVector &amounts, const QString &description); + void onCancelTransaction(PendingTransaction *tx, const QVector &address); void onSweepOutput(const QString &keyImage, QString address, bool churn, int outputs) const; void onCreateTransactionError(const QString &msg); void onOpenAliasResolve(const QString &openAlias); void onSetRestoreHeight(quint64 height); void onPreferredFiatCurrencyChanged(const QString &symbol); + Q_INVOKABLE void onAskReceivingPIN(); + Q_INVOKABLE void onLookupReceivingPIN(QString pin); + Q_INVOKABLE QString getAddress(quint32 accountIndex, quint32 addressIndex); private slots: void onWSNodes(const QJsonArray &nodes); void onWSMessage(const QJsonObject& msg); void onWSCCS(const QJsonArray &ccs_data); void onWSReddit(const QJsonArray& reddit_data); + void onWSForum(const QJsonArray& forum_data); void onMoneySpent(const QString &txId, quint64 amount); void onMoneyReceived(const QString &txId, quint64 amount); @@ -132,34 +177,47 @@ private slots: void onWalletOpened(Wallet *wallet); void onWalletNewBlock(quint64 blockheight, quint64 targetHeight); void onHeightRefreshed(quint64 walletHeight, quint64 daemonHeight, quint64 targetHeight); - void onTransactionCreated(PendingTransaction *tx, const QString &address, const QString &paymentId, quint32 mixin); + void onTransactionCreated(PendingTransaction *tx, const QVector &address); void onTransactionCommitted(bool status, PendingTransaction *t, const QStringList& txid); - void onConnectionStatusChanged(int status); signals: + // Emitted just before the wallet is closed + void walletAboutToClose(); + + // Emitted after a wallet has been closed + void walletClosed(); + void balanceUpdated(quint64 balance, quint64 spendable); + void balanceUpdatedFormatted(QString fmt); void blockchainSync(int height, int target); void refreshSync(int height, int target); void synchronized(); void blockHeightWSUpdated(QMap heights); - void walletSynchronized(); - void walletOpened(); - void walletClosed(); + void walletRefreshed(); + void walletOpened(Wallet *wallet); void walletCreatedError(const QString &msg); void walletCreated(Wallet *wallet); void walletOpenedError(QString msg); void walletOpenPasswordNeeded(bool invalidPassword, QString path); void transactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid); void createTransactionError(QString message); - void createTransactionCancelled(QString address, double amount); - void createTransactionSuccess(PendingTransaction *tx, const QString &address, const quint32 &mixin); + void createTransactionCancelled(const QVector &address, double amount); + void createTransactionSuccess(PendingTransaction *tx, const QVector &address); + void wsConnected(); + void wsDisconnected(); void redditUpdated(QList> &posts); - void nodesUpdated(QList> &nodes); + void forumUpdated(QList> &posts); + void nodesUpdated(QList> &nodes); void ccsUpdated(QList> &entries); + void suchWowUpdated(const QJsonArray &such_data); + void yellowUpdated(); void nodeSourceChanged(NodeSource nodeSource); void XMRigDownloads(const QJsonObject &data); - void setCustomNodes(QList nodes); - void ccsEmpty(); + void WownerodDownloads(const QJsonObject &data); + void pinLookupReceived(QString address, QString pin); + void pinLookupErrorReceived(); + void pinReceived(QString pin); + void setCustomNodes(QList nodes); void openAliasResolveError(const QString &msg); void openAliasResolved(const QString &address, const QString &openAlias); void setRestoreHeightError(const QString &msg); @@ -168,14 +226,21 @@ signals: void donationNag(); void initiateTransaction(); void endTransaction(); - void walletClosing(); void setTitle(const QString &title); // set window title + void versionOutdated(QString version_string, QJsonObject data); private: + WalletKeysFilesModel *m_walletKeysFilesModel; const int m_donationBoundary = 15; - UtilsNetworking *m_utilsNetworkingNodes; - QTimer *m_storeTimer = new QTimer(this); - QUrl m_wsUrl = QUrl(QStringLiteral("ws://7e6egbawekbkxzkv4244pqeqgoo4axko2imgjbedwnn6s5yb6b7oliqd.onion/ws")); + QTimer m_storeTimer; + QTimer m_hibernateTimer; + std::chrono::seconds m_hibernateDetectInterval{300}; + std::chrono::time_point m_hibernatePreviousTime; + + void setupPathsUnix(); + void setupPathsWindows(); + void setupPathsAndroid(); + void setupPathsTails(); }; -#endif //FEATHER_APPCONTEXT_H +#endif //WOWLET_APPCONTEXT_H diff --git a/src/assets.qrc b/src/assets.qrc index c37e4da..6b5d07c 100644 --- a/src/assets.qrc +++ b/src/assets.qrc @@ -3,7 +3,8 @@ assets/about.txt assets/ack.txt assets/contributors.txt - assets/feather.desktop + assets/org.wowlet.wowlet.desktop + assets/nodes.json assets/images/appicons/32x32.png assets/images/appicons/48x48.png assets/images/appicons/64x64.png @@ -11,9 +12,6 @@ assets/images/appicons/128x128.png assets/images/appicons/256x256.png assets/images/arrow.svg - assets/images/banners/1.png - assets/images/banners/2.png - assets/images/banners/3.png assets/images/bitcoin.png assets/images/camera_dark.png assets/images/camera_white.png @@ -30,15 +28,18 @@ assets/images/confirmed.svg assets/images/connect.svg assets/images/copy.png - assets/images/cutexmrfox.png + assets/images/dog_running.gif + assets/images/dog_sitting.gif assets/images/edit.png assets/images/exchange.png + assets/images/exchange_white.png assets/images/expired.png assets/images/expired_icon.png assets/images/eye1.png assets/images/eye_blind.png - assets/images/feather.png + assets/images/wowlet.png assets/images/file.png + assets/images/fire.png assets/images/gnome-calc.png assets/images/history.png assets/images/info.png @@ -54,8 +55,133 @@ assets/images/network.png assets/images/offline_tx.png assets/images/person.svg + assets/images/illiterate_illuminati.png + assets/images/welcome/wow1.png + assets/images/welcome/wow2.png + assets/images/welcome/wow3.png + assets/images/welcome/wow4.png + assets/images/welcome/wow5.png + assets/images/welcome/wow6.png + assets/images/welcome/wow7.png + assets/images/welcome/wow8.png + assets/images/welcome/wow9.png + assets/images/welcome/wow10.png + assets/images/welcome/wow11.png + assets/images/welcome/wow12.png + assets/images/welcome/wow13.png + assets/images/welcome/wow14.png + assets/images/welcome/wow15.png + assets/images/welcome/wow16.png + assets/images/welcome/wow17.png + assets/images/welcome/wow18.png + assets/images/welcome/wow19.png + assets/images/welcome/wow20.png + assets/images/welcome/wow21.png + assets/images/welcome/wow22.png + assets/images/welcome/wow23.png + assets/images/welcome/wow24.png + assets/images/welcome/wow25.png + assets/images/welcome/wow26.png + assets/images/welcome/wow27.png + assets/images/welcome/wow28.png + assets/images/welcome/wow29.png + assets/images/welcome/wow30.png + assets/images/welcome/wow31.png + assets/images/welcome/wow32.png + assets/images/welcome/wow33.png + assets/images/welcome/wow34.png + assets/images/welcome/wow35.png + assets/images/welcome/wow36.png + assets/images/welcome/wow37.png + assets/images/welcome/wow38.png + assets/images/welcome/wow39.png + assets/images/welcome/wow40.png + assets/images/welcome/wow41.png + assets/images/welcome/wow42.png + assets/images/welcome/wow43.png + assets/images/welcome/wow44.png + assets/images/welcome/wow45.png + assets/images/welcome/wow46.png + assets/images/welcome/wow47.png + assets/images/welcome/wow48.png + assets/images/welcome/wow49.png + assets/images/welcome/wow50.png + assets/images/welcome/wow51.png + assets/images/welcome/wow52.png + assets/images/welcome/wow53.png + assets/images/welcome/wow54.png + assets/images/welcome/wow55.png + assets/images/welcome/wow56.png + assets/images/welcome/wow57.png + assets/images/welcome/wow58.png + assets/images/welcome/wow59.png + assets/images/welcome/wow60.png + assets/images/welcome/wow61.png + assets/images/welcome/wow62.png + assets/images/welcome/wow63.png + assets/images/welcome/wow64.png + assets/images/welcome/wow65.png + assets/images/welcome/wow66.png + assets/images/welcome/wow67.png + assets/images/welcome/wow68.png + assets/images/welcome/wow69.png + assets/images/welcome/wow70.png + assets/images/welcome/wow71.png + assets/images/welcome/wow72.png + assets/images/welcome/wow73.png + assets/images/welcome/wow74.png + assets/images/welcome/wow75.png + assets/images/welcome/wow76.png + assets/images/welcome/wow77.png + assets/images/welcome/wow78.png + assets/images/welcome/wow79.png + assets/images/welcome/wow80.png + assets/images/welcome/wow81.png + assets/images/welcome/wow82.png + assets/images/welcome/wow83.png + assets/images/welcome/wow84.png + assets/images/welcome/wow85.png + assets/images/welcome/wow86.png + assets/images/welcome/wow87.png + assets/images/welcome/wow88.png + assets/images/welcome/wow89.png + assets/images/welcome/wow90.png + assets/images/welcome/wow91.png + assets/images/welcome/wow92.png + assets/images/welcome/wow93.png + assets/images/welcome/wow94.png + assets/images/welcome/wow95.png + assets/images/welcome/wow96.png + assets/images/welcome/wow97.png + assets/images/welcome/wow98.png + assets/images/welcome/wow99.png + assets/images/welcome/wow100.png + assets/images/welcome/wow101.png + assets/images/welcome/wow102.png + assets/images/welcome/wow103.png + assets/images/welcome/wow104.png + assets/images/welcome/wow105.png + assets/images/welcome/wow106.png + assets/images/welcome/wow107.png + assets/images/welcome/wow108.png + assets/images/welcome/wow109.png + assets/images/welcome/wow110.png + assets/images/welcome/wow111.png + assets/images/welcome/wow112.png + assets/images/welcome/wow113.png + assets/images/welcome/wow114.png + assets/images/welcome/wow115.png + assets/images/welcome/wow116.png + assets/images/welcome/wow117.png + assets/images/welcome/wow118.png + assets/images/welcome/wow119.png + assets/images/welcome/wow120.png + assets/images/welcome/wow121.png + assets/images/welcome/wow122.png + assets/images/welcome/wow123.png assets/images/preferences.png assets/images/preferences.svg + assets/images/credits.jpg assets/images/qrcode.png assets/images/qrcode_white.png assets/images/revealer_c.png @@ -63,6 +189,7 @@ assets/images/seal.png assets/images/seed.png assets/images/speaker.png + assets/images/pls_update.jpg assets/images/status_connected_fork.png assets/images/status_connected.png assets/images/status_connected_proxy_fork.png @@ -96,13 +223,39 @@ assets/images/unpaid.png assets/images/update.png assets/images/warning.png - assets/images/xmrto_big.png - assets/images/xmrto.png assets/images/xmrig.ico assets/images/xmrig.svg assets/images/zoom.png assets/mnemonic_25_english.txt - assets/restore_heights_monero_mainnet.txt - assets/restore_heights_monero_stagenet.txt + assets/restore_heights_wownero_mainnet.txt + + assets/images/mining/bottom_center_console.png + assets/images/mining/intel.png + assets/images/mining/amd.png + assets/images/mining/overlay.png + assets/images/mining/mining_gradient.png + assets/images/mining/bg1.gif + assets/images/mining/lowerleft_circle.png + assets/images/mining/lowerleft.png + assets/images/mining/lower_repeat.png + assets/images/mining/lowerright.png + assets/images/mining/r_bottom.png + assets/images/mining/r_left.png + assets/images/mining/r_right.png + assets/images/mining/topleft.png + assets/images/mining/topright_bar.png + assets/images/mining/topright_left.png + assets/images/mining/topright_middle.png + assets/images/mining/topright_right.png + assets/images/mining/warning.png + assets/images/mining/axe.png + assets/images/mining/lowerleft_btn.png + assets/images/mining/elmo.gif + assets/images/mining/bubble.png + assets/images/mining/mining.webp + + assets/fonts/ComicMono.ttf + assets/fonts/ComicMono-Bold.ttf + ui/qml/mining.qml diff --git a/src/assets/about.txt b/src/assets/about.txt index ac20d39..13a4dec 100644 --- a/src/assets/about.txt +++ b/src/assets/about.txt @@ -1,8 +1,9 @@ -Feather () +WOWlet () -https://featherwallet.org +Website: https://wownero.org +E-mail: dev@wownero.org -Created by dsc , tobtoht , and contributors. +Created by dsc, tobtoht, and contributors. Copyright (c) 2020-, The Monero Project diff --git a/src/assets/ack.txt b/src/assets/ack.txt index c025986..6a9dc4b 100644 --- a/src/assets/ack.txt +++ b/src/assets/ack.txt @@ -1,12 +1,13 @@ +WOWlet is a fork of Feather (https://git.featherwallet.org/feather/feather). + The wallet UI is heavily inspired by Electrum. We would like to recognize Thomas Voegtlin for his pioneering work on Bitcoin. -Feather uses monero-seed written by Tevador, for 14 word mnemonic seeds. +WOWlet uses monero-seed written by Tevador, for 14 word mnemonic seeds. Wizard banner art was adapted from a paper wallet design by the themonera (themonera.art). Initial CMake support for the Monero GUI was coded by TheCharlatan/xiphon. -Huge thanks to nioc, fluffypony, wowario, thrmo for help during development. +Huge thanks to dsc, tobtoht, nioc, fluffypony, wowario, thrmo for help during development. -Some more shoutouts for people for hosting nodes and/or having good ideas: -dnale0r, dEBRUYNE, binaryFate, lza_menace, jwinterm, kico, wowario +rottensox for testing :-) diff --git a/src/assets/contributors.txt b/src/assets/contributors.txt index 251d72c..92c9122 100644 --- a/src/assets/contributors.txt +++ b/src/assets/contributors.txt @@ -1,5 +1,5 @@ -dsc -tobtoht -selsta -Diego Salazar -Matt Smith \ No newline at end of file +dsc +tobtoht +selsta +Diego Salazar +Matt Smith \ No newline at end of file diff --git a/src/assets/feather.desktop b/src/assets/feather.desktop deleted file mode 100644 index 56a851c..0000000 --- a/src/assets/feather.desktop +++ /dev/null @@ -1,14 +0,0 @@ -[Desktop Entry] -Comment=Lightweight Monero Wallet -Exec=feather -GenericName[en_US]=Monero Wallet -GenericName=Monero Wallet -Icon=feather -Name[en_US]=Feather -Name=Feather -Categories=Finance;Network; -StartupNotify=false -StartupWMClass=feather -Terminal=false -Type=Application -MimeType=x-scheme-handler/monero; diff --git a/src/assets/fonts/ComicMono-Bold.ttf b/src/assets/fonts/ComicMono-Bold.ttf new file mode 100644 index 0000000..e03f41e Binary files /dev/null and b/src/assets/fonts/ComicMono-Bold.ttf differ diff --git a/src/assets/fonts/ComicMono.ttf b/src/assets/fonts/ComicMono.ttf new file mode 100644 index 0000000..9bc7354 Binary files /dev/null and b/src/assets/fonts/ComicMono.ttf differ diff --git a/src/assets/images/appicons/1024x1024.png b/src/assets/images/appicons/1024x1024.png new file mode 100644 index 0000000..acc9469 Binary files /dev/null and b/src/assets/images/appicons/1024x1024.png differ diff --git a/src/assets/images/appicons/128x128.png b/src/assets/images/appicons/128x128.png index 496896c..7d06c3c 100644 Binary files a/src/assets/images/appicons/128x128.png and b/src/assets/images/appicons/128x128.png differ diff --git a/src/assets/images/appicons/16x16.png b/src/assets/images/appicons/16x16.png new file mode 100644 index 0000000..1bc2708 Binary files /dev/null and b/src/assets/images/appicons/16x16.png differ diff --git a/src/assets/images/appicons/192x192.png b/src/assets/images/appicons/192x192.png new file mode 100644 index 0000000..93be5ba Binary files /dev/null and b/src/assets/images/appicons/192x192.png differ diff --git a/src/assets/images/appicons/22x22.png b/src/assets/images/appicons/22x22.png new file mode 100644 index 0000000..f3b3cb3 Binary files /dev/null and b/src/assets/images/appicons/22x22.png differ diff --git a/src/assets/images/appicons/24x24.png b/src/assets/images/appicons/24x24.png new file mode 100644 index 0000000..d7179ae Binary files /dev/null and b/src/assets/images/appicons/24x24.png differ diff --git a/src/assets/images/appicons/256x256.png b/src/assets/images/appicons/256x256.png index bbc3ddc..7a177f3 100644 Binary files a/src/assets/images/appicons/256x256.png and b/src/assets/images/appicons/256x256.png differ diff --git a/src/assets/images/appicons/32x32.png b/src/assets/images/appicons/32x32.png index 260435f..ce69873 100644 Binary files a/src/assets/images/appicons/32x32.png and b/src/assets/images/appicons/32x32.png differ diff --git a/src/assets/images/appicons/36x36.png b/src/assets/images/appicons/36x36.png new file mode 100644 index 0000000..643bf5a Binary files /dev/null and b/src/assets/images/appicons/36x36.png differ diff --git a/src/assets/images/appicons/42x42.png b/src/assets/images/appicons/42x42.png new file mode 100644 index 0000000..0532ad3 Binary files /dev/null and b/src/assets/images/appicons/42x42.png differ diff --git a/src/assets/images/appicons/48x48.png b/src/assets/images/appicons/48x48.png index c28af77..1b2d2a9 100644 Binary files a/src/assets/images/appicons/48x48.png and b/src/assets/images/appicons/48x48.png differ diff --git a/src/assets/images/appicons/512x512.png b/src/assets/images/appicons/512x512.png new file mode 100644 index 0000000..2289802 Binary files /dev/null and b/src/assets/images/appicons/512x512.png differ diff --git a/src/assets/images/appicons/64x64.png b/src/assets/images/appicons/64x64.png index d81babe..3388fe3 100644 Binary files a/src/assets/images/appicons/64x64.png and b/src/assets/images/appicons/64x64.png differ diff --git a/src/assets/images/appicons/64x64.png~ b/src/assets/images/appicons/64x64.png~ deleted file mode 100755 index c504f89..0000000 Binary files a/src/assets/images/appicons/64x64.png~ and /dev/null differ diff --git a/src/assets/images/appicons/72x72.png b/src/assets/images/appicons/72x72.png new file mode 100644 index 0000000..feef838 Binary files /dev/null and b/src/assets/images/appicons/72x72.png differ diff --git a/src/assets/images/appicons/8x8.png b/src/assets/images/appicons/8x8.png new file mode 100644 index 0000000..a6d5ea1 Binary files /dev/null and b/src/assets/images/appicons/8x8.png differ diff --git a/src/assets/images/appicons/96x96.png b/src/assets/images/appicons/96x96.png index 3b3bbbd..83affa9 100644 Binary files a/src/assets/images/appicons/96x96.png and b/src/assets/images/appicons/96x96.png differ diff --git a/src/assets/images/appicons/appicon.icns b/src/assets/images/appicons/appicon.icns old mode 100755 new mode 100644 index d0df4da..36c06ef Binary files a/src/assets/images/appicons/appicon.icns and b/src/assets/images/appicons/appicon.icns differ diff --git a/src/assets/images/appicons/appicon.ico b/src/assets/images/appicons/appicon.ico index a2092a8..b2989ed 100644 Binary files a/src/assets/images/appicons/appicon.ico and b/src/assets/images/appicons/appicon.ico differ diff --git a/src/assets/images/appicons/monero.png b/src/assets/images/appicons/monero.png deleted file mode 100755 index 15d5dcf..0000000 Binary files a/src/assets/images/appicons/monero.png and /dev/null differ diff --git a/src/assets/images/appicons/monero_grey.png b/src/assets/images/appicons/monero_grey.png deleted file mode 100755 index 5006367..0000000 Binary files a/src/assets/images/appicons/monero_grey.png and /dev/null differ diff --git a/src/assets/images/appicons/wowlet.svg b/src/assets/images/appicons/wowlet.svg new file mode 100644 index 0000000..72fda91 --- /dev/null +++ b/src/assets/images/appicons/wowlet.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + diff --git a/src/assets/images/banners/1.png b/src/assets/images/banners/1.png deleted file mode 100644 index c3d5e19..0000000 Binary files a/src/assets/images/banners/1.png and /dev/null differ diff --git a/src/assets/images/banners/2.png b/src/assets/images/banners/2.png deleted file mode 100644 index 6c67db7..0000000 Binary files a/src/assets/images/banners/2.png and /dev/null differ diff --git a/src/assets/images/banners/3.png b/src/assets/images/banners/3.png deleted file mode 100644 index a391808..0000000 Binary files a/src/assets/images/banners/3.png and /dev/null differ diff --git a/src/assets/images/credits.jpg b/src/assets/images/credits.jpg new file mode 100644 index 0000000..7f10892 Binary files /dev/null and b/src/assets/images/credits.jpg differ diff --git a/src/assets/images/cutexmrfox.png b/src/assets/images/cutexmrfox.png deleted file mode 100644 index 08d3d50..0000000 Binary files a/src/assets/images/cutexmrfox.png and /dev/null differ diff --git a/src/assets/images/dog_running.gif b/src/assets/images/dog_running.gif new file mode 100644 index 0000000..433ee58 Binary files /dev/null and b/src/assets/images/dog_running.gif differ diff --git a/src/assets/images/dog_sitting.gif b/src/assets/images/dog_sitting.gif new file mode 100644 index 0000000..f773aee Binary files /dev/null and b/src/assets/images/dog_sitting.gif differ diff --git a/src/assets/images/exchange_white.png b/src/assets/images/exchange_white.png new file mode 100644 index 0000000..9fe42b4 Binary files /dev/null and b/src/assets/images/exchange_white.png differ diff --git a/src/assets/images/feather.png b/src/assets/images/feather.png deleted file mode 100644 index 62af0e9..0000000 Binary files a/src/assets/images/feather.png and /dev/null differ diff --git a/src/assets/images/fire.png b/src/assets/images/fire.png new file mode 100644 index 0000000..6f5d037 Binary files /dev/null and b/src/assets/images/fire.png differ diff --git a/src/assets/images/illiterate_illuminati.png b/src/assets/images/illiterate_illuminati.png new file mode 100644 index 0000000..459f83e Binary files /dev/null and b/src/assets/images/illiterate_illuminati.png differ diff --git a/src/assets/images/mining/amd.png b/src/assets/images/mining/amd.png new file mode 100644 index 0000000..a75f597 Binary files /dev/null and b/src/assets/images/mining/amd.png differ diff --git a/src/assets/images/mining/axe.png b/src/assets/images/mining/axe.png new file mode 100644 index 0000000..7321bfd Binary files /dev/null and b/src/assets/images/mining/axe.png differ diff --git a/src/assets/images/mining/bg1.gif b/src/assets/images/mining/bg1.gif new file mode 100644 index 0000000..356669c Binary files /dev/null and b/src/assets/images/mining/bg1.gif differ diff --git a/src/assets/images/mining/bottom_center_console.png b/src/assets/images/mining/bottom_center_console.png new file mode 100644 index 0000000..cf492e0 Binary files /dev/null and b/src/assets/images/mining/bottom_center_console.png differ diff --git a/src/assets/images/mining/bubble.png b/src/assets/images/mining/bubble.png new file mode 100644 index 0000000..6681c18 Binary files /dev/null and b/src/assets/images/mining/bubble.png differ diff --git a/src/assets/images/mining/elmo.gif b/src/assets/images/mining/elmo.gif new file mode 100644 index 0000000..bbecfad Binary files /dev/null and b/src/assets/images/mining/elmo.gif differ diff --git a/src/assets/images/mining/intel.png b/src/assets/images/mining/intel.png new file mode 100644 index 0000000..909df59 Binary files /dev/null and b/src/assets/images/mining/intel.png differ diff --git a/src/assets/images/mining/lower_repeat.png b/src/assets/images/mining/lower_repeat.png new file mode 100644 index 0000000..9b8cf16 Binary files /dev/null and b/src/assets/images/mining/lower_repeat.png differ diff --git a/src/assets/images/mining/lowerleft.png b/src/assets/images/mining/lowerleft.png new file mode 100644 index 0000000..97db4c3 Binary files /dev/null and b/src/assets/images/mining/lowerleft.png differ diff --git a/src/assets/images/mining/lowerleft_btn.png b/src/assets/images/mining/lowerleft_btn.png new file mode 100644 index 0000000..2e2f275 Binary files /dev/null and b/src/assets/images/mining/lowerleft_btn.png differ diff --git a/src/assets/images/mining/lowerleft_circle.png b/src/assets/images/mining/lowerleft_circle.png new file mode 100644 index 0000000..7baa63f Binary files /dev/null and b/src/assets/images/mining/lowerleft_circle.png differ diff --git a/src/assets/images/mining/lowerright.png b/src/assets/images/mining/lowerright.png new file mode 100644 index 0000000..c9f2faf Binary files /dev/null and b/src/assets/images/mining/lowerright.png differ diff --git a/src/assets/images/mining/mining.webp b/src/assets/images/mining/mining.webp new file mode 100644 index 0000000..b11fe4a Binary files /dev/null and b/src/assets/images/mining/mining.webp differ diff --git a/src/assets/images/mining/mining_gradient.png b/src/assets/images/mining/mining_gradient.png new file mode 100644 index 0000000..f7422fe Binary files /dev/null and b/src/assets/images/mining/mining_gradient.png differ diff --git a/src/assets/images/mining/overlay.png b/src/assets/images/mining/overlay.png new file mode 100644 index 0000000..be97146 Binary files /dev/null and b/src/assets/images/mining/overlay.png differ diff --git a/src/assets/images/mining/r_bottom.png b/src/assets/images/mining/r_bottom.png new file mode 100644 index 0000000..8fa382f Binary files /dev/null and b/src/assets/images/mining/r_bottom.png differ diff --git a/src/assets/images/mining/r_left.png b/src/assets/images/mining/r_left.png new file mode 100644 index 0000000..b498e85 Binary files /dev/null and b/src/assets/images/mining/r_left.png differ diff --git a/src/assets/images/mining/r_right.png b/src/assets/images/mining/r_right.png new file mode 100644 index 0000000..8f56bfe Binary files /dev/null and b/src/assets/images/mining/r_right.png differ diff --git a/src/assets/images/mining/solo.png b/src/assets/images/mining/solo.png new file mode 100644 index 0000000..499e73b Binary files /dev/null and b/src/assets/images/mining/solo.png differ diff --git a/src/assets/images/mining/topleft.png b/src/assets/images/mining/topleft.png new file mode 100644 index 0000000..c4ddea1 Binary files /dev/null and b/src/assets/images/mining/topleft.png differ diff --git a/src/assets/images/mining/topright_bar.png b/src/assets/images/mining/topright_bar.png new file mode 100644 index 0000000..988f19c Binary files /dev/null and b/src/assets/images/mining/topright_bar.png differ diff --git a/src/assets/images/mining/topright_left.png b/src/assets/images/mining/topright_left.png new file mode 100644 index 0000000..3251de8 Binary files /dev/null and b/src/assets/images/mining/topright_left.png differ diff --git a/src/assets/images/mining/topright_middle.png b/src/assets/images/mining/topright_middle.png new file mode 100644 index 0000000..c590986 Binary files /dev/null and b/src/assets/images/mining/topright_middle.png differ diff --git a/src/assets/images/mining/topright_right.png b/src/assets/images/mining/topright_right.png new file mode 100644 index 0000000..3602e7c Binary files /dev/null and b/src/assets/images/mining/topright_right.png differ diff --git a/src/assets/images/mining/warning.png b/src/assets/images/mining/warning.png new file mode 100644 index 0000000..29745cb Binary files /dev/null and b/src/assets/images/mining/warning.png differ diff --git a/src/assets/images/pls_update.jpg b/src/assets/images/pls_update.jpg new file mode 100644 index 0000000..be276ab Binary files /dev/null and b/src/assets/images/pls_update.jpg differ diff --git a/src/assets/images/welcome/wow1.png b/src/assets/images/welcome/wow1.png new file mode 100644 index 0000000..de3bdb9 Binary files /dev/null and b/src/assets/images/welcome/wow1.png differ diff --git a/src/assets/images/welcome/wow10.png b/src/assets/images/welcome/wow10.png new file mode 100644 index 0000000..0d75a4a Binary files /dev/null and b/src/assets/images/welcome/wow10.png differ diff --git a/src/assets/images/welcome/wow100.png b/src/assets/images/welcome/wow100.png new file mode 100644 index 0000000..1b1ba84 Binary files /dev/null and b/src/assets/images/welcome/wow100.png differ diff --git a/src/assets/images/welcome/wow101.png b/src/assets/images/welcome/wow101.png new file mode 100644 index 0000000..567800b Binary files /dev/null and b/src/assets/images/welcome/wow101.png differ diff --git a/src/assets/images/welcome/wow102.png b/src/assets/images/welcome/wow102.png new file mode 100644 index 0000000..56e173c Binary files /dev/null and b/src/assets/images/welcome/wow102.png differ diff --git a/src/assets/images/welcome/wow103.png b/src/assets/images/welcome/wow103.png new file mode 100644 index 0000000..4c79ecf Binary files /dev/null and b/src/assets/images/welcome/wow103.png differ diff --git a/src/assets/images/welcome/wow104.png b/src/assets/images/welcome/wow104.png new file mode 100644 index 0000000..ba46ba2 Binary files /dev/null and b/src/assets/images/welcome/wow104.png differ diff --git a/src/assets/images/welcome/wow105.png b/src/assets/images/welcome/wow105.png new file mode 100644 index 0000000..6cc5b3e Binary files /dev/null and b/src/assets/images/welcome/wow105.png differ diff --git a/src/assets/images/welcome/wow106.png b/src/assets/images/welcome/wow106.png new file mode 100644 index 0000000..439acab Binary files /dev/null and b/src/assets/images/welcome/wow106.png differ diff --git a/src/assets/images/welcome/wow107.png b/src/assets/images/welcome/wow107.png new file mode 100644 index 0000000..e022ab0 Binary files /dev/null and b/src/assets/images/welcome/wow107.png differ diff --git a/src/assets/images/welcome/wow108.png b/src/assets/images/welcome/wow108.png new file mode 100644 index 0000000..b470507 Binary files /dev/null and b/src/assets/images/welcome/wow108.png differ diff --git a/src/assets/images/welcome/wow109.png b/src/assets/images/welcome/wow109.png new file mode 100644 index 0000000..afaf994 Binary files /dev/null and b/src/assets/images/welcome/wow109.png differ diff --git a/src/assets/images/welcome/wow11.png b/src/assets/images/welcome/wow11.png new file mode 100644 index 0000000..ff55daa Binary files /dev/null and b/src/assets/images/welcome/wow11.png differ diff --git a/src/assets/images/welcome/wow110.png b/src/assets/images/welcome/wow110.png new file mode 100644 index 0000000..cea76f4 Binary files /dev/null and b/src/assets/images/welcome/wow110.png differ diff --git a/src/assets/images/welcome/wow111.png b/src/assets/images/welcome/wow111.png new file mode 100644 index 0000000..34e071c Binary files /dev/null and b/src/assets/images/welcome/wow111.png differ diff --git a/src/assets/images/welcome/wow112.png b/src/assets/images/welcome/wow112.png new file mode 100644 index 0000000..8f3a6b5 Binary files /dev/null and b/src/assets/images/welcome/wow112.png differ diff --git a/src/assets/images/welcome/wow113.png b/src/assets/images/welcome/wow113.png new file mode 100644 index 0000000..d2f3efd Binary files /dev/null and b/src/assets/images/welcome/wow113.png differ diff --git a/src/assets/images/welcome/wow114.png b/src/assets/images/welcome/wow114.png new file mode 100644 index 0000000..0f8ea84 Binary files /dev/null and b/src/assets/images/welcome/wow114.png differ diff --git a/src/assets/images/welcome/wow115.png b/src/assets/images/welcome/wow115.png new file mode 100644 index 0000000..abf912c Binary files /dev/null and b/src/assets/images/welcome/wow115.png differ diff --git a/src/assets/images/welcome/wow116.png b/src/assets/images/welcome/wow116.png new file mode 100644 index 0000000..0a4982e Binary files /dev/null and b/src/assets/images/welcome/wow116.png differ diff --git a/src/assets/images/welcome/wow117.png b/src/assets/images/welcome/wow117.png new file mode 100644 index 0000000..9ad7428 Binary files /dev/null and b/src/assets/images/welcome/wow117.png differ diff --git a/src/assets/images/welcome/wow118.png b/src/assets/images/welcome/wow118.png new file mode 100644 index 0000000..0bc276a Binary files /dev/null and b/src/assets/images/welcome/wow118.png differ diff --git a/src/assets/images/welcome/wow119.png b/src/assets/images/welcome/wow119.png new file mode 100644 index 0000000..81176ba Binary files /dev/null and b/src/assets/images/welcome/wow119.png differ diff --git a/src/assets/images/welcome/wow12.png b/src/assets/images/welcome/wow12.png new file mode 100644 index 0000000..fd64151 Binary files /dev/null and b/src/assets/images/welcome/wow12.png differ diff --git a/src/assets/images/welcome/wow120.png b/src/assets/images/welcome/wow120.png new file mode 100644 index 0000000..543745e Binary files /dev/null and b/src/assets/images/welcome/wow120.png differ diff --git a/src/assets/images/welcome/wow121.png b/src/assets/images/welcome/wow121.png new file mode 100644 index 0000000..844b66f Binary files /dev/null and b/src/assets/images/welcome/wow121.png differ diff --git a/src/assets/images/welcome/wow122.png b/src/assets/images/welcome/wow122.png new file mode 100644 index 0000000..294f4ab Binary files /dev/null and b/src/assets/images/welcome/wow122.png differ diff --git a/src/assets/images/welcome/wow123.png b/src/assets/images/welcome/wow123.png new file mode 100644 index 0000000..0e6a572 Binary files /dev/null and b/src/assets/images/welcome/wow123.png differ diff --git a/src/assets/images/welcome/wow13.png b/src/assets/images/welcome/wow13.png new file mode 100644 index 0000000..6a57d42 Binary files /dev/null and b/src/assets/images/welcome/wow13.png differ diff --git a/src/assets/images/welcome/wow14.png b/src/assets/images/welcome/wow14.png new file mode 100644 index 0000000..f82afb3 Binary files /dev/null and b/src/assets/images/welcome/wow14.png differ diff --git a/src/assets/images/welcome/wow15.png b/src/assets/images/welcome/wow15.png new file mode 100644 index 0000000..fcf4a99 Binary files /dev/null and b/src/assets/images/welcome/wow15.png differ diff --git a/src/assets/images/welcome/wow16.png b/src/assets/images/welcome/wow16.png new file mode 100644 index 0000000..fe9f036 Binary files /dev/null and b/src/assets/images/welcome/wow16.png differ diff --git a/src/assets/images/welcome/wow17.png b/src/assets/images/welcome/wow17.png new file mode 100644 index 0000000..e5917c9 Binary files /dev/null and b/src/assets/images/welcome/wow17.png differ diff --git a/src/assets/images/welcome/wow18.png b/src/assets/images/welcome/wow18.png new file mode 100644 index 0000000..4f99f1a Binary files /dev/null and b/src/assets/images/welcome/wow18.png differ diff --git a/src/assets/images/welcome/wow19.png b/src/assets/images/welcome/wow19.png new file mode 100644 index 0000000..e41fc25 Binary files /dev/null and b/src/assets/images/welcome/wow19.png differ diff --git a/src/assets/images/welcome/wow2.png b/src/assets/images/welcome/wow2.png new file mode 100755 index 0000000..d0f96f0 Binary files /dev/null and b/src/assets/images/welcome/wow2.png differ diff --git a/src/assets/images/welcome/wow20.png b/src/assets/images/welcome/wow20.png new file mode 100644 index 0000000..77b4847 Binary files /dev/null and b/src/assets/images/welcome/wow20.png differ diff --git a/src/assets/images/welcome/wow21.png b/src/assets/images/welcome/wow21.png new file mode 100644 index 0000000..375aa17 Binary files /dev/null and b/src/assets/images/welcome/wow21.png differ diff --git a/src/assets/images/welcome/wow22.png b/src/assets/images/welcome/wow22.png new file mode 100644 index 0000000..2c4ad0f Binary files /dev/null and b/src/assets/images/welcome/wow22.png differ diff --git a/src/assets/images/welcome/wow23.png b/src/assets/images/welcome/wow23.png new file mode 100644 index 0000000..0565e64 Binary files /dev/null and b/src/assets/images/welcome/wow23.png differ diff --git a/src/assets/images/welcome/wow24.png b/src/assets/images/welcome/wow24.png new file mode 100644 index 0000000..0522700 Binary files /dev/null and b/src/assets/images/welcome/wow24.png differ diff --git a/src/assets/images/welcome/wow25.png b/src/assets/images/welcome/wow25.png new file mode 100644 index 0000000..77aeb9d Binary files /dev/null and b/src/assets/images/welcome/wow25.png differ diff --git a/src/assets/images/welcome/wow26.png b/src/assets/images/welcome/wow26.png new file mode 100644 index 0000000..cd1b137 Binary files /dev/null and b/src/assets/images/welcome/wow26.png differ diff --git a/src/assets/images/welcome/wow27.png b/src/assets/images/welcome/wow27.png new file mode 100644 index 0000000..1a443f1 Binary files /dev/null and b/src/assets/images/welcome/wow27.png differ diff --git a/src/assets/images/welcome/wow28.png b/src/assets/images/welcome/wow28.png new file mode 100644 index 0000000..19e552f Binary files /dev/null and b/src/assets/images/welcome/wow28.png differ diff --git a/src/assets/images/welcome/wow29.png b/src/assets/images/welcome/wow29.png new file mode 100644 index 0000000..0ced9b8 Binary files /dev/null and b/src/assets/images/welcome/wow29.png differ diff --git a/src/assets/images/welcome/wow3.png b/src/assets/images/welcome/wow3.png new file mode 100755 index 0000000..c0db816 Binary files /dev/null and b/src/assets/images/welcome/wow3.png differ diff --git a/src/assets/images/welcome/wow30.png b/src/assets/images/welcome/wow30.png new file mode 100644 index 0000000..1b39a4f Binary files /dev/null and b/src/assets/images/welcome/wow30.png differ diff --git a/src/assets/images/welcome/wow31.png b/src/assets/images/welcome/wow31.png new file mode 100644 index 0000000..16eabd3 Binary files /dev/null and b/src/assets/images/welcome/wow31.png differ diff --git a/src/assets/images/welcome/wow32.png b/src/assets/images/welcome/wow32.png new file mode 100644 index 0000000..f6ed814 Binary files /dev/null and b/src/assets/images/welcome/wow32.png differ diff --git a/src/assets/images/welcome/wow33.png b/src/assets/images/welcome/wow33.png new file mode 100644 index 0000000..8d6f00f Binary files /dev/null and b/src/assets/images/welcome/wow33.png differ diff --git a/src/assets/images/welcome/wow34.png b/src/assets/images/welcome/wow34.png new file mode 100644 index 0000000..66366f3 Binary files /dev/null and b/src/assets/images/welcome/wow34.png differ diff --git a/src/assets/images/welcome/wow35.png b/src/assets/images/welcome/wow35.png new file mode 100644 index 0000000..735705b Binary files /dev/null and b/src/assets/images/welcome/wow35.png differ diff --git a/src/assets/images/welcome/wow36.png b/src/assets/images/welcome/wow36.png new file mode 100644 index 0000000..f869dbb Binary files /dev/null and b/src/assets/images/welcome/wow36.png differ diff --git a/src/assets/images/welcome/wow37.png b/src/assets/images/welcome/wow37.png new file mode 100644 index 0000000..2018a8b Binary files /dev/null and b/src/assets/images/welcome/wow37.png differ diff --git a/src/assets/images/welcome/wow38.png b/src/assets/images/welcome/wow38.png new file mode 100644 index 0000000..3c845fa Binary files /dev/null and b/src/assets/images/welcome/wow38.png differ diff --git a/src/assets/images/welcome/wow39.png b/src/assets/images/welcome/wow39.png new file mode 100644 index 0000000..b21e906 Binary files /dev/null and b/src/assets/images/welcome/wow39.png differ diff --git a/src/assets/images/welcome/wow4.png b/src/assets/images/welcome/wow4.png new file mode 100644 index 0000000..9b49031 Binary files /dev/null and b/src/assets/images/welcome/wow4.png differ diff --git a/src/assets/images/welcome/wow40.png b/src/assets/images/welcome/wow40.png new file mode 100644 index 0000000..3c686c9 Binary files /dev/null and b/src/assets/images/welcome/wow40.png differ diff --git a/src/assets/images/welcome/wow41.png b/src/assets/images/welcome/wow41.png new file mode 100644 index 0000000..279c4f8 Binary files /dev/null and b/src/assets/images/welcome/wow41.png differ diff --git a/src/assets/images/welcome/wow42.png b/src/assets/images/welcome/wow42.png new file mode 100644 index 0000000..e5ef1bf Binary files /dev/null and b/src/assets/images/welcome/wow42.png differ diff --git a/src/assets/images/welcome/wow43.png b/src/assets/images/welcome/wow43.png new file mode 100644 index 0000000..9331981 Binary files /dev/null and b/src/assets/images/welcome/wow43.png differ diff --git a/src/assets/images/welcome/wow44.png b/src/assets/images/welcome/wow44.png new file mode 100644 index 0000000..5051d15 Binary files /dev/null and b/src/assets/images/welcome/wow44.png differ diff --git a/src/assets/images/welcome/wow45.png b/src/assets/images/welcome/wow45.png new file mode 100644 index 0000000..6ab151e Binary files /dev/null and b/src/assets/images/welcome/wow45.png differ diff --git a/src/assets/images/welcome/wow46.png b/src/assets/images/welcome/wow46.png new file mode 100644 index 0000000..5f4b6eb Binary files /dev/null and b/src/assets/images/welcome/wow46.png differ diff --git a/src/assets/images/welcome/wow47.png b/src/assets/images/welcome/wow47.png new file mode 100644 index 0000000..63d1b24 Binary files /dev/null and b/src/assets/images/welcome/wow47.png differ diff --git a/src/assets/images/welcome/wow48.png b/src/assets/images/welcome/wow48.png new file mode 100644 index 0000000..55e7a9a Binary files /dev/null and b/src/assets/images/welcome/wow48.png differ diff --git a/src/assets/images/welcome/wow49.png b/src/assets/images/welcome/wow49.png new file mode 100644 index 0000000..da4b3e7 Binary files /dev/null and b/src/assets/images/welcome/wow49.png differ diff --git a/src/assets/images/welcome/wow5.png b/src/assets/images/welcome/wow5.png new file mode 100644 index 0000000..d73ccd7 Binary files /dev/null and b/src/assets/images/welcome/wow5.png differ diff --git a/src/assets/images/welcome/wow50.png b/src/assets/images/welcome/wow50.png new file mode 100644 index 0000000..ada68bb Binary files /dev/null and b/src/assets/images/welcome/wow50.png differ diff --git a/src/assets/images/welcome/wow51.png b/src/assets/images/welcome/wow51.png new file mode 100644 index 0000000..5d6b82c Binary files /dev/null and b/src/assets/images/welcome/wow51.png differ diff --git a/src/assets/images/welcome/wow52.png b/src/assets/images/welcome/wow52.png new file mode 100644 index 0000000..4970e70 Binary files /dev/null and b/src/assets/images/welcome/wow52.png differ diff --git a/src/assets/images/welcome/wow53.png b/src/assets/images/welcome/wow53.png new file mode 100644 index 0000000..9083f5a Binary files /dev/null and b/src/assets/images/welcome/wow53.png differ diff --git a/src/assets/images/welcome/wow54.png b/src/assets/images/welcome/wow54.png new file mode 100644 index 0000000..c2cb724 Binary files /dev/null and b/src/assets/images/welcome/wow54.png differ diff --git a/src/assets/images/welcome/wow55.png b/src/assets/images/welcome/wow55.png new file mode 100644 index 0000000..a765ca9 Binary files /dev/null and b/src/assets/images/welcome/wow55.png differ diff --git a/src/assets/images/welcome/wow56.png b/src/assets/images/welcome/wow56.png new file mode 100644 index 0000000..c208b3e Binary files /dev/null and b/src/assets/images/welcome/wow56.png differ diff --git a/src/assets/images/welcome/wow57.png b/src/assets/images/welcome/wow57.png new file mode 100644 index 0000000..7872fa8 Binary files /dev/null and b/src/assets/images/welcome/wow57.png differ diff --git a/src/assets/images/welcome/wow58.png b/src/assets/images/welcome/wow58.png new file mode 100644 index 0000000..f4cb076 Binary files /dev/null and b/src/assets/images/welcome/wow58.png differ diff --git a/src/assets/images/welcome/wow59.png b/src/assets/images/welcome/wow59.png new file mode 100644 index 0000000..e88ad24 Binary files /dev/null and b/src/assets/images/welcome/wow59.png differ diff --git a/src/assets/images/welcome/wow6.png b/src/assets/images/welcome/wow6.png new file mode 100644 index 0000000..8c672a5 Binary files /dev/null and b/src/assets/images/welcome/wow6.png differ diff --git a/src/assets/images/welcome/wow60.png b/src/assets/images/welcome/wow60.png new file mode 100644 index 0000000..82964dd Binary files /dev/null and b/src/assets/images/welcome/wow60.png differ diff --git a/src/assets/images/welcome/wow61.png b/src/assets/images/welcome/wow61.png new file mode 100644 index 0000000..4f66099 Binary files /dev/null and b/src/assets/images/welcome/wow61.png differ diff --git a/src/assets/images/welcome/wow62.png b/src/assets/images/welcome/wow62.png new file mode 100644 index 0000000..4af583f Binary files /dev/null and b/src/assets/images/welcome/wow62.png differ diff --git a/src/assets/images/welcome/wow63.png b/src/assets/images/welcome/wow63.png new file mode 100644 index 0000000..93157ad Binary files /dev/null and b/src/assets/images/welcome/wow63.png differ diff --git a/src/assets/images/welcome/wow64.png b/src/assets/images/welcome/wow64.png new file mode 100644 index 0000000..9d8a21b Binary files /dev/null and b/src/assets/images/welcome/wow64.png differ diff --git a/src/assets/images/welcome/wow65.png b/src/assets/images/welcome/wow65.png new file mode 100644 index 0000000..52deeef Binary files /dev/null and b/src/assets/images/welcome/wow65.png differ diff --git a/src/assets/images/welcome/wow66.png b/src/assets/images/welcome/wow66.png new file mode 100644 index 0000000..70b2cd8 Binary files /dev/null and b/src/assets/images/welcome/wow66.png differ diff --git a/src/assets/images/welcome/wow67.png b/src/assets/images/welcome/wow67.png new file mode 100644 index 0000000..d0d87f5 Binary files /dev/null and b/src/assets/images/welcome/wow67.png differ diff --git a/src/assets/images/welcome/wow68.png b/src/assets/images/welcome/wow68.png new file mode 100644 index 0000000..6187a49 Binary files /dev/null and b/src/assets/images/welcome/wow68.png differ diff --git a/src/assets/images/welcome/wow69.png b/src/assets/images/welcome/wow69.png new file mode 100644 index 0000000..0360357 Binary files /dev/null and b/src/assets/images/welcome/wow69.png differ diff --git a/src/assets/images/welcome/wow7.png b/src/assets/images/welcome/wow7.png new file mode 100755 index 0000000..f6d4368 Binary files /dev/null and b/src/assets/images/welcome/wow7.png differ diff --git a/src/assets/images/welcome/wow70.png b/src/assets/images/welcome/wow70.png new file mode 100644 index 0000000..3c535c3 Binary files /dev/null and b/src/assets/images/welcome/wow70.png differ diff --git a/src/assets/images/welcome/wow71.png b/src/assets/images/welcome/wow71.png new file mode 100644 index 0000000..c92f14c Binary files /dev/null and b/src/assets/images/welcome/wow71.png differ diff --git a/src/assets/images/welcome/wow72.png b/src/assets/images/welcome/wow72.png new file mode 100644 index 0000000..b67918f Binary files /dev/null and b/src/assets/images/welcome/wow72.png differ diff --git a/src/assets/images/welcome/wow73.png b/src/assets/images/welcome/wow73.png new file mode 100644 index 0000000..d71e557 Binary files /dev/null and b/src/assets/images/welcome/wow73.png differ diff --git a/src/assets/images/welcome/wow74.png b/src/assets/images/welcome/wow74.png new file mode 100644 index 0000000..590b2b1 Binary files /dev/null and b/src/assets/images/welcome/wow74.png differ diff --git a/src/assets/images/welcome/wow75.png b/src/assets/images/welcome/wow75.png new file mode 100644 index 0000000..28add4e Binary files /dev/null and b/src/assets/images/welcome/wow75.png differ diff --git a/src/assets/images/welcome/wow76.png b/src/assets/images/welcome/wow76.png new file mode 100644 index 0000000..f546b91 Binary files /dev/null and b/src/assets/images/welcome/wow76.png differ diff --git a/src/assets/images/welcome/wow77.png b/src/assets/images/welcome/wow77.png new file mode 100644 index 0000000..78afea9 Binary files /dev/null and b/src/assets/images/welcome/wow77.png differ diff --git a/src/assets/images/welcome/wow78.png b/src/assets/images/welcome/wow78.png new file mode 100644 index 0000000..3979b39 Binary files /dev/null and b/src/assets/images/welcome/wow78.png differ diff --git a/src/assets/images/welcome/wow79.png b/src/assets/images/welcome/wow79.png new file mode 100644 index 0000000..a0f0bd0 Binary files /dev/null and b/src/assets/images/welcome/wow79.png differ diff --git a/src/assets/images/welcome/wow8.png b/src/assets/images/welcome/wow8.png new file mode 100644 index 0000000..288f362 Binary files /dev/null and b/src/assets/images/welcome/wow8.png differ diff --git a/src/assets/images/welcome/wow80.png b/src/assets/images/welcome/wow80.png new file mode 100644 index 0000000..cce80f5 Binary files /dev/null and b/src/assets/images/welcome/wow80.png differ diff --git a/src/assets/images/welcome/wow81.png b/src/assets/images/welcome/wow81.png new file mode 100644 index 0000000..6ea6d99 Binary files /dev/null and b/src/assets/images/welcome/wow81.png differ diff --git a/src/assets/images/welcome/wow82.png b/src/assets/images/welcome/wow82.png new file mode 100644 index 0000000..30e463d Binary files /dev/null and b/src/assets/images/welcome/wow82.png differ diff --git a/src/assets/images/welcome/wow83.png b/src/assets/images/welcome/wow83.png new file mode 100644 index 0000000..e3a884e Binary files /dev/null and b/src/assets/images/welcome/wow83.png differ diff --git a/src/assets/images/welcome/wow84.png b/src/assets/images/welcome/wow84.png new file mode 100644 index 0000000..0b87357 Binary files /dev/null and b/src/assets/images/welcome/wow84.png differ diff --git a/src/assets/images/welcome/wow85.png b/src/assets/images/welcome/wow85.png new file mode 100644 index 0000000..7f56856 Binary files /dev/null and b/src/assets/images/welcome/wow85.png differ diff --git a/src/assets/images/welcome/wow86.png b/src/assets/images/welcome/wow86.png new file mode 100644 index 0000000..7851148 Binary files /dev/null and b/src/assets/images/welcome/wow86.png differ diff --git a/src/assets/images/welcome/wow87.png b/src/assets/images/welcome/wow87.png new file mode 100644 index 0000000..bce0c24 Binary files /dev/null and b/src/assets/images/welcome/wow87.png differ diff --git a/src/assets/images/welcome/wow88.png b/src/assets/images/welcome/wow88.png new file mode 100644 index 0000000..8d208cb Binary files /dev/null and b/src/assets/images/welcome/wow88.png differ diff --git a/src/assets/images/welcome/wow89.png b/src/assets/images/welcome/wow89.png new file mode 100644 index 0000000..3ceace9 Binary files /dev/null and b/src/assets/images/welcome/wow89.png differ diff --git a/src/assets/images/welcome/wow9.png b/src/assets/images/welcome/wow9.png new file mode 100755 index 0000000..300528c Binary files /dev/null and b/src/assets/images/welcome/wow9.png differ diff --git a/src/assets/images/welcome/wow90.png b/src/assets/images/welcome/wow90.png new file mode 100644 index 0000000..6354d44 Binary files /dev/null and b/src/assets/images/welcome/wow90.png differ diff --git a/src/assets/images/welcome/wow91.png b/src/assets/images/welcome/wow91.png new file mode 100644 index 0000000..f411105 Binary files /dev/null and b/src/assets/images/welcome/wow91.png differ diff --git a/src/assets/images/welcome/wow92.png b/src/assets/images/welcome/wow92.png new file mode 100644 index 0000000..a8205cd Binary files /dev/null and b/src/assets/images/welcome/wow92.png differ diff --git a/src/assets/images/welcome/wow93.png b/src/assets/images/welcome/wow93.png new file mode 100644 index 0000000..935a64d Binary files /dev/null and b/src/assets/images/welcome/wow93.png differ diff --git a/src/assets/images/welcome/wow94.png b/src/assets/images/welcome/wow94.png new file mode 100644 index 0000000..0b156ec Binary files /dev/null and b/src/assets/images/welcome/wow94.png differ diff --git a/src/assets/images/welcome/wow95.png b/src/assets/images/welcome/wow95.png new file mode 100644 index 0000000..9cdc440 Binary files /dev/null and b/src/assets/images/welcome/wow95.png differ diff --git a/src/assets/images/welcome/wow96.png b/src/assets/images/welcome/wow96.png new file mode 100644 index 0000000..e340e6d Binary files /dev/null and b/src/assets/images/welcome/wow96.png differ diff --git a/src/assets/images/welcome/wow97.png b/src/assets/images/welcome/wow97.png new file mode 100644 index 0000000..7e9021a Binary files /dev/null and b/src/assets/images/welcome/wow97.png differ diff --git a/src/assets/images/welcome/wow98.png b/src/assets/images/welcome/wow98.png new file mode 100644 index 0000000..b3d0671 Binary files /dev/null and b/src/assets/images/welcome/wow98.png differ diff --git a/src/assets/images/welcome/wow99.png b/src/assets/images/welcome/wow99.png new file mode 100644 index 0000000..337727f Binary files /dev/null and b/src/assets/images/welcome/wow99.png differ diff --git a/src/assets/images/wowlet.png b/src/assets/images/wowlet.png new file mode 100644 index 0000000..a3da77b Binary files /dev/null and b/src/assets/images/wowlet.png differ diff --git a/src/assets/images/wowlet_old.png b/src/assets/images/wowlet_old.png new file mode 100644 index 0000000..12ed7e9 Binary files /dev/null and b/src/assets/images/wowlet_old.png differ diff --git a/src/assets/images/xmrto.png b/src/assets/images/xmrto.png deleted file mode 100644 index b06c771..0000000 Binary files a/src/assets/images/xmrto.png and /dev/null differ diff --git a/src/assets/lost_seed_find.txt b/src/assets/lost_seed_find.txt new file mode 100644 index 0000000..bc7ce55 --- /dev/null +++ b/src/assets/lost_seed_find.txt @@ -0,0 +1,49 @@ +in Conversations::Conversations(), results into `/tmp/results.txt` + + QString fn_wallet_temp = "/tmp/lol"; + QString fn_wallet_temp_keys = "/tmp/lol.keys"; + QString fn_results = "/tmp/results.txt"; + + QFile f_results(fn_results); + f_results.open(QIODevice::Append); + + QTextStream f_results_stream(&f_results); + + QFile f_newseeds("/tmp/new_seeds.txt"); // seeds to test for validness + + int i = 0; + int offset = 0; + if (f_newseeds.open(QIODevice::ReadOnly)) + { + QTextStream f_newseeds_stream(&f_newseeds); + + while (!f_newseeds_stream.atEnd()) { + if(i < offset) { + i++; + continue; + } + + QFile::remove(fn_wallet_temp); + QFile::remove(fn_wallet_temp_keys); + + QString seed = f_newseeds_stream.readLine().trimmed(); + qWarning() << "[" << QString::number(i) << "]" << seed; + + auto wallet = this->walletManager->recoveryWallet(fn_wallet_temp, "", seed, "", this->networkType, 0, this->kdfRounds); + auto wallet_status = wallet->status(); + + if(wallet_status == Wallet::Status::Status_Ok) { + //QString addr = QString::fromStdString(wallet->address(0, 0)); + auto addr = wallet->address(0, 0); + auto result_line = QString("%1 : %2").arg(addr, seed); + qWarning() << result_line; + f_results_stream << result_line << "\n"; + f_results_stream.flush(); + } + + delete wallet; + i++; + } + } + + f_results.close(); \ No newline at end of file diff --git a/src/assets/nodes.json b/src/assets/nodes.json new file mode 100644 index 0000000..1032659 --- /dev/null +++ b/src/assets/nodes.json @@ -0,0 +1,42 @@ +{ + "mainnet": { + "tor": [ + "v2admi6gbeprxnk6i2oscizhgy4v5ixu6iezkhj5udiwbfjjs2w7dnid.onion:34568", + "awbibkoaa67jhuaqes4n2243gd6vtidjzqj2djukrubp2eudrmxr5mid.onion:34568", + "7ftpbpp6rbgqi5kjmhyin46essnh3eqb3m3rhfi7r2fr33iwkeuer3yd.onion:34568", + "j7rf2jcccizcp47y5moehguyuqdpg4lusk642sw4nayuruitqaqbc7ad.onion:34568", + "aje53o5z5twne5q2ljw44zkahhsuhjtwaxuburxddbf7n4pfsj4rj6qd.onion:34568", + "nepc4lxndsooj2akn7ofrj3ooqc25242obchcag6tw3f2mxrms2uuvyd.onion:34568", + "666l2ajxqjgj5lskvbokvworjysgvqag4oitokjuy7wz6juisul4jqad.onion:34568", + "ty7ppqozzodz75audgvkprekiiqsovbyrkfdjwadrkbe3etyzloatxad.onion:34568", + "ewynwpnprbgqllv2syn3drjdrqkw7ehoeg73znelm6mevvmpddexsoqd.onion:34568", + "mqkiqwmhhpqtzlrf26stv7jvtaudbyzkbg3lttkmvvvauzgtxm62tgyd.onion:34568", + "zao3w6isidntdbnyee5ufs7fyzmv7wzchpw32i3uo5eldjwmo4bxg2qd.onion:34568" + ], + "clearnet": [ + "global.wownodes.com:34568", + "super.fast.node.xmr.pm:34568", + "node.wownero.club:34568", + "node.suchwow.xyz:34568", + "eu-west-1.wow.xmr.pm:34568", + "eu-west-2.wow.xmr.pm:34568", + "eu-west-3.wow.xmr.pm:34568", + "eu-west-4.wow.xmr.pm:34568", + "eu-west-5.wow.xmr.pm:34568", + "eu-west-6.wow.xmr.pm:34568", + "na-west-1.wow.xmr.pm:34568", + "much.wow.such.money:34568", + "very.wow.such.money:34568", + "169.119.33.174:34568", + "wow.bot.tips:34568", + "idontwanttogototoronto.wow.fail:34568" + ] + }, + "stagenet": { + "tor": [], + "clearnet": [ + "run.your.own.node.xmr.pm:38089", + "super.fast.node.xmr.pm:38089" + ] + } +} diff --git a/src/assets/org.wowlet.wowlet.desktop b/src/assets/org.wowlet.wowlet.desktop new file mode 100644 index 0000000..bc83e60 --- /dev/null +++ b/src/assets/org.wowlet.wowlet.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Type=Application +Version=1.0 +Name=WOWlet +GenericName=Wownero Wallet +Comment=Lightweight Wownero Wallet +Icon=wowlet +Exec=wowlet +Terminal=false +MimeType=x-scheme-handler/wownero; +Categories=Network; +Keywords=wow;wownero;cryptocurrency;dank;meme; +StartupNotify=false +StartupWMClass=wowlet +PrefersNonDefaultGPU=false diff --git a/src/assets/org.wowlet.wowlet.metainfo.xml b/src/assets/org.wowlet.wowlet.metainfo.xml new file mode 100644 index 0000000..c30ec49 --- /dev/null +++ b/src/assets/org.wowlet.wowlet.metainfo.xml @@ -0,0 +1,38 @@ + + + + org.wowlet.wowlet + BSD-3-Clause + BSD-3-Clause + WOWlet + Lightweight Wownero Wallet + + +

+ WOWlet is a free, open-source Wownero client for Linux with ports for Mac OS and Windows. +

+
+ + org.wowlet.wowlet.desktop + + + + Wow Dark Theme + https://i.imgur.com/KMFrtpZ.png + + + https://git.wownero.com/wowlet/wowlet + WOWlet + + + wowlet + + + + + +

Initial release.

+
+
+
+
\ No newline at end of file diff --git a/src/assets/restore_heights_monero_mainnet.txt b/src/assets/restore_heights_monero_mainnet.txt deleted file mode 100644 index 60e7353..0000000 --- a/src/assets/restore_heights_monero_mainnet.txt +++ /dev/null @@ -1,1457 +0,0 @@ -1397818193:1 -1397900458:1500 -1397988986:3000 -1398072982:4500 -1398150254:6000 -1398239439:7500 -1398327464:9000 -1398414629:10500 -1398503595:12000 -1398589229:13500 -1398674475:15000 -1398759778:16500 -1398853330:18000 -1398940120:19500 -1399029142:21000 -1399108598:22500 -1399199476:24000 -1399276463:25500 -1399359258:27000 -1399430728:28500 -1399529049:30000 -1399617670:31500 -1399704054:33000 -1399788123:34500 -1399876759:36000 -1399966741:37500 -1400048830:39000 -1400137204:40500 -1400227960:42000 -1400306653:43500 -1400390723:45000 -1400481607:46500 -1400562797:48000 -1400642153:49500 -1400733770:51000 -1400824661:52500 -1400909443:54000 -1400995911:55500 -1401087629:57000 -1401174818:58500 -1401259431:60000 -1401346018:61500 -1401446104:63000 -1401533922:64500 -1401615882:66000 -1401711748:67500 -1401800119:69000 -1401890061:70500 -1401981961:72000 -1402068695:73500 -1402161441:75000 -1402251933:76500 -1402342853:78000 -1402430216:79500 -1402521608:81000 -1402607480:82500 -1402694197:84000 -1402782013:85500 -1402877831:87000 -1402961257:88500 -1403051337:90000 -1403142326:91500 -1403227928:93000 -1403317545:94500 -1403402406:96000 -1403489043:97500 -1403581110:99000 -1403672901:100500 -1403762913:102000 -1403853728:103500 -1403942246:105000 -1404030101:106500 -1404121204:108000 -1404209324:109500 -1404299477:111000 -1404389132:112500 -1404479896:114000 -1404568672:115500 -1404658453:117000 -1404748301:118500 -1404841666:120000 -1404931637:121500 -1405021251:123000 -1405111817:124500 -1405202249:126000 -1405292780:127500 -1405384068:129000 -1405474052:130500 -1405560833:132000 -1405648064:133500 -1405738612:135000 -1405826744:136500 -1405917415:138000 -1406009136:139500 -1406098048:141000 -1406187373:142500 -1406276248:144000 -1406366555:145500 -1406454661:147000 -1406545604:148500 -1406634825:150000 -1406725340:151500 -1406814693:153000 -1406904971:154500 -1406994787:156000 -1407085463:157500 -1407175390:159000 -1407267706:160500 -1407356299:162000 -1407449840:163500 -1407538256:165000 -1407626820:166500 -1407724474:168000 -1407809765:169500 -1407902144:171000 -1407993798:172500 -1408082457:174000 -1408172155:175500 -1408262956:177000 -1408354097:178500 -1408443936:180000 -1408532602:181500 -1408622703:183000 -1408710047:184500 -1408800621:186000 -1408889541:187500 -1408978632:189000 -1409069384:190500 -1409161090:192000 -1409252389:193500 -1409341518:195000 -1409431833:196500 -1409523265:198000 -1409615103:199500 -1409706694:201000 -1409798817:202500 -1409887837:204000 -1409975926:205500 -1410066995:207000 -1410157020:208500 -1410247699:210000 -1410338278:211500 -1410426858:213000 -1410517509:214500 -1410603548:216000 -1410697050:217500 -1410786623:219000 -1410879374:220500 -1410968790:222000 -1411061102:223500 -1411150344:225000 -1411240315:226500 -1411333451:228000 -1411426837:229500 -1411517510:231000 -1411609298:232500 -1411700275:234000 -1411786636:235500 -1411879257:237000 -1411969413:238500 -1412059180:240000 -1412146654:241500 -1412240371:243000 -1412327650:244500 -1412419484:246000 -1412505208:247500 -1412598099:249000 -1412689756:250500 -1412779061:252000 -1412871113:253500 -1412958247:255000 -1413046858:256500 -1413143444:258000 -1413233792:259500 -1413326427:261000 -1413418713:262500 -1413513170:264000 -1413600711:265500 -1413691038:267000 -1413782539:268500 -1413873271:270000 -1413963233:271500 -1414051910:273000 -1414141926:274500 -1414235227:276000 -1414324027:277500 -1414416650:279000 -1414508370:280500 -1414600491:282000 -1414690323:283500 -1414780188:285000 -1414869014:286500 -1414960781:288000 -1415056523:289500 -1415146466:291000 -1415242321:292500 -1415326686:294000 -1415416410:295500 -1415513982:297000 -1415605041:298500 -1415690591:300000 -1415782947:301500 -1415872606:303000 -1415962299:304500 -1416054283:306000 -1416140330:307500 -1416233580:309000 -1416322091:310500 -1416414135:312000 -1416506758:313500 -1416595374:315000 -1416689164:316500 -1416780263:318000 -1416874051:319500 -1416962889:321000 -1417055934:322500 -1417146000:324000 -1417236998:325500 -1417324179:327000 -1417416820:328500 -1417507901:330000 -1417597710:331500 -1417686355:333000 -1417777506:334500 -1417862659:336000 -1417955917:337500 -1418046843:339000 -1418136820:340500 -1418233090:342000 -1418324035:343500 -1418414267:345000 -1418505126:346500 -1418595764:348000 -1418688320:349500 -1418779374:351000 -1418872600:352500 -1418966538:354000 -1419055739:355500 -1419144085:357000 -1419238098:358500 -1419326271:360000 -1419418123:361500 -1419507535:363000 -1419597647:364500 -1419683774:366000 -1419774083:367500 -1419866259:369000 -1419955270:370500 -1420044008:372000 -1420140609:373500 -1420231494:375000 -1420324119:376500 -1420413916:378000 -1420507318:379500 -1420606276:381000 -1420694938:382500 -1420789183:384000 -1420876853:385500 -1420964886:387000 -1421056364:388500 -1421145579:390000 -1421237342:391500 -1421326931:393000 -1421416957:394500 -1421502911:396000 -1421596997:397500 -1421688678:399000 -1421778389:400500 -1421868252:402000 -1421962600:403500 -1422053511:405000 -1422143942:406500 -1422233701:408000 -1422325595:409500 -1422417764:411000 -1422505420:412500 -1422598104:414000 -1422687391:415500 -1422777785:417000 -1422868479:418500 -1422956207:420000 -1423049056:421500 -1423138582:423000 -1423229478:424500 -1423317219:426000 -1423406036:427500 -1423499905:429000 -1423588906:430500 -1423680298:432000 -1423772526:433500 -1423862745:435000 -1423952092:436500 -1424041391:438000 -1424139807:439500 -1424229026:441000 -1424318898:442500 -1424409301:444000 -1424499432:445500 -1424588330:447000 -1424678229:448500 -1424767351:450000 -1424856412:451500 -1424945924:453000 -1425037250:454500 -1425127838:456000 -1425218701:457500 -1425304420:459000 -1425398748:460500 -1425487631:462000 -1425582279:463500 -1425668647:465000 -1425759251:466500 -1425851153:468000 -1425944420:469500 -1426035355:471000 -1426125337:472500 -1426216244:474000 -1426305042:475500 -1426396945:477000 -1426488132:478500 -1426579077:480000 -1426668886:481500 -1426757427:483000 -1426847995:484500 -1426937217:486000 -1427027279:487500 -1427118292:489000 -1427209584:490500 -1427297515:492000 -1427390524:493500 -1427480882:495000 -1427570116:496500 -1427659258:498000 -1427749838:499500 -1427840543:501000 -1427932591:502500 -1428024040:504000 -1428113328:505500 -1428207103:507000 -1428294368:508500 -1428385900:510000 -1428475862:511500 -1428566459:513000 -1428656150:514500 -1428745154:516000 -1428836572:517500 -1428927559:519000 -1429016578:520500 -1429108184:522000 -1429198248:523500 -1429288171:525000 -1429377542:526500 -1429471467:528000 -1429558593:529500 -1429653677:531000 -1429746059:532500 -1429836351:534000 -1429925189:535500 -1430016095:537000 -1430107657:538500 -1430197340:540000 -1430289235:541500 -1430378857:543000 -1430469252:544500 -1430559860:546000 -1430649912:547500 -1430737924:549000 -1430831012:550500 -1430922367:552000 -1431010902:553500 -1431101587:555000 -1431192674:556500 -1431285757:558000 -1431375632:559500 -1431466492:561000 -1431558015:562500 -1431649156:564000 -1431737625:565500 -1431828881:567000 -1431918115:568500 -1432011390:570000 -1432100985:571500 -1432189708:573000 -1432280424:574500 -1432369030:576000 -1432457824:577500 -1432550488:579000 -1432641906:580500 -1432730503:582000 -1432821446:583500 -1432914085:585000 -1433004746:586500 -1433094395:588000 -1433187412:589500 -1433276104:591000 -1433367216:592500 -1433460433:594000 -1433551901:595500 -1433637685:597000 -1433733220:598500 -1433825715:600000 -1433916570:601500 -1434006501:603000 -1434096894:604500 -1434187100:606000 -1434273702:607500 -1434367676:609000 -1434455723:610500 -1434545055:612000 -1434635579:613500 -1434730428:615000 -1434817300:616500 -1434906793:618000 -1434998648:619500 -1435090833:621000 -1435182990:622500 -1435273589:624000 -1435366019:625500 -1435453713:627000 -1435548085:628500 -1435636924:630000 -1435729973:631500 -1435822621:633000 -1435908886:634500 -1436001545:636000 -1436088666:637500 -1436178148:639000 -1436269067:640500 -1436362647:642000 -1436450486:643500 -1436539955:645000 -1436630255:646500 -1436721546:648000 -1436812401:649500 -1436903919:651000 -1436994474:652500 -1437085546:654000 -1437182957:655500 -1437275193:657000 -1437366265:658500 -1437455928:660000 -1437546033:661500 -1437633837:663000 -1437722391:664500 -1437810260:666000 -1437902321:667500 -1437993029:669000 -1438084185:670500 -1438171580:672000 -1438264522:673500 -1438354565:675000 -1438443988:676500 -1438535479:678000 -1438623629:679500 -1438716455:681000 -1438811029:682500 -1438904689:684000 -1438995954:685500 -1439086366:687000 -1439177854:688500 -1439267688:690000 -1439359080:691500 -1439447799:693000 -1439536807:694500 -1439628635:696000 -1439719005:697500 -1439804776:699000 -1439896959:700500 -1439989036:702000 -1440080322:703500 -1440170251:705000 -1440259422:706500 -1440351566:708000 -1440442434:709500 -1440537570:711000 -1440625665:712500 -1440717538:714000 -1440811510:715500 -1440903517:717000 -1440993091:718500 -1441084930:720000 -1441176305:721500 -1441265615:723000 -1441355056:724500 -1441446393:726000 -1441536851:727500 -1441628898:729000 -1441718152:730500 -1441805254:732000 -1441897179:733500 -1441986435:735000 -1442080450:736500 -1442172155:738000 -1442263883:739500 -1442355067:741000 -1442449041:742500 -1442542209:744000 -1442635207:745500 -1442724460:747000 -1442812486:748500 -1442902966:750000 -1442994219:751500 -1443085698:753000 -1443178161:754500 -1443264135:756000 -1443355099:757500 -1443446477:759000 -1443535739:760500 -1443625352:762000 -1443720015:763500 -1443811700:765000 -1443902882:766500 -1443998004:768000 -1444089737:769500 -1444182793:771000 -1444270850:772500 -1444361771:774000 -1444454626:775500 -1444544876:777000 -1444634893:778500 -1444725863:780000 -1444814080:781500 -1444904547:783000 -1444996388:784500 -1445086690:786000 -1445175749:787500 -1445267687:789000 -1445360811:790500 -1445449074:792000 -1445543282:793500 -1445632023:795000 -1445722156:796500 -1445813732:798000 -1445908836:799500 -1445998334:801000 -1446091833:802500 -1446185727:804000 -1446275117:805500 -1446367555:807000 -1446458743:808500 -1446548650:810000 -1446636178:811500 -1446729285:813000 -1446818028:814500 -1446909549:816000 -1447003607:817500 -1447093001:819000 -1447184705:820500 -1447278621:822000 -1447372370:823500 -1447468038:825000 -1447558138:826500 -1447652390:828000 -1447742476:829500 -1447828166:831000 -1447923194:832500 -1448013216:834000 -1448102910:835500 -1448193723:837000 -1448283885:838500 -1448375042:840000 -1448465226:841500 -1448556419:843000 -1448649382:844500 -1448740265:846000 -1448829027:847500 -1448923137:849000 -1449020848:850500 -1449111876:852000 -1449206548:853500 -1449295175:855000 -1449383624:856500 -1449475534:858000 -1449567493:859500 -1449656259:861000 -1449747770:862500 -1449839439:864000 -1449928803:865500 -1450020705:867000 -1450116099:868500 -1450206082:870000 -1450295833:871500 -1450393905:873000 -1450484210:874500 -1450576191:876000 -1450674264:877500 -1450763812:879000 -1450854842:880500 -1450945997:882000 -1451036350:883500 -1451125224:885000 -1451213407:886500 -1451306539:888000 -1451395994:889500 -1451487825:891000 -1451578633:892500 -1451673162:894000 -1451762734:895500 -1451855376:897000 -1451950724:898500 -1452044620:900000 -1452138667:901500 -1452229272:903000 -1452321274:904500 -1452411380:906000 -1452503713:907500 -1452593651:909000 -1452685043:910500 -1452774742:912000 -1452871547:913500 -1452955528:915000 -1453045013:916500 -1453139828:918000 -1453235253:919500 -1453322581:921000 -1453418754:922500 -1453508866:924000 -1453599446:925500 -1453692429:927000 -1453785727:928500 -1453874045:930000 -1453967280:931500 -1454056395:933000 -1454149053:934500 -1454238746:936000 -1454332249:937500 -1454422039:939000 -1454517368:940500 -1454604302:942000 -1454697148:943500 -1454792369:945000 -1454883921:946500 -1454976152:948000 -1455069597:949500 -1455162171:951000 -1455253531:952500 -1455344835:954000 -1455435262:955500 -1455523159:957000 -1455614591:958500 -1455704830:960000 -1455795089:961500 -1455885662:963000 -1455979503:964500 -1456067893:966000 -1456159912:967500 -1456252158:969000 -1456343386:970500 -1456436372:972000 -1456531050:973500 -1456626469:975000 -1456722795:976500 -1456812422:978000 -1456904454:979500 -1456992650:981000 -1457081799:982500 -1457174326:984000 -1457265022:985500 -1457353587:987000 -1457446102:988500 -1457536684:990000 -1457626424:991500 -1457717341:993000 -1457807857:994500 -1457902501:996000 -1457995186:997500 -1458089638:999000 -1458180514:1000500 -1458274276:1002000 -1458364317:1003500 -1458455352:1005000 -1458549046:1006500 -1458636174:1008000 -1458729317:1009500 -1458894346:1011000 -1459063482:1012500 -1459243276:1014000 -1459425755:1015500 -1459605826:1017000 -1459782083:1018500 -1459961331:1020000 -1460143746:1021500 -1460331607:1023000 -1460520936:1024500 -1460701361:1026000 -1460884221:1027500 -1461061695:1029000 -1461237934:1030500 -1461414191:1032000 -1461593953:1033500 -1461777761:1035000 -1461952141:1036500 -1462132052:1038000 -1462317051:1039500 -1462495092:1041000 -1462677074:1042500 -1462861748:1044000 -1463044884:1045500 -1463224911:1047000 -1463398580:1048500 -1463578591:1050000 -1463757604:1051500 -1463936022:1053000 -1464117101:1054500 -1464297865:1056000 -1464483584:1057500 -1464671071:1059000 -1464849970:1060500 -1465024863:1062000 -1465205807:1063500 -1465386722:1065000 -1465564285:1066500 -1465738760:1068000 -1465918555:1069500 -1466100427:1071000 -1466276876:1072500 -1466454118:1074000 -1466639653:1075500 -1466820501:1077000 -1467005177:1078500 -1467185150:1080000 -1467362682:1081500 -1467540213:1083000 -1467716652:1084500 -1467893799:1086000 -1468069912:1087500 -1468248812:1089000 -1468427344:1090500 -1468603125:1092000 -1468787751:1093500 -1468965065:1095000 -1469145781:1096500 -1469337233:1098000 -1469521554:1099500 -1469699691:1101000 -1469874679:1102500 -1470053612:1104000 -1470236012:1105500 -1470414476:1107000 -1470595923:1108500 -1470777161:1110000 -1470955781:1111500 -1471138526:1113000 -1471319847:1114500 -1471500943:1116000 -1471682222:1117500 -1471860790:1119000 -1472035420:1120500 -1472217115:1122000 -1472395302:1123500 -1472570739:1125000 -1472751050:1126500 -1472928309:1128000 -1473098267:1129500 -1473276441:1131000 -1473457643:1132500 -1473642257:1134000 -1473826970:1135500 -1474002748:1137000 -1474188317:1138500 -1474374066:1140000 -1474550392:1141500 -1474729572:1143000 -1474911163:1144500 -1475092518:1146000 -1475268122:1147500 -1475442938:1149000 -1475629374:1150500 -1475819480:1152000 -1475997819:1153500 -1476179133:1155000 -1476354939:1156500 -1476536210:1158000 -1476716350:1159500 -1476895225:1161000 -1477073983:1162500 -1477249312:1164000 -1477433801:1165500 -1477614082:1167000 -1477804971:1168500 -1477990372:1170000 -1478169998:1171500 -1478348283:1173000 -1478528413:1174500 -1478705414:1176000 -1478886655:1177500 -1479062832:1179000 -1479243048:1180500 -1479418422:1182000 -1479595192:1183500 -1479778962:1185000 -1479964598:1186500 -1480140671:1188000 -1480324683:1189500 -1480500809:1191000 -1480682239:1192500 -1480856453:1194000 -1481038133:1195500 -1481217124:1197000 -1481392752:1198500 -1481575804:1200000 -1481756751:1201500 -1481934733:1203000 -1482116256:1204500 -1482301346:1206000 -1482479176:1207500 -1482654068:1209000 -1482834659:1210500 -1483004059:1212000 -1483188148:1213500 -1483362554:1215000 -1483539897:1216500 -1483721622:1218000 -1483903190:1219500 -1484088607:1221000 -1484263006:1222500 -1484446963:1224000 -1484626829:1225500 -1484809489:1227000 -1484983861:1228500 -1485170094:1230000 -1485349686:1231500 -1485530749:1233000 -1485709581:1234500 -1485884232:1236000 -1486067414:1237500 -1486245341:1239000 -1486425256:1240500 -1486608991:1242000 -1486786270:1243500 -1486973042:1245000 -1487146309:1246500 -1487325223:1248000 -1487503053:1249500 -1487685365:1251000 -1487863975:1252500 -1488050119:1254000 -1488223036:1255500 -1488410492:1257000 -1488589768:1258500 -1488775148:1260000 -1488949276:1261500 -1489133453:1263000 -1489308790:1264500 -1489485996:1266000 -1489664303:1267500 -1489848401:1269000 -1490027832:1270500 -1490206463:1272000 -1490390593:1273500 -1490567029:1275000 -1490746894:1276500 -1490933137:1278000 -1491106069:1279500 -1491289329:1281000 -1491468486:1282500 -1491643624:1284000 -1491814895:1285500 -1491995475:1287000 -1492178181:1288500 -1492371569:1290000 -1492552114:1291500 -1492729903:1293000 -1492910706:1294500 -1493094028:1296000 -1493277668:1297500 -1493451685:1299000 -1493634509:1300500 -1493814008:1302000 -1493991208:1303500 -1494166238:1305000 -1494350490:1306500 -1494526071:1308000 -1494707137:1309500 -1494887930:1311000 -1495071305:1312500 -1495251430:1314000 -1495429566:1315500 -1495614062:1317000 -1495788802:1318500 -1495965162:1320000 -1496146099:1321500 -1496328368:1323000 -1496504063:1324500 -1496681255:1326000 -1496866740:1327500 -1497043312:1329000 -1497226571:1330500 -1497400684:1332000 -1497583491:1333500 -1497766332:1335000 -1497942512:1336500 -1498119751:1338000 -1498305083:1339500 -1498481551:1341000 -1498659598:1342500 -1498837788:1344000 -1499017991:1345500 -1499192957:1347000 -1499368904:1348500 -1499552117:1350000 -1499732418:1351500 -1499915064:1353000 -1500092067:1354500 -1500266465:1356000 -1500451753:1357500 -1500628055:1359000 -1500809381:1360500 -1500985894:1362000 -1501163425:1363500 -1501344352:1365000 -1501524529:1366500 -1501706158:1368000 -1501887950:1369500 -1502070277:1371000 -1502246128:1372500 -1502426331:1374000 -1502609329:1375500 -1502785502:1377000 -1502965697:1378500 -1503149952:1380000 -1503326470:1381500 -1503502198:1383000 -1503682259:1384500 -1503846976:1386000 -1504025371:1387500 -1504210659:1389000 -1504388051:1390500 -1504571483:1392000 -1504750590:1393500 -1504923930:1395000 -1505104688:1396500 -1505283020:1398000 -1505464381:1399500 -1505644195:1401000 -1505826737:1402500 -1506005392:1404000 -1506184128:1405500 -1506368706:1407000 -1506547393:1408500 -1506725266:1410000 -1506907806:1411500 -1507085344:1413000 -1507267312:1414500 -1507445129:1416000 -1507628097:1417500 -1507803256:1419000 -1507986316:1420500 -1508167088:1422000 -1508347016:1423500 -1508530561:1425000 -1508710041:1426500 -1508886983:1428000 -1509066419:1429500 -1509253136:1431000 -1509429629:1432500 -1509611536:1434000 -1509797649:1435500 -1509973107:1437000 -1510153044:1438500 -1510332372:1440000 -1510509741:1441500 -1510696836:1443000 -1510871459:1444500 -1511052822:1446000 -1511231910:1447500 -1511407518:1449000 -1511587113:1450500 -1511770521:1452000 -1511949617:1453500 -1512129674:1455000 -1512307629:1456500 -1512482822:1458000 -1512653560:1459500 -1512835616:1461000 -1513017827:1462500 -1513197715:1464000 -1513372385:1465500 -1513547532:1467000 -1513728243:1468500 -1513909535:1470000 -1514083183:1471500 -1514266543:1473000 -1514444953:1474500 -1514621027:1476000 -1514798581:1477500 -1514978081:1479000 -1515155541:1480500 -1515339872:1482000 -1515518908:1483500 -1515699380:1485000 -1515875622:1486500 -1516053533:1488000 -1516243460:1489500 -1516414701:1491000 -1516599857:1492500 -1516781257:1494000 -1516964999:1495500 -1517142540:1497000 -1517315501:1498500 -1517489351:1500000 -1517666336:1501500 -1517855270:1503000 -1518027977:1504500 -1518203488:1506000 -1518384465:1507500 -1518558355:1509000 -1518751308:1510500 -1518924052:1512000 -1519106822:1513500 -1519281628:1515000 -1519466837:1516500 -1519648752:1518000 -1519829797:1519500 -1520014254:1521000 -1520184998:1522500 -1520370843:1524000 -1520544780:1525500 -1520728324:1527000 -1520910430:1528500 -1521088410:1530000 -1521268781:1531500 -1521445861:1533000 -1521631805:1534500 -1521805475:1536000 -1521987364:1537500 -1522168759:1539000 -1522349749:1540500 -1522531771:1542000 -1522713608:1543500 -1522889687:1545000 -1523199218:1546500 -1523341007:1548000 -1523527026:1549500 -1523709149:1551000 -1523888851:1552500 -1524065976:1554000 -1524246015:1555500 -1524423554:1557000 -1524602490:1558500 -1524783179:1560000 -1524964360:1561500 -1525151214:1563000 -1525329119:1564500 -1525513042:1566000 -1525692507:1567500 -1525871313:1569000 -1526053870:1570500 -1526230509:1572000 -1526410171:1573500 -1526592816:1575000 -1526773513:1576500 -1526955087:1578000 -1527133612:1579500 -1527316345:1581000 -1527498499:1582500 -1527676559:1584000 -1527855294:1585500 -1528040693:1587000 -1528219591:1588500 -1528395704:1590000 -1528579987:1591500 -1528763026:1593000 -1528943220:1594500 -1529121386:1596000 -1529302157:1597500 -1529479749:1599000 -1529664069:1600500 -1529840212:1602000 -1530015093:1603500 -1530198774:1605000 -1530375043:1606500 -1530556497:1608000 -1530734767:1609500 -1530917375:1611000 -1531096855:1612500 -1531279152:1614000 -1531454376:1615500 -1531642390:1617000 -1531816195:1618500 -1531995687:1620000 -1532180791:1621500 -1532356484:1623000 -1532537384:1624500 -1532719158:1626000 -1532898266:1627500 -1533078869:1629000 -1533257860:1630500 -1533441853:1632000 -1533620709:1633500 -1533798312:1635000 -1533982417:1636500 -1534160192:1638000 -1534343434:1639500 -1534524042:1641000 -1534702092:1642500 -1534879676:1644000 -1535063247:1645500 -1535244194:1647000 -1535420587:1648500 -1535600184:1650000 -1535779496:1651500 -1535956153:1653000 -1536134137:1654500 -1536311328:1656000 -1536494008:1657500 -1536670845:1659000 -1536851610:1660500 -1537033013:1662000 -1537210976:1663500 -1537392240:1665000 -1537574727:1666500 -1537753429:1668000 -1537928751:1669500 -1538111834:1671000 -1538291618:1672500 -1538476427:1674000 -1538652972:1675500 -1538836084:1677000 -1539013906:1678500 -1539198355:1680000 -1539374477:1681500 -1539552789:1683000 -1539736817:1684500 -1539951210:1686000 -1540117344:1687500 -1540296439:1689000 -1540473097:1690500 -1540653573:1692000 -1540834279:1693500 -1541014980:1695000 -1541190938:1696500 -1541369517:1698000 -1541548646:1699500 -1541734186:1701000 -1541913570:1702500 -1542092909:1704000 -1542275017:1705500 -1542449875:1707000 -1542635853:1708500 -1542815406:1710000 -1542997650:1711500 -1543178239:1713000 -1543359208:1714500 -1543540950:1716000 -1543727129:1717500 -1543901392:1719000 -1544084664:1720500 -1544267089:1722000 -1544446105:1723500 -1544624643:1725000 -1544803722:1726500 -1544987704:1728000 -1545170981:1729500 -1545350532:1731000 -1545532466:1732500 -1545710048:1734000 -1545887915:1735500 -1546069559:1737000 -1546245869:1738500 -1546431793:1740000 -1546606116:1741500 -1546786754:1743000 -1546968255:1744500 -1547139298:1746000 -1547319437:1747500 -1547496353:1749000 -1547672846:1750500 -1547850712:1752000 -1548034420:1753500 -1548214308:1755000 -1548391966:1756500 -1548573263:1758000 -1548752471:1759500 -1548928088:1761000 -1549106489:1762500 -1549283115:1764000 -1549456506:1765500 -1549634814:1767000 -1549817916:1768500 -1549998027:1770000 -1550181258:1771500 -1550361109:1773000 -1550539544:1774500 -1550715280:1776000 -1550894562:1777500 -1551079870:1779000 -1551254182:1780500 -1551434299:1782000 -1551619776:1783500 -1551794014:1785000 -1551973350:1786500 -1552162320:1788000 -1552440957:1789500 -1552624599:1791000 -1552807716:1792500 -1552980302:1794000 -1553162414:1795500 -1553342996:1797000 -1553519700:1798500 -1553698458:1800000 -1553881211:1801500 -1554066280:1803000 -1554243249:1804500 -1554425052:1806000 -1554603701:1807500 -1554782591:1809000 -1554964129:1810500 -1555144375:1812000 -1555323612:1813500 -1555506661:1815000 -1555682580:1816500 -1555865552:1818000 -1556045247:1819500 -1556225465:1821000 -1556407651:1822500 -1556582937:1824000 -1556772261:1825500 -1556942721:1827000 -1557123929:1828500 -1557301054:1830000 -1557481698:1831500 -1557663940:1833000 -1557840344:1834500 -1558023818:1836000 -1558203355:1837500 -1558391132:1839000 -1558575667:1840500 -1558746689:1842000 -1558925957:1843500 -1559106354:1845000 -1559287492:1846500 -1559467006:1848000 -1559645231:1849500 -1559825739:1851000 -1560005500:1852500 -1560188695:1854000 -1560369273:1855500 -1560549957:1857000 -1560728250:1858500 -1560908667:1860000 -1561089902:1861500 -1561266483:1863000 -1561452756:1864500 -1561630099:1866000 -1561809391:1867500 -1561988751:1869000 -1562166315:1870500 -1562348668:1872000 -1562528088:1873500 -1562705035:1875000 -1562894124:1876500 -1563072153:1878000 -1563253196:1879500 -1563429474:1881000 -1563612610:1882500 -1563790557:1884000 -1563972425:1885500 -1564152141:1887000 -1564332716:1888500 -1564511944:1890000 -1564693842:1891500 -1564873798:1893000 -1565051050:1894500 -1565230166:1896000 -1565410958:1897500 -1565587893:1899000 -1565768680:1900500 -1565949811:1902000 -1566131254:1903500 -1566309564:1905000 -1566490278:1906500 -1566668500:1908000 -1566847812:1909500 -1567031237:1911000 -1567210421:1912500 -1567391373:1914000 -1567573130:1915500 -1567750424:1917000 -1567930191:1918500 -1568109052:1920000 -1568292141:1921500 -1568475276:1923000 -1568651158:1924500 -1568834035:1926000 -1569016695:1927500 -1569197462:1929000 -1569377087:1930500 -1569552946:1932000 -1569734228:1933500 -1569917274:1935000 -1570098125:1936500 -1570275613:1938000 -1570457750:1939500 -1570639244:1941000 -1570819775:1942500 -1570996968:1944000 -1571176527:1945500 -1571356679:1947000 -1571534462:1948500 -1571718656:1950000 -1571897497:1951500 -1572079573:1953000 -1572257839:1954500 -1572433496:1956000 -1572617030:1957500 -1572800390:1959000 -1572981257:1960500 -1573162090:1962000 -1573343169:1963500 -1573522418:1965000 -1573702490:1966500 -1573880257:1968000 -1574062548:1969500 -1574251843:1971000 -1574424663:1972500 -1574601376:1974000 -1574786775:1975500 -1574964035:1977000 -1575146296:1978500 -1575292812:1980000 -1575466285:1981500 -1575651166:1983000 -1575830411:1984500 -1576005533:1986000 -1576186198:1987500 -1576360710:1989000 -1576541731:1990500 -1576716413:1992000 -1576902518:1993500 -1577081999:1995000 -1577264190:1996500 -1577443608:1998000 -1577623965:1999500 -1577797297:2001000 -1577979977:2002500 -1578159838:2004000 -1578336239:2005500 -1578515304:2007000 -1578699616:2008500 -1578876107:2010000 -1579060229:2011500 -1579242633:2013000 -1579414863:2014500 -1579597542:2016000 -1579772970:2017500 -1579952975:2019000 -1580137609:2020500 -1580317014:2022000 -1580496315:2023500 -1580675324:2025000 -1580849194:2026500 -1581032371:2028000 -1581214733:2029500 -1581397004:2031000 -1581572973:2032500 -1581751875:2034000 -1581931029:2035500 -1582114546:2037000 -1582295872:2038500 -1582472927:2040000 -1582657335:2041500 -1582835968:2043000 -1583012446:2044500 -1583196576:2046000 -1583373753:2047500 -1583560473:2049000 -1583738686:2050500 -1583922736:2052000 -1584105842:2053500 -1584285185:2055000 -1584463972:2056500 -1584642026:2058000 -1584821928:2059500 -1584995845:2061000 -1585184223:2062500 -1585363485:2064000 -1585540102:2065500 -1585721837:2067000 -1585899117:2068500 -1586084634:2070000 -1586262819:2071500 -1586442409:2073000 -1586623044:2074500 -1586801375:2076000 -1586980631:2077500 -1587165890:2079000 -1587341099:2080500 -1587523790:2082000 -1587702237:2083500 -1587883578:2085000 -1588063778:2086500 -1588245212:2088000 -1588424440:2089500 -1588603366:2091000 -1588781424:2092500 -1588964395:2094000 -1589142803:2095500 -1589321977:2097000 -1589506409:2098500 -1589683808:2100000 -1589865852:2101500 -1590042622:2103000 -1590222956:2104500 -1590404367:2106000 -1590581681:2107500 -1590762536:2109000 -1590943308:2110500 -1591125425:2112000 -1591304788:2113500 -1591483294:2115000 -1591666790:2116500 -1591846816:2118000 -1592023700:2119500 -1592207460:2121000 -1592386537:2122500 -1592569543:2124000 -1592747578:2125500 -1592925121:2127000 -1593103239:2128500 -1593277684:2130000 -1593464042:2131500 -1593643273:2133000 -1593824098:2134500 -1594000762:2136000 -1594187379:2137500 -1594369906:2139000 -1594552767:2140500 -1594721587:2142000 -1594908084:2143500 -1595088951:2145000 -1595269262:2146500 -1595454606:2148000 -1595633949:2149500 -1595806853:2151000 -1595988097:2152500 -1596168734:2154000 -1596347710:2155500 -1596523798:2157000 -1596694716:2158500 -1596887172:2160000 -1597077820:2161500 -1597256353:2163000 -1597436569:2164500 -1597622246:2166000 -1597800117:2167500 -1597984768:2169000 -1598161623:2170500 -1598338544:2172000 -1598523532:2173500 -1598704427:2175000 -1598881234:2176500 -1599067666:2178000 -1599247884:2179500 -1599426969:2181000 -1599604157:2182500 -1599786817:2184000 diff --git a/src/assets/restore_heights_monero_stagenet.txt b/src/assets/restore_heights_monero_stagenet.txt deleted file mode 100644 index c28a4a4..0000000 --- a/src/assets/restore_heights_monero_stagenet.txt +++ /dev/null @@ -1,444 +0,0 @@ -1518932025:1 -1519057016:1500 -1519148374:3000 -1519251680:4500 -1519344568:6000 -1519443436:7500 -1519538388:9000 -1519630287:10500 -1519706564:12000 -1519797372:13500 -1519887275:15000 -1519977816:16500 -1520068127:18000 -1520163067:19500 -1520267595:21000 -1520378423:22500 -1520470528:24000 -1520547672:25500 -1520637599:27000 -1520727714:28500 -1520817129:30000 -1520907017:31500 -1521042482:33000 -1521203259:34500 -1521379791:36000 -1521565539:37500 -1521768004:39000 -1521952047:40500 -1522127660:42000 -1522284923:43500 -1522510139:45000 -1522676022:46500 -1522871613:48000 -1522969561:49500 -1523145200:51000 -1523316302:52500 -1523550884:54000 -1523758049:55500 -1523917524:57000 -1524106084:58500 -1524290437:60000 -1524464139:61500 -1524728732:63000 -1524905041:64500 -1525093135:66000 -1525239917:67500 -1525443579:69000 -1525663214:70500 -1525839621:72000 -1525989826:73500 -1526182919:75000 -1526437405:76500 -1526649137:78000 -1526812889:79500 -1526991726:81000 -1527184073:82500 -1527351889:84000 -1527567839:85500 -1527759754:87000 -1527916443:88500 -1528110008:90000 -1528285005:91500 -1528486806:93000 -1528666327:94500 -1528872096:96000 -1529015390:97500 -1529205809:99000 -1529384415:100500 -1529595764:102000 -1529770640:103500 -1529950955:105000 -1530115141:106500 -1530306273:108000 -1530491510:109500 -1530677550:111000 -1530823854:112500 -1531032372:114000 -1531175619:115500 -1531371373:117000 -1531541897:118500 -1531706629:120000 -1531888223:121500 -1532104373:123000 -1532314129:124500 -1532503060:126000 -1532663651:127500 -1532894128:129000 -1533095950:130500 -1533302631:132000 -1533464469:133500 -1533670723:135000 -1533833911:136500 -1534030841:138000 -1534203160:139500 -1534397055:141000 -1534577048:142500 -1534752236:144000 -1534931462:145500 -1535119263:147000 -1535300364:148500 -1535471540:150000 -1535640429:151500 -1535836082:153000 -1536059510:154500 -1536209710:156000 -1536366875:157500 -1536560444:159000 -1536749043:160500 -1536926345:162000 -1537105693:163500 -1537296613:165000 -1537501175:166500 -1537667740:168000 -1537844801:169500 -1538000228:171000 -1538199137:172500 -1538418406:174000 -1538612473:175500 -1538979696:177000 -1539147054:178500 -1539303989:180000 -1539488395:181500 -1539652212:183000 -1539819281:184500 -1539971301:186000 -1540146343:187500 -1540330288:189000 -1540505588:190500 -1540688044:192000 -1540869374:193500 -1541049379:195000 -1541223210:196500 -1541393586:198000 -1541577202:199500 -1541762094:201000 -1541909862:202500 -1542199063:204000 -1542399873:205500 -1542579333:207000 -1542763985:208500 -1542947442:210000 -1543124804:211500 -1543323933:213000 -1543489307:214500 -1543672244:216000 -1543837576:217500 -1544042420:219000 -1544222096:220500 -1544402628:222000 -1544546843:223500 -1544730464:225000 -1545134663:226500 -1545301874:228000 -1545488939:229500 -1545664263:231000 -1545834607:232500 -1546014630:234000 -1546192930:235500 -1546373750:237000 -1546556089:238500 -1546738764:240000 -1546917228:241500 -1547091360:243000 -1547272679:244500 -1547463907:246000 -1547636722:247500 -1547817060:249000 -1548001021:250500 -1548185375:252000 -1548380319:253500 -1548555267:255000 -1548741069:256500 -1548926544:258000 -1549140801:259500 -1549297081:261000 -1549478379:262500 -1549651888:264000 -1549860339:265500 -1550024455:267000 -1550217332:268500 -1551312389:270000 -1551527936:271500 -1551665288:273000 -1551836443:274500 -1552026339:276000 -1552218441:277500 -1552443760:279000 -1552680291:280500 -1552854334:282000 -1553030527:283500 -1553211359:285000 -1553385763:286500 -1553588198:288000 -1553760642:289500 -1553937158:291000 -1554121990:292500 -1554302691:294000 -1554479953:295500 -1554666762:297000 -1554850956:298500 -1555057081:300000 -1555228611:301500 -1555400592:303000 -1555615005:304500 -1555789135:306000 -1555995570:307500 -1556183867:309000 -1556362195:310500 -1556541232:312000 -1556728140:313500 -1556903453:315000 -1557065264:316500 -1557273415:318000 -1557443047:319500 -1557618850:321000 -1557798876:322500 -1557976530:324000 -1558172356:325500 -1558356032:327000 -1558534222:328500 -1558719934:330000 -1558892036:331500 -1559075695:333000 -1559253052:334500 -1559462339:336000 -1559647394:337500 -1559827424:339000 -1560002042:340500 -1560189126:342000 -1560343483:343500 -1560548477:345000 -1560709613:346500 -1560888640:348000 -1561072261:349500 -1561249189:351000 -1561433494:352500 -1561609875:354000 -1561789136:355500 -1561971530:357000 -1562146235:358500 -1562283612:360000 -1562536678:361500 -1562727970:363000 -1562896064:364500 -1563081360:366000 -1563222147:367500 -1563471753:369000 -1563648133:370500 -1563844968:372000 -1564019071:373500 -1564194349:375000 -1564378444:376500 -1564557884:378000 -1564733144:379500 -1564931656:381000 -1565088150:382500 -1565272766:384000 -1565457895:385500 -1565632566:387000 -1565824568:388500 -1565992971:390000 -1566155025:391500 -1566345274:393000 -1566534162:394500 -1566736618:396000 -1566937517:397500 -1567128136:399000 -1567296600:400500 -1567482630:402000 -1567671945:403500 -1567828904:405000 -1568061755:406500 -1568241437:408000 -1568413206:409500 -1568589427:411000 -1568777072:412500 -1568950797:414000 -1569140033:415500 -1569321139:417000 -1569497726:418500 -1569685524:420000 -1569858754:421500 -1570025222:423000 -1570195891:424500 -1570412169:426000 -1570568122:427500 -1570772965:429000 -1570968490:430500 -1571107236:432000 -1571359933:433500 -1571520970:435000 -1571737619:436500 -1571890574:438000 -1572104152:439500 -1572299391:441000 -1572483040:442500 -1572663772:444000 -1572839626:445500 -1573049256:447000 -1573229282:448500 -1573407580:450000 -1573589178:451500 -1573735333:453000 -1573840717:454500 -1574096272:456000 -1574280161:457500 -1574455892:459000 -1574604632:460500 -1574809987:462000 -1574975801:463500 -1575140569:465000 -1575422392:466500 -1575583824:468000 -1575763253:469500 -1575944350:471000 -1576125074:472500 -1576324269:474000 -1576508865:475500 -1576669612:477000 -1576891906:478500 -1577078563:480000 -1577265105:481500 -1577431370:483000 -1577744409:484500 -1577874268:486000 -1578038130:487500 -1578231375:489000 -1578439644:490500 -1578625982:492000 -1578808598:493500 -1578985283:495000 -1579175621:496500 -1579347774:498000 -1579517894:499500 -1579687667:501000 -1579868646:502500 -1580046838:504000 -1580240961:505500 -1580428207:507000 -1580572904:508500 -1580823996:510000 -1580994064:511500 -1581183924:513000 -1581351893:514500 -1581521085:516000 -1581702405:517500 -1581943619:519000 -1582098842:520500 -1582299537:522000 -1582480013:523500 -1582659742:525000 -1582839127:526500 -1583020057:528000 -1583266489:529500 -1583429819:531000 -1583615548:532500 -1583785190:534000 -1584011766:535500 -1584192961:537000 -1584342104:538500 -1584521327:540000 -1584706894:541500 -1584883565:543000 -1585062315:544500 -1585244138:546000 -1585427591:547500 -1585600165:549000 -1585784601:550500 -1585961031:552000 -1586147565:553500 -1586322716:555000 -1586513730:556500 -1586698639:558000 -1586878453:559500 -1587062131:561000 -1587234968:562500 -1587391529:564000 -1587591247:565500 -1587752262:567000 -1587969335:568500 -1588148503:570000 -1588405392:571500 -1588593609:573000 -1588778703:574500 -1588949467:576000 -1589172941:577500 -1589358899:579000 -1589536247:580500 -1589730950:582000 -1589882572:583500 -1590062931:585000 -1590237283:586500 -1590430792:588000 -1590599140:589500 -1590807968:591000 -1590987339:592500 -1591166304:594000 -1591348974:595500 -1591542069:597000 -1591723208:598500 -1591908870:600000 -1592060567:601500 -1592259549:603000 -1592465269:604500 -1592647205:606000 -1592828242:607500 -1593006687:609000 -1593201658:610500 -1593492855:612000 -1593636856:613500 -1593811224:615000 -1594004429:616500 -1594162422:618000 -1594348191:619500 -1594523256:621000 -1594685351:622500 -1594890677:624000 -1595073577:625500 -1595269373:627000 -1595477524:628500 -1595668392:630000 -1595867552:631500 -1596043173:633000 -1596209876:634500 -1596419711:636000 -1596600935:637500 -1596770710:639000 -1596979435:640500 -1597172685:642000 -1597347250:643500 -1597508807:645000 -1597698614:646500 -1597871525:648000 -1598058524:649500 -1598368966:651000 -1598552832:652500 -1598715002:654000 -1598902853:655500 -1599078705:657000 -1599253008:658500 -1599430407:660000 -1599636188:661500 -1599809533:663000 -1600001474:664500 diff --git a/src/assets/restore_heights_wownero_mainnet.txt b/src/assets/restore_heights_wownero_mainnet.txt new file mode 100644 index 0000000..f76b359 --- /dev/null +++ b/src/assets/restore_heights_wownero_mainnet.txt @@ -0,0 +1,479 @@ +1522624244:1 +1522919763:1500 +1523409727:3000 +1523960364:4500 +1524369547:6000 +1524784400:7500 +1525233663:9000 +1525687037:10500 +1526135584:12000 +1526578718:13500 +1527063859:15000 +1527518523:16500 +1527977555:18000 +1528436212:19500 +1528893646:21000 +1529347707:22500 +1529812899:24000 +1530272289:25500 +1530735091:27000 +1531195321:28500 +1531660804:30000 +1532117133:31500 +1532568099:33000 +1533015693:34500 +1533470854:36000 +1533923432:37500 +1534374443:39000 +1534823621:40500 +1535290349:42000 +1535735446:43500 +1536201310:45000 +1536655339:46500 +1537109771:48000 +1537565159:49500 +1538015344:51000 +1538470517:52500 +1538927269:54000 +1539379855:55500 +1539826869:57000 +1540311781:58500 +1540788117:60000 +1541297876:61500 +1541794302:63000 +1542407858:64500 +1543204218:66000 +1543955252:67500 +1544703247:69000 +1545372024:70500 +1546002226:72000 +1546636335:73500 +1547342810:75000 +1548268561:76500 +1548921502:78000 +1549481994:79500 +1550247894:81000 +1550743647:82500 +1551184199:84000 +1551626083:85500 +1552086272:87000 +1552546202:88500 +1552994646:90000 +1553451645:91500 +1553898976:93000 +1554352300:94500 +1554801655:96000 +1555254551:97500 +1555700170:99000 +1556151520:100500 +1556602014:102000 +1557057709:103500 +1557508808:105000 +1557961787:106500 +1558413175:108000 +1558860703:109500 +1559310651:111000 +1559759587:112500 +1560207825:114000 +1560635185:115500 +1561076902:117000 +1561514633:118500 +1561983210:120000 +1562435722:121500 +1562903313:123000 +1563367656:124500 +1563794760:126000 +1564249987:127500 +1564698967:129000 +1565154467:130500 +1565606876:132000 +1566053072:133500 +1566496455:135000 +1566940483:136500 +1567391114:138000 +1567840593:139500 +1568290979:141000 +1568739494:142500 +1569196321:144000 +1569643702:145500 +1570095074:147000 +1570533207:148500 +1570991907:150000 +1571447301:151500 +1571895478:153000 +1572343106:154500 +1572791579:156000 +1573241814:157500 +1573692641:159000 +1574137867:160500 +1574600312:162000 +1575051207:163500 +1575500955:165000 +1575953057:166500 +1576401859:168000 +1576850419:169500 +1577301553:171000 +1577753392:172500 +1578199780:174000 +1578655276:175500 +1579104342:177000 +1579549362:178500 +1580004525:180000 +1580451365:181500 +1580900062:183000 +1581350016:184500 +1581795609:186000 +1582251322:187500 +1582703447:189000 +1583152160:190500 +1583601824:192000 +1584051198:193500 +1584499159:195000 +1584949547:196500 +1585404000:198000 +1585843662:199500 +1586292852:201000 +1586738236:202500 +1587201986:204000 +1587663936:205500 +1588119101:207000 +1588586510:208500 +1589057972:210000 +1589520509:211500 +1589974638:213000 +1590425544:214500 +1590876865:216000 +1591326399:217500 +1591759684:219000 +1592226165:220500 +1592681388:222000 +1593141896:223500 +1593595859:225000 +1594048319:226500 +1594489197:228000 +1594955184:229500 +1595408732:231000 +1595854685:232500 +1596303095:234000 +1596732814:235500 +1597198383:237000 +1597650820:238500 +1598099448:240000 +1598553007:241500 +1599004645:243000 +1599459515:244500 +1599914532:246000 +1600357718:247500 +1600811447:249000 +1601257433:250500 +1601710572:252000 +1602154921:253500 +1609825674:279148 +1609816860:279048 +1610116800:280048 +1610420700:281048 +1610715120:282048 +1611017160:283048 +1611314940:284048 +1611616080:285048 +1611911760:286048 +1612211940:287048 +1612515660:288048 +1612810500:289048 +1613115540:290048 +1613414820:291048 +1613709300:292048 +1614008280:293048 +1614307380:294048 +1614603060:295048 +1614902280:296048 +1615204740:297048 +1615505100:298048 +1615807020:299048 +1616108820:300048 +1616402280:301048 +1616706720:302048 +1617003960:303048 +1617611100:305048 +1617911640:306048 +1618191900:307048 +1618522560:308048 +1618816620:309048 +1619098740:310048 +1619390520:311048 +1619695500:312048 +1619985120:313048 +1620290220:314048 +1620586260:315048 +1620885360:316048 +1621183620:317048 +1621482300:318048 +1621782840:319048 +1622079960:320048 +1622380260:321048 +1622678460:322048 +1622974380:323048 +1623269760:324048 +1623567420:325048 +1623869820:326048 +1624167180:327048 +1624473000:328048 +1624767600:329048 +1625065980:330048 +1625366940:331048 +1625439000:332048 +1625706420:333048 +1626101160:334048 +1626365940:335048 +1626660360:336048 +1626966840:337048 +1627231740:338048 +1627541700:339048 +1627810440:340048 +1628078820:341048 +1628406780:342048 +1628709420:343048 +1629011100:344048 +1629283260:345048 +1629582540:346048 +1629874620:347048 +1630168440:348048 +1630465980:349048 +1630756800:350048 +1631060460:351048 +1631393400:352048 +1631699460:353048 +1632012480:354048 +1632289920:355048 +1632602820:356048 +1632923220:357048 +1633203180:358048 +1633491000:359048 +1633811400:360048 +1634113140:361048 +1634430300:362048 +1634722260:363048 +1635035460:364048 +1635368760:365048 +1635639660:366048 +1635957840:367048 +1636245240:368048 +1636535820:369048 +1636863900:370048 +1637160360:371048 +1637457780:372048 +1637793240:373048 +1638062460:374048 +1638407580:375048 +1638675240:376048 +1638981360:377048 +1639273140:378048 +1639612740:379048 +1639928760:380048 +1640242500:381048 +1640530620:382048 +1640838000:383048 +1641136800:384048 +1641437400:385048 +1641716040:386048 +1642030680:387048 +1642330500:388048 +1642714260:389048 +1643040360:390048 +1643344560:391048 +1643612040:392048 +1643913360:393048 +1644223920:394048 +1644491820:395048 +1644794760:396048 +1645110660:397048 +1645379400:398048 +1645693500:399048 +1645981080:400048 +1646301360:401048 +1646576220:402048 +1646919420:403048 +1647208320:404048 +1647506640:405048 +1647768840:406048 +1648082520:407048 +1648391700:408048 +1648686240:409048 +1649002860:410048 +1649282820:411048 +1649599860:412048 +1649959980:413048 +1650248280:414048 +1650528840:415048 +1650809340:416048 +1651118280:417048 +1651432260:418048 +1651740360:419048 +1652031600:420048 +1652351400:421048 +1652639520:422048 +1652954640:423048 +1653252600:424048 +1653549840:425048 +1653862740:426048 +1654161060:427048 +1654461900:428048 +1654782600:429048 +1655076960:430048 +1655441820:431048 +1655740500:432048 +1656030240:433048 +1656324720:434048 +1656624060:435048 +1656925920:436048 +1657236840:437048 +1657526700:438048 +1657816740:439048 +1658135940:440048 +1658434440:441048 +1658715780:442048 +1659010080:443048 +1659318120:444048 +1659611040:445048 +1659914940:446048 +1660204260:447048 +1660505220:448048 +1660831740:449048 +1661114940:450048 +1661397720:451048 +1661708760:452048 +1661997180:453048 +1662335640:454048 +1662630120:455048 +1662908820:456048 +1663213380:457048 +1663501140:458048 +1663832400:459048 +1664109480:460048 +1664412600:461048 +1664724720:462048 +1665004620:463048 +1665305460:464048 +1665600480:465048 +1665894960:466048 +1666213620:467048 +1666527600:468048 +1666816380:469048 +1667123160:470048 +1667427180:471048 +1667720640:472048 +1668021000:473048 +1668334740:474048 +1668649440:475048 +1668946680:476048 +1669247100:477048 +1669560960:478048 +1669852800:479048 +1670164020:480048 +1670467860:481048 +1670767440:482048 +1671063480:483048 +1671363960:484048 +1671639900:485048 +1671950940:486048 +1672248180:487048 +1672566480:488048 +1672859400:489048 +1673179080:490048 +1673451120:491048 +1673759520:492048 +1674053100:493048 +1674374100:494048 +1674658440:495048 +1674978420:496048 +1675249380:497048 +1675559460:498048 +1675847160:499048 +1676178900:500048 +1676463600:501048 +1676782680:502048 +1677074640:503048 +1677385020:504048 +1677686160:505048 +1677996420:506048 +1678277700:507048 +1678564680:508048 +1678852920:509048 +1679178960:510048 +1679473500:511048 +1679780220:512048 +1680075120:513048 +1680415620:514048 +1680715500:515048 +1681014240:516048 +1681314240:517048 +1681628940:518048 +1681919940:519048 +1682226660:520048 +1682528460:521048 +1682838000:522048 +1683149040:523048 +1683448680:524048 +1683750540:525048 +1684050540:526048 +1684346940:527048 +1684659780:528048 +1684960560:529048 +1685261880:530048 +1685565420:531048 +1685865660:532048 +1686178020:533048 +1686480060:534048 +1686776820:535048 +1687078860:536048 +1687379580:537048 +1687685100:538048 +1687993320:539048 +1688293380:540048 +1688598420:541048 +1688898120:542048 +1689208500:543048 +1689503940:544048 +1689802800:545048 +1690109040:546048 +1690414320:547048 +1690721280:548048 +1691025480:549048 +1691325720:550048 +1691633940:551048 +1691931480:552048 +1692233280:553048 +1692532620:554048 +1692843420:555048 +1693147020:556048 +1693453140:557048 +1693749540:558048 +1694054460:559048 +1694348940:560048 +1694661120:561048 +1694961240:562048 +1695270600:563048 +1695572880:564048 +1695891600:565048 +1696201200:566048 +1696506300:567048 +1696833360:568048 +1697119860:569048 +1697424660:570048 +1697728620:571048 +1698030720:572048 +1698328680:573048 +1698640800:574048 +1698955800:575048 +1699261560:576048 +1699561560:577048 +1699873800:578048 +1700185680:579048 +1700481900:580048 +1700801820:581048 +1701103860:582048 +1701414900:583048 +1701721080:584048 +1702027260:585048 +1702332300:586048 +1702641960:587048 \ No newline at end of file diff --git a/src/assets/wowlet.1.gz b/src/assets/wowlet.1.gz new file mode 100644 index 0000000..af41738 Binary files /dev/null and b/src/assets/wowlet.1.gz differ diff --git a/src/assets/wowlet.1.md b/src/assets/wowlet.1.md new file mode 100644 index 0000000..9c71054 --- /dev/null +++ b/src/assets/wowlet.1.md @@ -0,0 +1,111 @@ +% WOWLET(1) wowlet 1.0 +% WOWlet +% March 2021 + +# NAME + +wowlet — Lightweight Wownero Wallet + +# SYNOPSIS + +**wowlet** [*OPTION*] + +# DESCRIPTION + +**WOWlet** is a free, open-source Wownero desktop wallet for Linux with ports for Mac OS and Windows. + +# Options + +**-h**, **\--help** + +: Displays usage information. + +**-v**, **\--version** + +: Displays the current version number. + +**\--use-local-tor** + +: Use system wide installed Tor instead of the bundled. + +**\--tor-port** + +: Port of running Tor instance. + +**\--debug** + +: Run program in debug mode. + +**\--quiet** + +: Limit console output. + +**\--use-local-tor** + +: Use system wide installed Tor instead of the bundled. + +**\--stagenet** + +: Stagenet is for development purposes only. + +**\--testnet** + +: Testnet is for development purposes only. + +**\--wallet-file** + +: Path to wallet keys file. + +**\--password** + +: Wallet password (escape/quote as needed). + +**\--daemon-address** + +: Daemon address (IPv4:port). + +**\--export-contacts** + +: Output wallet contacts as CSV to specified path. + +**\--export-txhistory** + +: Output wallet transaction history as CSV to specified path. + +**\--daemon** + +: Start wowlet in the background and start a websocket server (IPv4:port). + +**\--daemon-password** + +: Password for connecting to the wowlet websocket service. + +# EXAMPLES + +**wowlet -v | \--version** + +: Displays software version and then exits. + +**wowlet -h | \--help** + +: Displays software usage information and then exits. + +**wowlet \--daemon 127.0.0.1:1234 \--daemon-password "sekrit"** + +: Wallet starts in the background and exposes a websocket port that you can connect to using a websocket client. + +# BUGS + +See Git Issues: + +# COPYRIGHT + +(c) 2020-2021 The Monero Project. + +License: BSD-3-clause. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/calcwidget.cpp b/src/calcwidget.cpp index 89ab230..9274813 100644 --- a/src/calcwidget.cpp +++ b/src/calcwidget.cpp @@ -1,12 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include "calcwidget.h" #include "ui_calcwidget.h" -#include "utils/config.h" #include "mainwindow.h" +#include "components.h" +#include "utils/ColorScheme.h" CalcWidget::CalcWidget(QWidget *parent) : QWidget(parent), @@ -16,8 +17,7 @@ CalcWidget::CalcWidget(QWidget *parent) : m_ctx = MainWindow::getContext(); ui->imageExchange->setBackgroundRole(QPalette::Base); - QPixmap pm(":/assets/images/exchange.png"); - ui->imageExchange->setPixmap(pm); + ui->imageExchange->setAssets(":/assets/images/exchange.png", ":/assets/images/exchange_white.png"); ui->imageExchange->setScaledContents(true); ui->imageExchange->setFixedSize(26, 26); @@ -123,7 +123,7 @@ void CalcWidget::initComboBox() { ui->comboCalcFrom->addItems(marketsKeys); ui->comboCalcFrom->insertSeparator(marketsKeys.count()); ui->comboCalcFrom->addItems(ratesKeys); - ui->comboCalcFrom->setCurrentIndex(marketsKeys.indexOf("XMR")); + ui->comboCalcFrom->setCurrentIndex(marketsKeys.indexOf("WOW")); ui->comboCalcTo->addItems(marketsKeys); ui->comboCalcTo->insertSeparator(marketsKeys.count()); @@ -135,6 +135,10 @@ void CalcWidget::initComboBox() { this->m_comboBoxInit = true; } +void CalcWidget::skinChanged() { + ui->imageExchange->setMode(ColorScheme::hasDarkBackground(this)); +} + CalcWidget::~CalcWidget() { delete ui; } diff --git a/src/calcwidget.h b/src/calcwidget.h index 95af5f9..42f94bf 100644 --- a/src/calcwidget.h +++ b/src/calcwidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef CALC_H #define CALC_H @@ -17,7 +17,7 @@ Q_OBJECT public: explicit CalcWidget(QWidget *parent = nullptr); - ~CalcWidget(); + ~CalcWidget() override; signals: void closed(); @@ -28,6 +28,7 @@ public slots: void toComboChanged(const QString& data); void initFiat(); void initCrypto(); + void skinChanged(); private: Ui::CalcWidget *ui; diff --git a/src/calcwidget.ui b/src/calcwidget.ui index 674516b..dbd49bb 100644 --- a/src/calcwidget.ui +++ b/src/calcwidget.ui @@ -84,7 +84,7 @@ - + exchange image @@ -159,6 +159,13 @@ + + + DoublePixmapLabel + QLabel +
components.h
+
+
diff --git a/src/calcwindow.cpp b/src/calcwindow.cpp index f422c03..ba6dff1 100644 --- a/src/calcwindow.cpp +++ b/src/calcwindow.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "calcwindow.h" #include "mainwindow.h" @@ -14,7 +14,7 @@ CalcWindow::CalcWindow(QWidget *parent) : this->setWindowFlags(flags|Qt::WindowStaysOnTopHint); // on top ui->setupUi(this); - this->setWindowIcon(QIcon("://assets/images/coldcard.png")); + this->setWindowIcon(QIcon("://assets/images/gnome-calc.png")); connect(AppContext::prices, &Prices::fiatPricesUpdated, this, &CalcWindow::initFiat); connect(AppContext::prices, &Prices::cryptoPricesUpdated, this, &CalcWindow::initCrypto); diff --git a/src/calcwindow.h b/src/calcwindow.h index 2b5b9ac..8d6b6ed 100644 --- a/src/calcwindow.h +++ b/src/calcwindow.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef CalcWindow_H #define CalcWindow_H diff --git a/src/cli.cpp b/src/cli.cpp index a149e16..80a90e3 100644 --- a/src/cli.cpp +++ b/src/cli.cpp @@ -1,20 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "cli.h" +// Copyright (c) 2020-2021, The Monero Project. // libwalletqt -#include "Wallet.h" #include "libwalletqt/TransactionHistory.h" -#include "libwalletqt/SubaddressAccount.h" -#include "libwalletqt/Subaddress.h" -#include "libwalletqt/AddressBook.h" -#include "libwalletqt/Coins.h" #include "model/AddressBookModel.h" #include "model/TransactionHistoryModel.h" -#include "model/SubaddressAccountModel.h" -#include "model/SubaddressModel.h" -#include "model/CoinsModel.h" + +#include "cli.h" CLI::CLI(AppContext *ctx, QObject *parent) : QObject(parent), @@ -30,6 +22,8 @@ void CLI::run() { if(!ctx->cmdargs->isSet("wallet-file")) return this->finishedError("--wallet-file argument missing"); if(!ctx->cmdargs->isSet("password")) return this->finishedError("--password argument missing"); ctx->onOpenWallet(ctx->cmdargs->value("wallet-file"), ctx->cmdargs->value("password")); + } else if(mode == CLIMode::CLIDaemonize) { + m_wsServer = new WSServer(ctx, QHostAddress(this->backgroundWebsocketAddress), this->backgroundWebsocketPort, this->backgroundWebsocketPassword, true, this); } } diff --git a/src/cli.h b/src/cli.h index 597c557..2b18722 100644 --- a/src/cli.h +++ b/src/cli.h @@ -1,15 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CLI_H -#define FEATHER_CLI_H +#ifndef WOWLET_CLI_H +#define WOWLET_CLI_H #include #include "appcontext.h" +#include enum CLIMode { CLIModeExportContacts, - CLIModeExportTxHistory + CLIModeExportTxHistory, + CLIDaemonize }; class CLI : public QObject @@ -20,6 +22,10 @@ public: explicit CLI(AppContext *ctx, QObject *parent = nullptr); ~CLI() override; + QString backgroundWebsocketAddress; + quint16 backgroundWebsocketPort; + QString backgroundWebsocketPassword; + public slots: void run(); @@ -30,6 +36,7 @@ public slots: private: AppContext *ctx; + WSServer *m_wsServer; private slots: void finished(const QString &msg); @@ -39,4 +46,4 @@ signals: void closeApplication(); }; -#endif //FEATHER_CLI_H +#endif //WOWLET_CLI_H diff --git a/src/coinswidget.cpp b/src/coinswidget.cpp index 180d93d..21934a5 100644 --- a/src/coinswidget.cpp +++ b/src/coinswidget.cpp @@ -1,19 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "coinswidget.h" #include "ui_coinswidget.h" -#include "model/ModelUtils.h" -#include "utils/utils.h" #include "dialog/outputinfodialog.h" #include "dialog/outputsweepdialog.h" #include "mainwindow.h" #include -#include -#include -#include -#include #include CoinsWidget::CoinsWidget(QWidget *parent) @@ -67,7 +61,7 @@ CoinsWidget::CoinsWidget(QWidget *parent) void CoinsWidget::setModel(CoinsModel * model, Coins * coins) { m_coins = coins; m_model = model; - m_proxyModel = new CoinsProxyModel(this); + m_proxyModel = new CoinsProxyModel(this, m_coins); m_proxyModel->setSourceModel(m_model); ui->coins->setModel(m_proxyModel); ui->coins->setColumnHidden(CoinsModel::Spent, true); @@ -141,7 +135,8 @@ void CoinsWidget::setShowSpent(bool show) void CoinsWidget::freezeOutput() { QModelIndex index = ui->coins->currentIndex(); - emit freeze(m_proxyModel->mapToSource(index).row()); + QVector indexes = {m_proxyModel->mapToSource(index).row()}; + emit freeze(indexes); } void CoinsWidget::freezeAllSelected() { @@ -151,12 +146,13 @@ void CoinsWidget::freezeAllSelected() { for (QModelIndex index: list) { indexes.push_back(m_proxyModel->mapToSource(index).row()); // todo: will segfault if index get invalidated } - emit freezeMulti(indexes); + emit freeze(indexes); } void CoinsWidget::thawOutput() { QModelIndex index = ui->coins->currentIndex(); - emit thaw(m_proxyModel->mapToSource(index).row()); + QVector indexes = {m_proxyModel->mapToSource(index).row()}; + emit thaw(indexes); } void CoinsWidget::thawAllSelected() { @@ -166,7 +162,7 @@ void CoinsWidget::thawAllSelected() { for (QModelIndex index: list) { indexes.push_back(m_proxyModel->mapToSource(index).row()); } - emit thawMulti(indexes); + emit thaw(indexes); } void CoinsWidget::viewOutput() { @@ -212,6 +208,10 @@ void CoinsWidget::onSweepOutput() { dialog->deleteLater(); } +void CoinsWidget::resetModel() { + ui->coins->setModel(nullptr); +} + void CoinsWidget::copy(copyField field) { QModelIndex index = ui->coins->currentIndex(); int row = m_proxyModel->mapToSource(index).row(); diff --git a/src/coinswidget.h b/src/coinswidget.h index 412b55c..7464300 100644 --- a/src/coinswidget.h +++ b/src/coinswidget.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_COINSWIDGET_H -#define FEATHER_COINSWIDGET_H +#ifndef WOWLET_COINSWIDGET_H +#define WOWLET_COINSWIDGET_H #include "appcontext.h" #include "model/CoinsModel.h" @@ -25,6 +25,9 @@ public: void setModel(CoinsModel * model, Coins * coins); ~CoinsWidget() override; +public slots: + void resetModel(); + private slots: void showHeaderMenu(const QPoint& position); void setShowSpent(bool show); @@ -36,10 +39,8 @@ private slots: void onSweepOutput(); signals: - void freeze(int index); - void freezeMulti(QVector); - void thaw(int index); - void thawMulti(QVector); + void freeze(QVector indexes); + void thaw(QVector indexes); void sweepOutput(const QString &keyImage, const QString &address, bool isChurn, int outputs); private: @@ -75,4 +76,4 @@ private: }; -#endif //FEATHER_COINSWIDGET_H +#endif //WOWLET_COINSWIDGET_H diff --git a/src/components.cpp b/src/components.cpp index 30db7f8..4e02c65 100644 --- a/src/components.cpp +++ b/src/components.cpp @@ -1,10 +1,28 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "components.h" #include +DoublePixmapLabel::DoublePixmapLabel(QWidget *parent) + : QLabel(parent) +{} + +void DoublePixmapLabel::setAssets(const QString &firstAsset, const QString &secondAsset) +{ + m_first.load(firstAsset); + m_second.load(secondAsset); + this->setPixmap(m_first); +} + +void DoublePixmapLabel::setMode(bool mode) { + if (mode != m_mode) { + this->setPixmap(mode ? m_second : m_first); + } + m_mode = mode; +} + StatusBarButton::StatusBarButton(const QIcon &icon, const QString &tooltip, QWidget *parent) : QPushButton(parent) { setIcon(icon); setToolTip(tooltip); diff --git a/src/components.h b/src/components.h index 5a9772f..546c27b 100644 --- a/src/components.h +++ b/src/components.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef COMP_H #define COMP_H @@ -11,6 +11,23 @@ #include #include +class DoublePixmapLabel : public QLabel +{ +Q_OBJECT + +public: + explicit DoublePixmapLabel(QWidget *parent = nullptr); + +public slots: + void setAssets(const QString &firstAsset, const QString &secondAsset); + void setMode(bool mode); + +private: + bool m_mode = false; + QPixmap m_first; + QPixmap m_second; +}; + class StatusBarButton : public QPushButton { Q_OBJECT diff --git a/src/contactswidget.cpp b/src/contactswidget.cpp index 005413f..a723da9 100644 --- a/src/contactswidget.cpp +++ b/src/contactswidget.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "contactswidget.h" #include "ui_contactswidget.h" @@ -32,17 +32,26 @@ ContactsWidget::ContactsWidget(QWidget *parent) : this->newContact(); }); - // row context menu - m_rowMenu = new QMenu(ui->contacts); - m_rowMenu->addAction(QIcon(":/assets/images/copy.png"), "Copy address", this, &ContactsWidget::copyAddress); - m_rowMenu->addAction(QIcon(":/assets/images/copy.png"), "Copy name", this, &ContactsWidget::copyName); - m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo); - m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact); + connect(ui->btn_addContact, &QPushButton::pressed, [this]{ + this->newContact(); + }); connect(ui->contacts, &QTreeView::customContextMenuRequested, [=](const QPoint & point){ QModelIndex index = ui->contacts->indexAt(point); if (index.isValid()) { + auto username = index.model()->data(index.siblingAtColumn(AddressBookModel::Description), Qt::UserRole).toString(); + + m_rowMenu = new QMenu(ui->contacts); + if(username.contains("(yp)")) + m_rowMenu->addAction(QIcon(":/assets/images/network.png"), "Visit user's YellWOWPage", this, &ContactsWidget::visitYellowPage); + + m_rowMenu->addAction(QIcon(":/assets/images/copy.png"), "Copy address", this, &ContactsWidget::copyAddress); + m_rowMenu->addAction(QIcon(":/assets/images/copy.png"), "Copy name", this, &ContactsWidget::copyName); + m_rowMenu->addAction("Pay to", this, &ContactsWidget::payTo); + m_rowMenu->addAction("Delete", this, &ContactsWidget::deleteContact); + m_rowMenu->exec(ui->contacts->viewport()->mapToGlobal(point)); + m_rowMenu->deleteLater(); } else { m_contextMenu->exec(ui->contacts->viewport()->mapToGlobal(point)); @@ -52,6 +61,68 @@ ContactsWidget::ContactsWidget(QWidget *parent) : connect(ui->search, &QLineEdit::textChanged, this, &ContactsWidget::setSearchFilter); } +QMap ContactsWidget::data() { + auto rtn = QMap(); + for (int i = 0; i < m_ctx->currentWallet->addressBook()->count(); i++) { + m_ctx->currentWallet->addressBook()->getRow(i, [&rtn](const AddressBookInfo &entry) { + rtn[entry.description()] = entry.address(); + }); + } + return rtn; +} + +unsigned int ContactsWidget::rowIndex(const QString &name) { + // name -> row index lookup + int result = -1; + for (int i = 0; i < m_ctx->currentWallet->addressBook()->count(); i++) { + m_ctx->currentWallet->addressBook()->getRow(i, [i, name, &result](const AddressBookInfo &entry) { + if(entry.description() == name) result = i; + return; + }); + + if(result != -1) + return result; + } + return result; +} + +void ContactsWidget::loadYellowPages() { + if (m_ctx->currentWallet == nullptr || m_ctx->yellowPagesData.empty()) + return; + + auto contacts = this->data(); + for (auto item: m_ctx->yellowPagesData) { + auto obj = item.toObject(); + const auto username = QString("%1 (yp)").arg(obj.value("username").toString()); + const auto address = obj.value("address").toString(); + + if(contacts.contains(username)) { + if(contacts[username] == address) continue; + + // update the address + auto idx = this->rowIndex(username); + if(idx == -1) continue; + m_model->deleteRow((int)idx); + } + + bool addressValid = WalletManager::addressValid(address, m_ctx->currentWallet->nettype()); + if (!addressValid) { + continue; + } + + m_ctx->currentWallet->addressBook()->addRow(address, "", username); + } +} + +void ContactsWidget::visitYellowPage() { + auto index = ui->contacts->currentIndex(); + auto username = index.model()->data( + index.siblingAtColumn(AddressBookModel::Description), + Qt::UserRole).toString(); + username = username.replace(" (yp)", "").trimmed(); + Utils::externalLinkWarning(this, QString("https://yellow.wownero.com/user/%1").arg(username)); +} + void ContactsWidget::copyAddress() { QModelIndex index = ui->contacts->currentIndex(); ModelUtils::copyColumn(&index, AddressBookModel::Address); @@ -90,6 +161,11 @@ void ContactsWidget::setSearchFilter(const QString &filter) { m_proxyModel->setSearchFilter(filter); } +void ContactsWidget::resetModel() +{ + ui->contacts->setModel(nullptr); +} + void ContactsWidget::showHeaderMenu(const QPoint& position) { m_showFullAddressesAction->setChecked(m_model->isShowFullAddresses()); @@ -133,7 +209,6 @@ void ContactsWidget::newContact(QString address, QString name) } m_ctx->currentWallet->addressBook()->addRow(address, "", name); - m_ctx->storeWallet(); } void ContactsWidget::deleteContact() diff --git a/src/contactswidget.h b/src/contactswidget.h index 9d76bd5..ac41a32 100644 --- a/src/contactswidget.h +++ b/src/contactswidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef CONTACTSWIDGET_H #define CONTACTSWIDGET_H @@ -22,6 +22,7 @@ class ContactsWidget : public QWidget public: explicit ContactsWidget(QWidget *parent = nullptr); void setModel(AddressBookModel * model); + QMap data(); ~ContactsWidget() override; public slots: @@ -30,8 +31,11 @@ public slots: void payTo(); void newContact(QString address = "", QString name = ""); void deleteContact(); + void visitYellowPage(); void setShowFullAddresses(bool show); void setSearchFilter(const QString &filter); + void resetModel(); + void loadYellowPages(); signals: void fillAddress(QString &address); @@ -49,6 +53,8 @@ private: QMenu *m_headerMenu; AddressBookModel * m_model; AddressBookProxyModel * m_proxyModel; + + unsigned int rowIndex(const QString &name); }; #endif // CONTACTSWIDGET_H diff --git a/src/contactswidget.ui b/src/contactswidget.ui index 69151e6..f40a8f4 100644 --- a/src/contactswidget.ui +++ b/src/contactswidget.ui @@ -6,17 +6,14 @@ 0 0 - 589 - 416 + 310 + 283 Form - - - 9 - + 0 @@ -29,14 +26,38 @@ 0 - - - - Search contacts... + + 9 + + + + + 9 - + + + + Search contacts... + + + + + + + Qt::Vertical + + + + + + + New contact + + + + - + false diff --git a/src/dialog/WalletCacheDebugDialog.cpp b/src/dialog/WalletCacheDebugDialog.cpp new file mode 100644 index 0000000..b3b9dc8 --- /dev/null +++ b/src/dialog/WalletCacheDebugDialog.cpp @@ -0,0 +1,97 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include "WalletCacheDebugDialog.h" +#include "ui_WalletCacheDebugDialog.h" +#include "model/ModelUtils.h" + +#include + +WalletCacheDebugDialog::WalletCacheDebugDialog(AppContext *ctx, QWidget *parent) + : QDialog(parent) + , m_ctx(ctx) + , ui(new Ui::WalletCacheDebugDialog) +{ + ui->setupUi(this); + + ui->output->setFont(ModelUtils::getMonospaceFont()); + + connect(ui->m_blockchain, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printBlockchain()); + }); + + connect(ui->m_transfers, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printTransfers()); + }); + + connect(ui->m_unconfirmed_payments, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printUnconfirmedPayments()); + }); + + connect(ui->m_confirmed_txs, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printConfirmedTransferDetails()); + }); + + connect(ui->m_unconfirmed_txs, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printUnconfirmedTransferDetails()); + }); + + connect(ui->m_payments, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printPayments()); + }); + + connect(ui->m_pub_keys, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printPubKeys()); + }); + + connect(ui->m_tx_notes, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printTxNotes()); + }); + + connect(ui->m_subaddresses, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printSubaddresses()); + }); + + connect(ui->m_subaddress_labels, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printSubaddressLabels()); + }); + + connect(ui->m_additional_tx_keys, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printAdditionalTxKeys()); + }); + + connect(ui->m_attributes, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printAttributes()); + }); + + connect(ui->m_key_images, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printKeyImages()); + }); + + connect(ui->m_account_tags, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printAccountTags()); + }); + + connect(ui->m_tx_keys, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printTxKeys()); + }); + + connect(ui->m_address_book, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printAddressBook()); + }); + + connect(ui->m_scanned_pool_txs, &QRadioButton::pressed, [this]{ + this->setOutput(m_ctx->currentWallet->printScannedPoolTxs()); + }); + + this->adjustSize(); +} + +void WalletCacheDebugDialog::setOutput(const QString &output) { + ui->output->setPlainText(output); +} + +WalletCacheDebugDialog::~WalletCacheDebugDialog() { + delete ui; +} + diff --git a/src/dialog/WalletCacheDebugDialog.h b/src/dialog/WalletCacheDebugDialog.h new file mode 100644 index 0000000..bd22a84 --- /dev/null +++ b/src/dialog/WalletCacheDebugDialog.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_WALLETCACHEDEBUGDIALOG_H +#define WOWLET_WALLETCACHEDEBUGDIALOG_H + +#include +#include "appcontext.h" + +namespace Ui { + class WalletCacheDebugDialog; +} + +class WalletCacheDebugDialog : public QDialog +{ +Q_OBJECT + +public: + explicit WalletCacheDebugDialog(AppContext *ctx, QWidget *parent = nullptr); + ~WalletCacheDebugDialog() override; + +private: + void setOutput(const QString &output); + Ui::WalletCacheDebugDialog *ui; + AppContext *m_ctx; +}; + + + +#endif //WOWLET_WALLETCACHEDEBUGDIALOG_H diff --git a/src/dialog/WalletCacheDebugDialog.ui b/src/dialog/WalletCacheDebugDialog.ui new file mode 100644 index 0000000..4138a2b --- /dev/null +++ b/src/dialog/WalletCacheDebugDialog.ui @@ -0,0 +1,212 @@ + + + WalletCacheDebugDialog + + + + 0 + 0 + 1423 + 814 + + + + Wallet Cache Debug + + + + + + + 500 + 0 + + + + true + + + + + + + + + + + m_blockchain + + + + + + + m_transfers + + + + + + + m_key_images + + + + + + + m_pub_keys + + + + + + + m_address_book + + + + + + + + + + + m_unconfirmed_payments + + + + + + + m_payments + + + + + + + m_unconfirmed_txs + + + + + + + m_confirmed_txs + + + + + + + m_tx_keys + + + + + + + m_additional_tx_keys + + + + + + + + + + + m_tx_notes + + + + + + + m_scanned_pool_txs + + + + + + + m_subaddresses + + + + + + + m_subaddress_labels + + + + + + + m_account_tags + + + + + + + m_attributes + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + WalletCacheDebugDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + WalletCacheDebugDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/dialog/aboutdialog.cpp b/src/dialog/aboutdialog.cpp index 5563425..6fb6fa5 100644 --- a/src/dialog/aboutdialog.cpp +++ b/src/dialog/aboutdialog.cpp @@ -1,10 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "aboutdialog.h" #include "ui_aboutdialog.h" #include "utils/utils.h" -#include "config-feather.h" +#include "config-wowlet.h" AboutDialog::AboutDialog(QWidget *parent) : QDialog(parent) @@ -12,13 +12,13 @@ AboutDialog::AboutDialog(QWidget *parent) { ui->setupUi(this); this->setWindowIcon(QIcon("://assets/images/appicons/64x64.png")); - // cute fox (c) Diego "rehrar" Salazar :-D - QPixmap p(":assets/images/cutexmrfox.png"); - ui->aboutImage->setPixmap(p.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + + QPixmap p(":assets/images/credits.jpg"); + ui->aboutImage->setPixmap(p.scaled(800, 600, Qt::KeepAspectRatio, Qt::SmoothTransformation)); auto about = Utils::fileOpenQRC(":assets/about.txt"); auto about_text = Utils::barrayToString(about); - about_text = about_text.replace("", FEATHER_VERSION); - about_text = about_text.replace("", FEATHER_BRANCH); + about_text = about_text.replace("", WOWLET_VERSION); + about_text = about_text.replace("", WOWLET_BRANCH); about_text = about_text.replace("", QString::number(QDate::currentDate().year())); ui->copyrightText->setPlainText(about_text); @@ -26,28 +26,14 @@ AboutDialog::AboutDialog(QWidget *parent) auto ack_text = Utils::barrayToString(ack); ui->ackText->setText(ack_text); - auto sm = QApplication::font(); - auto font = QApplication::font(); - sm.setPointSize(sm.pointSize() - 2); - this->m_model = new QStandardItemModel(this); - this->m_model->setHorizontalHeaderItem(0, Utils::qStandardItem("Name", sm)); - this->m_model->setHorizontalHeaderItem(1, Utils::qStandardItem("Email", sm)); + m_model = new QStringListModel(this); + + QString contributors = Utils::barrayToString(Utils::fileOpenQRC(":assets/contributors.txt")); + QStringList contributor_list = contributors.split("\n"); + m_model->setStringList(contributor_list); + + ui->authorView->setHeaderHidden(true); ui->authorView->setModel(this->m_model); - - int i = 0; - auto contributors = Utils::barrayToString(Utils::fileOpenQRC(":assets/contributors.txt")); - for(const auto &line: contributors.split("\n")){ - // too lazy for regex #sorry #notsorry - auto name = line.left(line.indexOf("<")).trimmed(); - auto nameItem = Utils::qStandardItem(name, font); - auto email = line.mid(line.indexOf("<")+1, line.length()).replace(">", "").trimmed(); - auto emailItem = Utils::qStandardItem(email, font); - - this->m_model->setItem(i, 0, nameItem); - this->m_model->setItem(i, 1, emailItem); - i++; - } - ui->authorView->header()->setSectionResizeMode(QHeaderView::Stretch); this->adjustSize(); diff --git a/src/dialog/aboutdialog.h b/src/dialog/aboutdialog.h index 6dbce29..e7ce12c 100644 --- a/src/dialog/aboutdialog.h +++ b/src/dialog/aboutdialog.h @@ -1,11 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef ABOUT_H #define ABOUT_H #include -#include +#include #include namespace Ui { @@ -21,7 +21,7 @@ public: ~AboutDialog() override; private: - QStandardItemModel *m_model; + QStringListModel *m_model; Ui::AboutDialog *ui; }; diff --git a/src/dialog/aboutdialog.ui b/src/dialog/aboutdialog.ui index 84f2a76..f928be0 100644 --- a/src/dialog/aboutdialog.ui +++ b/src/dialog/aboutdialog.ui @@ -25,9 +25,9 @@ 0 - + - Feather + WOWlet @@ -43,7 +43,7 @@ - a free, open-source Monero wallet + a free, open-source Wownero wallet Qt::AlignCenter diff --git a/src/dialog/balancedialog.cpp b/src/dialog/balancedialog.cpp index 4eeda35..0d13121 100644 --- a/src/dialog/balancedialog.cpp +++ b/src/dialog/balancedialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "balancedialog.h" #include "ui_balancedialog.h" diff --git a/src/dialog/balancedialog.h b/src/dialog/balancedialog.h index d28dd1c..ee11724 100644 --- a/src/dialog/balancedialog.h +++ b/src/dialog/balancedialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_BALANCEDIALOG_H -#define FEATHER_BALANCEDIALOG_H +#ifndef WOWLET_BALANCEDIALOG_H +#define WOWLET_BALANCEDIALOG_H #include "libwalletqt/Wallet.h" @@ -24,4 +24,4 @@ private: Ui::BalanceDialog *ui; }; -#endif //FEATHER_BALANCEDIALOG_H +#endif //WOWLET_BALANCEDIALOG_H diff --git a/src/dialog/broadcasttxdialog.cpp b/src/dialog/broadcasttxdialog.cpp index 71f0f6a..33c73b6 100644 --- a/src/dialog/broadcasttxdialog.cpp +++ b/src/dialog/broadcasttxdialog.cpp @@ -1,9 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "broadcasttxdialog.h" #include "ui_broadcasttxdialog.h" -#include "utils/nodes.h" #include diff --git a/src/dialog/broadcasttxdialog.h b/src/dialog/broadcasttxdialog.h index 9917ed2..a7553ae 100644 --- a/src/dialog/broadcasttxdialog.h +++ b/src/dialog/broadcasttxdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_BROADCASTTXDIALOG_H -#define FEATHER_BROADCASTTXDIALOG_H +#ifndef WOWLET_BROADCASTTXDIALOG_H +#define WOWLET_BROADCASTTXDIALOG_H #include #include "appcontext.h" @@ -32,4 +32,4 @@ private: }; -#endif //FEATHER_BROADCASTTXDIALOG_H +#endif //WOWLET_BROADCASTTXDIALOG_H diff --git a/src/dialog/contactsdialog.cpp b/src/dialog/contactsdialog.cpp index 0ef59a4..455a265 100644 --- a/src/dialog/contactsdialog.cpp +++ b/src/dialog/contactsdialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ui_contactsdialog.h" #include "contactsdialog.h" diff --git a/src/dialog/contactsdialog.h b/src/dialog/contactsdialog.h index 2aa9ab1..6c89b74 100644 --- a/src/dialog/contactsdialog.h +++ b/src/dialog/contactsdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CONTACTSDIALOG_H -#define FEATHER_CONTACTSDIALOG_H +#ifndef WOWLET_CONTACTSDIALOG_H +#define WOWLET_CONTACTSDIALOG_H #include @@ -28,4 +28,4 @@ private: QString m_name; }; -#endif //FEATHER_CONTACTSDIALOG_H +#endif //WOWLET_CONTACTSDIALOG_H diff --git a/src/dialog/debuginfodialog.cpp b/src/dialog/debuginfodialog.cpp index 44119dc..409c242 100644 --- a/src/dialog/debuginfodialog.cpp +++ b/src/dialog/debuginfodialog.cpp @@ -1,13 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "debuginfodialog.h" #include "ui_debuginfodialog.h" -#include "config-feather.h" -#include "utils/utils.h" - -#include -#include +#include "config-wowlet.h" DebugInfoDialog::DebugInfoDialog(AppContext *ctx, QWidget *parent) : QDialog(parent) @@ -44,7 +40,7 @@ void DebugInfoDialog::updateInfo() { else torStatus = "Unknown"; - ui->label_featherVersion->setText(QString("%1-%2").arg(FEATHER_VERSION, FEATHER_BRANCH)); + ui->label_wowletVersion->setText(QString("%1-%2").arg(WOWLET_VERSION, WOWLET_BRANCH)); ui->label_moneroVersion->setText(QString("%1-%2").arg(MONERO_VERSION, MONERO_BRANCH)); ui->label_walletHeight->setText(QString::number(m_ctx->currentWallet->blockChainHeight())); @@ -54,13 +50,14 @@ void DebugInfoDialog::updateInfo() { ui->label_synchronized->setText(m_ctx->currentWallet->synchronized() ? "True" : "False"); auto node = m_ctx->nodes->connection(); + ui->label_websocketURL->setText(m_ctx->backendWSUrl); ui->label_remoteNode->setText(node.full); ui->label_walletStatus->setText(this->statusToString(m_ctx->currentWallet->connectionStatus())); ui->label_torStatus->setText(torStatus); ui->label_websocketStatus->setText(Utils::QtEnumToString(m_ctx->ws->webSocket.state()).remove("State")); ui->label_netType->setText(Utils::QtEnumToString(m_ctx->currentWallet->nettype())); - ui->label_seedType->setText(m_ctx->currentWallet->getCacheAttribute("feather.seed").isEmpty() ? "25 word" : "14 word"); + ui->label_seedType->setText(m_ctx->currentWallet->getCacheAttribute("wowlet.seed").isEmpty() ? "25 word" : "14 word"); ui->label_viewOnly->setText(m_ctx->currentWallet->viewOnly() ? "True" : "False"); ui->label_primaryOnly->setText(m_ctx->currentWallet->balance(0) == m_ctx->currentWallet->balanceAll() ? "True" : "False"); @@ -68,6 +65,9 @@ void DebugInfoDialog::updateInfo() { if (m_ctx->isTails) { os = QString("Tails %1").arg(TailsOS::version()); } + if (m_ctx->isWhonix) { + os = QString("Whonix %1").arg(WhonixOS::version()); + } ui->label_OS->setText(os); ui->label_timestamp->setText(QString::number(QDateTime::currentSecsSinceEpoch())); } @@ -90,8 +90,8 @@ QString DebugInfoDialog::statusToString(Wallet::ConnectionStatus status) { void DebugInfoDialog::copyToClipboad() { // Two spaces at the end of each line are for newlines in Markdown QString text = ""; - text += QString("Feather version: %1 \n").arg(ui->label_featherVersion->text()); - text += QString("Monero version: %1 \n").arg(ui->label_moneroVersion->text()); + text += QString("WOWlet version: %1 \n").arg(ui->label_wowletVersion->text()); + text += QString("Wownero version: %1 \n").arg(ui->label_moneroVersion->text()); text += QString("Wallet height: %1 \n").arg(ui->label_walletHeight->text()); text += QString("Daemon height: %1 \n").arg(ui->label_daemonHeight->text()); @@ -102,11 +102,13 @@ void DebugInfoDialog::copyToClipboad() { text += QString("Remote node: %1 \n").arg(ui->label_remoteNode->text()); text += QString("Wallet status: %1 \n").arg(ui->label_walletStatus->text()); text += QString("Tor status: %1 \n").arg(ui->label_torStatus->text()); + text += QString("Websocket URL: %1 \n").arg(ui->label_websocketURL->text()); text += QString("Websocket status: %1 \n").arg(ui->label_websocketStatus->text()); text += QString("Network type: %1 \n").arg(ui->label_netType->text()); text += QString("Seed type: %1 \n").arg(ui->label_seedType->text()); text += QString("View only: %1 \n").arg(ui->label_viewOnly->text()); + text += QString("Primary only: %1 \n").arg(ui->label_primaryOnly->text()); text += QString("Operating system: %1 \n").arg(ui->label_OS->text()); text += QString("Timestamp: %1 \n").arg(ui->label_timestamp->text()); diff --git a/src/dialog/debuginfodialog.h b/src/dialog/debuginfodialog.h index d9a6e4a..899fde3 100644 --- a/src/dialog/debuginfodialog.h +++ b/src/dialog/debuginfodialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_DEBUGINFODIALOG_H -#define FEATHER_DEBUGINFODIALOG_H +#ifndef WOWLET_DEBUGINFODIALOG_H +#define WOWLET_DEBUGINFODIALOG_H #include #include "appcontext.h" @@ -31,4 +31,4 @@ private: Ui::DebugInfoDialog *ui; }; -#endif //FEATHER_DEBUGINFODIALOG_H +#endif //WOWLET_DEBUGINFODIALOG_H diff --git a/src/dialog/debuginfodialog.ui b/src/dialog/debuginfodialog.ui index 9348dba..f036447 100644 --- a/src/dialog/debuginfodialog.ui +++ b/src/dialog/debuginfodialog.ui @@ -19,12 +19,12 @@ - Feather version: + WOWlet version: - + TextLabel @@ -36,7 +36,7 @@ - Monero version: + Wownero version: @@ -183,14 +183,14 @@ - + Websocket status: - + TextLabel @@ -200,21 +200,21 @@ - + Qt::Horizontal - + Network type: - + TextLabel @@ -224,14 +224,14 @@ - + Seed type: - + TextLabel @@ -241,14 +241,14 @@ - + View only: - + TextLabel @@ -258,14 +258,14 @@ - + Timestamp: - + TextLabel @@ -275,14 +275,14 @@ - + Operating system: - + TextLabel @@ -292,7 +292,7 @@ - + Qt::Horizontal @@ -316,20 +316,34 @@ - + TextLabel - + Primary only: + + + + Websocket URL: + + + + + + + TextLabel + + + diff --git a/src/dialog/keysdialog.cpp b/src/dialog/keysdialog.cpp index 11fffb5..e49278d 100644 --- a/src/dialog/keysdialog.cpp +++ b/src/dialog/keysdialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "keysdialog.h" #include "ui_keysdialog.h" diff --git a/src/dialog/keysdialog.h b/src/dialog/keysdialog.h index 8a89605..5bc7453 100644 --- a/src/dialog/keysdialog.h +++ b/src/dialog/keysdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_KEYSDIALOG_H -#define FEATHER_KEYSDIALOG_H +#ifndef WOWLET_KEYSDIALOG_H +#define WOWLET_KEYSDIALOG_H #include #include "appcontext.h" @@ -24,4 +24,4 @@ private: }; -#endif //FEATHER_KEYSDIALOG_H +#endif //WOWLET_KEYSDIALOG_H diff --git a/src/dialog/outputinfodialog.cpp b/src/dialog/outputinfodialog.cpp index 800b1c8..456252b 100644 --- a/src/dialog/outputinfodialog.cpp +++ b/src/dialog/outputinfodialog.cpp @@ -1,14 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "outputinfodialog.h" #include "ui_outputinfodialog.h" #include "model/ModelUtils.h" -#include "libwalletqt/CoinsInfo.h" #include "utils/utils.h" -#include - OutputInfoDialog::OutputInfoDialog(CoinsInfo *cInfo, QWidget *parent) : QDialog(parent) , ui(new Ui::OutputInfoDialog) @@ -28,7 +25,7 @@ OutputInfoDialog::OutputInfoDialog(CoinsInfo *cInfo, QWidget *parent) QString status = cInfo->spent() ? "spent" : (cInfo->frozen() ? "frozen" : "unspent"); ui->label_status->setText(status); - ui->label_amount->setText(QString("%1 XMR").arg(cInfo->displayAmount())); + ui->label_amount->setText(QString("%1 WOW").arg(cInfo->displayAmount())); ui->label_creationHeight->setText(QString::number(cInfo->blockHeight())); ui->label_globalIndex->setText(QString::number(cInfo->globalOutputIndex())); ui->label_internalIndex->setText(QString::number(cInfo->internalOutputIndex())); diff --git a/src/dialog/outputinfodialog.h b/src/dialog/outputinfodialog.h index 481e81b..6d983bb 100644 --- a/src/dialog/outputinfodialog.h +++ b/src/dialog/outputinfodialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_OUTPUTINFODIALOG_H -#define FEATHER_OUTPUTINFODIALOG_H +#ifndef WOWLET_OUTPUTINFODIALOG_H +#define WOWLET_OUTPUTINFODIALOG_H #include #include "libwalletqt/Coins.h" @@ -25,4 +25,4 @@ private: }; -#endif //FEATHER_OUTPUTINFODIALOG_H +#endif //WOWLET_OUTPUTINFODIALOG_H diff --git a/src/dialog/outputsweepdialog.cpp b/src/dialog/outputsweepdialog.cpp index 1b4bcaf..0789b1c 100644 --- a/src/dialog/outputsweepdialog.cpp +++ b/src/dialog/outputsweepdialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ui_outputsweepdialog.h" #include "outputsweepdialog.h" diff --git a/src/dialog/outputsweepdialog.h b/src/dialog/outputsweepdialog.h index ecfbe8d..f3185e6 100644 --- a/src/dialog/outputsweepdialog.h +++ b/src/dialog/outputsweepdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_OUTPUTSWEEPDIALOG_H -#define FEATHER_OUTPUTSWEEPDIALOG_H +#ifndef WOWLET_OUTPUTSWEEPDIALOG_H +#define WOWLET_OUTPUTSWEEPDIALOG_H #include @@ -31,4 +31,4 @@ private: }; -#endif //FEATHER_OUTPUTSWEEPDIALOG_H +#endif //WOWLET_OUTPUTSWEEPDIALOG_H diff --git a/src/dialog/passwordchangedialog.cpp b/src/dialog/passwordchangedialog.cpp index 1f199c1..106e001 100644 --- a/src/dialog/passwordchangedialog.cpp +++ b/src/dialog/passwordchangedialog.cpp @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "passwordchangedialog.h" #include "ui_passwordchangedialog.h" -#include #include PasswordChangeDialog::PasswordChangeDialog(QWidget *parent, Wallet *wallet) diff --git a/src/dialog/passwordchangedialog.h b/src/dialog/passwordchangedialog.h index 3a3cb1e..c3a418a 100644 --- a/src/dialog/passwordchangedialog.h +++ b/src/dialog/passwordchangedialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_PASSWORDCHANGEDIALOG_H -#define FEATHER_PASSWORDCHANGEDIALOG_H +#ifndef WOWLET_PASSWORDCHANGEDIALOG_H +#define WOWLET_PASSWORDCHANGEDIALOG_H #include #include "libwalletqt/Wallet.h" @@ -27,4 +27,4 @@ private: void setPassword(); }; -#endif //FEATHER_PASSWORDCHANGEDIALOG_H +#endif //WOWLET_PASSWORDCHANGEDIALOG_H diff --git a/src/dialog/passworddialog.cpp b/src/dialog/passworddialog.cpp index c736708..7f7d0f7 100644 --- a/src/dialog/passworddialog.cpp +++ b/src/dialog/passworddialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "passworddialog.h" #include "ui_passworddialog.h" diff --git a/src/dialog/passworddialog.h b/src/dialog/passworddialog.h index 092830c..6b6bdf2 100644 --- a/src/dialog/passworddialog.h +++ b/src/dialog/passworddialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_PASSWORDDIALOG_H -#define FEATHER_PASSWORDDIALOG_H +#ifndef WOWLET_PASSWORDDIALOG_H +#define WOWLET_PASSWORDDIALOG_H #include @@ -24,4 +24,4 @@ private: Ui::PasswordDialog *ui; }; -#endif //FEATHER_PASSWORDDIALOG_H +#endif //WOWLET_PASSWORDDIALOG_H diff --git a/src/dialog/qrcodedialog.cpp b/src/dialog/qrcodedialog.cpp index 334a002..a7dee06 100644 --- a/src/dialog/qrcodedialog.cpp +++ b/src/dialog/qrcodedialog.cpp @@ -1,9 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "qrcodedialog.h" #include "ui_qrcodedialog.h" -#include "qrcode/QrCode.h" #include #include diff --git a/src/dialog/qrcodedialog.h b/src/dialog/qrcodedialog.h index 200ec51..b2cc300 100644 --- a/src/dialog/qrcodedialog.h +++ b/src/dialog/qrcodedialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_QRCODEDIALOG_H -#define FEATHER_QRCODEDIALOG_H +#ifndef WOWLET_QRCODEDIALOG_H +#define WOWLET_QRCODEDIALOG_H #include #include "qrcode/QrCode.h" @@ -29,4 +29,4 @@ private: }; -#endif //FEATHER_QRCODEDIALOG_H +#endif //WOWLET_QRCODEDIALOG_H diff --git a/src/dialog/restoredialog.cpp b/src/dialog/restoredialog.cpp index 48d6867..af6f589 100644 --- a/src/dialog/restoredialog.cpp +++ b/src/dialog/restoredialog.cpp @@ -1,10 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "restoredialog.h" #include "ui_restoredialog.h" -#include "utils/utils.h" -#include "appcontext.h" RestoreDialog::RestoreDialog(AppContext *ctx, QWidget *parent) : QDialog(parent) diff --git a/src/dialog/restoredialog.h b/src/dialog/restoredialog.h index 60d62e3..065cc90 100644 --- a/src/dialog/restoredialog.h +++ b/src/dialog/restoredialog.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef RESTOREDIALOG_H #define RESTOREDIALOG_H @@ -10,7 +10,7 @@ #include #include -#include "utils/seeds.h" +#include "utils/RestoreHeightLookup.h" #include "appcontext.h" namespace Ui { diff --git a/src/dialog/seeddialog.cpp b/src/dialog/seeddialog.cpp index 2860c02..f481c62 100644 --- a/src/dialog/seeddialog.cpp +++ b/src/dialog/seeddialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ui_seeddialog.h" #include "seeddialog.h" @@ -13,7 +13,7 @@ SeedDialog::SeedDialog(Wallet *wallet, QWidget *parent) ui->label_restoreHeight->setText(QString::number(wallet->getWalletCreationHeight())); - QString seed_14_words = wallet->getCacheAttribute("feather.seed"); + QString seed_14_words = wallet->getCacheAttribute("wowlet.seed"); QString seed_25_words = wallet->getSeed(); if (seed_14_words.isEmpty()) { diff --git a/src/dialog/seeddialog.h b/src/dialog/seeddialog.h index 71a6c63..45c8179 100644 --- a/src/dialog/seeddialog.h +++ b/src/dialog/seeddialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_SEEDDIALOG_H -#define FEATHER_SEEDDIALOG_H +#ifndef WOWLET_SEEDDIALOG_H +#define WOWLET_SEEDDIALOG_H #include #include "libwalletqt/Wallet.h" @@ -26,4 +26,4 @@ private: }; -#endif //FEATHER_SEEDDIALOG_H +#endif //WOWLET_SEEDDIALOG_H diff --git a/src/dialog/signverifydialog.cpp b/src/dialog/signverifydialog.cpp index 2176b2e..f60dbdb 100644 --- a/src/dialog/signverifydialog.cpp +++ b/src/dialog/signverifydialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "signverifydialog.h" #include "ui_signverifydialog.h" diff --git a/src/dialog/signverifydialog.h b/src/dialog/signverifydialog.h index e4c5700..b53b40f 100644 --- a/src/dialog/signverifydialog.h +++ b/src/dialog/signverifydialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_SIGNVERIFYDIALOG_H -#define FEATHER_SIGNVERIFYDIALOG_H +#ifndef WOWLET_SIGNVERIFYDIALOG_H +#define WOWLET_SIGNVERIFYDIALOG_H #include #include "libwalletqt/Wallet.h" @@ -30,4 +30,4 @@ private slots: }; -#endif //FEATHER_SIGNVERIFYDIALOG_H +#endif //WOWLET_SIGNVERIFYDIALOG_H diff --git a/src/dialog/torinfodialog.cpp b/src/dialog/torinfodialog.cpp index 85e8474..97cad90 100644 --- a/src/dialog/torinfodialog.cpp +++ b/src/dialog/torinfodialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "torinfodialog.h" #include "ui_torinfodialog.h" diff --git a/src/dialog/torinfodialog.h b/src/dialog/torinfodialog.h index 9c44db1..be71712 100644 --- a/src/dialog/torinfodialog.h +++ b/src/dialog/torinfodialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TORINFODIALOG_H -#define FEATHER_TORINFODIALOG_H +#ifndef WOWLET_TORINFODIALOG_H +#define WOWLET_TORINFODIALOG_H #include @@ -29,4 +29,4 @@ private: }; -#endif //FEATHER_TORINFODIALOG_H +#endif //WOWLET_TORINFODIALOG_H diff --git a/src/dialog/transactioninfodialog.cpp b/src/dialog/transactioninfodialog.cpp index 61e53bc..f9f7a00 100644 --- a/src/dialog/transactioninfodialog.cpp +++ b/src/dialog/transactioninfodialog.cpp @@ -1,12 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "transactioninfodialog.h" #include "ui_transactioninfodialog.h" #include "libwalletqt/CoinsInfo.h" #include "libwalletqt/WalletManager.h" +#include "libwalletqt/Transfer.h" #include "utils.h" +#include "utils/ColorScheme.h" #include @@ -23,12 +25,16 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx ui->label_txid->setText(QString(txInfo->hash())); if (txInfo->direction() == TransactionInfo::Direction_In) { - ui->txKey->hide(); + ui->frameTxKey->hide(); } else { QString txKey = m_wallet->getTxKey(txInfo->hash()); - txKey = txKey.isEmpty() ? "unknown" : txKey; - ui->label_txKey->setText(txKey); + if (txKey.isEmpty()) { + ui->btn_CopyTxKey->setEnabled(false); + ui->btn_CopyTxKey->setToolTip("Transaction key unknown"); + } + m_txKey = txKey; } + connect(ui->btn_CopyTxKey, &QPushButton::pressed, this, &TransactionInfoDialog::copyTxKey); QString blockHeight = QString::number(txInfo->blockHeight()); if (blockHeight == "0") @@ -47,11 +53,17 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx qDebug() << m_wallet->coins()->coins_from_txid(txInfo->hash()); - QString destinations = txInfo->destinations_formatted(); - if (destinations.isEmpty()) { + QTextCursor cursor = ui->destinations->textCursor(); + for (const auto& transfer : txInfo->transfers()) { + auto address = transfer->address(); + auto amount = WalletManager::displayAmount(transfer->amount()); + auto index = m_wallet->subaddressIndex(address); + cursor.insertText(address, Utils::addressTextFormat(index)); + cursor.insertText(QString(" %1").arg(amount), QTextCharFormat()); + cursor.insertBlock(); + } + if (txInfo->transfers().size() == 0) { ui->frameDestinations->hide(); - } else { - ui->destinations->setText(destinations); } ui->txProofWidget->addWidget(m_txProofWidget); @@ -59,6 +71,10 @@ TransactionInfoDialog::TransactionInfoDialog(Wallet *wallet, TransactionInfo *tx this->adjustSize(); } +void TransactionInfoDialog::copyTxKey() { + Utils::copyToClipboard(m_txKey); +} + TransactionInfoDialog::~TransactionInfoDialog() { delete ui; } diff --git a/src/dialog/transactioninfodialog.h b/src/dialog/transactioninfodialog.h index 3426a87..f5d93ca 100644 --- a/src/dialog/transactioninfodialog.h +++ b/src/dialog/transactioninfodialog.h @@ -1,10 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TRANSACTIONINFODIALOG_H -#define FEATHER_TRANSACTIONINFODIALOG_H +#ifndef WOWLET_TRANSACTIONINFODIALOG_H +#define WOWLET_TRANSACTIONINFODIALOG_H #include +#include #include #include "libwalletqt/Coins.h" #include "libwalletqt/TransactionInfo.h" @@ -24,11 +25,14 @@ public: ~TransactionInfoDialog() override; private: + void copyTxKey(); + Ui::TransactionInfoDialog *ui; TransactionInfo *m_txInfo; Wallet *m_wallet; TxProofWidget *m_txProofWidget; + QString m_txKey; }; -#endif //FEATHER_TRANSACTIONINFODIALOG_H +#endif //WOWLET_TRANSACTIONINFODIALOG_H diff --git a/src/dialog/transactioninfodialog.ui b/src/dialog/transactioninfodialog.ui index 00585c2..f7ae9fd 100644 --- a/src/dialog/transactioninfodialog.ui +++ b/src/dialog/transactioninfodialog.ui @@ -14,6 +14,9 @@ Transaction + + + @@ -33,25 +36,6 @@ - - - - Transaction key: - - - - - - txKey - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - @@ -131,6 +115,22 @@ + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 0 + 15 + + + + @@ -152,13 +152,6 @@ 0 - - - - Qt::Horizontal - - - @@ -168,9 +161,15 @@ - + + + 0 + 0 + + + - 16777215 + 0 100 @@ -182,29 +181,76 @@ - - - - Qt::Horizontal - - - - - - Qt::Vertical + + QSizePolicy::Maximum + - 20 - 0 + 0 + 15 + + + + QFrame::NoFrame + + + QFrame::Raised + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Copy + + + + + + + Transaction Key + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + diff --git a/src/dialog/txconfadvdialog.cpp b/src/dialog/txconfadvdialog.cpp index a7fa2f4..cc67e4d 100644 --- a/src/dialog/txconfadvdialog.cpp +++ b/src/dialog/txconfadvdialog.cpp @@ -1,16 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "txconfadvdialog.h" #include "ui_txconfadvdialog.h" -#include "libwalletqt/WalletManager.h" #include "qrcode/QrCode.h" #include "dialog/qrcodedialog.h" -#include "utils/utils.h" -#include "libwalletqt/PendingTransactionInfo.h" #include "libwalletqt/Transfer.h" #include "libwalletqt/Input.h" #include "model/ModelUtils.h" +#include "utils/ColorScheme.h" #include #include @@ -55,7 +53,7 @@ void TxConfAdvDialog::setTransaction(PendingTransaction *tx) { m_tx = tx; m_tx->refresh(); - PendingTransactionInfo *ptx = m_tx->transaction(0); + PendingTransactionInfo *ptx = m_tx->transaction(0); //Todo: support split transactions ui->txid->setText(tx->txid().first()); @@ -105,12 +103,17 @@ void TxConfAdvDialog::setupConstructionData(ConstructionInfo *ci) { ui->inputs->setText(inputs_str); ui->label_inputs->setText(QString("Inputs (%1)").arg(QString::number(inputs.size()))); - QString outputs_str; auto outputs = ci->outputs(); + + QTextCursor cursor = ui->outputs->textCursor(); for (const auto& o: outputs) { - outputs_str += QString("%1 %2\n").arg(o->address(), WalletManager::displayAmount(o->amount())); + auto address = o->address(); + auto amount = WalletManager::displayAmount(o->amount()); + auto index = m_ctx->currentWallet->subaddressIndex(address); + cursor.insertText(address, Utils::addressTextFormat(index)); + cursor.insertText(QString(" %1").arg(amount), QTextCharFormat()); + cursor.insertBlock(); } - ui->outputs->setText(outputs_str); ui->label_outputs->setText(QString("Outputs (%1)").arg(QString::number(outputs.size()))); ui->label_ringSize->setText(QString("Ring size: %1").arg(QString::number(ci->minMixinCount() + 1))); diff --git a/src/dialog/txconfadvdialog.h b/src/dialog/txconfadvdialog.h index 63ed112..08380d8 100644 --- a/src/dialog/txconfadvdialog.h +++ b/src/dialog/txconfadvdialog.h @@ -1,13 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TXCONFADVDIALOG_H -#define FEATHER_TXCONFADVDIALOG_H +#ifndef WOWLET_TXCONFADVDIALOG_H +#define WOWLET_TXCONFADVDIALOG_H #include #include #include #include +#include #include "libwalletqt/PendingTransaction.h" #include "appcontext.h" @@ -49,6 +50,4 @@ private: QMenu *m_exportSignedMenu; }; - - -#endif //FEATHER_TXCONFADVDIALOG_H +#endif //WOWLET_TXCONFADVDIALOG_H diff --git a/src/dialog/txconfadvdialog.ui b/src/dialog/txconfadvdialog.ui index 86df777..38f3cbc 100644 --- a/src/dialog/txconfadvdialog.ui +++ b/src/dialog/txconfadvdialog.ui @@ -185,17 +185,11 @@ - + 0 0 - - - 16777215 - 100 - - true diff --git a/src/dialog/txconfdialog.cpp b/src/dialog/txconfdialog.cpp index fef1c6c..be64374 100644 --- a/src/dialog/txconfdialog.cpp +++ b/src/dialog/txconfdialog.cpp @@ -1,34 +1,32 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "txconfdialog.h" #include "ui_txconfdialog.h" -#include "appcontext.h" -#include "utils/config.h" #include "model/ModelUtils.h" -#include "libwalletqt/WalletManager.h" #include "txconfadvdialog.h" #include "globals.h" +#include "utils/ColorScheme.h" #include -TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QString &address, const QString &description, int mixin, QWidget *parent) +TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QString &address, const QString &description, QWidget *parent) : QDialog(parent) , ui(new Ui::TxConfDialog) , m_ctx(ctx) , m_tx(tx) , m_address(address) , m_description(description) - , m_mixin(mixin) { ui->setupUi(this); ui->label_warning->setText("You are about to send a transaction.\nVerify the information below."); + ui->label_note->hide(); QString preferredCur = config()->get(Config::preferredFiatCurrency).toString(); auto convert = [preferredCur](double amount){ - return QString::number(AppContext::prices->convert("XMR", preferredCur, amount), 'f', 2); + return QString::number(AppContext::prices->convert("WOW", preferredCur, amount), 'f', 2); }; QString amount = WalletManager::displayAmount(tx->amount()); @@ -45,14 +43,34 @@ TxConfDialog::TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QStrin int maxLengthFiat = Utils::maxLength(amounts_fiat); std::for_each(amounts_fiat.begin(), amounts_fiat.end(), [maxLengthFiat](QString& amount){amount = amount.rightJustified(maxLengthFiat, ' ');}); + ui->label_amount->setFont(ModelUtils::getMonospaceFont()); + ui->label_fee->setFont(ModelUtils::getMonospaceFont()); + ui->label_total->setFont(ModelUtils::getMonospaceFont()); + ui->label_amount->setText(QString("%1 (%2 %3)").arg(amounts[0], amounts_fiat[0], preferredCur)); ui->label_fee->setText(QString("%1 (%2 %3)").arg(amounts[1], amounts_fiat[1], preferredCur)); ui->label_total->setText(QString("%1 (%2 %3)").arg(amounts[2], amounts_fiat[2], preferredCur)); + auto subaddressIndex = m_ctx->currentWallet->subaddressIndex(address); + QString addressExtra; + ui->label_address->setText(ModelUtils::displayAddress(address, 2)); ui->label_address->setFont(ModelUtils::getMonospaceFont()); ui->label_address->setToolTip(address); + if (subaddressIndex.isValid()) { + ui->label_note->setText("Note: this is a churn transaction."); + ui->label_note->show(); + ui->label_address->setStyleSheet(ColorScheme::GREEN.asStylesheet(true)); + ui->label_address->setToolTip("Wallet receive address"); + } + + if (subaddressIndex.isPrimary()) { + ui->label_address->setStyleSheet(ColorScheme::YELLOW.asStylesheet(true)); + ui->label_address->setToolTip("Wallet change/primary address"); + } + + ui->buttonBox->button(QDialogButtonBox::Ok)->setText("Send"); connect(ui->btn_Advanced, &QPushButton::clicked, this, &TxConfDialog::setShowAdvanced); diff --git a/src/dialog/txconfdialog.h b/src/dialog/txconfdialog.h index 4f74370..c13eef0 100644 --- a/src/dialog/txconfdialog.h +++ b/src/dialog/txconfdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TXCONFDIALOG_H -#define FEATHER_TXCONFDIALOG_H +#ifndef WOWLET_TXCONFDIALOG_H +#define WOWLET_TXCONFDIALOG_H #include #include "libwalletqt/PendingTransaction.h" @@ -18,22 +18,19 @@ class TxConfDialog : public QDialog Q_OBJECT public: - explicit TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QString &address, const QString &description, int mixin, QWidget *parent = nullptr); + explicit TxConfDialog(AppContext *ctx, PendingTransaction *tx, const QString &address, const QString &description, QWidget *parent = nullptr); ~TxConfDialog() override; bool showAdvanced = false; private: void setShowAdvanced(); - void saveToFile(); - void copyToClipboard(); Ui::TxConfDialog *ui; AppContext *m_ctx; PendingTransaction *m_tx; QString m_address; QString m_description; - int m_mixin; }; -#endif //FEATHER_TXCONFDIALOG_H +#endif //WOWLET_TXCONFDIALOG_H diff --git a/src/dialog/txconfdialog.ui b/src/dialog/txconfdialog.ui index acb7a6c..5ead8f4 100644 --- a/src/dialog/txconfdialog.ui +++ b/src/dialog/txconfdialog.ui @@ -6,8 +6,8 @@ 0 0 - 844 - 248 + 612 + 288 @@ -24,6 +24,16 @@ + + + + note + + + true + + + diff --git a/src/dialog/tximportdialog.cpp b/src/dialog/tximportdialog.cpp index 9b3f639..41897f6 100644 --- a/src/dialog/tximportdialog.cpp +++ b/src/dialog/tximportdialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "tximportdialog.h" #include "ui_tximportdialog.h" diff --git a/src/dialog/tximportdialog.h b/src/dialog/tximportdialog.h index 1222ad0..93ca797 100644 --- a/src/dialog/tximportdialog.h +++ b/src/dialog/tximportdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TXIMPORTDIALOG_H -#define FEATHER_TXIMPORTDIALOG_H +#ifndef WOWLET_TXIMPORTDIALOG_H +#define WOWLET_TXIMPORTDIALOG_H #include #include "appcontext.h" @@ -36,4 +36,4 @@ private: }; -#endif //FEATHER_TXIMPORTDIALOG_H +#endif //WOWLET_TXIMPORTDIALOG_H diff --git a/src/dialog/updatedialog.cpp b/src/dialog/updatedialog.cpp new file mode 100644 index 0000000..a089aa0 --- /dev/null +++ b/src/dialog/updatedialog.cpp @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include +#include "updatedialog.h" +#include "ui_updatedialog.h" + +#include "config-wowlet.h" + +UpdateDialog::UpdateDialog(AppContext *ctx, QWidget *parent) : + QDialog(parent), + ctx(ctx), + ui(new Ui::UpdateDialog) { + ui->setupUi(this); + this->setWindowIcon(QIcon("://assets/images/appicons/64x64.png")); + + auto version_str = ctx->versionPending.value("version").toString(); + + QPixmap p(":assets/images/pls_update.jpg"); + ui->label_image->setPixmap(p.scaled(320, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + + ui->info_label->setText("Current version: " + QString(WOWLET_VERSION_SEMVER) + "\n" + "New version: " + version_str); + + ui->label_download->setText("Download: git.wownero.com"); + ui->label_download->setTextInteractionFlags(Qt::TextBrowserInteraction); + ui->label_download->setOpenExternalLinks(true); + + // checkbox + connect(ui->checkbox_ignore, &QCheckBox::clicked, this, &UpdateDialog::checkboxIgnoreWarning); + + this->adjustSize(); +} + +void UpdateDialog::checkboxIgnoreWarning(bool checked) { + if(checked) + config()->set(Config::ignoreUpdateWarning, WOWLET_VERSION_SEMVER); + else + config()->set(Config::ignoreUpdateWarning, ""); +} + +UpdateDialog::~UpdateDialog() { + delete ui; +} diff --git a/src/dialog/updatedialog.h b/src/dialog/updatedialog.h new file mode 100644 index 0000000..9ec1725 --- /dev/null +++ b/src/dialog/updatedialog.h @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_UPDATEDIALOG_H +#define WOWLET_UPDATEDIALOG_H + +#include +#include "appcontext.h" + +namespace Ui { + class UpdateDialog; +} + +class UpdateDialog : public QDialog +{ +Q_OBJECT + +public: + explicit UpdateDialog(AppContext *ctx, QWidget *parent = nullptr); + ~UpdateDialog() override; + +private slots: + void checkboxIgnoreWarning(bool checked); + +private: + AppContext *ctx = nullptr; + Ui::UpdateDialog *ui; +}; + + +#endif //WOWLET_UPDATEDIALOG_H diff --git a/src/dialog/updatedialog.ui b/src/dialog/updatedialog.ui new file mode 100644 index 0000000..efccab4 --- /dev/null +++ b/src/dialog/updatedialog.ui @@ -0,0 +1,108 @@ + + + UpdateDialog + + + + 0 + 0 + 349 + 189 + + + + Pls update + + + + + + image + + + + + + + info_label + + + + + + + download_label + + + Qt::RichText + + + + + + + Ignore for now + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + UpdateDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + UpdateDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/dialog/verifyproofdialog.cpp b/src/dialog/verifyproofdialog.cpp index 4d34f4e..1211c70 100644 --- a/src/dialog/verifyproofdialog.cpp +++ b/src/dialog/verifyproofdialog.cpp @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "verifyproofdialog.h" #include "ui_verifyproofdialog.h" -#include "utils/utils.h" #include "libwalletqt/WalletManager.h" #include @@ -94,6 +93,6 @@ void VerifyProofDialog::checkTxProof(const QString &txId, const QString &address return; } - QString msg = QString("This address received %1 monero, with %2 confirmation(s)").arg(WalletManager::displayAmount(r.received), QString::number(r.confirmations)); + QString msg = QString("This address received %1 wownero, with %2 confirmation(s)").arg(WalletManager::displayAmount(r.received), QString::number(r.confirmations)); QMessageBox::information(this, "Information", QString("Proof is valid.\n\n%1").arg(msg)); } \ No newline at end of file diff --git a/src/dialog/verifyproofdialog.h b/src/dialog/verifyproofdialog.h index 4442923..08eca19 100644 --- a/src/dialog/verifyproofdialog.h +++ b/src/dialog/verifyproofdialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_VERIFYPROOFDIALOG_H -#define FEATHER_VERIFYPROOFDIALOG_H +#ifndef WOWLET_VERIFYPROOFDIALOG_H +#define WOWLET_VERIFYPROOFDIALOG_H #include #include "libwalletqt/Wallet.h" @@ -32,4 +32,4 @@ private: Wallet *m_wallet; }; -#endif //FEATHER_VERIFYPROOFDIALOG_H +#endif //WOWLET_VERIFYPROOFDIALOG_H diff --git a/src/dialog/viewonlydialog.cpp b/src/dialog/viewonlydialog.cpp index b66e12b..33d30dc 100644 --- a/src/dialog/viewonlydialog.cpp +++ b/src/dialog/viewonlydialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include @@ -26,7 +26,7 @@ ViewOnlyDialog::ViewOnlyDialog(AppContext *ctx, QWidget *parent) } void ViewOnlyDialog::onWriteViewOnlyWallet(){ - QString fn = QFileDialog::getSaveFileName(this, "Save .keys wallet file", QDir::homePath(), "Monero wallet (*.keys)"); + QString fn = QFileDialog::getSaveFileName(this, "Save .keys wallet file", QDir::homePath(), "Wownero wallet (*.keys)"); if(fn.isEmpty()) return; if(!fn.endsWith(".keys")) fn += ".keys"; diff --git a/src/dialog/viewonlydialog.h b/src/dialog/viewonlydialog.h index 555f76b..2930750 100644 --- a/src/dialog/viewonlydialog.h +++ b/src/dialog/viewonlydialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_VIEWONLYDIALOG_H -#define FEATHER_VIEWONLYDIALOG_H +#ifndef WOWLET_VIEWONLYDIALOG_H +#define WOWLET_VIEWONLYDIALOG_H #include #include "appcontext.h" @@ -29,4 +29,4 @@ private: }; -#endif //FEATHER_KEYSDIALOG_H +#endif //WOWLET_KEYSDIALOG_H diff --git a/src/dialog/walletinfodialog.cpp b/src/dialog/walletinfodialog.cpp index 8697a97..d46909f 100644 --- a/src/dialog/walletinfodialog.cpp +++ b/src/dialog/walletinfodialog.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "walletinfodialog.h" #include "ui_walletinfodialog.h" @@ -18,7 +18,7 @@ WalletInfoDialog::WalletInfoDialog(AppContext *ctx, QWidget *parent) ui->label_walletName->setText(keys.fileName().replace(".keys", "")); ui->label_netType->setText(Utils::QtEnumToString(ctx->currentWallet->nettype())); - ui->label_seedType->setText(ctx->currentWallet->getCacheAttribute("feather.seed").isEmpty() ? "25 word" : "14 word"); + ui->label_seedType->setText(ctx->currentWallet->getCacheAttribute("wowlet.seed").isEmpty() ? "25 word" : "14 word"); ui->label_viewOnly->setText(ctx->currentWallet->viewOnly() ? "True" : "False"); ui->label_path->setText(ctx->walletPath); ui->label_cacheSize->setText(QString("%1 MB").arg(QString::number(cache.size() / 1e6, 'f', 2))); diff --git a/src/dialog/walletinfodialog.h b/src/dialog/walletinfodialog.h index b30b7c7..81794f0 100644 --- a/src/dialog/walletinfodialog.h +++ b/src/dialog/walletinfodialog.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WALLETINFODIALOG_H -#define FEATHER_WALLETINFODIALOG_H +#ifndef WOWLET_WALLETINFODIALOG_H +#define WOWLET_WALLETINFODIALOG_H #include @@ -27,4 +27,4 @@ private: AppContext *m_ctx; }; -#endif //FEATHER_WALLETINFODIALOG_H +#endif //WOWLET_WALLETINFODIALOG_H diff --git a/src/dialog/xmrtoinfodialog.cpp b/src/dialog/xmrtoinfodialog.cpp deleted file mode 100644 index 0400a96..0000000 --- a/src/dialog/xmrtoinfodialog.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "xmrtoinfodialog.h" -#include "ui_xmrtoinfodialog.h" - -#include - -XmrToInfoDialog::XmrToInfoDialog(XmrToOrder *oInfo, QWidget *parent) - : QDialog(parent) - , ui(new Ui::XmrToInfoDialog) - , m_oInfo(oInfo) -{ - ui->setupUi(this); - - ui->status->setText(XmrTo::stateMap[(OrderState) oInfo->state]); - ui->xmrto_id->setText(!oInfo->uuid.isEmpty() ? oInfo->uuid : ""); - - ui->error_code->setText(!oInfo->errorCode.isEmpty() ? oInfo->errorCode : ""); - ui->error_msg->setText(!oInfo->errorMsg.isEmpty() ? oInfo->errorMsg : ""); - - ui->xmr_amount->setText(QString::number(oInfo->incoming_amount_total)); - ui->btc_amount->setText(QString::number(oInfo->btc_amount)); - ui->rate->setText(oInfo->incoming_price_btc > 0 ? QString::number(oInfo->incoming_price_btc) : ""); - - ui->xmr_txid->setText(oInfo->xmr_txid); - ui->xmr_address->setText(oInfo->receiving_subaddress); - - ui->btc_txid->setText(oInfo->btc_txid); - ui->btc_address->setText(oInfo->btc_dest_address); - - this->adjustSize(); -} - -XmrToInfoDialog::~XmrToInfoDialog() { - delete ui; -} diff --git a/src/dialog/xmrtoinfodialog.h b/src/dialog/xmrtoinfodialog.h deleted file mode 100644 index 03fd3c5..0000000 --- a/src/dialog/xmrtoinfodialog.h +++ /dev/null @@ -1,28 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_XMRTOINFODIALOG_H -#define FEATHER_XMRTOINFODIALOG_H - -#include -#include "utils/xmrto.h" - -namespace Ui { - class XmrToInfoDialog; -} - -class XmrToInfoDialog : public QDialog -{ -Q_OBJECT - -public: - explicit XmrToInfoDialog(XmrToOrder *oInfo, QWidget *parent = nullptr); - ~XmrToInfoDialog() override; - -private: - Ui::XmrToInfoDialog *ui; - - XmrToOrder *m_oInfo; -}; - -#endif //FEATHER_XMRTOINFODIALOG_H diff --git a/src/dialog/xmrtoinfodialog.ui b/src/dialog/xmrtoinfodialog.ui deleted file mode 100644 index cb38077..0000000 --- a/src/dialog/xmrtoinfodialog.ui +++ /dev/null @@ -1,256 +0,0 @@ - - - XmrToInfoDialog - - - - 0 - 0 - 689 - 581 - - - - Xmr.to Order - - - - - - - - - - Status: - - - - - - - XMR.to ID: - - - - - - - Error code: - - - - - - - true - - - - - - - true - - - - - - - true - - - - - - - - - Qt::Vertical - - - - - - - - - XMR amount: - - - - - - - BTC amount: - - - - - - - Rate: - - - - - - - true - - - - - - - true - - - - - - - true - - - - - - - - - - - - - Message: - - - - - - - true - - - - - - - Qt::Horizontal - - - - - - - XMR.to address: - - - - - - - true - - - - - - - XMR txid: - - - - - - - true - - - - - - - Qt::Horizontal - - - - - - - BTC address: - - - - - - - true - - - - - - - BTC txid: - - - - - - - true - - - - - - - - - Qt::Horizontal - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Copy support template - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - diff --git a/src/globals.h b/src/globals.h index d3e01cd..90578f6 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1,14 +1,31 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_GLOBALS_H -#define FEATHER_GLOBALS_H +#ifndef WOWLET_GLOBALS_H +#define WOWLET_GLOBALS_H #include namespace globals { - const qreal cdiv = 1e12; + const qreal cdiv = 1e11; + + enum Tabs { + HOME = 0, + HISTORY, + SEND, + RECEIVE, + COINS, + CALC, + XMRIG + }; + + enum TabsHome { + FORUM, + REDDIT, + SUCHWOW, + WFS + }; } -#endif //FEATHER_GLOBALS_H +#endif //WOWLET_GLOBALS_H diff --git a/src/historywidget.cpp b/src/historywidget.cpp index df68738..ab13ebe 100644 --- a/src/historywidget.cpp +++ b/src/historywidget.cpp @@ -1,13 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "historywidget.h" #include "ui_historywidget.h" #include "dialog/transactioninfodialog.h" -#include "libwalletqt/TransactionHistory.h" -#include "model/TransactionHistoryProxyModel.h" - -#include +#include HistoryWidget::HistoryWidget(QWidget *parent) : QWidget(parent) @@ -37,6 +34,11 @@ HistoryWidget::HistoryWidget(QWidget *parent) } }); + connect(ui->btn_moreInfo, &QPushButton::clicked, this, &HistoryWidget::showSyncNoticeMsg); + connect(ui->btn_close, &QPushButton::clicked, [this]{ + config()->set(Config::showHistorySyncNotice, false); + ui->syncNotice->hide(); + }); } void HistoryWidget::showContextMenu(const QPoint &point) { @@ -88,6 +90,11 @@ void HistoryWidget::setModel(TransactionHistoryProxyModel *model, Wallet *wallet ui->history->hideColumn(TransactionHistoryModel::TxID); } +void HistoryWidget::resetModel() +{ + ui->history->setModel(nullptr); +} + void HistoryWidget::showTxDetails() { QModelIndex index = ui->history->currentIndex(); @@ -142,6 +149,23 @@ void HistoryWidget::copy(copyField field) { Utils::copyToClipboard(data); } +void HistoryWidget::onWalletOpened() { + ui->syncNotice->setVisible(config()->get(Config::showHistorySyncNotice).toBool()); +} + +void HistoryWidget::onWalletRefreshed() { + ui->syncNotice->hide(); +} + +void HistoryWidget::showSyncNoticeMsg() { + QMessageBox::information(this, "Sync notice", + "The wallet needs to scan the blockchain to find your transactions. " + "The status bar will show you how many blocks are still remaining.\n" + "\n" + "The history page will update once synchronization has finished. " + "To update the history page during synchronization press Ctrl+R."); +} + HistoryWidget::~HistoryWidget() { delete ui; } diff --git a/src/historywidget.h b/src/historywidget.h index b866454..e898f8a 100644 --- a/src/historywidget.h +++ b/src/historywidget.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_HISTORYWIDGET_H -#define FEATHER_HISTORYWIDGET_H +#ifndef WOWLET_HISTORYWIDGET_H +#define WOWLET_HISTORYWIDGET_H #include "model/TransactionHistoryModel.h" #include "model/TransactionHistoryProxyModel.h" @@ -27,6 +27,9 @@ public: public slots: void setSearchText(const QString &text); + void resetModel(); + void onWalletRefreshed(); + void onWalletOpened(); signals: void viewOnBlockExplorer(QString txid); @@ -47,6 +50,7 @@ private: void copy(copyField field); void showContextMenu(const QPoint &point); + void showSyncNoticeMsg(); Ui::HistoryWidget *ui; QMenu *m_contextMenu; @@ -56,4 +60,4 @@ private: Wallet *m_wallet = nullptr; }; -#endif //FEATHER_HISTORYWIDGET_H +#endif //WOWLET_HISTORYWIDGET_H diff --git a/src/historywidget.ui b/src/historywidget.ui index c333a69..ff8cb25 100644 --- a/src/historywidget.ui +++ b/src/historywidget.ui @@ -33,6 +33,73 @@ + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 3 + + + 3 + + + + + History may appear incomplete during synchronization. + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + + 0 + 0 + + + + More info + + + + + + + + 0 + 0 + + + + Close + + + false + + + + + + diff --git a/src/libwalletqt/AddressBook.cpp b/src/libwalletqt/AddressBook.cpp index decfa3a..6b485b0 100644 --- a/src/libwalletqt/AddressBook.cpp +++ b/src/libwalletqt/AddressBook.cpp @@ -1,8 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "AddressBook.h" -#include "AddressBookInfo.h" #include AddressBook::AddressBook(Monero::AddressBook *abImpl,QObject *parent) @@ -110,6 +109,25 @@ bool AddressBook::deleteRow(int rowId) return result; } +bool AddressBook::deleteByAddress(const QString &address) { + bool result; + QWriteLocker locker(&m_lock); + + const QMap::const_iterator it = m_addresses.find(address); + if (it == m_addresses.end()) + return false; + + { + result = m_addressBookImpl->deleteRow(*it); + } + + // Fetch new data from wallet2. + if (result) + getAll(); + + return result; +} + quint64 AddressBook::count() const { QReadLocker locker(&m_lock); diff --git a/src/libwalletqt/AddressBook.h b/src/libwalletqt/AddressBook.h index 6c8fefd..e1852de 100644 --- a/src/libwalletqt/AddressBook.h +++ b/src/libwalletqt/AddressBook.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef ADDRESSBOOK_H #define ADDRESSBOOK_H @@ -24,6 +24,7 @@ public: Q_INVOKABLE bool getRow(int index, std::function callback) const; Q_INVOKABLE bool addRow(const QString &address, const QString &payment_id, const QString &description); Q_INVOKABLE bool deleteRow(int rowId); + Q_INVOKABLE bool deleteByAddress(const QString &description); Q_INVOKABLE void setDescription(int index, const QString &label); quint64 count() const; Q_INVOKABLE QString errorString() const; diff --git a/src/libwalletqt/AddressBookInfo.cpp b/src/libwalletqt/AddressBookInfo.cpp index c6e33ec..ea3bd57 100644 --- a/src/libwalletqt/AddressBookInfo.cpp +++ b/src/libwalletqt/AddressBookInfo.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "AddressBookInfo.h" diff --git a/src/libwalletqt/AddressBookInfo.h b/src/libwalletqt/AddressBookInfo.h index af9c609..f969b9f 100644 --- a/src/libwalletqt/AddressBookInfo.h +++ b/src/libwalletqt/AddressBookInfo.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. -#ifndef FEATHER_ADDRESSBOOKINFO_H -#define FEATHER_ADDRESSBOOKINFO_H +#ifndef WOWLET_ADDRESSBOOKINFO_H +#define WOWLET_ADDRESSBOOKINFO_H #include #include @@ -25,4 +25,4 @@ private: }; -#endif //FEATHER_ADDRESSBOOKINFO_H +#endif //WOWLET_ADDRESSBOOKINFO_H diff --git a/src/libwalletqt/Coins.cpp b/src/libwalletqt/Coins.cpp index 4c1a9e5..677c700 100644 --- a/src/libwalletqt/Coins.cpp +++ b/src/libwalletqt/Coins.cpp @@ -1,19 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "Coins.h" #include -#include "Coins.h" #include "CoinsInfo.h" -#include #include -#include -#include -#include -#include bool Coins::coin(int index, std::function callback) @@ -42,10 +36,6 @@ void Coins::refresh(quint32 accountIndex) m_pimpl->refresh(); for (const auto i : m_pimpl->getAll()) { - if (i->subaddrAccount() != accountIndex) { - continue; - } - m_tinfo.append(new CoinsInfo(i, this)); } } diff --git a/src/libwalletqt/Coins.h b/src/libwalletqt/Coins.h index 66a0166..d493d65 100644 --- a/src/libwalletqt/Coins.h +++ b/src/libwalletqt/Coins.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_COINS_H -#define FEATHER_COINS_H +#ifndef WOWLET_COINS_H +#define WOWLET_COINS_H #include @@ -49,4 +49,4 @@ private: mutable QList m_tinfo; }; -#endif //FEATHER_COINS_H +#endif //WOWLET_COINS_H diff --git a/src/libwalletqt/CoinsInfo.cpp b/src/libwalletqt/CoinsInfo.cpp index 56ec202..d6076cb 100644 --- a/src/libwalletqt/CoinsInfo.cpp +++ b/src/libwalletqt/CoinsInfo.cpp @@ -1,11 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "CoinsInfo.h" #include "libwalletqt/WalletManager.h" -#include "Transfer.h" -#include -#include quint64 CoinsInfo::blockHeight() const { diff --git a/src/libwalletqt/CoinsInfo.h b/src/libwalletqt/CoinsInfo.h index 4739ea9..a9155a4 100644 --- a/src/libwalletqt/CoinsInfo.h +++ b/src/libwalletqt/CoinsInfo.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_COINSINFO_H -#define FEATHER_COINSINFO_H +#ifndef WOWLET_COINSINFO_H +#define WOWLET_COINSINFO_H #include #include @@ -88,4 +88,4 @@ private: bool m_coinbase; }; -#endif //FEATHER_COINSINFO_H +#endif //WOWLET_COINSINFO_H diff --git a/src/libwalletqt/ConstructionInfo.cpp b/src/libwalletqt/ConstructionInfo.cpp index ce163a8..d720c71 100644 --- a/src/libwalletqt/ConstructionInfo.cpp +++ b/src/libwalletqt/ConstructionInfo.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "ConstructionInfo.h" diff --git a/src/libwalletqt/ConstructionInfo.h b/src/libwalletqt/ConstructionInfo.h index e84a595..3d46567 100644 --- a/src/libwalletqt/ConstructionInfo.h +++ b/src/libwalletqt/ConstructionInfo.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. -#ifndef FEATHER_CONSTRUCTIONINFO_H -#define FEATHER_CONSTRUCTIONINFO_H +#ifndef WOWLET_CONSTRUCTIONINFO_H +#define WOWLET_CONSTRUCTIONINFO_H #include #include @@ -43,4 +43,4 @@ private: }; -#endif //FEATHER_CONSTRUCTIONINFO_H +#endif //WOWLET_CONSTRUCTIONINFO_H diff --git a/src/libwalletqt/Input.h b/src/libwalletqt/Input.h index 25ca4d6..5978f81 100644 --- a/src/libwalletqt/Input.h +++ b/src/libwalletqt/Input.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. -#ifndef FEATHER_INPUT_H -#define FEATHER_INPUT_H +#ifndef WOWLET_INPUT_H +#define WOWLET_INPUT_H #include #include @@ -26,4 +26,4 @@ public: }; -#endif //FEATHER_INPUT_H +#endif //WOWLET_INPUT_H diff --git a/src/libwalletqt/PassphraseHelper.cpp b/src/libwalletqt/PassphraseHelper.cpp index f4cea92..a0ffa18 100644 --- a/src/libwalletqt/PassphraseHelper.cpp +++ b/src/libwalletqt/PassphraseHelper.cpp @@ -1,8 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "PassphraseHelper.h" -#include #include Monero::optional PassphraseHelper::onDevicePassphraseRequest(bool & on_device) diff --git a/src/libwalletqt/PassphraseHelper.h b/src/libwalletqt/PassphraseHelper.h index 2cd1c8c..a91b5c4 100644 --- a/src/libwalletqt/PassphraseHelper.h +++ b/src/libwalletqt/PassphraseHelper.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef MONERO_GUI_PASSPHRASEHELPER_H #define MONERO_GUI_PASSPHRASEHELPER_H diff --git a/src/libwalletqt/PendingTransaction.cpp b/src/libwalletqt/PendingTransaction.cpp index a6bb47d..70f5323 100644 --- a/src/libwalletqt/PendingTransaction.cpp +++ b/src/libwalletqt/PendingTransaction.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "PendingTransaction.h" diff --git a/src/libwalletqt/PendingTransaction.h b/src/libwalletqt/PendingTransaction.h index 64cbfba..754bf4c 100644 --- a/src/libwalletqt/PendingTransaction.h +++ b/src/libwalletqt/PendingTransaction.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef PENDINGTRANSACTION_H #define PENDINGTRANSACTION_H diff --git a/src/libwalletqt/PendingTransactionInfo.cpp b/src/libwalletqt/PendingTransactionInfo.cpp index 6ae2776..17920fb 100644 --- a/src/libwalletqt/PendingTransactionInfo.cpp +++ b/src/libwalletqt/PendingTransactionInfo.cpp @@ -1,9 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "PendingTransactionInfo.h" -#include "Input.h" -#include "Transfer.h" quint64 PendingTransactionInfo::fee() const { return m_fee; diff --git a/src/libwalletqt/PendingTransactionInfo.h b/src/libwalletqt/PendingTransactionInfo.h index b6318b6..63a4907 100644 --- a/src/libwalletqt/PendingTransactionInfo.h +++ b/src/libwalletqt/PendingTransactionInfo.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. -#ifndef FEATHER_PENDINGTRANSACTIONINFO_H -#define FEATHER_PENDINGTRANSACTIONINFO_H +#ifndef WOWLET_PENDINGTRANSACTIONINFO_H +#define WOWLET_PENDINGTRANSACTIONINFO_H #include #include "ConstructionInfo.h" @@ -43,4 +43,4 @@ private: }; -#endif //FEATHER_PENDINGTRANSACTIONINFO_H +#endif //WOWLET_PENDINGTRANSACTIONINFO_H diff --git a/src/libwalletqt/Ring.h b/src/libwalletqt/Ring.h index 95fc34e..5faca5c 100644 --- a/src/libwalletqt/Ring.h +++ b/src/libwalletqt/Ring.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_RINGS_H -#define FEATHER_RINGS_H +#ifndef WOWLET_RINGS_H +#define WOWLET_RINGS_H #include #include @@ -25,4 +25,4 @@ public: std::vector ringMembers() const { return m_ringMembers; } }; -#endif //FEATHER_RINGS_H +#endif //WOWLET_RINGS_H diff --git a/src/libwalletqt/Subaddress.cpp b/src/libwalletqt/Subaddress.cpp index d046676..8518fda 100644 --- a/src/libwalletqt/Subaddress.cpp +++ b/src/libwalletqt/Subaddress.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "Subaddress.h" #include diff --git a/src/libwalletqt/Subaddress.h b/src/libwalletqt/Subaddress.h index ec86bc2..92f9c88 100644 --- a/src/libwalletqt/Subaddress.h +++ b/src/libwalletqt/Subaddress.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef SUBADDRESS_H #define SUBADDRESS_H diff --git a/src/libwalletqt/SubaddressAccount.cpp b/src/libwalletqt/SubaddressAccount.cpp index 82e19d2..db885e8 100644 --- a/src/libwalletqt/SubaddressAccount.cpp +++ b/src/libwalletqt/SubaddressAccount.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "SubaddressAccount.h" #include diff --git a/src/libwalletqt/SubaddressAccount.h b/src/libwalletqt/SubaddressAccount.h index ca04afc..e2db11e 100644 --- a/src/libwalletqt/SubaddressAccount.h +++ b/src/libwalletqt/SubaddressAccount.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef SUBADDRESSACCOUNT_H #define SUBADDRESSACCOUNT_H diff --git a/src/libwalletqt/TransactionHistory.cpp b/src/libwalletqt/TransactionHistory.cpp index 38c086c..f3ad4f8 100644 --- a/src/libwalletqt/TransactionHistory.cpp +++ b/src/libwalletqt/TransactionHistory.cpp @@ -1,17 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "TransactionHistory.h" #include "TransactionInfo.h" #include "utils/utils.h" #include "appcontext.h" -#include - -#include -#include -#include -#include -#include bool TransactionHistory::transaction(int index, std::function callback) @@ -39,6 +32,12 @@ TransactionInfo* TransactionHistory::transaction(const QString &id) return itr != m_tinfo.end() ? *itr : nullptr; } +void TransactionHistory::calcFiatInfo() { + for(const auto &tx: m_tinfo) { + tx->calcFiatInfo(); + } +} + void TransactionHistory::refresh(quint32 accountIndex) { #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) @@ -209,3 +208,74 @@ bool TransactionHistory::writeCSV(const QString &path) { data = QString("blockHeight,epoch,date,direction,amount,fiat,atomicAmount,fee,txid,label,subaddrAccount,paymentId\n%1").arg(data); return Utils::fileWrite(path, data); } + +QJsonArray TransactionHistory::toJsonArray(){ + QJsonArray return_array; + + for (const auto &tx : m_pimpl->getAll()) { + if (tx->subaddrAccount() != 0) { // only account 0 + continue; + } + + TransactionInfo info(tx, this); + + // collect column data + QDateTime timeStamp = info.timestamp(); + double amount = info.amount(); + + // calc historical fiat price + QString fiatAmount; + QString preferredCur = config()->get(Config::preferredFiatCurrency).toString(); + const double usd_price = AppContext::txFiatHistory->get(timeStamp.toString("yyyyMMdd")); + double fiat_price = usd_price * amount; + + if(preferredCur != "USD") + fiat_price = AppContext::prices->convert("USD", preferredCur, fiat_price); + double fiat_rounded = ceil(Utils::roundSignificant(fiat_price, 3) * 100.0) / 100.0; + if(fiat_price != 0) + fiatAmount = QString("%1 %2").arg(QString::number(fiat_rounded)).arg(preferredCur); + + // collect some more column data + quint64 atomicAmount = info.atomicAmount(); + quint32 subaddrAccount = info.subaddrAccount(); + QString fee = info.fee(); + QString direction = QString(""); + TransactionInfo::Direction _direction = info.direction(); + if(_direction == TransactionInfo::Direction_In) + direction = QString("in"); + else if(_direction == TransactionInfo::Direction_Out) + direction = QString("out"); + else + continue; // skip TransactionInfo::Direction_Both + + QString label = info.label(); + quint64 blockHeight = info.blockHeight(); + QString date = info.date() + " " + info.time(); + uint epoch = timeStamp.toTime_t(); + QString displayAmount = info.displayAmount(); + QString paymentId = info.paymentId(); + if(paymentId == "0000000000000000") + paymentId = ""; + + QJsonObject tx_item; + tx_item["timestamp"] = (int) epoch; + tx_item["date"] = date; + tx_item["preferred_currency"] = preferredCur; + tx_item["direction"] = direction; + tx_item["blockheight"] = (int) blockHeight; + tx_item["description"] = label; + tx_item["subaddress_account"] = (int) subaddrAccount; + tx_item["payment_id"] = paymentId; + + tx_item["amount"] = amount; + tx_item["amount_display"] = displayAmount; + tx_item["amount_fiat"] = fiatAmount; + tx_item["fiat_rounded"] = fiat_rounded; + tx_item["fiat_price"] = fiat_price; + tx_item["fee"] = fee; + + return_array.append(tx_item); + } + + return return_array; +} \ No newline at end of file diff --git a/src/libwalletqt/TransactionHistory.h b/src/libwalletqt/TransactionHistory.h index e37cf2b..9107db0 100644 --- a/src/libwalletqt/TransactionHistory.h +++ b/src/libwalletqt/TransactionHistory.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef TRANSACTIONHISTORY_H #define TRANSACTIONHISTORY_H @@ -32,12 +32,16 @@ public: Q_INVOKABLE void refresh(quint32 accountIndex); Q_INVOKABLE void setTxNote(const QString &txid, const QString ¬e); Q_INVOKABLE bool writeCSV(const QString &path); + Q_INVOKABLE QJsonArray toJsonArray(); quint64 count() const; QDateTime firstDateTime() const; QDateTime lastDateTime() const; quint64 minutesToUnlock() const; bool locked() const; +public slots: + void calcFiatInfo(); + signals: void refreshStarted() const; void refreshFinished() const; diff --git a/src/libwalletqt/TransactionInfo.cpp b/src/libwalletqt/TransactionInfo.cpp index 19e7fd1..e4beaea 100644 --- a/src/libwalletqt/TransactionInfo.cpp +++ b/src/libwalletqt/TransactionInfo.cpp @@ -1,12 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "TransactionInfo.h" #include "libwalletqt/WalletManager.h" #include "Transfer.h" #include "Ring.h" -#include -#include +#include "globals.h" +#include "appcontext.h" TransactionInfo::Direction TransactionInfo::direction() const { @@ -93,7 +93,7 @@ quint64 TransactionInfo::confirmations() const quint64 TransactionInfo::confirmationsRequired() const { - return (m_blockHeight < m_unlockTime) ? m_unlockTime - m_blockHeight : 10; + return (m_blockHeight < m_unlockTime) ? m_unlockTime - m_blockHeight : 4; } quint64 TransactionInfo::unlockTime() const @@ -111,6 +111,21 @@ QDateTime TransactionInfo::timestamp() const return m_timestamp; } +QString TransactionInfo::currentPriceStr() const +{ + return m_currentPriceStr; +} + +QString TransactionInfo::historicalRateStr() const +{ + return m_historicalRateStr; +} + +QString TransactionInfo::historicalPriceStr() const +{ + return m_historicalPriceStr; +} + QString TransactionInfo::date() const { return timestamp().date().toString(Qt::ISODate); @@ -146,6 +161,10 @@ QList TransactionInfo::destinations() const return dests; } +QList TransactionInfo::transfers() const { + return m_transfers; +} + QString TransactionInfo::rings_formatted() const { QString rings; @@ -159,6 +178,37 @@ QString TransactionInfo::rings_formatted() const return rings; } +void TransactionInfo::calcFiatInfo() { + auto const hash = this->hash(); + auto timestamp = this->timestamp().toString("yyyyMMdd"); + + if(!AppContext::prices->markets.contains("WOW")) + return; + + double fiat_rate = AppContext::prices->markets["WOW"].price_usd; + double historical_fiat_rate = AppContext::txFiatHistory->get(timestamp); + if (historical_fiat_rate == 0.0) + return; + + auto const preferredFiat = config()->get(Config::preferredFiatCurrency).toString(); + + if(preferredFiat != "USD") { + historical_fiat_rate = AppContext::prices->convert( + "USD", preferredFiat, historical_fiat_rate); + fiat_rate = AppContext::prices->convert( + "USD", preferredFiat, fiat_rate); + } + + double balance = (this->balanceDelta() / globals::cdiv); + + m_historicalRate = historical_fiat_rate; + m_historicalPrice = historical_fiat_rate * balance; + m_currentPrice = fiat_rate * balance; + m_historicalPriceStr = Utils::amountToCurrencyString(m_historicalPrice, preferredFiat, 2); + m_historicalRateStr = Utils::amountToCurrencyString(m_historicalRate, preferredFiat, 5); + m_currentPriceStr = Utils::amountToCurrencyString(m_currentPrice, preferredFiat, 2); +} + TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent) : QObject(parent) , m_amount(pimpl->amount()) @@ -191,4 +241,6 @@ TransactionInfo::TransactionInfo(const Monero::TransactionInfo *pimpl, QObject * { m_subaddrIndex.insert(i); } + + this->calcFiatInfo(); } diff --git a/src/libwalletqt/TransactionInfo.h b/src/libwalletqt/TransactionInfo.h index 63709e8..4cd1979 100644 --- a/src/libwalletqt/TransactionInfo.h +++ b/src/libwalletqt/TransactionInfo.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef TRANSACTIONINFO_H #define TRANSACTIONINFO_H @@ -71,13 +71,20 @@ public: QDateTime timestamp() const; QString date() const; QString time() const; + QString currentPriceStr() const; + QString historicalRateStr() const; + QString historicalPriceStr() const; QString paymentId() const; //! only applicable for output transactions //! used in tx details popup QList destinations() const; QString destinations_formatted() const; + QList transfers() const; QString rings_formatted() const; +public slots: + void calcFiatInfo(); + private: explicit TransactionInfo(const Monero::TransactionInfo *pimpl, QObject *parent = nullptr); private: @@ -101,6 +108,14 @@ private: QDateTime m_timestamp; quint64 m_unlockTime; bool m_coinbase; + + double m_historicalPrice = 0.0; + double m_historicalRate = 0.0; + double m_currentPrice = 0.0; + + QString m_currentPriceStr = "?"; + QString m_historicalRateStr = "?"; + QString m_historicalPriceStr = "?"; }; #endif // TRANSACTIONINFO_H diff --git a/src/libwalletqt/Transfer.h b/src/libwalletqt/Transfer.h index c9e462d..8349d41 100644 --- a/src/libwalletqt/Transfer.h +++ b/src/libwalletqt/Transfer.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef TRANSFER_H #define TRANSFER_H @@ -14,7 +14,8 @@ class Transfer : public QObject Q_PROPERTY(quint64 amount READ amount) Q_PROPERTY(QString address READ address) private: - explicit Transfer(uint64_t _amount, QString _address, QObject *parent = 0): QObject(parent), m_amount(_amount), m_address(std::move(_address)) {}; + explicit Transfer(uint64_t _amount, QString _address, QObject *parent = 0) + : QObject(parent), m_amount(_amount), m_address(std::move(_address)) {}; private: friend class TransactionInfo; friend class ConstructionInfo; diff --git a/src/libwalletqt/UnsignedTransaction.cpp b/src/libwalletqt/UnsignedTransaction.cpp index d1c9006..f61bf08 100644 --- a/src/libwalletqt/UnsignedTransaction.cpp +++ b/src/libwalletqt/UnsignedTransaction.cpp @@ -1,8 +1,7 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "UnsignedTransaction.h" -#include #include UnsignedTransaction::Status UnsignedTransaction::status() const diff --git a/src/libwalletqt/UnsignedTransaction.h b/src/libwalletqt/UnsignedTransaction.h index 892bdae..7b3a605 100644 --- a/src/libwalletqt/UnsignedTransaction.h +++ b/src/libwalletqt/UnsignedTransaction.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef UNSIGNEDTRANSACTION_H #define UNSIGNEDTRANSACTION_H diff --git a/src/libwalletqt/Wallet.cpp b/src/libwalletqt/Wallet.cpp index 5472ffd..5fb2721 100644 --- a/src/libwalletqt/Wallet.cpp +++ b/src/libwalletqt/Wallet.cpp @@ -1,14 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. + +#include #include "Wallet.h" -#include -#include -#include - -#include "PendingTransaction.h" -#include "UnsignedTransaction.h" #include "TransactionHistory.h" #include "AddressBook.h" #include "Subaddress.h" @@ -20,17 +16,6 @@ #include "model/SubaddressModel.h" #include "model/SubaddressAccountModel.h" #include "model/CoinsModel.h" -#include "wallet/api/wallet2_api.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include #include "utils/ScopeGuard.h" @@ -39,7 +24,7 @@ namespace { static const int DAEMON_BLOCKCHAIN_TARGET_HEIGHT_CACHE_TTL_SECONDS = 30; static const int WALLET_CONNECTION_STATUS_CACHE_TTL_SECONDS = 5; - static constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] = "feather.subaddress_account"; + static constexpr char ATTRIBUTE_SUBADDRESS_ACCOUNT[] = "wowlet.subaddress_account"; } Wallet::Wallet(QObject * parent) @@ -167,6 +152,15 @@ QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const return QString::fromStdString(m_walletImpl->address(accountIndex, addressIndex)); } +SubaddressIndex Wallet::subaddressIndex(const QString &address) const +{ + std::pair i; + if (!m_walletImpl->subaddressIndex(address.toStdString(), i)) { + return SubaddressIndex(-1, -1); + } + return SubaddressIndex(i.first, i.second); +} + QString Wallet::path() const { return QDir::toNativeSeparators(QString::fromStdString(m_walletImpl->path())); @@ -452,20 +446,28 @@ quint64 Wallet::daemonBlockChainTargetHeight() const bool Wallet::exportKeyImages(const QString& path, bool all) { - return m_walletImpl->exportKeyImages(path.toStdString(), all); + // @TODO: remove after WOW 0.9.0.2 tagged + feather libwallet patch + //return m_walletImpl->exportKeyImages(path.toStdString(), all); + return false; } bool Wallet::importKeyImages(const QString& path) { - return m_walletImpl->importKeyImages(path.toStdString()); + // @TODO: remove after WOW 0.9.0.2 tagged + feather libwallet patch + //return m_walletImpl->importKeyImages(path.toStdString()); + return false; } bool Wallet::exportOutputs(const QString& path, bool all) { - return m_walletImpl->exportOutputs(path.toStdString(), all); + // @TODO: remove after WOW 0.9.0.2 tagged + feather libwallet patch + //return m_walletImpl->exportOutputs(path.toStdString(), all); + return false; } bool Wallet::importOutputs(const QString& path) { - return m_walletImpl->importOutputs(path.toStdString()); + // @TODO: remove after WOW 0.9.0.2 tagged + feather libwallet patch + // return m_walletImpl->importOutputs(path.toStdString()); + return false; } bool Wallet::importTransaction(const QString& txid, const QVector& output_indeces, quint64 height, quint64 timestamp, bool miner_tx, bool pool, bool double_spend_seen) { @@ -485,6 +487,91 @@ bool Wallet::importTransaction(const QString& txid, const QVector& outp double_spend_seen); } +QString Wallet::printBlockchain() +{ + return QString::fromStdString(m_walletImpl->printBlockchain()); +} + +QString Wallet::printTransfers() +{ + return QString::fromStdString(m_walletImpl->printTransfers()); +} + +QString Wallet::printPayments() +{ + return QString::fromStdString(m_walletImpl->printPayments()); +} + +QString Wallet::printUnconfirmedPayments() +{ + return QString::fromStdString(m_walletImpl->printUnconfirmedPayments()); +} + +QString Wallet::printConfirmedTransferDetails() +{ + return QString::fromStdString(m_walletImpl->printConfirmedTransferDetails()); +} + +QString Wallet::printUnconfirmedTransferDetails() +{ + return QString::fromStdString(m_walletImpl->printUnconfirmedTransferDetails()); +} + +QString Wallet::printPubKeys() +{ + return QString::fromStdString(m_walletImpl->printPubKeys()); +} + +QString Wallet::printTxNotes() +{ + return QString::fromStdString(m_walletImpl->printTxNotes()); +} + +QString Wallet::printSubaddresses() +{ + return QString::fromStdString(m_walletImpl->printSubaddresses()); +} + +QString Wallet::printSubaddressLabels() +{ + return QString::fromStdString(m_walletImpl->printSubaddressLabels()); +} + +QString Wallet::printAdditionalTxKeys() +{ + return QString::fromStdString(m_walletImpl->printAdditionalTxKeys()); +} + +QString Wallet::printAttributes() +{ + return QString::fromStdString(m_walletImpl->printAttributes()); +} + +QString Wallet::printKeyImages() +{ + return QString::fromStdString(m_walletImpl->printKeyImages()); +} + +QString Wallet::printAccountTags() +{ + return QString::fromStdString(m_walletImpl->printAccountTags()); +} + +QString Wallet::printTxKeys() +{ + return QString::fromStdString(m_walletImpl->printTxKeys()); +} + +QString Wallet::printAddressBook() +{ + return QString::fromStdString(m_walletImpl->printAddressBook()); +} + +QString Wallet::printScannedPoolTxs() +{ + return QString::fromStdString(m_walletImpl->printScannedPoolTxs()); +} + void Wallet::startRefresh() { m_refreshEnabled = true; @@ -514,7 +601,40 @@ void Wallet::createTransactionAsync(const QString &dst_addr, const QString &paym { m_scheduler.run([this, dst_addr, payment_id, amount, mixin_count, priority] { PendingTransaction *tx = createTransaction(dst_addr, payment_id, amount, mixin_count, priority); - emit transactionCreated(tx, dst_addr, payment_id, mixin_count); + QVector address {dst_addr}; + emit transactionCreated(tx, address); + }); +} + +PendingTransaction* Wallet::createTransactionMultiDest(const QVector &dst_addr, const QVector &amount, + PendingTransaction::Priority priority) +{ + std::vector dests; + for (auto &addr : dst_addr) { + dests.push_back(addr.toStdString()); + } + + std::vector amounts; + for (auto &a : amount) { + amounts.push_back(a); + } + + // TODO: remove mixin count + Monero::PendingTransaction * ptImpl = m_walletImpl->createTransactionMultDest(dests, "", amounts, 11, static_cast(priority)); + PendingTransaction * result = new PendingTransaction(ptImpl); + return result; +} + +void Wallet::createTransactionMultiDestAsync(const QVector &dst_addr, const QVector &amount, + PendingTransaction::Priority priority) +{ + m_scheduler.run([this, dst_addr, amount, priority] { + PendingTransaction *tx = createTransactionMultiDest(dst_addr, amount, priority); + QVector addresses; + for (auto &addr : dst_addr) { + addresses.push_back(addr); + } + emit transactionCreated(tx, addresses); }); } @@ -535,7 +655,8 @@ void Wallet::createTransactionAllAsync(const QString &dst_addr, const QString &p { m_scheduler.run([this, dst_addr, payment_id, mixin_count, priority] { PendingTransaction *tx = createTransactionAll(dst_addr, payment_id, mixin_count, priority); - emit transactionCreated(tx, dst_addr, payment_id, mixin_count); + QVector address {dst_addr}; + emit transactionCreated(tx, address); }); } @@ -553,7 +674,8 @@ void Wallet::createTransactionSingleAsync(const QString &key_image, const QStrin { m_scheduler.run([this, key_image, dst_addr, outputs, priority] { PendingTransaction *tx = createTransactionSingle(key_image, dst_addr, outputs, priority); - emit transactionCreated(tx, dst_addr, "", 10); // todo: return true mixincount + QVector address {dst_addr}; + emit transactionCreated(tx, address); }); } @@ -568,7 +690,8 @@ void Wallet::createSweepUnmixableTransactionAsync() { m_scheduler.run([this] { PendingTransaction *tx = createSweepUnmixableTransaction(); - emit transactionCreated(tx, "", "", 0); + QVector address {""}; + emit transactionCreated(tx, address); }); } @@ -1085,6 +1208,18 @@ quint64 Wallet::getBytesSent() const { return m_walletImpl->getBytesSent(); } +QJsonObject Wallet::toJsonObject() { + QJsonObject obj; + obj["path"] = path(); + obj["password"] = getPassword(); + obj["address"] = address(0, 0); + obj["seed"] = getSeed(); + obj["seedLanguage"] = getSeedLanguage(); + obj["networkType"] = nettype(); + obj["walletCreationHeight"] = (int) getWalletCreationHeight(); + return obj; +} + void Wallet::onPassphraseEntered(const QString &passphrase, bool enter_on_device, bool entry_abort) { if (m_walletListener != nullptr) @@ -1136,7 +1271,9 @@ Wallet::Wallet(Monero::Wallet *w, QObject *parent) m_daemonUsername = ""; m_daemonPassword = ""; - startRefreshThread(); + if (this->status() == Status_Ok) { + startRefreshThread(); + } } Wallet::~Wallet() diff --git a/src/libwalletqt/Wallet.h b/src/libwalletqt/Wallet.h index f44edc4..5098282 100644 --- a/src/libwalletqt/Wallet.h +++ b/src/libwalletqt/Wallet.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef WALLET_H #define WALLET_H @@ -30,6 +30,24 @@ struct TxProof { QString error; }; +struct SubaddressIndex { + SubaddressIndex(int major, int minor) { + this->major = major; + this->minor = minor; + } + + bool isValid() const { + return major >= 0 && minor >= 0; + } + + bool isPrimary() const { + return major == 0 && minor == 0; + } + + int major; + int minor; +}; + class TransactionHistory; class TransactionHistoryModel; class TransactionHistoryProxyModel; @@ -139,6 +157,9 @@ public: //! returns wallet's public address Q_INVOKABLE QString address(quint32 accountIndex, quint32 addressIndex) const; + //! returns the subaddress index of the address + Q_INVOKABLE SubaddressIndex subaddressIndex(const QString &address) const; + //! returns wallet file's path QString path() const; @@ -217,6 +238,24 @@ public: //! import a transaction Q_INVOKABLE bool importTransaction(const QString& txid, const QVector& output_indeces, quint64 height, quint64 timestamp, bool miner_tx, bool pool, bool double_spend_seen); + Q_INVOKABLE QString printBlockchain(); + Q_INVOKABLE QString printTransfers(); + Q_INVOKABLE QString printPayments(); + Q_INVOKABLE QString printUnconfirmedPayments(); + Q_INVOKABLE QString printConfirmedTransferDetails(); + Q_INVOKABLE QString printUnconfirmedTransferDetails(); + Q_INVOKABLE QString printPubKeys(); + Q_INVOKABLE QString printTxNotes(); + Q_INVOKABLE QString printSubaddresses(); + Q_INVOKABLE QString printSubaddressLabels(); + Q_INVOKABLE QString printAdditionalTxKeys(); + Q_INVOKABLE QString printAttributes(); + Q_INVOKABLE QString printKeyImages(); + Q_INVOKABLE QString printAccountTags(); + Q_INVOKABLE QString printTxKeys(); + Q_INVOKABLE QString printAddressBook(); + Q_INVOKABLE QString printScannedPoolTxs(); + //! refreshes the wallet Q_INVOKABLE bool refresh(bool historyAndSubaddresses = false); @@ -244,6 +283,15 @@ public: quint64 amount, quint32 mixin_count, PendingTransaction::Priority priority); + //! creates multi-destination transaction + Q_INVOKABLE PendingTransaction * createTransactionMultiDest(const QVector &dst_addr, const QVector &amount, + PendingTransaction::Priority priority); + + //! creates async multi-destination transaction + Q_INVOKABLE void createTransactionMultiDestAsync(const QVector &dst_addr, const QVector &amount, + PendingTransaction::Priority priority); + + //! creates transaction with all outputs Q_INVOKABLE PendingTransaction * createTransactionAll(const QString &dst_addr, const QString &payment_id, quint32 mixin_count, PendingTransaction::Priority priority); @@ -402,6 +450,9 @@ public: Q_INVOKABLE quint64 getBytesReceived() const; Q_INVOKABLE quint64 getBytesSent() const; + // return as json object + QJsonObject toJsonObject(); + // TODO: setListenter() when it implemented in API signals: // emitted on every event happened with wallet @@ -427,7 +478,7 @@ signals: void deviceShowAddressShowed(); // emitted when transaction is created async - void transactionCreated(PendingTransaction * transaction, QString address, QString paymentId, quint32 mixinCount); + void transactionCreated(PendingTransaction * transaction, QVector address); void connectionStatusChanged(int status) const; void currentSubaddressAccountChanged() const; diff --git a/src/libwalletqt/WalletListenerImpl.cpp b/src/libwalletqt/WalletListenerImpl.cpp index 2a025c8..7acde93 100644 --- a/src/libwalletqt/WalletListenerImpl.cpp +++ b/src/libwalletqt/WalletListenerImpl.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "WalletListenerImpl.h" #include "Wallet.h" diff --git a/src/libwalletqt/WalletListenerImpl.h b/src/libwalletqt/WalletListenerImpl.h index 109ae59..2b250e4 100644 --- a/src/libwalletqt/WalletListenerImpl.h +++ b/src/libwalletqt/WalletListenerImpl.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef MONERO_GUI_WALLETLISTENERIMPL_H #define MONERO_GUI_WALLETLISTENERIMPL_H diff --git a/src/libwalletqt/WalletManager.cpp b/src/libwalletqt/WalletManager.cpp index 17cf353..fb0b0fc 100644 --- a/src/libwalletqt/WalletManager.cpp +++ b/src/libwalletqt/WalletManager.cpp @@ -1,17 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "libwalletqt/WalletManager.h" #include "Wallet.h" -#include "wallet/api/wallet2_api.h" -#include -#include -#include -#include -#include -#include -#include -#include //#include "qt/updater.h" #include "utils/ScopeGuard.h" @@ -264,12 +255,12 @@ QString WalletManager::displayAmount(quint64 amount) return QString::fromStdString(Monero::Wallet::displayAmount(amount)); } -quint64 WalletManager::amountFromString(const QString &amount) const +quint64 WalletManager::amountFromString(const QString &amount) { return Monero::Wallet::amountFromString(amount.toStdString()); } -quint64 WalletManager::amountFromDouble(double amount) const +quint64 WalletManager::amountFromDouble(double amount) { return Monero::Wallet::amountFromDouble(amount); } diff --git a/src/libwalletqt/WalletManager.h b/src/libwalletqt/WalletManager.h index 28b84e3..778bee1 100644 --- a/src/libwalletqt/WalletManager.h +++ b/src/libwalletqt/WalletManager.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef WALLETMANAGER_H #define WALLETMANAGER_H @@ -36,8 +36,10 @@ public: LogLevel_Min = Monero::WalletManagerFactory::LogLevel_Min, LogLevel_Max = Monero::WalletManagerFactory::LogLevel_Max, }; - + explicit WalletManager(QObject *parent = nullptr); static WalletManager * instance(); + ~WalletManager(); + // wizard: createWallet path; Q_INVOKABLE Wallet * createWallet(const QString &path, const QString &password, const QString &language, NetworkType::Type nettype = NetworkType::MAINNET, quint64 kdfRounds = 1); @@ -113,8 +115,8 @@ public: //! since we can't call static method from QML, move it to this class Q_INVOKABLE static QString displayAmount(quint64 amount); - Q_INVOKABLE quint64 amountFromString(const QString &amount) const; - Q_INVOKABLE quint64 amountFromDouble(double amount) const; + Q_INVOKABLE static quint64 amountFromString(const QString &amount); + Q_INVOKABLE static quint64 amountFromDouble(double amount); Q_INVOKABLE quint64 maximumAllowedAmount() const; // QML JS engine doesn't support unsigned integers @@ -187,9 +189,6 @@ public slots: private: friend class WalletPassphraseListenerImpl; - explicit WalletManager(QObject *parent = 0); - ~WalletManager(); - bool isMining() const; static WalletManager * m_instance; diff --git a/src/main.cpp b/src/main.cpp index 660b0cc..c0443b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,18 +1,24 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include #include #include -#include "config-feather.h" +#include "config-wowlet.h" #include "mainwindow.h" #include "cli.h" -#include "utils/utils.h" -#include "appcontext.h" -#include +#ifdef HAS_OPENVR +#include "vr/main.h" +#endif + +#ifdef HAS_ANDROID_DEBUG +#include "mobile/main.h" +#elif HAS_ANDROID +#include "mobile/main.h" +#endif #if defined(Q_OS_WIN) #include @@ -25,6 +31,7 @@ Q_IMPORT_PLUGIN(QXcbIntegrationPlugin) int main(int argc, char *argv[]) { Q_INIT_RESOURCE(assets); + qputenv("QML_DISABLE_DISK_CACHE", "1"); #if defined(Q_OS_MAC) && defined(HAS_TOR_BIN) Q_INIT_RESOURCE(assets_tor_macos); @@ -44,8 +51,12 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { argv_ << QString::fromStdString(argv[i]); } + QCoreApplication::setApplicationName("wowlet"); + QCoreApplication::setOrganizationDomain("wownero.org"); + QCoreApplication::setOrganizationName("wownero.org"); + QCommandLineParser parser; - parser.setApplicationDescription("feather"); + parser.setApplicationDescription("wowlet"); parser.addHelpOption(); parser.addVersionOption(); @@ -61,11 +72,11 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { QCommandLineOption quietModeOption(QStringList() << "quiet", "Limit console output"); parser.addOption(quietModeOption); - QCommandLineOption stagenetOption(QStringList() << "stagenet", "Stagenet is for development purposes only."); - parser.addOption(stagenetOption); - - QCommandLineOption testnetOption(QStringList() << "testnet", "Testnet is for development purposes only."); - parser.addOption(testnetOption); +// QCommandLineOption stagenetOption(QStringList() << "stagenet", "Stagenet is for development purposes only."); +// parser.addOption(stagenetOption); +// +// QCommandLineOption testnetOption(QStringList() << "testnet", "Testnet is for development purposes only."); +// parser.addOption(testnetOption); QCommandLineOption walletPathOption(QStringList() << "wallet-file", "Path to wallet keys file.", "file"); parser.addOption(walletPathOption); @@ -82,6 +93,30 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { QCommandLineOption exportTxHistoryOption(QStringList() << "export-txhistory", "Output wallet transaction history as CSV to specified path.", "file"); parser.addOption(exportTxHistoryOption); + QCommandLineOption backgroundOption(QStringList() << "daemon", "Start WOWlet in the background and start a websocket server (IPv4:port)", "backgroundAddress"); + parser.addOption(backgroundOption); + + QCommandLineOption backgroundPasswordOption(QStringList() << "daemon-password", "Password for connecting to the wowlet websocket service", "backgroundPassword"); + parser.addOption(backgroundPasswordOption); + + QCommandLineOption openVROption(QStringList() << "openvr", "Start Wowlet OpenVR"); + parser.addOption(openVROption); + + QCommandLineOption openVRDebugOption(QStringList() << "openvr-debug", "Start the Wowlet VR interface without initializing OpenVR - for debugging purposes. Requires -DOPENVR=ON CMake definition."); + parser.addOption(openVRDebugOption); + + QCommandLineOption androidDebugOption(QStringList() << "android-debug", "Start the Android interface without actually running on Android - for debugging purposes. Requires -DANDROID_DEBUG=ON CMake definition."); + parser.addOption(androidDebugOption); + + QCommandLineOption backendHostOption(QStringList() << "backend-host", "specify your own `wowlet-backend` host", "backend-host"); + parser.addOption(backendHostOption); + + QCommandLineOption backendPortOption(QStringList() << "backend-port", "specify your own `wowlet-backend` port", "backend-port"); + parser.addOption(backendPortOption); + + QCommandLineOption backendTLS(QStringList() << "backend-tls", "`wowlet-backend` is running via TLS? 'wss://' and 'https://' will be used.", "backend-tls"); + parser.addOption(backendTLS); + auto parsed = parser.parse(argv_); if(!parsed) { qCritical() << parser.errorText(); @@ -91,20 +126,52 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { const QStringList args = parser.positionalArguments(); bool debugMode = parser.isSet(debugModeOption); bool localTor = parser.isSet(useLocalTorOption); - bool stagenet = parser.isSet(stagenetOption); - bool testnet = parser.isSet(testnetOption); + bool stagenet = false; + bool testnet = false; bool quiet = parser.isSet(quietModeOption); bool exportContacts = parser.isSet(exportContactsOption); bool exportTxHistory = parser.isSet(exportTxHistoryOption); - bool cliMode = exportContacts || exportTxHistory; + bool backgroundAddressEnabled = parser.isSet(backgroundOption); + bool openVREnabled = parser.isSet(openVROption); + bool cliMode = exportContacts || exportTxHistory || backgroundAddressEnabled; + bool androidDebug = parser.isSet(androidDebugOption); + bool android = false; +#ifdef __ANDROID__ + android = true; +#endif + qRegisterMetaType>(); + +#ifdef __ANDROID__ + if(android || androidDebug) { + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication mobile_app(argc, argv); + auto *ctx = new AppContext(&parser); + auto *mobile = new mobile::Mobile(ctx, &parser, &mobile_app); + return mobile_app.exec(); + } +#endif + + if(openVREnabled) { +#ifdef HAS_OPENVR + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QApplication vr_app(argc, argv); + auto *ctx = new AppContext(&parser); + auto *vr = new wowletvr::WowletVR(ctx, &parser, &vr_app); + if(vr->errors.length() > 0) + return 1; + + vr->render(); + return vr_app.exec(); +#else + qCritical() << "Wowlet compiled without OpenVR support."; + exit(1); +#endif + } if(cliMode) { - QCoreApplication cli_app(argc, argv); - QCoreApplication::setApplicationName("feather"); - QCoreApplication::setOrganizationDomain("featherwallet.org"); - QCoreApplication::setOrganizationName("featherwallet.org"); - auto *ctx = new AppContext(&parser); + QCoreApplication cli_app(argc, argv); + ctx->applicationPath = QString(argv[0]); ctx->isDebug = debugMode; @@ -120,6 +187,27 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { if(!quiet) qInfo() << "CLI mode: Transaction history export"; cli->mode = CLIMode::CLIModeExportTxHistory; + QTimer::singleShot(0, cli, &CLI::run); + } else if(backgroundAddressEnabled) { + if(!quiet) + qInfo() << "CLI mode: daemonize"; + cli->mode = CLIMode::CLIDaemonize; + + auto backgroundHostPort = parser.value(backgroundOption); + if(!backgroundHostPort.contains(":")) { + qCritical() << "the format is: --background ipv4:port"; + return 1; + } + + auto spl = backgroundHostPort.split(":"); + cli->backgroundWebsocketAddress = spl.at(0); + cli->backgroundWebsocketPort = (quint16) spl.at(1).toInt(); + cli->backgroundWebsocketPassword = parser.value(backgroundPasswordOption); + if(cli->backgroundWebsocketPassword.isEmpty()) { + qCritical() << "--daemon-password needs to be set when using --daemon"; + return 1; + } + QTimer::singleShot(0, cli, &CLI::run); } @@ -129,25 +217,23 @@ if (AttachConsole(ATTACH_PARENT_PROCESS)) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); QApplication::setDesktopSettingsAware(true); // use system font - QApplication::setApplicationVersion(FEATHER_VERSION); + QApplication::setApplicationVersion(WOWLET_VERSION); QApplication app(argc, argv); - QApplication::setApplicationName("feather"); - QApplication::setOrganizationDomain("featherwallet.org"); - QApplication::setOrganizationName("featherwallet.org"); - parser.process(app); // Parse again for --help and --version if(!quiet) { QMap info; info["Qt"] = QT_VERSION_STR; - info["Feather"] = FEATHER_VERSION; + info["WOWlet"] = WOWLET_VERSION; if (stagenet) info["Mode"] = "Stagenet"; else if (testnet) info["Mode"] = "Testnet"; else info["Mode"] = "Mainnet"; +#ifndef QT_NO_SSL info["SSL"] = QSslSocket::sslLibraryVersionString(); info["SSL build"] = QSslSocket::sslLibraryBuildVersionString(); +#endif for (const auto &k: info.keys()) qWarning().nospace().noquote() << QString("%1: %2").arg(k).arg(info[k]); } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e6708d8..4309440 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,17 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include #include +#include #include #include +#include +#include #include -#include #include "mainwindow.h" -#include "widgets/ccswidget.h" -#include "widgets/redditwidget.h" #include "dialog/txconfdialog.h" #include "dialog/txconfadvdialog.h" #include "dialog/debuginfodialog.h" @@ -20,25 +20,17 @@ #include "dialog/viewonlydialog.h" #include "dialog/broadcasttxdialog.h" #include "dialog/tximportdialog.h" +#include "dialog/updatedialog.h" #include "dialog/passworddialog.h" #include "dialog/balancedialog.h" -#include "utils/utils.h" -#include "utils/config.h" -#include "utils/daemonrpc.h" -#include "components.h" -#include "calcwindow.h" +#include "dialog/WalletCacheDebugDialog.h" #include "ui_mainwindow.h" #include "globals.h" +#include "config-wowlet.h" +#include "utils/ColorScheme.h" // libwalletqt -#include "libwalletqt/WalletManager.h" -#include "Wallet.h" -#include "libwalletqt/TransactionHistory.h" -#include "libwalletqt/SubaddressAccount.h" #include "libwalletqt/AddressBook.h" -#include "model/SubaddressAccountModel.h" -#include "model/SubaddressModel.h" -#include "utils/networktype.h" MainWindow * MainWindow::pMainWindow = nullptr; @@ -50,6 +42,8 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : pMainWindow = this; ui->setupUi(this); + ui->label_outdated->setVisible(false); + m_windowSettings = new Settings(this); m_aboutDialog = new AboutDialog(this); m_windowCalc = new CalcWindow(this); @@ -88,6 +82,8 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : connect(ui->actionQuit, &QAction::triggered, this, &MainWindow::menuQuitClicked); connect(ui->actionSettings, &QAction::triggered, this, &MainWindow::menuSettingsClicked); connect(ui->actionCalculator, &QAction::triggered, this, &MainWindow::showCalcWindow); + connect(ui->actionPay_to_many, &QAction::triggered, this, &MainWindow::payToMany); + connect(ui->actionWallet_cache_debug, &QAction::triggered, this, &MainWindow::showWalletCacheDebugDialog); #if defined(Q_OS_WIN) || defined(Q_OS_MACOS) ui->actionCreateDesktopEntry->setDisabled(true); @@ -98,41 +94,29 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : }); connect(ui->actionReport_bug, &QAction::triggered, [this](){ QMessageBox::information(this, "Reporting Bugs", - "Please report any bugs as issues on our git repo:
\n" - "https://git.wownero.com/feather/feather/issues

" + "Please report any bugs as issues on the forum:
\n" + "https://forum.wownero.com/

" "\n" - "Before reporting a bug, upgrade to the most recent version of Feather " + "Before reporting a bug, upgrade to the most recent version of WOWlet " "(latest release or git HEAD), and include the version number in your report. " "Try to explain not only what the bug is, but how it occurs."); }); connect(ui->actionShow_debug_info, &QAction::triggered, this, &MainWindow::showDebugInfo); - connect(ui->actionOfficialWebsite, &QAction::triggered, [=] { Utils::externalLinkWarning(this, "https://featherwallet.org"); }); - -#if defined(HAS_XMRTO) - // xmr.to connects/widget - connect(ui->xmrToWidget, &XMRToWidget::viewOrder, m_ctx->XMRTo, &XmrTo::onViewOrder); - connect(ui->xmrToWidget, &XMRToWidget::getRates, m_ctx->XMRTo, &XmrTo::onGetRates); - connect(ui->xmrToWidget, &XMRToWidget::createOrder, m_ctx->XMRTo, &XmrTo::createOrder); - connect(m_ctx->XMRTo, &XmrTo::ratesUpdated, ui->xmrToWidget, &XMRToWidget::onRatesUpdated); - connect(m_ctx->XMRTo, &XmrTo::connectionError, ui->xmrToWidget, &XMRToWidget::onConnectionError); - connect(m_ctx->XMRTo, &XmrTo::connectionSuccess, ui->xmrToWidget, &XMRToWidget::onConnectionSuccess); - connect(m_ctx, &AppContext::balanceUpdated, ui->xmrToWidget, &XMRToWidget::onBalanceUpdated); - connect(m_ctx->XMRTo, &XmrTo::openURL, this, [=](const QString &url){ Utils::externalLinkWarning(this, url); }); - ui->xmrToWidget->setHistoryModel(m_ctx->XMRTo->tableModel); -#else - ui->tabExchanges->setTabVisible(0, false); -#endif + connect(ui->actionOfficialWebsite, &QAction::triggered, [=] { Utils::externalLinkWarning(this, "https://wownero.org"); }); #if defined(Q_OS_LINUX) // system tray m_trayIcon = new QSystemTrayIcon(QIcon(":/assets/images/appicons/64x64.png")); m_trayIcon->show(); + m_trayActionHome = new QAction("Show", this); + m_trayActionHome->setStatusTip("Show"); + m_trayActionCalc = new QAction("Calc", this); m_trayActionCalc->setStatusTip("Calculator"); m_trayActionSend = new QAction("Send", this); - m_trayActionSend->setStatusTip("Send XMR payment"); + m_trayActionSend->setStatusTip("Send a WOW payment"); m_trayActionHistory = new QAction("History", this); m_trayActionHistory->setStatusTip("View incoming transfers"); @@ -140,6 +124,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : m_trayActionExit = new QAction("Quit", this); m_trayActionExit->setStatusTip("Exit application"); + m_trayMenu.addAction(m_trayActionHome); m_trayMenu.addAction(m_trayActionSend); m_trayMenu.addAction(m_trayActionHistory); m_trayMenu.addAction(m_trayActionCalc); @@ -147,6 +132,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : m_trayIcon->setContextMenu(&m_trayMenu); // @TODO: only init tray *after* boot + connect(m_trayActionHome, &QAction::triggered, this, &MainWindow::showHomeWindow); connect(m_trayActionCalc, &QAction::triggered, this, &MainWindow::showCalcWindow); connect(m_trayActionSend, &QAction::triggered, this, &MainWindow::showSendTab); connect(m_trayActionHistory, &QAction::triggered, this, &MainWindow::showHistoryTab); @@ -154,52 +140,76 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : #endif // ticker widgets - m_tickerWidgets.append(new TickerWidget(this, "XMR")); - m_tickerWidgets.append(new TickerWidget(this, "BTC")); - for(auto tickerWidget: m_tickerWidgets) { - ui->tickerLayout->addWidget(tickerWidget); - } + m_tickerWOW = new TickerWidget(this, "WOW"); + ui->tickerLayout->addWidget(m_tickerWOW); - m_balanceWidget = new TickerWidget(this, "XMR", "Balance", true, true); + m_tickerSAT = new TickerWidget(this, "Satoshi"); + m_tickerSAT->hidePct(true); + ui->tickerLayout->addWidget(m_tickerSAT); + + m_tickerBTC = new TickerWidget(this, "BTC"); + ui->tickerLayout->addWidget(m_tickerBTC); + + m_tickerXMR = new TickerWidget(this, "XMR"); + ui->tickerLayout->addWidget(m_tickerXMR); + + m_balanceWidget = new TickerWidget(this, "Balance"); + m_balanceWidget->hidePct(true); ui->fiatTickerLayout->addWidget(m_balanceWidget); + connect(m_tickerWOW, &TickerWidget::reload, this, &MainWindow::onUpdateWowWidget); + connect(m_tickerBTC, &TickerWidget::reload, this, &MainWindow::onUpdateBTCWidget); + connect(m_tickerSAT, &TickerWidget::reload, this, &MainWindow::onUpdateSATWidget); + connect(m_tickerSAT, &TickerWidget::reload, this, &MainWindow::onUpdateXMRWidget); + connect(m_balanceWidget, &TickerWidget::reload, this, &MainWindow::onUpdateFiatBalanceWidget); + // Send widget - connect(ui->sendWidget, &SendWidget::createTransaction, m_ctx, QOverload::of(&AppContext::onCreateTransaction)); + connect(ui->sendWidget, &SendWidget::createTransaction, m_ctx, QOverload::of(&AppContext::onCreateTransaction)); + connect(ui->sendWidget, &SendWidget::createTransactionMultiDest, m_ctx, &AppContext::onCreateTransactionMultiDest); // Nodes connect(m_ctx->nodes, &Nodes::nodeExhausted, this, &MainWindow::showNodeExhaustedMessage); connect(m_ctx->nodes, &Nodes::WSNodeExhausted, this, &MainWindow::showWSNodeExhaustedMessage); // XMRig -#ifdef HAS_XMRIG m_xmrig = new XMRigWidget(m_ctx, this); ui->xmrRigLayout->addWidget(m_xmrig); connect(m_ctx->XMRig, &XmRig::output, m_xmrig, &XMRigWidget::onProcessOutput); connect(m_ctx->XMRig, &XmRig::error, m_xmrig, &XMRigWidget::onProcessError); + connect(m_ctx->XMRig, &XmRig::output, m_xmrig, &XMRigWidget::daemonOutput); + connect(m_ctx->XMRig, &XmRig::error, m_xmrig, &XMRigWidget::daemonOutput); + connect(m_ctx->XMRig, &XmRig::blockReward, m_xmrig, &XMRigWidget::onBlockReward); connect(m_ctx->XMRig, &XmRig::hashrate, m_xmrig, &XMRigWidget::onHashrate); + connect(m_ctx->XMRig, &XmRig::daemonStateChanged, m_xmrig, &XMRigWidget::onDaemonStateChanged); + connect(m_ctx->XMRig, &XmRig::syncStatus, m_xmrig, &XMRigWidget::onSyncStatus); + connect(m_ctx->XMRig, &XmRig::uptimeChanged, m_xmrig, &XMRigWidget::onUptimeChanged); + connect(m_ctx->XMRig, &XmRig::daemonStateChanged, [=](DaemonMiningState state) { + m_ctx->setWindowTitle(state >= DaemonMiningState::mining); + }); connect(m_ctx, &AppContext::walletClosed, m_xmrig, &XMRigWidget::onWalletClosed); connect(m_ctx, &AppContext::walletOpened, m_xmrig, &XMRigWidget::onWalletOpened); - connect(m_ctx, &AppContext::XMRigDownloads, m_xmrig, &XMRigWidget::onDownloads); - - connect(m_xmrig, &XMRigWidget::miningStarted, [=]{ m_ctx->setWindowTitle(true); }); - connect(m_xmrig, &XMRigWidget::miningEnded, [=]{ m_ctx->setWindowTitle(false); }); -#else - ui->tabWidget->setTabVisible(Tabs::XMRIG, false); -#endif + connect(m_ctx, &AppContext::XMRigDownloads, m_xmrig, &XMRigWidget::onRigDownloads); + connect(m_ctx, &AppContext::WownerodDownloads, m_xmrig, &XMRigWidget::onWownerodDownloads); connect(ui->ccsWidget, &CCSWidget::selected, this, &MainWindow::showSendScreen); connect(m_ctx, &AppContext::ccsUpdated, ui->ccsWidget->model(), &CCSModel::updateEntries); connect(m_ctx, &AppContext::redditUpdated, ui->redditWidget->model(), &RedditModel::updatePosts); + connect(m_ctx, &AppContext::forumUpdated, ui->forumWidget->model(), &ForumModel::updatePosts); + connect(m_ctx, &AppContext::suchWowUpdated, ui->suchWowWidget, &SuchWowWidget::onWS); + connect(ui->suchWowWidget, &SuchWowWidget::donate, this, &MainWindow::suchDonate); + connect(ui->redditWidget, &RedditWidget::setStatusText, this, &MainWindow::setStatusText); + + connect(ui->tabWidget, &QTabWidget::currentChanged, m_xmrig, &XMRigWidget::onMenuTabChanged); connect(ui->tabHomeWidget, &QTabWidget::currentChanged, [](int index){ - config()->set(Config::homeWidget, TabsHome(index)); + config()->set(Config::homeWidget, globals::TabsHome(index)); }); connect(m_ctx, &AppContext::donationNag, [=]{ - auto msg = "Feather is a 100% community-sponsored endeavor. Please consider supporting " + auto msg = "WOWlet is a 100% community-sponsored endeavor. Please consider supporting " "the project financially. Get rid of this message by donating any amount."; - int ret = QMessageBox::information(this, "Donate to Feather", msg, QMessageBox::Yes, QMessageBox::No); + int ret = QMessageBox::information(this, "Donate to WOWlet", msg, QMessageBox::Yes, QMessageBox::No); switch (ret) { case QMessageBox::Yes: this->donateButtonClicked(); @@ -211,11 +221,12 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : }); // libwalletqt - connect(this, &MainWindow::walletClosed, ui->xmrToWidget, &XMRToWidget::onWalletClosed); - connect(this, &MainWindow::walletClosed, ui->sendWidget, &SendWidget::onWalletClosed); + connect(m_ctx, &AppContext::walletClosed, [this]{ + this->onWalletClosed(); + }); + connect(m_ctx, &AppContext::walletClosed, ui->sendWidget, &SendWidget::onWalletClosed); connect(m_ctx, &AppContext::balanceUpdated, this, &MainWindow::onBalanceUpdated); connect(m_ctx, &AppContext::walletOpened, this, &MainWindow::onWalletOpened); - connect(m_ctx, &AppContext::walletClosed, this, QOverload<>::of(&MainWindow::onWalletClosed)); connect(m_ctx, &AppContext::walletOpenedError, this, &MainWindow::onWalletOpenedError); connect(m_ctx, &AppContext::walletCreatedError, this, &MainWindow::onWalletCreatedError); connect(m_ctx, &AppContext::walletCreated, this, &MainWindow::onWalletCreated); @@ -231,10 +242,6 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : connect(m_ctx, &AppContext::initiateTransaction, ui->sendWidget, &SendWidget::onInitiateTransaction); connect(m_ctx, &AppContext::endTransaction, ui->sendWidget, &SendWidget::onEndTransaction); - // XMR.to - connect(m_ctx, &AppContext::initiateTransaction, ui->xmrToWidget, &XMRToWidget::onInitiateTransaction); - connect(m_ctx, &AppContext::endTransaction, ui->xmrToWidget, &XMRToWidget::onEndTransaction); - connect(m_ctx, &AppContext::initiateTransaction, [this]{ m_statusDots = 0; m_constructingTransaction = true; @@ -252,7 +259,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : // testnet/stagenet warning - auto worthlessWarning = QString("Feather wallet is currently running in %1 mode. This is meant " + auto worthlessWarning = QString("WOWlet is currently running in %1 mode. This is meant " "for developers only. Your coins are WORTHLESS."); if(m_ctx->networkType == NetworkType::STAGENET) { if (config()->get(Config::warnOnStagenet).toBool()) { @@ -267,19 +274,13 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : } } - if(config()->get(Config::warnOnAlpha).toBool()) { - QString warning = "Feather Wallet is currently in beta.\n\nPlease report any bugs " - "you encounter on our Git repository, IRC or on /r/FeatherWallet."; - QMessageBox::warning(this, "Beta Warning", warning); - config()->set(Config::warnOnAlpha, false); - } - // settings connects - // Update ticker widget(s) on home tab when settings preferred fiat currency is changed - for(auto tickerWidget: m_tickerWidgets) - connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, tickerWidget, &TickerWidget::init); - connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_balanceWidget, &TickerWidget::init); + connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateFiatBalanceWidget); + connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateWowWidget); + connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateBTCWidget); + connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, this, &MainWindow::onUpdateXMRWidget); connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, m_ctx, &AppContext::onPreferredFiatCurrencyChanged); + connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->suchWowWidget, &SuchWowWidget::onPreferredFiatCurrencyChanged); connect(m_windowSettings, &Settings::preferredFiatCurrencyChanged, ui->sendWidget, QOverload<>::of(&SendWidget::onPreferredFiatCurrencyChanged)); // Skin @@ -294,19 +295,21 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : // Receive connect(ui->receiveWidget, &ReceiveWidget::generateSubaddress, [=]() { m_ctx->currentWallet->subaddress()->addRow( m_ctx->currentWallet->currentSubaddressAccount(), ""); - m_ctx->storeWallet(); }); connect(ui->receiveWidget, &ReceiveWidget::showTransactions, [this](const QString &text) { ui->historyWidget->setSearchText(text); - ui->tabWidget->setCurrentIndex(Tabs::HISTORY); + ui->tabWidget->setCurrentIndex(globals::Tabs::HISTORY); }); // History connect(ui->historyWidget, &HistoryWidget::viewOnBlockExplorer, this, &MainWindow::onViewOnBlockExplorer); connect(ui->historyWidget, &HistoryWidget::resendTransaction, this, &MainWindow::onResendTransaction); + connect(m_ctx, &AppContext::walletRefreshed, ui->historyWidget, &HistoryWidget::onWalletRefreshed); + connect(m_ctx, &AppContext::walletOpened, ui->historyWidget, &HistoryWidget::onWalletOpened); // Contacts connect(ui->contactWidget, &ContactsWidget::fillAddress, ui->sendWidget, &SendWidget::fillAddress); + connect(m_ctx, &AppContext::yellowUpdated, ui->contactWidget, &ContactsWidget::loadYellowPages); // Open alias connect(ui->sendWidget, &SendWidget::resolveOpenAlias, m_ctx, &AppContext::onOpenAliasResolve); @@ -314,45 +317,46 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : connect(m_ctx, &AppContext::openAliasResolved, ui->sendWidget, &SendWidget::onOpenAliasResolved); // Coins - connect(ui->coinsWidget, &CoinsWidget::freeze, [=](int index) { - m_ctx->currentWallet->coins()->freeze(index); - m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); - m_ctx->updateBalance(); - // subaddress account filtering should be done in Model maybe, so we can update data in coins() directly - }); - connect(ui->coinsWidget, &CoinsWidget::freezeMulti, [&](const QVector& indexes) { + connect(ui->coinsWidget, &CoinsWidget::freeze, [&](const QVector& indexes) { for (int i : indexes) { m_ctx->currentWallet->coins()->freeze(i); - m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); - m_ctx->updateBalance(); } - }); - connect(ui->coinsWidget, &CoinsWidget::thaw, [=](int index) { - m_ctx->currentWallet->coins()->thaw(index); m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); m_ctx->updateBalance(); }); - connect(ui->coinsWidget, &CoinsWidget::thawMulti, [&](const QVector& indexes) { + connect(ui->coinsWidget, &CoinsWidget::thaw, [&](const QVector& indexes) { for (int i : indexes) { m_ctx->currentWallet->coins()->thaw(i); - m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); - m_ctx->updateBalance(); } + m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); + m_ctx->updateBalance(); }); connect(ui->coinsWidget, &CoinsWidget::sweepOutput, m_ctx, &AppContext::onSweepOutput); - connect(m_ctx, &AppContext::walletClosing, [=]{ - ui->tabWidget->setCurrentIndex(Tabs::HOME); + connect(m_ctx, &AppContext::walletAboutToClose, [=]{ + if (!config()->get(Config::showTabHome).toBool()) + ui->tabWidget->setCurrentIndex(globals::Tabs::HISTORY); + else + ui->tabWidget->setCurrentIndex(globals::Tabs::HOME); + + // Clear all tables when wallet is closed + ui->historyWidget->resetModel(); + ui->contactWidget->resetModel(); + ui->receiveWidget->resetModel(); + ui->coinsWidget->resetModel(); }); // window title connect(m_ctx, &AppContext::setTitle, this, &QMainWindow::setWindowTitle); + // Version warning + connect(m_ctx, &AppContext::versionOutdated, this, &MainWindow::onVersionWarning); + // init touchbar #ifdef Q_OS_MAC m_touchbar = new KDMacTouchBar(this); - m_touchbarActionWelcome = new QAction(QIcon(":/assets/images/feather.png"), "Welcome to Feather!"); - m_touchbarWalletItems = {ui->actionSettings, ui->actionCalculator, ui->actionKeys, ui->actionDonate_to_Feather}; + m_touchbarActionWelcome = new QAction(QIcon(":/assets/images/wowlet.png"), "Welcome to WOWlet!"); + m_touchbarWalletItems = {ui->actionSettings, ui->actionCalculator, ui->actionKeys, ui->actionDonate_to_Wowlet}; m_touchbarWizardItems = {m_touchbarActionWelcome}; #endif @@ -362,6 +366,7 @@ MainWindow::MainWindow(AppContext *ctx, QWidget *parent) : this->initMenu(); connect(&m_updateBytes, &QTimer::timeout, this, &MainWindow::updateNetStats); + ColorScheme::updateFromWidget(this); } void MainWindow::initMain() { @@ -388,6 +393,7 @@ void MainWindow::initMain() { this->setEnabled(false); this->show(); m_wizard = this->createWizard(WalletWizard::Page_Menu); + m_wizard->randomBanner(); m_wizard->show(); this->touchbarShowWizard(); } @@ -404,6 +410,10 @@ void MainWindow::initMenu() { // hide/show tabs m_tabShowHideSignalMapper = new QSignalMapper(this); + connect(ui->actionShow_Home, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); + m_tabShowHideMapper["Home"] = new ToggleTab(ui->tabHome, "Home", "Home", ui->actionShow_Home, Config::showTabHome); + m_tabShowHideSignalMapper->setMapping(ui->actionShow_Home, "Home"); + connect(ui->actionShow_Coins, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); m_tabShowHideMapper["Coins"] = new ToggleTab(ui->tabCoins, "Coins", "Coins", ui->actionShow_Coins, Config::showTabCoins); m_tabShowHideSignalMapper->setMapping(ui->actionShow_Coins, "Coins"); @@ -412,21 +422,9 @@ void MainWindow::initMenu() { m_tabShowHideMapper["Calc"] = new ToggleTab(ui->tabCalc, "Calc", "Calc", ui->actionShow_calc, Config::showTabCalc); m_tabShowHideSignalMapper->setMapping(ui->actionShow_calc, "Calc"); -#if defined(HAS_XMRTO) - connect(ui->actionShow_Exchange, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); - m_tabShowHideMapper["Exchange"] = new ToggleTab(ui->tabExchange, "Exchange", "Exchange", ui->actionShow_Exchange, Config::showTabExchange); - m_tabShowHideSignalMapper->setMapping(ui->actionShow_Exchange, "Exchange"); -#else - ui->actionShow_Exchanges->setVisible(false); -#endif - -#if defined(HAS_XMRIG) connect(ui->actionShow_XMRig, &QAction::triggered, m_tabShowHideSignalMapper, QOverload<>::of(&QSignalMapper::map)); m_tabShowHideMapper["Mining"] = new ToggleTab(ui->tabXmrRig, "Mining", "Mining", ui->actionShow_XMRig, Config::showTabXMRig); m_tabShowHideSignalMapper->setMapping(ui->actionShow_XMRig, "Mining"); -#else - ui->actionShow_XMRig->setVisible(false); -#endif for (const auto &key: m_tabShowHideMapper.keys()) { const auto toggleTab = m_tabShowHideMapper.value(key); @@ -441,6 +439,7 @@ void MainWindow::initMenu() { connect(ui->actionSeed, &QAction::triggered, this, &MainWindow::showSeedDialog); connect(ui->actionPassword, &QAction::triggered, this, &MainWindow::showPasswordDialog); connect(ui->actionKeys, &QAction::triggered, this, &MainWindow::showKeysDialog); + connect(this, &MainWindow::updateDialog, this, &MainWindow::showUpdateDialog); connect(ui->actionViewOnly, &QAction::triggered, this, &MainWindow::showViewOnlyDialog); connect(ui->actionStore_wallet, &QAction::triggered, [this]{ m_ctx->currentWallet->store(); @@ -461,7 +460,7 @@ void MainWindow::initMenu() { connect(ui->actionChange_restore_height, &QAction::triggered, this, &MainWindow::showRestoreHeightDialog); connect(m_ctx, &AppContext::customRestoreHeightSet, [=](int height){ auto msg = QString("The restore height for this wallet has been set to %1. " - "Please re-open the wallet. Feather will now quit.").arg(height); + "Please re-open the wallet. WOWlet will now quit.").arg(height); QMessageBox::information(this, "Cannot set custom restore height", msg); this->menuQuitClicked(); }); @@ -489,7 +488,7 @@ void MainWindow::initMenu() { if(targetDir.isEmpty()) return; qint64 now = QDateTime::currentDateTime().currentMSecsSinceEpoch(); - QString fn = QString("%1/monero-contacts_%2.csv").arg(targetDir, QString::number(now / 1000)); + QString fn = QString("%1/wownero-contacts_%2.csv").arg(targetDir, QString::number(now / 1000)); if(model->writeCSV(fn)) QMessageBox::information(this, "Address book exported", QString("Address book exported to %1").arg(fn)); }); @@ -507,7 +506,7 @@ void MainWindow::initMenu() { // About screen connect(ui->actionAbout, &QAction::triggered, this, &MainWindow::menuAboutClicked); - connect(ui->actionDonate_to_Feather, &QAction::triggered, this, &MainWindow::donateButtonClicked); + connect(ui->actionDonate_to_Wowlet, &QAction::triggered, this, &MainWindow::donateButtonClicked); // Close wallet connect(ui->actionClose, &QAction::triggered, this, &MainWindow::menuWalletCloseClicked); @@ -524,13 +523,17 @@ void MainWindow::menuToggleTabVisible(const QString &key){ void MainWindow::initWidgets() { int homeWidget = config()->get(Config::homeWidget).toInt(); - ui->tabHomeWidget->setCurrentIndex(TabsHome(homeWidget)); + ui->tabHomeWidget->setCurrentIndex(globals::TabsHome(homeWidget)); } WalletWizard *MainWindow::createWizard(WalletWizard::Page startPage){ auto *wizard = new WalletWizard(m_ctx, startPage, this); connect(wizard, &WalletWizard::openWallet, m_ctx, &AppContext::onOpenWallet); connect(wizard, &WalletWizard::defaultWalletDirChanged, m_windowSettings, &Settings::updatePaths); + connect(wizard, &WalletWizard::rejected, [this]{ + this->cleanupBeforeClose(); + QCoreApplication::quit(); + }); return wizard; } @@ -541,18 +544,13 @@ void MainWindow::showWizard(WalletWizard::Page startPage) { m_wizard->setStartId(startPage); m_wizard->restart(); m_wizard->setEnabled(true); + m_wizard->randomBanner(); m_wizard->show(); } -void MainWindow::onWalletClosed() { - this->onWalletClosed(WalletWizard::Page_Menu); -} - void MainWindow::onWalletClosed(WalletWizard::Page page) { - emit walletClosed(); m_statusLabelBalance->clear(); m_statusLabelStatus->clear(); - this->setWindowTitle("Feather"); this->showWizard(page); } @@ -596,18 +594,16 @@ void MainWindow::onWalletOpenPasswordRequired(bool invalidPassword, const QStrin void MainWindow::onWalletOpenedError(const QString &err) { qDebug() << Q_FUNC_INFO << QString("Wallet open error: %1").arg(err); QMessageBox::warning(this, "Wallet open error", err); - this->setWindowTitle("Feather"); + this->setWindowTitle("WOWlet"); this->showWizard(WalletWizard::Page_OpenWallet); this->touchbarShowWizard(); } void MainWindow::onWalletCreated(Wallet *wallet) { qDebug() << Q_FUNC_INFO; - // emit signal on behalf of walletManager - m_ctx->walletManager->walletOpened(wallet); } -void MainWindow::onWalletOpened() { +void MainWindow::onWalletOpened(Wallet *wallet) { qDebug() << Q_FUNC_INFO; if(m_wizard != nullptr) { m_wizard->hide(); @@ -632,59 +628,58 @@ void MainWindow::onWalletOpened() { m_ctx->currentWallet->subaddress()->addRow(m_ctx->currentWallet->currentSubaddressAccount(), ""); } } - connect(m_ctx->currentWallet->subaddress(), &Subaddress::labelChanged, [this]{ - m_ctx->storeWallet(); - }); // history page m_ctx->currentWallet->history()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); ui->historyWidget->setModel(m_ctx->currentWallet->historyModel(), m_ctx->currentWallet); - connect(m_ctx->currentWallet->history(), &TransactionHistory::txNoteChanged, [this]{ - m_ctx->storeWallet(); - }); // contacts widget ui->contactWidget->setModel(m_ctx->currentWallet->addressBookModel()); - connect(m_ctx->currentWallet->addressBook(), &AddressBook::descriptionChanged, [this]{ - m_ctx->storeWallet(); - }); + ui->contactWidget->loadYellowPages(); // coins page m_ctx->currentWallet->coins()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); ui->coinsWidget->setModel(m_ctx->currentWallet->coinsModel(), m_ctx->currentWallet->coins()); - connect(m_ctx->currentWallet->coins(), &Coins::coinFrozen, [this]{ - m_ctx->storeWallet(); - }); - connect(m_ctx->currentWallet->coins(), &Coins::coinThawed, [this]{ - m_ctx->storeWallet(); - }); this->touchbarShowWallet(); this->updatePasswordIcon(); m_updateBytes.start(100); + + if(m_showUpdateWarning == 1) emit updateDialog(); } void MainWindow::onBalanceUpdated(quint64 balance, quint64 spendable) { qDebug() << Q_FUNC_INFO; bool hide = config()->get(Config::hideBalance).toBool(); - QString label_str = QString("Balance: %1 XMR").arg(QString::number(spendable / globals::cdiv, 'f')); + QString label_str = QString("Balance: %1 WOW").arg(Utils::balanceFormat(spendable)); if (balance > spendable) - label_str += QString(" (+%1 XMR unconfirmed)").arg(QString::number((balance - spendable) / globals::cdiv, 'f')); + label_str += QString(" (+%1 WOW unconfirmed)").arg(Utils::balanceFormat(balance - spendable)); if (hide) label_str = "Balance: HIDDEN"; m_statusLabelBalance->setToolTip("Click for details"); m_statusLabelBalance->setText(label_str); - m_balanceWidget->setHidden(hide); } -void MainWindow::setStatusText(const QString &text) { - m_statusText = text; - if (!m_constructingTransaction) +void MainWindow::setStatusText(const QString &text, bool override, int timeout) { + if (override) { + m_statusOverrideActive = true; m_statusLabelStatus->setText(text); + QTimer::singleShot(timeout, [this]{ + m_statusOverrideActive = false; + this->setStatusText(m_statusText); + }); + return; + } + + m_statusText = text; + + if (!m_statusOverrideActive && !m_constructingTransaction) { + m_statusLabelStatus->setText(text); + } } void MainWindow::onSynchronized() { @@ -701,7 +696,7 @@ void MainWindow::onBlockchainSync(int height, int target) { void MainWindow::onRefreshSync(int height, int target) { QString blocks = (target >= height) ? QString::number(target - height) : "?"; - QString heightText = QString("Wallet refresh: %1 blocks remaining").arg(blocks); + QString heightText = QString("Wallet sync: %1 blocks remaining").arg(blocks); this->setStatusText(heightText); } @@ -741,51 +736,38 @@ void MainWindow::onConnectionStatusChanged(int status) m_statusBtnConnectionStatusIndicator->setIcon(QIcon(statusIcon)); } -void MainWindow::onCreateTransactionSuccess(PendingTransaction *tx, const QString &address, const quint32 &mixin) { - auto tx_status = tx->status(); - auto err = QString("Can't create transaction: "); +void MainWindow::onCreateTransactionSuccess(PendingTransaction *tx, const QVector &address) { + const auto &description = m_ctx->tmpTxDescription; - if(tx_status != PendingTransaction::Status_Ok){ - auto tx_err = tx->errorString(); - qCritical() << tx_err; - - if (m_ctx->currentWallet->connectionStatus() == Wallet::ConnectionStatus_WrongVersion) - err = QString("%1 Wrong daemon version: %2").arg(err).arg(tx_err); - else - err = QString("%1 %2").arg(err).arg(tx_err); - - qDebug() << Q_FUNC_INFO << err; - QMessageBox::warning(this, "Transactions error", err); - m_ctx->currentWallet->disposeTransaction(tx); - } else if (tx->txCount() == 0) { - err = QString("%1 %2").arg(err).arg("No unmixable outputs to sweep."); - qDebug() << Q_FUNC_INFO << err; - QMessageBox::warning(this, "Transaction error", err); - m_ctx->currentWallet->disposeTransaction(tx); - } else { - const auto &description = m_ctx->tmpTxDescription; - - auto *dialog = new TxConfDialog(m_ctx, tx, address, description, mixin, this); - switch (dialog->exec()) { - case QDialog::Rejected: - { - if (!dialog->showAdvanced) - m_ctx->onCancelTransaction(tx, address); - break; - } - case QDialog::Accepted: - m_ctx->currentWallet->commitTransactionAsync(tx); - break; - } - - if (dialog->showAdvanced) { - auto *dialog_adv = new TxConfAdvDialog(m_ctx, description, this); - dialog_adv->setTransaction(tx); - dialog_adv->exec(); - dialog_adv->deleteLater(); - } - dialog->deleteLater(); + // Show advanced dialog on multi-destination transactions + if (address.size() > 1) { + auto *dialog_adv = new TxConfAdvDialog(m_ctx, description, this); + dialog_adv->setTransaction(tx); + dialog_adv->exec(); + dialog_adv->deleteLater(); + return; } + + auto *dialog = new TxConfDialog(m_ctx, tx, address[0], description, this); + switch (dialog->exec()) { + case QDialog::Rejected: + { + if (!dialog->showAdvanced) + m_ctx->onCancelTransaction(tx, address); + break; + } + case QDialog::Accepted: + m_ctx->currentWallet->commitTransactionAsync(tx); + break; + } + + if (dialog->showAdvanced) { + auto *dialog_adv = new TxConfAdvDialog(m_ctx, description, this); + dialog_adv->setTransaction(tx); + dialog_adv->exec(); + dialog_adv->deleteLater(); + } + dialog->deleteLater(); } void MainWindow::onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid) { @@ -834,7 +816,8 @@ void MainWindow::create_status_bar() { this->statusBar()->addWidget(m_statusLabelNetStats); m_statusLabelBalance = new ClickableLabel(this); - m_statusLabelBalance->setText("Balance: 0.00 XMR"); + m_statusLabelBalance->setText("Balance: 0 WOW"); + m_statusLabelBalance->setTextInteractionFlags(Qt::TextSelectableByMouse); this->statusBar()->addPermanentWidget(m_statusLabelBalance); connect(m_statusLabelBalance, &ClickableLabel::clicked, this, &MainWindow::showBalanceDialog); @@ -918,9 +901,15 @@ void MainWindow::updatePasswordIcon() { m_statusBtnPassword->setIcon(icon); } +void MainWindow::onVersionWarning(QString current_string, QJsonObject version_data) { + if(m_showUpdateWarning != -1) + m_showUpdateWarning = 1; + ui->label_outdated->setVisible(true); +} + void MainWindow::showRestoreHeightDialog() { // settings custom restore height is only available for 25 word seeds - auto seed = m_ctx->currentWallet->getCacheAttribute("feather.seed"); + auto seed = m_ctx->currentWallet->getCacheAttribute("wowlet.seed"); if(!seed.isEmpty()) { const auto msg = "This wallet has a 14 word mnemonic seed which has the restore height embedded."; QMessageBox::warning(this, "Cannot set custom restore height", msg); @@ -943,6 +932,17 @@ void MainWindow::showRestoreHeightDialog() { }); } +void MainWindow::showUpdateDialog() { + if(config()->get(Config::ignoreUpdateWarning).toString() == WOWLET_VERSION_SEMVER) { + m_showUpdateWarning = -1; + return; + } + + auto *dialog = new UpdateDialog(m_ctx, this); + dialog->show(); + m_showUpdateWarning = -1; +} + void MainWindow::showKeysDialog() { auto *dialog = new KeysDialog(m_ctx, this); dialog->exec(); @@ -970,13 +970,14 @@ void MainWindow::menuNewRestoreClicked() { void MainWindow::menuQuitClicked() { cleanupBeforeClose(); - QCoreApplication::quit(); } void MainWindow::menuWalletCloseClicked() { - if(m_ctx->currentWallet == nullptr) return; - m_ctx->walletClose(true); + if (m_ctx->currentWallet == nullptr) + return; + + m_ctx->closeWallet(true, true); } void MainWindow::menuWalletOpenClicked() { @@ -997,8 +998,7 @@ void MainWindow::menuWalletOpenClicked() { return; } - m_ctx->walletClose(false); - emit walletClosed(); + m_ctx->closeWallet(false); m_ctx->onOpenWallet(path, ""); } @@ -1033,45 +1033,85 @@ void MainWindow::skinChanged(const QString &skinName) { config()->set(Config::skin, skinName); qApp->setStyleSheet(m_skins[skinName]); qDebug() << QString("Skin changed to %1").arg(skinName); + ColorScheme::updateFromWidget(this); + + ui->conversionWidget->skinChanged(); } void MainWindow::closeEvent(QCloseEvent *event) { - cleanupBeforeClose(); + auto hideOnClose = config()->get(Config::hideOnClose).toBool(); + if(hideOnClose && !this->isHidden()) { + this->hide(); + event->ignore(); + return; + } + cleanupBeforeClose(); QWidget::closeEvent(event); + QApplication::exit(); } void MainWindow::donateButtonClicked() { - double donation = AppContext::prices->convert("EUR", "XMR", m_ctx->donationAmount); + double donation = AppContext::prices->convert("EUR", "WOW", m_ctx->donationAmount); if (donation <= 0) donation = 0.1337; - ui->sendWidget->fill(m_ctx->donationAddress, "Donation to the Feather development team", donation); - ui->tabWidget->setCurrentIndex(Tabs::SEND); + ui->sendWidget->fill(m_ctx->donationAddress, "Donation to the WOWlet development team", donation); + ui->tabWidget->setCurrentIndex(globals::Tabs::SEND); } void MainWindow::showHistoryTab() { this->raise(); - ui->tabWidget->setCurrentIndex(Tabs::HISTORY); + this->show(); + ui->tabWidget->setCurrentIndex(globals::Tabs::HISTORY); } void MainWindow::showSendTab() { this->raise(); - ui->tabWidget->setCurrentIndex(Tabs::SEND); + this->show(); + ui->tabWidget->setCurrentIndex(globals::Tabs::SEND); +} + +void MainWindow::showHomeWindow() { + this->raise(); + this->show(); + ui->tabWidget->setCurrentIndex(globals::Tabs::HOME); } void MainWindow::showCalcWindow() { + this->raise(); + this->show(); m_windowCalc->show(); } +void MainWindow::payToMany() { + ui->tabWidget->setCurrentIndex(globals::Tabs::SEND); + ui->sendWidget->payToMany(); + QMessageBox::information(this, "Pay to many", "Enter a list of outputs in the 'Pay to' field.\n" + "One output per line.\n" + "Format: address, amount\n" + "A maximum of 16 addresses may be specified."); +} + void MainWindow::showSendScreen(const CCSEntry &entry) { ui->sendWidget->fill(entry); - ui->tabWidget->setCurrentIndex(Tabs::SEND); + ui->tabWidget->setCurrentIndex(globals::Tabs::SEND); +} + +void MainWindow::suchDonate(const QString address) { + double tipAmount = config()->get(Config::suchWowTipAmount).toDouble(); + QString preferredCurrency = config()->get(Config::preferredFiatCurrency).toString(); + double donation = AppContext::prices->convert(preferredCurrency, "WOW", tipAmount); + ui->sendWidget->fill(address, "SuchWow contribution :-)", donation); + ui->tabWidget->setCurrentIndex(globals::Tabs::SEND); } void MainWindow::onViewOnBlockExplorer(const QString &txid) { - QString blockExplorerLink = Utils::blockExplorerLink(config()->get(Config::blockExplorer).toString(), m_ctx->networkType, txid); - Utils::externalLinkWarning(this, blockExplorerLink); + QString blockExplorerLink = Utils::blockExplorerLink(txid); + if(!blockExplorerLink.isEmpty()) + Utils::externalLinkWarning(this, blockExplorerLink); + else + QMessageBox::warning(this, "Error", "Could not generate block explorer URL"); } void MainWindow::onResendTransaction(const QString &txid) { @@ -1104,10 +1144,6 @@ void MainWindow::importContacts() { } } - if(inserts > 0) { - m_ctx->storeWallet(); - } - QMessageBox::information(this, "Contacts imported", QString("Total contacts imported: %1").arg(inserts)); } @@ -1120,6 +1156,10 @@ AppContext *MainWindow::getContext(){ } void MainWindow::loadSkins() { + QString breeze_wow = this->loadStylesheet(":/wow.qss"); + if (!breeze_wow.isEmpty()) + m_skins.insert("WOW", breeze_wow); + QString qdarkstyle = this->loadStylesheet(":qdarkstyle/style.qss"); if (!qdarkstyle.isEmpty()) m_skins.insert("QDarkStyle", qdarkstyle); @@ -1166,17 +1206,23 @@ void MainWindow::showDebugInfo() { dialog->deleteLater(); } +void MainWindow::showWalletCacheDebugDialog() { + auto *dialog = new WalletCacheDebugDialog(m_ctx, this); + dialog->exec(); + dialog->deleteLater(); +} + void MainWindow::showNodeExhaustedMessage() { // Spawning dialogs inside a lambda can cause system freezes on linux so we have to do it this way ¯\_(ツ)_/¯ - auto msg = "Feather is in 'custom node connection mode' but could not " + auto msg = "WOWlet is in 'custom node connection mode' but could not " "find an eligible node to connect to. Please go to Settings->Node " "and enter a node manually."; QMessageBox::warning(this, "Could not connect to a node", msg); } void MainWindow::showWSNodeExhaustedMessage() { - auto msg = "Feather is in 'automatic node connection mode' but the " + auto msg = "WOWlet is in 'automatic node connection mode' but the " "websocket server returned no available nodes. Please go to Settings->Node " "and enter a node manually."; QMessageBox::warning(this, "Could not connect to a node", msg); @@ -1235,8 +1281,9 @@ void MainWindow::importOutputs() { } void MainWindow::cleanupBeforeClose() { - m_ctx->walletManager->closeWallet(); + m_ctx->closeWallet(false, true); m_ctx->tor->stop(); + m_ctx->XMRig->stop(); this->saveGeo(); } @@ -1303,7 +1350,7 @@ void MainWindow::importTransaction() { auto result = QMessageBox::warning(this, "Warning", "Using this feature may allow a remote node to associate the transaction with your IP address.\n" "\n" - "Connect to a trusted node or run Feather over Tor if network level metadata leakage is included in your threat model.", + "Connect to a trusted node or run WOWlet over Tor if network level metadata leakage is included in your threat model.", QMessageBox::Ok | QMessageBox::Cancel); if (result == QMessageBox::Ok) { auto *dialog = new TxImportDialog(this, m_ctx); @@ -1313,7 +1360,7 @@ void MainWindow::importTransaction() { } void MainWindow::updateNetStats() { - if (!m_ctx->currentWallet) { + if (m_ctx->currentWallet == nullptr) { m_statusLabelNetStats->setText(""); return; } @@ -1343,6 +1390,90 @@ void MainWindow::showBalanceDialog() { dialog->deleteLater(); } +void MainWindow::onUpdateSATWidget() { + if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) + return; + auto wowObj = AppContext::prices->markets["WOW"]; + QString satStr = QString::number(wowObj.price_sat); + m_tickerSAT->setFiatText(satStr); +} + +void MainWindow::onUpdateWowWidget() { + if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) + return; + QString fiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if(!AppContext::prices->rates.contains(fiatCurrency)){ + config()->set(Config::preferredFiatCurrency, "USD"); + fiatCurrency = "USD"; + } + + auto wowObj = AppContext::prices->markets["WOW"]; + + double amount = wowObj.price_usd; + if(fiatCurrency != "USD") + amount = AppContext::prices->convert("USD", fiatCurrency, amount); + + auto currencyText = Utils::amountToCurrencyString(amount, fiatCurrency, 5); + m_tickerWOW->setFiatText(currencyText); + + auto pct24h = AppContext::prices->markets["WOW"].price_usd_change_pct_24h; + auto pct24hText = QString::number(pct24h, 'f', 2); + this->m_tickerWOW->setPctText(pct24hText, pct24h >= 0.0); +} + +void MainWindow::onUpdateBTCWidget() { + if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) + return; + QString fiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if(!AppContext::prices->rates.contains(fiatCurrency)){ + config()->set(Config::preferredFiatCurrency, "USD"); + fiatCurrency = "USD"; + } + + double conversion = AppContext::prices->convert("BTC", fiatCurrency, 1.0); + auto conversionText = Utils::amountToCurrencyString(conversion, fiatCurrency); + m_tickerBTC->setFiatText(conversionText); + + auto pct24h = AppContext::prices->markets["BTC"].price_usd_change_pct_24h; + auto pct24hText = QString::number(pct24h, 'f', 2); + this->m_tickerBTC->setPctText(pct24hText, pct24h >= 0.0); +} + +void MainWindow::onUpdateXMRWidget() { + if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) + return; + QString fiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if(!AppContext::prices->rates.contains(fiatCurrency)){ + config()->set(Config::preferredFiatCurrency, "USD"); + fiatCurrency = "USD"; + } + + double conversion = AppContext::prices->convert("XMR", fiatCurrency, 1.0); + auto conversionText = Utils::amountToCurrencyString(conversion, fiatCurrency); + m_tickerXMR->setFiatText(conversionText); + + auto pct24h = AppContext::prices->markets["XMR"].price_usd_change_pct_24h; + auto pct24hText = QString::number(pct24h, 'f', 2); + this->m_tickerXMR->setPctText(pct24hText, pct24h >= 0.0); +} + +void MainWindow::onUpdateFiatBalanceWidget() { + bool hide = config()->get(Config::hideBalance).toBool() || config()->get(Config::hideFiatBalance).toBool(); + m_balanceWidget->setHidden(hide); + + if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) + return; + QString fiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if(!AppContext::prices->rates.contains(fiatCurrency)){ + config()->set(Config::preferredFiatCurrency, "USD"); + fiatCurrency = "USD"; + } + + double conversion = AppContext::prices->convert("WOW", fiatCurrency, AppContext::balance); + auto conversionText = Utils::amountToCurrencyString(conversion, fiatCurrency); + m_balanceWidget->setFiatText(conversionText); +} + QString MainWindow::statusDots() { m_statusDots++; m_statusDots = m_statusDots % 4; diff --git a/src/mainwindow.h b/src/mainwindow.h index ff23eb5..0160f4f 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -1,9 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef MAINWINDOW_H #define MAINWINDOW_H +#include + #ifdef Q_OS_MAC #include "src/kdmactouchbar.h" #endif @@ -12,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -22,6 +25,7 @@ #include "calcwindow.h" #include "widgets/ccswidget.h" #include "widgets/redditwidget.h" +#include "widgets/forumwidget.h" #include "widgets/tickerwidget.h" #include "widgets/xmrigwidget.h" #include "utils/networking.h" @@ -29,11 +33,13 @@ #include "utils/config.h" #include "wizard/walletwizard.h" #include "settings.h" +#include "globals.h" #include "dialog/aboutdialog.h" #include "dialog/signverifydialog.h" #include "dialog/verifyproofdialog.h" #include "dialog/seeddialog.h" #include "dialog/passwordchangedialog.h" +#include "dialog/updatedialog.h" #include "dialog/keysdialog.h" #include "dialog/aboutdialog.h" #include "dialog/restoredialog.h" @@ -43,8 +49,8 @@ namespace Ui { } struct ToggleTab { - ToggleTab(QWidget *tab, const QString &name, const QString &description, QAction *menuAction, Config::ConfigKey configKey) : - tab(tab), key(name), name(description), menuAction(menuAction), configKey(configKey){} + ToggleTab(QWidget *tab, QString name, QString description, QAction *menuAction, Config::ConfigKey configKey) : + tab(tab), key(std::move(name)), name(std::move(description)), menuAction(menuAction), configKey(configKey){} QWidget *tab; QString key; QString name; @@ -69,22 +75,6 @@ public: qreal screenDpiPhysical; qreal screenRatio; - enum Tabs { - HOME = 0, - HISTORY, - SEND, - RECEIVE, - COINS, - CALC, - EXCHANGES, - XMRIG - }; - - enum TabsHome { - CCS, - REDDIT - }; - public slots: void initWidgets(); void initMenu(); @@ -103,10 +93,15 @@ public slots: void showViewOnlyDialog(); void donateButtonClicked(); void showCalcWindow(); + void showHomeWindow(); + void payToMany(); + void showWalletCacheDebugDialog(); void showSendTab(); void showHistoryTab(); void showSendScreen(const CCSEntry &entry); + void suchDonate(const QString address); void skinChanged(const QString &skinName); + void onVersionWarning(QString current_string, QJsonObject data); void menuTorClicked(); void onBlockchainSync(int height, int target); void onRefreshSync(int height, int target); @@ -135,16 +130,22 @@ public slots: // libwalletqt void onBalanceUpdated(quint64 balance, quint64 spendable); void onSynchronized(); - void onWalletOpened(); - void onWalletClosed(); - void onWalletClosed(WalletWizard::Page page); + void onWalletOpened(Wallet *wallet); + void onWalletClosed(WalletWizard::Page page = WalletWizard::Page_Menu); void onConnectionStatusChanged(int status); void onCreateTransactionError(const QString &message); - void onCreateTransactionSuccess(PendingTransaction *tx, const QString &address, const quint32 &mixin); + void onCreateTransactionSuccess(PendingTransaction *tx, const QVector &address); void onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid); + // tickers + void onUpdateWowWidget(); + void onUpdateFiatBalanceWidget(); + void onUpdateBTCWidget(); + void onUpdateSATWidget(); + void onUpdateXMRWidget(); + signals: - void walletClosed(); + void updateDialog(); void closed(); private: @@ -160,6 +161,7 @@ private: void saveGeo(); void restoreGeo(); void showDebugInfo(); + void showUpdateDialog(); void showNodeExhaustedMessage(); void showWSNodeExhaustedMessage(); void createUnsignedTxDialog(UnsignedTransaction *tx); @@ -168,7 +170,7 @@ private: void updatePasswordIcon(); void updateNetStats(); void rescanSpent(); - void setStatusText(const QString &text); + void setStatusText(const QString &text, bool override = false, int timeout = 1000); void showBalanceDialog(); QString statusDots(); @@ -183,12 +185,16 @@ private: QSystemTrayIcon *m_trayIcon; QMenu m_trayMenu; + QAction *m_trayActionHome; QAction *m_trayActionCalc; QAction *m_trayActionExit; QAction *m_trayActionSend; QAction *m_trayActionHistory; - QList m_tickerWidgets; + TickerWidget *m_tickerWOW; + TickerWidget *m_tickerBTC; + TickerWidget *m_tickerSAT; + TickerWidget *m_tickerXMR; TickerWidget *m_balanceWidget; // lower status bar @@ -201,9 +207,6 @@ private: StatusBarButton *m_statusBtnSeed; StatusBarButton *m_statusBtnTor; - SubaddressProxyModel *subaddressProxyModel; - TransactionHistoryModel *txHistModel; - CoinsModel *coinsModel; #ifdef Q_OS_MAC QAction *m_touchbarActionWelcome; KDMacTouchBar *m_touchbar; @@ -221,7 +224,9 @@ private: QString m_statusText; int m_statusDots; bool m_constructingTransaction = false; + bool m_statusOverrideActive = false; QTimer m_txTimer; + int m_showUpdateWarning = 0; private slots: void menuToggleTabVisible(const QString &key); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 460f1f2..d3263f3 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 1156 - 496 + 506
@@ -17,7 +17,7 @@ - Feather + WOWlet @@ -86,6 +86,13 @@
+ + + + Warning: outdated wowlet version + + + @@ -101,11 +108,11 @@ true - + - CCS + Forum - + 0 @@ -119,13 +126,13 @@ 0 - + - /r/Monero + Reddit @@ -145,6 +152,57 @@ + + + SuchWow + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 320 + + + + + + + + + WFS + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + @@ -190,7 +248,7 @@ - + 0 0 @@ -258,76 +316,6 @@ - - - - :/assets/images/gnome-calc.png:/assets/images/gnome-calc.png - - - Calc - - - - - - - - - - - :/assets/images/update.png:/assets/images/update.png - - - Exchange - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - - :/assets/images/xmrto.png:/assets/images/xmrto.png - - - XMR.to - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - @@ -342,6 +330,20 @@ + + + + :/assets/images/gnome-calc.png:/assets/images/gnome-calc.png + + + Calc + + + + + + + @@ -353,7 +355,7 @@ 0 0 1156 - 30 + 22 @@ -404,6 +406,7 @@ + @@ -445,6 +448,7 @@ + @@ -454,7 +458,7 @@ - + @@ -463,9 +467,9 @@ View + - @@ -529,9 +533,9 @@ Report bug - + - Donate to Feather + Donate to WOWlet @@ -704,16 +708,26 @@ Import transaction - - - Show Exchange - - Rescan spent + + + Show Home + + + + + Wallet cache debug + + + + + Pay to many + + @@ -746,12 +760,6 @@ QWidget
historywidget.h
- - XMRToWidget - QWidget -
xmrtowidget.h
- 1 -
CalcWidget QWidget @@ -770,6 +778,18 @@
widgets/redditwidget.h
1
+ + SuchWowWidget + QWidget +
widgets/suchwowwidget.h
+ 1 +
+ + ForumWidget + QWidget +
widgets/forumwidget.h
+ 1 +
diff --git a/src/mobile/README.md b/src/mobile/README.md new file mode 100644 index 0000000..250e21c --- /dev/null +++ b/src/mobile/README.md @@ -0,0 +1,45 @@ +# Wowlet Mobile (Android) + +This directory contains an unfinished QML application that will show: + +![https://i.imgur.com/yhCsSgj.jpg](https://i.imgur.com/yhCsSgj.jpg) + +## Building + +Credits go to Monero GUI team for providing the initial work on Qt5+Android. + +Build a Docker image: + +```bash +docker build --tag wowlet:android --build-arg THREADS=14 --file Dockerfile.android . +``` + +Building Wowlet for arm64-v8a: + +```Bash +docker run --rm -it -v $PWD:/wowlet -w /wowlet -e THREADS=6 wowlet:android +``` + +Installing the resulting `.apk` on your device: + +```bash +adb install build/Android/release/android-build//build/outputs/apk/debug/android-build-debug.apk +``` + +Viewing debug logs: + +```bash +adb logcat | grep --line-buffered "D wowlet" +``` + +# Development + +To show this on desktop, you will need the following CMake definitions: + +`-DANDROID_DEBUG=ON -DWITH_SCANNER=ON` + +Start wowlet with the `--android-debug` flag: + +```bash +./wowlet --android-debug +``` diff --git a/src/mobile/main.cpp b/src/mobile/main.cpp new file mode 100644 index 0000000..5c2a761 --- /dev/null +++ b/src/mobile/main.cpp @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libwalletqt/TransactionInfo.h" +#include "libwalletqt/TransactionHistory.h" +#include "model/TransactionHistoryModel.h" +#include "model/TransactionHistoryProxyModel.h" +#include "libwalletqt/WalletManager.h" + +#include "utils/keysfiles.h" +#include "mobile/main.h" + +namespace mobile { + + Mobile::Mobile(AppContext *ctx, QCommandLineParser *parser, QObject *parent) : + QObject(parent), ctx(ctx), m_parser(parser) { + AppContext::isQML = true; + m_pClipboard = QGuiApplication::clipboard(); + desktopMode = true; + + // turn on auto tx commits + ctx->autoCommitTx = true; + + // QR code scanning from screenshots + m_qrScreenshotPreviewPath = ctx->configDirectoryVR + "/screenshot_preview"; + m_qrScreenshotImagePath = ctx->configDirectoryVR + "/screenshot"; + m_qrScreenshotTimer.setSingleShot(true); + + qDebug() << "QMLSCENE_DEVICE: " << qgetenv("QMLSCENE_DEVICE"); + + m_engine.rootContext()->setContextProperty("homePath", QDir::homePath()); + m_engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); + m_engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount()); + m_engine.rootContext()->setContextProperty("qtRuntimeVersion", qVersion()); + m_engine.rootContext()->setContextProperty("ctx", ctx); + + m_engine.rootContext()->setContextProperty("Mobile", this); + qRegisterMetaType(); + qmlRegisterType("wowlet.NetworkType", 1, 0, "NetworkType"); + + qmlRegisterUncreatableType("wowlet.WalletKeysFiles", 1, 0, "WalletKeysFiles", "WalletKeysFiles can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.Wallet", 1, 0, "Wallet", "Wallet can't be instantiated directly"); + qmlRegisterType("wowlet.WalletManager", 1, 0, "WalletManager"); + + qmlRegisterUncreatableType("wowlet.TransactionHistoryProxyModel", 1, 0, "TransactionHistoryProxyModel", "TransactionHistoryProxyModel can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionHistoryModel", 1, 0, "TransactionHistoryModel", "TransactionHistoryModel can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionInfo", 1, 0, "TransactionInfo", "TransactionHistory can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionHistory", 1, 0, "TransactionHistory", "TransactionHistory can't be instantiated directly"); + + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); + + auto widgetUrl = QUrl(QStringLiteral("qrc:///main")); + m_engine.load(widgetUrl); + if (m_engine.rootObjects().isEmpty()) + { + qCritical() << "Error: no root objects"; + return; + } + QObject *rootObject = m_engine.rootObjects().first(); + if (!rootObject) + { + qCritical() << "Error: no root objects"; + return; + } + + + int wege = 1; + } + + void Mobile::takeQRScreenshot() { + + } + + void Mobile::onCheckQRScreenshot() { + + } + + QString Mobile::checkQRScreenshotResults(std::vector results) { + + } + + Mobile::~Mobile() { + // bla + int wegeg = 1; + } +} diff --git a/src/mobile/main.h b/src/mobile/main.h new file mode 100644 index 0000000..284d755 --- /dev/null +++ b/src/mobile/main.h @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_MAIN_H +#define WOWLET_MAIN_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "appcontext.h" +#include "utils/config.h" +#include "QR-Code-scanner/Decoder.h" + +namespace mobile { + + class Mobile : public QObject { + Q_OBJECT + public: + explicit Mobile(AppContext *ctx, QCommandLineParser *cmdargs, QObject *parent = nullptr); + ~Mobile() override; + + QList errors; + + Q_INVOKABLE double cdiv(double amount) { return amount / globals::cdiv; } + Q_INVOKABLE double add(double x, double y) const { return Utils::roundUp(x + y, 4); } // round ceil 4 decimals + Q_INVOKABLE double sub(double x, double y) const { return Utils::roundUp(x - y, 4); } // round ceil 4 decimals + + Q_INVOKABLE void onCreateTransaction(const QString &address, const QString &amount_str, const QString description, bool all) { + auto amount = WalletManager::amountFromString(amount_str); + ctx->onCreateTransaction(address, amount, description, false); + } + + Q_INVOKABLE void setClipboard(const QString &text) { + m_pClipboard->setText(text, QClipboard::Clipboard); + m_pClipboard->setText(text, QClipboard::Selection); + } + + Q_INVOKABLE QString preferredFiat() { + return config()->get(Config::preferredFiatCurrency).toString(); + } + + Q_INVOKABLE QString fiatToWow(double amount) { + auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if (amount <= 0) return QString("0.00"); + + double conversionAmount = AppContext::prices->convert(preferredFiatCurrency, "WOW", amount); + return QString("%1").arg(QString::number(conversionAmount, 'f', 2)); + } + + Q_INVOKABLE QString wowToFiat(double amount) { + auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if (amount <= 0) return QString("0.00"); + + double conversionAmount = AppContext::prices->convert("WOW", preferredFiatCurrency, amount); + if(conversionAmount <= 0) return QString("0.00"); + return QString("~%1").arg(QString::number(conversionAmount, 'f', 2)); + } + + Q_INVOKABLE void takeQRScreenshot(); + + signals: + void qrScreenshotFailed(QString error); + void qrScreenshotSuccess(QString address); + + private slots: + void onCheckQRScreenshot(); + + private: + AppContext *ctx; + QQmlApplicationEngine m_engine; + + bool desktopMode = false; + QString m_qrScreenshotPreviewPath; + QString m_qrScreenshotImagePath; + + QCommandLineParser *m_parser; + QClipboard *m_pClipboard; + QTimer m_qrScreenshotTimer; + QrDecoder m_qrDecoder; + + static QString checkQRScreenshotResults(std::vector results); + }; + +} + +#endif //WOWLET_MAIN_H diff --git a/src/mobile/main.qml b/src/mobile/main.qml new file mode 100644 index 0000000..5e29737 --- /dev/null +++ b/src/mobile/main.qml @@ -0,0 +1,35 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 +import QtGraphicalEffects 1.0 + +import "." + +import wowlet.Wallet 1.0 +import wowlet.WalletManager 1.0 + +ApplicationWindow { + visible: true + id: appWindow + width: 1080 + height: 2400 + color: "#2C3539" + + MouseArea { + anchors.fill: parent + onClicked: { + Qt.quit(); + } + } + + Text { + text: "Wowlet" + color: "white" + anchors.centerIn: parent + font.pointSize: 62 + } +} diff --git a/src/mobile/qml.qrc b/src/mobile/qml.qrc new file mode 100644 index 0000000..5a38622 --- /dev/null +++ b/src/mobile/qml.qrc @@ -0,0 +1,5 @@ + + + main.qml + + \ No newline at end of file diff --git a/src/model/AddressBookModel.cpp b/src/model/AddressBookModel.cpp index fb8b37d..cea5cd1 100644 --- a/src/model/AddressBookModel.cpp +++ b/src/model/AddressBookModel.cpp @@ -1,16 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "AddressBookModel.h" #include "AddressBook.h" #include "ModelUtils.h" #include "utils/utils.h" -#include - -#include -#include -#include -#include AddressBookModel::AddressBookModel(QObject *parent, AddressBook *addressBook) : QAbstractTableModel(parent), @@ -160,6 +154,22 @@ int AddressBookModel::lookupPaymentID(const QString &payment_id) const return m_addressBook->lookupPaymentID(payment_id); } +QJsonArray AddressBookModel::toJsonArray(){ + QJsonArray arr; + for(int i = 0; i < this->rowCount(); i++) { + QJsonObject item; + QModelIndex index = this->index(i, 0); + const auto description = this->data(index.siblingAtColumn(AddressBookModel::Description), Qt::UserRole).toString().replace("\"", ""); + const auto address = this->data(index.siblingAtColumn(AddressBookModel::Address), Qt::UserRole).toString(); + if(address.isEmpty()) continue; + + item["description"] = description; + item["address"] = address; + arr << item; + } + return arr; +} + bool AddressBookModel::writeCSV(const QString &path) { QString csv = ""; for(int i = 0; i < this->rowCount(); i++) { diff --git a/src/model/AddressBookModel.h b/src/model/AddressBookModel.h index a766f59..0a4e2a2 100644 --- a/src/model/AddressBookModel.h +++ b/src/model/AddressBookModel.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef ADDRESSBOOKMODEL_H #define ADDRESSBOOKMODEL_H @@ -30,6 +30,8 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const override; bool setData(const QModelIndex &index, const QVariant &value, int role) override; + QJsonArray toJsonArray(); + Q_INVOKABLE bool deleteRow(int row); Q_INVOKABLE int lookupPaymentID(const QString &payment_id) const; diff --git a/src/model/AddressBookProxyModel.cpp b/src/model/AddressBookProxyModel.cpp index a6c81fe..19a4d95 100644 --- a/src/model/AddressBookProxyModel.cpp +++ b/src/model/AddressBookProxyModel.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "AddressBookProxyModel.h" #include "AddressBookModel.h" diff --git a/src/model/AddressBookProxyModel.h b/src/model/AddressBookProxyModel.h index 1ce2743..20d7b20 100644 --- a/src/model/AddressBookProxyModel.h +++ b/src/model/AddressBookProxyModel.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_ADDRESSBOOKPROXYMODEL_H -#define FEATHER_ADDRESSBOOKPROXYMODEL_H +#ifndef WOWLET_ADDRESSBOOKPROXYMODEL_H +#define WOWLET_ADDRESSBOOKPROXYMODEL_H #include @@ -25,4 +25,4 @@ private: QRegExp m_searchRegExp; }; -#endif //FEATHER_ADDRESSBOOKPROXYMODEL_H +#endif //WOWLET_ADDRESSBOOKPROXYMODEL_H diff --git a/src/model/CCSModel.cpp b/src/model/CCSModel.cpp index 7992458..39a02ea 100644 --- a/src/model/CCSModel.cpp +++ b/src/model/CCSModel.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "CCSModel.h" @@ -58,7 +58,7 @@ QVariant CCSModel::data(const QModelIndex &index, int role) const return entry->author; #ifdef Q_OS_MACOS case Progress: - return QString("%1/%2 XMR").arg(entry->raised_amount).arg(entry->target_amount); + return QString("%1/%2 WOW").arg(entry->raised_amount).arg(entry->target_amount); #endif default: return QVariant(); @@ -76,7 +76,7 @@ QVariant CCSModel::headerData(int section, Qt::Orientation orientation, int role { switch(section) { case Title: - return QString("Community Crowdfunding Proposal"); + return QString("Wownero Funding System"); case Author: return QString("Author"); case Progress: diff --git a/src/model/CCSModel.h b/src/model/CCSModel.h index c5421ac..871401c 100644 --- a/src/model/CCSModel.h +++ b/src/model/CCSModel.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CCSMODEL_H -#define FEATHER_CCSMODEL_H +#ifndef WOWLET_CCSMODEL_H +#define WOWLET_CCSMODEL_H #include #include @@ -39,4 +39,4 @@ private: }; -#endif //FEATHER_CCSMODEL_H +#endif //WOWLET_CCSMODEL_H diff --git a/src/model/CoinsModel.cpp b/src/model/CoinsModel.cpp index 75ea5b8..9231695 100644 --- a/src/model/CoinsModel.cpp +++ b/src/model/CoinsModel.cpp @@ -1,17 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "CoinsModel.h" #include "CoinsInfo.h" #include "Coins.h" -#include #include "ModelUtils.h" #include "globals.h" +#include "utils/ColorScheme.h" -#include -#include #include -#include #include CoinsModel::CoinsModel(QObject *parent, Coins *coins) @@ -71,13 +68,13 @@ QVariant CoinsModel::data(const QModelIndex &index, int role) const } else if (role == Qt::BackgroundRole) { if (cInfo.spent()) { - result = QBrush(QColor(255, 100, 100)); + result = QBrush(ColorScheme::RED.asColor(true)); } else if (cInfo.frozen()) { - result = QBrush(QColor(173, 216, 230)); + result = QBrush(ColorScheme::BLUE.asColor(true)); } else if (!cInfo.unlocked()) { - result = QBrush(QColor("#60993E")); + result = QBrush(ColorScheme::YELLOW.asColor(true)); } } else if (role == Qt::TextAlignmentRole) { diff --git a/src/model/CoinsModel.h b/src/model/CoinsModel.h index 8914ba4..7d7f0c3 100644 --- a/src/model/CoinsModel.h +++ b/src/model/CoinsModel.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_COINSMODEL_H -#define FEATHER_COINSMODEL_H +#ifndef WOWLET_COINSMODEL_H +#define WOWLET_COINSMODEL_H #include @@ -55,4 +55,4 @@ private: QIcon m_eyeBlind; }; -#endif //FEATHER_COINSMODEL_H +#endif //WOWLET_COINSMODEL_H diff --git a/src/model/CoinsProxyModel.cpp b/src/model/CoinsProxyModel.cpp index 5bf65b9..d376813 100644 --- a/src/model/CoinsProxyModel.cpp +++ b/src/model/CoinsProxyModel.cpp @@ -1,19 +1,24 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "CoinsProxyModel.h" #include "CoinsModel.h" +#include "libwalletqt/CoinsInfo.h" -CoinsProxyModel::CoinsProxyModel(QObject *parent) - : QSortFilterProxyModel(parent) +CoinsProxyModel::CoinsProxyModel(QObject *parent, Coins *coins) + : QSortFilterProxyModel(parent), m_coins(coins) { setSortRole(Qt::UserRole); } bool CoinsProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - QModelIndex spentIndex = sourceModel()->index(sourceRow, CoinsModel::Spent, sourceParent); - bool isSpent = sourceModel()->data(spentIndex).toBool(); + bool isSpent; + int accountIndex; + m_coins->coin(sourceRow, [&isSpent, &accountIndex](const CoinsInfo &c){ + isSpent = c.spent(); + accountIndex = c.subaddrAccount(); + }); - return !(!m_showSpent && isSpent); + return !(!m_showSpent && isSpent) && accountIndex == 0; } \ No newline at end of file diff --git a/src/model/CoinsProxyModel.h b/src/model/CoinsProxyModel.h index 9a71a51..2e327f6 100644 --- a/src/model/CoinsProxyModel.h +++ b/src/model/CoinsProxyModel.h @@ -1,16 +1,17 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_COINSPROXYMODEL_H -#define FEATHER_COINSPROXYMODEL_H +#ifndef WOWLET_COINSPROXYMODEL_H +#define WOWLET_COINSPROXYMODEL_H #include +#include "libwalletqt/Coins.h" class CoinsProxyModel : public QSortFilterProxyModel { Q_OBJECT public: - explicit CoinsProxyModel(QObject* parent = nullptr); + explicit CoinsProxyModel(QObject* parent, Coins *coins); bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; public slots: @@ -21,6 +22,7 @@ public slots: private: bool m_showSpent = false; + Coins *m_coins; }; -#endif //FEATHER_COINSPROXYMODEL_H +#endif //WOWLET_COINSPROXYMODEL_H diff --git a/src/model/ForumModel.cpp b/src/model/ForumModel.cpp new file mode 100644 index 0000000..998a1c6 --- /dev/null +++ b/src/model/ForumModel.cpp @@ -0,0 +1,104 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include "ForumModel.h" + +ForumModel::ForumModel(QObject *parent) + : QAbstractTableModel(parent) +{ + +} + +void ForumModel::clear() { + beginResetModel(); + + m_posts.clear(); + + endResetModel(); +} + +void ForumModel::updatePosts(const QList>& posts) { + beginResetModel(); + + m_posts.clear(); + for (const auto& post : posts) { + m_posts.push_back(post); + } + + endResetModel(); +} + +int ForumModel::rowCount(const QModelIndex &parent) const{ + if (parent.isValid()) { + return 0; + } + return m_posts.count(); +} + +int ForumModel::columnCount(const QModelIndex &parent) const +{ + if (parent.isValid()) { + return 0; + } + return ModelColumn::COUNT; +} + +QVariant ForumModel::data(const QModelIndex &index, int role) const +{ + if (!index.isValid() || index.row() < 0 || index.row() >= m_posts.count()) + return QVariant(); + + QSharedPointer post = m_posts.at(index.row()); + + if(role == Qt::DisplayRole) { + switch(index.column()) { + case Title: + return post->title; + case Author: + return post->author; + case DateAdded: + return post->date_added; + default: + return QVariant(); + } + } + else if (role == Qt::TextAlignmentRole) { + switch(index.column()) { + case DateAdded: + return Qt::AlignRight; + default: + return QVariant(); + } + } + return QVariant(); +} + +QVariant ForumModel::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role != Qt::DisplayRole) { + return QVariant(); + } + if (orientation == Qt::Horizontal) + { + switch(section) { + case Title: + return QString("Forum Post"); + case Author: + return QString("Author"); + case DateAdded: + return QString("Date"); + default: + return QVariant(); + } + } + return QVariant(); +} + +QSharedPointer ForumModel::post(int row) { + if (row < 0 || row >= m_posts.size()) { + qCritical("%s: no forum post for index %d", __FUNCTION__, row); + return QSharedPointer(); + } + + return m_posts.at(row); +} \ No newline at end of file diff --git a/src/model/ForumModel.h b/src/model/ForumModel.h new file mode 100644 index 0000000..4f2f0ed --- /dev/null +++ b/src/model/ForumModel.h @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_FORUMMODEL_H +#define WOWLET_FORUMMODEL_H + +#include +#include + +#include "widgets/ForumPost.h" + +class ForumModel : public QAbstractTableModel +{ +Q_OBJECT + +public: + enum ModelColumn + { + Title = 0, + Author, + DateAdded, + COUNT + }; + + explicit ForumModel(QObject *parent); + + int rowCount(const QModelIndex &parent) const override; + int columnCount(const QModelIndex &parent) const override; + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + + void clear(); + void updatePosts(const QList>& posts); + + QSharedPointer post(int row); + +private: + QList> m_posts; +}; + +#endif //WOWLET_FORUMMODEL_H diff --git a/src/model/ModelUtils.cpp b/src/model/ModelUtils.cpp index 9ac173f..290effc 100644 --- a/src/model/ModelUtils.cpp +++ b/src/model/ModelUtils.cpp @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ModelUtils.h" #include -#include #include #include #include diff --git a/src/model/ModelUtils.h b/src/model/ModelUtils.h index b6b8566..15452d7 100644 --- a/src/model/ModelUtils.h +++ b/src/model/ModelUtils.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_MODELUTILS_H -#define FEATHER_MODELUTILS_H +#ifndef WOWLET_MODELUTILS_H +#define WOWLET_MODELUTILS_H #include #include @@ -15,4 +15,4 @@ public: }; -#endif //FEATHER_MODELUTILS_H +#endif //WOWLET_MODELUTILS_H diff --git a/src/model/NodeModel.cpp b/src/model/NodeModel.cpp index 504a195..47a83e0 100644 --- a/src/model/NodeModel.cpp +++ b/src/model/NodeModel.cpp @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "NodeModel.h" -#include -#include "appcontext.h" +#include "utils/nodes.h" +#include "utils/ColorScheme.h" NodeModel::NodeModel(int nodeSource, QObject *parent) : QAbstractTableModel(parent) @@ -19,7 +19,7 @@ void NodeModel::clear() { endResetModel(); } -void NodeModel::updateNodes(const QList nodes) { +void NodeModel::updateNodes(const QList nodes) { beginResetModel(); m_nodes.clear(); m_nodes = nodes; @@ -42,7 +42,7 @@ QVariant NodeModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() < 0 || index.row() >= m_nodes.count()) return QVariant(); - FeatherNode node = m_nodes.at(index.row()); + WowletNode node = m_nodes.at(index.row()); if(role == Qt::DisplayRole) { switch(index.column()) { @@ -70,9 +70,9 @@ QVariant NodeModel::data(const QModelIndex &index, int role) const { } else if(role == Qt::BackgroundRole) { if (node.isConnecting) - return QBrush(QColor("#A9DEF9")); + return QBrush(ColorScheme::YELLOW.asColor(true)); else if (node.isActive) - return QBrush(QColor("#78BC61")); + return QBrush(ColorScheme::GREEN.asColor(true)); } return QVariant(); } @@ -94,10 +94,10 @@ QVariant NodeModel::headerData(int section, Qt::Orientation orientation, int rol return QVariant(); } -FeatherNode NodeModel::node(int row) { +WowletNode NodeModel::node(int row) { if (row < 0 || row >= m_nodes.size()) { qCritical("%s: no reddit post for index %d", __FUNCTION__, row); - return FeatherNode(); + return WowletNode(); } return m_nodes.at(row); } diff --git a/src/model/NodeModel.h b/src/model/NodeModel.h index c128d62..54d6c43 100644 --- a/src/model/NodeModel.h +++ b/src/model/NodeModel.h @@ -1,13 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_NODEMODEL_H -#define FEATHER_NODEMODEL_H +#ifndef WOWLET_NODEMODEL_H +#define WOWLET_NODEMODEL_H #include #include -class FeatherNode; +class WowletNode; class NodeModel : public QAbstractTableModel { Q_OBJECT @@ -25,16 +25,16 @@ public: int columnCount(const QModelIndex &parent) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - FeatherNode node(int row); + WowletNode node(int row); void clear(); - void updateNodes(QList nodes); + void updateNodes(QList nodes); private: - QList m_nodes; + QList m_nodes; QIcon m_offline; QIcon m_online; int m_nodeSource; }; -#endif //FEATHER_NODEMODEL_H +#endif //WOWLET_NODEMODEL_H diff --git a/src/model/RedditModel.cpp b/src/model/RedditModel.cpp index 2077d64..d0166d1 100644 --- a/src/model/RedditModel.cpp +++ b/src/model/RedditModel.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "RedditModel.h" diff --git a/src/model/RedditModel.h b/src/model/RedditModel.h index e3eb392..73b14df 100644 --- a/src/model/RedditModel.h +++ b/src/model/RedditModel.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_REDDITMODEL_H -#define FEATHER_REDDITMODEL_H +#ifndef WOWLET_REDDITMODEL_H +#define WOWLET_REDDITMODEL_H #include #include @@ -38,4 +38,4 @@ private: QList> m_posts; }; -#endif //FEATHER_REDDITMODEL_H +#endif //WOWLET_REDDITMODEL_H diff --git a/src/model/SubaddressAccountModel.cpp b/src/model/SubaddressAccountModel.cpp index 605e119..8a1f75f 100644 --- a/src/model/SubaddressAccountModel.cpp +++ b/src/model/SubaddressAccountModel.cpp @@ -1,12 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "SubaddressAccountModel.h" #include "SubaddressAccount.h" -#include #include -#include SubaddressAccountModel::SubaddressAccountModel(QObject *parent, SubaddressAccount *subaddressAccount) : QAbstractListModel(parent), m_subaddressAccount(subaddressAccount) diff --git a/src/model/SubaddressAccountModel.h b/src/model/SubaddressAccountModel.h index 04d8d58..cbc7019 100644 --- a/src/model/SubaddressAccountModel.h +++ b/src/model/SubaddressAccountModel.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef SUBADDRESSACCOUNTMODEL_H #define SUBADDRESSACCOUNTMODEL_H diff --git a/src/model/SubaddressModel.cpp b/src/model/SubaddressModel.cpp index 308f165..35ea020 100644 --- a/src/model/SubaddressModel.cpp +++ b/src/model/SubaddressModel.cpp @@ -1,12 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "SubaddressModel.h" #include "Subaddress.h" #include "ModelUtils.h" -#include +#include "utils/ColorScheme.h" -#include #include #include #include @@ -58,8 +57,13 @@ QVariant SubaddressModel::data(const QModelIndex &index, int role) const result = parseSubaddressRow(subaddress, index, role); } else if (role == Qt::BackgroundRole) { - if (subaddress.isUsed()) { - result = QBrush(QColor(255,100,100)); + switch(index.column()) { + case Address: + { + if (subaddress.isUsed()) { + result = QBrush(ColorScheme::RED.asColor(true)); + } + } } } else if (role == Qt::FontRole) { @@ -70,6 +74,16 @@ QVariant SubaddressModel::data(const QModelIndex &index, int role) const } } } + else if (role == Qt::ToolTipRole) { + switch(index.column()) { + case Address: + { + if (subaddress.isUsed()) { + result = "This address is used."; + } + } + } + } }); if (!found) diff --git a/src/model/SubaddressModel.h b/src/model/SubaddressModel.h index afe378f..773711b 100644 --- a/src/model/SubaddressModel.h +++ b/src/model/SubaddressModel.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef SUBADDRESSMODEL_H #define SUBADDRESSMODEL_H diff --git a/src/model/SubaddressProxyModel.cpp b/src/model/SubaddressProxyModel.cpp index dc486e9..66705cc 100644 --- a/src/model/SubaddressProxyModel.cpp +++ b/src/model/SubaddressProxyModel.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "SubaddressProxyModel.h" diff --git a/src/model/SubaddressProxyModel.h b/src/model/SubaddressProxyModel.h index 68f6165..3c94de2 100644 --- a/src/model/SubaddressProxyModel.h +++ b/src/model/SubaddressProxyModel.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_SUBADDRESSPROXYMODEL_H -#define FEATHER_SUBADDRESSPROXYMODEL_H +#ifndef WOWLET_SUBADDRESSPROXYMODEL_H +#define WOWLET_SUBADDRESSPROXYMODEL_H #include "libwalletqt/Subaddress.h" @@ -35,4 +35,4 @@ private: bool m_hidePrimary; }; -#endif //FEATHER_SUBADDRESSPROXYMODEL_H +#endif //WOWLET_SUBADDRESSPROXYMODEL_H diff --git a/src/model/SubaddressView.cpp b/src/model/SubaddressView.cpp index 21203ef..1494759 100644 --- a/src/model/SubaddressView.cpp +++ b/src/model/SubaddressView.cpp @@ -1,3 +1,6 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + #include "SubaddressView.h" #include "model/ModelUtils.h" diff --git a/src/model/SubaddressView.h b/src/model/SubaddressView.h index e36d0ee..626cac7 100644 --- a/src/model/SubaddressView.h +++ b/src/model/SubaddressView.h @@ -1,5 +1,8 @@ -#ifndef FEATHER_SUBADDRESSVIEW_H -#define FEATHER_SUBADDRESSVIEW_H +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_SUBADDRESSVIEW_H +#define WOWLET_SUBADDRESSVIEW_H #include #include @@ -16,4 +19,4 @@ protected: void keyPressEvent(QKeyEvent *event); }; -#endif //FEATHER_SUBADDRESSVIEW_H +#endif //WOWLET_SUBADDRESSVIEW_H diff --git a/src/model/TransactionHistoryModel.cpp b/src/model/TransactionHistoryModel.cpp index 76b60ec..6796770 100644 --- a/src/model/TransactionHistoryModel.cpp +++ b/src/model/TransactionHistoryModel.cpp @@ -1,14 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "TransactionHistoryModel.h" #include "TransactionHistory.h" #include "TransactionInfo.h" #include "globals.h" - -#include -#include -#include +#include "utils/ColorScheme.h" TransactionHistoryModel::TransactionHistoryModel(QObject *parent) : QAbstractTableModel(parent), @@ -54,7 +51,12 @@ int TransactionHistoryModel::columnCount(const QModelIndex &parent) const { return 0; } - return Column::COUNT; + // When wowlet is in QtWidgets mode, it will only use the first 5 columns, + // the rest should be hidden, because it shows in the GUI. So by default we'll + // use 6 as column count. When in QtQuick (QML) mode, we want to expose more columns + // so we can change the column count here. + + return AppContext::isQML ? this->COUNT : 7; } QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const { @@ -73,14 +75,16 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const } else if (role == Qt::TextAlignmentRole) { switch (index.column()) { - case Column::Amount: - case Column::FiatAmount: + case TransactionInfoRole::Amount: + case TransactionInfoRole::HistoricalPrice: + case TransactionInfoRole::HistoricalRate: + case TransactionInfoRole::CurrentPrice: result = Qt::AlignRight; } } else if (role == Qt::DecorationRole) { switch (index.column()) { - case Column::Date: + case TransactionInfoRole::Date: { if (tInfo.isFailed()) result = QVariant(m_warning); @@ -103,7 +107,7 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const } else if (role == Qt::ToolTipRole) { switch(index.column()) { - case Column::Date: + case TransactionInfoRole::Date: { if (tInfo.isFailed()) result = "Transaction failed"; @@ -116,8 +120,7 @@ QVariant TransactionHistoryModel::data(const QModelIndex &index, int role) const } else if (role == Qt::ForegroundRole) { switch(index.column()) { - case Column::FiatAmount: - case Column::Amount: + case TransactionInfoRole::Amount: { if (tInfo.direction() == TransactionInfo::Direction_Out) { result = QVariant(QColor("#BC1E1E")); @@ -137,9 +140,19 @@ QVariant TransactionHistoryModel::parseTransactionInfo(const TransactionInfo &tI { switch (column) { - case Column::Date: + case TransactionInfoRole::TransactionFailedRole: + return tInfo.isFailed(); + case TransactionInfoRole::TransactionPendingRole: + return tInfo.isPending(); + case TransactionInfoRole::TransactionConfirmationsRole: + return tInfo.confirmations(); + case TransactionInfoRole::TransactionConfirmationsRequiredRole: + return tInfo.confirmationsRequired(); + case TransactionInfoRole::Date: return tInfo.timestamp().toString("yyyy-MM-dd HH:mm"); - case Column::Description: { + case TransactionInfoRole::TransactionIsOutRole: + return tInfo.direction() == TransactionInfo::Direction_Out; + case TransactionInfoRole::Description: { // if this tx is still in the pool, then we wont get the // description. We've cached it inside `AppContext::txDescriptionCache` // for the time being. @@ -150,26 +163,24 @@ QVariant TransactionHistoryModel::parseTransactionInfo(const TransactionInfo &tI } return tInfo.description(); } - case Column::Amount: + case TransactionInfoRole::Amount: { QString amount = QString::number(tInfo.balanceDelta() / globals::cdiv, 'f', 4); amount = (tInfo.direction() == TransactionInfo::Direction_Out) ? "-" + amount : "+" + amount; return amount; } - case Column::TxID: + case TransactionInfoRole::TxID: return tInfo.hash(); - case Column::FiatAmount: + case TransactionInfoRole::HistoricalRate: { + return tInfo.historicalRateStr(); + } + case TransactionInfoRole::HistoricalPrice: { - double usd_price = AppContext::txFiatHistory->get(tInfo.timestamp().toString("yyyyMMdd")); - if (usd_price == 0.0) - return QVariant("?"); - - double usd_amount = usd_price * (tInfo.balanceDelta() / globals::cdiv); - if(this->preferredFiatSymbol != "USD") - usd_amount = AppContext::prices->convert("USD", this->preferredFiatSymbol, usd_amount); - double fiat_rounded = ceil(Utils::roundSignificant(usd_amount, 3) * 100.0) / 100.0; - - return QString("%1").arg(Utils::amountToCurrencyString(fiat_rounded, this->preferredFiatSymbol)); + return tInfo.historicalPriceStr(); + } + case TransactionInfoRole::CurrentPrice: + { + return tInfo.currentPriceStr(); } default: { @@ -186,16 +197,20 @@ QVariant TransactionHistoryModel::headerData(int section, Qt::Orientation orient } if (orientation == Qt::Horizontal) { switch(section) { - case Column::Date: + case TransactionInfoRole::Date: return QString("Date"); - case Column::Description: + case TransactionInfoRole::Description: return QString("Description"); - case Column::Amount: + case TransactionInfoRole::Amount: return QString("Amount"); - case Column::TxID: + case TransactionInfoRole::TxID: return QString("Txid"); - case Column::FiatAmount: - return QString("Fiat"); + case TransactionInfoRole::HistoricalPrice: + return QString("Historical price"); + case TransactionInfoRole::HistoricalRate: + return QString("Historical rate"); + case TransactionInfoRole::CurrentPrice: + return QString("Current price"); default: return QVariant(); } @@ -208,7 +223,7 @@ bool TransactionHistoryModel::setData(const QModelIndex &index, const QVariant & QString hash; switch (index.column()) { - case Column::Description: + case TransactionInfoRole::Description: { m_transactionHistory->transaction(index.row(), [this, &hash, &value](const TransactionInfo &tInfo){ hash = tInfo.hash(); diff --git a/src/model/TransactionHistoryModel.h b/src/model/TransactionHistoryModel.h index 82b140d..e43bc6c 100644 --- a/src/model/TransactionHistoryModel.h +++ b/src/model/TransactionHistoryModel.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef TRANSACTIONHISTORYMODEL_H #define TRANSACTIONHISTORYMODEL_H @@ -21,21 +21,28 @@ class TransactionHistoryModel : public QAbstractTableModel Q_PROPERTY(TransactionHistory * transactionHistory READ transactionHistory WRITE setTransactionHistory NOTIFY transactionHistoryChanged) public: - enum Column + enum TransactionInfoRole { Date = 0, Description, Amount, TxID, - FiatAmount, + HistoricalPrice, + HistoricalRate, + CurrentPrice, + TransactionIsOutRole, + TransactionFailedRole, + TransactionPendingRole, + TransactionConfirmationsRole, + TransactionConfirmationsRequiredRole, COUNT }; + Q_ENUM(TransactionInfoRole) explicit TransactionHistoryModel(QObject * parent = nullptr); void setTransactionHistory(TransactionHistory * th); TransactionHistory * transactionHistory() const; - QString preferredFiatSign = "$"; QString preferredFiatSymbol = "USD"; int rowCount(const QModelIndex & parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; @@ -45,6 +52,7 @@ public: bool setData(const QModelIndex &index, const QVariant &value, int role) override; + int customColumnCount = 5; signals: void transactionHistoryChanged(); diff --git a/src/model/TransactionHistoryProxyModel.cpp b/src/model/TransactionHistoryProxyModel.cpp index 479780e..538c5aa 100644 --- a/src/model/TransactionHistoryProxyModel.cpp +++ b/src/model/TransactionHistoryProxyModel.cpp @@ -1,11 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "TransactionHistoryProxyModel.h" #include "TransactionHistoryModel.h" #include "libwalletqt/TransactionInfo.h" -#include TransactionHistoryProxyModel::TransactionHistoryProxyModel(Wallet *wallet, QObject *parent) : QSortFilterProxyModel(parent), @@ -14,20 +13,19 @@ TransactionHistoryProxyModel::TransactionHistoryProxyModel(Wallet *wallet, QObje { m_searchRegExp.setCaseSensitivity(Qt::CaseInsensitive); m_searchRegExp.setPatternSyntax(QRegExp::RegExp); + m_history = m_wallet->history(); } bool TransactionHistoryProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const { - QModelIndex descriptionIndex = sourceModel()->index(sourceRow, TransactionHistoryModel::Description, sourceParent); - QModelIndex txidIndex = sourceModel()->index(sourceRow, TransactionHistoryModel::TxID, sourceParent); - - QString descriptionData = sourceModel()->data(descriptionIndex).toString(); - QString txidData = sourceModel()->data(txidIndex).toString(); - + QString description, txid, subaddrlabel; quint32 subaddrAcount; QSet subaddrIndex; - m_wallet->history()->transaction(sourceRow, [&subaddrAcount, &subaddrIndex](TransactionInfo &tInfo){ + m_history->transaction(sourceRow, [&description, &txid, &subaddrlabel, &subaddrAcount, &subaddrIndex](TransactionInfo &tInfo){ + description = tInfo.description(); + txid = tInfo.hash(); + subaddrlabel = tInfo.label(); subaddrAcount = tInfo.subaddrAccount(); subaddrIndex = tInfo.subaddrIndex(); }); @@ -39,5 +37,5 @@ bool TransactionHistoryProxyModel::filterAcceptsRow(int sourceRow, const QModelI if (addressFound) break; } - return (descriptionData.contains(m_searchRegExp) || txidData.contains(m_searchRegExp)) || addressFound; + return (description.contains(m_searchRegExp) || txid.contains(m_searchRegExp) || subaddrlabel.contains(m_searchRegExp)) || addressFound; } \ No newline at end of file diff --git a/src/model/TransactionHistoryProxyModel.h b/src/model/TransactionHistoryProxyModel.h index 559f1ff..f7c0349 100644 --- a/src/model/TransactionHistoryProxyModel.h +++ b/src/model/TransactionHistoryProxyModel.h @@ -1,11 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TRANSACTIONHISTORYPROXYMODEL_H -#define FEATHER_TRANSACTIONHISTORYPROXYMODEL_H +#ifndef WOWLET_TRANSACTIONHISTORYPROXYMODEL_H +#define WOWLET_TRANSACTIONHISTORYPROXYMODEL_H #include "libwalletqt/TransactionHistory.h" #include "libwalletqt/Wallet.h" +#include "libwalletqt/TransactionHistory.h" #include @@ -23,9 +24,10 @@ public slots: } private: - Wallet * m_wallet; + Wallet *m_wallet; + TransactionHistory *m_history; QRegExp m_searchRegExp; }; -#endif //FEATHER_TRANSACTIONHISTORYPROXYMODEL_H +#endif //WOWLET_TRANSACTIONHISTORYPROXYMODEL_H diff --git a/src/model/XmrToModel.cpp b/src/model/XmrToModel.cpp deleted file mode 100644 index b14ac45..0000000 --- a/src/model/XmrToModel.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "XmrToModel.h" -#include "model/ModelUtils.h" -#include "utils/xmrto.h" - -XmrToModel::XmrToModel(QList *orders, QObject *parent) - : QAbstractTableModel(parent), - orders(orders) -{ -} - -void XmrToModel::update() { - beginResetModel(); - endResetModel(); -} - -int XmrToModel::rowCount(const QModelIndex &) const { - return this->orders->count(); -} - -int XmrToModel::columnCount(const QModelIndex &) const { - return COUNT; -} - -QVariant XmrToModel::data(const QModelIndex &index, int role) const { - const int _row = index.row(); - const int _col = index.column(); - const auto order = this->orders->at(_row); - - if (role == Qt::DisplayRole){ - switch(index.column()){ - case Status: - { - QString status = XmrTo::stateMap[(OrderState) order->state]; - - if (order->state == OrderState::Status_OrderUnpaid) - return QString("%1 (%2)").arg(status, QString::number(order->countdown)); - - return status; - } - case ID: - return !order->uuid.isEmpty() ? order->uuid.split("-")[1] : "-"; - case Destination: - return ModelUtils::displayAddress(order->btc_dest_address, 1); - case Conversion: - if(order->state <= OrderState::Status_OrderToBeCreated) - return ""; - - return QString("%1 XMR ⟶ %2 BTC").arg(QString::number(order->incoming_amount_total), QString::number(order->btc_amount)); - case Rate: - return order->incoming_price_btc ? QString::number(order->incoming_price_btc, 'f', 6) : ""; - case ErrorMsg: - if(order->errorMsg.isEmpty()) return ""; - return order->errorMsg; - default: return {}; - } - } - - else if(role == Qt::BackgroundRole) { - if (_col == 0) { - if (order->state == OrderState::Status_OrderPaid || order->state == OrderState::Status_OrderPaidUnconfirmed) - return QBrush(Qt::darkGreen); - else if (order->state == OrderState::Status_OrderCreating || order->state == OrderState::Status_OrderToBeCreated) - return QBrush(Qt::yellow); - else if (order->state == OrderState::Status_OrderUnpaid) - return QBrush(Qt::cyan); - else if (order->state == OrderState::Status_OrderBTCSent) - return QBrush(Qt::green); - else if (order->state == OrderState::Status_OrderFailed || order->state == OrderState::Status_OrderTimedOut) - return QBrush(QColor(191, 255, 0)); // lime - } - } - else if (role == Qt::FontRole) { - switch(index.column()) { - case ID: - case Destination: - return ModelUtils::getMonospaceFont(); - } - } - - return QVariant(); -} - -QVariant XmrToModel::headerData(int section, Qt::Orientation orientation, int role) const { - if (role == Qt::DisplayRole && orientation == Qt::Horizontal) { - switch (section) { - case Status: - return QString("Status"); - case ID: - return QString("ID"); - case Destination: - return QString("Address"); - case Conversion: - return QString("Conversion"); - case Rate: - return QString("Rate"); - case ErrorMsg: - return QString("Message"); - default: - return QVariant(); - } - } - return QVariant(); -} \ No newline at end of file diff --git a/src/model/XmrToModel.h b/src/model/XmrToModel.h deleted file mode 100644 index f428f0e..0000000 --- a/src/model/XmrToModel.h +++ /dev/null @@ -1,38 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_XMRTOMODEL_H -#define FEATHER_XMRTOMODEL_H - -#include - -class XmrToOrder; -class XmrToModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - enum ModelColumn - { - Status = 0, - ID, - Conversion, - Rate, - Destination, - ErrorMsg, - COUNT - }; - - XmrToModel(QList *orders, QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const override; - int columnCount(const QModelIndex &parent = QModelIndex()) const override; - QVariant headerData(int section, Qt::Orientation orientation, int role) const override; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; - QList *orders; - -public slots: - void update(); -}; - - -#endif //FEATHER_XMRTOMODEL_H diff --git a/src/openpgp/CMakeLists.txt b/src/openpgp/CMakeLists.txt deleted file mode 100644 index 1c3f4ba..0000000 --- a/src/openpgp/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -file(GLOB_RECURSE SOURCES *.cpp) -file(GLOB_RECURSE HEADERS *.h) - -find_library(GCRYPT_LIBRARY gcrypt) -find_library(GPG_ERROR_LIBRARY gpg-error) - -add_library(openpgp - ${SOURCES} - ${HEADERS}) - -find_package(GCrypt) -target_include_directories(openpgp PUBLIC - ${CMAKE_SOURCE_DIR}/monero/contrib/epee/include - ${GCRYPT_INCLUDE_DIRS} - ) - -target_link_libraries(openpgp - PUBLIC - ${GCRYPT_LIBRARY} - ${GPG_ERROR_LIBRARY}) diff --git a/src/openpgp/openpgp.cpp b/src/openpgp/openpgp.cpp deleted file mode 100644 index fa50301..0000000 --- a/src/openpgp/openpgp.cpp +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright (c) 2020, The Monero Project -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#include "openpgp.h" - -#include -#include -#include - -#include - -#include "hash.h" -#include "mpi.h" -#include "packet_stream.h" -#include "s_expression.h" -#include "serialization.h" - -namespace openpgp -{ -namespace -{ - -std::string::const_iterator find_next_line(std::string::const_iterator begin, const std::string::const_iterator &end) -{ - begin = std::find(begin, end, '\n'); - return begin != end ? ++begin : end; -} - -std::string::const_iterator find_line_starting_with( - std::string::const_iterator it, - const std::string::const_iterator &end, - const std::string &starts_with) -{ - for (std::string::const_iterator next_line; it != end; it = next_line) - { - next_line = find_next_line(it, end); - const size_t line_length = static_cast(std::distance(it, next_line)); - if (line_length >= starts_with.size() && std::equal(starts_with.begin(), starts_with.end(), it)) - { - return it; - } - } - return end; -} - -std::string::const_iterator find_empty_line(std::string::const_iterator it, const std::string::const_iterator &end) -{ - for (; it != end && *it != '\r' && *it != '\n'; it = find_next_line(it, end)) - { - } - return it; -} - -std::string get_armored_block_contents(const std::string &text, const std::string &block_name) -{ - static constexpr const char dashes[] = "-----"; - const std::string armor_header = dashes + block_name + dashes; - auto block_start = find_line_starting_with(text.begin(), text.end(), armor_header); - auto block_headers = find_next_line(block_start, text.end()); - auto block_end = find_line_starting_with(block_headers, text.end(), dashes); - auto contents_begin = find_next_line(find_empty_line(block_headers, block_end), block_end); - if (contents_begin == block_end) - { - throw std::runtime_error("armored block not found"); - } - return std::string(contents_begin, block_end); -} - -} // namespace - -public_key_rsa::public_key_rsa(s_expression expression, size_t bits) - : m_expression(std::move(expression)) - , m_bits(bits) -{ -} - -const gcry_sexp_t &public_key_rsa::get() const -{ - return m_expression.get(); -} - -size_t public_key_rsa::bits() const -{ - return m_bits; -} - -public_key_block::public_key_block(const std::string &armored) - : public_key_block(epee::to_byte_span(epee::to_span(epee::string_encoding::base64_decode( - strip_line_breaks(get_armored_block_contents(armored, "BEGIN PGP PUBLIC KEY BLOCK")))))) -{ -} - -// TODO: Public-Key expiration, User ID and Public-Key certification, Subkey binding checks -public_key_block::public_key_block(const epee::span buffer) -{ - packet_stream packets(buffer); - - const std::vector *data = packets.find_first(packet_tag::type::user_id); - if (data == nullptr) - { - throw std::runtime_error("user id is missing"); - } - m_user_id.assign(data->begin(), data->end()); - - const auto append_public_key = [this](const std::vector &data) { - deserializer> serialized(data); - - const auto version = serialized.read_big_endian(); - if (version != 4) - { - throw std::runtime_error("unsupported public key version"); - } - - /* const auto timestamp = */ serialized.read_big_endian(); - - const auto algorithm = serialized.read_big_endian(); - if (algorithm != openpgp::algorithm::rsa) - { - throw std::runtime_error("unsupported public key algorithm"); - } - - { - const mpi public_key_n = serialized.read_mpi(); - const mpi public_key_e = serialized.read_mpi(); - - emplace_back( - s_expression("(public-key (rsa (n %m) (e %m)))", public_key_n.get(), public_key_e.get()), - gcry_mpi_get_nbits(public_key_n.get())); - } - }; - - data = packets.find_first(packet_tag::type::public_key); - if (data == nullptr) - { - throw std::runtime_error("public key is missing"); - } - append_public_key(*data); - - packets.for_each(packet_tag::type::public_subkey, append_public_key); -} - -std::string public_key_block::user_id() const -{ - return m_user_id; -} - -// TODO: Signature expiration check -signature_rsa::signature_rsa( - uint8_t algorithm, - std::pair hash_leftmost_bytes, - uint8_t hash_algorithm, - const std::vector &hashed_data, - type type, - s_expression signature, - uint8_t version) - : m_hash_algorithm(hash_algorithm) - , m_hash_leftmost_bytes(hash_leftmost_bytes) - , m_hashed_appendix(format_hashed_appendix(algorithm, hash_algorithm, hashed_data, type, version)) - , m_signature(std::move(signature)) - , m_type(type) -{ -} - -signature_rsa signature_rsa::from_armored(const std::string &armored_signed_message) -{ - return from_base64(get_armored_block_contents(armored_signed_message, "BEGIN PGP SIGNATURE")); -} - -signature_rsa signature_rsa::from_base64(const std::string &base64) -{ - std::string decoded = epee::string_encoding::base64_decode(strip_line_breaks(base64)); - epee::span buffer(reinterpret_cast(&decoded[0]), decoded.size()); - return from_buffer(buffer); -} - -signature_rsa signature_rsa::from_buffer(const epee::span input) -{ - packet_stream packets(input); - - const std::vector *data = packets.find_first(packet_tag::type::signature); - if (data == nullptr) - { - throw std::runtime_error("signature is missing"); - } - - deserializer> buffer(*data); - - const auto version = buffer.read_big_endian(); - if (version != 4) - { - throw std::runtime_error("unsupported signature version"); - } - - const auto signature_type = static_cast(buffer.read_big_endian()); - - const auto algorithm = buffer.read_big_endian(); - if (algorithm != openpgp::algorithm::rsa) - { - throw std::runtime_error("unsupported signature algorithm"); - } - - const auto hash_algorithm = buffer.read_big_endian(); - - const auto hashed_data_length = buffer.read_big_endian(); - std::vector hashed_data = buffer.read(hashed_data_length); - - const auto unhashed_data_length = buffer.read_big_endian(); - buffer.read_span(unhashed_data_length); - - std::pair hash_leftmost_bytes{buffer.read_big_endian(), buffer.read_big_endian()}; - - const mpi signature = buffer.read_mpi(); - - return signature_rsa( - algorithm, - std::move(hash_leftmost_bytes), - hash_algorithm, - hashed_data, - signature_type, - s_expression("(sig-val (rsa (s %m)))", signature.get()), - version); -} - -bool signature_rsa::verify(const epee::span message, const public_key_rsa &public_key) const -{ - const s_expression signed_data = hash_message(message, public_key.bits()); - return gcry_pk_verify(m_signature.get(), signed_data.get(), public_key.get()) == 0; -} - -s_expression signature_rsa::hash_message(const epee::span message, size_t public_key_bits) const -{ - switch (m_type) - { - case type::binary_document: - return hash_bytes(message, public_key_bits); - case type::canonical_text_document: - { - std::vector crlf_formatted; - crlf_formatted.reserve(message.size()); - const size_t message_size = message.size(); - for (size_t offset = 0; offset < message_size; ++offset) - { - const auto &character = message[offset]; - if (character == '\r') - { - continue; - } - if (character == '\n') - { - const bool skip_last_crlf = offset + 1 == message_size; - if (skip_last_crlf) - { - break; - } - crlf_formatted.push_back('\r'); - } - crlf_formatted.push_back(character); - } - return hash_bytes(epee::to_span(crlf_formatted), public_key_bits); - } - default: - throw std::runtime_error("unsupported signature type"); - } -} - -std::vector signature_rsa::hash_asn_object_id() const -{ - size_t size; - if (gcry_md_algo_info(m_hash_algorithm, GCRYCTL_GET_ASNOID, nullptr, &size) != GPG_ERR_NO_ERROR) - { - throw std::runtime_error("failed to get ASN.1 Object Identifier (OID) size"); - } - - std::vector asn_object_id(size); - if (gcry_md_algo_info(m_hash_algorithm, GCRYCTL_GET_ASNOID, &asn_object_id[0], &size) != GPG_ERR_NO_ERROR) - { - throw std::runtime_error("failed to get ASN.1 Object Identifier (OID)"); - } - - return asn_object_id; -} - -s_expression signature_rsa::hash_bytes(const epee::span message, size_t public_key_bits) const -{ - const std::vector plain_hash = (hash(m_hash_algorithm) << message << m_hashed_appendix).finish(); - if (plain_hash.size() < 2) - { - throw std::runtime_error("insufficient message hash size"); - } - if (plain_hash[0] != m_hash_leftmost_bytes.first || plain_hash[1] != m_hash_leftmost_bytes.second) - { - throw std::runtime_error("signature checksum doesn't match the expected value"); - } - - std::vector asn_object_id = hash_asn_object_id(); - - const size_t public_key_bytes = bits_to_bytes(public_key_bits); - if (public_key_bytes < plain_hash.size() + asn_object_id.size() + 11) - { - throw std::runtime_error("insufficient public key bit length"); - } - - std::vector emsa_pkcs1_v1_5_encoded; - emsa_pkcs1_v1_5_encoded.reserve(public_key_bytes); - emsa_pkcs1_v1_5_encoded.push_back(0); - emsa_pkcs1_v1_5_encoded.push_back(1); - const size_t ps_size = public_key_bytes - plain_hash.size() - asn_object_id.size() - 3; - emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), ps_size, 0xff); - emsa_pkcs1_v1_5_encoded.push_back(0); - emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), asn_object_id.begin(), asn_object_id.end()); - emsa_pkcs1_v1_5_encoded.insert(emsa_pkcs1_v1_5_encoded.end(), plain_hash.begin(), plain_hash.end()); - - mpi value(emsa_pkcs1_v1_5_encoded); - return s_expression("(data (flags raw) (value %m))", value.get()); -} - -std::vector signature_rsa::format_hashed_appendix( - uint8_t algorithm, - uint8_t hash_algorithm, - const std::vector &hashed_data, - uint8_t type, - uint8_t version) -{ - const uint16_t hashed_data_size = static_cast(hashed_data.size()); - const uint32_t hashed_pefix_size = sizeof(version) + sizeof(type) + sizeof(algorithm) + sizeof(hash_algorithm) + - sizeof(hashed_data_size) + hashed_data.size(); - - std::vector appendix; - appendix.reserve(hashed_pefix_size + sizeof(version) + sizeof(uint8_t) + sizeof(hashed_pefix_size)); - appendix.push_back(version); - appendix.push_back(type); - appendix.push_back(algorithm); - appendix.push_back(hash_algorithm); - appendix.push_back(static_cast(hashed_data_size >> 8)); - appendix.push_back(static_cast(hashed_data_size)); - appendix.insert(appendix.end(), hashed_data.begin(), hashed_data.end()); - appendix.push_back(version); - appendix.push_back(0xff); - appendix.push_back(static_cast(hashed_pefix_size >> 24)); - appendix.push_back(static_cast(hashed_pefix_size >> 16)); - appendix.push_back(static_cast(hashed_pefix_size >> 8)); - appendix.push_back(static_cast(hashed_pefix_size)); - - return appendix; -} - -message_armored::message_armored(const std::string &message_armored) - : m_message(get_armored_block_contents(message_armored, "BEGIN PGP SIGNED MESSAGE")) -{ -} - -message_armored::operator epee::span() const -{ - return epee::to_byte_span(epee::to_span(m_message)); -} - -} // namespace openpgp diff --git a/src/openpgp/openpgp.h b/src/openpgp/openpgp.h deleted file mode 100644 index e876ecc..0000000 --- a/src/openpgp/openpgp.h +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) 2020, The Monero Project -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include - -#include - -#include - -#include "s_expression.h" - -namespace openpgp -{ - -enum algorithm : uint8_t -{ - rsa = 1, -}; - -class public_key_rsa -{ -public: - public_key_rsa(s_expression expression, size_t bits); - - size_t bits() const; - const gcry_sexp_t &get() const; - -private: - s_expression m_expression; - size_t m_bits; -}; - -class public_key_block : public std::vector -{ -public: - public_key_block(const std::string &armored); - public_key_block(const epee::span buffer); - - std::string user_id() const; - -private: - std::string m_user_id; -}; - -class signature_rsa -{ -public: - enum type : uint8_t - { - binary_document = 0, - canonical_text_document = 1, - }; - - signature_rsa( - uint8_t algorithm, - std::pair hash_leftmost_bytes, - uint8_t hash_algorithm, - const std::vector &hashed_data, - type type, - s_expression signature, - uint8_t version); - - static signature_rsa from_armored(const std::string &armored_signed_message); - static signature_rsa from_base64(const std::string &base64); - static signature_rsa from_buffer(const epee::span input); - - bool verify(const epee::span message, const public_key_rsa &public_key) const; - -private: - s_expression hash_message(const epee::span message, size_t public_key_bits) const; - std::vector hash_asn_object_id() const; - s_expression hash_bytes(const epee::span message, size_t public_key_bits) const; - - static std::vector format_hashed_appendix( - uint8_t algorithm, - uint8_t hash_algorithm, - const std::vector &hashed_data, - uint8_t type, - uint8_t version); - -private: - uint8_t m_hash_algorithm; - std::pair m_hash_leftmost_bytes; - std::vector m_hashed_appendix; - s_expression m_signature; - type m_type; -}; - -class message_armored -{ -public: - message_armored(const std::string &message_armored); - - operator epee::span() const; - -private: - std::string m_message; -}; - -} // namespace openpgp diff --git a/src/openpgp/serialization.h b/src/openpgp/serialization.h deleted file mode 100644 index fb42c1b..0000000 --- a/src/openpgp/serialization.h +++ /dev/null @@ -1,172 +0,0 @@ -// Copyright (c) 2020, The Monero Project -// -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without modification, are -// permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, this list of -// conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright notice, this list -// of conditions and the following disclaimer in the documentation and/or other -// materials provided with the distribution. -// -// 3. Neither the name of the copyright holder nor the names of its contributors may be -// used to endorse or promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, -// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF -// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -#pragma once - -#include "mpi.h" - -namespace openpgp -{ - -size_t bits_to_bytes(size_t bits) -{ - constexpr const uint16_t bits_in_byte = 8; - return (bits + bits_in_byte - 1) / bits_in_byte; -} - -std::string strip_line_breaks(const std::string &string) -{ - std::string result; - result.reserve(string.size()); - for (const auto &character : string) - { - if (character != '\r' && character != '\n') - { - result.push_back(character); - } - } - return result; -} - -struct packet_tag -{ - enum type : uint8_t - { - signature = 2, - public_key = 6, - user_id = 13, - public_subkey = 14, - }; - - const type packet_type; - const size_t length; -}; - -template < - typename byte_container, - typename = typename std::enable_if<(sizeof(typename byte_container::value_type) == 1)>::type> -class deserializer -{ -public: - deserializer(byte_container buffer) - : buffer(std::move(buffer)) - , cursor(0) - { - } - - bool empty() const - { - return buffer.size() - cursor == 0; - } - - packet_tag read_packet_tag() - { - const auto tag = read_big_endian(); - - constexpr const uint8_t format_mask = 0b11000000; - constexpr const uint8_t format_old_tag = 0b10000000; - if ((tag & format_mask) != format_old_tag) - { - throw std::runtime_error("invalid packet tag"); - } - - const packet_tag::type packet_type = static_cast((tag & 0b00111100) >> 2); - const uint8_t length_type = tag & 0b00000011; - - size_t length; - switch (length_type) - { - case 0: - length = read_big_endian(); - break; - case 1: - length = read_big_endian(); - break; - case 2: - length = read_big_endian(); - break; - default: - throw std::runtime_error("unsupported packet length type"); - } - - return {packet_type, length}; - } - - mpi read_mpi() - { - const size_t bit_length = read_big_endian(); - return mpi(read_span(bits_to_bytes(bit_length))); - } - - std::vector read(size_t size) - { - if (buffer.size() - cursor < size) - { - throw std::runtime_error("insufficient buffer size"); - } - - const size_t offset = cursor; - cursor += size; - - return {&buffer[offset], &buffer[cursor]}; - } - - template ::value>::type> - T read_big_endian() - { - if (buffer.size() - cursor < sizeof(T)) - { - throw std::runtime_error("insufficient buffer size"); - } - T result = 0; - for (size_t read = 0; read < sizeof(T); ++read) - { - result = (result << 8) | static_cast(buffer[cursor++]); - } - return result; - } - - epee::span read_span(size_t size) - { - if (buffer.size() - cursor < size) - { - throw std::runtime_error("insufficient buffer size"); - } - - const size_t offset = cursor; - cursor += size; - - return {reinterpret_cast(&buffer[offset]), size}; - } - -private: - byte_container buffer; - size_t cursor; -}; - -} // namespace openpgp diff --git a/src/qrcode/CMakeLists.txt b/src/qrcode/CMakeLists.txt index 9ffcf58..86b79c9 100644 --- a/src/qrcode/CMakeLists.txt +++ b/src/qrcode/CMakeLists.txt @@ -18,4 +18,5 @@ set(qrcode_SOURCES ) add_library(qrcode STATIC ${qrcode_SOURCES}) +target_include_directories(qrcode PUBLIC ${QRENCODE_INCLUDE_DIR}) target_link_libraries(qrcode Qt5::Core Qt5::Widgets Qt5::Svg ${QRENCODE_LIBRARY}) diff --git a/src/qrcode/QrCode.cpp b/src/qrcode/QrCode.cpp index 7a51155..6769540 100644 --- a/src/qrcode/QrCode.cpp +++ b/src/qrcode/QrCode.cpp @@ -21,15 +21,9 @@ #include "QrCode_p.h" #include -#include -#include -#include #include -#include -#include #include #include -#include #include diff --git a/src/receivewidget.cpp b/src/receivewidget.cpp index 0b623e9..748fa58 100644 --- a/src/receivewidget.cpp +++ b/src/receivewidget.cpp @@ -1,14 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ui_receivewidget.h" #include "receivewidget.h" -#include "qrcode/QrCode.h" #include "model/ModelUtils.h" #include "dialog/qrcodedialog.h" #include -#include ReceiveWidget::ReceiveWidget(QWidget *parent) : QWidget(parent), @@ -105,6 +103,10 @@ void ReceiveWidget::onShowTransactions() { emit showTransactions(address); } +void ReceiveWidget::resetModel() { + ui->addresses->setModel(nullptr); +} + void ReceiveWidget::setShowFullAddresses(bool show) { if (!m_model) return; m_model->setShowFullAddresses(show); diff --git a/src/receivewidget.h b/src/receivewidget.h index 5aa9cd3..8890f64 100644 --- a/src/receivewidget.h +++ b/src/receivewidget.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_RECEIVEWIDGET_H -#define FEATHER_RECEIVEWIDGET_H +#ifndef WOWLET_RECEIVEWIDGET_H +#define WOWLET_RECEIVEWIDGET_H #include "appcontext.h" #include "qrcode/QrCode.h" @@ -36,6 +36,7 @@ public slots: void setShowUsedAddresses(bool show); void setSearchFilter(const QString &filter); void onShowTransactions(); + void resetModel(); signals: void generateSubaddress(); @@ -58,4 +59,4 @@ private: void showQrCodeDialog(); }; -#endif //FEATHER_RECEIVEWIDGET_H +#endif //WOWLET_RECEIVEWIDGET_H diff --git a/src/sendwidget.cpp b/src/sendwidget.cpp index 01b0c30..4abce16 100644 --- a/src/sendwidget.cpp +++ b/src/sendwidget.cpp @@ -1,11 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include "sendwidget.h" -#include "widgets/ccswidget.h" #include "mainwindow.h" #include "ui_sendwidget.h" +#include "globals.h" SendWidget::SendWidget(QWidget *parent) : QWidget(parent), @@ -24,15 +24,15 @@ SendWidget::SendWidget(QWidget *parent) : connect(ui->btnClear, &QPushButton::clicked, this, &SendWidget::clearClicked); connect(ui->btnMax, &QPushButton::clicked, this, &SendWidget::btnMaxClicked); connect(ui->comboCurrencySelection, QOverload::of(&QComboBox::currentIndexChanged), this, &SendWidget::currencyComboChanged); - connect(ui->lineAmount, &QLineEdit::textEdited, this, &SendWidget::amountEdited); - connect(ui->lineAddress, &QLineEdit::textEdited, this, &SendWidget::addressEdited); + connect(ui->lineAmount, &QLineEdit::textChanged, this, &SendWidget::amountEdited); + connect(ui->lineAddress, &QPlainTextEdit::textChanged, this, &SendWidget::addressEdited); connect(ui->btn_openAlias, &QPushButton::clicked, this, &SendWidget::aliasClicked); ui->label_conversionAmount->setText(""); ui->label_conversionAmount->hide(); ui->btn_openAlias->hide(); ui->label_PayTo->setHelpText("Recipient of the funds.\n\n" - "You may enter a Monero address, or an alias (email-like address that forwards to a Monero address)"); + "You may enter a Wownero address, or an alias (email-like address that forwards to a Wownero address)"); ui->label_Description->setHelpText("Description of the transaction (optional).\n\n" "The description is not sent to the recipient of the funds. It is stored in your wallet cache, " "and displayed in the 'History' tab."); @@ -41,6 +41,7 @@ SendWidget::SendWidget(QWidget *parent) : "You will be able to review the transaction fee before the transaction is broadcast.\n\n" "To send all your balance, click the Max button to the right."); + ui->lineAddress->setNetType(m_ctx->networkType); this->setupComboBox(); } @@ -50,8 +51,22 @@ void SendWidget::currencyComboChanged(int index) { this->amountEdited(amount); } -void SendWidget::addressEdited(const QString &text) { - text.contains(".") ? ui->btn_openAlias->show() : ui->btn_openAlias->hide(); +void SendWidget::addressEdited() { + QVector outputs = ui->lineAddress->getOutputs(); + + bool freezeAmounts = outputs.size() > 0; + + ui->lineAmount->setReadOnly(freezeAmounts); + ui->lineAmount->setFrame(!freezeAmounts); + ui->btnMax->setDisabled(freezeAmounts); + ui->comboCurrencySelection->setDisabled(freezeAmounts); + + if (outputs.size() > 0) { + ui->lineAmount->setText(WalletManager::displayAmount(ui->lineAddress->getTotal())); + ui->comboCurrencySelection->setCurrentIndex(0); + } + + ui->btn_openAlias->setVisible(ui->lineAddress->isOpenAlias()); } void SendWidget::amountEdited(const QString &text) { @@ -69,7 +84,9 @@ void SendWidget::fill(double amount) { void SendWidget::fill(const QString &address, const QString &description, double amount) { ui->lineDescription->setText(description); ui->lineAddress->setText(address); - ui->lineAddress->setCursorPosition(0); + + ui->lineAddress->moveCursor(QTextCursor::Start); + if (amount > 0) ui->lineAmount->setText(QString::number(amount)); this->updateConversionLabel(); @@ -77,7 +94,7 @@ void SendWidget::fill(const QString &address, const QString &description, double void SendWidget::fillAddress(const QString &address) { ui->lineAddress->setText(address); - ui->lineAddress->setCursorPosition(0); + ui->lineAddress->moveCursor(QTextCursor::Start); } void SendWidget::sendClicked() { @@ -88,7 +105,6 @@ void SendWidget::sendClicked() { return; } - double amount; QString currency = ui->comboCurrencySelection->currentText(); QString recipient = ui->lineAddress->text().simplified().remove(' '); QString description = ui->lineDescription->text(); @@ -97,24 +113,52 @@ void SendWidget::sendClicked() { return; } - if (currency != "XMR") { - amount = this->conversionAmount(); - if(amount <= 0.0) { + QVector outputs = ui->lineAddress->getOutputs(); + QVector errors = ui->lineAddress->getErrors(); + if (errors.size() > 0 && ui->lineAddress->isMultiline()) { + QString errorText; + for (auto &error: errors) { + errorText += QString("Line #%1:\n%2\n").arg(QString::number(error.idx + 1), error.error); + } + + QMessageBox::warning(this, "Warning", QString("Invalid lines found:\n\n%1").arg(errorText)); + return; + } + + if (outputs.size() > 0) { // multi destination transaction + if (outputs.size() > 16) { + QMessageBox::warning(this, "Warning", "Maximum number of outputs (16) exceeded."); + return; + } + + QVector addresses; + QVector amounts; + for (auto &output : outputs) { + addresses.push_back(output.address); + amounts.push_back(output.amount); + } + + emit createTransactionMultiDest(addresses, amounts, description); + return; + } + + quint64 amount; + if (currency == "WOW") { + amount = this->amount(); + bool sendAll = (ui->lineAmount->text() == "all"); + if (amount == 0 && !sendAll) { + QMessageBox::warning(this, "Amount error", "Invalid amount specified."); + return; + } + emit createTransaction(recipient, amount, description, sendAll); + } else { + amount = WalletManager::amountFromDouble(this->conversionAmount()); + if (amount == 0) { QMessageBox::warning(this, "Fiat conversion error", "Could not create transaction."); return; } emit createTransaction(recipient, amount, description, false); - return; } - - amount = this->amount(); - bool sendAll = amount == -1.0; - if(amount == 0.0){ - QMessageBox::warning(this, "Amount error", "Invalid amount specified."); - return; - } - - emit createTransaction(recipient, amount, description, sendAll); } void SendWidget::aliasClicked() { @@ -130,27 +174,28 @@ void SendWidget::clearClicked() { void SendWidget::btnMaxClicked() { ui->lineAmount->setText("all"); + this->updateConversionLabel(); } void SendWidget::updateConversionLabel() { - auto amount = this->amount(); - if(amount == -1) return; + auto amount = this->amountDouble(); + ui->label_conversionAmount->setText(""); - if(amount <= 0) { + if (amount <= 0) { ui->label_conversionAmount->hide(); return; } QString conversionAmountStr = [this]{ QString currency = ui->comboCurrencySelection->currentText(); - if (currency != "XMR") { - return QString("~%1 XMR").arg(QString::number(this->conversionAmount(), 'f')); + if (currency != "WOW") { + return QString("~%1 WOW").arg(QString::number(this->conversionAmount(), 'f')); } else { auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); - double conversionAmount = AppContext::prices->convert("XMR", preferredFiatCurrency, this->amount()); + double conversionAmount = AppContext::prices->convert("WOW", preferredFiatCurrency, this->amountDouble()); return QString("~%1 %2").arg(QString::number(conversionAmount, 'f', 2), preferredFiatCurrency); - }; + } }(); ui->label_conversionAmount->setText(conversionAmountStr); @@ -159,18 +204,23 @@ void SendWidget::updateConversionLabel() { double SendWidget::conversionAmount() { QString currency = ui->comboCurrencySelection->currentText(); - return AppContext::prices->convert(currency, "XMR", this->amount()); + return AppContext::prices->convert(currency, "XMR", this->amountDouble()); } -double SendWidget::amount() { +quint64 SendWidget::amount() { // grab amount from "amount" text box QString amount = ui->lineAmount->text(); - if(amount == "all") return -1.0; + if (amount == "all") return 0; + amount.replace(',', '.'); - if(amount.isEmpty()) return 0.0; - auto amount_num = amount.toDouble(); - if(amount_num <= 0) return 0.0; - return amount_num; + if (amount.isEmpty()) return 0; + + return WalletManager::amountFromString(amount); +} + +double SendWidget::amountDouble() { + quint64 amount = this->amount(); + return amount / globals::cdiv; } void SendWidget::onOpenAliasResolved(const QString &address, const QString &openAlias) { @@ -189,6 +239,10 @@ void SendWidget::clearFields() { ui->label_conversionAmount->clear(); } +void SendWidget::payToMany() { + ui->lineAddress->payToMany(); +} + void SendWidget::onWalletClosed() { this->clearFields(); ui->btnSend->setEnabled(true); @@ -205,7 +259,7 @@ void SendWidget::onEndTransaction() { void SendWidget::setupComboBox() { ui->comboCurrencySelection->clear(); - QStringList defaultCurrencies = {"XMR", "USD", "EUR", "CNY", "JPY", "GBP"}; + QStringList defaultCurrencies = {"WOW", "USD", "EUR", "CNY", "JPY", "GBP"}; QString preferredCurrency = config()->get(Config::preferredFiatCurrency).toString(); if (defaultCurrencies.contains(preferredCurrency)) { diff --git a/src/sendwidget.h b/src/sendwidget.h index d73bfea..0821f01 100644 --- a/src/sendwidget.h +++ b/src/sendwidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef SENDWIDGET_H #define SENDWIDGET_H @@ -22,6 +22,7 @@ public: void fill(const QString &address, const QString& description, double amount = 0); void fill(double amount); void clearFields(); + void payToMany(); ~SendWidget() override; public slots: @@ -30,7 +31,7 @@ public slots: void aliasClicked(); void btnMaxClicked(); void amountEdited(const QString &text); - void addressEdited(const QString &text); + void addressEdited(); void currencyComboChanged(int index); void fillAddress(const QString &address); void updateConversionLabel(); @@ -44,14 +45,16 @@ public slots: signals: void resolveOpenAlias(const QString &address); - void createTransaction(const QString &address, double amount, const QString &description, bool all); + void createTransaction(const QString &address, quint64 amount, const QString &description, bool all); + void createTransactionMultiDest(const QVector &addresses, const QVector &amounts, const QString &description); private: void setupComboBox(); + double amountDouble(); Ui::SendWidget *ui; AppContext *m_ctx; - double amount(); + quint64 amount(); double conversionAmount(); }; diff --git a/src/sendwidget.ui b/src/sendwidget.ui index 8e5464e..b5b3810 100644 --- a/src/sendwidget.ui +++ b/src/sendwidget.ui @@ -7,7 +7,7 @@ 0 0 647 - 175 + 231 @@ -46,11 +46,7 @@ - - - - - + @@ -190,6 +186,11 @@ QLabel
components.h
+ + PayToEdit + QPlainTextEdit +
widgets/PayToEdit.h
+
diff --git a/src/settings.cpp b/src/settings.cpp index 09c13e4..fac282c 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1,13 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "settings.h" #include "ui_settings.h" -#include "appcontext.h" -#include "utils/config.h" + #include "mainwindow.h" #include +#include Settings::Settings(QWidget *parent) : QDialog(parent), @@ -23,21 +23,31 @@ Settings::Settings(QWidget *parent) : connect(ui->btnCopyToClipboard, &QPushButton::clicked, this, &Settings::copyToClipboard); connect(ui->checkBox_externalLink, &QCheckBox::clicked, this, &Settings::checkboxExternalLinkWarn); + connect(ui->checkBox_hideFiatBalance, &QCheckBox::toggled, [this](bool toggled){ + config()->set(Config::hideFiatBalance, toggled); + m_ctx->updateBalance(); + }); connect(ui->checkBox_hideBalance, &QCheckBox::toggled, [this](bool toggled){ config()->set(Config::hideBalance, toggled); m_ctx->updateBalance(); }); + connect(ui->checkBox_hideOnClose, &QCheckBox::toggled, [this](bool toggled){ + config()->set(Config::hideOnClose, toggled); + QApplication::setQuitOnLastWindowClosed(toggled); + }); + connect(ui->closeButton, &QDialogButtonBox::accepted, this, &Settings::close); // nodes ui->nodeWidget->setupUI(m_ctx); connect(ui->nodeWidget, &NodeWidget::nodeSourceChanged, m_ctx->nodes, &Nodes::onNodeSourceChanged); - connect(ui->nodeWidget, &NodeWidget::connectToNode, m_ctx->nodes, QOverload::of(&Nodes::connectToNode)); + connect(ui->nodeWidget, &NodeWidget::connectToNode, m_ctx->nodes, QOverload::of(&Nodes::connectToNode)); // setup checkboxes ui->checkBox_externalLink->setChecked(config()->get(Config::warnOnExternalLink).toBool()); ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool()); + ui->checkBox_hideOnClose->setChecked(config()->get(Config::hideOnClose).toBool()); // setup comboboxes this->setupSkinCombobox(); @@ -47,6 +57,10 @@ Settings::Settings(QWidget *parent) : connect(ui->comboBox_skin, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_skinChanged); connect(ui->comboBox_blockExplorer, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_blockExplorerChanged); + connect(ui->comboBox_redditFrontend, QOverload::of(&QComboBox::currentIndexChanged), this, &Settings::comboBox_redditFrontendChanged); + + // setup reddit combobox + ui->comboBox_redditFrontend->setCurrentText(config()->get(Config::redditFrontend).toString()); // setup preferred fiat currency combobox QStringList fiatCurrencies; @@ -96,6 +110,11 @@ void Settings::comboBox_blockExplorerChanged(int pos) { emit blockExplorerChanged(blockExplorer); } +void Settings::comboBox_redditFrontendChanged(int pos) { + QString redditFrontend = ui->comboBox_redditFrontend->currentText(); + config()->set(Config::redditFrontend, redditFrontend); +} + void Settings::copyToClipboard() { ui->textLogs->copy(); } diff --git a/src/settings.h b/src/settings.h index a34e9e7..5514ba7 100644 --- a/src/settings.h +++ b/src/settings.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef SETTINGS_H #define SETTINGS_H @@ -36,10 +36,11 @@ public slots: void checkboxExternalLinkWarn(); void fiatCurrencySelected(int index); void comboBox_skinChanged(int pos); - void comboBox_blockExplorerChanged(int post); + void comboBox_blockExplorerChanged(int pos); + void comboBox_redditFrontendChanged(int pos); private: - QStringList m_skins{"Native", "QDarkStyle", "Breeze/Dark", "Breeze/Light"}; + QStringList m_skins{"Native", "WOW", "QDarkStyle", "Breeze/Dark", "Breeze/Light"}; private: void setupSkinCombobox(); diff --git a/src/settings.ui b/src/settings.ui index 20ff38f..76d1829 100644 --- a/src/settings.ui +++ b/src/settings.ui @@ -17,7 +17,7 @@ - 0 + 5 @@ -141,37 +141,67 @@ - exploremonero.com + explore.wownero.com - xmrchain.net - - - - - moneroblocks.info - - - - - blockchair.com + muchwow.lol - + Warn before opening external link - + - Hide balance + Hide balances + + + + + + + Reddit frontend: + + + + + + + + old.reddit.com + + + + + reddit.com + + + + + teddit.net + + + + + + + + Hide fiat balance + + + + + + + Hide application on close @@ -287,8 +317,8 @@ - - false + + true @@ -317,8 +347,8 @@ - - false + + true @@ -331,8 +361,8 @@ - - false + + true diff --git a/src/ui/BreezeStyleSheets/breeze.qrc b/src/ui/BreezeStyleSheets/breeze.qrc index 88fb185..02a4212 100644 --- a/src/ui/BreezeStyleSheets/breeze.qrc +++ b/src/ui/BreezeStyleSheets/breeze.qrc @@ -1,5 +1,45 @@ + wow/hmovetoolbar.svg + wow/vmovetoolbar.svg + wow/hsepartoolbar.svg + wow/vsepartoolbars.svg + wow/stylesheet-branch-end.svg + wow/stylesheet-branch-end-closed.svg + wow/stylesheet-branch-end-open.svg + wow/stylesheet-vline.svg + wow/stylesheet-branch-more.svg + wow/branch_closed.svg + wow/branch_closed-on.svg + wow/branch_open.svg + wow/branch_open-on.svg + wow/down_arrow.svg + wow/down_arrow_disabled.svg + wow/down_arrow-hover.svg + wow/left_arrow.svg + wow/left_arrow_disabled.svg + wow/right_arrow.svg + wow/right_arrow_disabled.svg + wow/up_arrow.svg + wow/up_arrow_disabled.svg + wow/up_arrow-hover.svg + wow/sizegrip.svg + wow/transparent.svg + wow/close.svg + wow/close-hover.svg + wow/close-pressed.svg + wow/undock.svg + wow/undock-hover.svg + wow/checkbox_checked.svg + wow/checkbox_checked_disabled.svg + wow/checkbox_indeterminate.svg + wow/checkbox_indeterminate_disabled.svg + wow/checkbox_unchecked.svg + wow/checkbox_unchecked_disabled.svg + wow/radio_checked.svg + wow/radio_checked_disabled.svg + wow/radio_unchecked.svg + wow/radio_unchecked_disabled.svg light/hmovetoolbar.svg light/vmovetoolbar.svg light/hsepartoolbar.svg @@ -83,6 +123,7 @@ dark/radio_checked_disabled.svg dark/radio_unchecked.svg dark/radio_unchecked_disabled.svg + wow.qss light.qss dark.qss diff --git a/src/ui/BreezeStyleSheets/wow.qss b/src/ui/BreezeStyleSheets/wow.qss new file mode 100644 index 0000000..88f4808 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow.qss @@ -0,0 +1,1664 @@ +/* + * BreezeDark stylesheet. + * + * :author: Colin Duquesnoy + * :editor: Alex Huszagh + * :license: MIT, see LICENSE.md + * + * This is originally a fork of QDarkStyleSheet, and is based on Breeze/ + * BreezeDark color scheme, but is in no way affiliated with KDE. + * + * --------------------------------------------------------------------- + * The MIT License (MIT) + * + * Copyright (c) <2013-2014> + * Copyright (c) <2015-2016> + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * --------------------------------------------------------------------- + */ + +QToolTip +{ + border: 0.1ex solid #bd93f9; + background-color: #282a36; + alternate-background-color: #44475a; + color: #f8f8f2; + padding: 0.5ex; + opacity: 200; +} + +QWidget +{ + color: #f8f8f2; + background-color: #282a36; + selection-background-color:#6272a4; + selection-color: #f8f8f2; + background-clip: border; + border-image: none; + border: 0px transparent #bd93f9; + outline: 0; +} + +QWidget::item:hover +{ + background-color: #8be9fd; + color: #f8f8f2; +} + +QWidget::item:selected +{ + background-color: #6272a4; +} + + +QCheckBox +{ + spacing: 0.5ex; + outline: none; + color: #f8f8f2; + margin-bottom: 0.2ex; + opacity: 200; +} + +QCheckBox:disabled +{ + color: #44475a; +} + +QGroupBox::indicator +{ + margin-left: 0.2ex; +} + +QCheckBox::indicator:unchecked, +QCheckBox::indicator:unchecked:focus +{ + border-image: url(:/wow/checkbox_unchecked_disabled.svg); +} + +QCheckBox::indicator:unchecked:hover, +QCheckBox::indicator:unchecked:pressed, +QGroupBox::indicator:unchecked:hover, +QGroupBox::indicator:unchecked:focus, +QGroupBox::indicator:unchecked:pressed +{ + border: none; + border-image: url(:/wow/checkbox_unchecked.svg); +} + +QCheckBox::indicator:checked +{ + border-image: url(:/wow/checkbox_checked.svg); +} + +QCheckBox::indicator:checked:hover, +QCheckBox::indicator:checked:focus, +QCheckBox::indicator:checked:pressed, +QGroupBox::indicator:checked:hover, +QGroupBox::indicator:checked:focus, +QGroupBox::indicator:checked:pressed +{ + border: none; + border-image: url(:/wow/checkbox_checked.svg); +} + +QCheckBox::indicator:indeterminate +{ + border-image: url(:/wow/checkbox_indeterminate.svg); +} + +QCheckBox::indicator:indeterminate:focus, +QCheckBox::indicator:indeterminate:hover, +QCheckBox::indicator:indeterminate:pressed +{ + border-image: url(:/wow/checkbox_indeterminate.svg); +} + +QCheckBox::indicator:indeterminate:disabled +{ + border-image: url(:/wow/checkbox_indeterminate_disabled.svg); +} + +QCheckBox::indicator:checked:disabled, +QGroupBox::indicator:checked:disabled +{ + border-image: url(:/wow/checkbox_checked_disabled.svg); +} + +QCheckBox::indicator:unchecked:disabled, +QGroupBox::indicator:unchecked:disabled +{ + border-image: url(:/wow/checkbox_unchecked_disabled.svg); +} + +QRadioButton +{ + spacing: 0.5ex; + outline: none; + color: #f8f8f2; + margin-bottom: 0.2ex; +} + +QRadioButton:disabled +{ + color: #44475a; +} + +QRadioButton::indicator:unchecked, +QRadioButton::indicator:unchecked:focus +{ + border-image: url(:/wow/radio_unchecked_disabled.svg); +} + + +QRadioButton::indicator:unchecked:hover, +QRadioButton::indicator:unchecked:pressed +{ + border: none; + outline: none; + border-image: url(:/wow/radio_unchecked.svg); +} + + +QRadioButton::indicator:checked +{ + border: none; + outline: none; + border-image: url(:/wow/radio_checked.svg); +} + +QRadioButton::indicator:checked:hover, +QRadioButton::indicator:checked:focus, +QRadioButton::indicator:checked:pressed +{ + border: none; + outline: none; + border-image: url(:/wow/radio_checked.svg); +} + +QRadioButton::indicator:checked:disabled +{ + outline: none; + border-image: url(:/wow/radio_checked_disabled.svg); +} + +QRadioButton::indicator:unchecked:disabled +{ + border-image: url(:/wow/radio_unchecked_disabled.svg); +} + +QMenuBar +{ + background-color: #282a36; + color: #f8f8f2; +} + +QMenuBar::item +{ + background: transparent; +} + +QMenuBar::item:selected +{ + background: transparent; + border: 0.1ex solid #bd93f9; +} + +QMenuBar::item:pressed +{ + border: 0.1ex solid #bd93f9; + background-color: #bd93f9; + color: #f8f8f2; + margin-bottom: -0.1ex; + padding-bottom: 0.1ex; +} + +QMenu +{ + border: 0.1ex solid #bd93f9; + color: #f8f8f2; + margin: 0.2ex; +} + +QMenu::icon +{ + margin: 0.5ex; +} + +QMenu::item +{ + padding: 0.5ex 3ex 0.5ex 3ex; + margin-left: 0.5ex; + border: 0.1ex solid transparent; /* reserve space for selection border */ +} + +QMenu::item:selected +{ + color: #f8f8f2; +} + +QMenu::separator +{ + height: 0.2ex; + background: #8be9fd; + margin-left: 1ex; + margin-right: 0.5ex; +} + +/* non-exclusive indicator = check box style indicator + (see QActionGroup::setExclusive) */ +QMenu::indicator:non-exclusive:unchecked +{ + border-image: url(:/wow/checkbox_unchecked_disabled.svg); +} + +QMenu::indicator:non-exclusive:unchecked:selected +{ + border-image: url(:/wow/checkbox_unchecked_disabled.svg); +} + +QMenu::indicator:non-exclusive:checked +{ + border-image: url(:/wow/checkbox_checked.svg); +} + +QMenu::indicator:non-exclusive:checked:selected +{ + border-image: url(:/wow/checkbox_checked.svg); +} + +/* exclusive indicator = radio button style indicator (see QActionGroup::setExclusive) */ +QMenu::indicator:exclusive:unchecked +{ + border-image: url(:/wow/radio_unchecked_disabled.svg); +} + +QMenu::indicator:exclusive:unchecked:selected +{ + border-image: url(:/wow/radio_unchecked_disabled.svg); +} + +QMenu::indicator:exclusive:checked +{ + border-image: url(:/wow/radio_checked.svg); +} + +QMenu::indicator:exclusive:checked:selected +{ + border-image: url(:/wow/radio_checked.svg); +} + +QMenu::right-arrow +{ + margin: 0.5ex; + border-image: url(:/light/right_arrow.svg); + width: 0.6ex; + height: 0.9ex; +} + + +QWidget:disabled +{ + color: #454545; + background-color: #282a36; +} + +QAbstractItemView +{ + alternate-background-color: #282a36; + color: #f8f8f2; + border: 0.1ex solid #bd93f9; + border-radius: 0.2ex; +} + +QWidget:focus, +QMenuBar:focus +{ + border: 0.1ex solid #bd93f9; +} + +QTabWidget:focus, +QCheckBox:focus, +QRadioButton:focus, +QSlider:focus +{ + border: none; +} + +QLineEdit +{ + background-color: #232629; + padding: 0.5ex; + border-style: solid; + border: 0.1ex solid #bd93f9; + border-radius: 0.2ex; + color: #f8f8f2; +} + +QGroupBox +{ + border: 0.1ex solid #bd93f9; + border-radius: 0.2ex; + padding-top: 1ex; + margin-top: 1ex; +} + +QGroupBox::title +{ + subcontrol-origin: margin; + subcontrol-position: top center; + padding-left: 0.1ex; + padding-right: 0.1ex; + margin-top: -0.7ex; +} + +QAbstractScrollArea +{ + border-radius: 0.2ex; + border: 0.1ex solid #bd93f9; + background-color: transparent; +} + +QScrollBar:horizontal +{ + height: 1.5ex; + margin: 0.3ex 1.5ex 0.3ex 1.5ex; + border: 0.1ex transparent #bd93f9; + border-radius: 0.4ex; + background-color: #2A2929; +} + +QScrollBar::handle:horizontal +{ + background-color: #bd93f9; + min-width: 0.5ex; + border-radius: 0.4ex; +} + +QScrollBar::add-line:horizontal +{ + margin: 0px 0.3ex 0px 0.3ex; + border-image: url(:/wow/right_arrow_disabled.svg); + width: 1ex; + height: 1ex; + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal +{ + margin: 0ex 0.3ex 0ex 0.3ex; + border-image: url(:/wow/left_arrow_disabled.svg); + width: 1ex; + height: 1ex; + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::add-line:horizontal:hover, +QScrollBar::add-line:horizontal:on +{ + border-image: url(:/wow/right_arrow.svg); + width: 1ex; + height: 1ex; + subcontrol-position: right; + subcontrol-origin: margin; +} + + +QScrollBar::sub-line:horizontal:hover, +QScrollBar::sub-line:horizontal:on +{ + border-image: url(:/wow/left_arrow.svg); + width: 1ex; + height: 1ex; + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::up-arrow:horizontal, +QScrollBar::down-arrow:horizontal +{ + background: none; +} + + +QScrollBar::add-page:horizontal, +QScrollBar::sub-page:horizontal +{ + background: none; +} + +QScrollBar:vertical +{ + background-color: #2A2929; + width: 1.5ex; + margin: 1.5ex 0.3ex 1.5ex 0.3ex; + border: 0.1ex transparent #bd93f9; + border-radius: 0.4ex; +} + +QScrollBar::handle:vertical +{ + background-color: #ff79c6; + min-height: 0.5ex; + border-radius: 0.4ex; +} + +QScrollBar::sub-line:vertical +{ + margin: 0.3ex 0ex 0.3ex 0ex; + border-image: url(:/wow/up_arrow_disabled.svg); + height: 1ex; + width: 1ex; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-line:vertical +{ + margin: 0.3ex 0ex 0.3ex 0ex; + border-image: url(:/wow/down_arrow_disabled.svg); + height: 1ex; + width: 1ex; + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:vertical:hover, +QScrollBar::sub-line:vertical:on +{ + + border-image: url(:/wow/up_arrow.svg); + height: 1ex; + width: 1ex; + subcontrol-position: top; + subcontrol-origin: margin; +} + + +QScrollBar::add-line:vertical:hover, +QScrollBar::add-line:vertical:on +{ + border-image: url(:/wow/down_arrow.svg); + height: 1ex; + width: 1ex; + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::up-arrow:vertical, QScrollBar::down-arrow:vertical +{ + background: none; +} + + +QScrollBar::add-page:vertical, QScrollBar::sub-page:vertical +{ + background: none; +} + +QTextEdit +{ + background-color: #232629; + color: #f8f8f2; + border: 0.1ex solid #bd93f9; +} + +QPlainTextEdit +{ + background-color: #232629; + color: #f8f8f2; + border-radius: 0.2ex; + border: 0.1ex solid #bd93f9; +} + +QHeaderView::section +{ + background-color: #44475a; + color: #f8f8f2; + padding: 0.5ex; + border: 0.1ex solid #bd93f9; +} + +QSizeGrip +{ + border-image: url(:/wow/sizegrip.svg); + width: 1.2ex; + height: 1.2ex; +} + +QMainWindow::separator +{ + background-color: #282a36; + color: white; + padding-left: 0.4ex; + spacing: 0.2ex; + border: 0.1ex dashed #bd93f9; +} + +QMainWindow::separator:hover +{ + + background-color: #787876; + color: white; + padding-left: 0.4ex; + border: 0.1ex solid #bd93f9; + spacing: 0.2ex; +} + +QMenu::separator +{ + height: 0.1ex; + background-color: #bd93f9; + color: white; + padding-left: 0.4ex; + margin-left: 1ex; + margin-right: 0.5ex; +} + +QFrame[frameShape="2"], /* QFrame::Panel == 0x0003 */ +QFrame[frameShape="3"], /* QFrame::WinPanel == 0x0003 */ +QFrame[frameShape="4"], /* QFrame::HLine == 0x0004 */ +QFrame[frameShape="5"], /* QFrame::VLine == 0x0005 */ +QFrame[frameShape="6"] /* QFrame::StyledPanel == 0x0006 */ +{ + border-width: 0.1ex; + padding: 0.1ex; + border-style: solid; + border-color: #bd93f9; + background-color: #44475a; + border-radius: 0.5ex; +} + +QStackedWidget +{ + border: 0.1ex transparent #bd93f9; +} + +QToolBar +{ + border: 0.1ex transparent #bd93f9; + background: 0.1ex solid #282a36; + font-weight: bold; +} + +QToolBar::handle:horizontal +{ + border-image: url(:/wow/hmovetoolbar.svg); + width = 1.6ex; + height = 6.4ex; +} + +QToolBar::handle:vertical +{ + border-image: url(:/wow/vmovetoolbar.svg); + width = 5.4ex; + height = 1ex; +} + +QToolBar::separator:horizontal +{ + border-image: url(:/wow/hsepartoolbar.svg); + width = 0.7ex; + height = 6.3ex; +} + +QToolBar::separator:vertical +{ + border-image: url(:/wow/vsepartoolbars.svg); + width = 6.3ex; + height = 0.7ex; +} + +QPushButton +{ + color: #f8f8f2; + background-color: qlineargradient(x1: 0.5, y1: 0.5 x2: 0.5, y2: 1, stop: 0 #44475a, stop: 0.5 #282a36); + border-width: 0.1ex; + border-color: #bd93f9; + border-style: solid; + padding: 0.5ex; + border-radius: 0.2ex; + outline: none; +} + +QPushButton:disabled +{ + background-color: #282a36; + border-width: 0.1ex; + border-color: #bd93f9; + border-style: solid; + padding-top: 0.5ex; + padding-bottom: 0.5ex; + padding-left: 1ex; + padding-right: 1ex; + border-radius: 0.2ex; + color: #454545; +} + +QPushButton:focus +{ + color: white; +} + +QPushButton:pressed +{ + background-color: #282a36; + padding-top: -1.5ex; + padding-bottom: -1.7ex; +} + +QComboBox +{ + selection-background-color: #44475a; + border-style: solid; + border: 0.1ex solid #bd93f9; + border-radius: 0.2ex; + padding: 0.5ex; + min-width: 7.5ex; +} + +QPushButton:checked +{ + background-color: #44475a; + border-color: #bd93f9; +} + +QPushButton:hover +{ + background-color: qlineargradient(x1: 0.5, y1: 0.5 x2: 0.5, y2: 1, stop: 0 #454a4f, stop: 0.5 #44475a); + border: 0.1ex solid #bd93f9; + color: #f8f8f2; +} + +QPushButton:checked:hover +{ + background-color: qlineargradient(x1: 0.5, y1: 0.5 x2: 0.5, y2: 1, stop: 0 #808386, stop: 0.5 #6272a4); + border: 0.1ex solid #bd93f9; + color: #f8f8f2; +} + +QComboBox:hover, +QAbstractSpinBox:hover, +QLineEdit:hover, +QTextEdit:hover, +QPlainTextEdit:hover, +QAbstractView:hover, +QTreeView:hover +{ + border: 0.1ex solid #bd93f9; + color: #f8f8f2; +} + +QComboBox:hover:pressed, +QPushButton:hover:pressed, +QAbstractSpinBox:hover:pressed, +QLineEdit:hover:pressed, +QTextEdit:hover:pressed, +QPlainTextEdit:hover:pressed, +QAbstractView:hover:pressed, +QTreeView:hover:pressed +{ + background-color: #282a36; +} + +QComboBox:on +{ + padding-top: 0.3ex; + padding-left: 0.4ex; + selection-background-color: #4a4a4a; +} + +QComboBox QAbstractItemView +{ + background-color: #232629; + border-radius: 0.2ex; + border: 0.1ex solid #bd93f9; + selection-background-color: #ff79c6; +} + +QComboBox::drop-down +{ + subcontrol-origin: padding; + subcontrol-position: top right; + width: 1.5ex; + + border-left-width: 0ex; + border-left-color: #bd93f9; + border-left-style: solid; + border-top-right-radius: 0.3ex; + border-bottom-right-radius: 0.3ex; +} + +QComboBox::down-arrow +{ + border-image: url(:/wow/down_arrow_disabled.svg); + width: 0.9ex; + height: 0.6ex; +} + +QComboBox::down-arrow:on, +QComboBox::down-arrow:hover, +QComboBox::down-arrow:focus +{ + border-image: url(:/wow/down_arrow.svg); + width: 0.9ex; + height: 0.6ex; +} + +QAbstractSpinBox +{ + padding: 0.5ex; + border: 0.1ex solid #bd93f9; + background-color: #232629; + color: #f8f8f2; + border-radius: 0.2ex; + min-width: 7.5ex; +} + +QAbstractSpinBox:up-button +{ + background-color: transparent; + subcontrol-origin: border; + subcontrol-position: center right; +} + +QAbstractSpinBox:down-button +{ + background-color: transparent; + subcontrol-origin: border; + subcontrol-position: center left; +} + +QAbstractSpinBox::up-arrow, +QAbstractSpinBox::up-arrow:disabled, +QAbstractSpinBox::up-arrow:off +{ + border-image: url(:/wow/up_arrow_disabled.svg); + width: 0.9ex; + height: 0.6ex; +} + +QAbstractSpinBox::up-arrow:hover +{ + border-image: url(:/wow/up_arrow.svg); + width: 0.9ex; + height: 0.6ex; +} + +QAbstractSpinBox::down-arrow, +QAbstractSpinBox::down-arrow:disabled, +QAbstractSpinBox::down-arrow:off +{ + border-image: url(:/wow/down_arrow_disabled.svg); + width: 0.9ex; + height: 0.6ex; +} + +QAbstractSpinBox::down-arrow:hover +{ + border-image: url(:/wow/down_arrow.svg); + width: 0.9ex; + height: 0.6ex; +} + +QLabel +{ + border: 0ex solid #bd93f9; +} + +/* BORDERS */ +QTabWidget::pane +{ + padding: 0.5ex; + margin: 0.1ex; +} + +QTabWidget::pane:top +{ + border: 0.1ex solid #bd93f9; + top: -0.1ex; +} + +QTabWidget::pane:bottom +{ + border: 0.1ex solid #bd93f9; + bottom: -0.1ex; +} + +QTabWidget::pane:left +{ + border: 0.1ex solid #bd93f9; + right: -0.1ex; +} + +QTabWidget::pane:right +{ + border: 0.1ex solid #bd93f9; + left: -0.1ex; +} + + +QTabBar +{ + qproperty-drawBase: 0; + left: 0.5ex; /* move to the right by 0.5ex */ + border-radius: 0.3ex; +} + +QTabBar:focus +{ + border: 0ex transparent #bd93f9; +} + +QTabBar::close-button +{ + border-image: url(:/wow/close.svg); + background: transparent; +} + +QTabBar::close-button:hover +{ + border-image: url(:/wow/close-hover.svg); + width: 1.2ex; + height: 1.2ex; + background: transparent; +} + +QTabBar::close-button:pressed +{ + border-image: url(:/wow/close-pressed.svg); + width: 1.2ex; + height: 1.2ex; + background: transparent; +} + +/* TOP TABS */ +QTabBar::tab:top +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-top: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + min-width: 50px; + border-top-left-radius: 0.2ex; + border-top-right-radius: 0.2ex; +} + +QTabBar::tab:top:last, +QTabBar::tab:top:only-one +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-right: 0.1ex solid #bd93f9; + border-top: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + min-width: 50px; + border-top-left-radius: 0.2ex; + border-top-right-radius: 0.2ex; +} + +QTabBar::tab:top:!selected +{ + color: #f8f8f2; + background-color: #6272a4; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-top-left-radius: 0.2ex; + border-top-right-radius: 0.2ex; +} + +QTabBar::tab:top:first:!selected +{ + color: #f8f8f2; + background-color: #6272a4; + border: 0.1ex transparent #bd93f9; + border-top-left-radius: 0.2ex; + border-top-right-radius: 0.2ex; +} + +QTabBar::tab:top:!selected:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; + border-left: 0.1ex solid #bd93f9; +} + +QTabBar::tab:top:!selected:first:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; +} + +/* BOTTOM TABS */ + +QTabBar::tab:bottom +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-bottom: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-bottom-left-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; + min-width: 50px; +} + +QTabBar::tab:bottom:last, +QTabBar::tab:bottom:only-one +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-right: 0.1ex solid #bd93f9; + border-bottom: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-bottom-left-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; + min-width: 50px; +} + +QTabBar::tab:bottom:!selected +{ + color: #f8f8f2; + background-color: #54575B; + border: 0.1ex transparent #bd93f9; + border-left: 0.1ex solid #bd93f9; + border-bottom-left-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; +} + +QTabBar::tab:bottom:first:!selected +{ + color: #f8f8f2; + background-color: #54575B; + border: 0.1ex transparent #bd93f9; + border-top-left-radius: 0.2ex; + border-top-right-radius: 0.2ex; +} + +QTabBar::tab:bottom:!selected:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; + border-left: 0.1ex solid #bd93f9; +} + +QTabBar::tab:bottom:!selected:first:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; +} + +/* LEFT TABS */ +QTabBar::tab:left +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-right: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-top-right-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; + min-height: 50px; +} + +QTabBar::tab:left:last, +QTabBar::tab:left:only-one +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-bottom: 0.1ex solid #bd93f9; + border-right: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-top-right-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; + min-height: 50px; +} + +QTabBar::tab:left:!selected +{ + color: #f8f8f2; + background-color: #54575B; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-top-right-radius: 0.2ex; + border-bottom-right-radius: 0.2ex; +} + +QTabBar::tab:left:!selected:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; + border-top: 0.1ex solid #bd93f9; +} + +QTabBar::tab:left:!selected:first:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; +} + +/* RIGHT TABS */ +QTabBar::tab:right +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-left: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-top-left-radius: 0.2ex; + border-bottom-left-radius: 0.2ex; + min-height: 50px; +} + +QTabBar::tab:right:last, +QTabBar::tab:right:only-one +{ + color: #f8f8f2; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-bottom: 0.1ex solid #bd93f9; + border-left: 0.1ex solid #bd93f9; + background-color: #282a36; + padding: 0.5ex; + border-top-left-radius: 0.2ex; + border-bottom-left-radius: 0.2ex; + min-height: 50px; +} + +QTabBar::tab:right:!selected +{ + color: #f8f8f2; + background-color: #54575B; + border: 0.1ex transparent #bd93f9; + border-top: 0.1ex solid #bd93f9; + border-top-left-radius: 0.2ex; + border-bottom-left-radius: 0.2ex; +} + +QTabBar::tab:right:!selected:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; + border-top: 0.1ex solid #bd93f9; +} + +QTabBar::tab:right:!selected:first:hover +{ + background-color: #ff79c6; + border: 0.1ex #bd93f9; +} + +QTabBar QToolButton::right-arrow:enabled +{ + border-image: url(:/wow/right_arrow.svg); +} + +QTabBar QToolButton::left-arrow:enabled +{ + border-image: url(:/wow/left_arrow.svg); +} + +QTabBar QToolButton::right-arrow:disabled +{ + border-image: url(:/wow/right_arrow_disabled.svg); +} + +QTabBar QToolButton::left-arrow:disabled +{ + border-image: url(:/wow/left_arrow_disabled.svg); +} + +QDockWidget +{ + background: #282a36; + border: 0.1ex solid #bd93f9; + titlebar-close-icon: url(:/wow/transparent.svg); + titlebar-normal-icon: url(:/wow/transparent.svg); +} + +QDockWidget::close-button, +QDockWidget::float-button +{ + border: 0.1ex solid transparent; + border-radius: 0.2ex; + background: transparent; +} + +QDockWidget::float-button +{ + border-image: url(:/wow/undock.svg); +} + +QDockWidget::float-button:hover +{ + border-image: url(:/wow/undock-hover.svg) ; +} + +QDockWidget::close-button +{ + border-image: url(:/wow/close.svg) ; +} + +QDockWidget::close-button:hover +{ + border-image: url(:/wow/close-hover.svg) ; +} + +QDockWidget::close-button:pressed +{ + border-image: url(:/wow/close-pressed.svg) ; +} + +QTreeView, +QListView +{ + border: 0.1ex solid #bd93f9; + background-color: #232629; +} + +QTreeView::branch:has-siblings:!adjoins-item +{ + border-image: url(:/wow/stylesheet-vline.svg) 0; +} + +QTreeView::branch:has-siblings:adjoins-item +{ + border-image: url(:/wow/stylesheet-branch-more.svg) 0; +} + +QTreeView::branch:!has-children:!has-siblings:adjoins-item +{ + border-image: url(:/wow/stylesheet-branch-end.svg) 0; +} + +QTreeView::branch:has-children:!has-siblings:closed, +QTreeView::branch:closed:has-children:has-siblings +{ + border-image: url(:/wow/stylesheet-branch-end-closed.svg) 0; + image: url(:/wow/branch_closed.svg); +} + +QTreeView::branch:open:has-children:!has-siblings, +QTreeView::branch:open:has-children:has-siblings +{ + border-image: url(:/wow/stylesheet-branch-end-open.svg) 0; + image: url(:/wow/branch_open.svg); +} + +/* +QTreeView::branch:has-siblings:!adjoins-item { + background: cyan; +} + +QTreeView::branch:has-siblings:adjoins-item { + background: red; +} + +QTreeView::branch:!has-children:!has-siblings:adjoins-item { + background: blue; +} + +QTreeView::branch:closed:has-children:has-siblings { + background: pink; +} + +QTreeView::branch:has-children:!has-siblings:closed { + background: gray; +} + +QTreeView::branch:open:has-children:has-siblings { + background: magenta; +} + +QTreeView::branch:open:has-children:!has-siblings { + background: green; +} +*/ + +QTableView::item, +QListView::item, +QTreeView::item +{ + padding: 0.3ex; +} + +QTableView::item:!selected:hover, +QListView::item:!selected:hover, +QTreeView::item:!selected:hover +{ + background-color: #ff79c6; + outline: 0; + color: #f8f8f2; + padding: 0.3ex; +} + + +QSlider::groove:horizontal +{ + border: 0.1ex solid #bd93f9; + height: 0.4ex; + background: #565a5e; + margin: 0ex; + border-radius: 0.2ex; +} + +QSlider::handle:horizontal +{ + background: #232629; + border: 0.1ex solid #bd93f9; + width: 1.6ex; + height: 1.6ex; + margin: -0.8ex 0; + border-radius: 0.9ex; +} + +QSlider::groove:vertical +{ + border: 0.1ex solid #bd93f9; + width: 0.4ex; + background: #565a5e; + margin: 0ex; + border-radius: 0.3ex; +} + +QSlider::handle:vertical +{ + background: #232629; + border: 0.1ex solid #bd93f9; + width: 1.6ex; + height: 1.6ex; + margin: 0 -0.8ex; + border-radius: 0.9ex; +} + +QSlider::handle:horizontal:hover, +QSlider::handle:horizontal:focus, +QSlider::handle:vertical:hover, +QSlider::handle:vertical:focus +{ + border: 0.1ex solid #bd93f9; +} + +QSlider::sub-page:horizontal, +QSlider::add-page:vertical +{ + background: #565a5e; + border-radius: 0.3ex; +} + +QSlider::add-page:horizontal, +QSlider::sub-page:vertical +{ + background: #626568; + border-radius: 0.3ex; +} + +QToolButton +{ + background-color: transparent; + border: 0.1ex solid #bd93f9; + border-radius: 0.2ex; + margin: 0.3ex; + padding: 0.5ex; +} + +QToolButton[popupMode="1"] /* only for MenuButtonPopup */ +{ + padding-right: 2ex; /* make way for the popup button */ +} + +QToolButton[popupMode="2"] /* only for InstantPopup */ +{ + padding-right: 1ex; /* make way for the popup button */ +} + +QToolButton::menu-indicator +{ + border-image: none; + image: url(:/wow/down_arrow.svg); + top: -0.7ex; + left: -0.2ex; +} + +QToolButton::menu-arrow +{ + border-image: none; + image: url(:/wow/down_arrow.svg); +} + +QToolButton:hover, +QToolButton::menu-button:hover +{ + background-color: transparent; + border: 0.1ex solid #bd93f9; +} + +QToolButton:checked, +QToolButton:pressed, +QToolButton::menu-button:pressed +{ + background-color: #565a5e; + border: 0.1ex solid #bd93f9; + padding: 0.5ex; +} + +QToolButton::menu-button +{ + border: 0.1ex solid #bd93f9; + border-top-right-radius: 6px; + border-bottom-right-radius: 6px; + /* 1ex width + 0.4ex for border + no text = 2ex allocated above */ + width: 1ex; + padding: 0.5ex; + outline: none; +} + +QToolButton::menu-arrow:open +{ + border: 0.1ex solid #bd93f9; +} + +QPushButton::menu-indicator +{ + subcontrol-origin: padding; + subcontrol-position: bottom right; + left: 0.8ex; +} + +QTableView +{ + border: 0.1ex solid #bd93f9; + gridline-color: #282a36; + background-color: #232629; +} + + +QTableView, +QHeaderView +{ + border-radius: 0px; +} + +QTableView::item:pressed, +QListView::item:pressed, +QTreeView::item:pressed +{ + background: #565a5e; + color: #f8f8f2; +} + +QTableView::item:selected:active, +QTreeView::item:selected:active, +QListView::item:selected:active +{ + background: #44475a; + color: #f8f8f2; +} + +QListView::item:selected:hover, +QTreeView::item:selected:hover +{ + background-color: #6272a4; + color: #f8f8f2; +} + +QHeaderView +{ + background-color: #282a36; + border: 0.1ex transparent; + border-radius: 0px; + margin: 0px; + padding: 0px; + +} + +QHeaderView::section +{ + background-color: #282a36; + color: #f8f8f2; + padding: 0.5ex; + border: 0.1ex solid #bd93f9; + border-radius: 0px; + text-align: center; +} + +QHeaderView::section::vertical::first, +QHeaderView::section::vertical::only-one +{ + border-top: 0.1ex solid #bd93f9; +} + +QHeaderView::section::vertical +{ + border-top: transparent; +} + +QHeaderView::section::horizontal::first, +QHeaderView::section::horizontal::only-one +{ + border-left: 0.1ex solid #bd93f9; +} + +QHeaderView::section::horizontal +{ + border-left: transparent; +} + + +QHeaderView::section:checked +{ + color: white; + background-color: #6272a4; +} + + /* style the sort indicator */ +QHeaderView::down-arrow +{ + image: url(:/wow/down_arrow.svg); +} + +QHeaderView::up-arrow +{ + image: url(:/wow/up_arrow.svg); +} + +QTableCornerButton::section +{ + background-color: #282a36; + border: 0.1ex transparent #bd93f9; + border-radius: 0px; +} + +QToolBox +{ + padding: 0.5ex; + border: 0.1ex transparent #bd93f9; +} + +QToolBox:selected +{ + background-color: #282a36; + border-color: #bd93f9; +} + +QToolBox:hover +{ + border-color: #bd93f9; +} + +QStatusBar::item +{ + border: 0px transparent dark; +} + +QFrame[height="3"], +QFrame[width="3"] +{ + background-color: #6272a4; +} + +QSplitter::handle +{ + border: 0.1ex dashed #bd93f9; +} + +QSplitter::handle:hover +{ + background-color: #787876; + border: 0.1ex solid #bd93f9; +} + +QSplitter::handle:horizontal +{ + width: 0.1ex; +} + +QSplitter::handle:vertical +{ + height: 0.1ex; +} + +QProgressBar:horizontal +{ + background-color: #626568; + border: 0.1ex solid #bd93f9; + border-radius: 0.3ex; + height: 0.5ex; + text-align: right; + margin-top: 0.5ex; + margin-bottom: 0.5ex; + margin-right: 5ex; + padding: 0px; +} + +QProgressBar::chunk:horizontal +{ + background-color: #787876; + border: 0.1ex transparent; + border-radius: 0.3ex; +} + +QSpinBox, +QDoubleSpinBox +{ + padding-right: 1.5ex; +} + +QSpinBox::up-button, +QDoubleSpinBox::up-button +{ + subcontrol-origin: content; + subcontrol-position: right top; + + width: 1.6ex; + border-width: 0.1ex; +} + +QSpinBox::up-arrow, +QDoubleSpinBox::up-arrow +{ + border-image: url(:/wow/up_arrow.svg); + width: 0.9ex; + height: 0.6ex; +} + +QSpinBox::up-arrow:hover, +QSpinBox::up-arrow:pressed, +QDoubleSpinBox::up-arrow:hover, +QDoubleSpinBox::up-arrow:pressed +{ + border-image: url(:/wow/up_arrow-hover.svg); + width: 0.9ex; + height: 0.6ex; +} + +QSpinBox::up-arrow:disabled, +QSpinBox::up-arrow:off, +QDoubleSpinBox::up-arrow:disabled, +QDoubleSpinBox::up-arrow:off +{ + border-image: url(:/wow/up_arrow_disabled.svg); +} + +QSpinBox::down-button, +QDoubleSpinBox::down-button +{ + subcontrol-origin: content; + subcontrol-position: right bottom; + + width: 1.6ex; + border-width: 0.1ex; +} + +QSpinBox::down-arrow, +QDoubleSpinBox::down-arrow +{ + border-image: url(:/wow/down_arrow.svg); + width: 0.9ex; + height: 0.6ex; +} + +QSpinBox::down-arrow:hover, +QSpinBox::down-arrow:pressed, +QDoubleSpinBox::down-arrow:hover, +QDoubleSpinBox::down-arrow:pressed +{ + border-image: url(:/wow/down_arrow-hover.svg); + width: 0.9ex; + height: 0.6ex; +} + +QSpinBox::down-arrow:disabled, +QSpinBox::down-arrow:off, +QDoubleSpinBox::down-arrow:disabled, +QDoubleSpinBox::down-arrow:off +{ + border-image: url(:/wow/down_arrow_disabled.svg); +} + +/* fixes */ + +QPushButton:flat { + background-color: transparent; + border: none; +} + +QLabel:disabled { + color: #787878; +} + +QTableView::item:!selected:hover +{ + background-color: transparent; +} \ No newline at end of file diff --git a/src/ui/BreezeStyleSheets/wow/branch_closed-on.svg b/src/ui/BreezeStyleSheets/wow/branch_closed-on.svg new file mode 100755 index 0000000..8bd398f --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/branch_closed-on.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/branch_closed.svg b/src/ui/BreezeStyleSheets/wow/branch_closed.svg new file mode 100755 index 0000000..f5a072f --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/branch_closed.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/branch_open-on.svg b/src/ui/BreezeStyleSheets/wow/branch_open-on.svg new file mode 100755 index 0000000..4dd0c06 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/branch_open-on.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/branch_open.svg b/src/ui/BreezeStyleSheets/wow/branch_open.svg new file mode 100755 index 0000000..0745890 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/branch_open.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_checked.svg b/src/ui/BreezeStyleSheets/wow/checkbox_checked.svg new file mode 100755 index 0000000..6753d8b --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_checked.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_checked_disabled.svg b/src/ui/BreezeStyleSheets/wow/checkbox_checked_disabled.svg new file mode 100755 index 0000000..ff7e63a --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_checked_disabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate.svg b/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate.svg new file mode 100755 index 0000000..0f17124 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate_disabled.svg b/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate_disabled.svg new file mode 100755 index 0000000..bc0f285 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_indeterminate_disabled.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_unchecked.svg b/src/ui/BreezeStyleSheets/wow/checkbox_unchecked.svg new file mode 100755 index 0000000..6f3e569 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_unchecked.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/checkbox_unchecked_disabled.svg b/src/ui/BreezeStyleSheets/wow/checkbox_unchecked_disabled.svg new file mode 100755 index 0000000..dd73f75 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/checkbox_unchecked_disabled.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/close-hover.svg b/src/ui/BreezeStyleSheets/wow/close-hover.svg new file mode 100755 index 0000000..e2b0dd8 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/close-hover.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/close-pressed.svg b/src/ui/BreezeStyleSheets/wow/close-pressed.svg new file mode 100755 index 0000000..a0dc249 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/close-pressed.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/close.svg b/src/ui/BreezeStyleSheets/wow/close.svg new file mode 100755 index 0000000..07b50c9 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/down_arrow-hover.svg b/src/ui/BreezeStyleSheets/wow/down_arrow-hover.svg new file mode 100755 index 0000000..408397f --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/down_arrow-hover.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/down_arrow.svg b/src/ui/BreezeStyleSheets/wow/down_arrow.svg new file mode 100755 index 0000000..a50df00 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/down_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/down_arrow_disabled.svg b/src/ui/BreezeStyleSheets/wow/down_arrow_disabled.svg new file mode 100755 index 0000000..af74a30 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/down_arrow_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/hmovetoolbar.svg b/src/ui/BreezeStyleSheets/wow/hmovetoolbar.svg new file mode 100755 index 0000000..e4904db --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/hmovetoolbar.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/hsepartoolbar.svg b/src/ui/BreezeStyleSheets/wow/hsepartoolbar.svg new file mode 100755 index 0000000..89beb22 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/hsepartoolbar.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/left_arrow.svg b/src/ui/BreezeStyleSheets/wow/left_arrow.svg new file mode 100755 index 0000000..9c787ce --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/left_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/left_arrow_disabled.svg b/src/ui/BreezeStyleSheets/wow/left_arrow_disabled.svg new file mode 100755 index 0000000..2d749e7 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/left_arrow_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/radio_checked.svg b/src/ui/BreezeStyleSheets/wow/radio_checked.svg new file mode 100755 index 0000000..b8f7064 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/radio_checked.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/radio_checked_disabled.svg b/src/ui/BreezeStyleSheets/wow/radio_checked_disabled.svg new file mode 100755 index 0000000..523ee00 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/radio_checked_disabled.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/radio_unchecked.svg b/src/ui/BreezeStyleSheets/wow/radio_unchecked.svg new file mode 100755 index 0000000..1a556e3 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/radio_unchecked.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/radio_unchecked_disabled.svg b/src/ui/BreezeStyleSheets/wow/radio_unchecked_disabled.svg new file mode 100755 index 0000000..b3da8a2 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/radio_unchecked_disabled.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/right_arrow.svg b/src/ui/BreezeStyleSheets/wow/right_arrow.svg new file mode 100755 index 0000000..b793513 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/right_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/right_arrow_disabled.svg b/src/ui/BreezeStyleSheets/wow/right_arrow_disabled.svg new file mode 100755 index 0000000..4940025 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/right_arrow_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/sizegrip.svg b/src/ui/BreezeStyleSheets/wow/sizegrip.svg new file mode 100755 index 0000000..3388f07 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/sizegrip.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/spinup_disabled.svg b/src/ui/BreezeStyleSheets/wow/spinup_disabled.svg new file mode 100755 index 0000000..838436d --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/spinup_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-closed.svg b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-closed.svg new file mode 100755 index 0000000..eb73b13 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-closed.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-open.svg b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-open.svg new file mode 100755 index 0000000..eb73b13 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end-open.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end.svg b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end.svg new file mode 100755 index 0000000..334ca0c --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-end.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/stylesheet-branch-more.svg b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-more.svg new file mode 100755 index 0000000..f5250ba --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/stylesheet-branch-more.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/ui/BreezeStyleSheets/wow/stylesheet-vline.svg b/src/ui/BreezeStyleSheets/wow/stylesheet-vline.svg new file mode 100755 index 0000000..4e7ff6a --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/stylesheet-vline.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/transparent.svg b/src/ui/BreezeStyleSheets/wow/transparent.svg new file mode 100755 index 0000000..3a8ca5c --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/transparent.svg @@ -0,0 +1 @@ + diff --git a/src/ui/BreezeStyleSheets/wow/undock-hover.svg b/src/ui/BreezeStyleSheets/wow/undock-hover.svg new file mode 100755 index 0000000..6bddbd7 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/undock-hover.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/undock.svg b/src/ui/BreezeStyleSheets/wow/undock.svg new file mode 100755 index 0000000..9ab2197 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/undock.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/up_arrow-hover.svg b/src/ui/BreezeStyleSheets/wow/up_arrow-hover.svg new file mode 100755 index 0000000..dd1271a --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/up_arrow-hover.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/up_arrow.svg b/src/ui/BreezeStyleSheets/wow/up_arrow.svg new file mode 100755 index 0000000..9f42239 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/up_arrow.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/up_arrow_disabled.svg b/src/ui/BreezeStyleSheets/wow/up_arrow_disabled.svg new file mode 100755 index 0000000..742e1c5 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/up_arrow_disabled.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/ui/BreezeStyleSheets/wow/vmovetoolbar.svg b/src/ui/BreezeStyleSheets/wow/vmovetoolbar.svg new file mode 100755 index 0000000..0a30d45 --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/vmovetoolbar.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/src/ui/BreezeStyleSheets/wow/vsepartoolbars.svg b/src/ui/BreezeStyleSheets/wow/vsepartoolbars.svg new file mode 100755 index 0000000..00e91ab --- /dev/null +++ b/src/ui/BreezeStyleSheets/wow/vsepartoolbars.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/ui/qml/mining.qml b/src/ui/qml/mining.qml new file mode 100644 index 0000000..5f04907 --- /dev/null +++ b/src/ui/qml/mining.qml @@ -0,0 +1,730 @@ +import QtQuick 2.7 +import QtQuick.Layouts 1.15 +import QtQuick.Controls 2.3 + +Rectangle { + id: root + color: "#181725" + anchors.fill: parent + property variant buffer: [] + property int bufferMaxLength: 12 + // state: 0:idle 1:startup 2:syncing 3:mining + signal startMining(); + signal stopMining(); + + Component.onCompleted: { + calcAvailableHeightConsoleLines(); + } + + onHeightChanged: { + calcAvailableHeightConsoleLines(); + } + + function calcAvailableHeightConsoleLines() { + var max_lines = parseInt(textContainer.height / 20); + if(root.bufferMaxLength != max_lines && max_lines >= 4) + root.bufferMaxLength = max_lines; + } + +// width: 980 +// height: 480 + + Column { + FontLoader { id: comicMono; source: "qrc:/fonts/ComicMono.ttf" } + FontLoader { id: comicMonoBold; source: "qrc:/fonts/ComicMono-Bold.ttf" } + } + + AnimatedImage { + //visible: mining.daemonMiningState === 0 + source: "qrc:/mining/bg1.gif" + fillMode: Image.PreserveAspectCrop + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.top: parent.top + anchors.bottomMargin: 92 + anchors.topMargin: 112 + } + + Image { + source: "qrc:/mining/overlay.png" + fillMode: Image.PreserveAspectCrop + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.top: parent.top + anchors.bottomMargin: 92 + anchors.topMargin: 112 + smooth: false + } + + Image { + id: miningGradient + opacity: 0.0 + source: "qrc:/mining/mining_gradient.png" + fillMode: Image.PreserveAspectCrop + + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.top: parent.top + anchors.bottomMargin: 92 + anchors.topMargin: 112 + smooth: false + + states: [ + State { when: mining.daemonMiningState !== 0; + PropertyChanges { target: miningGradient; opacity: 1.0 }}, + State { when: mining.daemonMiningState === 0; + PropertyChanges { target: miningGradient; opacity: 0.0 }} + ] + transitions: [ Transition { NumberAnimation { property: "opacity"; duration: 750}} ] + } + + ColumnLayout { + width: parent.width + height: parent.height + spacing: 0 + + RowLayout { + spacing: 0 + Layout.fillWidth: true + Layout.preferredHeight: 128 + + Image { + source: "qrc:/mining/topleft.png" + Layout.preferredWidth: 435 + Layout.preferredHeight: 128 + smooth: false + + // top-left monitors + ColumnLayout { + width: 102 + height: 74 + + anchors.left: parent.left + anchors.leftMargin: 14 + anchors.top: parent.top + anchors.topMargin: 42 + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.fillHeight: true + + Text { + text: "Hashrate" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 4 + font.pointSize: 14 + font.family: comicMonoBold.name; + antialiasing: false + color: "#41FF00" + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.fillHeight: true + + Text { + id: hashRateText + text: "-" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 4 + font.pointSize: 16 + font.family: comicMono.name; + antialiasing: false + color: "#41FF00" + } + } + } + + ColumnLayout { + width: 102 + height: 74 + + anchors.left: parent.left + anchors.leftMargin: 142 + anchors.top: parent.top + anchors.topMargin: 42 + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.fillHeight: true + + Text { + text: "uptime" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 4 + font.pointSize: 14 + font.family: comicMonoBold.name; + antialiasing: false + color: "#41FF00" + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.fillHeight: true + + Text { + id: miningUptime + text: "-" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 4 + font.pointSize: 12 + font.family: comicMono.name; + antialiasing: false + color: "#41FF00" + } + } + } + + AnimatedImage { + visible: mining.daemonMiningState !== 0 + source: "qrc:/mining/mining.webp" + fillMode: Image.PreserveAspectCrop + width: 115 + height: 86 + + anchors.left: parent.left + anchors.leftMargin: 263 + anchors.top: parent.top + anchors.topMargin: 34 + } + } + + ColumnLayout { + Layout.fillWidth: true + Layout.preferredHeight: 128 + spacing: 0 + + Image { + source: "qrc:/mining/warning.png" + Layout.fillWidth: true + Layout.preferredHeight: 15 + fillMode: Image.TileHorizontally + smooth: false + } + + Image { + source: "qrc:/mining/topright_bar.png" + Layout.fillWidth: true + Layout.preferredHeight: 4 + fillMode: Image.TileHorizontally + smooth: false + } + + RowLayout { + spacing: 0 + Layout.fillHeight: true + Layout.preferredHeight: 102 + + Image { + Layout.preferredWidth: 5 + Layout.preferredHeight: parent.height + source: "qrc:/mining/topright_left.png" + smooth: false + } + + Image { + Layout.fillWidth: true + Layout.preferredHeight: parent.height + source: "qrc:/mining/topright_middle.png" + fillMode: Image.TileHorizontally + smooth: false + + RowLayout { + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: 6 + anchors.right: parent.right + anchors.rightMargin: 8 + anchors.topMargin: 12 + + height: 78 + spacing: 16 + + ColumnLayout { + Layout.minimumWidth: 200 + Layout.maximumWidth: 260 + Layout.fillHeight: true + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: "transparent" + + Text { + text: "Block Height" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 8 + font.pointSize: 20 + font.family: comicMonoBold.name; + color: "#41FF00" + antialiasing: false + } + } + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: "transparent" + + Text { + id: heightText + text: "-" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 8 + font.pointSize: 18 + font.family: comicMonoBold.name; + color: "#41FF00" + antialiasing: false + } + } + } + + ColumnLayout { + Layout.minimumWidth: 200 + Layout.maximumWidth: 260 + Layout.fillHeight: true + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: "transparent" + + Text { + text: "Sync Progress" + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.leftMargin: 8 + font.pointSize: 20 + font.family: comicMonoBold.name; + color: "#41FF00" + antialiasing: false + } + } + + Rectangle { + Layout.fillWidth: true + Layout.fillHeight: true + color: "transparent" + + Text { + id: syncPctText + text: "-" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + + font.pointSize: 18 + font.family: comicMonoBold.name; + color: "#41FF00" + antialiasing: false + } + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } + } + + Image { + Layout.preferredWidth: 5 + Layout.preferredHeight: parent.height + source: "qrc:/mining/topright_right.png" + smooth: false + } + } + + Item { + Layout.preferredHeight: 7 // 15 + 4 + 102 + 7 = 128 + Layout.fillWidth: true + } + } + } + + RowLayout { + spacing: 0 + //Layout.preferredHeight: 128 + Layout.fillHeight: true + Layout.fillWidth: true + + Image { + Layout.preferredWidth: 6 + Layout.fillHeight: true + source: "qrc:/mining/r_left.png" + fillMode: Image.TileVertically + smooth: false + } + + Item { + // text container + Layout.fillWidth: true + Layout.fillHeight: true + + Rectangle { + id: textContainer + color: "transparent" + height: parent.height - 20 + width: parent.width - 32 + clip: true + + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + + Text { + id: cons + anchors.margins: 4 + anchors.fill: parent + text: { + if(mining.daemonMiningState === 0) { + return "Press the pick-axe to start mining!"; + } else { + return ""; + } + } + font.pointSize: 14 + font.family: comicMono.name; + wrapMode: Text.WordWrap + color: "white" + } + } + } + + Image { + Layout.preferredWidth: 6 + Layout.fillHeight: true + source: "qrc:/mining/r_right.png" + fillMode: Image.TileVertically + smooth: false + } + } + + RowLayout { + spacing: 0 + Layout.preferredHeight: 140 + Layout.fillWidth: true + + Image { + Layout.preferredWidth: 306 + Layout.preferredHeight: 140 + source: "qrc:/mining/lowerleft.png" + smooth: false + + AnimatedImage { + source: mining.daemonMiningState === 0 ? "qrc:/assets/images/dog_sitting.gif" : "qrc:/assets/images/dog_running.gif" + width: 80 + height: 60 + anchors.bottom: parent.bottom + anchors.bottomMargin: 22 + anchors.left: parent.left + anchors.leftMargin: 22 + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + showBubble(); + } + onExited: { + hideBubble(); + } + } + } + } + + Image { + Layout.fillWidth: true + Layout.preferredHeight: 140 + source: "qrc:/mining/lower_repeat.png" + fillMode: Image.TileHorizontally + smooth: false + } + + Image { + Layout.preferredWidth: 236 + Layout.preferredHeight: 140 + source: "qrc:/mining/bottom_center_console.png" + smooth: false + + Rectangle { + // middle console clock + anchors.left: parent.left + anchors.leftMargin: 100 + anchors.top: parent.top + anchors.topMargin: 8 + color: "transparent" + + width: 54 + height: 16 + + Text { + id: clock + text: "" + antialiasing: false + font.pointSize: 9 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + font.family: comicMonoBold.name; + color: "#41FF00"; + + Component.onCompleted: { + root.setClock(); + } + } + } + + Image { + source: "qrc:/mining/intel.png" + width: 100 + height: 100 + fillMode: Image.Pad + smooth: false + + anchors.bottom: parent.bottom + anchors.horizontalCenter: parent.horizontalCenter + } + } + + Image { + Layout.fillWidth: true + Layout.preferredHeight: 140 + source: "qrc:/mining/lower_repeat.png" + fillMode: Image.TileHorizontally + smooth: false + } + + Image { + Layout.preferredWidth: 308 + Layout.preferredHeight: 140 + source: "qrc:/mining/lowerright.png" + smooth: false + + Rectangle { + // lower-right button container + color: "transparent" + width: 106 + height: 100 + anchors.right: parent.right + anchors.rightMargin: 11 + anchors.top: parent.top + anchors.topMargin: 34 + + Image { + id: imgAxe + visible: mining.daemonMiningState === 0 + source: "qrc:/mining/axe.png" + width: 73 + height: 75 + smooth: false + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } + + AnimatedImage { + visible: mining.daemonMiningState !== 0 + source: "qrc:/mining/elmo.gif" + width: 106 + height: 100 + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + + Text { + id: stopMiningBtn + visible: true + text: "Stop Mining" + font.pointSize: 10 + z: parent.z + 1 + color: "black" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 28 + font.family: comicMonoBold.name; + antialiasing: false + } + } + + MouseArea { + anchors.fill: parent + z: parent.z + 1 + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + + onClicked: { + if(mining.daemonMiningState === 0) { + root.startMining(); + root.calcAvailableHeightConsoleLines(); + } + else + root.stopMining(); + } + onEntered: { + imgAxe.height = 64 + imgAxe.width = 64 + } + onExited: { + imgAxe.height = 75 + imgAxe.width = 73 + } + } + } + } + } + } + + Image { + id: bubble + visible: false + source: "qrc:/mining/bubble.png" + width: 200 + height: 60 + anchors.bottom: parent.bottom + anchors.bottomMargin: 64 + anchors.left: parent.left + anchors.leftMargin: 48 + + Rectangle { + anchors.top: parent.top + anchors.topMargin: 6 + anchors.left: parent.left + anchors.leftMargin: 10 + height: 26 + color: "transparent" + width: 183 + z: parent.z + 1 + + Text { + id: bubbleText + text: "" + color: "black" + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + font.pointSize: 14 + font.family: ComicMonoBold.name; + } + } + } + + Timer { + id: setClockTimer + interval: 1000*60 + running: true + repeat: true + onTriggered: setClock() + } + + Timer { + id: dogBubbleTimer + interval: 1000*30 + running: true + repeat: true + onTriggered: { + if(Math.random() >= 0.5) return; + if(bubble.visible) return; + root.dogBubbleRemoval.stop(); + root.dogBubbleRemoval.start(); + + var msg = root.bubbleMessage(); + + bubbleText.text = msg; + bubble.visible = true; + } + } + + Timer { + id: dogBubbleRemoval + interval: 2500 + running: false + repeat: false + onTriggered: bubble.visible = false; + } + + function setClock() { + var now = new Date(); + var hours = now.getHours(); + var minutes = ('0'+now.getMinutes()).slice(-2); + clock.text = hours + ":" + minutes; + } + + function resetComponents() { + hashRateText.text = "-"; + miningUptime.text = "-"; + syncPctText.text = "-"; + heightText.text = "-"; + } + + function consoleAppend(line) { + if(root.buffer.length >= root.bufferMaxLength) + root.buffer.shift() + root.buffer.push(line); + + cons.text = ""; + for(var i = 0; i != root.bufferMaxLength; i++) { + if(root.buffer[i]) + cons.text += root.buffer[i] + "\n"; + } + } + + Connections { + target: mining + function onDaemonOutput(line) { + root.consoleAppend(line); + } + + function onSyncStatus(from, to, pct) { + syncPctText.text = pct + "%"; + heightText.text = from + "/" + to; + } + + function onUptimeChanged(uptime) { + miningUptime.text = uptime; + } + + function onHashrate(hashrate) { + hashRateText.text = hashrate; + } + } + + function showBubble() { + if(bubble.visible) return; + var msg = root.bubbleMessage(); + + bubbleText.text = msg; + bubble.visible = true; + } + + function hideBubble() { + bubble.visible = false; + } + + function bubbleMessage() { + var active = ["such work!", "mining WOW!", "woof woof!", "I am tired!", "mining :@", "weeeee", "blocks everywhere!", "wooohoo", "working, twerkin'", "looking4blocks", "mining blocks"]; + var inactive = ["doing nothing!", "ZzZZzzZ", "wen mining?!", "ETA mining?!", "zZZzzZZz", "omg so bored", "so bored!!", "much idle, many zZz", "lets go!", "i'm ready!"]; + var syncing = ["wen 1gbit", "syncin'", "zZzz", "ETA sync ready?!", "downloading blocks", "fetching blocks"]; + var msg = ""; + + if(mining.daemonMiningState === 0) { + return inactive[Math.floor(Math.random()*inactive.length)]; + } else if (mining.daemonMiningState === 2) { + return syncing[Math.floor(Math.random()*syncing.length)]; + } else { + return active[Math.floor(Math.random()*active.length)]; + } + } +} diff --git a/src/utils/ColorScheme.cpp b/src/utils/ColorScheme.cpp new file mode 100644 index 0000000..4862c11 --- /dev/null +++ b/src/utils/ColorScheme.cpp @@ -0,0 +1,39 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) 2012 thomasv@gitorious + +#include "ColorScheme.h" + +bool ColorScheme::darkScheme = false; +ColorSchemeItem ColorScheme::GREEN = ColorSchemeItem("#117c11", "#8af296"); +ColorSchemeItem ColorScheme::YELLOW = ColorSchemeItem("#897b2a", "#ffff00"); +ColorSchemeItem ColorScheme::RED = ColorSchemeItem("#7c1111", "#f18c8c"); +ColorSchemeItem ColorScheme::BLUE = ColorSchemeItem("#123b7c", "#8cb3f2"); +ColorSchemeItem ColorScheme::DEFAULT = ColorSchemeItem("black", "white"); +ColorSchemeItem ColorScheme::GRAY = ColorSchemeItem("gray", "gray"); + +bool ColorScheme::hasDarkBackground(QWidget *widget) { + int r, g, b; + widget->palette().color(QPalette::Background).getRgb(&r, &g, &b); + auto brightness = r + g + b; + return brightness < (255*3/2); +} + +void ColorScheme::updateFromWidget(QWidget *widget, bool forceDark) { + darkScheme = forceDark || ColorScheme::hasDarkBackground(widget); +} + +QString ColorSchemeItem::asStylesheet(bool background) { + auto cssPrefix = background ? "background-" : ""; + auto color = this->getColor(background); + return QString("QWidget { %1color : %2; }").arg(cssPrefix, color); +} + +QColor ColorSchemeItem::asColor(bool background) { + auto color = this->getColor(background); + return QColor(color); +} + +QString ColorSchemeItem::getColor(bool background) { + return m_colors[(int(background) + int(ColorScheme::darkScheme)) % 2]; +} \ No newline at end of file diff --git a/src/utils/ColorScheme.h b/src/utils/ColorScheme.h new file mode 100644 index 0000000..31697ec --- /dev/null +++ b/src/utils/ColorScheme.h @@ -0,0 +1,44 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) 2012 thomasv@gitorious + +#ifndef WOWLET_COLORSCHEME_H +#define WOWLET_COLORSCHEME_H + +#include +#include +#include +#include + +class ColorSchemeItem { + +public: + explicit ColorSchemeItem(const QString &fgColor, const QString &bgColor) + : m_colors({fgColor, bgColor}) {} + + QString asStylesheet(bool background = false); + QColor asColor(bool background = false); + +private: + QString getColor(bool background); + QVector m_colors; +}; + + +class ColorScheme { +public: + static bool darkScheme; + + static ColorSchemeItem GREEN; + static ColorSchemeItem YELLOW; + static ColorSchemeItem RED; + static ColorSchemeItem BLUE; + static ColorSchemeItem DEFAULT; + static ColorSchemeItem GRAY; + + static bool hasDarkBackground(QWidget *widget); + static void updateFromWidget(QWidget *widget, bool forceDark = false); +}; + + +#endif //WOWLET_COLORSCHEME_H diff --git a/src/utils/RestoreHeightLookup.h b/src/utils/RestoreHeightLookup.h new file mode 100644 index 0000000..844ab2c --- /dev/null +++ b/src/utils/RestoreHeightLookup.h @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_RESTOREHEIGHTLOOKUP_H +#define WOWLET_RESTOREHEIGHTLOOKUP_H + +#include +#include + +#include + +#include "networktype.h" +#include "utils/utils.h" + +struct RestoreHeightLookup { + NetworkType::Type type; + QMap data; + explicit RestoreHeightLookup(NetworkType::Type type) : type(type) {} + + int dateToRestoreHeight(int date) { + // restore height based on a given timestamp using a lookup + // table. If it cannot find the date in the lookup table, it + // will calculate the blockheight based off the last known + // date: ((now - lastKnownDate) / blockTime) - clearance + + if(this->type == NetworkType::TESTNET) return 1; + int blockTime = 300; + int blocksPerDay = 288; + int blockCalcClearance = blocksPerDay * 5; + QList values = this->data.keys(); + if(date <= values.at(0)) + return this->data[values.at(0)]; + for(int i = 0; i != values.count(); i++) { + if(values[i] > date) { + return i - 1 < 0 ? this->data[values[i]] : this->data[values[i-1]] - blockCalcClearance; + } + } + + // lookup failed, calculate blockheight from last known checkpoint + int lastBlockHeightTime = values.at(values.count() - 1); + int lastBlockHeight = this->data[lastBlockHeightTime]; + int deltaTime = date - lastBlockHeightTime; + int deltaBlocks = deltaTime / blockTime; + int blockHeight = (lastBlockHeight + deltaBlocks) - blockCalcClearance; + qDebug() << "Calculated blockheight: " << blockHeight << " from epoch " << date; + return blockHeight; + } + + int restoreHeightToDate(int height) { + // @TODO: most likely inefficient, refactor + QMap::iterator i; + int timestamp = 0; + for (i = this->data.begin(); i != this->data.end(); ++i) { + int ts = i.key(); + if (i.value() > height) + return timestamp; + timestamp = ts; + } + return timestamp; + } + + static RestoreHeightLookup *fromFile(const QString &fn, NetworkType::Type type) { + // initialize this class using a lookup table, e.g `:/assets/restore_heights_monero_mainnet.txt`/ + auto rtn = new RestoreHeightLookup(type); + auto data = Utils::barrayToString(Utils::fileOpen(fn)); + QMap _data; + for(const auto &line: data.split('\n')) { + if(line.trimmed().isEmpty()) continue; + auto spl = line.trimmed().split(':'); + rtn->data[spl.at(0).toUInt()] = spl.at(1).toUInt(); + } + return rtn; + } +}; + +#endif //WOWLET_RESTOREHEIGHTLOOKUP_H diff --git a/src/utils/WowletSeed.h b/src/utils/WowletSeed.h new file mode 100644 index 0000000..77f861a --- /dev/null +++ b/src/utils/WowletSeed.h @@ -0,0 +1,114 @@ +#ifndef WOWLET_WOWLETSEED_H +#define WOWLET_WOWLETSEED_H + +#include "libwalletqt/WalletManager.h" +#include "libwalletqt/Wallet.h" + +#include +#include "RestoreHeightLookup.h" + +enum SeedType { + WOWNERO = 0, // 25 word seeds + TEVADOR // 14 word seeds +}; + +struct WowletSeed { + QString coin; + QString language; + SeedType seedType; + + QStringList mnemonic; + QString spendKey; + QString correction; + + time_t time; + int restoreHeight = 0; + RestoreHeightLookup *lookup = nullptr; + + QString errorString; + + explicit WowletSeed(RestoreHeightLookup *lookup, + const QString &coin = "wownero", + const QString &language = "English", + const QStringList &mnemonic = {}) + : lookup(lookup), coin(coin), language(language), mnemonic(mnemonic) + { + // Generate a new mnemonic if none was given + if (this->mnemonic.length() == 0) { + this->time = std::time(nullptr); + wownero_seed seed(this->time, coin.toStdString()); + + std::stringstream buffer; + buffer << seed; + this->mnemonic = QString::fromStdString(buffer.str()).split(" "); + + buffer.str(std::string()); + buffer << seed.key(); + this->spendKey = QString::fromStdString(buffer.str()); + + this->setRestoreHeight(); + } + + if (this->mnemonic.length() == 25) { + this->seedType = SeedType::WOWNERO; + } + else if (this->mnemonic.length() == 14) { + this->seedType = SeedType::TEVADOR; + } else { + this->errorString = "Mnemonic seed does not match known type"; + return; + } + + if (seedType == SeedType::TEVADOR) { + try { + wownero_seed seed(this->mnemonic.join(" ").toStdString(), coin.toStdString()); + + this->time = seed.date(); + this->setRestoreHeight(); + + std::stringstream buffer; + buffer << seed.key(); + this->spendKey = QString::fromStdString(buffer.str()); + + this->correction = QString::fromStdString(seed.correction()); + if (!this->correction.isEmpty()) { + buffer.str(std::string()); + buffer << seed; + int index = this->mnemonic.indexOf("xxxx"); + this->mnemonic.replace(index, this->correction); + } + } + catch (const std::exception &e) { + this->errorString = e.what(); + return; + } + } + } + + int setRestoreHeight() { + if (this->lookup == nullptr) + return 1; + + if (this->time == 0) + return 1; + + this->restoreHeight = this->lookup->dateToRestoreHeight(this->time); + return this->restoreHeight; + } + + int setRestoreHeight(int height) { + auto now = std::time(nullptr); + auto nowClearance = 3600 * 24; + auto currentBlockHeight = this->lookup->dateToRestoreHeight(now - nowClearance); + if (height >= currentBlockHeight + nowClearance) { + qCritical() << "unrealistic restore height detected, setting to current blockheight instead: " << currentBlockHeight; + this->restoreHeight = currentBlockHeight; + } else { + this->restoreHeight = height; + } + + return this->restoreHeight; + } +}; + +#endif //WOWLET_WOWLETSEED_H diff --git a/src/utils/childproc.cpp b/src/utils/childproc.cpp index 383fe53..e11e902 100644 --- a/src/utils/childproc.cpp +++ b/src/utils/childproc.cpp @@ -1,8 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include -#include #include "utils/childproc.h" ChildProcess::ChildProcess(QObject* parent) {} diff --git a/src/utils/childproc.h b/src/utils/childproc.h index 5f2bb43..f3c1dc0 100644 --- a/src/utils/childproc.h +++ b/src/utils/childproc.h @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_FPROCESS_H -#define FEATHER_FPROCESS_H +#ifndef WOWLET_FPROCESS_H +#define WOWLET_FPROCESS_H -#include #include #if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX) @@ -22,4 +21,4 @@ protected: }; -#endif //FEATHER_FPROCESS_H +#endif //WOWLET_FPROCESS_H diff --git a/src/utils/config.cpp b/src/utils/config.cpp index ef15354..e025757 100644 --- a/src/utils/config.cpp +++ b/src/utils/config.cpp @@ -1,16 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (C) 2020 KeePassXC Team // Copyright (C) 2011 Felix Geyer -// Copyright (C) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "config.h" #include "utils/utils.h" #include "utils/tails.h" -#include -#include -#include - #define QS QStringLiteral struct ConfigDirective @@ -25,29 +21,37 @@ static const QHash configStrings = { {Config::checkForAppUpdates,{QS("checkForAppUpdates"), true}}, {Config::warnOnStagenet,{QS("warnOnStagenet"), true}}, {Config::warnOnTestnet,{QS("warnOnTestnet"), true}}, - {Config::warnOnAlpha,{QS("warnOnAlpha"), true}}, - {Config::homeWidget,{QS("homeWidget"), "ccs"}}, - {Config::donateBeg,{QS("donateBeg"), 1}}, + {Config::homeWidget,{QS("homeWidget"), 0}}, {Config::skin,{QS("skin"), "light"}}, + {Config::openVRSkin,{QS("openVRSkin"), "default"}}, + {Config::openVRStreamerMode,{QS("openVRStreamerMode"), false}}, {Config::preferredFiatCurrency,{QS("preferredFiatCurrency"), "USD"}}, - {Config::blockExplorer,{QS("blockExplorer"), "exploremonero.com"}}, + {Config::blockExplorer,{QS("blockExplorer"), "muchwow.lol"}}, {Config::walletDirectory,{QS("walletDirectory"), ""}}, {Config::autoOpenWalletPath,{QS("autoOpenWalletPath"), ""}}, {Config::walletPath,{QS("walletPath"), ""}}, {Config::xmrigPath,{QS("xmrigPath"), ""}}, - {Config::xmrigPool,{QS("xmrigPool"), "pool.xmr.pt:9000"}}, + {Config::wownerodPath, {QS("wownerodPath"), ""}}, {Config::nodes,{QS("nodes"), "{}"}}, {Config::websocketEnabled,{QS("websocketEnabled"), true}}, {Config::nodeSource,{QS("nodeSource"), 0}}, {Config::useOnionNodes,{QS("useOnionNodes"), false}}, + {Config::showTabHome,{QS("showTabHome"), true}}, {Config::showTabCoins,{QS("showTabCoins"), false}}, - {Config::showTabExchange, {QS("showTabExchange"), true}}, - {Config::showTabXMRig,{QS("showTabXMRig"), false}}, - {Config::showTabCalc,{QS("showTabCalc"), true}}, + {Config::showTabXMRig,{QS("showTabXMRig"), true}}, + {Config::showTabCalc,{QS("showTabCalc"), false}}, {Config::geometry, {QS("geometry"), {}}}, {Config::windowState, {QS("windowState"), {}}}, {Config::firstRun,{QS("firstRun"), false}}, - {Config::hideBalance, {QS("hideBalance"), false}} + {Config::hideBalance, {QS("hideBalance"), false}}, + {Config::hideOnClose, {QS("hideOnClose"), false}}, + {Config::simplifiedMiningInterface, {QS("simplifiedMiningInterface"), false}}, + {Config::hideFiatBalance, {QS("hideFiatBalance"), false}}, + {Config::redditFrontend, {QS("redditFrontend"), "old.reddit.com"}}, + {Config::showHistorySyncNotice, {QS("showHistorySyncNotice"), true}}, + {Config::ignoreUpdateWarning, {QS("ignoreUpdateWarning"), ""}}, + {Config::suchWowTipAmount, {QS("suchWowTipAmount"), 0.75}}, + {Config::LinuxActivated, {QS("linuxActivated"), ""}} }; @@ -114,7 +118,7 @@ Config::Config(QObject* parent) QString appImagePath = qgetenv("APPIMAGE"); QFileInfo appImageDir(appImagePath); - QDir portablePath(appImageDir.absoluteDir().path() + "/.feather"); + QDir portablePath(appImageDir.absoluteDir().path() + "/.wowlet"); if (portablePath.mkpath(".")) { configPath = portablePath.path(); } @@ -123,7 +127,7 @@ Config::Config(QObject* parent) } } - configPath += "/.config/feather/settings.json"; + configPath += "/.config/wowlet/settings.json"; init(QDir::toNativeSeparators(configPath)); } @@ -149,4 +153,4 @@ Config* Config::instance() } return m_instance; -} \ No newline at end of file +} diff --git a/src/utils/config.h b/src/utils/config.h index b043d8e..92f1335 100644 --- a/src/utils/config.h +++ b/src/utils/config.h @@ -1,10 +1,10 @@ // SPDX-License-Identifier: BSD-3-Clause // Copyright (C) 2020 KeePassXC Team // Copyright (C) 2011 Felix Geyer -// Copyright (C) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_SETTINGS_H -#define FEATHER_SETTINGS_H +#ifndef WOWLET_SETTINGS_H +#define WOWLET_SETTINGS_H #include #include @@ -23,29 +23,37 @@ public: checkForAppUpdates, warnOnStagenet, warnOnTestnet, - warnOnAlpha, homeWidget, - donateBeg, autoOpenWalletPath, skin, + openVRSkin, + openVRStreamerMode, preferredFiatCurrency, blockExplorer, walletDirectory, walletPath, xmrigPath, - xmrigPool, + wownerodPath, nodes, websocketEnabled, nodeSource, useOnionNodes, + showTabHome, showTabCoins, - showTabExchange, showTabCalc, showTabXMRig, geometry, windowState, firstRun, - hideBalance + hideBalance, + hideFiatBalance, + hideOnClose, + simplifiedMiningInterface, + redditFrontend, + showHistorySyncNotice, + ignoreUpdateWarning, + suchWowTipAmount, + LinuxActivated }; ~Config() override; @@ -76,4 +84,4 @@ inline Config* config() return Config::instance(); } -#endif //FEATHER_SETTINGS_H +#endif //WOWLET_SETTINGS_H diff --git a/src/utils/daemonrpc.cpp b/src/utils/daemonrpc.cpp index 619a52e..69c8bfc 100644 --- a/src/utils/daemonrpc.cpp +++ b/src/utils/daemonrpc.cpp @@ -1,10 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "daemonrpc.h" -#include - DaemonRpc::DaemonRpc(QObject *parent, UtilsNetworking *network, QString daemonAddress) : QObject(parent) , m_network(network) diff --git a/src/utils/daemonrpc.h b/src/utils/daemonrpc.h index 27c0c94..408a387 100644 --- a/src/utils/daemonrpc.h +++ b/src/utils/daemonrpc.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_DAEMON_RPC_H -#define FEATHER_DAEMON_RPC_H +#ifndef WOWLET_DAEMON_RPC_H +#define WOWLET_DAEMON_RPC_H #include @@ -48,4 +48,4 @@ private: }; -#endif //FEATHER_DAEMON_RPC_H +#endif //WOWLET_DAEMON_RPC_H diff --git a/src/utils/keysfiles.cpp b/src/utils/keysfiles.cpp index da7ca95..c61defa 100644 --- a/src/utils/keysfiles.cpp +++ b/src/utils/keysfiles.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include #include @@ -7,24 +7,26 @@ #include #include #include -#include -#include #include "appcontext.h" -#include "utils/config.h" -#include "utils/networktype.h" -#include "utils/utils.h" -#include "keysfiles.h" using namespace std::chrono; +WalletKeysFiles::WalletKeysFiles() = default; // to please Q_DECLARE_METATYPE WalletKeysFiles::WalletKeysFiles(const QFileInfo &info, int networkType, QString address) : m_fileName(info.fileName()), m_modified(info.lastModified().toSecsSinceEpoch()), m_path(QDir::toNativeSeparators(info.absoluteFilePath())), m_networkType(networkType), - m_address(std::move(address)) {} + m_address(std::move(address)) +{ + QFileInfo cacheFile = QFileInfo(info.absoluteFilePath().replace(QRegExp(".keys$"), "")); + qint64 cacheLastModified = cacheFile.lastModified().toSecsSinceEpoch(); + if (cacheFile.exists()) { + m_modified = (cacheLastModified > m_modified) ? cacheLastModified : m_modified; + } +} QString WalletKeysFiles::fileName() const { return m_fileName; @@ -46,6 +48,20 @@ int WalletKeysFiles::networkType() const { return m_networkType; } +QVariant WalletKeysFiles::toVariant() const { + return QVariant::fromValue(*this); +} + +QJsonObject WalletKeysFiles::toJsonObject() const { + auto item = QJsonObject(); + item["fileName"] = m_fileName; + item["modified"] = m_modified; + item["path"] = m_path; + item["networkType"] = m_networkType; + item["address"] = m_address; + return item; +} + WalletKeysFilesModel::WalletKeysFilesModel(AppContext *ctx, QObject *parent) : QAbstractTableModel(parent) , m_ctx(ctx) diff --git a/src/utils/keysfiles.h b/src/utils/keysfiles.h index e044911..5f665b9 100644 --- a/src/utils/keysfiles.h +++ b/src/utils/keysfiles.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef KEYSFILES_H #define KEYSFILES_H @@ -7,11 +7,12 @@ #include "libwalletqt/WalletManager.h" #include "utils/networktype.h" #include "utils/utils.h" -#include class WalletKeysFiles { + Q_GADGET public: + WalletKeysFiles(); WalletKeysFiles(const QFileInfo &info, int networkType, QString address); QString fileName() const; @@ -20,6 +21,15 @@ public: int networkType() const; QString address() const; + QJsonObject toJsonObject() const; + QVariant toVariant() const; + + Q_PROPERTY(qint64 modified READ modified) + Q_PROPERTY(QString fileName READ fileName) + Q_PROPERTY(QString path READ path) + Q_PROPERTY(QString address READ address) + Q_PROPERTY(int networkType READ networkType) + private: QString m_fileName; qint64 m_modified; @@ -27,6 +37,8 @@ private: int m_networkType; QString m_address; }; +Q_DECLARE_METATYPE(WalletKeysFiles) + class WalletKeysFilesModel : public QAbstractTableModel { @@ -53,6 +65,10 @@ public: QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; QStringList walletDirectories; + QList listWallets() { + return m_walletKeyFiles; + } + private: void updateDirectories(); diff --git a/src/utils/networking.cpp b/src/utils/networking.cpp index 1a50331..c6d2404 100644 --- a/src/utils/networking.cpp +++ b/src/utils/networking.cpp @@ -1,8 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include -#include #include #include @@ -18,6 +16,7 @@ void UtilsNetworking::setUserAgent(const QString &userAgent) { } void UtilsNetworking::get(const QString &url) { + busy = true; QNetworkRequest request; request.setUrl(QUrl(url)); request.setRawHeader("User-Agent", m_userAgent.toUtf8()); @@ -28,6 +27,7 @@ void UtilsNetworking::get(const QString &url) { } QNetworkReply* UtilsNetworking::getJson(const QString &url) { + busy = true; QNetworkRequest request; request.setUrl(QUrl(url)); request.setRawHeader("User-Agent", m_userAgent.toUtf8()); @@ -37,6 +37,7 @@ QNetworkReply* UtilsNetworking::getJson(const QString &url) { } QNetworkReply* UtilsNetworking::postJson(const QString &url, const QJsonObject &data) { + busy = true; QNetworkRequest request; request.setUrl(QUrl(url)); request.setRawHeader("User-Agent", m_userAgent.toUtf8()); @@ -63,6 +64,8 @@ void UtilsNetworking::webResponse(QNetworkReply *reply) { emit webErrorReceived(err); else emit webReceived(data); + + busy = false; } QString UtilsNetworking::validateJSON(QNetworkReply *reply){ diff --git a/src/utils/networking.h b/src/utils/networking.h index d0be889..450852b 100644 --- a/src/utils/networking.h +++ b/src/utils/networking.h @@ -1,19 +1,16 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_NETWORKING_H -#define FEATHER_NETWORKING_H +#ifndef WOWLET_NETWORKING_H +#define WOWLET_NETWORKING_H -#include #include -#include #include #include #include #include "utils/utils.h" -static QStringList randomHTTPAgents; class CCSEntry; class UtilsNetworking : public QObject @@ -29,6 +26,8 @@ public: void setUserAgent(const QString &userAgent); static QString validateJSON(QNetworkReply *reply); + bool busy = false; + private slots: void webResponse(QNetworkReply *reply); @@ -41,4 +40,4 @@ private: QNetworkAccessManager *m_networkAccessManager; }; -#endif //FEATHER_NETWORKING_H +#endif //WOWLET_NETWORKING_H diff --git a/src/utils/networktype.h b/src/utils/networktype.h index 227b003..05734ec 100644 --- a/src/utils/networktype.h +++ b/src/utils/networktype.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #pragma once diff --git a/src/utils/nodes.cpp b/src/utils/nodes.cpp index 0cf53e6..246dbf5 100644 --- a/src/utils/nodes.cpp +++ b/src/utils/nodes.cpp @@ -1,7 +1,6 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include #include #include @@ -13,7 +12,7 @@ Nodes::Nodes(AppContext *ctx, QNetworkAccessManager *networkAccessManager, QObje QObject(parent), m_ctx(ctx), m_networkAccessManager(networkAccessManager), - m_connection(FeatherNode()), + m_connection(WowletNode()), modelWebsocket(new NodeModel(NodeSource::websocket, this)), modelCustom(new NodeModel(NodeSource::custom, this)) { this->loadConfig(); @@ -42,7 +41,7 @@ void Nodes::loadConfig() { // load custom nodes auto nodes = obj.value("custom").toArray(); for (auto value: nodes) { - auto customNode = FeatherNode(value.toString()); + auto customNode = WowletNode(value.toString()); customNode.custom = true; if(m_connection == customNode) { @@ -58,7 +57,7 @@ void Nodes::loadConfig() { // load cached websocket nodes auto ws = obj.value("ws").toArray(); for (auto value: ws) { - auto wsNode = FeatherNode(value.toString()); + auto wsNode = WowletNode(value.toString()); wsNode.custom = false; wsNode.online = true; // assume online @@ -84,6 +83,37 @@ void Nodes::loadConfig() { qDebug() << QString("Loaded %1 custom nodes from config").arg(m_customNodes.count()); } + // No nodes cached, fallback to hardcorded list + if (m_websocketNodes.count() == 0) { + QByteArray file = Utils::fileOpenQRC(":/assets/nodes.json"); + QJsonDocument nodes_json = QJsonDocument::fromJson(file); + QJsonObject nodes_obj = nodes_json.object(); + + QString netKey; + if (m_ctx->networkType == NetworkType::MAINNET) { + netKey = "mainnet"; + } else if (m_ctx->networkType == NetworkType::STAGENET) { + netKey = "stagenet"; + } + + if (nodes_obj.contains(netKey)) { + QJsonArray nodes_list; + if (m_ctx->isTails || m_ctx->isWhonix || m_ctx->isTorSocks) { + nodes_list = nodes_json[netKey].toObject()["tor"].toArray(); + } else { + nodes_list = nodes_json[netKey].toObject()["clearnet"].toArray(); + } + for (auto node: nodes_list) { + auto wsNode = WowletNode(node.toString()); + wsNode.custom = false; + wsNode.online = true; + m_websocketNodes.append(wsNode); + } + } + + qDebug() << QString("Loaded %1 nodes from hardcoded list").arg(m_websocketNodes.count()); + } + m_configJson[key] = obj; this->writeConfig(); this->updateModels(); @@ -104,7 +134,7 @@ void Nodes::connectToNode() { this->autoConnect(true); } -void Nodes::connectToNode(const FeatherNode &node) { +void Nodes::connectToNode(const WowletNode &node) { if (node.address.isEmpty()) return; @@ -139,7 +169,7 @@ void Nodes::autoConnect(bool forceReconnect) { if (wsMode && !m_wsNodesReceived && m_websocketNodes.count() == 0) { // this situation should rarely occur due to the usage of the websocket node cache on startup. - qInfo() << "Feather is in websocket connection mode but was not able to receive any nodes (yet)."; + qInfo() << "WOWlet is in websocket connection mode but was not able to receive any nodes (yet)."; return; } @@ -170,14 +200,15 @@ void Nodes::autoConnect(bool forceReconnect) { this->updateModels(); } -FeatherNode Nodes::pickEligibleNode() { +WowletNode Nodes::pickEligibleNode() { // Pick a node at random to connect to - auto rtn = FeatherNode(); + auto rtn = WowletNode(); auto wsMode = (this->source() == NodeSource::websocket); auto nodes = wsMode ? m_websocketNodes : m_customNodes; if (nodes.count() == 0) { - this->exhausted(); + if (wsMode) + this->exhausted(); return rtn; } @@ -193,7 +224,7 @@ FeatherNode Nodes::pickEligibleNode() { // Pick random eligible node int mode_height = this->modeHeight(nodes); for (int index : node_indeces) { - const FeatherNode &node = nodes.at(index); + const WowletNode &node = nodes.at(index); // This may fail to detect bad nodes if cached nodes are used // Todo: wait on websocket before connecting, only use cache if websocket is unavailable @@ -220,11 +251,14 @@ FeatherNode Nodes::pickEligibleNode() { } // All nodes tried, and none eligible - this->exhausted(); + // Don't show node exhaustion warning if single custom node is used + if (wsMode || node_indeces.size() > 1) { + this->exhausted(); + } return rtn; } -void Nodes::onWSNodesReceived(const QList> &nodes) { +void Nodes::onWSNodesReceived(const QList> &nodes) { m_websocketNodes.clear(); m_wsNodesReceived = true; @@ -269,7 +303,7 @@ void Nodes::onNodeSourceChanged(NodeSource nodeSource) { this->autoConnect(true); } -void Nodes::setCustomNodes(const QList &nodes) { +void Nodes::setCustomNodes(const QList &nodes) { m_customNodes.clear(); auto key = QString::number(m_ctx->networkType); auto obj = m_configJson.value(key).toObject(); @@ -295,7 +329,7 @@ void Nodes::updateModels() { } void Nodes::resetLocalState() { - auto resetState = [this](QList *model){ + auto resetState = [this](QList *model){ for (auto&& node: *model) { node.isConnecting = false; node.isActive = false; @@ -338,11 +372,11 @@ void Nodes::WSNodeExhaustedWarning() { m_wsExhaustedWarningEmitted = true; } -QList Nodes::customNodes() { +QList Nodes::customNodes() { return m_customNodes; } -FeatherNode Nodes::connection() { +WowletNode Nodes::connection() { return m_connection; } @@ -350,7 +384,7 @@ NodeSource Nodes::source() { return m_source; } -int Nodes::modeHeight(const QList &nodes) { +int Nodes::modeHeight(const QList &nodes) { QVector heights; for (const auto &node: nodes) { heights.push_back(node.height); diff --git a/src/utils/nodes.h b/src/utils/nodes.h index 81c9627..083c309 100644 --- a/src/utils/nodes.h +++ b/src/utils/nodes.h @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_NODES_H -#define FEATHER_NODES_H +#ifndef WOWLET_NODES_H +#define WOWLET_NODES_H -#include #include #include #include @@ -21,8 +20,8 @@ enum NodeSource { custom }; -struct FeatherNode { - explicit FeatherNode(QString _address = "", int height = 0, int target_height = 0, bool online = false) +struct WowletNode { + explicit WowletNode(QString _address = "", int height = 0, int target_height = 0, bool online = false) : height(height), target_height(target_height), online(online){ // wonky ipv4/host parsing, should be fine(tm)(c). if(_address.isEmpty()) return; @@ -74,7 +73,7 @@ struct FeatherNode { return QString("%1://%2/get_info").arg(this->isHttps ? "https": "http",this->full); } - bool operator == (const FeatherNode &other) const { + bool operator == (const WowletNode &other) const { return this->full == other.full; } }; @@ -88,18 +87,18 @@ public: void writeConfig(); NodeSource source(); - FeatherNode connection(); - QList customNodes(); + WowletNode connection(); + QList customNodes(); NodeModel *modelWebsocket; NodeModel *modelCustom; public slots: void connectToNode(); - void connectToNode(const FeatherNode &node); - void onWSNodesReceived(const QList>& nodes); + void connectToNode(const WowletNode &node); + void onWSNodesReceived(const QList>& nodes); void onNodeSourceChanged(NodeSource nodeSource); - void setCustomNodes(const QList& nodes); + void setCustomNodes(const QList& nodes); void autoConnect(bool forceReconnect = false); signals: @@ -115,24 +114,24 @@ private: QStringList m_recentFailures; - QList m_customNodes; - QList m_websocketNodes; + QList m_customNodes; + QList m_websocketNodes; - FeatherNode m_connection; // current active connection, if any + WowletNode m_connection; // current active connection, if any bool m_wsNodesReceived = false; bool m_wsExhaustedWarningEmitted = true; bool m_customExhaustedWarningEmitted = true; bool m_enableAutoconnect = true; - FeatherNode pickEligibleNode(); + WowletNode pickEligibleNode(); void updateModels(); void resetLocalState(); void exhausted(); void WSNodeExhaustedWarning(); void nodeExhaustedWarning(); - int modeHeight(const QList &nodes); + int modeHeight(const QList &nodes); }; -#endif //FEATHER_NODES_H +#endif //WOWLET_NODES_H diff --git a/src/utils/prices.cpp b/src/utils/prices.cpp index 529597c..82dc864 100644 --- a/src/utils/prices.cpp +++ b/src/utils/prices.cpp @@ -1,9 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include #include #include "utils/prices.h" @@ -39,10 +38,12 @@ void Prices::cryptoPricesReceived(const QJsonArray &data) { for(auto &&entry: data) { marketStruct ms; QJsonObject obj = entry.toObject(); - ms.symbol = obj.value("symbol").toString(); + ms.symbol = obj.value("symbol").toString().toUpper(); ms.image = obj.value("image").toString(); ms.name = obj.value("name").toString(); - ms.price_usd = obj.value("current_price").toDouble(); + ms.price_usd = obj.value("current_price").toDouble(0); + ms.price_btc = obj.value("current_price_btc").toDouble(0.0); + ms.price_sat = obj.value("current_price_satoshi").toInt(0); ms.price_usd_change_pct_24h = obj.value("price_change_percentage_24h").toDouble(); if(ms.price_usd <= 0) continue; @@ -86,9 +87,8 @@ double Prices::convert(const QString &symbolFrom, const QString &symbolTo, doubl } void Prices::fiatPricesReceived(const QJsonObject &data) { - QJsonObject rates = data.value("rates").toObject(); for(const auto ¤cy: fiat.keys()) - if(rates.contains(currency)) - this->rates.insert(currency, rates.value(currency).toDouble()); + if(data.contains(currency)) + this->rates.insert(currency, data.value(currency).toDouble()); emit fiatPricesUpdated(); } diff --git a/src/utils/prices.h b/src/utils/prices.h index c33382f..2c606e3 100644 --- a/src/utils/prices.h +++ b/src/utils/prices.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_PRICES_H -#define FEATHER_PRICES_H +#ifndef WOWLET_PRICES_H +#define WOWLET_PRICES_H #include #include @@ -15,6 +15,8 @@ struct marketStruct { QString name; QString image; double price_usd; + double price_btc; + uint price_sat; double price_usd_change_pct_24h; }; @@ -39,4 +41,4 @@ signals: void cryptoPricesUpdated(); }; -#endif //FEATHER_PRICES_H +#endif //WOWLET_PRICES_H diff --git a/src/utils/scheduler.cpp b/src/utils/scheduler.cpp index 0ba91ce..e8b8503 100644 --- a/src/utils/scheduler.cpp +++ b/src/utils/scheduler.cpp @@ -1,12 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #include "scheduler.h" -#include - -#include - FutureScheduler::FutureScheduler(QObject *parent) : QObject(parent), Alive(0), Stopping(false) { diff --git a/src/utils/scheduler.h b/src/utils/scheduler.h index 9908193..1dd9e23 100644 --- a/src/utils/scheduler.h +++ b/src/utils/scheduler.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2014-2020, The Monero Project. +// Copyright (c) 2014-2021, The Monero Project. #ifndef FUTURE_SCHEDULER_H #define FUTURE_SCHEDULER_H diff --git a/src/utils/seeds.h b/src/utils/seeds.h deleted file mode 100644 index 13dd7e3..0000000 --- a/src/utils/seeds.h +++ /dev/null @@ -1,170 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_SEEDS_H -#define FEATHER_SEEDS_H - -#include -#include -#include -#include - -#include - -#include "networktype.h" -#include "libwalletqt/WalletManager.h" -#include "libwalletqt/Wallet.h" -#include "utils/utils.h" - - -struct RestoreHeightLookup { - NetworkType::Type type; - QMap data; - explicit RestoreHeightLookup(NetworkType::Type type) : type(type) {} - - int dateToRestoreHeight(int date) { - // restore height based on a given timestamp using a lookup - // table. If it cannot find the date in the lookup table, it - // will calculate the blockheight based off the last known - // date: ((now - lastKnownDate) / blockTime) - clearance - - if(this->type == NetworkType::TESTNET) return 1; - int blockTime = 120; - int blocksPerDay = 86400 / blockTime; - int blockCalcClearance = blocksPerDay * 5; - QList values = this->data.keys(); - if(date <= values.at(0)) - return this->data[values.at(0)]; - for(int i = 0; i != values.count(); i++) { - if(values[i] > date) { - return i - 1 < 0 ? this->data[values[i]] : this->data[values[i-1]] - blockCalcClearance; - } - } - - // lookup failed, calculate blockheight from last known checkpoint - int lastBlockHeightTime = values.at(values.count() - 1); - int lastBlockHeight = this->data[lastBlockHeightTime]; - int deltaTime = date - lastBlockHeightTime; - int deltaBlocks = deltaTime / blockTime; - int blockHeight = (lastBlockHeight + deltaBlocks) - blockCalcClearance; - qDebug() << "Calculated blockheight: " << blockHeight << " from epoch " << date; - return blockHeight; - } - - int restoreHeightToDate(int height) { - // @TODO: most likely inefficient, refactor - QMap::iterator i; - int timestamp = 0; - for (i = this->data.begin(); i != this->data.end(); ++i) { - int ts = i.key(); - if (i.value() > height) - return timestamp; - timestamp = ts; - } - return timestamp; - } - - static RestoreHeightLookup *fromFile(const QString &fn, NetworkType::Type type) { - // initialize this class using a lookup table, e.g `:/assets/restore_heights_monero_mainnet.txt`/ - auto rtn = new RestoreHeightLookup(type); - auto data = Utils::barrayToString(Utils::fileOpen(fn)); - QMap _data; - for(const auto &line: data.split('\n')) { - if(line.trimmed().isEmpty()) continue; - auto spl = line.trimmed().split(':'); - rtn->data[spl.at(0).toUInt()] = spl.at(1).toUInt(); - } - return rtn; - } -}; - -struct FeatherSeed { - QString mnemonicSeed; - QString spendKey; - time_t time = 0; - int restoreHeight = 0; - RestoreHeightLookup *lookup = nullptr; - QString language; - std::string coinName; - explicit FeatherSeed(RestoreHeightLookup *lookup, const std::string &coinName = "monero", const QString &language = "English") : lookup(lookup), coinName(coinName), language(language) {} - - static FeatherSeed fromSeed(RestoreHeightLookup *lookup, - const std::string &coinName, - const QString &seedLanguage, - const std::string &mnemonicSeed) { - - auto rtn = FeatherSeed(lookup, coinName, seedLanguage); - rtn.lookup = lookup; - rtn.mnemonicSeed = QString::fromStdString(mnemonicSeed); - - if(QString::fromStdString(mnemonicSeed).split(" ").count() == 14) { - monero_seed seed(mnemonicSeed, coinName); - std::stringstream buffer; - buffer << seed.key(); - rtn.time = seed.date(); - rtn.setRestoreHeight(); - rtn.spendKey = QString::fromStdString(buffer.str()); - } - return rtn; - } - - static FeatherSeed generate(RestoreHeightLookup *lookup, const std::string &coinName, const QString &language) { - auto rtn = FeatherSeed(lookup, coinName, language); - time_t _time = std::time(nullptr); - monero_seed seed(_time, coinName); - - std::stringstream buffer; - buffer << seed; - rtn.mnemonicSeed = QString::fromStdString(buffer.str()); - buffer.str(std::string()); - buffer << seed.key(); - rtn.spendKey = QString::fromStdString(buffer.str()); - rtn.time = _time; - rtn.setRestoreHeight(); - return rtn; - } - - Wallet *writeWallet(WalletManager *manager, NetworkType::Type type, const QString &path, const QString &password, quint64 kdfRounds) { - // writes both 14/25 word mnemonic seeds. - Wallet *wallet = nullptr; - if(this->lookup == nullptr) return wallet; - if(this->mnemonicSeed.split(" ").count() == 14) { - if(this->spendKey.isEmpty()) { - auto _seed = FeatherSeed::fromSeed(this->lookup, this->coinName, this->language, this->mnemonicSeed.toStdString()); - _seed.setRestoreHeight(); - this->time = _seed.time; - this->restoreHeight = _seed.restoreHeight; - this->spendKey = _seed.spendKey; - } - wallet = manager->createDeterministicWalletFromSpendKey(path, password, this->language, type, this->spendKey, this->restoreHeight, kdfRounds); - wallet->setCacheAttribute("feather.seed", this->mnemonicSeed); - } else { - wallet = manager->recoveryWallet(path, password, this->mnemonicSeed, "", type, this->restoreHeight, kdfRounds); - } - - wallet->setPassword(password); - return wallet; - } - - int setRestoreHeight() { - if(this->lookup == nullptr) return 1; - if(this->time == 0) return 1; - this->restoreHeight = this->lookup->dateToRestoreHeight(this->time); - return this->restoreHeight; - } - - int setRestoreHeight(int height) { - auto now = std::time(nullptr); - auto nowClearance = 3600 * 24; - auto currentBlockHeight = this->lookup->dateToRestoreHeight(now - nowClearance); - if(height >= currentBlockHeight + nowClearance) { - qCritical() << "unrealistic restore height detected, setting to current blockheight instead: " << currentBlockHeight; - this->restoreHeight = currentBlockHeight; - } else - this->restoreHeight = height; - - return this->restoreHeight; - } -}; - -#endif //FEATHER_SEEDS_H diff --git a/src/utils/tails.cpp b/src/utils/tails.cpp index ae8cbde..01ec12e 100644 --- a/src/utils/tails.cpp +++ b/src/utils/tails.cpp @@ -1,11 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include -#include -#include #include "tails.h" #include "utils.h" @@ -58,9 +55,9 @@ void TailsOS::showDataPersistenceDisabledWarning() msgBox.setText(QObject::tr("Warning: persistence disabled")); msgBox.setWindowTitle(QObject::tr("Warning: persistence disabled")); msgBox.setInformativeText( - QObject::tr("Feather has detected that Tails persistence is " + QObject::tr("WOWlet has detected that Tails persistence is " "currently disabled. Any configurations and wallets you make inside " - "Feather will not be permanently saved." + "WOWlet will not be permanently saved." "\n\n" "Make sure to not save your wallet on the " "filesystem, as it will be lost at shutdown." diff --git a/src/utils/tails.h b/src/utils/tails.h index 0f827c2..701d660 100644 --- a/src/utils/tails.h +++ b/src/utils/tails.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef TAILSOS_H #define TAILSOS_H @@ -16,7 +16,6 @@ public: static QString version(); static void showDataPersistenceDisabledWarning(); - static void askPersistence(); static void persistXdgMime(const QString& filePath, const QString& data); static bool usePersistence; diff --git a/src/utils/textedit.cpp b/src/utils/textedit.cpp index 3fd7de5..51f2dbf 100644 --- a/src/utils/textedit.cpp +++ b/src/utils/textedit.cpp @@ -54,8 +54,6 @@ #include #include #include -#include -#include #include diff --git a/src/utils/tor.cpp b/src/utils/tor.cpp index 8430be9..a4e0996 100644 --- a/src/utils/tor.cpp +++ b/src/utils/tor.cpp @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include #include #include -#include #include +#include #include "utils/utils.h" #include "utils/tor.h" #include "appcontext.h" +#include "config-wowlet.h" QString Tor::torHost = "127.0.0.1"; quint16 Tor::torPort = 9050; @@ -44,7 +44,7 @@ Tor::Tor(AppContext *ctx, QObject *parent) } #ifndef HAS_TOR_BIN - qCritical() << "Feather built without embedded Tor. Assuming --use-local-tor"; + qCritical() << "WOWlet built without embedded Tor. Assuming --use-local-tor"; this->localTor = true; return; #endif @@ -116,7 +116,7 @@ void Tor::start() { } void Tor::checkConnection() { - // We might not be able to connect to localhost if torsocks is used to start feather + // We might not be able to connect to localhost if torsocks is used to start wowlet if (m_ctx->isTorSocks) this->setConnectionState(true); @@ -202,10 +202,23 @@ bool Tor::unpackBins() { QFile f(torFile); QFileInfo fileInfo(f); this->torPath = QDir(this->torDir).filePath(fileInfo.fileName()); + #if defined(Q_OS_WIN) if(!this->torPath.endsWith(".exe")) this->torPath += ".exe"; #endif + + TorVersion embeddedVersion = this->stringToVersion(QString(TOR_VERSION)); + TorVersion filesystemVersion = this->getVersion(torPath); + qDebug() << QString("Tor versions: embedded %1, filesystem %2").arg(embeddedVersion.toString(), filesystemVersion.toString()); + if (TorVersion::isValid(filesystemVersion) && (embeddedVersion > filesystemVersion)) { + qInfo() << "Embedded version is newer, overwriting."; + QFile::setPermissions(torPath, QFile::ReadOther | QFile::WriteOther); + if (!QFile::remove(torPath)) { + qWarning() << "Unable to remove old Tor binary"; + }; + } + qDebug() << "Writing Tor executable to " << this->torPath; f.copy(torPath); f.close(); @@ -217,49 +230,7 @@ bool Tor::unpackBins() { return true; } -networkPeer Tor::getPeerFromConfig(const QString &path) { - // parse Tor bind addr from given Tor config - QRegularExpression re("^SocksPort ([\\d|.|:]+)"); - - networkPeer peer; - peer.host = "127.0.0.1"; - peer.port = 9050; - - if(!Utils::fileExists(path)) { - peer.active = Utils::portOpen(peer.host, peer.port); - return peer; - } - - for(const auto &line: Utils::fileOpen(path).split('\n')) { - QRegularExpressionMatch match = re.match(line); - if(!match.hasMatch()) - continue; - - QString match_group = match.captured(1); - int host_idx = match_group.indexOf(':'); - if(host_idx >= 1){ - peer.host = match_group.mid(0, host_idx); - QString port = match_group.mid(host_idx + 1); - if(!Utils::isDigit(port)) - continue; - - peer.port = (quint16)port.toInt(); - qDebug() << "Parsed port from local Tor config"; - break; - } - - if(Utils::isDigit(match_group)) { - peer.port = (quint16)match_group.toInt(); - qDebug() << "Parsed port from local Tor config"; - break; - } - } - - peer.active = Utils::portOpen(peer.host, peer.port); - return peer; -} - -QString Tor::getVersion() { +TorVersion Tor::getVersion(const QString &fileName) { QProcess process; process.setProcessChannelMode(QProcess::MergedChannels); process.start(this->torPath, QStringList() << "--version"); @@ -268,13 +239,23 @@ QString Tor::getVersion() { if(output.isEmpty()) { qWarning() << "Could not grab Tor version"; - return ""; - } - QString version = output.split('\n').at(0); - if(version.startsWith("Tor version")){ - return version; - } else { - qWarning() << "Could not parse Tor version"; - return ""; + return TorVersion(); } + + return this->stringToVersion(output); } + +TorVersion Tor::stringToVersion(const QString &version) { + QRegularExpression re("(?\\d)\\.(?\\d)\\.(?\\d)\\.(?\\d)"); + QRegularExpressionMatch match = re.match(version); + + if (!match.hasMatch()) { + qWarning() << "Could not parse Tor version"; + return TorVersion(); + } + + return TorVersion(match.captured("major").toInt(), + match.captured("minor").toInt(), + match.captured("patch").toInt(), + match.captured("release").toInt()); +} \ No newline at end of file diff --git a/src/utils/tor.h b/src/utils/tor.h index 1b33aed..2bdf02b 100644 --- a/src/utils/tor.h +++ b/src/utils/tor.h @@ -1,19 +1,69 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_TOR_H -#define FEATHER_TOR_H +#ifndef WOWLET_TOR_H +#define WOWLET_TOR_H #include #include #include -#include #include #include -#include -#include #include "utils/childproc.h" +struct TorVersion +{ + explicit TorVersion(int major=0, int minor=0, int patch=0, int release=0) + : patch(patch), release(release) + { + this->major = major; + this->minor = minor; + } + + friend bool operator== (const TorVersion &v1, const TorVersion &v2) { + return (v1.major == v2.major && + v1.minor == v2.minor && + v1.patch == v2.patch && + v1.release == v2.release); + } + + friend bool operator!= (const TorVersion &v1, const TorVersion &v2) { + return !(v1 == v2); + } + + friend bool operator> (const TorVersion &v1, const TorVersion &v2) { + if (v1.major != v2.major) + return v1.major > v2.major; + if (v1.minor != v2.minor) + return v1.minor > v2.minor; + if (v1.patch != v2.patch) + return v1.patch > v2.patch; + if (v1.release != v2.release) + return v1.release > v2.release; + return false; + } + + friend bool operator< (const TorVersion &v1, const TorVersion &v2) { + if (v1 == v2) + return false; + return !(v1 > v2); + } + + QString toString() { + return QString("%1.%2.%3.%4").arg(QString::number(major), QString::number(minor), + QString::number(patch), QString::number(release)); + } + + static bool isValid(const TorVersion &v) { + return v != TorVersion(); + } + + int major; + int minor; + int patch; + int release; +}; + class Tor : public QObject { Q_OBJECT @@ -24,8 +74,8 @@ public: void start(); void stop(); bool unpackBins(); - QString getVersion(); - networkPeer getPeerFromConfig(const QString &path); + TorVersion getVersion(const QString &fileName); + TorVersion stringToVersion(const QString &version); bool torConnected = false; bool localTor = false; @@ -62,4 +112,4 @@ private: class AppContext; // forward declaration -#endif //FEATHER_TOR_H \ No newline at end of file +#endif //WOWLET_TOR_H \ No newline at end of file diff --git a/src/utils/txfiathistory.cpp b/src/utils/txfiathistory.cpp index 40e2033..0f902af 100644 --- a/src/utils/txfiathistory.cpp +++ b/src/utils/txfiathistory.cpp @@ -1,7 +1,7 @@ -#include -#include +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + #include -#include #include #include "txfiathistory.h" diff --git a/src/utils/txfiathistory.h b/src/utils/txfiathistory.h index 5370bf1..d3eca70 100644 --- a/src/utils/txfiathistory.h +++ b/src/utils/txfiathistory.h @@ -1,6 +1,8 @@ -#ifndef FEATHER_TXFIATHISTORY_H -#define FEATHER_TXFIATHISTORY_H +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +#ifndef WOWLET_TXFIATHISTORY_H +#define WOWLET_TXFIATHISTORY_H class TxFiatHistory : public QObject { Q_OBJECT @@ -28,4 +30,4 @@ private: int m_genesis_timestamp; }; -#endif //FEATHER_TXFIATHISTORY_H +#endif //WOWLET_TXFIATHISTORY_H diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp index b582574..6f8dc36 100644 --- a/src/utils/utils.cpp +++ b/src/utils/utils.cpp @@ -1,39 +1,26 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include -#include -#include #include #include #include -#include #include -#include -#include #include #include -#include -#include -#include #include -#include +#include #include "utils.h" #include "utils/config.h" #include "utils/tails.h" #include "utils/whonix.h" +#include "utils/ColorScheme.h" +#include "globals.h" // Application log for current session QVector applicationLog = QVector(); // todo: replace with ring buffer QMutex logMutex; -void Utils::openWindow(QWidget *w) { - auto first_screen = QApplication::screens()[0]; - w->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, w->size(), first_screen->availableGeometry())); - w->show(); -} - bool Utils::fileExists(const QString &path) { QFileInfo check_file(path); return check_file.exists() && check_file.isFile(); @@ -55,6 +42,12 @@ QByteArray Utils::fileOpen(const QString &path) { return data; } +qint64 Utils::fileModifiedAge(const QString &path) { + QFileInfo fileInfo; + fileInfo.setFile(path); + return (QDateTime::currentSecsSinceEpoch() - fileInfo.lastModified().toSecsSinceEpoch()); +} + QByteArray Utils::fileOpenQRC(const QString &path) { QFile file(path); if(!file.open(QIODevice::ReadOnly)) { @@ -76,16 +69,6 @@ bool Utils::fileWrite(const QString &path, const QString &data) { return false; } -QString Utils::systemAccountName(){ - QString accountName = qgetenv("USER"); // mac/linux - if (accountName.isEmpty()) - return qgetenv("USERNAME"); // Windows - if (accountName.isEmpty()) - qDebug() << "accountName was empty"; - - return ""; -} - bool Utils::validateJSON(const QByteArray &blob) { QJsonDocument doc = QJsonDocument::fromJson(blob); QString jsonString = doc.toJson(QJsonDocument::Indented); @@ -103,18 +86,6 @@ bool Utils::writeJsonFile(QIODevice &device, const QSettings::SettingsMap &map) return true; } -QStringList Utils::readJsonStringToQStringList(const QString &input) { - QStringList data; - - QJsonDocument doc = QJsonDocument::fromJson(input.toUtf8()); - QJsonObject object = doc.object(); - QJsonArray array = doc.array(); - - for(auto &&entry: array) - data << entry.toString(); - return data; -} - void Utils::applicationLogHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) { const QString fn = context.function ? QString::fromUtf8(context.function) : ""; const QString date = QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"); @@ -154,19 +125,6 @@ void Utils::applicationLogHandler(QtMsgType type, const QMessageLogContext &cont //emit applicationLogUpdated(message); } -QByteArray Utils::zipExtract(const QString &path, const QString& destination) { - Q_UNUSED(path) - Q_UNUSED(destination) - return QByteArray(); -} - -bool Utils::isDigit(const QString& inp) { - for (auto &&i : inp) { - if(!i.isDigit()) return false; - } - return true; -} - void Utils::desktopNotify(const QString &title, const QString &message, int duration) { QStringList notify_send = QStringList() << title << message << "-t" << QString::number(duration); QStringList kdialog = QStringList() << title << message; @@ -200,83 +158,6 @@ QString Utils::barrayToString(const QByteArray &data) { return QString(QTextCodec::codecForMib(106)->toUnicode(data)); } -QByteArray Utils::readSocket(QTcpSocket &socket, int buffer_size) { - QByteArray data; - if(!socket.waitForReadyRead(6000)) - return data; - - while(buffer_size > 0 && socket.bytesAvailable() > 0){ - QByteArray _data = socket.read(buffer_size); - buffer_size -= _data.size(); - data += _data; - } - - return data; -} - -bool Utils::testSocks5(const QString &host, quint16 port){ - // synchronous socks5 tester - QByteArray data; - QTcpSocket socket; - socket.connectToHost(host, port); - if (!socket.waitForConnected(1000)) { - qDebug() << QString("could not connect to %1 %2") - .arg(host).arg(port); - socket.close(); - return false; - } - - // latest & greatest - socket.write(QByteArray("\x05\x02", 2)); - socket.flush(); - - // no auth pl0x - socket.write(QByteArray("\x00\x01", 2)); - socket.flush(); - - // cool story - if(Utils::readSocket(socket, 2).isEmpty()){ - qDebug() << "socks response timeout"; - socket.close(); - return false; - } - - // pls sir - socket.write(QByteArray("\x05\x01\x00\x03", 4)); - - // here we go!! - socket.write(QByteArray("\x16", 1)); // len - socket.write(QByteArray("kebjllr47c2ouoly.onion")); - socket.write(QByteArray("\x00\x50", 2)); // port - socket.flush(); - - // fingers crossed - auto result = Utils::readSocket(socket, 10); - qDebug() << result; - if(result.length() != 10 || result.at(1) != 0) { - qDebug() << "bad socks response"; - socket.close(); - return false; - } - - // can haz? - QByteArray http("GET /api/v1/ping HTTP/1.1\r\nHost: kebjllr47c2ouoly.onion\r\nConnection: close\r\n\r\n"); - socket.write(http); - - auto resp = Utils::readSocket(socket, 555); - QRegularExpression re(R"(^HTTP\/\d.\d 200 OK)"); - QRegularExpressionMatch match = re.match(resp); - if(match.hasMatch()){ - socket.close(); - return true; - } - - qDebug() << resp; - - socket.close(); - return false; -} - void Utils::externalLinkWarning(QWidget *parent, const QString &url){ if(!config()->get(Config::warnOnExternalLink).toBool()) { QDesktopServices::openUrl(QUrl(url)); @@ -284,17 +165,26 @@ void Utils::externalLinkWarning(QWidget *parent, const QString &url){ } QString body = "You are about to open the following link:\n\n"; - body += QString("%1\n\n").arg(url); + body += QString("%1").arg(url); if (!(TailsOS::detect() || WhonixOS::detect())) - body += "You will NOT be using Tor."; + body += "\n\nYou will NOT be using Tor."; - switch (QMessageBox::warning(parent, "External link warning", body, QMessageBox::Cancel|QMessageBox::Ok)) { - case QMessageBox::Cancel: - break; - default: - QDesktopServices::openUrl(QUrl(url)); - break; + + QMessageBox linkWarning(parent); + linkWarning.setWindowTitle("External link warning"); + linkWarning.setText(body); + QPushButton *copy = linkWarning.addButton("Copy link", QMessageBox::HelpRole); + linkWarning.addButton(QMessageBox::Cancel); + linkWarning.addButton(QMessageBox::Ok); + linkWarning.setDefaultButton(QMessageBox::Ok); + + linkWarning.exec(); + + if (linkWarning.clickedButton() == copy) { + Utils::copyToClipboard(url); + } else if (linkWarning.result() == QMessageBox::Ok) { + QDesktopServices::openUrl(QUrl(url)); } } @@ -324,12 +214,6 @@ QStringList Utils::fileFind(const QRegExp &pattern, const QString &baseDir, int return rtn; } -bool Utils::walletExists(QString name, const QString &path) { - name = name.replace(".keys", ""); - auto walletPath = QDir(path).filePath(name + ".keys"); - return Utils::fileExists(walletPath); -} - void Utils::copyToClipboard(const QString &string){ QClipboard * clipboard = QApplication::clipboard(); if (!clipboard) { @@ -354,72 +238,13 @@ QString Utils::copyFromClipboard() { return clipboard->text(); } -QString Utils::blockExplorerLink(const QString &blockExplorer, NetworkType::Type nettype, const QString &txid) { - if (blockExplorer == "exploremonero.com") { - if (nettype == NetworkType::MAINNET) { - return QString("https://exploremonero.com/transaction/%1").arg(txid); - } +QString Utils::blockExplorerLink(const QString &txid) { + auto explorer = config()->get(Config::blockExplorer).toString(); + if(explorer.startsWith("muchwow.lol")) { + return QString("https://muchwow.lol/tx?id=%1").arg(txid); + } else { + return QString("https://explore.wownero.com/tx/%1").arg(txid); } - else if (blockExplorer == "moneroblocks.info") { - if (nettype == NetworkType::MAINNET) { - return QString("https://moneroblocks.info/tx/%1").arg(txid); - } - } - else if (blockExplorer == "blockchair.com") { - if (nettype == NetworkType::MAINNET) { - return QString("https://blockchair.com/monero/transaction/%1").arg(txid); - } - } - - switch (nettype) { - case NetworkType::MAINNET: - return QString("https://xmrchain.net/tx/%1").arg(txid); - case NetworkType::STAGENET: - return QString("https://stagenet.xmrchain.net/tx/%1").arg(txid); - case NetworkType::TESTNET: - return QString("https://testnet.xmrchain.net/tx/%1").arg(txid); - } - - return QString(""); -} - -QList Utils::procList() { - // windows maybe: https://stackoverflow.com/a/13635377/2054778 - QList rtn; - QProcess process; -#if defined(Q_OS_MAC) || defined(Q_OS_LINUX) -#if defined(Q_OS_MAC) - process.start("ps", QStringList() << "-wwaxo" << "pid,command"); -#elif defined(Q_OS_LINUX) - process.start("ps", QStringList() << "-wwaxo" << "pid,command"); -#endif - process.waitForFinished(-1); - - QString stdout = process.readAllStandardOutput(); - QString stderr = process.readAllStandardError(); - - if(stdout.isEmpty()) - return rtn; - - QStringList spl = stdout.split("\n"); - if(spl.count() >= 1) - spl.removeAt(0); - - for (auto& line: spl) { - line = line.trimmed(); - if(line.isEmpty()) - continue; - - QStringList _spl = line.split(" "); - processStruct ps; - if(_spl.length() >= 2) { - ps.pid = _spl.at(0).toInt(); - ps.command = _spl.at(1); - rtn.append(ps); - } - } -#endif - return rtn; } QStandardItem *Utils::qStandardItem(const QString& text) { @@ -436,26 +261,29 @@ QStandardItem *Utils::qStandardItem(const QString& text, QFont &font) { } QString Utils::getUnixAccountName() { +#ifdef __ANDROID__ + return ""; +#endif QString accountName = qgetenv("USER"); // mac/linux if (accountName.isEmpty()) accountName = qgetenv("USERNAME"); // Windows if (accountName.isEmpty()) - throw std::runtime_error("Could derive system account name from env vars: USER or USERNAME"); + throw std::runtime_error("Could not derive system account name from env vars: USER or USERNAME"); return accountName; } QString Utils::xdgDesktopEntry(){ return QString( "[Desktop Entry]\n" - "Name=Feather\n" - "GenericName=Feather\n" - "X-GNOME-FullName=Feather\n" - "Comment=a free Monero desktop wallet\n" - "Keywords=Monero;\n" + "Name=WOWlet\n" + "GenericName=WOWlet\n" + "X-GNOME-FullName=WOWlet\n" + "Comment=a free Wownero desktop wallet\n" + "Keywords=Wownero;\n" "Exec=\"%1\" %u\n" "Terminal=false\n" "Type=Application\n" - "Icon=monero\n" + "Icon=wowlet\n" "Categories=Network;GNOME;Qt;\n" "StartupNotify=true\n" "X-GNOME-Bugzilla-Bugzilla=GNOME\n" @@ -494,7 +322,7 @@ bool Utils::xdgDesktopEntryRegister() { writeLocations += QString("- %1\n").arg(xdgPaths.pathApp); writeLocations += QString("- %1\n").arg(xdgPaths.pathIcon); - QPixmap appIcon(":assets/images/feather.png"); + QPixmap appIcon(":assets/images/wowlet.png"); if (!Utils::fileExists(xdgPaths.pathIcon)) Utils::pixmapWrite(xdgPaths.pathIcon, appIcon); Utils::xdgDesktopEntryWrite(xdgPaths.pathApp); @@ -585,14 +413,19 @@ QLocale Utils::getCurrencyLocale(const QString ¤cyCode) { return locale; } -QString Utils::amountToCurrencyString(double amount, const QString ¤cyCode) { +double Utils::roundUp(double value, int decimal_places) { + const double multiplier = std::pow(10.0, decimal_places); + return std::ceil(value * multiplier) / multiplier; +} + +QString Utils::amountToCurrencyString(double amount, const QString ¤cyCode, int precision) { QLocale locale = getCurrencyLocale(currencyCode); // \xC2\xA0 = UTF-8 non-breaking space, it looks off. if (currencyCode == "USD") - return locale.toCurrencyString(amount, "$").remove("\xC2\xA0"); + return locale.toCurrencyString(amount, "$", precision).remove("\xC2\xA0"); - return locale.toCurrencyString(amount).remove("\xC2\xA0"); + return locale.toCurrencyString(amount, nullptr, precision).remove("\xC2\xA0"); } int Utils::maxLength(const QVector &array) { @@ -605,3 +438,73 @@ int Utils::maxLength(const QVector &array) { } return maxLength; } + +unsigned int Utils::countAlphaNum(const QByteArray &line) { + QRegularExpression re("([a-zA-Z0-9])"); + QRegularExpressionMatchIterator iterator = re.globalMatch(line); + + int count = 0; + while (iterator.hasNext()){ + QRegularExpressionMatch match = iterator.next(); + count += 1; + } + return count; +} + +bool Utils::versionOutdated(const QString ¤t_version, const QString &newest_version) { + // True when major or minor version changed + auto cver = current_version.split('.'); + auto nver = newest_version.split('.'); + int cverlist[] = {cver.at(0).toInt(), cver.at(1).toInt()}; + int nverlist[] = {nver.at(0).toInt(), nver.at(1).toInt()}; + if(cverlist[0] < nverlist[0] || cverlist[1] < nverlist[1]) return true; + return false; +} + +QString Utils::balanceFormat(quint64 balance) { + QString str = QString::number(balance / globals::cdiv, 'f', 4); + + str.remove(QRegExp("0+$")); + str.remove(QRegExp("\\.$")); + + return str; +} + +QTextCharFormat Utils::addressTextFormat(const SubaddressIndex &index) { + if (index.isPrimary()) { + QTextCharFormat rec; + rec.setBackground(QBrush(ColorScheme::YELLOW.asColor(true))); + rec.setToolTip("Wallet change/primary address"); + return rec; + } + if (index.isValid()) { + QTextCharFormat rec; + rec.setBackground(QBrush(ColorScheme::GREEN.asColor(true))); + rec.setToolTip("Wallet receive address"); + return rec; + } + return QTextCharFormat(); +} + +#ifdef __ANDROID__ +bool Utils::androidAskPermissions(const QVector &permissions) { + bool rtn = true; + if(QtAndroid::androidSdkVersion() >= 23) { + for(const QString &permission : permissions) { + auto result = QtAndroid::checkPermission(permission); + if(result != QtAndroid::PermissionResult::Granted) { + auto resultHash = QtAndroid::requestPermissionsSync(QStringList({permission})); + if(resultHash[permission] != QtAndroid::PermissionResult::Granted) { + qDebug() << "Fail to get permission" << permission; + rtn = false; + } else { + qDebug() << "Permission" << permission << "granted!"; + } + } else { + qDebug() << "Permission" << permission << "already granted!"; + } + } + } + return rtn; +} +#endif \ No newline at end of file diff --git a/src/utils/utils.h b/src/utils/utils.h index fff47c6..a2ca24e 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -1,22 +1,21 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_UTILS_H -#define FEATHER_UTILS_H +#ifndef WOWLET_UTILS_H +#define WOWLET_UTILS_H -#include -#include -#include #include #include -#include #include -#include -#include +#include +#ifdef __ANDROID__ +#include +#endif -#include +#include #include "networktype.h" +#include "libwalletqt/Wallet.h" struct logMessage { @@ -30,18 +29,6 @@ struct logMessage QString fn; }; -struct networkPeer { - QString host; - quint16 port; - bool active = false; -}; - -struct processStruct { - int pid = 0; - QString command; - QFileInfo fileInfo; -}; - struct xdgDesktopEntryPaths { QString pathApp; QString pathIcon; @@ -49,8 +36,8 @@ struct xdgDesktopEntryPaths { }; const xdgDesktopEntryPaths xdgPaths = { - QString("%1/feather.desktop").arg(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)), - QString("%1/.local/share/icons/feather.png").arg(QDir::homePath()), + QString("%1/org.wowlet.wowlet.desktop").arg(QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)), + QString("%1/usr/share/icons/hicolor/64x64/apps/wowlet.png").arg(QDir::homePath()), QString("/") }; @@ -59,56 +46,54 @@ class Utils public: static bool portOpen(const QString &hostname, quint16 port); - static bool isDigit(const QString &inp); static bool fileExists(const QString &path); static QByteArray fileOpen(const QString &path); static QByteArray fileOpenQRC(const QString &path); + static qint64 fileModifiedAge(const QString &path); static void desktopNotify(const QString &title, const QString &message, int duration); static bool fileWrite(const QString &path, const QString &data); static QStringList fileFind(const QRegExp &pattern, const QString &baseDir, int level, int depth, int maxPerDir); - static QString systemAccountName(); - static QByteArray zipExtract(const QString &path, const QString& destination); static bool validateJSON(const QByteArray &blob); static bool readJsonFile(QIODevice &device, QSettings::SettingsMap &map); - static bool walletExists(QString name, const QString &path); static bool writeJsonFile(QIODevice &device, const QSettings::SettingsMap &map); - static QStringList readJsonStringToQStringList(const QString &input); static void applicationLogHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg); - static void openWindow(QWidget *w); static void externalLinkWarning(QWidget *parent, const QString &url); - static QList procList(); static bool dirExists(const QString &path); static QString barrayToString(const QByteArray &data); - static QByteArray readSocket(QTcpSocket &socket, int buffer_size); - static bool testSocks5(const QString &host, quint16 port); static QStandardItem *qStandardItem(const QString &text); static QStandardItem *qStandardItem(const QString &text, QFont &font); static void copyToClipboard(const QString &string); static QString copyFromClipboard(); - static QString blockExplorerLink(const QString &blockExplorer, NetworkType::Type nettype, const QString &txid); + static QString blockExplorerLink(const QString &txid); static QString getUnixAccountName(); static QString xdgDesktopEntry(); static bool xdgDesktopEntryWrite(const QString &path); static void xdgRefreshApplications(); static bool xdgDesktopEntryRegister(); + static unsigned int countAlphaNum(const QByteArray &line); static bool pixmapWrite(const QString &path, const QPixmap &pixmap); static QFont relativeFont(int delta); static double roundSignificant(double N, double n); static QString formatBytes(quint64 bytes); static QLocale getCurrencyLocale(const QString ¤cyCode); - static QString amountToCurrencyString(double amount, const QString ¤cyCode); + static QString amountToCurrencyString(double amount, const QString ¤cyCode, int precision = 2); static int maxLength(const QVector &array); + static double roundUp(double value, int decimal_places); static QMap localeCache; + static QString balanceFormat(quint64 balance); + static QTextCharFormat addressTextFormat(const SubaddressIndex &index); + static bool versionOutdated(const QString ¤t_version, const QString &newest_version); template - static QString QtEnumToString (const QEnum value) - { + static QString QtEnumToString (const QEnum value) { return QString::fromStdString(std::string(QMetaEnum::fromType().valueToKey(value))); } + +#ifdef __ANDROID__ + static bool androidAskPermissions(const QVector &permissions); +#endif }; class AppContext; // forward declaration - - -#endif //FEATHER_UTILS_H +#endif //WOWLET_UTILS_H diff --git a/src/utils/whonix.cpp b/src/utils/whonix.cpp index 231073f..6865f2c 100644 --- a/src/utils/whonix.cpp +++ b/src/utils/whonix.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "whonix.h" @@ -7,4 +7,11 @@ bool WhonixOS::detect() { return !QString::fromLocal8Bit(qgetenv("WHONIX")).isEmpty(); +} + +QString WhonixOS::version() { + if (!Utils::fileExists("/etc/whonix_version")) + return ""; + + return Utils::barrayToString(Utils::fileOpen("/etc/whonix_version")).trimmed(); } \ No newline at end of file diff --git a/src/utils/whonix.h b/src/utils/whonix.h index 3ad06a4..8d923f5 100644 --- a/src/utils/whonix.h +++ b/src/utils/whonix.h @@ -1,13 +1,15 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WHONIX_H -#define FEATHER_WHONIX_H +#ifndef WOWLET_WHONIX_H +#define WOWLET_WHONIX_H +#include struct WhonixOS { static bool detect(); + static QString version(); }; -#endif //FEATHER_WHONIX_H +#endif //WOWLET_WHONIX_H diff --git a/src/utils/wsclient.cpp b/src/utils/wsclient.cpp index 78cac69..3ae1a4d 100644 --- a/src/utils/wsclient.cpp +++ b/src/utils/wsclient.cpp @@ -1,28 +1,25 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include #include #include -#include #include "wsclient.h" #include "appcontext.h" - -WSClient::WSClient(AppContext *ctx, const QUrl &url, QObject *parent) : +WSClient::WSClient(AppContext *ctx, QObject *parent) : QObject(parent), - url(url), m_ctx(ctx) { + // this class connects to `https://git.wownero.com/wowlet/wowlet-backend/` connect(&this->webSocket, &QWebSocket::binaryMessageReceived, this, &WSClient::onbinaryMessageReceived); connect(&this->webSocket, &QWebSocket::connected, this, &WSClient::onConnected); connect(&this->webSocket, &QWebSocket::disconnected, this, &WSClient::closed); connect(&this->webSocket, QOverload::of(&QWebSocket::error), this, &WSClient::onError); - m_tor = url.host().endsWith(".onion"); + m_tor = m_ctx->backendHost.contains(".onion"); - // Keep websocket connection alive + // keep-alive connect(&m_pingTimer, &QTimer::timeout, [this]{ if (this->webSocket.state() == QAbstractSocket::ConnectedState) this->webSocket.ping(); @@ -43,7 +40,7 @@ void WSClient::start() { qDebug() << "WebSocket connect:" << url.url(); #endif if((m_tor && this->m_ctx->tor->torConnected) || !m_tor) - this->webSocket.open(QUrl(this->url)); + this->webSocket.open(QString("%1/ws").arg(m_ctx->backendWSUrl)); if(!this->m_connectionTimer.isActive()) { connect(&this->m_connectionTimer, &QTimer::timeout, this, &WSClient::checkConnection); @@ -80,7 +77,7 @@ void WSClient::onError(QAbstractSocket::SocketError error) { void WSClient::onbinaryMessageReceived(const QByteArray &message) { #ifdef QT_DEBUG - qDebug() << "WebSocket received:" << message; + qDebug() << "WebSocket (client) received:" << message; #endif if (!Utils::validateJSON(message)) { qCritical() << "Could not interpret WebSocket message as JSON"; diff --git a/src/utils/wsclient.h b/src/utils/wsclient.h index 57a9a93..50efa0c 100644 --- a/src/utils/wsclient.h +++ b/src/utils/wsclient.h @@ -1,12 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef ECHOCLIENT_H #define ECHOCLIENT_H -#include +#include #include -#include +#include class AppContext; class WSClient : public QObject @@ -14,11 +14,10 @@ class WSClient : public QObject Q_OBJECT public: - explicit WSClient(AppContext *ctx, const QUrl &url, QObject *parent = nullptr); + explicit WSClient(AppContext *ctx, QObject *parent = nullptr); void start(); void sendMsg(const QByteArray &data); QWebSocket webSocket; - QUrl url; signals: void closed(); diff --git a/src/utils/wsserver.cpp b/src/utils/wsserver.cpp new file mode 100644 index 0000000..9480915 --- /dev/null +++ b/src/utils/wsserver.cpp @@ -0,0 +1,397 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include "QtWebSockets/qwebsocketserver.h" +#include "QtWebSockets/qwebsocket.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include "model/AddressBookModel.h" +#include "model/TransactionHistoryModel.h" +#include "libwalletqt/AddressBook.h" +#include "libwalletqt/TransactionHistory.h" +#include + +#include "wsserver.h" +#include "appcontext.h" +#include "utils/utils.h" + +WSServer::WSServer(AppContext *ctx, const QHostAddress &host, const quint16 port, const QString &password, bool debug, QObject *parent) : + QObject(parent), + m_debug(debug), + m_ctx(ctx), + m_password(password), + m_pWebSocketServer( + new QWebSocketServer(QStringLiteral("WOWlet Daemon WS"), + QWebSocketServer::NonSecureMode, this)) { + if (!m_pWebSocketServer->listen(QHostAddress::Any, port)) + return; + + // turn on auto tx commits + ctx->autoCommitTx = true; + + qDebug() << "websocket server listening on port" << port; + + connect(m_pWebSocketServer, &QWebSocketServer::newConnection, this, &WSServer::onNewConnection); + connect(m_pWebSocketServer, &QWebSocketServer::closed, this, &WSServer::closed); + + connect(m_ctx, &AppContext::walletClosed, this, &WSServer::onWalletClosed); + connect(m_ctx, &AppContext::balanceUpdated, this, &WSServer::onBalanceUpdated); + connect(m_ctx, &AppContext::walletOpened, this, &WSServer::onWalletOpened); + connect(m_ctx, &AppContext::walletOpenedError, this, &WSServer::onWalletOpenedError); + connect(m_ctx, &AppContext::walletCreatedError, this, &WSServer::onWalletCreatedError); + connect(m_ctx, &AppContext::walletCreated, this, &WSServer::onWalletCreated); + connect(m_ctx, &AppContext::synchronized, this, &WSServer::onSynchronized); + connect(m_ctx, &AppContext::blockchainSync, this, &WSServer::onBlockchainSync); + connect(m_ctx, &AppContext::refreshSync, this, &WSServer::onRefreshSync); + connect(m_ctx, &AppContext::createTransactionError, this, &WSServer::onCreateTransactionError); + connect(m_ctx, &AppContext::createTransactionSuccess, this, &WSServer::onCreateTransactionSuccess); + connect(m_ctx, &AppContext::transactionCommitted, this, &WSServer::onTransactionCommitted); + connect(m_ctx, &AppContext::walletOpenPasswordNeeded, this, &WSServer::onWalletOpenPasswordRequired); + connect(m_ctx, &AppContext::initiateTransaction, this, &WSServer::onInitiateTransaction); + + m_walletDir = m_ctx->defaultWalletDir; + + // Bootstrap Tor/websockets + m_ctx->initTor(); + m_ctx->initWS(); +} + +QString WSServer::connectionId(QWebSocket *pSocket) { + return QString("%1#%2").arg(pSocket->peerAddress().toString()).arg(pSocket->peerPort()); +} + +void WSServer::onNewConnection() { + QWebSocket *pSocket = m_pWebSocketServer->nextPendingConnection(); + + connect(pSocket, &QWebSocket::binaryMessageReceived, this, &WSServer::processBinaryMessage); + connect(pSocket, &QWebSocket::disconnected, this, &WSServer::socketDisconnected); + + m_clients << pSocket; + m_clients_auth[this->connectionId(pSocket)] = false; + + // blast wallet listing on connect + QJsonArray arr; + for(const QVariant &wallet: m_ctx->listWallets()) + arr << wallet.value().toJsonObject(); + auto welcomeWalletMessage = WSServer::createWSMessage("walletList", arr); + pSocket->sendBinaryMessage(welcomeWalletMessage); + + // and the current state of appcontext + QJsonObject obj; + + if(this->m_ctx->currentWallet == nullptr) { + obj["state"] = "walletClosed"; + } + else { + obj["state"] = "walletOpened"; + obj["walletPath"] = m_ctx->currentWallet->path(); + } + this->sendAll("state", obj); +} + +void WSServer::processBinaryMessage(QByteArray buffer) { + QWebSocket *pClient = qobject_cast(sender()); + const QString cid = this->connectionId(pClient); + + if (m_debug) + qDebug() << "Websocket (server) received:" << buffer; + if (!pClient) + return; + + QJsonDocument doc = QJsonDocument::fromJson(buffer); + QJsonObject object = doc.object(); + + QString cmd = object.value("cmd").toString(); + + if(m_clients_auth.contains(cid) && !m_clients_auth[cid]) { + if (cmd == "password") { + auto data = object.value("data").toObject(); + auto passwd = data.value("password").toString(); + if(passwd != this->m_password) { + this->sendAll("passwordIncorrect", "authentication failed."); + return; + } else { + this->m_clients_auth[cid] = true; + this->sendAll("passwordSuccess", "authentication OK."); + return; + } + } else { + this->sendAll("passwordIncorrect", "authentication failed."); + return; + } + } + + if(cmd == "openWallet") { + auto data = object.value("data").toObject(); + auto path = data.value("path").toString(); + auto passwd = data.value("password").toString(); + + m_ctx->onOpenWallet(path, passwd); + } else if (cmd == "closeWallet") { + if (m_ctx->currentWallet == nullptr) + return; + + m_ctx->closeWallet(true, true); + } else if(cmd == "addressList") { + auto data = object.value("data").toObject(); + auto accountIndex = data.value("accountIndex").toInt(); + auto addressIndex = data.value("addressIndex").toInt(); + + auto limit = data.value("limit").toInt(50); + auto offset = data.value("offset").toInt(0); + + QJsonArray arr; + for(int i = offset; i != limit; i++) { + arr << m_ctx->currentWallet->address((quint32) accountIndex, (quint32) addressIndex + i); + } + + QJsonObject obj; + obj["accountIndex"] = accountIndex; + obj["addressIndex"] = addressIndex; + obj["offset"] = offset; + obj["limit"] = limit; + obj["addresses"] = arr; + this->sendAll("addressList", arr); + } else if(cmd == "sendTransaction") { + auto data = object.value("data").toObject(); + auto address = data.value("address").toString(); + auto amount = data.value("amount").toDouble(0); + auto description = data.value("description").toString(); + bool all = data.value("all").toBool(false); + + if(!WalletManager::addressValid(address, m_ctx->currentWallet->nettype())){ + this->sendAll("transactionError", "Could not validate address"); + return; + } + + if(amount <= 0) { + this->sendAll("transactionError", "y u send 0"); + return; + } + + m_ctx->onCreateTransaction(address, (quint64) amount, description, all); + } else if(cmd == "createWallet") { + auto data = object.value("data").toObject(); + + auto name = data.value("name").toString(); + auto path = data.value("path").toString(); + auto password = data.value("password").toString(); + QString walletPath; + + if(name.isEmpty()){ + this->sendAll("walletCreatedError", "Supply a name for your wallet"); + return; + } + + if(path.isEmpty()) { + walletPath = QDir(m_walletDir).filePath(name + ".keys"); + if(Utils::fileExists(walletPath)) { + auto err = QString("Filepath already exists: %1").arg(walletPath); + this->sendAll("walletCreatedError", err); + return; + } + } + + WowletSeed seed = WowletSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage); + m_ctx->createWallet(seed, walletPath, password); + } else if(cmd == "transactionHistory") { + m_ctx->currentWallet->history()->refresh(m_ctx->currentWallet->currentSubaddressAccount()); + auto *model = m_ctx->currentWallet->history(); + + QJsonArray arr = model->toJsonArray(); + this->sendAll("transactionHistory", arr); + } else if (cmd == "addressBook") { + QJsonArray arr = m_ctx->currentWallet->addressBookModel()->toJsonArray(); + this->sendAll("addressBook", arr); + } +} + +void WSServer::socketDisconnected() { + QWebSocket *pClient = qobject_cast(sender()); + QString cid = connectionId(pClient); + + m_clients_auth[cid] = false; + + if (m_debug) + qDebug() << "socketDisconnected:" << pClient; + if (pClient) { + m_clients.removeAll(pClient); + pClient->deleteLater(); + } +} + +// templates are forbidden! +QByteArray WSServer::createWSMessage(const QString &cmd, const QJsonArray &arr) { + QJsonObject jsonObject = QJsonObject(); + jsonObject["cmd"] = cmd; + jsonObject["data"] = arr; + QJsonDocument doc = QJsonDocument(jsonObject); + return doc.toJson(QJsonDocument::Compact); +} +QByteArray WSServer::createWSMessage(const QString &cmd, const QJsonObject &obj) { + QJsonObject jsonObject = QJsonObject(); + jsonObject["cmd"] = cmd; + jsonObject["data"] = obj; + QJsonDocument doc = QJsonDocument(jsonObject); + return doc.toJson(QJsonDocument::Compact); +} + +QByteArray WSServer::createWSMessage(const QString &cmd, const int val) { + QJsonObject jsonObject = QJsonObject(); + jsonObject["cmd"] = cmd; + jsonObject["data"] = val; + QJsonDocument doc = QJsonDocument(jsonObject); + return doc.toJson(QJsonDocument::Compact); +} + +QByteArray WSServer::createWSMessage(const QString &cmd, const QString &val) { + QJsonObject jsonObject = QJsonObject(); + jsonObject["cmd"] = cmd; + jsonObject["data"] = val; + QJsonDocument doc = QJsonDocument(jsonObject); + return doc.toJson(QJsonDocument::Compact); +} + +WSServer::~WSServer() { + m_pWebSocketServer->close(); + qDeleteAll(m_clients.begin(), m_clients.end()); +} + +void WSServer::sendAll(const QString &cmd, const QJsonObject &obj) { + for(QWebSocket *pSocket: m_clients) { + pSocket->sendBinaryMessage(WSServer::createWSMessage(cmd, obj)); + } +} + +void WSServer::sendAll(const QString &cmd, const QJsonArray &arr) { + for(QWebSocket *pSocket: m_clients) { + pSocket->sendBinaryMessage(WSServer::createWSMessage(cmd, arr)); + } +} + +void WSServer::sendAll(const QString &cmd, int val) { + for(QWebSocket *pSocket: m_clients) { + pSocket->sendBinaryMessage(WSServer::createWSMessage(cmd, val)); + } +} + +void WSServer::sendAll(const QString &cmd, const QString &val) { + for(QWebSocket *pSocket: m_clients) { + pSocket->sendBinaryMessage(WSServer::createWSMessage(cmd, val)); + } +} + +// ====================================================================== + +void WSServer::onWalletOpened(Wallet *wallet) { + connect(m_ctx->currentWallet, &Wallet::connectionStatusChanged, this, &WSServer::onConnectionStatusChanged); + + auto obj = wallet->toJsonObject(); + sendAll("walletOpened", obj); +} + +void WSServer::onBlockchainSync(int height, int target) { + QJsonObject obj; + obj["height"] = height; + obj["target"] = target; + sendAll("blockchainSync", obj); +} + +void WSServer::onRefreshSync(int height, int target) { + QJsonObject obj; + obj["height"] = height; + obj["target"] = target; + sendAll("refreshSync", obj); +} + +void WSServer::onWalletClosed() { + QJsonObject obj; + sendAll("walletClosed", obj); +} + +void WSServer::onBalanceUpdated(quint64 balance, quint64 spendable) { + QJsonObject obj; + obj["balance"] = balance / globals::cdiv; + obj["spendable"] = spendable / globals::cdiv; + sendAll("balanceUpdated", obj); +} + +void WSServer::onWalletOpenedError(const QString &err) { + sendAll("walletOpenedError", err); +} + +void WSServer::onWalletCreatedError(const QString &err) { + sendAll("walletCreatedError", err); +} + +void WSServer::onWalletCreated(Wallet *wallet) { + auto obj = wallet->toJsonObject(); + sendAll("walletCreated", obj); +} + +void WSServer::onSynchronized() { + QJsonObject obj; + sendAll("synchronized", obj); +} + +void WSServer::onWalletOpenPasswordRequired(bool invalidPassword, const QString &path) { + QJsonObject obj; + obj["invalidPassword"] = invalidPassword; + obj["path"] = path; + sendAll("walletOpenPasswordRequired", obj); +} + +void WSServer::onConnectionStatusChanged(int status) { + sendAll("connectionStatusChanged", status); +} + +void WSServer::onInitiateTransaction() { + QJsonObject obj; + sendAll("transactionStarted", obj); +} + +void WSServer::onCreateTransactionError(const QString &message) { + sendAll("transactionError", message); +} + +void WSServer::onCreateTransactionSuccess(PendingTransaction *tx, const QVector &address) { + +} + +void WSServer::onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList &txid) { + QString preferredCur = config()->get(Config::preferredFiatCurrency).toString(); + + auto convert = [preferredCur](double amount){ + return QString::number(AppContext::prices->convert("WOW", preferredCur, amount), 'f', 2); + }; + + QJsonObject obj; + QJsonArray txids; + + for(const QString &id: txid) + txids << id; + + obj["txid"] = txids; + obj["status"] = status; + obj["amount"] = tx->amount() / globals::cdiv; + obj["fee"] = tx->fee() / globals::cdiv; + obj["total"] = (tx->amount() + tx->fee()) / globals::cdiv; + + obj["amount_fiat"] = convert(tx->amount() / globals::cdiv); + obj["fee_fiat"] = convert(tx->fee() / globals::cdiv); + obj["total_fiat"] = convert((tx->amount() + tx->fee()) / globals::cdiv); + + sendAll("transactionSent", obj); +} \ No newline at end of file diff --git a/src/utils/wsserver.h b/src/utils/wsserver.h new file mode 100644 index 0000000..0a9ad68 --- /dev/null +++ b/src/utils/wsserver.h @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_WSSERVER_H +#define WOWLET_WSSERVER_H + + +#include +#include +#include + +#include "appcontext.h" +#include "utils/keysfiles.h" +#include "qrcode/QrCode.h" + +#include "libwalletqt/WalletManager.h" + +QT_FORWARD_DECLARE_CLASS(QWebSocketServer) +QT_FORWARD_DECLARE_CLASS(QWebSocket) + +class WSServer : public QObject +{ +Q_OBJECT +public: + explicit WSServer(AppContext *ctx, const QHostAddress &host, const quint16 port, const QString &password, bool debug = false, QObject *parent = nullptr); + ~WSServer(); + +signals: + void closed(); + +private slots: + void onNewConnection(); + void processBinaryMessage(QByteArray buffer); + void socketDisconnected(); + + // libwalletqt + void onBalanceUpdated(quint64 balance, quint64 spendable); + void onSynchronized(); + void onWalletOpened(Wallet *wallet); + void onWalletClosed(); + void onConnectionStatusChanged(int status); + void onCreateTransactionError(const QString &message); + void onCreateTransactionSuccess(PendingTransaction *tx, const QVector &address); + void onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid); + void onBlockchainSync(int height, int target); + void onRefreshSync(int height, int target); + void onWalletOpenedError(const QString &err); + void onWalletCreatedError(const QString &err); + void onWalletCreated(Wallet *wallet); + void onWalletOpenPasswordRequired(bool invalidPassword, const QString &path); + void onInitiateTransaction(); + +private: + QWebSocketServer *m_pWebSocketServer; + QList m_clients; + QMap m_clients_auth; + bool m_debug; + QString m_walletDir; + AppContext *m_ctx; + QString m_password; + + QString connectionId(QWebSocket *pSocket); + + QByteArray createWSMessage(const QString &cmd, const QJsonObject &obj); + QByteArray createWSMessage(const QString &cmd, const QJsonArray &arr); + QByteArray createWSMessage(const QString &cmd, const int val); + QByteArray createWSMessage(const QString &cmd, const QString &val); + void sendAll(const QString &cmd, const QJsonArray &arr); + void sendAll(const QString &cmd, const QJsonObject &obj); + void sendAll(const QString &cmd, int val); + void sendAll(const QString &cmd, const QString &val); +}; + +#endif //WOWLET_WSSERVER_H diff --git a/src/utils/xmrig.cpp b/src/utils/xmrig.cpp index de353cc..77e9d44 100644 --- a/src/utils/xmrig.cpp +++ b/src/utils/xmrig.cpp @@ -1,25 +1,30 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include #include #include -#include #include #include "utils/utils.h" #include "utils/xmrig.h" -#include "appcontext.h" +#include "mainwindow.h" -XmRig::XmRig(const QString &configDir, QObject *parent) : QObject(parent) { - this->rigDir = QDir(configDir).filePath("xmrig"); +XmRig::XmRig(const QString &configDir, QObject *parent) : + QObject(parent), + m_statusTimer(new QTimer(this)) +{ + m_statusTimer->setInterval(5000); + connect(m_statusTimer, &QTimer::timeout, [this]{ + if(daemonMiningState == DaemonMiningState::mining && m_process.state() == QProcess::Running) + m_process.write("status\n"); + }); } void XmRig::prepare() { m_process.setProcessChannelMode(QProcess::MergedChannels); - connect(&m_process, &QProcess::readyReadStandardOutput, this, &XmRig::handleProcessOutput); - connect(&m_process, &QProcess::errorOccurred, this, &XmRig::handleProcessError); - connect(&m_process, &QProcess::stateChanged, this, &XmRig::stateChanged); + connect(&m_process, &QProcess::readyReadStandardOutput, this, &XmRig::onHandleProcessOutput); + connect(&m_process, &QProcess::errorOccurred, this, &XmRig::onHandleProcessError); + connect(&m_process, &QProcess::stateChanged, this, &XmRig::onProcessStateChanged); } void XmRig::stop() { @@ -30,74 +35,156 @@ void XmRig::stop() { m_process.terminate(); #endif } + m_statusTimer->stop(); } -void XmRig::start(const QString &path, - int threads, - const QString &address, - const QString &username, - const QString &password, - bool tor, bool tls) { +bool XmRig::start(const QString &path, int threads) { + m_ctx = MainWindow::getContext(); + auto state = m_process.state(); - if (state == QProcess::ProcessState::Running || state == QProcess::ProcessState::Starting) { - emit error("Can't start XMRig, already running or starting"); - return; + if (state == QProcess::ProcessState::Running || + state == QProcess::ProcessState::Starting || + daemonMiningState != DaemonMiningState::idle) { + emit error("Can't start wownerod, already running or starting"); + return false; } if(path.isEmpty()) { - emit error("XmRig->Start path parameter missing."); - return; + emit error("wownerod path seems to be empty. Go to the mining settings tab and point towards the wownerod executable!"); + return false; } if(!Utils::fileExists(path)) { - emit error(QString("Path to XMRig binary invalid; file does not exist: %1").arg(path)); - return; + emit error(QString("Path to wownerod binary is invalid; file does not exist: %1").arg(path)); + return false; } + auto privateSpendKey = m_ctx->currentWallet->getSecretSpendKey(); QStringList arguments; - arguments << "-o" << address; - arguments << "-a" << "rx/0"; - arguments << "-u" << username; - if(!password.isEmpty()) - arguments << "-p" << password; - arguments << "--no-color"; - arguments << "-t" << QString::number(threads); - if(tor) - arguments << "-x" << QString("%1:%2").arg(Tor::torHost).arg(Tor::torPort); - if(tls) - arguments << "--tls"; - arguments << "--donate-level" << "1"; + + // dont exit when binding fails - we dont need + // to bind to any ports when we just want to mine + arguments << "--no-zmq"; + arguments << "--rpc-ignore-ipv4"; + arguments << "--p2p-ignore-ipv4"; + + arguments << "--mining-threads" << QString::number(threads); + arguments << "--start-mining" << m_ctx->currentWallet->address(0, 0); + arguments << "--spendkey" << privateSpendKey; + QString cmd = QString("%1 %2").arg(path, arguments.join(" ")); + cmd = cmd.replace(privateSpendKey, "[redacted]"); emit output(cmd.toUtf8()); + m_process.start(path, arguments); + m_statusTimer->start(); + return true; } -void XmRig::stateChanged(QProcess::ProcessState state) { - if(state == QProcess::ProcessState::Running) - emit output("XMRig started"); - else if (state == QProcess::ProcessState::NotRunning) - emit output("XMRig stopped"); -} - -void XmRig::handleProcessOutput() { - QByteArray _output = m_process.readAllStandardOutput(); - if(_output.contains("miner") && _output.contains("speed")) { - // detect hashrate - auto str = Utils::barrayToString(_output); - auto spl = str.mid(str.indexOf("speed")).split(" "); - auto rate = spl.at(2) + "H/s"; - qDebug() << "mining hashrate: " << rate; - emit hashrate(rate); +void XmRig::onProcessStateChanged(QProcess::ProcessState state) { + if(state == QProcess::ProcessState::Running) { + emit output("wownerod started"); + changeDaemonState(DaemonMiningState::startup); + } + else if (state == QProcess::ProcessState::NotRunning) { + emit output("wownerod stopped"); + changeDaemonState(DaemonMiningState::idle); } - - emit output(_output); } -void XmRig::handleProcessError(QProcess::ProcessError err) { +void XmRig::onHandleProcessOutput() { + QByteArray data = m_process.readAllStandardOutput(); + + for(auto &line: data.split('\n')) { + // remove timestamp + if(line.indexOf("\tI") >= 20) + line = line.remove(0, line.indexOf("\tI") + 2); + line = line.trimmed(); + + // sad attempt at removing ANSI color codes + // yes this is stupid, no i dont care + // works remarkably well so far lmao + auto ansi_start = QByteArray("\x1b\x5b"); + line = line.replace(ansi_start, ""); + line = line.replace("0;36m", ""); + line = line.replace("0;35m", ""); + line = line.replace("0;34m", ""); + line = line.replace("0;33m", ""); + line = line.replace("0;32m", ""); + line = line.replace("1;32m", ""); + line = line.replace("1;33m", ""); + line = line.replace("1;34m", ""); + line = line.replace("1;35m", ""); + line = line.replace("1;36m", ""); + if(line.startsWith("0m")) continue; + + auto lower = line.toLower(); + if(lower.isEmpty() || lower.startsWith("status")) continue; + + // skip ascii/ansi art + unsigned int printable_chars_pct = 100 * Utils::countAlphaNum(lower) / lower.length(); + if(printable_chars_pct < 60) continue; + + if(lower.startsWith("the daemon will start synchronizing")) { + changeDaemonState(DaemonMiningState::startup); + } else if(lower.startsWith("synchronization started")) { + changeDaemonState(DaemonMiningState::syncing); + } else if(lower.startsWith("synced") && lower.contains("left")) { + if(daemonMiningState < DaemonMiningState::syncing) changeDaemonState(DaemonMiningState::syncing); + QRegularExpression re("synced (\\d+)\\/(\\d+) \\((\\d+)%, (\\d+) left"); + + QRegularExpressionMatch match = re.match(lower); + if (match.hasMatch()) { + auto from = match.captured(1); + auto to = match.captured(2); + auto pct = match.captured(3); + m_from = from.toUInt(); + m_to = to.toUInt(); + emit syncStatus(m_from, m_to, pct.toInt()); + } + } else if(lower.contains("mining started. good luck")) { + emit syncStatus(m_to, m_to, 100); + changeDaemonState(DaemonMiningState::mining); + } + else if(lower.contains("you won a block reward")) + emit blockReward(); + else if(lower.contains("mining at")) { + QRegularExpression re("Height\\: (\\d+)\\/(\\d+) \\((.*)\\) on mainnet, mining at (.*), net hash .*, uptime (.*)"); + + QRegularExpressionMatch match = re.match(line); + if (match.hasMatch()) { + m_from = match.captured(1).toUInt(); + m_to = match.captured(2).toUInt(); + unsigned int pct = match.captured(3).replace("%", "").toDouble(); + auto rate = match.captured(4); + auto uptime = match.captured(5).replace(" ", ""); + + emit uptimeChanged(uptime); + emit syncStatus(m_to, m_to, pct); + emit hashrate(rate); + + line = line.remove(0, line.indexOf("mining at")); + } + } + + emit output(line.trimmed()); + } +} + +void XmRig::changeDaemonState(const DaemonMiningState state) { + if(daemonMiningState == state) return; + + daemonMiningState = state; + emit daemonStateChanged(daemonMiningState); +} + +void XmRig::onHandleProcessError(QProcess::ProcessError err) { if (err == QProcess::ProcessError::Crashed) - emit error("XMRig crashed or killed"); + emit error("wownerod crashed or killed"); else if (err == QProcess::ProcessError::FailedToStart) { - auto path = config()->get(Config::xmrigPath).toString(); - emit error(QString("XMRig binary failed to start: %1").arg(path)); + auto path = config()->get(Config::wownerodPath).toString(); + emit error(QString("wownerod binary failed to start: %1").arg(path)); } + + changeDaemonState(DaemonMiningState::idle); } diff --git a/src/utils/xmrig.h b/src/utils/xmrig.h index 34ad6cf..0c01b1d 100644 --- a/src/utils/xmrig.h +++ b/src/utils/xmrig.h @@ -1,13 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_XMRIG_H -#define FEATHER_XMRIG_H +#ifndef WOWLET_XMRIG_H +#define WOWLET_XMRIG_H #include #include #include -#include #include #include #include @@ -15,6 +14,14 @@ #include "utils/childproc.h" +enum DaemonMiningState { + idle = 0, + startup, + syncing, + mining +}; + +class AppContext; class XmRig : public QObject { Q_OBJECT @@ -23,25 +30,33 @@ public: explicit XmRig(const QString &configDir, QObject *parent = nullptr); void prepare(); - void start(const QString &path, int threads, const QString &address, const QString &username, const QString &password, bool tor = false, bool tls = true); + bool start(const QString &path, int threads); void stop(); - bool unpackBins(); - QString rigDir; - QString rigPath; + DaemonMiningState daemonMiningState = DaemonMiningState::idle; signals: void error(const QString &msg); void output(const QByteArray &data); + void blockReward(); + void syncStatus(unsigned int from, unsigned int to, unsigned int pct); void hashrate(const QString &rate); + void daemonStateChanged(DaemonMiningState state); + void uptimeChanged(QString &uptime); private slots: - void stateChanged(QProcess::ProcessState); - void handleProcessOutput(); - void handleProcessError(QProcess::ProcessError error); + void onProcessStateChanged(QProcess::ProcessState); + void onHandleProcessOutput(); + void onHandleProcessError(QProcess::ProcessError error); private: + void changeDaemonState(DaemonMiningState state); + ChildProcess m_process; + AppContext *m_ctx; + QTimer *m_statusTimer; + unsigned int m_to; + unsigned int m_from; }; -#endif //FEATHER_XMRIG_H +#endif //WOWLET_XMRIG_H diff --git a/src/utils/xmrto.cpp b/src/utils/xmrto.cpp deleted file mode 100644 index 11d467c..0000000 --- a/src/utils/xmrto.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "xmrto.h" - -#include "utils/xmrtoorder.h" -#include "appcontext.h" - -QMap XmrTo::stateMap; - -XmrTo::XmrTo(AppContext *ctx, QObject *parent) : - QObject(parent), - m_ctx(ctx) { - - m_baseUrl = m_ctx->networkType == NetworkType::Type::MAINNET ? "https://xmr.to" : "https://test.xmr.to"; - - m_netTor = new UtilsNetworking(this->m_ctx->network); - m_netClear = new UtilsNetworking(this->m_ctx->networkClearnet); - - m_apiTor = new XmrToApi(this, m_netTor, m_baseUrl); - m_apiClear = new XmrToApi(this, m_netClear, m_baseUrl); - - connect(m_apiTor, &XmrToApi::ApiResponse, this, &XmrTo::onApiResponse); - connect(m_apiClear, &XmrToApi::ApiResponse, this, &XmrTo::onApiResponse); - - connect(this, &XmrTo::orderPaymentRequired, this->m_ctx, QOverload::of(&AppContext::onCreateTransaction)); - - XmrTo::stateMap[OrderState::Status_Idle] = "IDLE"; - XmrTo::stateMap[OrderState::Status_OrderCreating] = "CREATING"; - XmrTo::stateMap[OrderState::Status_OrderUnpaid] = "UNPAID"; - XmrTo::stateMap[OrderState::Status_OrderToBeCreated] = "TO_BE_CREATED"; - XmrTo::stateMap[OrderState::Status_OrderUnderPaid] = "UNDERPAID"; - XmrTo::stateMap[OrderState::Status_OrderPaidUnconfirmed] = "PAID_UNCONFIRMED"; - XmrTo::stateMap[OrderState::Status_OrderPaid] = "PAID"; - XmrTo::stateMap[OrderState::Status_OrderBTCSent] = "BTC_SENT"; - XmrTo::stateMap[OrderState::Status_OrderTimedOut] = "TIMED_OUT"; - XmrTo::stateMap[OrderState::Status_OrderFailed] = "FAILED"; - XmrTo::stateMap[OrderState::Status_OrderXMRSent] = "XMR_SENT"; - - this->tableModel = new XmrToModel(&this->orders, this); -} - -void XmrTo::createOrder(double amount, const QString ¤cy, const QString &btcAddress) { - // ^[13][a-km-zA-HJ-NP-Z0-9]{26,33}$ - - XmrToOrder *order; - order = new XmrToOrder(this->m_ctx, m_netTor, m_baseUrl, false, &this->rates, this); - - connect(order, &XmrToOrder::orderFailed, this, &XmrTo::orderFailed); - connect(order, &XmrToOrder::orderPaid, this, &XmrTo::orderPaid); - connect(order, &XmrToOrder::orderPaidUnconfirmed, this, &XmrTo::orderPaidUnconfirmed); - connect(order, &XmrToOrder::orderPaymentRequired, this, &XmrTo::orderPaymentRequired); - connect(order, &XmrToOrder::orderChanged, this->tableModel, &XmrToModel::update); - - order->create(amount, currency, btcAddress); - this->orders.append(order); - tableModel->update(); -} - - -void XmrTo::onApiResponse(const XmrToResponse &resp) { - if (!resp.ok) { - this->onApiFailure(resp); - return; - } - - emit connectionSuccess(); - if (resp.endpoint == Endpoint::RATES) { - onRatesReceived(resp.obj); - } -} - -void XmrTo::onApiFailure(const XmrToResponse &resp) { - emit connectionError(resp.message); -} - -void XmrTo::onGetRates() { - m_apiTor->getRates(); -} - -void XmrTo::onRatesReceived(const QJsonObject &doc) { - this->rates.price = doc.value("price").toString().toDouble(); - this->rates.ln_lower_limit = doc.value("ln_lower_limit").toString().toDouble(); - this->rates.ln_upper_limit = doc.value("ln_upper_limit").toString().toDouble(); - this->rates.lower_limit = doc.value("lower_limit").toString().toDouble(); - this->rates.upper_limit = doc.value("upper_limit").toString().toDouble(); - this->rates.zero_conf_enabled = doc.value("zero_conf_enabled").toBool(); - this->rates.zero_conf_max_amount = doc.value("zero_conf_enabled").toString().toDouble(); - emit ratesUpdated(rates); -} - -void XmrTo::onNetworkChanged(bool clearnet) { - m_api = clearnet ? m_apiClear : m_apiTor; -} - -void XmrTo::onWalletClosed() { - // @TODO: cleanup - for(const auto &order: this->orders) - order->deleteLater(); - - this->tableModel->update(); -} - -void XmrTo::onWalletOpened() { - // @TODO: read past XMR.To orders, start pending ones -} - -void XmrTo::onViewOrder(const QString &orderId) { - QString url = QString("%1/nojs/status/%2").arg(this->m_baseUrl).arg(orderId); - emit openURL(url); -} diff --git a/src/utils/xmrto.h b/src/utils/xmrto.h deleted file mode 100644 index dcd7389..0000000 --- a/src/utils/xmrto.h +++ /dev/null @@ -1,63 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_XMRTOCONVERT_H -#define FEATHER_XMRTOCONVERT_H - -#include - -#include "model/XmrToModel.h" -#include "utils/xmrtoorder.h" -#include "utils/xmrtoapi.h" - -class AppContext; -class XmrTo: public QObject { - Q_OBJECT - -public: - explicit XmrTo(AppContext *ctx, QObject *parent = nullptr); - Q_ENUM(OrderState); - - XmrToModel *tableModel; - static QMap stateMap; - XmrToRates rates; - QList orders; - -public slots: - void createOrder(double amount, const QString ¤cy, const QString &btcAddress); - void onGetRates(); - void onRatesReceived(const QJsonObject &doc); - void onViewOrder(const QString &orderId); - void onNetworkChanged(bool clearnet); - void onWalletOpened(); - void onWalletClosed(); - -private slots: - void onApiResponse(const XmrToResponse &doc); - -signals: - void orderPaymentRequired(XmrToOrder *order); - void orderPaidUnconfirmed(XmrToOrder *order); - void orderPaid(XmrToOrder *order); - void orderFailed(XmrToOrder *order); - void ratesUpdated(XmrToRates rates); - void openURL(const QString &url); - void connectionError(const QString &err); - void connectionSuccess(); - -private: - void onApiFailure(const XmrToResponse &doc); - - QString m_baseUrl; - AppContext *m_ctx; - int m_orderTimeout = 900; // https://xmrto-api.readthedocs.io/en/latest/introduction.html#various-parameters - - UtilsNetworking *m_netTor; - UtilsNetworking *m_netClear; - - XmrToApi *m_api; - XmrToApi *m_apiTor; - XmrToApi *m_apiClear; -}; - -#endif //FEATHER_XMRTOCONVERT_H diff --git a/src/utils/xmrtoapi.cpp b/src/utils/xmrtoapi.cpp deleted file mode 100644 index 83c4808..0000000 --- a/src/utils/xmrtoapi.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "xmrtoapi.h" - -#include - -XmrToApi::XmrToApi(QObject *parent, UtilsNetworking *network, QString baseUrl) - : QObject(parent) - , m_network(network) - , m_baseUrl(std::move(baseUrl)) -{ -} - -void XmrToApi::getRates() { - QString url = QString("%1/api/v3/xmr2btc/order_parameter_query/").arg(this->m_baseUrl); - QNetworkReply *reply = m_network->getJson(url); - connect(reply, &QNetworkReply::finished, std::bind(&XmrToApi::onResponse, this, reply, Endpoint::RATES)); -} - -void XmrToApi::createOrder(double amount, const QString &amount_currency, const QString &dest_address) { - QJsonObject order; - order["amount"] = amount; - order["amount_currency"] = amount_currency; - order["btc_dest_address"] = dest_address; - - QString url = QString("%1/api/v3/xmr2btc/order_create/").arg(m_baseUrl); - QNetworkReply *reply = m_network->postJson(url, order); - connect(reply, &QNetworkReply::finished, std::bind(&XmrToApi::onResponse, this, reply, Endpoint::ORDER_CREATE)); -} - -void XmrToApi::getOrderStatus(const QString &uuid) { - QJsonObject order; - order["uuid"] = uuid; - - QString url = QString("%1/api/v3/xmr2btc/order_status_query/").arg(m_baseUrl); - QNetworkReply *reply = m_network->postJson(url, order); - connect(reply, &QNetworkReply::finished, std::bind(&XmrToApi::onResponse, this, reply, Endpoint::ORDER_STATUS)); -} - -void XmrToApi::onResponse(QNetworkReply *reply, Endpoint endpoint) { - const auto ok = reply->error() == QNetworkReply::NoError; - const auto err = reply->errorString(); - - QByteArray data = reply->readAll(); - QJsonObject obj; - if (!data.isEmpty() && Utils::validateJSON(data)) { - auto doc = QJsonDocument::fromJson(data); - obj = doc.object(); - } - else if (!ok) { - emit ApiResponse(XmrToResponse(false, endpoint, err)); - return; - } - else { - emit ApiResponse(XmrToResponse(false, endpoint, "Invalid response from XMR.to")); - return; - } - - XmrToError xmrto_err = XmrToApi::getApiError(obj); - if (!xmrto_err.code.isEmpty()) { - emit ApiResponse(XmrToResponse(false, endpoint, m_errorMap.contains(xmrto_err.code) ? m_errorMap[xmrto_err.code] : "", xmrto_err)); - return; - } - - reply->deleteLater(); - emit ApiResponse(XmrToResponse(true, endpoint, "", obj)); -} - -XmrToError XmrToApi::getApiError(const QJsonObject &obj) { - if (!obj.contains("error")) - return XmrToError(); - - QString code = obj.value("error").toString(); - QString msg = obj.value("error_msg").toString(); - - return XmrToError(code, msg); -} diff --git a/src/utils/xmrtoapi.h b/src/utils/xmrtoapi.h deleted file mode 100644 index 1fa983a..0000000 --- a/src/utils/xmrtoapi.h +++ /dev/null @@ -1,87 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_XMRTOAPI_H -#define FEATHER_XMRTOAPI_H - -#include -#include - -#include "utils/networking.h" - -enum Endpoint { - RATES = 0, - ORDER_CREATE, - ORDER_STATUS -}; - -struct XmrToError { - explicit XmrToError(QString code = "", QString msg = "") - : code(std::move(code)), msg(std::move(msg)) {}; - - QString code; - QString msg; -}; - -struct XmrToResponse { - explicit XmrToResponse(bool ok, Endpoint endpoint, QString message, XmrToError error = XmrToError(), QJsonObject obj = {}) - : ok(ok), endpoint(endpoint), message(std::move(message)), error(std::move(error)), obj(std::move(obj)) {}; - - explicit XmrToResponse(bool ok, Endpoint endpoint, QString message, QJsonObject obj) - : ok(ok), endpoint(endpoint), message(std::move(message)), obj(std::move(obj)) {}; - - bool ok; - Endpoint endpoint; - QString message; - XmrToError error = XmrToError(); - QJsonObject obj; -}; - -class XmrToApi : public QObject { - Q_OBJECT - -public: - explicit XmrToApi(QObject *parent, UtilsNetworking *network, QString baseUrl = "https://xmr.to"); - - void getRates(); - void createOrder(double amount, const QString &amount_currency, const QString &dest_address); - void getOrderStatus(const QString &uuid); - -signals: - void ApiResponse(XmrToResponse resp); - -private slots: - void onResponse(QNetworkReply *reply, Endpoint endpoint); - -private: - static XmrToError getApiError(const QJsonObject &obj); - - QString m_baseUrl; - UtilsNetworking *m_network; - - // https://xmrto-api.readthedocs.io/en/latest/introduction.html#list-of-all-error-codes - const QMap m_errorMap = { - {"XMRTO-ERROR-001", "internal services not available, try again later."}, - {"XMRTO-ERROR-002", "malformed bitcoin address, check address validity."}, - {"XMRTO-ERROR-003", "invalid bitcoin amount, check amount data type."}, - {"XMRTO-ERROR-004", "bitcoin amount out of bounds, check min and max amount."}, - {"XMRTO-ERROR-005", "unexpected validation error, contact support."}, - {"XMRTO-ERROR-006", "requested order not found, check order UUID."}, - {"XMRTO-ERROR-007", "third party service not available, try again later."}, - {"XMRTO-ERROR-008", "insufficient funds available, try again later."}, - {"XMRTO-ERROR-009", "invalid request, check request parameters."}, - {"XMRTO-ERROR-010", "payment protocol failed, invalid or outdated data served by URL."}, - {"XMRTO-ERROR-011", "malformed payment protocol url, URL is malformed or cannot be contacted."}, - {"XMRTO-ERROR-012", "too many requests, try less often."}, - {"XMRTO-ERROR-013", "access forbidden."}, - {"XMRTO-ERROR-014", "service is not available in your region."}, - {"XMRTO-ERROR-015", "invalid monero amount, check amount data type."}, - {"XMRTO-ERROR-016", "invalid currency, check available currency options."}, - {"XMRTO-ERROR-017", "malformed lightning network invoice, provide a correct invoice for the main network."}, - {"XMRTO-ERROR-018", "lightning payment unlikely to succeed, check first if xmr.to has routes available."}, - {"XMRTO-ERROR-019", "lightning invoice preimage already known, don’t use the same invoice more than once."} - }; -}; - - -#endif //FEATHER_XMRTOAPI_H diff --git a/src/utils/xmrtoorder.cpp b/src/utils/xmrtoorder.cpp deleted file mode 100644 index 6adef58..0000000 --- a/src/utils/xmrtoorder.cpp +++ /dev/null @@ -1,277 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "xmrtoorder.h" - -#include - -#include "libwalletqt/Wallet.h" -#include "appcontext.h" -#include "globals.h" -#include "utils/xmrto.h" - -XmrToOrder::XmrToOrder(AppContext *ctx, UtilsNetworking *network, QString baseUrl, bool clearnet, XmrToRates *rates, QObject *parent) : - QObject(parent), - m_ctx(ctx), - m_network(network), - m_baseUrl(std::move(baseUrl)), - m_rates(rates), - m_clearnet(clearnet) { - this->state = OrderState::Status_Idle; - - m_baseUrl = m_ctx->networkType == NetworkType::Type::MAINNET ? "https://xmr.to" : "https://test.xmr.to"; - m_api = new XmrToApi(this, network, m_baseUrl); - - connect(m_api, &XmrToApi::ApiResponse, this, &XmrToOrder::onApiResponse); - connect(m_ctx, &AppContext::transactionCommitted, this, &XmrToOrder::onTransactionCommitted); - connect(m_ctx, &AppContext::createTransactionCancelled, this, &XmrToOrder::onTransactionCancelled); -} - -void XmrToOrder::onTransactionCancelled(const QString &address, double amount) { - // listener for all cancelled transactions - will try to match the exact amount to this order. - if(this->incoming_amount_total != amount || this->receiving_subaddress != address) return; - - this->errorMsg = "TX cancelled by user"; - this->changeState(OrderState::Status_OrderFailed); - this->stop(); -} - -void XmrToOrder::onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid) { - // listener for all outgoing transactions - will try to match the exact amount to this order. - if(this->state == OrderState::Status_OrderUnpaid){ - if(tx->amount() / globals::cdiv == this->incoming_amount_total) { - if(!status) { - this->errorMsg = "TX failed to commit"; - this->changeState(OrderState::Status_OrderFailed); - this->stop(); - return; - } - - this->xmr_txid = txid.at(0); - this->m_paymentSent = true; - this->changeState(OrderState::Status_OrderXMRSent); - } - } -} - -void XmrToOrder::onApiFailure(const XmrToResponse &resp) { - this->errorCode = resp.error.code; - this->errorMsg = resp.message; - - switch (resp.endpoint) { - case ORDER_CREATE: - this->onCreatedError(); - break; - case ORDER_STATUS: - this->onCheckedError(resp.error); - break; - default: - return; - } -} - -void XmrToOrder::onApiResponse(const XmrToResponse& resp) { - if (!resp.ok) { - this->onApiFailure(resp); - return; - } - - switch (resp.endpoint) { - case ORDER_CREATE: - this->onCreated(resp.obj); - break; - case ORDER_STATUS: - this->onChecked(resp.obj); - break; - default: - return; - } -} - -void XmrToOrder::create(double amount, const QString ¤cy, const QString &btcAddress) { - if(this->m_ctx->currentWallet == nullptr) { - this->errorMsg = "No wallet opened"; - this->changeState(OrderState::Status_OrderFailed); - return; - } - - m_api->createOrder(amount, currency, btcAddress); - this->changeState(OrderState::Status_OrderCreating); -} - -void XmrToOrder::onCreatedError() { - this->changeState(OrderState::Status_OrderFailed); -} - -void XmrToOrder::onCreated(const QJsonObject &object) { - if(!object.contains("state")) - this->errorMsg = "Could not parse 'state' from JSON response"; - if(object.value("state").toString() != "TO_BE_CREATED") - this->errorMsg = "unknown state from response, should be \"TO_BE_CREATED\""; - - if(!this->errorMsg.isEmpty()) { - this->changeState(OrderState::Status_OrderFailed); - return; - } - - if(m_created) return; - m_created = true; - this->btc_amount = object.value("btc_amount").toDouble(); - this->btc_dest_address = object.value("btc_dest_address").toString(); - this->uses_lightning = object.value("uses_lightning").toBool(); - this->uuid = object.value("uuid").toString(); - m_checkTimer.start(1000*5); - m_countdownTimer.start(1000); - connect(&m_checkTimer, &QTimer::timeout, this, &XmrToOrder::check); - connect(&m_countdownTimer, &QTimer::timeout, this, &XmrToOrder::onCountdown); - - this->changeState(OrderState::Status_OrderToBeCreated); - this->check(); -} - -void XmrToOrder::check() { - if(this->m_ctx->currentWallet == nullptr) - return; - - m_api->getOrderStatus(this->uuid); -} - -void XmrToOrder::onCheckedError(const XmrToError& err) { - if (!err.code.isEmpty()) - this->changeState(OrderState::Status_OrderFailed); - - m_checkFailures += 1; - if(m_checkFailures > 15){ - this->errorMsg = "Too many failed attempts"; - this->changeState(OrderState::Status_OrderFailed); - } -} - -void XmrToOrder::onChecked(const QJsonObject &object) { - if(object.contains("btc_amount")) - this->btc_amount = object.value("btc_amount").toString().toDouble(); - if(object.contains("btc_dest_address")) - this->btc_dest_address = object.value("btc_dest_address").toString(); - if(object.contains("seconds_till_timeout")) { - this->seconds_till_timeout = object.value("seconds_till_timeout").toInt(); - this->countdown = this->seconds_till_timeout; - } - if(object.contains("created_at")) - this->created_at = object.value("created_at").toString(); - if(object.contains("expires_at")) - this->expires_at = object.value("expires_at").toString(); - if(object.contains("incoming_amount_total")) - this->incoming_amount_total = object.value("incoming_amount_total").toString().toDouble(); - if(object.contains("remaining_amount_incoming")) - this->remaining_amount_incoming = object.value("remaining_amount_incoming").toString().toDouble(); - if(object.contains("incoming_price_btc")) - { - qDebug() << object.value("incoming_price_btc").toString(); - this->incoming_price_btc = object.value("incoming_price_btc").toString().toDouble(); - } - if(object.contains("receiving_subaddress")) - this->receiving_subaddress = object.value("receiving_subaddress").toString(); - - if(object.contains("payments")) { - // detect btc txid, xmr.to api can output several - we'll just grab the first #yolo - auto payments = object.value("payments").toArray(); - for(const auto &payment: payments){ - auto obj = payment.toObject(); - if(obj.contains("tx_id")) { - this->btc_txid = obj.value("tx_id").toString(); - break; - } - } - } - - this->changeState(object.value("state").toString()); -} - -void XmrToOrder::changeState(const QString &_state) { - for(const auto &key: XmrTo::stateMap.keys()) { - const auto &val = XmrTo::stateMap[key]; - if(_state == val){ - this->changeState(key); - return; - } - } -} - -void XmrToOrder::changeState(OrderState _state) { - if(this->m_ctx->currentWallet == nullptr) - return; - - if(_state == OrderState::Status_OrderUnderPaid && m_paymentSent) { - this->state = OrderState::Status_OrderXMRSent; - emit orderChanged(); - return; - } - - if(_state == this->state) return; - switch(_state){ - case OrderState::Status_Idle: - break; - case OrderState::Status_OrderCreating: - break; - case OrderState::Status_OrderToBeCreated: - break; - case OrderState::Status_OrderUnderPaid: - emit orderFailed(this); - this->stop(); - break; - case OrderState::Status_OrderUnpaid: - // need to send Monero - if(!m_paymentRequested) { - auto unlocked_balance = m_ctx->currentWallet->unlockedBalance() / globals::cdiv; - if (this->incoming_amount_total >= unlocked_balance) { - this->state = OrderState::Status_OrderFailed; - emit orderFailed(this); - this->stop(); - break; - } - m_paymentRequested = true; - emit orderPaymentRequired(this); - } - break; - case OrderState::Status_OrderFailed: - emit orderFailed(this); - this->stop(); - break; - case OrderState::Status_OrderPaidUnconfirmed: - emit orderPaidUnconfirmed(this); - break; - case OrderState::Status_OrderPaid: - emit orderPaid(this); - break; - case OrderState::Status_OrderTimedOut: - emit orderFailed(this); - this->stop(); - break; - case OrderState::Status_OrderBTCSent: - emit orderPaid(this); - this->stop(); - break; - default: - break; - } - - this->state = _state; - emit orderChanged(); -} - -void XmrToOrder::onCountdown() { - if(this->countdown <= 0) return; - this->countdown -= 1; - emit orderChanged(); -} - -void XmrToOrder::stop(){ - this->m_checkTimer.stop(); - this->m_countdownTimer.stop(); -} - -XmrToOrder::~XmrToOrder(){ - this->stop(); - this->disconnect(); - this->m_network->deleteLater(); -} \ No newline at end of file diff --git a/src/utils/xmrtoorder.h b/src/utils/xmrtoorder.h deleted file mode 100644 index c05c71d..0000000 --- a/src/utils/xmrtoorder.h +++ /dev/null @@ -1,106 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef FEATHER_XMRTOORDER_H -#define FEATHER_XMRTOORDER_H - -#include - -#include "utils/networking.h" -#include "PendingTransaction.h" -#include "utils/xmrtoapi.h" - -enum OrderState { - Status_Idle, - Status_OrderCreating, - Status_OrderToBeCreated, - Status_OrderUnpaid, - Status_OrderXMRSent, - Status_OrderUnderPaid, - Status_OrderPaidUnconfirmed, - Status_OrderPaid, - Status_OrderBTCSent, - Status_OrderTimedOut, - Status_OrderFailed -}; - -struct XmrToRates { - double price; - double upper_limit; - double lower_limit; - double ln_upper_limit; - double ln_lower_limit; - double zero_conf_max_amount; - bool zero_conf_enabled; -}; - -class XmrToOrder : public QObject { - Q_OBJECT - -public: - explicit XmrToOrder(AppContext *ctx, UtilsNetworking *network, QString baseUrl, bool clearnet, XmrToRates *rates, QObject *parent = nullptr); - void create(double btcAmount, const QString ¤cy, const QString &btcAddress); - void changeState(OrderState state); - void changeState(const QString &state); - void stop(); - - int state; - int countdown = -1; // seconds remaining calculated from `seconds_till_timeout` - QString uuid; - QString errorMsg; - QString errorCode; - - double btc_amount = 0; - QString btc_dest_address; - QString btc_txid; - QString xmr_txid; - bool uses_lightning = false; - - QString receiving_subaddress; - QString created_at; - QString expires_at; - int seconds_till_timeout = -1; - double incoming_amount_total = 0; // amount_in_incoming_currency_for_this_order_as_string - double remaining_amount_incoming; // amount_in_incoming_currency_that_the_user_must_still_send_as_string - double incoming_price_btc = 0; // price_of_1_incoming_in_btc_currency_as_offered_by_service - -public slots: - void onCountdown(); - void onTransactionCancelled(const QString &address, double amount); - void onTransactionCommitted(bool status, PendingTransaction *tx, const QStringList& txid); - - void onCreatedError(); - void onChecked(const QJsonObject &object); - void onCheckedError(const XmrToError& err); - void check(); - -private: - bool m_created = false; - QString m_baseUrl; - QTimer m_checkTimer; - QTimer m_countdownTimer; - int m_checkFailures = 0; - bool m_clearnet; - bool m_paymentSent = false; - bool m_paymentRequested = false; - UtilsNetworking *m_network; - AppContext *m_ctx; - XmrToRates *m_rates; - XmrToApi *m_api; - - ~XmrToOrder(); - -signals: - void orderChanged(); - void orderPaymentRequired(XmrToOrder *order); - void orderPaid(XmrToOrder *order); - void orderPaidUnconfirmed(XmrToOrder *order); - void orderFailed(XmrToOrder *order); - -private slots: - void onCreated(const QJsonObject &object); - void onApiFailure(const XmrToResponse &resp); - void onApiResponse(const XmrToResponse &resp); -}; - -#endif //FEATHER_XMRTOORDER_H diff --git a/src/vr/assets/img/alarm/alarm_activated.png b/src/vr/assets/img/alarm/alarm_activated.png new file mode 100755 index 0000000..58bcc95 Binary files /dev/null and b/src/vr/assets/img/alarm/alarm_activated.png differ diff --git a/src/vr/assets/img/audio/media_keys/outline_play_pause_white_24dp.svg b/src/vr/assets/img/audio/media_keys/outline_play_pause_white_24dp.svg new file mode 100755 index 0000000..03a3ca1 --- /dev/null +++ b/src/vr/assets/img/audio/media_keys/outline_play_pause_white_24dp.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/src/vr/assets/img/audio/media_keys/outline_skip_next_white_24dp.svg b/src/vr/assets/img/audio/media_keys/outline_skip_next_white_24dp.svg new file mode 100755 index 0000000..23fa6ea --- /dev/null +++ b/src/vr/assets/img/audio/media_keys/outline_skip_next_white_24dp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/audio/media_keys/outline_skip_previous_white_24dp.svg b/src/vr/assets/img/audio/media_keys/outline_skip_previous_white_24dp.svg new file mode 100755 index 0000000..1d08e59 --- /dev/null +++ b/src/vr/assets/img/audio/media_keys/outline_skip_previous_white_24dp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/audio/media_keys/outline_stop_white_24dp.svg b/src/vr/assets/img/audio/media_keys/outline_stop_white_24dp.svg new file mode 100755 index 0000000..2123cee --- /dev/null +++ b/src/vr/assets/img/audio/media_keys/outline_stop_white_24dp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/audio/microphone/mic_off.svg b/src/vr/assets/img/audio/microphone/mic_off.svg new file mode 100755 index 0000000..a03af97 --- /dev/null +++ b/src/vr/assets/img/audio/microphone/mic_off.svg @@ -0,0 +1,75 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/audio/microphone/mic_on.svg b/src/vr/assets/img/audio/microphone/mic_on.svg new file mode 100755 index 0000000..7c32e56 --- /dev/null +++ b/src/vr/assets/img/audio/microphone/mic_on.svg @@ -0,0 +1,70 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/audio/microphone/ptm_notification.png b/src/vr/assets/img/audio/microphone/ptm_notification.png new file mode 100755 index 0000000..3bfa181 Binary files /dev/null and b/src/vr/assets/img/audio/microphone/ptm_notification.png differ diff --git a/src/vr/assets/img/audio/microphone/ptt_notification.png b/src/vr/assets/img/audio/microphone/ptt_notification.png new file mode 100755 index 0000000..cf8d3f9 Binary files /dev/null and b/src/vr/assets/img/audio/microphone/ptt_notification.png differ diff --git a/src/vr/assets/img/audio/microphone/ptt_notification.svg b/src/vr/assets/img/audio/microphone/ptt_notification.svg new file mode 100755 index 0000000..a3a96d3 --- /dev/null +++ b/src/vr/assets/img/audio/microphone/ptt_notification.svg @@ -0,0 +1,85 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/audio/speaker/speaker_off.svg b/src/vr/assets/img/audio/speaker/speaker_off.svg new file mode 100755 index 0000000..585c36d --- /dev/null +++ b/src/vr/assets/img/audio/speaker/speaker_off.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/audio/speaker/speaker_on.svg b/src/vr/assets/img/audio/speaker/speaker_on.svg new file mode 100755 index 0000000..f0353d8 --- /dev/null +++ b/src/vr/assets/img/audio/speaker/speaker_on.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/battery/battery_0.png b/src/vr/assets/img/battery/battery_0.png new file mode 100755 index 0000000..1b97fea Binary files /dev/null and b/src/vr/assets/img/battery/battery_0.png differ diff --git a/src/vr/assets/img/battery/battery_1.png b/src/vr/assets/img/battery/battery_1.png new file mode 100755 index 0000000..190004a Binary files /dev/null and b/src/vr/assets/img/battery/battery_1.png differ diff --git a/src/vr/assets/img/battery/battery_2.png b/src/vr/assets/img/battery/battery_2.png new file mode 100755 index 0000000..abf2625 Binary files /dev/null and b/src/vr/assets/img/battery/battery_2.png differ diff --git a/src/vr/assets/img/battery/battery_3.png b/src/vr/assets/img/battery/battery_3.png new file mode 100755 index 0000000..9e0a8c6 Binary files /dev/null and b/src/vr/assets/img/battery/battery_3.png differ diff --git a/src/vr/assets/img/battery/battery_4.png b/src/vr/assets/img/battery/battery_4.png new file mode 100755 index 0000000..2fd59c3 Binary files /dev/null and b/src/vr/assets/img/battery/battery_4.png differ diff --git a/src/vr/assets/img/battery/battery_5.png b/src/vr/assets/img/battery/battery_5.png new file mode 100755 index 0000000..916fa2d Binary files /dev/null and b/src/vr/assets/img/battery/battery_5.png differ diff --git a/src/vr/assets/img/chaperone/centermark.png b/src/vr/assets/img/chaperone/centermark.png new file mode 100755 index 0000000..44ddeab Binary files /dev/null and b/src/vr/assets/img/chaperone/centermark.png differ diff --git a/src/vr/assets/img/chaperone/centermarkl1.png b/src/vr/assets/img/chaperone/centermarkl1.png new file mode 100755 index 0000000..88d99f0 Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkl1.png differ diff --git a/src/vr/assets/img/chaperone/centermarkl2.png b/src/vr/assets/img/chaperone/centermarkl2.png new file mode 100755 index 0000000..0b6e4df Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkl2.png differ diff --git a/src/vr/assets/img/chaperone/centermarkl3.png b/src/vr/assets/img/chaperone/centermarkl3.png new file mode 100755 index 0000000..f554af6 Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkl3.png differ diff --git a/src/vr/assets/img/chaperone/centermarkr1.png b/src/vr/assets/img/chaperone/centermarkr1.png new file mode 100755 index 0000000..4ab9f37 Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkr1.png differ diff --git a/src/vr/assets/img/chaperone/centermarkr2.png b/src/vr/assets/img/chaperone/centermarkr2.png new file mode 100755 index 0000000..5a2849c Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkr2.png differ diff --git a/src/vr/assets/img/chaperone/centermarkr3.png b/src/vr/assets/img/chaperone/centermarkr3.png new file mode 100755 index 0000000..1d6865c Binary files /dev/null and b/src/vr/assets/img/chaperone/centermarkr3.png differ diff --git a/src/vr/assets/img/chest.png b/src/vr/assets/img/chest.png new file mode 100644 index 0000000..675161b Binary files /dev/null and b/src/vr/assets/img/chest.png differ diff --git a/src/vr/assets/img/common/backarrow.svg b/src/vr/assets/img/common/backarrow.svg new file mode 100755 index 0000000..6e08dbe --- /dev/null +++ b/src/vr/assets/img/common/backarrow.svg @@ -0,0 +1,76 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/common/check.svg b/src/vr/assets/img/common/check.svg new file mode 100755 index 0000000..6a6f37f --- /dev/null +++ b/src/vr/assets/img/common/check.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/confirmed.png b/src/vr/assets/img/confirmed.png new file mode 100755 index 0000000..2023abd Binary files /dev/null and b/src/vr/assets/img/confirmed.png differ diff --git a/src/vr/assets/img/cpus.png b/src/vr/assets/img/cpus.png new file mode 100644 index 0000000..a3aa53e Binary files /dev/null and b/src/vr/assets/img/cpus.png differ diff --git a/src/vr/assets/img/cpus.svg b/src/vr/assets/img/cpus.svg new file mode 100644 index 0000000..4157fe0 --- /dev/null +++ b/src/vr/assets/img/cpus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/vr/assets/img/dog.gif b/src/vr/assets/img/dog.gif new file mode 100644 index 0000000..433ee58 Binary files /dev/null and b/src/vr/assets/img/dog.gif differ diff --git a/src/vr/assets/img/dog2.gif b/src/vr/assets/img/dog2.gif new file mode 100644 index 0000000..f773aee Binary files /dev/null and b/src/vr/assets/img/dog2.gif differ diff --git a/src/vr/assets/img/expired.png b/src/vr/assets/img/expired.png new file mode 100755 index 0000000..6400b8b Binary files /dev/null and b/src/vr/assets/img/expired.png differ diff --git a/src/vr/assets/img/grass.png b/src/vr/assets/img/grass.png new file mode 100644 index 0000000..d3f74dd Binary files /dev/null and b/src/vr/assets/img/grass.png differ diff --git a/src/vr/assets/img/hypnotoad.png b/src/vr/assets/img/hypnotoad.png new file mode 100644 index 0000000..fcf0257 Binary files /dev/null and b/src/vr/assets/img/hypnotoad.png differ diff --git a/src/vr/assets/img/icons/advicon256px.ico b/src/vr/assets/img/icons/advicon256px.ico new file mode 100755 index 0000000..dae4b8d Binary files /dev/null and b/src/vr/assets/img/icons/advicon256px.ico differ diff --git a/src/vr/assets/img/icons/thumbicon.png b/src/vr/assets/img/icons/thumbicon.png new file mode 100755 index 0000000..3805af1 Binary files /dev/null and b/src/vr/assets/img/icons/thumbicon.png differ diff --git a/src/vr/assets/img/illuminati.png b/src/vr/assets/img/illuminati.png new file mode 100644 index 0000000..459f83e Binary files /dev/null and b/src/vr/assets/img/illuminati.png differ diff --git a/src/vr/assets/img/info.png b/src/vr/assets/img/info.png new file mode 100755 index 0000000..a1bb2a9 Binary files /dev/null and b/src/vr/assets/img/info.png differ diff --git a/src/vr/assets/img/main_menu_icons/audio_tab_icon.svg b/src/vr/assets/img/main_menu_icons/audio_tab_icon.svg new file mode 100755 index 0000000..110df6f --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/audio_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/bindings_tab_icon.svg b/src/vr/assets/img/main_menu_icons/bindings_tab_icon.svg new file mode 100755 index 0000000..4526825 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/bindings_tab_icon.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/chaperone_tab_icon.svg b/src/vr/assets/img/main_menu_icons/chaperone_tab_icon.svg new file mode 100755 index 0000000..54c94c7 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/chaperone_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/motion_tab_icon.svg b/src/vr/assets/img/main_menu_icons/motion_tab_icon.svg new file mode 100755 index 0000000..a5b2ca8 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/motion_tab_icon.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/offsets_tab_icon.svg b/src/vr/assets/img/main_menu_icons/offsets_tab_icon.svg new file mode 100755 index 0000000..5c7d0d9 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/offsets_tab_icon.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/rotation_tab_icon.svg b/src/vr/assets/img/main_menu_icons/rotation_tab_icon.svg new file mode 100755 index 0000000..0735790 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/rotation_tab_icon.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/settings_tab_icon.svg b/src/vr/assets/img/main_menu_icons/settings_tab_icon.svg new file mode 100755 index 0000000..7079354 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/settings_tab_icon.svg @@ -0,0 +1,17 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/space_fix_tab_icon.svg b/src/vr/assets/img/main_menu_icons/space_fix_tab_icon.svg new file mode 100755 index 0000000..f9d375e --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/space_fix_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/statistics_tab_icon.svg b/src/vr/assets/img/main_menu_icons/statistics_tab_icon.svg new file mode 100755 index 0000000..d92e219 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/statistics_tab_icon.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/steamvr_tab_icon.svg b/src/vr/assets/img/main_menu_icons/steamvr_tab_icon.svg new file mode 100755 index 0000000..11f8ead --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/steamvr_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/utilities_tab_icon.svg b/src/vr/assets/img/main_menu_icons/utilities_tab_icon.svg new file mode 100755 index 0000000..59e5480 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/utilities_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/main_menu_icons/video_tab_icon.svg b/src/vr/assets/img/main_menu_icons/video_tab_icon.svg new file mode 100755 index 0000000..fcdccb5 --- /dev/null +++ b/src/vr/assets/img/main_menu_icons/video_tab_icon.svg @@ -0,0 +1,12 @@ + + + + + + + diff --git a/src/vr/assets/img/receive.svg b/src/vr/assets/img/receive.svg new file mode 100755 index 0000000..f5de763 --- /dev/null +++ b/src/vr/assets/img/receive.svg @@ -0,0 +1 @@ +Artboard 13 \ No newline at end of file diff --git a/src/vr/assets/img/rotation/autoturn.png b/src/vr/assets/img/rotation/autoturn.png new file mode 100755 index 0000000..37bd883 Binary files /dev/null and b/src/vr/assets/img/rotation/autoturn.png differ diff --git a/src/vr/assets/img/rotation/noautoturn.png b/src/vr/assets/img/rotation/noautoturn.png new file mode 100755 index 0000000..b3a14ef Binary files /dev/null and b/src/vr/assets/img/rotation/noautoturn.png differ diff --git a/src/vr/assets/img/rotation/noautoturn.svg b/src/vr/assets/img/rotation/noautoturn.svg new file mode 100755 index 0000000..755074c --- /dev/null +++ b/src/vr/assets/img/rotation/noautoturn.svg @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + A + + + diff --git a/src/vr/assets/img/send.png b/src/vr/assets/img/send.png new file mode 100755 index 0000000..482dae9 Binary files /dev/null and b/src/vr/assets/img/send.png differ diff --git a/src/vr/assets/img/status_connected.svg b/src/vr/assets/img/status_connected.svg new file mode 100644 index 0000000..e077999 --- /dev/null +++ b/src/vr/assets/img/status_connected.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + + + + + record + media + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/status_disconnected.svg b/src/vr/assets/img/status_disconnected.svg new file mode 100644 index 0000000..46d1a1d --- /dev/null +++ b/src/vr/assets/img/status_disconnected.svg @@ -0,0 +1,293 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + + Record + + + record + media + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/status_lagging.svg b/src/vr/assets/img/status_lagging.svg new file mode 100644 index 0000000..1fd4879 --- /dev/null +++ b/src/vr/assets/img/status_lagging.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Lapo Calamandrei + + + + + + + + record + media + + + + + Jakub Steiner + + + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/status_waiting.svg b/src/vr/assets/img/status_waiting.svg new file mode 100644 index 0000000..069a4d3 --- /dev/null +++ b/src/vr/assets/img/status_waiting.svg @@ -0,0 +1,398 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + Jakub Steiner + + + http://jimmac.musichall.cz + + View Refresh + + + reload + refresh + view + + + + + Ricardo 'Rick' González + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/vr/assets/img/tutorial.png b/src/vr/assets/img/tutorial.png new file mode 100644 index 0000000..4cab6f9 Binary files /dev/null and b/src/vr/assets/img/tutorial.png differ diff --git a/src/vr/assets/img/video/color.png b/src/vr/assets/img/video/color.png new file mode 100755 index 0000000..be8926f Binary files /dev/null and b/src/vr/assets/img/video/color.png differ diff --git a/src/vr/assets/img/video/dimmer.png b/src/vr/assets/img/video/dimmer.png new file mode 100755 index 0000000..7c2f6a1 Binary files /dev/null and b/src/vr/assets/img/video/dimmer.png differ diff --git a/src/vr/assets/img/wizard.png b/src/vr/assets/img/wizard.png new file mode 100644 index 0000000..31426b5 Binary files /dev/null and b/src/vr/assets/img/wizard.png differ diff --git a/src/vr/assets/themes.json b/src/vr/assets/themes.json new file mode 100644 index 0000000..0902ed3 --- /dev/null +++ b/src/vr/assets/themes.json @@ -0,0 +1,39 @@ +{ + "default": { + "fontColor": "white", + "fontColorDimmed": "#cccccc", + "fontColorBright": "white", + "backgroundGradientStartColor": "#225d73", + "backgroundGradientStopColor": "#192e43", + "backgroundColor": "#1b2939", + "divideColor": "50ffffff", + "btnEnteredColor": "#aa3b689b", + "btnExitedColor": "#aa375c87", + "btnPressedColor": "#aa467dbb", + "btnTextHoverColor": "white", + "btnTextColor": "white", + "btnMainMenuBackground": "#aa3b689b", + "historyBackgroundColor": "#2c435d", + "historyBackgroundColorBright": "#406288", + "historyFontColorPlusAmount": "#00d304", + "historyFontColorMinAmount": "red" + }, + "wownero": { + "fontColor": "#bd93f9", + "fontColorBright": "#e5d3ff", + "backgroundGradientStartColor": "#383a59", + "backgroundGradientStopColor": "#282a36", + "backgroundColor": "#282a36", + "divideColor": "50ffffff", + "btnEnteredColor": "#bd93f9", + "btnExitedColor": "#50000000", + "btnPressedColor": "#bd93f9", + "btnTextHoverColor": "black", + "btnTextColor": "#bcc2cd", + "btnMainMenuBackground": "#50000000", + "historyBackgroundColor": "#30314d", + "historyBackgroundColorBright": "#383a59", + "historyFontColorPlusAmount": "#00d304", + "historyFontColorMinAmount": "red" + } +} \ No newline at end of file diff --git a/src/vr/main.cpp b/src/vr/main.cpp new file mode 100644 index 0000000..bf24757 --- /dev/null +++ b/src/vr/main.cpp @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "openvr.h" +#include "vr/openvr_init.h" +#include "vr/main.h" + +#include "libwalletqt/TransactionInfo.h" +#include "libwalletqt/TransactionHistory.h" +#include "model/TransactionHistoryModel.h" +#include "model/TransactionHistoryProxyModel.h" +#include "libwalletqt/WalletManager.h" + +#include "utils/keysfiles.h" + +namespace wowletvr { + + void check_error(int line, vr::EVRInitError error) { if (error != 0) printf("%d: error %s\n", line, VR_GetVRInitErrorAsSymbol(error)); } + + WowletVR::WowletVR(AppContext *ctx, QCommandLineParser *parser, QObject *parent) : + QObject(parent), ctx(ctx), m_parser(parser) { + AppContext::isQML = true; + m_pClipboard = QGuiApplication::clipboard(); + desktopMode = m_parser->isSet("openvr-debug"); + + // Init QML themes + this->readThemes(); + + // turn on auto tx commits + ctx->autoCommitTx = true; + + // QR code scanning from screenshots + m_qrScreenshotPreviewPath = ctx->configDirectoryVR + "/screenshot_preview"; + m_qrScreenshotImagePath = ctx->configDirectoryVR + "/screenshot"; + m_qrScreenshotTimer.setSingleShot(true); + connect(&m_qrScreenshotTimer, &QTimer::timeout, this, &WowletVR::onCheckQRScreenshot); + + // write icon to disk so openvr overlay can use it + auto icon = ":/assets/images/wowlet.png"; + if(Utils::fileExists(icon)) { + QFile f(icon); + QFileInfo fileInfo(f); + auto icon_path = QDir(ctx->configDirectory).filePath(fileInfo.fileName()); + f.copy(icon_path); + f.close(); + } + +#ifdef Q_OS_WIN + if(desktopMode) + qputenv("QMLSCENE_DEVICE", "softwarecontext"); // virtualbox +#endif + qDebug() << "QMLSCENE_DEVICE: " << qgetenv("QMLSCENE_DEVICE"); + qInfo() << "OPENSSL VERSION: " << QSslSocket::sslLibraryBuildVersionString(); + + m_engine.rootContext()->setContextProperty("homePath", QDir::homePath()); + m_engine.rootContext()->setContextProperty("applicationDirectory", QApplication::applicationDirPath()); + m_engine.rootContext()->setContextProperty("idealThreadCount", QThread::idealThreadCount()); + m_engine.rootContext()->setContextProperty("qtRuntimeVersion", qVersion()); + m_engine.rootContext()->setContextProperty("ctx", ctx); + +// qmlRegisterType("moneroComponents.Clipboard", 1, 0, "Clipboard"); + m_engine.rootContext()->setContextProperty("WowletVR", this); + qRegisterMetaType(); + qmlRegisterType("wowlet.NetworkType", 1, 0, "NetworkType"); + + qmlRegisterUncreatableType("wowlet.WalletKeysFiles", 1, 0, "WalletKeysFiles", "WalletKeysFiles can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.Wallet", 1, 0, "Wallet", "Wallet can't be instantiated directly"); + qmlRegisterType("wowlet.WalletManager", 1, 0, "WalletManager"); + + qmlRegisterUncreatableType("wowlet.TransactionHistoryProxyModel", 1, 0, "TransactionHistoryProxyModel", "TransactionHistoryProxyModel can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionHistoryModel", 1, 0, "TransactionHistoryModel", "TransactionHistoryModel can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionInfo", 1, 0, "TransactionInfo", "TransactionHistory can't be instantiated directly"); + qmlRegisterUncreatableType("wowlet.TransactionHistory", 1, 0, "TransactionHistory", "TransactionHistory can't be instantiated directly"); + + qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); + + if(!desktopMode) { + if(!openvr_init::initializeOpenVR(openvr_init::OpenVrInitializationType::Overlay)) + throw std::runtime_error("Error: initializeOpenVR()"); + } + + m_controller = new wowletvr::OverlayController(desktopMode, m_engine); + m_engine.rootContext()->setContextProperty("OverlayController", m_controller); + + auto widgetUrl = QUrl(QStringLiteral("qrc:///main")); + m_component = new QQmlComponent(&m_engine, widgetUrl); + + this->errors = m_component->errors(); + for (auto &e : this->errors) + qCritical() << "QML Error: " << e.toString().toStdString().c_str(); + } + + void WowletVR::render() { + auto quickObj = m_component->create(); + QQuickItem *quickObjItem = qobject_cast(quickObj); + + auto displayName = application_strings::applicationDisplayName; + auto appKey = application_strings::applicationKey; + + if(desktopMode) { + auto m_pWindow = new QQuickWindow(); + qobject_cast(quickObj)->setParentItem(m_pWindow->contentItem()); + m_pWindow->setGeometry(0, 0, + static_cast(qobject_cast(quickObj)->width()), + static_cast(qobject_cast(quickObj)->height())); + m_pWindow->show(); + return; + } + + auto iconPath = ctx->configDirectory + "/wowlet.png"; + m_controller->SetWidget(quickObjItem, displayName, appKey, iconPath.toStdString()); + } + + void WowletVR::readThemes() { + theme_names = QVariantList(); + themes = QVariantMap(); + + auto lol = Utils::fileOpen(":/qml_themes.json"); + auto doc = QJsonDocument::fromJson(lol); + QJsonObject obj = doc.object(); + + foreach(const QString &themeName, obj.keys()) { + theme_names << themeName; + + QJsonValue value = obj.value(themeName); + QJsonObject theme = value.toObject(); + QVariantMap map; + foreach(const QString &key, theme.keys()) { + map[key] = theme.value(key).toString(); + } + + themes[themeName] = map; + } + } + + void WowletVR::takeQRScreenshot() { + if(m_qrScreenshotTimer.isActive()) + return; + + m_controller->takeQRScreenshot(m_qrScreenshotPreviewPath, m_qrScreenshotImagePath); + m_qrScreenshotTimer.start(1000); + } + + void WowletVR::onCheckQRScreenshot() { + qDebug() << "onCheckQRScreenshot()"; + QString msg; + auto path = m_qrScreenshotPreviewPath + ".png"; + auto pathPreview = m_qrScreenshotPreviewPath + "_inverted.png"; + + qDebug() << "path: " + path << " inverted: " + pathPreview; + + if(!Utils::fileExists(path)) { + msg = "Screenshot was not saved to disk."; + qWarning() << msg; + emit qrScreenshotFailed(msg); + return; + } + + auto age = Utils::fileModifiedAge(path); + if (age >= 5) { + msg = "Screenshot on disk too old. Leftover from the last time?"; + qWarning() << msg; + emit qrScreenshotFailed(msg); + QFile file (path); + file.remove(); + return; + } + + auto results = m_qrDecoder.decodePNG(path); + auto result = wowletvr::WowletVR::checkQRScreenshotResults(results); + qDebug() << "QR code try #1: " << result; + if(result.isEmpty()) { + qDebug() << "trying to invert the image"; + QImage image(path); + image.invertPixels(); + image.save(pathPreview); + results = m_qrDecoder.decodePNG(pathPreview); + result = wowletvr::WowletVR::checkQRScreenshotResults(results); + qDebug() << "QR code try #2: " << result; + } + + if(!result.isEmpty()) { + qDebug() << "QR code decoded, trying address validation."; + + if(result.toLower().startsWith("wownero:")) + result = result.remove(0, 8); + + if(WalletManager::addressValid(result, NetworkType::MAINNET)) { + qDebug() << "QR code appears valid."; + emit qrScreenshotSuccess(result); + QFile file(path); + file.remove(); + return; + } + } + + emit qrScreenshotFailed("No QR code could be detected."); + } + + QString WowletVR::checkQRScreenshotResults(std::vector results) { + auto results_count = results.size(); + if(results_count == 1) + return QString::fromStdString(results[0]); + return ""; + } + + WowletVR::~WowletVR() { + // bla + int wegeg = 1; + } +} diff --git a/src/vr/main.h b/src/vr/main.h new file mode 100644 index 0000000..6d7a28e --- /dev/null +++ b/src/vr/main.h @@ -0,0 +1,120 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_MAIN_H +#define WOWLET_MAIN_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "overlaycontroller.h" +#include "appcontext.h" +#include "utils/config.h" +#include "QR-Code-scanner/Decoder.h" + +namespace wowletvr { + + class WowletVR : public QObject { + Q_OBJECT + public: + explicit WowletVR(AppContext *ctx, QCommandLineParser *cmdargs, QObject *parent = nullptr); + ~WowletVR() override; + + void readThemes(); + void render(); + + QList errors; + QVariantList theme_names; + QVariantMap themes; + + Q_INVOKABLE QVariantMap getThemes() { + return themes; + } + + Q_INVOKABLE QString getCurrentTheme() { + return config()->get(Config::openVRSkin).toString(); + } + + Q_INVOKABLE void setCurrentTheme(QString theme) { + config()->set(Config::openVRSkin, theme); + } + + Q_INVOKABLE double cdiv(double amount) { return amount / globals::cdiv; } + Q_INVOKABLE double add(double x, double y) const { return Utils::roundUp(x + y, 4); } // round ceil 4 decimals + Q_INVOKABLE double sub(double x, double y) const { return Utils::roundUp(x - y, 4); } // round ceil 4 decimals + + Q_INVOKABLE void onCreateTransaction(const QString &address, const QString &amount_str, const QString description, bool all) { + auto amount = WalletManager::amountFromString(amount_str); + ctx->onCreateTransaction(address, amount, description, false); + } + + Q_INVOKABLE void setClipboard(const QString &text) { + m_pClipboard->setText(text, QClipboard::Clipboard); + m_pClipboard->setText(text, QClipboard::Selection); + } + + Q_INVOKABLE void setStreamerMode(bool status) { + config()->set(Config::openVRStreamerMode, status); + } + + Q_INVOKABLE bool getStreamerMode() { + return config()->get(Config::openVRStreamerMode).toBool(); + } + + Q_INVOKABLE QString preferredFiat() { + return config()->get(Config::preferredFiatCurrency).toString(); + } + + Q_INVOKABLE QString fiatToWow(double amount) { + auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if (amount <= 0) return QString("0.00"); + + double conversionAmount = AppContext::prices->convert(preferredFiatCurrency, "WOW", amount); + return QString("%1").arg(QString::number(conversionAmount, 'f', 2)); + } + + Q_INVOKABLE QString wowToFiat(double amount) { + auto preferredFiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); + if (amount <= 0) return QString("0.00"); + + double conversionAmount = AppContext::prices->convert("WOW", preferredFiatCurrency, amount); + if(conversionAmount <= 0) return QString("0.00"); + return QString("~%1").arg(QString::number(conversionAmount, 'f', 2)); + } + + Q_INVOKABLE void takeQRScreenshot(); + + signals: + void qrScreenshotFailed(QString error); + void qrScreenshotSuccess(QString address); + + private slots: + void onCheckQRScreenshot(); + + private: + AppContext *ctx; + QQmlEngine m_engine; + QQmlComponent *m_component; + wowletvr::OverlayController *m_controller; + + bool desktopMode = false; + QString m_qrScreenshotPreviewPath; + QString m_qrScreenshotImagePath; + + QCommandLineParser *m_parser; + QClipboard *m_pClipboard; + QTimer m_qrScreenshotTimer; + QrDecoder m_qrDecoder; + + static QString checkQRScreenshotResults(std::vector results); + }; + +} + +#endif //WOWLET_MAIN_H diff --git a/src/vr/main.qml b/src/vr/main.qml new file mode 100644 index 0000000..64a0470 --- /dev/null +++ b/src/vr/main.qml @@ -0,0 +1,473 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 +import QtGraphicalEffects 1.0 + +import "." + +import "qml/common" +import "qml/." + +import wowlet.Wallet 1.0 +import wowlet.WalletManager 1.0 + +Rectangle { + id: appWindow + width: 1600 + height: 800 + color: "transparent" + + property var themes: {} + property string theme: "default" + property string fiatSymbol: "USD" + property bool streamerMode: false + signal initTheme(); + + // Components that have been dynamically created need to redraw + // after theme change (such as Repeater{}, Flow{} items, etc) so + // that the changes propogate. + signal redraw(); + + // For gradient background + property int start_x: 0 + property int start_y: 64 + property int end_x: 1080 + property int end_y: 416 + property double gradientTicks: 1.0; + + LinearGradient { + anchors.fill: parent + start: Qt.point(start_x, start_y) + end: Qt.point(end_x, end_y) + + gradient: Gradient { + GradientStop { position: 0.0; color: Style.backgroundGradientStartColor } + GradientStop { position: 1.0; color: Style.backgroundGradientStopColor } + } + } + + Timer { + // animates the gradient background a bit. + id: gradientBackgroundTimer + repeat: true + interval: 10 + triggeredOnStart: true + + onTriggered: { + appWindow.gradientTicks += 0.004; // speed + let newx = ((1080 - 200) * Math.sin(appWindow.gradientTicks) + 1080 + 200) / 2; + appWindow.end_x = newx; + } + } + + property var currentWallet; + property bool disconnected: currentWallet ? currentWallet.disconnected : false + property string walletTitle: "placeholder" + property string walletPath: "" + property string statusText: "Idle" + property string balanceFormatted: "Balance: 0.0 WOW" + property bool wsConnected: false + property int connectionStatus: Wallet.ConnectionStatus_Disconnected; + signal aboutClicked(); + + property var balance: 0.0 + property var spendable: 0.0 + + property DashboardPage dashboardPage: DashboardPage { + visible: false + } + + property SettingsPage settingsPage: SettingsPage { + visible: false + } + + property AboutPage aboutPage: AboutPage { + visible: false + } + + property WalletPage walletPage: WalletPage { + visible: false + } + + MyDialogOkPopup { + id: messagePopup + function showMessage(title, text) { + dialogTitle = title + dialogText = text + open() + } + } + + MyDialogOkCancelPopup { + id: enterPasswordDialog + dialogTitle: "Enter Wallet Password" + dialogWidth: 700 + dialogHeight: 280 + + dialogContentItem: ColumnLayout { + RowLayout { + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + MyText { + fontColor: Style.fontColorBright + text: "Password: " + } + + MyTextField { + id: walletOpenPassword + keyBoardUID: 591 + color: Style.fontColorDimmed + text: "" + Layout.fillWidth: true + font.pointSize: 20 + function onInputEvent(input) { + walletOpenPassword.text = input + } + } + } + } + + onClosed: { + if (okClicked) { + if(walletOpenPassword.text === "") + return messagePopup.showMessage("Password empty", "Please fill in a password."); + + ctx.onOpenWallet(appWindow.walletPath, walletOpenPassword.text); + } + } + function openPopup() { + open() + } + } + + MyDialogOkCancelPopup { + id: createWalletDialog + dialogTitle: "Create New Wallet" + dialogWidth: 700 + dialogHeight: 440 + + dialogContentItem: ColumnLayout { + spacing: 10 + RowLayout { + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + MyText { + fontColor: Style.fontColorBright + text: "Name: " + } + + MyTextField { + id: newWalletName + keyBoardUID: 590 + color: Style.fontColorDimmed + text: "" + Layout.fillWidth: true + font.pointSize: 20 + function onInputEvent(input) { + newWalletName.text = input + } + } + } + + RowLayout { + Layout.topMargin: 16 + Layout.leftMargin: 16 + Layout.rightMargin: 16 + + MyText { + fontColor: Style.fontColorBright + text: "Password: " + } + + MyTextField { + id: newWalletPassword + keyBoardUID: 592 + color: Style.fontColorDimmed + text: "" + Layout.fillWidth: true + font.pointSize: 20 + function onInputEvent(input) { + newWalletPassword.text = input + } + } + } + + MyText { + Layout.topMargin: 20 + Layout.leftMargin: 16 + fontSize: 24 + fontColor: Style.fontColorDimmed + text: "The password field is optional." + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + onClosed: { + if (okClicked) { + if(newWalletName.text === "") + return messagePopup.showMessage("Invalid name", "Please name the wallet."); + + ctx.createWalletWithoutSpecifyingSeed(newWalletName.text, newWalletPassword.text); + } + } + function openPopup() { + open() + } + } + + // About/credits button + Rectangle { + visible: mainView.currentItem == dashboardPage + color: "transparent" + width: 140 + height: 60 + anchors.bottom: parent.bottom + anchors.right: parent.right + + MyText { + text: "Credits" + fontSize: 16 + opacity: 0.3 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + fontColor: Style.fontColor + } + + MouseArea { + anchors.fill: parent + onClicked: { + aboutClicked(); + } + } + } + + StackView { + id: mainView + visible: true + anchors.fill: parent + + pushEnter: Transition { + PropertyAnimation { + property: "x" + from: mainView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + pushExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: -mainView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + popEnter: Transition { + PropertyAnimation { + property: "x" + from: -mainView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + popExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: mainView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + + initialItem: dashboardPage + } + + Component.onCompleted: { + dashboardPage.onPageCompleted(); + + if(typeof ctx !== 'undefined') { + ctx.initTor(); + ctx.initWS(); + } + + // Start animating the background + gradientBackgroundTimer.start(); + + // init some theme stuff + try { + appWindow.themes = WowletVR.getThemes(); + appWindow.theme = WowletVR.getCurrentTheme(); + } catch(err) { + // for debugging purposes - do not change color codes here, use themes.json instead. + appWindow.themes = { + "default": { + "fontColor": "white", + "fontColorDimmed": "#cccccc", + "fontColorBright": "white", + "backgroundGradientStartColor": "#225d73", + "backgroundGradientStopColor": "#192e43", + }, + "wownero": { + "fontColor": "#bd93f9", + "fontColorDimmed": "#cccccc", + "fontColorBright": "#e5d3ff", + "backgroundGradientStartColor": "#383a59", + "backgroundGradientStopColor": "#282a36", + } + } + } + appWindow.changeTheme(appWindow.theme); + appWindow.initTheme(); + + // streamer mode enabled? + try { + appWindow.streamerMode = WowletVR.getStreamerMode(); + } catch(err){} + } + + function changeTheme(theme) { + console.log("changeTheme", theme); + + for (var key in appWindow.themes[theme]){ + let val = appWindow.themes[theme][key]; + if(Style.hasOwnProperty(key)) + Style[key] = val; + } + + if(appWindow.theme != theme) { + appWindow.theme = theme; + try { WowletVR.setCurrentTheme(theme); } + catch(err) {} + } + + appWindow.redraw(); + } + + Connections { + target: ctx + + function onWsConnected() { + console.log("onWsConnected") + appWindow.wsConnected = true; + } + + function onWsDisconnected() { + console.log("onWsDisconnected") + appWindow.wsConnected = false; + } + + function onWalletOpened(wallet) { + console.log("onWalletOpened()"); + + appWindow.currentWallet = wallet; + appWindow.walletTitle = ctx.walletName; + mainView.push(appWindow.walletPage); + appWindow.walletPage.onPageCompleted(); + + appWindow.currentWallet.connectionStatusChanged.connect(onConnectionStatusChanged); + } + + function onBlockchainSync(height, target) { + let blocks = (target > height) ? (target - height) : "?"; + let heightText = "Blockchain sync: " + blocks + " blocks remaining"; + appWindow.statusText = heightText; + } + + function onRefreshSync(height, target) { + let blocks = (target >= height) ? (target - height) : "?"; + let heightText = "Wallet sync: " + blocks + " blocks remaining"; + appWindow.statusText = heightText; + } + + function onWalletClosed() { + console.log("onWalletClosed"); + + appWindow.walletTitle = ""; + appWindow.balanceFormatted = ""; + appWindow.balance = 0.0; + appWindow.spendable = 0.0; + appWindow.connectionStatus = Wallet.ConnectionStatus_Disconnected; + } + + function onBalanceUpdatedFormatted(fmt) { + appWindow.balanceFormatted = fmt; + } + + function onBalanceUpdated(balance, spendable) { + appWindow.balance = WowletVR.cdiv(balance); + appWindow.spendable = WowletVR.cdiv(spendable); + console.log("onBalanceUpdated", appWindow.spendable); + } + + function onWalletOpenedError(err) { + messagePopup.showMessage("Error", err); + } + + function onWalletCreatedError(err) { + messagePopup.showMessage("Error", err); + } + + function onWalletCreated(wallet) { + console.log("walletCreated"); + } + + function onSynchronized() { + appWindow.statusText = "Synchronized"; + + appWindow.onConnectionStatusChanged(Wallet.ConnectionStatus_Connected); + console.log("onSynchronized"); + } + + function onWalletOpenPasswordNeeded(invalidPassword, path) { // bool, str + enterPasswordDialog.openPopup(); + } + + function onInitiateTransaction() { + console.log("transactionStarted"); + } + + function onCreateTransactionError(message) { // str + console.log("transactionError", message); + } + + function onCreateTransactionSuccess(tx, address) { // PendingTransaction + console.log("onCreateTransactionSuccess", address) + } + + function onTransactionCommitted(status, tx, txid) { // bool,PendingTransaction,stringlist + console.log("onTransactionCommitted", status) + } + } + + Connections { + target: OverlayController + + function onDashboardDeactivated() { + gradientBackgroundTimer.stop(); + } + + function onDashboardActivated() { + gradientBackgroundTimer.start(); + } + } + + function onConnectionStatusChanged(status) { + console.log("onConnectionStatusChanged", status) + appWindow.connectionStatus = status; + } +} diff --git a/src/vr/main2.qml b/src/vr/main2.qml new file mode 100644 index 0000000..6d605cc --- /dev/null +++ b/src/vr/main2.qml @@ -0,0 +1,85 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 + +import "." +import "mock/Windows.js" as Windows +import "mock/Version.js" as Version +import "mock/NetworkType.js" as NetworkType +import "mock/Settings.js" as Settings +import "mock" +import "qml/common" + +import "qml/." + + +Rectangle { + width: 1600 + height: 800 + color: "red" + + property var currentWallet; + property bool disconnected: currentWallet ? currentWallet.disconnected : false + + property WalletDashboard WalletDashboard: WalletDashboard { + stackView: walletView + } + + property SendPage sendPage: SendPage { + stackView: walletView + visible: false + } + + property ReceivePage receivePage: ReceivePage { + stackView: walletView + visible: false + } + + StackView { + id: walletView + anchors.fill: parent + + pushEnter: Transition { + PropertyAnimation { + property: "x" + from: walletView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + pushExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: -walletView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + popEnter: Transition { + PropertyAnimation { + property: "x" + from: -walletView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + popExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: walletView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + + initialItem: WalletDashboard + } +} diff --git a/src/vr/openvr_init.cpp b/src/vr/openvr_init.cpp new file mode 100755 index 0000000..bae2884 --- /dev/null +++ b/src/vr/openvr_init.cpp @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) OpenVR Advanced Settings + +#include +#include +#include +#include + +#include "openvr_init.h" +#include "utils/utils.h" +#include +#include + + +namespace openvr_init +{ +bool initializeProperly(const OpenVrInitializationType initType) { + auto initializationType = vr::EVRApplicationType::VRApplication_Other; + if (initType == OpenVrInitializationType::Overlay) { + initializationType = vr::EVRApplicationType::VRApplication_Overlay; + } else if (initType == OpenVrInitializationType::Utility) { + initializationType = vr::EVRApplicationType::VRApplication_Utility; + } + + auto initError = vr::VRInitError_None; + vr::VR_Init(&initError, initializationType); + if (initError != vr::VRInitError_None) { + if (initError == vr::VRInitError_Init_HmdNotFound || initError == vr::VRInitError_Init_HmdNotFoundPresenceFailed) { + QMessageBox::critical(nullptr, "Wowlet VR", "Could not find HMD!"); + } + qCritical() << "Failed to initialize OpenVR: " << std::string(vr::VR_GetVRInitErrorAsEnglishDescription(initError)).c_str(); + return false; + } + + qInfo() << "OpenVR initialized successfully."; + return true; +} + +bool initializeOpenVR(const OpenVrInitializationType initType) +{ + QString vr_pathreg_override = qgetenv("VR_PATHREG_OVERRIDE"); + if(!vr_pathreg_override.isEmpty()) { + if(Utils::fileExists(vr_pathreg_override)) { + qCritical() << "Filepath supplied in VR_PATHREG_OVERRIDE not found. Does this path exist?"; + return false; + } + } + + bool res = initializeProperly(initType); + if(!res) + return false; + + // Check whether OpenVR is too outdated + if (!vr::VR_IsInterfaceVersionValid(vr::IVRSystem_Version)) { + return reportVersionError(vr::IVRSystem_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRSettings_Version)) { + return reportVersionError(vr::IVRSettings_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVROverlay_Version)) { + return reportVersionError(vr::IVROverlay_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRApplications_Version)) { + return reportVersionError(vr::IVRApplications_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRChaperone_Version)) { + return reportVersionError(vr::IVRChaperone_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRChaperoneSetup_Version)) { + return reportVersionError(vr::IVRChaperoneSetup_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRCompositor_Version)) { + return reportVersionError(vr::IVRCompositor_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRNotifications_Version)) { + return reportVersionError(vr::IVRNotifications_Version); + } else if (!vr::VR_IsInterfaceVersionValid(vr::IVRInput_Version)) { + return reportVersionError(vr::IVRInput_Version); + } + + return true; +} + +bool reportVersionError(const char* const interfaceAndVersion) { + // The function call and error message was the same for all version checks. + // Specific error messages are unlikely to be necessary since both the type + // and version are in the string and will be output. + auto msg = "OpenVR version is too outdated. Please update OpenVR: " + QString(interfaceAndVersion); + QMessageBox::critical(nullptr, "Wowlet VR", msg); + return false; +} + +} // namespace openvr_init diff --git a/src/vr/openvr_init.h b/src/vr/openvr_init.h new file mode 100755 index 0000000..3473be1 --- /dev/null +++ b/src/vr/openvr_init.h @@ -0,0 +1,16 @@ +#pragma once + +namespace openvr_init +{ + + enum class OpenVrInitializationType + { + Overlay, + Utility, + }; + + bool initializeProperly(OpenVrInitializationType initType); + bool initializeOpenVR(OpenVrInitializationType initType ); + bool reportVersionError(const char* interfaceAndVersion); + +} // namespace openvr_init diff --git a/src/vr/overlaycontroller.cpp b/src/vr/overlaycontroller.cpp new file mode 100755 index 0000000..675aadf --- /dev/null +++ b/src/vr/overlaycontroller.cpp @@ -0,0 +1,474 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) OpenVR Advanced Settings + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "overlaycontroller.h" +#include + +// application namespace +namespace wowletvr +{ + +OverlayController::OverlayController(bool desktopMode, QQmlEngine& qmlEngine) : + QObject(), + m_desktopMode(desktopMode) +{ + // Arbitrarily chosen Max Length of Directory path, should be sufficient for + // Any set-up + const uint32_t maxLength = 16192; + uint32_t requiredLength; + + char tempRuntimePath[maxLength]; + bool pathIsGood = vr::VR_GetRuntimePath( tempRuntimePath, maxLength, &requiredLength ); + + // Throw Error If over 16k characters in path string + if ( !pathIsGood ) + { + qCritical() << "Error Finding VR Runtime Path, Attempting Recovery: "; + uint32_t maxLengthRe = requiredLength; + qInfo() << "Open VR reporting Required path length of: " + << maxLengthRe; + } + + m_runtimePathUrl = QUrl::fromLocalFile( tempRuntimePath ); + qInfo() << "VR Runtime Path: " << m_runtimePathUrl.toLocalFile(); + + QSurfaceFormat format; + // Qt's QOpenGLPaintDevice is not compatible with OpenGL versions >= 3.0 + // NVIDIA does not care, but unfortunately AMD does + // Are subtle changes to the semantics of OpenGL functions actually covered + // by the compatibility profile, and this is an AMD bug? + format.setVersion( 2, 1 ); + // format.setProfile( QSurfaceFormat::CompatibilityProfile ); + format.setDepthBufferSize( 16 ); + format.setStencilBufferSize( 8 ); + format.setSamples( 16 ); + + m_openGLContext.setFormat( format ); + if ( !m_openGLContext.create() ) { + throw std::runtime_error( "Could not create OpenGL context" ); + } + + // create an offscreen surface to attach the context and FBO to + m_offscreenSurface.setFormat( m_openGLContext.format() ); + m_offscreenSurface.create(); + m_openGLContext.makeCurrent( &m_offscreenSurface ); + + if (!vr::VROverlay() && !desktopMode){ + QMessageBox::critical(nullptr, "Wowlet VR Overlay", "Is OpenVR running?"); + throw std::runtime_error( std::string( "No Overlay interface" ) ); + } + + // Set qml context + qmlEngine.rootContext()->setContextProperty("applicationVersion", "1337"); + qmlEngine.rootContext()->setContextProperty("vrRuntimePath", getVRRuntimePathUrl()); +} + +OverlayController::~OverlayController() { + Shutdown(); +} + +void OverlayController::exitApp() { + Shutdown(); + QApplication::exit(); + + qInfo() << "All systems exited."; + exit( EXIT_SUCCESS ); + // Does not fallthrough +} + +void OverlayController::Shutdown() { + if (m_pRenderTimer) + { + disconnect( &m_renderControl, + SIGNAL( renderRequested() ), + this, + SLOT( OnRenderRequest() ) ); + disconnect( &m_renderControl, + SIGNAL( sceneChanged() ), + this, + SLOT( OnRenderRequest() ) ); + disconnect( m_pRenderTimer.get(), + SIGNAL( timeout() ), + this, + SLOT( renderOverlay() ) ); + m_pRenderTimer->stop(); + m_pRenderTimer.reset(); + } + m_pFbo.reset(); +} + +void OverlayController::SetWidget(QQuickItem* quickItem, const std::string& name, const std::string& key, const std::string& iconPath) +{ + if ( !m_desktopMode ) + { + vr::VROverlayError overlayError + = vr::VROverlay()->CreateDashboardOverlay( + key.c_str(), + name.c_str(), + &m_ulOverlayHandle, + &m_ulOverlayThumbnailHandle ); + if ( overlayError != vr::VROverlayError_None ) + { + if ( overlayError == vr::VROverlayError_KeyInUse ) + { + QMessageBox::critical( nullptr, + "Wowlet VR Overlay", + "Another instance is already running." ); + } + throw std::runtime_error( std::string( + "Failed to create Overlay: " + + std::string( vr::VROverlay()->GetOverlayErrorNameFromEnum( + overlayError ) ) ) ); + } + vr::VROverlay()->SetOverlayWidthInMeters( m_ulOverlayHandle, 2.5f ); + vr::VROverlay()->SetOverlayInputMethod( + m_ulOverlayHandle, vr::VROverlayInputMethod_Mouse ); + vr::VROverlay()->SetOverlayFlag( + m_ulOverlayHandle, + vr::VROverlayFlags_SendVRSmoothScrollEvents, + true ); + + // Overlay icon + if (!iconPath.empty()) + vr::VROverlay()->SetOverlayFromFile( m_ulOverlayThumbnailHandle, iconPath.c_str() ); + + // Too many render calls in too short time overwhelm Qt and an + // assertion gets thrown. Therefore we use an timer to delay render + // calls + m_pRenderTimer.reset(new QTimer()); + m_pRenderTimer->setSingleShot( false ); + m_pRenderTimer->setInterval( 5 ); + connect( m_pRenderTimer.get(), + SIGNAL( timeout() ), + this, + SLOT( renderOverlay() ) ); + + QOpenGLFramebufferObjectFormat fboFormat; + fboFormat.setAttachment( + QOpenGLFramebufferObject::CombinedDepthStencil ); + fboFormat.setTextureTarget( GL_TEXTURE_2D ); + m_pFbo.reset( new QOpenGLFramebufferObject( + static_cast( quickItem->width() ), + static_cast( quickItem->height() ), + fboFormat ) ); + + m_window.setRenderTarget( m_pFbo.get() ); + quickItem->setParentItem( m_window.contentItem() ); + m_window.setGeometry( 0, + 0, + static_cast( quickItem->width() ), + static_cast( quickItem->height() ) ); + m_renderControl.initialize( &m_openGLContext ); + + vr::HmdVector2_t vecWindowSize + = { static_cast( quickItem->width() ), + static_cast( quickItem->height() ) }; + vr::VROverlay()->SetOverlayMouseScale( m_ulOverlayHandle, + &vecWindowSize ); + + connect( &m_renderControl, + SIGNAL( renderRequested() ), + this, + SLOT( OnRenderRequest() ) ); + connect( &m_renderControl, + SIGNAL( sceneChanged() ), + this, + SLOT( OnRenderRequest() ) ); + + m_pRenderTimer->start(); + } +} + +void OverlayController::OnRenderRequest() { + if ( m_pRenderTimer && !m_pRenderTimer->isActive() ) + { + m_pRenderTimer->start(); + } +} + +void OverlayController::renderOverlay() { + if ( !m_desktopMode ) + { + // skip rendering if the overlay isn't visible + if ( !vr::VROverlay() + || ( !vr::VROverlay()->IsOverlayVisible( m_ulOverlayHandle ) + && !vr::VROverlay()->IsOverlayVisible( + m_ulOverlayThumbnailHandle ) ) ) + return; + m_renderControl.polishItems(); + m_renderControl.sync(); + m_renderControl.render(); + + GLuint unTexture = m_pFbo->texture(); + if ( unTexture != 0 ) + { +#if defined _WIN64 || defined _LP64 + // To avoid any compiler warning because of cast to a larger + // pointer type (warning C4312 on VC) + vr::Texture_t texture = { reinterpret_cast( + static_cast( unTexture ) ), + vr::TextureType_OpenGL, + vr::ColorSpace_Auto }; +#else + vr::Texture_t texture = { reinterpret_cast( unTexture ), + vr::TextureType_OpenGL, + vr::ColorSpace_Auto }; +#endif + vr::VROverlay()->SetOverlayTexture( m_ulOverlayHandle, &texture ); + } + m_openGLContext.functions()->glFlush(); // We need to flush otherwise + // the texture may be empty.*/ + + if(m_customTickRateCounter % k_nonVsyncTickRate == 0) { + mainEventLoop(); + m_customTickRateCounter = 0; + } else { + m_customTickRateCounter += 1; + } + } +} + +bool OverlayController::pollNextEvent( vr::VROverlayHandle_t ulOverlayHandle, + vr::VREvent_t* pEvent ) { + if ( isDesktopMode() ) + { + return vr::VRSystem()->PollNextEvent( pEvent, sizeof( vr::VREvent_t ) ); + } + else + { + return vr::VROverlay()->PollNextOverlayEvent( + ulOverlayHandle, pEvent, sizeof( vr::VREvent_t ) ); + } +} + +QPoint OverlayController::getMousePositionForEvent( vr::VREvent_Mouse_t mouse ) { + float y = mouse.y; +#ifdef __linux__ + float h = static_cast( m_window.height() ); + y = h - y; +#endif + return QPoint( static_cast( mouse.x ), static_cast( y ) ); +} + +void OverlayController::mainEventLoop() { + if ( !vr::VRSystem() ) + return; + + vr::VREvent_t vrEvent; + + while ( pollNextEvent( m_ulOverlayHandle, &vrEvent ) ) { + switch ( vrEvent.eventType ) + { + case vr::VREvent_MouseMove: + { + QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse ); + if ( ptNewMouse != m_ptLastMouse ) + { + QMouseEvent mouseEvent( QEvent::MouseMove, + ptNewMouse, + m_window.mapToGlobal( ptNewMouse ), + Qt::NoButton, + m_lastMouseButtons, + nullptr ); + m_ptLastMouse = ptNewMouse; + QCoreApplication::sendEvent( &m_window, &mouseEvent ); + OnRenderRequest(); + } + } + break; + + case vr::VREvent_MouseButtonDown: + { + QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse ); + Qt::MouseButton button + = vrEvent.data.mouse.button == vr::VRMouseButton_Right + ? Qt::RightButton + : Qt::LeftButton; + m_lastMouseButtons |= button; + QMouseEvent mouseEvent( QEvent::MouseButtonPress, + ptNewMouse, + m_window.mapToGlobal( ptNewMouse ), + button, + m_lastMouseButtons, + nullptr ); + QCoreApplication::sendEvent( &m_window, &mouseEvent ); + } + break; + + case vr::VREvent_MouseButtonUp: + { + QPoint ptNewMouse = getMousePositionForEvent( vrEvent.data.mouse ); + Qt::MouseButton button + = vrEvent.data.mouse.button == vr::VRMouseButton_Right + ? Qt::RightButton + : Qt::LeftButton; + m_lastMouseButtons &= ~button; + QMouseEvent mouseEvent( QEvent::MouseButtonRelease, + ptNewMouse, + m_window.mapToGlobal( ptNewMouse ), + button, + m_lastMouseButtons, + nullptr ); + QCoreApplication::sendEvent( &m_window, &mouseEvent ); + } + break; + + case vr::VREvent_ScrollSmooth: + { + // Wheel speed is defined as 1/8 of a degree + QWheelEvent wheelEvent( + m_ptLastMouse, + m_window.mapToGlobal( m_ptLastMouse ), + QPoint(), + QPoint( static_cast( vrEvent.data.scroll.xdelta + * ( 360.0f * 8.0f ) ), + static_cast( vrEvent.data.scroll.ydelta + * ( 360.0f * 8.0f ) ) ), + 0, + Qt::Vertical, + m_lastMouseButtons, + nullptr ); + QCoreApplication::sendEvent( &m_window, &wheelEvent ); + } + break; + + case vr::VREvent_OverlayShown: + { + m_window.update(); + } + break; + + case vr::VREvent_Quit: + { + qInfo() << "Received quit request."; + vr::VRSystem()->AcknowledgeQuit_Exiting(); // Let us buy some + // time just in case + + exitApp(); + // Won't fallthrough, but also exitApp() wont, but QT won't + // acknowledge + exit( EXIT_SUCCESS ); + } + + case vr::VREvent_DashboardActivated: + { + qDebug() << "Dashboard activated"; + emit dashboardActivated(); + m_dashboardVisible = true; + } + break; + + case vr::VREvent_DashboardDeactivated: + { + qDebug() << "Dashboard deactivated"; + emit dashboardDeactivated(); + m_dashboardVisible = false; + } + break; + + case vr::VREvent_KeyboardDone: + { + qDebug() << "VREvent_KeyboardDone"; + char keyboardBuffer[1024]; + vr::VROverlay()->GetKeyboardText( keyboardBuffer, 1024 ); + qDebug() << "emit keyBoardInputSignal()"; + emit keyBoardInputSignal( QString( keyboardBuffer ), + static_cast( + vrEvent.data.keyboard.uUserValue ) ); + } + break; + } + } + + if ( m_ulOverlayThumbnailHandle != vr::k_ulOverlayHandleInvalid ) { + while ( vr::VROverlay()->PollNextOverlayEvent( + m_ulOverlayThumbnailHandle, &vrEvent, sizeof( vrEvent ) ) ) + { + switch ( vrEvent.eventType ) + { + case vr::VREvent_OverlayShown: + { + m_window.update(); + } + break; + } + } + } +} + +void OverlayController::showKeyboard(QString existingText, unsigned long userValue) +{ + if(m_desktopMode) return; + + vr::VROverlay()->ShowKeyboardForOverlay( + m_ulOverlayHandle, + vr::k_EGamepadTextInputModeNormal, + vr::k_EGamepadTextInputLineModeSingleLine, + 0, + "Wowlet VR", + 1024, + existingText.toStdString().c_str(), + userValue); + setKeyboardPos(); +} + +void OverlayController::setKeyboardPos() +{ + vr::HmdVector2_t emptyvec; + emptyvec.v[0] = 0; + emptyvec.v[1] = 0; + vr::HmdRect2_t empty; + empty.vTopLeft = emptyvec; + empty.vBottomRight = emptyvec; + vr::VROverlay()->SetKeyboardPositionForOverlay( m_ulOverlayHandle, empty ); +} + +QUrl OverlayController::getVRRuntimePathUrl() { + return m_runtimePathUrl; +} + +bool OverlayController::soundDisabled() { + return true; +} + +const vr::VROverlayHandle_t& OverlayController::overlayHandle() { + return m_ulOverlayHandle; +} + +const vr::VROverlayHandle_t& OverlayController::overlayThumbnailHandle() { + return m_ulOverlayThumbnailHandle; +} + +void OverlayController::takeQRScreenshot(const QString &previewPath, const QString &imagePath) { + vr::IVRScreenshots *screen_taker = vr::VRScreenshots(); + + vr::ScreenshotHandle_t taker_handle; + screen_taker->RequestScreenshot(&taker_handle, + vr::EVRScreenshotType::VRScreenshotType_Mono, + previewPath.toStdString().c_str(), + imagePath.toStdString().c_str() + ); +} + + +} // namespace wowletvr diff --git a/src/vr/overlaycontroller.h b/src/vr/overlaycontroller.h new file mode 100755 index 0000000..2d721c8 --- /dev/null +++ b/src/vr/overlaycontroller.h @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) OpenVR Advanced Settings + +#pragma once + +#include +#include +// because of incompatibilities with QtOpenGL and GLEW we need to cherry pick includes +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "openvr_init.h" +#include "vr/utils/paths.h" + +namespace application_strings +{ +constexpr auto applicationOrganizationName = "Wownero"; +constexpr auto applicationName = "Wowlet VR"; +constexpr const char* applicationKey = "steam.overlay.1001337"; +constexpr const char* applicationDisplayName = "Wowlet VR"; + +constexpr const char* applicationVersionString = "1337"; + +} // namespace application_strings + +constexpr int k_nonVsyncTickRate = 20; + +// application namespace +namespace wowletvr +{ + +class OverlayController : public QObject +{ + Q_OBJECT + Q_PROPERTY( bool m_desktopMode READ isDesktopMode ) + +public: + OverlayController(bool desktopMode, QQmlEngine& qmlEngine); + virtual ~OverlayController(); + + void Shutdown(); + + Q_INVOKABLE void exitApp(); + void takeQRScreenshot(const QString &previewPath, const QString &imagePath); + + bool isDashboardVisible() + { + return m_dashboardVisible; + } + + void SetWidget(QQuickItem* quickItem, const std::string& name, const std::string& key = "", const std::string& iconPath = ""); + + bool isDesktopMode() + { + return m_desktopMode; + } + + Q_INVOKABLE QUrl getVRRuntimePathUrl(); + Q_INVOKABLE bool soundDisabled(); + + const vr::VROverlayHandle_t& overlayHandle(); + const vr::VROverlayHandle_t& overlayThumbnailHandle(); + + bool pollNextEvent(vr::VROverlayHandle_t ulOverlayHandle, vr::VREvent_t* pEvent ); + void mainEventLoop(); + +private: + vr::VROverlayHandle_t m_ulOverlayHandle = vr::k_ulOverlayHandleInvalid; + vr::VROverlayHandle_t m_ulOverlayThumbnailHandle + = vr::k_ulOverlayHandleInvalid; + + QQuickRenderControl m_renderControl; + QQuickWindow m_window{ &m_renderControl }; + std::unique_ptr m_pFbo; + QOpenGLContext m_openGLContext; + QOffscreenSurface m_offscreenSurface; + + std::unique_ptr m_pRenderTimer; + bool m_dashboardVisible = false; + + QPoint m_ptLastMouse; + Qt::MouseButtons m_lastMouseButtons = nullptr; + + bool m_desktopMode; + + QUrl m_runtimePathUrl; + + uint64_t m_customTickRateCounter = 0; + uint64_t m_currentFrame = 0; + uint64_t m_lastFrame = 0; + + QNetworkAccessManager* netManager = new QNetworkAccessManager( this ); + QJsonDocument m_remoteVersionJsonDocument = QJsonDocument(); + QJsonObject m_remoteVersionJsonObject; + +private: + QPoint getMousePositionForEvent( vr::VREvent_Mouse_t mouse ); + + bool m_exclusiveState = false; + bool m_keyPressOneState = false; + bool m_keyPressTwoState = false; + +public slots: + void renderOverlay(); + void OnRenderRequest(); + + void showKeyboard( QString existingText, unsigned long userValue = 0 ); + void setKeyboardPos(); + +signals: + void keyBoardInputSignal( QString input, unsigned long userValue = 0 ); + void dashboardDeactivated(); + void dashboardActivated(); +}; + +} // namespace wowletvr diff --git a/src/vr/qml.qrc b/src/vr/qml.qrc new file mode 100644 index 0000000..bb9a3c4 --- /dev/null +++ b/src/vr/qml.qrc @@ -0,0 +1,86 @@ + + + assets/img/common/backarrow.svg + assets/img/common/check.svg + assets/img/audio/speaker/speaker_on.svg + assets/img/audio/speaker/speaker_off.svg + assets/img/audio/media_keys/outline_play_pause_white_24dp.svg + assets/img/audio/media_keys/outline_skip_next_white_24dp.svg + assets/img/audio/media_keys/outline_skip_previous_white_24dp.svg + assets/img/audio/media_keys/outline_stop_white_24dp.svg + assets/img/main_menu_icons/audio_tab_icon.svg + assets/img/main_menu_icons/bindings_tab_icon.svg + assets/img/main_menu_icons/chaperone_tab_icon.svg + assets/img/main_menu_icons/motion_tab_icon.svg + assets/img/main_menu_icons/offsets_tab_icon.svg + assets/img/main_menu_icons/settings_tab_icon.svg + assets/img/main_menu_icons/space_fix_tab_icon.svg + assets/img/main_menu_icons/statistics_tab_icon.svg + assets/img/main_menu_icons/steamvr_tab_icon.svg + assets/img/main_menu_icons/utilities_tab_icon.svg + assets/img/main_menu_icons/video_tab_icon.svg + assets/img/main_menu_icons/rotation_tab_icon.svg + assets/img/send.png + assets/img/receive.svg + assets/img/info.png + assets/img/confirmed.png + assets/img/expired.png + assets/img/illuminati.png + assets/img/chest.png + assets/img/tutorial.png + assets/img/wizard.png + assets/img/hypnotoad.png + assets/img/grass.png + assets/img/dog.gif + assets/img/dog2.gif + assets/img/cpus.png + + assets/img/status_disconnected.svg + assets/img/status_connected.svg + assets/img/status_waiting.svg + assets/img/status_lagging.svg + assets/themes.json + + main.qml + qml/common/HourComboBox.qml + qml/common/MinuteSecondComboBox.qml + qml/common/MyDialogOkCancelPopup.qml + qml/common/MyResources.qml + qml/common/MyTextField.qml + qml/common/MyRadioButton.qml + qml/common/MyDialogOkPopup.qml + qml/common/MyPushButton2.qml + qml/common/MyComboBox.qml + qml/common/TimeAssembly.qml + qml/common/LineSeparator.qml + qml/common/FullWidthSliderBox.qml + qml/common/MyText.qml + qml/common/MyToggleButton.qml + qml/common/MyPushButton.qml + qml/common/Style.qml + qml/common/qmldir + qml/common/MySlider.qml + qml/common/mainwidget.qml + qml/common/MyNumPad.qml + qml/common/MyNumPadButton.qml + qml/common/MyNumPadSendAmount.qml + qml/common/MyStackViewPage.qml + qml/common/ImageMask.qml + qml/wallet/ReceivePage.qml + qml/wallet/HistoryTable.qml + qml/wallet/WalletDashBoardPage.qml + + qml/DashboardPage.qml + qml/WalletPage.qml + qml/AboutPage.qml + qml/SettingsPage.qml + + qml/wallet/send/SendPage.qml + qml/wallet/send/SendPageDashboard.qml + qml/wallet/send/SendPageDashboardButton.qml + qml/wallet/send/SendPageNavBack.qml + qml/wallet/send/SendPagePIN.qml + qml/wallet/send/SendPageQR.qml + qml/wallet/send/SendPageTransfer.qml + + \ No newline at end of file diff --git a/src/vr/qml.rcc b/src/vr/qml.rcc new file mode 100644 index 0000000..4156b55 Binary files /dev/null and b/src/vr/qml.rcc differ diff --git a/src/vr/qml/AboutPage.qml b/src/vr/qml/AboutPage.qml new file mode 100644 index 0000000..3829290 --- /dev/null +++ b/src/vr/qml/AboutPage.qml @@ -0,0 +1,84 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import "." +import "common" + +ColumnLayout { + id: root + spacing: 30 + width: 1600 + height: 800 + + RowLayout { + Layout.topMargin: 40 + Layout.leftMargin: 40 + Layout.rightMargin: 40 + Layout.fillWidth: true + Layout.preferredHeight: 200 + + ColumnLayout { + Layout.preferredWidth: 256 + Layout.maximumWidth: 256 + + Image { + Layout.preferredHeight: 256 + Layout.preferredWidth: 256 + + source: "qrc:/illuminati" + } + } + + ColumnLayout { + Layout.preferredWidth: 256 + + MyText { + Layout.leftMargin: 40 + Layout.rightMargin: 40 + Layout.fillWidth: true + text: "Wowlet VR is an alternative QML interface for wowlet and was made over a 4 week period eating lots of pizzas. It is the world's first cryptocurrency wallet with support for VR. Wowlet is Free and open-source (BSD-3) software and the source code can be studied on git.wownero.com/wowlet/wowlet" + wrap: true + } + } + } + + MyText { + Layout.leftMargin: 40 + Layout.rightMargin: 40 + Layout.fillWidth: true + fontSize: 21 + text: "Shoutouts: matzman666, qvqc, ez, Gatto, RAGEHAÜZ, cisme, wowario, lza_menace, jwinterm, nioc, asymptotically, azy, selsta, kico, laura, thrmo, GNVR, solar, bl4sty, scoobybejesus, Valve Corporation for OpenVR" + wrap: true + } + + MyText { + Layout.leftMargin: 40 + Layout.rightMargin: 40 + Layout.fillWidth: true + fontSize: 21 + text: "dsc - April 2021" + wrap: true + } + + MyPushButton { + text: "Back" + Layout.leftMargin: 40 + Layout.preferredWidth: 220 + + onClicked: { + mainView.pop(); + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + function onPageCompleted(previousView){ + + } +} + +// OverlayController.exitApp(); diff --git a/src/vr/qml/DashboardPage.qml b/src/vr/qml/DashboardPage.qml new file mode 100644 index 0000000..dd7fe54 --- /dev/null +++ b/src/vr/qml/DashboardPage.qml @@ -0,0 +1,198 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import wowlet.NetworkType 1.0 +import wowlet.WalletKeysFiles 1.0 + +import "." +import "common" + +ColumnLayout { + id: root + width: 1600 + height: 800 + + property var walletList: []; + + Layout.fillWidth: true + Layout.fillHeight: true + + ColumnLayout { + Layout.fillWidth: true + Layout.preferredHeight: 128 + Layout.leftMargin: 40 + Layout.rightMargin: 40 + + RowLayout { + MyText { + text: "Welcome to Wowlet VR" + font.pointSize: 36 + Layout.leftMargin: 0 + } + + Item { + Layout.fillWidth: true + Layout.preferredHeight: 50 + } + + Rectangle { + Layout.preferredWidth: 720 + Layout.preferredHeight: 50 + color: "transparent" + + MyText{ + anchors.right: parent.right + anchors.bottom: parent.bottom + fontSize: 21 + text: "Version beta (Qt " + qtRuntimeVersion + ")" + } + } + } + + Rectangle { + color: Style.dividerColor + height: 1 + Layout.topMargin: 10 + Layout.fillWidth: true + } + } + + Flow { + id: flow + spacing: 20 + clip: true + + property int itemHeight: 192 + property int maxRows: 6 + + Layout.topMargin: 30 + Layout.fillWidth: true + Layout.leftMargin: 40 + + + Repeater { + id: recentList + clip: true + model: walletList + + delegate: Rectangle { + id: item + property var currentItem: walletList[index] + property bool settings: currentItem.hasOwnProperty("settings") + property bool create: currentItem.hasOwnProperty("create") + property bool exit: currentItem.hasOwnProperty("exit") + color: Style.btnMainMenuBackground + height: 242 + width: 232 + + Image { + width: 158 + height: 158 + anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom + anchors.bottomMargin: 10 + source: { + if(settings) { + return "qrc:/hypnotoad"; + } else if(create) { + return "qrc:/wizard"; + } else if(exit) { + return "qrc:/tutorial"; + } else { + return "qrc:/chest"; + } + } + } + + Text { + id: btnText + color: Style.btnTextColor + text: { + if(settings) { + return "Settings"; + } else if(create) { + return "Create wallet"; + } else if(exit) { + return "Exit"; + } else { + return currentItem['fileName'].replace(".keys", ""); + } + } + font.pointSize: 21 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + anchors.topMargin: 14 + anchors.leftMargin: 14 + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + + onEntered: { + parent.color = Style.btnPressedColor; + btnText.color = Style.btnTextHoverColor; + } + onExited: { + parent.color = Style.btnMainMenuBackground; + btnText.color = Style.btnTextColor; + } + onClicked: { + if(settings) { + mainView.push(settingsPage); + } else if(create) { + createWalletDialog.openPopup(); + } else if(exit) { + OverlayController.exitApp(); + } else { + appWindow.walletPath = currentItem['path']; + ctx.onOpenWallet(currentItem['path'], ""); + } + } + } + } + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + function onPageCompleted(previousView){ + console.log("list wallets"); + + root.walletList = []; + let wallets = []; + if(typeof ctx !== 'undefined') + wallets = ctx.listWallets(); + + let _walletList = []; + + for(var i = 0; i != wallets.length; i++) { + if(i == 9) // draw 10 items at any time + break; + _walletList.push(wallets[i]); + } + + _walletList.push({"create": true}); + _walletList.push({"settings": true}); + _walletList.push({"exit": true}); + + root.walletList = _walletList; + } + + Connections { + target: appWindow + function onAboutClicked() { + mainView.push(aboutPage); + } + + function onRedraw() { + console.log("hooray"); + onPageCompleted(1); + } + } +} diff --git a/src/vr/qml/SettingsPage.qml b/src/vr/qml/SettingsPage.qml new file mode 100644 index 0000000..287f7be --- /dev/null +++ b/src/vr/qml/SettingsPage.qml @@ -0,0 +1,168 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import "." +import "common" + +ColumnLayout { + id: root + property bool needsRestart: false + + spacing: 30 + Layout.fillHeight: true + Layout.fillWidth: true + + ColumnLayout { + spacing: 30 + Layout.topMargin: 40 + Layout.fillWidth: true + Layout.leftMargin: 40 + Layout.rightMargin: 40 + + MyText { + Layout.fillWidth: true + fontSize: 26 + text: "Settings" + wrap: true + } + + Rectangle { + color: Style.dividerColor + height: 1 + Layout.topMargin: 10 + Layout.fillWidth: true + } + + RowLayout { + spacing: 30 + + MyText { + text: "Theme" + } + + MyComboBox { + id: themeCombo + Layout.preferredHeight: 60 + Layout.preferredWidth: 378 + + displayText: "-" + + model: [""] + + delegate: ItemDelegate { + width: parent.width + text: modelData.text + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? Style.fontColor : Style.fontColorDimmed + } + background: Rectangle { + color: parent.pressed ? "#406288" : (parent.hovered ? "#365473" : "#2c435d") + } + } + + onCurrentIndexChanged: { + displayText = themeCombo.model[currentIndex]["text"]; + if(displayText !== "" && displayText !== appWindow.theme) { + appWindow.changeTheme(displayText); + needsRestart = true; + } + } + } + } + + RowLayout { + spacing: 30 + + MyText { + text: "Streamer mode (" + (appWindow.streamerMode ? "ON" : "OFF") + ")" + } + + RowLayout { + spacing: 20 + Layout.fillWidth: true + Layout.preferredHeight: 56 + + MyPushButton { + Layout.preferredWidth: 100 + enabled: !appWindow.streamerMode + opacity: !appWindow.streamerMode ? 1.0 : 0.3 + text: "On" + onClicked: { + appWindow.streamerMode = !appWindow.streamerMode; + WowletVR.setStreamerMode(appWindow.streamerMode); + } + } + + MyPushButton { + Layout.preferredWidth: 100 + enabled: appWindow.streamerMode + opacity: appWindow.streamerMode ? 1.0 : 0.3 + text: "Off" + + onClicked: { + appWindow.streamerMode = !appWindow.streamerMode; + WowletVR.setStreamerMode(appWindow.streamerMode); + } + } + } + } + } + + Component.onCompleted: { + } + + MyDialogOkPopup { + id: restartPopup + dialogTitle: "Restart required" + dialogText: "WowletVR needs a restart to load the theme. Exiting." + onClosed: { + OverlayController.exitApp(); + } + } + + MyPushButton { + text: "Back" + Layout.leftMargin: 40 + Layout.preferredWidth: 220 + + onClicked: { + if(root.needsRestart) { + restartPopup.open(); + } else { + mainView.pop(); + } + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + function onPageCompleted(previousView){ + + } + + Connections { + target: appWindow + + function onInitTheme() { + // populate combobox + let themeComboBoxItems = [{ value: 0, text: ""}]; + for (let _theme in appWindow.themes){ + if (!appWindow.themes.hasOwnProperty(_theme)) + continue; + themeComboBoxItems.push({ value: 0, text: _theme }); + } + themeCombo.model = themeComboBoxItems; + themeCombo.displayText = appWindow.theme; + } + } +} + +// OverlayController.exitApp(); diff --git a/src/vr/qml/WalletPage.qml b/src/vr/qml/WalletPage.qml new file mode 100755 index 0000000..48d72bc --- /dev/null +++ b/src/vr/qml/WalletPage.qml @@ -0,0 +1,81 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 + +import "." +import "common" +import "wallet" +import "wallet/send" + + +Rectangle { + width: 1600 + height: 800 + color: "transparent" + + property WalletDashBoardPage walletDashboardPage: WalletDashBoardPage { + stackView: walletView + visible: false + } + + property SendPage sendPage: SendPage { + stackView: walletView + visible: false + } + + property ReceivePage receivePage: ReceivePage { + stackView: walletView + visible: false + } + + StackView { + id: walletView + anchors.fill: parent + initialItem: walletDashboardPage + + pushEnter: Transition { + PropertyAnimation { + property: "x" + from: walletView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + pushExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: -walletView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + popEnter: Transition { + PropertyAnimation { + property: "x" + from: -walletView.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + } + popExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: walletView.width + duration: 300 + easing.type: Easing.OutCubic + } + } + } + + function onPageCompleted() { + walletDashboardPage.onPageCompleted(); + } +} diff --git a/src/vr/qml/common/BackgroundGradientDebug.qml b/src/vr/qml/common/BackgroundGradientDebug.qml new file mode 100644 index 0000000..021a516 --- /dev/null +++ b/src/vr/qml/common/BackgroundGradientDebug.qml @@ -0,0 +1,96 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import "." + +// This file is used to debug the background gradient animation and can be ignored. + +ColumnLayout { + property int start_x: 0 + property int start_y: 64 + property int end_x: 1080 + property int end_y: 416 + + visible: false + width: parent.width + height: parent.height + + MyText { + fontColor: "red" + text: "start_x: " + start_x + } + + MySlider { + from: 0 + to: 1600 + value: start_x + Layout.fillWidth: true + Layout.preferredHeight: 40 + + onValueChanged: { + appWindow.start_x = value; + } + } + + MyText { + fontColor: "red" + text: "start_y: " + start_y + } + + MySlider { + from: 0 + to: 1600 + value: start_y + Layout.fillWidth: true + Layout.preferredHeight: 40 + + onValueChanged: { + appWindow.start_y = value; + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + MyText { + fontColor: "red" + text: "end_x: " + end_x + } + + MySlider { + from: 0 + to: 1600 + value: end_x + Layout.fillWidth: true + Layout.preferredHeight: 40 + + onValueChanged: { + appWindow.end_x = value; + } + } + + MyText { + fontColor: "red" + text: "end_y: " + end_y + } + + MySlider { + from: 0 + to: 1600 + value: end_y + Layout.fillWidth: true + Layout.preferredHeight: 40 + + onValueChanged: { + appWindow.end_y = value; + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } +} \ No newline at end of file diff --git a/src/vr/qml/common/FullWidthSliderBox.qml b/src/vr/qml/common/FullWidthSliderBox.qml new file mode 100755 index 0000000..c8df999 --- /dev/null +++ b/src/vr/qml/common/FullWidthSliderBox.qml @@ -0,0 +1,93 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + + +GroupBox { + // Public properties + // Overload + property alias headerMessage: headerText.text + property alias sliderText: steamDesktopForwardText.text + property alias sliderValue: steamDesktopForwardSlider.value + property alias lowerLimit: steamDesktopForwardSlider.from + property alias upperLimit: steamDesktopForwardSlider.to + property alias kbUID: steamDesktopForwardText.keyBoardUID + + + function onValueChanged(value) { + + } + + function onComponentComplete() { + + } + + + // Private properties + id: sliderBox + Layout.fillWidth: true + label: MyText { + id: headerText + leftPadding: 10 + text: "MISSING HEADER TEXT" + bottomPadding: -10 + } + background: Rectangle { + color: "transparent" + border.color: "#ffffff" + radius: 8 + } + + property real sliderStepSize: 0.10 + readonly property real rightLeftLimit: 4.0 + + ColumnLayout { + anchors.fill: parent + + LineSeparator { + } + + ColumnLayout { + RowLayout { + MyPushButton2 { + Layout.preferredWidth: 40 + text: "-" + onClicked: { + steamDesktopForwardSlider.value -= sliderStepSize + } + } + + MySlider { + id: steamDesktopForwardSlider + from: -rightLeftLimit + to: rightLeftLimit + stepSize: sliderStepSize + Layout.fillWidth: true + onValueChanged: { + sliderBox.onValueChanged(this.value) + } + } + + MyPushButton2 { + Layout.preferredWidth: 40 + text: "+" + onClicked: { + steamDesktopForwardSlider.value += sliderStepSize + } + } + + MyTextField { + id: steamDesktopForwardText + text: "0.0" + keyBoardUID: 611 + Layout.preferredWidth: 100 + Layout.leftMargin: 10 + horizontalAlignment: Text.AlignHCenter + } + } + } + } + Component.onCompleted: { + sliderBox.onComponentComplete() + } +} diff --git a/src/vr/qml/common/HourComboBox.qml b/src/vr/qml/common/HourComboBox.qml new file mode 100755 index 0000000..8d7655b --- /dev/null +++ b/src/vr/qml/common/HourComboBox.qml @@ -0,0 +1,49 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + + +MyComboBox { + + model: [ + { value: 0, text: "00" }, + { value: 1, text: "01" }, + { value: 2, text: "02" }, + { value: 3, text: "03" }, + { value: 4, text: "04" }, + { value: 5, text: "05" }, + { value: 6, text: "06" }, + { value: 7, text: "07" }, + { value: 8, text: "08" }, + { value: 9, text: "09" }, + { value: 10, text: "10" }, + { value: 11, text: "11" }, + { value: 12, text: "12" }, + { value: 13, text: "13" }, + { value: 14, text: "14" }, + { value: 15, text: "15" }, + { value: 16, text: "16" }, + { value: 17, text: "17" }, + { value: 18, text: "18" }, + { value: 19, text: "19" }, + { value: 20, text: "20" }, + { value: 21, text: "21" }, + { value: 22, text: "22" }, + { value: 23, text: "23" }, + ] + + delegate: ItemDelegate { + width: parent.width + text: modelData.text + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? "#ffffff" : "#909090" + } + background: Rectangle { + color: parent.pressed ? "#406288" : (parent.hovered ? "#365473" : "#2c435d") + } + } +} diff --git a/src/vr/qml/common/ImageMask.qml b/src/vr/qml/common/ImageMask.qml new file mode 100644 index 0000000..dc51d79 --- /dev/null +++ b/src/vr/qml/common/ImageMask.qml @@ -0,0 +1,36 @@ +// Copyright (c) 2014-2019, The Monero Project + +import QtQuick 2.9 +import QtGraphicalEffects 1.0 + +Item { + // Use this component to color+opacity change images with transparency (svg/png) + // Does not work in low graphics mode, use fontAwesome fallback option. + + id: root + property string image: "" + property string color: "" + + property alias svgMask: svgMask + property alias imgMockColor: imgMockColor + + width: 0 + height: 0 + + Image { + id: svgMask + source: root.image + sourceSize.width: root.width + sourceSize.height: root.height + smooth: true + mipmap: true + visible: false + } + + ColorOverlay { + id: imgMockColor + anchors.fill: root + source: svgMask + color: root.color + } +} diff --git a/src/vr/qml/common/LineSeparator.qml b/src/vr/qml/common/LineSeparator.qml new file mode 100755 index 0000000..13656cf --- /dev/null +++ b/src/vr/qml/common/LineSeparator.qml @@ -0,0 +1,15 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +// Necessary for the project specific Components. +import ".." + +// Insert inside a ColumnLayout containing this and a RowLayout +// to neatly separate header and buttons. +Rectangle { + color: "#ffffff" + height: 1 + Layout.fillWidth: true + Layout.bottomMargin: 5 +} diff --git a/src/vr/qml/common/MinuteSecondComboBox.qml b/src/vr/qml/common/MinuteSecondComboBox.qml new file mode 100755 index 0000000..786282f --- /dev/null +++ b/src/vr/qml/common/MinuteSecondComboBox.qml @@ -0,0 +1,85 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + + +MyComboBox { + + model: [ + { value: 0, text: "00" }, + { value: 1, text: "01" }, + { value: 2, text: "02" }, + { value: 3, text: "03" }, + { value: 4, text: "04" }, + { value: 5, text: "05" }, + { value: 6, text: "06" }, + { value: 7, text: "07" }, + { value: 8, text: "08" }, + { value: 9, text: "09" }, + { value: 10, text: "10" }, + { value: 11, text: "11" }, + { value: 12, text: "12" }, + { value: 13, text: "13" }, + { value: 14, text: "14" }, + { value: 15, text: "15" }, + { value: 16, text: "16" }, + { value: 17, text: "17" }, + { value: 18, text: "18" }, + { value: 19, text: "19" }, + { value: 20, text: "20" }, + { value: 21, text: "21" }, + { value: 22, text: "22" }, + { value: 23, text: "23" }, + { value: 24, text: "24" }, + { value: 25, text: "25" }, + { value: 26, text: "26" }, + { value: 27, text: "27" }, + { value: 28, text: "28" }, + { value: 29, text: "29" }, + { value: 30, text: "30" }, + { value: 31, text: "31" }, + { value: 32, text: "32" }, + { value: 33, text: "33" }, + { value: 34, text: "34" }, + { value: 35, text: "35" }, + { value: 36, text: "36" }, + { value: 37, text: "37" }, + { value: 38, text: "38" }, + { value: 39, text: "39" }, + { value: 40, text: "40" }, + { value: 41, text: "41" }, + { value: 42, text: "42" }, + { value: 43, text: "43" }, + { value: 44, text: "44" }, + { value: 45, text: "45" }, + { value: 46, text: "46" }, + { value: 47, text: "47" }, + { value: 48, text: "48" }, + { value: 49, text: "49" }, + { value: 50, text: "50" }, + { value: 51, text: "51" }, + { value: 52, text: "52" }, + { value: 53, text: "53" }, + { value: 54, text: "54" }, + { value: 55, text: "55" }, + { value: 56, text: "56" }, + { value: 57, text: "57" }, + { value: 58, text: "58" }, + { value: 59, text: "59" } + ] + + delegate: ItemDelegate { + width: parent.width + text: modelData.text + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? "#ffffff" : "#909090" + } + background: Rectangle { + color: parent.pressed ? "#406288" : (parent.hovered ? "#365473" : "#2c435d") + } + } +} diff --git a/src/vr/qml/common/MyComboBox.qml b/src/vr/qml/common/MyComboBox.qml new file mode 100755 index 0000000..6385cb3 --- /dev/null +++ b/src/vr/qml/common/MyComboBox.qml @@ -0,0 +1,73 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file + + +ComboBox { + id: myComboBox + hoverEnabled: true + background: Rectangle { + color: parent.pressed ? "#406288" : (parent.activeFocus ? "#365473" : "#2c435d") + } + + contentItem: MyText { + leftPadding: 0 + rightPadding: parent.indicator.width + parent.spacing + text: parent.displayText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + elide: Text.ElideRight + } + + delegate: ItemDelegate { + width: myComboBox.width + text: modelData + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? Style.fontColor : Style.fontColorDimmed + } + background: Rectangle { + color: parent.pressed ? "#406288" : (parent.hovered ? "#365473" : "#2c435d") + } + } + + indicator: Canvas { + x: parent.width - width - parent.rightPadding + y: parent.topPadding + (parent.availableHeight - height) / 2 + width: 13 + height: 7 + contextType: "2d" + + onPaint: { + if (!context) { + getContext("2d") + } + context.reset(); + context.lineWidth = 2 + context.moveTo(1, 1); + context.lineTo(Math.ceil(width / 2), height - 1); + context.lineTo(width - 1, 1); + context.strokeStyle = "#ffffff" + context.stroke() + } + } + + onHoveredChanged: { + if (hovered) { + forceActiveFocus() + } + } + + // onActivated: { + // if (activeFocus) { + // MyResources.playActivationSound() + // } + // } + + Component.onCompleted: { + popup.background.color = "#2c435d" + } +} diff --git a/src/vr/qml/common/MyDialogOkCancelPopup.qml b/src/vr/qml/common/MyDialogOkCancelPopup.qml new file mode 100755 index 0000000..3c799cf --- /dev/null +++ b/src/vr/qml/common/MyDialogOkCancelPopup.qml @@ -0,0 +1,102 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import "." + +Popup { + id: myDialogPopup + + implicitHeight: parent.height + implicitWidth: parent.width + + property string dialogTitle: "" + property string dialogText: "" + property int dialogWidth: 600 + property int dialogHeight: 300 + + property Item dialogContentItem: MyText { + text: dialogText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true + fontColor: Style.fontColor + } + + property bool okClicked: false + + closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent + + background: Rectangle { + anchors.left: parent.left + anchors.right: parent.right + color: "black" + opacity: 0.8 + } + + contentItem: Item { + Rectangle { + implicitWidth: dialogWidth + implicitHeight: dialogHeight + anchors.centerIn: parent + radius: 36 + color: Style.backgroundColor + border.color: Style.fontColorDimmed + border.width: 2 + ColumnLayout { + anchors.fill: parent + anchors.margins: 12 + MyText { + Layout.leftMargin: 16 + Layout.rightMargin: 16 + text: dialogTitle + } + Rectangle { + color: Style.fontColorDimmed + height: 1 + Layout.fillWidth: true + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + ColumnLayout { + id: dialogContent + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + RowLayout { + Layout.fillWidth: true + Layout.leftMargin: 24 + Layout.rightMargin: 24 + Layout.bottomMargin: 12 + MyPushButton { + implicitWidth: 200 + text: "Ok" + onClicked: { + okClicked = true + myDialogPopup.close() + } + } + Item { + Layout.fillWidth: true + } + MyPushButton { + implicitWidth: 200 + text: "Cancel" + onClicked: { + okClicked = false + myDialogPopup.close() + } + } + } + } + } + } + + Component.onCompleted: { + dialogContentItem.parent = dialogContent + } +} diff --git a/src/vr/qml/common/MyDialogOkPopup.qml b/src/vr/qml/common/MyDialogOkPopup.qml new file mode 100755 index 0000000..e7fdc85 --- /dev/null +++ b/src/vr/qml/common/MyDialogOkPopup.qml @@ -0,0 +1,98 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import "." + +Popup { + id: myDialogPopup + property bool dismissible: true + + implicitHeight: parent.height + implicitWidth: parent.width + + property string dialogTitle: "" + property string dialogText: "" + property int dialogWidth: 900 + property int dialogHeight: 300 + + property Item dialogContentItem: MyText { + fontSize: 36 + text: dialogText + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + Layout.fillWidth: true + wrap: true + } + + property bool okClicked: false + + closePolicy: myDialogPopup.dismissible ? Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent : Popup.NoAutoClose + + background: Rectangle { + color: "black" + opacity: 0.8 + } + + contentItem: Item { + Rectangle { + implicitWidth: dialogWidth + implicitHeight: dialogHeight + anchors.centerIn: parent + radius: 24 + color: Style.backgroundColor + border.color: Style.fontColorDimmed + border.width: 2 + ColumnLayout { + anchors.fill: parent + anchors.margins: 12 + MyText { + Layout.leftMargin: 16 + Layout.rightMargin: 16 + text: dialogTitle + } + Rectangle { + color: Style.fontColorDimmed + height: 1 + Layout.fillWidth: true + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + ColumnLayout { + id: dialogContent + } + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + RowLayout { + visible: myDialogPopup.dismissible + Layout.fillWidth: true + Layout.leftMargin: 24 + Layout.rightMargin: 24 + Layout.bottomMargin: 12 + Item { + Layout.fillWidth: true + } + MyPushButton { + implicitWidth: 200 + text: "Ok" + onClicked: { + okClicked = true + myDialogPopup.close() + } + } + Item { + Layout.fillWidth: true + } + } + } + } + } + + Component.onCompleted: { + dialogContentItem.parent = dialogContent + } +} diff --git a/src/vr/qml/common/MyNumPad.qml b/src/vr/qml/common/MyNumPad.qml new file mode 100644 index 0000000..7e8b5f4 --- /dev/null +++ b/src/vr/qml/common/MyNumPad.qml @@ -0,0 +1,137 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import "." + +ColumnLayout { + id: root + enabled: true + spacing: 16 + + property double disabledOpacity: 0.4 + property bool compact: false + + signal resolvePressed(); + signal buttonPress(string val); + signal clearPress(); + + RowLayout { + spacing: 18 + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "1" + onClicked: { + buttonPress("1"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "2" + onClicked: { + buttonPress("2"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "3" + onClicked: { + buttonPress("3"); + } + } + } + + RowLayout { + spacing: 18 + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "4" + onClicked: { + buttonPress("4"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "5" + onClicked: { + buttonPress("5"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "6" + onClicked: { + buttonPress("6"); + } + } + } + + RowLayout { + spacing: 18 + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "7" + onClicked: { + buttonPress("7"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "8" + onClicked: { + buttonPress("8"); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "9" + onClicked: { + buttonPress("9"); + } + } + } + + RowLayout { + spacing: 18 + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + text: "0" + onClicked: { + buttonPress("0"); + } + } + + MyNumPadButton { + visible: root.compact + opacity: root.enabled ? 1 : disabledOpacity + text: "." + onClicked: { + buttonPress("."); + } + } + + MyNumPadButton { + opacity: root.enabled ? 1 : disabledOpacity + + Layout.preferredWidth: root.compact ? 106 : 230 + fontSize: 36 + text: root.compact ? "C" : "Clear" + onClicked: { + clearPress(); + } + } + } + + function reset() { + + } +} diff --git a/src/vr/qml/common/MyNumPadButton.qml b/src/vr/qml/common/MyNumPadButton.qml new file mode 100644 index 0000000..9fc7508 --- /dev/null +++ b/src/vr/qml/common/MyNumPadButton.qml @@ -0,0 +1,48 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +Rectangle { + id: root + property string text: "" + property int fontSize: 32 + property alias mouseArea: mouseArea + property alias btnTextColor: btnText.fontColor + + signal clicked; + + Layout.preferredWidth: 106 + Layout.preferredHeight: 106 + color: Style.btnExitedColor + + MyText { + id: btnText + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + fontColor: Style.btnTextColor + text: root.text + fontSize: root.fontSize + fontBold: true + } + + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onEntered: { + parent.color = Style.btnEnteredColor + btnText.color = Style.btnTextHoverColor + } + onExited: { + parent.color = Style.btnExitedColor + btnText.color = Style.btnTextColor + } + onPressed: { + parent.color = Style.btnPressedColor + btnText.color = Style.btnTextHoverColor + } + onClicked: { + root.clicked(); + } + } +} \ No newline at end of file diff --git a/src/vr/qml/common/MyNumPadSendAmount.qml b/src/vr/qml/common/MyNumPadSendAmount.qml new file mode 100644 index 0000000..5319a79 --- /dev/null +++ b/src/vr/qml/common/MyNumPadSendAmount.qml @@ -0,0 +1,173 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import "." + +RowLayout { + id: root + property double amount: 0.0; + property bool add: true; + + signal amountUpdated(double amount); + + spacing: 24 + + function reset() { + root.amount = 0.0; + } + + MyNumPadButton { + id: minButton + mouseArea.enabled: false + fontSize: 18 + + Layout.preferredWidth: 128 + Layout.preferredHeight: 112 + + color: root.add ? Style.btnExitedColor : Style.btnPressedColor + btnTextColor: !root.add ? Style.btnTextHoverColor : Style.btnTextColor + text: "-" + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + if(!root.add) return; + parent.color = Style.btnPressedColor + parent.btnTextColor = Style.btnTextHoverColor + } + onExited: { + if(!root.add) return; + parent.color = Style.btnExitedColor + Style.btnTextHoverColor + } + onClicked: { + root.add = false; + plusButton.color = Style.btnExitedColor + plusButton.btnTextColor = Style.btnTextColor; + } + } + } + + MyNumPadButton { + id: plusButton + mouseArea.enabled: false + fontSize: 18 + + Layout.preferredWidth: 128 + Layout.preferredHeight: 112 + + color: root.add ? Style.btnPressedColor : Style.btnExitedColor + btnTextColor: root.add ? Style.btnTextHoverColor : Style.btnTextColor + text: "+" + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + if(root.add) return; + parent.color = Style.btnPressedColor + parent.btnTextColor = Style.btnTextHoverColor + } + onExited: { + if(root.add) return; + parent.color = Style.btnExitedColor + } + onClicked: { + root.add = true; + minButton.color = Style.btnExitedColor + minButton.btnTextColor = Style.btnTextColor; + } + } + } + + Rectangle { + color: Style.fontColorDimmed + width: 1 + Layout.fillHeight: true + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 180 + Layout.preferredHeight: 112 + text: "0.001" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 0.001) : root.amount = WowletVR.sub(root.amount, 0.001); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 148 + Layout.preferredHeight: 112 + text: "0.01" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 0.01) : root.amount = WowletVR.sub(root.amount, 0.01); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 128 + Layout.preferredHeight: 112 + text: "0.1" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 0.1) : root.amount = WowletVR.sub(root.amount, 0.1); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 128 + Layout.preferredHeight: 112 + text: "1" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 1.0) : root.amount = WowletVR.sub(root.amount, 1.0); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 168 + Layout.preferredHeight: 112 + text: "10" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 10.0) : root.amount = WowletVR.sub(root.amount, 10.0); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 128 + Layout.preferredHeight: 112 + text: "100" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 100.0) : root.amount = WowletVR.sub(root.amount, 100.0); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } + + MyNumPadButton { + fontSize: 18 + Layout.preferredWidth: 168 + Layout.preferredHeight: 112 + text: "1000" + onClicked: { + root.add ? root.amount = WowletVR.add(root.amount, 1000.0) : root.amount = WowletVR.sub(root.amount, 1000.0); + if(root.amount <= 0.0) root.amount = 0.0; + amountUpdated(root.amount); + } + } +} \ No newline at end of file diff --git a/src/vr/qml/common/MyPushButton.qml b/src/vr/qml/common/MyPushButton.qml new file mode 100755 index 0000000..bbe499a --- /dev/null +++ b/src/vr/qml/common/MyPushButton.qml @@ -0,0 +1,85 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file + +Item { + id: root + property string text: "-" + property string iconPath: "" + property bool hasIcon: iconPath !== "" + property bool hoverEnabled: true + property bool activationSoundEnabled: true + property string enteredColor: Style.btnEnteredColor + property string exitedColor: Style.btnExitedColor + property string pressedColor: Style.btnPressedColor + signal clicked; + + Layout.preferredHeight: 70 + + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + Layout.minimumHeight: 54 + + // Image { + // visible: hasIcon + // source: iconPath + // Layout.leftMargin: 20 + // Layout.rightMargin: 20 + // Layout.preferredWidth: 32 + // Layout.preferredHeight: 32 + // } + + ImageMask { + id: backIcon + visible: hasIcon + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.preferredWidth: 32 + Layout.preferredHeight: 32 + + image: iconPath + color: Style.fontColorBright + } + + MyText { + id: btnText + Layout.leftMargin: root.hasIcon ? 0 : 20 + Layout.rightMargin: root.hasIcon ? 0 : 20 + Layout.fillWidth: root.hasIcon ? true : false + Layout.alignment: root.hasIcon ? Qt.AlignLeft : Qt.AlignHCenter + text: root.text + fontSize: 26 + fontColor: Style.btnTextColor + } + } + + Rectangle { + z: root.z - 1 + anchors.fill: root + Layout.fillWidth: root.Layout.fillWidth + color: root.down ? Style.btnPressedColor : (root.activeFocus ? Style.btnEnteredColor : Style.btnExitedColor) + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + parent.color = Style.btnEnteredColor; + btnText.fontColor = Style.btnTextHoverColor; + } + onExited: { + parent.color = Style.btnExitedColor; + btnText.fontColor = Style.btnTextColor; + } + onPressed: { + parent.color = Style.btnPressedColor; + btnText.fontColor = Style.btnTextHoverColor; + } + onClicked: { + root.clicked(); + } + } + } +} \ No newline at end of file diff --git a/src/vr/qml/common/MyPushButton2.qml b/src/vr/qml/common/MyPushButton2.qml new file mode 100755 index 0000000..31da025 --- /dev/null +++ b/src/vr/qml/common/MyPushButton2.qml @@ -0,0 +1,29 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file + +Button { + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? "#ffffff" : "#909090" + } + background: Rectangle { + color: parent.down ? "#406288" : (parent.activeFocus ? "#365473" : "transparent") + border.color: parent.enabled ? "#ffffff" : "#909090" + radius: 8 + } + onHoveredChanged: { + if (hovered) { + forceActiveFocus() + } else { + focus = false + } + } + + onClicked: { + MyResources.playActivationSound() + } +} diff --git a/src/vr/qml/common/MyRadioButton.qml b/src/vr/qml/common/MyRadioButton.qml new file mode 100755 index 0000000..8ffa650 --- /dev/null +++ b/src/vr/qml/common/MyRadioButton.qml @@ -0,0 +1,24 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file + +RadioButton { + hoverEnabled: true + contentItem: MyText { + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + text: parent.text + color: parent.enabled ? "#ffffff" : "#909090" + } + onHoveredChanged: { + if (hovered) { + forceActiveFocus() + } else { + focus = false + } + } + + onClicked: { + MyResources.playActivationSound() + } +} diff --git a/src/vr/qml/common/MyResources.qml b/src/vr/qml/common/MyResources.qml new file mode 100755 index 0000000..31cf903 --- /dev/null +++ b/src/vr/qml/common/MyResources.qml @@ -0,0 +1,12 @@ +pragma Singleton +import QtQuick 2.7 + + +QtObject { + function playActivationSound() { + OverlayController.playActivationSound() + } + function playFocusChangedSound() { + OverlayController.playFocusChangedSound() + } +} diff --git a/src/vr/qml/common/MySlider.qml b/src/vr/qml/common/MySlider.qml new file mode 100755 index 0000000..6a4e0f0 --- /dev/null +++ b/src/vr/qml/common/MySlider.qml @@ -0,0 +1,54 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file + + + +Slider { + snapMode: Slider.SnapAlways + wheelEnabled: true + hoverEnabled: true + to: 1.0 + from: 0.0 + + background: Rectangle { + x: parent.leftPadding + y: parent.topPadding + parent.availableHeight / 2 - height / 2 + width: parent.availableWidth + height: parent.availableHeight + radius: 2 + color: "transparent" + Rectangle { + y: parent.height / 2 - height / 2 + implicitHeight: 4 + width: parent.width + height: implicitHeight + radius: 2 + color: "#bdbebf" + } + } + + handle: Rectangle { + x: parent.leftPadding + parent.visualPosition * (parent.availableWidth - width) + y: parent.topPadding + parent.availableHeight / 2 - height / 2 + implicitWidth: 20 + implicitHeight: 40 + radius: 4 + color: parent.pressed ? "#ffffff" : "#eeeeee" + border.color: "#bdbebf" + } + + onHoveredChanged: { + if (hovered) { + forceActiveFocus() + } else { + focus = false + } + } + + onValueChanged: { + if (activeFocus) { + //MyResources.playActivationSound() + } + } +} diff --git a/src/vr/qml/common/MyStackViewPage.qml b/src/vr/qml/common/MyStackViewPage.qml new file mode 100755 index 0000000..cfac0a2 --- /dev/null +++ b/src/vr/qml/common/MyStackViewPage.qml @@ -0,0 +1,277 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import "." +import ".." + +import wowlet.Wallet 1.0 + + +Rectangle { + id: root + color: "transparent" + width: 1600 + height: 800 + + property StackView stackView + property string headerText: "Header Title" + property bool headerShowBackButton: true + + property string exitedColor: "transparent" + + signal backClicked(); + + property Item header: ColumnLayout { + RowLayout { + Rectangle { + color: "transparent" + Layout.preferredWidth: headerBackButton.width + headerTitleContainer.width + 20 + Layout.preferredHeight: 70 + + RowLayout { + spacing: 20 + anchors.fill: parent + + Rectangle { + id: headerBackButton + visible: headerShowBackButton + color: "transparent" + Layout.preferredHeight: 50 + Layout.preferredWidth: 50 + + ImageMask { + id: backIcon + anchors.fill: parent + image: "qrc:/backarrow" + color: Style.fontColorBright + width: 50 + height: 50 + } + } + + Rectangle { + id: headerTitleContainer + color: "transparent" + Layout.preferredHeight: 50 + Layout.preferredWidth: headerTitle.width + 20 + + MyText { + id: headerTitle + text: headerText + font.pointSize: 38 + anchors.verticalCenter: parent.verticalCenter + fontColor: Style.fontColorBright + } + } + } + + MouseArea { + enabled: headerShowBackButton + anchors.fill: parent + hoverEnabled: true + onEntered: { + parent.color = Style.btnEnteredColor + headerTitle.fontColor = Style.btnTextHoverColor + backIcon.color = Style.btnTextHoverColor + } + onExited: { + parent.color = root.exitedColor + headerTitle.fontColor = Style.fontColorBright + backIcon.color = Style.fontColorBright + } + onPressed: { + parent.color = Style.btnPressedColor + headerTitle.fontColor = Style.btnTextHoverColor + backIcon.color = Style.btnTextHoverColor + } + onClicked: { + stackView.pop(); + backClicked(); + } + } + } + + Item { + Layout.fillWidth: true + Layout.preferredHeight: 50 + } + + + Rectangle { + Layout.preferredWidth: 720 + Layout.preferredHeight: 50 + color: "transparent" + + MyText{ + anchors.right: parent.right + anchors.bottom: parent.bottom + fontSize: 30 + fontBold: true + text: { + if(!appWindow.streamerMode) + return appWindow.balanceFormatted; + else + return "HIDDEN"; + } + } + } + } + + Rectangle { + color: Style.dividerColor + height: 1 + Layout.topMargin: 10 + Layout.fillWidth: true + } + } + + property Item content: Frame { + MyText { + text: "Content" + } + } + + ColumnLayout { + id: mainLayout + anchors.fill: parent + } + + Rectangle { + id: bigRect + color: "transparent" + + Layout.fillWidth: true + Layout.preferredHeight: 64 + + Rectangle { + anchors.top: parent.top + anchors.left: parent.left + anchors.right: parent.right + + anchors.leftMargin: 40 + anchors.rightMargin: 40 + + color: Style.dividerColor + height: 1 + } + + RowLayout { + spacing: 30 + anchors.verticalCenter: parent.verticalCenter + + Layout.preferredHeight: 64 + Layout.fillWidth: true + + MyText { + Layout.leftMargin: 40 + + fontSize: 21 + text: appWindow.statusText + color: Style.fontColorDimmed + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: 1 + color: Style.dividerColor + } + + RowLayout { + Layout.fillHeight: true + spacing: 0 + + MyText { + fontSize: 21 + text: "Daemon: " + color: Style.fontColorDimmed + } + + Image { + opacity: 0.8 + Layout.preferredWidth: 32 + Layout.preferredHeight: 32 + source: { + if(typeof Wallet == 'undefined') + return "qrc:/status_disconnected"; + + if(appWindow.connectionStatus == Wallet.ConnectionStatus_Connected){ + return "qrc:/status_connected"; + } else if(appWindow.connectionStatus == Wallet.ConnectionStatus_Connecting) { + return "qrc:/status_lagging"; + } else { + return "qrc:/status_disconnected"; + } + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: 1 + color: Style.dividerColor + } + + RowLayout { + Layout.fillHeight: true + spacing: 0 + + MyText { + fontSize: 21 + text: "WS: " + color: Style.fontColorDimmed + } + + Image { + opacity: 0.8 + Layout.preferredWidth: 32 + Layout.preferredHeight: 32 + source: appWindow.wsConnected ? "qrc:/status_connected" : "qrc:/status_disconnected" + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: 1 + color: Style.dividerColor + } + + MyText { + fontSize: 21 + text: { + let rtn = "Balance: "; + try { + if(!appWindow.streamerMode) { + rtn += WowletVR.wowToFiat(appWindow.spendable); + return rtn + " " + appWindow.fiatSymbol + } + else + rtn += "HIDDEN"; + } catch(err) { + rtn += "ERROR"; + } + + return rtn; + } + color: Style.fontColorDimmed + } + } + } + + Component.onCompleted: { + header.parent = mainLayout + header.Layout.leftMargin = 40 + header.Layout.topMargin = 30 + header.Layout.rightMargin = 40 + content.parent = mainLayout + content.Layout.fillHeight = true + content.Layout.fillWidth = true + + content.Layout.topMargin = 10 + content.Layout.leftMargin = 40 + content.Layout.rightMargin = 40 + content.Layout.bottomMargin = 10 + + bigRect.parent = mainLayout + } +} diff --git a/src/vr/qml/common/MyText.qml b/src/vr/qml/common/MyText.qml new file mode 100755 index 0000000..e85f468 --- /dev/null +++ b/src/vr/qml/common/MyText.qml @@ -0,0 +1,15 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." + +Text { + property bool wrap: false + property int fontSize: 24 + property bool fontBold: false + property string fontColor: Style.fontColor + + color: fontColor + font.bold: fontBold + font.pointSize: fontSize + wrapMode: wrap ? Text.Wrap : Text.NoWrap +} diff --git a/src/vr/qml/common/MyTextField.qml b/src/vr/qml/common/MyTextField.qml new file mode 100755 index 0000000..fee8a97 --- /dev/null +++ b/src/vr/qml/common/MyTextField.qml @@ -0,0 +1,56 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 + +TextField { + property int keyBoardUID: 0 + property string savedText: "" + property bool passwordField: false + + id: myTextField + echoMode: passwordField ? TextInput.Password : TextInput.Normal + color: Style.fontColorDimmed + text: "" + font.pointSize: 20 + background: Button { + hoverEnabled: true + background: Rectangle { + color: parent.hovered ? "#2c435d" : "#1b2939" + border.color: Style.fontColorDimmed + border.width: 2 + } + onClicked: { + myTextField.forceActiveFocus() + } + } + onActiveFocusChanged: { + console.log("QML activeFocus()"); + if (activeFocus) { + if (!OverlayController.desktopMode) { + OverlayController.showKeyboard(text, keyBoardUID) + } else { + savedText = text + } + } + } + onEditingFinished: { + console.log("QML onEditingFinished()"); + if (OverlayController.desktopMode && savedText !== text) { + myTextField.onInputEvent(text) + } + } + function onInputEvent(input) { + text = input + } + + Connections { + target: OverlayController + function onKeyBoardInputSignal(input, userValue) { + console.log("QML onKeyBoardInputSignal(input, userValue)", keyBoardUID); + if (userValue == keyBoardUID) { + if (myTextField.text !== input) { + myTextField.onInputEvent(input) + } + } + } + } +} diff --git a/src/vr/qml/common/MyToggleButton.qml b/src/vr/qml/common/MyToggleButton.qml new file mode 100755 index 0000000..3f50afb --- /dev/null +++ b/src/vr/qml/common/MyToggleButton.qml @@ -0,0 +1,65 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import "." // QTBUG-34418, singletons require explicit import to load qmldir file +// Needed for MyResources in the default folder. +import ".." + +CheckBox { + checkState: Qt.Checked + tristate: false + hoverEnabled: true + spacing: 12 + + indicator: Rectangle { + implicitWidth: 28 + implicitHeight: 28 + x: parent.leftPadding + y: parent.height / 2 - height / 2 + color: parent.enabled ? (parent.down ? "#e0e0e0" : "#ffffff") : "#a0a0a0" + border.width: 0 + Path { + startX: 0 + startY: 0 + PathLine { + x: 40 + y: 40 + } + } + + Image { + width: 28 + height: 28 + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + source: "qrc:/box_checkmark" + sourceSize.width: width + sourceSize.height: height + visible: parent.parent.checked + } + } + + contentItem: MyText { + text: parent.text + horizontalAlignment: Text.AlignLeft + verticalAlignment: Text.AlignVCenter + leftPadding: parent.indicator.width + parent.spacing + color: parent.enabled ? "#ffffff" : "#909090" + } + + background: Rectangle { + color: "#2c435d" + opacity: parent.activeFocus ? 1.0 : 0 + } + + onHoveredChanged: { + if (hovered) { + forceActiveFocus() + } else { + focus = false + } + } + + onClicked: { + MyResources.playActivationSound() + } +} diff --git a/src/vr/qml/common/Style.qml b/src/vr/qml/common/Style.qml new file mode 100644 index 0000000..98b60da --- /dev/null +++ b/src/vr/qml/common/Style.qml @@ -0,0 +1,31 @@ +pragma Singleton + +import QtQuick 2.7 + +// These color codes are overriden by assets/themes.json, we are just +// making sure the property names exist. + +QtObject { + id: root + + property string fontColor: "white" + property string fontColorDimmed: "#cccccc" + property string fontColorBright: "white" + property string backgroundGradientStartColor: "#194f64" + property string backgroundGradientStopColor: "#192e43" + property string backgroundColor: "#1b2939" + + property string dividerColor: "#50ffffff" + + property string btnEnteredColor: "#aa3b689b" + property string btnExitedColor: "#aa375c87" + property string btnPressedColor: "#aa467dbb" + property string btnTextColor: "white" + property string btnTextHoverColor: "white" + property string btnMainMenuBackground: "#aa3b689b" + + property string historyBackgroundColor: "#2c435d" + property string historyBackgroundColorBright: "#406288" + property string historyFontColorPlusAmount: "#00d304" + property string historyFontColorMinAmount: "red" +} \ No newline at end of file diff --git a/src/vr/qml/common/TimeAssembly.qml b/src/vr/qml/common/TimeAssembly.qml new file mode 100755 index 0000000..087955b --- /dev/null +++ b/src/vr/qml/common/TimeAssembly.qml @@ -0,0 +1,55 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + + +RowLayout { + signal timeChanged(int hour, int minute, int second) + + HourComboBox { + id: hourBox + Layout.preferredWidth: 60 + onActivated: { + parent.timeChanged(hourBox.currentIndex, + minuteBox.currentIndex, + secondBox.currentIndex) + } + } + MyText { + text: "h" + } + + MinuteSecondComboBox { + id: minuteBox + Layout.preferredWidth: 60 + onActivated: { + parent.timeChanged(hourBox.currentIndex, + minuteBox.currentIndex, + secondBox.currentIndex) + } + } + MyText { + text: "m" + } + + MinuteSecondComboBox { + id: secondBox + Layout.preferredWidth: 60 + onActivated: { + parent.timeChanged(hourBox.currentIndex, + minuteBox.currentIndex, + secondBox.currentIndex) + } + } + MyText { + text: "s" + } + function changeTimer(hour, minute, second) { + hourBox.currentIndex = hour + minuteBox.currentIndex = minute + secondBox.currentIndex = second + hourBox.displayText = hour + minuteBox.displayText = minute + secondBox.displayText = second + } +} diff --git a/src/vr/qml/common/mainwidget.qml b/src/vr/qml/common/mainwidget.qml new file mode 100755 index 0000000..868931e --- /dev/null +++ b/src/vr/qml/common/mainwidget.qml @@ -0,0 +1,128 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 +import ".." +import "../utilities_page" +import "../audio_page" +import "../motion_page" +import "../video_page" +import "../chaperone_page" +import "../steamvr_page" +import "../rotation_page" +import "../chaperone_page/chaperone_additional" + +Rectangle { + id: root + color: "#1b2939" + width: 1200 + height: 800 + + property WalletDashboard WalletDashboard: WalletDashboard { + stackView: walletView + } + + property SteamVRPage steamVRPage: SteamVRPage { + stackView: walletView + visible: false + } + + property ChaperonePage chaperonePage: ChaperonePage { + stackView: walletView + visible: false + } + + property ChaperoneWarningsPage chaperoneWarningsPage: ChaperoneWarningsPage { + stackView: walletView + visible: false + } + + property ChaperoneAdditionalPage chaperoneAdditionalPage: ChaperoneAdditionalPage{ + stackView: walletView + visible: false + } + + property PlayspacePage playspacePage: PlayspacePage { + stackView: walletView + visible: false + } + + property MotionPage motionPage: MotionPage { + stackView: walletView + visible: false + } + + property RotationPage rotationPage: RotationPage { + stackView: walletView + visible: false + } + + property FixFloorPage fixFloorPage: FixFloorPage { + stackView: walletView + visible: false + } + + property StatisticsPage statisticsPage: StatisticsPage { + stackView: walletView + visible: false + } + + property SettingsPage settingsPage: SettingsPage { + stackView: walletView + visible: false + } + + property AudioPage audioPage: AudioPage { + stackView: walletView + visible: false + } + + property UtilitiesPage utilitiesPage: UtilitiesPage { + stackView: walletView + visible: false + } + + property VideoPage videoPage: VideoPage { + stackView: walletView + visible:false + } + + StackView { + id: walletView + anchors.fill: parent + + pushEnter: Transition { + PropertyAnimation { + property: "x" + from: walletView.width + to: 0 + duration: 200 + } + } + pushExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: -walletView.width + duration: 200 + } + } + popEnter: Transition { + PropertyAnimation { + property: "x" + from: -walletView.width + to: 0 + duration: 200 + } + } + popExit: Transition { + PropertyAnimation { + property: "x" + from: 0 + to: walletView.width + duration: 200 + } + } + + initialItem: WalletDashboard + } +} diff --git a/src/vr/qml/common/qmldir b/src/vr/qml/common/qmldir new file mode 100644 index 0000000..8198422 --- /dev/null +++ b/src/vr/qml/common/qmldir @@ -0,0 +1 @@ +singleton Style 1.0 Style.qml diff --git a/src/vr/qml/wallet/HistoryTable.qml b/src/vr/qml/wallet/HistoryTable.qml new file mode 100755 index 0000000..bfca25e --- /dev/null +++ b/src/vr/qml/wallet/HistoryTable.qml @@ -0,0 +1,188 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 + +import wowlet.Wallet 1.0 +import wowlet.WalletManager 1.0 +import wowlet.TransactionHistory 1.0 +import wowlet.TransactionInfo 1.0 +import wowlet.TransactionHistoryModel 1.0 +import wowlet.TransactionHistoryProxyModel 1.0 + +import "../common" + +Item { + id: root + property var txModel + property int txCount: 0 + + property var txModelData: [] + property int sideMargin: 20 + + ListModel { id: txListViewModel } + + ColumnLayout { + anchors.fill: parent + spacing: 0 + + MyText { + visible: txCount == 0 + text: "No transactions to display." + fontColor: Style.fontColorBright + } + + ListView { + id: listView + visible: true + + Layout.fillWidth: true + Layout.fillHeight: true + spacing: 10 + model: txModel + interactive: false + + delegate: Rectangle { + id: delegate + anchors.left: parent ? parent.left : undefined + anchors.right: parent ? parent.right : undefined + height: 54 + color: Style.historyBackgroundColor + + property bool isout: false; + property string amount: "0"; + property string description: ""; + property string date: "2021-13-37"; + + property bool confirmed: false + property bool failed: false + property bool pending: false + property int confirmations: 0 + property int confirmationsRequired: 0 + + Component.onCompleted: { + isout = getTxData(index, TransactionHistoryModel.TransactionIsOutRole); + amount = getTxData(index, TransactionHistoryModel.Amount); + description = getTxData(index, TransactionHistoryModel.Description); + date = getTxData(index, TransactionHistoryModel.Date); + + failed = getTxData(index, TransactionHistoryModel.TransactionFailedRole); + pending = getTxData(index, TransactionHistoryModel.TransactionPendingRole); + confirmations = getTxData(index, TransactionHistoryModel.TransactionConfirmationsRole); + confirmationsRequired = getTxData(index, TransactionHistoryModel.TransactionConfirmationsRequiredRole); + + confirmed = confirmations >= confirmationsRequired; + root.txCount = index; + } + + RowLayout { + spacing: 0 + clip: true + height: parent.height + anchors.left: parent.left + anchors.right: parent.right + + Rectangle { + Layout.preferredWidth: 56 + Layout.fillHeight: true + color: Style.historyBackgroundColorBright + + Image { + width: 32 + height: 32 + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + source: { + if(failed) return "qrc:/assets/images/warning.png" + else if(pending) return "qrc:/assets/images/unconfirmed.png" + else if(!confirmed) return "qrc:/assets/images/clock1.png" + + else return "qrc:/assets/images/confirmed.png" + //confirmed ? "qrc:/checkmark_icon" : "qrc:/expired_icon" + } + } + } + + Rectangle { + Layout.preferredWidth: 300 + Layout.leftMargin: 10 + Layout.rightMargin: 10 + Layout.fillHeight: true + color: "transparent" + + MyText { + // date + anchors.verticalCenter: parent.verticalCenter + fontSize: 22 + fontColor: Style.fontColorBright + text: date + + Component.onCompleted: { + parent.Layout.preferredWidth = width; + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.leftMargin: 10 + color: "transparent" + + MyText { + anchors.verticalCenter: parent.verticalCenter + fontSize: 22 + text: description !== "" ? description : "..." + fontColor: description !== "" ? Style.fontColorBright : Style.fontColorDimmed + Component.onCompleted: { + parent.Layout.preferredWidth = width; + } + } + } + + Item { + Layout.fillWidth: true + } + + Rectangle { + Layout.preferredWidth: 420 + Layout.fillHeight: true + color: Style.historyBackgroundColorBright + + MyText { + anchors.right: parent.right + anchors.rightMargin: 10 + + anchors.verticalCenter: parent.verticalCenter + fontSize: 24 + fontBold: true + text: amount + fontColor: !isout ? Style.historyFontColorPlusAmount : Style.historyFontColorMinAmount + } + } + } + } + } + + Item { + Layout.fillHeight: true + } + } + + Rectangle { + z: parent.z - 1 + color: "transparent" + anchors.fill: parent + } + + function getTxData(x, y) { + var idx = txModel.index(x, y); + return txModel.data(idx, 0); + } + + function onPageCompleted() { + if(currentWallet == null || typeof currentWallet.history === "undefined" ) return; + root.txCount = 0; + root.txModel = appWindow.currentWallet.historyModel; + //root.model.sortRole = TransactionHistoryModel.TransactionBlockHeightRole; + //root.model.sort(0, Qt.DescendingOrder); + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/ReceivePage.qml b/src/vr/qml/wallet/ReceivePage.qml new file mode 100755 index 0000000..41b04f2 --- /dev/null +++ b/src/vr/qml/wallet/ReceivePage.qml @@ -0,0 +1,207 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Dialogs 1.2 +import "." +import "../common" + +MyStackViewPage { + id: root + headerText: "Receive" + + content: ColumnLayout { + Layout.fillWidth: true + spacing: 30 + + RowLayout { + spacing: 30 + Layout.fillWidth: true + + ColumnLayout { + spacing: 20 + Layout.fillWidth: true + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 120 + + MyText { + width: parent.width + wrap: true + fontSize: 21 + fontColor: Style.fontColorBright + text: "Give the following 4 digit PIN to the person that is sending you Wownero. PIN's are valid for 10 minutes and automatically renew." + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 220 + + ColumnLayout { + spacing: 20 + MyText { + id: statusText + width: parent.width + visible: true + fontSize: 21 + fontColor: Style.fontColorBright + text: "Generating PIN..." + } + + Text { + id: pinText + text: "- - - -" + color: Style.fontColor + font.bold: true + font.pointSize: 60 + leftPadding: 20 + rightPadding: 20 + + Rectangle { + z: parent.z - 1 + anchors.fill: parent + color: "black" + } + } + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + } + + Rectangle { + color: Style.fontColorDimmed + width: 1 + Layout.fillHeight: true + } + + ColumnLayout { + Layout.fillWidth: true + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 80 + Layout.bottomMargin: 20 + + MyText { + width: parent.width + fontSize: 21 + wrap: true + fontColor: Style.fontColorBright + text: "Alternatively, you may use one of the following methods to retreive your address." + } + } + + MyPushButton { + id: viewAddress + text: "View address" + Layout.preferredHeight: 70 + Layout.fillWidth: true + + onClicked: { + let address = ctx.getAddress(0, 1); + messagePopup.showMessage("Your Wownero receiving address", address); + } + } + + MyPushButton { + id: copyToClipboard + text: "Copy address to clipboard" + Layout.preferredHeight: 70 + Layout.fillWidth: true + + onClicked: { + let address = ctx.getAddress(0, 1); + WowletVR.setClipboard(address); + messagePopup.showMessage("Clipboard", "Address copied to clipboard."); + } + } + + MyPushButton { + id: writeQRcode + text: "Save QR image" + Layout.preferredHeight: 70 + Layout.fillWidth: true + visible: false + + onClicked: { + + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + + } + + function onPageCompleted() { + console.log("onPageCompleted() ReceivePage") + pinAskTimer.start(); + askReceivingPIN(); + } + + function resetPage() { + pinAskTimer.stop(); + statusText.visible = true; + statusText.text = "Generating PIN..."; + pinText.text = "- - - -"; + } + + onBackClicked: { + resetPage(); + } + + Timer { + id: pinAskTimer + interval: 1000 * 5; + running: false; + repeat: true + onTriggered: askReceivingPIN() + triggeredOnStart: false + } + + function askReceivingPIN() { + ctx.onAskReceivingPIN(); + } + + Connections { + target: ctx + + function onPinReceived(pin) { + console.log("onPINReceived", pin); + statusText.visible = false; + pinText.text = pin[0] + " " + pin[1] + " " + pin[2] + " " + pin[3]; + } + } + + Connections { + target: OverlayController + + function onDashboardDeactivated() { + console.log("onDashboardDeactivated()") + pinAskTimer.stop(); + } + + function onDashboardActivated() { + console.log("onDashboardActivated()") + if(walletView.currentItem == root) + pinAskTimer.start(); + } + } +} diff --git a/src/vr/qml/wallet/WalletDashBoardPage.qml b/src/vr/qml/wallet/WalletDashBoardPage.qml new file mode 100644 index 0000000..40e9195 --- /dev/null +++ b/src/vr/qml/wallet/WalletDashBoardPage.qml @@ -0,0 +1,104 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.2 +import QtGraphicalEffects 1.0 +import QtQuick.Window 2.0 +import QtQuick.Controls.Styles 1.4 +import QtQuick.Dialogs 1.2 + +import "../common" +import "." + +MyStackViewPage { + id: walletDashboard + width: 1600 + height: 800 + headerText: appWindow.walletTitle + headerShowBackButton: false + stackView: walletView + + content: Item { + ColumnLayout { + anchors.fill: parent + RowLayout { + spacing: 32 + Layout.fillHeight: true + Layout.fillWidth: true + + ColumnLayout { + Layout.preferredWidth: 250 + Layout.maximumWidth: 250 + Layout.fillHeight: true + spacing: 10 + + MyPushButton { + id: steamVRButton + iconPath: "qrc:/send_icon" + activationSoundEnabled: false + text: "Send" + Layout.fillWidth: true + onClicked: { + //MyResources.playFocusChangedSound() + if(!appWindow.wsConnected) { + return messagePopup.showMessage("Please wait", "No connection to websocket server (yet)."); + } + + walletView.push(sendPage) + sendPage.onPageCompleted(); + } + } + + MyPushButton { + id: chaperoneButton + iconPath: "qrc:/receive_icon" + activationSoundEnabled: false + text: "Receive" + Layout.fillWidth: true + onClicked: { + //MyResources.playFocusChangedSound() + if(!appWindow.wsConnected) { + return messagePopup.showMessage("Please wait", "No connection to websocket server (yet)."); + } + + walletView.push(receivePage) + receivePage.onPageCompleted(); + } + } + + MyPushButton { + id: rotationButton + iconPath: "qrc:/backarrow" + activationSoundEnabled: false + text: "Close" + Layout.fillWidth: true + onClicked: { + ctx.closeWallet(true, true); + mainView.pop(); + } + } + + Rectangle { + Layout.fillHeight: true + Layout.fillWidth: true + color: "transparent" + } + } + + HistoryTable { + id: historyView + Layout.fillHeight: true + Layout.fillWidth: true + } + } + } + } + + function onPageCompleted() { + historyView.onPageCompleted(); + try { + appWindow.fiatSymbol = WowletVR.preferredFiat(); + } catch(err) { + + } + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/send/SendPage.qml b/src/vr/qml/wallet/send/SendPage.qml new file mode 100755 index 0000000..f5d8d10 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPage.qml @@ -0,0 +1,106 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 1.4 + +import "../../common" +import "." + +MyStackViewPage { + id: sendStateController + height: 800 + width: 1600 + headerText: "Send" + + property string destinationAddress: "" + + content: ColumnLayout { + id: sendStateView + property Item currentView + property Item previousView + + property SendPagePIN pinPage: SendPagePIN {} + property SendPageDashboard dashPage: SendPageDashboard {} + property SendPageTransfer transferPage: SendPageTransfer {} + property SendPageQR qrPage: SendPageQR {} + + state: '' + + onCurrentViewChanged: { + if (previousView) { + if (typeof previousView.onPageClosed === "function") { + previousView.onPageClosed(); + } + } + + if (currentView) { + sendStack.replace(currentView) + // Calls when view is opened + if (typeof currentView.onPageCompleted === "function") { + currentView.onPageCompleted(previousView); + } + } + + previousView = currentView; + } + + states: [ + State { + name: "pinPage" + PropertyChanges { target: sendStateView; currentView: sendStateView.pinPage } + }, State { + name: "dashPage" + PropertyChanges { target: sendStateView; currentView: sendStateView.dashPage } + }, State { + name: "transferPage" + PropertyChanges { target: sendStateView; currentView: sendStateView.transferPage } + }, State { + name: "qrPage" + PropertyChanges { target: sendStateView; currentView: sendStateView.qrPage } + } + ] + + StackView { + id: sendStack + clip: true + initialItem: sendStateView.dashPage + + Layout.fillWidth: true + Layout.fillHeight: true + + delegate: StackViewDelegate { + pushTransition: StackViewTransition { + PropertyAnimation { + target: enterItem + property: "x" + from: sendStack.backTransition ? -target.width : target.width + to: 0 + duration: 300 + easing.type: Easing.OutCubic + } + + PropertyAnimation { + target: exitItem + property: "x" + from: 0 + to: sendStack.backTransition ? target.width : -target.width + duration: 300 + easing.type: Easing.OutCubic + } + } + } + } + } + + function onPageCompleted(previousView){ + sendStateView.state = "dashPage" + } + + onBackClicked: { + // top back button to send/receive menu, reset default states for sendViews + sendStateView.pinPage.onPageCompleted(); + sendStateView.qrPage.onPageCompleted(); + sendStateView.dashPage.onPageCompleted(); + sendStateView.transferPage.onPageCompleted(); + } +} diff --git a/src/vr/qml/wallet/send/SendPageDashboard.qml b/src/vr/qml/wallet/send/SendPageDashboard.qml new file mode 100644 index 0000000..c9ad665 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPageDashboard.qml @@ -0,0 +1,46 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import "../../common" + +ColumnLayout { + id: root + + Layout.fillWidth: true + + MyText { + Layout.fillWidth: true + wrap: true + fontColor: Style.fontColorBright + text: "How to transfer Wownero?" + } + + RowLayout { + Layout.topMargin: 30 + Layout.fillWidth: true + spacing: 30 + + SendPageDashboardButton { + displayText: "Send via PIN" + onClicked: { + sendStateView.state = "pinPage"; + } + } + + SendPageDashboardButton { + displayText: "Send via QR code" + onClicked: { + sendStateView.state = "qrPage"; + } + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + + function onPageCompleted(previousView){ + + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/send/SendPageDashboardButton.qml b/src/vr/qml/wallet/send/SendPageDashboardButton.qml new file mode 100644 index 0000000..13e8c39 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPageDashboardButton.qml @@ -0,0 +1,44 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import "../../common" + +Rectangle { + id: root + color: Style.btnExitedColor + Layout.fillWidth: true + Layout.fillHeight: true + + property string displayText: "" + + signal clicked(); + + MyText{ + id: btnText + text: displayText + fontSize: 24 + fontColor: Style.btnTextColor + anchors.horizontalCenter: parent.horizontalCenter + anchors.verticalCenter: parent.verticalCenter + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: { + parent.color = Style.btnEnteredColor; + btnText.fontColor = Style.btnTextHoverColor; + } + onExited: { + parent.color = Style.btnExitedColor; + btnText.fontColor = Style.btnTextColor; + } + onPressed: { + parent.color = Style.btnPressedColor; + btnText.fontColor = Style.btnTextHoverColor; + } + onClicked: { + root.clicked(); + } + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/send/SendPageNavBack.qml b/src/vr/qml/wallet/send/SendPageNavBack.qml new file mode 100644 index 0000000..107fbce --- /dev/null +++ b/src/vr/qml/wallet/send/SendPageNavBack.qml @@ -0,0 +1,56 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 +import QtQuick.Controls 1.4 + +import "../../common" + + +RowLayout { + id: root + Layout.fillWidth: true + Layout.preferredHeight: 82 + Layout.maximumHeight: 82 + + signal backClicked(); + + Rectangle { + color: sendStateController.exitedColor + Layout.preferredHeight: 82 + Layout.preferredWidth: 220 + + RowLayout { + anchors.left: parent.left + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + Layout.minimumHeight: 54 + + Image { + source: "qrc:/backarrow" + Layout.leftMargin: 20 + Layout.rightMargin: 20 + Layout.preferredWidth: 32 + Layout.preferredHeight: 32 + } + + MyText { + Layout.fillWidth: true + Layout.alignment: Qt.AlignLeft + fontBold: true + text: "back" + fontSize: 24 + } + } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + onEntered: parent.color = sendStateController.enteredColor + onExited: parent.color = sendStateController.exitedColor + onPressed: parent.color = sendStateController.pressedColor + onClicked: { + root.backClicked(); + } + } + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/send/SendPagePIN.qml b/src/vr/qml/wallet/send/SendPagePIN.qml new file mode 100644 index 0000000..aa32607 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPagePIN.qml @@ -0,0 +1,188 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import "../../common" + + +ColumnLayout { + id: root + + Layout.fillWidth: true + property string pin: "" + + MyText { + Layout.fillWidth: true + wrap: true + fontColor: Style.fontColorBright + text: "Enter a 4 digit PIN and wait for it to resolve." + } + + RowLayout { + Layout.topMargin: 30 + Layout.fillWidth: true + spacing: 40 + + ColumnLayout { + Layout.preferredWidth: 320 + Layout.preferredHeight: 400 + + MyNumPad { + id: numPad + onButtonPress: { + root.pin += val; + if(root.pin.length === 4 && root.pin !== "0000") { + return addressLookup(); + } + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: parent.Layout.preferredWidth + color: "transparent" + } + } + + ColumnLayout { + Layout.preferredHeight: 400 + Layout.preferredWidth: 390 + + Text { + id: codeDisplay + Layout.preferredWidth: 390 + visible: true + text: (root.pin[0] || ".") + " " + (root.pin[1] || ".") + " " + (root.pin[2] || ".") + " " + (root.pin[3] || "."); + color: Style.fontColor + font.bold: true + font.pointSize: 60 + leftPadding: 20 + rightPadding: 20 + + Rectangle { + z: parent.z - 1 + anchors.fill: parent + color: "black" + } + } + + Rectangle { + color: "transparent" + Layout.fillHeight: true + Layout.preferredWidth: parent.Layout.preferredWidth + } + } + + Rectangle { + color: Style.fontColorDimmed + width: 1 + Layout.fillHeight: true + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + + // Idle container + ColumnLayout { + id: idleContainer + visible: true + spacing: 30 + Layout.fillWidth: true + + MyText { + fontSize: 22 + fontColor: Style.fontColorBright + text: "Waiting on input..." + } + } + + // Loading container + ColumnLayout { + id: loadingContainer + visible: false + spacing: 10 + Layout.fillWidth: true + + MyText { + fontSize: 22 + fontColor: Style.fontColorBright + text: "Looking up address..." + } + + RowLayout { + spacing: 30 + Layout.topMargin: 20 + Layout.fillWidth: true + + MyText { + fontBold: true + fontColor: Style.fontColorBright + text: "Code:" + } + + MyText { + text: root.pin + } + } + } + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + + function addressLookup() { + console.log("addressLookup()"); + idleContainer.visible = false; + loadingContainer.visible = true; + + numPad.enabled = false; + + try { + ctx.onLookupReceivingPIN(root.pin); + } catch(err){ + console.log("ctx.onLookupReceivingPIN() ignored") + } + } + + function onPageCompleted(previousView) { + reset(); + } + + function reset() { + console.log("SendPagePin reset()"); + // reset state + root.pin = ""; + + idleContainer.visible = true; + loadingContainer.visible = false; + sendStateController.destinationAddress = ""; + + numPad.enabled = true; + numPad.reset(); + } + + Connections { + target: ctx + + function onPinLookupReceived(address, pin) { + console.log("onPinLookupReceived", address); + + if(pin === root.pin) { + sendStateController.destinationAddress = address; + sendStateView.state = "transferPage"; + } else { + console.log("PIN lookup received but we timed out already, disregard.") // undefined behavior + } + } + + function onPinLookupErrorReceived() { + console.log("onPinLookupErrorReceived"); + messagePopup.showMessage("Lookup failed", "Error getting address.") + reset(); + } + } +} \ No newline at end of file diff --git a/src/vr/qml/wallet/send/SendPageQR.qml b/src/vr/qml/wallet/send/SendPageQR.qml new file mode 100644 index 0000000..9faaa00 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPageQR.qml @@ -0,0 +1,76 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import "../../common" + + +ColumnLayout { + id: root + spacing: 20 + + property bool takingScreenshot: false + Layout.fillWidth: true + + MyText { + Layout.fillWidth: true + wrap: true + fontColor: Style.fontColorBright + text: "Look at a QR code and press the button below to take a screenshot. Note: make sure to look at the center of the QR code. The parser works best with simple, straight-forward QR codes. When using more complex QR codes, make sure to properly fill your screen with the QR code itself (plus some margins)." + } + + MyPushButton { + id: continueButton + text: "Take in-game screenshot" + Layout.preferredWidth: 490 + opacity: takingScreenshot ? 0.0 : 1.0 + + onClicked: { + root.takingScreenshot = true; + WowletVR.takeQRScreenshot(); + } + } + + MyText { + id: statusMessage + visible: false + Layout.fillWidth: true + wrap: true + fontColor: Style.fontColorBright + text: "Status message." + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + + Connections { + target: WowletVR + + function onQrScreenshotSuccess(address) { + root.takingScreenshot = false; + console.log("onPinLookupReceived", address); + + if(sendStateView.currentView === sendStateView.qrPage) { + sendStateController.destinationAddress = address; + sendStateView.state = "transferPage"; + } + } + + function onQrScreenshotFailed(msg) { + root.takingScreenshot = false; + console.log("onQrScreenshotFailed", msg); + messagePopup.showMessage("QR scan failure", msg) + reset(); + } + } + + function reset() { + root.takingScreenshot = false; + } + + function onPageCompleted(previousView){ + reset(); + } +} diff --git a/src/vr/qml/wallet/send/SendPageTransfer.qml b/src/vr/qml/wallet/send/SendPageTransfer.qml new file mode 100644 index 0000000..ac3e1f5 --- /dev/null +++ b/src/vr/qml/wallet/send/SendPageTransfer.qml @@ -0,0 +1,280 @@ +import QtQuick 2.7 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.3 + +import "../../common" + +ColumnLayout { + id: root + spacing: 30 + + property string txDialogText: "" + property string amount: "" + property string amount_type: "wow" + property bool canSend: false + + Layout.fillWidth: true + + MyText { + Layout.fillWidth: true + wrap: true + fontColor: Style.fontColorBright + text: "How much would you like to send?" + } + + function count(input, needle) { + return input.split(".").length - 1; + } + + RowLayout { + spacing: 40 + + ColumnLayout { + Layout.preferredWidth: 320 + Layout.preferredHeight: 400 + + MyNumPad { + id: numPad + compact: true + onButtonPress: { + let periods = count(root.amount, "."); + if(periods == 1 && val === ".") return; + if(root.amount === "" && val === ".") return; + if(root.amount.length > 7) return; + + root.amount += val; + } + onClearPress: { + root.amount = ""; + } + } + + Rectangle { + Layout.fillHeight: true + Layout.preferredWidth: parent.Layout.preferredWidth + color: "transparent" + } + } + + ColumnLayout { + spacing: 14 + Layout.fillHeight: true + Layout.preferredWidth: 280 + + MyPushButton { + id: wowButton + opacity: enabled ? 1.0 : 0.4 + enabled: root.amount_type === "fiat" + + Layout.preferredWidth: 280 + Layout.preferredHeight: 108 + + text: "Wownero" + + onClicked: { + root.amount_type = "wow" + } + } + + MyPushButton { + id: fiatBtn + opacity: enabled ? 1.0 : 0.4 + enabled: root.amount_type === "wow" + + Layout.preferredWidth: 280 + Layout.preferredHeight: 108 + + text: "Fiat" + + onClicked: { + root.amount_type = "fiat" + } + } + + Item { + Layout.fillHeight: true + Layout.fillWidth: true + } + } + + ColumnLayout { + spacing: 10 + Layout.fillHeight: true + + + RowLayout { + spacing: 30 + Layout.fillWidth: true + Layout.fillHeight: true + + Rectangle { + color: "transparent" + Layout.preferredWidth: 192 + Layout.preferredHeight: 48 + + MyText { + fontBold: true + text: "Amount:" + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 68 + + MyText { + fontSize: 32 + fontColor: Style.fontColorBright + text: { + let rtn = ""; + if(root.amount === "") rtn += "0.0" + else if(root.amount_type === "wow") { + rtn += root.amount; + } else { + try { + rtn += WowletVR.fiatToWow(root.amount); + } catch(err) { + return "ERROR"; + } + } + + return rtn + " WOW"; + } + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + } + } + } + + RowLayout { + spacing: 30 + Layout.fillWidth: true + Layout.fillHeight: true + + Rectangle { + color: "transparent" + Layout.preferredWidth: 192 + Layout.preferredHeight: 48 + + MyText { + fontBold: true + text: "Fiat:" + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 48 + + MyText { + id: fiatText + fontSize: 26 + fontColor: Style.fontColorBright + text: { + let rtn = ""; + if(root.amount === "") rtn += "0.0" + else if(root.amount_type === "fiat") { + rtn += root.amount; + } else { + try { + rtn += WowletVR.wowToFiat(root.amount); + } catch(err) { + return "ERROR"; + } + } + + return rtn + " " + appWindow.fiatSymbol + } + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + } + } + } + + RowLayout { + spacing: 30 + Layout.fillWidth: true + Layout.fillHeight: true + + Rectangle { + color: "transparent" + Layout.preferredWidth: 192 + Layout.preferredHeight: 48 + + MyText { + fontBold: true + text: "Destination:" + anchors.verticalCenter: parent.verticalCenter + } + } + + Rectangle { + color: "transparent" + Layout.fillWidth: true + Layout.preferredHeight: 48 + + MyText { + text: destinationAddress.slice(0, 12) + "..."; + fontColor: Style.fontColorBright + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + } + } + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + MyPushButton { + id: sendButton + + Layout.preferredWidth: 420 + Layout.alignment: Qt.AlignRight + + text: "Create transaction" + + onClicked: { + if(amount === "") return; + + let _amount = parseFloat(amount); + if(root.amount_type == "fiat") { + try { + _amount = WowletVR.fiatToWow(_amount); + } catch(err) { + messagePopup.showMessage("Error", "Could not convert fiat to wow."); + return; + } + } + + if(amount <= 0) { + messagePopup.showMessage("Error", "Amount was zero."); + return; + } + + WowletVR.onCreateTransaction(destinationAddress, _amount.toString(), "", false); // no description + sendButton.enabled = false; + } + } + } + } + + function onPageCompleted() { + root.amount = ""; + root.amount_type = "wow"; + root.txDialogText = ""; + } + + Item { + Layout.fillWidth: true + Layout.fillHeight: true + } + + Component.onCompleted: { + } +} \ No newline at end of file diff --git a/src/vr/utils/paths.cpp b/src/vr/utils/paths.cpp new file mode 100755 index 0000000..45d3553 --- /dev/null +++ b/src/vr/utils/paths.cpp @@ -0,0 +1,58 @@ +#include "paths.h" +#include +#include +#include +#include +#include + +namespace paths +{ +string binaryDirectory() +{ + const auto path = QCoreApplication::applicationDirPath(); + if ( path == "" ) { + qCritical() << "Could not find binary directory."; + return ""; + } + + return path.toStdString() + "/../"; // @ TODO: removeme +} + +string binaryDirectoryFindFile( const string& fileName ) { + const auto path = binaryDirectory(); + if (path.empty()) { + return ""; + } + + const auto filePath = QDir( QString::fromStdString( path ) + '/' + + QString::fromStdString( fileName ) ); + QFileInfo file( filePath.path() ); + if (!file.exists()) + { + qCritical() << "Could not find file '" << fileName.c_str() + << "' in binary directory."; + return ""; + } + + return QDir::toNativeSeparators( file.filePath() ).toStdString(); +} + +string settingsDirectory() { + const auto path = QStandardPaths::writableLocation( QStandardPaths::AppDataLocation ); + if (path == "") { + qCritical() << "Could not find settings directory."; + return ""; + } + return path.toStdString(); +} + +string verifyIconFilePath( const string& filename ) { + const string notifIconPath = paths::binaryDirectoryFindFile( filename ); + if (notifIconPath.empty()) { + qCritical() << "Could not find icon " << filename.c_str() << "\""; + } + + return notifIconPath; +} + +} // namespace paths diff --git a/src/vr/utils/paths.h b/src/vr/utils/paths.h new file mode 100755 index 0000000..aeb274f --- /dev/null +++ b/src/vr/utils/paths.h @@ -0,0 +1,16 @@ +#pragma once +#include +#include +#include +#include + +namespace paths +{ +using std::string; + +string binaryDirectory(); +string binaryDirectoryFindFile( const string& fileName ); +string settingsDirectory(); +string verifyIconFilePath( const string& filename ); + +} // namespace paths diff --git a/src/widgets/CCSEntry.h b/src/widgets/CCSEntry.h index c2ec1f3..8c68364 100644 --- a/src/widgets/CCSEntry.h +++ b/src/widgets/CCSEntry.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CCSENTRY_H -#define FEATHER_CCSENTRY_H +#ifndef WOWLET_CCSENTRY_H +#define WOWLET_CCSENTRY_H #include @@ -21,4 +21,4 @@ struct CCSEntry { int contributions = 0; }; -#endif //FEATHER_CCSENTRY_H +#endif //WOWLET_CCSENTRY_H diff --git a/src/widgets/ForumPost.h b/src/widgets/ForumPost.h new file mode 100644 index 0000000..f6fa099 --- /dev/null +++ b/src/widgets/ForumPost.h @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_FORUMPOST_H +#define WOWLET_FORUMPOST_H + +#include + +struct ForumPost { + ForumPost(const QString &title, const QString &author, const QString &permalink, const QString date_added) + : title(title), author(author), permalink(permalink), date_added(date_added){}; + + QString title; + QString author; + QString permalink; + QString date_added; +}; + +#endif //WOWLET_FORUMPOST_H diff --git a/src/widgets/PayToEdit.cpp b/src/widgets/PayToEdit.cpp new file mode 100644 index 0000000..f19a6e3 --- /dev/null +++ b/src/widgets/PayToEdit.cpp @@ -0,0 +1,150 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) 2012 thomasv@gitorious + +#include "PayToEdit.h" + +#include +#include + +#include "utils/utils.h" +#include "model/ModelUtils.h" + +#include "libwalletqt/WalletManager.h" + +PayToEdit::PayToEdit(QWidget *parent) : QPlainTextEdit(parent) +{ + this->setFont(ModelUtils::getMonospaceFont()); + + connect(this->document(), &QTextDocument::contentsChanged, this, &PayToEdit::updateSize); + connect(this, &QPlainTextEdit::textChanged, this, &PayToEdit::checkText); + + this->updateSize(); +} + +void PayToEdit::setNetType(NetworkType::Type netType) { + m_netType = netType; +} + +void PayToEdit::setText(const QString &text) { + this->setPlainText(text); +} + +QString PayToEdit::text() { + return this->toPlainText(); +} + +QVector PayToEdit::getErrors() { + return m_errors; +} + +QVector PayToEdit::getOutputs() { + return m_outputs; +} + +quint64 PayToEdit::getTotal() { + return m_total; +} + +QStringList PayToEdit::lines() { + return this->toPlainText().split("\n"); +} + +bool PayToEdit::isMultiline() { + return this->lines().size() > 1; +} + +void PayToEdit::payToMany() { + this->setPlainText("\n\n\n"); + this->updateSize(); +} + +bool PayToEdit::isOpenAlias() { + if (this->isMultiline()) { + return false; + } + auto text = this->toPlainText().trimmed(); + if (!(text.contains('.') and (!text.contains(' ')))) { + return false; + } + auto parts = text.split(','); + if (parts.size() > 0 and WalletManager::addressValid(parts[0], m_netType)) { + return false; + } + return true; +} + +void PayToEdit::checkText() { + m_errors.clear(); + m_outputs.clear(); + + // filter out empty lines + QStringList lines; + for (auto &l : this->lines()) { + if (!l.isEmpty()) { + lines.push_back(l); + } + } + + this->parseAsMultiline(lines); +} + +void PayToEdit::updateSize() { + qreal lineHeight = QFontMetrics(this->document()->defaultFont()).height(); + qreal docHeight = this->document()->size().height(); + int h = int(docHeight * lineHeight + 11); + h = qMin(qMax(h, m_heightMin), m_heightMax); + this->setMinimumHeight(h); + this->setMaximumHeight(h); + this->verticalScrollBar()->hide(); +} + +PartialTxOutput PayToEdit::parseAddressAndAmount(const QString &line) { + QStringList x = line.split(","); + if (x.size() != 2) { + return PartialTxOutput(); + } + + QString address = this->parseAddress(x[0]); + quint64 amount = this->parseAmount(x[1]); + + return PartialTxOutput(address, amount); +} + +quint64 PayToEdit::parseAmount(QString amount) { + amount.replace(',', '.'); + if (amount.isEmpty()) return 0; + + return WalletManager::amountFromString(amount.trimmed()); +} + +QString PayToEdit::parseAddress(QString address) { + if (!WalletManager::addressValid(address.trimmed(), m_netType)) { + return ""; + } + return address; +} + +void PayToEdit::parseAsMultiline(const QStringList &lines) { + m_outputs.clear(); + m_total = 0; + + int i = 0; + for (auto &line : lines) { + PartialTxOutput output = this->parseAddressAndAmount(line); + if (output.address.isEmpty() && output.amount == 0) { + m_errors.append(PayToLineError(line, "Expected two comma-separated values: (address, amount)", i, true)); + continue; + } else if (output.address.isEmpty()) { + m_errors.append(PayToLineError(line, "Invalid address", i, true)); + continue; + } else if (output.amount == 0) { + m_errors.append(PayToLineError(line, "Invalid amount", i, true)); + continue; + } + + m_outputs.append(output); + m_total += output.amount; + i += 1; + } +} \ No newline at end of file diff --git a/src/widgets/PayToEdit.h b/src/widgets/PayToEdit.h new file mode 100644 index 0000000..74d66cc --- /dev/null +++ b/src/widgets/PayToEdit.h @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. +// Copyright (c) 2012 thomasv@gitorious + +#ifndef WOWLET_PAYTOEDIT_H +#define WOWLET_PAYTOEDIT_H + +#include +#include + +#include "utils/utils.h" + +struct PartialTxOutput { + explicit PartialTxOutput(QString address = "", quint64 amount = 0) + : address(address), amount(amount) {} + + QString address; + quint64 amount; +}; + +struct PayToLineError { + explicit PayToLineError(QString lineContent, QString error, int idx = 0, bool isMultiline = false) + : lineContent(lineContent), error(error), idx(idx), isMultiline(isMultiline) {} + + QString lineContent; + QString error; + int idx; + bool isMultiline; +}; + +class PayToEdit : public QPlainTextEdit +{ +Q_OBJECT + +public: + explicit PayToEdit(QWidget *parent = nullptr); + + void setNetType(NetworkType::Type netType); + void setText(const QString &text); + QString text(); + + QVector getErrors(); + QVector getOutputs(); + quint64 getTotal(); + + QStringList lines(); + bool isMultiline(); + void payToMany(); + bool isOpenAlias(); + +private: + void checkText(); + void updateSize(); + + PartialTxOutput parseAddressAndAmount(const QString &line); + quint64 parseAmount(QString amount); + QString parseAddress(QString address); + + void parseAsMultiline(const QStringList &lines); + + int m_heightMin = 0; + int m_heightMax = 150; + quint64 m_total = 0; + NetworkType::Type m_netType = NetworkType::Type::MAINNET; + + QVector m_errors; + QVector m_outputs; +}; + +#endif //WOWLET_PAYTOEDIT_H diff --git a/src/widgets/RedditPost.h b/src/widgets/RedditPost.h index b7d3e48..05bf06e 100644 --- a/src/widgets/RedditPost.h +++ b/src/widgets/RedditPost.h @@ -1,18 +1,19 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_REDDITPOST_H -#define FEATHER_REDDITPOST_H +#ifndef WOWLET_REDDITPOST_H +#define WOWLET_REDDITPOST_H #include struct RedditPost { - RedditPost(const QString &title, const QString &author, const QString &url, int comments) : title(title), author(author), url(url), comments(comments){}; + RedditPost(const QString &title, const QString &author, const QString &permalink, int comments) + : title(title), author(author), permalink(permalink), comments(comments){}; QString title; QString author; - QString url; + QString permalink; int comments; }; -#endif //FEATHER_REDDITPOST_H +#endif //WOWLET_REDDITPOST_H diff --git a/src/widgets/ccsprogressdelegate.cpp b/src/widgets/ccsprogressdelegate.cpp index 4fdb82a..2431989 100644 --- a/src/widgets/ccsprogressdelegate.cpp +++ b/src/widgets/ccsprogressdelegate.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "ccsprogressdelegate.h" @@ -31,7 +31,7 @@ void CCSProgressDelegate::paint(QPainter *painter, const QStyleOptionViewItem &o progressBarOption.textVisible = true; QSharedPointer entry = m_model->entry(index.row()); - auto target = QString("%1/%2 XMR").arg(entry->raised_amount).arg(entry->target_amount); + auto target = QString("%1/%2 WOW").arg(entry->raised_amount).arg(entry->target_amount); auto progress = (int)entry->percentage_funded; progressBarOption.progress = progress < 0 ? 0 : progress; progressBarOption.text = target; diff --git a/src/widgets/ccsprogressdelegate.h b/src/widgets/ccsprogressdelegate.h index b0a7c0f..cb20047 100644 --- a/src/widgets/ccsprogressdelegate.h +++ b/src/widgets/ccsprogressdelegate.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CSSPROGRESSDELEGATE_H -#define FEATHER_CSSPROGRESSDELEGATE_H +#ifndef WOWLET_CSSPROGRESSDELEGATE_H +#define WOWLET_CSSPROGRESSDELEGATE_H #include #include "model/CCSModel.h" @@ -20,4 +20,4 @@ private: }; -#endif //FEATHER_CSSPROGRESSDELEGATE_H +#endif //WOWLET_CSSPROGRESSDELEGATE_H diff --git a/src/widgets/ccswidget.cpp b/src/widgets/ccswidget.cpp index 3a15373..a170ad6 100644 --- a/src/widgets/ccswidget.cpp +++ b/src/widgets/ccswidget.cpp @@ -1,15 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include -#include #include #include "ccswidget.h" #include "ui_ccswidget.h" -#include "utils/utils.h" #include "ccsprogressdelegate.h" CCSWidget::CCSWidget(QWidget *parent) : diff --git a/src/widgets/ccswidget.h b/src/widgets/ccswidget.h index 747195c..9fa367c 100644 --- a/src/widgets/ccswidget.h +++ b/src/widgets/ccswidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef CSSWIDGET_H #define CSSWIDGET_H diff --git a/src/widgets/forumwidget.cpp b/src/widgets/forumwidget.cpp new file mode 100644 index 0000000..f11e6cc --- /dev/null +++ b/src/widgets/forumwidget.cpp @@ -0,0 +1,74 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include +#include +#include + +#include "model/ForumModel.h" +#include "forumwidget.h" +#include "ui_forumwidget.h" +#include "utils/utils.h" +#include "utils/config.h" + +ForumWidget::ForumWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::ForumWidget), + m_model(new ForumModel(this)), + m_contextMenu(new QMenu(this)) +{ + ui->setupUi(this); + ui->tableView->setModel(m_model); + this->setupTable(); + + m_contextMenu->addAction("View thread", this, &ForumWidget::linkClicked); + m_contextMenu->addAction("Copy link", this, &ForumWidget::copyUrl); + connect(ui->tableView, &QHeaderView::customContextMenuRequested, this, &ForumWidget::showContextMenu); + + connect(ui->tableView, &QTableView::doubleClicked, this, &ForumWidget::linkClicked); + + ui->tableView->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); +} + +ForumModel* ForumWidget::model() { + return m_model; +} + +void ForumWidget::linkClicked() { + QModelIndex index = ui->tableView->currentIndex(); + auto post = m_model->post(index.row()); + + if (post) + Utils::externalLinkWarning(this, post->permalink); +} + +void ForumWidget::copyUrl() { + QModelIndex index = ui->tableView->currentIndex(); + auto post = m_model->post(index.row()); + + if (post) { + Utils::copyToClipboard(post->permalink); + emit setStatusText("Link copied to clipboard", true, 1000); + } +} + +void ForumWidget::setupTable() { + ui->tableView->verticalHeader()->setVisible(false); + ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); + + ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->tableView->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch); +} + +void ForumWidget::showContextMenu(const QPoint &pos) { + QModelIndex index = ui->tableView->indexAt(pos); + if (!index.isValid()) { + return; + } + + m_contextMenu->exec(ui->tableView->viewport()->mapToGlobal(pos)); +} + +ForumWidget::~ForumWidget() { + delete ui; +} diff --git a/src/widgets/forumwidget.h b/src/widgets/forumwidget.h new file mode 100644 index 0000000..5ddc120 --- /dev/null +++ b/src/widgets/forumwidget.h @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef FORUMWIDGET_H +#define FORUMWIDGET_H + +#include +#include +#include + +#include "model/ForumModel.h" + +namespace Ui { + class ForumWidget; +} + +class ForumWidget : public QWidget +{ + Q_OBJECT + +public: + explicit ForumWidget(QWidget *parent = nullptr); + ~ForumWidget(); + ForumModel* model(); + +public slots: + void linkClicked(); + +signals: + void setStatusText(const QString &msg, bool override, int timeout); + +private: + void setupTable(); + void showContextMenu(const QPoint &pos); + void copyUrl(); + + Ui::ForumWidget *ui; + ForumModel* const m_model; + QMenu *m_contextMenu; +}; + +#endif // FORUMWIDGET_H diff --git a/src/widgets/forumwidget.ui b/src/widgets/forumwidget.ui new file mode 100644 index 0000000..842b54d --- /dev/null +++ b/src/widgets/forumwidget.ui @@ -0,0 +1,61 @@ + + + ForumWidget + + + + 0 + 0 + 492 + 409 + + + + Form + + + + 4 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::CustomContextMenu + + + QAbstractItemView::NoEditTriggers + + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + false + + + + + + + + + linkClicked() + + diff --git a/src/widgets/nodewidget.cpp b/src/widgets/nodewidget.cpp index b91f1a9..64a3b20 100644 --- a/src/widgets/nodewidget.cpp +++ b/src/widgets/nodewidget.cpp @@ -1,21 +1,14 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include -#include #include -#include #include -#include #include #include -#include #include "model/NodeModel.h" #include "nodewidget.h" #include "ui_nodewidget.h" -#include "utils/utils.h" -#include "utils/nodes.h" #include "mainwindow.h" NodeWidget::NodeWidget(QWidget *parent) @@ -49,14 +42,11 @@ NodeWidget::NodeWidget(QWidget *parent) ui->customView->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->wsView, &QTreeView::customContextMenuRequested, this, &NodeWidget::onShowWSContextMenu); connect(ui->customView, &QTreeView::customContextMenuRequested, this, &NodeWidget::onShowCustomContextMenu); - - connect(ui->customView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect); - connect(ui->wsView, &QTreeView::doubleClicked, this, &NodeWidget::onContextConnect); } void NodeWidget::onShowWSContextMenu(const QPoint &pos) { m_activeView = ui->wsView; - FeatherNode node = this->selectedNode(); + WowletNode node = this->selectedNode(); if (node.full.isEmpty()) return; this->showContextMenu(pos, node); @@ -64,13 +54,13 @@ void NodeWidget::onShowWSContextMenu(const QPoint &pos) { void NodeWidget::onShowCustomContextMenu(const QPoint &pos) { m_activeView = ui->customView; - FeatherNode node = this->selectedNode(); + WowletNode node = this->selectedNode(); if (node.full.isEmpty()) return; this->showContextMenu(pos, node); } -void NodeWidget::showContextMenu(const QPoint &pos, const FeatherNode &node) { +void NodeWidget::showContextMenu(const QPoint &pos, const WowletNode &node) { QMenu menu(this); if (!node.isActive) { @@ -87,33 +77,28 @@ void NodeWidget::showContextMenu(const QPoint &pos, const FeatherNode &node) { } void NodeWidget::onContextConnect() { - QObject *obj = sender(); - if (obj == ui->customView) - m_activeView = ui->customView; - else - m_activeView = ui->wsView; - - FeatherNode node = this->selectedNode(); + //QObject *obj = sender(); + WowletNode node = this->selectedNode(); if (!node.full.isEmpty()) emit connectToNode(node); } void NodeWidget::onContextStatusURL() { - FeatherNode node = this->selectedNode(); + WowletNode node = this->selectedNode(); if (!node.full.isEmpty()) Utils::externalLinkWarning(this, node.as_url()); } void NodeWidget::onContextNodeCopy() { - FeatherNode node = this->selectedNode(); + WowletNode node = this->selectedNode(); Utils::copyToClipboard(node.full); } -FeatherNode NodeWidget::selectedNode() { +WowletNode NodeWidget::selectedNode() { QModelIndex index = m_activeView->currentIndex(); - if (!index.isValid()) return FeatherNode(); + if (!index.isValid()) return WowletNode(); - FeatherNode node; + WowletNode node; if (m_activeView == ui->customView) { node = m_customModel->node(index.row()); } else { @@ -125,10 +110,10 @@ FeatherNode NodeWidget::selectedNode() { void NodeWidget::onContextCustomNodeRemove() { QModelIndex index = ui->customView->currentIndex(); if (!index.isValid()) return; - FeatherNode node = m_customModel->node(index.row()); + WowletNode node = m_customModel->node(index.row()); auto nodes = m_ctx->nodes->customNodes(); - QMutableListIterator i(nodes); + QMutableListIterator i(nodes); while (i.hasNext()) if (i.next() == node) i.remove(); @@ -148,14 +133,14 @@ void NodeWidget::onCustomAddClicked(){ if (!ok || text.isEmpty()) return; - QList nodesList; + QList nodesList; auto newNodesList = text.split("\n"); for(auto &newNodeText: newNodesList) { newNodeText = newNodeText.replace("\r", "").trimmed(); if(newNodeText.isEmpty()) continue; - auto node = FeatherNode(newNodeText); + auto node = WowletNode(newNodeText); node.custom = true; nodesList.append(node); } diff --git a/src/widgets/nodewidget.h b/src/widgets/nodewidget.h index e02c289..e21e387 100644 --- a/src/widgets/nodewidget.h +++ b/src/widgets/nodewidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef NODEWIDGET_H #define NODEWIDGET_H @@ -40,7 +40,7 @@ private slots: void onContextNodeCopy(); signals: - void connectToNode(FeatherNode node); + void connectToNode(WowletNode node); void nodeSourceChanged(NodeSource nodeSource); private: @@ -56,8 +56,8 @@ private: QAction *m_contextActionOpenStatusURL; QAction *m_contextActionCopy; - void showContextMenu(const QPoint &pos, const FeatherNode &node); - FeatherNode selectedNode(); + void showContextMenu(const QPoint &pos, const WowletNode &node); + WowletNode selectedNode(); }; #endif // NODEWIDGET_H diff --git a/src/widgets/redditwidget.cpp b/src/widgets/redditwidget.cpp index ff92d2e..386c086 100644 --- a/src/widgets/redditwidget.cpp +++ b/src/widgets/redditwidget.cpp @@ -1,16 +1,15 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include -#include #include #include "model/RedditModel.h" #include "redditwidget.h" #include "ui_redditwidget.h" #include "utils/utils.h" +#include "utils/config.h" RedditWidget::RedditWidget(QWidget *parent) : QWidget(parent), @@ -23,6 +22,7 @@ RedditWidget::RedditWidget(QWidget *parent) : this->setupTable(); m_contextMenu->addAction("View thread", this, &RedditWidget::linkClicked); + m_contextMenu->addAction("Copy link", this, &RedditWidget::copyUrl); connect(ui->tableView, &QHeaderView::customContextMenuRequested, this, &RedditWidget::showContextMenu); connect(ui->tableView, &QTableView::doubleClicked, this, &RedditWidget::linkClicked); @@ -38,8 +38,17 @@ void RedditWidget::linkClicked() { QModelIndex index = ui->tableView->currentIndex(); auto post = m_model->post(index.row()); + if (post) + Utils::externalLinkWarning(this, this->getLink(post->permalink)); +} + +void RedditWidget::copyUrl() { + QModelIndex index = ui->tableView->currentIndex(); + auto post = m_model->post(index.row()); + if (post) { - Utils::externalLinkWarning(this, post->url); + Utils::copyToClipboard(this->getLink(post->permalink)); + emit setStatusText("Link copied to clipboard", true, 1000); } } @@ -60,6 +69,11 @@ void RedditWidget::showContextMenu(const QPoint &pos) { m_contextMenu->exec(ui->tableView->viewport()->mapToGlobal(pos)); } +QString RedditWidget::getLink(const QString &permaLink) { + QString redditFrontend = config()->get(Config::redditFrontend).toString(); + return QString("https://%1%2").arg(redditFrontend, permaLink); +} + RedditWidget::~RedditWidget() { delete ui; } diff --git a/src/widgets/redditwidget.h b/src/widgets/redditwidget.h index cb5b09f..d5d8fc1 100644 --- a/src/widgets/redditwidget.h +++ b/src/widgets/redditwidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef REDDITWIDGET_H #define REDDITWIDGET_H @@ -26,9 +26,14 @@ public: public slots: void linkClicked(); +signals: + void setStatusText(const QString &msg, bool override, int timeout); + private: void setupTable(); void showContextMenu(const QPoint &pos); + void copyUrl(); + QString getLink(const QString &permaLink); Ui::RedditWidget *ui; RedditModel* const m_model; diff --git a/src/widgets/restoreheightwidget.cpp b/src/widgets/restoreheightwidget.cpp index c920e9c..b0ecb2c 100644 --- a/src/widgets/restoreheightwidget.cpp +++ b/src/widgets/restoreheightwidget.cpp @@ -1,15 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#include #include -#include #include #include #include "restoreheightwidget.h" #include "ui_restoreheightwidget.h" -#include "utils/utils.h" RestoreHeightWidget::RestoreHeightWidget(QWidget *parent) : QWidget(parent), diff --git a/src/widgets/restoreheightwidget.h b/src/widgets/restoreheightwidget.h index 04c303b..a1418c3 100644 --- a/src/widgets/restoreheightwidget.h +++ b/src/widgets/restoreheightwidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef RESTOREHEIGHTWIDGET_H #define RESTOREHEIGHTWIDGET_H diff --git a/src/widgets/restoreheightwidget.ui b/src/widgets/restoreheightwidget.ui index 00cb7d3..70c4553 100644 --- a/src/widgets/restoreheightwidget.ui +++ b/src/widgets/restoreheightwidget.ui @@ -53,7 +53,7 @@ - 2014-04-18 + 2018-04-1 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter diff --git a/src/widgets/suchwowwidget.cpp b/src/widgets/suchwowwidget.cpp new file mode 100644 index 0000000..27af675 --- /dev/null +++ b/src/widgets/suchwowwidget.cpp @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#include +#include +#include +#include +#include + +#include "suchwowwidget.h" +#include "ui_suchwowwidget.h" +#include "utils/utils.h" +#include "utils/config.h" +#include "mainwindow.h" + + +SuchWowPost::SuchWowPost(AppContext *ctx, QObject *parent) : + QObject(parent), + m_ctx(ctx) { + m_networkImg = new UtilsNetworking(m_ctx->network, this); + m_networkThumb = new UtilsNetworking(m_ctx->network, this); + m_weburl = QString("%1/suchwow").arg(this->m_ctx->backendHTTPUrl); +} + +void SuchWowPost::onThumbReceived(QByteArray data) { + thumb_data.loadFromData(data, "JPEG"); + emit thumbReceived(this); +} + +void SuchWowPost::onImgReceived(QByteArray data) { + img_data.loadFromData(data); + emit imgReceived(this); +} + +SuchWowPost::~SuchWowPost() = default; + + +SuchWowWidget::SuchWowWidget(QWidget *parent) : + QWidget(parent), + ui(new Ui::SuchWowWidget), + m_contextMenu(new QMenu(this)) +{ + ui->setupUi(this); + this->setupTable(); + + m_contextMenu->addAction("View image", this, &SuchWowWidget::suchImage); + m_contextMenu->addAction("Donate", this, &SuchWowWidget::suchDonate); + + connect(ui->listWidget, &QListWidget::customContextMenuRequested, this, &SuchWowWidget::showContextMenu); + + // tip amount slider + ui->slider_tipAmount->setMinimum(1); + ui->slider_tipAmount->setMaximum(60); + ui->slider_tipAmount->setTickInterval(1); + ui->slider_tipAmount->setSingleStep(1); + double tipAmount = config()->get(Config::suchWowTipAmount).toDouble(); + ui->slider_tipAmount->setValue((int)(tipAmount * 10)); + connect(ui->slider_tipAmount, &QSlider::valueChanged, this, &SuchWowWidget::onTipSliderChanged); + this->setTipAmountLabel(); +} + +void SuchWowWidget::setupTable() { + ui->listWidget->setViewMode(QListWidget::IconMode); + ui->listWidget->setIconSize(QSize(256, 256)); + ui->listWidget->setResizeMode(QListWidget::Adjust); + ui->listWidget->setContextMenuPolicy(Qt::CustomContextMenu); +} + +void SuchWowWidget::onWS(QJsonArray such_data) { + if(this->m_ctx == nullptr) + m_ctx = MainWindow::getContext(); + + for (auto &&such_post: such_data) { + auto obj = such_post.toObject(); + auto uid = obj.value("id").toInt(); + if(m_lookup.contains(uid)) continue; + + auto post = new SuchWowPost(m_ctx, this); + post->added_by = obj.value("added_by").toString(); + post->addy = obj.value("addy").toString(); + post->title = obj.value("title").toString(); + post->img = obj.value("img").toString(); + post->thumb = obj.value("thumb").toString(); + post->href = obj.value("href").toString();; + post->uid = uid; + + m_lookup[post->uid] = post; + connect(post, &SuchWowPost::thumbReceived, this, &SuchWowWidget::addThumb); + post->download_thumb(); + } +} + +void SuchWowWidget::addThumb(SuchWowPost *post) { + auto *item = new SuchWidgetItem(QIcon(post->thumb_data), post->title, post); + ui->listWidget->addItem(item); + ui->listWidget->sortItems(); +} + +void SuchWowWidget::showContextMenu(const QPoint &pos) { + QModelIndex index = ui->listWidget->indexAt(pos); + if (!index.isValid()) + return; + m_contextMenu->exec(ui->listWidget->viewport()->mapToGlobal(pos)); +} + +void SuchWowWidget::suchImage() { + auto *post = this->itemToPost(); + if(post == nullptr) + return; + + if(!post->img_data && !post->isFetchingImage()) { + connect(post, &SuchWowPost::imgReceived, this, &SuchWowWidget::showImage); + post->download_img(); + return; + } + + this->showImage(post); +} + +void SuchWowWidget::showImage(SuchWowPost *post) { + const auto title = QString("%1 - %2").arg(post->title, post->added_by); + QMessageBox mb(title, "", + QMessageBox::NoIcon, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton); + mb.setIconPixmap(post->img_data); + mb.exec(); +} + +void SuchWowWidget::suchDonate() { + auto *post = this->itemToPost(); + if(post != nullptr) + emit donate(post->addy); +} + +SuchWowPost *SuchWowWidget::itemToPost() { + QListWidgetItem *item = ui->listWidget->currentItem(); + QString title = item->text(); + + for(const auto &such_key: m_lookup.keys()) { + if(m_lookup[such_key]->title == title) + return m_lookup[such_key]; + } + + return nullptr; +} + +void SuchWowWidget::setTipAmountLabel(double tipAmount) { + if(tipAmount == 0.0) + tipAmount = config()->get(Config::suchWowTipAmount).toDouble(); + + QString amount_fmt = Utils::amountToCurrencyString(tipAmount, config()->get(Config::preferredFiatCurrency).toString()); + ui->label_tipAmount->setText(QString("Default tip amount (%1)").arg(amount_fmt)); +} + +void SuchWowWidget::onTipSliderChanged(int value) { + double amount = (double)value / 10; + config()->set(Config::suchWowTipAmount, amount); + setTipAmountLabel(amount); +} + +void SuchWowWidget::onPreferredFiatCurrencyChanged(const QString &symbol) { + this->setTipAmountLabel(); +} + +SuchWowWidget::~SuchWowWidget() { + delete ui; +} diff --git a/src/widgets/suchwowwidget.h b/src/widgets/suchwowwidget.h new file mode 100644 index 0000000..8e9de35 --- /dev/null +++ b/src/widgets/suchwowwidget.h @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef SUCHWOWWIDGET_H +#define SUCHWOWWIDGET_H + +#include +#include +#include +#include +#include + +#include "utils/networking.h" +#include "appcontext.h" + +namespace Ui { + class SuchWowWidget; +} + +class SuchWowPost : public QObject +{ +Q_OBJECT + +public: + explicit SuchWowPost(AppContext *ctx, QObject *parent = nullptr); + ~SuchWowPost(); + + QString title; + QString added_by; + QString thumb; + QString img; + QString addy; + QString href; + uint uid; + + QPixmap thumb_data; + QPixmap img_data; + + void download_thumb() { + const QString url = QString("%1/%2").arg(m_weburl, this->thumb); + connect(m_networkThumb, &UtilsNetworking::webReceived, this, &SuchWowPost::onThumbReceived); + m_networkThumb->get(url); + } + + void download_img() { + const QString url = QString("%1/%2").arg(m_weburl, this->img); + connect(m_networkImg, &UtilsNetworking::webReceived, this, &SuchWowPost::onImgReceived); + m_networkImg->get(url); + } + + bool isFetchingImage() { return m_networkImg->busy; } + bool isFetchingThumb() { return m_networkThumb->busy; } + +private slots: + void onThumbReceived(QByteArray data); + void onImgReceived(QByteArray data); + +signals: + void imgReceived(SuchWowPost *post); + void thumbReceived(SuchWowPost *post); + +private: + QString m_weburl; + AppContext *m_ctx = nullptr; + UtilsNetworking *m_networkThumb = nullptr; + UtilsNetworking *m_networkImg = nullptr; +}; + +class SuchWowWidget : public QWidget +{ +Q_OBJECT + +public: + explicit SuchWowWidget(QWidget *parent = nullptr); + ~SuchWowWidget(); + +public slots: + void onWS(QJsonArray such_data); + void onPreferredFiatCurrencyChanged(const QString &symbol); + +private slots: + void addThumb(SuchWowPost *post); + void showImage(SuchWowPost *post); + void onTipSliderChanged(int value); + +signals: + void donate(QString donate); + void openImage(SuchWowPost *post); + +private: + void setupTable(); + void suchDonate(); + void suchImage(); + void setTipAmountLabel(double tipAmount = 0.0); + SuchWowPost* itemToPost(); + void showContextMenu(const QPoint &pos); + + QMap m_lookup; + Ui::SuchWowWidget *ui; + AppContext *m_ctx = nullptr; + QMenu *m_contextMenu; +}; + +class SuchWidgetItem : public QListWidgetItem +{ +public: + explicit SuchWidgetItem(const QIcon &icon, const QString &text, SuchWowPost *post, QListWidget *parent = nullptr, int type = Type) { + this->setIcon(icon); + this->setText(text); + this->post = post; + } + + SuchWowPost *post; + + // sort + virtual bool operator< (const QListWidgetItem &other) const { + auto const *_other = dynamic_cast(&other); + return this->post->uid > _other->post->uid; + } +}; + +#endif // SUCHWOWWIDGET_H \ No newline at end of file diff --git a/src/widgets/suchwowwidget.ui b/src/widgets/suchwowwidget.ui new file mode 100644 index 0000000..887b0cd --- /dev/null +++ b/src/widgets/suchwowwidget.ui @@ -0,0 +1,51 @@ + + + SuchWowWidget + + + + 0 + 0 + 492 + 409 + + + + Form + + + + + + + + + + + Default tip amount + + + + + + + + 280 + 16777215 + + + + Qt::Horizontal + + + + + + + + + + + linkClicked() + + diff --git a/src/widgets/tickerwidget.cpp b/src/widgets/tickerwidget.cpp index 17c9a47..184ecfc 100644 --- a/src/widgets/tickerwidget.cpp +++ b/src/widgets/tickerwidget.cpp @@ -1,74 +1,41 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "tickerwidget.h" #include "ui_tickerwidget.h" -#include "appcontext.h" -#include "utils/config.h" #include "mainwindow.h" -TickerWidget::TickerWidget(QWidget *parent, QString symbol, QString title, bool convertBalance, bool hidePercent) : +TickerWidget::TickerWidget(QWidget *parent, QString title) : QWidget(parent), - ui(new Ui::TickerWidget), - m_symbol(std::move(symbol)), - m_convertBalance(convertBalance), - m_hidePercent(hidePercent) + ui(new Ui::TickerWidget) { ui->setupUi(this); m_ctx = MainWindow::getContext(); - // default values before API data - if (title == "") title = m_symbol; - this->ui->tickerBox->setTitle(title); QString defaultPct = "0.0"; QString defaultFiat = "..."; this->setFontSizes(); this->setPctText(defaultPct, true); - this->setFiatText(defaultFiat, 0.0); + this->setFiatText(defaultFiat); + this->setTitleText(title); - ui->tickerPct->setHidden(hidePercent); - - connect(AppContext::prices, &Prices::fiatPricesUpdated, this, &TickerWidget::init); - connect(AppContext::prices, &Prices::cryptoPricesUpdated, this, &TickerWidget::init); - if (convertBalance) - connect(m_ctx, &AppContext::balanceUpdated, this, &TickerWidget::init); + connect(AppContext::prices, &Prices::fiatPricesUpdated, this, &TickerWidget::reload); + connect(AppContext::prices, &Prices::cryptoPricesUpdated, this, &TickerWidget::reload); + connect(m_ctx, &AppContext::balanceUpdated, this, &TickerWidget::reload); } -void TickerWidget::init() { - if(!AppContext::prices->markets.count() || !AppContext::prices->rates.count()) - return; - - QString fiatCurrency = config()->get(Config::preferredFiatCurrency).toString(); - - if(!AppContext::prices->rates.contains(fiatCurrency)){ - config()->set(Config::preferredFiatCurrency, "USD"); - return; - } - - double amount = m_convertBalance ? AppContext::balance : 1.0; - double conversion = AppContext::prices->convert(m_symbol, fiatCurrency, amount); - if (conversion < 0) return; - - auto markets = AppContext::prices->markets; - if(!markets.contains(m_symbol)) return; - - bool hidePercent = (conversion == 0 || m_hidePercent); - if (hidePercent) { - ui->tickerPct->hide(); - } else { - auto pct24h = markets[m_symbol].price_usd_change_pct_24h; - auto pct24hText = QString::number(pct24h, 'f', 2); - this->setPctText(pct24hText, pct24h >= 0.0); - } - - this->setFiatText(fiatCurrency, conversion); +void TickerWidget::setFiatText(QString &text) { + ui->tickerFiat->setText(text); } -void TickerWidget::setFiatText(QString &fiatCurrency, double amount) { - QString conversionText = Utils::amountToCurrencyString(amount, fiatCurrency); - ui->tickerFiat->setText(conversionText); +void TickerWidget::setTitleText(QString text) { + ui->tickerBox->setTitle(text); +} + +void TickerWidget::hidePct(bool hide) { + ui->tickerPct->setHidden(hide); } void TickerWidget::setPctText(QString &text, bool positive) { diff --git a/src/widgets/tickerwidget.h b/src/widgets/tickerwidget.h index 0955b72..872cb77 100644 --- a/src/widgets/tickerwidget.h +++ b/src/widgets/tickerwidget.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef TICKERWIDGET_H #define TICKERWIDGET_H @@ -17,21 +17,19 @@ class TickerWidget : public QWidget Q_OBJECT public: - explicit TickerWidget(QWidget *parent, QString symbol, QString title = "", bool convertBalance = false, bool hidePercent = false); - void setFiatText(QString &fiatCurrency, double amount); + explicit TickerWidget(QWidget *parent, QString title = ""); + void setFiatText(QString &text); + void setTitleText(QString text); void setPctText(QString &text, bool positive); void setFontSizes(); + void hidePct(bool hide); ~TickerWidget() override; - -public slots: - void init(); +signals: + void reload(); private: Ui::TickerWidget *ui; - QString m_symbol; - bool m_convertBalance; - bool m_hidePercent; AppContext *m_ctx; }; diff --git a/src/widgets/txproofwidget.cpp b/src/widgets/txproofwidget.cpp index d7b54d4..81385af 100644 --- a/src/widgets/txproofwidget.cpp +++ b/src/widgets/txproofwidget.cpp @@ -1,8 +1,10 @@ +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + #include "txproofwidget.h" #include "ui_txproofwidget.h" #include -#include #include "utils/utils.h" diff --git a/src/widgets/txproofwidget.h b/src/widgets/txproofwidget.h index f6c5358..0be3146 100644 --- a/src/widgets/txproofwidget.h +++ b/src/widgets/txproofwidget.h @@ -1,5 +1,8 @@ -#ifndef FEATHER_TXPROOFWIDGET_H -#define FEATHER_TXPROOFWIDGET_H +// SPDX-License-Identifier: BSD-3-Clause +// Copyright (c) 2020-2021, The Monero Project. + +#ifndef WOWLET_TXPROOFWIDGET_H +#define WOWLET_TXPROOFWIDGET_H #include @@ -27,4 +30,4 @@ private: Wallet *m_wallet; }; -#endif //FEATHER_TXPROOFWIDGET_H +#endif //WOWLET_TXPROOFWIDGET_H diff --git a/src/widgets/xmrigwidget.cpp b/src/widgets/xmrigwidget.cpp index 9484afb..887eb03 100644 --- a/src/widgets/xmrigwidget.cpp +++ b/src/widgets/xmrigwidget.cpp @@ -1,37 +1,42 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include #include -#include #include #include -#include #include #include -#include #include "xmrigwidget.h" #include "ui_xmrigwidget.h" -#include "utils/utils.h" XMRigWidget::XMRigWidget(AppContext *ctx, QWidget *parent) : QWidget(parent), ui(new Ui::XMRigWidget), m_ctx(ctx), - m_model(new QStandardItemModel(this)), - m_contextMenu(new QMenu(this)) + m_modelRig(new QStandardItemModel(this)), + m_modelWownerod(new QStandardItemModel(this)), + m_contextMenuRig(new QMenu(this)), + m_contextMenuWownerod(new QMenu(this)) { ui->setupUi(this); + this->resetUI(); - QPixmap p(":assets/images/xmrig.svg"); - ui->lbl_logo->setPixmap(p.scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + QPixmap p(":assets/images/fire.png"); + ui->lbl_logo->setPixmap(p.scaled(268, 271, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - // table - ui->tableView->setModel(this->m_model); - m_contextMenu->addAction(QIcon(":/assets/images/network.png"), "Download file", this, &XMRigWidget::linkClicked); - connect(ui->tableView, &QHeaderView::customContextMenuRequested, this, &XMRigWidget::showContextMenu); - connect(ui->tableView, &QTableView::doubleClicked, this, &XMRigWidget::linkClicked); + // table XMRig + ui->tableRig->setModel(this->m_modelRig); + m_contextMenuRig->addAction(QIcon(":/assets/images/network.png"), "Download file", this, &XMRigWidget::rigLinkClicked); + connect(ui->tableRig, &QHeaderView::customContextMenuRequested, this, &XMRigWidget::showContextRigMenu); + connect(ui->tableRig, &QTableView::doubleClicked, this, &XMRigWidget::rigLinkClicked); + + // table wownerod + ui->tableWownerod->setModel(this->m_modelWownerod); + m_contextMenuWownerod->addAction(QIcon(":/assets/images/network.png"), "Download file", this, &XMRigWidget::wownerodLinkClicked); + connect(ui->tableWownerod, &QHeaderView::customContextMenuRequested, this, &XMRigWidget::showContextWownerodMenu); + connect(ui->tableWownerod, &QTableView::doubleClicked, this, &XMRigWidget::wownerodLinkClicked); // threads ui->threadSlider->setMinimum(1); @@ -48,78 +53,107 @@ XMRigWidget::XMRigWidget(AppContext *ctx, QWidget *parent) : connect(ui->btn_browse, &QPushButton::clicked, this, &XMRigWidget::onBrowseClicked); connect(ui->btn_clear, &QPushButton::clicked, this, &XMRigWidget::onClearClicked); - // defaults - ui->btn_stop->setEnabled(false); - ui->check_autoscroll->setChecked(true); - ui->relayTor->setChecked(false); - ui->check_tls->setChecked(true); - ui->label_status->setTextInteractionFlags(Qt::TextSelectableByMouse); - ui->label_status->hide(); - ui->soloFrame->hide(); - ui->poolFrame->hide(); + // graphics + bool simplifiedUI = config()->get(Config::simplifiedMiningInterface).toBool(); + ui->comboBox_gfx->setCurrentIndex(simplifiedUI ? 1 : 0); + connect(ui->comboBox_gfx, QOverload::of(&QComboBox::currentIndexChanged), this, &XMRigWidget::onSimplifiedMiningChanged); - // XMRig binary - auto path = config()->get(Config::xmrigPath).toString(); - if(!path.isEmpty()) { + // wownerod binary + auto path = config()->get(Config::wownerodPath).toString(); + if(!path.isEmpty()) ui->lineEdit_path->setText(path); - } - // pools - ui->poolFrame->show(); - ui->combo_pools->insertItems(0, m_pools); - auto preferredPool = config()->get(Config::xmrigPool).toString(); - if (m_pools.contains(preferredPool)) - ui->combo_pools->setCurrentIndex(m_pools.indexOf(preferredPool)); - else { - preferredPool = m_pools.at(0); - config()->set(Config::xmrigPool, preferredPool); - } - connect(ui->combo_pools, QOverload::of(&QComboBox::currentIndexChanged), this, &XMRigWidget::onPoolChanged); + connect(ui->lineEdit_path, &QLineEdit::textChanged, [=] { + config()->set(Config::wownerodPath, ui->lineEdit_path->text().trimmed()); + }); // info - ui->console->appendPlainText(QString("Detected %1 CPU threads.").arg(threads)); - if(!path.isEmpty() && !Utils::fileExists(path)) - ui->console->appendPlainText("Invalid path to XMRig binary detected. Please reconfigure on the Settings tab."); - else - ui->console->appendPlainText(QString("XMRig path set to %1").arg(path)); + this->appendText(QString("Detected %1 CPU threads.").arg(threads)); + if(path.isEmpty()) + this->appendText(QString("wownerod path is empty - please point towards the wownerod executable.").arg(path)); + else if(!Utils::fileExists(path)) + this->appendText("Invalid path to the wownerod executable detected. Please set the correct path."); + else { + this->appendText(QString("wownerod path set to '%1'").arg(path)); + this->appendText("Ready to mine."); + } +} - ui->console->appendPlainText("Ready to mine."); +void XMRigWidget::resetUI() { + ui->consoleFrame->hide(); + ui->qmlFrame->hide(); + ui->qmlFrameTxt->hide(); - // username/password - connect(ui->lineEdit_password, &QLineEdit::editingFinished, [=]() { - m_ctx->currentWallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text()); - m_ctx->currentWallet->store(); - }); - connect(ui->lineEdit_address, &QLineEdit::editingFinished, [=]() { - m_ctx->currentWallet->setCacheAttribute("feather.xmrig_username", ui->lineEdit_address->text()); - m_ctx->currentWallet->store(); - }); + ui->check_autoscroll->setChecked(true); + ui->label_status->setTextInteractionFlags(Qt::TextSelectableByMouse); + ui->label_status->hide(); + ui->console->clear(); - // checkbox connects - connect(ui->check_solo, &QCheckBox::stateChanged, this, &XMRigWidget::onSoloChecked); + this->destroyQml(); +} + +void XMRigWidget::startUI() { + this->resetUI(); + bool simplifiedUI = config()->get(Config::simplifiedMiningInterface).toBool(); + + if(simplifiedUI) { + this->initConsole(); + } else { + this->initQML(); + } +} + +void XMRigWidget::initConsole() { + ui->consoleFrame->show(); +} + +void XMRigWidget::initQML() { + if(m_quickWidget != nullptr) return; + m_quickWidget = new QQuickWidget(this); + + auto *qctx = m_quickWidget->rootContext(); + qctx->setContextProperty("cfg", config()); + qctx->setContextProperty("ctx", m_ctx); + qctx->setContextProperty("mining", this); + + m_quickWidget->setSource(QUrl("qrc:/mining.qml")); + m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView); + + connect((QObject*)m_quickWidget->rootObject(), SIGNAL(startMining()), + this, SLOT(onStartClicked())); + + connect((QObject*)m_quickWidget->rootObject(), SIGNAL(stopMining()), + this, SLOT(onStopClicked())); + + ui->qmlFrame->layout()->addWidget(m_quickWidget); + ui->qmlFrame->show(); + qDebug() << "created QML mining widget"; +} + +void XMRigWidget::destroyQml() { + if(m_quickWidget == nullptr) return; + m_quickWidget->disconnect(); + m_quickWidget->deleteLater(); + m_quickWidget = nullptr; + qDebug() << "destroyed QML mining widget"; +} + +void XMRigWidget::appendText(const QString &line) { + ui->console->appendPlainText(line); + m_consoleBuffer += 1; + if(m_consoleBuffer >= m_consoleBufferMax) { + ui->console->clear(); + m_consoleBuffer = 0; + } } void XMRigWidget::onWalletClosed() { this->onStopClicked(); this->onClearClicked(); - ui->lineEdit_password->setText(""); - ui->lineEdit_address->setText(""); } -void XMRigWidget::onWalletOpened(){ - // Xmrig username - auto username = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_username"); - if(!username.isEmpty()) - ui->lineEdit_address->setText(username); - - // Xmrig passwd - auto password = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_password"); - if(!password.isEmpty()) { - ui->lineEdit_password->setText(password); - } else { - ui->lineEdit_password->setText("featherwallet"); - m_ctx->currentWallet->setCacheAttribute("feather.xmrig_password", ui->lineEdit_password->text()); - } +void XMRigWidget::onWalletOpened(Wallet *wallet){ + int egiwoge = 1; } void XMRigWidget::onThreadsValueChanged(int threads) { @@ -127,98 +161,94 @@ void XMRigWidget::onThreadsValueChanged(int threads) { ui->label_threads->setText(QString("CPU threads: %1").arg(m_threads)); } -void XMRigWidget::onPoolChanged(int pos) { - config()->set(Config::xmrigPool, m_pools.at(pos)); -} - void XMRigWidget::onBrowseClicked() { QString fileName = QFileDialog::getOpenFileName( - this, "Path to XMRig executable", QDir::homePath()); + this, "Path to wownerod executable", QDir::homePath()); if (fileName.isEmpty()) return; - config()->set(Config::xmrigPath, fileName); + config()->set(Config::wownerodPath, fileName); ui->lineEdit_path->setText(fileName); } +void XMRigWidget::onSyncStatus(unsigned int from, unsigned int to, unsigned int pct) { + emit syncStatus(from, to, pct); +} + +void XMRigWidget::onDaemonStateChanged(DaemonMiningState state) { + if(state == DaemonMiningState::idle) { + ui->btn_stop->setEnabled(false); + ui->btn_start->setEnabled(true); + ui->label_status->hide(); + } else { + ui->btn_stop->setEnabled(true); + ui->btn_start->setEnabled(false); + ui->label_status->show(); + } + + m_daemonMiningState = state; + emit daemonMiningStateChanged(); +} + +void XMRigWidget::onUptimeChanged(const QString &uptime) { + emit uptimeChanged(uptime); +} + +void XMRigWidget::onBlockReward() { + QDateTime date = QDateTime::currentDateTime(); + QString formattedTime = date.toString("yyyy/MM/dd hh:mm"); + + auto reward = QString("Congrats: new block found at %1").arg(formattedTime); + + // @TODO: this might be blocking, what if multiple rewards happen? + QMessageBox::information(this, "Reward found", reward); +} + void XMRigWidget::onClearClicked() { ui->console->clear(); } void XMRigWidget::onStartClicked() { - QString xmrigPath; - bool solo = ui->check_solo->isChecked(); - xmrigPath = config()->get(Config::xmrigPath).toString(); + auto binPath = config()->get(Config::wownerodPath).toString(); + if(!m_ctx->XMRig->start(binPath, m_threads)) return; - // username is receiving address usually - auto username = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_username"); - auto password = m_ctx->currentWallet->getCacheAttribute("feather.xmrig_password"); - - if(username.isEmpty()) { - QString err = "Please specify a receiving address on the Settings screen"; - ui->console->appendPlainText(err); - QMessageBox::warning(this, "Error", err); - return; - } - - QString address; - if(solo) - address = ui->lineEdit_solo->text().trimmed(); - else - address = config()->get(Config::xmrigPool).toString(); - - if(address.contains("cryptonote.social") && !username.contains(".")) { - // cryptonote social requires ., we'll just grab a few chars from primary addy - username = QString("%1.%2").arg(username, m_ctx->currentWallet->address(0, 0).mid(0, 6)); - } - - m_ctx->XMRig->start(xmrigPath, m_threads, address, username, password, ui->relayTor->isChecked(), ui->check_tls->isChecked()); ui->btn_start->setEnabled(false); ui->btn_stop->setEnabled(true); - emit miningStarted(); } void XMRigWidget::onStopClicked() { - m_ctx->XMRig->stop(); - ui->btn_start->setEnabled(true); - ui->btn_stop->setEnabled(false); - ui->label_status->hide(); - emit miningEnded(); + if(m_ctx->XMRig->daemonMiningState != DaemonMiningState::idle) + m_ctx->XMRig->stop(); } void XMRigWidget::onProcessOutput(const QByteArray &data) { - auto output = Utils::barrayToString(data); - if(output.endsWith("\n")) - output = output.trimmed(); - - ui->console->appendPlainText(output); + auto line = Utils::barrayToString(data); + line = line.trimmed(); + this->appendText(line); if(ui->check_autoscroll->isChecked()) ui->console->verticalScrollBar()->setValue(ui->console->verticalScrollBar()->maximum()); } void XMRigWidget::onProcessError(const QString &msg) { - ui->console->appendPlainText("\n" + msg); - ui->btn_start->setEnabled(true); - ui->btn_stop->setEnabled(false); - ui->label_status->hide(); - emit miningEnded(); + this->appendText(msg); } -void XMRigWidget::onHashrate(const QString &hashrate) { +void XMRigWidget::onSimplifiedMiningChanged(int idx) { + config()->set(Config::simplifiedMiningInterface, idx == 1); + this->startUI(); +} + +void XMRigWidget::onHashrate(const QString &rate) { ui->label_status->show(); - ui->label_status->setText(QString("Mining at %1").arg(hashrate)); + ui->label_status->setText(QString("Mining at %1").arg(rate)); + emit hashrate(rate); } -void XMRigWidget::onDownloads(const QJsonObject &data) { - // For the downloads table we'll manually update the table - // with items once, as opposed to creating a class in - // src/models/. Saves effort; full-blown model - // is unnecessary in this case. - - m_model->clear(); - m_urls.clear(); +void XMRigWidget::onWownerodDownloads(const QJsonObject &data) { + m_modelWownerod->clear(); + m_urlsWownerod.clear(); auto version = data.value("version").toString(); - ui->label_latest_version->setText(QString("Latest version: %1").arg(version)); + ui->label_latest_version_wownerod->setText(QString("Latest version: %1").arg(version)); QJsonObject assets = data.value("assets").toObject(); const auto _linux = assets.value("linux").toArray(); @@ -243,54 +273,112 @@ void XMRigWidget::onDownloads(const QJsonObject &data) { auto _url = _obj.value("url").toString(); auto _created_at = _obj.value("created_at").toString(); - m_urls.append(_url); + m_urlsWownerod.append(_url); auto download_count = _obj.value("download_count").toInt(); - m_model->setItem(i, 0, Utils::qStandardItem(_name)); - m_model->setItem(i, 1, Utils::qStandardItem(_created_at)); - m_model->setItem(i, 2, Utils::qStandardItem(QString::number(download_count))); + m_modelWownerod->setItem(i, 0, Utils::qStandardItem(_name)); + m_modelWownerod->setItem(i, 1, Utils::qStandardItem(_created_at)); + m_modelWownerod->setItem(i, 2, Utils::qStandardItem(QString::number(download_count))); i++; } - m_model->setHeaderData(0, Qt::Horizontal, tr("Filename"), Qt::DisplayRole); - m_model->setHeaderData(1, Qt::Horizontal, tr("Date"), Qt::DisplayRole); - m_model->setHeaderData(2, Qt::Horizontal, tr("Downloads"), Qt::DisplayRole); + m_modelWownerod->setHeaderData(0, Qt::Horizontal, tr("Filename"), Qt::DisplayRole); + m_modelWownerod->setHeaderData(1, Qt::Horizontal, tr("Date"), Qt::DisplayRole); + m_modelWownerod->setHeaderData(2, Qt::Horizontal, tr("Downloads"), Qt::DisplayRole); - ui->tableView->verticalHeader()->setVisible(false); - ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); - ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui->tableView->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->tableView->setColumnWidth(2, 100); + ui->tableWownerod->verticalHeader()->setVisible(false); + ui->tableWownerod->setSelectionBehavior(QAbstractItemView::SelectRows); + ui->tableWownerod->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->tableWownerod->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); + ui->tableWownerod->setColumnWidth(2, 100); } -void XMRigWidget::showContextMenu(const QPoint &pos) { - QModelIndex index = ui->tableView->indexAt(pos); - if (!index.isValid()) { +void XMRigWidget::onMenuTabChanged(int index) { + if(m_tabIndex == globals::Tabs::XMRIG && index != m_tabIndex) + this->resetUI(); + else if(globals::Tabs(index + 1) == globals::Tabs::XMRIG) + this->startUI(); + m_tabIndex = index + 1; +} + +void XMRigWidget::onRigDownloads(const QJsonObject &data) { + m_modelRig->clear(); + m_urlsRig.clear(); + + auto version = data.value("version").toString(); + ui->label_latest_version_rig->setText(QString("Latest version: %1").arg(version)); + QJsonObject assets = data.value("assets").toObject(); + + const auto _linux = assets.value("linux").toArray(); + const auto macos = assets.value("macos").toArray(); + const auto windows = assets.value("windows").toArray(); + + auto info = QSysInfo::productType(); + QJsonArray *os_assets; + if(info == "osx") { + os_assets = const_cast(&macos); + } else if (info == "windows") { + os_assets = const_cast(&windows); + } else { + // assume linux + os_assets = const_cast(&_linux); + } + + int i = 0; + for(const auto &entry: *os_assets) { + auto _obj = entry.toObject(); + auto _name = _obj.value("name").toString(); + auto _url = _obj.value("url").toString(); + auto _created_at = _obj.value("created_at").toString(); + + m_urlsRig.append(_url); + auto download_count = _obj.value("download_count").toInt(); + + m_modelRig->setItem(i, 0, Utils::qStandardItem(_name)); + m_modelRig->setItem(i, 1, Utils::qStandardItem(_created_at)); + m_modelRig->setItem(i, 2, Utils::qStandardItem(QString::number(download_count))); + i++; + } + + m_modelRig->setHeaderData(0, Qt::Horizontal, tr("Filename"), Qt::DisplayRole); + m_modelRig->setHeaderData(1, Qt::Horizontal, tr("Date"), Qt::DisplayRole); + m_modelRig->setHeaderData(2, Qt::Horizontal, tr("Downloads"), Qt::DisplayRole); + + ui->tableRig->verticalHeader()->setVisible(false); + ui->tableRig->setSelectionBehavior(QAbstractItemView::SelectRows); + ui->tableRig->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents); + ui->tableRig->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); + ui->tableRig->setColumnWidth(2, 100); +} + +void XMRigWidget::showContextRigMenu(const QPoint &pos) { + QModelIndex index = ui->tableRig->indexAt(pos); + if (!index.isValid()) return; - } - m_contextMenu->exec(ui->tableView->viewport()->mapToGlobal(pos)); + m_contextMenuRig->exec(ui->tableRig->viewport()->mapToGlobal(pos)); } -void XMRigWidget::onSoloChecked(int state) { - if(state == 2) { - ui->poolFrame->hide(); - ui->soloFrame->show(); - ui->check_tls->setChecked(false); - } - else { - ui->poolFrame->show(); - ui->soloFrame->hide(); - } +void XMRigWidget::showContextWownerodMenu(const QPoint &pos) { + QModelIndex index = ui->tableWownerod->indexAt(pos); + if (!index.isValid()) + return; + m_contextMenuWownerod->exec(ui->tableWownerod->viewport()->mapToGlobal(pos)); } -void XMRigWidget::linkClicked() { - QModelIndex index = ui->tableView->currentIndex(); - auto download_link = m_urls.at(index.row()); +void XMRigWidget::wownerodLinkClicked() { + QModelIndex index = ui->tableWownerod->currentIndex(); + auto download_link = m_urlsWownerod.at(index.row()); + Utils::externalLinkWarning(this, download_link); +} + +void XMRigWidget::rigLinkClicked() { + QModelIndex index = ui->tableRig->currentIndex(); + auto download_link = m_urlsRig.at(index.row()); Utils::externalLinkWarning(this, download_link); } QStandardItemModel *XMRigWidget::model() { - return m_model; + return m_modelRig; } XMRigWidget::~XMRigWidget() { diff --git a/src/widgets/xmrigwidget.h b/src/widgets/xmrigwidget.h index daf87eb..9de5b3e 100644 --- a/src/widgets/xmrigwidget.h +++ b/src/widgets/xmrigwidget.h @@ -1,9 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef XMRIGWIDGET_H #define XMRIGWIDGET_H +#include +#include +#include +#include #include #include #include @@ -11,6 +15,7 @@ #include "utils/xmrig.h" #include "utils/config.h" #include "appcontext.h" +#include "globals.h" namespace Ui { class XMRigWidget; @@ -23,40 +28,73 @@ class XMRigWidget : public QWidget public: explicit XMRigWidget(AppContext *ctx, QWidget *parent = nullptr); ~XMRigWidget() override; + + Q_PROPERTY(int daemonMiningState READ daemonMiningState NOTIFY daemonMiningStateChanged); + int daemonMiningState() const { return m_daemonMiningState; } + QStandardItemModel *model(); public slots: void onWalletClosed(); - void onWalletOpened(); + void onWalletOpened(Wallet *wallet); void onStartClicked(); void onStopClicked(); void onClearClicked(); - void onDownloads(const QJsonObject &data); - void linkClicked(); + void onBlockReward(); + void onRigDownloads(const QJsonObject &data); + void onWownerodDownloads(const QJsonObject &data); + void rigLinkClicked(); + void wownerodLinkClicked(); void onProcessError(const QString &msg); void onProcessOutput(const QByteArray &msg); - void onHashrate(const QString &hashrate); - void onSoloChecked(int state); + void onHashrate(const QString &rate); + void onDaemonStateChanged(DaemonMiningState state); + void onSyncStatus(unsigned int from, unsigned int to, unsigned int pct); + void onUptimeChanged(const QString &uptime); + void onMenuTabChanged(int index); private slots: void onBrowseClicked(); void onThreadsValueChanged(int date); - void onPoolChanged(int pos); + void onSimplifiedMiningChanged(int idx); signals: - void miningStarted(); - void miningEnded(); + void daemonOutput(const QString &line); + void syncStatus(unsigned int from, unsigned int to, unsigned int pct); + void hashrate(const QString &rate); + void daemonMiningStateChanged(); + void uptimeChanged(const QString &uptime); + +//protected: +// void resizeEvent(QResizeEvent *event) override; private: - void showContextMenu(const QPoint &pos); + void showContextRigMenu(const QPoint &pos); + void showContextWownerodMenu(const QPoint &pos); + void appendText(const QString &line); AppContext *m_ctx; Ui::XMRigWidget *ui; - QStandardItemModel *m_model; - QMenu *m_contextMenu; + QStandardItemModel *m_modelRig; + QStandardItemModel *m_modelWownerod; + QMenu *m_contextMenuRig; + QMenu *m_contextMenuWownerod; int m_threads; - QStringList m_urls; - QStringList m_pools{"pool.xmr.pt:9000", "pool.supportxmr.com:9000", "mine.xmrpool.net:443", "xmrpool.eu:9999", "xmr-eu1.nanopool.org:14433", "pool.minexmr.com:6666", "us-west.minexmr.com:6666", "monerohash.com:9999", "cryptonote.social:5555", "cryptonote.social:5556"}; + QStringList m_urlsRig; + QStringList m_urlsWownerod; + unsigned int m_tabIndex = 0; + unsigned int m_consoleBuffer = 0; + unsigned int m_consoleBufferMax = 2000; + int m_daemonMiningState = 0; + + QQuickWidget *m_quickWidget = nullptr; + + void resetUI(); + void startUI(); + + void initConsole(); + void initQML(); + void destroyQml(); }; -#endif // REDDITWIDGET_H +#endif diff --git a/src/widgets/xmrigwidget.ui b/src/widgets/xmrigwidget.ui index 5fc6db9..841e5ec 100644 --- a/src/widgets/xmrigwidget.ui +++ b/src/widgets/xmrigwidget.ui @@ -6,8 +6,8 @@ 0 0 - 1329 - 540 + 854 + 431 @@ -29,22 +29,25 @@ - 1 + 0 Mining - - - + + + QFrame::NoFrame QFrame::Plain - + + 0 + + 0 @@ -57,14 +60,14 @@ 0 - + true - + @@ -119,105 +122,128 @@ + + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + QML area here + + + + + + Settings - - - + + + + + Qt::Vertical + + + + 20 + 386 + + + + + + - - - + + + + + Graphics + + + + + - - - - - Threads: - - - - - - - - - Qt::Horizontal - - - - - - + + Ultra + - - - Qt::Horizontal + + Potato + + + + + + + + Executable + + + + + + + + + Path to wownerod... - - - 0 - 20 - + + + + + + Browse - + - - - - QFrame::NoFrame + + + + CPU threads - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - - + + - - - TLS + + + Qt::Horizontal - - - Tor - - - - - - - Solo mine - - - - - + Qt::Horizontal @@ -231,209 +257,32 @@ - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - Pool - - - - - - - - 0 - 0 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - QFrame::NoFrame - - - QFrame::Plain - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - Node address - - - - - - - 127.0.0.1:18081 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - - - - - Receiving address - - - - - - - - - - Password (optional) - - - - - - - - - - XMRig executable - - - - - - - - - /path/to/xmrig - - - - - - - Browse - - - - - - - - + Qt::Horizontal - - QSizePolicy::Maximum - - 24 + 40 20 - + - logoimg + img - + Qt::Vertical @@ -449,30 +298,70 @@ - - - - Qt::Vertical + + + + + wownerod + + + + + + + + Latest version: + + + + + + + false + + + (right-click to download) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + Qt::CustomContextMenu - - - 20 - 0 - + + QAbstractItemView::NoEditTriggers - + + QAbstractItemView::SingleSelection + + + QAbstractItemView::SelectRows + + + false + + + false + + - Downloads + XMRig - + Latest version: @@ -494,7 +383,7 @@ - + Qt::CustomContextMenu diff --git a/src/wizard/createwallet.cpp b/src/wizard/createwallet.cpp index a33e376..e9359d6 100644 --- a/src/wizard/createwallet.cpp +++ b/src/wizard/createwallet.cpp @@ -1,18 +1,13 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "utils/utils.h" #include "wizard/createwallet.h" #include "wizard/walletwizard.h" #include "ui_createwallet.h" -#include "appcontext.h" -#include #include #include -#include - -#include "libwalletqt/WalletManager.h" CreateWalletPage::CreateWalletPage(AppContext *ctx, QWidget *parent) : QWizardPage(parent), diff --git a/src/wizard/createwallet.h b/src/wizard/createwallet.h index 050ff14..a51d68b 100644 --- a/src/wizard/createwallet.h +++ b/src/wizard/createwallet.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CREATEWALLET_H -#define FEATHER_CREATEWALLET_H +#ifndef WOWLET_CREATEWALLET_H +#define WOWLET_CREATEWALLET_H #include #include @@ -35,4 +35,4 @@ private: bool validateWidgets(); }; -#endif //FEATHER_CREATEWALLET_H +#endif //WOWLET_CREATEWALLET_H diff --git a/src/wizard/createwalletseed.cpp b/src/wizard/createwalletseed.cpp index 1bc8940..65da829 100644 --- a/src/wizard/createwalletseed.cpp +++ b/src/wizard/createwalletseed.cpp @@ -1,14 +1,12 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/createwalletseed.h" #include "wizard/walletwizard.h" #include "ui_createwalletseed.h" -#include "appcontext.h" -#include #include -#include +#include CreateWalletSeedPage::CreateWalletSeedPage(AppContext *ctx, QWidget *parent) : QWizardPage(parent), @@ -22,33 +20,60 @@ CreateWalletSeedPage::CreateWalletSeedPage(AppContext *ctx, QWidget *parent) : this->registerField("mnemonicSeed", ui->hiddenMnemonicSeed); ui->hiddenMnemonicSeed->hide(); - ui->seed->setFont(Utils::relativeFont(1)); + ui->seedWord2->setHelpText("In addition to the private spend key, Tevador's 14 word seed scheme also encodes the " + "restore date, cryptocurrency type, and reserves a few bits for future use. " + "The second word is static because the reserved bits remain the same for each seed generation."); connect(ui->btnRoulette, &QPushButton::clicked, [=]{ this->seedRoulette(0); }); + connect(ui->btnCopy, &QPushButton::clicked, [this]{ + Utils::copyToClipboard(m_mnemonic); + }); this->setButtonText(QWizard::FinishButton, "Create/Open wallet"); +} - // generate new seed - this->seedRoulette(m_rouletteSpin - 1); +void CreateWalletSeedPage::initializePage() { + this->generateSeed(); } void CreateWalletSeedPage::seedRoulette(int count) { count += 1; - if(count > m_rouletteSpin) return; - auto seed = FeatherSeed::generate(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage); - m_mnemonic = seed.mnemonicSeed; - m_restoreHeight = seed.restoreHeight; + if (count > m_rouletteSpin) + return; + + this->generateSeed(); - this->displaySeed(m_mnemonic); QTimer::singleShot(10, [=] { this->seedRoulette(count); }); } +void CreateWalletSeedPage::generateSeed() { + WowletSeed seed = WowletSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage); + m_mnemonic = seed.mnemonic.join(" "); + m_restoreHeight = seed.restoreHeight; + this->displaySeed(m_mnemonic); +} + void CreateWalletSeedPage::displaySeed(const QString &seed){ - ui->seed->setPlainText(seed); + QStringList seedSplit = seed.split(" "); + + ui->seedWord1->setText(seedSplit[0]); + ui->seedWord2->setText(seedSplit[1]); + ui->seedWord3->setText(seedSplit[2]); + ui->seedWord4->setText(seedSplit[3]); + ui->seedWord5->setText(seedSplit[4]); + ui->seedWord6->setText(seedSplit[5]); + ui->seedWord7->setText(seedSplit[6]); + ui->seedWord8->setText(seedSplit[7]); + ui->seedWord9->setText(seedSplit[8]); + ui->seedWord10->setText(seedSplit[9]); + ui->seedWord11->setText(seedSplit[10]); + ui->seedWord12->setText(seedSplit[11]); + ui->seedWord13->setText(seedSplit[12]); + ui->seedWord14->setText(seedSplit[13]); } int CreateWalletSeedPage::nextId() const { @@ -58,6 +83,16 @@ int CreateWalletSeedPage::nextId() const { bool CreateWalletSeedPage::validatePage() { if(m_mnemonic.isEmpty()) return false; if(!m_restoreHeight) return false; + + QMessageBox seedWarning(this); + seedWarning.setWindowTitle("Warning!"); + seedWarning.setText("• Never disclose your seed\n" + "• Never type it on a website\n" + "• Store it safely (offline)\n" + "• Do not lose your seed!"); + seedWarning.addButton("I understand", QMessageBox::AcceptRole); + seedWarning.exec(); + this->setField("mnemonicSeed", m_mnemonic); this->setField("restoreHeight", m_restoreHeight); emit createWallet(); diff --git a/src/wizard/createwalletseed.h b/src/wizard/createwalletseed.h index feb604e..b021891 100644 --- a/src/wizard/createwalletseed.h +++ b/src/wizard/createwalletseed.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_CREATEWALLETSEED_H -#define FEATHER_CREATEWALLETSEED_H +#ifndef WOWLET_CREATEWALLETSEED_H +#define WOWLET_CREATEWALLETSEED_H #include #include @@ -21,6 +21,7 @@ class CreateWalletSeedPage : public QWizardPage public: explicit CreateWalletSeedPage(AppContext *ctx, QWidget *parent = nullptr); + void initializePage() override; bool validatePage() override; int nextId() const override; @@ -29,6 +30,7 @@ public slots: private: void seedRoulette(int count); + void generateSeed(); signals: void createWallet(); @@ -45,4 +47,4 @@ private: int m_rouletteSpin = 15; }; -#endif //FEATHER_CREATEWALLETSEED_H +#endif //WOWLET_CREATEWALLETSEED_H diff --git a/src/wizard/createwalletseed.ui b/src/wizard/createwalletseed.ui index b5a7453..90949de 100644 --- a/src/wizard/createwalletseed.ui +++ b/src/wizard/createwalletseed.ui @@ -6,42 +6,442 @@ 0 0 - 438 - 444 + 529 + 510 WizardPage + + 0 + - - - - 16777215 - 90 - - - - Qt::NoFocus - - - QFrame::Box - - - QFrame::Plain - - - true - - - - - - - Qt::NoFocus - - + + + + + + + 1 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 5 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 9 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 13 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + + + + + 2 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 6 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 10 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 14 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + + + + + 3 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 7 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 11 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + + + + + + + + + + + + 4 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 8 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + 12 + + + + 5 + + + 6 + + + 5 + + + 5 + + + + + TextLabel + + + + + + + + + + + + + + + + @@ -58,6 +458,16 @@
+ + + + Qt::NoFocus + + + Copy + + + @@ -70,6 +480,13 @@ + + + + Qt::NoFocus + + + @@ -79,30 +496,7 @@ - Please save these 14 words on paper (order is important). This seed will allow you to recover your wallet in case of computer failure. - - - true - - - - - - - - 75 - true - - - - WARNING: - - - - - - - <html><head/><body><style>p{margin:0}</style><p>• Never disclose your seed.</p><p>• Never type it on a website.</p><p>• Store it safely (offline).</p><p>• <b>Do not lose your seed!</b></p></body></html> + Please save these 14 words on paper. This seed will allow you to recover your wallet in case of computer failure. true @@ -124,6 +518,13 @@ + + + HelpLabel + QLabel +
components.h
+
+
diff --git a/src/wizard/menu.cpp b/src/wizard/menu.cpp index 339fda5..0df315d 100644 --- a/src/wizard/menu.cpp +++ b/src/wizard/menu.cpp @@ -1,15 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/menu.h" #include "wizard/walletwizard.h" #include "ui_menu.h" -#include #include -#include - -#include "libwalletqt/WalletManager.h" MenuPage::MenuPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *parent) : QWizardPage(parent) @@ -18,6 +14,7 @@ MenuPage::MenuPage(AppContext *ctx, WalletKeysFilesModel *wallets, QWidget *pare , m_walletKeysFilesModel(wallets) { ui->setupUi(this); + this->setTitle("Welcome to WOWlet"); this->setButtonText(QWizard::FinishButton, "Open recent wallet"); } @@ -42,10 +39,5 @@ int MenuPage::nextId() const { } bool MenuPage::validatePage() { - // Check if file exists - // Check if wallet has password - // Check if wallet can be decrypted with entered password - - // TODO: Check if password is correct, otherwise show error message return true; } \ No newline at end of file diff --git a/src/wizard/menu.h b/src/wizard/menu.h index 2fb24a2..8d03d64 100644 --- a/src/wizard/menu.h +++ b/src/wizard/menu.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WIZARDMENU_H -#define FEATHER_WIZARDMENU_H +#ifndef WOWLET_WIZARDMENU_H +#define WOWLET_WIZARDMENU_H #include #include @@ -30,4 +30,4 @@ private: Ui::MenuPage *ui; }; -#endif //FEATHER_WIZARDMENU_H +#endif //WOWLET_WIZARDMENU_H diff --git a/src/wizard/menu.ui b/src/wizard/menu.ui index a45d1ee..493df71 100644 --- a/src/wizard/menu.ui +++ b/src/wizard/menu.ui @@ -80,26 +80,6 @@ - - - - false - - - by dsc & tobtoht - - - - - - - false - - - banner: themonera.art - - - diff --git a/src/wizard/network.cpp b/src/wizard/network.cpp index f3cbd23..ea3aed1 100644 --- a/src/wizard/network.cpp +++ b/src/wizard/network.cpp @@ -1,30 +1,24 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/network.h" -#include "wizard/walletwizard.h" #include "ui_network.h" -#include #include -#include - -#include "libwalletqt/WalletManager.h" NetworkPage::NetworkPage(AppContext *ctx, QWidget *parent) : QWizardPage(parent), ui(new Ui::NetworkPage), m_ctx(ctx) { ui->setupUi(this); - this->setTitle("Welcome to Feather!"); - this->setButtonText(QWizard::FinishButton, "walletKeysFilesModel"); + this->setTitle("Welcome to WOWlet"); ui->customFrame->hide(); - QPixmap p(":assets/images/feather.png"); - ui->featherImage->setText(""); - ui->featherImage->setPixmap(p.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - ui->label_eg->setText("Examples:\n- http://127.0.0.1:18089\n- my.node.com\n- my.node.com:18089\n- user:pass@my.node.com:18089"); + QPixmap p(":assets/images/wowlet.png"); + ui->wowletImage->setText(""); + ui->wowletImage->setPixmap(p.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation)); + ui->label_eg->setText("Examples:\n- http://127.0.0.1:34568\n- my.node.com\n- my.node.com:34568\n- user:pass@my.node.com:34568"); auto nodeSourceUInt = config()->get(Config::nodeSource).toUInt(); auto nodeSource = static_cast(nodeSourceUInt); @@ -65,7 +59,7 @@ bool NetworkPage::validatePage() { auto nodeText = ui->lineEdit_customNode->text().trimmed(); if(!nodeText.isEmpty()) { auto customNodes = m_ctx->nodes->customNodes(); - auto node = FeatherNode(nodeText); + auto node = WowletNode(nodeText); customNodes.append(node); m_ctx->setCustomNodes(customNodes); } diff --git a/src/wizard/network.h b/src/wizard/network.h index 9a28652..d58d606 100644 --- a/src/wizard/network.h +++ b/src/wizard/network.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WIZARDNETWORK_H -#define FEATHER_WIZARDNETWORK_H +#ifndef WOWLET_WIZARDNETWORK_H +#define WOWLET_WIZARDNETWORK_H #include #include @@ -30,4 +30,4 @@ private: Ui::NetworkPage *ui; }; -#endif //FEATHER_WIZARDNETWORK_H +#endif //WOWLET_WIZARDNETWORK_H diff --git a/src/wizard/network.ui b/src/wizard/network.ui index 62a5460..6066b02 100644 --- a/src/wizard/network.ui +++ b/src/wizard/network.ui @@ -17,7 +17,7 @@ - How would you like to connect to the Monero network? + How would you like to connect to the Wownero network? true @@ -29,7 +29,7 @@ - + 128 @@ -139,7 +139,7 @@ - 127.0.0.1:18089 + 127.0.0.1:34568 @@ -204,7 +204,7 @@ - Automatically connect to a remote node, hosted by the feather team and various trusted Monero community members. These nodes are provided as "best effort". + Automatically connect to a remote node, hosted by the wowlet team and various trusted Wownero community members. These nodes are provided as "best effort". true diff --git a/src/wizard/openwallet.cpp b/src/wizard/openwallet.cpp index 74facc6..f643495 100644 --- a/src/wizard/openwallet.cpp +++ b/src/wizard/openwallet.cpp @@ -1,12 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/openwallet.h" #include "ui_openwallet.h" -#include "appcontext.h" -#include "utils/config.h" -#include #include #include @@ -62,6 +59,7 @@ OpenWalletPage::OpenWalletPage(AppContext *ctx, WalletKeysFilesModel *wallets, Q connect(ui->walletTable->selectionModel(), &QItemSelectionModel::currentRowChanged, [this](QModelIndex current, QModelIndex prev){ this->updatePath(); }); + connect(ui->walletTable, &QTreeView::doubleClicked, this, &OpenWalletPage::validatePage); } void OpenWalletPage::initializePage() { diff --git a/src/wizard/openwallet.h b/src/wizard/openwallet.h index a6d0b78..7c4a0ad 100644 --- a/src/wizard/openwallet.h +++ b/src/wizard/openwallet.h @@ -1,8 +1,8 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_OPENWALLET_H -#define FEATHER_OPENWALLET_H +#ifndef WOWLET_OPENWALLET_H +#define WOWLET_OPENWALLET_H #include #include @@ -38,4 +38,4 @@ private: QStandardItemModel *m_model; }; -#endif //FEATHER_OPENWALLET_H +#endif //WOWLET_OPENWALLET_H diff --git a/src/wizard/openwallet.ui b/src/wizard/openwallet.ui index c0e3429..f2c3162 100644 --- a/src/wizard/openwallet.ui +++ b/src/wizard/openwallet.ui @@ -58,7 +58,7 @@ - path + diff --git a/src/wizard/restorewallet.cpp b/src/wizard/restorewallet.cpp index 839dc76..0430c2b 100644 --- a/src/wizard/restorewallet.cpp +++ b/src/wizard/restorewallet.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/restorewallet.h" #include "wizard/walletwizard.h" @@ -7,13 +7,10 @@ #include #include -#include -#include -#include +#include -#include // tevador 14 word - -#include "libwalletqt/WalletManager.h" +#include // tevador 14 word +#include "utils/WowletSeed.h" RestorePage::RestorePage(AppContext *ctx, QWidget *parent) : QWizardPage(parent), @@ -21,11 +18,10 @@ RestorePage::RestorePage(AppContext *ctx, QWidget *parent) : m_ctx(ctx) { ui->setupUi(this); this->setTitle("Restore wallet"); - this->setButtonText(QWizard::FinishButton, "walletKeysFilesModel"); ui->restoreFrame->hide(); ui->label_errorString->hide(); - QFont f("feather"); + QFont f("wowlet"); f.setStyleHint(QFont::Monospace); auto data = Utils::fileOpen(":/assets/mnemonic_25_english.txt"); @@ -34,6 +30,10 @@ RestorePage::RestorePage(AppContext *ctx, QWidget *parent) : for(int i = 0; i != 2048; i++) m_words14 << QString::fromStdString(wordlist::english.get_word(i)); + // Restore has limited error correction capability, namely it can correct a single erasure + // (illegible word with a known location). This can be tested by replacing a word with xxxx + m_words14 << "xxxx"; + // m_completer14Model = new QStringListModel(m_words14, m_completer14); m_completer14 = new QCompleter(this); @@ -132,13 +132,6 @@ bool RestorePage::validatePage() { return false; } } - - auto _seed = FeatherSeed::fromSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage, seed.toStdString()); - restoreHeight = _seed.restoreHeight; - - this->setField("restoreHeight", restoreHeight); - this->setField("mnemonicRestoredSeed", seed); - return true; } else if(m_mode == 25) { if(seedSplit.length() != 25) { ui->label_errorString->show(); @@ -155,15 +148,22 @@ bool RestorePage::validatePage() { return false; } } - - auto _seed = FeatherSeed::fromSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage, seed.toStdString()); - _seed.setRestoreHeight(restoreHeight); - this->setField("restoreHeight", restoreHeight); - this->setField("mnemonicSeed", seed); - this->setField("mnemonicRestoredSeed", seed); - return true; } - ui->seedEdit->setStyleSheet(errStyle); - return false; + auto _seed = WowletSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage, seedSplit); + if (!_seed.errorString.isEmpty()) { + QMessageBox::warning(this, "Invalid seed", QString("Invalid seed:\n\n%1").arg(_seed.errorString)); + ui->seedEdit->setStyleSheet(errStyle); + return false; + } + if (!_seed.correction.isEmpty()) { + QMessageBox::information(this, "Corrected erasure", QString("xxxx -> %1").arg(_seed.correction)); + } + + restoreHeight = _seed.restoreHeight; + + this->setField("restoreHeight", restoreHeight); + this->setField("mnemonicSeed", seed); + this->setField("mnemonicRestoredSeed", seed); + return true; } diff --git a/src/wizard/restorewallet.h b/src/wizard/restorewallet.h index 418d857..0b61d4e 100644 --- a/src/wizard/restorewallet.h +++ b/src/wizard/restorewallet.h @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WIZARDRESTORE_H -#define FEATHER_WIZARDRESTORE_H +#ifndef WOWLET_WIZARDRESTORE_H +#define WOWLET_WIZARDRESTORE_H -#include #include #include #include diff --git a/src/wizard/viewonlywallet.cpp b/src/wizard/viewonlywallet.cpp index 2c6d8cf..2488991 100644 --- a/src/wizard/viewonlywallet.cpp +++ b/src/wizard/viewonlywallet.cpp @@ -1,19 +1,11 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "wizard/viewonlywallet.h" #include "wizard/walletwizard.h" #include "ui_viewonlywallet.h" -#include #include -#include -#include -#include - -#include // tevador 14 word - -#include "libwalletqt/WalletManager.h" ViewOnlyPage::ViewOnlyPage(AppContext *ctx, QWidget *parent) : QWizardPage(parent), @@ -23,7 +15,7 @@ ViewOnlyPage::ViewOnlyPage(AppContext *ctx, QWidget *parent) : this->setTitle("Import view only wallet"); ui->label_errorString->hide(); - QFont f("feather"); + QFont f("wowlet"); f.setStyleHint(QFont::Monospace); auto *viewOnlyViewKeyDummy = new QLineEdit(this); diff --git a/src/wizard/viewonlywallet.h b/src/wizard/viewonlywallet.h index 1fbcff4..127cfd2 100644 --- a/src/wizard/viewonlywallet.h +++ b/src/wizard/viewonlywallet.h @@ -1,10 +1,9 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. -#ifndef FEATHER_WIZARDVIEWONLY_H -#define FEATHER_WIZARDVIEWONLY_H +#ifndef WOWLET_WIZARDVIEWONLY_H +#define WOWLET_WIZARDVIEWONLY_H -#include #include #include #include diff --git a/src/wizard/walletwizard.cpp b/src/wizard/walletwizard.cpp index 37c02a3..94306e7 100644 --- a/src/wizard/walletwizard.cpp +++ b/src/wizard/walletwizard.cpp @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #include "utils/utils.h" #include "wizard/walletwizard.h" @@ -11,18 +11,15 @@ #include "wizard/restorewallet.h" #include "wizard/viewonlywallet.h" -#include -#include #include #include #include -#include WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidget *parent) : QWizard(parent) , m_ctx(ctx) { - this->setWindowTitle("Welcome to Feather Wallet"); + this->setWindowTitle("Welcome to WOWlet"); this->setWindowIcon(QIcon(":/assets/images/appicons/64x64.png")); m_walletKeysFilesModel = new WalletKeysFilesModel(m_ctx, this); @@ -44,7 +41,14 @@ WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidge else setStartId(Page_Menu); - setPixmap(QWizard::WatermarkPixmap, QPixmap(":/assets/images/banners/3.png")); + setButtonText(QWizard::CancelButton, "Close"); + + // load banners + QDirIterator it(":/assets/images/welcome/", QDirIterator::Subdirectories); + while (it.hasNext()) { + m_banners << it.next(); + } + setWizardStyle(WizardStyle::ModernStyle); setOption(QWizard::NoBackButtonOnStartPage); @@ -64,6 +68,12 @@ WalletWizard::WalletWizard(AppContext *ctx, WalletWizard::Page startPage, QWidge }); } +void WalletWizard::randomBanner() { + int random = QRandomGenerator::global()->bounded(m_banners.count()); + auto header = m_banners.at(random); + setPixmap(QWizard::WatermarkPixmap, QPixmap(header)); +} + void WalletWizard::createWallet() { auto mnemonicRestoredSeed = this->field("mnemonicRestoredSeed").toString(); auto mnemonicSeed = mnemonicRestoredSeed.isEmpty() ? this->field("mnemonicSeed").toString() : mnemonicRestoredSeed; @@ -83,7 +93,8 @@ void WalletWizard::createWallet() { return; } - auto seed = FeatherSeed::fromSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName.toStdString(), m_ctx->seedLanguage, mnemonicSeed.toStdString()); + auto seed = WowletSeed(m_ctx->restoreHeights[m_ctx->networkType], m_ctx->coinName, m_ctx->seedLanguage, mnemonicSeed.split(" ")); + if(restoreHeight > 0) seed.setRestoreHeight(restoreHeight); m_ctx->createWallet(seed, walletPath, walletPasswd); diff --git a/src/wizard/walletwizard.h b/src/wizard/walletwizard.h index b295cc0..b469118 100644 --- a/src/wizard/walletwizard.h +++ b/src/wizard/walletwizard.h @@ -1,5 +1,5 @@ // SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. +// Copyright (c) 2020-2021, The Monero Project. #ifndef WALLETWIZARD_H #define WALLETWIZARD_H @@ -9,7 +9,7 @@ #include #include "appcontext.h" -#include "utils/seeds.h" +#include "utils/RestoreHeightLookup.h" #include "utils/config.h" class WalletWizard : public QWizard @@ -20,6 +20,7 @@ public: enum Page { Page_Menu, Page_CreateWallet, Page_CreateWalletSeed, Page_OpenWallet, Page_Network, Page_Restore, Page_ViewOnly }; explicit WalletWizard(AppContext *ctx, WalletWizard::Page startPage = WalletWizard::Page::Page_Menu, QWidget *parent = nullptr); + void randomBanner(); signals: void openWallet(QString path, QString password); @@ -28,7 +29,7 @@ signals: private: AppContext *m_ctx; WalletKeysFilesModel *m_walletKeysFilesModel; - + QStringList m_banners; void createWallet(); }; diff --git a/src/xmrtowidget.cpp b/src/xmrtowidget.cpp deleted file mode 100644 index 2b4cf76..0000000 --- a/src/xmrtowidget.cpp +++ /dev/null @@ -1,195 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#include "xmrtowidget.h" -#include "ui_xmrtowidget.h" -#include "dialog/xmrtoinfodialog.h" -#include "libwalletqt/WalletManager.h" -#include "mainwindow.h" -#include "globals.h" - -#include -#include - -XMRToWidget::XMRToWidget(QWidget *parent) : - QWidget(parent), - ui(new Ui::XMRToWidget) -{ - ui->setupUi(this); - m_ctx = MainWindow::getContext(); - - QString amount_rx = R"(^\d*\.\d*$)"; - QRegExp rx; - rx.setPattern(amount_rx); - QValidator *validator = new QRegExpValidator(rx, this); - ui->lineAmount->setValidator(validator); - - // xmrto logo (c) binaryFate et. al. :-D - QPixmap p(":assets/images/xmrto_big.png"); - ui->logo->setPixmap(p.scaled(112, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation)); - - ui->ratesLayout->hide(); - - // context menu - m_contextMenu = new QMenu(); - m_showDetailsAction = m_contextMenu->addAction("Details"); - m_viewOnXmrToAction = m_contextMenu->addAction("View order on XMR.to"); - m_viewOnXmrToAction->setIcon(QIcon(":/assets/images/xmrto.png")); - connect(m_showDetailsAction, &QAction::triggered, this, &XMRToWidget::showInfoDialog); - connect(m_viewOnXmrToAction, &QAction::triggered, [&](){ - QModelIndex index = ui->historyTable->currentIndex(); - XmrToOrder *order = this->tableModel->orders->at(index.row()); - emit viewOrder(order->uuid); - }); - - // connects - connect(ui->btnGetRates, &QPushButton::pressed, this, &XMRToWidget::onGetRates); - connect(ui->lineAmount, &QLineEdit::textChanged, this, &XMRToWidget::updateConversionLabel); - connect(ui->comboBox_currency, &QComboBox::currentTextChanged, this, &XMRToWidget::updateConversionLabel); - connect(ui->torCheckBox, &QCheckBox::stateChanged, this, &XMRToWidget::onTorCheckBoxToggled); - connect(ui->btnCreate, &QPushButton::clicked, this, &XMRToWidget::onCreateOrder); - - ui->historyTable->header()->setStretchLastSection(true); - ui->historyTable->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - ui->historyTable->setSelectionBehavior(QAbstractItemView::SelectRows); - ui->historyTable->setContextMenuPolicy(Qt::CustomContextMenu); - connect(ui->historyTable, &QTreeView::customContextMenuRequested, [&](const QPoint & point){ - QModelIndex index = ui->historyTable->indexAt(point); - if (index.isValid()) { - m_contextMenu->popup(ui->historyTable->viewport()->mapToGlobal(point)); - } - }); - - if (m_ctx->isTails || m_ctx->isWhonix) { - ui->torCheckBox->setDisabled(true); - } - - connect(ui->historyTable, &QTreeView::doubleClicked, this, &XMRToWidget::showInfoDialog); -} - -void XMRToWidget::setHistoryModel(XmrToModel *model) { - this->tableModel = model; - this->ui->historyTable->setModel(model); -} - -void XMRToWidget::onBalanceUpdated(quint64 balance, quint64 spendable) { - this->m_unlockedBalance = spendable / globals::cdiv; -} - -void XMRToWidget::onWalletClosed() { - ui->lineAddress->clear(); - ui->lineAmount->clear(); - ui->xmrLabelEstimate->setText("0.00 XMR"); -} - -void XMRToWidget::onCreateOrder() { - // @TODO: regex verify - - auto amount = ui->lineAmount->text(); - if(amount.isEmpty()) { - QMessageBox::warning(this, "Cannot create XMR.To order", "Invalid amount"); - return; - } - - double amount_num = amount.toDouble(); - QString amount_cur = (ui->comboBox_currency->currentIndex() == curr::BTC) ? "BTC" : "XMR"; - double amount_xmr = amount_num; - if (ui->comboBox_currency->currentIndex() == curr::BTC) { - amount_xmr = AppContext::prices->convert("BTC", "XMR", amount_num); - } - - auto available = m_unlockedBalance; - if(amount_xmr > available){ - QMessageBox::warning(this, "Cannot create XMR.To order", "Not enough Monero to create order."); - return; - } - - ui->btnGetRates->setEnabled(false); - ui->btnCreate->setEnabled(false); - - auto btc_address = ui->lineAddress->text(); - emit createOrder(amount_num, amount_cur, btc_address); - - QTimer::singleShot(2000, [=] { - ui->lineAmount->clear(); - ui->lineAddress->clear(); - ui->btnGetRates->setEnabled(true); - }); -} - -void XMRToWidget::onTorCheckBoxToggled(int state) { - ui->btnGetRates->setEnabled(true); - ui->btnCreate->setEnabled(false); - emit networkChanged(!state); -} - -void XMRToWidget::updateConversionLabel() { - QString amount = ui->lineAmount->text(); - - int curIndex = ui->comboBox_currency->currentIndex(); - QString symbolFrom = (curIndex == curr::XMR) ? "XMR" : "BTC"; - QString symbolTo = (curIndex == curr::XMR) ? "BTC" : "XMR"; - - if(amount.isEmpty()) { - ui->xmrLabelEstimate->setText(QString("0.00 %1").arg(symbolTo)); - return; - } - auto amount_num = amount.toDouble(); - auto amount_converted = AppContext::prices->convert(symbolFrom, symbolTo, amount_num); - auto amount_converted_str = QString::number(amount_converted, 'f', 2); - - auto fiat_cur = config()->get(Config::preferredFiatCurrency).toString(); - auto amount_fiat = AppContext::prices->convert(symbolFrom, fiat_cur, amount_num); - auto amount_fiat_str = QString::number(amount_fiat, 'f', 2); - - ui->xmrLabelEstimate->setText(QString("%1 %2, %3 %4").arg(amount_converted_str, symbolTo, amount_fiat_str, fiat_cur)); -} - -void XMRToWidget::onGetRates() { - ui->btnGetRates->setEnabled(false); - ui->btnCreate->setEnabled(false); - emit getRates(); -} - -void XMRToWidget::onConnectionError(QString msg) { - ui->btnGetRates->setEnabled(true); - ui->btnCreate->setEnabled(false); - msg = QString("%1\n\n%2").arg(msg).arg(m_regionBlockMessage); - QMessageBox::warning(this, "XMR.To Connection Error", msg); -} - -void XMRToWidget::onConnectionSuccess() { - ui->btnGetRates->setEnabled(true); - ui->btnCreate->setEnabled(true); -} - -void XMRToWidget::onRatesUpdated(XmrToRates rates) { - ui->label_rate->setText(QString("%1 BTC").arg(QString::number(rates.price))); - ui->label_minimum->setText(QString("%1 BTC").arg(QString::number(rates.lower_limit))); - ui->label_maximum->setText(QString("%1 BTC").arg(QString::number(rates.upper_limit))); - - if(!m_ratesDisplayed) { - ui->ratesLayout->setVisible(true); - m_ratesDisplayed = true; - } -} - -void XMRToWidget::onInitiateTransaction() { - ui->btnCreate->setEnabled(false); -} - -void XMRToWidget::onEndTransaction() { - ui->btnCreate->setEnabled(true); -} - -void XMRToWidget::showInfoDialog() { - QModelIndex index = ui->historyTable->currentIndex(); - XmrToOrder *order = this->tableModel->orders->at(index.row()); - auto *dialog = new XmrToInfoDialog(order, this); - dialog->exec(); - dialog->deleteLater(); -} - -XMRToWidget::~XMRToWidget() { - delete ui; -} diff --git a/src/xmrtowidget.h b/src/xmrtowidget.h deleted file mode 100644 index 5592f16..0000000 --- a/src/xmrtowidget.h +++ /dev/null @@ -1,67 +0,0 @@ -// SPDX-License-Identifier: BSD-3-Clause -// Copyright (c) 2020, The Monero Project. - -#ifndef XMRTOWIDGET_H -#define XMRTOWIDGET_H - -#include -#include "widgets/tickerwidget.h" -#include "utils/xmrto.h" -#include "appcontext.h" - -namespace Ui { - class XMRToWidget; -} - -class XMRToWidget : public QWidget -{ -Q_OBJECT - -public: - explicit XMRToWidget(QWidget *parent = nullptr); - void setHistoryModel(XmrToModel *model); - ~XMRToWidget(); - -public slots: - void onWalletClosed(); - void onGetRates(); - void onConnectionError(QString msg); - void onConnectionSuccess(); - void onRatesUpdated(XmrToRates rates); - void onTorCheckBoxToggled(int state); - void onCreateOrder(); - void onBalanceUpdated(quint64 balance, quint64 spendable); - void updateConversionLabel(); - - void onInitiateTransaction(); - void onEndTransaction(); - -signals: - void getRates(); - void networkChanged(bool clearnet); - void createOrder(double btnAmount, QString currency, QString btnAddress); - void viewOrder(const QString &orderId); - -private: - void showInfoDialog(); - - QMap m_tickerWidgets; - QMenu *m_contextMenu; - QAction *m_viewOnXmrToAction; - QAction *m_showDetailsAction; - - Ui::XMRToWidget *ui; - AppContext *m_ctx; - bool m_ratesDisplayed = false; - const QString m_regionBlockMessage = "Beware that XMR.To region blocks certain IPs, which can be problematic in combination with Tor. " - "Wait a few minutes for the circuit to switch, or disable the option to relay over Tor if the problem persists."; - double m_unlockedBalance = 0; - XmrToModel *tableModel; - - enum curr { - BTC = 0, - XMR - }; -}; - -#endif diff --git a/src/xmrtowidget.ui b/src/xmrtowidget.ui deleted file mode 100644 index 8726ea7..0000000 --- a/src/xmrtowidget.ui +++ /dev/null @@ -1,327 +0,0 @@ - - - XMRToWidget - - - - 0 - 0 - 896 - 472 - - - - Form - - - - - - - - - - Relay over Tor - - - true - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Get Rates - - - - - - - false - - - Create Order - - - - - - - - - Amount - - - - - - - - - 0 - - - - - - 0 - 0 - - - - - - - - - - - - - - - BTC - - - - - XMR - - - - - - - - - - 0.00 XMR - - - false - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - 0 - 0 - - - - - - - BTC address - - - - - - - Qt::Horizontal - - - QSizePolicy::Minimum - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 169 - 48 - - - - - - - - - - - - - - Pay to - - - - - - - - - QFrame::Sunken - - - Qt::Horizontal - - - - - - - - 0 - 0 - - - - - 0 - - - 1 - - - 0 - - - 6 - - - - - Rate (1 XMR) - - - - 6 - - - 6 - - - 6 - - - 4 - - - - - Rate - - - - - - - - - - Minimum - - - - 6 - - - 6 - - - 6 - - - 4 - - - - - Minimum - - - - - - - - - - Maximum - - - - 6 - - - 6 - - - 6 - - - 4 - - - - - Maximum - - - - - - - - - - - - - false - - - - - - - - diff --git a/utils/Info.plist b/utils/Info.plist index 00d3929..f368b92 100644 --- a/utils/Info.plist +++ b/utils/Info.plist @@ -3,7 +3,7 @@ LSMinimumSystemVersion - 10.10.0 + 10.0.0 NSPrincipalClass NSApplication @@ -18,16 +18,16 @@ ???? CFBundleExecutable - feather + wowlet CFBundleName - Feather + WOWlet NSHumanReadableCopyright Copyright © 2014-2021 The Monero Project CFBundleIdentifier - org.monero-project.feather + org.monero-project.wowlet CFBundleVersion @VERSION_LONG@ @@ -42,18 +42,10 @@ CFBundleURLName - monero Handler + wownero Handler CFBundleURLSchemes - monero - - - - CFBundleURLName - moneroseed Handler - CFBundleURLSchemes - - moneroseed + wownero diff --git a/utils/build_macos.sh b/utils/build_macos.sh index bf58960..c1948df 100644 --- a/utils/build_macos.sh +++ b/utils/build_macos.sh @@ -6,20 +6,20 @@ echo "[+] hash: $HASH" export DRONE=true echo "[+] Building" -rm ~/feather.zip 2>&1 >/dev/null -cd ~/feather -git fetch --all +rm ~/wowlet.zip 2>&1 >/dev/null +cd ~/wowlet +git fetch git reset --hard "$HASH" git submodule update --init --depth 120 monero git submodule update --init --depth 120 --recursive monero -cp "/Users/administrator/tor/libevent-2.1.7.dylib" "/Users/administrator/feather/src/assets/exec/libevent-2.1.7.dylib" +cp "/Users/administrator/tor/libevent-2.1.7.dylib" "/Users/administrator/wowlet/src/assets/exec/libevent-2.1.7.dylib" CMAKE_PREFIX_PATH="~/Qt/5.15.1/clang_64" TOR_BIN="/Users/administrator/tor/tor" make -j3 mac-release if [[ $? -eq 0 ]]; then - echo "[+] Feather built OK" - cd ~/feather/build/bin - zip -qr ~/feather.zip feather.app + echo "[+] WOWlet built OK" + cd ~/wowlet/build/bin + zip -qr ~/wowlet.zip wowlet.app else echo "[+] Error!" exit 1; diff --git a/utils/images/feather-home.png b/utils/images/feather-home.png deleted file mode 100644 index 85dcc67..0000000 Binary files a/utils/images/feather-home.png and /dev/null differ diff --git a/utils/images/wowlet-home.png b/utils/images/wowlet-home.png new file mode 100644 index 0000000..4a39f10 Binary files /dev/null and b/utils/images/wowlet-home.png differ diff --git a/utils/pubkeys/featherwallet.asc b/utils/pubkeys/featherwallet.asc deleted file mode 100644 index c047b2f..0000000 --- a/utils/pubkeys/featherwallet.asc +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQINBF/HogkBEAChsjCJUsZhDxOx5FrnRA3X5/mJd2xdKskLSPFtnYiQUtKvpRW6 -i/RVNMkTwFovzbXB6ucKJtY+OoEMu7xDhIkDWp//UlfHuP9AWAvqbhq6V5xVrZ41 -9oQ7JNN4gwAI8+ZjcNq3IVFQQ9mZ3py9t1IUdgWtWM3P/SD7vWiPIjG0D3Bt3Ptl -/mZjIFZZWUtFBItJLkiTpW0Ue4t98XMP6mvQiQ/LhP82OtSyCZ6agj4Wa3ve5KjA -pdEqamBGytx2kmN+AQFgMt66yOvr+97zzuEzI6mlWYORzOc1CFMsmPd6bu/dtQ4Z -96T8PNI6i1Lv5VqvqC7RBErvD7hO36JZb8j+PnbE1YADTKrw0HmgpI6d3RLyVop3 -n6ZQri0+nZ+TH0JG74MiihyZIz826zJO5OIwltexRcW0ZiRSpRCxZekU894lEs5Q -SxacRLeqM8ZVawB+9brqbeU3IJxmOCZgXLkkns0dBiSWGxtt+Tji+KXjogNfghmA -dVw9NQoBS+W5+pBtKEORD0YIGiUou9a7ukyMe2uvsl7rT+7BCOdvYtMBRbsfV5NP -s644wfJNIGa7OOjkWhuGwy6BVKTohDhJdKeZUpiTPKLV7ZLHjT4pkjuJgGQB7c+w -v7QYeUpwARwQNi8ZHuij2loG3Fb4l+3ejkcvivw0DLnDDhvUY57ezq53JwARAQAB -tCVGZWF0aGVyV2FsbGV0IDxkZXZAZmVhdGhlcndhbGxldC5vcmc+iQJOBBMBCgA4 -FiEEgYXhWKMzMMf9YbwNH3bhVc77pxwFAl/HogkCGwMFCwkIBwMFFQoJCAsFFgID -AQACHgECF4AACgkQH3bhVc77pxzAxw/9GYXGm71lUlZl2yfBPmo91euSc3w/irEC -88X1kFBsdKwL19B8HUaksCOQJRG8fJQmKvJmFnRZg3NK/GLIHam+1WVObFZc1MTv -y2ERzX5ILr9sb7FptB0Wr9gk0y0Nv032ZKci3wn1j2nA87o40uopDoQTaadDTKXa -s3M2+y6zM4dCmCaV6ylJromTzIaL2Q+tWSHDD8EDF2GbnfSeeEV6TV4xj3vqfT5P -34rK4vuVNxEy/YvRQJVRYntveNMJu9C4KJvIpo8onauUHEgBu4m+qfFpixDLwQzq -bJiJQaCUrwJ3liKMolBKiPqjGNl5JRRDy+YR1Dgsj6CRobWg1fDNnrGXUwDLaBwx -zVdCB0VSmcjXpt+FKTxw1mbY+6i6trUfJSjaaawXJbktOkO6sl0bVX83oQxEgod1 -aHwuo+eFCAW5zF0r+8R9Lk97Y5jkLWRKjXMFnMIyHaRhPdc24fOfojIQrXzQBMEO -lDhbWVd5vdOALhqvSOGYvjGjxBd9TE0pGzayNfPaee6kFEbxO3wZgF/QLPABl8i9 -b6hHJewpY5W9mM9/yP4lHL2TRcEMzk6I7XxPQUGEb3fzTAEHRM+My4SLwaUBIFvM -L8+hRhbfNnLZPd0xDAmvH6wToL3qgK/xSl9SYwuZkzaynblmyXE4+dCFp+T2XTam -FIbphOl8Yt+5Ag0EX8eiCQEQAKv0XnHtGhWTaq/sQ4lulYWNRjBsFQRMqwSFIosO -PfzWwATQeHxxIgRlWkc25w8W0O//t8x0UcNA5rU4R+C7kVrchVSYYYl9PY0vBhKP -3efVtPgntl/VgGH8LAdShHEt3H8ZDMFjqT6gx4xnpgt3C5OdGOA3bIWuvSZ1P7qp -SYiFZakrDfPeCdI/ifucipd+EnZhFv7ivnaoIGs+jgaImQH/5uEEVxpA89Bpxoju -gXlEKSVkVAanZsUwQkc/xzhsh8dzuEF5yKomVbwTYmXDTYmpff02ycdUP7gHw0Qg -WrWaQ2M0Xq1qcZL3ZpoaWUa/A92OfuncCSDNq1pRLqwJrExqQUP9cHGwGbqeGl8K -n2tFds8Pnnv+57ZKiO8E1VTDyBey1J3/Y1hOzctfEz6BzrL52Vj4vPWh2WNNh5fL -u1ZEIdykflH/Kho0zQkRfBfD93FbN/nH1xL3V7pO/wXVGqHSD3HbFLIcJ9Ax+Jgc -Z9fm9Bvc2RkXC8lJU5+htQ+YwHPLDExvUKrBL8b8xksODCvJSWLKcTPooFQyKgbK -EnPW5kmn3eT0SHHHOArn6EHoQttkR0pV2Lrgpfg+uhy3LSTmKbtRWo7VgDY0kfVL -hsatIUqYAVdDTBzsuMhehaoWwtLAsJ01OqxAoc6+0velLddLBuLxtzGtsF0u2mEF -QJmBABEBAAGJAjYEGAEKACAWIQSBheFYozMwx/1hvA0fduFVzvunHAUCX8eiCQIb -DAAKCRAfduFVzvunHDx1D/45GVAtIP1X640PR6N8qa4Iysc/crKepgDqm8zzvpQ8 -58MdeJZ9oPFEHDMkIMM8FGK9GbK4UE5mJzWJ2y5acMDOwvX4C9M206YaWQW9jPZt -fTfElP1KdAfTWz2/1UeOZKtOUuq9Wq+QlZGYg532JlX09TMyvINRM/w0+f4IBDlE -XIeRzRI6UQfz3BxpFpfWtMq/ayJnmJPrDsKQBPalai01OsbC+h4BUysZf1n7eTRF -DVaAKkSeOu+4gOVguE9PgKr11lDlKOI38tR6xBXzidBe3cPdun6vQbd1Bdfdmx3J -yFtlQo16kwwG2ZiVicXXugASBsrOFJa2/0lrtAPOnUWJsp2+1Ea6IzpRN8d1mNqr -6ND+CLxBsWj16UXq34GW6vt/QM7N1Br4/6SuPtv8OmDGRkRH7h2pz5yMf5GOwQFq -kgvOHt/x/sFPwk0GMgGn8aFr3vPH2YDg90mPn306Kv12e0JGkYVl4KqdL7u51gxT -3z5C/4+hhPVGHSPkf+g0VY/eY136kuuAZjV3P36M6UaBeCyqeD7b3fJ5IJcLwD9N -R0ustnn8IJ9zEwn+LY8kjRG8J3V57t2qAVGkMCiXnwFu3Vb+AYozOYi2ibu/N9QX -V4dTHarw64HUtLu/HEtcYuzuM5nGOXYvWPz3pQBtlqsyrhIfeaywQ+O55h5/KBo8 -Ig== -=2rq8 ------END PGP PUBLIC KEY BLOCK----- diff --git a/utils/pubkeys/tobtoht.asc b/utils/pubkeys/tobtoht.asc deleted file mode 100644 index 8fa20f4..0000000 --- a/utils/pubkeys/tobtoht.asc +++ /dev/null @@ -1,59 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- - -mQINBF2zfmoBEACrlG7MvTd0QpmSelCDHjO/speQpS34Up+PlJmtRqKXaTKap4ex -RmG0rEfJtaybkckrxJvl+niphLZeQfuxukyUGiqhRsjQLpSD2y3CXqfHkAQYY8Kl -ZGPRhRWCjGG9kbz+yoXz27/anszObHZwlK/JoBdn2u+O9tw8el+zaS5uewYCwEOn -ixrUdRhPLCLqz9rpO8YAwdEOk83ENr6U4xAwKBo2rhWPNBlNtG2KJAz+mS/Yarpz -vr/KFV09sDIgypJkkD+h6YpZ6xIRHa4mlDk6UvK2sGupMh6LU/LRMywaDurNMqOt -F4ja1abmyR5zZclLtx8fNqgRM9/EdKFL4+N1fp5CbJqIbI5kEYeyHtrGZCNQYP1m -yz8AcFIqd0BF9R0Fr0SYmnePqJWdIszE9JC+G0VccGzssHc30JUbvV4YyqlRq2m/ -ypb24Wr52ttHWVi+I+/LvRsfrRKpIG4VjQKAQ3FZF/MoY9YbPuZusVgx2X9RwtuO -AxgsTCNnkqXg2FC/NkeYluHRwSFMSMX2lFQcMK0+qo7xQCZ6Wx+GXTPSk6NLmnqt -l0J6fDUXLdKEr/wdVmeiyMcxjZGYOHLJOJ39QwxBiq11Y4BboYz4WUKtFDZJCkLJ -YoMkFNgoiDqPher9TZ3xcPRdvfuoDcn9GCcAjs0RRFNGskjdx4ujfbxHgQARAQAB -tEx0aG90Ym90ICgvdS9UaG90Ym90IG9uIERyZWFkLCAvdS90b2J0b2h0IG9uIFJl -ZGRpdCkgPHRob3Rib3RAcHJvdG9ubWFpbC5jb20+iQJOBBMBCAA4FiEExavlwOUP -orPxSrktHK3Sf0H0XDwFAl2zfmoCGwMFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AA -CgkQHK3Sf0H0XDxtXQ//Uw7SAH2tlwTTE/ehJbg2fZG4Jfn91XKtpEE8yMtqIHQc -QiGAp7pe/c851TTJ2aug6y0/9/usp4qMPhx4l/vNOHwe5sk+a2jm/Wxh+lfJqv6Q -+En7JmKRE7ZFCaTirEY5u4Qxepg/tSqD29ZN2uHeAVx3RTHSO05R6RMe6PPjEvsB -4xTOK7pKXI1Oxy0RJwRZSum8wwBUvmfeE78colyBekbl1A2TuIfEmfzPY+UjaxQj -28DUYsZ6RqFGBRnf6cMWm2iZx9FaLEZhqZUFL746vxIGwADgJmanI+f25UMPQfTP -EAlHZxpI/0oQb2QOGSJyFMQHgXVvR+u/QNbU0Uju/gW3/nqDRnPlBs5cwFcgjbPa -Txvkak/sgXYb30Ed47OXSH/VBR19QN8gMl3uMnTBWxC3z0Ps8TCgAS3K8tFuuRNs -eB2oLFlySbC3uFzDgh9DXmybF4MEdKckrjM4gGGf7uChjLBncUpGobsVDYTJuduJ -7ZLWPwvaFMXMcXQuHlJjf8qW54TQFYikZHx1uSU5j4xvT5F9k0HofJQQqbamIo/0 -nsxdufZs4fH1f8uDXKt7sWOw+TZlJPI6lqewys+3JVHkp/ByaSYn/a9R6ZHMkRb+ -RI1ezumoBAuA8JQd0X6VeiW0HOCEQekFlPZcf0obtdiY/bZrLjYOA+g5ZRMT3T2J -ATMEEAEIAB0WIQSDBDsI3YEB8o1xf+nlk5P7rJc+IAUCXbN/RQAKCRDlk5P7rJc+ -ICflB/9qji/RY09rTlUTLfXiKltQAEPjMvmmTIdNXHd+P5HsuZxn+dgJX8Vfk2R6 -GMF6XmUPTGe817/fnwzr+zU6rWwjLi/EATq8QlK1oJQ1H5proBHfRmDgnQRXB3JI -mfUUvSpt7keiDkH0/s/xbr7L2v6bYlEGssShsL51tHHfLn5mon/6pRC3szWvzN77 -KpUAFRy7Q7gTifCEKO0rjzfOd7aE01bj6FMftSlSqiDrf8SZMhdgn6+RkPu1nggx -Pf9pRSfhcaVWpZn9Y/DpESiLkHVo1WmgR7/TSjgmWTtWEeCe07X4bp2OCu5oFvfq -XXWbekH8MOyeLN1FHL58uqdBg+wCuQINBF2zfmoBEADMsraEqzx8HSS+1lRfb15U -T4yeIVNI5C58Z4WELxXzAYdeinlKgSIs0+fQf45UAR3q7gWQgxQZB8ojQPn1QfJE -tQ60tpzLlY8pCZhnuhtqM164OLkVThu5wJABbv5zRaohLVTNykYoVD2t/syAgMgn -1UuPPXBcG+I1fbAtclRyq3HnIcRkfym+adM08b7V6YEr4lHJOh8vGWmYuEzMpDnn -gRyWcuTvaHnJ3LGX49TDdL0OXeiL557Vvv1tQKcyGEmA+Su/QArBEfVK5FUK7EgB -gDxLVtqNOkaCSQykFr75ujXwTXV4VDFzsHXLA4js/robPkbaSFgn/NpFUuu82RPJ -7T5YoMXliiV8flYsdZyVlMq9nMbUbZ8yjJAIuGT/I/Q1KbWNK1cKS8co8RirjxlW -bS29Jak11f3XVqDg/Y1lT1LzQfDHSFY0c0hTjIWSOscGK4aQoNUJadwbuMBz2rSu -BXoeIpj5c8W5fNGx3CU1N34eIH6DbLzuhz/Ofhg1y/33hDaIu2EB87pYcWBHsLWy -6apmf8GctR4f8XtZrnfvaJTQkH05lP/d6uJr8bksPeUd6cM31eCX6DB/0MS2zY9i -5bKPPt3SPqZXu7aVObh/wNBkkMD2Zq76/aDDoXrYpHG1mW0Eo6m6vye5aFuqWy16 -5kLfIbolignWOBR2b6frfwARAQABiQI2BBgBCAAgFiEExavlwOUPorPxSrktHK3S -f0H0XDwFAl2zfmoCGwwACgkQHK3Sf0H0XDyM0hAAqcNPs83sLJcjMhIPIiLT7s1p -ghe+/+New+e+CI+vTjAYMWe38CbDxUzHxnuirpnbThu73CU5YeEirNOTqKsd3wBL -0xIHU/UtsBMX2TeRVUp4EzinbUJopP7wzTgLWEdSak9b0atuD6e9WRpgliL4fshu -aQJo0muM8uYjXTPpxUPG96F1dDvxenKC7b1B0J/Rwd5Ok0srHyvvgzVejX3M+Jg4 -E0bAY0agkY0kIX2odYrB+sG8X/zrjeI/B2wgAq1hzXQ6lGz70te3vP2/0hyUVrsb -TSnZB+2KWnveV3d8tBZBXzmYomIdgb+rOiDXQ5pccRq1+cf7X5ugwy4dNk7WbbQc -imYk0e40NeNjbWTeiMa0MRiytuatPs9N7OnhWrdEsvznmFHwp1P7kOpKzivPJu5Z -ijNMoBA+VDJN6L8Tz8M7efdUjOfz+Ak4GqjyFDy8VPomFS3PAz/7v2yhD+UjUl7o -r5JEOdSE0ksqK1OpnShoFXrAXwVQAyqmU2yKey2tfPlGpJQeJBdMSUJDNgaIb8mj -XZ0ls0fXknJfxhEZIdRGXT3m3GA6+AVELvlN94cY+1802h2bW/T2jKkzdor/AC6j -FCdMtwLy/TkxMq50/Nomjqz/CzLpyTQhAc6KWJC09lYsRG47qQ0Vel0pt74TO2kF -RR9alvpX5jGtupg5+1E= -=hD7u ------END PGP PUBLIC KEY BLOCK----- diff --git a/wownero b/wownero new file mode 160000 index 0000000..a21819c --- /dev/null +++ b/wownero @@ -0,0 +1 @@ +Subproject commit a21819cc22587e16af00e2c3d8f70156c11310a0