Wednesday, March 14, 2007

The Secret of Wiimote Access

Have been busy at work, so havn't gotten around to blog anything. I thought I would reveal the trick behind the "Wii-remote access from Xbox 360 demo". Some of the commenters on here and Youtube already pointed out the various pieces of the illusion. Here is how I have done it.

Background:
  • Wii remote uses bluetooth to connect to Wii or PC
  • Xbox 360 does not have IR port or Bluetooth port
  • Xbox 360 has USB port, but XNA does not have any low level access to the hardwares
  • I only know software, so this isn't a hardware hack
  • XNA has no network API, so I couldn't create network sockets

Since Xbox can't access Wiimote directly (without hardware mod), my solution is to use an "adapter" to acquire the data. In this case, my laptop is used as an all purpose adapter. :) With some googling, I was able to find Ziggy's wiimote library. And after reading through wiili.org's wiimote page, I was able to read input from on my laptop.

Now the remaining puzzle is how to get data in and out between the PC and the Xbox. It's relatively easy to get data out of the Xbox. But to get the data into the Xbox takes some doing... Since XNA doesn't have any low level access, USB is out. It's probably possible to create an adapter by simulating the joypad, but I am a software guy. :) The final solution I settled with is borrowing the conduit MS has provided: the debugger! By using the debugger, I was able to read variable data directly from the Xbox, and also modify Xhox data from the PC. If you are interested in how that is done, you would have to read about it in my next blog... :)

Big thanks to everyone who dropped by and checked out the video. :) As a treat, here is the source code to the Wiimote Demo. It will take some preparation to get it working properly. Here is the short instruction:
  • Make sure you can access the Wiimote from Windows.. Verify using GlovePie or WiinRemote
  • Load the solution in MS C# Express. Make sure you have only a single instance of C# Express running.
  • Make sure you can deploy and debug program on your Xbox from C# Express
  • Start the X360WiiTest project in Debug mode. The code will probably hit a break point and paused with some line highlighted. Don't worry about it.
  • Make sure you can see the Locals debug window open (from menu Debug->Windows->Locals)
  • Start WaruProxy.exe within the archive. Click on the button.
  • If you don't have C# Express open, or Wiimote isn't connected properly, WaruProxy will crash
  • If you have done everything correctly, WaruProxy will unpause the program and gather input from the wiimote and pass to your Xbox all by itself!

WaruProxy monitors C# Express to see when it hits a break point. If C# is in break mode, WaruProxy will check the Locals window for any known variable. If WaruProxy can find the proper variables, it will use them to communicate with the Xbox. Voila! That is how I access Wiimote from the Xbox. Enjoy! :)

Monday, March 05, 2007

XNA Team Delievers!

There were some grumblings in the MSDN's XNA/XGSE forums regarding the lack of samples and certain features and what Creators Club's benefits really are. After months of incommunicado, the XNA team has finally announced what they have been working on:
  • A Creators Club online community full of samples/tutorials/forums
  • The main Dream, Build and Play contest is now live with a chance to get your game published on XBLA!
  • Exclusive content for CC member such as free license to GarageGames Torque X Engine, Softimage's new 3-D solutions, and Allegorithmic ProFX. This may come May or later though.

Pretty exciting stuff! :) Thanks, XNA team!