forked from TeamTofuShop/segatools
mercury: fix coin counter (thanks Raki!)
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "board/io4.h"
|
||||
|
||||
@ -10,6 +11,9 @@
|
||||
|
||||
#include "util/dprintf.h"
|
||||
|
||||
bool mercury_io_coin = false;
|
||||
uint16_t mercury_io_coins = 0;
|
||||
|
||||
static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state);
|
||||
|
||||
static const struct io4_ops mercury_io4_ops = {
|
||||
@ -64,8 +68,16 @@ static HRESULT mercury_io4_poll(void *ctx, struct io4_state *state)
|
||||
}
|
||||
|
||||
if (opbtn & MERCURY_IO_OPBTN_COIN) {
|
||||
state->chutes[0] += 1 << 8; // FIXME: Inserts 1 credit on press, then 15 on release...
|
||||
if (!mercury_io_coin) {
|
||||
mercury_io_coin = true;
|
||||
mercury_io_coins++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
mercury_io_coin = false;
|
||||
}
|
||||
|
||||
state->chutes[0] = 128 + 256 * mercury_io_coins;
|
||||
|
||||
if (gamebtn & MERCURY_IO_GAMEBTN_VOL_UP) {
|
||||
state->buttons[0] |= 1 << 1;
|
||||
|
Reference in New Issue
Block a user