Exemple #1
0
void mk_mload_version()
{
	mload_ver_str[0] = 0;
	mload_ver = 0;
	if (CFG.ios_mload
			|| (is_ios_type(IOS_TYPE_WANIN) && IOS_GetRevision() >= 18) )
	{
		if (IOS_GetRevision() >= 4) {
			if (is_ios_type(IOS_TYPE_WANIN)) {
				char *info = get_ios_info_from_tmd();
				if (info) {
					sprintf(mload_ver_str, "Base: IOS%s ", info);
				} else {
					sprintf(mload_ver_str, "Base: IOS?? DI:%d ", wanin_mload_get_IOS_base());
				}
			} else {
				sprintf(mload_ver_str, "Base: IOS%d ", mload_get_IOS_base());
			}
		}
		if (IOS_GetRevision() > 4) {
			int v, s = 0;
			v = mload_ver = mload_get_version();
			if (v>0) {
				s = v & 0x0F;
				v = v >> 4;
			}
			sprintf(mload_ver_str + strlen(mload_ver_str), "mload v%d.%d ", v, s);
		} else {
Exemple #2
0
s32 IOS_GetRevisionMinor()
{
	s32 rev;
	rev = IOS_GetRevision();
	if(rev < 0) return rev;
	return rev&0xFF;
}
Exemple #3
0
s32 IOS_GetRevisionMajor()
{
	s32 rev;
	rev = IOS_GetRevision();
	if(rev < 0) return rev;
	return (rev>>8)&0xFF;
}
Exemple #4
0
s32 Nand_Enable(nandDevice *dev)
{
	s32 fd, ret;

	/* Open /dev/fs */
	fd = IOS_Open("/dev/fs", 0);
	if (fd < 0)
		return fd;

	memset(inbuf, 0, sizeof(inbuf));

	/* Set input buffer */
	if (IOS_GetRevision() >= 20)
	{
		// New method, fully enable full emulation
		inbuf[0] = dev->mode | 0x100;
	} else
	{
		// Old method
		inbuf[0] = dev->mode;
	}

	/* Enable NAND emulator */
	ret = IOS_Ioctl(fd, 100, inbuf, sizeof(inbuf), NULL, 0);

	/* Close /dev/fs */
	IOS_Close(fd);

	return ret;
} 
Exemple #5
0
void IOS_GetCurrentIOSInfo()
{
	memset(&CurrentIOS, 0, sizeof(IOS_Info));
	CurrentIOS.Version = IOS_GetVersion();
	CurrentIOS.Base = CurrentIOS.Version;
	CurrentIOS.Revision = IOS_GetRevision();
	CurrentIOS.SubRevision = 0;
	CurrentIOS.Type = IOS_GetType(CurrentIOS.Version);
	if(CurrentIOS.Type == IOS_TYPE_D2X)
	{
		iosinfo_t *iosInfo = IOS_GetInfo(CurrentIOS.Version);
		CurrentIOS.Revision = iosInfo->version;
		CurrentIOS.Base = iosInfo->baseios;
		gprintf("D2X IOS%i[%i] v%i\n", CurrentIOS.Version, CurrentIOS.Base, 
			CurrentIOS.Revision);
		MEM2_free(iosInfo);
	}
	else if(CurrentIOS.Type == IOS_TYPE_WANIN)
	{
		if(CurrentIOS.Revision >= 18)
			CurrentIOS.Base = wanin_mload_get_IOS_base();
		gprintf("Waninkoko IOS%i[%i] v%i\n", CurrentIOS.Version, CurrentIOS.Base, 
			CurrentIOS.Revision);
	}
	else if(CurrentIOS.Type == IOS_TYPE_HERMES)
	{
		CurrentIOS.Base = mload_get_IOS_base();
		if(CurrentIOS.Revision > 4)
		{
			CurrentIOS.Revision = mload_get_version() >> 4;
			CurrentIOS.SubRevision = mload_get_version() & 0xF;
		}
Exemple #6
0
void logfile_header()
{
	logfile("\r\n\r\n*---------------------------------------------------------------------------------------------------------------------------*\r\n");
	logfile("\r\n\r\nYet Another BlueDump MOD v%s - Logfile.\r\n", VERSION);
	logfile("SDmnt(%d), USBmnt(%d), isUSB2(%d), isSD(%d), vwii(%d), __wiilight(%d).\r\n", SDmnt, USBmnt, isUSB2, isSD, vwii, __wiilight);
	logfile("Using IOS%ld v%ld.\r\n", IOS_GetVersion(), IOS_GetRevision());
	logfile("Console language: %d (%s).\r\n\r\n", lang, languages[lang]);
}
Exemple #7
0
void detectIOScapabilities()
{
	if (!(identifyworks = DIVerify_works()) || identify_SU() < 0 || !DIVerify_works())
	{
		if (identifyworks)
		{
			menu_generatechannellist(TRUE);	// DIVerify seems to be slightly broken, try to workaround the problem
			IOS_ReloadIOS(IOS_GetVersion()); // Reset IOS, needed for some buggy cIOS versions
			buggycIOS = 1;
			identifyworks = (channellist_menu_items > 0);
		}
	}
	if (IOS_GetVersion() == 249 && IOS_GetRevision() > 7 && IOS_GetRevision() < 14)
		disableRebooter = 1;
	else
		disableRebooter = 0;
}
void disableIOSReload(void)
{
	if (mload_init() < 0 || IOS_GetRevision() == 2)
		return;

	patch_datas[0] = *((u32 *)(dip_plugin + 16 * 4));
	mload_set_ES_ioctlv_vector((void *)patch_datas[0]);
	mload_close();
}
Exemple #9
0
int main(int argc, char **argv)
{
    //DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
    s8 ios_patched = 0;
    s32 ret = 0;

    CheckForGecko();
    VIDEO_Init();

    vmode = VIDEO_GetPreferredMode(NULL);
    xfb = MEM_K0_TO_K1(SYS_AllocateFramebuffer(vmode));

    VIDEO_Configure(vmode);
    VIDEO_SetNextFramebuffer(xfb);
    VIDEO_SetBlack(false);
    VIDEO_Flush();

    VIDEO_WaitVSync();
    if (vmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync();

    int x = 20, y = 20, w, h;
    w = vmode->fbWidth - (x * 2);
    h = vmode->xfbHeight - (y + 20);

    // Initialize the console
    //Con_InitEX works better but for some odd reason doesn't show right when clearing screen...
    //CON_InitEx(vmode, x, y, w, h);
    CON_Init(xfb,x,y,w,h, vmode->fbWidth*VI_DISPLAY_PIX_SZ );
    printf("\n\n\n");
    VIDEO_ClearFrameBuffer(vmode, xfb, COLOR_BLACK);

    gprintf("resolution is %dx%d\n",vmode->viWidth,vmode->viHeight);
    //printf("\x1b[2J");
    /*sleep(3);
    gprintf("crashing...\n");
    free((void*)0x1);*/
    /*free((void*)0x1);
    free((void*)0x1);
    free((void*)0x1);
    memcpy((void*)0x0,(void*)0x1,5);*/
    //return 0;
    //reload ios so that IF the user started this with AHBPROT we lose everything from HBC. also, IOS36 is the most patched ios :')
    IOS_ReloadIOS(36);

    WPAD_Init();
    PAD_Init();

    printf("\nIOS %d rev %d\n\n",IOS_GetVersion(),IOS_GetRevision());
    if( (VERSION&0xFF) % 10 == 0 )
    {
#if BETAVERSION > 0
        printf("Priiloader v%d.%db%d(r0x%08x) Installation/Removal Tool\n\n\n\n\t",VERSION>>8, (VERSION&0xFF) / 10,BETAVERSION,GIT_REV);
#else
        printf("\t\tPriiloader v%d.%d(r0x%08x) Installation / Removal Tool\n\n\n\n\t",VERSION>>8, (VERSION&0xFF) / 10,GIT_REV);
#endif
    }
Exemple #10
0
void printheadline()
{
	int rows, cols;
	CON_GetMetrics(&cols, &rows);

	printf("118Channel and IOS118 Installer v1");
	
	char buf[64];
	sprintf(buf, "IOS%u (Rev %u)\n", IOS_GetVersion(), IOS_GetRevision());
	printf("\x1B[%d;%dH", 0, cols-strlen(buf)-1);	
	printf(buf);
}
bool shadow_mload()
{
	int ios = IOS_GetVersion();

	if(ios != 222 || ios != 223 || ios != 224)
		return false;

	int v51 = (5 << 4) & 1;
	if (IOS_GetRevision() >= 5 && mload_get_version() >= v51)
	{
		char fs[] ATTRIBUTE_ALIGN(32) = "/dev/mload/OFF";
		// shadow /dev/mload supported in hermes cios v5.1char fs[] ATTRIBUTE_ALIGN(32) = "/dev/usb2";
		IOS_Open(fs,0);
		return true;
	}
Exemple #12
0
void printheadline()
{
	int rows, cols;
	CON_GetMetrics(&cols, &rows);
	
	printf("Yet Another BlueDump MOD v%s.", VERSION);
	
	char buf[64];
	sprintf(buf, "IOS%ld (v%ld)", IOS_GetVersion(), IOS_GetRevision());
	printf("\x1b[%d;%dH", 0, cols-strlen(buf)-1);
	printf(buf);
	
	printf("\nOriginal code by nicksasa and WiiPower.");
	printf("\nUpdated by DarkMatterCore. Additional code by JoostinOnline.");
	printf("\nHacksDen.com, The Hacking Resource Community (2013-2017).\n\n");
}
Exemple #13
0
void Print_SYS_Info()
{
	FgColor(CFG.color_inactive);
	printf_("");
	Fat_print_sd_mode();
	printf_(gt("CFG base: %s"), USBLOADER_PATH);
	printf("\n");
	if (strcmp(LAST_CFG_PATH, USBLOADER_PATH)) {
		// if last cfg differs, print it out
		printf_(gt("Additional config:"));
		printf("\n");
		printf_("  %s/config.txt\n", LAST_CFG_PATH);
	}
	printf_(gt("Loader Version: %s"), CFG_VERSION);
	printf("\n");
	printf_("IOS%u (Rev %u)\n",
			IOS_GetVersion(), IOS_GetRevision());
	DefaultColor();
}
Exemple #14
0
void Menu_Loop(void)
{
	u8 iosVersion;
	/* Select IOS menu */
	Menu_SelectIOS();

	/* Retrieve IOS version */
	iosVersion = IOS_GetVersion();

	ndev = &ndevList[0];

	/* NAND device menu */
	if ((iosVersion == CIOS_VERSION || iosVersion == 250) && IOS_GetRevision() >13)
	{
		Menu_NandDevice();
	}
	for (;;) {
		/* FAT device menu */
		Menu_FatDevice();

		/* WAD list menu */
		Menu_WadList();
	}
}
Exemple #15
0
int
main(int argc, char *argv[])
{
    setlocale(LC_ALL, "en.UTF-8");
    geckoinit = InitGecko();

    if (hbcStubAvailable() || geckoinit)
    {
        InitTextVideo();
    }

    //	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
    //_break();

    __exception_setreload(5);                     //auto reset code dump nobody gives us codedump info anyways.

    gprintf("\n\n------------------");
    gprintf("\nUSB Loader GX rev%s",GetRev());
    gprintf("\nmain(%d", argc);
    for (int i=0;i<argc;i++)
        gprintf(", %s",argv[i]?argv[i]:"<NULL>");
    gprintf(")");

    // This part is added, because we need a identify patched ios
//    printf("\n\tReloading into ios 236");
    if (IOS_ReloadIOSsafe(236) < 0)
    {
//        printf("\n\tIOS 236 not found, reloading into 36");
        IOS_ReloadIOSsafe(36);
    }

    printf("\n\tStarting up");

    MEM2_init(36);                                // Initialize 36 MB
    MEM2_takeBigOnes(true);

    s32 ret;
    bool startupproblem = false;

    bool bootDevice_found=false;
    if (argc >= 1)
    {
        if (!strncasecmp(argv[0], "usb:/", 5))
        {
            strcpy(bootDevice, "USB:");
            bootDevice_found = true;
        } else if (!strncasecmp(argv[0], "sd:/", 4))
        bootDevice_found = true;
    }

    printf("\n\tInitializing controllers");

    /** PAD_Init has to be before InitVideo don't move that **/
    PAD_Init();                                   // initialize PAD/WPAD

    printf("\n\tInitialize USB (wake up)");

    USBDevice_Init();                             // seems enough to wake up some HDDs if they are in sleep mode when the loader starts (tested with WD MyPassport Essential 2.5")

    gprintf("\n\tChecking for stub IOS");
    ios222rev = getIOSrev(0x00000001000000dell);
    ios249rev = getIOSrev(0x00000001000000f9ll);

    //if we don't like either of the cIOS then scram
    if (!(ios222rev==4 || ios222rev==5 || (ios249rev>=9 && ios249rev<65280)))
    {
        InitTextVideo();
        printf("\x1b[2J");
        if ((ios222rev < 0 && ios222rev != WII_EINSTALL) && (ios249rev < 0 && ios249rev != WII_EINSTALL))
        {
            printf("\n\n\n\tWARNING!");
            printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
            printf("\n\n\tWe cannot determine the versions on your system,\n\tsince you have no patched ios 36 or 236 installed.");
            printf("\n\tTherefor, if loading of USB Loader GX fails, you\n\tprobably have installed the 4.2 update,");
            printf("\n\tand you should go figure out how to get some cios action going on\n\tin your Wii.");
            printf("\n\n\tThis message will show every time.");
            sleep(5);
        }
        else
        {
            printf("\n\n\n\tERROR!");
            printf("\n\tUSB Loader GX needs unstubbed cIOS 222 v4 or 249 v9+");
            printf("\n\n\tI found \n\t\t222 = %d%s",ios222rev,ios222rev==65280?" (Stubbed by 4.2 update)":"");
            printf("\n\t\t249 = %d%s",ios249rev,ios249rev==65280?" (Stubbed by 4.2 update)":"");
            printf("\n\n\tGo figure out how to get some cIOS action going on\n\tin your Wii and come back and see me.");

            sleep(15);
            printf("\n\n\tBye");

            USBDevice_deInit();
            exit(0);
        }
    }

    printf("\n\tReloading ios 249...");
    ret = IOS_ReloadIOSsafe(249);

    printf("%d", ret);

    if (ret < 0)
    {
        printf("\n\tIOS 249 failed, reloading ios 222...");
        ret = IOS_ReloadIOSsafe(222);
        printf("%d", ret);

        if (ret < 0)
        {
            printf("\n\tIOS 222 failed, reloading ios 250...");
            ret = IOS_ReloadIOSsafe(250);
            printf("%d", ret);

            if(ret < 0)
            {
                printf("\n\tIOS 250 failed, reloading ios 223...");
                ret = IOS_ReloadIOSsafe(223);
                printf("%d", ret);

                if (ret < 0)
                {
                    printf("\n\tERROR: cIOS could not be loaded!\n");
                    sleep(5);
                    SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
                }
            }
        }
        printf("\n\tInitialize sd card");
        SDCard_Init();
        printf("\n\tLoad ehc module");
        load_ehc_module();
        printf("\n\tdeinit sd card");
        SDCard_deInit();
    }

    printf("\n\tInit wbfs...");
    ret = WBFS_Init(WBFS_DEVICE_USB);
    printf("%d", ret);

    if (ret < 0)
    {
        printf("\n\tYou have issues with a slow disc, or a difficult disc\n\tReloading 222...");
        ret = IOS_ReloadIOSsafe(222);
        printf("%d", ret);
        /*if(ret < 0) {
        //			printf("\n\tSleeping for 4 seconds");
        //			sleep(4);

            InitVideo(); // Initialise video
            Menu_Render();
            BootUpProblems();
            startupproblem = true;
            ret = 1;
        }*/
        printf("\n\tInitialize sd card");
        SDCard_Init();
        printf("\n\tLoad ehc module");
        load_ehc_module();
        printf("\n\tdeinit sd card");
        SDCard_deInit();

        printf("\n\tInitialize wbfs...");
        USBDevice_deInit();
        USBDevice_Init();
        ret = WBFS_Init(WBFS_DEVICE_USB);
        printf("%d", ret);

        if(ret < 0)
        {
            //			printf("\n\tSleeping for 4 seconds");
            //			sleep(4);
            InitVideo();                          // Initialise video
            Menu_Render();
            BootUpProblems();
            startupproblem = true;
            ret = 1;
        }
    }

    printf("\n\tInitialize sd card");
    SDCard_Init();                                // mount SD for loading cfg's

    //this should have already been done by now in order to WBFS_Init().
    printf("\n\tInitialize usb device");
    USBDevice_Init();                             // and mount USB:/

    if (!bootDevice_found)
    {
        printf("\n\tSearch for configuration file");

        //try USB
        //left in all the dol and elf files in this check in case this is the first time running the app and they dont have the config
        if (checkfile((char*) "USB:/config/GXglobal.cfg") || (checkfile((char*) "USB:/apps/usbloader_gx/boot.elf"))
            || checkfile((char*) "USB:/apps/usbloadergx/boot.dol") || (checkfile((char*) "USB:/apps/usbloadergx/boot.elf"))
            || checkfile((char*) "USB:/apps/usbloader_gx/boot.dol"))
            strcpy(bootDevice, "USB:");

        printf("\n\tConfiguration file is on %s", bootDevice);
    }

    // Try opening and closing the configuration file here
    // to prevent a crash dump later on - giantpune
    char GXGlobal_cfg[26];
    sprintf(GXGlobal_cfg, "%s/config/GXGlobal.cfg", bootDevice);
    FILE *fp = fopen(GXGlobal_cfg, "r");
    if (fp)
    {
        fclose(fp);
    }

    gettextCleanUp();
    printf("\n\tLoading configuration...");
    CFG_Load();
    printf("done");
    //	gprintf("\n\tbootDevice = %s",bootDevice);

    /* Load Custom IOS */
    if ((Settings.cios == ios222 && IOS_GetVersion() != 222) ||
        (Settings.cios == ios223 && IOS_GetVersion() != 223))
    {
        printf("\n\tReloading IOS to config setting (%d)...", Settings.cios == ios222 ? 222 : 223);
        SDCard_deInit();                          // unmount SD for reloading IOS
        USBDevice_deInit();                       // unmount USB for reloading IOS
        USBStorage2_Deinit();
        ret = IOS_ReloadIOSsafe(Settings.cios == ios222 ? 222 : 223);
        printf("%d", ret);
        SDCard_Init();
        load_ehc_module();
        if (ret < 0)
        {
            SDCard_deInit();
            Settings.cios = ios249;
            ret = IOS_ReloadIOSsafe(249);
            // now mount SD:/  //no need to keep mindlessly mounting and unmounting SD card
            SDCard_Init();
        }

        USBDevice_Init();                         // and mount USB:/
        WBFS_Init(WBFS_DEVICE_USB);
    } else if ((Settings.cios == ios249 && IOS_GetVersion() != 249) ||
        (Settings.cios == ios250 && IOS_GetVersion() != 250))
    {

        printf("\n\tReloading IOS to config setting (%d)...", ios249 ? 249 : 250);
        SDCard_deInit();                          // unmount SD for reloading IOS
        USBDevice_deInit();                       // unmount USB for reloading IOS
        USBStorage2_Deinit();
        ret = IOS_ReloadIOSsafe(ios249 ? 249 : 250);
        printf("%d", ret);
        if (ret < 0)
        {
            Settings.cios = ios222;
            ret = IOS_ReloadIOSsafe(222);
            SDCard_Init();
            load_ehc_module();
        }

        else SDCard_Init();                       // now mount SD:/  //no need to keep mindlessly mounting and unmounting SD card
        USBDevice_Init();                         // and mount USB:/
        WBFS_Init(WBFS_DEVICE_USB);
    }

    //	Partition_GetList(&partitions);

    if (ret < 0)
    {
        printf("\nERROR: cIOS could not be loaded!");
        sleep(5);
        exit(0);
        //SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
    }
    //gprintf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());//don't need gprintf if sending console shit to gecko, too
    printf("\n\tcIOS = %u (Rev %u)",IOS_GetVersion(), IOS_GetRevision());

    //	printf("Sleeping for 5 seconds\n");
    //	sleep(5);

    //if a ID was passed via args copy it and try to boot it after the partition is mounted
    //its not really a headless mode.  more like hairless.
    if (argc > 1 && argv[1])
    {
        if (strlen(argv[1])==6)
            strncpy(headlessID, argv[1], sizeof(headlessID));
    }

    //! Init the rest of the System
    Sys_Init();
    Wpad_Init();
    if(!startupproblem)
        InitVideo();
    InitAudio();                                  // Initialize audio

    WPAD_SetDataFormat(WPAD_CHAN_ALL,WPAD_FMT_BTNS_ACC_IR);
    WPAD_SetVRes(WPAD_CHAN_ALL, screenwidth, screenheight);

    // load main font from file, or default to built-in font
    fontSystem = new FreeTypeGX();
    char *fontPath = NULL;
    asprintf(&fontPath, "%sfont.ttf", CFG.theme_path);
    fontSystem->loadFont(fontPath, font_ttf, font_ttf_size, 0);
    fontSystem->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);
    free(fontPath);

    fontClock = new FreeTypeGX();
    fontClock->loadFont(NULL, clock_ttf, clock_ttf_size, 0);
    fontClock->setCompatibilityMode(FTGX_COMPATIBILITY_DEFAULT_TEVOP_GX_PASSCLR | FTGX_COMPATIBILITY_DEFAULT_VTXDESC_GX_NONE);

    gprintf("\n\tEnd of Main()");
    InitGUIThreads();
    MainMenu(MENU_CHECK);
    return 0;
}
Exemple #16
0
int load_ehc_module()
{
int is_ios=0;

#if 0

FILE *fp;

// WARNING!!!: load external module suspended
if(sd_ok && !external_ehcmodule)
	{

	fp=fopen("sd:/apps/usbloader_gx/ehcmodule.elf","rb");
		if(fp==NULL)
			fp=fopen("sd:/apps/usbloadergx/ehcmodule.elf","rb");

	if(fp!=0)
		{
		fseek(fp, 0, SEEK_END);
		size_external_ehcmodule = ftell(fp);
		external_ehcmodule= memalign(32, size_external_ehcmodule);
		if(!external_ehcmodule) 
			{fclose(fp);}
		else
			{
			fseek(fp, 0, SEEK_SET);

			if(fread(external_ehcmodule,1, size_external_ehcmodule ,fp)!=size_external_ehcmodule)
				{free(external_ehcmodule); external_ehcmodule=NULL;}
		
			fclose(fp);
			}
		}
	}
#endif

/*
	if(mload_init()<0) return -1;
	mload_elf((void *) logmodule, &my_data_elf);
	my_thread_id= mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
	if(my_thread_id<0) return -1;
	*/
  
	if(!external_ehcmodule)
		{
#ifdef DEBUG_MLOAD
gprintf("before mload_init\n");
#endif
		if(mload_init()<0) return -1;
#ifdef DEBUG_MLOAD
		gprintf("after mload_init\n");
#endif
		if (IOS_GetRevision() == 4) {
#ifdef DEBUG_MLOAD
		    gprintf("Loading ehcmodule v4\n");
#endif
		    mload_elf((void *) ehcmodule_frag_v4_bin, &my_data_elf);
		} else if (IOS_GetRevision() == 65535) {
#ifdef DEBUG_MLOAD
		    gprintf("Loading ehcmodule v5\n");
#endif
		    mload_elf((void *) ehcmodule_frag_v5_bin, &my_data_elf);
		} else {
			return -2;
		}
//		mload_elf((void *) ehcmodule, &my_data_elf);
#ifdef DEBUG_MLOAD
		gprintf("before mload_run_thread\n");
#endif
		my_thread_id= mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
		if(my_thread_id<0) return -1;
		//if(mload_module(ehcmodule, size_ehcmodule)<0) return -1;
		}
	else
		{
		//if(mload_module(external_ehcmodule, size_external_ehcmodule)<0) return -1;
		if(mload_init()<0) return -1;
		mload_elf((void *) external_ehcmodule, &my_data_elf);
		my_thread_id= mload_run_thread(my_data_elf.start, my_data_elf.stack, my_data_elf.size_stack, my_data_elf.prio);
		if(my_thread_id<0) return -1;
		}
	usleep(350*1000);
	

	// Test for IOS

	#if 0
	mload_seek(0x20207c84, SEEK_SET);
	mload_read(patch_datas, 32);
	if(patch_datas[0]==0x6e657665 ) 
		{
		is_ios=38;
		}
	else
		{
		is_ios=36;
		}

#endif
	is_ios=mload_get_IOS_base();
	
	switch(is_ios)
		{

		case 36:
	
			memcpy(ios_36, dip_plugin, 4);		// copy the entry_point
			memcpy(dip_plugin, ios_36, 4*10);	// copy the adresses from the array
			
			mload_seek(0x1377E000, SEEK_SET);	// copy dip_plugin in the starlet
			mload_write(dip_plugin,size_dip_plugin);

			// enables DIP plugin
			mload_seek(0x20209040, SEEK_SET);
			mload_write(ios_36, 4);
			break;
		 
		case 37:

			memcpy(ios_37, dip_plugin, 4);	    // copy the entry_point
			memcpy(dip_plugin, ios_37, 4*10);   // copy the adresses from the array
			
			mload_seek(0x1377E000, SEEK_SET);	// copy dip_plugin in the starlet
			mload_write(dip_plugin,size_dip_plugin);

			// enables DIP plugin
			mload_seek(0x20209030, SEEK_SET);
			mload_write(ios_37, 4);
			break;

		case 38:

			memcpy(ios_38, dip_plugin, 4);	    // copy the entry_point
			memcpy(dip_plugin, ios_38, 4*10);   // copy the adresses from the array
			
			mload_seek(0x1377E000, SEEK_SET);	// copy dip_plugin in the starlet
			mload_write(dip_plugin,size_dip_plugin);

			// enables DIP plugin
			mload_seek(0x20208030, SEEK_SET);
			mload_write(ios_38, 4);
			break;

		case 57:

			memcpy(ios_57, dip_plugin, 4);	    // copy the entry_point
			memcpy(dip_plugin, ios_57, 4*10);   // copy the adresses from the array
			
			mload_seek(0x1377E000, SEEK_SET);	// copy dip_plugin in the starlet
			mload_write(dip_plugin,size_dip_plugin);

			// enables DIP plugin
			mload_seek(0x20208030, SEEK_SET);
			mload_write(ios_57, 4);
			break;
		
		case 60:

			memcpy(ios_60, dip_plugin, 4);	    // copy the entry_point
			memcpy(dip_plugin, ios_60, 4*10);   // copy the adresses from the array
			
			mload_seek(0x1377E000, SEEK_SET);	// copy dip_plugin in the starlet
			mload_write(dip_plugin,size_dip_plugin);

			// enables DIP plugin
			mload_seek(0x20208030, SEEK_SET);
			mload_write(ios_60, 4);
			break;

		}

	mload_close();

return 0;
}
/****************************************************************************
 * WindowPrompt
 *
 * Displays a prompt window to user, with information, an error message, or
 * presenting a user with a choice
 ***************************************************************************/
void
infoPrompt()
{
	bool stop = false;

	GuiWindow promptWindow(520,360);
	promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
	promptWindow.SetPosition(0, -10);
	GuiImageData btnOutline(Theme.button_tiny);
	GuiImageData btnOutlineOver(Theme.button_tiny_focus);
	GuiTrigger trigA;
	GuiTrigger trigB;
	trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
	trigB.SetSimpleTrigger(-1, WPAD_BUTTON_B | WPAD_CLASSIC_BUTTON_B, PAD_BUTTON_B);

	GuiImageData dialogBox(Theme.dialog_background);
	GuiImage dialogBoxImg(&dialogBox);

    int i = 0;
    int x = 30;
    int y = 40;
	GuiText * Entrie[20];

    Entrie[i] = new GuiText(tr("About HomebrewFilter"), 28, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
    Entrie[i]->SetPosition(0, y);
    i++;
    y += 50;

    Entrie[i] = new GuiText(tr("Developers:"), 24, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x, y);
    i++;

//    Entrie[i] = new GuiText("hamachi-mp / Christopher Roy Bratusek / obcd", 22, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i] = new GuiText("hamachi-mp   Nano   Obcd", 22, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x+200, y);
    i++;
    y += 32;

    Entrie[i] = new GuiText(tr("Designer:"), 24, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x, y);
    i++;

    Entrie[i] = new GuiText("Black.Pearl", 22, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x+200, y);
    i++;
    y += 50;

    Entrie[i] = new GuiText(tr("Special thanks to:"), 22, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x,y);
	i++;
	y += 32;

	Entrie[i] = new GuiText("- Dimok", 20, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x+50,y);
    i++;
	y += 32;

	Entrie[i] = new GuiText("- ichfly ", 20, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x+50,y);
    i++;
	y += 32;

	Entrie[i] = new GuiText("- all the translators", 20, (GXColor) {Theme.text_1, Theme.text_2, Theme.text_3, 255});
    Entrie[i]->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
    Entrie[i]->SetPosition(x+50,y);
    i++;


    int CreditEntries = i;

	char Rev[50];
#ifdef STBOOTVWII
	sprintf(Rev, "Rev. %i (vWii ST)", SvnRev());
#elif VWII
	sprintf(Rev, "Rev. %i (vWii Full)", SvnRev());
#elif STBOOT
	sprintf(Rev, "Rev. %i (Wii ST)", SvnRev());
#else
	sprintf(Rev, "Rev. %i (Wii Full)", SvnRev());
#endif
	GuiText RevTxt(Rev, 20, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
	RevTxt.SetAlignment(ALIGN_LEFT, ALIGN_TOP);
	RevTxt.SetPosition(30,24);

	char RunsIos[50];
	if((*(volatile unsigned int*)HW_ARMIRQMASK)&&(*(volatile unsigned int*)HW_ARMIRQFLAG))
		sprintf(RunsIos, "IOS %i Rev. %i (HW_AHBPROT)", IOS_GetVersion(), IOS_GetRevision());
	else
		sprintf(RunsIos, "IOS %i Rev. %i", IOS_GetVersion(), IOS_GetRevision());

	GuiText RunsIosTxt(RunsIos, 14, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
	RunsIosTxt.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
	RunsIosTxt.SetPosition(-30,24);

	GuiText backTxt(tr("Back"), 24, (GXColor){Theme.button_tiny_text_1, Theme.button_tiny_text_2, Theme.button_tiny_text_3, 255});
	GuiImage backImg(&btnOutline);
	GuiImage backImgOver(&btnOutlineOver);
	GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
	back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
	back.SetPosition(0, -15);
	back.SetLabel(&backTxt);
	back.SetImage(&backImg);
	back.SetImageOver(&backImgOver);
	back.SetTrigger(&trigA);
	back.SetTrigger(&trigB);

	promptWindow.Append(&dialogBoxImg);

	for(int i = 0; i < CreditEntries; i++)
        promptWindow.Append(Entrie[i]);

    promptWindow.Append(&RevTxt);
    promptWindow.Append(&RunsIosTxt);
	promptWindow.Append(&back);

	HaltGui();
	mainWindow->SetState(STATE_DISABLED);
	mainWindow->Append(&promptWindow);
	mainWindow->ChangeFocus(&promptWindow);
	ResumeGui();

	while(!stop)
	{
		usleep(100);

		if(back.GetState() == STATE_CLICKED)
			stop = true;
	}

	HaltGui();
	mainWindow->Remove(&promptWindow);
	mainWindow->SetState(STATE_DEFAULT);
	ResumeGui();
}