VOGONS


First post, by cfoesch

User metadata
Rank Newbie
Rank
Newbie

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...

Attachments

  • Filename
    dosbox-joystick-patch.diff
    File size
    3.39 KiB
    Downloads
    2446 downloads
    File comment
    Patch to raise limits on event scans for axes and hats so that they can be bound even if they're not being emulated.
    File license
    Fair use/fair dealing exception

Reply 1 of 17, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

DOSBox was arbitrarily capping the axes and hats to only what was being emulated.

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 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".

Reply 2 of 17, by ADDiCT

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 3 of 17, by cfoesch

User metadata
Rank Newbie
Rank
Newbie

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.

Reply 4 of 17, by cfoesch

User metadata
Rank Newbie
Rank
Newbie

@ADDiCT attached, I have the Windows binary I built from the raw SVN tarball with patch applied.

Wide testing base == good.

Attachments

  • Filename
    DOSBox-Joystick-patch.zip
    File size
    1.15 MiB
    Downloads
    2171 downloads
    File comment
    DOSBox.exe with Joystick patch applied.
    File license
    Fair use/fair dealing exception

Reply 7 of 17, by aireca

User metadata
Rank Newbie
Rank
Newbie

@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.

Reply 9 of 17, by aireca

User metadata
Rank Newbie
Rank
Newbie
mgtroyas wrote:

Taewoong's SVN build has added this patch. I'll try my logitech F710 in X360 mode to test it's effect.

http://ykhwong.x-y.net/

Yeah, i asked him to add this patch, i'm very glad he did it, i don't have experienced any trouble during this 2 months of use. 😊

Reply 10 of 17, by Xenphor

User metadata
Rank Member
Rank
Member

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.

Reply 11 of 17, by iworkedatsubway

User metadata
Rank Newbie
Rank
Newbie

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.

@cfoesch, thank you!!!

Reply 13 of 17, by amix

User metadata
Rank Newbie
Rank
Newbie

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!

Andreas

Reply 14 of 17, by InterClaw

User metadata
Rank Newbie
Rank
Newbie
cfoesch wrote:

@ADDiCT attached, I have the Windows binary I built from the raw SVN tarball with patch applied.

Wide testing base == good.

Thank you cfoesch. I've been using this SVN build of yours for ages now. Works great with DS3 and move controller on ScpToolkit.

Would it be possible to ask of you a similar Windows binary based on DOSBox 0.74-2 with your patch applied?

Reply 15 of 17, by Yesterplay80

User metadata
Rank Oldbie
Rank
Oldbie
InterClaw wrote:

Would it be possible to ask of you a similar Windows binary based on DOSBox 0.74-2 with your patch applied?

You realized that the thread was dead for almost 5 years now, did you? 😉 Oh, and cfoesch hasn't been active here since 2011, btw.

However, my ECE build (see my signature) has his patch integrated and is based on the latest SVN, go give that one a try!

My full-featured DOSBox SVN builds for Windows & Linux: Vanilla DOSBox and DOSBox ECE (Google Drive Mirror)

Reply 17 of 17, by azn

User metadata
Rank Newbie
Rank
Newbie

Anyone have this patch that works with more recent SVN source please?

Take a look at my YouTube channel - totally dedicated to retro shooters