Пример #1
0
void Menu_Remove(void)
{
	struct discHdr *header = NULL;

	s32 ret;

	/* No game list */
	if (!gameCnt)
		return;

	/* Selected game */
	header = &gameList[gameSelected];

	/* Clear console */
	Con_Clear();

	printf("[+] Are you sure you want to remove this\n");
	printf("    game?\n\n");

	/* Show game info */
	__Menu_PrintInfo(header);

	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;
	}

	printf("[+] Removing game, please wait...");
	fflush(stdout);

	/* Remove game */
	ret = WBFS_RemoveGame(header->id);
	if (ret < 0) {
		printf("\n    ERROR! (ret = %d)\n", ret);
		goto out;
	} else
		printf(" OK!\n");

	/* Reload entries */
	__Menu_GetEntries();

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

	/* Wait for any button */
	Wpad_WaitButtons();
}
Пример #2
0
void Menu_Unlock() {
	u32 buttons;
	static long long t_start;
	long long t_now;
	unsigned ms_diff = 0;
	int i = 0;
	char buf[16];
	bool unlocked = false;
	memset(buf, 0, sizeof(buf));

	//init the previous settings
	if (unlock_init) {
		disable_options = CFG.disable_options;
		confirm_start = CFG.confirm_start;
		unlock_init = false;
	}
	
	Con_Clear();
	printf(gt("Configurable Loader %s"), CFG_VERSION);
	printf("\n\n");

	if (CFG.admin_mode_locked) {
		printf(gt("Enter Code: "));
		t_start = gettime();
		
		while (ms_diff < 30000 && !unlocked) {
			buttons = Wpad_GetButtons();
			if (buttons) {
				printf("*");
				buf[i] = get_unlock_buttons(buttons);
				i++;
				if (stricmp(buf, CFG.unlock_password) == 0) {
					unlocked = true;
				}
				if (i >= 10) break;
			}
			VIDEO_WaitVSync();
			t_now = gettime();
			ms_diff = diff_msec(t_start, t_now);
		}
	}
	if (unlocked) {
		//save existing settings
		disable_options = CFG.disable_options;
		confirm_start = CFG.confirm_start;

		//enable all "admin-type" screens
		CFG.disable_options = 0;
		CFG.confirm_start = 1;
		CFG.admin_mode_locked = 0;
		printf("\n\n");
		printf(gt("SUCCESS!"));
		sleep(1);
		//show the hidden games
		__Menu_GetEntries();
	} else {
		//set the lock back on
		CFG.disable_options = disable_options;
		CFG.confirm_start = confirm_start;
		CFG.admin_mode_locked = 1;
		printf("\n\n");
		printf(gt("LOCKED!"));
		sleep(1);
		//reset the hidden games
		__Menu_GetEntries();
	}
}
Пример #3
0
void Menu_Partition(bool must_select)
{
	int i;
	s32 ret = 0;
	int pnum = WBFS_GetPartitionCount();

	struct Menu menu;
	char active[256];
	menu_init(&menu, pnum);
	menu_init_active(&menu, active, 256);

loop:
	menu_begin(&menu);
	/* Clear console */
	Con_Clear();

	FgColor(CFG.color_header);
	printf_x(gt("Select a partition"));
	printf(":\n\n");
	DefaultColor();

	printf_("P# Name\n");
	printf_("-----------------------------\n");
	//       P#1  ram1ro
	//       P#2  sda1ro
	//       P#3  sda2ro

	char partname[32];
	for (i = 0; i < pnum; i++) {
		memset(partname, 0, 32);
		WBFS_GetPartitionName(i, (char *) &partname);
		MENU_MARK();
		printf("%d  %s\n", i, partname);
	}
	printf("\n");
	printf_h(gt("Press %s button to select."), (button_names[CFG.button_confirm.num]));
	printf("\n");
	printf_h(gt("Press %s button to go back."), (button_names[CFG.button_cancel.num]));
	printf("\n");

	u32 buttons = Wpad_WaitButtonsCommon();

	menu_move(&menu, buttons);

	// B button
	if (buttons & CFG.button_cancel.mask) {
		if (must_select) {
			if (WBFS_Selected()) return;
			printf("\n");
			printf_(gt("No partition selected!"));
			printf("\n");
			sleep(2);
		} else {
			return;
		}
	}

	// A button
	if (buttons & CFG.button_confirm.mask) {
		i = menu.current;

		__console_flush(0);
		ret = WBFS_OpenPart(i, CFG.partition);
		if (ret == 0) {
			if (must_select) {
				// called from global options
				__Menu_GetEntries();
			}
			return;
		}
	}

	goto loop;
}
Пример #4
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();
}
Пример #5
0
void Menu_Device(void)
{
	u32 timeout = 30;
	s32 ret;

	/* Ask user for device */
	for (;;) {
		char *devname = "Unknown!";

		/* Set device name */
		switch (wbfsDev) {
		case WBFS_DEVICE_USB:
			devname = "USB Mass Storage Device";
			break;

		case WBFS_DEVICE_SDHC:
			devname = "SD/SDHC Card";
			break;
		}

		/* Clear console */
		Con_Clear();

		printf("[+] Select WBFS device:\n");
		printf("    < %s >\n\n", devname);

		printf("    Press LEFT/RIGHT to select device.\n");
		printf("    Press A button to continue.\n\n");

		u32 buttons = Wpad_WaitButtons();

		/* LEFT/RIGHT buttons */
		if (buttons & WPAD_BUTTON_LEFT) {
			if ((--wbfsDev) < WBFS_MIN_DEVICE)
				wbfsDev = WBFS_MAX_DEVICE;
		}
		if (buttons & WPAD_BUTTON_RIGHT) {
			if ((++wbfsDev) > WBFS_MAX_DEVICE)
				wbfsDev = WBFS_MIN_DEVICE;
		}

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

	printf("[+] Mounting device, please wait...\n");
	printf("    (%d seconds timeout)\n\n", timeout);
	fflush(stdout);

	/* Initialize WBFS */
	ret = WBFS_Init(wbfsDev, timeout);
	if (ret < 0) {
		printf("    ERROR! (ret = %d)\n", ret);

		/* Restart wait */
		Restart_Wait();
	}

	/* Try to open device */
	while (WBFS_Open() < 0) {
		/* Clear console */
		Con_Clear();

		printf("[+] WARNING:\n\n");

		printf("    No WBFS partition found!\n");
		printf("    You need to format a partition.\n\n");

		printf("    Press A button to format a partition.\n");
		printf("    Press B button to restart.\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)
				Restart();
		}

		/* Format device */
		Menu_Format();
	}

	/* Get game list */
	__Menu_GetEntries();
}