Mercurial > sdl-ios-xcode
annotate docs/html/sdlcondwaittimeout.html @ 892:dc29e5907694
Date: Sun, 18 Apr 2004 16:09:53 -0400 (EDT)
From: David MacCormack
Subject: [SDL] Linux joystick patch
I recently got myself a PS2 -> USB converter (a super joybox 5). It
accepts 4 PSX/PS2 controllers. It's implemented as a HID, which is nice
because it doesn't require its own driver, but the problem is that it's
implemented as a *single* HID -- that is, it shows up as a single
joystick with 19 axes, 4 hats, and 48 buttons. This poses a problem for a
number of apps which use SDL (stella, fce ultra, zsnes, to name a few) and
see only a single (physical) joystick even though there are really 4
(logical) joysticks. There are a number of these types of devices on the
market, and I've seen others post messages (in the zsnes forum, for
example) with the same problem, so I came up with what I think is a pretty
generic solution.
I patched src/joystick/linux/SDL_sysjoystic.c to include support for
logical joysticks; basically, it's a static array and supporting functions
that map a single physical joystick to multiple logical joysticks. The
attached patch has the new code. It's wrapped inside #ifndef
statements so that you can get the old behavior if you want.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 16 May 2004 18:46:24 +0000 |
parents | 355632dca928 |
children |
rev | line source |
---|---|
0 | 1 <HTML |
2 ><HEAD | |
3 ><TITLE | |
4 >SDL_CondWaitTimeout</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="Multi-threaded Programming" | |
14 HREF="thread.html"><LINK | |
15 REL="PREVIOUS" | |
16 TITLE="SDL_CondWait" | |
17 HREF="sdlcondwait.html"><LINK | |
18 REL="NEXT" | |
19 TITLE="Time" | |
20 HREF="time.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="sdlcondwait.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="time.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="SDLCONDWAITTIMEOUT" | |
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_CondWaitTimeout</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="AEN8393" |
0 | 80 ></A |
81 ><H2 | |
82 >Name</H2 | |
83 >SDL_CondWaitTimeout -- Wait on a condition variable, with timeout</DIV | |
84 ><DIV | |
85 CLASS="REFSYNOPSISDIV" | |
86 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
87 NAME="AEN8396" |
0 | 88 ></A |
89 ><H2 | |
90 >Synopsis</H2 | |
91 ><DIV | |
92 CLASS="FUNCSYNOPSIS" | |
93 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
94 NAME="AEN8397" |
0 | 95 ></A |
96 ><P | |
97 ></P | |
98 ><PRE | |
99 CLASS="FUNCSYNOPSISINFO" | |
100 >#include "SDL.h" | |
101 #include "SDL_thread.h"</PRE | |
102 ><P | |
103 ><CODE | |
104 ><CODE | |
105 CLASS="FUNCDEF" | |
106 >int <B | |
107 CLASS="FSFUNC" | |
108 >SDL_CondWaitTimeout</B | |
109 ></CODE | |
110 >(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);</CODE | |
111 ></P | |
112 ><P | |
113 ></P | |
114 ></DIV | |
115 ></DIV | |
116 ><DIV | |
117 CLASS="REFSECT1" | |
118 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
119 NAME="AEN8403" |
0 | 120 ></A |
121 ><H2 | |
122 >Description</H2 | |
123 ><P | |
124 >Wait on the condition variable <TT | |
125 CLASS="PARAMETER" | |
126 ><I | |
127 >cond</I | |
128 ></TT | |
129 > for, at most, <TT | |
130 CLASS="PARAMETER" | |
131 ><I | |
132 >ms</I | |
133 ></TT | |
134 > milliseconds. <TT | |
135 CLASS="PARAMETER" | |
136 ><I | |
137 >mut</I | |
138 ></TT | |
139 > is unlocked so it must be locked when the function is called. Returns <TT | |
140 CLASS="LITERAL" | |
141 >SDL_MUTEX_TIMEDOUT</TT | |
142 > if the condition is not signalled in the allotted time, <SPAN | |
143 CLASS="RETURNVALUE" | |
144 >0</SPAN | |
145 > if it was signalled or <SPAN | |
146 CLASS="RETURNVALUE" | |
147 >-1</SPAN | |
148 > on an error.</P | |
149 ></DIV | |
150 ><DIV | |
151 CLASS="REFSECT1" | |
152 ><A | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
153 NAME="AEN8412" |
0 | 154 ></A |
155 ><H2 | |
156 >See Also</H2 | |
157 ><P | |
158 ><A | |
159 HREF="sdlcondwait.html" | |
160 ><TT | |
161 CLASS="FUNCTION" | |
162 >SDL_CondWait</TT | |
163 ></A | |
164 ></P | |
165 ></DIV | |
166 ><DIV | |
167 CLASS="NAVFOOTER" | |
168 ><HR | |
169 ALIGN="LEFT" | |
170 WIDTH="100%"><TABLE | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
171 SUMMARY="Footer navigation table" |
0 | 172 WIDTH="100%" |
173 BORDER="0" | |
174 CELLPADDING="0" | |
175 CELLSPACING="0" | |
176 ><TR | |
177 ><TD | |
178 WIDTH="33%" | |
179 ALIGN="left" | |
180 VALIGN="top" | |
181 ><A | |
182 HREF="sdlcondwait.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
183 ACCESSKEY="P" |
0 | 184 >Prev</A |
185 ></TD | |
186 ><TD | |
187 WIDTH="34%" | |
188 ALIGN="center" | |
189 VALIGN="top" | |
190 ><A | |
191 HREF="index.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
192 ACCESSKEY="H" |
0 | 193 >Home</A |
194 ></TD | |
195 ><TD | |
196 WIDTH="33%" | |
197 ALIGN="right" | |
198 VALIGN="top" | |
199 ><A | |
200 HREF="time.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
201 ACCESSKEY="N" |
0 | 202 >Next</A |
203 ></TD | |
204 ></TR | |
205 ><TR | |
206 ><TD | |
207 WIDTH="33%" | |
208 ALIGN="left" | |
209 VALIGN="top" | |
210 >SDL_CondWait</TD | |
211 ><TD | |
212 WIDTH="34%" | |
213 ALIGN="center" | |
214 VALIGN="top" | |
215 ><A | |
216 HREF="thread.html" | |
803
355632dca928
Updated SDL HTML documentation
Sam Lantinga <slouken@libsdl.org>
parents:
181
diff
changeset
|
217 ACCESSKEY="U" |
0 | 218 >Up</A |
219 ></TD | |
220 ><TD | |
221 WIDTH="33%" | |
222 ALIGN="right" | |
223 VALIGN="top" | |
224 >Time</TD | |
225 ></TR | |
226 ></TABLE | |
227 ></DIV | |
228 ></BODY | |
229 ></HTML | |
230 > |