Index: cfgmgr/cfgmgr.c |
— | — | @@ -42,6 +42,18 @@ |
43 | 43 |
|
44 | 44 | DXGLCFG defaultmask;
|
45 | 45 |
|
| 46 | +#define INISECTION_NULL 0
|
| 47 | +#define INISECTION_SYSTEM 1
|
| 48 | +#define INISECTION_DISPLAY 2
|
| 49 | +#define INISECTION_SCALING 3
|
| 50 | +#define INISECTION_POSTPROCESS 4
|
| 51 | +#define INISECTION_D3D 5
|
| 52 | +#define INISECTION_ADVANCED 6
|
| 53 | +#define INISECTION_DEBUG 7
|
| 54 | +#define INISECTION_HACKS 8
|
| 55 | +
|
| 56 | +static int ini_currentsection = 0;
|
| 57 | +
|
46 | 58 | /**
|
47 | 59 | * Gets the hexadecimal digit for a number; the number must be less than 16
|
48 | 60 | * or 0x10.
|
— | — | @@ -1046,6 +1058,13 @@ |
1047 | 1059 | cfg->AddModes = INIIntValue(value);
|
1048 | 1060 | }
|
1049 | 1061 | if (!_stricmp(name, "SortModes")) cfg->SortModes = INIIntValue(value);
|
| 1062 | + if (!_stricmp(name, "VSync")) cfg->vsync = INIIntValue(value);
|
| 1063 | + if (!_stricmp(name, "CustomResolutionX")) cfg->CustomResolutionX = INIIntValue(value);
|
| 1064 | + if (!_stricmp(name, "CustomResolutionY")) cfg->CustomResolutionY = INIIntValue(value);
|
| 1065 | + if (!_stricmp(name, "CustomRefresh")) cfg->CustomRefresh = INIIntValue(value);
|
| 1066 | + if (!_stricmp(name, "DisplayMultiplierX")) cfg->DisplayMultiplierX = INIFloatValue(value);
|
| 1067 | + if (!_stricmp(name, "DisplayMultiplierY")) cfg->DisplayMultiplierY = INIFloatValue(value);
|
| 1068 | + if (!_stricmp(name, "SingleBufferDevice")) cfg->SingleBufferDevice = INIBoolValue(value);
|
1050 | 1069 | }
|
1051 | 1070 | if (!_stricmp(section, "scaling"))
|
1052 | 1071 | {
|
— | — | @@ -1058,11 +1077,6 @@ |
1059 | 1078 | if (!_stricmp(name, "PrimaryScaleY")) cfg->primaryscaley = INIFloatValue(value);
|
1060 | 1079 | if (!_stricmp(name, "ScreenAspect")) cfg->aspect = INIAspectValue(value);
|
1061 | 1080 | if (!_stricmp(name, "DPIScale")) cfg->DPIScale = INIIntValue(value);
|
1062 | | - if (!_stricmp(name, "CustomResolutionX")) cfg->CustomResolutionX = INIIntValue(value);
|
1063 | | - if (!_stricmp(name, "CustomResolutionY")) cfg->CustomResolutionY = INIIntValue(value);
|
1064 | | - if (!_stricmp(name, "CustomRefresh")) cfg->CustomRefresh = INIIntValue(value);
|
1065 | | - if (!_stricmp(name, "DisplayMultiplierX")) cfg->DisplayMultiplierX = INIFloatValue(value);
|
1066 | | - if (!_stricmp(name, "DisplayMultiplierY")) cfg->DisplayMultiplierY = INIFloatValue(value);
|
1067 | 1081 | }
|
1068 | 1082 | if (!_stricmp(section, "postprocess"))
|
1069 | 1083 | {
|
— | — | @@ -1091,10 +1105,8 @@ |
1092 | 1106 | }
|
1093 | 1107 | if (!_stricmp(section, "advanced"))
|
1094 | 1108 | {
|
1095 | | - if (!_stricmp(name, "VSync")) cfg->vsync = INIIntValue(value);
|
1096 | 1109 | if (!_stricmp(name, "TextureFormat")) cfg->TextureFormat = INIIntValue(value);
|
1097 | 1110 | if (!_stricmp(name, "TexUpload")) cfg->TexUpload = INIIntValue(value);
|
1098 | | - if (!_stricmp(name, "SingleBufferDevice")) cfg->SingleBufferDevice = INIBoolValue(value);
|
1099 | 1111 | if (!_stricmp(name, "WindowPosition")) cfg->WindowPosition = INIIntValue(value);
|
1100 | 1112 | if (!_stricmp(name, "RememberWindowSize")) cfg->RememberWindowSize = INIBoolValue(value);
|
1101 | 1113 | if (!_stricmp(name, "RememberWindowPosition")) cfg->RememberWindowPosition = INIBoolValue(value);
|
— | — | @@ -1147,12 +1159,398 @@ |
1148 | 1160 | }
|
1149 | 1161 | }
|
1150 | 1162 |
|
1151 | | -DWORD WriteINI(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR path)
|
| 1163 | +void SetINISection(HANDLE file, int section)
|
1152 | 1164 | {
|
1153 | | - //TODO: Write INI file.
|
1154 | | - return ERROR_CALL_NOT_IMPLEMENTED;
|
| 1165 | + char buffer[32];
|
| 1166 | + int buffersize;
|
| 1167 | + int outsize;
|
| 1168 | + if (section != ini_currentsection)
|
| 1169 | + {
|
| 1170 | + ini_currentsection = section;
|
| 1171 | + switch (section)
|
| 1172 | + {
|
| 1173 | + case INISECTION_SYSTEM:
|
| 1174 | + strcpy(buffer, "\r\n[system]\r\n");
|
| 1175 | + break;
|
| 1176 | + case INISECTION_DISPLAY:
|
| 1177 | + strcpy(buffer, "\r\n[display]\r\n");
|
| 1178 | + break;
|
| 1179 | + case INISECTION_SCALING:
|
| 1180 | + strcpy(buffer, "\r\n[scaling]\r\n");
|
| 1181 | + break;
|
| 1182 | + case INISECTION_POSTPROCESS:
|
| 1183 | + strcpy(buffer, "\r\n[postprocess]\r\n");
|
| 1184 | + break;
|
| 1185 | + case INISECTION_D3D:
|
| 1186 | + strcpy(buffer, "\r\n[d3d]\r\n");
|
| 1187 | + break;
|
| 1188 | + case INISECTION_ADVANCED:
|
| 1189 | + strcpy(buffer, "\r\n[advanced]\r\n");
|
| 1190 | + break;
|
| 1191 | + case INISECTION_DEBUG:
|
| 1192 | + strcpy(buffer, "\r\n[debug]\r\n");
|
| 1193 | + break;
|
| 1194 | + case INISECTION_HACKS:
|
| 1195 | + strcpy(buffer, "\r\n[hacks]\r\n");
|
| 1196 | + break;
|
| 1197 | + default:
|
| 1198 | + return;
|
| 1199 | + }
|
| 1200 | + buffersize = strlen(buffer);
|
| 1201 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1202 | + }
|
1155 | 1203 | }
|
1156 | 1204 |
|
| 1205 | +void INIWriteBool(HANDLE file, const char *name, BOOL value, BOOL mask, int section)
|
| 1206 | +{
|
| 1207 | + char buffer[256];
|
| 1208 | + int buffersize;
|
| 1209 | + int outsize;
|
| 1210 | + if (mask)
|
| 1211 | + {
|
| 1212 | + SetINISection(file, section);
|
| 1213 | + strcpy(buffer, name);
|
| 1214 | + strcat(buffer, "=");
|
| 1215 | + if (value) strcat(buffer, "true");
|
| 1216 | + else strcat(buffer, "false");
|
| 1217 | + strcat(buffer, "\r\n");
|
| 1218 | + buffersize = strlen(buffer);
|
| 1219 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1220 | + }
|
| 1221 | +}
|
| 1222 | +
|
| 1223 | +void INIWriteInt(HANDLE file, const char *name, DWORD value, DWORD mask, int section)
|
| 1224 | +{
|
| 1225 | + char buffer[256];
|
| 1226 | + char number[32];
|
| 1227 | + int buffersize;
|
| 1228 | + int outsize;
|
| 1229 | + if (mask)
|
| 1230 | + {
|
| 1231 | + SetINISection(file, section);
|
| 1232 | + strcpy(buffer, name);
|
| 1233 | + strcat(buffer, "=");
|
| 1234 | + itoa(value, number, 10);
|
| 1235 | + strcat(buffer, number);
|
| 1236 | + strcat(buffer, "\r\n");
|
| 1237 | + buffersize = strlen(buffer);
|
| 1238 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1239 | + }
|
| 1240 | +}
|
| 1241 | +
|
| 1242 | +void INIWriteHex(HANDLE file, const char *name, DWORD value, DWORD mask, int section)
|
| 1243 | +{
|
| 1244 | + char buffer[256];
|
| 1245 | + char number[32];
|
| 1246 | + int buffersize;
|
| 1247 | + int outsize;
|
| 1248 | + if (mask)
|
| 1249 | + {
|
| 1250 | + SetINISection(file, section);
|
| 1251 | + strcpy(buffer, name);
|
| 1252 | + strcat(buffer, "=0x");
|
| 1253 | + itoa(value, number, 16);
|
| 1254 | + strcat(buffer, number);
|
| 1255 | + strcat(buffer, "\r\n");
|
| 1256 | + buffersize = strlen(buffer);
|
| 1257 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1258 | + }
|
| 1259 | +}
|
| 1260 | +
|
| 1261 | +void INIWriteFloat(HANDLE file, const char *name, float value, float mask, int digits, int section)
|
| 1262 | +{
|
| 1263 | + char buffer[256];
|
| 1264 | + char number[32];
|
| 1265 | + char floatformat[16];
|
| 1266 | + int buffersize;
|
| 1267 | + int outsize;
|
| 1268 | + if (mask)
|
| 1269 | + {
|
| 1270 | + SetINISection(file, section);
|
| 1271 | + strcpy(buffer, name);
|
| 1272 | + strcat(buffer, "=");
|
| 1273 | + itoa(digits, number, 10);
|
| 1274 | + strcpy(floatformat, "%.");
|
| 1275 | + strcat(floatformat, number);
|
| 1276 | + strcat(floatformat, "g");
|
| 1277 | + _snprintf(number, 31, floatformat, value);
|
| 1278 | + itoa(value, number, 10);
|
| 1279 | + strcat(buffer, number);
|
| 1280 | + strcat(buffer, "\r\n");
|
| 1281 | + buffersize = strlen(buffer);
|
| 1282 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1283 | + }
|
| 1284 | +}
|
| 1285 | +
|
| 1286 | +void FloatToAspectString(float f, char *aspect)
|
| 1287 | +{
|
| 1288 | + double integer;
|
| 1289 | + double dummy;
|
| 1290 | + double fract;
|
| 1291 | + char denominator[5];
|
| 1292 | + int i;
|
| 1293 | + if (_isnan(f)) f = 0.0f; //Handle NAN condition
|
| 1294 | + if (f >= 1000.0f) // Clamp ridiculously wide aspects
|
| 1295 | + {
|
| 1296 | + strcpy(aspect, "1000:1");
|
| 1297 | + return;
|
| 1298 | + }
|
| 1299 | + if (f < 0.001f) // Exclude ridiculously tall aspects, zero, and negative
|
| 1300 | + {
|
| 1301 | + strcpy(aspect, "Default");
|
| 1302 | + return;
|
| 1303 | + }
|
| 1304 | + // Handle common aspects
|
| 1305 | + if (fabs(f - 1.25f) < 0.0001f)
|
| 1306 | + {
|
| 1307 | + strcpy(aspect, "5:4");
|
| 1308 | + return;
|
| 1309 | + }
|
| 1310 | + if (fabs(f - 1.3333333f) < 0.0001f)
|
| 1311 | + {
|
| 1312 | + strcpy(aspect, "4:3");
|
| 1313 | + return;
|
| 1314 | + }
|
| 1315 | + if (fabs(f - 1.6f) < 0.0001f)
|
| 1316 | + {
|
| 1317 | + strcpy(aspect, "16:10");
|
| 1318 | + return;
|
| 1319 | + }
|
| 1320 | + if (fabs(f - 1.7777777) < 0.0001f)
|
| 1321 | + {
|
| 1322 | + strcpy(aspect, "16:9");
|
| 1323 | + return;
|
| 1324 | + }
|
| 1325 | + if (fabs(f - 1.9333333) < 0.0001f)
|
| 1326 | + {
|
| 1327 | + strcpy(aspect, "256:135");
|
| 1328 | + return;
|
| 1329 | + }
|
| 1330 | + fract = modf(f, &integer);
|
| 1331 | + if (fract < 0.0001f) //Handle integer aspects
|
| 1332 | + {
|
| 1333 | + _itoa((int)integer, aspect, 10);
|
| 1334 | + strcat(aspect, ":1");
|
| 1335 | + return;
|
| 1336 | + }
|
| 1337 | + // Finally try from 2 to 1000
|
| 1338 | + for (i = 2; i < 1000; i++)
|
| 1339 | + {
|
| 1340 | + if (fabs(modf(fract*i, &dummy)) < 0.0001f)
|
| 1341 | + {
|
| 1342 | + _itoa((f*i) + .5f, aspect, 10);
|
| 1343 | + _itoa(i, denominator, 10);
|
| 1344 | + strcat(aspect, ":");
|
| 1345 | + strcat(aspect, denominator);
|
| 1346 | + return;
|
| 1347 | + }
|
| 1348 | + }
|
| 1349 | + // Cannot find a reasonable fractional aspect, so display as decimal.
|
| 1350 | + sprintf(aspect, "%.6g", f);
|
| 1351 | +}
|
| 1352 | +
|
| 1353 | +void INIWriteAspect(HANDLE file, const char *name, float value, float mask, int section)
|
| 1354 | +{
|
| 1355 | + char buffer[256];
|
| 1356 | + char number[32];
|
| 1357 | + char floatformat[16];
|
| 1358 | + int buffersize;
|
| 1359 | + int outsize;
|
| 1360 | + if (mask)
|
| 1361 | + {
|
| 1362 | + SetINISection(file, section);
|
| 1363 | + strcpy(buffer, name);
|
| 1364 | + strcat(buffer, "=");
|
| 1365 | + FloatToAspectString(value,number);
|
| 1366 | + strcat(buffer, number);
|
| 1367 | + strcat(buffer, "\r\n");
|
| 1368 | + buffersize = strlen(buffer);
|
| 1369 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1370 | + }
|
| 1371 | +}
|
| 1372 | +
|
| 1373 | +void INIWriteString(HANDLE file, const char *name, const char *value, DWORD mask, int section)
|
| 1374 | +{
|
| 1375 | + char buffer[512];
|
| 1376 | + int buffersize;
|
| 1377 | + int outsize;
|
| 1378 | + if (mask)
|
| 1379 | + {
|
| 1380 | + SetINISection(file, section);
|
| 1381 | + strcpy(buffer, name);
|
| 1382 | + strcat(buffer, "=");
|
| 1383 | + strcat(buffer, value);
|
| 1384 | + strcat(buffer, "\r\n");
|
| 1385 | + buffersize = strlen(buffer);
|
| 1386 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1387 | + }
|
| 1388 | +}
|
| 1389 | +
|
| 1390 | +void INIWriteTCHARString(HANDLE file, const char *name, LPCTSTR value, DWORD mask, int section)
|
| 1391 | +{
|
| 1392 | + char buffer[512];
|
| 1393 | +#ifdef _UNICODE
|
| 1394 | + wchar_t unicodebuffer[MAX_PATH + 1];
|
| 1395 | +#endif
|
| 1396 | + int buffersize;
|
| 1397 | + int outsize;
|
| 1398 | + if (mask)
|
| 1399 | + {
|
| 1400 | + SetINISection(file, section);
|
| 1401 | + strcpy(buffer, name);
|
| 1402 | + strcat(buffer, "=");
|
| 1403 | +#ifdef _UNICODE
|
| 1404 | + WideCharToMultiByte(CP_UTF8, 0, value, _tcslen(value), unicodebuffer, MAX_PATH, NULL, NULL);
|
| 1405 | + strcat(buffer, unicodebuffer);
|
| 1406 | +#else
|
| 1407 | + strcat(buffer, value);
|
| 1408 | +#endif
|
| 1409 | + strcat(buffer, "\r\n");
|
| 1410 | + buffersize = strlen(buffer);
|
| 1411 | + WriteFile(file, buffer, buffersize, &outsize, NULL);
|
| 1412 | + }
|
| 1413 | +}
|
| 1414 | +
|
| 1415 | +DWORD WriteINI(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR path, HWND hWnd)
|
| 1416 | +{
|
| 1417 | + Sha256Context sha_context;
|
| 1418 | + SHA256_HASH sha256;
|
| 1419 | + char sha256string[65];
|
| 1420 | + char buffer[512];
|
| 1421 | + DWORD bytesread;
|
| 1422 | + HANDLE file, file2;
|
| 1423 | + TCHAR inipath[MAX_PATH + 10];
|
| 1424 | + DWORD error;
|
| 1425 | + int i;
|
| 1426 | + int answer;
|
| 1427 | + _tcscpy(inipath, path);
|
| 1428 | + _tcscat(inipath, _T("\\dxgl.ini"));
|
| 1429 | + file = CreateFile(inipath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
| 1430 | + if (file == INVALID_HANDLE_VALUE)
|
| 1431 | + {
|
| 1432 | + error = GetLastError();
|
| 1433 | + if (error == ERROR_FILE_EXISTS)
|
| 1434 | + {
|
| 1435 | + answer = MessageBox(hWnd, _T("File already exists. Do you want to overwrite it?"),
|
| 1436 | + _T("File exists"), MB_YESNO | MB_ICONQUESTION);
|
| 1437 | + if (answer == IDNO) return error;
|
| 1438 | + }
|
| 1439 | + else return error;
|
| 1440 | + file = CreateFile(inipath, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
| 1441 | + if (file == INVALID_HANDLE_VALUE) return GetLastError();
|
| 1442 | + }
|
| 1443 | + ini_currentsection = INISECTION_NULL;
|
| 1444 | + strcpy(buffer, "; DXGL Configuration file\r\n; This file was generated by DXGL Config.\r\n");
|
| 1445 | + WriteFile(file, buffer, strlen(buffer), &bytesread, NULL);
|
| 1446 | + // [system]
|
| 1447 | + if (cfg->NoWriteRegistry) INIWriteBool(file, "NoWriteRegistry", TRUE, TRUE, INISECTION_SYSTEM);
|
| 1448 | + if (cfg->OverrideDefaults) INIWriteBool(file, "OverrideDefaults", TRUE, TRUE, INISECTION_SYSTEM);
|
| 1449 | + if (cfg->NoOverwrite) INIWriteBool(file, "NoOverwrite", TRUE, TRUE, INISECTION_SYSTEM);
|
| 1450 | + if (cfg->SaveSHA256)
|
| 1451 | + {
|
| 1452 | + _tcscpy(inipath, path);
|
| 1453 | + _tcscat(inipath, _T("\\ddraw.dll"));
|
| 1454 | + Sha256Initialise(&sha_context);
|
| 1455 | + file2 = CreateFile(inipath, GENERIC_READ, FILE_SHARE_READ, NULL,
|
| 1456 | + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
| 1457 | + if (file2 != INVALID_HANDLE_VALUE)
|
| 1458 | + {
|
| 1459 | + while (1)
|
| 1460 | + {
|
| 1461 | + ReadFile(file2, buffer, 512, &bytesread, NULL);
|
| 1462 | + if (!bytesread) break;
|
| 1463 | + Sha256Update(&sha_context, buffer, bytesread);
|
| 1464 | + if (bytesread < 512) break;
|
| 1465 | + }
|
| 1466 | + Sha256Finalise(&sha_context, &sha256);
|
| 1467 | + CloseHandle(file2);
|
| 1468 | + ZeroMemory(sha256string, 65 * sizeof(char));
|
| 1469 | + for (i = 0; i < (256 / 8); i++)
|
| 1470 | + {
|
| 1471 | + sha256string[i * 2] = hexdigit(sha256.bytes[i] >> 4);
|
| 1472 | + sha256string[(i * 2) + 1] = hexdigit(sha256.bytes[i] & 0xF);
|
| 1473 | + }
|
| 1474 | + strcpy(buffer, "; Do not change the following value!\r\n");
|
| 1475 | + WriteFile(file, buffer, strlen(buffer), &bytesread, NULL);
|
| 1476 | + INIWriteString(file, "BundledDDrawSHA256", sha256string, 1, INISECTION_SYSTEM);
|
| 1477 | + }
|
| 1478 | + else MessageBox(hWnd, _T("Cannot read ddraw.dll, skipping SHA-256 checksum"),
|
| 1479 | + _T("Warning"), MB_OK | MB_ICONWARNING);
|
| 1480 | + }
|
| 1481 | + if (cfg->NoUninstall) INIWriteBool(file, "NoUninstall", TRUE, TRUE, INISECTION_SYSTEM);
|
| 1482 | + // [display]
|
| 1483 | + INIWriteInt(file, "ScalingMode", cfg->scaler, mask->scaler, INISECTION_DISPLAY);
|
| 1484 | + INIWriteInt(file, "FullscreenWindowMode", cfg->fullmode, mask->fullmode, INISECTION_DISPLAY);
|
| 1485 | + INIWriteBool(file, "ChangeColorDepth", cfg->colormode, mask->colormode, INISECTION_DISPLAY);
|
| 1486 | + INIWriteInt(file, "AddColorDepths", cfg->AddColorDepths, mask->AddColorDepths, INISECTION_DISPLAY);
|
| 1487 | + INIWriteInt(file, "AddModes", cfg->AddModes, mask->AddModes, INISECTION_DISPLAY);
|
| 1488 | + INIWriteInt(file, "SortModes", cfg->SortModes, mask->SortModes, INISECTION_DISPLAY);
|
| 1489 | + INIWriteInt(file, "VSync", cfg->vsync, mask->vsync, INISECTION_DISPLAY);
|
| 1490 | + INIWriteInt(file, "CustomResolutionX", cfg->CustomResolutionX, mask->CustomResolutionX, INISECTION_DISPLAY);
|
| 1491 | + INIWriteInt(file, "CustomResolutionY", cfg->CustomResolutionY, mask->CustomResolutionY, INISECTION_DISPLAY);
|
| 1492 | + INIWriteInt(file, "CustomRefresh", cfg->CustomRefresh, mask->CustomRefresh, INISECTION_DISPLAY);
|
| 1493 | + INIWriteFloat(file, "DisplayMultiplierX", cfg->DisplayMultiplierX, mask->DisplayMultiplierX, 4, INISECTION_DISPLAY);
|
| 1494 | + INIWriteFloat(file, "DisplayMultiplierY", cfg->DisplayMultiplierY, mask->DisplayMultiplierY, 4, INISECTION_DISPLAY);
|
| 1495 | + INIWriteInt(file, "SingleBufferDevice", cfg->SingleBufferDevice, mask->SingleBufferDevice, INISECTION_DISPLAY);
|
| 1496 | + // [scaling]
|
| 1497 | + INIWriteInt(file, "ScalingFilter", cfg->scalingfilter, mask->scalingfilter, INISECTION_SCALING);
|
| 1498 | + INIWriteInt(file, "BltScale", cfg->BltScale, mask->BltScale, INISECTION_SCALING);
|
| 1499 | + // Option was temporarily removed for DXGL 0.5.13 release
|
| 1500 | + //INIWriteInt(file, "BltThreshold", cfg->BltThreshold, mask->BltThreshold, INISECTION_SCALING);
|
| 1501 | + INIWriteInt(file, "AdjustPrimaryResolution", cfg->primaryscale, mask->primaryscale, INISECTION_SCALING);
|
| 1502 | + INIWriteFloat(file, "PrimaryScaleX", cfg->primaryscalex, mask->primaryscalex, 4, INISECTION_SCALING);
|
| 1503 | + INIWriteFloat(file, "PrimaryScaleY", cfg->primaryscaley, mask->primaryscaley, 4, INISECTION_SCALING);
|
| 1504 | + INIWriteAspect(file, "ScreenAspect", cfg->aspect, mask->aspect, INISECTION_SCALING);
|
| 1505 | + INIWriteInt(file, "DPIScale", cfg->DPIScale, mask->DPIScale, INISECTION_SCALING);
|
| 1506 | + // [postprocess]
|
| 1507 | + INIWriteInt(file, "PostprocessFilter", cfg->postfilter, mask->postfilter, INISECTION_POSTPROCESS);
|
| 1508 | + INIWriteFloat(file, "PostprocessScaleX", cfg->postsizex, mask->postsizex, 4, INISECTION_POSTPROCESS);
|
| 1509 | + INIWriteFloat(file, "PostprocessScaleY", cfg->postsizey, mask->postsizey, 4, INISECTION_POSTPROCESS);
|
| 1510 | + INIWriteInt(file, "EnableShader", cfg->EnableShader, mask->EnableShader, INISECTION_POSTPROCESS);
|
| 1511 | + INIWriteTCHARString(file, "ShaderFile", cfg->shaderfile, mask->shaderfile[0], INISECTION_POSTPROCESS);
|
| 1512 | + // [d3d]
|
| 1513 | + INIWriteInt(file, "TextureFilter", cfg->texfilter, mask->texfilter, INISECTION_D3D);
|
| 1514 | + INIWriteInt(file, "AnisotropicFiltering", cfg->anisotropic, mask->anisotropic, INISECTION_D3D);
|
| 1515 | + INIWriteHex(file, "Antialiasing", cfg->msaa, mask->msaa, INISECTION_D3D);
|
| 1516 | + INIWriteInt(file, "D3DAspect", cfg->aspect3d, mask->aspect3d, INISECTION_D3D);
|
| 1517 | + INIWriteInt(file, "LowColorRendering", cfg->LowColorRendering, mask->LowColorRendering, INISECTION_D3D);
|
| 1518 | + INIWriteInt(file, "EnableDithering", cfg->EnableDithering, mask->EnableDithering, INISECTION_D3D);
|
| 1519 | + // [advanced]
|
| 1520 | + INIWriteInt(file, "TextureFormat", cfg->TextureFormat, mask->TextureFormat, INISECTION_ADVANCED);
|
| 1521 | + INIWriteInt(file, "TexUpload", cfg->TexUpload, mask->TexUpload, INISECTION_ADVANCED);
|
| 1522 | + INIWriteInt(file, "WindowPosition", cfg->WindowPosition, mask->WindowPosition, INISECTION_ADVANCED);
|
| 1523 | + INIWriteBool(file, "RememberWindowSize", cfg->RememberWindowSize, mask->RememberWindowSize, INISECTION_ADVANCED);
|
| 1524 | + INIWriteBool(file, "RememberWindowPosition", cfg->RememberWindowPosition, mask->RememberWindowPosition, INISECTION_ADVANCED);
|
| 1525 | + INIWriteBool(file, "NoResizeWindow", cfg->NoResizeWindow, mask->NoResizeWindow, INISECTION_ADVANCED);
|
| 1526 | + INIWriteInt(file, "WindowX", cfg->WindowX, mask->WindowX, INISECTION_ADVANCED);
|
| 1527 | + INIWriteInt(file, "WindowY", cfg->WindowY, mask->WindowY, INISECTION_ADVANCED);
|
| 1528 | + INIWriteInt(file, "WindowWidth", cfg->WindowWidth, mask->WindowWidth, INISECTION_ADVANCED);
|
| 1529 | + INIWriteInt(file, "WindowHeight", cfg->WindowHeight, mask->WindowHeight, INISECTION_ADVANCED);
|
| 1530 | + INIWriteBool(file, "WindowMaximized", cfg->WindowMaximized, mask->WindowMaximized, INISECTION_ADVANCED);
|
| 1531 | + INIWriteBool(file, "CaptureMouse", cfg->CaptureMouse, mask->CaptureMouse, INISECTION_ADVANCED);
|
| 1532 | + // [debug]
|
| 1533 | + INIWriteBool(file, "DebugNoExtFramebuffer", cfg->DebugNoExtFramebuffer, mask->DebugNoExtFramebuffer, INISECTION_DEBUG);
|
| 1534 | + INIWriteBool(file, "DebugNoArbFramebuffer", cfg->DebugNoArbFramebuffer, mask->DebugNoArbFramebuffer, INISECTION_DEBUG);
|
| 1535 | + INIWriteBool(file, "DebugNoES2Compatibility", cfg->DebugNoES2Compatibility, mask->DebugNoES2Compatibility, INISECTION_DEBUG);
|
| 1536 | + INIWriteBool(file, "DebugNoExtDirectStateAccess", cfg->DebugNoExtDirectStateAccess, mask->DebugNoExtDirectStateAccess, INISECTION_DEBUG);
|
| 1537 | + INIWriteBool(file, "DebugNoArbDirectStateAccess", cfg->DebugNoArbDirectStateAccess, mask->DebugNoArbDirectStateAccess, INISECTION_DEBUG);
|
| 1538 | + INIWriteBool(file, "DebugNoSamplerObjects", cfg->DebugNoSamplerObjects, mask->DebugNoSamplerObjects, INISECTION_DEBUG);
|
| 1539 | + INIWriteBool(file, "DebugNoGpuShader4", cfg->DebugNoGpuShader4, mask->DebugNoGpuShader4, INISECTION_DEBUG);
|
| 1540 | + INIWriteBool(file, "DebugNoGLSL130", cfg->DebugNoGLSL130, mask->DebugNoGLSL130, INISECTION_DEBUG);
|
| 1541 | + INIWriteBool(file, "DebugUnloadAfterUnlock", cfg->DebugUploadAfterUnlock, mask->DebugUploadAfterUnlock, INISECTION_DEBUG);
|
| 1542 | + INIWriteBool(file, "DebugBlendDestColorKey", cfg->DebugBlendDestColorKey, mask->DebugBlendDestColorKey, INISECTION_DEBUG);
|
| 1543 | + INIWriteBool(file, "DebugNoMouseHooks", cfg->DebugNoMouseHooks, mask->DebugNoMouseHooks, INISECTION_DEBUG);
|
| 1544 | + INIWriteBool(file, "DebugMaxGLVersionMajor", cfg->DebugMaxGLVersionMajor, mask->DebugMaxGLVersionMajor, INISECTION_DEBUG);
|
| 1545 | + INIWriteBool(file, "DebugMaxGLVersionMinor", cfg->DebugMaxGLVersionMinor, mask->DebugMaxGLVersionMinor, INISECTION_DEBUG);
|
| 1546 | + // [hacks]
|
| 1547 | + INIWriteBool(file, "HackCrop640480to640400", cfg->HackCrop640480to640400, mask->HackCrop640480to640400, INISECTION_HACKS);
|
| 1548 | + INIWriteInt(file, "HackAutoScale512448to640480", cfg->HackAutoScale512448to640480, mask->HackAutoScale512448to640480, INISECTION_HACKS);
|
| 1549 | + INIWriteBool(file, "HackNoTVRefresh", cfg->HackNoTVRefresh, mask->HackNoTVRefresh, INISECTION_HACKS);
|
| 1550 | + INIWriteBool(file, "HackSetCursor", cfg->HackSetCursor, mask->HackSetCursor, INISECTION_HACKS);
|
| 1551 | + CloseHandle(file);
|
| 1552 | + return ERROR_SUCCESS;
|
| 1553 | +}
|
| 1554 | +
|
1157 | 1555 | void GetCurrentConfig(DXGLCFG *cfg, BOOL initial)
|
1158 | 1556 | {
|
1159 | 1557 | HKEY hKey;
|
Index: cfgmgr/cfgmgr.h |
— | — | @@ -29,6 +29,9 @@ |
30 | 30 | // [system]
|
31 | 31 | DWORD NoWriteRegistry;
|
32 | 32 | DWORD OverrideDefaults;
|
| 33 | + DWORD NoOverwrite;
|
| 34 | + DWORD SaveSHA256;
|
| 35 | + DWORD NoUninstall;
|
33 | 36 | // [display]
|
34 | 37 | DWORD scaler;
|
35 | 38 | DWORD fullmode;
|
— | — | @@ -128,7 +131,7 @@ |
129 | 132 |
|
130 | 133 | void ReadSettings(HKEY hKey, DXGLCFG *cfg, DXGLCFG *mask, BOOL global, BOOL dll, LPTSTR dir);
|
131 | 134 | void WriteSettings(HKEY hKey, const DXGLCFG *cfg, const DXGLCFG *mask);
|
132 | | -DWORD WriteINI(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR path);
|
| 135 | +DWORD WriteINI(DXGLCFG *cfg, DXGLCFG *mask, LPCTSTR path, HWND hWnd);
|
133 | 136 | void GetCurrentConfig(DXGLCFG *cfg, BOOL initial);
|
134 | 137 | void GetGlobalConfig(DXGLCFG *cfg, BOOL initial);
|
135 | 138 | void GetGlobalConfigWithMask(DXGLCFG *cfg, DXGLCFG *mask, BOOL initial);
|
Index: dxgl-example.ini |
— | — | @@ -9,7 +9,7 @@ |
10 | 10 | ; Set to true if distributing the DXGL ddraw.dll with a game or application.
|
11 | 11 | ; Default is false so ensure the following line is set to avoid writing to
|
12 | 12 | ; the end user's registry.
|
13 | | -NoWriteRegistry = true
|
| 13 | +NoWriteRegistry=true
|
14 | 14 |
|
15 | 15 | ; OverrideDefaults - Boolean
|
16 | 16 | ; If true, settings not set in the .ini file will not be read from the
|
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | ; created if it does not exist.
|
21 | 21 | ; If false, the settings in DXGL Config global section will be used as default.
|
22 | 22 | ; Default is false
|
23 | | -OverrideDefaults = false
|
| 23 | +OverrideDefaults=false
|
24 | 24 |
|
25 | 25 | ; NoOverwrite - Boolean
|
26 | 26 | ; If true, DXGL Config will not overwrite the copy of ddraw in the application
|
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | ; the DXGL consumer application will not remove that copy of ddraw.dll. This
|
31 | 31 | ; will be enforced, even if the existing copy of ddraw.dll is not DXGL.
|
32 | 32 | ; Default is false
|
33 | | -NoOverwrite = false
|
| 33 | +NoOverwrite=false
|
34 | 34 |
|
35 | 35 | ; BundledDDrawSHA256 - String
|
36 | 36 | ; This field may be used to define the SHA256 checksum of the copy of ddraw.dll
|
— | — | @@ -41,7 +41,7 @@ |
42 | 42 | ; file is in the application directory with the SHA256 checksum of the bundled
|
43 | 43 | ; ddraw.dll file. This will be ignored if NoOverwrite is true.
|
44 | 44 | ; Default is a zero length string, disabling the backup feature.
|
45 | | -BundledDDrawSHA256 =
|
| 45 | +;BundledDDrawSHA256=
|
46 | 46 |
|
47 | 47 | ; NoUninstall - Boolean
|
48 | 48 | ; If true, DXGL will not delete the copy of ddraw.dll in the application folder
|
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | ; BundledDDrawSHA256 variable, it will not be restored, and the end-user must
|
52 | 52 | ; manually copy back the ddraw.dll.dxgl-backup file.
|
53 | 53 | ; Default is false.
|
54 | | -NoUninstall = false
|
| 54 | +NoUninstall=false
|
55 | 55 |
|
56 | 56 | [display]
|
57 | 57 | ; ScalingMode - Integer
|
— | — | @@ -68,7 +68,7 @@ |
69 | 69 | ; 8 - Center output, multiply by custom values
|
70 | 70 | ; 9 - Set display to custom resolution and refresh
|
71 | 71 | ; 10 - Center output, scale to custom size
|
72 | | -ScalingMode = 0
|
| 72 | +ScalingMode=0
|
73 | 73 |
|
74 | 74 | ; FullscreenWindowMode - Integer
|
75 | 75 | ; Determines how DXGL will draw the window for fullscreen modes.
|
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | ; 3 - Use a resizable window, uses scaler mode, preferably 1, 2, 3, or 7
|
82 | 82 | ; 4 - Use a borderless, non-resizable window, also known as windowed borderless
|
83 | 83 | ; 5 - Use a borderless window scaled to the screen
|
84 | | -FullscreenWindowMode = 0
|
| 84 | +FullscreenWindowMode=0
|
85 | 85 |
|
86 | 86 | ; ChangeColorDepth - Boolean
|
87 | 87 | ; If true, Windows will attempt to change the color depth of the screen.
|
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | ; DXGL always performs color depth conversion for DirectDraw internally
|
93 | 93 | ; via the OpenGL runtime regardless of the operating system's display mode.
|
94 | 94 | ; Default is false and is recommended except in special circumstances.
|
95 | | -ChangeColorDepth = false
|
| 95 | +ChangeColorDepth=false
|
96 | 96 |
|
97 | 97 | ; AllColorDepths - Boolean
|
98 | 98 | ; Adds 8, 16, 24, and 32-bit color modes if they are not already
|
— | — | @@ -99,7 +99,7 @@ |
100 | 100 | ; Equivalent to setting AddColorDepths to 21.
|
101 | 101 | ; Overridden by AddColorDepths.
|
102 | 102 | ; Default is true if Windows 8 or higher is detected, false otherwise.
|
103 | | -AllColorDepths = true
|
| 103 | +AllColorDepths=true
|
104 | 104 |
|
105 | 105 | ; AddColorDepths - Integer
|
106 | 106 | ; (future) Adds additional color modes if they are not already
|
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | ; Default is 21 if Windows 8 or higher is detected, 0 otherwise.
|
116 | 116 | ; Adding both 15 and 16 bit modes at the same time may cause
|
117 | 117 | ; crashes or undefined behavior in some programs.
|
118 | | -AddColorDepths = 21
|
| 118 | +AddColorDepths=21
|
119 | 119 |
|
120 | 120 | ; ExtraModes - Boolean
|
121 | 121 | ; Adds additional video modes to the list of resolutions.
|
— | — | @@ -123,7 +123,7 @@ |
124 | 124 | ; video modes.
|
125 | 125 | ; Default is true.
|
126 | 126 | ; Equivalent to setting AddModes to 7. Overridden by AddModes.
|
127 | | -ExtraModes = true
|
| 127 | +ExtraModes=true
|
128 | 128 |
|
129 | 129 | ; AddModes - Integer
|
130 | 130 | ; Adds additional video modes to the list of resolutions.
|
— | — | @@ -138,7 +138,7 @@ |
139 | 139 | ; 32 - Add over-4K UHD modes. Check GPU specifications before enabling.
|
140 | 140 | ; 64 - Add very uncommon resolutions of all dimensions.
|
141 | 141 | ; Default is 1.
|
142 | | -AddModes = 1
|
| 142 | +AddModes=1
|
143 | 143 |
|
144 | 144 | ; SortModes - Integer
|
145 | 145 | ; Determines whether or not to sort display modes by either
|
— | — | @@ -152,33 +152,47 @@ |
153 | 153 | ; 1 - Sort video modes, grouping by color depth.
|
154 | 154 | ; 2 - Sort video modes, grouping by resolution.
|
155 | 155 | ; Default is 0.
|
156 | | -SortModes = 0
|
| 156 | +SortModes=0
|
157 | 157 |
|
| 158 | +; VSync - Integer
|
| 159 | +; Determines vertical retrace behavior.
|
| 160 | +; The following values are currently available:
|
| 161 | +; 0 - Wait for V-sync when the application requests it.
|
| 162 | +; 1 - Disables V-sync entirely
|
| 163 | +; 2 - Waits for V-sync whenever the screen is redrawn.
|
| 164 | +VSync=0
|
| 165 | +
|
158 | 166 | ; CustomResolutionX - Integer
|
159 | 167 | ; Width of the custom resolution for the display output for modes 9 and 10.
|
160 | 168 | ; Default is 640.
|
161 | | -CustomResolutionX = 640
|
| 169 | +CustomResolutionX=640
|
162 | 170 |
|
163 | 171 | ; CustomResolutionY - Integer
|
164 | 172 | ; Height of the custom resolution for the display output for modes 9 and 10.
|
165 | 173 | ; Default is 480;
|
166 | | -CustomResolutionY = 480
|
| 174 | +CustomResolutionY=480
|
167 | 175 |
|
168 | 176 | ; CustomRefresh - Integer
|
169 | 177 | ; Refresh rate for the display output for modes 9 and 10.
|
170 | 178 | ; Default is 60.
|
171 | | -CustomRefresh = 60
|
| 179 | +CustomRefresh=60
|
172 | 180 |
|
173 | 181 | ; DisplayMultiplierX - Floating point
|
174 | 182 | ; Multiplier for the pixel width for display mode 8.
|
175 | 183 | ; Default is 1.0.
|
176 | | -DisplayMultiplierX = 1.0
|
| 184 | +DisplayMultiplierX=1.0
|
177 | 185 |
|
178 | 186 | ; DisplayMultiplierY - Floating point
|
179 | 187 | ; Multiplier for the pixel height for display mode 8.
|
180 | 188 | ; Default is 1.0.
|
181 | | -DisplayMultiplierY = 1.0
|
| 189 | +DisplayMultiplierY=1.0
|
182 | 190 |
|
| 191 | +; SingleBufferDevice - Boolean
|
| 192 | +; If true, creates an OpenGL device without double buffering. This has
|
| 193 | +; various effects, such as disabling vsync and exclusive fullscreen.
|
| 194 | +; Default is false
|
| 195 | +SingleBufferDevice=false
|
| 196 | +
|
183 | 197 | [scaling]
|
184 | 198 | ; ScalingFilter - Integer
|
185 | 199 | ; Selects the filter to be used to scale the output image
|
— | — | @@ -186,7 +200,7 @@ |
187 | 201 | ; The following values are valid:
|
188 | 202 | ; 0 - Nearest-neighbor stretching
|
189 | 203 | ; 1 - Bilinear interpolation
|
190 | | -ScalingFilter = 0
|
| 204 | +ScalingFilter=0
|
191 | 205 |
|
192 | 206 | ; BltScale - Integer
|
193 | 207 | ; Selects the filter to be used to scale Blt operations.
|
— | — | @@ -197,7 +211,7 @@ |
198 | 212 | ; 2 - Bilinear interpolation, nearest-neighbor color key
|
199 | 213 | ; 3 - Bilinear interpolation, sharp color key
|
200 | 214 | ; 4 - Bilinear interpolation, soft color key
|
201 | | -BltScale = 0
|
| 215 | +BltScale=0
|
202 | 216 |
|
203 | 217 | ; BltThreshold - Integer
|
204 | 218 | ; Sets the threshold point for sharp color key scaling.
|
— | — | @@ -204,7 +218,7 @@ |
205 | 219 | ; 0 will trim the most, 254 will trim the least, and 255 will completely
|
206 | 220 | ; disable color keying.
|
207 | 221 | ; Default is 127
|
208 | | -BltThreshold = 127
|
| 222 | +BltThreshold=127
|
209 | 223 |
|
210 | 224 | ; AdjustPrimaryResolution - Integer
|
211 | 225 | ; Determines whether or not to resize the buffers used to hold the primary
|
— | — | @@ -225,7 +239,7 @@ |
226 | 240 | ; 11 - Use exact 8x scale.
|
227 | 241 | ; 12 - Use custom scale.
|
228 | 242 | ; Default is 0.
|
229 | | -AdjustPrimaryResolution = 0
|
| 243 | +AdjustPrimaryResolution=0
|
230 | 244 |
|
231 | 245 | ; PrimaryScaleX - Floating point
|
232 | 246 | ; Sets the scaling amount in the X dimension for custom primary
|
— | — | @@ -232,7 +246,7 @@ |
233 | 247 | ; buffer scaling.
|
234 | 248 | ; If zero, negative, or an invalid value, will be interpreted as 1.0
|
235 | 249 | ; Default is 1.0
|
236 | | -PrimaryScaleX = 1.0
|
| 250 | +PrimaryScaleX=1.0
|
237 | 251 |
|
238 | 252 | ; PrimaryScaleY - Floating point
|
239 | 253 | ; Sets the scaling amount in the Y dimension for custom primary
|
— | — | @@ -239,7 +253,7 @@ |
240 | 254 | ; buffer scaling.
|
241 | 255 | ; If zero, negative, or an invalid value, will be interpreted as 1.0
|
242 | 256 | ; Default is 1.0
|
243 | | -PrimaryScaleY = 1.0
|
| 257 | +PrimaryScaleY=1.0
|
244 | 258 |
|
245 | 259 | ; ScreenAspect - Floating point or string
|
246 | 260 | ; Sets the aspect ratio of the display output.
|
— | — | @@ -250,7 +264,7 @@ |
251 | 265 | ; to a 1:1 PAR except on specific low-resolution modes which may use 2:1 or
|
252 | 266 | ; 1:2 PAR.
|
253 | 267 | ; Default is "Default"
|
254 | | -ScreenAspect = Default
|
| 268 | +ScreenAspect=Default
|
255 | 269 |
|
256 | 270 | ; DPIScale - Integer
|
257 | 271 | ; Overrides Windows DPI scaling on high-DPI modes.
|
— | — | @@ -268,7 +282,7 @@ |
269 | 283 | ; or game to restart as the registry value is set. Use this mode only if
|
270 | 284 | ; setting DPIScale to 1 has no effect.
|
271 | 285 | ; Default is 1.
|
272 | | -DPIScale = 1
|
| 286 | +DPIScale=1
|
273 | 287 |
|
274 | 288 | [postprocess]
|
275 | 289 | ; PostprocessFilter - Integer
|
— | — | @@ -279,7 +293,7 @@ |
280 | 294 | ; The following values are valid:
|
281 | 295 | ; 0 - Nearest-neighbor stretching
|
282 | 296 | ; 1 - Bilinear interpolation
|
283 | | -PostprocessFilter = 0
|
| 297 | +PostprocessFilter=0
|
284 | 298 |
|
285 | 299 | ; PostprocessScaleX - Floating point
|
286 | 300 | ; Scaling in the X direction for the postprocess pass.
|
— | — | @@ -288,7 +302,7 @@ |
289 | 303 | ; amount that doubles the width if it is 400 or fewer pixels wide, and doubles
|
290 | 304 | ; the lines if the height is 300 or fewer lines.
|
291 | 305 | ; Default is 0.0
|
292 | | -PostprocessScaleX = 0.0
|
| 306 | +PostprocessScaleX=0.0
|
293 | 307 |
|
294 | 308 | ; PostprocessScaleY - Floating point
|
295 | 309 | ; Scaling in the Y direction for the postprocess pass.
|
— | — | @@ -297,12 +311,12 @@ |
298 | 312 | ; amount that doubles the width if it is 400 or fewer pixels wide, and doubles
|
299 | 313 | ; the lines if the height is 300 or fewer lines.
|
300 | 314 | ; Default is 0.0
|
301 | | -PostprocessScaleY = 0.0
|
| 315 | +PostprocessScaleY=0.0
|
302 | 316 |
|
303 | 317 | ; EnableShader - Boolean
|
304 | 318 | ; (future) If true, uses a custom shader to render the postprocess pass.
|
305 | 319 | ; Default is false
|
306 | | -EnableShader = false
|
| 320 | +EnableShader=false
|
307 | 321 |
|
308 | 322 | ; ShaderFile - String
|
309 | 323 | ; (future)Path to a file containing either a GLSL fragment shader or a
|
— | — | @@ -312,7 +326,7 @@ |
313 | 327 | ; install directory and the path where the ddraw.dll implementation has been
|
314 | 328 | ; placed) or absolute.
|
315 | 329 | ; Default is undefined.
|
316 | | -; ShaderFile = example.fs
|
| 330 | +; ShaderFile=example.fs
|
317 | 331 |
|
318 | 332 | [d3d]
|
319 | 333 | ; TextureFilter - Integer
|
— | — | @@ -326,7 +340,7 @@ |
327 | 341 | ; 5 - GL_LINEAR_MIPMAP_NEAREST (Bilinear with mipmap)
|
328 | 342 | ; 6 - GL_LINEAR_MIPMAP_LINEAR (Trilinear filtering)
|
329 | 343 | ; Default is 0
|
330 | | -TextureFilter = 0
|
| 344 | +TextureFilter=0
|
331 | 345 |
|
332 | 346 | ; AnisotropicFiltering - Integer
|
333 | 347 | ; (future) Enabled anisotropic filtering to improve display quality
|
— | — | @@ -339,7 +353,7 @@ |
340 | 354 | ; 4 - Sets anisotropic filtering to 4x.
|
341 | 355 | ; 8 - Sets anisotropic filtering to 8x.
|
342 | 356 | ; 16 - Sets anisotropic filtering to 16x.
|
343 | | -AnisotropicFiltering = 0
|
| 357 | +AnisotropicFiltering=0
|
344 | 358 |
|
345 | 359 | ; Antialiasing - Hexadecimal integer
|
346 | 360 | ; (future) Enables multisample antialiasing. May cause significant
|
— | — | @@ -355,7 +369,7 @@ |
356 | 370 | ; Add 0x10000 to the number to enable the specific antialiasing mode only
|
357 | 371 | ; when the application requests it.
|
358 | 372 | ; Default is 0x0
|
359 | | -Antialiasing = 0x0
|
| 373 | +Antialiasing=0x0
|
360 | 374 |
|
361 | 375 | ; D3DAspect - Integer
|
362 | 376 | ; (future)Selects whether or not to adjust the aspect ratio for Direct3D
|
— | — | @@ -368,7 +382,7 @@ |
369 | 383 | ; 2 - Crops the display to the viewable area. May cut off parts of the game
|
370 | 384 | ; graphics.
|
371 | 385 | ; Default is 0
|
372 | | -D3DAspect = 0
|
| 386 | +D3DAspect=0
|
373 | 387 |
|
374 | 388 | ; LowColorRendering - Integer
|
375 | 389 | ; Selects whether to increase the color depth when rendering to a
|
— | — | @@ -378,7 +392,7 @@ |
379 | 393 | ; 1 - Uses a 32-bit texture format. Increases the quality of the game but
|
380 | 394 | ; will be downsampled if the surface is accessed directly after rendering.
|
381 | 395 | ; Default is 0
|
382 | | -LowColorRendering = 0
|
| 396 | +LowColorRendering=0
|
383 | 397 |
|
384 | 398 | ; EnableDithering - Integer
|
385 | 399 | ; Determines when dithering is enabled for Direct3D rendering.
|
— | — | @@ -393,34 +407,22 @@ |
394 | 408 | ; 3 - Enables dithering per application, for all modes.
|
395 | 409 | ; 4 - Always enables dithering, for all modes.
|
396 | 410 | ; Default is 0
|
397 | | -EnableDithering = 0
|
| 411 | +EnableDithering=0
|
398 | 412 |
|
399 | 413 | [advanced]
|
400 | | -; VSync - Integer
|
401 | | -; Determines vertical retrace behavior.
|
402 | | -; This option is reserved for future expansion, and the only valid value is
|
403 | | -; currently 0.
|
404 | | -VSync = 0
|
405 | | -
|
406 | 414 | ; TextureFormat - Integer
|
407 | 415 | ; Determines the internal format to use for textures and DirectDraw
|
408 | 416 | ; surfaces.
|
409 | 417 | ; This option is reserved for future expansion, and the only valid value is
|
410 | 418 | ; currently 0.
|
411 | | -TextureFormat = 0
|
| 419 | +TextureFormat=0
|
412 | 420 |
|
413 | 421 | ; TexUpload - Integer
|
414 | 422 | ; Determines the method used to upload texture data to the graphics card.
|
415 | 423 | ; This option is reserved for future expansion, and the only valid value is
|
416 | 424 | ; currently 0.
|
417 | | -TexUpload = 0
|
| 425 | +TexUpload=0
|
418 | 426 |
|
419 | | -; SingleBufferDevice - Boolean
|
420 | | -; If true, creates an OpenGL device without double buffering. This has
|
421 | | -; various effects, such as disabling vsync and exclusive fullscreen.
|
422 | | -; Default is false
|
423 | | -SingleBufferDevice = false
|
424 | | -
|
425 | 427 | ; WindowPosition - Integer
|
426 | 428 | ; Selects the position for the window on application startup, when using
|
427 | 429 | ; forced-window mode.
|
— | — | @@ -428,7 +430,7 @@ |
429 | 431 | ; 0 - Center window on screen.
|
430 | 432 | ; 1 - Use last remembered position.
|
431 | 433 | ; Default is 1
|
432 | | -WindowPosition = 1
|
| 434 | +WindowPosition=1
|
433 | 435 |
|
434 | 436 | ; RememberWindowSize - Boolean
|
435 | 437 | ; Determines whether to remember the last window size in forced window
|
— | — | @@ -436,7 +438,7 @@ |
437 | 439 | ; size before the first SetDisplayMode command. This value will be
|
438 | 440 | ; saved in the per-app profile as WindowX and WindowY.
|
439 | 441 | ; Default is true
|
440 | | -RememberWindowSize = true
|
| 442 | +RememberWindowSize=true
|
441 | 443 |
|
442 | 444 | ; RememberWindowPosition - Boolean
|
443 | 445 | ; Determines whether to remember the last window position in forced
|
— | — | @@ -443,40 +445,40 @@ |
444 | 446 | ; window mode, by saving it in the registry. This value will be saved
|
445 | 447 | ; in the per-app profile as WindowWidth and WindowHeight.
|
446 | 448 | ; Default is true
|
447 | | -RememberWindowPosition = true
|
| 449 | +RememberWindowPosition=true
|
448 | 450 |
|
449 | 451 | ; NoResizeWindow - Boolean
|
450 | 452 | ; If true, do not resize the window when using resizable window mode, when
|
451 | 453 | ; SetDisplayMode is called.
|
452 | 454 | ; Default is false
|
453 | | -NoResizeWindow = false
|
| 455 | +NoResizeWindow=false
|
454 | 456 |
|
455 | 457 | ; WindowX - Integer
|
456 | 458 | ; Remembered X position of the window when using forced window modes.
|
457 | 459 | ; Default is a position that puts the current window size in the center of the
|
458 | 460 | ; screen.
|
459 | | -; WindowX = 0
|
| 461 | +; WindowX=0
|
460 | 462 |
|
461 | 463 | ; WindowY - Integer
|
462 | 464 | ; Remembered Y position of the window when using forced window modes.
|
463 | 465 | ; Default is a position that puts the current window size in the center of the
|
464 | 466 | ; screen.
|
465 | | -; WindowY = 0
|
| 467 | +; WindowY=0
|
466 | 468 |
|
467 | 469 | ; WindowWidth = Integer
|
468 | 470 | ; Remembered width of the window when using forced window modes.
|
469 | 471 | ; Default is 640
|
470 | | -WindowWidth = 640
|
| 472 | +WindowWidth=640
|
471 | 473 |
|
472 | 474 | ; WindowHeight - Integer
|
473 | 475 | ; Remembered height of the window when using forced window modes.
|
474 | 476 | ; Default is 480
|
475 | | -WindowHeight = 480
|
| 477 | +WindowHeight=480
|
476 | 478 |
|
477 | 479 | ; WindowMaximized - Boolean
|
478 | 480 | ; Remembered maximized state of the window when using resized window mode.
|
479 | 481 | ; Default is false
|
480 | | -WindowMaximized = false
|
| 482 | +WindowMaximized=false
|
481 | 483 |
|
482 | 484 | [debug]
|
483 | 485 | ; DebugNoExtFramebuffer - Boolean
|
— | — | @@ -485,7 +487,7 @@ |
486 | 488 | ; unavailable or DebugNoArbFramebuffer is enabled, then DXGL will fail
|
487 | 489 | ; to initialize.
|
488 | 490 | ; Default is false
|
489 | | -DebugNoExtFramebuffer = false
|
| 491 | +DebugNoExtFramebuffer=false
|
490 | 492 |
|
491 | 493 | ; DebugNoArbFramebuffer - Boolean
|
492 | 494 | ; Disables use of the ARB_framebuffer_object OpenGL extension.
|
— | — | @@ -493,7 +495,7 @@ |
494 | 496 | ; unavailable or DebugNoExtFramebuffer is enabled, then DXGL will fail
|
495 | 497 | ; to initialize.
|
496 | 498 | ; Default is false
|
497 | | -DebugNoArbFramebuffer = false
|
| 499 | +DebugNoArbFramebuffer=false
|
498 | 500 |
|
499 | 501 | ; DebugNoES2Compatibility - Boolean
|
500 | 502 | ; Disables use of the ARB_ES2_compatibility OpenGL extension.
|
— | — | @@ -500,7 +502,7 @@ |
501 | 503 | ; Currently this means that GL_RGB565 16-bit internal texture format
|
502 | 504 | ; will not be used.
|
503 | 505 | ; Default is false
|
504 | | -DebugNoES2Compatibility = false
|
| 506 | +DebugNoES2Compatibility=false
|
505 | 507 |
|
506 | 508 | ; DebugNoExtDirectStateAccess - Boolean
|
507 | 509 | ; Disables use of the EXT_direct_state_access OpenGL extension.
|
— | — | @@ -508,7 +510,7 @@ |
509 | 511 | ; objects. Disabling direct state access will revert to a more traditional
|
510 | 512 | ; approach to manipulating OpenGL objects.
|
511 | 513 | ; Default is false
|
512 | | -DebugNoExtDirectStateAccess = false
|
| 514 | +DebugNoExtDirectStateAccess=false
|
513 | 515 |
|
514 | 516 | ; DebugNoArbDirectStateAccess - Boolean
|
515 | 517 | ; Disables use of the ARB_direct_state_access OpenGL extension.
|
— | — | @@ -516,13 +518,13 @@ |
517 | 519 | ; objects. Disabling direct state access will revert to a more traditional
|
518 | 520 | ; approach to manipulating OpenGL objects.
|
519 | 521 | ; Default is false
|
520 | | -DebugNoArbDirectStateAccess = false
|
| 522 | +DebugNoArbDirectStateAccess=false
|
521 | 523 |
|
522 | 524 | ; DebugNoSamplerObjects - Boolean
|
523 | 525 | ; Disables use of sampler objects. Disabling sampler objects may reduce
|
524 | 526 | ; the performance and accuracy of Direct3D commands.
|
525 | 527 | ; Default is false
|
526 | | -DebugNoSamplerObjects = false
|
| 528 | +DebugNoSamplerObjects=false
|
527 | 529 |
|
528 | 530 | ; DebugNoGpuShader4 - Boolean
|
529 | 531 | ; Disables use of the EXT_gpu_shader4 OpenGL extension.
|
— | — | @@ -532,7 +534,7 @@ |
533 | 535 | ; In addition disabling GLSL 1.30 and EXT_gpu_shader4 will disable DirectDraw
|
534 | 536 | ; ROP support.
|
535 | 537 | ; Default is false.
|
536 | | -DebugNoGpuShader4 = false
|
| 538 | +DebugNoGpuShader4=false
|
537 | 539 |
|
538 | 540 | ; DebugNoGLSL130 - Boolean
|
539 | 541 | ; Disables use of GLSL 1.30 shaders. Enabling this parameter as well as
|
— | — | @@ -539,13 +541,13 @@ |
540 | 542 | ; DebugNoGpuShader4 will disable integer processing of DirectDraw commands
|
541 | 543 | ; as well as disabling DirectDraw ROP support.
|
542 | 544 | ; Default is false
|
543 | | -DebugNoGLSL130 = false
|
| 545 | +DebugNoGLSL130=false
|
544 | 546 |
|
545 | 547 | ; DebugUploadAfterUnlock - Boolean
|
546 | 548 | ; Uploads surface contents immediately after unlock. This parameter can help
|
547 | 549 | ; with debugging surface uploads, but can also reduce performance.
|
548 | 550 | ; Default is false
|
549 | | -DebugUploadAfterUnlock = false
|
| 551 | +DebugUploadAfterUnlock=false
|
550 | 552 |
|
551 | 553 | ; DebugNoMouseHooks - Boolean
|
552 | 554 | ; Disables API hooks that adjust the mouse pointer position in scaled modes
|
— | — | @@ -553,7 +555,7 @@ |
554 | 556 | ; GetCursorPos() and SetCursorPos() will not be adjusted to the scaled size
|
555 | 557 | ; and position of the screen.
|
556 | 558 | ; Default is false
|
557 | | -DebugNoMouseHooks - false
|
| 559 | +DebugNoMouseHooks=false
|
558 | 560 |
|
559 | 561 | ; DebugBlendDestColorKey - Boolean
|
560 | 562 | ; Blends the temporary texture used for destination color keying with the
|
— | — | @@ -561,7 +563,7 @@ |
562 | 564 | ; with the destination coordinates being used for a Blt operation. This
|
563 | 565 | ; should only be enabled for development and regression testing purposes.
|
564 | 566 | ; Default is false
|
565 | | -DebugBlendDestColorKey = false
|
| 567 | +DebugBlendDestColorKey=false
|
566 | 568 |
|
567 | 569 | ; DebugMaxGLVersionMajor - Integer
|
568 | 570 | ; Determines the maximum OpenGL major version available to DXGL.
|
— | — | @@ -569,7 +571,7 @@ |
570 | 572 | ; If this value is 0 than DXGL will use the highest OpenGL version
|
571 | 573 | ; available to the system and ignore DebugMaxGLVersionMinor.
|
572 | 574 | ; Default is 0
|
573 | | -DebugMaxGLVersionMajor = 0
|
| 575 | +DebugMaxGLVersionMajor=0
|
574 | 576 |
|
575 | 577 | ; DebugMaxGLVersionMinor - Integer
|
576 | 578 | ; Determines the maximum OpenGL minor version available to DXGL.
|
— | — | @@ -576,7 +578,7 @@ |
577 | 579 | ; This will be ignored if the system OpenGL major version is less than
|
578 | 580 | ; DebugMaxGLVersionMajor.
|
579 | 581 | ; Default is 0
|
580 | | -DebugMaxGLVersionMinor = 0
|
| 582 | +DebugMaxGLVersionMinor=0
|
581 | 583 |
|
582 | 584 | ; DebugDisableErrors - Boolean
|
583 | 585 | ; (future) If OpenGL 4.6 is installed, creates an OpenGL context that has
|
— | — | @@ -585,7 +587,7 @@ |
586 | 588 | ; This option has no effect on OpenGL 4.5 or earlier drivers unless the
|
587 | 589 | ; GL_KHR_no_error extension is available.
|
588 | 590 | ; Default is false
|
589 | | -DebugDisableErrors = true
|
| 591 | +DebugDisableErrors=true
|
590 | 592 |
|
591 | 593 | [hacks]
|
592 | 594 | ; Hacks are intended for specific scenarios, and may cause undesired effects
|
— | — | @@ -597,7 +599,7 @@ |
598 | 600 | ; letterboxes the output. This hack is only active in fullscreen mode at
|
599 | 601 | ; 640x480 display mode.
|
600 | 602 | ; Default is false
|
601 | | -HackCrop640480to640400 = false
|
| 603 | +HackCrop640480to640400=false
|
602 | 604 |
|
603 | 605 | ; HackAutoScale512448to640480 - Boolean
|
604 | 606 | ; Detects when the application is rendering a 512x448 image in 640x480 mode.
|
— | — | @@ -611,7 +613,7 @@ |
612 | 614 | ; If set to 1, this will scale in both X and Y directions. If set to 1, this
|
613 | 615 | ; will scale only in the X direction.
|
614 | 616 | ; Default is 0
|
615 | | -HackAutoScale512448to640480 = 0
|
| 617 | +HackAutoScale512448to640480=0
|
616 | 618 |
|
617 | 619 | ; HackNoTVRefresh - Boolean
|
618 | 620 | ; Removes TV-compatible refresh rates that may be added by Windows 7 and
|
— | — | @@ -619,7 +621,7 @@ |
620 | 622 | ; This may fix some games that may run at a reduced framerate due to these
|
621 | 623 | ; compatible refresh rates operating above the integer refresh rate.
|
622 | 624 | ; Default is false
|
623 | | -HackNoTVRefresh = false
|
| 625 | +HackNoTVRefresh=false
|
624 | 626 |
|
625 | 627 | ; HackSetCursor - Boolean
|
626 | 628 | ; Applies a hack to the SetCursor() API to try to prevent a flickering cursor
|
— | — | @@ -626,4 +628,4 @@ |
627 | 629 | ; in some scenarios. This is a contributed code to mitigate this issue in the
|
628 | 630 | ; game "Atlantis 1" and may or may not work in other scenarios.
|
629 | 631 | ; Default is false
|
630 | | -HackSetCursor = false
|
| 632 | +HackSetCursor=false
|
Index: dxglcfg/dxglcfg.cpp |
— | — | @@ -1953,8 +1953,9 @@ |
1954 | 1954 |
|
1955 | 1955 | LRESULT CALLBACK SaveINICallback(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
|
1956 | 1956 | {
|
| 1957 | + BOOL unused;
|
1957 | 1958 | DWORD error;
|
1958 | | - TCHAR errormsg[2048];
|
| 1959 | + TCHAR errormsg[2048+MAX_PATH];
|
1959 | 1960 | switch(Msg)
|
1960 | 1961 | {
|
1961 | 1962 | case WM_INITDIALOG:
|
— | — | @@ -1968,18 +1969,30 @@ |
1969 | 1970 | switch (LOWORD(wParam))
|
1970 | 1971 | {
|
1971 | 1972 | case IDOK:
|
1972 | | - error = WriteINI(cfg, cfgmask, apps[current_app].path);
|
1973 | | - if (error == 5)
|
| 1973 | + cfg->NoWriteRegistry = GetCheck(hWnd, IDC_NOWRITEREGISTRY, &unused);
|
| 1974 | + cfg->OverrideDefaults = GetCheck(hWnd, IDC_OVERRIDEREGISTRY, &unused);
|
| 1975 | + cfg->NoOverwrite = GetCheck(hWnd, IDC_NOOVERWRITE, &unused);
|
| 1976 | + cfg->SaveSHA256 = GetCheck(hWnd, IDC_SAVESHA256, &unused);
|
| 1977 | + cfg->NoUninstall = GetCheck(hWnd, IDC_NOUNINSTALL, &unused);
|
| 1978 | + error = WriteINI(cfg, cfgmask, apps[current_app].path, hWnd);
|
| 1979 | + if (error == ERROR_ACCESS_DENIED)
|
1974 | 1980 | {
|
1975 | 1981 | MessageBox(hWnd, _T("Access denied error writing .ini file. Please re-launch DXGL Config as Administrator and try again."),
|
1976 | 1982 | _T("Error"), MB_OK | MB_ICONWARNING);
|
1977 | 1983 | }
|
1978 | | - else if (error != 0)
|
| 1984 | + else if (error != ERROR_SUCCESS)
|
1979 | 1985 | {
|
1980 | 1986 | _tcscpy(errormsg, _T("Error writing .ini file:\r\n"));
|
1981 | 1987 | FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0, errormsg + _tcslen(errormsg), 2048 - _tcslen(errormsg), NULL);
|
1982 | 1988 | MessageBox(hWnd, errormsg, _T("Error"), MB_OK | MB_ICONERROR);
|
1983 | 1989 | }
|
| 1990 | + else
|
| 1991 | + {
|
| 1992 | + _tcscpy(errormsg, _T("Saved dxgl.ini to "));
|
| 1993 | + _tcscat(errormsg, apps[current_app].path);
|
| 1994 | + _tcscat(errormsg, _T("\dxgl.ini"));
|
| 1995 | + MessageBox(hWnd, errormsg, _T("Notice"), MB_OK | MB_ICONINFORMATION);
|
| 1996 | + }
|
1984 | 1997 | EndDialog(hWnd, IDOK);
|
1985 | 1998 | return TRUE;
|
1986 | 1999 | case IDCANCEL:
|
— | — | @@ -3214,6 +3227,7 @@ |
3215 | 3228 | // Paths
|
3216 | 3229 | EnableWindow(GetDlgItem(hTabs[3], IDC_PATHLABEL), FALSE);
|
3217 | 3230 | EnableWindow(GetDlgItem(hTabs[3], IDC_PROFILEPATH), FALSE);
|
| 3231 | + EnableWindow(GetDlgItem(hTabs[3], IDC_WRITEINI), FALSE);
|
3218 | 3232 | // Debug
|
3219 | 3233 | _tcscpy(buffer, _T("Disable EXT framebuffers"));
|
3220 | 3234 | SendDlgItemMessage(hTabs[4], IDC_DEBUGLIST, LB_ADDSTRING, 0, (LPARAM)buffer);
|
— | — | @@ -3566,6 +3580,7 @@ |
3567 | 3581 | {
|
3568 | 3582 | EnableWindow(GetDlgItem(hTabs[3], IDC_PATHLABEL), TRUE);
|
3569 | 3583 | EnableWindow(GetDlgItem(hTabs[3], IDC_PROFILEPATH), TRUE);
|
| 3584 | + EnableWindow(GetDlgItem(hTabs[3], IDC_WRITEINI), TRUE);
|
3570 | 3585 | SetDlgItemText(hTabs[3], IDC_PROFILEPATH, apps[current_app].path);
|
3571 | 3586 | if (apps[current_app].builtin) EnableWindow(GetDlgItem(hWnd, IDC_REMOVE), FALSE);
|
3572 | 3587 | else EnableWindow(GetDlgItem(hWnd, IDC_REMOVE), TRUE);
|
— | — | @@ -3574,6 +3589,7 @@ |
3575 | 3590 | {
|
3576 | 3591 | EnableWindow(GetDlgItem(hTabs[3], IDC_PATHLABEL), FALSE);
|
3577 | 3592 | EnableWindow(GetDlgItem(hTabs[3], IDC_PROFILEPATH), FALSE);
|
| 3593 | + EnableWindow(GetDlgItem(hTabs[3], IDC_WRITEINI), FALSE);
|
3578 | 3594 | SetDlgItemText(hTabs[3], IDC_PROFILEPATH, _T(""));
|
3579 | 3595 | EnableWindow(GetDlgItem(hWnd, IDC_REMOVE), FALSE);
|
3580 | 3596 | }
|