Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; This is automatically generated file by XIM Link
  2. ; XIL Version=1,ForceOverwrite=False
  3. SetWorkingDir %A_AppData%\XIM Link\ScriptAdditionals\
  4.  
  5. #SingleInstance force
  6. #UseHook On
  7. Suspend On
  8.  
  9.  
  10. if (A_PtrSize = 8)
  11.     global XIL_libFile := "AhkLink64"
  12. else
  13. if (A_PtrSize = 4)
  14.     global XIL_libFile := "AhkLink"
  15. global XIL_libFileModule := DllCall("LoadLibrary", "Str", XIL_libFile)
  16.  
  17. OnExit("ExitCleanup")
  18. ExitCleanup(ExitReason, ExitCode)
  19. {
  20.   DllCall("FreeLibrary", "Ptr", XIL_libFileModule)
  21.   return 0
  22. }
  23.  
  24. XIL_HostHandle = %1%
  25. DetectHiddenWindows, on
  26. XIL_ScriptHandle := WinExist("ahk_pid" DllCall("GetCurrentProcessId")) + 0
  27.  
  28. XIL_ProcessID := 0
  29. WinGet, XIL_ProcessID, PID
  30. XIL_ProcessID := XIL_ProcessID + 0
  31.  
  32.  
  33. DllCall( XIL_libFile "\CopyDataCallback", "Int", XIL_HostHandle, "Int", XIL_ScriptHandle, "Int", XIL_ProcessID)
  34.  
  35. OnMessage(WM_COPYDATA:=74, "WMCopyData")
  36. WMCopyData(wParam, lParam, msg, hWnd)
  37. {
  38.   local XIL_ret := DllCall( XIL_libFile "\CopyDataParsing", "UInt", hWnd, "Uint", msg, "UInt", wParam, "UInt", lParam)
  39.   if (XIL_ret = 1)
  40.     Suspend On
  41.   if (XIL_ret = 2)
  42.     Suspend Off
  43.   if (XIL_ret = 3)
  44.     Reload
  45.     return
  46. }
  47.  
  48. XIMInputData(Function, Value1, Value2 := "null")
  49. {
  50.   global XIL_HostHandle  
  51.   global XIL_ScriptHandle
  52.   if (Function = "LeftStickDirectional" || Function = "RightStickDirectional")
  53.   {
  54.     if (Value2 = "null")
  55.     {
  56.       Value2 := 100.0
  57.     }
  58.     if (Value1 < 0)
  59.     {
  60.       Value1 := 0
  61.       Value2 := 0
  62.     }
  63.   }
  64.   DllCall( XIL_libFile "\DataInput", "Int", XIL_HostHandle, "Int", XIL_ScriptHandle, "Str", Function, "Double", Value1, "Double", Value2)
  65. }
  66.  
  67. SetWorkingDir %A_ScriptDir%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement