OpenTPW

Build-tool blueprint markers#

2026-10-11. Static analysis of the Mac PowerPC SimThemePark.data (SHA-256 04809cd4…e295f5, see FINDINGS.md) with Ghidra 12.1.4. No original program was run, and no decompiled code is kept in this repository. Addresses are Ghidra addresses: code starts at 0x10000000.

Question#

When the player lays a path or a queue, or places an object, the original shows blue (and red) markers on the cells the tool would change. OpenTPW drew small coloured squares in the interface instead (PATH-001). What does the original draw, and from which data?

Textures#

0x1022C374 is a table of 16-byte records whose first word points at a texture name. The names are loaded from Data:Generic:Dynamic:Textures (string at 0x101CC223); the PC CD has the same files as Data/generic/dynamic/textures/*.wct. A face's texture is its index in this table:

IndexTextureIndexTexture
0blue7m_inout
1red8m_link
2orange9m_break
3m_enter10m_cross
4m_exit11m_end
5m_direct12m_nocash
6m_front13m_erase

Indices 15–17 are gby_sur1–gby_sur3, chosen by rand() % 3 + 15 in 0x100BCB60, which confirms the numbering. orange.tga is not on the PC CD. The theme tables' PathTex entries 16–18 (baseblue, grnarrow, redarrow) name files that no archive contains; the original does not use them for markers.

The BlueprintMesh#

0x100BCB60 creates three dynamic meshes: BlueprintMesh (up to 0x600 faces), WaterMesh and FlagsMesh. AddFace 0x100BD3D4(x, y, z, f4, code, texture, …) appends a square face record (0xA0 bytes); the record's mesh, texture and draw code are kept for sorting by texture.

0x100BF540 turns a square face into geometry, with the face size DAT_101F1240 = 10.0 (one cell):

The vertex builder 0x100BF388 takes y as given for the blueprint mesh (only the water mesh adds the terrain height).

Ghosts of a path or queue line#

LayLine(mode | 0x100) (PATH-plan §4.3) calls SetCell 0x100866B8 with the ghost flag for each cell. The ghost branch:

  1. Position: x = cell X × 10, z = cell Y × 10 (mulli 0xa at 0x10086908), y = height + 1.5 (TOC −0x3070).

  2. Height (0x10086794): 0 for a plain cell; for cells of types 4, 7, 9, 10, 0xB, 0x10 and 0x19 (rides, track) the terrain height at the cell corner from 0x100509E8, rounded up to a multiple of 10 (((int)h + 9) / 10 × 10). 0x10086030 raises the height next to those types.

  3. Texture: the chooser 0x100895D8 returns 0 (blue) for an allowed cell and 1 (red) for a refused one, including a line the park cannot pay for; other codes (9 m_break, 11 m_end, 13 m_erase) belong to track types 0xB/0x10/0x19.

  4. Walls (0x10086B9C): for each neighbour whose marker height differs from the cell's, edge faces are added from the neighbour's height in steps of 10 (0x10086C2C) while below the cell's height. The same faces are drawn in red for a refused cell (0x100873E4…).

0x10080C50 is the same per-cell ghost routine for other build modes; its validator is 0x10084154, and 0x10075618 calls it for many cells (object footprints).

Which markers the build modes use#

2026-10-12, same binary and tools. AddFace has four callers: the two per-cell ghost routines 0x100866B8 (SetCell) and 0x10080C50, and 0x1006BC38 and 0x100E5EE0, which each add one flat red face (code 0, texture 1).

So in the routines read, the entrance and exit symbols (m_enter, m_exit, m_inout) and m_front, m_cross and m_nocash are never chosen as constants, and nothing marks an object's entrance or exit cell. The arrow symbols that do appear belong to track building (m_direct, m_link, m_end, m_break, m_erase). The only open source of other codes is the cell byte returned by 0x1006E0E4. (Superseded October 16, 2026: the PC placement 0x528A70 does choose m_front, m_enter and m_exit, see BLUEPRINT-003 below, and OpenTPW draws them.)

In OpenTPW#

BlueprintMarkers (a ModelEntity) builds this geometry for a list of cells with the blue and red textures, and the HUD (ParkHud.UpdateBlueprint) feeds it the path or queue tool's preview line and, while an object is being placed, the object's footprint under the cursor. The cost text beside the line stays.

Open points (BlueprintApproximations):

Object preflight refusal correction (October 18, 2026)#

The earlier BLUEPRINT-003 claim that a refused object preview should colour only independently refused cells was too broad. The PC ordinary-object hover checks the entire placement before it draws the ghost. A failed check forces the subsequent ghost red, even for a refusal whose individual validator return is non-sticky. OpenTPW's all-red ordinary footprint therefore does not need to be replaced with mixed per-cell feedback on this evidence.

Caller, arguments and return chain#

Bounded static inspection of the PC code establishes the following chain without executing original software:

  1. The hover 0x5234D0 clears 0x816D48, the sticky refusal 0x816D50 and related flags at 0x5234EC onward. The ordinary build route clears the separate force-red word 0x81B604 at 0x52367D.

  2. At 0x52390E it calls placement 0x528A70 with six arguments: cell X, cell Y, type 4, rotation, commit = 0, check = 1. In placement's normal stack frame these last two arguments are read at [esp+0x90] and [esp+0x94]. The ordinary footprint branch 0x529646–0x529676 skips ghost/check work when commit is set, chooses SetCell(0x204) when check is set and chooses SetCell(0x104) for the ghost otherwise. Entrance and exit footprint branches also check through 0x204.

  3. SetCell's 0x200 branch (0x532FEE–0x53300F) calls validator 0x535670 and returns 0 exactly when the validator returns 1 (refused). The ordinary footprint check branches to placement's zero return at 0x529CED when that happens (0x52966E). A queued entrance's outside cell uses 0x204 at 0x5297A4; its failed check returns 0 through 0x5298C0–0x5298D4 as well.

  4. A zero placement result makes the hover set 0x81B604 = 1 at 0x52391A. It then calls the same placement immediately at 0x5239EE with commit = 0, check = 0. The Move hover has the same two-pass structure at 0x5239C4, 0x5239D0 and 0x5239EE.

  5. In the ghost branch, SetCell reads 0x81B604 at 0x53319A. When set, it takes refusal before consulting that cell's validator (0x5331A7–0x5331BF), and the refused face path uses red. A front/access arrow supplied by the caller does not override this global refusal.

This also rules out the proposed fixed-path exception: type 4 on a NoModify cell returns refusal at 0x5356AA → 0x535B31 without setting 0x816D50, but that is still a failed preflight and therefore sets 0x81B604 before drawing. For ordinary footprint cells and a queue entrance's outside cell, preflight and ghost use the same type-4 cell rule and the same coordinates; no commit runs between them. The inspected route provides no successful first-pass case that newly acquires that NoModify refusal in its immediate ghost pass. Other shape branches and tool modes are not generalized from this result.

Refusal word versus marker colour#

The refused ghost calls 0x527940(1) after its second validator call. That helper only writes the separate word 0x816D48; it does not write 0x816D50 or 0x81B604. Direct references found in the retained code spans read 0x816D48 to gate click work (0x5247F0, 0x52482C, 0x5249E0, 0x524A63) or clear it. Its getter 0x527950 is called at 0x52F9F3, where it selects the no-place pointer 8 through the pointer setter 0x4A2AA0. Those inspected consumers do not recolour the blueprint after stamping. The positive force-red caller chain above, rather than an assumption that this separate word has no consumers, is the basis for the correction.

Outside access stamps and bounds#

For an ordinary shape with one entrance and one exit, both footprint cells in bounds, the ghost pass still reaches the outside access work after a failed preflight. With the queue option enabled, it calls SetCell(0x104, 3, direction) for the entrance's outside cell at 0x52989A and SetCell(0x118, 4, direction) for the exit's outside cell at 0x529B1C. Both ghost types reach the force-red check above; when it is set, these faces are red rather than access arrows. There is no early return merely because the footprint ghost is refused: refused SetCell returns 1 at 0x534009.

The order of the bounds checks matters. The helper 0x4D8300 accepts exactly 0 <= x,y < 128. The entrance-side check at 0x529744 returns from placement immediately on failure (0x52974E), before either outside stamp. The exit-side check at 0x5299E2 also returns on failure (0x5299EC), but the entrance-side ghost has already been stamped. With the queue option off, the entrance-side ghost instead uses 0x118/m_inout at 0x5299AE, and the exit-side work is skipped at 0x5299D2. The option helper 0x52FAB0 returns 0x81B0CC only when the add-on selection 0x8187F8 is zero, and otherwise returns zero.

The older shorthand that an exit is drawn "only after an entrance" is not an exact presence test. The placement records an entrance flag at normal-frame [esp+0x12] (0x52932D, with two arguments then pushed) and an exit flag at [esp+0x13] (0x529243, likewise). At 0x529711, one argument is still pushed, so [esp+0x16] reads the entrance flag; after popping that argument, 0x52971C reads the exit flag. Either flag enters the outside-stamp sequence. The coordinate locals start at zero and are overwritten whenever the in-bounds footprint loop encounters another matching access symbol. Thus missing partners and multiple entrances/exits cannot be inferred from OpenTPW's current first-entrance/first-exit selection. These cases, and the distinction between a skipped out-of-bounds footprint cell (0x52903D) and an outside-cell bounds failure, remain separate work. Only the ordinary paired-access case is implemented below.

Scope and remaining work#

Only the incorrect independent-cell expectation is removed from the register. BLUEPRINT-003 stays open:

The evidence correction retains whole-footprint refusal, placement, overwrite, refund, economy, decoder and simulation behavior. Both HUDs keep their existing colour policies. It does not establish original object money-colour behavior or retire the whole ID. The existing all-red/no-arrow regression now covers all four rotations. No original binary, disassembly or assets are included.

Bounded refused-access preview (October 18, 2026)#

BlueprintGhosts.Footprint has a grid-aware overload for the proven omission: the outside cells of an ordinary refused queued object can still need red faces. It adds those faces only when all of these conditions hold:

The entrance's outside cell is checked against the host grid dimensions first. If it is outside, neither access face is added. Otherwise it is added red, followed by the exit's red face only if its outside cell is in bounds. The footprint remains entirely red, and no direction arrows are added. Other inputs retain the existing fallback, including money/global-only refusal, unproven refusal reasons, missing/multiple access points, partly off-grid shapes, special symbols and no-queue mode. Accepted previews are unchanged; this does not implement m_inout or change which access cells actual placement accepts or lays.

Both HUDs call Level.ObjectBlueprint, which disables the new branch for tools, add-on entries and active add-on mode. It uses their already-computed placement result and colour decision: TPW still includes its separate purchase check, while TPI still colours by placement alone. The adapter does not repeat validation, consult the economy or buy anything. No validators, path clearing, overwrite priorities, purchases, refunds or simulation code changed.

Synthetic regressions cover all rotations, non-square host bounds, entrance/exit ordering, footprint bounds, fixed paths, ownership/occupancy refusal in both footprint and access cells, accepted/fallback output and repeated preview/cancel without cell-map writes, object changes or ledger charges. They use no original assets. Local .NET execution remains blocked by the missing SDK; the test command was attempted rather than reported as passed.

Bounded occupied-cell height implementation (October 20, 2026)#

Further read-only PC inspection resolves the top/wall contract independently of the PPC analysis. 0x5330C6–0x533189 uses Q(H) = 10 * trunc0((trunc0(H) + 9) / 10); the float conversion helper 0x67A830 explicitly selects truncation toward zero, and the multiply-high/signed-shift correction implements signed division by ten. This is not mathematical ceiling: H = 0.9 gives 0, H = 10.9 gives 10, H = -18.9 gives 0, and H = -19 gives -10. Second-layer types 11/12/16/17/25 first set Q; base types 4/7/9/10/30 overwrite it using the same 0x452AE0(x,y,0) sampler, not a sum or maximum. That sampler looks for a second-layer instance first, then the owner object, and finally terrain when no instance height map exists.

The top face is Q + 1.5. Each of the four PC neighbour loops (0x53323C–0x53391B, and the refused duplicates 0x53397E–0x534007) skips a missing neighbour and emits side quads only from lower neighbour Q to current Q, in ten-unit steps. Neighbours come from the map even when they are not preview cells. The face codes 1/4/16/64 select the -Y/+X/+Y/-X sides in the PC face builder 0x53DF30; subtracting the -10 constant at 0x700E1C adds the vertical step. Allowed sides use blue, except an area top (texture 2) also has area sides; refused sides use red. Access/front arrows and their rotation do not propagate to side faces. 0x53DDD0 adds terrain at each vertex and ripple to both tops and walls, so Q is an additional offset, not a replacement terrain height.

The host implementation deliberately supports only TPW ordinary primary cells 4/9/10 whose live owner word matches the footprint object and whose existing ObjectHeightMaps.Height supplies a valid map sample. Plain cells 0/1/3 have known zero offset. Any nonzero track/structure cell or fence post is excluded before owner sampling; it does not call the generic tour sampler or assert track-priority compatibility. Unsupported cells retain their old unraised top and do not acquire guessed walls. Missing, malformed, inaccessible or out-of-range height maps all remain unresolved here, including the native missing-map terrain-quantization branch. Types 7/30, secondary-layer parity, and all TPI behavior remain open. BLUEPRINT-001 is not retired.

Preview samples include the current cell and four map neighbours. They are captured when the preview is shown; a changed snapshot rebuilds topology even while paused, whereas ripple-only frame updates preserve the vertex count. Synthetic geometry cases cover both-sided stepped walls, all four sides, unequal/equal/higher/unknown neighbours, red/blue/area textures, arrow isolation, signed quantization and boundary sampling. No original assets or disassembly are published with this implementation; no BLUEPRINT-003 marker-selection behavior changes.

Typed ghosts of the line tools and Buy Land (November 1, 2026)#

Round 11, package F. The PC ghost routines were replayed in the x86 oracle (docs/reverse/ORACLE.md, X50 to X52) and ported for a typed TPW world:

Theme Park Inc raises it as well (read 2026-11-09). Its placement handler 0x67AD00 (reached through the thunk 0x403DEB) applies the same rule: the gate helper 0x67AC80 tests the record types 0xB, 0xC, 0x10, 0x11 and 0x19, the handler then tests the map types 7/0x1E and 4/9/10, quantises through the ground query 0x4A8760 (the twin of 0x452AE0: same 10-unit pitch, same byte-per-cell height grid scaled by 0.392157 at 0x93AFC4, same view rotation) and steps a placement between unequal neighbours by 10. So the earlier wording that Theme Park Inc keeps the terrain was wrong. The ten cmp reg,0x1E blocks at 0x67ABD9..0x67BD95 mirror tp.exe's nine at 0x5330CA..0x533F69 one for one. Note also that the register's type list belonged to that 0x5330xx family, not to 0x536CA0, which tests only 0xB, 0x10 and 0x19.

Residuals found in the review of the same round (all stay in BLUEPRINT-003): the kind 23 commit branch 0x5295F7..0x52965C and its link to the cell beyond (0x4D8C20 turns a direction byte by the placement rotation, 0x4D97E0 answers the neighbouring cell or none) are carried by ParkObjects' beyond-cell refusal (0x5295A8) and ParkCellMap.WriteFootprint but not replayed against the executable; a shape 'D' (direction 0) takes 0x529581 with no own face and no cell beyond, so the check refuses it and only a refused ghost meets it; the face adder 0x53DDD0 takes a terrain flag ([EBP+0x1C]) per caller (0x53E083..0x53E580) that is not matched per texture for the m_direct face. The tile ghost's entry gate 0x537103..0x537164 reads the answer and direction arguments only for the modes 4, 0xB and 0x10 with the argument 5; the walker passes its step (-2 or 2), so the default branch always applies. The refusal word 0x816D48 is also read by the click handler (0x5247F0, 0x52482C, 0x5249E0, 0x524A63) and written by 0x5234EC, 0x524AD9 and 0x527C48. The kinds 11 and 16 set the flag word 0x10 of the map cell and of the second layer's record (0x53A510 at 0x52950D and 0x52951A), which are ParkCellFlags.AddOn and TrackCell.FlagAddOn.

Source: docs/reverse/BLUEPRINT.md in the project repository.