Page 40 of 51

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

Posted: 22 Jan 2018, 05:20
by evilC
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>
	}
}

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

Posted: 22 Jan 2018, 05:39
by smootchat
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.

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

Posted: 22 Jan 2018, 07:11
by evilC
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?

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

Posted: 22 Jan 2018, 09:05
by Sam
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??

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

Posted: 22 Jan 2018, 09:21
by Zee
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??

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

Posted: 22 Jan 2018, 10:03
by evilC
UCR.ini is not in the zip.
It is created when you first save settings.

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

Posted: 22 Jan 2018, 11:59
by evilC
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?

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

Posted: 22 Jan 2018, 13:34
by Sam
No I have Extracted and Saved the settings ..
And What Kind of Permissions are you talking about??

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

Posted: 22 Jan 2018, 13:47
by Sam
Allowing Full Control and Running As Administrator Fixed The Problem Now It Saves...

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

Posted: 22 Jan 2018, 13:52
by evilC
To be fair, you may well want to run as admin anyway, else some games will not see keys sent by UCR.
Just be careful and don't run any plugins from untrusted sources ;)

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

Posted: 22 Jan 2018, 14:16
by Sam
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??

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

Posted: 22 Jan 2018, 15:34
by evilC
I presume you mean the button names on an Xbox pad? In this version of UCR, no.
However, in the new UCR-C#, If you use the XInput provider, then yes, it will show Xbox button names.

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

Posted: 22 Jan 2018, 16:05
by Sam-
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

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

Posted: 22 Jan 2018, 17:25
by smootchat
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.

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

Posted: 23 Jan 2018, 13:50
by Qren
Hey,
thx a lot for Your work. Thanks too You I could enjoy a game I was playing 15 years ago.
:D

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

Posted: 26 Jan 2018, 15:26
by haltux
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.

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

Posted: 26 Jan 2018, 15:31
by evilC
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.

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

Posted: 26 Jan 2018, 15:35
by evilC
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

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

Posted: 26 Jan 2018, 17:43
by haltux
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.

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

Posted: 26 Jan 2018, 20:46
by evilC
Well not by default, but you could just duplicate the profile switcher and add a button output to the plugin.
You would be talking like <5 lines of code