Detecting a crash

I’ve set a RequestDataOnSimObject for CRASH FLAG
but never get a result (is this because the flight ends with the crash and no message follows).

This also does not work in the Sim Watcher example in the SDK (Enum value)

To my knowledge the SimvarWatcher only shows simulation variables, but not events. Which simulation variable exacltly (name) did you try?

Besides that, I am successfully getting the “Crashed” event, with the following code (extract):

enum class Event: ::SIMCONNECT_CLIENT_EVENT_ID {
    SimStart,
    Pause,
    Crashed,
    ...
};

...
::SimConnect_SubscribeToSystemEvent(d->simConnectHandle, Enum::toUnderlyingType(Event::Crashed), "Crashed");
...
void CALLBACK SkyConnectImpl::dispatch(SIMCONNECT_RECV *receivedData, DWORD cbData, void *context) noexcept
{
...
switch (receivedData->dwID) {
case SIMCONNECT_RECV_ID_EVENT:
{
    const SIMCONNECT_RECV_EVENT *evt = reinterpret_cast<SIMCONNECT_RECV_EVENT *>(receivedData);
    switch (static_cast<Event>(evt->uEventID)) {
    case Event::SimStart:
        ...
        break;

    ...

    case Event::Crashed:
        // Process "crashed" event
        ...
        break;

    default:
        break;
    }
    break;
}

Of course you only get the “crashed” event when crash detection is actually enabled in FS2020 - so double-check your Flight Assistance settings :wink:

1 Like