It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
high rated
This is something that has been bugging me whenever I see a problem concerning DOSBox and being able to use a Xbox 360 or XInput controllers to play older DOS games. Usually when this problem crops up, the most common answer I see is "use programs like Xpadder or JoyToKey" to get around this. The thing is the answer is already within DOSBox, it just requires a few config edits.

[joystick]
# joysticktype: Type of joystick to emulate: auto (default), none,
# 2axis (supports two joysticks),
# 4axis (supports one joystick, first joystick used),
# 4axis_2 (supports one joystick, second joystick used),
# fcs (Thrustmaster), ch (CH Flightstick).
# none disables joystick emulation.
# auto chooses emulation depending on real joystick(s).
# (Remember to reset dosbox's mapperfile if you saved it earlier)
# Possible values: auto, 2axis, 4axis, 4axis_2, fcs, ch, none.
# timed: enable timed intervals for axis. Experiment with this option, if your joystick drifts (away).
# autofire: continuously fires as long as you keep the button pressed.
# swap34: swap the 3rd and the 4th axis. can be useful for certain joysticks.
# buttonwrap: enable button wrapping at the number of emulated buttons.

joysticktype=auto
timed=true
autofire=false
swap34=false
buttonwrap=false
Here are the default settings DOSBox's joystick settings, but the glaring problem these settings for Xbox 360 or XInput controllers is not being able to use the D-Pad and the analog stick not working properly. After fiddling around the settings and looking up the solutions to these problems, these are the settings I use for some of the DOS games I play under DOSBox. You might also want to reset the mapper file (usually it's "mapper-0.74.map" by default for v0.74) or delete it before you change anything; you can save a new one once you made the appropriate changes. What you need to do is set "joysticktype" to fcs and "timed" needs to be set to false. By doing this, your D-Pad should work (thanks to [fcs] enabling the D-Pad/Hat swtiches) and the analog sticks won't drift away (caused by "timed" being set to [true]).

Now what if a particular game doesn't give you the ability to rebind the inputs for the controller or calibrate the analog sticks, either in-game or as a separate set-up program? This is where DOSBox's keymapper comes in (special thanks to F4LL0UT for this). By pressing Ctrl+F1, you'll get a screen like this: http://i.imgur.com/Ac83yEV.png

