Universal Control Remapper (UCR) - v0.1.22 28th Oct 2018

Post gaming related scripts
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 05:20

If memory serves, what is going on is this:
Joystick POV directions are handled by GetKeyState(), so I had to build my own arrays to hold what happened for any given direction, so I went the extra mile and made it work with multiple bindings per POV direction.
Joystick buttons are handled by hotkey (ie a mapping to 1Joy3::). There can only be one of these per "thread" and seeing as both plugins are in the same profile, they use the same input thread. Seeing as the hotkey system ties a button to a boundfunc, I did not have to build custom arrays to handle this like for hat directions, so I did not make it compatible with multiple bindings per key.

In order to properly solve this, we would need to alter the core code of UCR to allow multiple bindings to the same Joystick button in the same profile.

The way around this without coding is to use UCR's profile switcher as the shift state mechanism. That way, each sub-profile only needs one mapping to each input, and so does not fall foul of this issue.
To allow multiple bindings to the same joystick button, the AHK_JoyBtn_Input class would need to be altered:
https://github.com/evilC/UCR/blob/maste ... d.ahk#L280

An array would need to be built something like this:

Code: Select all

{
	1Joy3: {
		<ControlGuid>: <BoundFunc>,
		<ControlGuid>: <BoundFunc>
	},
	2Joy3: {
		<ControlGuid>: <BoundFunc>,
		<ControlGuid>: <BoundFunc>
	}
}
smootchat
Posts: 9
Joined: 17 Jan 2018, 00:57

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 05:39

Thanks evilC.

The profile switcher seems like the way to go. I wouldn't know where to start implementing an array.

Hehe, the Profile Switcher plugin makes most of my code redundant ;-)

Using my ButtonsToButtons loaded into 3 profiles, each assigning a single column of 20 inputs to new outputs, I now have 60 functions I can assign to my Saitek Yoke. I have set the switch trigger to the 3 position mode switch on the yoke.

Thankyou for your excellent control mapper.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 07:11

Yeah, so sorry you ended up wasting a bunch of work, completely forgot about the button mapping limitation :(

When you say "most of your code", is there still something you could do with your plugin that you cannot do by switching profiles?
Sam

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 09:05

This program is not saving Remaped Keys Each Time I save and Close the app and then re-open it there is no profile that I've made...
Is it not supported or its a bug??
Zee

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 09:21

Where is UCR.ini there is no file like that in your File.. https://imgur.com/a/m8Enz
If it creates one what is the location??
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 11:59

Sam wrote:This program is not saving Remaped Keys Each Time I save and Close the app and then re-open it there is no profile that I've made...
Is it not supported or its a bug??
Are you maybe trying to run UCR.exe from inside a zipped folder?
Do you maybe have permissions on the folder that stop UCR from being able to create the file UCR.ini?
Sam

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 13:34

No I have Extracted and Saved the settings ..
And What Kind of Permissions are you talking about??
Sam

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 13:47

Allowing Full Control and Running As Administrator Fixed The Problem Now It Saves...
Sam

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 14:16

Got it...

And Is there a list which shows which button is which for example in Button to Button No. 1 is Y what is No. 11??
Sam-

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 16:05

that doesn't explain which button is which..
Vjoy shows only 1,2,3 how can we figure which number does what...
I.E: what does vjoy button 1 do
what does vjoy button 5 do??
check this http://steamcommunity.com/sharedfiles/f ... =819212345
only few buttons work as this shows not all and it only shows 10 buttons
smootchat
Posts: 9
Joined: 17 Jan 2018, 00:57

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

22 Jan 2018, 17:25

evilC wrote:Yeah, so sorry you ended up wasting a bunch of work, completely forgot about the button mapping limitation :(

When you say "most of your code", is there still something you could do with your plugin that you cannot do by switching profiles?
Hehe, no worries. I enjoyed the coding.

I'm happy that ....

With one plugin I can ....
1. Remap 20 input keys to 20 + 20 outputs (even more if I change the "NumberOfButtons" variable in the code)
2. Re-assign the Hatswitch multiple times with multiple shift buttons/keys by loading the plugin more than once
3. Create a situation where one button press can generate multiple simultaneous outputs (like an "Emergency: Fire everything !!" button).
4. There is an unavoidable slight delay when switching profiles. Using the plugin to switch instead of the profile, I can have the shifted and non-shifted buttons toggle and fire prettywell instantly (eg, hold the output button and press / release the shift button repeatedly and the outputs will fire eg: 1,10,1,10,1,10,1,10 etc. With 2 plugins and pressing 4 buttons at once, I can do (1,2),(10,20),(1,2),(10,20) in rapid succession.
5. I can have shifted and non-shifted buttons output simultaneously.
6. Merge several joysticks and their buttons into one virtual stick in the one plugin and then double the outputs with the shift function.

Someone might find this useful if they have a particular need to solve.

I just like to have all my buttons reassigned in the one plugin.
Qren

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

23 Jan 2018, 13:50

Hey,
thx a lot for Your work. Thanks too You I could enjoy a game I was playing 15 years ago.
:D
haltux
Posts: 4
Joined: 23 Dec 2017, 06:14

Re: Universal Control Remapper (UCR) - v0.1.17 21st Aug 2017

26 Jan 2018, 15:26

evilC wrote:
haltux wrote:Hello,
But the problem is that Button-to-Button does not work with Shift, Ctrl and Alt. Basically they are ignored. If I output shift-A in UCR, il2 register A.

I can solve the issue by assigning only non-shifted keys inside the game, but this is very cumbersome, especially because there are not so many available keys in this kind of games...
I tested this and it seems good in notepad, eg if I bind Shift-A, I get a capital a. Not quite sure why the game is not recognizing it.
Another alternative might be to emulate a vJoy stick - that can have up to 128 buttons, so plenty to play with there, plus it would not interfere with other keyboard commands (immune to state of shift, alt etc)
I found the solution on the IL2 forum (which was refering to AHK). IL2 does not work if shift and the key are pressed together. So the solution is to run an AHK script:

Send {RShift down}
Sleep 33
Send {p down}
Sleep 33
Send {p up}{RShift up}

In case it happens for other games, it would be great if it was possible to do that directly from ButtonToButtons.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

26 Jan 2018, 15:31

Hmm, interesting.
I am guessing maybe it is due to a flaw in their key polling routine?
Maybe it processes the keys in order of scancode or name or something, so registers p before shift?
I am extrapolating this based on the sleep - I am guessing this works because it forces the shift press to be processed on one poll, then the p press to be processed on the next poll.
User avatar
evilC
Posts: 4822
Joined: 27 Feb 2014, 12:30

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

26 Jan 2018, 15:35

Image
So the shift scancode is higher than p, but lower than the keys on the bottom row of the keyboard.
If my theory is right, you will not need the sleep between shift + sending any of the bottom-row keys
haltux
Posts: 4
Joined: 23 Dec 2017, 06:14

Re: Universal Control Remapper (UCR) - v0.1.19 26th Dec 2017

26 Jan 2018, 17:43

evilC wrote: So the shift scancode is higher than p, but lower than the keys on the bottom row of the keyboard.
If my theory is right, you will not need the sleep between shift + sending any of the bottom-row keys
I will try and I'll tell you.

I have another, unrelated, question. I want to output a button on profile change (using Profile Switcher), is there a way to do that? Thanks.

Return to “Gaming Scripts (v1)”

Who is online

Users browsing this forum: No registered users and 38 guests