1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
|
From: Hans de Goede <hdegoede@redhat.com>
Last-Update: 2013-01-04
Description: drop dga
Drop DGA support, fixing SDL_VIDEODRIVER parsing issues
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3
--- a/src/njam.cpp
+++ b/src/njam.cpp
@@ -52,7 +52,6 @@ int main(int argc, char *argv[])
{
bool Fullscreen = true;
bool SWSurface = true;
- bool UseDGA = false;
if (argc > 1)
{
for (int i=1; i<argc; i++)
@@ -64,8 +63,6 @@ int main(int argc, char *argv[])
Fullscreen = false; // use njam.exe -w windowed mode
else if (argv[i][1] == 'h')
SWSurface = false; // use -h for hardware surfaces
- else if (argv[i][1] == 'd')
- UseDGA = true;
else
ok = false;
}
@@ -77,7 +74,6 @@ int main(int argc, char *argv[])
printf("Usage: njam -[w|d|h]\n\n");
printf("-w start in Windowed mode (as opposed to fullscreen).\n");;
printf("-h use Hardware surfaces (faster, doesn't work well with all graphic cards).\n");
- printf("-d use DGA driver on Linux, (much faster, but must run as root).\n");
return 1;
}
}
@@ -106,7 +102,7 @@ int main(int argc, char *argv[])
#endif
NjamEngine Engine;
- if (!Engine.Init(Fullscreen, SWSurface, UseDGA))
+ if (!Engine.Init(Fullscreen, SWSurface))
{
LogFile("Failed.\n");
return 1;
@@ -159,12 +155,6 @@ NjamEngine::NjamEngine()
//-----------------------------------------------------------------------------
NjamEngine::~NjamEngine()
{
-#ifdef __linux__
- char bufsdl[30];
- sprintf(bufsdl, "SDL_VIDEODRIVER=%s", linux_sdl_driver);
- putenv(bufsdl);
-#endif
-
if (script_file)
fclose(script_file);
@@ -333,24 +323,8 @@ void NjamEngine::DoScript(void) // load
}
}
//-----------------------------------------------------------------------------
-bool NjamEngine::Init(bool Fullscreen, bool SoftwareSurface, bool UseDGA)
+bool NjamEngine::Init(bool Fullscreen, bool SoftwareSurface)
{
-#ifdef __linux__
- sprintf(linux_sdl_driver, "x11\0");
- char *driver_name = getenv("SDL_VIDEODRIVER");
- if (driver_name)
- sprintf(linux_sdl_driver, "%s\0", driver_name);
-
- if (UseDGA)
- {
- printf("You must be root to run DGA\nType ./njam -? for help\n");
- putenv("SDL_VIDEODRIVER=dga");
- }
-#else
- if (UseDGA)
- printf("Parameter -d is ignored for non-Linux platforms.\n");
-#endif
-
LogFile("Initializing SDL: VIDEO & AUDIO...", true);
if ( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_TIMER ) < 0 )
{
--- a/src/njam.h
+++ b/src/njam.h
@@ -111,7 +111,6 @@ private:
bool m_SDL; // whether SDL is initialized or not
bool m_AudioAvailable; // so we know wheter to try to play music/sfx
- char linux_sdl_driver[10];
SDL_Surface *m_Screen;
tGameOptions m_GameOptions;
@@ -201,7 +200,7 @@ private:
public:
NjamEngine();
~NjamEngine();
- bool Init(bool,bool,bool); // initialize everything except for networking
+ bool Init(bool,bool); // initialize everything except for networking
void Start(); // start the music and main menu loop
};
//-----------------------------------------------------------------------------
|