diff options
| author | ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> | 2026-11-29 23:03:09 -0500 |
|---|---|---|
| committer | ubiquitarianism <283527159+ubiquitarianism@users.noreply.github.com> | 2026-11-29 23:03:09 -0500 |
| commit | 1fb8c4bfef2beb4dcff4665ac40b4e9678930391 (patch) | |
| tree | 2d87659a4797bbeb3a8817af4cfd64336e9e36bd /docs | |
| parent | 54374cf53e0f66d2d5c744e8dd7b678d96cb141e (diff) | |
Live prompts: sentinels made at run time, counters, PlayStation on top
The first run in the title found four copies of lnLo/lnFamily/lnHi eight
bytes apart, wrote them on every switch, and the prompts stayed keyboard.
The sentinels were the slots' defaults, so a template of defaults could
match, and the keyboard pieces were drawn over the PlayStation ones, so
code that never ran looked like writes that missed.
- Main's static initialiser now computes lnLo and lnHi (half of each
sentinel times 2) before its own code: no copy of the movie or of a
slot default holds them.
- lnMade (prompts made) and lnShown (pictures switched) follow lnHi; the
runtime reads them through the found layout and logs them when found,
on each write and every 30 s. A find needs whole numbers there and must
not lie inside a copy of the movie; both rejects are counted.
- Sprites place the keyboard pieces first and the PlayStation pieces on
top (the first named p): if the code does not run, prompts look
PlayStation on every device.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/prompt_glyphs.md | 61 |
1 files changed, 42 insertions, 19 deletions
diff --git a/docs/prompt_glyphs.md b/docs/prompt_glyphs.md index 3f83f4f66..f63ece642 100644 --- a/docs/prompt_glyphs.md +++ b/docs/prompt_glyphs.md | |||
| @@ -276,27 +276,31 @@ tells it the family in use. `LEONIDA_PROMPTS_LIVE=0` turns it off (one family's | |||
| 276 | `pushscope`, `getlocal0`, `constructsuper 0`, `returnvoid`); so are all 38 of theirs. | 276 | `pushscope`, `getlocal0`, `constructsuper 0`, `returnvoid`); so are all 38 of theirs. |
| 277 | - **Two families fit.** The keyboard set takes 7,456 bytes of shapes and sprites, the PlayStation set 7,136, the | 277 | - **Two families fit.** The keyboard set takes 7,456 bytes of shapes and sprites, the PlayStation set 7,136, the |
| 278 | room is 15,226. One sprite per N holding both (one bounds rectangle under both, one name) instead of two, and the | 278 | room is 15,226. One sprite per N holding both (one bounds rectangle under both, one name) instead of two, and the |
| 279 | shapes of both in one table: the movie comes out at 28,148 bytes with the added ActionScript (681 bytes) and | 279 | shapes of both in one table: the movie comes out at 28,148 bytes with the added ActionScript and 977 bytes of |
| 280 | 1,057 bytes of padding to spare. The Xbox set alone fills the room, so an Xbox pad keeps the title's own movie. | 280 | padding to spare. The Xbox set alone fills the room, so an Xbox pad keeps the title's own movie. |
| 281 | 281 | ||
| 282 | ### The movie | 282 | ### The movie |
| 283 | 283 | ||
| 284 | - Each `Main_Button_<N>` sprite places the bounds rectangle, the PlayStation pieces, then the keyboard pieces, the | 284 | - Each `Main_Button_<N>` sprite places the bounds rectangle, the keyboard pieces, then the PlayStation pieces on |
| 285 | first of them named `k`. | 285 | top, the first of them named `p`. Without the added code both are drawn and the PlayStation glyph covers the key |
| 286 | - To the title's block, on the player's PC (nothing of it is in the repository), the tool adds: three static | 286 | 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 |
| 287 | `Number` slots on `Main` in a row, `lnLo`, `lnFamily`, `lnHi` (slots 39-41); two for the listener functions; | 287 | d-pad cross, 4-9, and the stick presses, 16 and 25), so a movie whose code does not run looks PlayStation |
| 288 | four static methods, each one try block (an error drops out of the method, never into the title): | 288 | whatever the device. |
| 289 | `lnShow(sprite)` shows the pad pieces (children 1 to before `k`) or the keyboard ones (`k` on) by `visible`, the | 289 | - To the title's block, on the player's PC (nothing of it is in the repository), the tool adds: five static |
| 290 | keyboard while `lnFamily == 2` (the runtime's `Family::KeyboardMouse`), and does nothing when they already are; | 290 | `Number` slots on `Main` in a row, `lnLo`, `lnFamily`, `lnHi`, `lnMade`, `lnShown` (slots 39-43); two for the |
| 291 | `lnInit` shows and adds an `enterFrame` listener; `lnTick` shows on each frame while the sprite is on the stage, | 291 | listener functions; four static methods, each one try block (an error drops out of the method, never into the |
| 292 | title): `lnShow(sprite)` shows the keyboard pieces (children 1 to before `p`) or the pad ones (`p` on) by | ||
| 293 | `visible`, the keyboard while `lnFamily == 2` (the runtime's `Family::KeyboardMouse`), does nothing when they | ||
| 294 | already are and counts a switch in `lnShown`; `lnInit` counts the prompt in `lnMade`, shows and adds an | ||
| 295 | `enterFrame` listener; `lnTick` shows on each frame while the sprite is on the stage, | ||
| 292 | and otherwise swaps its listener for an `addedToStage` one (`lnAdded`, which puts it back), so prompts taken off | 296 | and otherwise swaps its listener for an `addedToStage` one (`lnAdded`, which puts it back), so prompts taken off |
| 293 | the stage cost nothing and are not kept alive by a frame listener. `SpriteAsset`'s constructor calls | 297 | the stage cost nothing and are not kept alive by a frame listener. `SpriteAsset`'s constructor calls |
| 294 | `Main.lnInit(this)` after its own work, in a try block. A prompt on screen therefore follows a switch on the next | 298 | `Main.lnInit(this)` after its own work, in a try block. A prompt on screen therefore follows a switch on the next |
| 295 | frame, not only the next prompt made. | 299 | frame, not only the next prompt made. |
| 296 | - `lnLo` and `lnHi` hold sentinels (the doubles whose bytes are `LEONIDA1`, `LEONIDA2`); `lnFamily`'s default is a | 300 | - `lnLo` and `lnHi` hold sentinels (the doubles whose bytes are `LEONIDA1`, `LEONIDA2`), which `Main`'s static |
| 297 | third (`LEONIDAF`), which the runtime replaces with the family in use when it serves the movie. In the constant | 301 | initialiser computes before its own code (half of each, from the pool, times 2): they are in no copy of the movie |
| 298 | pool they come after the title's double as unset, high, low, so the file and Scaleform's parsed pool never hold the | 302 | and no slot default, only in the live class. `lnFamily`'s default is a third (`LEONIDAF`), which the runtime |
| 299 | low sentinel with the high one above it. | 303 | replaces with the family in use when it serves the movie. |
| 300 | - Checked without the game: `tests/test_live_prompt_glyphs.py` builds the same changes over a block made in the | 304 | - Checked without the game: `tests/test_live_prompt_glyphs.py` builds the same changes over a block made in the |
| 301 | title's layout, checks every path of the added code as the AVM2 verifier does (stack and scope depth, branch | 305 | title's layout, checks every path of the added code as the AVM2 verifier does (stack and scope depth, branch |
| 302 | targets, `label` on backward branches, locals, pool indices) and runs it in a small interpreter over fake display | 306 | targets, `label` on backward branches, locals, pool indices) and runs it in a small interpreter over fake display |
| @@ -315,22 +319,41 @@ tells it the family in use. `LEONIDA_PROMPTS_LIVE=0` turns it off (one family's | |||
| 315 | read-write (no guard, write-combined or uncached ones), with `ReadProcessMemory` (a page freed meanwhile fails the | 319 | read-write (no guard, write-combined or uncached ones), with `ReadProcessMemory` (a page freed meanwhile fails the |
| 316 | 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 | 320 | 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 |
| 317 | above and a family value between: a class's `Number` slots in a row, as doubles or as Scaleform's `Value`, whatever | 321 | above and a family value between: a class's `Number` slots in a row, as doubles or as Scaleform's `Value`, whatever |
| 318 | its size. The buffer it reads into is left out. Every copy found is kept. | 322 | its size. The buffer it reads into is left out. A find counts only when `lnMade` and `lnShown` after it hold whole |
| 323 | numbers and it does not lie inside a copy of the movie (a `GFX`/`FWS` header with the movie's length less than | ||
| 324 | that length before it); both rejects are counted in the log. Every copy found is kept. | ||
| 319 | - **Writing.** On each change of `gameinput::active_family`, the family (0, 1 or 2 as a double; the low 32 bits are | 325 | - **Writing.** On each change of `gameinput::active_family`, the family (0, 1 or 2 as a double; the low 32 bits are |
| 320 | zero, so a read while it is written sees the old value or the new) goes into every slot whose sentinels are still | 326 | zero, so a read while it is written sees the old value or the new) goes into every slot whose sentinels are still |
| 321 | there (read again just before, written with `WriteProcessMemory`); a slot whose sentinels are gone is dropped, and | 327 | there (read again just before, written with `WriteProcessMemory`); a slot whose sentinels are gone is dropped, and |
| 322 | with none left the looks start again. Unit-tested on a fake heap (`cargo test -p leonida-hle --lib glyphs`). | 328 | with none left the looks start again. Unit-tested on a fake heap (`cargo test -p leonida-hle --lib glyphs`). |
| 323 | - **Log lines.** `prompt glyphs: PlayStation and keyboard (live) movie loaded`; `prompt glyphs: the title reads its | 329 | - **Log lines.** `prompt glyphs: PlayStation and keyboard (live) movie loaded`; `prompt glyphs: the title reads its |
| 324 | glyph movie`; `prompt glyphs: live family slot found at 0x... after N s` (with the stride, the copies, the MiB | 330 | glyph movie`; `prompt glyphs: live family slot found at 0x... after N s` (with the stride, the copies, the MiB |
| 325 | looked through and the time it took); `prompt glyphs: family written PlayStation -> keyboard and mouse`. If the slot | 331 | looked through and the time it took); `prompt glyphs: family written PlayStation -> keyboard and mouse`; |
| 332 | `prompt glyphs: live code counters (...): prompts made N, pictures switched M` when found, on each write and every | ||
| 333 | 30 s, with the numbers of each copy. If the slot | ||
| 326 | is never found: `the live family slot was not found` after the last look, and `live family slot not found yet` at | 334 | is never found: `the live family slot was not found` after the last look, and `live family slot not found yet` at |
| 327 | debug level after each (with the count of low sentinels seen, which tells a layout this search does not expect from | 335 | debug level after each (with the count of low sentinels seen, which tells a layout this search does not expect from |
| 328 | slots that were never made). | 336 | slots that were never made). |
| 329 | 337 | ||
| 338 | ### The first run in the title (2026-11-29, keyboard at the read) | ||
| 339 | |||
| 340 | 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 | ||
| 341 | 14,770 MiB); six writes on six switches each reached four copies, and the prompts stayed keyboard. That version | ||
| 342 | kept the sentinels as the slots' defaults, so what was found may have been a template of defaults rather than the | ||
| 343 | live class, and its sprites put the keyboard over the PlayStation pieces, so code that never ran looked the same as | ||
| 344 | writes that missed. Both are changed above. What the next run's log tells: | ||
| 345 | |||
| 346 | - `found` with counters rising as prompts appear, and `switched` rising on switches: the code runs and the writes | ||
| 347 | land; prompts that still do not change mean the display does not follow `visible`; | ||
| 348 | - `found` with `prompts made 0` while prompts are on screen, or no find at all with `low_hits=0`: the constructor | ||
| 349 | call does not run (or `Main`'s initialiser does not), and the prompts look PlayStation on every device; | ||
| 350 | - `prompts made` rising but `switched` not rising on a switch: the writes miss the slots the code reads; | ||
| 351 | - `in_movie` or `implausible` above 0: finds of another kind were seen and left out. | ||
| 352 | |||
| 330 | ### Not proven until it runs in the title | 353 | ### Not proven until it runs in the title |
| 331 | 354 | ||
| 332 | Scaleform has not run the added code: whether it accepts the extended block (its verifier), whether a symbol's frame | 355 | Whether Scaleform runs the added code at all (its verifier), whether a symbol's frame children exist when |
| 333 | children exist when `SpriteAsset`'s constructor runs (if not, `lnShow` finds no `k` and the first frame shows both | 356 | `SpriteAsset`'s constructor runs (if not, `lnShow` finds no `p` and the first frame shows the PlayStation glyph until |
| 334 | sets until the first `enterFrame`), whether `enterFrame` reaches the icons, and how it stores a class's `Number` slots | 357 | the first `enterFrame`), whether `enterFrame` reaches the icons, and how it stores a class's `Number` slots |
| 335 | (raw doubles, or `Value`s of 16 or 24 bytes, are all searched; another layout logs `not found`). The memory search's | 358 | (raw doubles, or `Value`s of 16 or 24 bytes, are all searched; another layout logs `not found`). The memory search's |
| 336 | time on the title's heap is not measured; the log line says it. | 359 | time on the title's heap is not measured; the log line says it. |