Files
Sylpheed/docs/re
Sylpheed RE agent 5d44b52b07 re: progress word B - search space closed at 21 functions, the field itself still unwritten
Section 5.3 left word B (+1956) with no known writer. Three routes ran this turn:
one produced a population, two were refuted, and the field is still unwritten.

The offset route has power here, unlike +184. +1956 is a large unusual offset with
9 stores and 28 loads image-wide, against +80's 5403 and 6923. Control: the known
reader 0x821898C4 sits in the gate's list-builder 0x82189870, exactly where 5.1
puts it. But none of the 9 stores turns out to be a progress write - filtering by
whether the storing function reaches the progress object gives 0 of 8 distinct
functions, and the 9th stores through r1, the stack pointer, so it is a local.
+1956 is simply an offset several unrelated structures also use.

The obvious filter is dead, and it fails its own control. Testing "does the
function reference the singleton global 0x828F48B0 or call 0x821707C0" against the
KNOWN word-A writer returns no contact, because that path reaches the progress
object through the copier and never through the global. A filter that rejects the
known-good answer proves nothing about the others.

What did work: progress is only ever changed copy-modify-store, so every writer
must call both the copier 0x82175110 and the setter 0x8216FF70. Measured, 21
functions call the setter, 21 call the copier, and 21 call both - the two caller
sets are the same set. That is the complete progress-write population and it is
small enough to read exhaustively. Control: the word-A writer is among them as
0x821C1630 (BASE_INFO + DIFFICULTY), and 5.2's store 0x821C1820 lies inside it -
the doc's 0x821C09D8-0x821C29F0 is the enclosing method, 0x821C1630 the function.

No member of the 21 stores to +1956 directly. Their only large store offsets are
into this - 1004, 1980, 2040, 2100, 2199, 2436 - with 1004 being 5.2's own
this+1004 & 0x20000 guard. So word B is written through the stack copy, at
localbase + 1876, which no offset scan can pick out.

One false friend worth recording: two of the 21 reference Points, which looks
exactly like the challenge record-storing path 5.3 predicts. It is not - their full
string sets are Dependency, MissionObjective, Points, WEAPON, WEAPONS, i.e. the
arsenal development economy, and neither references Time. There are two Points
vocabularies, development points and the leaderboard metric.

Next candidate, not yet checked: 0x8218EFE0 is the one progress writer whose
strings are BASE_EXTRA and DIFFICULTY - the only member of the 21 carrying the
EXTRA vocabulary.

All seventeen artefacts byte-identical.
2026-08-28 12:33:32 +00:00
..

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 to xenia-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.

The status markers

The table above is the confidence scale. The markers that appear in BACKLOG.md and the structures/ pages are a separate, and until now undefined, vocabulary. They mean:

Marker Meaning
Confirmed — verified against ground truth.
🟡 Partial: true as far as it goes, or true under a stated assumption.
Open question. Nobody has answered it yet.
🔴 Refuted — shown false — or blocked by something the container cannot do.
A specific claim that was tried and failed. Prefer 🔴.
🚧 Work started and not finished.

🔴 never means "we have not run it yet." That is or 🚧. Reserve 🔴's "blocked" sense for a real limit of the box — no push credentials, no hardware Vulkan (lavapipe only), or a decision only the user can make. The box can run the emulator, script input, screenshot, read guest memory, and build and test Rust, so "needs a run" is never a blocker. This paragraph exists because the marker was undefined for 98 uses and three of them were mislabelled that way.

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 HYPOTHESIS to at least PROBABLE — 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 pathsdocs/re/functions/<name>.md (one file per function or tight cluster).
  • Data structures / formatsdocs/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 with xenia-rs/zq.pyzq.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-rs with 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; our xenia-rs never got past the intro video. Use canary to observe output (capture its framebuffer for texture colours), not usually to instrument code — though its build-cross toolchain 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.