Main > Main Forum
Its time to give back...beginning work on Wiimote Driver
<< < (9/13) > >>
vputz:

--- Quote ---The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.
--- End quote ---

That's why you'll have to go the driver route.  Windows doesn't know what to do with more than one mouse (not quite true because obviously you can have multiple mice attached and could address them by different objects, but at the OS level they're welded into one pointer and most applications just ask for "THE mouse").  Linux is inching closer with recent merging of the multi-pointer X patch, but we won't see that for some time yet.

So the way to get this to work with MAME and multiple Wiimotes is to represent the Wiimote as a HID multi-axis joystick.  The driver hooks into the PnP system to load when the Wiimote is plugged in, but instead of passing the Wiimote's HID device descriptor to the system, you make up your own with several axes and several buttons, then write code to intercept the Wiimote's HID device reports, translate them to your own format, and send the messages out.

Google around for things like "hid filter driver WDM" and you can see some examples of things like this, although most examples are pretty simple ones and you'd be doing a bit more.  Should be quite doable, though.

gl.tter:
Hey, I'm gl.tter, the guy that wrote the C++ wiimote library WiiYourself!.

I just stumbled on this thread and thought I'll add a few things.  BTW vputz, I remember your SpaceOrb driver - I still have my 'sporb but never got around to using it properly.


--- Quote from: vputz on June 17, 2008, 03:30:08 am ---
--- Quote ---The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.
--- End quote ---

That's why you'll have to go the driver route.  Windows doesn't know what to do with more than one mouse <snip>

--- End quote ---

Not quite true, since XP there's the Raw Input API which does allow you to read multiple mice indenpently (I've implemented it on a project in the past).  I haven't looked at MAME in a long time, but apparently it already supports it.

Also the wiimote is not a USB device, but a Bluetooth device - and worse, although it reports as a generic Bluetooth joystick using the HID profile, it actually can't be read that way because it uses its own proprietary protocol (hence the need for libraries like mine).  On the bright side, my code can happily handle multiple 'motes - someone tested 8 sucessfully.
jban4us:

--- Quote from: gl.tter on June 17, 2008, 03:42:31 pm ---

--- Quote from: vputz on June 17, 2008, 03:30:08 am ---
--- Quote ---The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.
--- End quote ---

That's why you'll have to go the driver route.  Windows doesn't know what to do with more than one mouse <snip>

--- End quote ---

Not quite true, since XP there's the Raw Input API which does allow you to read multiple mice indepently (I've implemented it on a project in the past).  I haven't looked at MAME in a long time, but apparently it already supports it.

Also the wiimote is not a USB device, but a Bluetooth device - and worse, although it reports as a generic Bluetooth joystick using the HID profile, it actually can't be read that way because it uses its own proprietary protocol (hence the need for libraries like mine).  On the bright side, my code can happily handle multiple 'motes - someone tested 8 sucessfully.

--- End quote ---

Yeah when I was looking about how to do this earlier I stumbled into some raw input stuff. I put a link to what I found in my first post in this thread.

Like you said though the easiest way since the wiimote part is pretty convoluted is going through a library. If you absolutely think you have to write a driver, you should be able to read through some libraries to figure it out. The WiiLi wiki should also be helpful http://www.wiili.org. A C or C++ library shouldn't be too hard to turn into a driver, provided you actually know how to develop drivers.

*edit
I just saw you based yours off of brian peek's. I'd say that yours is probably the best bet.
wbassett:

--- Quote from: gl.tter on June 17, 2008, 03:42:31 pm ---Hey, I'm gl.tter, the guy that wrote the C++ wiimote library WiiYourself!.

I just stumbled on this thread and thought I'll add a few things.  BTW vputz, I remember your SpaceOrb driver - I still have my 'sporb but never got around to using it properly.


--- Quote from: vputz on June 17, 2008, 03:30:08 am ---
--- Quote ---The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.
--- End quote ---

That's why you'll have to go the driver route.  Windows doesn't know what to do with more than one mouse <snip>

--- End quote ---

Not quite true, since XP there's the Raw Input API which does allow you to read multiple mice indepently (I've implemented it on a project in the past).  I haven't looked at MAME in a long time, but apparently it already supports it.

Also the wiimote is not a USB device, but a Bluetooth device - and worse, although it reports as a generic Bluetooth joystick using the HID profile, it actually can't be read that way because it uses its own proprietary protocol (hence the need for libraries like mine).  On the bright side, my code can happily handle multiple 'motes - someone tested 8 sucessfully.

--- End quote ---
You'll have to forgive me since I'm a hardware guy and not a programmer... are you saying we should be able to use the Wii mote with Mame?  If it's no trouble could you do a short 'shopping' list of what we need and either a quick tutorial or links please? :)
gl.tter:

--- Quote from: wbassett on June 17, 2008, 08:26:26 pm ---You'll have to forgive me since I'm a hardware guy and not a programmer... are you saying we should be able to use the Wii mote with Mame?  If it's no trouble could you do a short 'shopping' list of what we need and either a quick tutorial or links please? :)

--- End quote ---

If you can use my library, it's easy - just follow the demo code + you'll need a calibration function (see my Q2 mod below for an example).  If you need to fake mouse events instead, you'll probably need to write a driver.  Or it might be easier to write a separate executable with my library that reads the 'mote(s) and fakes global mouse events (you'll have to research how).

Navigation
Message Index
Next page
Previous page

Go to full version