Dolphin, the GameCube and Wii emulator - Forums

Full Version: [PATCH] UDPWii: Use iPhone as WiiMote [NEW: Nunchuck and IR support]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Hi guys! I'm new around here!
I figured that it would be nice to use an iPhone/iPod Touch or, in fact, anything else network-capable to act as a WiiMote, so I made this quick patch to the Wiimote Plugin that allows recieving of accelerometer and button data through UDP.

NEW: This patch was commited to the SVN

So here goes:

CHANGELOG:

iController (client):
v4.0.2
- fixed a crash on the settings view

http://www.mediafire.com/file/992992tnuq...source.zip (source)
binary in Cydia


v4.0.1
- iOS4.0 and multitasking support
- fixed inverted Z axis bug (sorry... Blush)
- new nunchuck layout for left-handed people
- even more bugfixes

binary was in Cydia

v4.0
- customizable skins and layouts
- bugfixes

http://www.mediafire.com/?346kcbb40gd76xb (source)
binary was in Cydia

v3.1
- automatic discovery
- some UI cleanup
- fixed some leaks

v3
- a lot of code cleanup and a lot of stuff rewritten
- a new way of controlling the IR pointer... AirMouse style...
- a new nunchuck-only tab (for use with 2 devices... kinda pricy...)
- sending nunchuck accelerometer data

v2
- improved UI
- nunchuck
- IR using trackpad
- IR using compass on the 3GS

v1
- initial release

UDPWii (server):
[color=#FF0000]not maintaining this changelog anymore... check my SVN commits[/color]
SVN r5916
- automatic discovery support
- multiple devices support

SVN r5840 (linux build fixed)
- nunchuck support
SVN r5835
- integrated into the new plugin (no nunchuck support yet)
SVN r5821
- listening on multiple interfaces
- performance improvements
- code cleanup
SVN r5352 (win build fixed)
- bugfix: nunchuck status not saving (typo)
- tested on OS X
- fixed scons script and XCode project
- comitted into SVN
v3
- UI
- nunchuck
- IR
v2
- multiple clients
v1
- initial release


INSTRUCTIONS

1.Open the wiimote plugin configuration dialog
2.Make sure you selected "Emulated Wiimote" and then click on "Configure":
[Image: Screenshot2010-08-21at85913PM-1.png]
3.Then under "UDP Wiimote" click "Configure":
[Image: Screenshot2010-08-21at85920PM-1.png]
4.Enable UDPWii:
[Image: Screenshot2010-08-21at85936PM-1.png]
5.Repeat steps 3-4 for each wiimote you want to emulate with your iPhone
6.Start iController on your iPhone
7.Start the game
8.With the game started or the config dialog open tap on the row that just appeared... only needed once:
[Image: ss1-1.png]
9.Configure the layouts as desired under "Appearance" (optional)
10.Press "Start", select the layout from the tab bar and enjoy! Big Grin

IMPLEMENTATION DETAILS:

you send UDP packets to Dolphin like this:
0xde -- signature
0xXX -- or-ed flags:
(1<<0) means accelerometer
(1<<1) means buttons
(1<<2) means IR
(1<<3) means nunchuk
(1<<4) means nunchuk accel data
if flag&accelerometer:
0xXX 0xXX 0xXX 0xXX -- 32bit signed ints in network byte order
0xYY 0xYY 0xYY 0xYY -- (s32)(float_value*1024*1024)
0xZZ 0xZZ 0xZZ 0xZZ
if flag&buttons:
0xBB 0xBB 0xBB 0xBB -- 32bit int in net byte order. or-ed flags (see UDPWiimote.h for meaning)
if flags&IR
0xXX 0xXX 0xXX 0xXX -- 32bit signed ints in network byte order
0xYY 0xYY 0xYY 0xYY -- (s32)(float_value*1024*1024)
if flags&nunchuk
0xBB -- 8bit int flag (c-bit0 and z-bit1 buttons, 1-active)
0xXX 0xXX 0xXX 0xXX -- 32bit signed ints in network byte order (analog stick)
0xYY 0xYY 0xYY 0xYY -- (s32)(float_value*1024*1024)
if flags&nunchuk_accel
0xXX 0xXX 0xXX 0xXX -- 32bit signed ints in network byte order
0xYY 0xYY 0xYY 0xYY -- (s32)(float_value*1024*1024)
0xZZ 0xZZ 0xZZ 0xZZ

Dolphin broadcasts it's presence over IPv4.
Packets are sent to 255.255.255.255 with this format:
0xdf -- signature
0xXX 0xXX -- 16-bit random number unique per-wiimote
0xXX -- wiimote index (from 0 to 3)
0xXX 0xXX -- network-order 16-bit unsigned int, the port witch I am advertising
0xXX -- display name length (max 255)
0xXX ..... the display name (length specified one byte before)

Features:
should be portable
better experience than keyboard (awesome for mario kart)
buttons are or-ed with keyboard mappings so it doesn't affect anything
works with multiple iphones (new super mario)

Known issues:
On-screen buttons too small
When the iPhone goes to sleep or disconnect from the network (crappy windows ad-hoc networks included) it loses the socket, and you have to go to settings then start sending again.
Greeeeeeeeeeat ! I've a iPhone with a jailbreak ! It could be cool for mario kart Wii, yeeeear that's amasing ! Smile
But I will test only if someone make me a 64 bits revision with this patch, and explain how to use my iPhone with it Wink
Sounds awesome, hopefully ector drops by and gives you svn access.
(03-28-2010, 11:31 PM)death-droid Wrote: [ -> ]Sounds awesome, hopefully ector drops by and gives you svn access.
Before that i have to add it into the ui. It shouldn't be that hard.

smartprogrammer

This is really amazing

Can it work with new nokia phones??
(03-30-2010, 02:31 AM)smartprogrammer Wrote: [ -> ]This is really amazing

Can it work with new nokia phones??

Maby. If someone makes a client for them. I think both 5800 and N97 have an accelerometer. But I wont make it. Coding for S60 is nasty (or so I heard).
Sounds awesome.

I wonder if someone who creates Jailbroken apps can create a controller app for the iPhone to use with Dolphin.

Then you can press the A, B buttons etc. on your iphone's touchscreen. I think it can be done with people who have used the iPhone as an Airmouse, but no one has used it as a controller yet.

EDIT: Didn't read the bottom part of the post. Ignore what I said <_<
I might integrate it into the wiimote plugin ui tomorrow.
I tried installing the iControl app on my Jailbroken iPhone.

But I can't seem to launch it, i even rebooted. Whenever i tap the icon it just stays there on the Springboard.

I'm using an iPhone 3GS, new bootrom with 3.1.2
Quick question. Does this work over the network or over bluetooth?
Looks awesome anyways. Im loading Cydia and I'll let you know the results.

EDIT: Darn, will someone please upload this to a repo? I have not had the best luck with SSH or terminal and always seem to mess up my ipod and need to restore.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23