Hacking USB Loaders mods with Sixaxis controller suppor

  • Thread starter Thread starter AbdallahTerro
  • Start date Start date
  • Views Views 34,964
  • Replies Replies 87
  • Likes Likes 2
AbdallahTerro: Feel free to open up a pull request on postLoader's Github repo if you've been editing the sicksaxis wrapper (or upload a patch somewhere). I'm usually open for improvements in the code.
all the additions so far has been hacks to wiiflow code. I managed to trick the code since the wrapper has no BTN_HELD functions only BTN_PRESSED
I'm still using the untouched wrapper.
As for the fast button press response it's also present in postloader.
It would be best to add some code similar to this template to make the button response with normal speed:
Code:
Function Listen For X_Button Click()
 
    If X_Button Click = true then
 
          Listen For X_Button Click Release()
 
              If X_Button_click_release = true then
 
                    ;DO BUTTON FUNCTION
 
              EndIf
    EndIf
End Func
or just add a delay when a function checks if the button is already pressed,
problem is there is no release function in the wrapper and I'm not sure if the delay has to be part of the wrapper or the loader code.
finally, I lack the coding skills needed to write this myself.
All the progress made so far has been possible because of the help I got from Fix94 and megazig on IRC
So some help would be appreciated :P
 
This is how Libogc is doing it:
https://github.com/comex/libogc/blob/master/libogc/pad.c#L714

I guess creating a function to DS3_scanpad() to held all button state is better than using libsiksaxis to read them in real time?

I didn't check it fully yet, I'll see what I can do to "emulate" a Classic Pad in USBLoaderGX too.
(Setting all read value to WPAD to prevent rewriting all the sources to add DS3 reading, I don't think users will use both Classic and PS3 controller at the same time for the same channel)
 
  • Like
Reactions: AbdallahTerro
I'll try it, but from idea to working state, there are always unexpected problems with me :wtf:
I hope it won't be hard.

Did you manage to do something for GX yet?

Edit:
The more I check the sources, the more I think it would need a third struct for HID (pad, wpad, upad, hid) in libogc, as LibwiiGUI is checking pad and wpad states directly from libogc.

It has been done in Snes9XGX, it could help to check how it's done with Libwiigui.
Edit:
The sources for 9x are easy, but I guess it's not working in the GUI.
there's a list of button state sent to the game, that state is edited for each pad's read. this is the idea I had for USBLoaderGX. It might not work with LibWiiGUI unless you edit wpad data.
 
I'll try it, but from idea to working state, there are always unexpected problems with me :wtf:
I hope it won't be hard.

Did you manage to do something for GX yet?

Edit:
The more I check the sources, the more I think it would need a third struct for HID (pad, wpad, upad, hid) in libogc, as LibwiiGUI is checking pad and wpad states directly from libogc.

It has been done in Snes9XGX, it could help to check how it's done with Libwiigui.
Edit:
The sources for 9x are easy, but I guess it's not working in the GUI.
there's a list of button state sent to the game, that state is edited for each pad's read. this is the idea I had for USBLoaderGX. It might not work with LibWiiGUI unless you edit wpad data.
I'm still trying to get it fully working in wiiflow, just need to decrease the sensitivity of the buttons, I spent yesterday rewriting the code in wiiflow and managed with Fix94's help to map power off to select button.
when I'm happy with the button sensitivity I'll move to GX :)
 
if you want to map buttons yourself for USBLoaderGX, please map it like a Classic Controller (Start = +, Select = -, PS = Home, etc.) based on what's already done in the loader to keep consistency with different controllers.
 
No, I didn't see it.
I'm making my own, but if it's already done I guess I'll use it too.

where can I find it?



Having a method to read LED would be great to determine the current pad when scanning all 4 pads. (yeah, I tried scanning multiple controllers).
I'll limit to one controller, it's easier to code for the moment.
 
No, I didn't see it.
I'm making my own, but if it's already done I guess I'll use it too.

where can I find it?



Having a method to read LED would be great to determine the current pad when scanning all 4 pads. (yeah, I tried scanning multiple controllers).
I'll limit to one controller, it's easier to code for the moment.
this rar file has the sixaxis library source + compiled library + wrapper files: https://dl.dropboxusercontent.com/u/101209384/ds3/libsicksaxis.rar
 
