Show client connection errors and handle connection result

If result is a success sent event to launch the next netplay screen. if it fails, clear up the netplay client
This commit is contained in:
Tom Pratt
2026-04-09 12:40:07 +01:00
committed by Tom Pratt
parent 3ed9174208
commit f52ca02ca2
9 changed files with 184 additions and 21 deletions

View File

@@ -17,6 +17,12 @@
#include "jni/AndroidCommon/IDCache.h"
#include "jni/NetPlay/NetPlayUICallbacks.h"
static NetPlay::NetPlayClient* GetPointer(JNIEnv* env)
{
return reinterpret_cast<NetPlay::NetPlayClient*>(
env->GetStaticLongField(IDCache::GetNetplayClass(), IDCache::GetNetPlayClientPointer()));
}
extern "C" {
JNIEXPORT jstring JNICALL
@@ -124,6 +130,12 @@ Java_org_dolphinemu_dolphinemu_features_netplay_Netplay_SaveSetup(
Config::SetBaseOrCurrent(Config::NETPLAY_LISTEN_PORT, static_cast<u16>(listenPort));
}
JNIEXPORT jboolean JNICALL
Java_org_dolphinemu_dolphinemu_features_netplay_Netplay_isClientConnected(JNIEnv* env, jclass)
{
return static_cast<jboolean>(GetPointer(env)->IsConnected());
}
JNIEXPORT jlong JNICALL
Java_org_dolphinemu_dolphinemu_features_netplay_Netplay_Join(JNIEnv* env, jclass)
{
@@ -155,4 +167,10 @@ Java_org_dolphinemu_dolphinemu_features_netplay_Netplay_Join(JNIEnv* env, jclass
return reinterpret_cast<jlong>(client);
}
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_features_netplay_Netplay_ReleaseNetplayClient(JNIEnv* env, jclass)
{
delete GetPointer(env);
}
} // extern "C"