Skip to main content

Archive

Struct Archive 

Source
pub struct Archive {
    pub user_packs: usize,
    /* private fields */
}
Expand description

A set of packages resolved by priority: higher priority shadows lower for the same name.

Fields§

§user_packs: usize

IO::FileSystem: the user pack files (enabled mods) the packages were set up with (AddUserPackFile, AreUserPackFilesEnabled).

Implementations§

Source§

impl Archive

Source

pub fn add(&mut self, pkg: Package)

Add one of the game’s packages. An entry replaces one of the same name when its package’s priority is not lower.

Source

pub fn add_mod(&mut self, pkg: Package)

FileSystem::LoadPackages for a mod (.pkm), added after the game’s packages: the enabled mods go in from the last in the mod list to the first, and a file replaces one already there only when that one’s package allows it. So the first mod in the list wins, and nothing overrides data1 or patch1.

Original: Runtime 0x1800ac3b0.

Source

pub fn package_count(&self) -> usize

How many packages are loaded (the game’s first, then the mods).

Source

pub fn remove_after(&mut self, keep: usize)

Drop every package after the first keep (the mods), as FileSystem::ClosePackages before the packages load again.

Source

pub fn package_of(&self, name: &str) -> Option<&Package>

The package holding name’s current entry (its header names the mod).

Source

pub fn len(&self) -> usize

The number of entries.

Source

pub fn is_empty(&self) -> bool

Whether there are no entries.

Source

pub fn names(&self) -> Vec<&str>

Resource names, sorted.

Source

pub fn get(&self, name: &str) -> Option<&Entry>

An entry by name.

Source

pub fn read(&self, name: &str) -> Result<Vec<u8>>

An entry’s bytes, expanded, by entry name (for example Dialog\Toolbar_resource.crs).

Source

pub fn read_ref(&self, reference: &str) -> Result<Vec<u8>>

Read the compiled resource behind a reference such as Models\X\Y.rsc:resource. The package stores it as Models\X\Y_resource.crs.

Trait Implementations§

Source§

impl Default for Archive

Source§

fn default() -> Archive

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.