comparison src/video/xbios/SDL_xbios_centscreen.c @ 1064:fba6b67b4d60

Add Centscreen extended modes support
author Patrice Mandin <patmandin@gmail.com>
date Tue, 31 May 2005 12:31:11 +0000
parents 5023cde12cbd
children 1c9988e47824
comparison
equal deleted inserted replaced
1063:0fb50bfaea7f 1064:fba6b67b4d60
25 25
26 Patrice Mandin 26 Patrice Mandin
27 */ 27 */
28 28
29 #include <stdlib.h> 29 #include <stdlib.h>
30 #include <string.h>
30 31
31 #include <mint/falcon.h> 32 #include <mint/falcon.h>
32 33
33 #include "SDL_xbios.h" 34 #include "SDL_xbios.h"
34 #include "SDL_xbios_centscreen.h" 35 #include "SDL_xbios_centscreen.h"
35 36
36 void SDL_XBIOS_CentscreenInit(_THIS) 37 int SDL_XBIOS_CentscreenInit(_THIS)
37 { 38 {
38 centscreen_mode_t curmode; 39 centscreen_mode_t curmode, listedmode;
40 unsigned long result;
41 int cur_handle; /* Current Centscreen mode handle */
39 42
40 /* Reset current mode list */ 43 /* Reset current mode list */
41 if (XBIOS_modelist) { 44 if (XBIOS_modelist) {
42 free(XBIOS_modelist); 45 free(XBIOS_modelist);
43 XBIOS_nummodes = 0; 46 XBIOS_nummodes = 0;
44 XBIOS_modelist = NULL; 47 XBIOS_modelist = NULL;
45 } 48 }
46 49
47 /* Add current active mode */ 50 /* Add Centscreen modes */
48 Vread(&curmode); 51 Vread(&curmode);
52 cur_handle = curmode.handle;
53 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
54 curmode.logx = curmode.logy = -1;
49 55
50 SDL_XBIOS_AddMode(this, -1, curmode.physx, curmode.physy, curmode.plan, 56 result = Vfirst(&curmode, &listedmode);
51 SDL_FALSE 57 if (result==0) {
52 ); 58 while (result==0) {
59 /* Don't add modes with virtual screen */
60 if ((listedmode.mode & CSCREEN_VIRTUAL)==0) {
61 /* Don't add modes with bpp<8 */
62 if (listedmode.plan>=8) {
63 SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx,
64 listedmode.physy, listedmode.plan, SDL_FALSE
65 );
66 }
67 }
68 memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t));
69 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
70 curmode.logx = curmode.logy = -1;
71 result = Vnext(&curmode, &listedmode);
72 }
73 } else {
74 fprintf(stderr, "No suitable Centscreen modes\n");
75 }
76
77 return cur_handle;
53 } 78 }
79
80 void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes)
81 {
82 centscreen_mode_t newmode, curmode;
83
84 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1;
85 newmode.physx = width;
86 newmode.physy = height;
87 newmode.plan = planes;
88 Vwrite(0, &newmode, &curmode);
89 }
90
91 void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle)
92 {
93 centscreen_mode_t newmode, curmode;
94
95 /* Restore old video mode */
96 newmode.handle = prev_handle;
97 newmode.mode = newmode.physx = newmode.physy = newmode.plan =
98 newmode.logx = newmode.logy = -1;
99 Vwrite(0, &newmode, &curmode);
100 }