Thorough(!) remodeling of the arch/ directory and the contents therein; fixed link-time warnings on GCC and should make things a lot easier to manage. A pile of other random things too, mostly cleanups and getting things to work with the remodeled arch/ directory.

This commit is contained in:
Ben Anderson
2005-03-14 06:44:38 +00:00
parent eaaace1f30
commit 0db665d4d6
95 changed files with 765 additions and 493 deletions
-1
View File
@@ -11,7 +11,6 @@
#include "NoteTypes.h" #include "NoteTypes.h"
#include "Steps.h" #include "Steps.h"
#include "DancingCharacters.h" #include "DancingCharacters.h"
#include "arch/arch.h"
#include "BeginnerHelper.h" #include "BeginnerHelper.h"
#include "StatsManager.h" #include "StatsManager.h"
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
-1
View File
@@ -1,6 +1,5 @@
#include "global.h" #include "global.h"
#include "arch/arch.h"
#include "Foreach.h" #include "Foreach.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageUtil.h" #include "RageUtil.h"
-1
View File
@@ -1,7 +1,6 @@
#include "global.h" #include "global.h"
#include "Bookkeeper.h" #include "Bookkeeper.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "IniFile.h" #include "IniFile.h"
-1
View File
@@ -2,7 +2,6 @@
#include "Character.h" #include "Character.h"
#include "IniFile.h" #include "IniFile.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h"
bool Character::Load( CString sCharDir ) bool Character::Load( CString sCharDir )
-1
View File
@@ -16,7 +16,6 @@
#include "Steps.h" #include "Steps.h"
#include "BannerCache.h" #include "BannerCache.h"
#include "RageFile.h" #include "RageFile.h"
#include "arch/arch.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "Foreach.h" #include "Foreach.h"
-1
View File
@@ -17,7 +17,6 @@
#include "UnlockManager.h" #include "UnlockManager.h"
#include "AnnouncerManager.h" #include "AnnouncerManager.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "arch/arch.h"
#include "ThemeManager.h" #include "ThemeManager.h"
#include "LightsManager.h" #include "LightsManager.h"
#include "RageFile.h" #include "RageFile.h"
-1
View File
@@ -8,7 +8,6 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageInput.h" #include "RageInput.h"
#include "arch/arch.h"
#include "Game.h" #include "Game.h"
#include "Style.h" #include "Style.h"
+16 -6
View File
@@ -100,13 +100,15 @@ StepMania = StdString.h \
StepMania.cpp StepMania.h \ StepMania.cpp StepMania.h \
global.cpp global.h global.cpp global.h
LoadingWindow = arch/LoadingWindow/LoadingWindow_Null.h LoadingWindow = arch/LoadingWindow/LoadingWindow.h arch/LoadingWindow/LoadingWindow.cpp \
arch/LoadingWindow/LoadingWindow_Null.h
if HAVE_GTK if HAVE_GTK
LoadingWindow += arch/LoadingWindow/LoadingWindow_Gtk.cpp arch/LoadingWindow/LoadingWindow_Gtk.h LoadingWindow += arch/LoadingWindow/LoadingWindow_Gtk.cpp arch/LoadingWindow/LoadingWindow_Gtk.h
endif endif
Sound = arch/Sound/RageSoundDriver_Null.cpp arch/Sound/RageSoundDriver_Null.h \ Sound = arch/Sound/RageSoundDriver.h arch/Sound/RageSoundDriver.cpp \
arch/Sound/RageSoundDriver_Null.cpp arch/Sound/RageSoundDriver_Null.h \
arch/Sound/RageSoundDriver_Generic_Software.cpp arch/Sound/RageSoundDriver_Generic_Software.h arch/Sound/RageSoundDriver_Generic_Software.cpp arch/Sound/RageSoundDriver_Generic_Software.h
@@ -141,7 +143,7 @@ Lights = arch/Lights/LightsDriver.cpp arch/Lights/LightsDriver.h \
arch/Lights/LightsDriver_SystemMessage.cpp arch/Lights/LightsDriver_SystemMessage.h arch/Lights/LightsDriver_SystemMessage.cpp arch/Lights/LightsDriver_SystemMessage.h
MemoryCard = arch/MemoryCard/MemoryCardDriver.cpp arch/MemoryCard/MemoryCardDriver.h MemoryCard = arch/MemoryCard/MemoryCardDriver.cpp arch/MemoryCard/MemoryCardDriver.h
LowLevelWindow = arch/LowLevelWindow/LowLevelWindow.h LowLevelWindow = arch/LowLevelWindow/LowLevelWindow.h arch/LowLevelWindow/LowLevelWindow.cpp
ArchUtils = ArchUtils =
@@ -150,17 +152,19 @@ Dialog = arch/Dialog/Dialog.cpp arch/Dialog/Dialog.h arch/Dialog/DialogDriver.h
Threads = arch/Threads/Threads.h Threads = arch/Threads/Threads.h
if HAVE_X11 if HAVE_X11
# InputHandler_X11 depends on LowLevelWindow_X11
InputHandler += arch/InputHandler/InputHandler_X11.cpp arch/InputHandler/InputHandler_X11.h InputHandler += arch/InputHandler/InputHandler_X11.cpp arch/InputHandler/InputHandler_X11.h
LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_X11.cpp arch/LowLevelWindow/LowLevelWindow_X11.h LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_X11.cpp arch/LowLevelWindow/LowLevelWindow_X11.h
ArchUtils += archutils/Unix/X11Helper.cpp archutils/Unix/X11Helper.h ArchUtils += archutils/Unix/X11Helper.cpp archutils/Unix/X11Helper.h
endif else
if HAVE_SDL if HAVE_SDL
# InputHandler_SDL depends on LowLevelWindow_SDL
InputHandler += arch/InputHandler/InputHandler_SDL.cpp arch/InputHandler/InputHandler_SDL.h InputHandler += arch/InputHandler/InputHandler_SDL.cpp arch/InputHandler/InputHandler_SDL.h
LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_SDL.cpp arch/LowLevelWindow/LowLevelWindow_SDL.h LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_SDL.cpp arch/LowLevelWindow/LowLevelWindow_SDL.h
LoadingWindow += arch/LoadingWindow/LoadingWindow_SDL.cpp arch/LoadingWindow/LoadingWindow_SDL.h LoadingWindow += arch/LoadingWindow/LoadingWindow_SDL.cpp arch/LoadingWindow/LoadingWindow_SDL.h
StepMania += SDL_utils.cpp SDL_utils.h StepMania += SDL_utils.cpp SDL_utils.h
endif endif
endif
# Platform-specific drivers: # Platform-specific drivers:
@@ -188,11 +192,17 @@ endif
if LINUX if LINUX
MemoryCard += arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp arch/MemoryCard/MemoryCardDriverThreaded_Linux.h MemoryCard += arch/MemoryCard/MemoryCardDriverThreaded_Linux.cpp arch/MemoryCard/MemoryCardDriverThreaded_Linux.h
InputHandler += arch/InputHandler/InputHandler_Linux_Joystick.h arch/InputHandler/InputHandler_Linux_Joystick.cpp
# XXX: WTF? InputHandler_Linux_tty depends on SDL!
if HAVE_SDL
InputHandler += arch/InputHandler/InputHandler_Linux_tty.h arch/InputHandler/InputHandler_Linux_tty.cpp
endif
endif endif
Arch = $(LoadingWindow) $(Sound) $(ArchHooks) $(InputHandler) $(MovieTexture) \ Arch = $(LoadingWindow) $(Sound) $(ArchHooks) $(InputHandler) $(MovieTexture) \
$(Lights) $(MemoryCard) $(LowLevelWindow) $(ArchUtils) $(Dialog) $(Threads) \ $(Lights) $(MemoryCard) $(LowLevelWindow) $(ArchUtils) $(Dialog) $(Threads) \
arch/arch.cpp arch/arch.h arch/arch_default.h arch/arch_linux.h arch/arch_platform.h arch/arch_default.h arch/arch_platform.h
RageSoundFileReaders = RageSoundReader_WAV.cpp RageSoundReader_WAV.h RageSoundFileReaders = RageSoundReader_WAV.cpp RageSoundReader_WAV.h
-1
View File
@@ -7,7 +7,6 @@
#include "StyleInput.h" #include "StyleInput.h"
#include "Style.h" #include "Style.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "arch/Dialog/Dialog.h" #include "arch/Dialog/Dialog.h"
#include "PrefsManager.h" #include "PrefsManager.h"
-1
View File
@@ -4,7 +4,6 @@
#include "IniFile.h" #include "IniFile.h"
#include "RageException.h" #include "RageException.h"
#include "GameState.h" #include "GameState.h"
#include "arch/arch.h"
#include "PlayerState.h" #include "PlayerState.h"
#define AI_PATH "Data/AI.ini" #define AI_PATH "Data/AI.ini"
+1 -1
View File
@@ -4,7 +4,7 @@
#include "GameState.h" #include "GameState.h"
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h" /* for default driver specs */ #include "arch/arch_default.h"
#include "RageSoundReader_Resample.h" /* for ResampleQuality */ #include "RageSoundReader_Resample.h" /* for ResampleQuality */
#include "RageFile.h" #include "RageFile.h"
#include "ProductInfo.h" #include "ProductInfo.h"
-1
View File
@@ -1,7 +1,6 @@
#include "global.h" #include "global.h"
#include "ProfileManager.h" #include "ProfileManager.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageFile.h" #include "RageFile.h"
+1
View File
@@ -3,6 +3,7 @@
#ifndef RAGEDISPLAY_H #ifndef RAGEDISPLAY_H
#define RAGEDISPLAY_H #define RAGEDISPLAY_H
#include "global.h"
#include "RageTypes.h" #include "RageTypes.h"
#include "ModelTypes.h" #include "ModelTypes.h"
-2
View File
@@ -29,8 +29,6 @@
#include "ScreenDimensions.h" #include "ScreenDimensions.h"
#include "arch/arch.h"
// Static libraries // Static libraries
// load Windows D3D8 dynamically // load Windows D3D8 dynamically
#if defined(_WINDOWS) #if defined(_WINDOWS)
-1
View File
@@ -54,7 +54,6 @@
#include "StepMania.h" #include "StepMania.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "arch/arch.h"
#include "arch/LowLevelWindow/LowLevelWindow.h" #include "arch/LowLevelWindow/LowLevelWindow.h"
#ifdef WIN32 #ifdef WIN32
-1
View File
@@ -2,7 +2,6 @@
#include "RageInput.h" #include "RageInput.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageException.h" #include "RageException.h"
#include "arch/arch.h"
#include "arch/InputHandler/InputHandler.h" #include "arch/InputHandler/InputHandler.h"
RageInput* INPUTMAN = NULL; // globally accessable input device RageInput* INPUTMAN = NULL; // globally accessable input device
-1
View File
@@ -1,6 +1,5 @@
#include "global.h" #include "global.h"
#include "arch/ArchHooks/ArchHooks.h" #include "arch/ArchHooks/ArchHooks.h"
#include "arch/arch.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageTimer.h" #include "RageTimer.h"
-1
View File
@@ -9,7 +9,6 @@
#include "RageLog.h" #include "RageLog.h"
#include "RageTimer.h" #include "RageTimer.h"
#include "arch/arch.h"
#include "arch/Sound/RageSoundDriver.h" #include "arch/Sound/RageSoundDriver.h"
/* /*
-1
View File
@@ -3,7 +3,6 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageFile.h" #include "RageFile.h"
#include "arch/arch.h"
#include <numeric> #include <numeric>
#include <ctime> #include <ctime>
-1
View File
@@ -3,7 +3,6 @@
#include "RageUtil_FileDB.h" #include "RageUtil_FileDB.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
#include "arch/arch.h"
/* Search for "beginning*containing*ending". */ /* Search for "beginning*containing*ending". */
void FileSet::GetFilesMatching(const CString &beginning, const CString &containing, const CString &ending, vector<CString> &out, bool bOnlyDirs) const void FileSet::GetFilesMatching(const CString &beginning, const CString &containing, const CString &ending, vector<CString> &out, bool bOnlyDirs) const
-1
View File
@@ -18,7 +18,6 @@
#include "Steps.h" #include "Steps.h"
#include <utility> #include <utility>
#include "NoteFieldPositioning.h" #include "NoteFieldPositioning.h"
#include "arch/arch.h"
#include "NoteDataUtil.h" #include "NoteDataUtil.h"
#include "SongUtil.h" #include "SongUtil.h"
#include "StepsUtil.h" #include "StepsUtil.h"
-1
View File
@@ -17,7 +17,6 @@
#include "TitleSubstitution.h" #include "TitleSubstitution.h"
#include "BannerCache.h" #include "BannerCache.h"
#include "Sprite.h" #include "Sprite.h"
#include "arch/arch.h"
#include "RageFile.h" #include "RageFile.h"
#include "RageFileManager.h" #include "RageFileManager.h"
#include "RageSurface.h" #include "RageSurface.h"
-1
View File
@@ -5,7 +5,6 @@
#include "MsdFile.h" #include "MsdFile.h"
#include "NotesLoaderDWI.h" #include "NotesLoaderDWI.h"
#include "BannerCache.h" #include "BannerCache.h"
#include "arch/arch.h"
#include "GameState.h" #include "GameState.h"
#include "PrefsManager.h" #include "PrefsManager.h"
+2 -1
View File
@@ -16,7 +16,6 @@
#include "RageDisplay.h" #include "RageDisplay.h"
#include "RageThreads.h" #include "RageThreads.h"
#include "arch/arch.h"
#include "arch/ArchHooks/ArchHooks.h" #include "arch/ArchHooks/ArchHooks.h"
#include "arch/LoadingWindow/LoadingWindow.h" #include "arch/LoadingWindow/LoadingWindow.h"
#include "arch/Dialog/Dialog.h" #include "arch/Dialog/Dialog.h"
@@ -35,6 +34,8 @@
#include "RageSurface.h" #include "RageSurface.h"
#include "RageSurface_Load.h" #include "RageSurface_Load.h"
#include "arch/arch_platform.h"
// //
// StepMania global classes // StepMania global classes
// //
-1
View File
@@ -1,6 +1,5 @@
#include "global.h" #include "global.h"
#include "TitleSubstitution.h" #include "TitleSubstitution.h"
#include "arch/arch.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
+1 -1
View File
@@ -3,7 +3,7 @@
ArchHooks *HOOKS = NULL; ArchHooks *HOOKS = NULL;
#include "../arch_platform.h" #include "Selector_ArchHooks.h"
ArchHooks *MakeArchHooks() { return new ARCH_HOOKS; } ArchHooks *MakeArchHooks() { return new ARCH_HOOKS; }
/* /*
@@ -12,7 +12,9 @@ public:
int64_t GetMicrosecondsSinceStart(); int64_t GetMicrosecondsSinceStart();
}; };
#undef ARCH_HOOKS #ifdef ARCH_HOOKS
#error "More than one ArchHooks selected!"
#endif
#define ARCH_HOOKS ArchHooks_Unix #define ARCH_HOOKS ArchHooks_Unix
#endif #endif
@@ -25,7 +25,9 @@ private:
void CheckVideoDriver(); void CheckVideoDriver();
}; };
#undef ARCH_HOOKS #ifdef ARCH_HOOKS
#error "More than one ArchHooks selected!"
#endif
#define ARCH_HOOKS ArchHooks_Win32 #define ARCH_HOOKS ArchHooks_Win32
#endif #endif
@@ -39,7 +39,9 @@ inline void WRITEMSRREG( UINT32 reg, LARGE_INTEGER val )
}; };
} }
#undef ARCH_HOOKS #ifdef ARCH_HOOKS
#error "More than one ArchHooks selected!"
#endif
#define ARCH_HOOKS ArchHooks_Xbox #define ARCH_HOOKS ArchHooks_Xbox
#endif #endif
@@ -26,7 +26,9 @@ protected:
RageMutex *TimeCritMutex; RageMutex *TimeCritMutex;
}; };
#undef ARCH_HOOKS #ifdef ARCH_HOOKS
#error "More than one ArchHooks selected!"
#endif
#define ARCH_HOOKS ArchHooks_darwin #define ARCH_HOOKS ArchHooks_darwin
#endif /* ARCH_HOOKS_DARWIN_H */ #endif /* ARCH_HOOKS_DARWIN_H */
@@ -0,0 +1,48 @@
#ifndef SELECTOR_ARCH_HOOKS_H
#define SELECTOR_ARCH_HOOKS_H
#include "arch/arch_platform.h"
/* ArchHooks driver selector. */
#if defined(HAVE_DARWIN)
#include "ArchHooks_darwin.h"
#elif defined(HAVE_POSIX)
#include "ArchHooks_Unix.h"
#elif defined(HAVE_WIN32) // XXX: Better name for this API?
#include "ArchHooks_Win32.h"
#elif defined(HAVE_XBOX) // XXX: Better name for this API?
#include "ArchHooks_Xbox.h"
#else
#error "No suitable ArchHooks available."
#endif
#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.
*/
+5 -12
View File
@@ -5,16 +5,7 @@
#include "RageUtil.h" #include "RageUtil.h"
#include "RageLog.h" #include "RageLog.h"
/* Hmm. I don't want this to depend on other arch drivers--we should be able to test #include "Selector_Dialog.h"
* this without linking to them. We probably don't actually have to do that just by
* #including the headers in arch_Win32.h, etc., but it's still messy ... */
#if defined(_WINDOWS)
#include "DialogDriver_Win32.h"
#endif
#if defined(DARWIN)
#include "DialogDriver_Cocoa.h"
#endif
static DialogDriver *g_pImpl = NULL; static DialogDriver *g_pImpl = NULL;
static DialogDriver_Null g_NullDriver; static DialogDriver_Null g_NullDriver;
@@ -37,13 +28,15 @@ void Dialog::Init()
{ {
Driver = DriversToTry[i]; Driver = DriversToTry[i];
#if defined(HAVE_DIALOG_WIN32) #if defined(USE_DIALOG_DRIVER_WIN32)
if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32; if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32;
#endif #endif
#if defined(HAVE_DIALOG_COCOA) #if defined(USE_DIALOG_DRIVER_COCOA)
if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa; if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa;
#endif #endif
#if defined(USE_DIALOG_DRIVER_NULL)
if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null; if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null;
#endif
if( g_pImpl == NULL ) if( g_pImpl == NULL )
continue; continue;
+1
View File
@@ -16,6 +16,7 @@ public:
}; };
class DialogDriver_Null: public DialogDriver { }; class DialogDriver_Null: public DialogDriver { };
#define USE_DIALOG_DRIVER_NULL
#endif #endif
@@ -10,8 +10,7 @@ public:
void OK(CString sMessage, CString ID); void OK(CString sMessage, CString ID);
Dialog::Result AbortRetryIgnore(CString sMessage, CString ID); Dialog::Result AbortRetryIgnore(CString sMessage, CString ID);
}; };
#define USE_DIALOG_DRIVER_COCOA
#define HAVE_DIALOG_COCOA
#endif /* ARCH_HOOKS_DARWIN_H */ #endif /* ARCH_HOOKS_DARWIN_H */
@@ -11,8 +11,7 @@ public:
Dialog::Result AbortRetryIgnore( CString sMessage, CString ID ); Dialog::Result AbortRetryIgnore( CString sMessage, CString ID );
Dialog::Result AbortRetry( CString sMessage, CString ID ); Dialog::Result AbortRetry( CString sMessage, CString ID );
}; };
#define USE_DIALOG_DRIVER_WIN32
#define HAVE_DIALOG_WIN32
#endif #endif
@@ -1,23 +1,23 @@
#ifndef XBOX_ARCH_H #ifndef SELECTOR_DIALOG
#define XBOX_ARCH_H #define SELECTOR_DIALOG
/* Load drivers for Xbox. */ #include "arch/arch_platform.h"
#include "LoadingWindow/LoadingWindow_Xbox.h" /* Dialog drivers selector. */
#ifdef HAVE_WIN32
#include "DialogDriver_Win32.h"
#endif
#include "ArchHooks/ArchHooks_Xbox.h" #ifdef HAVE_COCOA
#include "DialogDriver_Cocoa.h"
#endif
#include "InputHandler/InputHandler_Xbox.h" #include "DialogDriver.h" // DialogDriver_Null is in here
#include "Sound/RageSoundDriver_DSound.h"
/* Undef this if you need no SDL input. */
#undef SUPPORT_SDL_INPUT
#endif #endif
/* /*
* (c) 2002 Glenn Maynard, Chris Danford * (c) 2005 Ben Anderson.
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
@@ -40,4 +40,3 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
@@ -1,7 +1,51 @@
#include "global.h" #include "global.h"
#include "InputFilter.h" #include "InputFilter.h"
#include "RageUtil.h"
#include "InputHandler.h" #include "InputHandler.h"
#include "Selector_InputHandler.h"
void MakeInputHandlers(CString drivers, vector<InputHandler *> &Add)
{
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString Driver;
for(unsigned i = 0; i < DriversToTry.size(); ++i)
{
#ifdef USE_INPUT_HANDLER_DIRECTINPUT
if(!DriversToTry[i].CompareNoCase("DirectInput") ) Add.push_back(new InputHandler_DInput);
#endif
#ifdef USE_INPUT_HANDLER_LINUX_JOYSTICK
if(!DriversToTry[i].CompareNoCase("Linux_Joystick") ) Add.push_back(new InputHandler_Linux_Joystick);
#endif
#ifdef USE_INPUT_HANDLER_LINUX_TTY
if(!DriversToTry[i].CompareNoCase("Linux_tty") ) Add.push_back(new InputHandler_Linux_tty);
#endif
#ifdef USE_INPUT_HANDLER_MONKEY_KEYBOARD
if(!DriversToTry[i].CompareNoCase("MonkeyKeyboard") ) Add.push_back(new InputHandler_MonkeyKeyboard);
#endif
#ifdef USE_INPUT_HANDLER_SDL
if(!DriversToTry[i].CompareNoCase("SDL") ) Add.push_back(new InputHandler_SDL);
#endif
#ifdef USE_INPUT_HANDLER_WIN32_PARA
if(!DriversToTry[i].CompareNoCase("Para") ) Add.push_back(new InputHandler_Win32_Para);
#endif
#ifdef USE_INPUT_HANDLER_WIN32_PUMP
if(!DriversToTry[i].CompareNoCase("Pump") ) Add.push_back(new InputHandler_Win32_Pump);
#endif
#ifdef USE_INPUT_HANDLER_X11
if(!DriversToTry[i].CompareNoCase("X11") ) Add.push_back(new InputHandler_X11);
#endif
#ifdef USE_INPUT_HANDLER_XBOX
if(!DriversToTry[i].CompareNoCase("Xbox") ) Add.push_back(new InputHandler_Xbox);
#endif
}
}
void InputHandler::UpdateTimer() void InputHandler::UpdateTimer()
{ {
m_LastUpdate.Touch(); m_LastUpdate.Touch();
@@ -55,6 +55,8 @@ protected:
void UpdateTimer(); void UpdateTimer();
}; };
void MakeInputHandlers(CString drivers, vector<InputHandler *> &Add);
#endif #endif
/* /*
@@ -27,6 +27,7 @@ public:
void Update(float fDeltaTime); void Update(float fDeltaTime);
void WindowReset(); void WindowReset();
}; };
#define USE_INPUT_HANDLER_DIRECTINPUT
#endif #endif
@@ -16,6 +16,7 @@ public:
private: private:
int fds[NUM_JOYSTICKS]; int fds[NUM_JOYSTICKS];
}; };
#define USE_INPUT_HANDLER_LINUX_JOYSTICK
#endif #endif
@@ -14,6 +14,7 @@ public:
~InputHandler_Linux_tty(); ~InputHandler_Linux_tty();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_LINUX_TTY
#endif #endif
@@ -16,6 +16,7 @@ public:
~InputHandler_MonkeyKeyboard(); ~InputHandler_MonkeyKeyboard();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_MONKEY_KEYBOARD
#endif #endif
@@ -16,7 +16,7 @@ public:
~InputHandler_SDL(); ~InputHandler_SDL();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_SDL
#endif #endif
@@ -22,6 +22,7 @@ public:
~InputHandler_Win32_Para(); ~InputHandler_Win32_Para();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_WIN32_PARA
#endif #endif
@@ -22,6 +22,7 @@ public:
~InputHandler_Win32_Pump(); ~InputHandler_Win32_Pump();
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_WIN32_PUMP
#endif #endif
@@ -13,6 +13,7 @@ public:
void Update(float fDeltaTime); void Update(float fDeltaTime);
void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut); void GetDevicesAndDescriptions(vector<InputDevice>& vDevicesOut, vector<CString>& vDescriptionsOut);
}; };
#define USE_INPUT_HANDLER_X11
#endif #endif
@@ -21,7 +21,7 @@ public:
private: private:
void getHandles(); void getHandles();
}; };
#define USE_INPUT_HANDLER_XBOX
#endif #endif
@@ -0,0 +1,63 @@
#ifndef SELECTOR_INPUT_HANDLER_H
#define SELECTOR_INPUT_HANDLER_H
#include "arch/arch_platform.h"
/* InputHandler drivers selector. */
#ifdef HAVE_DIRECTX
#include "InputHandler_DirectInput.h"
#endif
#ifdef HAVE_LINUXKERNEL
#include "InputHandler_Linux_Joystick.h"
// XXX: WTF? InputHandler_Linux_tty depends on SDL!
#ifdef HAVE_SDL
#include "InputHandler_Linux_tty.h"
#endif
#endif
#include "InputHandler_MonkeyKeyboard.h"
#ifdef HAVE_SDL
#include "InputHandler_SDL.h"
#endif
#ifdef HAVE_WIN32
#include "InputHandler_Win32_Pump.h"
#include "InputHandler_Win32_Para.h"
#endif
#ifdef HAVE_XBOX
#include "InputHandler_Xbox.h"
#endif
#ifdef HAVE_X11
#include "InputHandler_X11.h"
#endif
#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.
*/
+16 -10
View File
@@ -1,8 +1,8 @@
#include "global.h" #include "global.h"
#include "LightsDriver.h" #include "LightsDriver.h"
#include "RageLog.h" #include "RageLog.h"
#include "arch/arch.h"
#include "arch/arch_platform.h" #include "Selector_LightsDriver.h"
LightsDriver *MakeLightsDriver(CString driver) LightsDriver *MakeLightsDriver(CString driver)
{ {
@@ -10,17 +10,23 @@ LightsDriver *MakeLightsDriver(CString driver)
LightsDriver *ret = NULL; LightsDriver *ret = NULL;
#ifdef _WINDOWS #ifdef USE_LIGHTS_DRIVER_LINUX_PARALLEL
// if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel;
#endif
if( !driver.CompareNoCase("SystemMessage") ) ret = new LightsDriver_SystemMessage;
#ifdef LINUX
if( !driver.CompareNoCase("WeedTech") ) ret = new LightsDriver_LinuxWeedTech;
if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel; if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel;
#endif #endif
#ifdef USE_LIGHTS_DRIVER_LINUX_WEEDTECH
if( !driver.CompareNoCase("WeedTech") ) ret = new LightsDriver_LinuxWeedTech;
#endif
#ifdef USE_LIGHTS_DRIVER_NULL
if( !driver.CompareNoCase("Null") ) ret = new LightsDriver_Null;
#endif
#ifdef USE_LIGHTS_DRIVER_SYSTEM_MESSAGE
if( !driver.CompareNoCase("SystemMessage") ) ret = new LightsDriver_SystemMessage;
#endif
#ifdef USE_LIGHTS_DRIVER_WIN32_PARALLEL
if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel;
#endif
if( ret == NULL && driver.CompareNoCase("Null") ) if( ret == NULL )
LOG->Warn( "Unknown lights driver name: %s", driver.c_str() ); LOG->Warn( "Unknown lights driver name: %s", driver.c_str() );
return ret; return ret;
@@ -13,6 +13,7 @@ public:
virtual ~LightsDriver_LinuxParallel(); virtual ~LightsDriver_LinuxParallel();
virtual void Set( const LightsState *ls ); virtual void Set( const LightsState *ls );
}; };
#define USE_LIGHTS_DRIVER_LINUX_PARALLEL
#endif #endif
@@ -16,6 +16,7 @@ public:
virtual void Set( const LightsState *ls ); virtual void Set( const LightsState *ls );
}; };
#define USE_LIGHTS_DRIVER_LINUX_WEEDTECH
#endif #endif
@@ -11,7 +11,7 @@ public:
void Set( const LightsState *ls ) {}; void Set( const LightsState *ls ) {};
}; };
#define USE_LIGHTS_DRIVER_NULL
#endif #endif
@@ -11,6 +11,7 @@ public:
virtual void Set( const LightsState *ls ); virtual void Set( const LightsState *ls );
}; };
#define USE_LIGHTS_DRIVER_SYSTEM_MESSAGE
#endif #endif
@@ -16,6 +16,7 @@ public:
virtual void Set( const LightsState *ls ); virtual void Set( const LightsState *ls );
}; };
#define USE_LIGHTS_DRIVER_WIN32_PARALLEL
#endif #endif
@@ -0,0 +1,42 @@
#ifndef SELECTOR_LIGHTS_DRIVER_H
#define SELECTOR_LIGHTS_DRIVER_H
#include "arch/arch_platform.h"
/* LightsDriver selector. */
#ifdef HAVE_WIN32
#include "LightsDriver_Win32Parallel.h"
#endif
#ifdef HAVE_LINUXKERNEL
#include "LightsDriver_LinuxParallel.h"
#include "LightsDriver_LinuxWeedTech.h"
#endif
#include "LightsDriver_SystemMessage.h"
#include "LightsDriver_Null.h"
#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.
*/
@@ -0,0 +1,89 @@
#include "LoadingWindow.h"
#include "global.h"
#include "RageLog.h"
#include "PrefsManager.h"
#include "Selector_LoadingWindow.h"
LoadingWindow *MakeLoadingWindow()
{
if( !PREFSMAN->m_bShowLoadingWindow )
return new LoadingWindow_Null;
/* Don't load NULL by default. On most systems, if we can't load the SDL
* loading window, we won't be able to init OpenGL, either, so don't bother. */
CString drivers = "xbox,win32,cocoa,gtk,sdl";
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString 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_SDL
if(!DriversToTry[i].CompareNoCase("SDL") ) ret = new LoadingWindow_SDL;
#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;
CString 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;
}
/*
* (c) 2002-2004 Glenn Maynard
* 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.
*/
@@ -3,6 +3,8 @@
#ifndef LOADING_WINDOW_H #ifndef LOADING_WINDOW_H
#define LOADING_WINDOW_H #define LOADING_WINDOW_H
#include "global.h"
struct RageSurface; struct RageSurface;
class LoadingWindow class LoadingWindow
{ {
@@ -15,6 +17,8 @@ public:
virtual void SetIcon( const RageSurface *pIcon ) { } virtual void SetIcon( const RageSurface *pIcon ) { }
}; };
LoadingWindow *MakeLoadingWindow();
#endif #endif
/* /*
@@ -1,7 +1,7 @@
/* LoadingWindow_Cocoa - Loading window for OSX */ /* LoadingWindow_Cocoa - Loading window for OSX */
#ifndef LOADING_WINDOW_COCOA #ifndef LOADING_WINDOW_COCOA_H
#define LOADING_WINDOW_COCOA #define LOADING_WINDOW_COCOA_H
#include "LoadingWindow.h" #include "LoadingWindow.h"
@@ -17,10 +17,9 @@ public:
void Paint() {} /* Not needed */ void Paint() {} /* Not needed */
void SetText( CString str ) { SetCocoaWindowText( str ); } void SetText( CString str ) { SetCocoaWindowText( str ); }
}; };
#define USE_LOADING_WINDOW_COCOA
#define HAVE_LOADING_WINDOW_COCOA #endif
#endif /* LOADING_WINDOW_COCOA */
/* /*
* (c) 2003-2004 Steve Checkoway * (c) 2003-2004 Steve Checkoway
@@ -15,8 +15,7 @@ public:
void SetText(CString str); void SetText(CString str);
void Paint() { } void Paint() { }
}; };
#define USE_LOADING_WINDOW_GTK
#define HAVE_LOADING_WINDOW_GTK
#endif #endif
@@ -11,8 +11,7 @@ public:
void SetText(CString str) { } void SetText(CString str) { }
void Paint() { } void Paint() { }
}; };
#define USE_LOADING_WINDOW_NULL
#define HAVE_LOADING_WINDOW_NULL
#endif #endif
@@ -14,8 +14,7 @@ public:
void Paint(); void Paint();
}; };
#define USE_LOADING_WINDOW_SDL
#define HAVE_LOADING_WINDOW_SDL
#endif #endif
@@ -25,8 +25,7 @@ private:
static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam );
}; };
#define USE_LOADING_WINDOW_WIN32
#define HAVE_LOADING_WINDOW_WIN32
#endif #endif
@@ -21,6 +21,7 @@ protected:
XFONT* font; XFONT* font;
bool useImage; bool useImage;
}; };
#define USE_LOADING_WINDOW_XBOX
#endif #endif
@@ -1,31 +1,35 @@
#ifndef WIN32_ARCH_H #ifndef SELECTOR_LOADING_WINDOW_H
#define WIN32_ARCH_H #define SELECTOR_LOADING_WINDOW_H
/* Load drivers for Win32. */ #include "arch/arch_platform.h"
#include "LoadingWindow/LoadingWindow_Win32.h"
#include "ArchHooks/ArchHooks_Win32.h"
#include "InputHandler/InputHandler_DirectInput.h" /* LoadingWindow driver selector. */
#include "InputHandler/InputHandler_Win32_Pump.h" #ifdef HAVE_COCOA
#include "InputHandler/InputHandler_Win32_Para.h" #include "LoadingWindow_Cocoa.h"
#endif
#include "Sound/RageSoundDriver_DSound.h" #ifdef HAVE_GTK
#include "Sound/RageSoundDriver_DSound_Software.h" #include "LoadingWindow_Gtk.h"
#include "Sound/RageSoundDriver_WaveOut.h" #endif
#include "Lights/LightsDriver_Win32Parallel.h" #include "LoadingWindow_Null.h"
#include "MemoryCard/MemoryCardDriverThreaded_Windows.h" #ifdef HAVE_SDL
#include "LoadingWindow_SDL.h"
#endif
#include "LowLevelWindow/LowLevelWindow_Win32.h" #ifdef HAVE_WIN32
#include "LoadingWindow_Win32.h"
#endif
#define HAVE_FFMPEG #ifdef HAVE_XBOX
#undef SUPPORT_SDL_INPUT #include "LoadingWindow_Xbox.h"
#endif
#endif #endif
/* /*
* (c) 2002-2004 Glenn Maynard * (c) 2005 Ben Anderson
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
@@ -1,15 +1,11 @@
#ifndef ARCH_DARWIN_H #include "LowLevelWindow.h"
#define ARCH_DARWIN_H
#include "Sound/RageSoundDriver_CA.h" #include "Selector_LowLevelWindow.h"
#include "Sound/RageSoundDriver_QT1.h"
#include "LoadingWindow/LoadingWindow_Cocoa.h"
#include "ArchHooks/ArchHooks_darwin.h"
#endif LowLevelWindow *MakeLowLevelWindow() { return new ARCH_LOW_LEVEL_WINDOW; }
/* /*
* (c) 2003 Steve Checkoway * (c) 2002-2004 Glenn Maynard
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
@@ -32,4 +28,3 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
@@ -5,6 +5,7 @@
* we use SDL. Note that not all SDL operations go here; however, nothing * we use SDL. Note that not all SDL operations go here; however, nothing
* outside of this can assume that SDL has VIDEO initialized. */ * outside of this can assume that SDL has VIDEO initialized. */
#include "global.h"
#include "RageDisplay.h" // for RageDisplay::VideoModeParams #include "RageDisplay.h" // for RageDisplay::VideoModeParams
class LowLevelWindow class LowLevelWindow
@@ -25,6 +26,8 @@ public:
virtual RageDisplay::VideoModeParams GetVideoModeParams() const = 0; virtual RageDisplay::VideoModeParams GetVideoModeParams() const = 0;
}; };
LowLevelWindow *MakeLowLevelWindow();
#endif #endif
/* /*
@@ -17,7 +17,9 @@ public:
RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; } RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; }
}; };
#undef ARCH_LOW_LEVEL_WINDOW #ifdef ARCH_LOW_LEVEL_WINDOW
#error "More than one LowLevelWindow selected!"
#endif
#define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_SDL #define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_SDL
#endif #endif
@@ -15,8 +15,9 @@ public:
RageDisplay::VideoModeParams GetVideoModeParams() const; RageDisplay::VideoModeParams GetVideoModeParams() const;
}; };
#ifdef ARCH_LOW_LEVEL_WINDOW
#undef ARCH_LOW_LEVEL_WINDOW #error "More than one LowLevelWindow selected!"
#endif
#define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_Win32 #define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_Win32
#endif #endif
@@ -97,7 +97,8 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b
// We're remodeling the existing window, and not touching the // We're remodeling the existing window, and not touching the
// context. // context.
bNewDeviceOut = false; bNewDeviceOut = false;
// Remap the window to work around possible buggy WMs and/or X servers // Remap the window to work around possible buggy WMs and/or
// X servers
XUnmapWindow(X11Helper::Dpy(), X11Helper::Win() ); XUnmapWindow(X11Helper::Dpy(), X11Helper::Win() );
} }
@@ -22,8 +22,9 @@ public:
RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; } RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; }
}; };
// XXX: Shouldn't we try multiple LowLevelWindows and use whichever works? #ifdef ARCH_LOW_LEVEL_WINDOW
#undef ARCH_LOW_LEVEL_WINDOW #error "More than one LowLevelWindow selected!"
#endif
#define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_X11 #define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_X11
@@ -0,0 +1,40 @@
#ifndef SELECTOR_LOW_LEVEL_WINDOW_H
#define SELECTOR_LOW_LEVEL_WINDOW_H
/* LowLevelWindow selector. */
#if defined(HAVE_WIN32)
#include "LowLevelWindow_Win32.h"
#elif defined(HAVE_X11) // Prefer LLW_X11 over LLW_SDL
#include "LowLevelWindow_X11.h"
#elif defined(HAVE_SDL)
#include "LowLevelWindow_SDL.h"
#else
#error "No suitable LowLevelWindow available."
#endif
#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.
*/
@@ -1,8 +1,9 @@
#include "global.h" #include "global.h"
#include "MemoryCardDriver.h" #include "MemoryCardDriver.h"
#include "PrefsManager.h" #include "PrefsManager.h"
#include "MemoryCardDriver_Null.h"
#include "arch/arch_platform.h" #include "Selector_MemoryCardDriver.h"
bool UsbStorageDevice::operator==(const UsbStorageDevice& other) const bool UsbStorageDevice::operator==(const UsbStorageDevice& other) const
{ {
@@ -31,11 +32,10 @@ MemoryCardDriver *MakeMemoryCardDriver()
MemoryCardDriver *ret = NULL; MemoryCardDriver *ret = NULL;
#ifdef LINUX #ifdef ARCH_MEMORY_CARD_DRIVER
ret = new MemoryCardDriverThreaded_Linux; ret = new ARCH_MEMORY_CARD_DRIVER;
#elif _WINDOWS
ret = new MemoryCardDriverThreaded_Windows;
#endif #endif
if( !ret ) if( !ret )
ret = new MemoryCardDriver_Null; ret = new MemoryCardDriver_Null;
@@ -21,6 +21,11 @@ protected:
vector<UsbStorageDevice> m_vDevicesLastSeen; vector<UsbStorageDevice> m_vDevicesLastSeen;
}; };
#ifdef ARCH_MEMORY_CARD_DRIVER
#error "More than one MemoryCardDriver selected!"
#endif
#define ARCH_MEMORY_CARD_DRIVER MemoryCardDriverThreaded_Linux
#endif #endif
/* /*
@@ -20,6 +20,11 @@ private:
DWORD m_dwLastLogicalDrives; DWORD m_dwLastLogicalDrives;
}; };
#ifdef ARCH_MEMORY_CARD_DRIVER
#error "More than one MemoryCardDriver included!"
#endif
#define ARCH_MEMORY_CARD_DRIVER MemoryCardDriverThreaded_Windows
#endif #endif
/* /*
@@ -0,0 +1,38 @@
#ifndef SELECTOR_MEMORY_CARD_DRIVER_H
#define SELECTOR_MEMORY_CARD_DRIVER_H
#include "arch/arch_platform.h"
/* MemoryCardDriver selector. */
#if defined(HAVE_LINUXKERNEL)
#include "MemoryCardDriverThreaded_Linux.h"
#elif defined(HAVE_WIN32)
#include "MemoryCardDriverThreaded_Win32.h"
#endif
#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.
*/
@@ -6,17 +6,7 @@
#include "PrefsManager.h" #include "PrefsManager.h"
#include "RageFile.h" #include "RageFile.h"
#include "arch/arch_platform.h" #include "Selector_MovieTexture.h"
/* _WINDOWS is Windows only, where _WIN32 is Windows and Xbox, I think. Does this
* work on the Xbox? -glenn */
#if defined(_WINDOWS)
#include "MovieTexture_DShow.h"
#endif
#ifdef HAVE_FFMPEG
#include "MovieTexture_FFMpeg.h"
#endif
void ForceToAscii( CString &str ) void ForceToAscii( CString &str )
{ {
@@ -91,13 +81,15 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID)
{ {
Driver = DriversToTry[i]; Driver = DriversToTry[i];
LOG->Trace("Initializing driver: %s", Driver.c_str()); LOG->Trace("Initializing driver: %s", Driver.c_str());
#ifdef _WINDOWS #ifdef USE_MOVIE_TEXTURE_DSHOW
if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID); if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID);
#endif #endif
#ifdef HAVE_FFMPEG #ifdef USE_MOVIE_TEXTURE_FFMPEG
if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID); if( !Driver.CompareNoCase("FFMpeg") ) ret = new MovieTexture_FFMpeg(ID);
#endif #endif
#ifdef USE_MOVIE_TEXTURE_NULL
if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID); if( !Driver.CompareNoCase("Null") ) ret = new MovieTexture_Null(ID);
#endif
if( ret == NULL ) if( ret == NULL )
{ {
LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() ); LOG->Warn( "Unknown movie driver name: %s", Driver.c_str() );
@@ -92,6 +92,7 @@ private:
float CheckFrameTime(); float CheckFrameTime();
void DiscardFrame(); void DiscardFrame();
}; };
#define USE_MOVIE_TEXTURE_FFMPEG
#endif #endif
@@ -1,5 +1,5 @@
#ifndef MOVIE_TEXTURE_NULL #ifndef MOVIE_TEXTURE_NULL_H
#define MOVIE_TEXTURE_NULL #define MOVIE_TEXTURE_NULL_H
/* /*
* MovieTexture_null.h * MovieTexture_null.h
* stepmania * stepmania
@@ -29,8 +29,9 @@ public:
void SetPlaybackRate(float rate) { } void SetPlaybackRate(float rate) { }
void SetLooping(bool looping=true) { loop = looping; } void SetLooping(bool looping=true) { loop = looping; }
}; };
#define USE_MOVIE_TEXTURE_NULL
#endif /* MOVIE_TEXTURE_NULL */ #endif
/* /*
* (c) 2003 Steve Checkoway * (c) 2003 Steve Checkoway
@@ -0,0 +1,42 @@
#ifndef SELECTOR_MOVIE_TEXTURE_H
#define SELECTOR_MOVIE_TEXTURE_H
#include "arch/arch_platform.h"
/* MovieTexture driver selector. */
#ifdef HAVE_DIRECTX
#include "MovieTexture_DShow.h"
#endif
#ifdef HAVE_FFMPEG
#include "MovieTexture_FFMpeg.h"
#endif
#include "MovieTexture_Null.h"
#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.
*/
@@ -0,0 +1,95 @@
#include "RageSoundDriver.h"
#include "global.h"
#include "RageUtil.h"
#include "RageLog.h"
#include "Selector_RageSoundDriver.h"
RageSoundDriver *MakeRageSoundDriver(CString drivers)
{
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString 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_CA
if(!DriversToTry[i].CompareNoCase("CoreAudio")) ret = new RageSound_CA;
#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_QT1
if(!DriversToTry[i].CompareNoCase("QT1")) ret = new RageSound_QT1;
#endif
#ifdef USE_RAGE_SOUND_WAVE_OUT
if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut;
#endif
if( ret == NULL )
{
LOG->Warn( "Unknown sound driver name: %s", DriversToTry[i].c_str() );
continue;
}
CString 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;
}
/*
* (c) 2002-2004 Glenn Maynard
* 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.
*/
@@ -1,6 +1,8 @@
#ifndef RAGE_SOUND_DRIVER #ifndef RAGE_SOUND_DRIVER
#define RAGE_SOUND_DRIVER #define RAGE_SOUND_DRIVER
#include "global.h"
class RageSoundBase; class RageSoundBase;
class RageSoundDriver class RageSoundDriver
{ {
@@ -48,6 +50,8 @@ public:
virtual ~RageSoundDriver() { } virtual ~RageSoundDriver() { }
}; };
RageSoundDriver *MakeRageSoundDriver(CString drivers);
/* /*
* (c) 2002-2004 Glenn Maynard * (c) 2002-2004 Glenn Maynard
* All rights reserved. * All rights reserved.
@@ -71,6 +71,7 @@ private:
void GetData(); void GetData();
}; };
#define USE_RAGE_SOUND_ALSA9
#endif #endif
@@ -33,6 +33,7 @@ public:
CString Init(); CString Init();
~RageSound_ALSA9_Software(); ~RageSound_ALSA9_Software();
}; };
#define USE_RAGE_SOUND_ALSA9_SOFTWARE
#endif #endif
@@ -45,8 +45,7 @@ public:
int64_t GetPosition(const RageSoundBase *sound) const; int64_t GetPosition(const RageSoundBase *sound) const;
void SetupDecodingThread(); void SetupDecodingThread();
}; };
#define USE_RAGE_SOUND_CA
#define RAGE_SOUND_CA
#endif #endif
@@ -69,6 +69,7 @@ private:
int GetSampleRate( int rate ) const { return rate; } int GetSampleRate( int rate ) const { return rate; }
}; };
#define USE_RAGE_SOUND_DSOUND
#endif #endif
@@ -28,6 +28,7 @@ public:
virtual ~RageSound_DSound_Software(); virtual ~RageSound_DSound_Software();
CString Init(); CString Init();
}; };
#define USE_RAGE_SOUND_DSOUND_SOFTWARE
#endif #endif
@@ -16,6 +16,7 @@ protected:
public: public:
RageSound_Null(); RageSound_Null();
}; };
#define USE_RAGE_SOUND_NULL
#endif #endif
@@ -32,6 +32,7 @@ public:
CString Init(); CString Init();
~RageSound_OSS(); ~RageSound_OSS();
}; };
#define USE_RAGE_SOUND_OSS
#endif #endif
@@ -1,5 +1,5 @@
#ifndef RAGE_SOUND_QT1 #ifndef RAGE_SOUND_QT1_H
#define RAGE_SOUND_QT1 #define RAGE_SOUND_QT1_H
/* /*
* RageSoundDriver_QT1.h * RageSoundDriver_QT1.h
* stepmania * stepmania
@@ -37,8 +37,9 @@ public:
virtual ~RageSound_QT1(); virtual ~RageSound_QT1();
static void GetData(QT::SndChannel *chan, QT::SndCommand *cmd_passed); static void GetData(QT::SndChannel *chan, QT::SndCommand *cmd_passed);
}; };
#define USE_RAGE_SOUND_QT1
#endif /* RAGE_SOUND_QT1 */ #endif
/* /*
* (c) 2003-2004 Steve Checkoway * (c) 2003-2004 Steve Checkoway
@@ -32,6 +32,7 @@ public:
~RageSound_WaveOut(); ~RageSound_WaveOut();
CString Init(); CString Init();
}; };
#define USE_RAGE_SOUND_WAVE_OUT
#endif #endif
@@ -1,35 +1,41 @@
#ifndef LINUX_ARCH_H #ifndef SELECTOR_RAGE_SOUND_DRIVER_H
#define LINUX_ARCH_H #define SELECTOR_RAGE_SOUND_DRIVER_H
#include "arch/arch_platform.h"
/* RageSoundDriver selector. */
#ifdef HAVE_ALSA #ifdef HAVE_ALSA
#include "Sound/RageSoundDriver_ALSA9.h" #include "RageSoundDriver_ALSA9.h"
#include "Sound/RageSoundDriver_ALSA9_Software.h" #include "RageSoundDriver_ALSA9_Software.h"
#endif #endif
#ifdef HAVE_COREAUDIO
#include "RageSoundDriver_CA.h"
#endif
#ifdef HAVE_DIRECTX
#include "RageSoundDriver_DSound.h"
#include "RageSoundDriver_DSound_Software.h"
#endif
#include "RageSoundDriver_Null.h"
#ifdef HAVE_OSS #ifdef HAVE_OSS
#include "Sound/RageSoundDriver_OSS.h" #include "RageSoundDriver_OSS.h"
#endif #endif
#ifdef HAVE_GTK #ifdef HAVE_QUICKTIME1
#include "LoadingWindow/LoadingWindow_Gtk.h" #include "RageSoundDriver_QT1.h"
#endif #endif
/* Load this even if we have GTK, since we can fall back if GTK is missing. */ #ifdef HAVE_WIN32
#ifdef HAVE_SDL #include "RageSoundDriver_WaveOut.h"
#include "LoadingWindow/LoadingWindow_SDL.h"
#endif #endif
#include "ArchHooks/ArchHooks_Unix.h"
#include "Lights/LightsDriver_LinuxWeedTech.h"
#include "Lights/LightsDriver_LinuxParallel.h"
#include "MemoryCard/MemoryCardDriverThreaded_Linux.h"
#endif #endif
/* /*
* (c) 2002-2003 Glenn Maynard * (c) 2005 Ben Anderson
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
@@ -52,4 +58,3 @@
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE. * PERFORMANCE OF THIS SOFTWARE.
*/ */
-183
View File
@@ -1,183 +0,0 @@
/*
* 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"
LoadingWindow *MakeLoadingWindow()
{
#if defined(XBOX)
return new LoadingWindow_Xbox;
#endif
if( !PREFSMAN->m_bShowLoadingWindow )
return new LoadingWindow_Null;
/* Don't load NULL by default. On most systems, if we can't load the SDL
* loading window, we won't be able to init OpenGL, either, so don't bother. */
CString drivers = "win32,cocoa,gtk,sdl";
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString Driver;
LoadingWindow *ret = NULL;
for(unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i)
{
Driver = DriversToTry[i];
#ifdef HAVE_LOADING_WINDOW_WIN32
if(!DriversToTry[i].CompareNoCase("Win32")) ret = new LoadingWindow_Win32;
#endif
#ifdef HAVE_LOADING_WINDOW_GTK
if(!DriversToTry[i].CompareNoCase("Gtk")) ret = new LoadingWindow_Gtk;
#endif
#ifdef HAVE_LOADING_WINDOW_COCOA
if(!DriversToTry[i].CompareNoCase("Cocoa")) ret = new LoadingWindow_Cocoa;
#endif
#ifdef HAVE_LOADING_WINDOW_SDL
if(!DriversToTry[i].CompareNoCase("SDL")) ret = new LoadingWindow_SDL;
#endif
#ifdef HAVE_LOADING_WINDOW_NULL
if(!DriversToTry[i].CompareNoCase("Null")) ret = new LoadingWindow_Null;
#endif
if( ret == NULL )
continue;
CString 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)
LowLevelWindow *MakeLowLevelWindow() { return new ARCH_LOW_LEVEL_WINDOW; }
#endif
void MakeInputHandlers(CString drivers, vector<InputHandler *> &Add)
{
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString Driver;
RageSoundDriver *ret = NULL;
for(unsigned i = 0; ret == NULL && i < DriversToTry.size(); ++i)
{
#if defined(_WINDOWS)
if(!DriversToTry[i].CompareNoCase("DirectInput")) Add.push_back(new InputHandler_DInput);
if(!DriversToTry[i].CompareNoCase("Pump")) Add.push_back(new InputHandler_Win32_Pump);
// if(!DriversToTry[i].CompareNoCase("Para")) Add.push_back(new InputHandler_Win32_Para);
#elif defined(XBOX)
if(!DriversToTry[i].CompareNoCase("Xbox")) Add.push_back(new InputHandler_Xbox);
#endif
#if defined(SUPPORT_SDL_INPUT)
if(!DriversToTry[i].CompareNoCase("SDL")) Add.push_back(new InputHandler_SDL);
#endif
if(!DriversToTry[i].CompareNoCase("MonkeyKeyboard"))Add.push_back(new InputHandler_MonkeyKeyboard);
}
}
RageSoundDriver *MakeRageSoundDriver(CString drivers)
{
CStringArray DriversToTry;
split(drivers, ",", DriversToTry, true);
ASSERT( DriversToTry.size() != 0 );
CString 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 _WINDOWS
if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound;
if(!DriversToTry[i].CompareNoCase("DirectSound-sw")) ret = new RageSound_DSound_Software;
if(!DriversToTry[i].CompareNoCase("WaveOut")) ret = new RageSound_WaveOut;
#endif
#ifdef _XBOX
if(!DriversToTry[i].CompareNoCase("DirectSound")) ret = new RageSound_DSound;
#endif
#ifdef HAVE_ALSA
if(!DriversToTry[i].CompareNoCase("ALSA")) ret = new RageSound_ALSA9;
if(!DriversToTry[i].CompareNoCase("ALSA-sw")) ret = new RageSound_ALSA9_Software;
#endif
#ifdef HAVE_OSS
if(!DriversToTry[i].CompareNoCase("OSS")) ret = new RageSound_OSS;
#endif
#ifdef RAGE_SOUND_CA
if(!DriversToTry[i].CompareNoCase("CoreAudio")) ret = new RageSound_CA;
#endif
#ifdef RAGE_SOUND_QT1
if(!DriversToTry[i].CompareNoCase("QT1")) ret = new RageSound_QT1;
#endif
if(!DriversToTry[i].CompareNoCase("Null")) ret = new RageSound_Null;
if( ret == NULL )
{
LOG->Warn( "Unknown sound driver name: %s", DriversToTry[i].c_str() );
continue;
}
CString 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;
}
/*
* (c) 2002-2004 Glenn Maynard
* 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.
*/
-89
View File
@@ -1,89 +0,0 @@
#ifndef ARCH_H
#define ARCH_H
/* Include this file if you need to create an instance of a driver object. */
class LoadingWindow;
class RageSoundDriver;
class ArchHooks;
class InputHandler;
class LowLevelWindow;
class LightsDriver;
class MemoryCardDriver;
LoadingWindow *MakeLoadingWindow();
LowLevelWindow *MakeLowLevelWindow();
void MakeInputHandlers(CString drivers,vector<InputHandler *> &Add);
RageSoundDriver *MakeRageSoundDriver(CString drivers);
/* These definitions are in here, instead of in arch_*.h, because they
* need to be available to other modules. It'd be overkill to create separate
* "config" and "driver" headers for each arch. */
/* Define the default list of sound drivers for each arch. It's
* OK to list drivers that may not be available. */
#if defined(LINUX)
#define DEFAULT_SOUND_DRIVER_LIST "ALSA,ALSA-sw,OSS"
#elif defined(DARWIN)
#define DEFAULT_SOUND_DRIVER_LIST "CoreAudio,QT1"
#elif defined(_WINDOWS)
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound,DirectSound-sw,WaveOut"
#elif defined(_XBOX)
#define DEFAULT_SOUND_DRIVER_LIST "DirectSound"
#else
#define DEFAULT_SOUND_DRIVER_LIST "Null"
#endif
#if defined(_WINDOWS)
#define DEFAULT_INPUT_DRIVER_LIST "DirectInput,Pump"
#elif defined(_XBOX)
#define DEFAULT_INPUT_DRIVER_LIST "Xbox"
#else
#define DEFAULT_INPUT_DRIVER_LIST "SDL"
#endif
#define DEFAULT_MOVIE_DRIVER_LIST "FFMpeg,Null"
/* Choose your renderers. */
#if defined(_WINDOWS)
#define SUPPORT_OPENGL
#define SUPPORT_D3D
#elif defined(_XBOX)
#define SUPPORT_D3D
#else
#define SUPPORT_OPENGL
#endif
/* Hack for Xbox: All paths must be absolute. */
#if defined(_XBOX)
#define SYS_BASE_PATH "D:\\"
#else
#define SYS_BASE_PATH ""
#endif
#endif
/*
* (c) 2002-2004 Glenn Maynard
* 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.
*/
+28 -39
View File
@@ -1,49 +1,38 @@
#ifndef SDL_ARCH_H #ifndef ARCH_DEFAULT_H
#define SDL_ARCH_H #define ARCH_DEFAULT_H
/* All driver types should have a default, portable implementation, provided /* Define the default driver sets. It's okay to have in the sets drivers that
* here. */ * might not be available, just as long as you don't mind if they're used when
/* None of these SDL implementations run on Xbox, so I've commented * they are available. (For example, if we're using X11, we don't want
* out use of this header and added the #includes to each arch_*.h */ * InputHandler_SDL to be used.) */
/*
* The basic design principle of arch is that a new platform can be up and running
* quickly using only arch_default, with OpenGL graphics and SDL input, and things can
* be overloaded later. That way, people don't have to learn how arch works
* until after they have the basic stuff running.
*
* For Xbox, let's leave this file alone, and special case stuff in arch_xbox.h.
*
* For LowLevelWindow, just undefine SUPPORT_OPENGL and don't link any LLW at
* all.
* For InputHandler, undef SUPPORT_SDL_INPUT and we won't create the SDL input /* InputHandler drivers */
* handler. (We'll still include the header here, but it'll never be used.) #if defined (HAVE_XBOX)
*/ #define DEFAULT_INPUT_DRIVER_LIST "Xbox"
#elif defined(HAVE_DIRECTX)
/* We can have any number of input drivers. By default, use SDL for keyboards #define DEFAULT_INPUT_DRIVER_LIST "DirectInput,Pump,Para"
* and joysticks. If you write your own handler for these devices types, or if #elif defined(HAVE_X11) // Prefer X11 over SDL
* SDL input doesn't work on your platform, undef SUPPORT_SDL_INPUT in your platform #define DEFAULT_INPUT_DRIVER_LIST "X11,Linux_joystick"
* header. */ #elif defined(HAVE_SDL)
#define SUPPORT_SDL_INPUT #define DEFAULT_INPUT_DRIVER_LIST "SDL"
#include "InputHandler/InputHandler_SDL.h" #else
#include "InputHandler/InputHandler_MonkeyKeyboard.h" #if defined(LINUX)
#define DEFAULT_INPUT_DRIVER_LIST "Linux_joystick,Linux_tty"
/* Load default fallback drivers; some of these may be overridden by arch-specific #else
* drivers. These are all singleton drivers--we never use more than one. */ #define DEFAULT_INPUT_DRIVER_LIST "MonkeyKeyboard"
#include "LoadingWindow/LoadingWindow_Null.h" #endif
#include "Sound/RageSoundDriver_Null.h"
#include "Lights/LightsDriver_Null.h"
#include "Lights/LightsDriver_SystemMessage.h"
#include "MemoryCard/MemoryCardDriver_Null.h"
#if defined(SUPPORT_OPENGL)
#include "LowLevelWindow/LowLevelWindow_SDL.h"
#endif #endif
/* MovieTexture drivers */
#define DEFAULT_MOVIE_DRIVER_LIST "FFMpeg,DShow,Null"
/* RageSoundDrivers */
#define DEFAULT_SOUND_DRIVER_LIST "ALSA,DirectSound,ALSA-sw,DirectSound-sw,CoreAudio,OSS,QT1,WaveOut,Null"
#endif #endif
/* /*
* (c) 2002-2004 Glenn Maynard * (c) 2002-2005 Glenn Maynard, Ben Anderson
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
+32 -13
View File
@@ -1,26 +1,45 @@
#ifndef ARCH_PLATFORM_H #ifndef ARCH_PLATFORM_H
#define ARCH_PLATFORM_H #define ARCH_PLATFORM_H
#include "arch.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.
/* Load default drivers. */ #if defined(UNIX) || !defined(DARWIN) // Darwin isn't POSIX enough for us.
#include "arch_default.h" #define HAVE_POSIX
#endif
/* Override them with arch-specific drivers, as available. */ #if defined(DARWIN)
#define HAVE_DARWIN
#define HAVE_COCOA
#define HAVE_COREAUDIO
#define HAVE_QUICKTIME1
#endif
#if defined(_WINDOWS)
#define HAVE_DIRECTX
#define HAVE_WIN32 // XXX: Better name for this API?
#endif
#if defined(_XBOX)
#define HAVE_DIRECTX
#define HAVE_XBOX // XXX: Better name for this API?
#endif
#if defined(LINUX) #if defined(LINUX)
#include "arch_linux.h" #define HAVE_POSIX // Here just to be explicit.
#elif defined(DARWIN) #define HAVE_LINUXKERNEL
#include "arch_darwin.h" #endif
/* I'm also putting the renderer master switch in here, since there's really no
* better place to put it. */
#if defined(_WINDOWS)
#define SUPPORT_OPENGL
#define SUPPORT_D3D
#elif defined(_XBOX) #elif defined(_XBOX)
#include "arch_xbox.h" #define SUPPORT_D3D
#elif defined(_WINDOWS) #else
#include "arch_Win32.h" #define SUPPORT_OPENGL
#endif #endif
#endif #endif
/* /*
* (c) 2002-2004 Glenn Maynard * (c) 2002-2005 Glenn Maynard, Ben Anderson
* All rights reserved. * All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a