diff --git a/src/engine/fileOpsIns.cpp b/src/engine/fileOpsIns.cpp index 148c9d2e9..b74c7cba3 100644 --- a/src/engine/fileOpsIns.cpp +++ b/src/engine/fileOpsIns.cpp @@ -829,12 +829,15 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector& ret, St c1Read = false, m2Read = false, c2Read = false; + + DivInstrument* newPatch = nullptr; auto completePatchRead = [&]() { return patchNameRead && lfoRead && characteristicRead && m1Read && c1Read && m2Read && c2Read; }; auto resetPatchRead = [&]() { patchNameRead = lfoRead = characteristicRead = m1Read = c1Read = m2Read = c2Read = false; + newPatch = nullptr; }; auto readOpmOperator = [](SafeReader& reader, DivInstrumentFM::Operator& op) { op.ar = atoi(reader.readString_Token().c_str()); @@ -850,8 +853,6 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector& ret, St op.ssgEnv = atoi(reader.readString_Token().c_str()); }; - DivInstrument* newPatch = nullptr; - try { reader.seek(0, SEEK_SET); while (!reader.isEOF()) { @@ -922,7 +923,7 @@ void DivEngine::loadOPM(SafeReader& reader, std::vector& ret, St if (completePatchRead()) { insList.push_back(newPatch); - newPatch = nullptr; + resetPatchRead(); ++readCount; } } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 009952a63..d3218b30c 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1290,9 +1290,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) { if (!dirExists(workingDirIns)) workingDirIns=getHomeDir(); hasOpened=fileDialog->openLoad( "Load Instrument", - {"compatible files", "*.fui *.dmp *.tfi *.vgi *.s3i *.sbi *.bnk *.ff", + {"compatible files", "*.fui *.dmp *.tfi *.vgi *.s3i *.sbi *.bnk *.ff *.opm", "all files", ".*"}, - "compatible files{.fui,.dmp,.tfi,.vgi,.s3i,.sbi,.bnk,.ff},.*", + "compatible files{.fui,.dmp,.tfi,.vgi,.s3i,.sbi,.bnk,.ff,.opm},.*", workingDirIns, dpiScale ); diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index f1cd27a36..f1565b8ee 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -2489,6 +2489,7 @@ void FurnaceGUI::applyUISettings(bool updateFonts) { ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".fti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE); ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".bti",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE); ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".ff",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE); + ImGuiFileDialog::Instance()->SetFileStyle(IGFD_FileStyleByExtension,".opm",uiColors[GUI_COLOR_FILE_INSTR],ICON_FA_FILE); if (updateFonts) { if (fileDialog!=NULL) delete fileDialog;