naomi/jvs: add coin add/sub commands (sub is used by crazy taxi) [O. Galibert]

This commit is contained in:
Olivier Galibert 2011-06-13 10:00:59 +00:00
parent 45fa774c24
commit bff81672b6
4 changed files with 31 additions and 0 deletions

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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);