deco_mlc.cpp: device_finder (nw)

This commit is contained in:
Ivan Vangelista 2018-05-31 11:36:59 +02:00
parent ee20deea84
commit 9fcd763f8e
4 changed files with 68 additions and 41 deletions

View File

@ -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<timer_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

View File

@ -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 <rom_size / 2; i++)
{
uint16_t x = src[i];
if ((i & 0x2000) == 0x0000 || (i & 0x0004) == 0x0000 || (i & 0x0090) == 0x0000)
{ logerror("x:%04x, 04", x); x ^= 0x0004; }
if ((i & 0x0100) == 0x0100 || (i & 0x0040) == 0x0040 || (i & 0x0012) == 0x0012)
{ logerror("x:%04x, 20", x); x ^= 0x0020; }
if ( (i & 0x2400) == 0x0000)
{ logerror("x:%04x, 200", x); x ^= 0x0200; }
if ((x & 0x0024) == 0x0004 || (x & 0x0024) == 0x0020)
{ logerror("x:%04x, 24", x); x ^= 0x0024; }
src[i] = x;
logerror("i: %08x x: %04x\n", i, x);
}
}
void igs011_state::drgnwrld_type3_decrypt()
{
@ -2306,7 +2333,7 @@ void igs011_state::init_drgnwrldv20j()
void igs011_state::init_drgnwrldv40k()
{
//drgnwrld_type3_decrypt(); // wrong
drgnwrld_type4_decrypt(); // wrong
drgnwrld_gfx_decrypt();
//m_maincpu->space(AS_PROGRAM).install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this)); // wrong

View File

@ -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<cpu_device> m_maincpu;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<ymz280b_device> m_ymz;
@ -34,6 +48,7 @@ public:
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
optional_device<deco146_device> m_deco146;
required_device<timer_device> m_raster_irq_timer;
required_shared_ptr<uint32_t> m_mainram;
required_shared_ptr<uint32_t> m_irq_ram;
@ -42,7 +57,6 @@ public:
required_region_ptr<uint8_t> 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);
};

View File

@ -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,