Skip to content

Commit

Permalink
Update movement data when merging records
Browse files Browse the repository at this point in the history
  • Loading branch information
elishacloud committed Jun 26, 2024
1 parent 5635abf commit 86fd6fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dllmain/BuildNo.rc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define BUILD_NUMBER 7065
#define BUILD_NUMBER 7066
10 changes: 9 additions & 1 deletion dinput8/IDirectInputDevice8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,19 @@ HRESULT m_IDirectInputDevice8::GetMouseDeviceData(DWORD cbObjectData, LPDIDEVICE
lpdod->dwOfs == DIMOFS_Y ? 1 :
lpdod->dwOfs == DIMOFS_Z ? 2 : 0;

// Check for existing data and that direction has not changed
// Check if record should be merged, if there is an existing record and the movement direction has not changed
if (isSet[v] && !((dod[Loc[v]].lData < 0 && (LONG)lpdod->dwData > 0) || (dod[Loc[v]].lData > 0 && (LONG)lpdod->dwData < 0)))
{
// Updating movement data (merging records)
dod[Loc[v]].lData += (LONG)lpdod->dwData;
dod[Loc[v]].dwTimeStamp = lpdod->dwTimeStamp;
dod[Loc[v]].dwSequence = lpdod->dwSequence;
if (cbObjectData == sizeof(DIDEVICEOBJECTDATA))
{
dod[Loc[v]].uAppData = lpdod->uAppData;
}
}
// Storing new movement data
else
{
dod.push_back({ (LONG)lpdod->dwData, lpdod->dwOfs, lpdod->dwTimeStamp, lpdod->dwSequence, (cbObjectData == sizeof(DIDEVICEOBJECTDATA)) ? lpdod->uAppData : NULL });
Expand Down

0 comments on commit 86fd6fa

Please sign in to comment.