cp2077_extractor.cr2w.header_structs

Classes to represent header data in CR2W/W2RC files.

Classes:

CR2WBufferInfo(flags, index, offset, ...)

Metadata about a buffer in a CR2W/W2RC file.

CR2WEmbeddedInfo(import_index, chunk_index, ...)

CR2WEmbeddedInfo(import_index, chunk_index, path_hash)

CR2WExportInfo(class_name, object_flags, ...)

CR2WExportInfo(class_name, object_flags, parent_id, data_size, data_offset, template, crc32)

CR2WFile(info, metadata, properties, ...)

Represents a read and parsed CR2W/W2RC file.

CR2WFileHeader(version, flags, time_stamp, ...)

Represents the header of a CR2W/W2RC file.

CR2WFileInfo(file_header, string_dict, ...)

Data about the file structure of a CR2W/W2RC file.

CR2WImport(depot_path, class_name, flags)

CR2WImport(depot_path, class_name, flags)

CR2WImportInfo(offset, class_name, flags)

CR2WImportInfo(offset, class_name, flags)

CR2WMetadata(file_name, hash_version, ...[, ...])

Metadata about the CR2W/W2RC file.

CR2WNameInfo(offset, hash)

Metatada about a name in the name lookup table of a CR2W/W2RC file.

CR2WPropertyInfo(class_name, class_flags, ...)

CR2WPropertyInfo(class_name, class_flags, property_name, property_flags, hash)

CR2WTable(offset, item_count, crc32)

A table holds various data about the structure of the CR2W/W2RC file, such as CR2WNameInfo or CR2WBufferInfo.

Struct

Protocol for a NamedTuple representing structured binary data in a file.

namedtuple CR2WBufferInfo(flags, index, offset, disk_size, mem_size, crc32)[source]

Bases: NamedTuple

Metadata about a buffer in a CR2W/W2RC file.

Fields
  1.  flags (int) – Alias for field number 0

  2.  index (int) – Alias for field number 1

  3.  offset (int) – offset inside a cr2w file, buffers are compressed and appended to a cr2w file

  4.  disk_size (int) – This is the compressed size of the buffer; it’s called disksize because buffers are compressed and appended to a cr2w file

  5.  mem_size (int) – This is the uncompressed size of the buffer; it’s called memSize because buffers are uncompressed at runtime in the game

  6.  crc32 (int) – crc32 over the compressed buffer

__repr__()

Return a nicely formatted representation string

namedtuple CR2WEmbeddedInfo(import_index, chunk_index, path_hash)[source]

Bases: NamedTuple

CR2WEmbeddedInfo(import_index, chunk_index, path_hash)

Fields
  1.  import_index (int) – Alias for field number 0

  2.  chunk_index (int) – Alias for field number 1

  3.  path_hash (int) – Alias for field number 2

__repr__()

Return a nicely formatted representation string

namedtuple CR2WExportInfo(class_name, object_flags, parent_id, data_size, data_offset, template, crc32)[source]

Bases: NamedTuple

CR2WExportInfo(class_name, object_flags, parent_id, data_size, data_offset, template, crc32)

Fields
  1.  class_name (int) – Alias for field number 0

  2.  object_flags (int) – Alias for field number 1

  3.  parent_id (int) – Alias for field number 2

  4.  data_size (int) – Alias for field number 3

  5.  data_offset (int) – Alias for field number 4

  6.  template (int) – Alias for field number 5

  7.  crc32 (int) – Alias for field number 6

__repr__()

Return a nicely formatted representation string

namedtuple CR2WFile(info, metadata, properties, root_chunk, embedded_files)[source]

Bases: NamedTuple

Represents a read and parsed CR2W/W2RC file.

Fields
  1.  info (CR2WFileInfo) – Alias for field number 0

  2.  metadata (CR2WMetadata) – Alias for field number 1

  3.  properties (list[CR2WProperty]) – Alias for field number 2

  4.  root_chunk (Chunk) – Alias for field number 3

  5.  embedded_files (list[Any]) – Alias for field number 4

__repr__()

Return a nicely formatted representation string

namedtuple CR2WFileHeader(version, flags, time_stamp, build_version, objects_end, buffers_end, crc32, num_chunks)[source]

