mirror of
https://git.neolegacy.dev/neoStudiosLCE/neoLegacy.git
synced 2026-11-25 18:12:41 +01:00
TU46 Test content, added missing commits by amending commit and cherry-picking to new branch, ready for iggy guis and tu46 bug fixes
28 lines
983 B
PowerShell
28 lines
983 B
PowerShell
param([string]$Bank, [string]$Filter = '', [string]$OutDir = '')
|
|
|
|
$data = [System.IO.File]::ReadAllBytes($Bank)
|
|
$text = [System.Text.Encoding]::GetEncoding(28591).GetString($data)
|
|
$pattern = 'Minecraft/([A-Za-z0-9_/]+)\x00\*(\d+)\*(\d+)\.binka'
|
|
|
|
$seen = @{}
|
|
foreach ($m in [regex]::Matches($text, $pattern)) {
|
|
$name = $m.Groups[1].Value
|
|
if ($Filter -and $name -notlike "*$Filter*") { continue }
|
|
if ($seen.ContainsKey($name)) { continue }
|
|
$seen[$name] = 1
|
|
$size = [int64]$m.Groups[2].Value
|
|
$off = [int64]$m.Groups[3].Value
|
|
if ($off + $size -gt $data.Length) { Write-Warning "$name is outside the bank"; continue }
|
|
|
|
if ($OutDir) {
|
|
$path = Join-Path $OutDir ($name + '.binka')
|
|
New-Item -ItemType Directory -Force (Split-Path $path) | Out-Null
|
|
$buf = New-Object byte[] $size
|
|
[Array]::Copy($data, $off, $buf, 0, $size)
|
|
[System.IO.File]::WriteAllBytes($path, $buf)
|
|
}
|
|
else {
|
|
"$name $size $off"
|
|
}
|
|
}
|