GUI: fix #400
This commit is contained in:
parent
28af57c4f0
commit
9eb9561b53
|
@ -1428,6 +1428,10 @@ bool DivEngine::addWaveFromFile(const char* path) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (len==(SIZE_MAX>>1)) {
|
||||||
|
fclose(f);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (len==0) {
|
if (len==0) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return false;
|
return false;
|
||||||
|
@ -1620,6 +1624,14 @@ int DivEngine::addSampleFromFile(const char* path) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len==(SIZE_MAX>>1)) {
|
||||||
|
fclose(f);
|
||||||
|
BUSY_END;
|
||||||
|
lastError="file is invalid!";
|
||||||
|
delete sample;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
if (fseek(f,0,SEEK_SET)<0) {
|
if (fseek(f,0,SEEK_SET)<0) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
|
|
|
@ -1220,6 +1220,11 @@ std::vector<DivInstrument*> DivEngine::instrumentFromFile(const char* path) {
|
||||||
fclose(f);
|
fclose(f);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
if (len==(SIZE_MAX>>1)) {
|
||||||
|
lastError=strerror(errno);
|
||||||
|
fclose(f);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
if (len==0) {
|
if (len==0) {
|
||||||
lastError=strerror(errno);
|
lastError=strerror(errno);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
|
@ -1286,6 +1286,7 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case GUI_FILE_INS_OPEN:
|
case GUI_FILE_INS_OPEN:
|
||||||
|
prevIns=-3;
|
||||||
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
|
if (!dirExists(workingDirIns)) workingDirIns=getHomeDir();
|
||||||
hasOpened=fileDialog->openLoad(
|
hasOpened=fileDialog->openLoad(
|
||||||
"Load Instrument",
|
"Load Instrument",
|
||||||
|
@ -1298,6 +1299,9 @@ void FurnaceGUI::openFileDialog(FurnaceGUIFileDialogs type) {
|
||||||
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path);
|
std::vector<DivInstrument*> instruments=e->instrumentFromFile(path);
|
||||||
if (!instruments.empty()) {
|
if (!instruments.empty()) {
|
||||||
e->loadTempIns(instruments[0]);
|
e->loadTempIns(instruments[0]);
|
||||||
|
if (curIns!=-2) {
|
||||||
|
prevIns=curIns;
|
||||||
|
}
|
||||||
curIns=-2;
|
curIns=-2;
|
||||||
}
|
}
|
||||||
for (DivInstrument* i: instruments) delete i;
|
for (DivInstrument* i: instruments) delete i;
|
||||||
|
@ -2937,6 +2941,9 @@ bool FurnaceGUI::loop() {
|
||||||
workingDirLayout=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
workingDirLayout=fileDialog->getPath()+DIR_SEPARATOR_STR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (prevIns!=-3) {
|
||||||
|
curIns=prevIns;
|
||||||
|
}
|
||||||
if (fileDialog->accepted()) {
|
if (fileDialog->accepted()) {
|
||||||
fileName=fileDialog->getFileName();
|
fileName=fileDialog->getFileName();
|
||||||
if (fileName!="") {
|
if (fileName!="") {
|
||||||
|
@ -3791,6 +3798,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
curSample(0),
|
curSample(0),
|
||||||
curOctave(3),
|
curOctave(3),
|
||||||
curOrder(0),
|
curOrder(0),
|
||||||
|
prevIns(0),
|
||||||
oldRow(0),
|
oldRow(0),
|
||||||
oldOrder(0),
|
oldOrder(0),
|
||||||
oldOrder1(0),
|
oldOrder1(0),
|
||||||
|
|
|
@ -931,7 +931,7 @@ class FurnaceGUI {
|
||||||
|
|
||||||
char finalLayoutPath[4096];
|
char finalLayoutPath[4096];
|
||||||
|
|
||||||
int curIns, curWave, curSample, curOctave, curOrder, oldRow, oldOrder, oldOrder1, editStep, exportLoops, soloChan, soloTimeout, orderEditMode, orderCursor;
|
int curIns, curWave, curSample, curOctave, curOrder, prevIns, oldRow, oldOrder, oldOrder1, editStep, exportLoops, soloChan, soloTimeout, orderEditMode, orderCursor;
|
||||||
int loopOrder, loopRow, loopEnd, isClipping, extraChannelButtons, patNameTarget, newSongCategory, latchTarget;
|
int loopOrder, loopRow, loopEnd, isClipping, extraChannelButtons, patNameTarget, newSongCategory, latchTarget;
|
||||||
int wheelX, wheelY;
|
int wheelX, wheelY;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue