[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.
This commit is contained in:
parent
814c1c9572
commit
77a5af3bcf
|
@ -1,24 +1,30 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
>
|
|
||||||
<PreferenceCategory
|
<!-- CPU Settings -->
|
||||||
android:summary="@string/settings"
|
<PreferenceScreen
|
||||||
android:title="@string/cpu_settings"
|
android:title="@string/cpu_settings">
|
||||||
android:key="cpuprefcat">
|
|
||||||
<CheckBoxPreference
|
<CheckBoxPreference
|
||||||
android:key="dualcorepref"
|
android:key="dualCorePref"
|
||||||
android:summary="@string/on_off"
|
android:summary="@string/on_off"
|
||||||
android:title="@string/dual_core" />
|
android:title="@string/dual_core" />
|
||||||
</PreferenceCategory>
|
|
||||||
<PreferenceCategory
|
|
||||||
android:summary="@string/settings"
|
|
||||||
android:title="@string/video_settings"
|
|
||||||
android:key="videoprefcat">
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
android:entries="@array/gpuOptions"
|
android:key="cpuCorePref"
|
||||||
android:entryValues="@array/gpuValues"
|
android:summary="@string/emu_core_to_use"
|
||||||
android:key="gpupref"
|
android:title="@string/cpu_core" />
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
||||||
|
|
||||||
|
<!-- Video Settings -->
|
||||||
|
<PreferenceScreen
|
||||||
|
android:title="@string/video_settings">
|
||||||
|
|
||||||
|
<ListPreference
|
||||||
|
android:key="gpuPref"
|
||||||
android:summary="@string/video_backend_to_use"
|
android:summary="@string/video_backend_to_use"
|
||||||
android:title="@string/video_backend" />
|
android:title="@string/video_backend" />
|
||||||
</PreferenceCategory>
|
|
||||||
|
</PreferenceScreen>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
<string name="video_settings">ビデオ設定</string>
|
<string name="video_settings">ビデオ設定</string>
|
||||||
<string name="software_renderer">Software Renderer</string>
|
<string name="software_renderer">Software Renderer</string>
|
||||||
|
<string name="opengl_es3">OpenGL ES 3</string>
|
||||||
<string name="video_backend">ビデオレンダラ</string>
|
<string name="video_backend">ビデオレンダラ</string>
|
||||||
<string name="video_backend_to_use">使用するビデオレンダラー</string>
|
<string name="video_backend_to_use">使用するビデオレンダラー</string>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!-- All lists for ListPreference keys/values are placed here -->
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- CPU core selection - X86 -->
|
||||||
|
<string-array name="emuCoreEntriesX86" translatable="false">
|
||||||
|
<item>@string/interpreter</item>
|
||||||
|
<item>@string/jit64_recompiler</item>
|
||||||
|
<item>@string/jitil_recompiler</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="emuCoreValuesX86" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>1</item>
|
||||||
|
<item>2</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- CPU core selection - ARM -->
|
||||||
|
<string-array name="emuCoreEntriesARM" translatable="false">
|
||||||
|
<item>@string/interpreter</item>
|
||||||
|
<item>@string/jit_arm_recompiler</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="emuCoreValuesARM" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
<item>3</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- CPU core selection - Other -->
|
||||||
|
<string-array name="emuCoreEntriesOther" translatable="false">
|
||||||
|
<item>@string/interpreter</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="emuCoreValuesOther" translatable="false">
|
||||||
|
<item>0</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Video Backend Selection - Supports OpenGL ES 3 -->
|
||||||
|
<string-array name="videoBackendEntriesGLES3" translatable="false">
|
||||||
|
<item>@string/software_renderer</item>
|
||||||
|
<item>@string/opengl_es3</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="videoBackendValuesGLES3" translatable="false">
|
||||||
|
<item>Software Renderer</item>
|
||||||
|
<item>OGL</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Video Backend Selection - No OpenGL ES 3 support -->
|
||||||
|
<string-array name="videoBackendEntriesNoGLES3">
|
||||||
|
<item>@string/software_renderer</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="videoBackendValuesNoGLES3">
|
||||||
|
<item>Software Renderer</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
</resources>
|
|
@ -1,12 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<resources>
|
|
||||||
<string-array name="gpuOptions" translatable="false">
|
|
||||||
<item>Software Renderer</item>
|
|
||||||
<item>OpenGL ES 3</item>
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="gpuValues" translatable="false">
|
|
||||||
<item>Software Renderer</item>
|
|
||||||
<item>OGL</item>
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
|
|
@ -73,6 +73,7 @@
|
||||||
|
|
||||||
<string name="video_settings">Video Settings</string>
|
<string name="video_settings">Video Settings</string>
|
||||||
<string name="software_renderer">Software Renderer</string>
|
<string name="software_renderer">Software Renderer</string>
|
||||||
|
<string name="opengl_es3">OpenGL ES 3</string>
|
||||||
<string name="video_backend">Video Backend</string>
|
<string name="video_backend">Video Backend</string>
|
||||||
<string name="video_backend_to_use">Video backend to use</string>
|
<string name="video_backend_to_use">Video backend to use</string>
|
||||||
|
|
||||||
|
|
|
@ -127,9 +127,9 @@ public final class DolphinEmulator<MainActivity> extends Activity
|
||||||
|
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||||
SharedPreferences.Editor editor = prefs.edit();
|
SharedPreferences.Editor editor = prefs.edit();
|
||||||
editor.putString("cpupref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "CPUCore", "3"));
|
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.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("gpuPref", NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend ", "Software Renderer"));
|
||||||
editor.commit();
|
editor.commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,9 +113,9 @@ public final class GameListActivity extends Activity
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
String Keys[] = {
|
String Keys[] = {
|
||||||
"cpupref",
|
"cpuCorePref",
|
||||||
"dualcorepref",
|
"dualCorePref",
|
||||||
"gpupref",
|
"gpuPref",
|
||||||
};
|
};
|
||||||
String ConfigKeys[] = {
|
String ConfigKeys[] = {
|
||||||
"Core-CPUCore",
|
"Core-CPUCore",
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
package org.dolphinemu.dolphinemu;
|
package org.dolphinemu.dolphinemu;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.PreferenceCategory;
|
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
|
|
||||||
import javax.microedition.khronos.egl.*;
|
import javax.microedition.khronos.egl.*;
|
||||||
|
@ -111,11 +108,11 @@ public final class PrefsFragment extends PreferenceFragment
|
||||||
boolean mSupportsGLES3 = false;
|
boolean mSupportsGLES3 = false;
|
||||||
|
|
||||||
// Check for OpenGL ES 3 support (General case).
|
// 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;
|
mSupportsGLES3 = true;
|
||||||
|
|
||||||
// Checking for OpenGL ES 3 support for certain Qualcomm devices.
|
// 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"))
|
if (m_GLRenderer.contains("Adreno (TM) 3"))
|
||||||
{
|
{
|
||||||
|
@ -149,58 +146,43 @@ public final class PrefsFragment extends PreferenceFragment
|
||||||
// Load the preferences from an XML resource
|
// Load the preferences from an XML resource
|
||||||
addPreferencesFromResource(R.layout.prefs);
|
addPreferencesFromResource(R.layout.prefs);
|
||||||
|
|
||||||
final ListPreference etp = new ListPreference(m_activity);
|
final ListPreference cpuCores = (ListPreference) findPreference("cpuCorePref");
|
||||||
final HashMap<CharSequence, CharSequence> entries = new HashMap<CharSequence, CharSequence>();
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Set valid emulation cores depending on the CPU architecture
|
||||||
|
// that the Android device is running on.
|
||||||
|
//
|
||||||
if (Build.CPU_ABI.contains("x86"))
|
if (Build.CPU_ABI.contains("x86"))
|
||||||
{
|
{
|
||||||
entries.put(getString(R.string.interpreter), "0");
|
cpuCores.setEntries(R.array.emuCoreEntriesX86);
|
||||||
entries.put(getString(R.string.jit64_recompiler), "1");
|
cpuCores.setEntryValues(R.array.emuCoreValuesX86);
|
||||||
entries.put(getString(R.string.jitil_recompiler), "2");
|
|
||||||
}
|
}
|
||||||
else if (Build.CPU_ABI.contains("arm"))
|
else if (Build.CPU_ABI.contains("arm"))
|
||||||
{
|
{
|
||||||
entries.put(getString(R.string.interpreter), "0");
|
cpuCores.setEntries(R.array.emuCoreEntriesARM);
|
||||||
entries.put(getString(R.string.jit_arm_recompiler), "3");
|
cpuCores.setEntryValues(R.array.emuCoreValuesARM);
|
||||||
}
|
}
|
||||||
else
|
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.
|
// Setting valid video backends.
|
||||||
etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()]));
|
//
|
||||||
etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()]));
|
final ListPreference videoBackends = (ListPreference) findPreference("gpuPref");
|
||||||
etp.setKey("cpupref");
|
final boolean deviceSupportsGLES3 = SupportsGLES3();
|
||||||
etp.setTitle(getString(R.string.cpu_core));
|
|
||||||
etp.setSummary(getString(R.string.emu_core_to_use));
|
|
||||||
|
|
||||||
PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat");
|
if (deviceSupportsGLES3)
|
||||||
mCategory.addPreference(etp);
|
|
||||||
|
|
||||||
boolean mSupportsGLES3 = SupportsGLES3();
|
|
||||||
|
|
||||||
if (!mSupportsGLES3)
|
|
||||||
{
|
{
|
||||||
mCategory = (PreferenceCategory) findPreference("videoprefcat");
|
videoBackends.setEntries(R.array.videoBackendEntriesGLES3);
|
||||||
ListPreference mPref = (ListPreference) findPreference("gpupref");
|
videoBackends.setEntryValues(R.array.videoBackendValuesGLES3);
|
||||||
mCategory.removePreference(mPref);
|
}
|
||||||
|
else
|
||||||
final ListPreference videobackend = new ListPreference(m_activity);
|
{
|
||||||
|
videoBackends.setEntries(R.array.videoBackendEntriesNoGLES3);
|
||||||
// Add available graphics renderers to the hashmap to add to the list.
|
videoBackends.setEntryValues(R.array.videoBackendValuesNoGLES3);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue