summaryrefslogtreecommitdiff
path: root/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
diff options
context:
space:
mode:
authorTom Pratt <tom.pratt@outlook.com>2026-04-30 10:16:20 +0200
committerTom Pratt <tompratt@squareup.com>2026-05-19 12:02:58 +0200
commitacbf9e155f8e0397e6bfa2f3d00bad0e5f5ecbcf (patch)
treec581744bba8bd33e37c9173f4cdd92be41b24823 /Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
parent117d1d71acc6b85b6c67396bd2222fbee7f0ff05 (diff)
Game digest progress dialog
We just about get away with using a StateFlow in NetplaySession since the host sends AbortGameDigest when closing their own dialog. Without that it would be harder for the UI to distinguish between subsequent dialogs. If that wasn't the case then NetplaySession might need to expose the individual progress and result updates and have the view model assemble it into the overall GameDigestProgress.
Diffstat (limited to 'Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp')
-rw-r--r--Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp51
1 files changed, 47 insertions, 4 deletions
diff --git a/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp b/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
index c411119ab9..018d5556dd 100644
--- a/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
+++ b/Source/Android/jni/NetPlay/NetPlayUICallbacks.cpp
@@ -265,10 +265,53 @@ NetPlayUICallbacks::FindGameFile(const NetPlay::SyncIdentifier& sync_identifier,
}
std::string NetPlayUICallbacks::FindGBARomPath(const std::array<u8, 20>&, std::string_view, int) { return {}; }
-void NetPlayUICallbacks::ShowGameDigestDialog(const std::string&) {}
-void NetPlayUICallbacks::SetGameDigestProgress(int, int) {}
-void NetPlayUICallbacks::SetGameDigestResult(int, const std::string&) {}
-void NetPlayUICallbacks::AbortGameDigest() {}
+
+void NetPlayUICallbacks::ShowGameDigestDialog(const std::string& title)
+{
+ JNIEnv* env = IDCache::GetEnvForThread();
+ jobject netplay_session = GetNetplaySessionLocalRef(env);
+ if (!netplay_session)
+ return;
+
+ env->CallVoidMethod(netplay_session, IDCache::GetNetplayOnShowGameDigestDialog(),
+ ToJString(env, title));
+ env->DeleteLocalRef(netplay_session);
+}
+
+void NetPlayUICallbacks::SetGameDigestProgress(int pid, int progress)
+{
+ JNIEnv* env = IDCache::GetEnvForThread();
+ jobject netplay_session = GetNetplaySessionLocalRef(env);
+ if (!netplay_session)
+ return;
+
+ env->CallVoidMethod(netplay_session, IDCache::GetNetplayOnSetGameDigestProgress(),
+ static_cast<jint>(pid), static_cast<jint>(progress));
+ env->DeleteLocalRef(netplay_session);
+}
+
+void NetPlayUICallbacks::SetGameDigestResult(int pid, const std::string& result)
+{
+ JNIEnv* env = IDCache::GetEnvForThread();
+ jobject netplay_session = GetNetplaySessionLocalRef(env);
+ if (!netplay_session)
+ return;
+
+ env->CallVoidMethod(netplay_session, IDCache::GetNetplayOnSetGameDigestResult(),
+ static_cast<jint>(pid), ToJString(env, result));
+ env->DeleteLocalRef(netplay_session);
+}
+
+void NetPlayUICallbacks::AbortGameDigest()
+{
+ JNIEnv* env = IDCache::GetEnvForThread();
+ jobject netplay_session = GetNetplaySessionLocalRef(env);
+ if (!netplay_session)
+ return;
+
+ env->CallVoidMethod(netplay_session, IDCache::GetNetplayOnAbortGameDigest());
+ env->DeleteLocalRef(netplay_session);
+}
void NetPlayUICallbacks::ShowChunkedProgressDialog(const std::string& title, u64 data_size,
std::span<const int> players)