From: lordmulder Date: Fri, 9 Aug 2019 12:33:57 +0000 (+0200) Subject: Small tweak to VapourSynth detection. X-Git-Tag: v2.94~11 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=3d620d791c891da28d8c9bb31a9408ac9b1c3772;p=x264-launcher%2Fx264-launcher.git Small tweak to VapourSynth detection. --- diff --git a/src/thread_vapoursynth.cpp b/src/thread_vapoursynth.cpp index d708c61..51f486d 100644 --- a/src/thread_vapoursynth.cpp +++ b/src/thread_vapoursynth.cpp @@ -61,10 +61,10 @@ static const char* const VPS_REG_NAME = "VapourSynthDLL"; //Enable detection of "portabel" edition? #define ENABLE_PORTABLE_VPS true -//------------------------------------- -// Auxilary functions -//------------------------------------- +//Registry scope EOL flag +#define REG_SCOPE_EOL (MUtils::Registry::reg_scope_t(-1)) +//Auxilary functions #define BOOLIFY(X) ((X) ? '1' : '0') #define VPS_BITNESS(X) (((X) + 1U) * 32U) @@ -163,11 +163,16 @@ int VapourSynthCheckThread::threadMain(void) VAPOURSYNTH_X64, 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_x64, - MUtils::Registry::scope_default + REG_SCOPE_EOL }; QHash vpsDllInfo, vpsExeInfo; @@ -192,20 +197,24 @@ int VapourSynthCheckThread::threadMain(void) //Read VapourSynth path from registry 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; - 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)); vpsRegDllInfo.makeAbsolute(); if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile()) { - const int flag = getVapourSynthType(REG_SCOPE[i]); - vpsDllInfo.insert(flag, vpsRegDllInfo); - vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/ + const int flag = getVapourSynthType(scope[i]); + if((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag))) + { + 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! 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])) { QFile *vpsExeFile, *vpsDllFile; @@ -260,19 +270,21 @@ int VapourSynthCheckThread::threadMain(void) VapourSynthCheckThread::VapourSynthFlags VapourSynthCheckThread::getVapourSynthType(const int scope) { - if (MUtils::OS::os_architecture() != MUtils::OS::ARCH_X64) - { - return VAPOURSYNTH_X86; - } - - switch (scope) + if (MUtils::OS::os_architecture() == MUtils::OS::ARCH_X64) { + switch (scope) + { case MUtils::Registry::scope_wow_x32: return VAPOURSYNTH_X86; case MUtils::Registry::scope_wow_x64: return VAPOURSYNTH_X64; default: return VAPOURSYNTH_DEF; + } + } + else + { + return VAPOURSYNTH_X86; /*ignore scope on 32-Bit OS*/ } } diff --git a/src/version.h b/src/version.h index 781c544..2fffdea 100644 --- a/src/version.h +++ b/src/version.h @@ -26,7 +26,7 @@ #define VER_X264_MAJOR 2 #define VER_X264_MINOR 9 #define VER_X264_PATCH 3 -#define VER_X264_BUILD 1181 +#define VER_X264_BUILD 1182 #define VER_X264_PORTABLE_EDITION (0)