Android: Remove the in-emulation IR sensitivity options

This too can be set in the normal controller settings now.
This commit is contained in:
JosJuice 2022-06-26 15:19:46 +02:00
parent ee2c7dc24b
commit 4c326f2030
7 changed files with 3 additions and 262 deletions

View File

@ -39,7 +39,6 @@ import org.dolphinemu.dolphinemu.NativeLibrary;
import org.dolphinemu.dolphinemu.R;
import org.dolphinemu.dolphinemu.databinding.ActivityEmulationBinding;
import org.dolphinemu.dolphinemu.databinding.DialogInputAdjustBinding;
import org.dolphinemu.dolphinemu.databinding.DialogIrSensitivityBinding;
import org.dolphinemu.dolphinemu.databinding.DialogSkylandersManagerBinding;
import org.dolphinemu.dolphinemu.features.input.model.ControllerInterface;
import org.dolphinemu.dolphinemu.features.input.model.DolphinSensorEventListener;
@ -124,9 +123,9 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
MENU_ACTION_LOAD_SLOT3, MENU_ACTION_LOAD_SLOT4, MENU_ACTION_LOAD_SLOT5,
MENU_ACTION_LOAD_SLOT6, MENU_ACTION_EXIT, MENU_ACTION_CHANGE_DISC,
MENU_ACTION_RESET_OVERLAY, MENU_SET_IR_RECENTER, MENU_SET_IR_MODE,
MENU_SET_IR_SENSITIVITY, MENU_ACTION_CHOOSE_DOUBLETAP,
MENU_ACTION_PAUSE_EMULATION, MENU_ACTION_UNPAUSE_EMULATION,
MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS, MENU_ACTION_SKYLANDERS})
MENU_ACTION_CHOOSE_DOUBLETAP, MENU_ACTION_PAUSE_EMULATION,
MENU_ACTION_UNPAUSE_EMULATION, MENU_ACTION_OVERLAY_CONTROLS, MENU_ACTION_SETTINGS,
MENU_ACTION_SKYLANDERS})
public @interface MenuAction
{
}
@ -159,7 +158,6 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
public static final int MENU_ACTION_RESET_OVERLAY = 26;
public static final int MENU_SET_IR_RECENTER = 27;
public static final int MENU_SET_IR_MODE = 28;
public static final int MENU_SET_IR_SENSITIVITY = 29;
public static final int MENU_ACTION_CHOOSE_DOUBLETAP = 30;
public static final int MENU_ACTION_PAUSE_EMULATION = 32;
public static final int MENU_ACTION_UNPAUSE_EMULATION = 33;
@ -195,8 +193,6 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
EmulationActivity.MENU_SET_IR_RECENTER);
buttonsActionsMap.append(R.id.menu_emulation_set_ir_mode,
EmulationActivity.MENU_SET_IR_MODE);
buttonsActionsMap.append(R.id.menu_emulation_set_ir_sensitivity,
EmulationActivity.MENU_SET_IR_SENSITIVITY);
buttonsActionsMap.append(R.id.menu_emulation_choose_doubletap,
EmulationActivity.MENU_ACTION_CHOOSE_DOUBLETAP);
}
@ -786,10 +782,6 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
setIRMode();
break;
case MENU_SET_IR_SENSITIVITY:
setIRSensitivity();
break;
case MENU_ACTION_CHOOSE_DOUBLETAP:
chooseDoubleTapButton();
break;
@ -1021,88 +1013,6 @@ public final class EmulationActivity extends AppCompatActivity implements ThemeP
.show();
}
private void setIRSensitivity()
{
// IR settings always get saved per-game since WiimoteNew.ini is wiped upon reinstall.
File file = SettingsFile.getCustomGameSettingsFile(NativeLibrary.GetCurrentGameID());
IniFile ini = new IniFile(file);
int ir_pitch = ini.getInt(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_PITCH, 20);
DialogIrSensitivityBinding dialogBinding =
DialogIrSensitivityBinding.inflate(getLayoutInflater());
TextView text_slider_value_pitch = dialogBinding.textIrPitch;
TextView units = dialogBinding.textIrPitchUnits;
Slider slider_pitch = dialogBinding.sliderPitch;
text_slider_value_pitch.setText(String.valueOf(ir_pitch));
units.setText(getString(R.string.pitch));
slider_pitch.setValueTo(100);
slider_pitch.setValue(ir_pitch);
slider_pitch.setStepSize(1);
slider_pitch.addOnChangeListener(
(slider, progress, fromUser) -> text_slider_value_pitch.setText(
String.valueOf((int) progress)));
int ir_yaw = ini.getInt(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_YAW, 25);
TextView text_slider_value_yaw = dialogBinding.textIrYaw;
TextView units_yaw = dialogBinding.textIrYawUnits;
Slider seekbar_yaw = dialogBinding.sliderYaw;
text_slider_value_yaw.setText(String.valueOf(ir_yaw));
units_yaw.setText(getString(R.string.yaw));
seekbar_yaw.setValueTo(100);
seekbar_yaw.setValue(ir_yaw);
seekbar_yaw.setStepSize(1);
seekbar_yaw.addOnChangeListener((slider, progress, fromUser) -> text_slider_value_yaw.setText(
String.valueOf((int) progress)));
int ir_vertical_offset =
ini.getInt(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET, 10);
TextView text_slider_value_vertical_offset = dialogBinding.textIrVerticalOffset;
TextView units_vertical_offset = dialogBinding.textIrVerticalOffsetUnits;
Slider seekbar_vertical_offset = dialogBinding.sliderVerticalOffset;
text_slider_value_vertical_offset.setText(String.valueOf(ir_vertical_offset));
units_vertical_offset.setText(getString(R.string.vertical_offset));
seekbar_vertical_offset.setValueTo(100);
seekbar_vertical_offset.setValue(ir_vertical_offset);
seekbar_vertical_offset.setStepSize(1);
seekbar_vertical_offset.addOnChangeListener(
(slider, progress, fromUser) -> text_slider_value_vertical_offset.setText(
String.valueOf((int) progress)));
new MaterialAlertDialogBuilder(this)
.setTitle(getString(R.string.emulation_ir_sensitivity))
.setView(dialogBinding.getRoot())
.setPositiveButton(R.string.ok, (dialogInterface, i) ->
{
ini.setString(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_PITCH,
text_slider_value_pitch.getText().toString());
ini.setString(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_YAW,
text_slider_value_yaw.getText().toString());
ini.setString(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET,
text_slider_value_vertical_offset.getText().toString());
ini.save(file);
NativeLibrary.ReloadWiimoteConfig();
})
.setNegativeButton(R.string.cancel, null)
.setNeutralButton(R.string.default_values, (dialogInterface, i) ->
{
ini.deleteKey(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_PITCH);
ini.deleteKey(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_YAW);
ini.deleteKey(Settings.SECTION_CONTROLS, SettingsFile.KEY_WIIBIND_IR_VERTICAL_OFFSET);
ini.save(file);
NativeLibrary.ReloadWiimoteConfig();
})
.show();
}
private void showSkylanderPortalSettings()
{
mSkylandersBinding =

View File

@ -47,7 +47,6 @@ public class Settings implements Closeable
public static final String SECTION_STEREOSCOPY = "Stereoscopy";
public static final String SECTION_BINDINGS = "Android";
public static final String SECTION_CONTROLS = "Controls";
public static final String SECTION_PROFILE = "Profile";
public static final String SECTION_ANALYTICS = "Analytics";

View File

@ -22,10 +22,6 @@ public final class SettingsFile
public static final String KEY_GCPAD_PLAYER_1 = "SIDevice0";
public static final String KEY_WIIBIND_IR_PITCH = "IRTotalPitch";
public static final String KEY_WIIBIND_IR_YAW = "IRTotalYaw";
public static final String KEY_WIIBIND_IR_VERTICAL_OFFSET = "IRVerticalOffset";
private static BiMap<String, String> sectionsMap = new BiMap<>();
static

View File

@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<com.google.android.material.slider.Slider
android:id="@+id/slider_yaw"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@id/text_ir_yaw"
app:layout_constraintStart_toEndOf="@id/text_ir_yaw_units"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_ir_yaw"
android:layout_width="26dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginStart="@dimen/spacing_medlarge"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="@+id/slider_yaw"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/slider_yaw"
app:layout_constraintTop_toTopOf="@+id/slider_yaw"
tools:text="100" />
<TextView
android:id="@+id/text_ir_yaw_units"
android:layout_width="92dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/spacing_medlarge"
android:textAlignment="viewStart"
app:layout_constraintBottom_toBottomOf="@+id/slider_yaw"
app:layout_constraintEnd_toStartOf="@id/slider_yaw"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/slider_yaw"
tools:text="Total Yaw" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<com.google.android.material.slider.Slider
android:id="@+id/slider_pitch"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@id/text_ir_pitch"
app:layout_constraintStart_toEndOf="@id/text_ir_pitch_units"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_ir_pitch"
android:layout_width="26dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginStart="@dimen/spacing_medlarge"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="@+id/slider_pitch"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/slider_pitch"
app:layout_constraintTop_toTopOf="@+id/slider_pitch"
tools:text="100" />
<TextView
android:id="@+id/text_ir_pitch_units"
android:layout_width="92dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/spacing_medlarge"
android:textAlignment="viewStart"
app:layout_constraintBottom_toBottomOf="@+id/slider_pitch"
app:layout_constraintEnd_toStartOf="@id/slider_pitch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/slider_pitch"
tools:text="Total Pitch" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<com.google.android.material.slider.Slider
android:id="@+id/slider_vertical_offset"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@id/text_ir_vertical_offset"
app:layout_constraintStart_toEndOf="@id/text_ir_vertical_offset_units"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/text_ir_vertical_offset"
android:layout_width="26dp"
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:layout_marginStart="@dimen/spacing_medlarge"
android:gravity="end"
app:layout_constraintBottom_toBottomOf="@+id/slider_vertical_offset"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/slider_vertical_offset"
app:layout_constraintTop_toTopOf="@+id/slider_vertical_offset"
tools:text="100" />
<TextView
android:id="@+id/text_ir_vertical_offset_units"
android:layout_width="92dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginEnd="@dimen/spacing_medlarge"
android:textAlignment="viewStart"
app:layout_constraintBottom_toBottomOf="@+id/slider_vertical_offset"
app:layout_constraintEnd_toStartOf="@id/slider_vertical_offset"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/slider_vertical_offset"
tools:text="Vertical Offset" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>

View File

@ -36,9 +36,6 @@
<item
android:id="@+id/menu_emulation_set_ir_mode"
android:title="@string/emulation_ir_mode"/>
<item
android:id="@+id/menu_emulation_set_ir_sensitivity"
android:title="@string/emulation_ir_sensitivity"/>
<item
android:id="@+id/menu_emulation_choose_doubletap"
android:title="@string/emulation_choose_doubletap"/>

View File

@ -610,9 +610,6 @@ It can efficiently compress both junk data and encrypted Wii data.
<!-- Misc -->
<string name="enabled">Enabled</string>
<string name="pitch">Total Pitch</string>
<string name="yaw">Total Yaw</string>
<string name="vertical_offset">Vertical Offset</string>
<string name="default_values">Default Values</string>
<string name="slider_setting_value">%1$d%2$s</string>
<string name="disc_number">Disc %1$d</string>

View File

@ -35,11 +35,6 @@ bool InputConfig::LoadConfig(InputClass type)
std::string profile[MAX_BBMOTES];
std::string path;
#if defined(ANDROID)
bool use_ir_config = false;
std::string ir_values[3];
#endif
m_dynamic_input_tex_config_manager.Load();
if (SConfig::GetInstance().GetGameID() != "00000000")
@ -90,18 +85,6 @@ bool InputConfig::LoadConfig(InputClass type)
}
}
}
#if defined(ANDROID)
// For use on android touchscreen IR pointer
// Check for IR values
if (control_section->Exists("IRTotalYaw") && control_section->Exists("IRTotalPitch") &&
control_section->Exists("IRVerticalOffset"))
{
use_ir_config = true;
control_section->Get("IRTotalYaw", &ir_values[0]);
control_section->Get("IRTotalPitch", &ir_values[1]);
control_section->Get("IRVerticalOffset", &ir_values[2]);
}
#endif
}
if (inifile.Load(File::GetUserPath(D_CONFIG_IDX) + m_ini_name + ".ini") &&
@ -129,15 +112,6 @@ bool InputConfig::LoadConfig(InputClass type)
{
config = *inifile.GetOrCreateSection(controller->GetName());
}
#if defined(ANDROID)
// Only set for wii pads
if (type == InputClass::Wii && use_ir_config)
{
config.Set("IR/Total Yaw", ir_values[0]);
config.Set("IR/Total Pitch", ir_values[1]);
config.Set("IR/Vertical Offset", ir_values[2]);
}
#endif
controller->LoadConfig(&config);
controller->UpdateReferences(g_controller_interface);
controller_names.push_back(controller->GetName());