From 0db665d4d63042c6f6efc04e8a31be7161bd1306 Mon Sep 17 00:00:00 2001 From: Ben Anderson Date: Mon, 14 Mar 2005 06:44:38 +0000 Subject: [PATCH] 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. --- stepmania/src/Background.cpp | 1 - stepmania/src/BannerCache.cpp | 1 - stepmania/src/Bookkeeper.cpp | 1 - stepmania/src/Character.cpp | 1 - stepmania/src/Course.cpp | 1 - stepmania/src/GameState.cpp | 1 - stepmania/src/InputMapper.cpp | 1 - stepmania/src/Makefile.am | 24 ++- stepmania/src/NoteSkinManager.cpp | 1 - stepmania/src/PlayerAI.cpp | 1 - stepmania/src/PrefsManager.cpp | 2 +- stepmania/src/ProfileManager.cpp | 1 - stepmania/src/RageDisplay.h | 1 + stepmania/src/RageDisplay_D3D.cpp | 2 - stepmania/src/RageDisplay_OGL.cpp | 1 - stepmania/src/RageInput.cpp | 1 - stepmania/src/RageLog.cpp | 1 - stepmania/src/RageSoundManager.cpp | 1 - stepmania/src/RageUtil.cpp | 1 - stepmania/src/RageUtil_FileDB.cpp | 1 - stepmania/src/ScreenEdit.cpp | 1 - stepmania/src/Song.cpp | 1 - stepmania/src/SongManager.cpp | 1 - stepmania/src/StepMania.cpp | 5 +- stepmania/src/TitleSubstitution.cpp | 1 - stepmania/src/arch/ArchHooks/ArchHooks.cpp | 2 +- stepmania/src/arch/ArchHooks/ArchHooks_Unix.h | 4 +- .../src/arch/ArchHooks/ArchHooks_Win32.h | 4 +- stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h | 4 +- .../src/arch/ArchHooks/ArchHooks_darwin.h | 4 +- .../src/arch/ArchHooks/Selector_ArchHooks.h | 48 +++++ stepmania/src/arch/Dialog/Dialog.cpp | 17 +- stepmania/src/arch/Dialog/DialogDriver.h | 1 + .../src/arch/Dialog/DialogDriver_Cocoa.h | 3 +- .../src/arch/Dialog/DialogDriver_Win32.h | 3 +- .../{arch_xbox.h => Dialog/Selector_Dialog.h} | 25 ++- .../src/arch/InputHandler/InputHandler.cpp | 44 +++++ .../src/arch/InputHandler/InputHandler.h | 2 + .../InputHandler/InputHandler_DirectInput.h | 1 + .../InputHandler_Linux_Joystick.h | 1 + .../InputHandler/InputHandler_Linux_tty.h | 1 + .../InputHandler_MonkeyKeyboard.h | 1 + .../src/arch/InputHandler/InputHandler_SDL.h | 2 +- .../InputHandler/InputHandler_Win32_Para.h | 1 + .../InputHandler/InputHandler_Win32_Pump.h | 1 + .../src/arch/InputHandler/InputHandler_X11.h | 1 + .../src/arch/InputHandler/InputHandler_Xbox.h | 2 +- .../arch/InputHandler/Selector_InputHandler.h | 63 ++++++ stepmania/src/arch/Lights/LightsDriver.cpp | 26 ++- .../arch/Lights/LightsDriver_LinuxParallel.h | 1 + .../arch/Lights/LightsDriver_LinuxWeedTech.h | 1 + stepmania/src/arch/Lights/LightsDriver_Null.h | 2 +- .../arch/Lights/LightsDriver_SystemMessage.h | 1 + .../arch/Lights/LightsDriver_Win32Parallel.h | 1 + .../src/arch/Lights/Selector_LightsDriver.h | 42 ++++ .../src/arch/LoadingWindow/LoadingWindow.cpp | 89 +++++++++ .../src/arch/LoadingWindow/LoadingWindow.h | 4 + .../arch/LoadingWindow/LoadingWindow_Cocoa.h | 9 +- .../arch/LoadingWindow/LoadingWindow_Gtk.h | 3 +- .../arch/LoadingWindow/LoadingWindow_Null.h | 3 +- .../arch/LoadingWindow/LoadingWindow_SDL.h | 3 +- .../arch/LoadingWindow/LoadingWindow_Win32.h | 3 +- .../arch/LoadingWindow/LoadingWindow_Xbox.h | 1 + .../Selector_LoadingWindow.h} | 38 ++-- .../LowLevelWindow.cpp} | 13 +- .../src/arch/LowLevelWindow/LowLevelWindow.h | 3 + .../arch/LowLevelWindow/LowLevelWindow_SDL.h | 4 +- .../LowLevelWindow/LowLevelWindow_Win32.h | 5 +- .../LowLevelWindow/LowLevelWindow_X11.cpp | 3 +- .../arch/LowLevelWindow/LowLevelWindow_X11.h | 5 +- .../LowLevelWindow/Selector_LowLevelWindow.h | 40 ++++ .../src/arch/MemoryCard/MemoryCardDriver.cpp | 10 +- .../MemoryCardDriverThreaded_Linux.h | 5 + .../MemoryCardDriverThreaded_Windows.h | 5 + .../MemoryCard/Selector_MemoryCardDriver.h | 38 ++++ .../src/arch/MovieTexture/MovieTexture.cpp | 18 +- .../arch/MovieTexture/MovieTexture_FFMpeg.h | 1 + .../src/arch/MovieTexture/MovieTexture_Null.h | 7 +- .../arch/MovieTexture/Selector_MovieTexture.h | 42 ++++ stepmania/src/arch/Sound/RageSoundDriver.cpp | 95 +++++++++ stepmania/src/arch/Sound/RageSoundDriver.h | 4 + .../src/arch/Sound/RageSoundDriver_ALSA9.h | 1 + .../Sound/RageSoundDriver_ALSA9_Software.h | 1 + stepmania/src/arch/Sound/RageSoundDriver_CA.h | 3 +- .../src/arch/Sound/RageSoundDriver_DSound.h | 1 + .../Sound/RageSoundDriver_DSound_Software.h | 1 + .../src/arch/Sound/RageSoundDriver_Null.h | 1 + .../src/arch/Sound/RageSoundDriver_OSS.h | 1 + .../src/arch/Sound/RageSoundDriver_QT1.h | 7 +- .../src/arch/Sound/RageSoundDriver_WaveOut.h | 1 + .../Selector_RageSoundDriver.h} | 43 ++-- stepmania/src/arch/arch.cpp | 183 ------------------ stepmania/src/arch/arch.h | 89 --------- stepmania/src/arch/arch_default.h | 67 +++---- stepmania/src/arch/arch_platform.h | 45 +++-- 95 files changed, 765 insertions(+), 493 deletions(-) create mode 100644 stepmania/src/arch/ArchHooks/Selector_ArchHooks.h rename stepmania/src/arch/{arch_xbox.h => Dialog/Selector_Dialog.h} (78%) create mode 100644 stepmania/src/arch/InputHandler/Selector_InputHandler.h create mode 100644 stepmania/src/arch/Lights/Selector_LightsDriver.h create mode 100644 stepmania/src/arch/LoadingWindow/LoadingWindow.cpp rename stepmania/src/arch/{arch_Win32.h => LoadingWindow/Selector_LoadingWindow.h} (65%) rename stepmania/src/arch/{arch_darwin.h => LowLevelWindow/LowLevelWindow.cpp} (84%) create mode 100644 stepmania/src/arch/LowLevelWindow/Selector_LowLevelWindow.h create mode 100644 stepmania/src/arch/MemoryCard/Selector_MemoryCardDriver.h create mode 100644 stepmania/src/arch/MovieTexture/Selector_MovieTexture.h create mode 100644 stepmania/src/arch/Sound/RageSoundDriver.cpp rename stepmania/src/arch/{arch_linux.h => Sound/Selector_RageSoundDriver.h} (69%) delete mode 100644 stepmania/src/arch/arch.cpp delete mode 100644 stepmania/src/arch/arch.h diff --git a/stepmania/src/Background.cpp b/stepmania/src/Background.cpp index 396ad6ad7d..f2c9fd2c56 100644 --- a/stepmania/src/Background.cpp +++ b/stepmania/src/Background.cpp @@ -11,7 +11,6 @@ #include "NoteTypes.h" #include "Steps.h" #include "DancingCharacters.h" -#include "arch/arch.h" #include "BeginnerHelper.h" #include "StatsManager.h" #include "ScreenDimensions.h" diff --git a/stepmania/src/BannerCache.cpp b/stepmania/src/BannerCache.cpp index 53119795c8..f22b6091e3 100644 --- a/stepmania/src/BannerCache.cpp +++ b/stepmania/src/BannerCache.cpp @@ -1,6 +1,5 @@ #include "global.h" -#include "arch/arch.h" #include "Foreach.h" #include "RageDisplay.h" #include "RageUtil.h" diff --git a/stepmania/src/Bookkeeper.cpp b/stepmania/src/Bookkeeper.cpp index e49243380d..24f6bec6ff 100644 --- a/stepmania/src/Bookkeeper.cpp +++ b/stepmania/src/Bookkeeper.cpp @@ -1,7 +1,6 @@ #include "global.h" #include "Bookkeeper.h" #include "RageUtil.h" -#include "arch/arch.h" #include "PrefsManager.h" #include "RageLog.h" #include "IniFile.h" diff --git a/stepmania/src/Character.cpp b/stepmania/src/Character.cpp index 4ab990dd79..1b93254c68 100644 --- a/stepmania/src/Character.cpp +++ b/stepmania/src/Character.cpp @@ -2,7 +2,6 @@ #include "Character.h" #include "IniFile.h" #include "RageUtil.h" -#include "arch/arch.h" bool Character::Load( CString sCharDir ) diff --git a/stepmania/src/Course.cpp b/stepmania/src/Course.cpp index b92ccd1c33..afb3d054da 100644 --- a/stepmania/src/Course.cpp +++ b/stepmania/src/Course.cpp @@ -16,7 +16,6 @@ #include "Steps.h" #include "BannerCache.h" #include "RageFile.h" -#include "arch/arch.h" #include "ThemeManager.h" #include "ProfileManager.h" #include "Foreach.h" diff --git a/stepmania/src/GameState.cpp b/stepmania/src/GameState.cpp index 375e3f0caf..c8e3537491 100644 --- a/stepmania/src/GameState.cpp +++ b/stepmania/src/GameState.cpp @@ -17,7 +17,6 @@ #include "UnlockManager.h" #include "AnnouncerManager.h" #include "ProfileManager.h" -#include "arch/arch.h" #include "ThemeManager.h" #include "LightsManager.h" #include "RageFile.h" diff --git a/stepmania/src/InputMapper.cpp b/stepmania/src/InputMapper.cpp index b45004ec1e..1d10c9f65b 100644 --- a/stepmania/src/InputMapper.cpp +++ b/stepmania/src/InputMapper.cpp @@ -8,7 +8,6 @@ #include "RageUtil.h" #include "PrefsManager.h" #include "RageInput.h" -#include "arch/arch.h" #include "Game.h" #include "Style.h" diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index e80b01d623..cd5c3950bf 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -100,14 +100,16 @@ StepMania = StdString.h \ StepMania.cpp StepMania.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 LoadingWindow += arch/LoadingWindow/LoadingWindow_Gtk.cpp arch/LoadingWindow/LoadingWindow_Gtk.h endif -Sound = arch/Sound/RageSoundDriver_Null.cpp arch/Sound/RageSoundDriver_Null.h \ - arch/Sound/RageSoundDriver_Generic_Software.cpp arch/Sound/RageSoundDriver_Generic_Software.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 if HAVE_OSS @@ -141,7 +143,7 @@ Lights = arch/Lights/LightsDriver.cpp arch/Lights/LightsDriver.h \ arch/Lights/LightsDriver_SystemMessage.cpp arch/Lights/LightsDriver_SystemMessage.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 = @@ -150,17 +152,19 @@ Dialog = arch/Dialog/Dialog.cpp arch/Dialog/Dialog.h arch/Dialog/DialogDriver.h Threads = arch/Threads/Threads.h if HAVE_X11 +# InputHandler_X11 depends on LowLevelWindow_X11 InputHandler += arch/InputHandler/InputHandler_X11.cpp arch/InputHandler/InputHandler_X11.h LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_X11.cpp arch/LowLevelWindow/LowLevelWindow_X11.h ArchUtils += archutils/Unix/X11Helper.cpp archutils/Unix/X11Helper.h -endif - +else if HAVE_SDL +# InputHandler_SDL depends on LowLevelWindow_SDL InputHandler += arch/InputHandler/InputHandler_SDL.cpp arch/InputHandler/InputHandler_SDL.h LowLevelWindow += arch/LowLevelWindow/LowLevelWindow_SDL.cpp arch/LowLevelWindow/LowLevelWindow_SDL.h LoadingWindow += arch/LoadingWindow/LoadingWindow_SDL.cpp arch/LoadingWindow/LoadingWindow_SDL.h StepMania += SDL_utils.cpp SDL_utils.h endif +endif # Platform-specific drivers: @@ -188,11 +192,17 @@ endif if LINUX 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 Arch = $(LoadingWindow) $(Sound) $(ArchHooks) $(InputHandler) $(MovieTexture) \ $(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 diff --git a/stepmania/src/NoteSkinManager.cpp b/stepmania/src/NoteSkinManager.cpp index fa944b0914..07d3147056 100644 --- a/stepmania/src/NoteSkinManager.cpp +++ b/stepmania/src/NoteSkinManager.cpp @@ -7,7 +7,6 @@ #include "StyleInput.h" #include "Style.h" #include "RageUtil.h" -#include "arch/arch.h" #include "RageDisplay.h" #include "arch/Dialog/Dialog.h" #include "PrefsManager.h" diff --git a/stepmania/src/PlayerAI.cpp b/stepmania/src/PlayerAI.cpp index d0388ad8d3..f5108f7e85 100644 --- a/stepmania/src/PlayerAI.cpp +++ b/stepmania/src/PlayerAI.cpp @@ -4,7 +4,6 @@ #include "IniFile.h" #include "RageException.h" #include "GameState.h" -#include "arch/arch.h" #include "PlayerState.h" #define AI_PATH "Data/AI.ini" diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 160f2537aa..09161bb45b 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -4,7 +4,7 @@ #include "GameState.h" #include "RageDisplay.h" #include "RageUtil.h" -#include "arch/arch.h" /* for default driver specs */ +#include "arch/arch_default.h" #include "RageSoundReader_Resample.h" /* for ResampleQuality */ #include "RageFile.h" #include "ProductInfo.h" diff --git a/stepmania/src/ProfileManager.cpp b/stepmania/src/ProfileManager.cpp index 043b269178..687ead88bc 100644 --- a/stepmania/src/ProfileManager.cpp +++ b/stepmania/src/ProfileManager.cpp @@ -1,7 +1,6 @@ #include "global.h" #include "ProfileManager.h" #include "RageUtil.h" -#include "arch/arch.h" #include "PrefsManager.h" #include "RageLog.h" #include "RageFile.h" diff --git a/stepmania/src/RageDisplay.h b/stepmania/src/RageDisplay.h index a2669815e5..ef0f7e91ec 100644 --- a/stepmania/src/RageDisplay.h +++ b/stepmania/src/RageDisplay.h @@ -3,6 +3,7 @@ #ifndef RAGEDISPLAY_H #define RAGEDISPLAY_H +#include "global.h" #include "RageTypes.h" #include "ModelTypes.h" diff --git a/stepmania/src/RageDisplay_D3D.cpp b/stepmania/src/RageDisplay_D3D.cpp index 5ef2b490db..1ecfc908ac 100644 --- a/stepmania/src/RageDisplay_D3D.cpp +++ b/stepmania/src/RageDisplay_D3D.cpp @@ -29,8 +29,6 @@ #include "ScreenDimensions.h" -#include "arch/arch.h" - // Static libraries // load Windows D3D8 dynamically #if defined(_WINDOWS) diff --git a/stepmania/src/RageDisplay_OGL.cpp b/stepmania/src/RageDisplay_OGL.cpp index 6486bca43f..72540ff532 100644 --- a/stepmania/src/RageDisplay_OGL.cpp +++ b/stepmania/src/RageDisplay_OGL.cpp @@ -54,7 +54,6 @@ #include "StepMania.h" #include "RageUtil.h" -#include "arch/arch.h" #include "arch/LowLevelWindow/LowLevelWindow.h" #ifdef WIN32 diff --git a/stepmania/src/RageInput.cpp b/stepmania/src/RageInput.cpp index fa96dc0b47..3970b3482a 100644 --- a/stepmania/src/RageInput.cpp +++ b/stepmania/src/RageInput.cpp @@ -2,7 +2,6 @@ #include "RageInput.h" #include "RageLog.h" #include "RageException.h" -#include "arch/arch.h" #include "arch/InputHandler/InputHandler.h" RageInput* INPUTMAN = NULL; // globally accessable input device diff --git a/stepmania/src/RageLog.cpp b/stepmania/src/RageLog.cpp index c45237fc2a..2db8a36ae6 100644 --- a/stepmania/src/RageLog.cpp +++ b/stepmania/src/RageLog.cpp @@ -1,6 +1,5 @@ #include "global.h" #include "arch/ArchHooks/ArchHooks.h" -#include "arch/arch.h" #include "RageLog.h" #include "RageUtil.h" #include "RageTimer.h" diff --git a/stepmania/src/RageSoundManager.cpp b/stepmania/src/RageSoundManager.cpp index 70a0f73bf5..8232a11deb 100644 --- a/stepmania/src/RageSoundManager.cpp +++ b/stepmania/src/RageSoundManager.cpp @@ -9,7 +9,6 @@ #include "RageLog.h" #include "RageTimer.h" -#include "arch/arch.h" #include "arch/Sound/RageSoundDriver.h" /* diff --git a/stepmania/src/RageUtil.cpp b/stepmania/src/RageUtil.cpp index dda35c2196..b820652907 100644 --- a/stepmania/src/RageUtil.cpp +++ b/stepmania/src/RageUtil.cpp @@ -3,7 +3,6 @@ #include "RageUtil.h" #include "RageLog.h" #include "RageFile.h" -#include "arch/arch.h" #include #include diff --git a/stepmania/src/RageUtil_FileDB.cpp b/stepmania/src/RageUtil_FileDB.cpp index 6d95ac0346..8aaefd9d9a 100644 --- a/stepmania/src/RageUtil_FileDB.cpp +++ b/stepmania/src/RageUtil_FileDB.cpp @@ -3,7 +3,6 @@ #include "RageUtil_FileDB.h" #include "RageUtil.h" #include "RageLog.h" -#include "arch/arch.h" /* Search for "beginning*containing*ending". */ void FileSet::GetFilesMatching(const CString &beginning, const CString &containing, const CString &ending, vector &out, bool bOnlyDirs) const diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 4884902818..563a0a2f14 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -18,7 +18,6 @@ #include "Steps.h" #include #include "NoteFieldPositioning.h" -#include "arch/arch.h" #include "NoteDataUtil.h" #include "SongUtil.h" #include "StepsUtil.h" diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index 58bf5e1fbf..d2363b4650 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -17,7 +17,6 @@ #include "TitleSubstitution.h" #include "BannerCache.h" #include "Sprite.h" -#include "arch/arch.h" #include "RageFile.h" #include "RageFileManager.h" #include "RageSurface.h" diff --git a/stepmania/src/SongManager.cpp b/stepmania/src/SongManager.cpp index 5fc8b1111b..882a7871ac 100644 --- a/stepmania/src/SongManager.cpp +++ b/stepmania/src/SongManager.cpp @@ -5,7 +5,6 @@ #include "MsdFile.h" #include "NotesLoaderDWI.h" #include "BannerCache.h" -#include "arch/arch.h" #include "GameState.h" #include "PrefsManager.h" diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index b1e4a9da2a..590850affb 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -16,7 +16,6 @@ #include "RageDisplay.h" #include "RageThreads.h" -#include "arch/arch.h" #include "arch/ArchHooks/ArchHooks.h" #include "arch/LoadingWindow/LoadingWindow.h" #include "arch/Dialog/Dialog.h" @@ -35,6 +34,8 @@ #include "RageSurface.h" #include "RageSurface_Load.h" +#include "arch/arch_platform.h" + // // StepMania global classes // @@ -1358,7 +1359,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT))) || (DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F12) && (INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RMETA)) || - INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LMETA))))) + INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LMETA))))) { // If holding LShift save uncompressed, else save compressed bool bSaveCompressed = !INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) ); diff --git a/stepmania/src/TitleSubstitution.cpp b/stepmania/src/TitleSubstitution.cpp index f0e610f7e0..0aab36b748 100644 --- a/stepmania/src/TitleSubstitution.cpp +++ b/stepmania/src/TitleSubstitution.cpp @@ -1,6 +1,5 @@ #include "global.h" #include "TitleSubstitution.h" -#include "arch/arch.h" #include "RageUtil.h" #include "RageLog.h" diff --git a/stepmania/src/arch/ArchHooks/ArchHooks.cpp b/stepmania/src/arch/ArchHooks/ArchHooks.cpp index bfa03e00d9..83cf95a1ca 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks.cpp @@ -3,7 +3,7 @@ ArchHooks *HOOKS = NULL; -#include "../arch_platform.h" +#include "Selector_ArchHooks.h" ArchHooks *MakeArchHooks() { return new ARCH_HOOKS; } /* diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.h b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.h index 3e9e6d14aa..98d63d9a26 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.h @@ -12,7 +12,9 @@ public: int64_t GetMicrosecondsSinceStart(); }; -#undef ARCH_HOOKS +#ifdef ARCH_HOOKS +#error "More than one ArchHooks selected!" +#endif #define ARCH_HOOKS ArchHooks_Unix #endif diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h index 9c0a3d29d2..047e961006 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Win32.h @@ -25,7 +25,9 @@ private: void CheckVideoDriver(); }; -#undef ARCH_HOOKS +#ifdef ARCH_HOOKS +#error "More than one ArchHooks selected!" +#endif #define ARCH_HOOKS ArchHooks_Win32 #endif diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h index d649cdbf52..b9c438b0cc 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Xbox.h @@ -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 #endif diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_darwin.h b/stepmania/src/arch/ArchHooks/ArchHooks_darwin.h index ff29b75a1b..ab6f7c6fe6 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_darwin.h +++ b/stepmania/src/arch/ArchHooks/ArchHooks_darwin.h @@ -26,7 +26,9 @@ protected: RageMutex *TimeCritMutex; }; -#undef ARCH_HOOKS +#ifdef ARCH_HOOKS +#error "More than one ArchHooks selected!" +#endif #define ARCH_HOOKS ArchHooks_darwin #endif /* ARCH_HOOKS_DARWIN_H */ diff --git a/stepmania/src/arch/ArchHooks/Selector_ArchHooks.h b/stepmania/src/arch/ArchHooks/Selector_ArchHooks.h new file mode 100644 index 0000000000..f3db8d6808 --- /dev/null +++ b/stepmania/src/arch/ArchHooks/Selector_ArchHooks.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. + */ diff --git a/stepmania/src/arch/Dialog/Dialog.cpp b/stepmania/src/arch/Dialog/Dialog.cpp index ff10c8e3cf..6bb5d287ed 100644 --- a/stepmania/src/arch/Dialog/Dialog.cpp +++ b/stepmania/src/arch/Dialog/Dialog.cpp @@ -5,16 +5,7 @@ #include "RageUtil.h" #include "RageLog.h" -/* Hmm. I don't want this to depend on other arch drivers--we should be able to test - * 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 +#include "Selector_Dialog.h" static DialogDriver *g_pImpl = NULL; static DialogDriver_Null g_NullDriver; @@ -37,13 +28,15 @@ void Dialog::Init() { Driver = DriversToTry[i]; -#if defined(HAVE_DIALOG_WIN32) +#if defined(USE_DIALOG_DRIVER_WIN32) if( !DriversToTry[i].CompareNoCase("Win32") ) g_pImpl = new DialogDriver_Win32; #endif -#if defined(HAVE_DIALOG_COCOA) +#if defined(USE_DIALOG_DRIVER_COCOA) if( !DriversToTry[i].CompareNoCase("Cocoa") ) g_pImpl = new DialogDriver_Cocoa; #endif +#if defined(USE_DIALOG_DRIVER_NULL) if( !DriversToTry[i].CompareNoCase("Null") ) g_pImpl = new DialogDriver_Null; +#endif if( g_pImpl == NULL ) continue; diff --git a/stepmania/src/arch/Dialog/DialogDriver.h b/stepmania/src/arch/Dialog/DialogDriver.h index 88459dc39d..8a40a92b84 100644 --- a/stepmania/src/arch/Dialog/DialogDriver.h +++ b/stepmania/src/arch/Dialog/DialogDriver.h @@ -16,6 +16,7 @@ public: }; class DialogDriver_Null: public DialogDriver { }; +#define USE_DIALOG_DRIVER_NULL #endif diff --git a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h index 77747c8666..3c35d56f04 100644 --- a/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h +++ b/stepmania/src/arch/Dialog/DialogDriver_Cocoa.h @@ -10,8 +10,7 @@ public: void OK(CString sMessage, CString ID); Dialog::Result AbortRetryIgnore(CString sMessage, CString ID); }; - -#define HAVE_DIALOG_COCOA +#define USE_DIALOG_DRIVER_COCOA #endif /* ARCH_HOOKS_DARWIN_H */ diff --git a/stepmania/src/arch/Dialog/DialogDriver_Win32.h b/stepmania/src/arch/Dialog/DialogDriver_Win32.h index cf2433906e..8f3bc576bd 100644 --- a/stepmania/src/arch/Dialog/DialogDriver_Win32.h +++ b/stepmania/src/arch/Dialog/DialogDriver_Win32.h @@ -11,8 +11,7 @@ public: Dialog::Result AbortRetryIgnore( CString sMessage, CString ID ); Dialog::Result AbortRetry( CString sMessage, CString ID ); }; - -#define HAVE_DIALOG_WIN32 +#define USE_DIALOG_DRIVER_WIN32 #endif diff --git a/stepmania/src/arch/arch_xbox.h b/stepmania/src/arch/Dialog/Selector_Dialog.h similarity index 78% rename from stepmania/src/arch/arch_xbox.h rename to stepmania/src/arch/Dialog/Selector_Dialog.h index fa26df77e6..c8657aa61c 100644 --- a/stepmania/src/arch/arch_xbox.h +++ b/stepmania/src/arch/Dialog/Selector_Dialog.h @@ -1,23 +1,23 @@ -#ifndef XBOX_ARCH_H -#define XBOX_ARCH_H +#ifndef SELECTOR_DIALOG +#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 "Sound/RageSoundDriver_DSound.h" - -/* Undef this if you need no SDL input. */ -#undef SUPPORT_SDL_INPUT +#include "DialogDriver.h" // DialogDriver_Null is in here #endif /* - * (c) 2002 Glenn Maynard, Chris Danford + * (c) 2005 Ben Anderson. * All rights reserved. * * 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 * PERFORMANCE OF THIS SOFTWARE. */ - diff --git a/stepmania/src/arch/InputHandler/InputHandler.cpp b/stepmania/src/arch/InputHandler/InputHandler.cpp index cc4cb27f6d..464ce4ac53 100644 --- a/stepmania/src/arch/InputHandler/InputHandler.cpp +++ b/stepmania/src/arch/InputHandler/InputHandler.cpp @@ -1,7 +1,51 @@ #include "global.h" #include "InputFilter.h" +#include "RageUtil.h" #include "InputHandler.h" +#include "Selector_InputHandler.h" + +void MakeInputHandlers(CString drivers, vector &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() { m_LastUpdate.Touch(); diff --git a/stepmania/src/arch/InputHandler/InputHandler.h b/stepmania/src/arch/InputHandler/InputHandler.h index 3fc61a8d08..3d291d35b6 100644 --- a/stepmania/src/arch/InputHandler/InputHandler.h +++ b/stepmania/src/arch/InputHandler/InputHandler.h @@ -55,6 +55,8 @@ protected: void UpdateTimer(); }; +void MakeInputHandlers(CString drivers, vector &Add); + #endif /* diff --git a/stepmania/src/arch/InputHandler/InputHandler_DirectInput.h b/stepmania/src/arch/InputHandler/InputHandler_DirectInput.h index 5628022074..75f049e1e2 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_DirectInput.h +++ b/stepmania/src/arch/InputHandler/InputHandler_DirectInput.h @@ -27,6 +27,7 @@ public: void Update(float fDeltaTime); void WindowReset(); }; +#define USE_INPUT_HANDLER_DIRECTINPUT #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_Linux_Joystick.h b/stepmania/src/arch/InputHandler/InputHandler_Linux_Joystick.h index 0f689b1a0b..5746457e38 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Linux_Joystick.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Linux_Joystick.h @@ -16,6 +16,7 @@ public: private: int fds[NUM_JOYSTICKS]; }; +#define USE_INPUT_HANDLER_LINUX_JOYSTICK #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_Linux_tty.h b/stepmania/src/arch/InputHandler/InputHandler_Linux_tty.h index cf313cb93b..f5e01e8512 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Linux_tty.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Linux_tty.h @@ -14,6 +14,7 @@ public: ~InputHandler_Linux_tty(); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; +#define USE_INPUT_HANDLER_LINUX_TTY #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h b/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h index 44f62666e6..08102845c2 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h +++ b/stepmania/src/arch/InputHandler/InputHandler_MonkeyKeyboard.h @@ -16,6 +16,7 @@ public: ~InputHandler_MonkeyKeyboard(); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; +#define USE_INPUT_HANDLER_MONKEY_KEYBOARD #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_SDL.h b/stepmania/src/arch/InputHandler/InputHandler_SDL.h index 1285f3869d..b7f3072375 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_SDL.h +++ b/stepmania/src/arch/InputHandler/InputHandler_SDL.h @@ -16,7 +16,7 @@ public: ~InputHandler_SDL(); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; - +#define USE_INPUT_HANDLER_SDL #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_Win32_Para.h b/stepmania/src/arch/InputHandler/InputHandler_Win32_Para.h index 84675ae2fe..16051b5479 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Win32_Para.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Win32_Para.h @@ -22,6 +22,7 @@ public: ~InputHandler_Win32_Para(); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; +#define USE_INPUT_HANDLER_WIN32_PARA #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_Win32_Pump.h b/stepmania/src/arch/InputHandler/InputHandler_Win32_Pump.h index ff012b5494..4cf9508abc 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Win32_Pump.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Win32_Pump.h @@ -22,6 +22,7 @@ public: ~InputHandler_Win32_Pump(); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; +#define USE_INPUT_HANDLER_WIN32_PUMP #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_X11.h b/stepmania/src/arch/InputHandler/InputHandler_X11.h index 546b4cd1ac..45959e2f17 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_X11.h +++ b/stepmania/src/arch/InputHandler/InputHandler_X11.h @@ -13,6 +13,7 @@ public: void Update(float fDeltaTime); void GetDevicesAndDescriptions(vector& vDevicesOut, vector& vDescriptionsOut); }; +#define USE_INPUT_HANDLER_X11 #endif diff --git a/stepmania/src/arch/InputHandler/InputHandler_Xbox.h b/stepmania/src/arch/InputHandler/InputHandler_Xbox.h index 9a10800f3b..809ac6ac82 100644 --- a/stepmania/src/arch/InputHandler/InputHandler_Xbox.h +++ b/stepmania/src/arch/InputHandler/InputHandler_Xbox.h @@ -21,7 +21,7 @@ public: private: void getHandles(); }; - +#define USE_INPUT_HANDLER_XBOX #endif diff --git a/stepmania/src/arch/InputHandler/Selector_InputHandler.h b/stepmania/src/arch/InputHandler/Selector_InputHandler.h new file mode 100644 index 0000000000..8061409024 --- /dev/null +++ b/stepmania/src/arch/InputHandler/Selector_InputHandler.h @@ -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. + */ diff --git a/stepmania/src/arch/Lights/LightsDriver.cpp b/stepmania/src/arch/Lights/LightsDriver.cpp index 77444073d6..e70ce0b149 100644 --- a/stepmania/src/arch/Lights/LightsDriver.cpp +++ b/stepmania/src/arch/Lights/LightsDriver.cpp @@ -1,8 +1,8 @@ #include "global.h" #include "LightsDriver.h" #include "RageLog.h" -#include "arch/arch.h" -#include "arch/arch_platform.h" + +#include "Selector_LightsDriver.h" LightsDriver *MakeLightsDriver(CString driver) { @@ -10,17 +10,23 @@ LightsDriver *MakeLightsDriver(CString driver) LightsDriver *ret = NULL; -#ifdef _WINDOWS -// if( !driver.CompareNoCase("Parallel") ) ret = new LightsDriver_Win32Parallel; +#ifdef USE_LIGHTS_DRIVER_LINUX_PARALLEL + if( !driver.CompareNoCase("LinuxParallel") ) ret = new LightsDriver_LinuxParallel; #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; +#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() ); return ret; diff --git a/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.h b/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.h index 06649497c6..4aabedae97 100644 --- a/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.h +++ b/stepmania/src/arch/Lights/LightsDriver_LinuxParallel.h @@ -13,6 +13,7 @@ public: virtual ~LightsDriver_LinuxParallel(); virtual void Set( const LightsState *ls ); }; +#define USE_LIGHTS_DRIVER_LINUX_PARALLEL #endif diff --git a/stepmania/src/arch/Lights/LightsDriver_LinuxWeedTech.h b/stepmania/src/arch/Lights/LightsDriver_LinuxWeedTech.h index 27f4b891a2..56680a529b 100644 --- a/stepmania/src/arch/Lights/LightsDriver_LinuxWeedTech.h +++ b/stepmania/src/arch/Lights/LightsDriver_LinuxWeedTech.h @@ -16,6 +16,7 @@ public: virtual void Set( const LightsState *ls ); }; +#define USE_LIGHTS_DRIVER_LINUX_WEEDTECH #endif diff --git a/stepmania/src/arch/Lights/LightsDriver_Null.h b/stepmania/src/arch/Lights/LightsDriver_Null.h index 9fea9e73fb..1ec39c9d57 100644 --- a/stepmania/src/arch/Lights/LightsDriver_Null.h +++ b/stepmania/src/arch/Lights/LightsDriver_Null.h @@ -11,7 +11,7 @@ public: void Set( const LightsState *ls ) {}; }; - +#define USE_LIGHTS_DRIVER_NULL #endif diff --git a/stepmania/src/arch/Lights/LightsDriver_SystemMessage.h b/stepmania/src/arch/Lights/LightsDriver_SystemMessage.h index bc2a807346..e401789e0c 100644 --- a/stepmania/src/arch/Lights/LightsDriver_SystemMessage.h +++ b/stepmania/src/arch/Lights/LightsDriver_SystemMessage.h @@ -11,6 +11,7 @@ public: virtual void Set( const LightsState *ls ); }; +#define USE_LIGHTS_DRIVER_SYSTEM_MESSAGE #endif diff --git a/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.h b/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.h index 474ac5d8c0..cbad956d48 100644 --- a/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.h +++ b/stepmania/src/arch/Lights/LightsDriver_Win32Parallel.h @@ -16,6 +16,7 @@ public: virtual void Set( const LightsState *ls ); }; +#define USE_LIGHTS_DRIVER_WIN32_PARALLEL #endif diff --git a/stepmania/src/arch/Lights/Selector_LightsDriver.h b/stepmania/src/arch/Lights/Selector_LightsDriver.h new file mode 100644 index 0000000000..2399e8b88b --- /dev/null +++ b/stepmania/src/arch/Lights/Selector_LightsDriver.h @@ -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. + */ diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp new file mode 100644 index 0000000000..74887fa7b8 --- /dev/null +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow.cpp @@ -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. + */ diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow.h b/stepmania/src/arch/LoadingWindow/LoadingWindow.h index 2f3128bff4..bb7504234a 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow.h @@ -3,6 +3,8 @@ #ifndef LOADING_WINDOW_H #define LOADING_WINDOW_H +#include "global.h" + struct RageSurface; class LoadingWindow { @@ -15,6 +17,8 @@ public: virtual void SetIcon( const RageSurface *pIcon ) { } }; +LoadingWindow *MakeLoadingWindow(); + #endif /* diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Cocoa.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Cocoa.h index b1ba567c52..78b54b4c0f 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Cocoa.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Cocoa.h @@ -1,7 +1,7 @@ /* LoadingWindow_Cocoa - Loading window for OSX */ -#ifndef LOADING_WINDOW_COCOA -#define LOADING_WINDOW_COCOA +#ifndef LOADING_WINDOW_COCOA_H +#define LOADING_WINDOW_COCOA_H #include "LoadingWindow.h" @@ -17,10 +17,9 @@ public: void Paint() {} /* Not needed */ void SetText( CString str ) { SetCocoaWindowText( str ); } }; +#define USE_LOADING_WINDOW_COCOA -#define HAVE_LOADING_WINDOW_COCOA - -#endif /* LOADING_WINDOW_COCOA */ +#endif /* * (c) 2003-2004 Steve Checkoway diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h index 66c3d829ee..07c3473286 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h @@ -15,8 +15,7 @@ public: void SetText(CString str); void Paint() { } }; - -#define HAVE_LOADING_WINDOW_GTK +#define USE_LOADING_WINDOW_GTK #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Null.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Null.h index ff7d4afeae..a774a925f9 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Null.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Null.h @@ -11,8 +11,7 @@ public: void SetText(CString str) { } void Paint() { } }; - -#define HAVE_LOADING_WINDOW_NULL +#define USE_LOADING_WINDOW_NULL #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h index d11d903519..d22d2df9ab 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_SDL.h @@ -14,8 +14,7 @@ public: void Paint(); }; - -#define HAVE_LOADING_WINDOW_SDL +#define USE_LOADING_WINDOW_SDL #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h index 13cb28fc03..f197d6de2d 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Win32.h @@ -25,8 +25,7 @@ private: static BOOL CALLBACK WndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ); }; - -#define HAVE_LOADING_WINDOW_WIN32 +#define USE_LOADING_WINDOW_WIN32 #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Xbox.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Xbox.h index 14a3e2a0fa..9e6232bba8 100644 --- a/stepmania/src/arch/LoadingWindow/LoadingWindow_Xbox.h +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Xbox.h @@ -21,6 +21,7 @@ protected: XFONT* font; bool useImage; }; +#define USE_LOADING_WINDOW_XBOX #endif diff --git a/stepmania/src/arch/arch_Win32.h b/stepmania/src/arch/LoadingWindow/Selector_LoadingWindow.h similarity index 65% rename from stepmania/src/arch/arch_Win32.h rename to stepmania/src/arch/LoadingWindow/Selector_LoadingWindow.h index 5abac2b428..ba1014f518 100644 --- a/stepmania/src/arch/arch_Win32.h +++ b/stepmania/src/arch/LoadingWindow/Selector_LoadingWindow.h @@ -1,31 +1,35 @@ -#ifndef WIN32_ARCH_H -#define WIN32_ARCH_H +#ifndef SELECTOR_LOADING_WINDOW_H +#define SELECTOR_LOADING_WINDOW_H -/* Load drivers for Win32. */ -#include "LoadingWindow/LoadingWindow_Win32.h" -#include "ArchHooks/ArchHooks_Win32.h" +#include "arch/arch_platform.h" -#include "InputHandler/InputHandler_DirectInput.h" -#include "InputHandler/InputHandler_Win32_Pump.h" -#include "InputHandler/InputHandler_Win32_Para.h" +/* LoadingWindow driver selector. */ +#ifdef HAVE_COCOA +#include "LoadingWindow_Cocoa.h" +#endif -#include "Sound/RageSoundDriver_DSound.h" -#include "Sound/RageSoundDriver_DSound_Software.h" -#include "Sound/RageSoundDriver_WaveOut.h" +#ifdef HAVE_GTK +#include "LoadingWindow_Gtk.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 -#undef SUPPORT_SDL_INPUT +#ifdef HAVE_XBOX +#include "LoadingWindow_Xbox.h" +#endif #endif /* - * (c) 2002-2004 Glenn Maynard + * (c) 2005 Ben Anderson * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/stepmania/src/arch/arch_darwin.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.cpp similarity index 84% rename from stepmania/src/arch/arch_darwin.h rename to stepmania/src/arch/LowLevelWindow/LowLevelWindow.cpp index ad6a31b8b0..698769e3bf 100644 --- a/stepmania/src/arch/arch_darwin.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.cpp @@ -1,15 +1,11 @@ -#ifndef ARCH_DARWIN_H -#define ARCH_DARWIN_H +#include "LowLevelWindow.h" -#include "Sound/RageSoundDriver_CA.h" -#include "Sound/RageSoundDriver_QT1.h" -#include "LoadingWindow/LoadingWindow_Cocoa.h" -#include "ArchHooks/ArchHooks_darwin.h" +#include "Selector_LowLevelWindow.h" -#endif +LowLevelWindow *MakeLowLevelWindow() { return new ARCH_LOW_LEVEL_WINDOW; } /* - * (c) 2003 Steve Checkoway + * (c) 2002-2004 Glenn Maynard * All rights reserved. * * 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 * PERFORMANCE OF THIS SOFTWARE. */ - diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h index a571d01c40..4122d5e791 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow.h @@ -5,6 +5,7 @@ * we use SDL. Note that not all SDL operations go here; however, nothing * outside of this can assume that SDL has VIDEO initialized. */ +#include "global.h" #include "RageDisplay.h" // for RageDisplay::VideoModeParams class LowLevelWindow @@ -25,6 +26,8 @@ public: virtual RageDisplay::VideoModeParams GetVideoModeParams() const = 0; }; +LowLevelWindow *MakeLowLevelWindow(); + #endif /* diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h index 771c8d3649..8f2f5c7177 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_SDL.h @@ -17,7 +17,9 @@ public: 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 #endif diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h index b6ae7b6def..3d2efc0211 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_Win32.h @@ -15,8 +15,9 @@ public: RageDisplay::VideoModeParams GetVideoModeParams() const; }; - -#undef ARCH_LOW_LEVEL_WINDOW +#ifdef ARCH_LOW_LEVEL_WINDOW +#error "More than one LowLevelWindow selected!" +#endif #define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_Win32 #endif diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp index 27e104e22f..84a6b35409 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.cpp @@ -97,7 +97,8 @@ CString LowLevelWindow_X11::TryVideoMode(RageDisplay::VideoModeParams p, bool &b // We're remodeling the existing window, and not touching the // context. 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() ); } diff --git a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h index a9004e4519..6748ee5e9f 100644 --- a/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h +++ b/stepmania/src/arch/LowLevelWindow/LowLevelWindow_X11.h @@ -22,8 +22,9 @@ public: RageDisplay::VideoModeParams GetVideoModeParams() const { return CurrentParams; } }; -// XXX: Shouldn't we try multiple LowLevelWindows and use whichever works? -#undef ARCH_LOW_LEVEL_WINDOW +#ifdef ARCH_LOW_LEVEL_WINDOW +#error "More than one LowLevelWindow selected!" +#endif #define ARCH_LOW_LEVEL_WINDOW LowLevelWindow_X11 diff --git a/stepmania/src/arch/LowLevelWindow/Selector_LowLevelWindow.h b/stepmania/src/arch/LowLevelWindow/Selector_LowLevelWindow.h new file mode 100644 index 0000000000..85ba56ee4b --- /dev/null +++ b/stepmania/src/arch/LowLevelWindow/Selector_LowLevelWindow.h @@ -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. + */ diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriver.cpp b/stepmania/src/arch/MemoryCard/MemoryCardDriver.cpp index 874fabb640..d9b9118e7f 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriver.cpp +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriver.cpp @@ -1,8 +1,9 @@ #include "global.h" #include "MemoryCardDriver.h" #include "PrefsManager.h" +#include "MemoryCardDriver_Null.h" -#include "arch/arch_platform.h" +#include "Selector_MemoryCardDriver.h" bool UsbStorageDevice::operator==(const UsbStorageDevice& other) const { @@ -31,11 +32,10 @@ MemoryCardDriver *MakeMemoryCardDriver() MemoryCardDriver *ret = NULL; -#ifdef LINUX - ret = new MemoryCardDriverThreaded_Linux; -#elif _WINDOWS - ret = new MemoryCardDriverThreaded_Windows; +#ifdef ARCH_MEMORY_CARD_DRIVER + ret = new ARCH_MEMORY_CARD_DRIVER; #endif + if( !ret ) ret = new MemoryCardDriver_Null; diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.h b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.h index 7ab6c8be73..5f9757f7d4 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.h +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Linux.h @@ -21,6 +21,11 @@ protected: vector m_vDevicesLastSeen; }; +#ifdef ARCH_MEMORY_CARD_DRIVER +#error "More than one MemoryCardDriver selected!" +#endif +#define ARCH_MEMORY_CARD_DRIVER MemoryCardDriverThreaded_Linux + #endif /* diff --git a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.h b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.h index d8609f7e13..68981d327e 100644 --- a/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.h +++ b/stepmania/src/arch/MemoryCard/MemoryCardDriverThreaded_Windows.h @@ -20,6 +20,11 @@ private: DWORD m_dwLastLogicalDrives; }; +#ifdef ARCH_MEMORY_CARD_DRIVER +#error "More than one MemoryCardDriver included!" +#endif +#define ARCH_MEMORY_CARD_DRIVER MemoryCardDriverThreaded_Windows + #endif /* diff --git a/stepmania/src/arch/MemoryCard/Selector_MemoryCardDriver.h b/stepmania/src/arch/MemoryCard/Selector_MemoryCardDriver.h new file mode 100644 index 0000000000..42c815e729 --- /dev/null +++ b/stepmania/src/arch/MemoryCard/Selector_MemoryCardDriver.h @@ -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. + */ diff --git a/stepmania/src/arch/MovieTexture/MovieTexture.cpp b/stepmania/src/arch/MovieTexture/MovieTexture.cpp index 67ae7fdca3..9e0af75e3d 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture.cpp +++ b/stepmania/src/arch/MovieTexture/MovieTexture.cpp @@ -6,17 +6,7 @@ #include "PrefsManager.h" #include "RageFile.h" -#include "arch/arch_platform.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 +#include "Selector_MovieTexture.h" void ForceToAscii( CString &str ) { @@ -91,13 +81,15 @@ RageMovieTexture *MakeRageMovieTexture(RageTextureID ID) { Driver = DriversToTry[i]; LOG->Trace("Initializing driver: %s", Driver.c_str()); -#ifdef _WINDOWS +#ifdef USE_MOVIE_TEXTURE_DSHOW if( !Driver.CompareNoCase("DShow") ) ret = new MovieTexture_DShow(ID); #endif -#ifdef HAVE_FFMPEG +#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->Warn( "Unknown movie driver name: %s", Driver.c_str() ); diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h index f6d271ef74..b7cb539b29 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_FFMpeg.h @@ -92,6 +92,7 @@ private: float CheckFrameTime(); void DiscardFrame(); }; +#define USE_MOVIE_TEXTURE_FFMPEG #endif diff --git a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h index dfe7d53b04..17106074c9 100644 --- a/stepmania/src/arch/MovieTexture/MovieTexture_Null.h +++ b/stepmania/src/arch/MovieTexture/MovieTexture_Null.h @@ -1,5 +1,5 @@ -#ifndef MOVIE_TEXTURE_NULL -#define MOVIE_TEXTURE_NULL +#ifndef MOVIE_TEXTURE_NULL_H +#define MOVIE_TEXTURE_NULL_H /* * MovieTexture_null.h * stepmania @@ -29,8 +29,9 @@ public: void SetPlaybackRate(float rate) { } void SetLooping(bool looping=true) { loop = looping; } }; +#define USE_MOVIE_TEXTURE_NULL -#endif /* MOVIE_TEXTURE_NULL */ +#endif /* * (c) 2003 Steve Checkoway diff --git a/stepmania/src/arch/MovieTexture/Selector_MovieTexture.h b/stepmania/src/arch/MovieTexture/Selector_MovieTexture.h new file mode 100644 index 0000000000..a47690f7cf --- /dev/null +++ b/stepmania/src/arch/MovieTexture/Selector_MovieTexture.h @@ -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. + */ diff --git a/stepmania/src/arch/Sound/RageSoundDriver.cpp b/stepmania/src/arch/Sound/RageSoundDriver.cpp new file mode 100644 index 0000000000..d71ca37585 --- /dev/null +++ b/stepmania/src/arch/Sound/RageSoundDriver.cpp @@ -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. + */ diff --git a/stepmania/src/arch/Sound/RageSoundDriver.h b/stepmania/src/arch/Sound/RageSoundDriver.h index 01710b7499..fe230e9049 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver.h +++ b/stepmania/src/arch/Sound/RageSoundDriver.h @@ -1,6 +1,8 @@ #ifndef RAGE_SOUND_DRIVER #define RAGE_SOUND_DRIVER +#include "global.h" + class RageSoundBase; class RageSoundDriver { @@ -48,6 +50,8 @@ public: virtual ~RageSoundDriver() { } }; +RageSoundDriver *MakeRageSoundDriver(CString drivers); + /* * (c) 2002-2004 Glenn Maynard * All rights reserved. diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.h b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.h index d4a0ba7b79..968c3094ab 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9.h @@ -71,6 +71,7 @@ private: void GetData(); }; +#define USE_RAGE_SOUND_ALSA9 #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h index b104b8b195..7cebd13d44 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_ALSA9_Software.h @@ -33,6 +33,7 @@ public: CString Init(); ~RageSound_ALSA9_Software(); }; +#define USE_RAGE_SOUND_ALSA9_SOFTWARE #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_CA.h b/stepmania/src/arch/Sound/RageSoundDriver_CA.h index a6820952cb..b9c4c65715 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_CA.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_CA.h @@ -45,8 +45,7 @@ public: int64_t GetPosition(const RageSoundBase *sound) const; void SetupDecodingThread(); }; - -#define RAGE_SOUND_CA +#define USE_RAGE_SOUND_CA #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound.h b/stepmania/src/arch/Sound/RageSoundDriver_DSound.h index fae30a0e26..33975c3eac 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound.h @@ -69,6 +69,7 @@ private: int GetSampleRate( int rate ) const { return rate; } }; +#define USE_RAGE_SOUND_DSOUND #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h index 3f3d894708..cb5ef113a3 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_DSound_Software.h @@ -28,6 +28,7 @@ public: virtual ~RageSound_DSound_Software(); CString Init(); }; +#define USE_RAGE_SOUND_DSOUND_SOFTWARE #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_Null.h b/stepmania/src/arch/Sound/RageSoundDriver_Null.h index 97427b7e74..8b1c2cabe7 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_Null.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_Null.h @@ -16,6 +16,7 @@ protected: public: RageSound_Null(); }; +#define USE_RAGE_SOUND_NULL #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_OSS.h b/stepmania/src/arch/Sound/RageSoundDriver_OSS.h index 309b5ecdce..99662f6357 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_OSS.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_OSS.h @@ -32,6 +32,7 @@ public: CString Init(); ~RageSound_OSS(); }; +#define USE_RAGE_SOUND_OSS #endif diff --git a/stepmania/src/arch/Sound/RageSoundDriver_QT1.h b/stepmania/src/arch/Sound/RageSoundDriver_QT1.h index eb642fa3ce..de5be7fed6 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_QT1.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_QT1.h @@ -1,5 +1,5 @@ -#ifndef RAGE_SOUND_QT1 -#define RAGE_SOUND_QT1 +#ifndef RAGE_SOUND_QT1_H +#define RAGE_SOUND_QT1_H /* * RageSoundDriver_QT1.h * stepmania @@ -37,8 +37,9 @@ public: virtual ~RageSound_QT1(); 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 diff --git a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h index 865d9e53a1..e70c6302a9 100644 --- a/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h +++ b/stepmania/src/arch/Sound/RageSoundDriver_WaveOut.h @@ -32,6 +32,7 @@ public: ~RageSound_WaveOut(); CString Init(); }; +#define USE_RAGE_SOUND_WAVE_OUT #endif diff --git a/stepmania/src/arch/arch_linux.h b/stepmania/src/arch/Sound/Selector_RageSoundDriver.h similarity index 69% rename from stepmania/src/arch/arch_linux.h rename to stepmania/src/arch/Sound/Selector_RageSoundDriver.h index 623728f3a9..75f961b51c 100644 --- a/stepmania/src/arch/arch_linux.h +++ b/stepmania/src/arch/Sound/Selector_RageSoundDriver.h @@ -1,35 +1,41 @@ -#ifndef LINUX_ARCH_H -#define LINUX_ARCH_H +#ifndef SELECTOR_RAGE_SOUND_DRIVER_H +#define SELECTOR_RAGE_SOUND_DRIVER_H +#include "arch/arch_platform.h" + +/* RageSoundDriver selector. */ #ifdef HAVE_ALSA -#include "Sound/RageSoundDriver_ALSA9.h" -#include "Sound/RageSoundDriver_ALSA9_Software.h" +#include "RageSoundDriver_ALSA9.h" +#include "RageSoundDriver_ALSA9_Software.h" #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 -#include "Sound/RageSoundDriver_OSS.h" +#include "RageSoundDriver_OSS.h" #endif -#ifdef HAVE_GTK -#include "LoadingWindow/LoadingWindow_Gtk.h" +#ifdef HAVE_QUICKTIME1 +#include "RageSoundDriver_QT1.h" #endif -/* Load this even if we have GTK, since we can fall back if GTK is missing. */ -#ifdef HAVE_SDL -#include "LoadingWindow/LoadingWindow_SDL.h" +#ifdef HAVE_WIN32 +#include "RageSoundDriver_WaveOut.h" #endif -#include "ArchHooks/ArchHooks_Unix.h" - -#include "Lights/LightsDriver_LinuxWeedTech.h" -#include "Lights/LightsDriver_LinuxParallel.h" - -#include "MemoryCard/MemoryCardDriverThreaded_Linux.h" - #endif /* - * (c) 2002-2003 Glenn Maynard + * (c) 2005 Ben Anderson * All rights reserved. * * 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 * PERFORMANCE OF THIS SOFTWARE. */ - diff --git a/stepmania/src/arch/arch.cpp b/stepmania/src/arch/arch.cpp deleted file mode 100644 index 092586f054..0000000000 --- a/stepmania/src/arch/arch.cpp +++ /dev/null @@ -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 &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. - */ diff --git a/stepmania/src/arch/arch.h b/stepmania/src/arch/arch.h deleted file mode 100644 index abbf13be04..0000000000 --- a/stepmania/src/arch/arch.h +++ /dev/null @@ -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 &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. - */ diff --git a/stepmania/src/arch/arch_default.h b/stepmania/src/arch/arch_default.h index 7238921308..7ba08e6f0d 100644 --- a/stepmania/src/arch/arch_default.h +++ b/stepmania/src/arch/arch_default.h @@ -1,49 +1,38 @@ -#ifndef SDL_ARCH_H -#define SDL_ARCH_H +#ifndef ARCH_DEFAULT_H +#define ARCH_DEFAULT_H -/* All driver types should have a default, portable implementation, provided - * here. */ -/* None of these SDL implementations run on Xbox, so I've commented - * out use of this header and added the #includes to each arch_*.h */ -/* - * 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. +/* Define the default driver sets. It's okay to have in the sets drivers that + * might not be available, just as long as you don't mind if they're used when + * they are available. (For example, if we're using X11, we don't want + * InputHandler_SDL to be used.) */ - * For InputHandler, undef SUPPORT_SDL_INPUT and we won't create the SDL input - * handler. (We'll still include the header here, but it'll never be used.) - */ - -/* We can have any number of input drivers. By default, use SDL for keyboards - * and joysticks. If you write your own handler for these devices types, or if - * SDL input doesn't work on your platform, undef SUPPORT_SDL_INPUT in your platform - * header. */ -#define SUPPORT_SDL_INPUT -#include "InputHandler/InputHandler_SDL.h" -#include "InputHandler/InputHandler_MonkeyKeyboard.h" - -/* Load default fallback drivers; some of these may be overridden by arch-specific - * drivers. These are all singleton drivers--we never use more than one. */ -#include "LoadingWindow/LoadingWindow_Null.h" -#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" +/* InputHandler drivers */ +#if defined (HAVE_XBOX) + #define DEFAULT_INPUT_DRIVER_LIST "Xbox" +#elif defined(HAVE_DIRECTX) +#define DEFAULT_INPUT_DRIVER_LIST "DirectInput,Pump,Para" +#elif defined(HAVE_X11) // Prefer X11 over SDL + #define DEFAULT_INPUT_DRIVER_LIST "X11,Linux_joystick" +#elif defined(HAVE_SDL) + #define DEFAULT_INPUT_DRIVER_LIST "SDL" +#else + #if defined(LINUX) + #define DEFAULT_INPUT_DRIVER_LIST "Linux_joystick,Linux_tty" + #else + #define DEFAULT_INPUT_DRIVER_LIST "MonkeyKeyboard" + #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 /* - * (c) 2002-2004 Glenn Maynard + * (c) 2002-2005 Glenn Maynard, Ben Anderson * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a diff --git a/stepmania/src/arch/arch_platform.h b/stepmania/src/arch/arch_platform.h index e47270002b..379cc2ac24 100644 --- a/stepmania/src/arch/arch_platform.h +++ b/stepmania/src/arch/arch_platform.h @@ -1,26 +1,45 @@ #ifndef ARCH_PLATFORM_H #define ARCH_PLATFORM_H -#include "arch.h" - -/* Load default drivers. */ -#include "arch_default.h" - -/* Override them with arch-specific drivers, as available. */ +// 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(UNIX) || !defined(DARWIN) // Darwin isn't POSIX enough for us. +#define HAVE_POSIX +#endif +#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) -#include "arch_linux.h" -#elif defined(DARWIN) -#include "arch_darwin.h" +#define HAVE_POSIX // Here just to be explicit. +#define HAVE_LINUXKERNEL +#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) -#include "arch_xbox.h" -#elif defined(_WINDOWS) -#include "arch_Win32.h" +#define SUPPORT_D3D +#else +#define SUPPORT_OPENGL #endif #endif /* - * (c) 2002-2004 Glenn Maynard + * (c) 2002-2005 Glenn Maynard, Ben Anderson * All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a