Files
mandy/scripts/carve_all.ps1
NotRexed db0dc8bd5e Initial commit: Leonida, build-it-yourself PC port groundwork
Shader pipeline (carve, FSSM unpack, gfx1013 disassembly, RDNA2 to SPIR-V),
asset export via rpf9-explorer's Core (submodule), PE loader and shim
skeleton, and make_game.py, which builds from the user's own copy of the game.
No game data, keys or executables are included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 15:22:16 -05:00

21 lines
1.5 KiB
PowerShell

# Carves every .rpf in the game folder into <Out>\<archive path with _>, smallest first (research tool; the
# build itself doesn't need it). Skips archives that already have an index.json. Summary: <Out>\coverage.json
param([Parameter(Mandatory)][string]$Game, [Parameter(Mandatory)][string]$Out)
$root = Split-Path $PSScriptRoot -Parent
$tool = Join-Path $root "tools\rpf9_carve.py"
$rows = @()
foreach ($f in Get-ChildItem $Game -Recurse -Filter *.rpf | Sort-Object Length) {
$rel = $f.FullName.Substring($Game.Length + 1)
$dest = Join-Path $Out ([IO.Path]::GetFileNameWithoutExtension(($rel -replace "[\\/]", "_")))
if (-not (Test-Path (Join-Path $dest "index.json"))) {
Write-Host ("{0:HH:mm:ss} carving {1} ({2:N1} GiB)" -f (Get-Date), $rel, ($f.Length / 1GB))
python -I $tool $f.FullName $dest | Select-Object -Last 1
}
$s = (Get-Content (Join-Path $dest "index.json") -Raw | ConvertFrom-Json).summary
$rows += [pscustomobject]@{ archive = $rel; files = $s.files; bink2 = $s.bink2_files; span = $s.span
readable = [math]::Round(($s.compressed_bytes) / $s.span, 4)
unread = [math]::Round($s.unread_bytes / $s.span, 4); inflated = $s.inflated_bytes }
}
$rows | ConvertTo-Json | Set-Content -Encoding utf8 (Join-Path $Out "coverage.json")
$rows | Format-Table archive, files, bink2, @{n = "GiB"; e = { [math]::Round($_.span / 1GB, 2) } }, readable, unread -AutoSize | Out-String -Width 200