MSFS Version: 1.2.8.0
SDK Version: 1.1.2
Frequency: Consistently
Severity: High - Feature not functioning as intended, or if by design not a documented limitation
Bug description:
When using fsCommBusCall
in module_init
using the FsCommBusBroadcast_AllWasm
broadcast flags, the event is never received.
Calling fsCommBusCall
later (eg. when SIMCONNECT_RECV_ID_OPEN
is received) works as expected.
Small incomplete example:
const char* TestEventName = "test_event_name";
void EventCallback( const char* buf, unsigned int bufSize, void* ctx )
{
std::string Data( buf, bufSize );
std::cout << Data;
}
void CALLBACK CallDispatch( SIMCONNECT_RECV* pData, DWORD cbData, void* pContext )
{
switch ( pData->dwID )
{
case SIMCONNECT_RECV_ID_OPEN:
// Fire event to self after the SimConnect connection has opened - EventCallback is called in this case
std::string Data( "Event data from DispatchProc" );
fsCommBusCall( TestEventName, Data.c_str(), Data.size(), FsCommBusBroadcast_AllWasm );
break;
}
}
extern "C" MSFS_CALLBACK void module_init()
{
// SimConnect connection code omitted for brevity
// Commbus init
fsCommBusRegister( TestEventName, &EventCallback, nullptr );
// Fire event to self from module_init - EventCallback never called with this data
std::string Data( "Event data from module_init" );
fsCommBusCall( TestEventName, Data.c_str(), Data.size(), FsCommBusBroadcast_AllWasm );
}
Repro steps:
- Place the attached package in your community folder
- Launch MSFS 2024
- Open the dev mode console
- Search for
CommbusModuleInit.wasm
- Observe that
Event data from module_init
is not present in the log, andEvent data from DispatchProc
is present
Attachments:
A complete minimal package with an example of this is attached:
CommbusModuleInit.zip (818.0 KB)