Struct physis::gamedata::GameData

source ·
pub struct GameData {
    pub game_directory: String,
    pub repositories: Vec<Repository>,
    /* private fields */
}
Expand description

Framework for operating on game data.

Fields§

§game_directory: String

The game directory to operate on.

§repositories: Vec<Repository>

Repositories in the game directory.

Implementations§

source§

impl GameData

source

pub fn from_existing(platform: Platform, directory: &str) -> Option<GameData>

Read game data from an existing game installation.

This will return None if the game directory is not valid, but it does not check the validity of each individual file.

§Example
use physis::gamedata::GameData;
GameData::from_existing(Platform::Win32, "$FFXIV/game");
source

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

Checks if a file located at path exists.

§Example
use physis::gamedata::GameData;
if game.exists("exd/cid.exl") {
    println!("Cid really does exist!");
} else {
    println!("Oh noes!");
}
source

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

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

§Example
use physis::common::Platform;
let data = game.extract("exd/root.exl").unwrap();

let mut file = std::fs::File::create("root.exl").unwrap();
file.write(data.as_slice()).unwrap();
source

pub fn read_excel_sheet_header(&mut self, name: &str) -> Option<EXH>

Read an excel sheet by name (e.g. “Achievement”)

source

pub fn get_all_sheet_names(&mut self) -> Option<Vec<String>>

Returns all known sheet names listed in the root list

source

pub fn read_excel_sheet( &mut self, name: &str, exh: &EXH, language: Language, page: usize ) -> Option<EXD>

Read an excel sheet

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.

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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>,

§

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>,

§

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more