All pastes #736752 Raw Edit

ps2convfix.ahk

public text v1 · immutable
·published 2007-10-14 20:05 UTC
rendered paste body
#Persistent
SetTimer, WatchAxis, 1
return

WatchAxis:
GetKeyState, JoyX, JoyX
GetKeyState, JoyY, JoyY
UpKeyPrev = %UpKey%
DownKeyPrev = %DownKey%
LeftKeyPrev = %LeftKey%
RightKeyPrev = %RightKey%

if JoyY = 0.000000
{
  UpKey = 1
  DownKey = 0
}
else if JoyY = 100.000000
{
  UpKey = 0
  DownKey = 1
}
else if JoyY = 49.608606
{
  UpKey = 0
  DownKey = 0
}
else if JoyY = 49.999237
{
  UpKey = 1
  DownKey = 1
}

if JoyX = 0.000000
{
  LeftKey = 1
  RightKey = 0
}
else if JoyX = 100.000000
{
  LeftKey = 0
  RightKey = 1
}
else if JoyX = 49.608606
{
  LeftKey = 0
  RightKey = 0
}
else if JoyX = 49.999237
{
  LeftKey = 1
  RightKey = 1
}

SetKeyDelay -1

if LeftKey <> %LeftKeyPrev%
{
  if LeftKey = 1
    Send, {Left down}
  else
    Send, {Left up}
}

if RightKey <> %RightKeyPrev%
{
  if RightKey = 1
    Send, {Right down}
  else
    Send, {Right up}
}

if UpKey <> %UpKeyPrev%
{
  if UpKey = 1
    Send, {Up down}
  else
    Send, {Up up}
}

if DownKey <> %DownKeyPrev%
{
  if DownKey = 1
    Send, {Down down}
  else
    Send, {Down up}
}

return