fhx-toolkit

CLI toolkit for converting FHX's custom binary file formats (item/NPC tables, models, animations, effects, zones, quests) to and from open formats, built on reverse-engineered specs of the original game client.

Active Pure Nim score 65/100 · last commit 2026-11-21 · 1 stars · tests present · no docs generated

Summary

Latest Version Unknown
License Unknown
CI Status Failing
Stars 1
Forks 0
Open Issues 0
Last Commit 2026-11-21
Downloads 0
Last Indexed 2026-11-24 09:10

Installation

nimble install fhx-toolkit
choosenim install fhx-toolkit
git clone https://gitlab.com/fhx-public/fhx-toolkit

OS Compatibility

Platform Linux macOS Windows FreeBSD OpenBSD NetBSD Android iOS WASM Embedded
fhx-toolkit ✓ ✓ ✓ - - - - - - -

README

fhx-toolkit

fhx-toolkit is a single command-line tool that converts the custom file formats of the FHX/Blade engine (Ferentus / Herrcot / Xiones) to and from open, editable formats, and back, byte-identical where the format allows it.

Part of the FHX restoration project. Format specifications live in docs/formats/, one directory per format, each with its 010 Editor template, mapping doc, and any historical helper scripts/projects.

📦 Supported formats

Format What it is Open format Round trip
.bds texture (header + DDS) PNG / DDS / TGA / BMP / JPEG re-compresses (not byte-identical)
.msh 3D mesh + skeleton glTF 2.0 (.glb) byte-identical (extras.fhx)
.cmh collision mesh Wavefront OBJ geometrically equivalent
.kfm skeletal keyframe animation JSON, glTF 2.0 byte-identical
.bmd model catalog JSON; glTF bundle export/import byte-identical (JSON); glTF is view/edit
.fx effects / particles ("EFFECT" v8) JSON byte-identical
.bla effect pattern (particle/sprite motion) JSON byte-identical
.stbl hot-string tables (Emotion/Hotword) JSON byte-identical
.itf UI script text container + token codec
.tbl static game data CSV / SQL / DB container byte-identical; per-table CSV/SQL/DB round trip for most tables (see docs)
.qs quest script XML-ish text / JSON container byte-identical; JSON byte-identical except multi-line values
.bwh world/zone header JSON; glTF terrain export byte-identical (JSON)
.bfwd terrain field directory of editable sidecars byte-identical

Documented but not yet implemented as a codec: .dat, .lng, .cat (all plain text, no codec needed).

Known gaps, unverified claims and design rules: docs/STATUS.md.

🔨 Build

cmake -B build
cmake --build build --config Release

Windows-first (MSVC, C++20); dependencies fetched via CMake FetchContent.

Build with MSVC, not GCC/MinGW. One dependency (DirectXTex) only resolves its directxmath requirement under the MSVC toolchain, where DirectXMath ships with the compiler. If another C++ toolchain is earlier on your PATH (e.g. Strawberry Perl's GCC), CMake auto-selects it and configuration fails with Could not find a package configuration file provided by "directxmath".

The reliable way to force MSVC is to configure from a Visual Studio "x64 Native Tools Command Prompt" (or after running vcvars64.bat). If a non-MSVC compiler is still on PATH there, also pin the compiler explicitly:

set CC=cl
set CXX=cl
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build

Using a Visual Studio generator (e.g. -G "Visual Studio 17 2022") is an alternative, but only if your CMake version is new enough to know your installed Visual Studio.

🚀 Usage

fhx-toolkit <format> <verb> [input] [output] [options]

Inspect any file:

fhx-toolkit info somefile.bds --json

Textures (.bds ↔ PNG):

fhx-toolkit bds decode tex.bds tex.png
fhx-toolkit bds encode tex.png tex.bds --format DXT5
fhx-toolkit bds encode tex.png --format DXT1 --mips 4 --verify

Meshes/skeletons (.msh ↔ glTF), open in Blender, edit, convert back:

fhx-toolkit msh to-gltf body.msh body.glb
fhx-toolkit msh from-gltf body.glb body.msh --verify

Whole models with textures + animations (.bmd ↔ glTF):

fhx-toolkit bmd to-gltf object/Character.bmd --model alligator --root /path/to/client/root
fhx-toolkit bmd from-gltf alligator.glb --root . --bmd object/Character.bmd --name alligator --force

UI scripts and quests:

fhx-toolkit itf decode login.itf
fhx-toolkit qs to-json qsf00_0.qs

Static game data (.tbl <-> CSV / SQL / DB):

fhx-toolkit tbl to-csv skill skill.tbl skill.csv
fhx-toolkit tbl from-csv skill skill.csv skill.tbl
fhx-toolkit tbl to-sql skill skill.tbl skill.sql
fhx-toolkit tbl from-db skill skill.tbl --lang en --db-host 127.0.0.1 --db-user root --db-pass root --db-name fhx_immutable_v4

Full command reference: docs/cli.md.

✅ Tests

ctest --test-dir build -C Release -jN   # use available cores (e.g. nproc / Environment.ProcessorCount); -C Release matters a lot for the JSON-heavy sweeps

Unit tests use synthetic fixtures only, no game assets in this repo. The real-file round-trip sweep ([realfiles] tag) reads the shipped client data from a checkout of the public fhx-client repo: default path ../fhx-client/base-client/root, override with FHX_CLIENT_ROOT; skipped when the path doesn't exist.