diff --git a/src/win32/MainWndOptions.cpp b/src/win32/MainWndOptions.cpp index dab65790..c120ce3c 100644 --- a/src/win32/MainWndOptions.cpp +++ b/src/win32/MainWndOptions.cpp @@ -465,20 +465,28 @@ void MainWnd::OnOptionsVideoRendermethodDirect3d() void MainWnd::OnUpdateOptionsVideoRendermethodDirect3d(CCmdUI* pCmdUI) { #ifndef NO_D3D - pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D); + pCmdUI->SetCheck(theApp.renderMethod == DIRECT_3D); +#else + pCmdUI->Enable( FALSE ); #endif } void MainWnd::OnOptionsVideoRendermethodOpengl() { +#ifndef NO_OGL theApp.renderMethod = OPENGL; theApp.updateRenderMethod(false); theApp.winAccelMgr.UpdateMenu(theApp.menu); +#endif } void MainWnd::OnUpdateOptionsVideoRendermethodOpengl(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.renderMethod == OPENGL); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.renderMethod == OPENGL); +#else + pCmdUI->Enable( FALSE ); +#endif } @@ -556,86 +564,122 @@ void MainWnd::OnUpdateOptionsVideoRenderoptionsD3dbilinear(CCmdUI* pCmdUI) void MainWnd::OnOptionsVideoRenderoptionsGlnearest() { +#ifndef NO_OGL theApp.glFilter = 0; if( theApp.display ) { theApp.display->setOption( _T("glFilter"), theApp.glFilter ); } +#endif } void MainWnd::OnUpdateOptionsVideoRenderoptionsGlnearest(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.glFilter == 0); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.glFilter == 0); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnOptionsVideoRenderoptionsGlbilinear() { +#ifndef NO_OGL theApp.glFilter = 1; if( theApp.display ) { theApp.display->setOption( _T("glFilter"), theApp.glFilter ); } +#endif } void MainWnd::OnUpdateOptionsVideoRenderoptionsGlbilinear(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.glFilter == 1); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.glFilter == 1); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnOptionsVideoRenderoptionsGltriangle() { +#ifndef NO_OGL theApp.glType = 0; if( theApp.display ) { theApp.display->setOption( _T("glType"), theApp.glType ); } +#endif } void MainWnd::OnUpdateOptionsVideoRenderoptionsGltriangle(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.glType == 0); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.glType == 0); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnOptionsVideoRenderoptionsGlquads() { +#ifndef NO_OGL theApp.glType = 1; if( theApp.display ) { theApp.display->setOption( _T("glType"), theApp.glType ); } +#endif } void MainWnd::OnUpdateOptionsVideoRenderoptionsGlquads(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.glType == 1); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.glType == 1); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnOptionsVideoRenderoptionsGlpolygons() { +#ifndef NO_OGL theApp.glType = 2; if( theApp.display ) { theApp.display->setOption( _T("glType"), theApp.glType ); } +#endif } void MainWnd::OnUpdateOptionsVideoRenderoptionsGlpolygons(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.glType == 2); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.glType == 2); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnUpdateOptionsVideoRenderingoptionsGLSLShaders(CCmdUI* pCmdUI) { - pCmdUI->SetCheck(theApp.GLSLShaders); +#ifndef NO_OGL + pCmdUI->SetCheck(theApp.GLSLShaders); +#else + pCmdUI->Enable( FALSE ); +#endif } void MainWnd::OnOptionsVideoRenderingoptionsGLSLShaders() { +#ifndef NO_OGL theApp.GLSLShaders = !theApp.GLSLShaders; if( theApp.GLSLShaders ) { theApp.display->setOption( _T("GLSLShaders"), theApp.GLSLShaders ); } +#endif } void MainWnd::OnOptionsEmulatorAssociate() @@ -2000,6 +2044,8 @@ void MainWnd::OnUpdateOutputapiOpenal(CCmdUI *pCmdUI) #ifndef NO_OAL pCmdUI->SetCheck( ( theApp.audioAPI == OPENAL_SOUND ) ? 1 : 0 ); pCmdUI->Enable(!theApp.aviRecording && !theApp.soundRecording); +#else + pCmdUI->Enable( FALSE ); #endif } @@ -2034,5 +2080,7 @@ void MainWnd::OnUpdateOutputapiOalconfiguration(CCmdUI *pCmdUI) { #ifndef NO_OAL pCmdUI->Enable(!theApp.aviRecording && !theApp.soundRecording); +#else + pCmdUI->Enable( FALSE ); #endif } diff --git a/src/win32/OpenGL.cpp b/src/win32/OpenGL.cpp index 5dcfbdee..736bb82a 100644 --- a/src/win32/OpenGL.cpp +++ b/src/win32/OpenGL.cpp @@ -17,6 +17,8 @@ // along with this program; if not, write to the Free Software Foundation, // Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +#ifndef NO_OGL + #include "stdafx.h" #include "MainWnd.h" @@ -684,3 +686,5 @@ IDisplay *newOpenGLDisplay() { return new OpenGLDisplay(); } + +#endif // #ifndef NO_OGL diff --git a/src/win32/VBA.cpp b/src/win32/VBA.cpp index b0ee364d..7f096bb7 100644 --- a/src/win32/VBA.cpp +++ b/src/win32/VBA.cpp @@ -101,7 +101,9 @@ extern void toolsLog(const char *); extern IDisplay *newGDIDisplay(); extern IDisplay *newDirectDrawDisplay(); +#ifndef NO_OGL extern IDisplay *newOpenGLDisplay(); +#endif #ifndef NO_D3D extern IDisplay *newDirect3DDisplay(); #endif @@ -1445,7 +1447,10 @@ void VBA::loadSettings() } renderMethod = (DISPLAY_TYPE)regQueryDwordValue("renderMethod", DIRECT_DRAW); - if( ( renderMethod != DIRECT_DRAW ) && ( renderMethod != OPENGL ) + if( ( renderMethod != DIRECT_DRAW ) +#ifndef NO_OGL + && ( renderMethod != OPENGL ) +#endif #ifndef NO_D3D && ( renderMethod != DIRECT_3D ) #endif @@ -2121,34 +2126,19 @@ bool VBA::preInitialize() bool VBA::updateRenderMethod(bool force) { - Sm60FPS_Init(); - bool res = updateRenderMethod0(force); + bool ret = true; - while(!res && renderMethod > 0) { - if( fsAdapter > 0 ) { - fsAdapter = 0; - } else { - if( videoOption > VIDEO_4X ) { - videoOption = VIDEO_1X; - force = true; - } else { - if(renderMethod == OPENGL) { -#ifndef NO_D3D - renderMethod = DIRECT_3D; - } else { - if(renderMethod == DIRECT_3D) { -#endif - renderMethod = DIRECT_DRAW; - } - } - } -#ifndef NO_D3D - } -#endif - res = updateRenderMethod(force); + Sm60FPS_Init(); + + if( !updateRenderMethod0( force ) ) { + // fall back to safe configuration + renderMethod = DIRECT_DRAW; + fsAdapter = 0; + videoOption = VIDEO_1X; + ret = updateRenderMethod( true ); } - return res; + return ret; } @@ -2183,19 +2173,22 @@ bool VBA::updateRenderMethod0(bool force) } if(display == NULL) { switch(renderMethod) { - case DIRECT_DRAW: - pVideoDriverGUID = NULL; - ZeroMemory( &videoDriverGUID, sizeof( GUID ) ); - display = newDirectDrawDisplay(); - break; +#ifndef NO_OGL case OPENGL: display = newOpenGLDisplay(); break; +#endif #ifndef NO_D3D case DIRECT_3D: display = newDirect3DDisplay(); break; #endif + case DIRECT_DRAW: + default: + pVideoDriverGUID = NULL; + ZeroMemory( &videoDriverGUID, sizeof( GUID ) ); + display = newDirectDrawDisplay(); + break; } if( preInitialize() ) {