Skip to content

cite_labels ​

Tool tools/triage/cite_labels.py (program, Triage). Make function labels from a reimplementation's citations: every item whose comment says "Original: FUN_xxxx" names that original function.

Run it with ./gameframe run cite_labels ARGS or python3 tools/triage/cite_labels.py. Source on GitHub.

Its own help ​

This is the help text in the tool itself, as ./gameframe tool cite_labels prints it.

text
Make function labels from a reimplementation's citations: every item whose comment says
"Original: FUN_xxxx" names that original function.

Usage: cite_labels.py SOURCE_DIR [--existing names.tsv] [--no-lines] [--out FILE] [--check FILE]

GameFrame's rule is that every ported item names the original function it came from, in a
comment such as `/// Original: FUN_1400be770` (or `// Original: 1400be770`). The port then knows
far more names than labels/names.tsv, and the decompiled code that the next session reads still
says FUN_1400be770. This tool reads the citations and writes a labels file: each cited address
gets the name of the item declared after the comment, a function, a method (Type::method), a
struct, an enum or a class, in Rust, C, C++, Python, JavaScript or TypeScript.

- When one item cites several functions, the first gets the item's name and the others get the
  name with _2, _3 and so on after it.
- A citation that is not followed by an item (a module's comment, a note in a body) is counted and
  left out.
- --existing names.tsv: addresses already labelled there by hand are left out, so a person's label
  always wins.
- --out FILE writes the labels (address, label, evidence as file:line); without it they are printed.
- --no-lines gives the evidence as the file alone. A committed labels file then changes only when
  a citation or an item's name changes, not with every edit above it.
- --check FILE exits 1 if FILE differs from what the tool would write, for a test that keeps the
  generated labels current.

Point decomp_query.py at the result with --labels, or keep it beside labels/names.tsv. Standard
library only.

Named by ​

Skills: re-land.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.