diff options
| author | Lioncash <mathew1800@gmail.com> | 2013-08-19 22:34:27 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2013-08-19 22:34:27 -0400 |
| commit | 9595457e1cc9714a01fae19a831ddb7d7b93a493 (patch) | |
| tree | 18a948f6391caa3137354bec1b4b26adff982883 /Source/Android/src | |
| parent | 6dbfdce7753e1dce2b69f439e696e8c0d2cf590f (diff) | |
[Android] Turn SaveConfigToDolphinIni() into a static method. Now saving settings to the ini config just uses one call in PrefsFragment.onDestroy().
Diffstat (limited to 'Source/Android/src')
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java | 6 | ||||
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java | 46 |
2 files changed, 13 insertions, 39 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index bacede461f..0919e09964 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -208,9 +208,7 @@ public final class PrefsFragment extends PreferenceFragment { super.onDestroy(); - // When the fragment is done being used, save the settings - // to the Dolphin ini file. - UserPreferences userPrefs = new UserPreferences(m_activity); - userPrefs.SaveConfigToDolphinIni(); + // When the fragment is done being used, save the settings to the Dolphin ini file. + UserPreferences.SaveConfigToDolphinIni(m_activity); } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java b/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java index aea2ca6e31..f5747db9f5 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java @@ -12,46 +12,22 @@ import android.preference.PreferenceManager; * aren't made necessary. */ public final class UserPreferences -{ - // The cached shared preferences. - private final SharedPreferences mPrefs; - - // Whether or not the user is using dual core. - private final boolean isUsingDualCore; - - // The current CPU core being used. - private final String currentEmuCore; - - // The current video back-end being used. - private final String currentVideoBackend; - - /** - * Constructor - * - * @param ctx The context to use an instance of this class in. - * This allows the class to retrieve the SharedPreferences - * instance from the given context, which, in turn allows - * this class to function for its intended purpose. - */ - public UserPreferences(Context ctx) +{ + /** Writes the config to the Dolphin ini file. */ + public static void SaveConfigToDolphinIni(Context ctx) { - // Get an instance of all of our stored preferences. - this.mPrefs = PreferenceManager.getDefaultSharedPreferences(ctx); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx); - //-- Assign to the variables to cache the settings. --// + // Whether or not the user is using dual core. + boolean isUsingDualCore = prefs.getBoolean("dualCorePref", true); - this.isUsingDualCore = mPrefs.getBoolean("dualCorePref", true); + // Current CPU core being used. Falls back to interpreter upon error. + String currentEmuCore = prefs.getString("cpuCorePref", "0"); + + // Current video backend being used. Falls back to software rendering upon error + String currentVideoBackend = prefs.getString("gpuPref", "Software Rendering"); - // Fall back to interpreter if it somehow can't find a CPU core. - this.currentEmuCore = mPrefs.getString("cpuCorePref", "0"); - // Fall back to using software rendering if another valid backend can't be found. - this.currentVideoBackend = mPrefs.getString("gpuPref", "Software Renderer"); - } - - /** Writes the config to the Dolphin ini file. */ - public void SaveConfigToDolphinIni() - { NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUCore", currentEmuCore); NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUThread", isUsingDualCore ? "True" : "False"); NativeLibrary.SetConfig("Dolphin.ini", "Core", "GFXBackend", currentVideoBackend); |
