From eb9acad42ea7ac002e51d51280dbddeb6d3698d8 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 18 May 2017 16:35:56 -0700 Subject: [PATCH 1/8] Update content set URL for RC40 --- server-console/src/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server-console/src/main.js b/server-console/src/main.js index 4ce1ccfb02..98bda9a10f 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -42,7 +42,7 @@ const appIcon = path.join(__dirname, '../resources/console.png'); const DELETE_LOG_FILES_OLDER_THAN_X_SECONDS = 60 * 60 * 24 * 7; // 7 Days const LOG_FILE_REGEX = /(domain-server|ac-monitor|ac)-.*-std(out|err).txt/; -const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-RC39.tar.gz"; +const HOME_CONTENT_URL = "http://cdn.highfidelity.com/content-sets/home-tutorial-RC40.tar.gz"; function getBuildInfo() { var buildInfoPath = null; From 303bb05b3d698dabe986628a31f269575f2e8865 Mon Sep 17 00:00:00 2001 From: Marko Kudjerski Date: Tue, 16 May 2017 18:51:48 -0700 Subject: [PATCH 2/8] changing the location in welcome to which a user is sent on the first run --- libraries/networking/src/AddressManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index c66fe8daf0..629a594f92 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -30,7 +30,7 @@ #include "udt/PacketHeaders.h" #if USE_STABLE_GLOBAL_SERVICES -const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome"; +const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome/hello"; #else const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome"; #endif From 986d63cdbb30d1ca04f1afaf5c6d0c442460d6a3 Mon Sep 17 00:00:00 2001 From: Marko Kudjerski Date: Tue, 16 May 2017 19:28:44 -0700 Subject: [PATCH 3/8] making sure that the first time landing in *welcome domain is updated for dev builds too --- libraries/networking/src/AddressManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/networking/src/AddressManager.cpp b/libraries/networking/src/AddressManager.cpp index 629a594f92..8fc1d66cf1 100644 --- a/libraries/networking/src/AddressManager.cpp +++ b/libraries/networking/src/AddressManager.cpp @@ -32,7 +32,7 @@ #if USE_STABLE_GLOBAL_SERVICES const QString DEFAULT_HIFI_ADDRESS = "hifi://welcome/hello"; #else -const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome"; +const QString DEFAULT_HIFI_ADDRESS = "hifi://dev-welcome/hello"; #endif const QString ADDRESS_MANAGER_SETTINGS_GROUP = "AddressManager"; From 6765451cc82a9f31e6d9309d8a71c4caecaa07a9 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 19 May 2017 10:36:31 -0700 Subject: [PATCH 4/8] Ensure snapshots without story_ids get uploaded --- scripts/system/html/js/SnapshotReview.js | 2 +- scripts/system/snapshot.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/system/html/js/SnapshotReview.js b/scripts/system/html/js/SnapshotReview.js index d52ff3d4a6..6c5829d64f 100644 --- a/scripts/system/html/js/SnapshotReview.js +++ b/scripts/system/html/js/SnapshotReview.js @@ -300,7 +300,7 @@ function addImage(image_data, isLoggedIn, canShare, isGifLoading, isShowingPrevi if (!isGifLoading) { appendShareBar(id, isLoggedIn, canShare, isGif, blastButtonDisabled, hifiButtonDisabled, canBlast); } - if (!isGifLoading && !isShowingPreviousImages) { + if (!isGifLoading || (isShowingPreviousImages && !image_data.story_id)) { shareForUrl(id); } if (isShowingPreviousImages && isLoggedIn && image_data.story_id) { diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 8b5ae3c9a7..4c661482fc 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -138,10 +138,10 @@ function onMessage(message) { isLoggedIn = Account.isLoggedIn(); if (isLoggedIn) { print('Sharing snapshot with audience "for_url":', message.data); - Window.shareSnapshot(message.data, message.href || href); + Window.shareSnapshot(message.data, Settings.getValue("previousSnapshotHref")); } else { shareAfterLogin = true; - snapshotToShareAfterLogin.push({ path: message.data, href: message.href || href }); + snapshotToShareAfterLogin.push({ path: message.data, href: Settings.getValue("previousSnapshotHref") }); } } }); @@ -349,6 +349,7 @@ function takeSnapshot() { // We will record snapshots based on the starting location. That could change, e.g., when recording a .gif. // Even the domainId could change (e.g., if the user falls into a teleporter while recording). href = location.href; + Settings.setValue("previousSnapshotHref", href); domainId = location.domainId; Settings.setValue("previousSnapshotDomainID", domainId); From c36b85bb059c30df5d1ebd84a878fc288e6c3431 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 19 May 2017 11:11:00 -0700 Subject: [PATCH 5/8] Add notes to KtxStorage::maybeOpenFile --- libraries/gpu/src/gpu/Texture_ktx.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index 92ead5f616..9799aecdf5 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -184,6 +184,11 @@ KtxStorage::KtxStorage(const std::string& filename) : _filename(filename) { } std::shared_ptr KtxStorage::maybeOpenFile() const { + // 1. Try to get the shared ptr + // 2. If it doesn't exist, grab the mutex around its creation + // 3. If it was created before we got the mutex, return it + // 4. Otherwise, create it + std::shared_ptr file = _cacheFile.lock(); if (file) { return file; From 64bf5784e6513b56ac0a587b310ad639b03c3e96 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 19 May 2017 11:16:20 -0700 Subject: [PATCH 6/8] Fix FileStorage to not close files after they are opened This is particularly an issue with KTX file reading/writing where we do both concurrently. --- libraries/gpu/src/gpu/Texture_ktx.cpp | 12 +++++--- libraries/shared/src/shared/Storage.cpp | 41 ++++++------------------- libraries/shared/src/shared/Storage.h | 3 +- 3 files changed, 18 insertions(+), 38 deletions(-) diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index 9799aecdf5..bf5b4d7965 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -210,7 +210,6 @@ std::shared_ptr KtxStorage::maybeOpenFile() const { } PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const { - storage::StoragePointer result; auto faceOffset = _ktxDescriptor->getMipFaceTexelsOffset(level, face); auto faceSize = _ktxDescriptor->getMipFaceTexelsSize(level, face); if (faceSize != 0 && faceOffset != 0) { @@ -226,7 +225,7 @@ PixelsPointer KtxStorage::getMipFace(uint16 level, uint8 face) const { qWarning() << "Failed to get a valid file out of maybeOpenFile " << QString::fromStdString(_filename); } } - return result; + return nullptr; } Size KtxStorage::getMipFaceSize(uint16 level, uint8 face) const { @@ -260,8 +259,13 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor } auto file = maybeOpenFile(); + if (!file) { + qWarning() << "Failed to open file to assign mip data " << QString::fromStdString(_filename); + return; + } - auto imageData = file->mutableData(); + auto fileData = file->mutableData(); + auto imageData = fileData; imageData += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset; imageData += ktx::IMAGE_SIZE_WIDTH; @@ -276,7 +280,7 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor memcpy(imageData, storage->data(), storage->size()); _minMipLevelAvailable = level; if (_offsetToMinMipKV > 0) { - auto minMipKeyData = file->mutableData() + ktx::KTX_HEADER_SIZE + _offsetToMinMipKV; + auto minMipKeyData = fileData + ktx::KTX_HEADER_SIZE + _offsetToMinMipKV; memcpy(minMipKeyData, (void*)&_minMipLevelAvailable, 1); } } diff --git a/libraries/shared/src/shared/Storage.cpp b/libraries/shared/src/shared/Storage.cpp index e479559e6a..b07f896df0 100644 --- a/libraries/shared/src/shared/Storage.cpp +++ b/libraries/shared/src/shared/Storage.cpp @@ -70,7 +70,15 @@ StoragePointer FileStorage::create(const QString& filename, size_t size, const u } FileStorage::FileStorage(const QString& filename) : _file(filename) { - if (_file.open(QFile::ReadOnly)) { + bool opened = _file.open(QFile::ReadWrite); + if (opened) { + _hasWriteAccess = true; + } else { + _hasWriteAccess = false; + opened = _file.open(QFile::ReadOnly); + } + + if (opened) { _mapped = _file.map(0, _file.size()); if (_mapped) { _valid = true; @@ -91,35 +99,4 @@ FileStorage::~FileStorage() { if (_file.isOpen()) { _file.close(); } -} - -void FileStorage::ensureWriteAccess() { - if (_hasWriteAccess) { - return; - } - - if (_mapped) { - if (!_file.unmap(_mapped)) { - throw std::runtime_error("Unable to unmap file"); - } - } - if (_file.isOpen()) { - _file.close(); - } - _valid = false; - _mapped = nullptr; - - if (_file.open(QFile::ReadWrite)) { - _mapped = _file.map(0, _file.size()); - if (_mapped) { - _valid = true; - _hasWriteAccess = true; - } else { - qCWarning(storagelogging) << "Failed to map file " << _file.fileName(); - throw std::runtime_error("Failed to map file"); - } - } else { - qCWarning(storagelogging) << "Failed to open file " << _file.fileName(); - throw std::runtime_error("Failed to open file"); - } } \ No newline at end of file diff --git a/libraries/shared/src/shared/Storage.h b/libraries/shared/src/shared/Storage.h index 4cad9fa083..d7946738cf 100644 --- a/libraries/shared/src/shared/Storage.h +++ b/libraries/shared/src/shared/Storage.h @@ -60,11 +60,10 @@ namespace storage { FileStorage& operator=(const FileStorage& other) = delete; const uint8_t* data() const override { return _mapped; } - uint8_t* mutableData() override { ensureWriteAccess(); return _mapped; } + uint8_t* mutableData() override { return _hasWriteAccess ? _mapped : nullptr; } size_t size() const override { return _file.size(); } operator bool() const override { return _valid; } private: - void ensureWriteAccess(); bool _valid { false }; bool _hasWriteAccess { false }; From 26247e86539411ec42f892390cf0e926568101ee Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Fri, 19 May 2017 15:00:53 -0700 Subject: [PATCH 7/8] Add check for valid mutableData in assignMipData --- libraries/gpu/src/gpu/Texture_ktx.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/gpu/src/gpu/Texture_ktx.cpp b/libraries/gpu/src/gpu/Texture_ktx.cpp index bf5b4d7965..14282ec525 100644 --- a/libraries/gpu/src/gpu/Texture_ktx.cpp +++ b/libraries/gpu/src/gpu/Texture_ktx.cpp @@ -265,6 +265,11 @@ void KtxStorage::assignMipData(uint16 level, const storage::StoragePointer& stor } auto fileData = file->mutableData(); + if (!fileData) { + qWarning() << "Failed to get mutable data for " << QString::fromStdString(_filename); + return; + } + auto imageData = fileData; imageData += ktx::KTX_HEADER_SIZE + _ktxDescriptor->header.bytesOfKeyValueData + _ktxDescriptor->images[level]._imageOffset; imageData += ktx::IMAGE_SIZE_WIDTH; From 487319f7efca5e05881e9df2a11730c9bcf64a30 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 19 May 2017 16:53:25 -0700 Subject: [PATCH 8/8] Increment _identitySequenceId before sending ID packet for agents --- assignment-client/src/Agent.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/assignment-client/src/Agent.cpp b/assignment-client/src/Agent.cpp index 5864cadc15..96b2336af8 100644 --- a/assignment-client/src/Agent.cpp +++ b/assignment-client/src/Agent.cpp @@ -584,6 +584,7 @@ void Agent::setIsAvatar(bool isAvatar) { void Agent::sendAvatarIdentityPacket() { if (_isAvatar) { auto scriptedAvatar = DependencyManager::get(); + scriptedAvatar->markIdentityDataChanged(); scriptedAvatar->sendIdentityPacket(); } }