mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Add find_offset function
Currently working around the lack of a good extract() API
This commit is contained in:
parent
c1fb2c5fa7
commit
fdf07fd255
1 changed files with 11 additions and 0 deletions
|
@ -193,6 +193,17 @@ impl GameData {
|
|||
}
|
||||
}
|
||||
|
||||
/// Finds the offset inside of the DAT file for `path`.
|
||||
pub fn find_offset(&mut self, path: &str) -> Option<u32> {
|
||||
let slice = self.find_entry(path);
|
||||
match slice {
|
||||
Some((entry, chunk)) => {
|
||||
Some(entry.offset)
|
||||
}
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
||||
/// Parses a path structure and spits out the corresponding category and repository.
|
||||
fn parse_repository_category(&self, path: &str) -> Option<(&Repository, Category)> {
|
||||
let tokens: Vec<&str> = path.split('/').collect(); // TODO: use split_once here
|
||||
|
|
Loading…
Add table
Reference in a new issue