From 25a532347b4c4b7d1bc41f1bc95be1741a16aa8f Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Wed, 23 Feb 2022 02:44:23 -0500 Subject: [PATCH] non-working coin insert emulation --- dist/mercury/segatools.ini | 1 + mercuryhook/io4.c | 4 ++++ mercuryio/config.c | 1 + mercuryio/config.h | 1 + mercuryio/mercuryio.c | 4 ++++ mercuryio/mercuryio.h | 1 + 6 files changed, 12 insertions(+) diff --git a/dist/mercury/segatools.ini b/dist/mercury/segatools.ini index f71bfae..0b9ffdd 100644 --- a/dist/mercury/segatools.ini +++ b/dist/mercury/segatools.ini @@ -39,6 +39,7 @@ enable=1 ; Input API selection for JVS input emulator. test=0x2D service=0x2E +coin=0x24 volup=0x26 voldown=0x28 diff --git a/mercuryhook/io4.c b/mercuryhook/io4.c index f178ab9..fa146db 100644 --- a/mercuryhook/io4.c +++ b/mercuryhook/io4.c @@ -61,6 +61,10 @@ static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state) if (opbtn & MERCURY_IO_OPBTN_SERVICE) { state->buttons[0] |= IO4_BUTTON_SERVICE; + } + + if (gamebtn & MERCURY_IO_OPBTN_COIN) { + state->chutes[0] |= 1 << 1; // FIXME: insert coins } if (gamebtn & MERCURY_IO_GAMEBTN_VOL_UP) { diff --git a/mercuryio/config.c b/mercuryio/config.c index 6e67e42..f3c8e54 100644 --- a/mercuryio/config.c +++ b/mercuryio/config.c @@ -29,6 +29,7 @@ void mercury_io_config_load( cfg->vk_test = GetPrivateProfileIntW(L"io4", L"test", 0x2D, filename); cfg->vk_service = GetPrivateProfileIntW(L"io4", L"service", 0x2E, filename); + cfg->vk_coin = GetPrivateProfileIntW(L"io4", L"coin", 0x24, filename); cfg->vk_vol_up = GetPrivateProfileIntW(L"io4", L"volup", 0x26, filename); cfg->vk_vol_down = GetPrivateProfileIntW(L"io4", L"voldown", 0x28, filename); diff --git a/mercuryio/config.h b/mercuryio/config.h index 18ff5de..c925764 100644 --- a/mercuryio/config.h +++ b/mercuryio/config.h @@ -8,6 +8,7 @@ struct mercury_io_config { uint8_t vk_test; uint8_t vk_service; + uint8_t vk_coin; uint8_t vk_vol_up; uint8_t vk_vol_down; uint8_t vk_cell[240]; diff --git a/mercuryio/mercuryio.c b/mercuryio/mercuryio.c index 75ee77d..9ad755b 100644 --- a/mercuryio/mercuryio.c +++ b/mercuryio/mercuryio.c @@ -40,6 +40,10 @@ HRESULT mercury_io_poll(void) mercury_opbtn |= MERCURY_IO_OPBTN_SERVICE; } + if (GetAsyncKeyState(mercury_io_cfg.vk_coin)) { + mercury_opbtn |= MERCURY_IO_OPBTN_COIN; + } + if (GetAsyncKeyState(mercury_io_cfg.vk_vol_up)) { mercury_gamebtn |= MERCURY_IO_GAMEBTN_VOL_UP; } diff --git a/mercuryio/mercuryio.h b/mercuryio/mercuryio.h index 4b36dee..2701ec4 100644 --- a/mercuryio/mercuryio.h +++ b/mercuryio/mercuryio.h @@ -7,6 +7,7 @@ enum { MERCURY_IO_OPBTN_TEST = 0x01, MERCURY_IO_OPBTN_SERVICE = 0x02, + MERCURY_IO_OPBTN_COIN = 0x04, }; enum {