• R/O
  • HTTP
  • SSH
  • HTTPS

x264-launcher: Commit

Simple x264 Launcher development repository


Commit MetaInfo

Revisiond59c4f5789957a77af318c368f644ca740e130a3 (tree)
Time2019-08-13 03:20:44
Authorlordmulder <mulder2@gmx....>
Commiterlordmulder

Log Message

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

Change Summary

Incremental Difference

--- a/src/thread_vapoursynth.cpp
+++ b/src/thread_vapoursynth.cpp
@@ -48,7 +48,6 @@ QScopedPointer<QFile> VapourSynthCheckThread::m_vpsDllPath[2];
4848 //Const
4949 static const char* const VPS_DLL_NAME = "vapoursynth.dll";
5050 static const char* const VPS_EXE_NAME = "vspipe.exe";
51-static const char* const VPS_REG_PATH = "SOFTWARE\\VapourSynth";
5251 static const char* const VPS_REG_NAME = "VapourSynthDLL";
5352
5453 //Default VapurSynth architecture
@@ -163,6 +162,12 @@ int VapourSynthCheckThread::threadMain(void)
163162 VAPOURSYNTH_X64,
164163 NULL
165164 };
165+ static const char* const VPS_REG_PATH[] =
166+ {
167+ "SOFTWARE\\VapourSynth",
168+ "SOFTWARE\\VapourSynth-32",
169+ NULL
170+ };
166171 static const MUtils::Registry::reg_scope_t REG_SCOPE_X86[] =
167172 {
168173 MUtils::Registry::scope_default,
@@ -197,20 +202,43 @@ int VapourSynthCheckThread::threadMain(void)
197202 //Read VapourSynth path from registry
198203 if (vpsDllInfo.isEmpty() && vpsExeInfo.isEmpty())
199204 {
205+ //Try to detect the path from HKEY_LOCAL_MACHINE first!
200206 const MUtils::Registry::reg_scope_t* const scope = (MUtils::OS::os_architecture() == MUtils::OS::ARCH_X64) ? REG_SCOPE_X64 : REG_SCOPE_X86;
201207 for (size_t i = 0; scope[i] != REG_SCOPE_EOL; i++)
202208 {
203- if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), scope[i]))
209+ if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH[0U]), scope[i]))
204210 {
205211 QString vpsRegDllPath;
206- if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath, scope[i]))
212+ if (MUtils::Registry::reg_value_read(MUtils::Registry::root_machine, QString::fromLatin1(VPS_REG_PATH[0U]), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath, scope[i]))
207213 {
208214 QFileInfo vpsRegDllInfo(QDir::fromNativeSeparators(vpsRegDllPath));
209215 vpsRegDllInfo.makeAbsolute();
210216 if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile())
211217 {
212218 const int flag = getVapourSynthType(scope[i]);
213- if((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag)))
219+ if ((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag)))
220+ {
221+ vpsDllInfo.insert(flag, vpsRegDllInfo);
222+ vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/
223+ }
224+ }
225+ }
226+ }
227+ }
228+ //Fall back to HKEY_CURRENT_USER, if path not found yet
229+ for (size_t i = 0; VPS_REG_PATH[i]; i++)
230+ {
231+ if (MUtils::Registry::reg_key_exists(MUtils::Registry::root_user, QString::fromLatin1(VPS_REG_PATH[i])))
232+ {
233+ QString vpsRegDllPath;
234+ if (MUtils::Registry::reg_value_read(MUtils::Registry::root_user, QString::fromLatin1(VPS_REG_PATH[i]), QString::fromLatin1(VPS_REG_NAME), vpsRegDllPath))
235+ {
236+ QFileInfo vpsRegDllInfo(QDir::fromNativeSeparators(vpsRegDllPath));
237+ vpsRegDllInfo.makeAbsolute();
238+ if (vpsRegDllInfo.exists() && vpsRegDllInfo.isFile())
239+ {
240+ const int flag = (i) ? VAPOURSYNTH_X86 : VAPOURSYNTH_X64;
241+ if ((!vpsDllInfo.contains(flag)) || (!vpsExeInfo.contains(flag)))
214242 {
215243 vpsDllInfo.insert(flag, vpsRegDllInfo);
216244 vpsExeInfo.insert(flag, vpsRegDllInfo.absoluteDir().absoluteFilePath(VPS_EXE_NAME)); /*derive VSPipe.EXE path from VapourSynth.DLL path for now!*/
--- a/src/version.h
+++ b/src/version.h
@@ -26,7 +26,7 @@
2626 #define VER_X264_MAJOR 2
2727 #define VER_X264_MINOR 9
2828 #define VER_X264_PATCH 3
29-#define VER_X264_BUILD 1182
29+#define VER_X264_BUILD 1183
3030
3131 #define VER_X264_PORTABLE_EDITION (0)
3232
Show on old repository browser