SDL-1.2.14
[sdl_omap.git] / src / video / xbios / SDL_xbios_blowup.c
1 /*
2     SDL - Simple DirectMedia Layer
3     Copyright (C) 1997-2009 Sam Lantinga
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public
16     License along with this library; if not, write to the Free
17     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
19     Sam Lantinga
20     slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 /*
25         Blowup extension definitions
26
27         Patrice Mandin
28 */
29
30 #include <mint/falcon.h>
31
32 #include "SDL_xbios.h"
33 #include "SDL_xbios_blowup.h"
34
35 void SDL_XBIOS_ListBlowupModes(_THIS, int actually_add, blow_cookie_t *cookie_blow)
36 {
37         int i, j, num_mode, bank;
38         blow_mode_t *blow_mode;
39         xbiosmode_t modeinfo;
40
41         if (actually_add) {
42                 /* Set bit 15 for old modes */
43                 for (i=0;i<NUM_MODELISTS;i++) {
44                         if ( SDL_xbiosmode[i] != NULL ) {
45                                 for ( j=0; SDL_xbiosmode[i][j]; ++j ) {
46                                         SDL_xbiosmode[i][j]->number |= 1<<15;
47                                 }
48                         }
49                 }
50         }
51
52         /* Add Blowup modes for 8 and 16 bpp */
53         for (num_mode=3; num_mode<5; num_mode++) {
54                 bank = cookie_blow->num_mode[num_mode];
55                 blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]);
56
57                 /* Check extended mode enabled */
58                 if (blow_mode->enabled == 0) {
59                         /* Check monitor needed for this mode */
60                         if ((blow_mode->monitor == cookie_blow->montype)
61                                 || ((blow_mode->monitor == MONITOR_TV)
62                                         && (cookie_blow->montype == MONITOR_RGB))
63                                 || ((blow_mode->monitor == MONITOR_RGB)
64                                         && (cookie_blow->montype == MONITOR_TV)))
65                         {
66                                 /* we can use this extended mode */
67                                 modeinfo.number = (num_mode == 3 ? BPS8 : BPS16);
68                                 modeinfo.width = blow_mode->width + 1;
69                                 modeinfo.height = blow_mode->height + 1;
70                                 modeinfo.depth = (num_mode == 3 ? 8 : 16);
71                                 modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0);
72
73                                 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
74                         }
75                 }
76         }
77 }