ividyon / WitchyBND

Unpacks/repacks FromSoftware archive formats and serializes FromSoftware data formats.
Other
113 stars 11 forks source link

Repacking Bloodborne menu_knowledge.tpf.dcx files corrupts .DDS image #43

Closed SpunkMurphy closed 1 month ago

SpunkMurphy commented 1 month ago

When you repack Bloodborne menu_knowledge.tpf.dcx files the .dds is corrupted. The same portion of the .dds is cut from the image every time you do this.

I have uploaded an example of what I'm talking about. Example: menu_knowledge_00011.tpf.dcx

Before repacking:

image

After repacking:

image

ividyon commented 1 month ago

Should be fixed in the next release, Shadowth117 took care of it in SoulsFormatsNEXT

Shadowth117 commented 1 month ago

Purely so the info is out in the open btw, this problem should only affect textures that aren't 'normal' block sizes for a particular pixel format. Typical sizes like 256x256, 512x512 are all exempt from this, so virtually all gameplay textures.

For this instance, it was a 400x400 texture, but the pixel block size was 32x32 since it was BC7. The texture's data MUST be at least as much as a multiple of 32. If we divide 400 by 32, or modulo it like so 400 % 32, we get the remainder 16. So the minimum texture size should be treated as what a 416x416 texture would require. The game's graphics api then handles slicing out what's not being used based on the actual resolution of 400x400, seemingly.