Skip to content

About

Biohazard 4 tools and libraries

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

HydraHazard Project

HydraHazard is a high-performance C library and a suite of command-line tools designed for parsing, extracting, and repacking Resident Evil 4 UHD asset formats. It provides bit-perfect parity with original game tools while offering a simple and modern interface.

Legal Notice: This software is intended for modding and research purposes only. The user is responsible for any consequences arising from the use of this software. Resident Evil 4 UHD is property of Capcom, all rights reserved.

Features

  • LZX Decompression - High-fidelity streaming LZX implementation with 100% bit-exact parity with Xbox 360 XCompress64.dll.
  • LFS Container Support - Seamless extraction and handling of .lfs compressed archives.
  • YZ2 Compression - Full support for the Jaderlink/YZ2 algorithm used for textures and sub-archives in the UHD Edition.
  • PACK Archive Management - Robust extraction and repacking of .pack and .pack.yz2 containers, including support for nested archives.
  • UDAS/DAS Support - Extraction of room and character archives with smart format detection.
  • Transparent LFS Handling - Automatic on-the-fly decompression when opening archives via the library.

Components

Library (libhydrahazardfmt/)

The core library is written in portable C (C99) and provides high-level abstractions for asset loading:

  • pack_open_file / udas_open_file: Smart loaders that handle .lfs decompression and fallback automatically.
  • lfs_extract_full_file: Low-level standalone LFS extraction.
  • yz2_mem_inflate / deflate: Memory-to-memory YZ2 processing.

CLI Tools (tools/)

  • lfsx: LFS container extractor and diagnostic tool.
  • yz2cli: YZ2 compression/decompression utility.
  • packcli: Recursive PACK archive manager (Extraction & Repacking).
  • udascli: UDAS/DAS extraction utility.

Building

The project supports multiple build systems for maximum portability.

Using Make (Standard)

  1. Run make
  2. Binaries will be located in the out/ directory.

Using CMake

  1. Run cmake -S . -B build
  2. Run cmake --build build
  3. Binaries will be located in the build/tools/ directory.

Using Meson

  1. Run meson setup build
  2. Run meson compile -C build
  3. Binaries will be located in the build/tools/ directory.

Usage

HydraHazard tools are designed to be intuitive and follow standard CLI conventions.

General Syntax

toolname [options] <input_file>

The tool will autodetect if the file should be extracted or repacked based on the extension and file type.

Common Options

  • -x, -d: Explicitly set Extract / Decompress mode.
  • -c: Explicitly set Repack / Compress mode.
  • -o <path>: Specify the output destination.
    • If <path> is a non-existing path, it will be created as the output file or directory.
    • If <path> is an existing directory, the results will be placed inside it.
    • If <path> is -, output is redirected to STDOUT (supported by lfsx and yz2cli).
  • -v: Enable verbose output.
  • -V: Show version information.
  • -h: Show help/usage guide.

Examples

  1. Extracting a pack file (Auto-detect):

    packcli 01000000.pack.yz2
  2. Extracting to a specific path:

    packcli -o my_assets 01000000.pack.yz2
  3. Repacking a directory into a pack file:

    packcli -c my_assets
  4. Piping decompressed LFS data directly:

    lfsx -o - room.udas.lfs | head -c 16 | xxd

License

This is a personal project provided as-is. See LICENSE for details. Resident Evil 4 UHD is property of Capcom, all rights reserved. This project is not affiliated with or endorsed by Capcom. Enjoy! :D

About

Biohazard 4 tools and libraries

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages