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_BUTTON_B;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_TRIGGER_Z; 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_Y;
//btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_X;
btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START; btnmap[CTRL_SCOPE][CTRLR_GCPAD][i++] = PAD_BUTTON_START;
/*** Superscope : wiimote button mapping ***/ /*** 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_B;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_A; 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_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_DOWN;
btnmap[CTRL_SCOPE][CTRLR_WIIMOTE][i++] = WPAD_BUTTON_PLUS; 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 AimOffscreen");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Cursor");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
//ASSIGN_BUTTON_FALSE (maxcode++, "Superscope ToggleTurbo");
ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause"); ASSIGN_BUTTON_FALSE (maxcode++, "Superscope Pause");
maxcode = 0x60; maxcode = 0x60;

View File

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

View File

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

View File

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

View File

@ -77,6 +77,7 @@ struct SGCSettings{
float ZoomLevel; // zoom amount float ZoomLevel; // zoom amount
int VerifySaves; 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 render; // 0 - original, 1 - filtered, 2 - unfiltered
int FilterMethod; // convert to RenderFilter int FilterMethod; // convert to RenderFilter
int Controller; int Controller;

View File

@ -36,7 +36,7 @@
#define SNES9XGFX_SIZE EXT_PITCH*EXT_HEIGHT #define SNES9XGFX_SIZE EXT_PITCH*EXT_HEIGHT
#define FILTERMEM_SIZE 512*MAX_SNES_HEIGHT*4 #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)) unsigned char * filtermem = NULL; // only want ((512*2) X (239*2))
/*** 2D Video ***/ /*** 2D Video ***/
@ -45,6 +45,7 @@ static int whichfb = 0; // Switch
static GXRModeObj *vmode; // Menu video mode static GXRModeObj *vmode; // Menu video mode
int screenheight; int screenheight;
int screenwidth; int screenwidth;
static int currentVideoMode = -1; // -1 - not set, 0 - automatic, 1 - NTSC (480i), 2 - Progressive (480p), 3 - PAL (50Hz), 4 - PAL (60Hz)
/*** GX ***/ /*** GX ***/
#define TEX_WIDTH 512 #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. * Finds the optimal video mode, or uses the user-specified one
* - also sets up menu video mode * Also configures original video modes
***************************************************************************/ ***************************************************************************/
static void SetupVideoMode()
void
InitGCVideo ()
{ {
// 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); 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) switch (vmode->viTVMode >> 2)
{ {
case VI_PAL: case VI_PAL:
@ -562,17 +594,11 @@ InitGCVideo ()
break; 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 // check for progressive scan
if (vmode->viTVMode == VI_TVMODE_NTSC_PROG) if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
progressive = true; progressive = true;
else
progressive = false;
#ifdef HW_RVL #ifdef HW_RVL
// widescreen fix // widescreen fix
@ -583,6 +609,20 @@ InitGCVideo ()
} }
#endif #endif
currentVideoMode = GCSettings.videomode;
}
/****************************************************************************
* InitGCVideo
*
* This function MUST be called at startup.
* - also sets up menu video mode
***************************************************************************/
void
InitGCVideo ()
{
SetupVideoMode();
VIDEO_Configure (vmode); VIDEO_Configure (vmode);
screenheight = 480; screenheight = 480;
@ -626,7 +666,8 @@ InitGCVideo ()
void void
ResetVideo_Emu () ResetVideo_Emu ()
{ {
GXRModeObj *rmode = vmode; SetupVideoMode();
GXRModeObj *rmode = vmode; // same mode as menu
Mtx44 p; Mtx44 p;
int i = -1; int i = -1;
@ -660,10 +701,6 @@ ResetVideo_Emu ()
rmode->viTVMode |= VI_INTERLACE; rmode->viTVMode |= VI_INTERLACE;
} }
} }
else
{
rmode = vmode; // same mode as menu
}
VIDEO_Configure (rmode); VIDEO_Configure (rmode);
VIDEO_Flush(); VIDEO_Flush();
@ -906,6 +943,7 @@ ResetVideo_Menu ()
f32 yscale; f32 yscale;
u32 xfbHeight; u32 xfbHeight;
SetupVideoMode();
VIDEO_Configure (vmode); VIDEO_Configure (vmode);
VIDEO_Flush(); VIDEO_Flush();
VIDEO_WaitVSync(); VIDEO_WaitVSync();

View File

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