From d4470aa42b0fe385287ee77211867e3c4ce6d9b5 Mon Sep 17 00:00:00 2001 From: M374LX Date: Sat, 27 Sep 2025 21:13:26 -0300 Subject: [PATCH] Start implementing EIF instrument support --- src/engine/engine.h | 1 + src/engine/fileOpsIns.cpp | 23 +++++++++++++++++++++++ src/gui/gui.cpp | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/engine/engine.h b/src/engine/engine.h index 74b8064f5..2c7c2ccb7 100644 --- a/src/engine/engine.h +++ b/src/engine/engine.h @@ -612,6 +612,7 @@ class DivEngine { void loadDMP(SafeReader& reader, std::vector& ret, String& stripPath); void loadTFI(SafeReader& reader, std::vector& ret, String& stripPath); void loadVGI(SafeReader& reader, std::vector& ret, String& stripPath); + void loadEIF(SafeReader& reader, std::vector& ret, String& stripPath); void loadS3I(SafeReader& reader, std::vector& ret, String& stripPath); void loadSBI(SafeReader& reader, std::vector& ret, String& stripPath); void loadOPLI(SafeReader& reader, std::vector& ret, String& stripPath); diff --git a/src/engine/fileOpsIns.cpp b/src/engine/fileOpsIns.cpp index dfc6671de..1e38f9f3e 100644 --- a/src/engine/fileOpsIns.cpp +++ b/src/engine/fileOpsIns.cpp @@ -27,6 +27,7 @@ enum DivInsFormats { DIV_INSFORMAT_DMP, DIV_INSFORMAT_TFI, DIV_INSFORMAT_VGI, + DIV_INSFORMAT_EIF, DIV_INSFORMAT_FTI, DIV_INSFORMAT_BTI, DIV_INSFORMAT_S3I, @@ -494,6 +495,23 @@ void DivEngine::loadVGI(SafeReader& reader, std::vector& ret, St ret.push_back(ins); } +void DivEngine::loadEIF(SafeReader& reader, std::vector& ret, String& stripPath) { + DivInstrument* ins=new DivInstrument; + try { + reader.seek(0,SEEK_SET); + + ins->type=DIV_INS_FM; + ins->name=stripPath; + } catch (EndOfFileException& e) { + lastError="premature end of file"; + logE("premature end of file"); + delete ins; + return; + } + + ret.push_back(ins); +} + void DivEngine::loadS3I(SafeReader& reader, std::vector& ret, String& stripPath) { DivInstrument* ins=new DivInstrument; try { @@ -1971,6 +1989,8 @@ std::vector DivEngine::instrumentFromFile(const char* path, bool format=DIV_INSFORMAT_TFI; } else if (extS==".vgi") { format=DIV_INSFORMAT_VGI; + } else if (extS==".eif") { + format=DIV_INSFORMAT_EIF; } else if (extS==".fti") { format=DIV_INSFORMAT_FTI; } else if (extS==".bti") { @@ -2015,6 +2035,9 @@ std::vector DivEngine::instrumentFromFile(const char* path, bool case DIV_INSFORMAT_VGI: loadVGI(reader,ret,stripPath); break; + case DIV_INSFORMAT_EIF: + loadEIF(reader,ret,stripPath); + break; case DIV_INSFORMAT_FTI: // TODO break; case DIV_INSFORMAT_BTI: // TODO diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 6b5b03bc7..d17efa94d 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1904,11 +1904,12 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) { if (!dirExists(workingDirIns)) workingDirIns=getHomeDir(); hasOpened=fileDialog->openLoad( _("Load Instrument"), - {_("all compatible files"), "*.fui *.dmp *.tfi *.vgi *.s3i *.sbi *.opli *.opni *.y12 *.bnk *.ff *.gyb *.opm *.wopl *.wopn", + {_("all compatible files"), "*.fui *.dmp *.tfi *.vgi *.eif *.s3i *.sbi *.opli *.opni *.y12 *.bnk *.ff *.gyb *.opm *.wopl *.wopn", _("Furnace instrument"), "*.fui", _("DefleMask preset"), "*.dmp", _("TFM Music Maker instrument"), "*.tfi", _("VGM Music Maker instrument"), "*.vgi", + _("Echo instrument"), "*.eif", _("Scream Tracker 3 instrument"), "*.s3i", _("SoundBlaster instrument"), "*.sbi", _("Wohlstand OPL instrument"), "*.opli",