REMOVED predefined fullscreen modes from menu

REARRANGED video menu
FIXED: Switching "Ignore aspect ratio" will not resize the window
RENAMED fsMaxScale to maxScale
FIXED OpenGL maxScale and aspectRatio switching

git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@728 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
spacy51 2008-09-17 19:19:08 +00:00
parent cb1cf28ba0
commit 2e346a8ce0
9 changed files with 33 additions and 170 deletions

View File

@ -263,36 +263,8 @@ bool Direct3DDisplay::initialize()
DXTRACE_ERR_MSGBOX( _T("Error creating Direct3D object"), 0 );
return false;
}
pD3D->GetAdapterDisplayMode(theApp.fsAdapter, &mode);
theApp.mode320Available = FALSE;
theApp.mode640Available = FALSE;
theApp.mode800Available = FALSE;
theApp.mode1024Available = FALSE;
theApp.mode1280Available = FALSE;
unsigned int nModes, i;
D3DDISPLAYMODE dm;
nModes = pD3D->GetAdapterModeCount(theApp.fsAdapter, mode.Format);
for( i = 0; i<nModes; i++ )
{
if( D3D_OK == pD3D->EnumAdapterModes(theApp.fsAdapter, mode.Format, i, &dm) )
{
if( (dm.Width == 320) && (dm.Height == 240) )
theApp.mode320Available = true;
if( (dm.Width == 640) && (dm.Height == 480) )
theApp.mode640Available = true;
if( (dm.Width == 800) && (dm.Height == 600) )
theApp.mode800Available = true;
if( (dm.Width == 1024) && (dm.Height == 768) )
theApp.mode1024Available = true;
if( (dm.Width == 1280) && (dm.Height == 1024) )
theApp.mode1280Available = true;
}
}
screenFormat = mode.Format;
switch(mode.Format) {
@ -827,8 +799,8 @@ void Direct3DDisplay::calculateDestRect()
float scaleX = (float)dpp.BackBufferWidth / (float)width;
float scaleY = (float)dpp.BackBufferHeight / (float)height;
float min = (scaleX < scaleY) ? scaleX : scaleY;
if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) {
min = (float)theApp.fsMaxScale;
if( theApp.maxScale && (min > theApp.maxScale) ) {
min = (float)theApp.maxScale;
}
destRect.left = 0;
destRect.top = 0;

View File

@ -139,12 +139,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X2, OnUpdateOptionsVideoX2)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X3, OnUpdateOptionsVideoX3)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_X4, OnUpdateOptionsVideoX4)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnUpdateOptionsVideoFullscreen320x240)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnUpdateOptionsVideoFullscreen640x480)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnUpdateOptionsVideoFullscreen800x600)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN320X240, OnOptionsVideoFullscreen320x240)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN640X480, OnOptionsVideoFullscreen640x480)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN800X600, OnOptionsVideoFullscreen800x600)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN, OnOptionsVideoFullscreen)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN, OnUpdateOptionsVideoFullscreen)
ON_WM_MOVING()
@ -388,10 +382,6 @@ BEGIN_MESSAGE_MAP(MainWnd, CWnd)
ON_MESSAGE(WM_SYSCOMMAND, OnMySysCommand)
ON_COMMAND(ID_OPTIONS_SOUND_HARDWAREACCELERATION, &MainWnd::OnOptionsSoundHardwareacceleration)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_SOUND_HARDWAREACCELERATION, &MainWnd::OnUpdateOptionsSoundHardwareacceleration)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN1280X1024, OnOptionsVideoFullscreen1280x1024)
ON_COMMAND(ID_OPTIONS_VIDEO_FULLSCREEN1024X768, OnOptionsVideoFullscreen1024x768)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN1024X768, OnUpdateOptionsVideoFullscreen1024x768)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_VIDEO_FULLSCREEN1280X1024, OnUpdateOptionsVideoFullscreen1280x1024)
ON_COMMAND(ID_OPTIONS_FILTER_LCDCOLORS, OnOptionsFilterLcdcolors)
ON_UPDATE_COMMAND_UI(ID_OPTIONS_FILTER_LCDCOLORS, OnUpdateOptionsFilterLcdcolors)
ON_COMMAND(ID_OUTPUTAPI_DIRECTSOUND, &MainWnd::OnOutputapiDirectsound)

View File

