mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
InputCommon: Clean up how numeric settings are handled. Add units of measure to UI. Eliminate hidden magic values of the IR cursor.
This commit is contained in:
@@ -18,9 +18,9 @@ IR/Right = `Axis 115`
|
|||||||
IR/Forward = `Axis 116`
|
IR/Forward = `Axis 116`
|
||||||
IR/Backward = `Axis 117`
|
IR/Backward = `Axis 117`
|
||||||
IR/Hide = `Button 118`
|
IR/Hide = `Button 118`
|
||||||
IR/Height = 50
|
IR/Total Pitch = 15
|
||||||
IR/Width = 50
|
IR/Total Yaw = 15
|
||||||
IR/Center = 50
|
IR/Vertical Offset = 10
|
||||||
Swing/Up = `Axis 120`
|
Swing/Up = `Axis 120`
|
||||||
Swing/Down = `Axis 121`
|
Swing/Down = `Axis 121`
|
||||||
Swing/Left = `Axis 122`
|
Swing/Left = `Axis 122`
|
||||||
@@ -157,9 +157,9 @@ IR/Right = `Axis 115`
|
|||||||
IR/Forward = `Axis 116`
|
IR/Forward = `Axis 116`
|
||||||
IR/Backward = `Axis 117`
|
IR/Backward = `Axis 117`
|
||||||
IR/Hide = `Button 118`
|
IR/Hide = `Button 118`
|
||||||
IR/Height = 50
|
IR/Total Pitch = 15
|
||||||
IR/Width = 50
|
IR/Total Yaw = 15
|
||||||
IR/Center = 50
|
IR/Vertical Offset = 10
|
||||||
Swing/Up = `Axis 120`
|
Swing/Up = `Axis 120`
|
||||||
Swing/Down = `Axis 121`
|
Swing/Down = `Axis 121`
|
||||||
Swing/Left = `Axis 122`
|
Swing/Left = `Axis 122`
|
||||||
@@ -296,9 +296,9 @@ IR/Right = `Axis 115`
|
|||||||
IR/Forward = `Axis 116`
|
IR/Forward = `Axis 116`
|
||||||
IR/Backward = `Axis 117`
|
IR/Backward = `Axis 117`
|
||||||
IR/Hide = `Button 118`
|
IR/Hide = `Button 118`
|
||||||
IR/Height = 50
|
IR/Total Pitch = 15
|
||||||
IR/Width = 50
|
IR/Total Yaw = 15
|
||||||
IR/Center = 50
|
IR/Vertical Offset = 10
|
||||||
Swing/Up = `Axis 120`
|
Swing/Up = `Axis 120`
|
||||||
Swing/Down = `Axis 121`
|
Swing/Down = `Axis 121`
|
||||||
Swing/Left = `Axis 122`
|
Swing/Left = `Axis 122`
|
||||||
@@ -435,9 +435,9 @@ IR/Right = `Axis 115`
|
|||||||
IR/Forward = `Axis 116`
|
IR/Forward = `Axis 116`
|
||||||
IR/Backward = `Axis 117`
|
IR/Backward = `Axis 117`
|
||||||
IR/Hide = `Button 118`
|
IR/Hide = `Button 118`
|
||||||
IR/Height = 50
|
IR/Total Pitch = 15
|
||||||
IR/Width = 50
|
IR/Total Yaw = 15
|
||||||
IR/Center = 50
|
IR/Vertical Offset = 10
|
||||||
Swing/Up = `Axis 120`
|
Swing/Up = `Axis 120`
|
||||||
Swing/Down = `Axis 121`
|
Swing/Down = `Axis 121`
|
||||||
Swing/Left = `Axis 122`
|
Swing/Left = `Axis 122`
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ IR/Right = `Axis 115`
|
|||||||
IR/Forward = `Axis 116`
|
IR/Forward = `Axis 116`
|
||||||
IR/Backward = `Axis 117`
|
IR/Backward = `Axis 117`
|
||||||
IR/Hide = `Button 118`
|
IR/Hide = `Button 118`
|
||||||
IR/Height = 50
|
IR/Total Pitch = 15
|
||||||
IR/Width = 50
|
IR/Total Yaw = 15
|
||||||
IR/Center = 50
|
IR/Vertical Offset = 10
|
||||||
Swing/Up = `Axis 120`
|
Swing/Up = `Axis 120`
|
||||||
Swing/Down = `Axis 121`
|
Swing/Down = `Axis 121`
|
||||||
Swing/Left = `Axis 122`
|
Swing/Left = `Axis 122`
|
||||||
|
|||||||
+49
-45
@@ -842,26 +842,26 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
|
|
||||||
private void setIRSensitivity()
|
private void setIRSensitivity()
|
||||||
{
|
{
|
||||||
int irHeight = Integer.valueOf(
|
int ir_pitch = Integer.valueOf(
|
||||||
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_HEIGHT + mSelectedGameId, "50"));
|
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_PITCH + mSelectedGameId, "15"));
|
||||||
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(this);
|
LayoutInflater inflater = LayoutInflater.from(this);
|
||||||
View view = inflater.inflate(R.layout.dialog_ir_sensitivity, null);
|
View view = inflater.inflate(R.layout.dialog_ir_sensitivity, null);
|
||||||
|
|
||||||
TextView mTextSliderValueHeight = (TextView) view.findViewById(R.id.text_ir_height);
|
TextView text_slider_value_pitch = (TextView) view.findViewById(R.id.text_ir_pitch);
|
||||||
TextView units = (TextView) view.findViewById(R.id.text_ir_height_units);
|
TextView units = (TextView) view.findViewById(R.id.text_ir_pitch_units);
|
||||||
SeekBar seekbarHeight = view.findViewById(R.id.seekbar_height);
|
SeekBar seekbar_pitch = view.findViewById(R.id.seekbar_pitch);
|
||||||
|
|
||||||
mTextSliderValueHeight.setText(String.valueOf(irHeight));
|
text_slider_value_pitch.setText(String.valueOf(ir_pitch));
|
||||||
units.setText(getString(R.string.height));
|
units.setText(getString(R.string.pitch));
|
||||||
seekbarHeight.setMax(100);
|
seekbar_pitch.setMax(100);
|
||||||
seekbarHeight.setProgress(irHeight);
|
seekbar_pitch.setProgress(ir_pitch);
|
||||||
seekbarHeight.setKeyProgressIncrement(5);
|
seekbar_pitch.setKeyProgressIncrement(5);
|
||||||
seekbarHeight.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
seekbar_pitch.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
||||||
{
|
{
|
||||||
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||||
{
|
{
|
||||||
mTextSliderValueHeight.setText(String.valueOf(progress));
|
text_slider_value_pitch.setText(String.valueOf(progress));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
@@ -875,23 +875,23 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
int irWidth = Integer.valueOf(
|
int ir_yaw = Integer.valueOf(
|
||||||
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_WIDTH + mSelectedGameId, "50"));
|
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_YAW + mSelectedGameId, "15"));
|
||||||
|
|
||||||
TextView mTextSliderValueWidth = (TextView) view.findViewById(R.id.text_ir_width);
|
TextView text_slider_value_yaw = (TextView) view.findViewById(R.id.text_ir_yaw);
|
||||||
TextView unitsWidth = (TextView) view.findViewById(R.id.text_ir_width_units);
|
TextView units_yaw = (TextView) view.findViewById(R.id.text_ir_yaw_units);
|
||||||
SeekBar seekbarWidth = view.findViewById(R.id.seekbar_width);
|
SeekBar seekbar_yaw = view.findViewById(R.id.seekbar_width);
|
||||||
|
|
||||||
mTextSliderValueWidth.setText(String.valueOf(irWidth));
|
text_slider_value_yaw.setText(String.valueOf(ir_yaw));
|
||||||
unitsWidth.setText(getString(R.string.width));
|
units_yaw.setText(getString(R.string.yaw));
|
||||||
seekbarWidth.setMax(100);
|
seekbar_yaw.setMax(100);
|
||||||
seekbarWidth.setProgress(irWidth);
|
seekbar_yaw.setProgress(ir_yaw);
|
||||||
seekbarWidth.setKeyProgressIncrement(5);
|
seekbar_yaw.setKeyProgressIncrement(5);
|
||||||
seekbarWidth.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
seekbar_yaw.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
||||||
{
|
{
|
||||||
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||||
{
|
{
|
||||||
mTextSliderValueWidth.setText(String.valueOf(progress));
|
text_slider_value_yaw.setText(String.valueOf(progress));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
@@ -906,23 +906,26 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
int irCenter = Integer.valueOf(
|
int ir_vertical_offset = Integer.valueOf(
|
||||||
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_CENTER + mSelectedGameId, "50"));
|
mPreferences.getString(SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET + mSelectedGameId,
|
||||||
|
"10"));
|
||||||
|
|
||||||
TextView mTextSliderValueCenter = (TextView) view.findViewById(R.id.text_ir_center);
|
TextView text_slider_value_vertical_offset =
|
||||||
TextView unitsCenter = (TextView) view.findViewById(R.id.text_ir_center_units);
|
(TextView) view.findViewById(R.id.text_ir_vertical_offset);
|
||||||
SeekBar seekbarCenter = view.findViewById(R.id.seekbar_center);
|
TextView units_vertical_offset =
|
||||||
|
(TextView) view.findViewById(R.id.text_ir_vertical_offset_units);
|
||||||
|
SeekBar seekbar_vertical_offset = view.findViewById(R.id.seekbar_vertical_offset);
|
||||||
|
|
||||||
mTextSliderValueCenter.setText(String.valueOf(irCenter));
|
text_slider_value_vertical_offset.setText(String.valueOf(ir_vertical_offset));
|
||||||
unitsCenter.setText(getString(R.string.center));
|
units_vertical_offset.setText(getString(R.string.vertical_offset));
|
||||||
seekbarCenter.setMax(100);
|
seekbar_vertical_offset.setMax(100);
|
||||||
seekbarCenter.setProgress(irCenter);
|
seekbar_vertical_offset.setProgress(ir_vertical_offset);
|
||||||
seekbarCenter.setKeyProgressIncrement(5);
|
seekbar_vertical_offset.setKeyProgressIncrement(5);
|
||||||
seekbarCenter.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
seekbar_vertical_offset.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener()
|
||||||
{
|
{
|
||||||
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
@Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser)
|
||||||
{
|
{
|
||||||
mTextSliderValueCenter.setText(String.valueOf(progress));
|
text_slider_value_vertical_offset.setText(String.valueOf(progress));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
@Override public void onStartTrackingTouch(SeekBar seekBar)
|
||||||
@@ -942,21 +945,22 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
|
builder.setPositiveButton(R.string.ok, (dialogInterface, i) ->
|
||||||
{
|
{
|
||||||
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
||||||
SettingsFile.KEY_WIIBIND_IR_HEIGHT, mTextSliderValueHeight.getText().toString());
|
SettingsFile.KEY_WIIBIND_IR_PITCH, text_slider_value_pitch.getText().toString());
|
||||||
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
||||||
SettingsFile.KEY_WIIBIND_IR_WIDTH, mTextSliderValueWidth.getText().toString());
|
SettingsFile.KEY_WIIBIND_IR_YAW, text_slider_value_yaw.getText().toString());
|
||||||
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
SettingsFile.saveSingleCustomSetting(mSelectedGameId, Settings.SECTION_CONTROLS,
|
||||||
SettingsFile.KEY_WIIBIND_IR_CENTER, mTextSliderValueCenter.getText().toString());
|
SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET,
|
||||||
|
text_slider_value_vertical_offset.getText().toString());
|
||||||
|
|
||||||
NativeLibrary.ReloadWiimoteConfig();
|
NativeLibrary.ReloadWiimoteConfig();
|
||||||
|
|
||||||
SharedPreferences.Editor editor = mPreferences.edit();
|
SharedPreferences.Editor editor = mPreferences.edit();
|
||||||
editor.putString(SettingsFile.KEY_WIIBIND_IR_HEIGHT + mSelectedGameId,
|
editor.putString(SettingsFile.KEY_WIIBIND_IR_PITCH + mSelectedGameId,
|
||||||
mTextSliderValueHeight.getText().toString());
|
text_slider_value_pitch.getText().toString());
|
||||||
editor.putString(SettingsFile.KEY_WIIBIND_IR_WIDTH + mSelectedGameId,
|
editor.putString(SettingsFile.KEY_WIIBIND_IR_YAW + mSelectedGameId,
|
||||||
mTextSliderValueWidth.getText().toString());
|
text_slider_value_yaw.getText().toString());
|
||||||
editor.putString(SettingsFile.KEY_WIIBIND_IR_CENTER + mSelectedGameId,
|
editor.putString(SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET + mSelectedGameId,
|
||||||
mTextSliderValueCenter.getText().toString());
|
text_slider_value_vertical_offset.getText().toString());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(R.string.cancel, (dialogInterface, i) ->
|
builder.setNegativeButton(R.string.cancel, (dialogInterface, i) ->
|
||||||
|
|||||||
+3
-3
@@ -153,9 +153,9 @@ public final class SettingsFile
|
|||||||
public static final String KEY_WIIBIND_IR_FORWARD = "IRForward_";
|
public static final String KEY_WIIBIND_IR_FORWARD = "IRForward_";
|
||||||
public static final String KEY_WIIBIND_IR_BACKWARD = "IRBackward_";
|
public static final String KEY_WIIBIND_IR_BACKWARD = "IRBackward_";
|
||||||
public static final String KEY_WIIBIND_IR_HIDE = "IRHide_";
|
public static final String KEY_WIIBIND_IR_HIDE = "IRHide_";
|
||||||
public static final String KEY_WIIBIND_IR_HEIGHT = "IRHeight";
|
public static final String KEY_WIIBIND_IR_PITCH = "IRTotalPitch";
|
||||||
public static final String KEY_WIIBIND_IR_WIDTH = "IRWidth";
|
public static final String KEY_WIIBIND_IR_YAW = "IRTotalYaw";
|
||||||
public static final String KEY_WIIBIND_IR_CENTER = "IRCenter";
|
public static final String KEY_WIIBIND_IR_VERTICAL_OFFSET = "IRVerticalOffset";
|
||||||
public static final String KEY_WIIBIND_SWING_UP = "SwingUp_";
|
public static final String KEY_WIIBIND_SWING_UP = "SwingUp_";
|
||||||
public static final String KEY_WIIBIND_SWING_DOWN = "SwingDown_";
|
public static final String KEY_WIIBIND_SWING_DOWN = "SwingDown_";
|
||||||
public static final String KEY_WIIBIND_SWING_LEFT = "SwingLeft_";
|
public static final String KEY_WIIBIND_SWING_LEFT = "SwingLeft_";
|
||||||
|
|||||||
@@ -16,13 +16,13 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@+id/text_ir_width"
|
android:layout_below="@+id/text_ir_yaw"
|
||||||
android:layout_marginBottom="@dimen/spacing_medlarge"
|
android:layout_marginBottom="@dimen/spacing_medlarge"
|
||||||
android:layout_marginLeft="@dimen/spacing_large"
|
android:layout_marginLeft="@dimen/spacing_large"
|
||||||
android:layout_marginRight="@dimen/spacing_large"/>
|
android:layout_marginRight="@dimen/spacing_large"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_width"
|
android:id="@+id/text_ir_yaw"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
@@ -32,11 +32,11 @@
|
|||||||
tools:text="75"/>
|
tools:text="75"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_width_units"
|
android:id="@+id/text_ir_yaw_units"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@+id/text_ir_width"
|
android:layout_alignTop="@+id/text_ir_yaw"
|
||||||
android:layout_toEndOf="@+id/text_ir_width"
|
android:layout_toEndOf="@+id/text_ir_yaw"
|
||||||
tools:text="%"/>
|
tools:text="%"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
@@ -46,18 +46,18 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/seekbar_height"
|
android:id="@+id/seekbar_pitch"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@+id/text_ir_height"
|
android:layout_below="@+id/text_ir_pitch"
|
||||||
android:layout_marginBottom="@dimen/spacing_medlarge"
|
android:layout_marginBottom="@dimen/spacing_medlarge"
|
||||||
android:layout_marginLeft="@dimen/spacing_large"
|
android:layout_marginLeft="@dimen/spacing_large"
|
||||||
android:layout_marginRight="@dimen/spacing_large"/>
|
android:layout_marginRight="@dimen/spacing_large"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_height"
|
android:id="@+id/text_ir_pitch"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
@@ -67,11 +67,11 @@
|
|||||||
tools:text="75"/>
|
tools:text="75"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_height_units"
|
android:id="@+id/text_ir_pitch_units"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@+id/text_ir_height"
|
android:layout_alignTop="@+id/text_ir_pitch"
|
||||||
android:layout_toEndOf="@+id/text_ir_height"
|
android:layout_toEndOf="@+id/text_ir_pitch"
|
||||||
tools:text="%"/>
|
tools:text="%"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@@ -82,18 +82,18 @@
|
|||||||
android:layout_weight="1">
|
android:layout_weight="1">
|
||||||
|
|
||||||
<SeekBar
|
<SeekBar
|
||||||
android:id="@+id/seekbar_center"
|
android:id="@+id/seekbar_vertical_offset"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_alignParentStart="true"
|
android:layout_alignParentStart="true"
|
||||||
android:layout_below="@+id/text_ir_center"
|
android:layout_below="@+id/text_ir_vertical_offset"
|
||||||
android:layout_marginBottom="@dimen/spacing_medlarge"
|
android:layout_marginBottom="@dimen/spacing_medlarge"
|
||||||
android:layout_marginLeft="@dimen/spacing_large"
|
android:layout_marginLeft="@dimen/spacing_large"
|
||||||
android:layout_marginRight="@dimen/spacing_large"/>
|
android:layout_marginRight="@dimen/spacing_large"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_center"
|
android:id="@+id/text_ir_vertical_offset"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignParentTop="true"
|
android:layout_alignParentTop="true"
|
||||||
@@ -103,11 +103,11 @@
|
|||||||
tools:text="75"/>
|
tools:text="75"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/text_ir_center_units"
|
android:id="@+id/text_ir_vertical_offset_units"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_alignTop="@+id/text_ir_center"
|
android:layout_alignTop="@+id/text_ir_vertical_offset"
|
||||||
android:layout_toEndOf="@+id/text_ir_center"
|
android:layout_toEndOf="@+id/text_ir_vertical_offset"
|
||||||
tools:text="%"/>
|
tools:text="%"/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -330,8 +330,8 @@
|
|||||||
<string name="select_dir">Select This Directory</string>
|
<string name="select_dir">Select This Directory</string>
|
||||||
|
|
||||||
<!-- Misc -->
|
<!-- Misc -->
|
||||||
<string name="height">Height</string>
|
<string name="pitch">Total Pitch</string>
|
||||||
<string name="width">Width</string>
|
<string name="yaw">Total Yaw</string>
|
||||||
<string name="center">Center</string>
|
<string name="vertical_offset">Vertical Offset</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
#include "InputCommon/KeyboardStatus.h"
|
#include "InputCommon/KeyboardStatus.h"
|
||||||
|
|
||||||
static const u16 keys0_bitmasks[] = {KEYMASK_HOME, KEYMASK_END, KEYMASK_PGUP, KEYMASK_PGDN,
|
static const u16 keys0_bitmasks[] = {KEYMASK_HOME, KEYMASK_END, KEYMASK_PGUP, KEYMASK_PGDN,
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/Buttons.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/MixedTriggers.h"
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
#include "InputCommon/ControllerEmu/StickGate.h"
|
#include "InputCommon/ControllerEmu/StickGate.h"
|
||||||
|
|
||||||
#include "InputCommon/GCPadStatus.h"
|
#include "InputCommon/GCPadStatus.h"
|
||||||
@@ -102,10 +101,10 @@ GCPad::GCPad(const unsigned int index) : m_index(index)
|
|||||||
|
|
||||||
// options
|
// options
|
||||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||||
m_options->boolean_settings.emplace_back(
|
m_options->AddSetting(&m_always_connected_setting,
|
||||||
// i18n: Treat a controller as always being connected regardless of what
|
// i18n: Treat a controller as always being connected regardless of what
|
||||||
// devices the user actually has plugged in
|
// devices the user actually has plugged in
|
||||||
m_always_connected = new ControllerEmu::BooleanSetting(_trans("Always Connected"), false));
|
_trans("Always Connected"), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GCPad::GetName() const
|
std::string GCPad::GetName() const
|
||||||
@@ -143,7 +142,7 @@ GCPadStatus GCPad::GetInput() const
|
|||||||
const auto lock = GetStateLock();
|
const auto lock = GetStateLock();
|
||||||
GCPadStatus pad = {};
|
GCPadStatus pad = {};
|
||||||
|
|
||||||
if (!(m_always_connected->GetValue() || IsDefaultDeviceConnected()))
|
if (!(m_always_connected_setting.GetValue() || IsDefaultDeviceConnected()))
|
||||||
{
|
{
|
||||||
pad.isConnected = false;
|
pad.isConnected = false;
|
||||||
return pad;
|
return pad;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/ControlGroup.h"
|
||||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
||||||
|
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||||
|
|
||||||
struct GCPadStatus;
|
struct GCPadStatus;
|
||||||
|
|
||||||
@@ -57,7 +58,8 @@ private:
|
|||||||
ControllerEmu::ControlGroup* m_rumble;
|
ControllerEmu::ControlGroup* m_rumble;
|
||||||
ControllerEmu::Buttons* m_mic;
|
ControllerEmu::Buttons* m_mic;
|
||||||
ControllerEmu::ControlGroup* m_options;
|
ControllerEmu::ControlGroup* m_options;
|
||||||
ControllerEmu::BooleanSetting* m_always_connected;
|
|
||||||
|
ControllerEmu::SettingValue<bool> m_always_connected_setting;
|
||||||
|
|
||||||
const unsigned int m_index;
|
const unsigned int m_index;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
#include "Common/Matrix.h"
|
#include "Common/Matrix.h"
|
||||||
|
|
||||||
#include "Core/Config/SYSCONFSettings.h"
|
|
||||||
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
|
#include "Core/HW/WiimoteCommon/WiimoteReport.h"
|
||||||
|
|
||||||
namespace WiimoteEmu
|
namespace WiimoteEmu
|
||||||
@@ -84,13 +83,9 @@ void CameraLogic::Update(const Common::Matrix44& transform)
|
|||||||
// This seems to be acceptable for a good number of games.
|
// This seems to be acceptable for a good number of games.
|
||||||
constexpr float SENSOR_BAR_LED_SEPARATION = 0.2f;
|
constexpr float SENSOR_BAR_LED_SEPARATION = 0.2f;
|
||||||
|
|
||||||
// Emulate a sensor bar height that matches the config.
|
|
||||||
const bool sensor_bar_on_top = Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION) != 0;
|
|
||||||
const float sensor_bar_height = sensor_bar_on_top ? 0.11 : -0.11;
|
|
||||||
|
|
||||||
const std::array<Vec3, NUM_POINTS> leds{
|
const std::array<Vec3, NUM_POINTS> leds{
|
||||||
Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, sensor_bar_height},
|
Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, 0},
|
||||||
Vec3{SENSOR_BAR_LED_SEPARATION / 2, 0, sensor_bar_height},
|
Vec3{SENSOR_BAR_LED_SEPARATION / 2, 0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
const auto camera_view = Matrix44::Perspective(CAMERA_FOV_Y, CAMERA_ASPECT_RATIO, 0.001f, 1000) *
|
const auto camera_view = Matrix44::Perspective(CAMERA_FOV_Y, CAMERA_ASPECT_RATIO, 0.001f, 1000) *
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
#include "Common/MathUtil.h"
|
#include "Common/MathUtil.h"
|
||||||
|
#include "Core/Config/SYSCONFSettings.h"
|
||||||
#include "Core/Config/WiimoteInputSettings.h"
|
#include "Core/Config/WiimoteInputSettings.h"
|
||||||
#include "Core/HW/Wiimote.h"
|
#include "Core/HW/Wiimote.h"
|
||||||
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
|
||||||
@@ -186,25 +187,28 @@ WiimoteCommon::DataReportBuilder::AccelData ConvertAccelData(const Common::Vec3&
|
|||||||
|
|
||||||
Common::Matrix44 EmulateCursorMovement(ControllerEmu::Cursor* ir_group)
|
Common::Matrix44 EmulateCursorMovement(ControllerEmu::Cursor* ir_group)
|
||||||
{
|
{
|
||||||
const auto cursor = ir_group->GetState(true);
|
|
||||||
|
|
||||||
using Common::Matrix33;
|
using Common::Matrix33;
|
||||||
using Common::Matrix44;
|
using Common::Matrix44;
|
||||||
|
|
||||||
// Values are optimized for default settings in "Super Mario Galaxy 2"
|
|
||||||
// This seems to be acceptable for a good number of games.
|
|
||||||
constexpr float YAW_ANGLE = 0.1472f;
|
|
||||||
constexpr float PITCH_ANGLE = 0.121f;
|
|
||||||
|
|
||||||
// Nintendo recommends a distance of 1-3 meters.
|
// Nintendo recommends a distance of 1-3 meters.
|
||||||
constexpr float NEUTRAL_DISTANCE = 2.f;
|
constexpr float NEUTRAL_DISTANCE = 2.f;
|
||||||
|
|
||||||
constexpr float MOVE_DISTANCE = 1.f;
|
constexpr float MOVE_DISTANCE = 1.f;
|
||||||
|
|
||||||
|
// When the sensor bar position is on bottom, apply the "offset" setting negatively.
|
||||||
|
// This is kinda odd but it does seem to maintain consistent cursor behavior.
|
||||||
|
const bool sensor_bar_on_top = Config::Get(Config::SYSCONF_SENSOR_BAR_POSITION) != 0;
|
||||||
|
|
||||||
|
const float height = ir_group->GetVerticalOffset() * (sensor_bar_on_top ? 1 : -1);
|
||||||
|
|
||||||
|
const float yaw_scale = ir_group->GetTotalYaw() / 2;
|
||||||
|
const float pitch_scale = ir_group->GetTotalPitch() / 2;
|
||||||
|
|
||||||
|
const auto cursor = ir_group->GetState(true);
|
||||||
|
|
||||||
return Matrix44::Translate({0, MOVE_DISTANCE * float(cursor.z), 0}) *
|
return Matrix44::Translate({0, MOVE_DISTANCE * float(cursor.z), 0}) *
|
||||||
Matrix44::FromMatrix33(Matrix33::RotateX(PITCH_ANGLE * cursor.y) *
|
Matrix44::FromMatrix33(Matrix33::RotateX(pitch_scale * cursor.y) *
|
||||||
Matrix33::RotateZ(YAW_ANGLE * cursor.x)) *
|
Matrix33::RotateZ(yaw_scale * cursor.x)) *
|
||||||
Matrix44::Translate({0, -NEUTRAL_DISTANCE, 0});
|
Matrix44::Translate({0, -NEUTRAL_DISTANCE, height});
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApproachAngleWithAccel(RotationalState* state, const Common::Vec3& angle_target,
|
void ApproachAngleWithAccel(RotationalState* state, const Common::Vec3& angle_target,
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
#include "Core/HW/WiimoteReal/WiimoteReal.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/Attachments.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
|
|
||||||
namespace WiimoteEmu
|
namespace WiimoteEmu
|
||||||
{
|
{
|
||||||
@@ -233,7 +232,7 @@ void Wiimote::HandleRequestStatus(const OutputReportRequestStatus&)
|
|||||||
// Max battery level seems to be 0xc8 (decimal 200)
|
// Max battery level seems to be 0xc8 (decimal 200)
|
||||||
constexpr u8 MAX_BATTERY_LEVEL = 0xc8;
|
constexpr u8 MAX_BATTERY_LEVEL = 0xc8;
|
||||||
|
|
||||||
m_status.battery = u8(std::lround(m_battery_setting->GetValue() * MAX_BATTERY_LEVEL));
|
m_status.battery = u8(std::lround(m_battery_setting.GetValue() / 100 * MAX_BATTERY_LEVEL));
|
||||||
|
|
||||||
if (Core::WantsDeterminism())
|
if (Core::WantsDeterminism())
|
||||||
{
|
{
|
||||||
@@ -394,7 +393,7 @@ void Wiimote::HandleSpeakerData(const WiimoteCommon::OutputReportSpeakerData& rp
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Speaker Pan
|
// Speaker Pan
|
||||||
const auto pan = m_options->numeric_settings[0]->GetValue();
|
const auto pan = m_speaker_pan_setting.GetValue() / 100;
|
||||||
|
|
||||||
m_speaker_logic.SpeakerData(rpt.data, rpt.length, pan);
|
m_speaker_logic.SpeakerData(rpt.data, rpt.length, pan);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,8 +41,6 @@
|
|||||||
#include "InputCommon/ControllerEmu/ControlGroup/Force.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/Force.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/ModifySettingsButton.h"
|
||||||
#include "InputCommon/ControllerEmu/ControlGroup/Tilt.h"
|
#include "InputCommon/ControllerEmu/ControlGroup/Tilt.h"
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
|
||||||
|
|
||||||
namespace WiimoteEmu
|
namespace WiimoteEmu
|
||||||
{
|
{
|
||||||
@@ -212,26 +210,28 @@ Wiimote::Wiimote(const unsigned int index) : m_index(index)
|
|||||||
// options
|
// options
|
||||||
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
groups.emplace_back(m_options = new ControllerEmu::ControlGroup(_trans("Options")));
|
||||||
|
|
||||||
// m_options->boolean_settings.emplace_back(
|
m_options->AddSetting(&m_speaker_pan_setting,
|
||||||
// m_motion_plus_setting =
|
{_trans("Speaker Pan"),
|
||||||
// new ControllerEmu::BooleanSetting("Attach MotionPlus", _trans("Attach MotionPlus"),
|
// i18n: The percent symbol.
|
||||||
// true,
|
_trans("%")},
|
||||||
// ControllerEmu::SettingType::NORMAL, false));
|
0, -100, 100);
|
||||||
|
|
||||||
m_options->boolean_settings.emplace_back(
|
m_options->AddSetting(&m_battery_setting,
|
||||||
new ControllerEmu::BooleanSetting("Forward Wiimote", _trans("Forward Wii Remote"), true,
|
{_trans("Battery"),
|
||||||
ControllerEmu::SettingType::NORMAL, true));
|
// i18n: The percent symbol.
|
||||||
m_options->boolean_settings.emplace_back(m_upright_setting = new ControllerEmu::BooleanSetting(
|
_trans("%")},
|
||||||
"Upright Wiimote", _trans("Upright Wii Remote"),
|
95, 0, 100);
|
||||||
false, ControllerEmu::SettingType::NORMAL, true));
|
|
||||||
m_options->boolean_settings.emplace_back(m_sideways_setting = new ControllerEmu::BooleanSetting(
|
|
||||||
"Sideways Wiimote", _trans("Sideways Wii Remote"),
|
|
||||||
false, ControllerEmu::SettingType::NORMAL, true));
|
|
||||||
|
|
||||||
m_options->numeric_settings.emplace_back(
|
// m_options->AddSetting(&m_motion_plus_setting, {_trans("Attach MotionPlus")}, true);
|
||||||
std::make_unique<ControllerEmu::NumericSetting>(_trans("Speaker Pan"), 0, -100, 100));
|
|
||||||
m_options->numeric_settings.emplace_back(
|
// Note: "Upright" and "Sideways" options can be enabled at the same time which produces an
|
||||||
m_battery_setting = new ControllerEmu::NumericSetting(_trans("Battery"), 95.0 / 100, 0, 100));
|
// orientation where the wiimote points towards the left with the buttons towards you.
|
||||||
|
m_options->AddSetting(&m_upright_setting,
|
||||||
|
{"Upright Wiimote", nullptr, nullptr, _trans("Upright Wii Remote")}, false);
|
||||||
|
|
||||||
|
m_options->AddSetting(&m_sideways_setting,
|
||||||
|
{"Sideways Wiimote", nullptr, nullptr, _trans("Sideways Wii Remote")},
|
||||||
|
false);
|
||||||
|
|
||||||
// hotkeys
|
// hotkeys
|
||||||
groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys")));
|
groups.emplace_back(m_hotkeys = new ControllerEmu::ModifySettingsButton(_trans("Hotkeys")));
|
||||||
@@ -667,14 +667,14 @@ bool Wiimote::IsSideways() const
|
|||||||
{
|
{
|
||||||
const bool sideways_modifier_toggle = m_hotkeys->getSettingsModifier()[0];
|
const bool sideways_modifier_toggle = m_hotkeys->getSettingsModifier()[0];
|
||||||
const bool sideways_modifier_switch = m_hotkeys->getSettingsModifier()[2];
|
const bool sideways_modifier_switch = m_hotkeys->getSettingsModifier()[2];
|
||||||
return m_sideways_setting->GetValue() ^ sideways_modifier_toggle ^ sideways_modifier_switch;
|
return m_sideways_setting.GetValue() ^ sideways_modifier_toggle ^ sideways_modifier_switch;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Wiimote::IsUpright() const
|
bool Wiimote::IsUpright() const
|
||||||
{
|
{
|
||||||
const bool upright_modifier_toggle = m_hotkeys->getSettingsModifier()[1];
|
const bool upright_modifier_toggle = m_hotkeys->getSettingsModifier()[1];
|
||||||
const bool upright_modifier_switch = m_hotkeys->getSettingsModifier()[3];
|
const bool upright_modifier_switch = m_hotkeys->getSettingsModifier()[3];
|
||||||
return m_upright_setting->GetValue() ^ upright_modifier_toggle ^ upright_modifier_switch;
|
return m_upright_setting.GetValue() ^ upright_modifier_toggle ^ upright_modifier_switch;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Wiimote::SetRumble(bool on)
|
void Wiimote::SetRumble(bool on)
|
||||||
|
|||||||
@@ -23,14 +23,12 @@ class PointerWrap;
|
|||||||
namespace ControllerEmu
|
namespace ControllerEmu
|
||||||
{
|
{
|
||||||
class Attachments;
|
class Attachments;
|
||||||
class BooleanSetting;
|
|
||||||
class Buttons;
|
class Buttons;
|
||||||
class ControlGroup;
|
class ControlGroup;
|
||||||
class Cursor;
|
class Cursor;
|
||||||
class Extension;
|
class Extension;
|
||||||
class Force;
|
class Force;
|
||||||
class ModifySettingsButton;
|
class ModifySettingsButton;
|
||||||
class NumericSetting;
|
|
||||||
class Output;
|
class Output;
|
||||||
class Tilt;
|
class Tilt;
|
||||||
} // namespace ControllerEmu
|
} // namespace ControllerEmu
|
||||||
@@ -235,12 +233,14 @@ private:
|
|||||||
ControllerEmu::Output* m_motor;
|
ControllerEmu::Output* m_motor;
|
||||||
ControllerEmu::Attachments* m_attachments;
|
ControllerEmu::Attachments* m_attachments;
|
||||||
ControllerEmu::ControlGroup* m_options;
|
ControllerEmu::ControlGroup* m_options;
|
||||||
ControllerEmu::BooleanSetting* m_sideways_setting;
|
|
||||||
ControllerEmu::BooleanSetting* m_upright_setting;
|
|
||||||
ControllerEmu::NumericSetting* m_battery_setting;
|
|
||||||
// ControllerEmu::BooleanSetting* m_motion_plus_setting;
|
|
||||||
ControllerEmu::ModifySettingsButton* m_hotkeys;
|
ControllerEmu::ModifySettingsButton* m_hotkeys;
|
||||||
|
|
||||||
|
ControllerEmu::SettingValue<bool> m_sideways_setting;
|
||||||
|
ControllerEmu::SettingValue<bool> m_upright_setting;
|
||||||
|
ControllerEmu::SettingValue<double> m_battery_setting;
|
||||||
|
ControllerEmu::SettingValue<double> m_speaker_pan_setting;
|
||||||
|
// ControllerEmu::SettingValue<bool> m_motion_plus_setting;
|
||||||
|
|
||||||
SpeakerLogic m_speaker_logic;
|
SpeakerLogic m_speaker_logic;
|
||||||
MotionPlus m_motion_plus;
|
MotionPlus m_motion_plus;
|
||||||
CameraLogic m_camera_logic;
|
CameraLogic m_camera_logic;
|
||||||
|
|||||||
@@ -63,12 +63,10 @@ add_executable(dolphin-emu
|
|||||||
Config/Mapping/HotkeyTAS.cpp
|
Config/Mapping/HotkeyTAS.cpp
|
||||||
Config/Mapping/HotkeyWii.cpp
|
Config/Mapping/HotkeyWii.cpp
|
||||||
Config/Mapping/IOWindow.cpp
|
Config/Mapping/IOWindow.cpp
|
||||||
Config/Mapping/MappingBool.cpp
|
|
||||||
Config/Mapping/MappingButton.cpp
|
Config/Mapping/MappingButton.cpp
|
||||||
Config/Mapping/MappingCommon.cpp
|
Config/Mapping/MappingCommon.cpp
|
||||||
Config/Mapping/MappingIndicator.cpp
|
Config/Mapping/MappingIndicator.cpp
|
||||||
Config/Mapping/MappingNumeric.cpp
|
Config/Mapping/MappingNumeric.cpp
|
||||||
Config/Mapping/MappingRadio.cpp
|
|
||||||
Config/Mapping/MappingWidget.cpp
|
Config/Mapping/MappingWidget.cpp
|
||||||
Config/Mapping/MappingWindow.cpp
|
Config/Mapping/MappingWindow.cpp
|
||||||
Config/Mapping/WiimoteEmuExtension.cpp
|
Config/Mapping/WiimoteEmuExtension.cpp
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
#include "Core/HW/GCPad.h"
|
#include "Core/HW/GCPad.h"
|
||||||
#include "Core/HW/GCPadEmu.h"
|
#include "Core/HW/GCPadEmu.h"
|
||||||
|
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
#include "InputCommon/ControllerEmu/Setting/NumericSetting.h"
|
||||||
#include "InputCommon/InputConfig.h"
|
#include "InputCommon/InputConfig.h"
|
||||||
|
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
// Copyright 2017 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#include "DolphinQt/Config/Mapping/MappingBool.h"
|
|
||||||
|
|
||||||
#include "DolphinQt/Config/Mapping/MappingWidget.h"
|
|
||||||
|
|
||||||
#include "InputCommon/ControllerEmu/ControllerEmu.h"
|
|
||||||
#include "InputCommon/ControllerEmu/Setting/BooleanSetting.h"
|
|
||||||
#include "InputCommon/ControllerInterface/ControllerInterface.h"
|
|
||||||
|
|
||||||
MappingBool::MappingBool(MappingWidget* parent, ControllerEmu::BooleanSetting* setting)
|
|
||||||
: QCheckBox(tr(setting->m_ui_name.c_str())), m_setting(*setting)
|
|
||||||
{
|
|
||||||
connect(this, &QCheckBox::stateChanged, this, [this, parent](int value) {
|
|
||||||
m_setting.SetValue(value);
|
|
||||||
parent->SaveSettings();
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(parent, &MappingWidget::ConfigChanged, this, &MappingBool::ConfigChanged);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MappingBool::ConfigChanged()
|
|
||||||
{
|
|
||||||
const bool old_state = blockSignals(true);
|
|
||||||
setChecked(m_setting.GetValue());
|
|
||||||
blockSignals(old_state);
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
// Copyright 2017 Dolphin Emulator Project
|
|
||||||
// Licensed under GPLv2+
|
|
||||||
// Refer to the license.txt file included.
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
|
||||||
|
|
||||||
class MappingWidget;
|
|
||||||
|
|
||||||
namespace ControllerEmu
|
|
||||||
{
|
|
||||||
class BooleanSetting;
|
|
||||||
};
|
|
||||||
|
|
||||||
class MappingBool : public QCheckBox
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MappingBool(MappingWidget* widget, ControllerEmu::BooleanSetting* setting);
|
|
||||||
|
|
||||||
private:
|
|
||||||
void ConfigChanged();
|
|
||||||
|
|
||||||
ControllerEmu::BooleanSetting& m_setting;
|
|
||||||
};
|
|
||||||
@@ -158,7 +158,7 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deadzone for Z (forward/backward):
|
// Deadzone for Z (forward/backward):
|
||||||
const double deadzone = cursor.numeric_settings[cursor.SETTING_DEADZONE]->GetValue();
|
const double deadzone = cursor.GetDeadzonePercentage();
|
||||||
if (deadzone > 0.0)
|
if (deadzone > 0.0)
|
||||||
{
|
{
|
||||||
p.setPen(DEADZONE_COLOR);
|
p.setPen(DEADZONE_COLOR);
|
||||||
@@ -181,23 +181,12 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TV screen or whatever you want to call this:
|
// TV screen or whatever you want to call this:
|
||||||
constexpr double tv_scale = 0.75;
|
constexpr double TV_SCALE = 0.75;
|
||||||
constexpr double center_scale = 2.0 / 3.0;
|
|
||||||
|
|
||||||
const double tv_center = (cursor.numeric_settings[cursor.SETTING_CENTER]->GetValue() - 0.5);
|
|
||||||
const double tv_width = cursor.numeric_settings[cursor.SETTING_WIDTH]->GetValue();
|
|
||||||
const double tv_height = cursor.numeric_settings[cursor.SETTING_HEIGHT]->GetValue();
|
|
||||||
|
|
||||||
p.setPen(tv_pen_color);
|
p.setPen(tv_pen_color);
|
||||||
p.setBrush(tv_brush_color);
|
p.setBrush(tv_brush_color);
|
||||||
auto gate_polygon = GetPolygonFromRadiusGetter(
|
p.drawPolygon(GetPolygonFromRadiusGetter(
|
||||||
[&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale);
|
[&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale * TV_SCALE));
|
||||||
for (auto& pt : gate_polygon)
|
|
||||||
{
|
|
||||||
pt = {pt.x() * tv_width, pt.y() * tv_height + tv_center * center_scale * scale};
|
|
||||||
pt *= tv_scale;
|
|
||||||
}
|
|
||||||
p.drawPolygon(gate_polygon);
|
|
||||||
|
|
||||||
// Deadzone.
|
// Deadzone.
|
||||||
p.setPen(DEADZONE_COLOR);
|
p.setPen(DEADZONE_COLOR);
|
||||||
@@ -221,8 +210,8 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
|
|||||||
{
|
{
|
||||||
p.setPen(Qt::NoPen);
|
p.setPen(Qt::NoPen);
|
||||||
p.setBrush(ADJ_INPUT_COLOR);
|
p.setBrush(ADJ_INPUT_COLOR);
|
||||||
const QPointF pt(adj_coord.x / 2.0, (adj_coord.y - tv_center) / 2.0 + tv_center * center_scale);
|
p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale * TV_SCALE, INPUT_DOT_RADIUS,
|
||||||
p.drawEllipse(pt * scale * tv_scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
|
INPUT_DOT_RADIUS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -444,7 +433,7 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deadzone for Z (forward/backward):
|
// Deadzone for Z (forward/backward):
|
||||||
const double deadzone = force.numeric_settings[force.SETTING_DEADZONE]->GetValue();
|
const double deadzone = force.GetDeadzonePercentage();
|
||||||
if (deadzone > 0.0)
|
if (deadzone > 0.0)
|
||||||
{
|
{
|
||||||
p.setPen(DEADZONE_COLOR);
|
p.setPen(DEADZONE_COLOR);
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ class Control;
|
|||||||
class ControlGroup;
|
class ControlGroup;
|
||||||
class Cursor;
|
class Cursor;
|
||||||
class Force;
|
class Force;
|
||||||
class NumericSetting;
|
|
||||||
} // namespace ControllerEmu
|
} // namespace ControllerEmu
|
||||||
|
|
||||||
class QPainter;
|
class QPainter;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user