mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-08-12 04:09:36 -05:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user