bookkeeping: don't increment coin counter at power-on when initial counter_w input is 1, add handlers for resetting counters

This commit is contained in:
hap 2024-10-31 00:49:48 +01:00
parent f03f1475c7
commit 152389867e
3 changed files with 61 additions and 30 deletions

View file

@ -22,11 +22,11 @@
// bookkeeping_manager - constructor
//-------------------------------------------------
bookkeeping_manager::bookkeeping_manager(running_machine &machine)
: m_machine(machine),
m_dispensed_tickets(0)
bookkeeping_manager::bookkeeping_manager(running_machine &machine) :
m_machine(machine),
m_dispensed_tickets(0)
{
/* reset coin counters */
// reset coin counters
for (int counternum = 0; counternum < COIN_COUNTERS; counternum++)
{
m_lastcoin[counternum] = 0;
@ -52,6 +52,16 @@ bookkeeping_manager::bookkeeping_manager(running_machine &machine)
TICKETS
***************************************************************************/
/*-------------------------------------------------
increment_dispensed_tickets - increment the
number of dispensed tickets
-------------------------------------------------*/
void bookkeeping_manager::increment_dispensed_tickets(int delta)
{
m_dispensed_tickets += delta;
}
/*-------------------------------------------------
get_dispensed_tickets - return the number of
tickets dispensed
@ -64,13 +74,13 @@ int bookkeeping_manager::get_dispensed_tickets() const
/*-------------------------------------------------
increment_dispensed_tickets - increment the
number of dispensed tickets
reset_dispensed_tickets - reset the number of
tickets dispensed
-------------------------------------------------*/
void bookkeeping_manager::increment_dispensed_tickets(int delta)
void bookkeeping_manager::reset_dispensed_tickets()
{
m_dispensed_tickets += delta;
m_dispensed_tickets = 0;
}
@ -156,8 +166,8 @@ void bookkeeping_manager::coin_counter_w(int num, int on)
if (num >= std::size(m_coin_count))
return;
/* Count it only if the data has changed from 0 to non-zero */
if (on && (m_lastcoin[num] == 0))
// count it only if the data has changed from 0 to non-zero
if (machine().time() > attotime::zero && on && (m_lastcoin[num] == 0))
m_coin_count[num]++;
m_lastcoin[num] = on;
}
@ -176,11 +186,24 @@ int bookkeeping_manager::coin_counter_get_count(int num)
}
/*-------------------------------------------------
coin_counter_reset_count - reset the coin count
for a given coin
-------------------------------------------------*/
void bookkeeping_manager::coin_counter_reset_count(int num)
{
if (num >= std::size(m_coin_count))
return;
m_coin_count[num] = 0;
}
/*-------------------------------------------------
coin_lockout_w - locks out one coin input
-------------------------------------------------*/
void bookkeeping_manager::coin_lockout_w(int num,int on)
void bookkeeping_manager::coin_lockout_w(int num, int on)
{
if (num >= std::size(m_coinlockedout))
return;

View file

@ -32,11 +32,14 @@ public:
bookkeeping_manager(running_machine &machine);
// ----- tickets -----
// increment the number of dispensed tickets
void increment_dispensed_tickets(int delta);
// return the number of tickets dispensed
int get_dispensed_tickets() const;
// increment the number of dispensed tickets
void increment_dispensed_tickets(int delta);
// reset the number of dispensed tickets
void reset_dispensed_tickets();
// ----- coin counters -----
// write to a particular coin counter (clocks on active high edge)
@ -45,6 +48,9 @@ public:
// return the coin count for a given coin
int coin_counter_get_count(int num);
// reset the coin count for a given coin
void coin_counter_reset_count(int num);
// enable/disable coin lockout for a particular coin
void coin_lockout_w(int num, int on);
@ -56,6 +62,7 @@ public:
// getters
running_machine &machine() const { return m_machine; }
private:
void config_load(config_type cfg_type, config_level cfg_level, util::xml::data_node const *parentnode);
void config_save(config_type cfg_type, util::xml::data_node *parentnode);

View file

@ -392,7 +392,7 @@ static INPUT_PORTS_START( quickpick5 )
PORT_BIT(0xd8, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_START("DSW1")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 2C_1C ) )
@ -401,22 +401,22 @@ static INPUT_PORTS_START( quickpick5 )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_7C ) )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW1:4")
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW1:4")
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x30, 0x30, "Jack Pot" ) PORT_DIPLOCATION("DIPSW1:5,6")
PORT_DIPNAME( 0x30, 0x30, "Jack Pot" ) PORT_DIPLOCATION("DIPSW1:5,6")
PORT_DIPSETTING( 0x30, "300" )
PORT_DIPSETTING( 0x20, "500" )
PORT_DIPSETTING( 0x10, "700" )
PORT_DIPSETTING( 0x00, "1000" )
PORT_DIPNAME( 0xc0, 0xc0, "Max Pay" ) PORT_DIPLOCATION("DIPSW1:7,8")
PORT_DIPNAME( 0xc0, 0xc0, "Max Pay" ) PORT_DIPLOCATION("DIPSW1:7,8")
PORT_DIPSETTING( 0xc0, "400" )
PORT_DIPSETTING( 0x80, "500" )
PORT_DIPSETTING( 0x40, "700" )
PORT_DIPSETTING( 0x00, "1000" )
PORT_START("DSW2")
PORT_DIPNAME( 0x0f, 0x0f, "Max Payout" ) PORT_DIPLOCATION("DIPSW2:1,2,3,4")
PORT_DIPNAME( 0x0f, 0x0f, "Max Payout" ) PORT_DIPLOCATION("DIPSW2:1,2,3,4")
PORT_DIPSETTING( 0x0f, "65%" )
PORT_DIPSETTING( 0x0e, "70%" )
PORT_DIPSETTING( 0x0d, "75%" )
@ -433,15 +433,15 @@ static INPUT_PORTS_START( quickpick5 )
PORT_DIPSETTING( 0x02, "91%" )
PORT_DIPSETTING( 0x01, "92%" )
PORT_DIPSETTING( 0x00, "94%" )
PORT_DIPNAME( 0x30, 0x30, "Button Time" ) PORT_DIPLOCATION("DIPSW2:5,6")
PORT_DIPNAME( 0x30, 0x30, "Button Time" ) PORT_DIPLOCATION("DIPSW2:5,6")
PORT_DIPSETTING( 0x30, "15 Seconds" )
PORT_DIPSETTING( 0x20, "20 Seconds" )
PORT_DIPSETTING( 0x10, "30 Seconds" )
PORT_DIPSETTING( 0x00, "40 Seconds" )
PORT_DIPNAME( 0x40, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:7")
PORT_DIPNAME( 0x40, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:7")
PORT_DIPSETTING( 0x00, "Clear" )
PORT_DIPSETTING( 0x40, "Keep" )
PORT_DIPNAME( 0x80, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:8")
PORT_DIPNAME( 0x80, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@ -509,7 +509,8 @@ static INPUT_PORTS_START( waijockey )
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_OTHER) PORT_NAME("Bet 1-4") PORT_CODE(KEYCODE_G)
PORT_START("DSW1")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3,4")
// Coinage DSW is only for converting 100 Yen coin to medals via the hopper
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coinage ) ) PORT_DIPLOCATION("DIPSW1:1,2,3,4")
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_3C ) )
@ -526,7 +527,7 @@ static INPUT_PORTS_START( waijockey )
PORT_DIPSETTING( 0x02, "1 Coin/14 Credits" )
PORT_DIPSETTING( 0x01, "1 Coin/15 Credits" )
PORT_DIPSETTING( 0x00, "1 Coin/16 Credits" )
PORT_DIPNAME( 0xf0, 0xf0, "Max Payout" ) PORT_DIPLOCATION("DIPSW1:5,6,7,8")
PORT_DIPNAME( 0xf0, 0xf0, "Max Payout" ) PORT_DIPLOCATION("DIPSW1:5,6,7,8")
PORT_DIPSETTING( 0xf0, "60%" )
PORT_DIPSETTING( 0xe0, "62%" )
PORT_DIPSETTING( 0xd0, "64%" )
@ -545,28 +546,28 @@ static INPUT_PORTS_START( waijockey )
PORT_DIPSETTING( 0x00, "90%" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:1")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:2")
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:2")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:3")
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:3")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:4")
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("DIPSW2:4")
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x10, 0x10, "Game Play Mode" ) PORT_DIPLOCATION("DIPSW2:5") // more like gameplay test mode
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DIPSW2:6")
PORT_DIPNAME( 0x20, 0x00, "Payout Mode" ) PORT_DIPLOCATION("DIPSW2:6")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:7")
PORT_DIPNAME( 0x40, 0x00, "Attract Sound" ) PORT_DIPLOCATION("DIPSW2:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:8")
PORT_DIPNAME( 0x80, 0x00, "Backup Memory" ) PORT_DIPLOCATION("DIPSW2:8")
PORT_DIPSETTING( 0x00, "Clear" )
PORT_DIPSETTING( 0x80, "Keep" )