INPUT - Enabling Settlers 2 Multiplayer

Here you can discuss the development of patches.

INPUT - Enabling Settlers 2 Multiplayer

Postby Yonibear » 2009-1-02 @ 00:01

Bored on new years eve, we decided that we wanted to play Settler 2 multiplayer through dosbox on Linux. For those who do not remember, Settler's multiplayer solution was to split screen and attach a second mouse to the COM Port.
Unfortunately the basic X11 API does not provide a way to distinguish between mouses (We are investigating the usefulness of XInput though). The only solution is to use the evdev devices (/dev/input/event*) and grab the raw mouse events. To make this a bit simpler, we used the input library libGII, which offered a driver using these input devices.
We implemented a serial port driver to emulate the second mouse, and still use dosbox' PS/2 emulation for the primary mouse. This means that the second mouse must be made invisible to X, since it generates both evdev and X CorePointer events. Newer Xservers using the evdev input driver use HAL to detect the available input devices. Our quick solution was to create a HAL policy that blocks the second mouse to be used by X11.

With a patched dosbox version, your dosbox.conf should have a section like this:
Code: Select all
serial1=mouse giidriver:input-linux-evdev:/dev/input/event4

You have to figure out the correct /dev/input/event* yourself, and also may have to chown it to 666, because current distributions usually do not make it user readable.
You can try other GII drivers on your own, but beware, since your computer will propably explode.

If you start the game now, you will notice that the secondary mouse will control both player. To prevent the second mouse being detected by X, you have to create a special HAL policy.
First you will have to find out the exact vendor and product ID of your mouse with lsusb (first column).
Then you create a file named like 10-dosbox-mouse.fdi and place it in /etc/hal/fdi/policy/ .

The file content should look like this, adapt it with your USB IDs:
Pay attention that leading zero's are stripped, so that 046d:c018 from lsusb gets converted to usb_device_46d_c018, like in the example.

Code: Select all
<?xml version="1.0" encoding="ISO-8859-1"?>
<deviceinfo version="0.2">
    <match key="info.capabilities" contains="input.mouse">
      <match key="info.udi" contains="usb_device_46d_c018">
        <merge key="input.x11_driver" type="string"></merge>

Restart HAL, replug the mouse and enjoy your dysfunctional mouse. To reverse, just delete the .fdi file and repeat.

We are aware that this is not really a solid solution yet. We are currently investigating if we can achieve grabbing of a certain mouse with XInput, but the state of Linux APIs in this field seems to be rather sorry.
You do not have the required permissions to view the files attached to this post.
Posts: 1
Joined: 2009-1-01 @ 23:28

Re: Enabling Settlers 2 Multiplayer

Postby bugs_bugger » 2009-1-02 @ 16:05

Sounds like great work. I did not try your patch though, as I own a serial mouse to play Settlers 2 multiplayer games. I think you should split your project into two parts. One that is OS independent and one that is OS dependent and connect them trough Network. The task of the first part would be to receive network packages and to translate them into the serial mouse protocol. The second part would be responsible for grabbing the mouse which also could happen on a different PC. In comination with transmitted image and sound it could lead to Network play and also solve the problem of two mice at one X11 screen. Your project would also become less OS dependent.
Posts: 127
Joined: 2006-1-23 @ 15:11
Location: Germany

Re: Enabling Settlers 2 Multiplayer

Postby wd » 2009-1-07 @ 08:33

Looks like fun :)

You might want to check out sdl 1.3, specifically the manymouse tree
(don't know if this is merged into the development tree) : ... manymouse/
DOSBox Author
Posts: 10818
Joined: 2003-12-03 @ 21:23

Re: Enabling Settlers 2 Multiplayer

Postby anamika » 2014-9-12 @ 09:08

It's probably not possible to get MIDI daugtherboards working in Win7, as Microsoft removed support for DB15 joystick ports due to the performance hit from having to poll them. As a result, Creative dropped all support for the whole joystick+MPU401 subsystem of their cards. I found this out the hard way when I tried putting my old SB Live in a Win7 machine to use as an MPU401 interface.
If you are looking for fast success in exams then join today to explore complete Rochester College dumps resources.
Posts: 1
Joined: 2014-9-12 @ 09:02

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 1 guest