]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - image.c
Fix an IO exception on exit when using -condebug because FS_Close was trying to log...
[xonotic/darkplaces.git] / image.c
diff --git a/image.c b/image.c
index f0243e5b38c0df96b5769e997deed791f24a592b..ed498ed6562ce832080410a4fc25a9378aeb4727 100644 (file)
--- a/image.c
+++ b/image.c
@@ -970,46 +970,28 @@ imageformat_t;
 imageformat_t imageformats_tenebrae[] =
 {
        {"override/%s.tga", LoadTGA_BGRA},
-       {"override/%s.TGA", LoadTGA_BGRA},
        {"override/%s.png", PNG_LoadImage_BGRA},
-       {"override/%s.PNG", PNG_LoadImage_BGRA},
        {"override/%s.jpg", JPEG_LoadImage_BGRA},
-       {"override/%s.JPG", JPEG_LoadImage_BGRA},
        {"override/%s.pcx", LoadPCX_BGRA},
-       {"override/%s.PCX", LoadPCX_BGRA},      
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.png", PNG_LoadImage_BGRA},
-       {"%s.PNG", PNG_LoadImage_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.pcx", LoadPCX_BGRA},
-       {"%s.PCX", LoadPCX_BGRA},
        {NULL, NULL}
 };
 
 imageformat_t imageformats_nopath[] =
 {
        {"override/%s.tga", LoadTGA_BGRA},
-       {"override/%s.TGA", LoadTGA_BGRA},
        {"override/%s.png", PNG_LoadImage_BGRA},
-       {"override/%s.PNG", PNG_LoadImage_BGRA},
        {"override/%s.jpg", JPEG_LoadImage_BGRA},
-       {"override/%s.JPG", JPEG_LoadImage_BGRA},
        {"textures/%s.tga", LoadTGA_BGRA},
-       {"textures/%s.TGA", LoadTGA_BGRA},
        {"textures/%s.png", PNG_LoadImage_BGRA},
-       {"textures/%s.PNG", PNG_LoadImage_BGRA},
        {"textures/%s.jpg", JPEG_LoadImage_BGRA},
-       {"textures/%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.png", PNG_LoadImage_BGRA},
-       {"%s.PNG", PNG_LoadImage_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.pcx", LoadPCX_BGRA},
-       {"%s.PCX", LoadPCX_BGRA},
        {NULL, NULL}
 };
 
@@ -1021,58 +1003,39 @@ imageformat_t imageformats_nopath[] =
 imageformat_t imageformats_dq[] =
 {
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},        
        {"texturemaps/%s.tga", LoadTGA_BGRA},
-       {"texturemaps/%s.TGA", LoadTGA_BGRA},   
        {"texturemaps/%s.jpg", JPEG_LoadImage_BGRA},
-       {"texturemaps/%s.JPG", JPEG_LoadImage_BGRA},    
        {NULL, NULL}
 };
 
 imageformat_t imageformats_textures[] =
 {
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.png", PNG_LoadImage_BGRA},
-       {"%s.PNG", PNG_LoadImage_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.pcx", LoadPCX_BGRA},
-       {"%s.PCX", LoadPCX_BGRA},
        {"%s.wal", LoadWAL_BGRA},
-       {"%s.WAL", LoadWAL_BGRA},       
        {NULL, NULL}
 };
 
 imageformat_t imageformats_gfx[] =
 {
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.png", PNG_LoadImage_BGRA},
-       {"%s.PNG", PNG_LoadImage_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.pcx", LoadPCX_BGRA},
-       {"%s.PCX", LoadPCX_BGRA},
        {"%s.lmp", LoadLMP_BGRA},
-       {"%s.LMP", LoadLMP_BGRA},
        {NULL, NULL}
 };
 
 imageformat_t imageformats_other[] =
 {
        {"%s.tga", LoadTGA_BGRA},
-       {"%s.TGA", LoadTGA_BGRA},
        {"%s.png", PNG_LoadImage_BGRA},
-       {"%s.PNG", PNG_LoadImage_BGRA},
        {"%s.jpg", JPEG_LoadImage_BGRA},
-       {"%s.JPG", JPEG_LoadImage_BGRA},
        {"%s.pcx", LoadPCX_BGRA},
-       {"%s.PCX", LoadPCX_BGRA},
        {"%s.lmp", LoadLMP_BGRA},
-       {"%s.LMP", LoadLMP_BGRA},       
        {NULL, NULL}
 };
 
@@ -1121,8 +1084,10 @@ unsigned char *loadimagepixelsbgra (const char *filename, qbool complain, qbool
        for (format = firstformat;format->formatstring;format++)
        {
                dpsnprintf (name, sizeof(name), format->formatstring, basename);
-               f = FS_LoadFile(name, tempmempool, true, &filesize);
-               if (f)
+
+               FS_SanitizePath(name);
+
+               if(FS_FileExists(name) && (f = FS_LoadFile(name, tempmempool, true, &filesize)) != NULL)
                {
                        mymiplevel = miplevel ? *miplevel : 0;
                        image_width = 0;
@@ -1842,10 +1807,8 @@ void Image_HeightmapToNormalmap_BGRA(const unsigned char *inpixels, unsigned cha
        }
 }
 
-static const unsigned char concharimage[] =
-{
+
 #include "lhfont.h"
-};
 
 static unsigned char *Image_GenerateConChars(void)
 {