[HID] Add touchscreen

This commit is contained in:
wheremyfoodat 2023-06-13 15:44:55 +03:00
parent 5200c10b27
commit 4f619086e9

View file

@ -149,7 +149,12 @@ void HIDService::updateInputs(u64 currentTick) {
writeSharedMem<u64>(0xA8, currentTick); // Write new tick count
}
writeSharedMem<u32>(0xB8, nextTouchscreenIndex); // Index last updated by the HID module
const size_t touchEntryOffset = 0xC8 + (nextTouchscreenIndex * 8); // Offset in the array of 8 touchscreen entries
nextTouchscreenIndex = (nextTouchscreenIndex + 1) % 8; // Move to next entry
writeSharedMem<u16>(touchEntryOffset, touchScreenX);
writeSharedMem<u16>(touchEntryOffset + 2, touchScreenY);
writeSharedMem<u8>(touchEntryOffset + 4, touchScreenPressed ? 1 : 0);
// Next, update accelerometer state
if (nextAccelerometerIndex == 0) {