Skip to content

Commit

Permalink
fix: Disable dynamic library load in emscripten version !minor
Browse files Browse the repository at this point in the history
  • Loading branch information
lcgamboa committed Jul 26, 2022
1 parent 2281e81 commit e75ab6f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/boards/bsim_qemu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ int bsim_qemu::MInit(const char* processor, const char* _fname, float freq) {
serialfd[2] = INVALID_HANDLE_VALUE;
serialfd[3] = INVALID_HANDLE_VALUE;

#ifndef __EMSCRIPTEN__
if (!qemu_started) {
StartThread();
while (!qemu_started) {
Expand All @@ -197,15 +198,19 @@ int bsim_qemu::MInit(const char* processor, const char* _fname, float freq) {
mtx_qinit->Lock(); // only for wait qemu start
mtx_qinit->Unlock();
}

#else //qemu is not supported in emscripten version yet
qemu_started = -1;
#endif
Window1.menu1_File_LoadHex.SetText("Load Bin");
Window1.menu1_File_SaveHex.SetEnable(0);
Window1.filedialog1.SetFileName(lxT("untitled.bin"));
Window1.filedialog1.SetFilter(lxT("Bin Files (*.bin)|*.bin;*.BIN"));

#ifndef __EMSCRIPTEN__
} else {
printf("PICSimLab: qemu already started !!!!!\n");
}
#endif

return 0; // ret;
}
Expand Down
12 changes: 9 additions & 3 deletions src/picsimlab1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,11 @@ void CPWindow1::timer2_EvOnTime(CControl* control) {
label2.SetText(lxString().Format("Spd: %3.2fx", 100.0 / timer1.GetTime()));

if (Errors.GetLinesCount()) {
#ifndef __EMSCRIPTEN__
Message_sz(Errors.GetLine(0), 450, 200);
#else
printf("Error: %s\n", Errors.GetLine(0).c_str());
#endif
Errors.DelLine(0);
}

Expand Down Expand Up @@ -962,7 +966,9 @@ void CPWindow1::EndSimulation(int saveold, const char* newpath) {
}

void CPWindow1::SetNeedReboot(void) {
#ifndef __EMSCRIPTEN__
NeedReboot = 1;
#endif
}

void CPWindow1::menu1_File_LoadHex_EvMenuActive(CControl* control) {
Expand Down Expand Up @@ -1240,14 +1246,14 @@ void CPWindow1::menu1_EvMicrocontroller(CControl* control) {
}

void CPWindow1::togglebutton1_EvOnToggleButton(CControl* control) {
#ifdef NO_DEBUG
statusbar1.SetField(1, lxT(" "));
#else
int osc_on = pboard->GetUseOscilloscope();
int spare_on = pboard->GetUseSpareParts();

debug = togglebutton1.GetCheck();

#ifdef NO_DEBUG
statusbar1.SetField(1, lxT(" "));
#else
EndSimulation();
Configure(HOME);

Expand Down

0 comments on commit e75ab6f

Please sign in to comment.