Don't crash on desktop builds

This commit is contained in:
Anders Jenbo 2025-06-13 18:08:42 +02:00
parent 5080e372f9
commit ab25067897

View File

@ -566,16 +566,15 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
break; break;
} }
} }
#ifdef __EMSCRIPTEN__
else if (event->user.type == g_legoSdlEvents.m_presenterProgress) { else if (event->user.type == g_legoSdlEvents.m_presenterProgress) {
MxPresenter* presenter = static_cast<MxPresenter*>(event->user.data1); MxPresenter* presenter = static_cast<MxPresenter*>(event->user.data1);
MxDSAction* action = presenter->GetAction(); MxDSAction* action = presenter->GetAction();
MxPresenter::TickleState state = static_cast<MxPresenter::TickleState>(event->user.code); MxPresenter::TickleState state = static_cast<MxPresenter::TickleState>(event->user.code);
#ifdef __EMSCRIPTEN__
if (!g_isle->GetGameStarted()) { if (!g_isle->GetGameStarted()) {
Emscripten_SendPresenterProgress(presenter, state); Emscripten_SendPresenterProgress(presenter, state);
} }
#endif
if (!g_isle->GetGameStarted() && action && state == MxPresenter::e_ready && if (!g_isle->GetGameStarted() && action && state == MxPresenter::e_ready &&
!SDL_strncmp(action->GetObjectName(), "Lego_Smk", 8)) { !SDL_strncmp(action->GetObjectName(), "Lego_Smk", 8)) {
@ -583,6 +582,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
SDL_Log("Game started"); SDL_Log("Game started");
} }
} }
#endif
return SDL_APP_CONTINUE; return SDL_APP_CONTINUE;
} }