xboxscene.org forums

Author Topic: Darwiin Discussion Thread  (Read 77 times)

alemerson

  • Archived User
  • Full Member
  • *
  • Posts: 158
Darwiin Discussion Thread
« on: December 10, 2006, 12:52:00 PM »

here

It is a small app that reads the accelerometers from your Wiimote and send the information via bluetooth to your mac. It can be used in mouse mode which is cool but hard, and it has a force feedback mode, which i haven't figured out what it does yet besides rumble.

The best part i think is the fact that the buttons are mapped to be used as a front row remote...


with a small adjustment to the keyboard configuration in Snes9x, im playing snes games on my mac with a wireless bluetooth wiimote!!!



the source code is open to the public and is written in Apple's Objective-C based language Cocoa.

The source code  can be found there ^

The authors blog on the topic is here


----------------------------------------------------------------------------------------------------------------------



Now there is a reason that i wanted to post this:


since the source code is open source i would like to maybe modify the code a little for better emulator use...

the problem is i don't know Cocoa...  DOES ANYBODY HERE KNOW COCOA?

Here a sample of the code...

CODE
//
//  WiiRemote.h
//  DarwiinRemote
//
//  Created by KIMURA Hiroaki on 06/12/04.
//  Copyright 2006 KIMURA Hiroaki. All rights reserved.
//

#import
#import
#import

#import


typedef struct {
    int x, y, s;
} IRData;

typedef UInt16 WiiButtonType;
enum {
    kWiiRemoteTwoButton        = 0x0001, :D
    kWiiRemoteOneButton        = 0x0002,
    kWiiRemoteBButton        = 0x0004,
    kWiiRemoteAButton        = 0x0008,
    kWiiRemoteMinusButton    = 0x0010,
    kWiiRemoteHomeButton    = 0x0080,
    kWiiRemoteLeftButton    = 0x0100,
    kWiiRemoteRightButton    = 0x0200,
    kWiiRemoteDownButton    = 0x0400,
    kWiiRemoteUpButton        = 0x0800,
    kWiiRemotePlusButton    = 0x1000 :D
};


@interface WiiRemote : NSObject {
    
    IOBluetoothDeviceInquiry* inquiry;
    IOBluetoothDevice* wiiDevice;
    IOBluetoothL2CAPChannel *ichan;
    IOBluetoothL2CAPChannel *cchan;
    
    id _delegate;
    
    
    unsigned char accX;
    unsigned char accY;
    unsigned char accZ;
    unsigned short buttonData;
    
    float lowZ, lowX;
    int orientation;
    int leftPoint; // is point 0 or 1 on the left. -1 when not tracking.
    
    IRData    irData[4];

    
    BOOL isMotionSensorEnabled, isIRSensorEnabled, isVibrationEnabled;
    BOOL isConnecting;
    

}


- (void)setDelegate:(id)delegate;
- (BOOL)available;
- (BOOL)connect;
- (void)close;
- (void)setIRSensorEnabled:(BOOL)enabled;
- (BOOL)setForceFeedbackEnabled:(BOOL)enabled;
- (BOOL)setMotionSensorEnabled:(BOOL)enabled;
- (BOOL)setLEDEnabled1:(BOOL)enabled1 enabled2:(BOOL)enabled2 enabled3:(BOOL)enabled3 enabled4:(BOOL)enabled4;
- (BOOL)writeData:(const unsigned char*)data at:(unsigned long)address length:(size_t)length;
- (BOOL)sendCommand:(const unsigned char*)data length:(size_t)length;

- (IOReturn)inquiry;


@end


@interface NSObject( WiiRemoteDelegate )

- (void) wiiRemoteInquiryComplete:(BOOL)isFound;
- (void) dataChanged:(unsigned short)buttonData accX:(unsigned char)accX accY:(unsigned char)accY accZ:(unsigned char)accZ mouseX:(float)mx mouseY:(float)my;
- (void) wiiRemoteDisconnected;


@end




The part that i highlighted with smiley faces (and between the smileys) is my best guess on what the buttons might be mapped to... I would like to be able to change them.... Here is the reason... the plus, minus, and home are mapped to SHIFT UP, SHIFT DOWN, and SHIFT ESC, respectivly, for use in Front Row as volume up/down and open/close front row...


The other buttons are mapped to single keys so i can use them in an emulator... however i cant get the two button combination to map... (i have even tried using keystroke programs that map a combo to another button, like butler. it works in text edit but not in the emulator.)


does anyone want to try and figure out how to remap the buttons?

----------------------------------------------------------------------------------------------------------


(This is the last section i promis happy.gif )


Here's what i think Darwiin needs to fit The emulator need...


1  Multi Wiimote support - (that would include seperating multiple controller's bluetooth signal and mapping them to different keys) for 4 player emulators

2  Program specific button pofiles - (In front row the dpad is facing up and the plus minus are used for volume, in an emulator, the dpad is rotated 90 degrees and the +/- become single keystokes that can be mapped to start/select... ect.)



I don't know how to do this.. but im looking for someone interested in helping / or inspired enough to do it and share it with the scene... This is open source so home modifications are welcomed by the author.




IF nobody wants to program then just enjoy the program like me and push for more features... at sourceforge you can even request features or report problems....


be a part of the devo scene on this one guys cause i want to see some cool stuff  biggrin.gif  biggrin.gif  biggrin.gif




(sorry for the uber long post)
 ph34r.gif

P.s to moderators- if this should be in the Personal Computer section.. please move it but i need help from the wii people on how to seperate the channels in each wiimote... so sorry again if its in the wrong place
Logged

SR388

  • Archived User
  • Sr. Member
  • *
  • Posts: 269
Darwiin Discussion Thread
« Reply #1 on: December 10, 2006, 09:37:00 PM »

I'd be interested if it were for pc.

I don't own a mac and I never plan to get one
Logged

yaazz

  • Archived User
  • Hero Member
  • *
  • Posts: 1370
Darwiin Discussion Thread
« Reply #2 on: December 11, 2006, 05:17:00 AM »

pretty neat, I've never seen cocoa before, but it looks a lot like C so someone will port it to windows soon enough I would say
Logged

twistedsymphony

  • Archived User
  • Hero Member
  • *
  • Posts: 6955
Darwiin Discussion Thread
« Reply #3 on: December 11, 2006, 06:20:00 AM »

QUOTE(SR388 @ Dec 10 2006, 11:44 PM) View Post

I'd be interested if it were for pc.



Ask and Wii shall receive:
http://www.wiili.org...-here-t294.html

beerchug.gif
Logged

SR388

  • Archived User
  • Sr. Member
  • *
  • Posts: 269
Darwiin Discussion Thread
« Reply #4 on: December 11, 2006, 10:03:00 AM »

lol, I didn't even think of that, thanks twisted, and thanks alemerson sor the awesome post
Logged

alemerson

  • Archived User
  • Full Member
  • *
  • Posts: 158
Darwiin Discussion Thread
« Reply #5 on: December 11, 2006, 04:13:00 PM »

im having soooo much fun playing NBA JAM Tournament Edition for Snes wirelessly with my Wiimote....



WIIIII.


but seriously can anyone program cocoa?
Logged

xboxbman

  • Archived User
  • Full Member
  • *
  • Posts: 154
Darwiin Discussion Thread
« Reply #6 on: December 11, 2006, 07:17:00 PM »

QUOTE(twistedsymphony @ Dec 11 2006, 08:27 AM) View Post

Ask and Wii shall receive:
http://www.wiili.org...-here-t294.html

beerchug.gif


what about linux?
Logged