Skip to content

violetvandal/thugkit

Repository files navigation

thugkit

A single static Go binary that applies the THUG2: Violet Vandal Edition mod layer onto a Tony Hawk's Underground 2 (PC) install. It is the engine behind the Revert toolkit — it compiles NeverScript in-process and packs .prx archives with no runtime dependencies (no Python, no external compiler), so it cross-compiles cleanly to Windows, Linux, and Steam Deck.

Status: early. Private while the wider project takes shape; will open up when ready.

What it does

  • prx — read / list / extract / replace files inside THUG2 .prx (PRE) archives, including LZSS (de)compression. Round-trips byte-identically.
  • apply — read a mod set (mods.list + per-mod mod.conf / inject.list) and apply it to an install: compile .ns.qb in-process and inject into the right archive (raw, or LZSS-compressed for the size-capped qb_scripts).
  • tag — turn any image into a custom in-game Create-A-Graphic tag: encode it into a CAGR sprite (.img.xbx), inject into cagpieces.prx, and build a correctly-checksummed .GRF that loads directly. (Native Go port of the reference Python tag importer; the .GRF it builds is byte-identical.)
  • build — produce a whole edition from a clean pristine base + the mod sources: mirror the base, install the no-CD exe, apply the WidescreenFix (the dinput8.dllwinmm.dll rename, via stdlib archive/zip), run apply, install custom tags, copy the HUD-fix .asi, overlay an HQ A/V pack, and optionally bake a default soundtrack (with the qb_scripts boot ceiling enforced). This is the in-process, zero-dep core of the Revert installer's build step — it never shells out, so archive extraction (ISO/MSI/7z) and the optional Python asset steps stay in Revert's bash wrapper.
thugkit prx <roundtrip|list|extract|replace|replacez> ...
thugkit apply <install-dir> [--mods <dir>] [--layer all|binary|source] [--only a,b]
thugkit tag <image> --gamedir <dir> [--name X] [--slot grap_50] [--size 64|128|256] [--scale F] [--out dir] [--install]
thugkit build <dest> --pristine <dir> [--mods dir] [--fast] [--no-cd exe] [--wsfix zip] [--hq-audio dir] [--hudfix asi] [--glyphfix asi] [--tags dir] [--soundtrack-qb f] [--only a,b]

Build

go build -o thugkit ./cmd/thugkit
# cross-compile, zero deps:
GOOS=windows GOARCH=amd64 go build -o thugkit.exe ./cmd/thugkit

Tests

go test ./...                          # hermetic unit tests (no game data needed)
go test ./prx -run x -fuzz FuzzLZSS    # fuzz the LZSS codec

The verify_*.sh / verify_parity.py scripts are integration harnesses that compare against the reference Python/bash pipeline; they expect the surrounding project layout (clean game data + mods/) and are not needed to build or unit-test.

Dependency

The patched NeverScript compiler is vendored as a git submodule at third_party/neverscript (the public fork github.com/violetvandal/NeverScript, pinned to the thug2-runtime-safe-recompiler branch); go.mod replaces github.com/byxor/NeverScript with it. The repo is self-contained — just clone with submodules:

git clone --recursive git@github.com:violetvandal/thugkit.git
# or, after a plain clone:
git submodule update --init --recursive

License

MIT — see LICENSE.

About

thugkit — single-binary Go mod-apply engine for THUG2: Violet Vandal Edition (Revert toolkit)

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors