comparison src/video/riscos/SDL_riscosvideo.c @ 1549:066236f0cbf0

Implemented RISC OS and OS/2 desktop resolution code (thanks to Alan and Doodle)
author Sam Lantinga <slouken@libsdl.org>
date Sat, 18 Mar 2006 22:42:09 +0000
parents 8d9bb0cf2c2a
children 782fd950bd46 c121d94672cb a1b03ba2fcd0
comparison
equal deleted inserted replaced
1548:a77c022733fe 1549:066236f0cbf0
160 160
161 161
162 int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat) 162 int RISCOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
163 { 163 {
164 _kernel_swi_regs regs; 164 _kernel_swi_regs regs;
165 int vars[4], vals[3];
165 166
166 if (RISCOS_InitTask() == 0) 167 if (RISCOS_InitTask() == 0)
167 { 168 {
168 SDL_SetError("Unable to start task"); 169 SDL_SetError("Unable to start task");
169 return 0; 170 return 0;
170 } 171 }
171 172
172 regs.r[0] = -1; /* Current mode */ 173 vars[0] = 9; /* Log base 2 bpp */
173 regs.r[1] = 9; /* Log base 2 bpp */ 174 vars[1] = 11; /* XWndLimit - num x pixels -1 */
174 175 vars[2] = 12; /* YWndLimit - num y pixels -1 */
175 _kernel_swi(OS_ReadModeVariable, &regs, &regs); 176 vars[3] = -1; /* Terminate list */
176 vformat->BitsPerPixel = (1 << regs.r[2]); 177 regs.r[0] = (int)vars;
178 regs.r[1] = (int)vals;
179
180 _kernel_swi(OS_ReadVduVariables, &regs, &regs);
181 vformat->BitsPerPixel = (1 << vals[0]);
177 182
178 /* Determine the current screen size */ 183 /* Determine the current screen size */
179 this->info.current_w = 0; /* FIXME! */ 184 this->info.current_w = vals[1] + 1;
180 this->info.current_h = 0; /* FIXME! */ 185 this->info.current_h = vals[2] + 1;
181 186
182 /* Minimum bpp for SDL is 8 */ 187 /* Minimum bpp for SDL is 8 */
183 if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8; 188 if (vformat->BitsPerPixel < 8) vformat->BitsPerPixel = 8;
184 189
185 190