Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: Its time to give back...beginning work on Wiimote Driver  (Read 67428 times)

0 Members and 1 Guest are viewing this topic.

vputz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 115
  • Last login:August 23, 2010, 08:16:05 am
  • I'm a llobter!
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #40 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.

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

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 185
  • Last login:October 10, 2009, 04:53:44 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #41 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
The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.

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

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.
« Last Edit: June 18, 2008, 02:02:39 am by gl.tter »
author of the Quake2 and Half Life Act Labs lightgun conversions:


jban4us

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 63
  • Last login:July 08, 2013, 12:06:49 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #42 on: June 17, 2008, 08:11:30 pm »

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

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

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.

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.
« Last Edit: June 17, 2008, 08:23:55 pm by jban4us »

wbassett

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 424
  • Last login:March 12, 2023, 04:34:49 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #43 on: June 17, 2008, 08:26:26 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
The hardest part is making "multiple" mice for two player games. I haven't the slightest idea how you would go about this.

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

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.
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

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 185
  • Last login:October 10, 2009, 04:53:44 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #44 on: June 18, 2008, 02:11:23 am »
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? :)

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).

author of the Quake2 and Half Life Act Labs lightgun conversions:


vputz

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 115
  • Last login:August 23, 2010, 08:16:05 am
  • I'm a llobter!
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #45 on: June 18, 2008, 05:15:32 am »
Quote
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.

Ah... well, if MAME supports it already then that's an option.

Quote
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

My mistake, but I don't think that will change much; you can still intercept the device creation event, substitute your own HID device descriptor, create a virtual device, and make a filter driver.  I never quite got the hang of destroying devices (thus the problems with the sporb driver, grr) but you've got a somewhat more sensible situation here since you should get the appropriate events through the bluetooth system, and since you could make both a mouse and a joystick device (heck, and a keyboard device) virtually, you could get the best of all worlds.

...providing you can come to grips with the annoying WDM system.  It's not bad, but I'd forgotten how bad unprotected memory could be (wound up trashing part of my filesystem when a pointer ran amok).


gl.tter

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 185
  • Last login:October 10, 2009, 04:53:44 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #46 on: June 18, 2008, 01:04:16 pm »
My mistake, but I don't think that will change much; you can still intercept the device creation event, substitute your own HID device descriptor, create a virtual device, and make a filter driver.

You're the expert, I haven't worked with drivers (on any level).  One final complication (perhaps) is that different Bluetooth stacks seems to enumerate the 'mote differently.  A driver would be cool, but if it's possible to spoof global mouse events to the Raw Input API then a standalone application is probably easier.

Quote
It's not bad, but I'd forgotten how bad unprotected memory could be (wound up trashing part of my filesystem when a pointer ran amok).

Nasty.  :cry:
« Last Edit: June 18, 2008, 01:05:56 pm by gl.tter »
author of the Quake2 and Half Life Act Labs lightgun conversions:


dmworking247

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 305
  • Last login:February 19, 2024, 01:05:24 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #47 on: June 18, 2008, 11:03:35 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? :)

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).



gl.tter, that is a pretty cool setup you had there playing Q2 with the Wiimote, but do I understand correctly that you have to stop (press a button?) to aim and shoot... ie, the wii motion sensing is used to move the player but if you want to aim, you have to 'swtich' it from movement mode to aiming mode?

I guess there aren't many alternatives since to shoot while moving you need two sets of analog axis going at once.

... unless you could make it work with TWO remotes, one for movement, and the other for shooting :)  That could be interesting, especially if you set it up so that the 'movement' wiimote was somehow attached to the body/neck etc.... its almost VR :)

jban4us

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 63
  • Last login:July 08, 2013, 12:06:49 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #48 on: June 19, 2008, 12:44:59 am »
gl.tter, that is a pretty cool setup you had there playing Q2 with the Wiimote, but do I understand correctly that you have to stop (press a button?) to aim and shoot... ie, the wii motion sensing is used to move the player but if you want to aim, you have to 'swtich' it from movement mode to aiming mode?

I guess there aren't many alternatives since to shoot while moving you need two sets of analog axis going at once.

... unless you could make it work with TWO remotes, one for movement, and the other for shooting :)  That could be interesting, especially if you set it up so that the 'movement' wiimote was somehow attached to the body/neck etc.... its almost VR :)

that's what the nunchuck was born to do ;D kind of an analog WASD in one hand and a light gun in the other

*edit: i should really check into links before i start posting. if i understand the video correctly it is a quake II mod that makes the game like a scripted arcade shooter. this seems perfect for a cab!
« Last Edit: June 19, 2008, 12:49:54 am by jban4us »

gl.tter

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 185
  • Last login:October 10, 2009, 04:53:44 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #49 on: June 19, 2008, 05:59:50 am »
gl.tter, that is a pretty cool setup you had there playing Q2 with the Wiimote

Thanks.

Quote
but do I understand correctly that you have to stop (press a button?) to aim and shoot... ie, the wii motion sensing is used to move the player but if you want to aim, you have to 'swtich' it from movement mode to aiming mode?