My own version compile but ... no effect haha!
Probably full of fail...
the LEDs don't even stop blinking.

edit:
ah, some progress.
IOS58 is needed for HID. the led stopped blinking.

edit2:
more progress, analog works! with Y axis inverted.
(but not buttons, damn)
 
  • Like
Reactions: AbdallahTerro
this is the correct stick code for wiiflow, it was inverted too before fixing it:
Code:
void CMenu::LeftStick()
{
    u8 speed = 0, pSpeed = 0;
    for(int chan = WPAD_MAX_WIIMOTES-1; chan >= 0; chan--)
    {
        if(left_stick_mag[chan] > 0.15 || abs(PAD_StickX(chan)) > 20 || abs(PAD_StickY(chan)) > 20 || (chan == 0 && (abs(DS3_StickX()) > 20 || abs(DS3_StickY()) > 20)))
        {
            m_show_pointer[chan] = true;
            if(LEFT_STICK_LEFT)
            {
                speed = (u8)(left_stick_mag[chan] * 10.00);
                pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10)));
                if(stickPointer_x[chan] > m_cursor[chan].width()/2)
                    stickPointer_x[chan] = stickPointer_x[chan]-speed-pSpeed;
                pointerhidedelay[chan] = 150;
            }
            if(LEFT_STICK_DOWN)
            {
                speed = (u8)(left_stick_mag[chan] * 10.00);
                pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10)));
                if(stickPointer_y[chan] < (m_vid.height() + (m_cursor[chan].height()/2)))
                    stickPointer_y[chan] = stickPointer_y[chan]+speed+pSpeed;
                pointerhidedelay[chan] = 150;
            }
            if(LEFT_STICK_RIGHT)
            {
                speed = (u8)(left_stick_mag[chan] * 10.00);
                pSpeed = (u8)((abs(PAD_StickX(chan))/10)|(abs(DS3_StickX()/10)));
                if(stickPointer_x[chan] < (m_vid.width() + (m_cursor[chan].width()/2)))
                    stickPointer_x[chan] = stickPointer_x[chan]+speed+pSpeed;
                pointerhidedelay[chan] = 150;
            }
            if(LEFT_STICK_UP)
            {
                speed = (u8)(left_stick_mag[chan] * 10.00);
                pSpeed = (u8)((abs(PAD_StickY(chan))/10)|(abs(DS3_StickY()/10)));
                if(stickPointer_y[chan] > m_cursor[chan].height()/2)
                    stickPointer_y[chan] = stickPointer_y[chan]-speed-pSpeed;
                pointerhidedelay[chan] = 150;
            }
        }
        else
        {
            if(pointerhidedelay[chan] > 0 && !wii_btnsHeld[chan] && !wii_btnsPressed[chan] 
                && !gc_btnsHeld && !gc_btnsPressed) 
                pointerhidedelay[chan]--;
        }
        if (pointerhidedelay[chan] == 0)
            m_show_pointer[chan] = false;
    }
}
 
It was only a test, my code is not the correct method to implement it, so I will stop trying to make it work.
What I did:
Create a new function for DS3_ScanPads() to act like PAD_ScanPads() from libogc, with up/down/pressed/analog, etc.
In "state" I set the corresponding CC defined value when PS3 button was detected as pressed.
 
  • Like
Reactions: AbdallahTerro
cool :)

New update Mod3 is out!
Link in my sig (includes extra folders to make the dol work)
What's new:
Fixed the PS3 controller button sensitivity by adding a tiny delay, this will enable title selection and Home (Start) button press no longer reboots (Thanks JoostinOnline for the great help)

I'm very happy with the new mod and I don't believe I'll modify the PS3 controller stuff anymore.

Things in this mod not found in official 1075 yet:
1. Fully working PS3 controller support vis USB cable
2. Support or both old and new Nintendont Autoboot
3. Extra Nintendont HID Button
4. Fixed Custom banner download URL

FIX94 what about making all the new stuff official? :P
 
So does this make it so I'd be able to play Wii games using my PS3 controller through WiiFlow, or is it just for WiiFlow? I was kinda confused on the OP
 

Site & Scene News

Popular threads in this forum