diff --git a/stepmania/src/BannerCache.cpp b/stepmania/src/BannerCache.cpp index 5bc22786ac..d877219d73 100644 --- a/stepmania/src/BannerCache.cpp +++ b/stepmania/src/BannerCache.cpp @@ -301,10 +301,11 @@ void BannerCache::CacheBanner( CString BannerPath ) void BannerCache::CacheBannerInternal( CString BannerPath ) { - RageSurface *img = RageSurfaceUtils::LoadFile( BannerPath ); + CString error; + RageSurface *img = RageSurfaceUtils::LoadFile( BannerPath, error ); if( img == NULL ) { - LOG->Warn( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), SDL_GetError() ); + LOG->Warn( "BannerCache::CacheBanner: Couldn't load %s: %s", BannerPath.c_str(), error.c_str() ); return; } diff --git a/stepmania/src/RageBitmapTexture.cpp b/stepmania/src/RageBitmapTexture.cpp index 4363faf283..722ad2eab2 100644 --- a/stepmania/src/RageBitmapTexture.cpp +++ b/stepmania/src/RageBitmapTexture.cpp @@ -11,9 +11,7 @@ #include "RageSurface.h" #include "RageSurfaceUtils.h" -#include "SDL.h" #include "SDL_rotozoom.h" -#include "SDL_utils.h" #include "SDL_dither.h" #include "RageSurface_Load.h" @@ -69,12 +67,13 @@ void RageBitmapTexture::Create() /* Create (and return) a surface ready to be loaded to OpenGL */ /* Load the image into an SDL surface. */ - RageSurface *img = RageSurfaceUtils::LoadFile( actualID.filename ); + CString error; + RageSurface *img = RageSurfaceUtils::LoadFile( actualID.filename, error ); /* Tolerate corrupt/unknown images. */ if( img == NULL ) { - LOG->Warn( "RageBitmapTexture: Couldn't load %s: %s", actualID.filename.c_str(), SDL_GetError() ); + LOG->Warn( "RageBitmapTexture: Couldn't load %s: %s", actualID.filename.c_str(), error.c_str() ); img = RageSurfaceUtils::MakeDummySurface( 64, 64 ); ASSERT( img != NULL ); } diff --git a/stepmania/src/RageSurface_Load.cpp b/stepmania/src/RageSurface_Load.cpp index 1fad08b182..a658dd1d76 100644 --- a/stepmania/src/RageSurface_Load.cpp +++ b/stepmania/src/RageSurface_Load.cpp @@ -97,13 +97,13 @@ static RageSurface *TryOpenFile( CString sPath, bool bHeaderOnly, CString &error return NULL; } -RageSurface *RageSurfaceUtils::LoadFile( const CString &sPath, bool bHeaderOnly ) +RageSurface *RageSurfaceUtils::LoadFile( const CString &sPath, CString &error, bool bHeaderOnly ) { { RageFile TestOpen; if( !TestOpen.Open( sPath ) ) { - SDL_SetError( "%s", TestOpen.GetError().c_str() ); + error = TestOpen.GetError(); return NULL; } } @@ -117,8 +117,6 @@ RageSurface *RageSurfaceUtils::LoadFile( const CString &sPath, bool bHeaderOnly CString format = GetExtension(sPath); format.MakeLower(); - CString error = ""; - bool bKeepTrying = true; /* If the extension matches a format, try that first. */ @@ -140,7 +138,6 @@ RageSurface *RageSurfaceUtils::LoadFile( const CString &sPath, bool bHeaderOnly } } - SDL_SetError( "%s", error.c_str() ); return NULL; } diff --git a/stepmania/src/RageSurface_Load.h b/stepmania/src/RageSurface_Load.h index 1867a9b412..dc326041f3 100644 --- a/stepmania/src/RageSurface_Load.h +++ b/stepmania/src/RageSurface_Load.h @@ -13,7 +13,7 @@ namespace RageSurfaceUtils /* If bHeaderOnly is true, the loader is only required to return a surface * with the width and height set (but may return a complete surface). */ - RageSurface *LoadFile( const CString &sPath, bool bHeaderOnly=false ); + RageSurface *LoadFile( const CString &sPath, CString &error, bool bHeaderOnly=false ); } #endif diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index b6d1b3c861..41c730ad28 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -697,11 +697,13 @@ void Song::TidyUpData() continue; // skip CString sPath = m_sSongDir + arrayImages[i]; + /* We only care about the dimensions. */ - RageSurface *img = RageSurfaceUtils::LoadFile( sPath, true ); + CString error; + RageSurface *img = RageSurfaceUtils::LoadFile( sPath, error, true ); if( !img ) { - LOG->Trace("Couldn't load '%s': %s", sPath.c_str(), SDL_GetError()); + LOG->Trace( "Couldn't load '%s': %s", sPath.c_str(), error.c_str() ); continue; } diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp index 461d18ada1..e7ea6776ca 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.cpp @@ -14,7 +14,8 @@ static HBITMAP g_hBitmap = NULL; /* Load a file into a GDI surface. */ HBITMAP LoadWin32Surface( CString fn ) { - RageSurface *s = RageSurfaceUtils::LoadFile( fn ); + CString error; + RageSurface *s = RageSurfaceUtils::LoadFile( fn, error ); if( s == NULL ) return NULL;