void Surface_Init() { Msg("* ImageLibrary version: %s",FreeImage_GetVersion()); formats.format_register("tga"); Surface_FormatExt(FIF_BMP); Surface_FormatExt(FIF_ICO); Surface_FormatExt(FIF_JPEG); Surface_FormatExt(FIF_JNG); Surface_FormatExt(FIF_KOALA); Surface_FormatExt(FIF_LBM); Surface_FormatExt(FIF_MNG); Surface_FormatExt(FIF_PBM); Surface_FormatExt(FIF_PBMRAW); Surface_FormatExt(FIF_PCD); Surface_FormatExt(FIF_PCX); Surface_FormatExt(FIF_PGM); Surface_FormatExt(FIF_PGMRAW); Surface_FormatExt(FIF_PNG); Surface_FormatExt(FIF_PPM); Surface_FormatExt(FIF_PPMRAW); Surface_FormatExt(FIF_RAS); Surface_FormatExt(FIF_TARGA); Surface_FormatExt(FIF_TIFF); Surface_FormatExt(FIF_WBMP); Surface_FormatExt(FIF_PSD); Surface_FormatExt(FIF_IFF); Msg("* %d supported formats",formats.size()); }
void Surface_FormatExt(FREE_IMAGE_FORMAT f) { LPCSTR n=FreeImage_GetFIFExtensionList(f); if (n){ LPSTR base = xr_strdup(n); LPSTR ext = base; LPSTR cur = ext; for (; ext[0]; ext++){ if (ext[0]==','){ ext[0] = 0; formats.format_register(cur); cur = ++ext; } } if (cur&&cur[0]) formats.format_register(cur); xr_free(base); } }
BOOL Surface_Detect(string_path& F, LPSTR N) { for (u32 i=0; i<formats.size(); i++) { FS.update_path (F,"$textures$",strconcat(sizeof(F),F,N,".",formats[i])); int h = _open(F,O_RDONLY|O_BINARY); if (h>0) { _close(h); return TRUE; } } return FALSE; }
BOOL Surface_Detect(string_path& F, LPSTR N) { #ifndef PRIQUEL for (u32 i=0; i<formats.size(); i++) #endif // PRIQUEL { #ifdef PRIQUEL FS.update_path (F,"$game_textures$",strconcat(sizeof(F),F,N,".dds")); #else // PRIQUEL FS.update_path (F,"$textures$",strconcat(sizeof(F),F,N,".",formats[i])); #endif // PRIQUEL int h = _open(F,O_RDONLY|O_BINARY); if (h>0) { _close(h); return TRUE; } } return FALSE; }