diff --git a/cmake/externals/steamworks/CMakeLists.txt b/cmake/externals/steamworks/CMakeLists.txt new file mode 100644 index 0000000000..152e95cdcf --- /dev/null +++ b/cmake/externals/steamworks/CMakeLists.txt @@ -0,0 +1,62 @@ +include(ExternalProject) + +set(EXTERNAL_NAME steamworks) + +string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) + +set(STEAMWORKS_URL "https://s3.amazonaws.com/hifi-public/dependencies/steamworks_sdk_137.zip") +set(STEAMWORKS_URL_MD5 "95ba9d0e3ddc04f8a8be17d2da806cbb") + +ExternalProject_Add( + ${EXTERNAL_NAME} + URL ${STEAMWORKS_URL} + URL_MD5 ${STEAMWORKS_URL_MD5} + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 +) + +set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals") + +ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) + +set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/public CACHE TYPE INTERNAL) + +if (WIN32) + + if ("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin/win64) + set(ARCH_SUFFIX "64") + else() + set(ARCH_DIR ${SOURCE_DIR}/redistributable_bin) + set(ARCH_SUFFIX "") + endif() + + set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${ARCH_DIR}) + set(${EXTERNAL_NAME_UPPER}_LIB_PATH ${ARCH_DIR}) + + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE "${${EXTERNAL_NAME_UPPER}_LIB_PATH}/steam_api${ARCH_SUFFIX}.lib" CACHE TYPE INTERNAL) + add_paths_to_fixup_libs("${${EXTERNAL_NAME_UPPER}_DLL_PATH}") + +elseif(APPLE) + + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/osx32/libsteam_api.dylib CACHE TYPE INTERNAL) + + set(_STEAMWORKS_LIB_DIR "${SOURCE_DIR}/redistributable_bin/osx32") + ExternalProject_Add_Step( + ${EXTERNAL_NAME} + change-install-name + COMMENT "Calling install_name_tool on libraries to fix install name for dylib linking" + COMMAND ${CMAKE_COMMAND} -DINSTALL_NAME_LIBRARY_DIR=${_STEAMWORKS_LIB_DIR} -P ${EXTERNAL_PROJECT_DIR}/OSXInstallNameChange.cmake + DEPENDEES install + WORKING_DIRECTORY + LOG 1 + ) + +elseif(NOT ANDROID) + + # FIXME need to account for different architectures + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${SOURCE_DIR}/redistributable_bin/linux64/libsteam_api.so CACHE TYPE INTERNAL) + +endif() diff --git a/cmake/macros/TargetSteamworks.cmake b/cmake/macros/TargetSteamworks.cmake new file mode 100644 index 0000000000..67145050c2 --- /dev/null +++ b/cmake/macros/TargetSteamworks.cmake @@ -0,0 +1,13 @@ +# +# Copyright 2015 High Fidelity, Inc. +# Created by Clement Brisset on 6/8/2016 +# +# Distributed under the Apache License, Version 2.0. +# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +# +macro(TARGET_STEAMWORKS) + add_dependency_external_projects(steamworks) + find_package(Steamworks REQUIRED) + target_include_directories(${TARGET_NAME} PRIVATE ${STEAMWORKS_INCLUDE_DIRS}) + target_link_libraries(${TARGET_NAME} ${STEAMWORKS_LIBRARIES}) +endmacro() diff --git a/cmake/modules/FindSteamworks.cmake b/cmake/modules/FindSteamworks.cmake new file mode 100644 index 0000000000..515a9d4374 --- /dev/null +++ b/cmake/modules/FindSteamworks.cmake @@ -0,0 +1,29 @@ +# +# FindSteamworks.cmake +# +# Try to find the Steamworks controller library +# +# This module defines the following variables +# +# STEAMWORKS_FOUND - Was Steamworks found +# STEAMWORKS_INCLUDE_DIRS - the Steamworks include directory +# STEAMWORKS_LIBRARIES - Link this to use Steamworks +# +# This module accepts the following variables +# +# STEAMWORKS_ROOT - Can be set to steamworks install path or Windows build path +# +# Created on 6/8/2016 by Clement Brisset +# 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 +# + +include(SelectLibraryConfigurations) +select_library_configurations(STEAMWORKS) + +set(STEAMWORKS_REQUIREMENTS STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Steamworks DEFAULT_MSG STEAMWORKS_INCLUDE_DIRS STEAMWORKS_LIBRARIES) +mark_as_advanced(STEAMWORKS_LIBRARIES STEAMWORKS_INCLUDE_DIRS STEAMWORKS_SEARCH_DIRS) diff --git a/interface/CMakeLists.txt b/interface/CMakeLists.txt index 4381f3321b..ae84705da3 100644 --- a/interface/CMakeLists.txt +++ b/interface/CMakeLists.txt @@ -139,7 +139,7 @@ link_hifi_libraries(shared octree gpu gl gpu-gl procedural model render recording fbx networking model-networking entities avatars audio audio-client animation script-engine physics render-utils entities-renderer ui auto-updater - controllers plugins display-plugins input-plugins) + controllers plugins display-plugins input-plugins steamworks-wrapper) # include the binary directory of render-utils for shader includes target_include_directories(${TARGET_NAME} PRIVATE "${CMAKE_BINARY_DIR}/libraries/render-utils") diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 29238cf153..ee365cd5a1 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -389,7 +389,10 @@ bool setupEssentials(int& argc, char** argv) { Setting::preInit(); - bool previousSessionCrashed = CrashHandler::checkForResetSettings(); + + static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset"; + bool suppressPrompt = cmdOptionExists(argc, const_cast(argv), SUPPRESS_SETTINGS_RESET); + bool previousSessionCrashed = CrashHandler::checkForResetSettings(suppressPrompt); CrashHandler::writeRunningMarkerFiler(); qAddPostRoutine(CrashHandler::deleteRunningMarkerFile); @@ -2916,7 +2919,7 @@ bool Application::exportEntities(const QString& filename, const QVectorwriteToJSONFile(filename.toLocal8Bit().constData()); + success = exportTree->writeToJSONFile(filename.toLocal8Bit().constData()); // restore the main window's active state _window->activateWindow(); @@ -5145,13 +5148,6 @@ void Application::updateDisplayMode() { QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { resizeGL(); }); - QObject::connect(displayPlugin.get(), &DisplayPlugin::outputDeviceLost, [this, displayPluginName] { - PluginManager::getInstance()->disableDisplayPlugin(displayPluginName); - auto menu = Menu::getInstance(); - if (menu->menuItemExists(MenuOption::OutputMenu, displayPluginName)) { - menu->removeMenuItem(MenuOption::OutputMenu, displayPluginName); - } - }); first = false; } diff --git a/interface/src/CrashHandler.cpp b/interface/src/CrashHandler.cpp index 8de6766c7a..3c5f03bef3 100644 --- a/interface/src/CrashHandler.cpp +++ b/interface/src/CrashHandler.cpp @@ -27,7 +27,7 @@ static const QString RUNNING_MARKER_FILENAME = "Interface.running"; -bool CrashHandler::checkForResetSettings() { +bool CrashHandler::checkForResetSettings(bool suppressPrompt) { QSettings::setDefaultFormat(QSettings::IniFormat); QSettings settings; settings.beginGroup("Developer"); @@ -42,6 +42,10 @@ bool CrashHandler::checkForResetSettings() { QFile runningMarkerFile(runningMarkerFilePath()); bool wasLikelyCrash = runningMarkerFile.exists(); + if (suppressPrompt) { + return wasLikelyCrash; + } + if (wasLikelyCrash || askToResetSettings) { if (displaySettingsResetOnCrash || askToResetSettings) { Action action = promptUserForAction(wasLikelyCrash); diff --git a/interface/src/CrashHandler.h b/interface/src/CrashHandler.h index 566b780d61..a65fed677d 100644 --- a/interface/src/CrashHandler.h +++ b/interface/src/CrashHandler.h @@ -17,7 +17,7 @@ class CrashHandler { public: - static bool checkForResetSettings(); + static bool checkForResetSettings(bool suppressPrompt = false); static void writeRunningMarkerFiler(); static void deleteRunningMarkerFile(); diff --git a/libraries/entities/src/EntityTreeElement.cpp b/libraries/entities/src/EntityTreeElement.cpp index a7baeb361b..0523933ee6 100644 --- a/libraries/entities/src/EntityTreeElement.cpp +++ b/libraries/entities/src/EntityTreeElement.cpp @@ -189,7 +189,7 @@ void EntityTreeElement::elementEncodeComplete(EncodeBitstreamParams& params) con // encoud our parent... this might happen. if (extraEncodeData->contains(childElement.get())) { EntityTreeElementExtraEncodeData* childExtraEncodeData - = static_cast(extraEncodeData->value(childElement.get())); + = static_cast((*extraEncodeData)[childElement.get()]); if (wantDebug) { qCDebug(entities) << "checking child: " << childElement->_cube; diff --git a/libraries/octree/src/Octree.cpp b/libraries/octree/src/Octree.cpp index 475beef03c..d8c8229ce3 100644 --- a/libraries/octree/src/Octree.cpp +++ b/libraries/octree/src/Octree.cpp @@ -1868,24 +1868,26 @@ bool Octree::readJSONFromStream(unsigned long streamLength, QDataStream& inputSt return success; } -void Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) { +bool Octree::writeToFile(const char* fileName, OctreeElementPointer element, QString persistAsFileType) { // make the sure file extension makes sense QString qFileName = fileNameWithoutExtension(QString(fileName), PERSIST_EXTENSIONS) + "." + persistAsFileType; QByteArray byteArray = qFileName.toUtf8(); const char* cFileName = byteArray.constData(); + bool success = false; if (persistAsFileType == "svo") { - writeToSVOFile(fileName, element); + success = writeToSVOFile(fileName, element); } else if (persistAsFileType == "json") { - writeToJSONFile(cFileName, element); + success = writeToJSONFile(cFileName, element); } else if (persistAsFileType == "json.gz") { - writeToJSONFile(cFileName, element, true); + success = writeToJSONFile(cFileName, element, true); } else { qCDebug(octree) << "unable to write octree to file of type" << persistAsFileType; } + return success; } -void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) { +bool Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool doGzip) { QVariantMap entityDescription; qCDebug(octree, "Saving JSON SVO to file %s...", fileName); @@ -1906,7 +1908,7 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, bool entityDescriptionSuccess = writeToMap(entityDescription, top, true, true); if (!entityDescriptionSuccess) { qCritical("Failed to convert Entities to QVariantMap while saving to json."); - return; + return false; } // convert the QVariantMap to JSON @@ -1916,22 +1918,26 @@ void Octree::writeToJSONFile(const char* fileName, OctreeElementPointer element, if (doGzip) { if (!gzip(jsonData, jsonDataForFile, -1)) { qCritical("unable to gzip data while saving to json."); - return; + return false; } } else { jsonDataForFile = jsonData; } QFile persistFile(fileName); + bool success = false; if (persistFile.open(QIODevice::WriteOnly)) { - persistFile.write(jsonDataForFile); + success = persistFile.write(jsonDataForFile) != -1; } else { qCritical("Could not write to JSON description of entities."); } + + return success; } -void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) { - qWarning() << "SVO file format depricated. Support for reading SVO files is no longer support and will be removed soon."; +bool Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) { + qWarning() << "SVO file format deprecated. Support for reading SVO files is no longer support and will be removed soon."; + bool success = false; std::ofstream file(fileName, std::ios::out|std::ios::binary); @@ -2010,8 +2016,12 @@ void Octree::writeToSVOFile(const char* fileName, OctreeElementPointer element) } releaseSceneEncodeData(&extraEncodeData); + + success = true; } file.close(); + + return success; } unsigned long Octree::getOctreeElementsCount() { diff --git a/libraries/octree/src/Octree.h b/libraries/octree/src/Octree.h index 2f0ce3b807..6894f0aa1a 100644 --- a/libraries/octree/src/Octree.h +++ b/libraries/octree/src/Octree.h @@ -299,9 +299,9 @@ public: void loadOctreeFile(const char* fileName); // Octree exporters - void writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo"); - void writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false); - void writeToSVOFile(const char* filename, OctreeElementPointer element = NULL); + bool writeToFile(const char* filename, OctreeElementPointer element = NULL, QString persistAsFileType = "svo"); + bool writeToJSONFile(const char* filename, OctreeElementPointer element = NULL, bool doGzip = false); + bool writeToSVOFile(const char* filename, OctreeElementPointer element = NULL); virtual bool writeToMap(QVariantMap& entityDescription, OctreeElementPointer element, bool skipDefaultValues, bool skipThoseWithBadParents) = 0; diff --git a/libraries/plugins/src/plugins/DisplayPlugin.h b/libraries/plugins/src/plugins/DisplayPlugin.h index a65e8e7371..72bb6a315c 100644 --- a/libraries/plugins/src/plugins/DisplayPlugin.h +++ b/libraries/plugins/src/plugins/DisplayPlugin.h @@ -210,10 +210,6 @@ public: signals: void recommendedFramebufferSizeChanged(const QSize & size); - // Indicates that this display plugin is no longer valid for use. - // For instance if a user exits Oculus Home or Steam VR while - // using the corresponding plugin, that plugin should be disabled. - void outputDeviceLost(); protected: void incrementPresentCount(); diff --git a/libraries/procedural/src/procedural/Procedural.cpp b/libraries/procedural/src/procedural/Procedural.cpp index a9a297a2e1..7dd729384c 100644 --- a/libraries/procedural/src/procedural/Procedural.cpp +++ b/libraries/procedural/src/procedural/Procedural.cpp @@ -96,7 +96,9 @@ bool Procedural::parseVersion(const QJsonValue& version) { bool Procedural::parseUrl(const QUrl& shaderUrl) { if (!shaderUrl.isValid()) { - qWarning() << "Invalid shader URL: " << shaderUrl; + if (!shaderUrl.isEmpty()) { + qWarning() << "Invalid shader URL: " << shaderUrl; + } _networkShader.reset(); return false; } diff --git a/libraries/procedural/src/procedural/ProceduralCommon.slf b/libraries/procedural/src/procedural/ProceduralCommon.slf index 128723265f..d4144ad537 100644 --- a/libraries/procedural/src/procedural/ProceduralCommon.slf +++ b/libraries/procedural/src/procedural/ProceduralCommon.slf @@ -264,12 +264,18 @@ float snoise(vec2 v) { return 130.0 * dot(m, g); } + #define PROCEDURAL 1 //PROCEDURAL_VERSION #ifdef PROCEDURAL_V1 +// shader playback time (in seconds) +uniform float iGlobalTime; +// the dimensions of the object being rendered +uniform vec3 iWorldScale; + #else // Unimplemented uniforms diff --git a/libraries/steamworks-wrapper/CMakeLists.txt b/libraries/steamworks-wrapper/CMakeLists.txt new file mode 100644 index 0000000000..0cbe3bb5ad --- /dev/null +++ b/libraries/steamworks-wrapper/CMakeLists.txt @@ -0,0 +1,5 @@ +set(TARGET_NAME steamworks-wrapper) +setup_hifi_library() +link_hifi_libraries() + +target_steamworks() \ No newline at end of file diff --git a/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp new file mode 100644 index 0000000000..0f06e03672 --- /dev/null +++ b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.cpp @@ -0,0 +1,19 @@ +// +// SteamClient.cpp +// steamworks-wrapper/src/steamworks-wrapper +// +// Created by Clement Brisset on 6/8/16. +// 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 +// + +#include "SteamClient.h" + +#include + + + + + diff --git a/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.h b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.h new file mode 100644 index 0000000000..369641b0c7 --- /dev/null +++ b/libraries/steamworks-wrapper/src/steamworks-wrapper/SteamClient.h @@ -0,0 +1,21 @@ +// +// SteamClient.h +// steamworks-wrapper/src/steamworks-wrapper +// +// Created by Clement Brisset on 6/8/16. +// 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 +// + + +#ifndef hifi_SteamClient_h +#define hifi_SteamClient_h + +class SteamClient { + + +}; + +#endif // hifi_SteamClient_h \ No newline at end of file diff --git a/plugins/openvr/src/OpenVrDisplayPlugin.cpp b/plugins/openvr/src/OpenVrDisplayPlugin.cpp index a92c930cbf..9c4313dc13 100644 --- a/plugins/openvr/src/OpenVrDisplayPlugin.cpp +++ b/plugins/openvr/src/OpenVrDisplayPlugin.cpp @@ -134,10 +134,7 @@ void OpenVrDisplayPlugin::resetSensors() { bool OpenVrDisplayPlugin::beginFrameRender(uint32_t frameIndex) { handleOpenVrEvents(); - if (openVrQuitRequested()) { - emit outputDeviceLost(); - return false; - } + double displayFrequency = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_DisplayFrequency_Float); double frameDuration = 1.f / displayFrequency; double vsyncToPhotons = _system->GetFloatTrackedDeviceProperty(vr::k_unTrackedDeviceIndex_Hmd, vr::Prop_SecondsFromVsyncToPhotons_Float); diff --git a/plugins/openvr/src/OpenVrHelpers.cpp b/plugins/openvr/src/OpenVrHelpers.cpp index 4a756e12b0..dc38aa0a0a 100644 --- a/plugins/openvr/src/OpenVrHelpers.cpp +++ b/plugins/openvr/src/OpenVrHelpers.cpp @@ -31,11 +31,6 @@ using Lock = std::unique_lock; static int refCount { 0 }; static Mutex mutex; static vr::IVRSystem* activeHmd { nullptr }; -static bool _openVrQuitRequested { false }; - -bool openVrQuitRequested() { - return _openVrQuitRequested; -} static const uint32_t RELEASE_OPENVR_HMD_DELAY_MS = 5000; @@ -89,7 +84,6 @@ void releaseOpenVrSystem() { if (0 == refCount) { qCDebug(displayplugins) << "OpenVR: zero refcount, deallocate VR system"; vr::VR_Shutdown(); - _openVrQuitRequested = false; activeHmd = nullptr; } } @@ -228,8 +222,8 @@ void handleOpenVrEvents() { while (activeHmd->PollNextEvent(&event, sizeof(event))) { switch (event.eventType) { case vr::VREvent_Quit: - _openVrQuitRequested = true; activeHmd->AcknowledgeQuit_Exiting(); + QMetaObject::invokeMethod(qApp, "quit"); break; case vr::VREvent_KeyboardDone: @@ -244,7 +238,7 @@ void handleOpenVrEvents() { default: break; } - qDebug() << "OpenVR: Event " << event.eventType; + qDebug() << "OpenVR: Event " << activeHmd->GetEventTypeNameFromEnum((vr::EVREventType)event.eventType) << "(" << event.eventType << ")"; } } diff --git a/plugins/openvr/src/ViveControllerManager.cpp b/plugins/openvr/src/ViveControllerManager.cpp index 631efca4a2..7f78ab8553 100644 --- a/plugins/openvr/src/ViveControllerManager.cpp +++ b/plugins/openvr/src/ViveControllerManager.cpp @@ -213,10 +213,6 @@ void ViveControllerManager::renderHand(const controller::Pose& pose, gpu::Batch& void ViveControllerManager::pluginUpdate(float deltaTime, const controller::InputCalibrationData& inputCalibrationData) { auto userInputMapper = DependencyManager::get(); handleOpenVrEvents(); - if (openVrQuitRequested()) { - deactivate(); - return; - } // because update mutates the internal state we need to lock userInputMapper->withLock([&, this]() { diff --git a/scripts/system/html/entityProperties.html b/scripts/system/html/entityProperties.html index c8edbdb369..82387cafa5 100644 --- a/scripts/system/html/entityProperties.html +++ b/scripts/system/html/entityProperties.html @@ -671,7 +671,6 @@ } else { for (var i = 0; i < elShapeSections.length; i++) { - console.log("Hiding shape section " + elShapeSections[i]) elShapeSections[i].style.display = 'none'; } } @@ -805,8 +804,10 @@ } var activeElement = document.activeElement; - - activeElement.select(); + + if(typeof activeElement.select!=="undefined"){ + activeElement.select(); + } } } }); diff --git a/scripts/system/selectAudioDevice.js b/scripts/system/selectAudioDevice.js index fd4cd43a59..663f96b59c 100644 --- a/scripts/system/selectAudioDevice.js +++ b/scripts/system/selectAudioDevice.js @@ -48,7 +48,7 @@ var selectedInputMenu = ""; var selectedOutputMenu = ""; function setupAudioMenus() { - Menu.addMenu("Audio > Devices", "Advanced"); + Menu.addMenu("Audio > Devices"); Menu.addSeparator("Audio > Devices","Output Audio Device"); var outputDeviceSetting = Settings.getValue(OUTPUT_DEVICE_SETTING); diff --git a/server-console/src/main.js b/server-console/src/main.js index 6465f6b0a3..8f85872d0b 100644 --- a/server-console/src/main.js +++ b/server-console/src/main.js @@ -515,6 +515,20 @@ function maybeInstallDefaultContentSet(onComplete) { return; } + console.log("Found contentPath:" + argv.contentPath); + if (argv.contentPath) { + fs.copy(argv.contentPath, getRootHifiDataDirectory(), function (err) { + if (err) { + console.log('Could not copy home content: ' + err); + return console.error(err) + } + console.log('Copied home content over to: ' + getRootHifiDataDirectory()); + onComplete(); + }); + return; + } + + // Show popup var window = new BrowserWindow({ icon: appIcon,