I've tried to use my XBox360 controller with DOSBox every once and a while every so often, but it never works, because DOSBox won't let you bind any axes after the first four, and won't actually register bindings to the hat/d-pad either unless the hat/d-pad is supported by the emulated device. Not to mention that the XBox360 driver stupidly places the trigger/rudder axis as the 3rd axis, and thus totally breaking the "first two axes are joy1, second two axes are joy2" assumption made by DOSBox... and every other rational human being.

But think about it, if I'm remapping the d-pad to keys, then the emulated device doesn't _need_ to support the hat, right? So why would DOSBox block me from doing so? (Answer? DOSBox was arbitrarily capping the axes and hats to only what was being emulated.)

This patch removes a few MAGIC_NUMBERS in favor of defines, and also raises the scans on the axes and the hats for event handling so that you can actually bind all axes (up to 8 ), and hats (up to 2) to something...

Of course, the emulated environment will still only ever see the 4-axis or whatever you setup, this is simply a limitation of how joysticks were handled in DOS. However, at least now you can bind those otherwise useless axes to keys, and bind hat switch positions to your favorite emulated keys.

I shall now spend the next 8 hours playing my Descent with my entire gamepad, rather than the hideous horrible mess I was forced to use before, because Microsoft decided to be total idiots in laying out the axes on their controller...

Hey wd, I don't understand the slightly hostile tone in this matter. There are a few threads about joystick troubles connected to the "axis limit" IIRC, and I remember not being able to use the right thumbstick on my Xbox 360 controller (XBCD driver) at all. I don't have the knowledge (and motivation/time, to be frank) to setup a compile environment. If someone could compile a Windows build with that patch applied I could do some quick Windows 7 testing and reporting though if that's any help.

Wrong, DOSBox intentionally capped mappable features to keep the mapper file sane in case of replacing joysticks or switching to keyboard-only mapping of joystick targets and back to real joysticks.

I'm trying to think of a situation where the mapper file would stop being sane if DOSBox recognized 8 axes instead of just limiting itself to 4 axes... and why it would stop being sane if DOSBox recognized a hat for binding even when not emulating a hat...

I'm failing to see how the addition of about 16 more possible bindable inputs (4 axes * 2 directions + 2 hats * 4 directions) would have any impact on the sanity of the file, when the keyboard itself has about 101...

DOSBox without this patch is literally throwing away inputs. Sure if you never have more than 4 axes on your joystick, you would never notice, but Microsoft pumped out a controller with 5 axes, and arranged them somewhat retardedly: Axes 0,1 = Left control stick, Axis 2 = the triggers together as one axis, Axes 3,4 = Right control stick. Put this together with DOSBox arbitrarily capping at 4 axes, and you only get one-axis of the right control stick, with no possible way to map Axes 3,4 onto emulated Axes 2,3.

I don't have any joystick any more so hope somebody is interested in checking out ways of testing this or a more useful implementation rather than "arbitrarily removing the arbitrary capping".

There is no way to implement this except removing the arbitrary cap on input (or rather raising the arbitrary cap on input... if someone had a controller with more than 8-axes, it would now still throw away the 9th axis and above).

As for testing, I'm all for testing anything you can possibly dream up that you think I might be forgetting about... but as is, it's all the same code that has been working for years... just reading more axes and the hat even if there isn't a hat being emulated.

@cfoesch A BIG THANK YOU, i was very dissapointed that my controller did not fully worked (Hat & right thumb does not worked before), Now i can play like it should be, Thank you very much again, i hope this is included into the next release, if not then please continue to compile your awesome build. THANKS.

If there's no cap on buttons then why cap axes and hats? I could use a dualshock 3 with both left and right stick because the rest of the controller was mapped to buttons, no analog triggers or hat. I could map up to 17 buttons with no issues (with button wrap off), even though dosbox was only emulating a max number of 6 buttons with the ch profile. For some reason this same approach isn't applied to axes. If dosbox is only emulating 4 axes you can only use 4, and the bigger problem is that you can't even tell it which 4 to use. It will just choose the 4 itself which is what messes up the 360 controller. At the very least you should be able to drop the analog triggers in favor of another axis on the right stick if you still want to cap 4 axes.

I'm pretty new at using DosBox and haven't even begun to even consider attempting to foray into its source to try and make changes, so I just wanted to extend my gratitude for providing this change and the accompanying build. I can now play MechWarrior 2 using both Xbox 360 joysticks (whereas before I couldn't bind anything to the X axis of the right joystick). I'm kind of ecstatic now and am gonna spend the rest of the day in pure nostalgic bliss.

I would like to know, how I can interact with this patch (config options). I am using SVN-Daum, but I find no instructions, on what to do. I have a Logitech Rumblepad F710, which I got to get working with X-Wing and TIE-Fighter, but gives me headaches with Strike Commander. I can use the Joypad in the menu, but I get no functionality ingame. Whatever I chose, no luck. I also tried using it in DirectInput mode and XInput mode. Does it count, which input mode I use? I guess, since this patch was made for the XBox controller, originally, it should be XInput (the Joypad I am using can be switched to either)?

So, after having this patch applied (i.e SVN-Daum installed), what is the next step do do? Thanks a lot!