From bff81672b62a55ec00fc4c039ca75d1c7a310eca Mon Sep 17 00:00:00 2001 From: Olivier Galibert Date: Mon, 13 Jun 2011 10:00:59 +0000 Subject: [PATCH] naomi/jvs: add coin add/sub commands (sub is used by crazy taxi) [O. Galibert] --- src/emu/machine/jvsdev.c | 18 ++++++++++++++++++ src/emu/machine/jvsdev.h | 1 + src/mame/machine/jvs13551.c | 11 +++++++++++ src/mame/machine/jvs13551.h | 1 + 4 files changed, 31 insertions(+) diff --git a/src/emu/machine/jvsdev.c b/src/emu/machine/jvsdev.c index 9c302d8bfc3..ebed2095d40 100644 --- a/src/emu/machine/jvsdev.c +++ b/src/emu/machine/jvsdev.c @@ -150,6 +150,18 @@ int jvs_device::handle_message(const UINT8 *send_buffer, UINT32 send_size, UINT8 *recv_buffer++ = 0x01; return analogs(recv_buffer, send_buffer[1]) ? 2 : 0; + case 0x30: + if(send_size < 4) + return 0; + *recv_buffer++ = 0x01; + return coin_add(send_buffer[1], -((send_buffer[2] << 8) | send_buffer[3])) ? 4 : 0; + + case 0x31: + if(send_size < 4) + return 0; + *recv_buffer++ = 0x01; + return coin_add(send_buffer[1], ((send_buffer[2] << 8) | send_buffer[3])) ? 4 : 0; + case 0x32: if(send_size < 2 || send_size < 2+send_buffer[1]) return 0; @@ -202,6 +214,12 @@ bool jvs_device::coin_counters(UINT8 *&buf, UINT8 count) return false; } +bool jvs_device::coin_add(UINT8 slot, INT32 count) +{ + return false; +} + + bool jvs_device::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) { return false; diff --git a/src/emu/machine/jvsdev.h b/src/emu/machine/jvsdev.h index bc175e8065e..23e01a88861 100644 --- a/src/emu/machine/jvsdev.h +++ b/src/emu/machine/jvsdev.h @@ -36,6 +36,7 @@ protected: virtual void function_list(UINT8 *&buf); virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch); virtual bool coin_counters(UINT8 *&buf, UINT8 count); + virtual bool coin_add(UINT8 slot, INT32 count); virtual bool analogs(UINT8 *&buf, UINT8 count); virtual bool swoutputs(UINT8 count, const UINT8 *vals); virtual bool swoutputs(UINT8 id, UINT8 val); diff --git a/src/mame/machine/jvs13551.c b/src/mame/machine/jvs13551.c index 2b545a4c72c..d83b502093b 100644 --- a/src/mame/machine/jvs13551.c +++ b/src/mame/machine/jvs13551.c @@ -105,6 +105,17 @@ bool sega_837_13551::coin_counters(UINT8 *&buf, UINT8 count) return true; } +bool sega_837_13551::coin_add(UINT8 slot, INT32 count) +{ + if(slot < 1 || slot > 2) + return false; + + coin_counter[slot-1] += count; + fprintf(stderr, "coin_add(%d, %d) -> %d\n", slot, count, coin_counter[slot]); + + return true; +} + bool sega_837_13551::switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch) { if(count_players > 2 || bytes_per_switch > 2) diff --git a/src/mame/machine/jvs13551.h b/src/mame/machine/jvs13551.h index 83376f175e2..c33530663c8 100644 --- a/src/mame/machine/jvs13551.h +++ b/src/mame/machine/jvs13551.h @@ -45,6 +45,7 @@ protected: virtual void function_list(UINT8 *&buf); virtual bool switches(UINT8 *&buf, UINT8 count_players, UINT8 bytes_per_switch); virtual bool coin_counters(UINT8 *&buf, UINT8 count); + virtual bool coin_add(UINT8 slot, INT32 count); virtual bool analogs(UINT8 *&buf, UINT8 count); virtual bool swoutputs(UINT8 count, const UINT8 *vals); virtual bool swoutputs(UINT8 id, UINT8 val);