gamecore common-function-table slots: presence client, lists, text, KB search, misc
=====================================================================================
Date: 2026-09-24. Static only (capstone 5 + pefile over reverse-engineering/unpacked/*.unpacked.dll,
image base 0x10000000), plus the live call log gamecore_live_calls.txt (retail gamecore, signed in to
argument 0x0bbf28c0 is FFXiMain 0x100f28c0). Scratch scripts: session scratchpad pp/*.py.
Confidence tags: HIGH = read directly from code; MED = read, but a detail rests on inference;
LOW = educated guess.

===================================================================================================
0. CONVENTIONS THAT HOLD FOR EVERY SLOT IN THIS GROUP                             confidence: HIGH
===================================================================================================
* CALLING CONVENTION: every slot target in this group ends in a plain `ret` (checked by recursive
  descent of each target: no `ret N`), and every FFXiMain call site cleans up itself
  (`add esp,4*N` / `pop ecx`) or reaches the slot by a tail-`jmp` from a 1-line cdecl wrapper.
  => ALL slots below are __cdecl: the callee pops NOTHING. "a0,a1,.." = dwords at [esp+4],[esp+8],..
     on entry. Return in eax (slot 283 returns a 64-bit value in edx:eax; slot 207 a 16-bit value
     in ax, FFXiMain masks with `and eax,0xffff`).
* FFXiMain reaches the table only through thunks (mov eax,[0x10456a6c]; jmp [eax+disp]). Most
  presence slots are wrapped again by 1-line functions at 0x100f1590..0x100f1a60.
* gamecore error codes are negative: 0xffffe3xx (-72xx) bad index/state; 0xfffff7fa (-2054) bad
  request handle; 0xffffebf0 (-5136) handle not in use; 0xfffffdfd (-515) not signed in to the
  online session (global 0x100aa8c8==0); 0xfffffefc (-260) request older than 100 s; 0xffffff00 (-256) no free
  request context; 0xffffec00 (-5120) bad argument; 0xffffd800 (-10240) bad file channel.
* FFXiMain reports negative codes from several service paths through 100182f0(err) -> 10018320 ->
  10018190 (the game's service-error reporter). Native stubs should therefore prefer "0 / empty
  record / done" over negative returns, except where noted.

presence ASYNC REQUEST MODEL                                                        confidence: HIGH
  Pairs: 165/166, 175/176, 179/180, 181/182 (poll also 180 in one state), 208/209, 273/274, 275/276,
  278/279, 280/281, 301/302 (and 195/196, not in this group).
  - START: takes one of 4 request contexts (0x338 bytes each at 0x10404ad0..0x104057b0; finder
    0x1001eba0), initialises it (0x1001ea00, 0x1001ff20), returns the context index 0..3 as the
    HANDLE, or 0xffffff00 if none is free. Start does no network I/O.
  - POLL(h): validator 0x1001ebd0: h<0||h>=4 -> -2054; ctx free -> -5136; not signed in
    (0x100aa8c8==0) -> frees ctx, -515; older than 100000 ms -> frees ctx, -260. Otherwise steps
    the request: 0 = BUSY, >0 (1) = DONE (ctx freed), <0 = FAILED (ctx freed).
  - FREE(h): slots 199 and 277 (both -> 0x1001fc30) cancel/free a context.
  - FFXiMain always:  h = start(); h<0 -> error;  then per frame r = poll(h): r==0 stay,
    r>0 advance, r<0 -> error path (network-mode failure, or service job failure + error report).
  => NATIVE GENERIC RULE: start returns 0 (a fake handle, never negative); poll returns 1 (DONE) on
     the first call; free returns 0. Retail "not signed in" (poll -> -515) would drive FFXiMain
     into its error paths, which is exactly what we do not want. Where DONE is followed by FFXiMain
     reading output written by the slot, the per-slot block says what to write.

FFXiMain "SERVICE JOB" STEP PROTOCOL (0x100f2c90 runner, step tables at 0x103620d0..0x10362330)
                                                                                  confidence: HIGH
  A service job is a NULL-terminated list of step functions step(job, phase). phase 0 = query,
  1 = begin, 2 = poll, 3 = cancel. Step return: 0x16 = busy (call again next frame), 0x17 = step done
  (advance), 0x18 = "item available" (iterator), 6 = cancelled, anything else = job failed with that
  code (if job+8 < 0 the runner calls 100182f0(job+8) = service-error report, then the requester's
  callback gets the code). Every step starts with 0x100f4570 (common init).
  Jobs are created by: 0x100f1f10 (auto, only if slot 836 returns 1) and the service UI in FFXiMain
  (0x101ff3f0..0x10201650: the service's mail / friend UI, via
  0x100f7000..0x100f76c0 C-API wrappers).

===================================================================================================
1. FFXiMain STATE MACHINES THAT CALL THESE SLOTS, AND WHAT "NOT CONNECTED" SHOULD LOOK LIKE
===================================================================================================
1a. Network-mode dispatcher 0x100da760 (mode in [obj+0x88], obj = [0x103601cc]).  conf: HIGH
  Per frame, from 0x100daf40 (which also calls slot 705). Modes are requested by 0x1023b540 via
  0x1023bb50 (mode) -> 0x100db180. On a handler returning -1 the dispatcher switches to mode 0xcb
  (error / disconnect dialog). Relevant handlers:
    mode 1   0x100ed7f0  lobby connect (818, 221/222, 195/196, 936, 1003; other group)
    mode 3   0x100ee170  ENTER WORLD with the selected character (uses 177, 183/184, 179/180,
                         181/180, 195/196). Always used by 1023b540 op 1 = "play character".
    mode 19  0x100ee0b0  175/176 (only when 1023b540's first argument is non-zero; not seen live)
    mode 17  0x100eeea0  181/182 then 179/180;  mode 18 0x100eef90 181/182.
                         Both requested only by 0x1023bc00, which has NO callers (dead).
  mode 3 (0x100ee170) in detail. States 0..9 are lobby traffic, 10..13 print messages, then:
    14  idx = 0x100efdb0(sel) -> 0x100efe00(contentId, worldWord, charIdPacked): scans slot 177
        records 0..63 for one with  (b[0]&1) && w[2]==1 && d[8]==contentId && d[0xc]==0 &&
        d[4]==packed.  None -> -1 -> mode fails -> error dialog.  Found: 177(idx,&rec):
          rec.q[0x10] bit 15 set   -> 195(chan=(q[0x10]>>16)&0x3f, idx, 0, -2, -1, 1); state 15
          bit 15 clear, state<20   -> state 16
    15  poll 196: 0 wait, >0 -> state 22 -> return 1 (mode done), <0 -> fail
    16  ebx=0x100efdb0(sel), edi=0x100efd30() (first 173 record with bit0 set and a free byte in
        rec+0x20..0x27, else -1 -> fail); 184(ebx,edi); 183(ebx,edi) <0 -> fail; h=179() -> 17
    17  poll 180(h): 0 wait, >0 -> 18, <0 fail;   18  h=181() -> 19;   19 poll 180(h) -> 20
    20  = state 14 again, but now "bit 15 clear" -> fail.
  The live log shows exactly states 14 -> 15 -> 22 (177 at 100efe2e for idx 0,1,2, then 177(2)
  at 100ee363, 195(0,2,0,-2,-1,1), 196 polled 15x until 1).
  FFXiMain values: character table at [[0x104df7b0]+0x13820 + i*0x8c], selected index at
  [[0x104df7b0]+0x1381c]; per entry: dword +4 = contentId, word +8 and byte +0xf = 24-bit
  character id, word +0xa = world word. 0x100efe00's packed id =
      (charId & 0xffff) | ((worldWord & 0xffff) << 16) | ((charId>>16 & 0xff) << 24)
  (the world word and the char-id high byte overlap in bits 24..31; world word is expected <256).
  => "NOT CONNECTED" CANNOT MEAN "NO 177 RECORDS". Native slot 177 must return, for the selected
     character, a record that 0x100efe00 matches, with bit 15 of q[0x10] set and handle index 0 in
     bits 16..21, so mode 3 goes 14 -> 195/196 -> done and never reaches 183/184/179/180/181.
     Source the values from the server's own lobby data or read them from FFXiMain's table above.

1b. Presence snapshot 0x104df94c (FFXiMain 0x100f77a0 init, 0x100f78d0 refresh,
    0x100f7970 reset)                                                            conf: HIGH
  Reads 190 -> [0], 189 -> [4], 204 -> [8], 206 -> [0xc], 207 -> [0x14], 0x100f1680 -> [0x38]
  (0x100f1680 = 190 -> 173(idx) -> bit0? rec.d[0x18]&3 : -1). These values are passed back into
  slot 195 by the async op at [0x104df94c+0x30] whenever the UI changes a presence field
  (0x100f7a60, 0x100f7aa0 from 1007e090.. / 101ebd20), and 0x100f7a90 (= snapshot 206) is used at
  logout (0x100db08d). 0x100f7b40 (from UI 0x101ebd90) runs 181/182 then 0x100f1600 (190/173/174).
  => Native: keep one small presence store {chan, sub, flag, mode, x, word} that slot 195 writes
     (-2 / out-of-range = keep, see the 190/189/204/206/207 blocks) and 189/190/204/206/207 read.
     Recommended initial values = what the retail gamecore reported live after sign-in:
     chan(190)=0, sub(189)=-1, flag(204)=1, mode(206)=0, word(207)=0x3e8, plus handle record
     173[0] valid. Pre-sign-in retail values are 190=-1, 189=-1, 204=0, 206=4, 207=0x3e8; FFXiMain
     also tolerates those (it checks 190<0 everywhere), but they are untested live.

1c. FFXiMain service client object 0x104df8e8 (pointer 0x104df948)                    conf: HIGH
  0x100f76c0 creates it (from 0x100f0140 init and 0x10017710); 0x100f7710 -> 0x100f1d30 pumps its
  job queue once per frame (from 0x10103930, called by 0x100da760 every frame); 0x100f76e0 tears it
  down. 0x100f7750 (called by the lobby machine 0x100ed7f0) and 0x100f7770 call 0x100f1f10(1):
      if (word obj+4 == 0 && slot836() == 1) { obj+4 = 1; allocate job slots; friend-list scan
          (100e6b20/100e6c50/100e63d0: slots 167/169); queue the mail-folder jobs (100f2600,
          100f26a0, 100f2730: slots 126, 931/930/923, 291, 167/169/173, 278/279/282/288) }
  obj+4 also gates registering the service notification callback (0x100f1d10 -> 288(0x100f28c0)).
  The mail counters read by the in-game mail icon UI (0x100f6ee0.., 0x102007xx..0x102015xx)
  stay 0 unless jobs run.
  => "NOT CONNECTED" = slot 836 returns 0. Then no service job is ever started automatically, the
     per-frame pump finds an empty queue, and the mail icon shows nothing. UI-started jobs can
     still run; with the stubs below they finish immediately with empty results.
  (Retail returns 1 from 836 when the online session is NOT initialised, and a fetch-and-clear
  flag otherwise; live it returned 1. Returning 1 natively is also safe with the stubs below, just more code runs.)

1d. Help Desk FAQ search (0x10212650 / 0x10212770 / 0x10216260..0x10216505)       conf: HIGH
  0x10212650 (opening the Help Desk) calls 0x10216260: loads kb_faq.pib, kb_faq_idx.pib,
  kb_faq.pfb through FFXiMain's own file loader, then slot 667(pib, pfb, idx). 667 returning 0 ->
  0x10216260 returns false -> 0x10216410 (slot 641 cleanup) and obj+0x1c2 = 0 (FAQ disabled).
  => "NOT CONNECTED" = slot 667 returns 0; everything else in 638..669 is then unreachable.

1e. Other gates found
  - 0x100e7be0 / 0x100e7ef0 (load the viewer profile DB; slots 258, 921/922, 926/927, 923, 293/294)
    have NO callers or references anywhere in FFXiMain: dead code. 0x100e81b0 (slots 296/297/299/301/302,
    from UI 0x101ebb07) returns -1 unless that dead loader ran: effectively unreachable.
  - 1023bc00 (modes 17/18) is dead; wrappers 0x100f15f0 (197), 0x100f17a0 (188), 0x100f17c0 (186),
    0x100f17e0 (165), 0x100f17f0 (166), 0x100f15a0/15b0/15c0/15d0/16e0/16f0/1970/1990 are never
    called (their slots are reached only from the direct call sites listed per slot).

===================================================================================================
2. PER-SLOT BLOCKS
===================================================================================================
Format: slot / disp -> gamecore target | conv | args | return | writes | FFXiMain | Native | conf.
"live" = what gamecore_live_calls.txt shows.

--- presence: handles (0x28-byte records, 64 at 0x10405800) and FFXI characters (0x68-byte, 64 at
    0x10403080), friend lists (0xb0-byte, 200 at 0x100b40d8 and 100 at 0x100afc18) ---

slot 165 (+0x294) -> 0x10025580                                                   conf: HIGH
  cdecl, 0 args. START async request "refresh friend lists" (0x100240c0: counts entries of both
  friend lists, request type 0xd). Returns handle 0..3 or <0.
  FFXiMain: only via wrapper 0x100f17e0, which is never called. DEAD.
  Native: return 0.

slot 166 (+0x298) -> 0x100255a0                                                   conf: HIGH
  cdecl, a0 = handle. POLL of 165 (0x10024170). 0 busy / >0 done / <0 error.
  FFXiMain: only via never-called wrapper 0x100f17f0. DEAD.
  Native: return 1.

slot 167 (+0x29c) -> 0x10023da0                                                   conf: HIGH
  cdecl, a0 = index (0..199), a1 = void* out (>= 0xb0 bytes).
  Copies friend-list-A entry a0 (0xb0 bytes from 0x100b40d8 + a0*0xb0) to a1 (0x10023e10: memcpy,
  then if (q[8] & 0xe000) >= 0xa000 clears bits 13..15 of byte 9), then sets bits 20..27 of the
  u64 at a1+8 to (a0 & 0xff). Returns 0; a0 >= 200 -> 0xffffe3f9 (-7175), nothing written.
  Record fields used by FFXiMain: q[0] = account ID (u64), q[0x98] bit0 = entry valid, bits 13..18 of
  q[0x98] = handle index, and at +0x18 a 16-byte "character" sub-record array (see 0x100e63f0).
  FFXiMain: 0x100e7b30 (a0<200 -> 167 else 169(a0-200); <0 -> 100182f0 error report), 0x100e68b0
  (friend lookup), 0x100f2c90 / 0x100f5f80 / 0x100f6c20.. (sender lookup in mail jobs): every one
  loops over all indices and skips entries whose q[0x98] bit0 is clear.
  live: 32 calls idx 0..31 -> 0 (from 100e7b47) and 32 calls from 100f6129 -> 0.
  Native: if (a0 >= 200) return 0xffffe3f9; memset(a1, 0, 0xb0);
          *(uint64_t*)(a1+8) |= (uint64_t)(a0 & 0xff) << 20;  return 0.   (empty friend list)

slot 169 (+0x2a4) -> 0x10023f90                                                   conf: HIGH
  cdecl, a0 = index (0..99), a1 = out (0xb0 bytes). Same as 167 for friend-list B (0x100afc18),
  without the index bits. a0 >= 100 -> 0xffffe3f9.
  FFXiMain: as 167 (0x100e7b30 maps list indices 200..299 to it).
  live: idx 0..31 -> 0 (twice).
  Native: if (a0 >= 100) return 0xffffe3f9; memset(a1, 0, 0xb0); return 0.

slot 173 (+0x2b4) -> 0x1001cc40                                                   conf: HIGH
  cdecl, a0 = handle-record index (0..63), a1 = out (0x28 bytes). Copies record a0 from
  0x10405800 + a0*0x28. Returns 0; a0 >= 64 -> 0xffffe3ea (-7190), nothing written.
  Record: q[0] bit0 = valid (other low bits = flags, bits 13..18 of the high dword are compared by
  174), +8 char name[16] (account handle name), d[0x18] bits 0..1 = online status, bits 2..7 more
  flags, d[0x1c], +0x20 byte[8] = character slots (bit0 used, bits 1..6 = 177 index).
  FFXiMain: 0x100f1680 (status: 190 -> 173 -> !(q0&1) ? -1 : d[0x18]&3), 0x100f1600 (update, then
  174), 0x100efd30 / 0x100eff30 (mode 3 fallback, find a handle with a free character slot),
  0x100f4ab0 (service job step: 283, 190, 173; fails with job code 7 when 190<0 or 173 fails or
  name[0]==0), 0x100f2c90 / 0x100f5f80 / 0x100f57d0 (copy handle name), 0x102384f0 (UI: formats
  "%s" of the name).
  live: 173(0,&buf) = 0 twice (100f1697), 173(0, ..) = 0 at 100f6064.
  Native: if (a0 >= 64) return 0xffffe3ea; memset(a1,0,0x28); if (a0 == 0) { a1[0] = 1 (valid);
          copy a 15-char handle name to a1+8 (e.g. the account or character name) ; d[0x18] = 0; }
          return 0.   (One valid handle 0, matching 190 == 0. Use an all-zero record instead if 190
          returns -1.)

slot 174 (+0x2b8) -> 0x1001cc80                                                   conf: HIGH
  cdecl, a0 = index (0..63), a1 = const rec* (0x28). Merges fields of a1 into handle record a0
  (bit0, flag bits, bits 13..18, d[0x18] bits 0..1 and 2..7, d[0x1c], name at +8), marks it dirty
  and queues a server update (0x1001cbe0, 0x1002a430). Never writes through a1. Returns 0;
  a0 >= 64 -> 0xffffe3ea.
  FFXiMain: 0x100f1600 only (completion of the UI "set status" op 0x100f7b40): return ignored.
  Native: if (a0 >= 64) return 0xffffe3ea; optionally copy a1->d[0x18]&3 into the native handle
          record; return 0.

slot 175 (+0x2bc) -> 0x10023440  (START)                                           conf: HIGH
  cdecl, 0 args. Starts a request (0x10022210, type 8). Returns handle or <0.
  FFXiMain: mode 19 state 0 (0x100ee0ee): h<0 -> [+0x136ac]=h, return -1 (mode error);
  else state 1. Mode 19 was not entered in the live session.
  Native: return 0.

slot 176 (+0x2c0) -> 0x10023460  (POLL of 175)                                     conf: HIGH
  cdecl, a0 = handle. 0 busy / >0 done / <0 error (0x10022260).
  FFXiMain: mode 19 state 1 (0x100ee11c): 0 stay, >0 state 2 -> 3 -> 4 -> done, <0 mode error.
  Nothing is read after DONE.
  Native: return 1.

slot 177 (+0x2c4) -> 0x100227d0                                                   conf: HIGH
  cdecl, a0 = character-record index (0..63), a1 = out (0x68 bytes). Copies record a0 from
  0x10403080 + a0*0x68. Returns 0; a0 >= 64 -> 0xffffe3fd (-7171), nothing written.
  Record: b[0] bit0 valid; w[2] = type (1 = FFXI character); d[4] = packed char id (see 1a);
  q[8] = content id (high dword 0); q[0x10]: bit 15 = registered to a handle, bits 16..21 = handle
  index; rest unknown.
  FFXiMain: 0x100efe00 (mode 3, find the selected character), 0x100ee363 (mode 3 state 14/20),
  0x100efeb0 / 0x100effb0 (no callers), 0x100f63d0 (service job step: finds the record with
  w[2] == slot207() and compares a name).
  live: 177(0..2) at 100efe2e -> 0 (idx 2 matched), 177(2) at 100ee363 -> 0.
  Native (REQUIRED for world entry, see 1a): if (a0 >= 64) return 0xffffe3fd; memset(a1,0,0x68);
          if a0 == the lobby slot of a character (or: a0 == selected index) {
             a1[0] = 1;  *(u16*)(a1+2) = 1;
             *(u32*)(a1+4) = (charId & 0xffff) | (world << 16) | ((charId >> 16 & 0xff) << 24);
             *(u32*)(a1+8) = contentId;  *(u32*)(a1+0xc) = 0;
             *(u64*)(a1+0x10) = 0x8000 | (0 << 16);   // registered, handle 0 }
          return 0.
  The simplest correct source is FFXiMain's own table: entry = [[0x104df7b0]+0x13820 + a0*0x8c],
  contentId = d[entry+4], charId = w[entry+8] | b[entry+0xf]<<16, world = w[entry+0xa]; emit a
  record only when contentId != 0.

slot 179 (+0x2cc) -> 0x10023400  (START "commit character/handle links")          conf: HIGH
  cdecl, 0 args (0x100229b0). Returns handle or <0.
  FFXiMain: mode 3 state 16 (only when 177 bit 15 is clear), mode 17 (dead).
  Native: return 0.

slot 180 (+0x2d0) -> 0x10023420  (POLL of 179, also polls 181's handle)             conf: HIGH
  cdecl, a0 = handle (0x10022aa0). 0 busy / >0 done / <0 error.
  FFXiMain: mode 3 states 17 and 19 (0 stay, >0 advance, <0 mode error), mode 17.
  Native: return 1.

slot 181 (+0x2d4) -> 0x1001e430  (START "refresh handle list")                     conf: HIGH
  cdecl, 0 args (0x1001ce00). Returns handle or <0.
  FFXiMain: mode 3 state 18; mode 17/18 (dead); the UI presence op at [0x104df94c+0x40]
  (0x100f16c0 wrapper, started by 0x100f7b40).
  Native: return 0.

slot 182 (+0x2d8) -> 0x1001e450  (POLL of 181)                                    conf: HIGH
  cdecl, a0 = handle (0x1001cf50). 0 / >0 / <0.
  FFXiMain: presence op completion -> 0x100f7ad0 -> 0x100f1600 (190/173/174); modes 17/18 (dead).
  Native: return 1.

slot 183 (+0x2dc) -> 0x10022e00                                                   conf: HIGH
  cdecl, a0 = character index (0..63), a1 = handle index (0..63). Local list edit: link character
  a0 into a free slot of handle a1 (checks handle valid, character valid, slot free). Returns 0 or
  -7171 (a0>=64), -7190 (a1>=64), -7172 (handle invalid), -7173 (character invalid), -7168 /
  -7169 (0xffffe400 / 0xffffe3ff: no free slot / already linked).
  FFXiMain: mode 3 state 16 only (<0 -> mode error).
  Native: return 0.

slot 184 (+0x2e0) -> 0x10022dd0                                                   conf: HIGH
  cdecl, a0 = character index, a1 = handle index. Unlink (0x10022d00): errors -7171, -7172,
  -7190, -7173, -7174 (not linked); returns 0. FFXiMain ignores its return (state 16 calls 183
  right after it; 0x100efeb0 is dead).
  Native: return 0.

slot 185 (+0x2e4) -> 0x10024ad0                                                   conf: MED
  cdecl, 6 args (a0 = -1 from FFXiMain = "any slot", a1..a2 = u64 account ID, a3 = handle index,
  a4, a5). Add an entry to friend list B (100 entries): finds a matching or free slot, fills it,
  queues a server update. Returns the entry index (0..99) or <0 (-7175 bad index, list full ...).
  FFXiMain: 0x100f1740 <- 0x100e7b70 (flag!=0 path), which adds 200 and reports <0 via 100182f0;
  0x100e7b70 is called from the friend UI (0x100e6a00, 0x100e6a70).
  Native: return 0xffffe3f9 is NOT benign (error report). Return 0 (pretend stored at index 0;
          the entry stays invisible because 169 returns empty records).

slot 186 (+0x2e8) -> 0x10024dd0                                                   conf: HIGH
  cdecl, a0 = index (0..99). Delete friend-list-B entry (0x10024d30(1, a0, rec)): -7175 bad index,
  -7189 (0xffffe3eb) entry not valid, else 0. FFXiMain: only via never-called 0x100f17c0. DEAD.
  Native: return 0.

slot 187 (+0x2ec) -> 0x10024e10                                                   conf: MED
  cdecl, 6 args, as 185 for friend list A (200 entries). FFXiMain: 0x100f1700 <- 0x100e7b70
  (flag==0 path). Native: return 0.

slot 188 (+0x2f0) -> 0x10024d90                                                   conf: HIGH
  cdecl, a0 = index (0..199). Delete friend-list-A entry. FFXiMain: only via never-called
  0x100f17a0. DEAD. Native: return 0.

slot 189 (+0x2f4) -> 0x1001cb80                                                   conf: HIGH
  cdecl, 0 args. Returns global 0x10075420 = presence "sub" (the 177 index of the character in
  play, 0..63) or -1. Init -1; written by the sign-in data and by slot 195's a1 (-2 = keep,
  -1..63 accepted, else 195 fails).
  FFXiMain: snapshot [4] (0x100f77a0/0x100f78d0); 0x100f1800 (dead).
  live: -1 before world entry, 2 after 195(0,2,...).
  Native: return presence.sub (initial -1; set by native 195 a1 unless a1 == -2).

slot 190 (+0x2f8) -> 0x1001cbb0                                                   conf: HIGH
  cdecl, 0 args. Returns global 0x1007541c = presence "chan" = current handle index (0..63) or -1.
  Written by sign-in and by slot 195's a0 (-2 keep, -1..63).
  FFXiMain: snapshot [0]; 0x100f1680 / 0x100f1600 / 0x100f4ab0 / 0x102384f0 all treat <0 as
  "no handle" (return -1, job error 7, or skip).
  live: 0 every time.
  Native: return presence.chan (recommended initial 0, with a valid 173[0]; see 1b).

slot 197 (+0x314) -> 0x1001d2c0                                                   conf: HIGH
  cdecl, 4 args (a0 = handle index 0..63, ...). Edits a handle record (errors -7190, -5429
  (0xffffeacb), -7184, -7178). FFXiMain: only via never-called wrapper 0x100f15f0. DEAD.
  Native: return 0.

slot 199 (+0x31c) -> 0x10025280                                                   conf: HIGH
  cdecl, a0 = request handle. Frees/cancels the request (0x1001fc30). Return = junk (the callee's
  eax); FFXiMain ignores it. FFXiMain: 0x100f4b60 phase 3 (cancel of the 208/209 step).
  Native: return 0.

slot 204 (+0x330) -> 0x1001cb00                                                   conf: HIGH
  cdecl, 0 args. Returns global 0x100ac54c = presence flag (0/1). Written by sign-in (byte==1) and
  by 195's a2 (-2 keep; 0 or 1). FFXiMain: snapshot [8] only.
  live: 1 before world entry, 0 after.
  Native: return presence.flag (initial 1).

slot 206 (+0x338) -> 0x1001cb20                                                   conf: HIGH
  cdecl, 0 args. Returns global 0x10075424 = presence "mode" (-1..4, init 4). Written by sign-in
  and by 195's a3 (-2 keep, -1..4). FFXiMain: snapshot [0xc]; 0x100f7a90 returns it; at logout
  0x100db08d: == 1 -> 0x100e46b0(1,1) else (1,0) (a UI flag, not an error).
  live: 0.
  Native: return presence.mode (initial 0).

slot 207 (+0x33c) -> 0x1001cb50                                                   conf: HIGH
  cdecl, 0 args, returns a WORD (ax) = global 0x10075428, init 0x3e8. Written by sign-in (word) and
  by 195's a5 (0..0x3ff accepted, else keep). FFXiMain masks to 16 bits: snapshot [0x14];
  0x100f4b60 passes it to 208 as the "world/content" word (208 marks 0x3e8 specially);
  0x100f63d0 / 0x100f6c20 compare it with 177 w[2] / job fields.
  live: 0x3e8 before world entry, 1 after 195(...,1).
  Native: return presence.word (initial 0x3e8).

slot 208 (+0x340) -> 0x10023050  (START "look up account user")                        conf: HIGH
  cdecl, a0 = word (207 value), a1:a2 = u64 target id, a3 = 0. Needs 190 >= 0 else returns
  0xffffe3ee (-7186). Else starts request type 6 and returns the handle.
  FFXiMain: service job step 0x100f4b60: <0 -> retries up to 60 frames then job error 5;
  handle -> poll with 209.
  Native: return 0.

slot 209 (+0x344) -> 0x10023330  (POLL of 208)                                     conf: HIGH
  cdecl, a0 = handle, a1 = u64* outId (may be 0), a2 = u32* outByte (may be 0). On DONE writes
  *a1 = the found user's u64 id (decoded), *a2 = a status byte; returns 1 (found or a0's word was
  0x3e8) or 0xffffe3ee (-7186, not found). 0 while busy.
  FFXiMain: 0x100f4b60: >0 -> job+0x38/0x3c = *a1, step done; -0x14cb -> job error 8;
  -7186 -> job error 0xb; other <0 -> retry up to 3 times then error 5.
  Every failure path stores the negative code in job+8, so the runner also calls the service-error
  reporter 100182f0. Only UI-started jobs (mail/tell to an account ID) reach this step.
  Native (recommended, benign "found"): if (a1) *(u64*)a1 = the id passed to 208 (a1:a2 there,
          keep it in the fake request); if (a2) *(u32*)a2 = 0; return 1.
          (Returning 0xffffe3ee = "no such user" also works but triggers an error report.)

--- 258: sprintf-like ---

slot 258 (+0x408) -> 0x10012420                                                   conf: HIGH
  cdecl VARARGS: a0 = char* dst, a1 = int size, a2 = const char* fmt, a3.. = arguments (each
  conversion consumes exactly one 32-bit stack slot).
  Exact semantics (reimplement this, not libc snprintf):
   - limit = dst + size - 1.  Before handling EACH format character the loop checks
     out >= limit; if so: *out = 0, return -1.  (So size 0 writes a NUL at dst[0] and returns -1;
     an empty fmt returns 0 without any check.)
   - A non-'%' char is copied.  At the end of fmt: *out = 0, return out - dst (length).
   - '%' is followed by an optional single width digit:
       '%0N' (N = next char): pad char '0', width N;   '%N' with N in '1'..'9': pad ' ', width N.
       (Stored as width-1 = N - '1'. Only ONE width digit is read: "%10d" = width 1 with
       conversion char '0', which is emitted literally, then 'd' literally -> "0d".)
       Without a digit: width 0 (no padding); the pad char keeps its last value (start ' ').
       A width of 1 or less never pads.
   - Conversion char:
       'd'  signed 32-bit decimal. A '-' is emitted first (WITHOUT the limit check), then pad
            chars up to width (width counts digits only, excludes the '-'), then the digits.
            INT_MIN is not handled (negation overflows).
       'x'  unsigned hex, lowercase a-f;  'X' uppercase.  Pad as 'd'.
       's'  copy the string (no width, no precision; NULL is not checked).
       'c'  emit the low byte of the argument, WITHOUT the limit check (a 0 byte is emitted too).
       anything else (including '%', 'l', 'u', 'f', ...): emit that char literally, consume NO
            argument, ignore any width.
   - Each padding / digit / string byte is limit-checked (-> NUL + return -1 on overflow).
   - Returns length (excluding NUL) or -1 on truncation (truncated output is NUL-terminated).
  FFXiMain: 0x100e7c45 / 0x100e7f55: 258(buf, 0x200, <profile .pib name format>, dir) in the dead
  0x100e7be0 / 0x100e7ef0 loaders. Also used internally by gamecore 1483.
  Native: implement as above (tiny); or return -1 with dst[0]=0 (unreachable in practice).

--- 270..302: mail headers of the service, mail file paths, PIB database ---

slot 270 (+0x438) -> 0x1001a760                                                   conf: HIGH
  cdecl, 13 args (0x34 bytes): a0 = hdr* (0x48 bytes), a1..a4 = two u64 ids, a5 = char* (15),
  a6..a12 = subject pointer, bytes and words (flags, time). Zero-fills hdr and builds a mail
  header (ids, 15-byte name, 15-byte subject truncated at a DBCS boundary, time via 0x1004ccf0,
  flag words at +0x3e/+0x40/+0x42). Returns a12 (the last argument). Pure local computation.
  FFXiMain: service job steps 0x100f4de0 / 0x100f57d0 (compose mail), return ignored, step -> 0x17.
  Native: memset(a0, 0, 0x48); return a12.  (or reimplement; the header is only consumed by
          273/275, which are stubbed)

slot 271 (+0x43c) -> 0x1001aa80                                                   conf: MED
  cdecl, a0 = hdr* (or 0), a1 = const char* src, a2 = char* dst (128). Copies up to hdr->d[0x38]
  bytes (max 127) of src up to a 0x07 separator into dst, NUL-terminates, and returns non-zero
  if more text follows (used to split "From/Title/Message"). a0 or a2 NULL -> returns 0.
  FFXiMain: 0x100f2c90 (runner, before the completion callback): non-zero -> callback gets dst as
  the message text; 0 -> callback gets code 0x10.
  Native: if (a2) a2[0] = 0; return 0.

slot 272 (+0x440) -> 0x1001a8e0                                                   conf: MED
  cdecl, 5 args: a0 = char* (<=127), a1 = int len (capped 0x100000), a2..a3, a4 = dst (NULL -> 0).
  Concatenates header text parts into dst and returns the byte count. FFXiMain: 0x100f3060
  (job setup) stores the result in job+0xbc (message length).
  Native: if (a4) *(char*)a4 = 0; return 0.

slot 273 (+0x444) -> 0x1001aba0  (START "send mail")                              conf: HIGH
  cdecl, a0 = hdr* (0x48, 8-byte aligned else -5120), a1 = body. Rejects hdr+0x43 bit1 (-5457,
  0xffffeaaf); sets the "sent" bits in hdr+0x3e/+0x42 (WRITES hdr); writes the local copy file
  FFXiMain: service job step 0x100f5070 (with 274/277).
  Native: return 0 (do not touch hdr).

slot 274 (+0x448) -> 0x1001abc0  POLL of 273. cdecl, a0 = handle. Native: return 1.   conf: HIGH
slot 275 (+0x44c) -> 0x1001abd0  START (a0 = hdr*, a1): same family as 273 (0x1001bfc0, mail
  delete/move on server). FFXiMain: step 0x100f5260. Native: return 0.                conf: MED
slot 276 (+0x450) -> 0x1001abf0  POLL of 275. cdecl, a0 = handle. Native: return 1.   conf: HIGH

slot 277 (+0x454) -> 0x1001ac00                                                   conf: HIGH
  cdecl, a0 = handle. Free/cancel request (0x1001c150 -> 0x1001fc30 under the mail lock). Return
  ignored. FFXiMain: cancel phase of mail steps (0x100f5070, 5260, 5510, 5e50, 6520).
  Native: return 0.

slot 278 (+0x458) -> 0x1001ac10  (START "fetch mail headers")                      conf: HIGH
  cdecl, a0 = hdr buffer (array of 0x48-byte headers), a1 = count (FFXiMain passes 0x10).
  Starts request 0x10027660(a0, a1, 1); the request fills a0 while it runs. Returns handle / <0.
  FFXiMain: service job step 0x100f5e50 (live: 278(buf,0x10) = 0, then 279 polled 22x until 1).
  After DONE, FFXiMain scans all 16 headers: 282(hdr) != 0 -> 0x100f27f0(hdr) (new-mail entry),
  then 0x100f1d10 (register notification callback via 288) and the step finishes. <0 from start
  -> retried up to 60 frames, then job+8 = code, callback.
  Native: memset(a0, 0, a1 * 0x48); return 0.   (zero headers => 282 returns 0 for all)

slot 279 (+0x45c) -> 0x1001ac30  POLL of 278. cdecl, a0 = handle. 0 / 1 / <0.     conf: HIGH
  Native: return 1.

slot 280 (+0x460) -> 0x1001c0e0  START (a0 = hdr*): 0x1001c070, mail request (mark read / fetch
  body). FFXiMain: step 0x100f5510 (with 281/277). Native: return 0.                    conf: MED
slot 281 (+0x464) -> 0x1001ac40  POLL of 280. Native: return 1.                        conf: HIGH

slot 282 (+0x468) -> 0x1001ac50                                                   conf: HIGH
  cdecl, a0 = hdr*. Returns (u16 at hdr+0x3e) >> 15 = the "new/unread" bit. Pure.
  live: 16 calls -> 0.  Native: return (*(uint16_t*)(a0+0x3e)) >> 15.

slot 283 (+0x46c) -> 0x1001ac60 (jmp 0x1001fef0)                                   conf: HIGH
  cdecl, 0 args. Returns the signed-in account ID as a u64 in edx:eax (globals
  0x10404a88/0x10404a8c: the presence credential id).
  FFXiMain: 0x100f4ab0 (job step: stores as "my id"), 0x100e68b0 (friend add: returns -3 when
  the target id equals my id).
  Native: return a fixed non-zero 64-bit id (the account id); 0 would collide with empty ids.

slots 284 (+0x470), 285 (+0x474), 286 (+0x478), 287 (+0x47c) -> 0x1001acb0 / ac80 / ad10 / ace0
                                                                                  conf: HIGH
  cdecl, a0 = hdr* (0x48), a1 = char* out (0x200). Builds the local file path of a mail:
  install directory id 7 (284), 8 (285), 5 (286), 6 (287) via slot-126's implementation 0x10048be0,
  the id fields of hdr IN PLACE: writes hdr q[0], q[8]). Return value = end of string / junk;
  FFXiMain ignores it (it reads the path).
  FFXiMain: mail steps 0x100f5030/5170/51c0/5210/53d0/5460/54c0/56b0/5700/5750/6690/67b0/68a0,
  which then open/read/write that path with 921..931.
  Native: a1[0] = 0 (empty path; the following 921 open fails harmlessly); return 0.

slot 288 (+0x480) -> 0x1001b500                                                   conf: HIGH
  cdecl, a0 = callback (void(*)(...)) or 0. Resets 0x100748d8 = -1, stores a0 in 0x100aa974
  (gamecore calls it on incoming mail notifications). Returns a0 (eax = the argument).
  FFXiMain: 0x100f1d10 registers 0x100f28c0; 0x100f1e80 registers 0 (unregister). Return ignored.
  live: 288(0x100f28c0) = 0x100f28c0 (rebased), 288(0) = 0.
  Native: store a0; return a0. Never call the callback.

  Native: return 0.                                                               conf: HIGH
slot 290 (+0x488) -> 0x1001ad60   not used by FFXiMain. cdecl, 2 args. Native: return 0.

slot 291 (+0x48c) -> 0x1001b6d0                                                   conf: HIGH
  cdecl, a0 = const char* src (text line from a mail index file), a1 = hdr* out (0x60 bytes).
  strlen(src) < 0x60 -> returns 0xffffec00 (-5120), nothing written. Else decodes 0x60 bytes of
  src into a1 (0x100078a0) and unscrambles the id fields (q[0], and q[8] unless the type bits of
  Returns 0.
  FFXiMain: 0x100f5f80 / 0x100f5b40 / 0x100f5c40 / 0x100f5d20 / 0x100f6990 (iterate entries of a
  mail directory; != 0 -> skip the entry).
  live: 13 calls, 7 x -5120 and 6 x 0.
  Native: return 0xffffec00 (skip). Unreachable anyway when 930 reports 0 entries.

slot 292 (+0x490) -> 0x1001a6d0                                                   conf: MED
  cdecl, a0 = hdr*. Swaps sender/recipient ids and name bytes IN PLACE (reply header), refreshes
  the time, and if the new sender is me (283) copies my handle name, else "unknown". Return junk.
  FFXiMain: 0x100f57d0 (reply compose). Native: no-op; return 0.

slot 293 (+0x494) -> 0x100203a0                                                   conf: MED
  cdecl, a0 = PIB blob (loaded file). Relocates the blob's internal offsets to pointers IN PLACE
  (once; flag at +0x24) and returns a pointer to the parsed header, or 0.
  FFXiMain: dead loader 0x100e7db0 (0 -> 100182f0(0x7d3)); gamecore 667 uses it for the FAQ.
  Native: return 0.

slot 294 (+0x498) -> 0x10020210                                                   conf: MED
  cdecl, a0 = PIB blob. Decrypts (0x100081e0) and relocates an encrypted PIB in place; returns a0
  or 0. FFXiMain: dead loader 0x100e80a0. Native: return 0.

slot 295 (+0x49c) -> 0x10020830  not used by FFXiMain. cdecl (db, name, ...) -> field ptr or 0.
  Native: return 0.
slot 296 (+0x4a0) -> 0x10020430                                                   conf: MED
  cdecl, 4 args (db, query node*, field name e.g. "z_hid", value*). Fills a query node.
  FFXiMain: 0x100e8230 (effectively unreachable, see 1e). Native: return 0.
slot 297 (+0x4a4) -> 0x10020720                                                   conf: HIGH
  cdecl, a0 = node*, a1 = op (7 = "with value"), a2 = value. Writes node+4 = op; for op 7 also
  node+0xc |= 1 and, if a2 != 0, node+0xf = 1, node+0x10 = a2. Return junk.
  Native: implement (3 stores) or no-op; unreachable.
slot 298 (+0x4a8) -> 0x10020750  = 297(a0, a1, 0). Not used by FFXiMain. Native: no-op.
slot 299 (+0x4ac) -> 0x100207a0                                                   conf: HIGH
  cdecl VARARGS: a0 = n, then n node pointers: links them as a list (each non-NULL node's
  d[0] = previous non-NULL node) and returns the last non-NULL node (0 if n<=0). FFXiMain:
  0x100e8230 (299(1, node)). Native: implement (trivial).
slot 300 (+0x4b0) -> 0x10020770  not used by FFXiMain. cdecl (list, node): appends; 1 or -2054.
slot 301 (+0x4b4) -> 0x10020880  START PIB query request (db, nodes, out). Returns handle / <0.
  FFXiMain: 0x100e8300 (unreachable). Native: return 0.                           conf: MED
slot 302 (+0x4b8) -> 0x10020bb0  POLL of 301. cdecl, a0 = handle. Native: return 1.   conf: HIGH

--- 422, 465: text / progress ---

slot 422 (+0x698) -> 0x100302b0                                                   conf: MED
  cdecl, a0 = char* text, a1 = byte flag, a2 = mode (-1 / 2, from [0x10456a68]+0x18/+0xc).
  FAQ-search text normalisation/matching (strings "&amp;", "&quot;"...), returns a match
  score/flag used as boolean. FFXiMain: 0x10216490 <- 0x10216060 (FAQ search): 0 -> -1 (no match).
  Unreachable once 667 fails. Native: return 0.

slot 465 (+0x744) -> 0x100482a0                                                   conf: HIGH
  cdecl, a0 = handle from slot 464 / 1535 / 1536 (server-side settings backup "FFXI%d.DAT",
  FFXiMain: 0x10244a90 loops (drawing the "netwait/netbar" progress bar) until 100 or <0;
  0x1023c550 polls per frame (<0 -> stores error; <100 -> shows "*-0").
  Native: handles that the native 464/1535/1536 never issue cannot arrive if those fail; if the
  native 464 (other group) hands out a handle, return 100 for it. Otherwise return -1.

--- 638..669: Help Desk FAQ search (kb_faq.pib) ---
All cdecl. None is reached unless 667 succeeds (1d). Retail bodies hold a mutex
(0x10030ce0/0x10030d20) and use a search thread.
  638 (+0x9f8)  -> 0x1002fe70  0 args, cancel/reset search.                 Native: return 0.
  639 (+0x9fc)  -> 0x1002fe20  unused by FFXiMain.                           Native: return 0.
  640 (+0xa00)  -> 0x1002fe40  a0 = work buffer (aligned to 64 and kept).     Native: return 0.
  641 (+0xa04)  -> 0x1002fec0  0 args, shutdown (closes the mutex). Called by 0x10216410 even
                               after a failed 667.                           Native: return 0.
  642 (+0xa08)  -> 0x1002fef0  a0 = category id, select category.           Native: return 0.
  643 (+0xa0c)  -> 0x1002ff90  a0 = index, select sub-category.              Native: return 0.
  644 (+0xa10)  -> 0x10030000  0 args, build category list in the buffer.    Native: return 0.
  645 (+0xa14)  -> 0x100300c0  a0 = -1, select.                               Native: return 0.
  646 (+0xa18)  -> 0x10030140  unused.                                        Native: return 0.
  647 (+0xa1c)  -> 0x100301c0  0 args, returns count/pointer or 0.            Native: return 0.
  648 (+0xa20)  -> 0x100308b0  unused.                                        Native: return 0.
  649 (+0xa24)  -> 0x100308c0  poll search: 0 busy, >0 count/done, 0x7fffffff overflow. FFXiMain
                               0x102164d0 polls it N times per frame; 0 = keep waiting.
                               Native: return 1 would claim results; return 0 keeps a (disabled)
                               UI waiting. Unreachable: return 0.
  650 (+0xa28)  -> 0x10030930  a0 = page/index, start fetch.                 Native: return 0.
  651 (+0xa2c)  -> 0x100309a0  poll fetch: 0 busy, >0 done (z_id...).         Native: return 0.
  652..666 (+0xa30..+0xa68) -> 0x10030c90, 0x1004d320..0x1004ddc0: unused by FFXi/FFXiMain.
                               Native: return 0.
  667 (+0xa6c)  -> 0x1002fd50  a0 = kb_faq.pib blob, a1 = kb_faq.pfb blob, a2 = kb_faq_idx.pib
                               blob. Relocates/decrypts them (293/294 internals), returns the
                               work-buffer size needed (non-zero) or 0 on failure.
                               FFXiMain: 0 -> FAQ disabled cleanly (1d).
                               Native: return 0.                              conf: HIGH
  668 (+0xa70)  -> 0x10030890  unused.                                        Native: return 0.
  669 (+0xa74)  -> 0x10030c00  a0 = field 0..7 (z_id, z_cate1, z_cate2, z_que, z_ans, z_ctime,
                               z_mtime, z_locl), a1 = result index. Returns a field node pointer
                               or 0 (FFXiMain skips 0).                       Native: return 0.

--- 836: service-client enable ---

slot 836 (+0xd10) -> 0x100458c0                                                   conf: HIGH
  cdecl, 0 args. = 0x100458d0(1): if the online session is not initialised (0x103df7f8 == 0)
  returns 1; else returns the flag 0x10099254 and clears it (0x1009aa60 = old value).
  FFXiMain: 0x100f1f10 only (see 1c): == 1 -> enable the in-game service client and queue the friend
  and mail jobs; anything else -> do nothing, return.
  live: 1 (once, during lobby bring-up).
  Native: return 0 (service client stays disabled; recommended "not connected").

--- 921..931: async file channels (4 channels at 0x100be0f8, worker thread) ---
All cdecl. Channel handle 0..3; bad handle -> 0xffffd800 (-10240); subsystem not started ->
0xffffd7fe (-10242).                                                             conf: HIGH
slot 921 (+0xe64) -> 0x1002ec30   a0 = path, a1 = mode flags (1 = read, 0xe = create/write).
  Opens asynchronously; returns channel or <0 (NULL path -> -10240).
  FFXiMain: 0x100f19b0 (dead profile loader), 0x100f3e30 (exists-check: <0 -> "absent", step done),
  0x100f3f20 (write mail file: <0 -> job code 0x13), 0x100f40d0 (read).
  Native: return 0xffffd800 ("cannot open"). Benign for the exists-check; the write/read paths
  are only reachable from UI-started mail jobs and end with a job error code (no crash).
slot 922 (+0xe68) -> 0x1002e920   a0 = channel. Poll open: 0 busy, 1 open (stores OS handle), <0.
  Native: return 0xffffd800.
slot 923 (+0xe6c) -> 0x1002eeb0   a0 = channel. Close (ignores bad handles). Return junk; FFXiMain
  ignores it. live: 1.  Native: return 1.
slot 924/925 (+0xe70/+0xe74) -> 0x1002ef50 / 0x1002f050: unused by FFXiMain. Native: return -10240.
slot 926 (+0xe78) -> 0x1002ec70   a0 = channel, a1 = buf, a2 = size: start read. <0 = error.
  FFXiMain 0x100f19e0 returns a1 on success. Native: return 0xffffd800.
slot 927 (+0xe7c) = slot 929 (+0xe84) -> 0x1002edc0   a0 = channel, a1 = int* bytes. Poll
  read/write: 0 busy, 1 done (*a1 = bytes), <0 error. Native: return 0xffffd800.
slot 928 (+0xe80) -> 0x1002ee60   a0 = channel, a1 = buf, a2 = size: start write.
  Native: return 0xffffd800.
slot 930 (+0xe88) -> 0x1002f410   a0 = channel, a1 = int* count (may be 0). Poll a directory
  listing started by 931: 0 busy; 1 done with *a1 = entries found (0..max); <0 error.
  FFXiMain 0x100f42e0: 0 -> busy; <0 -> close, error 0x14 (and job+8); done -> 923(ch), then
  count <= 0 -> 0x17 (no more files), else iterate entries (0x18).
  live: 1 (count written, 2..5 mail files existed locally).
  Native: if (a1) *a1 = 0; return 1.
slot 931 (+0xe8c) -> 0x1002f0d0   a0 = directory path, a1 = out buffer (entries of 0x208 bytes
  from a1+8), a2 = first index, a3 = max entries (5). Starts "list <dir>/*" asynchronously;
  returns channel or <0. FFXiMain 0x100f42e0: <0 is retried 10 times, then error 0x14 (reported).
  live: 931(dir, buf, 0|5, 5) = 0.
  Native: return 0 (fake channel; 930 then reports 0 entries).

--- 1004..1006: service error-message table ---
slot 1006 (+0xfb8) -> 0x10019570                                                  conf: MED
  cdecl, a0 = blob, a1 = size. Decrypts (0x100081e0) and relocates an error-message table in
  place; returns a0 or 0. FFXiMain: job step 0x100f6b50 (job started by 0x100f3d10 <- 0x100f2770
  <- 0x100f7630 <- 0x10113cb0 = the service-error reporter, to fetch message text). 0 -> step code
  0x10 (job fails, requester callback gets 0x10).
  Native: return a0 (pretend OK) so the text path runs 1004/1005 below.
slot 1004 (+0xfb0) -> 0x10019600                                                  conf: MED
  cdecl, a0 = table (1006 result), a1 = error code, a2 = char* dst, a3 = size (0x400).
  Formats the message for a1 ("UNKNOWN ERROR [%d]%s", "(s%04d)", "(w%07d)"). FFXiMain: dst[0]
  != 0 -> done, else calls 1005. Native: write "Service error %d" (or "") into a2; return 0.
slot 1005 (+0xfb4) -> 0x100197f0   same arguments, fallback formatter. Native: as 1004.

--- misc ---
slot 1132 (+0x11b0) -> 0x1002e6f0    TEXT INPUT CONVERSION - NOT A STUB            conf: HIGH
  cdecl, a0 = const u8* src, a1 = u8* dst, a2 = src length. = 0x1002e530(src, dst, len, 0, 0).
  Called by FFXiMain 0x101b6820, the text-input box's "add typed character" handler, for EVERY
  typed character: 1132(&ch_pair, tmp, 1); if strlen(tmp) == 0 the character is rejected.
  So chat/text entry depends on it. Algorithm (attr arrays unused when either attr pointer is
  NULL, which is always the case here):
    i = 0; o = 0; count = 0;
    while (i < len) {
      b = src[i++];
      if (b < 0x80) { if (b == 0) break; dst[o++] = b; continue; }
      if (LATIN) {                         // gamecore global 0x100aa318 != 0
        count++; dst[o++] = 0x85;
        dst[o++] = (b < 0xc0) ? (b - 0x40 + (b == 0xbf)) : (b - 0x21);   // 0x80..0xbe -> 40..7e,
        continue;                                                        // 0xbf -> 80, c0.. -> 9f..
      }
      k = b - 0xa1;                         // JP mode
      if (k < 0x3f) {                       // half-width katakana 0xa1..0xdf -> full-width SJIS
        count++; kind = 2;
        if (i < len) { m = (u8)(src[i] + 0x22); if (m < 3) kind = m; }   // next 0xde / 0xdf
        w = TBL[kind][k];                   // u16, TBL[0]=0x10076644 (dakuten), TBL[1]=0x100765c4
        if (w != TBL[2][k]) { i++; count++; }  // (handakuten), TBL[2]=0x10076544 (plain)
        dst[o++] = w & 0xff; dst[o++] = w >> 8;     // stored so bytes come out as SJIS lead,trail
        continue;
      }
      if (i == len) break;                  // SJIS lead byte without trail: dropped
      dst[o++] = b; b = src[i++]; if (b == 0) break; dst[o++] = b;   // copy the 2-byte pair
    }
    dst[o] = 0; return count;
  The three 63-entry u16 tables are in gamecore .data at the addresses above (copy them verbatim;
  e.g. plain[0] = 0x4281 -> bytes 81 42).
  LATIN flag: 0x100aa318 is set only by slot 965, which FFXi/FFXiMain never call; the Viewer
  (app.dll 0x1001a19d) calls 965(language != 0) with its language global 0x105c7b44
  (0 = Japanese). A host with no Viewer must choose: LATIN = 1 for English/European clients.
  Native: implement exactly as above with LATIN = 1 (0 for a Japanese client). Return count.

slot 1152 (+0x1200) -> 0x10021e30                                                 conf: MED
  cdecl, 8 args. Formats the service's "last active" text ("z_aa_mt", " are", " minutes", "z_aa_e") from
  a PIB record into a buffer; <0 on error. FFXiMain: 0x100f1a10 (<0 -> 100182f0 report) <- 0x100e8340,
  the completion callback of the unreachable 0x100e81b0 query.
  Native: write "" to the output buffer if identifiable; return 0.

slot 1483 (+0x172c) -> 0x1001add0                                                 conf: HIGH
  cdecl, a0 = int message id, a1 = char* dst, a2 = int dst size, a3 = const char* arg (may be 0).
  Looks a0 up in a 10-entry table (ids 1,9,10,11,12,14,15,16,18,19 -> text slots 0..9 at
  0x100743d8 + n*128, filled at run time; all empty in the image). Type flag 1 -> 258(dst, a2-1,
  template, a3 ? a3 : ""); otherwise (and for unknown ids) strncpy(dst, template or "", a2-1),
  NUL-terminated. Return value ignored by FFXiMain.
  FFXiMain: 0x10200df0 (mail viewer of the service, appends a header line to its text buffer).
  Native: if (a2 > 0) a1[0] = 0; return 0.

slot 1535 (+0x17fc) -> 0x10048060                                                 conf: MED
  cdecl, 4 args (a0 = data, a1 = size, a2 = 0, a3 = name "%s-%d"). Starts the upload of a
  FFXiMain: 0x10244b50 (config menu "save settings to server"): <0 -> returns -2 (the menu shows
  its failure message).
  Native: return 0xffffff00 (fail). There is no server-side settings storage.

slot 1536 (+0x1800) -> 0x100481d0                                                 conf: HIGH
  cdecl, a0 = buffer, a1 = size, a2 = info* (FFXiMain reads byte +0x15 afterwards). Starts the
  download (request type 9). a0 or a1 == 0 -> 0xffffec00; no free slot -> 0xffffff00; else handle.
  FFXiMain: 0x10244980 ("load settings from server", after 464): <0 -> -2 (failure message).
  Native: return 0xffffff00 (fail). (If instead a handle is returned, 465 must reach 100 and the
  buffer and a2 must hold a valid FFXI%d.DAT image; do not do that.)

===================================================================================================
3. NATIVE SUMMARY TABLE (all cdecl)
===================================================================================================
  return 0 (no-op):      165 174 183 184 185 186 187 188 197 199 277 289 290 292 293 294 295 296
                         301(start) 422 638..648 650 652..666 668 669 1152 1483(+dst[0]=0)
  async start -> 0:      175 179 181 208 273 275 278(+zero a0) 280 301 931
  async poll  -> 1:      166 176 180 182 274 276 279 281 302 930(+*a1=0) 209(see block)
  presence store:        189 190 204 206 207 (written by native 195)
  records:               167/169 (zeroed), 173 (handle 0 valid), 177 (REQUIRED: selected char)
  exact reimplementation: 258 (sprintf-like), 282 (bit), 283 (u64 id), 288 (store, return a0),
                         297, 299, 1132 (text input conversion, LATIN=1)
  fail on purpose:       836 -> 0 (service client off), 667 -> 0 (FAQ off), 921/922/924..929 ->
                         0xffffd800, 1535/1536 -> 0xffffff00, 291 -> 0xffffec00, 270 (zero hdr)
  text:                  271/272/284..287 -> empty string, 1004/1005 -> short text, 1006 -> a0,
                         465 -> 100 for a native handle else -1

===================================================================================================
NOT DETERMINED / CAVEATS
===================================================================================================
- 177's remaining q[0x10] bits and the exact meaning of w[2] other than "1 = FFXI"; whether the
  world word in 0x100efe00's packed id can exceed 255 (then it overlaps the char-id high byte).
- 185/187 argument meanings beyond (slot, u64 id, handle) were not traced; 270/272/275/280 field
  layouts are approximate (stubs do not depend on them).
- 1004/1005 exact text formats; 1152 argument roles; 422 exact return semantics.
- Whether some FFXiMain UI keeps retrying a service job that ends in an error code (e.g. mail send
  after 921 fails). Only UI-initiated paths reach those, and only with service features the host does
  not offer; a trapping/logging table will show it if it happens.
- 1132 LATIN value: inferred from app.dll (965 called with language != 0); the US Viewer value
  was not observed live.
