Android: Optimize rumble call

Moved rumble call to IDCache since GetMethodID is expensive
This commit is contained in:
zackhow committed 2019-01-26 09:38:35 -05:00
1 parent ff5e296576
commit 4979220cf0
3 files changed
+11 -4

No files matched your search

+9 -1
View File
@@ -25,6 +25,8 @@ static jclass s_analytics_class;
static jmethodID s_send_analytics_report;
static jmethodID s_get_analytics_value;
static jmethodID s_do_rumble;
namespace IDCache
{
JavaVM* GetJavaVM()
@@ -86,6 +88,11 @@ jfieldID GetGameFileCachePointer()
return s_game_file_cache_pointer;
}
jmethodID GetDoRumble()
{
return s_do_rumble;
}
} // namespace IDCache
#ifdef __cplusplus
@@ -104,8 +111,9 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
s_native_library_class = reinterpret_cast<jclass>(env->NewGlobalRef(native_library_class));
s_display_alert_msg = env->GetStaticMethodID(s_native_library_class, "displayAlertMsg",
"(Ljava/lang/String;Ljava/lang/String;Z)Z");
s_do_rumble = env->GetStaticMethodID(s_native_library_class, "rumble", "(ID)V");
s_get_update_touch_pointer =
env->GetStaticMethodID(IDCache::GetNativeLibraryClass(), "updateTouchPointer", "()V");
env->GetStaticMethodID(s_native_library_class, "updateTouchPointer", "()V");
const jclass game_file_class = env->FindClass("org/dolphinemu/dolphinemu/model/GameFile");
s_game_file_class = reinterpret_cast<jclass>(env->NewGlobalRef(game_file_class));