mirror of
https://github.com/tildearrow/furnace.git
synced 2025-01-07 16:12:31 +00:00
don't load assets when loading temp ins
This commit is contained in:
parent
82649c9c81
commit
0627e38d63
4 changed files with 9 additions and 5 deletions
|
@ -766,7 +766,7 @@ class DivEngine {
|
|||
|
||||
// get instrument from file
|
||||
// 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
|
||||
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;
|
||||
warnings="";
|
||||
|
||||
|
@ -1919,7 +1919,7 @@ std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path) {
|
|||
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!";
|
||||
delete ins;
|
||||
delete[] buf;
|
||||
|
|
|
@ -2502,7 +2502,11 @@ DivDataErrors DivInstrument::readInsDataNew(SafeReader& reader, short version, b
|
|||
} else if (memcmp(featCode,"X1",2)==0) { // X1-010
|
||||
readFeatureX1(reader);
|
||||
} else {
|
||||
logW("unknown feature code %c%c!",featCode[0],featCode[1]);
|
||||
if (song==NULL && (memcmp(featCode,"SL",2)==0 || (memcmp(featCode,"WL",2)==0))) {
|
||||
// nothing
|
||||
} else {
|
||||
logW("unknown feature code %c%c!",featCode[0],featCode[1]);
|
||||
}
|
||||
// skip feature
|
||||
unsigned short skip=reader.readS();
|
||||
reader.seek(skip,SEEK_CUR);
|
||||
|
|
|
@ -1475,7 +1475,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
|||
dpiScale,
|
||||
[this](const char* path) {
|
||||
int sampleCountBefore=e->song.sampleLen;
|
||||
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path);
|
||||
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path,false);
|
||||
if (!instruments.empty()) {
|
||||
if (e->song.sampleLen!=sampleCountBefore) {
|
||||
e->renderSamplesP();
|
||||
|
|
Loading…
Reference in a new issue