No, my mod has several different modes.  The 'Arcade 2000' mode shown in the video is path scripted, ie. the camera moves along a pre-determined path as per the old-school arcade lightgun shooters - but unlike those, the monsters are random, and the camera intelligently stops for them and tracks their movements, so every game is different.  The wiimote is used for aiming directly, using only the sensor bar as an IR reference.  The only buttons are for weapon reloading, and starting the calibration mode.

What probably confused you is that if you press the reload button & you're already fully loaded, the voice says 'Go'.  I use it in the video for fun a couple of times when nothing's happening.

I guess there aren't many alternatives since to shoot while moving you need two sets of analog axis going at once.

Right, my mod was originally written for the two-lightguns-plus-joystick Act Labs GS (though it supports single USB guns too), and it has modes were you move manually (eg. with their joystick in one hand, or just the keyboard) and aim with the gun.  I added the path scripted modes for v2 so I could add a 2 player mode (or alternatively you can use a gun in each hand in the Jon Woo mode :)).

Quote
... unless you could make it work with TWO remotes, one for movement, and the other for shooting :)  That could be interesting,

One word - Nunchuk  ;).

Edit: to make it clearer, the Nunchuk has an accelerometer just like the wiimote, and an analog joystick.  So you could tilt it to look around and move with the stick (and my lib reads it).
« Last Edit: June 20, 2008, 04:34:08 am by gl.tter »
author of the Quake2 and Half Life Act Labs lightgun conversions:


mhermann

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:October 04, 2019, 07:10:08 pm
  • We ain't found.........
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #50 on: June 19, 2008, 11:34:05 pm »
From what research I have done and through other posts made here and on other boards the low level mouse driver is the only thing that will work in Mame without changing Mame source. At least for 2 guns at once.

mhermann

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:October 04, 2019, 07:10:08 pm
  • We ain't found.........
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #51 on: June 19, 2008, 11:35:59 pm »
Also, just finished my last class for my masters in software engineering. Now all I have left is either a project or a paper. If I can get a group together at school who like gaming, I have a great project we can use.  ;D

But the point being I should have some more time to work on this.

u_rebelscum

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3633
  • Last login:April 21, 2010, 03:06:26 pm
  • You rebel scum
    • Mame:Analog+
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #52 on: June 20, 2008, 05:44:34 pm »
From what research I have done and through other posts made here and on other boards the low level mouse driver is the only thing that will work in Mame without changing Mame source. At least for 2 guns at once.

An analog joystick driver would work just as well with mame*, also without any editing mame source.  Maybe even better than a mouse if you give the axes 10 or 12 bits per axis instead of the old standard of 8 bits.

(*Just because the actlab joystick lightguns didn't work well with mame, does not in any way or form mean that the poor performance was due to the joystick interface.  Especially since analog joysticks work fine.  It was the calibration that was a pain, plus mame's analog code has had major changes since then.  The sensitivity is now linear; it used to be logarithmic with just totally screwed up calibration if anything but 100%.)


But yes, either mouse driver that's RawInput compatible and includes absolute analog data instead of just the relative analog data of a normal mouse, or a joystick driver that's directInput compatible with work in mame.
Robin
Knowledge is Power

wbassett

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 424
  • Last login:March 12, 2023, 04:34:49 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #53 on: June 20, 2008, 06:11:37 pm »
My vote and opinion is I really don't care whether it's mouse or joystick... as long as it works and is easy to get running! :)

mhermann

  • Trade Count: (+3)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 182
  • Last login:October 04, 2019, 07:10:08 pm
  • We ain't found.........
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #54 on: June 21, 2008, 12:24:28 am »
Ok looks like I am going with the Wiiuse wiimote library written in C. I also purchased a Windows Device driver book from amazon (should be here next week). This thing is going to be XP only to start but I hope I can port it to Vista (No vista driver book yet). I picked this book because it is more of a beginners guide to developing device drivers for windows. And most of the stuff I have read so far has made me lost. So I need to develop a base knowledge to get started.

Now there do seem to be some Linux drivers out there that might work. But that is one area of computing I have yet to really work with outside of hacking my Tivo (need to boot to a linux disc to upgrade the hard drive). So for those using Linux, if anyone could test out using 2 wiimotes it would be appreciated.




wbassett

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 424
  • Last login:March 12, 2023, 04:34:49 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #55 on: June 21, 2008, 04:27:05 am »
merhmann I finally got all my gear and tried some testing, and it seems to be okay for moving the mouse around but was a bit sporadic for me.  I did find when I stepped back a bit it seemed to get better but still wasn't tracking exactly where I was pointing... but much better than a Gyration Gryotransport air mouse.  This was also with a basic GlovePie script too, that also wouldn't work with Mame... useless I know,  but I'm trying to get a feel for how well this will work.

I know you're doing a lot and being smart by working from the ground up and building a good foundation... once you get a basic driver working, (GlovePie seems to work okay, but it's a two or more step process and not something everyone would want to do...  Anyway, eventually we need some sort of tracking and calibration option as well as a driver.

