mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 08:09:26 +01:00
Android: Clear preferences linked to WiimoteNew.ini when overwriting
Otherwise the preferences can end up in a state that is inconsistent with WiimoteNew.ini.
This commit is contained in:
parent
b793ee6521
commit
7e64bdc85f
@ -1,5 +1,6 @@
|
|||||||
package org.dolphinemu.dolphinemu.activities;
|
package org.dolphinemu.dolphinemu.activities;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
@ -237,6 +238,14 @@ public final class EmulationActivity extends AppCompatActivity
|
|||||||
activity.startActivity(launcher);
|
activity.startActivity(launcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void clearWiimoteNewIniLinkedPreferences(Context context)
|
||||||
|
{
|
||||||
|
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(context).edit();
|
||||||
|
editor.remove("wiiController");
|
||||||
|
editor.remove("motionControlsEnabled");
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState)
|
protected void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ import android.preference.PreferenceManager;
|
|||||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
|
import org.dolphinemu.dolphinemu.activities.EmulationActivity;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -152,6 +153,7 @@ public final class DirectoryInitialization
|
|||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||||
if (prefs.getInt("WiimoteNewVersion", 0) != WiimoteNewVersion)
|
if (prefs.getInt("WiimoteNewVersion", 0) != WiimoteNewVersion)
|
||||||
{
|
{
|
||||||
|
EmulationActivity.clearWiimoteNewIniLinkedPreferences(context);
|
||||||
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), true, context);
|
copyAsset("WiimoteNew.ini", new File(configDirectory, "WiimoteNew.ini"), true, context);
|
||||||
SharedPreferences.Editor sPrefsEditor = prefs.edit();
|
SharedPreferences.Editor sPrefsEditor = prefs.edit();
|
||||||
sPrefsEditor.putInt("WiimoteNewVersion", WiimoteNewVersion);
|
sPrefsEditor.putInt("WiimoteNewVersion", WiimoteNewVersion);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user