The keymapper is kinda like DOSBox's Xpadder though not as advanced but gets the job done for the most part. If you want to bind a certain key to a controller input, let's say binding the arrow keys to the Xbox 360's controller's D-Pad, first you click the key on the on-screen keyboard for the arrow keys, then click on "Add" on the menu where you will be prompt to add another input to the command (e.g. bind Arrow Key Up to D-Pad Up, Return/Enter Key to Start, Gamepad Button 1 on the Xbox 360 controller's A Button). The same can be done for keyboard inputs, like mapping WASD to the Arrow Keys for Abuse.

Unfortunately this isn't the "end-all-be-all" solution for rebinding inputs on a controller. So far this worked on some fighting games like One Must Fall 2097 or Super Street Fighter II: Turbo, shoot 'em ups like Tyrian 2000, and platformers Jill of the Jungle or Genocide 2: Master of the Dark Communion. Older first-person shooter games like Doom aren't to keen when it comes to rebindable inputs for a controller as the horizontal axis on the right stick doesn't work for some reason; the SVM Duam build does get around this but for some reason I can't sprint and shoot at the same time (it could be something I did with the config file though). There's also the inability to rebind mouse inputs such as the left or right click, mouse movement, and the scroll wheel on the original DOSBox's keymapper, so you're out of luck for point-and-click games or if you're planning to play Abuse on a controller unless you get Xpadder or similar programs.

I hope this can help some people out with playing games on DOSBox.
Post edited February 10, 2020 by AmethystViper
Really great post! I've looked into a few different topics trying to get xbox 360 controllers to play Commander Keen (among other things) and this worked like a charm.

Thanks!
Thank you for this.
Well, tried that, didn't work. I keep my analog sticks and d-pad not working.
high rated
My DOSBox build (DOSBox ECE) now supports all the axis (up to ten) and the hat (up to two) even when joysticktype isn't set to fcs. So you should be able to use/map it even with default config.
This is all a bit confusing at first. I wanted to use the D-Pad on my X360 controller to control DOS games, just like an old-fashioned Gravis gamepad.

The problem: By default, Dosbox assigns the left analog stick as the main controller axis. This cannot be changed in the config. For most games, this means you cannot use the D-Pad to control the game natively.

The solution: Your only option is to switch your game to keyboard mode, then remap the keyboard arrow keys to your D-Pad using the DOSBox mapper tool. Start DOSBox, press CTRL+F1 to bring up the mapper tool, click one of the arrow keys in the upper right corner, click "add" at the bottom, then press the corresponding direction on the D-Pad. Repeat for the other directions, then click "save" at the bottom. As the game is now in keyboard mode, you will also have to remap all the remaining keyboard actions to the controller.

I know this has already been described at the beginning, I just wanted to give a quick explanation and solution for anyone who has the same problem.
Post edited April 15, 2018 by jballhgg
Thanks for your post, it was really helpful. I just thought I'd add my own input for anyone who might still be struggling with this. This is how I got the D-Pad working with Rayman Forever, so hopefully this method should apply to other DOS games too:
(PS. You can use this method for any controller)

By default, your controller may be recognised by the game as a virtual joystick, and will be mapped to that virtual joystick in the DOSBox mapper screen. If so, then you wouldn't want the controller mapped to this virtual joystick, since it could conflict with how you'd map it to the DOSBox keyboard. So therefore you should first unmap it from the virtual joystick in the DOSBox mapper screen. Then you'd be able to map it to the DOSBox keyboard with no problems.

However after doing this, the game will still recognise the controller as a virtual joystick (just that it will no longer recognise any controller button presses as virtual joystick button presses, since you've unmapped the controller from the virtual joystick). This wouldn't usually be a problem, but because it recognises the controller as a virtual joystick, it may still ask you to configure the joystick when you first start up the game. You won't be able to do this now though since you've unmapped the controller from the virtual joystick, so you'd just have to skip this configuration. You may think that this wouldn't matter, but this can actually cause the controls to mess up for the game (it did with Rayman Forever anyway). Therefore, before unmapping the controller from the virtual joystick (and mapping it to the DOSBox keyboard instead), you would have to first start up the game and go through this initial configuration. Then once you've done this, you can do all the mapping then.

1. Install the game
2. Connect the controller to your PC (make sure there are no other controllers connected as well)
3. If the game does require you to configure the joystick when you first start up the game, then you will need to do that now. So start up the game and proceed through this joystick configuration. Then once you reach the game's main menu, exit the game again
4. Open the 'DOSBOX' subfolder in the game's folder
5. Click on 'DOSBox.exe'
6. Hold Ctrl and press F1
7. To unmap the controller from the virtual joystick, you'll need to delete all the controller button mappings from each of the virtual joystick buttons. To delete a button mapping, simply click on a virtual joystick button, and then click 'Del' on-screen. In the DOSBox mapper screen, you'll see three sections, named 'Axis 1/2', 'Axis 3/4' and 'Disabled'. In each of these sections will be a number of buttons. The controller buttons will be automatically mapped to all of these, so you must now delete all these mappings
8. To map a controller button to a DOSBox keyboard key, first left-click on a key on the on-screen keyboard, then click 'Add', then press a button on the controller. Map all the controller buttons to the appropriate DOSBox keys
9 Once you've finished all this, click Save
10. Click Exit
11. Close DOSBox
12. Go back to the game's main folder
13. In a separate window, go to the location "C:\Users\(User)\AppData\Local\DOSBox"
14. Move the 'mapperfile=mapper-0.74-2.1.map' file in that location into the game's folder alongside the game's .conf file
15. You can then delete the other 'dosbox-0.74-2.1.conf' file in that location and you can delete the 'DOSBox' folder altogether from the 'Local' folder
16. In the game's folder, rename the .map file that you just moved there to something more suitable like 'Xbox360Controller.map' or something (just make sure that you don't use any spaces in it though)
17. There should be a .conf file in the game's folder, open this in a text editor like Notepad
18. There is a name in the text, called 'mapperfile', the value of it should be the same as the name of the .map file you just moved into the game's folder (ie. Xbox360Controller.map). So rename its value to that
19. There is another name in the text, called 'joysticktype', that has a value called 'auto'. Change this value to 'fcs'
20. There is one more name in the text, called 'buttonwrap', that has a value called 'true'. Change this value to 'false'
21. Save these changes you've made to the .conf file

If you want to set up another controller with the game, you can connect this controller to your PC now as well (make sure to disconnect all other controllers first though), and then proceed through steps 4-16 above again in order to map this new controller. Then whenever you wish to switch between controllers, you must open the game's .conf file and change the value of the 'mapperfile' to the name of your desired controller's .map file.
Post edited March 11, 2022 by AllHallowSteve
avatar
jballhgg: This is all a bit confusing at first. I wanted to use the D-Pad on my X360 controller to control DOS games, just like an old-fashioned Gravis gamepad.

The problem: By default, Dosbox assigns the left analog stick as the main controller axis. This cannot be changed in the config. For most games, this means you cannot use the D-Pad to control the game natively.

The solution: Your only option is to switch your game to keyboard mode, then remap the keyboard arrow keys to your D-Pad using the DOSBox mapper tool. Start DOSBox, press CTRL+F1 to bring up the mapper tool, click one of the arrow keys in the upper right corner, click "add" at the bottom, then press the corresponding direction on the D-Pad. Repeat for the other directions, then click "save" at the bottom. As the game is now in keyboard mode, you will also have to remap all the remaining keyboard actions to the controller.

I know this has already been described at the beginning, I just wanted to give a quick explanation and solution for anyone who has the same problem.
The dpad will show up in the mapper if you try to map it but in game it won't see whatever you have mapped to the dpad. this is very unfortunate because some games just work better with a d pad than a joystick
So, how do I do that keymapper in DosBox on a chromebook that does not have F1 to F12 keys?
avatar
EspyLacopa: So, how do I do that keymapper in DosBox on a chromebook that does not have F1 to F12 keys?
Is there no onscreen keyboard with Function keys (Fn) in Chrome OS?

Edit: https://appuals.com/use-chromebook-function-keys/
Post edited February 08, 2020 by teceem
avatar
EspyLacopa: So, how do I do that keymapper in DosBox on a chromebook that does not have F1 to F12 keys?
avatar
teceem: Is there no onscreen keyboard with Function keys (Fn) in Chrome OS?

Edit: https://appuals.com/use-chromebook-function-keys/
See, I tried that combo (search + 1 for F1, plus ctrl). . but that just closed DosBox. And the Ctrl+Alt+/ just opened up a search dialogue for various keys, not a virtual keyboard.
avatar
teceem: Is there no onscreen keyboard with Function keys (Fn) in Chrome OS?

Edit: https://appuals.com/use-chromebook-function-keys/
avatar
EspyLacopa: See, I tried that combo (search + 1 for F1, plus ctrl). . but that just closed DosBox. And the Ctrl+Alt+/ just opened up a search dialogue for various keys, not a virtual keyboard.
start dosbox with the -startmapper commandline parameter
avatar
EspyLacopa: See, I tried that combo (search + 1 for F1, plus ctrl). . but that just closed DosBox. And the Ctrl+Alt+/ just opened up a search dialogue for various keys, not a virtual keyboard.
avatar
Qbix: start dosbox with the -startmapper commandline parameter
Sounds like a great idea.


How do I do that on a Chromebook using the Google Chrome app version of DosBox?
avatar
Qbix: start dosbox with the -startmapper commandline parameter
avatar
EspyLacopa: Sounds like a great idea.

How do I do that on a Chromebook using the Google Chrome app version of DosBox?
I don;t know.
I only write the "normal" version of it.
You can try the Linux version of DOSBox, according to the git webpage the person who worked on Chrome for DOSBox stopped working on it:

https://www.androidpolice.com/2018/08/19/install-linux-applications-chrome-os/

If the same issue then something is going wrong with your OS and/or keyboard.