parent
a81c28c479
commit
761662e76f
@ -0,0 +1,35 @@
|
||||
use crate::parsers::bnd;
|
||||
use crate::unpackers::errors::{self as unpackers_errors, UnpackError};
|
||||
|
||||
/// Extract BND file contents to disk.
|
||||
///
|
||||
/// Wraps around `extract_bnd` to load the BND from disk.
|
||||
pub fn extract_bnd_file(bnd_path: &str, output_path: &str) -> Result<(), UnpackError> {
|
||||
let bnd = load_bnd_file(bnd_path)?;
|
||||
extract_bnd(bnd, output_path)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Extract BND contents to disk.
|
||||
pub fn extract_bnd(bnd: bnd::Bnd, output_path: &str) -> Result<(), UnpackError> {
|
||||
//TODO
|
||||
//let mut output_file = fs::File::create(output_path)?;
|
||||
//output_file.write_all(&decomp_data)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Load a BND file from disk.
|
||||
///
|
||||
/// Wraps around `load_bnd` to load the BND from disk.
|
||||
pub fn load_bnd_file(bnd_path: &str) -> Result<bnd::Bnd, UnpackError> {
|
||||
let mut bnd_file = fs::File::open(bnd_path)?;
|
||||
let file_len = bnd_file.metadata()?.len() as usize;
|
||||
let mut bnd_data = vec![0u8; file_len];
|
||||
bnd_file.read_exact(&mut bnd_data)?;
|
||||
load_bnd(&bnd_data)
|
||||
}
|
||||
|
||||
/// Load a BND file from a bytes slice.
|
||||
pub fn load_bnd(bnd_data: &[u8]) -> Result<bnd::Bnd, UnpackError> {
|
||||
Ok(())
|
||||
}
|
Loading…
Reference in new issue