Skip to content

RE2R (Non-RT) scn.19 / pfb.16 / fmsv2.30 support - #3

Merged
Namsku merged 10 commits into
masterfrom
re2r-non-rt-implementation
Sep 4, 2026
Merged

RE2R (Non-RT) scn.19 / pfb.16 / fmsv2.30 support#3
Namsku merged 10 commits into
masterfrom
re2r-non-rt-implementation

Conversation

@Namsku

@Namsku Namsku commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

namsku and others added 10 commits August 24, 2026 22:28
- pfb v16: correct 40-byte header, packed UTF16 resource strings,
  GORef table layout; fixes crashes and empty exports on all RE2 prefabs
- scn v19: embedded userdata roundtrip in RSZ and JSON serializer
- RszSerializer: size-tolerant Segment fields (declared size honored,
  e.g. via.gui.Memo.FontSize as two floats)
- StringPoolBuilder: game writes one physical string copy per reference
  but backpatches all offset refs to the first occurrence
- Un-skip Rebuild_RE2_ST4_701_0_GIMMICK; drop stale hardcoded length
- Verified byte-identical rebuild of all 2912 scn.19 + 5012 pfb.16 files
  from a live RE2 install

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
- Preserve raw (actionId, actionEx) slot words per node: files whose
  action ids don't resolve to a decoded RSZ object no longer silently
  drop those slots on rebuild. Slots are written columnar (all ids,
  then all ex values) to match the format.
- Deduplicate identical node names in the name pool (the game stores
  each distinct name once and reuses the char offset).
- Write the resource pool's count/char-length prefix bytes before its
  entries; backpatching previously overwrote the first entry with the
  two counts when the pool was non-empty.
- Empty resource/userdata pools on v<42 are a bare count, matching the
  vanilla layout; userdataPaths stays empty for now.

RE2 fsmv2.30 corpus and an RE8 fsmv2.40 file now rebuild byte-identical
(or semantically equal where hashes are preserved); TestBhvt is green.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
All 8532 RE2 non-RT files now roundtrip through JSON byte-identically:
2912/2912 scn.19, 5012/5012 pfb.16, 609/609 fsmv2.30.

scn.19:
- v19 layout: tight tables, u64 string offsets, correct header field order
- embedded userdata serialized as nested @Embedded JSON (symmetric)
- resource preload table carried as @resources metadata and restored
  verbatim on import (scene-derived harvesting is lossy in both
  directions); empty tables are preserved as empty arrays

pfb.16:
- 40-byte header (v<17), packed NUL-terminated UTF16 resource blob,
  raw game object ref table replayed verbatim via base64 metadata with
  object-id identity remapping for edited scenes
- standalone loose objects (settings/components outside the GO tree)
  roundtrip via a PrefabDocument shape
- v16 resource table also carried verbatim, including empty tables;
  no alignment padding between tables and the RSZ stream (vanilla has
  none)

fsmv2.30:
- originalTableIndex passthrough so rebuilds keep vanilla state tables

serializer:
- RszEmbeddedUserValueNode support in RszJsonSerializer
- size-tolerant Segment deserialization (declared size vs managed struct)
- template-free builders for scn.19/pfb.16/fsmv2.30 imports

New corpus tests skip gracefully without a vanilla install.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpPj5qFvuddhqLN8NUH19e
Named, single-purpose gameplay patch built on BhvtFile.Builder, with a
test against a synthetic chapter1 mainflow tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpPj5qFvuddhqLN8NUH19e
empty.fsmv2.34 is the embedded template consumed by Fsmv2FileHandler for
version 34. McpServerTestHost hosts the real MCP server over stdio for
tests; call sites are migrated in a follow-up.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpPj5qFvuddhqLN8NUH19e
…ntation

# Conflicts:
#	src/IntelOrca.Biohazard.REE/Rsz/PfbFile.cs
#	src/IntelOrca.Biohazard.REE/Rsz/RszFile.cs
Point the MCP server test at the shared McpServerTestHost helper (added
earlier) and drop the now-duplicated private helpers. Keeps upstream's
read-tool API (expand_nodes; the full param was removed upstream).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpPj5qFvuddhqLN8NUH19e
10 vanilla enemydead/emXXXX_dead.pfb.16 files (of 5012) were produced by a
tool that 16-aligns two internal offsets the rest of the RE2 corpus leaves
unaligned, with nothing in the format predicting which files do it:
  - ~12 stray zero bytes before the RSZ block (header DataOffset)
  - 4 bytes of leading pad before the RSZ v8 instance-info table

Capture both from the source file and carry them through the JSON hop as
@meta-dataoffset / @meta-rszinstpad, then replay the exact gaps on build.
Replays are bounded (<= 16 bytes, only when the rebuild is short) and gated
so the 5002 files without the padding stay byte-identical.

PfbFile16_AllCorpus: 10 failures -> 0. ScnFile19_AllCorpus unchanged at
97 (scn path untouched). No other regression. Regression test:
em0000_dead.pfb.16 added as a permanent PfbFile16 case.

Hypothesis confirmed: the padding is tool provenance, not a layout rule --
identical-looking prefabs (doorenduringforlocked.pfb.16) have none.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KpPj5qFvuddhqLN8NUH19e
@Namsku
Namsku merged commit e97eceb into master Sep 4, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant