Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

UJR - Universal Joystick Remapper (Using vJoy)


  • Please log in to reply
130 replies to this topic
twipley
  • Members
  • 11 posts
  • Last active: May 27 2015 09:04 PM
  • Joined: 26 Jan 2011

Hey evilc! I'm interested to know whether your software (UJR v6.3 under ADHD v2.1 over here) installs a low-level keyboard hook which would prevent any other AHK script making use of SendInput? or not?

 

I've started a thread just for that. (http://www.autohotke...d-mode-is-used/) Maybe you can help?



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005

Nope, UJR uses no hooks.

It shouldn't affect other AHK scripts as you can use different send modes etc in each script.

 

Out of interest, have you tried just using Send rather than SendInput?

 

Also, try running the other scripts as admin.



twipley
  • Members
  • 11 posts
  • Last active: May 27 2015 09:04 PM
  • Joined: 26 Jan 2011

Well, actually the inputs get sent by the other AHK scripts (through whichever send mode) . But, if UJR does use SendInput, then the command still would work in the other scripts, although in an impoverished manner; that is, being silently reverted to inferior send modes.

 

"If a script other than the one executing SendInput has a low-level keyboard hook installed, SendInput automatically reverts to SendEvent (or SendPlay if SendMode InputThenPlay is in effect). This is done because the presence of an external hook disables all of SendInput's advantages, making it inferior to both SendPlay and SendEvent. However, since SendInput is unable to detect a low-level hook in programs other than AutoHotkey v1.0.43+, it will not revert in these cases, making it less reliable than SendPlay/Event."

source: http://www.autohotke...SendInputDetail

 

a) so, you are saying UJR does not make use of SendInput? (in which case the command is left available to other scripts.)

 

b) if that is so, is there any reason the send mode in UJR is defaulted to SendEvent or something? I've read somewhere UJR does not really induce input lag (congratulations, by the way, for such an excellent program). But the AHK docs note that even SendPlay is considerably inferior in speed than the almost-instantaneous SendInput.



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005

AHK does not support joystick output (ie you cannot "move" a joystick using vanilla AHK), and UJR only uses joystick for output, so I can state with confidence that UJR does not use Send...

 

All output in UJR is via the vJoy API, which is nothing to do with AHK.

I have to use DLL calls to manipulate the joystick.

 

It does set SendMode Event though, dunno why that is in the code. Maybe that is what is breaking things for you?

I uploaded a test version without it, see if that helps you:

http://evilc.com/fil...oy/ujr_test.exe



twipley
  • Members
  • 11 posts
  • Last active: May 27 2015 09:04 PM
  • Joined: 26 Jan 2011

evilc, thanks for the hand!

 

I'll be having food for thought... :)



Motorsheep
  • Members
  • 2 posts
  • Last active: Jul 19 2015 06:52 PM
  • Joined: 21 Jan 2015

Hey...
first of all, thanks to the author for making this great tool. :)  
The option to combine two physical axes into one virtual one helped me heaps in War Thunder and FSX, and I've used UJR for quite a few other games, including Star Citizen and GTA V. 

Now, about buttons. I see that I can bind one physical button to any number of virtual buttons. However, I have the opposite problem: I need two buttons from a physical device to trigger the same virtual button, because Assetto Corsa's user interface has big shortcomings when it comes to input mapping. (No alternate buttons or axes? Please.)
Is there any way that UJR can do this?



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005

Not UJR, but if you are willing to edit a text file, you can use another project of mine called UJR Companion, that would let you set up shift states.

 

It's not very well documented though :(



Youda
  • New members
  • 1 posts
  • Last active: Aug 23 2015 03:54 PM
  • Joined: 23 Aug 2015

I have T.Flight Hotas X with USB conector, running Windows XP. When i unzip this app and run urj.exe i instantly get [VJoy_DeviceErr] Device 1 is not ready. Whether i click on OK or cross, it pops up again. None of the 16 Physical Stick IDs work. What should i do?



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005

Do you have vJoy installed?



revista
  • Members
  • 1 posts
  • Last active: Sep 03 2015 04:07 AM
  • Joined: 04 Aug 2014

Hey Evilc,

 

I've been following the topic for a while trying to solve a problem.......

 

I want to make my right trigger (physical joystick) to have a turbo function...

 

To do that, i've installed and configured vjoy and UJR, however, i'm having trouble to create the function on the script to do that.

 

I got DaoWace's code... (he managed to do what i'm trying) ... I've tried to understand it .. but i've failed.

 

this is the code i got (placed it bellow functions section inside ujr.ahk)

 

 

$Joy3::

loop
{
    GetKeyState, Joy3State, Joy3, P
    if (Joy3State = "U")
    {
        break
    }
    else
    {
        VJoy_SetBtn(1, 1, 3)
        sleep, 10
        VJoy_SetBtn(0, 1, 3)
        sleep, 30
    }
}

 

 

However, i want to do the turbo function with my right trigger (RT - that is read as Z axis of the joystick)

 

Can you help to do that ? 

 

Thanks.



evilc
  • Members
  • 340 posts
  • Last active: Oct 27 2015 11:07 PM
  • Joined: 17 Nov 2005
First off, when you say "Right Trigger",do you mean an XBOX joypad?
If so, bear in mind that UJR or AHK's normal joystick support cannot detect the right trigger independently of the left trigger on an XBOX pad.
To do that, you would need Lexikos' XInput library.

So you want to convert that script to be activated by the joystick Z axis of your joystick?

You need to know the ID of your stick. If you have vjoy installed, it will not be 1
Assuming your stick with the right trigger on it is ID 2, the code would be:
 
loop
{
    GetKeyState, TriggerState, 2JoyZ
    if (TriggerState > 60) ; you may need to change this to < 40 if left trigger activates instead
    {
        break
    }
    else
    {
        VJoy_SetBtn(1, 1, 3)
        sleep, 10
        VJoy_SetBtn(0, 1, 3)
        sleep, 30
    }
}