0x321 set-polygon-texture
Opcode 0x321 (801), draw. Investigated by OME, with high confidence (from investigation).
(handle)(stage)(surface_slot) — set the surface of a polygon's texture stage 0 or 1; -1 is none.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | handle | imm, l-int | read |
| 2 | texture stage, 0 or 1 (an index into polygon texture stage, 2 entries, not bounds-checked) | imm | read |
| 3 | surface slot (an index into surface, 1000 entries, not bounds-checked) | imm, l-int | 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 | — |
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 0x321): op_0x321_set_polygon_texture@0x4250b0 calls gfx_polygon_set_texture@0x496860, which stores operand 3 at record +0x1c + stage * 4 and sets the dirty flag. gfx_draw_polygon_primitive@0x4895b0 binds each slot that names a surface, clamped and filtered linearly: one texture is multiplied by the diffuse, and with two, stage 1 is blended over stage 0 by its alpha first.
Details
OME’s notes on it, as the registry keeps them.
The port stores the slot (GfxState.SetPolygonTexture). A stage outside 0 and 1, or a slot of 1,000 or more, halts the run: native writes and reads outside its tables there. 創刻のアテリアル has 42 sites.