From 327ca4c96eef73b7be9aeff1efe947495dd0220b Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Fri, 17 Apr 2015 23:24:21 -0700 Subject: [PATCH] Stub invalid vertex decoder colors to avoid crash. These values are invalid, but before we'd call a null pointer if we hit them. Should do tests to see what actual behavior is. --- GPU/Common/VertexDecoderCommon.cpp | 15 +++++++++++++-- GPU/Common/VertexDecoderCommon.h | 1 + 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/GPU/Common/VertexDecoderCommon.cpp b/GPU/Common/VertexDecoderCommon.cpp index 79f2674331..6e36c8830b 100644 --- a/GPU/Common/VertexDecoderCommon.cpp +++ b/GPU/Common/VertexDecoderCommon.cpp @@ -365,6 +365,11 @@ void VertexDecoder::Step_TcFloatPrescale() const { uv[1] = uvdata[1] * gstate_c.uv.vScale + gstate_c.uv.vOff; } +void VertexDecoder::Step_ColorInvalid() const +{ + // Do nothing. This is only here to prevent crashes. +} + void VertexDecoder::Step_Color565() const { u8 *c = decoded_ + decFmt.c0off; @@ -762,7 +767,10 @@ static const StepFunction tcstep_through_RemasterToFloat[4] = { // TODO: Tc Morph static const StepFunction colstep[8] = { - 0, 0, 0, 0, + 0, + &VertexDecoder::Step_ColorInvalid, + &VertexDecoder::Step_ColorInvalid, + &VertexDecoder::Step_ColorInvalid, &VertexDecoder::Step_Color565, &VertexDecoder::Step_Color5551, &VertexDecoder::Step_Color4444, @@ -770,7 +778,10 @@ static const StepFunction colstep[8] = { }; static const StepFunction colstep_morph[8] = { - 0, 0, 0, 0, + 0, + &VertexDecoder::Step_ColorInvalid, + &VertexDecoder::Step_ColorInvalid, + &VertexDecoder::Step_ColorInvalid, &VertexDecoder::Step_Color565Morph, &VertexDecoder::Step_Color5551Morph, &VertexDecoder::Step_Color4444Morph, diff --git a/GPU/Common/VertexDecoderCommon.h b/GPU/Common/VertexDecoderCommon.h index d39d82da6e..fe56b3d9e9 100644 --- a/GPU/Common/VertexDecoderCommon.h +++ b/GPU/Common/VertexDecoderCommon.h @@ -493,6 +493,7 @@ public: void Step_TcU16ThroughDoubleToFloat() const; void Step_TcFloatThrough() const; + void Step_ColorInvalid() const; void Step_Color4444() const; void Step_Color565() const; void Step_Color5551() const;