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
impl GameData
sourcepub fn from_existing(platform: Platform, directory: &str) -> Option<GameData>
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");
sourcepub fn extract(&mut self, path: &str) -> Option<ByteBuffer>
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();
sourcepub fn find_offset(&mut self, path: &str) -> Option<u64>
pub fn find_offset(&mut self, path: &str) -> Option<u64>
Finds the offset inside of the DAT file for path
.
sourcepub fn read_excel_sheet_header(&mut self, name: &str) -> Option<EXH>
pub fn read_excel_sheet_header(&mut self, name: &str) -> Option<EXH>
Read an excel sheet by name (e.g. “Achievement”)
sourcepub fn get_all_sheet_names(&mut self) -> Option<Vec<String>>
pub fn get_all_sheet_names(&mut self) -> Option<Vec<String>>
Returns all known sheet names listed in the root list
sourcepub fn read_excel_sheet(
&mut self,
name: &str,
exh: &EXH,
language: Language,
page: usize,
) -> Option<EXD>
pub fn read_excel_sheet( &mut self, name: &str, exh: &EXH, language: Language, page: usize, ) -> Option<EXD>
Read an excel sheet
sourcepub fn apply_patch(&self, patch_path: &str) -> Result<(), PatchError>
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.
sourcepub fn needs_repair(&self) -> Option<Vec<(&Repository, RepairAction)>>
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.
sourcepub fn perform_repair<'a>(
&self,
repositories: &Vec<(&'a Repository, RepairAction)>,
) -> Result<(), RepairError<'a>>
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.