some more changes and additions
This commit is contained in:
@@ -1867,10 +1867,18 @@
|
|||||||
<Filter
|
<Filter
|
||||||
Name="arch"
|
Name="arch"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\arch\arch.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="arch\arch_default.h"
|
RelativePath="arch\arch_default.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\arch\arch_platform.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\arch\RageDriver.cpp"
|
RelativePath=".\arch\RageDriver.cpp"
|
||||||
>
|
>
|
||||||
@@ -2302,6 +2310,10 @@
|
|||||||
RelativePath="arch\Dialog\DialogDriver_Win32.h"
|
RelativePath="arch\Dialog\DialogDriver_Win32.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\arch\Dialog\Selector_Dialog.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Threads"
|
Name="Threads"
|
||||||
|
|||||||
+1
-1
@@ -989,7 +989,7 @@ int main(int argc, char* argv[])
|
|||||||
* so ArchHooks can use a preference to turn this off. We want to do this before ApplyLogPreferences,
|
* so ArchHooks can use a preference to turn this off. We want to do this before ApplyLogPreferences,
|
||||||
* so if we exit because of another instance, we don't try to clobber its log. We also want to
|
* so if we exit because of another instance, we don't try to clobber its log. We also want to
|
||||||
* do this before opening the loading window, so if we give focus away, we don't flash the window. */
|
* do this before opening the loading window, so if we give focus away, we don't flash the window. */
|
||||||
if( !g_bAllowMultipleInstances.Get() && HOOKS->CheckForMultipleInstances() )
|
if(!g_bAllowMultipleInstances.Get() && HOOKS->CheckForMultipleInstances(argc, argv))
|
||||||
{
|
{
|
||||||
ShutdownGame();
|
ShutdownGame();
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Dialog
|
|||||||
|
|
||||||
void SetWindowed( bool bWindowed );
|
void SetWindowed( bool bWindowed );
|
||||||
|
|
||||||
enum Result { abort, retry, ignore };
|
enum Result { ok, cancel, abort, retry, ignore };
|
||||||
void Error( RString sError, RString sID = "" );
|
void Error( RString sError, RString sID = "" );
|
||||||
void OK( RString sMessage, RString sID = "" );
|
void OK( RString sMessage, RString sID = "" );
|
||||||
Result OKCancel( RString sMessage, RString sID = "" );
|
Result OKCancel( RString sMessage, RString sID = "" );
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
#ifndef SELECTOR_DIALOG
|
||||||
|
#define SELECTOR_DIALOG
|
||||||
|
|
||||||
|
#include "arch/arch_platform.h"
|
||||||
|
|
||||||
|
// Dialog drivers selector.
|
||||||
|
#if defined(WIN32)
|
||||||
|
#include "DialogDriver_Win32.h"
|
||||||
|
|
||||||
|
#elif defined(MACOSX)
|
||||||
|
#include "DialogDriver_Cocoa.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "DialogDriver.h" // DialogDriver_Null is in here
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2005 Ben Anderson.
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
@@ -22,7 +22,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
|
|||||||
{
|
{
|
||||||
sLine += ssprintf( " %s", lpcstrModule );
|
sLine += ssprintf( " %s", lpcstrModule );
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
RString sPath = FindSystemFile( lpcstrModule );
|
RString sPath = FindSystemFile( lpcstrModule );
|
||||||
if( sPath != "" )
|
if( sPath != "" )
|
||||||
{
|
{
|
||||||
@@ -30,7 +29,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
|
|||||||
if( GetFileVersion(sPath, sVersion) )
|
if( GetFileVersion(sPath, sVersion) )
|
||||||
sLine += ssprintf( " %s", sVersion.c_str() );
|
sLine += ssprintf( " %s", sVersion.c_str() );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG->Info( "%s", sLine.c_str() );
|
LOG->Info( "%s", sLine.c_str() );
|
||||||
@@ -40,7 +38,6 @@ BOOL CALLBACK DSound::EnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription, LPC
|
|||||||
|
|
||||||
void DSound::SetPrimaryBufferMode()
|
void DSound::SetPrimaryBufferMode()
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
|
||||||
DSBUFFERDESC format;
|
DSBUFFERDESC format;
|
||||||
memset( &format, 0, sizeof(format) );
|
memset( &format, 0, sizeof(format) );
|
||||||
format.dwSize = sizeof(format);
|
format.dwSize = sizeof(format);
|
||||||
@@ -96,7 +93,6 @@ void DSound::SetPrimaryBufferMode()
|
|||||||
// pBuffer->Play( 0, 0, DSBPLAY_LOOPING );
|
// pBuffer->Play( 0, 0, DSBPLAY_LOOPING );
|
||||||
|
|
||||||
pBuffer->Release();
|
pBuffer->Release();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DSound::DSound()
|
DSound::DSound()
|
||||||
@@ -113,7 +109,6 @@ RString DSound::Init()
|
|||||||
if( FAILED( hr = DirectSoundCreate(NULL, &m_pDS, NULL) ) )
|
if( FAILED( hr = DirectSoundCreate(NULL, &m_pDS, NULL) ) )
|
||||||
return hr_ssprintf( hr, "DirectSoundCreate" );
|
return hr_ssprintf( hr, "DirectSoundCreate" );
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
static bool bShownInfo = false;
|
static bool bShownInfo = false;
|
||||||
if( !bShownInfo )
|
if( !bShownInfo )
|
||||||
{
|
{
|
||||||
@@ -136,7 +131,6 @@ RString DSound::Init()
|
|||||||
|
|
||||||
/* Try to set primary mixing privileges */
|
/* Try to set primary mixing privileges */
|
||||||
hr = m_pDS->SetCooperativeLevel( GetDesktopWindow(), DSSCL_PRIORITY );
|
hr = m_pDS->SetCooperativeLevel( GetDesktopWindow(), DSSCL_PRIORITY );
|
||||||
#endif
|
|
||||||
|
|
||||||
SetPrimaryBufferMode();
|
SetPrimaryBufferMode();
|
||||||
|
|
||||||
@@ -152,7 +146,6 @@ DSound::~DSound()
|
|||||||
|
|
||||||
bool DSound::IsEmulated() const
|
bool DSound::IsEmulated() const
|
||||||
{
|
{
|
||||||
#ifndef _XBOX
|
|
||||||
/* Don't bother wasting time trying to create buffers if we're
|
/* Don't bother wasting time trying to create buffers if we're
|
||||||
* emulated. This also gives us better diagnostic information. */
|
* emulated. This also gives us better diagnostic information. */
|
||||||
DSCAPS Caps;
|
DSCAPS Caps;
|
||||||
@@ -166,9 +159,6 @@ bool DSound::IsEmulated() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
return !!(Caps.dwFlags & DSCAPS_EMULDRIVER);
|
return !!(Caps.dwFlags & DSCAPS_EMULDRIVER);
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DSoundBuf::DSoundBuf()
|
DSoundBuf::DSoundBuf()
|
||||||
@@ -220,45 +210,21 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
|
|||||||
DSBUFFERDESC format;
|
DSBUFFERDESC format;
|
||||||
memset( &format, 0, sizeof(format) );
|
memset( &format, 0, sizeof(format) );
|
||||||
format.dwSize = sizeof(format);
|
format.dwSize = sizeof(format);
|
||||||
#ifdef _XBOX
|
|
||||||
format.dwFlags = 0;
|
|
||||||
#else
|
|
||||||
format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME;
|
format.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_GLOBALFOCUS | DSBCAPS_CTRLVOLUME;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
/* Don't use DSBCAPS_STATIC. It's meant for static buffers, and we
|
/* Don't use DSBCAPS_STATIC. It's meant for static buffers, and we
|
||||||
* only use streaming buffers. */
|
* only use streaming buffers. */
|
||||||
if( hardware == HW_HARDWARE )
|
if( hardware == HW_HARDWARE )
|
||||||
format.dwFlags |= DSBCAPS_LOCHARDWARE;
|
format.dwFlags |= DSBCAPS_LOCHARDWARE;
|
||||||
else
|
else
|
||||||
format.dwFlags |= DSBCAPS_LOCSOFTWARE;
|
format.dwFlags |= DSBCAPS_LOCSOFTWARE;
|
||||||
#endif
|
|
||||||
|
|
||||||
if( bNeedCtrlFrequency )
|
if( bNeedCtrlFrequency )
|
||||||
format.dwFlags |= DSBCAPS_CTRLFREQUENCY;
|
format.dwFlags |= DSBCAPS_CTRLFREQUENCY;
|
||||||
|
|
||||||
format.dwBufferBytes = m_iBufferSize;
|
format.dwBufferBytes = m_iBufferSize;
|
||||||
#ifndef _XBOX
|
|
||||||
format.dwReserved = 0;
|
|
||||||
#else
|
|
||||||
DSMIXBINVOLUMEPAIR dsmbvp[8] =
|
|
||||||
{
|
|
||||||
{ DSMIXBIN_FRONT_LEFT, DSBVOLUME_MAX }, // left channel
|
|
||||||
{ DSMIXBIN_FRONT_RIGHT, DSBVOLUME_MAX }, // right channel
|
|
||||||
{ DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX }, // left channel
|
|
||||||
{ DSMIXBIN_FRONT_CENTER, DSBVOLUME_MAX }, // right channel
|
|
||||||
{ DSMIXBIN_BACK_LEFT, DSBVOLUME_MAX }, // left channel
|
|
||||||
{ DSMIXBIN_BACK_RIGHT, DSBVOLUME_MAX }, // right channel
|
|
||||||
{ DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX }, // left channel
|
|
||||||
{ DSMIXBIN_LOW_FREQUENCY, DSBVOLUME_MAX } // right channel
|
|
||||||
};
|
|
||||||
DSMIXBINS dsmb;
|
|
||||||
dsmb.dwMixBinCount = 8;
|
|
||||||
dsmb.lpMixBinVolumePairs = dsmbvp;
|
|
||||||
|
|
||||||
format.lpMixBins = &dsmb;
|
format.dwReserved = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
format.lpwfxFormat = &waveformat;
|
format.lpwfxFormat = &waveformat;
|
||||||
|
|
||||||
@@ -266,7 +232,6 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
|
|||||||
if( FAILED(hr) )
|
if( FAILED(hr) )
|
||||||
return hr_ssprintf( hr, "CreateSoundBuffer failed (%i hz)", m_iSampleBits );
|
return hr_ssprintf( hr, "CreateSoundBuffer failed (%i hz)", m_iSampleBits );
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
/* I'm not sure this should ever be needed, but ... */
|
/* I'm not sure this should ever be needed, but ... */
|
||||||
DSBCAPS bcaps;
|
DSBCAPS bcaps;
|
||||||
bcaps.dwSize=sizeof(bcaps);
|
bcaps.dwSize=sizeof(bcaps);
|
||||||
@@ -291,7 +256,6 @@ RString DSoundBuf::Init( DSound &ds, DSoundBuf::hw hardware,
|
|||||||
LOG->Warn( hr_ssprintf(hr, "GetFormat on secondary buffer") );
|
LOG->Warn( hr_ssprintf(hr, "GetFormat on secondary buffer") );
|
||||||
else if( (int) waveformat.nSamplesPerSec != m_iSampleRate )
|
else if( (int) waveformat.nSamplesPerSec != m_iSampleRate )
|
||||||
LOG->Warn( "Secondary buffer set to %i instead of %i", waveformat.nSamplesPerSec, m_iSampleRate );
|
LOG->Warn( "Secondary buffer set to %i instead of %i", waveformat.nSamplesPerSec, m_iSampleRate );
|
||||||
#endif
|
|
||||||
|
|
||||||
m_pTempBuffer = new char[m_iBufferSize];
|
m_pTempBuffer = new char[m_iBufferSize];
|
||||||
|
|
||||||
@@ -456,7 +420,6 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
|
|||||||
/* It's easiest to think of the cursor as a block, starting and ending at
|
/* It's easiest to think of the cursor as a block, starting and ending at
|
||||||
* the two values returned by GetCurrentPosition, that we can't write to. */
|
* the two values returned by GetCurrentPosition, that we can't write to. */
|
||||||
result = m_pBuffer->GetCurrentPosition( &iCursorStart, &iCursorEnd );
|
result = m_pBuffer->GetCurrentPosition( &iCursorStart, &iCursorEnd );
|
||||||
#ifndef _XBOX
|
|
||||||
if( result == DSERR_BUFFERLOST )
|
if( result == DSERR_BUFFERLOST )
|
||||||
{
|
{
|
||||||
m_pBuffer->Restore();
|
m_pBuffer->Restore();
|
||||||
@@ -467,7 +430,6 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
|
|||||||
LOG->Warn( hr_ssprintf(result, "DirectSound::GetCurrentPosition failed") );
|
LOG->Warn( hr_ssprintf(result, "DirectSound::GetCurrentPosition failed") );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
memmove( &m_iLastCursors[0][0], &m_iLastCursors[1][0], sizeof(int)*6 );
|
memmove( &m_iLastCursors[0][0], &m_iLastCursors[1][0], sizeof(int)*6 );
|
||||||
m_iLastCursors[3][0] = iCursorStart;
|
m_iLastCursors[3][0] = iCursorStart;
|
||||||
@@ -552,13 +514,12 @@ bool DSoundBuf::get_output_buf( char **pBuffer, unsigned *pBufferSize, int iChun
|
|||||||
/* Lock the audio buffer. */
|
/* Lock the audio buffer. */
|
||||||
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
|
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
if( result == DSERR_BUFFERLOST )
|
if( result == DSERR_BUFFERLOST )
|
||||||
{
|
{
|
||||||
m_pBuffer->Restore();
|
m_pBuffer->Restore();
|
||||||
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
|
result = m_pBuffer->Lock( m_iWriteCursor, iNumBytesEmpty, (LPVOID *) &m_pLockedBuf1, (DWORD *) &m_iLockedSize1, (LPVOID *) &m_pLockedBuf2, (DWORD *) &m_iLockedSize2, 0 );
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
if( result != DS_OK )
|
if( result != DS_OK )
|
||||||
{
|
{
|
||||||
LOG->Warn( hr_ssprintf(result, "Couldn't lock the DirectSound buffer.") );
|
LOG->Warn( hr_ssprintf(result, "Couldn't lock the DirectSound buffer.") );
|
||||||
@@ -593,7 +554,6 @@ int64_t DSoundBuf::GetPosition() const
|
|||||||
DWORD iCursor, iJunk;
|
DWORD iCursor, iJunk;
|
||||||
HRESULT hr = m_pBuffer->GetCurrentPosition( &iCursor, &iJunk );
|
HRESULT hr = m_pBuffer->GetCurrentPosition( &iCursor, &iJunk );
|
||||||
|
|
||||||
#ifndef _XBOX
|
|
||||||
if( hr == DSERR_BUFFERLOST )
|
if( hr == DSERR_BUFFERLOST )
|
||||||
{
|
{
|
||||||
m_pBuffer->Restore();
|
m_pBuffer->Restore();
|
||||||
@@ -604,7 +564,6 @@ int64_t DSoundBuf::GetPosition() const
|
|||||||
LOG->Warn( hr_ssprintf(hr, "DirectSound::GetPosition failed") );
|
LOG->Warn( hr_ssprintf(hr, "DirectSound::GetPosition failed") );
|
||||||
iCursor = 0;
|
iCursor = 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/* This happens occasionally on "Realtek AC97 Audio". */
|
/* This happens occasionally on "Realtek AC97 Audio". */
|
||||||
if( (int) iCursor == m_iBufferSize )
|
if( (int) iCursor == m_iBufferSize )
|
||||||
|
|||||||
@@ -0,0 +1,334 @@
|
|||||||
|
/*
|
||||||
|
* This file provides functions to create driver objects.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "global.h"
|
||||||
|
#include "RageLog.h"
|
||||||
|
#include "RageUtil.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
#include "arch.h"
|
||||||
|
#include "arch_platform.h"
|
||||||
|
#include "Foreach.h"
|
||||||
|
#include "LocalizedString.h"
|
||||||
|
#include "arch/arch_default.h"
|
||||||
|
|
||||||
|
#include "InputHandler/Selector_InputHandler.h"
|
||||||
|
static LocalizedString INPUT_HANDLERS_EMPTY( "Arch", "Input Handlers cannot be empty." );
|
||||||
|
void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add )
|
||||||
|
{
|
||||||
|
vector<RString> DriversToTry;
|
||||||
|
split( drivers, ",", DriversToTry, true );
|
||||||
|
|
||||||
|
if( DriversToTry.empty() )
|
||||||
|
RageException::Throw( INPUT_HANDLERS_EMPTY.GetValue() );
|
||||||
|
|
||||||
|
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_SDL
|
||||||
|
if( !s->CompareNoCase("SDL") ) ret = new InputHandler_SDL;
|
||||||
|
#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_MACOSX_HID
|
||||||
|
if( !s->CompareNoCase("MacOSX") ) ret = new InputHandler_MacOSX_HID;
|
||||||
|
#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 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Lights/Selector_LightsDriver.h"
|
||||||
|
void MakeLightsDrivers( const RString &driver, vector<LightsDriver *> &Add )
|
||||||
|
{
|
||||||
|
LOG->Trace( "Initializing lights driver: %s", driver.c_str() );
|
||||||
|
|
||||||
|
LightsDriver *ret = NULL;
|
||||||
|
|
||||||
|
#ifdef USE_LIGHTS_DRIVER_LINUX_PARALLEL
|
||||||
|
if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LIGHTS_DRIVER_LINUX_WEEDTECH
|
||||||
|
if( !driver.CompareNoCase("WeedTech") ) ret = new LightsDriver_LinuxWeedTech;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LIGHTS_DRIVER_WIN32_PARALLEL
|
||||||
|
if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( ret == NULL && driver.CompareNoCase("Null") )
|
||||||
|
LOG->Trace( "Unknown lights driver name: %s", driver.c_str() );
|
||||||
|
else if( ret != NULL )
|
||||||
|
Add.push_back( ret );
|
||||||
|
|
||||||
|
Add.push_back( new LightsDriver_SystemMessage );
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "LoadingWindow/Selector_LoadingWindow.h"
|
||||||
|
LoadingWindow *MakeLoadingWindow()
|
||||||
|
{
|
||||||
|
if( !PREFSMAN->m_bShowLoadingWindow )
|
||||||
|
return new LoadingWindow_Null;
|
||||||
|
#if defined(LINUX) && !defined(HAVE_GTK)
|
||||||
|
return new LoadingWindow_Null;
|
||||||
|
#endif
|
||||||
|
// Don't load NULL by default.
|
||||||
|
const RString drivers = "xbox,win32,cocoa,gtk";
|
||||||
|
vector<RString> DriversToTry;
|
||||||
|
split( drivers, ",", DriversToTry, true );
|
||||||
|
|
||||||
|
ASSERT( DriversToTry.size() != 0 );
|
||||||
|
|
||||||
|
RString Driver;
|
||||||
|
LoadingWindow *ret = NULL;
|
||||||
|
|
||||||
|
for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i )
|
||||||
|
{
|
||||||
|
Driver = DriversToTry[i];
|
||||||
|
|
||||||
|
#ifdef USE_LOADING_WINDOW_COCOA
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Cocoa") ) ret = new LoadingWindow_Cocoa;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LOADING_WINDOW_GTK
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Gtk") ) ret = new LoadingWindow_Gtk;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LOADING_WINDOW_NULL
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new LoadingWindow_Null;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LOADING_WINDOW_WIN32
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Win32") ) ret = new LoadingWindow_Win32;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_LOADING_WINDOW_XBOX
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Xbox") ) ret = new LoadingWindow_Xbox;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
if( ret == NULL )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
RString sError = ret->Init();
|
||||||
|
if( sError != "" )
|
||||||
|
{
|
||||||
|
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
|
||||||
|
SAFE_DELETE( ret );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ret)
|
||||||
|
LOG->Info( "Loading window: %s", Driver.c_str() );
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(SUPPORT_OPENGL)
|
||||||
|
#include "LowLevelWindow/Selector_LowLevelWindow.h"
|
||||||
|
LowLevelWindow *MakeLowLevelWindow()
|
||||||
|
{
|
||||||
|
return new ARCH_LOW_LEVEL_WINDOW;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "MemoryCard/MemoryCardDriver_Null.h"
|
||||||
|
#include "MemoryCard/Selector_MemoryCardDriver.h"
|
||||||
|
MemoryCardDriver *MakeMemoryCardDriver()
|
||||||
|
{
|
||||||
|
MemoryCardDriver *ret = NULL;
|
||||||
|
|
||||||
|
#ifdef ARCH_MEMORY_CARD_DRIVER
|
||||||
|
ret = new ARCH_MEMORY_CARD_DRIVER;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( !ret )
|
||||||
|
ret = new MemoryCardDriver_Null;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Preference<RString> g_sMovieDrivers( "MovieDrivers", "" ); // "" == default
|
||||||
|
#include "MovieTexture/Selector_MovieTexture.h"
|
||||||
|
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( MOVIE_DRIVERS_EMPTY.GetValue() );
|
||||||
|
|
||||||
|
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( COULDNT_CREATE_MOVIE_DRIVER.GetValue() );
|
||||||
|
|
||||||
|
LOG->Trace( "Created movie texture \"%s\" with driver \"%s\"",
|
||||||
|
ID.filename.c_str(), Driver.c_str() );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "Sound/Selector_RageSoundDriver.h"
|
||||||
|
static LocalizedString SOUND_DRIVERS_CANNOT_EMPTY( "Arch", "Sound Drivers cannot be empty." );
|
||||||
|
RageSoundDriver *MakeRageSoundDriver( const RString &drivers )
|
||||||
|
{
|
||||||
|
vector<RString> DriversToTry;
|
||||||
|
split( drivers, ",", DriversToTry, true );
|
||||||
|
|
||||||
|
if( DriversToTry.empty() )
|
||||||
|
RageException::Throw( SOUND_DRIVERS_CANNOT_EMPTY.GetValue() );
|
||||||
|
|
||||||
|
RString Driver;
|
||||||
|
RageSoundDriver *ret = NULL;
|
||||||
|
|
||||||
|
for( unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i )
|
||||||
|
{
|
||||||
|
Driver = DriversToTry[i];
|
||||||
|
LOG->Trace( "Initializing driver: %s", DriversToTry[i].c_str() );
|
||||||
|
|
||||||
|
#ifdef USE_RAGE_SOUND_ALSA9
|
||||||
|
if( !DriversToTry[i].CompareNoCase("ALSA") ) ret = new RageSound_ALSA9;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_ALSA9_SOFTWARE
|
||||||
|
if( !DriversToTry[i].CompareNoCase("ALSA-sw") ) ret = new RageSound_ALSA9_Software;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_AU
|
||||||
|
if( !DriversToTry[i].CompareNoCase("AudioUnit") ) ret = new RageSoundDriver_AU;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_DSOUND
|
||||||
|
if( !DriversToTry[i].CompareNoCase("DirectSound") ) ret = new RageSound_DSound;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_DSOUND_SOFTWARE
|
||||||
|
if( !DriversToTry[i].CompareNoCase("DirectSound-sw") ) ret = new RageSound_DSound_Software;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_NULL
|
||||||
|
if( !DriversToTry[i].CompareNoCase("Null") ) ret = new RageSound_Null;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_OSS
|
||||||
|
if( !DriversToTry[i].CompareNoCase("OSS") ) ret = new RageSound_OSS;
|
||||||
|
#endif
|
||||||
|
#ifdef USE_RAGE_SOUND_WAVE_OUT
|
||||||
|
if( !DriversToTry[i].CompareNoCase("WaveOut") ) ret = new RageSound_WaveOut;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( ret == NULL )
|
||||||
|
{
|
||||||
|
LOG->Trace( "Unknown sound driver name: %s", DriversToTry[i].c_str() );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
RString sError = ret->Init();
|
||||||
|
if( sError != "" )
|
||||||
|
{
|
||||||
|
LOG->Info( "Couldn't load driver %s: %s", DriversToTry[i].c_str(), sError.c_str() );
|
||||||
|
SAFE_DELETE( ret );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ret )
|
||||||
|
LOG->Info( "Sound driver: %s", Driver.c_str() );
|
||||||
|
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
#ifndef ARCH_H
|
||||||
|
#define ARCH_H
|
||||||
|
|
||||||
|
#include "RageTextureID.h"
|
||||||
|
|
||||||
|
// Put renderers switch here, makes things cleaner
|
||||||
|
#if defined(_WINDOWS)
|
||||||
|
#define SUPPORT_OPENGL
|
||||||
|
#define SUPPORT_D3D
|
||||||
|
#elif defined(_XBOX)
|
||||||
|
#define SUPPORT_D3D
|
||||||
|
#else
|
||||||
|
#define SUPPORT_OPENGL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Include this file if you need to create an instance of a driver object.
|
||||||
|
class ArchHooks;
|
||||||
|
ArchHooks *MakeArchHooks();
|
||||||
|
|
||||||
|
class DialogDriver;
|
||||||
|
DialogDriver *MakeDialogDriver();
|
||||||
|
|
||||||
|
class InputHandler;
|
||||||
|
void MakeInputHandlers( const RString &drivers, vector<InputHandler *> &Add );
|
||||||
|
|
||||||
|
class LightsDriver;
|
||||||
|
void MakeLightsDrivers( const RString &drivers, vector<LightsDriver *> &Add );
|
||||||
|
|
||||||
|
class LoadingWindow;
|
||||||
|
LoadingWindow *MakeLoadingWindow();
|
||||||
|
|
||||||
|
#if defined(SUPPORT_OPENGL)
|
||||||
|
class LowLevelWindow;
|
||||||
|
LowLevelWindow *MakeLowLevelWindow();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class MemoryCardDriver;
|
||||||
|
MemoryCardDriver *MakeMemoryCardDriver();
|
||||||
|
|
||||||
|
class RageMovieTexture;
|
||||||
|
RageMovieTexture *MakeRageMovieTexture( RageTextureID ID );
|
||||||
|
|
||||||
|
class RageSoundDriver;
|
||||||
|
RageSoundDriver *MakeRageSoundDriver( const RString &drivers );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2002-2005 Glenn Maynard, Ben Anderson
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
#ifndef ARCH_PLATFORM_H
|
||||||
|
#define ARCH_PLATFORM_H
|
||||||
|
|
||||||
|
// In here, you define which APIs are guaranteed to be available on which OSes.
|
||||||
|
// Don't ever actually #include anything here -- that's for */Selector_*.h.
|
||||||
|
#if defined(_WINDOWS)
|
||||||
|
#define HAVE_DIRECTX
|
||||||
|
#define HAVE_FFMPEG
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (c) 2002-2005 Glenn Maynard, Ben Anderson
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
Reference in New Issue
Block a user