XML data layer: pugixml (external/pugixml, v1.15), a format-neutral DataNode API for every loader, DataFormat=auto|json|xml (default xml), KAGE's archive file system ported (index once, four unpackers, the original's mount order) so --resources can point at an install's resources/ with no import step, the original XML .anm2 loader beside Anm2Ed JSON, mods' own XML; 72 goldens identical from converted resources and from the install

This commit is contained in:
shweet committed 2026-11-24 05:57:54 -05:00
1 parent 74322af121
commit 6d8a43775d
52 files changed
+1513 -909

No files matched your search

+23 -5
View File
@@ -30,7 +30,7 @@ scripts/ decompile.sh (print decompiled C for a function, by name regex or
fields), build.sh (rebuild everything from the exe after a game update), and the Ghidra Java scripts
and Python helpers they use
tools/ gitignored local tools: the resource importer and the test harness (tools/harness/)
external/ static submodules: SDL3, Lua 5.3, simdjson, Ogg, Vorbis, Theora, stb, Dear ImGui (docking)
external/ static submodules: SDL3, Lua 5.3, pugixml, simdjson, Ogg, Vorbis, Theora, stb, Dear ImGui (docking)
assets/ files the repository ships itself: the overlay's fonts (git-lfs), with their licences, and REPENTOGON's Lua
scripts (assets/repentogon/, GPL-2), adapted where they reach API not ported yet
repentogon/ shallow clone of TeamREPENTOGON/REPENTOGON (libzhl/functions/*.zhl = sigs, structs, enums)
@@ -42,9 +42,25 @@ jdk/ ghidra_12.2_PUBLIC/ Temurin 21 (system java is 8, too old) and Ghidra
The goal is a C++ source tree that builds a native 64-bit Linux game: `git submodule update --init --recursive`, then
`cmake -B build && cmake --build build`. SDL3 (window, OpenGL context, input, audio) and Lua 5.3 (mods) are submodules
in `external/`, built statically, with simdjson for data and Xiph's Ogg, Vorbis and Theora (decoders only) for the cutscene videos. Online features (Steam, EOS, curl) are offline stubs. The game
reads JSON, not XML: an import tool in `tools/` converts the player's own install (XML, packed archives) and mods into
`resources/` (both gitignored). Nothing from the game ships here.
in `external/`, built statically, with pugixml and simdjson for data and Xiph's Ogg, Vorbis and Theora (decoders only)
for the cutscene videos. Online features (Steam, EOS, curl) are offline stubs. Nothing from the game ships here.
The game reads the player's own install as it is: `--resources <install>/resources` mounts its packed archives
(`src/engine/filesys.cpp`, a port of KAGE's file system: each archive indexed once at start-up, its files unpacked on
demand) in the original's order (loose files, then animations, config, fonts, graphics, music, rooms, sfx, videos,
afterbirth, afterbirthp, the repentance_<language> archives and secret.a, a later archive overriding an earlier one),
with the language's mount (`resources.<code>`) searched first and mods in the install's `mods/`. Every resource
(documents, anm2, images, sounds, music, videos, shaders, fonts, rooms, string tables, the game's Lua scripts) is read
through that one file system, and nothing is ever written into the install. XML documents and `.anm2` files are read
as the original's XML, and mods' own XML loads as it ships. The import tool in `tools/` (gitignored) still converts an
install into `resources/` (XML to JSON, anm2 to Anm2Ed's JSON), which the game reads just the same: loaders see one
node API (`src/engine/data.h`) over pugixml's tree or simdjson's, with identical elements, attribute strings and text.
An `.anm2` is told apart by its first character.
When both a document's XML (`items.xml`) and its JSON (`items.xml.json`) are mounted, options.ini's `DataFormat`
(the overlay's Game Options, System tab) picks one: `xml` (the default) reads the XML wherever it is mounted, `json`
the JSON, and `auto` whichever the first mount holding either has, XML first there. A missing one falls back to the
other. The string tables load before options.ini, so they always prefer the XML.
`generated-src/` is the whole decompiled game as C++, regenerated every build and never edited. `src/` is the readable
game, written by hand on top of it one function at a time:
@@ -67,7 +83,8 @@ Regenerate `generated-src/` after adding or moving a function in `src/`:
```
engine/ platform (SDL3 window, frame pacing, clock), gl, kage_* (graphics, input, sound), anm2, textures,
fonts, video, renderers, data loading, log, seeds and RNG, the test harness
fonts, video, renderers, the file system (packed archives) and data loading, log, seeds and RNG, the
test harness
game/ main, Manager, game_* (game/state, game/save, game/update ...), options, strings, save data, mods,
sound and music managers, dailies, local versus
level/ level_* (level/generator, level/stage ...), room*, backdrop, minimap, path finder, rails,
@@ -111,6 +128,7 @@ and field where two traces differ; `tools/harness/bot/` is a Lua mod that plays
`tools/harness/goldens/check.sh` replays about 70 recorded runs (every character, the main and alternate floors,
every final boss, Greed and Greedier, challenges, typed seeds, saving and continuing) on three saves (nothing unlocked
in Hard, everything unlocked in Normal and in Hard) and names each trace that changed; `--record` re-records them.
`RESOURCES=<install>/resources` replays them on the install itself instead of `resources/`.
Traces follow the compiler's float code, so check with a clang build, as the goldens were recorded.
## Quick use