Snapmap+ ships a backend DLL loaded by DOOM and a WebView2 companion DLL. The backend owns engine integration; the frontend owns presentation and forwards engine work through their shared interface. The Go installer deploys the pair.
This guide explains component boundaries and contributor constraints. Detailed backend algorithms and reverse-engineering evidence belong beside their code or in the snaphak-re findings system.
| Component | Responsibility | Start reading |
|---|---|---|
| Backend | Bootstrap, hooks, editor operations and installed-resource access. | src/backend/dllmain.c |
| Shared interface | Matched DLL contract, callback bindings and shared queues. | src/common/snapmap_plus_iface.h |
| Frontend | Companion window, messages, editor views and preview controls. | WebView UI |
| Fault shield | Selected engine-fault recovery and local crash evidence. | src/fault_shield/fault_shield.c |
| Installer | Verified deployment, migration, update and uninstall. | Installer README |
| Store tool | Migrates a mods folder of earlier releases; the installer runs it. | src/store/store_tool.h |
| Feedback relay | Files in-app reports as GitHub issues. | Services, feedback |
The backend is an XInput proxy named XINPUT1_4.dll. It forwards controller calls
to the system library and initializes the editor integration. The frontend is
snapmap-plus-ui.dll. Both are built and deployed together; mixing their versions
can call the wrong interface slot. See packaging.
Snapmap+ supports one build of DOOM 2016: the April 2024 update, Steam build
13954591. Its executables are not SteamStub-wrapped and import XINPUT1_4.dll by
ordinals 2 and 3; xinput1_4.def pins the real System32 XINPUT1_4.dll ordinal
set (named and unnamed), with the backend's private exports at 200 and up.
host_image.c identifies the host by the SHA-256 of its executable file
(SH_KNOWN_BUILDS: the Vulkan and OpenGL executables of build 13954591). Any other
executable, the 2018 build included, is unsupported: the backend logs one line
naming the supported build and the final 2018 release, shows the same once in a
message box from its bootstrap thread (a DOOM update is otherwise silent), then
only forwards XInput.
Every engine constant is a build 13954591 value: struct and slot offsets in
engine_build.h, function RVAs as Vulkan/OpenGL pairs in the signature table, and
global RVAs in the generated globals table. Raw RVAs are applied only on a
recognized executable, for its own renderer, so no address can reach another image.
A feature whose engine offsets are not yet verified for this build stays off and
logs which values it waits for (SH_PENDING_* in engine_build.h); starting DOOM with
the environment variable SNAPMAP_PLUS_LIVE_VERIFY=1 runs those features for live verification.
The installer routes by build before downloading anything: it hashes
DOOMx64vk.exe and DOOMx64.exe, installs the current release on build 13954591,
installs the final 2018 release v0.2.1-beta.19 (by tag, exactly as that release
installs itself) on the 2018 build, and refuses unrecognized or mixed executables.
See packaging.
Function signatures identify engine code. Generated anchors derive global addresses from code references. Vulkan and OpenGL share these portable resolution paths; field layouts still need explicit verification when porting.
A pattern that matches more than once is not an identification. Where two functions share a body, the caller must confirm its target by something the pattern cannot carry: the rawmap branch answer follows the call its candidate makes and reads the literal that callee names, because the sibling it must not patch differs only there.
A raw-RVA fallback requires an exact fingerprint of a supported executable. The hook-tolerant fallback additionally checks the detour and remaining signature bytes. A filename or a readable address is not sufficient evidence. Contributor changes to signatures or anchors require the two-image test gate in contributing.
The bootstrap scans the whole database once, which takes about five seconds;
later installs reuse those results instead of scanning again. The boot pacing
sites (boot_pacing.c) cannot wait for that scan: the engine's resource preload
starts about two seconds after launch. Right after the build check they are
matched at their recorded RVAs only (sig_match_recorded), checked byte by byte,
and patched about 0.1 s after process creation. The offline signature tests
prove each of those recorded RVAs is the pattern's only match. A patch that would
land more than three seconds after process creation is not made, because the
preload's threads could then be executing the redirected instructions.
Hook callers prepare a trampoline, publish it as their original callback, then
commit the detour. Preparation does not write the target. Callers own the
lifetime of their original callbacks and any relay memory.
They must preserve those resources until restoration succeeds and no execution
can still use them. Failed rollback remains a recoverable state, not a successful
uninstall. The patch and hook headers define the supported installation and
restoration sequence. Stolen instructions must be complete and independently
executable. The ordinary hook helper performs no relocation; its explicit
hook_prepare_rip_lea variant expands one verified 64-bit RIP-relative LEA.
Callers still verify every other stolen instruction. Original target bytes
remain separate from relocated code for commit validation and restoration.
Snapmap+'s per-map data (the mods a map declares, its two built-in settings and
any navigation an earlier build baked into it) lives in the map's own file, in
one root member the engine does not declare, "snapmap-plus", never in the
author's variable table. The grammar is described once, in
src/backend/map_carrier.h; map_carrier.c finds, reads, strips and writes it
as text. The engine's typeinfo deserializer ignores an undeclared member with
no log and its serializer cannot write one; every transport (cloud save,
publish upload, download, Save to My Downloaded Maps, a lobby joiner's fetch)
moves the saved bytes unchanged, and a vanilla editor save drops the member.
Load: every parse the DeserializeFromJson detour sees (rawmap.c
prepare_map_buffer: My Maps, a published read, a joiner's download, a rawmap)
has each family read its part from the raw text -- the member's part when it
has one, else that family's legacy string variables (smpmod1.,
smp.render.v1, smp.bounds.v1, smnav1.), which are removed -- and the
retired smpprod1., smpkg., smpbind. and smpref. rows are removed as
before. The member is stripped last, so the engine never sees it; a member that
does not read (not an object, a format other than 1, a part of the wrong type,
two members) is logged as refused, read as absent and still removed, and the
map loads. One CARRIER: map read: line names the parts a map carries.
Save: after the engine serializes (sh_ser_detour, and the rawmap export), the
settings, navigation and manifest steps each put their part with
sh_carrier_put; the member is written compact and last at the root, with its
parts in the order mods, settings, nav. No step writes a variable or touches
variables.allocCount. A map with nothing to carry has no member and saves as
exactly the engine's bytes. A legacy settings row an author's variable follows
cannot be removed without moving that variable's index, so it stays and is
rewritten to the value that reads as off; the member carries the setting.
Navigation chunks: the engine's lexer sees the member only where Snapmap+ is
not installed. Measured live on Vulkan, an undeclared root member holding one
string of 8192, 65536 or 1048576 characters, or an array of 2048 strings of
4096 characters, loads and plays with no engine message above level 4, so each
set's base64 is cut into chunks of 1048576 characters (SH_SMNAV_CARRIER_CHUNK
in navmesh.h, which records the measurement).
Map rendering lives in the backend and DOOM's native Settings / Properties
panel, in the Snapmap+ tab. The Unlock View Distance group owns an
Apply/Cancel draft (one toggle) tied to the map open in the editor. The two
built-in map settings are held by map_settings.c as the open map's state,
never in the engine's variable lists: every map parse reads them from the map's
member ("settings":{"render":...,"bounds":...}, see The map carrier) or, in a
map an earlier build saved, from its smp.render.v1 / smp.bounds.v1 string
variables, which are removed before the engine parses, so the Toybox variables
list never shows them; every save writes them into the member. On saves
render = 4;0; Off saves nothing. A legacy row an author's variable follows
keeps its index: it stays in place, is read when the member has no settings,
and is rewritten at the first save to the value that reads as off (4;8192,
1;0), the member carrying the setting. Applying a
change marks the map modified with one undo step; undo does not revert it.
Versions 1 to 4 stored a distance: 8192 and disabled version 2 read as off, any
other distance as on, and an on value saves as 4;0. Malformed or duplicate
metadata reads as off. Map deserialization clears the previous runtime
selection and selects the parsed map's settings; editor-to-play conversion
selects the open map's. A locked value copy crosses to rendering at
the blended environment's single maxViewDistance read: off returns the native
read, on returns 200000 (the engine raises the read to at least 256 before
writing r_zfar) and rewrites the view's literal. Before that it reads the
block's native distance and stretches its fog by r = 200000 / native (floored
at 256, never below 1): the fogstart, fogend and fogstartdistance
literals are multiplied by r and fogscale and fogdensity divided by r,
whatever the blend target and in the editor and Play alike; the renderer packs
them into fogParms/fogParms2 from that block after the blend, and the block
is the view's own per-frame copy, so no declaration changes and nothing needs
restoring. The blend writes r_zfar only when an environment resolves, so
selecting an unlocked map also sets r_zfar to 200000 once through the engine's
forced cvar setter, and the editor's Blueprint far-plane writer (editor_zoom.c)
is raised to 200000 for that map, so every r_zfar writer agrees. This applies only to
SnapMap and uses signed bindings in both renderer executables. No WebView
interface change is involved.
The Snapmap+ tab is a third category added to the native Settings / Properties
panel (settings_tab.c): the category count, the diamond markers and the
populate dispatch are extended under the panel's own hooks, and groups register
through sh_settings_tab_register_group with their own draft, commit and reset
callbacks because native Apply and Reset are not category-scoped. It holds the
Unlock View Distance group and the Unlock Map Bounds group (map_bounds.c), whose
map setting (the member's bounds, held like the view distance, above) raises snapEdit_environmentModuleBounds and the
camera distance limit for that map up to the 32671-unit ceiling imposed by the
signed-short collision and navigation coordinates, restoring the native 16000
when a stock map loads. Every client re-validates module placement against its
own cvar, so an unlocked map is a Snapmap+-only map. Blueprint zoom-out
(editor_zoom.c) raises the orbit camera's dolly and pan height limits to a
client-side multiple of the native height, default 2x. Object Mode entry
(object_entry.c) repoints the FPS view's one load of its 18364-unit downward
trace segment at a product float covering the whole coordinate range, so the
entry drop reaches the floor of a Grid Room taller than that segment. Unrestricted
placement (place_anywhere.c) turns the two editor tests that refuse an
entity with no accepted surface and no air flag (the held-entity colour and the
Place admission) into unconditional passes for that clause only; the surface
classification, snapping, alignment and the overlap and module refusals stay
native.
Grid Room resizing is implemented in the existing backend. The native DOOM Module Properties panel owns its XYZ control. In Blueprint mode, the normal module selection handler adds the native Module Properties prompt and checks the engine's X action for the highlighted Grid Room. It selects that placement and enters the native panel state while retaining the Blueprint camera. Tutorial restrictions, other module types and selection transitions remain guarded. The WebView has no resizing control or new interface slot. Dimension-bearing module names resolve through private native palettes and the existing resource provider. Newly materialized empty catalogs take the native generic source load before admission; accepted and stock catalogs are not reloaded. The edit handler changes one compiled placement and translates its owned caps, doors and frames through the native copy-on-write entity edit and transform setter. This uses the live local transform, including after a native cap replacement leaves serialized definition edit state null. Ordinary placed objects keep their local positions and sizes. Finite XYZ inputs clamp to the per-axis limits and display the applied dimensions. The current snapEdit_environmentModuleBounds cvar constrains the selected placement and every connected neighbor on each edit: only the axes the user changed move, each as far toward the request as the boundary allows, and an existing boundary crossing is tolerated but never extended, so a shrink always applies. Every limited axis is logged with the request, the accepted value and the limiting coordinate. The built-in probe and ceiling light that the editor owns follow the room on each edit; the fill lights, which get no editor entity, follow from the generated room on the next load or Play, through the same policy. Planning uses temporary spatial views and native bounds helpers before creating resources. Signed-short BCM/AAS coordinates impose independent representation limits, including navigation outsets beyond the shell. Changing the cvar does not change those formats. Connected module branches translate rigidly to follow the changed doorways. A conflicting loop or increased bounding-box overlap prevents the connected edit. The engine recomputes all portal connections before accepting the transaction; an unexpected change restores the prior transforms and module records. The room resources are constructed in memory; no map sidecars are required.
Built-in lights are identified from the installed module's original entity names and inheritance. Native property-tree setters, commit and cached-property refresh update their position, coverage and distance cutoffs without changing authored light properties. The modern effective light center follows the roof; the classic central light follows the room center. Tree ownership uses the engine's matching destructor and delete calls, with rollback on edit failure.
The resource provider supplies resized AAS for all three stock agent classes. Door apertures and agent clearance remain fixed. Narrow strips that collapse at the shrink minimum are removed with their area references, cover membership, visibility and route chains remapped. Native BuildAAS performs module placement and assembly, and marked blocking volumes augment the resized base navigation.
Object-mode containment first uses the native query. If its fixed 6000-unit vertical rays miss an admitted taller variant, a bounded fallback extends both rays to that room's height. Both native body hits must identify the same valid module; world bounds alone never authorize placement. Resizing also refreshes the native per-module placement-display models inside the process heap scope, including after rollback. Otherwise Object Mode can retain the previous size's display resources until the camera is re-entered.
The native XYZ inspector shares a context with Grid Offset. Its base reset clears values but leaves the range list populated. AddVec3 clears the validated range count before native construction so each inspector rebuilds its own three ranges. Allocation ownership stays native; the separate door-cap and portal minimum checks still determine the smallest accepted room dimensions.
The faint green surface display is the game's navigation-class placement overlay, separate from the custom blocking-volume preview. The held entity's native navigation type selects one of three installed display models. Objects without that type do not request a model. The native material uses world-space grid coordinates and animated brightness, so its apparent intensity can vary while the model remains visible. The resize path preserves these native rules.
Reload has a separate palette membership probe; it now shares the variant lookup so saved rooms reach instance conversion. Cold construction can run before editor activation once the stock palette and native main-thread heap are available. Portal magnet snapping corrects the selected group's discarded XY offset only for compatible equal-size portals involving a variant. Explicit attachment scopes an exact-origin exception to that operation. Add/move/duplicate confirmation also preserves off-grid origins in maps containing resized rooms, including a stock neighbor aligned to one. Native dirty marking and remainder cleanup still run. Native reciprocal connection checks remain exact; the normal frame updater replaces caps and creates doors/frames when those connections change. Private palettes retain their two cached collision resources across map teardown; their native collision builder runs in the same process heap scope as the palette. Stock palette collision lifetime remains native. A process holds at most 64 distinct size/type variants, avoiding eviction while maps or undo records may still reference them. Save files contain the dimension-bearing module identity; players need Snapmap+ to reconstruct its resources. Vanilla loading is unsupported.
The shared object uses an append-only vtable. Its original 77-slot prefix is
retained, with extensions through +0x380; the current table occupies 0x388
bytes. The File menu's rawmap surface is rawmap_status (+0x328),
rawmap_configure (+0x330) and rawmap_load_now (+0x338). The last three
are navmesh_view (+0x340), run_on_main (+0x348), delete_entities
(+0x350), prefab_grab_status (+0x358), module_prefab (+0x360, the
Blueprint module-prefab state, save, place, status and module-check operations),
timeline_tile (+0x368, the Timeline palette tile's status) and budget
(+0x370, the editor budget table and usage for the Prefabs tab's Limits
section, built on the game thread after each palette build by
budget_table.c), mods (+0x378, the Mods tab's document and actions,
modui.c, run on the game thread through run_on_main) and prefab_watch
(+0x380, the Prefabs tab's guarded reads: the Blueprint module selection that
gates Create, the Load / Place held in the 3D view, and the game thread's last
paste decision, from iface_engine.c, apply_engine.c and module_prefab.c). The retired
timeline-inherit normaliser at +0x298 stays in the table and returns 1. The backend writes a marker and the table's size into the object's
first reserved cell (+0x08); older backends left it zero and had 0x350
bytes. Check SH_IFACE_HAS_SLOT before calling any slot at or past +0x350,
so a frontend never reads past an older backend's table.
Static assertions pin the layout. Do not insert, reorder or repurpose
existing slots. Add new capability slots at the end and update both DLLs.
Headers define buffer ownership, return values and thread requirements. Keep engine pointers inside the backend where possible. Copy values across the boundary rather than exposing mutable engine storage. An accepted asynchronous request is distinct from completed engine work.
The WebView host owns its window and browser callbacks. Its worker polls the backend through a manual think loop at about 30 Hz. UI callbacks stage requests; the worker drains them and posts result messages. A UI mutex protects its shared request state, not the engine's objects.
Selection, class/inherit, display-name, source and camera writes from the UI go
through run_on_main. The backend runs the call after the next native frame
while the worker waits. A call that has not started when its wait expires is
withdrawn and never runs. A started call borrows the worker's data, so the
worker waits for it to finish; the main thread never waits on the worker.
Navigation and staging maintenance run after a successful native engine frame on DOOM's verified main thread. Recovery suppresses that pass. The frontend queue drain does not schedule native maintenance or display engine dialogs.
Console sh handlers run on the engine's command-execution thread. Synchronous
apply runs inline only when that thread is positively identified as DOOM's main
thread. A known off-main caller copies its batch into the blocking marshal and
waits for the main-thread command drain. Unknown identity, missing transport and
occupied slots refuse the request; they never authorize an inline fallback.
The marshal withdraws work that has not started when its wait expires. If the
engine has started but has not finished by the deadline, it retains the request
and returns SH_APPLY_IN_PROGRESS. Callers must not report that as failure or
submit a duplicate. The asynchronous queue likewise refuses a new batch while
its existing pending batch is occupied.
Class/inherit edits snapshot both original pooled strings before assignment.
Result 1 means every requested assignment succeeded; 0 means refusal or
successful rollback; -2 means rollback also faulted. Only complete success
permits a dependent source rebuild. SEH contains memory faults; it cannot promise
that every native engine operation can be undone.
An entity edit whose text sets isNetworkStatic on an entity whose palette
definition names a networkStaticPath also writes the network-static byte the
editor budget counts (entity holder +0x320), which replacing the definition
text does not reread, and turning Static off is refused and rolled back, as the
native toggle does, when the recomputed budget is then at or over a limit.
Prefab Load/Place stages data and queues the native paste action after checking editor state and the copy/paste cvar. Queue acceptance does not confirm that the engine has entered placement mode. The engine consumes that action later.
Entities-list Delete calls delete_entities inside run_on_main. The backend
applies the gates DOOM's own Delete key passes (object editing active, no grab,
placement or pending action, the map's Delete restriction), makes the native
selection exactly the requested entities, clears a hover on any other entity,
and calls the engine's Delete Selection. The engine checks eligibility,
releases the entities and empties the selection; the "Delete Selection" undo
step and the return to idle follow on later native frames. Until they do, the
selection guard refuses product selection writes and reports 2. Every refusal
before the action restores the previous selection. The selection setup and the
action run inside a verified process-heap scope, as the Delete key runs inside
the editor frame: they grow the selected-ID array and the wire animation list,
which outlive the call, and on a console command's map heap Play would release
them under the editor, so the next Ctrl+Z, which frees the selected-ID array,
stopped DOOM with "Memory corruption before block!". A request whose scope
cannot be verified is refused unchanged. Portal doors and frames are
refused before anything changes. The page edits its own selection and announces
success only from the returned status.
Engine allocators inherit the calling thread's heap scope. Objects retained across Play or map teardown need a persistent scope; allocating them on a transient scope can leave apparently valid pointers to released storage. Keep construction, destruction and heap-scope pairing within the backend operation.
The frontend treats returned data according to each slot's explicit ownership contract. Preview requests are asynchronous and generation-tagged so an old completion cannot replace a newer selection. Large serialized results use owned, growable buffers instead of silently truncating fixed arrays.
Asset browsers and prefab previews read declarations and resources from the player's installed game. The product does not embed DOOM assets. Resource caches need explicit reader lifetimes; a refresh must not invalidate storage a reader or native object still uses.
Navigation snapshots and shipped resource reads run on the engine thread.
The snapshot reader takes collision dimensions from each cloned entity's
resolved declaration while the native snapshot is alive. It pairs declarations
with JSON by array position, preserving inherited sizes and duplicate IDs
without adding fields to saved maps. Only copied geometry reaches the bake.
A worker owns copied preview inputs and performs the arithmetic bake, while the
frame installs only a result matching the current geometry revision. The bake
lock precedes the worker handoff lock; the worker never acquires the bake lock.
Published lines remain until their replacement completes, except during a drag
or after an empty or refused snapshot. Sparse box refreshes include unmarked
obstacles and use live uniqueIds; topology changes require a complete snapshot.
Play always takes its own complete snapshot, of the idSnapMapEdit that
SnapMapEditToSnapBuild is converting rather than the editor's map, so hub, map
browser, co-op and direct launches read the map actually being played. The
editor's map stands in only when the converted map cannot be read and the two
place the same modules in the same order (nav_snapshot.c). During that
snapshot an unresolved Blocking Box takes its entityDef size for omitted axes.
The worker and session log handle
have process lifetime; DllMain must not wait on them or acquire their locks.
The native Start-menu action in nav_menu.c shares the View menu's update
request and completion state. It creates its additional button through the
engine, repairs the SWF binding after timeline rewinds, and uses native busy
and toast widgets with literal text. Completion collects the worker result
independently of preview drawing; the UI does not invoke saving or map validation.
Navigation surfaces and obstacles have separate roles. The bake emits only exposed box faces meeting each AAS class's floor-slope threshold; ordinary Block Demons boxes subtract occupied standing space without adding surfaces. The engine also registers their clip shapes for native AAS obstacle avoidance. Its separate expanded blocker registration feeds flight navigation. Keep both native registrations intact for ordinary walls; a vertical wall does not need a custom walkable shell. Traversals connect valid approach and landing surfaces.
Native route preparation allows 256 outgoing reachabilities per area. A custom bake refusal concerns that area's route complexity, not the map's entity count. It must remain distinguishable from a stale preview or a failed local obstacle query, either of which can occur while the underlying AAS remains loaded.
The backend owns %LOCALAPPDATA%/snapmap-plus/config.json, including defaults,
validation, persistence and recovery. UI writes go through the registered config
service. The frontend uses the service's descriptors and values; it does not
maintain a competing settings file.
Initialization validates configuration before dependent subsystems consume it. Unknown keys are preserved. Invalid input and failed persistence remain visible through service results. Theme bootstrap may read the existing preference before the browser is ready, then converges on the backend's published state.
Configuration descriptors in src/backend/config.c define available keys and
change behavior. Deleting the file resets preferences at the next startup.
Installer updates and uninstall preserve player configuration.
Mods are installed under %LOCALAPPDATA%\snapmap-plus\mods\. A mod is a folder
holding mod.json and an assets/ tree at the engine's own request paths
(a package.json is accepted until the folder's first build turns it into
mod.json). Mods reach other machines two ways: a published map's
bundles are uploaded to the Community API's mod store when the map is published,
and a player who opens that map is asked first and downloads only what they
approve in the dialog, verified by hash (modnet.c, modsync.c, modpublished.c;
see Published maps and missing mods); that
transport is for publications only. An exported rawmap or prefab is a ZIP that
carries each mod exactly as it sits in the mods folder, its folder with
mod.json and assets/ (modexport.c), and importing one is the ordinary
install of those folders, so sharing stays offline; every rawmap save of a map
that names mods writes that ZIP beside the JSON (see
Rawmaps that name mods and
Prefabs that name mods). Plain saves never upload. The retired
%LOCALAPPDATA%\snapmap-plus\overrides\ tree is read once, by the store tool's
migration below, never served or written, and moved to the Recycle Bin once
everything in it is in mods\; no package-cache or package-staging
folder is created.
These backend files share the work:
modbundle.cbuilds a mod folder into a bundle: a SHA-256 per file, the logical name each file provides, the names its decls need, the namespace and structural rules, and the canonical manifest whose SHA-256 is the bundle hash. It reads and writesmod.jsonand the product record (below). New names live undermods/<key>/; raw files and skins decls may spell the key the way the engine derives binary names (-becomes_). Every file is classified from its path and bytes: an addition or a borrow (a stock pointer) under the key, editor-only types included (a Toybox row travels with its mod), an editor tweak (an editor-only type outside the key), a surface (the game's own bytes at the game's own name, served from the player's disk, never carried and never refused; SnapMap's provider cannot see campaign-only content without it), or a replacement (any other file at a game name). Whether a file is the game's own bytes is decided by bytes for a binary and by text for a file in the decl grammar (a decl, a snapModule decl, or a render program's permutation declgenerated/renderprogs/permutations/<program>_<mask>.decl,{ permutations { } parms { } state { } hlsl_vp { } hlsl_fp { } }): line ends are not content (CRLF equals LF, the final run of line ends is ignored,sh_mb_text_same), so a copy an export turned from CRLF to LF is a pointer recording the game's hash and size (mb_text_pointer). Replacements and editor tweaks are the bundle'sshadows, derived and never declared. A replacement that is a decl is an edited copy: its structural diff against the game's text is the product block'seditsand the game file is generated per map (see Derived edits); a binary replacement fails the build, except in a folder the product received, and so does a copy outside the decl grammar. An edited permutation decl is decl text, never a binary, but it fails the build with what to do instead: the product generates edited game files undergenerated/decls/only (ms_registry_files), and a permutation is opened with its program's cooked.binand SPIR-V, so the author either deletes the copy (the mod borrows the game's) or ships a whole program undermods/<key>/. Of the 494 permutation decls the installed archives hold, 324 parse as decl trees; the rest carry HLSL with=at statement level. The retired author keysplayer,extendsandreplacesare ignored with one line each; a partial they name is refused with "this is a partial; put the whole edited copy of at its game name". Rules 3 (SH_MB_RULES) added the campaign-only closure below, rules 4 its effects, movies and atlases, rules 5 a closure no other installed mod stands in for, rules 6 whole models and rules 7 textual identity of decl-grammar files and a material's whole render program, so every installed folder is built again once. The author keysshadows,stockandscopeare accepted and ignored (an authorstockentry with no file still builds a pointer and is reported), so an existing mod keeps its hash. The key is the authoridwhen present (deprecated), else the product block'skey, else (a folder outside the store, built withsh_mods build) the folder's own name.sh_mods new "<name>"makes a folder under a generated key (sh_mb_key_generate: a slug with_and four random characters, never-, so decl text and cooked paths spell it alike). The Mods tab's New mod (sh_ms_new_mod_example) writes the same folder with an example that places and plays untouched: an entityDefmods/<key>/example_cratewith the game's SnapMapcrate01model, its Toybox row (snapEditorEntityDef, nothing binary: the game'sprop/new/crate01row field for field but its names and itsentityDef, so it names norenderInfo.renderModelName, which only rows whose entity has no model of its own carry) and the row's strings in the author block, then rescans, so its first build runs at once and keeps the key its block records. A store folder with neither anidnor a blockkeygets one the same way at its first build (sh_ms_first_key, run before every in-place build: the rescan,sh_mods buildandrebuild, the tab's Rebuild): under the store lock, its references tomods/<folder>/(decl text,mod.json, folder segments aftermodsunderassets/, written or cooked) are rewritten in memory, the result is staged beside it with unchanged files hard-linked, and two renames swap it in, the second undone on failure; any read or rename failure, or a binary file naming the folder, leaves it untouched and refuses that folder alone. The record'srenamedsection keeps the old name and the count for the Mods tab. An unbuilt folder serves nothing, so the rename never races a serve. An install from elsewhere of such a folder copies it in under a generated key the same way. A bundle with alegacyrecord (a converted first-generation package) keeps its declared shadows and the rules of before, and its unresolved needs only warn. In any other bundle a need that resolves to nothing fails the build, with three exceptions that only warn: an image (stock materials name virtual-texture sources with no standalone image), a need of a replacement, and a need the game's own text also names ("names , which no archive holds; the game's own names it too"). That last one covers a stock pointer (its text is the installed text) and a carried decl under the key whose stock twin, the installed decl at its request withmods/<key>/cut (sh_mb_strip_key), names the same resource: shipped md6Defs keep event and alias blocks of clips no archive holds, so a copy of one builds without dropping them. A need only the mod introduces stays an error. A model name (.lwoand the like) resolves atcooked/model/<stem>.bmodelorgenerated/model/<stem>.bmodel: the md6 collision models the death-collision entities name (md6/.../collision/<x>.lwo) ship only undergenerated/model/md6/, besidegenerated/cm/md6/. Before the needs are resolved the builder closes the bundle over campaign-only content (mb_close_campaign): SnapMap's session loadssnap_gameresources, nevergameresources, so a served decl naming content onlygameresourcesholds would leave a hole (issue 132'sdesignsystems/med_station_healnamingwallhealthstation.md6). Each such name a file needs, at any depth through the decls brought along, is added as a pointer at the game's own path (a surface,inAssets: false, nothing carried or uploaded), found withsh_mb_stock_container(a name both archives hold is SnapMap's own and adds nothing; a name no archive holds is resolved as before). A decl added this way is scanned for its own needs; what it names and no archive holds is the game's own hole and is not reported. The walk stops at the file cap or the 1 MiB manifest cap with an error naming the first need past it, and the build notes "N game files borrowed for completeness". Another installed mod pointing at the same campaign file does not settle a need: that mod is served only where a map declares it, so each bundle carries its own pointers. (Until rules 5 the store's build, whose resolver includes every installed bundle, let one stand in, so the SP doors folder rebuilt in the game derived no pointers while a bare build of the same folder derived 29; snaphak-re triage V2, F7.) The closure follows models, effects, movies and images: an animWeb'smodelInfospairs andmodelslist name md6Defs and its nodes'.md6animnames are anims; an effect (fx) names particles (declPrt), ribbons (declRibbon) and materials (lightMtr,decalMtr); a particle or ribbon names materials (material); an entityDef names movies (any.swfvalue,guiDataswfFileandguiFile), a movieswf/<stem>.swfbeinggenerated/swf/<stem>.bswfand its atlasgenerated/swf/<stem>.bimagecoming along with it. A material's image is added only where SnapMap would not serve it: an image no archive holds standalone may be a transparency or decal atlas of that name (generated/transsortatlas/orgenerated/decalatlas/, nothing when SnapMap mounts it), and an image a virtual-textured material (usevirtualmappingset) names in a source field (diffusemap,bumpmap,powermap,specularmap,bloommask,sssmap,colormaskmap) needs nothing when the material has a row in the installedvirtualtextures/_vmtr*.vmtr, whose baked pages the engine samples. A name of these kinds no archive holds is reported, not refused, like an animWeb clip. A material's render program (stageprogramand the other*Programkeys) is one unit too (mb_closure_program): when onlygameresourcesholds the program's decl, the closure brings the decl,generated/renderprogs/<name>_pc_vulkan.bin(and an OpenGL_pc.binif the archive has one), the SPIR-V the archive holds atsh_mb_spirv_request's names (split names included), and every permutationgenerated/renderprogs/permutations/<name>_<mask>.declthe installed indexes list (sh_modstock_list) with its own.binand SPIR-V; the shared includes underdecls/renderprogs/never come along. This reproducesarchive_renderprog.py's closure for all 488gameresourcesand 435snap_gameresourcesprograms of 13954591 (59 are campaign-only,newwateramong them). A program served without its permutation files stops the game (0xE06D7363 when the permutation open fails), so a missing.binor a program with no permutation fails the build naming the member, and the stage files are then checked from the.binas for a mod's own program (see Render programs). A program SnapMap holds adds nothing (the 429 programs both archives hold have the same files in each). Measured on the owner's water mod: a folder ofmod.jsonand thetemplar_watermaterial gains the 8 files ofnewwater, and the folder with its two.binfiles deleted gains those two. A model is one unit (mb_model_needs): the engine loads an md6Def's mesh, then the skeleton whose name the cooked mesh carries (a little-endian u32 length at 0x0C, then the name; "MM" at byte 2), then that skeleton's default clip<skeleton>/_default.md6anim(cooked/anim/<skeleton>/_default.bmd6anim). An md6Def usually names only the mesh, so for every md6Def a bundle serves (carried, a pointer, a surface or brought by the closure) the builder reads the mesh's skeleton name from the bundle's own copy, else the installed one SnapMap loads first, and records the skeleton and the default clip as needs beside the mesh when something holds them. These are names: SnapMap's stock adds no pointer, a campaign-only skeleton or clip becomes one. The derived pointers are recomputed every build, never carried forward: the product block lists them instockwith"closure": true, a rebuild drops them and derives the set again from its own needs (a pointer whose need is gone is gone, and the hash changes; an unchanged folder keeps its hash), while an authorstockentry and a pointer a download or migration brought stay. A block of rules 3, which had no mark, hands its pointers at the game's own path to content onlygameresourcesholds to the closure the same way. Measured on build 13954591: the owner's SP doors folder gains 29 pointers (the wallhealthstation, access panel and desk scanner md6Defs, 8 meshes and 18 clips), 40 with whole models (the 8 meshes' skeletons and 3 default clips), through the store's build as through a bare one; of the six campaign-interactables families of fidelity85,-1gainsplayer/crucible_eyesand-2the crucible particles, ribbon and materials, the gauss_beam transparency atlas and theswitch2_upandautomap_hellmovies with their atlases (11 names, the ones fidelity87 added by hand); the other four gain none.modstore.cowns the store: the mod folders, install, verification, the rebuild rule and the one-time upgrade of the retired layout, below, which the store tool runs. Files are hashed at install and onsh_mods doctor verify, never at boot.modstock.cis the read-only installed-resource bridge behind stock pointers, below. Itscontaineroperation (sh_mb_stock_container) names the archive that holds a pointer's source,snap_gameresources,gameresourcesor a loose file, by the row's name, hashing only a name both archives hold; the Mods tab's Files view says from it where a game file comes from, andmod.jsondoes not record it.modcmd.cis thesh_modsconsole command. It dispatches the serving verbs (status,rescan,palette rebuild,held) tomodserve_engine.c(a rescan runs the rebuild rule first) and ownsbuild,install,listandverify. Itsmodbundle_build_folderis the builder entry the legacy converter calls, with the game's archives as the stock resolver.modserve.creads everymod.jsononce at boot, checking sizes and never hashes, into one immutable table from request path to file; a bundle that fails is skipped with oneMODS:line and nothing else is affected. Needs are resolved once per table, through the same request paths the builder uses. Lookups allocate nothing.modserve_engine.cregisters editor rows inside the palette build (Timeline tile detour), answers the decl existence probe for served decls (the probe is detoured only when the table holds a decl), activates a map's gameplay decls at the engine's own level 1, and rebuilds the live palette inside process heap 0. A grandfathered bundle's shadows are planned like new names; the engine already knowing the source marks a stock decl, which is left to the provider. It applies a refresh in place (re-parse, reload, the anims of a map pass) and arms the companions detour at its main-thread gates.modtypeinfo.cserves the default property trees of the entity types the editor's type-info cache (idSnapTypeInfoCache) lacks. The game builds that cache once per process, one default property tree persnapEditorEntityDefregistered at that moment, keyed by entityDef name, with room for 1,499 types (its builder stops the game at 1,500 registered rows, so it can never run again on an installation with many mods), and every placed entity's tree starts as a copy of its type's (idSnapTypeInfoCache::Get). A row registered after the build (a mod's) has no cached tree: the game builds the entity's tree from the instance alone, reads its model scale as zero (modelMatrix invert failed on model <model>every frame the entity is drawn on its own) and draws the hidden badge over it. The product detoursGetand its lookup-only sibling: a name the game's cache holds is served by the game untouched; a name it lacks is served from the product's table, where the tree is built on first use the way the game's builder builds each entry (the type's default entity created through the game, its state written to text, the entity destroyed, the text parsed into a tree) inside process heap 0 for the life of the process.Getruns on a one-entry view of the table so the game's own copy-and-apply path makes the result; the lookup returns the tree itself. The table serves only after a boot self-check that builds three of the game's own cached types the product's way and finds them equal node for node; oneMODS: typeinfo:line per boot says how many mod rows resolve through the table. An entityDef whose served bytes change at a refresh loses its entry and is rebuilt at its next use.modledger.cis the served-bytes ledger: per request path, the bytes the provider gave the engine this session, read lock-free by the refresh decision andsh_mods held.modmanifest.cowns the manifest rows (a placed mod's row and a map-level one,"attached": true), carried in the map member'smodspart (The map carrier); it still reads and removes the legacysmpmod1.<index>.<count>string variables earlier builds wrote, and the next save converts them.modlegacy.cowns the retiredsmpkg.carriers, as below. A load and a save also remove anysmpprod1.<version>string variable an earlier development build recorded (one log line per map); nothing writes or reads one.modui.cis the WebView Mods tab's backend. It lists one row per mod folder (two folders declaring one id both flagged, a package a map delivered listed like any other) with what each carries, marks each installed or needing attention with its cause, reports whetheroverrides\still holds entries to migrate, describes the open map and the mods it uses, and runs Install, Verify, Rebuild, Uninstall, Remove from map, their dry runs, Migrate and rescan on the main thread, as in The Mods tab's map scope. What the tab does not show, every bundle's state with legacy ones, conflicts with their winners, shadows and verification, it prints assh_mods doctor [verify](see WebView UI). Each row names its organizing folder (group). Its Files view reads only:modFileslists a folder's files (walked on disk, dot folders skipped) and the pointers its last good build reads from the install, each with its class (f->cls), whether it is the game's own bytes and their archive, and the mod's standing cause when that names the file;modFileTextanswers one text file of at most 1 MiB of UTF-8 inside the folder (mod.jsonwithout its product block). Neither is followed by a fresh document. New mod isnewMod.modmap.creads the open map's entities, wires and Timeline references from its serialized JSON for it.modpublished.cholds a published or My Maps launch whose manifest names a mod no installed folder serves (the asset rule, below), asks the player, and fetches and resumes it or drops it, as in Published maps and missing mods. It also holds a rawmap load whose mods are missing, as in Rawmaps that name mods, and a prefab placement whose mods are missing, as in Prefabs that name mods.modexport.cwrites and reads the ZIP exports of maps and prefabs: the.jsonand each mod's installed folder, byte for byte; import installs each carried folder the asset rule does not find served already as a folder from elsewhere (sh_ms_install_as), as in Rawmaps that name mods. It has no network code.prefab_mods.ckeeps a prefab's description, tags, summary and the mods it needs in the prefab file's ownsnapmapPlusblock (prefab_block.cfinds, inserts and strips it, and removes the serializer's comments so the file is plain JSON), reads an older prefab's sidecar read-only, resolves the mods before Load / Place, and writes and reads a prefab's ZIP, as in Prefabs that name mods.modmigrate.cmoves the retiredoverrides\tree andstrings\strids.jsoninto the store once (the store tool runs it, andsh_mods migrateby hand for the packages), as in Migration of the retired overrides folder.modsound.cdelivers the Wwise sound banks bundles carry, and loads the stock banks SnapMap skips that a declared mod's sound events need, withmodbankinfo.creading the game's bank index, as in Mod sounds.modvt.cregisters each private virtual-texture family a bundle carries (virtualtextures/mods/<id>/<family>_sq<N>.mega2, the builder's only form of.mega2) as one page-source record, as in Mod virtual-texture families.companion.creads thecompanionskey of every admitted bundle's author block andcompanion_engine.cspawns them, as in Owner-bound companions.modpublish.cuploads a map's bundles when the map is published, claims them under the published item, releases the claim at unpublish, and refuses a copy to My Maps that the map service would reject, as in Publishing a map with mods.
The store. A folder is mod.json plus assets\. mod.json has
two blocks in one object: every key but snapmap-plus is the author's (id,
name, version, description, author, strings, requirements, hud, and any other key, kept and carried as the manifest's
extra; the retired shadows, stock and scope, and the retired intent keys player, extends and replaces, are read as
above), and
snapmap-plus is the product's, the whole built manifest: format, key, build,
bundle hash, built time, validated and cause, origin (by-hand for a folder
the author made), a converted package's legacy record, the derived classes
counts (adds, borrows, edits, replaces, editor, surfaces: an edited copy of a game file
counts under edits, never replaces, which is only what a folder the product received replaces;
the build and sh_mods list lines print them the same way), editor (the editor tweaks' request paths), registries (banks,
conductor, strings), edits (the derived edits of each decl at a game name), shadows, files (path, sha256, size, provides, needs) and
stock (pointers; "inAssets": false when no file stands behind one). When a
rebuild fails, mod.json is left as it was, so the last good build keeps
serving, and the store records the failure on the folder (sh_mods list:
"build failed: ; the last working version keeps serving (kept in )"); a folder that
never built is skipped. Because authors edit files in place, every successful
build of a store folder keeps a snapshot of its carried files and its
mod.json under mods\.builds\<key>@<hash16>\ (one per folder, named in the
record's snapshots section, replaced by the next successful build, removed
with the folder); while a rebuild is failed, sh_ms_entry.snapshot names the
folder the last good bytes are read from, and the serving index reads that
snapshot's bundle.json and carried files (ms_parse_bundle, from the cause
sh_ms_build_cause reports), logging bundle '<folder>': its latest build failed (<cause>); serving the last good build <key>@<hash16> from <snapshot>;
without a snapshot it serves the folder's last good block and says so. A
mod.json that does not parse is a refused build too (sh_ms_descriptor_unparsable,
recorded by sh_ms_sync): the folder needs attention with the parse error as its cause,
and the enumeration and the serving index find its snapshot through the record's
snapshots row and serve it until the author fixes the file. The
serving index takes a bundle's key from the author block's id when present,
else from the product block's key, so a folder made by sh_mods new is
served. The
product writes the block by splicing: the old member is cut from the end of
the member before it, the new one appended after the author's last member, so
the author's bytes, order and formatting never change. The canonical manifest
is derived from both blocks in memory, for the hash and for the upload; its
text is the Contract 1 text, so an unchanged mod keeps its hash. There is no
blob store and there are no hard links: a mod's files live in its own
assets\ only. A folder the author drops in keeps its name and may sit at any
depth: a folder under mods\ without mod.json or package.json is an
organizing folder and is looked into (to eight levels, SH_MS_NEST_MAX), one
with a descriptor is a mod and is not entered, so mods\demon-mods\local.cyberdemon\
is the mod local.cyberdemon named demon-mods\local.cyberdemon (its path under
mods\, which the listing, the console, the Mods tab and sh_mods build use; the
console also takes a nested folder by its own name). Every scan walks the same way:
the store listing (sh_ms_enumerate), the rebuild rule and the serving scan at boot.
An install of a folder from elsewhere places it by hash (rule 1 of DESIGN-additive 4,
sh_ms_build_folder_name): the first build of a key is <key> at the root, every later
build <key>@<first 16 hex of its bundle hash> beside it (-2, -3 ... when that is
taken). A build the product receives for a map is never placed beside the player's own
folders (owner 2026-11-10, sh_ms_placed_folder_name): a download goes under an
organizing folder named after the map, mods\downloads\<map title>\<key>\ (the title
made a folder name by sh_ms_title_segment: the characters Windows refuses dropped, at
most 60 bytes, a device name given a _; (<map id>) appended only when the record's
downloads section already gives that title folder to another map of the same title;
with no title, mods\downloads\<key>\), and a build a rawmap or prefab ZIP carried goes
under mods\imports\<ZIP name>\<key>\ by the same rule; a later build there is <key>-2,
-3 .... No hash names a visible folder: .builds\ (hidden) is the only place one
appears. A build already installed anywhere is not installed again
(sh_ms_install_stats.present), and nothing installed is replaced, so "same version,
other files" is never a refusal. Each records its origin (install, imported for a
rawmap or prefab ZIP, download). A download notes the map it was fetched for in the
record's downloads section (sh_ms_downloads_note: map id, or title:<segment>, to the
title and the folders that serve it), also when the build was already present elsewhere
in the store, so the Mods tab says "Downloaded for " (downloadedFor,
sh_ms_downloaded_for, else the title folder's name). A migration's named target keeps the older rule
(<id>, else <id>@<version>), and the upgrade's renames leave nested folders where
they are. A package a map
delivered without a version gets one
generated from its digest (legacy-<digest16>); it is part of the manifest
and its hash, so it stays in mod.json, but it never names a folder (<id>,
else <id>-<hash 8>) and the Mods tab and the doctor do not show it.
Identity is the bundle hash: two folders declaring one key are two builds,
both kept and both listed. A download whose content an installed mod of the same key already
serves is not stored; its hash is recorded as an alias of the installed
bundle. A package a map delivered is not stored when an installed mod that
was not itself delivered declares its id (whatever the content), or provides
every path it provides under another id (a copy renamed by its packager);
the installed mod answers the carrier, and the second upgrade step records
the copy's hash as an alias of it. A folder built again in place with new
content (the rebuild rule, sh_mods build, an install of a folder of the store
itself or a migration's target) records the hash its product block named before as an
alias of the new one, so a map saved against any earlier build loads the
current one. An author's own map follows their own folder with no prompt
(owner 2026-11-09; sh_modserve_row_follow, bound through
sh_modmanifest_set_follow): at every editor load (a map opened in the
editor, a My Maps play) a row whose hash is an alias of a folder of this
machine's own (product block origin by-hand or none, install or
migration) is rewritten to that folder's current build before the
listing, with one MODS: map: <key>: follows its own folder line; the Mods
tab then shows it and the next save writes it, as the save already writes
rows from the serving index. An alias of a folder the product received with
a map (imported, download, delivery) still serves the pin but never
rewrites it, and a build installed beside another of its key (no alias) is
never moved: a downloaded map keeps exactly what it pins. A published map this
machine published is treated at launch like a My Maps load (owner 2026-11-10):
when the published gate sees its item (a claim of this machine's is keyed by the
item, modsync_claim_lookup, or the record's links section names it,
sh_modpublish_item_linked), each row of the current manifest whose key one of
this machine's own folders builds is rewritten to that folder's current build
(sh_modmanifest_current_follow with sh_modserve_row_follow_own: the newest
admitted, non-legacy own build of the key) before anything counts what is
missing, with one MODS: map: <key>: follows its own folder, your published map '<item>' (<old16> -> <new16>); nothing is downloaded for it line, so nothing is
fetched for those rows and the launch's listing names the own build. A key no
own folder builds is fetched as for any map, and a stranger's map is unchanged. There is no
upgrade action. The aliases stay flat: an alias naming the old hash is re-pointed
at the new one, so one hop always resolves. After each pass of the rebuild rule
the store drops every alias whose target no folder builds to any more (a
folder deleted or replaced by hand), with one MODS: store: line. Aliases are a lookup aid for
store downloads and exports only: upload sends and claims the current build,
and export, when no folder or snapshot holds the declared hash itself, carries
the aliased build and rewrites the exported map's rows to name it, both
through sh_ms_resolve. Nothing refuses or brings anything back because of an
alias. Saving a map writes rows from the serving index, so they name the
build that serves. Removing a folder keeps its aliases while a folder of that
id remains and drops them once none does.
The asset rule. A map, rawmap or prefab pins the builds its manifest rows
name by bundle hash (DESIGN-additive 2.5: what the author saw is what every
player gets). sh_modserve_row_served(row, cause, cap) (modserve.c,
sh_modserve_row_served_for with the word "prefab") is the one predicate
every hold uses: a row is served when the installed folder at the row's hash
(or an alias of it) is admitted and every name it lists resolves, in that
build or through the serving index; missing when no admitted folder has that
hash, also when the key is installed at another hash (another build, inert
for the map); incomplete when the build is admitted but a listed name does
not resolve. Its cause is the refusal: "This map uses Hell Guards
(local.hell-guard), which is not installed." (also when another build of the
key is installed: the player is never told about builds, owner 2026-11-09) or "Hell Guards
(local.hell-guard) is installed but does not provide
mods/local.hell-guard/hell_guard_combo_enc, which this map uses." (the first
three missing names, then "and N more"; the folder's own name, else the key
alone; "prefab" for a prefab). A missing row is fetched by its hash, so a
folder rebuilt with new bytes is installed beside the build a map pins, never
over it; sh_modserve_row_other_build answers the other build for the launch
gate's wording. sh_modserve_bundle_serving with a hash answers exactly that
build (an alias resolves), never a newer one of the key, so activation and the
save keep each row's pin; without a hash it answers the build of the key that
serves with no map open: the player's own folder when one is admitted, else the
newest. The scope listing is keyed by hash too (Map scope).
What a placed entity depends on. The save closure and the map listing resolve
each placed name (sh_modmanifest_placed_names: the inherit and
moduleName values and every string in an entity's edit state) through
ms_name_file: an entityDef provider, else any served decl or snapModule of
that name, else, for a model reference (renderModelInfo.model and the like:
a .lwo, .ase, .ma, .obj, .fbx or .bmodel path), the file that
provides it under its cooked request (sh_mb_model_key:
cooked/model/<stem>.bmodel), carried or a stock pointer. So a mod whose only
content unlocks a blacklisted stock model an author placed by path is named by
the map and uploaded with it. A name whose provider is a shadow of editor-time
content (sh_mb_editor_time: the snapEditor*, snapPropertyInspector* and
snapPalette decl types, the editor's own movies) names no bundle: such a
shadow changes what the author can set, never what plays, so an author's
editor overrides never become a dependency of a map, vanilla or not. A
gameplay shadow (an entityDef, a material, a model) still does.
The player side of the same rule: a fetch whose bundle manifest holds only
editor-time content and no requirements (sh_mb_editor_only) installs
nothing, logs MODS: pull <hash>: <name> (<id>) changes only the editor (...); not installed, the map plays without it, and records the hash in the
editorOnly section; sh_modserve_row_served_for serves a row whose bundle
that section names, so maps published before this rule neither ask for nor
download an author's editor overrides again.
mods\snapmap-plus.json is the product's one record:
claims, links, pending, migration, cache (tree hash to bundle hash),
aliases, editorOnly (bundle hash to id, name and when: bundles a map
named that change only the editor) and downloads (the maps downloaded builds were
fetched for, above), each section written whole under one lock.
A record another program holds open is waited for, up to a second. A read
that still fails logs MODS: record: cannot read <file> (<why>), and that
section is not written until a read of it succeeds again, so a
read-modify-write never replaces what it holds with less; a write while the
file cannot be read is refused with the same kind of line. A record that is
not JSON is moved aside as snapmap-plus.json.unreadable-<time> when a
section is written, and a new one started; the line names the aside file.
The player reads the same failure where they acted: install and uninstall in
the Mods tab (and their console verbs) add "Some of its bookkeeping was not
saved: could not be used (); close the program holding it ... and
try again" to their result, and a publish whose claim could not be saved
shows that sentence as its upload cause (sh_mb_record_why).
Removal goes to the Windows Recycle Bin. Uninstall, Remove and the removal of
covered builds move the folder there (sh_ms_delete_mod_folder: a direct
child of the store root, under the store lock, through SHFileOperationW
FO_DELETE with FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_SILENT | FOF_NOERRORUI | FOF_NORECURSEREPARSE, a double-NUL-terminated plain path,
reparse points moved as themselves and never entered; a folder under
downloads\ or imports\ takes its emptied title and group folders with it and
leaves the record's downloads section), drop its aliases once
no folder of its id remains (sh_ms_alias_forget), and rescan; the build cache
follows at that rescan. sh_ms_remove_folder, which the store upgrade and an
import's rollback use, takes the same route under the same lock. The shell is
offered only a folder on a fixed drive whose plain path is shorter than
MAX_PATH; on a network or removable drive there is no bin and the shell would
delete without saying so. When the bin cannot take the folder (that drive or
path, or a shell error, or a folder the shell leaves in place), it is deleted
outright, links removed and never followed, and the MODS: store: line ("deleted
mods<folder> outright; the Recycle Bin could not take it ()") and the
result text ("Its folder was deleted because the Recycle Bin could not take it
().") say so; otherwise the line reads "moved mods<folder> to the Recycle
Bin". The product never brings a folder back: a map that still needs it
refuses to open with the asset rule's sentence until the player restores the
folder from the Recycle Bin by hand (the folder watcher's rescan builds it
again) or the download offer of a published map, a rawmap or a prefab installs
it again. Uninstall also clears the open map's undo history (see The Mods
tab's map scope), so Ctrl+Z cannot bring back what
used the mod.
The retired recycle bin. Earlier builds moved removed folders to
removed-mods\ beside mods\ and recorded them in the record's removed
section. The store tool's migrate, after the store upgrade, runs
sh_ms_bin_sweep: every entry of removed-mods\ goes to the Windows Recycle
Bin (links removed, never followed), then the empty folder and the removed
section go, with one line per entry ("removed-mods: moved to the Recycle
Bin") and one summary ("removed-mods: 3 folder(s) moved to the Recycle Bin; the
bin is retired"); a later run finds nothing. An entry that cannot be moved
stays for the next run.
The store migration tool. The game runs no store migration at boot.
snapmap-plus-store.exe (src/store/) links the store sources (modstore.c,
modmigrate.c, modlegacy.c, modbundle.c, modstock.c and what they use)
with a stand-in for the serving layer (store_seam.c), and no engine, DLL or
WebView code. check <store> lists the work it finds, one line per kind
(folders of the retired layout, blobs\, legacy\, the old record files, the
second upgrade step, removed-mods\ or its record section, package entries of
overrides\ the record does not mark as migrated, the loose files of
overrides\ and a strings\strids.json not yet moved, a document that is not
a strings document, and an overrides\ or strings\ folder left to retire)
and exits 0 when there is none, 1 when there is, 2 on an error; it changes
nothing (sh_ms_upgrade_scan, sh_modmigrate_loose_scan).
migrate <store> [--doom <folder>] refuses while DOOM runs, then runs the
layout upgrade, the bin sweep, the overrides migration, the loose step and the
retirement of overrides\ and strings\ (sh_modmigrate_retire), each only
when check finds its work, with every delete through sh_ms_set_discard to
the Recycle Bin (store_recycle.c: SHFileOperationW with FOF_ALLOWUNDO, on
a fixed local disk only, links removed first). The overrides migration and the
loose step's loose files need the game's archives for their stock pointers: the
--doom folder, else the one Steam names; without either they are reported and
left (a strings document alone needs neither). It prints the store's own log
lines as its action lines and a summary, and exits 0 when nothing is left to do,
1 when a later run could still do something, 2 on an error; a second run finds
nothing and changes nothing. The installer runs it on install and update (see
installer/README.md).
The rebuild rule is unchanged: a folder without a product block is built at the
next rescan, or at the next boot (below).
Crash leftovers. An install, a download and a first-build rename assemble a
folder as <name>.staging-<pid> and move the folder they replace aside as
<name>.old-<pid> before the swap; the listing and the serving scan skip both.
At boot, before the serving index is read, sh_ms_recover_work walks the store
(organizing folders included) and .builds\: a work folder whose process is
still running is left; a .old-<pid> folder whose target is missing is the
folder a session took away when it ended between the two renames, and is put
back ("put back from : an earlier session ended while it
was being replaced"); every other one is removed ("removed , a work
folder an earlier session left when it ended mid-install").
The folder watchers. The lists follow the disk. The window's host
(snapmap_plus_ui_webview.cpp, folder_watch.h) runs one thread that watches
%LOCALAPPDATA%\snapmap-plus\prefabs\ and mods\ with
ReadDirectoryChangesW (subtree; file and folder names, last write, size). A
change in the prefabs folder refreshes the Prefabs list 300 ms after the last
change of a burst (the page keeps its selection while that prefab exists and
clears Prefab Details otherwise). A change in mods\ asks for the ordinary
rescan (the Refresh button's, as SH_MODS_ACT_WATCH_RESCAN) after 1500 ms of
quiet, on the main thread through run_on_main; the backend defers it while
Play runs, a map loads or a store write holds the lock, and the host asks again
two seconds later. The Mods tab re-renders from the document that follows. The
product's own writes fire the watcher too: a change seen while the store lock
is held (SH_MODS_STORE, modstore_lock_busy), or within a second after a
hold ended, is dropped, so an install or export in progress never triggers a
rescan mid-write. An author's edit during a long hold looks the same, so when
that second ends with a change dropped, one rescan follows (sh_fw_store), unless the
window's own rescan already read the folder after it: a New mod, an install, a rebuild or a
Refresh that succeeded, and the watcher's own rescan, end with the backend's rescan, so the
changes dropped before it owe nothing more (sh_fw_covered, poc_mods_rescanned) and one
rescan follows a New mod. A change dropped after that rescan still owes one. A rescan of
unchanged trees is cheap by the rebuild rule. Each refresh and rescan logs one
UI-log line with its reason (watch: ...). A folder that does not exist yet is
opened again every five seconds.
The rebuild rule: a folder is built again when its tree hash (the author's bytes of mod.json
and the path, size and time of every file under assets\) is not a key of the
cache for its bundle; that runs on a rescan (the Mods tab, sh_mods rescan,
an install) and at boot (sh_ms_boot_sync): after the boot index, a thread of
its own checks the trees and, when a folder is not built yet or changed while
the game was closed (the first boot after a conversion), builds it as a rescan
would, with the install's indexes (modstock.c) as the stock reader, then
rebuilds the serving index, whose listeners pass the table to the game. A first
build of the 15 converted folders takes about 10 s, so it never runs on the
boot thread; the same folders built this way carry the same bundle hashes as an
in-game rescan's. The thread waits until the startup install has released the
store (sh_ms_boot_release, at the end of the install in dllmain.c): the
install takes the store itself (the publish launch reads the upload queue and
the claims), and a build holding it delayed the startup by the build's length.
While it builds, the thread hands the store to any operation waiting for it
between two folders, so an editor map open in that time waits one folder's
build at most; only the index rebuild at its end touches serving.
The store tool's sh_ms_upgrade converts the retired layout once (before the
overrides migration): every
<id>@<version>+<build>\ folder gets mod.json from its bundle.json and
.state.json (read back with the same hash before the old files go), hard
links become copies (the linked file is renamed aside, copied back to its name
and checked against its hash, and only then is the renamed original retired;
on any failure the original is put back, and one an interrupted run left aside
is put back at the next run), a missing file is restored from blobs\, product folders
are renamed to <id> (or <id>@<version> when one id has several), legacy\
folders move into mods\ or are dropped as aliases, blobs\ is removed, and
claims.json, publish-links.json, pending-uploads.json and
.migrated.json are folded into the record. Everything it retires goes to the
Recycle Bin. It logs one MODS: store: line per folder and a summary (the
tool prints them), and every step can be repeated. A second step runs
once per store, also on one that went through the first already (the record's
layout section becomes 2): it removes every delivered package an installed
mod answers by the rule above and aliases its hash, renames a product folder
left alone with its id under <id>@<version> to <id> and any folder named
after a generated version, and collapses a completed migration section to
complete, migratedAt, source, the rows of folders not done (skipped,
refused or pending) and trees, which maps each converted overrides tree to
its folder and still resolves maps published before Contract 5 (aliases map
hashes, not trees); the folder names in it follow the drops and renames. A
pass of the overrides migration writes the same collapsed section when it
completes, and the Migrate button counts an overrides\ entry the section
does not list as done unless it was created or written after migratedAt.
The product block's legacy record (tree fingerprint, grandfathered shadows)
is kept as it is. One MODS: store: line per dropped or renamed folder and a
summary.
A bundle file may be a stock pointer instead of carried bytes: Contract 1's
file kind stock, {"needs", "path", "provides", "request", "stock": {"sha256", "source"}} with no blob and no size, where source is an
installed resource path and sha256 the hash of the installed bytes
(modbundle.h has the grammar). The builder makes one of every file whose
bytes equal installed content, and an author writes one in the descriptor's
stock object ({"<request>": {"source": "<installed path>", "sha256": "<optional>"}}, the hash filled in by the builder) to alias installed content
under a mod name. Pointers do not count toward the 64 MiB and 256 MiB caps and
the extension whitelist does not apply to them, because nothing is carried;
the store never receives their bytes (no copied file, nothing uploaded), so a
converted package or a copy-of-stock mod uploads only its authored and edited
files. modstock.c answers them from the player's own
install, read-only: it parses base\snap_gameresources.pindex and
base\gameresources.pindex once, on the first question (about 171,000 rows
with bytes, 20 MB held, 125 ms on build 13954591; an empty mods\ never loads
it), reads a row's slice from .resources or .patch with one positional
read, inflates the engine's sync-flush raw DEFLATE (raw_deflate.c), and
falls back to loose files under base\ and the install root (a .pages
virtual texture). It reads the archives directly rather than through the
engine provider because SnapMap's provider does not see campaign-only
content in gameresources, which is what the boss packs copy. Identity is
size first: the builder hashes only entries whose decoded size equals the
file's, at the file's own path, then at that path with its mods/<key>/
segment cut (either spelling of the key; where a copy moved under a key came
from), each time every row of the name in both archives (they hold different
bytes under some names, and the one whose bytes match is named), then entries
of the same size and extension elsewhere (a renamed copy, in size, extension,
archive and name order until one matches or 256 MiB are hashed for the file;
no candidate count, since image sizes the game uses for thousands of rows
would otherwise stop the search early), and each slice is hashed at most once
per process; measured on the
owner's packs, a build hashes about the bytes that become pointers, never the
archives. Installing a downloaded bundle resolves every pointer first, and a
game that lacks the entry or holds other bytes (a different revision) refuses
the bundle with that first cause before anything is fetched; sh_mods verify
checks pointers the same way. The serving index never reads the archives at
boot; a pointer is read when it is first opened, accepted only with its hash,
and a pointer the install cannot answer falls through to the engine with one
logged line. For the conflict rules a pointer's bytes are the installed bytes
(its hash stands for its blob), so a carried copy and a pointer to the same
bytes are one file, and a composed list decl reads a pointer's installed text.
The builder's and the Mods tab's stock-name checks ask the bridge when the
engine provider does not have a name.
The provider open (ov_open_body in overrides.c) serves, in order: the
placement grid, map navigation, the generated Grid Room variants, installed
mods, the built-in defaults, then the engine (a mod's version of a built-in
name, such as a player's expanded Lift tile, wins over the baked default, as the
retired overrides layer did). Opens with mode 2 or higher are
never served. A shadow applies while a map that lists its bundle is open or
played (see Map scope); a new name applies once it is registered: editor rows at the first palette build (or
sh_mods palette rebuild, or the load of a map that names their bundle, below),
gameplay decls when a map that names their bundle loads. Two builds of one key
are never a conflict: each map serves the build its rows pin and the other is
inert for it; with no map open the player's own folder of the key (origin
by-hand, install or migration) serves its names for the Toybox when one is
admitted, else the newest build (built time, then folder): a build the product
received for a map (a download, an import, a delivered package) never serves
over the folder its author edits (owner 2026-11-10, ms_preferred: the legacy
SP doors download had become "newest" over the owner's folder). The gate's
"installed at another build" answer (sh_modserve_row_other_build) follows the
same rule. The index build logs one MODS: key <key>: bundles <hash16> (<version>) and <hash16> (<version>) both provide paths with other bytes; ... line.
Cooked movies need a second route (modswf.c). A .bswf is an idFileResource,
and its Load (vtable +0x40, signature FileResourceLoad) opens through the
provider only while the map-load lifecycle state is below 2; from 2 on it asks
the resource manager (+0x68), which reads the mounted containers unless
resource_loadLooseAssets is set, and a miss becomes an empty file returned as
success, so a bundle's movie used to load blank with no message. modswf.c
swaps that one vtable slot (the only read-only qword holding the Load; no code
is patched). For a generated/swf/...bswf request the serving table answers,
it runs the engine's own below-2 sequence at any state: a named memory file at
the resource's +0x38, then the open-into helper, which opens through the
provider and copies the bundle's bytes. Everything else, and a served movie
whose open fails, goes to the original Load. The four engine calls it uses are
decoded from the resolved Load body, and the open-into helper must call
+0x148. The cvar is not used: it is read by four engine paths on each
executable, two of them generic opens, and would make every file and JSON
resource load walk the search paths on disk. A served movie applies at that
resource's next Load: a movie first loaded in a map is purged at map unload, so
a shadow installed between maps applies at the next map load; a movie resident
since boot is served only when its bundle is installed at boot. The builder
admits .bswf only under generated/swf/, names it as the consumer does
(swf/<stem>.swf), and applies the usual rules: a stock movie is a listed
shadow, a new one lives under generated/swf/mods/<id>/ with its atlas
generated/swf/mods/<id>/<stem>.bimage beside it. Each served movie logs
MODS: swf: served <request> (<bundle>) at load state N (the first 32).
Display text reaches the engine's #str_ table through strids.c, which reads
two layers and keeps the first writer of each key (case-insensitive): the
strings.en object of every admitted bundle's author block (installed mods
before bundles a map delivered, then by id case-insensitively, then version,
through sh_modserve_each_bundle_extra), then the baked defaults. Keys omit the
#str_ prefix decls use, and only en is read. When two bundles give one key
different text the first stands and one B1: strids REFUSED line names both;
identical text is not a conflict. The pass summary reads N #str_ entries (bundles B, baked D). The player's own document of earlier releases,
%LOCALAPPDATA%\snapmap-plus\strings\strids.json, is not read: the store
tool's loose step moves its keys into the mod My overrides (see Migration of
the retired overrides folder), so
they are ordinary bundle strings and outrank no other mod. The first injection runs after the boot index
is built, so it already carries bundle strings. Every later index build
(sh_mods rescan, an install, a migration, a fetched bundle) requests a
refresh that re-reads the layers and re-sorts the table on the main thread: at
once when the build ran there, otherwise through the apply call slot or at the
next editor palette build or map activation. A refresh updates changed text in
place and retires keys no layer supplies any more.
A sound decl a mod carries (generated/decls/sound/mods/<id>/<stem>.decl)
names the Wwise event play_<stem>: the engine computes the event id from the
decl's own name, so a decl whose stem is a stock event's (an alias) plays that
stock sound with no bank, and one whose event lives in the mod's own bank
plays once that bank is loaded. The builder makes a soundShader or sound
key naming mods/... a need of type sound; a stock event name is not a need.
A bank is admitted only as sound/soundbanks/pc/<stem>.bnk (Wwise opens banks
by file name in that one folder), with the stem <id>_<rest> (the id's . and
- as _), letters, digits and _ only, and without _sp, _snapmaps or
initial, which the engine's listed-bank filter skips in some game mode; its
BKHD chunk must be version 113 and carry the id the game loads it as, FNV-1 of
the lower-cased stem, so a renamed bank is refused rather than loading under
the wrong id. A bank is always carried: never a stock pointer, never a shadow.
A converted first-generation package keeps its banks as plain files.
Wwise reads banks with its own CreateFileW, not through the provider, and
the engine lists the bank folder only inside LoadBanks, so modsound.c
delivers them itself, with two vtable-slot swaps and no code patch: the
resolver's open by name (AudioFileOpenName, held in two read-only vtables)
answers a served bank's file name by opening the bundle's file and filling the
AkFileDesc as the engine's default hook does, and every served bank is
submitted to the engine's own per-bank wrapper (AudioBankSubmit, the
filter and the async LoadBank) on the main thread inside process heap 0, at
the first editor entry or map load once Wwise is up (the hardware object is
soundSystem+0x140, decoded from the s_loadBanks function), and at once
when sh_mods install rebuilds the index. The engine prints its own result,
async load success id <id> : <name> with the id as a signed number. The
LoadBanks slot (AudioLoadBanks, hardware vtable +0x30) resubmits every
bank after s_loadBanks and s_restart, and runs them in process heap 0:
Wwise allocates through the engine allocator's current heap, so a rerun from
the console with a map open put the reloaded stream packages in the map heap,
the map unload freed them, and the next streamed sound read a freed package
(a crash at the Play load). A mod installed mid-session plays at
its next map: its banks go through the same per-bank wrapper at the next
main-thread pass, never through s_loadBanks with a map open. A bank whose
bytes change under a name already loaded keeps the loaded copy (Wwise keeps the
first bytes for a bank id and answers a second load with 69,
AK_BankAlreadyLoaded) until the game restarts, and a removed bank stays
loaded until then. Two builds of one key never share a stem: the serving
index serves every carried bank of a keyed bundle as
sound/soundbanks/pc/<stem>.<hash16>.bnk, with its BKHD bank id rewritten
to that stem's FNV-1, and rewrites every quoted "<stem>", "<stem>.bnk" or
".../<stem>.bnk" in the bundle's served decl texts to match; the rewritten
bytes are written once under mods\.served\<key>@<hash16>\ (a dot folder
the scanners skip) and served from there, with their own size and hash. A
changed build is therefore a new bank to Wwise, and the ledger and the
refresh see a new name. A grandfathered package keeps its banks as they are. sh_mods status lists each bank and whether it was
submitted. The events file (soundbanksinfo.events) is not extended: a mod
event needs no record to play (it only feeds the by-id lookup; without one
the event is never distance-virtualized).
A mod's sound decl at a stock event's name borrows that event, which plays
only while a bank filing it is loaded. SnapMap's listed-bank filter skips
every bank whose name holds _sp; on build 13954591 that is
doom_weapon_sp.bnk, the only bank filing 4 of the game's 7,649 events (the
plasma fly-by and whiz-by among them). modbankinfo.c reads the game's
base\sound\soundbanks\pc\soundbanksinfo.xml once, on the first question,
and answers which skipped bank a sound decl's event needs (its name, else
play_ plus its last path component). The builder lists those banks as the
product block's registries "banks"; the serving index adds what each
bundle's served sound decls need, each checked against the game's index. At
the map pass modsound.c loads each bank a declared bundle needs, once per
process: on the main thread inside process heap 0, through the call the
per-bank wrapper makes once its filter passes (operator new and the cookie
ctor, then the async LoadBank with the product's callback, which records
the result and hands the cookie to the engine's own), waiting up to 3 s for
the callback so the events exist before the level loads. It never goes
through the wrapper, never through s_loadBanks, and never changes the game
mode. The bank stays loaded until the game exits (about its file size, 85 MB
for doom_weapon_sp.bnk). sh_mods status, sh_mods doctor and the Mods
tab's facts show each needed bank and whether it loaded.
A mod can ship a new render program mods/<id>/<name> (no . in the last
component) and a material that names it in quotes; the engine opens every file
of it through the provider and needs no restart. The builder checks what the
engine checks (mb_check_renderprogs): each _pc_vulkan.bin (and an OpenGL
_pc.bin, if shipped) starts with 0xB68800AD and carries MD5fold of its decl
text, trailing spaces and line ends removed (otherwise the engine silently
compiles the text); each SPIR-V header is {4, hashA, hashB, length} with
hashA equal to MD5fold of the matching stage text in the .bin, which the
engine enforces at a map load with "out of date"; and every stage and
permutation is present: the decl, the .bin and generated/spirv/<name>.vspv
and .fspv for the program, and the same for each
generated/renderprogs/permutations/<name>_<mask>.decl under
generated/spirv/generated/renderprogs/permutations/ (Vulkan binds the base
files on GPUs without AMD's three shader extensions and the permutation on GPUs
with them; a missing stage file is fatal at bind). A permutation decl is named
by its request path, the string the engine looks it up by; it is served, not
registered. A material naming a campaign-only program brings the program's
files along as pointers (the closure under Mods), checked the same
way from the installed bytes. A bare program name in a material, shared includes under
decls/renderprogs/, vulkan_pipelines.bin, generated/glslBinaries/ and
generated/glsl/ are refused. MD5fold is MD5 with its four words XORed
together. OpenGL compiles the decl text by default (r_useGeneratedRenderprogs
0) and may write the permutation decl into the player's base\generated\.
The first open of each served render-program file logs
MODS: renderprog: served <request> (<id>@<version>, <n> bytes) (the first 64),
which shows the variant this GPU binds.
A bundle's companions key (author block of mod.json, kept under extra)
maps owner entityDefs, which must be the bundle's own mods/<id>/ names, to
1..16 companions {entityDef, origin, axis, activate, bind} (companion.h
has the grammar and refusals; a refused block adds nothing and is logged
COMPANIONS: <id> REFUSED: ...; the first bundle to declare an owner keeps
it). companion_engine.c detours idClass::CallSpawn (VK 0x141583A00, GL
0x141584A90, 14 stolen bytes) only once an admitted bundle declares an owner:
at startup when one does, otherwise at the first main-thread gate after one is
installed (sh_companions_ensure, called beside the probe's own lazy commit at
the Play build sh_modserve_play_begin, the map load
modserve_activate_bundles, the editor palette pass, sh_mods rescan and the
return to the editor). CallSpawn runs on DOOM's main thread only, with no
inlined copy (reports ADD-G2, and ADD-V1 live: 2,132 Vulkan and 2,130 OpenGL
entries, all on the main thread), and the editor's map load spawns nothing
while Play precedes every spawn burst, so a commit from the main thread at one
of those gates is race-free and comes before the spawns it is for. The gate
checks, in order (sh_companion_arm_decide): the boot resolution succeeded
(it is cached; nothing is resolved later), the detour is not live yet, the
caller is DOOM's main thread (main_thread_id; never armed from another
thread), the serving index was published again since the table was built and
the rebuilt table has an owner, and CallSpawn's 14 bytes are still the
expected ones (another detour there refuses). Once committed the detour stays
for the session; it is never unhooked mid-session, since a main-thread frame
inside GetType returns into the trampoline. It logs COMPANIONS: installed ... (<gate>) and one line per owner
spawn (<owner>: n of m companions spawned), the first 64 lines. After the original spawn chain
returns, an idEntity whose entityDef (+0x6D0) is an owner, or inherits one
through mods/ names (+0x58), gets each companion in list order: spawned
the way idTarget_Spawn spawns at a pose (game vtable +0x448 creates it,
its spawnPosition +0x3A8 and spawnOrientation +0x3B4 get the owner's
physics origin plus origin * axis and the axis axis * ownerAxis, and
+0x458 registers it and runs CallSpawn), so the class's own Spawn places it.
Placing it after the spawn is not enough: SpawnEntityDef (+0x450) runs
CallSpawn before it returns, entity SetOrigin and SetAxis write the physics
only, and an idProp_Coop stays where its Spawn presented it. When the create
and finish calls do not resolve, the companion falls back to SpawnEntityDef,
SetOrigin, SetAxis and UpdateVisuals (+0x3C0, as the engine's setOrigin
event pairs them); the per-owner line counts both routes. Each companion is
then bound (idEntity::Bind, oriented) so it moves
with the owner and the owner's destructor removes it, and appended to the
owner's targets (idEntity::AddTarget) so a native ActivateTargets (Use
with activateTargetsOnUse) activates it after the owner's earlier targets.
SpawnEntityDef constructs the class the decl parsed (CreateManagedClassFromDecl
reads decl +0x60 through decl vtable +0xB0), so a companion whose resource
state (+0x2C) marks a failed load or no load yet is skipped and logged rather
than spawned as the bare idEntity a defaulted decl would give; the per-owner
line names the class the first companion spawned as.
Map entities reach CallSpawn after SpawnEntitiesForLayers has registered all
of them, so companions number after the map's own. A companion's own
companions are spawned once more, no deeper. Nothing is spawned when the game
is a network client. Access violations inside the pass are contained and
counted; an engine exception propagates to the engine. The signatures are
private to companion_sigs.c and checked on both executables by
companion_test. The capability name snapmap.owner_companions is reserved
for the engine-capability facility once it carries hook rows.
A bundle module is maps/modules/mods/<id>/<leaf>.decl (provides snapModule,
named by that path, the name a map's moduleName holds) plus
generated/decls/snapmoduleinfo/mods/<id>/<leaf>.decl, which the builder
requires in the same bundle. Every other file is a name the engine derives: the
render model maps/modules/palettes/mega_blessed/mods/<id>/<leaf>.bmodel (the
loader's palette group is the stock palette's, mega_blessed), and under
maps/modules/mods/<id>/<leaf>/ the collision _combo/world.bcm and
<leaf>_floor_collision.bcm, navigation generated/.../<leaf>.baas_monster48,
96 and 128, <leaf>.sbsp, <leaf>.ambientsh, _combo/_world.tome and
lightprobes/<entity>_compressed.bimage (the probe path is built from the
module's name and the probe entity's name). A multiplayer map's files are
byte-identical stock pointers at those names. The per-map kinds .sbsp,
.ambientsh, .tome and .pages are admitted only as pointers
(sh_mb_pointer_only_kind). A pointer that restores installed content under
its own name (sh_mb_stock_restore: the request is its source, or
generated/decls/<type>/<source>.decl for an own-path decl such as a map's
mega.decl, which models name with .decl) sits outside the namespace without
a shadows entry; the activation plan treats it as a shadow, leaving it to the
provider when the engine knows the name and registering it when it does not
(SnapMap does not see multiplayer content in gameresources). Placement reuses
the Grid Room route: the FindModule and HasModule detours ask the serving index
(sh_modserve_module_served) about a name the stock palette lacks, and a served
module is loaded with the native loader into a private one-module palette whose
loader context comes from the stock palette's first record; the snapModuleInfo
is registered the same way as a variant's, without the one-floor, four-wall
check. Its snapModuleInfo and collision are checked in the serving index,
never read through the Grid preflight (which claims only Grid Room names); a
refusal logs MODS: module <name> refused: <step> once, and a load logs
MODS: module <name> loaded into a private palette (mega_blessed). The map
validator (RepairAndMigrate, VK 0x1412488e0 / GL 0x141247f10) asks HasModule
for every instance near its end, drops a module it refuses ("Couldn't load
module") and then returns 4 when the entity check fails or no instance is
left. The private palette's collision is retained across Play like a
variant's. The sound BSP, light grid and occlusion tome (and probe images if they come
the same way) are idFileResources that BuildSoundWorld, SetTome and
LoadAmbientLighting materialize at Play, when the Load reads the mounted
containers; modswf.c's Load slot serves a bundle's copy through the provider
as it does a movie, logging MODS: file: served <request> (<bundle>) at load state N. There is no Add-browser tile; a saved map or a module prefab that
names the module places it. The module decl's bounds decide the placement
limit check; for a multiplayer map they cover the arena, so it fits the native
16000 bound at the origin.
A material binds to a virtual-texture family only when a page-source record
with exactly the material's landpagefile name exists when the material is
parsed; otherwise the engine classifies it as a unique family and it draws
with default images. The engine creates such a record for a private family on
no path of its own and never reads a private family's .vmtr rows, so
modvt.c calls idVirtualTexture::SetSource(record, "mods/<id>/<family>", "virtualtextures/mods/<id>/<family>.pages", flavor, 2, 0, NULL) per family.
SetSource's mega2 loader opens the served _sq1 to _sq16 members through the
provider; no .pages file is needed, and materials carry an explicit
virtualmapping instead of rows.
- Thread and time: DOOM's main thread, inside process heap 0, once the VT
system has built record 1 (
_vmtr). The serving index calls a listener after every table it publishes; on the main thread (sh_mods install, rescan) the families are registered at once, on another thread (boot, a fetch, a migration) at the next decl registration pass. Every pass (the editor palette build, a map's activation) registers first and then parses, so no material of a bundle is parsed before its family's record exists. A sync is idempotent. - Records: 32 slots, records 1 to 31. Record 31 is never taken
(VirtualTextureForMaterial releases it on any lookup miss), no record the
product did not create is touched, and a family that finds 1 to 30 in use is
refused with one
VT:line. Each record costs about 14 MB (11,184,810 bytes of host page table for the fixed 12 levels, the reader's index and the page-table image; 13.9 MB measured on Vulkan). - Release: when a family's bundle leaves the index (or another build replaces it) and no registration pass has run since the family was registered, its record is released. After a pass its materials may hold the record, and the decls stay registered for the process, so the record is kept until DOOM exits, with one line.
- Renderers: flavor 2 on Vulkan; on OpenGL, flavor 4 when the AMD sparse texture extension and its cvar are both set (the test the engine's own lookup makes), and no registration otherwise.
sh_vt(vt_harness.c) is the diagnostic on the same binding:listmarks the product's records(product),syncruns a sync, and its manualregister/releasenever touch a product record. The member format is vt-baker.md.
A mod's hud key (the author block of mod.json) selects how
the stock ammo widget shows a weapon (modhud.c, the beta.19 weapon_hud
contract: {"weapons": {"<weapon decl>": {"ammo_display": "weapon" | "engine"}}}).
weapon removes the multiplayer mode's forced numeric display for that weapon,
so a nonpositive capacity shows the widget's infinity frame; no ammunition,
decl or widget field changes. Rules are read at startup from every admitted
bundle, installed or legacy; identical rules compose and conflicting ones
refuse the whole table with both bundle ids logged. The widget update's one
call to the mode predicate (WeaponHudModeCall, WeaponHudGameMode) has its
aligned rel32 swapped to a near relay that passes the widget, whose weapon decl
is at +0x1F8; every other caller of the predicate is untouched. Logs:
weapon-hud compiled: N rules, weapon-hud installed: ..., and
weapon-hud active: ... on first use.
When bundles of different keys provide one path with different bytes, the
open map decides among the providers it declares (Map scope):
the fewest needs the declared bundles do not provide, then the bytes most
declared providers carry, then the order of the map's rows. Nothing about the
install counts (time, folder, or whether a map delivered the copy), so a map
serves the same bytes on every machine whatever else is installed. With map
scope off, the static winner serves: the same two rules over every admitted
bundle, then the key and hash in name order. A path that only undeclared
bundles provide is left to the game while a map is open: their names have no
reach in it. (Before phase 2 one provider always served such a path, because
leaving it to the engine broke every boss pack at Play when their other files
were served and named it; the Cyberdemon's animWeb defaulted to an empty one
and AnimWeb ... has no nodes ended the process. A map that declares the pack
now serves all of it.) When every provider's
text is a decl that differs from the others only inside lists (a block of
num = N; and item[i] members, as the encounter conductor's aiTypeList or
the whitelist inspectors' validEncounters, which every boss pack extends),
or only inside bags of repeated entries in the bare statement grammar of an
md6Def (the anim "<clip>" { event ... } blocks of its events, its alias
rows), the winner's text is served with the other declared providers' entries
appended (composed per listing and memoized on the path, ms_scope_compose),
so several boss packs a map declares work together and several mods may each
add event rows to the player body; an undeclared mod's entries are never
composed in. The composed text keeps each key = value statement's ;
terminator as its source wrote it: an md6Def's meshKits pairs ("doors" = "")
have none, and the engine's md6Def parser refuses the decl (expected '=' but found '}', issue #160) when one is added. An appended entry takes the
convention of the block it joins, a renumbered list's num keeps the
winner's, and texts that differ only by terminators compare equal. Editor-time bundles (below) compose with each other in every map,
as before. One MODS: conflict: line at the index build names the
providers, the static winner and the reason; sh_mods doctor prints, per path,
which layer serves it for the open map and why. A
registration pass (editor rows, map activation) also withdraws an animWeb
whose modelInfos or models block names a model that no bundle provides and
the engine cannot find. The engine's parse looks each model up with DeclFind
(no makeDefault) and a miss throws an idLexerException that the animWeb
parse catches itself (13954591, both renderers): the web keeps what it had
parsed (nothing past props, its nodes freed first), is not marked failed,
and the load reports success. So for a decl the pass loads now, the engine's
own lookup decides, not the game archives, which also hold campaign md6Defs
SnapMap cannot load (issue 132: a converted doors package carrying
designsystems/med_station, which names the campaign
wallhealthstation.md6); a stock shadow the engine parses later keeps the
archive answer. A stock animWeb it shadowed is served by the game again, and a
new name is not registered. A load the engine refuses although it reports
success is caught by its error text naming the decl's file (the reporter
copies it to last_error_msg before the throw); the decl is not loaded a
second time and is withdrawn. A withdrawn file is not parsed again in the
session, and each skip or refusal prints one console line,
Snapmap+ mods: <bundle>: animWeb '<name>' not loaded: it names model '<md6>', which SnapMap cannot load (campaign-only or missing) or ... not loaded: the game refused it: <engine error>. Before
the Play level load the SnapBuild detour re-checks the bundles' requirements
(MODS: play: requirements live: ...); the engine itself does not reset the
blacklist gates between the editor and the level load. The editor pass
also raises to the session lifetime (4) the decls an editor row points at
directly (its editor animWeb, its md6 render model, its preview material): the
row is kept for the session, but those objects were created after the boot
promotion at level 1, so the purge on entering Play freed them and the editor
entity rebuilt after Play bound a freed animWeb. The rest of the closure (an
md6Def's MD6 model and skeleton, an animWeb's anims, a material's images) is
raised the same way: the pass takes a watermark of the engine's resource
lists before it runs and keeps every resource created since then that is
still at level 1, and every step of the editor plan is registered at the
session lifetime.
The editor closure is every served file of a bundle that adds editor rows,
and every served file one of those needs, at any depth
(ms_mark_editor_closure, per table). The whole bundle counts, not only what
its rows need today, because a later build's row can name a decl a map pass
already registered at level 1 (an open map's activation had made the keycard
md6Def a new row attaches, and keeping that decl alone outlived its model).
Every pass treats
it as the boot editor pass does, because after an in-session install the
same work happens elsewhere: the rescan re-parses the changed rows and
registers the new decls they need (an editor-only md6Def, say) before the
palette rebuild takes its watermark, and an idDeclFX an fxInfo names, an
attachment's md6Def or a new md6Def's MD6 model and anims were then created
at level 1 outside any watermark; the rebuild's keeper raised only the decl
objects a row names, not what they hold, and the Play purge freed the rest
under them (VK purge 0x141572170 / GL 0x141573300 frees every level-1
resource; the editor's FX start VK 0x1412a9e60 / GL 0x1412a9540 and
idEntityModels::Init VK 0x1412ab690 / GL 0x1412aad70 then read freed
objects on the return to the editor). So a refresh applies the closure's
pending changes first inside a watermark of its own and keeps what they
create, then the rest at the engine's level
(sh_modserve_each_refresh_part); a plan step for a closure decl keeps its
decl in any pass (sh_modserve_step.persist), and outside a watermark
me_run runs those steps first inside one (sh_modserve_plan_split), the
rest after; and a rescan whose rows changed runs the keeper inside a
watermark before the palette rebuild, which may be refused and retried. Outside
the editor plan such a step is kept unless the engine already holds the decl
permanently (persist 2), which is left to the game as a map pass leaves it.
A decl the keeper finds at level 1 from before its watermark (created by the
engine's own load) is counted as older: an md6Def is left whole at level 1,
since a row names it only by name and the editor finds it without creating it
(VK FUN_14123b340 / GL FUN_14123a7e0); an animWeb or material a row holds by
pointer is kept, and what it holds is kept by name, as below.
A watermark keeps only what a pass creates, so a decl a pass keeps after the
engine's own load parsed it would outlive what that parse created. An open
map's load creates the decls its entities name at level 1, and their parse
creates what they hold: the weapons pack's chainsaw pickup web made its clip
(.../chainsaw_pickup_pre_idle.md6anim) there and caches the clip's pointer
in a blend-tree entry; the map pass then kept the web (4), the clip stayed at
1, the Play purge freed it, and idAnimWebBlendTree::Init (VK FUN_1417244c0 /
GL FUN_141724fb0) used it at the Play spawn (a divide by zero at VK 0x15d2574
/ GL 0x15d3994, or a read at VK 0x1a1d3d9; snaphak-re triage X1). The rule is
therefore by name, not by time: every resource a level-4 decl of a served
bundle holds is level 4 (sh_modserve_holds_raise). From each non-surface
decl of an admitted bundle the engine holds at level 4, the needs the builder
recorded for its file (an animWeb's clips and md6Defs, an md6Def's mesh,
skeleton and clips, an entityDef's models and md6Defs) are closed through
every index file that provides one, looked up by the list's type (+0x08;
anim for idMD6Anim, VK 0x140215b00) and the folded name, and raised from 1
to 4. It runs after every serving pass (me_closure_end at the outermost
watermark, me_editor_rows) and before the Play level load
(sh_modserve_play_begin), so a held name the engine creates after a pass (an
editor spawn) is kept before the first purge that follows. A log line
<phase>: N resource(s) kept decls hold kept for the session with them names
what it raised. Nothing the product keeps is released in a session, and a
name a kept decl no longer needs is not raised by later runs. Since rules 6
an md6Def's needs name its mesh's skeleton and default clip too (read from the
cooked mesh, see the builder), so a raised mesh never keeps a skeleton at 1
that the Play purge frees (the keycard of
interact/yellow_key_tech_corpse, VK 0x1a05687; snaphak-re triage V2, F7).
What the needs do not name (a stock mesh's materials, a skeleton a clip names
only in its bytes) is outside that rule, and the next one covers it.
A pass the editor runs while a map is open (an in-editor rawmap reload, Open
map in the editor, sh_mods map add) registers while the previous map's
level-1 objects are still alive, since the in-editor load runs no purge
(DoLoadMap, VK 0x1405253e0, calls neither the purge driver nor the purge). A
decl the pass keeps then binds to those objects: they are older than its
watermark, and no recorded need names them (an entityDef records its own
md6Def, not its attachments), so the Play purge freed them under the kept
decl (3 of 4 such Plays faulted, fresh opens 0 of 18; snaphak-re triage V3,
F8, F8b). The engine finds every existing resource through one find-only
lookup, ResourceLookup (VK 0x141571d50 / GL 0x141572ee0), which
ResourceMaterialize asks before it creates one; while a watermark is open
the product records, on the main thread, every resource that lookup returns
(a 19-byte detour, installed once the index holds a decl), and the outermost
watermark's close raises each one still listed at level 1 to 4 under the
resource lock (sh_modserve_lookups_*, from me_closure_begin and
me_editor_rows to me_closure_end). The set is deduplicated by address and
emptied at the close; a stock object already at 4 costs nothing. A log line
<phase>: N resource(s) the <part> looked up kept for the session with it
names what it raised. So a kept decl never holds an object that outlives it
by less, whether the pass created the object (the watermark), parsed it
earlier (the needs by name) or found it already loaded (the lookups).
What the engine loads on behalf of a kept object is kept with it, whenever
it loads (sh_modserve_attrib_*, sh_modserve_kept_*). The kept set holds,
by address, every resource a keep raised or a pass created at level 4. A
second detour, on ResourceGenericLoad (VK 0x1416c6050 / GL 0x1416c6d30,
20-byte head; ResourceMaterialize calls it at +0x249 for every resource it
creates), tracks the engine's load nesting on the main thread: each load
opened inside another, and each resource ResourceLookup returns inside a
load, is recorded as a (parent, child) pair, and a child of a kept parent is
kept at once (raised when its own load returns, since the load's failure
path reconstructs the object at level 1). A Play's spawns load objects no
kept decl held yet, nested (the chainsaw gore md6Def loads its mesh, whose
load creates its material; snaphak-re triage F9 census); when a later keep
lifts one of them, every close (me_keep_attrib: after each outermost
watermark, after the editor rows, and before the Play level load) follows
the recorded pairs from every kept resource, transitively. The close drops
kept addresses no list holds any longer, keeps only pairs a later keep can
still follow (a parent neither kept nor at level 4), and forgets all pairs
before the Play purge. Both sets are bounded at 2^20 entries; a full set
stops recording and the close says so. The first close logs whether the
hook recorded anything, so a build whose loads it never sees says what is
kept only by name.
Raising a level keeps a resource's object, not what its load allocated from
the current heap. The engine's allocator (VK 0x140328530) takes heap -1 as
the top of idMemLocal's heap stack (ids at +0x44, depth at +0xC4), else
process heap 0; an MD6 skeleton's joints (+0x40, VK 0x1416d0770,
TAG_MD6) come from it. The editor's reload after a Play exit loads the
gore md6Defs, meshes and skeletons with a map heap selected, and the next
Play load releases that heap: the skeleton the holds-by-name raise had
lifted to level 4 kept its object and lost its joints, and the chainsaw
pickup's attachment animator read them (G1, VK 0x16f7f0b; 2 of 2 before
this rule). So the load hook records the heap each load runs with, and no
keep (watermark, holds, lookups, attribution) raises a resource whose last
load ran with a heap other than 0: it stays at level 1, the purge frees it
whole and the next load recreates it. A load in heap 0 clears the mark. A
log line <phase>: N keep(s) left at level 1 because the map's heap holds what their load allocated names them.
A kept decl's render models are loaded by the product itself, in process heap
0, while their files serve (sh_modserve_held_models, me_hold_models, run at
the start of every me_keep_holds). An entityDef's parse does not load its
renderModelInfo.model; the entity's spawn does, at level 1 in the map's heap,
so no keep holds it and every Play purge frees it. The rows' decls stay
registered in every map, and the Play level load of a map that does not
declare the bundle loads all of its prop models again from them (all 17 of
local.rocks in an empty map); in Play an undeclared bundle serves nothing,
so each load ends as the engine's default box (state bit 2, bounds +-8), and
the editor after the Play exit makes the same defaults. The editor's own map
changes purge nothing, so a later open of a map that places the props drew
black cubes until its next Play (snaphak-re X2: fresh boot, empty map, Play,
exit, rocks map: 3 of 3 black; fresh rocks map: whole). So for each model
need of the holds closure whose providing file the index serves in the
current scope, the product loads it when the lists do not hold it
(ResourceMaterialize, VK 0x141572660 / GL 0x1415737f0, quiet, the find-or-load
the model manager's FindModel runs), and loads it again in place when the
lists hold a default, a failed load, or one a map heap owns; it then holds it
at level 4 inside its own keeper, so what the load creates (materials,
images) is kept with it. A load that still ends in a default stays at level 1
and is named. A stock model (no provider) is the game's bytes in every scope
and is left to the engine; nothing is loaded during Play. The log line is
<phase>: N model(s) kept decls hold loaded for the session while their bundles serve them.
Requirements. A bundle's requirements ({"cvars": {...}, "commands": {"activate": [...], "deactivate": [...]}}) are read only through the builder's
canonical form (sh_mb_requirements_canonical): sorted cvar names with string
values, true/false as 1/0, console lines trimmed and in the author's
order, "cvars" always present and "commands" only when not empty, so a
bundle carrying only the two blacklist gates keeps the text and hash it had
when they were the only accepted requirement. The product names no cvar or
command; the bounds (SH_MB_REQ_* in modbundle.h) are syntax only, and the
Community API's manifest check mirrors them. modserve.c takes the admitted
bundles in install order and drops the requirements of one that asks a cvar an
earlier one asks at another value (one MODS: requirements: conflict: line
names both). Before every registration pass, at the Play re-check and after a
rescan on the main thread outside Play, it applies them: the deactivate lines of
bundles whose requirements stopped, then each asked cvar set and read back
(idCVar::Set with force, after modserve_engine.c refuses a read-only or
command-line-only cvar from its flags; a set queued as console text is drained
first), each cvar no bundle asks any more restored to the value it displaced
unless someone else changed it, then the activate lines of bundles that start
now, appended with BufferCommandText and logged as MODS: requirements: <id>: command "<line>". A bundle whose cvars are not all live has its steps blocked
with the cause, and its files first served before then are treated as below.
The state lives across tables (a rescan replaces the index, not what was set);
Nothing is restored at DOOM's exit; a cvar the engine archives to its own
configuration may therefore keep a mod's value into the next session.
A bundle's requirements are accepted only while the map scope has its shadows
in (below) or, in a map, when the bundle adds Toybox rows; a pass after the
listing changes therefore runs the stopped bundles' deactivate lines and
restores their cvars as it does after an uninstall. sh_mods status and
sh_mods doctor print sh_modserve_requirements_report, one line per
requirement with that bundle's own state for the open map: live, not active
for this map (with the reason, and the mod that holds the same value when one
does, so another bundle's value never reads as live for this one), refused
(lost a conflict), NOT live with the engine's cause, restored (its
requirements ran and stopped; modserve.c keeps the stopped ids until they
start again), or not applied yet. Packages converted from the
retired formats keep only the two blacklist gates (below): their requirements
were never accepted by a player installing them.
On every parse the DeserializeFromJson detour sees, modlegacy.c runs first.
A complete carrier whose ZIP and package.json read is unpacked once into an
ordinary mod folder mods\<id>\ (older decls/, images/ and shaders/
layouts moved under assets/; the package's keys become the author block, the
legacy record and its grandfathered shadows seed the product block), built into
a bundle and named by a manifest row; a conversion an installed mod of the same
id already serves is dropped and that mod answers;
the serving table is then rebuilt when that bundle is not in it yet, so the same
parse can activate it. A first-generation package served every file under
assets/; a file a bundle cannot carry (a type outside the bundle whitelist,
such as the .materials.txt sidecars every beta.19 model pack shipped or a
.bswf movie outside generated/swf/, an empty file, a path the request rules refuse) is left out and
counted on the LEGACY: unpacked line instead of refusing the package, and a
cvar requirement other than the two supported blacklist gates is left out the
same way. A beta.16-19 carrier names its tree (smpkg.delivery.<tree>), so
before converting one the converter also looks for a mod folder whose
mod.json legacy record has that key (or the carrier's digest) and for a
bundle the overrides migration built from the same tree (the record's
migration section, trees); either answers the carrier without a second
copy. Any other carrier, and the unreleased smpbind. and
smpref. rows, are removed. Each carrier logs one LEGACY: verdict line. After
the navigation strip, modmanifest.c reads the manifest rows (the member's
mods, else the legacy smpmod1. rows, which it removes) before the engine
parses the map, and activates the bundles they name.
The editor palette is built once per process, and the map validator
(RepairAndMigrate) looks every placed entity up in it, so after activation
the same step checks the named bundles' editor rows against the built palette.
When at least one row is absent and was never registered (a package converted
mid-session, or a bundle installed after the build), it runs the heap-scoped
palette rebuild once (the same path as sh_mods palette rebuild: main thread,
verified process heap 0, pending rows registered first, the builder with a
NULL progress through the detour, product palette caches reset) before the
buffer returns to the engine, and logs one line:
MODS: map rows: M of R editor row(s) missing from the palette; K registered, A now in the palette; palette rebuilt in N ms (B -> C rows). It is refused,
with the reason on the same line, while the editor holds an entity or a wire;
before the first palette build it does nothing, because that build registers
every row. A map without manifest rows never reaches it. On
save it writes, into the member's mods part, one row per bundle that provides a placed name (a placed
entity's def, module or a model its edit state names; never a shadow of
editor-time content, see the asset rule) and each bundle their needs reach,
and one per map-level row of the current manifest;
with an empty table, no rows in the map and no map-level row
it returns at once and the save is the engine's own bytes. A map-level row is
written for the build that serves its mod (the bundle resolver modui.c binds,
sh_modserve_bundle_serving), and the current manifest follows the rename; a
row of a mod that is not installed is kept as it is.
Threads: the table is built on the bootstrap thread before the provider hook is
published and replaced only by a rescan (sh_mods install, a build inside the
store, a legacy conversion, the end of the overrides migration's worker,
sh_mods rescan). Readers see one complete table;
retired tables are never freed, because a provider open on another thread may
still read one. Registration, activation and the palette rebuild run on DOOM's
main thread only. With an empty mods\ folder the table is empty and every hook
above passes through: the differences from a build without mods are the
sh_mods command and its MODS: log lines.
Early decls: the provider hook is published after the backend's signature scan,
about seven seconds into the process, while DOOM's main thread is already
parsing its boot decls, so whether a given shadow was parsed from the game's
bytes or the bundle's depends on that race (the boss packs' aiFSMManager
states were served in 3 of 18 boots on 13954591, and 113 and 180 shadows of the
installed packs lost it in the two boots measured after the fix). Each registration pass therefore
re-parses, between publishing its sources and running its loads, every served
shadow decl the provider has never opened and the engine already holds parsed:
ResourceGenericLoad with the state bits cleared, inside process heap 0, which
reads the bundle's bytes through the provider. Running it after the sources are
published lets a shadow that names a new identity (an editor animWeb naming a
new md6Def) find it; running it before the loads gives a new decl that
inherits a shadow the bundle's values. A shadow the engine has not parsed yet is
left to the provider. Each file is settled once; a rescan keeps the mark while
the bytes are unchanged, also when the open landed in the table it replaced.
The pass logs MODS: reparsed <n> <type> decl(s) the engine parsed before the serving index (...) per type and one summary line.
Every in-place load the product runs (this re-parse, the refresh below, the
gated reload of models and images) keeps the resource's lifetime at +0x28.
ResourceGenericLoad's failure path reconstructs the object in place and
idResource's constructor writes level 1 or 2 (VK 0x1416c5580), so a permanent
decl that failed a re-parse would be destroyed by the next map unload while
everything permanent that points at it keeps the pointer; the main menu's
collectibles hold stock md6Defs (unlockModel decls name the boss and demon
md6Defs that Doomforge packs shadow) and read them on every shell-map load. A
re-parse that fails (state bit 0, or an engine error naming the file) is
withdrawn and the decl is parsed once more from the game's bytes, and an
animWeb shadow whose models the engine cannot find is withdrawn before its
re-parse, since the re-parse would free the stock web's nodes and rebuild
nothing.
What an in-place reload or re-parse of a held resource creates must live as
long as that resource. Reloading a held model resolves its materials again, and
a held material re-parsed binds to the images that exist at that moment; an
image created at map level is freed by the next purge while the permanent
material keeps the pointer, and the first draw reads freed memory. That was the
cold My Maps launch crash on both renderers (snaphak-re ADD-G6): the map load's
scope change reloaded the boot-held spider and Olivia meshes outside any
watermark, while the editor-first flow ran the same reload inside the editor
pass's watermark. The gated reload and every refresh part therefore run inside
a keeper of their own (a resource watermark raised to the session's level when
it ends, me_closure_begin and me_closure_end) whenever no other watermark
covers them and they have work (sh_modserve_inplace_keeper).
A surface (a stock pointer at the game's own path: the game's bytes under the
game's name, sh_mb_stock_restore) is never registered, re-parsed or
refreshed by any pass. The provider serves it whenever the game parses or loads
it, at the game's own time and level, so it is in no plan (editor, map, scope
activation, refresh), no refresh list, no early-shadow list, no editor-row
reference and no ledger sweep (sh_modserve_is_surface). The one exception is
the gated reload below: a surface model or image the game loaded before its
bundle's requirements were live is loaded again, inside that reload's keeper,
once they are. A cold process holds the stock spider mesh from boot, loaded
with the blacklists on, and the requirements go live only at the first map
load; without that reload the mesh's blacklisted materials are never created
and the spider body is not drawn (snaphak-re ADD-V7a). The keeper raises the
materials and images the reload creates to the session's level, as the editor
pass's watermark does in the editor-first flow. The
engine's own source lookup could not stand in for this: DeclSourceFind misses
decls archived in the game's containers, so a stock-path material a pack
carries as a surface was registered, and so re-parsed in place, by every map
pass whose engine did not already hold it at level 4.
A plan orders its steps by need, then by rank: renderParms first, then other
decls, md6Defs, entityDefs and snapEditorEntityDefs (SH_MODSERVE_RANK_*).
The engine gives a renderParm its parm-state slot and kind at its first parse
and keeps them on a reparse, and a material's parm keys are bare names that no
need records, so a material parsed before the renderParm it assigns bound a
slot the renderParm's own parse then retyped. On a cold My Maps launch of a
map with the campaign doors pack, skull_key was parsed before skinsssmap,
and a render job later read two floats as a sampler pointer, on both
renderers (snaphak-re ADD-G5). Every renderParm therefore registers and loads
before any other step: in the map plan, in the part of a split plan that runs
first, and in the editor part of a refresh, which runs before the rest. A
renderParm a pack carries as a surface (skinsssmap in the doors pack) is in
no plan at all: the game parses it from its own bytes when a material first
names it.
Registering a file is itself a parse. DeclRegisterFile's loader looks up every
decl the file defines, and an existing resource of that name is re-parsed on
the spot (VK FUN_141559a30 -> FUN_141561af0 -> DeclParseSource), whatever its
level. A decl pointer it reads is set by DeclFind with create, at the level of
the pass. The registration source check misses archived stock decls, so a
bundle's stock-named file reaches registration, and a map pass used to re-parse
permanent decls that way. The unlockModel spidermastermind (level 4, its
model null after boot) was bound to a spider_mastermind.md6 the pass created
at level 1. START MISSION's purge freed that object, and leaving Play faulted in
SetupModelList (VK RVA 0x33a130). The registration phase therefore asks the
engine first (held, a walk of the type's resource list that creates nothing)
and does not register a permanent decl in a pass that does not keep its decls,
by the same rule the load phase uses (sh_modserve_load_left_to_engine):
MODS: map: <type> '<name>' (<bundle>) left to the game: permanent, ...; not registered by this pass, whose registration would re-parse it in place.
Nothing is remembered, so a later pass decides again. Permanent shadows whose
bundle bytes differ from the game's still reach the engine through the
re-parse above and the refresh.
The same race decides what a bundle's requirements mean for a resource: its
cvars (the cut-content blacklist gates, for one) are applied only at the first
registration pass, and anything the engine loaded before that resolved its
names with the blacklists on. A model loaded then keeps no materials and draws nothing: this
is why the Spider Mastermind body (stock-named mesh, loaded at boot, its
materials and images on the blacklists) was invisible on 13954591 while its AI
ran, and why the same bytes under a new mesh name drew. The provider therefore
records whether a file was first served while its bundle's cvar requirements
were not live; a decl first served then is re-parsed by the pass above, and each
baseModel and image first served then is loaded again in place, found by
name in the engine's idMD6Model and idImage resource lists, once the gates
are live: MODS: editor: reloaded <n> model(s) and <m> image(s) loaded before their bundles' requirements were live.
Refresh: a rescan (the Mods tab's refresh, sh_mods rescan, a console build
or install) publishes a new table while the engine keeps every decl it parsed
and every model and image it loaded from the old one. Each table therefore
compares itself with the table it replaces, per served request path: a path
whose bytes differ is changed, one only the new table serves is new, one only
the old table served is gone. Changed decls, models and images and gone
shadow decls are marked pending, and the marks carry over to later tables
while the bytes stay the same. Before applying, the served decls whose
top-level inherit names a pending decl are marked too, transitively, since
the engine resolves a parent when the child is parsed (measured: re-parsing
only the Hell Guard's base entityDef left the spawned child at its old
health). Applying uses the two primitives above: each marked decl the engine
holds parsed is re-parsed (state bits cleared, ResourceGenericLoad inside
process heap 0), parents before children, a gone shadow so that the engine
reads its own bytes again; each marked model and image it holds loaded is
reloaded in place by name, only once its bundle's gates are live. A changed
anim (cooked/anim/<stem>.bmd6anim, refresh kind SH_MODSERVE_RF_ANIM) is
reloaded at a map pass only (modserve_activate_bundles): there the engine's
purge has run (every SnapMap map load purges levels 1 and 2, report ADD-G1),
the departed map's entities are gone and the next map's are not spawned yet;
marked anywhere else it waits for the next map load. Only an anim held at
level 4 is reloaded (a level-1 anim is freed at every transition and read
again from the current bytes); its served bytes are checked first against what
the engine's Load accepts (magic and version 0x2602414d read big-endian, the
skeleton name's length), because a failed Load frees the data the held anim
points at, and one that fails the check is kept as it is and logged
(MODS: reload: anim '<name>' kept as the engine holds it: ...). After the
reloads the md6Def and animWeb decls the open map serves that name a reloaded
anim are re-parsed, so what they built from the old data is rebuilt (which
engine objects cache an anim's data pointer is not established). Raw names
match the list entries case-insensitively with the id's - and _ as one. A
skeleton has no in-place route (it heads an ordered closure of models, anims
and decls that is unsafe while any animator lives); sh_mods held counts the
mod skeletons held at level 4, and a changed skeleton stays a restart. A decl the
engine has not parsed, or a resource it has not loaded, is settled, since its
next load reads the current bytes, and a settled decl is no early decl. The
rescan applies the marks at once on the main thread, except during SnapMap
Play (the editor inactive with deactivate reason 3): then they wait, and a
watcher thread hands them to the main-thread call slot, which drains in
editor frames, at the return to the editor; every registration pass also
applies them between publishing its sources and running its loads. Editor
content follows in the same step: new gameplay decls of a mod a registration
pass already registered this session are registered at once (the map's
activation plan for just those files), and when editor rows were added,
changed or removed the live palette is rebuilt through the
sh_mods palette rebuild path, whose editor pass registers new rows first. A
removed row is re-parsed without a source, resolves no entityDef and is left
out by the rebuild; the strids layer re-reads bundle strings on every
published table, so a new row shows its #str_ name. Without a palette yet,
the first editor entry builds it with every row; a refused rebuild (an entity
or wire held) is retried by sh_mods palette rebuild. The engine sorts the
palette's rows in place (SnapPaletteSort) from four places, and the Play
build does it twice: once inside its own process-heap scope (the validator)
and once after that scope is popped, in the map heap (the Play map's
structure). A sort swaps rows through a temporary and gives a row string a
new buffer, in the current heap, when the value moving into the slot is
longer than its old one; a row grown by the second sort kept a map-heap
string, the return to the editor freed it, and the next Play's first sort
read it (the review's A-D3 fault at DOOM+0x339c40, a row's clipModelName).
The Timeline tile's sort detour (tl_palette_sort) runs every sort inside
a verified process-heap scope; sh_mods palette check reports where each
row's strings live and how many sorts ran. What stays reported
rather than applied: new names of a mod no map has used this session (they
register when a map that names the mod loads), a changed movie (read at the
next map load), a changed anim (reloaded in place at the next map load), and
changed files nothing reloads in this process (a sound bank whose bytes
changed under a name Wwise already loaded, skeletons and other raw files
besides models, images and anims) or removed non-row decl names, which need a
restart; a stock decl no bundle serves that
inherits a changed one cannot be found from the index. The log carries one MODS: refresh: line
per category and a summary; the Mods tab's rescan result carries
refresh: {reparsed, reloaded, needsMapReload, needsRestart, pending, deferred, note}, and sh_mods rescan (or sh_mods refresh) echoes the same
lines to the console; sh_mods status says when changes are pending.
Served-bytes ledger (modledger.c): the engine records no byte identity for
raw resources and, after a production read, none for decls but entityDef
(report ADD-G3), so the product keeps its own. Every serve through
sh_modserve_open (the provider's +0x148 open, which the raw loaders and
the decl read path both reach) calls the serve listener, which records per
request path the serving bundle's hash and the file's identity: the first 64
bits of its recorded SHA-256, or an FNV-1a 64 of the bytes for a composed text
or a file without one. A product read of served bytes (the anim check, the
dependents search) is not recorded. Records live in a fixed open-address table
of 16,384 paths (32,768 slots), published once and updated under a per-record
sequence count, so readers take no lock; a serve past the bound is counted and
the ledger then calls itself incomplete. It is bound in sh_modserve_install
and is complete only when the provider served nothing before that. At a
refresh, a pending model, image or anim is reloaded only when the ledger says
the bytes the engine was given differ from what the open map serves now
(sh_modledger_decide: KEEP when equal, REFRESH when different, GAME when a
complete ledger has no record: the engine's object never had a mod's bytes and
is not refreshed); shadows and withdrawn paths, and decls (a child is marked
for its parent's change, not its own), keep the marks alone. At each map pass
the ledger is also swept: a held name the provider served whose bytes differ
from what the declared builds serve, which the marks left, is refreshed by its
type's route (MODS: map: ledger: ...), and a held skeleton or other raw type
is reported as a restart. sh_mods held [filter] prints the ledger (request,
bundle, file identity, serves, whether and at which level the engine holds the
name) and the census of level-4 names the product served, by type, ending with
the count of mod skeletons held at level 4.
Two layers (DESIGN-additive 2.3): while a map is open or played, the bundles
it declares serve, then the game. The listing is the declared bundles' hashes
in row order in modserve.c, set by sh_modserve_scope_set from manifest
rows and the placed closure (hashes resolve through aliases; a key alone
declares nothing), with whether a map is open, and a mode,
sh_modserve_scope_mode: SH_MODSERVE_MODE_PLAY from the Play entry
(sh_modserve_scope_source with SH_MODSERVE_AT_PLAY) until the editor's
tick sets SH_MODSERVE_MODE_EDITOR again (modui.c), and EDITOR with no map.
The first hash of a key in row order declares that key; every other build of
it is inert for the map. Each admitted bundle gets serve flags computed from
the listing and read lock-free (sv: names under its key, shadows, surfaces):
- declared: everything it carries;
- another build of a declared key: nothing;
- an editor-time bundle (its shadows include a
generated/decls/snapeditor*,snappropertyinspector*orsnappalette*decl, or the editor's own movies undergenerated/swf/snapmaps/): its editor tweaks, in every map this editor opens; the rest of it follows the other rules. That ismy-overrides' editor tweaks and the Toybox rows of converted first-generation packages (hell guard, spider mastermind, rocks, Olivia): their other files serve only where a map's row declares them, as every mod's do (owner 2026-11-09: the grandfathered serving rule is gone, and nothing a player reads says legacy; a package converts at install or map load throughmodlegacy.candmodmigrate.c, a folder built under earlier builder rules rebuilds at boot, and a map with string-variable rows migrates at its next save); - otherwise, in the editor and with no map open: the names under its key, for the one build of the key that serves with no map (the player's own folder, else the newest; the Toybox offers its rows; placing one declares it at the next save), and its surfaces; never its shadows. In Play: nothing.
Requirements: a declared bundle's apply; an undeclared newest build that adds
Toybox rows keeps them outside Play, because the palette registers its rows
in every editor map and with none open; in Play (the editor's, or a hub
launch) no undeclared bundle's are accepted, so their cvars are the game's
from the Play entry and applied again when the editor shows a map; any other
undeclared bundle's are not accepted (req_off). A registration step is
gated by the requirements of the build that serves its path for the listing
(sh_modserve_plan_block_unmet through ms_scoped), not by the path's static
winner's: with two builds of one key installed the winner of a path both carry
can be the build the open map, or the Toybox, does not use, whose requirements
are off, and gating on it blocked every row of the key.
A mod.json "scope" key no longer chooses (logged once). Per path,
ms_resolve records every provider of a path several bundles carry on its
static winner (alt_first: the static rules' order for different bytes, the
player's own build, then the newest, first for one key, index order for
identical bytes), and
ms_scope_compute chooses the file that serves it for the listing
(scope_alt, read by ms_scoped on every lookup): among the declared (and
editor-time) providers by the conflict rules above, composed when their texts
compose, else the first provider an undeclared bundle may serve, else none.
A path with no file misses sh_modserve_lookup, sh_modserve_open and the
decl probe, so the provider falls through to the engine; the early-decl and
gated-reload visits skip it; reports read the static index through
sh_modserve_lookup_indexed. The editor plan registers the rows whose path
the listing serves (sh_modserve_plan_editor), and the save-time closure and
the map listing map a placed name to the build the open map serves
(modserve_bundles_for_names_visit), so a save keeps each row's pin.
When the listing or the mode changes, every shadow decl, model and image whose serving
bytes changed (withdrawn, admitted, or moved to a provider with other bytes;
moving between identical copies marks nothing) is marked pending at generation
0, and so is every name another build of its key now serves with other bytes
than the ones last served (scope_last); the inheritance closure is marked
again, and sh_modserve_each_refresh offers them
with gone set while a shadow is withdrawn (no gate needed for the game's
bytes). A withdrawn name is never offered: it has no game bytes to go back to,
so the engine keeps what it parsed until a map serves it again. The
engine side is the refresh of a rescan: sh_modserve_scope_apply runs the
requirements pass first, then me_refresh_apply (re-parse in process heap 0,
reload in place by name) and the gated reloads. The listing is set and applied
at:
- a map load:
modmanifest.ccalls the scope hook (modui.c) with the rows just read and, whensh_modserve_scope_relevant, the map's placed names, before the bundles are activated, and applies at once. The load's activation then runs for the rows and every build the listing declares beyond them (sh_modmanifest_set_listed, bound tosh_modserve_scope_hashes): the placed names' closure. A map that places a mod without a row (a rawmap opened as a new map) therefore registers that mod's decls, materials, models and registries as its saved copy's load would (map: N bundle(s) its entities place without a row were activated with its rows); - a save: the hook gets the rows written (placed closure and map-level rows); the change is applied on the next editor tick;
- the Play entry: Play does not serialize the map, so
sh_modserve_play_beginasks the scope source (modui.c) to read the current manifest and the live placed names, then applies before the requirements check and the level load; only the editor's Play reads them: a hub launch keeps the listing its launch gate set, since the editor's entities are not the launched map's; - the map exit: the main-thread tick (
sh_modui_poll_main, polled while scope can matter) clears the listing once the editor that showed the map loaded last has its screen down, neither Play nor a load runs (load_statereads 3 for any loaded map, so the loading-screen thread's running byte,load_screen+0x4b2, marks a load in progress, the hub's shell map included), and the engine'smap_left(iface_engine.c) says the editor has left the map: no map object, or the editor state at+0x23618is 0 (no state runs: the hub or the browser) or 8 (exiting) with the deactivate reason at+0x2366Cnot equal to 4. The Settings screen opened from the Start menu also takes the editor screen down and also reads state 8, but with reason 4 (shutdown reads 1), so the listing stays. The current manifest goes with it (sh_modmanifest_current_close), so nothing later reads the editor map's rows as another map's. The tick sets the listing again from the open map when an editor map is open without one; - the Mods tab's and the console's map add and Remove from map, at once.
With no map (at boot, and at the hub after the editor) no undeclared shadow
serves. A published or My Maps launch from the hub declares exactly the
launched map's rows and runs in PLAY mode: the launch boundary
(PublishedMapLobbyLaunch, PublishedMapOfflineLaunch,
LaunchLocalSnapMapForOfflinePlay, and the resume of a held one) calls
sh_modui_scope_launch, which lists the current manifest's rows (the launched
map's parse made them current; the editor's exit cleared the editor map's),
sets SH_MODSERVE_MODE_PLAY and applies it before the original launches, so
an undeclared bundle serves nothing in the map. Before it lists anything, once
per launch (not again from launched or loading), it runs the pre-load pass
(sh_modserve_launch_preload): at the hub, in the editor mode and process heap
0, the editor rows and their closure are registered as an editor entry
registers them, then any step of the declared builds the parse's map pass did
not settle (sh_modserve_plan_unvisited). The palette pass the level load runs
then registers nothing new; in a cold process it used to register every mod's
rows there (161 rows, 645 steps with the campaign packs installed). The listing holds until that
Play has run and ended, by a state machine in modui.c driven by the signals
the product has: launched (the gate's sh_modui_scope_launch), loading
(the tick's busy callback reported a load or Play), playing (the Play-begin
gate, sh_modserve_play_begin from the SnapBuild detour, asked the scope
source), running (busy again after that) and ended (the first idle tick
after running). Only ended clears the listing and the current rows and
returns to EDITOR mode (scope: the launched map's Play is over); an idle
tick in any earlier state does nothing, since the gate runs at the launch's
map parse and the level load starts frames later (ADD-V4a H2: a tick in that
gap withdrew a boss's rows and its decl parsed empty). The editor's return
ends the launch without that clear. A launch the gate refuses (denied,
dropped from its hold, or refused at once) calls sh_modui_scope_launch_refused
through the ops' launch_refused: nothing was launched, so the current
manifest is closed and nothing is declared, or, with the editor still showing
a map, the state the launched map's parse replaced comes back
(sh_modmanifest_current_restore_previous). The editor's tick also sets
EDITOR when the editor next shows a map,
and an editor palette pass does it first (a pass in PLAY would not register
undeclared rows). A
mod.json author key "scope" stays in the manifest's extra, so a mod with
it keeps its canonical text and hash; it is ignored.
sh_modserve_index_boot enables scope for the product's index; the native
tests enable it where they test it (sh_modserve_scope_enable).
sh_mods status, sh_mods doctor and sh_mods map print
sh_modserve_scope_report: one header per key installed as several bundles
("scope: key : N bundles installed; ..."), one line per bundle (key, version, hash, its names, shadows and surfaces, and
what it serves for the open map), then per path several bundles provide with
different bytes which layer serves it and why (serving: <request>: <key>@<version> (<hash16>), declared (row N): <why>; not served: ... or
the game (no declared bundle provides it)), and the counts per layer. The
walks of the engine's resource lists (watermarks, sh_modserve_resource_each,
op_held, the ledger's census and sweep) hold the engine's resource lock: the
static struct whose first qword is the CRITICAL_SECTION every list add, remove
and find takes (generated globals entry resource_lock, Vulkan RVA 0x5D79238,
OpenGL 0x467E8B8, decoded from the end of ResourceStaticPromote into the lock's
accessor; globals_test checks it sits 0x3D8 past decl_resource_head on both
renderers), bound in sh_modserve_install through
sh_modserve_set_resource_lock (ADD-G3). The accessor builds the section on
first use, so a NULL pointer means no list was touched yet. Callbacks and
loads run after it is released. The map load's MODS: map manifest names ... line
ends with the registration steps the activation found ready, or "no new decls
to register" for bundles of shadows and requirements only.
A mod that edits a game file carries the edited copy at the game's own name;
mod.json says nothing about it (DESIGN-additive 2.4). The builder records the
copy's structural diff against the game's text, the product generates the game
file per map from the game's text and every declared mod's diff, and the copy
itself is never served (decl_tree.c is the model, modbundle.c derives,
modregistry.c applies, modserve.c serves, modregistry_choices.c holds the
map's choices).
- The model.
decl_tree.cparses the decl grammar into a tree:key = valuefields (a value may be several words, strings or( ... )groups on one line),key {andkey = {blocks, named blocks (anim "<clip>" {,painGroup "head" = ...), the md6Def spelling without=(a statement ends at its line), bare members (LeftFooton its own line) and anonymous blocks (a table's{ { 0, 1 } }). Comments are dropped; every other token,=and;is kept, so a generated text lexes to the same tokens the engine would read from the same tree. Of the 45,419 stock decl texts both archives hold, 45,243 parse and every one round-trips token for token; the rest are 158 render programs (shader code) and 18 malformed game files, which a mod that edits one is refused. - Kinds of member. A key appearing at most once on both sides is a field
(set or removed; blocks on both sides compared member by member). A block of
num = N;anditem[0]..item[n-1]in order is an ordered list: its items are entries matched by their text (a conductoraiTypeListitem is itsaiTypeandentityDefpair), written back renumbered withnumkept at N plus the items added (syncGroups { num = 3; }keeps its 3); sparseitem[i]blocks (damageGroups) are fields. A block with a name (anim "<clip>") unique on each side is a named entry. Repeated blocks that each carry a name field (anamemember, or one underobjectorobject/object: thesubGraphandnodeentries ofaifsmmanagerstates) are keyed entries, matched by that name without case and replaced whole. Any other repeated statement, and what a mod puts in a block the game leaves empty (the body'saliases { }), is a bag entry matched by its whole text. - Derived at build. For each carried decl at a game name whose bytes differ,
mb_derive_editsreads the game's text through the installed-content reader and recordssh_dt_diffin the product block's"edits": one element per file,{"file", "stock" (a digest of the text diffed against), "counts", "ops"}, an op beingset/remove(path to the field, the statement),list/unlist(the list's path, the item),keyed/unkey(the container, the key word, the name, the statement) orbag/unbag(the container, the statement); a path is the member keys from the decl's top (edit,item[4],anim "clip"). The copy stays in the bundle (hashed, uploaded, its needs scanned) and inshadows; it is classified a replacement but marked edited (sh_mb_file.edited, counted inclasses.edits, never inclasses.replaces, the Mods tab's replaced stock files or a doctor conflict). Refused: a copy or a game text outside the grammar ("does not parse as a decl (line N: ...); the product derives the edits from the whole edited copy"); a game text the reader cannot supply; a binary at a game name with other bytes (": the game ships this file and a mod cannot replace it with other bytes; delete your copy and the mod borrows the game's, or put your version under mods// and point your decls at it"; a binary at a name the game does not ship keeps "the game has no file of that name for it to replace"), except in a folder the product received (origindownload,delivery,migration, or a thread that calledsh_mb_keep_replacements_here(1), where it stays a replacement, as does a decl whose game text cannot be read there). A grandfathered bundle keeps its shadows and derives nothing. The retired author keysplayer,extendsandreplacesare ignored with one line each and kept out ofextra; a partial they name (anextendsvalue,player.bodyEvents) is refused: "this is a partial; put the whole edited copy of at its game name". - Applied per map. The index carries one synthetic file per game file an
admitted bundle's edits name. For the listing, the sources are the bundles
that serve and edit a game file (or carry one: a grandfathered package's own
served copy at that name is diffed on the fly and is that package's edits),
in row order, then editor-time bundles by key.
sh_dt_applytakes the game's text and applies every source's operations in that order: an identical operation merges, additions union, a named entry two sources add becomes one block holding both texts' rows (identical rows once, a scalar both set otherwise keeps the earlier), and a field or keyed entry two sources set to different values is a clash. Each source's line closes its sum:N edit(s) from X: A applied, M already held, C superseded by <key>'s choice(orby <key> (row order)) for the operations that lost a clash. - The conductor. The one rule per file: each
aiTypeListitem a source added whoseaiTypeis a number that is not a stockSPAWN_AI_TYPE_*bit gets a bit assigned per map, the lowest free aboveSPAWN_AI_TYPE_ZOMBIE_UNWILLING(1 << 19up to1 << 29, eleven per map), in row order then by the name of the encounter decl whosememberTypenames the author's number, so two packs never claim one bit; everysnapAiEncountermemberTypeandsnapAiScoreaiTypeof that bundle naming the author's number is served rewritten to the assigned bit (the same synthetic body mechanism, on the bundle's own file). - Clashes. A slot is
<type>/<decl name>/<path>(entitydef/player/coop/edit/handsModelMPUseDoomHands; a keyed entry adds its name, a named block segment isword:name). Two sources setting one slot to different values: the map's choice ("choices"in the manifest rows,sh_modregistry_choices_set,sh_mods choose "<game file>/<path>" "<key>"), else the first in row order, with one line naming the slot and the command; the Mods tab lists them from the declared rows' edits (sh_dt_edits_slots), a row resolved as serving resolves it: its own build, else the build the editor load substituted, else the installed build of its key (mu_row_serving_entry), so a map pinning a build that is not installed still offers the choice. - Serving. The synthetic files belong to a pseudo-bundle
(
snapmap-plus.registries, one past the bundle count, never admitted, so no bundle walk sees it), never served by name or need; an edited copy (ms_file.edit) gets no key, so nothing looks it up, plans, refreshes or probes it. Generated texts are memoized per serving set and choices in the index arena and read throughscope_bodylike a composed text. With nothing generated the game's file answers; the game's texts are read once per index; with map scope off nothing is generated.sh_modserve_registry_reportprints one line per generated file, what each source's edits did, every clash, the merged body's totals (player body: the merged body holds <clips> clips and <aliases> aliases), and oneregistry edits <path>line per edited copy. The doctor lists the same copies asedit source <path>: from <folders>; diffed at build against the game's text, generated per map that declares it, the copy is never served, never as a conflict or a shadow, and its summary counts them apart:N conflict(s), N shadow(s), N grandfathered shadow(s), N edit source(s) of N game file(s), so its conflict count agrees with the serving index's. - Choices. A choice applies at once and is kept with the open map's
manifest; the map's next save writes it on the row of the key it names; a
load reads them from every row (first row per slot) and gives them to the
index (
sh_modserve_scope_set_choices) before the listing; a choice naming a key the save writes no row for is dropped with one line, and closing the map (sh_modmanifest_reset) clears the index's copy too. A choice, likemap addand amap removethat drops only the row, marks the editor's map modified through the editor's own commit (sh_editor_mark_modified, one undo step, as a placed entity does), so leaving the editor asks to save; the wording stays "applies now; saved with the map's next save". - Rescans, gates and old builds. A rescan that changes a generated text
for the listing (a mod rebuilt with other edits) marks the path that serves
it for refresh, as a changed decl is marked. A generated text is gated by the
requirement gates of the first source with requirements whose edits changed
it (bare-hands' cvar gates its player entity text), as a bundle's own file
is. A bundle built before derived edits keeps serving until it is rebuilt:
its partials (the product block's
registries.extendsvalues andplayer.bodyEvents) are never registered, planned, refreshed, probed or served to the engine, and its retired intent is not read.
Releases up to v0.2.1-beta.19 kept packages in overrides\. The store tool's
migrate, after the store upgrade and the bin sweep, runs modmigrate.c's
pass once when overrides\ exists and the record's migration section does
not (or records an unfinished pass), with the --doom folder as the stock
bridge's install (sh_modstock_set_install):
- each direct child folder with
package.jsonormod.jsonis converted the way a carrier is (layout moved underassets/, files a bundle cannot carry left out) into a staging folder outside the store and installed bymodstore.casmods\<folder>\(its own name; with the tree's first 8 hex when another mod holds that name),mod.jsonand real files. The package's keys are the author block: its id (or, for an era B pack without one, its folder name), version (else0.0.0), requirements, strings and hud, and its other keys (composes, an era Bschema) kept; the product block'slegacyrecord (source,folder,tree) grandfathers its names as shadows. Two folders with one id are both built, each in its own folder, and the duplicate is reported; - each delivered package,
overrides\map-<16 hex>\<package>\, becomes a mod foldermods\<id>\keyeddelivery.<tree>, the beta.19 tree fingerprint (entries sorted case-insensitively, then by bytes; adorfbyte, the NUL-terminated relative path and the file's SHA-256), which is the key a map's carrier of the same delivery has; a later load of that map reuses it; - a folder without a descriptor whose only package is one direct child folder (beta.19 read unmarked folders as groups) has that child migrated under the child's own id, and its line says so; a folder without a descriptor and with several such children and a ZIP are skipped with the reason (every other file, and a folder with no descriptor and no package child, is the loose layer below); a folder over 512 MiB or 8192 files is skipped before it is read, and one whose carried part is over the bundle caps (4096 files, 256 MiB) is refused before it is hashed;
- a file byte-identical to installed game content becomes a stock pointer (see
above): the store never receives it and an upload never sends it. Each
folder's line says
N file(s), P of them stock pointer(s) to installed content, K KiB not stored, the summary line totals them, and the record carriesstockPointersandstockBytes. Measured on the owner's packs: 453 of 472 files of the cyberdemon pack (9.1 of 9.7 MB), 306 of 388 of the doors pack (8.1 of 8.3 MB), and 6 of the Imp's 11 (renamed copies, 1.8 MB); - the pass itself creates and changes nothing under
overrides\; an emptyoverride-backups\folder is removed and a non-empty one is left alone.
The loose step (sh_modmigrate_loose_run, after the pass) moves what SnapHak
and the first releases served without a package, with the strings document,
into one mod, mods\my-overrides\. The loose layer is every file directly in
overrides\ that is not a ZIP and every folder with no descriptor and no
package folder one level down (overrides\generated\..., a tree of engine
paths); strings\strids.json is the flat "id": "text" object strids.c read
before (UTF-8, with or without a BOM). The loose files are converted as a
package is: placed under assets\ at their paths below overrides\, files a
mod cannot carry left out and counted, copies of installed content made stock
pointers, with a descriptor of id my-overrides, name My overrides and the
document's keys as strings.en, and installed by modstore.c as
mods\my-overrides\ with the migration's origin and legacy record (the Mods tab
says "Moved from the old overrides folder"). With the document alone the folder
is mod.json (the same author block, origin migration) and an empty
assets\. When mods\my-overrides\ already exists only what it lacks is added
(files compared by path, keys case-insensitively) and one MODS: migration: kept my-overrides' <path or key> line names each it has with other bytes or
text; an identical one is counted, not named. The changed tree is built again at
the next start or rescan by the rebuild rule, and its strings serve from that
build. A file merged into a folder the player made is built under that folder's
rules: a binary at a game name with other bytes than the game's is refused
there, and the last good build keeps serving. A document that is not a strings
document is left with one line naming why. The record's loose section
(complete, migratedAt, folder) marks the step done; a loose entry or a
document created or written after migratedAt is due again. The step holds the
store lock throughout.
Then sh_modmigrate_retire moves overrides\ to the Recycle Bin once every
entry of it is in mods\ (a package entry the record marks done, a loose entry
the loose step moved), and strings\ once it holds no document left to move,
both through sh_ms_retire_sibling, which acts only when a discard is set: the
store tool's Recycle Bin. An entry still skipped (a ZIP, an over-cap folder)
keeps overrides\, and one line names the first. In the game, sh_mods migrate
runs neither the loose step nor the retirement.
The tool runs the pass on its own thread, folder by folder. In the game,
sh_mods migrate [--again] (and the Mods tab's Migrate) runs it on a worker
thread that writes the record and rebuilds the serving table when it is done
(editor rows it adds after the first palette build need
sh_mods palette rebuild). The record lists every folder with its kind,
outcome, reason, id, version, store folder, bundle hash and tree, and a trees
map from tree to store folder; it says "complete": false until the pass
ends, and an unfinished record makes the next run do the pass again (every
step is idempotent). Each folder logs one MODS: migration: line and the pass
one summary line; a line that leaves files out names how many and how many of
them are .bswf movies (bundles carry movies under generated/swf/ only, served
by modswf.c; a pack migrated before that was left out can be migrated again
with sh_mods migrate --again). A migrated pack keeps its id, so where it
shares one with a delivered or converted package (the beta.19 doors packs),
the two are builds of one key: each map serves the build it pins, and with no
map open the migrated pack (the player's own) serves. Stock names are not checked during the migration because the
pass runs without the game's resource reader, so unresolved needs only warn, as
for a converted carrier.
Every writer of the store serialises on one recursive lock, modstore_lock
(modstore.c; modsync_store_lock is the same lock under its older name).
Each install and verification takes it; each migration folder, a download
install, sh_mods install, sh_mods migrate and an export hold it around their
whole step. A second writer waits for the first instead of failing, and logs
one MODS: store: waiting line; because the migration takes the lock per
folder, an install on the main thread (the Mods tab or sh_mods install) waits
for at most one folder, not for the whole pass.
The tab's map object and its two destructive flows (Remove from map, Uninstall) work on the map open in the editor, read when the document is built:
- Entities, wires and references come from the map serialized as a save would
write it (
sh_rawmap_serialize_live_copy, a snapshot with no save side effects), parsed bymodmap.c. An entity uses a mod when one of its placed names (its inherit and every string under aneditobject, the save-time closure's rule) is a name the mod provides (modserve_bundles_for_names_visit); a module instance uses one through itsmoduleName. A manifest row whose mod is not installed is matched through the names the row recorded. The editor's entity ids are the JSONuniqueIds. - A reference to those entities is a wire (
targets.connections, a run-length list) with exactly one end on them, or a Timeline (idTarget_Timeline) whoseentityEntRefsrow names one. The same edge model is what the module-prefab save walks when it cuts a selection. - A map-level mod is a row of the current manifest marked
attached(sh_modmanifest_current_attach, the tab'smapAddModandsh_mods map add): the map uses it without placing anything, so it is listed with no entities and Remove from map deletes nothing and drops the row. - The map's details: its saved-map id and cloud-saved id from the editor's
copy of the saved-map model (edit+0x7F8, +0x9B0), the search tag from that
copy's tag list (edit+0x998, the list the next local save writes), the name
and last save from the slot's
game.detailsunderSaved Games\id Software\DOOM\base\savegame.user\<profile>\SNAPMAPS<id>\, and the published and uploaded state from the record'slinksandclaims. What none of these say is left out of the document, never guessed.
Remove from map deletes the mod's entities through sh_editor_delete_batch,
DOOM's own Delete Selection, in one batch: one native undo step that Ctrl+Z
reverts, before or after a Play round, from the tab or from sh_mods map remove. The native delete drops the wires to the entities with them (a save
right after shows no connection to a deleted entity), so the product severs
nothing itself; an entity the editor would ask about (its referenced-entity
confirmation) is refused, with the whole request, before anything changes.
How the native delete treats a Timeline's entity reference was not exercised
live: the dry run lists it, and the next save is the engine's own. Then the mod's row leaves the
current manifest record (sh_modmanifest_current_remove); the next save
rebuilds the rows from the placed entities and writes none for it. With the
last mod, the search tag mods is removed from the editor's tag list
(sh_modpublish_edit_tag, the engine's own idStr assignment, run on the process
heap because the console command's own heap does not survive Play); the published
copy is unchanged until the map is published again. A mod placed as
Blueprint modules, or reached only through another mod's needs, is refused
with the cause.
Uninstall, in order: the dry run and confirmation (as Remove from map's,
headed "Undo history is cleared. The folder can be restored from the Recycle
Bin by hand." with a map open and "The folder can be restored from the Recycle
Bin by hand." without, plus the Toybox rows, "Moves the folder mods<folder> to
the Windows Recycle Bin.", how many local saves in My Maps carry a row of the
mod, "N of your saved maps use it; they will not open until a mod folder
provides its assets again"). The list is computed per key: when another build
of the key stays installed (install.keptBuild), only the Toybox rows no
staying build adds are listed, and the saved-maps line becomes "Another build
of this mod stays installed (mods<folder>); maps that use the mod open with
it."; the native delete
of the mod's entities from the open map, as Remove from map (a refusal, Play
running, a load or a busy editor, deletes nothing and is reported); the open
map's undo and redo history cleared so no snapshot older than the delete
remains; the folder moved to the Recycle Bin (deleted outright when the bin
cannot take it) and its record entries dropped; the rescan. The
saved maps are counted from each savegame.user\<profile>\SNAPMAPS<id>\map.decl
(a 4-byte checksum, then zlib of the map text; sh_inflate_raw_upto). The
history is cleared by the engine's own undo push (editor_undo.c): the undo
list is the idList at *(editor+0x10) (data +0, count +8, capacity +0xc,
cursor +0x18, each entry a 0xDD0-byte snapshot), and the push EditorCommitEdit
calls (Vulkan RVA 0x12039F0, OpenGL RVA 0x1202CE0, decoded at run time from
EditorCommitEdit's rel32 CALL at +0x20 to a mov rcx,[rcx]; jmp wrapper)
advances the cursor, destroys every entry from it to the end with the snapshot
destructor and the engine's sized free, compacts the list and appends a copy of
the live edit map. With the cursor set one slot before the first entry it
destroys every snapshot and leaves exactly one, the current state, with the
cursor on it; the engine frees what it allocated and no other address is
needed. It runs on the game thread inside a verified process-heap scope. After
an entity delete the native "Delete Selection" commit lands on later editor
frames, so the Mods tab's tick (sh_modui_poll_main, every native frame while
a clear is owed) clears once sh_editor_delete_native_pending is 0 (at most
ten seconds); without a delete it clears at once. A build where the push does
not decode refuses Uninstall while a map is open. The rescan's refresh rebuilds
the palette without the mod's editor rows and, when the editor refuses the
rebuild because the delete is still committing, retries it once the editor is
free. Closed maps are not edited. Remove from map, Uninstall and Rebuild are
refused while Play runs or a map loads (the editor's deactivation reason, the
engine's load state).
Accuracy: the page renders only from the documents the backend returns. Each
action is answered with its result and then a fresh document whose map object
is read again from the editor, so the confirmation lists exactly what the dry
run computed and the modal redraws from what the backend found afterwards.
The console verbs sh_mods map, sh_mods map add "<id>", sh_mods map remove "<id>" [--yes] and sh_mods uninstall "<id>" [--yes] share the dry runs and
the actions; the console's uninstall of a key removes every installed build of
it (mu_uninstall_targets), "<id>@<hash16>" one build, where the tab names
one folder. Adding a mod to the map changes the current manifest only; the
next save writes its row, so it publishes, downloads and carries the mods tag
like a placed mod's.
A published map is native by default: the product touches its launch only when
its text carries a manifest row (in its member, or a legacy smpmod1. row) the asset rule does not find served (no
installed folder at the row's hash, also when the key is installed at another
build, or one that lacks a name the row lists). Everything else reaches the
engine unchanged: vanilla maps, and maps whose rows the installed folders at
their hashes serve.
Identification. The DeserializeFromJson detour reports each parse with the
map object it filled and a classification by the engine caller's return
address: PublishedMapRead+0x12A is the offline read of the cached map.decl,
SnapMapReadSizeLimit+0x5D the profile reader under PublishedMapComplete;
anything else (editor, My Maps, a rawmap, the product's own resume) is another
parse. After the manifest step and the native parse,
sh_modpublished_parse_seen records beside the kept rows the kind of read, the
map object it filled, the frame it ran in and, when a named bundle is missing,
a copy of the text. sh_modpublished_last_parse exposes the record.
Hold points. The completion that follows a read receives the same map object
in the same frame (the main-thread tick after every native frame ends one), so
each gate uses the record whose map is its map and whose frame is the current
one. The classification is reported, not required: a second detour on
DeserializeFromJson that rewrites the return address (a debugger's, an
overlay's) makes every published read look like another parse, and gating on
it let every map with missing mods through.
| Gate | Vulkan / OpenGL RVA | Steal | Resume |
|---|---|---|---|
OnSnapPlay read completion |
0xFA4A80 / 0xFA3FB0 | 18, the cookie load at +11 rewritten | (manager, NULL, metadata, map) |
| Browser published play | 0xFD1E30 / 0xFD1320 | 20 | (browser, NULL, metadata, map) |
| SnapMap feed read completion, play action only | 0x112B440 / 0x112A5F0 | 14 | (widget, request, metadata, map) with a request whose action int (+8, engine operator new) is 3 |
PublishedMapCacheReady (joiner) |
0xFA1D60 / 0xFA1290 | 15, stack-probe call at +7 | (manager, NULL, metadata, map) after the lobby host's item is re-checked |
CacheMapForLobby, warm cache (joiner) |
0xF9A170 / 0xF99620 | 20 | the function's own cold branch: wait text, CacheReady and error callbacks, PublishedMapRead |
LaunchLocalSnapMapForOfflinePlay (My Maps) |
0xF9FCF0 / 0xF9F220 | 22 | (manager, model, map) when the model is unchanged |
None of these completions reads its request argument except the feed's, which reads only its action int (1 details, 2 author, 3 play) and frees it. A held or refused feed play still runs the completion with the action set to 0, which clears the feed's wait state, frees the int and launches nothing. The warm-cache branch never parses, so it uses the manifest this session saw for that item and revision at an earlier gated completion; an item never seen is not gated.
The launch boundary. Every published play ends in PublishedMapLobbyLaunch
(manager, flag; 0xFA0770 / 0xF9FCA0, steal 18) or PublishedMapOfflineLaunch
(manager, metadata, map; 0xFA0400 / 0xF9F930, steal 17); the install checks that
browser play calls them at +0x9C and +0xAD and the feed at +0xE3. Each gate
consumes the record it decides on, so a record of the current frame that is
still there at a launch, with rows the asset rule does not serve, belongs to a
completion no gate knows. sh_modpub_launch_gate holds such a lobby launch with
the same question (its resume runs the manifest step on the retained text and
calls the launch with its flag, when the screen it was held on is still
current) and refuses such an offline launch, which has no map object left to
resume with, with "This map needs mods that could not be prepared. The map was
not loaded." A launch without a parse of its frame (the lobby's own relaunch
from the map cache) is not checked. The level load at START MISSION builds from
the cached map and does not parse again, so this boundary is the last point at
which a missing mod can be caught.
The hold. When bundles are missing the gate retains a deep copy of the published
metadata (the copy constructor PublishedMapSelectionConstruct uses, inside
process heap 0) and the text, does what the completion itself would have done to
the screen first (OnSnapPlay clears its wait dialog, GDM 0x63, and hides the
progress widget; browser play clears its pending state; the joiner hides the
progress widget), and returns without the original. On a later main-thread tick
(sh_modpublished_poll, after every native frame, menus included) it raises the
engine's Yes/No (GDM 0x29, button set 6) once the dialog surface is idle:
"This map needs N mod(s): (). Download and install now?". Each
row it asks for prints the asset rule's sentence on the console first.
The denial gate (DESIGN-additive 2.8). Before the question, every hold (the
completions, the launch boundary, My Maps, rawmaps, prefabs) runs one job on
the modsync worker that asks the store about each missing bundle
(modsync_probe_bundle: GET /mods/bundle/<hash>, then each borrow checked
against the installed game with sh_mb_stock_verify). One function,
sh_modpub_gate_decide, then decides each bundle from three facts: what the
store answered (held, absent for 404 and 451, unreachable for a network
failure, a timeout, an unusable address, 429, 5xx or an unexpected response),
whether a borrow names game bytes this machine lacks, and whether the map is
published (every map-service hook is; a My Maps map, rawmap or prefab when a
claim this machine holds names the bundle, modsync_claim_names). Held and
installable is obtainable; any other answer denies the launch in one of four
causes, sh_modpub_gate_wording:
| cause | when | sentence (after "This map needs (), which ") |
|---|---|---|
| 1 gone | absent, published | "is no longer available: its author unpublished it, or it was removed. This is permanent on this machine." |
| 2 unreachable | the store did not answer | "could not be downloaded: " and the store's failure in words (plain_reason.h): "the mod store is busy; try again in a few minutes." for 429 and 5xx, "the mod store could not be reached; check the internet connection and try again." when nothing answers, "the address in mods.store answered, but not as the mod store; check the mods.store setting." for another server, "the mod store did not answer; try again in a few minutes." when the cause is unknown |
| 3 never published | absent, not published | "is not installed and was never published. Restore its folder from the Recycle Bin or load the map's rawmap ZIP." |
| 4 game revision | held, a borrow the game lacks | "needs a file this game does not hold (): a different game revision. This is permanent on this machine." |
An editor open asks no store, so its note for a key with no installed build
(sh_modpub_editor_substitute) says only what this computer knows: "not
installed on this computer, so the editor opens the map without it. Playing
the map asks the mod store for it." The causes above, which depend on the
store's answer, are said where the store is asked. When the map's placed
entities name that mod's namespace (mods/<id>/, read by
sh_modmanifest_placed_names), the engine's validator refuses the map
(GetLocalSavedMapEdit's RepairAndMigrate, then its damaged-save dialog,
which the fault shield's save guard dismisses), so the editor cannot open it
without the mod. The note then says so and is also the one-button notice
raised once no gate took the parse (sh_modmanifest_load_refusal): "This
map needs , which is not installed on this computer, so the editor
cannot open the map. Restore the mod's folder from the Recycle Bin, or play
the map from My Maps to get it from the mod store." (My Maps Play holds and
asks the store, above.) An editor open does not itself fetch: it has no hold
point before the engine's load.
A denial drops the hold before anything is asked or fetched: the first denied
bundle's sentence is the one-button notice (with "N more mods cannot be
obtained; see the console." when there are more) and every denied bundle gets
one console line. A prefab's sentences say "prefab" and "the prefab's ZIP
export". The title is the store manifest's name, else an installed build's,
else the key alone. A key installed at another build (sh_modserve_row_other_build)
is never a cause, and never mentioned. When the store holds the declared build
it is the obtainable case, asked with the ordinary question above; the
download lands beside the installed build by hash without a word about builds
(owner 2026-11-09). When the declared build cannot be obtained, the player's own
content substitutes (verdict SH_MODPUB_GATE_SUBSTITUTE, fact own): a My
Maps play, a rawmap load or a prefab placement goes on with the installed build
of the key, as an editor open does (DESIGN-additive 2.5). Each such row prints
<hold>: <key>: uses the installed mod; the next save of the map records it
(the hashes on the backend log), leaves the hold's missing list, and is
remembered for the session (sh_modpub_row_substitute, checked against the
key's installed build on every use), so the hold's resume, a rawmap's reopen,
the next launch of the same map and the Prefabs tab's second placement find
the row served. When no row is left the hold resumes without a question;
otherwise only the rest is offered. A fetch that fails after Yes for a row
that can substitute substitutes it and fetches the others again. The launched
map's listing declares the installed build through the manifest's
substitution table, which the My Maps parse and the hold's resume parse fill
as an editor parse does, so the Play's per-map pinning matches what serves it;
a prefab adds its row to the map at the installed build. A map from the map
service (browser, lobby, feed, launch boundary) keeps its author's build and is
denied as before: substituting there would change what its author
published. A fetch that fails after Yes
is decided by the same function (404 and 451, a network failure, and
MODNET_E_GAME, the download's own borrow refusal, whose source the fetch
keeps). A placeholder system (phase 6) would plug in at sh_modpub_gate_decide
with a verdict of its own and touch nothing else.
Yes starts one job on the modsync worker that fetches every missing bundle by
hash and logs a progress line every two seconds. When the job is done, on a main
tick, the index is rescanned, every fetched bundle must be admitted, the screen
the hold came from must still be current (and, for a joiner, the lobby must
still host that item and revision), the manifest's bundles are activated, a
fresh idSnapMap is constructed, the retained text is parsed through the normal
detour (which strips the rows and activates), and the original completion runs
with it. No, a failed fetch, a bundle that will not install or a lobby that
changed drops the hold: nothing is launched, the progress widget is hidden, and
a one-button notice names the mod. Another map load, or a newer held launch,
abandons the hold silently and cancels its fetch. The engine thread never waits:
the network runs on the worker and the dialog is polled. After No, a hold that
asked for one row shows that row's sentence and "The map was not loaded."
(for example "This map uses Hell Guards (local.hell-guard), which is not
installed. The map was not loaded."). The download lands by hash under
mods\downloads\<map title>\<key>\ (modsync_fetch_bundle_for; the title is the
published item's, an idStr at metadata +0x398 beside the id at +0 and the revision at
+0x30, a rawmap's file name, a prefab's name), never over a folder; the resume
checks every row against the asset rule again.
A rawmap carries the same manifest rows as any saved map (its snapmap-plus member), and its JSON alone
loads only where those mods are installed: a placed entity whose mod is absent
makes SnapMap's own validator throw the player out with "map corruption". So a
rawmap is never handed to the engine while a mod it names is missing.
Loading. sh_modpub_rawmap_missing reads the rows and counts those the asset
rule does not find served (missing or incomplete). The editor reload, which
both File > Load Rawmap... and sh_rawmaps load use, checks on its own
frame before LoadMap (sh_rawmap_prepare_reload in ef_service_reload); the
text it read, with a .zip already imported, is what the parse then uses. Any
other substitution (a staged file and the next map the player opens, or rawmaps
on for every load) is checked in the DeserializeFromJson detour: a map that
misses mods is not substituted, the map being opened loads as itself, and the
hold starts after that parse. Inside a reload window a failed check parses
nothing rather than the borrowed saved map.
The hold (sh_modpub_rawmap_hold, hook SH_MODPUB_RAWMAP_LOAD) runs the
denial gate first, as every hold does (see Published maps and missing mods).
When every missing bundle is obtainable, the player gets the question a My Maps
launch asks, and Yes fetches and installs them; the resume does not activate
anything (the rawmap's own parse does) but opens the rawmap again, through a
reload when the editor can take one and otherwise staged for the next map open,
with a notice saying so. That reopened load parses the text the hold checked
(held_take in rawmap.c), so a .zip is imported once, at the hold; any other
read of the source drops it and reads the file again. Otherwise the load is denied with the gate's
sentences; the asset rule's sentence for each row comes first on the console.
No and a failed download behave as for a published map. The gate is bound with the published-map gates; on a
build where they did not install, nothing is counted missing and rawmaps load as
before.
Saving. After every rawmap write of a map with at least one row (the File menu's
Save Rawmap and Save Rawmap As, sh_rawmaps save, and the mirror when rawmaps
are on), the export is written beside the JSON at the same path with .zip
(rawmap.json becomes rawmap.zip), through modexport_write_text_report. The
next main tick (sh_rawmap_poll_main) shows one toast and one console line:
"This map uses N mod(s); share .zip, the .json alone will not load for
others." A save whose own path ends in .zip is the export already; a map with no
rows writes only the JSON. sh_rawmaps status and the File menu's status
(lastJson, lastZip, lastZipBytes, lastMods, lastZipError, and mapMods
for the open map) report what the last save wrote. A ZIP left beside a JSON by
an earlier save is not deleted when the map later stops using mods.
The ZIP (modexport.h) carries the map and each mod its rows name, at the
bundle hash the row declares, as that build is installed:
<name>.json the map text, its snapmap-plus member included, named after the ZIP
mods/<folder>/mod.json the store folder's name under mods\ (<key>, imports/<ZIP name>/<key>,
mods/<folder>/assets/... downloads/<map title>/<key>, or an author's organizing folders), byte for byte
Entry names separate with / only, as the ZIP format requires: a mod in an
organizing folder (mods\campaign-interactables\campaign-interactables-1\) is
carried as mods/campaign-interactables/campaign-interactables-1/, and the
importer takes a carried folder at any depth the store enters (one whose
ancestors carry no mod.json). The importer refuses a backslash in an entry
name, except under mods/, where an export written before this fix used one
as that folder's separator and it reads as /.
Each row's build is taken from the installed folder at exactly that hash (while
that folder's latest build is failed, its carried files are read from its last
good build snapshot, mods\.builds\<key>@<hash16>\, whose bytes the hash
names); else from a snapshot at that hash whose folder moved on (its
bundle.json is carried as the folder's mod.json); else from the folder an
alias of the hash names, as below.
There is no export.json, no bundle.json and no bundle.canonical.json, no
legacy/ level and no +<build> suffix: the rows name the bundles, and each
carried mod.json records its bundle hash in its product block (with its
legacy record, if any). A stock pointer is an entry of mod.json, so the
folder carries it; installed game content is never written into the ZIP, so a
pointer whose bytes an author's folder holds under assets\ travels without
them. A row whose build only an alias still answers (the author rebuilt that
folder in place) carries the folder serving it now, and the exported map's rows
name that build.
Importing it is the ordinary install by hash of each carried folder whose
bundle a row names (modexport_read, on whichever thread loads the map; a
carried folder no row names is left out):
- a carried folder the store already holds (by its hash, or an alias of it) is skipped and counted as already installed; nothing in that folder is written. Another build of its key never counts: a map pins its build;
- each remaining folder is copied out of the ZIP into a temporary folder (with
the bytes of a pointer the folder held filled from this player's own game)
and installed from there as any folder from elsewhere is
(
sh_ms_install_placed, originimported: built, copied into the store, verified) asmods\imports\<ZIP name>\<key>\(<key>-2... when another build holds that name), never beside the player's own folders and never over one, whatever the carried folder was called and whatever its version. Same version with other files is not a refusal. A mod that needs another carried mod is built after it; - the built bundle hash must equal the one the carried
mod.jsonnames; otherwise, and on any other refusal, exactly the folders this import installed are removed and the load is refused (" in the export does not build to the bundle the map names", or " , a mod this map carries, does not install on this computer (<the builder's reason>); nothing was installed. Ask whoever shared it for a new export saved with this release"); - a carried
mod.jsonwhose block an earlier builder's rules wrote (its"rules"absent or belowSH_MB_RULES, and its recorded hash not the one today's rules give:sh_mb_load_text_earlier_rules) is not left out: it is rebuilt under today's rules, as the store rebuilds its own folders once after a rules change, and installed (or found installed) under the hash they give. The map's row keeps naming the recorded hash, so the hold then treats it as another build of an installed key: the store's copy of the recorded build is offered beside it, else the installed build substitutes. A block with today's"rules"whose hash does not match was edited by hand and is still left out. A folder from earlier rules that today's rules refuse (the development builds of 2026-11-04 to 11-07 wrote retired intent keys, whose partials today's builder refuses: "this is a partial; put the whole edited copy ...") is that one mod's failure: it is left out with one log line naming the builder's reason, the rest of the export installs, and the map's row for it is a mod this computer does not have, which the hold then settles as for any map (the store, the installed build of its key, or the gate's sentences); - after an install the serving index is rebuilt, as before.
A refused import reaches the player whole: the editor reload
(sh_rawmap_prepare_reload) prints and toasts " was not opened:
<the importer's cause>." (a .json that cannot be read gets Windows' reason
through plain_reason.h), and the backend log line carries the same cause
uncut (MODEXPORT_CAUSE_MAX).
A map's ZIP in the bundle form beta.20 wrote (map.rawmap.json, an
export.json index, and per bundle mods/[legacy/]<id>@<version>+<build>/
with bundle.canonical.json and its files, each distinct file stored once)
opens: each canonical manifest a row names is installed as a download is
(modsync_install_manifest), its files taken from the ZIP by hash, so the
bundle keeps the hash the map pins (me_install_retired). Any other ZIP in
that form (no map.rawmap.json) is refused: "this export was made by an
earlier release; save the rawmap again". The map importer tells a map from a prefab by
the carried .json: an idSnapMap (or an object without ~type) without a
snapmapPlus block is a map; a prefab's export is refused with "this is a
prefab's export, not a map's". The published-map download path is not used.
A prefab is never handed to the engine while a mod it uses is missing, for the same reason as a rawmap: an entity on a mod's decl, or an instance of a mod's module, has nothing to resolve to.
One file. A prefab is one file in the library: the engine's JSON (an
idSnapEntityPrefab, or a module prefab's idSnapMap) with one product-owned
top-level member, snapmapPlus, after the engine's own members
(prefab_block.h):
"snapmapPlus":{"format":1,"description":"","tags":[],
"mods":[{"id","version","bundle","size","names"}...],
"summary":{...}}
summary is a module prefab's summary (module, entity, door-slot and variable
counts, dropped wires and references, AI Navigation boxes, environments, the
footprint and each module's box) and is absent for an object prefab. The block
is inserted as ,\n"snapmapPlus":{...} right after the last engine member, so
removing that span gives back the engine's bytes exactly. The engine's
reflection parser skips an unknown top-level key (on 13954591 a map carrying
the block loaded clean and the engine's re-save dropped it), but nothing depends
on that: every reader strips the block first. Load / Place strips it before the
paste or the module merge, the module check and merge strip it again in the
backend, the closure ignores it, and the Prefabs tab sends the page the scene
without it (the page's scene parser also drops the key). The product writes a
prefab file at Create and then only rewrites its block; the engine never
re-saves one, so the block persists.
Plain JSON. The engine's serializer writes a block comment before almost
every member ({/*camera yaw*/; one stairs prefab held 209). Create
removes every block and line comment outside a string
(sh_prefab_block_strip_comments in prefab_block.c, the one function every
writer of an object prefab file uses: the host before it writes the file, and
MODS_RECORD again before it writes the block) and then appends the block, so
a prefab file is plain JSON. Strings keep every byte, comment openers and
escapes included. Readers still skip comments, because files created by
earlier builds have them; the engine's deserializer reads comment-free text
(module prefab files and prefabs from the 2018 build have none).
Recording. Saving a prefab finds its mods exactly as a map's save does: the
placed names of the prefab text (sh_modmanifest_placed_names: every
inherit, moduleName and string inside an edit object) go through
modserve_bundles_for_names_visit, which names every admitted bundle that
provides one and the bundles its needs reach. Each bundle is one row in the
manifest's form; a pinned hash an alias names resolves to the current build
wherever a row is used, as for a map. Create writes the file the engine
serialized and then has the backend write a fresh block into it (MODS_RECORD:
empty description and tags, the rows, [] when there are none); a module
prefab's save writes the file with its block in one step. The Prefabs tab's
description and tag edits rewrite the block in place (META_WRITE), keeping its
summary and rows. No sidecar is written.
The read-only sidecar. A prefab saved before the block has none. When a
<name>.meta.json sits beside it, the list and Prefab Details show that
sidecar's description, tags, summary and "mods" rows, and Load / Place,
export and sh_prefab mods use its rows. It is not migrated: the first
description or tag edit writes the block into the file from the sidecar's
details and leaves the sidecar on disk as it was; from then on the block wins.
A prefab with neither names no mods and loads as before. A sidecar is never
listed as a prefab, and it follows its prefab when that is moved, renamed or
deleted.
The page and the slot see a prefab's details as one flat object, the view:
the sidecar's shape, {"desc","tags",...summary members...,"mods"}. A block
reads as a view and a view composes into a block (prefab_mods.c).
META_READ returns the view of a file (its block, else its sidecar); the
Prefabs list reads at most the last 1 MB of each file, where the block is.
Resolving. Load / Place first reads the rows (MODS_RESOLVE, on the game
thread):
- a module prefab naming a module no row provides and the palette lacks (DLC the player does not own) is refused with the module guard's toast and console line, below; nothing is fetched, because nothing can install it;
- with every row served (the asset rule), the rows are activated for the open map
through the builds that serve them
(
modserve_activate_bundles) and each one the open map does not list (its scope listing, else its manifest rows) is attached as a map-level row through the Mods tab's Use in this map (sh_modui_run(SH_MODS_ACT_MAP_ADD), given the folder of the build at the row's hash, so the map declares the prefab's build and not the newest of its key), with one console line: "Prefab uses ; this map did not list it, so it was added to the map (the Mods tab's Remove from map takes it out).". Then the placement goes on unchanged; - otherwise the placement is held by
sh_modpub_prefab_hold, the rawmap hold with its own hook (SH_MODPUB_PREFAB_PLACE): the denial gate asks the store on the worker; when every missing bundle is obtainable the engine's Yes/No asks "This prefab needs N mod(s): (). Download and install now?", Yes fetches and installs them by hash, and the ready callback runs the step above; only rows the asset rule reports missing or incomplete are asked for; the Prefabs tab, pollingMODS_POLL, then places the prefab through its ordinary Load / Place. Otherwise the placement is denied with the gate's prefab sentences ("This prefab needs <title>, which ... The prefab was not placed."). No, a failed download and a bundle that will not install end as for a map, with "The prefab was not placed."; - with the gates unbound (a build where the published-map gates did not install) the same refusal is printed and toasted without asking the store.
One hold runs at a time: a second placement while one waits is refused.
Export. sh_prefab export "<name>" "<path.zip>" and the tab's Export always
write one ZIP, also for a prefab that uses no mods, in a map's layout
(modexport.h):
<name>.json the prefab file, its block naming the builds carried
mods/<folder>/mod.json each mod the block's rows name, at the hash the row records,
mods/<folder>/assets/... as that build is installed: the store folder's name and its files
There is no export.json, no sidecar and no bundle manifest: the prefab's own
block is the index, and each mod.json carries its bundle hash.
<name>.json is the file's bytes as they are on disk. A prefab with no block
(saved before it, with or without a sidecar), one saved before rows were
recorded (its rows are then the closure of its text) and one whose rows pin an
earlier build are carried with their block written for the rows the ZIP
carries; the file in the library is not changed. The Export dialog proposes
<name>.zip.
Import. sh_prefab import "<path.zip or path.json>" and the tab's Import (the
Open dialog's "Prefab exports (*.zip, *.json)") take the ZIP, or a .json
inside an extracted export folder: that folder is the export, the picked file is
the prefab and a mods/ folder beside it holds the mod folders. The importer
takes the one top-level .json (an idSnapEntityPrefab, or an idSnapMap that
carries a block) and installs each carried mods/<folder>/ whose mod.json
names a bundle the block's rows name, exactly as a map's import does (see
Rawmaps that name mods): skipped when the store holds
its hash, installed by hash under mods\imports\<ZIP name>\<key>\ otherwise, and removed again when it does not build to the hash its own
mod.json names; a carried folder no row names is left out. It then rescans and adds the prefab under the .json's file
name. A prefab of that name with the same bytes is left alone (an
import that finds everything already there writes nothing); one with other bytes
is kept and the import takes " (2)" and so on. A row the export does not
carry is named in the result ("It also needs , which the export
does not carry."), and Load / Place asks for it as above. Each importer refuses
the other's ZIP, told apart by the carried .json ("this is a map's export, not
a prefab's"), and the prefab importer also refuses a map's JSON and two prefabs
in one ZIP. An export in the bundle form of earlier releases (any
bundle.canonical.json, in a ZIP or an extracted folder, or an export.json
index) is refused with "this export was made by an earlier release; export it
again".
sh_prefab mods "<name>" lists the block's rows (else the sidecar's) and
whether each is installed, with the asset rule's sentence for one that is not.
What is sent: the bundles the published map names in its manifest rows, and
only those, at publish time. The SerializeToJson detour reports each save's
final text (sh_rawmap_set_save_observer); PublishAfterSave, the Save
state's callback that runs before the first request to the map service, is
detoured (modpublish.c). A save without rows publishes natively. A text over
the service's 10,485,760-byte bound is refused through the engine's own
PublishFail, with a toast giving the size and the overage. Otherwise the
publish is held: the Save state returns with the publish pacifier up, as the
engine's own asynchronous chain leaves it. The first publish with mods on an
installation asks once through sh_engine_dialog_ask (Yes sets
mods.upload_confirmed); the ask site is one function, and an alternative
route shows the explanation as PublishFail's editor toast instead, cancels
that publish, and treats the next one as the agreement. One worker job then
uploads every bundle (modsync_upload_bundles: each bundle's canonical
manifest with its blob list to POST /mods/missing, the missing blobs, the
manifests, one claim) under a provisional ref publish-pending-<16 hex>, and a
main tick resumes the original PublishAfterSave. The store checks a manifest
sent to /mods/missing as its bundle PUT would (modnet_missing_bundle), so a
manifest it refuses stops the publish with the store's message in one request,
before any blob is sent; a store that does not name the bundle back did not
check it, and its bundle PUT still does. The rules of the store's that the
builder would otherwise admit (an author key outside ^[a-z][a-z0-9_-]{0,63}$
such as displayName or $schema, a control character such as a tab in the
name or author) are mirrored as build warnings in one table,
MB_STORE_RULES in modbundle.c, so the author hears them at the build
rather than at publish. They are derived again whenever a built mod.json is
read, so they also reach sh_mods doctor (one "warning i of n" line per
bundle), each rescan (one line per mod with warnings), the Rebuild result
(warnings, firstWarning) and each mod of the Mods tab's v3 payload
(warnings: the first SH_MB_WARNINGS_KEPT as strings, warningCount,
firstWarning). The builder's other warnings are its build report's. A publish whose save
carries rows also carries the search tag mods, so players can see that the
map needs Snapmap+. Every local save keeps the tag in step with its rows: the
WriteLocalSavedMapText detour adds it to the model the save writes when the
save observer saw rows and removes it when it saw none (the model is copied
back to the editor), so an undo of the last mod's removal, or a save made
without publishing, never leaves a map with mods untagged. The tag has to be in the local save's metadata: the cloud
save TryCloudSave starts reads the slot's metadata back from the profile
(ReadLocalSaveMeta) rather than the editor's model, and the published item
copies the cloud save's tags, so a tag added to the editor after the save is
lost. PublishStart is therefore detoured to arm the tag for the edit's local
id, and WriteLocalSavedMapText (the local save's metadata and map.decl
write) to append mods to the model it writes, when it is that slot's save
and the save observer saw rows, the way PublishStart appends map:dev (the
list grow and idStr assignment are bound from its own calls). The save then
copies that model back to the editor. A tag that cannot be written is logged
and the map publishes without it; a held publish whose save was not tagged
logs that too. A No, a failed upload, a
question that cannot be shown or a busy worker cancels through PublishFail
and a toast naming the cause; nothing reached the map service. The editor
leaving abandons the hold; another save cancels it.
The claim and its secret: PublishFeedPost, the one function both success
paths reach, carries the item id and revision. The worker claims the bundle
set under the item id. On a republish the stored secret re-claims that ref,
which replaces the set (Contract 4); a republish without rows releases the
item's claim. The claim id and secret live in the record's claims
section (modsync); the secret is never logged. The provisional claim is released once the item
claim succeeds, or when its publish never reaches the feed post. Claims,
links and the retry queue are the claims, links and pending sections of
mods\snapmap-plus.json.
Release: the MapInfo screen's unpublish completion ((screen, ctx, const idStr &id), bound by the unpublish confirm) releases the item's claim on the
worker. Deleting a map from My Maps removes the local slot and the cloud-saved
item; the published item stays playable for everyone, so its claim normally
stays. The delete completion ((screen, ctx, const idStr &localId, const idStr &cloudItemId)) releases a claim only when its item is no longer published,
for example after an unpublish this installation never saw. Neither saved-map
model links to a published item (their reflected fields hold only the local
id, the cloud-saved id and branch parents), so the feed post records the link
itself in the record's links section (item id to cloud-saved id and local id).
At delete, the linked items that still hold a claim are checked with the
engine's own maps_pub_prev_pub search (PublishedPrevQuery, by parent
cloud-saved item and owner), issued on the main tick with two callback objects
the engine's request context invokes and destroys; only an item missing from a
successful answer is released. No link, no stored claim, no cloud-saved id, a
link younger than an hour (a fresh item may not be searchable yet), an answer
as long as a search page (30 items, it may be partial), a failed answer or
none within 60 seconds keeps every claim. A release or an
unpublish forgets the link. A copy to My Maps of a published map whose
cached text (%LOCALAPPDATA%\id Software\DOOM\base\doomsnapmaps\published-maps\<id>_<rev>_map.decl)
is over the bound is refused at the MapInfo and browser entries, before the
engine creates the saved item, with a one-button notice.
The retry queue: a failure modsync can retry stays in the record's pending
section, an upload or a claim release alike. A release the store does not
take (a busy store at unpublish, say) is queued under its ref rather than only
logged, since a leaked claim keeps its bundles on the store; it replaces a
queued upload of the same ref. Queued releases are retried after the next
store call that succeeds and at startup. At startup the backend first forgets
the queued work of provisional refs left by a closed game (their publish never
completed), then retries the queue once on the worker, then releases each
provisional claim, except one an item's queued claim still waits on: the item
claim records its provisional ref when it is queued, and the provisional claim
keeps the bundles on the store until that claim succeeds. Releasing it first
would let the store delete a bundle the retry then has to upload again from
whatever build serves now. The worker logs the counts.
module_prefab.c saves the selected Blueprint modules as an idSnapMap file,
with the summary and mod rows in its snapmapPlus block (one file, see
Prefabs that name mods), and places one by stripping
that block and merging the rest into a fresh serialization of the open map
(module_prefab_map.c) and installing the result through the engine's Redo step
(see module_prefab.h). Before the merge, Place checks every moduleName the
file names, on the game thread: sh_mp_check_modules asks
sh_grid_native_module_known, which accepts a record of the editor's module
palette (found by exact name over every record, because the Blueprint Add tool
re-sorts that list), a Grid Room size the adapter builds, a module an installed
mod serves (sh_modserve_module_served) or one already loaded into a private
palette. Any other name refuses the placement before the engine sees it: slot
result -6, one console line Module prefab: needs module <name>; this room is not in your palette (DLC or a mod you do not have) and a toast naming the rooms.
A module a served mod provides is a mod row like any other (see
Prefabs that name mods): the save records it, Load /
Place downloads and installs it before this check, and the check then finds it
served; a module no row provides and the palette lacks is DLC, refused here.
The engine has no safe outcome for such a name. The map validator (VK
0x1412488e0 / GL 0x141247f10) drops the instance through HasModule ("Couldn't
load module") and keeps its entities, and the record builder SnapMapEditCtor runs
(VK FUN_141204380 / GL FUN_141203780) raises FatalError "Couldn't find module in
modulePalette" when FindModule returns the palette's end record. The Prefabs tab
runs the same check (SH_MODULE_PREFAB_CHECK) when a module prefab is selected
and shows the missing rooms above Limits; the check names nothing when no editor
palette is open, and with the prefab's block (or older sidecar) it leaves out the modules its
mod rows provide, which the Prefabs tab lists as mods instead.
From the install until Space or Esc ends its grab, a placement is held
(sh_module_prefab_held, read through prefab_watch); the editor budget
already counts the installed modules then, so the Prefabs tab's Limits show the
live usage as "Map after" for the held prefab instead of adding it again.
sh_module_prefab_selected_count reads the length of Blueprint's module
selection, the count Save uses, for the tab's Create gate.
modaction.c lets a map carry a behaviour in stock data, so a new engine event
needs no product release: a Set (String) node whose literal value starts with
smp: is a command. The detour sits on the action's DoAction(this, activator)
(signature StringSetDoAction, Vulkan 0x9E26C0 / OpenGL 0x9E19B0, reached
only through its vtable slot), the one hop where the activator is known; the
variable-changed notification that follows carries only the variable index.
The 20-byte prologue is checked before the detour is placed; the engine calls
the hook uses (ProcessEventArgs, the argument clear and entity conversion,
the two player casts) are raw RVA pairs that apply only on the recognised build
13954591 executables.
The hook reads the node's value parameter at this+0xCA8: a literal when its
index equals the engine's "no variable" constant (-1), held in an idStr at
+0xCB0 (length +0x08, data +0x10). It acts only when all of these hold:
the master switch (sh_smp on|off) is on, the game manager reports the host
(IsServer, gameMgr +0x2BB3A4), the SnapMap logic manager exists (the same
check every stock action makes), and the optional map gate
(sh_modaction_set_map_gate, unset by default because the smp: prefix is the
map's own opt-in) admits the open map. Logic only runs on the host, so a client
never reaches the hook. The activator becomes a player by an idPlayer cast,
else through the owner slot (vtable +0x558) the stock Give Item action uses.
The command runs on the game thread inside DoAction, then the stock write
proceeds unchanged; a fault inside the command is caught and logged and never
stops the write.
smp:event looks the event up through the decl manager's event interface
(+0x90, FindByName +0x10), types the arguments from the record's compact
format (+0x08), and dispatches at once with ProcessEventArgs(obj, ret, def, n, arg...), up to eight 0x18-byte idEventArgs. A bool travels as 'i' because
the engine's argument copy drops a 'b' value; an entity argument is resolved
by name and converted to its handle with the engine's own constructor; a string
points into the parsed command for the duration of the call. smp:doomhands
writes the player's Doom-hands byte (+0x45EB5, otherwise written only by
idPlayer::Spawn from the local-player check, the SnapMap game type, the map's
useSPModels and a player count below two) and marks the hands and body stale
(+0xB512, +0xB513) so the next think reselects them. The parser and the
argument typing are pure C (SH_MODACTION_PURE, tests/modaction_test.c).
sh_event list reads the same registry (Count +0x28, GetEventCommand
+0x08); on this build it holds the 1611 events of the Timeline tab's
generated catalogue with the same argument types, so the tab's picker already
offers every registry event. Timelines resolve their target entities when the
map spawns (idComponentTimeLine reports "references bad entity" for a name
that does not exist yet, such as player1), while entity arguments resolve
when the event runs. The engine's own writer annotates the call's members as
"\neventHandle_t eventDef" and "\nnum" (a leading newline), and the Play
build warns about them
("Expected 'eventHandle_t eventDef' ...") but still reads the call.
The fault shield handles selected, understood engine faults. It does not make arbitrary native calls safe. Expected recoveries, nonterminal notices and fatal records have different meanings; a captured record alone does not prove survival.
The Class-B redirect turns a fault into the engine's Error(6). Only
idCommonLocal::Frame's idException catch receives it, and that catch is a full
teardown run inside the catch funclet, outside Frame's try: it syncs the renderer
and calls CancelMapChange, which unloads the game and loads game/shell_map.
redirect_policy.h therefore declines the redirect, and leaves the fault to the
fatal handlers and their crash report, when the fault is off the engine main
thread; when an earlier redirect is still being recovered in the same Frame
call, where a second throw reaches the game-loop catch that ends the process;
and when the faulting stack does not unwind to Frame. An input the shield
cannot read keeps the earlier behaviour. The decision is logged as a declined
shield line with its stack.
A fault during a map load is recovered through the same redirect.
idLoadScreen::LevelLoadCompleted is the only code that stops the
loading-screen thread (the load_screen global, thread byte +0x4b2), and an
error thrown out of a load skips it, the engine's own recoverable errors
included. CancelMapChange's renderer sync and menu load then run while that
thread still draws the load GUI: a deadlock in a Play load, or a race on the
shared menu GUI (issue 132). load_screen_stop.c detours CancelMapChange
(common vtable +0x28): on the engine main thread with the loading-screen thread
still running it calls LevelLoadCompleted first, the engine's own order on a
load that completes (stop the thread with no lock held, sync the renderer, free
the load GUI), then runs the original. Both functions are signature-resolved and
the stolen prologue is verified at startup on both renderers
(tests/load_screen_stop_test.c). Only while that detour is armed does the
policy redirect a fault with the loading-screen thread running; otherwise it
declines it as before.
The serialized-entity cleanup guard permits an empty moved handle, as the native snapshot writer already does. It skips that handle's index write and preserves the engine's list reduction and removed-entity reset. Startup requires a unique instruction signature and exact-byte verification on both supported renderers.
Failures the player or author reads are worded by one table, plain_reason.h
(sh_reason): a Windows error code becomes what happened to which file and
what to do (access denied, a file open elsewhere, a full disk naming the drive
and the bytes needed), a mod store status becomes the store's state and the
next step, and a file-name character the game cannot read is named with its
code point. The store, builder, importer and download messages route through
it; none carries a bare "error ".
Crash formatting produces complete JSON or an empty failure. Capture uses bounded storage and nonblocking guards so nested faults cannot wait on a faulting thread. A pending record is published only after its temporary file is written completely. The frontend reads those records for notices or report prompts; network reporting is handled separately by the feedback pipeline.
Keep thread, ownership and failure contracts in the relevant header and verify the production path with focused tests. Use fault injection for rollback and publication failures, controlled concurrent readers for snapshot changes, and both executable images for resolver changes. Build both DLLs and test the affected workflow in DOOM before shipping. See contributing.