mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-21 12:17:45 +00:00
Re-add support for FDHR version 2, used for boot patches still
This commit is contained in:
parent
c4549a413f
commit
70a92594a2
1 changed files with 22 additions and 29 deletions
49
src/patch.rs
49
src/patch.rs
|
@ -19,7 +19,10 @@ struct PatchChunk {
|
||||||
|
|
||||||
#[derive(BinRead, PartialEq, Debug)]
|
#[derive(BinRead, PartialEq, Debug)]
|
||||||
enum ChunkType {
|
enum ChunkType {
|
||||||
#[br(magic = b"FHDR")] FileHeader(FileHeaderChunk),
|
#[br(magic = b"FHDR")] FileHeader(
|
||||||
|
#[br(pad_before = 2)]
|
||||||
|
#[br(pad_after = 1)]
|
||||||
|
FileHeaderChunk),
|
||||||
#[br(magic = b"APLY")] ApplyOption(ApplyOptionChunk),
|
#[br(magic = b"APLY")] ApplyOption(ApplyOptionChunk),
|
||||||
#[br(magic = b"ADIR")] AddDirectory(AddDirectoryChunk),
|
#[br(magic = b"ADIR")] AddDirectory(AddDirectoryChunk),
|
||||||
#[br(magic = b"DELD")] DeleteDirectory(DeleteDirectoryChunk),
|
#[br(magic = b"DELD")] DeleteDirectory(DeleteDirectoryChunk),
|
||||||
|
@ -28,53 +31,43 @@ enum ChunkType {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(BinRead, PartialEq, Debug)]
|
#[derive(BinRead, PartialEq, Debug)]
|
||||||
#[br(big)]
|
enum FileHeaderChunk {
|
||||||
struct FileHeaderChunk {
|
#[br(magic = 2u8)] Version2(FileHeaderChunk2),
|
||||||
#[br(pad_before = 2)]
|
#[br(magic = 3u8)] Version3(FileHeaderChunk3)
|
||||||
#[br(pad_after = 1)]
|
}
|
||||||
version: u8,
|
|
||||||
|
|
||||||
|
#[derive(BinRead, PartialEq, Debug)]
|
||||||
|
#[br(big)]
|
||||||
|
struct FileHeaderChunk2 {
|
||||||
#[br(count = 4)]
|
#[br(count = 4)]
|
||||||
#[br(map = | x: Vec < u8 > | String::from_utf8(x).unwrap())]
|
#[br(map = | x: Vec < u8 > | String::from_utf8(x).unwrap())]
|
||||||
name: String,
|
name: String,
|
||||||
|
|
||||||
|
#[br(pad_before = 8)]
|
||||||
|
depot_hash: u32
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(BinRead, PartialEq, Debug)]
|
||||||
#[br(big)]
|
#[br(big)]
|
||||||
|
struct FileHeaderChunk3 {
|
||||||
|
#[br(count = 4)]
|
||||||
|
#[br(map = | x: Vec < u8 > | String::from_utf8(x).unwrap())]
|
||||||
|
name: String,
|
||||||
|
|
||||||
entry_files: u32,
|
entry_files: u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
add_directories : u32,
|
add_directories : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
delete_directories : u32,
|
delete_directories : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
delete_data_size : u32,
|
delete_data_size : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
delete_data_size_2 : u32,
|
delete_data_size_2 : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
minor_version : u32,
|
minor_version : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
repository_name : u32,
|
repository_name : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
commands : u32,
|
commands : u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
sqpk_add_commands: u32,
|
sqpk_add_commands: u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
sqpk_delete_commands: u32,
|
sqpk_delete_commands: u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
sqpk_expand_commands: u32,
|
sqpk_expand_commands: u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
sqpk_header_commands: u32,
|
sqpk_header_commands: u32,
|
||||||
|
|
||||||
#[br(big)]
|
|
||||||
#[br(pad_after = 0xB8)]
|
#[br(pad_after = 0xB8)]
|
||||||
sqpk_file_commands: u32
|
sqpk_file_commands: u32
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue