mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-24 05:25:12 +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;
|
||||
}
|
||||
} else { // read as .dmp
|
||||
// this is a ridiculous mess
|
||||
unsigned char version=0;
|
||||
unsigned char sys=0;
|
||||
try {
|
||||
reader.seek(0,SEEK_SET);
|
||||
unsigned char version=reader.readC();
|
||||
|
||||
if (version>11) {
|
||||
lastError="unknown sample version!";
|
||||
version=reader.readC();
|
||||
} catch (EndOfFileException e) {
|
||||
lastError="premature end of file";
|
||||
logE("premature end of file!\n");
|
||||
delete ins;
|
||||
delete[] buf;
|
||||
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) {
|
||||
case 1: // YMU759
|
||||
|
@ -4442,7 +4454,16 @@ bool DivEngine::addInstrumentFromFile(const char *path) {
|
|||
return false;
|
||||
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();
|
||||
if (mode==0 && ins->type==DIV_INS_FM) {
|
||||
ins->type=DIV_INS_STD;
|
||||
|
|
Loading…
Reference in a new issue