Silver

  • Wiki Contributor
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1668
  • Last login:February 17, 2024, 10:29:00 am
  • Cunning like the Fox.
    • Mods'n'Mods
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #56 on: June 21, 2008, 10:01:47 pm »
Few comments, forgive me if I repeat anything, I skimmed the thread slightly....


1. Give up on adding wiimote support directly into mame - HID mouse or analog joystick drivers are your only longterm options (looks like you are heading here anyway). Such code would not be accepted into mame...


2. Why is glovepie not a viable solution? Is it program overhead? lag?

[youtube]http://www.youtube.com/watch?v=fd5Kai8PPHo[/youtube]


3. A few comments on here about having to stand way back from the monitor when using Topguns/Wiimotes. All you need to do here is move the LED sources closer together inside the "sensor" bars (or just use any 2 LED sources). This can be successfully done to allow use very close to screens, e.g. laptops.

e.g. In the Wii "sensor" bar, 2 LED sources are around 7.5" apart. Moving them to around 4.5" apart should allow you to get about 1foot from the screen with accuarcy.

See: http://www.engadget.com/2007/01/31/how-to-make-a-wii-laptop-part-2/  and look for section "Modifying the sensor bar"


wbassett

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 424
  • Last login:March 12, 2023, 04:34:49 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #57 on: June 22, 2008, 02:34:15 am »
Silver I don't have any personal issues with using GlovePie, I just haven't found the right script yet.

It's more of looking for a solution that's very easy to implement for even someone that has no programming skills (like me, my skills are very limited in that area) or people that are only comfortable with a plug and play solution.

From what I have heard from others, yeah GlovePie does add some overhead, but how much I don't know.  I have seen some people that wrote scripts that incorporate Wii mote calibration, but they state that the scripts don't work as a mouse input and won't work with any games that require or use that.  So I don't know if the script will work or not, but perhaps the calibration routine can be incorporated into a different script.  Again, I don't know if that's feasable or not.

Scubaduba

  • Trade Count: (0)
  • Newbie
  • *
  • Offline Offline
  • Posts: 1
  • Last login:August 14, 2008, 11:10:50 am
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #58 on: August 13, 2008, 03:42:40 pm »
gl.tter your work is great. Thanks a lot man. I have few questions:

  • Do you plan to release Gun Frenzy 2?
  • What is the algorithm to correctly map cursor position on screen? You use 2 IR LED references or 4? (Couldn't see it on Gunfrenzy video) I'd ilke to work with that on .Net and XNA. Yours looks quite accurate, isn't it? Even if you can point me some sources on maths behind that I'd appreciate.

Thanks

padstack

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 265
  • Last login:February 03, 2024, 12:54:24 pm
  • I want to build my own arcade controls!
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #59 on: August 23, 2008, 12:16:25 am »
Hopefully I dont' derail this. but I don't understand why this particualr scenario won't work:

Wiimote stationed over the TV.  rig up an old Nintendo Zapper (just to keep the brands the same!  :P) with a peice of the reflective tape at the tip and hack a wireless mouse to record a "click" when the trigger is fired.

Does that have any credibility at all for a start?  I'm basically using the video from Johnny Lee where he uses IR reflective tape on his fingers to track them in midair.  I know I'm leaving something out, but it's late for me!  LOL!  The video can be foudn here: http://www.cs.cmu.edu/~johnny/projects/wii/ (first video)  Feel free to be brutally honest b/c I'm not the sharpest tool in the shed on some of this stuff, but it could have potential.

Thoughts?

Hemi

  • Banned
  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 244
  • Last login:September 21, 2008, 08:41:21 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #60 on: August 23, 2008, 02:36:34 am »
The Dolphin Gamecube emulator runs Wii games now but the games will not actually go in-game due to no Wii-mote controller support. The games end up complaining about the Wii-mote has stopped communicating with the game and emulator due to no input plugin being made for the emu. Maybe this can be used to code an input plugin for the Wii emulator and this emulator can then fully emulate the Wii.


These pics are of the actual emulator running the game "We Love Golf" and a few Wii-mote screens. This game does not show any errors about the mote not being connected, but if there was a plugin made to identify the start button, the game would go further.

« Last Edit: August 23, 2008, 02:48:30 am by Hemi »
Banned

gl.tter

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 185
  • Last login:October 10, 2009, 04:53:44 pm
Re: Its time to give back...beginning work on Wiimote Driver
« Reply #61 on: August 23, 2008, 04:19:20 am »
I have few questions:

  • Do you plan to release Gun Frenzy 2?
  • What is the algorithm to correctly map cursor position on screen? You use 2 IR LED references or 4? (Couldn't see it on Gunfrenzy video) I'd ilke to work with that on .Net and XNA. Yours looks quite accurate, isn't it? Even if you can point me some sources on maths behind that I'd appreciate.

Did you get my PM?
author of the Quake2 and Half Life Act Labs lightgun conversions: