Universal Control Remapper (UCR) - v0.1.21 2nd Oct 2018

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

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

14 Sep 2017, 08:23

FYI, Snoothy and I are pretty close to releasing an Alpha of the new, completely rewritten UCR. We may well have something usable by the end of this weekend.
The home of the new version will not be on this site, as the new version does not use AHK.
I am in the process of setting up a site for the new version.
Raptor_67
Posts: 4
Joined: 03 Sep 2017, 08:22

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

20 Sep 2017, 10:00

evilC wrote:@Raptor
Shift profiles should be a child of the parent profile and they should have "inherit from parent" checked.
The profile switcher plugin should be in the parent profile.

Ideally you need two child profiles - a "Default" one and a "Shifted" one.
Anything that changes mapping while shifted should be mapped in both the "Default" and "Shifted" child profiles.
Anything that is common to both default and shifted state should be in the parent profile.

Hope this helps
Ah.. thanks. Now things are making a lot more sense. Thanks.
Raptor_67
Posts: 4
Joined: 03 Sep 2017, 08:22

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

20 Sep 2017, 11:32

Sorry to be a pain, but I got another issue.
I have 2 ThrustMaster Cougar MFD's (28 button square looking things).
I cant seem to successfully map them with UCR.
When I go to remap Button to Button, I can Select Binding and it appears to work. (UCR reports "Input Button" as "Stick 4 Button 1")
But with or without setting the output Button, if I just press the Stick 4 Button 1 (Button 1 on the MFD) neither the input button or the output button green indicator in UCR light up like they do for all my other inputs.
Am I doing something wrong or is this a bug with Win10 or UCR?
I'm trying to allocate the MFD Buttons to Virtual Joystick 2
I'm doing this to get around the silly windows swapping around the controllers issue as I use this PC for a number of projects so the USB ports are constantly being used for different things.
Windows rarely seem to load twice with the same joystick / device assignments.
Running Windows 10 Pro x64 on Gigabyte X99 G1 Gaming i7 5820K, 16GB 1080GTR etc.
Jnk
Posts: 3
Joined: 25 Sep 2017, 00:34

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

25 Sep 2017, 00:52

Hello, and thank you for developing such a useful program.
I have enjoyed many hours flying planes in DCS World with my mouse.
I am using UCR, mouse to joystick axis with vJoy as my system driver.
The mouse to joy plugin is set to absolute mode.
I have not been able to figure out how to neutralize, or center the virtual joystick.
I have tried using axisinitializer, but it does not seem to affect mouse to joystick.
Am doing something wrong?

Any help is appreciated.
User avatar
evilC
Posts: 4342
Joined: 27 Feb 2014, 12:30

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

25 Sep 2017, 07:58

@Raptor_67
This is a bit of an issue with AHK, because of the way it handles joysticks.
The new version of UCR that we are currently writing should be able to handle this properly.
We are hoping to release a pre-alpha soon, please keep an eye on this thread.

@Jnk
Try this modified version of the plugin:

Code: Select all

