mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-26 22:27:44 +00:00
Add support for writing fiin files
This commit is contained in:
parent
bbbbb7cd02
commit
9b1927f700
1 changed files with 12 additions and 1 deletions
13
src/fiin.rs
13
src/fiin.rs
|
@ -4,7 +4,7 @@
|
|||
use std::fs::read;
|
||||
use std::io::Cursor;
|
||||
|
||||
use binrw::BinRead;
|
||||
use binrw::{BinRead, BinWrite};
|
||||
use binrw::binrw;
|
||||
|
||||
use crate::gamedata::MemoryBuffer;
|
||||
|
@ -52,6 +52,17 @@ impl FileInfo {
|
|||
FileInfo::read(&mut cursor).ok()
|
||||
}
|
||||
|
||||
pub fn write_to_buffer(&self) -> Option<MemoryBuffer> {
|
||||
let mut buffer = MemoryBuffer::new();
|
||||
|
||||
{
|
||||
let mut cursor = Cursor::new(&mut buffer);
|
||||
self.write(&mut cursor).ok()?;
|
||||
}
|
||||
|
||||
Some(buffer)
|
||||
}
|
||||
|
||||
/// Creates a new FileInfo structure from a list of filenames. These filenames must be present in
|
||||
/// the current working directory in order to be read properly, since it also generates SHA1
|
||||
/// hashes.
|
||||
|
|
Loading…
Add table
Reference in a new issue