diff options
| author | Léo Lam <leo@leolam.fr> | 2020-10-21 22:29:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-21 22:29:21 +0200 |
| commit | 18b2553538acf647b9e965136b035adaeef87b88 (patch) | |
| tree | 40de11fa4728ffe37963e7b80aecf9303e0095a8 /Source/Android/jni/MainAndroid.cpp | |
| parent | 548bfbe2a201f26580ad3d23b4f7cc51c6772c2f (diff) | |
| parent | e86d713600b5e97af9904518b47152c97949c85e (diff) | |
Merge pull request #9078 from JosJuice/android-metadata-from-core
Android: Get game metadata from core
Diffstat (limited to 'Source/Android/jni/MainAndroid.cpp')
| -rw-r--r-- | Source/Android/jni/MainAndroid.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Source/Android/jni/MainAndroid.cpp b/Source/Android/jni/MainAndroid.cpp index 3904647a12..e7b3663837 100644 --- a/Source/Android/jni/MainAndroid.cpp +++ b/Source/Android/jni/MainAndroid.cpp @@ -80,6 +80,7 @@ std::mutex s_host_identity_lock; Common::Event s_update_main_frame_event; Common::Event s_emulation_end_event; bool s_have_wm_user_stop = false; +bool s_game_metadata_is_valid = false; } // Anonymous namespace void UpdatePointer() @@ -149,6 +150,10 @@ void Host_YieldToUI() void Host_TitleChanged() { + s_game_metadata_is_valid = true; + + JNIEnv* env = IDCache::GetEnvForThread(); + env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetOnTitleChanged()); } static bool MsgAlert(const char* caption, const char* text, bool yes_no, Common::MsgType style) @@ -608,6 +613,7 @@ static void Run(JNIEnv* env, const std::vector<std::string>& paths, } } + s_game_metadata_is_valid = false; Core::Shutdown(); ButtonManager::Shutdown(); guard.unlock(); @@ -752,6 +758,36 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetObscuredP OSD::SetObscuredPixelsTop(height); } +JNIEXPORT jboolean JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_IsGameMetadataValid(JNIEnv* env, jobject obj) +{ + return s_game_metadata_is_valid; +} + +JNIEXPORT jboolean JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_IsEmulatingWiiUnchecked(JNIEnv* env, jobject obj) +{ + return SConfig::GetInstance().bWii; +} + +JNIEXPORT jstring JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentGameIDUnchecked(JNIEnv* env, jobject obj) +{ + return ToJString(env, SConfig::GetInstance().GetGameID()); +} + +JNIEXPORT jstring JNICALL +Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCurrentTitleDescriptionUnchecked(JNIEnv* env, + jobject obj) +{ + // Prefer showing just the name. If no name is available, show just the game ID. + std::string description = SConfig::GetInstance().GetTitleName(); + if (description.empty()) + description = SConfig::GetInstance().GetTitleDescription(); + + return ToJString(env, description); +} + #ifdef __cplusplus } #endif |
