Index: cfgmgr/cfgmgr.c |
— | — | @@ -406,7 +406,7 @@ |
407 | 407 | {
|
408 | 408 | LPCTSTR obsolete;
|
409 | 409 | va_list va;
|
410 | | - int i;
|
| 410 | + unsigned int i;
|
411 | 411 | DWORD dwOut;
|
412 | 412 | DWORD sizeout = 4;
|
413 | 413 | DWORD regdword = REG_DWORD;
|
— | — | @@ -532,7 +532,7 @@ |
533 | 533 | {
|
534 | 534 | LPCTSTR obsolete;
|
535 | 535 | va_list va;
|
536 | | - int i;
|
| 536 | + unsigned int i;
|
537 | 537 | float dwOut;
|
538 | 538 | DWORD sizeout = 4;
|
539 | 539 | DWORD regdword = REG_DWORD;
|
— | — | @@ -699,7 +699,7 @@ |
700 | 700 | {
|
701 | 701 | LPCTSTR obsolete;
|
702 | 702 | va_list va;
|
703 | | - int i;
|
| 703 | + unsigned int i;
|
704 | 704 | va_start(va, obsolete_count);
|
705 | 705 | for (i = 0; i < obsolete_count; i++)
|
706 | 706 | {
|
— | — | @@ -727,7 +727,7 @@ |
728 | 728 | {
|
729 | 729 | LPCTSTR obsolete;
|
730 | 730 | va_list va;
|
731 | | - int i;
|
| 731 | + unsigned int i;
|
732 | 732 | va_start(va, obsolete_count);
|
733 | 733 | for (i = 0; i < obsolete_count; i++)
|
734 | 734 | {
|
— | — | @@ -833,7 +833,6 @@ |
834 | 834 | TCHAR sha256string[65];
|
835 | 835 | TCHAR regkey[MAX_PATH + 80];
|
836 | 836 | TCHAR filename[MAX_PATH + 1];
|
837 | | - TCHAR pathlwr[MAX_PATH + 1];
|
838 | 837 | HKEY hKey;
|
839 | 838 | LONG error;
|
840 | 839 | int i;
|
— | — | @@ -962,7 +961,7 @@ |
963 | 962 | float INIAspectValue(const char *value)
|
964 | 963 | {
|
965 | 964 | char *ptr;
|
966 | | - float numerator, denominator;
|
| 965 | + double numerator, denominator;
|
967 | 966 | if (!strcmp(value, "Default")) return 0.0f;
|
968 | 967 | else
|
969 | 968 | {
|
— | — | @@ -973,9 +972,9 @@ |
974 | 973 | *ptr = 0;
|
975 | 974 | numerator = atof(value);
|
976 | 975 | denominator = atof(ptr + 1);
|
977 | | - return numerator / denominator;
|
| 976 | + return (float)(numerator / denominator);
|
978 | 977 | }
|
979 | | - else return atof(value);
|
| 978 | + else return (float)atof(value);
|
980 | 979 | }
|
981 | 980 | }
|
982 | 981 |
|
— | — | @@ -987,17 +986,20 @@ |
988 | 987 | int ReadINICallback(DXGLCFG *cfg, const char *section, const char *name,
|
989 | 988 | const char *value)
|
990 | 989 | {
|
991 | | - if (!stricmp(section, "system"))
|
| 990 | +#ifdef _UNICODE
|
| 991 | + TCHAR unicode_path[MAX_PATH + 1];
|
| 992 | +#endif
|
| 993 | + if (!_stricmp(section, "system"))
|
992 | 994 | {
|
993 | | - if (!stricmp(name, "NoWriteRegistry")) cfg->NoWriteRegistry = INIBoolValue(value);
|
994 | | - if (!stricmp(name, "OverrideDefaults")) cfg->OverrideDefaults = INIBoolValue(value);
|
| 995 | + if (!_stricmp(name, "NoWriteRegistry")) cfg->NoWriteRegistry = INIBoolValue(value);
|
| 996 | + if (!_stricmp(name, "OverrideDefaults")) cfg->OverrideDefaults = INIBoolValue(value);
|
995 | 997 | }
|
996 | | - if (!stricmp(section, "display"))
|
| 998 | + if (!_stricmp(section, "display"))
|
997 | 999 | {
|
998 | | - if (!stricmp(name, "ScalingMode")) cfg->scaler = INIIntValue(value);
|
999 | | - if (!stricmp(name, "FullscreenWindowMode")) cfg->fullmode = INIIntValue(value);
|
1000 | | - if (!stricmp(name, "ChangeColorDepth")) cfg->colormode = INIBoolValue(value);
|
1001 | | - if (!stricmp(name, "AllColorDepths"))
|
| 1000 | + if (!_stricmp(name, "ScalingMode")) cfg->scaler = INIIntValue(value);
|
| 1001 | + if (!_stricmp(name, "FullscreenWindowMode")) cfg->fullmode = INIIntValue(value);
|
| 1002 | + if (!_stricmp(name, "ChangeColorDepth")) cfg->colormode = INIBoolValue(value);
|
| 1003 | + if (!_stricmp(name, "AllColorDepths"))
|
1002 | 1004 | {
|
1003 | 1005 | if (!cfg->ParsedAddColorDepths)
|
1004 | 1006 | {
|
— | — | @@ -1005,12 +1007,12 @@ |
1006 | 1008 | else cfg->AddColorDepths = 0;
|
1007 | 1009 | }
|
1008 | 1010 | }
|
1009 | | - if (!stricmp(name, "AddColorDepths"))
|
| 1011 | + if (!_stricmp(name, "AddColorDepths"))
|
1010 | 1012 | {
|
1011 | 1013 | cfg->ParsedAddColorDepths = TRUE;
|
1012 | 1014 | cfg->AddColorDepths = INIIntValue(value);
|
1013 | 1015 | }
|
1014 | | - if (!stricmp(name, "ExtraModes"))
|
| 1016 | + if (!_stricmp(name, "ExtraModes"))
|
1015 | 1017 | {
|
1016 | 1018 | if (!cfg->ParsedAddModes)
|
1017 | 1019 | {
|
— | — | @@ -1018,85 +1020,93 @@ |
1019 | 1021 | else cfg->AddModes = 0;
|
1020 | 1022 | }
|
1021 | 1023 | }
|
1022 | | - if (!stricmp(name, "AddModes"))
|
| 1024 | + if (!_stricmp(name, "AddModes"))
|
1023 | 1025 | {
|
1024 | 1026 | cfg->ParsedAddModes = TRUE;
|
1025 | 1027 | cfg->AddModes = INIIntValue(value);
|
1026 | 1028 | }
|
1027 | | - if (!stricmp(name, "SortModes")) cfg->SortModes = INIIntValue(value);
|
| 1029 | + if (!_stricmp(name, "SortModes")) cfg->SortModes = INIIntValue(value);
|
1028 | 1030 | }
|
1029 | | - if (!stricmp(section, "scaling"))
|
| 1031 | + if (!_stricmp(section, "scaling"))
|
1030 | 1032 | {
|
1031 | | - if (!stricmp(name, "ScalingFilter")) cfg->scalingfilter = INIIntValue(value);
|
1032 | | - if (!stricmp(name, "BltScale")) cfg->BltScale = INIIntValue(value);
|
| 1033 | + if (!_stricmp(name, "ScalingFilter")) cfg->scalingfilter = INIIntValue(value);
|
| 1034 | + if (!_stricmp(name, "BltScale")) cfg->BltScale = INIIntValue(value);
|
1033 | 1035 | // Removed for DXGL 0.5.13 release
|
1034 | | - // if (!stricmp(name, "BltThreshold")) cfg->BltThreshold = INIIntValue(value);
|
1035 | | - if (!stricmp(name, "AdjustPrimaryResolution")) cfg->primaryscale = INIIntValue(value);
|
1036 | | - if (!stricmp(name, "PrimaryScaleX")) cfg->primaryscalex = INIFloatValue(value);
|
1037 | | - if (!stricmp(name, "PrimaryScaleY")) cfg->primaryscaley = INIFloatValue(value);
|
1038 | | - if (!stricmp(name, "ScreenAspect")) cfg->aspect = INIAspectValue(value);
|
1039 | | - if (!stricmp(name, "DPIScale")) cfg->DPIScale = INIIntValue(value);
|
1040 | | - if (!stricmp(name, "CustomResolutionX")) cfg->CustomResolutionX = INIIntValue(value);
|
1041 | | - if (!stricmp(name, "CustomResolutionY")) cfg->CustomResolutionY = INIIntValue(value);
|
1042 | | - if (!stricmp(name, "CustomRefresh")) cfg->CustomRefresh = INIIntValue(value);
|
1043 | | - if (!stricmp(name, "DisplayMultiplierX")) cfg->DisplayMultiplierX = INIFloatValue(value);
|
1044 | | - if (!stricmp(name, "DisplayMultiplierY")) cfg->DisplayMultiplierY = INIFloatValue(value);
|
| 1036 | + // if (!_stricmp(name, "BltThreshold")) cfg->BltThreshold = INIIntValue(value);
|
| 1037 | + if (!_stricmp(name, "AdjustPrimaryResolution")) cfg->primaryscale = INIIntValue(value);
|
| 1038 | + if (!_stricmp(name, "PrimaryScaleX")) cfg->primaryscalex = INIFloatValue(value);
|
| 1039 | + if (!_stricmp(name, "PrimaryScaleY")) cfg->primaryscaley = INIFloatValue(value);
|
| 1040 | + if (!_stricmp(name, "ScreenAspect")) cfg->aspect = INIAspectValue(value);
|
| 1041 | + if (!_stricmp(name, "DPIScale")) cfg->DPIScale = INIIntValue(value);
|
| 1042 | + if (!_stricmp(name, "CustomResolutionX")) cfg->CustomResolutionX = INIIntValue(value);
|
| 1043 | + if (!_stricmp(name, "CustomResolutionY")) cfg->CustomResolutionY = INIIntValue(value);
|
| 1044 | + if (!_stricmp(name, "CustomRefresh")) cfg->CustomRefresh = INIIntValue(value);
|
| 1045 | + if (!_stricmp(name, "DisplayMultiplierX")) cfg->DisplayMultiplierX = INIFloatValue(value);
|
| 1046 | + if (!_stricmp(name, "DisplayMultiplierY")) cfg->DisplayMultiplierY = INIFloatValue(value);
|
1045 | 1047 | }
|
1046 | | - if (!stricmp(section, "postprocess"))
|
| 1048 | + if (!_stricmp(section, "postprocess"))
|
1047 | 1049 | {
|
1048 | | - if (!stricmp(name, "PostprocessFilter")) cfg->postfilter = INIIntValue(value);
|
1049 | | - if (!stricmp(name, "PostprocessScaleX")) cfg->postsizex = INIFloatValue(value);
|
1050 | | - if (!stricmp(name, "PostprocessScaleY")) cfg->postsizex = INIFloatValue(value);
|
1051 | | - if (!stricmp(name, "EnableShader")) cfg->EnableShader = INIBoolValue(value);
|
1052 | | - if (!stricmp(name, "ShaderFile")) strncpy(cfg->shaderfile, value, MAX_PATH);
|
| 1050 | + if (!_stricmp(name, "PostprocessFilter")) cfg->postfilter = INIIntValue(value);
|
| 1051 | + if (!_stricmp(name, "PostprocessScaleX")) cfg->postsizex = INIFloatValue(value);
|
| 1052 | + if (!_stricmp(name, "PostprocessScaleY")) cfg->postsizex = INIFloatValue(value);
|
| 1053 | + if (!_stricmp(name, "EnableShader")) cfg->EnableShader = INIBoolValue(value);
|
| 1054 | + if (!_stricmp(name, "ShaderFile"))
|
| 1055 | + {
|
| 1056 | +#ifdef _UNICODE
|
| 1057 | + MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED, value, strlen(value), unicode_path, MAX_PATH);
|
| 1058 | + _tcsncpy(cfg->shaderfile, unicode_path, MAX_PATH);
|
| 1059 | +#else
|
| 1060 | + _tcsncpy(cfg->shaderfile, value, MAX_PATH);
|
| 1061 | +#endif
|
| 1062 | + }
|
1053 | 1063 | }
|
1054 | | - if (!stricmp(section, "d3d"))
|
| 1064 | + if (!_stricmp(section, "d3d"))
|
1055 | 1065 | {
|
1056 | | - if (!stricmp(name, "TextureFilter")) cfg->texfilter = INIIntValue(value);
|
1057 | | - if (!stricmp(name, "AnisotropicFiltering")) cfg->anisotropic = INIIntValue(value);
|
1058 | | - if (!stricmp(name, "Antialiasing")) cfg->msaa = INIHexValue(value);
|
1059 | | - if (!stricmp(name, "D3DAspect")) cfg->aspect3d = INIIntValue(value);
|
1060 | | - if (!stricmp(name, "LowColorRendering")) cfg->LowColorRendering = INIIntValue(value);
|
1061 | | - if (!stricmp(name, "EnableDithering")) cfg->EnableDithering = INIIntValue(value);
|
| 1066 | + if (!_stricmp(name, "TextureFilter")) cfg->texfilter = INIIntValue(value);
|
| 1067 | + if (!_stricmp(name, "AnisotropicFiltering")) cfg->anisotropic = INIIntValue(value);
|
| 1068 | + if (!_stricmp(name, "Antialiasing")) cfg->msaa = INIHexValue(value);
|
| 1069 | + if (!_stricmp(name, "D3DAspect")) cfg->aspect3d = INIIntValue(value);
|
| 1070 | + if (!_stricmp(name, "LowColorRendering")) cfg->LowColorRendering = INIIntValue(value);
|
| 1071 | + if (!_stricmp(name, "EnableDithering")) cfg->EnableDithering = INIIntValue(value);
|
1062 | 1072 | }
|
1063 | | - if (!stricmp(section, "advanced"))
|
| 1073 | + if (!_stricmp(section, "advanced"))
|
1064 | 1074 | {
|
1065 | | - if (!stricmp(name, "VSync")) cfg->vsync = INIIntValue(value);
|
1066 | | - if (!stricmp(name, "TextureFormat")) cfg->TextureFormat = INIIntValue(value);
|
1067 | | - if (!stricmp(name, "TexUpload")) cfg->TexUpload = INIIntValue(value);
|
1068 | | - if (!stricmp(name, "SingleBufferDevice")) cfg->SingleBufferDevice = INIBoolValue(value);
|
1069 | | - if (!stricmp(name, "WindowPosition")) cfg->WindowPosition = INIIntValue(value);
|
1070 | | - if (!stricmp(name, "RememberWindowSize")) cfg->RememberWindowSize = INIBoolValue(value);
|
1071 | | - if (!stricmp(name, "RememberWindowPosition")) cfg->RememberWindowPosition = INIBoolValue(value);
|
1072 | | - if (!stricmp(name, "NoResizeWindow")) cfg->NoResizeWindow = INIBoolValue(value);
|
1073 | | - if (!stricmp(name, "WindowX")) cfg->WindowX = INIIntValue(value);
|
1074 | | - if (!stricmp(name, "WindowY")) cfg->WindowY = INIIntValue(value);
|
1075 | | - if (!stricmp(name, "WindowWidth")) cfg->WindowWidth = INIIntValue(value);
|
1076 | | - if (!stricmp(name, "WindowHeight")) cfg->WindowHeight = INIIntValue(value);
|
1077 | | - if (!stricmp(name, "WindowMaximized")) cfg->WindowMaximized = INIBoolValue(value);
|
| 1075 | + if (!_stricmp(name, "VSync")) cfg->vsync = INIIntValue(value);
|
| 1076 | + if (!_stricmp(name, "TextureFormat")) cfg->TextureFormat = INIIntValue(value);
|
| 1077 | + if (!_stricmp(name, "TexUpload")) cfg->TexUpload = INIIntValue(value);
|
| 1078 | + if (!_stricmp(name, "SingleBufferDevice")) cfg->SingleBufferDevice = INIBoolValue(value);
|
| 1079 | + if (!_stricmp(name, "WindowPosition")) cfg->WindowPosition = INIIntValue(value);
|
| 1080 | + if (!_stricmp(name, "RememberWindowSize")) cfg->RememberWindowSize = INIBoolValue(value);
|
| 1081 | + if (!_stricmp(name, "RememberWindowPosition")) cfg->RememberWindowPosition = INIBoolValue(value);
|
| 1082 | + if (!_stricmp(name, "NoResizeWindow")) cfg->NoResizeWindow = INIBoolValue(value);
|
| 1083 | + if (!_stricmp(name, "WindowX")) cfg->WindowX = INIIntValue(value);
|
| 1084 | + if (!_stricmp(name, "WindowY")) cfg->WindowY = INIIntValue(value);
|
| 1085 | + if (!_stricmp(name, "WindowWidth")) cfg->WindowWidth = INIIntValue(value);
|
| 1086 | + if (!_stricmp(name, "WindowHeight")) cfg->WindowHeight = INIIntValue(value);
|
| 1087 | + if (!_stricmp(name, "WindowMaximized")) cfg->WindowMaximized = INIBoolValue(value);
|
1078 | 1088 | }
|
1079 | | - if (!stricmp(section, "debug"))
|
| 1089 | + if (!_stricmp(section, "debug"))
|
1080 | 1090 | {
|
1081 | | - if (!stricmp(name, "DebugNoExtFramebuffer")) cfg->DebugNoExtFramebuffer = INIBoolValue(value);
|
1082 | | - if (!stricmp(name, "DebugNoArbFramebuffer")) cfg->DebugNoArbFramebuffer = INIBoolValue(value);
|
1083 | | - if (!stricmp(name, "DebugNoES2Compatibility")) cfg->DebugNoES2Compatibility = INIBoolValue(value);
|
1084 | | - if (!stricmp(name, "DebugNoExtDirectStateAccess")) cfg->DebugNoExtDirectStateAccess = INIBoolValue(value);
|
1085 | | - if (!stricmp(name, "DebugNoArbDirectStateAccess")) cfg->DebugNoArbDirectStateAccess = INIBoolValue(value);
|
1086 | | - if (!stricmp(name, "DebugNoSamplerObjects")) cfg->DebugNoSamplerObjects = INIBoolValue(value);
|
1087 | | - if (!stricmp(name, "DebugNoGpuShader4")) cfg->DebugNoGpuShader4 = INIBoolValue(value);
|
1088 | | - if (!stricmp(name, "DebugNoGLSL130")) cfg->DebugNoGLSL130 = INIBoolValue(value);
|
1089 | | - if (!stricmp(name, "DebugUploadAfterUnlock")) cfg->DebugUploadAfterUnlock = INIBoolValue(value);
|
1090 | | - if (!stricmp(name, "DebugBlendDestColorKey")) cfg->DebugBlendDestColorKey = INIBoolValue(value);
|
1091 | | - if (!stricmp(name, "DebugNoMouseHooks")) cfg->DebugNoMouseHooks = INIBoolValue(value);
|
1092 | | - if (!stricmp(name, "DebugMaxGLVersionMajor")) cfg->DebugMaxGLVersionMajor = INIIntValue(value);
|
1093 | | - if (!stricmp(name, "DebugMaxGLVersionMinor")) cfg->DebugMaxGLVersionMinor = INIIntValue(value);
|
| 1091 | + if (!_stricmp(name, "DebugNoExtFramebuffer")) cfg->DebugNoExtFramebuffer = INIBoolValue(value);
|
| 1092 | + if (!_stricmp(name, "DebugNoArbFramebuffer")) cfg->DebugNoArbFramebuffer = INIBoolValue(value);
|
| 1093 | + if (!_stricmp(name, "DebugNoES2Compatibility")) cfg->DebugNoES2Compatibility = INIBoolValue(value);
|
| 1094 | + if (!_stricmp(name, "DebugNoExtDirectStateAccess")) cfg->DebugNoExtDirectStateAccess = INIBoolValue(value);
|
| 1095 | + if (!_stricmp(name, "DebugNoArbDirectStateAccess")) cfg->DebugNoArbDirectStateAccess = INIBoolValue(value);
|
| 1096 | + if (!_stricmp(name, "DebugNoSamplerObjects")) cfg->DebugNoSamplerObjects = INIBoolValue(value);
|
| 1097 | + if (!_stricmp(name, "DebugNoGpuShader4")) cfg->DebugNoGpuShader4 = INIBoolValue(value);
|
| 1098 | + if (!_stricmp(name, "DebugNoGLSL130")) cfg->DebugNoGLSL130 = INIBoolValue(value);
|
| 1099 | + if (!_stricmp(name, "DebugUploadAfterUnlock")) cfg->DebugUploadAfterUnlock = INIBoolValue(value);
|
| 1100 | + if (!_stricmp(name, "DebugBlendDestColorKey")) cfg->DebugBlendDestColorKey = INIBoolValue(value);
|
| 1101 | + if (!_stricmp(name, "DebugNoMouseHooks")) cfg->DebugNoMouseHooks = INIBoolValue(value);
|
| 1102 | + if (!_stricmp(name, "DebugMaxGLVersionMajor")) cfg->DebugMaxGLVersionMajor = INIIntValue(value);
|
| 1103 | + if (!_stricmp(name, "DebugMaxGLVersionMinor")) cfg->DebugMaxGLVersionMinor = INIIntValue(value);
|
1094 | 1104 | }
|
1095 | | - if (!stricmp(section, "hacks"))
|
| 1105 | + if (!_stricmp(section, "hacks"))
|
1096 | 1106 | {
|
1097 | | - if (!stricmp(section, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
|
1098 | | - if (!stricmp(section, "HackAutoScale512448to640480")) cfg->HackAutoScale512448to640480 = INIBoolValue(value);
|
1099 | | - if (!stricmp(section, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
|
1100 | | - if (!stricmp(section, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
|
| 1107 | + if (!_stricmp(section, "HackCrop640480to640400")) cfg->HackCrop640480to640400 = INIBoolValue(value);
|
| 1108 | + if (!_stricmp(section, "HackAutoScale512448to640480")) cfg->HackAutoScale512448to640480 = INIBoolValue(value);
|
| 1109 | + if (!_stricmp(section, "HackNoTVRefresh")) cfg->HackNoTVRefresh = INIBoolValue(value);
|
| 1110 | + if (!_stricmp(section, "HackSetCursor")) cfg->HackSetCursor = INIBoolValue(value);
|
1101 | 1111 | }
|
1102 | 1112 | return 1;
|
1103 | 1113 | }
|
— | — | @@ -1122,7 +1132,6 @@ |
1123 | 1133 | Sha256Context sha_context;
|
1124 | 1134 | SHA256_HASH sha256;
|
1125 | 1135 | TCHAR sha256string[65];
|
1126 | | - FILE *file;
|
1127 | 1136 | TCHAR filename[MAX_PATH+1];
|
1128 | 1137 | TCHAR regkey[MAX_PATH + 80];
|
1129 | 1138 | int i;
|
— | — | @@ -1244,7 +1253,7 @@ |
1245 | 1254 | {
|
1246 | 1255 | _SetProcessDpiAwarenessContext =
|
1247 | 1256 | (BOOL(WINAPI*)(HANDLE))GetProcAddress(hUser32, "SetProcessDpiAwarenessContext");
|
1248 | | - if (_SetProcessDpiAwarenessContext) _SetProcessDpiAwarenessContext(-4);
|
| 1257 | + if (_SetProcessDpiAwarenessContext) _SetProcessDpiAwarenessContext((HANDLE)-4);
|
1249 | 1258 | }
|
1250 | 1259 | if (!_SetProcessDpiAwarenessContext)
|
1251 | 1260 | {
|
— | — | @@ -1335,7 +1344,7 @@ |
1336 | 1345 | {
|
1337 | 1346 | HKEY hKey;
|
1338 | 1347 | RegCreateKeyEx(HKEY_CURRENT_USER,regkeyglobal,0,NULL,0,KEY_ALL_ACCESS,NULL,&hKey,NULL);
|
1339 | | - WriteSettings(hKey,cfg,mask,TRUE);
|
| 1348 | + WriteSettings(hKey,cfg,mask);
|
1340 | 1349 | RegCloseKey(hKey);
|
1341 | 1350 | }
|
1342 | 1351 |
|
— | — | @@ -1347,7 +1356,7 @@ |
1348 | 1357 | _tcscat(regkey, _T("Profiles\\"));
|
1349 | 1358 | _tcsncat(regkey, name, MAX_PATH);
|
1350 | 1359 | RegCreateKeyEx(HKEY_CURRENT_USER, regkey, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hKey, NULL);
|
1351 | | - WriteSettings(hKey,cfg,mask,FALSE);
|
| 1360 | + WriteSettings(hKey,cfg,mask);
|
1352 | 1361 | RegCloseKey(hKey);
|
1353 | 1362 | }
|
1354 | 1363 |
|
Index: dxglcfg/dxgltest.cpp |
— | — | @@ -221,7 +221,8 @@ |
222 | 222 | {7, 7, 0, 2, TRUE, 60.0, TRUE, FALSE, TRUE, _T("DrawIndexedPrimitive cube with directional light (DX7)")},
|
223 | 223 | {7, 7, 0, 2, TRUE, 60.0, TRUE, TRUE, TRUE, _T("DrawPrimitive textured cube (DX7)")},
|
224 | 224 | {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Texture Stage shaders (Interactive, DX7)")},
|
225 | | - {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Vertex shaders (Interactive, DX7)")}
|
| 225 | + {7, 7, 0, 0, TRUE, 60.0, TRUE, TRUE, TRUE, _T("Vertex shaders (Interactive, DX7)")},
|
| 226 | + {1, 7, 0, 1, TRUE, 60.0, FALSE, FALSE, FALSE, _T("SetCursorPos Test")}
|
226 | 227 | };
|
227 | 228 | const int END_TESTS = __LINE__ - 4;
|
228 | 229 | const int numtests = END_TESTS - START_TESTS;
|
Index: dxglcfg/tests.cpp |
— | — | @@ -85,9 +85,9 @@ |
86 | 86 | static BOOL lightenable[8];
|
87 | 87 | static DWORD bgcolor = 0;
|
88 | 88 |
|
89 | | -static UINT lastmousemsg = WM_NULL;
|
90 | | -static WPARAM lastmousewparam = 0;
|
91 | | -static LPARAM lastmouselparam = NULL;
|
| 89 | +static UINT lastmousemsg[8] = { WM_NULL,WM_NULL,WM_NULL,WM_NULL,WM_NULL,WM_NULL,WM_NULL,WM_NULL };
|
| 90 | +static WPARAM lastmousewparam[8] = { 0,0,0,0,0,0,0,0 };
|
| 91 | +static LPARAM lastmouselparam[8] = { NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };
|
92 | 92 |
|
93 | 93 | typedef struct
|
94 | 94 | {
|
— | — | @@ -196,6 +196,7 @@ |
197 | 197 | RECT srcrect,destrect;
|
198 | 198 | HRESULT error;
|
199 | 199 | PAINTSTRUCT paintstruct;
|
| 200 | + int i;
|
200 | 201 | switch(Msg)
|
201 | 202 | {
|
202 | 203 | case WM_CLOSE:
|
— | — | @@ -312,9 +313,15 @@ |
313 | 314 | case WM_XBUTTONUP:
|
314 | 315 | case WM_XBUTTONDBLCLK:
|
315 | 316 | case WM_MOUSEHWHEEL:
|
316 | | - lastmousemsg = Msg;
|
317 | | - lastmousewparam = wParam;
|
318 | | - lastmouselparam = lParam;
|
| 317 | + for (i = 7; i > 0; i--)
|
| 318 | + lastmousemsg[i] = lastmousemsg[i - 1];
|
| 319 | + lastmousemsg[0] = Msg;
|
| 320 | + for (i = 7; i > 0; i--)
|
| 321 | + lastmousewparam[i] = lastmousewparam[i-1];
|
| 322 | + lastmousewparam[0] = wParam;
|
| 323 | + for (i = 7; i > 0; i--)
|
| 324 | + lastmouselparam[i] = lastmouselparam[i-1];
|
| 325 | + lastmouselparam[0] = lParam;
|
319 | 326 | break;
|
320 | 327 | default:
|
321 | 328 | return DefWindowProc(hWnd,Msg,wParam,lParam);
|
— | — | @@ -1313,7 +1320,8 @@ |
1314 | 1321 | TCHAR message[256];
|
1315 | 1322 | TCHAR number[32];
|
1316 | 1323 | HBRUSH brush;
|
1317 | | - BOOL out[7];
|
| 1324 | + BOOL out[9];
|
| 1325 | + int i;
|
1318 | 1326 | bltfx.dwSize = sizeof(DDBLTFX);
|
1319 | 1327 | ZeroMemory(&ddscaps,sizeof(DDSCAPS2));
|
1320 | 1328 | ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
|
— | — | @@ -1380,8 +1388,8 @@ |
1381 | 1389 | destrect.bottom = height;
|
1382 | 1390 | FillRect(hDCdest, &destrect, brush);
|
1383 | 1391 | DeleteObject(brush);
|
1384 | | - _tcscpy(message, _T("Mouse pointer test"));
|
1385 | | - displayfonts[0] = CreateFont(9, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
| 1392 | + _tcscpy(message, _T("Mouse pointer test - colored pointers should follow mouse."));
|
| 1393 | + displayfonts[0] = CreateFont(16, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE,
|
1386 | 1394 | ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
|
1387 | 1395 | DEFAULT_PITCH, _T("Fixedsys"));
|
1388 | 1396 | displayfonts[1] = (HFONT)SelectObject(hDCdest, displayfonts[0]);
|
— | — | @@ -1389,85 +1397,89 @@ |
1390 | 1398 | SetBkColor(hDCdest, RGB(0,0,255));
|
1391 | 1399 | TextOut(hDCdest, 0, 0, message, _tcslen(message));
|
1392 | 1400 | GetTextExtentPoint(hDCdest, _T("A"), 1, &textsize);
|
1393 | | - _tcscpy(message, _T("Last mouse message: "));
|
1394 | | - switch (lastmousemsg)
|
| 1401 | + for (i = 0; i < 8; i++)
|
1395 | 1402 | {
|
1396 | | - case WM_MOUSEMOVE:
|
1397 | | - _tcscat(message, _T("WM_MOUSEMOVE "));
|
1398 | | - break;
|
1399 | | - case WM_LBUTTONDOWN:
|
1400 | | - _tcscat(message, _T("WM_LBUTTONDOWN "));
|
1401 | | - break;
|
1402 | | - case WM_LBUTTONUP:
|
1403 | | - _tcscat(message, _T("WM_LBUTTONUP "));
|
1404 | | - break;
|
1405 | | - case WM_LBUTTONDBLCLK:
|
1406 | | - _tcscat(message, _T("WM_LBUTTONDBLCLK "));
|
1407 | | - break;
|
1408 | | - case WM_RBUTTONDOWN:
|
1409 | | - _tcscat(message, _T("WM_RBUTTONDOWN "));
|
1410 | | - break;
|
1411 | | - case WM_RBUTTONUP:
|
1412 | | - _tcscat(message, _T("WM_RBUTTONUP "));
|
1413 | | - break;
|
1414 | | - case WM_RBUTTONDBLCLK:
|
1415 | | - _tcscat(message, _T("WM_RBUTTONDBLCLK "));
|
1416 | | - break;
|
1417 | | - case WM_MBUTTONDOWN:
|
1418 | | - _tcscat(message, _T("WM_MBUTTONDOWN "));
|
1419 | | - break;
|
1420 | | - case WM_MBUTTONUP:
|
1421 | | - _tcscat(message, _T("WM_MBUTTONUP "));
|
1422 | | - break;
|
1423 | | - case WM_MBUTTONDBLCLK:
|
1424 | | - _tcscat(message, _T("WM_MBUTTONDBLCLK "));
|
1425 | | - break;
|
1426 | | - case WM_MOUSEWHEEL:
|
1427 | | - _tcscat(message, _T("WM_MOUSEWHEEL "));
|
1428 | | - break;
|
1429 | | - case WM_XBUTTONDOWN:
|
1430 | | - _tcscat(message, _T("WM_XBUTTONDOWN "));
|
1431 | | - break;
|
1432 | | - case WM_XBUTTONUP:
|
1433 | | - _tcscat(message, _T("WM_XBUTTONUP "));
|
1434 | | - break;
|
1435 | | - case WM_XBUTTONDBLCLK:
|
1436 | | - _tcscat(message, _T("WM_XBUTTONDBLCLK "));
|
1437 | | - break;
|
1438 | | - case WM_MOUSEHWHEEL:
|
1439 | | - _tcscat(message, _T("WM_MOUSEHWHEEL "));
|
1440 | | - break;
|
1441 | | - default:
|
1442 | | - _tcscat(message, _T("unknown "));
|
| 1403 | + _tcscpy(message, _T("Mouse message: "));
|
| 1404 | + switch (lastmousemsg[i])
|
| 1405 | + {
|
| 1406 | + case WM_MOUSEMOVE:
|
| 1407 | + _tcscat(message, _T("WM_MOUSEMOVE "));
|
| 1408 | + break;
|
| 1409 | + case WM_LBUTTONDOWN:
|
| 1410 | + _tcscat(message, _T("WM_LBUTTONDOWN "));
|
| 1411 | + break;
|
| 1412 | + case WM_LBUTTONUP:
|
| 1413 | + _tcscat(message, _T("WM_LBUTTONUP "));
|
| 1414 | + break;
|
| 1415 | + case WM_LBUTTONDBLCLK:
|
| 1416 | + _tcscat(message, _T("WM_LBUTTONDBLCLK "));
|
| 1417 | + break;
|
| 1418 | + case WM_RBUTTONDOWN:
|
| 1419 | + _tcscat(message, _T("WM_RBUTTONDOWN "));
|
| 1420 | + break;
|
| 1421 | + case WM_RBUTTONUP:
|
| 1422 | + _tcscat(message, _T("WM_RBUTTONUP "));
|
| 1423 | + break;
|
| 1424 | + case WM_RBUTTONDBLCLK:
|
| 1425 | + _tcscat(message, _T("WM_RBUTTONDBLCLK "));
|
| 1426 | + break;
|
| 1427 | + case WM_MBUTTONDOWN:
|
| 1428 | + _tcscat(message, _T("WM_MBUTTONDOWN "));
|
| 1429 | + break;
|
| 1430 | + case WM_MBUTTONUP:
|
| 1431 | + _tcscat(message, _T("WM_MBUTTONUP "));
|
| 1432 | + break;
|
| 1433 | + case WM_MBUTTONDBLCLK:
|
| 1434 | + _tcscat(message, _T("WM_MBUTTONDBLCLK "));
|
| 1435 | + break;
|
| 1436 | + case WM_MOUSEWHEEL:
|
| 1437 | + _tcscat(message, _T("WM_MOUSEWHEEL "));
|
| 1438 | + break;
|
| 1439 | + case WM_XBUTTONDOWN:
|
| 1440 | + _tcscat(message, _T("WM_XBUTTONDOWN "));
|
| 1441 | + break;
|
| 1442 | + case WM_XBUTTONUP:
|
| 1443 | + _tcscat(message, _T("WM_XBUTTONUP "));
|
| 1444 | + break;
|
| 1445 | + case WM_XBUTTONDBLCLK:
|
| 1446 | + _tcscat(message, _T("WM_XBUTTONDBLCLK "));
|
| 1447 | + break;
|
| 1448 | + case WM_MOUSEHWHEEL:
|
| 1449 | + _tcscat(message, _T("WM_MOUSEHWHEEL "));
|
| 1450 | + break;
|
| 1451 | + default:
|
| 1452 | + _tcscat(message, _T("unknown "));
|
| 1453 | + }
|
| 1454 | + x = GET_X_LPARAM(lastmouselparam[i]);
|
| 1455 | + y = GET_Y_LPARAM(lastmouselparam[i]);
|
| 1456 | + _tcscat(message, _T("X="));
|
| 1457 | + _itot(x, number, 10);
|
| 1458 | + _tcscat(message, number);
|
| 1459 | + _tcscat(message, _T(" "));
|
| 1460 | + _tcscat(message, _T("Y="));
|
| 1461 | + _itot(y, number, 10);
|
| 1462 | + _tcscat(message, number);
|
| 1463 | + _tcscat(message, _T(" "));
|
| 1464 | + _tcscat(message, _T("Keys: "));
|
| 1465 | + if (lastmousewparam[i] & MK_CONTROL) _tcscat(message, _T("CTRL "));
|
| 1466 | + if (lastmousewparam[i] & MK_SHIFT) _tcscat(message, _T("SHIFT "));
|
| 1467 | + _tcscat(message, _T("Buttons: "));
|
| 1468 | + if (lastmousewparam[i] & MK_LBUTTON) _tcscat(message, _T("L "));
|
| 1469 | + if (lastmousewparam[i] & MK_MBUTTON) _tcscat(message, _T("M "));
|
| 1470 | + if (lastmousewparam[i] & MK_RBUTTON) _tcscat(message, _T("R "));
|
| 1471 | + if (lastmousewparam[i] & MK_XBUTTON1) _tcscat(message, _T("X1 "));
|
| 1472 | + if (lastmousewparam[i] & MK_XBUTTON2) _tcscat(message, _T("X2 "));
|
| 1473 | + if ((x > width) || (y > height) || (x < 0) || (y < 0))
|
| 1474 | + {
|
| 1475 | + out[i] = TRUE;
|
| 1476 | + _tcscat(message, _T(" OUT OF BOUNDS"));
|
| 1477 | + }
|
| 1478 | + else out[i] = FALSE;
|
| 1479 | + if (out[i]) SetTextColor(hDCdest, RGB(255, 0, 0));
|
| 1480 | + else SetTextColor(hDCdest, RGB(255, 255, 255));
|
| 1481 | + SetBkColor(hDCdest, RGB(0, 0, 127));
|
| 1482 | + TextOut(hDCdest, 0, (i + 1)*textsize.cy, message, _tcslen(message));
|
1443 | 1483 | }
|
1444 | | - x = GET_X_LPARAM(lastmouselparam);
|
1445 | | - y = GET_Y_LPARAM(lastmouselparam);
|
1446 | | - _tcscat(message, _T("X="));
|
1447 | | - _itot(x, number, 10);
|
1448 | | - _tcscat(message, number);
|
1449 | | - _tcscat(message, _T(" "));
|
1450 | | - _tcscat(message, _T("Y="));
|
1451 | | - _itot(y, number, 10);
|
1452 | | - _tcscat(message, number);
|
1453 | | - _tcscat(message, _T(" "));
|
1454 | | - _tcscat(message, _T("Keys: "));
|
1455 | | - if (lastmousewparam & MK_CONTROL) _tcscat(message, _T("CTRL "));
|
1456 | | - if (lastmousewparam & MK_SHIFT) _tcscat(message, _T("SHIFT "));
|
1457 | | - _tcscat(message, _T("Buttons: "));
|
1458 | | - if (lastmousewparam & MK_LBUTTON) _tcscat(message, _T("L "));
|
1459 | | - if (lastmousewparam & MK_MBUTTON) _tcscat(message, _T("M "));
|
1460 | | - if (lastmousewparam & MK_RBUTTON) _tcscat(message, _T("R "));
|
1461 | | - if (lastmousewparam & MK_XBUTTON1) _tcscat(message, _T("X1 "));
|
1462 | | - if (lastmousewparam & MK_XBUTTON2) _tcscat(message, _T("X2 "));
|
1463 | | - if ((x > width) || (y > height) || (x < 0) || (y < 0))
|
1464 | | - {
|
1465 | | - out[0] = TRUE;
|
1466 | | - _tcscat(message, _T(" OUT OF BOUNDS"));
|
1467 | | - }
|
1468 | | - else out[0] = FALSE;
|
1469 | | - if (out[0]) SetTextColor(hDCdest, RGB(255, 0, 0));
|
1470 | | - else SetTextColor(hDCdest, RGB(255, 255, 255));
|
1471 | | - TextOut(hDCdest, 0, textsize.cy, message, _tcslen(message));
|
1472 | 1484 | GetCursorPos(&p);
|
1473 | 1485 | _tcscpy(message, _T("GetCursorPos() position: "));
|
1474 | 1486 | _tcscat(message, _T("X="));
|
— | — | @@ -1479,32 +1491,35 @@ |
1480 | 1492 | _tcscat(message, number);
|
1481 | 1493 | if ((p.x > width) || (p.y > height) || (p.x < 0) || (p.y < 0))
|
1482 | 1494 | {
|
1483 | | - out[1] = TRUE;
|
| 1495 | + out[8] = TRUE;
|
1484 | 1496 | _tcscat(message, _T(" OUT OF BOUNDS"));
|
1485 | 1497 | }
|
1486 | | - else out[1] = FALSE;
|
1487 | | - if (out[1]) SetTextColor(hDCdest, RGB(255, 0, 0));
|
| 1498 | + else out[8] = FALSE;
|
| 1499 | + if (out[8]) SetTextColor(hDCdest, RGB(255, 0, 0));
|
1488 | 1500 | else SetTextColor(hDCdest, RGB(255, 255, 255));
|
1489 | | - SetBkColor(hDCdest, RGB(0, 255, 0));
|
1490 | | - TextOut(hDCdest, 0, 2 * textsize.cy, message, _tcslen(message));
|
| 1501 | + SetBkColor(hDCdest, RGB(0, 127, 0));
|
| 1502 | + TextOut(hDCdest, 0, 9 * textsize.cy, message, _tcslen(message));
|
1491 | 1503 | SelectObject(hDCdest, displayfonts[1]);
|
1492 | 1504 | DeleteObject(displayfonts[0]);
|
1493 | 1505 | temp1->ReleaseDC(hDCdest);
|
1494 | 1506 | // Draw cursors
|
1495 | | - if (!out[0])
|
| 1507 | + for (i = 0; i < 8; i++)
|
1496 | 1508 | {
|
1497 | | - destrect.left = GET_X_LPARAM(lastmouselparam);
|
1498 | | - destrect.top = GET_Y_LPARAM(lastmouselparam);
|
1499 | | - destrect.right = GET_X_LPARAM(lastmouselparam) + sprites[0].ddsd.dwWidth;
|
1500 | | - if (destrect.right > width) destrect.right = width;
|
1501 | | - destrect.bottom = GET_Y_LPARAM(lastmouselparam) + sprites[0].ddsd.dwHeight;
|
1502 | | - if (destrect.bottom > height) destrect.bottom = height;
|
1503 | | - srcrect.left = srcrect.top = 0;
|
1504 | | - srcrect.right = destrect.right - destrect.left;
|
1505 | | - srcrect.bottom = destrect.bottom - destrect.top;
|
1506 | | - temp1->Blt(&destrect, sprites[0].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 1509 | + if (!out[i])
|
| 1510 | + {
|
| 1511 | + destrect.left = GET_X_LPARAM(lastmouselparam[i]);
|
| 1512 | + destrect.top = GET_Y_LPARAM(lastmouselparam[i]);
|
| 1513 | + destrect.right = GET_X_LPARAM(lastmouselparam[i]) + sprites[0].ddsd.dwWidth;
|
| 1514 | + if (destrect.right > width) destrect.right = width;
|
| 1515 | + destrect.bottom = GET_Y_LPARAM(lastmouselparam[i]) + sprites[0].ddsd.dwHeight;
|
| 1516 | + if (destrect.bottom > height) destrect.bottom = height;
|
| 1517 | + srcrect.left = srcrect.top = 0;
|
| 1518 | + srcrect.right = destrect.right - destrect.left;
|
| 1519 | + srcrect.bottom = destrect.bottom - destrect.top;
|
| 1520 | + temp1->Blt(&destrect, sprites[0].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
| 1521 | + }
|
1507 | 1522 | }
|
1508 | | - if (!out[1])
|
| 1523 | + if (!out[8])
|
1509 | 1524 | {
|
1510 | 1525 | destrect.left = p.x;
|
1511 | 1526 | destrect.top = p.y;
|
— | — | @@ -1517,6 +1532,7 @@ |
1518 | 1533 | srcrect.bottom = destrect.bottom - destrect.top;
|
1519 | 1534 | temp1->Blt(&destrect, sprites[1].surface, &srcrect, DDBLT_KEYSRC | DDBLT_WAIT, NULL);
|
1520 | 1535 | }
|
| 1536 | + if (backbuffers) temp1->Release();
|
1521 | 1537 | if (fullscreen)
|
1522 | 1538 | {
|
1523 | 1539 | if (backbuffers && ddsrender) ddsrender->Flip(NULL, DDFLIP_WAIT);
|