Page 1 of 2

Remap joystick (axis) to turn around how to use

Posted: 24 May 2019, 03:53
by Ataricx
I am 49 years old and got used to holding an joystick upside down on an early age. Now i am playing games again with a snes controler (see picture)

I know, i better get use to the proper way, but i can't anymore, it's too much of an headach to learn, so i want to have an script which remaps the axis upside down in W10

I already got this script to remap the axis to do cursor keys, so i know it is possible

I will upload the picture just the way i want to use the joystick.

Code: Select all

#Persistent  ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
JoyX := GetKeyState("JoyX")  ; Get position of X axis.
JoyY := GetKeyState("JoyY")  ; Get position of Y axis.
KeyToHoldDownPrev := KeyToHoldDown  ; Prev now holds the key that was down before (if any).

if (JoyX > 70)
    KeyToHoldDown := "Left"
else if (JoyX < 30)
    KeyToHoldDown := "Right"
else if (JoyY > 70)
    KeyToHoldDown := "Up"
else if (JoyY < 30)
    KeyToHoldDown := "Down"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  ; The correct key is already down (or no key is needed).
    return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return

Re: Remap joystick (axis) to turn around how to use

Posted: 24 May 2019, 12:48
by Ataricx
so unlucky for me, this isnt possible?
nevertheless, thanx for reading :)

Re: Remap joystick (axis) to turn around how to use

Posted: 24 May 2019, 21:48
by A_AhkUser
Ataricx wrote:
24 May 2019, 03:53
I already got this script to remap the axis to do cursor keys, so i know it is possible
Hi Ataricx,

If I understand correctly, what you're trying to do is slightly different and more problematic: you're trying to remap or "send" as a joystick (correct me if I'm wrong).
If so, you might be interested in Trying to remap or "send" as a joystick?.

Re: Remap joystick (axis) to turn around how to use

Posted: 25 May 2019, 04:05
by Ataricx
Thank you for your reaction, i've tried the link out and downloaded the file, but mainly is for Xbox and the other (ucr) is much to complicated

I will explain more detailed.

On the 1st picture you'll see X-as and y-as, it's x-as is to the left middle but i want it to go to the right middle, so just the opposite
The same with the Y-as, when i press top, it will go to the top of the y-as box.

If i would succeed all the x-as and y-as are the opposite of where it should be in W10.

But in my case that is to be prefered because i got use to holding the gamepad upside down like i am used to since 1990... i tried to 'reprogram myself' but thats very difficult.

In picture 3 it shows how i wish to use the gamepad, but before i can, it must be remapped with just the x-as and y- as.

* I dont want to remap any keyboard or mouse to an button
* I dont want to remap any button, buttons are ok, no problem

Hopefully this is more clear now.. Maybe it can be done with the Registry, but i search on that through google and was unsuccesfull.

Re: Remap joystick (axis) to turn around how to use

Posted: 25 May 2019, 05:19
by Ataricx
Sorry about the confussion.. I've edited the picture and merged the 2 pictures together so it's more obvious hopefully...

Re: Remap joystick (axis) to turn around how to use

Posted: 25 May 2019, 17:11
by evilC
Recalibrate the joystick, but switch the directions ;)
If you have trouble doing it using the windows calibration tool, then use DIView
There is a slight bug in the DIView manual calibration, you cannot type in negative values. To work around it, copy the value to the clipboard and paste.

If you really want to do it using AHK...
As mentioned in the "Trying to remap" link, it is not possible to alter how windows sees a device using AHK - all you can do is spin up a virtual vJoy stick (See CvJoyInterface linked in that thread), and route all the input from the physical stick to the virtual stick

What's too complicated about UCR? It would be orders of magnitude simpler (Like less than an hour to get to grips with it) compared to coding the equivalent functionality in AHK. Even remapping an joystick button to a keyboard key in AHK is a pain in the arse, due to bugs in AHK that will never be fixed - 1Joy1::a does NOT properly remap joystick button 1 to a - it maps press of joystick button 1 to press *and release* of a - ie with that hotkey, you cannot hold the a key by holding joystick button 1

Re: Remap joystick (axis) to turn around how to use

