summaryrefslogtreecommitdiff
path: root/apps/plugins/sdl/src/video/xbios
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/sdl/src/video/xbios')
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios.c1116
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios.h111
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.c77
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.h86
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.c104
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.h114
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c106
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.h129
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.c83
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.h82
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.c63
-rw-r--r--apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.h64
12 files changed, 0 insertions, 2135 deletions
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios.c
deleted file mode 100644
index 56bf6abd6f..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios.c
+++ /dev/null
@@ -1,1116 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24/*
25 * Xbios SDL video driver
26 *
27 * Patrice Mandin
28 */
29
30#include <sys/stat.h>
31#include <unistd.h>
32
33/* Mint includes */
34#include <mint/cookie.h>
35#include <mint/osbind.h>
36#include <mint/falcon.h>
37
38#include "SDL_video.h"
39#include "SDL_mouse.h"
40#include "../SDL_sysvideo.h"
41#include "../SDL_pixels_c.h"
42#include "../../events/SDL_events_c.h"
43
44#include "../ataricommon/SDL_ataric2p_s.h"
45#include "../ataricommon/SDL_atarievents_c.h"
46#include "../ataricommon/SDL_atarimxalloc_c.h"
47#include "../ataricommon/SDL_atarigl_c.h"
48#include "SDL_xbios.h"
49#include "SDL_xbios_blowup.h"
50#include "SDL_xbios_centscreen.h"
51#include "SDL_xbios_sb3.h"
52#include "SDL_xbios_tveille.h"
53#include "SDL_xbios_milan.h"
54
55#define XBIOS_VID_DRIVER_NAME "xbios"
56
57#ifndef C_fVDI
58#define C_fVDI 0x66564449L
59#endif
60
61/* Debug print info */
62#if 0
63#define DEBUG_PRINT(what) \
64 { \
65 printf what; \
66 }
67#define DEBUG_VIDEO_XBIOS 1
68#else
69#define DEBUG_PRINT(what)
70#undef DEBUG_VIDEO_XBIOS
71#endif
72
73/* Initialization/Query functions */
74static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat);
75static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags);
76static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags);
77static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors);
78static void XBIOS_VideoQuit(_THIS);
79
80/* Hardware surface functions */
81static int XBIOS_AllocHWSurface(_THIS, SDL_Surface *surface);
82static int XBIOS_LockHWSurface(_THIS, SDL_Surface *surface);
83static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface);
84static void XBIOS_UnlockHWSurface(_THIS, SDL_Surface *surface);
85static void XBIOS_FreeHWSurface(_THIS, SDL_Surface *surface);
86static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects);
87
88#if SDL_VIDEO_OPENGL
89/* OpenGL functions */
90static void XBIOS_GL_SwapBuffers(_THIS);
91#endif
92
93/* To setup palette */
94
95static unsigned short TT_palette[256];
96static unsigned long F30_palette[256];
97
98/* Default list of video modes */
99
100static const xbiosmode_t stmodes[1]={
101 {ST_LOW>>8,320,200,4, XBIOSMODE_C2P}
102};
103
104static const xbiosmode_t ttmodes[2]={
105 {TT_LOW,320,480,8, XBIOSMODE_C2P},
106 {TT_LOW,320,240,8, XBIOSMODE_C2P|XBIOSMODE_DOUBLELINE}
107};
108
109static const xbiosmode_t falconrgbmodes[16]={
110 {BPS16|COL80|OVERSCAN|VERTFLAG,768,480,16,0},
111 {BPS16|COL80|OVERSCAN,768,240,16,0},
112 {BPS16|COL80|VERTFLAG,640,400,16,0},
113 {BPS16|COL80,640,200,16,0},
114 {BPS16|OVERSCAN|VERTFLAG,384,480,16,0},
115 {BPS16|OVERSCAN,384,240,16,0},
116 {BPS16|VERTFLAG,320,400,16,0},
117 {BPS16,320,200,16,0},
118 {BPS8|COL80|OVERSCAN|VERTFLAG,768,480,8,XBIOSMODE_C2P},
119 {BPS8|COL80|OVERSCAN,768,240,8,XBIOSMODE_C2P},
120 {BPS8|COL80|VERTFLAG,640,400,8,XBIOSMODE_C2P},
121 {BPS8|COL80,640,200,8,XBIOSMODE_C2P},
122 {BPS8|OVERSCAN|VERTFLAG,384,480,8,XBIOSMODE_C2P},
123 {BPS8|OVERSCAN,384,240,8,XBIOSMODE_C2P},
124 {BPS8|VERTFLAG,320,400,8,XBIOSMODE_C2P},
125 {BPS8,320,200,8,XBIOSMODE_C2P}
126};
127
128static const xbiosmode_t falconvgamodes[6]={
129 {BPS16,320,480,16,0},
130 {BPS16|VERTFLAG,320,240,16,0},
131 {BPS8|COL80,640,480,8,XBIOSMODE_C2P},
132 {BPS8|COL80|VERTFLAG,640,240,8,XBIOSMODE_C2P},
133 {BPS8,320,480,8,XBIOSMODE_C2P},
134 {BPS8|VERTFLAG,320,240,8,XBIOSMODE_C2P}
135};
136
137/* Xbios driver bootstrap functions */
138
139static int XBIOS_Available(void)
140{
141 long cookie_vdo, /*cookie_mil,*/ cookie_hade, cookie_scpn;
142 long cookie_fvdi;
143 const char *envr = SDL_getenv("SDL_VIDEODRIVER");
144
145 /* Milan/Hades Atari clones do not have an Atari video chip */
146 if ( /*(Getcookie(C__MIL, &cookie_mil) == C_FOUND) ||*/
147 (Getcookie(C_hade, &cookie_hade) == C_FOUND) ) {
148 return 0;
149 }
150
151 /* fVDI means graphic card, so no Xbios with it */
152 if (Getcookie(C_fVDI, &cookie_fvdi) == C_FOUND) {
153 if (!envr) {
154 return 0;
155 }
156 if (SDL_strcmp(envr, XBIOS_VID_DRIVER_NAME)!=0) {
157 return 0;
158 }
159 /* Except if we force Xbios usage, through env var */
160 }
161
162 /* Cookie _VDO present ? if not, assume ST machine */
163 if (Getcookie(C__VDO, &cookie_vdo) != C_FOUND) {
164 cookie_vdo = VDO_ST << 16;
165 }
166
167 /* Test if we have a monochrome monitor plugged in */
168 switch( cookie_vdo >>16) {
169 case VDO_ST:
170 case VDO_STE:
171 if ( Getrez() == (ST_HIGH>>8) )
172 return 0;
173 break;
174 case VDO_TT:
175 if ( (EgetShift() & ES_MODE) == TT_HIGH)
176 return 0;
177 break;
178 case VDO_F30:
179 if ( VgetMonitor() == MONITOR_MONO)
180 return 0;
181 if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
182 if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *)cookie_scpn)) {
183 return 0;
184 }
185 }
186 break;
187 case VDO_MILAN:
188 break;
189 default:
190 return 0;
191 }
192
193 return 1;
194}
195
196static void XBIOS_DeleteDevice(SDL_VideoDevice *device)
197{
198 SDL_free(device->hidden);
199 SDL_free(device);
200}
201
202static SDL_VideoDevice *XBIOS_CreateDevice(int devindex)
203{
204 SDL_VideoDevice *device;
205
206 /* Initialize all variables that we clean on shutdown */
207 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice));
208 if ( device ) {
209 SDL_memset(device, 0, (sizeof *device));
210 device->hidden = (struct SDL_PrivateVideoData *)
211 SDL_malloc((sizeof *device->hidden));
212 device->gl_data = (struct SDL_PrivateGLData *)
213 SDL_malloc((sizeof *device->gl_data));
214 }
215 if ( (device == NULL) || (device->hidden == NULL) ) {
216 SDL_OutOfMemory();
217 if ( device ) {
218 SDL_free(device);
219 }
220 return(0);
221 }
222 SDL_memset(device->hidden, 0, (sizeof *device->hidden));
223 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data));
224
225 /* Video functions */
226 device->VideoInit = XBIOS_VideoInit;
227 device->ListModes = XBIOS_ListModes;
228 device->SetVideoMode = XBIOS_SetVideoMode;
229 device->SetColors = XBIOS_SetColors;
230 device->UpdateRects = NULL;
231 device->VideoQuit = XBIOS_VideoQuit;
232 device->AllocHWSurface = XBIOS_AllocHWSurface;
233 device->LockHWSurface = XBIOS_LockHWSurface;
234 device->UnlockHWSurface = XBIOS_UnlockHWSurface;
235 device->FlipHWSurface = XBIOS_FlipHWSurface;
236 device->FreeHWSurface = XBIOS_FreeHWSurface;
237
238#if SDL_VIDEO_OPENGL
239 /* OpenGL functions */
240 device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
241 device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
242 device->GL_GetAttribute = SDL_AtariGL_GetAttribute;
243 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
244 device->GL_SwapBuffers = XBIOS_GL_SwapBuffers;
245#endif
246
247 /* Events */
248 device->InitOSKeymap = Atari_InitOSKeymap;
249 device->PumpEvents = Atari_PumpEvents;
250
251 device->free = XBIOS_DeleteDevice;
252
253 return device;
254}
255
256VideoBootStrap XBIOS_bootstrap = {
257 XBIOS_VID_DRIVER_NAME, "Atari Xbios driver",
258 XBIOS_Available, XBIOS_CreateDevice
259};
260
261void SDL_XBIOS_AddMode(_THIS, int actually_add, const xbiosmode_t *modeinfo)
262{
263 int i = 0;
264
265 switch(modeinfo->depth) {
266 case 15:
267 case 16:
268 i = 1;
269 break;
270 case 24:
271 i = 2;
272 break;
273 case 32:
274 i = 3;
275 break;
276 }
277
278 if ( actually_add ) {
279 SDL_Rect saved_rect[2];
280 xbiosmode_t saved_mode[2];
281 int b, j;
282
283 /* Add the mode, sorted largest to smallest */
284 b = 0;
285 j = 0;
286 while ( (SDL_modelist[i][j]->w > modeinfo->width) ||
287 (SDL_modelist[i][j]->h > modeinfo->height) ) {
288 ++j;
289 }
290 /* Skip modes that are already in our list */
291 if ( (SDL_modelist[i][j]->w == modeinfo->width) &&
292 (SDL_modelist[i][j]->h == modeinfo->height) ) {
293 return;
294 }
295 /* Insert the new mode */
296 saved_rect[b] = *SDL_modelist[i][j];
297 SDL_memcpy(&saved_mode[b], SDL_xbiosmode[i][j], sizeof(xbiosmode_t));
298 SDL_modelist[i][j]->w = modeinfo->width;
299 SDL_modelist[i][j]->h = modeinfo->height;
300 SDL_memcpy(SDL_xbiosmode[i][j], modeinfo, sizeof(xbiosmode_t));
301 /* Everybody scoot down! */
302 if ( saved_rect[b].w && saved_rect[b].h ) {
303 for ( ++j; SDL_modelist[i][j]->w; ++j ) {
304 saved_rect[!b] = *SDL_modelist[i][j];
305 memcpy(&saved_mode[!b], SDL_xbiosmode[i][j], sizeof(xbiosmode_t));
306 *SDL_modelist[i][j] = saved_rect[b];
307 SDL_memcpy(SDL_xbiosmode[i][j], &saved_mode[b], sizeof(xbiosmode_t));
308 b = !b;
309 }
310 *SDL_modelist[i][j] = saved_rect[b];
311 SDL_memcpy(SDL_xbiosmode[i][j], &saved_mode[b], sizeof(xbiosmode_t));
312 }
313 } else {
314 ++SDL_nummodes[i];
315 }
316}
317
318static void XBIOS_ListSTModes(_THIS, int actually_add)
319{
320 SDL_XBIOS_AddMode(this, actually_add, &stmodes[0]);
321}
322
323static void XBIOS_ListTTModes(_THIS, int actually_add)
324{
325 int i;
326
327 for (i=0; i<2; i++) {
328 SDL_XBIOS_AddMode(this, actually_add, &ttmodes[i]);
329 }
330}
331
332static void XBIOS_ListFalconRgbModes(_THIS, int actually_add)
333{
334 int i;
335
336 for (i=0; i<16; i++) {
337 xbiosmode_t modeinfo;
338
339 SDL_memcpy(&modeinfo, &falconrgbmodes[i], sizeof(xbiosmode_t));
340 modeinfo.number &= ~(VGA|PAL);
341 modeinfo.number |= XBIOS_oldvmode & (VGA|PAL);
342
343 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
344 }
345}
346
347static void XBIOS_ListFalconVgaModes(_THIS, int actually_add)
348{
349 int i;
350
351 for (i=0; i<6; i++) {
352 xbiosmode_t modeinfo;
353
354 SDL_memcpy(&modeinfo, &falconvgamodes[i], sizeof(xbiosmode_t));
355 modeinfo.number &= ~(VGA|PAL);
356 modeinfo.number |= XBIOS_oldvmode & (VGA|PAL);
357
358 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
359 }
360}
361
362static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat)
363{
364 int i;
365 long cookie_blow, cookie_scpn, cookie_cnts;
366
367 /* Initialize all variables that we clean on shutdown */
368 for ( i=0; i<NUM_MODELISTS; ++i ) {
369 SDL_nummodes[i] = 0;
370 SDL_modelist[i] = NULL;
371 SDL_xbiosmode[i] = NULL;
372 }
373
374 /* Cookie _VDO present ? if not, assume ST machine */
375 if (Getcookie(C__VDO, &XBIOS_cvdo) != C_FOUND) {
376 XBIOS_cvdo = VDO_ST << 16;
377 }
378
379 /* Allocate memory for old palette */
380 XBIOS_oldpalette = (void *)SDL_malloc(256*sizeof(long));
381 if ( !XBIOS_oldpalette ) {
382 SDL_SetError("Unable to allocate memory for old palette\n");
383 return(-1);
384 }
385
386 /* Initialize video mode list */
387 /* and save current screen status (palette, screen address, video mode) */
388 XBIOS_centscreen = SDL_FALSE;
389 XBIOS_oldvbase = Physbase();
390
391 /* Determine the current screen size */
392 this->info.current_w = 0;
393 this->info.current_h = 0;
394
395 /* Determine the screen depth (use default 8-bit depth) */
396 vformat->BitsPerPixel = 8;
397
398 /* First allocate room for needed video modes */
399 switch (XBIOS_cvdo >>16) {
400 case VDO_ST:
401 case VDO_STE:
402 {
403 short *oldpalette;
404
405 XBIOS_oldvmode=Getrez();
406 switch(XBIOS_oldvmode << 8) {
407 case ST_LOW:
408 XBIOS_oldnumcol=16;
409 break;
410 case ST_MED:
411 XBIOS_oldnumcol=4;
412 break;
413 case ST_HIGH:
414 XBIOS_oldnumcol=2;
415 break;
416 }
417
418 oldpalette= (short *) XBIOS_oldpalette;
419 for (i=0;i<XBIOS_oldnumcol;i++) {
420 *oldpalette++=Setcolor(i,-1);
421 }
422
423 XBIOS_ListSTModes(this, 0);
424 }
425 break;
426 case VDO_TT:
427 XBIOS_oldvmode=EgetShift();
428
429 switch(XBIOS_oldvmode & ES_MODE) {
430 case TT_LOW:
431 XBIOS_oldnumcol=256;
432 break;
433 case ST_LOW:
434 case TT_MED:
435 XBIOS_oldnumcol=16;
436 break;
437 case ST_MED:
438 XBIOS_oldnumcol=4;
439 break;
440 case ST_HIGH:
441 case TT_HIGH:
442 XBIOS_oldnumcol=2;
443 break;
444 }
445 if (XBIOS_oldnumcol) {
446 EgetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
447 }
448
449 XBIOS_ListTTModes(this, 0);
450 break;
451 case VDO_F30:
452 XBIOS_oldvmode=VsetMode(-1);
453
454 XBIOS_oldnumcol= 1<< (1 << (XBIOS_oldvmode & NUMCOLS));
455 if (XBIOS_oldnumcol > 256) {
456 XBIOS_oldnumcol = 0;
457 }
458 if (XBIOS_oldnumcol) {
459 VgetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
460 }
461
462 vformat->BitsPerPixel = 16;
463
464 /* ScreenBlaster 3 ? */
465 if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
466 SDL_XBIOS_ListSB3Modes(this, 0, (scpn_cookie_t *)cookie_scpn);
467 } else
468 /* Centscreen ? */
469 if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) {
470 XBIOS_oldvmode = SDL_XBIOS_ListCentscreenModes(this, 0);
471 XBIOS_centscreen = SDL_TRUE;
472 } else
473 /* Standard, with or without Blowup */
474 {
475 switch (VgetMonitor())
476 {
477 case MONITOR_RGB:
478 case MONITOR_TV:
479 XBIOS_ListFalconRgbModes(this, 0);
480 break;
481 case MONITOR_VGA:
482 XBIOS_ListFalconVgaModes(this, 0);
483 break;
484 }
485
486 if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) {
487 SDL_XBIOS_ListBlowupModes(this, 0, (blow_cookie_t *)cookie_blow);
488 }
489 }
490 break;
491 case VDO_MILAN:
492 {
493 SCREENINFO si;
494
495 /* Read infos about current mode */
496 VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_GETMODE);
497
498 si.size = sizeof(SCREENINFO);
499 si.devID = XBIOS_oldvmode;
500 si.scrFlags = 0;
501 VsetScreen(-1, &si, MI_MAGIC, CMD_GETINFO);
502
503 this->info.current_w = si.scrWidth;
504 this->info.current_h = si.scrHeight;
505
506 XBIOS_oldnumcol = 0;
507 if (si.scrFlags & SCRINFO_OK) {
508 if (si.scrPlanes <= 8) {
509 XBIOS_oldnumcol = 1<<si.scrPlanes;
510 }
511 }
512 if (XBIOS_oldnumcol) {
513 VgetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
514 }
515
516 SDL_XBIOS_ListMilanModes(this, 0);
517 }
518 break;
519 }
520
521 for ( i=0; i<NUM_MODELISTS; ++i ) {
522 int j;
523
524 SDL_xbiosmode[i] = (xbiosmode_t **)
525 SDL_malloc((SDL_nummodes[i]+1)*sizeof(xbiosmode_t *));
526 if ( SDL_xbiosmode[i] == NULL ) {
527 SDL_OutOfMemory();
528 return(-1);
529 }
530 for ( j=0; j<SDL_nummodes[i]; ++j ) {
531 SDL_xbiosmode[i][j]=(xbiosmode_t *)SDL_malloc(sizeof(xbiosmode_t));
532 if ( SDL_xbiosmode[i][j] == NULL ) {
533 SDL_OutOfMemory();
534 return(-1);
535 }
536 SDL_memset(SDL_xbiosmode[i][j], 0, sizeof(xbiosmode_t));
537 }
538 SDL_xbiosmode[i][j] = NULL;
539
540 SDL_modelist[i] = (SDL_Rect **)
541 SDL_malloc((SDL_nummodes[i]+1)*sizeof(SDL_Rect *));
542 if ( SDL_modelist[i] == NULL ) {
543 SDL_OutOfMemory();
544 return(-1);
545 }
546 for ( j=0; j<SDL_nummodes[i]; ++j ) {
547 SDL_modelist[i][j]=(SDL_Rect *)SDL_malloc(sizeof(SDL_Rect));
548 if ( SDL_modelist[i][j] == NULL ) {
549 SDL_OutOfMemory();
550 return(-1);
551 }
552 SDL_memset(SDL_modelist[i][j], 0, sizeof(SDL_Rect));
553 }
554 SDL_modelist[i][j] = NULL;
555 }
556
557 /* Now fill the mode list */
558 switch (XBIOS_cvdo >>16) {
559 case VDO_ST:
560 case VDO_STE:
561 XBIOS_ListSTModes(this, 1);
562 break;
563 case VDO_TT:
564 XBIOS_ListTTModes(this, 1);
565 break;
566 case VDO_F30:
567 /* ScreenBlaster 3 ? */
568 if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
569 SDL_XBIOS_ListSB3Modes(this, 1, (scpn_cookie_t *)cookie_scpn);
570 } else
571 /* Centscreen ? */
572 if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) {
573 XBIOS_oldvmode = SDL_XBIOS_ListCentscreenModes(this, 1);
574 XBIOS_centscreen = SDL_TRUE;
575 } else
576 /* Standard, with or without Blowup */
577 {
578 switch (VgetMonitor())
579 {
580 case MONITOR_RGB:
581 case MONITOR_TV:
582 XBIOS_ListFalconRgbModes(this, 1);
583 break;
584 case MONITOR_VGA:
585 XBIOS_ListFalconVgaModes(this, 1);
586 break;
587 }
588
589 if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) {
590 SDL_XBIOS_ListBlowupModes(this, 1, (blow_cookie_t *)cookie_blow);
591 }
592 }
593 break;
594 case VDO_MILAN:
595 SDL_XBIOS_ListMilanModes(this, 1);
596 break;
597 }
598
599 XBIOS_screens[0]=NULL;
600 XBIOS_screens[1]=NULL;
601 XBIOS_shadowscreen=NULL;
602
603 /* Update hardware info */
604 this->info.hw_available = 1;
605 this->info.video_mem = (Uint32) Atari_SysMalloc(-1L, MX_STRAM);
606
607 /* Init chunky to planar routine */
608 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
609
610#if SDL_VIDEO_OPENGL
611 SDL_AtariGL_InitPointers(this);
612#endif
613
614 /* Disable screensavers */
615 if (SDL_XBIOS_TveillePresent(this)) {
616 SDL_XBIOS_TveilleDisable(this);
617 }
618
619 /* We're done! */
620 return(0);
621}
622
623static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags)
624{
625 return(SDL_modelist[((format->BitsPerPixel+7)/8)-1]);
626}
627
628static void XBIOS_FreeBuffers(_THIS)
629{
630 int i;
631
632 for (i=0;i<2;i++) {
633 if (XBIOS_screensmem[i]!=NULL) {
634 if ((XBIOS_cvdo>>16) == VDO_MILAN) {
635 if (i==1) {
636 VsetScreen(-1, -1, MI_MAGIC, CMD_FREEPAGE);
637 }
638 } else {
639 Mfree(XBIOS_screensmem[i]);
640 }
641 XBIOS_screensmem[i]=NULL;
642 }
643 }
644
645 if (XBIOS_shadowscreen!=NULL) {
646 Mfree(XBIOS_shadowscreen);
647 XBIOS_shadowscreen=NULL;
648 }
649}
650
651static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current,
652 int width, int height, int bpp, Uint32 flags)
653{
654 int mode, new_depth;
655 int i, num_buffers;
656 xbiosmode_t *new_video_mode;
657 Uint32 new_screen_size;
658 Uint32 modeflags;
659
660 /* Free current buffers */
661 XBIOS_FreeBuffers(this);
662
663 /* Try to set the requested linear video mode */
664 bpp = (bpp+7)/8-1;
665 for ( mode=0; SDL_modelist[bpp][mode]; ++mode ) {
666 if ( (SDL_modelist[bpp][mode]->w == width) &&
667 (SDL_modelist[bpp][mode]->h == height) ) {
668 break;
669 }
670 }
671 if ( SDL_modelist[bpp][mode] == NULL ) {
672 SDL_SetError("Couldn't find requested mode in list");
673 return(NULL);
674 }
675 new_video_mode = SDL_xbiosmode[bpp][mode];
676
677 modeflags = SDL_FULLSCREEN | SDL_PREALLOC;
678
679 /* Allocate needed buffers: simple/double buffer and shadow surface */
680 new_depth = new_video_mode->depth;
681 if (new_depth == 4) {
682 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert4;
683 new_depth=8;
684 modeflags |= SDL_SWSURFACE|SDL_HWPALETTE;
685 } else if (new_depth == 8) {
686 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8;
687 modeflags |= SDL_SWSURFACE|SDL_HWPALETTE;
688 } else {
689 modeflags |= SDL_HWSURFACE;
690 }
691
692 new_screen_size = width * height * ((new_depth)>>3);
693 new_screen_size += 256; /* To align on a 256 byte adress */
694
695 if (new_video_mode->flags & XBIOSMODE_C2P) {
696 XBIOS_shadowscreen = Atari_SysMalloc(new_screen_size, MX_PREFTTRAM);
697
698 if (XBIOS_shadowscreen == NULL) {
699 SDL_SetError("Can not allocate %d KB for shadow buffer", new_screen_size>>10);
700 return (NULL);
701 }
702 SDL_memset(XBIOS_shadowscreen, 0, new_screen_size);
703 }
704
705 /* Output buffer needs to be twice in size for the software double-line mode */
706 if (new_video_mode->flags & XBIOSMODE_DOUBLELINE) {
707 new_screen_size <<= 1;
708 }
709
710 /* Double buffer ? */
711 num_buffers = 1;
712
713#if SDL_VIDEO_OPENGL
714 if (flags & SDL_OPENGL) {
715 if (this->gl_config.double_buffer) {
716 flags |= SDL_DOUBLEBUF;
717 }
718 }
719#endif
720 if ((flags & SDL_DOUBLEBUF) && ((XBIOS_cvdo>>16) != VDO_MILAN)) {
721 num_buffers = 2;
722 modeflags |= SDL_DOUBLEBUF;
723 }
724
725 /* Allocate buffers */
726 for (i=0; i<num_buffers; i++) {
727 if ((XBIOS_cvdo>>16) == VDO_MILAN) {
728 if (i==0) {
729 XBIOS_screensmem[i] = XBIOS_oldvbase;
730 } else {
731 VsetScreen(-1, &XBIOS_screensmem[i], MI_MAGIC, CMD_ALLOCPAGE);
732 }
733 } else {
734 XBIOS_screensmem[i] = Atari_SysMalloc(new_screen_size, MX_STRAM);
735 }
736
737 if (XBIOS_screensmem[i]==NULL) {
738 XBIOS_FreeBuffers(this);
739 SDL_SetError("Can not allocate %d KB for buffer %d", new_screen_size>>10, i);
740 return (NULL);
741 }
742 SDL_memset(XBIOS_screensmem[i], 0, new_screen_size);
743
744 XBIOS_screens[i]=(void *) (( (long) XBIOS_screensmem[i]+256) & 0xFFFFFF00UL);
745 }
746
747 /* Allocate the new pixel format for the screen */
748 if ( ! SDL_ReallocFormat(current, new_depth, 0, 0, 0, 0) ) {
749 XBIOS_FreeBuffers(this);
750 SDL_SetError("Couldn't allocate new pixel format for requested mode");
751 return(NULL);
752 }
753
754 XBIOS_current = new_video_mode;
755 current->w = width;
756 current->h = height;
757 current->pitch = (width * new_depth)>>3;
758
759 /* this is for C2P conversion */
760 XBIOS_pitch = (new_video_mode->width * new_video_mode->depth)>>3;
761
762 if (new_video_mode->flags & XBIOSMODE_C2P)
763 current->pixels = XBIOS_shadowscreen;
764 else
765 current->pixels = XBIOS_screens[0];
766
767 XBIOS_fbnum = 0;
768
769#if SDL_VIDEO_OPENGL
770 if (flags & SDL_OPENGL) {
771 if (!SDL_AtariGL_Init(this, current)) {
772 XBIOS_FreeBuffers(this);
773 SDL_SetError("Can not create OpenGL context");
774 return NULL;
775 }
776
777 modeflags |= SDL_OPENGL;
778 }
779#endif
780
781 current->flags = modeflags;
782
783#ifndef DEBUG_VIDEO_XBIOS
784 /* Now set the video mode */
785 if ((XBIOS_cvdo>>16) == VDO_MILAN) {
786 VsetScreen(-1, XBIOS_screens[0], MI_MAGIC, CMD_SETADR);
787 } else {
788 Setscreen(-1,XBIOS_screens[0],-1);
789 }
790
791 switch(XBIOS_cvdo >> 16) {
792 case VDO_ST:
793 Setscreen(-1,-1,new_video_mode->number);
794
795 /* Reset palette */
796 for (i=0;i<16;i++) {
797 TT_palette[i]= ((i>>1)<<8) | (((i*8)/17)<<4) | (i>>1);
798 }
799 Setpalette(TT_palette);
800 break;
801 case VDO_STE:
802 Setscreen(-1,-1,new_video_mode->number);
803
804 /* Reset palette */
805 for (i=0;i<16;i++)
806 {
807 int c;
808
809 c=((i&1)<<3)|((i>>1)&7);
810 TT_palette[i]=(c<<8)|(c<<4)|c;
811 }
812 Setpalette(TT_palette);
813 break;
814 case VDO_TT:
815 EsetShift(new_video_mode->number);
816 break;
817 case VDO_F30:
818 if (XBIOS_centscreen) {
819 SDL_XBIOS_CentscreenSetmode(this, width, height, new_depth);
820 } else {
821 VsetMode(new_video_mode->number);
822 }
823
824 /* Set hardware palette to black in True Colour */
825 if (new_depth > 8) {
826 SDL_memset(F30_palette, 0, sizeof(F30_palette));
827 VsetRGB(0,256,F30_palette);
828 }
829 break;
830 case VDO_MILAN:
831 VsetScreen(-1, new_video_mode->number, MI_MAGIC, CMD_SETMODE);
832
833 /* Set hardware palette to black in True Colour */
834 if (new_depth > 8) {
835 SDL_memset(F30_palette, 0, sizeof(F30_palette));
836 VsetRGB(0,256,F30_palette);
837 }
838 break;
839 }
840
841 Vsync();
842#endif
843
844 this->UpdateRects = XBIOS_UpdateRects;
845
846 return (current);
847}
848
849/* We don't actually allow hardware surfaces other than the main one */
850static int XBIOS_AllocHWSurface(_THIS, SDL_Surface *surface)
851{
852 return(-1);
853}
854
855static void XBIOS_FreeHWSurface(_THIS, SDL_Surface *surface)
856{
857 return;
858}
859
860static int XBIOS_LockHWSurface(_THIS, SDL_Surface *surface)
861{
862 return(0);
863}
864
865static void XBIOS_UnlockHWSurface(_THIS, SDL_Surface *surface)
866{
867 return;
868}
869
870static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
871{
872 SDL_Surface *surface;
873
874 surface = this->screen;
875
876 if (XBIOS_current->flags & XBIOSMODE_C2P) {
877 int i;
878 int doubleline = (XBIOS_current->flags & XBIOSMODE_DOUBLELINE ? 1 : 0);
879
880 for (i=0;i<numrects;i++) {
881 void *source,*destination;
882 int x1,x2;
883
884 x1 = rects[i].x & ~15;
885 x2 = rects[i].x+rects[i].w;
886 if (x2 & 15) {
887 x2 = (x2 | 15) +1;
888 }
889
890 source = surface->pixels;
891 source += surface->pitch * rects[i].y;
892 source += x1;
893
894 destination = XBIOS_screens[XBIOS_fbnum];
895 destination += XBIOS_pitch * rects[i].y;
896 destination += x1;
897
898 /* Convert chunky to planar screen */
899 SDL_Atari_C2pConvert(
900 source,
901 destination,
902 x2-x1,
903 rects[i].h,
904 doubleline,
905 surface->pitch,
906 XBIOS_pitch
907 );
908 }
909 }
910
911#ifndef DEBUG_VIDEO_XBIOS
912 if ((XBIOS_cvdo>>16) == VDO_MILAN) {
913 VsetScreen(-1, XBIOS_screens[XBIOS_fbnum], MI_MAGIC, CMD_SETADR);
914 } else {
915 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
916 }
917
918 Vsync();
919#endif
920
921 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
922 XBIOS_fbnum ^= 1;
923 if ((XBIOS_current->flags & XBIOSMODE_C2P) == 0) {
924 surface->pixels=XBIOS_screens[XBIOS_fbnum];
925 }
926 }
927}
928
929static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface)
930{
931 if (XBIOS_current->flags & XBIOSMODE_C2P) {
932 void *destscr;
933 int destx;
934 int doubleline = (XBIOS_current->flags & XBIOSMODE_DOUBLELINE ? 1 : 0);
935
936 /* Center on destination screen */
937 destscr = XBIOS_screens[XBIOS_fbnum];
938 destscr += XBIOS_pitch * ((XBIOS_current->height - surface->h) >> 1);
939 destx = (XBIOS_current->width - surface->w) >> 1;
940 destx &= ~15;
941 destscr += destx;
942
943 /* Convert chunky to planar screen */
944 SDL_Atari_C2pConvert(
945 surface->pixels,
946 destscr,
947 surface->w,
948 surface->h,
949 doubleline,
950 surface->pitch,
951 XBIOS_pitch
952 );
953 }
954
955#ifndef DEBUG_VIDEO_XBIOS
956 if ((XBIOS_cvdo>>16) == VDO_MILAN) {
957 VsetScreen(-1, XBIOS_screens[XBIOS_fbnum], MI_MAGIC, CMD_SETADR);
958 } else {
959 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1);
960 }
961
962 Vsync();
963#endif
964
965 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) {
966 XBIOS_fbnum ^= 1;
967 if ((XBIOS_current->flags & XBIOSMODE_C2P) == 0) {
968 surface->pixels=XBIOS_screens[XBIOS_fbnum];
969 }
970 }
971
972 return(0);
973}
974
975static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)
976{
977#ifndef DEBUG_VIDEO_XBIOS
978 int i;
979 int r,v,b;
980
981 switch( XBIOS_cvdo >> 16) {
982 case VDO_ST:
983 case VDO_STE:
984 for (i=0;i<ncolors;i++)
985 {
986 r = colors[i].r;
987 v = colors[i].g;
988 b = colors[i].b;
989
990 TT_palette[firstcolor+i]=((r*30)+(v*59)+(b*11))/100;
991 }
992 SDL_Atari_C2pConvert4_pal(TT_palette); /* convert the lighting */
993 break;
994 case VDO_TT:
995 for(i = 0; i < ncolors; i++)
996 {
997 r = colors[i].r;
998 v = colors[i].g;
999 b = colors[i].b;
1000
1001 TT_palette[i]=((r>>4)<<8)|((v>>4)<<4)|(b>>4);
1002 }
1003 EsetPalette(firstcolor,ncolors,TT_palette);
1004 break;
1005 case VDO_F30:
1006 case VDO_MILAN:
1007 for(i = 0; i < ncolors; i++)
1008 {
1009 r = colors[i].r;
1010 v = colors[i].g;
1011 b = colors[i].b;
1012
1013 F30_palette[i]=(r<<16)|(v<<8)|b;
1014 }
1015 VsetRGB(firstcolor,ncolors,F30_palette);
1016 break;
1017 }
1018#endif
1019
1020 return(1);
1021}
1022
1023/* Note: If we are terminated, this could be called in the middle of
1024 another SDL video routine -- notably UpdateRects.
1025*/
1026static void XBIOS_VideoQuit(_THIS)
1027{
1028 int i,j;
1029
1030 Atari_ShutdownEvents();
1031
1032 /* Restore video mode and palette */
1033#ifndef DEBUG_VIDEO_XBIOS
1034 switch(XBIOS_cvdo >> 16) {
1035 case VDO_ST:
1036 case VDO_STE:
1037 Setscreen(-1,XBIOS_oldvbase,XBIOS_oldvmode);
1038 if (XBIOS_oldnumcol) {
1039 Setpalette(XBIOS_oldpalette);
1040 }
1041 break;
1042 case VDO_TT:
1043 Setscreen(-1,XBIOS_oldvbase,-1);
1044 EsetShift(XBIOS_oldvmode);
1045 if (XBIOS_oldnumcol) {
1046 EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette);
1047 }
1048 break;
1049 case VDO_F30:
1050 Setscreen(-1, XBIOS_oldvbase, -1);
1051 if (XBIOS_centscreen) {
1052 SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode);
1053 } else {
1054 VsetMode(XBIOS_oldvmode);
1055 }
1056 if (XBIOS_oldnumcol) {
1057 VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
1058 }
1059 break;
1060 case VDO_MILAN:
1061 VsetScreen(-1, &XBIOS_oldvbase, MI_MAGIC, CMD_SETADR);
1062 VsetScreen(-1, &XBIOS_oldvmode, MI_MAGIC, CMD_SETMODE);
1063 if (XBIOS_oldnumcol) {
1064 VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette);
1065 }
1066 break;
1067 }
1068 Vsync();
1069#endif
1070
1071#if SDL_VIDEO_OPENGL
1072 if (gl_active) {
1073 SDL_AtariGL_Quit(this, SDL_TRUE);
1074 }
1075#endif
1076
1077 if (XBIOS_oldpalette) {
1078 SDL_free(XBIOS_oldpalette);
1079 XBIOS_oldpalette=NULL;
1080 }
1081 XBIOS_FreeBuffers(this);
1082
1083 /* Free mode list */
1084 for ( i=0; i<NUM_MODELISTS; ++i ) {
1085 if ( SDL_modelist[i] != NULL ) {
1086 for ( j=0; SDL_modelist[i][j]; ++j )
1087 SDL_free(SDL_modelist[i][j]);
1088 SDL_free(SDL_modelist[i]);
1089 SDL_modelist[i] = NULL;
1090 }
1091 if ( SDL_xbiosmode[i] != NULL ) {
1092 for ( j=0; SDL_xbiosmode[i][j]; ++j )
1093 SDL_free(SDL_xbiosmode[i][j]);
1094 SDL_free(SDL_xbiosmode[i]);
1095 SDL_xbiosmode[i] = NULL;
1096 }
1097 }
1098
1099 this->screen->pixels = NULL;
1100
1101 /* Restore screensavers */
1102 if (SDL_XBIOS_TveillePresent(this)) {
1103 SDL_XBIOS_TveilleEnable(this);
1104 }
1105}
1106
1107#if SDL_VIDEO_OPENGL
1108
1109static void XBIOS_GL_SwapBuffers(_THIS)
1110{
1111 SDL_AtariGL_SwapBuffers(this);
1112 XBIOS_FlipHWSurface(this, this->screen);
1113 SDL_AtariGL_MakeCurrent(this);
1114}
1115
1116#endif
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios.h
deleted file mode 100644
index 3ad6827153..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios.h
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 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 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21*/
22#include "SDL_config.h"
23
24#ifndef _SDL_xbios_h
25#define _SDL_xbios_h
26
27#include "SDL_stdinc.h"
28#include "../SDL_sysvideo.h"
29
30/* Hidden "this" pointer for the video functions */
31#define _THIS SDL_VideoDevice *this
32
33#define XBIOSMODE_DOUBLELINE (1<<0)
34#define XBIOSMODE_C2P (1<<1)
35
36typedef struct
37{
38 Uint16 number; /* Video mode number */
39 Uint16 width; /* Size */
40 Uint16 height;
41 Uint16 depth; /* bits per plane */
42 Uint16 flags;
43} xbiosmode_t;
44
45/* Private display data */
46#define NUM_MODELISTS 4 /* 8, 16, 24, and 32 bits-per-pixel */
47
48struct SDL_PrivateVideoData {
49 long cookie_vdo;
50 long old_video_mode; /* Old video mode before entering SDL */
51 void *old_video_base; /* Old pointer to screen buffer */
52 void *old_palette; /* Old palette */
53 Uint32 old_num_colors; /* Nb of colors in saved palette */
54
55 void *screens[2]; /* Pointers to aligned screen buffer */
56 void *screensmem[2]; /* Pointers to screen buffer */
57 void *shadowscreen; /* Shadow screen for c2p conversion */
58 int frame_number; /* Number of frame for double buffer */
59 int pitch; /* Destination line width for C2P */
60
61 SDL_bool centscreen; /* Centscreen extension present ? */
62
63 xbiosmode_t *current; /* Current set mode */
64 int SDL_nummodes[NUM_MODELISTS];
65 SDL_Rect **SDL_modelist[NUM_MODELISTS];
66 xbiosmode_t **SDL_xbiosmode[NUM_MODELISTS];
67};
68
69/* _VDO cookie values */
70enum {
71 VDO_ST=0,
72 VDO_STE,
73 VDO_TT,
74 VDO_F30,
75 VDO_MILAN
76};
77
78/* Monitor types */
79enum {
80 MONITOR_MONO=0,
81 MONITOR_TV,
82 MONITOR_VGA,
83 MONITOR_RGB
84};
85
86/* EgetShift masks */
87#define ES_MODE 0x0700
88
89/* Hidden structure -> variables names */
90#define SDL_nummodes (this->hidden->SDL_nummodes)
91#define SDL_modelist (this->hidden->SDL_modelist)
92#define SDL_xbiosmode (this->hidden->SDL_xbiosmode)
93#define XBIOS_mutex (this->hidden->mutex)
94#define XBIOS_cvdo (this->hidden->cookie_vdo)
95#define XBIOS_oldpalette (this->hidden->old_palette)
96#define XBIOS_oldnumcol (this->hidden->old_num_colors)
97#define XBIOS_oldvbase (this->hidden->old_video_base)
98#define XBIOS_oldvmode (this->hidden->old_video_mode)
99#define XBIOS_screens (this->hidden->screens)
100#define XBIOS_screensmem (this->hidden->screensmem)
101#define XBIOS_shadowscreen (this->hidden->shadowscreen)
102#define XBIOS_fbnum (this->hidden->frame_number)
103#define XBIOS_pitch (this->hidden->pitch)
104#define XBIOS_centscreen (this->hidden->centscreen)
105#define XBIOS_current (this->hidden->current)
106
107/*--- Functions prototypes ---*/
108
109void SDL_XBIOS_AddMode(_THIS, int actually_add, const xbiosmode_t *modeinfo);
110
111#endif /* _SDL_xbios_h */
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.c
deleted file mode 100644
index 2950b84f17..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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
35void 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}
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.h
deleted file mode 100644
index 09a3651bdc..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_blowup.h
+++ /dev/null
@@ -1,86 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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#ifndef _SDL_xbios_blowup_h
31#define _SDL_xbios_blowup_h
32
33#include "SDL_xbios.h"
34
35/*--- Types ---*/
36
37typedef struct {
38 /* 64 bytes */
39 unsigned short enabled; /* Extended mode enabled ? 0=yes, <>0=no */
40 unsigned short dummy10[6];
41 unsigned short registers_0E; /* value for register 0xffff820e */
42 unsigned short registers_10; /* value for register 0xffff8210 */
43 unsigned short dummy11[23];
44
45 /* 64 bytes */
46 unsigned short width; /* width-1 */
47 unsigned short height; /* height-1 */
48 unsigned short dummy20;
49 unsigned long screensize; /* screensize in bytes */
50 unsigned short dummy21[8];
51 unsigned short virtual; /* Virtual screen ? */
52 unsigned short virwidth; /* Virtual screen width */
53 unsigned short virheight; /* Virtual screen height */
54
55 unsigned short dummy22;
56 unsigned short monitor; /* Monitor defined for this mode */
57 unsigned short extension; /* Extended mode defined ? 0=yes, 1=no */
58 unsigned short dummy23[13];
59
60 /* 64 bytes */
61 unsigned short dummy30;
62 unsigned short registers_82[6]; /* values for registers 0xffff8282-8c */
63 unsigned short dummy31[9];
64
65 unsigned short dummy32;
66 unsigned short registers_A2[6]; /* values for registers 0xffff82a2-ac */
67 unsigned short dummy33[9];
68
69 /* 64 bytes */
70 unsigned short registers_C0; /* value for register 0xffff82c0 */
71 unsigned short registers_C2; /* value for register 0xffff82c2 */
72 unsigned short dummy40[30];
73} blow_mode_t;
74
75typedef struct {
76 blow_mode_t blowup_modes[10];
77 unsigned char num_mode[6];
78 unsigned long dummy;
79 unsigned short montype;
80} blow_cookie_t;
81
82/*--- Functions prototypes ---*/
83
84void SDL_XBIOS_ListBlowupModes(_THIS, int actually_add, blow_cookie_t *cookie_blow);
85
86#endif /* _SDL_xbios_blowup_h */
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.c
deleted file mode 100644
index 6daade2e5e..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Centscreen extension definitions
26
27 Patrice Mandin
28*/
29
30#include <mint/falcon.h>
31
32#include "SDL_xbios.h"
33#include "SDL_xbios_centscreen.h"
34
35int SDL_XBIOS_ListCentscreenModes(_THIS, int actually_add)
36{
37 centscreen_mode_t curmode, listedmode;
38 unsigned long result;
39 int cur_handle; /* Current Centscreen mode handle */
40
41 /* Add Centscreen modes */
42 Vread(&curmode);
43 cur_handle = curmode.handle;
44 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
45 curmode.logx = curmode.logy = -1;
46
47 result = Vfirst(&curmode, &listedmode);
48 if (result==0) {
49 while (result==0) {
50 /* Don't add modes with virtual screen */
51 if ((listedmode.mode & CSCREEN_VIRTUAL)==0) {
52 /* Don't add modes with bpp<8 */
53 if (listedmode.plan>=8) {
54 xbiosmode_t modeinfo;
55
56 modeinfo.number = listedmode.mode;
57 modeinfo.width = listedmode.physx;
58 modeinfo.height = listedmode.physy;
59 modeinfo.depth = listedmode.plan;
60 modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0);
61
62 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
63 }
64 }
65 SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t));
66 curmode.mode = curmode.physx = curmode.physy = curmode.plan =
67 curmode.logx = curmode.logy = -1;
68 result = Vnext(&curmode, &listedmode);
69 }
70 } else {
71 fprintf(stderr, "No suitable Centscreen modes\n");
72 }
73
74 return cur_handle;
75}
76
77void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes)
78{
79 centscreen_mode_t newmode, curmode;
80
81 newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1;
82 newmode.physx = width;
83 newmode.physy = height;
84 newmode.plan = planes;
85 Vwrite(0, &newmode, &curmode);
86
87#ifdef SDL_VIDEO_DISABLE_SCREENSAVER
88 /* Disable screensaver */
89 Vread(&newmode);
90 newmode.mode &= ~(CSCREEN_SAVER|CSCREEN_ENERGYSTAR);
91 Vwrite(0, &newmode, &curmode);
92#endif /* SDL_VIDEO_DISABLE_SCREENSAVER */
93}
94
95void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle)
96{
97 centscreen_mode_t newmode, curmode;
98
99 /* Restore old video mode */
100 newmode.handle = prev_handle;
101 newmode.mode = newmode.physx = newmode.physy = newmode.plan =
102 newmode.logx = newmode.logy = -1;
103 Vwrite(0, &newmode, &curmode);
104}
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.h
deleted file mode 100644
index dfe88d9ea3..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_centscreen.h
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Centscreen extension definitions
26
27 Patrice Mandin
28*/
29
30#ifndef _SDL_xbios_centscreen_h
31#define _SDL_xbios_centscreen_h
32
33#include <mint/falcon.h> /* for trap_14_xxx macros */
34
35#include "SDL_xbios.h"
36
37/*--- Defines ---*/
38
39#define CSCREEN_ENERGYSTAR (1<<9)
40#define CSCREEN_SAVER (1<<10)
41#define CSCREEN_VIRTUAL (1<<11)
42#define CSCREEN_EXTCLOCK_CT2 (1<<12)
43#define CSCREEN_EXTCLOCK (1<<13)
44#define CSCREEN_STANDARD (1<<14)
45#define CSCREEN_DEFAULT (1<<15)
46
47/*--- Structures ---*/
48
49typedef struct {
50 unsigned short handle; /* videomode handle */
51 unsigned short mode; /* Falcon videomode code */
52 unsigned short physx; /* visible width */
53 unsigned short physy; /* visible height */
54 unsigned short plan; /* bitplanes */
55 unsigned short logx; /* virtual width */
56 unsigned short logy; /* virtual height */
57 unsigned short eco; /* screen saver delay */
58 unsigned short eco2; /* energy star screen saver delay */
59 unsigned short wsize; /* screen width (mm) */
60 unsigned short hsize; /* screen height (mm) */
61 unsigned short dummy[21];
62 unsigned char name[32]; /* videomode name */
63} centscreen_mode_t;
64
65/*--- Functions prototypes ---*/
66
67#define Vread(current_mode) \
68 (void)trap_14_wl((short)0x41,(long)(current_mode))
69#define Vwrite(init_vdi, inparam, outparam) \
70 (long)trap_14_wwll((short)0x42,(short)(init_vdi),(long)(inparam),(long)(outparam))
71#define Vattrib(inparam, outparam) \
72 (void)trap_14_wll((short)0x43,(long)(inparam),(long)(outparam))
73#define Vcreate(inparam, outparam) \
74 (void)trap_14_wll((short)0x44,(long)(inparam),(long)(outparam))
75#define Vdelete(handle) \
76 (long)trap_14_ww((short)0x45,(short)(handle))
77#define Vfirst(mask,mode) \
78 (long)trap_14_wll((short)0x46,(long)(mask),(long)(mode))
79#define Vnext(mask,mode) \
80 (long)trap_14_wll((short)0x47,(long)(mask),(long)(mode))
81#define Vvalid(handle) \
82 (long)trap_14_ww((short)0x48,(short)(handle))
83#define Vload() \
84 (long)trap_14_w((short)0x49)
85#define Vsave() \
86 (long)trap_14_w((short)0x4a)
87#define Vopen() \
88 (long)trap_14_w((short)0x4b)
89#define Vclose() \
90 (long)trap_14_w((short)0x4c)
91#define Vscroll(scrollmode) \
92 (long)trap_14_ww((short)0x4d,(short)(scrollmode))
93#define Voffset() \
94 (long)trap_14_w((short)0x4e)
95#define Vseek() \
96 (long)trap_14_w((short)0x4f)
97#define Vlock(cmd) \
98 (long)trap_14_ww((short)0x50,(short)(cmd))
99#define SetMon(montype) \
100 (long)trap_14_ww((short)0x51,(short)(montype))
101#define MultiMon(cmd) \
102 (long)trap_14_ww((short)0x52,(short)(cmd))
103#define VSizeComp() \
104 (long)trap_14_w((short)0x53)
105#define Vsize(mode) \
106 (long)trap_14_wl((short)0x54,(long)(mode))
107
108/*--- Functions prototypes ---*/
109
110int SDL_XBIOS_ListCentscreenModes(_THIS, int actually_add);
111void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes);
112void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle);
113
114#endif /* _SDL_xbios_centscreen_h */
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
deleted file mode 100644
index a99ee18c5b..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Milan Xbios video functions
26
27 Patrice Mandin
28*/
29
30#include <mint/cookie.h>
31#include <mint/falcon.h>
32
33#include "SDL_xbios.h"
34#include "SDL_xbios_milan.h"
35
36#define NUM_PREDEFINED_MODES 7
37
38typedef struct {
39 Uint16 width, height;
40} predefined_mode_t;
41
42static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={
43 {640,400},
44 {640,480},
45 {800,608},
46 {1024,768},
47 {1152,864},
48 {1280,1024},
49 {1600,1200}
50};
51
52static const Uint8 mode_bpp[4]={
53 8, 15, 16, 32
54};
55
56/*--- Variables ---*/
57
58static int enum_actually_add;
59static SDL_VideoDevice *enum_this;
60
61/*--- Functions ---*/
62
63static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag)
64{
65 xbiosmode_t modeinfo;
66
67 modeinfo.number = inf->devID;
68 modeinfo.width = inf->scrWidth;
69 modeinfo.height = inf->scrHeight;
70 modeinfo.depth = inf->scrPlanes;
71 modeinfo.flags = 0;
72
73 SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo);
74
75 return ENUMMODE_CONT;
76}
77
78void SDL_XBIOS_ListMilanModes(_THIS, int actually_add)
79{
80 int i;
81
82 /* Read validated predefined modes */
83 for (i=0; i<NUM_PREDEFINED_MODES; i++) {
84 int j;
85 Uint16 deviceid = 0x1000 + (i<<4);
86
87 for (j=1; j<4; j++) {
88 if (Validmode(deviceid + j)) {
89 xbiosmode_t modeinfo;
90
91 modeinfo.number = deviceid + j;
92 modeinfo.width = mode_list[i].width;
93 modeinfo.height = mode_list[i].height;
94 modeinfo.depth = mode_bpp[j-1];
95 modeinfo.flags = 0;
96
97 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
98 }
99 }
100 }
101
102 /* Read custom created modes */
103 enum_this = this;
104 enum_actually_add = actually_add;
105 VsetScreen(-1, &enumfunc, MI_MAGIC, CMD_ENUMMODES);
106}
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.h
deleted file mode 100644
index bcf5c8a5bd..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_milan.h
+++ /dev/null
@@ -1,129 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Milan Xbios video functions
26
27 Patrice Mandin
28*/
29
30#ifndef _SDL_xbios_milan_h
31#define _SDL_xbios_milan_h
32
33#include "SDL_xbios.h"
34
35/*--- Defines ---*/
36
37/* Vsetscreen() parameters */
38#define MI_MAGIC 0x4D49
39
40enum {
41 CMD_GETMODE=0,
42 CMD_SETMODE,
43 CMD_GETINFO,
44 CMD_ALLOCPAGE,
45 CMD_FREEPAGE,
46 CMD_FLIPPAGE,
47 CMD_ALLOCMEM,
48 CMD_FREEMEM,
49 CMD_SETADR,
50 CMD_ENUMMODES
51};
52
53enum {
54 ENUMMODE_EXIT=0,
55 ENUMMODE_CONT
56};
57
58enum {
59 BLK_ERR=0,
60 BLK_OK,
61 BLK_CLEARED
62};
63
64/* scrFlags */
65#define SCRINFO_OK 1
66
67/* scrClut */
68#define NO_CLUT 0
69#define HARD_CLUT 1
70#define SOFT_CLUT 2
71
72/* scrFormat */
73#define INTERLEAVE_PLANES 0
74#define STANDARD_PLANES 1
75#define PACKEDPIX_PLANES 2
76
77/* bitFlags */
78#define STANDARD_BITS 1
79#define FALCON_BITS 2
80#define INTEL_BITS 8
81
82/*--- Structures ---*/
83
84typedef struct _scrblk {
85 unsigned long size; /* size of strukture */
86 unsigned long blk_status; /* status bits of blk */
87 unsigned long blk_start; /* Start Adress */
88 unsigned long blk_len; /* length of memblk */
89 unsigned long blk_x; /* x pos in total screen*/
90 unsigned long blk_y; /* y pos in total screen */
91 unsigned long blk_w; /* width */
92 unsigned long blk_h; /* height */
93 unsigned long blk_wrap; /* width in bytes */
94} SCRMEMBLK;
95
96typedef struct screeninfo {
97 unsigned long size; /* Size of structure */
98 unsigned long devID; /* device id number */
99 unsigned char name[64]; /* Friendly name of Screen */
100 unsigned long scrFlags; /* some Flags */
101 unsigned long frameadr; /* Adress of framebuffer */
102 unsigned long scrHeight; /* visible X res */
103 unsigned long scrWidth; /* visible Y res */
104 unsigned long virtHeight; /* virtual X res */
105 unsigned long virtWidth; /* virtual Y res */
106 unsigned long scrPlanes; /* color Planes */
107 unsigned long scrColors; /* # of colors */
108 unsigned long lineWrap; /* # of Bytes to next line */
109 unsigned long planeWarp; /* # of Bytes to next plane */
110 unsigned long scrFormat; /* screen Format */
111 unsigned long scrClut; /* type of clut */
112 unsigned long redBits; /* Mask of Red Bits */
113 unsigned long greenBits; /* Mask of Green Bits */
114 unsigned long blueBits; /* Mask of Blue Bits */
115 unsigned long alphaBits; /* Mask of Alpha Bits */
116 unsigned long genlockBits;/* Mask of Genlock Bits */
117 unsigned long unusedBits; /* Mask of unused Bits */
118 unsigned long bitFlags; /* Bits organisation flags */
119 unsigned long maxmem; /* max. memory in this mode */
120 unsigned long pagemem; /* needed memory for one page */
121 unsigned long max_x; /* max. possible width */
122 unsigned long max_y; /* max. possible heigth */
123} SCREENINFO;
124
125/*--- Functions prototypes ---*/
126
127void SDL_XBIOS_ListMilanModes(_THIS, int actually_add);
128
129#endif /* _SDL_xbios_milan_h */
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.c
deleted file mode 100644
index 8b0ed2c629..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 ScreenBlaster 3 functions
26
27 Patrice Mandin
28*/
29
30/*--- Includes ---*/
31
32#include "SDL_stdinc.h"
33#include "SDL_xbios.h"
34#include "SDL_xbios_sb3.h"
35
36/*--- Defines ---*/
37
38const int SDL_XBIOS_scpn_planes_device[]={
39 SCPN_DEV_1BPP,
40 SCPN_DEV_4BPP,
41 SCPN_DEV_8BPP,
42 SCPN_DEV_16BPP,
43 SCPN_DEV_2BPP,
44 SCPN_DEV_4BPP,
45 SCPN_DEV_1BPP
46};
47
48/*--- Functions ---*/
49
50int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn)
51{
52 scpn_screeninfo_t *scrinfo;
53 int bpp;
54
55 /* Check if current SB3 mode is usable, i.e. 8 or 16bpp */
56 scrinfo = cookie_scpn->screen_info;
57 bpp = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
58
59 if ((bpp==8) || (bpp==16)) {
60 return 1;
61 }
62
63 return 0;
64}
65
66void SDL_XBIOS_ListSB3Modes(_THIS, int actually_add, scpn_cookie_t *cookie_scpn)
67{
68 scpn_screeninfo_t *scrinfo;
69 xbiosmode_t modeinfo;
70
71 scrinfo = cookie_scpn->screen_info;
72 if (actually_add) {
73 scrinfo->h_pos = scrinfo->v_pos = 0;
74 }
75
76 modeinfo.number = -1;
77 modeinfo.width = scrinfo->virtual_width;
78 modeinfo.height = scrinfo->virtual_height;
79 modeinfo.depth = 1<<(SDL_XBIOS_scpn_planes_device[scrinfo->device]);
80 modeinfo.flags = (modeinfo.depth == 8 ? XBIOSMODE_C2P : 0);
81
82 SDL_XBIOS_AddMode(this, actually_add, &modeinfo);
83}
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.h
deleted file mode 100644
index 3272c31349..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_sb3.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 ScreenBlaster 3 definitions
26
27 Patrice Mandin
28*/
29
30#ifndef _SDL_xbios_sb3_h_
31#define _SDL_xbios_sb3_h_
32
33/*--- Defines ---*/
34
35#ifndef C_SCPN
36#define C_SCPN 0x5343504EL
37#endif
38
39#define SCPN_DEV_1BPP 0
40#define SCPN_DEV_2BPP 1
41#define SCPN_DEV_4BPP 2
42#define SCPN_DEV_8BPP 3
43#define SCPN_DEV_16BPP 4
44
45extern const int SDL_XBIOS_scpn_planes_device[];
46
47/*--- Types ---*/
48
49typedef struct {
50 unsigned short virtual_width; /* Virtual screen width */
51 unsigned short virtual_height; /* Virtual screen height */
52 unsigned short visible_width; /* Visible width */
53 unsigned short visible_height; /* Visible height */
54 unsigned short h_pos; /* Horizontal position in virtual screen */
55 unsigned short v_pos; /* Vertical position in virtual screen */
56 unsigned short dummy;
57 unsigned long size; /* Size of screen in bytes */
58 unsigned short device; /* Device number to find planes = getRez() */
59 /* = Index in scpn_planes_device[] */
60} scpn_screeninfo_t;
61
62typedef struct {
63 unsigned long magic; /* just a BRA assembler jump */
64 unsigned short version;
65 void *dummy1;
66 unsigned short ptsout0_1;
67 unsigned short ptsout0_2;
68 unsigned short dummy3;
69 unsigned char date[8]; /* Date of program build */
70 unsigned char asm_string[30]; /* 10 times the 'ASM' string */
71 unsigned short dummy4;
72 scpn_screeninfo_t *screen_info;
73 unsigned short dummy6;
74} scpn_cookie_t;
75
76/*--- Function prototypes ---*/
77
78int SDL_XBIOS_SB3Usable(scpn_cookie_t *cookie_scpn);
79
80void SDL_XBIOS_ListSB3Modes(_THIS, int actually_add, scpn_cookie_t *cookie_scpn);
81
82#endif /* _SDL_xbios_sb3_h_ */
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.c b/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.c
deleted file mode 100644
index b0f8499197..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.c
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Turbo veille screensaver
26
27 Patrice Mandin
28*/
29
30#include <mint/cookie.h>
31
32#include "SDL_xbios.h"
33#include "SDL_xbios_tveille.h"
34
35static tveille_t *cookie_veil = NULL;
36static int status;
37
38int SDL_XBIOS_TveillePresent(_THIS)
39{
40 long dummy;
41
42 cookie_veil = NULL;
43 if (Getcookie(C_VeiL, &dummy) == C_FOUND) {
44 cookie_veil = (tveille_t *) dummy;
45 }
46
47 return (cookie_veil != NULL);
48}
49
50void SDL_XBIOS_TveilleDisable(_THIS)
51{
52 if (cookie_veil) {
53 status = cookie_veil->enabled;
54 cookie_veil->enabled = 0xff;
55 }
56}
57
58void SDL_XBIOS_TveilleEnable(_THIS)
59{
60 if (cookie_veil) {
61 cookie_veil->enabled = status;
62 }
63}
diff --git a/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.h b/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.h
deleted file mode 100644
index 8a9cd7d46a..0000000000
--- a/apps/plugins/sdl/src/video/xbios/SDL_xbios_tveille.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2012 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 Turbo veille screensaver
26
27 Patrice Mandin
28*/
29
30#ifndef _SDL_xbios_tveille_h
31#define _SDL_xbios_tveille_h
32
33#include "SDL_xbios.h"
34
35/*--- Structures ---*/
36
37typedef struct {
38 unsigned long version;
39 void (*prg_ptr)();
40 void (*kbd_ptr)();
41 void (*vbl_ptr)();
42 unsigned long vbl_count;
43 void (*oldkbd_ptr)();
44 unsigned long off_count;
45 unsigned long prg_size;
46 unsigned long dummy1[4];
47 unsigned char dummy2;
48 unsigned char status;
49 unsigned short freq;
50 unsigned short dummy3;
51 unsigned char clear_first;
52 unsigned char enabled; /* 0=enabled, 0xff=disabled */
53 unsigned char serial_redir;
54 unsigned char dummy4;
55 void (*oldserial_ptr)();
56} tveille_t;
57
58/*--- Functions prototypes ---*/
59
60int SDL_XBIOS_TveillePresent(_THIS);
61void SDL_XBIOS_TveilleDisable(_THIS);
62void SDL_XBIOS_TveilleEnable(_THIS);
63
64#endif /* _SDL_xbios_tveille_h */