Jump to content

[0.24.x] AltInput v0.9.1 - Joystick/GamePad Input


Akeo

Recommended Posts

What situations is this mod designed for?

Both the controllers you tried are Gamepads rather than joysticks. They don't need to be calibrated, and none appear to have a throttle/slider. Again, I invite everybody who wonders what this plugin is for to read the "How-to-fix-horribly-calibrated-Joysticks-in-KSP" from this forum. While you may find that you can use your controller just fine with KSP, this is not the case for everyone.

Also, please understand that I'm only providing the XBox 360 as an example, because this is a controller that many people are expected to be able to get their hands on if they want to test the plugin. That doesn't mean that this plugin is meant to replace the default input for X360 if you are happy with it. It's just that a lot fewer people will have the controller I actually use (a Microsoft SideWinder Precision Pro), so using that as my example in the announcement wouldn't have been for the best.

Finally, I don't believe you can use one of the analog sticks of a gamepad to control a throttle delta in KSP. AltInput can do that, which can be quite convenient (since the delta will then also be proportional to how far the stick is moved, which allow for finer precision throttle up/down compared to a button).

Link to comment
Share on other sites

Also, we absolutely totally need the kill throttle button, and full throttle for 0.25.

NB: 0.24.x is not the version of AltInput, but the version of KSP AltInput is compatible with. The next version of AltInput will be 0.9.1. And yeah, as I already indicated, I'm planning to add the kill throttle. Not sure about full throttle though, since I don't believe it is a default KSP command when using the keyboard.

In fact, I can see no reason why any command KSP has should not be bindable.

When you try to actually code them, believe me, you'll see plenty.

VERY few commands in KSP can be mapped to an executeAction() API call that does all the work for you. For the rest, it's not that simple: Between warp mode that actually disables the regular processing call, and therefore requires a separate one (along with figuring out how to compute the warp restrictions according to altitude to mimic what the game does), EVA that seems to use completely different control than Craft and commands such as navBall toggle that are mapped God knows where, you'd be amazed how time consuming it can all become to add seemingly trivial stuff. And don't get me started on trying to alter the camera...

Anyway, just so you know, AltInput 0.91, which I'm trying to find time to finalize as we speak, will have continuous action for the buttons, kill throttle and config.ini reload (as long as you are OK going through the menu first - I'm not going to add an actual action for reload). It'll also let you know more explicitly if the config is not found where expected.

Speaking of config.ini, the reason why I placed it in [KSP]\Plugins\PluginData\AltInput\config.ini rather than [KSP]\PluginData\AltInput\config.ini is because when I first tried the native XML API from KSP to save some config data, that's where it went.

If you guys think that [KSP]\PluginData\AltInput\config.ini is preferable, I don't mind switching, but you need to let me know.

Finally, sorry, but I'm not planning to provide an archive. I want to be able to add a new [input] section to the existing config.ini file on the server, without having to do a new release, and the last thing I want is re-zip and leave people with no idea as to whether the zip they got contains all the latest controller defs.

Link to comment
Share on other sites

I have not tried this yet, so apologies if it has been already covered.

I wrote an app called UJR that lets you control a virtual joystick (with modifications - eg axis invert, deadzones etc) with a physical joystick.

The only issue is that it is unable to hide the physical stick from the game, so when you manipulate the physical stick, games often bind to that instead of the virtual stick.

How would this mod work with UJR?

The virtual stick should always be stick ID 1 - if this mod sees multiple sticks move when binding, does it prefer the lower ID stick?

Anything that I can do to make UJR work well in combination with this mod - please let me know.

Link to comment
Share on other sites

NB: 0.24.x is not the version of AltInput, but the version of KSP AltInput is compatible with. The next version of AltInput will be 0.9.1. And yeah, as I already indicated, I'm planning to add the kill throttle. Not sure about full throttle though, since I don't believe it is a default KSP command when using the keyboard.

It is in 0.25

Link to comment
Share on other sites

Hello Akeo,

I've hard time setting this plugin up. 1) when i use the release version of the plugin and try to launch a craft it prompts me that the version is wrong ( just like The Space Man posted). 2) when i use the debug version of the plugin it tells me that it didn't detect any controllers. And yes, i've put all the files where they're supposed to be. Can you help me?

Edit: i have a wireless xbox controller. So in config file i changed the name from XBOX 360 controller or something to just xbox. Now it works

Edited by Barbakliashas
Found solution
Link to comment
Share on other sites

@Akeo: any idea what's going on for me?

I think you only need a partial match on the controller name, but if you take the name from the windows "Setup USB Game Controllers" it should be right.

If you have lots of plugins try without them. There's an issue I'm seeing, where if lots of plugins load the AltInput plugin initialises late and something else snaps up the joysticks. That leads to a no controller found message. I get it when B9 is present.

If its saying version 0.0 of the config is found that usually means the config files not found/not in the correct folder. I've made a few tweaks to give more meaningful feedback... if Akeo will have me, but I'm new to the whole github collaborative thing :)

