Added functions to ActorUtil for converting the extension to a file type and changed various places that had lists of extensions to use ActorUtil instead of duplicating the list of extensions. Added webm and wmv to list of video types.

This commit is contained in:
Kyzentun
2014-11-09 00:04:47 -07:00
parent 77130ed3c4
commit e22e99251e
12 changed files with 208 additions and 130 deletions
+12 -10
View File
@@ -15,6 +15,8 @@
#include "NotesLoader.h"
#include "PrefsManager.h"
#include "BackgroundUtil.h"
#include "ActorUtil.h"
#include "RageFileManager.h"
/* BMS encoding: tap-hold
* 4&8panel: Player1 Player2
@@ -328,8 +330,8 @@ int BMSSong::AllocateKeysound( RString filename, RString path )
if( !IsAFile(dir + normalizedFilename) )
{
const char *exts[] = { "oga", "ogg", "wav", "mp3", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i )
vector<RString> const& exts= ActorUtil::GetTypeExtensionList(FT_Sound);
for(size_t i = 0; i < exts.size(); ++i)
{
RString fn = SetExtension( normalizedFilename, exts[i] );
if( IsAFile(dir + fn) )
@@ -393,8 +395,10 @@ bool BMSSong::GetBackground( RString filename, RString path, RString &bgfile )
if( !IsAFile(dir + normalizedFilename) )
{
const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i )
vector<RString> exts;
ActorUtil::AddTypeExtensionsToList(FT_Movie, exts);
ActorUtil::AddTypeExtensionsToList(FT_Bitmap, exts);
for(size_t i = 0; i < exts.size(); ++i)
{
RString fn = SetExtension( normalizedFilename, exts[i] );
if( IsAFile(dir + fn) )
@@ -424,12 +428,10 @@ void BMSSong::PrecacheBackgrounds(const RString &dir)
backgroundsPrecached = true;
vector<RString> arrayPossibleFiles;
const char *exts[] = { "ogv", "avi", "mpg", "mpeg", "bmp", "png", "jpeg", NULL }; // XXX: stop duplicating these everywhere
for( unsigned i = 0; exts[i] != NULL; ++i )
{
GetDirListing( dir + RString("*.") + RString(exts[i]), arrayPossibleFiles );
}
vector<RString> exts;
ActorUtil::AddTypeExtensionsToList(FT_Movie, exts);
ActorUtil::AddTypeExtensionsToList(FT_Bitmap, exts);
FILEMAN->GetDirListingWithMultipleExtensions(dir + RString("*."), exts, arrayPossibleFiles);
for( unsigned i = 0; i < arrayPossibleFiles.size(); i++ )
{