mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 13:35:11 +00:00
prepare to fix loading old .dmp files
This commit is contained in:
parent
0da7aaa56e
commit
da8380a6e2
1 changed files with 59 additions and 38 deletions
|
@ -4397,18 +4397,30 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else { // read as .dmp
|
} else { // read as .dmp
|
||||||
|
// this is a ridiculous mess
|
||||||
|
unsigned char version=0;
|
||||||
|
unsigned char sys=0;
|
||||||
try {
|
try {
|
||||||
reader.seek(0,SEEK_SET);
|
reader.seek(0,SEEK_SET);
|
||||||
unsigned char version=reader.readC();
|
version=reader.readC();
|
||||||
|
} catch (EndOfFileException e) {
|
||||||
if (version>11) {
|
lastError="premature end of file";
|
||||||
lastError="unknown sample version!";
|
logE("premature end of file!\n");
|
||||||
delete ins;
|
delete ins;
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char sys=reader.readC();
|
if (version>11) {
|
||||||
|
lastError="unknown instrument version!";
|
||||||
|
delete ins;
|
||||||
|
delete[] buf;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version>=10) { // 1.0
|
||||||
|
try {
|
||||||
|
sys=reader.readC();
|
||||||
|
|
||||||
switch (sys) {
|
switch (sys) {
|
||||||
case 1: // YMU759
|
case 1: // YMU759
|
||||||
|
@ -4442,7 +4454,16 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
} catch (EndOfFileException e) {
|
||||||
|
lastError="premature end of file";
|
||||||
|
logE("premature end of file!\n");
|
||||||
|
delete ins;
|
||||||
|
delete[] buf;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
bool mode=reader.readC();
|
bool mode=reader.readC();
|
||||||
if (mode==0 && ins->type==DIV_INS_FM) {
|
if (mode==0 && ins->type==DIV_INS_FM) {
|
||||||
ins->type=DIV_INS_STD;
|
ins->type=DIV_INS_STD;
|
||||||
|
|
Loading…
Reference in a new issue