Slot2: Slide Controller fixes
This commit is contained in:
parent
c3cdf8b412
commit
b6cc718d81
|
@ -226,8 +226,10 @@ ISlot2Interface* construct_Slot2_SlideController() { return new Slot2_SlideContr
|
||||||
|
|
||||||
void slideController_updateMotion(s8 x, s8 y)
|
void slideController_updateMotion(s8 x, s8 y)
|
||||||
{
|
{
|
||||||
scRegs[0x03] = (u8)x;
|
if (x || y)
|
||||||
scRegs[0x04] = (u8)y;
|
{
|
||||||
if (scRegs[0x03] || scRegs[0x04])
|
scRegs[0x03] = (u8)x;
|
||||||
scRegs[0x02] |= 0x80;
|
scRegs[0x04] = (u8)y;
|
||||||
|
scRegs[0x02] |= 0x80; //Set motion flag in the motion status register
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2133,12 +2133,13 @@ int _main()
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
RAWINPUTDEVICE rid = {};
|
//Raw input for the Slide Controller add-on
|
||||||
rid.usUsagePage = 0x01;
|
RAWINPUTDEVICE Rid[1];
|
||||||
rid.usUsage = 0x02;
|
Rid[0].usUsagePage = 0x01;
|
||||||
rid.dwFlags = 0;
|
Rid[0].usUsage = 0x02;
|
||||||
rid.hwndTarget = MainWindow->getHWnd();
|
Rid[0].dwFlags = 0x00;
|
||||||
RegisterRawInputDevices(&rid, 1, sizeof(rid));
|
Rid[0].hwndTarget = MainWindow->getHWnd();
|
||||||
|
RegisterRawInputDevices(Rid, 1, sizeof(Rid[0]));
|
||||||
|
|
||||||
//disable wacky stylus stuff
|
//disable wacky stylus stuff
|
||||||
//TODO - we are obliged to call GlobalDeleteAtom
|
//TODO - we are obliged to call GlobalDeleteAtom
|
||||||
|
@ -4529,24 +4530,24 @@ DOKEYDOWN:
|
||||||
{
|
{
|
||||||
if (SlideController.Enabled)
|
if (SlideController.Enabled)
|
||||||
{
|
{
|
||||||
UINT dataSize;
|
UINT dwSize = sizeof(RAWINPUT);
|
||||||
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dataSize, sizeof(RAWINPUTHEADER));
|
static BYTE lpb[sizeof(RAWINPUT)];
|
||||||
LPBYTE rawdata = new BYTE[dataSize];
|
|
||||||
if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, rawdata, &dataSize, sizeof(RAWINPUTHEADER)) == dataSize)
|
GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, sizeof(RAWINPUTHEADER));
|
||||||
|
|
||||||
|
RAWINPUT* raw = (RAWINPUT*)lpb;
|
||||||
|
|
||||||
|
if (raw->header.dwType == RIM_TYPEMOUSE)
|
||||||
{
|
{
|
||||||
RAWINPUT* raw = (RAWINPUT*)rawdata;
|
int xMotion = raw->data.mouse.lLastX;
|
||||||
if (raw->header.dwType == RIM_TYPEMOUSE)
|
int yMotion = raw->data.mouse.lLastY;
|
||||||
{
|
xMotion = max(-127, min(xMotion, 127));
|
||||||
LONG xMotion = raw->data.mouse.lLastX;
|
yMotion = max(-127, min(yMotion, 127));
|
||||||
LONG yMotion = raw->data.mouse.lLastY;
|
slideController_updateMotion(xMotion, -yMotion);
|
||||||
xMotion = max((LONG)-127, min(xMotion, (LONG)127));
|
|
||||||
yMotion = max((LONG)-127, min(yMotion, (LONG)127));
|
|
||||||
slideController_updateMotion(xMotion, -yMotion);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
if(HIWORD(wParam) == 0 || HIWORD(wParam) == 1)
|
if(HIWORD(wParam) == 0 || HIWORD(wParam) == 1)
|
||||||
|
|
Loading…
Reference in New Issue