From 0e321e77a244f8a566f4289d7c7f0a351a42df85 Mon Sep 17 00:00:00 2001 From: Endolf Date: Mon, 21 May 2018 21:51:53 +0100 Subject: [PATCH] Handle wintab not being available --- .../main/native/net_java_games_input_WinTabContext.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c b/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c index c00d848..d455197 100644 --- a/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c +++ b/plugins/wintab/src/main/native/net_java_games_input_WinTabContext.c @@ -23,7 +23,17 @@ JNIEXPORT jlong JNICALL Java_net_java_games_input_WinTabContext_nOpen(JNIEnv *en jmethodID getBooleanMethod = (*env)->GetStaticMethodID(env, booleanClass, "getBoolean", "(Ljava/lang/String;)Z"); jboolean detachCursor = (*env)->CallStaticBooleanMethod(env, booleanClass, getBooleanMethod, propertyName); - LoadWintab(); + if(!LoadWintab()) { + throwIOException(env, "Failed to load wintab (%d)\n", GetLastError()); + } else { + printfJava(env, "Wintab dll loaded\n"); + } + + if (!gpWTInfoA(0, 0, NULL)) { + throwIOException(env, "Wintab is not available (%d)\n", GetLastError()); + } else { + printfJava(env, "Wintab is available\n"); + } gpWTInfoA(WTI_DEFCONTEXT, 0, &context);