Re: [AD] BeOS joystick, Gnome Panel

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


* George Foot (gfoot@xxxxxxxxxx) wrote:
> On Fri, Apr 13, 2001 at 12:05:48AM -0700, Joshua Haberman wrote:
> > I'm not sure why Open() returns 3 -- the API docs say that functions
> > should return 0 on no error, or a negative number corresponding to an
> > error code, so I'm not sure how to interpret "3" -- in any case,
> > CountSticks() is documented to return "the number of joysticks connected
> > to the opened game port."
> 
> Maybe 3 is still an error code, and the reason CountSticks
> returns 1 is that the port wasn't properly opened in the first
> place.

It's possible but seems unlikely, as far as I can tell, for two reasons:

1. The API docs very clearly state that error codes are negative:

    All Be error constants except for B_OK (B_NO_ERROR) are negative
    integers; any function that returns an error code can thus be lazily
    tested for success or failure by 
    the following: 
        if ( funcCall() < B_NO_ERROR ) 
            /* failure */ 
        else 
            /* success */

2. The Be error constants are all defined as enums in
   <support/Errors.h>, and they all start counting at much less than 0

On the other hand, 3 definitely is not 0, which is what B_OK and
B_NO_ERROR are defined to be. Perhaps Allegro should specifically test
for equality with B_OK?

> What is the return code when you actually have a joystick plugged in

I wish I could tell you, but the only joystick I have (a Microsoft
Sidewinder 3d pro) isn't detected by BeOS in the Joystick preferences.
Should it at least work with generic analog drivers though? I don't know
anything about joysticks.

> and which step fails if you disable the joystick ports?

BJoystick::CountDevices() (correctly) returns 0:

$ ./test
CountDevices(): 0
GetDeviceName(): -2147483645 (B_OK: 0)
The Device Name: p
Open(): -2147459069
CountSticks(): 1  

Notice the Open() attempt on the invalid port gives a negative result.

However, CountSticks() still returns 1. This gives credibility to your
theory that the 3 from earlier is an error, and CountSticks() just
(stupidly) returns 1 on a port that hasn't been opened correctly. I
modified the above test program to do nothing but call CountSticks(),
and it returned 1 as well.

It would be helpful if someone else could test this on another Be
machine, especially one with a working joystick.

> One of the two.  The main difference between now and then is
> that now he is neither a student (like when Allegro started) nor
> in a crap job (like two years ago, during the initial work
> towards Allegro 4). :)  He gets plenty of interesting things to
> do at work (and does more than enough tech support for the other
> people using his tools), and probably doesn't much feel like
> programming (or discussing things) when he gets home as well.
> It's possible that over time, under these circumstances, his
> interest in Allegro has diminished too.

So are you taking on the majority of the development? How many people
are actively working on Allegro at the moment?

BTW, your AllegroGL looks very exciting! When can we expect a stable
API?

Joshua

-- 
Joshua Haberman                                        <joshua@xxxxxxxxxx>
University of Puget Sound                                <joshua@xxxxxxxxxx>
http://www.reverberate.org                               <jhaberman@xxxxxxxxxx>



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/