mirror of
https://github.com/reactos/reactos.git
synced 2024-07-31 16:48:14 +00:00
[NTVDM]
Implement motion counters in the mouse BIOS. svn path=/trunk/; revision=64136
This commit is contained in:
parent
7b9ecd8232
commit
75c869d7b5
|
@ -85,8 +85,11 @@ static VOID WINAPI BiosMouseService(LPWORD Stack)
|
||||||
/* Reset Driver */
|
/* Reset Driver */
|
||||||
case 0x00:
|
case 0x00:
|
||||||
{
|
{
|
||||||
|
SHORT i;
|
||||||
|
|
||||||
DriverEnabled = TRUE;
|
DriverEnabled = TRUE;
|
||||||
DriverState.ShowCount = 0;
|
DriverState.ShowCount = 0;
|
||||||
|
DriverState.ButtonState = 0;
|
||||||
|
|
||||||
/* Set the default text cursor */
|
/* Set the default text cursor */
|
||||||
DriverState.TextCursor.ScreenMask = 0xFFFF; /* Display everything */
|
DriverState.TextCursor.ScreenMask = 0xFFFF; /* Display everything */
|
||||||
|
@ -130,6 +133,18 @@ static VOID WINAPI BiosMouseService(LPWORD Stack)
|
||||||
DriverState.GraphicsCursor.CursorMask[14] = 0x0030; // 0000000000110000
|
DriverState.GraphicsCursor.CursorMask[14] = 0x0030; // 0000000000110000
|
||||||
DriverState.GraphicsCursor.CursorMask[15] = 0x0000; // 0000000000000000
|
DriverState.GraphicsCursor.CursorMask[15] = 0x0000; // 0000000000000000
|
||||||
|
|
||||||
|
/* Initialize the counters */
|
||||||
|
DriverState.HorizCount = DriverState.VertCount = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_MOUSE_BUTTONS; i++)
|
||||||
|
{
|
||||||
|
DriverState.PressCount[i] = DriverState.ReleaseCount[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initialize the resolution */
|
||||||
|
DriverState.MickeysPerCellHoriz = 8;
|
||||||
|
DriverState.MickeysPerCellVert = 16;
|
||||||
|
|
||||||
/* Return mouse information */
|
/* Return mouse information */
|
||||||
setAX(0xFFFF); // Hardware & driver installed
|
setAX(0xFFFF); // Hardware & driver installed
|
||||||
setBX(NUM_MOUSE_BUTTONS);
|
setBX(NUM_MOUSE_BUTTONS);
|
||||||
|
@ -240,6 +255,27 @@ static VOID WINAPI BiosMouseService(LPWORD Stack)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read Motion Counters */
|
||||||
|
case 0x0B:
|
||||||
|
{
|
||||||
|
setCX(DriverState.HorizCount);
|
||||||
|
setDX(DriverState.VertCount);
|
||||||
|
|
||||||
|
/* Reset the counters */
|
||||||
|
DriverState.HorizCount = DriverState.VertCount = 0;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Define Mickey/Pixel Ratio */
|
||||||
|
case 0x0F:
|
||||||
|
{
|
||||||
|
DriverState.MickeysPerCellHoriz = getCX();
|
||||||
|
DriverState.MickeysPerCellVert = getDX();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Return Driver Storage Requirements */
|
/* Return Driver Storage Requirements */
|
||||||
case 0x15:
|
case 0x15:
|
||||||
{
|
{
|
||||||
|
@ -289,7 +325,15 @@ static VOID WINAPI BiosMouseService(LPWORD Stack)
|
||||||
|
|
||||||
VOID MouseBiosUpdatePosition(PCOORD NewPosition)
|
VOID MouseBiosUpdatePosition(PCOORD NewPosition)
|
||||||
{
|
{
|
||||||
if (DriverEnabled && (DriverState.ShowCount > 0))
|
SHORT DeltaX = NewPosition->X - DriverState.Position.X;
|
||||||
|
SHORT DeltaY = NewPosition->Y - DriverState.Position.Y;
|
||||||
|
|
||||||
|
if (!DriverEnabled) return;
|
||||||
|
|
||||||
|
DriverState.HorizCount += (DeltaX * (SHORT)DriverState.MickeysPerCellHoriz) / 8;
|
||||||
|
DriverState.VertCount += (DeltaY * (SHORT)DriverState.MickeysPerCellVert) / 8;
|
||||||
|
|
||||||
|
if (DriverState.ShowCount > 0)
|
||||||
{
|
{
|
||||||
EraseMouseCursor();
|
EraseMouseCursor();
|
||||||
DriverState.Position = *NewPosition;
|
DriverState.Position = *NewPosition;
|
||||||
|
|
|
@ -35,6 +35,10 @@ typedef struct _MOUSE_DRIVER_STATE
|
||||||
COORD LastPress[NUM_MOUSE_BUTTONS];
|
COORD LastPress[NUM_MOUSE_BUTTONS];
|
||||||
WORD ReleaseCount[NUM_MOUSE_BUTTONS];
|
WORD ReleaseCount[NUM_MOUSE_BUTTONS];
|
||||||
COORD LastRelease[NUM_MOUSE_BUTTONS];
|
COORD LastRelease[NUM_MOUSE_BUTTONS];
|
||||||
|
SHORT HorizCount;
|
||||||
|
SHORT VertCount;
|
||||||
|
WORD MickeysPerCellHoriz;
|
||||||
|
WORD MickeysPerCellVert;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue