Author Topic: DOS VDM - USB and Game port Gamepad support  (Read 201050 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4934
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
DOS VDM - USB and Game port Gamepad support
« on: September 30, 2021, 11:33:38 pm »
Hi

At Warpstock there was a quick Q&A with Lewis and there was some talk about ArcaOS as a retro gaming platform.
There was some fast comment about gamepads/joysticks and DOS old games.

I asked on the FreeDOS mailinglist if there was something like a way to connect an USB gamepad and some "interpreter" that will allow old DOS games see it as a game port joystick. (So, in the end you can be able to play games that are supposed to use a game port joystick with an USB joystick).

Bret Johnson, that developed some USB device drivers for DOS (http://bretjohnson.us/) , answer me that it is possible with his driver, but under a very specific USB hardware set running FreeDOS.

The final idea will be to be able to support an USB gamepad under DOS VDM for old DOS games, but it seems we are still some steps behind.

I just post this as a discussion topic and maybe something of the open source DOS USB driver/program can be useful someday for the OS/2 platform.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Mentore

  • Full Member
  • ***
  • Posts: 198
  • Karma: +6/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #1 on: October 02, 2021, 11:02:28 am »
Hi

At Warpstock there was a quick Q&A with Lewis and there was some talk about ArcaOS as a retro gaming platform.
There was some fast comment about gamepads/joysticks and DOS old games.

I asked on the FreeDOS mailinglist if there was something like a way to connect an USB gamepad and some "interpreter" that will allow old DOS games see it as a game port joystick. (So, in the end you can be able to play games that are supposed to use a game port joystick with an USB joystick).

Bret Johnson, that developed some USB device drivers for DOS (http://bretjohnson.us/) , answer me that it is possible with his driver, but under a very specific USB hardware set running FreeDOS.

The final idea will be to be able to support an USB gamepad under DOS VDM for old DOS games, but it seems we are still some steps behind.

I just post this as a discussion topic and maybe something of the open source DOS USB driver/program can be useful someday for the OS/2 platform.

Regards

ISTR that Wim Brul developed usbecd**.zip "generic" drivers, which may be useful to understand/read classless devices. Maybe one could try these?

(Too bad I currently do not have an ArcaOS machine. Need time to install the latest beta for the italian NLV!)

Mentore

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4934
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: DOS VDM - USB and Game port Gamepad support
« Reply #2 on: October 02, 2021, 02:27:11 pm »
ISTR that Wim Brul developed usbecd**.zip "generic" drivers, which may be useful to understand/read classless devices. Maybe one could try these?

Hi Mentore

That may be interesting as a first step. Trying to see if with "USBRESMG.SYS" and/or the Wim Brul' drivers something came out of a USB gamepad attached to OS/2.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Lars

  • Hero Member
  • *****
  • Posts: 1344
  • Karma: +67/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #3 on: October 02, 2021, 03:55:32 pm »
US CALLS and USBRESMG are completely generic and you can set up any control,bulk,IRQ transfer that you want. But you will need some layer that maps the USB response packets to the packets that an analog or digital joystick would return (as far as I understand it).

Roderick Klein

  • Hero Member
  • *****
  • Posts: 676
  • Karma: +14/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #4 on: October 02, 2021, 04:04:47 pm »
This whole thing has two sides to it.

First of all its the device driver it self that needs to communicate with the USB joystick or gamepad. How that can be done. While writing the device driver should not be that difficult I do not know how well standardized gamepads and USB joysticks are.  Is there a USB class for such devices ?

However if you have an OS/2 driver that is the first step. What I do not know is if Wim Brull his driver or usbresmgr.sys can used for such a project.
USBRESMGR in my understanding seems to effectively a ring 3 to ring 0 device driver that enables you to use a DLL to control equipment from OS/2 with a DLL. A good example of this is TAME.

You then automatically come with the second portion. You will need a VDD for DOS sessions. This VDD would emulate a legacy Joystick. I think the hex address is 301 or for a Joystick port ? The VDD would need to capture port 301 and send the data from and to the USB OS/2 driver.

Since joysticks are so timing senstive a command given on a USB stick should arrive up at the game ASAP!
So you need a driver that the DOS VDM driver can directly talk at ring 0. I do not know if thsi can be done at ring0 with USBRESMGR.SYS or Wim Brul his driver.

Joystockv.sys (VDM driver)-> USB PDD->USB stack->Joystick

Roderick Klein

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4934
  • Karma: +44/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: DOS VDM - USB and Game port Gamepad support
« Reply #5 on: October 02, 2021, 05:24:47 pm »
Thanks.

I guess the idea will be something like this graphic, to have some gamepad/joystick support for ArcaOS with an USB gamepad.
The red squares are the things that do not exist.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4980
  • Karma: +109/-1
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #6 on: October 02, 2021, 05:42:07 pm »
First of all its the device driver it self that needs to communicate with the USB joystick or gamepad. How that can be done. While writing the device driver should not be that difficult I do not know how well standardized gamepads and USB joysticks are.  Is there a USB class for such devices ?

Joysticks are standardized USB Human Interface Devices (HID) https://en.wikipedia.org/wiki/USB_human_interface_device_class#Game_controllers so pretty standardized with one driver supporting most USB joysticks.

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #7 on: November 16, 2021, 02:21:56 am »
Hi

At Warpstock there was a quick Q&A with Lewis and there was some talk about ArcaOS as a retro gaming platform.
There was some fast comment about gamepads/joysticks and DOS old games.

I asked on the FreeDOS mailinglist if there was something like a way to connect an USB gamepad and some "interpreter" that will allow old DOS games see it as a game port joystick. (So, in the end you can be able to play games that are supposed to use a game port joystick with an USB joystick).

Bret Johnson, that developed some USB device drivers for DOS (http://bretjohnson.us/) , answer me that it is possible with his driver, but under a very specific USB hardware set running FreeDOS.

The final idea will be to be able to support an USB gamepad under DOS VDM for old DOS games, but it seems we are still some steps behind.

I just post this as a discussion topic and maybe something of the open source DOS USB driver/program can be useful someday for the OS/2 platform.

Regards

Hi Martin!

Interestingly, I was just about to broach the subject of whether there is some way to support use of USB joysticks under ArcaOS, as I've been reinstalling a lot of legacy games as well as SDL and Java games lately, so an interesting topic to me.

A few years ago, I purchased an item from Logilink in the EU which is called a USB 2.0 to Gameport adapter, which is a neat little device, which allowed me to connect one of the original Thrustmaster joysticks (made of metal) with a gameport connector to a usb port, to allow it to be used on newer computers under Windows. It works very well in situations like that. I don't know how the translation was done from the gameport connection to USB.

I've attached a couple of pictures of the adapter below. I don't think it is available for sale anymore retail as Amazon here lists it with a caveat of "not available". May still be available on eBay.

Mark
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #8 on: November 16, 2021, 05:58:31 am »
First of all its the device driver it self that needs to communicate with the USB joystick or gamepad. How that can be done. While writing the device driver should not be that difficult I do not know how well standardized gamepads and USB joysticks are.  Is there a USB class for such devices ?

Joysticks are standardized USB Human Interface Devices (HID) https://en.wikipedia.org/wiki/USB_human_interface_device_class#Game_controllers so pretty standardized with one driver supporting most USB joysticks.

Hi Dave!

Do you, or does anyone else know if the OS/2/eCS/ArcaOS version of DOSBOX has Joystick support built in?

I was reading this article tonight and it raised an interesting question:

https://itstillworks.com/12226738/how-to-use-usb-joysticks-with-dosbox

It seems that Windows versions of DOSBOX can recognize Joysticks, if the devices are recognized by Windows, and assuming that joystick support exists in the DOS software being emulated by DOSBOX.

Would that simplify the process, and only require a driver under OS/2/eCS/ArcaOS for USB Joysticks (or perhaps items like the USB 2.0 to Gameport adapter I mentioned) to address DOSBOX? Not being a programmer, but being a troubleshooter, I thought the question needed asking.

You have to admit that the majority of legacy games that we would require direct support for would be either DOS or legacy Windows 3.1 (mostly flight simulators, or shoot'em up games), I would assume.

I don't know if any Java games have or need such support.

I also don't know of many games that are native OS/2 that have ever needed Joystick or Gamepad support (well perhaps Galactic Civilizations or Trials of Battle).

Best!

Mark
« Last Edit: November 16, 2021, 06:00:05 am by Mark Szkolnicki »
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4980
  • Karma: +109/-1
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #9 on: November 16, 2021, 06:05:43 am »
Seems to me that adding joystick support to SDL would be relatively easy, at least compared to writing device drivers. I'd assume that it would also give joystick support to DosBox. I'm not really a programmer so haven't looked into it.

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #10 on: November 16, 2021, 02:56:24 pm »
Seems to me that adding joystick support to SDL would be relatively easy, at least compared to writing device drivers. I'd assume that it would also give joystick support to DosBox. I'm not really a programmer so haven't looked into it.

HI Dave!

Probably wouldn't do much good in SDL, as I've seen few games with complex input requireemnts (maybe gamepad support?)

Interestingly I did some further reading in the DosBox Wiki on Wikipedia and found some interesting facts:

https://en.wikipedia.org/wiki/DOSBox#Hardware_emulation

DOSBox uses the Simple DirectMedia Layer external library to not only build new versions of DOSBox from source, but also handle graphics, audio, and input devices.

It can simulate the PC joystick port, with limited options being to emulate one joystick with four axes and four buttons; one gamepad with two axes and six buttons; two joysticks each with two axes and two buttons; a Thrustmaster Flight Control System joystick that has three axes, four buttons, and a hat switch; and a CH Flightstick with four axes, six buttons that can be pressed only one at a time, and a hat switch. Newer joysticks and gamepads will need to use one of these configurations to function.


So actually a very sophisticated piece of software, building on the original Simple DirectMedia layer external library.

As we have an ArcaOS version of DosBox which works well already (I have over 60 games running under DosBox). it seems the problem may be simplified to how to get USB input devices to address ArcaOS, and how to get the OS to address DosBox, as the architecture already exists within the emulator, as DosBox is really the standard go to now for all platforms, for people who want to run most DOS games at least. Don't know about any other legacy DOS programs.

But it is really Games and Input devices were talking here, so it may be very applicable.

I'm not a programmer as well, so I don't know how much it would simplify or complicate matters. I know Joystick drivers were written in the past to address gameport devices under OS/2. Perhaps they could be a framework to start the process.

Best as always!

M
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Roderick Klein

  • Hero Member
  • *****
  • Posts: 676
  • Karma: +14/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #11 on: November 16, 2021, 04:14:43 pm »
Thanks.

I guess the idea will be something like this graphic, to have some gamepad/joystick support for ArcaOS with an USB gamepad.
The red squares are the things that do not exist.

Regards

If you want the DOS VDM and the VDD communicate with the USB joystick you will need to have the knowlegde of the SDL library in a driver. That can be a PDD or a VDD. That is tricky part of supporting the VDM. And the VDD has to have code to "trap" I/O instructions so they are routed to the USB device.

Roderick

Roderick Klein

  • Hero Member
  • *****
  • Posts: 676
  • Karma: +14/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #12 on: November 16, 2021, 04:26:52 pm »
Seems to me that adding joystick support to SDL would be relatively easy, at least compared to writing device drivers. I'd assume that it would also give joystick support to DosBox. I'm not really a programmer so haven't looked into it.

HI Dave!

Probably wouldn't do much good in SDL, as I've seen few games with complex input requireemnts (maybe gamepad support?)

Interestingly I did some further reading in the DosBox Wiki on Wikipedia and found some interesting facts:

https://en.wikipedia.org/wiki/DOSBox#Hardware_emulation

DOSBox uses the Simple DirectMedia Layer external library to not only build new versions of DOSBox from source, but also handle graphics, audio, and input devices.

It can simulate the PC joystick port, with limited options being to emulate one joystick with four axes and four buttons; one gamepad with two axes and six buttons; two joysticks each with two axes and two buttons; a Thrustmaster Flight Control System joystick that has three axes, four buttons, and a hat switch; and a CH Flightstick with four axes, six buttons that can be pressed only one at a time, and a hat switch. Newer joysticks and gamepads will need to use one of these configurations to function.


So actually a very sophisticated piece of software, building on the original Simple DirectMedia layer external library.

As we have an ArcaOS version of DosBox which works well already (I have over 60 games running under DosBox). it seems the problem may be simplified to how to get USB input devices to address ArcaOS, and how to get the OS to address DosBox, as the architecture already exists within the emulator, as DosBox is really the standard go to now for all platforms, for people who want to run most DOS games at least. Don't know about any other legacy DOS programs.

But it is really Games and Input devices were talking here, so it may be very applicable.

I'm not a programmer as well, so I don't know how much it would simplify or complicate matters. I know Joystick drivers were written in the past to address gameport devices under OS/2. Perhaps they could be a framework to start the process.

Best as always!

M

I really wonder how good a DLL is going to work timing wise and then the commands from the USB gamepad or joystick have to end up with the game.
This is extremely timing sensitive. I doubt Dosbox with a ring 3 DLL and usbresmgr.sys can be responsive enough and that the communication becomes to slow.
When you hit the firebutton the game should receive and process this command ASAP.

The DOS VDM I think has better performance then DOSbox.

Roderick

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #13 on: November 16, 2021, 05:26:58 pm »
Hi Roderick!

As to your comments I can't really say, not being able to try input devices on ArcaOS DosBox at the moment. You are far more familiar with the architecture involved based on your involvement with the entire OS/2 based line of OS's in the past, but that has peeked my interest.

I think it would be interesting to set up DosBox on one of my other Windows partitions (Windows XP or 7), and try running a game that uses the Thrustmaster Control System as I have Joystick and Throttle, and see just how fast it responds. It is probably the most complex input array DosBox is programmed to handle.

As the equipment I have is set up for gameport, it would also allow me to test how it responds through the Logilink USB adapter box I have.

Best!

Mark
Vincit Que Se Vincit - "He Who Conquers Self Succeeds"

Mark Szkolnicki

  • Sr. Member
  • ****
  • Posts: 454
  • Karma: +18/-0
    • View Profile
Re: DOS VDM - USB and Game port Gamepad support
« Reply #14 on: November 16, 2021, 08:15:24 pm »
Seems to me that adding joystick support to SDL would be relatively easy, at least compared to writing device drivers. I'd assume that it would also give joystick support to DosBox. I'm not really a programmer so haven't looked into it.

Hi Dave!

It shows that I'm a Luudite when it comes to software technobabble.
(The reason I'm a hardware geek)

Of course SDL = Simple DirectMedia Layer - and from reading the Wikipedia Wiki, it seems DosBox is running the SDL libraries and is essentially an SDL program. Duh!

I reached out to Jochen Schäfer, whose porting DosBox to ask two questions:

1) In his ports, is the OS/2 DosBox code related to Input Devices still present? I noted in the .conf file for the ArcaOs inplementation a section exists under "Joysticks", but I'm sure would not work if we have no frontend USB Input driver under ArcaOS. Addressing your comment, if it is already there, NFAR, which is why I suggested this may be a solution to the problem presented, related to DOS.

2) I also wanted to know if he had some idea of how well Input Devices worked when captured by DosBox (timing, response, implementation), under other OS's, if he had some knowledge in the matter? I agree with Roderick, that would be a key factor as to whether DosBox or a native VBM would be an option.

2Roderick: I also had a follow-up question - for the frontend native USB driver, would there be any different programming required in the ArcaOS input driver to address either a VDM or DosBox? If not, the worst that could happen, if code exists in the current ArcaOS DosBox, is that it works poorly on capture of the Input device, and then a VDM could be developed, as a follow-on.

Perhaps the focus should be on getting a native USB Input Driver first, if that's possible, in whatever manner necessary?

As mentioned, just asking dumb questions, Guys and Gals, because I'm not aware of how labour intensive development of either (native USB driver / Dos VDM) would be. And being a consultant for 28 years, I know how the devil is in the details ......... and the personnel time and cost involved.

Best as always!

M

Vincit Que Se Vincit - "He Who Conquers Self Succeeds"