Skip to content

Stub System

asdfmonster261 edited this page May 3, 2026 · 2 revisions

Stub System

Pre-built stubs live in stub/prebuilt/. They are compiled C programs that provide the UI and apply the embedded data at runtime.

Update Patch stubs

File Description
hdiffpatch_x64.exe / _x86.exe HDiffPatch stub (LZMA + LZMA2 only)
hdiffpatch_full_x64.exe / _x86.exe HDiffPatch stub + zlib + bzip2 (needed for any _bzip2 preset)
jojodiff_x64.exe / _x86.exe JojoDiff stub

exe_packager picks BASIC vs FULL automatically based on the chosen compression preset — _bzip2 / _pbzip2 / _zlib / _deflate route to the FULL stub; everything else uses BASIC.

Repack stubs

File Description
installer_x64.exe / _x86.exe XPACK01 installer stub (LZMA2 + Zstandard)
uninstaller_x64.exe / _x86.exe Standalone uninstaller stub

Rebuilding from source

Requires MinGW-w64 cross-compilers.

cd stub
make                # x64 update-patch stubs (hdiffpatch, jojodiff)
make win32          # x86 update-patch stubs
make installer      # installer stubs (x64 + x86)
make uninstaller    # uninstaller stubs (x64 + x86)
make full           # HDiffPatch full stubs (zlib + bzip2); run `make deps` first
make full32         # HDiffPatch full stubs, x86
make deps           # Cross-compile zlib and bzip2 static libs
make clean          # Remove all prebuilt stubs

Full stubs are only needed when using a _bzip2 preset in HDiffPatch. All other presets work with the standard stubs.

Directory structure

patchforge/
├── pyproject.toml
├── engines/linux-x64/           # Linux diff binaries (hdiffz, jdiff, …)
├── src/
│   ├── cli/main.py              # CLI argument parser & commands
│   └── core/
│       ├── project.py           # ProjectSettings dataclass, save/load (.xpm)
│       ├── patch_builder.py     # Patch build orchestration
│       ├── repack_project.py    # RepackSettings dataclass, save/load (.xpr)
│       ├── repack_builder.py    # Repack build orchestration
│       ├── xpack_archive.py     # XPACK01 solid-archive format + MT compression
│       ├── exe_packager.py      # Appends data + metadata to stub
│       ├── pe_icon.py           # PE icon injection
│       ├── verification.py      # CRC32C / MD5 / filesize
│       ├── archive/             # Steam archive mode (see Archive-Mode page)
│       │   ├── appinfo.py
│       │   ├── bbcode.py
│       │   ├── compress.py
│       │   ├── credentials.py
│       │   ├── download.py
│       │   ├── notify.py
│       │   ├── poll.py
│       │   ├── runner.py
│       │   ├── upload.py
│       │   └── crack/
│       │       ├── coldclient.py
│       │       ├── gse.py
│       │       └── unstub/      # vendored SteamStub unpackers
│       └── engines/
│           ├── base.py          # PatchEngine ABC
│           ├── hdiffpatch.py
│           ├── jojodiff.py
│           └── dir_format.py    # PFMD container (JojoDiff dir mode)
│   └── gui/
│       ├── main_window.py       # PySide6 GUI (all three modes)
│       ├── archive_panel.py
│       ├── archive_pages_*.py
│       ├── archive_run_view.py
│       ├── archive_worker.py
│       └── theme.py             # Dark theme QSS
└── stub/
    ├── Makefile
    ├── stub_common.h            # Shared UI, metadata parsing, patch reading
    ├── path_safe.h              # Shared path-traversal validator
    ├── hdiffpatch_stub.c
    ├── jojodiff_stub.c
    ├── installer_stub.c         # XPACK01 installer stub (LZMA2 + Zstandard)
    ├── uninstaller_stub.c       # Standalone uninstaller stub
    ├── prebuilt/                # Pre-compiled stub EXEs
    └── third_party/             # liblzma, zlib, bzip2, zstd headers + static libs

Clone this wiki locally