Skip to main content

Source

Struct Source 

Source
pub struct Source<'a> {
    pub folder: &'a Folder,
    pub base: Option<&'a Folder>,
    pub oodle: Option<&'a Oodle>,
}
Expand description

A Patch folder with the game’s data behind it: files a Patch TOC places in the base game are read there, and CAS payloads are decoded with the game’s own Oodle when they use it.

Fields§

§folder: &'a Folder

The folder to read, which holds the TOCs asked about.

§base: Option<&'a Folder>

The game’s own Data folder, where folder is a Patch folder.

§oodle: Option<&'a Oodle>

The game’s Oodle library, for payloads that use it.

Implementations§

Source§

impl Source<'_>

Source

pub fn raw(&self, f: FileRef) -> Result<Vec<u8>>

The stored bytes of a file a bundle region points at, from the folder or the base game.

Source

pub fn merged_toc(&self, rel: &str) -> Result<Toc>

The superbundle TOC at rel (relative to the folder, as in Folder::tocs) as the game sees it: the folder’s TOC merged with the base game’s TOC of the same path (toc::merge) when its flags say the base holds bundles or chunks it lacks, else the folder’s TOC as it is. A flagged TOC the base game has no TOC for (a superbundle the folder adds: 30 of the 199 flagged TOCs of the installed mods) stands alone. An error when the TOC is flagged and the source has no base game folder.

Source

pub fn payload(&self, f: FileRef, expected: usize) -> Result<Vec<u8>>

A CAS-framed file decoded to exactly expected bytes.

Source

pub fn manifest( &self, files: &[FileRef], inline: &[u8], ) -> Result<Option<(Manifest, usize, Vec<u8>)>>

The bundle’s manifest and the index of its first asset file, read the way ReSkate’s merge reads it: inline in the region (its assets then no more than the region’s files), else the region file that is a manifest (raw or CAS-framed) whose asset count matches.

Source

pub fn ebx(&self, toc: &str, name: &str) -> Result<(String, Document)>

The EBX document named name (ASCII case-insensitive, as bundle manifests name them: characters/.../x) in the first bundle of the TOC at toc (relative to the folder, as in Folder::tocs) that holds it, read; with the bundle’s name. An error when no bundle of that TOC holds it.

Source

pub fn ebx_index( &self, toc: &str, bundle_name: &str, ) -> Result<BTreeMap<[u8; 16], EbxEntry>>

Every EBX document of the bundle named bundle_name in the TOC at toc, by its file GUID: its name and where it lies (read it with Source::read_ebx). Each document’s payload is read for its GUID, not parsed.

Source

pub fn resource( &self, toc: &str, bundle_name: &str, rid: u64, ) -> Result<Resource>

The resource with id rid of the bundle named bundle_name in the TOC at toc.

Source

pub fn read_ebx(&self, entry: &EbxEntry) -> Result<Document>

The EBX document at entry, read.

Source§

impl Source<'_>

Source

pub fn bundle_names(&self, toc: &str) -> Result<Vec<String>>

The bundles of the TOC at toc (relative to the data folder), by name, in stored order. Reads the TOC only.

Source

pub fn bundle(&self, toc: &str, name: &str) -> Result<Bundle>

The bundle named name (ASCII case-insensitive) of the TOC at toc.

Source

pub fn listing(&self, toc: &str) -> Result<Listing>

Every bundle of the TOC at toc, opened (the TOC is read once, each manifest once).

Source

pub fn ebx_type(&self, entry: &Listed) -> Result<String>

The type name of EBX document entry’s first instance. Decodes the document: its cost is the document’s.

Trait Implementations§

Source§

impl<'a> Debug for Source<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Source<'a>

§

impl<'a> RefUnwindSafe for Source<'a>

§

impl<'a> Send for Source<'a>

§

impl<'a> Sync for Source<'a>

§

impl<'a> Unpin for Source<'a>

§

impl<'a> UnsafeUnpin for Source<'a>

§

impl<'a> UnwindSafe for Source<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.