mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-11 06:59:07 +01:00
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);
|
mView.launchSettingsActivity(SettingsFile.FILE_NAME_GCPAD);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.menu_settings_wiimote:
|
||||||
|
mView.launchSettingsActivity(SettingsFile.FILE_NAME_WIIMOTE);
|
||||||
|
|
||||||
case R.id.menu_refresh:
|
case R.id.menu_refresh:
|
||||||
mView.refresh();
|
mView.refresh();
|
||||||
return true;
|
return true;
|
||||||
|
@ -225,10 +225,6 @@ public final class TvMainActivity extends Activity implements MainView
|
|||||||
{
|
{
|
||||||
ArrayObjectAdapter rowItems = new ArrayObjectAdapter(new SettingsRowPresenter());
|
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,
|
rowItems.add(new TvSettingsItem(R.id.menu_settings_core,
|
||||||
R.drawable.ic_settings_core_tv,
|
R.drawable.ic_settings_core_tv,
|
||||||
R.string.grid_menu_core_settings));
|
R.string.grid_menu_core_settings));
|
||||||
@ -241,10 +237,18 @@ public final class TvMainActivity extends Activity implements MainView
|
|||||||
R.drawable.ic_settings_gcpad,
|
R.drawable.ic_settings_gcpad,
|
||||||
R.string.grid_menu_gcpad_settings));
|
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,
|
rowItems.add(new TvSettingsItem(R.id.button_add_directory,
|
||||||
R.drawable.ic_add_tv,
|
R.drawable.ic_add_tv,
|
||||||
R.string.add_directory_title));
|
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.
|
// Create a header for this row.
|
||||||
HeaderItem header = new HeaderItem(R.string.settings, getString(R.string.settings));
|
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);
|
mPresenter.onGcPadSettingChanged(key, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWiimoteSettingChanged(String section, int value)
|
||||||
|
{
|
||||||
|
mPresenter.onWiimoteSettingChanged(section, value);
|
||||||
|
}
|
||||||
|
|
||||||
private SettingsFragment getFragment()
|
private SettingsFragment getFragment()
|
||||||
{
|
{
|
||||||
return (SettingsFragment) getFragmentManager().findFragmentByTag(SettingsFragment.FRAGMENT_TAG);
|
return (SettingsFragment) getFragmentManager().findFragmentByTag(SettingsFragment.FRAGMENT_TAG);
|
||||||
|
@ -174,4 +174,18 @@ public final class SettingsActivityPresenter
|
|||||||
break;
|
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.
|
* @param value New setting for the GCPad.
|
||||||
*/
|
*/
|
||||||
void onGcPadSettingChanged(String key, int value);
|
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);
|
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)
|
// Get the backing Setting, which may be null (if for example it was missing from the file)
|
||||||
IntSetting setting = scSetting.setSelectedValue(value);
|
IntSetting setting = scSetting.setSelectedValue(value);
|
||||||
if (setting != null)
|
if (setting != null)
|
||||||
|
@ -157,6 +157,12 @@ public final class SettingsFragment extends Fragment implements SettingsFragment
|
|||||||
mActivity.onGcPadSettingChanged(key, value);
|
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 FRAGMENT_TAG = BuildConfig.APPLICATION_ID + ".fragment.settings";
|
||||||
|
|
||||||
public static final String ARGUMENT_MENU_TAG = FRAGMENT_TAG + ".menu_tag";
|
public static final String ARGUMENT_MENU_TAG = FRAGMENT_TAG + ".menu_tag";
|
||||||
|
@ -106,6 +106,10 @@ public final class SettingsFragmentPresenter
|
|||||||
addGcPadSettings(sl);
|
addGcPadSettings(sl);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SettingsFile.FILE_NAME_WIIMOTE:
|
||||||
|
addWiimoteSettings(sl);
|
||||||
|
break;
|
||||||
|
|
||||||
case SettingsFile.SECTION_GFX_ENHANCEMENTS:
|
case SettingsFile.SECTION_GFX_ENHANCEMENTS:
|
||||||
addEnhanceSettings(sl);
|
addEnhanceSettings(sl);
|
||||||
break;
|
break;
|
||||||
@ -133,6 +137,7 @@ public final class SettingsFragmentPresenter
|
|||||||
Setting dualCore = null;
|
Setting dualCore = null;
|
||||||
Setting overclockEnable = null;
|
Setting overclockEnable = null;
|
||||||
Setting overclock = null;
|
Setting overclock = null;
|
||||||
|
Setting continuousScan = null;
|
||||||
|
|
||||||
if (mSettings != null)
|
if (mSettings != null)
|
||||||
{
|
{
|
||||||
@ -140,6 +145,7 @@ public final class SettingsFragmentPresenter
|
|||||||
dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
|
dualCore = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_DUAL_CORE);
|
||||||
overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
|
overclockEnable = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_ENABLE);
|
||||||
overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
|
overclock = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_OVERCLOCK_PERCENT);
|
||||||
|
continuousScan = mSettings.get(SettingsFile.SECTION_CORE).getSetting(SettingsFile.KEY_WIIMOTE_SCAN);
|
||||||
}
|
}
|
||||||
else
|
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_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 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 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)
|
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)
|
private void addGraphicsSettings(ArrayList<SettingsItem> sl)
|
||||||
{
|
{
|
||||||
Setting showFps = null;
|
Setting showFps = null;
|
||||||
|
@ -84,4 +84,13 @@ public interface SettingsFragmentView
|
|||||||
* @param value New setting for the GCPad.
|
* @param value New setting for the GCPad.
|
||||||
*/
|
*/
|
||||||
void onGcPadSettingChanged(String key, int value);
|
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_STEREOSCOPY = "Stereoscopy";
|
||||||
|
|
||||||
|
public static final String SECTION_WIIMOTE = "Wiimote";
|
||||||
|
|
||||||
public static final String KEY_CPU_CORE = "CPUCore";
|
public static final String KEY_CPU_CORE = "CPUCore";
|
||||||
public static final String KEY_DUAL_CORE = "CPUThread";
|
public static final String KEY_DUAL_CORE = "CPUThread";
|
||||||
public static final String KEY_OVERCLOCK_ENABLE = "OverclockEnable";
|
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_RUMBLE = "AdapterRumble";
|
||||||
public static final String KEY_GCADAPTER_BONGOS = "SimulateKonga";
|
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.
|
// Internal only, not actually found in settings file.
|
||||||
public static final String KEY_XFB_METHOD = "XFBMethod";
|
public static final String KEY_XFB_METHOD = "XFBMethod";
|
||||||
|
|
||||||
|
@ -16,6 +16,11 @@
|
|||||||
android:title="@string/grid_menu_gcpad_settings"
|
android:title="@string/grid_menu_gcpad_settings"
|
||||||
android:icon="@drawable/ic_settings_gcpad"
|
android:icon="@drawable/ic_settings_gcpad"
|
||||||
app:showAsAction="ifRoom"/>
|
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
|
<item
|
||||||
android:id="@+id/menu_refresh"
|
android:id="@+id/menu_refresh"
|
||||||
android:title="@string/grid_menu_refresh"
|
android:title="@string/grid_menu_refresh"
|
||||||
|
@ -159,4 +159,15 @@
|
|||||||
<item>12</item>
|
<item>12</item>
|
||||||
</integer-array>
|
</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>
|
</resources>
|
||||||
|
@ -95,10 +95,14 @@
|
|||||||
<string name="modifier_range">Modifier Range</string>
|
<string name="modifier_range">Modifier Range</string>
|
||||||
<string name="analog_radius">Analog Radius (High value = High sensitivity)</string>
|
<string name="analog_radius">Analog Radius (High value = High sensitivity)</string>
|
||||||
<string name="analog_threshold">Analog Threshold (Low 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_0">Wiimote 1</string>
|
||||||
<string name="wiimote_1">Wiimote 2</string>
|
<string name="wiimote_1">Wiimote 2</string>
|
||||||
<string name="wiimote_2">Wiimote 3</string>
|
<string name="wiimote_2">Wiimote 3</string>
|
||||||
<string name="wiimote_3">Wiimote 4</string>
|
<string name="wiimote_3">Wiimote 4</string>
|
||||||
|
<!-- END WARNING -->
|
||||||
|
|
||||||
<string name="enable_wiimote">Enable Wiimote</string>
|
<string name="enable_wiimote">Enable Wiimote</string>
|
||||||
<string name="wiimote_ir">IR Motion Controls</string>
|
<string name="wiimote_ir">IR Motion Controls</string>
|
||||||
<string name="wiimote_swing">Swing Navigation</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_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_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="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 -->
|
<!-- Video Preference Fragment -->
|
||||||
<string name="video_settings">Video</string>
|
<string name="video_settings">Video</string>
|
||||||
@ -324,6 +331,7 @@
|
|||||||
<string name="grid_menu_core_settings">CPU Settings</string>
|
<string name="grid_menu_core_settings">CPU Settings</string>
|
||||||
<string name="grid_menu_video_settings">Video Settings</string>
|
<string name="grid_menu_video_settings">Video Settings</string>
|
||||||
<string name="grid_menu_gcpad_settings">GameCube Input</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>
|
<string name="grid_menu_refresh">Refresh Library</string>
|
||||||
|
|
||||||
<!-- Add Directory Screen-->
|
<!-- Add Directory Screen-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user