Index: cfgmgr/ReadMe.txt |
— | — | @@ -92,6 +92,10 @@ |
93 | 93 | 1 - Expand viewable area. May have glitches on edge of screen.
|
94 | 94 | 2 - Crop to viewable area. May cause graphics to get cut off.
|
95 | 95 |
|
| 96 | +Member EnableShader
|
| 97 | +REG_DWORD HKCU\DXGL\<app>\EnableShader
|
| 98 | +If nonzero, enables post-process shaders.
|
| 99 | +
|
96 | 100 | Member shaderfile
|
97 | 101 | REG_SZ HKCU\DXGL\<app>\ShaderFile
|
98 | 102 | Full path to file containing a post-process shader script.
|
Index: cfgmgr/cfgmgr.c |
— | — | @@ -440,6 +440,7 @@ |
441 | 441 | cfg->primaryscale = ReadDWORD(hKey,cfg->primaryscale,&cfgmask->primaryscale,_T("AdjustPrimaryResolution"));
|
442 | 442 | cfg->primaryscalex = ReadFloat(hKey,cfg->primaryscalex,&cfgmask->primaryscalex,_T("PrimaryScaleX"));
|
443 | 443 | cfg->primaryscaley = ReadFloat(hKey,cfg->primaryscaley,&cfgmask->primaryscaley,_T("PrimaryScaleY"));
|
| 444 | + cfg->EnableShader = ReadBool(hKey, cfg->EnableShader, &cfgmask->EnableShader, _T("EnableShader"));
|
444 | 445 | ReadPath(hKey,cfg->shaderfile,cfgmask->shaderfile,_T("ShaderFile"));
|
445 | 446 | cfg->SortModes = ReadDWORD(hKey,cfg->SortModes,&cfgmask->SortModes,_T("SortModes"));
|
446 | 447 | cfg->AddColorDepths = ReadDeprecatedBool(hKey, cfg->AddColorDepths, &cfgmask->AddColorDepths, _T("AllColorDepths"), 1 | 4 | 16, 0);
|
— | — | @@ -532,6 +533,7 @@ |
533 | 534 | WriteBool(hKey,cfg->primaryscale,cfgmask->primaryscale,_T("AdjustPrimaryResolution"));
|
534 | 535 | WriteFloat(hKey,cfg->primaryscalex,cfgmask->primaryscalex,_T("PrimaryScaleX"));
|
535 | 536 | WriteFloat(hKey,cfg->primaryscaley,cfgmask->primaryscaley,_T("PrimaryScaleY"));
|
| 537 | + WriteBool(hKey, cfg->EnableShader, cfgmask->EnableShader, _T("EnableShader"));
|
536 | 538 | WritePath(hKey,cfg->shaderfile,cfgmask->shaderfile,_T("ShaderFile"));
|
537 | 539 | WriteDWORD(hKey,cfg->SortModes,cfgmask->SortModes,_T("SortModes"));
|
538 | 540 | WriteBool(hKey,cfg->AddColorDepths,cfgmask->AddColorDepths,_T("AddColorDepths"));
|
Index: cfgmgr/cfgmgr.h |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | float primaryscalex;
|
38 | 38 | float primaryscaley;
|
39 | 39 | DWORD vsync;
|
| 40 | + BOOL EnableShader;
|
40 | 41 | TCHAR shaderfile[MAX_PATH+1];
|
41 | 42 | DWORD SortModes;
|
42 | 43 | DWORD AddColorDepths;
|
Index: dxglcfg2/dxglcfg2.c |
— | — | @@ -22,7 +22,6 @@ |
23 | 23 | #include <stdlib.h>
|
24 | 24 | #include <crtdbg.h>
|
25 | 25 | #include <windows.h>
|
26 | | -#include <windowsx.h>
|
27 | 26 | #include <HtmlHelp.h>
|
28 | 27 | #include <CommCtrl.h>
|
29 | 28 | #include <string.h>
|
— | — | @@ -30,6 +29,8 @@ |
31 | 30 | #include <stdio.h>
|
32 | 31 | #include <math.h>
|
33 | 32 | #include <io.h>
|
| 33 | +#include <Uxtheme.h>
|
| 34 | +#include <Vsstyle.h>
|
34 | 35 | #include "resource.h"
|
35 | 36 | #include "../cfgmgr/cfgmgr.h"
|
36 | 37 | #include <gl/GL.h>
|
— | — | @@ -56,7 +57,14 @@ |
57 | 58 | const char *extensions_string = NULL;
|
58 | 59 | OSVERSIONINFO osver;
|
59 | 60 | TCHAR hlppath[MAX_PATH+16];
|
| 61 | +HMODULE uxtheme = NULL;
|
| 62 | +HTHEME hThemeDisplay = NULL;
|
| 63 | +HTHEME(WINAPI *_OpenThemeData)(HWND hwnd, LPCWSTR pszClassList) = NULL;
|
| 64 | +HRESULT(WINAPI *_CloseThemeData)(HTHEME hTheme) = NULL;
|
| 65 | +HRESULT(WINAPI *_DrawThemeBackground)(HTHEME hTheme, HDC hdc, int iPartID,
|
| 66 | + int iStateID, const RECT *pRect, const RECT *pClipRect) = NULL;
|
60 | 67 |
|
| 68 | +
|
61 | 69 | typedef struct
|
62 | 70 | {
|
63 | 71 | LPTSTR regkey;
|
— | — | @@ -115,10 +123,6 @@ |
116 | 124 | _T("8/15/16/24/32-bit")
|
117 | 125 | };
|
118 | 126 |
|
119 | | -LRESULT CALLBACK CheckedComboProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
120 | | -{
|
121 | | -}
|
122 | | -
|
123 | 127 | DWORD AddApp(LPCTSTR path, BOOL copyfile, BOOL admin)
|
124 | 128 | {
|
125 | 129 | BOOL installed = FALSE;
|
— | — | @@ -266,6 +270,7 @@ |
267 | 271 | float fract;
|
268 | 272 | TCHAR denominator[5];
|
269 | 273 | int i;
|
| 274 | + if (_isnan(f)) f = 0; //Handle NAN condition
|
270 | 275 | if (f >= 1000.0f) // Clamp ridiculously wide aspects
|
271 | 276 | {
|
272 | 277 | _tcscpy(aspect, _T("1000:1"));
|
— | — | @@ -469,10 +474,65 @@ |
470 | 475 | }
|
471 | 476 | LRESULT CALLBACK DisplayTabCallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
472 | 477 | {
|
| 478 | + DRAWITEMSTRUCT* drawitem;
|
| 479 | + COLORREF OldTextColor, OldBackColor;
|
| 480 | + RECT r;
|
| 481 | + TCHAR combotext[64];
|
473 | 482 | switch (Msg)
|
474 | 483 | {
|
475 | 484 | case WM_INITDIALOG:
|
| 485 | + if (uxtheme) hThemeDisplay = _OpenThemeData(hWnd, L"Button");
|
| 486 | + else hThemeDisplay = NULL;
|
476 | 487 | return TRUE;
|
| 488 | + case WM_MEASUREITEM:
|
| 489 | + switch (wParam)
|
| 490 | + {
|
| 491 | + case IDC_EXTRAMODES:
|
| 492 | + ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYMENUCHECK);
|
| 493 | + ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXMENUCHECK);
|
| 494 | + break;
|
| 495 | + default:
|
| 496 | + break;
|
| 497 | + }
|
| 498 | + case WM_DRAWITEM:
|
| 499 | + drawitem = (DRAWITEMSTRUCT*)lParam;
|
| 500 | + switch (wParam)
|
| 501 | + {
|
| 502 | + case IDC_EXTRAMODES:
|
| 503 | + OldTextColor = GetTextColor(drawitem->hDC);
|
| 504 | + OldBackColor = GetBkColor(drawitem->hDC);
|
| 505 | + if ((drawitem->itemAction | ODA_SELECT) && (drawitem->itemState & ODS_SELECTED) &&
|
| 506 | + !(drawitem->itemState & ODS_COMBOBOXEDIT))
|
| 507 | + {
|
| 508 | + SetTextColor(drawitem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT));
|
| 509 | + SetBkColor(drawitem->hDC, GetSysColor(COLOR_HIGHLIGHT));
|
| 510 | + FillRect(drawitem->hDC, &drawitem->rcItem, (HBRUSH)(COLOR_HIGHLIGHT + 1));
|
| 511 | + }
|
| 512 | + else ExtTextOut(drawitem->hDC, 0, 0, ETO_OPAQUE, &drawitem->rcItem, NULL, 0, NULL);
|
| 513 | + memcpy(&r, &drawitem->rcItem, sizeof(RECT));
|
| 514 | + r.left = r.left + 2;
|
| 515 | + r.right = r.left + GetSystemMetrics(SM_CXMENUCHECK);
|
| 516 | + if (hThemeDisplay) _DrawThemeBackground(hThemeDisplay, drawitem->hDC, BS_AUTOCHECKBOX,
|
| 517 | + CBS_CHECKEDNORMAL, &r, NULL);
|
| 518 | + else DrawFrameControl(drawitem->hDC, &r, DFC_BUTTON, DFCS_BUTTONCHECK | DFCS_CHECKED | DFCS_HOT);
|
| 519 | + drawitem->rcItem.left += GetSystemMetrics(SM_CXMENUCHECK) + 5;
|
| 520 | + combotext[0] = 0;
|
| 521 | + SendDlgItemMessage(hWnd, IDC_EXTRAMODES, CB_GETLBTEXT, drawitem->itemID, combotext);
|
| 522 | + DrawText(drawitem->hDC, combotext, _tcslen(combotext), &drawitem->rcItem,
|
| 523 | + DT_LEFT | DT_SINGLELINE | DT_VCENTER);
|
| 524 | + SetTextColor(drawitem->hDC, OldTextColor);
|
| 525 | + SetBkColor(drawitem->hDC, OldBackColor);
|
| 526 | + DefWindowProc(hWnd, Msg, wParam, lParam);
|
| 527 | + break;
|
| 528 | + default:
|
| 529 | + break;
|
| 530 | + }
|
| 531 | + case WM_THEMECHANGED:
|
| 532 | + if (uxtheme)
|
| 533 | + {
|
| 534 | + if (hThemeDisplay) _CloseThemeData(hThemeDisplay);
|
| 535 | + _OpenThemeData(hWnd, L"Button");
|
| 536 | + }
|
477 | 537 | default:
|
478 | 538 | return FALSE;
|
479 | 539 | }
|
— | — | @@ -588,7 +648,6 @@ |
589 | 649 | NMHDR *nm;
|
590 | 650 | int newtab;
|
591 | 651 | TCITEM tab;
|
592 | | - drawitem = (DRAWITEMSTRUCT*)lParam;
|
593 | 652 | switch (Msg)
|
594 | 653 | {
|
595 | 654 | case WM_INITDIALOG:
|
— | — | @@ -641,6 +700,21 @@ |
642 | 701 | wglDeleteContext(rc);
|
643 | 702 | ReleaseDC(hGLWnd,dc);
|
644 | 703 | DestroyWindow(hGLWnd);
|
| 704 | + uxtheme = LoadLibrary(_T("uxtheme.dll"));
|
| 705 | + if (uxtheme)
|
| 706 | + {
|
| 707 | +
|
| 708 | + _OpenThemeData = (HTHEME(WINAPI*)(HWND,LPCWSTR))GetProcAddress(uxtheme, "OpenThemeData");
|
| 709 | + _CloseThemeData = (HRESULT(WINAPI*)(HTHEME))GetProcAddress(uxtheme, "CloseThemeData");
|
| 710 | + _DrawThemeBackground =
|
| 711 | + (HRESULT(WINAPI*)(HTHEME, HDC, int, int, const RECT*, const RECT*))
|
| 712 | + GetProcAddress(uxtheme, "DrawThemeBackground");
|
| 713 | + if (!(_OpenThemeData && _CloseThemeData && _DrawThemeBackground))
|
| 714 | + {
|
| 715 | + FreeLibrary(uxtheme);
|
| 716 | + uxtheme = NULL;
|
| 717 | + }
|
| 718 | + }
|
645 | 719 | // Add tabs
|
646 | 720 | ZeroMemory(&tab, sizeof(TCITEM));
|
647 | 721 | tab.mask = TCIF_TEXT;
|
— | — | @@ -864,27 +938,34 @@ |
865 | 939 | SendDlgItemMessage(hTabs[0], IDC_COLORDEPTH, CB_ADDSTRING, i, (LPARAM)buffer);
|
866 | 940 | }
|
867 | 941 | SendDlgItemMessage(hTabs[0], IDC_COLORDEPTH, CB_SETCURSEL, cfg->AddColorDepths, 0);
|
868 | | - /*// extra modes
|
869 | | - if(cfg->ExtraModes) SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_CHECKED,0);
|
870 | | - else SendDlgItemMessage(hWnd,IDC_EXTRAMODES,BM_SETCHECK,BST_UNCHECKED,0);
|
| 942 | + _tcscpy(buffer, _T("Common low resolutions"));
|
| 943 | + SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 0, (LPARAM)buffer);
|
| 944 | + _tcscpy(buffer, _T("Uncommon low resolutions"));
|
| 945 | + SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 1, (LPARAM)buffer);
|
| 946 | + _tcscpy(buffer, _T("Higher resolutions"));
|
| 947 | + SendDlgItemMessage(hTabs[0], IDC_EXTRAMODES, CB_ADDSTRING, 2, (LPARAM)buffer);
|
| 948 | + //FIXME: Populate extra resolution combobox
|
| 949 | + // Enable shader
|
| 950 | + if (cfg->colormode) SendDlgItemMessage(hTabs[2], IDC_USESHADER, BM_SETCHECK, BST_CHECKED, 0);
|
| 951 | + else SendDlgItemMessage(hTabs[2], IDC_USESHADER, BM_SETCHECK, BST_UNCHECKED, 0);
|
871 | 952 | // shader path
|
872 | | - SetText(hWnd,IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,FALSE);
|
| 953 | + SetText(hTabs[2],IDC_SHADER,cfg->shaderfile,cfgmask->shaderfile,FALSE);
|
873 | 954 | // texture format
|
874 | 955 | _tcscpy(buffer,_T("Automatic"));
|
875 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)buffer);
|
876 | | - SendDlgItemMessage(hWnd,IDC_TEXTUREFORMAT,CB_SETCURSEL,cfg->TextureFormat,0);
|
| 956 | + SendDlgItemMessage(hTabs[3],IDC_TEXTUREFORMAT,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 957 | + SendDlgItemMessage(hTabs[3],IDC_TEXTUREFORMAT,CB_SETCURSEL,cfg->TextureFormat,0);
|
877 | 958 | // Texture upload
|
878 | 959 | _tcscpy(buffer,_T("Automatic"));
|
879 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)buffer);
|
880 | | - SendDlgItemMessage(hWnd,IDC_TEXUPLOAD,CB_SETCURSEL,cfg->TexUpload,0);
|
| 960 | + SendDlgItemMessage(hTabs[3],IDC_TEXUPLOAD,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 961 | + SendDlgItemMessage(hTabs[3],IDC_TEXUPLOAD,CB_SETCURSEL,cfg->TexUpload,0);
|
881 | 962 | // DPI
|
882 | 963 | _tcscpy(buffer, _T("Disabled"));
|
883 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
| 964 | + SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,0,(LPARAM)buffer);
|
884 | 965 | _tcscpy(buffer, _T("Enabled"));
|
885 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
| 966 | + SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,1,(LPARAM)buffer);
|
886 | 967 | _tcscpy(buffer, _T("Windows AppCompat"));
|
887 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
888 | | - SendDlgItemMessage(hWnd,IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);*/
|
| 968 | + SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_ADDSTRING,2,(LPARAM)buffer);
|
| 969 | + SendDlgItemMessage(hTabs[0],IDC_DPISCALE,CB_SETCURSEL,cfg->DPIScale,0);
|
889 | 970 | // Add installed programs
|
890 | 971 | current_app = 1;
|
891 | 972 | appcount = 1;
|
— | — | @@ -1036,8 +1117,9 @@ |
1037 | 1118 | switch(wParam)
|
1038 | 1119 | {
|
1039 | 1120 | case IDC_APPS:
|
1040 | | - ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYSMICON)+1;
|
| 1121 | + ((LPMEASUREITEMSTRUCT)lParam)->itemHeight = GetSystemMetrics(SM_CYSMICON) + 1;
|
1041 | 1122 | ((LPMEASUREITEMSTRUCT)lParam)->itemWidth = GetSystemMetrics(SM_CXSMICON)+1;
|
| 1123 | + break;
|
1042 | 1124 | default:
|
1043 | 1125 | break;
|
1044 | 1126 | }
|
— | — | @@ -1057,7 +1139,8 @@ |
1058 | 1140 | }
|
1059 | 1141 | break;
|
1060 | 1142 | case WM_DRAWITEM:
|
1061 | | - switch(wParam)
|
| 1143 | + drawitem = (DRAWITEMSTRUCT*)lParam;
|
| 1144 | + switch (wParam)
|
1062 | 1145 | {
|
1063 | 1146 | case IDC_APPS:
|
1064 | 1147 | OldTextColor = GetTextColor(drawitem->hDC);
|
— | — | @@ -1467,7 +1550,6 @@ |
1468 | 1551 |
|
1469 | 1552 | int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
|
1470 | 1553 | {
|
1471 | | - WNDCLASSEX wc;
|
1472 | 1554 | INITCOMMONCONTROLSEX icc;
|
1473 | 1555 | HMODULE comctl32;
|
1474 | 1556 | BOOL(WINAPI *iccex)(LPINITCOMMONCONTROLSEX lpInitCtrls);
|
— | — | @@ -1488,12 +1570,6 @@ |
1489 | 1571 | iccex = (BOOL (WINAPI *)(LPINITCOMMONCONTROLSEX))GetProcAddress(comctl32,"InitCommonControlsEx");
|
1490 | 1572 | if(iccex) iccex(&icc);
|
1491 | 1573 | else InitCommonControls();
|
1492 | | - ZeroMemory(&wc, sizeof(WNDCLASSEX));
|
1493 | | - wc.cbSize = sizeof(WNDCLASSEX);
|
1494 | | - wc.lpfnWndProc = CheckedComboProc;
|
1495 | | - wc.hInstance = hInstance;
|
1496 | | - wc.lpszClassName = _T("CheckedComboBox");
|
1497 | | - RegisterClassEx(&wc);
|
1498 | 1574 | hinstance = hInstance;
|
1499 | 1575 | GetModuleFileName(NULL,hlppath,MAX_PATH);
|
1500 | 1576 | GetDirFromPath(hlppath);
|
Index: dxglcfg2/dxglcfg2.rc |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | {
|
38 | 38 | COMBOBOX IDC_VSYNC, 114, 92, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
|
39 | 39 | LTEXT "Vertical sync", IDC_STATIC, 114, 82, 41, 8, SS_LEFT, WS_EX_LEFT
|
40 | | - COMBOBOX IDC_EXTRAMODES, 114, 42, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
|
| 40 | + COMBOBOX IDC_EXTRAMODES, 114, 42, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWFIXED, WS_EX_LEFT
|
41 | 41 | LTEXT "Additional display modes", 0, 114, 32, 78, 8, SS_LEFT, WS_EX_LEFT
|
42 | 42 | COMBOBOX IDC_COLORDEPTH, 114, 17, 102, 30, CBS_DROPDOWNLIST | CBS_HASSTRINGS, WS_EX_LEFT
|
43 | 43 | LTEXT "Add color depths", IDC_STATIC, 114, 7, 54, 8, SS_LEFT, WS_EX_LEFT
|