Skip to content

Commit

Permalink
Don't write textures in info mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Torphedo committed Jan 21, 2023
1 parent f9b8553 commit 5a4acbd
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions alr_parser/src/parsers.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,9 @@ static void block_texture(arena_t* arena, unsigned int texture_buffer_ptr)
res_size = resources[texture_id + 1].data_ptr - resources[texture_id].data_ptr;
}

texture_info info = {
.filename = &dds_names[i * 0x20],
.bits_per_pixel = (res_size / pixel_count) * 8,
.mipmap_count = surface[i].mipmap_count,
.image_data = (char*) arena->base_addr + texture_buffer_ptr + resources[texture_id].data_ptr,
.width = textures[i].width,
.height = textures[i].height,
.format = DDS
};

log_error(INFO, "Surface %2d (%s): %2d mipmap(s), estimated %2d bpp\n", i, &dds_names[i * 0x20], info.mipmap_count, info.bits_per_pixel);
uint8_t bits_per_pixel = (res_size / pixel_count) * 8;

log_error(INFO, "Surface %2d (%s): %2d mipmap(s), estimated %2d bpp\n", i, &dds_names[i * 0x20], surface[i].mipmap_count, bits_per_pixel);

if (resources[i].pad != 0)
{
Expand All @@ -203,7 +195,18 @@ static void block_texture(arena_t* arena, unsigned int texture_buffer_ptr)
log_error(DEBUG, "Discovered anomaly in format! Flag value in 0x15 member was 0x%x at index %d!\n", resources[i].flags, i);
}

write_texture(info);
if (!info_mode) {
texture_info info = {
.filename = &dds_names[i * 0x20],
.bits_per_pixel = bits_per_pixel,
.mipmap_count = surface[i].mipmap_count,
.image_data = (char *) arena->base_addr + texture_buffer_ptr + resources[texture_id].data_ptr,
.width = textures[i].width,
.height = textures[i].height,
.format = DDS
};
write_texture(info);
}
}
printf("\n");

Expand Down

0 comments on commit 5a4acbd

Please sign in to comment.