-
Notifications
You must be signed in to change notification settings - Fork 0
/
copy.ps1
70 lines (51 loc) · 1.76 KB
/
copy.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
Param(
[Parameter(Mandatory=$false)]
[Switch] $clean,
[Parameter(Mandatory=$false)]
[Switch] $log,
[Parameter(Mandatory=$false)]
[Switch] $useDebug,
[Parameter(Mandatory=$false)]
[Switch] $self,
[Parameter(Mandatory=$false)]
[Switch] $all,
[Parameter(Mandatory=$false)]
[String] $custom="",
[Parameter(Mandatory=$false)]
[String] $file="",
[Parameter(Mandatory=$false)]
[Switch] $help
)
if ($help -eq $true) {
Write-Output "`"Copy`" - Builds and copies your mod to your quest, and also starts Beat Saber with optional logging"
Write-Output "`n-- Arguments --`n"
Write-Output "-Clean `t`t Performs a clean build (equvilant to running `"build -clean`")"
Write-Output "-UseDebug `t Copies the debug version of the mod to your quest"
Write-Output "-Log `t`t Logs Beat Saber using the `"Start-Logging`" command"
Write-Output "`n-- Logging Arguments --`n"
& $PSScriptRoot/start-logging.ps1 -help -excludeHeader
exit
}
& $PSScriptRoot/build.ps1 -clean:$clean
if ($LASTEXITCODE -ne 0) {
Write-Output "Failed to build, exiting..."
exit $LASTEXITCODE
}
& $PSScriptRoot/validate-modjson.ps1
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$modJson = Get-Content "./mod.json" -Raw | ConvertFrom-Json
$modFiles = $modJson.modFiles
foreach ($fileName in $modFiles) {
if ($useDebug -eq $true) {
& adb push build/debug/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
} else {
& adb push build/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName
}
}
& $PSScriptRoot/restart-game.ps1
if ($log -eq $true) {
& adb logcat -c
& $PSScriptRoot/start-logging.ps1 -self:$self -all:$all -custom:$custom -file:$file
}