diff --git a/stepmania/src/arch/ArchHooks/ArchHooks.cpp b/stepmania/src/arch/ArchHooks/ArchHooks.cpp index 967df2e032..fee6c3352d 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks.cpp @@ -2,6 +2,7 @@ #include "ArchHooks.h" #include "RageLog.h" #include "RageThreads.h" +#include "arch/arch_default.h" bool ArchHooks::g_bQuitting = false; bool ArchHooks::g_bToggleWindowed = false; @@ -49,6 +50,12 @@ bool ArchHooks::GoToURL( RString sUrl ) return false; } +ArchHooks *MakeArchHooks() +{ + return new ARCH_HOOKS; +} + + /* * (c) 2003-2004 Glenn Maynard, Chris Danford * All rights reserved. diff --git a/stepmania/src/arch/Dialog/Dialog.h b/stepmania/src/arch/Dialog/Dialog.h index ea124c36cf..49def888f4 100644 --- a/stepmania/src/arch/Dialog/Dialog.h +++ b/stepmania/src/arch/Dialog/Dialog.h @@ -18,7 +18,7 @@ namespace Dialog /* for DialogDrivers */ void IgnoreMessage( RString sID ); -}; +} #endif diff --git a/stepmania/src/arch/Dialog/DialogDriver.cpp b/stepmania/src/arch/Dialog/DialogDriver.cpp new file mode 100644 index 0000000000..3dfb72f38f --- /dev/null +++ b/stepmania/src/arch/Dialog/DialogDriver.cpp @@ -0,0 +1,76 @@ +#include "global.h" +#include "DialogDriver.h" +#include "Foreach.h" +#include "RageLog.h" + +map *RegisterDialogDriver::g_pRegistrees; +RegisterDialogDriver::RegisterDialogDriver( const istring &sName, CreateDialogDriverFn pfn ) +{ + if( g_pRegistrees == NULL ) + g_pRegistrees = new map; + + ASSERT( g_pRegistrees->find(sName) == g_pRegistrees->end() ); + (*g_pRegistrees)[sName] = pfn; +} + +REGISTER_DIALOG_DRIVER_CLASS( Null ); + +DialogDriver *MakeDialogDriver() +{ + RString sDrivers = "win32,cocoa,null"; + vector asDriversToTry; + split( sDrivers, ",", asDriversToTry, true ); + + ASSERT( asDriversToTry.size() != 0 ); + + RString sDriver; + DialogDriver *pRet = NULL; + + FOREACH_CONST( RString, asDriversToTry, Driver ) + { + map::const_iterator iter = RegisterDialogDriver::g_pRegistrees->find( istring(*Driver) ); + + if( iter == RegisterDialogDriver::g_pRegistrees->end() ) + continue; + + pRet = (iter->second)(); + DEBUG_ASSERT( pRet ); + const RString sError = pRet->Init(); + + if( sError != "" ) + { + if( LOG ) + LOG->Info( "Couldn't load driver %s: %s", Driver->c_str(), sError.c_str() ); + SAFE_DELETE( pRet ); + continue; + } + break; + } + return pRet; +} + + +/* + * (c) 2002-2006 Gleen Maynard, Steve Checkoway + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, and/or sell copies of the Software, and to permit persons to + * whom the Software is furnished to do so, provided that the above + * copyright notice(s) and this permission notice appear in all copies of + * the Software and that both the above copyright notice(s) and this + * permission notice appear in supporting documentation. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF + * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS + * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT + * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS + * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR + * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ diff --git a/stepmania/src/arch/Dialog/DialogDriver.h b/stepmania/src/arch/Dialog/DialogDriver.h index e79978ae9b..e4c9c5a065 100644 --- a/stepmania/src/arch/Dialog/DialogDriver.h +++ b/stepmania/src/arch/Dialog/DialogDriver.h @@ -2,6 +2,7 @@ #define DIALOG_BOX_DRIVER_H #include "Dialog.h" +#include "RageUtil.h" class DialogDriver { @@ -14,9 +15,18 @@ public: virtual RString Init() { return RString(); } virtual ~DialogDriver() { } }; +class DialogDriver_Null : public DialogDriver { }; + +typedef DialogDriver *(*CreateDialogDriverFn)(); +struct RegisterDialogDriver +{ + static map *g_pRegistrees; + RegisterDialogDriver( const istring &sName, CreateDialogDriverFn pfn ); +}; +#define REGISTER_DIALOG_DRIVER_CLASS( name ) \ + static DialogDriver *Create##name() { return new DialogDriver_##name; } \ + static RegisterDialogDriver register_##className( #name, Create##name ) -class DialogDriver_Null: public DialogDriver { }; -#define USE_DIALOG_DRIVER_NULL #endif diff --git a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.cpp b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.cpp index 3880001f2f..e463ebc751 100644 --- a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.cpp +++ b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.cpp @@ -6,6 +6,8 @@ #include "InputFilter.h" #include +REGISTER_DIALOG_DRIVER_CLASS( Cocoa ); + static CFOptionFlags ShowAlert( CFOptionFlags flags, const RString& sMessage, CFStringRef OK, CFStringRef alt = NULL, CFStringRef other = NULL) { diff --git a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h index 3c11ad4c3c..4af35f5c07 100644 --- a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h +++ b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h @@ -11,7 +11,6 @@ public: Dialog::Result AbortRetryIgnore( RString sMessage, RString sID ); Dialog::Result AbortRetry( RString sMessage, RString sID ); }; -#define USE_DIALOG_DRIVER_COCOA #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler.cpp b/stepmania/src/arch/InputHandler/InputHandler.cpp index f5e42037ad..c0ee83c1f2 100644 --- a/stepmania/src/arch/InputHandler/InputHandler.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler.cpp @@ -4,6 +4,9 @@ #include "InputHandler.h" #include "RageLog.h" #include "LocalizedString.h" +#include "arch/arch_default.h" +#include "InputHandler_MonkeyKeyboard.h" +#include "Foreach.h" void InputHandler::UpdateTimer() { @@ -159,6 +162,45 @@ RString InputHandler::GetLocalizedInputString( const DeviceInput &di ) } } +map *RegisterInputHandler::g_pRegistrees; +RegisterInputHandler::RegisterInputHandler( const istring &sName, CreateInputHandlerFn pfn ) +{ + if( g_pRegistrees == NULL ) + g_pRegistrees = new map; + + ASSERT( g_pRegistrees->find(sName) == g_pRegistrees->end() ); + (*g_pRegistrees)[sName] = pfn; +} + +static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." ); +void MakeInputHandlers( const RString &drivers_, vector &Add ) +{ + const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_; + vector DriversToTry; + split( drivers, ",", DriversToTry, true ); + + if( DriversToTry.empty() ) + RageException::Throw( "%s", INPUT_HANDLERS_EMPTY.GetValue().c_str() ); + + FOREACH_CONST( RString, DriversToTry, s ) + { + map::const_iterator iter = RegisterInputHandler::g_pRegistrees->find( istring(*s) ); + + if( iter == RegisterInputHandler::g_pRegistrees->end() ) + { + LOG->Trace( "Unknown Input Handler name: %s", s->c_str() ); + continue; + } + InputHandler *ret = (iter->second)(); + DEBUG_ASSERT( ret ); + Add.push_back( ret ); + } + // Always add + Add.push_back( new InputHandler_MonkeyKeyboard ); + +} + + /* * (c) 2003-2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/arch/InputHandler/InputHandler.h b/stepmania/src/arch/InputHandler/InputHandler.h index 12be5c5189..10457f8acb 100644 --- a/stepmania/src/arch/InputHandler/InputHandler.h +++ b/stepmania/src/arch/InputHandler/InputHandler.h @@ -68,6 +68,18 @@ private: int m_iInputsSinceUpdate; }; +typedef InputHandler *(*CreateInputHandlerFn)(); +struct RegisterInputHandler +{ + static map *g_pRegistrees; + RegisterInputHandler( const istring &sName, CreateInputHandlerFn pfn ); +}; +#define REGISTER_INPUT_HANDLER_CLASS2( name, x ) \ + static InputHandler *Create##name() { return new x; } \ + static RegisterInputHandler register_##className( #name, Create##name ) +#define REGISTER_INPUT_HANDLER_CLASS( name ) REGISTER_INPUT_HANDLER_CLASS2( name, InputHandler_##name ) + + #endif /* diff --git a/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp b/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp index 48b9f371f9..2de867ea05 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler_Carbon.cpp @@ -13,6 +13,8 @@ #include "archutils/Darwin/PumpDevice.h" #include +REGISTER_INPUT_HANDLER_CLASS( Carbon ); + void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon, void *sender ) { // The result seems useless as you can't actually return anything... diff --git a/stepmania/src/arch/InputHandler/InputHandler_Carbon.h b/stepmania/src/arch/InputHandler/InputHandler_Carbon.h index 5999297097..27e3aeb7d4 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Carbon.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Carbon.h @@ -39,7 +39,6 @@ public: static void QueueCallBack( void *target, int result, void *refcon, void *sender ); }; -#define USE_INPUT_HANDLER_CARBON #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h b/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h index 807fee2056..649ee26f73 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h +++ b/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h @@ -17,7 +17,6 @@ private: RageTimer m_timerPressButton; DeviceInput m_diLast; // Last input that we sent }; -#define USE_INPUT_HANDLER_MONKEY_KEYBOARD #endif diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.cpp b/stepmania/src/arch/MovieTexture/MovieTexture.cpp index 462a78b3cf..25d514e83b 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture.cpp @@ -5,6 +5,9 @@ #include "MovieTexture_Null.h" #include "PrefsManager.h" #include "RageFile.h" +#include "LocalizedString.h" +#include "Foreach.h" +#include "arch_default.h" void ForceToAscii( RString &str ) { @@ -54,6 +57,76 @@ bool RageMovieTexture::GetFourCC( RString fn, RString &handler, RString &type ) #undef HANDLE_ERROR } +map *RegisterMovieTexture::g_pRegistrees = NULL; +RegisterMovieTexture::RegisterMovieTexture( const istring &sName, CreateMovieTextureFn pfn ) +{ + if( g_pRegistrees == NULL ) + g_pRegistrees = new map; + + ASSERT( g_pRegistrees->find(sName) == g_pRegistrees->end() ); + (*g_pRegistrees)[sName] = pfn; +} + +// Helper for MakeRageMovieTexture() +static void DumpAVIDebugInfo( const RString& fn ) +{ + RString type, handler; + if( !RageMovieTexture::GetFourCC( fn, handler, type ) ) + return; + + LOG->Trace( "Movie %s has handler '%s', type '%s'", fn.c_str(), handler.c_str(), type.c_str() ); +} + +static Preference g_sMovieDrivers( "MovieDrivers", "" ); // "" == default +/* Try drivers in order of preference until we find one that works. */ +static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); +static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); +RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) +{ + DumpAVIDebugInfo( ID.filename ); + + RString sDrivers = g_sMovieDrivers; + if( sDrivers.empty() ) + sDrivers = DEFAULT_MOVIE_DRIVER_LIST; + + vector DriversToTry; + split( sDrivers, ",", DriversToTry, true ); + + if( DriversToTry.empty() ) + RageException::Throw( "%s", MOVIE_DRIVERS_EMPTY.GetValue().c_str() ); + + RageMovieTexture *ret = NULL; + + FOREACH_CONST( RString, DriversToTry, Driver ) + { + LOG->Trace( "Initializing driver: %s", Driver->c_str() ); + map::const_iterator iter = RegisterMovieTexture::g_pRegistrees->find( istring(*Driver) ); + + if( iter == RegisterMovieTexture::g_pRegistrees->end() ) + { + LOG->Trace( "Unknown movie driver name: %s", Driver->c_str() ); + continue; + } + ret = (iter->second)( ID ); + DEBUG_ASSERT( ret ); + const RString sError = ret->Init(); + if( sError != "" ) + { + LOG->Info( "Couldn't load driver %s: %s", Driver->c_str(), sError.c_str() ); + SAFE_DELETE( ret ); + continue; + } + LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"", + ID.filename.c_str(), Driver->c_str() ); + break; + } + if ( !ret ) + RageException::Throw( "%s", COULDNT_CREATE_MOVIE_DRIVER.GetValue().c_str() ); + + return ret; +} + + /* * (c) 2003-2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.h b/stepmania/src/arch/MovieTexture/MovieTexture.h index fad00ac78e..56cb556501 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture.h @@ -2,6 +2,7 @@ #define MOVIE_TEXTURE_H #include "RageTexture.h" +#include class RageMovieTexture : public RageTexture { @@ -22,6 +23,16 @@ public: static bool GetFourCC( RString fn, RString &handler, RString &type ); }; +typedef RageMovieTexture *(*CreateMovieTextureFn)( RageTextureID ); +struct RegisterMovieTexture +{ + static map *g_pRegistrees; + RegisterMovieTexture( const istring &sName, CreateMovieTextureFn ); +}; +#define REGISTER_MOVIE_TEXTURE_CLASS( name ) \ + static RageMovieTexture *Create##name( RageTextureID ID ) { return new MovieTexture_##name( ID ); } \ + static RegisterMovieTexture register_##className( #name, Create##name ) + #endif /* diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp index cd28e49e20..e4cb6e1694 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.cpp @@ -9,6 +9,8 @@ #include +REGISTER_MOVIE_TEXTURE_CLASS( FFMpeg ); + namespace avcodec { #include diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h index 79d5f9471f..a7b8c2967c 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h @@ -13,7 +13,6 @@ public: static void RegisterProtocols(); static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt ); }; -#define USE_MOVIE_TEXTURE_FFMPEG #endif diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp index 01b8bb0dd2..cfaf75e2dd 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.cpp @@ -6,6 +6,7 @@ #include "MovieTexture_Null.h" #include "RageSurface.h" +REGISTER_MOVIE_TEXTURE_CLASS( Null ); MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID) { LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)"); diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h index f6f24e59a5..fd292fa13c 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h @@ -29,7 +29,6 @@ private: bool loop; unsigned texHandle; }; -#define USE_MOVIE_TEXTURE_NULL #endif diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Theora.cpp b/stepmania/src/arch/MovieTexture/MovieTexture_Theora.cpp index 795dc879a6..c56626f829 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Theora.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Theora.cpp @@ -7,6 +7,8 @@ #include "RageUtil.h" #include "MovieTexture_FFMpeg.h" /* for AVCodecCreateCompatibleSurface */ +REGISTER_MOVIE_TEXTURE_CLASS( Theora ); + namespace avcodec { #include /* for avcodec::img_convert */ diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Theora.h b/stepmania/src/arch/MovieTexture/MovieTexture_Theora.h index 8adf407c6d..3eda6486d6 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Theora.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Theora.h @@ -10,7 +10,6 @@ class MovieTexture_Theora: public MovieTexture_Generic public: MovieTexture_Theora( RageTextureID ID ); }; -#define USE_MOVIE_TEXTURE_THEORA #endif diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp index 0280a9f7f1..2d05953a69 100644 --- a/stepmania/src/arch/arch.cpp +++ b/stepmania/src/arch/arch.cpp @@ -11,105 +11,6 @@ #include "LocalizedString.h" #include "arch_default.h" -ArchHooks *MakeArchHooks() -{ - return new ARCH_HOOKS; -} - -DialogDriver *MakeDialogDriver() -{ - RString sDrivers = "win32,cocoa,null"; - vector asDriversToTry; - split( sDrivers, ",", asDriversToTry, true ); - - ASSERT( asDriversToTry.size() != 0 ); - - RString sDriver; - DialogDriver *pRet = NULL; - - for( unsigned i = 0; pRet == NULL && i < asDriversToTry.size(); ++i ) - { - sDriver = asDriversToTry[i]; - -#ifdef USE_DIALOG_DRIVER_COCOA - if( !asDriversToTry[i].CompareNoCase("Cocoa") ) pRet = new DialogDriver_Cocoa; -#endif -#ifdef USE_DIALOG_DRIVER_NULL - if( !asDriversToTry[i].CompareNoCase("Null") ) pRet = new DialogDriver_Null; -#endif -#ifdef USE_DIALOG_DRIVER_WIN32 - if( !asDriversToTry[i].CompareNoCase("Win32") ) pRet = new DialogDriver_Win32; -#endif - - if( pRet == NULL ) - continue; - - RString sError = pRet->Init(); - if( sError != "" ) - { - if( LOG ) - LOG->Info( "Couldn't load driver %s: %s", asDriversToTry[i].c_str(), sError.c_str() ); - SAFE_DELETE( pRet ); - } - } - - return pRet; -} - -static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." ); -void MakeInputHandlers( const RString &drivers_, vector &Add ) -{ - const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_; - vector DriversToTry; - split( drivers, ",", DriversToTry, true ); - - if( DriversToTry.empty() ) - RageException::Throw( "%s", INPUT_HANDLERS_EMPTY.GetValue().c_str() ); - - RString Driver; - - FOREACH_CONST( RString, DriversToTry, s ) - { - InputHandler *ret = NULL; - -#ifdef USE_INPUT_HANDLER_DIRECTINPUT - if( !s->CompareNoCase("DirectInput") ) ret = new InputHandler_DInput; -#endif -#ifdef USE_INPUT_HANDLER_LINUX_JOYSTICK - if( !s->CompareNoCase("Joystick") ) ret = new InputHandler_Linux_Joystick; -#endif -#ifdef USE_INPUT_HANDLER_LINUX_TTY - if( !s->CompareNoCase("tty") ) ret = new InputHandler_Linux_tty; -#endif -#ifdef USE_INPUT_HANDLER_WIN32_PARA - if( !s->CompareNoCase("Para") ) ret = new InputHandler_Win32_Para; -#endif -#ifdef USE_INPUT_HANDLER_WIN32_PUMP - if( !s->CompareNoCase("Pump") ) ret = new InputHandler_Win32_Pump; -#endif -#ifdef USE_INPUT_HANDLER_WIN32_MIDI - if( !s->CompareNoCase("MIDI") ) ret = new InputHandler_Win32_MIDI; -#endif -#ifdef USE_INPUT_HANDLER_X11 - if( !s->CompareNoCase("X11") ) ret = new InputHandler_X11; -#endif -#ifdef USE_INPUT_HANDLER_XBOX - if( !s->CompareNoCase("Xbox") ) ret = new InputHandler_Xbox; -#endif -#ifdef USE_INPUT_HANDLER_CARBON - if( !s->CompareNoCase("Carbon") ) ret = new InputHandler_Carbon; -#endif - - if( ret == NULL ) - LOG->Trace( "Unknown Input Handler name: %s", s->c_str() ); - else - Add.push_back( ret ); - } - - // Always add - Add.push_back( new InputHandler_MonkeyKeyboard ); - -} void MakeLightsDrivers( const RString &driver, vector &Add ) { @@ -211,65 +112,6 @@ MemoryCardDriver *MakeMemoryCardDriver() return ret; } -static Preference g_sMovieDrivers( "MovieDrivers", "" ); // "" == default -static void DumpAVIDebugInfo( const RString& fn ); -/* Try drivers in order of preference until we find one that works. */ -static LocalizedString MOVIE_DRIVERS_EMPTY ( "Arch", "Movie Drivers cannot be empty." ); -static LocalizedString COULDNT_CREATE_MOVIE_DRIVER ( "Arch", "Couldn't create a movie driver." ); -RageMovieTexture *MakeRageMovieTexture( RageTextureID ID ) -{ - DumpAVIDebugInfo( ID.filename ); - - RString sDrivers = g_sMovieDrivers; - if( sDrivers.empty() ) - sDrivers = DEFAULT_MOVIE_DRIVER_LIST; - - vector DriversToTry; - split( sDrivers, ",", DriversToTry, true ); - - if( DriversToTry.empty() ) - RageException::Throw( "%s", MOVIE_DRIVERS_EMPTY.GetValue().c_str() ); - - RString Driver; - RageMovieTexture *ret = NULL; - - for( unsigned i=0; ret==NULL && iTrace( "Initializing driver: %s", Driver.c_str() ); -#ifdef USE_MOVIE_TEXTURE_THEORA - if( !Driver.CompareNoCase("Theora") ) ret = new MovieTexture_Theora(ID); -#endif -#ifdef USE_MOVIE_TEXTURE_DSHOW - if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID); -#endif -#ifdef USE_MOVIE_TEXTURE_FFMPEG - if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID); -#endif -#ifdef USE_MOVIE_TEXTURE_NULL - if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID); -#endif - if( ret == NULL ) - { - LOG->Trace( "Unknown movie driver name: %s", Driver.c_str() ); - continue; - } - - RString sError = ret->Init(); - if( sError != "" ) - { - LOG->Info( "Couldn't load driver %s: %s", Driver.c_str(), sError.c_str() ); - SAFE_DELETE( ret ); - } - } - if ( !ret ) - RageException::Throw( "%s", COULDNT_CREATE_MOVIE_DRIVER.GetValue().c_str() ); - - LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"", - ID.filename.c_str(), Driver.c_str() ); - return ret; -} - static LocalizedString SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." ); RageSoundDriver *MakeRageSoundDriver( const RString &drivers ) { @@ -335,16 +177,6 @@ RageSoundDriver *MakeRageSoundDriver( const RString &drivers ) return ret; } -// Helper for MakeRageMovieTexture() -static void DumpAVIDebugInfo( const RString& fn ) -{ - RString type, handler; - if( !RageMovieTexture::GetFourCC( fn, handler, type ) ) - return; - - LOG->Trace( "Movie %s has handler '%s', type '%s'", fn.c_str(), handler.c_str(), type.c_str() ); -} - /* * (c) 2002-2005 Glenn Maynard, Ben Anderson * All rights reserved. diff --git a/stepmania/src/arch/arch_default.h b/stepmania/src/arch/arch_default.h index 8c4c54aacb..4afba7a8f2 100644 --- a/stepmania/src/arch/arch_default.h +++ b/stepmania/src/arch/arch_default.h @@ -4,16 +4,10 @@ /* Define the default driver sets. */ #if defined(_WINDOWS) #include "ArchHooks/ArchHooks_Win32.h" -#include "Dialog/DialogDriver_Win32.h" -#include "InputHandler/InputHandler_DirectInput.h" -#include "InputHandler/InputHandler_Win32_Pump.h" -#include "InputHandler/InputHandler_Win32_Para.h" -#include "InputHandler/InputHandler_Win32_MIDI.h" #include "Lights/LightsDriver_Win32Parallel.h" #include "LoadingWindow/LoadingWindow_Win32.h" #include "LowLevelWindow/LowLevelWindow_Win32.h" #include "MemoryCard/MemoryCardDriverThreaded_Windows.h" -#include "MovieTexture/MovieTexture_DShow.h" #include "Sound/RageSoundDriver_DSound.h" #include "Sound/RageSoundDriver_DSound_Software.h" #include "Sound/RageSoundDriver_WaveOut.h" @@ -24,8 +18,6 @@ #elif defined(MACOSX) #include "ArchHooks/ArchHooks_darwin.h" -#include "Dialog/DialogDriver_Cocoa.h" -#include "InputHandler/InputHandler_Carbon.h" #include "LoadingWindow/LoadingWindow_Cocoa.h" #include "LowLevelWindow/LowLevelWindow_Cocoa.h" #include "MemoryCard/MemoryCardDriverThreaded_OSX.h" @@ -38,7 +30,6 @@ #elif defined(_XBOX) #include "ArchHooks/ArchHooks_Xbox.h" -#include "InputHandler/InputHandler_Xbox.h" #include "LoadingWindow/LoadingWindow_Xbox.h" #include "LowLevelWindow/LowLevelWindow_Win32.h" #include "MemoryCard/MemoryCardDriverThreaded_Windows.h" @@ -54,7 +45,6 @@ #include "LowLevelWindow/LowLevelWindow_X11.h" #if defined(LINUX) -#include "InputHandler/InputHandler_Linux_Joystick.h" #include "Lights/LightsDriver_LinuxWeedTech.h" #include "MemoryCard/MemoryCardDriverThreaded_Linux.h" @@ -63,7 +53,6 @@ #endif #endif -#include "InputHandler/InputHandler_X11.h" #if defined(HAVE_GTK) #include "LoadingWindow/LoadingWindow_Gtk.h" #endif @@ -85,21 +74,10 @@ #error Which arch? #endif - -#ifdef HAVE_THEORA -#include "MovieTexture/MovieTexture_Theora.h" -#endif -#ifdef HAVE_FFMPEG -#include "MovieTexture/MovieTexture_FFMpeg.h" -#endif - /* All use these. */ -#include "Dialog/DialogDriver.h" -#include "InputHandler/InputHandler_MonkeyKeyboard.h" #include "Lights/LightsDriver_SystemMessage.h" #include "Lights/LightsDriver_Null.h" #include "LoadingWindow/LoadingWindow_Null.h" -#include "MovieTexture/MovieTexture_Null.h" #include "Sound/RageSoundDriver_Null.h" #include "MemoryCard/MemoryCardDriver_Null.h"