STATIC_INLINE void maybe_first_bpl1dat (int hpos)
{
- if (thisline_decision.plfleft < 0)
+ if (thisline_decision.plfleft < 0) {
thisline_decision.plfleft = hpos;
+ }
}
static int fetch_warn (int nr, int hpos)
// This is really the end of scanline, we can finally flush all remaining data.
thisline_decision.plfright += flush_plane_data (fetchmode);
+ // This can overflow if display setup is really bad.
+ if (out_offs > MAX_PIXELS_PER_LINE / 32)
+ out_offs = MAX_PIXELS_PER_LINE / 32;
thisline_decision.plflinelen = out_offs;
finish_playfield_line ();
STATIC_INLINE void decide_fetch_safe (int hpos)
{
- if (!blitter_dangerous_bpl) {
+ if (!blitter_dangerous_bpl && !bitplane_overrun) {
decide_fetch (hpos);
decide_blitter (hpos);
} else {
if (nodraw ())
return;
+ // if overrun at the beginning of scanline was not handled: do it here first.
+ if (bitplane_overrun) {
+ do_overrun_fetch(hpos, fetchmode);
+ }
decide_diw (hpos);
decide_line (hpos);
decide_fetch_safe (hpos);
/* Now, compute some offsets. */
ddf_left -= DISPLAY_LEFT_SHIFT;
+ if (ddf_left < 0)
+ ddf_left = 0;
pixels_offset = MAX_PIXELS_PER_LINE - (ddf_left << bplres);
ddf_left <<= bplres;
if (linetoscr_diw_end > native_ddf_right) {
int pos = res_shift_from_window (native_ddf_right - native_ddf_left);
int size = res_shift_from_window (linetoscr_diw_end - native_ddf_right);
+ if (pos + size > MAX_PIXELS_PER_LINE)
+ size = MAX_PIXELS_PER_LINE - pos;
+ if (size > 0)
+ memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size);
linetoscr_diw_start = native_ddf_left;
- memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size);
}
}
if (sprite_last_x > native_ddf_right) {
int pos = res_shift_from_window (native_ddf_right - native_ddf_left);
int size = res_shift_from_window (sprite_last_x - native_ddf_right);
- memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size);
+ if (pos + size > MAX_PIXELS_PER_LINE)
+ size = MAX_PIXELS_PER_LINE - pos;
+ if (size > 0)
+ memset (pixdata.apixels + MAX_PIXELS_PER_LINE + pos, 0, size);
}
}