finally fix invalid module disrupting program

This commit is contained in:
tildearrow 2021-12-19 21:11:23 -05:00
parent f327e036ce
commit 498fa99c5a
3 changed files with 13 additions and 5 deletions

View File

@ -1413,6 +1413,12 @@ void DivEngine::reset() {
dispatch->reset();
}
void DivEngine::syncReset() {
isBusy.lock();
reset();
isBusy.unlock();
}
String DivEngine::getConfigPath() {
return configPath;
}
@ -1696,6 +1702,7 @@ void DivEngine::initDispatch() {
break;
}
dispatch->init(this,getChannelCount(song.system),got.rate,(!song.pal) || (song.customTempo!=0 && song.hz<53));
chans=getChannelCount(song.system);
blip_set_rates(bb[0],dispatch->rate,got.rate);
blip_set_rates(bb[1],dispatch->rate,got.rate);

View File

@ -108,6 +108,7 @@ class DivEngine {
bool perSystemEffect(int ch, unsigned char effect, unsigned char effectVal);
bool perSystemPostEffect(int ch, unsigned char effect, unsigned char effectVal);
void renderSamples();
void reset();
public:
DivSong song;
@ -146,7 +147,7 @@ class DivEngine {
void stop();
// reset playback state
void reset();
void syncReset();
// get config path
String getConfigPath();

View File

@ -1768,11 +1768,11 @@ int FurnaceGUI::load(String path) {
if (!e->load(file,(size_t)len)) {
logE("could not open file!\n");
e->initDispatch();
e->reset();
e->syncReset();
return 1;
}
e->initDispatch();
e->reset();
e->syncReset();
}
updateWindowTitle();
return 0;
@ -2058,11 +2058,11 @@ bool FurnaceGUI::init() {
ImGui::GetIO().ConfigFlags|=ImGuiConfigFlags_DockingEnable;
ImGui::GetIO().IniFilename=finalLayoutPath;
if ((mainFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(defFont_main_compressed_data,defFont_main_compressed_size,18*dpiScale))==NULL) {
if ((mainFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(defFont_main_compressed_data,defFont_main_compressed_size,e->getConfInt("mainFontSize",18)*dpiScale))==NULL) {
logE("could not load UI font!\n");
return false;
}
if ((patFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(defFont_pat_compressed_data,defFont_pat_compressed_size,18*dpiScale))==NULL) {
if ((patFont=ImGui::GetIO().Fonts->AddFontFromMemoryCompressedTTF(defFont_pat_compressed_data,defFont_pat_compressed_size,e->getConfInt("patFontSize",18)*dpiScale))==NULL) {
logE("could not load pattern font!\n");
return false;
}