From e75ab6feaec584f5508a4ee482643670d2ba2726 Mon Sep 17 00:00:00 2001 From: lcgamboa Date: Mon, 25 Jul 2022 23:16:47 -0300 Subject: [PATCH] fix: Disable dynamic library load in emscripten version !minor --- src/boards/bsim_qemu.cc | 7 ++++++- src/picsimlab1.cc | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/boards/bsim_qemu.cc b/src/boards/bsim_qemu.cc index 5928856d..99fff84c 100644 --- a/src/boards/bsim_qemu.cc +++ b/src/boards/bsim_qemu.cc @@ -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) { @@ -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; } diff --git a/src/picsimlab1.cc b/src/picsimlab1.cc index 726e4786..ac214928 100644 --- a/src/picsimlab1.cc +++ b/src/picsimlab1.cc @@ -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); } @@ -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) { @@ -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);