This commit is contained in:
widberg 2026-04-26 11:37:05 -04:00
parent 6bbc0c8306
commit 0c27b8b8ff
8 changed files with 33 additions and 39 deletions

View file

@ -1,8 +1,13 @@
use std::io::{self, BufRead, Read};
use bff::crc::{
asobo32_options, asobo64_options, asobo_alternate32_options, blacksheep32_options,
kalisto32_options, racenet32_options, ubisoft64_options,
asobo_alternate32_options,
asobo32_options,
asobo64_options,
blacksheep32_options,
kalisto32_options,
racenet32_options,
ubisoft64_options,
};
use clap::ValueEnum;
@ -76,10 +81,9 @@ fn hash(bytes: &[u8], starting: &i64, algorithm: &CrcAlgorithm, format: &CrcForm
let starting = *starting;
match algorithm {
CrcAlgorithm::Asobo => format_hash(asobo32_options(bytes, starting as i32), format),
CrcAlgorithm::AsoboAlternate => format_hash(
asobo_alternate32_options(bytes, starting as i32),
format,
),
CrcAlgorithm::AsoboAlternate => {
format_hash(asobo_alternate32_options(bytes, starting as i32), format)
}
CrcAlgorithm::Kalisto => format_hash(kalisto32_options(bytes, starting as i32), format),
CrcAlgorithm::BlackSheep => {
format_hash(blacksheep32_options(bytes, starting as i32), format)

View file

@ -155,11 +155,7 @@ pub fn create(
if let Some(out_names) = out_names {
let resource_names: Vec<_> = bigfile.resources.keys().copied().collect();
write_names(
out_names,
Some(resource_names.as_slice()),
&name_context,
)?;
write_names(out_names, Some(resource_names.as_slice()), &name_context)?;
}
progress_bar.finish_and_clear();

View file

@ -9,7 +9,11 @@ use indicatif::{ProgressBar, ProgressStyle};
use crate::error::BffCliResult;
use crate::extract::{
probe_bigfile_name_context, read_bigfile, read_bigfile_names, read_in_names, write_names,
probe_bigfile_name_context,
read_bigfile,
read_bigfile_names,
read_in_names,
write_names,
};
#[derive(ValueEnum, Clone, Copy)]
@ -96,8 +100,9 @@ pub fn names(
.unwrap()
.with_context(&name_context)
.to_string();
let parent_string = if let Some((_, s)) =
name_context.name_type().parse_forced_hash_name(&parent_name)
let parent_string = if let Some((_, s)) = name_context
.name_type()
.parse_forced_hash_name(&parent_name)
{
s
} else {
@ -131,11 +136,7 @@ pub fn names(
if let Some(out_names) = out_names {
let resource_names: Vec<_> = bigfile.resources.keys().copied().collect();
write_names(
out_names,
Some(resource_names.as_slice()),
&name_context,
)?;
write_names(out_names, Some(resource_names.as_slice()), &name_context)?;
}
} else if let Some(out_names) = out_names {
write_names(out_names, None, &name_context)?;