This repository contains a small Python CLI toolkit to compare two .gfx files by extracting their AVM1 p-code, normalizing decompiler noise, and surfacing the real script logic differences.
.gfx files are Scaleform GFx assets: compiled Adobe Flash/ActionScript content used to build game UIs (menus, HUD) in Kingdom Come: Deliverance and many other games. .gfx files are .swf files optimised for games.
Python 3.11+.
JPEXS Free Flash Decompiler, in particular the ffdec binary (ffdec-cli.exe on Windows). Tested with version 25. Download it here: https://github.com/jindrapetrik/jpexs-decompiler.
Important
Since this package is not published yet, you will not be able to install it and use it globally on your system. To run this project right now, you need to clone this repository and use uv (package and project manager) to run the commands as documented below.
uv run kcd-gfx diff a/path/to/file1.gfx a/path/to/file2.gfx --ffdec "/the/path/to/ffdec"This script is intended for comparing two .gfx files that are mostly similar, such as a modded file and its vanilla game counterpart. It helps pinpoint the script-level changes introduced by the mod.
--ffdec is only required if the ffdec binary is not in your PATH.
The command proceeds in four steps:
- Extract scripts from both files as p-code text.
- Find different scripts between both files.
- Split those scripts into logical blocks and normalize them.
- Compare normalized blocks and report the most changed blocks (by line count).
Intermediate files will be written to your system’s temporary directory.
uv run kcd-gfx extract a/path/to/file.gfx --ffdec "/the/path/to/ffdec"Currently, extraction output is always written to your system’s temporary directory.
uv run kcd-gfx normalize a/path/to/MyScript.pcode a/path/to/output_dirOne file is written per normalized block at the root of the output directory.