Bases: NamedTuple

Represents the header of a CR2W/W2RC file.

Fields
  1.  version (int) – Alias for field number 0

  2.  flags (int) – Alias for field number 1

  3.  time_stamp (int) – Alias for field number 2

  4.  build_version (int) – Alias for field number 3

  5.  objects_end (int) – Alias for field number 4

  6.  buffers_end (int) – Alias for field number 5

  7.  crc32 (int) – Alias for field number 6

  8.  num_chunks (int) – Alias for field number 7

__repr__()

Return a nicely formatted representation string

namedtuple CR2WFileInfo(file_header, string_dict, name_info, import_info, property_info, export_info, buffer_info, embedded_info, imports)[source]

Bases: NamedTuple

Data about the file structure of a CR2W/W2RC file.

Fields
  1.  file_header (CR2WFileHeader) – Alias for field number 0

  2.  string_dict (dict[int, bytes]) – Alias for field number 1

  3.  name_info (list[CR2WNameInfo]) – Alias for field number 2

  4.  import_info (list[CR2WImportInfo]) – Alias for field number 3

  5.  property_info (list[CR2WPropertyInfo]) – Alias for field number 4

  6.  export_info (list[CR2WExportInfo]) – Alias for field number 5

  7.  buffer_info (list[CR2WBufferInfo]) – Alias for field number 6

  8.  embedded_info (list[CR2WEmbeddedInfo]) – Alias for field number 7

  9.  imports (list[CR2WImport]) – Alias for field number 8

__repr__()

Return a nicely formatted representation string

namedtuple CR2WImport(depot_path, class_name, flags)[source]

Bases: NamedTuple

CR2WImport(depot_path, class_name, flags)

Fields
  1.  depot_path (bytes) – Alias for field number 0

  2.  class_name (bytes) – Alias for field number 1

  3.  flags (int) – Alias for field number 2

__repr__()

Return a nicely formatted representation string

namedtuple CR2WImportInfo(offset, class_name, flags)[source]

Bases: NamedTuple

CR2WImportInfo(offset, class_name, flags)

Fields
  1.  offset (int) – Alias for field number 0

  2.  class_name (int) – Alias for field number 1

  3.  flags (int) – Alias for field number 2

__repr__()

Return a nicely formatted representation string

namedtuple CR2WMetadata(file_name, hash_version, objects_end, version=195, build_version=0)[source]

Bases: NamedTuple

Metadata about the CR2W/W2RC file.

Fields
  1.  file_name (Optional[str]) – Alias for field number 0

  2.  hash_version (Any) – Alias for field number 1

  3.  objects_end (int) – Alias for field number 2

  4.  version (int) – Alias for field number 3

  5.  build_version (int) – Alias for field number 4

__repr__()

Return a nicely formatted representation string

namedtuple CR2WNameInfo(offset, hash)[source]

Bases: NamedTuple

Metatada about a name in the name lookup table of a CR2W/W2RC file.

Fields
  1.  offset (int) – Alias for field number 0

  2.  hash (int) – Alias for field number 1

__repr__()

Return a nicely formatted representation string

namedtuple CR2WPropertyInfo(class_name, class_flags, property_name, property_flags, hash)[source]

Bases: NamedTuple

CR2WPropertyInfo(class_name, class_flags, property_name, property_flags, hash)

Fields
  1.  class_name (int) – Alias for field number 0

  2.  class_flags (int) – Alias for field number 1

  3.  property_name (int) – Alias for field number 2

  4.  property_flags (int) – Alias for field number 3

  5.  hash (int) – Alias for field number 4

__repr__()

Return a nicely formatted representation string

namedtuple CR2WTable(offset, item_count, crc32)[source]

Bases: NamedTuple

A table holds various data about the structure of the CR2W/W2RC file, such as CR2WNameInfo or CR2WBufferInfo.

Fields
  1.  offset (int) – Alias for field number 0

  2.  item_count (int) – Alias for field number 1

  3.  crc32 (int) – Alias for field number 2

__repr__()

Return a nicely formatted representation string

protocol Struct[source]

Bases: Protocol

Protocol for a NamedTuple representing structured binary data in a file.

Classes that implement this protocol must have the following methods / attributes: