Skip to content

Commit

Permalink
*Very* rough patch to allow extracting Chaos Bleeds textures.
Browse files Browse the repository at this point in the history
Will almost certainly break every other game in the process.
  • Loading branch information
joshbarrass committed Apr 9, 2024
1 parent 7b6bcb7 commit fbeef35
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions eurochef/shared/src/platform/texture/xbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ impl TextureDecoder for XboxTextureDecoder {
anyhow::ensure!(output.len() == (width as usize * height as usize * depth as usize) * 4);

let mut buffer = vec![0u8; output.len()];
// println!("Format: {:?}", fmt);
// println!("(w,h) = ({},{})", width, height);
// println!("Input size: {}", input.len());
match fmt {
InternalFormat::Dxt1
| InternalFormat::Dxt1Alpha
Expand Down
8 changes: 6 additions & 2 deletions eurochef/shared/src/textures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ impl UXGeoTexture {
)
.context("Failed to get data size")?;

let data_size = tex.data_size.map(|v| v as usize).unwrap_or(calculated_size);
//let data_size = tex.data_size.map(|v| v as usize).unwrap_or(calculated_size);
let data_size = calculated_size;
// println!("calculated_size: {}", calculated_size);
// println!("data_size: {}", data_size);
// println!("original data_size: {}", tex.data_size.map(|v| v as usize).unwrap_or(calculated_size));

if data_size == 0 {
return Err(anyhow::anyhow!(
Expand Down Expand Up @@ -163,7 +167,7 @@ impl UXGeoTexture {
}

for (i, frame_offset) in tex.frame_offsets.iter().enumerate() {
edb.seek(std::io::SeekFrom::Start(frame_offset.offset_absolute()))?;
edb.seek(std::io::SeekFrom::Start(frame_offset.offset_absolute() + 8*11 - 4))?;
edb.read_exact(&mut data)
.context(format!("Failed to read frame {i}"))?;

Expand Down

0 comments on commit fbeef35

Please sign in to comment.