VOGONS

Common searches


First post, by Fitzbattleaxe

User metadata
Rank Newbie
Rank
Newbie

I'm encountering an add issue while trying to get my joystick working through DOSBox, and it's unclear to me whether it's a problem with DOSBox, the game itself (Mechwarrior 2), or something else entirely.

I have my physical joystick mapped to a virtual joystick by way of Joystick Gremlin and VJoy, and DOSBox is taking the virtual joystick as input using the 4axis joysticktype. In the Mapper, everything seems to be bound the way I want it, including 4 buttons, but no hat switch.

In game, however, I discovered rather by accident that if I press two of the mapped VJoy buttons at the same time, it's being interpreted as the 'left' direction of a hat switch (noting again that I didn't intend to have anything bound to a hat at all, much less some odd two-button combination).

To be honest, I'm not really sure how to go about diagnosing this. If the game is getting a hat input, it's presumably coming from DOSBox, but there's no hat mapping configured so far as I can tell. But by the same token, I also can't find anything in the game configuration that would cause two non-hat inputs to be interpreted as a hat. So my questions, then, would be (1) Is this a known issue of any kind, and if so, how do I address it? and (2) If it isn't a known issue, then any suggestions on how I might determine whether it's a DOSBox issue vs a Mechwarrior 2 issue?

Thanks

Reply 1 of 3, by thp

User metadata
Rank Member
Rank
Member

This is how it was encoded.

The gameport only exposes 8 bits:

Joystick X and Y axis (2x)
Joystick button A, B (2x)

In addition, since Y and Y need more than one bit, the way to read those was to reset a timer and continuously read the port until the bit flips and the time it takes is the measurement on that axis.

4-button joystick is just the two buttons of the second joystick, and throttle is usually one of the two axes of the second joystick.

More advanced joysticks (e.g. Sidewinder) encode bit patterns in the 4 button bits (and require special drivers), which is what you are seeing.

Configuring the right joystick type (2-button joystick without throttle and without hat) should prevent the issues you are seeing.

See also:
https://github.com/necroware/gameport-adapter … igital-joystick

Reply 2 of 3, by thp

User metadata
Rank Member
Rank
Member

Looks like CH Flightstick Pro encodes the hat this way:

https://github.com/necroware/gameport-adapter … tstickPro.h#L39

    // Unfortunately I had no real CHFlighstickPro joystick to test, but
// Sidewinder 3D Pro has an emulation for CHFlighstickPro. So, this
// implementation was made using that emulation and could be wrong.
// CHFlighstickPro seems to be a very interesting joystick. It doesn't
// allow the user to press multiple buttons simultaneously and uses
// combined buttons invocations as hat switch codes instead. So, every
// time a multiple buttons seem to be pressed, means that the user is
// actually using the hat switch.