Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -1,1253 +0,0 @@ |
2 | | -// DXGL
|
3 | | -// Copyright (C) 2011-2014 William Feely
|
4 | | -
|
5 | | -// This library is free software; you can redistribute it and/or
|
6 | | -// modify it under the terms of the GNU Lesser General Public
|
7 | | -// License as published by the Free Software Foundation; either
|
8 | | -// version 2.1 of the License, or (at your option) any later version.
|
9 | | -
|
10 | | -// This library is distributed in the hope that it will be useful,
|
11 | | -// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 | | -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13 | | -// Lesser General Public License for more details.
|
14 | | -
|
15 | | -// You should have received a copy of the GNU Lesser General Public
|
16 | | -// License along with this library; if not, write to the Free Software
|
17 | | -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
18 | | -
|
19 | | -#define _WIN32_WINNT 0x0600
|
20 | | -#define _WIN32_IE 0x0300
|
21 | | -#define _CRT_SECURE_NO_WARNINGS
|
22 | | -#include <windows.h>
|
23 | | -#include <HtmlHelp.h>
|
24 | | -#include <CommCtrl.h>
|
25 | | -#include <tchar.h>
|
26 | | -#include <stdio.h>
|
27 | | -#include <io.h>
|
28 | | -#include "resource.h"
|
29 | | -#include "../cfgmgr/cfgmgr.h"
|
30 | | -#include <gl/GL.h>
|
31 | | -#include <string>
|
32 | | -
|
33 | | -using namespace std;
|
34 | | -#ifdef _UNICODE
|
35 | | -typedef wstring tstring;
|
36 | | -#else
|
37 | | -typedef string tstring;
|
38 | | -#endif
|
39 | | -
|
40 | | -#ifndef SHGFI_ADDOVERLAYS
|
41 | | -#define SHGFI_ADDOVERLAYS 0x000000020
|
42 | | -#endif //SHGFI_ADDOVERLAYS
|
43 | | -
|
44 | | -#ifndef BCM_SETSHIELD
|
45 | | -#define BCM_SETSHIELD 0x160C
|
46 | | -#endif
|
47 | | -
|
48 | | -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
49 | | -#define GL_MAX_SAMPLES_EXT 0x8D57
|
50 | | -#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
|
51 | | -#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
|
52 | | -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
53 | | -
|
54 | | -DXGLCFG *cfg;
|
55 | | -DXGLCFG *cfgmask;
|
56 | | -bool *dirty;
|
57 | | -HINSTANCE hinstance;
|
58 | | -bool msaa = false;
|
59 | | -const char *extensions_string = NULL;
|
60 | | -OSVERSIONINFO osver;
|
61 | | -TCHAR hlppath[MAX_PATH+16];
|
62 | | -
|
63 | | -typedef struct
|
64 | | -{
|
65 | | - tstring *regkey;
|
66 | | - tstring *name;
|
67 | | - HICON icon;
|
68 | | - bool icon_shared;
|
69 | | - bool dirty;
|
70 | | - DXGLCFG cfg;
|
71 | | - DXGLCFG mask;
|
72 | | -} app_setting;
|
73 | | -
|
74 | | -TCHAR exe_filter[] = _T("Program Files\0*.exe\0All Files\0*.*\0\0");
|
75 | | -
|
76 | | -app_setting *apps;
|
77 | | -int appcount;
|
78 | | -int maxapps;
|
79 | | -DWORD current_app;
|
80 | | -bool tristate;
|
81 | | -TCHAR strdefault[] = _T("(global default)");
|
82 | | -
|
83 | | -DWORD AddApp(LPCTSTR path, bool copyfile, bool admin)
|
84 | | -{
|
85 | | - bool installed = false;
|
86 | | - bool dxgl_installdir = false;
|
87 | | - bool old_dxgl = false;
|
88 | | - tstring command;
|
89 | | - if(copyfile)
|
90 | | - {
|
91 | | - DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
|
92 | | - TCHAR installpath[MAX_PATH+1];
|
93 | | - TCHAR srcpath[MAX_PATH+1];
|
94 | | - TCHAR destpath[MAX_PATH+1];
|
95 | | - HKEY hKeyInstall;
|
96 | | - LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
|
97 | | - if(error == ERROR_SUCCESS)
|
98 | | - {
|
99 | | - dxgl_installdir = true;
|
100 | | - error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
101 | | - if(error == ERROR_SUCCESS) installed = true;
|
102 | | - }
|
103 | | - if(hKeyInstall) RegCloseKey(hKeyInstall);
|
104 | | - if(!installed)
|
105 | | - {
|
106 | | - GetModuleFileName(NULL,installpath,MAX_PATH+1);
|
107 | | - }
|
108 | | - if(dxgl_installdir) _tcscat(installpath,_T("\\"));
|
109 | | - else (_tcsrchr(installpath,_T('\\')))[1] = 0;
|
110 | | - _tcsncpy(srcpath,installpath,MAX_PATH+1);
|
111 | | - _tcscat(srcpath,_T("ddraw.dll"));
|
112 | | - _tcsncpy(destpath,path,MAX_PATH+1);
|
113 | | - (_tcsrchr(destpath,_T('\\')))[1] = 0;
|
114 | | - _tcscat(destpath,_T("ddraw.dll"));
|
115 | | - error = CopyFile(srcpath,destpath,TRUE);
|
116 | | - error_loop:
|
117 | | - if(!error)
|
118 | | - {
|
119 | | - error = GetLastError();
|
120 | | - if(error == ERROR_FILE_EXISTS)
|
121 | | - {
|
122 | | - HMODULE hmod = LoadLibrary(destpath);
|
123 | | - if(hmod)
|
124 | | - {
|
125 | | - if(GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = true;
|
126 | | - FreeLibrary(hmod);
|
127 | | - }
|
128 | | - if(old_dxgl)
|
129 | | - {
|
130 | | - error = CopyFile(srcpath,destpath,FALSE);
|
131 | | - goto error_loop;
|
132 | | - }
|
133 | | - }
|
134 | | - if((error == ERROR_ACCESS_DENIED) && !admin)
|
135 | | - {
|
136 | | - command.assign(_T(" install "));
|
137 | | - command.append(path);
|
138 | | - SHELLEXECUTEINFO shex;
|
139 | | - ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
140 | | - shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
141 | | - shex.lpVerb = _T("runas");
|
142 | | - shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
143 | | - _tcscat(installpath,_T("\\dxglcfg.exe"));
|
144 | | - shex.lpFile = installpath;
|
145 | | - shex.lpParameters = command.c_str();
|
146 | | - ShellExecuteEx(&shex);
|
147 | | - WaitForSingleObject(shex.hProcess,INFINITE);
|
148 | | - DWORD exitcode;
|
149 | | - GetExitCodeProcess(shex.hProcess,&exitcode);
|
150 | | - return exitcode;
|
151 | | - }
|
152 | | - return error;
|
153 | | - }
|
154 | | - }
|
155 | | - return 0;
|
156 | | -}
|
157 | | -
|
158 | | -DWORD DelApp(LPCTSTR path, bool admin)
|
159 | | -{
|
160 | | - bool installed = false;
|
161 | | - tstring command;
|
162 | | - bool old_dxgl = true;
|
163 | | - DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
|
164 | | - TCHAR installpath[MAX_PATH+1];
|
165 | | - HKEY hKeyInstall;
|
166 | | - LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
|
167 | | - if(error == ERROR_SUCCESS)
|
168 | | - {
|
169 | | - error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
170 | | - if(error == ERROR_SUCCESS) installed = true;
|
171 | | - }
|
172 | | - if(hKeyInstall) RegCloseKey(hKeyInstall);
|
173 | | - if(!installed)
|
174 | | - {
|
175 | | - GetModuleFileName(NULL,installpath,MAX_PATH+1);
|
176 | | - }
|
177 | | - HMODULE hmod = LoadLibrary(path);
|
178 | | - if(hmod)
|
179 | | - {
|
180 | | - if(!GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = false;
|
181 | | - FreeLibrary(hmod);
|
182 | | - }
|
183 | | - if(!old_dxgl) return 0;
|
184 | | - if(!DeleteFile(path))
|
185 | | - {
|
186 | | - error = GetLastError();
|
187 | | - if(error == ERROR_FILE_NOT_FOUND) return 0;
|
188 | | - if((error == ERROR_ACCESS_DENIED) && !admin)
|
189 | | - {
|
190 | | - command.assign(_T(" remove "));
|
191 | | - command.append(path);
|
192 | | - SHELLEXECUTEINFO shex;
|
193 | | - ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
194 | | - shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
195 | | - shex.lpVerb = _T("runas");
|
196 | | - shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
197 | | - _tcscat(installpath,_T("\\dxglcfg.exe"));
|
198 | | - shex.lpFile = installpath;
|
199 | | - shex.lpParameters = command.c_str();
|
200 | | - ShellExecuteEx(&shex);
|
201 | | - WaitForSingleObject(shex.hProcess,INFINITE);
|
202 | | - DWORD exitcode;
|
203 | | - GetExitCodeProcess(shex.hProcess,&exitcode);
|
204 | | - return exitcode;
|
205 | | - }
|
206 | | - return error;
|
207 | | - }
|
208 | | - return 0;
|
209 | | -}
|
210 | | -
|
211 | | -void SaveChanges(HWND hWnd)
|
212 | | -{
|
213 | | - if(apps[0].dirty) SetGlobalConfig(&apps[0].cfg);
|
214 | | - for(int i = 1; i < appcount; i++)
|
215 | | - {
|
216 | | - if(apps[i].dirty) SetConfig(&apps[i].cfg,&apps[i].mask,apps[i].regkey->c_str());
|
217 | | - }
|
218 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),FALSE);
|
219 | | -}
|
220 | | -
|
221 | | -void FloatToAspect(float f, LPTSTR aspect)
|
222 | | -{
|
223 | | - float integer;
|
224 | | - float dummy;
|
225 | | - TCHAR denominator[5];
|
226 | | - if (f >= 1000.0f) // Clamp ridiculously wide aspects
|
227 | | - {
|
228 | | - _tcscpy(aspect, _T("1000:1"));
|
229 | | - return;
|
230 | | - }
|
231 | | - if (f < 0.001f) // Exclude ridiculously tall aspects, zero, and negative
|
232 | | - {
|
233 | | - _tcscpy(aspect, _T("Default"));
|
234 | | - return;
|
235 | | - }
|
236 | | - // Handle common aspects
|
237 | | - if (abs(f - 1.25f) < 0.0001f)
|
238 | | - {
|
239 | | - _tcscpy(aspect, _T("5:4"));
|
240 | | - return;
|
241 | | - }
|
242 | | - if (abs(f - 1.3333333f) < 0.0001f)
|
243 | | - {
|
244 | | - _tcscpy(aspect, _T("4:3"));
|
245 | | - return;
|
246 | | - }
|
247 | | - if (abs(f - 1.6f) < 0.0001f)
|
248 | | - {
|
249 | | - _tcscpy(aspect, _T("16:10"));
|
250 | | - return;
|
251 | | - }
|
252 | | - if (abs(f - 1.7777777) < 0.0001f)
|
253 | | - {
|
254 | | - _tcscpy(aspect, _T("16:9"));
|
255 | | - return;
|
256 | | - }
|
257 | | - if (abs(f - 1.9333333) < 0.0001f)
|
258 | | - {
|
259 | | - _tcscpy(aspect, _T("256:135"));
|
260 | | - return;
|
261 | | - }
|
262 | | - float fract = modf(f, &integer);
|
263 | | - if (fract < 0.0001f) //Handle integer aspects
|
264 | | - {
|
265 | | - _itot((int)integer, aspect, 10);
|
266 | | - _tcscat(aspect, _T(":1"));
|
267 | | - return;
|
268 | | - }
|
269 | | - // Finally try from 2 to 1000
|
270 | | - for (int i = 2; i < 1000; i++)
|
271 | | - {
|
272 | | - if (abs(modf(fract*i, &dummy)) < 0.0001f)
|
273 | | - {
|
274 | | - _itot((f*i) + .5f, aspect, 10);
|
275 | | - _itot(i, denominator, 10);
|
276 | | - _tcscat(aspect, _T(":"));
|
277 | | - _tcscat(aspect, denominator);
|
278 | | - return;
|
279 | | - }
|
280 | | - }
|
281 | | - // Cannot find a reasonable fractional aspect, so display as decimal.
|
282 | | - _stprintf(aspect, _T("%.6f"), f);
|
283 | | -}
|
284 | | -
|
285 | | -void SetCheck(HWND hWnd, int DlgItem, BOOL value, BOOL mask, bool tristate)
|
286 | | -{
|
287 | | - if(tristate && !mask)
|
288 | | - SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_INDETERMINATE,0);
|
289 | | - else
|
290 | | - {
|
291 | | - if(value) SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_CHECKED,0);
|
292 | | - else SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_UNCHECKED,0);
|
293 | | - }
|
294 | | -}
|
295 | | -
|
296 | | -void SetCombo(HWND hWnd, int DlgItem, DWORD value, DWORD mask, bool tristate)
|
297 | | -{
|
298 | | - if(tristate && !mask)
|
299 | | - SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
|
300 | | - SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
301 | | - else
|
302 | | - SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,value,0);
|
303 | | -}
|
304 | | -
|
305 | | -void SetAspectCombo(HWND hWnd, int DlgItem, float value, DWORD mask, bool tristate)
|
306 | | -{
|
307 | | - TCHAR buffer[32];
|
308 | | - if (tristate && !mask)
|
309 | | - SendDlgItemMessage(hWnd, DlgItem, CB_SETCURSEL,
|
310 | | - SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
311 | | - else
|
312 | | - {
|
313 | | - FloatToAspect(value, buffer);
|
314 | | - SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
|
315 | | - SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)buffer), 0);
|
316 | | - SetDlgItemText(hWnd, DlgItem, buffer);
|
317 | | - }
|
318 | | -
|
319 | | -}
|
320 | | -
|
321 | | -void SetText(HWND hWnd, int DlgItem, TCHAR *value, TCHAR *mask, bool tristate)
|
322 | | -{
|
323 | | - if(tristate && (mask[0] == 0))
|
324 | | - SetWindowText(GetDlgItem(hWnd,DlgItem),_T(""));
|
325 | | - else SetWindowText(GetDlgItem(hWnd,DlgItem),value);
|
326 | | -}
|
327 | | -
|
328 | | -bool GetCheck(HWND hWnd, int DlgItem, BOOL &mask)
|
329 | | -{
|
330 | | - int check = SendDlgItemMessage(hWnd,DlgItem,BM_GETCHECK,0,0);
|
331 | | - switch(check)
|
332 | | - {
|
333 | | - case BST_CHECKED:
|
334 | | - mask = TRUE;
|
335 | | - return true;
|
336 | | - case BST_UNCHECKED:
|
337 | | - mask = TRUE;
|
338 | | - return false;
|
339 | | - case BST_INDETERMINATE:
|
340 | | - default:
|
341 | | - mask = FALSE;
|
342 | | - return false;
|
343 | | - }
|
344 | | -}
|
345 | | -
|
346 | | -DWORD GetCombo(HWND hWnd, int DlgItem, DWORD &mask)
|
347 | | -{
|
348 | | - int value = SendDlgItemMessage(hWnd,DlgItem,CB_GETCURSEL,0,0);
|
349 | | - if(value == SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault))
|
350 | | - {
|
351 | | - mask = 0;
|
352 | | - return 0;
|
353 | | - }
|
354 | | - else
|
355 | | - {
|
356 | | - mask = 1;
|
357 | | - return value;
|
358 | | - }
|
359 | | -}
|
360 | | -
|
361 | | -float GetAspectCombo(HWND hWnd, int DlgItem, float &mask)
|
362 | | -{
|
363 | | - TCHAR buffer[32];
|
364 | | - TCHAR *ptr;
|
365 | | - float numerator, denominator;
|
366 | | - GetDlgItemText(hWnd, DlgItem, buffer, 31);
|
367 | | - if (!_tcscmp(buffer, strdefault))
|
368 | | - {
|
369 | | - mask = 0.0f;
|
370 | | - return 0;
|
371 | | - }
|
372 | | - else
|
373 | | - {
|
374 | | - mask = 1.0f;
|
375 | | - if (!_tcscmp(buffer, _T("Default"))) return 0.0f;
|
376 | | - else
|
377 | | - {
|
378 | | - // Check for colon
|
379 | | - ptr = _tcsstr(buffer, _T(":"));
|
380 | | - if (ptr)
|
381 | | - {
|
382 | | - *ptr = 0;
|
383 | | - numerator = _ttof(buffer);
|
384 | | - denominator = _ttof(ptr + 1);
|
385 | | - return numerator / denominator;
|
386 | | - }
|
387 | | - else return _ttof(buffer);
|
388 | | - }
|
389 | | - }
|
390 | | -}
|
391 | | -
|
392 | | -void GetText(HWND hWnd, int DlgItem, TCHAR *str, TCHAR *mask)
|
393 | | -{
|
394 | | - GetDlgItemText(hWnd,DlgItem,str,MAX_PATH+1);
|
395 | | - if(str[0] == 0) mask[0] = 0;
|
396 | | - else mask[0] = 0xff;
|
397 | | -}
|
398 | | -
|
399 | | -LRESULT CALLBACK DXGLCfgCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
400 | | -{
|
401 | | - PIXELFORMATDESCRIPTOR pfd =
|
402 | | - {
|
403 | | - sizeof(PIXELFORMATDESCRIPTOR),
|
404 | | - 1,
|
405 | | - PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags
|
406 | | - PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette.
|
407 | | - 0, //Colordepth of the framebuffer.
|
408 | | - 0, 0, 0, 0, 0, 0,
|
409 | | - 0,
|
410 | | - 0,
|
411 | | - 0,
|
412 | | - 0, 0, 0, 0,
|
413 | | - 24, //Number of bits for the depthbuffer
|
414 | | - 8, //Number of bits for the stencilbuffer
|
415 | | - 0, //Number of Aux buffers in the framebuffer.
|
416 | | - PFD_MAIN_PLANE,
|
417 | | - 0,
|
418 | | - 0, 0, 0
|
419 | | - };
|
420 | | - GLfloat anisotropic;
|
421 | | - HDC dc;
|
422 | | - HGLRC rc;
|
423 | | - GLint maxsamples;
|
424 | | - GLint maxcoverage = 0;
|
425 | | - GLint coveragemodes[64];
|
426 | | - int msaamodes[32];
|
427 | | - int pf;
|
428 | | - int i;
|
429 | | - HKEY hKeyBase;
|
430 | | - HKEY hKey;
|
431 | | - DWORD keysize,keysize2;
|
432 | | - DEVMODE mode;
|
433 | | - LPTSTR keyname;
|
434 | | - LPTSTR regbuffer;
|
435 | | - DWORD regbuffersize;
|
436 | | - DWORD regbufferpos;
|
437 | | - DWORD buffersize;
|
438 | | - LONG error;
|
439 | | - TCHAR buffer[64];
|
440 | | - tstring subkey;
|
441 | | - tstring path;
|
442 | | - SHFILEINFO fileinfo;
|
443 | | - DWORD verinfosize;
|
444 | | - LPTSTR outbuffer;
|
445 | | - UINT outlen;
|
446 | | - TCHAR verpath[64];
|
447 | | - WORD translation[2];
|
448 | | - DWORD cursel;
|
449 | | - DRAWITEMSTRUCT* drawitem = (DRAWITEMSTRUCT*)lParam;
|
450 | | - bool hasname;
|
451 | | - void *verinfo;
|
452 | | - COLORREF OldTextColor,OldBackColor;
|
453 | | - HANDLE token = NULL;
|
454 | | - TOKEN_ELEVATION elevation;
|
455 | | - HWND hGLWnd;
|
456 | | - switch(Msg)
|
457 | | - {
|
458 | | - case WM_INITDIALOG:
|
459 | | - tristate = false;
|
460 | | - maxapps = 128;
|
461 | | - apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
|
462 | | - apps[0].name = new tstring(_T("Global"));
|
463 | | - apps[0].regkey = new tstring(_T("Global"));
|
464 | | - GetGlobalConfig(&apps[0].cfg, false);
|
465 | | - cfg = &apps[0].cfg;
|
466 | | - cfgmask = &apps[0].mask;
|
467 | | - dirty = &apps[0].dirty;
|
468 | | - memset(&apps[0].mask,0xff,sizeof(DXGLCFG));
|
469 | | - apps[0].dirty = false;
|
470 | | - apps[0].icon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_STAR));
|
471 | | - apps[0].icon_shared = true;
|
472 | | - SetClassLong(hWnd,GCL_HICON,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGL));
|
473 | | - SetClassLong(hWnd,GCL_HICONSM,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGLSM));
|
474 | | - // create temporary gl context to get AA and AF settings.
|
475 | | - EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&mode);
|
476 | | - pfd.cColorBits = (BYTE)mode.dmBitsPerPel;
|
477 | | - hGLWnd = CreateWindow(_T("STATIC"),NULL,WS_CHILD,0,0,16,16,hWnd,NULL,NULL,NULL);
|
478 | | - dc = GetDC(hGLWnd);
|
479 | | - pf = ChoosePixelFormat(dc,&pfd);
|
480 | | - SetPixelFormat(dc,pf,&pfd);
|
481 | | - rc = wglCreateContext(dc);
|
482 | | - wglMakeCurrent(dc,rc);
|
483 | | - extensions_string = (char*)glGetString(GL_EXTENSIONS);
|
484 | | - if(strstr(extensions_string,"GL_EXT_texture_filter_anisotropic"))
|
485 | | - glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&anisotropic);
|
486 | | - else anisotropic = 0;
|
487 | | - if(strstr(extensions_string,"GL_EXT_framebuffer_multisample"))
|
488 | | - {
|
489 | | - glGetIntegerv(GL_MAX_SAMPLES_EXT,&maxsamples);
|
490 | | - if(strstr(extensions_string,"GL_NV_framebuffer_multisample_coverage")) // Supports NVIDIA CSAA
|
491 | | - {
|
492 | | - glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV,&maxcoverage);
|
493 | | - glGetIntegerv(GL_MULTISAMPLE_COVERAGE_MODES_NV,coveragemodes);
|
494 | | - if(maxcoverage) for(i = 0; i < maxcoverage; i++)
|
495 | | - {
|
496 | | - msaamodes[i] = coveragemodes[2*i]+(4096*coveragemodes[(2*i)+1]);
|
497 | | - msaa = true;
|
498 | | - }
|
499 | | - }
|
500 | | - }
|
501 | | - wglMakeCurrent(dc,NULL);
|
502 | | - wglDeleteContext(rc);
|
503 | | - ReleaseDC(hGLWnd,dc);
|
504 | | - DestroyWindow(hGLWnd);
|
505 | | - // Load global settings.
|
506 | | - // scaler
|
507 | | - _tcscpy(buffer,_T("Change desktop resolution"));
|
508 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)buffer);
|
509 | | - _tcscpy(buffer,_T("Stretch to screen"));
|
510 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,1,(LPARAM)buffer);
|
511 | | - _tcscpy(buffer,_T("Aspect corrected stretch"));
|
512 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,2,(LPARAM)buffer);
|
513 | | - _tcscpy(buffer,_T("Center image on screen"));
|
514 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,3,(LPARAM)buffer);
|
515 | | - _tcscpy(buffer,_T("Stretch if mode not found"));
|
516 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,4,(LPARAM)buffer);
|
517 | | - _tcscpy(buffer,_T("Scale if mode not found"));
|
518 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,5,(LPARAM)buffer);
|
519 | | - _tcscpy(buffer,_T("Center if mode not found"));
|
520 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,6,(LPARAM)buffer);
|
521 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_SETCURSEL,cfg->scaler,0);
|
522 | | - // colormode
|
523 | | - if(cfg->colormode) SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_CHECKED,0);
|
524 | | - else SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_UNCHECKED,0);
|
525 | | - // scalingfilter
|
526 | | - _tcscpy(buffer,_T("Nearest"));
|
527 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
528 | | - _tcscpy(buffer,_T("Bilinear"));
|
529 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
530 | | - _tcscpy(buffer,_T("Custom shader"));
|
531 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
532 | | - _tcscpy(buffer,_T("Shader (primary only)"));
|
533 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,3,(LPARAM)buffer);
|
534 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_SETCURSEL,cfg->scalingfilter,0);
|
535 | | - // aspect
|
536 | | - _tcscpy(buffer,_T("Default"));
|
537 | | - SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
538 | | - _tcscpy(buffer,_T("4:3"));
|
539 | | - SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
540 | | - _tcscpy(buffer,_T("16:10"));
|
541 | | - SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
542 | | - _tcscpy(buffer,_T("16:9"));
|
543 | | - SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
544 | | - _tcscpy(buffer,_T("5:4"));
|
545 | | - SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
546 | | - SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
547 | | -
|
548 | | - // highres
|
549 | | - if(cfg->highres) SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_CHECKED,0);
|
550 | | - else SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_UNCHECKED,0);
|
551 | | - // texfilter
|
552 | | - _tcscpy(buffer,_T("Application default"));
|
553 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)buffer);
|
554 | | - _tcscpy(buffer,_T("Nearest"));
|
555 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,1,(LPARAM)buffer);
|
556 | | - _tcscpy(buffer,_T("Bilinear"));
|
557 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,2,(LPARAM)buffer);
|
558 | | - _tcscpy(buffer,_T("Nearest, nearest mipmap"));
|
559 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,3,(LPARAM)buffer);
|
560 | | - _tcscpy(buffer,_T("Nearest, linear mipmap"));
|
561 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,4,(LPARAM)buffer);
|
562 | | - _tcscpy(buffer,_T("Bilinear, nearest mipmap"));
|
563 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,5,(LPARAM)buffer);
|
564 | | - _tcscpy(buffer,_T("Bilinear, linear mipmap"));
|
565 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,6,(LPARAM)buffer);
|
566 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_SETCURSEL,cfg->texfilter,0);
|
567 | | - // anisotropic
|
568 | | - if (anisotropic < 2)
|
569 | | - {
|
570 | | - _tcscpy(buffer,_T("Not supported"));
|
571 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
|
572 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,0,0);
|
573 | | - EnableWindow(GetDlgItem(hWnd,IDC_ANISO),FALSE);
|
574 | | - cfg->anisotropic = 0;
|
575 | | - }
|
576 | | - else
|
577 | | - {
|
578 | | - _tcscpy(buffer,_T("Application default"));
|
579 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
|
580 | | - _tcscpy(buffer,_T("Disabled"));
|
581 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,1,(LPARAM)buffer);
|
582 | | - if(anisotropic >= 2)
|
583 | | - {
|
584 | | - _tcscpy(buffer,_T("2x"));
|
585 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,2,(LPARAM)buffer);
|
586 | | - }
|
587 | | - if(anisotropic >= 4)
|
588 | | - {
|
589 | | - _tcscpy(buffer,_T("4x"));
|
590 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
|
591 | | - }
|
592 | | - if(anisotropic >= 8)
|
593 | | - {
|
594 | | - _tcscpy(buffer,_T("8x"));
|
595 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,8,(LPARAM)buffer);
|
596 | | - }
|
597 | | - if(anisotropic >= 16)
|
598 | | - {
|
599 | | - _tcscpy(buffer,_T("16x"));
|
600 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,16,(LPARAM)buffer);
|
601 | | - }
|
602 | | - if(anisotropic >= 32)
|
603 | | - {
|
604 | | - _tcscpy(buffer,_T("32x"));
|
605 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
|
606 | | - }
|
607 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,cfg->anisotropic,0);
|
608 | | - }
|
609 | | - // msaa
|
610 | | - if(msaa)
|
611 | | - {
|
612 | | - _tcscpy(buffer,_T("Application default"));
|
613 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
|
614 | | - _tcscpy(buffer,_T("Disabled"));
|
615 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,1,(LPARAM)buffer);
|
616 | | - if(maxcoverage)
|
617 | | - {
|
618 | | - for(i = 0; i < maxcoverage; i++)
|
619 | | - {
|
620 | | - if((msaamodes[i] & 0xfff) <= 4)
|
621 | | - _sntprintf(buffer,64,_T("%dx"),msaamodes[i] & 0xfff);
|
622 | | - else _sntprintf(buffer,64,_T("%dx coverage, %dx color"),(msaamodes[i] & 0xfff), (msaamodes[i] >> 12));
|
623 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,msaamodes[i],(LPARAM)buffer);
|
624 | | - }
|
625 | | - }
|
626 | | - else
|
627 | | - {
|
628 | | - if(maxsamples >= 2)
|
629 | | - {
|
630 | | - _tcscpy(buffer,_T("2x"));
|
631 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,2,(LPARAM)buffer);
|
632 | | - }
|
633 | | - if(maxsamples >= 4)
|
634 | | - {
|
635 | | - _tcscpy(buffer,_T("4x"));
|
636 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,4,(LPARAM)buffer);
|
637 | | - }
|
638 | | - if(maxsamples >= 8)
|
639 | | - {
|
640 | | - _tcscpy(buffer,_T("8x"));
|
641 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,8,(LPARAM)buffer);
|
642 | | - }
|
643 | | - if(maxsamples >= 16)
|
644 | | - {
|
645 | | - _tcscpy(buffer,_T("16x"));
|
646 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,16,(LPARAM)buffer);
|
647 | | - }
|
648 | | - if(maxsamples >= 32)
|
649 | | - {
|
650 | | - _tcscpy(buffer,_T("32x"));
|
651 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,32,(LPARAM)buffer);
|
652 | | - }
|
653 | | - }
|
654 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,cfg->msaa,0);
|
655 | | - }
|
656 | | - else
|
657 | | - {
|
658 | | - _tcscpy(buffer,_T("Not supported"));
|
659 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
|
660 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,0,0);
|
661 | | - EnableWindow(GetDlgItem(hWnd,IDC_MSAA),FALSE);
|
662 | | - cfg->msaa = 0;
|
663 | | - }
|
664 | | - // aspect3d
|
665 | | - _tcscpy(buffer,_T("Stretch to display"));
|
666 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)buffer);
|
667 | | - _tcscpy(buffer,_T("Expand viewable area"));
|
668 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,1,(LPARAM)buffer);
|
669 | | - _tcscpy(buffer,_T("Crop to display"));
|
670 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,2,(LPARAM)buffer);
|
671 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_SETCURSEL,cfg->aspect3d,0);
|
672 | | - // sort modes
|
673 | | - _tcscpy(buffer,_T("Use system order"));
|
674 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)buffer);
|
675 | | - _tcscpy(buffer,_T("Group by color depth"));
|
676 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,1,(LPARAM)buffer);
|
677 | | - _tcscpy(buffer,_T("Group by resolution"));
|
678 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,2,(LPARAM)buffer);
|
679 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_SETCURSEL,cfg->SortModes,0);
|
680 | | - // color depths
|
681 | | - if(cfg->AllColorDepths) SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_CHECKED,0);
|
682 | | - else SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_UNCHECKED,0);
|
683 | | - // extra modes
|
684 | | - if(cfg->ExtraModes) SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_CHECKED,0);
|
685 | | - else SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_UNCHECKED,0);
|
686 | | - // shader path
|
687 | | - SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,false);
|
688 | | - // texture format
|
689 | | - _tcscpy(buffer,_T("Automatic"));
|
690 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)buffer);
|
691 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_SETCURSEL,cfg->TextureFormat,0);
|
692 | | - // Texture upload
|
693 | | - _tcscpy(buffer,_T("Automatic"));
|
694 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)buffer);
|
695 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_SETCURSEL,cfg->TexUpload,0);
|
696 | | - // DPI
|
697 | | - _tcscpy(buffer, _T("Disabled"));
|
698 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
699 | | - _tcscpy(buffer, _T("Enabled"));
|
700 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
701 | | - _tcscpy(buffer, _T("Windows AppCompat"));
|
702 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
703 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);
|
704 | | - // Add installed programs
|
705 | | - current_app = 1;
|
706 | | - appcount = 1;
|
707 | | - regbuffersize = 1024;
|
708 | | - regbuffer = (LPTSTR)malloc(regbuffersize*sizeof(TCHAR));
|
709 | | - RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\DXGL"),0,NULL,0,KEY_READ,NULL,&hKeyBase,NULL);
|
710 | | - RegQueryInfoKey(hKeyBase,NULL,NULL,NULL,NULL,&keysize,NULL,NULL,NULL,NULL,NULL,NULL);
|
711 | | - keysize++;
|
712 | | - keyname = (LPTSTR)malloc(keysize*sizeof(TCHAR));
|
713 | | - keysize2 = keysize;
|
714 | | - i = 0;
|
715 | | - while(RegEnumKeyEx(hKeyBase,i,keyname,&keysize2,NULL,NULL,NULL,NULL) == ERROR_SUCCESS)
|
716 | | - {
|
717 | | - keysize2 = keysize;
|
718 | | - i++;
|
719 | | - if(!_tcscmp(keyname,_T("Global"))) continue;
|
720 | | - appcount++;
|
721 | | - if(appcount > maxapps)
|
722 | | - {
|
723 | | - maxapps += 128;
|
724 | | - apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
|
725 | | - }
|
726 | | - if(!_tcscmp(keyname,_T("DXGLTestApp"))) subkey = _T("dxgltest.exe-0");
|
727 | | - else subkey = keyname;
|
728 | | - if(subkey.rfind(_T("-")) != string::npos) subkey.resize(subkey.rfind(_T("-")));
|
729 | | - error = RegOpenKeyEx(hKeyBase,keyname,0,KEY_READ,&hKey);
|
730 | | - buffersize = regbuffersize;
|
731 | | - RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
732 | | - if(buffersize > regbuffersize)
|
733 | | - {
|
734 | | - regbuffersize = buffersize;
|
735 | | - regbuffer = (LPTSTR)realloc(regbuffer,regbuffersize);
|
736 | | - }
|
737 | | - buffersize = regbuffersize;
|
738 | | - regbuffer[0] = regbuffer[1] = 0;
|
739 | | - error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
740 | | - regbufferpos = 0;
|
741 | | - apps[appcount-1].regkey = new tstring(keyname);
|
742 | | - GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,keyname);
|
743 | | - apps[appcount-1].dirty = false;
|
744 | | - while(1)
|
745 | | - {
|
746 | | - if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
|
747 | | - {
|
748 | | - // Default icon
|
749 | | - apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
|
750 | | - apps[appcount-1].icon_shared = true;
|
751 | | - apps[appcount-1].name = new tstring(subkey);
|
752 | | - break;
|
753 | | - }
|
754 | | - path = tstring(((LPTSTR)regbuffer+regbufferpos))+tstring(_T("\\"))+subkey;
|
755 | | - if(GetFileAttributes(path.c_str()) == INVALID_FILE_ATTRIBUTES)
|
756 | | - {
|
757 | | - regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
758 | | - continue;
|
759 | | - }
|
760 | | - // Get exe attributes
|
761 | | - error = SHGetFileInfo(path.c_str(),0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
|
762 | | - apps[appcount-1].icon = fileinfo.hIcon;
|
763 | | - apps[appcount-1].icon_shared = false;
|
764 | | - verinfosize = GetFileVersionInfoSize(path.c_str(),NULL);
|
765 | | - verinfo = malloc(verinfosize);
|
766 | | - hasname = false;
|
767 | | - if(GetFileVersionInfo(path.c_str(),0,verinfosize,verinfo))
|
768 | | - {
|
769 | | - if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
|
770 | | - {
|
771 | | - memcpy(translation,outbuffer,4);
|
772 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\FileDescription"),translation[0],translation[1]);
|
773 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
774 | | - {
|
775 | | - hasname = true;
|
776 | | - apps[appcount-1].name = new tstring(outbuffer);
|
777 | | - }
|
778 | | - else
|
779 | | - {
|
780 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
781 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
782 | | - {
|
783 | | - hasname = true;
|
784 | | - apps[appcount-1].name = new tstring(outbuffer);
|
785 | | - }
|
786 | | - else
|
787 | | - {
|
788 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
789 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
790 | | - {
|
791 | | - hasname = true;
|
792 | | - apps[appcount-1].name = new tstring(outbuffer);
|
793 | | - }
|
794 | | - }
|
795 | | - }
|
796 | | - }
|
797 | | - }
|
798 | | - if(!hasname) apps[appcount-1].name = new tstring(subkey);
|
799 | | - free(verinfo);
|
800 | | - break;
|
801 | | - }
|
802 | | - RegCloseKey(hKey);
|
803 | | - }
|
804 | | - RegCloseKey(hKeyBase);
|
805 | | - free(keyname);
|
806 | | - for(i = 0; i < appcount; i++)
|
807 | | - {
|
808 | | - SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[i].name->c_str());
|
809 | | - }
|
810 | | - current_app = 0;
|
811 | | - SendDlgItemMessage(hWnd,IDC_APPS,LB_SETCURSEL,0,0);
|
812 | | - if(osver.dwMajorVersion >= 6)
|
813 | | - {
|
814 | | - if(OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY,&token))
|
815 | | - {
|
816 | | - if(GetTokenInformation(token,(TOKEN_INFORMATION_CLASS)TokenElevation,&elevation,sizeof(TOKEN_ELEVATION),(PDWORD)&outlen))
|
817 | | - {
|
818 | | - if(!elevation.TokenIsElevated)
|
819 | | - {
|
820 | | - SendDlgItemMessage(hWnd,IDC_ADD,BCM_SETSHIELD,0,TRUE);
|
821 | | - SendDlgItemMessage(hWnd,IDC_REMOVE,BCM_SETSHIELD,0,TRUE);
|
822 | | - }
|
823 | | - }
|
824 | | - }
|
825 | | - }
|
826 | | - else
|
827 | | - {
|
828 | | - EnableWindow(GetDlgItem(hWnd, IDC_DPISCALE), FALSE);
|
829 | | - }
|
830 | | - if(token) CloseHandle(token);
|
831 | | - return true;
|
832 | | - case WM_MEASUREITEM:
|
833 | | - switch(wParam)
|
834 | | - {
|
835 | | - case IDC_APPS:
|
836 | | - ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYSMICON)+1;
|
837 | | - ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXSMICON)+1;
|
838 | | - default:
|
839 | | - break;
|
840 | | - }
|
841 | | - break;
|
842 | | - case WM_DRAWITEM:
|
843 | | - switch(wParam)
|
844 | | - {
|
845 | | - case IDC_APPS:
|
846 | | - OldTextColor = GetTextColor(drawitem->hDC);
|
847 | | - OldBackColor = GetBkColor(drawitem->hDC);
|
848 | | - if((drawitem->itemAction | ODA_SELECT) && (drawitem->itemState & ODS_SELECTED) &&
|
849 | | - !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
850 | | - {
|
851 | | - SetTextColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHTTEXT));
|
852 | | - SetBkColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHT));
|
853 | | - FillRect(drawitem->hDC,&drawitem->rcItem,(HBRUSH)(COLOR_HIGHLIGHT+1));
|
854 | | - }
|
855 | | - else ExtTextOut(drawitem->hDC,0,0,ETO_OPAQUE,&drawitem->rcItem,NULL,0,NULL);
|
856 | | - DrawIconEx(drawitem->hDC,drawitem->rcItem.left+2,drawitem->rcItem.top,
|
857 | | - apps[drawitem->itemID].icon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
|
858 | | - drawitem->rcItem.left += GetSystemMetrics(SM_CXSMICON)+5;
|
859 | | - DrawText(drawitem->hDC,apps[drawitem->itemID].name->c_str(),
|
860 | | - apps[drawitem->itemID].name->length(),&drawitem->rcItem,
|
861 | | - DT_LEFT|DT_SINGLELINE|DT_VCENTER);
|
862 | | - SetTextColor(drawitem->hDC,OldTextColor);
|
863 | | - SetBkColor(drawitem->hDC,OldBackColor);
|
864 | | - DefWindowProc(hWnd,Msg,wParam,lParam);
|
865 | | - break;
|
866 | | - default:
|
867 | | - break;
|
868 | | - }
|
869 | | - break;
|
870 | | - case WM_HELP:
|
871 | | - HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
|
872 | | - return true;
|
873 | | - break;
|
874 | | - case WM_SYSCOMMAND:
|
875 | | - if(LOWORD(wParam) == SC_CONTEXTHELP)
|
876 | | - {
|
877 | | - HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
|
878 | | - return true;
|
879 | | - }
|
880 | | - break;
|
881 | | - case WM_COMMAND:
|
882 | | - switch(LOWORD(wParam))
|
883 | | - {
|
884 | | - case IDOK:
|
885 | | - SaveChanges(hWnd);
|
886 | | - EndDialog(hWnd,IDOK);
|
887 | | - return true;
|
888 | | - case IDCANCEL:
|
889 | | - EndDialog(hWnd,IDCANCEL);
|
890 | | - return true;
|
891 | | - case IDC_APPLY:
|
892 | | - SaveChanges(hWnd);
|
893 | | - return true;
|
894 | | - case IDC_APPS:
|
895 | | - if(HIWORD(wParam) == LBN_SELCHANGE)
|
896 | | - {
|
897 | | - cursel = SendDlgItemMessage(hWnd,IDC_APPS,LB_GETCURSEL,0,0);
|
898 | | - if(cursel == current_app) break;
|
899 | | - current_app = cursel;
|
900 | | - cfg = &apps[current_app].cfg;
|
901 | | - cfgmask = &apps[current_app].mask;
|
902 | | - dirty = &apps[current_app].dirty;
|
903 | | - if(current_app)
|
904 | | - {
|
905 | | - if(!_tcscmp(apps[current_app].regkey->c_str(),_T("DXGLTestApp"))) EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),false);
|
906 | | - else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),true);
|
907 | | - }
|
908 | | - else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),false);
|
909 | | - // Set 3-state status
|
910 | | - if(current_app && !tristate)
|
911 | | - {
|
912 | | - tristate = true;
|
913 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)strdefault);
|
914 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)strdefault);
|
915 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)strdefault);
|
916 | | - SendDlgItemMessage(hWnd,IDC_VSYNC,CB_ADDSTRING,0,(LPARAM)strdefault);
|
917 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)strdefault);
|
918 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)strdefault);
|
919 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)strdefault);
|
920 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)strdefault);
|
921 | | - SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
922 | | - SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
923 | | - SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
924 | | - SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
925 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)strdefault);
|
926 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)strdefault);
|
927 | | - SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
|
928 | | - SendDlgItemMessage(hWnd, IDC_ASPECT, CB_ADDSTRING, 0, (LPARAM)strdefault);
|
929 | | - }
|
930 | | - else if(!current_app && tristate)
|
931 | | - {
|
932 | | - tristate = false;
|
933 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_DELETESTRING,
|
934 | | - SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
935 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_DELETESTRING,
|
936 | | - SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
937 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_DELETESTRING,
|
938 | | - SendDlgItemMessage(hWnd,IDC_SCALE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
939 | | - SendDlgItemMessage(hWnd,IDC_VSYNC,CB_DELETESTRING,
|
940 | | - SendDlgItemMessage(hWnd,IDC_VSYNC,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
941 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_DELETESTRING,
|
942 | | - SendDlgItemMessage(hWnd,IDC_MSAA,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
943 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_DELETESTRING,
|
944 | | - SendDlgItemMessage(hWnd,IDC_ANISO,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
945 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_DELETESTRING,
|
946 | | - SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
947 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_DELETESTRING,
|
948 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
949 | | - SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
950 | | - SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
951 | | - SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
952 | | - SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
953 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_DELETESTRING,
|
954 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
955 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_DELETESTRING,
|
956 | | - SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
957 | | - SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_DELETESTRING,
|
958 | | - SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
959 | | - SendDlgItemMessage(hWnd, IDC_ASPECT, CB_DELETESTRING,
|
960 | | - SendDlgItemMessage(hWnd, IDC_ASPECT, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
961 | | - }
|
962 | | - // Read settings into controls
|
963 | | - SetCombo(hWnd,IDC_VIDMODE,cfg->scaler,cfgmask->scaler,tristate);
|
964 | | - SetCombo(hWnd,IDC_SORTMODES,cfg->SortModes,cfgmask->SortModes,tristate);
|
965 | | - SetCombo(hWnd,IDC_SCALE,cfg->scalingfilter,cfgmask->scalingfilter,tristate);
|
966 | | - SetCombo(hWnd,IDC_VSYNC,cfg->vsync,cfgmask->vsync,tristate);
|
967 | | - SetCombo(hWnd,IDC_MSAA,cfg->msaa,cfgmask->msaa,tristate);
|
968 | | - SetCombo(hWnd,IDC_ANISO,cfg->anisotropic,cfgmask->anisotropic,tristate);
|
969 | | - SetCombo(hWnd,IDC_TEXFILTER,cfg->texfilter,cfgmask->texfilter,tristate);
|
970 | | - SetCombo(hWnd,IDC_ASPECT3D,cfg->aspect3d,cfgmask->aspect3d,tristate);
|
971 | | - SetCheck(hWnd,IDC_COLOR,cfg->colormode,cfgmask->colormode,tristate);
|
972 | | - SetCheck(hWnd,IDC_HIGHRES,cfg->highres,cfgmask->highres,tristate);
|
973 | | - SetCheck(hWnd,IDC_UNCOMMONCOLOR,cfg->AllColorDepths,cfgmask->AllColorDepths,tristate);
|
974 | | - SetCombo(hWnd,IDC_TEXTUREFORMAT,cfg->TextureFormat,cfgmask->TextureFormat,tristate);
|
975 | | - SetCombo(hWnd,IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
|
976 | | - SetCheck(hWnd,IDC_EXTRAMODES,cfg->ExtraModes,cfgmask->ExtraModes,tristate);
|
977 | | - SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,tristate);
|
978 | | - SetCombo(hWnd, IDC_DPISCALE, cfg->DPIScale, cfgmask->DPIScale, tristate);
|
979 | | - SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
980 | | - }
|
981 | | - case IDC_VIDMODE:
|
982 | | - cfg->scaler = GetCombo(hWnd,IDC_VIDMODE,cfgmask->scaler);
|
983 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
984 | | - *dirty = true;
|
985 | | - break;
|
986 | | - case IDC_SORTMODES:
|
987 | | - cfg->SortModes = GetCombo(hWnd,IDC_SORTMODES,cfgmask->SortModes);
|
988 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
989 | | - *dirty = true;
|
990 | | - break;
|
991 | | - case IDC_SCALE:
|
992 | | - cfg->scalingfilter = GetCombo(hWnd,IDC_SCALE,cfgmask->scalingfilter);
|
993 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
994 | | - *dirty = true;
|
995 | | - break;
|
996 | | - case IDC_VSYNC:
|
997 | | - cfg->vsync = GetCombo(hWnd,IDC_VSYNC,cfgmask->vsync);
|
998 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
999 | | - *dirty = true;
|
1000 | | - break;
|
1001 | | - case IDC_MSAA:
|
1002 | | - cfg->msaa = GetCombo(hWnd,IDC_MSAA,cfgmask->msaa);
|
1003 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1004 | | - *dirty = true;
|
1005 | | - break;
|
1006 | | - case IDC_ANISO:
|
1007 | | - cfg->anisotropic = GetCombo(hWnd,IDC_ANISO,cfgmask->anisotropic);
|
1008 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1009 | | - *dirty = true;
|
1010 | | - break;
|
1011 | | - case IDC_TEXFILTER:
|
1012 | | - cfg->texfilter = GetCombo(hWnd,IDC_TEXFILTER,cfgmask->texfilter);
|
1013 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1014 | | - *dirty = true;
|
1015 | | - break;
|
1016 | | - case IDC_ASPECT3D:
|
1017 | | - cfg->aspect3d = GetCombo(hWnd,IDC_ASPECT3D,cfgmask->aspect3d);
|
1018 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1019 | | - *dirty = true;
|
1020 | | - break;
|
1021 | | - case IDC_COLOR:
|
1022 | | - cfg->colormode = GetCheck(hWnd,IDC_COLOR,cfgmask->colormode);
|
1023 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1024 | | - *dirty = true;
|
1025 | | - break;
|
1026 | | - case IDC_HIGHRES:
|
1027 | | - cfg->highres = GetCheck(hWnd,IDC_HIGHRES,cfgmask->highres);
|
1028 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1029 | | - *dirty = true;
|
1030 | | - break;
|
1031 | | - case IDC_UNCOMMONCOLOR:
|
1032 | | - cfg->AllColorDepths = GetCheck(hWnd,IDC_UNCOMMONCOLOR,cfgmask->AllColorDepths);
|
1033 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1034 | | - *dirty = true;
|
1035 | | - break;
|
1036 | | - case IDC_EXTRAMODES:
|
1037 | | - cfg->ExtraModes = GetCheck(hWnd,IDC_EXTRAMODES,cfgmask->ExtraModes);
|
1038 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1039 | | - *dirty = true;
|
1040 | | - break;
|
1041 | | - case IDC_TEXTUREFORMAT:
|
1042 | | - cfg->TextureFormat = GetCombo(hWnd,IDC_TEXTUREFORMAT,cfgmask->TextureFormat);
|
1043 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1044 | | - *dirty = true;
|
1045 | | - break;
|
1046 | | - case IDC_TEXUPLOAD:
|
1047 | | - cfg->TexUpload = GetCombo(hWnd,IDC_TEXUPLOAD,cfgmask->TexUpload);
|
1048 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1049 | | - *dirty = true;
|
1050 | | - break;
|
1051 | | - case IDC_DPISCALE:
|
1052 | | - cfg->DPIScale = GetCombo(hWnd,IDC_DPISCALE,cfgmask->DPIScale);
|
1053 | | - EnableWindow(GetDlgItem(hWnd, IDC_APPLY), true);
|
1054 | | - *dirty = true;
|
1055 | | - break;
|
1056 | | - case IDC_SHADER:
|
1057 | | - if(HIWORD(wParam) == EN_CHANGE)
|
1058 | | - {
|
1059 | | - GetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile);
|
1060 | | - EnableWindow(GetDlgItem(hWnd,IDC_APPLY),true);
|
1061 | | - *dirty = true;
|
1062 | | - }
|
1063 | | - break;
|
1064 | | - case IDC_ASPECT:
|
1065 | | - if (HIWORD(wParam) == CBN_KILLFOCUS)
|
1066 | | - {
|
1067 | | - cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, cfgmask->aspect);
|
1068 | | - SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
1069 | | - EnableWindow(GetDlgItem(hWnd, IDC_APPLY), true);
|
1070 | | - *dirty = true;
|
1071 | | - }
|
1072 | | - else if (HIWORD(wParam) == CBN_SELCHANGE)
|
1073 | | - {
|
1074 | | - cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, cfgmask->aspect);
|
1075 | | - EnableWindow(GetDlgItem(hWnd, IDC_APPLY), true);
|
1076 | | - *dirty = true;
|
1077 | | - }
|
1078 | | - break;
|
1079 | | - case IDC_ADD:
|
1080 | | - OPENFILENAME filename;
|
1081 | | - TCHAR selectedfile[MAX_PATH+1];
|
1082 | | - selectedfile[0] = 0;
|
1083 | | - ZeroMemory(&filename,OPENFILENAME_SIZE_VERSION_400);
|
1084 | | - filename.lStructSize = OPENFILENAME_SIZE_VERSION_400;
|
1085 | | - filename.hwndOwner = hWnd;
|
1086 | | - filename.lpstrFilter = exe_filter;
|
1087 | | - filename.lpstrFile = selectedfile;
|
1088 | | - filename.nMaxFile = MAX_PATH+1;
|
1089 | | - filename.lpstrInitialDir = _T("%ProgramFiles%");
|
1090 | | - filename.lpstrTitle = _T("Select program");
|
1091 | | - filename.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
|
1092 | | - if(GetOpenFileName(&filename))
|
1093 | | - {
|
1094 | | - DWORD err = AddApp(filename.lpstrFile,true,false);
|
1095 | | - if(!err)
|
1096 | | - {
|
1097 | | - tstring newkey = MakeNewConfig(filename.lpstrFile);
|
1098 | | - tstring newkey2 = _T("Software\\DXGL\\") + newkey;
|
1099 | | - appcount++;
|
1100 | | - if(appcount > maxapps)
|
1101 | | - {
|
1102 | | - maxapps += 128;
|
1103 | | - apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
|
1104 | | - }
|
1105 | | - RegOpenKeyEx(HKEY_CURRENT_USER,newkey2.c_str(),0,KEY_READ,&hKey);
|
1106 | | - RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
1107 | | - regbuffer = (LPTSTR)malloc(buffersize);
|
1108 | | - regbuffer[0] = regbuffer[1] = 0;
|
1109 | | - error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
1110 | | - regbufferpos = 0;
|
1111 | | - apps[appcount-1].regkey = new tstring(newkey);
|
1112 | | - GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,newkey.c_str());
|
1113 | | - apps[appcount-1].dirty = false;
|
1114 | | - while(1)
|
1115 | | - {
|
1116 | | - if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
|
1117 | | - {
|
1118 | | - // Default icon
|
1119 | | - apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
|
1120 | | - apps[appcount-1].icon_shared = true;
|
1121 | | - apps[appcount-1].name = new tstring(newkey);
|
1122 | | - break;
|
1123 | | - }
|
1124 | | - if(newkey.rfind(_T("-")) != string::npos) newkey.resize(newkey.rfind(_T("-")));
|
1125 | | - path = tstring(((LPTSTR)regbuffer+regbufferpos))+tstring(_T("\\"))+newkey;
|
1126 | | - if(GetFileAttributes(path.c_str()) == INVALID_FILE_ATTRIBUTES)
|
1127 | | - {
|
1128 | | - regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
1129 | | - continue;
|
1130 | | - }
|
1131 | | - // Get exe attributes
|
1132 | | - error = SHGetFileInfo(path.c_str(),0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
|
1133 | | - apps[appcount-1].icon = fileinfo.hIcon;
|
1134 | | - apps[appcount-1].icon_shared = false;
|
1135 | | - verinfosize = GetFileVersionInfoSize(path.c_str(),NULL);
|
1136 | | - verinfo = malloc(verinfosize);
|
1137 | | - hasname = false;
|
1138 | | - if(GetFileVersionInfo(path.c_str(),0,verinfosize,verinfo))
|
1139 | | - {
|
1140 | | - if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
|
1141 | | - {
|
1142 | | - memcpy(translation,outbuffer,4);
|
1143 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\FileDescription"),translation[0],translation[1]);
|
1144 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
1145 | | - {
|
1146 | | - hasname = true;
|
1147 | | - apps[appcount-1].name = new tstring(outbuffer);
|
1148 | | - }
|
1149 | | - else
|
1150 | | - {
|
1151 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
1152 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
1153 | | - {
|
1154 | | - hasname = true;
|
1155 | | - apps[appcount-1].name = new tstring(outbuffer);
|
1156 | | - }
|
1157 | | - else
|
1158 | | - {
|
1159 | | - _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
1160 | | - if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
1161 | | - {
|
1162 | | - hasname = true;
|
1163 | | - apps[appcount-1].name = new tstring(outbuffer);
|
1164 | | - }
|
1165 | | - }
|
1166 | | - }
|
1167 | | - }
|
1168 | | - }
|
1169 | | - if(!hasname) apps[appcount-1].name = new tstring(newkey);
|
1170 | | - free(verinfo);
|
1171 | | - break;
|
1172 | | - }
|
1173 | | - SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[appcount-1].name->c_str());
|
1174 | | - RegCloseKey(hKey);
|
1175 | | - free(regbuffer);
|
1176 | | - }
|
1177 | | - }
|
1178 | | -
|
1179 | | - break;
|
1180 | | - case IDC_REMOVE:
|
1181 | | - if(MessageBox(hWnd,_T("Do you want to delete the selected application profile and remove DXGL from its installation folder(s)?"),
|
1182 | | - _T("Confirmation"),MB_YESNO|MB_ICONQUESTION) != IDYES) return false;
|
1183 | | - tstring regpath = _T("Software\\DXGL\\");
|
1184 | | - tstring regkey = *apps[current_app].regkey;
|
1185 | | - regpath.append(*apps[current_app].regkey);
|
1186 | | - RegOpenKeyEx(HKEY_CURRENT_USER,regpath.c_str(),0,KEY_READ,&hKey);
|
1187 | | - RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
1188 | | - regbuffer = (LPTSTR)malloc(buffersize);
|
1189 | | - regbuffer[0] = regbuffer[1] = 0;
|
1190 | | - error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
1191 | | - regbufferpos = 0;
|
1192 | | - bool failed = false;
|
1193 | | - while(1)
|
1194 | | - {
|
1195 | | - if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS) break;
|
1196 | | - if(regkey.rfind(_T("-")) != string::npos) regkey.resize(regkey.rfind(_T("-")));
|
1197 | | - path = tstring(((LPTSTR)regbuffer+regbufferpos))+tstring(_T("\\ddraw.dll"));
|
1198 | | - if(GetFileAttributes(path.c_str()) == INVALID_FILE_ATTRIBUTES)
|
1199 | | - {
|
1200 | | - regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
1201 | | - continue;
|
1202 | | - }
|
1203 | | - if(DelApp(path.c_str(),false)) failed = true;
|
1204 | | - regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
1205 | | - }
|
1206 | | - RegCloseKey(hKey);
|
1207 | | - if(!failed)
|
1208 | | - {
|
1209 | | - RegDeleteKey(HKEY_CURRENT_USER,regpath.c_str());
|
1210 | | - if(!apps[current_app].icon_shared) DeleteObject(apps[current_app].icon);
|
1211 | | - if(apps[current_app].name) delete apps[current_app].name;
|
1212 | | - if(apps[current_app].regkey) delete apps[current_app].regkey;
|
1213 | | - for(int i = current_app; i < appcount; i++)
|
1214 | | - {
|
1215 | | - apps[i] = apps[i+1];
|
1216 | | - }
|
1217 | | - appcount--;
|
1218 | | - }
|
1219 | | - SendDlgItemMessage(hWnd,IDC_APPS,LB_DELETESTRING,current_app,0);
|
1220 | | - break;
|
1221 | | - }
|
1222 | | - break;
|
1223 | | - }
|
1224 | | - return false;
|
1225 | | -}
|
1226 | | -
|
1227 | | -int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
1228 | | -{
|
1229 | | - osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
1230 | | - GetVersionEx(&osver);
|
1231 | | - CoInitialize(NULL);
|
1232 | | - INITCOMMONCONTROLSEX icc;
|
1233 | | - if(!_tcsnicmp(lpCmdLine,_T("install "),8))
|
1234 | | - {
|
1235 | | - return AddApp(lpCmdLine+8,true,true);
|
1236 | | - }
|
1237 | | - if(!_tcsnicmp(lpCmdLine,_T("remove "),7))
|
1238 | | - {
|
1239 | | - return DelApp(lpCmdLine+7,true);
|
1240 | | - }
|
1241 | | - icc.dwSize = sizeof(icc);
|
1242 | | - icc.dwICC = ICC_WIN95_CLASSES;
|
1243 | | - HMODULE comctl32 = LoadLibrary(_T("comctl32.dll"));
|
1244 | | - BOOL (WINAPI *iccex)(LPINITCOMMONCONTROLSEX lpInitCtrls) =
|
1245 | | - (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
1246 | | - if(iccex) iccex(&icc);
|
1247 | | - else InitCommonControls();
|
1248 | | - hinstance = hInstance;
|
1249 | | - GetModuleFileName(NULL,hlppath,MAX_PATH);
|
1250 | | - GetDirFromPath(hlppath);
|
1251 | | - _tcscat(hlppath,_T("\\dxgl.chm"));
|
1252 | | - DialogBox(hInstance,MAKEINTRESOURCE(IDD_DXGLCFG),0,reinterpret_cast<DLGPROC>(DXGLCfgCallback));
|
1253 | | - return 0;
|
1254 | | -}
|
Index: dxglcfg/dxglcfg.c |
— | — | @@ -0,0 +1,1303 @@ |
| 2 | +// DXGL
|
| 3 | +// Copyright (C) 2011-2014 William Feely
|
| 4 | +
|
| 5 | +// This library is free software; you can redistribute it and/or
|
| 6 | +// modify it under the terms of the GNU Lesser General Public
|
| 7 | +// License as published by the Free Software Foundation; either
|
| 8 | +// version 2.1 of the License, or (at your option) any later version.
|
| 9 | +
|
| 10 | +// This library is distributed in the hope that it will be useful,
|
| 11 | +// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 | +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
| 13 | +// Lesser General Public License for more details.
|
| 14 | +
|
| 15 | +// You should have received a copy of the GNU Lesser General Public
|
| 16 | +// License along with this library; if not, write to the Free Software
|
| 17 | +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
| 18 | +
|
| 19 | +#define _WIN32_WINNT 0x0600
|
| 20 | +#define _WIN32_IE 0x0300
|
| 21 | +#define _CRT_SECURE_NO_WARNINGS
|
| 22 | +#include <windows.h>
|
| 23 | +#include <HtmlHelp.h>
|
| 24 | +#include <CommCtrl.h>
|
| 25 | +#include <string.h>
|
| 26 | +#include <tchar.h>
|
| 27 | +#include <stdio.h>
|
| 28 | +#include <math.h>
|
| 29 | +#include <io.h>
|
| 30 | +#include "resource.h"
|
| 31 | +#include "../cfgmgr/cfgmgr.h"
|
| 32 | +#include <gl/GL.h>
|
| 33 | +
|
| 34 | +#ifndef SHGFI_ADDOVERLAYS
|
| 35 | +#define SHGFI_ADDOVERLAYS 0x000000020
|
| 36 | +#endif //SHGFI_ADDOVERLAYS
|
| 37 | +
|
| 38 | +#ifndef BCM_SETSHIELD
|
| 39 | +#define BCM_SETSHIELD 0x160C
|
| 40 | +#endif
|
| 41 | +
|
| 42 | +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
| 43 | +#define GL_MAX_SAMPLES_EXT 0x8D57
|
| 44 | +#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
|
| 45 | +#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
|
| 46 | +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
|
| 47 | +
|
| 48 | +DXGLCFG *cfg;
|
| 49 | +DXGLCFG *cfgmask;
|
| 50 | +BOOL *dirty;
|
| 51 | +HINSTANCE hinstance;
|
| 52 | +BOOL msaa = FALSE;
|
| 53 | +const char *extensions_string = NULL;
|
| 54 | +OSVERSIONINFO osver;
|
| 55 | +TCHAR hlppath[MAX_PATH+16];
|
| 56 | +
|
| 57 | +typedef struct
|
| 58 | +{
|
| 59 | + LPTSTR regkey;
|
| 60 | + LPTSTR name;
|
| 61 | + HICON icon;
|
| 62 | + BOOL icon_shared;
|
| 63 | + BOOL dirty;
|
| 64 | + DXGLCFG cfg;
|
| 65 | + DXGLCFG mask;
|
| 66 | +} app_setting;
|
| 67 | +
|
| 68 | +TCHAR exe_filter[] = _T("Program Files\0*.exe\0All Files\0*.*\0\0");
|
| 69 | +
|
| 70 | +app_setting *apps;
|
| 71 | +int appcount;
|
| 72 | +int maxapps;
|
| 73 | +DWORD current_app;
|
| 74 | +BOOL tristate;
|
| 75 | +TCHAR strdefault[] = _T("(global default)");
|
| 76 | +
|
| 77 | +DWORD AddApp(LPCTSTR path, BOOL copyfile, BOOL admin)
|
| 78 | +{
|
| 79 | + BOOL installed = FALSE;
|
| 80 | + BOOL dxgl_installdir = FALSE;
|
| 81 | + BOOL old_dxgl = FALSE;
|
| 82 | + TCHAR command[MAX_PATH+32];
|
| 83 | + SHELLEXECUTEINFO shex;
|
| 84 | + DWORD exitcode;
|
| 85 | + if (copyfile)
|
| 86 | + {
|
| 87 | + DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
|
| 88 | + TCHAR installpath[MAX_PATH+1];
|
| 89 | + TCHAR srcpath[MAX_PATH+1];
|
| 90 | + TCHAR destpath[MAX_PATH+1];
|
| 91 | + HKEY hKeyInstall;
|
| 92 | + LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE,_T("Software\\DXGL"),0,KEY_READ,&hKeyInstall);
|
| 93 | + if(error == ERROR_SUCCESS)
|
| 94 | + {
|
| 95 | + dxgl_installdir = TRUE;
|
| 96 | + error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
| 97 | + if(error == ERROR_SUCCESS) installed = TRUE;
|
| 98 | + }
|
| 99 | + if(hKeyInstall) RegCloseKey(hKeyInstall);
|
| 100 | + if(!installed)
|
| 101 | + {
|
| 102 | + GetModuleFileName(NULL,installpath,MAX_PATH+1);
|
| 103 | + }
|
| 104 | + if(dxgl_installdir) _tcscat(installpath,_T("\\"));
|
| 105 | + else (_tcsrchr(installpath,_T('\\')))[1] = 0;
|
| 106 | + _tcsncpy(srcpath,installpath,MAX_PATH+1);
|
| 107 | + _tcscat(srcpath,_T("ddraw.dll"));
|
| 108 | + _tcsncpy(destpath,path,MAX_PATH+1);
|
| 109 | + (_tcsrchr(destpath,_T('\\')))[1] = 0;
|
| 110 | + _tcscat(destpath,_T("ddraw.dll"));
|
| 111 | + error = CopyFile(srcpath,destpath,TRUE);
|
| 112 | + error_loop:
|
| 113 | + if(!error)
|
| 114 | + {
|
| 115 | + error = GetLastError();
|
| 116 | + if(error == ERROR_FILE_EXISTS)
|
| 117 | + {
|
| 118 | + HMODULE hmod = LoadLibrary(destpath);
|
| 119 | + if(hmod)
|
| 120 | + {
|
| 121 | + if(GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = TRUE;
|
| 122 | + FreeLibrary(hmod);
|
| 123 | + }
|
| 124 | + if(old_dxgl)
|
| 125 | + {
|
| 126 | + error = CopyFile(srcpath,destpath,FALSE);
|
| 127 | + goto error_loop;
|
| 128 | + }
|
| 129 | + }
|
| 130 | + if((error == ERROR_ACCESS_DENIED) && !admin)
|
| 131 | + {
|
| 132 | + _tcscpy(command,_T(" install "));
|
| 133 | + _tcscat(command,path);
|
| 134 | + ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
| 135 | + shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
| 136 | + shex.lpVerb = _T("runas");
|
| 137 | + shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
| 138 | + _tcscat(installpath,_T("\\dxglcfg.exe"));
|
| 139 | + shex.lpFile = installpath;
|
| 140 | + shex.lpParameters = command;
|
| 141 | + ShellExecuteEx(&shex);
|
| 142 | + WaitForSingleObject(shex.hProcess,INFINITE);
|
| 143 | + GetExitCodeProcess(shex.hProcess,&exitcode);
|
| 144 | + return exitcode;
|
| 145 | + }
|
| 146 | + return error;
|
| 147 | + }
|
| 148 | + }
|
| 149 | + return 0;
|
| 150 | +}
|
| 151 | +
|
| 152 | +DWORD DelApp(LPCTSTR path, BOOL admin)
|
| 153 | +{
|
| 154 | + BOOL installed = FALSE;
|
| 155 | + TCHAR command[MAX_PATH + 32];
|
| 156 | + BOOL old_dxgl = TRUE;
|
| 157 | + DWORD sizeout = (MAX_PATH+1)*sizeof(TCHAR);
|
| 158 | + TCHAR installpath[MAX_PATH+1];
|
| 159 | + HKEY hKeyInstall;
|
| 160 | + HMODULE hmod;
|
| 161 | + SHELLEXECUTEINFO shex;
|
| 162 | + DWORD exitcode;
|
| 163 | + LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\DXGL"), 0, KEY_READ, &hKeyInstall);
|
| 164 | + if(error == ERROR_SUCCESS)
|
| 165 | + {
|
| 166 | + error = RegQueryValueEx(hKeyInstall,_T("InstallDir"),NULL,NULL,(LPBYTE)installpath,&sizeout);
|
| 167 | + if(error == ERROR_SUCCESS) installed = TRUE;
|
| 168 | + }
|
| 169 | + if(hKeyInstall) RegCloseKey(hKeyInstall);
|
| 170 | + if(!installed)
|
| 171 | + {
|
| 172 | + GetModuleFileName(NULL,installpath,MAX_PATH+1);
|
| 173 | + }
|
| 174 | + hmod = LoadLibrary(path);
|
| 175 | + if(hmod)
|
| 176 | + {
|
| 177 | + if(!GetProcAddress(hmod,"IsDXGLDDraw")) old_dxgl = FALSE;
|
| 178 | + FreeLibrary(hmod);
|
| 179 | + }
|
| 180 | + if(!old_dxgl) return 0;
|
| 181 | + if(!DeleteFile(path))
|
| 182 | + {
|
| 183 | + error = GetLastError();
|
| 184 | + if(error == ERROR_FILE_NOT_FOUND) return 0;
|
| 185 | + if((error == ERROR_ACCESS_DENIED) && !admin)
|
| 186 | + {
|
| 187 | + _tcscpy(command,_T(" remove "));
|
| 188 | + _tcscat(command,path);
|
| 189 | + ZeroMemory(&shex,sizeof(SHELLEXECUTEINFO));
|
| 190 | + shex.cbSize = sizeof(SHELLEXECUTEINFO);
|
| 191 | + shex.lpVerb = _T("runas");
|
| 192 | + shex.fMask = SEE_MASK_NOCLOSEPROCESS;
|
| 193 | + _tcscat(installpath,_T("\\dxglcfg.exe"));
|
| 194 | + shex.lpFile = installpath;
|
| 195 | + shex.lpParameters = command;
|
| 196 | + ShellExecuteEx(&shex);
|
| 197 | + WaitForSingleObject(shex.hProcess,INFINITE);
|
| 198 | + GetExitCodeProcess(shex.hProcess,&exitcode);
|
| 199 | + return exitcode;
|
| 200 | + }
|
| 201 | + return error;
|
| 202 | + }
|
| 203 | + return 0;
|
| 204 | +}
|
| 205 | +
|
| 206 | +void SaveChanges(HWND hWnd)
|
| 207 | +{
|
| 208 | + int i;
|
| 209 | + if(apps[0].dirty) SetGlobalConfig(&apps[0].cfg);
|
| 210 | + for(i = 1; i < appcount; i++)
|
| 211 | + {
|
| 212 | + if(apps[i].dirty) SetConfig(&apps[i].cfg,&apps[i].mask,apps[i].regkey);
|
| 213 | + }
|
| 214 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),FALSE);
|
| 215 | +}
|
| 216 | +
|
| 217 | +void FloatToAspect(float f, LPTSTR aspect)
|
| 218 | +{
|
| 219 | + float integer;
|
| 220 | + float dummy;
|
| 221 | + float fract;
|
| 222 | + TCHAR denominator[5];
|
| 223 | + int i;
|
| 224 | + if (f >= 1000.0f) // Clamp ridiculously wide aspects
|
| 225 | + {
|
| 226 | + _tcscpy(aspect, _T("1000:1"));
|
| 227 | + return;
|
| 228 | + }
|
| 229 | + if (f < 0.001f) // Exclude ridiculously tall aspects, zero, and negative
|
| 230 | + {
|
| 231 | + _tcscpy(aspect, _T("Default"));
|
| 232 | + return;
|
| 233 | + }
|
| 234 | + // Handle common aspects
|
| 235 | + if (fabsf(f - 1.25f) < 0.0001f)
|
| 236 | + {
|
| 237 | + _tcscpy(aspect, _T("5:4"));
|
| 238 | + return;
|
| 239 | + }
|
| 240 | + if (fabsf(f - 1.3333333f) < 0.0001f)
|
| 241 | + {
|
| 242 | + _tcscpy(aspect, _T("4:3"));
|
| 243 | + return;
|
| 244 | + }
|
| 245 | + if (fabsf(f - 1.6f) < 0.0001f)
|
| 246 | + {
|
| 247 | + _tcscpy(aspect, _T("16:10"));
|
| 248 | + return;
|
| 249 | + }
|
| 250 | + if (fabsf(f - 1.7777777) < 0.0001f)
|
| 251 | + {
|
| 252 | + _tcscpy(aspect, _T("16:9"));
|
| 253 | + return;
|
| 254 | + }
|
| 255 | + if (fabsf(f - 1.9333333) < 0.0001f)
|
| 256 | + {
|
| 257 | + _tcscpy(aspect, _T("256:135"));
|
| 258 | + return;
|
| 259 | + }
|
| 260 | + fract = modff(f, &integer);
|
| 261 | + if (fract < 0.0001f) //Handle integer aspects
|
| 262 | + {
|
| 263 | + _itot((int)integer, aspect, 10);
|
| 264 | + _tcscat(aspect, _T(":1"));
|
| 265 | + return;
|
| 266 | + }
|
| 267 | + // Finally try from 2 to 1000
|
| 268 | + for (i = 2; i < 1000; i++)
|
| 269 | + {
|
| 270 | + if (fabsf(modff(fract*i, &dummy)) < 0.0001f)
|
| 271 | + {
|
| 272 | + _itot((f*i) + .5f, aspect, 10);
|
| 273 | + _itot(i, denominator, 10);
|
| 274 | + _tcscat(aspect, _T(":"));
|
| 275 | + _tcscat(aspect, denominator);
|
| 276 | + return;
|
| 277 | + }
|
| 278 | + }
|
| 279 | + // Cannot find a reasonable fractional aspect, so display as decimal.
|
| 280 | +#ifdef _UNICODE
|
| 281 | + swprintf(aspect, 31, L"%.6f", f);
|
| 282 | +#else
|
| 283 | + sprintf(aspect,"%.6f", f);
|
| 284 | +#endif
|
| 285 | +
|
| 286 | +}
|
| 287 | +
|
| 288 | +void SetCheck(HWND hWnd, int DlgItem, BOOL value, BOOL mask, BOOL tristate)
|
| 289 | +{
|
| 290 | + if(tristate && !mask)
|
| 291 | + SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_INDETERMINATE,0);
|
| 292 | + else
|
| 293 | + {
|
| 294 | + if(value) SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_CHECKED,0);
|
| 295 | + else SendDlgItemMessage(hWnd,DlgItem,BM_SETCHECK,BST_UNCHECKED,0);
|
| 296 | + }
|
| 297 | +}
|
| 298 | +
|
| 299 | +void SetCombo(HWND hWnd, int DlgItem, DWORD value, DWORD mask, BOOL tristate)
|
| 300 | +{
|
| 301 | + if(tristate && !mask)
|
| 302 | + SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
|
| 303 | + SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 304 | + else
|
| 305 | + SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,value,0);
|
| 306 | +}
|
| 307 | +
|
| 308 | +void SetAspectCombo(HWND hWnd, int DlgItem, float value, DWORD mask, BOOL tristate)
|
| 309 | +{
|
| 310 | + TCHAR buffer[32];
|
| 311 | + if (tristate && !mask)
|
| 312 | + SendDlgItemMessage(hWnd, DlgItem, CB_SETCURSEL,
|
| 313 | + SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
| 314 | + else
|
| 315 | + {
|
| 316 | + FloatToAspect(value, buffer);
|
| 317 | + SendDlgItemMessage(hWnd,DlgItem,CB_SETCURSEL,
|
| 318 | + SendDlgItemMessage(hWnd, DlgItem, CB_FINDSTRING, -1, (LPARAM)buffer), 0);
|
| 319 | + SetDlgItemText(hWnd, DlgItem, buffer);
|
| 320 | + }
|
| 321 | +
|
| 322 | +}
|
| 323 | +
|
| 324 | +void SetText(HWND hWnd, int DlgItem, TCHAR *value, TCHAR *mask, BOOL tristate)
|
| 325 | +{
|
| 326 | + if(tristate && (mask[0] == 0))
|
| 327 | + SetWindowText(GetDlgItem(hWnd,DlgItem),_T(""));
|
| 328 | + else SetWindowText(GetDlgItem(hWnd,DlgItem),value);
|
| 329 | +}
|
| 330 | +
|
| 331 | +BOOL GetCheck(HWND hWnd, int DlgItem, BOOL *mask)
|
| 332 | +{
|
| 333 | + int check = SendDlgItemMessage(hWnd,DlgItem,BM_GETCHECK,0,0);
|
| 334 | + switch(check)
|
| 335 | + {
|
| 336 | + case BST_CHECKED:
|
| 337 | + *mask = TRUE;
|
| 338 | + return TRUE;
|
| 339 | + case BST_UNCHECKED:
|
| 340 | + *mask = TRUE;
|
| 341 | + return FALSE;
|
| 342 | + case BST_INDETERMINATE:
|
| 343 | + default:
|
| 344 | + *mask = FALSE;
|
| 345 | + return FALSE;
|
| 346 | + }
|
| 347 | +}
|
| 348 | +
|
| 349 | +DWORD GetCombo(HWND hWnd, int DlgItem, DWORD *mask)
|
| 350 | +{
|
| 351 | + int value = SendDlgItemMessage(hWnd,DlgItem,CB_GETCURSEL,0,0);
|
| 352 | + if(value == SendDlgItemMessage(hWnd,DlgItem,CB_FINDSTRING,-1,(LPARAM)strdefault))
|
| 353 | + {
|
| 354 | + *mask = 0;
|
| 355 | + return 0;
|
| 356 | + }
|
| 357 | + else
|
| 358 | + {
|
| 359 | + *mask = 1;
|
| 360 | + return value;
|
| 361 | + }
|
| 362 | +}
|
| 363 | +
|
| 364 | +float GetAspectCombo(HWND hWnd, int DlgItem, float *mask)
|
| 365 | +{
|
| 366 | + TCHAR buffer[32];
|
| 367 | + TCHAR *ptr;
|
| 368 | + float numerator, denominator;
|
| 369 | + GetDlgItemText(hWnd, DlgItem, buffer, 31);
|
| 370 | + if (!_tcscmp(buffer, strdefault))
|
| 371 | + {
|
| 372 | + *mask = 0.0f;
|
| 373 | + return 0;
|
| 374 | + }
|
| 375 | + else
|
| 376 | + {
|
| 377 | + *mask = 1.0f;
|
| 378 | + if (!_tcscmp(buffer, _T("Default"))) return 0.0f;
|
| 379 | + else
|
| 380 | + {
|
| 381 | + // Check for colon
|
| 382 | + ptr = _tcsstr(buffer, _T(":"));
|
| 383 | + if (ptr)
|
| 384 | + {
|
| 385 | + *ptr = 0;
|
| 386 | + numerator = _ttof(buffer);
|
| 387 | + denominator = _ttof(ptr + 1);
|
| 388 | + return numerator / denominator;
|
| 389 | + }
|
| 390 | + else return _ttof(buffer);
|
| 391 | + }
|
| 392 | + }
|
| 393 | +}
|
| 394 | +
|
| 395 | +void GetText(HWND hWnd, int DlgItem, TCHAR *str, TCHAR *mask)
|
| 396 | +{
|
| 397 | + GetDlgItemText(hWnd,DlgItem,str,MAX_PATH+1);
|
| 398 | + if(str[0] == 0) mask[0] = 0;
|
| 399 | + else mask[0] = 0xff;
|
| 400 | +}
|
| 401 | +
|
| 402 | +LRESULT CALLBACK DXGLCfgCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
| 403 | +{
|
| 404 | + PIXELFORMATDESCRIPTOR pfd =
|
| 405 | + {
|
| 406 | + sizeof(PIXELFORMATDESCRIPTOR),
|
| 407 | + 1,
|
| 408 | + PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, //Flags
|
| 409 | + PFD_TYPE_RGBA, //The kind of framebuffer. RGBA or palette.
|
| 410 | + 0, //Colordepth of the framebuffer.
|
| 411 | + 0, 0, 0, 0, 0, 0,
|
| 412 | + 0,
|
| 413 | + 0,
|
| 414 | + 0,
|
| 415 | + 0, 0, 0, 0,
|
| 416 | + 24, //Number of bits for the depthbuffer
|
| 417 | + 8, //Number of bits for the stencilbuffer
|
| 418 | + 0, //Number of Aux buffers in the framebuffer.
|
| 419 | + PFD_MAIN_PLANE,
|
| 420 | + 0,
|
| 421 | + 0, 0, 0
|
| 422 | + };
|
| 423 | + GLfloat anisotropic;
|
| 424 | + HDC dc;
|
| 425 | + HGLRC rc;
|
| 426 | + GLint maxsamples;
|
| 427 | + GLint maxcoverage = 0;
|
| 428 | + GLint coveragemodes[64];
|
| 429 | + int msaamodes[32];
|
| 430 | + int pf;
|
| 431 | + int i;
|
| 432 | + HKEY hKeyBase;
|
| 433 | + HKEY hKey;
|
| 434 | + DWORD keysize,keysize2;
|
| 435 | + DEVMODE mode;
|
| 436 | + LPTSTR keyname;
|
| 437 | + LPTSTR regbuffer;
|
| 438 | + DWORD regbuffersize;
|
| 439 | + DWORD regbufferpos;
|
| 440 | + DWORD buffersize;
|
| 441 | + LONG error;
|
| 442 | + TCHAR buffer[64];
|
| 443 | + TCHAR subkey[MAX_PATH];
|
| 444 | + LPTSTR path;
|
| 445 | + SHFILEINFO fileinfo;
|
| 446 | + DWORD verinfosize;
|
| 447 | + LPTSTR outbuffer;
|
| 448 | + UINT outlen;
|
| 449 | + TCHAR verpath[64];
|
| 450 | + WORD translation[2];
|
| 451 | + DWORD cursel;
|
| 452 | + DRAWITEMSTRUCT* drawitem = (DRAWITEMSTRUCT*)lParam;
|
| 453 | + BOOL hasname;
|
| 454 | + void *verinfo;
|
| 455 | + COLORREF OldTextColor,OldBackColor;
|
| 456 | + HANDLE token = NULL;
|
| 457 | + TOKEN_ELEVATION elevation;
|
| 458 | + HWND hGLWnd;
|
| 459 | + OPENFILENAME filename;
|
| 460 | + TCHAR selectedfile[MAX_PATH + 1];
|
| 461 | + LPTSTR regpath;
|
| 462 | + LPTSTR regkey;
|
| 463 | + BOOL failed;
|
| 464 | + switch (Msg)
|
| 465 | + {
|
| 466 | + case WM_INITDIALOG:
|
| 467 | + tristate = FALSE;
|
| 468 | + maxapps = 128;
|
| 469 | + apps = (app_setting *)malloc(maxapps*sizeof(app_setting));
|
| 470 | + apps[0].name = (TCHAR*)malloc(7 * sizeof(TCHAR));
|
| 471 | + _tcscpy(apps[0].name,_T("Global"));
|
| 472 | + apps[0].regkey = (TCHAR*)malloc(7 * sizeof(TCHAR));
|
| 473 | + _tcscpy(apps[0].regkey,_T("Global"));
|
| 474 | + GetGlobalConfig(&apps[0].cfg, FALSE);
|
| 475 | + cfg = &apps[0].cfg;
|
| 476 | + cfgmask = &apps[0].mask;
|
| 477 | + dirty = &apps[0].dirty;
|
| 478 | + memset(&apps[0].mask,0xff,sizeof(DXGLCFG));
|
| 479 | + apps[0].dirty = FALSE;
|
| 480 | + apps[0].icon = LoadIcon(GetModuleHandle(NULL),MAKEINTRESOURCE(IDI_STAR));
|
| 481 | + apps[0].icon_shared = TRUE;
|
| 482 | + SetClassLong(hWnd,GCL_HICON,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGL));
|
| 483 | + SetClassLong(hWnd,GCL_HICONSM,(LONG)LoadIcon(hinstance,(LPCTSTR)IDI_DXGLSM));
|
| 484 | + // create temporary gl context to get AA and AF settings.
|
| 485 | + mode.dmSize = sizeof(DEVMODE);
|
| 486 | + EnumDisplaySettings(NULL,ENUM_CURRENT_SETTINGS,&mode);
|
| 487 | + pfd.cColorBits = (BYTE)mode.dmBitsPerPel;
|
| 488 | + hGLWnd = CreateWindow(_T("STATIC"),NULL,WS_CHILD,0,0,16,16,hWnd,NULL,NULL,NULL);
|
| 489 | + dc = GetDC(hGLWnd);
|
| 490 | + pf = ChoosePixelFormat(dc,&pfd);
|
| 491 | + SetPixelFormat(dc,pf,&pfd);
|
| 492 | + rc = wglCreateContext(dc);
|
| 493 | + wglMakeCurrent(dc,rc);
|
| 494 | + extensions_string = (char*)glGetString(GL_EXTENSIONS);
|
| 495 | + if(strstr(extensions_string,"GL_EXT_texture_filter_anisotropic"))
|
| 496 | + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT,&anisotropic);
|
| 497 | + else anisotropic = 0;
|
| 498 | + if(strstr(extensions_string,"GL_EXT_framebuffer_multisample"))
|
| 499 | + {
|
| 500 | + glGetIntegerv(GL_MAX_SAMPLES_EXT,&maxsamples);
|
| 501 | + if(strstr(extensions_string,"GL_NV_framebuffer_multisample_coverage")) // Supports NVIDIA CSAA
|
| 502 | + {
|
| 503 | + glGetIntegerv(GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV,&maxcoverage);
|
| 504 | + glGetIntegerv(GL_MULTISAMPLE_COVERAGE_MODES_NV,coveragemodes);
|
| 505 | + if(maxcoverage) for(i = 0; i < maxcoverage; i++)
|
| 506 | + {
|
| 507 | + msaamodes[i] = coveragemodes[2*i]+(4096*coveragemodes[(2*i)+1]);
|
| 508 | + msaa = TRUE;
|
| 509 | + }
|
| 510 | + }
|
| 511 | + }
|
| 512 | + wglMakeCurrent(dc,NULL);
|
| 513 | + wglDeleteContext(rc);
|
| 514 | + ReleaseDC(hGLWnd,dc);
|
| 515 | + DestroyWindow(hGLWnd);
|
| 516 | + // Load global settings.
|
| 517 | + // scaler
|
| 518 | + _tcscpy(buffer,_T("Change desktop resolution"));
|
| 519 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 520 | + _tcscpy(buffer,_T("Stretch to screen"));
|
| 521 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 522 | + _tcscpy(buffer,_T("Aspect corrected stretch"));
|
| 523 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 524 | + _tcscpy(buffer,_T("Center image on screen"));
|
| 525 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,3,(LPARAM)buffer);
|
| 526 | + _tcscpy(buffer,_T("Stretch if mode not found"));
|
| 527 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,4,(LPARAM)buffer);
|
| 528 | + _tcscpy(buffer,_T("Scale if mode not found"));
|
| 529 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,5,(LPARAM)buffer);
|
| 530 | + _tcscpy(buffer,_T("Center if mode not found"));
|
| 531 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,6,(LPARAM)buffer);
|
| 532 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_SETCURSEL,cfg->scaler,0);
|
| 533 | + // colormode
|
| 534 | + if(cfg->colormode) SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_CHECKED,0);
|
| 535 | + else SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETCHECK,BST_UNCHECKED,0);
|
| 536 | + // scalingfilter
|
| 537 | + _tcscpy(buffer,_T("Nearest"));
|
| 538 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 539 | + _tcscpy(buffer,_T("Bilinear"));
|
| 540 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 541 | + _tcscpy(buffer,_T("Custom shader"));
|
| 542 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 543 | + _tcscpy(buffer,_T("Shader (primary only)"));
|
| 544 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,3,(LPARAM)buffer);
|
| 545 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_SETCURSEL,cfg->scalingfilter,0);
|
| 546 | + // aspect
|
| 547 | + _tcscpy(buffer,_T("Default"));
|
| 548 | + SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 549 | + _tcscpy(buffer,_T("4:3"));
|
| 550 | + SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 551 | + _tcscpy(buffer,_T("16:10"));
|
| 552 | + SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 553 | + _tcscpy(buffer,_T("16:9"));
|
| 554 | + SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 555 | + _tcscpy(buffer,_T("5:4"));
|
| 556 | + SendDlgItemMessage(hWnd,IDC_ASPECT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 557 | + SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
| 558 | +
|
| 559 | + // highres
|
| 560 | + if(cfg->highres) SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_CHECKED,0);
|
| 561 | + else SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETCHECK,BST_UNCHECKED,0);
|
| 562 | + // texfilter
|
| 563 | + _tcscpy(buffer,_T("Application default"));
|
| 564 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 565 | + _tcscpy(buffer,_T("Nearest"));
|
| 566 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 567 | + _tcscpy(buffer,_T("Bilinear"));
|
| 568 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 569 | + _tcscpy(buffer,_T("Nearest, nearest mipmap"));
|
| 570 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,3,(LPARAM)buffer);
|
| 571 | + _tcscpy(buffer,_T("Nearest, linear mipmap"));
|
| 572 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,4,(LPARAM)buffer);
|
| 573 | + _tcscpy(buffer,_T("Bilinear, nearest mipmap"));
|
| 574 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,5,(LPARAM)buffer);
|
| 575 | + _tcscpy(buffer,_T("Bilinear, linear mipmap"));
|
| 576 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,6,(LPARAM)buffer);
|
| 577 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_SETCURSEL,cfg->texfilter,0);
|
| 578 | + // anisotropic
|
| 579 | + if (anisotropic < 2)
|
| 580 | + {
|
| 581 | + _tcscpy(buffer,_T("Not supported"));
|
| 582 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 583 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,0,0);
|
| 584 | + EnableWindow(GetDlgItem(hWnd,IDC_ANISO),FALSE);
|
| 585 | + cfg->anisotropic = 0;
|
| 586 | + }
|
| 587 | + else
|
| 588 | + {
|
| 589 | + _tcscpy(buffer,_T("Application default"));
|
| 590 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 591 | + _tcscpy(buffer,_T("Disabled"));
|
| 592 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 593 | + if(anisotropic >= 2)
|
| 594 | + {
|
| 595 | + _tcscpy(buffer,_T("2x"));
|
| 596 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 597 | + }
|
| 598 | + if(anisotropic >= 4)
|
| 599 | + {
|
| 600 | + _tcscpy(buffer,_T("4x"));
|
| 601 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
|
| 602 | + }
|
| 603 | + if(anisotropic >= 8)
|
| 604 | + {
|
| 605 | + _tcscpy(buffer,_T("8x"));
|
| 606 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,8,(LPARAM)buffer);
|
| 607 | + }
|
| 608 | + if(anisotropic >= 16)
|
| 609 | + {
|
| 610 | + _tcscpy(buffer,_T("16x"));
|
| 611 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,16,(LPARAM)buffer);
|
| 612 | + }
|
| 613 | + if(anisotropic >= 32)
|
| 614 | + {
|
| 615 | + _tcscpy(buffer,_T("32x"));
|
| 616 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,4,(LPARAM)buffer);
|
| 617 | + }
|
| 618 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_SETCURSEL,cfg->anisotropic,0);
|
| 619 | + }
|
| 620 | + // msaa
|
| 621 | + if(msaa)
|
| 622 | + {
|
| 623 | + _tcscpy(buffer,_T("Application default"));
|
| 624 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 625 | + _tcscpy(buffer,_T("Disabled"));
|
| 626 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 627 | + if(maxcoverage)
|
| 628 | + {
|
| 629 | + for(i = 0; i < maxcoverage; i++)
|
| 630 | + {
|
| 631 | + if((msaamodes[i] & 0xfff) <= 4)
|
| 632 | + _sntprintf(buffer,64,_T("%dx"),msaamodes[i] & 0xfff);
|
| 633 | + else _sntprintf(buffer,64,_T("%dx coverage, %dx color"),(msaamodes[i] & 0xfff), (msaamodes[i] >> 12));
|
| 634 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,msaamodes[i],(LPARAM)buffer);
|
| 635 | + }
|
| 636 | + }
|
| 637 | + else
|
| 638 | + {
|
| 639 | + if(maxsamples >= 2)
|
| 640 | + {
|
| 641 | + _tcscpy(buffer,_T("2x"));
|
| 642 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 643 | + }
|
| 644 | + if(maxsamples >= 4)
|
| 645 | + {
|
| 646 | + _tcscpy(buffer,_T("4x"));
|
| 647 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,4,(LPARAM)buffer);
|
| 648 | + }
|
| 649 | + if(maxsamples >= 8)
|
| 650 | + {
|
| 651 | + _tcscpy(buffer,_T("8x"));
|
| 652 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,8,(LPARAM)buffer);
|
| 653 | + }
|
| 654 | + if(maxsamples >= 16)
|
| 655 | + {
|
| 656 | + _tcscpy(buffer,_T("16x"));
|
| 657 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,16,(LPARAM)buffer);
|
| 658 | + }
|
| 659 | + if(maxsamples >= 32)
|
| 660 | + {
|
| 661 | + _tcscpy(buffer,_T("32x"));
|
| 662 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,32,(LPARAM)buffer);
|
| 663 | + }
|
| 664 | + }
|
| 665 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,cfg->msaa,0);
|
| 666 | + }
|
| 667 | + else
|
| 668 | + {
|
| 669 | + _tcscpy(buffer,_T("Not supported"));
|
| 670 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 671 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_SETCURSEL,0,0);
|
| 672 | + EnableWindow(GetDlgItem(hWnd,IDC_MSAA),FALSE);
|
| 673 | + cfg->msaa = 0;
|
| 674 | + }
|
| 675 | + // aspect3d
|
| 676 | + _tcscpy(buffer,_T("Stretch to display"));
|
| 677 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 678 | + _tcscpy(buffer,_T("Expand viewable area"));
|
| 679 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 680 | + _tcscpy(buffer,_T("Crop to display"));
|
| 681 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 682 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_SETCURSEL,cfg->aspect3d,0);
|
| 683 | + // sort modes
|
| 684 | + _tcscpy(buffer,_T("Use system order"));
|
| 685 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 686 | + _tcscpy(buffer,_T("Group by color depth"));
|
| 687 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 688 | + _tcscpy(buffer,_T("Group by resolution"));
|
| 689 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 690 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_SETCURSEL,cfg->SortModes,0);
|
| 691 | + // color depths
|
| 692 | + if(cfg->AllColorDepths) SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_CHECKED,0);
|
| 693 | + else SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETCHECK,BST_UNCHECKED,0);
|
| 694 | + // extra modes
|
| 695 | + if(cfg->ExtraModes) SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_CHECKED,0);
|
| 696 | + else SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_UNCHECKED,0);
|
| 697 | + // shader path
|
| 698 | + SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,FALSE);
|
| 699 | + // texture format
|
| 700 | + _tcscpy(buffer,_T("Automatic"));
|
| 701 | + SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 702 | + SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_SETCURSEL,cfg->TextureFormat,0);
|
| 703 | + // Texture upload
|
| 704 | + _tcscpy(buffer,_T("Automatic"));
|
| 705 | + SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 706 | + SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_SETCURSEL,cfg->TexUpload,0);
|
| 707 | + // DPI
|
| 708 | + _tcscpy(buffer, _T("Disabled"));
|
| 709 | + SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 710 | + _tcscpy(buffer, _T("Enabled"));
|
| 711 | + SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 712 | + _tcscpy(buffer, _T("Windows AppCompat"));
|
| 713 | + SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 714 | + SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);
|
| 715 | + // Add installed programs
|
| 716 | + current_app = 1;
|
| 717 | + appcount = 1;
|
| 718 | + regbuffersize = 1024;
|
| 719 | + regbuffer = (LPTSTR)malloc(regbuffersize*sizeof(TCHAR));
|
| 720 | + RegCreateKeyEx(HKEY_CURRENT_USER,_T("Software\\DXGL"),0,NULL,0,KEY_READ,NULL,&hKeyBase,NULL);
|
| 721 | + RegQueryInfoKey(hKeyBase,NULL,NULL,NULL,NULL,&keysize,NULL,NULL,NULL,NULL,NULL,NULL);
|
| 722 | + keysize++;
|
| 723 | + keyname = (LPTSTR)malloc(keysize*sizeof(TCHAR));
|
| 724 | + keysize2 = keysize;
|
| 725 | + i = 0;
|
| 726 | + while(RegEnumKeyEx(hKeyBase,i,keyname,&keysize2,NULL,NULL,NULL,NULL) == ERROR_SUCCESS)
|
| 727 | + {
|
| 728 | + keysize2 = keysize;
|
| 729 | + i++;
|
| 730 | + if(!_tcscmp(keyname,_T("Global"))) continue;
|
| 731 | + appcount++;
|
| 732 | + if(appcount > maxapps)
|
| 733 | + {
|
| 734 | + maxapps += 128;
|
| 735 | + apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
|
| 736 | + }
|
| 737 | + if(!_tcscmp(keyname,_T("DXGLTestApp"))) _tcscpy(subkey,_T("dxgltest.exe-0"));
|
| 738 | + else _tcscpy(subkey,keyname);
|
| 739 | + if (_tcsrchr(subkey, _T('-'))) *(_tcsrchr(subkey, _T('-'))) = 0;
|
| 740 | + error = RegOpenKeyEx(hKeyBase,keyname,0,KEY_READ,&hKey);
|
| 741 | + buffersize = regbuffersize;
|
| 742 | + RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
| 743 | + if(buffersize > regbuffersize)
|
| 744 | + {
|
| 745 | + regbuffersize = buffersize;
|
| 746 | + regbuffer = (LPTSTR)realloc(regbuffer,regbuffersize);
|
| 747 | + }
|
| 748 | + buffersize = regbuffersize;
|
| 749 | + regbuffer[0] = regbuffer[1] = 0;
|
| 750 | + error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
| 751 | + regbufferpos = 0;
|
| 752 | + apps[appcount - 1].regkey = (LPTSTR)malloc((_tcslen(keyname) + 1)*sizeof(TCHAR));
|
| 753 | + _tcscpy(apps[appcount - 1].regkey, keyname);
|
| 754 | + GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,keyname);
|
| 755 | + apps[appcount-1].dirty = FALSE;
|
| 756 | + while(1)
|
| 757 | + {
|
| 758 | + if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
|
| 759 | + {
|
| 760 | + // Default icon
|
| 761 | + apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
|
| 762 | + apps[appcount-1].icon_shared = TRUE;
|
| 763 | + apps[appcount-1].name = (TCHAR*)malloc((_tcslen(subkey)+1)*sizeof(TCHAR));
|
| 764 | + _tcscpy(apps[appcount-1].name,subkey);
|
| 765 | + break;
|
| 766 | + }
|
| 767 | + path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
|
| 768 | + _tcslen(subkey) + 2))*sizeof(TCHAR));
|
| 769 | + _tcscpy(path, (LPTSTR)regbuffer + regbufferpos);
|
| 770 | + _tcscat(path, _T("\\"));
|
| 771 | + _tcscat(path, subkey);
|
| 772 | + if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
|
| 773 | + {
|
| 774 | + regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
| 775 | + free(path);
|
| 776 | + continue;
|
| 777 | + }
|
| 778 | + // Get exe attributes
|
| 779 | + error = SHGetFileInfo(path,0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
|
| 780 | + apps[appcount-1].icon = fileinfo.hIcon;
|
| 781 | + apps[appcount-1].icon_shared = FALSE;
|
| 782 | + verinfosize = GetFileVersionInfoSize(path,NULL);
|
| 783 | + verinfo = malloc(verinfosize);
|
| 784 | + hasname = FALSE;
|
| 785 | + if(GetFileVersionInfo(path,0,verinfosize,verinfo))
|
| 786 | + {
|
| 787 | + if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
|
| 788 | + {
|
| 789 | + memcpy(translation,outbuffer,4);
|
| 790 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\"),translation[0],translation[1]);
|
| 791 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 792 | + {
|
| 793 | + hasname = TRUE;
|
| 794 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 795 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 796 | + }
|
| 797 | + else
|
| 798 | + {
|
| 799 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
| 800 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 801 | + {
|
| 802 | + hasname = TRUE;
|
| 803 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 804 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 805 | + }
|
| 806 | + else
|
| 807 | + {
|
| 808 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
| 809 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 810 | + {
|
| 811 | + hasname = TRUE;
|
| 812 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 813 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 814 | + }
|
| 815 | + }
|
| 816 | + }
|
| 817 | + }
|
| 818 | + }
|
| 819 | + free(path);
|
| 820 | + if (!hasname)
|
| 821 | + {
|
| 822 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(subkey) + 1)*sizeof(TCHAR));
|
| 823 | + _tcscpy(apps[appcount - 1].name, subkey);
|
| 824 | + }
|
| 825 | + free(verinfo);
|
| 826 | + break;
|
| 827 | + }
|
| 828 | + RegCloseKey(hKey);
|
| 829 | + }
|
| 830 | + RegCloseKey(hKeyBase);
|
| 831 | + free(keyname);
|
| 832 | + for(i = 0; i < appcount; i++)
|
| 833 | + {
|
| 834 | + SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[i].name);
|
| 835 | + }
|
| 836 | + current_app = 0;
|
| 837 | + SendDlgItemMessage(hWnd,IDC_APPS,LB_SETCURSEL,0,0);
|
| 838 | + if(osver.dwMajorVersion >= 6)
|
| 839 | + {
|
| 840 | + if(OpenProcessToken(GetCurrentProcess(),TOKEN_QUERY,&token))
|
| 841 | + {
|
| 842 | + if(GetTokenInformation(token,(TOKEN_INFORMATION_CLASS)TokenElevation,&elevation,sizeof(TOKEN_ELEVATION),(PDWORD)&outlen))
|
| 843 | + {
|
| 844 | + if(!elevation.TokenIsElevated)
|
| 845 | + {
|
| 846 | + SendDlgItemMessage(hWnd,IDC_ADD,BCM_SETSHIELD,0,TRUE);
|
| 847 | + SendDlgItemMessage(hWnd,IDC_REMOVE,BCM_SETSHIELD,0,TRUE);
|
| 848 | + }
|
| 849 | + }
|
| 850 | + }
|
| 851 | + }
|
| 852 | + else
|
| 853 | + {
|
| 854 | + EnableWindow(GetDlgItem(hWnd, IDC_DPISCALE), FALSE);
|
| 855 | + }
|
| 856 | + if(token) CloseHandle(token);
|
| 857 | + return TRUE;
|
| 858 | + case WM_MEASUREITEM:
|
| 859 | + switch(wParam)
|
| 860 | + {
|
| 861 | + case IDC_APPS:
|
| 862 | + ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYSMICON)+1;
|
| 863 | + ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXSMICON)+1;
|
| 864 | + default:
|
| 865 | + break;
|
| 866 | + }
|
| 867 | + break;
|
| 868 | + case WM_DRAWITEM:
|
| 869 | + switch(wParam)
|
| 870 | + {
|
| 871 | + case IDC_APPS:
|
| 872 | + OldTextColor = GetTextColor(drawitem->hDC);
|
| 873 | + OldBackColor = GetBkColor(drawitem->hDC);
|
| 874 | + if((drawitem->itemAction | ODA_SELECT) && (drawitem->itemState & ODS_SELECTED) &&
|
| 875 | + !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 876 | + {
|
| 877 | + SetTextColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHTTEXT));
|
| 878 | + SetBkColor(drawitem->hDC,GetSysColor(COLOR_HIGHLIGHT));
|
| 879 | + FillRect(drawitem->hDC,&drawitem->rcItem,(HBRUSH)(COLOR_HIGHLIGHT+1));
|
| 880 | + }
|
| 881 | + else ExtTextOut(drawitem->hDC,0,0,ETO_OPAQUE,&drawitem->rcItem,NULL,0,NULL);
|
| 882 | + DrawIconEx(drawitem->hDC,drawitem->rcItem.left+2,drawitem->rcItem.top,
|
| 883 | + apps[drawitem->itemID].icon,GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),0,NULL,DI_NORMAL);
|
| 884 | + drawitem->rcItem.left += GetSystemMetrics(SM_CXSMICON)+5;
|
| 885 | + DrawText(drawitem->hDC,apps[drawitem->itemID].name,
|
| 886 | + _tcslen(apps[drawitem->itemID].name),&drawitem->rcItem,
|
| 887 | + DT_LEFT|DT_SINGLELINE|DT_VCENTER);
|
| 888 | + SetTextColor(drawitem->hDC,OldTextColor);
|
| 889 | + SetBkColor(drawitem->hDC,OldBackColor);
|
| 890 | + DefWindowProc(hWnd,Msg,wParam,lParam);
|
| 891 | + break;
|
| 892 | + default:
|
| 893 | + break;
|
| 894 | + }
|
| 895 | + break;
|
| 896 | + case WM_HELP:
|
| 897 | + HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
|
| 898 | + return TRUE;
|
| 899 | + break;
|
| 900 | + case WM_SYSCOMMAND:
|
| 901 | + if(LOWORD(wParam) == SC_CONTEXTHELP)
|
| 902 | + {
|
| 903 | + HtmlHelp(hWnd,hlppath,HH_DISPLAY_TOPIC,(DWORD_PTR)_T("configuration.htm"));
|
| 904 | + return TRUE;
|
| 905 | + }
|
| 906 | + break;
|
| 907 | + case WM_COMMAND:
|
| 908 | + switch(LOWORD(wParam))
|
| 909 | + {
|
| 910 | + case IDOK:
|
| 911 | + SaveChanges(hWnd);
|
| 912 | + EndDialog(hWnd,IDOK);
|
| 913 | + return TRUE;
|
| 914 | + case IDCANCEL:
|
| 915 | + EndDialog(hWnd,IDCANCEL);
|
| 916 | + return TRUE;
|
| 917 | + case IDC_APPLY:
|
| 918 | + SaveChanges(hWnd);
|
| 919 | + return TRUE;
|
| 920 | + case IDC_APPS:
|
| 921 | + if(HIWORD(wParam) == LBN_SELCHANGE)
|
| 922 | + {
|
| 923 | + cursel = SendDlgItemMessage(hWnd,IDC_APPS,LB_GETCURSEL,0,0);
|
| 924 | + if(cursel == current_app) break;
|
| 925 | + current_app = cursel;
|
| 926 | + cfg = &apps[current_app].cfg;
|
| 927 | + cfgmask = &apps[current_app].mask;
|
| 928 | + dirty = &apps[current_app].dirty;
|
| 929 | + if(current_app)
|
| 930 | + {
|
| 931 | + if(!_tcscmp(apps[current_app].regkey,_T("DXGLTestApp"))) EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE);
|
| 932 | + else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),TRUE);
|
| 933 | + }
|
| 934 | + else EnableWindow(GetDlgItem(hWnd,IDC_REMOVE),FALSE);
|
| 935 | + // Set 3-state status
|
| 936 | + if(current_app && !tristate)
|
| 937 | + {
|
| 938 | + tristate = TRUE;
|
| 939 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 940 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 941 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 942 | + SendDlgItemMessage(hWnd,IDC_VSYNC,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 943 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 944 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 945 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 946 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 947 | + SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
| 948 | + SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
| 949 | + SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
| 950 | + SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTO3STATE,(LPARAM)TRUE);
|
| 951 | + SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 952 | + SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)strdefault);
|
| 953 | + SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_ADDSTRING, 0, (LPARAM)strdefault);
|
| 954 | + SendDlgItemMessage(hWnd, IDC_ASPECT, CB_ADDSTRING, 0, (LPARAM)strdefault);
|
| 955 | + }
|
| 956 | + else if(!current_app && tristate)
|
| 957 | + {
|
| 958 | + tristate = FALSE;
|
| 959 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_DELETESTRING,
|
| 960 | + SendDlgItemMessage(hWnd,IDC_VIDMODE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 961 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_DELETESTRING,
|
| 962 | + SendDlgItemMessage(hWnd,IDC_SORTMODES,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 963 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_DELETESTRING,
|
| 964 | + SendDlgItemMessage(hWnd,IDC_SCALE,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 965 | + SendDlgItemMessage(hWnd,IDC_VSYNC,CB_DELETESTRING,
|
| 966 | + SendDlgItemMessage(hWnd,IDC_VSYNC,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 967 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_DELETESTRING,
|
| 968 | + SendDlgItemMessage(hWnd,IDC_MSAA,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 969 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_DELETESTRING,
|
| 970 | + SendDlgItemMessage(hWnd,IDC_ANISO,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 971 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_DELETESTRING,
|
| 972 | + SendDlgItemMessage(hWnd,IDC_TEXFILTER,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 973 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_DELETESTRING,
|
| 974 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 975 | + SendDlgItemMessage(hWnd,IDC_COLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
| 976 | + SendDlgItemMessage(hWnd,IDC_HIGHRES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
| 977 | + SendDlgItemMessage(hWnd,IDC_UNCOMMONCOLOR,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
| 978 | + SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETSTYLE,BS_AUTOCHECKBOX,(LPARAM)TRUE);
|
| 979 | + SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_DELETESTRING,
|
| 980 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 981 | + SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_DELETESTRING,
|
| 982 | + SendDlgItemMessage(hWnd,IDC_ASPECT3D,CB_FINDSTRING,-1,(LPARAM)strdefault),0);
|
| 983 | + SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_DELETESTRING,
|
| 984 | + SendDlgItemMessage(hWnd, IDC_DPISCALE, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
| 985 | + SendDlgItemMessage(hWnd, IDC_ASPECT, CB_DELETESTRING,
|
| 986 | + SendDlgItemMessage(hWnd, IDC_ASPECT, CB_FINDSTRING, -1, (LPARAM)strdefault), 0);
|
| 987 | + }
|
| 988 | + // Read settings into controls
|
| 989 | + SetCombo(hWnd,IDC_VIDMODE,cfg->scaler,cfgmask->scaler,tristate);
|
| 990 | + SetCombo(hWnd,IDC_SORTMODES,cfg->SortModes,cfgmask->SortModes,tristate);
|
| 991 | + SetCombo(hWnd,IDC_SCALE,cfg->scalingfilter,cfgmask->scalingfilter,tristate);
|
| 992 | + SetCombo(hWnd,IDC_VSYNC,cfg->vsync,cfgmask->vsync,tristate);
|
| 993 | + SetCombo(hWnd,IDC_MSAA,cfg->msaa,cfgmask->msaa,tristate);
|
| 994 | + SetCombo(hWnd,IDC_ANISO,cfg->anisotropic,cfgmask->anisotropic,tristate);
|
| 995 | + SetCombo(hWnd,IDC_TEXFILTER,cfg->texfilter,cfgmask->texfilter,tristate);
|
| 996 | + SetCombo(hWnd,IDC_ASPECT3D,cfg->aspect3d,cfgmask->aspect3d,tristate);
|
| 997 | + SetCheck(hWnd,IDC_COLOR,cfg->colormode,cfgmask->colormode,tristate);
|
| 998 | + SetCheck(hWnd,IDC_HIGHRES,cfg->highres,cfgmask->highres,tristate);
|
| 999 | + SetCheck(hWnd,IDC_UNCOMMONCOLOR,cfg->AllColorDepths,cfgmask->AllColorDepths,tristate);
|
| 1000 | + SetCombo(hWnd,IDC_TEXTUREFORMAT,cfg->TextureFormat,cfgmask->TextureFormat,tristate);
|
| 1001 | + SetCombo(hWnd,IDC_TEXUPLOAD,cfg->TexUpload,cfgmask->TexUpload,tristate);
|
| 1002 | + SetCheck(hWnd,IDC_EXTRAMODES,cfg->ExtraModes,cfgmask->ExtraModes,tristate);
|
| 1003 | + SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,tristate);
|
| 1004 | + SetCombo(hWnd, IDC_DPISCALE, cfg->DPIScale, cfgmask->DPIScale, tristate);
|
| 1005 | + SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
| 1006 | + }
|
| 1007 | + case IDC_VIDMODE:
|
| 1008 | + cfg->scaler = GetCombo(hWnd,IDC_VIDMODE,&cfgmask->scaler);
|
| 1009 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1010 | + *dirty = TRUE;
|
| 1011 | + break;
|
| 1012 | + case IDC_SORTMODES:
|
| 1013 | + cfg->SortModes = GetCombo(hWnd,IDC_SORTMODES,&cfgmask->SortModes);
|
| 1014 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1015 | + *dirty = TRUE;
|
| 1016 | + break;
|
| 1017 | + case IDC_SCALE:
|
| 1018 | + cfg->scalingfilter = GetCombo(hWnd,IDC_SCALE,&cfgmask->scalingfilter);
|
| 1019 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1020 | + *dirty = TRUE;
|
| 1021 | + break;
|
| 1022 | + case IDC_VSYNC:
|
| 1023 | + cfg->vsync = GetCombo(hWnd,IDC_VSYNC,&cfgmask->vsync);
|
| 1024 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1025 | + *dirty = TRUE;
|
| 1026 | + break;
|
| 1027 | + case IDC_MSAA:
|
| 1028 | + cfg->msaa = GetCombo(hWnd,IDC_MSAA,&cfgmask->msaa);
|
| 1029 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1030 | + *dirty = TRUE;
|
| 1031 | + break;
|
| 1032 | + case IDC_ANISO:
|
| 1033 | + cfg->anisotropic = GetCombo(hWnd,IDC_ANISO,&cfgmask->anisotropic);
|
| 1034 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1035 | + *dirty = TRUE;
|
| 1036 | + break;
|
| 1037 | + case IDC_TEXFILTER:
|
| 1038 | + cfg->texfilter = GetCombo(hWnd,IDC_TEXFILTER,&cfgmask->texfilter);
|
| 1039 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1040 | + *dirty = TRUE;
|
| 1041 | + break;
|
| 1042 | + case IDC_ASPECT3D:
|
| 1043 | + cfg->aspect3d = GetCombo(hWnd,IDC_ASPECT3D,&cfgmask->aspect3d);
|
| 1044 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1045 | + *dirty = TRUE;
|
| 1046 | + break;
|
| 1047 | + case IDC_COLOR:
|
| 1048 | + cfg->colormode = GetCheck(hWnd,IDC_COLOR,&cfgmask->colormode);
|
| 1049 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1050 | + *dirty = TRUE;
|
| 1051 | + break;
|
| 1052 | + case IDC_HIGHRES:
|
| 1053 | + cfg->highres = GetCheck(hWnd,IDC_HIGHRES,&cfgmask->highres);
|
| 1054 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1055 | + *dirty = TRUE;
|
| 1056 | + break;
|
| 1057 | + case IDC_UNCOMMONCOLOR:
|
| 1058 | + cfg->AllColorDepths = GetCheck(hWnd,IDC_UNCOMMONCOLOR,&cfgmask->AllColorDepths);
|
| 1059 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1060 | + *dirty = TRUE;
|
| 1061 | + break;
|
| 1062 | + case IDC_EXTRAMODES:
|
| 1063 | + cfg->ExtraModes = GetCheck(hWnd,IDC_EXTRAMODES,&cfgmask->ExtraModes);
|
| 1064 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1065 | + *dirty = TRUE;
|
| 1066 | + break;
|
| 1067 | + case IDC_TEXTUREFORMAT:
|
| 1068 | + cfg->TextureFormat = GetCombo(hWnd,IDC_TEXTUREFORMAT,&cfgmask->TextureFormat);
|
| 1069 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1070 | + *dirty = TRUE;
|
| 1071 | + break;
|
| 1072 | + case IDC_TEXUPLOAD:
|
| 1073 | + cfg->TexUpload = GetCombo(hWnd,IDC_TEXUPLOAD,&cfgmask->TexUpload);
|
| 1074 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1075 | + *dirty = TRUE;
|
| 1076 | + break;
|
| 1077 | + case IDC_DPISCALE:
|
| 1078 | + cfg->DPIScale = GetCombo(hWnd,IDC_DPISCALE,&cfgmask->DPIScale);
|
| 1079 | + EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
|
| 1080 | + *dirty = TRUE;
|
| 1081 | + break;
|
| 1082 | + case IDC_SHADER:
|
| 1083 | + if(HIWORD(wParam) == EN_CHANGE)
|
| 1084 | + {
|
| 1085 | + GetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile);
|
| 1086 | + EnableWindow(GetDlgItem(hWnd,IDC_APPLY),TRUE);
|
| 1087 | + *dirty = TRUE;
|
| 1088 | + }
|
| 1089 | + break;
|
| 1090 | + case IDC_ASPECT:
|
| 1091 | + if (HIWORD(wParam) == CBN_KILLFOCUS)
|
| 1092 | + {
|
| 1093 | + cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, &cfgmask->aspect);
|
| 1094 | + SetAspectCombo(hWnd, IDC_ASPECT, cfg->aspect, cfgmask->aspect, tristate);
|
| 1095 | + EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
|
| 1096 | + *dirty = TRUE;
|
| 1097 | + }
|
| 1098 | + else if (HIWORD(wParam) == CBN_SELCHANGE)
|
| 1099 | + {
|
| 1100 | + cfg->aspect = GetAspectCombo(hWnd, IDC_ASPECT, &cfgmask->aspect);
|
| 1101 | + EnableWindow(GetDlgItem(hWnd, IDC_APPLY), TRUE);
|
| 1102 | + *dirty = TRUE;
|
| 1103 | + }
|
| 1104 | + break;
|
| 1105 | + case IDC_ADD:
|
| 1106 | + selectedfile[0] = 0;
|
| 1107 | + ZeroMemory(&filename,OPENFILENAME_SIZE_VERSION_400);
|
| 1108 | + filename.lStructSize = OPENFILENAME_SIZE_VERSION_400;
|
| 1109 | + filename.hwndOwner = hWnd;
|
| 1110 | + filename.lpstrFilter = exe_filter;
|
| 1111 | + filename.lpstrFile = selectedfile;
|
| 1112 | + filename.nMaxFile = MAX_PATH+1;
|
| 1113 | + filename.lpstrInitialDir = _T("%ProgramFiles%");
|
| 1114 | + filename.lpstrTitle = _T("Select program");
|
| 1115 | + filename.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
|
| 1116 | + if(GetOpenFileName(&filename))
|
| 1117 | + {
|
| 1118 | + DWORD err = AddApp(filename.lpstrFile,TRUE,FALSE);
|
| 1119 | + if(!err)
|
| 1120 | + {
|
| 1121 | + LPTSTR newkey = MakeNewConfig(filename.lpstrFile);
|
| 1122 | + LPTSTR newkey2 = (LPTSTR)malloc((_tcslen(newkey) + 15)*sizeof(TCHAR));
|
| 1123 | + _tcscpy(newkey2, _T("Software\\DXGL\\"));
|
| 1124 | + _tcscat(newkey2,newkey);
|
| 1125 | + appcount++;
|
| 1126 | + if(appcount > maxapps)
|
| 1127 | + {
|
| 1128 | + maxapps += 128;
|
| 1129 | + apps = (app_setting *)realloc(apps,maxapps*sizeof(app_setting));
|
| 1130 | + }
|
| 1131 | + RegOpenKeyEx(HKEY_CURRENT_USER,newkey2,0,KEY_READ,&hKey);
|
| 1132 | + RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
| 1133 | + regbuffer = (LPTSTR)malloc(buffersize);
|
| 1134 | + regbuffer[0] = regbuffer[1] = 0;
|
| 1135 | + error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
| 1136 | + regbufferpos = 0;
|
| 1137 | + apps[appcount - 1].regkey = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
|
| 1138 | + _tcscpy(apps[appcount - 1].regkey, newkey);
|
| 1139 | + GetConfig(&apps[appcount-1].cfg,&apps[appcount-1].mask,newkey);
|
| 1140 | + apps[appcount-1].dirty = FALSE;
|
| 1141 | + free(newkey2);
|
| 1142 | + while(1)
|
| 1143 | + {
|
| 1144 | + if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS)
|
| 1145 | + {
|
| 1146 | + // Default icon
|
| 1147 | + apps[appcount-1].icon = LoadIcon(NULL,IDI_APPLICATION);
|
| 1148 | + apps[appcount-1].icon_shared = TRUE;
|
| 1149 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
|
| 1150 | + _tcscpy(apps[appcount - 1].name, newkey);
|
| 1151 | + break;
|
| 1152 | + }
|
| 1153 | + if (_tcsrchr(newkey, _T('-'))) *(_tcsrchr(newkey, _T('-'))) = 0;
|
| 1154 | + path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
|
| 1155 | + _tcslen(newkey) + 2))*sizeof(TCHAR));
|
| 1156 | + _tcscpy(path, (LPTSTR)regbuffer + regbufferpos);
|
| 1157 | + _tcscat(path, _T("\\"));
|
| 1158 | + _tcscat(path, newkey);
|
| 1159 | + if (GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
|
| 1160 | + {
|
| 1161 | + regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
| 1162 | + free(path);
|
| 1163 | + continue;
|
| 1164 | + }
|
| 1165 | + // Get exe attributes
|
| 1166 | + error = SHGetFileInfo(path,0,&fileinfo,sizeof(SHFILEINFO),SHGFI_ICON|SHGFI_SMALLICON|SHGFI_ADDOVERLAYS);
|
| 1167 | + apps[appcount-1].icon = fileinfo.hIcon;
|
| 1168 | + apps[appcount-1].icon_shared = FALSE;
|
| 1169 | + verinfosize = GetFileVersionInfoSize(path,NULL);
|
| 1170 | + verinfo = malloc(verinfosize);
|
| 1171 | + hasname = FALSE;
|
| 1172 | + if(GetFileVersionInfo(path,0,verinfosize,verinfo))
|
| 1173 | + {
|
| 1174 | + if(VerQueryValue(verinfo,_T("\\VarFileInfo\\Translation"),(LPVOID*)&outbuffer,&outlen))
|
| 1175 | + {
|
| 1176 | + memcpy(translation,outbuffer,4);
|
| 1177 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\FileDescription"),translation[0],translation[1]);
|
| 1178 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 1179 | + {
|
| 1180 | + hasname = TRUE;
|
| 1181 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 1182 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 1183 | + }
|
| 1184 | + else
|
| 1185 | + {
|
| 1186 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\ProductName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
| 1187 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 1188 | + {
|
| 1189 | + hasname = TRUE;
|
| 1190 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 1191 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 1192 | + }
|
| 1193 | + else
|
| 1194 | + {
|
| 1195 | + _sntprintf(verpath,64,_T("\\StringFileInfo\\%04x%04x\\InternalName"),((WORD*)outbuffer)[0],((WORD*)outbuffer)[1]);
|
| 1196 | + if(VerQueryValue(verinfo,verpath,(LPVOID*)&outbuffer,&outlen))
|
| 1197 | + {
|
| 1198 | + hasname = TRUE;
|
| 1199 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(outbuffer) + 1)*sizeof(TCHAR));
|
| 1200 | + _tcscpy(apps[appcount - 1].name, outbuffer);
|
| 1201 | + }
|
| 1202 | + }
|
| 1203 | + }
|
| 1204 | + }
|
| 1205 | + }
|
| 1206 | + if (!hasname)
|
| 1207 | + {
|
| 1208 | + apps[appcount - 1].name = (LPTSTR)malloc((_tcslen(newkey) + 1)*sizeof(TCHAR));
|
| 1209 | + _tcscpy(apps[appcount - 1].name, newkey);
|
| 1210 | + }
|
| 1211 | + free(verinfo);
|
| 1212 | + free(path);
|
| 1213 | + break;
|
| 1214 | + }
|
| 1215 | + SendDlgItemMessage(hWnd,IDC_APPS,LB_ADDSTRING,0,(LPARAM)apps[appcount-1].name);
|
| 1216 | + RegCloseKey(hKey);
|
| 1217 | + free(regbuffer);
|
| 1218 | + }
|
| 1219 | + }
|
| 1220 | +
|
| 1221 | + break;
|
| 1222 | + case IDC_REMOVE:
|
| 1223 | + if(MessageBox(hWnd,_T("Do you want to delete the selected application profile and remove DXGL from its installation folder(s)?"),
|
| 1224 | + _T("Confirmation"),MB_YESNO|MB_ICONQUESTION) != IDYES) return FALSE;
|
| 1225 | + regpath = (LPTSTR)malloc((_tcslen(apps[current_app].regkey) + 15)*sizeof(TCHAR));
|
| 1226 | + _tcscpy(regpath, _T("Software\\DXGL\\"));
|
| 1227 | + _tcscat(regpath, apps[current_app].regkey);
|
| 1228 | + regkey = (LPTSTR)malloc(_tcslen(apps[current_app].regkey));
|
| 1229 | + _tcscpy(regkey, apps[current_app].regkey);
|
| 1230 | + RegOpenKeyEx(HKEY_CURRENT_USER,regpath,0,KEY_READ,&hKey);
|
| 1231 | + RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,NULL,&buffersize);
|
| 1232 | + regbuffer = (LPTSTR)malloc(buffersize);
|
| 1233 | + regbuffer[0] = regbuffer[1] = 0;
|
| 1234 | + error = RegQueryValueEx(hKey,_T("InstallPaths"),NULL,NULL,(LPBYTE)regbuffer,&buffersize);
|
| 1235 | + regbufferpos = 0;
|
| 1236 | + failed = FALSE;
|
| 1237 | + while(1)
|
| 1238 | + {
|
| 1239 | + if((regbuffer[regbufferpos] == 0) || error != ERROR_SUCCESS) break;
|
| 1240 | + if (_tcsrchr(regkey, _T('-'))) *(_tcsrchr(regkey, _T('-'))) = 0;
|
| 1241 | + path = (LPTSTR)malloc(((_tcslen((LPTSTR)regbuffer + regbufferpos) +
|
| 1242 | + 12))*sizeof(TCHAR));
|
| 1243 | + _tcscpy(path, regbuffer + regbufferpos);
|
| 1244 | + _tcscat(path, _T("\\ddraw.dll"));
|
| 1245 | + if(GetFileAttributes(path) == INVALID_FILE_ATTRIBUTES)
|
| 1246 | + {
|
| 1247 | + regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
| 1248 | + free(path);
|
| 1249 | + continue;
|
| 1250 | + }
|
| 1251 | + if(DelApp(path,FALSE)) failed = TRUE;
|
| 1252 | + regbufferpos += (_tcslen(regbuffer+regbufferpos)+1);
|
| 1253 | + free(path);
|
| 1254 | + }
|
| 1255 | + RegCloseKey(hKey);
|
| 1256 | + if(!failed)
|
| 1257 | + {
|
| 1258 | + RegDeleteKey(HKEY_CURRENT_USER,regpath);
|
| 1259 | + if(!apps[current_app].icon_shared) DeleteObject(apps[current_app].icon);
|
| 1260 | + if(apps[current_app].name) free(apps[current_app].name);
|
| 1261 | + if(apps[current_app].regkey) free(apps[current_app].regkey);
|
| 1262 | + for(i = current_app; i < appcount; i++)
|
| 1263 | + {
|
| 1264 | + apps[i] = apps[i+1];
|
| 1265 | + }
|
| 1266 | + appcount--;
|
| 1267 | + }
|
| 1268 | + SendDlgItemMessage(hWnd,IDC_APPS,LB_DELETESTRING,current_app,0);
|
| 1269 | + break;
|
| 1270 | + }
|
| 1271 | + break;
|
| 1272 | + }
|
| 1273 | + return FALSE;
|
| 1274 | +}
|
| 1275 | +
|
| 1276 | +int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
| 1277 | +{
|
| 1278 | + INITCOMMONCONTROLSEX icc;
|
| 1279 | + HMODULE comctl32;
|
| 1280 | + BOOL(WINAPI *iccex)(LPINITCOMMONCONTROLSEX lpInitCtrls);
|
| 1281 | + osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
|
| 1282 | + GetVersionEx(&osver);
|
| 1283 | + CoInitialize(NULL);
|
| 1284 | + if(!_tcsnicmp(lpCmdLine,_T("install "),8))
|
| 1285 | + {
|
| 1286 | + return AddApp(lpCmdLine+8,TRUE,TRUE);
|
| 1287 | + }
|
| 1288 | + if(!_tcsnicmp(lpCmdLine,_T("remove "),7))
|
| 1289 | + {
|
| 1290 | + return DelApp(lpCmdLine+7,TRUE);
|
| 1291 | + }
|
| 1292 | + icc.dwSize = sizeof(icc);
|
| 1293 | + icc.dwICC = ICC_WIN95_CLASSES;
|
| 1294 | + comctl32 = LoadLibrary(_T("comctl32.dll"));
|
| 1295 | + iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
| 1296 | + if(iccex) iccex(&icc);
|
| 1297 | + else InitCommonControls();
|
| 1298 | + hinstance = hInstance;
|
| 1299 | + GetModuleFileName(NULL,hlppath,MAX_PATH);
|
| 1300 | + GetDirFromPath(hlppath);
|
| 1301 | + _tcscat(hlppath,_T("\\dxgl.chm"));
|
| 1302 | + DialogBox(hInstance,MAKEINTRESOURCE(IDD_DXGLCFG),0,(DLGPROC)DXGLCfgCallback);
|
| 1303 | + return 0;
|
| 1304 | +}
|
Index: dxglcfg/dxglcfg.vcxproj |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | <ClInclude Include="resource.h" />
|
187 | 187 | </ItemGroup>
|
188 | 188 | <ItemGroup>
|
189 | | - <ClCompile Include="dxglcfg.cpp" />
|
| 189 | + <ClCompile Include="dxglcfg.c" />
|
190 | 190 | </ItemGroup>
|
191 | 191 | <ItemGroup>
|
192 | 192 | <Manifest Include="xp.manifest" />
|
Index: dxglcfg/dxglcfg.vcxproj.filters |
— | — | @@ -25,13 +25,13 @@ |
26 | 26 | </ClInclude>
|
27 | 27 | </ItemGroup>
|
28 | 28 | <ItemGroup>
|
29 | | - <ClCompile Include="dxglcfg.cpp">
|
30 | | - <Filter>Source Files</Filter>
|
31 | | - </ClCompile>
|
32 | | - </ItemGroup>
|
33 | | - <ItemGroup>
|
34 | 29 | <Manifest Include="xp.manifest">
|
35 | 30 | <Filter>Resource Files</Filter>
|
36 | 31 | </Manifest>
|
37 | 32 | </ItemGroup>
|
| 33 | + <ItemGroup>
|
| 34 | + <ClCompile Include="dxglcfg.c">
|
| 35 | + <Filter>Source Files</Filter>
|
| 36 | + </ClCompile>
|
| 37 | + </ItemGroup>
|
38 | 38 | </Project> |
\ No newline at end of file |