@ -143,12 +143,6 @@ protected:
afx_msg void OnUpdateOptionsVideoX2(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX3(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoX4(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI);
afx_msg void OnOptionsVideoFullscreen320x240();
afx_msg void OnOptionsVideoFullscreen640x480();
afx_msg void OnOptionsVideoFullscreen800x600();
afx_msg void OnOptionsVideoFullscreen();
afx_msg void OnUpdateOptionsVideoFullscreen(CCmdUI* pCmdUI);
afx_msg void OnMove(int x, int y);
@ -343,10 +337,6 @@ protected:
afx_msg void OnUpdateOptionsFilterLcdcolors(CCmdUI *pCmdUI);
afx_msg void OnOptionsSoundHardwareacceleration();
afx_msg void OnUpdateOptionsSoundHardwareacceleration(CCmdUI *pCmdUI);
afx_msg void OnOptionsVideoFullscreen1280x1024();
afx_msg void OnOptionsVideoFullscreen1024x768();
afx_msg void OnUpdateOptionsVideoFullscreen1024x768(CCmdUI *pCmdUI);
afx_msg void OnUpdateOptionsVideoFullscreen1280x1024(CCmdUI *pCmdUI);
afx_msg void OnLinkOptions();
afx_msg void OnOptionsLinkLog() ;
afx_msg void OnUpdateOptionsLinkLog(CCmdUI* pCmdUI) ;

View File

@ -269,69 +269,12 @@ void MainWnd::OnUpdateOptionsVideoX4(CCmdUI* pCmdUI)
pCmdUI->SetCheck(theApp.videoOption == VIDEO_4X);
}
void MainWnd::OnUpdateOptionsVideoFullscreen320x240(CCmdUI* pCmdUI)
{
pCmdUI->Enable(theApp.mode320Available);
pCmdUI->SetCheck(theApp.videoOption == VIDEO_320x240);
}
void MainWnd::OnUpdateOptionsVideoFullscreen640x480(CCmdUI* pCmdUI)
{
pCmdUI->Enable(theApp.mode640Available);
pCmdUI->SetCheck(theApp.videoOption == VIDEO_640x480);
}
void MainWnd::OnUpdateOptionsVideoFullscreen800x600(CCmdUI* pCmdUI)
{
pCmdUI->Enable(theApp.mode800Available);
pCmdUI->SetCheck(theApp.videoOption == VIDEO_800x600);
}
void MainWnd::OnUpdateOptionsVideoFullscreen1024x768(CCmdUI *pCmdUI)
{
pCmdUI->Enable(theApp.mode1024Available);
pCmdUI->SetCheck(theApp.videoOption == VIDEO_1024x768);
}
void MainWnd::OnUpdateOptionsVideoFullscreen1280x1024(CCmdUI *pCmdUI)
{
pCmdUI->Enable(theApp.mode1280Available);
pCmdUI->SetCheck(theApp.videoOption == VIDEO_1280x1024);
}
BOOL MainWnd::OnOptionVideoSize(UINT nID)
{
theApp.updateVideoSize(nID);
return TRUE;
}
void MainWnd::OnOptionsVideoFullscreen320x240()
{
OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN320X240);
}
void MainWnd::OnOptionsVideoFullscreen640x480()
{
OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN640X480);
}
void MainWnd::OnOptionsVideoFullscreen800x600()
{
OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN800X600);
}
void MainWnd::OnOptionsVideoFullscreen1024x768()
{
OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN1024X768);
}
void MainWnd::OnOptionsVideoFullscreen1280x1024()
{
OnOptionVideoSize(ID_OPTIONS_VIDEO_FULLSCREEN1280X1024);
}
void MainWnd::OnOptionsVideoFullscreen()
{
IDisplay::VIDEO_MODE mode;
@ -379,11 +322,7 @@ void MainWnd::OnUpdateOptionsVideoDisablesfx(CCmdUI* pCmdUI)
void MainWnd::OnOptionsVideoFullscreenstretchtofit()
{
theApp.fullScreenStretch = !theApp.fullScreenStretch;
theApp.updateWindowSize( theApp.videoOption );
if( theApp.display ) {
if( emulating ) {
theApp.display->clear( );
}
theApp.display->setOption( _T("fullScreenStretch"), theApp.fullScreenStretch );
}
}
@ -1485,7 +1424,7 @@ void MainWnd::OnOptionsVideoFullscreenmaxscale()
dlg.DoModal();
if( theApp.display ) {
theApp.display->setOption( _T("maxScale"), theApp.fsMaxScale );
theApp.display->setOption( _T("maxScale"), theApp.maxScale );
}
}

View File

@ -70,7 +70,7 @@ void MaxScale::OnOk()
{
CString tmp;
m_value.GetWindowText(tmp);
theApp.fsMaxScale = atoi(tmp);
theApp.maxScale = atoi(tmp);
EndDialog(TRUE);
}
@ -80,7 +80,7 @@ BOOL MaxScale::OnInitDialog()
CString temp;
temp.Format("%d", theApp.fsMaxScale);
temp.Format("%d", theApp.maxScale);
m_value.SetWindowText(temp);

