Move stuff out of arch using a registration system modeled after Screen.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
#include "ArchHooks.h"
|
#include "ArchHooks.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "RageThreads.h"
|
#include "RageThreads.h"
|
||||||
|
#include "arch/arch_default.h"
|
||||||
|
|
||||||
bool ArchHooks::g_bQuitting = false;
|
bool ArchHooks::g_bQuitting = false;
|
||||||
bool ArchHooks::g_bToggleWindowed = false;
|
bool ArchHooks::g_bToggleWindowed = false;
|
||||||
@@ -49,6 +50,12 @@ bool ArchHooks::GoToURL( RString sUrl )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArchHooks *MakeArchHooks()
|
||||||
|
{
|
||||||
|
return new ARCH_HOOKS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2003-2004 Glenn Maynard, Chris Danford
|
* (c) 2003-2004 Glenn Maynard, Chris Danford
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace Dialog
|
|||||||
|
|
||||||
/* for DialogDrivers */
|
/* for DialogDrivers */
|
||||||
void IgnoreMessage( RString sID );
|
void IgnoreMessage( RString sID );
|
||||||
};
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,76 @@
|
|||||||
|
#include "global.h"
|
||||||
|
#include "DialogDriver.h"
|
||||||
|
#include "Foreach.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
|
||||||
|
map<istring, CreateDialogDriverFn> *RegisterDialogDriver::g_pRegistrees;
|
||||||
|
RegisterDialogDriver::RegisterDialogDriver( const istring &sName, CreateDialogDriverFn pfn )
|
||||||
|
{
|
||||||
|
if( g_pRegistrees == NULL )
|
||||||
|
g_pRegistrees = new map<istring, CreateDialogDriverFn>;
|
||||||
|
|
||||||
|
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<RString> asDriversToTry;
|
||||||
|
split( sDrivers, ",", asDriversToTry, true );
|
||||||
|
|
||||||
|
ASSERT( asDriversToTry.size() != 0 );
|
||||||
|
|
||||||
|
RString sDriver;
|
||||||
|
DialogDriver *pRet = NULL;
|
||||||
|
|
||||||
|
FOREACH_CONST( RString, asDriversToTry, Driver )
|
||||||
|
{
|
||||||
|
map<istring, CreateDialogDriverFn>::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.
|
||||||
|
*/
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
#define DIALOG_BOX_DRIVER_H
|
#define DIALOG_BOX_DRIVER_H
|
||||||
|
|
||||||
#include "Dialog.h"
|
#include "Dialog.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
|
||||||
class DialogDriver
|
class DialogDriver
|
||||||
{
|
{
|
||||||
@@ -14,9 +15,18 @@ public:
|
|||||||
virtual RString Init() { return RString(); }
|
virtual RString Init() { return RString(); }
|
||||||
virtual ~DialogDriver() { }
|
virtual ~DialogDriver() { }
|
||||||
};
|
};
|
||||||
|
class DialogDriver_Null : public DialogDriver { };
|
||||||
|
|
||||||
|
typedef DialogDriver *(*CreateDialogDriverFn)();
|
||||||
|
struct RegisterDialogDriver
|
||||||
|
{
|
||||||
|
static map<istring, CreateDialogDriverFn> *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
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,8 @@
|
|||||||
#include "InputFilter.h"
|
#include "InputFilter.h"
|
||||||
#include <Carbon/Carbon.h>
|
#include <Carbon/Carbon.h>
|
||||||
|
|
||||||
|
REGISTER_DIALOG_DRIVER_CLASS( Cocoa );
|
||||||
|
|
||||||
static CFOptionFlags ShowAlert( CFOptionFlags flags, const RString& sMessage, CFStringRef OK,
|
static CFOptionFlags ShowAlert( CFOptionFlags flags, const RString& sMessage, CFStringRef OK,
|
||||||
CFStringRef alt = NULL, CFStringRef other = NULL)
|
CFStringRef alt = NULL, CFStringRef other = NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ public:
|
|||||||
Dialog::Result AbortRetryIgnore( RString sMessage, RString sID );
|
Dialog::Result AbortRetryIgnore( RString sMessage, RString sID );
|
||||||
Dialog::Result AbortRetry( RString sMessage, RString sID );
|
Dialog::Result AbortRetry( RString sMessage, RString sID );
|
||||||
};
|
};
|
||||||
#define USE_DIALOG_DRIVER_COCOA
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
#include "InputHandler.h"
|
#include "InputHandler.h"
|
||||||
#include "RageLog.h"
|
#include "RageLog.h"
|
||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
|
#include "arch/arch_default.h"
|
||||||
|
#include "InputHandler_MonkeyKeyboard.h"
|
||||||
|
#include "Foreach.h"
|
||||||
|
|
||||||
void InputHandler::UpdateTimer()
|
void InputHandler::UpdateTimer()
|
||||||
{
|
{
|
||||||
@@ -159,6 +162,45 @@ RString InputHandler::GetLocalizedInputString( const DeviceInput &di )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map<istring, CreateInputHandlerFn> *RegisterInputHandler::g_pRegistrees;
|
||||||
|
RegisterInputHandler::RegisterInputHandler( const istring &sName, CreateInputHandlerFn pfn )
|
||||||
|
{
|
||||||
|
if( g_pRegistrees == NULL )
|
||||||
|
g_pRegistrees = new map<istring, CreateInputHandlerFn>;
|
||||||
|
|
||||||
|
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<InputHandler *> &Add )
|
||||||
|
{
|
||||||
|
const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_;
|
||||||
|
vector<RString> DriversToTry;
|
||||||
|
split( drivers, ",", DriversToTry, true );
|
||||||
|
|
||||||
|
if( DriversToTry.empty() )
|
||||||
|
RageException::Throw( "%s", INPUT_HANDLERS_EMPTY.GetValue().c_str() );
|
||||||
|
|
||||||
|
FOREACH_CONST( RString, DriversToTry, s )
|
||||||
|
{
|
||||||
|
map<istring, CreateInputHandlerFn>::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
|
* (c) 2003-2004 Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -68,6 +68,18 @@ private:
|
|||||||
int m_iInputsSinceUpdate;
|
int m_iInputsSinceUpdate;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef InputHandler *(*CreateInputHandlerFn)();
|
||||||
|
struct RegisterInputHandler
|
||||||
|
{
|
||||||
|
static map<istring, CreateInputHandlerFn> *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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -13,6 +13,8 @@
|
|||||||
#include "archutils/Darwin/PumpDevice.h"
|
#include "archutils/Darwin/PumpDevice.h"
|
||||||
#include <IOKit/IOMessage.h>
|
#include <IOKit/IOMessage.h>
|
||||||
|
|
||||||
|
REGISTER_INPUT_HANDLER_CLASS( Carbon );
|
||||||
|
|
||||||
void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon, void *sender )
|
void InputHandler_Carbon::QueueCallBack( void *target, int result, void *refcon, void *sender )
|
||||||
{
|
{
|
||||||
// The result seems useless as you can't actually return anything...
|
// The result seems useless as you can't actually return anything...
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ public:
|
|||||||
static void QueueCallBack( void *target, int result, void *refcon, void *sender );
|
static void QueueCallBack( void *target, int result, void *refcon, void *sender );
|
||||||
|
|
||||||
};
|
};
|
||||||
#define USE_INPUT_HANDLER_CARBON
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ private:
|
|||||||
RageTimer m_timerPressButton;
|
RageTimer m_timerPressButton;
|
||||||
DeviceInput m_diLast; // Last input that we sent
|
DeviceInput m_diLast; // Last input that we sent
|
||||||
};
|
};
|
||||||
#define USE_INPUT_HANDLER_MONKEY_KEYBOARD
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,9 @@
|
|||||||
#include "MovieTexture_Null.h"
|
#include "MovieTexture_Null.h"
|
||||||
#include "PrefsManager.h"
|
#include "PrefsManager.h"
|
||||||
#include "RageFile.h"
|
#include "RageFile.h"
|
||||||
|
#include "LocalizedString.h"
|
||||||
|
#include "Foreach.h"
|
||||||
|
#include "arch_default.h"
|
||||||
|
|
||||||
void ForceToAscii( RString &str )
|
void ForceToAscii( RString &str )
|
||||||
{
|
{
|
||||||
@@ -54,6 +57,76 @@ bool RageMovieTexture::GetFourCC( RString fn, RString &handler, RString &type )
|
|||||||
#undef HANDLE_ERROR
|
#undef HANDLE_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
map<istring, CreateMovieTextureFn> *RegisterMovieTexture::g_pRegistrees = NULL;
|
||||||
|
RegisterMovieTexture::RegisterMovieTexture( const istring &sName, CreateMovieTextureFn pfn )
|
||||||
|
{
|
||||||
|
if( g_pRegistrees == NULL )
|
||||||
|
g_pRegistrees = new map<istring, CreateMovieTextureFn>;
|
||||||
|
|
||||||
|
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<RString> 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<RString> 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<istring, CreateMovieTextureFn>::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
|
* (c) 2003-2004 Glenn Maynard
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#define MOVIE_TEXTURE_H
|
#define MOVIE_TEXTURE_H
|
||||||
|
|
||||||
#include "RageTexture.h"
|
#include "RageTexture.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
class RageMovieTexture : public RageTexture
|
class RageMovieTexture : public RageTexture
|
||||||
{
|
{
|
||||||
@@ -22,6 +23,16 @@ public:
|
|||||||
static bool GetFourCC( RString fn, RString &handler, RString &type );
|
static bool GetFourCC( RString fn, RString &handler, RString &type );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef RageMovieTexture *(*CreateMovieTextureFn)( RageTextureID );
|
||||||
|
struct RegisterMovieTexture
|
||||||
|
{
|
||||||
|
static map<istring, CreateMovieTextureFn> *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
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
|
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
|
||||||
|
REGISTER_MOVIE_TEXTURE_CLASS( FFMpeg );
|
||||||
|
|
||||||
namespace avcodec
|
namespace avcodec
|
||||||
{
|
{
|
||||||
#include <ffmpeg/avformat.h>
|
#include <ffmpeg/avformat.h>
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ public:
|
|||||||
static void RegisterProtocols();
|
static void RegisterProtocols();
|
||||||
static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt );
|
static RageSurface *AVCodecCreateCompatibleSurface( int iTextureWidth, int iTextureHeight, bool bPreferHighColor, int &iAVTexfmt );
|
||||||
};
|
};
|
||||||
#define USE_MOVIE_TEXTURE_FFMPEG
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include "MovieTexture_Null.h"
|
#include "MovieTexture_Null.h"
|
||||||
#include "RageSurface.h"
|
#include "RageSurface.h"
|
||||||
|
|
||||||
|
REGISTER_MOVIE_TEXTURE_CLASS( Null );
|
||||||
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
|
MovieTexture_Null::MovieTexture_Null(RageTextureID ID) : RageMovieTexture(ID)
|
||||||
{
|
{
|
||||||
LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)");
|
LOG->Trace("MovieTexture_Null::MovieTexture_Null(ID)");
|
||||||
|
|||||||
@@ -29,7 +29,6 @@ private:
|
|||||||
bool loop;
|
bool loop;
|
||||||
unsigned texHandle;
|
unsigned texHandle;
|
||||||
};
|
};
|
||||||
#define USE_MOVIE_TEXTURE_NULL
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,8 @@
|
|||||||
#include "RageUtil.h"
|
#include "RageUtil.h"
|
||||||
#include "MovieTexture_FFMpeg.h" /* for AVCodecCreateCompatibleSurface */
|
#include "MovieTexture_FFMpeg.h" /* for AVCodecCreateCompatibleSurface */
|
||||||
|
|
||||||
|
REGISTER_MOVIE_TEXTURE_CLASS( Theora );
|
||||||
|
|
||||||
namespace avcodec
|
namespace avcodec
|
||||||
{
|
{
|
||||||
#include <ffmpeg/avcodec.h> /* for avcodec::img_convert */
|
#include <ffmpeg/avcodec.h> /* for avcodec::img_convert */
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ class MovieTexture_Theora: public MovieTexture_Generic
|
|||||||
public:
|
public:
|
||||||
MovieTexture_Theora( RageTextureID ID );
|
MovieTexture_Theora( RageTextureID ID );
|
||||||
};
|
};
|
||||||
#define USE_MOVIE_TEXTURE_THEORA
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -11,105 +11,6 @@
|
|||||||
#include "LocalizedString.h"
|
#include "LocalizedString.h"
|
||||||
#include "arch_default.h"
|
#include "arch_default.h"
|
||||||
|
|
||||||
ArchHooks *MakeArchHooks()
|
|
||||||
{
|
|
||||||
return new ARCH_HOOKS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DialogDriver *MakeDialogDriver()
|
|
||||||
{
|
|
||||||
RString sDrivers = "win32,cocoa,null";
|
|
||||||
vector<RString> 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<InputHandler *> &Add )
|
|
||||||
{
|
|
||||||
const RString drivers = drivers_.empty()? RString(DEFAULT_INPUT_DRIVER_LIST):drivers_;
|
|
||||||
vector<RString> 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<LightsDriver *> &Add )
|
void MakeLightsDrivers( const RString &driver, vector<LightsDriver *> &Add )
|
||||||
{
|
{
|
||||||
@@ -211,65 +112,6 @@ MemoryCardDriver *MakeMemoryCardDriver()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Preference<RString> 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<RString> 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 && i<DriversToTry.size(); ++i )
|
|
||||||
{
|
|
||||||
Driver = DriversToTry[i];
|
|
||||||
LOG->Trace( "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." );
|
static LocalizedString SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." );
|
||||||
RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
|
RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
|
||||||
{
|
{
|
||||||
@@ -335,16 +177,6 @@ RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
|
|||||||
return ret;
|
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
|
* (c) 2002-2005 Glenn Maynard, Ben Anderson
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
|||||||
@@ -4,16 +4,10 @@
|
|||||||
/* Define the default driver sets. */
|
/* Define the default driver sets. */
|
||||||
#if defined(_WINDOWS)
|
#if defined(_WINDOWS)
|
||||||
#include "ArchHooks/ArchHooks_Win32.h"
|
#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 "Lights/LightsDriver_Win32Parallel.h"
|
||||||
#include "LoadingWindow/LoadingWindow_Win32.h"
|
#include "LoadingWindow/LoadingWindow_Win32.h"
|
||||||
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
||||||
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h"
|
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h"
|
||||||
#include "MovieTexture/MovieTexture_DShow.h"
|
|
||||||
#include "Sound/RageSoundDriver_DSound.h"
|
#include "Sound/RageSoundDriver_DSound.h"
|
||||||
#include "Sound/RageSoundDriver_DSound_Software.h"
|
#include "Sound/RageSoundDriver_DSound_Software.h"
|
||||||
#include "Sound/RageSoundDriver_WaveOut.h"
|
#include "Sound/RageSoundDriver_WaveOut.h"
|
||||||
@@ -24,8 +18,6 @@
|
|||||||
|
|
||||||
#elif defined(MACOSX)
|
#elif defined(MACOSX)
|
||||||
#include "ArchHooks/ArchHooks_darwin.h"
|
#include "ArchHooks/ArchHooks_darwin.h"
|
||||||
#include "Dialog/DialogDriver_Cocoa.h"
|
|
||||||
#include "InputHandler/InputHandler_Carbon.h"
|
|
||||||
#include "LoadingWindow/LoadingWindow_Cocoa.h"
|
#include "LoadingWindow/LoadingWindow_Cocoa.h"
|
||||||
#include "LowLevelWindow/LowLevelWindow_Cocoa.h"
|
#include "LowLevelWindow/LowLevelWindow_Cocoa.h"
|
||||||
#include "MemoryCard/MemoryCardDriverThreaded_OSX.h"
|
#include "MemoryCard/MemoryCardDriverThreaded_OSX.h"
|
||||||
@@ -38,7 +30,6 @@
|
|||||||
|
|
||||||
#elif defined(_XBOX)
|
#elif defined(_XBOX)
|
||||||
#include "ArchHooks/ArchHooks_Xbox.h"
|
#include "ArchHooks/ArchHooks_Xbox.h"
|
||||||
#include "InputHandler/InputHandler_Xbox.h"
|
|
||||||
#include "LoadingWindow/LoadingWindow_Xbox.h"
|
#include "LoadingWindow/LoadingWindow_Xbox.h"
|
||||||
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
#include "LowLevelWindow/LowLevelWindow_Win32.h"
|
||||||
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h"
|
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h"
|
||||||
@@ -54,7 +45,6 @@
|
|||||||
#include "LowLevelWindow/LowLevelWindow_X11.h"
|
#include "LowLevelWindow/LowLevelWindow_X11.h"
|
||||||
|
|
||||||
#if defined(LINUX)
|
#if defined(LINUX)
|
||||||
#include "InputHandler/InputHandler_Linux_Joystick.h"
|
|
||||||
#include "Lights/LightsDriver_LinuxWeedTech.h"
|
#include "Lights/LightsDriver_LinuxWeedTech.h"
|
||||||
#include "MemoryCard/MemoryCardDriverThreaded_Linux.h"
|
#include "MemoryCard/MemoryCardDriverThreaded_Linux.h"
|
||||||
|
|
||||||
@@ -63,7 +53,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "InputHandler/InputHandler_X11.h"
|
|
||||||
#if defined(HAVE_GTK)
|
#if defined(HAVE_GTK)
|
||||||
#include "LoadingWindow/LoadingWindow_Gtk.h"
|
#include "LoadingWindow/LoadingWindow_Gtk.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -85,21 +74,10 @@
|
|||||||
#error Which arch?
|
#error Which arch?
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_THEORA
|
|
||||||
#include "MovieTexture/MovieTexture_Theora.h"
|
|
||||||
#endif
|
|
||||||
#ifdef HAVE_FFMPEG
|
|
||||||
#include "MovieTexture/MovieTexture_FFMpeg.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* All use these. */
|
/* All use these. */
|
||||||
#include "Dialog/DialogDriver.h"
|
|
||||||
#include "InputHandler/InputHandler_MonkeyKeyboard.h"
|
|
||||||
#include "Lights/LightsDriver_SystemMessage.h"
|
#include "Lights/LightsDriver_SystemMessage.h"
|
||||||
#include "Lights/LightsDriver_Null.h"
|
#include "Lights/LightsDriver_Null.h"
|
||||||
#include "LoadingWindow/LoadingWindow_Null.h"
|
#include "LoadingWindow/LoadingWindow_Null.h"
|
||||||
#include "MovieTexture/MovieTexture_Null.h"
|
|
||||||
#include "Sound/RageSoundDriver_Null.h"
|
#include "Sound/RageSoundDriver_Null.h"
|
||||||
#include "MemoryCard/MemoryCardDriver_Null.h"
|
#include "MemoryCard/MemoryCardDriver_Null.h"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user