]> git.wh0rd.org Git - patches.git/blob - xiptech-sdl-1.2.9.patch
initial import
[patches.git] / xiptech-sdl-1.2.9.patch
1 diff -Nur SDL-1.2.9.orig/config.sub SDL-1.2.9/config.sub
2 --- SDL-1.2.9.orig/config.sub   2004-05-06 11:55:06.000000000 -0400
3 +++ SDL-1.2.9/config.sub        2006-05-08 08:01:42.000000000 -0400
4 @@ -135,6 +135,9 @@
5  ### recognize some manufacturers as not being operating systems, so we
6  ### can provide default operating systems below.
7  case $os in
8 +        -uclinux*)
9 +            os=-linux-gnu
10 +            ;;
11         -sun*os*)
12                 # Prevent following clause from handling this invalid input.
13                 ;;
14 @@ -224,7 +227,8 @@
15  case $basic_machine in
16         # Recognize the basic CPU types without company name.
17         # Some are omitted here because they have special meanings below.
18 -       1750a | 580 \
19 +        bfin \
20 +       | 1750a | 580 \
21         | a29k \
22         | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
23         | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
24 diff -Nur SDL-1.2.9.orig/readme.537 SDL-1.2.9/readme.537
25 --- SDL-1.2.9.orig/readme.537   1969-12-31 19:00:00.000000000 -0500
26 +++ SDL-1.2.9/readme.537        2006-05-08 06:53:08.000000000 -0400
27 @@ -0,0 +1,5 @@
28 +1.configure\r
29 +CFLAGS="-Dunix" ./configure --host=bfin-uclinux --disable-threads --disable-pth --disable-pthreads --disable-sdl-dlopen --disable-esd --disable-video-x11 --disable-cdrom --with-pic=no --disable-arts --disable-shared\r
30 +\r
31 +2.make\r
32 +./make
33 --- SDL-1.2.9.orig/src/video/fbcon/SDL_fbevents.c       2005-01-04 14:04:14.000000000 -0500
34 +++ SDL-1.2.9/src/video/fbcon/SDL_fbevents.c    2006-05-08 08:02:28.000000000 -0400
35 @@ -159,7 +159,7 @@
36  int FB_EnterGraphicsMode(_THIS)
37  {
38         struct termios keyboard_termios;
39 -
40 +       int ret;
41         /* Set medium-raw keyboard mode */
42         if ( (keyboard_fd >= 0) && !FB_InGraphicsMode(this) ) {
43  
44 @@ -184,6 +185,7 @@
45                         keyboard_fd = -1;
46                         return(-1);
47                 }
48 +               #if 0 //lee
49                 if ( ioctl(keyboard_fd, KDGKBMODE, &saved_kbd_mode) < 0 ) {
50                         SDL_SetError("Unable to get current keyboard mode");
51                         if ( keyboard_fd > 0 ) {
52 @@ -192,27 +194,31 @@
53                         keyboard_fd = -1;
54                         return(-1);
55                 }
56 +               #endif //lee
57                 keyboard_termios = saved_kbd_termios;
58                 keyboard_termios.c_lflag &= ~(ICANON | ECHO | ISIG);
59                 keyboard_termios.c_iflag &= ~(ISTRIP | IGNCR | ICRNL | INLCR | IXOFF | IXON);
60                 keyboard_termios.c_cc[VMIN] = 0;
61                 keyboard_termios.c_cc[VTIME] = 0;
62 +               
63                 if (tcsetattr(keyboard_fd, TCSAFLUSH, &keyboard_termios) < 0) {
64                         FB_CloseKeyboard(this);
65                         SDL_SetError("Unable to set terminal attributes");
66                         return(-1);
67                 }
68 +               #if 0 //lee 
69                 /* This will fail if we aren't root or this isn't our tty */
70 -               if ( ioctl(keyboard_fd, KDSKBMODE, K_MEDIUMRAW) < 0 ) {
71 +               if ( (ret = ioctl(keyboard_fd, KDSKBMODE, K_MEDIUMRAW)) < 0 ) {
72                         FB_CloseKeyboard(this);
73 -                       SDL_SetError("Unable to set keyboard in raw mode");
74 +                       SDL_SetError("Unable to set keyboard in raw mode %d",ret);
75                         return(-1);
76                 }
77 -               if ( ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS) < 0 ) {
78 +               if ( (ret = ioctl(keyboard_fd, KDSETMODE, KD_GRAPHICS)) < 0 ) {
79                         FB_CloseKeyboard(this);
80 -                       SDL_SetError("Unable to set keyboard in graphics mode");
81 +                       SDL_SetError("Unable to set keyboard in graphics mode %d",ret);
82                         return(-1);
83                 }
84 +               #endif //lee
85         }
86         return(keyboard_fd);
87  }
88 @@ -288,6 +299,8 @@
89                         /* Last resort, maybe our tty is a usable VT */
90                         current_vt = 0;
91                         keyboard_fd = open("/dev/tty", O_RDWR);
92 +                       //keyboard_fd = dup(0); 
93 +                       fprintf(stderr,"Last resort open /dev/tty=%d\n",keyboard_fd);
94                 }
95  #ifdef DEBUG_KEYBOARD
96                 fprintf(stderr, "Current VT: %d\n", current_vt);
97 @@ -295,14 +308,15 @@
98                 saved_kbd_mode = -1;
99  
100                 /* Make sure that our input is a console terminal */
101 -               { int dummy;
102 +               //lee 2006-4-22
103 +               /*{ int dummy;
104                   if ( ioctl(keyboard_fd, KDGKBMODE, &dummy) < 0 ) {
105                         close(keyboard_fd);
106                         keyboard_fd = -1;
107                         SDL_SetError("Unable to open a console terminal");
108                   }
109 -               }
110 -
111 +               }*/
112 +               
113                 /* Set up keymap */
114                 FB_vgainitkeymaps(keyboard_fd);
115         }
116 @@ -891,7 +906,11 @@
117         int scancode;
118         SDL_keysym keysym;
119  
120 +       
121 +       SDL_ResetKeyboard();//lee 5-5
122 +       
123         nread = read(keyboard_fd, keybuf, BUFSIZ);
124 +               
125         for ( i=0; i<nread; ++i ) {
126                 scancode = keybuf[i] & 0x7F;
127                 if ( keybuf[i] & 0x80 ) {
128 @@ -1081,15 +1103,51 @@
129             default: break;
130           }
131         }
132 +/*
133 +       {
134 +                       int i;
135 +                       for (i = 0; i<128;i++)
136 +                               fprintf(stderr,"%d:%d\n",i,keymap[i]);
137 +               
138 +       }
139 +*/     
140  }
141  
142  static SDL_keysym *TranslateKey(int scancode, SDL_keysym *keysym)
143  {
144         /* Set the keysym information */
145         keysym->scancode = scancode;
146 +       #if 0
147 +       
148         keysym->sym = keymap[scancode];
149 +
150 +       #else  //lee
151 +
152 +       keysym->sym = 0;
153 +       if(scancode == 0x31)
154 +       keysym->sym = SDLK_1;
155 +       if(scancode == 0x35)
156 +       keysym->sym = SDLK_5;
157 +       else if(scancode == 0x44)
158 +       keysym->sym = SDLK_LEFT;
159 +       else if(scancode == 0x43)
160 +       keysym->sym = SDLK_RIGHT;
161 +       else if(scancode == 0x41)
162 +       keysym->sym = SDLK_UP;
163 +       else if(scancode == 0x42)
164 +       keysym->sym = SDLK_DOWN;
165 +       else if(scancode == 0x6f)
166 +       keysym->sym = SDLK_o;
167 +       else if(scancode == 0x6b)
168 +       keysym->sym =   SDLK_k;
169 +       else if(scancode == 0x71)
170 +       keysym->sym =   SDLK_q;
171 +
172 +       #endif
173 +       
174         keysym->mod = KMOD_NONE;
175  
176 +               
177         /* If UNICODE is on, get the UNICODE value for the key */
178         keysym->unicode = 0;
179         if ( SDL_TranslateUNICODE ) {
180 diff -Nur SDL-1.2.9.orig/src/video/fbcon/SDL_fbvideo.c SDL-1.2.9/src/video/fbcon/SDL_fbvideo.c
181 --- SDL-1.2.9.orig/src/video/fbcon/SDL_fbvideo.c        2005-02-12 13:03:54.000000000 -0500
182 +++ SDL-1.2.9/src/video/fbcon/SDL_fbvideo.c     2006-05-08 08:02:26.000000000 -0400
183 @@ -79,7 +79,8 @@
184         {  0, 0,  640,  400 },          /*  8 bpp: 0x100, or 256 */
185         {  0, 0,  512,  384 },
186         {  0, 0,  320,  240 },
187 -       {  0, 0,  320,  200 }
188 +       {  0, 0,  320,  200 },
189 +       {  0, 0,  240,  320 }           //lee 2006-4-22:to support 240*320 display mode
190  };
191  static const struct {
192         int xres;
193 @@ -123,6 +124,7 @@
194         { 1280, 1024,  9369, 224, 32, 32,  4, 136, 4, 0, 0 },   /* 60 Hz */
195         { 1408, 1056,  8214, 256, 40, 32,  5, 144, 5, 0, 0 },   /* 60 Hz */
196         { 1600, 1200,/*?*/0, 272, 48, 32,  5, 152, 5, 0, 0 },   /* 60 Hz */
197 +       { 240, 320,63492,  16, 16, 16,  4,  48, 2, 0, 2 },       //lee 2006-4-22:to support 240*320 display mode
198  #endif
199  };
200  
201 @@ -279,6 +281,9 @@
202         /* Only allow a mode if we have a valid timing for it */
203         next_mode = -1;
204         for ( i=0; i<(sizeof(vesa_timings)/sizeof(vesa_timings[0])); ++i ) {
205 +               #ifdef USE_VESA_TIMINGS
206 +               fprintf(stderr,"USE_VESA_TIMINGS\n");
207 +               #endif
208                 if ( (w == vesa_timings[i].xres) &&
209                      (h == vesa_timings[i].yres) && vesa_timings[i].pixclock ) {
210                         next_mode = i;
211 @@ -408,7 +413,7 @@
212                         (((long)finfo.smem_start)&~(PAGE_SIZE-1)));
213         mapped_memlen = finfo.smem_len+mapped_offset;
214         mapped_mem = mmap(NULL, mapped_memlen,
215 -                         PROT_READ|PROT_WRITE, MAP_SHARED, console_fd, 0);
216 +                         PROT_READ|PROT_WRITE, /*MAP_SHARED*/MAP_PRIVATE, console_fd, 0);
217         if ( mapped_mem == (char *)-1 ) {
218                 SDL_SetError("Unable to memory map the video hardware");
219                 mapped_mem = NULL;
220 @@ -452,7 +457,7 @@
221         if ( finfo.accel && finfo.mmio_len ) {
222                 mapped_iolen = finfo.mmio_len;
223                 mapped_io = mmap(NULL, mapped_iolen, PROT_READ|PROT_WRITE,
224 -                                MAP_SHARED, console_fd, mapped_memlen);
225 +                                /*MAP_SHARED*/MAP_PRIVATE, console_fd, mapped_memlen);
226                 if ( mapped_io == (char *)-1 ) {
227                         /* Hmm, failed to memory map I/O registers */
228                         mapped_io = NULL;
229 @@ -725,12 +730,12 @@
230         Uint32 Bmask;
231         char *surfaces_mem;
232         int surfaces_len;
233 -
234
235         /* Set the terminal into graphics mode */
236         if ( FB_EnterGraphicsMode(this) < 0 ) {
237                 return(NULL);
238         }
239 -
240
241         /* Restore the original palette */
242         FB_RestorePalette(this);
243  
244 @@ -769,6 +774,7 @@
245                 fprintf(stderr, "Printing wanted vinfo:\n");
246                 print_vinfo(&vinfo);
247  #endif
248 +#if 0 //lee
249                 if ( ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo) < 0 ) {
250                         vinfo.yres_virtual = height;
251                         if ( ioctl(console_fd, FBIOPUT_VSCREENINFO, &vinfo) < 0 ) {
252 @@ -776,6 +782,7 @@
253                                 return(NULL);
254                         }
255                 }
256 +#endif
257         } else {
258                 int maxheight;
259  
260 @@ -817,11 +824,12 @@
261         /* Get the fixed information about the console hardware.
262            This is necessary since finfo.line_length changes.
263          */
264 +       
265         if ( ioctl(console_fd, FBIOGET_FSCREENINFO, &finfo) < 0 ) {
266                 SDL_SetError("Couldn't get console hardware info");
267                 return(NULL);
268         }
269 -
270 +       
271         /* Save hardware palette, if needed */
272         FB_SavePalette(this, &finfo, &vinfo);
273  
274 @@ -1107,10 +1115,12 @@
275                 FB_WaitBusySurfaces(this);
276         }
277         wait_vbl(this);
278 +       #if 0 //lee 5-1
279         if ( ioctl(console_fd, FBIOPAN_DISPLAY, &cache_vinfo) < 0 ) {
280                 SDL_SetError("ioctl(FBIOPAN_DISPLAY) failed");
281                 return(-1);
282         }
283 +       #endif
284         flip_page = !flip_page;
285  
286         surface->pixels = flip_address[flip_page];