-
Notifications
You must be signed in to change notification settings - Fork 3
/
check-includes.ps1
43 lines (37 loc) · 1.6 KB
/
check-includes.ps1
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
35
36
37
38
39
40
41
42
43
# check all rom configs
gci "overlays/roms" | ? {
$_.Name.EndsWith('.cfg')
} | % {
$content = get-content $_ | Out-String
# echo $content.IndexOf('#include')
# echo $content.IndexOf('video_shader')
# echo $content.IndexOf('video_fullscreen_x')
# check if it doesn't have the include and config is not written directly
if (($content.IndexOf('#include') -lt 0)) {
# check that I have both shader and resolution
if ((($content.IndexOf('video_shader') -lt 0) -and ($content.IndexOf('video_fullscreen_x') -gt 0)) `
-or (($content.IndexOf('video_shader') -gt 0) -and ($content.IndexOf('video_fullscreen_x') -lt 0))) {
echo "$_ doesn't have the include, and is missing shader or resolution"
read-host
}
elseif (($content.IndexOf('video_shader') -lt 0) -and ($content.IndexOf('video_fullscreen_x') -lt 0)) {
echo "$_ doesn't have the include"
# get orientation
if ($content -match 'custom_viewport_width\s?=\s?\"?(\d+)\"?') {
$width = $matches[1]
}
if ($content -match 'custom_viewport_height\s?=\s?\"?(\d+)\"?') {
$height = $matches[1]
}
if ($width -gt $height) {
$orientation = "horizontal"
}
else {
$orientation = "vertical"
}
# add #include
$content = "#include `"/opt/retropie/configs/all/retroarch/overlay/arcade-realistic/common/$orientation.cfg`"`n`n$content"
$content | out-file $_
}
}
}