<?xml version="1.0"?>
<rss version="2.0">
	<channel>
		<title>Bug? Joystick in OSX</title>
		<link>http://www.allegro.cc/forums/view/592349</link>
		<description>Allegro.cc Forum Thread</description>
		<webMaster>matthew@allegro.cc (Matthew Leverton)</webMaster>
		<lastBuildDate>Sat, 21 Jul 2007 12:53:58 +0000</lastBuildDate>
	</channel>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Unless I&#39;m doing something stupid, I think I&#39;ve found a bug. The JOYSTICK_SIGNED / JOYSTICK_UNSIGNED flags seem to be improperly set. All my sticks report that they are signed, while some of them give position between 0 and 255. (Some give -128 to 128 as expected.)</p><p>I test for the flag with <span class="source-code"><span class="k1">if</span> <span class="k2">(</span><a href="http://www.allegro.cc/manual/joy" target="_blank"><span class="a">joy</span></a><span class="k2">[</span>h<span class="k2">]</span>.stick<span class="k2">[</span>c<span class="k2">]</span>.flags <span class="k3">&amp;</span> JOYFLAG_SIGNED<span class="k2">)</span></span> and check the status with <span class="source-code"><a href="http://www.allegro.cc/manual/joy" target="_blank"><span class="a">joy</span></a><span class="k2">[</span>h<span class="k2">]</span>.stick<span class="k2">[</span>c<span class="k2">]</span>.axis<span class="k2">[</span>w<span class="k2">]</span>.pos</span>. That&#39;s right, isn&#39;t it?</p><p>.</p><p><s>Edit: I <i>was</i> doing something stupid. I wasn&#39;t considering the JOYFLAG_CALIBRATE flag, which was set.</s></p><p>Edit 2: Correction. It doesn&#39;t need to be calibrated. (I did a mistake when checking that flag. Forgot the parentheses.) The original post still stands.</p><p>In case it matters, I&#39;m using a Thrustmaster Dual Power 3 gamepad and Allegro 4.2.1.</p><p>---</p><p>Edit 3: I&#39;ve been looking at the Allegro sources and, while I haven&#39;t tested anything yet, I think I&#39;ve found the bug. In hidjoy.m in the macosx sources, in hid_joy_init, all axis are given the signed flag, while in hid_joy_poll HID_ELEMENT_STANDALONE_AXIS is given unsigned values. I&#39;ll try changing it and report back.</p><p>---</p><p>Edit 4: Yep, that did it. Now I get values that work.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trumgottist)</author>
		<pubDate>Wed, 18 Jul 2007 18:31:38 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Send a patch?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Wed, 18 Jul 2007 19:58:04 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>How?
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trumgottist)</author>
		<pubDate>Wed, 18 Jul 2007 20:19:55 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p><tt>diff -wup oldfile newfile &gt; foo.diff</tt></p><p>-w to ignore whitespace changes<br />-u for unified context, which is what I think everyone prefers<br />-p to show which function the patch is in
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Matthew Leverton)</author>
		<pubDate>Wed, 18 Jul 2007 20:27:31 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Or alternatively, get svn and do:
</p><pre>
svn co <a href="https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/4.2">https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/4.2</a>
svn diff filename &gt; foo.diff
</pre><p>
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Elias)</author>
		<pubDate>Wed, 18 Jul 2007 20:36:03 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>Ok, thanks. I&#39;ll do that tomorrow.</p><p>Edit: Done.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Trumgottist)</author>
		<pubDate>Wed, 18 Jul 2007 21:07:28 +0000</pubDate>
	</item>
	<item>
		<description><![CDATA[<div class="mockup v2"><p>I assume it&#39;s right and committed it.
</p></div>]]>
		</description>
		<author>no-reply@allegro.cc (Peter Wang)</author>
		<pubDate>Sat, 21 Jul 2007 12:53:58 +0000</pubDate>
	</item>
</rss>
