diff options
author | enikland2 <enikland@gmx.com> | 2019-03-30 12:48:18 -0300 |
---|---|---|
committer | R. Belmont <rb6502@users.noreply.github.com> | 2019-03-30 11:48:18 -0400 |
commit | 7f92ee8016b4785a1e4408a7fb1d643e4a5d40d8 (patch) | |
tree | ff5f82393ed8ae1af3588e64c9b3144d850f4380 /src/mame | |
parent | 06176a02a528fa92c068bdfa94d2d717ee4f5454 (diff) |
nes: Replace VDP bitmap access with screen().pixel() for lightgun emulation (#4665)
Diffstat (limited to 'src/mame')
-rw-r--r-- | src/mame/drivers/nes.cpp | 4 | ||||
-rw-r--r-- | src/mame/includes/nes.h | 1 | ||||
-rw-r--r-- | src/mame/machine/nes.cpp | 13 | ||||
-rw-r--r-- | src/mame/machine/playch10.cpp | 3 | ||||
-rw-r--r-- | src/mame/machine/vsnes.cpp | 3 |
5 files changed, 4 insertions, 20 deletions
diff --git a/src/mame/drivers/nes.cpp b/src/mame/drivers/nes.cpp index 090834d40db..916ef864af9 100644 --- a/src/mame/drivers/nes.cpp +++ b/src/mame/drivers/nes.cpp @@ -76,9 +76,7 @@ void nes_state::nes(machine_config &config) // not sure how to adjust it when it's inside the CPU? NES_CONTROL_PORT(config, m_ctrl1, nes_control_port1_devices, "joypad"); - m_ctrl1->set_brightpixel_callback(FUNC(nes_state::bright_pixel)); NES_CONTROL_PORT(config, m_ctrl2, nes_control_port2_devices, "joypad"); - m_ctrl2->set_brightpixel_callback(FUNC(nes_state::bright_pixel)); NES_CART_SLOT(config, m_cartslot, NTSC_APU_CLOCK, nes_cart, nullptr); SOFTWARE_LIST(config, "cart_list").set_original("nes"); @@ -114,7 +112,6 @@ void nes_state::famicom(machine_config &config) NES_CONTROL_PORT(config.replace(), m_ctrl1, fc_control_port1_devices, "joypad"); NES_CONTROL_PORT(config.replace(), m_ctrl2, fc_control_port2_devices, "joypad"); NES_CONTROL_PORT(config, m_exp, fc_expansion_devices, nullptr); - m_exp->set_brightpixel_callback(FUNC(nes_state::bright_pixel)); SOFTWARE_LIST(config, "flop_list").set_original("famicom_flop"); SOFTWARE_LIST(config, "cass_list").set_original("famicom_cass"); @@ -145,7 +142,6 @@ void nes_state::famipalc(machine_config &config) NES_CONTROL_PORT(config.replace(), m_ctrl1, fc_control_port1_devices, "joypad"); NES_CONTROL_PORT(config.replace(), m_ctrl2, fc_control_port2_devices, "joypad"); NES_CONTROL_PORT(config, m_exp, fc_expansion_devices, nullptr); - m_exp->set_brightpixel_callback(FUNC(nes_state::bright_pixel)); SOFTWARE_LIST(config, "cass_list").set_original("famicom_cass"); } diff --git a/src/mame/includes/nes.h b/src/mame/includes/nes.h index 06dcf8f4366..17d0e8c6437 100644 --- a/src/mame/includes/nes.h +++ b/src/mame/includes/nes.h @@ -93,7 +93,6 @@ public: virtual void video_start() override; virtual void video_reset() override; uint32_t screen_update_nes(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); - NESCTRL_BRIGHTPIXEL_CB(bright_pixel); void init_famicom(); diff --git a/src/mame/machine/nes.cpp b/src/mame/machine/nes.cpp index 7b15384293e..d46c0ed286d 100644 --- a/src/mame/machine/nes.cpp +++ b/src/mame/machine/nes.cpp @@ -190,16 +190,3 @@ void nes_state::init_famicom() space.install_write_handler(0x4016, 0x4016, write8_delegate(FUNC(nes_state::fc_in0_w), this)); space.install_read_handler(0x4017, 0x4017, read8_delegate(FUNC(nes_state::fc_in1_r), this)); } - -NESCTRL_BRIGHTPIXEL_CB(nes_state::bright_pixel) -{ - // get the pixel at the gun position - rgb_t pix = m_ppu->get_pixel(x, y); - - // check if the cursor is over a bright pixel - // FIXME: still a gross hack - if (pix.r() == 0xff && pix.b() == 0xff && pix.g() > 0x90) - return true; - else - return false; -} diff --git a/src/mame/machine/playch10.cpp b/src/mame/machine/playch10.cpp index e9fde5b157c..2c2c29a9ec3 100644 --- a/src/mame/machine/playch10.cpp +++ b/src/mame/machine/playch10.cpp @@ -1,6 +1,7 @@ // license:BSD-3-Clause // copyright-holders:Ernesto Corvi,Brad Oliver #include "emu.h" +#include "screen.h" #include "includes/playch10.h" #include "machine/nvram.h" @@ -225,7 +226,7 @@ READ8_MEMBER(playch10_state::pc10_in1_r) ret |= 0x08; /* get the pixel at the gun position */ - rgb_t pix = m_ppu->get_pixel(x, y); + rgb_t pix = m_ppu->screen().pixel(x, y); /* look at the screen and see if the cursor is over a bright pixel */ // FIXME: still a gross hack diff --git a/src/mame/machine/vsnes.cpp b/src/mame/machine/vsnes.cpp index d5c1b3c4094..f7595acba77 100644 --- a/src/mame/machine/vsnes.cpp +++ b/src/mame/machine/vsnes.cpp @@ -10,6 +10,7 @@ Nintendo VS UniSystem and DualSystem - (c) 1984 Nintendo of America ***************************************************************************/ #include "emu.h" +#include "screen.h" #include "video/ppu2c0x.h" #include "includes/vsnes.h" @@ -375,7 +376,7 @@ WRITE8_MEMBER(vsnes_state::gun_in0_w) uint8_t realy = (int)y; /* get the pixel at the gun position */ - rgb_t col = m_ppu1->get_pixel(x, realy); + rgb_t col = m_ppu1->screen().pixel(x, realy); uint8_t bright = col.brightness(); // todo, calculate how bright it is with pix.r * 0.3 + pix.g * 0.59 + pix.b * 0.11 ? // the mame calc above is uint8_t brightness() const { return (r() * 222 + g() * 707 + b() * 71) / 1000; } (from lib/util/palette.h) |