Two results, one of which kills an operational hope I had been carrying. THE RECORD IS MUCH BIGGER THAN I MEASURED. Reading 0x82175110 to the end: after the two words, the 8-byte pair, the 184-byte memcpy and the 8 words at +200, it copies 816 bytes at +232, 816 more at +1048, a sub-object at +1864 and a final word at +1876. So the record spans +0..~+1880 = singleton +80..+1960, which means word A is record +0 AND WORD B IS RECORD +1876. That retires last commit's "word B has no known writer": there is no separate store because the whole record is copied out, modified and assigned back as a unit (0x8216FF70 -> compare 0x822C3708, assign 0x82170650, then a worker 0x821700A8 -- note 168 decimal, not hex, which I misread first time -- retrying a commit 0x822C33B8 up to five times). IT IS NOT THE SAVEGAME, by two independent checks: - size: every real save on disk is a 276-byte container deflating to 545 bytes; the record is ~1880. It does not fit. - files: after many sessions the content tree holds only game0N/savedata and game0N/__thumbnail.png per slot plus three Headers/*.header. No second data file exists anywhere under the title id. Also negative: the savegame object is *(*(this+4)) + 304, and the singleton's holder address 0x828F48B0 is referenced NOWHERE outside the accessor, so this+4 is a different holder -- the save block is not a window into this record. => Hand-editing a save cannot unlock the challenge missions. The earlier savegame-editing win does not extend here. WHAT WOULD WORK. The singleton is a static object at 0x828F4070 (0x8216F650: addis 0x828F + addi 16496), so the gate words sit at fixed guest addresses with no scanning: word A = 0x828F40C0, word B = 0x828F4814. Canary maps guest RAM into /dev/shm and the project already reads it live, so writing 0xFFFF / 0x3F there while the title sits on a menu should open all six challenge missions without playing the campaign -- the route to the last 42 EX units. Untested; needs a run.
Reverse-engineering knowledge base
This directory is the spec-side of the clean-room: it records what the original Project Sylpheed binary does (behaviour) and how its data is laid out, so that the Rust port can be implemented from these specs without re-deriving anything and without ever copying original code.
It exists to answer one question fast: "do we already know how X works, and how sure are we?"
The one rule that matters
Never document a claim more confidently than the evidence supports, and never paste original code here.
A wrong-but-confident note is worse than no note: someone builds on it and the bug hides for weeks. Every entry therefore carries an explicit confidence and its evidence. This mirrors the project method — measure the oracle, never infer; refute before believing.
Clean-room firewall
- ✅ Allowed: behaviour descriptions, field offsets/types, formulas, state machines,
observed input→output pairs, and references to the original by address
(
sub_821B68C0) or toxenia-rs/sylpheed.db. - ❌ Forbidden here and in
crates/: pasted decompiled C/C++ or verbatim disassembled function bodies presented as the thing to reimplement. Cite the address; describe the behaviour in your own words. Disassembly is a tool for understanding, not a source to copy.
Confidence levels
| Level | Meaning | Bar to reach it |
|---|---|---|
CONFIRMED |
Behaviour verified against ground truth. | ≥2 independent observations or one observation cross-checked against an oracle (canary framebuffer, a known-correct value, a second code path). |
PROBABLE |
Strong single-source inference. | One clean observation, or an unambiguous static read of the disassembly. |
HYPOTHESIS |
Educated guess, not yet tested. | Anything else. Must say what would confirm/refute it. |
Promotion requires new evidence, not re-reading the old evidence. A HYPOTHESIS that
"looks right again" is still a HYPOTHESIS. Only an independent check promotes it.
If evidence later contradicts an entry, demote it and record the contradiction — do
not silently edit the conclusion.
When to document
- Right after a function/structure crosses from
HYPOTHESISto at leastPROBABLE— before moving to the next code path, so the knowledge isn't lost or re-derived. - Whenever confidence changes (up or down) — append to the Evidence log, don't overwrite.
- Not while it's still a pure guess with no evidence — a one-liner in the relevant backlog/plan is enough until there's something to stand on.
What to document
- Functions/code paths →
docs/re/functions/<name>.md(one file per function or tight cluster). - Data structures / formats →
docs/re/structures/<name>.md. - Keep the index in
INDEX.md(one line each: name · confidence · one-line summary).
Use the templates: _TEMPLATE.function.md,
_TEMPLATE.structure.md.
How we find and confirm code paths (the toolchain)
Everything joins on the guest virtual address (PC) — code addresses are fixed by the XEX load, identical across our emulator and canary.
- Static (cheap, try first):
xenia-rs/sylpheed.db(DuckDB: 25 481 functions, xrefs, strings, vtables, imports). Query withxenia-rs/zq.py—zq.py grep <str>,zq.py xref <addr>,zq.py dis <lo> <hi>,zq.py fn <pc>. Entry points are usually a string (zq.py grep MSG_DEMO) or an import (movie/XMA API) xref'd back to the loader. - Dynamic (when static is ambiguous): run
xenia-rswith its probe suite —--pc-probe/--audit-pc-probe-hex(fires at block entry),--mem-watch(mid-block reads/writes of a VA),--lr-trace(call/return chains),--trace-instructions,--dump-addr(read guest memory). These already exist; prefer them over hacking canary. - Oracle (correctness ground truth): canary — the Wine cross-build
xenia-canary/build-cross/bin/Windows/Debug/xenia_canary.exe(the native Linux ELF crashes / does not run — do not use it). This is the only emulator that reaches the in-game menu; ourxenia-rsnever got past the intro video. Use canary to observe output (capture its framebuffer for texture colours), not usually to instrument code — though itsbuild-crosstoolchain does compile, so small C++ probes + rebuild are possible when needed. Run muted, one emulator process at a time, point it at the real ISO (not the symlink).
⚠️ VA-equality caveat: join code by PC (fixed), but never assume a data VA holds the same bytes across emulators — allocators differ. Compare data by content/layout.