diff options
| author | Lioncash <mathew1800@gmail.com> | 2013-08-19 19:10:13 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2013-08-19 19:10:13 -0400 |
| commit | 77a5af3bcf093b81df92921096e1d74bef505b46 (patch) | |
| tree | aeef93e9de3f82bf4a32ba6c44e5d1e2fe01f7ae /Source/Android/src | |
| parent | 814c1c9572c7152d009bb8be44c68f4d7d115f61 (diff) | |
[Android] Change the settings menu a little more. Instead of the settings being a single view with settings from all components being displayed, I have broken it into sections. This future-proofs the settings menu in the sense that it won't get cluttered before people start asking "Hey, shouldn't this be broken into sections?".
As of this commit, it is broken into CPU Settings and Video Settings.
I also simplified the code that is responsible for setting the valid CPU cores and video backends by simply making UI string arrays that get chosen, based on the platform the Android device is running on.
Diffstat (limited to 'Source/Android/src')
3 files changed, 32 insertions, 50 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index 08c95fd2cd..e593a996ad 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -127,9 +127,9 @@ public final class DolphinEmulator<MainActivity> extends Activity SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = prefs.edit(); - editor.putString("cpupref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "CPUCore", "3")); - editor.putBoolean("dualcorepref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "CPUThread", "False").equals("True") ? true : false); - editor.putString("gpupref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend ", "Software Renderer")); + editor.putString("cpuCorePref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "CPUCore", "3")); + editor.putBoolean("dualCorePref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "CPUThread", "False").equals("True") ? true : false); + editor.putString("gpuPref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend ", "Software Renderer")); editor.commit(); } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java index 2bd61cb0f2..bbc3a0be72 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java @@ -113,9 +113,9 @@ public final class GameListActivity extends Activity case 2: { String Keys[] = { - "cpupref", - "dualcorepref", - "gpupref", + "cpuCorePref", + "dualCorePref", + "gpuPref", }; String ConfigKeys[] = { "Core-CPUCore", diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index ad69a89a9d..bdc036e38a 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -1,12 +1,9 @@ package org.dolphinemu.dolphinemu; -import java.util.HashMap; - import android.app.Activity; import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; -import android.preference.PreferenceCategory; import android.preference.PreferenceFragment; import javax.microedition.khronos.egl.*; @@ -111,11 +108,11 @@ public final class PrefsFragment extends PreferenceFragment boolean mSupportsGLES3 = false; // Check for OpenGL ES 3 support (General case). - if (m_GLVersion.contains("OpenGL ES 3.0") || m_GLVersion.equals("OpenGL ES 3.0")) + if (m_GLVersion != null && (m_GLVersion.contains("OpenGL ES 3.0") || m_GLVersion.equals("OpenGL ES 3.0"))) mSupportsGLES3 = true; // Checking for OpenGL ES 3 support for certain Qualcomm devices. - if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm")) + if (!mSupportsGLES3 && m_GLVendor != null && m_GLVendor.equals("Qualcomm")) { if (m_GLRenderer.contains("Adreno (TM) 3")) { @@ -149,58 +146,43 @@ public final class PrefsFragment extends PreferenceFragment // Load the preferences from an XML resource addPreferencesFromResource(R.layout.prefs); - final ListPreference etp = new ListPreference(m_activity); - final HashMap<CharSequence, CharSequence> entries = new HashMap<CharSequence, CharSequence>(); + final ListPreference cpuCores = (ListPreference) findPreference("cpuCorePref"); + // + // Set valid emulation cores depending on the CPU architecture + // that the Android device is running on. + // if (Build.CPU_ABI.contains("x86")) { - entries.put(getString(R.string.interpreter), "0"); - entries.put(getString(R.string.jit64_recompiler), "1"); - entries.put(getString(R.string.jitil_recompiler), "2"); + cpuCores.setEntries(R.array.emuCoreEntriesX86); + cpuCores.setEntryValues(R.array.emuCoreValuesX86); } else if (Build.CPU_ABI.contains("arm")) { - entries.put(getString(R.string.interpreter), "0"); - entries.put(getString(R.string.jit_arm_recompiler), "3"); + cpuCores.setEntries(R.array.emuCoreEntriesARM); + cpuCores.setEntryValues(R.array.emuCoreValuesARM); } else { - entries.put(getString(R.string.interpreter), "0"); + cpuCores.setEntries(R.array.emuCoreEntriesOther); + cpuCores.setEntryValues(R.array.emuCoreValuesOther); } - - // Convert the key/value sections to arrays respectively so the list can be set. - // If Java had proper generics it wouldn't look this disgusting. - etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); - etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); - etp.setKey("cpupref"); - etp.setTitle(getString(R.string.cpu_core)); - etp.setSummary(getString(R.string.emu_core_to_use)); - - PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat"); - mCategory.addPreference(etp); - boolean mSupportsGLES3 = SupportsGLES3(); + // + // Setting valid video backends. + // + final ListPreference videoBackends = (ListPreference) findPreference("gpuPref"); + final boolean deviceSupportsGLES3 = SupportsGLES3(); - if (!mSupportsGLES3) + if (deviceSupportsGLES3) { - mCategory = (PreferenceCategory) findPreference("videoprefcat"); - ListPreference mPref = (ListPreference) findPreference("gpupref"); - mCategory.removePreference(mPref); - - final ListPreference videobackend = new ListPreference(m_activity); - - // Add available graphics renderers to the hashmap to add to the list. - entries.clear(); - entries.put(getString(R.string.software_renderer), "Software Renderer"); - - videobackend.setKey("gpupref"); - videobackend.setTitle(getString(R.string.video_backend)); - videobackend.setSummary(getString(R.string.video_backend_to_use)); - - videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); - videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); - - mCategory.addPreference(videobackend); + videoBackends.setEntries(R.array.videoBackendEntriesGLES3); + videoBackends.setEntryValues(R.array.videoBackendValuesGLES3); + } + else + { + videoBackends.setEntries(R.array.videoBackendEntriesNoGLES3); + videoBackends.setEntryValues(R.array.videoBackendValuesNoGLES3); } } |
