diff options
| author | Tom Pratt <tom.pratt@outlook.com> | 2026-05-19 10:26:16 +0200 |
|---|---|---|
| committer | Tom Pratt <tompratt@squareup.com> | 2026-05-19 12:03:02 +0200 |
| commit | 06cc09cf09d27de28715a68e58fe8731bc311603 (patch) | |
| tree | c5d35889016057ec34a3b67eff36ca1e68a5b19c /Source/Android/jni/NetPlay/Netplay.cpp | |
| parent | f63b81dd3963b3e25be707c4e1df7fdb24f220ed (diff) | |
Pass immutable games list to NetplayUICallbacks
Remove corresponding jni config.
Rename Netplay to NetplaySession in jni config to match new kotlin name.
Diffstat (limited to 'Source/Android/jni/NetPlay/Netplay.cpp')
| -rw-r--r-- | Source/Android/jni/NetPlay/Netplay.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Source/Android/jni/NetPlay/Netplay.cpp b/Source/Android/jni/NetPlay/Netplay.cpp index e98dc28742..20ebffe42c 100644 --- a/Source/Android/jni/NetPlay/Netplay.cpp +++ b/Source/Android/jni/NetPlay/Netplay.cpp @@ -15,7 +15,6 @@ #include "Core/NetPlayClient.h" #include "Core/NetPlayServer.h" #include "UICommon/GameFile.h" -#include "UICommon/GameFileCache.h" #include "jni/AndroidCommon/AndroidCommon.h" #include "jni/AndroidCommon/IDCache.h" @@ -75,17 +74,21 @@ Java_org_dolphinemu_dolphinemu_features_netplay_NetplaySession_nativeAdjustServe } JNIEXPORT jlong JNICALL -Java_org_dolphinemu_dolphinemu_features_netplay_NetplaySession_nativeCreateUICallbacks(JNIEnv* env, - jobject obj) +Java_org_dolphinemu_dolphinemu_features_netplay_NetplaySession_nativeCreateUICallbacks( + JNIEnv* env, jobject obj, jobjectArray jgame_files) { - jobject jgame_file_cache = env->GetStaticObjectField( - IDCache::GetGameFileCacheManagerClass(), IDCache::GetGameFileCacheManagerInstance()); - auto* game_file_cache = reinterpret_cast<UICommon::GameFileCache*>( - env->GetLongField(jgame_file_cache, IDCache::GetGameFileCachePointer())); - std::vector<std::shared_ptr<const UICommon::GameFile>> games; - game_file_cache->ForEach( - [&games](const std::shared_ptr<const UICommon::GameFile>& game) { games.push_back(game); }); + const jsize count = env->GetArrayLength(jgame_files); + games.reserve(count); + for (jsize i = 0; i < count; i++) + { + jobject jgame_file = env->GetObjectArrayElement(jgame_files, i); + auto* game_ptr = reinterpret_cast<std::shared_ptr<const UICommon::GameFile>*>( + env->GetLongField(jgame_file, IDCache::GetGameFilePointer())); + if (game_ptr) + games.push_back(*game_ptr); + env->DeleteLocalRef(jgame_file); + } return reinterpret_cast<jlong>(new NetPlay::NetPlayUICallbacks(obj, std::move(games))); } |
