Start implementing EIF instrument support

This commit is contained in:
M374LX 2025-09-27 21:13:26 -03:00 committed by tildearrow
parent f8068431b2
commit d4470aa42b
3 changed files with 26 additions and 1 deletions

View file

@ -612,6 +612,7 @@ class DivEngine {
void loadDMP(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadTFI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadVGI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadEIF(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadS3I(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadSBI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);
void loadOPLI(SafeReader& reader, std::vector<DivInstrument*>& ret, String& stripPath);

View file

@ -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<DivInstrument*>& ret, St
ret.push_back(ins);
}
void DivEngine::loadEIF(SafeReader& reader, std::vector<DivInstrument*>& 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<DivInstrument*>& ret, String& stripPath) {
DivInstrument* ins=new DivInstrument;
try {
@ -1971,6 +1989,8 @@ std::vector<DivInstrument*> 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<DivInstrument*> 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

View file

@ -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",