mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-25 13:57:45 +00:00
Improve FIIN documentation
This commit is contained in:
parent
7b739f655b
commit
609284ce8f
2 changed files with 8 additions and 1 deletions
|
@ -14,6 +14,7 @@ use crate::sha1::Sha1;
|
||||||
#[brw(magic = b"FileInfo")]
|
#[brw(magic = b"FileInfo")]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
#[brw(little)]
|
#[brw(little)]
|
||||||
|
/// File info, which contains SHA1 of one or more files
|
||||||
pub struct FileInfo {
|
pub struct FileInfo {
|
||||||
#[brw(pad_before = 16)]
|
#[brw(pad_before = 16)]
|
||||||
#[bw(calc = 1024)]
|
#[bw(calc = 1024)]
|
||||||
|
@ -25,14 +26,18 @@ pub struct FileInfo {
|
||||||
|
|
||||||
#[brw(pad_before = 992)]
|
#[brw(pad_before = 992)]
|
||||||
#[br(count = entries_size / 96)]
|
#[br(count = entries_size / 96)]
|
||||||
|
/// File info entries
|
||||||
pub entries: Vec<FIINEntry>,
|
pub entries: Vec<FIINEntry>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
/// A file info entry
|
||||||
pub struct FIINEntry {
|
pub struct FIINEntry {
|
||||||
|
/// File size (in bytes)
|
||||||
pub file_size: i32,
|
pub file_size: i32,
|
||||||
|
|
||||||
|
/// The file name
|
||||||
#[brw(pad_before = 4)]
|
#[brw(pad_before = 4)]
|
||||||
#[br(count = 64)]
|
#[br(count = 64)]
|
||||||
#[bw(pad_size_to = 64)]
|
#[bw(pad_size_to = 64)]
|
||||||
|
@ -40,6 +45,7 @@ pub struct FIINEntry {
|
||||||
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
|
#[br(map = | x: Vec<u8> | String::from_utf8(x).unwrap().trim_matches(char::from(0)).to_string())]
|
||||||
pub file_name: String,
|
pub file_name: String,
|
||||||
|
|
||||||
|
/// SHA1 of the file
|
||||||
#[br(count = 24)]
|
#[br(count = 24)]
|
||||||
#[bw(pad_size_to = 24)]
|
#[bw(pad_size_to = 24)]
|
||||||
pub sha1: Vec<u8>,
|
pub sha1: Vec<u8>,
|
||||||
|
@ -52,6 +58,7 @@ impl FileInfo {
|
||||||
FileInfo::read(&mut cursor).ok()
|
FileInfo::read(&mut cursor).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Writes file info into a new file
|
||||||
pub fn write_to_buffer(&self) -> Option<ByteBuffer> {
|
pub fn write_to_buffer(&self) -> Option<ByteBuffer> {
|
||||||
let mut buffer = ByteBuffer::new();
|
let mut buffer = ByteBuffer::new();
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub mod exd;
|
||||||
#[cfg(feature = "visual_data")]
|
#[cfg(feature = "visual_data")]
|
||||||
pub mod skeleton;
|
pub mod skeleton;
|
||||||
|
|
||||||
/// Reading file into files (FIIN).
|
/// Reading file info files (FIIN).
|
||||||
pub mod fiin;
|
pub mod fiin;
|
||||||
|
|
||||||
/// Reading and writing chat logs (LOG).
|
/// Reading and writing chat logs (LOG).
|
||||||
|
|
Loading…
Add table
Reference in a new issue