mirror of
https://github.com/holub/mame
synced 2025-05-15 18:32:02 +03:00
fix out of bounds array access during astrowar boot
This commit is contained in:
parent
6e34740603
commit
fd66104ca6
@ -60,35 +60,51 @@ PALETTE_INIT( astrowar )
|
||||
palette_set_color_rgb(machine, BULLET_PEN, pal1bit(1), pal1bit(1), pal1bit(0));
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_bg_tile_info )
|
||||
static TILE_GET_INFO( get_galaxia_bg_tile_info )
|
||||
{
|
||||
galaxia_state *state = machine.driver_data<galaxia_state>();
|
||||
UINT8 code = state->m_video_ram[tile_index] & 0x7f; // d7 unused
|
||||
UINT8 color = state->m_color_ram[tile_index] & 3; // highest bits unused
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( get_astrowar_bg_tile_info )
|
||||
{
|
||||
galaxia_state *state = machine.driver_data<galaxia_state>();
|
||||
UINT8 code = state->m_video_ram[tile_index];
|
||||
UINT8 color = state->m_color_ram[tile_index]; // highest bits unused
|
||||
UINT8 color = state->m_color_ram[tile_index] & 7; // highest bits unused
|
||||
|
||||
SET_TILE_INFO(0, code, color, 0);
|
||||
}
|
||||
|
||||
static void init_common( running_machine &machine )
|
||||
{
|
||||
assert((STAR_PEN & 7) == 0);
|
||||
cvs_init_stars(machine);
|
||||
}
|
||||
|
||||
VIDEO_START( galaxia )
|
||||
{
|
||||
galaxia_state *state = machine.driver_data<galaxia_state>();
|
||||
init_common(machine);
|
||||
|
||||
assert((STAR_PEN & 7) == 0);
|
||||
|
||||
state->m_bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->m_bg_tilemap = tilemap_create(machine, get_galaxia_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->m_bg_tilemap->set_transparent_pen(0);
|
||||
state->m_bg_tilemap->set_scroll_cols(8);
|
||||
|
||||
cvs_init_stars(machine);
|
||||
}
|
||||
|
||||
VIDEO_START( astrowar )
|
||||
{
|
||||
VIDEO_START_CALL(galaxia);
|
||||
|
||||
galaxia_state *state = machine.driver_data<galaxia_state>();
|
||||
init_common(machine);
|
||||
|
||||
state->m_bg_tilemap = tilemap_create(machine, get_astrowar_bg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
|
||||
state->m_bg_tilemap->set_transparent_pen(0);
|
||||
state->m_bg_tilemap->set_scroll_cols(8);
|
||||
state->m_bg_tilemap->set_scrolldx(8, 8);
|
||||
|
||||
machine.primary_screen->register_screen_bitmap(state->m_temp_bitmap);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user