rem: if (buttons != 0) { if (sButtonsState == 0) { if (sLastClickTime + sClickSpeed > currentTime) sClickCount++; else sClickCount = 1; } }  sLastClickTime = currentTime; sButtonsState = buttons;  if (sPacketSize == PS2_PACKET_INTELLIMOUSE) { switch (packet[3] & 0x0F) {
add: if (buttons != 0 && sButtonsState == 0) { if (sLastClickTime + sClickSpeed > currentTime) sClickCount++; else sClickCount = 1; }  sLastClickTime = currentTime; sButtonsState = buttons;  if (sPacketSize == PS2_PACKET_INTELLIMOUSE) { switch (packet[3] & 0x0F) {
context: ps2_packet_to_movement(uint8 packet[], mouse_movement *pos){	int buttons = packet[0] & 7;	int xDelta = ((packet[0] & 0x10) ? 0xFFFFFF00 : 0) | packet[1];	int yDelta = ((packet[0] & 0x20) ? 0xFFFFFF00 : 0) | packet[2];  	bigtime_t currentTime = system_time();	int8 wheel_ydelta = 0;	int8 wheel_xdelta = 0;  	  	if (buttons != 0) {  		if (sButtonsState == 0) {  			if (sLastClickTime + sClickSpeed > currentTime)  				sClickCount++;  			else  				sClickCount = 1;  		}  	}  	  	sLastClickTime = currentTime;  	sButtonsState = buttons;  	  	if (sPacketSize == PS2_PACKET_INTELLIMOUSE) {   		 switch (packet[3] & 0x0F) {			case 0x01: wheel_ydelta = +1; break; // wheel 1 down			case 0x0F: wheel_ydelta = -1; break; // wheel 1 up			case 0x02: wheel_xdelta = +1; break; // wheel 2 down			case 0x0E: wheel_xdelta = -1; break; // wheel 2 up		}  	}  	  	if (pos) {		pos->xdelta = xDelta;		pos->ydelta = yDelta;		pos->buttons = buttons;		pos->clicks = sClickCount;		pos->modifiers = 0;		pos->timestamp = currentTime;		pos->wheel_ydelta = (int)wheel_ydelta;		pos->wheel_xdelta = (int)wheel_xdelta;		TRACE(("xdelta: %d, ydelta: %d, buttons %x, clicks: %d, timestamp %Ld\n", xDelta, yDelta, buttons, sClickCount, currentTime));	}}