|
1 | | -$NDKPath = Get-Content $PSScriptRoot/ndkpath.txt |
| 1 | +Param( |
| 2 | + [Parameter(Mandatory=$false)] |
| 3 | + [Switch] $clean, |
2 | 4 |
|
3 | | -$buildScript = "$NDKPath/build/ndk-build" |
4 | | -if (-not ($PSVersionTable.PSEdition -eq "Core")) { |
5 | | - $buildScript += ".cmd" |
| 5 | + [Parameter(Mandatory=$false)] |
| 6 | + [Switch] $log, |
| 7 | + |
| 8 | + [Parameter(Mandatory=$false)] |
| 9 | + [Switch] $useDebug, |
| 10 | + |
| 11 | + [Parameter(Mandatory=$false)] |
| 12 | + [Switch] $self, |
| 13 | + |
| 14 | + [Parameter(Mandatory=$false)] |
| 15 | + [Switch] $all, |
| 16 | + |
| 17 | + [Parameter(Mandatory=$false)] |
| 18 | + [String] $custom="", |
| 19 | + |
| 20 | + [Parameter(Mandatory=$false)] |
| 21 | + [String] $file="", |
| 22 | + |
| 23 | + [Parameter(Mandatory=$false)] |
| 24 | + [Switch] $help |
| 25 | +) |
| 26 | + |
| 27 | +if ($help -eq $true) { |
| 28 | + Write-Output "`"Copy`" - Builds and copies your mod to your quest, and also starts Beat Saber with optional logging" |
| 29 | + Write-Output "`n-- Arguments --`n" |
| 30 | + |
| 31 | + Write-Output "-Clean `t`t Performs a clean build (equvilant to running `"build -clean`")" |
| 32 | + Write-Output "-UseDebug `t Copies the debug version of the mod to your quest" |
| 33 | + Write-Output "-Log `t`t Logs Beat Saber using the `"Start-Logging`" command" |
| 34 | + |
| 35 | + Write-Output "`n-- Logging Arguments --`n" |
| 36 | + |
| 37 | + & $PSScriptRoot/start-logging.ps1 -help -excludeHeader |
| 38 | + |
| 39 | + exit |
| 40 | +} |
| 41 | + |
| 42 | +& $PSScriptRoot/build.ps1 -clean:$clean |
| 43 | + |
| 44 | +if ($LASTEXITCODE -ne 0) { |
| 45 | + Write-Output "Failed to build, exiting..." |
| 46 | + exit $LASTEXITCODE |
| 47 | +} |
| 48 | + |
| 49 | +# & $PSScriptRoot/validate-modjson.ps1 |
| 50 | +# if ($LASTEXITCODE -ne 0) { |
| 51 | +# exit $LASTEXITCODE |
| 52 | +# } |
| 53 | +$modJson = Get-Content "./mod.json" -Raw | ConvertFrom-Json |
| 54 | + |
| 55 | +$modFiles = $modJson.modFiles |
| 56 | + |
| 57 | +foreach ($fileName in $modFiles) { |
| 58 | + if ($useDebug -eq $true) { |
| 59 | + & adb push build/debug/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName |
| 60 | + } else { |
| 61 | + & adb push build/$fileName /sdcard/Android/data/com.beatgames.beatsaber/files/mods/$fileName |
| 62 | + } |
6 | 63 | } |
7 | 64 |
|
8 | | -& $buildScript NDK_PROJECT_PATH=$PSScriptRoot APP_BUILD_SCRIPT=$PSScriptRoot/Android.mk NDK_APPLICATION_MK=$PSScriptRoot/Application.mk |
9 | | -& adb push libs/arm64-v8a/libRedBar_0_1_0.so /sdcard/Android/data/com.beatgames.beatsaber/files/mods/libRedBar_0_1_0.so |
10 | | -& adb shell am force-stop com.beatgames.beatsaber |
| 65 | +& $PSScriptRoot/restart-game.ps1 |
| 66 | + |
| 67 | +if ($log -eq $true) { |
| 68 | + & adb logcat -c |
| 69 | + & $PSScriptRoot/start-logging.ps1 -self:$self -all:$all -custom:$custom -file:$file |
| 70 | +} |
0 commit comments