On the B9 thing it seems to be parts related, it seems it's not a conflict with another dll. I'm getting it with spaceplane+ too. I'm not sure yet if its just volume of parts a specific type of part or something more esoteric that upsets things.

Edited by mostevil
Link to comment
Share on other sites

@Taverius: I stand corrected... ;) (though the Steam version still seems to be 0.24.x right now). If you pick version 0.9.1, which I just released, you'll be able to use killThrottle and fullThrottle.

@Barbakliashas: The 0.9.1 release will now list the name of all the DirectInput game controller it detected, regardless of whether they have an entry in the config or not. This should help figure out what name to use for your section. I may add code to ignore case if the XBox 360 wired and wireless controllers are an issue. Or I might just duplicate the sections.

@K3|Chris: Please check what v0.9.1 report as detected controllers. If you still don't see anything, it may be that your controller is not handled by DirectInput...

@mostevil/enodatio: Thanks for figuring out a workaround for the B9 issue. As I explained, because it affects the ability to reload the config, I have preferred not to apply it for this release, but at least we know how to help people facing the same issue.

Finally, @EveryOne, please check the top post for the v0.9.1 release announcement, including the list of the many improvements that have been applied. Please continue to let me know of ways you'd like to see AltInput enhanced. I can't promise I'll add them all, and I'm pretty sure anything that gets added will happen much slower than anyone would like, but I'll see what I can do.

Link to comment
Share on other sites

@K3|Chris: Please check what v0.9.1 report as detected controllers. If you still don't see anything, it may be that your controller is not handled by DirectInput...

@mostevil/enodatio: Thanks for figuring out a workaround for the B9 issue. As I explained, because it affects the ability to reload the config, I have preferred not to apply it for this release, but at least we know how to help people facing the same issue.

From what Chrs is describing I'm fairly sure he's having the issue I see with too many parts present. If it shows no devices try moving the plugin folders out and see if it still then finds it. I can't see the x55 not having Direct Input support, it might need two entries to handle the throttle unit.

I wrote an app called UJR that lets you control a virtual joystick (with modifications - eg axis invert, deadzones etc) with a physical joystick.

The only issue is that it is unable to hide the physical stick from the game, so when you manipulate the physical stick, games often bind to that instead of the virtual stick.

How would this mod work with UJR?

The virtual stick should always be stick ID 1 - if this mod sees multiple sticks move when binding, does it prefer the lower ID stick?

Anything that I can do to make UJR work well in combination with this mod - please let me know.

It finds it through DirectInput so it will bind to the vJoy device, assuming an entry is created in the config.ini

However this can invert and specify dead zones so there's not really much call for using both together.

Link to comment
Share on other sites

From what Chrs is describing I'm fairly sure he's having the issue I see with too many parts present. If it shows no devices try moving the plugin folders out and see if it still then finds it. I can't see the x55 not having Direct Input support, it might need two entries to handle the throttle unit.

You mean too many mods? I can try it with a stock version of the game.

X55 defiantly supports direct input, and I also have an official wireless 360 controller that defiantly does, neither detected by 0.9.1

Edit: Tested with a completely stock .24.2 install, it detects both my 360 pad and both X55 devices, why would other mods make this one not work? Is it because it uses the deprecated out of gamedata folder structure? All mods since a couple KSP versions ago go in gamedata.

zregObb.png

There seems to be a bit of a bug with the plugin, it seems to block keyboard controls when in use, I can't push x to kill the engines, ctrl/shift to regulate throttle etc, yeah not a big problem once I get it set up but with no throttle set up it's a problem, and it shouldn't block the keyboard inputs imo.

Edit2:

Moved AltInput into GameData using this folder structure:

GameData\AltInput\SharpDX.dll

GameData\AltInput\SharpDX.DirectInput.dll

GameData\AltInput\AltInput.dll

GameData\AltInput\PluginData\AltInput\config.ini

Still works fine but not with all my mods in my main install, I'm slowly copying over a couple mods at a time from my main install into the completely stock + AltInput install to see what the culprit is, MM and FAR in the first round because those seem likely candidates, still works fine, I'll keep going, B9 (and it's dependencies) next.

Edit3:

"Success" no longer works with B9 + dependencies, even completely stock planes no longer work, now I'll remove stuff one mod at a time to see what causes it.

Edit4:

Errm, that's weird, just to get it out of the way I just removed the B9 folder, not it's dependencies, B9 only contains parts, no plugins, now AltInput works again... what the... That doesn't make any logical sense to me, why would additional parts with associated models and textures break this plugin?

Edit5:

Nvm looked above to see this been covered already, but still, it's weird, B9 isn't a plugin, and the plugins it comes with doesn't affect this one it seems, it's the parts causing the problem, which seems bonkers to me, I can't re-compile files, a compiled version that works with B9 (and I'm guessing any install with a lot of parts) would be appreciated.

