FFXiMain.dll / FFXi.dll build 2026-09-03: R1 function discovery for static recompilation
=====================================================================================

Retail files  a private-server install's FINAL FANTASY XI folder
  FFXiMain.dll  SHA-256 f2245d1c9d06e02c36624942483913f5120c0d40777fc1bb8703c6f4bda823e4
                PE timestamp 0x6a995428 (2026-09-03); unpacked .text 0x10001000-0x103285ee,
                real entry 0x1031672f
  FFXi.dll      SHA-256 9053d4106160a073a215dcd1d9045c804a27f459c6cb7cacec74eaefaf827bc7
                PE timestamp 0x6a995417
Metadata      FFXiMain.2026-09-03.meta.json, FFXi.2026-09-03.meta.json (ffxi-recomp-meta/1)
Label         the date of the PE timestamp (2026-08-22 predates that convention)

What changed from 2026-08-22
----------------------------
FFXi.dll: .text and .reloc byte-identical; .rdata/.data/.rsrc differ in 27 bytes. Its metadata
is the old one plus one function at 0x10001000 (the first 106 bytes of .text, listed as
unreferenced code in FFXi.2026-08-22.discovery.txt), which this run's Discover pass created.

FFXiMain.dll: a real game update. .text is 0x40 bytes shorter; code moves by 0 at the bottom
(0x100035cb, the Present call site, is unchanged) and by -0x10 / -0x40 higher up; struct offsets
change too (e.g. `mov [edi+0xccc],esi` -> `mov [edi+0x14cc],esi` at 0x1015bedd). .data grew by
0x32ae0, so .data1, .rsrc, the packed section and .reloc moved up by 0x33000.

Carrying addresses over
-----------------------
Old -> new addresses by byte matching: a window around the old address, every relocated dword
(from the private .text relocation table) wildcarded, must match exactly once in the new .text;
windows widen until one does. Data addresses: map the .text sites that reference them and read
the new operand. Results used:
  manual verdicts (r1builds.py) all 7 NOT_CODE, 3 REDECODE, 5 switch overrides mapped
                                (0x1015bef0/0x1015beed by hand: same -0x10 shift, verified by
                                disassembly; the byte window failed because of the 0xccc change)
  character table pointer       0x104df7b0 -> 0x104df770 (layout unchanged: +0x13820, stride 0x8c)
  Present call site             0x100035cb (unchanged)
  difftest CRT slice            each -0x40 (strlen 0x10317440 ... strpbrk 0x10322bb0), all entries
These are in FFXIRecompile recomp/meta/builds.json.

Method
------
Ghidra 11.3.2 headless, scratch project, as for 2026-08-22: import + auto-analysis, then
Discover -> Discover2 (each to a fixpoint) -> Switches -> SwitchAudit -> Conflicts ->
BogusCheck APPLY -> the same again -> Classify / Diagnose / RecompStats -> Export.
The manual verdicts now live in r1builds.py, per module and build (by PE timestamp).

Three false starts are new in this build (Conflicts reported 3 after the carried-over verdicts):
  0x100657d0  aligned start inside `mov eax,0x10353b90` at 0x100657ce: its 0x90 read as padding
              -> NOT_CODE 0x100657d0, REDECODE 0x100657ce
  0x100f46b0  a 4-entry switch table (0x100f45d7 0x100f45e5 0x100f4693 0x100f45cc) after a nop,
              decoded as xlatb/movups -> NOT_CODE
  0x1015d7e0  a jump table into the function before it, right after its ret -> NOT_CODE
After re-applying: 0 conflicts, 0 suspect functions, SwitchAudit review 0.

Results
-------
                                  auto-analysis   after discovery   2026-08-22 after discovery
functions in .text                14,159          21,762            21,873
instructions                      890,470         996,083           996,086
instruction bytes                 83.3%           93.0%             93.0%
instructions outside functions    152,181         0                 0
scaled-index switches             857             943               943
tail_jumps                        -               2,165             2,447

Coverage is the same as 2026-08-22; the function partition is not. 113 old entries map to
addresses that are inside another function's body here (5 inside nothing), e.g. 0x1001cff0 ->
0x1001cfe0, now part of 0x10071a30's body. They are shared tail code reached only by jumps (no
pointer references), which this run's analysis order folded into a jumping function instead of
promoting. The translator is indifferent: x86c.py follows jumps to non-entry code and inlines it
into each jumping function, so the translation's behaviour is the same, only its layout differs.
Fewer tail_jumps follows from the same thing.

Verification (FFXIRecompile)
----------------------------
tools/prepare.py --game <that folder> -> build 2026-09-03.
tools/build.py difftest: PASS, 133,681 calls, 0 mismatches.
tools/build.py host: translated 21,762 functions (194 with unimplemented instructions, all
MMX/3DNow!/SSE; 195 in 2026-08-22); 21,762 entries patched; BOOT OK at the preferred base and
relocated (as inside the retail launcher). Not yet run in-game.
tools/build.py boot64: BOOT64 OK. host64 (Windows x64): the title-screen loop at ~28 frames a
second, after three host fixes that install needed (FFXIRecompile 58a23f8): InstallFolder
set to the real folders (else FFXI-9001), a patch.ver made for version 30260903_0 (the install
ships none), and d3d8 ValidateVertexShader/ValidatePixelShader shims.
The version string 30260903_0 is inferred (retail's 30260805_0 is the 2026-08-05 PE date); a
server whose version check expects another string will refuse the client at the lobby.
