diff --git a/CODING_RULES.md b/CODING_RULES.md index a34e6002..460ea6b4 100644 --- a/CODING_RULES.md +++ b/CODING_RULES.md @@ -27,9 +27,21 @@ void Player::Update(float dt) { } ``` -- `// OFFSET: 0x...` is mandatory on every standalone `// FUNCTION:` definition: one line per stacked ID, placed above - the `FUNCTION` lines, with the address `td symbol ` reports (eight uppercase hex digits). Never type an address - from memory or a decompiler listing that disagrees with the symbol database. +- `// OFFSET: 0x...` is mandatory on every standalone `// FUNCTION:` line, on the line directly above it, with the + address `td symbol ` reports (eight uppercase hex digits). Never type an address from memory or a decompiler + listing that disagrees with the symbol database. An `OFFSET` line always has its `FUNCTION` line right below it, + and no blank line separates the annotations from the definition. The submission gate checks this. +- Several IDs stack on one definition only for template instances: each `FUNCTION` line keeps its own `OFFSET` + line above it. Two non-template functions with identical bytes are two source functions; one often only calls + the other, which the compiler inlined. + + ```cpp + // OFFSET: 0x009C2A50 + // FUNCTION: fn_13995 + // OFFSET: 0x009C2B20 + // FUNCTION: fn_13996 + template void CUIListBoxEx::Slot15(int width, int height) { + ``` - `FUNCTION`/`GLOBAL`/`STRING`/`VTABLE` annotations contain IDs, never addresses; the symbol database stays authoritative. Preserve existing `// STATIC: 0x...` provenance for data. Inline-only functions must not carry `OFFSET` provenance. diff --git a/data/decomp.json b/data/decomp.json index a06414c4..4f79d19c 100644 --- a/data/decomp.json +++ b/data/decomp.json @@ -12,6 +12,7 @@ ], "toolchain": "ragnarok", "globalRules": true, + "offsetAnnotations": true, "encodedLiterals": [ { "macro": "CRYPT_NAME", "kind": "xor-repeating-key", "keyBytes": 8, "includeTerminator": true } ],