diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml
index a6918f867b..5744af828c 100644
--- a/Source/Android/AndroidManifest.xml
+++ b/Source/Android/AndroidManifest.xml
@@ -4,45 +4,51 @@
android:versionCode="10"
android:versionName="0.10" >
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ android:label="@string/app_name" >
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
+
+ android:name="org.dolphinemu.dolphinemu.folderbrowser.FolderBrowser"
+ android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode"
+ android:label="@string/app_name" >
+ android:name="org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment"
+ android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode"
+ android:label="@string/app_name" >
+
+
+
+
+
+
-
-
-
-
+ android:name="org.dolphinemu.dolphinemu.settings.PrefsActivity"
+ android:label="@string/settings" >
diff --git a/Source/Android/res/layout/prefs_viewpager.xml b/Source/Android/res/layout/prefs_viewpager.xml
new file mode 100644
index 0000000000..f07fc62c46
--- /dev/null
+++ b/Source/Android/res/layout/prefs_viewpager.xml
@@ -0,0 +1,6 @@
+
diff --git a/Source/Android/res/values/dimens.xml b/Source/Android/res/values/dimens.xml
new file mode 100644
index 0000000000..55c1e5908c
--- /dev/null
+++ b/Source/Android/res/values/dimens.xml
@@ -0,0 +1,7 @@
+
+
+
+ 16dp
+ 16dp
+
+
diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml
index 6ddd255995..009387ff77 100644
--- a/Source/Android/res/values/strings.xml
+++ b/Source/Android/res/values/strings.xml
@@ -3,22 +3,22 @@
Dolphin Emulator
-
+
Open navigation drawer
Close navigation drawer
-
+
Build Revision:
Supports OpenGL ES 3:
-
+
Current Dir:
Parent Directory
Folder
File Size:
Can not use compressed file types
-
+
Game List
Browse Folder
@@ -28,7 +28,7 @@
File clicked:
-
+
Draw on-screen controls
Button A
@@ -51,11 +51,10 @@
C Stick Right
Trigger L
Trigger R
-
Not drawing on-screen controls
Drawing on-screen controls
Press button to configure %1$s
-
+
Interpreter
JIT64 Recompiler
@@ -66,7 +65,6 @@
Emulation core to use
Dual Core
On/Off
-
Video Settings
Software Renderer
OpenGL ES 3
@@ -121,5 +119,6 @@
No
Disabled
Other
+
diff --git a/Source/Android/res/xml/cpu_prefs.xml b/Source/Android/res/xml/cpu_prefs.xml
new file mode 100644
index 0000000000..adb6fff91f
--- /dev/null
+++ b/Source/Android/res/xml/cpu_prefs.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Android/res/xml/prefs.xml b/Source/Android/res/xml/prefs.xml
deleted file mode 100644
index 89c531f2d0..0000000000
--- a/Source/Android/res/xml/prefs.xml
+++ /dev/null
@@ -1,144 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Source/Android/res/xml/video_prefs.xml b/Source/Android/res/xml/video_prefs.xml
new file mode 100644
index 0000000000..2abd8deabf
--- /dev/null
+++ b/Source/Android/res/xml/video_prefs.xml
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
index 07e36fa459..40e78fc4bf 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
@@ -11,6 +11,10 @@ import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
+import org.dolphinemu.dolphinemu.folderbrowser.FolderBrowserAdapter;
+import org.dolphinemu.dolphinemu.folderbrowser.FolderBrowserItem;
+import org.dolphinemu.dolphinemu.settings.VideoSettingsFragment;
+
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
@@ -42,7 +46,7 @@ public final class AboutFragment extends Fragment
List Input = new ArrayList();
Input.add(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true));
- Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), PrefsFragment.SupportsGLES3() ? yes : no, "", true));
+ Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, "", true));
adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input);
mMainList.setAdapter(adapter);
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
index f1abc215d1..3dca1f5fbe 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
@@ -15,6 +15,10 @@ import android.view.WindowManager;
import java.io.*;
import java.util.List;
+import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
+import org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment;
+import org.dolphinemu.dolphinemu.settings.UserPreferences;
+
public final class DolphinEmulator extends Activity
{
static private NativeGLSurfaceView GLview = null;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java
deleted file mode 100644
index f6196c7236..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.app.Activity;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.PreferenceFragment;
-import javax.microedition.khronos.egl.*;
-import javax.microedition.khronos.opengles.GL10;
-
-//
-// TODO: It would be nice to situate the preferences in a ViewPager.
-// In such a way that the video settings are divided into sections like
-// [General | Enhancements | Hacks]
-//
-// However I do not know how to correctly get ViewPagers to work with PreferenceFragments
-// (at the time of writing), so if anyone else can implement this (AND document it nicely)
-// that would be awesome
-//
-// - Lioncash
-//
-
-/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
- */
-public final class PrefsFragment extends PreferenceFragment
-{
- private Activity m_activity;
-
- static public class VersionCheck
- {
- EGL10 mEGL;
- EGLDisplay mEGLDisplay;
- EGLConfig[] mEGLConfigs;
- EGLConfig mEGLConfig;
- EGLContext mEGLContext;
- EGLSurface mEGLSurface;
- GL10 mGL;
-
- String mThreadOwner;
-
- public VersionCheck()
- {
- int[] version = new int[2];
- int[] attribList = new int[] {
- EGL10.EGL_WIDTH, 1,
- EGL10.EGL_HEIGHT, 1,
- EGL10.EGL_RENDERABLE_TYPE, 4,
- EGL10.EGL_NONE
- };
- int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
- int[] ctx_attribs = new int[] {
- EGL_CONTEXT_CLIENT_VERSION, 2,
- EGL10.EGL_NONE
- };
-
- // No error checking performed, minimum required code to elucidate logic
- mEGL = (EGL10) EGLContext.getEGL();
- mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
- mEGL.eglInitialize(mEGLDisplay, version);
- mEGLConfig = chooseConfig(); // Choosing a config is a little more complicated
- mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, ctx_attribs);
- mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
- mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
- mGL = (GL10) mEGLContext.getGL();
-
- // Record thread owner of OpenGL context
- mThreadOwner = Thread.currentThread().getName();
- }
-
- public String getVersion()
- {
- return mGL.glGetString(GL10.GL_VERSION);
- }
-
- public String getVendor()
- {
- return mGL.glGetString(GL10.GL_VENDOR);
- }
-
- public String getRenderer()
- {
- return mGL.glGetString(GL10.GL_RENDERER);
- }
-
- private EGLConfig chooseConfig()
- {
- int[] attribList = new int[] {
- EGL10.EGL_DEPTH_SIZE, 0,
- EGL10.EGL_STENCIL_SIZE, 0,
- EGL10.EGL_RED_SIZE, 8,
- EGL10.EGL_GREEN_SIZE, 8,
- EGL10.EGL_BLUE_SIZE, 8,
- EGL10.EGL_ALPHA_SIZE, 8,
- EGL10.EGL_NONE
- };
-
- // No error checking performed, minimum required code to elucidate logic
- // Expand on this logic to be more selective in choosing a configuration
- int[] numConfig = new int[1];
- mEGL.eglChooseConfig(mEGLDisplay, attribList, null, 0, numConfig);
- int configSize = numConfig[0];
- mEGLConfigs = new EGLConfig[configSize];
- mEGL.eglChooseConfig(mEGLDisplay, attribList, mEGLConfigs, configSize, numConfig);
-
- return mEGLConfigs[0]; // Best match is probably the first configuration
- }
- }
-
- static public boolean SupportsGLES3()
- {
- VersionCheck mbuffer = new VersionCheck();
- String m_GLVersion = mbuffer.getVersion();
- String m_GLVendor = mbuffer.getVendor();
- String m_GLRenderer = mbuffer.getRenderer();
-
- boolean mSupportsGLES3 = false;
-
- // Check for OpenGL ES 3 support (General case).
- 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 != null && m_GLVendor.equals("Qualcomm"))
- {
- if (m_GLRenderer.contains("Adreno (TM) 3"))
- {
- int mVStart = m_GLVersion.indexOf("V@") + 2;
- int mVEnd = 0;
- float mVersion;
-
- for (int a = mVStart; a < m_GLVersion.length(); ++a)
- {
- if (m_GLVersion.charAt(a) == ' ')
- {
- mVEnd = a;
- break;
- }
- }
-
- mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd));
-
- if (mVersion >= 14.0f)
- mSupportsGLES3 = true;
- }
- }
- return mSupportsGLES3;
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState)
- {
- super.onCreate(savedInstanceState);
-
- // Load the preferences from an XML resource
- addPreferencesFromResource(R.xml.prefs);
-
- 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"))
- {
- cpuCores.setEntries(R.array.emuCoreEntriesX86);
- cpuCores.setEntryValues(R.array.emuCoreValuesX86);
- }
- else if (Build.CPU_ABI.contains("arm"))
- {
- cpuCores.setEntries(R.array.emuCoreEntriesARM);
- cpuCores.setEntryValues(R.array.emuCoreValuesARM);
- }
- else
- {
- cpuCores.setEntries(R.array.emuCoreEntriesOther);
- cpuCores.setEntryValues(R.array.emuCoreValuesOther);
- }
-
- //
- // Setting valid video backends.
- //
- final ListPreference videoBackends = (ListPreference) findPreference("gpuPref");
- final boolean deviceSupportsGLES3 = SupportsGLES3();
-
- if (deviceSupportsGLES3)
- {
- videoBackends.setEntries(R.array.videoBackendEntriesGLES3);
- videoBackends.setEntryValues(R.array.videoBackendValuesGLES3);
- }
- else
- {
- videoBackends.setEntries(R.array.videoBackendEntriesNoGLES3);
- videoBackends.setEntryValues(R.array.videoBackendValuesNoGLES3);
- }
- }
-
- @Override
- public void onAttach(Activity activity)
- {
- super.onAttach(activity);
-
- // This makes sure that the container activity has implemented
- // the callback interface. If not, it throws an exception
- try
- {
- m_activity = activity;
- }
- catch (ClassCastException e)
- {
- throw new ClassCastException(activity.toString()
- + " must implement OnGameListZeroListener");
- }
- }
-
- @Override
- public void onDestroy()
- {
- super.onDestroy();
-
- // 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/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
similarity index 95%
rename from Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
index bd41c75093..3dc0b4fbb4 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.folderbrowser;
import android.app.Activity;
import android.app.Fragment;
@@ -14,6 +14,10 @@ import android.widget.Toast;
import java.io.File;
import java.util.*;
+import org.dolphinemu.dolphinemu.NativeLibrary;
+import org.dolphinemu.dolphinemu.R;
+import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
+
public final class FolderBrowser extends Fragment
{
private Activity m_activity;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java
similarity index 96%
rename from Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java
index f7596600b7..3d8ce2d4b3 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java
@@ -1,4 +1,6 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.folderbrowser;
+
+import java.util.List;
import android.content.Context;
import android.view.LayoutInflater;
@@ -8,7 +10,7 @@ import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;
-import java.util.List;
+import org.dolphinemu.dolphinemu.R;
public final class FolderBrowserAdapter extends ArrayAdapter
{
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java
similarity index 98%
rename from Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java
index 5fd9bd5ad1..1184b4889c 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.folderbrowser;
import java.io.File;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
similarity index 90%
rename from Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
index 08736b7360..8e460527ff 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
@@ -1,8 +1,9 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.gamelist;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
+import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
@@ -13,6 +14,17 @@ import android.widget.ListView;
import java.util.ArrayList;
import java.util.List;
+import org.dolphinemu.dolphinemu.AboutFragment;
+import org.dolphinemu.dolphinemu.NativeLibrary;
+import org.dolphinemu.dolphinemu.R;
+import org.dolphinemu.dolphinemu.folderbrowser.FolderBrowser;
+import org.dolphinemu.dolphinemu.inputconfig.InputConfigAdapter;
+import org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment;
+import org.dolphinemu.dolphinemu.inputconfig.InputConfigItem;
+import org.dolphinemu.dolphinemu.settings.PrefsActivity;
+import org.dolphinemu.dolphinemu.sidemenu.SideMenuAdapter;
+import org.dolphinemu.dolphinemu.sidemenu.SideMenuItem;
+
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
@@ -144,11 +156,9 @@ public final class GameListActivity extends Activity
break;
case 2:
- {
- mCurFragmentNum = 2;
- mCurFragment = new PrefsFragment();
- FragmentManager fragmentManager = getFragmentManager();
- fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
+ {
+ Intent intent = new Intent(this, PrefsActivity.class);
+ startActivity(intent);
}
break;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java
similarity index 96%
rename from Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java
index d683741c79..1944733723 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.gamelist;
import android.content.Context;
import android.view.LayoutInflater;
@@ -10,6 +10,8 @@ import android.widget.TextView;
import java.util.List;
+import org.dolphinemu.dolphinemu.R;
+
public final class GameListAdapter extends ArrayAdapter
{
private final Context c;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
similarity index 97%
rename from Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
index 8464eaea9c..945fb64acb 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.gamelist;
import android.app.Activity;
import android.app.Fragment;
@@ -19,6 +19,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import org.dolphinemu.dolphinemu.NativeLibrary;
+import org.dolphinemu.dolphinemu.R;
+
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java
similarity index 95%
rename from Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java
index 10f44f69e4..9634eb5fa1 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.gamelist;
import android.content.Context;
import android.graphics.Bitmap;
@@ -8,6 +8,8 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import org.dolphinemu.dolphinemu.NativeLibrary;
+
public final class GameListItem implements Comparable
{
private String name;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java
similarity index 94%
rename from Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java
index 12541b8b37..a02c97c343 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.inputconfig;
import android.content.Context;
import android.view.LayoutInflater;
@@ -9,6 +9,8 @@ import android.widget.TextView;
import java.util.List;
+import org.dolphinemu.dolphinemu.R;
+
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java
similarity index 97%
rename from Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java
index 530f8b1d3b..00794f3ea0 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.inputconfig;
import android.app.Activity;
import android.app.Fragment;
@@ -13,6 +13,9 @@ import android.widget.Toast;
import java.util.ArrayList;
import java.util.List;
+import org.dolphinemu.dolphinemu.R;
+import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
+
/**
* Copyright 2013 Dolphin Emulator Project
* Licensed under GPLv2
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java
similarity index 95%
rename from Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java
index 70e68261ec..71b557dcc3 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java
@@ -4,7 +4,9 @@
* Refer to the license.txt file included.
*/
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.inputconfig;
+
+import org.dolphinemu.dolphinemu.NativeLibrary;
/**
* Represents a controller input item (button, stick, etc).
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java
new file mode 100644
index 0000000000..a50b094338
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java
@@ -0,0 +1,81 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.settings;
+
+import org.dolphinemu.dolphinemu.R;
+
+import android.app.Activity;
+import android.os.Build;
+import android.os.Bundle;
+import android.preference.ListPreference;
+import android.preference.PreferenceFragment;
+
+/**
+ * Responsible for the loading of the CPU preferences.
+ */
+public final class CPUSettingsFragment extends PreferenceFragment
+{
+ private Activity m_activity;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.cpu_prefs);
+
+ 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"))
+ {
+ cpuCores.setEntries(R.array.emuCoreEntriesX86);
+ cpuCores.setEntryValues(R.array.emuCoreValuesX86);
+ }
+ else if (Build.CPU_ABI.contains("arm"))
+ {
+ cpuCores.setEntries(R.array.emuCoreEntriesARM);
+ cpuCores.setEntryValues(R.array.emuCoreValuesARM);
+ }
+ else
+ {
+ cpuCores.setEntries(R.array.emuCoreEntriesOther);
+ cpuCores.setEntryValues(R.array.emuCoreValuesOther);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity)
+ {
+ super.onAttach(activity);
+
+ // This makes sure that the container activity has implemented
+ // the callback interface. If not, it throws an exception
+ try
+ {
+ m_activity = activity;
+ }
+ catch (ClassCastException e)
+ {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnGameListZeroListener");
+ }
+ }
+
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+
+ // When this fragment is destroyed, force the settings to be saved to the ini file.
+ UserPreferences.SaveConfigToDolphinIni(m_activity);
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java
new file mode 100644
index 0000000000..8186ffc05e
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java
@@ -0,0 +1,146 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.settings;
+
+import org.dolphinemu.dolphinemu.R;
+
+import android.app.ActionBar;
+import android.app.ActionBar.Tab;
+import android.app.Activity;
+import android.app.Fragment;
+import android.app.FragmentManager;
+import android.app.FragmentTransaction;
+import android.os.Bundle;
+import android.support.v13.app.FragmentPagerAdapter;
+import android.support.v4.view.ViewPager;
+
+/**
+ * Main activity that manages all of the preference fragments used to display
+ * the settings to the user.
+ */
+public final class PrefsActivity extends Activity implements ActionBar.TabListener
+{
+ /**
+ * The {@link android.support.v4.view.PagerAdapter} that will provide org.dolphinemu.dolphinemu.settings for each of the
+ * sections. We use a {@link android.support.v4.app.FragmentPagerAdapter} derivative, which will
+ * keep every loaded fragment in memory. If this becomes too memory intensive, it may be best to
+ * switch to a {@link android.support.v4.app.FragmentStatePagerAdapter}.
+ */
+ SectionsPagerAdapter mSectionsPagerAdapter;
+
+ /**
+ * The {@link ViewPager} that will host the section contents.
+ */
+ ViewPager mViewPager;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.prefs_viewpager);
+
+ // Set up the action bar.
+ final ActionBar actionBar = getActionBar();
+ actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
+
+ // Create the adapter that will return a fragment for each of the three
+ // primary sections of the app.
+ mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager());
+
+ // Set up the ViewPager with the sections adapter.
+ mViewPager = (ViewPager) findViewById(R.id.pager);
+ mViewPager.setAdapter(mSectionsPagerAdapter);
+
+ // When swiping between different sections, select the corresponding
+ // tab. We can also use ActionBar.Tab#select() to do this if we have
+ // a reference to the Tab.
+ mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener()
+ {
+ @Override
+ public void onPageSelected(int position)
+ {
+ actionBar.setSelectedNavigationItem(position);
+ }
+ } );
+
+ // Create a tab with text corresponding to the page title defined by
+ // the adapter. Also specify this Activity object, which implements
+ // the TabListener interface, as the callback (listener) for when
+ // this tab is selected.
+ actionBar.addTab(actionBar.newTab().setText(R.string.cpu_settings).setTabListener(this));
+ actionBar.addTab(actionBar.newTab().setText(R.string.video_settings).setTabListener(this));
+
+ }
+
+ public void onTabReselected(Tab arg0, FragmentTransaction arg1)
+ {
+ // Do nothing.
+ }
+
+ public void onTabSelected(Tab tab, FragmentTransaction ft)
+ {
+ // When the given tab is selected, switch to the corresponding page in the ViewPager.
+ mViewPager.setCurrentItem(tab.getPosition());
+ }
+
+ public void onTabUnselected(Tab tab, FragmentTransaction ft)
+ {
+ // Do nothing.
+ }
+
+ /**
+ * A {@link FragmentPagerAdapter} that returns a fragment corresponding to one of the
+ * sections/tabs/pages.
+ */
+ public class SectionsPagerAdapter extends FragmentPagerAdapter
+ {
+
+ public SectionsPagerAdapter(FragmentManager fm)
+ {
+ super(fm);
+ }
+
+ @Override
+ public Fragment getItem(int position)
+ {
+ switch(position)
+ {
+ case 0:
+ return new CPUSettingsFragment();
+
+ case 1:
+ return new VideoSettingsFragment();
+
+ default: // Should never happen.
+ return null;
+ }
+ }
+
+ @Override
+ public int getCount()
+ {
+ // Show total pages.
+ return 2;
+ }
+
+ @Override
+ public CharSequence getPageTitle(int position)
+ {
+ switch(position)
+ {
+ case 0:
+ return getString(R.string.cpu_settings).toUpperCase();
+
+ case 1:
+ return getString(R.string.video_settings).toUpperCase();
+
+ default: // Should never happen.
+ return null;
+ }
+ }
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java
similarity index 98%
rename from Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java
index 80e8b9dfdc..0bf8535492 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/UserPreferences.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java
@@ -1,4 +1,12 @@
-package org.dolphinemu.dolphinemu;
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.settings;
+
+import org.dolphinemu.dolphinemu.NativeLibrary;
import android.content.Context;
import android.content.SharedPreferences;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java
new file mode 100644
index 0000000000..fcb04134ad
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java
@@ -0,0 +1,202 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.settings;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.egl.EGLSurface;
+import javax.microedition.khronos.opengles.GL10;
+
+import org.dolphinemu.dolphinemu.R;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.preference.ListPreference;
+import android.preference.PreferenceFragment;
+
+/**
+ * Responsible for handling the loading of the video preferences.
+ */
+public final class VideoSettingsFragment extends PreferenceFragment
+{
+ private Activity m_activity;
+
+ static public class VersionCheck
+ {
+ EGL10 mEGL;
+ EGLDisplay mEGLDisplay;
+ EGLConfig[] mEGLConfigs;
+ EGLConfig mEGLConfig;
+ EGLContext mEGLContext;
+ EGLSurface mEGLSurface;
+ GL10 mGL;
+
+ String mThreadOwner;
+
+ public VersionCheck()
+ {
+ int[] version = new int[2];
+ int[] attribList = new int[] {
+ EGL10.EGL_WIDTH, 1,
+ EGL10.EGL_HEIGHT, 1,
+ EGL10.EGL_RENDERABLE_TYPE, 4,
+ EGL10.EGL_NONE
+ };
+ int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+ int[] ctx_attribs = new int[] {
+ EGL_CONTEXT_CLIENT_VERSION, 2,
+ EGL10.EGL_NONE
+ };
+
+ // No error checking performed, minimum required code to elucidate logic
+ mEGL = (EGL10) EGLContext.getEGL();
+ mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
+ mEGL.eglInitialize(mEGLDisplay, version);
+ mEGLConfig = chooseConfig(); // Choosing a config is a little more complicated
+ mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT, ctx_attribs);
+ mEGLSurface = mEGL.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, attribList);
+ mEGL.eglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext);
+ mGL = (GL10) mEGLContext.getGL();
+
+ // Record thread owner of OpenGL context
+ mThreadOwner = Thread.currentThread().getName();
+ }
+
+ public String getVersion()
+ {
+ return mGL.glGetString(GL10.GL_VERSION);
+ }
+
+ public String getVendor()
+ {
+ return mGL.glGetString(GL10.GL_VENDOR);
+ }
+
+ public String getRenderer()
+ {
+ return mGL.glGetString(GL10.GL_RENDERER);
+ }
+
+ private EGLConfig chooseConfig()
+ {
+ int[] attribList = new int[] {
+ EGL10.EGL_DEPTH_SIZE, 0,
+ EGL10.EGL_STENCIL_SIZE, 0,
+ EGL10.EGL_RED_SIZE, 8,
+ EGL10.EGL_GREEN_SIZE, 8,
+ EGL10.EGL_BLUE_SIZE, 8,
+ EGL10.EGL_ALPHA_SIZE, 8,
+ EGL10.EGL_NONE
+ };
+
+ // No error checking performed, minimum required code to elucidate logic
+ // Expand on this logic to be more selective in choosing a configuration
+ int[] numConfig = new int[1];
+ mEGL.eglChooseConfig(mEGLDisplay, attribList, null, 0, numConfig);
+ int configSize = numConfig[0];
+ mEGLConfigs = new EGLConfig[configSize];
+ mEGL.eglChooseConfig(mEGLDisplay, attribList, mEGLConfigs, configSize, numConfig);
+
+ return mEGLConfigs[0]; // Best match is probably the first configuration
+ }
+ }
+
+ static public boolean SupportsGLES3()
+ {
+ VersionCheck mbuffer = new VersionCheck();
+ String m_GLVersion = mbuffer.getVersion();
+ String m_GLVendor = mbuffer.getVendor();
+ String m_GLRenderer = mbuffer.getRenderer();
+
+ boolean mSupportsGLES3 = false;
+
+ // Check for OpenGL ES 3 support (General case).
+ 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 != null && m_GLVendor.equals("Qualcomm"))
+ {
+ if (m_GLRenderer.contains("Adreno (TM) 3"))
+ {
+ int mVStart = m_GLVersion.indexOf("V@") + 2;
+ int mVEnd = 0;
+ float mVersion;
+
+ for (int a = mVStart; a < m_GLVersion.length(); ++a)
+ {
+ if (m_GLVersion.charAt(a) == ' ')
+ {
+ mVEnd = a;
+ break;
+ }
+ }
+
+ mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd));
+
+ if (mVersion >= 14.0f)
+ mSupportsGLES3 = true;
+ }
+ }
+ return mSupportsGLES3;
+ }
+
+ @Override
+ public void onCreate(Bundle savedInstanceState)
+ {
+ super.onCreate(savedInstanceState);
+
+ // Load the preferences from an XML resource
+ addPreferencesFromResource(R.xml.video_prefs);
+
+ //
+ // Setting valid video backends.
+ //
+ final ListPreference videoBackends = (ListPreference) findPreference("gpuPref");
+ final boolean deviceSupportsGLES3 = SupportsGLES3();
+
+ if (deviceSupportsGLES3)
+ {
+ videoBackends.setEntries(R.array.videoBackendEntriesGLES3);
+ videoBackends.setEntryValues(R.array.videoBackendValuesGLES3);
+ }
+ else
+ {
+ videoBackends.setEntries(R.array.videoBackendEntriesNoGLES3);
+ videoBackends.setEntryValues(R.array.videoBackendValuesNoGLES3);
+ }
+ }
+
+ @Override
+ public void onAttach(Activity activity)
+ {
+ super.onAttach(activity);
+
+ // This makes sure that the container activity has implemented
+ // the callback interface. If not, it throws an exception
+ try
+ {
+ m_activity = activity;
+ }
+ catch (ClassCastException e)
+ {
+ throw new ClassCastException(activity.toString()
+ + " must implement OnGameListZeroListener");
+ }
+ }
+
+ @Override
+ public void onDestroy()
+ {
+ super.onDestroy();
+
+ // 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/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java
similarity index 94%
rename from Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java
index 11c071b026..4d4816e355 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java
@@ -1,4 +1,4 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.sidemenu;
import android.content.Context;
import android.view.LayoutInflater;
@@ -9,6 +9,8 @@ import android.widget.TextView;
import java.util.List;
+import org.dolphinemu.dolphinemu.R;
+
public final class SideMenuAdapter extends ArrayAdapter
{
private final Context c;
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java
similarity index 96%
rename from Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
rename to Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java
index 51ebc93c19..2b780dcbb2 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java
@@ -4,7 +4,7 @@
* Refer to the license.txt file included.
*/
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.sidemenu;
/**