0x36 mosaic-transition-surfaces
Opcode 0x36 (54), draw. Investigated by OME, with high confidence (from investigation).
(source_surface)(target_surface)(interval ms) — blocking mosaic transition between two captured surfaces: the source breaks up into blocks that grow by a pixel each timer period, and after 80 periods the target comes back out of blocks that shrink; 160 periods in all.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | captured source surface (an index into surface, 1000 entries, not bounds-checked) | imm | read |
| 2 | captured target surface (an index into surface, 1000 entries, not bounds-checked) | imm | read |
| 3 | timer period in milliseconds | imm | read |
In the port
OME’s port implements it. It may wait: a wait parks the engine until input, a sleep, a transition, a dialog or a movie ends. What it can do with control besides waiting:
falls: it returns to the next instruction
OME derives these facts from the port’s handler (its tools/opcode_flow.py), and they over-approximate: a fact some path can reach is given.
By build
Whether each build’s scripts use it, as OME’s survey of the game’s scripts saw them, and how many evidence items name the build.
| Build | Game | Used by its scripts | Evidence |
|---|---|---|---|
4.24J (SYS4422) | Himegari Dungeon Meister | no | — |
4.33G (SYS4433) | Kamidori Alchemy Meister | no | — |
4.38D (SYS4438) | Soukoku no Arterial | yes | 1 |
Evidence
- native-re on SYS4438, high confidence; Arterial SYS4438 Ghidra /arterial/4.38D and the complete Arterial catalog (
vm-map/opcodes.toml opcode 0x36): op_0x36_mosaic_transition_surfaces@0x41d7a0 sets the frame's wait kind to 7 and, with run-state 0x8000000 clear, sets run-state 8, calls sleep_timer_arm@0x44fe50(operand 3) and screen_transition_begin@0x43d5e0(operand 1, operand 2, 9, 0xa0, 0), polls the triggered action mask (ctx+0xaa648) and zeroes it; otherwise it calls screen_transition_finalize@0x43d230(operand 2, 0). Begin's mode 9 under draw mode 1 creates 0x24 and 0x25 blank at the size it clipped (+0x2018, +0x201c), copies the two surfaces into them with gfx_copy_surface_rect@0x48d2f0, creates 0x20 blank and stores the parameter at +0x2028. screen_transition_tick@0x43dfe0 mode 9: +0x1fb8 += argument, capped at +0x2028; below half of it gfx_mosaic_surface_rect@0x44e520(0x20, rect, 0x24, rect, counter), else (0x20, rect, 0x25, rect, +0x2028 - counter + 1); +0x1fb8 += 1; gfx_render_frame, gfx_draw_surface_through_sprite(0x20) and present; at +0x2028 <= +0x1fb8 it calls gfx_recreate_transition_copy_surfaces@0x490670 and reports the transition finished. gfx_mosaic_surface_rect calls gfx_mosaic_texture@0x48ee10 under draw mode 1, which copies the pixel at (x - x % dot, y - y % dot) of the rectangle and traces 0x5b08b8 for a dot of 0.
Details
OME’s notes on it, as the registry keeps them.
The handler sets run-state 8, arms the interval timer with operand 3 and begins legacy screen transition mode 9 with the parameter 0xa0, then polls the triggered actions and clears them. Begin copies the two surfaces to 0x24 and 0x25 through gfx_copy_surface_rect, which tests neither slot, and creates scratch 0x20 blank. Each tick adds the missed periods to its counter and caps it at 0xa0; below 0x50 it fills 0x20 from 0x24 with MosaicTexture at a dot of the counter, else from 0x25 at a dot of 0xa0 - counter + 1; it then adds 1, renders the frame, draws 0x20 over it and presents. The transition is over when the counter reaches 0xa0, where the tick creates 0x24 and 0x25 again at the screen's size. MosaicTexture gives every pixel the top-left pixel of its dot x dot block, the blocks counted from the rectangle's corner, and refuses a dot of 0 with the trace 「関数:MosaicTexture エラー:モザイクサイズの指定が不正ですsize = 0」: the counter is 0 on a tick that runs in the first period, and 0x20 is then drawn as it is, blank the first time. What a blank surface draws as is not measured, and the port shows the source unchanged for that period. Action 4 forces the counter to its cap, which shows the target at a dot of 1. With fast-forward set at dispatch the handler finishes on the target at once (screen_transition_finalize: a negative slot fills 0x20 with black). The records of 0x24 and 0x25 are created from the engine's start (engine_initialize_graphics_from_settings), so a save shows no change in them. 創刻のアテリアル has 8 sites in 6 scripts; the first site of each script passes (1, 2, 3 ms) or (1, 2, 20 ms). Neither Himegari nor Kamidori calls it.