diff --git a/korman/exporter/material.py b/korman/exporter/material.py index 852996d..39e62f1 100644 --- a/korman/exporter/material.py +++ b/korman/exporter/material.py @@ -272,6 +272,14 @@ class MaterialConverter: compression = plBitmap.kDirectXCompression dxt = plBitmap.kDXT5 if key.use_alpha or key.calc_alpha else plBitmap.kDXT1 + # HACK ATTACK! + # There is a bug in Cyan's level size algorithm that causes it to not allocate enough memory + # for the color block in a 1x1 DXT5 mipmap. To fix that, we will reduce the number of levels + # by one, such that we don't even produce a 1x1 mipmap. DXT images need to have at least 4 pixels anyway... + # We can't fix the real source of the bug because the values generated by the algo are + # used to read from the file. Can't fixed close source games :( + numLevels -= 1 + # Grab the image data from OpenGL and stuff it into the plBitmap with _GLTexture(image) as glimage: if key.mipmap: