mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Android: Normalize pointer touches based on rendered aspect ratio
This allows the defaults to be actual defaults across devices with different screen sizes
This commit is contained in:
@ -12,6 +12,7 @@ static JavaVM* s_java_vm;
|
||||
|
||||
static jclass s_native_library_class;
|
||||
static jmethodID s_display_alert_msg;
|
||||
static jmethodID s_get_update_touch_pointer;
|
||||
|
||||
static jclass s_game_file_class;
|
||||
static jfieldID s_game_file_pointer;
|
||||
@ -41,6 +42,11 @@ jmethodID GetDisplayAlertMsg()
|
||||
return s_display_alert_msg;
|
||||
}
|
||||
|
||||
jmethodID GetUpdateTouchPointer()
|
||||
{
|
||||
return s_get_update_touch_pointer;
|
||||
}
|
||||
|
||||
jclass GetAnalyticsClass()
|
||||
{
|
||||
return s_analytics_class;
|
||||
@ -98,6 +104,8 @@ 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_get_update_touch_pointer =
|
||||
env->GetStaticMethodID(IDCache::GetNativeLibraryClass(), "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));
|
||||
|
@ -14,6 +14,7 @@ JavaVM* GetJavaVM();
|
||||
|
||||
jclass GetNativeLibraryClass();
|
||||
jmethodID GetDisplayAlertMsg();
|
||||
jmethodID GetUpdateTouchPointer();
|
||||
|
||||
jclass GetAnalyticsClass();
|
||||
jmethodID GetSendAnalyticsReport();
|
||||
|
@ -107,6 +107,11 @@ void Host_UpdateMainFrame()
|
||||
|
||||
void Host_RequestRenderWindowSize(int width, int height)
|
||||
{
|
||||
// Update touch pointer
|
||||
JNIEnv* env;
|
||||
IDCache::GetJavaVM()->AttachCurrentThread(&env, nullptr);
|
||||
env->CallStaticVoidMethod(IDCache::GetNativeLibraryClass(), IDCache::GetUpdateTouchPointer());
|
||||
IDCache::GetJavaVM()->DetachCurrentThread();
|
||||
}
|
||||
|
||||
bool Host_UINeedsControllerState()
|
||||
@ -564,6 +569,13 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestr
|
||||
s_surf = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jfloat JNICALL
|
||||
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameAspectRatio(JNIEnv* env, jobject obj)
|
||||
{
|
||||
return g_renderer->CalculateDrawAspectRatio();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimotes(JNIEnv* env,
|
||||
jobject obj)
|
||||
{
|
||||
|
Reference in New Issue
Block a user