Merge branch 'master' of https://github.com/tildearrow/furnace into ym2610b

This commit is contained in:
cam900 2022-02-27 06:41:11 +09:00
commit ee013ad7a9
10 changed files with 300 additions and 174 deletions

View file

@ -1153,15 +1153,24 @@ enum DivInsFormats {
DIV_INSFORMAT_BTI
};
bool DivEngine::addInstrumentFromFile(const char *path) {
bool DivEngine::addInstrumentFromFile(const char* path) {
warnings="";
const char* pathRedux=strrchr(path,DIR_SEPARATOR);
if (pathRedux==NULL) {
pathRedux="Instrument";
pathRedux=path;
} else {
pathRedux++;
}
String stripPath;
const char* pathReduxEnd=strrchr(pathRedux,'.');
if (pathReduxEnd==NULL) {
stripPath=pathRedux;
} else {
for (const char* i=pathRedux; i!=pathReduxEnd && (*i); i++) {
stripPath+=*i;
}
}
FILE* f=ps_fopen(path,"rb");
if (f==NULL) {
@ -1286,7 +1295,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
return false;
}
ins->name=pathRedux;
ins->name=stripPath;
if (version>=11) { // 1.0
try {
@ -1519,7 +1528,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
reader.seek(0,SEEK_SET);
ins->type=DIV_INS_FM;
ins->name=pathRedux;
ins->name=stripPath;
ins->fm.alg=reader.readC();
ins->fm.fb=reader.readC();
@ -1551,7 +1560,7 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
reader.seek(0,SEEK_SET);
ins->type=DIV_INS_FM;
ins->name=pathRedux;
ins->name=stripPath;
ins->fm.alg=reader.readC();
ins->fm.fb=reader.readC();