« Math Notation Is TerribleInternational Corpus of English »

Wii Classic Controller on Mac

06/06/08

Permalink 07:17:07 am, 130 words
Categories: Code, Games

Wii Classic Controller on Mac

It looks like my Smartjoy PS2 adapter prevents my computer from sleeping now that I am using Leopard. That’s annoying. I thought Macs were supposed to Just Work. Oh well, I guess I still have my old Logitech wireless gamepad, but its buttons are mushy and it uses batteries and there’s an annoying dongle.

Maybe I should look into using my otherwise-wasted Wii Classic Controller (what can I say, I bought it cause of SNES nostalgia). DarwiinRemote claims to provide a bluetooth driver for the Wiimote, although looking at the source, conflicting evidence exists on whether the analogue sticks are supported.

In WiiRemote.h:

typedef UInt16 WiiJoyStickType;
enum{
	WiiNunchukJoyStick,
	WiiClassicControllerLeftJoyStick,	//not available
	WiiClassicControllerRightJoyStick	//not available
};

But in WiiRemote.m

		} else if (expType == WiiClassicController) {
			cButtonData = (unsigned short)([self decrypt:dp[startByte + 4]] << 8 ) + [self decrypt:dp[startByte + 5]];
			
			
			cStickX1 = [self decrypt:dp[startByte]] & 0x3F;
			cStickY1 = [self decrypt:dp[startByte +1]] & 0x3F;
                        :  //code continues...

The code compiles and the remote works as long as the the front-end app is running. But since all it does is map button presses to keys, the driver detects the analog sticks just fine, but doesn’t provide their data in any useful way to applications. What needs to happen is for this to be a real driver that provides a joystick interface (as a HID?). The Bluetooth metadata already describes this as a joystick, but that doesn’t seem to mean anything to the rest of the OS.

I’ve got the code checked out, so I’ll see what I can see. Objective-C is stupid-looking but the code itself is pretty clear. C variants are pretty good for drivers, after all.

4 comments

Comment from: Gugum [Visitor] · http://freegamesystem-s.com/about
how is it work? I still not understand..
14/03/09 @ 15:27
Comment from: Jon Hangman [Visitor] Email · http://playhangmangames.com/
Hi Mate!!!
The real fun of playing Games are with joystick :)
So switch to joystick and experiance the change ;)

Cheers :)
03/05/09 @ 15:39
Comment from: Damon Golding [Visitor] Email
Any luck with the analog sticks?

I have everything else working.Pcsx2+Darwiin remote+wiimote classic, now the only thing is the analog sticks lol

12/05/09 @ 15:51
Comment from: PS3 Shop [Visitor] Email · http://ps3home.co.uk/shop/
Wow thats cool, using Wiimote on mac is cool.
25/08/09 @ 17:12

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
b2