Mercurial > repos > blastem
comparison vdp.c @ 1454:a664bade4b29
Fix minor graphical regression in Gunstar Heroes
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 29 Aug 2017 23:49:57 -0700 |
parents | da72344af3ff |
children | 3c1661305219 |
comparison
equal
deleted
inserted
replaced
1453:cd6e566eb6b9 | 1454:a664bade4b29 |
---|---|
2704 } | 2704 } |
2705 } | 2705 } |
2706 | 2706 |
2707 static void vdp_inactive(vdp_context *context, uint32_t target_cycles, uint8_t is_h40, uint8_t mode_5) | 2707 static void vdp_inactive(vdp_context *context, uint32_t target_cycles, uint8_t is_h40, uint8_t mode_5) |
2708 { | 2708 { |
2709 uint8_t buf_clear_slot, index_reset_slot, bg_end_slot, vint_slot, line_change, jump_start, jump_dest; | 2709 uint8_t buf_clear_slot, index_reset_slot, bg_end_slot, vint_slot, line_change, jump_start, jump_dest, latch_slot; |
2710 uint8_t index_reset_value, max_draws, max_sprites; | 2710 uint8_t index_reset_value, max_draws, max_sprites; |
2711 uint16_t vint_line, active_line; | 2711 uint16_t vint_line, active_line; |
2712 uint32_t bg_color; | 2712 uint32_t bg_color; |
2713 | 2713 |
2714 if (mode_5) { | 2714 if (mode_5) { |
2715 if (is_h40) { | 2715 if (is_h40) { |
2716 latch_slot = 165; | |
2716 buf_clear_slot = 163; | 2717 buf_clear_slot = 163; |
2717 index_reset_slot = 167; | 2718 index_reset_slot = 167; |
2718 bg_end_slot = BG_START_SLOT + LINEBUF_SIZE/2; | 2719 bg_end_slot = BG_START_SLOT + LINEBUF_SIZE/2; |
2719 max_draws = MAX_DRAWS-1; | 2720 max_draws = MAX_DRAWS-1; |
2720 max_sprites = MAX_SPRITES_LINE; | 2721 max_sprites = MAX_SPRITES_LINE; |
2732 index_reset_value = 0x80; | 2733 index_reset_value = 0x80; |
2733 vint_slot = VINT_SLOT_H32; | 2734 vint_slot = VINT_SLOT_H32; |
2734 line_change = LINE_CHANGE_H32; | 2735 line_change = LINE_CHANGE_H32; |
2735 jump_start = 147; | 2736 jump_start = 147; |
2736 jump_dest = 233; | 2737 jump_dest = 233; |
2738 latch_slot = 243; | |
2737 } | 2739 } |
2738 vint_line = context->inactive_start; | 2740 vint_line = context->inactive_start; |
2739 active_line = 0x1FF; | 2741 active_line = 0x1FF; |
2742 if (context->regs[REG_MODE_3] & BIT_VSCROLL) { | |
2743 latch_slot = 220; | |
2744 } | |
2740 } else { | 2745 } else { |
2746 latch_slot = 220; | |
2741 bg_end_slot = BG_START_SLOT + (256+HORIZ_BORDER)/2; | 2747 bg_end_slot = BG_START_SLOT + (256+HORIZ_BORDER)/2; |
2742 max_draws = MAX_DRAWS_H32_MODE4; | 2748 max_draws = MAX_DRAWS_H32_MODE4; |
2743 max_sprites = 8; | 2749 max_sprites = 8; |
2744 buf_clear_slot = 136; | 2750 buf_clear_slot = 136; |
2745 index_reset_slot = 253; | 2751 index_reset_slot = 253; |
2819 } | 2825 } |
2820 memset(context->linebuf, 0, LINEBUF_SIZE); | 2826 memset(context->linebuf, 0, LINEBUF_SIZE); |
2821 } else if (context->hslot == index_reset_slot) { | 2827 } else if (context->hslot == index_reset_slot) { |
2822 context->sprite_index = index_reset_value; | 2828 context->sprite_index = index_reset_value; |
2823 context->slot_counter = mode_5 ? 0 : max_sprites; | 2829 context->slot_counter = mode_5 ? 0 : max_sprites; |
2830 } else if (context->hslot == latch_slot) { | |
2831 //it seems unlikely to me that vscroll actually gets latched when the display is off | |
2832 //but it's the only straightforward way to reconcile what I'm seeing between Skitchin | |
2833 //(which seems to expect vscroll to be latched early) and the intro of Gunstar Heroes | |
2834 //(which disables the display and ends up with garbage if vscroll is latched during that period) | |
2835 //without it. Some more tests are definitely needed | |
2836 context->vscroll_latch[0] = context->vsram[0]; | |
2837 context->vscroll_latch[1] = context->vsram[1]; | |
2824 } else if (context->vcounter == vint_line && context->hslot == vint_slot) { | 2838 } else if (context->vcounter == vint_line && context->hslot == vint_slot) { |
2825 context->flags2 |= FLAG2_VINT_PENDING; | 2839 context->flags2 |= FLAG2_VINT_PENDING; |
2826 context->pending_vint_start = context->cycles; | 2840 context->pending_vint_start = context->cycles; |
2827 } else if (context->vcounter == context->inactive_start && context->hslot == 1 && (context->regs[REG_MODE_4] & BIT_INTERLACE)) { | 2841 } else if (context->vcounter == context->inactive_start && context->hslot == 1 && (context->regs[REG_MODE_4] & BIT_INTERLACE)) { |
2828 context->flags2 ^= FLAG2_EVEN_FIELD; | 2842 context->flags2 ^= FLAG2_EVEN_FIELD; |