From 611afb779984306116788b04cdb061e2af0f9b70 Mon Sep 17 00:00:00 2001 From: MS Date: Thu, 21 Sep 2023 05:27:27 -0400 Subject: [PATCH] Quick patch for EqualsDataProduct (#134) --- LEGO1/mxmatrix.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/LEGO1/mxmatrix.cpp b/LEGO1/mxmatrix.cpp index 534db6a9..1cc3c550 100644 --- a/LEGO1/mxmatrix.cpp +++ b/LEGO1/mxmatrix.cpp @@ -111,21 +111,20 @@ void MxMatrix::EqualsMxProduct(const MxMatrix *p_a, const MxMatrix *p_b) EqualsDataProduct(p_a->m_data, p_b->m_data); } -// Just a placeholder matrix multiply implementation. I think the decomp will -// look roughly like this but it's not close to matching and won't be until -// an exact match is found given it's all loop and float crunching. -// OFFSET: LEGO1 0x100024d0 STUB +// OFFSET: LEGO1 0x100024d0 void MxMatrix::EqualsDataProduct(const float *p_a, const float *p_b) { + float *cur = m_data; for (int row = 0; row < 4; ++row) { for (int col = 0; col < 4; ++col) { - m_data[row * 4 + col] = 0.0f; + *cur = 0.0f; for (int k = 0; k < 4; ++k) { - m_data[row * 4 + col] += p_a[row * 4 + k] * p_b[k * 4 + col]; + *cur += p_a[row * 4 + k] * p_b[k * 4 + col]; } + cur++; } } }