From be47bca506eeb07b1d0783b480639b06c919f615 Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Thu, 5 Apr 2018 17:18:18 +0200 Subject: [PATCH] -output: Removed legacy output handlers from wecleman [Ryan Holtz] --- src/mame/drivers/wecleman.cpp | 21 ++++++-- src/mame/includes/wecleman.h | 13 +++++ src/mame/video/wecleman.cpp | 91 ++++++++++++++++------------------- 3 files changed, 71 insertions(+), 54 deletions(-) diff --git a/src/mame/drivers/wecleman.cpp b/src/mame/drivers/wecleman.cpp index d181ca1f994..0c383df7070 100644 --- a/src/mame/drivers/wecleman.cpp +++ b/src/mame/drivers/wecleman.cpp @@ -1030,12 +1030,16 @@ TIMER_DEVICE_CALLBACK_MEMBER(wecleman_state::hotchase_scanline) m_maincpu->set_input_line(4, HOLD_LINE); } - -MACHINE_RESET_MEMBER(wecleman_state,wecleman) +MACHINE_RESET_MEMBER(wecleman_state, wecleman) { m_k007232[0]->set_bank( 0, 1 ); } +MACHINE_START_MEMBER(wecleman_state, wecleman) +{ + m_led.resolve(); +} + MACHINE_CONFIG_START(wecleman_state::wecleman) /* basic machine hardware */ @@ -1052,7 +1056,8 @@ MACHINE_CONFIG_START(wecleman_state::wecleman) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_MACHINE_RESET_OVERRIDE(wecleman_state,wecleman) + MCFG_MACHINE_START_OVERRIDE(wecleman_state, wecleman) + MCFG_MACHINE_RESET_OVERRIDE(wecleman_state, wecleman) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) @@ -1093,7 +1098,12 @@ INTERRUPT_GEN_MEMBER(wecleman_state::hotchase_sound_timer) device.execute().set_input_line(M6809_FIRQ_LINE, HOLD_LINE); } -MACHINE_RESET_MEMBER(wecleman_state,hotchase) +MACHINE_START_MEMBER(wecleman_state, hotchase) +{ + m_led.resolve(); +} + +MACHINE_RESET_MEMBER(wecleman_state, hotchase) { int i; @@ -1123,7 +1133,8 @@ MACHINE_CONFIG_START(wecleman_state::hotchase) MCFG_QUANTUM_TIME(attotime::from_hz(6000)) - MCFG_MACHINE_RESET_OVERRIDE(wecleman_state,hotchase) + MCFG_MACHINE_RESET_OVERRIDE(wecleman_state, hotchase) + MCFG_MACHINE_START_OVERRIDE(wecleman_state, hotchase) /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) diff --git a/src/mame/includes/wecleman.h b/src/mame/includes/wecleman.h index fbf9d56aa56..7f1667756c1 100644 --- a/src/mame/includes/wecleman.h +++ b/src/mame/includes/wecleman.h @@ -37,8 +37,11 @@ public: , m_gfxdecode(*this, "gfxdecode") , m_palette(*this, "palette") , m_screen(*this, "screen") + , m_led(*this, "led%u", 0U) { } + // [RH] TODO: Make this less awful and put stuff behind protected and private wherever possible. + optional_shared_ptr m_videostatus; optional_shared_ptr m_protection_ram; required_shared_ptr m_blitter_regs; @@ -75,6 +78,7 @@ public: int m_sound_hw_type; bool m_hotchase_sound_hs; pen_t m_black_pen; + DECLARE_READ16_MEMBER(wecleman_protection_r); DECLARE_WRITE16_MEMBER(wecleman_protection_w); DECLARE_WRITE16_MEMBER(irqctrl_w); @@ -98,10 +102,15 @@ public: TILE_GET_INFO_MEMBER(wecleman_get_txt_tile_info); TILE_GET_INFO_MEMBER(wecleman_get_bg_tile_info); TILE_GET_INFO_MEMBER(wecleman_get_fg_tile_info); + + DECLARE_MACHINE_START(wecleman); DECLARE_MACHINE_RESET(wecleman); DECLARE_VIDEO_START(wecleman); + + DECLARE_MACHINE_START(hotchase); DECLARE_MACHINE_RESET(hotchase); DECLARE_VIDEO_START(hotchase); + uint32_t screen_update_wecleman(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); uint32_t screen_update_hotchase(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); INTERRUPT_GEN_MEMBER(hotchase_sound_timer); @@ -129,6 +138,8 @@ public: required_device m_palette; required_device m_screen; + output_finder<1> m_led; + void hotchase(machine_config &config); void wecleman(machine_config &config); void hotchase_map(address_map &map); @@ -137,6 +148,8 @@ public: void wecleman_map(address_map &map); void wecleman_sound_map(address_map &map); void wecleman_sub_map(address_map &map); + + private: struct sprite_t { diff --git a/src/mame/video/wecleman.cpp b/src/mame/video/wecleman.cpp index 3fd54e13251..4bb6c0c1120 100644 --- a/src/mame/video/wecleman.cpp +++ b/src/mame/video/wecleman.cpp @@ -997,34 +997,28 @@ VIDEO_START_MEMBER(wecleman_state,hotchase) uint32_t wecleman_state::screen_update_wecleman(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - const pen_t *mrct; - int video_on; - int fg_x, bg_x, fg_y, bg_y; - int cloud_sx, cloud_sy; - int i, j, k; + const pen_t *mrct = m_palette->pens(); - mrct = m_palette->pens(); + bool video_on = m_irqctrl & 0x40; - video_on = m_irqctrl & 0x40; + m_led[0] = (m_selected_ip & 0x04) ? 1 : 0; - output().set_led_value(0, m_selected_ip & 0x04); // Start lamp + int fg_y = (m_txtram[0x0f24 >> 1] & (TILEMAP_DIMY - 1)); + int bg_y = (m_txtram[0x0f26 >> 1] & (TILEMAP_DIMY - 1)); - fg_y = (m_txtram[0x0f24>>1] & (TILEMAP_DIMY - 1)); - bg_y = (m_txtram[0x0f26>>1] & (TILEMAP_DIMY - 1)); - - cloud_sx = m_txtram[0xfee>>1] + 0xb0; - cloud_sy = bg_y; + int cloud_sx = m_txtram[0xfee >> 1] + 0xb0; + int cloud_sy = bg_y; m_bg_tilemap->set_scrolly(0, bg_y -BMP_PAD); m_fg_tilemap->set_scrolly(0, fg_y -BMP_PAD); - for (i=0; i<(28<<2); i+=4) + for (int i = 0; i < (28 << 2); i += 4) { - fg_x = m_txtram[(i+0xf80)>>1] + (0xb0 -BMP_PAD); - bg_x = m_txtram[(i+0xf82)>>1] + (0xb0 -BMP_PAD); + int fg_x = m_txtram[(i + 0xf80) >> 1] + (0xb0 - BMP_PAD); + int bg_x = m_txtram[(i + 0xf82) >> 1] + (0xb0 - BMP_PAD); - k = i<<1; - for (j=0; j<8; j++) + int k = i << 1; + for (int j = 0; j < 8; j++) { m_fg_tilemap->set_scrollx((fg_y + k + j) & (TILEMAP_DIMY - 1), fg_x); m_bg_tilemap->set_scrollx((bg_y + k + j) & (TILEMAP_DIMY - 1), bg_x); @@ -1039,11 +1033,14 @@ uint32_t wecleman_state::screen_update_wecleman(screen_device &screen, bitmap_rg bitmap.fill(m_black_pen, cliprect); - /* Draw the road (lines which have priority 0x02) */ - if (video_on) wecleman_draw_road(bitmap, cliprect, 0x02); + if (video_on) + { + /* Draw the road (lines which have priority 0x02) */ + wecleman_draw_road(bitmap, cliprect, 0x02); - /* Draw the background */ - if (video_on) m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + /* Draw the background */ + m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + } // draws the cloud layer; needs work if (m_cloud_visible) @@ -1052,14 +1049,9 @@ uint32_t wecleman_state::screen_update_wecleman(screen_device &screen, bitmap_rg ((pen_t *)mrct)[0] = ((pen_t *)mrct)[0x40] = ((pen_t *)mrct)[0x200] = ((pen_t *)mrct)[0x205]; if (video_on) - draw_cloud(bitmap, - m_gfxdecode->gfx(0), - m_pageram+0x1800, - BMP_PAD, BMP_PAD, - 41, 20, - cloud_sx, cloud_sy, - 6, 5, - m_cloud_blend/BLEND_STEPS, 0); + { + draw_cloud(bitmap, m_gfxdecode->gfx(0), m_pageram + 0x1800, BMP_PAD, BMP_PAD, 41, 20, cloud_sx, cloud_sy, 6, 5, m_cloud_blend/BLEND_STEPS, 0); + } m_cloud_blend += m_cloud_ds; @@ -1069,17 +1061,21 @@ uint32_t wecleman_state::screen_update_wecleman(screen_device &screen, bitmap_rg { m_cloud_blend = BLEND_MAX; m_cloud_ds = 0; m_cloud_visible = 0; } } - /* Draw the foreground */ - if (video_on) m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); + if (video_on) + { + /* Draw the foreground */ + m_fg_tilemap->draw(screen, bitmap, cliprect, 0, 0); - /* Draw the road (lines which have priority 0x04) */ - if (video_on) wecleman_draw_road(bitmap,cliprect, 0x04); + /* Draw the road (lines which have priority 0x04) */ + wecleman_draw_road(bitmap,cliprect, 0x04); - /* Draw the sprites */ - if (video_on) sprite_draw(bitmap,cliprect); + /* Draw the sprites */ + sprite_draw(bitmap,cliprect); + + /* Draw the text layer */ + m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0); + } - /* Draw the text layer */ - if (video_on) m_txt_tilemap->draw(screen, bitmap, cliprect, 0, 0); return 0; } @@ -1089,30 +1085,27 @@ uint32_t wecleman_state::screen_update_wecleman(screen_device &screen, bitmap_rg uint32_t wecleman_state::screen_update_hotchase(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int video_on; + bool video_on = (m_irqctrl & 0x40) ? true : false; - video_on = m_irqctrl & 0x40; - - output().set_led_value(0, m_selected_ip & 0x04); // Start lamp + m_led[0] = (m_selected_ip & 0x04) ? 1 : 0; // Start lamp get_sprite_info(); bitmap.fill(m_black_pen, cliprect); - /* Draw the background */ if (video_on) + { + /* Draw the background */ m_k051316[0]->zoom_draw(screen, bitmap, cliprect, 0, 0); - /* Draw the road */ - if (video_on) + /* Draw the road */ hotchase_draw_road(bitmap, cliprect); - /* Draw the sprites */ - if (video_on) + /* Draw the sprites */ sprite_draw(bitmap,cliprect); - /* Draw the foreground (text) */ - if (video_on) + /* Draw the foreground (text) */ m_k051316[1]->zoom_draw(screen, bitmap, cliprect, 0, 0); + } return 0; }