0x147 point-in-polygon
Opcode 0x147 (327), input. Investigated by OME, with high confidence (from investigation).
(out_inside)(point_x)(point_y)(vertex_x_array)(vertex_y_array)(vertex_count) — return whether the point lies in the polygon under Win32 ALTERNATE (even-odd) fill semantics.
Operands
| # | Role | Types seen | Access |
|---|---|---|---|
| 1 | inside result output (0 or 1) | l-int | write |
| 2 | point x | l-int | read |
| 3 | point y | l-int | read |
| 4 | pointer to vertex x coordinates | l-ptr | address |
| 5 | pointer to vertex y coordinates | l-ptr | address |
| 6 | vertex count | 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, Kamidori SYS4433 Ghidra /kamidori/SYS4433 (4.33F), addresses given for /kamidori/4.33G, and Win32 GDI behavior probe (
vm-map/opcodes.toml opcode 0x147): SYS4422 op_0x147_point_in_polygon@0x429b10 and SYS4433 @0x42a960 share the six-operand CreatePolygonRgn(..., ALTERNATE) then PtInRegion contract. A direct GDI square probe returns inside for (5,5), top/left boundary points, and false for bottom/right boundary points. Kamidori's two sites are ARRANGE@0x4c6 and STUDIO@0x525; both pass local-int output/x/y, local pointers to parallel x/y arrays, and immediate vertex count 4.
Details
OME’s notes on it, as the registry keeps them.
Both native handlers copy the parallel signed-dword coordinate arrays into POINT records, call CreatePolygonRgn(points, count, ALTERNATE), query PtInRegion, normalize the result to 0/1, and destroy the temporary region. The portable even-odd crossing rule preserves GDI's half-open raster convention: for an axis-aligned rectangle its top/left edges are included and bottom/right edges excluded. Kamidori's ARRANGE@0x4c6 and STUDIO@0x525 calls both use four vertices through local pointers.