Repository navigation
Expand file tree
/
Copy pathterribuild.ps1
More file actions
178 lines (156 loc) · 6.78 KB
/
Copy pathterribuild.ps1
File metadata and controls
178 lines (156 loc) · 6.78 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
[Reflection.Assembly]::LoadFrom("$((Get-Location).Path)\Newtonsoft.Json.dll")
# Config
try {
. ".\config.ps1"
}
catch {
throw "Please put a config.ps1 from the provided config.ps1.sample in the repository root, and run this script from there."
}
# EXE metadata configuration
$version_string = "1.0.0"
$tool_icon = "CoZIcon.ico"
$game_icon = "LauncherIcon.ico"
$publisher = "Committee of Zero"
$product_name = "Steins;Gate Variant Space Octet Translation Patch"
# Code
function SetInstallerExeMetadata {
param ([string]$exePath)
$originalFilename = (Get-Item $exePath).Name
.\rcedit-x86.exe $exePath `
--set-icon "$tool_icon" `
--set-file-version "$version_string" `
--set-product-version "$version_string" `
--set-version-string "CompanyName" "$publisher" `
--set-version-string "FileDescription" "$product_name Installer (v$version_string)" `
--set-version-string "FileVersion" "$version_string" `
--set-version-string "InternalName" "Installer.exe" `
--set-version-string "LegalCopyright" "$publisher" `
--set-version-string "OriginalFilename" "$originalFilename" `
--set-version-string "ProductName" "$product_name Installer" `
--set-version-string "ProductVersion" "$version_string"
}
function SetUninstallerExeMetadata {
param ([string]$exePath)
$originalFilename = (Get-Item $exePath).Name
.\rcedit-x86.exe $exePath `
--set-icon "$tool_icon" `
--set-file-version "$version_string" `
--set-product-version "$version_string" `
--set-version-string "CompanyName" "$publisher" `
--set-version-string "FileDescription" "$product_name Uninstaller (v$version_string)" `
--set-version-string "FileVersion" "$version_string" `
--set-version-string "InternalName" "nguninstall.exe" `
--set-version-string "LegalCopyright" "$publisher" `
--set-version-string "OriginalFilename" "$originalFilename" `
--set-version-string "ProductName" "$product_name Uninstaller" `
--set-version-string "ProductVersion" "$version_string"
}
function SetRealbootExeMetadata {
param ([string]$exePath)
$originalFilename = (Get-Item $exePath).Name
.\rcedit-x86.exe $exePath `
--set-icon "$game_icon" `
--set-file-version "$version_string" `
--set-product-version "$version_string" `
--set-version-string "CompanyName" "$publisher" `
--set-version-string "FileDescription" "$product_name Launcher (v$version_string)" `
--set-version-string "FileVersion" "$version_string" `
--set-version-string "InternalName" "realboot.exe" `
--set-version-string "LegalCopyright" "$publisher" `
--set-version-string "OriginalFilename" "$originalFilename" `
--set-version-string "ProductName" "$product_name Launcher" `
--set-version-string "ProductVersion" "$version_string"
}
function GenerateEnscriptToc {
param ([string]$tocPath, [string]$scriptsPath)
$inToc = Import-CSV .\script_toc.csv -header Id, FilenameOnDisk, FilenameInArchive
$jw = New-Object Newtonsoft.Json.JsonTextWriter(New-Object System.IO.StreamWriter($tocPath))
$jw.Formatting = [Newtonsoft.Json.Formatting]::Indented
$jw.Indentation = 2
$jw.IndentChar = ' '
$jw.WriteStartArray();
foreach ($entry in $inToc) {
$jw.WriteStartObject();
$jw.WritePropertyName("id");
$jw.WriteValue([int]$entry.Id);
$jw.WritePropertyName("filename");
$jw.WriteValue($entry.FilenameInArchive);
$jw.WritePropertyName('size');
$jw.WriteValue((Get-Item "$scriptsPath\$($entry.FilenameInArchive)").Length);
$jw.WriteEndObject();
}
$jw.WriteEndArray();
$jw.Flush()
$jw.Close()
}
# END CONFIG
function PrintSection {
param ([string]$desc)
$line = "------------------------------------------------------------------------"
$len = (($line.length, $desc.legnth) | Measure -Max).Maximum
Write-Host ""
Write-Host $line.PadRight($len) -BackgroundColor DarkBlue -ForegroundColor Cyan
Write-Host (" >> " + $desc).PadRight($len) -BackgroundColor DarkBlue -ForegroundColor Cyan
Write-Host $line.PadRight($len) -BackgroundColor DarkBlue -ForegroundColor Cyan
Write-Host ""
}
Write-Output " TERRIBUILD"
Write-Output "Rated World's #1 Build Script By Leading Game Industry Officials"
Write-Output ""
Write-Output "------------------------------------------------------------------------"
Write-Output ""
PrintSection "Creating new DIST and temp"
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue .\DIST
New-Item -ItemType directory -Path .\DIST | Out-Null
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue .\temp
New-Item -ItemType directory -Path .\temp | Out-Null
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue .\symbols
New-Item -ItemType directory -Path .\symbols | Out-Null
PrintSection "Pulling latest assets changes"
cd sgvso-engine
& git pull
cd ..
PrintSection "Patching and copying assets to DIST"
.\Xp3Pack.exe .\sgvso-engine\data
Move-Item -Force .\sgvso-engine\data.xp3 .\DIST\data.xp3
Copy-Item -Recurse -Force .\sgvso-engine\plugin .\DIST
Copy-Item -Recurse -Force .\sgvso-engine\gdiplus.dll .\DIST
Copy-Item -Recurse -Force .\sgvso-engine\k2compat.xp3 .\DIST
Copy-Item -Recurse -Force .\sgvso-engine\sg8bit.exe .\DIST
PrintSection "Copying content to DIST"
Copy-Item -Recurse -Force .\content\* .\DIST
PrintSection "Building and copying realboot"
cd launcher
& .\realboot_build.bat
cd ..
SetRealbootExeMetadata .\launcher\deploy\LauncherC0.exe
Copy-Item -Recurse -Force .\launcher\deploy\* .\DIST
Copy-Item -Recurse -Force .\launcher\build\release\*.pdb .\symbols
PrintSection "Building noidget"
cd installer
& .\noidget_build.bat
cd ..
SetInstallerExeMetadata .\installer\deploy\noidget.exe
SetUninstallerExeMetadata .\installer\deployUninstaller\noidget.exe
Copy-Item -Recurse -Force .\installer\build\release\*.pdb .\symbols
PrintSection "Packing uninstaller"
cd installer\deployUninstaller
7z a -mx=0 ..\..\temp\sfxbaseUninstaller.7z .\*
cd ..\..
copy .\7zS2.sfx .\temp\UninstallerExtractor.exe
SetUninstallerExeMetadata -exePath .\temp\UninstallerExtractor.exe
cmd /c copy /b .\temp\UninstallerExtractor.exe + .\temp\sfxbaseUninstaller.7z DIST\nguninstall.exe
PrintSection "Packing installer"
cd temp
$patchFolderName = "SGVSOPatch-v$version_string-Setup"
New-Item -ItemType directory -Path $patchFolderName | Out-Null
cd $patchFolderName
New-Item -ItemType directory -Path DIST | Out-Null
Move-Item -Force ..\..\DIST\* .\DIST
Move-Item -Force ..\..\installer\deploy\* .
Move-Item -Force .\noidget.exe .\SGVSOPatch-Installer.exe
cd ..\..\DIST
7z a -mx=5 "$patchFolderName.zip" "..\temp\$patchFolderName"
cd ..
PrintSection "Removing temp"
Remove-Item -Force -Recurse .\temp