mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-23 21:17:45 +00:00
Fix patching for some patch files
We still need to read the index type, even though it's NOP. It appeared in a recent patch!
This commit is contained in:
parent
59fc7d9786
commit
b180cf5aac
1 changed files with 29 additions and 0 deletions
29
src/patch.rs
29
src/patch.rs
|
@ -141,6 +141,8 @@ enum SqpkOperation {
|
|||
PatchInfo(SqpkPatchInfo),
|
||||
#[br(magic = b'T')]
|
||||
TargetInfo(SqpkTargetInfo),
|
||||
#[br(magic = b'I')]
|
||||
Index(SqpkIndex)
|
||||
}
|
||||
|
||||
#[derive(BinRead, PartialEq, Debug)]
|
||||
|
@ -288,6 +290,30 @@ struct SqpkTargetInfo {
|
|||
seek_count: u64,
|
||||
}
|
||||
|
||||
#[binread]
|
||||
#[derive(PartialEq, Debug)]
|
||||
enum SqpkIndexCommand {
|
||||
#[br(magic = b'A')]
|
||||
Add,
|
||||
#[br(magic = b'D')]
|
||||
Delete,
|
||||
}
|
||||
|
||||
#[derive(BinRead, PartialEq, Debug)]
|
||||
#[br(big)]
|
||||
struct SqpkIndex {
|
||||
command: SqpkIndexCommand,
|
||||
#[br(map = | x : u8 | x == 1)]
|
||||
is_synonym: bool,
|
||||
|
||||
#[br(pad_before = 1)]
|
||||
file_hash: u64,
|
||||
|
||||
block_offset: u32,
|
||||
#[br(pad_after = 8)] // data?
|
||||
block_number: u32
|
||||
}
|
||||
|
||||
#[derive(BinRead, PartialEq, Debug)]
|
||||
#[br(big)]
|
||||
struct SqpkChunk {
|
||||
|
@ -577,6 +603,9 @@ pub fn apply_patch(data_dir: &str, patch_path: &str) -> Result<(), PatchError> {
|
|||
SqpkOperation::TargetInfo(new_target_info) => {
|
||||
target_info = Some(new_target_info);
|
||||
}
|
||||
SqpkOperation::Index(_) => {
|
||||
// Currently, there's nothing we need from Index command. Intentional NOP.
|
||||
}
|
||||
}
|
||||
}
|
||||
ChunkType::FileHeader(_) => {
|
||||
|
|
Loading…
Add table
Reference in a new issue