Re: [AD] Mouse (DOS and WINDOWS) patches |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Yes, you are right. I didn't checked that piece of code.
sorry...
----- Original Message -----
From: "Eric Botcazou" <ebotcazou@xxxxxxxxxx>
To: "Allegro Conductors" <conductors@xxxxxxxxxx>
Sent: Saturday, December 23, 2000 12:44 PM
Subject: Re: [AD] Mouse (DOS and WINDOWS) patches
> > so, if cx = 8 (that is the mouse default, it's when allegro is given 2)
> and
> > dx = 16 (the mouse default, it's when allegro is given 2) it sets the
> > sensivity to the default
>
> Ok, it's the default for the DOS mouse driver (I mean the TSR program) but
> Allegro's mouse driver uses its own policy.
>
> > so imho, if in the actual code we specify mouse_setspeed(2, 2), cx would
> be
> > 2 and dx would be 2, meanwhile it should be cx = 8 and dx = 16.
> > That's why i've changed that to cx = xspeed * 4 (if it's given 2, its 8)
> and
> > dx = yspeed * 8 (if it's given 2, its 16 as it should be too)
>
> If you look at the default driver (namely the mousedrv_mickeys driver),
> you'll find that (horizontal or vertical) speed is defined as mickey/pixel
> ratio and that the driver actually does all the position tracking.
> The second driver (mousedrv_int33), unlike the previous one, relies on the
> TSR DOS mouse driver for position tracking; but there's a little hitch:
for
> the DOS driver, speed (or sensitivity as set by int33 - function 15) is
> defined as number of mickeys per *8* pixels.
>
> So to be consistent, we have to correct this factor 8:
> - first solution (yours): scaling up the DOS driver sensitivity
>
> static void int33_set_speed(int xspeed, int yspeed)
> {
> __dpmi_regs r;
>
> r.x.ax = 15;
> r.x.cx = xspeed*8;
> r.x.dx = yspeed*8;
> __dpmi_int(0x33, &r);
> }
>
> - second solution (Shawn's): scaling down the DOS driver position output
>
> static void int33_set_range(int x1, int y1, int x2, int y2)
> {
> __dpmi_regs r;
>
> r.x.ax = 7; /* set horizontal range */
> r.x.cx = x1 * 8;
> r.x.dx = x2 * 8;
> __dpmi_int(0x33, &r);
>
> r.x.ax = 8; /* set vertical range */
> r.x.cx = y1 * 8;
> r.x.dx = y2 * 8;
> __dpmi_int(0x33, &r);
>
> r.x.ax = 3; /* check the position */
> __dpmi_int(0x33, &r);
>
> _mouse_x = r.x.cx / 8;
> _mouse_y = r.x.dx / 8;
> }
>
> The code treats 8 DOS driver pixels as 1 Allegro pixel; therefore speed,
> defined as number of mickeys per 8 DOS pixels, is consistent with its
> original definition.
>
> Shawn, am I wrong ?
>
> --
> Eric Botcazou (ebotcazou@xxxxxxxxxx)
> Web Site: http://www.multimania.com/ebotcazou
>
>