From fa09e99ba9cd2df09f4b81d09c94efd29b029c2e Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Wed, 4 Nov 2026 22:30:27 +0100 Subject: [PATCH] Enable the OFFSET annotation gate; document one OFFSET per FUNCTION line Main is clean (07897c8b): every FUNCTION line has its address right above it. offsetAnnotations makes the submission gate keep it that way. CODING_RULES section 2: OFFSET goes on the line directly above each FUNCTION line, never without one, with no blank line in the block; several IDs on one body only for template instances. --- CODING_RULES.md | 18 +++++++++++++++--- data/decomp.json | 1 + 2 files changed, 16 insertions(+), 3 deletions(-) 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 } ],