/*
Remaps mouse DELTA information (is unconcerned with cursor position, just cares about mouse movement) to joystick output.
Features Absolute and Relative modes
*/
class MouseToJoyWithCenter extends _UCR.Classes.Plugin {
	Type := "Remapper (Mouse Axis To Joystick Axis) WITH CENTERING"
	Description := "Converts mouse input delta information into two joystick axes"
	RelativeScaleFactor := {x: 10, y: 10}
	RelativeTimeout := 10
	RelativeThreshold := 2
	AbsoluteTimeout := {x: 10, y: 10}
	AbsoluteScaleFactor := {x: 1, y: 1}
	Mode := 2	; 1 = Relative, 2 = Absolute
	CurrX := 0
	CurrY := 0
	TimerX := 0
	TimerY := 0
	SelectedMouse := -1
	Init(){
		title_row := 25
		x_row := 55
		y_row := x_row + 25
		Gui, Add, Text, % "xm y" x_row+3, X AXIS
		Gui, Add, Text, % "xm y" y_row+3, Y AXIS
		
		; Relative mode
		Gui, Add, GroupBox, % "Center x50 ym w125 Section h" y_row+35, % "Relative"
		Gui, Add, Text, % "xs+5 y" title_row, Scale Factor
		this.AddControl("Edit", "RelativeScaleX", this.RelativeScaleChanged.Bind(this, "X"), "x70 w30 y" x_row, 10)
		Gui, Add, Text, % "x120 w40 center y" title_row, Timeout
		this.AddControl("Edit", "RelativeTimeout", this.TimeoutChanged.Bind(this), "x120 w40 y" x_row - 10, 50)
		
		Gui, Add, Text, % "x120 w40 center y" y_row - 10, Threshold
		this.AddControl("Edit", "RelativeThreshold", this.RelativeThresholdChanged.Bind(this), "x120 w40 y" y_row + 5, 2)
		
		this.AddControl("Edit", "RelativeScaleY", this.RelativeScaleChanged.Bind(this, "Y"), "x70 w30 y" y_row, 10)
		
		; Absolute Mode
		Gui, Add, GroupBox, % "Center x185 ym w55 Section h" y_row+35, % "Absolute"
		;Gui, Add, Text, % "x200 w40 center y" title_row, Timeout
		;this.AddControl("AbsoluteTimeoutX", this.TimeoutChanged.Bind(this, 2, "X"), "x200 w40 y" x_row, 10)
		;this.AddControl("AbsoluteTimeoutY", this.TimeoutChanged.Bind(this, 2, "Y"), "x200 w40 y" y_row, 10)
		Gui, Add, Text, % "Center xs+15 center w30 y" title_row, Scale`nFactor
		this.AddControl("Edit", "AbsoluteScaleFactorX", this.AbsoluteScaleChanged.Bind(this, "X"), "xs+15 w30 y" x_row, 1)
		this.AddControl("Edit", "AbsoluteScaleFactorY", this.AbsoluteScaleChanged.Bind(this, "Y"), "xs+15 w30 y" y_row, 1)
		
		; Tweaks
		Gui, Add, GroupBox, % "Center x245 ym w55 Section h" y_row+35, % "Common"
		Gui, Add, Text, % "xs+15 w20 center y" title_row+10, Invert
		this.AddControl("CheckBox", "InvertX", 0, "xp+5 y" x_row+3, "", 0)
		this.AddControl("CheckBox", "InvertY", 0, "xp y" y_row+3, "", 0)
		
		; Mouse Selection
		Gui, Add, GroupBox, % "x305 ym w110 Section h" y_row+35, % "Input"
		this.AddControl("InputDelta", "MD1", 0, this.MouseEvent.Bind(this), "x310 w100 y" x_row)
		
		; Outputs
		Gui, Add, GroupBox, % "x420 ym w140 Section h" y_row+35, % "Outputs"
		this.AddControl("OutputAxis", "OutputAxisX", 0, "x425 w125 y" x_row - 20)
		this.AddControl("OutputAxis", "OutputAxisY", 0, "x425 w125 y" y_row)
		
		this.AddControl("AxisPreview", "", 0, this.IOControls.OutputAxisX, "x560 y" x_row, 50)
		this.AddControl("AxisPreview", "", 0, this.IOControls.OutputAxisY, "x560 y" y_row, 50)

		Gui, Add, Text, xm y+25, Center Button
		this.AddControl("InputButton", "IB1", 0, this.OnCenter.Bind(this), "x+5 yp-13")

		this.AddControl("DDL", "ModeSelect", this.ModeSelect.Bind(this), "x575 w100 ym AltSubmit", "Mode: Relative||Mode: Absolute")
		
		;this.MouseTimeoutFn := this.OnMouseTimeout.Bind(this)
		;this.MouseTimeoutFn := this.MouseEvent.Bind(this, {x: 0, y: 0})
	}
	
	OnActive(){
		;this.InputDeltas.MouseDelta.Register()
	}
	
	OnInactive(){
		;this.InputDeltas.MouseDelta.UnRegister()
	}
	
	;MouseEvent(x := 0, y := 0){
	MouseEvent(value){
		; The "Range" for a given axis is -50 to +50
		try {

			x := value.axes.x, y := value.axes.y, ax := Abs(x), ay := Abs(y), MouseID := value.MouseID, dox := (x != ""), doy := (y != "")
					
			if (this.GuiControls.InvertX.Get())
				x *= -1
			if (this.GuiControls.InvertY.Get())
				y *= -1
		} catch {
			; M2J sometimes seems to crash eg when switching from a profile with M2J to a profile without
			; This seems to fix it, but this should probably be properly investigated.
			return
		}
		
		if (this.Mode = 1){
			; Relative
			threshold := this.RelativeThreshold
			if (dox && ax && ax <= threshold)
				dox := 0
			if (doy && ay && ay <= threshold)
				doy := 0
			if (dox){
				this.CurrX := x * this.RelativeScaleFactor.X
				
			}
			if (doy){
				this.CurrY := y * this.RelativeScaleFactor.Y
			}
		} else {
			; Absolute
			if (dox){
				this.CurrX += ( x * this.AbsoluteScaleFactor.X )
				if (this.CurrX > 50)
					this.CurrX := 50
				else if (this.CurrX < -50)
					this.CurrX := -50
			}
			
			if (doy){
				this.CurrY += ( y * this.AbsoluteScaleFactor.Y )
				if (this.CurrY > 50)
					this.CurrY := 50
				else if (this.CurrY < -50)
					this.CurrY := -50
			}
		}
	
		if (dox){
			;OutputDebug, % "UCR| x: " this.CurrX " (" UCR.Libraries.StickOps.InternalToAHK(this.CurrX) "), y: " this.CurrY
			ox := this.IOControls.OutputAxisX.GetBinding()
			if (ox.DeviceID && ox.Binding[1]){
				cx := UCR.Libraries.StickOps.InternalToAHK(this.CurrX)
				this.IOControls.OutputAxisX.Set(cx)
			}
		}
		
		if (doy){
			oy := this.IOControls.OutputAxisY.GetBinding()
			if (oy.DeviceID && oy.Binding[1]){
				cy := UCR.Libraries.StickOps.InternalToAHK(this.CurrY)
				this.IOControls.OutputAxisY.Set(cy)
			}
		}
	

		
		; In Relative mode, emulate centering with a timeout
		if (this.Mode = 1){
			if (dox && x != 0){
				if (this.TimerX != 0){
					fn := this.TimerX
					SetTimer, % fn, Off
				}
				fn := this.MouseEvent.Bind(this, {axes: {x: 0}, MouseID: MouseID})
				this.TimerX := fn
				SetTimer, % fn, % "-" this.RelativeTimeout
			}
			if (doy && y != 0){
				if (this.TimerY != 0){
					fn := this.TimerY
					SetTimer, % fn, Off
				}
				fn := this.MouseEvent.Bind(this, {axes: {y: 0}, MouseID: MouseID})
				this.TimerY := fn
				SetTimer, % fn, % "-" this.RelativeTimeout
			}
		}
	}
	
	OnCenter(e){
		if (e){
			this.CurrX := 0, this.CurrY := 0
			cx := UCR.Libraries.StickOps.InternalToAHK(this.CurrX)
			cy := UCR.Libraries.StickOps.InternalToAHK(this.CurrY)
			this.IOControls.OutputAxisX.Set(cx)
			this.IOControls.OutputAxisY.Set(cy)
		}
	}
	
	OnMouseTimeout(){
		this.MouseEvent({x: 0, y: 0})
	}
	
	ModeSelect(value){
		this.Mode := value
	}
	
	; === Relative Mode variable changed
	RelativeScaleChanged(axis, value){
		;this.RelativeScaleFactor[axis] := 100 / value
		this.RelativeScaleFactor[axis] := value
	}
	
	RelativeThresholdChanged(value){
		this.RelativeThreshold := value
	}
	
	TimeoutChanged(value){
		this.RelativeTimeout := value
		;this.MouseDelta.SetTimeOut(value)
	}
	
	; === Absolute Mode variable changed
	AbsoluteScaleChanged(axis, value){
		this.AbsoluteScaleFactor[axis] := value
	}
}
Last edited by evilC on 26 Sep 2017, 04:08, edited 1 time in total.
Jnk
Posts: 3
Joined: 25 Sep 2017, 00:34

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

25 Sep 2017, 18:00

C, wow. Thank you so much. This helps me so much. In the flight sim world, the aircraft control surfaces have to be set very specifically, for take offs, landings and just spawning in the air. I have crashed so many times trying to wrest control of the aircraft because I could not effectively neutralize the control surfaces. This plug-in works perfectly. I had planned on producing some video tutorials on YouTube at my channel JnksCombatFlightSims. I will be including information and instructions which include your application. Again, thank you.
Jnk
Posts: 3
Joined: 25 Sep 2017, 00:34

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

25 Sep 2017, 19:05

C,
I disabled this line.. ToolTip % A_TickCount ..as it was generating debug infomation? on the display
OnCenter(e){
;ToolTip % A_TickCount
if (e){
this.CurrX := 0, this.CurrY := 0
cx := UCR.Libraries.StickOps.InternalToAHK(this.CurrX)
cy := UCR.Libraries.StickOps.InternalToAHK(this.CurrY)
this.IOControls.OutputAxisX.Set(cx)
this.IOControls.OutputAxisY.Set(cy)
}
}

Thanks again, this is a great plug-in for flight simulators. Tested it out in DCS World, works perfectly.
Alerax

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

29 Sep 2017, 17:47

Hey- this an awesome plugin for flight simulator indeed.
I'm trying to maximize my new Elgato Stream Deck with this plugin, but it seems like the plugin is only limited to 128 joystick output buttons. Would it be possible to go up to 250 output buttons? (Elgato has 15 folder capabilities with 14 buttons in each folder, reaching 210 buttons).
Alerax

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

29 Sep 2017, 18:59

Please ignore the earlier post- figured it out that I can use Joy1 and Joy2 in vJoy.

Might've found an issue though, or maybe I'm doing something wrong. I'm trying to do a keyboard to joystick button conversion, and everything works great if I use single keyboard inputs, i.e. 1,2,a,b,c. However, if use a macro (i.e. lcrtl+1), I need to have the UCR as active window for it to register the joystick conversion. Not sure if this limitations?

Thanks in advance!
pickone
Posts: 3
Joined: 30 Sep 2017, 10:02

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

30 Sep 2017, 10:09

Hi! Theres any way to have "toggle" on ButtonsToAxis too? Thank you in advance
dbgtboy
Posts: 1
Joined: 30 Sep 2017, 22:21
Facebook: Amar Zebian
Google: Amar Zebian
GitHub: Amar

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

30 Sep 2017, 22:32

Hello evilC, great job with this application! I have been trying it out with great success. I do have one issue though, right now with the ButtonToButton plugin you can set "Block" on the input so that any game you are playing will not see the key being pressed and will detect it as a joystick press only. However, the problem I am having is that the "Remapper - Mouse Axis to Joystick Axis" does not have the same "Block" option for the input, so what is happening to me is that whenever I move the mouse, the game detects both a mouse movement and joystick movement and then starts constantly flipping between the two and it gets a bit screwed up. How do I block the mouse input so that the game cannot detect and can only see the joystick being moved?
User avatar
evilC
Posts: 4342
Joined: 27 Feb 2014, 12:30

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

01 Oct 2017, 12:09

The current version of UCR does not support mouse blocking, as it does not support per-device blocking.
So if I blocked the mouse, it would stop working in windows.
Without some kind of per-application blocking, supporting this is tricky.

In the new version of UCR we are writing, we support per-device blocking, so at least we can block a certain mouse, and you could maybe have a spare mouse or something in case you lock yourself out.
baker99
Posts: 5
Joined: 05 Aug 2017, 15:47

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

02 Oct 2017, 07:24

"FYI, Snoothy and I are pretty close to releasing an Alpha of the new, completely rewritten UCR. We may well have something usable by the end of this weekend.
The home of the new version will not be on this site, as the new version does not use AHK.
I am in the process of setting up a site for the new version."

How would one get access to the alpha?
User avatar
evilC
Posts: 4342
Joined: 27 Feb 2014, 12:30

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

02 Oct 2017, 07:29

When it is ready, I will announce it here
Bear in mind though that this new version may not have all the features that the current version has. For example, there will be no blocking of mouse/keyboard in the first iteration, and it will only have some very basic plugins. Also mouse delta support will probably not be in the first version.
It will probably also be buggy as hell.

ie do not expect it to be replacing the current version for a while yet.
baker99
Posts: 5
Joined: 05 Aug 2017, 15:47

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

02 Oct 2017, 07:46

No worries, happy to help test things when you are ready
Winsane
Posts: 3
Joined: 03 Sep 2017, 19:43

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

07 Oct 2017, 13:25

Hello! First off, thanks for all the work you're doing. UCR has been one of those things I didn't know I needed until I found it!

I have a question though, and I hope this is the right place to ask. I want to bind a specific key combination to a joystick axis, but it's not letting me.

Specifically, I want to bind LButton+RButton to an axis. But it seems like it's only possible to have modifiers like shift or ctrl in a key combination like that, and not two "normal" keys.

This is the error I'm getting:

Image

I've been poking around in the code to see if I could make a more traditional hotkey and then maybe call the ucr axis function, but I'm simply not experienced enough to figure it out. I feel like I was getting close when I found "Plugin Authors call this to set the state of the output axis" in OutputAxis.ahk, but I really don't understand the code I'm looking at.

So if someone could tell me what the easiest way of achieving what I'm trying to do is, I'd greatly appreciate it!
Winsane
Posts: 3
Joined: 03 Sep 2017, 19:43

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

09 Oct 2017, 10:45

evilC wrote:@Winsane
Could you please clarify the statement "I want to bind LButton+RButton to an axis"?
Are LB+RB the input (what you press) or the output (What gets pressed)?
Yep! LB+RB is what I press, and I want that to result in a certain axis tilt!

Basically this:

Image

But doing that gives me the error I showed in the previous post.

I don't absolutely need it to work through the UCR keybinding interface, though. If there is a way of doing this something like this: (Excuse my attempt at pseudo code)

Code: Select all

rbutton & lbutton::
{
set vXBox_Axis.X(75)
}
return

lbutton up::
{
set vXBox_Axis.X(0)
}
return
Then that would work just fine. If I knew how to do that, it would actually probably be very useful for other strange specific binds I might want to create in the future!

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 3 guests