mirror of
https://github.com/holub/mame
synced 2025-10-04 16:34:53 +03:00
gb.cpp: Added Rumble emulation to the MBC-5 Game Boy
Color games which supported it. MAME will now output a "Rumble" output bit (0 for Rumble=OFF and 1 for Rumble=ON) whenever the games try to access the Rumble component… third party applications can now listen to the output and redirect it to some hardware that can "rumble" in sync with the gameplay. [Fabio Priuli] gb.cpp: Added partial RTC emulation to the MBC-3 Game Boy Color games which supported it. Clock proceeds a bit too fast during gameplay, but at least it is not stuck anymore to the time of first configuration. [Fabio Priuli]
This commit is contained in:
parent
0169416ae3
commit
ad3b07d17f
@ -86,7 +86,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="10pinbu" cloneof="10pinb">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>10-Pin Bowling (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Majesco</publisher>
|
||||
@ -177,7 +177,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="3dupinb">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>3-D Ultra Pinball - Thrillride (USA)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Sierra</publisher>
|
||||
@ -3051,7 +3051,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="cheechai">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Chee-Chai Alien (Jpn)</description>
|
||||
<year>2001</year>
|
||||
<publisher>Creatures</publisher>
|
||||
@ -6698,7 +6698,6 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="getchuu">
|
||||
<!-- Notes: Rumble support -->
|
||||
<description>Get Chuu Club - Minna no Konchuu Daizukan (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Jaleco</publisher>
|
||||
@ -8057,7 +8056,6 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="holein1">
|
||||
<!-- Notes: Rumble support -->
|
||||
<description>Hole In One Golf (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Natsume</publisher>
|
||||
@ -9197,7 +9195,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="kawanus4" cloneof="rivking2">
|
||||
<!-- Notes: SGB enhanced, Rumble support -->
|
||||
<!-- Notes: SGB enhanced -->
|
||||
<description>Kawa no Nushi Tsuri 4 (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Victor Interactive Software</publisher>
|
||||
@ -10446,7 +10444,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="mermaid2u" cloneof="mermaid2">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Disney's The Little Mermaid II - Pinball Frenzy (USA)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Disney Interactive</publisher>
|
||||
@ -12538,7 +12536,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="missileu" cloneof="missile">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Missile Command (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Hasbro Interactive</publisher>
|
||||
@ -13556,7 +13554,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="nascchal">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>NASCAR Challenge (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Hasbro Interactive</publisher>
|
||||
@ -14086,7 +14084,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="nushiadv">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Nushi Tsuri Adventure - Kite no Bouken (Jpn)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Victor Interactive Software</publisher>
|
||||
@ -14477,7 +14475,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="pdark">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Perfect Dark (Euro, USA)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Nintendo</publisher>
|
||||
@ -15502,7 +15500,6 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="pokepinb">
|
||||
<!-- Notes: Rumble support -->
|
||||
<description>Pokémon Pinball (Euro)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Nintendo</publisher>
|
||||
@ -15526,7 +15523,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="pokepinbj" cloneof="pokepinb">
|
||||
<!-- Notes: SGB enhanced, Rumble support -->
|
||||
<!-- Notes: SGB enhanced -->
|
||||
<description>Pokémon Pinball (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Nintendo</publisher>
|
||||
@ -15545,7 +15542,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="pokepinbu" cloneof="pokepinb">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Pokémon Pinball (Aus, USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Nintendo</publisher>
|
||||
@ -15645,7 +15642,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="polarsno" cloneof="snowcros">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Polaris SnoCross (USA)</description>
|
||||
<year>2000</year>
|
||||
<publisher>Vatical Entertainment</publisher>
|
||||
@ -17088,7 +17085,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="r2rumbleu" cloneof="r2rumble">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Ready 2 Rumble Boxing (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Midway</publisher>
|
||||
@ -19194,7 +19191,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="swracer">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Star Wars Episode I - Racer (Euro, USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Nintendo</publisher>
|
||||
@ -19304,7 +19301,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="sblkbass">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Super Black Bass - Real Fight (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Starfish</publisher>
|
||||
@ -19545,7 +19542,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="srfish">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Super Real Fishing (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Bottom Up</publisher>
|
||||
@ -20151,7 +20148,6 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="tdoffr3" cloneof="4x4world">
|
||||
<!-- Notes: Rumble support -->
|
||||
<description>Test Drive Off-Road 3 (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Infogrames</publisher>
|
||||
@ -20684,7 +20680,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="tonkaracua" cloneof="tonkarac">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Tonka Raceway (USA, Rumble Version)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Hasbro Interactive</publisher>
|
||||
@ -20828,7 +20824,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="topgearj" cloneof="tgrally">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Top Gear Pocket (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Kemco</publisher>
|
||||
@ -20845,7 +20841,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="topgear" cloneof="tgrally">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Top Gear Pocket (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Kemco</publisher>
|
||||
@ -20860,7 +20856,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="topgear2j" cloneof="tgrally2">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Top Gear Pocket 2 (Jpn)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Kemco</publisher>
|
||||
@ -20895,7 +20891,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="tgrally">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Top Gear Rally (Euro)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Kemco</publisher>
|
||||
@ -21645,7 +21641,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="vigilnt8">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Vigilante 8 (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Vatical Entertainment</publisher>
|
||||
@ -22909,7 +22905,7 @@ Unreleased (music source code exists, possibly no prototypes exist)
|
||||
</software>
|
||||
|
||||
<software name="zebco">
|
||||
<!-- Notes: GBC only, Rumble support -->
|
||||
<!-- Notes: GBC only -->
|
||||
<description>Zebco Fishing! (USA)</description>
|
||||
<year>1999</year>
|
||||
<publisher>Vatical Entertainment</publisher>
|
||||
|
@ -5,7 +5,7 @@
|
||||
Game Boy carts with MBC (Memory Bank Controller)
|
||||
|
||||
|
||||
TODO: add proper RTC and Rumble support
|
||||
TODO: RTC runs too fast while in-game, in MBC-3 games... find the problem!
|
||||
|
||||
***********************************************************************************************************/
|
||||
|
||||
@ -179,13 +179,15 @@ void gb_rom_mbc_device::shared_reset()
|
||||
void gb_rom_mbc3_device::device_start()
|
||||
{
|
||||
shared_start();
|
||||
save_item(NAME(m_rtc_map));
|
||||
save_item(NAME(m_rtc_regs));
|
||||
save_item(NAME(m_rtc_ready));
|
||||
}
|
||||
|
||||
void gb_rom_mbc3_device::device_reset()
|
||||
{
|
||||
shared_reset();
|
||||
memset(m_rtc_map, 0, sizeof(m_rtc_map));
|
||||
memset(m_rtc_regs, 0, sizeof(m_rtc_regs));
|
||||
m_rtc_ready = 0;
|
||||
}
|
||||
|
||||
void gb_rom_mbc6_device::device_start()
|
||||
@ -446,6 +448,18 @@ WRITE8_MEMBER(gb_rom_mbc2_device::write_ram)
|
||||
|
||||
// MBC3
|
||||
|
||||
void gb_rom_mbc3_device::update_rtc()
|
||||
{
|
||||
system_time curtime;
|
||||
machine().current_datetime(curtime);
|
||||
|
||||
m_rtc_regs[0] = curtime.local_time.second;
|
||||
m_rtc_regs[1] = curtime.local_time.minute;
|
||||
m_rtc_regs[2] = curtime.local_time.hour;
|
||||
m_rtc_regs[3] = curtime.local_time.day & 0xff;
|
||||
m_rtc_regs[4] = (m_rtc_regs[4] & 0xf0) | (curtime.local_time.day >> 8);
|
||||
}
|
||||
|
||||
READ8_MEMBER(gb_rom_mbc3_device::read_rom)
|
||||
{
|
||||
if (offset < 0x4000)
|
||||
@ -472,16 +486,14 @@ WRITE8_MEMBER(gb_rom_mbc3_device::write_bank)
|
||||
{
|
||||
m_ram_bank = data;
|
||||
}
|
||||
else
|
||||
else if (has_timer)
|
||||
{
|
||||
if (has_timer)
|
||||
if (m_rtc_ready == 1 && data == 0)
|
||||
m_rtc_ready = 0;
|
||||
if (m_rtc_ready == 0 && data == 1)
|
||||
{
|
||||
/* FIXME: RTC Latch goes here */
|
||||
m_rtc_map[0] = 50; /* Seconds */
|
||||
m_rtc_map[1] = 40; /* Minutes */
|
||||
m_rtc_map[2] = 15; /* Hours */
|
||||
m_rtc_map[3] = 25; /* Day counter lowest 8 bits */
|
||||
m_rtc_map[4] = 0x01; /* Day counter upper bit, timer off, no day overflow occurred (bit7) */
|
||||
m_rtc_ready = 1;
|
||||
update_rtc();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -489,14 +501,16 @@ WRITE8_MEMBER(gb_rom_mbc3_device::write_bank)
|
||||
READ8_MEMBER(gb_rom_mbc3_device::read_ram)
|
||||
{
|
||||
if (m_ram_bank < 4 && m_ram_enable)
|
||||
{ // RAM
|
||||
{
|
||||
// RAM
|
||||
if (!m_ram.empty())
|
||||
return m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)];
|
||||
}
|
||||
if (m_ram_bank >= 0x8 && m_ram_bank <= 0xc)
|
||||
{ // RAM
|
||||
{
|
||||
// RTC registers
|
||||
if (has_timer)
|
||||
return m_rtc_map[m_ram_bank - 8];
|
||||
return m_rtc_regs[m_ram_bank - 8];
|
||||
}
|
||||
return 0xff;
|
||||
}
|
||||
@ -504,16 +518,16 @@ READ8_MEMBER(gb_rom_mbc3_device::read_ram)
|
||||
WRITE8_MEMBER(gb_rom_mbc3_device::write_ram)
|
||||
{
|
||||
if (m_ram_bank < 4 && m_ram_enable)
|
||||
{ // RAM
|
||||
{
|
||||
// RAM
|
||||
if (!m_ram.empty())
|
||||
m_ram[ram_bank_map[m_ram_bank] * 0x2000 + (offset & 0x1fff)] = data;
|
||||
}
|
||||
if (m_ram_bank >= 0x8 && m_ram_bank <= 0xc)
|
||||
{ // RAM
|
||||
if (m_ram_bank >= 0x8 && m_ram_bank <= 0xc && m_ram_enable)
|
||||
{
|
||||
// RTC registers are writeable too
|
||||
if (has_timer)
|
||||
{
|
||||
// what to do here?
|
||||
}
|
||||
m_rtc_regs[m_ram_bank - 8] = data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -547,7 +561,10 @@ WRITE8_MEMBER(gb_rom_mbc5_device::write_bank)
|
||||
{
|
||||
data &= 0x0f;
|
||||
if (has_rumble)
|
||||
{
|
||||
machine().output().set_value("Rumble", BIT(data, 3));
|
||||
data &= 0x7;
|
||||
}
|
||||
m_ram_bank = data;
|
||||
}
|
||||
}
|
||||
@ -1071,8 +1088,6 @@ WRITE8_MEMBER(gb_rom_sintax_device::write_bank)
|
||||
else if (offset < 0x5000)
|
||||
{
|
||||
data &= 0x0f;
|
||||
if (has_rumble)
|
||||
data &= 0x7;
|
||||
m_ram_bank = data;
|
||||
}
|
||||
else if (offset < 0x6000)
|
||||
@ -1167,8 +1182,6 @@ WRITE8_MEMBER(gb_rom_digimon_device::write_bank)
|
||||
{
|
||||
// printf("written $05-$06 %X at %X\n", data, offset);
|
||||
data &= 0x0f;
|
||||
if (has_rumble)
|
||||
data &= 0x7;
|
||||
m_ram_bank = data;
|
||||
}
|
||||
// else
|
||||
|
@ -93,7 +93,11 @@ public:
|
||||
virtual DECLARE_WRITE8_MEMBER(write_bank) override;
|
||||
virtual DECLARE_READ8_MEMBER(read_ram) override;
|
||||
virtual DECLARE_WRITE8_MEMBER(write_ram) override;
|
||||
UINT8 m_rtc_map[5];
|
||||
|
||||
private:
|
||||
void update_rtc();
|
||||
UINT8 m_rtc_regs[5];
|
||||
int m_rtc_ready;
|
||||
};
|
||||
|
||||
// ======================> gb_rom_mbc5_device
|
||||
|
Loading…
Reference in New Issue
Block a user