Merge with develop

--HG--
branch : compatibility-develop
This commit is contained in:
kervala 2016-09-03 10:15:39 +02:00
commit 904e17475e
9 changed files with 15 additions and 12 deletions

View file

@ -192,7 +192,7 @@ public:
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (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. /// Get audio/container extensions that are supported natively by the driver implementation.
virtual void getMusicExtensions(std::vector<std::string> &extensions) const = 0; virtual void getMusicExtensions(std::vector<std::string> &extensions) const = 0;
/// Return if a music extension is supported by the driver's music channel. /// Return if a music extension is supported by the driver's music channel.

View file

@ -1676,7 +1676,7 @@ void registerGlExtensions(CGlExtensions &ext)
// Check pixel program // Check pixel program
// Disable feature ??? // Disable feature ???
if (!ext.DisableHardwarePixelProgram) if (!ext.DisableHardwarePixelProgram)
{ {
ext.ARBFragmentProgram = setupARBFragmentProgram(glext); ext.ARBFragmentProgram = setupARBFragmentProgram(glext);
ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext); ext.NVFragmentProgram2 = setupNVFragmentProgram2(glext);
ext.ARBFragmentShader = setupARBFragmentShader(glext); ext.ARBFragmentShader = setupARBFragmentShader(glext);
@ -1685,6 +1685,7 @@ void registerGlExtensions(CGlExtensions &ext)
{ {
ext.ARBFragmentProgram = false; ext.ARBFragmentProgram = false;
ext.NVFragmentProgram2 = false; ext.NVFragmentProgram2 = false;
ext.ARBFragmentShader = false;
} }
ext.OESDrawTexture = setupOESDrawTexture(glext); ext.OESDrawTexture = setupOESDrawTexture(glext);

View file

@ -1486,7 +1486,7 @@ bool CDriverGL::createWindow(const GfxMode &mode)
[[CocoaApplicationDelegate alloc] initWithDriver:this]; [[CocoaApplicationDelegate alloc] initWithDriver:this];
// set the application delegate, this will handle window/app close events // set the application delegate, this will handle window/app close events
[NSApp setDelegate:(id<NSFileManagerDelegate>)appDelegate]; [NSApp setDelegate:(id<NSApplicationDelegate>)appDelegate];
// bind the close button of the window to applicationShouldTerminate // bind the close button of the window to applicationShouldTerminate
id closeButton = [cocoa_window standardWindowButton:NSWindowCloseButton]; id closeButton = [cocoa_window standardWindowButton:NSWindowCloseButton];

View file

@ -2691,7 +2691,7 @@ bool CAudioMixerUser::getSongTitle(const std::string &filename, std::string &res
std::string artist; std::string artist;
std::string title; std::string title;
if (!_SoundDriver->getMusicInfo(filename, artist, title)) if (!_SoundDriver->getMusicInfo(filename, artist, title, length))
{ {
// use 3rd party libraries supported formats // use 3rd party libraries supported formats
IAudioDecoder::getInfo(filename, artist, title, length); IAudioDecoder::getInfo(filename, artist, title, length);

View file

@ -115,7 +115,7 @@ public:
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (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: private:

View file

@ -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 artist returns the song artist (empty if not available)
* \param title returns the title (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 */ /* Open a stream, get the tag if it exists, close the stream */
string pathName = CPath::lookup(filepath, false); 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(artist, "ARTIST", stream);
getTag(title, "TITLE", stream); getTag(title, "TITLE", stream);
// get length of the music in seconds
length = (float)FSOUND_Stream_GetLengthMs(stream) / 1000.f;
FSOUND_Stream_Close(stream); FSOUND_Stream_Close(stream);
return true; return true;
} }

View file

@ -116,7 +116,7 @@ public:
* \param artist returns the song artist (empty if not available) * \param artist returns the song artist (empty if not available)
* \param title returns the title (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) // also check that the channel still exist (avoid any free problem)
void markMusicChannelEnded(void *stream, CMusicChannelFMod *musicChannel); void markMusicChannelEnded(void *stream, CMusicChannelFMod *musicChannel);

View file

@ -679,12 +679,12 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const
// directory doesn't exist // directory doesn't exist
if (!dir.exists()) return false; if (!dir.exists()) return false;
if (!dir.cd("data") && dir.exists()) return false; if (!dir.cd("data")) return false;
QStringList filter; QStringList filter;
filter << "*.string_cache"; filter << "*.string_cache";
if (dir.exists("packed_sheets.bnp")) if (dir.exists("packedsheets.bnp"))
{ {
filter << "*.packed_sheets"; filter << "*.packed_sheets";
filter << "*.packed"; filter << "*.packed";
@ -695,7 +695,7 @@ bool CConfigFile::foundTemporaryFiles(const QString &directory) const
if (!dir.entryList(filter, QDir::Files).isEmpty()) return true; if (!dir.entryList(filter, QDir::Files).isEmpty()) return true;
// fonts directory is not needed anymore // 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; return false;
} }

View file

@ -46,7 +46,7 @@ bool CFilesCleaner::exec()
// directory doesn't exist // directory doesn't exist
if (!dir.exists()) return false; if (!dir.exists()) return false;
if (!dir.cd("data") && dir.exists()) return false; if (!dir.cd("data")) return false;
QStringList filter; QStringList filter;
filter << "*.string_cache"; filter << "*.string_cache";
@ -79,7 +79,7 @@ bool CFilesCleaner::exec()
} }
// fonts directory is not needed anymore if fonts.bnp exists // 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(); dir.removeRecursively();
} }