From bfef1cf30183860b4a996d58ea88b35214de8709 Mon Sep 17 00:00:00 2001 From: mittorn Date: Wed, 6 Jun 2018 01:32:58 +0700 Subject: [PATCH] Fix vibrator check --- jni/src/Xash3D/xash3d | 2 +- src/in/celest/xash3d/XashActivity.java | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/jni/src/Xash3D/xash3d b/jni/src/Xash3D/xash3d index 44cfcf8a..60be57da 160000 --- a/jni/src/Xash3D/xash3d +++ b/jni/src/Xash3D/xash3d @@ -1 +1 @@ -Subproject commit 44cfcf8a62735c2d5312a1bcc1c4c633dddba1ed +Subproject commit 60be57dafef0d3da03356e261092fdb8e54f7399 diff --git a/src/in/celest/xash3d/XashActivity.java b/src/in/celest/xash3d/XashActivity.java index f2af5d87..854e8df5 100644 --- a/src/in/celest/xash3d/XashActivity.java +++ b/src/in/celest/xash3d/XashActivity.java @@ -417,8 +417,9 @@ public class XashActivity extends Activity { else handler = new JoystickHandler(); handler.init(); - - mHasVibrator = mHasVibrator && ( handler.hasVibrator() ); + + mVibrator = ( Vibrator )getSystemService( Context.VIBRATOR_SERVICE ); + mHasVibrator = handler.hasVibrator() && (mVibrator != null); mPixelFormat = mPref.getInt( "pixelformat", 0 ); mUseVolume = mPref.getBoolean( "usevolume", false ); @@ -432,8 +433,6 @@ public class XashActivity extends Activity { else mImmersiveMode = new ImmersiveMode(); mDecorView = getWindow().getDecorView(); - - mVibrator = ( Vibrator )getSystemService( Context.VIBRATOR_SERVICE ); if( mPref.getBoolean( "resolution_fixed", false ) ) { @@ -2040,7 +2039,9 @@ class JoystickHandler_v12 extends JoystickHandler @Override public boolean hasVibrator() { - return XashActivity.mVibrator.hasVibrator(); + if( XashActivity.mVibrator != null ) + return XashActivity.mVibrator.hasVibrator(); + return false; } @Override