Skip to content

Commit

Permalink
[Experimental] Attempt to fix opening of some AIL banks
Browse files Browse the repository at this point in the history
It's weird, but, when opening that bank, at it's end the junk bank appears
Issue #93
  • Loading branch information
Wohlstand committed Aug 31, 2018
1 parent 65ca735 commit 92d4b93
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/FileFormats/format_ail2_gtl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ FfmtErrCode AIL_GTL::loadFile(QString filePath, FmBank &bank)
return FfmtErrCode::ERR_BADFORMAT;
}

if((insLen < 14) || (insLen > 25))
if(insLen < 14)
{
bank.reset();
return FfmtErrCode::ERR_BADFORMAT;
Expand All @@ -179,7 +179,16 @@ FfmtErrCode AIL_GTL::loadFile(QString filePath, FmBank &bank)
insLen -= 2;

memset(idata, 0, 24);
/*qint64 got = */ file.read(char_p(idata), insLen);
if(insLen < 24)
{
file.read(char_p(idata), insLen);
}
else
{
file.read(char_p(idata), 24);
file.seek(file.pos() + (insLen - 24));
}
/*qint64 got = file.read(char_p(idata), insLen);*/
//if(got != insLen)
//{
// bank.reset();
Expand Down

0 comments on commit 92d4b93

Please sign in to comment.