-
-
Notifications
You must be signed in to change notification settings - Fork 15
Fixes to multiplayer #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
6f3fb40
1dd1760
53b93a0
809c4ab
8fc076f
c3b372c
61f549f
6ca0850
36ff6fe
0f3bb26
1d43f48
15da17f
b8417c9
83bd617
e356c0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| Param( | ||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $clean, | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $help | ||
| ) | ||
|
|
||
| if ($help -eq $true) { | ||
| Write-Output "`"Build`" - Copiles your mod into a `".so`" or a `".a`" library" | ||
| Write-Output "`n-- Arguments --`n" | ||
|
|
||
| Write-Output "-Clean `t`t Deletes the `"build`" folder, so that the entire library is rebuilt" | ||
|
|
||
| exit | ||
| } | ||
|
|
||
| # if user specified clean, remove all build files | ||
| if ($clean.IsPresent) { | ||
| if (Test-Path -Path "build") { | ||
| remove-item build -R | ||
| } | ||
| } | ||
|
|
||
|
|
||
| if (($clean.IsPresent) -or (-not (Test-Path -Path "build"))) { | ||
| new-item -Path build -ItemType Directory | ||
| } | ||
|
|
||
| & cmake -G "Ninja" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -B build | ||
| & cmake --build ./build | ||
|
Comment on lines
+20
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat scripts/build.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 803 Anchor build paths to script location and check CMake configure exit code before building. The script uses relative paths ( Suggested fix+ $repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
+ $buildDir = Join-Path $repoRoot "build"
+
if ($clean.IsPresent) {
- if (Test-Path -Path "build") {
- remove-item build -R
+ if (Test-Path -Path $buildDir) {
+ Remove-Item $buildDir -Recurse -Force
}
}
- if (($clean.IsPresent) -or (-not (Test-Path -Path "build"))) {
- new-item -Path build -ItemType Directory
+ if (-not (Test-Path -Path $buildDir)) {
+ New-Item -Path $buildDir -ItemType Directory | Out-Null
}
- & cmake -G "Ninja" -DCMAKE_BUILD_TYPE="RelWithDebInfo" -B build
- & cmake --build ./build
+ & cmake -S $repoRoot -B $buildDir -G "Ninja" -DCMAKE_BUILD_TYPE="RelWithDebInfo"
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
+ & cmake --build $buildDir
+ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| 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)] | ||
| [Switch] $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 | ||
| $lateModFiles = $modJson.lateModFiles | ||
|
|
||
| foreach ($fileName in $modFiles) { | ||
| if ($useDebug -eq $true) { | ||
| & adb push build/debug/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/early_mods/$fileName | ||
| } else { | ||
| & adb push build/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/early_mods/$fileName | ||
| } | ||
| } | ||
|
|
||
| foreach ($fileName in $lateModFiles) { | ||
| if ($useDebug -eq $true) { | ||
| & adb push build/debug/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName | ||
| } else { | ||
| & adb push build/$fileName /sdcard/ModData/com.beatgames.beatsaber/Modloader/mods/$fileName | ||
|
Comment on lines
+53
to
+70
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's check the repository structure
git ls-files | head -20Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 509 🏁 Script executed: # Read the full scripts/copy.ps1 file to understand context
wc -l scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 98 🏁 Script executed: # Read the relevant section and surrounding context
sed -n '40,75p' scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1079 🏁 Script executed: # Find mod.json location
find . -name "mod.json" -type fRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 61 🏁 Script executed: # Check the build.ps1 script to understand build output paths
sed -n '1,50p' scripts/build.ps1 | head -40Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 803 🏁 Script executed: # Check if mod.json is in scripts directory
ls -la scripts/ | grep -E "(mod\.json|\.json)"Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 61 🏁 Script executed: # Read the beginning of copy.ps1 to see initialization and parameter handling
sed -n '1,40p' scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1095 🏁 Script executed: # Check if mod.json exists in the repo (broader search)
find . -name "*.json" -type f | grep -i modRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 98 🏁 Script executed: # Check full repository structure at root and scripts
ls -la scripts/ | head -30Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 717 🏁 Script executed: # Read more of copy.ps1 to see if working directory is set
sed -n '40,60p' scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 619 🏁 Script executed: # Check the README or any documentation on how to run scripts
grep -r "copy.ps1\|\.ps1" README.md 2>/dev/null | head -20Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 61 🏁 Script executed: # Check if there's a script that calls copy.ps1 to see intended cwd
grep -r "copy\.ps1" . --include="*.ps1" --include="*.yml" --include="*.yaml" --include="*.md"Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 61 🏁 Script executed: # Check if other PowerShell scripts follow similar patterns
rg 'Get-Content.*"\./[^"]*"' scripts/ --no-headingRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 155 🏁 Script executed: # Check if any validation script gives hints about where mod.json should be
cat scripts/validate-modjson.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1149 🏁 Script executed: # Check the entire copy.ps1 to understand full context
cat -n scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 2779 Use repo-rooted file paths for Lines 53, 60, 62, 68, and 70 use working-directory-relative paths. When 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
|
|
||
| & $PSScriptRoot/restart-game.ps1 | ||
|
|
||
|
Comment on lines
+58
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n scripts/copy.ps1 | head -100Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 2779 🏁 Script executed: grep -n "ErrorActionPreference\|$ErrorActionPreference" scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 2454 🏁 Script executed: cat scripts/restart-game.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 208 Check exit codes for Lines 58–75 do not check 🤖 Prompt for AI Agents |
||
| if ($log -eq $true) { | ||
| & adb logcat -c | ||
| & $PSScriptRoot/start-logging.ps1 -self:$self -all:$all -custom:$custom -file:$file | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| Param( | ||
| [Parameter(Mandatory=$false)] | ||
| [String] $qmodName="", | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $help | ||
| ) | ||
|
|
||
| if ($help -eq $true) { | ||
| Write-Output "`"createqmod`" - Creates a .qmod file with your compiled libraries and mod.json." | ||
| Write-Output "`n-- Arguments --`n" | ||
|
|
||
| Write-Output "-QmodName `t The file name of your qmod" | ||
|
|
||
| exit | ||
| } | ||
|
|
||
| $mod = "./mod.json" | ||
|
|
||
| & $PSScriptRoot/validate-modjson.ps1 | ||
| if ($LASTEXITCODE -ne 0) { | ||
| exit $LASTEXITCODE | ||
| } | ||
| $modJson = Get-Content $mod -Raw | ConvertFrom-Json | ||
|
|
||
| if ($qmodName -eq "") { | ||
| $qmodName = $modJson.name | ||
| } | ||
|
|
||
| $filelist = @($mod) | ||
|
|
||
| $cover = "./" + $modJson.coverImage | ||
| if ((-not ($cover -eq "./")) -and (Test-Path $cover)) { | ||
| $filelist += ,$cover | ||
| } | ||
|
|
||
| foreach ($mod in $modJson.modFiles) { | ||
| $path = "./build/" + $mod | ||
| if (-not (Test-Path $path)) { | ||
| $path = "./extern/libs/" + $mod | ||
|
Comment on lines
+18
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Find and examine the createqmod.ps1 script
find . -name "createqmod.ps1" -type fRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 103 🏁 Script executed: # Read the full script to understand the context
cat -n scripts/createqmod.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 2368 🏁 Script executed: # Check if there are other scripts in the same directory that might give context
ls -la scripts/Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 717 🏁 Script executed: # Look for README or documentation
find . -maxdepth 2 -type f \( -name "README*" -o -name "*.md" \) | head -20Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 117 🏁 Script executed: # Check build.ps1 to see how paths are handled there
cat -n scripts/build.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1020 🏁 Script executed: # Check if there are any CI/workflow files that show how this script is called
find . -path "*/.github/workflows/*.yml" -o -path "*/CI/*" -o -path "*/.gitlab-ci.yml" 2>/dev/null | head -10Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 214 🏁 Script executed: # Check the workflow files to see how createqmod.ps1 is invoked
cat -n .github/workflows/Pre-Release.ymlRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 5502 🏁 Script executed: cat -n .github/workflows/Release.ymlRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 5862 🏁 Script executed: # Also check README to see if there's documentation about script usage
cat -n README.md | head -100Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 669 Resolve package input paths from repo root for portability. The script mixes approaches: line 20 correctly uses 🤖 Prompt for AI Agents |
||
| } | ||
| if (-not (Test-Path $path)) { | ||
| Write-Output "Error: could not find dependency: $path" | ||
| exit 1 | ||
| } | ||
| $filelist += $path | ||
| } | ||
|
|
||
| foreach ($mod in $modJson.lateModFiles) { | ||
| $path = "./build/" + $mod | ||
| if (-not (Test-Path $path)) { | ||
| $path = "./extern/libs/" + $mod | ||
| } | ||
| if (-not (Test-Path $path)) { | ||
| Write-Output "Error: could not find dependency: $path" | ||
| exit 1 | ||
| } | ||
| $filelist += $path | ||
| } | ||
|
|
||
| foreach ($lib in $modJson.libraryFiles) { | ||
| $path = "./build/" + $lib | ||
| if (-not (Test-Path $path)) { | ||
| $path = "./extern/libs/" + $lib | ||
| } | ||
| if (-not (Test-Path $path)) { | ||
| Write-Output "Error: could not find dependency: $path" | ||
| exit 1 | ||
| } | ||
| $filelist += $path | ||
| } | ||
|
|
||
| $zip = $qmodName + ".zip" | ||
| $qmod = $qmodName + ".qmod" | ||
|
|
||
| Compress-Archive -Path $filelist -DestinationPath $zip -Update | ||
| Move-Item $zip $qmod -Force | ||
|
Comment on lines
+76
to
+77
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # First, let's look at the file and the specific lines mentioned
if [ -f "scripts/createqmod.ps1" ]; then
echo "=== File found, reading lines 70-85 for context ==="
sed -n '70,85p' scripts/createqmod.ps1
else
echo "=== Looking for the file ==="
find . -name "createqmod.ps1" -type f
fiRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 302 🌐 Web query:
💡 Result:
So if you delete a file from the source folder, How to avoid retaining stale files
Extra gotcha:
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| Param( | ||
| [Parameter(Mandatory=$false)] | ||
| [String] $fileName = "RecentCrash.log", | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $analyze, | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $help | ||
| ) | ||
|
|
||
| if ($help -eq $true) { | ||
| Write-Output "`"Pull-Tombstone`" - Finds and pulls the most recent tombstone from your quest, optionally analyzing it with ndk-stack" | ||
| Write-Output "`n-- Arguments --`n" | ||
|
|
||
| Write-Output "-FileName `t The name for the output file, defaulting to RecentCrash.log" | ||
| Write-Output "-Analyze `t Runs ndk-stack on the file after pulling" | ||
|
|
||
| exit | ||
| } | ||
|
|
||
| $global:currentDate = get-date | ||
| $global:recentDate = $Null | ||
| $global:recentTombstone = $Null | ||
|
|
||
| for ($i = 0; $i -lt 3; $i++) { | ||
| $stats = & adb shell stat /sdcard/Android/data/com.beatgames.beatsaber/files/tombstone_0$i | ||
| $date = (Select-String -Input $stats -Pattern "(?<=Modify: )\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?=.\d{9})").Matches.Value | ||
| if([string]::IsNullOrEmpty($date)) { | ||
| Write-Output "Failed to pull tombstone, exiting..." | ||
| exit 1; | ||
| } | ||
| $dateObj = [datetime]::ParseExact($date, "yyyy-MM-dd HH:mm:ss", $Null) | ||
|
Comment on lines
+26
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t abort the whole scan when one tombstone is unreadable. Line 29 exits the script on the first parse miss. If one slot is missing/corrupt, you skip valid newer slots and fail the primary use case. Suggested fix+$foundAny = $false
for ($i = 0; $i -lt 3; $i++) {
- $stats = & adb shell stat /sdcard/Android/data/com.beatgames.beatsaber/files/tombstone_0$i
- $date = (Select-String -Input $stats -Pattern "(?<=Modify: )\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?=.\d{9})").Matches.Value
- if([string]::IsNullOrEmpty($date)) {
- Write-Output "Failed to pull tombstone, exiting..."
- exit 1;
+ $stats = & adb shell stat /sdcard/Android/data/com.beatgames.beatsaber/files/tombstone_0$i 2>$null
+ if ($LASTEXITCODE -ne 0) {
+ Write-Output "Skipping tombstone_0$i (not found)"
+ continue
+ }
+ $match = Select-String -InputObject $stats -Pattern 'Modify:\s+(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})'
+ if ($match.Matches.Count -eq 0) {
+ Write-Output "Skipping tombstone_0$i (timestamp parse failed)"
+ continue
}
+ $date = $match.Matches[0].Groups[1].Value
$dateObj = [datetime]::ParseExact($date, "yyyy-MM-dd HH:mm:ss", $Null)
+ $foundAny = $true
$difference = [math]::Round(($currentDate - $dateObj).TotalMinutes)
@@
}
+
+if (-not $foundAny) {
+ Write-Error "No readable tombstones found."
+ exit 1
+}🤖 Prompt for AI Agents |
||
| $difference = [math]::Round(($currentDate - $dateObj).TotalMinutes) | ||
| if ($difference -eq 1) { | ||
| Write-Output "Found tombstone_0$i $difference minute ago" | ||
| } else { | ||
| Write-Output "Found tombstone_0$i $difference minutes ago" | ||
| } | ||
| if (-not $recentDate -or $recentDate -lt $dateObj) { | ||
| $recentDate = $dateObj | ||
| $recentTombstone = $i | ||
| } | ||
| } | ||
|
|
||
| Write-Output "Latest tombstone was tombstone_0$recentTombstone" | ||
|
|
||
| & adb pull /sdcard/Android/data/com.beatgames.beatsaber/files/tombstone_0$recentTombstone $fileName | ||
|
|
||
| if ($analyze) { | ||
| & $PSScriptRoot/ndk-stack.ps1 -logName:$fileName | ||
| } | ||
|
Comment on lines
+48
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gate analysis on successful Line 51 can run even when Line 48 failed, which may analyze an old/local stale file and produce misleading output. Suggested fix & adb pull /sdcard/Android/data/com.beatgames.beatsaber/files/tombstone_0$recentTombstone $fileName
+if ($LASTEXITCODE -ne 0) {
+ Write-Error "Failed to pull tombstone_0$recentTombstone"
+ exit 1
+}
if ($analyze) {
& $PSScriptRoot/ndk-stack.ps1 -logName:$fileName
}🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| adb shell am force-stop com.beatgames.beatsaber | ||
| adb shell am start com.beatgames.beatsaber/com.unity3d.player.UnityPlayerActivity |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| Param( | ||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $self, | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $all, | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [String] $custom="", | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $file="", | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $help, | ||
|
|
||
| [Parameter(Mandatory=$false)] | ||
| [Switch] $excludeHeader | ||
| ) | ||
|
|
||
| if ($help -eq $true) { | ||
| if ($excludeHeader -eq $false) { | ||
| Write-Output "`"Start-Logging`" - Logs Beat Saber using `"adb logcat`"" | ||
| Write-Output "`n-- Arguments --`n" | ||
| } | ||
|
|
||
| Write-Output "-Self `t`t Only Logs your mod and Crashes" | ||
| Write-Output "-All `t`t Logs everything, including logs made by the Quest itself" | ||
| Write-Output "-Custom `t Specify a specific logging pattern, e.g `"custom-types|questui`"" | ||
| Write-Output "`t`t NOTE: The paterent `"AndriodRuntime|CRASH`" is always appended to a custom pattern" | ||
| Write-Output "-File `t`t Saves the output of the log to the file name given" | ||
|
|
||
| exit | ||
| } | ||
|
|
||
| $bspid = adb shell pidof com.beatgames.beatsaber | ||
| $command = "adb logcat " | ||
|
|
||
| # if ($all -eq $false) { | ||
| $loops = 0 | ||
| while ([string]::IsNullOrEmpty($bspid) -and $loops -lt 6) { | ||
| Start-Sleep -Milliseconds 100 | ||
| $bspid = adb shell pidof com.beatgames.beatsaber | ||
| $loops += 1 | ||
| } | ||
|
|
||
| if ([string]::IsNullOrEmpty($bspid)) { | ||
| Write-Output "Could not connect to adb, exiting..." | ||
| exit 1 | ||
| } | ||
|
|
||
| $command += "--pid $bspid" | ||
| # } | ||
|
Comment on lines
+39
to
+53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 39–53 always resolve PID and append 🤖 Prompt for AI Agents |
||
|
|
||
| if ($all -eq $false) { | ||
| $pattern = "(" | ||
| if ($self -eq $true) { | ||
| $pattern += "MultiplayerCore|" | ||
| } | ||
| if (![string]::IsNullOrEmpty($custom)) { | ||
| $pattern += "$custom|" | ||
| } | ||
| if ($pattern -eq "(") { | ||
| $pattern = "(QuestHook|modloader|" | ||
| } | ||
| $pattern += "AndroidRuntime|CRASH)" | ||
| $command += " | Select-String -pattern `"$pattern`"" | ||
| } | ||
|
|
||
| if ($file -eq $true) { | ||
| $command += " | Out-File -FilePath $PSScriptRoot\..\log.log" | ||
| } | ||
|
|
||
| Write-Output "Logging using Command `"$command`"" | ||
| Invoke-Expression $command | ||
|
Comment on lines
+67
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replace Line 67–75 executes interpolated strings containing Suggested fix-Write-Output "Logging using Command `"$command`""
-Invoke-Expression $command
+Write-Output "Starting log capture..."
+if ($all) {
+ if ($file) { & adb logcat | Out-File -FilePath (Join-Path $PSScriptRoot "..\log.log") }
+ else { & adb logcat }
+} else {
+ if ($file) { & adb logcat --pid $bspid | Select-String -Pattern $pattern | Out-File -FilePath (Join-Path $PSScriptRoot "..\log.log") }
+ else { & adb logcat --pid $bspid | Select-String -Pattern $pattern }
+}🧰 Tools🪛 PSScriptAnalyzer (1.25.0)[warning] 75-75: Invoke-Expression is used. Please remove Invoke-Expression from script and find other options instead. (PSAvoidUsingInvokeExpression) 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $mod = "./mod.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (-not (Test-Path -Path $mod)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Test-Path -Path ".\mod.template.json") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| & qpm qmod build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Read the PowerShell script
cat -n scripts/validate-modjson.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1415 🏁 Script executed: # Check repo structure and locations of the files mentioned
fd "mod\.json|mod\.template\.json|mod\.schema\.json" -t fRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 96 🏁 Script executed: # Find where this script is invoked from
rg "validate-modjson" -t json -t yaml -t powershell -t shellRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 113 🏁 Script executed: # Search for invocations of the validate script more broadly
rg "validate-modjson" --max-count=20Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 192 🏁 Script executed: # Check package.json and other script files for invocations
cat -n package.json | head -100Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 123 🏁 Script executed: # Check for any CI/CD files
fd "\.yml|\.yaml|\.json" scripts/ -t fRepository: EnderdracheLP/MultiplayerCore.Quest Length of output: 61 🏁 Script executed: # Check repo structure to confirm file locations
ls -la | head -20Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1306 🏁 Script executed: # Check where mod.template.json actually is
find . -name "mod.template.json" -o -name "mod.json"Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 98 🏁 Script executed: # Look at the other scripts that call validate-modjson.ps1 to understand context
head -20 scripts/copy.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 457 🏁 Script executed: # Also check createqmod.ps1
head -20 scripts/createqmod.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 496 Resolve paths from script's parent directory; add error handling for network requests. Lines 1–5 rely on the current working directory for path resolution, which breaks when this script is invoked from a different directory. Resolve paths using Additionally, line 21 downloads the schema with 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($LASTEXITCODE -ne 0) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit $LASTEXITCODE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Write-Output "Error: mod.json and mod.template.json were not present" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Write-Output "Creating qmod from mod.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $psVersion = $PSVersionTable.PSVersion.Major | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if ($psVersion -ge 6) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $schemaUrl = "https://raw.githubusercontent.com/Lauriethefish/QuestPatcher.QMod/main/QuestPatcher.QMod/Resources/qmod.schema.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Invoke-WebRequest $schemaUrl -OutFile ./mod.schema.json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $schema = "./mod.schema.json" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $modJsonRaw = Get-Content $mod -Raw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $modSchemaRaw = Get-Content $schema -Raw | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Remove-Item $schema | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Write-Output "Validating mod.json..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (-not ($modJsonRaw | Test-Json -Schema $modSchemaRaw)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Write-Output "Error: mod.json is not valid" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: cat -n scripts/validate-modjson.ps1Repository: EnderdracheLP/MultiplayerCore.Quest Length of output: 1415 Add error handling around schema download and validation cleanup. If Suggested fix- Invoke-WebRequest $schemaUrl -OutFile ./mod.schema.json
-
- $schema = "./mod.schema.json"
- $modJsonRaw = Get-Content $mod -Raw
- $modSchemaRaw = Get-Content $schema -Raw
-
- Remove-Item $schema
-
- Write-Output "Validating mod.json..."
- if (-not ($modJsonRaw | Test-Json -Schema $modSchemaRaw)) {
- Write-Output "Error: mod.json is not valid"
- exit 1
- }
+ $schema = "./mod.schema.json"
+ try {
+ Invoke-WebRequest $schemaUrl -OutFile $schema -ErrorAction Stop
+ $modJsonRaw = Get-Content $mod -Raw -ErrorAction Stop
+ $modSchemaRaw = Get-Content $schema -Raw -ErrorAction Stop
+ Write-Output "Validating mod.json..."
+ if (-not ($modJsonRaw | Test-Json -Schema $modSchemaRaw)) {
+ Write-Output "Error: mod.json is not valid"
+ exit 1
+ }
+ } finally {
+ if (Test-Path $schema) { Remove-Item $schema -Force }
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Write-Output "Could not validate mod.json with schema: powershell version was too low (< 6)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix help text typo.
Line 10 says “Copiles”; should be “Compiles”.
🤖 Prompt for AI Agents