コード例 #1
0
ファイル: psview.c プロジェクト: jmzaleski/ivtools-1.2
void PostScriptView::MinGS (ostream& out) {
    Brush(out);
    FgColor(out);
    BgColor(out);
    Pattern(out);
    Transformation(out);
}
コード例 #2
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
/* load game info from XML - lustar */
void __Menu_ShowGameInfo(bool showfullinfo, u8 *id)
{
	if (LoadGameInfoFromXML(id)) {
		FgColor(CFG.color_inactive);
		PrintGameInfo(showfullinfo);
		//printf("Play Count: %d\n", getPlayCount(id));
		DefaultColor();
	}
}
コード例 #3
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
void printf_h(const char *fmt, ...)
{
	va_list argp;
	DefaultColor();
	FgColor(CFG.color_help);
	printf("%s", CFG.menu_plus_s);
	va_start(argp, fmt);
	//vprintf(fmt, argp);
	printf_a(fmt, argp);
	va_end(argp);
	DefaultColor();
}
コード例 #4
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
void menu_print_mark(struct Menu *m)
{
	//if (m->active[m->line_count] && m->current == m->line_count) {
	if (m->current == m->line_count) {
		BgColor(CFG.color_selected_bg);
		FgColor(CFG.color_selected_fg);
		Con_ClearLine();
	} else if (m_active(m, m->line_count)) {
		DefaultColor();
	} else {
		DefaultColor();
		FgColor(CFG.color_inactive);
	}
	char *xx;
	//if (m->active[m->line_count] && m->current == m->line_count) {
	if (m->current == m->line_count) {
		xx = CFG.cursor;
	} else {
		xx = CFG.cursor_space;
	}
	printf(" %s ", xx);
}
コード例 #5
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
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();
}
コード例 #6
0
ファイル: sort.c プロジェクト: smurk-too/wodebrew
int filter_games(int (*filter) (struct discHdr *, int, char *, bool), char * name, bool num)
{
	int i, len;
	int ret = 0;
	u8 *id = NULL;
	// filter
	if (filter_gameList) {
		len = sizeof(struct discHdr) * all_gameCnt;
		memcpy(filter_gameList, all_gameList, len);
		filter_gameCnt = filter(filter_gameList, all_gameCnt, name, num);
	}
	if (gameSelected < gameCnt) {
		id = gameList[gameSelected].id;
	}
	if (filter_gameCnt > 0) {
		gameList = filter_gameList;
		gameCnt = filter_gameCnt;
		ret = 1;
	} else {
		Con_Clear();
		FgColor(CFG.color_header);
		printf("\n");
		printf(gt("%s No games found!!"), CFG.cursor);
		printf("\n");
		printf(gt("Loading previous game list..."));
		printf("\n");
		DefaultColor();
		__console_flush(0);
		sleep(1);
		ret = -1;
	}
	gameStart = 0;
	gameSelected = 0;
	for (i=0; i<gameCnt; i++) {
		if (strncmp((char*)gameList[i].id, (char*)id, 6) == 0) {
			gameSelected = i;
			break;
		}
	}
	// scroll start list
	__Menu_ScrollStartList();
	return ret;
}
コード例 #7
0
ファイル: stencilcomp.cpp プロジェクト: neurodebian/iv-hines
boolean PSStencil::Definition (ostream& out) {
    StencilComp* comp = (StencilComp*) GetSubject();
    Bitmap* image, *mask;
    comp->GetStencil()->GetOriginal(image, mask);
    const char* tag = (image == mask) ? "SSten" : "FSten";
    Coord w = image->Width();
    Coord h = image->Height();

    out << "Begin " << MARK << " " << tag << "\n";
    FgColor(out);
    BgColor(out);
    Transformation(out);

    out << MARK << "\n";
    out << w << " " << h << " " << tag << " ";
    out << "{ currentfile "<< (w + 7) / 8 << " string readhexstring pop }\n";
    out << "imagemask";

    unidraw->GetCatalog()->WriteBitmapData(image, out);

    out << "\nEnd\n\n";

    return out.good();
}
コード例 #8
0
ファイル: psview.c プロジェクト: jmzaleski/ivtools-1.2
void PostScriptView::TextGS (ostream& out) {
    FgColor(out);
    Font(out);
    Transformation(out);
}
コード例 #9
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
int Menu_Boot_Options(struct discHdr *header) {

	int ret_val = 0;
	if (CFG.disable_options) return 0;

	struct Game_CFG_2 *game_cfg2 = NULL;
	struct Game_CFG *game_cfg = NULL;
	int opt_saved, opt_ios_reload; 
	int redraw_cover = 0;
	int rows, cols, win_size;
	CON_GetMetrics(&cols, &rows);
	if ((win_size = rows-9) < 3) win_size = 3;
	Con_Clear();
	FgColor(CFG.color_header);
	printf_x(gt("Selected Game"));
	printf(":");
	__console_flush(0);
	printf(" (%.6s)\n", header->id);

	DefaultColor();
	printf(" %s %s\n\n", CFG.cursor_space, __Menu_PrintTitle(get_title(header)));
	__console_flush(0);
//	load_dolmenu((char*)header->id);

	game_cfg2 = CFG_get_game(header->id);
	if (!game_cfg2) {
		printf(gt("ERROR game opt"));
		printf("\n");
		sleep(5);
		return 0;
	}
	game_cfg = &game_cfg2->curr;

	struct Menu menu;
	const int NUM_OPT = 16;
	char active[NUM_OPT];
	menu_init(&menu, NUM_OPT);

	for (;;) {
		/*
		// fat on 249?
		if (wbfs_part_fs && !disc) {
			if (!is_ios_idx_mload(game_cfg->ios_idx))
			{
				game_cfg->ios_idx = CFG_IOS_222_MLOAD;
			}
		}
		*/

		menu_init_active(&menu, active, sizeof(active));
		opt_saved = game_cfg2->is_saved;
		// if not mload disable block ios reload opt
		opt_ios_reload = game_cfg->block_ios_reload;

		// if not ocarina and not wiird, deactivate hooks
		if (!game_cfg->ocarina && !CFG.wiird) {
			active[11] = 0;
		}
		//if admin lock is off or they're not in admin 
		// mode then they can't hide/unhide games
		if (!CFG.admin_lock || CFG.admin_mode_locked) {
			active[14] = 0;
		}

		//These things shouldn't be changed if using a disc...maybe
		active[0] = 0;
		active[8] = 0;
		active[9] = 0;
		active[14] = 0;
		
		Con_Clear();
		FgColor(CFG.color_header);
		printf_x(gt("Selected Game"));
		printf(":");
		printf(" (%.6s)\n", header->id);
		DefaultColor();
		printf(" %s %s\n\n", CFG.cursor_space, __Menu_PrintTitle(get_title(header)));
		FgColor(CFG.color_header);
		printf_x(gt("Game Options:  %s"),
				CFG_is_changed(header->id) ? gt("[ CHANGED ]") :
				opt_saved ? gt("[ SAVED ]") : "");
		printf("\n");
		DefaultColor();
		char c1 = '<', c2 = '>';
		//if (opt_saved) { c1 = '['; c2 = ']'; }

		const char *str_vpatch[3];
		str_vpatch[0] = gt("Off");
		str_vpatch[1] = gt("On");
		str_vpatch[2] = gt("All");

		// start menu draw

		menu_begin(&menu);
		menu_jump_active(&menu);

		#define PRINT_OPT_S(N,V) \
			printf("%s%c %s %c\n", con_align(N,18), c1, V, c2)

		#define PRINT_OPT_A(N,V) \
			printf("%s%c%s%c\n", con_align(N,18), c1, V, c2)

		#define PRINT_OPT_B(N,V) \
			PRINT_OPT_S(N,(V?gt("On"):gt("Off"))) 

		menu_window_begin(&menu, win_size, NUM_OPT);
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Favorite:"), is_favorite(header->id) ? gt("Yes") : gt("No"));
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Language:"), languages[game_cfg->language]);
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Video:"), videos[game_cfg->video]);
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Video Patch:"), str_vpatch[game_cfg->video_patch]);
		if (menu_window_mark(&menu))
			PRINT_OPT_B("VIDTV:", game_cfg->vidtv);
		if (menu_window_mark(&menu))
			PRINT_OPT_B(gt("Country Fix:"), game_cfg->country_patch);
		if (menu_window_mark(&menu))
			PRINT_OPT_B(gt("Anti 002 Fix:"), game_cfg->fix_002);
		if (menu_window_mark(&menu))
			PRINT_OPT_B(gt("Block IOS Reload:"), opt_ios_reload);
		if (menu_window_mark(&menu))
			PRINT_OPT_B(gt("Ocarina (cheats):"), game_cfg->ocarina);
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Hook Type:"), hook_name[game_cfg->hooktype]);
		if (menu_window_mark(&menu))
			PRINT_OPT_A(gt("Cheat Codes:"), gt("Manage"));
		if (menu_window_mark(&menu))
			printf("%s%s\n", con_align(gt("Cover Image:"), 18), 
				imageNotFound ? gt("< DOWNLOAD >") : gt("[ FOUND ]"));
		if (menu_window_mark(&menu))
			PRINT_OPT_S(gt("Hide Game:"), is_hide_game(header->id) ? gt("Yes") : gt("No"));
		if (menu_window_mark(&menu))
			PRINT_OPT_B(gt("Write Playlog:"), game_cfg->write_playlog);
		DefaultColor();
		menu_window_end(&menu, cols);

		printf_h(gt("Press %s to start game"), (button_names[CFG.button_confirm.num]));
		printf("\n");
		bool need_save = !opt_saved || CFG_is_changed(header->id);
		if (need_save)
			printf_h(gt("Press %s to save options"), (button_names[CFG.button_save.num]));
		else
			printf_h(gt("Press %s to discard options"), (button_names[CFG.button_save.num]));
		printf("\n");
		printf_h(gt("Press %s for global options"), (button_names[CFG.button_other.num]));
		DefaultColor();
		__console_flush(0);

		if (redraw_cover) {
			Gui_DrawCover(header->id);
			redraw_cover = 0;
		}
		
		u32 buttons = Wpad_WaitButtonsRpt();
		int change = 0;

		menu_move_active(&menu, buttons);

		if (buttons & WPAD_BUTTON_LEFT) change = -1;
		if (buttons & WPAD_BUTTON_RIGHT) change = +1;

		if (change) {
			switch (menu.current) {
			case 0:
				printf("\n\n");
				printf_x(gt("Saving Settings... "));
				__console_flush(0);
				if (set_favorite(header->id, change > 0)) {
					printf(gt("OK"));
				} else {
					printf(gt("ERROR"));
					sleep(1);
				}
				__console_flush(0);
				Gui_DrawCover(header->id);
				break;
			case 1:
				CHANGE(game_cfg->language, CFG_LANG_MAX);
				break;
			case 2:
				CHANGE(game_cfg->video, CFG_VIDEO_MAX);
				break;
			case 3:
				CHANGE(game_cfg->video_patch, 2);
				break;
			case 4:
				CHANGE(game_cfg->vidtv, 1);
				break;
			case 5:
				CHANGE(game_cfg->country_patch, 1);
				break;
			case 6:
				CHANGE(game_cfg->fix_002, 1);
				break;
			case 7:
				CHANGE(game_cfg->block_ios_reload, 1);
				break;
			case 8:
				CHANGE(game_cfg->ocarina, 1);
				break;
			case 9:
				CHANGE(game_cfg->hooktype, NUM_HOOK-1);
				break;
			case 10:
				Menu_Cheats(header);
				break;
			case 11:
				printf("\n\n");
				Download_Cover((char*)header->id, change > 0, true);
				Cache_Invalidate();
				Gui_DrawCover(header->id);
				Menu_PrintWait();
				break;
			case 12: // hide game
				printf("\n\n");
				printf_x(gt("Saving Settings... "));
				__console_flush(0);
				if (set_hide_game(header->id, change > 0)) {
					printf(gt("OK"));
				} else {
					printf(gt("ERROR"));
					sleep(1);
				}
				__console_flush(0);
				Gui_DrawCover(header->id);
				break;
			case 13:
				CHANGE(game_cfg->write_playlog, 1);
				break;
			}
		}
		if (buttons & CFG.button_confirm.mask) {
			CFG.confirm_start = 0;
			Menu_Boot();
			break;
		}
		if (buttons & CFG.button_save.mask) {
			bool ret;
			printf("\n\n");
			if (need_save) {
				ret = CFG_save_game_opt(header->id);
				if (ret) {
					printf_x(gt("Options saved for this game."));
				} else printf(gt("Error saving options!")); 
			} else {
				ret = CFG_discard_game_opt(header->id);
				if (ret) printf_x(gt("Options discarded for this game."));
				else printf(gt("Error discarding options!")); 
			}
			sleep(1);
		}
		// HOME button
		if (buttons & CFG.button_exit.mask) {
			Handle_Home(0);
		}
		if (buttons & CFG.button_other.mask) { ret_val = 1; break; }
		if (buttons & CFG.button_cancel.mask) break;
	}
	CFG_release_game(game_cfg2);

	return ret_val;
}
コード例 #10
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
int Menu_Views()
{
	struct discHdr *header = NULL;
	int redraw_cover = 0;
	struct Menu menu;

	if (gameCnt) {
		header = &gameList[gameSelected];
	}
	
	const int NUM_OPT = 8;
	char active[NUM_OPT];
	menu_init(&menu, NUM_OPT);

	for (;;) {

		menu.line_count = 0;
		menu_init_active(&menu, active, sizeof(active));

		active[3] = 0; // disable_remove
		active[4] = 0; // disable_install
		
		if (CFG.disable_options) {
			active[1] = 0;
			active[2] = 0;
		}
		Con_Clear();
		FgColor(CFG.color_header);
		printf_x(gt("Main Menu"));
		printf(":\n\n");
		
		DefaultColor();
		MENU_MARK();
		printf("<%s>\n", gt("Start Game"));
		MENU_MARK();
		printf("<%s>\n", gt("Game Options"));
		MENU_MARK();
		printf("<%s>\n", gt("Global Options"));
		MENU_MARK();
		printf("<%s>\n", gt("Sort Games"));
		MENU_MARK();
		printf("<%s>\n", gt("Filter Games"));
		MENU_MARK();
		printf("<%s>\n", gt("Boot Disc"));
   
		DefaultColor();

		printf("\n");
		printf_h(gt("Press %s button to select."),
				(button_names[CFG.button_confirm.num]));
		printf("\n");
		DefaultColor();
		__console_flush(0);

		if (redraw_cover) {
			if (header) Gui_DrawCover(header->id);
			redraw_cover = 0;
		}
		
		u32 buttons = Wpad_WaitButtonsRpt();
		menu_move_active(&menu, buttons);
		
		int change = -2;
		if (buttons & WPAD_BUTTON_LEFT) change = -1;
		if (buttons & WPAD_BUTTON_RIGHT) change = +1;
		if (buttons & CFG.button_confirm.mask) change = 0;
//		#define CHANGE(V,M) {V+=change;if(V>M)V=M;if(V<0)V=0;}

		if (change > -2) {
			switch (menu.current) {
			case 0:
				CFG.confirm_start = 0;
				Menu_Boot(0);
				break;
			case 1:
				Menu_Game_Options();
				break;
			case 2:
				Menu_Global_Options();
				break;
			case 3:
				Menu_Sort();
				break;
			case 4:
				Menu_Filter();
				break;
			case 5:
				Menu_Boot(1);
				break;
			}
		}

		// HOME button
		if (buttons & CFG.button_exit.mask) {
			Handle_Home(0);
		}
		if (buttons & CFG.button_cancel.mask) break;
	}
	
	return 0;
}
コード例 #11
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
void __Menu_ShowList(void)
{
	FgColor(CFG.color_header);
	if (enable_favorite) {
		printf_x(gt("Favorite Games"));
		printf(":\n");
	} else {
		if (!CFG.hide_header) {
			printf_x(gt("Select the game you want to boot"));
			printf(":\n");
		}
	}
	DefaultColor();
	if (CFG.console_mark_page && gameStart > 0) {
		printf(" %s +", CFG.cursor_space);
	}
	printf("\n");

	/* No game list*/
	if (gameCnt) {
		u32 cnt;

		/* Print game list */
		for (cnt = gameStart; cnt < gameCnt; cnt++) {
			struct discHdr *header = &gameList[cnt];

			/* Entries per page limit reached */
			if ((cnt - gameStart) >= ENTRIES_PER_PAGE)
				break;

			if (gameSelected == cnt) {
				FgColor(CFG.color_selected_fg);
				BgColor(CFG.color_selected_bg);
				Con_ClearLine();
			} else {
				DefaultColor();
			}

			/* Print entry */
			//printf(" %2s %s\n", (gameSelected == cnt) ? ">>" : "  ",
			char *title = __Menu_PrintTitle(get_title(header));
			// cursor
			printf(" %s", (gameSelected == cnt) ? CFG.cursor : CFG.cursor_space);
			// favorite mark
			printf("%s", (CFG.console_mark_favorite && is_favorite(header->id))
					? CFG.favorite : " ");
			// title
			printf("%s", title);
			// saved mark
			if (CFG.console_mark_saved) {
				printf("%*s", (MAX_CHARACTERS - con_len(title)),
					(CFG_is_saved(header->id)) ? CFG.saved : " ");
			}
			printf("\n");
		}
		DefaultColor();
		if (CFG.console_mark_page && cnt < gameCnt) {
			printf(" %s +", CFG.cursor_space);
		} else {
			printf(" %s  ", CFG.cursor_space);
		}
		//if (CFG.hide_hddinfo) {
		FgColor(CFG.color_footer);
		BgColor(CONSOLE_BG_COLOR);
		int num_page = 1 + (gameCnt - 1) / ENTRIES_PER_PAGE;
		int cur_page = 1 + gameSelected / ENTRIES_PER_PAGE;
		printf(" %-*.*s %d/%d", MAX_CHARACTERS - 8, MAX_CHARACTERS - 8, action_string, cur_page, num_page);
		action_string[0] = 0;
		//}
	} else {
		printf(" ");
		printf(gt("%s No games found!!"), CFG.cursor);
		printf("\n");
	}

	/* Print free/used space */
	FgColor(CFG.color_footer);
	BgColor(CONSOLE_BG_COLOR);
	if (!CFG.hide_footer) {
		printf("\n");
		// (B) GUI (1) Options (2) Favorites
		// B: GUI 1: Options 2: Favorites
		//char c_gui = 'B', c_opt = '1';
		//if (CFG.buttons == CFG_BTN_OPTIONS_B) {
		//	c_gui = '1'; c_opt = 'B';
		//}
		printf_("");
		if (CFG.gui && CFG.button_gui) {
			printf("%s: GUI ", (button_names[CFG.button_gui]));
		}
		if (!CFG.disable_options && CFG.button_opt) {
			printf("%s: Options ", (button_names[CFG.button_opt]));
		}
		if (CFG.button_fav) {
			printf("%s: Favorites", (button_names[CFG.button_fav]));
		}
	}
	if (CFG.db_show_info) {
		printf("\n");
		//load game info from XML - lustar
		__Menu_ShowGameInfo(false, gameList[gameSelected].id);
	}
	DefaultColor();
	__console_flush(0);
}
コード例 #12
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
void Menu_Boot()
{
	struct discHdr *header;
	bool gc = false;

	header = &gameList[gameSelected];
	
	s32 ret;
	struct Game_CFG_2 *game_cfg = NULL;

	/* Clear console */
	if (!CFG.direct_launch) {
		Con_Clear();
	}
	FgColor(CFG.color_header);
	printf_x(gt("Start this game?"));
	printf("\n\n");
	DefaultColor();
	
	game_cfg = CFG_find_game(header->id);

	// Get game size
	gc = header->magic == GC_MAGIC;
	bool do_skip = !CFG.confirm_start;
/*
	SoundInfo snd;
	u8 banner_title[84];
	memset(banner_title, 0, 84);
	memset(&snd, 0, sizeof(snd));
	WBFS_Banner(header->id, &snd, banner_title, !do_skip, CFG_read_active_game_setting(header->id).write_playlog);
*/
	if (do_skip) {
		goto skip_confirm;
	}

	printf("\n");

	/* Show game info */
	printf_("%s\n", get_title(header));
	printf_("(%.6s)\n\n", header->id);

	__Menu_ShowGameInfo(true, header->id); /* load game info from XML */
	printf("\n");

	//Does DL warning apply to launching discs too? Not sure
	printf_h(gt("Press %s button to continue."), (button_names[CFG.button_confirm.num]));
	printf("\n");
	printf_h(gt("Press %s button to go back."), (button_names[CFG.button_cancel.num]));
	if (!gc) {
		printf("\n");
		printf_h(gt("Press %s button for options."), (button_names[CFG.button_other.num]));
	}
	printf("\n\n");
	__console_flush(0);

	// play banner sound
/*
	if (snd.dsp_data) {
		SND_PauseVoice(0, 1); // pause mp3
		int fmt = (snd.channels == 2) ? VOICE_STEREO_16BIT : VOICE_MONO_16BIT;
		SND_SetVoice(1, fmt, snd.rate, 0,
			snd.dsp_data, snd.size,
			255,255, //volume,volume,
			NULL); //DataTransferCallback
	}
*/
	/* Wait for user answer */
	u32 buttons;
	for (;;) {
		buttons = Wpad_WaitButtons();
		if (buttons & CFG.button_confirm.mask) break;
		if (buttons & CFG.button_cancel.mask) break;
		if (!gc && (buttons & CFG.button_other.mask)) break;
		if (buttons & CFG.button_exit.mask) break;
	}
/*
	// stop banner sound, resume mp3
	if (snd.dsp_data) {
		SND_StopVoice(1);
		SAFE_FREE(snd.dsp_data);
		if (buttons & CFG.button_confirm.mask) {
			SND_ChangeVolumeVoice(0, 0, 0);
		}
		SND_PauseVoice(0, 0);
	}
*/
	if (buttons & CFG.button_cancel.mask) goto close;
	if (buttons & CFG.button_exit.mask) {
		Handle_Home(0);
		return;
	}
	if (!gc && (buttons & CFG.button_other.mask)) {
		Menu_Boot_Options(header);
		return;
	}
	// A button: continue to boot

	skip_confirm:

	if (game_cfg) {
		CFG.game = game_cfg->curr;
	}

	if (CFG.game.write_playlog && set_playrec(header->id, (u8 *) header->title) < 0) { // banner_title) < 0) {
		printf_(gt("Error storing playlog file.\nStart from the Wii Menu to fix."));
		printf("\n");
		printf_h(gt("Press %s button to exit."), (button_names[CFG.button_exit.num]));
		printf("\n");
		if (!Menu_Confirm(0)) return;
	}

	WBFS_OpenDisc(header->id, header->game_idx);

	printf("\n");
	printf_x(gt("Booting Wii game, please wait..."));
	printf("\n\n");
	
	// load stuff before ios reloads & services close
	ocarina_load_code(header->id);
	load_wip_patches(header->id);

	// Close the wode stuff
	WBFS_Close();
	use_dvdx = 0;
	
	Disc_Init();
	ret = Disc_Wait();
	if (ret < 0) {
		printf("Cannot mount newly selected image: %d\n", ret);
	}
	Disc_Open();

	// stop services (music, gui)
	Services_Close();

	setPlayStat(header->id); //I'd rather do this after the check, but now you unmount fat before that ;)
	
	Fat_UnmountAll();

	if (gc) {
		WII_Initialize();
		ret = WII_LaunchTitle(0x0000000100000100ULL);
	} else {
		switch(CFG.game.language)
				{
						// 0 = CFG_LANG_CONSOLE
						case 0: configbytes[0] = 0xCD; break; 
						case 1: configbytes[0] = 0x00; break; 
						case 2: configbytes[0] = 0x01; break; 
						case 3: configbytes[0] = 0x02; break; 
						case 4: configbytes[0] = 0x03; break; 
						case 5: configbytes[0] = 0x04; break; 
						case 6: configbytes[0] = 0x05; break; 
						case 7: configbytes[0] = 0x06; break; 
						case 8: configbytes[0] = 0x07; break; 
						case 9: configbytes[0] = 0x08; break; 
						case 10: configbytes[0] = 0x09; break;
				}

		/* Boot Wii disc */
		ret = Disc_WiiBoot();
	}
	printf_(gt("Returned! (ret = %d)"), ret);
	printf("\n");

	printf("\n");
	printf_(gt("Press any button to exit..."));
	printf("\n");

	/* Wait for button */
	Wpad_WaitButtonsCommon();
	exit(0);
close:
	WDVD_StopMotor();
	header = &gameList[gameSelected];
	Gui_DrawCover(header->id);
	
	// Reopen the wode
	WBFS_Init();
	
	return;
}
コード例 #13
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
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;
}
コード例 #14
0
ファイル: menu.c プロジェクト: smurk-too/wodebrew
int Menu_Global_Options()
{
	int rows, cols, win_size = 11;
	CON_GetMetrics(&cols, &rows);
	if (strcmp(LAST_CFG_PATH, USBLOADER_PATH)) win_size += 2;
	if ((win_size = rows-win_size) < 3) win_size = 3;

	if (CFG.disable_options) return 0;

	struct discHdr *header = NULL;
	int redraw_cover = 0;

	struct Menu menu;
	menu_init(&menu, 9);

	for (;;) {

		menu.line_count = 0;

		if (gameCnt) {
			header = &gameList[gameSelected];
		} else {
			header = NULL;
		}

		Con_Clear();
		FgColor(CFG.color_header);
		printf_x(gt("Global Options"));
		printf(":\n\n");
		DefaultColor();
		menu_window_begin(&menu, win_size, 9);
		if (menu_window_mark(&menu))
			printf("<%s>\n", gt("Main Menu"));
		if (menu_window_mark(&menu))
			printf("%s%2d/%-2d< %s > (%d)\n", con_align(gt("Profile:"),8),
				CFG.current_profile + 1, CFG.num_profiles,
				CFG.profile_names[CFG.current_profile],
				CFG.num_favorite_game);
		if (menu_window_mark(&menu))
			printf("%s%2d/%2d < %s >\n", con_align(gt("Theme:"),7),
				cur_theme + 1, num_theme, *CFG.theme ? CFG.theme : gt("none"));
		if (menu_window_mark(&menu))
			printf("%s< %s >\n", con_align(gt("Partition:"),13), CFG.partition);
		if (menu_window_mark(&menu))
			printf("<%s>\n", gt("Download All Missing Covers"));
		if (menu_window_mark(&menu))
			printf("<%s>\n", gt("Update WiiTDB Game Database")); // download database - lustar
		if (menu_window_mark(&menu))
			printf("<%s>\n", gt("Update titles.txt"));
		if (menu_window_mark(&menu))
			printf("<%s>\n", gt("Check For Updates"));
		DefaultColor();
		menu_window_end(&menu, cols);
		
		printf_h(gt("Press %s for game options"), (button_names[CFG.button_other.num]));
		printf("\n");
		printf_h(gt("Press %s to save global settings"), (button_names[CFG.button_save.num]));
		printf("\n\n");
		Print_SYS_Info();
		DefaultColor();
		__console_flush(0);

		if (redraw_cover) {
			if (header) Gui_DrawCover(header->id);
			redraw_cover = 0;
		}
		
		u32 buttons = Wpad_WaitButtonsRpt();
		menu_move(&menu, buttons);

		int change = 0;
		if (buttons & WPAD_BUTTON_LEFT) change = -1;
		if (buttons & WPAD_BUTTON_RIGHT) change = +1;
		if (buttons & CFG.button_confirm.mask) change = +1;

		if (change) {
			switch (menu.current) {
			case 0:
				Menu_Views();
				return 0;
			case 1:
				CHANGE(CFG.current_profile, CFG.num_profiles-1);
				// refresh favorites list
				Switch_Favorites(enable_favorite);
				redraw_cover = 1;
				break;
			case 2:
				CFG_switch_theme(cur_theme + change);
				redraw_cover = 1;
				Cache_Invalidate();
				break;
			case 3:
				Menu_Partition(true);
				return 0;
			case 4:
				Download_All_Covers(change > 0);
				Cache_Invalidate();
				if (header) Gui_DrawCover(header->id);
				Menu_PrintWait();
				break;
			case 5:
				Download_XML();
				break;
			case 6:
				Download_Titles();
				break;
			case 7:
				Online_Update();
				break;
			}
		}
		// HOME button
		if (buttons & CFG.button_exit.mask) {
			Handle_Home(0);
		}
		if (buttons & CFG.button_save.mask) {
			int ret;
			printf("\n");
			printf_x(gt("Saving Settings... "));
			printf("\n");
			__console_flush(0);
			FgColor(CFG.color_inactive);
			ret = CFG_Save_Global_Settings();
			DefaultColor();
			if (ret) {
				printf_(gt("OK"));
				printf("\n");
				Save_Game_List();
			} else {
				printf_(gt("ERROR"));
			}
			printf("\n");
			//sleep(2);
			Menu_PrintWait();
		}
		if (buttons & WPAD_BUTTON_PLUS) {
			printf("\n");
			mem_stat();
			Menu_PrintWait();
		}
		if (buttons & CFG.button_other.mask) return 1;
		if (buttons & CFG.button_cancel.mask) break;
	}
	return 0;
}
コード例 #15
0
ファイル: sort.c プロジェクト: smurk-too/wodebrew
int Menu_Sort()
{
	struct discHdr *header = NULL;
	int redraw_cover = 0;
	int n = 0;
	bool first_run = 1;
	bool descend[sortCnt];
	for (;n<sortCnt;n++)
		descend[n] = 0;
	struct Menu menu;
	menu_init(&menu, sortCnt);
	for (;;) {

		menu.line_count = 0;

		if (gameCnt) {
			header = &gameList[gameSelected];
		} else {
			header = NULL;
		}
		Con_Clear();
		FgColor(CFG.color_header);
		printf_x(gt("Choose a sorting method"));
		printf(":\n\n");
		for (n=0; n<sortCnt; n++) {
			if (sort_index == n && sort_desc && first_run) {
				first_run = 0;
				descend[n] = 1;
			}
			MENU_MARK();
			printf("%s ", (sort_index == n ? "*": " "));
			printf("%s", con_align(sortTypes[n].name,25));
			printf("%s\n", !descend[n] ? gt("< ASC  >") : gt("< DESC >"));
		}
		DefaultColor();

		printf("\n");
		printf_h(gt("Press %s to select sorting method"), (button_names[CFG.button_confirm.num]));
		__console_flush(0);

		if (redraw_cover) {
			if (header) Gui_DrawCover(header->id);
			redraw_cover = 0;
		}
		
		u32 buttons = Wpad_WaitButtonsRpt();
		menu_move(&menu, buttons);

		int change = 0;
		if (buttons & WPAD_BUTTON_LEFT || buttons & WPAD_BUTTON_RIGHT) change = -1;
		if (buttons & CFG.button_confirm.mask || buttons & CFG.button_save.mask) change = +1;

		if (change) {
			for (n=0; n<sortCnt; n++) {
				if (menu.current == n) {
					if (change == -1) descend[n] = !descend[n];
					else {
						if (descend[n]) {
							sort_desc = 1;
							sortList(sortTypes[n].sortDsc);
						} else {
							sort_desc = 0;
							sortList(sortTypes[n].sortAsc);
						}
						redraw_cover = 1;
						sort_index = n;
						break;
					}
				}
			}
		}
		
		// HOME button
		if (buttons & CFG.button_exit.mask) {
			Handle_Home(0);
		}
		if (buttons & CFG.button_cancel.mask) break;
	}
	return 0;
}
コード例 #16
0
ファイル: sort.c プロジェクト: smurk-too/wodebrew
int Menu_Filter3()
{
	struct discHdr *header = NULL;
	int redraw_cover = 0;
	struct Menu menu;
	int rows, cols, size;
	CON_GetMetrics(&cols, &rows);
	if ((size = rows-8) < 3) size = 3;
	menu_init(&menu, featureCnt+3);
	for (;;) {

		menu.line_count = 0;

		if (gameCnt) {
			header = &gameList[gameSelected];
		} else {
			header = NULL;
		}
		int n;
		Con_Clear();
		FgColor(CFG.color_header);
		printf_x(gt("Filter by Online Features"));
		printf(":\n\n");
		MENU_MARK();
		printf("<%s>\n", gt("Filter by Genre"));
		MENU_MARK();
		printf("<%s>\n", gt("Filter by Controller"));		
		MENU_MARK();
		printf("%s %s\n", ((filter_type == -1) ? "*" : " "), gt("All Games"));
		menu_window_begin(&menu, size, featureCnt);
		for (n=0;n<featureCnt;n++) {
			if (menu_window_mark(&menu))
			printf("%s %s\n", ((filter_index == n && filter_type == 3) ? "*": " "), featureTypes[n][1]);
		}
		DefaultColor();
		menu_window_end(&menu, cols);
		
		printf_h(gt("Press %s to select filter type"), (button_names[CFG.button_confirm.num]));
		__console_flush(0);

		if (redraw_cover) {
			if (header) Gui_DrawCover(header->id);
			redraw_cover = 0;
		}
		
		u32 buttons = Wpad_WaitButtonsRpt();
		menu_move(&menu, buttons);

		int change = 0;
		if (buttons & WPAD_BUTTON_LEFT) change = -1;
		if (buttons & WPAD_BUTTON_RIGHT || buttons & CFG.button_confirm.mask || buttons & CFG.button_save.mask) change = +1;

		if (change) {
			if (0 == menu.current) {
				Menu_Filter();
				redraw_cover = 1;
				goto end;
			} else if (1 == menu.current) {
				Menu_Filter2();
				redraw_cover = 1;
				goto end;
			} else if (2 == menu.current) {
				showAllGames();
				filter_type = -1;
				redraw_cover = 1;
			}
			for (n=0;n<featureCnt;n++) {
				if (3+n == menu.current) {
					redraw_cover = 1;
					if (filter_games(filter_features, featureTypes[n][0], 0) > -1) {
						filter_type = 3;
						filter_index = n;
					}
					break;
				}
			}
		}
		
		// HOME button
		if (buttons & CFG.button_exit.mask) {
			Handle_Home(0);
		}
		if (buttons & CFG.button_cancel.mask) break;
	}
	end:
	return 0;
}