EXI's api

Post Reply
0000
Posts: 1
Joined: Thu Jun 28, 2012 3:41 pm

EXI's api

Post by 0000 » Thu Jun 28, 2012 3:46 pm

Hello,

I'm trying to play with the EXI's api but it always fail in EXI_Select function.
Here is my tiny code:

Code: Select all

#include <gccore.h>
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <ogcsys.h>
#include <debug.h>
#include <math.h>


static void *xfb = NULL;

u32 first_frame = 1;
GXRModeObj *rmode;
vu16 oldstate;
vu16 keystate;
vu16 keydown;
vu16 keyup;
PADStatus pad[4];


int main()
{
    unsigned char data[] = { 0x90, 0x55, 0x42 };
    unsigned int i = 0;

	VIDEO_Init();
	
	rmode = VIDEO_GetPreferredMode(NULL);
	
	PAD_Init();

	
	xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
		
	VIDEO_Configure(rmode);
		
	VIDEO_SetNextFramebuffer(xfb);
	
	VIDEO_SetBlack(FALSE);
	VIDEO_Flush();
	VIDEO_WaitVSync();
	if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
	
	
	console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*2);


	printf(".-=##############################=-.\n");
	printf(" Testing EXI gamecube communication\n");
	printf(".-=##############################=-.\n");

    if ( EXI_Select ( EXI_CHANNEL_0, EXI_DEVICE_0, EXI_SPEED16MHZ ) )
        printf ( "[+] EXI channel 0, device 0, frequency 16Mhz\n" );
    else
        printf ( "[!] Cannot select EXI channel 0, device 0 with 16Mhz frequency!\n" );

	while(1) {
		VIDEO_WaitVSync();
		PAD_ScanPads();

		int buttonsDown = PAD_ButtonsDown(0);
		
		if (buttonsDown & PAD_BUTTON_START) {
            printf ( "[+] Trying to send %02Xh on EXI0:1\n", (unsigned char)data[i] );
            if ( EXI_Imm ( EXI_CHANNEL_0, &data[i++], sizeof ( unsigned char ), EXI_WRITE, NULL ) )
                printf ( "   [+] Data has been sent on EXI0:1.\n" );
            else
                printf ( "   [!] Cannot send data on EXI0:1\n" );
            i=i%3;
		}
	}
}
EXI_Select always return 0 (tried with a memory card).

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests