From 2e346a8ce0765485d37578a7af91b68ba05016fd Mon Sep 17 00:00:00 2001 From: spacy51 Date: Wed, 17 Sep 2008 19:19:08 +0000 Subject: [PATCH] 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 --- src/win32/Direct3D.cpp | 34 ++----------------- src/win32/MainWnd.cpp | 10 ------ src/win32/MainWnd.h | 10 ------ src/win32/MainWndOptions.cpp | 63 +----------------------------------- src/win32/MaxScale.cpp | 4 +-- src/win32/OpenGL.cpp | 21 ++++-------- src/win32/VBA.cpp | 15 +++------ src/win32/VBA.h | 7 +--- src/win32/VBA.rc | 39 ++++++++-------------- 9 files changed, 33 insertions(+), 170 deletions(-) diff --git a/src/win32/Direct3D.cpp b/src/win32/Direct3D.cpp index 7f0e69c7..26f68229 100644 --- a/src/win32/Direct3D.cpp +++ b/src/win32/Direct3D.cpp @@ -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; iEnumAdapterModes(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; diff --git a/src/win32/MainWnd.cpp b/src/win32/MainWnd.cpp index 04f81772..38ae1658 100644 --- a/src/win32/MainWnd.cpp +++ b/src/win32/MainWnd.cpp @@ -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) diff --git a/src/win32/MainWnd.h b/src/win32/MainWnd.h index 557d2ec9..2838860f 100644 --- a/src/win32/MainWnd.h +++ b/src/win32/MainWnd.h @@ -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) ; diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index c3ab0393..810d1fa8 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -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 ); } } diff --git a/src/win32/MaxScale.cpp b/src/win32/MaxScale.cpp index 4b9d77b6..d4528168 100644 --- a/src/win32/MaxScale.cpp +++ b/src/win32/MaxScale.cpp @@ -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); diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp index 021d98bb..513b155a 100644 --- a/src/win32/OpenGL.cpp +++ b/src/win32/OpenGL.cpp @@ -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; @@ -483,8 +477,7 @@ void OpenGLDisplay::render() //resize screen void OpenGLDisplay::resize( int w, int h ) { - initializeMatrices( w, 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 ); } } diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index 8ccf4887..6fe7fd0c 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -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); diff --git a/src/win32/VBA.h b/src/win32/VBA.h index 8ea7899e..1e25cb4c 100644 --- a/src/win32/VBA.h +++ b/src/win32/VBA.h @@ -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; diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index 4dd03d2a..8c82ede4 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -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