diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragment.java new file mode 100644 index 0000000000..346a16741d --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragment.java @@ -0,0 +1,6 @@ +package org.dolphinemu.dolphinemu.ui.input.gamecube; + + +public class ControllerFragment +{ +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentPresenter.java new file mode 100644 index 0000000000..d8916ccf08 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentPresenter.java @@ -0,0 +1,6 @@ +package org.dolphinemu.dolphinemu.ui.input.gamecube; + + +public class ControllerFragmentPresenter +{ +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentView.java new file mode 100644 index 0000000000..77c8b7b3a7 --- /dev/null +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/input/gamecube/ControllerFragmentView.java @@ -0,0 +1,6 @@ +package org.dolphinemu.dolphinemu.ui.input.gamecube; + + +public interface ControllerFragmentView +{ +} diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java index c1052fc42a..42b3231c8c 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/MainPresenter.java @@ -50,6 +50,10 @@ public final class MainPresenter mView.launchSettingsActivity(SettingsFile.FILE_NAME_GFX); return true; + case R.id.menu_settings_gcpad: + mView.launchSettingsActivity(SettingsFile.FILE_NAME_GCPAD); + return true; + case R.id.menu_refresh: mView.refresh(); return true; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java index b1103998b3..bf9087bef1 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/main/TvMainActivity.java @@ -237,6 +237,10 @@ public final class TvMainActivity extends Activity implements MainView R.drawable.ic_settings_graphics_tv, R.string.grid_menu_video_settings)); + rowItems.add(new TvSettingsItem(R.id.menu_settings_gcpad, + R.drawable.ic_settings_gcpad, + R.string.grid_menu_gcpad_settings)); + rowItems.add(new TvSettingsItem(R.id.button_add_directory, R.drawable.ic_add_tv, R.string.add_directory_title)); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivity.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivity.java index 70d3cfbb86..206d6432dd 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivity.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivity.java @@ -150,6 +150,12 @@ public final class SettingsActivity extends AppCompatActivity implements Setting mPresenter.onSettingChanged(); } + @Override + public void onGcPadSettingChanged(String key, int value) + { + mPresenter.onGcPadSettingChanged(key, value); + } + private SettingsFragment getFragment() { return (SettingsFragment) getFragmentManager().findFragmentByTag(SettingsFragment.FRAGMENT_TAG); diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityPresenter.java index 8c16443cec..59d4cbee77 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityPresenter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityPresenter.java @@ -39,6 +39,21 @@ public final class SettingsActivityPresenter if (savedInstanceState == null) { + // TODO DI should be able to get rid of this hack + if (filename.equals(SettingsFile.FILE_NAME_GCPAD)) + { + // Psyche! Don't actually load that file (yet). + mFileName = SettingsFile.FILE_NAME_DOLPHIN; + + // But do display its fragment, as if we had. + mView.showSettingsFragment(SettingsFile.FILE_NAME_GCPAD, false); + } + else + { + mFileName = filename; + mView.showSettingsFragment(mFileName, false); + } + SettingsFile.readFile(mFileName) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -60,8 +75,6 @@ public final class SettingsActivityPresenter mView.onSettingsFileNotFound(); } }); - - mView.showSettingsFragment(mFileName, false); } else { @@ -147,4 +160,18 @@ public final class SettingsActivityPresenter { outState.putBoolean(SHOULD_SAVE, mShouldSave); } + + public void onGcPadSettingChanged(String key, int value) + { + switch (value) + { + case 6: + mView.showToastMessage("Configuration coming soon. Settings from old versions will still work."); + break; + + case 12: + mView.showSettingsFragment(key, true); + break; + } + } } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityView.java index 0a14440087..4307ec891b 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityView.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsActivityView.java @@ -69,4 +69,13 @@ public interface SettingsActivityView * unless this has been called, the Activity will not save to disk. */ void onSettingChanged(); + + /** + * Called by a containing Fragment to tell the containing Activity that a GCPad's setting + * was modified. + * + * @param key Identifier for the GCPad that was modified. + * @param value New setting for the GCPad. + */ + void onGcPadSettingChanged(String key, int value); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsAdapter.java index 72ff6049b1..4028af87a2 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsAdapter.java @@ -189,6 +189,11 @@ public final class SettingsAdapter extends RecyclerView.Adapter mSettings; private ArrayList mSettingsList; + private int mGcPadNumber; + public SettingsFragmentPresenter(SettingsFragmentView view) { mView = view; @@ -33,7 +35,15 @@ public final class SettingsFragmentPresenter public void onCreate(String menuTag) { - mMenuTag = menuTag; + if (menuTag.startsWith(SettingsFile.KEY_GCPAD_TYPE)) + { + mMenuTag = SettingsFile.KEY_GCPAD_TYPE; + mGcPadNumber = Integer.valueOf(menuTag.substring(menuTag.length() - 1)); + } + else + { + mMenuTag = menuTag; + } } public void onViewCreated(HashMap settings) @@ -92,6 +102,10 @@ public final class SettingsFragmentPresenter addGraphicsSettings(sl); break; + case SettingsFile.FILE_NAME_GCPAD: + addGcPadSettings(sl); + break; + case SettingsFile.SECTION_GFX_ENHANCEMENTS: addEnhanceSettings(sl); break; @@ -100,6 +114,10 @@ public final class SettingsFragmentPresenter addHackSettings(sl); break; + case SettingsFile.KEY_GCPAD_TYPE: + addGcAdapterSettings(sl, mGcPadNumber); + break; + default: mView.showToastMessage("Unimplemented menu."); return; @@ -139,6 +157,19 @@ public final class SettingsFragmentPresenter } + private void addGcPadSettings(ArrayList sl) + { + if (mSettings != null) + { + for (int i = 0; i < 4; i++) + { + // TODO This controller_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order. + Setting gcPadSetting = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_GCPAD_TYPE + i); + sl.add(new SingleChoiceSetting(SettingsFile.KEY_GCPAD_TYPE + i, SettingsFile.SECTION_CORE, R.string.controller_0 + i, 0, R.array.gcpadTypeEntries, R.array.gcpadTypeValues, 0, gcPadSetting)); + } + } + } + private void addGraphicsSettings(ArrayList sl) { Setting showFps = null; @@ -229,6 +260,15 @@ public final class SettingsFragmentPresenter sl.add(new SingleChoiceSetting(SettingsFile.KEY_ASPECT_RATIO, SettingsFile.SECTION_GFX_HACKS, R.string.aspect_ratio, R.string.aspect_ratio_descrip, R.array.aspectRatioEntries, R.array.aspectRatioValues, 0, aspectRatio)); } + private void addGcAdapterSettings(ArrayList sl, int gcPadNumber) + { + Setting rumble = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_GCADAPTER_RUMBLE + gcPadNumber); + Setting bongos = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_GCADAPTER_BONGOS + gcPadNumber); + + sl.add(new CheckBoxSetting(SettingsFile.KEY_GCADAPTER_RUMBLE + gcPadNumber, SettingsFile.SECTION_CORE, R.string.gc_adapter_rumble, R.string.gc_adapter_rumble_description, false, rumble)); + sl.add(new CheckBoxSetting(SettingsFile.KEY_GCADAPTER_BONGOS + gcPadNumber, SettingsFile.SECTION_CORE, R.string.gc_adapter_bongos, R.string.gc_adapter_bongos_description, false, bongos)); + } + private int getXfbValue() { int xfbValue; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsFragmentView.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsFragmentView.java index 66ea466b54..8cdf4361e7 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsFragmentView.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/ui/settings/SettingsFragmentView.java @@ -76,4 +76,12 @@ public interface SettingsFragmentView * Have the fragment tell the containing Activity that a setting was modified. */ void onSettingChanged(); + + /** + * Have the fragment tell the containing Activity that a GCPad's setting was modified. + * + * @param key Identifier for the GCPad that was modified. + * @param value New setting for the GCPad. + */ + void onGcPadSettingChanged(String key, int value); } diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java index 2b2286d5c7..26a1232e41 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/Java_GCAdapter.java @@ -20,9 +20,7 @@ import java.util.Map; public class Java_GCAdapter { public static UsbManager manager; - public static Activity our_activity; static byte[] controller_payload = new byte[37]; - static byte HasRead; static UsbDeviceConnection usb_con; static UsbInterface usb_intf; diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java index 865e3371ae..12221cb0fe 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/utils/SettingsFile.java @@ -70,8 +70,13 @@ public final class SettingsFile public static final String KEY_TEXCACHE_ACCURACY = "SafeTextureCacheColorSamples"; public static final String KEY_XFB = "UseXFB"; public static final String KEY_XFB_REAL = "UseRealXFB"; - public static final String KEY_FAST_DEPTH= "FastDepthCalc"; - public static final String KEY_ASPECT_RATIO= "AspectRatio"; + public static final String KEY_FAST_DEPTH = "FastDepthCalc"; + public static final String KEY_ASPECT_RATIO = "AspectRatio"; + + public static final String KEY_GCPAD_TYPE = "SIDevice"; + + public static final String KEY_GCADAPTER_RUMBLE = "AdapterRumble"; + public static final String KEY_GCADAPTER_BONGOS = "SimulateKonga"; // Internal only, not actually found in settings file. public static final String KEY_XFB_METHOD = "XFBMethod"; diff --git a/Source/Android/app/src/main/res/drawable-hdpi/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable-hdpi/ic_settings_gcpad.png new file mode 100644 index 0000000000..08346b24d3 Binary files /dev/null and b/Source/Android/app/src/main/res/drawable-hdpi/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/drawable-mdpi/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable-mdpi/ic_settings_gcpad.png new file mode 100644 index 0000000000..a109fe764f Binary files /dev/null and b/Source/Android/app/src/main/res/drawable-mdpi/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/drawable-xhdpi/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable-xhdpi/ic_settings_gcpad.png new file mode 100644 index 0000000000..50f316a5d4 Binary files /dev/null and b/Source/Android/app/src/main/res/drawable-xhdpi/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/drawable-xxhdpi/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable-xxhdpi/ic_settings_gcpad.png new file mode 100644 index 0000000000..bc2daefaec Binary files /dev/null and b/Source/Android/app/src/main/res/drawable-xxhdpi/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_gcpad.png new file mode 100644 index 0000000000..c3860e1b51 Binary files /dev/null and b/Source/Android/app/src/main/res/drawable-xxxhdpi/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/drawable/ic_settings_gcpad.png b/Source/Android/app/src/main/res/drawable/ic_settings_gcpad.png new file mode 100644 index 0000000000..c3860e1b51 Binary files /dev/null and b/Source/Android/app/src/main/res/drawable/ic_settings_gcpad.png differ diff --git a/Source/Android/app/src/main/res/layout/fragment_input_gc_list.xml b/Source/Android/app/src/main/res/layout/fragment_input_gc_list.xml new file mode 100644 index 0000000000..d656890320 --- /dev/null +++ b/Source/Android/app/src/main/res/layout/fragment_input_gc_list.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Source/Android/app/src/main/res/menu/menu_game_grid.xml b/Source/Android/app/src/main/res/menu/menu_game_grid.xml index a87f89f32d..034da74ee0 100644 --- a/Source/Android/app/src/main/res/menu/menu_game_grid.xml +++ b/Source/Android/app/src/main/res/menu/menu_game_grid.xml @@ -1,11 +1,6 @@ - + + \ No newline at end of file diff --git a/Source/Android/app/src/main/res/values/arrays.xml b/Source/Android/app/src/main/res/values/arrays.xml index bf2afc4527..d327a5004e 100644 --- a/Source/Android/app/src/main/res/values/arrays.xml +++ b/Source/Android/app/src/main/res/values/arrays.xml @@ -147,4 +147,16 @@ Taiwan Unknown + + + Disabled + Emulated + Gamecube Adapter + + + 0 + 6 + 12 + + diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml index db5cc8355a..cf391e8ec8 100644 --- a/Source/Android/app/src/main/res/values/strings.xml +++ b/Source/Android/app/src/main/res/values/strings.xml @@ -78,10 +78,14 @@ Controller Bindings GameCube Controllers Wii Controllers (Wiimotes) + + GameCube Controller 1 GameCube Controller 2 GameCube Controller 3 GameCube Controller 4 + + Enable controller Buttons Directional Keys @@ -317,8 +321,9 @@ - Settings + CPU Settings Video Settings + Gamecube Input Refresh Library @@ -340,7 +345,13 @@ Toggle Touch Controls Quick Save Quick Load - + + + Enable Vibration + Enable the vibration function for this Gamecube controller. + Bongo Controller + Enable this if you are using bongos on this port. + org.dolphinemu.dolphinemu diff --git a/Source/Android/build.gradle b/Source/Android/build.gradle index 469472dc22..ae2e54a2d9 100644 --- a/Source/Android/build.gradle +++ b/Source/Android/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:2.0.0-alpha7' + classpath 'com.android.tools.build:gradle:2.0.0-alpha8' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Source/Android/gradle.properties b/Source/Android/gradle.properties index 0907253421..ffbabe60d3 100644 --- a/Source/Android/gradle.properties +++ b/Source/Android/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit