int BootGameCubeHomebrew() { if(homebrewsize == 0) return -1; xprintf("Booting GC Homebrew\n"); xprintf("if it fails, install correct cMIOS!\n"); static tikview view ATTRIBUTE_ALIGN(32); DI2_Init(); DI2_Reset(); DI2_ReadDiscID((u64 *) 0x80000000); DI2_Mount(); strcpy(GC_MAGIC_BUF, GC_DOL_MAGIC); DCFlushRange(GC_MAGIC_BUF, 32); memcpy(GC_DOL_BUF, homebrewbuffer, homebrewsize); DCFlushRange(GC_DOL_BUF, homebrewsize); *(vu32 *) 0xCC003024 |= 0x07; ES_GetTicketViews(BC, &view, 1); int ret = ES_LaunchTitle(BC, &view); exit_uneek_fs(); return ret; }
s32 WII_LaunchTitle(u64 titleID) { s32 res; u32 numviews; STACK_ALIGN(tikview,views,4,32); if(!__initialized) return WII_ENOTINIT; res = ES_GetNumTicketViews(titleID, &numviews); if(res < 0) { return res; } if(numviews > 4) { return WII_EINTERNAL; } res = ES_GetTicketViews(titleID, views, numviews); if(res < 0) return res; VIDEO_SetBlack(1); VIDEO_Flush(); res = ES_LaunchTitle(titleID, &views[0]); if(res < 0) return res; return WII_EINTERNAL; }
s32 StartMIOS (void) { s32 ret; SetGCVideoMode (); tikview view ATTRIBUTE_ALIGN(32); ret = ES_GetTicketViews(BC, &view, 1); if (ret != 0) return -1; // Tell DML to boot the game from sd card *(u32 *)0x80001800 = 0xB002D105; DCFlushRange((void *)(0x80001800), 4); ICInvalidateRange((void *)(0x80001800), 4); *(volatile unsigned int *)0xCC003024 |= 7; ret = ES_LaunchTitle(BC, &view); return -102; }
//--------------------------------------------------------------------------------- int main(int argc, char **argv) { VIDEO_Init(); VIDEO_SetBlack(true); // Disable video output during initialisation net_wc24cleanup(); if (fatMountSimple("sd", &__io_wiisd)) DebugStart (true, "sd://ploader.log"); else DebugStart (true, NULL); configbytes[0] = 0xCD; //configbytes[0] = 0; Debug ("---------------------------------------------------------------------------"); Debug (" di "VER" by stfour"); Debug (" (part of postLoader project)"); Debug ("---------------------------------------------------------------------------"); struct discHdr *header; header = (struct discHdr *)memalign(32, sizeof(struct discHdr)); s32 rr = Disc_Init(); Debug("Disc_Init() returned: %d", rr); rr = Disc_Open(); Debug("Disc_Open() returned: %d", rr); // Check disc rr = Disc_IsGC(); Debug("Disc_IsGC() returned: %d", rr); if (rr == 0) { rr = WDVD_ReadDiskId ((void*)0x80000000); Debug("WDVD_ReadDiskId() returned: %d", rr); rr = WDVD_EnableAudio(*(u8*)0x80000008); Debug("WDVD_EnableAudio() returned: %d", rr); *(volatile unsigned int *)0xCC003024 |= 7; int retval = ES_GetTicketViews(BC, &view, 1); if (retval != 0) { Debug("ES_GetTicketViews fail %d", retval); exit (0); } retval = ES_LaunchTitle(BC, &view); exit (0); } // Check disc rr = Disc_IsWii(); Debug("Disc_IsWii() returned: %d", rr); if (rr == 0) { // Read header rr = Disc_ReadHeader(header); Debug("Disc_ReadHeader() returned: %d", rr); Disc_WiiBoot (0, FALSE, TRUE, 0); } exit (0); }