From b91c7d436babc48b812f6e2874072afc67ef52ea Mon Sep 17 00:00:00 2001 From: Kai Kaufman <92912278+ktkaufman03@users.noreply.github.com> Date: Sun, 2 Jul 2023 03:51:57 -0400 Subject: [PATCH 1/2] fix: MxDSFile::Open is now matching 100% (#69) --- LEGO1/mxdsfile.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/LEGO1/mxdsfile.cpp b/LEGO1/mxdsfile.cpp index 327fab46..3e587b07 100644 --- a/LEGO1/mxdsfile.cpp +++ b/LEGO1/mxdsfile.cpp @@ -23,16 +23,15 @@ MxDSFile::~MxDSFile() // OFFSET: LEGO1 0x100cc590 long MxDSFile::Open(unsigned long uStyle) { - // No idea what's stopping this one matching, but I'm pretty - // confident it has the correct behavior. + MXIOINFO& io = m_io; long longResult = 1; - memset(&m_io, 0, sizeof(MXIOINFO)); + memset(&io, 0, sizeof(MXIOINFO)); - if (m_io.Open(m_filename.GetData(), uStyle) != 0) { + if (io.Open(m_filename.GetData(), uStyle) != 0) { return -1; } - m_io.SetBuffer(NULL, 0, 0); + io.SetBuffer(NULL, 0, 0); m_position = 0; if (m_skipReadingChunks == 0) { From 0555e0575658f64f4976f7b823d774c710d7ff01 Mon Sep 17 00:00:00 2001 From: Kai Kaufman <92912278+ktkaufman03@users.noreply.github.com> Date: Sun, 2 Jul 2023 04:02:05 -0400 Subject: [PATCH 2/2] fix: ConvertHSVToRGB is effectively 100% matching (#70) --- LEGO1/legoutil.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/LEGO1/legoutil.cpp b/LEGO1/legoutil.cpp index 58e11e8f..5ea567e8 100644 --- a/LEGO1/legoutil.cpp +++ b/LEGO1/legoutil.cpp @@ -9,10 +9,13 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa double v9; double v12; double v13; + + double s_dbl = s; + if (s > 0.5f) calc = (1.0f - v) * s + v; else - calc = (v + 1.0) * s; + calc = (v + 1.0) * s_dbl; if (calc <= 0.0) { *g_out = 0.0f; @@ -20,7 +23,7 @@ void ConvertHSVToRGB(float h, float s, float v, float *r_out, float *b_out, floa *r_out = 0.0f; return; } - p = s * 2.0 - calc; + p = s * 2.0f - calc; hue_index = h * 6.0; v9 = (h * 6.0 - (float)hue_index) * ((calc - p) / calc) * calc; v12 = p + v9;