0x32 scale-copy-surface-rect
Opcode 0x32 (50), draw. Investigated by OME, with high confidence (from investigation).
(source_surface)(destination_surface)(source_x)(source_y)(source_width)(source_height)(destination_x)(destination_y)(destination_width)(destination_height) — clip and scale a source surface rectangle into an independently sized destination rectangle.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | source surface slot (an index into surface, 1000 entries, not bounds-checked) | imm | read |
| 2 | destination surface slot (an index into surface, 1000 entries, not bounds-checked) | imm | read |
| 3 | source x | imm | read |
| 4 | source y | imm | read |
| 5 | source width | imm | read |
| 6 | source height | imm | read |
| 7 | destination x | imm | read |
| 8 | destination y | imm | read |
| 9 | destination width | imm | read |
| 10 | destination height | imm | read |
In the port
OME’s port implements it. It never waits: 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 | 1 |
4.33G (SYS4433) | Kamidori Alchemy Meister | yes | 1 |
4.38D (SYS4438) | Soukoku no Arterial | yes | — |
Evidence
- native-re on SYS4422, SYS4433, high confidence; Himegari SYS4422 Ghidra /v2 and Kamidori SYS4433 Ghidra /kamidori/SYS4433 (4.33F), addresses given for /kamidori/4.33G (
vm-map/opcodes.toml opcode 0x32): SYS4422 op_0x32_scale_copy_surface_rect@0x41db20 -> gfx_scale_copy_surface_rect@0x47c6c0 and SYS4433 op_0x32_scale_copy_surface_rect@0x41bbf0 -> gfx_scale_copy_surface_rect@0x483410 have the same ten-operand contract. Both workers proportionally clip paired rectangles, mark the destination dirty, select direct/down/up scaling by the relative dimensions, and use scratch surface 0x20 when the two axes require different directions. SYS4433's two corpus sites are ALLMAP@0x4e2 and SAVE@0xbb6, both immediate 1024x576 -> 384x216 copies.
Details
OME’s notes on it, as the registry keeps them.
Both revision handlers convert origin/extent operands into paired edge rectangles, validate the two surfaces, mark the destination dirty, and dispatch to direct copy, area-weighted shrink, interpolating enlargement, or a two-pass mixed-axis route through scratch surface 0x20, which it creates over slot 32 and releases after, so a script surface there is lost (the port does the same). Kamidori's only two calls, ALLMAP@0x4e2 and SAVE@0xbb6, downsample the full 1024x576 surface 2 into a 384x216 thumbnail on surfaces 193 and 195. The portable host implements that observed shrink contract with an area-weighted RGBA sampler; equal-sized rectangles continue through the established exact-copy path.