don't load assets when loading temp ins
This commit is contained in:
parent
82649c9c81
commit
0627e38d63
|
@ -766,7 +766,7 @@ class DivEngine {
|
||||||
|
|
||||||
// get instrument from file
|
// get instrument from file
|
||||||
// if the returned vector is empty then there was an error.
|
// if the returned vector is empty then there was an error.
|
||||||
std::vector<DivInstrument*> instrumentFromFile(const char* path);
|
std::vector<DivInstrument*> instrumentFromFile(const char* path, bool loadAssets=true);
|
||||||
|
|
||||||
// load temporary instrument
|
// load temporary instrument
|
||||||
void loadTempIns(DivInstrument* which);
|
void loadTempIns(DivInstrument* which);
|
||||||
|
|
|
@ -1814,7 +1814,7 @@ void DivEngine::loadWOPN(SafeReader& reader, std::vector<DivInstrument*>& ret, S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path) {
|
std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path, bool loadAssets) {
|
||||||
std::vector<DivInstrument*> ret;
|
std::vector<DivInstrument*> ret;
|
||||||
warnings="";
|
warnings="";
|
||||||
|
|
||||||
|
@ -1919,7 +1919,7 @@ std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path) {
|
||||||
reader.seek(dataPtr,SEEK_SET);
|
reader.seek(dataPtr,SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ins->readInsData(reader,version,&song)!=DIV_DATA_SUCCESS) {
|
if (ins->readInsData(reader,version,loadAssets?(&song):NULL)!=DIV_DATA_SUCCESS) {
|
||||||
lastError="invalid instrument header/data!";
|
lastError="invalid instrument header/data!";
|
||||||
delete ins;
|
delete ins;
|
||||||
delete[] buf;
|
delete[] buf;
|
||||||
|
|
|
@ -2501,8 +2501,12 @@ DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, b
|
||||||
readFeatureES(reader);
|
readFeatureES(reader);
|
||||||
} else if (memcmp(featCode,"X1",2)==0) { // X1-010
|
} else if (memcmp(featCode,"X1",2)==0) { // X1-010
|
||||||
readFeatureX1(reader);
|
readFeatureX1(reader);
|
||||||
|
} else {
|
||||||
|
if (song==NULL && (memcmp(featCode,"SL",2)==0 || (memcmp(featCode,"WL",2)==0))) {
|
||||||
|
// nothing
|
||||||
} else {
|
} else {
|
||||||
logW("unknown feature code %c%c!",featCode[0],featCode[1]);
|
logW("unknown feature code %c%c!",featCode[0],featCode[1]);
|
||||||
|
}
|
||||||
// skip feature
|
// skip feature
|
||||||
unsigned short skip=reader.readS();
|
unsigned short skip=reader.readS();
|
||||||
reader.seek(skip,SEEK_CUR);
|
reader.seek(skip,SEEK_CUR);
|
||||||
|
|
|
@ -1475,7 +1475,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
dpiScale,
|
dpiScale,
|
||||||
[this](const char* path) {
|
[this](const char* path) {
|
||||||
int sampleCountBefore=e->song.sampleLen;
|
int sampleCountBefore=e->song.sampleLen;
|
||||||
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path);
|
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path,false);
|
||||||
if (!instruments.empty()) {
|
if (!instruments.empty()) {
|
||||||
if (e->song.sampleLen!=sampleCountBefore) {
|
if (e->song.sampleLen!=sampleCountBefore) {
|
||||||
e->renderSamplesP();
|
e->renderSamplesP();
|
||||||
|
|
Loading…
Reference in a new issue