-
Notifications
You must be signed in to change notification settings - Fork 0
/
sc-troubleshooting.ps1
357 lines (332 loc) · 12.2 KB
/
sc-troubleshooting.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
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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# Change this value to change the default path
$strDefault = "C:\Program Files\Roberts Space Industries\StarCitizen"
# Don't change any other values
# $roamingAppData = [Environment]::GetFolderPath('ApplicationData')
$localAppData = [Environment]::GetFolderPath('LocalApplicationData')
Clear-Host
Write-Host "Welcome to Deus Maximus's Star Citizen Troubleshooting script (for Alpha 3.17 or higher)."
Write-Host
$strFolder = Read-Host -Prompt "Where is your Star Citizen Folder located? (default is ""$strDefault"")"
if ($strFolder -eq ""){
$strFolder = $strDefault
}
function Show-Menu
{
param (
[string]$Title = 'Star Citizen Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' for the LIVE environment."
Write-Host "2: Press '2' for the PTU environment."
Write-Host "3: Press '3' for the EPTU environment."
Write-Host "4: Press '4' for the TECH-PREVIEW environment."
Write-Host "5: Press '5' for general troubleshooting."
Write-Host "Q: Press 'Q' to quit."
}
function Show-LIVE-Menu
{
param (
[string]$Title = 'Star Citizen LIVE Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' to delete Easy Anti Cheat (you will need to re-verify files after doing this)."
Write-Host "2: Press '2' to delete the LIVE USER folder (not recommended)."
Write-Host "3: Press '3' to copy LIVE to the PTU environment."
Write-Host "4: Press '4' to copy LIVE to the EPTU environment."
Write-Host "5: Press '5' to copy LIVE to the TECH-PREVIEW environment."
Write-Host "B: Press 'B' to go back."
}
function Show-PTU-Menu
{
param (
[string]$Title = 'Star Citizen PTU Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' to delete Easy Anti Cheat (you will need to re-verify files after doing this)."
Write-Host "2: Press '2' to delete the PTU USER folder."
Write-Host "3: Press '3' to copy PTU to the LIVE environment."
Write-Host "4: Press '4' to copy PTU to the EPTU environment."
Write-Host "B: Press 'B' to go back."
}
function Show-EPTU-Menu
{
param (
[string]$Title = 'Star Citizen EPTU Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' to delete Easy Anti Cheat (you will need to re-verify files after doing this)."
Write-Host "2: Press '2' to delete the EPTU USER folder."
Write-Host "3: Press '3' to copy EPTU to the LIVE environment."
Write-Host "4: Press '4' to copy EPTU to the PTU environment."
Write-Host "B: Press 'B' to go back."
}
function Show-TECH-PREVIEW-Menu
{
param (
[string]$Title = 'Star Citizen TECH-PREVIEW Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' to delete Easy Anti Cheat (you will need to re-verify files after doing this)."
Write-Host "2: Press '2' to delete the TECH-PREVIEW USER folder."
Write-Host "3: Press '3' to copy TECH-PREVIEW to the LIVE environment."
Write-Host "B: Press 'B' to go back."
}
function Show-General-Menu
{
param (
[string]$Title = 'Star Citizen General Troubleshooting'
)
Clear-Host
Write-Host "================ $Title ================"
Write-Host "1: Press '1' to delete shaders."
Write-Host "2: Press '2' to delete debug logs and log backups."
Write-Host "3: Press '3' to delete previous crash dumps."
Write-Host "B: Press 'B' to go back."
}
function deleteShaders
{
$strShaderPaths = Get-ChildItem "$localAppData\Star Citizen" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('shaders')}
$strOldShaderPaths = Get-ChildItem "$strFolder" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('shaders')}
foreach ($strShaderPath in $strShaderPaths) {
Write-Host "Deleting shaders in" $strShaderPath.FullName
Remove-Item $strShaderPath.FullName -Recurse
}
foreach ($strOldShaderPath in $strOldShaderPaths) {
Write-Host "Deleting shaders in" $strOldShaderPath.FullName
Remove-Item $strOldShaderPath.FullName -Recurse
}
}
function deleteOldLogs
{
$strLogPaths = Get-ChildItem "$strFolder" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('logbackups')}
$strDebugLogPaths = Get-ChildItem "$strFolder" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('DebugLogs')}
foreach ($strLogPath in $strLogPaths) {
Write-Host "Deleting logs in" $strLogPath.FullName
Remove-Item $strLogPath.FullName -Recurse
}
foreach ($strDebugLogPath in $strDebugLogPaths) {
Write-Host "Deleting debug logs in" $strDebugLogPath.FullName
Remove-Item $strDebugLogPath.FullName -Recurse
}
}
function deleteCrashes
{
$strCrashPath = "$localAppData\Star Citizen\Crashes"
If (Test-Path "$strCrashPath"){
Write-Host "Deleting crash dumps in" $strCrashPath
Remove-Item "$strCrashPath" -Recurse
}
}
function deleteEAC
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string] $Environment
)
$strEACPaths = Get-ChildItem "$strFolder\$Environment" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('EasyAntiCheat')}
foreach ($strEACPath in $strEACPaths) {
Write-Host "Deleting EasyAntiCheat in" $strEACPath.FullName
Remove-Item $strEACPath.FullName -Recurse
}
Write-Host "Remember to verify your game files before launching Star Citizen after doing this!"
}
function deleteUser
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string] $Environment
)
$strUserPaths = Get-ChildItem "$strFolder\$Environment" -Recurse | Where-Object { $_.PSIsContainer -and $_.Name.EndsWith('USER')}
Write-Host "This will delete all folders with USER in the name in your $Environment folder, including controller bindings."
$deleteUsers = $Host.UI.PromptForChoice('', 'Are you sure?', @('&Yes'; '&No'), 1)
if ($deleteUsers -eq 0)
{
foreach ($strUserPath in $strUserPaths) {
Write-Host "Deleting USER folder in" $strUserPath.FullName
Remove-Item $strUserPath.FullName -Recurse
}
}
}
function copyEnvironment
{
Param
(
[Parameter(Mandatory=$true, Position=0)]
[string] $Source,
[Parameter(Mandatory=$true, Position=1)]
[string] $Destination
)
Write-Host "This will delete all files in the $Destination folder, except for the USER and ScreenShots folder, and copy the current $Source build as a starting point for the next $Destination patch."
$deletePTU = $Host.UI.PromptForChoice('', 'Are you sure?', @('&Yes'; '&No'), 0)
if ($deletePTU -eq 0){
if(!(Test-Path -Path "$strFolder\$Destination"))
{
New-Item -Path "$strFolder" -Name "$Destination" -ItemType Directory
}
Get-ChildItem -Path "$strFolder\$Destination" -Exclude ('USER', 'ScreenShots') | Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Remove-Item -Recurse -Force
robocopy "$strFolder\$Source" "$strFolder\$Destination" /MIR /XD "$strFolder\$Source\DebugLogs" "$strFolder\$Source\EasyAntiCheat" "$strFolder\$Source\logbackups" "$strFolder\$Source\logs" "$strFolder\$Source\ScreenShots" "$strFolder\$Source\USER" /XF *.log
}
}
do
{
Show-Menu
$selection = Read-Host "Please make a selection"
switch ($selection)
{
'1' {
do
{
Show-LIVE-Menu
$selection1 = Read-Host "Please make a selection"
switch ($selection1)
{
'1' {
deleteEAC -Environment "LIVE"
Write-Host
pause
}
'2' {
deleteUser -Environment "LIVE"
Write-Host
pause
}
'3' {
copyEnvironment -Source "LIVE" -Destination "PTU"
Write-Host
pause
}
'4' {
copyEnvironment -Source "LIVE" -Destination "EPTU"
Write-Host
pause
}
'5' {
copyEnvironment -Source "LIVE" -Destination "TECH-PREVIEW"
Write-Host
pause
}
}
}
until ($selection1 -eq 'b')
} '2' {
do
{
Show-PTU-Menu
$selection2 = Read-Host "Please make a selection"
switch ($selection2)
{
'1' {
deleteEAC -Environment "PTU"
Write-Host
pause
}
'2' {
deleteUser -Environment "PTU"
Write-Host
pause
}
'3' {
copyEnvironment -Source "PTU" -Destination "LIVE"
Write-Host
pause
}
'4' {
copyEnvironment -Source "PTU" -Destination "EPTU"
Write-Host
pause
}
}
}
until ($selection2 -eq 'b')
} '3' {
do
{
Show-EPTU-Menu
$selection3 = Read-Host "Please make a selection"
switch ($selection3)
{
'1' {
deleteEAC -Environment "EPTU"
Write-Host
pause
}
'2' {
deleteUser -Environment "EPTU"
Write-Host
pause
}
'3' {
copyEnvironment -Source "EPTU" -Destination "LIVE"
Write-Host
pause
}
'4' {
copyEnvironment -Source "EPTU" -Destination "PTU"
Write-Host
pause
}
}
}
until ($selection3 -eq 'b')
} '4' {
do
{
Show-TECH-PREVIEW-Menu
$selection4 = Read-Host "Please make a selection"
switch ($selection4)
{
'1' {
deleteEAC -Environment "TECH-PREVIEW"
Write-Host
pause
}
'2' {
deleteUser -Environment "TECH-PREVIEW"
Write-Host
pause
}
'3' {
copyEnvironment -Source "TECH-PREVIEW" -Destination "LIVE"
Write-Host
pause
}
}
}
until ($selection4 -eq 'b')
} '5' {
do
{
Show-General-Menu
$selection5 = Read-Host "Please make a selection"
switch ($selection5)
{
'1' {
deleteShaders
Write-Host
pause
}
'2' {
deleteOldLogs
Write-Host
pause
}
'3' {
deleteCrashes
Write-Host
pause
}
}
}
until ($selection5 -eq 'b')
}
}
}
until ($selection -eq 'q')
Clear-Host