Mercurial > sdl-ios-xcode
annotate src/video/xbios/SDL_xbios.c @ 1358:c71e05b4dc2e
More header massaging... works great on Windows. ;-)
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 10 Feb 2006 06:48:43 +0000 |
parents | adc8ff3c9597 |
children | 19418e4422cb |
rev | line source |
---|---|
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
13 Lesser General Public License for more details. |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1256
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 /* |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 * Xbios SDL video driver |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 * |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 * Patrice Mandin |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #include <sys/stat.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #include <unistd.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 /* Mint includes */ |
557
0ce5a68278fd
Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
508
diff
changeset
|
33 #include <mint/cookie.h> |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 #include <mint/osbind.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 #include <mint/falcon.h> |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 #include "SDL_video.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 #include "SDL_mouse.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 #include "SDL_sysvideo.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 #include "SDL_pixels_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 #include "SDL_events_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include "SDL_ataric2p_s.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 #include "SDL_atarievents_c.h" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 #include "SDL_atarimxalloc_c.h" |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
46 #include "SDL_atarigl_c.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 #include "SDL_xbios.h" |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
48 #include "SDL_xbios_blowup.h" |
1061
5023cde12cbd
Add Falcon Centscreen extension support
Patrice Mandin <patmandin@gmail.com>
parents:
1043
diff
changeset
|
49 #include "SDL_xbios_centscreen.h" |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
50 #include "SDL_xbios_sb3.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 #define XBIOS_VID_DRIVER_NAME "xbios" |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
54 /* Debug print info */ |
1043 | 55 #if 0 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
56 #define DEBUG_PRINT(what) \ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
57 { \ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
58 printf what; \ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
59 } |
1043 | 60 #define DEBUG_VIDEO_XBIOS 1 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
61 #else |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
62 #define DEBUG_PRINT(what) |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
63 #undef DEBUG_VIDEO_XBIOS |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
64 #endif |
735 | 65 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 /* Initialization/Query functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 static void XBIOS_VideoQuit(_THIS); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 /* Hardware surface functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 static int XBIOS_AllocHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 static int XBIOS_LockHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 static void XBIOS_UnlockHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 static void XBIOS_FreeHWSurface(_THIS, SDL_Surface *surface); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
81 #ifdef HAVE_OPENGL |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
82 /* OpenGL functions */ |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
83 static void XBIOS_GL_SwapBuffers(_THIS); |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
84 #endif |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
85 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 /* To setup palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 static unsigned short TT_palette[256]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 static unsigned long F30_palette[256]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 /* Xbios driver bootstrap functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 static int XBIOS_Available(void) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 { |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
95 unsigned long cookie_vdo, cookie_mil, cookie_hade, cookie_scpn; |
797
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
96 |
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
97 /* Milan/Hades Atari clones do not have an Atari video chip */ |
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
98 if ( (Getcookie(C__MIL, &cookie_mil) == C_FOUND) || |
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
99 (Getcookie(C_hade, &cookie_hade) == C_FOUND) ) { |
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
100 return 0; |
d0f1e34290d6
Milan and Hades Atari clones do not have an Atari video chip
Patrice Mandin <patmandin@gmail.com>
parents:
769
diff
changeset
|
101 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 /* Cookie _VDO present ? if not, assume ST machine */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 if (Getcookie(C__VDO, &cookie_vdo) != C_FOUND) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 cookie_vdo = VDO_ST << 16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 /* Test if we have a monochrome monitor plugged in */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 switch( cookie_vdo >>16) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 case VDO_ST: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 case VDO_STE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 if ( Getrez() == (ST_HIGH>>8) ) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 return 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 case VDO_TT: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 if ( (EgetShift() & ES_MODE) == TT_HIGH) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 return 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 case VDO_F30: |
1322
a4566d07718f
Update for mintlib 0.57.6 (m68k-atari-mint libc)
Patrice Mandin <patmandin@gmail.com>
parents:
1312
diff
changeset
|
120 if ( VgetMonitor() == MONITOR_MONO) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 return 0; |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
122 if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) { |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
123 if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *)cookie_scpn)) { |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
124 return 0; |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
125 } |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
126 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 default: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 return 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 return 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 static void XBIOS_DeleteDevice(SDL_VideoDevice *device) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
137 SDL_free(device->hidden); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
138 SDL_free(device); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 static SDL_VideoDevice *XBIOS_CreateDevice(int devindex) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 SDL_VideoDevice *device; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 /* Initialize all variables that we clean on shutdown */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
146 device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 if ( device ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
148 SDL_memset(device, 0, (sizeof *device)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 device->hidden = (struct SDL_PrivateVideoData *) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
150 SDL_malloc((sizeof *device->hidden)); |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
151 device->gl_data = (struct SDL_PrivateGLData *) |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
152 SDL_malloc((sizeof *device->gl_data)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 if ( (device == NULL) || (device->hidden == NULL) ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 SDL_OutOfMemory(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 if ( device ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
157 SDL_free(device); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
161 SDL_memset(device->hidden, 0, (sizeof *device->hidden)); |
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
162 SDL_memset(device->gl_data, 0, sizeof(*device->gl_data)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 /* Video functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 device->VideoInit = XBIOS_VideoInit; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 device->ListModes = XBIOS_ListModes; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 device->SetVideoMode = XBIOS_SetVideoMode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 device->SetColors = XBIOS_SetColors; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 device->UpdateRects = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 device->VideoQuit = XBIOS_VideoQuit; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 device->AllocHWSurface = XBIOS_AllocHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 device->LockHWSurface = XBIOS_LockHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 device->UnlockHWSurface = XBIOS_UnlockHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 device->FlipHWSurface = XBIOS_FlipHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 device->FreeHWSurface = XBIOS_FreeHWSurface; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
177 #ifdef HAVE_OPENGL |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
178 /* OpenGL functions */ |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
179 device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary; |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
180 device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress; |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
181 device->GL_GetAttribute = SDL_AtariGL_GetAttribute; |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
182 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent; |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
183 device->GL_SwapBuffers = XBIOS_GL_SwapBuffers; |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
184 #endif |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
185 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 /* Events */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 device->InitOSKeymap = Atari_InitOSKeymap; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 device->PumpEvents = Atari_PumpEvents; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 device->free = XBIOS_DeleteDevice; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 return device; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 VideoBootStrap XBIOS_bootstrap = { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 XBIOS_VID_DRIVER_NAME, "Atari Xbios driver", |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 XBIOS_Available, XBIOS_CreateDevice |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 }; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
200 void SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
201 Uint16 depth, SDL_bool flags) |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
202 { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
203 int i, curpos; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
204 xbiosmode_t *current_mode; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
205 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
206 /* Check if mode already exists */ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
207 if (XBIOS_modelist) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
208 current_mode = XBIOS_modelist; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
209 for (i=0;i<XBIOS_nummodes; i++, current_mode++) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
210 if (current_mode->width != width) |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
211 continue; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
212 if (current_mode->height != height) |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
213 continue; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
214 if (current_mode->depth != depth) |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
215 continue; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
216 return; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
217 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
218 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
219 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
220 ++XBIOS_nummodes; |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
221 XBIOS_modelist = (xbiosmode_t *) SDL_realloc(XBIOS_modelist, XBIOS_nummodes * sizeof(xbiosmode_t)); |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
222 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
223 /* Keep the list sorted: bpp, width, height */ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
224 curpos=0; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
225 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
226 for(i=0; i<XBIOS_nummodes-1; i++) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
227 if (XBIOS_modelist[i].depth <= depth) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
228 if (XBIOS_modelist[i].width < width) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
229 break; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
230 } else if (XBIOS_modelist[i].width == width) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
231 if (XBIOS_modelist[i].height <= height) { |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
232 break; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
233 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
234 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
235 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
236 curpos++; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
237 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
238 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
239 /* Push remaining modes further */ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
240 for(i=XBIOS_nummodes-1; i>curpos; i--) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
241 SDL_memcpy(&XBIOS_modelist[i], &XBIOS_modelist[i-1], sizeof(xbiosmode_t)); |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
242 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
243 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
244 XBIOS_modelist[curpos].number = modecode; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
245 XBIOS_modelist[curpos].width = width; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
246 XBIOS_modelist[curpos].height = height; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
247 XBIOS_modelist[curpos].depth = depth; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
248 XBIOS_modelist[curpos].doubleline = flags; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
249 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
250 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 static int XBIOS_VideoInit(_THIS, SDL_PixelFormat *vformat) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 int i,j8,j16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 xbiosmode_t *current_mode; |
1061
5023cde12cbd
Add Falcon Centscreen extension support
Patrice Mandin <patmandin@gmail.com>
parents:
1043
diff
changeset
|
255 unsigned long cookie_blow, cookie_scpn, cookie_cnts; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 /* Initialize all variables that we clean on shutdown */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 memset (SDL_modelist, 0, sizeof(SDL_modelist)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 /* Cookie _VDO present ? if not, assume ST machine */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 if (Getcookie(C__VDO, &XBIOS_cvdo) != C_FOUND) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 XBIOS_cvdo = VDO_ST << 16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 /* Allocate memory for old palette */ |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
266 XBIOS_oldpalette = (void *)SDL_malloc(256*sizeof(long)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 if ( !XBIOS_oldpalette ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 SDL_SetError("Unable to allocate memory for old palette\n"); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 return(-1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 /* Initialize video mode list */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 /* and save current screen status (palette, screen address, video mode) */ |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
274 XBIOS_nummodes = 0; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
275 XBIOS_modelist = NULL; |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
276 XBIOS_centscreen = SDL_FALSE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 switch (XBIOS_cvdo >>16) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 case VDO_ST: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 case VDO_STE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 short *oldpalette; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
284 SDL_XBIOS_AddMode(this, ST_LOW>>8,320,200,4,SDL_FALSE); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 XBIOS_oldvbase=Physbase(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 XBIOS_oldvmode=Getrez(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 switch(XBIOS_oldvmode << 8) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 case ST_LOW: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 XBIOS_oldnumcol=16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 case ST_MED: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 XBIOS_oldnumcol=4; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 case ST_HIGH: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 XBIOS_oldnumcol=2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 default: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 XBIOS_oldnumcol=0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 oldpalette= (short *) XBIOS_oldpalette; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 for (i=0;i<XBIOS_oldnumcol;i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 *oldpalette++=Setcolor(i,-1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 vformat->BitsPerPixel = 8; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 case VDO_TT: |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
312 |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
313 SDL_XBIOS_AddMode(this, TT_LOW,320,480,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
314 /* Software double-lined mode */ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
315 SDL_XBIOS_AddMode(this, TT_LOW,320,240,8,SDL_TRUE); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 XBIOS_oldvbase=Logbase(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 XBIOS_oldvmode=EgetShift(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 switch(XBIOS_oldvmode & ES_MODE) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 case TT_LOW: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 XBIOS_oldnumcol=256; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 case ST_LOW: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 case TT_MED: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 XBIOS_oldnumcol=16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 case ST_MED: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 XBIOS_oldnumcol=4; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 case ST_HIGH: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 case TT_HIGH: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 XBIOS_oldnumcol=2; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 default: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 XBIOS_oldnumcol=0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 if (XBIOS_oldnumcol) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 EgetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 vformat->BitsPerPixel = 8; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 case VDO_F30: |
1322
a4566d07718f
Update for mintlib 0.57.6 (m68k-atari-mint libc)
Patrice Mandin <patmandin@gmail.com>
parents:
1312
diff
changeset
|
346 switch (VgetMonitor()) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 case MONITOR_MONO: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 /* Not usable */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 case MONITOR_RGB: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 case MONITOR_TV: |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
353 SDL_XBIOS_AddMode(this, BPS16|COL80|OVERSCAN|VERTFLAG,768,480,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
354 SDL_XBIOS_AddMode(this, BPS16|COL80|OVERSCAN,768,240,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
355 SDL_XBIOS_AddMode(this, BPS16|COL80|VERTFLAG,640,400,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
356 SDL_XBIOS_AddMode(this, BPS16|COL80,640,200,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
357 SDL_XBIOS_AddMode(this, BPS16|OVERSCAN|VERTFLAG,384,480,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
358 SDL_XBIOS_AddMode(this, BPS16|OVERSCAN,384,240,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
359 SDL_XBIOS_AddMode(this, BPS16|VERTFLAG,320,400,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
360 SDL_XBIOS_AddMode(this, BPS16,320,200,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
361 SDL_XBIOS_AddMode(this, BPS8|COL80|OVERSCAN|VERTFLAG,768,480,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
362 SDL_XBIOS_AddMode(this, BPS8|COL80|OVERSCAN,768,240,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
363 SDL_XBIOS_AddMode(this, BPS8|COL80|VERTFLAG,640,400,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
364 SDL_XBIOS_AddMode(this, BPS8|COL80,640,200,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
365 SDL_XBIOS_AddMode(this, BPS8|OVERSCAN|VERTFLAG,384,480,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
366 SDL_XBIOS_AddMode(this, BPS8|OVERSCAN,384,240,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
367 SDL_XBIOS_AddMode(this, BPS8|VERTFLAG,320,400,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
368 SDL_XBIOS_AddMode(this, BPS8,320,200,8,SDL_FALSE); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 case MONITOR_VGA: |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
371 SDL_XBIOS_AddMode(this, BPS16,320,480,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
372 SDL_XBIOS_AddMode(this, BPS16|VERTFLAG,320,240,16,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
373 SDL_XBIOS_AddMode(this, BPS8|COL80,640,480,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
374 SDL_XBIOS_AddMode(this, BPS8|COL80|VERTFLAG,640,240,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
375 SDL_XBIOS_AddMode(this, BPS8,320,480,8,SDL_FALSE); |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
376 SDL_XBIOS_AddMode(this, BPS8|VERTFLAG,320,240,8,SDL_FALSE); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 XBIOS_oldvbase=Logbase(); |
1322
a4566d07718f
Update for mintlib 0.57.6 (m68k-atari-mint libc)
Patrice Mandin <patmandin@gmail.com>
parents:
1312
diff
changeset
|
380 XBIOS_oldvmode=VsetMode(-1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 XBIOS_oldnumcol= 1<< (1 << (XBIOS_oldvmode & NUMCOLS)); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 if (XBIOS_oldnumcol > 256) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 XBIOS_oldnumcol = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 if (XBIOS_oldnumcol) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 VgetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 vformat->BitsPerPixel = 16; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 /* Keep vga/rvb, and pal/ntsc bits */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 current_mode = XBIOS_modelist; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 for (i=0;i<XBIOS_nummodes;i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 Uint16 newvmode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 newvmode = current_mode->number; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 newvmode &= ~(VGA|PAL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 newvmode |= XBIOS_oldvmode & (VGA|PAL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 current_mode->number = newvmode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 current_mode++; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
405 /* Initialize BlowUp/SB3/Centscreen stuff if present */ |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
406 if (Getcookie(C_BLOW, &cookie_blow) == C_FOUND) { |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
407 SDL_XBIOS_BlowupInit(this, (blow_cookie_t *)cookie_blow); |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
408 } else if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) { |
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
409 SDL_XBIOS_SB3Init(this, (scpn_cookie_t *)cookie_scpn); |
1061
5023cde12cbd
Add Falcon Centscreen extension support
Patrice Mandin <patmandin@gmail.com>
parents:
1043
diff
changeset
|
410 } else if (Getcookie(C_CNTS, &cookie_cnts) == C_FOUND) { |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
411 XBIOS_oldvmode = SDL_XBIOS_CentscreenInit(this); |
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
412 XBIOS_centscreen = SDL_TRUE; |
1040
c6ed27c7d47d
Preliminary support for Blowup and Screen Blaster 3 extensions on Atari Falcon 030
Patrice Mandin <patmandin@gmail.com>
parents:
993
diff
changeset
|
413 } |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
414 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 } |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
417 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 current_mode = XBIOS_modelist; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 j8 = j16 = 0; |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
420 for (i=0; i<XBIOS_nummodes; i++, current_mode++) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 switch (current_mode->depth) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 case 4: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 case 8: |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
424 SDL_modelist[0][j8] = SDL_malloc(sizeof(SDL_Rect)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 SDL_modelist[0][j8]->x = SDL_modelist[0][j8]->y = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 SDL_modelist[0][j8]->w = current_mode->width; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 SDL_modelist[0][j8]->h = current_mode->height; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 XBIOS_videomodes[0][j8]=current_mode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 j8++; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 case 16: |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
432 SDL_modelist[1][j16] = SDL_malloc(sizeof(SDL_Rect)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 SDL_modelist[1][j16]->x = SDL_modelist[1][j16]->y = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 SDL_modelist[1][j16]->w = current_mode->width; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 SDL_modelist[1][j16]->h = current_mode->height; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 XBIOS_videomodes[1][j16]=current_mode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 j16++; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 SDL_modelist[0][j8] = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 SDL_modelist[1][j16] = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
444 XBIOS_screens[0]=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 XBIOS_screens[1]=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 XBIOS_shadowscreen=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 /* Update hardware info */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 this->info.hw_available = 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 this->info.video_mem = (Uint32) Atari_SysMalloc(-1L, MX_STRAM); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
452 /* Init chunky to planar routine */ |
735 | 453 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
454 |
991
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
455 #ifdef HAVE_OPENGL |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
456 SDL_AtariGL_InitPointers(this); |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
457 #endif |
12b13601a544
Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents:
989
diff
changeset
|
458 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
459 /* We're done! */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
460 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
461 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
462 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
463 static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
464 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
465 /* 8 bits -> list 0 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
466 /* 16 bits -> list 1 */ |
712
8be92df64b22
Finally bugfixed: the simpler the better
Patrice Mandin <patmandin@gmail.com>
parents:
711
diff
changeset
|
467 if ((format->BitsPerPixel != 8) && (format->BitsPerPixel !=16)) { |
711
8db4098e944b
Severe bugfix: format->BitsPerPixel not checked in ListModes function
Patrice Mandin <patmandin@gmail.com>
parents:
598
diff
changeset
|
468 return NULL; |
8db4098e944b
Severe bugfix: format->BitsPerPixel not checked in ListModes function
Patrice Mandin <patmandin@gmail.com>
parents:
598
diff
changeset
|
469 } |
8db4098e944b
Severe bugfix: format->BitsPerPixel not checked in ListModes function
Patrice Mandin <patmandin@gmail.com>
parents:
598
diff
changeset
|
470 |
712
8be92df64b22
Finally bugfixed: the simpler the better
Patrice Mandin <patmandin@gmail.com>
parents:
711
diff
changeset
|
471 return(SDL_modelist[(format->BitsPerPixel)>>4]); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
472 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
474 static void XBIOS_FreeBuffers(_THIS) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
475 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
476 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
478 for (i=0;i<2;i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
479 if (XBIOS_screensmem[i]!=NULL) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
480 Mfree(XBIOS_screensmem[i]); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 XBIOS_screensmem[i]=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
482 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
483 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
485 if (XBIOS_shadowscreen!=NULL) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
486 Mfree(XBIOS_shadowscreen); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
487 XBIOS_shadowscreen=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
488 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
489 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
490 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
491 static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface *current, |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 int width, int height, int bpp, Uint32 flags) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
494 int mode, new_depth; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
495 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
496 xbiosmode_t *new_video_mode; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
497 Uint32 new_screen_size; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
498 Uint32 modeflags; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
499 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
500 /* Free current buffers */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
501 XBIOS_FreeBuffers(this); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
502 |
801
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
503 /* Limit bpp */ |
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
504 if (bpp>16) { |
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
505 bpp = 16; |
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
506 } |
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
507 bpp >>= 4; |
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
508 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
509 /* Search if the mode exists (width, height, bpp) */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
510 for ( mode=0; SDL_modelist[bpp][mode]; ++mode ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
511 if ( (SDL_modelist[bpp][mode]->w == width) && |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
512 (SDL_modelist[bpp][mode]->h == height) ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
513 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
514 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
515 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
516 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
517 if ( SDL_modelist[bpp][mode] == NULL ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
518 SDL_SetError("Couldn't find requested mode in list"); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
519 return(NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
520 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
521 |
1103
18e5babe266e
Tell SDL to notfree my video surfaces (Damn, no how-to write a SDL driver)
Patrice Mandin <patmandin@gmail.com>
parents:
1102
diff
changeset
|
522 modeflags = SDL_FULLSCREEN | SDL_PREALLOC; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
523 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
524 /* Allocate needed buffers: simple/double buffer and shadow surface */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
525 new_video_mode = XBIOS_videomodes[bpp][mode]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
526 new_depth = new_video_mode->depth; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
527 if (new_depth == 4) { |
735 | 528 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert4; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
529 new_depth=8; |
1085
49d154d0c56e
4bits screen also has hardware palette
Patrice Mandin <patmandin@gmail.com>
parents:
1084
diff
changeset
|
530 modeflags |= SDL_SWSURFACE|SDL_HWPALETTE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
531 } else if (new_depth == 8) { |
735 | 532 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; |
508
9ff7e90aaa94
Fixed gamma correction in Atari video drivers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
319
diff
changeset
|
533 modeflags |= SDL_SWSURFACE|SDL_HWPALETTE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 } else { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 modeflags |= SDL_HWSURFACE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 new_screen_size = width * height * ((new_depth)>>3); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 new_screen_size += 256; /* To align on a 256 byte adress */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 if (new_depth == 8) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 XBIOS_shadowscreen = Atari_SysMalloc(new_screen_size, MX_PREFTTRAM); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 if (XBIOS_shadowscreen == NULL) { |
1104
bf145eaf76ef
Tell user how many bytes are needed
Patrice Mandin <patmandin@gmail.com>
parents:
1103
diff
changeset
|
545 SDL_SetError("Can not allocate %d KB for shadow buffer", new_screen_size>>10); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 return (NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
548 SDL_memset(XBIOS_shadowscreen, 0, new_screen_size); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
549 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
550 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
551 /* Output buffer needs to be twice in size for the software double-line mode */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
552 XBIOS_doubleline = SDL_FALSE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
553 if (new_video_mode->doubleline) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
554 new_screen_size <<= 1; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
555 XBIOS_doubleline = SDL_TRUE; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
556 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
557 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
558 XBIOS_screensmem[0] = Atari_SysMalloc(new_screen_size, MX_STRAM); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
559 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
560 if (XBIOS_screensmem[0]==NULL) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
561 XBIOS_FreeBuffers(this); |
1104
bf145eaf76ef
Tell user how many bytes are needed
Patrice Mandin <patmandin@gmail.com>
parents:
1103
diff
changeset
|
562 SDL_SetError("Can not allocate %d KB for frame buffer", new_screen_size>>10); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
563 return (NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
564 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
565 SDL_memset(XBIOS_screensmem[0], 0, new_screen_size); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
566 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
567 XBIOS_screens[0]=(void *) (( (long) XBIOS_screensmem[0]+256) & 0xFFFFFF00UL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
568 |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
569 #ifdef HAVE_OPENGL |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
570 if (flags & SDL_OPENGL) { |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
571 if (this->gl_config.double_buffer) { |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
572 flags |= SDL_DOUBLEBUF; |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
573 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
574 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
575 #endif |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
576 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
577 /* Double buffer ? */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
578 if (flags & SDL_DOUBLEBUF) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 XBIOS_screensmem[1] = Atari_SysMalloc(new_screen_size, MX_STRAM); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
581 if (XBIOS_screensmem[1]==NULL) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
582 XBIOS_FreeBuffers(this); |
1104
bf145eaf76ef
Tell user how many bytes are needed
Patrice Mandin <patmandin@gmail.com>
parents:
1103
diff
changeset
|
583 SDL_SetError("Can not allocate %d KB for double buffer", new_screen_size>>10); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
584 return (NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 } |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
586 SDL_memset(XBIOS_screensmem[1], 0, new_screen_size); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
587 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
588 XBIOS_screens[1]=(void *) (( (long) XBIOS_screensmem[1]+256) & 0xFFFFFF00UL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
589 modeflags |= SDL_DOUBLEBUF; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
590 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
591 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 /* Allocate the new pixel format for the screen */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
593 if ( ! SDL_ReallocFormat(current, new_depth, 0, 0, 0, 0) ) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
594 XBIOS_FreeBuffers(this); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
595 SDL_SetError("Couldn't allocate new pixel format for requested mode"); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
596 return(NULL); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
597 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
598 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
599 current->w = XBIOS_width = width; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
600 current->h = XBIOS_height = height; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
601 current->pitch = (width * new_depth)>>3; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
603 /* this is for C2P conversion */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
604 XBIOS_pitch = (new_video_mode->width * new_video_mode->depth)>>3; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
605 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
606 if (new_depth == 8) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
607 current->pixels = XBIOS_shadowscreen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 else |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
609 current->pixels = XBIOS_screens[0]; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
610 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 XBIOS_fbnum = 0; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
612 |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
613 #ifdef HAVE_OPENGL |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
614 if (flags & SDL_OPENGL) { |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
615 if (!SDL_AtariGL_Init(this, current)) { |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
616 XBIOS_FreeBuffers(this); |
989
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
617 SDL_SetError("Can not create OpenGL context"); |
475166d13b44
Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
980
diff
changeset
|
618 return NULL; |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
619 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
620 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
621 modeflags |= SDL_OPENGL; |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
622 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
623 #endif |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
624 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
625 current->flags = modeflags; |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
626 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
627 /* Now set the video mode */ |
735 | 628 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
629 Setscreen(-1,XBIOS_screens[0],-1); |
735 | 630 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
631 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 switch(XBIOS_cvdo >> 16) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
633 case VDO_ST: |
735 | 634 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
635 Setscreen(-1,-1,new_video_mode->number); |
735 | 636 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
637 /* Reset palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
638 for (i=0;i<16;i++) { |
1085
49d154d0c56e
4bits screen also has hardware palette
Patrice Mandin <patmandin@gmail.com>
parents:
1084
diff
changeset
|
639 TT_palette[i]= ((i>>1)<<8) | (((i*8)/17)<<4) | (i>>1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
640 } |
735 | 641 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
642 Setpalette(TT_palette); |
735 | 643 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
644 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
645 case VDO_STE: |
735 | 646 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
647 Setscreen(-1,-1,new_video_mode->number); |
735 | 648 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 /* Reset palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
650 for (i=0;i<16;i++) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
651 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 int c; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
653 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
654 c=((i&1)<<3)|((i>>1)&7); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
655 TT_palette[i]=(c<<8)|(c<<4)|c; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
656 } |
735 | 657 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
658 Setpalette(TT_palette); |
735 | 659 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
661 case VDO_TT: |
735 | 662 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
663 EsetShift(new_video_mode->number); |
735 | 664 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
665 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
666 case VDO_F30: |
735 | 667 #ifndef DEBUG_VIDEO_XBIOS |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
668 if (XBIOS_centscreen) { |
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
669 SDL_XBIOS_CentscreenSetmode(this, width, height, new_depth); |
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
670 } else { |
1350
adc8ff3c9597
Fixes for new SDL embedded libc stuff
Patrice Mandin <patmandin@gmail.com>
parents:
1338
diff
changeset
|
671 VsetMode(new_video_mode->number); |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
672 } |
735 | 673 #endif |
1094
5012b97142ac
Set hardware palette to black in True Colour mode
Patrice Mandin <patmandin@gmail.com>
parents:
1085
diff
changeset
|
674 /* Set hardware palette to black in True Colour */ |
5012b97142ac
Set hardware palette to black in True Colour mode
Patrice Mandin <patmandin@gmail.com>
parents:
1085
diff
changeset
|
675 if (new_depth == 16) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
676 SDL_memset(F30_palette, 0, sizeof(F30_palette)); |
1094
5012b97142ac
Set hardware palette to black in True Colour mode
Patrice Mandin <patmandin@gmail.com>
parents:
1085
diff
changeset
|
677 VsetRGB(0,256,F30_palette); |
5012b97142ac
Set hardware palette to black in True Colour mode
Patrice Mandin <patmandin@gmail.com>
parents:
1085
diff
changeset
|
678 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
679 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
681 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
682 Vsync(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
683 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
684 this->UpdateRects = XBIOS_UpdateRects; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
685 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
686 return (current); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
687 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
688 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
689 /* We don't actually allow hardware surfaces other than the main one */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
690 static int XBIOS_AllocHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
691 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
692 return(-1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
693 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
694 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
695 static void XBIOS_FreeHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
696 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
697 return; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
698 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
699 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
700 static int XBIOS_LockHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
701 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
702 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
703 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
704 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 static void XBIOS_UnlockHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
706 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
707 return; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
708 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
709 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
710 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect *rects) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
711 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 SDL_Surface *surface; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
713 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
714 surface = this->screen; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
715 |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
716 if ((surface->format->BitsPerPixel) == 8) { |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
717 int i; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
718 |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
719 for (i=0;i<numrects;i++) { |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
720 void *source,*destination; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
721 int x1,x2; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
722 |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
723 x1 = rects[i].x & ~15; |
319
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
314
diff
changeset
|
724 x2 = rects[i].x+rects[i].w; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
314
diff
changeset
|
725 if (x2 & 15) { |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
314
diff
changeset
|
726 x2 = (x2 | 15) +1; |
189a6a3416c7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
314
diff
changeset
|
727 } |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
728 |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
729 source = surface->pixels; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
730 source += surface->pitch * rects[i].y; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
731 source += x1; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
732 |
1256
3cfb04f6e726
Rollback 1.28 change, but only for UpdateRects function this time
Patrice Mandin <patmandin@gmail.com>
parents:
1239
diff
changeset
|
733 destination = XBIOS_screens[XBIOS_fbnum]; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
734 destination += XBIOS_pitch * rects[i].y; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
735 destination += x1; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
736 |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
737 /* Convert chunky to planar screen */ |
735 | 738 SDL_Atari_C2pConvert( |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
739 source, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
740 destination, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
741 x2-x1, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
742 rects[i].h, |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
743 XBIOS_doubleline, |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
744 surface->pitch, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
745 XBIOS_pitch |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
746 ); |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
747 } |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
748 } |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
749 |
735 | 750 #ifndef DEBUG_VIDEO_XBIOS |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
751 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); |
735 | 752 #endif |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
753 Vsync(); |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
754 |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
755 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
756 XBIOS_fbnum ^= 1; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
757 if ((surface->format->BitsPerPixel) > 8) { |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
758 surface->pixels=XBIOS_screens[XBIOS_fbnum]; |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
759 } |
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
760 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
761 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
762 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
763 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface *surface) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
764 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
765 if ((surface->format->BitsPerPixel) == 8) { |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
766 void *destscr; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
767 int destx; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
768 |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
769 /* Center on destination screen */ |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
770 destscr = XBIOS_screens[XBIOS_fbnum]; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
771 destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1); |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
772 destx = (XBIOS_width - surface->w) >> 1; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
773 destx &= ~15; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
774 destscr += destx; |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
775 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
776 /* Convert chunky to planar screen */ |
735 | 777 SDL_Atari_C2pConvert( |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
778 surface->pixels, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
779 destscr, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
780 surface->w, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
781 surface->h, |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
782 XBIOS_doubleline, |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
783 surface->pitch, |
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
784 XBIOS_pitch |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
785 ); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
786 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
787 |
735 | 788 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
789 Setscreen(-1,XBIOS_screens[XBIOS_fbnum],-1); |
735 | 790 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
791 Vsync(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
792 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
793 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { |
311
2847fd83f115
Date: Fri, 15 Mar 2002 18:24:59 GMT+1
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
794 XBIOS_fbnum ^= 1; |
2847fd83f115
Date: Fri, 15 Mar 2002 18:24:59 GMT+1
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
795 if ((surface->format->BitsPerPixel) > 8) { |
2847fd83f115
Date: Fri, 15 Mar 2002 18:24:59 GMT+1
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
796 surface->pixels=XBIOS_screens[XBIOS_fbnum]; |
2847fd83f115
Date: Fri, 15 Mar 2002 18:24:59 GMT+1
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
797 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
798 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
800 return(0); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
801 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
802 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
803 static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
804 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
805 int i; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
806 int r,v,b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
807 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
808 switch( XBIOS_cvdo >> 16) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
809 case VDO_ST: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
810 case VDO_STE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
811 for (i=0;i<ncolors;i++) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
812 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
813 r = colors[i].r; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 v = colors[i].g; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
815 b = colors[i].b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
816 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
817 TT_palette[firstcolor+i]=((r*30)+(v*59)+(b*11))/100; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
818 } |
735 | 819 SDL_Atari_C2pConvert4_pal(TT_palette); /* convert the lighting */ |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
820 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
821 case VDO_TT: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
822 for(i = 0; i < ncolors; i++) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
823 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
824 r = colors[i].r; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
825 v = colors[i].g; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
826 b = colors[i].b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
827 |
1102
f0919504adfd
Revert back change between 1.29 and 1.30
Patrice Mandin <patmandin@gmail.com>
parents:
1101
diff
changeset
|
828 TT_palette[i]=((r>>4)<<8)|((v>>4)<<4)|(b>>4); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
829 } |
735 | 830 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
831 EsetPalette(firstcolor,ncolors,TT_palette); |
735 | 832 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
833 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
834 case VDO_F30: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
835 for(i = 0; i < ncolors; i++) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
836 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
837 r = colors[i].r; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
838 v = colors[i].g; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
839 b = colors[i].b; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
840 |
1102
f0919504adfd
Revert back change between 1.29 and 1.30
Patrice Mandin <patmandin@gmail.com>
parents:
1101
diff
changeset
|
841 F30_palette[i]=(r<<16)|(v<<8)|b; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
842 } |
735 | 843 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
844 VsetRGB(firstcolor,ncolors,F30_palette); |
735 | 845 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
846 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
847 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
848 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
849 return(1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
850 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
851 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
852 /* Note: If we are terminated, this could be called in the middle of |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
853 another SDL video routine -- notably UpdateRects. |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
854 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
855 static void XBIOS_VideoQuit(_THIS) |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
856 { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
857 int i,j; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
858 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
859 Atari_ShutdownEvents(); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
860 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
861 /* Restore video mode and palette */ |
801
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
862 #ifndef DEBUG_VIDEO_XBIOS |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
863 switch(XBIOS_cvdo >> 16) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
864 case VDO_ST: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
865 case VDO_STE: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
866 Setscreen(-1,XBIOS_oldvbase,XBIOS_oldvmode); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
867 if (XBIOS_oldnumcol) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
868 Setpalette(XBIOS_oldpalette); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
869 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
870 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
871 case VDO_TT: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
872 Setscreen(-1,XBIOS_oldvbase,-1); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
873 EsetShift(XBIOS_oldvmode); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
874 if (XBIOS_oldnumcol) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
875 EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
876 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
877 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
878 case VDO_F30: |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
879 Setscreen(-1, XBIOS_oldvbase, -1); |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
880 if (XBIOS_centscreen) { |
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
881 SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode); |
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
882 } else { |
1350
adc8ff3c9597
Fixes for new SDL embedded libc stuff
Patrice Mandin <patmandin@gmail.com>
parents:
1338
diff
changeset
|
883 VsetMode(XBIOS_oldvmode); |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
884 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
885 if (XBIOS_oldnumcol) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
886 VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
887 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
888 break; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
889 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
890 Vsync(); |
801
ff1058d642dc
Video modes must be sorted by Y size, for SDL_GetVideoMode() to operate properly
Patrice Mandin <patmandin@gmail.com>
parents:
797
diff
changeset
|
891 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
892 |
992
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
893 |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
894 #ifdef HAVE_OPENGL |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
895 if (gl_active) { |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
896 SDL_AtariGL_Quit(this, SDL_TRUE); |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
897 } |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
898 #endif |
0324ce32b2d9
Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents:
991
diff
changeset
|
899 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
900 if (XBIOS_oldpalette) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
901 SDL_free(XBIOS_oldpalette); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
902 XBIOS_oldpalette=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
903 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
904 XBIOS_FreeBuffers(this); |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
905 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
906 /* Free mode list */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
907 for (j=0;j<NUM_MODELISTS;j++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
908 for (i=0;i<SDL_NUMMODES;i++) { |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
909 if (SDL_modelist[j][i]!=NULL) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
910 SDL_free(SDL_modelist[j][i]); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
911 SDL_modelist[j][i]=NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
912 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
913 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
914 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
915 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
916 if (XBIOS_modelist) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1322
diff
changeset
|
917 SDL_free(XBIOS_modelist); |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
918 XBIOS_nummodes=0; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
919 XBIOS_modelist=NULL; |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
920 } |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
921 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
922 this->screen->pixels = NULL; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
923 } |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
924 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
925 #ifdef HAVE_OPENGL |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
926 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
927 static void XBIOS_GL_SwapBuffers(_THIS) |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
928 { |
993
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
929 SDL_AtariGL_SwapBuffers(this); |
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
930 XBIOS_FlipHWSurface(this, this->screen); |
2662da16d668
Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents:
992
diff
changeset
|
931 SDL_AtariGL_MakeCurrent(this); |
978
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
932 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
933 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
934 #endif |