From 80a92b8b43bda8e322c0bdb19ec0dfebbca1b983 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Sat, 4 Oct 2025 18:28:34 -0500 Subject: [PATCH] add option to remove unused patterns --- src/engine/song.cpp | 18 ++++++++++++++++++ src/engine/song.h | 1 + src/gui/gui.cpp | 8 ++++++++ 3 files changed, 27 insertions(+) diff --git a/src/engine/song.cpp b/src/engine/song.cpp index 7e6fb5e6f..e457478e4 100644 --- a/src/engine/song.cpp +++ b/src/engine/song.cpp @@ -278,6 +278,24 @@ void DivSubSong::clearData() { ordersLen=1; } +void DivSubSong::removeUnusedPatterns() { + for (int i=0; i& orders, std::vector& grooves, int& length, int chans, int jumpTreatment, int ignoreJumpAtEnd, int firstPat=0); void clearData(); + void removeUnusedPatterns(); void optimizePatterns(); void rearrangePatterns(); void sortOrders(); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 64de23ef3..de659e37a 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -6553,6 +6553,14 @@ bool FurnaceGUI::loop() { MARK_MODIFIED; ImGui::CloseCurrentPopup(); } + if (ImGui::Button(_("Remove unused patterns"))) { + stop(); + e->lockEngine([this]() { + e->curSubSong->removeUnusedPatterns(); + }); + MARK_MODIFIED; + ImGui::CloseCurrentPopup(); + } if (ImGui::Button(_("Remove unused instruments"))) { stop(); e->delUnusedIns();