[GH-ISSUE #3711] [Feature] CR2W and RED4 resource container reverse engineering: CR2W chunk trees, RTTI reflection tables, compiled script bytecodes and entity component graphs #1421

Open
opened 2026-10-16 21:05:18 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @matbrgz on GitHub (Oct 14, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/3711

Type: Feature Domain: Game & Engine RE Status: Proposed Ecosystem: REA

Problem Statement & Context

High-fidelity open-world cinematic action RPG engines utilize custom binary resource serializations across two major architectural generations:

  1. CR2W Binary Format (Core Resource 2 Wrapper):
    • File signature CR2W (magic 0x57325243), engine version flags, and file header tables: Strings table, Names table, Imports table (external resource paths), Properties table, and Export chunk tables.
    • Used across .w2mesh (meshes), .w2ent (entities), .w2scene (dialogue & cinematic scenes), .w2anims (animations), and .env (world environment parameters).
  2. Modern RED4 Resource Architecture:
    • Upgraded resource framework utilized in modern futuristic titles: .redscript compiled bytecode, .ink UI layouts, .ent entity definitions, .app appearances, and .streamingsector world streaming chunks.
    • Run-Time Type Information (RTTI) reflection system with 64-bit FNV-1a hashed class, property, and function names.
  3. Archive Storage Packages (.bundle / .archive):
    • Multi-part resource packages packing compressed CR2W/RED4 resources with Snappy, Oodle, or Zlib compression and CRC/FNV path indexing.
  4. Compiled Script Bytecodes:
    • Custom object-oriented virtual machines executing compiled script logic, handling gameplay rules, AI state transitions, and quest logic.

REA lacks native parsers to unpack these resource archives, deserialize CR2W chunk graphs, and map modern RTTI reflection tables.

Proposed Architecture

flowchart TD
    A["Resource File (.w2ent, .w2scene, .ent) / Archive (.bundle, .archive)"] --> B["CR2W & RED4 Semantic Engine"]
    B --> C["Archive Container Unpacker"]
    B --> D["CR2W Chunk & Property Deserializer"]
    B --> E["RED4 RTTI & Modern Resource Parser"]
    
    C --> C1[".bundle / .archive Header & File Index Traversal"]
    C --> C2["Decompression (Snappy / Oodle / Zlib)"]
    
    D --> D1["CR2W Header, String Table & Import/Export Tables"]
    D --> D2["Chunk Tree & Typed Property Traversal"]
    
    E --> E1["RTTI Class Deserialization (64-bit FNV-1a Hashes)"]
    E --> E2["Compiled Script Bytecode Disassembly"]
    E --> E3["Cinematic Scene Flow & Entity Appearance Trees"]
    
    C & D & E --> F["Synthesized Entity Component Graph, Dialogue Flowchart & Asset Manifest"]

Technical Capabilities & Modules

  1. Archive Ingestion & Unpacking:

    • Parse .bundle and modern .archive container formats.
    • Resolve 64-bit hash filenames against community or generated hashlists.
    • Decompress resource streams using Snappy, Zlib, and Oodle algorithms.
  2. CR2W Format Deserialization:

    • Parse CR2W file header: string tables, name tables, import references, and exported chunk descriptors.
    • Reconstruct parent-child chunk trees: instantiate typed properties (arrays, structs, pointers, soft-references).
    • Support specific resource types: .w2ent (entity components), .w2scene (dialogue trees, camera tracks, gesture cues).
  3. RED4 Modern Resource & RTTI Analysis:

    • Parse modern .ent, .app, and .streamingsector files.
    • Map 64-bit FNV-1a hashes to engine class names, property names, and enum values.
    • Reconstruct entity appearance definitions and component attachment graphs.
  4. Script Bytecode Disassembly:

    • Disassemble compiled script bytecodes into structured instructions (assignments, member function calls, control flow jumps, event callbacks).
    • Map parameters, local variables, and return types.
  5. Cinematic Scene & Dialogue Reconstruction:

    • Parse dialogue and cinematic scene files (.w2scene / .scene).
    • Extract dialogue text strings, speaker voice identifiers, choices, conditions, and branch targets into an interactive flowchart.

Acceptance Criteria

  • Unpacking and extraction of assets from .bundle and .archive containers.
  • Complete deserialization of CR2W files into human-readable JSON property trees.
  • RTTI hash resolution and typing for modern RED4 resources.
  • Disassembly of compiled script bytecodes into readable instructions.
  • Reconstruction of branching dialogue and cinematic scene flowcharts.
  • Complements #3621 (Unknown binary file-format inference)
  • Complements #3624 (Native C++ semantic reconstruction: RTTI, vtables)
  • Complements #3698 (Interactive entertainment runtime and asset reverse engineering tracker)
Originally created by @matbrgz on GitHub (Oct 14, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/3711 [![Type: Feature](https://img.shields.io/badge/type-feature-blue.svg?style=flat-square)](https://github.com/morluto/rea) [![Domain: Game & Engine RE](https://img.shields.io/badge/domain-game_&_engine_RE-green.svg?style=flat-square)](https://github.com/morluto/rea) [![Status: Proposed](https://img.shields.io/badge/status-proposed-blue.svg?style=flat-square)](https://github.com/morluto/rea) [![Ecosystem: REA](https://img.shields.io/badge/ecosystem-morluto%2Frea-8A2BE2.svg?style=flat-square)](https://github.com/morluto/rea) ### Problem Statement & Context High-fidelity open-world cinematic action RPG engines utilize custom binary resource serializations across two major architectural generations: 1. **CR2W Binary Format (Core Resource 2 Wrapper)**: - File signature `CR2W` (magic `0x57325243`), engine version flags, and file header tables: Strings table, Names table, Imports table (external resource paths), Properties table, and Export chunk tables. - Used across `.w2mesh` (meshes), `.w2ent` (entities), `.w2scene` (dialogue & cinematic scenes), `.w2anims` (animations), and `.env` (world environment parameters). 2. **Modern RED4 Resource Architecture**: - Upgraded resource framework utilized in modern futuristic titles: `.redscript` compiled bytecode, `.ink` UI layouts, `.ent` entity definitions, `.app` appearances, and `.streamingsector` world streaming chunks. - Run-Time Type Information (RTTI) reflection system with 64-bit FNV-1a hashed class, property, and function names. 3. **Archive Storage Packages (`.bundle` / `.archive`)**: - Multi-part resource packages packing compressed CR2W/RED4 resources with Snappy, Oodle, or Zlib compression and CRC/FNV path indexing. 4. **Compiled Script Bytecodes**: - Custom object-oriented virtual machines executing compiled script logic, handling gameplay rules, AI state transitions, and quest logic. REA lacks native parsers to unpack these resource archives, deserialize CR2W chunk graphs, and map modern RTTI reflection tables. ### Proposed Architecture ```mermaid flowchart TD A["Resource File (.w2ent, .w2scene, .ent) / Archive (.bundle, .archive)"] --> B["CR2W & RED4 Semantic Engine"] B --> C["Archive Container Unpacker"] B --> D["CR2W Chunk & Property Deserializer"] B --> E["RED4 RTTI & Modern Resource Parser"] C --> C1[".bundle / .archive Header & File Index Traversal"] C --> C2["Decompression (Snappy / Oodle / Zlib)"] D --> D1["CR2W Header, String Table & Import/Export Tables"] D --> D2["Chunk Tree & Typed Property Traversal"] E --> E1["RTTI Class Deserialization (64-bit FNV-1a Hashes)"] E --> E2["Compiled Script Bytecode Disassembly"] E --> E3["Cinematic Scene Flow & Entity Appearance Trees"] C & D & E --> F["Synthesized Entity Component Graph, Dialogue Flowchart & Asset Manifest"] ``` ### Technical Capabilities & Modules 1. **Archive Ingestion & Unpacking:** - Parse `.bundle` and modern `.archive` container formats. - Resolve 64-bit hash filenames against community or generated hashlists. - Decompress resource streams using Snappy, Zlib, and Oodle algorithms. 2. **CR2W Format Deserialization:** - Parse CR2W file header: string tables, name tables, import references, and exported chunk descriptors. - Reconstruct parent-child chunk trees: instantiate typed properties (arrays, structs, pointers, soft-references). - Support specific resource types: `.w2ent` (entity components), `.w2scene` (dialogue trees, camera tracks, gesture cues). 3. **RED4 Modern Resource & RTTI Analysis:** - Parse modern `.ent`, `.app`, and `.streamingsector` files. - Map 64-bit FNV-1a hashes to engine class names, property names, and enum values. - Reconstruct entity appearance definitions and component attachment graphs. 4. **Script Bytecode Disassembly:** - Disassemble compiled script bytecodes into structured instructions (assignments, member function calls, control flow jumps, event callbacks). - Map parameters, local variables, and return types. 5. **Cinematic Scene & Dialogue Reconstruction:** - Parse dialogue and cinematic scene files (`.w2scene` / `.scene`). - Extract dialogue text strings, speaker voice identifiers, choices, conditions, and branch targets into an interactive flowchart. ### Acceptance Criteria - [ ] Unpacking and extraction of assets from `.bundle` and `.archive` containers. - [ ] Complete deserialization of CR2W files into human-readable JSON property trees. - [ ] RTTI hash resolution and typing for modern RED4 resources. - [ ] Disassembly of compiled script bytecodes into readable instructions. - [ ] Reconstruction of branching dialogue and cinematic scene flowcharts. ### Related Issues & Dependencies - Complements #3621 (Unknown binary file-format inference) - Complements #3624 (Native C++ semantic reconstruction: RTTI, vtables) - Complements #3698 (Interactive entertainment runtime and asset reverse engineering tracker)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#1421
No description provided.