From 1847a8be4508233041540f3c20aa559feaa02d2f Mon Sep 17 00:00:00 2001 From: Nittai-Cohen-TAU Date: Sat, 19 Aug 2023 13:10:39 +0300 Subject: [PATCH 1/2] Fixed an issue where the library would fail to find the DLL --- VJoy_lib.ahk | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/VJoy_lib.ahk b/VJoy_lib.ahk index e4ec3fd..620001d 100644 --- a/VJoy_lib.ahk +++ b/VJoy_lib.ahk @@ -41,31 +41,18 @@ VJoy_LoadLibrary() { ExitApp } - ; Try to find location of correct DLL. - ; vJoy versions prior to 2.0.4 241214 lack these registry keys - if key not found, advise update. + DllFolder := vJoyFolder + if (A_PtrSize == 8){ ; 64-Bit AHK - DllFolder := RegRead64("HKEY_LOCAL_MACHINE", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{8E31F76F-74C3-47F1-9550-E041EEDC5FBB}_is1", "DllX64Location") + DllFolder .= "x64\" } else { ; 32-Bit AHK - DllFolder := RegRead64("HKEY_LOCAL_MACHINE", "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{8E31F76F-74C3-47F1-9550-E041EEDC5FBB}_is1", "DllX86Location") - } - - if (!DllFolder){ - ; Could not find registry entry. Advise vJoy update. - msgbox, 4, ERROR, % "A vJoy install was found in " vJoyFolder ", but it appears to be an old version.`nPlease update vJoy to the latest version from `n`nhttp://vjoystick.sourceforge.net.`n`nDo you wish to open a browser window to the site now?" - IfMsgBox, Yes - Run http://vjoystick.sourceforge.net - ExitApp + DllFolder .= "x86\" } - DllFolder .= "\" - DllFile := "vJoyInterface.dll" - x86 := "x86\" - x64 := "x64\" - ErrorReport := "Trying to locate correct " DllFile "...`nLooking in " DllFolder " ... " if (FileExist(DllFolder DllFile)){ ErrorReport .= "FOUND. Loading... " From d1e0186e35b0370e6925f55ff09fb31848b1e128 Mon Sep 17 00:00:00 2001 From: Nittai-Cohen-TAU Date: Sat, 19 Aug 2023 13:44:20 +0300 Subject: [PATCH 2/2] Added error message if DllFolder does not exist --- VJoy_lib.ahk | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/VJoy_lib.ahk b/VJoy_lib.ahk index 620001d..87aee90 100644 --- a/VJoy_lib.ahk +++ b/VJoy_lib.ahk @@ -24,6 +24,10 @@ HID_USAGE_SL1:= 0x37 VJDev := Object() + +IsDir(path) { + return InStr(FileExist(path), "D") +} ; Load lib from already load or current/system directory VJoy_LoadLibrary() { @@ -51,6 +55,14 @@ VJoy_LoadLibrary() { DllFolder .= "x86\" } + if (!IsDir(DllFolder)){ + ; Could not find registry entry. Advise vJoy update. + msgbox, 4, ERROR, % "A vJoy install was found in " vJoyFolder ", but it appears to be an old version.`nPlease update vJoy to the latest version from `n`nhttp://vjoystick.sourceforge.net.`n`nDo you wish to open a browser window to the site now?" + IfMsgBox, Yes + Run http://vjoystick.sourceforge.net + ExitApp + } + DllFile := "vJoyInterface.dll" ErrorReport := "Trying to locate correct " DllFile "...`nLooking in " DllFolder " ... "