summaryrefslogtreecommitdiff
path: root/games/njam/patches/drop_gda.patch
blob: 5973420b25a4f70b36088e5378a1b06b8b957b4c (plain)
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
101
102
103
#!/bin/sh /usr/share/dpatch/dpatch-run
Description: drop DGA support, fixing SDL_VIDEODRIVER parsing issues
Author: Hans de Goede <hdegoede@redhat.com>
Last-Update: 2011-12-13

Index: njam-1.25/src/njam.cpp
===================================================================
--- njam-1.25.orig/src/njam.cpp	2012-07-04 16:46:32.000000000 +0000
+++ njam-1.25/src/njam.cpp	2012-07-04 16:49:29.000000000 +0000
@@ -52,7 +52,6 @@
 {
  	bool Fullscreen = true;
  	bool SWSurface = true;
-	bool UseDGA = false;
  	if (argc > 1)
  	{
  		for (int i=1; i<argc; i++)
@@ -64,8 +63,6 @@
 					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 @@
 				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 @@
 #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()
 {
-#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 @@
     }
 }
 //-----------------------------------------------------------------------------
-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 )
 	{
Index: njam-1.25/src/njam.h
===================================================================
--- njam-1.25.orig/src/njam.h	2005-12-13 11:56:43.000000000 +0000
+++ njam-1.25/src/njam.h	2012-07-04 16:50:13.000000000 +0000
@@ -111,7 +111,6 @@
 
  	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 @@
 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
 };
 //-----------------------------------------------------------------------------