Mercurial > sdl-ios-xcode
annotate src/video/xbios/SDL_xbios_milan.c @ 4196:89c7562eae9b SDL-1.2
Enumerates custom modes
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Sat, 19 Sep 2009 13:31:41 +0000 |
parents | 13de8ea401db |
children | 1bf6585720e9 |
rev | line source |
---|---|
4195 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
3 Copyright (C) 1997-2009 Sam Lantinga | |
4 | |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
20 slouken@libsdl.org | |
21 */ | |
22 #include "SDL_config.h" | |
23 | |
24 /* | |
25 Milan Xbios video functions | |
26 | |
27 Patrice Mandin | |
28 */ | |
29 | |
30 #include <mint/cookie.h> | |
31 | |
32 #include "SDL_xbios.h" | |
33 #include "SDL_xbios_milan.h" | |
34 | |
35 #ifndef Validmode | |
36 #define Validmode(mode) \ | |
37 (short)trap_14_ww((short)0x5f,(short)(mode)) | |
38 #endif | |
39 | |
40 #define NUM_PREDEFINED_MODES 7 | |
41 | |
42 typedef struct { | |
43 Uint16 width, height; | |
44 } predefined_mode_t; | |
45 | |
46 static const predefined_mode_t mode_list[NUM_PREDEFINED_MODES]={ | |
47 {640,400}, | |
48 {640,480}, | |
49 {800,608}, | |
50 {1024,768}, | |
51 {1152,864}, | |
52 {1280,1024}, | |
53 {1600,1200} | |
54 }; | |
55 | |
56 static const Uint8 mode_bpp[4]={ | |
57 8, 15, 16, 32 | |
58 }; | |
59 | |
4196
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
60 /*--- Variables ---*/ |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
61 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
62 static int enum_actually_add; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
63 static SDL_VideoDevice *enum_this; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
64 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
65 /*--- Functions ---*/ |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
66 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
67 static unsigned long /*cdecl*/ enumfunc(SCREENINFO *inf, unsigned long flag) |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
68 { |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
69 xbiosmode_t modeinfo; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
70 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
71 modeinfo.number = inf->devID; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
72 modeinfo.width = inf->scrWidth; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
73 modeinfo.height = inf->scrHeight; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
74 modeinfo.depth = inf->scrPlanes; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
75 modeinfo.doubleline = SDL_FALSE; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
76 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
77 SDL_XBIOS_AddMode(enum_this, enum_actually_add, &modeinfo); |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
78 |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
79 return ENUMMODE_CONT; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
80 } |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
81 |
4195 | 82 void SDL_XBIOS_ListMilanModes(_THIS, int actually_add) |
83 { | |
84 int i; | |
85 | |
86 /* Read infos about current mode */ | |
87 | |
88 /* Read validated predefined modes */ | |
89 for (i=0; i<NUM_PREDEFINED_MODES; i++) { | |
90 int j; | |
91 Uint16 deviceid = 0x1000 + (i<<4); | |
92 | |
93 for (j=1; j<4; j++) { | |
94 if (Validmode(deviceid + j)) { | |
95 xbiosmode_t modeinfo; | |
96 | |
97 modeinfo.number = deviceid + j; | |
98 modeinfo.width = mode_list[i].width; | |
99 modeinfo.height = mode_list[i].height; | |
100 modeinfo.depth = mode_bpp[j-1]; | |
101 modeinfo.doubleline = SDL_FALSE; | |
102 | |
103 SDL_XBIOS_AddMode(this, actually_add, &modeinfo); | |
104 } | |
105 } | |
106 } | |
107 | |
108 /* Read custom created modes */ | |
4196
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
109 enum_this = this; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
110 enum_actually_add = actually_add; |
89c7562eae9b
Enumerates custom modes
Patrice Mandin <patmandin@gmail.com>
parents:
4195
diff
changeset
|
111 VsetScreen(-1, &enumfunc, MI_MAGIC, CMD_ENUMMODES); |
4195 | 112 } |