-
Notifications
You must be signed in to change notification settings - Fork 0
/
DDrawCompatSettingsService.cs
35 lines (32 loc) · 1.48 KB
/
DDrawCompatSettingsService.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using Sims1WidescreenPatcher.Core.Enums;
namespace Sims1WidescreenPatcher.Core.Services;
public static class DDrawCompatSettingsService
{
public static async Task CreateDDrawCompatSettingsFile(string pathToSimsExe, params DDrawCompatEnums[] settings)
{
var dir = Path.GetDirectoryName(pathToSimsExe);
if (string.IsNullOrWhiteSpace(dir))
{
throw new DirectoryNotFoundException($"Directory not found: {dir}");
}
using var sw = new StreamWriter(Path.Combine(dir, "DDrawCompat.ini"));
foreach (var setting in settings)
{
switch (setting)
{
case DDrawCompatEnums.BorderlessFullscreen:
await sw.WriteLineAsync("FullscreenMode=borderless");
break;
case DDrawCompatEnums.ExclusiveFullscreen:
await sw.WriteLineAsync("FullscreenMode=exclusive");
await sw.WriteLineAsync("DisplayResolution=app");
break;
default:
break;
}
}
await sw.WriteLineAsync("CPUAffinity=all"); // the default was changed to 1 in 0.4.0 which was a culprit for the major issues, crashes, and lag
await sw.WriteLineAsync("DisplayRefreshRate=desktop"); // removes erroneous lock to 60fps on higher-than-60hz displays when vsync is enabled
await sw.WriteLineAsync("AltTabFix=keepvidmem"); // fixes crashes/bugs when using Alt+Tab
}
}