From 8f7a28f5c9bc90c44e8fd6e1d3a5f7f001137171 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:03:33 +0200 Subject: [PATCH 1/6] Changed: Get length of song in FMod driver too (issue #59) --HG-- branch : develop --- code/nel/include/nel/sound/driver/sound_driver.h | 2 +- code/nel/src/sound/audio_mixer_user.cpp | 2 +- code/nel/src/sound/driver/dsound/sound_driver_dsound.h | 2 +- code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp | 4 +++- code/nel/src/sound/driver/fmod/sound_driver_fmod.h | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/code/nel/include/nel/sound/driver/sound_driver.h b/code/nel/include/nel/sound/driver/sound_driver.h index b5549e5bf..e38126fff 100644 --- a/code/nel/include/nel/sound/driver/sound_driver.h +++ b/code/nel/include/nel/sound/driver/sound_driver.h @@ -192,7 +192,7 @@ public: * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ - virtual bool getMusicInfo(const std::string &/* filepath */, std::string &artist, std::string &title) { artist.clear(); title.clear(); return false; } + virtual bool getMusicInfo(const std::string &/* filepath */, std::string &artist, std::string &title, float &length) { artist.clear(); title.clear(); length = 0.f; return false; } /// Get audio/container extensions that are supported natively by the driver implementation. virtual void getMusicExtensions(std::vector &extensions) const = 0; /// Return if a music extension is supported by the driver's music channel. diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 96cfdf268..6f2c2b449 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -2691,7 +2691,7 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res std::string artist; std::string title; - if (!_SoundDriver->getMusicInfo(filename, artist, title)) + if (!_SoundDriver->getMusicInfo(filename, artist, title, length)) { // use 3rd party libraries supported formats IAudioDecoder::getInfo(filename, artist, title, length); diff --git a/code/nel/src/sound/driver/dsound/sound_driver_dsound.h b/code/nel/src/sound/driver/dsound/sound_driver_dsound.h index 14872c1e1..e928cf137 100644 --- a/code/nel/src/sound/driver/dsound/sound_driver_dsound.h +++ b/code/nel/src/sound/driver/dsound/sound_driver_dsound.h @@ -115,7 +115,7 @@ public: * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ - virtual bool getMusicInfo(const std::string & /* filepath */, std::string &artist, std::string &title) { artist.clear(); title.clear(); return false; } + virtual bool getMusicInfo(const std::string & /* filepath */, std::string &artist, std::string &title, float &length) { artist.clear(); title.clear(); length = 0.f; return false; } private: diff --git a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp index 6ca480ce7..07455b963 100644 --- a/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp +++ b/code/nel/src/sound/driver/fmod/sound_driver_fmod.cpp @@ -496,7 +496,7 @@ bool getTag (std::string &result, const char *tag, FSOUND_STREAM *stream) * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ -bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title) +bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length) { /* Open a stream, get the tag if it exists, close the stream */ string pathName = CPath::lookup(filepath, false); @@ -526,6 +526,8 @@ bool CSoundDriverFMod::getMusicInfo(const std::string &filepath, std::string &ar { getTag(artist, "ARTIST", stream); getTag(title, "TITLE", stream); + // get length of the music in seconds + length = (float)FSOUND_Stream_GetLengthMs(stream) / 1000.f; FSOUND_Stream_Close(stream); return true; } diff --git a/code/nel/src/sound/driver/fmod/sound_driver_fmod.h b/code/nel/src/sound/driver/fmod/sound_driver_fmod.h index 8beabe562..db82cde6e 100644 --- a/code/nel/src/sound/driver/fmod/sound_driver_fmod.h +++ b/code/nel/src/sound/driver/fmod/sound_driver_fmod.h @@ -116,7 +116,7 @@ public: * \param artist returns the song artist (empty if not available) * \param title returns the title (empty if not available) */ - virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title); + virtual bool getMusicInfo(const std::string &filepath, std::string &artist, std::string &title, float &length); // also check that the channel still exist (avoid any free problem) void markMusicChannelEnded(void *stream, CMusicChannelFMod *musicChannel); From 53290cb2129ef8807e3da9b8a82f4482c2d656c5 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:04:09 +0200 Subject: [PATCH 2/6] Changed: Initialize ARBFragmentShader to false if DisableHardwarePixelProgram is set --HG-- branch : develop --- code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp index 373c501bf..9d9143515 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_extension.cpp @@ -1676,7 +1676,7 @@ void registerGlExtensions(CGlExtensions &ext) // Check pixel program // Disable feature ??? if (!ext.DisableHardwarePixelProgram) - { + { ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); ext.ARBFragmentShader = setupARBFragmentShader(glext); @@ -1685,6 +1685,7 @@ void registerGlExtensions(CGlExtensions &ext) { ext.ARBFragmentProgram = false; ext.NVFragmentProgram2 = false; + ext.ARBFragmentShader = false; } ext.OESDrawTexture = setupOESDrawTexture(glext); From eb878d97d1bb9105ddbb24c1d914a9c1b81f582f Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:04:56 +0200 Subject: [PATCH 3/6] Fixed: Compilation under macOS 10.12 --HG-- branch : develop --- code/nel/src/3d/driver/opengl/driver_opengl_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index db6400042..c826238ea 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -1486,7 +1486,7 @@ bool CDriverGL::createWindow(const GfxMode &mode) [[CocoaApplicationDelegate alloc] initWithDriver:this]; // set the application delegate, this will handle window/app close events - [NSApp setDelegate:(id)appDelegate]; + [NSApp setDelegate:(id)appDelegate]; // bind the close button of the window to applicationShouldTerminate id closeButton = [cocoa_window standardWindowButton:NSWindowCloseButton]; From 400c17826e488de6ace63b48faafcbb9b43a783d Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:05:56 +0200 Subject: [PATCH 4/6] Changed: Added getGroundZ to develop branch too --HG-- branch : develop --- code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp | 12 ++++++++++++ code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h | 1 + 2 files changed, 13 insertions(+) diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 87ee0c44d..578033949 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -519,6 +519,7 @@ void CLuaIHMRyzom::RegisterRyzomFunctions( NLGUI::CLuaState &ls ) LUABIND_FUNC(getCharacterSheetRegionForce), LUABIND_FUNC(getCharacterSheetRegionLevel), LUABIND_FUNC(getRegionByAlias), + LUABIND_FUNC(getGroundZ), LUABIND_FUNC(tell), LUABIND_FUNC(isRingAccessPointInReach), LUABIND_FUNC(updateTooltipCoords), @@ -2614,6 +2615,17 @@ string CLuaIHMRyzom::getRegionByAlias(uint32 alias) return ContinentMngr.getRegionNameByAlias(alias); } + +sint32 CLuaIHMRyzom::getGroundZ(uint32 x, sint32 y) +{ + CVector vect = CVector(x, y, 0); + nlinfo("TEST"); + UserEntity->getCollisionEntity()->snapToGround(vect); + nlinfo("Ground Z of (%d,%d) = %d", x, y, vect.z); + return vect.z; +} + + // *************************************************************************** void CLuaIHMRyzom::tell(const ucstring &player, const ucstring &msg) { diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h index fd570f100..5599941e5 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.h @@ -201,6 +201,7 @@ private: static sint getCharacterSheetRegionForce(const std::string &sheet); static sint getCharacterSheetRegionLevel(const std::string &sheet); static std::string getRegionByAlias(uint32 alias); + static sint getGroundZ(uint32 x, sint32 y); // open the window to do a tell to 'player', if 'msg' is not empty, then the message will be sent immediatly // else, current command of the chat window will be replaced with tell 'player' static void tell(const ucstring &player, const ucstring &msg); From 508b5fdd24f11d9b99529db9928e46780ae4bf67 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:14:06 +0200 Subject: [PATCH 5/6] Changed: QDir.cd already checks if directory exists, see #279 --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/configfile.cpp | 4 ++-- code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index 6e978cd80..b94a75358 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -679,7 +679,7 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const // directory doesn't exist if (!dir.exists()) return false; - if (!dir.cd("data") && dir.exists()) return false; + if (!dir.cd("data")) return false; QStringList filter; filter << "*.string_cache"; @@ -695,7 +695,7 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const if (!dir.entryList(filter, QDir::Files).isEmpty()) return true; // fonts directory is not needed anymore - if (dir.exists("fonts.bnp") && dir.cd("fonts") && dir.exists()) return true; + if (dir.exists("fonts.bnp") && !dir.cd("fonts")) return true; return false; } diff --git a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp index be62ee2a9..c3830dbc1 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/filescleaner.cpp @@ -46,7 +46,7 @@ bool CFilesCleaner::exec() // directory doesn't exist if (!dir.exists()) return false; - if (!dir.cd("data") && dir.exists()) return false; + if (!dir.cd("data")) return false; QStringList filter; filter << "*.string_cache"; @@ -79,7 +79,7 @@ bool CFilesCleaner::exec() } // fonts directory is not needed anymore if fonts.bnp exists - if (dir.exists("fonts.bnp") && dir.cd("fonts") && dir.exists()) + if (dir.exists("fonts.bnp") && dir.cd("fonts")) { dir.removeRecursively(); } From 243f9bc9bd147378f07b3f71b065eb09f99d06f6 Mon Sep 17 00:00:00 2001 From: kervala Date: Sat, 3 Sep 2016 10:14:48 +0200 Subject: [PATCH 6/6] Changed: Wrong filename for packed sheets BNP, see #279 --HG-- branch : develop --- code/ryzom/tools/client/ryzom_installer/src/configfile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index b94a75358..7b3952a22 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -684,7 +684,7 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const QStringList filter; filter << "*.string_cache"; - if (dir.exists("packed_sheets.bnp")) + if (dir.exists("packedsheets.bnp")) { filter << "*.packed_sheets"; filter << "*.packed";