diff --git a/src/components/ogre/EmberOgreFileSystem.cpp b/src/components/ogre/EmberOgreFileSystem.cpp index 4f7c91967f..8f0e8d6c21 100644 --- a/src/components/ogre/EmberOgreFileSystem.cpp +++ b/src/components/ogre/EmberOgreFileSystem.cpp @@ -179,7 +179,7 @@ DataStreamPtr FileSystemArchive::open(const String& filename, bool readOnly) con // Always open in binary mode auto* origStream = OGRE_NEW_T(std::ifstream, MEMCATEGORY_GENERAL)(); - origStream->open(full_path.c_str(), std::ios::in | std::ios::binary); + origStream->open(full_path.string().c_str(), std::ios::in | std::ios::binary); // Should check ensure open succeeded, in case fail for some reason. if (origStream->fail()) { diff --git a/src/components/ogre/OgrePluginLoader.cpp b/src/components/ogre/OgrePluginLoader.cpp index a4ab2dabcd..96e8d9ec1b 100644 --- a/src/components/ogre/OgrePluginLoader.cpp +++ b/src/components/ogre/OgrePluginLoader.cpp @@ -71,6 +71,9 @@ OgrePluginLoader::OgrePluginLoader() { //on windows we'll bundle the dll files in the same directory as the executable mPluginDirs.push_back("."); mPluginExtension = ".dll"; + mPluginDirs.push_back("bin");// Prefix + "bin", or alternatives: + mPluginDirs.push_back("lib64"); + mPluginDirs.push_back("lib"); #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX //If any prefix is set (for example for AppImage builds), check for the plugins in directories relative to the prefix first. @@ -143,6 +146,12 @@ bool OgrePluginLoader::loadDynPlugin(const std::string& pluginName) { //#else pluginPath = dir + "/" + pluginName + mPluginExtension; //#endif + if (!std::ifstream(pluginPath).good()) { + pluginPath = pluginName + mPluginExtension;// if absent, use plugin in current directory + } + if (!std::ifstream(pluginPath).good()) { + pluginPath = dir + "/" + pluginName + "_d" + mPluginExtension; + } if (std::ifstream(pluginPath).good()) { S_LOG_INFO("Trying to load the plugin '" << pluginPath << "'."); try { @@ -151,6 +160,9 @@ bool OgrePluginLoader::loadDynPlugin(const std::string& pluginName) { } catch (...) { } } + else{ + printf("\nUnable to load:%s", pluginPath.c_str()); + } } S_LOG_FAILURE("Failed to load the plugin '" << pluginName << "'!"); #else diff --git a/src/components/ogre/OgreSetup.cpp b/src/components/ogre/OgreSetup.cpp index 4b86c04b9a..9ee49c7303 100644 --- a/src/components/ogre/OgreSetup.cpp +++ b/src/components/ogre/OgreSetup.cpp @@ -188,9 +188,29 @@ void OgreSetup::createOgreSystem() { mPluginLoader.loadPlugin("Codec_FreeImage"); mPluginLoader.loadPlugin("Plugin_ParticleFX"); mPluginLoader.loadPlugin("RenderSystem_GL3Plus"); //We'll use OpenGL on Windows too, to make it easier to develop + mPluginLoader.loadPlugin("RenderSystem_Direct3D11"); + mPluginLoader.loadPlugin("RenderSystem_Direct3D10"); + mPluginLoader.loadPlugin("RenderSystem_Direct3D9"); #endif - auto renderSystem = mRoot->getAvailableRenderers().front(); + //auto renderSystem = mRoot->getAvailableRenderers().front(); + const auto& renderers = mRoot->getAvailableRenderers(); + if (renderers.size() == 0){ + S_LOG_WARNING("\nFatal error: Empty renderer list!\n"); + exit(1); + } + const char* envRenderName = getenv("OGRE_RENDER_SYSTEM"); + if (envRenderName!= NULL) + { + auto renderSystem = mRoot->getRenderSystemByName(envRenderName); + if (renderSystem == NULL){ + S_LOG_WARNING("\nmRoot->getRenderSystemByName() return NULL!Render name:\n"); + S_LOG_WARNING(envRenderName); + renderSystem = renderers.front(); + } + mRoot->setRenderSystem(renderSystem); + }else{ + auto renderSystem = renderers.front(); try { //Set the default resolution to 1280 x 720 unless overridden by the user. renderSystem->setConfigOption("Video Mode", "1280 x 720"); //OGRE stores the value with two spaces after "x". @@ -198,6 +218,7 @@ void OgreSetup::createOgreSystem() { S_LOG_WARNING("Could not set default resolution." << ex); } mRoot->setRenderSystem(renderSystem); + } if (chdir(configSrv.getEmberDataDirectory().generic_string().c_str())) { S_LOG_WARNING("Failed to change to the data directory '" << configSrv.getEmberDataDirectory().string() << "'."); diff --git a/src/components/ogre/model/ModelDefinitionAtlasComposer.cpp b/src/components/ogre/model/ModelDefinitionAtlasComposer.cpp index 288ee99282..2e327efa71 100644 --- a/src/components/ogre/model/ModelDefinitionAtlasComposer.cpp +++ b/src/components/ogre/model/ModelDefinitionAtlasComposer.cpp @@ -202,7 +202,7 @@ std::string ModelDefinitionAtlasComposer::composeToFile(Model* model, const std: auto fileName = dir / (typeName + ".xml"); - std::fstream exportFile(fileName.c_str(), std::fstream::out); + std::fstream exportFile(fileName.string().c_str(), std::fstream::out); S_LOG_INFO("Creating atlas type " << fileName.string()); composeToStream(exportFile, model, typeName, parentTypeName, scale, collisionType); diff --git a/src/components/ogre/widgets/IngameChatWidget.cpp b/src/components/ogre/widgets/IngameChatWidget.cpp index 7aedf96169..641bb5d75d 100644 --- a/src/components/ogre/widgets/IngameChatWidget.cpp +++ b/src/components/ogre/widgets/IngameChatWidget.cpp @@ -331,7 +331,13 @@ void IngameChatWidget::Label::objectRendering(const Ogre::Camera* camera) { auto model = Model::ModelRepresentation::getModelForEntity(*mEntity); if (model) { - Ogre::Node* node = model->getNodeProvider()->getNode(); + auto provider = model->getNodeProvider(); + if (provider == nullptr) // avoid "Pick up" person bug with null provider + { + S_LOG_WARNING("model->getNodeProvider() returned NULL!"); + return; + } + Ogre::Node* node = provider->getNode(); Ogre::Vector3 diff = node->_getDerivedPosition() - camera->getDerivedPosition(); //remove the window if it's either too far away diff --git a/src/main/Application.cpp b/src/main/Application.cpp index 68684236e4..582bc058a5 100644 --- a/src/main/Application.cpp +++ b/src/main/Application.cpp @@ -223,7 +223,7 @@ Application::Application(std::string prefix, std::string homeDir, ConfigMap conf auto userConfigFilePath = mConfigService.getHomeDirectory(BaseDirType_CONFIG) / "ember.conf"; if (!boost::filesystem::exists(userConfigFilePath)) { //Create empty template file. - std::ofstream outstream(userConfigFilePath.c_str()); + std::ofstream outstream(userConfigFilePath.string().c_str()); outstream << "#This is a user specific settings file. Settings here override those found in the application installed ember.conf file." << std::endl << std::flush; S_LOG_INFO("Created empty user specific settings file at '" << userConfigFilePath.string() << "'."); } diff --git a/src/services/config/ConfigService.cpp b/src/services/config/ConfigService.cpp index 59c957dd78..578b038313 100644 --- a/src/services/config/ConfigService.cpp +++ b/src/services/config/ConfigService.cpp @@ -264,7 +264,7 @@ bool ConfigService::loadSavedConfig(const std::string& filename, const StringCon S_LOG_INFO ("Loading shared config file from " << path.string() << "."); bool success = mGlobalConfig->readFromFile(path.string(), varconf::GLOBAL); auto userConfigPath = getHomeDirectory(BaseDirType_CONFIG) / filename; - std::ifstream file(userConfigPath.c_str()); + std::ifstream file(userConfigPath.string().c_str()); if (!file.fail()) { S_LOG_INFO ("Loading user config file from " << userConfigPath.string() << "."); try { diff --git a/src/services/server/LoggedInState.cpp b/src/services/server/LoggedInState.cpp index 7982b1a475..4e834261c4 100644 --- a/src/services/server/LoggedInState.cpp +++ b/src/services/server/LoggedInState.cpp @@ -68,7 +68,7 @@ LoggedInState::~LoggedInState() { void LoggedInState::checkTransfer() { TransferInfoStringSerializer serializer; auto teleportFilePath = EmberServices::getSingleton().getConfigService().getHomeDirectory(BaseDirType_DATA) / "teleports"; - std::fstream teleportsFile(teleportFilePath.c_str(), std::ios_base::in); + std::fstream teleportsFile(teleportFilePath.string().c_str(), std::ios_base::in); TransferInfoStringSerializer::TransferInfoStore transferObjects; if (teleportsFile.good()) { serializer.deserialize(transferObjects, teleportsFile); @@ -178,7 +178,7 @@ void LoggedInState::gotAvatarSuccess(Eris::Avatar* avatar) { void LoggedInState::removeTransferInfo(const AvatarTransferInfo& transferInfo) { TransferInfoStringSerializer serializer; auto teleportFilePath = EmberServices::getSingleton().getConfigService().getHomeDirectory(BaseDirType_DATA) / "teleports"; - std::fstream teleportsFile(teleportFilePath.c_str(), std::ios_base::in); + std::fstream teleportsFile(teleportFilePath.string().c_str(), std::ios_base::in); TransferInfoStringSerializer::TransferInfoStore transferObjects; if (teleportsFile.good()) { serializer.deserialize(transferObjects, teleportsFile); @@ -196,7 +196,7 @@ void LoggedInState::removeTransferInfo(const AvatarTransferInfo& transferInfo) { } } - std::fstream teleportsOutputFile(teleportFilePath.c_str(), std::ios_base::out); + std::fstream teleportsOutputFile(teleportFilePath.string().c_str(), std::ios_base::out); if (teleportsOutputFile.good()) { serializer.serialize(transferObjects, teleportsOutputFile); } else { @@ -209,7 +209,7 @@ void LoggedInState::removeTransferInfo(const AvatarTransferInfo& transferInfo) { void LoggedInState::avatar_transferRequest(const Eris::TransferInfo& transferInfo, const Eris::Avatar* avatar) { TransferInfoStringSerializer serializer; auto teleportFilePath = EmberServices::getSingleton().getConfigService().getHomeDirectory(BaseDirType_DATA) / "teleports"; - std::fstream teleportsFile(teleportFilePath.c_str(), std::ios_base::in); + std::fstream teleportsFile(teleportFilePath.string().c_str(), std::ios_base::in); TransferInfoStringSerializer::TransferInfoStore transferObjects; if (teleportsFile.good()) { serializer.deserialize(transferObjects, teleportsFile); @@ -218,7 +218,7 @@ void LoggedInState::avatar_transferRequest(const Eris::TransferInfo& transferInf AvatarTransferInfo avatarTransferInfo(avatar->getEntity()->getName(), WFMath::TimeStamp::now(), transferInfo); transferObjects.push_back(avatarTransferInfo); - std::fstream teleportsOutputFile(teleportFilePath.c_str(), std::ios_base::out); + std::fstream teleportsOutputFile(teleportFilePath.string().c_str(), std::ios_base::out); if (teleportsOutputFile.good()) { serializer.serialize(transferObjects, teleportsOutputFile); } else { diff --git a/src/services/serversettings/ServerSettings.cpp b/src/services/serversettings/ServerSettings.cpp index d7d07e10d2..5bea2e8b5d 100644 --- a/src/services/serversettings/ServerSettings.cpp +++ b/src/services/serversettings/ServerSettings.cpp @@ -63,7 +63,7 @@ void ServerSettings::writeToDisk() { void ServerSettings::readFromDisk() { auto filePath = getFullConfigFilePath(); - std::ifstream file(filePath.c_str()); + std::ifstream file(filePath.string().c_str()); // If an existing server settings is present, then read it in. if (!file.fail()) { diff --git a/src/services/sound/SoundService.h b/src/services/sound/SoundService.h index 33cfa5cb77..b5605bdb92 100644 --- a/src/services/sound/SoundService.h +++ b/src/services/sound/SoundService.h @@ -30,7 +30,7 @@ #include #include -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(WIN32) #include #endif namespace Ember { @@ -170,7 +170,7 @@ class SoundService : public Service, public ConsoleObject { */ std::unordered_map> mBaseSamples; -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(WIN32) /** * @brief The main OpenAL context. */