limenko.c, lordgun.c: added save state support (nw)

This commit is contained in:
Ivan Vangelista 2015-01-29 18:07:41 +01:00
parent b55b45a5a9
commit e3f6b06fdd
3 changed files with 111 additions and 72 deletions

View File

@ -34,18 +34,25 @@ class limenko_state : public driver_device
public:
limenko_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_qs1000(*this, "qs1000"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette"),
m_mainram(*this, "mainram"),
m_fg_videoram(*this, "fg_videoram"),
m_md_videoram(*this, "md_videoram"),
m_bg_videoram(*this, "bg_videoram"),
m_spriteram(*this, "spriteram"),
m_spriteram2(*this, "spriteram2"),
m_videoreg(*this, "videoreg"),
m_maincpu(*this, "maincpu"),
m_oki(*this, "oki"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette") { }
m_videoreg(*this, "videoreg") { }
required_device<cpu_device> m_maincpu;
optional_device<okim6295_device> m_oki;
optional_device<qs1000_device> m_qs1000;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
required_shared_ptr<UINT32> m_mainram;
required_shared_ptr<UINT32> m_fg_videoram;
required_shared_ptr<UINT32> m_md_videoram;
@ -53,14 +60,17 @@ public:
required_shared_ptr<UINT32> m_spriteram;
required_shared_ptr<UINT32> m_spriteram2;
required_shared_ptr<UINT32> m_videoreg;
tilemap_t *m_bg_tilemap;
tilemap_t *m_md_tilemap;
tilemap_t *m_fg_tilemap;
int m_spriteram_bit;
bitmap_ind16 m_sprites_bitmap;
bitmap_ind8 m_sprites_bitmap_pri;
int m_prev_sprites_count;
UINT8 m_spotty_sound_cmd;
DECLARE_WRITE32_MEMBER(limenko_coincounter_w);
DECLARE_WRITE32_MEMBER(bg_videoram_w);
DECLARE_WRITE32_MEMBER(md_videoram_w);
@ -75,29 +85,28 @@ public:
DECLARE_READ32_MEMBER(legendoh_speedup_r);
DECLARE_READ32_MEMBER(sb2003_speedup_r);
DECLARE_READ32_MEMBER(spotty_speedup_r);
DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
DECLARE_READ8_MEMBER(qs1000_p1_r);
DECLARE_WRITE8_MEMBER(qs1000_p1_w);
DECLARE_WRITE8_MEMBER(qs1000_p2_w);
DECLARE_WRITE8_MEMBER(qs1000_p3_w);
DECLARE_CUSTOM_INPUT_MEMBER(spriteram_bit_r);
DECLARE_DRIVER_INIT(common);
DECLARE_DRIVER_INIT(sb2003);
DECLARE_DRIVER_INIT(dynabomb);
DECLARE_DRIVER_INIT(legendoh);
DECLARE_DRIVER_INIT(spotty);
TILE_GET_INFO_MEMBER(get_bg_tile_info);
TILE_GET_INFO_MEMBER(get_md_tile_info);
TILE_GET_INFO_MEMBER(get_fg_tile_info);
virtual void video_start();
UINT32 screen_update_limenko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_single_sprite(bitmap_ind16 &dest_bmp,const rectangle &clip,gfx_element *gfx,UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int priority);
void draw_sprites(UINT32 *sprites, const rectangle &cliprect, int count);
void copy_sprites(bitmap_ind16 &bitmap, bitmap_ind16 &sprites_bitmap, bitmap_ind8 &priority_bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
optional_device<okim6295_device> m_oki;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
};
/*****************************************************************************************************
@ -165,10 +174,8 @@ WRITE32_MEMBER(limenko_state::spriteram_buffer_w)
WRITE32_MEMBER(limenko_state::limenko_soundlatch_w)
{
qs1000_device *qs1000 = machine().device<qs1000_device>("qs1000");
soundlatch_byte_w(space, 0, data >> 16);
qs1000->set_irq(ASSERT_LINE);
m_qs1000->set_irq(ASSERT_LINE);
machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
}
@ -198,12 +205,10 @@ WRITE8_MEMBER(limenko_state::qs1000_p3_w)
// ...x .... - ?
// ..x. .... - /IRQ clear
qs1000_device *qs1000 = machine().device<qs1000_device>("qs1000");
membank("qs1000:bank")->set_entry(data & 0x07);
if (!BIT(data, 5))
qs1000->set_irq(CLEAR_LINE);
m_qs1000->set_irq(CLEAR_LINE);
}
/*****************************************************************************************************
@ -500,6 +505,9 @@ void limenko_state::video_start()
m_sprites_bitmap.allocate(384,240);
m_sprites_bitmap_pri.allocate(384,240);
save_item(NAME(m_spriteram_bit));
save_item(NAME(m_prev_sprites_count));
}
UINT32 limenko_state::screen_update_limenko(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -1138,12 +1146,14 @@ DRIVER_INIT_MEMBER(limenko_state,spotty)
m_maincpu->space(AS_PROGRAM).install_read_handler(0x6626c, 0x6626f, read32_delegate(FUNC(limenko_state::spotty_speedup_r), this));
m_spriteram_bit = 1;
save_item(NAME(m_spotty_sound_cmd));
}
GAME( 2000, dynabomb, 0, limenko, sb2003, limenko_state, dynabomb, ROT0, "Limenko", "Dynamite Bomber (Korea, Rev 1.5)", GAME_IMPERFECT_SOUND )
GAME( 2000, legendoh, 0, limenko, legendoh, limenko_state, legendoh, ROT0, "Limenko", "Legend of Heroes", GAME_IMPERFECT_SOUND )
GAME( 2003, sb2003, 0, limenko, sb2003, limenko_state, sb2003, ROT0, "Limenko", "Super Bubble 2003 (World, Ver 1.0)", GAME_IMPERFECT_SOUND )
GAME( 2003, sb2003a, sb2003, limenko, sb2003, limenko_state, sb2003, ROT0, "Limenko", "Super Bubble 2003 (Asia, Ver 1.0)", GAME_IMPERFECT_SOUND )
GAME( 2000, dynabomb, 0, limenko, sb2003, limenko_state, dynabomb, ROT0, "Limenko", "Dynamite Bomber (Korea, Rev 1.5)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
GAME( 2000, legendoh, 0, limenko, legendoh, limenko_state, legendoh, ROT0, "Limenko", "Legend of Heroes", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
GAME( 2003, sb2003, 0, limenko, sb2003, limenko_state, sb2003, ROT0, "Limenko", "Super Bubble 2003 (World, Ver 1.0)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
GAME( 2003, sb2003a, sb2003, limenko, sb2003, limenko_state, sb2003, ROT0, "Limenko", "Super Bubble 2003 (Asia, Ver 1.0)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE )
// this game only use the same graphics chip used in limenko's system
GAME( 2001, spotty, 0, spotty, spotty, limenko_state, spotty, ROT0, "Prince Co.", "Spotty (Ver. 2.0.2)", GAME_NO_SOUND )
// this game only uses the same graphics chip used in Limenko's system
GAME( 2001, spotty, 0, spotty, spotty, limenko_state, spotty, ROT0, "Prince Co.", "Spotty (Ver. 2.0.2)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE )

View File

@ -47,6 +47,7 @@ Notes:
#include "sound/ymf278b.h"
#include "includes/lordgun.h"
/***************************************************************************
Memory Maps - Main
@ -59,15 +60,15 @@ WRITE16_MEMBER(lordgun_state::lordgun_protection_w)
{
case 0x00/2: // increment counter
{
m_lordgun_protection_data++;
m_lordgun_protection_data &= 0x1f;
m_protection_data++;
m_protection_data &= 0x1f;
return;
}
case 0xc0/2: // reset protection device
{
m_lordgun_protection_data = 0;
m_protection_data = 0;
return;
}
@ -80,22 +81,22 @@ READ16_MEMBER(lordgun_state::lordgun_protection_r)
{
case 0x40/2: // bitswap and xor counter
{
UINT8 x = m_lordgun_protection_data;
UINT8 x = m_protection_data;
m_lordgun_protection_data = ((( x >> 0) | ( x >> 1)) & 1) << 4;
m_lordgun_protection_data |= ((~x >> 2) & 1) << 3;
m_lordgun_protection_data |= (((~x >> 4) | ( x >> 0)) & 1) << 2;
m_lordgun_protection_data |= (( x >> 3) & 1) << 1;
m_lordgun_protection_data |= (((~x >> 0) | ( x >> 2)) & 1) << 0;
m_protection_data = ((( x >> 0) | ( x >> 1)) & 1) << 4;
m_protection_data |= ((~x >> 2) & 1) << 3;
m_protection_data |= (((~x >> 4) | ( x >> 0)) & 1) << 2;
m_protection_data |= (( x >> 3) & 1) << 1;
m_protection_data |= (((~x >> 0) | ( x >> 2)) & 1) << 0;
return 0;
}
case 0x80/2: // return value if conditions are met
{
if ((m_lordgun_protection_data & 0x11) == 0x01) return 0x10;
if ((m_lordgun_protection_data & 0x06) == 0x02) return 0x10;
if ((m_lordgun_protection_data & 0x09) == 0x08) return 0x10;
if ((m_protection_data & 0x11) == 0x01) return 0x10;
if ((m_protection_data & 0x06) == 0x02) return 0x10;
if ((m_protection_data & 0x09) == 0x08) return 0x10;
return 0;
}
@ -110,7 +111,7 @@ WRITE16_MEMBER(lordgun_state::aliencha_protection_w)
{
case 0xc0/2: // reset protection device
{
m_lordgun_protection_data = 0;
m_protection_data = 0;
return;
}
@ -123,30 +124,30 @@ READ16_MEMBER(lordgun_state::aliencha_protection_r)
{
case 0x00/2: // de-increment counter
{
m_lordgun_protection_data--;
m_lordgun_protection_data &= 0x1f;
m_protection_data--;
m_protection_data &= 0x1f;
return 0;
}
case 0x40/2: // bitswap and xor counter
{
UINT8 x = m_lordgun_protection_data;
UINT8 x = m_protection_data;
m_lordgun_protection_data = (((x >> 3) ^ (x >> 2)) & 1) << 4;
m_lordgun_protection_data |= (((x >> 2) ^ (x >> 1)) & 1) << 3;
m_lordgun_protection_data |= (((x >> 1) ^ (x >> 0)) & 1) << 2;
m_lordgun_protection_data |= (((x >> 4) ^ (x >> 0)) & 1) << 1;
m_lordgun_protection_data |= (((x >> 4) ^ (x >> 3)) & 1) << 0;
m_protection_data = (((x >> 3) ^ (x >> 2)) & 1) << 4;
m_protection_data |= (((x >> 2) ^ (x >> 1)) & 1) << 3;
m_protection_data |= (((x >> 1) ^ (x >> 0)) & 1) << 2;
m_protection_data |= (((x >> 4) ^ (x >> 0)) & 1) << 1;
m_protection_data |= (((x >> 4) ^ (x >> 3)) & 1) << 0;
return 0;
}
case 0x80/2: // return value if conditions are met
{
if ((m_lordgun_protection_data & 0x11) == 0x00) return 0x20;
if ((m_lordgun_protection_data & 0x06) != 0x06) return 0x20;
if ((m_lordgun_protection_data & 0x18) == 0x00) return 0x20;
if ((m_protection_data & 0x11) == 0x00) return 0x20;
if ((m_protection_data & 0x06) != 0x06) return 0x20;
if ((m_protection_data & 0x18) == 0x00) return 0x20;
return 0;
}
@ -622,6 +623,13 @@ INPUT_PORTS_END
***************************************************************************/
void lordgun_state::machine_start()
{
save_item(NAME(m_protection_data));
save_item(NAME(m_priority));
save_item(NAME(m_whitescreen));
}
static MACHINE_CONFIG_START( lordgun, lordgun_state )
MCFG_CPU_ADD("maincpu", M68000, XTAL_20MHz / 2)
MCFG_CPU_PROGRAM_MAP(lordgun_map)
@ -1027,13 +1035,12 @@ ROM_END
***************************************************************************/
DRIVER_INIT_MEMBER(lordgun_state,lordgun)
DRIVER_INIT_MEMBER(lordgun_state, lordgun)
{
int i;
UINT16 *rom = (UINT16 *)memregion("maincpu")->base();
int rom_size = 0x100000;
for(i = 0; i < rom_size/2; i++)
for(int i = 0; i < rom_size/2; i++)
{
UINT16 x = rom[i];
@ -1042,6 +1049,21 @@ DRIVER_INIT_MEMBER(lordgun_state,lordgun)
rom[i] = x;
}
save_item(NAME(m_old));
for (int i = 0; i < 2; i++)
{
save_item(NAME(m_gun[i].scr_x), i);
save_item(NAME(m_gun[i].scr_y), i);
save_item(NAME(m_gun[i].hw_x), i);
save_item(NAME(m_gun[i].hw_y), i);
}
}
DRIVER_INIT_MEMBER(lordgun_state, aliencha)
{
save_item(NAME(m_aliencha_dip_sel));
}
/***************************************************************************
@ -1050,6 +1072,6 @@ DRIVER_INIT_MEMBER(lordgun_state,lordgun)
***************************************************************************/
GAME( 1994, lordgun, 0, lordgun, lordgun, lordgun_state, lordgun, ROT0, "IGS", "Lord of Gun (USA)", GAME_IMPERFECT_GRAPHICS )
GAME( 1994, aliencha, 0, aliencha, aliencha, driver_device, 0, ROT0, "IGS", "Alien Challenge (World)", 0 )
GAME( 1994, alienchac, aliencha, aliencha, aliencha, driver_device, 0, ROT0, "IGS", "Alien Challenge (China)", 0 )
GAME( 1994, lordgun, 0, lordgun, lordgun, lordgun_state, lordgun, ROT0, "IGS", "Lord of Gun (USA)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
GAME( 1994, aliencha, 0, aliencha, aliencha, driver_device, 0, ROT0, "IGS", "Alien Challenge (World)", GAME_SUPPORTS_SAVE )
GAME( 1994, alienchac, aliencha, aliencha, aliencha, driver_device, 0, ROT0, "IGS", "Alien Challenge (China)", GAME_SUPPORTS_SAVE )

View File

@ -17,12 +17,6 @@ class lordgun_state : public driver_device
public:
lordgun_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_priority_ram(*this, "priority_ram"),
m_scrollram(*this, "scrollram"),
m_spriteram(*this, "spriteram"),
m_vram(*this, "vram"),
m_scroll_x(*this, "scroll_x"),
m_scroll_y(*this, "scroll_y") ,
m_maincpu(*this, "maincpu"),
m_soundcpu(*this, "soundcpu"),
m_oki(*this, "oki"),
@ -30,24 +24,39 @@ public:
m_gfxdecode(*this, "gfxdecode"),
m_screen(*this, "screen"),
m_palette(*this, "palette"),
m_generic_paletteram_16(*this, "paletteram") { }
m_generic_paletteram_16(*this, "paletteram"),
m_priority_ram(*this, "priority_ram"),
m_scrollram(*this, "scrollram"),
m_spriteram(*this, "spriteram"),
m_vram(*this, "vram"),
m_scroll_x(*this, "scroll_x"),
m_scroll_y(*this, "scroll_y") { }
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<okim6295_device> m_oki;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_generic_paletteram_16;
required_shared_ptr<UINT16> m_priority_ram;
required_shared_ptr<UINT16> m_scrollram;
required_shared_ptr<UINT16> m_spriteram;
required_shared_ptr_array<UINT16, 4> m_vram;
required_shared_ptr_array<UINT16, 4> m_scroll_x;
required_shared_ptr_array<UINT16, 4> m_scroll_y;
UINT8 m_old;
UINT8 m_aliencha_dip_sel;
UINT16 m_priority;
required_shared_ptr_array<UINT16, 4> m_vram;
required_shared_ptr_array<UINT16, 4> m_scroll_x;
required_shared_ptr_array<UINT16, 4> m_scroll_y;
int m_whitescreen;
lordgun_gun_data m_gun[2];
tilemap_t *m_tilemap[4];
bitmap_ind16 *m_bitmaps[5];
UINT16 m_lordgun_protection_data;
UINT16 m_protection_data;
DECLARE_WRITE16_MEMBER(lordgun_protection_w);
DECLARE_READ16_MEMBER(lordgun_protection_r);
DECLARE_WRITE16_MEMBER(aliencha_protection_w);
@ -71,26 +80,24 @@ public:
DECLARE_READ8_MEMBER(aliencha_dip_r);
DECLARE_WRITE8_MEMBER(aliencha_dip_w);
DECLARE_WRITE8_MEMBER(lordgun_okibank_w);
DECLARE_DRIVER_INIT(aliencha);
DECLARE_DRIVER_INIT(lordgun);
TILE_GET_INFO_MEMBER(get_tile_info_0);
TILE_GET_INFO_MEMBER(get_tile_info_1);
TILE_GET_INFO_MEMBER(get_tile_info_2);
TILE_GET_INFO_MEMBER(get_tile_info_3);
virtual void machine_start();
virtual void video_start();
UINT32 screen_update_lordgun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
inline void get_tile_info(tile_data &tileinfo, tilemap_memory_index tile_index, int _N_);
inline void lordgun_vram_w(offs_t offset, UINT16 data, UINT16 mem_mask, int _N_);
void lorddgun_calc_gun_scr(int i);
void lordgun_update_gun(int i);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
required_device<cpu_device> m_soundcpu;
required_device<okim6295_device> m_oki;
required_device<eeprom_serial_93cxx_device> m_eeprom;
required_device<gfxdecode_device> m_gfxdecode;
required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
required_shared_ptr<UINT16> m_generic_paletteram_16;
};
/*----------- defined in video/lordgun.c -----------*/