Line 29: |
Line 29: |
| #include <unistd.h> | | #include <unistd.h> |
| #include <assert.h> | | #include <assert.h> |
| + | #include <ogc/ios.h> |
| + | #include <ogc/stm.h> |
| + | #include <ogc/es.h> |
| + | #include <ogc/gu.h> |
| | | |
| static void *xfb = NULL; | | static void *xfb = NULL; |
| static GXRModeObj *rmode = NULL; | | static GXRModeObj *rmode = NULL; |
| | | |
− | #include "ios.c" | + | #define USB_ALIGN __attribute__ ((aligned(32))) |
− | #include "stm.c"
| + | |
− | #include "es.h"
| + | #define MAX_WIIMOTES 4 |
− | #include "es.c"
| |
− | #include "ipc.h"
| |
− | #include "gu.c" | |
| | | |
| #include "GRRLIB.h" | | #include "GRRLIB.h" |
| + | |
| + | #include "wiiuse.h" |
| | | |
| #include "../gfx/music.h" | | #include "../gfx/music.h" |
| + | #include "../gfx/cursor.h" |
| + | #include "../gfx/impact.h" |
| | | |
| typedef void (*Loader_Entry)(void); | | typedef void (*Loader_Entry)(void); |
Line 50: |
Line 55: |
| | | |
| extern u16 *GRRLIB_buffer; | | extern u16 *GRRLIB_buffer; |
| + | |
| + | void wiimote_event(struct wiimote_t* wm, int event) |
| + | { |
| + | } |
| | | |
| void hello(void) | | void hello(void) |
Line 90: |
Line 99: |
| | | |
| VIDEO_Configure(rmode); | | VIDEO_Configure(rmode); |
− | VIDEO_SetNextFramebuffer(xfb);
| + | VIDEO_SetNextFramebuffer(xfb); |
| VIDEO_SetBlack(FALSE); | | VIDEO_SetBlack(FALSE); |
| VIDEO_Flush(); | | VIDEO_Flush(); |
Line 98: |
Line 107: |
| | | |
| void sysutils(void) { | | void sysutils(void) { |
− | bool pressed;
| |
− |
| |
− | pressed=false;
| |
− |
| |
− | clearscreen();
| |
− |
| |
− | printf("System Utils Menu\n");
| |
− | printf("-----------------\n\n");
| |
− | printf("X = Load IOS37\n");
| |
− | printf("Y = Load IOS9\n");
| |
− | printf("B = Go Back\n");
| |
− | printf("Press A to continue \n");
| |
− | while((pressed=false)) {
| |
− | VIDEO_WaitVSync();
| |
− | PAD_ScanPads();
| |
− | int buttonsDown = PAD_ButtonsHeld(0);
| |
− | if (buttonsDown & PAD_BUTTON_X){
| |
− | __IOS_LaunchNewIOS(37);
| |
− | pressed=true;
| |
− | }
| |
− | if (buttonsDown & PAD_BUTTON_Y){
| |
− | IOS_ReloadIOS(9);
| |
− | pressed=true;
| |
− | }
| |
− | if (buttonsDown & PAD_BUTTON_B){
| |
− | pressed=true;
| |
− | }
| |
− | }
| |
| return; | | return; |
| } | | } |
Line 147: |
Line 128: |
| int revmi; | | int revmi; |
| int di_fd; | | int di_fd; |
− | int es_fd;
| |
− | int vec;
| |
− | u32 wiiid;
| |
| static u8 stm_inbuf[0x20] ATTRIBUTE_ALIGN(32); | | static u8 stm_inbuf[0x20] ATTRIBUTE_ALIGN(32); |
| static u8 stm_iobuf[0x20] ATTRIBUTE_ALIGN(32); | | static u8 stm_iobuf[0x20] ATTRIBUTE_ALIGN(32); |
Line 165: |
Line 143: |
| IOS_Close(di_fd); | | IOS_Close(di_fd); |
| | | |
− | vec=0;
| + | GRRLIB_DrawImg(10,50, music_width, music_high, music_img, 0, 1); |
− | es_fd=IOS_Open("/dev/es",1);
| |
− | vec = ES_GetDeviceID(&wiiid);
| |
− | // printf("Console ID : %08x \n\n", wiiid);
| |
− | IOS_Close(es_fd);
| |
− |
| |
− | GRRLIB_DrawImg(10,50, music_width, music_high, music_img); | |
| GRRLIB_Render(); | | GRRLIB_Render(); |
| | | |
Line 225: |
Line 197: |
| /**************************************************************************** | | /**************************************************************************** |
| Initialise Video | | Initialise Video |
− | Initialise GCPad for input
| + | Initialise GCPad for input |
| ****************************************************************************/ | | ****************************************************************************/ |
| | | |
| GRRLIB_buffer=(u16 *)malloc(640*240*2); | | GRRLIB_buffer=(u16 *)malloc(640*240*2); |
− | | + | wiimote** wiimotes; |
| + | |
| VIDEO_Init(); | | VIDEO_Init(); |
| PAD_Init(); | | PAD_Init(); |
| | | |
| + | *((u32*)0xcd0000c0) |= 0x100; |
| + | bte_init(); |
| + | bte_start(); |
| + | wiimotes = wiiuse_init(MAX_WIIMOTES,wiimote_event); |
| + | |
| GRRLIB_InitVideo(); | | GRRLIB_InitVideo(); |
| GRRLIB_Start(); | | GRRLIB_Start(); |
Line 253: |
Line 231: |
| } | | } |
| | | |
− | xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); | + | console(); |
− | xjb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
| |
− | console_init(xfb,20,20,rmode->fbWidth,rmode->xfbHeight,rmode->fbWidth*VI_DISPLAY_PIX_SZ);
| |
− |
| |
− | VIDEO_Configure(rmode);
| |
− | VIDEO_SetNextFramebuffer(xfb);
| |
− | VIDEO_SetBlack(FALSE);
| |
− | VIDEO_Flush();
| |
− | VIDEO_WaitVSync();
| |
| if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); | | if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync(); |
| | | |