fix(bridge): decode legacy animation art without GDI+ (#39, 1 of 2) #42

Merged
whitlocktech merged 1 commits from fix/asset-bridge-gdiplus-anim into main 2026-11-25 23:15:11 -06:00
Member

Closes the legacy-animation half of #39 (PR 1 of 2).

The bug

On a Linux/Mono shard the Asset Bridge's legacy-MUL catalogue art fails with
[GDI+ status: NotImplemented]: the vendored Ultima.Frame ctor builds a 16bpp
Bitmap (Settings.PixelFormat) and libgdiplus cannot create one, so the ~787 legacy
anim*.mul creature thumbnails never render. The phase-4 UOP path already avoids
System.Drawing; this finishes the same migration for the legacy animation path, so
Windows and Linux share one managed path instead of a Linux-specific workaround.

The fix (overlay-only — no wire change, no PROTOCOL_VERSION bump)

Keep every byte-level vendored call (Translate, BodyConverter, FileIndex, the
ResolveAnimation/CheckEntry/AnimationSane gate, Hues.List[i].Colors) and replace
only the two calls that reach System.Drawing:

  • BridgeMul — a hand-written anim*.mul first-frame decoder to an ARGB1555
    ushort[], mirroring Ultima.Frame's run loop with BridgeUop's bounds checks. No
    Bitmap, no System.Drawing.
  • BridgeHue — Ultima.Hue.ApplyTo reproduced over a ushort[], reusing the vendored
    Hues.List[i].Colors table so a body.def-hued creature (162 Body.def entries carry a
    hue) tints identically.
  • BridgeAssetValidator — RecordReader.ReadRecordCopy hands the verdata-patched
    record bytes to the decoder; a ResolveAnimation overload surfaces the body.def hue it
    already computed and used to discard.
  • BridgeCatalog — the legacy path decodes through BridgeMul + BridgeHue →
    BridgePng; the ImagingOk gate is removed from assets.manifest/assets.fetch,
    because the body catalogue (legacy + UOP) no longer touches System.Drawing.
  • BridgeAnimParity — a [BridgeAnimParity] GM command / BRIDGE_ANIM_PARITY=1 boot
    run that compares the shipping managed decode against the vendored one pixel for pixel.
    It is the only file that still references System.Drawing, and only as the test oracle.

The record gate is unchanged, so the exact set of records served is unchanged. The
art/land path (BridgeArt) and its own imaging gate are PR 2 of 2; BridgeHue is the
shared piece it will reuse.

Verification — both gates green

Windows (local ServUO + live client): the parity harness compared every legacy record
the Bridge serves against the vendored GDI+ decode:

compared 40341  matched 40341  MISMATCHED 0  MISSED 0  EXTRA 0  (skipped 102923 records the Bridge does not serve)
RESULT: PASS — managed decode is pixel-identical to the vendored path

Linux/Mono (Ubuntu 24.04.5, Mono 6.8, libgdiplus 6.1 — the live-host versions): ServUO
loaded the prebuilt Scripts.dll, the world loaded (210k items / 43k mobiles), and the
same harness ran at boot:

oracle unavailable (GDI+ NotImplemented — a Linux/Mono host): the managed path produced 40341 sprites

i.e. the vendored path fails with the exact NotImplemented this issue reports, while the
managed path produces all 40,341 sprites — the same count that is pixel-identical on
Windows.

dotnet build Scripts.csproj -c Release → 0 warnings / 0 errors.

Docs companion (the §4.4 imaging note in docs/) follows separately.


  • AI-assisted change (see CONTRIBUTING).

🤖 Generated with Claude Code

https://claude.ai/code/session_014HJEmcaKvWQ8LsnXHKha5y

Closes the legacy-animation half of #39 (PR 1 of 2). ## The bug On a Linux/Mono shard the Asset Bridge's legacy-MUL catalogue art fails with `[GDI+ status: NotImplemented]`: the vendored `Ultima.Frame` ctor builds a **16bpp** `Bitmap` (`Settings.PixelFormat`) and libgdiplus cannot create one, so the ~787 legacy `anim*.mul` creature thumbnails never render. The phase-4 UOP path already avoids `System.Drawing`; this finishes the same migration for the legacy animation path, so **Windows and Linux share one managed path** instead of a Linux-specific workaround. ## The fix (overlay-only — no wire change, no `PROTOCOL_VERSION` bump) Keep every byte-level vendored call (`Translate`, `BodyConverter`, `FileIndex`, the `ResolveAnimation`/`CheckEntry`/`AnimationSane` gate, `Hues.List[i].Colors`) and replace only the two calls that reach `System.Drawing`: - **`BridgeMul`** — a hand-written `anim*.mul` first-frame decoder to an ARGB1555 `ushort[]`, mirroring `Ultima.Frame`'s run loop with `BridgeUop`'s bounds checks. No `Bitmap`, no `System.Drawing`. - **`BridgeHue`** — `Ultima.Hue.ApplyTo` reproduced over a `ushort[]`, reusing the vendored `Hues.List[i].Colors` table so a body.def-hued creature (162 `Body.def` entries carry a hue) tints identically. - **`BridgeAssetValidator`** — `RecordReader.ReadRecordCopy` hands the verdata-patched record bytes to the decoder; a `ResolveAnimation` overload surfaces the body.def hue it already computed and used to discard. - **`BridgeCatalog`** — the legacy path decodes through `BridgeMul` + `BridgeHue` → `BridgePng`; the `ImagingOk` gate is removed from `assets.manifest`/`assets.fetch`, because the body catalogue (legacy + UOP) no longer touches `System.Drawing`. - **`BridgeAnimParity`** — a `[BridgeAnimParity]` GM command / `BRIDGE_ANIM_PARITY=1` boot run that compares the shipping managed decode against the vendored one pixel for pixel. It is the only file that still references `System.Drawing`, and only as the test oracle. The record gate is unchanged, so the exact set of records served is unchanged. The art/land path (`BridgeArt`) and its own imaging gate are **PR 2 of 2**; `BridgeHue` is the shared piece it will reuse. ## Verification — both gates green **Windows (local ServUO + live client):** the parity harness compared every legacy record the Bridge serves against the vendored GDI+ decode: ``` compared 40341 matched 40341 MISMATCHED 0 MISSED 0 EXTRA 0 (skipped 102923 records the Bridge does not serve) RESULT: PASS — managed decode is pixel-identical to the vendored path ``` **Linux/Mono (Ubuntu 24.04.5, Mono 6.8, libgdiplus 6.1 — the live-host versions):** ServUO loaded the prebuilt `Scripts.dll`, the world loaded (210k items / 43k mobiles), and the same harness ran at boot: ``` oracle unavailable (GDI+ NotImplemented — a Linux/Mono host): the managed path produced 40341 sprites ``` i.e. the vendored path fails with the exact `NotImplemented` this issue reports, while the managed path produces all 40,341 sprites — the same count that is pixel-identical on Windows. `dotnet build Scripts.csproj -c Release` → 0 warnings / 0 errors. Docs companion (the §4.4 imaging note in `docs/`) follows separately. --- - [x] AI-assisted change (see CONTRIBUTING). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014HJEmcaKvWQ8LsnXHKha5y
wtclaude added 1 commit 2026-11-25 22:59:17 -06:00
On a Linux/Mono shard the Asset Bridge's legacy-MUL catalogue art failed with
[GDI+ status: NotImplemented]: the vendored Ultima.Frame ctor builds a 16bpp
Bitmap (Settings.PixelFormat) and libgdiplus cannot create one. This finishes,
for the legacy animation path, the GDI+-free migration §4.4 began for UOP —
Windows and Linux now share one managed path rather than a Linux workaround.

- BridgeMul: a hand-written anim*.mul first-frame decoder to ARGB1555, mirroring
  Ultima.Frame's run loop with BridgeUop's bounds (no System.Drawing, no Bitmap).
- BridgeHue: Hue.ApplyTo reproduced over a ushort[], reusing the vendored
  Hues.List[i].Colors table so a body.def-hued creature tints identically.
- BridgeAssetValidator: RecordReader.ReadRecordCopy hands the verdata-patched
  record bytes to the managed decoder; a ResolveAnimation overload surfaces the
  body.def hue it already computes and discarded.
- BridgeCatalog: the legacy path now decodes through BridgeMul + BridgeHue ->
  BridgePng; the imaging gate is removed from assets.manifest/fetch, since the
  body catalogue (legacy + UOP) no longer touches System.Drawing. The record
  gate (ResolveAnimation/CheckEntry/AnimationSane) is unchanged.
- BridgeAnimParity: a [BridgeAnimParity] GM command / BRIDGE_ANIM_PARITY=1 boot
  run that compares the managed decode against the vendored one pixel for pixel.

Overlay-only; no wire change, no PROTOCOL_VERSION bump. The art/land path
(BridgeArt) and its imaging gate are the second PR. The art family's imaging.ok
status is unchanged meanwhile.

Verified on this machine's ServUO + live client: the parity harness compared all
40,341 records the Bridge serves and every one is pixel-identical to the vendored
GDI+ decode (0 mismatched, 0 missed); 102,923 out-of-band/invalid records the
Bridge refuses were correctly skipped.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014HJEmcaKvWQ8LsnXHKha5y
whitlocktech approved these changes 2026-11-25 23:15:06 -06:00
whitlocktech merged commit db87b20fae into main 2026-11-25 23:15:11 -06:00
whitlocktech deleted branch fix/asset-bridge-gdiplus-anim 2026-11-25 23:15:11 -06:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: RunicGateway/servuo-plugins#42
No description provided.