Ejemplo n.º 1
0
void
platform_add_menus(Menu *menu)
{
	MenuItem *item;

	switch (menu->Type()) {
		case MAIN_MENU:
			item = new(std::nothrow)MenuItem("Select video mode", video_mode_menu());
			if (item != NULL) {
				menu->AddItem(item);
				item->SetTarget(video_mode_hook);
				item->SetShortcut('v');
			}

			break;

		case SAFE_MODE_MENU:
			item = new(std::nothrow) MenuItem("Use fail-safe graphics driver");
			if (item != NULL) {
				menu->AddItem(item);
				item->SetType(MENU_ITEM_MARKABLE);
				item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
				item->SetHelpText("The system will use VESA mode "
					"and won't try to use any video graphics drivers.");
			}

			smp_add_safemode_menus(menu);

			item = new(std::nothrow) MenuItem("Disable ACPI");
			if (item != NULL) {
				menu->AddItem(item);
				item->SetType(MENU_ITEM_MARKABLE);
				item->SetData(B_SAFEMODE_DISABLE_ACPI);
				item->SetHelpText("Disables Advanced Configuration and Power "
					"Interface hardware support, overriding the ACPI setting "
					"in the kernel settings file.");
			}
			break;

		default:
			break;
	}
}
Ejemplo n.º 2
0
void
platform_add_menus(Menu *menu)
{
	MenuItem *item;

	switch (menu->Type()) {
		case MAIN_MENU:
			menu->AddItem(item = new(nothrow) MenuItem("Select screen resolution", video_mode_menu()));
			item->SetTarget(video_mode_hook);
			break;
		case SAFE_MODE_MENU:
			menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe graphics driver"));
			item->SetType(MENU_ITEM_MARKABLE);
			item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
			item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver");

#if 0
			smp_add_safemode_menus(menu);

			menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
			item->SetType(MENU_ITEM_MARKABLE);

			menu->AddItem(item = new(nothrow) MenuItem("Disable APM"));
			item->SetType(MENU_ITEM_MARKABLE);
			item->SetData("disable_apm");
			item->SetHelpText("This overrides the APM setting in the kernel settings file");

			menu->AddItem(item = new(nothrow) MenuItem("Disable ACPI"));
			item->SetType(MENU_ITEM_MARKABLE);
			item->SetData(B_SAFEMODE_DISABLE_ACPI);
			item->SetHelpText("This overrides the ACPI setting in the kernel settings file");
#endif
			break;
		default:
			break;
	}
}
Ejemplo n.º 3
0
int osd2_video_menu(int selected, unsigned input)
{
	struct advance_video_context* video_context = &CONTEXT.video;
	struct advance_global_context* global_context = &CONTEXT.global;
	struct advance_ui_context* ui_context = &CONTEXT.ui;

	struct ui_menu menu;
	unsigned mac;
	int resolution_index;
	int stretch_index;
	int vsync_index;
	int combine_index;
	int effect_index;
	int save_game_index;
	int save_resolution_index;
	int save_resolutionclock_index;
	int pipeline_index;
	int magnify_index;
	int index_index;
	int smp_index;
	int crash_index;
	int exit_index;
	char buffer[128];
	char freq[32];
	const char* text = 0;
	const char* option = 0;

	/* the menu data is not duplicated for the thread, so we have to wait for its completion */
	advance_video_thread_wait(video_context);

	if (selected >= 1)
		selected = selected - 1;
	else
		selected = 0;

	if (video_context->state.menu_sub_flag) {
		int ret = 0;
		switch (video_context->state.menu_sub_flag) {
		case 1: ret = video_mode_menu(video_context, ui_context, video_context->state.menu_sub_selected, input); break;
		case 2: ret = video_pipeline_menu(video_context, ui_context, video_context->state.menu_sub_selected, input); break;
		}
		switch (ret) {
		case -1: return -1;  /* hide interface */
		case 0: video_context->state.menu_sub_flag = 0; video_context->state.menu_sub_selected = 1; break;  /* close submenu */
		default: video_context->state.menu_sub_selected = ret; break;
		}
		return selected + 1;
	}

	advance_ui_menu_init(&menu);

	advance_ui_menu_title_insert(&menu, "Video Menu");

	snprintf(buffer, sizeof(buffer), "%dx%dx%d %.1f/%.1f/%.1f",
		video_size_x(),
		video_size_y(),
		video_bits_per_pixel(),
		(double)crtc_pclock_get(&video_context->state.crtc_effective) / 1E6,
		(double)crtc_hclock_get(&video_context->state.crtc_effective) / 1E3,
		(double)crtc_vclock_get(&video_context->state.crtc_effective)
	);
	advance_ui_menu_title_insert(&menu, buffer);

	resolution_index = advance_ui_menu_option_insert(&menu, "Mode...", video_context->config.resolution_buffer);

	if (!video_context->state.game_vector_flag) {
		if (strcmp(video_context->config.resolution_buffer, "auto") == 0) {
			switch (mode_current_magnify(video_context)) {
			default:
			case 1: text = "Magnify [1]"; break;
			case 2: text = "Magnify [2]"; break;
			case 3: text = "Magnify [3]"; break;
			case 4: text = "Magnify [4]"; break;
			}
			switch (video_context->config.magnify_factor) {
			default:
			case 0: option = "auto"; break;
			case 1: option = "1"; break;
			case 2: option = "2"; break;
			case 3: option = "3"; break;
			case 4: option = "4"; break;
			}
			magnify_index = advance_ui_menu_option_insert(&menu, text, option);
		} else {
			magnify_index = -1;
		}

		advance_ui_menu_title_insert(&menu, "Options");

		switch (mode_current_stretch(video_context)) {
		case STRETCH_NONE: text = "Resize [no]"; break;
		case STRETCH_INTEGER_XY: text = "Resize [integer]"; break;
		case STRETCH_INTEGER_X_FRACTIONAL_Y: text = "Resize [mixed]"; break;
		case STRETCH_FRACTIONAL_XY: text = "Resize [fractional]"; break;
		}
		switch (video_context->config.stretch) {
		case STRETCH_NONE: option = "no"; break;
		case STRETCH_INTEGER_XY: option = "integer"; break;
		case STRETCH_INTEGER_X_FRACTIONAL_Y: option = "mixed"; break;
		case STRETCH_FRACTIONAL_XY: option = "fractional"; break;
		}
		stretch_index = advance_ui_menu_option_insert(&menu, text, option);
	} else {
		magnify_index = -1;

		advance_ui_menu_title_insert(&menu, "Options");

		stretch_index = -1;
	}

	switch (video_index()) {
	case MODE_FLAGS_INDEX_PALETTE8:
		text = "Color [palette8]";
		break;
	case MODE_FLAGS_INDEX_BGR8:
		text = "Color [bgr8]";
		break;
	case MODE_FLAGS_INDEX_BGR15:
		text = "Color [bgr15]";
		break;
	case MODE_FLAGS_INDEX_BGR16:
		text = "Color [bgr16]";
		break;
	case MODE_FLAGS_INDEX_BGR32:
		text = "Color [bgr32]";
		break;
	case MODE_FLAGS_INDEX_YUY2:
		text = "Color [yuy2]";
		break;
	default:
		text = "Color [unknown]";
		break;
	}
	switch (video_context->config.index) {
	case MODE_FLAGS_INDEX_NONE:
		option = "auto";
		break;
	case MODE_FLAGS_INDEX_PALETTE8:
		option = "palette8";
		break;
	case MODE_FLAGS_INDEX_BGR8:
		option = "bgr8";
		break;
	case MODE_FLAGS_INDEX_BGR15:
		option = "bgr15";
		break;
	case MODE_FLAGS_INDEX_BGR16:
		option = "bgr16";
		break;
	case MODE_FLAGS_INDEX_BGR32:
		option = "bgr32";
		break;
	case MODE_FLAGS_INDEX_YUY2:
		option = "yuy2";
		break;
	default:
		option = "unknown";
		break;
	}
	index_index = advance_ui_menu_option_insert(&menu, text, option);

	switch (video_context->state.combine) {
	case COMBINE_NONE: text = "Resize Effect [no]"; break;
	case COMBINE_MAXMIN: text = "Resize Effect [max]"; break;
	case COMBINE_MEAN: text = "Resize Effect [mean]"; break;
	case COMBINE_FILTER: text = "Resize Effect [filter]"; break;
	case COMBINE_SCALEX: text = "Resize Effect [scalex]"; break;
	case COMBINE_SCALEK: text = "Resize Effect [scalek]"; break;
	case COMBINE_HQ: text = "Resize Effect [hq]"; break;
	case COMBINE_XBR: text = "Resize Effect [xbr]"; break;
	}
	switch (video_context->config.combine) {
	case COMBINE_AUTO: option = "auto"; break;
	case COMBINE_NONE: option = "no"; break;
	case COMBINE_MAXMIN: option = "max"; break;
	case COMBINE_MEAN: option = "mean"; break;
	case COMBINE_FILTER: option = "filter"; break;
	case COMBINE_SCALEX: option = "scalex"; break;
	case COMBINE_SCALEK: option = "scalek"; break;
	case COMBINE_HQ: option = "hq"; break;
	case COMBINE_XBR: option = "xbr"; break;
	}
	combine_index = advance_ui_menu_option_insert(&menu, text, option);

	switch (video_context->state.rgb_effect) {
	case EFFECT_NONE: text = "Rgb Effect [no]"; break;
	case EFFECT_RGB_TRIAD3PIX: text = "Rgb Effect [triad3dot]"; break;
	case EFFECT_RGB_TRIAD6PIX: text = "Rgb Effect [triad6dot]"; break;
	case EFFECT_RGB_TRIAD16PIX: text = "Rgb Effect [triad16dot]"; break;
	case EFFECT_RGB_TRIADSTRONG3PIX: text = "Rgb Effect [triadstrong3dot]"; break;
	case EFFECT_RGB_TRIADSTRONG6PIX: text = "Rgb Effect [triadstrong6dot]"; break;
	case EFFECT_RGB_TRIADSTRONG16PIX: text = "Rgb Effect [triadstrong16dot]"; break;
	case EFFECT_RGB_SCANDOUBLEHORZ: text = "Rgb Effect [scan2horz]"; break;
	case EFFECT_RGB_SCANTRIPLEHORZ: text = "Rgb Effect [scan3horz]"; break;
	case EFFECT_RGB_SCANDOUBLEVERT: text = "Rgb Effect [scan2vert]"; break;
	case EFFECT_RGB_SCANTRIPLEVERT: text = "Rgb Effect [scan3vert]"; break;
	}
	switch (video_context->config.rgb_effect) {
	case EFFECT_NONE: option = "no"; break;
	case EFFECT_RGB_TRIAD3PIX: option = "triad3dot"; break;
	case EFFECT_RGB_TRIAD6PIX: option = "triad6dot"; break;
	case EFFECT_RGB_TRIAD16PIX: option = "triad16dot"; break;
	case EFFECT_RGB_TRIADSTRONG3PIX: option = "triadstrong3dot"; break;
	case EFFECT_RGB_TRIADSTRONG6PIX: option = "triadstrong6dot"; break;
	case EFFECT_RGB_TRIADSTRONG16PIX: option = "triadstrong16dot"; break;
	case EFFECT_RGB_SCANDOUBLEHORZ: option = "scan2horz"; break;
	case EFFECT_RGB_SCANTRIPLEHORZ: option = "scan3horz"; break;
	case EFFECT_RGB_SCANDOUBLEVERT: option = "scan2vert"; break;
	case EFFECT_RGB_SCANTRIPLEVERT: option = "scan3vert"; break;
	}
	effect_index = advance_ui_menu_option_insert(&menu, text, option);

	switch (video_context->state.vsync_flag) {
	case 0: text = "Vsync [no]"; break;
	case 1:
		snprintf(freq, sizeof(freq), "Vsync [%.1f]", video_measured_vclock());
		text = freq;
		break;
	}
	switch (video_context->config.vsync_flag) {
	case 0: option = "no"; break;
	case 1: option = "yes"; break;
	}
	vsync_index = advance_ui_menu_option_insert(&menu, text, option);

#ifdef USE_SMP
	switch (video_context->config.smp_flag) {
	case 0: text = "SMP [no]"; break;
	case 1: text = "SMP [yes]"; break;
	}
	switch (video_context->config.smp_flag) {
	case 0: option = "no"; break;
	case 1: option = "yes"; break;
	}
	smp_index = advance_ui_menu_option_insert(&menu, text, option);
#else
	smp_index = -1;
#endif

	pipeline_index = advance_ui_menu_text_insert(&menu, "Details...");

	if (global_context->state.is_config_writable) {
		save_game_index = advance_ui_menu_text_insert(&menu, "Save for this game");

		if (!video_context->state.game_vector_flag) {
			save_resolutionclock_index = advance_ui_menu_text_insert(&menu, "Save for this game size/freq");
		} else {
			save_resolutionclock_index = -1;
		}

		if (video_context->state.game_vector_flag)
			text = "Save for all vector games";
		else
			text = "Save for this game size";
		save_resolution_index = advance_ui_menu_text_insert(&menu, text);
	} else {
		save_game_index = -1;
		save_resolution_index = -1;
		save_resolutionclock_index = -1;
	}

	if (video_context->config.crash_flag) {
		crash_index = advance_ui_menu_text_insert(&menu, "Crash");
	} else {
		crash_index = -1;
	}

	exit_index = advance_ui_menu_text_insert(&menu, "Return to Main Menu");

	mac = advance_ui_menu_done(&menu, ui_context, selected);

	if (input == OSD_INPUT_DOWN) {
		selected = (selected + 1) % mac;
	}

	if (input == OSD_INPUT_UP) {
		selected = (selected + mac - 1) % mac;
	}

	if (input == OSD_INPUT_SELECT) {
		if (selected == exit_index) {
			selected = -1;
		} else if (selected == resolution_index) {
			video_context->state.menu_sub_flag = 1;
		} else if (selected == pipeline_index) {
			video_context->state.menu_sub_flag = 2;
		} else if (selected == save_game_index) {
			advance_video_config_save(video_context, video_context->config.section_name_buffer);
		} else if (selected == save_resolution_index) {
			advance_video_config_save(video_context, video_context->config.section_resolution_buffer);
		} else if (selected == save_resolutionclock_index) {
			advance_video_config_save(video_context, video_context->config.section_resolutionclock_buffer);
		} else if (selected == crash_index) {
			target_crash();
		}
	}

	if (input == OSD_INPUT_RIGHT) {
		if (selected == combine_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.combine) {
			case COMBINE_AUTO: config.combine = COMBINE_NONE; break;
			case COMBINE_NONE: config.combine = COMBINE_MAXMIN; break;
			case COMBINE_MAXMIN: config.combine = COMBINE_MEAN; break;
			case COMBINE_MEAN: config.combine = COMBINE_FILTER; break;
			case COMBINE_FILTER: config.combine = COMBINE_SCALEX; break;
			case COMBINE_SCALEX: config.combine = COMBINE_SCALEK; break;
			case COMBINE_SCALEK: config.combine = COMBINE_HQ; break;
			case COMBINE_HQ: config.combine = COMBINE_XBR; break;
			case COMBINE_XBR: config.combine = COMBINE_AUTO; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == effect_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.rgb_effect) {
			case EFFECT_NONE: config.rgb_effect = EFFECT_RGB_TRIAD3PIX; break;
			case EFFECT_RGB_TRIAD3PIX: config.rgb_effect = EFFECT_RGB_TRIADSTRONG3PIX; break;
			case EFFECT_RGB_TRIADSTRONG3PIX: config.rgb_effect = EFFECT_RGB_TRIAD6PIX; break;
			case EFFECT_RGB_TRIAD6PIX: config.rgb_effect = EFFECT_RGB_TRIADSTRONG6PIX; break;
			case EFFECT_RGB_TRIADSTRONG6PIX: config.rgb_effect = EFFECT_RGB_TRIAD16PIX; break;
			case EFFECT_RGB_TRIAD16PIX: config.rgb_effect = EFFECT_RGB_TRIADSTRONG16PIX; break;
			case EFFECT_RGB_TRIADSTRONG16PIX: config.rgb_effect = EFFECT_RGB_SCANDOUBLEHORZ; break;
			case EFFECT_RGB_SCANDOUBLEHORZ: config.rgb_effect = EFFECT_RGB_SCANTRIPLEHORZ; break;
			case EFFECT_RGB_SCANTRIPLEHORZ: config.rgb_effect = EFFECT_RGB_SCANDOUBLEVERT; break;
			case EFFECT_RGB_SCANDOUBLEVERT: config.rgb_effect = EFFECT_RGB_SCANTRIPLEVERT; break;
			case EFFECT_RGB_SCANTRIPLEVERT: config.rgb_effect = EFFECT_NONE; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == vsync_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.vsync_flag) {
			case 0: config.vsync_flag = 1; break;
			case 1: config.vsync_flag = 0; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == smp_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.smp_flag) {
			case 0: config.smp_flag = 1; break;
			case 1: config.smp_flag = 0; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == magnify_index) {
			struct advance_video_config_context config = video_context->config;
			if (config.magnify_factor == 4)
				config.magnify_factor = 0;
			else
				config.magnify_factor += 1;
			advance_video_reconfigure(video_context, &config);
		} else if (selected == index_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.index) {
			case MODE_FLAGS_INDEX_NONE: config.index = MODE_FLAGS_INDEX_PALETTE8; break;
			case MODE_FLAGS_INDEX_PALETTE8: config.index = MODE_FLAGS_INDEX_BGR8; break;
			case MODE_FLAGS_INDEX_BGR8: config.index = MODE_FLAGS_INDEX_BGR15; break;
			case MODE_FLAGS_INDEX_BGR15: config.index = MODE_FLAGS_INDEX_BGR16; break;
			case MODE_FLAGS_INDEX_BGR16: config.index = MODE_FLAGS_INDEX_BGR32; break;
			case MODE_FLAGS_INDEX_BGR32: config.index = MODE_FLAGS_INDEX_YUY2; break;
			case MODE_FLAGS_INDEX_YUY2: config.index = MODE_FLAGS_INDEX_NONE; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == stretch_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.stretch) {
			case STRETCH_NONE: config.stretch = STRETCH_FRACTIONAL_XY; break;
			case STRETCH_INTEGER_XY: config.stretch = STRETCH_NONE; break;
			case STRETCH_INTEGER_X_FRACTIONAL_Y: config.stretch = STRETCH_INTEGER_XY; break;
			case STRETCH_FRACTIONAL_XY: config.stretch = STRETCH_INTEGER_X_FRACTIONAL_Y; break;
			}
			advance_video_reconfigure(video_context, &config);
		}
	}

	if (input == OSD_INPUT_LEFT) {
		if (selected == combine_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.combine) {
			case COMBINE_AUTO: config.combine = COMBINE_XBR; break;
			case COMBINE_NONE: config.combine = COMBINE_AUTO; break;
			case COMBINE_MAXMIN: config.combine = COMBINE_NONE; break;
			case COMBINE_MEAN: config.combine = COMBINE_MAXMIN; break;
			case COMBINE_FILTER: config.combine = COMBINE_MEAN; break;
			case COMBINE_SCALEX: config.combine = COMBINE_FILTER; break;
			case COMBINE_SCALEK: config.combine = COMBINE_SCALEX; break;
			case COMBINE_HQ: config.combine = COMBINE_SCALEK; break;
			case COMBINE_XBR: config.combine = COMBINE_HQ; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == effect_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.rgb_effect) {
			case EFFECT_NONE: config.rgb_effect = EFFECT_RGB_SCANTRIPLEVERT; break;
			case EFFECT_RGB_TRIAD3PIX: config.rgb_effect = EFFECT_NONE; break;
			case EFFECT_RGB_TRIADSTRONG3PIX: config.rgb_effect = EFFECT_RGB_TRIAD3PIX; break;
			case EFFECT_RGB_TRIAD6PIX: config.rgb_effect = EFFECT_RGB_TRIADSTRONG3PIX; break;
			case EFFECT_RGB_TRIADSTRONG6PIX: config.rgb_effect = EFFECT_RGB_TRIAD6PIX; break;
			case EFFECT_RGB_TRIAD16PIX: config.rgb_effect = EFFECT_RGB_TRIADSTRONG6PIX; break;
			case EFFECT_RGB_TRIADSTRONG16PIX: config.rgb_effect = EFFECT_RGB_TRIAD16PIX; break;
			case EFFECT_RGB_SCANDOUBLEHORZ: config.rgb_effect = EFFECT_RGB_TRIADSTRONG16PIX; break;
			case EFFECT_RGB_SCANTRIPLEHORZ: config.rgb_effect = EFFECT_RGB_SCANDOUBLEHORZ; break;
			case EFFECT_RGB_SCANDOUBLEVERT: config.rgb_effect = EFFECT_RGB_SCANTRIPLEHORZ; break;
			case EFFECT_RGB_SCANTRIPLEVERT: config.rgb_effect = EFFECT_RGB_SCANDOUBLEVERT; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == vsync_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.vsync_flag) {
			case 0: config.vsync_flag = 1; break;
			case 1: config.vsync_flag = 0; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == smp_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.smp_flag) {
			case 0: config.smp_flag = 1; break;
			case 1: config.smp_flag = 0;  break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == magnify_index) {
			struct advance_video_config_context config = video_context->config;
			if (config.magnify_factor == 0)
				config.magnify_factor = 4;
			else
				config.magnify_factor -= 1;
			advance_video_reconfigure(video_context, &config);
		} else if (selected == index_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.index) {
			case MODE_FLAGS_INDEX_NONE: config.index = MODE_FLAGS_INDEX_YUY2; break;
			case MODE_FLAGS_INDEX_PALETTE8: config.index = MODE_FLAGS_INDEX_NONE; break;
			case MODE_FLAGS_INDEX_BGR8: config.index = MODE_FLAGS_INDEX_PALETTE8; break;
			case MODE_FLAGS_INDEX_BGR15: config.index = MODE_FLAGS_INDEX_BGR8; break;
			case MODE_FLAGS_INDEX_BGR16: config.index = MODE_FLAGS_INDEX_BGR15; break;
			case MODE_FLAGS_INDEX_BGR32: config.index = MODE_FLAGS_INDEX_BGR16; break;
			case MODE_FLAGS_INDEX_YUY2: config.index = MODE_FLAGS_INDEX_BGR32; break;
			}
			advance_video_reconfigure(video_context, &config);
		} else if (selected == stretch_index) {
			struct advance_video_config_context config = video_context->config;
			switch (config.stretch) {
			case STRETCH_NONE: config.stretch = STRETCH_INTEGER_XY; break;
			case STRETCH_INTEGER_XY: config.stretch = STRETCH_INTEGER_X_FRACTIONAL_Y; break;
			case STRETCH_INTEGER_X_FRACTIONAL_Y: config.stretch = STRETCH_FRACTIONAL_XY; break;
			case STRETCH_FRACTIONAL_XY: config.stretch = STRETCH_NONE; break;
			}
			advance_video_reconfigure(video_context, &config);
		}
	}

	if (input == OSD_INPUT_CANCEL)
		selected = -1;

	if (input == OSD_INPUT_CONFIGURE)
		selected = -2;

	return selected + 1;
}