Fix the mouse for Unreal tormnet 2004, it is working now

have not test it to 100%. But hoppfull it is last fix, geting games that need dinput working now with opengl.

svn path=/trunk/; revision=13987
This commit is contained in:
Magnus Olsen 2005-03-13 00:13:07 +00:00
parent 108b495229
commit bc1cb8bf6e

View file

@ -733,7 +733,7 @@ void getmousesvalue(LPDIRECTINPUTDEVICE8A iface)
if (poll_mouse==1) filp=0; if (poll_mouse==1) filp=0;
if (filp==2) filp=0; if (filp==2) filp=0;
if (filp==0) { if (filp==0) {
@ -865,34 +865,28 @@ const int size = sizeof(DIDEVICEOBJECTDATA) * 1;
int count=0; int count=0;
DWORD count_ent=0; DWORD count_ent=0;
static DWORD time=0; static DWORD time=0;
static int save_x; static POINT save_point;
static int save_y; static int save_b[5];
static int save_z; static int b[5];
static int save_b0; static POINT point;
static int save_b1; int count_button;
static int save_b2;
static int save_b3;
static int save_b4;
static int save_b5;
static int save_b6;
int calc;
#endif #endif
TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags); TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
#ifdef __REACTOS__ #ifdef __REACTOS__
save_x = This->m_state.lX;
save_y = This->m_state.lY; if (flags != DIGDD_PEEK)
save_z = This->m_state.lZ; {
save_b0 = This->m_state.rgbButtons[0]; b[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00);
save_b1 = This->m_state.rgbButtons[1]; b[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00);
save_b2 = This->m_state.rgbButtons[2]; b[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00);
save_b3 = This->m_state.rgbButtons[3]; b[3] = ((GetKeyState(VK_XBUTTON1) & 0x80) ? 0xFF : 0x00);
save_b4 = This->m_state.rgbButtons[4]; b[4] = ((GetKeyState(VK_XBUTTON2) & 0x80) ? 0xFF : 0x00);
save_b5 = This->m_state.rgbButtons[5]; GetCursorPos( &point );
save_b6 = This->m_state.rgbButtons[6]; }
getmousesvalue(iface);
#endif #endif
// windows does not get any data if // windows does not get any data if
@ -913,103 +907,72 @@ getmousesvalue(iface);
#ifdef __REACTOS__ #ifdef __REACTOS__
FIXME("This is broken in Tribes, need right implant of the buffer!!!!!!!!\n"); FIXME("This is broken in Tribes ??, need right implant of the buffer!!!!!!!!\n");
if (GetTickCount()-time <50) { if (GetTickCount()-time <50) {
return DI_OK; return DI_OK;
} }
time = GetTickCount(); time = GetTickCount();
if (*entries == 0) return DIERR_INVALIDPARAM; if (*entries == 0) return DIERR_INVALIDPARAM;
last_event++;
for (count=0;count<*entries;count++) { for (count=0;count<*entries;count++) {
if (save_x != This->m_state.lX) { if (save_point.x != point.x) {
dod[count].dwOfs = DIMOFS_X; dod[count_ent].dwOfs = DIMOFS_X;
dod[count].dwData = This->m_state.lX - This->offset_array[0]; dod[count_ent].dwData = point.x - save_point.x;
dod[count].dwTimeStamp = time +1; dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++; dod[count].dwSequence = last_event++;
count_ent++; count_ent++;
save_point.x = point.x;
} }
if (save_y != This->m_state.lY) { if (save_point.y != point.y) {
dod[count].dwOfs = DIMOFS_Y; dod[count].dwOfs = DIMOFS_Y;
dod[count].dwData = This->m_state.lY; dod[count].dwData = point.y - save_point.y;
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_z != This->m_state.lZ) {
dod[count].dwOfs = DIMOFS_Z;
dod[count].dwData = This->m_state.lZ;
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_b0 != This->m_state.rgbButtons[0]) {
dod[count].dwOfs = DIMOFS_BUTTON0;
dod[count].dwData = This->m_state.rgbButtons[0];
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_b1 != This->m_state.rgbButtons[1]) {
dod[count].dwOfs = DIMOFS_BUTTON1;
dod[count].dwData = This->m_state.rgbButtons[1];
dod[count].dwTimeStamp = time +1; dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++; dod[count].dwSequence = last_event++;
count_ent++; count_ent++;
save_point.y = point.y;
} }
for (count_button=0;count_button<5;count_button++)
{
if (save_b[count_button] != b[count_button]) {
if (count_button==0) {
dod[count].dwOfs = DIMOFS_BUTTON0;
}
if (save_b2 != This->m_state.rgbButtons[2]) { if (count_button==1) {
dod[count].dwOfs = DIMOFS_BUTTON2; dod[count].dwOfs = DIMOFS_BUTTON1;
dod[count].dwData = This->m_state.rgbButtons[2]; }
dod[count].dwTimeStamp = time +1; if (count_button==2) {
dod[count].dwSequence = last_event++; dod[count].dwOfs = DIMOFS_BUTTON2;
count_ent++; }
} if (count_button==3) {
dod[count].dwOfs = DIMOFS_BUTTON3;
}
if (count_button==4) {
dod[count].dwOfs = DIMOFS_BUTTON4;
}
if (save_b3 != This->m_state.rgbButtons[3]) { dod[count].dwData = b[count_button];
dod[count].dwOfs = DIMOFS_BUTTON3;
dod[count].dwData = This->m_state.rgbButtons[3];
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_b4 != This->m_state.rgbButtons[4]) {
dod[count].dwOfs = DIMOFS_BUTTON4;
dod[count].dwData = This->m_state.rgbButtons[4];
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_b5 != This->m_state.rgbButtons[5]) {
dod[count].dwOfs = DIMOFS_BUTTON5;
dod[count].dwData = This->m_state.rgbButtons[5];
dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++;
count_ent++;
}
if (save_b6 != This->m_state.rgbButtons[6]) {
dod[count].dwOfs = DIMOFS_BUTTON6;
dod[count].dwData = This->m_state.rgbButtons[6];
dod[count].dwTimeStamp = time +1; dod[count].dwTimeStamp = time +1;
dod[count].dwSequence = last_event++; dod[count].dwSequence = last_event++;
count_ent++; count_ent++;
save_b[count_button] = b[count_button];
} }
}
} // end for } // end for
*entries = count_ent; *entries = count_ent;
#endif #endif
#ifndef __REACTOS__ #ifndef __REACTOS__