cp2077_extractor.redarchive_reader
Partial parser for REDEngine .archive files.
Classes:
|
Represents a FileList in a |
|
Represents a FileRecord in a |
|
Represents a FileSegment in a |
|
Represents a REDEngine |
-
class
FileList(file_table_offset, file_table_size, crc, file_entry_count, file_segment_count, resource_dep_count, file_records, file_segments, resource_dependencies)[source] Bases:
objectRepresents a FileList in a
.archivefile.Methods:
__eq__(other)Return self==value.
__repr__()Return repr(self).
find_filename(filename)Find the record for the given filename, relative to the root of the archive (usually starting
base).get_segments(file)Returns the segments for the given file.
Attributes:
Checksum of ???
Number of files
Number of file segments
Always 8
Number of resource dependencies
-
__eq__(other) Return self==value.
-
__repr__() Return repr(self).
-
find_filename(filename)[source] Find the record for the given filename, relative to the root of the archive (usually starting
base).- Parameters
filename (
str)- Return type
-
get_segments(file)[source] Returns the segments for the given file.
- Parameters
file (
FileRecord)- Return type
-
-
class
FileRecord(name_hash, timestamp, num_inline_buffer_segs, segs_start, segs_end, res_deps_start, res_deps_end, sha1_hash)[source] Bases:
objectRepresents a FileRecord in a
.archivefile.Methods:
__eq__(other)Return self==value.
__repr__()Return repr(self).
Attributes:
FNV1A64 hash of the filename
Number of inline buffers
Index of the last resource dependency
Index of the first resource dependency
Index of the last file segment
Index of the first file segment
SHA1 hash of the file # TODO: compressed files?
Windows filetime of file creation
-
__eq__(other) Return self==value.
-
__repr__() Return repr(self).
-
-
class
FileSegment(offset, zsize, size)[source] Bases:
objectRepresents a FileSegment in a
.archivefile.Methods:
__eq__(other)Return self==value.
__repr__()Return repr(self).
Attributes:
Offset of the data
Size of uncompressed data
Size of compressed data
-
__eq__(other) Return self==value.
-
__repr__() Return repr(self).
-
-
class
REDArchive(magic, version, index_pos, index_size, debug_pos, debug_size, filesize, custom_data_length, file_list)[source] Bases:
objectRepresents a REDEngine
.archivefile.Methods:
__eq__(other)Return self==value.
__repr__()Return repr(self).
extract_file(fp, file)Extract a file from the archive.
load_archive(archive_file)Load metadata for an
.archivefile.Attributes:
Files created with WolvenKit only
Always 0
Always 0
Size of file (excluding Filesize)
Offset of beginning of file list
Size of file list
Constant: "RDAR"
Currently 12
-
__eq__(other) Return self==value.
-
__repr__() Return repr(self).
-
extract_file(fp, file)[source] Extract a file from the archive.
- Parameters
fp (
IO) – File handle for the opened archive.file (
FileRecord) – The file to extract.
- Return type
-