View File

@ -261,8 +261,8 @@ bool OpenGLDisplay::initialize()
float scaleX = (float)theApp.fsWidth / (float)theApp.sizeX;
float scaleY = (float)theApp.fsHeight / (float)theApp.sizeY;
float min = ( scaleX < scaleY ) ? scaleX : scaleY;
if( theApp.fsMaxScale )
min = ( min > (float)theApp.fsMaxScale ) ? (float)theApp.fsMaxScale : min;
if( theApp.maxScale )
min = ( min > (float)theApp.maxScale ) ? (float)theApp.maxScale : min;
theApp.surfaceSizeX = (int)((float)theApp.sizeX * min);
theApp.surfaceSizeY = (int)((float)theApp.sizeY * min);
}
@ -310,12 +310,6 @@ bool OpenGLDisplay::initialize()
theApp.updateMenuBar();
theApp.adjustDestRect();
theApp.mode320Available = FALSE;
theApp.mode640Available = FALSE;
theApp.mode800Available = FALSE;
theApp.mode1024Available = FALSE;
theApp.mode1280Available = FALSE;
currentAdapter = theApp.fsAdapter;
DISPLAY_DEVICE dev;
@ -484,7 +478,6 @@ void OpenGLDisplay::render()
void OpenGLDisplay::resize( int w, int h )
{
initializeMatrices( w, h );
}
//update filtering methods
@ -627,8 +620,8 @@ void OpenGLDisplay::calculateDestRect( int w, int h )
float scaleX = (float)w / (float)width;
float scaleY = (float)h / (float)height;
float min = (scaleX < scaleY) ? scaleX : scaleY;
if( theApp.fsMaxScale && (min > theApp.fsMaxScale) ) {
min = (float)theApp.fsMaxScale;
if( theApp.maxScale && (min > theApp.maxScale) ) {
min = (float)theApp.maxScale;
}
destRect.left = 0;
destRect.top = 0;
@ -659,11 +652,11 @@ void OpenGLDisplay::setOption( const char *option, int value )
}
if( !_tcscmp( option, _T("maxScale") ) ) {
initializeMatrices( theApp.dest.right, theApp.dest.bottom );
initializeMatrices( theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top );
}
if( !_tcscmp( option, _T("fullScreenStretch") ) ) {
initializeMatrices( theApp.dest.right, theApp.dest.bottom );
initializeMatrices( theApp.dest.right-theApp.dest.left, theApp.dest.bottom-theApp.dest.top );
}
}

View File

