Add Wiimote Input menu
This commit is contained in:
parent
32dcb4c37c
commit
85cf07e87e
|
@ -54,6 +54,9 @@ public final class MainPresenter
|
|||
mView.launchSettingsActivity(SettingsFile.FILE_NAME_GCPAD);
|
||||
return true;
|
||||
|
||||
case R.id.menu_settings_wiimote:
|
||||
mView.launchSettingsActivity(SettingsFile.FILE_NAME_WIIMOTE);
|
||||
|
||||
case R.id.menu_refresh:
|
||||
mView.refresh();
|
||||
return true;
|
||||
|
|
|
@ -225,10 +225,6 @@ public final class TvMainActivity extends Activity implements MainView
|
|||
{
|
||||
ArrayObjectAdapter rowItems = new ArrayObjectAdapter(new SettingsRowPresenter());
|
||||
|
||||
rowItems.add(new TvSettingsItem(R.id.menu_refresh,
|
||||
R.drawable.ic_refresh_tv,
|
||||
R.string.grid_menu_refresh));
|
||||
|
||||
rowItems.add(new TvSettingsItem(R.id.menu_settings_core,
|
||||
R.drawable.ic_settings_core_tv,
|
||||
R.string.grid_menu_core_settings));
|
||||
|
@ -241,10 +237,18 @@ public final class TvMainActivity extends Activity implements MainView
|
|||
R.drawable.ic_settings_gcpad,
|
||||
R.string.grid_menu_gcpad_settings));
|
||||
|
||||
rowItems.add(new TvSettingsItem(R.id.menu_settings_wiimote,
|
||||
R.drawable.ic_settings_wiimote,
|
||||
R.string.grid_menu_wiimote_settings));
|
||||
|
||||
rowItems.add(new TvSettingsItem(R.id.button_add_directory,
|
||||
R.drawable.ic_add_tv,
|
||||
R.string.add_directory_title));
|
||||
|
||||
rowItems.add(new TvSettingsItem(R.id.menu_refresh,
|
||||
R.drawable.ic_refresh_tv,
|
||||
R.string.grid_menu_refresh));
|
||||
|
||||
// Create a header for this row.
|
||||
HeaderItem header = new HeaderItem(R.string.settings, getString(R.string.settings));
|
||||
|
||||
|
|
|
@ -156,6 +156,12 @@ public final class SettingsActivity extends AppCompatActivity implements Setting
|
|||
mPresenter.onGcPadSettingChanged(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWiimoteSettingChanged(String section, int value)
|
||||
{
|
||||
mPresenter.onWiimoteSettingChanged(section, value);
|
||||
}
|
||||
|
||||
private SettingsFragment getFragment()
|
||||
{
|
||||
return (SettingsFragment) getFragmentManager().findFragmentByTag(SettingsFragment.FRAGMENT_TAG);
|
||||
|
|
|
@ -174,4 +174,18 @@ public final class SettingsActivityPresenter
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void onWiimoteSettingChanged(String section, int value)
|
||||
{
|
||||
switch (value)
|
||||
{
|
||||
case 1:
|
||||
mView.showToastMessage("Configuration coming soon. Settings from old versions will still work.");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
mView.showToastMessage("Please make sure Continuous Scanning is enabled in Core Settings.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,4 +78,14 @@ public interface SettingsActivityView
|
|||
* @param value New setting for the GCPad.
|
||||
*/
|
||||
void onGcPadSettingChanged(String key, int value);
|
||||
|
||||
/**
|
||||
* Called by a containing Fragment tell the containing Activity that a Wiimote's setting
|
||||
* was modified.
|
||||
*
|
||||
* @param section Identifier for Wiimote that was modified; Wiimotes are identified by their section,
|
||||
* not their key.
|
||||
* @param value New setting for the Wiimote.
|
||||
*/
|
||||
void onWiimoteSettingChanged(String section, int value);
|
||||
}
|
||||
|
|
|
@ -194,6 +194,11 @@ public final class SettingsAdapter extends RecyclerView.Adapter<SettingViewHolde
|
|||
mView.onGcPadSettingChanged(scSetting.getKey(), value);
|
||||
}
|
||||
|
||||
if (scSetting.getKey().equals(SettingsFile.KEY_WIIMOTE_TYPE))
|
||||
{
|
||||
mView.onWiimoteSettingChanged(scSetting.getSetting().getSection(), value);
|
||||
}
|
||||
|
||||
// Get the backing Setting, which may be null (if for example it was missing from the file)
|
||||
IntSetting setting = scSetting.setSelectedValue(value);
|
||||
if (setting != null)
|
||||
|
|
|
@ -157,6 +157,12 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
|||
mActivity.onGcPadSettingChanged(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWiimoteSettingChanged(String section, int value)
|
||||
{
|
||||
mActivity.onWiimoteSettingChanged(section, value);
|
||||
}
|
||||
|
||||
public static final String FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".fragment.settings";
|
||||
|
||||
public static final String ARGUMENT_MENU_TAG = FRAGMENT_TAG + ".menu_tag";
|
||||
|
|
|
@ -106,6 +106,10 @@ public final class SettingsFragmentPresenter
|
|||
addGcPadSettings(sl);
|
||||
break;
|
||||
|
||||
case SettingsFile.FILE_NAME_WIIMOTE:
|
||||
addWiimoteSettings(sl);
|
||||
break;
|
||||
|
||||
case SettingsFile.SECTION_GFX_ENHANCEMENTS:
|
||||
addEnhanceSettings(sl);
|
||||
break;
|
||||
|
@ -133,6 +137,7 @@ public final class SettingsFragmentPresenter
|
|||
Setting dualCore = null;
|
||||
Setting overclockEnable = null;
|
||||
Setting overclock = null;
|
||||
Setting continuousScan = null;
|
||||
|
||||
if (mSettings != null)
|
||||
{
|
||||
|
@ -140,6 +145,7 @@ public final class SettingsFragmentPresenter
|
|||
dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
|
||||
overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
|
||||
overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
|
||||
continuousScan = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_WIIMOTE_SCAN);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -154,7 +160,7 @@ public final class SettingsFragmentPresenter
|
|||
sl.add(new CheckBoxSetting(SettingsFile.KEY_DUAL_CORE, SettingsFile.SECTION_CORE, R.string.dual_core, R.string.dual_core_descrip, true, dualCore));
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_OVERCLOCK_ENABLE, SettingsFile.SECTION_CORE, R.string.overclock_enable, R.string.overclock_enable_description, false, overclockEnable));
|
||||
sl.add(new SliderSetting(SettingsFile.KEY_OVERCLOCK_PERCENT, SettingsFile.SECTION_CORE, R.string.overclock_title, 0, 400, "%", 100, overclock));
|
||||
|
||||
sl.add(new CheckBoxSetting(SettingsFile.KEY_WIIMOTE_SCAN, SettingsFile.SECTION_CORE, R.string.wiimote_scanning, R.string.wiimote_scanning_description, true, continuousScan));
|
||||
}
|
||||
|
||||
private void addGcPadSettings(ArrayList<SettingsItem> sl)
|
||||
|
@ -170,6 +176,19 @@ public final class SettingsFragmentPresenter
|
|||
}
|
||||
}
|
||||
|
||||
private void addWiimoteSettings(ArrayList<SettingsItem> sl)
|
||||
{
|
||||
if (mSettings != null)
|
||||
{
|
||||
for (int i = 1; i <= 4; i++)
|
||||
{
|
||||
// TODO This wiimote_0 + i business is quite the hack. It should work, but only if the definitions are kept together and in order.
|
||||
Setting wiimoteSetting = mSettings.get(SettingsFile.SECTION_WIIMOTE + i).getSetting(SettingsFile.KEY_WIIMOTE_TYPE);
|
||||
sl.add(new SingleChoiceSetting(SettingsFile.KEY_WIIMOTE_TYPE, SettingsFile.SECTION_WIIMOTE + i, R.string.wiimote_0 + i - 1, 0, R.array.wiimoteTypeEntries, R.array.wiimoteTypeValues, 0, wiimoteSetting));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addGraphicsSettings(ArrayList<SettingsItem> sl)
|
||||
{
|
||||
Setting showFps = null;
|
||||
|
|
|
@ -84,4 +84,13 @@ public interface SettingsFragmentView
|
|||
* @param value New setting for the GCPad.
|
||||
*/
|
||||
void onGcPadSettingChanged(String key, int value);
|
||||
|
||||
/**
|
||||
* Have the fragment tell the containing Activity that a Wiimote's setting was modified.
|
||||
*
|
||||
* @param section Identifier for Wiimote that was modified; Wiimotes are identified by their section,
|
||||
* not their key.
|
||||
* @param value New setting for the Wiimote.
|
||||
*/
|
||||
void onWiimoteSettingChanged(String section, int value);
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ public final class SettingsFile
|
|||
|
||||
public static final String SECTION_STEREOSCOPY = "Stereoscopy";
|
||||
|
||||
public static final String SECTION_WIIMOTE = "Wiimote";
|
||||
|
||||
public static final String KEY_CPU_CORE = "CPUCore";
|
||||
public static final String KEY_DUAL_CORE = "CPUThread";
|
||||
public static final String KEY_OVERCLOCK_ENABLE = "OverclockEnable";
|
||||
|
@ -78,6 +80,10 @@ public final class SettingsFile
|
|||
public static final String KEY_GCADAPTER_RUMBLE = "AdapterRumble";
|
||||
public static final String KEY_GCADAPTER_BONGOS = "SimulateKonga";
|
||||
|
||||
public static final String KEY_WIIMOTE_TYPE = "Source";
|
||||
|
||||
public static final String KEY_WIIMOTE_SCAN = "WiimoteContinuousScanning";
|
||||
|
||||
// Internal only, not actually found in settings file.
|
||||
public static final String KEY_XFB_METHOD = "XFBMethod";
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@
|
|||
android:title="@string/grid_menu_gcpad_settings"
|
||||
android:icon="@drawable/ic_settings_gcpad"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/menu_settings_wiimote"
|
||||
android:title="@string/grid_menu_wiimote_settings"
|
||||
android:icon="@drawable/ic_settings_wiimote"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/menu_refresh"
|
||||
android:title="@string/grid_menu_refresh"
|
||||
|
|
|
@ -159,4 +159,15 @@
|
|||
<item>12</item>
|
||||
</integer-array>
|
||||
|
||||
<string-array name="wiimoteTypeEntries">
|
||||
<item>Disabled</item>
|
||||
<item>Emulated</item>
|
||||
<item>"Real Wiimote (DolphinBar required)"</item>
|
||||
</string-array>
|
||||
<integer-array name="wiimoteTypeValues">
|
||||
<item>0</item>
|
||||
<item>1</item>
|
||||
<item>2</item>
|
||||
</integer-array>
|
||||
|
||||
</resources>
|
||||
|
|
|
@ -95,10 +95,14 @@
|
|||
<string name="modifier_range">Modifier Range</string>
|
||||
<string name="analog_radius">Analog Radius (High value = High sensitivity)</string>
|
||||
<string name="analog_threshold">Analog Threshold (Low value = High sensitivity)</string>
|
||||
|
||||
<!-- WARNING Do not move these controller entries AT ALL COSTS! -->
|
||||
<string name="wiimote_0">Wiimote 1</string>
|
||||
<string name="wiimote_1">Wiimote 2</string>
|
||||
<string name="wiimote_2">Wiimote 3</string>
|
||||
<string name="wiimote_3">Wiimote 4</string>
|
||||
<!-- END WARNING -->
|
||||
|
||||
<string name="enable_wiimote">Enable Wiimote</string>
|
||||
<string name="wiimote_ir">IR Motion Controls</string>
|
||||
<string name="wiimote_swing">Swing Navigation</string>
|
||||
|
@ -245,6 +249,9 @@
|
|||
<string name="overclock_enable_description">Higher values can make variable-framerate games run at a higher framerate, requiring a powerful device. Lower values make games run at a lower framerate, increasing emulation speed, but reducing the emulated console\'s performance.</string>
|
||||
<string name="overclock_title">Emulated CPU Clock Speed</string>
|
||||
<string name="overclock_warning">WARNING: Changing this from the default (100%) WILL break games and cause glitches. Please do not report bugs that occur with a non-default clock.</string>
|
||||
<string name="wiimote_scanning">Wiimote Continuous Scanning</string>
|
||||
<string name="wiimote_scanning_description">Leave this on if you are using a DolphinBar for real Wiimote support.</string>
|
||||
|
||||
|
||||
<!-- Video Preference Fragment -->
|
||||
<string name="video_settings">Video</string>
|
||||
|
@ -324,6 +331,7 @@
|
|||
<string name="grid_menu_core_settings">CPU Settings</string>
|
||||
<string name="grid_menu_video_settings">Video Settings</string>
|
||||
<string name="grid_menu_gcpad_settings">GameCube Input</string>
|
||||
<string name="grid_menu_wiimote_settings">Wii Input</string>
|
||||
<string name="grid_menu_refresh">Refresh Library</string>
|
||||
|
||||
<!-- Add Directory Screen-->
|
||||
|
|
Loading…
Reference in New Issue