mirror of
https://gitea.tendokyu.moe/TeamTofuShop/taitools.git
synced 2026-09-30 18:57:59 +03:00
97 lines
2.3 KiB
C
97 lines
2.3 KiB
C
#include <windows.h>
|
|
#include <xinput.h>
|
|
|
|
#include <limits.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "ll3io/ll3io.h"
|
|
#include "ll3io/config.h"
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
static bool ll3_io_coin = false;
|
|
static bool ll3_io_service = false;
|
|
static uint32_t ll3_coin_ct = 0;
|
|
static struct ll3_input_config cfg;
|
|
|
|
uint16_t ll3_io_get_api_version(void)
|
|
{
|
|
return 0x0100;
|
|
}
|
|
|
|
HRESULT ll3_io_init(void)
|
|
{
|
|
dprintf("ll3 IO: Init\n");
|
|
ll3_io_config_load(&cfg, L".\\taitools.ini");
|
|
return S_OK;
|
|
}
|
|
|
|
void ll3_io_poll(uint16_t *game_btn, uint8_t *sys_btn, uint32_t *coinct)
|
|
{
|
|
if (GetAsyncKeyState(cfg.coin) & 0x8000) {
|
|
*sys_btn |= LL3_SYSBTN_COIN;
|
|
if (!ll3_io_coin) {
|
|
ll3_io_coin = true;
|
|
ll3_coin_ct++;
|
|
}
|
|
} else {
|
|
ll3_io_coin = false;
|
|
}
|
|
|
|
if (GetAsyncKeyState(cfg.service) & 0x8000) {
|
|
*sys_btn |= LL3_SYSBTN_SERVICE;
|
|
if (!ll3_io_service) {
|
|
ll3_io_service = true;
|
|
ll3_coin_ct++;
|
|
}
|
|
} else {
|
|
ll3_io_service = false;
|
|
}
|
|
|
|
*coinct = ll3_coin_ct;
|
|
|
|
if (GetAsyncKeyState(cfg.test) & 0x8000) {
|
|
*sys_btn |= LL3_SYSBTN_TEST;
|
|
}
|
|
if (GetAsyncKeyState(cfg.enter) & 0x8000) {
|
|
*sys_btn |= LL3_SYSBTN_ENTER;
|
|
}
|
|
if (GetAsyncKeyState(cfg.select) & 0x8000) {
|
|
*sys_btn |= LL3_SYSBTN_SELECT;
|
|
}
|
|
|
|
if (GetAsyncKeyState(cfg.btn1) & 0x8000) {
|
|
*game_btn |= LL3_BTN1;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn2) & 0x8000) {
|
|
*game_btn |= LL3_BTN2;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn3) & 0x8000) {
|
|
*game_btn |= LL3_BTN3;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn4) & 0x8000) {
|
|
*game_btn |= LL3_BTN4;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn5) & 0x8000) {
|
|
*game_btn |= LL3_BTN5;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn6) & 0x8000) {
|
|
*game_btn |= LL3_BTN6;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn7) & 0x8000) {
|
|
*game_btn |= LL3_BTN7;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn8) & 0x8000) {
|
|
*game_btn |= LL3_BTN8;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn9) & 0x8000) {
|
|
*game_btn |= LL3_BTN9;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn_cancel) & 0x8000) {
|
|
*game_btn |= LL3_BTN_CANCEL;
|
|
}
|
|
if (GetAsyncKeyState(cfg.btn_decide) & 0x8000) {
|
|
*game_btn |= LL3_BTN_DECIDE;
|
|
}
|
|
} |