@ -213,11 +213,6 @@ VBA::VBA()
}
// ! keep in mind that many of the following values will be really initialized in loadSettings()
mode320Available = false;
mode640Available = false;
mode800Available = false;
mode1024Available = false;
mode1280Available = false;
maxCpuCores = 1;
windowPositionX = 0;
windowPositionY = 0;
@ -335,7 +330,7 @@ VBA::VBA()
frameskipadjust = 0;
autoLoadMostRecent = false;
winSkipSaveGameBattery = false;
fsMaxScale = 0;
maxScale = 0;
romSize = 0;
lastWindowed = VIDEO_3X;
lastFullscreen = VIDEO_1024x768;
@ -1750,7 +1745,7 @@ void VBA::loadSettings()
cheatsEnabled = regQueryDwordValue("cheatsEnabled", false) ? true : false;
fsMaxScale = regQueryDwordValue("fsMaxScale", 0);
maxScale = regQueryDwordValue("maxScale", 0);
updateThrottle( (unsigned short)regQueryDwordValue( "throttle", 0 ) );
@ -1970,8 +1965,8 @@ void VBA::updateWindowSize(int value)
scaleX = (fsWidth / sizeX);
scaleY = (fsHeight / sizeY);
int min = scaleX < scaleY ? scaleX : scaleY;
if(fsMaxScale)
min = min > fsMaxScale ? fsMaxScale : min;
if(maxScale)
min = min > maxScale ? maxScale : min;
surfaceSizeX = min * sizeX;
surfaceSizeY = min * sizeY;
if((fullScreenStretch && (display != NULL &&
@ -2661,7 +2656,7 @@ void VBA::saveSettings()
regSetDwordValue("autoLoadMostRecent", autoLoadMostRecent);
regSetDwordValue("winSkipSaveGameBattery", winSkipSaveGameBattery);
regSetDwordValue("cheatsEnabled", cheatsEnabled);
regSetDwordValue("fsMaxScale", fsMaxScale);
regSetDwordValue("maxScale", maxScale);
regSetDwordValue("throttle", throttle);
regSetStringValue("pluginName", pluginName);
regSetDwordValue("saveMoreCPU", Sm60FPS::bSaveMoreCPU);

View File

@ -76,11 +76,6 @@ class VBA : public CWinApp
CMenu m_menu;
HMENU menu;
HMENU popup;
bool mode320Available;
bool mode640Available;
bool mode800Available;
bool mode1024Available;
bool mode1280Available;
unsigned int maxCpuCores; // maximum number of CPU cores VBA should use, 0 means auto-detect
int windowPositionX;
int windowPositionY;
@ -203,7 +198,7 @@ class VBA : public CWinApp
int frameskipadjust;
bool autoLoadMostRecent;
bool winSkipSaveGameBattery;
int fsMaxScale;
int maxScale;
int romSize;
VIDEO_SIZE lastWindowed;
VIDEO_SIZE lastFullscreen;

View File

@ -1687,41 +1687,30 @@ BEGIN
BEGIN
POPUP "Render API"
BEGIN
MENUITEM "Direct&3D", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D
MENUITEM "Direct3D 9", ID_OPTIONS_VIDEO_RENDERMETHOD_DIRECT3D
MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DNOFILTER
MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_D3DBILINEAR
MENUITEM " Motion Blur", ID_RENDERAPI_D3DMOTIONBLUR
MENUITEM SEPARATOR
MENUITEM "&OpenGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL
MENUITEM "OpenGL", ID_OPTIONS_VIDEO_RENDERMETHOD_OPENGL
MENUITEM " Filter: Nearest", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLNEAREST
MENUITEM " Filter: Bilinear", ID_OPTIONS_VIDEO_RENDEROPTIONS_GLBILINEAR
MENUITEM SEPARATOR
MENUITEM "&VSync", ID_OPTIONS_VIDEO_VSYNC
MENUITEM "VSync", ID_OPTIONS_VIDEO_VSYNC
MENUITEM "Triple Buffering", ID_OPTIONS_VIDEO_TRIPLEBUFFERING
END
MENUITEM SEPARATOR
POPUP "Windowed"
BEGIN
MENUITEM "&1x Size", ID_OPTIONS_VIDEO_X1
MENUITEM "&2x Size", ID_OPTIONS_VIDEO_X2
MENUITEM "&3x Size", ID_OPTIONS_VIDEO_X3
MENUITEM "&4x Size", ID_OPTIONS_VIDEO_X4
END
POPUP "Fullscreen"
BEGIN
MENUITEM "&Custom...", ID_OPTIONS_VIDEO_FULLSCREEN
MENUITEM SEPARATOR
MENUITEM "320x240x16", ID_OPTIONS_VIDEO_FULLSCREEN320X240
MENUITEM "640x480x16", ID_OPTIONS_VIDEO_FULLSCREEN640X480
MENUITEM "800x600x16", ID_OPTIONS_VIDEO_FULLSCREEN800X600
MENUITEM "1024x768x16", ID_OPTIONS_VIDEO_FULLSCREEN1024X768
MENUITEM "1280x1024x16", ID_OPTIONS_VIDEO_FULLSCREEN1280X1024
MENUITEM SEPARATOR
MENUITEM "&Max Scale...", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE
MENUITEM "Stretch to &fit", ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT
END
MENUITEM "1x window size", ID_OPTIONS_VIDEO_X1
MENUITEM "2x window size", ID_OPTIONS_VIDEO_X2
MENUITEM "3x window size", ID_OPTIONS_VIDEO_X3
MENUITEM "4x window size", ID_OPTIONS_VIDEO_X4
MENUITEM SEPARATOR
MENUITEM "D&isable status messages", ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES
MENUITEM "Select fullscreen mode...", ID_OPTIONS_VIDEO_FULLSCREEN
MENUITEM SEPARATOR
MENUITEM "Ignore aspect ratio", ID_OPTIONS_VIDEO_FULLSCREENSTRETCHTOFIT
MENUITEM "Maximum magnification...", ID_OPTIONS_VIDEO_FULLSCREENMAXSCALE
MENUITEM SEPARATOR
MENUITEM "Disable status messages", ID_OPTIONS_EMULATOR_DISABLESTATUSMESSAGES
END
POPUP "&Pixel Filter"
BEGIN
@ -1783,7 +1772,7 @@ BEGIN
MENUITEM "OpenAL", ID_OUTPUTAPI_OPENAL
MENUITEM " Configuration...", ID_OUTPUTAPI_OALCONFIGURATION
MENUITEM SEPARATOR
MENUITEM "DirectSound", ID_OUTPUTAPI_DIRECTSOUND
MENUITEM "DirectSound 8", ID_OUTPUTAPI_DIRECTSOUND
MENUITEM SEPARATOR
MENUITEM "&Sync game to audio", ID_OPTIONS_EMULATOR_SYNCHRONIZE
END