mirror of
https://github.com/ProjectLeonida/mandy.git
synced 2026-12-06 20:58:36 +00:00
385 lines
31 KiB
Markdown
385 lines
31 KiB
Markdown
# Button prompt glyphs
|
|
|
|
The title draws its button prompts from one Scaleform movie, and it has only the Xbox set: the dump holds no
|
|
PlayStation or keyboard glyphs. This note records the movie's format, which export is which button and who asks for
|
|
them, measured on the user's own `data.rpf`. It holds no shapes. `tools/ps_prompt_glyphs.py` builds an original
|
|
PlayStation set, `tools/pc_prompt_glyphs.py` a keyboard-and-mouse set from its own built-in key caps or from pictures
|
|
the player supplies, `tools/live_prompt_glyphs.py` both in one movie that follows a device switch during play,
|
|
`tools/prompt_glyph_movies.py` builds them where the runtime looks (from the D3D12 launcher and make_game.py's
|
|
runtime stage), and the runtime serves the one for the device in use.
|
|
|
|
## The movie
|
|
|
|
| fact | value |
|
|
|---|---|
|
|
| where | `data.rpf`, a zlib stream at archive offset `0x117d7000` (found by zlib scanning; the TOC is not used) |
|
|
| size | 9,644 bytes stored, 28,148 bytes inflated (the inflated length is also the length field of the header) |
|
|
| signature | `GFX` (uncompressed Scaleform container), version byte 42 (`GFX*`), then the u32 file length |
|
|
| stage | 1 frame, 30 fps, frame label `platform_xbsx_input_icons_Main` |
|
|
| tags | GFx exporter info (1000, library name `input_icons`), FileAttributes (69: ActionScript 3), background colour, frame label, 131 DefineShape3, 38 DefineSprite, ExportAssets (56), DoABC (82, 9,516 bytes, lazy-init name `frame1`), SymbolClass (76, 39 entries), ShowFrame, End |
|
|
| symbols | 38 exports `platform_xbsx.input_icons.Main_Button_<N>` (N = 4..39, 58, 59), each a one-frame sprite of 2 to 5 vector shapes (no bitmaps); the SymbolClass binds each sprite to the class `platform_xbsx.input_icons:Main_Button_<N>` and one more entry, id 0, to the document class `Main` |
|
|
| canvas | every sprite is 1280 x 1280 twips (64 x 64 px), registration at the top left; exceptions: N = 16 and 25 (4..1281 x 21..1265), 34 and 36 (the bumpers, about 1279 x 775 starting at y 252) and 35 and 37 (the triggers, x 31..1254) |
|
|
| drawing | counted over all 131 shapes: 103 have one solid fill and no stroke, 28 one stroke and no fill; the fills are opaque white (41), black (55) and grey 103 (7, the unlit D-pad), every stroke is opaque black and 60 twips (3 px) wide; all 131 placements are PlaceObject2 with a translation only (no scale, rotation or colour transform) |
|
|
|
|
The symbol name is built outside this movie, by the prompt class of the larger movies (next section); the executable
|
|
also holds the format string `platform_xbsx.input_icons.Main_Button_%d`. Character ids of the original sprites follow
|
|
the export order, 5, 10, 16, 20, ..., 169 (shapes in between); a replacement does not need them, only the export names
|
|
and the class names. Its 131 shapes and 38 sprites take 15,226 bytes; the other tags and the header take 12,922.
|
|
|
|
## Who asks for a glyph, and when
|
|
|
|
Read from the ActionScript blocks of the user's own movies with a disassembler written for this note (2026-11-27;
|
|
none of its output is kept here).
|
|
|
|
- **This movie holds no logic.** Its block (9,505 bytes of ABC, 44 classes) is a symbol library: the document class
|
|
`Main` (a `Sprite`, through `rockstar.core.Gfx`) with 38 constants bound to 38 empty `mx.core.SpriteAsset`
|
|
subclasses, and three helpers (a string hash, a stub of Scaleform's extensions, an `ExternalInterface` wrapper). It
|
|
has no frame script, no event listener and no timer; its constructors turn Scaleform's extensions on and register a
|
|
sound callback. Nothing in it reads a platform or a device.
|
|
- **The larger movies ask.** Three movies of the archive carry a copy of the class `rockstar.input_icons.InputIconV2`
|
|
(exporter names `generic_movie`, `hud` and `map_scripted_movie`, at `0x1176f000`, `0x11786000` and `0x117da000`, each
|
|
stored as zlib chunks of 64 KiB), and the HUD movie one more class with the same loader:
|
|
- `loadAssets()`, static, called from the movie's `Main` constructor: unless it has already done so, it loads the
|
|
URL `input_icons.gfx` through a `flash.display.Loader` and fixes the name prefix,
|
|
`"platform_" + flash.system.Capabilities.os.toLowerCase() + ".input_icons.Main_Button_"`. The platform part is the
|
|
player's `Capabilities.os`, a constant of the build, not a device.
|
|
- `init(...)`, reached from `initializePress`, `initializeHold`, `initializeMash`, `initializeRotate` and their
|
|
variants, so **each time a prompt is set up**: the icon container's children are removed, the class named
|
|
`prefix + iconID + DEVICE_PREFIXES[device]` is looked up in the loaded movie (`applicationDomain.getDefinition`),
|
|
and a new instance of it is added. Until the movie is loaded a white disc is drawn instead.
|
|
- `DEVICE_PREFIXES` is a static list of name suffixes, one empty string to begin with; the static
|
|
`setAvailableDevices(list)` replaces it. No ActionScript in the three movies calls `setAvailableDevices`, and their
|
|
own calls of the initialisers pass device 0. What the executable passes when it calls them is not in the movies.
|
|
|
|
## N to button
|
|
|
|
Read from rendered sprites. `tools/xbox_prompt_glyphs.py` is the rasteriser of the DefineShape3 records:
|
|
|
|
```powershell
|
|
python -I tools/xbox_prompt_glyphs.py --from-archive "<package>/data.rpf" --out <folder outside the repository>
|
|
```
|
|
|
|
writes one PNG per export (named after it, the 64 x 64 canvas and a pixel around it at 4x), a contact sheet `sheet.png`
|
|
and a listing `README.txt`. The pictures are the game's artwork: the tool refuses a folder inside the repository, and
|
|
they are never committed. Some outlines leave the 64 x 64 canvas by up to 0.3 px (N = 6: x from -0.30), hence the
|
|
margin. It stops with an error on anything it does not draw (gradient or bitmap fills, colour transforms, clip layers);
|
|
this movie has none.
|
|
|
|
| N | button | N | button |
|
|
|---|---|---|---|
|
|
| 4 | D-pad up lit | 24 | right stick right |
|
|
| 5 | D-pad down lit | 25 | right stick press (R3) |
|
|
| 6 | D-pad left lit | 26 | right stick, plain |
|
|
| 7 | D-pad right lit | 27 | right stick up/down |
|
|
| 8 | D-pad, nothing lit | 28 | right stick left/right |
|
|
| 9 | D-pad, all lit | 29 | right stick rotate (arrow on the left) |
|
|
| 10 | D-pad up/down lit | 30 | A |
|
|
| 11 | D-pad left/right lit | 31 | B |
|
|
| 12 | left stick up | 32 | X |
|
|
| 13 | left stick down | 33 | Y |
|
|
| 14 | left stick left | 34 | LB |
|
|
| 15 | left stick right | 35 | LT |
|
|
| 16 | left stick press (L3) | 36 | RB |
|
|
| 17 | left stick, plain | 37 | RT |
|
|
| 18 | left stick up/down | 38 | Menu (three bars) |
|
|
| 19 | left stick left/right | 39 | View (two overlapping windows) |
|
|
| 20 | left stick rotate (arrow on the left) | 58 | left stick rotate (arrow on the right) |
|
|
| 21 | right stick up | 59 | right stick rotate (arrow on the right) |
|
|
| 22 | right stick down | | |
|
|
| 23 | right stick left | | |
|
|
|
|
Not identified: nothing is unknown by shape, but the Xbox/Guide button has no glyph in the set, and which of the two
|
|
rotate variants (20/29 against 58/59) the title picks for which prompt is not known. N 8 and 9 are told apart only
|
|
by the lighting; which one the title uses for a plain "D-pad" prompt is not measured.
|
|
|
|
## The PlayStation package (not read)
|
|
|
|
The user's PS5 copy is one package file, `EP1004-PPSA38500_00-GRANDTHEFTAUTO00-A0102-V0102.pkg` (212,421,953,822
|
|
bytes; header magic `7F 46 49 48`). Samples of 64 KiB at 5, 25, 50, 75 and 95 % of the file measure 7.85-8.00 bits a byte:
|
|
the game's files inside are encrypted (a package's image is, until the console's keys open it). Under the ground rules
|
|
nothing is decrypted, so the title's own PlayStation glyph movie, if the PS5 build has one, is not read from it; the
|
|
replacement below stays the PlayStation set. A PS5 build's files already extracted by the user's own console as a plain
|
|
folder could be read like the Xbox archive (2026-11-27).
|
|
|
|
## The PlayStation replacement
|
|
|
|
`tools/ps_prompt_glyphs.py` writes a movie with the same export names, canvas sizes and class names:
|
|
|
|
| Xbox N | replacement |
|
|
|---|---|
|
|
| 30, 31, 32, 33 (A, B, X, Y) | cross, circle, square, triangle in blue, red, pink, green |
|
|
| 34, 36 / 35, 37 | L1, R1 / L2, R2 |
|
|
| 38 / 39 | Options / touchpad (the console's View is the touchpad on the PlayStation layout) |
|
|
| 16, 25 | L3, R3 |
|
|
| 4..11 and 12..29, 58, 59 | the same d-pad and stick prompts, drawn again |
|
|
|
|
Shapes are discs, polygons, thick polylines and a small stroke font written in the tool. See the tool's docstring for
|
|
the options (`--out`, `--zlib`, `--pad-to`, `--selftest`). The movie is 13,551 bytes, 5,721 as one zlib stream, below the
|
|
original stored 9,644, so it can be padded to that size. The ActionScript block is minimal (empty `MovieClip`
|
|
subclasses, no `Main` behaviour, no sound hook); whether the title's loader needs more has not been tried in the game.
|
|
|
|
## The keyboard and mouse replacement
|
|
|
|
`tools/pc_prompt_glyphs.py` (standard library only) turns pictures, one per N, into the shapes of the same 38 sprites:
|
|
its own built-in set unless a folder of the player's pictures (`*Main_Button_<N>.png`) is named with `--glyphs`. The
|
|
first set it was written for was drawn by a friend of the user from scratch (W/A/S/D and arrow keys with one or more
|
|
keys lit, a mouse in a circle for the right stick, key caps for the face buttons and shoulders); its licence is not
|
|
stated, and neither those pictures nor a movie built from them is in the repository.
|
|
|
|
### The built-in set
|
|
|
|
Key caps, arrow keys and a mouse drawn by the tool itself (`builtin`, `BUILTIN`): rounded rectangles, quadratic
|
|
curves, polygons and a stroke font of its own (16 capitals), painted with exact-area anti-aliasing into the same
|
|
in-memory 4x pictures (264 x 264) that the tracer reads from a player's folder, so the two take one path. No picture,
|
|
font, Pillow or game file is needed. Black rim (heavier at the bottom, the cap's edge), white face, black label; the
|
|
lit mouse button is the grey (103, 103, 103); the movement arrows around the mouse are white with a black edge, so
|
|
they show on a dark scene and a light one.
|
|
|
|
| N | shows | N | shows |
|
|
|---|---|---|---|
|
|
| 4, 5, 6, 7 | the up, down, left, right arrow key | 25 | C |
|
|
| 8, 9 | the four arrow keys (inverted T) | 21-24, 26, 29, 59 | the mouse, arrows four ways |
|
|
| 10 / 11 | up over down / left beside right | 27 / 28 | the mouse, arrows up and down / left and right |
|
|
| 12, 13, 14, 15 | W, S, A, D | 30, 31 | SPACE, CTRL (wide caps) |
|
|
| 16 | SHIFT (a wide cap) | 32, 33 | R, F |
|
|
| 17, 20, 58 | W over A S D (inverted T) | 34 / 36 | TAB (a wide cap) / Q |
|
|
| 18 / 19 | W over S / A beside D | 35 / 37 | the mouse, right / left button lit |
|
|
| | | 38, 39 | ESC, M |
|
|
|
|
The keys are those of the runtime's on-foot keyboard table (`gameinput/kbm.rs`, `SHARED` and `FOOT_ONLY`) for the pad
|
|
input of each Xbox glyph; `tests/test_pc_prompt_glyphs.py` reads that table and fails when a label no longer matches.
|
|
Checked on 2026-11-29: every slot matched (Y is both F and E on foot; the cap shows F, the key that enters and
|
|
leaves vehicles in both tables).
|
|
|
|
**Size.** Players found an earlier set "covered other UI". Measured on the user's movie (each Xbox sprite drawn at 4x
|
|
with `tools/xbox_prompt_glyphs.py`, opaque bounds and covered area counted; only the numbers are kept, as
|
|
`XBOX_AREA` in the tool): the Xbox glyphs are not drawn small inside the canvas. The face buttons, sticks, Menu and
|
|
View are discs of diameter 64 that touch all four edges (3,216 canvas pixels, a 3-pixel black ring around a white
|
|
disc of diameter 58); the D-pad is a cross that reaches the same edges (2,339-2,345); the bumpers are 64 x 39 at
|
|
y 12.5..51.5 (2,161), the triggers 61 x 64 (3,496-3,534), the stick presses 64 x 62 (2,534). A square cap of 64 fills
|
|
the corners the disc leaves empty, and so it reads larger than the glyph it replaces. Every built-in picture
|
|
therefore stays inside the outline of its slot's Xbox glyph (the circle of radius 32, or the slot's bounds for 16, 25
|
|
and 34-37) and covers no more of the canvas than that glyph: a single cap is 48 x 48 (2,235 pixels, against 2,341 for
|
|
the D-pad and 3,216 for a disc), clusters and pairs 1,120-1,212, the wide caps 56-60 wide and 30-34 tall (never taller
|
|
than a single cap) with a smaller font for the long names (SHIFT, SPACE, CTRL, TAB; ESC keeps a square cap), TAB and Q
|
|
inside the bumpers' band, the mice 648 and 1,543. `footprint()` measures it and the test asserts it for every slot.
|
|
The sprites keep the Xbox glyphs' bounds (the invisible rectangle), so where a prompt's text is laid out does not move.
|
|
|
|
**Built, over the user's movie (2026-11-29):** 7,456 bytes of shapes and sprites of the 15,226 (7,770 to spare);
|
|
drawn back, 0.12 % to 0.61 % of a glyph's opaque area differs from its picture, one pixel in all more than half wrong
|
|
(N 16). The tool takes a few seconds for the whole set.
|
|
|
|
### From pictures to shapes (either set)
|
|
|
|
- **Pictures.** 8-bit PNG, the 64 x 64 canvas with one more canvas pixel on every side, at a whole multiple (264 x 264
|
|
is 4x), three flat colours with anti-aliased edges: black, white and the grey (103, 103, 103).
|
|
- **Tracing.** Each pixel is split into how much of it is covered at all, by white and by grey; the half-covered line
|
|
of each is followed between the pixel centres, placing an edge by the coverage of the two pixels it lies between
|
|
(exact for a straight edge; interpolating to one half would be up to 0.09 pixels out). Each closed line is one
|
|
painted piece, outermost first: everything opaque in black, white and grey areas over it, a letter over those, its
|
|
counter over the letter. Only a hole through the whole picture is cut out.
|
|
- **Edges.** Straight edges and quadratic curves that stay within `--tolerance` (0.03 canvas pixels) of the traced line,
|
|
none across a bend. A corner the anti-aliasing rounded is put back where the long edges on its two sides cross, when
|
|
that crossing is as near the traced line as a sharp corner leaves it; a corner the drawing rounds stays round.
|
|
- **Sharing.** A line that is the same in several pictures or at several places is defined once (the eight W/A/S/D
|
|
pictures share their outline, letters and key faces), and pieces that always appear together are one shape.
|
|
- **Size.** On that set: 76 distinct lines for 300 painted pieces, 53 shapes placed 230 times, 7,067 bytes of shapes
|
|
and sprites of the 15,226 the title's movie leaves (the Xbox set fills them; the PlayStation set takes 7,136).
|
|
- **Check.** The tool reads the movie it wrote back, draws every sprite at the pictures' scale with exact-area
|
|
anti-aliasing and compares: on that set 0.01 % to 0.48 % of a glyph's opaque area differs (4,207 of some 1.6 million
|
|
opaque pixels in all), no pixel is more than half wrong (the largest single difference is 40 %), and what is left
|
|
sits on the edges: a twip is a fifth of a 4x pixel and the pictures have edges on quarters and thirds. The glyphs
|
|
furthest out are the lit W/A/S/D and arrow sets (N 17, 9, 18) and the rotate arrows (N 58, 59, 20, 29).
|
|
`--sheet <png>` writes those drawings as a contact sheet.
|
|
- **Not checked.** The movie has not run in the title (2026-11-27). It differs from the confirmed PlayStation movie in
|
|
its shapes only, which use the level and upright edge records that movie does not (the title's own shapes have 807
|
|
of them).
|
|
|
|
```
|
|
python -I tools/pc_prompt_glyphs.py --from-archive "<package>/data.rpf" --out pc_prompt_glyphs.gfx # built-in set
|
|
python -I tools/pc_prompt_glyphs.py --glyphs <folder> --from-archive "<package>/data.rpf" --out pc_prompt_glyphs.gfx
|
|
python -I tools/pc_prompt_glyphs.py --sheet sheet.png --pictures <folder> # the built-in set drawn back, and as PNGs
|
|
python -I tools/pc_prompt_glyphs.py --selftest # pictures made by the tool itself, no game file
|
|
```
|
|
|
|
The numbers under "Size" and "Check" in this list are for the friend's set; the built-in set's are in the section
|
|
above.
|
|
|
|
## How the runtime swaps the movie
|
|
|
|
The D3D12 runtime (`leonida-hle`, `modules/glyphs.rs`, hooked in `modules/dstorage.rs` `execute`) answers the title's
|
|
read of the movie with a movie built on the player's PC, chosen by the family in use at that moment
|
|
(`gameinput::active_family()`, see [gameinput.md](gameinput.md)): the PlayStation one for a PlayStation pad, the
|
|
keyboard one for the keyboard and mouse, the title's own for an Xbox pad. The archive is never written and its table of
|
|
contents is not touched or needed.
|
|
|
|
- **What is matched.** A DirectStorage request is a file object (our `dstorage` file keeps the path the title opened it by),
|
|
an offset, a stored size, options and a destination size. A zlib request on a file named `data.rpf` at offset
|
|
`0x117d7000` whose destination size is `28,148` is the movie. The stored size is not looked at, because the runtime
|
|
never reads the archive for it: it fills the destination with the replacement itself. Whatever the table of contents says
|
|
the stored size is (it is encrypted and unused here, so it is not known), the title gets the replacement as if
|
|
inflated. A replacement stream written into the archive instead would have to fit that stored size (ours would:
|
|
5,721 bytes against 9,644 for the standalone movie), but that needs the archive changed and the stored size known; the
|
|
runtime does neither.
|
|
- **What is served.** `ps_prompt_glyphs.gfx` or `pc_prompt_glyphs.gfx` beside `leonida.exe` (or one of the six folders
|
|
above it), or the file `LEONIDA_PS_GLYPHS` or `LEONIDA_PC_GLYPHS` names (`off` leaves the title's movie in place for
|
|
that family). It must be exactly 28,148 bytes, begin with `GFX` or `FWS`, and say so in its length field; otherwise
|
|
one warning is logged and the title keeps the Xbox movie. A file is read once, when its family first needs it.
|
|
- **When.** At the title's read, so the family at that moment decides: what is connected at start (a Sony pad counts as
|
|
PlayStation, no pad at all as the keyboard and mouse, before any input), or `LEONIDA_PROMPTS`. The title reads the
|
|
movie once, about 3 s after it starts: one `the title reads its glyph movie` line in the log of a 15 minute session
|
|
with the menus opened (2026-11-27). With one family's movie, picking up another device later does not show until
|
|
the next start; the live movie of the last section follows it.
|
|
- **Built for every player.** `tools/prompt_glyph_movies.py --game <package>` writes the movies into `d3d12/target`
|
|
(above `target/diag` and `target/release`, so either build finds them; ignored by git): the keyboard one from the
|
|
built-in set (or `--pc-glyphs <folder>`), the PlayStation one, each over the title's movie in `<package>/data.rpf`
|
|
and, if that cannot be read, the standalone movie padded to 28,148 bytes. `d3d12\scripts\play-nvidia.ps1` (and so
|
|
`scripts\play-d3d12.ps1` and the `play-*` scripts, which go through it; `-PcGlyphs <folder>` for your pictures) runs
|
|
it before each start when Python is there, and make_game.py runs it in its runtime stage (`--pc-glyphs DIR`). It
|
|
prints nothing when there is nothing to do and never stops the start or the build: a set it cannot build keeps the
|
|
Xbox glyphs. A movie of the player's is never touched: a set is skipped while its variable is set (in the launcher,
|
|
`-More @{LEONIDA_PC_GLYPHS=...}`, since it clears the window's other `LEONIDA_*` variables), and when a movie file
|
|
this step did not write is in any folder the runtime searches, where this step's own copy is removed so it cannot
|
|
come first. What it wrote is told by `<movie>.stamp` beside it (the movie's SHA-256 and a digest of the tools, the
|
|
archive's size and time and the pictures); its own movie is rebuilt only when that digest changes. A cargo clean
|
|
removes them with `target\`; the next start builds them again.
|
|
- **Builds by hand.** `python -I tools/ps_prompt_glyphs.py --from-archive "<package>/data.rpf" --out ps_prompt_glyphs.gfx` builds
|
|
over the title's own movie: the shapes are replaced and every other tag (the ActionScript, export and class tables) is
|
|
kept as it is, so the title's code finds the symbols as before. The output holds those tags of the game's movie: keep it
|
|
on your PC, never commit it. `--pad-inflated 28148 --out ps_prompt_glyphs.gfx` builds the standalone movie
|
|
(with its own ActionScript block, which has never run in the title) padded to the same length.
|
|
`--mono` draws the PlayStation glyphs in a look close to the PS5's own prompts: white keys and discs with black
|
|
symbols, and the d-pad as the DualSense's four separate arrow keys pointing at the middle (the pressed ones white,
|
|
the rest grey). Its sprites have no see-through box behind them: a highlight's colour change showed that box as a
|
|
black halo.
|
|
- **Checking it.** Run with `LEONIDA_PROMPTS=playstation` (or `keyboard`) and look in the log for
|
|
`prompt glyphs: PlayStation movie loaded` (or `keyboard movie loaded`) and `prompt glyphs: the title reads its glyph
|
|
movie`, which names the family and the glyphs served. If the second line never appears, the title does not read the
|
|
movie through a zlib DirectStorage request on `data.rpf` (or not at that offset); `LEONIDA_DSTORAGE_TRACE=2` lists the
|
|
requests. The warning `a read at the glyph movie's offset is not the movie` means the offset matched but the file or
|
|
size did not.
|
|
- **Tried in the title (2026-11-27, Series X profile, `--from-archive` movie, `LEONIDA_PROMPTS=playstation`, no pad).**
|
|
Both log lines appeared about 4 s after start, and the pause menu's prompts showed the replacement glyphs with the
|
|
usual PlayStation mapping (Photo Studio on square, Select on cross, Back on circle): Scaleform accepts the movie and
|
|
the swap at the DirectStorage read works. Not tried yet: a real DualSense or DualShock 4 over HID, Bluetooth, and
|
|
whether the title reads the movie again after start (a live switch).
|
|
|
|
## Following a device switch during play
|
|
|
|
`tools/live_prompt_glyphs.py` builds `ps_live_prompt_glyphs.gfx`: the PlayStation and the keyboard set in one movie,
|
|
and ActionScript that shows the one the runtime asks for; `leonida-hle` (`modules/glyphs/live.rs`) serves it and
|
|
tells it the family in use. `LEONIDA_PROMPTS_LIVE=0` turns it off (one family's movie, as before).
|
|
|
|
### What was measured first (2026-11-29, the user's `data.rpf`, names and sizes only)
|
|
|
|
- **The movie carries its own ActionScript, and the symbol classes share one base.** `tools/abc_file.py` reads the
|
|
block (9,505 bytes of ABC) and writes it back byte for byte: 44 classes, 44 scripts, 151 methods (2,497 bytes of
|
|
code), one double in the constant pool. `Main` (`platform_xbsx.input_icons`, through `rockstar.core.Gfx`, a
|
|
`Sprite`) has 38 private class constants `Button_<N>`. `mx.core.SpriteAsset` (a `Sprite`) is the base of exactly the
|
|
38 `Main_Button_<N>` classes and of nothing else, and its constructor is the plain one (6 bytes: `getlocal0`,
|
|
`pushscope`, `getlocal0`, `constructsuper 0`, `returnvoid`); so are all 38 of theirs.
|
|
- **Two families fit.** The keyboard set takes 7,456 bytes of shapes and sprites, the PlayStation set 7,136, the
|
|
room is 15,226. One sprite per N holding both (one bounds rectangle under both, one name) instead of two, and the
|
|
shapes of both in one table: the movie comes out at 28,148 bytes with the added ActionScript and 977 bytes of
|
|
padding to spare. The Xbox set alone fills the room, so an Xbox pad keeps the title's own movie.
|
|
|
|
### The movie
|
|
|
|
- Each `Main_Button_<N>` sprite places the bounds rectangle, the keyboard pieces, then the PlayStation pieces on
|
|
top, the first of them named `p`. Without the added code both are drawn and the PlayStation glyph covers the key
|
|
cap (on 30 glyphs all of it, or all but 2 % at most on 10, 11 and 34; 15-23 % of the cap's area shows around the
|
|
d-pad cross, 4-9, and the stick presses, 16 and 25), so a movie whose code does not run looks PlayStation
|
|
whatever the device.
|
|
- To the title's block, on the player's PC (nothing of it is in the repository), the tool adds: five static
|
|
`Number` slots on `Main` in a row, `lnLo`, `lnFamily`, `lnHi`, `lnMade`, `lnShown` (slots 39-43); two for the
|
|
listener functions; four static methods, each one try block (an error drops out of the method, never into the
|
|
title): `lnShow(sprite)` shows the keyboard pieces (children 1 to before `p`) or the pad ones (`p` on) by
|
|
`visible`, the keyboard while `lnFamily == 2` (the runtime's `Family::KeyboardMouse`), does nothing when they
|
|
already are and counts a switch in `lnShown`; `lnInit` counts the prompt in `lnMade`, shows and adds an
|
|
`enterFrame` listener; `lnTick` shows on each frame while the sprite is on the stage,
|
|
and otherwise swaps its listener for an `addedToStage` one (`lnAdded`, which puts it back), so prompts taken off
|
|
the stage cost nothing and are not kept alive by a frame listener. The constructor of each `Main_Button_<N>`
|
|
calls `Main.lnInit(this)` after its own work, in a try block. (Hooking their shared base `mx.core.SpriteAsset`
|
|
once did not work: the three movies that load this one each define `mx.core.SpriteAsset` too, 45, 91 and 81
|
|
classes in all, and the second run's counters stayed at 0. Their document classes are
|
|
`platform_xbsx.generic_movie.Main`, `platform_xbsx.hud.Main` and `platform_xbsx.map_scripted_movie.Main`, so
|
|
`platform_xbsx.input_icons.Main`, whose initialiser makes the sentinels, is this movie's own.) A prompt on screen therefore follows a switch on the next
|
|
frame, not only the next prompt made.
|
|
- `lnLo` and `lnHi` hold sentinels (the doubles whose bytes are `LEONIDA1`, `LEONIDA2`), which `Main`'s static
|
|
initialiser computes before its own code (half of each, from the pool, times 2): they are in no copy of the movie
|
|
and no slot default, only in the live class. `lnFamily`'s default is a third (`LEONIDAF`), which the runtime
|
|
replaces with the family in use when it serves the movie.
|
|
- Checked without the game: `tests/test_live_prompt_glyphs.py` builds the same changes over a block made in the
|
|
title's layout, checks every path of the added code as the AVM2 verifier does (stack and scope depth, branch
|
|
targets, `label` on backward branches, locals, pool indices) and runs it in a small interpreter over fake display
|
|
objects: the family shown when made, the switch on the next frame, the listener trade off and on the stage, an
|
|
error inside caught.
|
|
|
|
### The runtime
|
|
|
|
- **What is served.** Unless `LEONIDA_PROMPTS` forces a family, a PlayStation pad or the keyboard and mouse at the
|
|
read gets the live movie (`ps_live_prompt_glyphs.gfx` where the runtime looks, or `LEONIDA_PS_LIVE_GLYPHS`); with
|
|
the keyboard, `LEONIDA_PROMPTS_PAD=xbox` -- or an Xbox pad already connected at the read with `LEONIDA_PROMPTS_PAD`
|
|
unset/`auto` (and no Sony pad present or mirrored) -- keeps the keyboard movie instead (`LEONIDA_PROMPTS_PAD=playstation`
|
|
still forces the live movie). An Xbox pad in use keeps the title's movie. Because the title reads its glyph movie once
|
|
near startup, a pad connected only after that read keeps whichever movie was served then. Without a
|
|
usable live movie, the family's own is served as before. The log line `the title reads its glyph movie` says
|
|
`glyphs="PlayStation and keyboard (live)"`.
|
|
- **Finding the slots.** A thread (`leonida-prompts-live`, below normal priority) looks 2, 4, 7, 10, 15, 20, 30, 45, 60,
|
|
90, 120, 180, 300 and 600 s after the serve through the process's committed private and mapped pages that are plain
|
|
read-write (no guard, write-combined or uncached ones), with `ReadProcessMemory` (a page freed meanwhile fails the
|
|
read instead of faulting), for the low sentinel at an 8-aligned address with the high one 2 x 8, 16, 24 or 32 bytes
|
|
above and a family value between: a class's `Number` slots in a row, as doubles or as Scaleform's `Value`, whatever
|
|
its size. The buffer it reads into is left out. A find counts only when `lnMade` and `lnShown` after it hold whole
|
|
numbers and it does not lie inside a copy of the movie (a `GFX`/`FWS` header with the movie's length less than
|
|
that length before it); both rejects are counted in the log. Every copy found is kept.
|
|
- **Writing.** On each change of `gameinput::active_family`, the family (0, 1 or 2 as a double; the low 32 bits are
|
|
zero, so a read while it is written sees the old value or the new) goes into every slot whose sentinels are still
|
|
there (read again just before, written with `WriteProcessMemory`); a slot whose sentinels are gone is dropped, and
|
|
with none left the looks start again. Unit-tested on a fake heap (`cargo test -p leonida-hle --lib glyphs`).
|
|
- **Log lines.** `prompt glyphs: PlayStation and keyboard (live) movie loaded`; `prompt glyphs: the title reads its
|
|
glyph movie`; `prompt glyphs: live family slot found at 0x... after N s` (with the stride, the copies, the MiB
|
|
looked through and the time it took); `prompt glyphs: family written PlayStation -> keyboard and mouse`;
|
|
`prompt glyphs: live code counters (...): prompts made N, pictures switched M` when found, on each write and every
|
|
30 s, with the numbers of each copy. If the slot
|
|
is never found: `the live family slot was not found` after the last look, and `live family slot not found yet` at
|
|
debug level after each (with the count of low sentinels seen, which tells a layout this search does not expect from
|
|
slots that were never made).
|
|
|
|
### The first run in the title (2026-11-29, keyboard at the read)
|
|
|
|
The movie loaded and was read, and the search found `stride=8 copies=4` 9 s after the serve (one look of 6.8 s over
|
|
14,770 MiB); six writes on six switches each reached four copies, and the prompts stayed keyboard. That version
|
|
kept the sentinels as the slots' defaults, so what was found may have been a template of defaults rather than the
|
|
live class, and its sprites put the keyboard over the PlayStation pieces, so code that never ran looked the same as
|
|
writes that missed. Both are changed above. What the next run's log tells:
|
|
|
|
- `found` with counters rising as prompts appear, and `switched` rising on switches: the code runs and the writes
|
|
land; prompts that still do not change mean the display does not follow `visible`;
|
|
- `found` with `prompts made 0` while prompts are on screen, or no find at all with `low_hits=0`: the constructor
|
|
call does not run (or `Main`'s initialiser does not), and the prompts look PlayStation on every device;
|
|
- `prompts made` rising but `switched` not rising on a switch: the writes miss the slots the code reads;
|
|
- `in_movie` or `implausible` above 0: finds of another kind were seen and left out.
|
|
|
|
The second run (2026-11-29, sentinels made at run time): found 7 s after the serve, `stride=8 copies=4`, no
|
|
reject, so `Main`'s initialiser ran in four copies and its slots are raw doubles; every switch was written to all
|
|
four, but `prompts made 0, pictures switched 0` for minutes with prompts on screen: the `SpriteAsset` hook never
|
|
ran (above).
|
|
|
|
### Device switches in the title (2026-11-30)
|
|
|
|
The live movie started in the PlayStation family. At 10:06:42.427 UTC the runtime changed
|
|
to keyboard and mouse, then to Xbox at 10:06:47.652. Each change wrote to four live family
|
|
slots. Both reads and a follow-up at 10:06:53.870 counted five prompts made and zero pictures
|
|
switched. The constructor hook ran and the runtime wrote the family values. The probe did
|
|
not verify that a prompt stayed on screen across either change, so a visible switch still
|
|
needs a test with a prompt on stage.
|
|
|
|
### Not proven until it runs in the title
|
|
|
|
Whether Scaleform runs the added code at all (its verifier), whether a symbol's frame children exist when
|
|
its constructor runs (if not, `lnShow` finds no `p` and the first frame shows the PlayStation glyph until
|
|
the first `enterFrame`), whether `enterFrame` reaches the icons, and how it stores a class's `Number` slots
|
|
(raw doubles, or `Value`s of 16 or 24 bytes, are all searched; another layout logs `not found`). The memory search's
|
|
time on the title's heap is not measured; the log line says it.
|