annotate src/video/xbios/SDL_xbios.c @ 3055:cd863dd2082b

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 07 Feb 2009 18:03:46 +0000
parents 99210400e8b9
children
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
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2120
diff changeset
3 Copyright (C) 1997-2009 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 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
281
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 /*
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 * Xbios SDL video driver
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 *
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 * Patrice Mandin
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
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <sys/stat.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <unistd.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33 /* Mint includes */
557
0ce5a68278fd Updated Atari port for new system headers (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents: 508
diff changeset
34 #include <mint/cookie.h>
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 #include <mint/osbind.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
36 #include <mint/falcon.h>
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 #include "SDL_video.h"
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #include "SDL_mouse.h"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
40 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
41 #include "../SDL_pixels_c.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
42 #include "../../events/SDL_events_c.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43
1412
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
44 #include "../ataricommon/SDL_ataric2p_s.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
45 #include "../ataricommon/SDL_atarievents_c.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
46 #include "../ataricommon/SDL_atarimxalloc_c.h"
a8181c4040b8 Fixed include files
Patrice Mandin <patmandin@gmail.com>
parents: 1402
diff changeset
47 #include "../ataricommon/SDL_atarigl_c.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 #include "SDL_xbios.h"
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
49 #include "SDL_xbiosmodes.h"
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
51 /* Debug print info */
1043
21d1d05aad39 Disable debug code
Patrice Mandin <patmandin@gmail.com>
parents: 1042
diff changeset
52 #if 0
1042
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
53 #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
54 { \
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
55 printf what; \
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
56 }
1043
21d1d05aad39 Disable debug code
Patrice Mandin <patmandin@gmail.com>
parents: 1042
diff changeset
57 #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
58 #else
0e7218843cfb Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents: 1040
diff changeset
59 #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
60 #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
61 #endif
735
abec2a842d11 Use new C2P routine
Patrice Mandin <patmandin@gmail.com>
parents: 712
diff changeset
62
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 /* Initialization/Query functions */
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
64 static int XBIOS_VideoInit(_THIS);
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
65 static void XBIOS_VideoQuit(_THIS);
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
66
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 /* Xbios driver bootstrap functions */
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
69 static int
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
70 XBIOS_Available(void)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
72 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
73
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
74 /* Milan/Hades Atari clones do not have an Atari video chip */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
75 if ((Getcookie(C__MIL, &cookie_mil) == C_FOUND) ||
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
76 (Getcookie(C_hade, &cookie_hade) == C_FOUND)) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
77 return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
78 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
80 /* Cookie _VDO present ? if not, assume ST machine */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
81 if (Getcookie(C__VDO, &cookie_vdo) != C_FOUND) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
82 cookie_vdo = VDO_ST << 16;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
83 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
85 /* Test if we have a monochrome monitor plugged in */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
86 switch (cookie_vdo >> 16) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
87 case VDO_ST:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
88 case VDO_STE:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
89 if (Getrez() == (ST_HIGH >> 8))
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
90 return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
91 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
92 case VDO_TT:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
93 if ((EgetShift() & ES_MODE) == TT_HIGH)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
94 return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
95 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
96 case VDO_F30:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
97 if (VgetMonitor() == MONITOR_MONO)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
98 return 0;
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
99 /*if (Getcookie(C_SCPN, &cookie_scpn) == C_FOUND) {
2120
2c835d58faad make indent
Sam Lantinga <slouken@libsdl.org>
parents: 2073
diff changeset
100 if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *) cookie_scpn)) {
2c835d58faad make indent
Sam Lantinga <slouken@libsdl.org>
parents: 2073
diff changeset
101 return 0;
2c835d58faad make indent
Sam Lantinga <slouken@libsdl.org>
parents: 2073
diff changeset
102 }
2c835d58faad make indent
Sam Lantinga <slouken@libsdl.org>
parents: 2073
diff changeset
103 } */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
104 break;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
105 default:
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
106 return 0;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
107 }
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
109 return 1;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
112 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
113 XBIOS_DeleteDevice(SDL_VideoDevice * device)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 {
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
115 SDL_free(device->driverdata);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
116 SDL_free(device);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
119 static SDL_VideoDevice *
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
120 XBIOS_CreateDevice(int devindex)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
122 SDL_VideoDevice *device;
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
123 SDL_VideoData *data;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
125 /* Initialize all variables that we clean on shutdown */
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
126 device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
127 if (device) {
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
128 data = (struct SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData));
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
129 }
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
130 if (!device || !data) {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
131 SDL_OutOfMemory();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
132 if (device) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
133 SDL_free(device);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
134 }
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
135 return NULL;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
136 }
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
137 device->driverdata = data;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
139 /* Video functions */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
140 device->VideoInit = XBIOS_VideoInit;
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
141 device->VideoQuit = XBIOS_VideoQuit;
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
142
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
143 /* Modes */
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
144 device->GetDisplayModes = SDL_XBIOS_GetDisplayModes;
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
145 device->SetDisplayMode = SDL_XBIOS_SetDisplayMode;
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
146
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
147 /* Events */
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
148 device->PumpEvents = SDL_Atari_PumpEvents;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1358
diff changeset
150 #if SDL_VIDEO_OPENGL
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
151 /* OpenGL functions */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
152 device->GL_LoadLibrary = SDL_AtariGL_LoadLibrary;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
153 device->GL_GetProcAddress = SDL_AtariGL_GetProcAddress;
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
154 device->GL_CreateContext = NULL;
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
155 device->GL_MakeCurrent = SDL_AtariGL_MakeCurrent;
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
156 device->GL_SetSwapInterval = NULL;
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
157 device->GL_GetSwapInterval = NULL;
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
158 device->GL_SwapWindow = XBIOS_GL_SwapBuffers;
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
159 device->GL_DeleteContext = 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
160 #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
161
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
162 device->free = XBIOS_DeleteDevice;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
164 return device;
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 VideoBootStrap XBIOS_bootstrap = {
2035
c848c18684ab Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
168 "xbios", "Atari Xbios driver",
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
169 XBIOS_Available, XBIOS_CreateDevice
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170 };
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
172 static int
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
173 XBIOS_VideoInit(_THIS)
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 {
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
175 /* Save screensaver settings */
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
176
2073
790726541708 Save/restore current video mode and palette
Patrice Mandin <patmandin@gmail.com>
parents: 2072
diff changeset
177 /* Init video mode list, save current video mode settings */
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
178 SDL_XBIOS_InitModes(_this);
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
179
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1830
diff changeset
180 return (0);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
181 }
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
182
2036
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
183 static void
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
184 XBIOS_VideoQuit(_THIS)
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
185 {
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
186 Atari_ShutdownEvents();
12ef90a41631 Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents: 2035
diff changeset
187
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
188 /* Restore screensaver settings */
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
189
2073
790726541708 Save/restore current video mode and palette
Patrice Mandin <patmandin@gmail.com>
parents: 2072
diff changeset
190 /* Restore previous video mode settings */
2072
4b3f98a9a2c1 xbios: preliminary video mode init
Patrice Mandin <patmandin@gmail.com>
parents: 2043
diff changeset
191 SDL_XBIOS_QuitModes(_this);
281
c5010ab8ba35 Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
192 }