From 2af92ca3790809a8c5c2fe2e72ac8362ddbccb92 Mon Sep 17 00:00:00 2001 From: samcake Date: Thu, 2 Jun 2016 16:56:35 -0700 Subject: [PATCH 01/27] Adding a turntable script --- .../developer/utilities/render/turntable.js | 68 +++++++++++++++++++ .../developer/utilities/render/turntable.qml | 30 ++++++++ 2 files changed, 98 insertions(+) create mode 100644 scripts/developer/utilities/render/turntable.js create mode 100644 scripts/developer/utilities/render/turntable.qml diff --git a/scripts/developer/utilities/render/turntable.js b/scripts/developer/utilities/render/turntable.js new file mode 100644 index 0000000000..dcc6dcd0e0 --- /dev/null +++ b/scripts/developer/utilities/render/turntable.js @@ -0,0 +1,68 @@ +// +// turntable.js +// developer/utilities/render +// +// Sam Gateau, created on 6/2/2016. +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +// Set up the qml ui +var qml = Script.resolvePath('turntable.qml'); +var window = new OverlayWindow({ + title: 'Turntable', + source: qml, + width: 320, + height: 320 +}); +window.setPosition(500, 500); +window.closed.connect(function() { Script.stop(); }); + + + +function findClickedEntity(event) { + var pickZones = event.isControl; + + if (pickZones) { + Entities.setZonesArePickable(true); + } + + var pickRay = Camera.computePickRay(event.x, event.y); + + var entityResult = Entities.findRayIntersection(pickRay, true); // want precision picking + var lightResult = lightOverlayManager.findRayIntersection(pickRay); + lightResult.accurate = true; + + if (pickZones) { + Entities.setZonesArePickable(false); + } + + var result; + + if (!entityResult.intersects && !lightResult.intersects) { + return null; + } else if (entityResult.intersects && !lightResult.intersects) { + result = entityResult; + } else if (!entityResult.intersects && lightResult.intersects) { + result = lightResult; + } else { + if (entityResult.distance < lightResult.distance) { + result = entityResult; + } else { + result = lightResult; + } + } + + if (!result.accurate) { + return null; + } + + var foundEntity = result.entityID; + return { + pickRay: pickRay, + entityID: foundEntity, + intersection: result.intersection + }; +} diff --git a/scripts/developer/utilities/render/turntable.qml b/scripts/developer/utilities/render/turntable.qml new file mode 100644 index 0000000000..8c2af2593f --- /dev/null +++ b/scripts/developer/utilities/render/turntable.qml @@ -0,0 +1,30 @@ +// +// turntable.qml +// developer/utilities/render +// +// Created by Sam Gateau on 6/2/2016 +// Copyright 2016 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html +// +import QtQuick 2.5 +import QtQuick.Controls 1.4 + +Item { + id: statsUI + anchors.fill:parent + + Column { + id: stats + spacing: 8 + anchors.fill:parent + + Label { + text: "Turntable" + } + + } + +} + From bf93483f878814b99aa6a8c70e541081afcaf1fb Mon Sep 17 00:00:00 2001 From: humbletim Date: Wed, 19 Oct 2016 15:47:02 -0400 Subject: [PATCH 02/27] allow assignment client scripts to create ATP assets --- domain-server/src/DomainGatekeeper.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/domain-server/src/DomainGatekeeper.cpp b/domain-server/src/DomainGatekeeper.cpp index bf9d7d04a6..abe7ed176a 100644 --- a/domain-server/src/DomainGatekeeper.cpp +++ b/domain-server/src/DomainGatekeeper.cpp @@ -237,6 +237,7 @@ void DomainGatekeeper::updateNodePermissions() { userPerms.permissions |= NodePermissions::Permission::canAdjustLocks; userPerms.permissions |= NodePermissions::Permission::canRezPermanentEntities; userPerms.permissions |= NodePermissions::Permission::canRezTemporaryEntities; + userPerms.permissions |= NodePermissions::Permission::canWriteToAssetServer; } else { // this node is an agent const QHostAddress& addr = node->getLocalSocket().getAddress(); @@ -312,6 +313,7 @@ SharedNodePointer DomainGatekeeper::processAssignmentConnectRequest(const NodeCo userPerms.permissions |= NodePermissions::Permission::canAdjustLocks; userPerms.permissions |= NodePermissions::Permission::canRezPermanentEntities; userPerms.permissions |= NodePermissions::Permission::canRezTemporaryEntities; + userPerms.permissions |= NodePermissions::Permission::canWriteToAssetServer; newNode->setPermissions(userPerms); return newNode; } From c8d41463512803ffa3309796c91050585874ee42 Mon Sep 17 00:00:00 2001 From: Andrew Meadows Date: Fri, 28 Oct 2016 17:08:43 -0700 Subject: [PATCH 03/27] don't mirror eye animations --- libraries/animation/src/AnimSkeleton.cpp | 21 +++++++++++++++++++++ libraries/animation/src/AnimSkeleton.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/libraries/animation/src/AnimSkeleton.cpp b/libraries/animation/src/AnimSkeleton.cpp index 351c09beee..a379ebd80a 100644 --- a/libraries/animation/src/AnimSkeleton.cpp +++ b/libraries/animation/src/AnimSkeleton.cpp @@ -118,11 +118,26 @@ void AnimSkeleton::convertAbsoluteRotationsToRelative(std::vector& ro } } +void AnimSkeleton::saveNonMirroredPoses(const AnimPoseVec& poses) const { + _nonMirroredPoses.clear(); + for (int i = 0; i < (int)_nonMirroredIndices.size(); ++i) { + _nonMirroredPoses.push_back(poses[_nonMirroredIndices[i]]); + } +} + +void AnimSkeleton::restoreNonMirroredPoses(AnimPoseVec& poses) const { + for (int i = 0; i < (int)_nonMirroredIndices.size(); ++i) { + int index = _nonMirroredIndices[i]; + poses[index] = _nonMirroredPoses[i]; + } +} void AnimSkeleton::mirrorRelativePoses(AnimPoseVec& poses) const { + saveNonMirroredPoses(poses); convertRelativePosesToAbsolute(poses); mirrorAbsolutePoses(poses); convertAbsolutePosesToRelative(poses); + restoreNonMirroredPoses(poses); } void AnimSkeleton::mirrorAbsolutePoses(AnimPoseVec& poses) const { @@ -189,8 +204,14 @@ void AnimSkeleton::buildSkeletonFromJoints(const std::vector& joints) } // build mirror map. + _nonMirroredIndices.clear(); _mirrorMap.reserve(_joints.size()); for (int i = 0; i < (int)joints.size(); i++) { + if (_joints[i].name.endsWith("tEye")) { + // HACK: we don't want to mirror some joints so we remember their indices + // so we can restore them after a future mirror operation + _nonMirroredIndices.push_back(i); + } int mirrorJointIndex = -1; if (_joints[i].name.startsWith("Left")) { QString mirrorJointName = QString(_joints[i].name).replace(0, 4, "Right"); diff --git a/libraries/animation/src/AnimSkeleton.h b/libraries/animation/src/AnimSkeleton.h index 68cce11326..e1c6ae95c8 100644 --- a/libraries/animation/src/AnimSkeleton.h +++ b/libraries/animation/src/AnimSkeleton.h @@ -57,6 +57,9 @@ public: void convertAbsoluteRotationsToRelative(std::vector& rotations) const; + void saveNonMirroredPoses(const AnimPoseVec& poses) const; + void restoreNonMirroredPoses(AnimPoseVec& poses) const; + void mirrorRelativePoses(AnimPoseVec& poses) const; void mirrorAbsolutePoses(AnimPoseVec& poses) const; @@ -75,6 +78,8 @@ protected: AnimPoseVec _absoluteDefaultPoses; AnimPoseVec _relativePreRotationPoses; AnimPoseVec _relativePostRotationPoses; + mutable AnimPoseVec _nonMirroredPoses; + std::vector _nonMirroredIndices; std::vector _mirrorMap; // no copies From 91d878666cdc734d37d8e2e2920947fafe8e33cc Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 31 Oct 2016 14:56:28 -0700 Subject: [PATCH 04/27] Remove experimental scripts --- .../developer/utilities/render/turntable.js | 68 ------------------- .../developer/utilities/render/turntable.qml | 30 -------- 2 files changed, 98 deletions(-) delete mode 100644 scripts/developer/utilities/render/turntable.js delete mode 100644 scripts/developer/utilities/render/turntable.qml diff --git a/scripts/developer/utilities/render/turntable.js b/scripts/developer/utilities/render/turntable.js deleted file mode 100644 index dcc6dcd0e0..0000000000 --- a/scripts/developer/utilities/render/turntable.js +++ /dev/null @@ -1,68 +0,0 @@ -// -// turntable.js -// developer/utilities/render -// -// Sam Gateau, created on 6/2/2016. -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -// Set up the qml ui -var qml = Script.resolvePath('turntable.qml'); -var window = new OverlayWindow({ - title: 'Turntable', - source: qml, - width: 320, - height: 320 -}); -window.setPosition(500, 500); -window.closed.connect(function() { Script.stop(); }); - - - -function findClickedEntity(event) { - var pickZones = event.isControl; - - if (pickZones) { - Entities.setZonesArePickable(true); - } - - var pickRay = Camera.computePickRay(event.x, event.y); - - var entityResult = Entities.findRayIntersection(pickRay, true); // want precision picking - var lightResult = lightOverlayManager.findRayIntersection(pickRay); - lightResult.accurate = true; - - if (pickZones) { - Entities.setZonesArePickable(false); - } - - var result; - - if (!entityResult.intersects && !lightResult.intersects) { - return null; - } else if (entityResult.intersects && !lightResult.intersects) { - result = entityResult; - } else if (!entityResult.intersects && lightResult.intersects) { - result = lightResult; - } else { - if (entityResult.distance < lightResult.distance) { - result = entityResult; - } else { - result = lightResult; - } - } - - if (!result.accurate) { - return null; - } - - var foundEntity = result.entityID; - return { - pickRay: pickRay, - entityID: foundEntity, - intersection: result.intersection - }; -} diff --git a/scripts/developer/utilities/render/turntable.qml b/scripts/developer/utilities/render/turntable.qml deleted file mode 100644 index 8c2af2593f..0000000000 --- a/scripts/developer/utilities/render/turntable.qml +++ /dev/null @@ -1,30 +0,0 @@ -// -// turntable.qml -// developer/utilities/render -// -// Created by Sam Gateau on 6/2/2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html -// -import QtQuick 2.5 -import QtQuick.Controls 1.4 - -Item { - id: statsUI - anchors.fill:parent - - Column { - id: stats - spacing: 8 - anchors.fill:parent - - Label { - text: "Turntable" - } - - } - -} - From a23bbd1e4e067714dc7457689f1b25a772d9bffc Mon Sep 17 00:00:00 2001 From: samcake Date: Mon, 31 Oct 2016 16:40:15 -0700 Subject: [PATCH 05/27] Trying to extend the memory counter --- libraries/shared/src/GPUIdent.cpp | 3 ++- libraries/shared/src/GPUIdent.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index 02f92d87e7..a78163b570 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -10,6 +10,7 @@ #include + #ifdef Q_OS_WIN #include #include @@ -139,7 +140,7 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) var.ChangeType(CIM_UINT64); // We're going to receive some integral type, but it might not be uint. // We might be hosed here. The parameter is documented to be UINT32, but that's only 4 GB! const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024; - _dedicatedMemoryMB = (uint) (var.ullVal / BYTES_PER_MEGABYTE); + _dedicatedMemoryMB = (uint64_t) (var.ullVal / BYTES_PER_MEGABYTE); } else { qCDebug(shared) << "Unable to get video AdapterRAM"; diff --git a/libraries/shared/src/GPUIdent.h b/libraries/shared/src/GPUIdent.h index 4e844b0e54..8615e61b08 100644 --- a/libraries/shared/src/GPUIdent.h +++ b/libraries/shared/src/GPUIdent.h @@ -14,17 +14,19 @@ #ifndef hifi_GPUIdent_h #define hifi_GPUIdent_h +#include + class GPUIdent { public: - unsigned int getMemory() { return _dedicatedMemoryMB; } + uint64_t getMemory() { return _dedicatedMemoryMB; } QString getName() { return _name; } QString getDriver() { return _driver; } bool isValid() { return _isValid; } // E.g., GPUIdent::getInstance()->getMemory(); static GPUIdent* getInstance(const QString& vendor = "", const QString& renderer = "") { return _instance.ensureQuery(vendor, renderer); } private: - uint _dedicatedMemoryMB { 0 }; + uint64_t _dedicatedMemoryMB { 0 }; QString _name { "" }; QString _driver { "" }; bool _isQueried { false }; From b7f5fc2516393404786e8b17d01e9f00fdaa8575 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 1 Nov 2016 08:58:29 -0700 Subject: [PATCH 06/27] Update 'Sandbox' to 'High Fidelity Sandbox' in task manager --- server-console/packager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-console/packager.js b/server-console/packager.js index bc3b8989d2..89bcd7cb71 100644 --- a/server-console/packager.js +++ b/server-console/packager.js @@ -37,7 +37,7 @@ if (osType == "Darwin") { } else if (osType == "Windows_NT") { options["version-string"] = { CompanyName: "High Fidelity, Inc.", - FileDescription: SHORT_NAME, + FileDescription: FULL_NAME, ProductName: FULL_NAME, OriginalFilename: EXEC_NAME + ".exe" } From ea31a8e3b47d4a6e7c23b387d4671c5c70dd99dd Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 1 Nov 2016 08:59:56 -0700 Subject: [PATCH 07/27] Add VersionInfo.rc.in --- cmake/templates/VersionInfo.rc.in | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/templates/VersionInfo.rc.in diff --git a/cmake/templates/VersionInfo.rc.in b/cmake/templates/VersionInfo.rc.in new file mode 100644 index 0000000000..1d7b3fa585 --- /dev/null +++ b/cmake/templates/VersionInfo.rc.in @@ -0,0 +1,22 @@ +// Language and character set information as described at +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa381049(v=vs.85).aspx +#define US_ENGLISH_UNICODE "040904B0" + +// More information about the format of this file can be found at +// https://msdn.microsoft.com/en-us/library/windows/desktop/aa381058(v=vs.85).aspx +1 VERSIONINFO +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK US_ENGLISH_UNICODE + BEGIN + VALUE "CompanyName", "@BUILD_ORGANIZATION@" + VALUE "FileDescription", "@APP_FULL_NAME@" + VALUE "FileVersion", "@BUILD_VERSION@" + VALUE "InternalName", "@TARGET_NAME@" + VALUE "OriginalFilename", "@EXE_NAME@" + VALUE "ProductName", "@APP_FULL_NAME@" + VALUE "ProductVersion", "@BUILD_VERSION@" + END + END +END From 0cc98d4501e6d009d071fda0b262d3ecb9a7a28d Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 1 Nov 2016 09:00:08 -0700 Subject: [PATCH 08/27] Add VersionInfo.rc to interface --- interface/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index b43376c374..f3d684abf1 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -133,8 +133,13 @@ elseif (WIN32) set(CONFIGURE_ICON_RC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/Icon.rc") configure_file("${HF_CMAKE_DIR}/templates/Icon.rc.in" ${CONFIGURE_ICON_RC_OUTPUT}) + set(APP_FULL_NAME "High Fidelity Interface") + set(EXE_NAME "interface.exe") + set(CONFIGURE_VERSION_INFO_RC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.rc") + configure_file("${HF_CMAKE_DIR}/templates/VersionInfo.rc.in" ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) + # add an executable that also has the icon itself and the configured rc file as resources - add_executable(${TARGET_NAME} WIN32 ${INTERFACE_SRCS} ${QM} ${CONFIGURE_ICON_RC_OUTPUT}) + add_executable(${TARGET_NAME} WIN32 ${INTERFACE_SRCS} ${QM} ${CONFIGURE_ICON_RC_OUTPUT} ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) if (NOT DEV_BUILD) add_custom_command( From 5f8cee787fa06a9e84d44395c1ef71553c3ca667 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Tue, 1 Nov 2016 09:07:56 -0700 Subject: [PATCH 09/27] Update VersionInfo.rc.in to use TARGET_NAME.exe as original filename --- cmake/templates/VersionInfo.rc.in | 2 +- interface/CMakeLists.txt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/templates/VersionInfo.rc.in b/cmake/templates/VersionInfo.rc.in index 1d7b3fa585..ad192ed87d 100644 --- a/cmake/templates/VersionInfo.rc.in +++ b/cmake/templates/VersionInfo.rc.in @@ -14,7 +14,7 @@ BEGIN VALUE "FileDescription", "@APP_FULL_NAME@" VALUE "FileVersion", "@BUILD_VERSION@" VALUE "InternalName", "@TARGET_NAME@" - VALUE "OriginalFilename", "@EXE_NAME@" + VALUE "OriginalFilename", "@TARGET_NAME@.exe" VALUE "ProductName", "@APP_FULL_NAME@" VALUE "ProductVersion", "@BUILD_VERSION@" END diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index f3d684abf1..131c4ee509 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -134,7 +134,6 @@ elseif (WIN32) configure_file("${HF_CMAKE_DIR}/templates/Icon.rc.in" ${CONFIGURE_ICON_RC_OUTPUT}) set(APP_FULL_NAME "High Fidelity Interface") - set(EXE_NAME "interface.exe") set(CONFIGURE_VERSION_INFO_RC_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/VersionInfo.rc") configure_file("${HF_CMAKE_DIR}/templates/VersionInfo.rc.in" ${CONFIGURE_VERSION_INFO_RC_OUTPUT}) From 861944ba71e718391c69554ac1405ba61a3d19c3 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 1 Nov 2016 11:12:47 -0700 Subject: [PATCH 10/27] Try uing DXGI on windows instead of com --- libraries/shared/src/GPUIdent.cpp | 45 ++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index a78163b570..170d57fe4f 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -15,6 +15,9 @@ #include #include +#include +#pragma comment(lib, "dxgi.lib") + #elif defined(Q_OS_MAC) #include #endif @@ -54,9 +57,44 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) CGLDestroyRendererInfo(rendererInfo); #elif defined(Q_OS_WIN) + + + // Create the DXGI factory + // Let s get into DXGI land: + HRESULT hr = S_OK; + + IDXGIFactory1* pFactory = nullptr; + hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) ); + + // Select our adapter + IDXGIAdapter1* capableAdapter = nullptr; + { + for (UINT adapter = 0; !capableAdapter; ++adapter) { + // get a candidate DXGI adapter + IDXGIAdapter1* pAdapter = nullptr; + hr = pFactory->EnumAdapters1(adapter, &pAdapter); + if (FAILED(hr)) { + break; + } + // query to see if there exists a corresponding compute device + + // if so, mark it as the one against which to create our d3d10 device + capableAdapter = pAdapter; + capableAdapter->AddRef(); + + pAdapter->Release(); + } + } + + DXGI_ADAPTER_DESC1 adapterDesc; + capableAdapter->GetDesc1(&adapterDesc); + + capableAdapter->Release(); + pFactory->Release(); + // COM must be initialized already using CoInitialize. E.g., by the audio subsystem. CComPtr spLoc = NULL; - HRESULT hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc); + hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc); if (hr != S_OK || spLoc == NULL) { qCDebug(shared) << "Unable to connect to WMI"; return this; @@ -150,6 +188,11 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) } hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances); } + + const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024; + _dedicatedMemoryMB = (uint64_t)(adapterDesc.DedicatedVideoMemory / BYTES_PER_MEGABYTE); + + #endif return this; } From ae17135a075bec90f540d322718465e43bf766c1 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 1 Nov 2016 11:14:16 -0700 Subject: [PATCH 11/27] lock around quit flag to avoid shutdown race --- libraries/audio-client/src/AudioClient.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 5208b893ac..9bfdfe08c4 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -85,18 +85,26 @@ public: } void beforeAboutToQuit() { + Lock lock(_checkDevicesMutex); _quit = true; } void run() override { - while (!_quit) { + for (;;) { + { + Lock lock(_checkDevicesMutex); + if (_quit) { + break; + } + _audioClient->checkDevices(); + } QThread::msleep(DEVICE_CHECK_INTERVAL_MSECS); - _audioClient->checkDevices(); } } private: AudioClient* _audioClient { nullptr }; + Mutex _checkDevicesMutex; bool _quit { false }; }; From 137730dc50c66f3045a25d9ab874126ff479b2c0 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Tue, 1 Nov 2016 11:59:28 -0700 Subject: [PATCH 12/27] coding standard --- libraries/audio-client/src/AudioClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 9bfdfe08c4..062991c187 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -90,7 +90,7 @@ public: } void run() override { - for (;;) { + while (true) { { Lock lock(_checkDevicesMutex); if (_quit) { From c4b59eafbb3e8b28f987f0550e3461f2d759a2a8 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 1 Nov 2016 14:09:25 -0700 Subject: [PATCH 13/27] Add 'Snapshot' text. My very first commit! --- interface/resources/qml/hifi/Card.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index 8c1b78af79..0ca7132c94 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -113,8 +113,8 @@ Rectangle { } FiraSansRegular { id: users; - visible: action === 'concurrency'; - text: onlineUsers; + visible: true; + text: ((action === 'concurrency') ? (onlineUsers) : ('Snapshot')); size: textSize; color: hifi.colors.white; anchors { From b98c6cb50f3e9e074b5750667768217f8611e347 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Tue, 1 Nov 2016 14:49:18 -0700 Subject: [PATCH 14/27] Change 'Snapshot' to 'snapshot' and use smaller font --- interface/resources/qml/hifi/Card.qml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/Card.qml b/interface/resources/qml/hifi/Card.qml index 0ca7132c94..70eab82910 100644 --- a/interface/resources/qml/hifi/Card.qml +++ b/interface/resources/qml/hifi/Card.qml @@ -113,9 +113,8 @@ Rectangle { } FiraSansRegular { id: users; - visible: true; - text: ((action === 'concurrency') ? (onlineUsers) : ('Snapshot')); - size: textSize; + text: (action === 'concurrency') ? onlineUsers : 'snapshot'; + size: (action === 'concurrency') ? textSize : textSizeSmall; color: hifi.colors.white; anchors { verticalCenter: usersImage.verticalCenter; From 49f1590e01ee2a1dfeed7b43b706a03cb1b82d02 Mon Sep 17 00:00:00 2001 From: samcake Date: Tue, 1 Nov 2016 16:51:57 -0700 Subject: [PATCH 15/27] Start detecting all the gpus --- libraries/shared/src/GPUIdent.cpp | 32 ++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index 170d57fe4f..02ef4b64ab 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -65,7 +65,12 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) IDXGIFactory1* pFactory = nullptr; hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory) ); + if (hr != S_OK || pFactory == nullptr) { + qCDebug(shared) << "Unable to create DXGI"; + return this; + } + std::vector adapterDescs; // Select our adapter IDXGIAdapter1* capableAdapter = nullptr; { @@ -77,21 +82,21 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) break; } // query to see if there exists a corresponding compute device - - // if so, mark it as the one against which to create our d3d10 device - capableAdapter = pAdapter; - capableAdapter->AddRef(); - + DXGI_ADAPTER_DESC1 adapterDesc; + pAdapter->GetDesc1(&adapterDesc); pAdapter->Release(); + + qCDebug(shared) << "Found adapter: " << adapterDesc.Description; + + adapterDescs.push_back(adapterDesc); + } } - - DXGI_ADAPTER_DESC1 adapterDesc; - capableAdapter->GetDesc1(&adapterDesc); - - capableAdapter->Release(); pFactory->Release(); + + + // COM must be initialized already using CoInitialize. E.g., by the audio subsystem. CComPtr spLoc = NULL; hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc); @@ -189,9 +194,10 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances); } - const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024; - _dedicatedMemoryMB = (uint64_t)(adapterDesc.DedicatedVideoMemory / BYTES_PER_MEGABYTE); - + if (adapterDescs.size()) { + const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024; + _dedicatedMemoryMB = (uint64_t)(adapterDescs[0].DedicatedVideoMemory / BYTES_PER_MEGABYTE); + } #endif return this; From e78d907db0a9d933a6f30b5929f6fcdc0ec009c2 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 1 Nov 2016 17:28:35 -0700 Subject: [PATCH 16/27] Add clo to launch interface after content loads --- server-console/src/main.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server-console/src/main.js b/server-console/src/main.js index d8a6f30ac1..6c82230601 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -868,6 +868,12 @@ function onContentLoaded() { homeServer.start(); } + // If we were launched with the launchInterface option, then we need to launch interface now + if (argv.launchInterface) { + log.debug("Interface launch requested... argv.launchInterface:", argv.launchInterface); + startInterface(); + } + // If we were launched with the shutdownWatcher option, then we need to watch for the interface app // shutting down. The interface app will regularly update a running state file which we will check. // If the file doesn't exist or stops updating for a significant amount of time, we will shut down. From 46102d93c6f95d7f2cebe3ab65a6b0520a12d3c1 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 1 Nov 2016 18:13:20 -0700 Subject: [PATCH 17/27] Launch interface on install after content loading --- cmake/templates/NSIS.template.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/templates/NSIS.template.in b/cmake/templates/NSIS.template.in index 568418afe1..d65612351c 100644 --- a/cmake/templates/NSIS.template.in +++ b/cmake/templates/NSIS.template.in @@ -571,7 +571,9 @@ Function HandlePostInstallOptions ; both launches use the explorer trick in case the user has elevated permissions for the installer ; it won't be possible to use this approach if either application should be launched with a command line param ${If} ${SectionIsSelected} ${@SERVER_COMPONENT_NAME@} - Exec '"$WINDIR\explorer.exe" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@"' + ; create shortcut with ARGUMENTS + CreateShortCut "$TEMP\SandboxShortcut.lnk" "$INSTDIR\@CONSOLE_INSTALL_SUBDIR@\@CONSOLE_WIN_EXEC_NAME@" "-- --launchInterface" + Exec '"$WINDIR\explorer.exe" "$TEMP\SandboxShortcut.lnk"' ${Else} Exec '"$WINDIR\explorer.exe" "$INSTDIR\@INTERFACE_WIN_EXEC_NAME@"' ${EndIf} From a948e03ed8d831dfbffa0dfbb06c7ebeb9d2bd06 Mon Sep 17 00:00:00 2001 From: Dante Ruiz Date: Tue, 1 Nov 2016 23:09:59 +0100 Subject: [PATCH 18/27] changed old icon to new icon --- interface/resources/qml/UpdateDialog.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/interface/resources/qml/UpdateDialog.qml b/interface/resources/qml/UpdateDialog.qml index ca3a2da577..5e05601ce4 100644 --- a/interface/resources/qml/UpdateDialog.qml +++ b/interface/resources/qml/UpdateDialog.qml @@ -20,10 +20,10 @@ ScrollingWindow { anchors.centerIn: parent UpdateDialog { id: updateDialog - + implicitWidth: backgroundRectangle.width implicitHeight: backgroundRectangle.height - + readonly property int contentWidth: 500 readonly property int logoSize: 60 readonly property int borderWidth: 30 @@ -36,7 +36,7 @@ ScrollingWindow { signal triggerBuildDownload signal closeUpdateDialog - + Rectangle { id: backgroundRectangle color: "#ffffff" @@ -47,7 +47,7 @@ ScrollingWindow { Image { id: logo - source: "../images/interface-logo.svg" + source: "../images/hifi-logo.svg" width: updateDialog.logoSize height: updateDialog.logoSize anchors { @@ -65,7 +65,7 @@ ScrollingWindow { topMargin: updateDialog.borderWidth top: parent.top } - + Rectangle { id: header width: parent.width - updateDialog.logoSize - updateDialog.inputSpacing From 54496c2efff2618fda3f726cd24a838944091fd0 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 Nov 2016 09:02:39 -0700 Subject: [PATCH 19/27] Fix tutorial tracking wentToEntry if you haven't finished the tutorial --- tutorial/tutorial.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 4908465779..6c824d7bbb 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -971,6 +971,7 @@ TutorialManager = function() { var currentStep = null; var startedTutorialAt = 0; var startedLastStepAt = 0; + var didFinishTutorial = false; var wentToEntryStepNum; var VERSION = 1; @@ -1032,6 +1033,7 @@ TutorialManager = function() { info("DONE WITH TUTORIAL"); currentStepNum = -1; currentStep = null; + didFinishTutorial = true; return false; } else { info("Starting step", currentStepNum); @@ -1069,8 +1071,11 @@ TutorialManager = function() { // This is a message sent from the "entry" portal in the courtyard, // after the tutorial has finished. this.enteredEntryPortal = function() { - info("Got enteredEntryPortal, tracking"); - this.trackStep("wentToEntry", wentToEntryStepNum); + info("Got enteredEntryPortal"); + if (didFinishTutorial) { + info("Tracking wentToEntry"); + this.trackStep("wentToEntry", wentToEntryStepNum); + } } } From 3c777bb079fe93df3b3e4762dc75933c89f00845 Mon Sep 17 00:00:00 2001 From: samcake Date: Wed, 2 Nov 2016 12:29:51 -0700 Subject: [PATCH 20/27] Clenaing up the detection phase to get all the iformation from DXGI --- libraries/shared/src/GPUIdent.cpp | 108 ++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 22 deletions(-) diff --git a/libraries/shared/src/GPUIdent.cpp b/libraries/shared/src/GPUIdent.cpp index 02ef4b64ab..fb6f291e19 100644 --- a/libraries/shared/src/GPUIdent.cpp +++ b/libraries/shared/src/GPUIdent.cpp @@ -12,8 +12,10 @@ #ifdef Q_OS_WIN -#include -#include +#include + +//#include +//#include #include #pragma comment(lib, "dxgi.lib") @@ -58,6 +60,19 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) #elif defined(Q_OS_WIN) + struct ConvertLargeIntegerToQString { + QString convert(const LARGE_INTEGER& version) { + QString value; + value.append(QString::number(uint32_t(((version.HighPart & 0xFFFF0000) >> 16) & 0x0000FFFF))); + value.append("."); + value.append(QString::number(uint32_t((version.HighPart) & 0x0000FFFF))); + value.append("."); + value.append(QString::number(uint32_t(((version.LowPart & 0xFFFF0000) >> 16) & 0x0000FFFF))); + value.append("."); + value.append(QString::number(uint32_t((version.LowPart) & 0x0000FFFF))); + return value; + } + } convertDriverVersionToString; // Create the DXGI factory // Let s get into DXGI land: @@ -70,33 +85,72 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) return this; } - std::vector adapterDescs; - // Select our adapter - IDXGIAdapter1* capableAdapter = nullptr; + std::vector validAdapterList; + using AdapterEntry = std::pair, std::vector>; + std::vector adapterToOutputs; + // Enumerate adapters and outputs { - for (UINT adapter = 0; !capableAdapter; ++adapter) { - // get a candidate DXGI adapter - IDXGIAdapter1* pAdapter = nullptr; - hr = pFactory->EnumAdapters1(adapter, &pAdapter); - if (FAILED(hr)) { - break; - } - // query to see if there exists a corresponding compute device + UINT adapterNum = 0; + IDXGIAdapter1* pAdapter = nullptr; + while (pFactory->EnumAdapters1(adapterNum, &pAdapter) != DXGI_ERROR_NOT_FOUND) { + + // Found an adapter, get descriptor DXGI_ADAPTER_DESC1 adapterDesc; pAdapter->GetDesc1(&adapterDesc); + + LARGE_INTEGER version; + hr = pAdapter->CheckInterfaceSupport(__uuidof(IDXGIDevice), &version); + + std::wstring wDescription (adapterDesc.Description); + std::string description(wDescription.begin(), wDescription.end()); + qCDebug(shared) << "Found adapter: " << description.c_str() + << " Driver version: " << convertDriverVersionToString.convert(version); + + AdapterEntry adapterEntry; + adapterEntry.first.first = adapterDesc; + adapterEntry.first.second = version; + + + + UINT outputNum = 0; + IDXGIOutput * pOutput; + bool hasOutputConnectedToDesktop = false; + while (pAdapter->EnumOutputs(outputNum, &pOutput) != DXGI_ERROR_NOT_FOUND) { + + // FOund an output attached to the adapter, get descriptor + DXGI_OUTPUT_DESC outputDesc; + pOutput->GetDesc(&outputDesc); + + adapterEntry.second.push_back(outputDesc); + + std::wstring wDeviceName(outputDesc.DeviceName); + std::string deviceName(wDeviceName.begin(), wDeviceName.end()); + qCDebug(shared) << " Found output: " << deviceName.c_str() << " desktop: " << (outputDesc.AttachedToDesktop ? "true" : "false") + << " Rect [ l=" << outputDesc.DesktopCoordinates.left << " r=" << outputDesc.DesktopCoordinates.right + << " b=" << outputDesc.DesktopCoordinates.bottom << " t=" << outputDesc.DesktopCoordinates.top << " ]"; + + hasOutputConnectedToDesktop |= (bool) outputDesc.AttachedToDesktop; + + pOutput->Release(); + outputNum++; + } + + adapterToOutputs.push_back(adapterEntry); + + // add this adapter to the valid list if has output + if (hasOutputConnectedToDesktop && !adapterEntry.second.empty()) { + validAdapterList.push_back(adapterNum); + } + pAdapter->Release(); - - qCDebug(shared) << "Found adapter: " << adapterDesc.Description; - - adapterDescs.push_back(adapterDesc); - + adapterNum++; } } pFactory->Release(); - - + // THis was the previous technique used to detect the platform we are running on on windows. + /* // COM must be initialized already using CoInitialize. E.g., by the audio subsystem. CComPtr spLoc = NULL; hr = CoCreateInstance(CLSID_WbemLocator, 0, CLSCTX_SERVER, IID_IWbemLocator, (LPVOID *)&spLoc); @@ -193,10 +247,20 @@ GPUIdent* GPUIdent::ensureQuery(const QString& vendor, const QString& renderer) } hr = spEnumInst->Next(WBEM_INFINITE, 1, &spInstance.p, &uNumOfInstances); } + */ + + if (!validAdapterList.empty()) { + auto& adapterEntry = adapterToOutputs[validAdapterList.front()]; + + std::wstring wDescription(adapterEntry.first.first.Description); + std::string description(wDescription.begin(), wDescription.end()); + _name = QString(description.c_str()); + + _driver = convertDriverVersionToString.convert(adapterEntry.first.second); - if (adapterDescs.size()) { const ULONGLONG BYTES_PER_MEGABYTE = 1024 * 1024; - _dedicatedMemoryMB = (uint64_t)(adapterDescs[0].DedicatedVideoMemory / BYTES_PER_MEGABYTE); + _dedicatedMemoryMB = (uint64_t)(adapterEntry.first.first.DedicatedVideoMemory / BYTES_PER_MEGABYTE); + _isValid = true; } #endif From 8350dc47f4ece46d475321955349747d8d55cdfa Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 Nov 2016 15:40:58 -0700 Subject: [PATCH 21/27] Fix Controller.Actions not returning correct values --- libraries/controllers/src/controllers/ScriptingInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/controllers/src/controllers/ScriptingInterface.cpp b/libraries/controllers/src/controllers/ScriptingInterface.cpp index d32acb3d82..a690561813 100644 --- a/libraries/controllers/src/controllers/ScriptingInterface.cpp +++ b/libraries/controllers/src/controllers/ScriptingInterface.cpp @@ -68,7 +68,7 @@ controller::ScriptingInterface::ScriptingInterface() { // Expose the IDs to JS QString cleanActionName = QString(actionName).remove(SANITIZE_NAME_EXPRESSION); - _actions.insert(cleanActionName, actionInput.getID()); + _actions.insert(cleanActionName, actionInput.getChannel()); } updateMaps(); From 68735763df351f14ffe96bcb8d8d24bf628e8f97 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 Nov 2016 15:41:35 -0700 Subject: [PATCH 22/27] Add support for smooth turning in tutorial --- tutorial/tutorial.js | 45 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 4908465779..95a2fcd771 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -715,7 +715,8 @@ var stepTurnAround = function(name) { this.tempTag = name + "-temporary"; this.onActionBound = this.onAction.bind(this); - this.numTimesTurnPressed = 0; + this.numTimesSnapTurnPressed = 0; + this.numTimesSmoothTurnPressed = 0; } stepTurnAround.prototype = { start: function(onFinish) { @@ -724,19 +725,26 @@ stepTurnAround.prototype = { showEntitiesWithTag(this.tag); - this.numTimesTurnPressed = 0; + this.numTimesSnapTurnPressed = 0; + this.numTimesSmoothTurnPressed = 0; + this.smoothTurnDown = false; Controller.actionEvent.connect(this.onActionBound); this.interval = Script.setInterval(function() { - debug("TurnAround | Checking if finished", this.numTimesTurnPressed); + debug("TurnAround | Checking if finished", + this.numTimesSnapTurnPressed, this.numTimesSmoothTurnPressed); var FORWARD_THRESHOLD = 90; - var REQ_NUM_TIMES_PRESSED = 3; + var REQ_NUM_TIMES_SNAP_TURN_PRESSED = 3; + var REQ_NUM_TIMES_SMOOTH_TURN_PRESSED = 2; var dir = Quat.getFront(MyAvatar.orientation); var angle = Math.atan2(dir.z, dir.x); var angleDegrees = ((angle / Math.PI) * 180); - if (this.numTimesTurnPressed >= REQ_NUM_TIMES_PRESSED && Math.abs(angleDegrees) < FORWARD_THRESHOLD) { + var hasTurnedEnough = this.numTimesSnapTurnPressed >= REQ_NUM_TIMES_SNAP_TURN_PRESSED + || this.numTimesSmoothTurnPressed >= REQ_NUM_TIMES_SMOOTH_TURN_PRESSED; + var facingForward = Math.abs(angleDegrees) < FORWARD_THRESHOLD + if (hasTurnedEnough && facingForward) { Script.clearInterval(this.interval); this.interval = null; playSuccessSound(); @@ -745,10 +753,31 @@ stepTurnAround.prototype = { }.bind(this), 100); }, onAction: function(action, value) { - var STEP_YAW_ACTION = 6; + // NOTE(Huffman, 11/2/16): The checks below are for backward compatibility + // Old versions of High Fidelity returned invalid action ids from + // Controller.Actions.Yaw/StepYaw which were above 10000. If they are + // above 10000 then we can assume we are on an old version and hard-code + // the values. Eventually we should remove these checks. + var STEP_YAW_ACTION = Controller.Actions.StepYaw; + if (STEP_YAW_ACTION > 10000) { + STEP_YAW_ACTION = 6; + } + var SMOOTH_YAW_ACTION = Controller.Actions.Yaw; + if (SMOOTH_YAW_ACTION > 10000) { + SMOOTH_YAW_ACTION = 4; + } + if (action == STEP_YAW_ACTION && value != 0) { - debug("TurnAround | Got yaw action"); - this.numTimesTurnPressed += 1; + debug("TurnAround | Got step yaw action"); + ++this.numTimesSnapTurnPressed; + } else if (action == SMOOTH_YAW_ACTION) { + debug("TurnAround | Got smooth yaw action"); + if (this.smoothTurnDown && value === 0) { + this.smoothTurnDown = false; + ++this.numTimesSmoothTurnPressed; + } else if (!this.smoothTurnDown && value !== 0) { + this.smoothTurnDown = true; + } } }, cleanup: function() { From f6c0a451deccc18da8058c921d5565d37f54b596 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 Nov 2016 15:53:29 -0700 Subject: [PATCH 23/27] Revert "Fix Controller.Actions not returning correct values" This reverts commit 8350dc47f4ece46d475321955349747d8d55cdfa. --- libraries/controllers/src/controllers/ScriptingInterface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/controllers/src/controllers/ScriptingInterface.cpp b/libraries/controllers/src/controllers/ScriptingInterface.cpp index a690561813..d32acb3d82 100644 --- a/libraries/controllers/src/controllers/ScriptingInterface.cpp +++ b/libraries/controllers/src/controllers/ScriptingInterface.cpp @@ -68,7 +68,7 @@ controller::ScriptingInterface::ScriptingInterface() { // Expose the IDs to JS QString cleanActionName = QString(actionName).remove(SANITIZE_NAME_EXPRESSION); - _actions.insert(cleanActionName, actionInput.getChannel()); + _actions.insert(cleanActionName, actionInput.getID()); } updateMaps(); From cf975f966735437ac7547bfcaa9cff5280cea084 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Wed, 2 Nov 2016 15:56:19 -0700 Subject: [PATCH 24/27] Update step/smooth yaw action values to be hardcoded --- tutorial/tutorial.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/tutorial/tutorial.js b/tutorial/tutorial.js index 95a2fcd771..4de418eb19 100644 --- a/tutorial/tutorial.js +++ b/tutorial/tutorial.js @@ -753,19 +753,8 @@ stepTurnAround.prototype = { }.bind(this), 100); }, onAction: function(action, value) { - // NOTE(Huffman, 11/2/16): The checks below are for backward compatibility - // Old versions of High Fidelity returned invalid action ids from - // Controller.Actions.Yaw/StepYaw which were above 10000. If they are - // above 10000 then we can assume we are on an old version and hard-code - // the values. Eventually we should remove these checks. - var STEP_YAW_ACTION = Controller.Actions.StepYaw; - if (STEP_YAW_ACTION > 10000) { - STEP_YAW_ACTION = 6; - } - var SMOOTH_YAW_ACTION = Controller.Actions.Yaw; - if (SMOOTH_YAW_ACTION > 10000) { - SMOOTH_YAW_ACTION = 4; - } + var STEP_YAW_ACTION = 6; + var SMOOTH_YAW_ACTION = 4; if (action == STEP_YAW_ACTION && value != 0) { debug("TurnAround | Got step yaw action"); From 64cb5d1b1a0d5b0b41b44e99326a1507b685bab5 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 2 Nov 2016 20:02:07 -0700 Subject: [PATCH 25/27] fix QVector packing when number of joints isn't a multiple of 8 --- libraries/octree/src/OctreePacketData.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp index 5380aaa6ce..5cd93bb0e1 100644 --- a/libraries/octree/src/OctreePacketData.cpp +++ b/libraries/octree/src/OctreePacketData.cpp @@ -451,6 +451,9 @@ bool OctreePacketData::appendValue(const QVector& value) { bit = 0; } } + if (bit != 0) { + destinationBuffer++; + } int boolsSize = destinationBuffer - start; success = append(start, boolsSize); if (success) { From cfea3cba9b0ba9654b871f712676d6595121cf7d Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 3 Nov 2016 06:54:11 -0700 Subject: [PATCH 26/27] guard against heap-overflow in the event of bogus entity network data --- libraries/octree/src/OctreePacketData.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp index 5cd93bb0e1..5344fad430 100644 --- a/libraries/octree/src/OctreePacketData.cpp +++ b/libraries/octree/src/OctreePacketData.cpp @@ -686,6 +686,10 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto uint16_t length; memcpy(&length, dataBytes, sizeof(uint16_t)); dataBytes += sizeof(length); + if (length * sizeof(glm::vec3) > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { + result.resize(0); + return sizeof(uint16_t); + } result.resize(length); memcpy(result.data(), dataBytes, length * sizeof(glm::vec3)); return sizeof(uint16_t) + length * sizeof(glm::vec3); @@ -695,6 +699,10 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char *dataBytes, QVecto uint16_t length; memcpy(&length, dataBytes, sizeof(uint16_t)); dataBytes += sizeof(length); + if (length * sizeof(glm::quat) > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { + result.resize(0); + return sizeof(uint16_t); + } result.resize(length); const unsigned char *start = dataBytes; @@ -709,6 +717,10 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVecto uint16_t length; memcpy(&length, dataBytes, sizeof(uint16_t)); dataBytes += sizeof(length); + if (length * sizeof(float) > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { + result.resize(0); + return sizeof(uint16_t); + } result.resize(length); memcpy(result.data(), dataBytes, length * sizeof(float)); return sizeof(uint16_t) + length * sizeof(float); @@ -718,6 +730,10 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVecto uint16_t length; memcpy(&length, dataBytes, sizeof(uint16_t)); dataBytes += sizeof(length); + if (length * sizeof(bool) > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { + result.resize(0); + return sizeof(uint16_t); + } result.resize(length); int bit = 0; From 1d0c3d71688d8aa897a8ec93581b815595964186 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Thu, 3 Nov 2016 09:47:24 -0700 Subject: [PATCH 27/27] fix checker for unreasonable size of vector of bools --- libraries/octree/src/OctreePacketData.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/octree/src/OctreePacketData.cpp b/libraries/octree/src/OctreePacketData.cpp index 5344fad430..5fd7e4dba3 100644 --- a/libraries/octree/src/OctreePacketData.cpp +++ b/libraries/octree/src/OctreePacketData.cpp @@ -730,7 +730,7 @@ int OctreePacketData::unpackDataFromBytes(const unsigned char* dataBytes, QVecto uint16_t length; memcpy(&length, dataBytes, sizeof(uint16_t)); dataBytes += sizeof(length); - if (length * sizeof(bool) > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { + if (length / 8 > MAX_OCTREE_UNCOMRESSED_PACKET_SIZE) { result.resize(0); return sizeof(uint16_t); }