added NO_OGL switch
simplified fall back when initializing render API failed git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@225 a31d4220-a93d-0410-bf67-fe4944624d44
This commit is contained in:
parent
3821d13005
commit
4382e41696
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() ) {
|
||||
|
|
Loading…
Reference in New Issue