comparison src/video/xbios/SDL_xbios_centscreen.c @ 1895:c121d94672cb

SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
author Sam Lantinga <slouken@libsdl.org>
date Mon, 10 Jul 2006 21:04:37 +0000
parents d910939febfa
children 0e751c1f83f5
comparison
equal deleted inserted replaced
1894:c69cee13dd76 1895:c121d94672cb
30 #include <mint/falcon.h> 30 #include <mint/falcon.h>
31 31
32 #include "SDL_xbios.h" 32 #include "SDL_xbios.h"
33 #include "SDL_xbios_centscreen.h" 33 #include "SDL_xbios_centscreen.h"
34 34
35 int SDL_XBIOS_CentscreenInit(_THIS) 35 int
36 SDL_XBIOS_CentscreenInit(_THIS)
36 { 37 {
37 centscreen_mode_t curmode, listedmode; 38 centscreen_mode_t curmode, listedmode;
38 unsigned long result; 39 unsigned long result;
39 int cur_handle; /* Current Centscreen mode handle */ 40 int cur_handle; /* Current Centscreen mode handle */
40 41
41 /* Reset current mode list */ 42 /* Reset current mode list */
42 if (XBIOS_modelist) { 43 if (XBIOS_modelist) {
43 SDL_free(XBIOS_modelist); 44 SDL_free(XBIOS_modelist);
44 XBIOS_nummodes = 0; 45 XBIOS_nummodes = 0;
45 XBIOS_modelist = NULL; 46 XBIOS_modelist = NULL;
46 } 47 }
47 48
48 /* Add Centscreen modes */ 49 /* Add Centscreen modes */
49 Vread(&curmode); 50 Vread(&curmode);
50 cur_handle = curmode.handle; 51 cur_handle = curmode.handle;
51 curmode.mode = curmode.physx = curmode.physy = curmode.plan = 52 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
52 curmode.logx = curmode.logy = -1; 53 curmode.logx = curmode.logy = -1;
53 54
54 result = Vfirst(&curmode, &listedmode); 55 result = Vfirst(&curmode, &listedmode);
55 if (result==0) { 56 if (result == 0) {
56 while (result==0) { 57 while (result == 0) {
57 /* Don't add modes with virtual screen */ 58 /* Don't add modes with virtual screen */
58 if ((listedmode.mode & CSCREEN_VIRTUAL)==0) { 59 if ((listedmode.mode & CSCREEN_VIRTUAL) == 0) {
59 /* Don't add modes with bpp<8 */ 60 /* Don't add modes with bpp<8 */
60 if (listedmode.plan>=8) { 61 if (listedmode.plan >= 8) {
61 SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx, 62 SDL_XBIOS_AddMode(this, listedmode.mode,
62 listedmode.physy, listedmode.plan, SDL_FALSE 63 listedmode.physx,
63 ); 64 listedmode.physy,
64 } 65 listedmode.plan, SDL_FALSE);
65 } 66 }
66 SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t)); 67 }
67 curmode.mode = curmode.physx = curmode.physy = curmode.plan = 68 SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t));
68 curmode.logx = curmode.logy = -1; 69 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
69 result = Vnext(&curmode, &listedmode); 70 curmode.logx = curmode.logy = -1;
70 } 71 result = Vnext(&curmode, &listedmode);
71 } else { 72 }
72 fprintf(stderr, "No suitable Centscreen modes\n"); 73 } else {
73 } 74 fprintf(stderr, "No suitable Centscreen modes\n");
75 }
74 76
75 return cur_handle; 77 return cur_handle;
76 } 78 }
77 79
78 void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes) 80 void
81 SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes)
79 { 82 {
80 centscreen_mode_t newmode, curmode; 83 centscreen_mode_t newmode, curmode;
81
82 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1;
83 newmode.physx = width;
84 newmode.physy = height;
85 newmode.plan = planes;
86 Vwrite(0, &newmode, &curmode);
87 84
88 /* Disable screensaver */ 85 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1;
89 Vread(&newmode); 86 newmode.physx = width;
90 newmode.mode &= ~(CSCREEN_SAVER|CSCREEN_ENERGYSTAR); 87 newmode.physy = height;
91 Vwrite(0, &newmode, &curmode); 88 newmode.plan = planes;
89 Vwrite(0, &newmode, &curmode);
90
91 /* Disable screensaver */
92 Vread(&newmode);
93 newmode.mode &= ~(CSCREEN_SAVER | CSCREEN_ENERGYSTAR);
94 Vwrite(0, &newmode, &curmode);
92 } 95 }
93 96
94 void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle) 97 void
98 SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle)
95 { 99 {
96 centscreen_mode_t newmode, curmode; 100 centscreen_mode_t newmode, curmode;
97 101
98 /* Restore old video mode */ 102 /* Restore old video mode */
99 newmode.handle = prev_handle; 103 newmode.handle = prev_handle;
100 newmode.mode = newmode.physx = newmode.physy = newmode.plan = 104 newmode.mode = newmode.physx = newmode.physy = newmode.plan =
101 newmode.logx = newmode.logy = -1; 105 newmode.logx = newmode.logy = -1;
102 Vwrite(0, &newmode, &curmode); 106 Vwrite(0, &newmode, &curmode);
103 } 107 }
108
109 /* vi: set ts=4 sw=4 expandtab: */