Skip to main content

Module resource

Module resource 

Source
Expand description

Resource lookup (helpers/ResourceReader.py:10-38).

get_resource_data(res_path, ...) tries four CAB names, in order: basename, name + ".resource", name + ".assets.resS", name + ".resS", where basename = ntpath.basename(res_path) and name is ntpath.splitext(basename)[0]. On a miss it loads the file’s externals and the four candidates as dependencies, then tries again, and raises FileNotFoundError when all four still miss. The bytes are reader.read_bytes(size) from offset.

Memory. res_path is an object’s string (m_StreamData.path, m_Resource.m_Source), a slice of its file as long as the object’s bytes allow. resource_candidates copies nothing: each Candidate is a slice of the path and a static suffix. A lookup that needs the whole name (the registry’s lowered key, a resolver’s argument) builds it with Candidate::joined_vec, charged to the asking file’s meter while it lives, one candidate at a time.

Owner: package D (Candidate and its methods: the scaffold).

Structs§

Candidate
One candidate name: a slice of the resource path followed by a suffix, built in a charged vector when a lookup needs it whole (Self::joined_vec).

Constants§

SUFFIXES
The suffixes of the four candidates, in UnityPy’s order.

Functions§

resource_candidates
The four candidates, in UnityPy’s order, each a slice of res_path and a suffix (module docs): nothing is copied.