I've confirmed it's the parts, kept all other B9 folders in gamedata but the parts sub-folder inside, works, put it back, stops working.

I think it would make sense to compile it in the fashion that it works with non-stock parts and put it into an archive that goes in gamedata, can provide the alternate .dll for debugging purposes, but a lot of KSP players play the game with part mods installed, could include your configuration file and a readme in the archive and have the configuration file labeled as an example you need to re-name or charge the file extension of to make use of it, could also put the config on your git wiki or similar if you want easy access to it without having to upload a new archive etc, though I think git can do releases without you having to supply an archive, it just wraps a branch into an archive.

Edited by K3|Chris
Link to comment
Share on other sites

Thanks again for your work Akeo. I see you have mentioned that coding in support for many functions in KSP can be a real pain, so I by no means want you to construe this as a demand, but I have been disappointed with how KSP doesn't allow re-binding trim functions. It would be great to be able to do that for flying planes, especially for pitch-trim. I just wanted to let you know that the interest is out there if it's something you consider.

Link to comment
Share on other sites

and I also have an official wireless 360 controller that defiantly does, neither detected by 0.9.1

See that AltInput: Detected Controller 'Controller (Xbox 360 Wireless Receiver for Windows)': 5 Axes, 10 Buttons, 1 POV(s) line?

The 'Controller (Xbox 360 Wireless Receiver for Windows)' part is what AltInput uses to find a match in the config file.

Now, because I don't have a Wireless X360 controller, the wired version I use reports 'Controller (XBOX 360 For Windows)', so I used the following entry in config.ini:

[XBOX 360 For Windows]

But since 'XBOX 360 For Windows' is not part of 'Controller (Xbox 360 Wireless Receiver for Windows)', your controller, while detected, will not be usable.

To be able to use it, just change the text between the brackets to part of the name that's reported by AltInput. Or you can just pick the latest version of config.ini, which I just updated to duplicate the XBox 360 entry for wireless (and I'll just point out that having the ability to update the config.ini on the fly, as I just did, is one of the reasons I don't want to provide AltInput as an archive)

In the next release, I guess I'll try to match sections in a case insensitive manner, so that a single [XBox 360] section should apply for both wired and wireless.

Link to comment
Share on other sites

There seems to be a bit of a bug with the plugin, it seems to block keyboard controls when in use, I can't push x to kill the engines, ctrl/shift to regulate throttle etc

Mmmm, that's something that I thought I had fixed.

I had that issue early in development, but I thought I had fixed it. I haven't checked if that was still the case before the 0.9.1 release, so I'll look into it when I get a chance, along with what might be best for B9.

Link to comment
Share on other sites

B9 is a parts pack with some plugins included including Firespitter, as said, I've tested it with all B9 components intact except the parts, I have no idea how parts can break a plugin, parts are configuration files, models and textures, should have no possible interactions, and since there is a setting that fixes it, why not apply the setting?

Link to comment
Share on other sites

and since there is a setting that fixes it, why not apply the setting?

Because that is a workaround (i.e. "No idea why this breaks, but somehow doing it like this seems to work") rather than a fix, and I'd much prefer a proper fix to a hasty workaround.

Then again, if anyone wants to publish a modified version of AltInput that includes the workaround, for B9 users, they are welcome to do so (It's free source after all). But, because the current workaround has drawbacks, I'm not planning to multiply the versions of AltInput I provide until we see clearer...

I should add that I am planning to test with B9 when I get a chance, to try to see clearer (and I'm ready to go as far as removing parts one by one to find the culprit). However, my time is limited and with my priorities being what they are, this will probably not happen as fast as you guys would like, so please be patient, OK?

Edit: The workaround is detailed here.

Edited by Akeo
added link to workaround comments
Link to comment
Share on other sites

I'm utterly confused why parts would break a plugin still, if B9 breaks AltInput, a very long list of mods with parts should as well, only possible connection I can think of is the additional assets makes something time out, but that should be the case with any mods that add sufficient textures etc to make the game load longer, not B9 specifically.

Gah so frustrating, almost though I could play with my X55, guess it's not meant to be.

Edited by K3|Chris
Link to comment
Share on other sites

  • 2 months later...

Here's a lovely oddity: I managed to get AltInput functioning properly in most respects. It detects my Saitek X52 just fine, and it is able to detect any button inputs. Axis inputs, however...yeah, I get nothing.

[Saitek X52 Flight Controller]
Interface = DirectInput
Class = GameControl
DeadZone = 0.03
AxisZ.Inverted = true
[Saitek X52 Flight Controller.Flight]
AxisY = pitch
AxisX = roll
AxisZ = mainThrottle
RotationZ = yaw
Button3 = toggleSAS
Button5 = overrideSAS
Button4 = toggleRCS
Button7 = toggleBrakes
Button9 = toggleGear
Button2 = toggleLights
Slider1 = wheelThrottle

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...