Skip to content

Commit 05c5c7e

Browse files
committed
snk/hng64_3d.ipp: Fixed vertex ROM range check and moved indexing after check.
Fixes assertion failures, etc.
1 parent ae78e07 commit 05c5c7e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/mame/snk/hng64_3d.ipp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,7 @@ void hng64_state::recoverPolygonBlock(const u16* packet, int& numPolys)
489489

490490
// 3d ROM Offset
491491
const u32 threeDOffset = (u32(packet[2]) << 16) | u32(packet[3]);
492-
const u16 *const threeDPointer = &m_vertsrom[threeDOffset * 3];
493-
494-
if (threeDOffset >= m_vertsrom.length())
492+
if ((threeDOffset * 3) >= m_vertsrom.length())
495493
{
496494
// bbust2 quite often spams this invalid pointer
497495
if ((packet[2] == 0x2347) && (packet[3] == 0x5056))
@@ -502,6 +500,8 @@ void hng64_state::recoverPolygonBlock(const u16* packet, int& numPolys)
502500
return;
503501
}
504502

503+
const u16 *const threeDPointer = &m_vertsrom[threeDOffset * 3];
504+
505505
#if 0
506506
// Debug - ajg
507507
printf("%08x : ", threeDOffset*3*2);
@@ -586,7 +586,7 @@ void hng64_state::recoverPolygonBlock(const u16* packet, int& numPolys)
586586
}
587587

588588
// Syntactical simplification
589-
polygon& currentPoly = m_polys[numPolys];
589+
polygon &currentPoly = m_polys[numPolys];
590590

591591
// Debug - ajg
592592
//LOG3D("%d (%08x) : %04x %04x %04x\n", k, address[k]*3*2, chunkOffset[0], chunkOffset[1], chunkOffset[2]);
@@ -614,7 +614,7 @@ void hng64_state::recoverPolygonBlock(const u16* packet, int& numPolys)
614614
currentPoly.palOffset = 0;
615615

616616
//u16 explicitPaletteValue0 = ((chunkOffset[?] & 0x????) >> ?) * 0x800;
617-
u16 explicitPaletteValue = ((chunkOffset[1] & 0x0ff0) >> 4);
617+
u16 explicitPaletteValue = (chunkOffset[1] & 0x0ff0) >> 4;
618618
explicitPaletteValue = explicitPaletteValue << 3;
619619

620620
// HACK: this is not the enable, the cars in roadedge rely on this to switch palettes

0 commit comments

Comments
 (0)