diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:15:56 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-22 13:15:56 -0500 |
| commit | 2fbbd93b57ade80ecc560e0550e60b053a531a5f (patch) | |
| tree | c54c96bd99a5f35add2d8f2e49f2c4e15887bbfd /scripts | |
| parent | 1b75e5c58fb5b03d6cbc0fb32e4c73f11be7803a (diff) | |
| parent | 6065382540667e2e82f5adc623e6afb55e211001 (diff) | |
Merge pull request #2529 from DanielDeGiorgio
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/meta_to_xml.ps1 | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/meta_to_xml.ps1 b/scripts/meta_to_xml.ps1 index 2efe0c32a..065ad4145 100644 --- a/scripts/meta_to_xml.ps1 +++ b/scripts/meta_to_xml.ps1 | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | # Converts carved PSO ('PSIN') and RBF ('RBF0') metadata blobs to XML with CodeWalker.Core's parsers. | 1 | # Converts carved PSO ('PSIN') and RBF ('RBF0') metadata blobs to XML with CodeWalker.Core's parsers. |
| 2 | # Run in Windows PowerShell 5.1. | 2 | # Run in Windows PowerShell 5.1. |
| 3 | # .\meta_to_xml.ps1 -Carve <work>\carve -Out <work>\meta [-Limit N] | 3 | # .\meta_to_xml.ps1 -Carve <work>\carve -Out <work>\meta [-Limit N] |
| 4 | # Each blob becomes <Out>\<archive>\<offset>.xml. Failures go to <Out>\failures.txt with the parser's message. | 4 | # Each blob becomes <Out>\<archive>\<offset>.xml. Failures go to <Out>\failures.txt with the error message. |
| 5 | param( | 5 | param( |
| 6 | [string]$Carve = "<work>\carve", | 6 | [string]$Carve = "<work>\carve", |
| 7 | [string]$Out = "<work>\meta", | 7 | [string]$Out = "<work>\meta", |
| @@ -29,9 +29,9 @@ foreach ($dir in Get-ChildItem -LiteralPath $Carve -Directory) { | |||
| 29 | if ($Limit -and $n -ge $Limit) { break } | 29 | if ($Limit -and $n -ge $Limit) { break } |
| 30 | $n++ | 30 | $n++ |
| 31 | $name = "{0:x12}" -f [int64]$r.off | 31 | $name = "{0:x12}" -f [int64]$r.off |
| 32 | $bytes = [IO.File]::ReadAllBytes((Join-Path $dir.FullName "$name.bin")) | ||
| 33 | $kind = if ($r.head.StartsWith("5053494e")) { "pso" } else { "rbf" } | 32 | $kind = if ($r.head.StartsWith("5053494e")) { "pso" } else { "rbf" } |
| 34 | try { | 33 | try { |
| 34 | $bytes = [IO.File]::ReadAllBytes((Join-Path $dir.FullName "$name.bin")) | ||
| 35 | if ($kind -eq "pso") { | 35 | if ($kind -eq "pso") { |
| 36 | $f = New-Object CodeWalker.GameFiles.PsoFile; $f.Load($bytes) | 36 | $f = New-Object CodeWalker.GameFiles.PsoFile; $f.Load($bytes) |
| 37 | $xml = [CodeWalker.GameFiles.PsoXml]::GetXml($f) | 37 | $xml = [CodeWalker.GameFiles.PsoXml]::GetXml($f) |