Newcomer / Intro TARGET - buttons not working?

I've been working on TARGET scripting, with help from folks in this forum, but have run into an issue.
From what I've seen, the best way to create a script is using mode_filtered to only map the items I need.
This leaves the original throttle and joystick visible to Elite, so you don't have to remap everything.

However, I'm running into issues where a handful of buttons aren't working (Joy 18 on joystick, Joy 31 on throttle, and the U axis on the throttle). They show up working fine in the device analyzer, but Elite isn't recognizing them.

Has anyone seen issues like this or would be able to take a look at my script and see if you can see why this is a problem?

I got the code from PiedDroit over on this thread.
 
Hi @johntarr ,

In short, yes, I've seen issues like this reported several times.
When you have a spare 2 hours, read every post on Aussiedroids thread I posted yesterday!
;-)

In the meantime, zip up your script and .bind file, post here (or a link to whatever cloud drive you use) and , I'll take a look at your script and try to help.

Cheers
Clicker
 
Hey @Clicker, thanks again for offering to help!

Here's the current script and binds file. If I can just get these buttons working, I think I'll be pretty happy with my control layout, at least for now.
 

Attachments

  • Script and Binds.zip
    7.1 KB · Views: 273
@Clicker - I read through some of your recent notes on the AD thread. I just downloaded TARGET and updated the firmware as well, so I should be good on that front. Am also running the script prior to starting Elite, and I know it's working, because it's picked up the remaps I've done in the script. Just wanted to update you that I've checked those items out.
 
Hi @johntarr ,

Just a quick update (not finished playing with this but thought I'd share what I've learned so far).

1) I've not come across using ThrottleMap0/1, JoystickMap0/1 to create 'mapping profiles' via arrays before, very interesting.
I can see why the DCSWorld crowd would use these (for different aircraft) but has limited use in ED...other than testing

2) Joy 19 and Joy 31 both seem to work for me...however, because you have Throttle and Joystick = MODE_FILTERED, when playing with in-game binds, they register as "Joy19+Joy19" or "Joy31+Joy31"...I'm still to trawl through the entire bind list to look for where you've assigned these to test in game.

3) "U Axis" is presumably the slider.
a) I've never seen reference to a "U Axis" in ED before...usually RZ or RY.
b) You have not included a MapAxis statement for the slider in your .tmc ... so this maybe your issue

4) I'm yet to learn why you need MODE_FILTERED, but will keep looking and playing

Cheers
Clicker
 
Last edited:
Hey @Clicker,

Thanks for the update. I'll try to respond on some of these, please correct me if I'm misunderstanding what I'm trying to do here (this is likely the case).

4) I'll answer this first as it may drive some of the other items. My thought behind using MODE_FILTERED was that I'd like the original physical joystick & throttle to remain mapped so that Elite Dangerous can still see them and use the built in Warthog mappings as a starting point instead of having to map everything from scratch. My understanding is that when you use MODE_FILTERED, it leaves the original joystick & throttle, but creates a new virtual device. I've seen this behavior when I watch the Windows Game Controller screen while starting/stopping scripts.

1) I didn't think it was to do with multiple planes, although it may be. I assumed that the purpose of mapping inputs to 0 was to tell the virtual device not to repeat those button presses and to leave them on the original physical device only. Before I found this approach, I was having issues with MODE_FILTERED where a single press of certain buttons was showing up as two presses in Elite Dangerous. For instance, pressing JOY_20 on the throttle was coming across as JOY_20, and JOY_15, I believe.

2) I will have to try that out and see if I'm seeing that same behavior.

3) I probably had the axis name wrong, sorry. I mean the slider on the throttle.
b) My expectation was that I wouldn't need to map it because it's still on the physical throttle (which MODE_FILTERED) should leave in place. My understanding was that the only things I really need to map would be those keys I want the virtual device to emulate.

Thanks again for your help in this.
 
Hey @Clicker,

Thanks for the update. I'll try to respond on some of these, please correct me if I'm misunderstanding what I'm trying to do here (this is likely the case).

4) I'll answer this first as it may drive some of the other items. My thought behind using MODE_FILTERED was that I'd like the original physical joystick & throttle to remain mapped so that Elite Dangerous can still see them and use the built in Warthog mappings as a starting point instead of having to map everything from scratch. My understanding is that when you use MODE_FILTERED, it leaves the original joystick & throttle, but creates a new virtual device. I've seen this behavior when I watch the Windows Game Controller screen while starting/stopping scripts.

