mirror of
https://github.com/libretro/RetroArch
synced 2025-04-16 08:43:10 +00:00
More verbose TGA logging.
This commit is contained in:
parent
c135cf7e6d
commit
09bbfbba83
@ -104,17 +104,24 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
|
|||||||
{
|
{
|
||||||
// TODO: Check more gracefully.
|
// TODO: Check more gracefully.
|
||||||
if (!strstr(path, ".tga"))
|
if (!strstr(path, ".tga"))
|
||||||
|
{
|
||||||
|
RARCH_ERR("Extension is not .tga.\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void *raw_buf = NULL;
|
void *raw_buf = NULL;
|
||||||
ssize_t len = read_file(path, &raw_buf);
|
ssize_t len = read_file(path, &raw_buf);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
|
{
|
||||||
|
RARCH_ERR("Failed to read image: %s.\n", path);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t *buf = (uint8_t*)raw_buf;
|
uint8_t *buf = (uint8_t*)raw_buf;
|
||||||
|
|
||||||
if (buf[2] != 2) // Uncompressed RGB
|
if (buf[2] != 2) // Uncompressed RGB
|
||||||
{
|
{
|
||||||
|
RARCH_ERR("TGA image is not uncompressed RGB.\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -137,6 +144,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
|
|||||||
out_img->height = height;
|
out_img->height = height;
|
||||||
if (!out_img->pixels)
|
if (!out_img->pixels)
|
||||||
{
|
{
|
||||||
|
RARCH_ERR("Failed to allocate TGA pixels.\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -168,6 +176,7 @@ bool texture_image_load(const char *path, struct texture_image *out_img)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RARCH_ERR("Bit depth of TGA image is wrong. Only 32-bit and 24-bit supported.\n");
|
||||||
free(buf);
|
free(buf);
|
||||||
free(out_img->pixels);
|
free(out_img->pixels);
|
||||||
out_img->pixels = NULL;
|
out_img->pixels = NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user