Exemplo n.º 1
0
s32 Disc_Type(bool gc)
{
	s32 ret;
	u32 check;
	u32 magic;
	
	if (!gc)
	{
		check = WII_MAGIC;
		struct discHdr *header = (struct discHdr *)buffer;
		ret = Disc_ReadHeader(header);
		magic = header->magic;
	}
	else
	{
		check = GC_MAGIC;
		struct gc_discHdr *header = (struct gc_discHdr *)buffer;
		ret = Disc_ReadGCHeader(header);
		magic = header->magic;
	}

	if (ret < 0) return ret;
		
	/* Check magic word */
	if (magic != check) return -1;

	return 0;
}
Exemplo n.º 2
0
s32 Disc_Type(bool gc)
{
	s32 ret = 0;
	u32 check = 0;
	u32 magic = 0;

	if(!gc)
	{
		check = WII_MAGIC;
		ret = Disc_ReadHeader(&wii_hdr);
		magic = wii_hdr.magic;
	}
	else
	{
		check = GC_MAGIC;
		ret = Disc_ReadGCHeader(&gc_hdr);
		if(memcmp(gc_hdr.id, "GCOPDV", 6) == 0)
			magic = GC_MAGIC;
		else
			magic = gc_hdr.magic;
	}

	if (ret < 0)
		return ret;

	/* Check magic word */
	if (magic != check) return -1;

	return 0;
}
Exemplo n.º 3
0
s32 Disc_IsWii(void) {
    struct discHdr *header = (struct discHdr *)buffer;

    s32 ret;

    /* Read disc header */
    ret = Disc_ReadHeader(header);
    if (ret < 0)
        return ret;

    /* Check magic word */
    if (header->magic != WII_MAGIC)
        return -1;

    return 0;
}
Exemplo n.º 4
0
//---------------------------------------------------------------------------------
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);
	}
Exemplo n.º 5
0
void Menu_Install(void)
{
	static struct discHdr header ATTRIBUTE_ALIGN(32);

	s32 ret;

	/* Clear console */
	Con_Clear();

	printf("[+] Are you sure you want to install a\n");
	printf("    new Wii game?\n\n");

	printf("    Press A button to continue.\n");
	printf("    Press B button to go back.\n\n\n");

	/* Wait for user answer */
	for (;;) {
		u32 buttons = Wpad_WaitButtons();

		/* A button */
		if (buttons & WPAD_BUTTON_A)
			break;

		/* B button */
		if (buttons & WPAD_BUTTON_B)
			return;
	}

	/* Disable WBFS mode */
	Disc_SetWBFS(0, NULL);

	printf("[+] Insert the game DVD disc...");
	fflush(stdout);

	/* Wait for disc */
	ret = Disc_Wait();
	if (ret < 0) {
		printf("\n    ERROR! (ret = %d)\n", ret);
		goto out;
	} else
		printf(" OK!\n");

	printf("[+] Opening DVD disc...");
	fflush(stdout);

	/* Open disc */
	ret = Disc_Open();
	if (ret < 0) {
		printf("\n    ERROR! (ret = %d)\n", ret);
		goto out;
	} else
		printf(" OK!\n\n");

	/* Check disc */
	ret = Disc_IsWii();
	if (ret < 0) {
		printf("[+] ERROR: Not a Wii disc!!\n");
		goto out;
	}

	/* Read header */
	Disc_ReadHeader(&header);

	/* Check if game is already installed */
	ret = WBFS_CheckGame(header.id);
	if (ret) {
		printf("[+] ERROR: Game already installed!!\n");
		goto out;
	}

	printf("[+] Installing game, please wait...\n\n");

	printf("    %s\n",           header.title);
	printf("    (%c%c%c%c)\n\n", header.id[0], header.id[1], header.id[2], header.id[3]);

	/* Install game */
	ret = WBFS_AddGame();
	if (ret < 0) {
		printf("[+] Installation ERROR! (ret = %d)\n", ret);
		goto out;
	}

	/* Reload entries */
	__Menu_GetEntries();

out:
	printf("\n");
	printf("    Press any button to continue...\n");

	/* Wait for any button */
	Wpad_WaitButtons();
}