From 9fcd763f8e90a863d4cb67e93e3ecf9d2c76d3d0 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Thu, 31 May 2018 11:36:59 +0200 Subject: [PATCH] deco_mlc.cpp: device_finder (nw) --- src/mame/drivers/deco_mlc.cpp | 42 ++++++++++++++--------------------- src/mame/drivers/igs011.cpp | 29 +++++++++++++++++++++++- src/mame/includes/deco_mlc.h | 28 +++++++++++++++-------- src/mame/video/deco_mlc.cpp | 10 ++++----- 4 files changed, 68 insertions(+), 41 deletions(-) diff --git a/src/mame/drivers/deco_mlc.cpp b/src/mame/drivers/deco_mlc.cpp index 97bcb17c059..31865131ee4 100644 --- a/src/mame/drivers/deco_mlc.cpp +++ b/src/mame/drivers/deco_mlc.cpp @@ -87,13 +87,12 @@ - DE156 clock: 7.000MHz (42MHz / 6, QFP100, clock measured on pin 90) Stadium Hero contains a '146' protection chip on the ROM/CPU pcb, but - it is barely used by the game (only checked at startup). See decoprot.c + it is barely used by the game (only checked at startup). See deco146.cpp. Driver TODO: stadhr96 - protection? issues (or 156 co-processor? or timing?) avengrgs - doesn't generate enough line interrupts? ddream95 seems to have a dual screen mode(??) - hoops** - crash entering test mode (regression from 0.113 era?) skullfng - slowdowns not verified from real PCB, Random hangs sometimes Graphic TODO: @@ -503,25 +502,23 @@ GFXDECODE_END /******************************************************************************/ -MACHINE_RESET_MEMBER(deco_mlc_state,mlc) +void deco_mlc_state::machine_reset() { m_vbl_i = 0xffffffff; - m_raster_irq_timer = machine().device("int_timer"); } MACHINE_CONFIG_START(deco_mlc_state::avengrgs) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", SH2,42000000/2) /* 21 MHz clock confirmed on real board */ + MCFG_DEVICE_ADD(m_maincpu, SH2, 42000000/2) /* 21 MHz clock confirmed on real board */ MCFG_DEVICE_PROGRAM_MAP(avengrgs_map) - MCFG_MACHINE_RESET_OVERRIDE(deco_mlc_state,mlc) - MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") /* Actually 93c45 */ + MCFG_EEPROM_SERIAL_93C46_ADD(m_eeprom) /* Actually 93c45 */ - MCFG_TIMER_DRIVER_ADD("int_timer", deco_mlc_state, interrupt_gen) + MCFG_TIMER_DRIVER_ADD(m_raster_irq_timer, deco_mlc_state, interrupt_gen) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD(m_screen, RASTER) MCFG_SCREEN_REFRESH_RATE(58) MCFG_SCREEN_SIZE(40*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) @@ -529,18 +526,16 @@ MACHINE_CONFIG_START(deco_mlc_state::avengrgs) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, deco_mlc_state, screen_vblank_mlc)) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_deco_mlc) - MCFG_PALETTE_ADD("palette", 2048) + MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_deco_mlc) + MCFG_PALETTE_ADD(m_palette, 2048) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) MCFG_PALETTE_MEMBITS(16) - MCFG_VIDEO_START_OVERRIDE(deco_mlc_state,mlc) - /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ymz", YMZ280B, 42000000 / 3) + MCFG_DEVICE_ADD(m_ymz, YMZ280B, 42000000 / 3) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END @@ -548,16 +543,15 @@ MACHINE_CONFIG_END MACHINE_CONFIG_START(deco_mlc_state::mlc) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu", ARM,42000000/6) /* 42 MHz -> 7MHz clock confirmed on real board */ + MCFG_DEVICE_ADD(m_maincpu, ARM,42000000/6) /* 42 MHz -> 7MHz clock confirmed on real board */ MCFG_DEVICE_PROGRAM_MAP(decomlc_map) - MCFG_MACHINE_RESET_OVERRIDE(deco_mlc_state,mlc) - MCFG_EEPROM_SERIAL_93C46_ADD("eeprom") /* Actually 93c45 */ + MCFG_EEPROM_SERIAL_93C46_ADD(m_eeprom) /* Actually 93c45 */ - MCFG_TIMER_DRIVER_ADD("int_timer", deco_mlc_state, interrupt_gen) + MCFG_TIMER_DRIVER_ADD(m_raster_irq_timer, deco_mlc_state, interrupt_gen) /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD(m_screen, RASTER) MCFG_SCREEN_REFRESH_RATE(58) MCFG_SCREEN_SIZE(40*8, 32*8) MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 1*8, 31*8-1) @@ -565,21 +559,19 @@ MACHINE_CONFIG_START(deco_mlc_state::mlc) MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, deco_mlc_state, screen_vblank_mlc)) MCFG_SCREEN_VIDEO_ATTRIBUTES(VIDEO_UPDATE_SCANLINE) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_deco_mlc) - MCFG_PALETTE_ADD("palette", 2048) + MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_deco_mlc) + MCFG_PALETTE_ADD(m_palette, 2048) MCFG_PALETTE_FORMAT(xBBBBBGGGGGRRRRR) MCFG_PALETTE_MEMBITS(16) - MCFG_VIDEO_START_OVERRIDE(deco_mlc_state,mlc) - - MCFG_DECO146_ADD("ioprot") + MCFG_DECO146_ADD(m_deco146) MCFG_DECO146_SET_USE_MAGIC_ADDRESS_XOR /* sound hardware */ SPEAKER(config, "lspeaker").front_left(); SPEAKER(config, "rspeaker").front_right(); - MCFG_DEVICE_ADD("ymz", YMZ280B, 42000000 / 3) + MCFG_DEVICE_ADD(m_ymz, YMZ280B, 42000000 / 3) MCFG_SOUND_ROUTE(0, "lspeaker", 1.0) MCFG_SOUND_ROUTE(1, "rspeaker", 1.0) MACHINE_CONFIG_END diff --git a/src/mame/drivers/igs011.cpp b/src/mame/drivers/igs011.cpp index 8c0c84eaefb..1e652615e1a 100644 --- a/src/mame/drivers/igs011.cpp +++ b/src/mame/drivers/igs011.cpp @@ -260,6 +260,7 @@ private: INTERRUPT_GEN_MEMBER(lhb_vblank_irq); void wlcc_decrypt(); void lhb_decrypt(); + void drgnwrld_type4_decrypt(); void drgnwrld_type3_decrypt(); void drgnwrld_type2_decrypt(); void drgnwrld_type1_decrypt(); @@ -746,6 +747,32 @@ void igs011_state::lhb_decrypt() } } +void igs011_state::drgnwrld_type4_decrypt() +{ + uint16_t *src = (uint16_t *) (memregion("maincpu")->base()); + + int rom_size = 0x80000; + + for (int i = 0; i space(AS_PROGRAM).install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this)); // wrong diff --git a/src/mame/includes/deco_mlc.h b/src/mame/includes/deco_mlc.h index e63af284675..c2a853e03be 100644 --- a/src/mame/includes/deco_mlc.h +++ b/src/mame/includes/deco_mlc.h @@ -20,6 +20,7 @@ public: m_screen(*this, "screen"), m_palette(*this, "palette"), m_deco146(*this, "ioprot"), + m_raster_irq_timer(*this, "int_timer"), m_mainram(*this, "mainram"), m_irq_ram(*this, "irq_ram"), m_clip_ram(*this, "clip_ram"), @@ -27,6 +28,19 @@ public: m_gfx2(*this,"gfx2") { } + void init_mlc(); + void init_avengrgs(); + + void mlc(machine_config &config); + void mlc_6bpp(machine_config &config); + void avengrgs(machine_config &config); + void mlc_5bpp(machine_config &config); + +protected: + virtual void machine_reset() override; + virtual void video_start() override; + +private: required_device m_maincpu; required_device m_eeprom; required_device m_ymz; @@ -34,6 +48,7 @@ public: required_device m_screen; required_device m_palette; optional_device m_deco146; + required_device m_raster_irq_timer; required_shared_ptr m_mainram; required_shared_ptr m_irq_ram; @@ -42,7 +57,6 @@ public: required_region_ptr m_gfx2; - timer_device *m_raster_irq_timer; int m_irqLevel; uint32_t m_mlc_raster_table_1[4*256]; uint32_t m_mlc_raster_table_2[4*256]; @@ -74,20 +88,16 @@ public: DECLARE_READ16_MEMBER( sh96_protection_region_0_146_r ); DECLARE_WRITE16_MEMBER( sh96_protection_region_0_146_w ); - void init_mlc(); - void init_avengrgs(); - DECLARE_MACHINE_RESET(mlc); - DECLARE_VIDEO_START(mlc); uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_mlc); TIMER_DEVICE_CALLBACK_MEMBER(interrupt_gen); void draw_sprites( const rectangle &cliprect, int scanline, uint32_t* dest); + void drawgfxzoomline(uint32_t* dest,const rectangle &clip,gfx_element *gfx, + uint32_t code1,uint32_t code2, uint32_t color,int flipx,int sx, + int transparent_color,int use8bpp, + int scalex, int alpha, int srcline, int shadowMode, int alphaMode); void descramble_sound( ); - void mlc(machine_config &config); - void mlc_6bpp(machine_config &config); - void avengrgs(machine_config &config); - void mlc_5bpp(machine_config &config); void avengrgs_map(address_map &map); void decomlc_map(address_map &map); }; diff --git a/src/mame/video/deco_mlc.cpp b/src/mame/video/deco_mlc.cpp index 85f066de120..4415c231456 100644 --- a/src/mame/video/deco_mlc.cpp +++ b/src/mame/video/deco_mlc.cpp @@ -17,7 +17,7 @@ /******************************************************************************/ -VIDEO_START_MEMBER(deco_mlc_state,mlc) +void deco_mlc_state::video_start() { int max_color = (0x800 / m_gfxdecode->gfx(0)->granularity()); m_colour_mask=max_color - 1; @@ -34,8 +34,7 @@ VIDEO_START_MEMBER(deco_mlc_state,mlc) } -static void mlc_drawgfxzoomline(deco_mlc_state *state, - uint32_t* dest,const rectangle &clip,gfx_element *gfx, +void deco_mlc_state::drawgfxzoomline(uint32_t* dest,const rectangle &clip,gfx_element *gfx, uint32_t code1,uint32_t code2, uint32_t color,int flipx,int sx, int transparent_color,int use8bpp, int scalex, int alpha, int srcline, int shadowMode, int alphaMode ) @@ -90,7 +89,7 @@ static void mlc_drawgfxzoomline(deco_mlc_state *state, if( ex>sx ) { /* skip if inner loop doesn't draw anything */ - const pen_t *pal = &state->m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); + const pen_t *pal = &m_palette->pen(gfx->colorbase() + gfx->granularity() * (color % gfx->colors())); const uint8_t *code_base1 = gfx->get_data(code1 % gfx->elements()); const uint8_t *code_base2 = gfx->get_data(code2 % gfx->elements()); const uint8_t *source1 = code_base1 + (srcline) * gfx->rowbytes(); @@ -516,8 +515,7 @@ void deco_mlc_state::draw_sprites( const rectangle &cliprect, int scanline, uint } } - mlc_drawgfxzoomline(this, - dest,user_clip,m_gfxdecode->gfx(0), + drawgfxzoomline(dest,user_clip,m_gfxdecode->gfx(0), tile,tile2, color + colorOffset,fx,realxbase, 0,