mirror of
https://github.com/holub/mame
synced 2025-05-21 13:18:56 +03:00
Another out-of-bounds error caught by randomizing memory.
This commit is contained in:
parent
38b9895e51
commit
dead7010da
@ -128,45 +128,48 @@ static VIDEO_UPDATE( cubeqst )
|
|||||||
memset(depth_buffer, 0xff, 512);
|
memset(depth_buffer, 0xff, 512);
|
||||||
|
|
||||||
/* Process all the spans on this scanline */
|
/* Process all the spans on this scanline */
|
||||||
for (i = 0; i < num_entries; i += 2)
|
if (y < 256)
|
||||||
{
|
{
|
||||||
int color = 0, depth = 0;
|
for (i = 0; i < num_entries; i += 2)
|
||||||
int h1 = 0, h2 = 0;
|
|
||||||
int x;
|
|
||||||
|
|
||||||
int entry1 = stk_ram[(y << 7) | ((i + 0) & 0x7f)];
|
|
||||||
int entry2 = stk_ram[(y << 7) | ((i + 1) & 0x7f)];
|
|
||||||
|
|
||||||
/* Determine which entry is the start point and which is the stop */
|
|
||||||
if ( entry1 & (1 << 19) )
|
|
||||||
{
|
{
|
||||||
h1 = (entry2 >> 8) & 0x1ff;
|
int color = 0, depth = 0;
|
||||||
depth = entry2 & 0xff;
|
int h1 = 0, h2 = 0;
|
||||||
|
int x;
|
||||||
|
|
||||||
h2 = (entry1 >> 8) & 0x1ff;
|
int entry1 = stk_ram[(y << 7) | ((i + 0) & 0x7f)];
|
||||||
color = entry1 & 0xff;
|
int entry2 = stk_ram[(y << 7) | ((i + 1) & 0x7f)];
|
||||||
}
|
|
||||||
else if ( entry2 & (1 << 19) )
|
|
||||||
{
|
|
||||||
h1 = (entry1 >> 8) & 0x1ff;
|
|
||||||
depth = entry1 & 0xff;
|
|
||||||
|
|
||||||
h2 = (entry2 >> 8) & 0x1ff;
|
/* Determine which entry is the start point and which is the stop */
|
||||||
color = entry2 & 0xff;
|
if ( entry1 & (1 << 19) )
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Shouldn't happen...
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Draw the span, testing for depth */
|
|
||||||
pen = colormap[paletteram16[color]];
|
|
||||||
for (x = h1; x <= h2; ++x)
|
|
||||||
{
|
|
||||||
if (!(depth_buffer[x] < depth))
|
|
||||||
{
|
{
|
||||||
dest[x] = pen;
|
h1 = (entry2 >> 8) & 0x1ff;
|
||||||
depth_buffer[x] = depth;
|
depth = entry2 & 0xff;
|
||||||
|
|
||||||
|
h2 = (entry1 >> 8) & 0x1ff;
|
||||||
|
color = entry1 & 0xff;
|
||||||
|
}
|
||||||
|
else if ( entry2 & (1 << 19) )
|
||||||
|
{
|
||||||
|
h1 = (entry1 >> 8) & 0x1ff;
|
||||||
|
depth = entry1 & 0xff;
|
||||||
|
|
||||||
|
h2 = (entry2 >> 8) & 0x1ff;
|
||||||
|
color = entry2 & 0xff;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Shouldn't happen...
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Draw the span, testing for depth */
|
||||||
|
pen = colormap[paletteram16[color]];
|
||||||
|
for (x = h1; x <= h2; ++x)
|
||||||
|
{
|
||||||
|
if (!(depth_buffer[x] < depth))
|
||||||
|
{
|
||||||
|
dest[x] = pen;
|
||||||
|
depth_buffer[x] = depth;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user