New video mode selection in menu, video mode corrections

This commit is contained in:
dborth 2009-04-22 18:21:37 +00:00
parent 40063aecbf
commit 088676c674
7 changed files with 104 additions and 51 deletions

View File

@ -129,7 +129,6 @@ void ResetControls()
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_B;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_Y;
//btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
/*** Superscope : wiimote button mapping ***/
@ -137,7 +136,6 @@ void ResetControls()
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_B;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_MINUS;
//btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_UP;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_DOWN;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS;
@ -691,7 +689,6 @@ void SetDefaultButtonMap ()
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope AimOffscreen");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
//ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause");
maxcode = 0x60;

View File

@ -963,7 +963,7 @@ static int MenuGameSelection()
HaltGui();
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
btnLogo->SetPosition(-30, 24);
btnLogo->SetPosition(-50, 24);
mainWindow->Append(&titleTxt);
mainWindow->Append(&gameBrowser);
mainWindow->Append(&buttonWindow);
@ -1244,7 +1244,7 @@ static int MenuGame()
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
closeBtn.SetPosition(-30, 35);
closeBtn.SetPosition(-50, 35);
closeBtn.SetLabel(&closeBtnTxt);
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
@ -1313,7 +1313,7 @@ static int MenuGame()
w.Append(&closeBtn);
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_BOTTOM);
btnLogo->SetPosition(-30, -40);
btnLogo->SetPosition(-50, -40);
mainWindow->Append(&w);
if(lastMenu == MENU_NONE)
@ -1512,7 +1512,7 @@ static int MenuGameSaves(int action)
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
closeBtn.SetPosition(-30, 35);
closeBtn.SetPosition(-50, 35);
closeBtn.SetLabel(&closeBtnTxt);
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
@ -1830,7 +1830,7 @@ static int MenuGameSettings()
GuiImage closeBtnImgOver(&btnCloseOutlineOver);
GuiButton closeBtn(btnCloseOutline.GetWidth(), btnCloseOutline.GetHeight());
closeBtn.SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
closeBtn.SetPosition(-30, 35);
closeBtn.SetPosition(-50, 35);
closeBtn.SetLabel(&closeBtnTxt);
closeBtn.SetImage(&closeBtnImg);
closeBtn.SetImageOver(&closeBtnImgOver);
@ -2823,6 +2823,7 @@ static int MenuSettingsVideo()
sprintf(options.name[i++], "Filtering");
sprintf(options.name[i++], "Screen Zoom");
sprintf(options.name[i++], "Screen Position");
sprintf(options.name[i++], "Video Mode");
options.length = i;
GuiText titleTxt("Game Settings - Video", 28, (GXColor){255, 255, 255, 255});
@ -2856,6 +2857,7 @@ static int MenuSettingsVideo()
GuiOptionBrowser optionBrowser(552, 248, &options);
optionBrowser.SetPosition(0, 108);
optionBrowser.SetCol2Position(200);
optionBrowser.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
HaltGui();
@ -2892,6 +2894,20 @@ static int MenuSettingsVideo()
sprintf (options.value[4], "%d, %d", GCSettings.xshift, GCSettings.yshift);
switch(GCSettings.videomode)
{
case 0:
sprintf (options.value[5], "Automatic (Recommended)"); break;
case 1:
sprintf (options.value[5], "NTSC (480i)"); break;
case 2:
sprintf (options.value[5], "Progressive (480p)"); break;
case 3:
sprintf (options.value[5], "PAL (50Hz)"); break;
case 4:
sprintf (options.value[5], "PAL (60Hz)"); break;
}
ret = optionBrowser.GetClickedOption();
switch (ret)
@ -2919,6 +2935,11 @@ static int MenuSettingsVideo()
case 4:
ScreenPositionWindow();
break;
case 5:
GCSettings.videomode++;
if(GCSettings.videomode > 4)
GCSettings.videomode = 0;
break;
}
if(backBtn.GetState() == STATE_CLICKED)
@ -3551,7 +3572,6 @@ MainMenu (int menu)
{
gameScreenImg = new GuiImage(gameScreenTex, screenwidth, screenheight);
gameScreenImg->SetAlpha(192);
//gameScreenImg->SetStripe(100);
gameScreenImg->ColorStripe(30);
mainWindow->Append(gameScreenImg);
bgImg->SetVisible(false);
@ -3579,7 +3599,7 @@ MainMenu (int menu)
logoTxt.SetPosition(0, 4);
btnLogo = new GuiButton(logoImg.GetWidth(), logoImg.GetHeight());
btnLogo->SetAlignment(ALIGN_RIGHT, ALIGN_TOP);
btnLogo->SetPosition(-30, 24);
btnLogo->SetPosition(-50, 24);
btnLogo->SetImage(&logoImg);
btnLogo->SetImageOver(&logoImgOver);
btnLogo->SetLabel(&logoTxt);
@ -3592,17 +3612,11 @@ MainMenu (int menu)
mainWindow->Append(bgBottomImg);
mainWindow->Append(btnLogo);
/*// memory usage - for debugging
memTxt = new GuiText(NULL, 18, (GXColor){255, 255, 255, 255});
memTxt->SetAlignment(ALIGN_LEFT, ALIGN_TOP);
memTxt->SetPosition(20, 20);
mainWindow->Append(memTxt);*/
if(currentMenu == MENU_GAMESELECTION)
ResumeGui();
// Load preferences
if(!LoadPrefs()) //TODO: notify that preferences reset
if(!LoadPrefs())
SavePrefs(SILENT);
#ifndef NO_SOUND
@ -3682,7 +3696,6 @@ MainMenu (int menu)
delete exitSound;
#endif
//delete memTxt;
delete btnLogo;
delete bgImg;
delete bgTopImg;

View File

@ -98,7 +98,7 @@ void UpdateCheck()
else // temporary, for compatibility
{
int versionnum = atoi(version);
if(versionnum > 11) // 011
if(versionnum > 12) // 012 (4.0.2)
{
item = mxmlFindElement(xml, xml, "file", NULL, NULL, MXML_DESCEND);
if(item)

View File

@ -43,6 +43,8 @@ void FixInvalidSettings()
GCSettings.Controller = CTRL_PAD2;
if(!(GCSettings.render >= 0 && GCSettings.render < 3))
GCSettings.render = 2;
if(!(GCSettings.videomode >= 0 && GCSettings.videomode < 5))
GCSettings.videomode = 0;
}
/****************************************************************************
@ -79,6 +81,7 @@ DefaultSettings ()
GCSettings.Controller = CTRL_PAD2;
GCSettings.videomode = 0; // automatic video mode detection
GCSettings.ZoomLevel = 1.0; // zoom level
GCSettings.render = 2; // Unfiltered
GCSettings.widescreen = 0; // no aspect ratio correction

View File

@ -77,6 +77,7 @@ struct SGCSettings{
float ZoomLevel; // zoom amount
int VerifySaves;
int videomode; // 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
int render; // 0 - original, 1 - filtered, 2 - unfiltered
int FilterMethod; // convert to RenderFilter
int Controller;

View File

@ -36,7 +36,7 @@
#define SNES9XGFX_SIZE EXT_PITCH*EXT_HEIGHT
#define FILTERMEM_SIZE 512*MAX_SNES_HEIGHT*4
static unsigned char * snes9xgfx = NULL; // changed.
static unsigned char * snes9xgfx = NULL;
unsigned char * filtermem = NULL; // only want ((512*2) X (239*2))
/*** 2D Video ***/
@ -45,6 +45,7 @@ static int whichfb = 0; // Switch
static GXRModeObj *vmode; // Menu video mode
int screenheight;
int screenwidth;
static int currentVideoMode = -1; // -1 - not set, 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
/*** GX ***/
#define TEX_WIDTH 512
@ -500,18 +501,49 @@ MakeTexture (const void *src, void *dst, s32 width, s32 height)
}
/****************************************************************************
* InitGCVideo
* SetupVideoMode
*
* This function MUST be called at startup.
* - also sets up menu video mode
* Finds the optimal video mode, or uses the user-specified one
* Also configures original video modes
***************************************************************************/
void
InitGCVideo ()
static void SetupVideoMode()
{
// get default video mode
if(currentVideoMode == GCSettings.videomode)
return; // no need to do anything
// choose the desired video mode
switch(GCSettings.videomode)
{
case 1: // NTSC (480i)
vmode = &TVNtsc480IntDf;
break;
case 2: // Progressive (480p)
vmode = &TVNtsc480Prog;
break;
case 3: // PAL (50Hz)
vmode = &TVPal574IntDfScale;
break;
case 4: // PAL (60Hz)
vmode = &TVEurgb60Hz480IntDf;
break;
default:
vmode = VIDEO_GetPreferredMode(NULL);
#ifdef HW_DOL
/* we have component cables, but the preferred mode is interlaced
* why don't we switch into progressive?
* on the Wii, the user can do this themselves on their Wii Settings */
if(VIDEO_HaveComponentCable())
vmode = &TVNtsc480Prog;
#endif
// use hardware vertical scaling to fill screen
if(vmode->viTVMode >> 2 == VI_PAL)
vmode = &TVPal574IntDfScale;
break;
}
// configure original modes
switch (vmode->viTVMode >> 2)
{
case VI_PAL:
@ -562,17 +594,11 @@ InitGCVideo ()
break;
}
#ifdef HW_DOL
/* we have component cables, but the preferred mode is interlaced
* why don't we switch into progressive?
* on the Wii, the user can do this themselves on their Wii Settings */
if(VIDEO_HaveComponentCable())
vmode = &TVNtsc480Prog;
#endif
// check for progressive scan
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
progressive = true;
else
progressive = false;
#ifdef HW_RVL
// widescreen fix
@ -583,6 +609,20 @@ InitGCVideo ()
}
#endif
currentVideoMode = GCSettings.videomode;
}
/****************************************************************************
* InitGCVideo
*
* This function MUST be called at startup.
* - also sets up menu video mode
***************************************************************************/
void
InitGCVideo ()
{
SetupVideoMode();
VIDEO_Configure (vmode);
screenheight = 480;
@ -626,7 +666,8 @@ InitGCVideo ()
void
ResetVideo_Emu ()
{
GXRModeObj *rmode = vmode;
SetupVideoMode();
GXRModeObj *rmode = vmode; // same mode as menu
Mtx44 p;
int i = -1;
@ -660,10 +701,6 @@ ResetVideo_Emu ()
rmode->viTVMode |= VI_INTERLACE;
}
}
else
{
rmode = vmode; // same mode as menu
}
VIDEO_Configure (rmode);
VIDEO_Flush();
@ -906,6 +943,7 @@ ResetVideo_Menu ()
f32 yscale;
u32 xfbHeight;
SetupVideoMode();
VIDEO_Configure (vmode);
VIDEO_Flush();
VIDEO_WaitVSync();

View File

@ -3,6 +3,7 @@
*
* softdev July 2006
* Michniewski 2008
* Tantric 2008-2009
*
* video.h
*