Page 1 of 1

libogc: Pads unusable if unplugged then plugged back in

Posted: Fri Feb 08, 2008 9:52 pm
by PeterM
I've tried calling PAD_Init again, but it doesn't seem to help.

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Feb 09, 2008 5:00 pm
by WinterMute
We'll need a testcase I think, currently this works for me although I'm using current CVS & the next toolchain iteration.

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Feb 09, 2008 5:35 pm
by PeterM
Thanks for looking into it. I had a quick look through CVS and it's possible that there were fixes:
http://devkitpro.cvs.sourceforge.net/de ... 19&r2=1.20
(Note new variable "connected" in PAD_ScanPads).

I don't use PAD_ScanPads though, I just call PAD_Read in Quake's input update function. It's entirely possible that I'm "doing it wrong". :oops:

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Mon Feb 11, 2008 3:35 pm
by WinterMute
Well, yeah. You should be using the scanpads function or at least providing the same functionality we have in there now. That's one of those lot check items commercial games have to deal with too - input failure after replugging pads is a big no no.

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Mon Feb 11, 2008 7:32 pm
by PeterM
Even though I was calling PAD_Read myself, I was checking for all the error codes and acting (as far as I could tell) accordingly.

I switched my code over to use PAD_ScanPads as the post-retrace callback, but still no dice. Once the pad is unplugged, the buttons are always zero. The code is a lot simpler though, so I'll probably keep it this way!

Do you know if this is something which is fixed in the CVS version and handled internally by PAD_ScanPads?
Edit: Sorry, just realised you confirmed that already.

Thanks for looking into these issues by the way.

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Mar 01, 2008 12:08 pm
by Eke
About PAD_ScanPad, we got warnings when we pass it at argument for the function "VIDEO_SetPostRetraceCallback"

the reason is in function type declaration:
typedef void (*VIRetraceCallback)(u32 retraceCnt);
u32 PAD_ScanPads();

it's not really important but maybe this should be fixed as PAD_ScanPads is, as you said, mostly used as PostRetraceCallback

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Mar 01, 2008 12:09 pm
by PeterM
I mentioned that to WinterMute recently, who said the PAD_ScanPads call should be moved to your update/main loop and not done in the retrace callback any more.

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Mar 01, 2008 9:03 pm
by Eke
ok, using PostRetraceCallback seemed more optimized but why not :|

anyway, from my first tests with the new release,it seems the issue when unplugging pads has been fixed in libogc , which is good news :P

Re: libogc: Pads unusable if unplugged then plugged back in

Posted: Sat Apr 12, 2008 3:13 pm
by Eke
Some precisions: it is fixed in GC mode but NOT in Wii mode !

remove the gamepad then reinsert it, it is not readable anymore