Small tweak to VapourSynth detection.

This commit is contained in:
LoRd_MuldeR 2019-08-09 14:33:57 +02:00
parent 9d6b4ccfeb
commit 3d620d791c
2 changed files with 30 additions and 18 deletions

View File

@ -61,10 +61,10 @@ static const char* const VPS_REG_NAME = "VapourSynthDLL";
//Enable detection of "portabel" edition? //Enable detection of "portabel" edition?
#define ENABLE_PORTABLE_VPS true #define ENABLE_PORTABLE_VPS true
//------------------------------------- //Registry scope EOL flag
// Auxilary functions #define REG_SCOPE_EOL (MUtils::Registry::reg_scope_t(-1))
//-------------------------------------
//Auxilary functions
#define BOOLIFY(X) ((X) ? '1' : '0') #define BOOLIFY(X) ((X) ? '1' : '0')
#define VPS_BITNESS(X) (((X) + 1U) * 32U) #define VPS_BITNESS(X) (((X) + 1U) * 32U)
@ -163,11 +163,16 @@ int VapourSynthCheckThread::threadMain(void)
VAPOURSYNTH_X64, VAPOURSYNTH_X64,
NULL NULL
}; };
static const MUtils::Registry::reg_scope_t REG_SCOPE[3] = static const MUtils::Registry::reg_scope_t REG_SCOPE_X86[] =
{
MUtils::Registry::scope_default,
REG_SCOPE_EOL
};
static const MUtils::Registry::reg_scope_t REG_SCOPE_X64[] =
{ {
MUtils::Registry::scope_wow_x32, MUtils::Registry::scope_wow_x32,
MUtils::Registry::scope_wow_x64, MUtils::Registry::scope_wow_x64,
MUtils::Registry::scope_default REG_SCOPE_EOL
}; };
QHash<int, QFileInfo> vpsDllInfo, vpsExeInfo; QHash<int, QFileInfo> vpsDllInfo, vpsExeInfo;
@ -192,20 +197,24 @@ int VapourSynthCheckThread::threadMain(void)
//Read VapourSynth path from registry //Read VapourSynth path from registry
if (vpsDllInfo.isEmpty() && vpsExeInfo.isEmpty()) if (vpsDllInfo.isEmpty() && vpsExeInfo.isEmpty())
{ {
for (size_t i = 0; i < 3U; i++) const MUtils::Registry::reg_scope_t* const scope = (MUtils::OS::os_architecture() == MUtils::OS::ARCH_X64) ? REG_SCOPE_X64 : REG_SCOPE_X86;
for (size_t i = 0; scope[i] != REG_SCOPE_EOL; i++)
{ {
if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), REG_SCOPE[i])) if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), scope[i]))
{ {
QString vpsRegDllPath; QString vpsRegDllPath;
if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath, REG_SCOPE[i])) if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath, scope[i]))
{ {
QFileInfo vpsRegDllInfo(QDir::fromNativeSeparators(vpsRegDllPath)); QFileInfo vpsRegDllInfo(QDir::fromNativeSeparators(vpsRegDllPath));
vpsRegDllInfo.makeAbsolute(); vpsRegDllInfo.makeAbsolute();
if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile()) if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile())
{ {
const int flag = getVapourSynthType(REG_SCOPE[i]); const int flag = getVapourSynthType(scope[i]);
vpsDllInfo.insert(flag, vpsRegDllInfo); if((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag)))
vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/ {
vpsDllInfo.insert(flag, vpsRegDllInfo);
vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/
}
} }
} }
} }
@ -222,6 +231,7 @@ int VapourSynthCheckThread::threadMain(void)
//Validate the VapourSynth installation now! //Validate the VapourSynth installation now!
for (size_t i = 0; i < 2U; i++) for (size_t i = 0; i < 2U; i++)
{ {
qDebug("VapourSynth %u-Bit support is being tested.", VPS_BITNESS(i));
if (vpsDllInfo.contains(VPS_BIT_FLAG[i]) && vpsExeInfo.contains(VPS_BIT_FLAG[i])) if (vpsDllInfo.contains(VPS_BIT_FLAG[i]) && vpsExeInfo.contains(VPS_BIT_FLAG[i]))
{ {
QFile *vpsExeFile, *vpsDllFile; QFile *vpsExeFile, *vpsDllFile;
@ -260,19 +270,21 @@ int VapourSynthCheckThread::threadMain(void)
VapourSynthCheckThread::VapourSynthFlags VapourSynthCheckThread::getVapourSynthType(const int scope) VapourSynthCheckThread::VapourSynthFlags VapourSynthCheckThread::getVapourSynthType(const int scope)
{ {
if (MUtils::OS::os_architecture() != MUtils::OS::ARCH_X64) if (MUtils::OS::os_architecture() == MUtils::OS::ARCH_X64)
{
return VAPOURSYNTH_X86;
}
switch (scope)
{ {
switch (scope)
{
case MUtils::Registry::scope_wow_x32: case MUtils::Registry::scope_wow_x32:
return VAPOURSYNTH_X86; return VAPOURSYNTH_X86;
case MUtils::Registry::scope_wow_x64: case MUtils::Registry::scope_wow_x64:
return VAPOURSYNTH_X64; return VAPOURSYNTH_X64;
default: default:
return VAPOURSYNTH_DEF; return VAPOURSYNTH_DEF;
}
}
else
{
return VAPOURSYNTH_X86; /*ignore scope on 32-Bit OS*/
} }
} }

View File

@ -26,7 +26,7 @@
#define VER_X264_MAJOR 2 #define VER_X264_MAJOR 2
#define VER_X264_MINOR 9 #define VER_X264_MINOR 9
#define VER_X264_PATCH 3 #define VER_X264_PATCH 3
#define VER_X264_BUILD 1181 #define VER_X264_BUILD 1182
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)