Mercurial > sdl-ios-xcode
annotate docs/html/sdlcd.html @ 914:bbf8dcc8aed6
Date: Wed, 23 Jun 2004 17:05:33 -0400
From: Chris Nelson
Subject: [SDL] [Patch] WiseGroup MP-8800 / MP-8866 (PS2 Joystick)
In the current cvs version, SDL doesn't handle these Playstation2
controller => USB adapters correctly, in linux.
It will always assume that the maximum number of joysticks (2 in the
case of the MP-8866, 4 in the case of the 8800) are plugged in. This is
bad not only because it allows SDL to exaggerate the number of logical
joysticks, but primarily because the joystick axes are mapped
incorrectly, all over the place, such that the devices are effectively
unusable unless you have the maximum number of joysticks plugged in.
My changes to src/joystick/linux/SDL_sysjoystick.c build on another's
previous work (which was a special case for this very joystick,
actually), and fix both of these problems, as well as making the current
code a little more general, to allow for others to more easily drop in
code for quirky joysticks such as these.
I've tested this code under 2.6.7 as well as 2.4.24... Both work as
advertised (provided you load the JOYDEV linux code as a module,
otherwise they won't work at all, new code or old, but that's another
issue entirely).
Though this sounds horribly formal, you have my permission to distribute
all of my work on this issue under the LGPL. So there.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 25 Jul 2004 18:31:50 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CD</TITLE | |
5 ><META | |
6 NAME="GENERATOR" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+ |
0 | 8 "><LINK |
9 REL="HOME" | |
10 TITLE="SDL Library Documentation" | |
11 HREF="index.html"><LINK | |
12 REL="UP" | |
13 TITLE="CD-ROM" | |
14 HREF="cdrom.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_CDClose" | |
17 HREF="sdlcdclose.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="SDL_CDtrack" | |
20 HREF="sdlcdtrack.html"></HEAD | |
21 ><BODY | |
22 CLASS="REFENTRY" | |
23 BGCOLOR="#FFF8DC" | |
24 TEXT="#000000" | |
25 LINK="#0000ee" | |
26 VLINK="#551a8b" | |
27 ALINK="#ff0000" | |
28 ><DIV | |
29 CLASS="NAVHEADER" | |
30 ><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
31 SUMMARY="Header navigation table" |
0 | 32 WIDTH="100%" |
33 BORDER="0" | |
34 CELLPADDING="0" | |
35 CELLSPACING="0" | |
36 ><TR | |
37 ><TH | |
38 COLSPAN="3" | |
39 ALIGN="center" | |
40 >SDL Library Documentation</TH | |
41 ></TR | |
42 ><TR | |
43 ><TD | |
44 WIDTH="10%" | |
45 ALIGN="left" | |
46 VALIGN="bottom" | |
47 ><A | |
48 HREF="sdlcdclose.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
49 ACCESSKEY="P" |
0 | 50 >Prev</A |
51 ></TD | |
52 ><TD | |
53 WIDTH="80%" | |
54 ALIGN="center" | |
55 VALIGN="bottom" | |
56 ></TD | |
57 ><TD | |
58 WIDTH="10%" | |
59 ALIGN="right" | |
60 VALIGN="bottom" | |
61 ><A | |
62 HREF="sdlcdtrack.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
63 ACCESSKEY="N" |
0 | 64 >Next</A |
65 ></TD | |
66 ></TR | |
67 ></TABLE | |
68 ><HR | |
69 ALIGN="LEFT" | |
70 WIDTH="100%"></DIV | |
71 ><H1 | |
72 ><A | |
73 NAME="SDLCD" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
74 ></A |
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
75 >SDL_CD</H1 |
0 | 76 ><DIV |
77 CLASS="REFNAMEDIV" | |
78 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
79 NAME="AEN7566" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CD -- CDROM Drive Information</DIV | |
84 ><DIV | |
85 CLASS="REFSECT1" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN7569" |
0 | 88 ></A |
89 ><H2 | |
90 >Structure Definition</H2 | |
91 ><PRE | |
92 CLASS="PROGRAMLISTING" | |
93 >typedef struct{ | |
94 int id; | |
95 CDstatus status; | |
96 int numtracks; | |
97 int cur_track; | |
98 int cur_frame; | |
99 SDL_CDtrack track[SDL_MAX_TRACKS+1]; | |
100 } SDL_CD;</PRE | |
101 ></DIV | |
102 ><DIV | |
103 CLASS="REFSECT1" | |
104 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
105 NAME="AEN7572" |
0 | 106 ></A |
107 ><H2 | |
108 >Structure Data</H2 | |
109 ><DIV | |
110 CLASS="INFORMALTABLE" | |
111 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
112 NAME="AEN7574" |
0 | 113 ></A |
114 ><P | |
115 ></P | |
116 ><TABLE | |
117 BORDER="0" | |
118 CLASS="CALSTABLE" | |
119 ><TBODY | |
120 ><TR | |
121 ><TD | |
122 ALIGN="LEFT" | |
123 VALIGN="TOP" | |
124 ><TT | |
125 CLASS="STRUCTFIELD" | |
126 ><I | |
127 >id</I | |
128 ></TT | |
129 ></TD | |
130 ><TD | |
131 ALIGN="LEFT" | |
132 VALIGN="TOP" | |
133 >Private drive identifier</TD | |
134 ></TR | |
135 ><TR | |
136 ><TD | |
137 ALIGN="LEFT" | |
138 VALIGN="TOP" | |
139 ><TT | |
140 CLASS="STRUCTFIELD" | |
141 ><I | |
142 >status</I | |
143 ></TT | |
144 ></TD | |
145 ><TD | |
146 ALIGN="LEFT" | |
147 VALIGN="TOP" | |
148 >Drive <A | |
149 HREF="sdlcdstatus.html" | |
150 >status</A | |
151 ></TD | |
152 ></TR | |
153 ><TR | |
154 ><TD | |
155 ALIGN="LEFT" | |
156 VALIGN="TOP" | |
157 ><TT | |
158 CLASS="STRUCTFIELD" | |
159 ><I | |
160 >numtracks</I | |
161 ></TT | |
162 ></TD | |
163 ><TD | |
164 ALIGN="LEFT" | |
165 VALIGN="TOP" | |
166 >Number of tracks on the CD</TD | |
167 ></TR | |
168 ><TR | |
169 ><TD | |
170 ALIGN="LEFT" | |
171 VALIGN="TOP" | |
172 ><TT | |
173 CLASS="STRUCTFIELD" | |
174 ><I | |
175 >cur_track</I | |
176 ></TT | |
177 ></TD | |
178 ><TD | |
179 ALIGN="LEFT" | |
180 VALIGN="TOP" | |
181 >Current track</TD | |
182 ></TR | |
183 ><TR | |
184 ><TD | |
185 ALIGN="LEFT" | |
186 VALIGN="TOP" | |
187 ><TT | |
188 CLASS="STRUCTFIELD" | |
189 ><I | |
190 >cur_frame</I | |
191 ></TT | |
192 ></TD | |
193 ><TD | |
194 ALIGN="LEFT" | |
195 VALIGN="TOP" | |
196 >Current frame offset within the track</TD | |
197 ></TR | |
198 ><TR | |
199 ><TD | |
200 ALIGN="LEFT" | |
201 VALIGN="TOP" | |
202 ><TT | |
203 CLASS="STRUCTFIELD" | |
204 ><I | |
205 >track</I | |
206 ></TT | |
207 >[SDL_MAX_TRACKS+1]</TD | |
208 ><TD | |
209 ALIGN="LEFT" | |
210 VALIGN="TOP" | |
211 >Array of track descriptions. (see <A | |
212 HREF="sdlcdtrack.html" | |
213 ><SPAN | |
214 CLASS="STRUCTNAME" | |
215 >SDL_CDtrack</SPAN | |
216 ></A | |
217 >)</TD | |
218 ></TR | |
219 ></TBODY | |
220 ></TABLE | |
221 ><P | |
222 ></P | |
223 ></DIV | |
224 ></DIV | |
225 ><DIV | |
226 CLASS="REFSECT1" | |
227 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
228 NAME="AEN7604" |
0 | 229 ></A |
230 ><H2 | |
231 >Description</H2 | |
232 ><P | |
233 >An <SPAN | |
234 CLASS="STRUCTNAME" | |
235 >SDL_CD</SPAN | |
236 > structure is returned by <A | |
237 HREF="sdlcdopen.html" | |
238 ><TT | |
239 CLASS="FUNCTION" | |
240 >SDL_CDOpen</TT | |
241 ></A | |
242 >. It represents an opened CDROM device and stores information on the layout of the tracks on the disc.</P | |
243 ><P | |
244 >A frame is the base data unit of a CD. <TT | |
245 CLASS="LITERAL" | |
246 >CD_FPS</TT | |
247 > frames is equal to 1 second of music. SDL provides two macros for converting between time and frames: <TT | |
248 CLASS="LITERAL" | |
249 >FRAMES_TO_MSF(f, M,S,F)</TT | |
250 > and <TT | |
251 CLASS="LITERAL" | |
252 >MSF_TO_FRAMES</TT | |
253 >.</P | |
254 ></DIV | |
255 ><DIV | |
256 CLASS="REFSECT1" | |
257 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
258 NAME="AEN7614" |
0 | 259 ></A |
260 ><H2 | |
261 >Examples</H2 | |
262 ><PRE | |
263 CLASS="PROGRAMLISTING" | |
264 >int min, sec, frame; | |
265 int frame_offset; | |
266 | |
267 FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame); | |
268 printf("Current Position: %d minutes, %d seconds, %d frames\n", min, sec, frame); | |
269 | |
270 frame_offset=MSF_TO_FRAMES(min, sec, frame);</PRE | |
271 ></DIV | |
272 ><DIV | |
273 CLASS="REFSECT1" | |
274 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
275 NAME="AEN7617" |
0 | 276 ></A |
277 ><H2 | |
278 >See Also</H2 | |
279 ><P | |
280 ><A | |
281 HREF="sdlcdopen.html" | |
282 ><TT | |
283 CLASS="FUNCTION" | |
284 >SDL_CDOpen</TT | |
285 ></A | |
286 >, | |
287 <A | |
288 HREF="sdlcdtrack.html" | |
289 ><SPAN | |
290 CLASS="STRUCTNAME" | |
291 >SDL_CDtrack</SPAN | |
292 ></A | |
293 ></P | |
294 ></DIV | |
295 ><DIV | |
296 CLASS="NAVFOOTER" | |
297 ><HR | |
298 ALIGN="LEFT" | |
299 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
300 SUMMARY="Footer navigation table" |
0 | 301 WIDTH="100%" |
302 BORDER="0" | |
303 CELLPADDING="0" | |
304 CELLSPACING="0" | |
305 ><TR | |
306 ><TD | |
307 WIDTH="33%" | |
308 ALIGN="left" | |
309 VALIGN="top" | |
310 ><A | |
311 HREF="sdlcdclose.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
312 ACCESSKEY="P" |
0 | 313 >Prev</A |
314 ></TD | |
315 ><TD | |
316 WIDTH="34%" | |
317 ALIGN="center" | |
318 VALIGN="top" | |
319 ><A | |
320 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
321 ACCESSKEY="H" |
0 | 322 >Home</A |
323 ></TD | |
324 ><TD | |
325 WIDTH="33%" | |
326 ALIGN="right" | |
327 VALIGN="top" | |
328 ><A | |
329 HREF="sdlcdtrack.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
330 ACCESSKEY="N" |
0 | 331 >Next</A |
332 ></TD | |
333 ></TR | |
334 ><TR | |
335 ><TD | |
336 WIDTH="33%" | |
337 ALIGN="left" | |
338 VALIGN="top" | |
339 >SDL_CDClose</TD | |
340 ><TD | |
341 WIDTH="34%" | |
342 ALIGN="center" | |
343 VALIGN="top" | |
344 ><A | |
345 HREF="cdrom.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
346 ACCESSKEY="U" |
0 | 347 >Up</A |
348 ></TD | |
349 ><TD | |
350 WIDTH="33%" | |
351 ALIGN="right" | |
352 VALIGN="top" | |
353 >SDL_CDtrack</TD | |
354 ></TR | |
355 ></TABLE | |
356 ></DIV | |
357 ></BODY | |
358 ></HTML | |
359 > |