mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 15:20:15 +00:00
- Add build.ps1/bat, rebuild.ps1/bat, debug_texture.ps1/bat (Windows equivalents of existing bash scripts, using directory junctions for Data link) - Fix asset extractor: StormLib is not thread-safe even with separate handles per thread. Serialize all MPQ reads behind a mutex while keeping CRC computation and disk writes parallel. Previously caused 99.8% extraction failures with >1 thread. - Add SFileHasFile() check during enumeration to skip listfile-only entries - Add diagnostic logging for extraction failures (first 5 per thread + summary) - Use std::filesystem::temp_directory_path() instead of hardcoded /tmp/ in character_renderer.cpp debug dumps - Update debug_texture.sh to use $TMPDIR fallback and glob for actual dump filenames
64 lines
2.1 KiB
PowerShell
64 lines
2.1 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Converts raw RGBA texture dumps to PNG for visual inspection (Windows equivalent of debug_texture.sh).
|
|
|
|
.PARAMETER Width
|
|
Texture width in pixels. Defaults to 1024.
|
|
|
|
.PARAMETER Height
|
|
Texture height in pixels. Defaults to 1024.
|
|
|
|
.EXAMPLE
|
|
.\debug_texture.ps1
|
|
.\debug_texture.ps1 -Width 2048 -Height 2048
|
|
#>
|
|
|
|
param(
|
|
[int]$Width = 1024,
|
|
[int]$Height = 1024
|
|
)
|
|
|
|
$TempDir = $env:TEMP
|
|
|
|
Write-Host "Converting debug textures (${Width}x${Height})..."
|
|
|
|
# Find raw dumps — filenames include dimensions (e.g. wowee_composite_debug_1024x1024.raw)
|
|
$rawFiles = Get-ChildItem -Path $TempDir -Filter "wowee_*_debug*.raw" -ErrorAction SilentlyContinue
|
|
|
|
if (-not $rawFiles) {
|
|
Write-Host "No debug dumps found in $TempDir"
|
|
Write-Host " (looked for $TempDir\wowee_*_debug*.raw)"
|
|
exit 0
|
|
}
|
|
|
|
foreach ($rawItem in $rawFiles) {
|
|
$raw = $rawItem.FullName
|
|
$png = $raw -replace '\.raw$', '.png'
|
|
|
|
# Try ImageMagick first, fall back to ffmpeg
|
|
if (Get-Command magick -ErrorAction SilentlyContinue) {
|
|
& magick -size "${Width}x${Height}" -depth 8 "rgba:$raw" "$png" 2>$null
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Created $png (${Width}x${Height})"
|
|
} else {
|
|
Write-Host "Failed to convert $raw"
|
|
}
|
|
} elseif (Get-Command convert -ErrorAction SilentlyContinue) {
|
|
& convert -size "${Width}x${Height}" -depth 8 "rgba:$raw" "$png" 2>$null
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Created $png (${Width}x${Height})"
|
|
} else {
|
|
Write-Host "Failed to convert $raw"
|
|
}
|
|
} elseif (Get-Command ffmpeg -ErrorAction SilentlyContinue) {
|
|
& ffmpeg -y -f rawvideo -pix_fmt rgba -s "${Width}x${Height}" -i "$raw" "$png" 2>$null
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Created $png (${Width}x${Height})"
|
|
} else {
|
|
Write-Host "Failed to convert $raw"
|
|
}
|
|
} else {
|
|
Write-Host "Need 'magick' (ImageMagick) or 'ffmpeg' to convert $raw"
|
|
Write-Host " Install: winget install ImageMagick.ImageMagick"
|
|
}
|
|
}
|