added assert for usage of uninitialized stack memory in n64_rdp::SpanDraw1Cycle() (nw)

happens with e.g. n64 -cart vprowrs2 - it actually already goes out of
bounds in poly_manager::render_triangle_custom() but since that code is
generic it's hard to add an assert there / also added another FBSize
check
This commit is contained in:
Oliver Stöneberg 2014-11-09 14:10:48 +01:00
parent 5ad41fafe5
commit 46051f5655
2 changed files with 16 additions and 0 deletions

View File

@ -1983,6 +1983,9 @@ void n64_rdp::DrawTriangle(bool shade, bool texture, bool zbuffer, bool rect)
int dzdx_dz = (dzdx >> 16) & 0xffff;
extent_t Spans[2048];
#ifdef MAME_DEBUG
memset(Spans, 0xcc, sizeof(Spans));
#endif
SpanBase.m_span_drdy = drdy;
SpanBase.m_span_dgdy = dgdy;

View File

@ -152,6 +152,11 @@ void n64_rdp::SpanDraw1Cycle(INT32 scanline, const extent_t &extent, const rdp_p
INT32 tile1 = tilenum;
#ifdef PTR64
assert(extent.userdata != (const void *)0xcccccccccccccccc);
#else
assert(extent.userdata != (const void *)0xcccccccc);
#endif
rdp_span_aux *userdata = (rdp_span_aux*)extent.userdata;
INT32 m_clamp_s_diff[8];
@ -325,6 +330,11 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
INT32 news = 0;
INT32 newt = 0;
#ifdef PTR64
assert(extent.userdata != (const void *)0xcccccccccccccccc);
#else
assert(extent.userdata != (const void *)0xcccccccc);
#endif
rdp_span_aux *userdata = (rdp_span_aux*)extent.userdata;
INT32 m_clamp_s_diff[8];
@ -367,6 +377,9 @@ void n64_rdp::SpanDraw2Cycle(INT32 scanline, const extent_t &extent, const rdp_p
dzinc = 0;
}
if (object.MiscState.FBSize < 2 || object.MiscState.FBSize > 4)
fatalerror("unsupported FBSize %d\n", object.MiscState.FBSize);
int blend_index = (object.OtherModes.alpha_cvg_select ? 2 : 0) | ((object.OtherModes.rgb_dither_sel < 3) ? 1 : 0);
int read_index = ((object.MiscState.FBSize - 2) << 1) | object.OtherModes.image_read_en;
int write_index = ((object.MiscState.FBSize - 2) << 3) | (object.OtherModes.cvg_dest << 1);