segatools/carolhook/touch.h

45 lines
827 B
C
Raw Normal View History

2022-12-11 03:01:52 +00:00
#pragma once
#include <windows.h>
#include <stdbool.h>
#include <stdint.h>
2023-05-31 08:54:38 +00:00
#pragma pack(push, 1)
2022-12-11 03:01:52 +00:00
struct touch_config {
bool enable;
2023-11-28 04:23:00 +00:00
unsigned int port_no;
char board_id[7];
char unit_type[9];
2022-12-11 03:01:52 +00:00
};
// Always starts with 0x01, always ends with 0x0D
2022-12-11 03:01:52 +00:00
struct touch_req {
uint8_t sync; // Always 0x01
uint8_t cmd[256]; // rest of the data goes here
uint8_t tail; // Always 0x0D
size_t data_len; // length of data
2022-12-11 03:01:52 +00:00
};
2023-05-31 08:54:38 +00:00
struct touch_report {
uint8_t status;
2023-11-28 04:23:00 +00:00
uint8_t x1;
uint8_t x2;
uint8_t y1;
uint8_t y2;
2023-05-31 08:54:38 +00:00
uint8_t touch_id;
};
struct touch_auto_resp {
struct touch_report touches[10];
2023-11-28 04:23:00 +00:00
};
enum {
TOUCH_MODE_STREAM = 0x01,
TOUCH_MODE_DOWN_UP = 0x02,
TOUCH_MODE_INACTIVE = 0x03,
2023-05-31 08:54:38 +00:00
};
#pragma pack(pop)
2022-12-11 03:01:52 +00:00
HRESULT touch_hook_init(const struct touch_config *cfg);