OpenTPW

Saved particle pool configuration (bounded SAVE-013)#

Evidence manifest#

Static PC evidence from sp20_nocd/tp.exe, SHA-256 5472f97b5eb28f58b5a49f3a15f6f66adffa6b2625a623f503202c9696d1b805, inspected on October 20, 2026 against OpenTPW main 2d7a1ae88127cd103ec6f211f79697ea93d6b7eb. The executable was not run or uploaded. This is instruction-level evidence, not an original-game runtime/visual comparison. All newly added fixtures are synthetic.

Managed restore contract#

ParticleSystemState.Configuration is optional for older own-format saves. Missing/null keeps the receiving pool's current settings, including any settings from a previous restore. Present configuration carries signed density, capacity and low-detail semantics. Original import always supplies it for an initialized pool. An initialized empty pool is captured too, preserving its RNG, counters and free-list order for the next new emitter or effector.

Capacity outside 100..32767 is rejected before mutation. This is a managed supported-domain/allocation guard aligned with native initialization, not native loader validation. The reader still reports the original format; conversion and the own-format validator enforce the runtime boundary. Capacity is not clamped. All list/counter/template checks complete before any configuration or pool change, and a resized particle array is allocated before it is assigned. The original host ground callback remains in place. RNG restoration, handles, list order and post-load screen-space/effector cleanup are unchanged.

Density preserves all 32 bits, including zero and negative values. It is not a preset-only range. Existing saved emitter rates/cap/burst remain as saved; only future creations use the restored density. A scaled burst is between -2097152 and 2097151 and its spawn loop stops at pool exhaustion, before a refused spawn draws RNG; rates remain signed bytes, so tick emission stays bounded too. Density zero still changes nonzero authored rates and positive cap/burst to one, not to disabled emission. No new density arithmetic is introduced by this change.

Verification and limits#

ParticlePoolConfigurationTests adds synthetic original-block to own-envelope round trips for empty/live pools, density1500 loading into host500 followed by a new emitter compared with an uninterrupted1500 control, non-default empty RNG history, low-detail refusals (ordinary/directed/effector), capacity shrink/grow and exhaustion at both bounds, density0/-1/signed extremes, refusal atomicity for invalid counts/lists/templates, absent/null legacy settings and ground-callback retention, required configuration-member rejection and sliced/manual JSON equality. Existing save tests retain handle/list/RNG and post-load cleanup checks; the optional real-save corpus expectation now includes empty initialized pools.

No local .NET execution is claimed. Source review and exact published-head CI are required before merge; CI results belong to the PR, not an invented local pass. The optional original-data corpus is not claimed executed when data is absent.

SAVE-013 remains open for sprite VM/animation phase, saved template and emitter flags/groups, and effector identity matching. This slice changes none of those, nor Level.Objects, track restoration, the world hash, or the save envelope version.

Source: docs/reverse/PARTICLE-POOL-SAVE-CONFIGURATION.md in the project repository.