Correct. MODE_FILTERED offers both the native controllers and the combined controller it creates to the Operating system.
And, yes, if you don't use MODE_FILTERED, you do have to re bind everything in game.
Why not create a binds file for native joystick/throttle and one for when you use TARGET.
Once you create each, simply rename them and change the "PresetName" on line 2 via notepad or notepad++ accordingly.
Yes, it's a pain, but in the long run, totally worth it.

1) I didn't think it was to do with multiple planes, although it may be. I assumed that the purpose of mapping inputs to 0 was to tell the virtual device not to repeat those button presses and to leave them on the original physical device only. Before I found this approach, I was having issues with MODE_FILTERED where a single press of certain buttons was showing up as two presses in Elite Dangerous. For instance, pressing JOY_20 on the throttle was coming across as JOY_20, and JOY_15, I believe.

Ahh...communication mismatch between me and you here... I was talking about "int ThrottleMap1[]={...}" + "int ThrottleMap0[]={...}" lists with MapList() Statements.
The individual array list entries result in a Mapkey(<input device>, <button>, <event>) for each button included in the list and yes, if "<event>" for a specific button is '0' then it sends NUL when pressed.

In your case, great for trouble shooting.
You only need to change one or both MapList() statements to go from NUL to DX mappings.

I can see that whilst you use these MapList() statements you also overwritten a couple by defining them manually later on (eg. LDGH, APPAT & APAH)
These will overwrite the entries in whichever MapList you are using...just so you know.

3) I probably had the axis name wrong, sorry. I mean the slider on the throttle.
b) My expectation was that I wouldn't need to map it because it's still on the physical throttle (which MODE_FILTERED) should leave in place. My understanding was that the only things I really need to map would be those keys I want the virtual device to emulate.

Probably true...I would need to test this to be certain as well.

Thanks again for your help in this.

No problem.
Cheers
Clicker
 
@johntarr ,

Your EventHandle function...

Code:
int EventHandle(int type, alias o, int x)
{
    int rc = DefaultMapping(&o, x);

    if(&o == &Throttle & x == THR_FC) return rc;

    GameOutput(&o, x, o[x]);
    return rc;
}

This is not default....can you advise what this is meant to do?
(THR_FC is the slider)

FYI...changing EventHandle back to default doesn't change the issue with the slider not being recognised in game anyway.

Just a thought..., do you have any other controllers connected to your PC?
If you do, perhaps they are causing a conflict by using one of the 8 (only) DX Axes available to Windows.

Cheers
Clicker
 
No other controllers connected, just a Logitech mouse receiver and a Bluetooth keyboard.

Unfortunately, I've got no idea what that code is meant to do. I stole that part wholesale from the forum post I linked in my first post above. I really tried to understand the code and start my own from scratch, but ran into issues. The manual states that unless you map something it won't work, but in practice all the default mappings are there even if you don't map them. Also, it doesn't even mentioned MODE_FILTERED, so I'm relying on info I'm finding in forum posts for how to use it.

Maybe no one uses filtered because it's too buggy? Not sure, but I'm hoping to get it to work.
 
@johntarr ,

The code you borrowed was from the DCSWorld forum...as such it was written specifically for a P-51 LUA and not with Elite Dangerous in mind.
Apart from the EventHandle function and a few minor things there's nothing major wrong with the code.

I'm still playing with it and will let you know when I find some solid solutions.
;-)

Dennis
 
@johntarr ,

Major issue.
You are using the same DX#s on the throttle and the stick.
(example Throttle, SC, DX1 and Joystick, TG1, DX1)
Plus, you can only use DXHATUP/DOWN/LEFT/RIGHT once!

Further, your script tries to assign 32DX buttons to the Combined throttle and 19DX buttons to the combined joystick (total = 51 DX Buttons)

If my understanding is correct, when using MODE_FILTERED
a) TARGET passes through any unmapped buttons and axes (as previously mentioned) (from ThrustmasterJoystick, or ThrustmasterThrottle)​
b) If a button is mapped, the ThrustmasterThrottle/Joystick button is blocked by TARGET which issues the action you mapped to that button (as ThrustmasterCombined)​

