Changes

Jump to navigation Jump to search
1,600 bytes added ,  11:15, 27 April 2008
#include <ogc/es.h>
#include <ogc/gu.h>
#include <ogc/usb.h>
#include <bte/bte.h>
static void *xfb = NULL;
typedef void (*Loader_Entry)(void);
static u32 *xjb;
 
wiimote** wiimotes;
Loader_Entry loader = (Loader_Entry)0x80001800;
extern u16 *GRRLIB_buffer;
unsigned int buttonA=0;
unsigned int buttonB=0;
unsigned int buttonUp=0;
unsigned int buttonDown=0;
unsigned int buttonLeft=0;
unsigned int buttonRight=0;
unsigned int buttonPlus=0;
unsigned int buttonMinus=0;
unsigned int buttonHome=0;
unsigned int buttonOne=0;
unsigned int buttonTwo=0;
unsigned int rumble=0;
unsigned int irx=0,iry=0;
void wiimote_event(struct wiimote_t* wm, int event)
{
wiiuse_rumble(wiimotes[0], rumble);
switch (event) {
case WIIUSE_EVENT:
buttonB=0;
buttonA=0;
buttonUp=0;
buttonDown=0;
buttonLeft=0;
buttonRight=0;
buttonPlus=0;
buttonMinus=0;
buttonHome=0;
buttonOne=0;
buttonTwo=0;
 
if (IS_PRESSED(wm, WIIMOTE_BUTTON_B))
buttonB=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_A))
buttonA=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_UP))
buttonUp=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_DOWN))
buttonDown=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_LEFT))
buttonLeft=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_RIGHT))
buttonRight=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_HOME))
buttonHome=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_ONE))
buttonOne=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_TWO))
buttonTwo=1;
if (IS_PRESSED(wm, WIIMOTE_BUTTON_PLUS))
buttonPlus=1;
if ( IS_PRESSED(wm, WIIMOTE_BUTTON_MINUS))
buttonMinus=1;
break;
default:
break;
}
 
}
void hello(void)
{
printf(" Hello world!\n"); printf(" v 0.345");
}
void menutext(void)
{
printf(" Menu\n"); printf(" ----\n"); printf("Start + Z Home = Return to loader\n"); printf("A Up !! = Elf Loader\n"); printf("B Down !! = System Utils\n"); printf("Y Left ! = Fun\n"); printf("X Right = Reboot Wii\n");
return;
}
void checkAndReload(void) {
PAD_ScanPads(); int buttonsDown = PAD_ButtonsHeld(0); if( (buttonsDown & PAD_TRIGGER_Z) && (buttonsDown & PAD_BUTTON_STARTbuttonHome==1)) {
loader();
}
xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
xjb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
console_initCON_Init(xfb,20,20120,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
VIDEO_Configure(rmode);
__STM_Init();
printf(" FUN\n"); printf(" ---\n\n");
int ver;
revma=IOS_GetRevisionMajor();
revmi=IOS_GetRevisionMinor();
printf(" IOS Version : %d Revision : %d.%d \n\n", ver, revma, revmi);
((u32*)stm_inbuf)[0x00] = 0x70000000;
IOS_Ioctl( di_fd, stm_inbuf[0x00], stm_inbuf, 0x20, stm_iobuf, 0x20);
printf(" DVD ID : %s \n\n",stm_iobuf);
IOS_Close(di_fd);
//GRRLIB_DrawImg(10,50, music_width, music_high, music_img, 0, 1); //GRRLIB_Render(); printf(" Press + to rumble\n"); printf(" Press - to stop\n\n");
printf(" Press A to continue\n");
while(1) {
VIDEO_WaitVSync();
PAD_ScanPadsif ((); int buttonsDown buttonA== PAD_ButtonsHeld(01); if (buttonsDown & PAD_BUTTON_A){
console();
clearscreen();
return;
}
if ((buttonPlus==1)){
rumble=1;
}
if ((buttonMinus==1)){
rumble=0;
}
}
}
VIDEO_WaitVSync();
checkAndReload();
PAD_ScanPadsif ((); int buttonsDown buttonLeft== PAD_ButtonsHeld(01); if (buttonsDown & PAD_BUTTON_Y){
fun();
}
if (buttonsDown & PAD_BUTTON_X(buttonRight==1)){
shutdown();
}
if (buttonsDown & PAD_BUTTON_B(buttonDown==1)){
//sysutils();
}
if (buttonsDown & PAD_BUTTON_A(buttonUp==1)){
//elfloader();
}
void start(void) {
PAD_ScanPads if(); int buttonsDown (buttonB== PAD_ButtonsHeld(01); if(buttonsDown & PAD_BUTTON_START) { menu(); }
}
int main(int argc, char **argv) {
/****************************************************************************
Initialise Video
Initialise GCPad for input
GRRLIB_buffer=(u16 *)malloc(640*240*2);
wiimote** wiimotes;
VIDEO_Init();
PAD_Init();
*((u32*)0xcd0000c0) |//rmode = 0x100&TVPal528IntDf; bte_init(); bte_start(); wiimotes = wiiuse_init(MAX_WIIMOTES,wiimote_event); GRRLIB_InitVideo(); GRRLIB_Start(); GRRLIB_FillScreen(0x0000); GRRLIB_Render(); 
switch(VIDEO_GetCurrentTvMode()) {
case VI_NTSC:
console();
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
printf(" Press 1&2\n\n");
*((u32*)0xcd0000c0) |= 0x100;
bte_init();
bte_start();
wiimotes = wiiuse_init(MAX_WIIMOTES,wiimote_event);
wiiuse_find(wiimotes, MAX_WIIMOTES, 5);
wiiuse_connect(wiimotes, MAX_WIIMOTES);
wiiuse_set_leds(wiimotes[0], WIIMOTE_LED_1);
wiiuse_rumble(wiimotes[0], 1);
usleep(200000); /* 200ms */
wiiuse_rumble(wiimotes[0], 0);
clearscreen();
GRRLIB_InitVideo();
GRRLIB_Start();
GRRLIB_FillScreen(0x0000);
GRRLIB_Render();
 
console();
/****************************************************************************
hello();
printf("\n");
printf(" My first native wii homebrew\n\n"); printf(" Press Start B :-)\n\n");
while(1) {
return 0;
}
 
 
</source>
569

edits

Navigation menu