docs: reflect full working flow + raw-D3D11 rationale + polish list

This commit is contained in:
2026-07-07 14:01:35 -05:00
parent 1305412dc2
commit 36d0f03d9d
3 changed files with 78 additions and 8 deletions

View File

@@ -65,7 +65,15 @@ cd ~/neoLegacy && git submodule update --init --recursive
only ever existed for the console targets, which aren't built)
- [x] SWF/Iggy UI replaced: the closed `iggy_w64.dll` is swapped for the open
`iggy-shim` (`iggy-shim/`), which loads UI from extracted **PNGs** + JSON
layout manifests — no Flash runtime, no `.swf` parsing. Two render paths:
a working display-tree renderer (default) and an **RmlUi** backend
(built + wired, gated `IGGY_SHIM_RML=1` pending a Wine init fix).
See [docs/UI-DESWF-ROADMAP.md](docs/UI-DESWF-ROADMAP.md).
layout manifests — no Flash runtime, no `.swf` parsing. The full game
flow works through it: **title → main menu → Play → EULA → Load/Create/
Join → Create New World → world options → generate → in-game with HUD.**
All UI subsystems function: PNG sprite rendering, bitmap-font text
(the game's own Mojangles glyphs), focus highlight, keyboard navigation,
button press, scene transitions, dynamic `FJ_List` menus, checkboxes,
tab switching, scroll-gated accept. A standard UI library, **RmlUi**
(+ FreeType), is cross-compiled and wired as a second render path,
gated `IGGY_SHIM_RML=1` pending a Wine init fix. See
[docs/UI-DESWF-ROADMAP.md](docs/UI-DESWF-ROADMAP.md).
Remaining polish: button/panel 9-slice skin art (buttons are currently
text-only), list-item font scaling, and the RmlUi runtime crash.

View File

@@ -32,7 +32,41 @@ library (RmlUi picked; NOT imgui) with behavior as if nothing changed,
(reads ~/neoLegacy-mac/ui-layout/*.json + ui-png/** + as3/**; writes
<gamedir>/uiassets/). uiassets/png is a symlink to ~/neoLegacy-mac/ui-png.
## Current state (truthful)
## UPDATE (session 2): FULL FLOW WORKS — boot to in-game
The invisible-UI problem is SOLVED and the entire critical path works:
title → main menu → Play → EULA → Load/Create/Join → Create New World →
world options → generate → **in-game with HUD**. Key changes since the
brief below:
- `raw_d3d.cpp`: raw D3D11 pipeline (device harvested from GDrawHandle first
member {ID3D11Texture2D*, SRV*, RTV*, w, h}; runtime D3DCompile; premult
blend; letterbox from bound-RT desc). GDraw draws were executing but
producing no pixels — this bypasses that. THIS is why UI now renders.
- `text_renderer.cpp`: glyphs uploaded as RGBA via textureUploadRGBA (not the
R8 GDRAW_TEXTURE_FORMAT_font path); em-unit metrics (advance*fontPx,
baseline from ascent, bitmap scaled fontPx/pixel_scale_correct); whitespace
advances w/o drawing; font-provider ranking (Mojangles_11 > _7 > Unicode).
- `scene_registry.cpp`: SetFocus(-1)=auto-focus first focusable (was matching
label nodes with default id=-1 — this unblocked every dialog/menu);
FJ_List controls (addNewItem/removeAllItems/HighlightItem/SetButtonLabel);
list-item press emits handlePress(listParentId, itemId).
- RmlUi restored to build (was temporarily stubbed via rml_stubs.cpp).
### Remaining polish (the "100%" tail)
1. Button/panel skin art: buttons are text-only; MainMenuButton selection bar
+ 9-slice dialog panels don't draw. In gen-scene-bundles.py the button art
resolves to a skin sprite but 9-slice scaling isn't applied; in ui_renderer
the panel BackgroundPanel sprite (DefineSprite_N/1.png) may be a small
9-slice source that needs stretching to the placement's child scale.
2. List-item font oversized: items inherit list node's bundle scale (e.g 4.9).
Fix: give list items a fixed fontPx independent of inherited scale, and lay
them out in the list's local pixel space.
3. RmlUi Rml::Initialise page-fault under wine (gated IGGY_SHIM_RML=1). Bisect
with logs inside rmlEnsureInit (SetRenderInterface→Initialise→LoadFontFace).
4. Then: sweep remaining scenes (inventory/containers/settings) for method
coverage; remove .swf/.arc from packaged build (uiassets/ is sole input).
## Original state brief (session 1)
- Game boots+runs on iggy-shim (Iggy DLL fully replaced). Scenes fingerprint,
bundles load, ticks paced (ReadyToTick gates while-loop — NEVER return
always-true), draws go through game's GDraw vtable (globals().gdraw).

View File

@@ -6,12 +6,40 @@ The closed-source Iggy Flash player (`iggy_w64.dll`) is **fully replaced** by an
open reimplementation, `iggy-shim`. The game links our `iggy_shim_w64.lib`
instead of RAD's; **no Flash runtime and no `.swf` parsing remain in the
render path.** UI art is loaded from the extracted **PNGs**; scene structure
from the **layout manifests**. Two render paths exist behind the same shim:
from the **layout manifests**.
**The full game flow works through the shim** — verified by screenshots at each
stage: title attract → autosave dialog → main menu → Play Game → EULA (scroll +
accept) → Load/Create/Join → Create tab → Create New World → world options
(name / seed / mode / difficulty) → Create → world generates → **in-game with
the HUD rendering.** Every UI subsystem is exercised: PNG sprite rendering,
bitmap-font text, focus highlight, keyboard nav, button press, scene
transitions, dynamic `FJ_List` population, checkboxes, tab switch.
Two render paths exist behind the same shim:
| Path | State | Notes |
|---|---|---|
| **Display-tree renderer** (`ui_renderer.cpp` + `text_renderer.cpp`) | **working, default** | Draws PNG quads + text (game's own Mojangles glyphs) directly through the game's GDraw D3D11 vtable. Boots the game, renders scenes, handles input/focus/nav. |
| **RmlUi backend** (`rml_backend.cpp` + `rml_render.cpp`) | built + linked + wired; **gated `IGGY_SHIM_RML=1`** | RmlUi 6.2 (HTML/CSS game-UI library) + FreeType, both cross-compiled for the target, rendering through the same GDraw backend. A page-fault at `Rml::Initialise` under Wine remains to debug before it can be the default. |
| **Display-tree renderer** (`ui_renderer` + `text_renderer` + `raw_d3d`) | **working, default** | Renders PNG quads + text through a raw D3D11 pipeline. The device is harvested from a GDraw texture handle (layout mirrored from the open `gdraw_d3d1x` source); shaders are compiled at runtime; text uses the game's own Mojangles bitmap glyphs uploaded as RGBA. GDraw still does texture uploads; we bind its SRVs. This is what drives the working flow above. |
| **RmlUi backend** (`rml_backend` + `rml_render`) | built + linked + wired; **gated `IGGY_SHIM_RML=1`** | RmlUi 6.2 (HTML/CSS game-UI library) + FreeType, both cross-compiled for the target, rendering through GDraw. A page-fault at `Rml::Initialise` under Wine remains to debug before it can be the default. |
### Why a raw D3D11 pipeline instead of GDraw's `DrawIndexedTriangles`?
Draw calls issued through the game's GDraw vtable executed (non-zero batch
stats) but produced no visible pixels — a render-state black box that was not
worth reverse-engineering. Harvesting the `ID3D11Device` and drawing with a
tiny owned pipeline (the same save/set/draw/restore pattern the game's
`PostProcesser` uses for gamma) made the UI render immediately and is fully
under our control.
### Known remaining polish
- **Button/panel skin art**: buttons render as text only; the `MainMenuButton`
selection bar and 9-slice dialog panels aren't drawn yet (the skin-symbol →
PNG resolution needs the 9-slice scale handling).
- **List-item font scale**: `FJ_List` items inherit the list node's bundle
scale and render oversized; items need a fixed font size.
- **RmlUi `Rml::Initialise` Wine page-fault** (see below).
## Architecture