Recognize WMA decoder (wamwav.exe) from the LameXP program directory. Might be helpful for people using LameXP as a portable application.

This commit is contained in:
LoRd_MuldeR 2011-06-21 16:23:42 +02:00
parent ee6b909065
commit 63bf596ce8
3 changed files with 12 additions and 8 deletions

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 3 #define VER_LAMEXP_MINOR_LO 3
#define VER_LAMEXP_TYPE Alpha #define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 1 #define VER_LAMEXP_PATCH 1
#define VER_LAMEXP_BUILD 579 #define VER_LAMEXP_BUILD 580
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Tools versions // Tools versions

View File

@ -58,14 +58,14 @@ LockedFile::LockedFile(const QString &resourcePath, const QString &outPath, cons
} }
//Now lock the file! //Now lock the file!
for(int i = 0; i < 1000; i++) for(int i = 0; i < 64; i++)
{ {
if((m_fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL)) != INVALID_HANDLE_VALUE) m_fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(m_filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
{ if((m_fileHandle != NULL) && (m_fileHandle != INVALID_HANDLE_VALUE)) break;
break;
}
Sleep(100); Sleep(100);
} }
//Locked successfully?
if((m_fileHandle == NULL) || (m_fileHandle == INVALID_HANDLE_VALUE)) if((m_fileHandle == NULL) || (m_fileHandle == INVALID_HANDLE_VALUE))
{ {
QFile::remove(QFileInfo(outFile).canonicalFilePath()); QFile::remove(QFileInfo(outFile).canonicalFilePath());
@ -120,7 +120,7 @@ LockedFile::LockedFile(const QString &filePath)
m_filePath = existingFile.canonicalFilePath(); m_filePath = existingFile.canonicalFilePath();
//Now lock the file //Now lock the file
for(int i = 0; i < 10; i++) for(int i = 0; i < 64; i++)
{ {
m_fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL); m_fileHandle = CreateFileW(QWCHAR(QDir::toNativeSeparators(filePath)), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, NULL, NULL);
if((m_fileHandle != NULL) && (m_fileHandle != INVALID_HANDLE_VALUE)) break; if((m_fileHandle != NULL) && (m_fileHandle != INVALID_HANDLE_VALUE)) break;

View File

@ -405,7 +405,11 @@ void InitializationThread::initWmaDec(void)
LockedFile *wmaFileBin = NULL; LockedFile *wmaFileBin = NULL;
QFileInfo wmaFileInfo = QFileInfo(QString("%1/%2").arg(lamexp_known_folder(lamexp_folder_programfiles), wmaDecoderComponentPath)); QFileInfo wmaFileInfo = QFileInfo(QString("%1/%2").arg(lamexp_known_folder(lamexp_folder_programfiles), wmaDecoderComponentPath));
if(!wmaFileInfo.exists()) if(!(wmaFileInfo.exists() && wmaFileInfo.isFile()))
{
wmaFileInfo.setFile(QString("%1/%2").arg(QDir(QCoreApplication::applicationDirPath()).canonicalPath(), "wmawav.exe"));
}
if(!(wmaFileInfo.exists() && wmaFileInfo.isFile()))
{ {
qDebug("WMA File Decoder not found -> WMA decoding support will be disabled!\n"); qDebug("WMA File Decoder not found -> WMA decoding support will be disabled!\n");
return; return;