Esempio n. 1
0
void UGUI() {
    int i;
    UpdatePads();
    mainWindow->Draw();

#ifdef HW_RVL
    for (i = 3; i >= 0; i--) // so that player 1's cursor appears on top!
    {
        if (userInput[i].wpad->ir.valid)
            Menu_DrawImg(userInput[i].wpad->ir.x - 48, userInput[i].wpad->ir.y - 48,
                96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
        DoRumble(i);
    }
#endif
    Menu_Render();

    for (i = 0; i < 4; i++)
        mainWindow->Update(&userInput[i]);

    if (ExitRequested) {
        for (i = 0; i <= 255; i += 15) {
            mainWindow->Draw();

            Menu_DrawRectangle(0, 0, screenwidth, screenheight, (GXColor) {
                0, 0, 0, i
            }, 1);
            Menu_Render();
        }
        ExitApp();
    }
}
Esempio n. 2
0
/****************************************************************************
 * UpdateGUI
 *
 * Primary thread to allow GUI to respond to state changes, and draws GUI
 ***************************************************************************/
static void * UpdateGUI(void *arg)
{
    u8 i;

    while (!ExitRequested)
    {
        if (guiHalt)
        {
            LWP_SuspendThread(guithread);
            continue;
        }

        UpdatePads();

        mainWindow->Draw();
        if (Settings.tooltips && Theme::ShowTooltips && mainWindow->GetState() != STATE_DISABLED)
            mainWindow->DrawTooltip();

        // Pointer modifies wpad data struct for easy implementation of "virtual pointer" with PAD-Sticks
        // That is why it has to be called right before updating other gui elements with the triggers
        i = 4;
        while(i--)
            pointer[i]->Draw(&userInput[i]);

        for (i = 0; i < 4; i++)
            mainWindow->Update(&userInput[i]);

        Menu_Render();

        if (bgMusic) bgMusic->UpdateState();
    }

    for (i = 5; i < 255; i += 10)
    {
        mainWindow->Draw();
        Menu_DrawRectangle(0, 0, screenwidth, screenheight, (GXColor) {
            0, 0, 0, i
        }, 1);
        Menu_Render();
    }

    mainWindow->RemoveAll();
    ShutoffRumble();

    return NULL;
}
Esempio n. 3
0
static void *
UpdateGUI (void *arg)
{
	int i;

	while(1)
	{
		if(guiHalt)
		{
			LWP_SuspendThread(guithread);
		}
		else
		{
			UpdatePads();
			mainWindow->Draw();

			#ifdef HW_RVL
			for(i=3; i >= 0; i--) // so that player 1's cursor appears on top!
			{
				if(userInput[i].wpad->ir.valid)
					Menu_DrawImg(userInput[i].wpad->ir.x-48, userInput[i].wpad->ir.y-48,
						96, 96, pointer[i]->GetImage(), userInput[i].wpad->ir.angle, 1, 1, 255);
				DoRumble(i);
			}
			#endif

			Menu_Render();

			for(i=0; i < 4; i++)
				mainWindow->Update(&userInput[i]);

			if(ExitRequested)
			{
				for(i = 0; i < 255; i += 15)
				{
					mainWindow->Draw();
					Menu_DrawRectangle(0,0,screenwidth,screenheight,(GXColor){0, 0, 0, i},1);
					Menu_Render();
				}
				ExitApp();
			}
		}
	}
	return NULL;
}
Esempio n. 4
0
u32 GetJoy(int pad)
{
	UpdatePads();

	// request to go back to menu
	if (MenuRequested())
	{
		ScreenshotRequested = 1;
		updateRumbleFrame();
		return 0;
	}

	u32 J = DecodeJoy(pad);
	// don't allow up+down or left+right
	if ((J & 48) == 48)
		J &= ~16;
	if ((J & 192) == 192)
		J &= ~128;
	updateRumbleFrame();
	return J;
}
Esempio n. 5
0
void GetJoy()
{
	JSReturn = 0; // reset buttons pressed
	unsigned char pad[4];
	short i;

	UpdatePads();

	// Turbo mode
	// RIGHT on c-stick and on classic ctrlr right joystick
	if(userInput[0].pad.substickX > 70 || userInput[0].WPAD_StickX(1) > 70)
		turbomode = 1;
	else
		turbomode = 0;

	// request to go back to menu
	if(MenuRequested())
		ScreenshotRequested = 1; // go to the menu

	for (i = 0; i < 4; i++)
		pad[i] = DecodeJoy(i);

	JSReturn = pad[0] | pad[1] << 8 | pad[2] << 16 | pad[3] << 24;
}
Esempio n. 6
0
/****************************************************************************
* systemReadJoypads
****************************************************************************/
bool systemReadJoypads()
{
	UpdatePads();
	return true;
}
Esempio n. 7
0
static void *
UpdateGUI (void *arg)
{
	int i;

	while(1)
	{
		if(guiHalt)
		{
			LWP_SuspendThread(guithread);
		}
		else
		{
			UpdatePads();
			mainWindow->Draw();

			#ifdef HW_RVL
		//	for(i=3; i >= 0; i--) // so that player 1's cursor appears on top!
		//	{
				if(userInput[0].wpad->ir.valid)
					Menu_DrawImg(userInput[0].wpad->ir.x-48, userInput[0].wpad->ir.y-48,
						96, 96, pointer->GetImage(), userInput[0].wpad->ir.angle, 1, 1, 255);
		//	}
			#endif

			Menu_Render();

		//	for(i=0; i < 4; i++)
				mainWindow->Update(&userInput[0]);

			if(ExitRequested)
			{
				for(i = 0; i < 255; i += 15)
				{
					mainWindow->Draw();
					GXColor Color = (GXColor) {0, 0, 0, i};
					Menu_DrawRectangle(0,0,screenwidth,screenheight,&Color,false,true);
					Menu_Render();
				}

				if (boothomebrew)
				{
					LoadHomebrew(Settings.forwarder_path.c_str());

					string startingAppName = Settings.forwarder_path;

					if((signed)startingAppName.rfind("/") != -1)
						startingAppName.erase(startingAppName.rfind("/"));

					startingAppName.erase(0, startingAppName.rfind("/") +1);

					if(IOS_GetVersion() != GetAppIOS(startingAppName))
						addAppIos(Settings.startingAppName, SelectedIOS());
				}
				if (!goneek2o)
					ExitApp();
			}

			// sd check
			if(Settings.device == "sd1")
				check_sd();

			// usb check
			else if(Settings.device == "usb1")
				check_usb();

			// sd und usb check
			else if(Settings.device == "sd_usb")
			{
				check_sd();
				check_usb();
			}

			else if(Settings.device == "dvd")
				check_dvd();
#ifndef VWII
			else if(Settings.device == "gca")
				check_gca();

			else if(Settings.device == "gcb")
				check_gcb();
#endif
			else if(Settings.device == "all")
			{
				check_sd();
				check_usb();
				check_dvd();
#ifndef VWII
				check_gca();
				check_gcb();
#endif
			}

			// screenshoot
			if(WPAD_ButtonsDown(0) & WPAD_BUTTON_1 && WPAD_ButtonsDown(0) & WPAD_BUTTON_2)
				Screenshot();
		}
	}
	return NULL;
}
Esempio n. 8
0
extern "C" void mplayer_osd_draw(int level)
{
	if ((mplayer_get_pause() == 1) && (first_enter == 1)) {
		ResetController();
		first_enter = 0;
	}	
	//Y-osd button used because libmenu is off
	GuiTrigger osdMenu;
	osdMenu.SetButtonOnlyTrigger(-1, 0, PAD_BUTTON_Y);
	GuiButton osdBtn(20, 20);
	osdBtn.SetTrigger(&osdMenu);
	osdBtn.SetSelectable(false);
	mainWindow->Append(&osdBtn);
	if (osd_show) {

		double duration = mplayer_get_duration();
		double elapsed = mplayer_get_elapsed();

		struct XenosSurface * img = video_osd_progress_bar_front->GetImage();
		float pourcents = (float) (elapsed * 100) / (float) duration;
		float width = (float) osd_duration_bar_width * (pourcents / 100.0);
		img->width = width;

		format_time(osd_duration, duration);
		format_time(osd_cur_time, elapsed);

		video_osd_info_cur_time->SetText(osd_cur_time);
		video_osd_info_duration->SetText(osd_duration);

		if (last_level != level) {
			video_osd_info_filename->SetText(mplayer_get_filename());
			video_osd_info_filename->SetMaxWidth(644);
			video_osd_info_filename->SetScroll(SCROLL_HORIZONTAL);
		}

		video_osd_progress_bar_front->SetImage(img, img->width, img->height);

		video_osd_play->SetVisible(false);
		video_osd_pause->SetVisible(false);
		video_osd_stop->SetVisible(false);
		video_osd_rewind->SetVisible(false);
		video_osd_forward->SetVisible(false);
		video_osd_next->SetVisible(false);
		video_osd_prev->SetVisible(false);

		switch (mplayer_get_status()) {
		case 1:
			video_osd_play->SetVisible(true);
			break;
		case 2:
			video_osd_pause->SetVisible(true);
			break;
		case 3:
			video_osd_stop->SetVisible(true);
			break;
		case 4:
			video_osd_rewind->SetVisible(true);
			break;
		case 5:
			video_osd_forward->SetVisible(true);
			break;
		case 6:
			video_osd_next->SetVisible(true);
			break;
		case 7:
			video_osd_prev->SetVisible(true);
			break;

		default:
			break;
		}

		// show file info
		if (osd_display_info) {
			if (!video_osd_infobar->IsVisible())
				video_osd_infobar->SetVisible(true);
		} else {
			if (video_osd_infobar->IsVisible())
				video_osd_infobar->SetVisible(false);
		}

		if (level == 3) {
			if (!osd_options_window->IsVisible())
				osd_options_window->SetVisible(true);
		} else {
			if (osd_options_window->IsVisible())
				osd_options_window->SetVisible(false);
				osd_display_info = 0;
				osd_display_option_subtitle = 0;
				osd_display_option_audio = 0;
				osd_display_option_video = 0;
		}
	} else {
		osd_display_info = 0;
	}
	OsdSubtitlesOptions();
	OsdAudioOptions();
	OsdVideoOptions();
	Menu_Frame();
	last_level = level;
	mainWindow->Draw();
	if (level == 3) { //this fixes non intended key-presses when osd is not 3 (like when seekbar is present)
		UpdatePads();
		for (int i = 0; i < 4; i++) {
			mainWindow->Update(&userInput[i]);
		}
		if ((mplayer_get_pause() == 1) && (osdBtn.GetState() == STATE_CLICKED)) {
			osd_level = 1;
			osd_display_info = 0;
			osd_display_option_subtitle = 0;
			osd_display_option_audio = 0;
			osd_display_option_video = 0;

		}
	}
	mainWindow->Remove(&osdBtn);
}
Esempio n. 9
0
static void OsdVideoOptions()
{
	bool firstRun = true;
	std::string osd_framedrop;
	if ((osd_display_option_subtitle == 0) && (osd_display_option_audio == 0)) {
		if (osd_display_option_video) {
			osd_options_window->SetFocus(0);
			osd_options_headline->SetText("Video Options");
			osd_options_video_window->SetVisible(true);
			osd_options_video_window->SetFocus(1);
			osd_options_video->SetFocus(1);
			Menu_Frame();
			UpdatePads();
			for (int i = 0; i < 4; i++) {
				mainWindow->Update(&userInput[i]);
			}
			int ret = osd_options_video->GetClickedOption();
			switch (ret) {
				case 0:
				{
					mplayer_switch_fullscreen();
					break;
				}
				case 1:
				{
					frame_dropping++;
					if (frame_dropping > 2) {
						frame_dropping = 0;
					}
					break;
				}
				case 2:
				{
					vo_vsync = !vo_vsync;
					break;
				}
				case 3:
				{
					osd_display_option_video = 0;
					osd_options_menu_pan_btn->SetState(STATE_SELECTED);
					break;
				}
			}
			if (ret >= 0 || firstRun) {
				firstRun = false;
				if (frame_dropping == 2) {
					osd_framedrop = "Hard";
				} else if (frame_dropping == 1) {
					osd_framedrop = "Enabled";
				} else {
					osd_framedrop = "Disabled";
				}
				sprintf(video_option_list.value[0], "%s", vo_fs == 1 ? "Enabled" : "Disabled");
				sprintf(video_option_list.value[1], osd_framedrop.c_str());
				sprintf(video_option_list.value[2], "%s", vo_vsync == 1 ? "Enabled" : "Disabled");
				osd_options_video->TriggerUpdate();
			}
		} else {
			osd_options_headline->SetText("");
			osd_options_video_window->SetVisible(false);
			osd_options_video_window->SetFocus(0);
			osd_options_video->SetFocus(0);
			osd_options_window->SetFocus(1);
		}
	}
}
Esempio n. 10
0
static void OsdAudioOptions()
{
	bool firstRun = true;
	float osd_audiodelay, osd_volume;
	if ((osd_display_option_subtitle == 0) && (osd_display_option_video == 0)) {
		if (osd_display_option_audio) {
			osd_options_window->SetFocus(0);
			osd_options_headline->SetText("Audio Options");
			osd_options_audio_window->SetVisible(true);
			osd_options_audio_window->SetFocus(1);
			osd_options_audio->SetFocus(1);
			Menu_Frame();
			UpdatePads();
			for (int i = 0; i < 4; i++) {
				mainWindow->Update(&userInput[i]);
			}
			int ret = osd_options_audio->GetClickedOption();
			switch (ret) {
				case 0:
				{
					mplayer_switch_audio();
					break;
				}
				case 3:
				{
					mplayer_switch_mute();
					break;
				}
				case 5:
				{
					osd_display_option_audio = 0;
					osd_options_menu_audio_channel_btn->SetState(STATE_SELECTED);
					break;
				}
			}
			int het = osd_options_audio->GetSelectedOption();
			if (osd_options_audio->GetLeft() == 1) {
				switch (het) {
				case 1:
				{
					mplayer_switch_volume(0);
					break;
				}
				/*case 2:
				{
					mplayer_switch_balance(1);
					break;
				} */
				case 4:
				{
					audio_delay += 0.1;
					break;
				}
				}
			} else if (osd_options_audio->GetRight() == 1) {
				switch (het) {
				case 1:
				{
					mplayer_switch_volume(1);
					break;
				}
				/*case 2:
				{
					mplayer_switch_balance(0);
					break;
				}*/
				case 4:
				{
					audio_delay -= 0.1;
					break;
				}
				}
			}
			if (ret >= 0 || firstRun) {
				firstRun = false;
				osd_volume = mplayer_get_volume();
				//std::string osd_balance(mplayer_get_balance());
				std::string osd_mute(mplayer_get_mute());
				osd_audiodelay = (audio_delay * -1000);
				if ((osd_audiodelay < 0.100) && (osd_audiodelay > -0.100)) {
					osd_audiodelay = 0;
				}
				sprintf(audio_option_list.value[1], "%.0f", osd_volume);
				sprintf(audio_option_list.value[2], "Disabled"); //balance is not working
				sprintf(audio_option_list.value[3], osd_mute.c_str());
				sprintf(audio_option_list.value[4], "%.0f ms", osd_audiodelay);
				osd_options_audio->TriggerUpdate();
			}
		} else {
			osd_options_headline->SetText("");
			osd_options_audio_window->SetVisible(false);
			osd_options_audio_window->SetFocus(0);
			osd_options_audio->SetFocus(0);
			osd_options_window->SetFocus(1);
		}
	}
}
Esempio n. 11
0
static void OsdSubtitlesOptions()
{
	bool firstRun = true;
	float osd_subdelay;
	if ((osd_display_option_audio == 0) && (osd_display_option_video == 0)) {
		if (osd_display_option_subtitle) {
			osd_options_window->SetFocus(0);
			osd_options_headline->SetText("Subtitle Options");
			osd_options_subtitle_window->SetVisible(true);
			osd_options_subtitle_window->SetFocus(1);
			osd_options_subtitle->SetFocus(1);
			Menu_Frame();
			UpdatePads();
			for (int i = 0; i < 4; i++) {
				mainWindow->Update(&userInput[i]);
			}
			int ret = osd_options_subtitle->GetClickedOption();
			switch (ret) {
				case 0:
				{
					mplayer_switch_subtitle();
					break;
				}
				case 1:
				{
					sub_visibility = (sub_visibility == 1) ? 0 : 1;
					break;
				}
				case 5:
				{
					osd_display_option_subtitle = 0;
					osd_options_menu_subtitle_btn->SetState(STATE_SELECTED);
					break;
				}
			}
			int het = osd_options_subtitle->GetSelectedOption();
			if (osd_options_subtitle->GetLeft() == 1) {
				switch (het) {
				case 2:
				{
					if (!ass_enabled) {
						sub_pos--;
						if (sub_pos < 0) {
							sub_pos = 100;
						}
					}
					break;
				}
				case 3:
				{
					sub_delay += 0.1;
					break;
				}
				case 4:
				{
					if (ass_enabled) {
						ass_font_scale -= 0.1;
						if (ass_font_scale < 0) {
							ass_font_scale = 100;
						}
						ass_force_reload = 1;
					} else {
						text_font_scale_factor -= 0.1;
						if (text_font_scale_factor < 0) {
							text_font_scale_factor = 100;
						}
						force_load_font = 1;
					}
					break;
				}
				}
			} else if (osd_options_subtitle->GetRight() == 1) {
				switch (het) {
				case 2:
				{
					if (!ass_enabled) {
						sub_pos++;
						if (sub_pos > 100) {
							sub_pos = 0;
						}
					}
					break;
				}
				case 3:
				{
					sub_delay -= 0.1;
					break;
				}
				case 4:
				{
					if (ass_enabled) {
						ass_font_scale += 0.1;
						if (ass_font_scale > 100) {
							ass_font_scale = 0;
						}
						ass_force_reload = 1;
					} else {
						text_font_scale_factor += 0.1;
						if (text_font_scale_factor > 100) {
							text_font_scale_factor = 0;
						}
						force_load_font = 1;
					}
					break;
				}
				}
			}
			if (ret >= 0 || firstRun) {
				firstRun = false;
				std::string osd_sub_name(mplayer_get_subtitle());
				osd_subdelay = (sub_delay * -1000);
				if ((osd_subdelay < 0.100) && (osd_subdelay > -0.100)) {
					osd_subdelay = 0;
				}
				sprintf(subtitle_option_list.value[0], osd_sub_name.c_str());
				sprintf(subtitle_option_list.value[1], "%s", sub_visibility == 1 ? "Enabled" : "Disabled");
				if (!ass_enabled) {
					sprintf(subtitle_option_list.value[2], "%d", sub_pos);
				} else {
					sprintf(subtitle_option_list.value[2], "%s", "Disabled");
				}
				sprintf(subtitle_option_list.value[3], "%.0f ms", osd_subdelay);
				sprintf(subtitle_option_list.value[4], "%.2f", ass_enabled == 1 ? ass_font_scale : text_font_scale_factor);
				osd_options_subtitle->TriggerUpdate();
			}
		} else {
			osd_options_headline->SetText("");
			osd_options_subtitle_window->SetVisible(false);
			osd_options_subtitle_window->SetFocus(0);
			osd_options_subtitle->SetFocus(0);
			osd_options_window->SetFocus(1);
		}
	}
}