libsicksaxis - connect sixaxis/DS3 to the Wii

Discussion in 'Wii - Hardware, Devices and Utilities' started by xerpi, Dec 14, 2012.

  1. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
    Hi guys, these days I've been writing a library called "sicksaxis" (yeah sick xD) for the Wii.
    It's very simple, it allows you to connect your sixaxis and dualshock 3 via USB to the Wii and read its data.

    Lib SickSaxis allows:
    • Read the buttons
    • Read the analog sticks
    • Read the motion sensors (accelerometer and gyro)
    • Read the button pressure
    • Rumble
    • Turn on/off the LEDs
    • Set the controller's MAC
    • Get the controller's MAC
    Version 2:
    • Rewritten from scratch
    • Should be more stable
    Version 1.0 improvements:
    • Reorganizated the code
    • Improved some functions
    • Changed synchronous USB functions to asyncrhonous (this means it won't lag anymore)
    Download version 2.0
    GitHub: https://github.com/xerpi/libsicksaxis


    A video:




    Old versions:
    This is not yet a library, it's just a homebrew, I mean the library source is compiled with the main.c
     
    RiCK420 and filfat like this.
  2. boomario

    boomario Nothing to say here.

    Member
    413
    135
    Oct 31, 2012
    Brazil
    Awesome work :lol:
    please continue with this wonderful work and maybe in future we will be able to play some games with dualshock 3 wihout any problems.
     
  3. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
    Thanks :P
    Well, currently it's only a library, it can be useful for current homebrew (and maybe new), I mean, if you grab some emulator's code for example, you can implement this library very easily.
    The hard this would be to write a IOS driver to support sixaxis/dualshock3 natively.
    And even a harder think would be to do the same via bluetooth.

    If you find an interesting open source Wii project, tell me and I'll try to implement libsicksaxis :)
     
  4. Oxybelis

    Oxybelis GBAtemp Fan

    Member
    349
    74
    Jan 10, 2010
    Maxternal and Felipe_9595 like this.
  5. WoJjTeK

    WoJjTeK GBAtemp Regular

    Member
    122
    45
    Jun 27, 2012
    Poland
    Awesome work , do you think it'd be possible to implement this library into Dios Mios ? I'd be a great solution for new Wii's without GC controller support.
     
    RiCK420 and Felipe_9595 like this.
  6. BlackWizzard17

    BlackWizzard17 Don't worry Captin we'll buff out those scratches.

    Member
    1,183
    450
    Dec 1, 2012
    United States
    E-Arth
    so cool hopefully I can play ps1 emulator with it for MK trilogy :lol:
     
  7. LightyKD

    LightyKD Future CEO of OUYA Inc.

    Member
    4,694
    1,042
    Jun 25, 2008
    United States
    Angel Grove, CA
    Great work! Id love to see a 360 controller version of this!
     
  8. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,564
    8,912
    Oct 27, 2002
    France
    Engine room, learning
    WiiSX? Playstation emulator with a Playstation controller.


    @users: it needs to be included into the homebrew sources/devkit, not into IOS/MIOS.
     
  9. SifJar

    SifJar Not a pirate

    Member
    6,022
    892
    Apr 4, 2009
    People talking about IOS/MIOS are meaning they want it to work in official software.
     
  10. phrozenfeonix

    phrozenfeonix Member

    Newcomer
    46
    0
    Oct 28, 2008
    United States
    You wouldn't be able to implement this into dios mios, for sure. Apparently there is already so much space restriction involved with the code, that the devs can't even fit in an ntfs support module.
     
  11. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
  12. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
    New version 1.0, see the top of the page!
     
    BlackWizzard17 and Maxternal like this.
  13. BlackWizzard17

    BlackWizzard17 Don't worry Captin we'll buff out those scratches.

    Member
    1,183
    450
    Dec 1, 2012
    United States
    E-Arth
    So how would we use this, and by the way nice work.
     
  14. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
    We can implement it on homebrews (on emulators it would be nice :P). And thanks.
     
  15. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona
    I have updated it a little, now the library is actually a library, not a homebrew. Typing make install will do the trick.
     
    filfat likes this.
  16. filfat

    filfat Musician, Developer & Entrepreneur

    Member
    1,231
    858
    Nov 24, 2012
    The 360 controller isencrypted so it req a driver. That makes it 1000x harder to make.
     
  17. BlackWizzard17
    This message by BlackWizzard17 has been removed from public view by Cyan, Aug 31, 2013, Reason: don't do that. Thanks.
    Aug 31, 2013
  18. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,955
    Jun 9, 2007
    Antarctica
    Hi, do you have any idea why the sample stops updating the controller info after about 5 seconds? I compiled it with the latest commit from https://github.com/xerpi/libsicksaxis, connected a genuine Sony DS3 via a USB cable, and saw it started printing button info and such to the screen, but after about 5 seconds, it just completely stops. I do have a USB hard drive connected to the Wii while trying this; is there a problem with this library and USB hard drives?

    I modified the sample like so, to remove the "opening" part (I wanted it to always print the info, as pressing 1 or 2 freezes the homebrew :unsure: ):
    Code:
    int main(int argc, char **argv)
    {
        srand(time(NULL));
        IOS_ReloadIOS(58);
        usleep(100 * 100000);
        USB_Initialize();
        init_video();
        WPAD_Init();
           
        ss_init();
        struct ss_device dev, dev2;
        ss_initialize(&dev);
       
     
        while(run) {
            WPAD_ScanPads();
            u32 pressed = WPAD_ButtonsDown(0);
            printf("\x1b[2;1H  \n");
            printf("Press 1 or 2 to open the controllers:  %d\n", lol);
            USB_DeviceChangeNotifyAsync(USB_CLASS_HID, change_cb, (void*)&lol);
           
            if (!ss_is_connected(&dev)) {
                    if (ss_open(&dev)>0) {
                        ss_start_reading(&dev);
                        ss_set_removal_cb(&dev, removal_callback, (void*)1);
                    }
            } else {
                print_ss_data(&dev);
            }
     
            if (pressed & WPAD_BUTTON_HOME) run = 0;
            VIDEO_WaitVSync();
            VIDEO_ClearFrameBuffer (rmode, xfb, COLOR_BLACK);
        }
        ss_close(&dev);
        ss_close(&dev2);
        USB_Deinitialize();
        exit(0);
        return 0;
    }
    Edit: I found the problem myself. USB_DeviceChangeNotifyAsync(USB_CLASS_HID, change_cb, (void*)&lol); shouldn't be called on every loop iteration. It causes the Wii to freeze. If it's async, it doesn't need to be called every frame.
     
  19. xerpi
    OP

    xerpi GBAtemp Regular

    Member
    169
    451
    Dec 25, 2011
    Barcelona


    Thanks for noticing that USB_DeviceChangeNotifyAsync bug! I'll take a deeper look once I've ended my finals.
     
  20. daxtsu

    daxtsu GBAtemp Guru

    Member
    5,546
    3,955
    Jun 9, 2007
    Antarctica
    No problem. Out of curiosity, does libsicksaxis support connecting DS3 controllers wirelessly? I saw some code to get and set the mac address, but when I tried to use either one, it seemed to crash (I'm sure I was doing it wrong somehow..).
     
  21. AbdallahTerro

    AbdallahTerro da KiNG

    Member
    6,047
    2,519
    Jan 14, 2012
    Ideas factory :)
    Yo!
    first thanks for this awesome library
    second is there a way on earth to make it work in USB Loaders when a cIOS is used (force cIOS option "on" that is)