Skip to content

Commit 5eb21eb

Browse files
authored
Merge pull request #2 from Uklosk/Windows
Update how hardware_settings_restrictions.xml is generated.
2 parents 561b704 + e831eb6 commit 5eb21eb

File tree

4 files changed

+46
-90
lines changed

4 files changed

+46
-90
lines changed

Files/Template.xml

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,18 @@
1-
<?xml version="1.0" encoding="UTF-8" ?>
2-
<hardware_settings_restrictions>
3-
4-
<cpu>
5-
<restrict_info>
6-
<restrict_if name="cores" op="int_eq" value="2">
7-
<restrict_add>
8-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap2Core.xml" forceFeedbackProcessor="1" dvdStorageProcessor="1" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="1" fileStreamProcessor="1" />
9-
</restrict_add>
10-
</restrict_if>
11-
<restrict_if name="cores" op="int_eq" value="3">
12-
<restrict_add>
13-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap2Core.xml" forceFeedbackProcessor="1" dvdStorageProcessor="1" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="1" fileStreamProcessor="1" />
14-
</restrict_add>
15-
</restrict_if>
16-
<restrict_if name="cores" op="int_eq" value="4">
17-
<restrict_add>
18-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap4Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" />
19-
</restrict_add>
20-
</restrict_if>
21-
<restrict_if name="cores" op="int_eq" value="6">
22-
<restrict_add>
23-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap6Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" />
24-
</restrict_add>
25-
</restrict_if>
26-
<restrict_if name="cores" op="int_ge" value="_Y_">
27-
<restrict_add>
28-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap_Y_Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" />
29-
</restrict_add>
30-
</restrict_if>
31-
<restrict_if name="hyperThreading" op="bo_eq" value="true">
32-
<restrict_add>
33-
<threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap2Core.xml" forceFeedbackProcessor="1" dvdStorageProcessor="1" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="1" fileStreamProcessor="1" />
34-
</restrict_add>
35-
</restrict_if>
36-
<restrict_else>
37-
<restrict_add>
38-
<threadStrategy parallelUpdateRender="false" workerMapFile="system/workerMap.xml" forceFeedbackProcessor="0" dvdStorageProcessor="0" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="0" fileStreamProcessor="0" />
39-
</restrict_add>
40-
</restrict_else>
41-
</restrict_info>
42-
</cpu>
43-
44-
</hardware_settings_restrictions>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<hardware_settings_restrictions>
3+
<cpu>
4+
<restrict_info>
5+
<!-- 001 --><restrict_if name="cores" op="int_le" value="1"> <restrict_add> <threadStrategy parallelUpdateRender="false" workerMapFile="system/workerMap.xml" forceFeedbackProcessor="0" dvdStorageProcessor="0" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="0" fileStreamProcessor="0" /> </restrict_add> </restrict_if>
6+
<!-- 002 --><restrict_if name="cores" op="int_le" value="3"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap2Core.xml" forceFeedbackProcessor="1" dvdStorageProcessor="1" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="1" fileStreamProcessor="1" /> </restrict_add> </restrict_if>
7+
<!-- 004 --><restrict_if name="cores" op="int_le" value="5"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap4Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" /> </restrict_add> </restrict_if>
8+
<!-- 006 --><restrict_if name="cores" op="int_le" value="7"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap6Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" /> </restrict_add> </restrict_if>
9+
<!-- 008 --><restrict_if name="cores" op="int_le" value="11"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap8Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
10+
<!-- 012 --><restrict_if name="cores" op="int_le" value="15"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap12Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
11+
<!-- 016 --><restrict_if name="cores" op="int_le" value="19"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap16Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
12+
<!-- 020 --><restrict_if name="cores" op="int_le" value="23"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap20Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
13+
<!-- 024 --><restrict_if name="cores" op="int_le" value="27"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap24Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
14+
<!-- 028 --><restrict_if name="cores" op="int_le" value="31"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap28Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
15+
<!-- 032 --><restrict_if name="cores" op="int_ge" value="32"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap32Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
16+
</restrict_info>
17+
</cpu>
18+
</hardware_settings_restrictions>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<hardware_settings_restrictions>
3+
<cpu>
4+
<restrict_info>
5+
<!-- 001 --><restrict_if name="cores" op="int_le" value="1"> <restrict_add> <threadStrategy parallelUpdateRender="false" workerMapFile="system/workerMap.xml" forceFeedbackProcessor="0" dvdStorageProcessor="0" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="0" fileStreamProcessor="0" /> </restrict_add> </restrict_if>
6+
<!-- 002 --><restrict_if name="cores" op="int_le" value="3"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap2Core.xml" forceFeedbackProcessor="1" dvdStorageProcessor="1" dataSetMonitorProcessor="0" renderProcessor="0" updateProcessor="1" fileStreamProcessor="1" /> </restrict_add> </restrict_if>
7+
<!-- 004 --><restrict_if name="cores" op="int_le" value="5"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap4Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" /> </restrict_add> </restrict_if>
8+
<!-- 006 --><restrict_if name="cores" op="int_le" value="7"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap6Core.xml" forceFeedbackProcessor="3" dvdStorageProcessor="3" dataSetMonitorProcessor="1" renderProcessor="0" updateProcessor="2" fileStreamProcessor="3" /> </restrict_add> </restrict_if>
9+
<!-- 008 --><restrict_if name="cores" op="int_le" value="11"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap8Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
10+
<!-- 012 --><restrict_if name="cores" op="int_le" value="15"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap12Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
11+
<!-- 016 --><restrict_if name="cores" op="int_le" value="19"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap16Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
12+
<!-- 020 --><restrict_if name="cores" op="int_le" value="23"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap20Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
13+
<!-- 024 --><restrict_if name="cores" op="int_le" value="27"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap24Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
14+
<!-- 028 --><restrict_if name="cores" op="int_le" value="31"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap28Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
15+
<!-- 032 --><restrict_if name="cores" op="int_ge" value="32"> <restrict_add> <threadStrategy parallelUpdateRender="true" workerMapFile="system/workerMap32Core.xml" forceFeedbackProcessor="6" dvdStorageProcessor="7" dataSetMonitorProcessor="4" renderProcessor="0" updateProcessor="2" fileStreamProcessor="5" /> </restrict_add> </restrict_if>
16+
</restrict_info>
17+
</cpu>
18+
</hardware_settings_restrictions>

