Welcome! Log In Create A New Profile

Advanced

Accessing gamecube port

Posted by holy_artefact 
Accessing gamecube port
October 04, 2009 05:01PM
What I want to do is accessing the gamecube ports and to do serial communication with it.
I ask this question because I want to replicate the xboo communications used to transfert gba roms to a linked gba (ngc -> gba cable) just like some gamecube games (Zelda : Four Swords adventure).
[www.devkitpro.org] -> XBOO on devkitpro pages

I don't have a gba to test, but I plan on getting one (but I have the cable =) !!!!! ).
I also think that the PAD_ScansPads will interfere with these communications, can we disable a port when we do PAD_ScansPAD????

Thanks for response in advance
Re: Accessing gamecube port
October 05, 2009 05:45AM
In the libogc source PAD_ScanPads() uses this for loop

for(i=0;i<PAD_CHANMAX;i++) 
blablablabla...

So you can just copy the function into your code and call it PAD_ScanPads1() and then change the loop to exclude the port you're using for other stuff.

if you are using GC slot 4...
for(i=0;i<PAD_CHANMAX-1;i++) 
blablablabla...

or slot 1...
for(i=1;i<PAD_CHANMAX;i++) 
blablablabla...


you would also need to keep your GC channel from getting scanned in the while loop here probably

u32 PAD_Read(PADStatus *status)
{
	u32 chan,mask,ret;
	u32 level,sistatus,type;
	u32 buf[2];
#ifdef _PAD_DEBUG
	printf("PAD_Read(%p)\n",status);
#endif
	_CPU_ISR_Disable(level);
	chan = 0;
	ret = 0;
	while(chan<4) {
blablablabla.....

Then you can just call PAD_ScanPads1() every time you want to scan and omit that port.



Edited 2 time(s). Last edit at 10/05/2009 06:04AM by giantpune.
Re: Accessing gamecube port
October 05, 2009 05:43PM
Thanks giantpune,

I will try to copy ScanPads and PAD_Read with conditions!

But what about sending bits into pad channel 1 for example?
There seems to be a function like SI_SetCommand(chan,cmd); in the pad.c source code.
But when I look in si.c, first I don't understand the code and there's also a function SI_GetResponseRaw(s32 chan).
That seems to be a part of the answer....

If someone know how it works, I would appreciate to understand!
Sorry, only registered users may post in this forum.

Click here to login