Implement StopGame callback and use it to finish the emulation activity

This commit is contained in:
Tom Pratt
2026-04-22 18:46:12 +02:00
committed by Tom Pratt
parent 86956b21be
commit 38b5c7370c
6 changed files with 53 additions and 2 deletions

View File

@@ -32,6 +32,7 @@ static jclass s_netplay_class;
static jfieldID s_net_play_client_pointer;
static jfieldID s_netplay_boot_session_data_pointer;
static jmethodID s_netplay_on_boot_game;
static jmethodID s_netplay_on_stop_game;
static jmethodID s_netplay_on_connection_error;
static jmethodID s_netplay_on_game_changed;
static jmethodID s_netplay_on_host_input_authority_changed;
@@ -267,6 +268,11 @@ jmethodID GetNetplayOnBootGame()
return s_netplay_on_boot_game;
}
jmethodID GetNetplayOnStopGame()
{
return s_netplay_on_stop_game;
}
jmethodID GetNetplayOnConnectionError()
{
return s_netplay_on_connection_error;
@@ -717,6 +723,7 @@ JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved)
s_net_play_client_pointer = env->GetStaticFieldID(netplay_class, "netPlayClientPointer", "J");
s_netplay_boot_session_data_pointer = env->GetStaticFieldID(netplay_class, "bootSessionDataPointer", "J");
s_netplay_on_boot_game = env->GetStaticMethodID(netplay_class, "onBootGame", "(Ljava/lang/String;J)V");
s_netplay_on_stop_game = env->GetStaticMethodID(netplay_class, "onStopGame", "()V");
s_netplay_on_connection_error = env->GetStaticMethodID(netplay_class, "onConnectionError", "(Ljava/lang/String;)V");
s_netplay_on_game_changed =
env->GetStaticMethodID(netplay_class, "onGameChanged", "(Ljava/lang/String;)V");