Mercurial > sdl-ios-xcode
annotate src/video/xbios/SDL_xbios.c @ 2043:adf732f1f016
Formatting update
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 24 Sep 2006 15:56:55 +0000 |
parents | 12ef90a41631 |
children | 4b3f98a9a2c1 |
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 */ |
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 | 44 #include "../ataricommon/SDL_ataric2p_s.h" |
45 #include "../ataricommon/SDL_atarievents_c.h" | |
46 #include "../ataricommon/SDL_atarimxalloc_c.h" | |
47 #include "../ataricommon/SDL_atarigl_c.h" | |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 #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
|
49 #include "SDL_xbios_blowup.h" |
1061
5023cde12cbd
Add Falcon Centscreen extension support
Patrice Mandin <patmandin@gmail.com>
parents:
1043
diff
changeset
|
50 #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
|
51 #include "SDL_xbios_sb3.h" |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
53 /* Debug print info */ |
1043 | 54 #if 0 |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
55 #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
|
56 { \ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
57 printf what; \ |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
58 } |
1043 | 59 #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
|
60 #else |
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
61 #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
|
62 #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
|
63 #endif |
735 | 64 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 /* 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
|
66 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
|
67 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
|
68 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
69 #if 0 |
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
|
70 static SDL_Rect **XBIOS_ListModes(_THIS, SDL_PixelFormat * format, |
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
|
71 Uint32 flags); |
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 static SDL_Surface *XBIOS_SetVideoMode(_THIS, SDL_Surface * current, |
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
|
73 int width, int height, int bpp, |
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 Uint32 flags); |
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 static int XBIOS_SetColors(_THIS, int firstcolor, int ncolors, |
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 SDL_Color * colors); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 /* Hardware surface functions */ |
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
|
79 static int XBIOS_AllocHWSurface(_THIS, SDL_Surface * surface); |
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 static int XBIOS_LockHWSurface(_THIS, SDL_Surface * surface); |
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 static int XBIOS_FlipHWSurface(_THIS, SDL_Surface * surface); |
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 static void XBIOS_UnlockHWSurface(_THIS, SDL_Surface * surface); |
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 static void XBIOS_FreeHWSurface(_THIS, SDL_Surface * surface); |
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
|
84 static void XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect * rects); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
86 #if SDL_VIDEO_OPENGL |
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
|
87 /* 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
|
88 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
|
89 #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
|
90 |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 /* To setup palette */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 |
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
|
93 static unsigned short TT_palette[256]; |
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 static unsigned long F30_palette[256]; |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
95 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 /* Xbios driver bootstrap functions */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 |
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
|
99 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
|
100 XBIOS_Available(void) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 { |
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
|
102 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
|
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 /* 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
|
105 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
|
106 (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
|
107 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
|
108 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 |
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
|
110 /* 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
|
111 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
|
112 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
|
113 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 |
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
|
115 /* 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
|
116 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
|
117 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
|
118 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
|
119 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
|
120 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
|
121 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
|
122 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
|
123 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
|
124 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
|
125 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
|
126 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
|
127 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
|
128 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
|
129 if (Getcookie(C_SCPN, &cookie_scpn) == 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
|
130 if (!SDL_XBIOS_SB3Usable((scpn_cookie_t *) cookie_scpn)) { |
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 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
|
132 } |
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 } |
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 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
|
135 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
|
136 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
|
137 } |
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 return 1; |
281
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 |
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
|
142 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
|
143 XBIOS_DeleteDevice(SDL_VideoDevice * device) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 { |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
145 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
|
146 SDL_free(device); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 |
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
|
149 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
|
150 XBIOS_CreateDevice(int devindex) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 { |
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
|
152 SDL_VideoDevice *device; |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
153 SDL_VideoData *data; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 |
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 /* 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
|
156 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
|
157 if (device) { |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
158 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
|
159 } |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
160 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
|
161 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
|
162 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
|
163 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
|
164 } |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
165 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
|
166 } |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
167 device->driverdata = data; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 |
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 /* 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
|
170 device->VideoInit = XBIOS_VideoInit; |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
171 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
|
172 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
173 /* Modes */ |
2043 | 174 device->GetDisplayModes = NULL /*XBIOS_GetDisplayModes */ ; |
175 device->SetDisplayMode = NULL /*XBIOS_SetDisplayMode */ ; | |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
176 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
177 /* Events */ |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
178 device->PumpEvents = SDL_Atari_PumpEvents; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
180 #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
|
181 /* 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
|
182 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
|
183 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
|
184 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
|
185 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
|
186 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
|
187 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
|
188 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
|
189 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
|
190 #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
|
191 |
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
|
192 device->free = XBIOS_DeleteDevice; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 |
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
|
194 return device; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 VideoBootStrap XBIOS_bootstrap = { |
2035
c848c18684ab
Started update for 1.3
Patrice Mandin <patmandin@gmail.com>
parents:
1895
diff
changeset
|
198 "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
|
199 XBIOS_Available, XBIOS_CreateDevice |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 }; |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
202 #if 0 |
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
|
203 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
|
204 SDL_XBIOS_AddMode(_THIS, Uint16 modecode, Uint16 width, Uint16 height, |
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
|
205 Uint16 depth, SDL_bool flags) |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
206 { |
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
|
207 int i, curpos; |
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
|
208 xbiosmode_t *current_mode; |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
209 |
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
|
210 /* Check if mode already exists */ |
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
|
211 if (XBIOS_modelist) { |
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
|
212 current_mode = XBIOS_modelist; |
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
|
213 for (i = 0; i < XBIOS_nummodes; i++, current_mode++) { |
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
|
214 if (current_mode->width != width) |
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
|
215 continue; |
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
|
216 if (current_mode->height != height) |
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
|
217 continue; |
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
|
218 if (current_mode->depth != depth) |
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
|
219 continue; |
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
|
220 return; |
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
|
221 } |
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
|
222 } |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
223 |
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
|
224 ++XBIOS_nummodes; |
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
|
225 XBIOS_modelist = |
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
|
226 (xbiosmode_t *) SDL_realloc(XBIOS_modelist, |
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
|
227 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
|
228 |
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
|
229 /* Keep the list sorted: bpp, width, height */ |
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
|
230 curpos = 0; |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
231 |
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
|
232 for (i = 0; i < XBIOS_nummodes - 1; i++) { |
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
|
233 if (XBIOS_modelist[i].depth <= depth) { |
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
|
234 if (XBIOS_modelist[i].width < width) { |
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
|
235 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
|
236 } else if (XBIOS_modelist[i].width == width) { |
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
|
237 if (XBIOS_modelist[i].height <= height) { |
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
|
238 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
|
239 } |
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
|
240 } |
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
|
241 } |
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
|
242 curpos++; |
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
|
243 } |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
244 |
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
|
245 /* Push remaining modes further */ |
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
|
246 for (i = XBIOS_nummodes - 1; i > curpos; i--) { |
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
|
247 SDL_memcpy(&XBIOS_modelist[i], &XBIOS_modelist[i - 1], |
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
|
248 sizeof(xbiosmode_t)); |
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
|
249 } |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
250 |
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
|
251 XBIOS_modelist[curpos].number = modecode; |
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
|
252 XBIOS_modelist[curpos].width = width; |
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
|
253 XBIOS_modelist[curpos].height = height; |
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
|
254 XBIOS_modelist[curpos].depth = depth; |
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
|
255 XBIOS_modelist[curpos].doubleline = flags; |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
256 } |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
257 #endif |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
258 |
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
|
259 static int |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
260 XBIOS_VideoInit(_THIS) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 { |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
262 XBIOS_InitModes(_this); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
263 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
264 #if 0 |
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
|
265 int i, j8, j16; |
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
|
266 xbiosmode_t *current_mode; |
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
|
267 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
|
268 |
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
|
269 /* Initialize all variables that we clean on shutdown */ |
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
|
270 memset(SDL_modelist, 0, sizeof(SDL_modelist)); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 |
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
|
272 /* 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
|
273 if (Getcookie(C__VDO, &XBIOS_cvdo) != 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
|
274 XBIOS_cvdo = 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
|
275 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 |
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
|
277 /* Allocate memory for old palette */ |
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
|
278 XBIOS_oldpalette = (void *) SDL_malloc(256 * sizeof(long)); |
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
|
279 if (!XBIOS_oldpalette) { |
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
|
280 SDL_SetError("Unable to allocate memory for old palette\n"); |
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
|
281 return (-1); |
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
|
282 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 |
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
|
284 /* Initialize video mode list */ |
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
|
285 /* and save current screen status (palette, screen address, video mode) */ |
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
|
286 XBIOS_nummodes = 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
|
287 XBIOS_modelist = NULL; |
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
|
288 XBIOS_centscreen = SDL_FALSE; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 |
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
|
290 switch (XBIOS_cvdo >> 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
|
291 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
|
292 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
|
293 { |
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
|
294 short *oldpalette; |
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
|
295 |
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
|
296 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
|
297 |
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
|
298 XBIOS_oldvbase = Physbase(); |
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
|
299 XBIOS_oldvmode = Getrez(); |
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
|
300 switch (XBIOS_oldvmode << 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
|
301 case ST_LOW: |
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
|
302 XBIOS_oldnumcol = 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
|
303 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
|
304 case ST_MED: |
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
|
305 XBIOS_oldnumcol = 4; |
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
|
306 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
|
307 case ST_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
|
308 XBIOS_oldnumcol = 2; |
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
|
309 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
|
310 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
|
311 XBIOS_oldnumcol = 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
|
312 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
|
313 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 |
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
|
315 oldpalette = (short *) XBIOS_oldpalette; |
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
|
316 for (i = 0; i < XBIOS_oldnumcol; i++) { |
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
|
317 *oldpalette++ = Setcolor(i, -1); |
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
|
318 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 |
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
|
320 vformat->BitsPerPixel = 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
|
321 } |
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
|
322 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
|
323 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
|
324 |
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
|
325 SDL_XBIOS_AddMode(this, TT_LOW, 320, 480, 8, SDL_FALSE); |
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
|
326 /* Software double-lined mode */ |
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
|
327 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
|
328 |
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
|
329 XBIOS_oldvbase = Logbase(); |
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
|
330 XBIOS_oldvmode = EgetShift(); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 |
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
|
332 switch (XBIOS_oldvmode & ES_MODE) { |
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
|
333 case TT_LOW: |
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
|
334 XBIOS_oldnumcol = 256; |
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
|
335 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
|
336 case ST_LOW: |
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
|
337 case TT_MED: |
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
|
338 XBIOS_oldnumcol = 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
|
339 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
|
340 case ST_MED: |
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
|
341 XBIOS_oldnumcol = 4; |
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
|
342 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
|
343 case ST_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
|
344 case 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
|
345 XBIOS_oldnumcol = 2; |
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
|
346 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
|
347 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
|
348 XBIOS_oldnumcol = 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
|
349 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
|
350 } |
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
|
351 if (XBIOS_oldnumcol) { |
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
|
352 EgetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
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
|
353 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 |
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
|
355 vformat->BitsPerPixel = 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
|
356 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
|
357 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
|
358 switch (VgetMonitor()) { |
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
|
359 case 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
|
360 /* Not usable */ |
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
|
361 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
|
362 case MONITOR_RGB: |
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
|
363 case MONITOR_TV: |
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
|
364 SDL_XBIOS_AddMode(this, BPS16 | COL80 | OVERSCAN | VERTFLAG, |
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
|
365 768, 480, 16, SDL_FALSE); |
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
|
366 SDL_XBIOS_AddMode(this, BPS16 | COL80 | OVERSCAN, 768, 240, |
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
|
367 16, SDL_FALSE); |
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
|
368 SDL_XBIOS_AddMode(this, BPS16 | COL80 | VERTFLAG, 640, 400, |
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
|
369 16, SDL_FALSE); |
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
|
370 SDL_XBIOS_AddMode(this, BPS16 | COL80, 640, 200, 16, SDL_FALSE); |
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
|
371 SDL_XBIOS_AddMode(this, BPS16 | OVERSCAN | VERTFLAG, 384, |
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
|
372 480, 16, SDL_FALSE); |
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
|
373 SDL_XBIOS_AddMode(this, BPS16 | OVERSCAN, 384, 240, 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
|
374 SDL_FALSE); |
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
|
375 SDL_XBIOS_AddMode(this, BPS16 | VERTFLAG, 320, 400, 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
|
376 SDL_FALSE); |
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
|
377 SDL_XBIOS_AddMode(this, BPS16, 320, 200, 16, SDL_FALSE); |
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
|
378 SDL_XBIOS_AddMode(this, BPS8 | COL80 | OVERSCAN | VERTFLAG, |
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
|
379 768, 480, 8, SDL_FALSE); |
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
|
380 SDL_XBIOS_AddMode(this, BPS8 | COL80 | OVERSCAN, 768, 240, 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
|
381 SDL_FALSE); |
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
|
382 SDL_XBIOS_AddMode(this, BPS8 | COL80 | VERTFLAG, 640, 400, 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
|
383 SDL_FALSE); |
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
|
384 SDL_XBIOS_AddMode(this, BPS8 | COL80, 640, 200, 8, SDL_FALSE); |
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
|
385 SDL_XBIOS_AddMode(this, BPS8 | OVERSCAN | VERTFLAG, 384, 480, |
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
|
386 8, SDL_FALSE); |
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
|
387 SDL_XBIOS_AddMode(this, BPS8 | OVERSCAN, 384, 240, 8, SDL_FALSE); |
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
|
388 SDL_XBIOS_AddMode(this, BPS8 | VERTFLAG, 320, 400, 8, SDL_FALSE); |
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
|
389 SDL_XBIOS_AddMode(this, BPS8, 320, 200, 8, SDL_FALSE); |
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
|
390 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
|
391 case MONITOR_VGA: |
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
|
392 SDL_XBIOS_AddMode(this, BPS16, 320, 480, 16, SDL_FALSE); |
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
|
393 SDL_XBIOS_AddMode(this, BPS16 | VERTFLAG, 320, 240, 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
|
394 SDL_FALSE); |
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
|
395 SDL_XBIOS_AddMode(this, BPS8 | COL80, 640, 480, 8, SDL_FALSE); |
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
|
396 SDL_XBIOS_AddMode(this, BPS8 | COL80 | VERTFLAG, 640, 240, 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
|
397 SDL_FALSE); |
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
|
398 SDL_XBIOS_AddMode(this, BPS8, 320, 480, 8, SDL_FALSE); |
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
|
399 SDL_XBIOS_AddMode(this, BPS8 | VERTFLAG, 320, 240, 8, SDL_FALSE); |
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
|
400 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
|
401 } |
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
|
402 XBIOS_oldvbase = Logbase(); |
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
|
403 XBIOS_oldvmode = VsetMode(-1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 |
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
|
405 XBIOS_oldnumcol = 1 << (1 << (XBIOS_oldvmode & NUMCOLS)); |
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
|
406 if (XBIOS_oldnumcol > 256) { |
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
|
407 XBIOS_oldnumcol = 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
|
408 } |
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
|
409 if (XBIOS_oldnumcol) { |
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
|
410 VgetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
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
|
411 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 |
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
|
413 vformat->BitsPerPixel = 16; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 |
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
|
415 /* Keep vga/rvb, and pal/ntsc bits */ |
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
|
416 current_mode = XBIOS_modelist; |
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
|
417 for (i = 0; i < XBIOS_nummodes; i++) { |
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
|
418 Uint16 newvmode; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 |
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
|
420 newvmode = current_mode->number; |
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
|
421 newvmode &= ~(VGA | PAL); |
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
|
422 newvmode |= XBIOS_oldvmode & (VGA | PAL); |
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
|
423 current_mode->number = newvmode; |
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
|
424 |
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
|
425 current_mode++; |
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
|
426 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 |
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
|
428 /* Initialize BlowUp/SB3/Centscreen stuff if present */ |
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
|
429 if (Getcookie(C_BLOW, &cookie_blow) == 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
|
430 SDL_XBIOS_BlowupInit(this, (blow_cookie_t *) cookie_blow); |
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
|
431 } else if (Getcookie(C_SCPN, &cookie_scpn) == 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
|
432 SDL_XBIOS_SB3Init(this, (scpn_cookie_t *) cookie_scpn); |
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
|
433 } else if (Getcookie(C_CNTS, &cookie_cnts) == 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
|
434 XBIOS_oldvmode = SDL_XBIOS_CentscreenInit(this); |
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
|
435 XBIOS_centscreen = SDL_TRUE; |
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
|
436 } |
1064
fba6b67b4d60
Add Centscreen extended modes support
Patrice Mandin <patmandin@gmail.com>
parents:
1061
diff
changeset
|
437 |
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
|
438 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
|
439 } |
1042
0e7218843cfb
Dynamically create list of video modes, easier to add new ones
Patrice Mandin <patmandin@gmail.com>
parents:
1040
diff
changeset
|
440 |
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
|
441 /* Determine the current screen size */ |
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
|
442 if (XBIOS_nummodes > 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
|
443 /* FIXME: parse video mode list to search for current mode */ |
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
|
444 this->info.current_w = XBIOS_modelist[0].width; |
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
|
445 this->info.current_h = XBIOS_modelist[0].height; |
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
|
446 } |
1545
8d9bb0cf2c2a
Added current_w and current_h to the SDL_VideoInfo structure, which is set to the desktop resolution during video intialization, and then set to the current resolution when a video mode is set.
Sam Lantinga <slouken@libsdl.org>
parents:
1412
diff
changeset
|
447 |
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
|
448 current_mode = XBIOS_modelist; |
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
|
449 j8 = j16 = 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
|
450 for (i = 0; i < XBIOS_nummodes; i++, current_mode++) { |
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
|
451 switch (current_mode->depth) { |
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
|
452 case 4: |
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
|
453 case 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
|
454 SDL_modelist[0][j8] = SDL_malloc(sizeof(SDL_Rect)); |
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
|
455 SDL_modelist[0][j8]->x = SDL_modelist[0][j8]->y = 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
|
456 SDL_modelist[0][j8]->w = current_mode->width; |
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
|
457 SDL_modelist[0][j8]->h = current_mode->height; |
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
|
458 XBIOS_videomodes[0][j8] = current_mode; |
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
|
459 j8++; |
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
|
460 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
|
461 case 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
|
462 SDL_modelist[1][j16] = SDL_malloc(sizeof(SDL_Rect)); |
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
|
463 SDL_modelist[1][j16]->x = SDL_modelist[1][j16]->y = 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
|
464 SDL_modelist[1][j16]->w = current_mode->width; |
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
|
465 SDL_modelist[1][j16]->h = current_mode->height; |
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
|
466 XBIOS_videomodes[1][j16] = current_mode; |
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
|
467 j16++; |
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
|
468 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
|
469 } |
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
|
470 } |
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
|
471 SDL_modelist[0][j8] = NULL; |
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
|
472 SDL_modelist[1][j16] = NULL; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
473 |
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
|
474 XBIOS_screens[0] = NULL; |
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
|
475 XBIOS_screens[1] = NULL; |
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
|
476 XBIOS_shadowscreen = NULL; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 |
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
|
478 /* Update hardware info */ |
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
|
479 this->info.hw_available = 1; |
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
|
480 this->info.video_mem = (Uint32) Atari_SysMalloc(-1L, MX_STRAM); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
481 |
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
|
482 /* Init chunky to planar routine */ |
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
|
483 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
484 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
485 #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
|
486 SDL_AtariGL_InitPointers(this); |
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
|
487 #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
|
488 |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
489 #endif |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
490 |
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
|
491 return (0); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
492 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
493 |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
494 static void |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
495 XBIOS_VideoQuit(_THIS) |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
496 { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
497 /* int i, j;*/ |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
498 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
499 XBIOS_QuitModes(_this); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
500 Atari_ShutdownEvents(); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
501 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
502 #if 0 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
503 /* Restore video mode and palette */ |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
504 #ifndef DEBUG_VIDEO_XBIOS |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
505 switch (XBIOS_cvdo >> 16) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
506 case VDO_ST: |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
507 case VDO_STE: |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
508 Setscreen(-1, XBIOS_oldvbase, XBIOS_oldvmode); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
509 if (XBIOS_oldnumcol) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
510 Setpalette(XBIOS_oldpalette); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
511 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
512 break; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
513 case VDO_TT: |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
514 Setscreen(-1, XBIOS_oldvbase, -1); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
515 EsetShift(XBIOS_oldvmode); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
516 if (XBIOS_oldnumcol) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
517 EsetPalette(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
518 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
519 break; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
520 case VDO_F30: |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
521 Setscreen(-1, XBIOS_oldvbase, -1); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
522 if (XBIOS_centscreen) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
523 SDL_XBIOS_CentscreenRestore(this, XBIOS_oldvmode); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
524 } else { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
525 VsetMode(XBIOS_oldvmode); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
526 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
527 if (XBIOS_oldnumcol) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
528 VsetRGB(0, XBIOS_oldnumcol, XBIOS_oldpalette); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
529 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
530 break; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
531 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
532 Vsync(); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
533 #endif |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
534 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
535 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
536 #if SDL_VIDEO_OPENGL |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
537 if (gl_active) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
538 SDL_AtariGL_Quit(this, SDL_TRUE); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
539 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
540 #endif |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
541 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
542 if (XBIOS_oldpalette) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
543 SDL_free(XBIOS_oldpalette); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
544 XBIOS_oldpalette = NULL; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
545 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
546 XBIOS_FreeBuffers(this); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
547 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
548 /* Free mode list */ |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
549 for (j = 0; j < NUM_MODELISTS; j++) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
550 for (i = 0; i < SDL_NUMMODES; i++) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
551 if (SDL_modelist[j][i] != NULL) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
552 SDL_free(SDL_modelist[j][i]); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
553 SDL_modelist[j][i] = NULL; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
554 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
555 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
556 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
557 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
558 if (XBIOS_modelist) { |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
559 SDL_free(XBIOS_modelist); |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
560 XBIOS_nummodes = 0; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
561 XBIOS_modelist = NULL; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
562 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
563 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
564 this->screen->pixels = NULL; |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
565 #endif |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
566 } |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
567 |
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
568 #if 0 |
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
|
569 static SDL_Rect ** |
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
|
570 XBIOS_ListModes(_THIS, SDL_PixelFormat * format, Uint32 flags) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
571 { |
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
|
572 /* 8 bits -> list 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
|
573 /* 16 bits -> list 1 */ |
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
|
574 if ((format->BitsPerPixel != 8) && (format->BitsPerPixel != 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
|
575 return NULL; |
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
|
576 } |
711
8db4098e944b
Severe bugfix: format->BitsPerPixel not checked in ListModes function
Patrice Mandin <patmandin@gmail.com>
parents:
598
diff
changeset
|
577 |
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
|
578 return (SDL_modelist[(format->BitsPerPixel) >> 4]); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
579 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
580 |
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
|
581 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
|
582 XBIOS_FreeBuffers(_THIS) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
583 { |
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
|
584 int i; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
585 |
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
|
586 for (i = 0; i < 2; i++) { |
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
|
587 if (XBIOS_screensmem[i] != NULL) { |
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
|
588 Mfree(XBIOS_screensmem[i]); |
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
|
589 XBIOS_screensmem[i] = NULL; |
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
|
590 } |
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
|
591 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
592 |
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
|
593 if (XBIOS_shadowscreen != NULL) { |
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
|
594 Mfree(XBIOS_shadowscreen); |
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
|
595 XBIOS_shadowscreen = NULL; |
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
|
596 } |
281
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 |
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
|
599 static SDL_Surface * |
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
|
600 XBIOS_SetVideoMode(_THIS, SDL_Surface * current, |
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
|
601 int width, int height, int bpp, Uint32 flags) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
602 { |
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
|
603 int mode, new_depth; |
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
|
604 int i; |
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
|
605 xbiosmode_t *new_video_mode; |
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
|
606 Uint32 new_screen_size; |
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
|
607 Uint32 modeflags; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
608 |
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
|
609 /* Free current buffers */ |
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
|
610 XBIOS_FreeBuffers(this); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
611 |
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
|
612 /* Limit bpp */ |
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
|
613 if (bpp > 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
|
614 bpp = 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
|
615 } |
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
|
616 bpp >>= 4; |
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
|
617 |
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
|
618 /* Search if the mode exists (width, height, bpp) */ |
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
|
619 for (mode = 0; SDL_modelist[bpp][mode]; ++mode) { |
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
|
620 if ((SDL_modelist[bpp][mode]->w == width) && |
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
|
621 (SDL_modelist[bpp][mode]->h == height)) { |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
622 |
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
|
623 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
|
624 } |
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
|
625 } |
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
|
626 if (SDL_modelist[bpp][mode] == NULL) { |
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
|
627 SDL_SetError("Couldn't find requested mode in list"); |
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
|
628 return (NULL); |
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
|
629 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
630 |
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
|
631 modeflags = SDL_FULLSCREEN | SDL_PREALLOC; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
632 |
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
|
633 /* Allocate needed buffers: simple/double buffer and shadow surface */ |
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
|
634 new_video_mode = XBIOS_videomodes[bpp][mode]; |
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
|
635 new_depth = new_video_mode->depth; |
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
|
636 if (new_depth == 4) { |
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
|
637 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert4; |
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
|
638 new_depth = 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
|
639 modeflags |= SDL_SWSURFACE | SDL_HWPALETTE; |
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
|
640 } else if (new_depth == 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
|
641 SDL_Atari_C2pConvert = SDL_Atari_C2pConvert8; |
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
|
642 modeflags |= SDL_SWSURFACE | SDL_HWPALETTE; |
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
|
643 } else { |
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
|
644 modeflags |= SDL_HWSURFACE; |
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
|
645 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
646 |
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
|
647 new_screen_size = width * height * ((new_depth) >> 3); |
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
|
648 new_screen_size += 256; /* To align on a 256 byte adress */ |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
649 |
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
|
650 if (new_depth == 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
|
651 XBIOS_shadowscreen = Atari_SysMalloc(new_screen_size, MX_PREFTTRAM); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
652 |
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
|
653 if (XBIOS_shadowscreen == NULL) { |
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
|
654 SDL_SetError("Can not allocate %d KB for shadow buffer", |
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
|
655 new_screen_size >> 10); |
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
|
656 return (NULL); |
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
|
657 } |
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
|
658 SDL_memset(XBIOS_shadowscreen, 0, new_screen_size); |
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
|
659 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
660 |
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
|
661 /* Output buffer needs to be twice in size for the software double-line mode */ |
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
|
662 XBIOS_doubleline = SDL_FALSE; |
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
|
663 if (new_video_mode->doubleline) { |
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
|
664 new_screen_size <<= 1; |
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
|
665 XBIOS_doubleline = SDL_TRUE; |
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
|
666 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
667 |
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
|
668 XBIOS_screensmem[0] = Atari_SysMalloc(new_screen_size, MX_STRAM); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
669 |
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
|
670 if (XBIOS_screensmem[0] == NULL) { |
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
|
671 XBIOS_FreeBuffers(this); |
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
|
672 SDL_SetError("Can not allocate %d KB for frame buffer", |
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
|
673 new_screen_size >> 10); |
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
|
674 return (NULL); |
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
|
675 } |
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
|
676 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
|
677 |
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
|
678 XBIOS_screens[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
|
679 (void *) (((long) XBIOS_screensmem[0] + 256) & 0xFFFFFF00UL); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
680 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
681 #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
|
682 if (flags & SDL_INTERNALOPENGL) { |
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
|
683 if (this->gl_config.double_buffer) { |
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
|
684 flags |= SDL_DOUBLEBUF; |
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
|
685 } |
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
|
686 } |
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
|
687 #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
|
688 |
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
|
689 /* Double buffer ? */ |
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
|
690 if (flags & SDL_DOUBLEBUF) { |
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
|
691 XBIOS_screensmem[1] = Atari_SysMalloc(new_screen_size, MX_STRAM); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
692 |
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
|
693 if (XBIOS_screensmem[1] == NULL) { |
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
|
694 XBIOS_FreeBuffers(this); |
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
|
695 SDL_SetError("Can not allocate %d KB for double buffer", |
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
|
696 new_screen_size >> 10); |
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
|
697 return (NULL); |
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
|
698 } |
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
|
699 SDL_memset(XBIOS_screensmem[1], 0, new_screen_size); |
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
|
700 |
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
|
701 XBIOS_screens[1] = |
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
|
702 (void *) (((long) XBIOS_screensmem[1] + 256) & 0xFFFFFF00UL); |
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
|
703 modeflags |= SDL_DOUBLEBUF; |
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
|
704 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
705 |
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
|
706 /* Allocate the new pixel format for the screen */ |
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
|
707 if (!SDL_ReallocFormat(current, new_depth, 0, 0, 0, 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
|
708 XBIOS_FreeBuffers(this); |
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
|
709 SDL_SetError("Couldn't allocate new pixel format for requested mode"); |
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
|
710 return (NULL); |
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
|
711 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
712 |
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
|
713 current->w = XBIOS_width = width; |
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
|
714 current->h = XBIOS_height = height; |
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
|
715 current->pitch = (width * new_depth) >> 3; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
716 |
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
|
717 /* this is for C2P conversion */ |
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
|
718 XBIOS_pitch = (new_video_mode->width * new_video_mode->depth) >> 3; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
719 |
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
|
720 if (new_depth == 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
|
721 current->pixels = XBIOS_shadowscreen; |
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
|
722 else |
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
|
723 current->pixels = XBIOS_screens[0]; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
724 |
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
|
725 XBIOS_fbnum = 0; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
726 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
727 #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
|
728 if (flags & SDL_INTERNALOPENGL) { |
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
|
729 if (!SDL_AtariGL_Init(this, current)) { |
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
|
730 XBIOS_FreeBuffers(this); |
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
|
731 SDL_SetError("Can not create OpenGL context"); |
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
|
732 return NULL; |
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
|
733 } |
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
|
734 |
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
|
735 modeflags |= SDL_INTERNALOPENGL; |
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
|
736 } |
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
|
737 #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
|
738 |
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
|
739 current->flags = modeflags; |
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
|
740 |
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
|
741 /* Now set the video mode */ |
735 | 742 #ifndef DEBUG_VIDEO_XBIOS |
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
|
743 Setscreen(-1, XBIOS_screens[0], -1); |
735 | 744 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
745 |
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
|
746 switch (XBIOS_cvdo >> 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
|
747 case VDO_ST: |
735 | 748 #ifndef DEBUG_VIDEO_XBIOS |
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
|
749 Setscreen(-1, -1, new_video_mode->number); |
735 | 750 #endif |
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
|
751 /* Reset palette */ |
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
|
752 for (i = 0; i < 16; i++) { |
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
|
753 TT_palette[i] = |
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
|
754 ((i >> 1) << 8) | (((i * 8) / 17) << 4) | (i >> 1); |
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
|
755 } |
735 | 756 #ifndef DEBUG_VIDEO_XBIOS |
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
|
757 Setpalette(TT_palette); |
735 | 758 #endif |
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
|
759 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
|
760 case VDO_STE: |
735 | 761 #ifndef DEBUG_VIDEO_XBIOS |
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
|
762 Setscreen(-1, -1, new_video_mode->number); |
735 | 763 #endif |
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
|
764 /* Reset palette */ |
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
|
765 for (i = 0; i < 16; i++) { |
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
|
766 int c; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
767 |
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
|
768 c = ((i & 1) << 3) | ((i >> 1) & 7); |
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
|
769 TT_palette[i] = (c << 8) | (c << 4) | c; |
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
|
770 } |
735 | 771 #ifndef DEBUG_VIDEO_XBIOS |
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
|
772 Setpalette(TT_palette); |
735 | 773 #endif |
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
|
774 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
|
775 case VDO_TT: |
735 | 776 #ifndef DEBUG_VIDEO_XBIOS |
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
|
777 EsetShift(new_video_mode->number); |
735 | 778 #endif |
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
|
779 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
|
780 case VDO_F30: |
735 | 781 #ifndef DEBUG_VIDEO_XBIOS |
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
|
782 if (XBIOS_centscreen) { |
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
|
783 SDL_XBIOS_CentscreenSetmode(this, width, height, new_depth); |
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
|
784 } else { |
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
|
785 VsetMode(new_video_mode->number); |
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
|
786 } |
735 | 787 #endif |
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
|
788 /* Set hardware palette to black in True Colour */ |
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
|
789 if (new_depth == 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
|
790 SDL_memset(F30_palette, 0, sizeof(F30_palette)); |
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
|
791 VsetRGB(0, 256, F30_palette); |
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
|
792 } |
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
|
793 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
|
794 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
795 |
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
|
796 Vsync(); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
797 |
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
|
798 this->UpdateRects = XBIOS_UpdateRects; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
799 |
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
|
800 return (current); |
281
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 /* We don't actually allow hardware surfaces other than the main one */ |
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
|
804 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
|
805 XBIOS_AllocHWSurface(_THIS, SDL_Surface * surface) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
806 { |
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
|
807 return (-1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
808 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
809 |
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
|
810 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
|
811 XBIOS_FreeHWSurface(_THIS, SDL_Surface * surface) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
812 { |
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
|
813 return; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
814 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
815 |
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
|
816 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
|
817 XBIOS_LockHWSurface(_THIS, SDL_Surface * surface) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
818 { |
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
|
819 return (0); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
820 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
821 |
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
|
822 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
|
823 XBIOS_UnlockHWSurface(_THIS, SDL_Surface * surface) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
824 { |
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
|
825 return; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
826 } |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
827 |
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
|
828 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
|
829 XBIOS_UpdateRects(_THIS, int numrects, SDL_Rect * rects) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
830 { |
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
|
831 SDL_Surface *surface; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
832 |
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
|
833 surface = this->screen; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
834 |
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
|
835 if ((surface->format->BitsPerPixel) == 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
|
836 int i; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
837 |
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
|
838 for (i = 0; i < numrects; i++) { |
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
|
839 void *source, *destination; |
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
|
840 int x1, x2; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
841 |
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
|
842 x1 = rects[i].x & ~15; |
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
|
843 x2 = rects[i].x + rects[i].w; |
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
|
844 if (x2 & 15) { |
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
|
845 x2 = (x2 | 15) + 1; |
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
|
846 } |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
847 |
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
|
848 source = surface->pixels; |
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
|
849 source += surface->pitch * rects[i].y; |
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
|
850 source += x1; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
851 |
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
|
852 destination = XBIOS_screens[XBIOS_fbnum]; |
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
|
853 destination += XBIOS_pitch * rects[i].y; |
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
|
854 destination += x1; |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
855 |
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
|
856 /* Convert chunky to planar screen */ |
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
|
857 SDL_Atari_C2pConvert(source, |
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
|
858 destination, |
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
|
859 x2 - x1, |
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
|
860 rects[i].h, |
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
|
861 XBIOS_doubleline, |
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
|
862 surface->pitch, XBIOS_pitch); |
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
|
863 } |
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
|
864 } |
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
|
865 #ifndef DEBUG_VIDEO_XBIOS |
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
|
866 Setscreen(-1, XBIOS_screens[XBIOS_fbnum], -1); |
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
|
867 #endif |
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
|
868 Vsync(); |
314
bff64eba7721
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
311
diff
changeset
|
869 |
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
|
870 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { |
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
|
871 XBIOS_fbnum ^= 1; |
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
|
872 if ((surface->format->BitsPerPixel) > 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
|
873 surface->pixels = XBIOS_screens[XBIOS_fbnum]; |
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
|
874 } |
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
|
875 } |
281
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 |
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
|
878 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
|
879 XBIOS_FlipHWSurface(_THIS, SDL_Surface * surface) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
880 { |
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
|
881 if ((surface->format->BitsPerPixel) == 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
|
882 void *destscr; |
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
|
883 int destx; |
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
|
884 |
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
|
885 /* Center on destination screen */ |
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
|
886 destscr = XBIOS_screens[XBIOS_fbnum]; |
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
|
887 destscr += XBIOS_pitch * ((XBIOS_height - surface->h) >> 1); |
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
|
888 destx = (XBIOS_width - surface->w) >> 1; |
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
|
889 destx &= ~15; |
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
|
890 destscr += destx; |
1101
c8a51d169579
Revert back screen centering when using c2p
Patrice Mandin <patmandin@gmail.com>
parents:
1094
diff
changeset
|
891 |
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
|
892 /* Convert chunky to planar screen */ |
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
|
893 SDL_Atari_C2pConvert(surface->pixels, |
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
|
894 destscr, |
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
|
895 surface->w, |
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
|
896 surface->h, |
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
|
897 XBIOS_doubleline, surface->pitch, XBIOS_pitch); |
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
|
898 } |
735 | 899 #ifndef DEBUG_VIDEO_XBIOS |
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
|
900 Setscreen(-1, XBIOS_screens[XBIOS_fbnum], -1); |
735 | 901 #endif |
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
|
902 Vsync(); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
903 |
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
|
904 if ((surface->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) { |
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
|
905 XBIOS_fbnum ^= 1; |
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
|
906 if ((surface->format->BitsPerPixel) > 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
|
907 surface->pixels = XBIOS_screens[XBIOS_fbnum]; |
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
|
908 } |
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
|
909 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
910 |
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
|
911 return (0); |
281
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 |
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
|
914 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
|
915 XBIOS_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color * colors) |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
916 { |
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
|
917 int i; |
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
|
918 int r, v, b; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
919 |
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
|
920 switch (XBIOS_cvdo >> 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
|
921 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
|
922 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
|
923 for (i = 0; i < ncolors; i++) { |
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
|
924 r = colors[i].r; |
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
|
925 v = colors[i].g; |
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
|
926 b = colors[i].b; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
927 |
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
|
928 TT_palette[firstcolor + i] = |
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
|
929 ((r * 30) + (v * 59) + (b * 11)) / 100; |
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
|
930 } |
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
|
931 SDL_Atari_C2pConvert4_pal(TT_palette); /* convert the lighting */ |
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
|
932 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
|
933 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
|
934 for (i = 0; i < ncolors; i++) { |
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
|
935 r = colors[i].r; |
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
|
936 v = colors[i].g; |
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
|
937 b = colors[i].b; |
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
|
938 |
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
|
939 TT_palette[i] = ((r >> 4) << 8) | ((v >> 4) << 4) | (b >> 4); |
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
|
940 } |
735 | 941 #ifndef DEBUG_VIDEO_XBIOS |
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
|
942 EsetPalette(firstcolor, ncolors, TT_palette); |
735 | 943 #endif |
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
|
944 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
|
945 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
|
946 for (i = 0; i < ncolors; i++) { |
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
|
947 r = colors[i].r; |
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
|
948 v = colors[i].g; |
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
|
949 b = colors[i].b; |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
950 |
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
|
951 F30_palette[i] = (r << 16) | (v << 8) | b; |
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
|
952 } |
735 | 953 #ifndef DEBUG_VIDEO_XBIOS |
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
|
954 VsetRGB(firstcolor, ncolors, F30_palette); |
735 | 955 #endif |
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
|
956 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
|
957 } |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
958 |
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
|
959 return (1); |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
960 } |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
961 #endif |
281
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
962 |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
963 /* 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
|
964 another SDL video routine -- notably UpdateRects. |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
965 */ |
c5010ab8ba35
Added initial support for Atari (thanks Patrice!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
966 |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
967 #if 0 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
968 #if SDL_VIDEO_OPENGL |
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
|
969 |
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
|
970 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
|
971 XBIOS_GL_SwapBuffers(_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
|
972 { |
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
|
973 SDL_AtariGL_SwapBuffers(this); |
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
|
974 XBIOS_FlipHWSurface(this, this->screen); |
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
|
975 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
|
976 } |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
977 |
3b1ba22f5a28
Add support for OpenGL on Atari using OSMesa, the offscreen rendering driver from Mesa
Patrice Mandin <patmandin@gmail.com>
parents:
972
diff
changeset
|
978 #endif |
2036
12ef90a41631
Pfiou, all of it to update, faster to rewrite from scratch?
Patrice Mandin <patmandin@gmail.com>
parents:
2035
diff
changeset
|
979 #endif |
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
|
980 /* vi: set ts=4 sw=4 expandtab: */ |