Skip to content

Add compression output to repak info command#52

Closed
Knutschbert wants to merge 1 commit intotrumank:masterfrom
Knutschbert:master
Closed

Add compression output to repak info command#52
Knutschbert wants to merge 1 commit intotrumank:masterfrom
Knutschbert:master

Conversation

@Knutschbert
Copy link
Copy Markdown

>repak info MyPak.pak
mount point: ../../../ASD/Content/MyPak/
version: V9
version major: FrozenIndex
encrypted index: false
encryption guid: Some(00000000000000000000000000000000)
compression: Zlib
path hash seed: None
92 file entriess

@trumank
Copy link
Copy Markdown
Owner

trumank commented Dec 9, 2025

Perhaps something like this to handle old pak versions that don't have an explicit list of compression methods and also (rare) cases of multiple compression methods? Also would be nice to show an explicit compression: None in the output when no compression is used.

pub fn used_compression(&self) -> Vec<Compression> {
    let mut used_compression = vec![0; self.pak.compression.len()];
    for entry in self.pak.index.entries.values() {
        if let Some(count) = entry
            .compression_slot
            .and_then(|slot| used_compression.get_mut(slot as usize))
        {
            *count += 1;
        }
    }
    used_compression
        .into_iter()
        .zip(self.pak.compression.iter())
        .filter_map(|(count, comp)| comp.filter(|_| count > 0))
        .collect()
}

trumank added a commit that referenced this pull request Dec 10, 2025
@trumank trumank closed this in b7892e8 Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants