# Building xdvdfs-tools - Quick Start ## What is xdvdfs-tools? **xdvdfs-tools** is a modern Rust-based tool for working with Xbox 360 ISO images. It can: - List Xbox 360 ISO contents - Extract (unpack) Xbox 360 ISOs - Create (pack) Xbox 360 ISOs - Compress ISOs (CSO format) - Compute checksums - Mount as FUSE filesystem (xdvdfsd) **Why needed:** Xbox 360 uses XGD (Xbox Game Disc) format with XDVDFS filesystem! --- ## Quick Build ```bash cd /data/emu/rom-farmer/tools/xdvdfs-tools # Step 1: Download source (first time only) ./clone.sh # Step 2: Update Rust (required!) rustup update stable # Step 3: Build xdvdfs-tools # Make sure to use updated Rust toolchain export PATH="$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH" ./build.sh # Step 4: Use it! ../bin/xdvdfs --help ``` Build time: ~30 seconds (first build compiles dependencies) --- ## What clone.sh Does 1. **Clones xdvdfs repository** from https://github.com/antangelo/xdvdfs - Active development (latest: Sept 2025) - Shows available release tags 2. **Records version info** in `VERSION.txt` - Git commit hash - Release tag (if on a release) - Build date --- ## What build.sh Does 1. **Checks dependencies** - Verifies Rust/Cargo installed - Requires Rust 1.80+ (uses lockfile v4) 2. **Builds with Cargo** (Rust build system) - Release build with optimizations - First build: ~30s (downloads & compiles dependencies) - Subsequent builds: ~5-10s 3. **Installs binaries** - Copies to `tools/xdvdfs-tools/build/` - Creates symlinks in `tools/bin/` - Records build info in `BUILD_INFO.txt` 4. **Two binaries created:** - `xdvdfs` - Main CLI tool (~4.1MB) - `xdvdfsd` - FUSE daemon for mounting (~3.8MB) --- ## Usage Examples ### List Xbox 360 ISO contents ```bash # Simple list xdvdfs ls game.iso # Recursive tree view xdvdfs tree game.iso # Show MD5 checksums xdvdfs md5 game.iso # Show ISO metadata xdvdfs info game.iso ``` ### Extract Xbox 360 ISO ```bash # Unpack entire ISO to directory xdvdfs unpack game.iso output_dir/ # Copy specific file/directory out xdvdfs copy-out game.iso /path/in/iso output_file ``` ### Create Xbox 360 ISO ```bash # Pack directory into ISO xdvdfs pack input_dir/ game.iso # Pack and compress (CSO format) xdvdfs compress input_dir/ game.cso # Pack from source ISO (rewrite) xdvdfs pack source.iso output.iso ``` ### Mount as filesystem (advanced) ```bash # Mount ISO using FUSE xdvdfsd game.iso /mnt/xbox360/ # Unmount fusermount -u /mnt/xbox360/ ``` ### Compute checksums ```bash # Deterministic checksum of ISO contents xdvdfs checksum game.iso # Useful for verifying identical content across different ISOs ``` --- ## Integration with rom-farmer The transformation recorder will detect and record your xdvdfs version: ```python # Automatically recorded in database transformation = ROMTransformation( source_file="Halo 3 (USA).iso", source_md5="ORIGINAL_ISO_HASH", final_file="Halo 3 (USA).cso", # Compressed final_md5="CSO_HASH", # Different from original! tool="xdvdfs", tool_version="0.9.0 (5afdda1)", # Detected automatically tool_path="/data/emu/rom-farmer/tools/bin/xdvdfs", # ... ) ``` --- ## Why Different Versions Matter ### XGD Format Evolution Xbox 360 used different disc formats over its lifetime: - **XGD1** - Original format (2005-2007) - **XGD2** - Updated format (2007-2011) - **XGD3** - Final format (2011-2016) with larger capacity Different xdvdfs versions may handle these differently! ### Compression Differences Different tool versions may use different compression: - Compression ratio variations - CSO format versions - Header handling **Result:** Same input ISO → Different output CSO hashes! ### Solution Track the version used: 1. **For scraping:** Use multi-tier strategy (CSO → ISO → filename) 2. **For consistency:** Stick with one version for all your conversions 3. **For sharing:** Document which version you used --- ## Xbox 360 ROM Processing Workflow ### Phase 1: Import Xbox 360 ISOs ```bash # Your collection (standard ISOs) ls xbox360/ Halo 3.iso Gears of War.iso Red Dead Redemption.iso ... ``` ### Phase 2: Optional Compression ```python # With transformation tracking from romfarmer.metadata import TransformationRecorder recorder = TransformationRecorder(db_session) with recorder.record_transformation( source_file="Halo 3.iso", system="xbox360", tool="xdvdfs", version="0.9.0" ) as transform: # Compress to CSO run_command(["xdvdfs", "compress", "Halo 3.iso", "Halo 3.cso"]) transform.set_final_file("Halo 3.cso") # Database now has: # source_md5: ORIGINAL_ISO_HASH # final_md5: CSO_HASH ``` ### Phase 3: Scrape Metadata ```python # Look up transformation transformation = recorder.find_source_hash(cso_file) # Get original ISO hash iso_md5 = transformation.source_md5 # Query ScreenScraper with original ISO hash game = screenscraper.search_game( system_id=XBOX360_SYSTEM_ID, md5=iso_md5 # Use original ISO hash, not CSO! ) ``` --- ## ScreenScraper Strategy for Xbox 360 **Problem:** ScreenScraper may not know your CSO hash **Solution:** Use original ISO hash via transformation tracking ``` Your CSO → Transformation DB → Original ISO hash → ScreenScraper → Metadata ✅ ``` This is why transformation tracking is essential! --- ## Xbox 360 vs Original Xbox **CRITICAL:** These are different consoles with different formats! | Feature | Original Xbox | Xbox 360 | |---------|--------------|----------| | **Format** | XISO (custom) | ISO + XGD | | **Filesystem** | FATX-like | XDVDFS | | **Executable** | default.xbe | default.xex | | **Tool** | extract-xiso | xdvdfs-tools | | **Compression** | N/A | CSO support | See `tools/XBOX_PLATFORMS.md` for detailed comparison. --- ## Dependencies ### Rust Toolchain (Required!) **Minimum:** Rust 1.80+ (for lockfile v4 support) ```bash # Install Rust (if not installed) curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Update Rust (if too old) rustup update stable # Verify version rustc --version # Should show 1.80+ cargo --version ``` ### Ubuntu/Debian ```bash # If Rust installed via apt (usually outdated) sudo apt-get remove cargo rustc # Then install via rustup (above) # Or update system Rust (may not be new enough) sudo apt-get update && sudo apt-get upgrade ``` ### Build Tools ```bash # Usually already installed if you built extract-xiso sudo apt-get install build-essential ``` ### FUSE (Optional, for xdvdfsd mounting) ```bash sudo apt-get install fuse3 libfuse3-dev ``` --- ## Troubleshooting ### "lock file version 4 requires -Znext-lockfile-bump" Your Rust version is too old (< 1.80). ```bash # Update Rust rustup update stable # Make sure you're using the updated version export PATH="$HOME/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:$PATH" # Verify rustc --version # Should show 1.80+ # Try building again ./build.sh ``` ### "cargo: command not found" Rust not installed. ```bash # Install Rust curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Source environment source ~/.cargo/env # Try building again ./build.sh ``` ### Build succeeds but binaries don't work ```bash # Check file type file tools/xdvdfs-tools/build/xdvdfs # Should show: ELF 64-bit LSB executable ``` ### "Permission denied" when running ```bash chmod +x tools/bin/xdvdfs chmod +x tools/bin/xdvdfsd ``` ### Slow first build This is normal! Rust compiles all dependencies from source: - First build: ~30 seconds (downloads + compiles ~117 crates) - Subsequent builds: ~5-10 seconds (only recompiles changed code) --- ## Advanced Usage ### Work with specific files ```bash # List specific directory xdvdfs ls game.iso /path/in/iso/ # Copy single file xdvdfs copy-out game.iso /default.xex output.xex # Show file checksums xdvdfs md5 game.iso ``` ### Image specifications ```bash # Create xdvdfs.toml spec xdvdfs image-spec create spec.toml # Edit spec.toml to customize ISO layout # Build from spec xdvdfs build-image spec.toml output.iso ``` ### Compression options ```bash # Compress with xdvdfs xdvdfs compress input_dir/ game.cso # This creates CSO (Compressed ISO) format # Smaller file size, compatible with emulators # Transformation tracking records compression ``` --- ## Performance Tips ### Extraction ```bash # Unpack is fast (no decompression needed) xdvdfs unpack game.iso output/ # For Xbox 360, ISOs are standard format # Extraction is straightforward ``` ### Packing ```bash # Pack is moderate speed xdvdfs pack input/ game.iso # Compress is slower (compression overhead) xdvdfs compress input/ game.cso # Trade-off: CSO is smaller but takes longer ``` ### FUSE Mounting ```bash # Mount for read-only access (fast) xdvdfsd game.iso /mnt/xbox360/ # Good for browsing without extracting # No temporary files created ``` --- ## Comparison with Other Tools ### xdvdfs-tools (what we built) **Pros:** - ✅ Open source (MIT license) - ✅ Cross-platform (Rust) - ✅ Active development - ✅ Fast and modern - ✅ Handles all XGD formats - ✅ FUSE mounting support - ✅ CSO compression **Cons:** - ⚠️ Requires Rust toolchain - ⚠️ Newer tool (less mature than XBC) ### Xbox Backup Creator (XBC) **Pros:** - ✅ Most popular - ✅ Well-tested - ✅ GUI interface **Cons:** - ❌ Windows only - ❌ Not open source - ❌ Harder to automate - ❌ Would need Wine on Linux ### extract-xiso-360 **Pros:** - ✅ Similar name to original Xbox tool **Cons:** - ❌ Less actively maintained - ❌ Harder to find - ❌ Less feature-complete **Winner:** xdvdfs-tools for Linux automation! --- ## See Also - `tools/XBOX_PLATFORMS.md` - Xbox vs Xbox 360 comparison - `tools/extract-xiso/README.md` - Original Xbox tool - `tools/README.md` - Tools infrastructure overview - `docs/MULTI_TIER_STRATEGY.md` - Transformation tracking strategy - https://github.com/antangelo/xdvdfs - Upstream project --- ## Fun Fact The Xbox 360's XDVDFS (Xbox DVD Filesystem) is quite different from the original Xbox's XISO format: **XDVDFS features:** - Based on standard ISO 9660 with Xbox modifications - Supports 3 disc formats: XGD1, XGD2, XGD3 - XGD3 uses the full DVD capacity (8.5GB dual-layer) - Anti-piracy sectors built into disc structure - Video partition for DVD movie playback - Game partition with XDVDFS data **Why it matters:** - XGD2→XGD3 transition added 1GB more space - Anti-piracy sectors mean exact ISO preservation is important - Some games use video partition for cutscenes - Different regions may have different disc formats That's why tools like xdvdfs-tools need to understand all these nuances. Transformation tracking helps you know exactly which format your ISOs are in and how they were processed! --- ## Quick Reference ```bash # List ISO contents xdvdfs ls game.iso # Extract entire ISO xdvdfs unpack game.iso output/ # Create ISO from directory xdvdfs pack input/ game.iso # Create compressed CSO xdvdfs compress input/ game.cso # Show ISO info xdvdfs info game.iso # Compute checksum xdvdfs checksum game.iso # Mount as filesystem xdvdfsd game.iso /mnt/point/ # Get help xdvdfs --help xdvdfs --help ``` --- ## Build Version Information **Current Build:** - Version: 0.9.0 - Commit: 5afdda1 - Date: 2025-09-25 - Rust: 1.90.0 - Build time: 29 seconds - Binaries: 2 (xdvdfs, xdvdfsd) - Total size: ~8MB