Struct SqPackResource

Source
pub struct SqPackResource {
    pub game_directory: String,
    pub repositories: Vec<Repository>,
    /* private fields */
}
Expand description

Used to read files from the retail game, in their SqPack-compressed format.

Fields§

§game_directory: String

The game directory to operate on.

§repositories: Vec<Repository>

Repositories in the game directory.

Implementations§

Source§

impl SqPackResource

Source

pub fn from_existing(platform: Platform, directory: &str) -> Self

Source

pub fn find_offset(&mut self, path: &str) -> Option<u64>

Finds the offset inside of the DAT file for path.

Source

pub fn apply_patch(&self, patch_path: &str) -> Result<(), PatchError>

Applies the patch to game data and returns any errors it encounters. This function will not update the version in the GameData struct.

Source

pub fn needs_repair(&self) -> Option<Vec<(&Repository, RepairAction)>>

Detects whether or not the game files need a repair, right now it only checks for invalid version files. If the repair is needed, a list of invalid repositories is given.

Source

pub fn perform_repair<'a>( &self, repositories: &Vec<(&'a Repository, RepairAction)>, ) -> Result<(), RepairError<'a>>

Performs the repair, assuming any damaging effects it may have Returns true only if all actions were taken are successful. NOTE: This is a destructive operation, especially for InvalidVersion errors.

Trait Implementations§

Source§

impl Resource for SqPackResource

Source§

fn read(&mut self, path: &str) -> Option<ByteBuffer>

Reads the file located at path. This is returned as an in-memory buffer, and will usually have to be further parsed. Read more
Source§

fn exists(&mut self, path: &str) -> bool

Checks if a file exists While you could abuse read to do this, in some Resources they can optimize this since it doesn’t read data. 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.