Skip to content

Commit 564ca94

Browse files
committed
Added Games List feature.
1 parent 2dc6a75 commit 564ca94

File tree

6 files changed

+7719
-18
lines changed

6 files changed

+7719
-18
lines changed

PACTConfig.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class PACTConfig
1212
[JsonProperty]
1313
public Dictionary<string, ProcessConfig> ProcessConfigs { get; set; }
1414
[JsonProperty]
15+
public ProcessConfig GameConfig { get; set; }
16+
[JsonProperty]
1517
public ProcessConfig DefaultConfig { get; set; }
1618
[JsonProperty]
1719
public int ScanInterval { get; set; }
@@ -20,14 +22,20 @@ class PACTConfig
2022
[JsonProperty]
2123
public bool ForceAggressiveScan { get; set; }
2224

23-
public PACTConfig(Dictionary<string, ProcessConfig> processConfigs = null, ProcessConfig defaultConfig = null, int scanInterval = 3000, int aggressiveScanInterval = 3, bool forceAggressiveScan = false)
25+
public PACTConfig(Dictionary<string, ProcessConfig> processConfigs = null, ProcessConfig gameconfig = null, ProcessConfig defaultConfig = null, int scanInterval = 3000, int aggressiveScanInterval = 3, bool forceAggressiveScan = false)
2426
{
2527
ProcessConfigs = processConfigs;
2628
if (processConfigs == null)
2729
{
2830
ProcessConfigs = new Dictionary<string, ProcessConfig>();
2931
}
3032

33+
GameConfig = gameconfig;
34+
if (defaultConfig == null)
35+
{
36+
GameConfig = new ProcessConfig(Enumerable.Range(0, Environment.ProcessorCount).ToList(), 2);
37+
}
38+
3139
DefaultConfig = defaultConfig;
3240
if (defaultConfig == null)
3341
{

ProcessAffinityControlTool.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
6-
<Version>1.0.2</Version>
6+
<Version>1.1.0</Version>
77
<PackageIcon>PACT Logo.png</PackageIcon>
88
<PackageIconUrl />
99
<RepositoryUrl>https://github.com/sas41/ProcessAffinityControlTool/</RepositoryUrl>
@@ -16,14 +16,20 @@
1616
<ApplicationIcon>PACT.ico</ApplicationIcon>
1717
<Win32Resource />
1818
<ApplicationManifest>app.manifest</ApplicationManifest>
19-
<AssemblyVersion>1.0.2.0</AssemblyVersion>
19+
<AssemblyVersion>1.1.0.0</AssemblyVersion>
2020
</PropertyGroup>
2121

2222
<ItemGroup>
2323
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
2424
</ItemGroup>
2525

2626
<ItemGroup>
27+
<None Update="games.txt">
28+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
29+
</None>
30+
<None Update="possible_games_list.txt">
31+
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
32+
</None>
2733
<None Update="help.txt">
2834
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
2935
</None>

ProcessOverwatch.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace ProcessAffinityControlTool
1111
class ProcessOverwatch
1212
{
1313
public PACTConfig Config { get; set; }
14+
public List<string> Games { get; set; }
1415
List<Process> managedProcesses;
1516
int aggressiveScanCountdown = 0;
1617

@@ -20,6 +21,7 @@ public ProcessOverwatch()
2021
{
2122
Config = new PACTConfig();
2223
managedProcesses = new List<Process>();
24+
Games = new List<string>();
2325
}
2426

2527
public void SetTimer()
@@ -120,6 +122,11 @@ private void HandleProcess(Process process)
120122
mask = (IntPtr)Config.ProcessConfigs[process.ProcessName.ToLower()].AffinityMask;
121123
priority = Config.ProcessConfigs[process.ProcessName.ToLower()].Priority;
122124
}
125+
else if (Games.Contains(process.ProcessName.ToLower()))
126+
{
127+
mask = (IntPtr)Config.GameConfig.AffinityMask;
128+
priority = Config.GameConfig.Priority;
129+
}
123130
else
124131
{
125132
mask = (IntPtr)Config.DefaultConfig.AffinityMask;

0 commit comments

Comments
 (0)