Add Windows build scripts, fix multi-threaded MPQ extraction, and cross-platform temp paths

- 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
This commit is contained in:
Kelsidavis 2026-02-25 08:18:26 -08:00
parent 570dec8b88
commit 1fab17e639
9 changed files with 300 additions and 68 deletions

View file

@ -8,23 +8,32 @@ H=${2:-1024}
echo "Converting debug textures (${W}x${H})..."
for raw in /tmp/wowee_composite_debug.raw /tmp/wowee_equip_composite_debug.raw; do
if [ -f "$raw" ]; then
png="${raw%.raw}.png"
# Try ImageMagick first, fall back to ffmpeg
if command -v convert &>/dev/null; then
convert -size ${W}x${H} -depth 8 rgba:"$raw" "$png" 2>/dev/null && \
echo "Created $png (${W}x${H})" || \
echo "Failed to convert $raw"
elif command -v ffmpeg &>/dev/null; then
ffmpeg -y -f rawvideo -pix_fmt rgba -s ${W}x${H} -i "$raw" "$png" 2>/dev/null && \
echo "Created $png (${W}x${H})" || \
echo "Failed to convert $raw"
else
echo "Need 'convert' (ImageMagick) or 'ffmpeg' to convert $raw"
echo " Install: sudo apt install imagemagick"
fi
TMPD="${TMPDIR:-/tmp}"
# Find raw dumps — filenames include dimensions (e.g. wowee_composite_debug_1024x1024.raw)
shopt -s nullglob
RAW_FILES=("$TMPD"/wowee_*_debug*.raw)
shopt -u nullglob
if [ ${#RAW_FILES[@]} -eq 0 ]; then
echo "No debug dumps found in $TMPD"
echo " (looked for $TMPD/wowee_*_debug*.raw)"
exit 0
fi
for raw in "${RAW_FILES[@]}"; do
png="${raw%.raw}.png"
# Try ImageMagick first, fall back to ffmpeg
if command -v convert &>/dev/null; then
convert -size ${W}x${H} -depth 8 rgba:"$raw" "$png" 2>/dev/null && \
echo "Created $png (${W}x${H})" || \
echo "Failed to convert $raw"
elif command -v ffmpeg &>/dev/null; then
ffmpeg -y -f rawvideo -pix_fmt rgba -s ${W}x${H} -i "$raw" "$png" 2>/dev/null && \
echo "Created $png (${W}x${H})" || \
echo "Failed to convert $raw"
else
echo "Not found: $raw"
echo "Need 'convert' (ImageMagick) or 'ffmpeg' to convert $raw"
echo " Install: sudo apt install imagemagick"
fi
done