Merge pull request #8491 from JosJuice/android-gc-adapter-crash
Android: Fix crash on enabling GC adapter
This commit is contained in:
commit
41563aed21
|
@ -2,8 +2,11 @@ package org.dolphinemu.dolphinemu;
|
||||||
|
|
||||||
import android.app.Application;
|
import android.app.Application;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.hardware.usb.UsbManager;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
import org.dolphinemu.dolphinemu.utils.DirectoryInitialization;
|
||||||
|
import org.dolphinemu.dolphinemu.utils.Java_GCAdapter;
|
||||||
|
import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter;
|
||||||
import org.dolphinemu.dolphinemu.utils.PermissionsHandler;
|
import org.dolphinemu.dolphinemu.utils.PermissionsHandler;
|
||||||
import org.dolphinemu.dolphinemu.utils.VolleyUtil;
|
import org.dolphinemu.dolphinemu.utils.VolleyUtil;
|
||||||
|
|
||||||
|
@ -19,6 +22,9 @@ public class DolphinApplication extends Application
|
||||||
VolleyUtil.init(getApplicationContext());
|
VolleyUtil.init(getApplicationContext());
|
||||||
System.loadLibrary("main");
|
System.loadLibrary("main");
|
||||||
|
|
||||||
|
Java_GCAdapter.manager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
||||||
|
Java_WiimoteAdapter.manager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
||||||
|
|
||||||
if (PermissionsHandler.hasWriteAccess(getApplicationContext()))
|
if (PermissionsHandler.hasWriteAccess(getApplicationContext()))
|
||||||
DirectoryInitialization.start(getApplicationContext());
|
DirectoryInitialization.start(getApplicationContext());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
package org.dolphinemu.dolphinemu.activities;
|
package org.dolphinemu.dolphinemu.activities;
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.hardware.usb.UsbManager;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
|
@ -48,8 +46,6 @@ import org.dolphinemu.dolphinemu.ui.main.MainActivity;
|
||||||
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
import org.dolphinemu.dolphinemu.ui.platform.Platform;
|
||||||
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
import org.dolphinemu.dolphinemu.utils.ControllerMappingHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
import org.dolphinemu.dolphinemu.utils.FileBrowserHelper;
|
||||||
import org.dolphinemu.dolphinemu.utils.Java_GCAdapter;
|
|
||||||
import org.dolphinemu.dolphinemu.utils.Java_WiimoteAdapter;
|
|
||||||
import org.dolphinemu.dolphinemu.utils.MotionListener;
|
import org.dolphinemu.dolphinemu.utils.MotionListener;
|
||||||
import org.dolphinemu.dolphinemu.utils.Rumble;
|
import org.dolphinemu.dolphinemu.utils.Rumble;
|
||||||
import org.dolphinemu.dolphinemu.utils.TvUtil;
|
import org.dolphinemu.dolphinemu.utils.TvUtil;
|
||||||
|
@ -304,8 +300,6 @@ public final class EmulationActivity extends AppCompatActivity
|
||||||
|
|
||||||
setTheme(themeId);
|
setTheme(themeId);
|
||||||
|
|
||||||
Java_GCAdapter.manager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
|
||||||
Java_WiimoteAdapter.manager = (UsbManager) getSystemService(Context.USB_SERVICE);
|
|
||||||
Rumble.initRumble(this);
|
Rumble.initRumble(this);
|
||||||
|
|
||||||
setContentView(R.layout.activity_emulation);
|
setContentView(R.layout.activity_emulation);
|
||||||
|
|
Loading…
Reference in New Issue