Merge pull request #9609 from Pokechu22/fix-WriteVertexArray

Fix PanicAlert when recording FIFOs
This commit is contained in:
Léo Lam
2021-03-27 01:39:53 +01:00
committed by GitHub
9 changed files with 32 additions and 26 deletions

View File

@ -224,7 +224,7 @@ u32 AnalyzeCommand(const u8* data, DecodeMode mode)
// Determine offset of each element that might be a vertex array
// The first 9 elements are never vertex arrays so we just accumulate their sizes.
int offset = std::accumulate(sizes.begin(), sizes.begin() + 9, 0u);
std::array<int, 12> offsets;
std::array<int, NUM_VERTEX_COMPONENT_ARRAYS> offsets;
for (size_t i = 0; i < offsets.size(); ++i)
{
offsets[i] = offset;

View File

@ -50,10 +50,10 @@ void FifoRecordAnalyzer::WriteVertexArray(int arrayIndex, const u8* vertexData,
arrayType = s_CpMem.vtxDesc.low.Position;
else if (arrayIndex == ARRAY_NORMAL)
arrayType = s_CpMem.vtxDesc.low.Normal;
else if (arrayIndex == ARRAY_COLOR || arrayIndex == ARRAY_COLOR2)
arrayType = s_CpMem.vtxDesc.low.Color[arrayIndex - ARRAY_COLOR];
else if (arrayIndex >= ARRAY_POSITION && arrayIndex < ARRAY_POSITION + 8)
arrayType = s_CpMem.vtxDesc.high.TexCoord[arrayIndex - ARRAY_POSITION];
else if (arrayIndex >= ARRAY_COLOR0 && arrayIndex < ARRAY_COLOR0 + NUM_COLOR_ARRAYS)
arrayType = s_CpMem.vtxDesc.low.Color[arrayIndex - ARRAY_COLOR0];
else if (arrayIndex >= ARRAY_TEXCOORD0 && arrayIndex < ARRAY_TEXCOORD0 + NUM_TEXCOORD_ARRAYS)
arrayType = s_CpMem.vtxDesc.high.TexCoord[arrayIndex - ARRAY_TEXCOORD0];
else
{
PanicAlertFmt("Invalid arrayIndex {}", arrayIndex);