"""Placement identity through the split-stream --entities-out path (synthetic data only).""" import contextlib import io import json from pathlib import Path import struct import sys import tempfile import unittest TESTS = Path(__file__).resolve().parent sys.path[:0] = [str(TESTS), str(TESTS.parent / "tools")] import test_world_index as twi # noqa: E402 STRIDE = 0x90 PARENT_MAPS = (0xABCD, 0xCDEF0123) UNSUPPORTED = 5 # one-based block ID of the unsupported class def entity_ref(index): return ((index * STRIDE) << 20) | 1 # block 1, byte offset in the upper bits def make_map(links, pointers, parent_maps=PARENT_MAPS, *, map_name=0xABCDEF, first_x=10): """Extend the stock fixture's CMapData root and its template CEntityDef.""" blob = bytearray(twi.make_resource()) template = blob[0x400:0x400 + STRIDE] def extend_members(header, additions): old_table = struct.unpack_from("