Added a method to use custom binaries instead of the "built-in" ones: Simply put the custom binary to "$ORIGIN\tools\<build_no>\<tool_name>.exe" and it will be detected at runtime.

This commit is contained in:
LoRd_MuldeR 2011-04-17 20:38:49 +02:00
parent 568da6136b
commit cd593aefbf
3 changed files with 34 additions and 12 deletions

View File

@ -20,6 +20,7 @@ a:visited { color: #0000EE; }
<li>Upgraded build environment to Microsoft Visual Studio 2010
<li>Dropping support for Windows 2000 and for Windows XP RTM/SP1, Windows XP needs SP2 or SP3 now!
<li>Added a new translation: Korean
<li>Added a method to use custom tools instead of the "built-in" ones (see <a href="FAQ.html" target="_blank">FAQ doc</a> for details)
<li>Updated LAME encoder to v3.99.1.0 (2011-04-15), compiled with ICL 12.0.3 and MSVC 10.0 (<a href="http://lame.cvs.sourceforge.net/viewvc/lame/lame/doc/html/history.html?revision=1.127" target="_blank">details</a>)
<li>Updated MediaInfo to v0.7.43 (2011-04-10), compiled with ICL 12.0.3 and MSVC 10.0
<li>Updated language files (big thank-you to all contributors !!!)

View File

@ -30,7 +30,7 @@
#define VER_LAMEXP_MINOR_LO 2
#define VER_LAMEXP_TYPE Alpha
#define VER_LAMEXP_PATCH 4
#define VER_LAMEXP_BUILD 447
#define VER_LAMEXP_BUILD 448
///////////////////////////////////////////////////////////////////////////////
// Tools versions

View File

@ -101,6 +101,7 @@ InitializationThread::InitializationThread(const lamexp_cpu_t *cpuFeatures)
void InitializationThread::run()
{
m_bSuccess = false;
bool bCustom = false;
delay();
//CPU type selection
@ -133,10 +134,11 @@ void InitializationThread::run()
QDir toolsDir(":/tools/");
QList<QFileInfo> toolsList = toolsDir.entryInfoList(QStringList("*.*"), QDir::Files, QDir::Name);
QDir appDir = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
QTime timer;
timer.start();
//Extract all files
while(!toolsList.isEmpty())
{
@ -157,14 +159,25 @@ void InitializationThread::run()
if(toolCpuType & cpuSupport)
{
qDebug("Extracting file: %s -> %s", toolName.toLatin1().constData(), toolShortName.toLatin1().constData());
LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString("%1/tool_%2").arg(lamexp_temp_folder2(), toolShortName), toolHash);
lamexp_register_tool(toolShortName, lockedFile, toolVersion);
QFileInfo customTool(QString("%1/tools/%2/%3").arg(appDir.canonicalPath(), QString::number(lamexp_version_build()), toolShortName));
if(customTool.exists() && customTool.isFile())
{
bCustom = true;
qDebug("Setting up file: %s <- %s", toolShortName.toLatin1().constData(), appDir.relativeFilePath(customTool.canonicalFilePath()).toLatin1().constData());
LockedFile *lockedFile = new LockedFile(customTool.canonicalFilePath());
lamexp_register_tool(toolShortName, lockedFile, UINT_MAX);
}
else
{
qDebug("Extracting file: %s -> %s", toolName.toLatin1().constData(), toolShortName.toLatin1().constData());
LockedFile *lockedFile = new LockedFile(QString(":/tools/%1").arg(toolName), QString("%1/tool_%2").arg(lamexp_temp_folder2(), toolShortName), toolHash);
lamexp_register_tool(toolShortName, lockedFile, toolVersion);
}
}
}
catch(char *errorMsg)
{
qFatal("At least one of the required tools could not be extracted:\n%s", errorMsg);
qFatal("At least one of the required tools could not be initialized:\n%s", errorMsg);
return;
}
}
@ -176,12 +189,18 @@ void InitializationThread::run()
return;
}
qDebug("All extracted.\n");
//Clean-up
mapChecksum.clear();
mapVersion.clear();
mapCpuType.clear();
qDebug("All extracted.\n");
//Using any custom tools?
if(bCustom)
{
qWarning("Warning: Using custom tools, you might encounter unexpected problems!\n");
}
//Check delay
double delayExtract = static_cast<double>(timer.elapsed()) / 1000.0;
@ -273,10 +292,12 @@ void InitializationThread::initTranslations(void)
void InitializationThread::initNeroAac(void)
{
const QString appPath = QDir(QCoreApplication::applicationDirPath()).canonicalPath();
QFileInfo neroFileInfo[3];
neroFileInfo[0] = QFileInfo(QString("%1/neroAacEnc.exe").arg(QCoreApplication::applicationDirPath()));
neroFileInfo[1] = QFileInfo(QString("%1/neroAacDec.exe").arg(QCoreApplication::applicationDirPath()));
neroFileInfo[2] = QFileInfo(QString("%1/neroAacTag.exe").arg(QCoreApplication::applicationDirPath()));
neroFileInfo[0] = QFileInfo(QString("%1/neroAacEnc.exe").arg(appPath));
neroFileInfo[1] = QFileInfo(QString("%1/neroAacDec.exe").arg(appPath));
neroFileInfo[2] = QFileInfo(QString("%1/neroAacTag.exe").arg(appPath));
bool neroFilesFound = true;
for(int i = 0; i < 3; i++) { if(!neroFileInfo[i].exists()) neroFilesFound = false; }