diff options
Diffstat (limited to 'src/mame/video/neogeo.c')
-rw-r--r-- | src/mame/video/neogeo.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/src/mame/video/neogeo.c b/src/mame/video/neogeo.c index 9952706ec0b..409618bfc31 100644 --- a/src/mame/video/neogeo.c +++ b/src/mame/video/neogeo.c @@ -264,31 +264,30 @@ void neogeo_set_fixed_layer_source( running_machine &machine, UINT8 data ) } -static void draw_fixed_layer( running_machine &machine, bitmap_rgb32 &bitmap, int scanline ) +void neogeo_state::draw_fixed_layer( bitmap_rgb32 &bitmap, int scanline ) { - neogeo_state *state = machine.driver_data<neogeo_state>(); int x; - UINT8* gfx_base = state->memregion(state->m_fixed_layer_source ? "fixed" : "fixedbios")->base(); - UINT32 addr_mask = state->memregion(state->m_fixed_layer_source ? "fixed" : "fixedbios")->bytes() - 1; - UINT16 *video_data = &state->m_videoram[0x7000 | (scanline >> 3)]; + UINT8* gfx_base = m_fixed_layer_source ? m_region_fixed->base() : m_region_fixedbios->base(); + UINT32 addr_mask = ( m_fixed_layer_source ? m_region_fixed->bytes() : m_region_fixedbios->bytes() ) - 1; + UINT16 *video_data = &m_videoram[0x7000 | (scanline >> 3)]; UINT32 *pixel_addr = &bitmap.pix32(scanline, NEOGEO_HBEND); int garouoffsets[32]; - int banked = state->m_fixed_layer_source && (addr_mask > 0x1ffff); + int banked = m_fixed_layer_source && (addr_mask > 0x1ffff); /* thanks to Mr K for the garou & kof2000 banking info */ /* Build line banking table for Garou & MS3 before starting render */ - if (banked && state->m_fixed_layer_bank_type == 1) + if (banked && m_fixed_layer_bank_type == 1) { int garoubank = 0; int k = 0; int y = 0; while (y < 32) { - if (state->m_videoram[0x7500 + k] == 0x0200 && (state->m_videoram[0x7580 + k] & 0xff00) == 0xff00) + if (m_videoram[0x7500 + k] == 0x0200 && (m_videoram[0x7580 + k] & 0xff00) == 0xff00) { - garoubank = state->m_videoram[0x7580 + k] & 3; + garoubank = m_videoram[0x7580 + k] & 3; garouoffsets[y++] = garoubank; } garouoffsets[y++] = garoubank; @@ -304,14 +303,14 @@ static void draw_fixed_layer( running_machine &machine, bitmap_rgb32 &bitmap, in if (banked) { int y = scanline >> 3; - switch (state->m_fixed_layer_bank_type) + switch (m_fixed_layer_bank_type) { case 1: /* Garou, MSlug 3 */ code += 0x1000 * (garouoffsets[(y - 2) & 31] ^ 3); break; case 2: - code += 0x1000 * (((state->m_videoram[0x7500 + ((y - 1) & 31) + 32 * (x / 6)] >> (5 - (x % 6)) * 2) & 3) ^ 3); + code += 0x1000 * (((m_videoram[0x7500 + ((y - 1) & 31) + 32 * (x / 6)] >> (5 - (x % 6)) * 2) & 3) ^ 3); break; } } @@ -321,7 +320,7 @@ static void draw_fixed_layer( running_machine &machine, bitmap_rgb32 &bitmap, in int i; UINT8 *gfx = &gfx_base[((code << 5) | (scanline & 0x07)) & addr_mask]; - pen_t *char_pens = &state->m_pens[code_and_palette >> 12 << 4]; + pen_t *char_pens = &m_pens[code_and_palette >> 12 << 4]; for (i = 0; i < 4; i++) { @@ -670,10 +669,8 @@ static void start_sprite_line_timer( running_machine &machine ) } -static void optimize_sprite_data( running_machine &machine ) +void neogeo_state::optimize_sprite_data() { - neogeo_state *state = machine.driver_data<neogeo_state>(); - /* convert the sprite graphics data into a format that allows faster blitting */ int i; @@ -684,22 +681,22 @@ static void optimize_sprite_data( running_machine &machine ) /* get mask based on the length rounded up to the nearest power of 2 */ - state->m_sprite_gfx_address_mask = 0xffffffff; + m_sprite_gfx_address_mask = 0xffffffff; - len = state->memregion("sprites")->bytes(); + len = m_region_sprites->bytes(); for (bit = 0x80000000; bit != 0; bit >>= 1) { if (((len * 2) - 1) & bit) break; - state->m_sprite_gfx_address_mask >>= 1; + m_sprite_gfx_address_mask >>= 1; } - state->m_sprite_gfx = auto_alloc_array_clear(machine, UINT8, state->m_sprite_gfx_address_mask + 1); + m_sprite_gfx = auto_alloc_array_clear(machine(), UINT8, m_sprite_gfx_address_mask + 1); - src = machine.root_device().memregion("sprites")->base(); - dest = state->m_sprite_gfx; + src = m_region_sprites->base(); + dest = m_sprite_gfx; for (i = 0; i < len; i += 0x80, src += 0x80) { @@ -859,7 +856,7 @@ void neogeo_state::video_start() compute_rgb_weights(machine()); create_sprite_line_timer(machine()); create_auto_animation_timer(machine()); - optimize_sprite_data(machine()); + optimize_sprite_data(); /* initialize values that are not modified on a reset */ m_videoram_read_buffer = 0; @@ -902,7 +899,7 @@ void neogeo_state::video_reset() { start_sprite_line_timer(machine()); start_auto_animation_timer(machine()); - optimize_sprite_data(machine()); + optimize_sprite_data(); } @@ -920,7 +917,7 @@ UINT32 neogeo_state::screen_update_neogeo(screen_device &screen, bitmap_rgb32 &b if (m_has_sprite_bus) draw_sprites(machine(), bitmap, cliprect.min_y); - if (m_has_text_bus) draw_fixed_layer(machine(), bitmap, cliprect.min_y); + if (m_has_text_bus) draw_fixed_layer(bitmap, cliprect.min_y); return 0; } |