Handle desync messages

Show them in the chat window and also in a toast during game play.
This commit is contained in:
Tom Pratt
2026-04-29 14:31:25 +02:00
committed by Tom Pratt
parent abd324e98d
commit 117d1d71ac
7 changed files with 45 additions and 1 deletions

View File

@@ -197,7 +197,17 @@ void NetPlayUICallbacks::OnHostInputAuthorityChanged(bool enabled)
env->DeleteLocalRef(netplay_session);
}
void NetPlayUICallbacks::OnDesync(u32, const std::string&) {}
void NetPlayUICallbacks::OnDesync(u32 frame, const std::string& player)
{
JNIEnv* env = IDCache::GetEnvForThread();
jobject netplay_session = GetNetplaySessionLocalRef(env);
if (!netplay_session)
return;
env->CallVoidMethod(netplay_session, IDCache::GetNetplayOnDesync(),
static_cast<jint>(frame), ToJString(env, player));
env->DeleteLocalRef(netplay_session);
}
void NetPlayUICallbacks::OnConnectionLost()
{