From 7a52266da5b3581ae7c1362e291256a14c1f296c Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sun, 12 Oct 2025 14:21:33 -0500 Subject: [PATCH] GUI: fix off-by-one in Game Boy ins editor sound length 63 was being displayed as infinity --- src/gui/insEdit.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/insEdit.cpp b/src/gui/insEdit.cpp index 667d99ff2..eb196cbed 100644 --- a/src/gui/insEdit.cpp +++ b/src/gui/insEdit.cpp @@ -1952,7 +1952,7 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s ImGui::RenderFrame(rect.Min,rect.Max,ImGui::GetColorU32(ImGuiCol_FrameBg),true,style.FrameRounding); float volY=1.0-((float)vol/15.0); - float lenPos=(sLen>62)?1.0:((float)sLen/384.0); + float lenPos=(sLen>63)?1.0:((float)sLen/384.0); float envEndPoint=((float)len/7.0)*((float)(dir?(15-vol):vol)/15.0); ImVec2 pos1=ImLerp(rect.Min,rect.Max,ImVec2(0.0,volY)); @@ -1978,10 +1978,10 @@ void FurnaceGUI::drawGBEnv(unsigned char vol, unsigned char len, unsigned char s pos2=ImLerp(rect.Min,rect.Max,ImVec2(lenPos,volY)); } } - ImVec2 pos3=ImLerp(rect.Min,rect.Max,ImVec2(lenPos,(len>0 || sLen<63)?((dir && sLen>62)?0.0:1.0):volY)); + ImVec2 pos3=ImLerp(rect.Min,rect.Max,ImVec2(lenPos,(len>0 || sLen<64)?((dir && sLen>62)?0.0:1.0):volY)); addAALine(dl,pos1,pos2,color); - if (lenPos>=envEndPoint && sLen<63 && dir) { + if (lenPos>=envEndPoint && sLen<64 && dir) { pos3=ImLerp(rect.Min,rect.Max,ImVec2(lenPos,0.0)); addAALine(dl,pos2,pos3,color); ImVec2 pos4=ImLerp(rect.Min,rect.Max,ImVec2(lenPos,1.0));