Posted: 26 May 2019, 03:58
by Ataricx
I've tried DLview, but i dont understand how i should enter the values......

Thanks for the reply, i guess i am stuck with this and must adjust i to work with a gamepad

Re: Remap joystick (axis) to turn around how to use

Posted: 27 May 2019, 09:03
by scriptor2016
I have been working all weekend on getting a Nintendo Joy Con controller to work on my Windows7 system... all new territory for me. Happily, I have it working now. So I have a bit of practice with this joystick thing now.

Concerning your code, it might seem to easy, but it looks like all you have to do is swap the "Left" and "Right" words, and also swap the "Up" and "Down" words. Or I could be totally wrong in this particular case. But does this work?

Code: Select all

#Persistent  ; Keep this script running until the user explicitly exits it.
SetTimer, WatchAxis, 5
return

WatchAxis:
JoyX := GetKeyState("JoyX")  ; Get position of X axis.
JoyY := GetKeyState("JoyY")  ; Get position of Y axis.
KeyToHoldDownPrev := KeyToHoldDown  ; Prev now holds the key that was down before (if any).

if (JoyX > 70)
    KeyToHoldDown := "Right" ;this was originally "Left"
else if (JoyX < 30)
    KeyToHoldDown := "Left" ;this was originally "Right"
else if (JoyY > 70)
    KeyToHoldDown := "Down" ;this was originally "Up"
else if (JoyY < 30)
    KeyToHoldDown := "Up" ;this was originally "Down"
else
    KeyToHoldDown := ""

if (KeyToHoldDown = KeyToHoldDownPrev)  ; The correct key is already down (or no key is needed).
    return  ; Do nothing.

; Otherwise, release the previous key and press down the new key:
SetKeyDelay -1  ; Avoid delays between keystrokes.
if KeyToHoldDownPrev   ; There is a previous key to release.
    Send, {%KeyToHoldDownPrev% up}  ; Release it.
if KeyToHoldDown   ; There is a key to press down.
    Send, {%KeyToHoldDown% down}  ; Press it down.
return

Re: Remap joystick (axis) to turn around how to use

Posted: 27 May 2019, 12:24
by Ataricx
thanx @scriptor2016 but this only remaps keyboard keys to joystick, it doenst do anything with the joystick itself

Re: Remap joystick (axis) to turn around how to use

Posted: 28 May 2019, 10:54
by evilC
@Ataricx Swap the values for Min and Max
Min of 255, Max of 0

Re: Remap joystick (axis) to turn around how to use

Posted: 28 May 2019, 13:00
by Ataricx
just to make sure we talking about the same stuff, do you mean this program?

if i adjust the values the x as doesnt do anything anymore.

Re: Remap joystick (axis) to turn around how to use

Posted: 28 May 2019, 13:55
by evilC
Hmm, you appear to be right, it doesn't work, I swear I did it in the past...
Your only option then is to use vJoy and feed the vJoy stick with the inverse of the axes

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 03:49
by Ataricx
Thanx for your reaction Evilc

I downloaded vjoy but instantly got an install error on the end of the process bar...

i will search for an solution...

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 03:59
by Ataricx
i tried to install older versions, but with same result : failed to install on the end of installation process

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 04:05
by evilC
Are you on win 1809? There is an open issue for vJoy reporting install issues

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 05:56
by Ataricx
no 1903... i guess thats the problem...

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 05:58
by evilC
Oh sorry, yeah I think it is 1903 - the one that just came out

Re: Remap joystick (axis) to turn around how to use

Posted: 29 May 2019, 13:12
by Ataricx
np :)

the program got me into 'test mode' and i was supprised with an watermark on my desktop..... so better not install this on 1903

thanx anyway !

Re: Remap joystick (axis) to turn around how to use

Posted: 30 May 2019, 05:13
by evilC
Test mode ?!?! VJoy should be a signed driver, you should not need test mode. Where did you get it from? Be wary, it could be malicious

Re: Remap joystick (axis) to turn around how to use

Posted: 30 May 2019, 13:36
by Ataricx
That program did get me into test mode... i got it from the original site... i will try it in a few weeks, hopefully it will be updated then