Android: Optimize rumble call

Moved rumble call to IDCache since GetMethodID is expensive
This commit is contained in:
zackhow
2019-01-21 19:11:11 -05:00
parent ff5e296576
commit 4979220cf0
3 changed files with 11 additions and 4 deletions

View File

@ -239,9 +239,7 @@ void Touchscreen::Motor::Rumble(int padID, double state)
{
JNIEnv* env;
IDCache::GetJavaVM()->AttachCurrentThread(&env, nullptr);
jmethodID rumbleMethod =
env->GetStaticMethodID(IDCache::GetNativeLibraryClass(), "rumble", "(ID)V");
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), rumbleMethod, padID, state);
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetDoRumble(), padID, state);
IDCache::GetJavaVM()->DetachCurrentThread();
}
}