VOGONS

Common searches


Dosbox and XBOX 360 controller

Topic actions

First post, by Barret7sc

User metadata
Rank Newbie
Rank
Newbie

Well, I feel kinda silly about this. I recently got a XBOX 360 controller for emulators and such, and could not for the life of me get the dpad to work right in dosbox. I could map the controls just fine (it appears as a hat switch), but the bindings would never work in game.

I even went as far as downloading the source and started to hack in support for XINPUT (The API for the controller), before finding out the solution.

To make the dpad work right, set the joystick type to "fcs". The other joystick types don't emulate a hat switch, so, for whatever reason, the mapper never tries to run the events tied to the hat switch.

Personally, I think this is broken behavior, a physical hat switch is not always going to be mapped directly to the emulated one. Is this really intended behavior, and if so, why? 😉

Anyway, just in case anyone was wondering how to make that work, there you go.

Reply 1 of 37, by ADDiCT

User metadata
Rank Oldbie
Rank
Oldbie

It's silly to not treat the hat switch as a "joy1" device, but it's very much the standard. Sadly, the crappy MS drivers don't allow driver-based remapping of axes/buttons/etc. of the stick. I'm using my trusty old XBox controller most of the time, with the excellent XBCD driver. There is a hacked XBCD driver out there that supports the XBox 360 controller, with the full functionality of XBCD, though i didn't try it yet. The hacked driver also has full force feedback support for "old" games (before the DirectX API was switched - don't ask me what the correct terms for the old and new functionality are).

Reply 2 of 37, by Barret7sc

User metadata
Rank Newbie
Rank
Newbie

Still though, the mapper in dosbox should be what allows me to map the various functions of the controller to functions in dosbox.

It should not ignore the hat switch simply because the emulated joystick does not have one.

Reply 4 of 37, by Barret7sc

User metadata
Rank Newbie
Rank
Newbie
wd wrote:

It should not ignore the hat switch simply because the emulated joystick does not have one.

Don't see any problem with that.

Why is that not a problem? Or are you agreeing with me? My physical joystick has a hat switch. It should not matter if the emulated joystick has one or not for dosbox to be able to read the hat switch and map it to whatever virtual inputs I have it mapped to.

Am I making sense? heh. If I map the up on the hat switch of my physical joystick (in this case, the dpad on the xbox 360 controller), to the "A" key, it should always input an A in dosbox. No matter what kind of virtual joystick is set up in the emulator.

Reply 5 of 37, by general_vagueness

User metadata
Rank Member
Rank
Member

You seem to be missing one layer:
Only if DOSBox is looking for the specific virtual joystick that's been set up.
XBox 360 controller --> virtual Windows joystick --> virtual DOSBox joystick --> joystick percieved by the game
each one depends not on the hardware (because this isn't real DOS and direct I/O isn't allowed) but on what's directly below it
(I'm pretty sure) what wd's saying is DOSBox is looking to Windows (or whatever OS), and if it gets faulty information about a device, then that device might not work right in DOSBox

You cannot fall off the floor.
If you look hard enough, you'll find something you don't like.

How to ask questions the smart way
How to become a hacker
How to answer smart-alec questions

Reply 6 of 37, by wolf

User metadata
Rank Member
Rank
Member

So has anyone found a solution to this issue? I to cannot get the hat to work in games, even though I can map it. All the buttons work, and even though I tell the mapper to use the D-Pad for directions, it only works with the joystick.

Reply 11 of 37, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

Post exact information about the problem (this is the "issue" part) and about
your configuration including how EXACTLY you're remapping the joystick
stuff and how the game is configured joystick-wise.

Reply 12 of 37, by wolf

User metadata
Rank Member
Rank
Member

It is identical to the first post. DOSBox recognizes the controller, and in the mapper, all the buttons are good from the get go, but when I map the directions to be D-Pad, it maps just fine and I see it switching the the D-Pad directions, but when I play a game, all the buttons are good, except the D-pad doesn't work, only the left joy stick.

Reply 13 of 37, by jal

User metadata
Rank Oldbie
Rank
Oldbie
wd wrote:

including how EXACTLY you're remapping the joystick

wolf wrote:

It is identical to the first post.

It seems, dear Mr. wolf, you have a problem in complying to the requests of those who are the most likely to be able to help you. That does usually not advantageously advance the situation to your benefit.

JAL

Reply 14 of 37, by MiniMax

User metadata
Rank Moderator
Rank
Moderator

Maybe he comes from the same culture as mr. imachavel.

DOSBox 60 seconds guide | How to ask questions
_________________
Lenovo M58p | Core 2 Quad Q8400 @ 2.66 GHz | Radeon R7 240 | LG HL-DT-ST DVDRAM GH40N | Fedora 32

Reply 15 of 37, by wolf

User metadata
Rank Member
Rank
Member

I am not sure what brought the wise remarks towards me, but, What exactly are you wanting me to post then. I don't have as much experience as you God's, and thats why I am here, learning. WD is taking the time to help me and I am extremely grateful! Thank you WD.
If making fun of people posting is your thing, start a thread. Otherwise, let people who care to help, like WD, continue being helpful.

He asked what is the problem, and I said the D-pad is not working even though it is recognized in the mapper and when set to the directions, but doesn't do anything in game.
I mentioned it is identical to first post to try and spare him repetition, by no means did I try to be as rude as you two.
However I did forget to mention how game is configured, I appoligize. In game there is no configuration settings. It just asks if you want to use a joystick. I am using the game "Prince of Persia 2: The Shadow and The Flame". Just incase that might help. But the same thing happens to all games.

Reply 16 of 37, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

He asked what is the problem, and I said the D-pad is not working even though it is recognized in the mapper and when set to the directions, but doesn't do anything in game.

Well that's way too unspecific to give any advice. Post exactly how you did
the remapping, which exact part of the hat doesn't work etc.

Reply 17 of 37, by wolf

User metadata
Rank Member
Rank
Member

ok sorry...
In the mapper I manually changed the up, down, left, right using the D-Pad. I saw it change accordingly, and also made sure it wasn't mapping the same as the directions for the joystick, which it wasn't. I didn't have to map any buttons since they were all working perfectly just by chosing the controller. Making sure it was saved, I tried POP2. Ingame setting is set to use a controller, all the buttons work great, however then D-Pad does nothing (all directions). Yet the joystick works even though I didn't set it use the joystick. I tried using all the controller types in the config, and most just didn't work. So I just use the default.
I also tried this with multiple games, and same thing. D-Pad just doesn't want to work.

Reply 18 of 37, by wd

User metadata
Rank DOSBox Author
Rank
DOSBox Author

In the mapper I manually changed the up, down, left, right using the D-Pad.

That's still very unspecific, like are you remapping the emulated up/down
cursor keys to hat stuff, or joystick directions or whatever.
I still don't have any clue what you want to do, what you tried, and what
"went wrong" in any sense.