Code: Select all
; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
; Author: Helgef
; Date: 2016-08-14
; Description:
; Simple joystick simulator.
; The circle displayed on screen is a visual aid for the control.
; There are two circles, when the mouse is inside the inner circle
; the control does nothing, this corresponds to having the joystick
; in its default position
; The outer ring is divided into twelve (invisible) segments.
; Moving the mouse over each segment, triggers a different action, these are
; defined in the function: action()
;
; Notes:
; -#s (Winkey+s) toggles on/off.
; -#d move visual aid, if autoplaceVisualAid=0.
; -#q exit at any time.
;
; Url:
; https://autohotkey.com/boards/viewtopic.php?f=19&t=21489 - First released here.
; https://autohotkey.com/boards/viewtopic.php?f=19&t=20703&sid=2619d57dcbb0796e16ea172f238f08a0 - Original request by crisangelfan.
;
; Acknowledgements:
; crisangelfan and evilC on autohotkey.com forum provided useful input.
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
; Settings
CoordMode,Mouse,Screen
SetMouseDelay,-1
; On exit
OnExit("exitFunc")
toggle:=1 ; On/off parameter for the hotkey. Toggle 0 means controller is on. The placement of this variable is disturbing.
; Icon
Menu,Tray,NoStandard
try
Menu,Tray,Icon,ddores.dll,26
;Menu,Settings,openSettings
Menu,Tray,Add,About,aboutMenu
Menu,Tray,Add,Help,helpMenu
Menu,Tray,Add,Settings,openSettings
Menu,Tray,Add
Menu,Tray,Add,Reload,reloadMenu
Menu,Tray,Add,Exit,exitFunc
; If no settings file, create
IfNotExist, settings.ini
{
defaultSettings=
(
[Joystick>Keys]
upKey=w
downKey=s
leftKey=a
rightKey=d
LButtonReplacementKey=
RButtonReplacementKey=
[Joystick>Setup]
r=90
k=0.60
fallBackPause=125
[Visual aid]
autoplaceVisualAid=1
visualAidIsOn=1
hideCursor=1
[Hotkeys]
controllerSwitchKey=#s
exitKey=#q
moveAidKey=#d
[General]
gameExe=notepad.exe
firstRun=1
)
FileAppend,%defaultSettings%,settings.ini
}
; Read settings.
IniRead,allSections,settings.ini
Loop,Parse,allSections,`n
{
IniRead,pairs,settings.ini,%A_LoopField%
Loop,Parse,pairs,`n
{
StringSplit,keyValue,A_LoopField,=
%keyValue1%:=keyValue2
}
}
IfNotExist images\*.png
{
Msgbox,% 16, No images found., No image files were found, visual aid is disabled. Please place images in %A_ScriptDir%\images\
visualAidIsOn:=0
IniWrite,0,settings.ini,Visual aid,visualAidIsOn
}
; Constants and such. Some values are commented out because they have been stored in the settings.ini file instead, but are kept because they have comments.
kr:=21 ; Radius of the knob for the visual aid. Needs to match the actuall image, don't change if you don't change the image. (You can test smaller perhaps.)
vW:=202 ; Visual aid image width. Needs to match the actuall image, don't change if you don't change the image.
vH:=202 ; Visual aid image height. Both the inner circle and the outer ring is assumed to have the same dimensions.
pi:=3.1415 ; Approx pi.
dr:=0 ; Bounce back when hit outer circle edge, in pixels. (This might not work any more, it is off) Can be seen as a force feedback parameter, can be extended to depend on the over extension beyond the outer ring.
;r:=75 ; This is acts as a sensitivity parameter, where values closer to zero corresponds higher sensitivity, should not be less than one.
;k:=0.50 ; This parameter dictates the radius of the inner circle, inner=outer*k, k∈(0,1)
; Key set up
;controllerSwitchKey:="#s" ; Hotkey for toggling controller on/off
; Mouse button binds: ; Game does not receive mouse clicks when controller is on, bind to keyboard instead.
;LButtonReplacementKey:=""
;RButtonReplacementKey:=""
; Hotkey(s).
Hotkey,%controllerSwitchKey%,controllerSwitch, on
Hotkey,%exitKey%,exitFunc, on
Hotkey,%moveAidKey%,moveAid, on
;hideCursor:=1 ; Set to 1 to hide the cursor when controller is on.
;visualAidIsOn:=1 ; Set to 1 to show a visual aid for the controller.
;autoplaceVisualAid:=1 ; Automatically places visual aid outside game screen.
freq:=25 ; Controllers update frequency, in ms.
movingAid:=0 ; Track when visual aid is in move mode.
actionTaken:=0 ; For handling quick fall back to center. Needs to start at zero.
;fallBackPause:=125 ; Short mouse movement block after fall back. Set to zero to disable fallback
;gameExe:="notepad.exe" ; Game executable name, for activating the game and for sizing the gui overlay, when toggling on/off the controller.
keyNames:=[upKey, leftKey, downKey, rightKey] ; The order is important, corresponds to up/left/down/right on the "stick".
currentState:=[0,0,0,0] ; 0 means that the corresponding key in keyNames is up, 1 means down
segmentEndAngles:=Object() ; Each segment is defined by its angle, segment 1,...,12 -> end angle pi/6,pi/3,...,2*pi [rad]. (Unfortuantley its clockwise, with 0/2pi being at three o'clock)
Loop,12
segmentEndAngles[A_Index]:=pi/6*A_Index
; Display on screen visual aid for joystick control
if visualAidIsOn
{
; Visual aid gui, the center circle
; Calculate the position and dimension of the inner circle.
icX:=vW*(1-k)/2
icY:=vH*(1-k)/2
icW:=vW*k
Gui, VA: new
Gui, VA: +ToolWindow -Caption +AlwaysOnTop +HWNDva
Gui, VA: add, Picture, BackgroundTrans X0 Y0, images\outerRing.png
Gui, VA: add, Picture, BackgroundTrans X%icX% Y%icY% W%icW% H-1 hwndIC, images\innerCircle.png
Gui, VA: Color, FFFFFF
; Visual aid gui, the knob.
kd:=kr*2 ; Knob diameter.
Gui, VAknob: new
Gui, VAknob: +ToolWindow -Caption +AlwaysOnTop +HWNDknob
Gui, VAknob: add, Picture,X0 Y0 W%kd% H-1, images\knob.png
Gui, VAknob: Color, FFFFFF
}
; Transparent window that covers game scren to prevent game from capture the mouse.
Gui, Controller: New
Gui, Controller: +ToolWindow -Caption +AlwaysOnTop +HWNDstick
Gui, Controller: Color, FFFFFF
; Spam user with useless info, first time script runs.
if (firstRun && gameExe="notepad.exe")
{
MsgBox,64,gameExe not set.,The game executable name is notepad.exe by default.`nYou can try the controller by opening notepad.exe and press Winkey+s.
IniWrite,0,settings.ini,General,firstRun
}
mouseBlockIsOn:=0
return
; End autoexec.
moveAid:
if (autoplaceVisualAid || !toggle)
return
movingAid:=!movingAid
if movingAid
{
Gui, VA: show
WinSet, Style, +0xC00000, ahk_id %va%
}
else
{
WinSet, Style, -0xC00000, ahk_id %va%
Gui, VA: show, hide
}
return
vaGuiClose:
WinSet, Style, -0xC00000, ahk_id %va% ; In case user closes va-gui when caption is on.
Gui, VA: show, hide
movingAid:=0
return
reloadMenu:
reload
return
aboutMenu:
Msgbox,32,About, Author: Helgef`nVersion 1.0 2016-08-14
return
helpMenu:
Msgbox,% 4+ 32 , Open help in browser?, Visit autohotkey.com forum for help? Opens link in default browser.
IfMsgBox Yes
Run, https://autohotkey.com/boards/viewtopic.php?f=19&t=21489
return
; Hotkey labels
controllerSwitch:
if movingAid ; Handle when controller is switched while visual aid is in move mode.
return
if toggle ; Starting controller
{
WinActivate,ahk_exe %gameExe%
WinWaitActive, ahk_exe %gameExe%,,2
if ErrorLevel
{
MsgBox,16,Error, %gameExe% not activated.
return
}
DllCall("User32.dll\ReleaseCapture") ; Release mouse capture from game.
WinGetPos,gameX,gameY,gameW,gameH,ahk_exe %gameExe% ; Get game screen position and dimensions
if visualAidIsOn ; Show and place visual aid.
{
if autoplaceVisualAid
{
vY:=gameY+gameH/2-vH/2
rightBoundExceeded:=gameX+gameW+vW+kr>A_ScreenWidth
leftBoundExceeded:=gameX-vW-kr<0
if rightBoundExceeded && leftBoundExceeded
vX:=kr,vY:=kr
else if rightBoundExceeded
vX:=gameX-vW-kr
else
vX:=gameX+gameW+kr
Gui, VA: Show, X%vX% Y%vY% w%vW% h%vH% NA,Visual aid for controller. ; Show visual aid outside bottom right corner of game screen
}
else
{
Gui, VA: Show, w%vW% h%vH% NA,Visual aid for controller. ; Show visual aid at last position
}
WinSet,TransColor, FFFFFF, ahk_id %va%
if !autoplaceVisualAid
WinGetPos,vX,vY,,,ahk_id %va% ; Get position and calculate it's center.
vOX:=round(vX+vW/2)
vOY:=round(vY+vH/2)
Gui, VAknob: Show,% "NA X" vOX-kr " Y" vOY-kr " W41 H41",Controller knob ; Show visual aid, kr is the knob radius
WinSet,TransColor, FFFFFF, ahk_id %knob%
}
; Controller origin is center of game screen. (This is not the visual aid)
OX:=gameX+gameW/2
OY:=gameY+gameH/2
Gui, Controller: Show,NA x%gameX% y%gameY% w%gameW% h%gameH%,Controller
MouseMove,OX,OY ; Move mouse to controller origin
WinSet,Transparent,1,ahk_id %stick% ; Make transparent.
DllCall("User32.dll\SetCapture", "Uint", stick) ; Let the controller capture the mouse.
if hideCursor
DllCall("User32.dll\ShowCursor", "Int", 0)
SetTimer,mouse2joystick,%freq%
}
else ; Shutting down controller
{
SetTimer,mouse2joystick,Off
if hideCursor
DllCall("User32.dll\ShowCursor", "Int", 1) ; No need to show cursor if not hidden.
if visualAidIsOn
{
WinHide, ahk_id %knob%
WinHide, ahk_id %va%
}
DllCall("User32.dll\ReleaseCapture") ; This might be unnecessary
WinHide, ahk_id %stick%
changeStateTo([0,0,0,0]) ; All keys up.
}
toggle:=!toggle
return
; Game does not receive mouse clicks when controller is on, bind to keyboard instead.
#if !toggle
LButton::
if LButtonReplacementKey
Send,{%LButtonReplacementKey% down}
return
LButton Up::
if LButtonReplacementKey
Send,{%LButtonReplacementKey% up}
return
RButton::
if RButtonReplacementKey
Send,{%RButtonReplacementKey% down}
return
RButton Up::
if RButtonReplacementKey
Send,{%RButtonReplacementKey% up}
return
#if
; Labels
mouse2joystick:
mouse2joystick(r,dr,OX,OY,vOX,vOY,kr)
return
; Functions
mouse2joystick(r,dr,OX,OY,vOX,vOY,kr)
{
; r is the radius of the outer circle.
; dr is a bounce back parameter.
; OX is the x coord of circle center.
; OY is the y coord of circle center.
; vOX is the x coord of the visual aid origin.
; vOY is the y coord of the visual aid origin.
; kr is the knob radius.
global actionTaken, fallBackPause, visualAidIsOn, knob, vW, vH,k, mouseBlockIsOn
if mouseBlockIsOn
return
MouseGetPos,X,Y
X-=OX ; Move to controller coord system.
Y-=OY
RR:=sqrt(X**2+Y**2)
if (RR>r) ; Check if outside controller circle.
{
X:=round(X*(r-dr)/RR)
Y:=round(Y*(r-dr)/RR)
MouseMove,X+OX,Y+OY ; Calculate point on controller circle, move back to screen/window coords, and move mouse.
}
if visualAidIsOn
{
; Map controller coords to visual aid coord system
kX:=round(vOX+X/r*vW/2-kr)
kY:=round(vOY+Y/r*vH/2-kr)
SetWinDelay,-1
WinMove,ahk_id %knob%,, kX,kY ; Move the knob.
}
if (RR>k*r) ; Check if outside inner circle.
{
; Calculate segement
phi:=getAngle(X,Y)
seg:=getSegment(phi)
; Call action function.
action(seg)
actionTaken:=1 ; This will enable fall back to center when leaving outer circle.
}
else
{
changeStateTo([0,0,0,0]) ; All keys up.
if (fallBackPause!=-1 && actionTaken=1)
{
MouseMove,OX,OY ; User has moved back to inner circle, fall back to center.
if visualAidIsOn
{
kX:=vOX-kr
kY:=vOY-kr
WinMove,ahk_id %knob%,, kX,kY ; Move the knob.
}
mouseBlock() ; Short mouse movmement block after fallback.
actionTaken:=0 ; This will enable leaving the inner circle again.
}
}
}
action(seg)
{
; 1 is down, 0 is up newState:=[w a s d]
if (seg=1 || seg=12) ; Keys down:
changeStateTo([0,0,0,1]) ; d
else if (seg=2)
changeStateTo([0,0,1,1]) ; s+d
else if (seg=3 || seg= 4)
changeStateTo([0,0,1,0]) ; s
else if (seg=5)
changeStateTo([0,1,1,0]) ; a+s
else if (seg=6 || seg=7)
changeStateTo([0,1,0,0]) ; a
else if (seg=8)
changeStateTo([1,1,0,0]) ; w+a
else if (seg=9 || seg=10)
changeStateTo([1,0,0,0]) ; w
else if (seg=11)
changeStateTo([1,0,0,1]) ; d+w
else
return -1 ; error
return
}
changeStateTo(newState)
{
global keyNames, currentState
Loop, 4
if newState[A_Index]!=currentState[A_Index]
Send,% "{" . keyNames[A_Index] . (newState[A_Index] ? " Down}" : " Up}")
currentState:=newState
return
}
getSegment(phi)
{
global segmentEndAngles
Loop 12
if(phi<segmentEndAngles[A_Index])
return A_Index
return -1 ; error
}
getAngle(x,y)
{
global pi
if (x=0)
return 3*pi/2-(y>0)*pi
phi:=atan(y/x)
if (x<0 && y>0)
return phi+pi
if (x<0 && y<=0)
return phi+pi
if (x>0 && y<0)
return phi+2*pi
return phi
}
mouseBlock()
{
global fallBackPause
BlockInput, MouseMove
Sleep, %fallBackPause%
BlockInput, MouseMoveOff
}
exitFunc()
{
changeStateTo([0,0,0,0])
BlockInput, MouseMoveOff
DllCall("User32.dll\ShowCursor", "Int", 1)
ExitApp
}
;
; End Script.
; Start settings.
; This is auto generated.
;
openSettings:
Gui, Main: Destroy ; Ops
hideShow=0
win_name:="Settings"
submitOnlyOne:=0
OX_client:=180
OY_client:=25
GoSub,readTreeString
Gui, Main: -Resize
GUI, Main: add, text, x10 , Options:
Gui, Main: Add, TreeView, vMainTreeVar r14 w150 gTreeClick
Gui, Main: Add, GroupBox, W260 H250 X+10 yp-14 vboxName
Gui, Main: Add, button, x10 w100 gmainOk ,Ok
GUI, Main: Add, StatusBar
SB_SetParts(150,50)
GoSub,guiCode
GUI, Main:+HwndMAIN_HWND
Gui, Main: Show,, Mouse2Joystick settings
Main_WinTitle=ahk_id %MAIN_HWND%
GuiControl, -Redraw, Main
Gui, Main: default
TV_LoadTree(tree)
GuiControl, +Redraw, Main
return
TreeClick:
lastSection:=section
if A_GuiEvent = S
selection:=A_EventInfo
section:=selectionPath(selection)
SB_SetText("You are in: " . section,1)
TV_GetText(nodeName,selection)
GuiControl,,boxName,%nodeName%
if (IsLabel(lastSection))
{
hideShow=0
Gosub,%lastSection%
}
section:=RegExReplace(section,"[ ]+","_")
if (IsLabel(section))
{
hideShow=1
Gosub,%section%
hideShow=0
}
return
mainOk:
Gui, Main: Submit
Gosub, SubmitAll
; Read settings.
IniRead,allSections,settings.ini
Loop,Parse,allSections,`n
{
IniRead,pairs,settings.ini,%A_LoopField%
Loop,Parse,pairs,`n
{
StringSplit,keyValue,A_LoopField,=
%keyValue1%:=keyValue2
}
}
IfNotExist images\*.png
{
Msgbox,% 16, No images found., No image files were found, visual aid is disabled. Please place images in %A_ScriptDir%\images\
visualAidIsOn:=0
IniWrite,0,settings.ini,Visual aid,visualAidIsOn
}
if visualAidIsOn
{
; Remake va.
Gui, VA: destroy
icX:=vW*(1-k)/2
icY:=vH*(1-k)/2
icW:=vW*k
Gui, VA: new
Gui, VA: +ToolWindow -Caption +AlwaysOnTop +HWNDva
Gui, VA: add, Picture, BackgroundTrans X0 Y0, images\outerRing.png
Gui, VA: add, Picture, BackgroundTrans X%icX% Y%icY% W%icW% H-1 hwndIC, images\innerCircle.png
Gui, VA: Color, FFFFFF
}
return
guiCode:
Text=
(
There is no input verification.
Follow instructions and don't try to break it.
)
Gui, Main: add, Text,Hidden vtext587566698 X180 Y25,%Text%
Text=
Iniread,master_var,settings.ini,Joystick>Keys,upKey
hotkey940848461_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey940848461 X285 Y30 W75,% RegExReplace(master_var,"#")
Iniread,master_var,settings.ini,Joystick>Keys,downKey
hotkey291587116_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey291587116 X285 Y55 W75,% RegExReplace(master_var,"#")
Iniread,master_var,settings.ini,Joystick>Keys,leftKey
hotkey264694416_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey264694416 X285 Y105 W75,% RegExReplace(master_var,"#")
Iniread,master_var,settings.ini,Joystick>Keys,rightKey
hotkey1029721995_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey1029721995 X285 Y80 W75,% RegExReplace(master_var,"#")
Iniread,master_var,settings.ini,Joystick>Keys,LButtonReplacementKey
hotkey1773620668_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey1773620668 X285 Y165 W75,% RegExReplace(master_var,"#")
Iniread,master_var,settings.ini,Joystick>Keys,RButtonReplacementKey
hotkey2116015994_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden Limit190 vhotkey2116015994 X285 Y195 W75,% RegExReplace(master_var,"#")
Text=
(
Up
)
Gui, Main: add, Text,Hidden vtext1031928077 X180 Y35,%Text%
Text=
Text=
(
Down
)
Gui, Main: add, Text,Hidden vtext1746398942 X180 Y60,%Text%
Text=
Text=
(
Left
)
Gui, Main: add, Text,Hidden vtext1432110660 X180 Y110,%Text%
Text=
Text=
(
Right
)
Gui, Main: add, Text,Hidden vtext243103111 X180 Y85,%Text%
Text=
Text=
(
Left mouse button
)
Gui, Main: add, Text,Hidden vtext1568329861 X180 Y170,%Text%
Text=
Text=
(
Right mouse button
)
Gui, Main: add, Text,Hidden vtext2021300023 X180 Y200,%Text%
Text=
Iniread,editText,settings.ini,Joystick>Setup,r
editText:=RegExReplace(editText,"DELIM_\|_ITER","`n")
Gui, Main: add, Edit,Hidden Number Limit5 vedit499657353 X295 Y25 r1 w50,%editText%
editText=
Iniread,editText,settings.ini,Joystick>Setup,k
editText:=RegExReplace(editText,"DELIM_\|_ITER","`n")
Gui, Main: add, Edit,Hidden vedit2087193758 X295 Y95 r1 w50,%editText%
editText=
Iniread,editText,settings.ini,Joystick>Setup,fallBackPause
editText:=RegExReplace(editText,"DELIM_\|_ITER","`n")
Gui, Main: add, Edit,Hidden vedit11561765 X295 Y150 r1 w50,%editText%
editText=
Text=
(
Sensitivity
)
Gui, Main: add, Text,Hidden vtext2067661602 X180 Y30,%Text%
Text=
Text=
(
Lower values corresponds to higher sensitivity.
Do not set below 1.
)
Gui, Main: add, Text,Hidden vtext1662187617 X180 Y55,%Text%
Text=
Text=
(
Radius of inner circle:
)
Gui, Main: add, Text,Hidden vtext336372104 X180 Y100,%Text%
Text=
Text=
(
Range: (0,1)
)
Gui, Main: add, Text,Hidden vtext599329820 X355 Y100,%Text%
Text=
Text=
(
Fallback pause:
)
Gui, Main: add, Text,Hidden vtext588619596 X180 Y155,%Text%
Text=
Text=
(
ms.
)
Gui, Main: add, Text,Hidden vtext388013707 X355 Y155,%Text%
Text=
Text=
(
A short mouse block is done when falling
back to center, set to -1 to disable the fallback.
)
Gui, Main: add, Text,Hidden vtext127411773 X180 Y180,%Text%
Text=
Iniread,master_var,settings.ini,Visual aid,autoplaceVisualAid
boxName=
(
Automatic placement
)
checkMe:=(master_var="1" ) ? 1:(master_var="0" ? 0:-1)
Gui, Main: add, Checkbox, Hidden Checked%checkMe% vcheckbox12949562 X180 Y80,%boxName%
boxName=
Iniread,master_var,settings.ini,Visual aid,visualAidIsOn
boxName=
(
Enable visual aid
)
checkMe:=(master_var="1" ) ? 1:(master_var="0" ? 0:-1)
Gui, Main: add, Checkbox, Hidden Checked%checkMe% vcheckbox721857143 X180 Y55,%boxName%
boxName=
Iniread,master_var,settings.ini,Visual aid,hideCursor
boxName=
(
Hide mouse cursor
)
checkMe:=(master_var="1" ) ? 1:(master_var="0" ? 0:-1)
Gui, Main: add, Checkbox, Hidden Checked%checkMe% vcheckbox19307098 X180 Y30,%boxName%
boxName=
Iniread,master_var,settings.ini,Hotkeys,controllerSwitchKey
hotkey1030086486_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden 0 vhotkey1030086486 X180 Y115 W150,% RegExReplace(master_var,"#")
checkMe:=RegExMatch(master_var,"#") ? 1:0
Gui, Main: add, CheckBox, Hidden vhotkey1030086486_addWinkey checked%checkMe%,Use modifer: Winkey
Iniread,master_var,settings.ini,Hotkeys,exitKey
hotkey1089061737_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden 0 vhotkey1089061737 X180 Y45 W150,% RegExReplace(master_var,"#")
checkMe:=RegExMatch(master_var,"#") ? 1:0
Gui, Main: add, CheckBox, Hidden vhotkey1089061737_addWinkey checked%checkMe%,Use modifer: Winkey
Iniread,master_var,settings.ini,Hotkeys,moveAidKey
hotkey1467808675_oldkey:=master_var
Gui, Main: add, Hotkey, Hidden 0 vhotkey1467808675 X180 Y185 W150,% RegExReplace(master_var,"#")
checkMe:=RegExMatch(master_var,"#") ? 1:0
Gui, Main: add, CheckBox, Hidden vhotkey1467808675_addWinkey checked%checkMe%,Use modifer: Winkey
Text=
(
Toggle the joystick on and off:
)
Gui, Main: add, Text,Hidden vtext141512981 X180 Y95,%Text%
Text=
Text=
(
Quit application:
)
Gui, Main: add, Text,Hidden vtext1592254653 X180 Y25,%Text%
Text=
Text=
(
Enable/disable movement of visual aid:
)
Gui, Main: add, Text,Hidden vtext1065676017 X180 Y165,%Text%
Text=
Iniread,editText,settings.ini,General,gameExe
editText:=RegExReplace(editText,"DELIM_\|_ITER","`n")
Gui, Main: add, Edit,Hidden vedit73227190 X275 Y30 r1 w100,%editText%
editText=
Text=
(
Game executable:
)
Gui, Main: add, Text,Hidden vtext1961899057 X180 Y33,%Text%
Text=
return
SubmitAll:
submit_Joystick:
if submitOnlyOne
return
submit_Joystick>Keys:
hotkey940848461:=RegExReplace(hotkey940848461,"[!^+]+")
hotkey940848461:=hotkey940848461_addWinkey ? "#" . hotkey940848461:hotkey940848461
IniWrite,%hotkey940848461%, settings.ini, Joystick>Keys, upKey
hotkey291587116:=RegExReplace(hotkey291587116,"[!^+]+")
hotkey291587116:=hotkey291587116_addWinkey ? "#" . hotkey291587116:hotkey291587116
IniWrite,%hotkey291587116%, settings.ini, Joystick>Keys, downKey
hotkey264694416:=RegExReplace(hotkey264694416,"[!^+]+")
hotkey264694416:=hotkey264694416_addWinkey ? "#" . hotkey264694416:hotkey264694416
IniWrite,%hotkey264694416%, settings.ini, Joystick>Keys, leftKey
hotkey1029721995:=RegExReplace(hotkey1029721995,"[!^+]+")
hotkey1029721995:=hotkey1029721995_addWinkey ? "#" . hotkey1029721995:hotkey1029721995
IniWrite,%hotkey1029721995%, settings.ini, Joystick>Keys, rightKey
hotkey1773620668:=RegExReplace(hotkey1773620668,"[!^+]+")
hotkey1773620668:=hotkey1773620668_addWinkey ? "#" . hotkey1773620668:hotkey1773620668
IniWrite,%hotkey1773620668%, settings.ini, Joystick>Keys, LButtonReplacementKey
hotkey2116015994:=RegExReplace(hotkey2116015994,"[!^+]+")
hotkey2116015994:=hotkey2116015994_addWinkey ? "#" . hotkey2116015994:hotkey2116015994
IniWrite,%hotkey2116015994%, settings.ini, Joystick>Keys, RButtonReplacementKey
if submitOnlyOne
return
submit_Joystick>Setup:
edit499657353:=RegExReplace(edit499657353,"`n","DELIM_|_ITER")
IniWrite,%edit499657353%, settings.ini, Joystick>Setup, r
edit2087193758:=RegExReplace(edit2087193758,"`n","DELIM_|_ITER")
IniWrite,%edit2087193758%, settings.ini, Joystick>Setup, k
edit11561765:=RegExReplace(edit11561765,"`n","DELIM_|_ITER")
IniWrite,%edit11561765%, settings.ini, Joystick>Setup, fallBackPause
if submitOnlyOne
return
submit_Visual_aid:
writeVal:=(checkbox12949562=1) ? "1" : "0"
IniWrite,%writeVal%, settings.ini, Visual aid, autoplaceVisualAid
writeVal:=(checkbox721857143=1) ? "1" : "0"
IniWrite,%writeVal%, settings.ini, Visual aid, visualAidIsOn
writeVal:=(checkbox19307098=1) ? "1" : "0"
IniWrite,%writeVal%, settings.ini, Visual aid, hideCursor
if submitOnlyOne
return
submit_Hotkeys:
hotkey1030086486:=hotkey1030086486_addWinkey ? "#" . hotkey1030086486:hotkey1030086486
IniWrite,%hotkey1030086486%, settings.ini, Hotkeys, controllerSwitchKey
hotkey1089061737:=hotkey1089061737_addWinkey ? "#" . hotkey1089061737:hotkey1089061737
IniWrite,%hotkey1089061737%, settings.ini, Hotkeys, exitKey
hotkey1467808675:=hotkey1467808675_addWinkey ? "#" . hotkey1467808675:hotkey1467808675
IniWrite,%hotkey1467808675%, settings.ini, Hotkeys, moveAidKey
if submitOnlyOne
return
submit_General:
edit73227190:=RegExReplace(edit73227190,"`n","DELIM_|_ITER")
IniWrite,%edit73227190%, settings.ini, General, gameExe
if submitOnlyOne
return
return
Joystick:
/*
There is no input verification.
Follow instructions and don't try to break it.
*/
GuiControl, Main: Show%hideShow%, text587566698
return
Joystick>Keys:
GuiControl, Main: Show%hideShow%, hotkey940848461
GuiControl, Main: Enable%hideShow%, hotkey940848461
GuiControl, Main: Show%hideShow%, hotkey940848461_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey940848461_addWinkey
GuiControl, Main: Show%hideShow%, hotkey291587116
GuiControl, Main: Enable%hideShow%, hotkey291587116
GuiControl, Main: Show%hideShow%, hotkey291587116_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey291587116_addWinkey
GuiControl, Main: Show%hideShow%, hotkey264694416
GuiControl, Main: Enable%hideShow%, hotkey264694416
GuiControl, Main: Show%hideShow%, hotkey264694416_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey264694416_addWinkey
GuiControl, Main: Show%hideShow%, hotkey1029721995
GuiControl, Main: Enable%hideShow%, hotkey1029721995
GuiControl, Main: Show%hideShow%, hotkey1029721995_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey1029721995_addWinkey
GuiControl, Main: Show%hideShow%, hotkey1773620668
GuiControl, Main: Enable%hideShow%, hotkey1773620668
GuiControl, Main: Show%hideShow%, hotkey1773620668_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey1773620668_addWinkey
GuiControl, Main: Show%hideShow%, hotkey2116015994
GuiControl, Main: Enable%hideShow%, hotkey2116015994
GuiControl, Main: Show%hideShow%, hotkey2116015994_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey2116015994_addWinkey
/*
Up
*/
GuiControl, Main: Show%hideShow%, text1031928077
/*
Down
*/
GuiControl, Main: Show%hideShow%, text1746398942
/*
Left
*/
GuiControl, Main: Show%hideShow%, text1432110660
/*
Right
*/
GuiControl, Main: Show%hideShow%, text243103111
/*
Left mouse button
*/
GuiControl, Main: Show%hideShow%, text1568329861
/*
Right mouse button
*/
GuiControl, Main: Show%hideShow%, text2021300023
return
Joystick>Setup:
GuiControl, Main: Show%hideShow%, edit499657353
GuiControl, Main: Enable%hideShow%, edit499657353
GuiControl, Main: Show%hideShow%, edit2087193758
GuiControl, Main: Enable%hideShow%, edit2087193758
GuiControl, Main: Show%hideShow%, edit11561765
GuiControl, Main: Enable%hideShow%, edit11561765
/*
Sensitivity
*/
GuiControl, Main: Show%hideShow%, text2067661602
/*
Lower values corresponds to higher sensitivity.
Do not set below 1.
*/
GuiControl, Main: Show%hideShow%, text1662187617
/*
Radius of inner circle:
*/
GuiControl, Main: Show%hideShow%, text336372104
/*
Range: (0,1)
*/
GuiControl, Main: Show%hideShow%, text599329820
/*
Fallback pause:
*/
GuiControl, Main: Show%hideShow%, text588619596
/*
ms.
*/
GuiControl, Main: Show%hideShow%, text388013707
/*
A short mouse block is done when falling
back to center, set to -1 to disable the fallback.
*/
GuiControl, Main: Show%hideShow%, text127411773
return
Visual_aid:
GuiControl, Main: Show%hideShow%, checkbox12949562
GuiControl, Main: Enable%hideShow%, checkbox12949562
GuiControl, Main: Show%hideShow%, checkbox721857143
GuiControl, Main: Enable%hideShow%, checkbox721857143
GuiControl, Main: Show%hideShow%, checkbox19307098
GuiControl, Main: Enable%hideShow%, checkbox19307098
return
Hotkeys:
GuiControl, Main: Show%hideShow%, hotkey1030086486
GuiControl, Main: Enable%hideShow%, hotkey1030086486
GuiControl, Main: Show%hideShow%, hotkey1030086486_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey1030086486_addWinkey
GuiControl, Main: Show%hideShow%, hotkey1089061737
GuiControl, Main: Enable%hideShow%, hotkey1089061737
GuiControl, Main: Show%hideShow%, hotkey1089061737_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey1089061737_addWinkey
GuiControl, Main: Show%hideShow%, hotkey1467808675
GuiControl, Main: Enable%hideShow%, hotkey1467808675
GuiControl, Main: Show%hideShow%, hotkey1467808675_addWinkey
GuiControl, Main: Enable%hideShow%, hotkey1467808675_addWinkey
/*
Toggle the joystick on and off:
*/
GuiControl, Main: Show%hideShow%, text141512981
/*
Quit application:
*/
GuiControl, Main: Show%hideShow%, text1592254653
/*
Enable/disable movement of visual aid:
*/
GuiControl, Main: Show%hideShow%, text1065676017
return
General:
GuiControl, Main: Show%hideShow%, edit73227190
GuiControl, Main: Enable%hideShow%, edit73227190
/*
Game executable:
*/
GuiControl, Main: Show%hideShow%, text1961899057
return
TV_LoadTree(tree)
{
Loop, Parse, tree,`n,`r
{
node=%A_LoopField%
Loop, Parse, node,;
head%A_Index%:=A_LoopField
break
}
if !head2
return
parentID:=TV_Add(head2,,"+expand")
load(head4,parentID)
parentID:=TV_GetParent(parentID)
load(head3,parentID)
return
}
load(relativeID,parentID)
{
nextSibling=
nextChild=
nodeName=
getNode(nextSibling,nextChild,nodeName,relativeID)
if nodeName
parentID:=TV_Add(nodeName,parentID,"+expand")
if nextChild
{
load(nextChild,parentID)
}
if nextSibling
{
parentID:=TV_GetParent(parentID)
load(nextSibling,parentID)
}
return
}
getNode(ByRef sibling, ByRef child, ByRef nodeName, nodeID)
{
global tree
firstLoop:=1
Loop, Parse, tree,`n,`r
{
if firstLoop
{
firstLoop:=0
continue
}
node:=A_LoopField
Loop, Parse, node,;
{
id:=A_LoopField
break
}
if (id=nodeID)
{
Loop, Parse, node,;
node%A_Index%:=A_LoopField
break
}
}
nodeName:=node2
sibling:=node3
child:=node4
return
}
selectionPath(id)
{
TV_GetText(name,id)
if !name
return 0
parentID := id
Loop
{
parentID := TV_GetParent(parentID)
if !parentID
break
parentName=
TV_GetText(parentName, parentID)
if parentName
name = %parentName%>%name%
}
return name
}
readTreeString: ; These are not comments, don't remove.
tree=
(
38692480;Joystick;38692768;38692576
38692576;Keys;38692672;0
38692672;Setup;0;0
38692768;Visual aid;38692864;0
38692864;Hotkeys;38693248;0
38693248;General;0;0
)
return