MOD import: don't complain about end of file
I gotta figure out how to fix this
This commit is contained in:
parent
83e7d966b9
commit
ff2b3e77a0
|
@ -1252,15 +1252,19 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
|
||||||
|
|
||||||
// check mod magic bytes
|
// check mod magic bytes
|
||||||
if (!reader.seek(1080,SEEK_SET)) {
|
if (!reader.seek(1080,SEEK_SET)) {
|
||||||
|
logD("couldn't seek to 1080\n");
|
||||||
throw EndOfFileException(&reader,reader.tell());
|
throw EndOfFileException(&reader,reader.tell());
|
||||||
}
|
}
|
||||||
reader.read(magic,4);
|
reader.read(magic,4);
|
||||||
if (memcmp(magic,"M.K.",4)==0 || memcmp(magic,"M!K!",4)==0) {
|
if (memcmp(magic,"M.K.",4)==0 || memcmp(magic,"M!K!",4)==0) {
|
||||||
|
logD("detected a ProTracker module\n");
|
||||||
chCount=4;
|
chCount=4;
|
||||||
} else if(memcmp(magic+1,"CHN",3)==0 && magic[0]>='1' && magic[0]<='9') {
|
} else if(memcmp(magic+1,"CHN",3)==0 && magic[0]>='1' && magic[0]<='9') {
|
||||||
|
logD("detected a FastTracker module\n");
|
||||||
chCount=magic[0]-'0';
|
chCount=magic[0]-'0';
|
||||||
} else if((memcmp(magic+2,"CH",2)==0 || memcmp(magic+2,"CN",2)==0)
|
} else if((memcmp(magic+2,"CH",2)==0 || memcmp(magic+2,"CN",2)==0)
|
||||||
&&(magic[0]>='1' && magic[0]<='9' && magic[1]>='0' && magic[1]<='9')) {
|
&&(magic[0]>='1' && magic[0]<='9' && magic[1]>='0' && magic[1]<='9')) {
|
||||||
|
logD("detected a FastTracker module\n");
|
||||||
chCount=((magic[0]-'0')*10)+(magic[1]-'0');
|
chCount=((magic[0]-'0')*10)+(magic[1]-'0');
|
||||||
} else {
|
} else {
|
||||||
// TODO: Soundtracker MOD?
|
// TODO: Soundtracker MOD?
|
||||||
|
@ -1549,7 +1553,7 @@ bool DivEngine::loadMod(unsigned char* file, size_t len) {
|
||||||
}
|
}
|
||||||
success=true;
|
success=true;
|
||||||
} catch (EndOfFileException e) {
|
} catch (EndOfFileException e) {
|
||||||
logE("premature end of file!\n");
|
//logE("premature end of file!\n");
|
||||||
lastError="incomplete file";
|
lastError="incomplete file";
|
||||||
} catch (InvalidHeaderException e) {
|
} catch (InvalidHeaderException e) {
|
||||||
//logE("invalid info header!\n");
|
//logE("invalid info header!\n");
|
||||||
|
|
Loading…
Reference in a new issue