This means you still only have a total combined 32 DX Buttons (plus 4x DXHAT ) and 8 DX Axes for ThrustmasterCombined and I believe you need to assign unique DX#s to your buttons across both Joystick and Throttle in your script.

Solution = you will need to unmap 19 of your buttons across the joystick/throttle AND use each DX# and the 4xDXHAT only once in your script.

My tip would be to bite the bullet...use keyboard keys and not DX# for your buttons.
Yes, setting up your bindings is a pain, but once done (properly) it's almost set and forget.

Clicker
 
@Clicker

I'm genuinely confused now.

Since the throttle and stick are separate DX devices, why would there be an issue with overlap in their buttons?
In fact, according to ED Ref Card, the Warthog has multiple overlapping buttons, but still works fine with Elite right out of the box. See JOY 7-14 & JOY 16&17, which exist on both throttle and stick.

As for your comments around MODE_FILTERED:
a) I think this may be the source of the issue, and I'll try to look into it. The code I borrowed does map most buttons to 0, but I don't think he maps all the axes & hats to 0, so there may be some issue with the virtual device having too many axes & hats.
b) I'm probably wrong, but I don't think this is correct. That script maps all the buttons to 0 on the virtual device, but they still work fine on the physical device. Also, I just tested this out by mapping S4 to 0 and S3 to PULSE+'a' in my script. Attempting to bind S4 in ED resulted in ED seeing JOY4, and attempting to bind S3 resulted in ED seeing JOY3+A. Just to check if it behaves differently with a DX map, I exited the game, mapped S3 to DX9, and ED saw a press of S3 as JOY3 + JOY9. Based on this, I don't think TARGET is blocking the action on the physical device.

C-like:
MapKey(&Joystick, S4, 0); // paddle to 0
//MapKey(&Joystick, S3, PULSE+'a'); // pinky to a
MapKey(&Joystick, S3, DX9); // pinky to DX9

You've been at this way longer than me, so I'm sure there's something simple I'm missing, but as it stands, I'm not seeing the behavior you describe from TARGET. I don't want to keep tying you up, you've put a lot of time into this already, and I appreciate it, so I will probably look into the axis/hat issue a bit and then bite the bullet and hand map it all to keystrokes if I have to. Was really hoping to continue to present the physical stick & throttle to ED and then just have a virtual device provide a few extra keystrokes here and there, but it looks like that may not be in the cards.
 
Hiya,

Yep the ED Warthog profile is for 2x independent controllers.
So one each of DX1-DX32 for Throttle and for Joystick.
These are not overlapping...they are separate controllers.

The overlap I'm talking about occurs in the "Combined" controller that TARGET creates when it is run.

In MODE_FILTERED, you have;
an independent Joystick controller (32DX Buttons, 4xDXHAT, 8 Axes) and
an independent Throttle controller (32DX Buttons, 4xDXHAT, 8 Axes) and
a combined controller (32DX Buttons, 4xDXHAT, 8 Axes) created by TARGET, and all KeyMaps take precedence over the seperate, independent controllers.

If you assign the same DX# to two different buttons (albeit on different physical devices) in TARGET the Combined controller may (or may not) send the exact same DX# to ED in game, or more likely, ignore it altogether if there's a conflict.

It is also interesting to note that the .bind file you supplied has ZERO ThrustmasterCombined references.
Can you take a look in your bindings folder and see if there's an 'BindingLoadingErrors.log' file?
If so, please post here!

Hang in there @johntarr , we're getting closer!

Cheers
Clicker
 
@Clicker
b) I'm probably wrong, but I don't think this is correct. That script maps all the buttons to 0 on the virtual device, but they still work fine on the physical device. Also, I just tested this out by mapping S4 to 0 and S3 to PULSE+'a' in my script. Attempting to bind S4 in ED resulted in ED seeing JOY4, and attempting to bind S3 resulted in ED seeing JOY3+A. Just to check if it behaves differently with a DX map, I exited the game, mapped S3 to DX9, and ED saw a press of S3 as JOY3 + JOY9. Based on this, I don't think TARGET is blocking the action on the physical device.

I see the same behavoir ... so I may be wrong in my assumption around MODE_FILTERED and it looks like it's seeing both devices.
 
