diff --git a/board/io3.c b/board/io3.c index 34a1781..c2664eb 100644 --- a/board/io3.c +++ b/board/io3.c @@ -454,8 +454,8 @@ static HRESULT io3_cmd_read_coin( /* Write slot detail */ for (i = 0 ; i < req.nslots ; i++) { - if (io3->ops->consume_coins != NULL) { - ncoins = io3->ops->consume_coins(io3->ops_ctx, i); + if (io3->ops->read_coin_counter != NULL) { + ncoins = io3->ops->read_coin_counter(io3->ops_ctx, i); } else { ncoins = 0; } diff --git a/board/io3.h b/board/io3.h index c34c2db..0d6df07 100644 --- a/board/io3.h +++ b/board/io3.h @@ -18,7 +18,7 @@ struct io3_ops { void (*write_gpio)(void *ctx, uint32_t state); void (*read_switches)(void *ctx, struct io3_switch_state *out); uint16_t (*read_analog)(void *ctx, uint8_t analog_no); - uint16_t (*consume_coins)(void *ctx, uint8_t slot_no); + uint16_t (*read_coin_counter)(void *ctx, uint8_t slot_no); }; struct io3 { diff --git a/chunihook/jvs.c b/chunihook/jvs.c index b46e844..5f1d386 100644 --- a/chunihook/jvs.c +++ b/chunihook/jvs.c @@ -14,16 +14,17 @@ #include "util/dprintf.h" static void chunithm_jvs_read_switches(void *ctx, struct io3_switch_state *out); -static uint16_t chunithm_jvs_consume_coins(void *ctx, uint8_t slot_no); +static uint16_t chunithm_jvs_read_coin_counter(void *ctx, uint8_t slot_no); static const struct io3_ops chunithm_jvs_io3_ops = { - .read_switches = chunithm_jvs_read_switches, - .consume_coins = chunithm_jvs_consume_coins, + .read_switches = chunithm_jvs_read_switches, + .read_coin_counter = chunithm_jvs_read_coin_counter, }; static struct io3 chunithm_jvs_io3; static size_t chunithm_jvs_rise_pos; static bool chunithm_jvs_coin; +static uint16_t chunithm_jvs_coins; void chunithm_jvs_init(void) { @@ -74,24 +75,21 @@ static void chunithm_jvs_read_switches(void *ctx, struct io3_switch_state *out) } } -static uint16_t chunithm_jvs_consume_coins(void *ctx, uint8_t slot_no) +static uint16_t chunithm_jvs_read_coin_counter(void *ctx, uint8_t slot_no) { if (slot_no > 0) { return 0; } if (GetAsyncKeyState('3')) { - if (chunithm_jvs_coin) { - return 0; - } else { + if (!chunithm_jvs_coin) { dprintf("Chunithm JVS: Coin drop\n"); chunithm_jvs_coin = true; - - return 1; + chunithm_jvs_coins++; } } else { chunithm_jvs_coin = false; - - return 0; } + + return chunithm_jvs_coins; } diff --git a/divahook/jvs.c b/divahook/jvs.c index b25cbaa..d66f433 100644 --- a/divahook/jvs.c +++ b/divahook/jvs.c @@ -13,15 +13,16 @@ #include "util/dprintf.h" static void diva_jvs_read_switches(void *ctx, struct io3_switch_state *out); -static uint16_t diva_jvs_consume_coins(void *ctx, uint8_t slot_no); +static uint16_t diva_jvs_read_coin_counter(void *ctx, uint8_t slot_no); static const struct io3_ops diva_jvs_io3_ops = { - .read_switches = diva_jvs_read_switches, - .consume_coins = diva_jvs_consume_coins, + .read_switches = diva_jvs_read_switches, + .read_coin_counter = diva_jvs_read_coin_counter, }; static struct io3 diva_jvs_io3; static bool diva_jvs_coin; +static uint16_t diva_jvs_coins; void diva_jvs_init(void) { @@ -70,24 +71,21 @@ static void diva_jvs_read_switches(void *ctx, struct io3_switch_state *out) } } -static uint16_t diva_jvs_consume_coins(void *ctx, uint8_t slot_no) +static uint16_t diva_jvs_read_coin_counter(void *ctx, uint8_t slot_no) { if (slot_no > 0) { return 0; } if (GetAsyncKeyState('3')) { - if (diva_jvs_coin) { - return 0; - } else { + if (!diva_jvs_coin) { dprintf("Diva JVS: Coin drop\n"); diva_jvs_coin = true; - - return 1; + diva_jvs_coins++; } } else { diva_jvs_coin = false; - - return 0; } + + return diva_jvs_coins; } diff --git a/idzhook/jvs.c b/idzhook/jvs.c index 3bb6402..0ad8f63 100644 --- a/idzhook/jvs.c +++ b/idzhook/jvs.c @@ -19,16 +19,17 @@ static void idz_jvs_read_switches(void *ctx, struct io3_switch_state *out); static uint16_t idz_jvs_read_analog(void *ctx, uint8_t analog_no); -static uint16_t idz_jvs_consume_coins(void *ctx, uint8_t slot_no); +static uint16_t idz_jvs_read_coin_counter(void *ctx, uint8_t slot_no); static const struct io3_ops idz_jvs_io3_ops = { - .read_switches = idz_jvs_read_switches, - .read_analog = idz_jvs_read_analog, - .consume_coins = idz_jvs_consume_coins, + .read_switches = idz_jvs_read_switches, + .read_analog = idz_jvs_read_analog, + .read_coin_counter = idz_jvs_read_coin_counter, }; static struct io3 idz_jvs_io3; static bool idz_jvs_coin; +static uint16_t idz_jvs_coins; static bool idz_jvs_shifting; static uint8_t idz_jvs_gear; @@ -178,24 +179,21 @@ static uint16_t idz_jvs_read_analog(void *ctx, uint8_t analog_no) } } -static uint16_t idz_jvs_consume_coins(void *ctx, uint8_t slot_no) +static uint16_t idz_jvs_read_coin_counter(void *ctx, uint8_t slot_no) { if (slot_no > 0) { return 0; } if (GetAsyncKeyState('3')) { - if (idz_jvs_coin) { - return 0; - } else { + if (!idz_jvs_coin) { dprintf("IDZero JVS: Coin drop\n"); idz_jvs_coin = true; - - return 1; + idz_jvs_coins++; } } else { idz_jvs_coin = false; - - return 0; } + + return idz_jvs_coins; }