forked from TeamTofuShop/segatools
In this PR, I have added the `mai2` touch and `led15070` hooks to provide an example for handling custom peripherals. This change allows users to implement the touch and `led15070` logic by writing appropriate `mai2io` scripts. #### **Touch Hook**: - The touch hook simulates touch points based on keyboard combinations. For example, to trigger the A1 touch point, the user must press the A and 1 keys on the keyboard. Input for the 1p requires Caps Lock to be off, while 2p requires Caps Lock to be on. - The hook allows for independent control of whether device simulation is enabled for "1p" and "2p" and whether keyboard input mapping is enabled. - **Note**: The current touch hook is not yet functional as it requires modifications to the `capnhook` for proper completion of the `sinmai` hook. #### **LED15070 Hook**: - This hook implements basic device simulation. Peripherals requiring lighting data should complete the logic as needed. - **Note**: The LED data refresh can flood the console logs, so I’ve added a `DEBUG` flag to control whether the debug logging is enabled or not. #### **Other Changes**: - In certain versions of `sinmai`, key inputs for 1p and 2p can be directly read from the keyboard without requiring simulation via the `amdaemon io4` hook. I’ve added a switch to control this behavior to prevent redundant input. - **Benefit**: This ensures that key input is only read when `sinmai` is in the foreground. If you'd like to learn more about the touch and `led15070` features, my research findings are available here: [Mai2Touch](https://github.com/Sucareto/Mai2Touch) Co-authored-by: Sucareto <28331534+Sucareto@users.noreply.github.com> Reviewed-on: TeamTofuShop/segatools#55 Co-authored-by: Mahuyo <mahuyo@noreply.gitea.tendokyu.moe> Co-committed-by: Mahuyo <mahuyo@noreply.gitea.tendokyu.moe>
29 lines
772 B
C
29 lines
772 B
C
#pragma once
|
|
|
|
#include <windows.h>
|
|
|
|
#include "mai2io/mai2io.h"
|
|
|
|
struct mai2_dll {
|
|
uint16_t api_version;
|
|
HRESULT (*init)(void);
|
|
HRESULT (*poll)(void);
|
|
void (*get_opbtns)(uint8_t *opbtn);
|
|
void (*get_gamebtns)(uint16_t *player1, uint16_t *player2);
|
|
HRESULT (*touch_init)(mai2_io_touch_callback_t callback);
|
|
void (*touch_set_sens)(uint8_t *bytes);
|
|
void (*touch_update)(bool player1, bool player2);
|
|
HRESULT (*led_init)(void);
|
|
void (*led_set_fet_output)(const uint8_t *rgb);
|
|
void (*led_dc_update)(const uint8_t *rgb);
|
|
void (*led_gs_update)(const uint8_t *rgb);
|
|
};
|
|
|
|
struct mai2_dll_config {
|
|
wchar_t path[MAX_PATH];
|
|
};
|
|
|
|
extern struct mai2_dll mai2_dll;
|
|
|
|
HRESULT mai2_dll_init(const struct mai2_dll_config *cfg, HINSTANCE self);
|