Ok...regarding references to overlapping DX# in your script...so you are saying you only use...

// Empty maps
MapList(&Joystick,&JoystickMap0);
MapList(&Throttle,&ThrottleMap0);

...that makes more sense now...I must have assumed you were using both JoystickMap1 and ThrottleMap1.
(why, I don't know!)

Yeah, don't use both JoystickMap1 and ThrottleMap1 together!
(as they will have conflicting DX#)

My bad.
Let me have another crack at this and sorry about the confusion.

Clicker
 
I just had an epiphony...I think...

comment out those two MapList statements

then add...

Code:
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);

underneath your existing Keyaxis statement then change EventHandle to...

Code:
    int EventHandle(int type, alias o, int x) {
        DefaultMapping(&o, x);
    }

...and let me know what's still not working.

FWIW I've not been able to get your script working in game at all on my machine!
I can try binding stuff, and the buttons and switches all bind, but none of the axes, and your other existing binds are not working on my machine...and no error.log file
I suspect the binds file is incompatible.
What version of Windows are you running?

Cheers
Clicker
 
Last edited:
I've done some more testing...

In your script, I made the changes suggested above.

I've left S2 without a KeyMap

Then added the following to your script...

Code:
MapKey(&Joystick, S3, DX30);
MapKey(&Joystick, S4, 0);

Results:

1 - Device Analyzer

S2 - Joystick registers DX2, Combined Registers DX2 (being passed through)
S3 - Joystick registers DX3, Combined Registers DX30 (being intercepted and new action sent)
S4 - Joystick registers DX4, Combined Registers nothing (being blocked)

2 - In game (Options Controls)

S2 - Game Registers Joy2, Bind file registers "ThrustmasterWarthogCombined" Joy_2
S3 - Game Registers Joy30, Bind file registers "ThrustmasterWarthogCombined" Joy_30
S4 - does not register at all

This would tend to indicate that MODE_FILTERED is working as I originally understood.
It is passing through unmapped buttons as original DX.
Is intercepting original button and transposing what we map in script
Is blocking buttons mapped to '0'.

Also, NONE of the AXES are being passed through.
The Slider registers because I added a MapAxis() statement for earlier today.

As mentioned in my previous post, NONE of the original bindings work on my machine (the ones your bind file shows them as "ThrustmasterWarthogJoystick" or "ThrustmasterWarthogThrottle") ... this includes before I made the changes in the above post.

Any passed through or filtered buttons are now registered as "ThrustmasterWarthogCombined" ... which is how I originally understood it to work.
At this stage, I actually do not understand why the original script works on your machine but not mine...sorry.

On a positive note...I've learnt something cool today.
Your KeyAxis() statement for sending a 'j' when the throttle is at 95% works well and is something I've not played with before...nice!

Clicker
 
Last edited:
@Clicker

A lot to digest there, I'll try to respond.

I'm on Windows 10

I understand that it passes unmapped devices through as though they belong to the virtual device.
However, the point of mapping all the buttons to 0 on the virtual device is to avoid the conflicts you're describing. I don't want to comment those MapList lines, as that would guarantee DX button conflicts when it uses the default mappings.

I'll play with it some more.

I am glad that you found something you can use out of that! As you probably saw, I use that to trigger a jump. Feels pretty satisfying to drive the throttle all the way forward to trigger a jump to a new system.
 
@johntarr

The only other way I can describe it is that TARGET filters the devices you've configured as such, so, when you MapKey a button in the script you are telling TARGET to intercept and do something with it. 0 Blocks it, a DX# or keyboard character will be sent instead.

If you do not MapKey the button, it gets passed through as is, however the catch is, it is presented to Windows as "ThrustmasterWarthogCombined" device and not "ThrustmasterWarthogJoystick" or "...Throttle".

So somehow, despite running TARGET, your machine is still interpretting the buttons coming from "ThrustmasterWarthogJoystick" etc. (not being intercepted despite being MapKey'd).
So far, I've not been able to replicate this at all on my machine.

You mentioned the other day you re-downloaded TARGET and updated the firmware...can you confirm for me which versions you now have running?
  1. TARGET version
  2. Joystick firmware version
  3. Throttle firmware version
TARGET.jpg


Cheers
Clicker
 
Last edited:
Back
Top Bottom