70 lines
1.4 KiB
C
70 lines
1.4 KiB
C
#include <windows.h>
|
|
#include <xinput.h>
|
|
|
|
#include <limits.h>
|
|
#include <stdint.h>
|
|
#include <stdbool.h>
|
|
|
|
#include "tekkenio/tekkenio.h"
|
|
#include "tekkenio/config.h"
|
|
|
|
#include "util/dprintf.h"
|
|
|
|
static bool tekken_io_coin = false;
|
|
static bool tekken_test_toggle = false;
|
|
static uint16_t tekken_coin_ct = 0;
|
|
static struct tekken_najv4_config najv4_cfg;
|
|
|
|
uint16_t tekken_io_get_api_version(void)
|
|
{
|
|
return 0x0100;
|
|
}
|
|
|
|
HRESULT tekken_io_jvs_init(void)
|
|
{
|
|
dprintf("Tekken IO: JVS Init\n");
|
|
tekken_io_najv4_config_load(&najv4_cfg, L".\\bananatools.ini");
|
|
return S_OK;
|
|
}
|
|
|
|
HRESULT tekken_io_jvs_poll(uint8_t *opbtn)
|
|
{
|
|
*opbtn = 0;
|
|
|
|
if ((GetAsyncKeyState(najv4_cfg.test) & 0x8000)) {
|
|
*opbtn |= TEKKEN_IO_OPBTN_TEST;
|
|
}
|
|
|
|
if (GetAsyncKeyState(najv4_cfg.service) & 0x8000) {
|
|
*opbtn |= TEKKEN_IO_OPBTN_SERVICE;
|
|
}
|
|
|
|
if (GetAsyncKeyState(najv4_cfg.up) & 0x8000) {
|
|
*opbtn |= TEKKEN_IO_OPBTN_UP;
|
|
}
|
|
|
|
if (GetAsyncKeyState(najv4_cfg.down) & 0x8000) {
|
|
*opbtn |= TEKKEN_IO_OPBTN_DOWN;
|
|
}
|
|
|
|
if (GetAsyncKeyState(najv4_cfg.enter) & 0x8000) {
|
|
*opbtn |= TEKKEN_IO_OPBTN_ENTER;
|
|
}
|
|
|
|
return S_OK;
|
|
}
|
|
|
|
void tekken_io_jvs_read_coin_counter(uint16_t *coins)
|
|
{
|
|
if (GetAsyncKeyState(VK_INSERT) & 0x8000) {
|
|
if (!tekken_io_coin) {
|
|
tekken_io_coin = true;
|
|
tekken_coin_ct++;
|
|
}
|
|
} else {
|
|
tekken_io_coin = false;
|
|
}
|
|
|
|
*coins = tekken_coin_ct;
|
|
}
|