Struct 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) -> GameData

Read game data from an existing game installation.

This will return a GameData even if the game directory is technically invalid, but it won’t have any repositories.

§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 find_offset(&mut self, path: &str) -> Option<u64>

Finds the offset inside of the DAT file for path.

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

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

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