mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-27 06:53:01 +00:00
IT import: fix empty asset loading
This commit is contained in:
parent
6d4efbd908
commit
63f8289847
1 changed files with 20 additions and 0 deletions
|
@ -136,6 +136,12 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
|
||||||
// read instruments
|
// read instruments
|
||||||
for (int i=0; i<ds.insLen; i++) {
|
for (int i=0; i<ds.insLen; i++) {
|
||||||
DivInstrument* ins=new DivInstrument;
|
DivInstrument* ins=new DivInstrument;
|
||||||
|
ins->type=DIV_INS_ES5506;
|
||||||
|
|
||||||
|
if (insPtr[i]==0) {
|
||||||
|
ds.ins.push_back(ins);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
logV("reading instrument %d...",i);
|
logV("reading instrument %d...",i);
|
||||||
if (!reader.seek(insPtr[i],SEEK_SET)) {
|
if (!reader.seek(insPtr[i],SEEK_SET)) {
|
||||||
|
@ -252,6 +258,11 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
|
||||||
for (int i=0; i<ds.sampleLen; i++) {
|
for (int i=0; i<ds.sampleLen; i++) {
|
||||||
DivSample* s=new DivSample;
|
DivSample* s=new DivSample;
|
||||||
|
|
||||||
|
if (samplePtr[i]==0) {
|
||||||
|
ds.sample.push_back(s);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
logV("reading sample %d...",i);
|
logV("reading sample %d...",i);
|
||||||
if (!reader.seek(samplePtr[i],SEEK_SET)) {
|
if (!reader.seek(samplePtr[i],SEEK_SET)) {
|
||||||
logE("premature end of file!");
|
logE("premature end of file!");
|
||||||
|
@ -401,6 +412,8 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
|
||||||
// read patterns
|
// read patterns
|
||||||
int maxChan=0;
|
int maxChan=0;
|
||||||
for (int i=0; i<patCount; i++) {
|
for (int i=0; i<patCount; i++) {
|
||||||
|
if (patPtr[i]==0) continue;
|
||||||
|
|
||||||
unsigned char mask[64];
|
unsigned char mask[64];
|
||||||
unsigned char note[64];
|
unsigned char note[64];
|
||||||
unsigned char ins[64];
|
unsigned char ins[64];
|
||||||
|
@ -427,6 +440,13 @@ bool DivEngine::loadIT(unsigned char* file, size_t len) {
|
||||||
unsigned int dataLen=(unsigned short)reader.readS();
|
unsigned int dataLen=(unsigned short)reader.readS();
|
||||||
unsigned short patRows=reader.readS();
|
unsigned short patRows=reader.readS();
|
||||||
|
|
||||||
|
if (patRows>DIV_MAX_ROWS) {
|
||||||
|
logE("too many rows! %d",patRows);
|
||||||
|
lastError="too many rows";
|
||||||
|
delete[] file;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
reader.readI(); // x
|
reader.readI(); // x
|
||||||
|
|
||||||
dataLen+=reader.tell();
|
dataLen+=reader.tell();
|
||||||
|
|
Loading…
Reference in a new issue