Matteo Bruni (@Mystral) commented about dlls/d3dx9_36/surface.c:
+ if (header->color_map_type && ((header->color_map_type > 1) || (!header->color_map_length) + || (d3dx_get_tga_format_for_bpp(header->color_map_entrysize) == D3DFMT_UNKNOWN))) + return D3DXERR_INVALIDDATA; + + switch (header->image_type & IMAGETYPE_MASK) + { + case IMAGETYPE_COLORMAPPED: + if (header->depth != 8 || !header->color_map_type) + return D3DXERR_INVALIDDATA; + image->format = D3DFMT_P8; + break; + + case IMAGETYPE_TRUECOLOR: + if (d3dx_get_tga_format_for_bpp(header->depth) == D3DFMT_UNKNOWN) + return D3DXERR_INVALIDDATA; + image->format = d3dx_get_tga_format_for_bpp(header->depth); Another nitpick but:
if ((image->format = d3dx_get_tga_format_for_bpp(header->depth)) == D3DFMT_UNKNOWN)
return D3DXERR_INVALIDDATA;
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/6673#note_85146