comparison src/video/xbios/SDL_xbios_blowup.c @ 1042:0e7218843cfb

Dynamically create list of video modes, easier to add new ones
author Patrice Mandin <patmandin@gmail.com>
date Mon, 07 Mar 2005 10:00:58 +0000
parents c6ed27c7d47d
children d910939febfa
comparison
equal deleted inserted replaced
1041:af92ee34b3e2 1042:0e7218843cfb
24 Blowup extension definitions 24 Blowup extension definitions
25 25
26 Patrice Mandin 26 Patrice Mandin
27 */ 27 */
28 28
29 #include <mint/falcon.h>
30
29 #include "SDL_xbios.h" 31 #include "SDL_xbios.h"
30 #include "SDL_xbios_blowup.h" 32 #include "SDL_xbios_blowup.h"
31 33
32 void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow) 34 void SDL_XBIOS_BlowupInit(_THIS, blow_cookie_t *cookie_blow)
33 { 35 {
34 int i, num_mode, bank, keep_old; 36 int i, num_mode, bank;
35 xbiosmode_t *current_mode;
36 blow_mode_t *blow_mode; 37 blow_mode_t *blow_mode;
37 38
38 current_mode = XBIOS_modelist; 39 /* Add bit 15 for old modes */
39 for (i=0;i<XBIOS_nummodes;i++) { 40 for (i=0;i<XBIOS_nummodes;i++) {
40 keep_old=1; /* use default mode */ 41 XBIOS_modelist[i].number |= 1<<15;
41 blow_mode = NULL; 42 }
42 switch (current_mode->depth) {
43 case 1:
44 num_mode=0;
45 break;
46 case 2:
47 num_mode=1;
48 break;
49 case 4:
50 num_mode=2;
51 break;
52 case 8:
53 num_mode=3;
54 break;
55 case 16:
56 num_mode=4;
57 break;
58 default:
59 num_mode=-1;
60 break;
61 }
62 43
63 /* Check which bank of modes to use */ 44 /* Add Blowup modes for 8 and 16 bpp */
64 if (num_mode>=0) { 45 for (num_mode=3; num_mode<5; num_mode++) {
65 bank = cookie_blow->num_mode[num_mode]; 46 bank = cookie_blow->num_mode[num_mode];
66 blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]); 47 blow_mode = &(cookie_blow->blowup_modes[num_mode+(bank*5)]);
67 48
68 /* Check extended mode enabled */ 49 /* Check extended mode enabled */
69 if (blow_mode->enabled == 0) { 50 if (blow_mode->enabled == 0) {
70 /* Check monitor needed for this mode */ 51 /* Check monitor needed for this mode */
71 if ((blow_mode->monitor == cookie_blow->montype) 52 if ((blow_mode->monitor == cookie_blow->montype)
72 || ((blow_mode->monitor == MONITOR_TV) 53 || ((blow_mode->monitor == MONITOR_TV)
73 && (cookie_blow->montype == MONITOR_RGB)) 54 && (cookie_blow->montype == MONITOR_RGB))
74 || ((blow_mode->monitor == MONITOR_RGB) 55 || ((blow_mode->monitor == MONITOR_RGB)
75 && (cookie_blow->montype == MONITOR_TV))) 56 && (cookie_blow->montype == MONITOR_TV)))
76 { 57 {
77 keep_old = 0; /* we can use this extended mode */ 58 /* we can use this extended mode */
78 } 59 SDL_XBIOS_AddMode(this,
60 num_mode == 3 ? BPS8 : BPS16,
61 blow_mode->width + 1,
62 blow_mode->height + 1,
63 num_mode == 3 ? 8 : 16,
64 SDL_FALSE
65 );
79 } 66 }
80 } 67 }
81
82 if (keep_old) {
83 /* disable blowup for this mode */
84 current_mode->number |= (1<<15);
85 } else {
86 /* Update mode size */
87 current_mode->width = blow_mode->width +1;
88 current_mode->height = blow_mode->height +1;
89 }
90
91 current_mode++;
92 } 68 }
93 } 69 }