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) -> GameData
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");
Sourcepub fn exists(&mut self, path: &str) -> bool
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!");
}
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.