xref: /OK3568_Linux_fs/buildroot/package/rubix/0002-misc-fixes.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyundiff -Nrup rubix-1.0.5/fillpoly.c rubix-1.0.5-avr32/fillpoly.c
2*4882a593Smuzhiyun--- rubix-1.0.5/fillpoly.c	2003-10-12 15:41:43.000000000 -0400
3*4882a593Smuzhiyun+++ rubix-1.0.5-avr32/fillpoly.c	2008-02-29 12:39:51.000000000 -0500
4*4882a593Smuzhiyun@@ -435,7 +435,7 @@ void fill_lines(device *d, int thecol)
5*4882a593Smuzhiyun 			);
6*4882a593Smuzhiyun #endif
7*4882a593Smuzhiyun     }
8*4882a593Smuzhiyun-  } else if (d->depth==16) { /* here 16bpp */
9*4882a593Smuzhiyun+  } else if ((d->depth==16) | (d->depth==15)) { /* here 16bpp */
10*4882a593Smuzhiyun     register int i;
11*4882a593Smuzhiyun #ifndef PC_ARCHI
12*4882a593Smuzhiyun     register int j;
13*4882a593Smuzhiyundiff -Nrup rubix-1.0.5/line.c rubix-1.0.5-avr32/line.c
14*4882a593Smuzhiyun--- rubix-1.0.5/line.c	2003-10-12 14:15:19.000000000 -0400
15*4882a593Smuzhiyun+++ rubix-1.0.5-avr32/line.c	2008-02-29 12:39:51.000000000 -0500
16*4882a593Smuzhiyun@@ -1317,7 +1317,7 @@ void drawline(device *d, line *l)
17*4882a593Smuzhiyun #endif
18*4882a593Smuzhiyun   if (d->depth==8)
19*4882a593Smuzhiyun     drawline8(d, l);
20*4882a593Smuzhiyun-  else if (d->depth==16)
21*4882a593Smuzhiyun+  else if ((d->depth==16) | (d->depth==15))
22*4882a593Smuzhiyun     drawline16(d, l);
23*4882a593Smuzhiyun   else if (d->depth==24)
24*4882a593Smuzhiyun     drawline24(d, l);
25*4882a593Smuzhiyundiff -Nrup rubix-1.0.5/Makefile rubix-1.0.5-avr32/Makefile
26*4882a593Smuzhiyun--- rubix-1.0.5/Makefile	2003-12-04 14:27:58.000000000 -0500
27*4882a593Smuzhiyun+++ rubix-1.0.5-avr32/Makefile	2008-02-29 12:58:30.000000000 -0500
28*4882a593Smuzhiyun@@ -11,21 +11,17 @@
29*4882a593Smuzhiyun # Customize to fit your needs (especially if it does not work for now).
30*4882a593Smuzhiyun
31*4882a593Smuzhiyun LANGUAGE=ENGLISH
32*4882a593Smuzhiyun-GAMESDIR=/usr/games
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun #architecture=-DPC_ARCHI
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun # For Solaris
37*4882a593Smuzhiyun #EXTRALIBS=-lsocket
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun-CC=gcc
40*4882a593Smuzhiyun CFLAGS=-Wall -O3 -fomit-frame-pointer -ffast-math \
41*4882a593Smuzhiyun    -DGAMESDIR="\"$(GAMESDIR)\"" \
42*4882a593Smuzhiyun    -D$(LANGUAGE) $(architecture)
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun #CFLAGS=-Wall -g -ffast-math -Iplayer $(architecture)
45*4882a593Smuzhiyun-XINC=-I/usr/X11R6/include
46*4882a593Smuzhiyun-XLIB=-L/usr/X11R6/lib -lX11
47*4882a593Smuzhiyun
48*4882a593Smuzhiyun #the following should not be changed.
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun@@ -37,7 +33,7 @@ rubix : $(OBJ)
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun install :
53*4882a593Smuzhiyun 	mkdir -p $(GAMESDIR)
54*4882a593Smuzhiyun-	install -c -s rubix $(GAMESDIR)
55*4882a593Smuzhiyun+	install -c rubix $(GAMESDIR)
56*4882a593Smuzhiyun
57*4882a593Smuzhiyun clean :
58*4882a593Smuzhiyun 	rm -f *.o *~ core *.bak *.dat gmon.out
59*4882a593Smuzhiyundiff -Nrup rubix-1.0.5/screen.c rubix-1.0.5-avr32/screen.c
60*4882a593Smuzhiyun--- rubix-1.0.5/screen.c	2004-04-26 04:26:05.000000000 -0400
61*4882a593Smuzhiyun+++ rubix-1.0.5-avr32/screen.c	2008-02-29 12:39:51.000000000 -0500
62*4882a593Smuzhiyun@@ -80,11 +80,17 @@ void error_statement(SCREEN *s)
63*4882a593Smuzhiyun
64*4882a593Smuzhiyun int reset_data_buffers(SCREEN *s)
65*4882a593Smuzhiyun {
66*4882a593Smuzhiyun+  int temp;
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun   if (s->im)
69*4882a593Smuzhiyun     XDestroyImage(s->im);
70*4882a593Smuzhiyun+  if (s->depth == 15) {
71*4882a593Smuzhiyun+		temp=16;
72*4882a593Smuzhiyun+  } else {
73*4882a593Smuzhiyun+		temp=s->depth;
74*4882a593Smuzhiyun+  }
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun-  s->buffer=(char *)malloc(((SCREEN_X+7)/8)*SCREEN_Y*s->depth);
77*4882a593Smuzhiyun+  s->buffer=(char *)malloc(((SCREEN_X+7)/8)*SCREEN_Y*temp);
78*4882a593Smuzhiyun
79*4882a593Smuzhiyun   if (!s->buffer) {
80*4882a593Smuzhiyun     error_statement(s);
81*4882a593Smuzhiyun@@ -106,7 +112,7 @@ int reset_data_buffers(SCREEN *s)
82*4882a593Smuzhiyun    */
83*4882a593Smuzhiyun   /* Sed - december 2003 - no it has to be 8 */
84*4882a593Smuzhiyun   s->im=XCreateImage(s->d, DefaultVisual(s->d, DefaultScreen(s->d)),
85*4882a593Smuzhiyun-		     s->depth==32?24:s->depth, ZPixmap,
86*4882a593Smuzhiyun+		     s->depth, ZPixmap,
87*4882a593Smuzhiyun 		     0, s->buffer, SCREEN_X, SCREEN_Y, 8, 0);
88*4882a593Smuzhiyun
89*4882a593Smuzhiyun   if (!s->im) {
90*4882a593Smuzhiyun@@ -139,8 +145,8 @@ int init_screen(SCREEN *s)
91*4882a593Smuzhiyun
92*4882a593Smuzhiyun   s->depth=DefaultDepth(s->d, DefaultScreen(s->d));
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun-  if (s->depth!=8 && s->depth!=16 && s->depth!=24) {
95*4882a593Smuzhiyun-    fprintf(stderr, "screen depth not supported (only 8, 16 and 24bpp (which means 32bpp too) handled\n");
96*4882a593Smuzhiyun+  if (s->depth!=8 && s->depth!=15 && s->depth!=16 && s->depth!=24) {
97*4882a593Smuzhiyun+    fprintf(stderr, "screen depth not supported (only 8, 15, 16 and 24bpp (which means 32bpp too) handled\n");
98*4882a593Smuzhiyun     XCloseDisplay(s->d);
99*4882a593Smuzhiyun     s->d=(Display *)0;
100*4882a593Smuzhiyun     return -1;
101*4882a593Smuzhiyun@@ -182,10 +188,10 @@ int init_screen(SCREEN *s)
102*4882a593Smuzhiyun
103*4882a593Smuzhiyun   /* let's create and map our window */
104*4882a593Smuzhiyun   s->w=XCreateWindow(s->d, DefaultRootWindow(s->d), 0, 0,
105*4882a593Smuzhiyun-		       SCREEN_X, SCREEN_Y, 3, s->depth==32?24:s->depth,
106*4882a593Smuzhiyun+		       SCREEN_X, SCREEN_Y, 3, s->depth,
107*4882a593Smuzhiyun 		       CopyFromParent, CopyFromParent, 0, NULL);
108*4882a593Smuzhiyun   s->h=XCreateWindow(s->d, DefaultRootWindow(s->d), 0, 0,
109*4882a593Smuzhiyun-		       HELP_X, HELP_Y, 3, s->depth==32?24:s->depth,
110*4882a593Smuzhiyun+		       HELP_X, HELP_Y, 3, s->depth,
111*4882a593Smuzhiyun 		       CopyFromParent, CopyFromParent, 0, NULL);
112*4882a593Smuzhiyun
113*4882a593Smuzhiyun   xch.res_name = "rubix";
114*4882a593Smuzhiyun@@ -946,13 +952,18 @@ void close_screen(SCREEN *s)
115*4882a593Smuzhiyun void clear_screen(SCREEN *s)
116*4882a593Smuzhiyun {
117*4882a593Smuzhiyun   /* fill s->im with pixel[10], avoid XPutPixel which is rather slow... */
118*4882a593Smuzhiyun-  int i, w, dw;
119*4882a593Smuzhiyun+  int i, w, dw, temp;
120*4882a593Smuzhiyun+  if (s->depth == 15) {
121*4882a593Smuzhiyun+	temp = 16;
122*4882a593Smuzhiyun+  } else {
123*4882a593Smuzhiyun+	temp = s->depth;
124*4882a593Smuzhiyun+  }
125*4882a593Smuzhiyun   w = (SCREEN_X+7)/8;
126*4882a593Smuzhiyun-  dw = s->depth/8;
127*4882a593Smuzhiyun+  dw = temp/8;
128*4882a593Smuzhiyun   XPutPixel(s->im, 0, 0, pixel[10]);
129*4882a593Smuzhiyun   for (i=1; i<8*w; i++)
130*4882a593Smuzhiyun      memcpy(s->buffer + i*dw, s->buffer, dw);
131*4882a593Smuzhiyun-  w = w * s->depth;
132*4882a593Smuzhiyun+  w = w * temp;
133*4882a593Smuzhiyun   for (i=1; i<SCREEN_Y; i++)
134*4882a593Smuzhiyun      memcpy(s->buffer + i*w, s->buffer, w);
135*4882a593Smuzhiyun }
136