Workaround to detect VapourSynth even if it has been installed with "for me only" option (not recommended).

This commit is contained in:
LoRd_MuldeR 2019-08-12 20:20:44 +02:00
parent 3d620d791c
commit d59c4f5789
2 changed files with 33 additions and 5 deletions

View File

@ -48,7 +48,6 @@ QScopedPointer<QFile> VapourSynthCheckThread::m_vpsDllPath[2];
//Const //Const
static const char* const VPS_DLL_NAME = "vapoursynth.dll"; static const char* const VPS_DLL_NAME = "vapoursynth.dll";
static const char* const VPS_EXE_NAME = "vspipe.exe"; static const char* const VPS_EXE_NAME = "vspipe.exe";
static const char* const VPS_REG_PATH = "SOFTWARE\\VapourSynth";
static const char* const VPS_REG_NAME = "VapourSynthDLL"; static const char* const VPS_REG_NAME = "VapourSynthDLL";
//Default VapurSynth architecture //Default VapurSynth architecture
@ -163,6 +162,12 @@ int VapourSynthCheckThread::threadMain(void)
VAPOURSYNTH_X64, VAPOURSYNTH_X64,
NULL NULL
}; };
static const char* const VPS_REG_PATH[] =
{
"SOFTWARE\\VapourSynth",
"SOFTWARE\\VapourSynth-32",
NULL
};
static const MUtils::Registry::reg_scope_t REG_SCOPE_X86[] = static const MUtils::Registry::reg_scope_t REG_SCOPE_X86[] =
{ {
MUtils::Registry::scope_default, MUtils::Registry::scope_default,
@ -197,20 +202,43 @@ int VapourSynthCheckThread::threadMain(void)
//Read VapourSynth path from registry //Read VapourSynth path from registry
if (vpsDllInfo.isEmpty() && vpsExeInfo.isEmpty()) if (vpsDllInfo.isEmpty() && vpsExeInfo.isEmpty())
{ {
//Try to detect the path from HKEY_LOCAL_MACHINE first!
const MUtils::Registry::reg_scope_t* const scope = (MUtils::OS::os_architecture() == MUtils::OS::ARCH_X64) ? REG_SCOPE_X64 : REG_SCOPE_X86; 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++) 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), scope[i])) if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH[0U]), 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, scope[i])) if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH[0U]), 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(scope[i]); const int flag = getVapourSynthType(scope[i]);
if((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag))) 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!*/
}
}
}
}
}
//Fall back to HKEY_CURRENT_USER, if path not found yet
for (size_t i = 0; VPS_REG_PATH[i]; i++)
{
if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_user, QString::fromLatin1(VPS_REG_PATH[i])))
{
QString vpsRegDllPath;
if (MUtils::Registry::reg_value_read(MUtils::Registry::root_user, QString::fromLatin1(VPS_REG_PATH[i]), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath))
{
QFileInfo vpsRegDllInfo(QDir::fromNativeSeparators(vpsRegDllPath));
vpsRegDllInfo.makeAbsolute();
if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile())
{
const int flag = (i) ? VAPOURSYNTH_X86 : VAPOURSYNTH_X64;
if ((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag)))
{ {
vpsDllInfo.insert(flag, vpsRegDllInfo); vpsDllInfo.insert(flag, vpsRegDllInfo);
vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/ vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/

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 1182 #define VER_X264_BUILD 1183
#define VER_X264_PORTABLE_EDITION (0) #define VER_X264_PORTABLE_EDITION (0)