- Messages
- 162
- Country

hello
i'm receive this error from the in-game dev console:
nevertheless the module is compiled, initialized and loaded correctly, it works nicely as well.
Someone had same issue ?
Below the module code,
the SetRpmOverspeed() is triggered by a custom event originated in the behaviou xml when the PROP RPM overtakes 2600 rpm.
tia
/mario
i'm receive this error from the in-game dev console:
Code:
WASM: Exception c000001d in gauge warning_panel in module
P:\MicrosoftFlightSimulator\Community\mycompany-aircraft-wasm-gauge\SimObjects\Airplanes\MyCompany_Gauge_Aircraft\panel\ssw_shared.wasm
nevertheless the module is compiled, initialized and loaded correctly, it works nicely as well.
Someone had same issue ?
Below the module code,
the SetRpmOverspeed() is triggered by a custom event originated in the behaviou xml when the PROP RPM overtakes 2600 rpm.
tia
/mario
Code:
#include "ssw_shared.h"
#include "simvars.h"
#include <engine.h>
struct S_WLIGHTS
{
int iFont;
NVGcontext* nvgctx;
LocalSimVar* rpm_overspeed;
};
//////////////////
S_WLIGHTS wlights = {-1,0,0};
extern Engine* myEngine;
void SetRpmOverspeed(FLOAT64 overspeed) {
if (myEngine) {
RWSimVar* prop_rpm = myEngine->prop_rpm;
RWSimVar* throttle = myEngine->throttle_pos;
wlights.rpm_overspeed->Set(overspeed);
if (prop_rpm && throttle && (prop_rpm->Get() > 2600)) {
FLOAT64 thr = throttle->Get();
thr -= 0.2;
throttle->Set(thr);
}
}
}
///////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////
void DrawWarnings(NVGcontext* nvgctx, sGaugeDrawData* p_draw_data, struct S_WLIGHTS* data) {
if (data->iFont != -1) {
char str[50] = "";
//////////////////////////////////////////////////////////
nvgFontFaceId(nvgctx, data->iFont);
nvgFontSize(nvgctx, 0.20 * p_draw_data->winHeight);
nvgTextAlign(nvgctx, NVG_ALIGN_LEFT | NVG_ALIGN_TOP);
nvgFillColor(nvgctx, nvgRGB(250, 0, 0));
if (data->rpm_overspeed->Get() > 0.0) {
sprintf(str, "RPM OVERSPEED");
nvgText(nvgctx, 0, 0.10f * p_draw_data->winHeight, str, (const char*)NULL);
}
}
}
////////////////////////////////////////////////
extern "C" {
MSFS_CALLBACK bool warning_panel_gauge_callback(FsContext ctx, int service_id, void* pData)
{
switch (service_id)
{
/**/
case PANEL_SERVICE_PRE_INSTALL:
{
}
break;
////////////////////////
case PANEL_SERVICE_POST_INSTALL:
{
NVGparams params;
wlights.rpm_overspeed = dynamic_cast<LocalSimVar*>(GetSimVar("rpm_overspeed"));
///////////
params.edgeAntiAlias = true;
params.userPtr = ctx;
params.edgeAntiAlias = true;
params.userPtr = ctx;
wlights.nvgctx = nvgCreateInternal(¶ms);
if (wlights.nvgctx)
wlights.iFont = nvgCreateFont(wlights.nvgctx, "serif", "./data/Roboto-Regular.ttf");
}
break;
/////////////////
case PANEL_SERVICE_PRE_DRAW:
{
/// /////////////
sGaugeDrawData* p_draw_data = (sGaugeDrawData*)pData;
float pxRatio = (float)p_draw_data->fbWidth / (float)p_draw_data->winWidth;
NVGcontext* nvgctx = wlights.nvgctx;
nvgBeginFrame(nvgctx, p_draw_data->winWidth, p_draw_data->winHeight, pxRatio);
{
NVGpaint imgPaint;
int imgw, imgh;
// Black background
nvgFillColor(nvgctx, nvgRGB(0, 0, 0));
nvgBeginPath(nvgctx);
nvgRect(nvgctx, 0, 0, p_draw_data->winWidth, p_draw_data->winHeight);
nvgFill(nvgctx);
// draws warning lights
DrawWarnings(nvgctx, p_draw_data, &wlights);
}
nvgEndFrame(nvgctx);
}
break;
//////////////////
case PANEL_SERVICE_PRE_KILL:
{
NVGcontext* nvgctx = wlights.nvgctx;
nvgDeleteInternal(nvgctx);
FlushVarList();
}
break;
//////////////////
default:
return false;
} /////////////////////////
return true;
}
}