GridMTFixv2-GOG.ps1

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -65,29 +65,10 @@ else {
6565
#$cores = 64
6666

6767
# Definir los valores válidos de cores
68-
$valid_cores = 8, 12, 16, 20, 24, 28, 32
68+
$valid_cores = 1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32
6969

70-
# Definir el valor de grid_cores basado en el número de cores
71-
if ($cores -gt 32) {
72-
$grid_cores = 32
73-
Write-Host "Your CPU has $cores cores, but the game is limited to 32 cores, so that will be the max core count used."
74-
Delay 4
75-
}
76-
elseif ($cores -lt 8) {
77-
$grid_cores = 8
78-
Write-Host "Race Driver: Grid already supports your CPU core count."
79-
Delay 4
80-
}
81-
else {
82-
# Verificar si el número de cores está en la lista de valid_cores
83-
if ($valid_cores -contains $cores) {
84-
$grid_cores = $cores
85-
}
86-
else {
8770
# Obtener el valor de valid_cores inmediatamente inferior a $cores
88-
$grid_cores = $valid_cores | Where-Object { $_ -lt $cores } | Select-Object -Last 1
89-
}
90-
}
71+
$grid_cores = $valid_cores | Where-Object { $_ -le $cores } | Select-Object -Last 1
9172

9273
# Ruta del archivo de plantilla y archivo de salida
9374
$template_file = "Template.xml"
@@ -96,8 +77,9 @@ else {
9677
# Leer el contenido de la plantilla
9778
$template_content = Get-Content $template_file -Raw
9879

99-
# Reemplazar el valor "_Y_" por el valor de grid_cores en la plantilla
100-
$updated_content = $template_content -replace "_Y_", $grid_cores
80+
# Borrar todas las lineas que empiezan por comentario menos la correspondiente al número de cores
81+
$grid_cores_d3 = "{0:D3}" -f $grid_cores
82+
$updated_content = $template_content -replace "<!-- (?!$grid_cores_d3).*", ""
10183

10284
# Guardar el contenido actualizado en el archivo de salida
10385
$updated_content | Set-Content $output_file

GridMTFixv2-Steam.ps1

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -82,29 +82,10 @@ else {
8282
#$cores = 64
8383

8484
# Definir los valores válidos de cores
85-
$valid_cores = 8, 12, 16, 20, 24, 28, 32
85+
$valid_cores = 1, 2, 4, 6, 8, 12, 16, 20, 24, 28, 32
8686

87-
# Definir el valor de grid_cores basado en el número de cores
88-
if ($cores -gt 32) {
89-
$grid_cores = 32
90-
Write-Host "Your CPU has $cores cores, but the game is limited to 32 cores, so that will be the max core count used."
91-
Delay 4
92-
}
93-
elseif ($cores -lt 8) {
94-
$grid_cores = 8
95-
Write-Host "Race Driver: Grid already supports your CPU core count."
96-
Delay 4
97-
}
98-
else {
99-
# Verificar si el número de cores está en la lista de valid_cores
100-
if ($valid_cores -contains $cores) {
101-
$grid_cores = $cores
102-
}
103-
else {
10487
# Obtener el valor de valid_cores inmediatamente inferior a $cores
105-
$grid_cores = $valid_cores | Where-Object { $_ -lt $cores } | Select-Object -Last 1
106-
}
107-
}
88+
$grid_cores = $valid_cores | Where-Object { $_ -le $cores } | Select-Object -Last 1
10889

10990
# Ruta del archivo de plantilla y archivo de salida
11091
$template_file = "Template.xml"
@@ -113,8 +94,9 @@ else {
11394
# Leer el contenido de la plantilla
11495
$template_content = Get-Content $template_file -Raw
11596

116-
# Reemplazar el valor "_Y_" por el valor de grid_cores en la plantilla
117-
$updated_content = $template_content -replace "_Y_", $grid_cores
97+
# Borrar todas las lineas que empiezan por comentario menos la correspondiente al número de cores
98+
$grid_cores_d3 = "{0:D3}" -f $grid_cores
99+
$updated_content = $template_content -replace "<!-- (?!$grid_cores_d3).*", ""
118100

119101
# Guardar el contenido actualizado en el archivo de salida
120102
$updated_content | Set-Content $output_file

0 commit comments

Comments
 (0)