Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed an issue where the library would fail to find the DLL #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions VJoy_lib.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -41,31 +45,26 @@ 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")
DllFolder .= "x86\"
}

if (!DllFolder){
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
}

DllFolder .= "\"

DllFile := "vJoyInterface.dll"

x86 := "x86\"
x64 := "x64\"

ErrorReport := "Trying to locate correct " DllFile "...`nLooking in " DllFolder " ... "
if (FileExist(DllFolder DllFile)){
ErrorReport .= "FOUND. Loading... "
Expand Down