mirror of
https://gitea.tendokyu.moe/TeamTofuShop/taitools.git
synced 2026-09-27 09:23:05 +03:00
76 lines
1.5 KiB
C
76 lines
1.5 KiB
C
#include <windows.h>
|
|
|
|
#include <limits.h>
|
|
#include <stdint.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "sivaio/sivaio.h"
|
|
#include "sivaio/config.h"
|
|
#include "ri/ri.h"
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
static bool siva_io_coin = false;
|
|
static bool siva_io_service = false;
|
|
static uint16_t siva_coin_ct = 0;
|
|
static uint16_t siva_service_ct = 0;
|
|
static struct siva_input_config cfg;
|
|
|
|
uint16_t siva_io_get_api_version(void)
|
|
{
|
|
return 0x0100;
|
|
}
|
|
|
|
HRESULT siva_io_init(void)
|
|
{
|
|
dprintf("Siva IO: Init\n");
|
|
siva_io_config_load(&cfg, L".\\taitools.ini");
|
|
|
|
if (cfg.is_ri) {
|
|
return ri_init(cfg.device_num);
|
|
}
|
|
return S_OK;
|
|
}
|
|
|
|
void siva_io_get_btns(uint8_t *btn, uint8_t *stick)
|
|
{
|
|
|
|
if (GetAsyncKeyState(VK_MENU) && GetAsyncKeyState(VK_F4)) {
|
|
ri_exit();
|
|
return;
|
|
}
|
|
|
|
if (GetAsyncKeyState(cfg.test) & 0x8000) {
|
|
*btn |= BTN_TEST;
|
|
}
|
|
|
|
if (GetAsyncKeyState(cfg.service) & 0x8000) {
|
|
*btn |= BTN_SERVICE;
|
|
}
|
|
|
|
}
|
|
|
|
void siva_io_read_coin_counter(uint16_t *coins, uint16_t *services)
|
|
{
|
|
if (GetAsyncKeyState(cfg.coin) & 0x8000) {
|
|
if (!siva_io_coin) {
|
|
siva_io_coin = true;
|
|
siva_coin_ct++;
|
|
}
|
|
} else {
|
|
siva_io_coin = false;
|
|
}
|
|
|
|
if (GetAsyncKeyState(cfg.service) & 0x8000) {
|
|
if (!siva_io_service) {
|
|
siva_io_service = true;
|
|
siva_service_ct++;
|
|
}
|
|
} else {
|
|
siva_io_service = false;
|
|
}
|
|
|
|
*coins = siva_coin_ct;
|
|
*services = siva_service_ct;
|
|
} |