DXGL r725 - Code Review

Jump to navigation Jump to search
Repository:DXGL
Revision:r724‎ | r725 | r726 >
Date:07:36, 22 July 2017
Author:admin
Status:new
Tags:
Comment:
Fix INI boolean values.
Support overriding maximum supported OpenGL version.
Improve OpenGL version error dialog, detect RDP sessions when OpenGL version fails, and detect invalid maximum OpenGL version debug values.
Modified paths:
  • /cfgmgr/cfgmgr.c (modified) (history)
  • /ddraw/glExtensions.c (modified) (history)

Diff [purge]

Index: cfgmgr/cfgmgr.c
@@ -798,6 +798,8 @@
799799 {
800800 if (value[0] == 'F') return 0;
801801 if (value[0] == 'f') return 0;
 802+ if (value[0] == 'T') return 1;
 803+ if (value[0] == 't') return 1;
802804 if (!atoi(value)) return 0;
803805 return 1;
804806 }
Index: ddraw/glExtensions.c
@@ -17,8 +17,8 @@
1818
1919 #include "common.h"
2020 #include "glExtensions.h"
 21+extern DXGLCFG dxglcfg;
2122
22 -
2323 void glExtensions_Init(glExtensions *ext)
2424 {
2525 const GLubyte *glversion;
@@ -29,6 +29,19 @@
3030 glversion = glGetString(GL_VERSION);
3131 ext->glver_minor = 0;
3232 if(!sscanf((char*)glversion,"%d.%d",&ext->glver_major,&ext->glver_minor)) ext->glver_major = 0;
 33+ if (dxglcfg.DebugMaxGLVersionMajor)
 34+ {
 35+ if (dxglcfg.DebugMaxGLVersionMajor < ext->glver_major)
 36+ {
 37+ ext->glver_major = dxglcfg.DebugMaxGLVersionMajor;
 38+ ext->glver_minor = dxglcfg.DebugMaxGLVersionMinor;
 39+ }
 40+ else if (dxglcfg.DebugMaxGLVersionMajor == ext->glver_major)
 41+ {
 42+ if (dxglcfg.DebugMaxGLVersionMinor < ext->glver_minor)
 43+ ext->glver_minor = dxglcfg.DebugMaxGLVersionMinor;
 44+ }
 45+ }
3346 if((ext->glver_major >= 2) || ((ext->glver_major >= 1) && (ext->glver_minor >= 2)))
3447 ext->glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)wglGetProcAddress("glDrawRangeElements");
3548 if((ext->glver_major >= 2) || ((ext->glver_major >= 1) && (ext->glver_minor >= 3)))
@@ -83,9 +96,20 @@
8497 }
8598 else
8699 {
87 - MessageBox(NULL,_T("DXGL requires an OpenGL 2.0 or higher compatible graphics card to function. \
88 -Please contact your graphics card manufacturer for an updated driver. This program will now exit."),_T("Fatal error"),
89 - MB_OK|MB_ICONERROR);
 100+ if (dxglcfg.DebugMaxGLVersionMajor && (dxglcfg.DebugMaxGLVersionMajor < 2))
 101+ MessageBox(NULL, _T("An invalid debug setting has been detected. DXGL requires at least OpenGL 2.0 and the \
 102+debug settings prohibit OpenGL 2.0 support.\r\n\r\nPlease edit the DebugMaxGLVersionMajor setting to at least 2 and restart \
 103+this program.\r\n\r\nThis program will now exit."), _T("Fatal error"), MB_OK | MB_ICONERROR);
 104+ else
 105+ {
 106+ if(GetSystemMetrics(SM_REMOTESESSION))
 107+ MessageBox(NULL, _T("This program appears to be running in a remote desktop session. Since this session \
 108+does not support OpenGL 2.0 or greater, DXGL will not work.\r\n\r\nTry starting this program from a non-remote session.\r\n\r\n\
 109+This program will now exit."), _T("Fatal error"), MB_OK | MB_ICONERROR);
 110+ else MessageBox(NULL, _T("DXGL requires an OpenGL 2.0 or higher compatible graphics card to function. \
 111+Please contact your graphics card manufacturer for an updated driver.\r\n\r\nThis program will now exit."), _T("Fatal error"),
 112+ MB_OK | MB_ICONERROR);
 113+ }
90114 ExitProcess(-1);
91115 }
92116 glextensions = glGetString(GL_EXTENSIONS);