Welcome! Log In Create A New Profile

Advanced

Returning Wiimote Connection Status

Posted by Arikado 
Returning Wiimote Connection Status
January 17, 2009 12:47AM
Could someone give me a very small, simple snippet of code that detects wether or not a wiimote is connected. For example:

if(wiimote_chan_0 is connected)
do something();

if(wiimote_chan_1 is connected)
do something();

//etc.

I tried about 5 different things and nothing appears to be working (and I dont have much time to keep playing around).

Thanks in advance to everyone,
Arikado
Re: Returning Wiimote Connection Status
January 17, 2009 12:58AM
I use this code in my WiiCmd class:

bool WiiCmd::WiimoteConnected(int wiimote){

        u32 type;
        int res = WPAD_Probe(wiimote, &type);
        if(res == WPAD_ERR_NONE){
                return true;
        }

        return false;
}

Which is called like this:
if(!w->WiimoteConnected(0)){
           m->msg("  Waiting for Wiimote #1 to connect.");
}

0 being the channel of the wiimote.
Re: Returning Wiimote Connection Status
January 17, 2009 01:04AM
Thank you. My code is similiar except I was looking for something other than WPAD_ERR_NONE. Thank you very much. My problems are solved now. I really appreciate this.
Sorry, only registered users may post in this forum.

Click here to login