summaryrefslogtreecommitdiff
path: root/Source/Android
diff options
context:
space:
mode:
authorMatthew Parlane <parlane@gmail.com>2013-08-23 00:51:12 +1200
committerMatthew Parlane <parlane@gmail.com>2013-08-23 00:51:12 +1200
commitb6e054a2beef3236822e27d95dfe38a4ccee2eb1 (patch)
tree6f744593b14def9c2fbc7be9e509df5507835cc4 /Source/Android
parentf274b3b074fb8bb0477b0e9f4e88db0e08bf4f2c (diff)
parent41c25d0c90a2461c3e34bf9659dcf1da5e1e8580 (diff)
Merge branch 'master' into wii-network
Conflicts: Source/Core/Core/Core.vcxproj Source/Core/Core/Core.vcxproj.filters Source/Core/Core/Src/CoreParameter.cpp Source/Core/DolphinWX/Dolphin.vcxproj Source/Core/DolphinWX/Dolphin.vcxproj.filters
Diffstat (limited to 'Source/Android')
-rw-r--r--Source/Android/.classpath2
-rw-r--r--Source/Android/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--Source/Android/AndroidManifest.xml51
-rw-r--r--Source/Android/custom_rules.xml2
-rw-r--r--Source/Android/res/drawable-hdpi/ic_menu_file.pngbin0 -> 510 bytes
-rw-r--r--Source/Android/res/drawable-hdpi/ic_menu_folder.pngbin0 -> 1449 bytes
-rw-r--r--Source/Android/res/drawable-mdpi/ic_menu_file.pngbin0 -> 487 bytes
-rw-r--r--Source/Android/res/drawable-mdpi/ic_menu_folder.pngbin0 -> 1312 bytes
-rw-r--r--Source/Android/res/drawable-xhdpi/ic_menu_file.pngbin0 -> 580 bytes
-rw-r--r--Source/Android/res/drawable-xhdpi/ic_menu_folder.pngbin0 -> 1617 bytes
-rw-r--r--Source/Android/res/layout/about_layout.xml22
-rw-r--r--Source/Android/res/layout/folderbrowser.xml76
-rw-r--r--Source/Android/res/layout/gamelist_layout.xml91
-rw-r--r--Source/Android/res/layout/prefs.xml24
-rw-r--r--Source/Android/res/layout/prefs_viewpager.xml6
-rw-r--r--Source/Android/res/layout/sidemenu.xml36
-rw-r--r--Source/Android/res/values-ja/strings.xml120
-rw-r--r--Source/Android/res/values/arrays.xml128
-rw-r--r--Source/Android/res/values/prefvalues.xml12
-rw-r--r--Source/Android/res/values/strings.xml113
-rw-r--r--Source/Android/res/xml/cpu_prefs.xml14
-rw-r--r--Source/Android/res/xml/video_prefs.xml132
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java43
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java179
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java58
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java55
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java76
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java56
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java56
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java71
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java24
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java211
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java49
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java36
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java (renamed from Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java)96
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java95
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java122
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java (renamed from Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java)183
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java80
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java (renamed from Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java)89
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java136
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java70
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java (renamed from Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java)157
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java101
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java80
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java144
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java235
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java225
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java67
-rw-r--r--Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java58
50 files changed, 2554 insertions, 1133 deletions
diff --git a/Source/Android/.classpath b/Source/Android/.classpath
index 3f9691c5dd..d3bb07b44c 100644
--- a/Source/Android/.classpath
+++ b/Source/Android/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
- <classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
+ <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
diff --git a/Source/Android/.settings/org.eclipse.jdt.core.prefs b/Source/Android/.settings/org.eclipse.jdt.core.prefs
index f77b31c2d2..b080d2ddc8 100644
--- a/Source/Android/.settings/org.eclipse.jdt.core.prefs
+++ b/Source/Android/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml
index a6918f867b..2ea38baf8d 100644
--- a/Source/Android/AndroidManifest.xml
+++ b/Source/Android/AndroidManifest.xml
@@ -2,47 +2,40 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.dolphinemu.dolphinemu"
android:versionCode="10"
- android:versionName="0.10" >
+ android:versionName="0.10"
+ android:installLocation="auto">
- <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="14"/>
-
- <uses-feature android:glEsVersion="0x00020000"></uses-feature>
- <uses-feature android:name="android.hardware.screen.landscape" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
- <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
-
- <application
+ <uses-sdk
+ android:minSdkVersion="14"
+ android:targetSdkVersion="14" />
+
+ <uses-feature android:glEsVersion="0x00020000" >
+ </uses-feature>
+ <uses-feature android:name="android.hardware.screen.landscape" />
+
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+ <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
+
+ <application
android:icon="@drawable/launcher"
- android:label="@string/app_name">
+ android:label="@string/app_name" >
<activity
- android:name=".DolphinEmulator"
+ android:name="org.dolphinemu.dolphinemu.DolphinEmulator"
+ android:configChanges="locale|keyboard|keyboardHidden|navigation|fontScale|uiMode"
android:label="@string/app_name"
- android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="landscape"
- android:configChanges="locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
+ android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
+
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
- <activity
- android:name="org.dolphinemu.dolphinemu.FolderBrowser"
- android:label="@string/app_name"
- android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
- </activity>
- <activity
- android:name=".InputConfigFragment"
- android:label="@string/app_name"
- android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
- </activity>
- <activity
- android:name=".PrefsFragment" >
- </activity>
- <activity
- android:name=".GameListActivity" >
+ <activity android:name="org.dolphinemu.dolphinemu.gamelist.GameListActivity" >
</activity>
<activity
- android:name=".AboutFragment" >
+ android:name="org.dolphinemu.dolphinemu.settings.PrefsActivity"
+ android:label="@string/settings" >
</activity>
</application>
diff --git a/Source/Android/custom_rules.xml b/Source/Android/custom_rules.xml
index e06de68e57..c19d48e25f 100644
--- a/Source/Android/custom_rules.xml
+++ b/Source/Android/custom_rules.xml
@@ -8,7 +8,7 @@
<copy todir="${jar.libs.dir}/armeabi-v7a">
<fileset
dir="../../libs/armeabi-v7a"
- includes="libdolphin-emu-nogui.so" />
+ includes="libmain.so" />
</copy>
</target>
<target name="clean" depends="android_rules.clean">
diff --git a/Source/Android/res/drawable-hdpi/ic_menu_file.png b/Source/Android/res/drawable-hdpi/ic_menu_file.png
new file mode 100644
index 0000000000..f204740905
--- /dev/null
+++ b/Source/Android/res/drawable-hdpi/ic_menu_file.png
Binary files differ
diff --git a/Source/Android/res/drawable-hdpi/ic_menu_folder.png b/Source/Android/res/drawable-hdpi/ic_menu_folder.png
new file mode 100644
index 0000000000..6f441b41da
--- /dev/null
+++ b/Source/Android/res/drawable-hdpi/ic_menu_folder.png
Binary files differ
diff --git a/Source/Android/res/drawable-mdpi/ic_menu_file.png b/Source/Android/res/drawable-mdpi/ic_menu_file.png
new file mode 100644
index 0000000000..dee2577897
--- /dev/null
+++ b/Source/Android/res/drawable-mdpi/ic_menu_file.png
Binary files differ
diff --git a/Source/Android/res/drawable-mdpi/ic_menu_folder.png b/Source/Android/res/drawable-mdpi/ic_menu_folder.png
new file mode 100644
index 0000000000..cc81e57f7e
--- /dev/null
+++ b/Source/Android/res/drawable-mdpi/ic_menu_folder.png
Binary files differ
diff --git a/Source/Android/res/drawable-xhdpi/ic_menu_file.png b/Source/Android/res/drawable-xhdpi/ic_menu_file.png
new file mode 100644
index 0000000000..85369c338e
--- /dev/null
+++ b/Source/Android/res/drawable-xhdpi/ic_menu_file.png
Binary files differ
diff --git a/Source/Android/res/drawable-xhdpi/ic_menu_folder.png b/Source/Android/res/drawable-xhdpi/ic_menu_folder.png
new file mode 100644
index 0000000000..78500a93c1
--- /dev/null
+++ b/Source/Android/res/drawable-xhdpi/ic_menu_folder.png
Binary files differ
diff --git a/Source/Android/res/layout/about_layout.xml b/Source/Android/res/layout/about_layout.xml
new file mode 100644
index 0000000000..c282fc0369
--- /dev/null
+++ b/Source/Android/res/layout/about_layout.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:orientation="vertical" >
+
+ <TextView
+ android:id="@+id/FolderTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="5dip"
+ android:layout_marginTop="5dip"
+ android:singleLine="true"
+ android:textStyle="bold" />
+
+ <TextView
+ android:id="@+id/FolderSubTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="10dip" />
+
+</LinearLayout> \ No newline at end of file
diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml
index 82b94e238f..d3ee4538fa 100644
--- a/Source/Android/res/layout/folderbrowser.xml
+++ b/Source/Android/res/layout/folderbrowser.xml
@@ -1,29 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="vertical" >
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:padding="3dip">
+
+ <ImageView
+ android:id="@+id/ImageIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+
+ android:layout_alignParentTop="true"
+ android:layout_alignParentBottom="true"
+ android:layout_marginRight="6dip"/>
- <TextView
- android:id="@+id/FolderTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- android:layout_marginTop="5dip"
- android:singleLine="true"
- android:text="Title"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/FolderSubTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:text="Subtitle" />
-
- </LinearLayout>
-</LinearLayout>
+ <TextView
+ android:id="@+id/FolderSubTitle"
+ android:layout_width="fill_parent"
+ android:layout_height="26dip"
+
+ android:layout_toRightOf="@id/ImageIcon"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true"
+
+ android:singleLine="true"
+ android:ellipsize="marquee"
+ android:text="Subtitle" />
+
+ <TextView
+ android:id="@+id/FolderTitle"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+
+ android:layout_toRightOf="@id/ImageIcon"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_above="@id/FolderSubTitle"
+ android:layout_alignWithParentIfMissing="true"
+
+ android:gravity="center_vertical"
+ android:text="Title"
+ android:textStyle="bold" />
+
+ <ImageView
+ android:src="@android:drawable/divider_horizontal_dark"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:scaleType="fitXY"
+ android:paddingLeft="5dp"
+ android:paddingRight="5dp"
+ android:paddingBottom="2dp"
+ android:paddingTop="2dp" />
+</RelativeLayout>
diff --git a/Source/Android/res/layout/gamelist_layout.xml b/Source/Android/res/layout/gamelist_layout.xml
index 16596c3cec..f27b5968a6 100644
--- a/Source/Android/res/layout/gamelist_layout.xml
+++ b/Source/Android/res/layout/gamelist_layout.xml
@@ -1,43 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- android:orientation="vertical" >
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <ImageView
- android:id="@+id/GameItemIcon"
- android:layout_width="96dp"
- android:layout_height="match_parent" />
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/GameItemTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- android:layout_marginTop="5dip"
- android:singleLine="true"
- android:text="@+id/TextView01"
- android:textStyle="bold" />
-
- <TextView
- android:id="@+id/GameItemSubText"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="10dip"
- android:text="@+id/TextView02" />
-
- </LinearLayout>
-
- </LinearLayout>
-
-</LinearLayout>
+ android:layout_height="?android:attr/listPreferredItemHeight"
+ android:padding="3dp" >
+
+ <ImageView
+ android:id="@+id/GameItemIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="fill_parent"
+
+ android:layout_alignParentTop="true"
+ android:layout_alignParentBottom="true"
+ android:layout_marginRight="6dip" />
+
+
+ <TextView
+ android:id="@+id/GameItemSubText"
+ android:layout_width="fill_parent"
+ android:layout_height="26dip"
+
+ android:layout_toRightOf="@id/GameItemIcon"
+ android:layout_alignParentBottom="true"
+ android:layout_alignParentRight="true"
+
+ android:singleLine="true"
+ android:ellipsize="marquee"/>
+
+ <TextView
+ android:id="@+id/GameItemTitle"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+
+ android:layout_toRightOf="@id/GameItemIcon"
+ android:layout_alignParentRight="true"
+ android:layout_alignParentTop="true"
+ android:layout_above="@id/GameItemSubText"
+ android:layout_alignWithParentIfMissing="true"
+
+ android:gravity="center_vertical"
+ android:textStyle="bold" />
+
+ <ImageView
+ android:src="@android:drawable/divider_horizontal_dark"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:scaleType="fitXY"
+ android:paddingLeft="5dp"
+ android:paddingRight="5dp"
+ android:paddingBottom="2dp"
+ android:paddingTop="2dp" />
+
+</RelativeLayout>
diff --git a/Source/Android/res/layout/prefs.xml b/Source/Android/res/layout/prefs.xml
deleted file mode 100644
index 34700f56b7..0000000000
--- a/Source/Android/res/layout/prefs.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
- >
- <PreferenceCategory
- android:summary="Settings"
- android:title="CPU Settings"
- android:key="cpuprefcat">
- <CheckBoxPreference
- android:key="dualcorepref"
- android:summary="On/Off"
- android:title="Dual Core" />
- </PreferenceCategory>
- <PreferenceCategory
- android:summary="Settings"
- android:title="Video Settings"
- android:key="videoprefcat">
- <ListPreference
- android:entries="@array/gpuOptions"
- android:entryValues="@array/gpuValues"
- android:key="gpupref"
- android:summary="Video backend to use"
- android:title="Video Backend" />
- </PreferenceCategory>
-</PreferenceScreen> \ No newline at end of file
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 @@
+<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:tools="http://schemas.android.com/tools"
+ android:id="@+id/pager"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ tools:context=".PrefsActivity" />
diff --git a/Source/Android/res/layout/sidemenu.xml b/Source/Android/res/layout/sidemenu.xml
index 76bc937489..2066f4b10b 100644
--- a/Source/Android/res/layout/sidemenu.xml
+++ b/Source/Android/res/layout/sidemenu.xml
@@ -1,31 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
android:gravity="left"
android:orientation="vertical" >
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content" >
-
- <LinearLayout
- android:layout_width="wrap_content"
- android:layout_height="match_parent"
- android:orientation="vertical" >
-
- <TextView
- android:id="@+id/SideMenuTitle"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginLeft="5dip"
- android:layout_marginTop="5dip"
- android:singleLine="true"
- android:text="@+id/TextView01"
- android:textAppearance="?android:attr/textAppearanceLarge"
- android:textStyle="bold" />
-
- </LinearLayout>
- </LinearLayout>
+ <TextView
+ android:id="@+id/SideMenuTitle"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginLeft="5dip"
+ android:layout_marginTop="5dip"
+ android:singleLine="true"
+ android:text="@+id/TextView01"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:textStyle="bold" />
</LinearLayout>
diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml
new file mode 100644
index 0000000000..9216a2ecdc
--- /dev/null
+++ b/Source/Android/res/values-ja/strings.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+ <!-- Title of the app -->
+ <string name="app_name">Dolphin Emulator</string>
+
+ <!-- Navigation-related Strings -->
+ <string name="drawer_open">ナビゲーションウィンドウを開く</string>
+ <string name="drawer_close">ナビゲーションウィンドウを閉じる</string>
+
+ <!-- About Fragment -->
+ <string name="build_revision">ビルドのバージョン:</string>
+ <string name="supports_gles3">サポートのOpenGL ES 3:</string>
+
+ <!-- Folder Browser -->
+ <string name="current_dir">現在のディレクトリ: </string>
+ <string name="parent_directory">親ディレクトリ</string>
+ <string name="folder">フォルダ</string>
+ <string name="file_size">ファイルサイズ: </string>
+ <string name="cant_use_compressed_filetypes">圧縮ファイル形式はサポートされていません</string>
+
+ <!-- Game List Activity -->
+ <string name="game_list">ゲームリスト</string>
+ <string name="browse_folder">フォルダの参照</string>
+ <string name="settings">設定</string>
+ <string name="gamepad_config">ゲームパッド設定</string>
+ <string name="about">について</string>
+
+ <!-- Game List Fragment -->
+ <string name="file_clicked">クリックされたファイル: </string>
+
+ <!-- Input Config Fragment -->
+ <string name="button_a">Aボタン</string>
+ <string name="button_b">Bボタン</string>
+ <string name="button_start">スタートボタン</string>
+ <string name="button_x">Xボタン</string>
+ <string name="button_y">Yボタン</string>
+ <string name="button_z">Zボタン</string>
+ <string name="dpad_up">D-Pad: ↑</string>
+ <string name="dpad_down">D-Pad: ↓</string>
+ <string name="dpad_left">D-Pad: ←</string>
+ <string name="dpad_right">D-Pad: →</string>
+ <string name="main_stick_up">コントロールスティック: ↑</string>
+ <string name="main_stick_down">コントロールスティック: ↓</string>
+ <string name="main_stick_left">コントロールスティック: ←</string>
+ <string name="main_stick_right">コントロールスティック: →</string>
+ <string name="c_stick_up">C-スティック: ↑</string>
+ <string name="c_stick_down">C-スティック: ↓</string>
+ <string name="c_stick_left">C-スティック: ←</string>
+ <string name="c_stick_right">C-スティック: →</string>
+ <string name="trigger_left">左のトリガー</string>
+ <string name="trigger_right">右のトリガー</string>
+ <string name="press_button_to_config">%1$sを設定するにはボタンを押して</string>
+
+ <!-- Prefs Fragment -->
+ <string name="interpreter">Interpreter</string>
+ <string name="jit64_recompiler">JIT64 Recompiler</string>
+ <string name="jitil_recompiler">JITIL Recompiler</string>
+ <string name="jit_arm_recompiler">JIT ARM Recompiler</string>
+ <string name="cpu_core">CPUコア</string>
+ <string name="cpu_settings">CPU設定</string>
+ <string name="emu_core_to_use">使用するエミュレーションコア</string>
+ <string name="dual_core">デュアルコア</string>
+ <string name="on_off">有効/無効</string>
+ <string name="video_settings">ビデオ設定</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_to_use">使用するビデオレンダラー</string>
+ <string name="draw_onscreen_controls">画面上のコントロールを描画</string>
+
+ <string name="enhancements">画質向上の設定</string>
+ <string name="internal_resolution">内部解像度の変更</string>
+ <string name="internal_resolution_descrip">内部解像度の計算方式を設定します。高解像度に設定することで大きく 画質が向上します。 しかし、ゲームによっては非常に重くなったり描画バグの原因となります。 【ゲーム解像度の倍数】は【ウィンドウサイズに拡大】より少し重くなり ますが、描画バグは発生しにくくなります。 また一般的に内部解像度が低いほど、動作速度は向上します。</string>
+ <string name="anisotropic_filtering">異方性フィルタリング</string>
+ <string name="anisotropic_filtering_descrip">異方性フィルタリングを適用します。 奥行きのあるテクスチャをより精細に描画することが出来ます。 特定のゲームでは描画バグの原因になることがあります。</string>
+ <string name="scaled_efb_copy">Scaled EFB Copy</string>
+ <string name="scaled_efb_copy_descrip">テクスチャエフェクトを表示するために作成されたテクスチャの品質を著しく向上させます。 特に高解像度出力時に効果が大きく出ます。 動作速度は少々低下し、まれに描画バグの原因にもなることもあります。</string>
+ <string name="per_pixel_lighting">Per-Pixel Lighting</string>
+ <string name="per_pixel_lighting_descrip">ピクセル単位での光源処理を行います。 GPUの性能にもよりますが、数パーセント程度、動作速度が低下します。 このオプションは通常安全ですが、時に描画バグを引き起こすこともあります</string>
+ <string name="force_texture_filtering">Force Texture Filtering</string>
+ <string name="force_texture_filtering_descrip">ゲーム側でフィルタ無効を明示している場面でも、強制的にフィルタリングを行います。 特に高解像度出力時にテクスチャが綺麗になりますが、いくつかのゲームで描画バグを引き起こします。</string>
+ <string name="disable_fog">霧を無効</string>
+ <string name="disable_fog_descrip">フォグ処理を無効化します。これにより遠景の高精細化が期待できます。いくつかのタイトルではフォグ処理に頼った画面効果が正しく表示 されなくなります。</string>
+
+ <string name="hacks">高速化(Hacks)</string>
+ <string name="embedded_frame_buffer">内蔵フレームバッファ</string>
+ <string name="skip_efb_access">CPUからEFBアクセスをスキップ</string>
+ <string name="skip_efb_access_descrip">EFBへの読み取り/書き込みにCPUから作られたすべての要求を無視。</string>
+ <string name="ignore_format_changes">フォーマットの変更を無視</string>
+ <string name="ignore_format_changes_descrip">EFB形式への変更を無視。</string>
+ <string name="efb_copy_method">EFBコピー方法</string>
+ <string name="efb_copy_method_descrip">EFBコピーをエミュレート方法を決定。</string>
+ <string name="efb_copy_texture">テクスチャ</string>
+ <string name="efb_copy_ram_uncached">RAM (キャッシュない)</string>
+ <string name="efb_copy_ram_cached">RAM (キャッシュ)</string>
+ <string name="texture_cache">テクスチャキャッシュ</string>
+ <string name="texture_cache_accuracy">テクスチャキャッシュ確度</string>
+ <string name="texture_cache_accuracy_descrip">この選択をSafe設定しておくと、RAMからのテクスチャ更新に 失敗しにくなります。</string>
+ <string name="texture_cache_accuracy_low">低</string>
+ <string name="texture_cache_accuracy_medium">平</string>
+ <string name="texture_cache_accuracy_high">高</string>
+ <string name="external_frame_buffer">外部フレームバッファ</string>
+ <string name="external_frame_buffer_descrip">XFBをエミュレート方法を決定。</string>
+ <string name="external_frame_buffer_virtual">バーチャル</string>
+ <string name="external_frame_buffer_real">実機</string>
+ <string name="cache_display_lists">Cache Display Lists</string>
+ <string name="cache_display_lists_descrip">ディスプレイリストをキャッシュすることによりエミュレーション速度を向上。</string>
+ <string name="disable_destination_alpha">Disable Destination Alpha</string>
+ <string name="disable_destination_alpha_descrip">多くのタイトルで画面効果に使用されている、アルファ透過処理をスキップ 。</string>
+ <string name="fast_depth_calculation">高速奥行き計算</string>
+ <string name="fast_depth_calculation_descrip">深度値を計算するために精度の低いアルゴリズムを使用します。</string>
+
+ <!-- Miscellaneous -->
+ <string name="yes">はい</string>
+ <string name="no">いいえ</string>
+ <string name="disabled">無効</string>
+ <string name="other">その他</string>
+
+</resources>
diff --git a/Source/Android/res/values/arrays.xml b/Source/Android/res/values/arrays.xml
new file mode 100644
index 0000000000..2144440a33
--- /dev/null
+++ b/Source/Android/res/values/arrays.xml
@@ -0,0 +1,128 @@
+<?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" translatable="false">
+ <item>@string/software_renderer</item>
+ </string-array>
+ <string-array name="videoBackendValuesNoGLES3" translatable="false">
+ <item>Software Renderer</item>
+ </string-array>
+
+
+ <!-- EFB Copy Method Preference -->
+ <string-array name="efbCopyMethodEntries" translatable="false">
+ <item>@string/disabled</item>
+ <item>@string/efb_copy_texture</item>
+ <item>@string/efb_copy_ram_uncached</item>
+ <item>@string/efb_copy_ram_cached</item>
+ </string-array>
+ <string-array name="efbCopyMethodValues" translatable="false">
+ <item>Off</item>
+ <item>Texture</item>
+ <item>RAM (cached)</item>
+ <item>RAM (uncached)</item>
+ </string-array>
+
+ <!-- Texture Cache Accuracy Preference -->
+ <string-array name="textureCacheAccuracyEntries" translatable="false">
+ <item>@string/texture_cache_accuracy_low</item>
+ <item>@string/texture_cache_accuracy_medium</item>
+ <item>@string/texture_cache_accuracy_high</item>
+ </string-array>
+ <string-array name="textureCacheAccuracyValues" translatable="false">
+ <item>128</item>
+ <item>512</item>
+ <item>0</item>
+ </string-array>
+
+ <!-- External Frame Buffer Preference -->
+ <string-array name="externalFrameBufferEntries" translatable="false">
+ <item>@string/disabled</item>
+ <item>@string/external_frame_buffer_virtual</item>
+ <item>@string/external_frame_buffer_real</item>
+ </string-array>
+ <string-array name="externalFrameBufferValues" translatable="false">
+ <item>Disabled</item>
+ <item>Virtual</item>
+ <item>Real</item>
+ </string-array>
+
+ <!-- Internal Resolution Preference -->
+ <string-array name="internalResolutionEntries" translatable="false">
+ <item>1x Native (640x528)</item>
+ <item>1.5x Native (960x792)</item>
+ <item>2x Native (1280x1056)</item>
+ <item>2.5x Native (1600x1320)</item>
+ <item>3x Native (1920x1584)</item>
+ <item>4x Native (2560x2112)</item>
+ </string-array>
+ <string-array name="internalResolutionValues" translatable="false">
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ <item>5</item>
+ <item>6</item>
+ <item>7</item>
+ </string-array>
+
+ <!-- Anisotropic Filtering Preference -->
+ <string-array name="anisotropicFilteringEntries" translatable="false">
+ <item>1x</item>
+ <item>2x</item>
+ <item>4x</item>
+ <item>8x</item>
+ <item>16x</item>
+ </string-array>
+ <string-array name="anisotropicFilteringValues" translatable="false">
+ <item>0</item>
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ </string-array>
+
+</resources> \ No newline at end of file
diff --git a/Source/Android/res/values/prefvalues.xml b/Source/Android/res/values/prefvalues.xml
deleted file mode 100644
index 409666e328..0000000000
--- a/Source/Android/res/values/prefvalues.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string-array name="gpuOptions">
- <item>Software Renderer</item>
- <item>OpenGL ES 3</item>
- </string-array>
-
- <string-array name="gpuValues">
- <item>Software Renderer</item>
- <item>OGL</item>
- </string-array>
-</resources> \ No newline at end of file
diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml
index 40a14e3b4e..50bacda5df 100644
--- a/Source/Android/res/values/strings.xml
+++ b/Source/Android/res/values/strings.xml
@@ -1,8 +1,121 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
+ <!-- Title of the app -->
<string name="app_name">Dolphin Emulator</string>
+
+ <!-- Navigation-related Strings -->
<string name="drawer_open">Open navigation drawer</string>
<string name="drawer_close">Close navigation drawer</string>
+ <!-- About Fragment -->
+ <string name="build_revision">Build Revision:</string>
+ <string name="supports_gles3">Supports OpenGL ES 3:</string>
+
+ <!-- Folder Browser -->
+ <string name="current_dir">Current Dir: </string>
+ <string name="parent_directory">Parent Directory</string>
+ <string name="folder">Folder</string>
+ <string name="file_size">File Size: </string>
+ <string name="cant_use_compressed_filetypes">Can not use compressed file types</string>
+
+ <!-- Game List Activity -->
+ <string name="game_list">Game List</string>
+ <string name="browse_folder">Browse Folder</string>
+ <string name="settings">Settings</string>
+ <string name="gamepad_config">Gamepad Config</string>
+ <string name="about">About</string>
+
+ <!-- Game List Fragment -->
+ <string name="file_clicked">File clicked: </string>
+
+ <!-- Input Config Fragment -->
+ <string name="button_a">Button A</string>
+ <string name="button_b">Button B</string>
+ <string name="button_start">Button Start</string>
+ <string name="button_x">Button X</string>
+ <string name="button_y">Button Y</string>
+ <string name="button_z">Button Z</string>
+ <string name="dpad_up">D-Pad Up</string>
+ <string name="dpad_down">D-Pad Down</string>
+ <string name="dpad_left">D-Pad Left</string>
+ <string name="dpad_right">D-Pad Right</string>
+ <string name="main_stick_up">Main Stick Up</string>
+ <string name="main_stick_down">Main Stick Down</string>
+ <string name="main_stick_left">Main Stick Left</string>
+ <string name="main_stick_right">Main Stick Right</string>
+ <string name="c_stick_up">C Stick Up</string>
+ <string name="c_stick_down">C Stick Down</string>
+ <string name="c_stick_left">C Stick Left</string>
+ <string name="c_stick_right">C Stick Right</string>
+ <string name="trigger_left">Trigger L</string>
+ <string name="trigger_right">Trigger R</string>
+ <string name="press_button_to_config">Press button to configure %1$s</string>
+
+ <!-- Preference Related -->
+ <string name="interpreter">Interpreter</string>
+ <string name="jit64_recompiler">JIT64 Recompiler</string>
+ <string name="jitil_recompiler">JITIL Recompiler</string>
+ <string name="jit_arm_recompiler">JIT ARM Recompiler</string>
+ <string name="cpu_core">CPU Core</string>
+ <string name="cpu_settings">CPU Settings</string>
+ <string name="emu_core_to_use">Emulation core to use</string>
+ <string name="dual_core">Dual Core</string>
+ <string name="on_off">On/Off</string>
+ <string name="video_settings">Video Settings</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_to_use">Video backend to use</string>
+ <string name="draw_onscreen_controls">Draw on-screen controls</string>
+
+ <string name="enhancements">Enhancements</string>
+ <string name="internal_resolution">Internal Resolution</string>
+ <string name="internal_resolution_descrip">Specifies the resolution used to render at. A high resolution will improve visual quality a lot but is also quite heavy on performance and might cause glitches in certain games.</string>
+ <string name="anisotropic_filtering">Anisotropic Filtering</string>
+ <string name="anisotropic_filtering_descrip">Enhances visual quality of textures that are at oblique viewing angles. Might cause issues in a small number of games.</string>
+ <string name="scaled_efb_copy">Scaled EFB Copy</string>
+ <string name="scaled_efb_copy_descrip">Greatly increases quality of textures generated using render to texture effects. Raising the internal resolution will improve the effect of this setting. Slightly decreases performance and possibly causes issues (although unlikely).</string>
+ <string name="per_pixel_lighting">Per-Pixel Lighting</string>
+ <string name="per_pixel_lighting_descrip">Calculate lighting of 3D graphics per-pixel rather than per vertex. Decreases emulation speed by some percent (depending on your GPU). This usually is a safe enhancement, but might cause issues sometimes.</string>
+ <string name="force_texture_filtering">Force Texture Filtering</string>
+ <string name="force_texture_filtering_descrip">Force texture filtering even if the emulated game explicitly disabled it. Improves texture quality slightly but causes glitches in some games.</string>
+ <string name="disable_fog">Disable Fog</string>
+ <string name="disable_fog_descrip">Makes distant objects more visible by removing fog, thus increasing the overall detail. Disabling fog will break some games which rely on proper fog emulation.</string>
+
+ <string name="hacks">Hacks</string>
+ <string name="embedded_frame_buffer">Embedded Frame Buffer</string>
+ <string name="skip_efb_access">Skip EFB Access from CPU</string>
+ <string name="skip_efb_access_descrip">Ignore any requests from the CPU to read/write to the EFB.</string>
+ <string name="ignore_format_changes">Ignore Format Changes</string>
+ <string name="ignore_format_changes_descrip">Ignore any changes to the EFB format.</string>
+ <string name="efb_copy_method">EFB Copy Method</string>
+ <string name="efb_copy_method_descrip">Determines how EFB copies will be emulated.</string>
+ <string name="efb_copy_texture">Texture</string>
+ <string name="efb_copy_ram_uncached">RAM (uncached)</string>
+ <string name="efb_copy_ram_cached">RAM (cached)</string>
+ <string name="texture_cache">Texture Cache</string>
+ <string name="texture_cache_accuracy">Texture Cache Accuracy</string>
+ <string name="texture_cache_accuracy_descrip">The safer the selection, the less likely the emulator will be missing any texture updates from RAM.</string>
+ <string name="texture_cache_accuracy_low">Low</string>
+ <string name="texture_cache_accuracy_medium">Medium</string>
+ <string name="texture_cache_accuracy_high">High</string>
+ <string name="external_frame_buffer">External Frame Buffer</string>
+ <string name="external_frame_buffer_descrip">Determines how the XFB will be emulated.</string>
+ <string name="external_frame_buffer_virtual">Virtual</string>
+ <string name="external_frame_buffer_real">Real</string>
+ <string name="cache_display_lists">Cache Display Lists</string>
+ <string name="cache_display_lists_descrip">Speeds up emulation a bit by caching display lists.</string>
+ <string name="disable_destination_alpha">Disable Destination Alpha</string>
+ <string name="disable_destination_alpha_descrip">Disables emulation of a hardware feature called destination alpha, which is used in many games for various effects.</string>
+ <string name="fast_depth_calculation">Fast Depth Calculation</string>
+ <string name="fast_depth_calculation_descrip">Uses a less accurate algorithm to calculate depth values.</string>
+
+ <!-- Miscellaneous -->
+ <string name="yes">Yes</string>
+ <string name="no">No</string>
+ <string name="disabled">Disabled</string>
+ <string name="other">Other</string>
+
+
</resources>
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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <!-- CPU Settings -->
+ <CheckBoxPreference
+ android:key="dualCorePref"
+ android:summary="@string/on_off"
+ android:title="@string/dual_core" />
+
+ <ListPreference
+ android:key="cpuCorePref"
+ android:summary="@string/emu_core_to_use"
+ android:title="@string/cpu_core" />
+
+</PreferenceScreen> \ 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..ec0c1837f7
--- /dev/null
+++ b/Source/Android/res/xml/video_prefs.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <!-- Video Settings -->
+
+
+ <!-- Video Enhancements -->
+ <PreferenceScreen android:title="@string/enhancements">
+
+ <ListPreference
+ android:entries="@array/internalResolutionEntries"
+ android:entryValues="@array/internalResolutionValues"
+ android:key="internalResolution"
+ android:summary="@string/internal_resolution_descrip"
+ android:title="@string/internal_resolution"/>
+
+ <ListPreference
+ android:entries="@array/anisotropicFilteringEntries"
+ android:entryValues="@array/anisotropicFilteringValues"
+ android:key="anisotropicFiltering"
+ android:summary="@string/anisotropic_filtering_descrip"
+ android:title="@string/anisotropic_filtering"/>
+
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="scaledEFBCopy"
+ android:summary="@string/scaled_efb_copy_descrip"
+ android:title="@string/scaled_efb_copy"/>
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="perPixelLighting"
+ android:summary="@string/per_pixel_lighting_descrip"
+ android:title="@string/per_pixel_lighting"/>
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="forceTextureFiltering"
+ android:summary="@string/force_texture_filtering_descrip"
+ android:title="@string/force_texture_filtering"/>
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="disableFog"
+ android:summary="@string/disable_fog_descrip"
+ android:title="@string/disable_fog"/>
+
+ </PreferenceScreen>
+
+ <!-- Video Hacks -->
+ <PreferenceScreen android:title="@string/hacks">
+ <PreferenceCategory android:title="@string/embedded_frame_buffer">
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="skipEFBAccess"
+ android:summary="@string/skip_efb_access_descrip"
+ android:title="@string/skip_efb_access"/>
+
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="ignoreFormatChanges"
+ android:summary="@string/ignore_format_changes_descrip"
+ android:title="@string/ignore_format_changes"/>
+
+ <ListPreference
+ android:defaultValue="Texture"
+ android:entries="@array/efbCopyMethodEntries"
+ android:entryValues="@array/efbCopyMethodValues"
+ android:key="efbCopyMethod"
+ android:summary="@string/efb_copy_method_descrip"
+ android:title="@string/efb_copy_method"/>
+
+ </PreferenceCategory>
+
+ <!-- Texture Cache -->
+ <PreferenceCategory android:title="@string/texture_cache">
+ <ListPreference
+ android:defaultValue="Low"
+ android:entries="@array/textureCacheAccuracyEntries"
+ android:entryValues="@array/textureCacheAccuracyValues"
+ android:key="textureCacheAccuracy"
+ android:summary="@string/texture_cache_accuracy_descrip"
+ android:title="@string/texture_cache_accuracy"/>
+ </PreferenceCategory>
+
+ <!-- External Frame Buffer -->
+ <PreferenceCategory android:title="@string/external_frame_buffer">
+ <ListPreference
+ android:defaultValue="Disabled"
+ android:entries="@array/externalFrameBufferEntries"
+ android:entryValues="@array/externalFrameBufferValues"
+ android:key="externalFrameBuffer"
+ android:summary="@string/external_frame_buffer_descrip"
+ android:title="@string/external_frame_buffer"/>
+ </PreferenceCategory>
+
+
+ <!-- Other Hacks -->
+ <PreferenceCategory android:title="@string/other">
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="cacheDisplayLists"
+ android:summary="@string/cache_display_lists_descrip"
+ android:title="@string/cache_display_lists"/>
+
+ <CheckBoxPreference
+ android:defaultValue="false"
+ android:key="disableDestinationAlpha"
+ android:summary="@string/disable_destination_alpha_descrip"
+ android:title="@string/disable_destination_alpha"/>
+
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="fastDepthCalculation"
+ android:summary="@string/fast_depth_calculation_descrip"
+ android:title="@string/fast_depth_calculation"/>
+
+ </PreferenceCategory>
+ </PreferenceScreen>
+
+ <ListPreference
+ android:key="gpuPref"
+ android:summary="@string/video_backend_to_use"
+ android:title="@string/video_backend" />
+
+ <CheckBoxPreference
+ android:defaultValue="true"
+ android:key="drawOnscreenControls"
+ android:title="@string/draw_onscreen_controls"/>
+</PreferenceScreen> \ 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 5c47b79a3e..41e347a697 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java
@@ -11,50 +11,53 @@ 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
* Refer to the license.txt file included.
*/
-public class AboutFragment extends Fragment {
+public final class AboutFragment extends Fragment
+{
private static Activity m_activity;
-
private ListView mMainList;
-
private FolderBrowserAdapter adapter;
- private int configPosition = 0;
- boolean Configuring = false;
- boolean firstEvent = true;
-
- public AboutFragment() {
- // Empty constructor required for fragment subclasses
- }
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
+ {
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
mMainList = (ListView) rootView.findViewById(R.id.gamelist);
+
+ String yes = getString(R.string.yes);
+ String no = getString(R.string.no);
- List<GameListItem> Input = new ArrayList<GameListItem>();
- int a = 0;
+ List<FolderBrowserItem> Input = new ArrayList<FolderBrowserItem>();
+ Input.add(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true));
+ Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, "", true));
- Input.add(a++, new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true));
- Input.add(a++, new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true));
- adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, Input);
+ adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input);
mMainList.setAdapter(adapter);
return mMainList;
}
+
@Override
- public void onAttach(Activity activity) {
+ 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 {
+ try
+ {
m_activity = activity;
- } catch (ClassCastException e) {
+ }
+ catch (ClassCastException e)
+ {
throw new ClassCastException(activity.toString()
+ " must implement OnGameListZeroListener");
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
index a883cd7b49..b708b756b5 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java
@@ -3,10 +3,8 @@ package org.dolphinemu.dolphinemu;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
-import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Environment;
-import android.preference.PreferenceManager;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.InputDevice;
@@ -17,39 +15,48 @@ import android.view.WindowManager;
import java.io.*;
import java.util.List;
-public class DolphinEmulator<MainActivity> extends Activity
-{
- static private NativeGLSurfaceView GLview = null;
- static private boolean Running = false;
-
+import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
+import org.dolphinemu.dolphinemu.inputconfig.InputConfigFragment;
+import org.dolphinemu.dolphinemu.settings.UserPreferences;
+
+public final class DolphinEmulator<MainActivity> extends Activity
+{
+ private static NativeGLSurfaceView GLview = null;
+ private static boolean Running = false;
+
private float screenWidth;
private float screenHeight;
- private void CopyAsset(String asset, String output) {
- InputStream in = null;
- OutputStream out = null;
- try {
- in = getAssets().open(asset);
- out = new FileOutputStream(output);
- copyFile(in, out);
- in.close();
- in = null;
- out.flush();
- out.close();
- out = null;
- } catch(IOException e) {
- Log.e("tag", "Failed to copy asset file: " + asset, e);
- }
+ private void CopyAsset(String asset, String output)
+ {
+ InputStream in = null;
+ OutputStream out = null;
+
+ try
+ {
+ in = getAssets().open(asset);
+ out = new FileOutputStream(output);
+ copyFile(in, out);
+ in.close();
+ out.close();
+ }
+ catch (IOException e)
+ {
+ Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e);
+ }
}
- private void copyFile(InputStream in, OutputStream out) throws IOException {
- byte[] buffer = new byte[1024];
- int read;
- while((read = in.read(buffer)) != -1){
- out.write(buffer, 0, read);
- }
+ private void copyFile(InputStream in, OutputStream out) throws IOException
+ {
+ byte[] buffer = new byte[1024];
+ int read;
+
+ while ((read = in.read(buffer)) != -1)
+ {
+ out.write(buffer, 0, read);
+ }
}
-
+
@Override
public void onStop()
{
@@ -57,6 +64,7 @@ public class DolphinEmulator<MainActivity> extends Activity
if (Running)
NativeLibrary.StopEmulation();
}
+
@Override
public void onPause()
{
@@ -64,6 +72,7 @@ public class DolphinEmulator<MainActivity> extends Activity
if (Running)
NativeLibrary.PauseEmulation();
}
+
@Override
public void onResume()
{
@@ -72,21 +81,21 @@ public class DolphinEmulator<MainActivity> extends Activity
NativeLibrary.UnPauseEmulation();
}
- /** Called when the activity is first created. */
+ /** Called when the activity is first created. */
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState)
+ {
super.onCreate(savedInstanceState);
if (savedInstanceState == null)
{
-
Intent ListIntent = new Intent(this, GameListActivity.class);
startActivityForResult(ListIntent, 1);
-
+
// Make the assets directory
String BaseDir = Environment.getExternalStorageDirectory()+File.separator+"dolphin-emu";
File directory = new File(BaseDir);
directory.mkdirs();
-
+
String ConfigDir = BaseDir + File.separator + "Config";
directory = new File(ConfigDir);
directory.mkdirs();
@@ -95,50 +104,31 @@ public class DolphinEmulator<MainActivity> extends Activity
directory = new File(GCDir);
directory.mkdirs();
+ String WiiDir = BaseDir + File.separator + "Wii";
+ directory = new File(WiiDir);
+ directory.mkdirs();
+
// Copy assets if needed
- java.io.File file = new java.io.File(
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_coef.bin");
+ File file = new File(WiiDir + File.separator + "setting-usa.txt");
if(!file.exists())
{
- CopyAsset("ButtonA.png",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "ButtonA.png");
- CopyAsset("ButtonB.png",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "ButtonB.png");
- CopyAsset("ButtonStart.png",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "ButtonStart.png");
- CopyAsset("NoBanner.png",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "NoBanner.png");
- CopyAsset("GCPadNew.ini",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "Config" + File.separator + "GCPadNew.ini");
- CopyAsset("Dolphin.ini",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "Config" + File.separator + "Dolphin.ini");
- CopyAsset("dsp_coef.bin",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_coef.bin");
- CopyAsset("dsp_rom.bin",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "GC" + File.separator + "dsp_rom.bin");
- CopyAsset("font_ansi.bin",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "GC" + File.separator + "font_ansi.bin");
- CopyAsset("font_sjis.bin",
- Environment.getExternalStorageDirectory()+File.separator+
- "dolphin-emu" + File.separator + "GC" + File.separator + "font_sjis.bin");
-
- 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.commit();
+ CopyAsset("ButtonA.png", BaseDir + File.separator + "ButtonA.png");
+ CopyAsset("ButtonB.png", BaseDir + File.separator + "ButtonB.png");
+ CopyAsset("ButtonStart.png", BaseDir + File.separator + "ButtonStart.png");
+ CopyAsset("NoBanner.png", BaseDir + File.separator + "NoBanner.png");
+ CopyAsset("GCPadNew.ini", ConfigDir + File.separator + "GCPadNew.ini");
+ CopyAsset("Dolphin.ini", ConfigDir + File.separator + "Dolphin.ini");
+ CopyAsset("dsp_coef.bin", GCDir + File.separator + "dsp_coef.bin");
+ CopyAsset("dsp_rom.bin", GCDir + File.separator + "dsp_rom.bin");
+ CopyAsset("font_ansi.bin", GCDir + File.separator + "font_ansi.bin");
+ CopyAsset("font_sjis.bin", GCDir + File.separator + "font_sjis.bin");
+ CopyAsset("setting-eur.txt", WiiDir + File.separator + "setting-eur.txt");
+ CopyAsset("setting-jpn.txt", WiiDir + File.separator + "setting-jpn.txt");
+ CopyAsset("setting-kor.txt", WiiDir + File.separator + "setting-kor.txt");
+ CopyAsset("setting-usa.txt", WiiDir + File.separator + "setting-usa.txt");
}
+
+ UserPreferences.LoadDolphinConfigToPrefs(this);
}
}
@@ -154,30 +144,25 @@ public class DolphinEmulator<MainActivity> extends Activity
wm.getDefaultDisplay().getMetrics(displayMetrics);
screenWidth = displayMetrics.widthPixels;
screenHeight = displayMetrics.heightPixels;
-
+
String FileName = data.getStringExtra("Select");
GLview = new NativeGLSurfaceView(this);
this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
String backend = NativeLibrary.GetConfig("Dolphin.ini", "Core", "GFXBackend", "Software Renderer");
- if (backend.equals("OGL"))
- GLview.SetDimensions(screenHeight, screenWidth);
- else
- GLview.SetDimensions(screenWidth, screenHeight);
- GLview.SetFileName(FileName);
+ NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
+ NativeLibrary.SetFilename(FileName);
setContentView(GLview);
Running = true;
}
}
-
+
@Override
public boolean onTouchEvent(MotionEvent event)
{
- float X, Y;
- int Action;
- X = event.getX();
- Y = event.getY();
- Action = event.getActionMasked();
-
+ float X = event.getX();
+ float Y = event.getY();
+ int Action = event.getActionMasked();
+
// Converts button locations 0 - 1 to OGL screen coords -1.0 - 1.0
float ScreenX = ((X / screenWidth) * 2.0f) - 1.0f;
float ScreenY = ((Y / screenHeight) * -2.0f) + 1.0f;
@@ -189,7 +174,8 @@ public class DolphinEmulator<MainActivity> extends Activity
// Gets button presses
@Override
- public boolean dispatchKeyEvent(KeyEvent event) {
+ public boolean dispatchKeyEvent(KeyEvent event)
+ {
int action = 0;
// Special catch for the back key
@@ -211,7 +197,8 @@ public class DolphinEmulator<MainActivity> extends Activity
if (Running)
{
- switch (event.getAction()) {
+ switch (event.getAction())
+ {
case KeyEvent.ACTION_DOWN:
action = 0;
break;
@@ -229,21 +216,21 @@ public class DolphinEmulator<MainActivity> extends Activity
}
@Override
- public boolean dispatchGenericMotionEvent(MotionEvent event) {
- if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running) {
+ public boolean dispatchGenericMotionEvent(MotionEvent event)
+ {
+ if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running)
+ {
return super.dispatchGenericMotionEvent(event);
}
InputDevice input = event.getDevice();
List<InputDevice.MotionRange> motions = input.getMotionRanges();
- for (int a = 0; a < motions.size(); ++a)
+
+ for (InputDevice.MotionRange range : motions)
{
- InputDevice.MotionRange range;
- range = motions.get(a);
NativeLibrary.onGamePadMoveEvent(InputConfigFragment.getInputDesc(input), range.getAxis(), event.getAxisValue(range.getAxis()));
}
return true;
}
-
-} \ No newline at end of file
+} \ No newline at end of file
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java
deleted file mode 100644
index 30c1747781..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import java.util.List;
-
-public class FolderBrowserAdapter extends ArrayAdapter<GameListItem>{
-
- private Context c;
- private int id;
- private List<GameListItem>items;
-
- public FolderBrowserAdapter(Context context, int textViewResourceId,
- List<GameListItem> objects) {
- super(context, textViewResourceId, objects);
- c = context;
- id = textViewResourceId;
- items = objects;
- }
-
- public GameListItem getItem(int i)
- {
- return items.get(i);
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (v == null) {
- LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = vi.inflate(id, null);
- }
- final GameListItem o = items.get(position);
- if (o != null) {
- TextView t1 = (TextView) v.findViewById(R.id.FolderTitle);
- TextView t2 = (TextView) v.findViewById(R.id.FolderSubTitle);
-
- if(t1!=null)
- {
- t1.setText(o.getName());
- if (!o.isValid())
- t1.setTextColor(0xFFFF0000);
- }
- if(t2!=null)
- t2.setText(o.getData());
-
- }
- return v;
- }
-
-
-
-}
-
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java
deleted file mode 100644
index 986f33555b..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListAdapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import java.util.List;
-
-public class GameListAdapter extends ArrayAdapter<GameListItem>{
-
- private Context c;
- private int id;
- private List<GameListItem>items;
-
- public GameListAdapter(Context context, int textViewResourceId, List<GameListItem> objects) {
- super(context, textViewResourceId, objects);
- c = context;
- id = textViewResourceId;
- items = objects;
- }
-
- public GameListItem getItem(int i)
- {
- return items.get(i);
- }
-
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (v == null) {
- LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = vi.inflate(id, null);
- }
-
- final GameListItem o = items.get(position);
- if (o != null) {
- TextView t1 = (TextView) v.findViewById(R.id.GameItemTitle);
- TextView t2 = (TextView) v.findViewById(R.id.GameItemSubText);
- ImageView v1 = (ImageView) v.findViewById(R.id.GameItemIcon);
-
- if(t1!=null)
- t1.setText(o.getName());
- if(t2!=null)
- t2.setText(o.getData());
- if(v1!=null)
- v1.setImageBitmap(o.getImage());
- }
- return v;
- }
-}
-
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java
deleted file mode 100644
index 427cd132f8..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListItem.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.content.Context;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-
-public class GameListItem implements Comparable<GameListItem>{
- private String name;
- private String data;
- private String path;
- private Bitmap image;
- private boolean m_valid;
-
- public GameListItem(Context ctx, String n,String d,String p, boolean valid)
- {
- name = n;
- data = d;
- path = p;
- m_valid = valid;
- File file = new File(path);
- if (!file.isDirectory() && !path.equals(""))
- {
- int[] Banner = NativeLibrary.GetBanner(path);
- if (Banner[0] == 0)
- {
- try {
- InputStream path = ctx.getAssets().open("NoBanner.png");
- image = BitmapFactory.decodeStream(path);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- else
- image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888);
- name = NativeLibrary.GetTitle(path);
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- public String getData()
- {
- return data;
- }
-
- public String getPath()
- {
- return path;
- }
- public Bitmap getImage()
- {
- return image;
- }
- public boolean isValid()
- {
- return m_valid;
- }
-
- public int compareTo(GameListItem o)
- {
- if(this.name != null)
- return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
- else
- throw new IllegalArgumentException();
- }
-}
-
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java
deleted file mode 100644
index b0984dd08a..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import java.util.List;
-
-/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
- */
-public class InputConfigAdapter extends ArrayAdapter<InputConfigItem> {
- private Context c;
- private int id;
- private List<InputConfigItem> items;
-
- public InputConfigAdapter(Context context, int textViewResourceId,
- List<InputConfigItem> objects) {
- super(context, textViewResourceId, objects);
- c = context;
- id = textViewResourceId;
- items = objects;
- }
-
- public InputConfigItem getItem(int i)
- {
- return items.get(i);
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (v == null) {
- LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = vi.inflate(id, null);
- }
- final InputConfigItem o = items.get(position);
- if (o != null) {
- TextView t1 = (TextView) v.findViewById(R.id.FolderTitle);
- TextView t2 = (TextView) v.findViewById(R.id.FolderSubTitle);
-
- if(t1!=null)
- t1.setText(o.getName());
- if(t2!=null)
- t2.setText(o.getBind());
- }
- return v;
- }
-
-
-
-}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java
deleted file mode 100644
index 7511406dc9..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
- */
-public class InputConfigItem implements Comparable<InputConfigItem>{
- private String m_name;
- private String m_Config;
- private String m_bind;
-
- private void Init(String n, String c, String d)
- {
- m_name = n;
- m_Config = c;
- String ConfigValues[] = m_Config.split("-");
- String Key = ConfigValues[0];
- String Value = ConfigValues[1];
- m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, d);
- }
-
- public InputConfigItem(String n, String c, String d)
- {
- Init(n, c, d);
- }
-
- public InputConfigItem(String n, String c)
- {
- Init(n, c, "None");
- }
- public String getName()
- {
- return m_name;
- }
- public String getConfig()
- {
- return m_Config;
- }
- public String getBind()
- {
- return m_bind;
- }
- public void setBind(String b)
- {
- m_bind = b;
- }
-
- public int compareTo(InputConfigItem o)
- {
- if(this.m_name != null)
- return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
- else
- throw new IllegalArgumentException();
- }
-}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java
index 8a8041a08b..2e38d98fef 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeGLSurfaceView.java
@@ -4,58 +4,57 @@ import android.content.Context;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
-public class NativeGLSurfaceView extends SurfaceView {
- static private String FileName;
- static private Thread myRun;
- static private boolean Running = false;
- static private boolean Created = false;
- static private float width;
- static private float height;
+/**
+ * The surface that rendering is done to.
+ */
+public final class NativeGLSurfaceView extends SurfaceView
+{
+ private static Thread myRun;
+ private static boolean Running = false;
+ private static boolean Created = false;
- public NativeGLSurfaceView(Context context) {
+ /**
+ * Constructor.
+ *
+ * @param context The current {@link Context}.
+ */
+ public NativeGLSurfaceView(Context context)
+ {
super(context);
if (!Created)
{
myRun = new Thread()
{
@Override
- public void run() {
- NativeLibrary.Run(FileName, getHolder().getSurface(), (int)width, (int)height);
- }
+ public void run() {
+ NativeLibrary.Run(getHolder().getSurface());
+ }
};
- getHolder().addCallback(new SurfaceHolder.Callback() {
- public void surfaceCreated(SurfaceHolder holder) {
- // TODO Auto-generated method stub
- if (!Running)
- {
- myRun.start();
- Running = true;
- }
- }
- public void surfaceChanged(SurfaceHolder arg0, int arg1,
- int arg2, int arg3) {
+ getHolder().addCallback(new SurfaceHolder.Callback()
+ {
+ public void surfaceCreated(SurfaceHolder holder)
+ {
+ // TODO Auto-generated method stub
+ if (!Running)
+ {
+ myRun.start();
+ Running = true;
+ }
+ }
+
+ public void surfaceChanged(SurfaceHolder arg0, int arg1, int arg2, int arg3)
+ {
// TODO Auto-generated method stub
-
}
- public void surfaceDestroyed(SurfaceHolder arg0) {
+ public void surfaceDestroyed(SurfaceHolder arg0)
+ {
// TODO Auto-generated method stub
-
}
});
+
Created = true;
}
}
-
- public void SetFileName(String file)
- {
- FileName = file;
- }
-
- public void SetDimensions(float screenWidth, float screenHeight)
- {
- width = screenWidth;
- height = screenHeight;
- }
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
index 499dc7867b..8622026b97 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java
@@ -1,24 +1,32 @@
+/*
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
package org.dolphinemu.dolphinemu;
import android.util.Log;
import android.view.Surface;
/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
+ * Class which contains methods that interact
+ * with the native side of the Dolphin code.
*/
-public class NativeLibrary {
+public final class NativeLibrary
+{
public static native void onTouchEvent(int Action, float X, float Y);
public static native void onGamePadEvent(String Device, int Button, int Action);
public static native void onGamePadMoveEvent(String Device, int Axis, float Value);
public static native String GetConfig(String configFile, String Key, String Value, String Default);
public static native void SetConfig(String configFile, String Key, String Value, String Default);
+ public static native void SetFilename(String filename);
+ public static native void SetDimensions(int width, int height);
public static native int[] GetBanner(String filename);
public static native String GetTitle(String filename);
public static native String GetVersionString();
- public static native void Run(String File, Surface surf, int width, int height);
+ public static native void Run(Surface surf);
public static native void UnPauseEmulation();
public static native void PauseEmulation();
public static native void StopEmulation();
@@ -27,11 +35,11 @@ public class NativeLibrary {
{
try
{
- System.loadLibrary("dolphin-emu-nogui");
+ System.loadLibrary("main");
}
- catch (Exception ex)
+ catch (UnsatisfiedLinkError ex)
{
- Log.w("me", ex.toString());
+ Log.w("NativeLibrary", ex.toString());
}
}
}
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 08ed852cdc..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java
+++ /dev/null
@@ -1,211 +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.PreferenceCategory;
-import android.preference.PreferenceFragment;
-
-import javax.microedition.khronos.egl.*;
-import javax.microedition.khronos.opengles.GL10;
-
-/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
- */
-public 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
- };
-
- // 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, null);
- 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()
- {
- String m_GLVersion;
- String m_GLVendor;
- String m_GLRenderer;
-
- VersionCheck mbuffer = new VersionCheck();
- m_GLVersion = mbuffer.getVersion();
- m_GLVendor = mbuffer.getVendor();
- m_GLRenderer = mbuffer.getRenderer();
-
- boolean mSupportsGLES3 = false;
-
- if (m_GLVersion.contains("OpenGL ES 3.0")) // 3.0 support
- mSupportsGLES3 = true;
- if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm"))
- {
- if (m_GLRenderer.contains("Adreno (TM) 3"))
- {
- int mVStart, mVEnd = 0;
- float mVersion;
- mVStart = m_GLVersion.indexOf("V@") + 2;
- 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.layout.prefs);
-
- final ListPreference etp = new ListPreference(m_activity);
- CharSequence[] _entries;
- CharSequence[] _entryvalues;
-
- if (Build.CPU_ABI.contains("x86"))
- {
- _entries = new CharSequence[] {
- "Interpreter",
- "JIT64 Recompiler",
- "JITIL Recompiler",
- };
- _entryvalues = new CharSequence[] {"0", "1", "2"};
- }
- else if (Build.CPU_ABI.contains("arm"))
- {
- _entries = new CharSequence[] {
- "Interpreter",
- "JIT ARM Recompiler",
- };
- _entryvalues = new CharSequence[] {"0", "3"};
- }
- else
- {
- _entries = new CharSequence[] {
- "Interpreter",
- };
- _entryvalues = new CharSequence[] {"0"};
- }
-
- etp.setEntries(_entries);
- etp.setEntryValues(_entryvalues);
- etp.setKey("cpupref");
- etp.setTitle("CPU Core");
- etp.setSummary("Emulation core to use");
-
- PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat");
- mCategory.addPreference(etp);
-
- boolean mSupportsGLES3 = SupportsGLES3();
-
- if (!mSupportsGLES3)
- {
- mCategory = (PreferenceCategory) findPreference("videoprefcat");
- ListPreference mPref = (ListPreference) findPreference("gpupref");
- mCategory.removePreference(mPref);
-
- final ListPreference videobackend = new ListPreference(m_activity);
-
- _entries = new CharSequence[] {
- "Software Renderer",
- };
- _entryvalues = new CharSequence[] {"Software Renderer"};
-
- videobackend.setKey("gpupref");
- videobackend.setTitle("Video Backend");
- videobackend.setSummary("Video backend to use");
-
- videobackend.setEntries(_entries);
- videobackend.setEntryValues(_entryvalues);
-
- mCategory.addPreference(videobackend);
- }
- }
-
- @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");
- }
- }
-}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java
deleted file mode 100644
index 599ce5007a..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-import android.content.Context;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-import java.util.List;
-
-public class SideMenuAdapter extends ArrayAdapter<SideMenuItem>{
-
- private Context c;
- private int id;
- private List<SideMenuItem>items;
-
- public SideMenuAdapter(Context context, int textViewResourceId,
- List<SideMenuItem> objects) {
- super(context, textViewResourceId, objects);
- c = context;
- id = textViewResourceId;
- items = objects;
- }
- public SideMenuItem getItem(int i)
- {
- return items.get(i);
- }
- @Override
- public View getView(int position, View convertView, ViewGroup parent) {
- View v = convertView;
- if (v == null) {
- LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- v = vi.inflate(id, null);
- }
- final SideMenuItem o = items.get(position);
- if (o != null) {
- TextView t1 = (TextView) v.findViewById(R.id.SideMenuTitle);
-
- if(t1!=null)
- t1.setText(o.getName());
- }
- return v;
- }
-
-
-
-}
-
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
deleted file mode 100644
index e24842bed1..0000000000
--- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.dolphinemu.dolphinemu;
-
-/**
- * Copyright 2013 Dolphin Emulator Project
- * Licensed under GPLv2
- * Refer to the license.txt file included.
- */
-
-public class SideMenuItem implements Comparable<SideMenuItem>{
- private String m_name;
- private int m_id;
-
- public SideMenuItem(String n, int id)
- {
- m_name = n;
- m_id = id;
- }
-
- public String getName()
- {
- return m_name;
- }
- public int getID()
- {
- return m_id;
- }
-
- public int compareTo(SideMenuItem o)
- {
- if(this.m_name != null)
- return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
- else
- throw new IllegalArgumentException();
- }
-}
-
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
index 9094486197..2895196ff7 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java
@@ -1,9 +1,10 @@
-package org.dolphinemu.dolphinemu;
+package org.dolphinemu.dolphinemu.folderbrowser;
import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.os.Environment;
+import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -14,7 +15,25 @@ import android.widget.Toast;
import java.io.File;
import java.util.*;
-public class FolderBrowser extends Fragment {
+import org.dolphinemu.dolphinemu.NativeLibrary;
+import org.dolphinemu.dolphinemu.R;
+import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
+
+/**
+ * A basic folder browser {@link Fragment} that allows
+ * the user to select ISOs/ROMs for playing within the
+ * emulator.
+ * <p>
+ * Any valid ISO/ROM selected in this will be added to
+ * the game list for easy browsing the next time the
+ * application is used.
+ * <p>
+ * Note that invalid items will be shown in the color red. <br/>
+ * Also note that this file browser does not display files
+ * or directories that are hidden
+ */
+public final class FolderBrowser extends Fragment
+{
private Activity m_activity;
private FolderBrowserAdapter adapter;
private ListView mDrawerList;
@@ -23,45 +42,48 @@ public class FolderBrowser extends Fragment {
// Populates the FolderView with the given currDir's contents.
private void Fill(File currDir)
- {
- m_activity.setTitle("Current Dir: " + currDir.getName());
+ {
+ m_activity.setTitle(getString(R.string.current_dir) + currDir.getName());
File[] dirs = currDir.listFiles();
- List<GameListItem>dir = new ArrayList<GameListItem>();
- List<GameListItem>fls = new ArrayList<GameListItem>();
+ List<FolderBrowserItem>dir = new ArrayList<FolderBrowserItem>();
+ List<FolderBrowserItem>fls = new ArrayList<FolderBrowserItem>();
// Supported extensions to filter by
Set<String> validExts = new HashSet<String>(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf", ".dff"));
- Set<String> archiveExts = new HashSet<String>(Arrays.asList(".zip", ".rar", ".7z"));
+ Set<String> invalidExts = new HashSet<String>(Arrays.asList(".zip", ".rar", ".7z"));
- // Search for any directories or supported files within the current dir.
- try
+ // Search for any directories or files within the current dir.
+ for(File entry : dirs)
{
- for(File entry : dirs)
+ try
{
String entryName = entry.getName();
+ boolean hasExtension = (entryName.lastIndexOf(".") != -1);
+ // Skip hidden folders/files.
if (entryName.charAt(0) != '.')
{
if(entry.isDirectory())
{
- dir.add(new GameListItem(m_activity, entryName,"Folder",entry.getAbsolutePath(), true));
+ dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true));
}
- else
+ else if (entry.isFile() && hasExtension)
{
if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{
- fls.add(new GameListItem(m_activity, entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true));
+ fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), true));
}
- else if (archiveExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
+ else if (invalidExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
{
- fls.add(new GameListItem(m_activity, entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), false));
+ fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), false));
}
}
}
}
- }
- catch(Exception ignored)
- {
+ catch (Exception ex)
+ {
+ Log.e("Exception-FolderBrowser", ex.toString());
+ }
}
Collections.sort(dir);
@@ -70,16 +92,16 @@ public class FolderBrowser extends Fragment {
// Check for a parent directory to the one we're currently in.
if (!currDir.getPath().equalsIgnoreCase("/"))
- dir.add(0, new GameListItem(m_activity, "..", "Parent Directory", currDir.getParent(), true));
+ dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent(), true));
adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir);
- mDrawerList = (ListView) rootView.findViewById(R.id.gamelist);
- mDrawerList.setAdapter(adapter);
- mDrawerList.setOnItemClickListener(mMenuItemClickListener);
- }
+ mDrawerList = (ListView) rootView.findViewById(R.id.gamelist);
+ mDrawerList.setAdapter(adapter);
+ mDrawerList.setOnItemClickListener(mMenuItemClickListener);
+ }
+
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState)
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if(currentDir == null)
currentDir = new File(Environment.getExternalStorageDirectory().getPath());
@@ -94,33 +116,41 @@ public class FolderBrowser extends Fragment {
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
- GameListItem o = adapter.getItem(position);
- if(o.getData().equalsIgnoreCase("folder") || o.getData().equalsIgnoreCase("parent directory"))
+ FolderBrowserItem item = adapter.getItem(position);
+ if(item.isDirectory())
{
- currentDir = new File(o.getPath());
+ currentDir = new File(item.getPath());
Fill(currentDir);
}
else
- if (o.isValid())
+ {
+ if (item.isValid())
FolderSelected();
else
- Toast.makeText(m_activity, "Can not use compressed file types.", Toast.LENGTH_LONG).show();
+ Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show();
+ }
}
};
@Override
- public void onAttach(Activity activity) {
+ 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 {
+ try
+ {
m_activity = activity;
- } catch (ClassCastException e) {
+ }
+ catch (ClassCastException e)
+ {
throw new ClassCastException(activity.toString()
+ " must implement OnGameListZeroListener");
}
}
+
+
private void FolderSelected()
{
String Directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0");
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java
new file mode 100644
index 0000000000..e77205b527
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java
@@ -0,0 +1,95 @@
+package org.dolphinemu.dolphinemu.folderbrowser;
+
+import java.util.List;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import org.dolphinemu.dolphinemu.R;
+
+/**
+ * The {@link ArrayAdapter} that backs the file browser.
+ * <p>
+ * This is responsible for correctly handling the display
+ * of the items for the UI.
+ */
+public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
+{
+ private final Context c;
+ private final int id;
+ private final List<FolderBrowserItem> items;
+
+ public FolderBrowserAdapter(Context context, int textViewResourceId, List<FolderBrowserItem> objects)
+ {
+ super(context, textViewResourceId, objects);
+ c = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+
+ @Override
+ public FolderBrowserItem getItem(int i)
+ {
+ return items.get(i);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent)
+ {
+ View v = convertView;
+ if (v == null)
+ {
+ LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, parent, false);
+ }
+
+ final FolderBrowserItem item = items.get(position);
+ if (item != null)
+ {
+ ImageView iconView = (ImageView) v.findViewById(R.id.ImageIcon);
+ TextView mainText = (TextView) v.findViewById(R.id.FolderTitle);
+ TextView subtitleText = (TextView) v.findViewById(R.id.FolderSubTitle);
+
+ if(mainText != null)
+ {
+ mainText.setText(item.getName());
+
+ if (!item.isValid())
+ {
+ mainText.setTextColor(0xFFFF0000);
+ }
+ }
+
+ if(subtitleText != null)
+ {
+ // Remove the subtitle for all folders, except for the parent directory folder.
+ if (item.isDirectory() && !item.getSubtitle().equals(c.getResources().getString(R.string.parent_directory)))
+ {
+ subtitleText.setVisibility(View.GONE);
+ }
+ else
+ {
+ subtitleText.setText(item.getSubtitle());
+ }
+ }
+
+ if (iconView != null)
+ {
+ if (item.isDirectory())
+ {
+ iconView.setImageResource(R.drawable.ic_menu_folder);
+ }
+ else
+ {
+ iconView.setImageResource(R.drawable.ic_menu_file);
+ }
+ }
+ }
+ return v;
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java
new file mode 100644
index 0000000000..ebff901961
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java
@@ -0,0 +1,122 @@
+package org.dolphinemu.dolphinemu.folderbrowser;
+
+import java.io.File;
+
+/**
+ * Represents an item in the folder browser list.
+ */
+public final class FolderBrowserItem implements Comparable<FolderBrowserItem>
+{
+ private final String name;
+ private final String subtitle;
+ private final String path;
+ private final boolean isValid;
+ private final File underlyingFile;
+
+ /**
+ * Constructor
+ *
+ * @param name The name of the file/folder represented by this item.
+ * @param subtitle The subtitle of this FolderBrowserItem to display.
+ * @param path The path of the file/folder represented by this item.
+ * @param isValid Whether or not this item represents a file type that can be handled.
+ */
+ public FolderBrowserItem(String name, String subtitle, String path, boolean isValid)
+ {
+ this.name = name;
+ this.subtitle = subtitle;
+ this.path = path;
+ this.isValid = isValid;
+ this.underlyingFile = new File(path);
+ }
+
+ /**
+ * Constructor. Initializes a FolderBrowserItem with an empty subtitle.
+ *
+ * @param name The name of the file/folder represented by this item.
+ * @param path The path of the file/folder represented by this item.
+ * @param isValid Whether or not this item represents a file type that can be handled.
+ */
+ public FolderBrowserItem(String name, String path, boolean isValid)
+ {
+ this.name = name;
+ this.subtitle = "";
+ this.path = path;
+ this.isValid = isValid;
+ this.underlyingFile = new File(path);
+ }
+
+ /**
+ * Gets the name of the file/folder represented by this FolderBrowserItem.
+ *
+ * @return the name of the file/folder represented by this FolderBrowserItem.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the subtitle text of this FolderBrowserItem.
+ *
+ * @return the subtitle text of this FolderBrowserItem.
+ */
+ public String getSubtitle()
+ {
+ return subtitle;
+ }
+
+ /**
+ * Gets the path of the file/folder represented by this FolderBrowserItem.
+ *
+ * @return the path of the file/folder represented by this FolderBrowserItem.
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Gets whether or not the file represented
+ * by this FolderBrowserItem is supported
+ * and can be handled correctly.
+ *
+ * @return whether or not the file represented
+ * by this FolderBrowserItem is supported
+ * and can be handled correctly.
+ */
+ public boolean isValid()
+ {
+ return isValid;
+ }
+
+ /**
+ * Gets the {@link File} representation of the underlying file/folder
+ * represented by this FolderBrowserItem.
+ *
+ * @return the {@link File} representation of the underlying file/folder
+ * represented by this FolderBrowserItem.
+ */
+ public File getUnderlyingFile()
+ {
+ return underlyingFile;
+ }
+
+ /**
+ * Gets whether or not this FolderBrowserItem represents a directory.
+ *
+ * @return true if this FolderBrowserItem represents a directory, false otherwise.
+ */
+ public boolean isDirectory()
+ {
+ return underlyingFile.isDirectory();
+ }
+
+ public int compareTo(FolderBrowserItem other)
+ {
+ if(this.name != null)
+ return this.name.toLowerCase().compareTo(other.getName().toLowerCase());
+ else
+ throw new IllegalArgumentException();
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
index 9a48de4d8b..62a9f34189 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java
@@ -1,62 +1,88 @@
-package org.dolphinemu.dolphinemu;
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.gamelist;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
-import android.content.SharedPreferences;
+import android.content.Intent;
import android.content.res.Configuration;
import android.os.Bundle;
-import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.widget.DrawerLayout;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ListView;
-import android.widget.Toast;
-
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
- * Refer to the license.txt file included.
+ * The activity that implements all of the functions
+ * for the game list.
*/
-public class GameListActivity extends Activity
- implements GameListFragment.OnGameListZeroListener{
-
+public final class GameListActivity extends Activity
+ implements GameListFragment.OnGameListZeroListener
+{
private int mCurFragmentNum = 0;
private Fragment mCurFragment;
- enum keyTypes {TYPE_STRING, TYPE_BOOL};
private ActionBarDrawerToggle mDrawerToggle;
private DrawerLayout mDrawerLayout;
private SideMenuAdapter mDrawerAdapter;
private ListView mDrawerList;
+
+ /**
+ * Interface defining methods which handle
+ * the binding of specific key presses within
+ * the input mapping settings.
+ */
+ public interface OnGameConfigListener
+ {
+ boolean onMotionEvent(MotionEvent event);
+ boolean onKeyEvent(KeyEvent event);
+ }
- private static GameListActivity mMe;
-
- // Called from the game list fragment
+ /**
+ * Called from the {@link GameListFragment}.
+ * <p>
+ * This is called when there are no games
+ * currently present within the game list.
+ */
public void onZeroFiles()
{
mDrawerLayout.openDrawer(mDrawerList);
}
@Override
- protected void onCreate(Bundle savedInstanceState) {
+ protected void onCreate(Bundle savedInstanceState)
+ {
super.onCreate(savedInstanceState);
setContentView(R.layout.gamelist_activity);
- mMe = this;
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
mDrawerList = (ListView) findViewById(R.id.left_drawer);
List<SideMenuItem> dir = new ArrayList<SideMenuItem>();
- dir.add(new SideMenuItem("Game List", 0));
- dir.add(new SideMenuItem("Browse Folder", 1));
- dir.add(new SideMenuItem("Settings", 2));
- dir.add(new SideMenuItem("Gamepad Config", 3));
- dir.add(new SideMenuItem("About", 4));
+ dir.add(new SideMenuItem(getString(R.string.game_list), 0));
+ dir.add(new SideMenuItem(getString(R.string.browse_folder), 1));
+ dir.add(new SideMenuItem(getString(R.string.settings), 2));
+ dir.add(new SideMenuItem(getString(R.string.gamepad_config), 3));
+ dir.add(new SideMenuItem(getString(R.string.about), 4));
mDrawerAdapter = new SideMenuAdapter(this, R.layout.sidemenu, dir);
mDrawerList.setAdapter(mDrawerAdapter);
@@ -94,59 +120,25 @@ public class GameListActivity extends Activity
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
}
+
+ /**
+ * Switches to the {@link Fragment} represented
+ * by the given ID number.
+ *
+ * @param toPage the number representing the {@link Fragment} to switch to.l
+ */
public void SwitchPage(int toPage)
{
if (mCurFragmentNum == toPage)
return;
+
switch (mCurFragmentNum)
{
// Folder browser
case 1:
recreateFragment();
- break;
- // Settings
- case 2:
- {
- String Keys[] = {
- "cpupref",
- "dualcorepref",
- "gpupref",
- };
- String ConfigKeys[] = {
- "Core-CPUCore",
- "Core-CPUThread",
- "Core-GFXBackend",
- };
-
- keyTypes KeysTypes[] = {
- keyTypes.TYPE_STRING,
- keyTypes.TYPE_BOOL,
- keyTypes.TYPE_STRING,
- };
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
-
- // Set our preferences here
- for (int a = 0; a < Keys.length; ++a)
- {
- String ConfigValues[] = ConfigKeys[a].split("-");
- String Key = ConfigValues[0];
- String Value = ConfigValues[1];
-
- switch(KeysTypes[a])
- {
- case TYPE_STRING:
- String strPref = prefs.getString(Keys[a], "");
- NativeLibrary.SetConfig("Dolphin.ini", Key, Value, strPref);
- break;
- case TYPE_BOOL:
- boolean boolPref = prefs.getBoolean(Keys[a], true);
- NativeLibrary.SetConfig("Dolphin.ini", Key, Value, boolPref ? "True" : "False");
- break;
- }
+ break;
- }
- }
- break;
case 3: // Gamepad settings
{
InputConfigAdapter adapter = ((InputConfigFragment)mCurFragment).getAdapter();
@@ -162,11 +154,14 @@ public class GameListActivity extends Activity
}
}
break;
+
case 0: // Game List
+ case 2: // Settings
case 4: // About
- /* Do Nothing */
+ /* Do Nothing */
break;
}
+
switch(toPage)
{
case 0:
@@ -177,46 +172,46 @@ public class GameListActivity extends Activity
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
}
break;
+
case 1:
{
- Toast.makeText(mMe, "Loading up the browser", Toast.LENGTH_SHORT).show();
mCurFragmentNum = 1;
mCurFragment = new FolderBrowser();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
}
break;
+
case 2:
{
- Toast.makeText(mMe, "Loading up settings", Toast.LENGTH_SHORT).show();
- 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;
+
case 3:
{
- Toast.makeText(mMe, "Loading up gamepad config", Toast.LENGTH_SHORT).show();
mCurFragmentNum = 3;
mCurFragment = new InputConfigFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
}
break;
+
case 4:
{
- Toast.makeText(mMe, "Loading up About", Toast.LENGTH_SHORT).show();
mCurFragmentNum = 4;
mCurFragment = new AboutFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
}
break;
+
default:
break;
}
}
+
private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
@@ -226,64 +221,76 @@ public class GameListActivity extends Activity
SwitchPage(o.getID());
}
};
+
/**
* When using the ActionBarDrawerToggle, you must call it during
* onPostCreate() and onConfigurationChanged()...
*/
-
@Override
- protected void onPostCreate(Bundle savedInstanceState) {
+ protected void onPostCreate(Bundle savedInstanceState)
+ {
super.onPostCreate(savedInstanceState);
// Sync the toggle state after onRestoreInstanceState has occurred.
mDrawerToggle.syncState();
}
@Override
- public void onConfigurationChanged(Configuration newConfig) {
+ public void onConfigurationChanged(Configuration newConfig)
+ {
super.onConfigurationChanged(newConfig);
- // Pass any configuration change to the drawer toggls
+ // Pass any configuration change to the drawer toggle
mDrawerToggle.onConfigurationChanged(newConfig);
}
/* Called whenever we call invalidateOptionsMenu() */
@Override
- public boolean onPrepareOptionsMenu(Menu menu) {
+ public boolean onPrepareOptionsMenu(Menu menu)
+ {
return super.onPrepareOptionsMenu(menu);
}
@Override
- public boolean onOptionsItemSelected(MenuItem item) {
+ public boolean onOptionsItemSelected(MenuItem item)
+ {
// The action bar home/up action should open or close the drawer.
// ActionBarDrawerToggle will take care of this.
- if (mDrawerToggle.onOptionsItemSelected(item)) {
+ if (mDrawerToggle.onOptionsItemSelected(item))
+ {
return true;
}
+
return super.onOptionsItemSelected(item);
}
+
+ @Override
public void onBackPressed()
{
SwitchPage(0);
}
- public interface OnGameConfigListener {
- public boolean onMotionEvent(MotionEvent event);
- public boolean onKeyEvent(KeyEvent event);
- }
// Gets move(triggers, joystick) events
@Override
- public boolean dispatchGenericMotionEvent(MotionEvent event) {
+ public boolean dispatchGenericMotionEvent(MotionEvent event)
+ {
if (mCurFragmentNum == 3)
+ {
if (((OnGameConfigListener)mCurFragment).onMotionEvent(event))
return true;
+ }
+
return super.dispatchGenericMotionEvent(event);
}
+
// Gets button presses
@Override
- public boolean dispatchKeyEvent(KeyEvent event) {
+ public boolean dispatchKeyEvent(KeyEvent event)
+ {
if (mCurFragmentNum == 3)
+ {
if (((OnGameConfigListener)mCurFragment).onKeyEvent(event))
return true;
+ }
+
return super.dispatchKeyEvent(event);
}
-
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java
new file mode 100644
index 0000000000..1bc88e1255
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java
@@ -0,0 +1,80 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.gamelist;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import java.util.List;
+
+import org.dolphinemu.dolphinemu.R;
+
+/**
+ * The adapter backing the game list.
+ * <p>
+ * Responsible for handling each game list item individually.
+ */
+public final class GameListAdapter extends ArrayAdapter<GameListItem>
+{
+ private final Context c;
+ private final int id;
+ private final List<GameListItem>items;
+
+ public GameListAdapter(Context context, int textViewResourceId, List<GameListItem> objects)
+ {
+ super(context, textViewResourceId, objects);
+ c = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+
+ @Override
+ public GameListItem getItem(int i)
+ {
+ return items.get(i);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent)
+ {
+ View v = convertView;
+ if (v == null)
+ {
+ LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, parent, false);
+ }
+
+ final GameListItem item = items.get(position);
+ if (item != null)
+ {
+ TextView title = (TextView) v.findViewById(R.id.GameItemTitle);
+ TextView subtitle = (TextView) v.findViewById(R.id.GameItemSubText);
+ ImageView icon = (ImageView) v.findViewById(R.id.GameItemIcon);
+
+ if (title != null)
+ title.setText(item.getName());
+
+ if (subtitle != null)
+ subtitle.setText(item.getData());
+
+ if (icon != null)
+ {
+ icon.setImageBitmap(item.getImage());
+ icon.getLayoutParams().width = (int) ((860 / c.getResources().getDisplayMetrics().density) + 0.5);
+ icon.getLayoutParams().height = (int)((340 / c.getResources().getDisplayMetrics().density) + 0.5);
+ }
+ }
+
+ return v;
+ }
+}
+
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
index 152c18662b..d77741016b 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java
@@ -1,4 +1,10 @@
-package org.dolphinemu.dolphinemu;
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.gamelist;
import android.app.Activity;
import android.app.Fragment;
@@ -19,25 +25,33 @@ 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
- * Refer to the license.txt file included.
+ * The {@link Fragment} responsible for displaying the game list.
*/
-public class GameListFragment extends Fragment
+public final class GameListFragment extends Fragment
{
private ListView mMainList;
private GameListAdapter mGameAdapter;
private static GameListActivity mMe;
- OnGameListZeroListener mCallback;
+ private OnGameListZeroListener mCallback;
- public interface OnGameListZeroListener {
- public void onZeroFiles();
+ /**
+ * Interface that defines how to handle the case
+ * when there are zero game.
+ */
+ public interface OnGameListZeroListener
+ {
+ /**
+ * This is called when there are no games
+ * currently present within the game list.
+ */
+ void onZeroFiles();
}
- public GameListFragment() {
- // Empty constructor required for fragment subclasses
- }
private void Fill()
{
List<GameListItem> fls = new ArrayList<GameListItem>();
@@ -49,40 +63,58 @@ public class GameListFragment extends Fragment
for (int a = 0; a < intDirectories; ++a)
{
- String BrowseDir = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + Integer.toString(a), "");
+ String BrowseDir = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPath" + a, "");
File currentDir = new File(BrowseDir);
- File[]dirs = currentDir.listFiles();
+ File[] dirs = currentDir.listFiles();
try
{
- for(File entry : dirs)
+ for (File entry : dirs)
{
String entryName = entry.getName();
if (entryName.charAt(0) != '.')
{
- if(!entry.isDirectory())
+ if (!entry.isDirectory())
{
if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
- fls.add(new GameListItem(mMe.getApplicationContext(), entryName,"File Size: "+entry.length(),entry.getAbsolutePath(), true));
+ fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true));
}
}
}
}
- catch(Exception ignored)
+ catch (Exception ignored)
{
}
}
Collections.sort(fls);
+ // Remove any duplicate items from the list.
+ // We don't need to index these in the game list more than once.
+ //
+ // This works by comparing the paths of items in the file list for equality,
+ // so there should be no worries about accidentally removing a valid game.
+ for (int i = 0; i < fls.size(); i++)
+ {
+ int indexNext = i+1;
+
+ if (indexNext < fls.size() && fls.get(indexNext).getPath().contains(fls.get(i).getPath()))
+ {
+ fls.remove(indexNext);
+ }
+ }
+
mGameAdapter = new GameListAdapter(mMe, R.layout.gamelist_layout, fls);
mMainList.setAdapter(mGameAdapter);
- if (fls.size() == 0)
+
+ if (fls.isEmpty())
+ {
mCallback.onZeroFiles();
+ }
}
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
+ {
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
mMainList = (ListView) rootView.findViewById(R.id.gamelist);
mMainList.setOnItemClickListener(mGameItemClickListener);
@@ -91,36 +123,43 @@ public class GameListFragment extends Fragment
return mMainList;
}
+
private AdapterView.OnItemClickListener mGameItemClickListener = new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
GameListItem o = mGameAdapter.getItem(position);
- if(!(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")))
+ if (!(o.getData().equalsIgnoreCase(getString(R.string.folder))||o.getData().equalsIgnoreCase(getString(R.string.parent_directory))))
{
onFileClick(o.getPath());
}
}
};
+
private void onFileClick(String o)
{
- Toast.makeText(mMe, "File Clicked: " + o, Toast.LENGTH_SHORT).show();
+ Toast.makeText(mMe, getString(R.string.file_clicked) + o, Toast.LENGTH_SHORT).show();
Intent intent = new Intent();
intent.putExtra("Select", o);
mMe.setResult(Activity.RESULT_OK, intent);
mMe.finish();
}
+
@Override
- public void onAttach(Activity activity) {
+ 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 {
+ try
+ {
mCallback = (OnGameListZeroListener) activity;
mMe = (GameListActivity) activity;
- } catch (ClassCastException e) {
+ }
+ catch (ClassCastException e)
+ {
throw new ClassCastException(activity.toString()
+ " must implement OnGameListZeroListener");
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java
new file mode 100644
index 0000000000..16ba06a65a
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java
@@ -0,0 +1,136 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.gamelist;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.util.Log;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.dolphinemu.dolphinemu.NativeLibrary;
+
+/**
+ * Represents an item in the game list.
+ */
+public final class GameListItem implements Comparable<GameListItem>
+{
+ private String name;
+ private final String data;
+ private final String path;
+ private final boolean isValid;
+ private Bitmap image;
+
+ /**
+ * Constructor.
+ *
+ * @param ctx The current {@link Context}
+ * @param name The name of this GameListItem.
+ * @param data The subtitle for this GameListItem
+ * @param path The file path for the game represented by this GameListItem.
+ * @param isValid Whether or not the emulator can handle this file.
+ */
+ public GameListItem(Context ctx, String name, String data, String path, boolean isValid)
+ {
+ this.name = name;
+ this.data = data;
+ this.path = path;
+ this.isValid = isValid;
+
+ File file = new File(path);
+ if (!file.isDirectory() && !path.equals(""))
+ {
+ int[] Banner = NativeLibrary.GetBanner(path);
+ if (Banner[0] == 0)
+ {
+ try
+ {
+ // Open the no banner icon.
+ InputStream noBannerPath = ctx.getAssets().open("NoBanner.png");
+
+ // Decode the bitmap.
+ image = BitmapFactory.decodeStream(noBannerPath);
+
+ // Scale the bitmap to match other banners.
+ image = Bitmap.createScaledBitmap(image, 96, 32, false);
+ }
+ catch (IOException e)
+ {
+ Log.e("Exception-GameListItem", e.toString());
+ }
+ }
+ else
+ {
+ image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888);
+ }
+
+ this.name = NativeLibrary.GetTitle(path);
+ }
+ }
+
+ /**
+ * Gets the name of this GameListItem.
+ *
+ * @return the name of this GameListItem.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the subtitle of this GameListItem.
+ *
+ * @return the subtitle of this GameListItem.
+ */
+ public String getData()
+ {
+ return data;
+ }
+
+ /**
+ * Gets the file path of the game represented by this GameListItem.
+ *
+ * @return the file path of the game represented by this GameListItem.
+ */
+ public String getPath()
+ {
+ return path;
+ }
+
+ /**
+ * Gets the image data for this game as a {@link Bitmap}.
+ *
+ * @return the image data for this game as a {@link Bitmap}.
+ */
+ public Bitmap getImage()
+ {
+ return image;
+ }
+
+ /**
+ * Gets whether or not the emulator can handle this GameListItem.
+ *
+ * @return true, if this GameListItem can be handled by the emulator; false, otherwise.
+ */
+ public boolean isValid()
+ {
+ return isValid;
+ }
+
+ public int compareTo(GameListItem o)
+ {
+ if (this.name != null)
+ return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
+ else
+ throw new IllegalArgumentException();
+ }
+}
+
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java
new file mode 100644
index 0000000000..318075ec40
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigAdapter.java
@@ -0,0 +1,70 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.inputconfig;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import java.util.List;
+
+import org.dolphinemu.dolphinemu.R;
+
+/**
+ * The adapter backing the input mapping configuration.
+ * <p>
+ * Responsible for handling the list items.
+ */
+public final class InputConfigAdapter extends ArrayAdapter<InputConfigItem>
+{
+ private final Context c;
+ private final int id;
+ private final List<InputConfigItem> items;
+
+ public InputConfigAdapter(Context context, int textViewResourceId, List<InputConfigItem> objects)
+ {
+ super(context, textViewResourceId, objects);
+ c = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+
+ @Override
+ public InputConfigItem getItem(int i)
+ {
+ return items.get(i);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent)
+ {
+ View v = convertView;
+ if (v == null)
+ {
+ LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, parent, false);
+ }
+
+ final InputConfigItem item = items.get(position);
+ if (item != null)
+ {
+ TextView title = (TextView) v.findViewById(R.id.FolderTitle);
+ TextView subtitle = (TextView) v.findViewById(R.id.FolderSubTitle);
+
+ if (title != null)
+ title.setText(item.getName());
+
+ if (subtitle != null)
+ subtitle.setText(item.getBind());
+ }
+
+ return v;
+ }
+}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java
index 3a6e855c3b..dd91b952c7 100644
--- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigFragment.java
@@ -1,4 +1,10 @@
-package org.dolphinemu.dolphinemu;
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.inputconfig;
import android.app.Activity;
import android.app.Fragment;
@@ -13,63 +19,75 @@ 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
- * Refer to the license.txt file included.
+ * The {@link Fragment} responsible for implementing the functionality
+ * within the input control mapping config.
*/
-public class InputConfigFragment extends Fragment
- implements GameListActivity.OnGameConfigListener{
+public final class InputConfigFragment extends Fragment
+ implements GameListActivity.OnGameConfigListener
+{
private Activity m_activity;
private ListView mDrawerList;
private InputConfigAdapter adapter;
private int configPosition = 0;
- boolean Configuring = false;
- boolean firstEvent = true;
+ private boolean Configuring = false;
+ private boolean firstEvent = true;
- static public String getInputDesc(InputDevice input)
+ /**
+ * Gets the descriptor for the given {@link InputDevice}.
+ *
+ * @param input The {@link InputDevice} to get the descriptor of.
+ *
+ * @return the descriptor for the given {@link InputDevice}.
+ */
+ public static String getInputDesc(InputDevice input)
{
if (input == null)
return "null"; // Happens when the inputdevice is from an unknown source
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
+ {
return input.getDescriptor();
+ }
else
{
List<InputDevice.MotionRange> motions = input.getMotionRanges();
String fakeid = "";
+
for (InputDevice.MotionRange range : motions)
fakeid += range.getAxis();
+
return fakeid;
}
}
+
@Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState)
+ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
List<InputConfigItem> Input = new ArrayList<InputConfigItem>();
- int a = 0;
-
- Input.add(a++, new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True"));
- Input.add(a++, new InputConfigItem("Button A", "Android-InputA"));
- Input.add(a++, new InputConfigItem("Button B", "Android-InputB"));
- Input.add(a++, new InputConfigItem("Button Start", "Android-InputStart"));
- Input.add(a++, new InputConfigItem("Button X", "Android-InputX"));
- Input.add(a++, new InputConfigItem("Button Y", "Android-InputY"));
- Input.add(a++, new InputConfigItem("Button Z", "Android-InputZ"));
- Input.add(a++, new InputConfigItem("D-Pad Up", "Android-DPadUp"));
- Input.add(a++, new InputConfigItem("D-Pad Down", "Android-DPadDown"));
- Input.add(a++, new InputConfigItem("D-Pad Left", "Android-DPadLeft"));
- Input.add(a++, new InputConfigItem("D-Pad Right", "Android-DPadRight"));
- Input.add(a++, new InputConfigItem("Main Stick Up", "Android-MainUp"));
- Input.add(a++, new InputConfigItem("Main Stick Down", "Android-MainDown"));
- Input.add(a++, new InputConfigItem("Main Stick Left", "Android-MainLeft"));
- Input.add(a++, new InputConfigItem("Main Stick Right", "Android-MainRight"));
- Input.add(a++, new InputConfigItem("C Stick Up", "Android-CStickUp"));
- Input.add(a++, new InputConfigItem("C Stick Down", "Android-CStickDown"));
- Input.add(a++, new InputConfigItem("C Stick Left", "Android-CStickLeft"));
- Input.add(a++, new InputConfigItem("C Stick Right", "Android-CStickRight"));
- Input.add(a++, new InputConfigItem("Trigger L", "Android-InputL"));
- Input.add(a++, new InputConfigItem("Trigger R", "Android-InputR"));
+ Input.add(new InputConfigItem(getString(R.string.button_a), "Android-InputA"));
+ Input.add(new InputConfigItem(getString(R.string.button_b), "Android-InputB"));
+ Input.add(new InputConfigItem(getString(R.string.button_start), "Android-InputStart"));
+ Input.add(new InputConfigItem(getString(R.string.button_x), "Android-InputX"));
+ Input.add(new InputConfigItem(getString(R.string.button_y), "Android-InputY"));
+ Input.add(new InputConfigItem(getString(R.string.button_z), "Android-InputZ"));
+ Input.add(new InputConfigItem(getString(R.string.dpad_up), "Android-DPadUp"));
+ Input.add(new InputConfigItem(getString(R.string.dpad_down), "Android-DPadDown"));
+ Input.add(new InputConfigItem(getString(R.string.dpad_left), "Android-DPadLeft"));
+ Input.add(new InputConfigItem(getString(R.string.dpad_right), "Android-DPadRight"));
+ Input.add(new InputConfigItem(getString(R.string.main_stick_up), "Android-MainUp"));
+ Input.add(new InputConfigItem(getString(R.string.main_stick_down), "Android-MainDown"));
+ Input.add(new InputConfigItem(getString(R.string.main_stick_left), "Android-MainLeft"));
+ Input.add(new InputConfigItem(getString(R.string.main_stick_right), "Android-MainRight"));
+ Input.add(new InputConfigItem(getString(R.string.c_stick_up), "Android-CStickUp"));
+ Input.add(new InputConfigItem(getString(R.string.c_stick_down), "Android-CStickDown"));
+ Input.add(new InputConfigItem(getString(R.string.c_stick_left), "Android-CStickLeft"));
+ Input.add(new InputConfigItem(getString(R.string.c_stick_right), "Android-CStickRight"));
+ Input.add(new InputConfigItem(getString(R.string.trigger_left), "Android-InputL"));
+ Input.add(new InputConfigItem(getString(R.string.trigger_right), "Android-InputR"));
adapter = new InputConfigAdapter(m_activity, R.layout.folderbrowser, Input);
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
@@ -79,56 +97,44 @@ public class InputConfigFragment extends Fragment
mDrawerList.setOnItemClickListener(mMenuItemClickListener);
return mDrawerList;
}
+
private AdapterView.OnItemClickListener mMenuItemClickListener = new AdapterView.OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
InputConfigItem o = adapter.getItem(position);
- switch(position)
- {
- case 0: // On screen controls
- String newBind;
- if (o.getBind().equals("True"))
- {
- Toast.makeText(m_activity, "Not Drawing on screen controls", Toast.LENGTH_SHORT).show();
- newBind = "False";
- }
- else
- {
- Toast.makeText(m_activity, "Drawing on screen controls", Toast.LENGTH_SHORT).show();
- newBind = "True";
- }
- adapter.remove(o);
- o.setBind(newBind);
- adapter.insert(o, position);
- break;
- default: // gamepad controls
- Toast.makeText(m_activity, "Press button to configure " + o.getName(), Toast.LENGTH_SHORT).show();
- configPosition = position;
- Configuring = true;
- firstEvent = true;
- break;
- }
+
+ Toast.makeText(m_activity, getString(R.string.press_button_to_config, o.getName()), Toast.LENGTH_SHORT).show();
+ configPosition = position;
+ Configuring = true;
+ firstEvent = true;
}
};
- static ArrayList<Float> m_values = new ArrayList<Float>();
+ private static ArrayList<Float> m_values = new ArrayList<Float>();
- void AssignBind(String bind)
+ private void AssignBind(String bind)
{
InputConfigItem o = adapter.getItem(configPosition);
adapter.remove(o);
o.setBind(bind);
adapter.insert(o, configPosition);
}
+
+ /**
+ * Gets the current {@link InputConfigAdapter}
+ *
+ * @return the current {@link InputConfigAdapter}.
+ */
public InputConfigAdapter getAdapter()
{
return adapter;
}
+
// Called from GameListActivity
public boolean onMotionEvent(MotionEvent event)
{
- if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0))
+ if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)
return false;
InputDevice input = event.getDevice();
@@ -138,17 +144,20 @@ public class InputConfigFragment extends Fragment
if (firstEvent)
{
m_values.clear();
- for (InputDevice.MotionRange range : motions) {
+
+ for (InputDevice.MotionRange range : motions)
+ {
m_values.add(event.getAxisValue(range.getAxis()));
}
+
firstEvent = false;
}
else
{
for (int a = 0; a < motions.size(); ++a)
{
- InputDevice.MotionRange range;
- range = motions.get(a);
+ InputDevice.MotionRange range = motions.get(a);
+
if (m_values.get(a) > (event.getAxisValue(range.getAxis()) + 0.5f))
{
AssignBind("Device '" + InputConfigFragment.getInputDesc(input) + "'-Axis " + range.getAxis() + "-");
@@ -164,10 +173,13 @@ public class InputConfigFragment extends Fragment
}
return true;
}
+
+ // Called from GameListActivity
public boolean onKeyEvent(KeyEvent event)
{
- Log.w("Dolphinemu", "Got Event " + event.getAction());
- switch (event.getAction()) {
+ Log.w("InputConfigFragment", "Got Event " + event.getAction());
+ switch (event.getAction())
+ {
case KeyEvent.ACTION_DOWN:
case KeyEvent.ACTION_UP:
if (Configuring)
@@ -177,6 +189,7 @@ public class InputConfigFragment extends Fragment
Configuring = false;
return true;
}
+
default:
break;
}
@@ -185,14 +198,18 @@ public class InputConfigFragment extends Fragment
}
@Override
- public void onAttach(Activity activity) {
+ 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 {
+ try
+ {
m_activity = activity;
- } catch (ClassCastException e) {
+ }
+ catch (ClassCastException e)
+ {
throw new ClassCastException(activity.toString()
+ " must implement OnGameListZeroListener");
}
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java
new file mode 100644
index 0000000000..fc11c7c347
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/inputconfig/InputConfigItem.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.inputconfig;
+
+import org.dolphinemu.dolphinemu.NativeLibrary;
+
+/**
+ * Represents a controller input item (button, stick, etc).
+ */
+public final class InputConfigItem implements Comparable<InputConfigItem>
+{
+ private String m_name;
+ private String m_Config;
+ private String m_bind;
+
+ private void Init(String name, String config, String defaultBind)
+ {
+ m_name = name;
+ m_Config = config;
+ String ConfigValues[] = m_Config.split("-");
+ String Key = ConfigValues[0];
+ String Value = ConfigValues[1];
+ m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, defaultBind);
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name Name of the input config item.
+ * @param config Name of the key in the configuration file that this control modifies.
+ * @param defaultBind Default binding to fall back upon if binding fails.
+ */
+ public InputConfigItem(String name, String config, String defaultBind)
+ {
+ Init(name, config, defaultBind);
+ }
+
+ /**
+ * Constructor that creates an InputConfigItem
+ * that has a default binding of "None".
+ *
+ * @param name Name of the input config item.
+ * @param config Name of the key in the configuration file that this control modifies.
+ */
+ public InputConfigItem(String name, String config)
+ {
+ Init(name, config, "None");
+ }
+
+ /**
+ * Gets the name of this InputConfigItem.
+ *
+ * @return the name of this InputConfigItem
+ */
+ public String getName()
+ {
+ return m_name;
+ }
+
+ /**
+ * Gets the config key this InputConfigItem modifies.
+ *
+ * @return the config key this InputConfigItem modifies.
+ */
+ public String getConfig()
+ {
+ return m_Config;
+ }
+
+ /**
+ * Gets the currently set binding of this InputConfigItem.
+ *
+ * @return the currently set binding of this InputConfigItem
+ */
+ public String getBind()
+ {
+ return m_bind;
+ }
+
+ /**
+ * Sets a new binding for this InputConfigItem.
+ *
+ * @param bind The new binding.
+ */
+ public void setBind(String bind)
+ {
+ m_bind = bind;
+ }
+
+ public int compareTo(InputConfigItem o)
+ {
+ if (this.m_name != null)
+ return this.m_name.toLowerCase().compareTo(o.getName().toLowerCase());
+ else
+ throw new IllegalArgumentException();
+ }
+}
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..e77725087e
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/CPUSettingsFragment.java
@@ -0,0 +1,80 @@
+/**
+ * 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());
+ }
+ }
+
+ @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..08685fa008
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java
@@ -0,0 +1,144 @@
+/**
+ * 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}.
+ */
+ private SectionsPagerAdapter mSectionsPagerAdapter;
+
+ /**
+ * The {@link ViewPager} that will host the section contents.
+ */
+ private 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 final 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/settings/UserPreferences.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java
new file mode 100644
index 0000000000..7f4840b9a2
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/UserPreferences.java
@@ -0,0 +1,235 @@
+/**
+ * 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;
+import android.preference.PreferenceManager;
+
+/**
+ * A class that retrieves all of the set user preferences in Android, in a safe way.
+ * <p>
+ * If any preferences are added to this emulator, an accessor for that preference
+ * should be added here. This way lengthy calls to getters from SharedPreferences
+ * aren't made necessary.
+ */
+public final class UserPreferences
+{
+ /**
+ * Loads the set config items from the Dolphin config files to the shared preferences of this front-end
+ *
+ * @param ctx The context used to retrieve the SharedPreferences instance.
+ */
+ public static void LoadDolphinConfigToPrefs(Context ctx)
+ {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+
+ // Get an editor.
+ SharedPreferences.Editor editor = prefs.edit();
+
+ // Add the settings.
+ editor.putString("cpuCorePref", getConfig("Dolphin.ini", "Core", "CPUCore", "3"));
+ editor.putBoolean("dualCorePref", getConfig("Dolphin.ini", "Core", "CPUThread", "False").equals("True"));
+
+ editor.putString("gpuPref", getConfig("Dolphin.ini", "Core", "GFXBackend ", "Software Renderer"));
+ editor.putBoolean("drawOnscreenControls", getConfig("Dolphin.ini", "Android", "ScreenControls", "True").equals("True"));
+
+ editor.putString("internalResolution", getConfig("gfx_opengl.ini", "Settings", "EFBScale", "2") );
+ editor.putString("anisotropicFiltering", getConfig("gfx_opengl.ini", "Enhancements", "MaxAnisotropy", "0"));
+ editor.putBoolean("scaledEFBCopy", getConfig("gfx_opengl.ini", "Hacks", "EFBScaleCopy", "True").equals("True"));
+ editor.putBoolean("perPixelLighting", getConfig("gfx_opengl.ini", "Settings", "EnablePixelLighting", "False").equals("True"));
+ editor.putBoolean("forceTextureFiltering", getConfig("gfx_opengl.ini", "Enhancements", "ForceFiltering", "False").equals("True"));
+ editor.putBoolean("disableFog", getConfig("gfx_opengl.ini", "Settings", "DisableFog", "False").equals("True"));
+ editor.putBoolean("skipEFBAccess", getConfig("gfx_opengl.ini", "Hacks", "EFBAccessEnable", "False").equals("True"));
+ editor.putBoolean("ignoreFormatChanges", getConfig("gfx_opengl.ini", "Hacks", "EFBEmulateFormatChanges", "False").equals("False"));
+
+ String efbCopyOn = getConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "False");
+ String efbToTexture = getConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "False");
+ String efbCopyCache = getConfig("gfx_opengl.ini", "Hacks", "EFBCopyCacheEnable", "False");
+
+ if (efbCopyOn.equals("False"))
+ {
+ editor.putString("efbCopyMethod", "Off");
+ }
+ else if (efbCopyOn.equals("True") && efbToTexture.equals("True"))
+ {
+ editor.putString("efbCopyMethod", "Texture");
+ }
+ else if(efbCopyOn.equals("True") && efbToTexture.equals("False") && efbCopyCache.equals("False"))
+ {
+ editor.putString("efbCopyMethod", "RAM (uncached)");
+ }
+ else if(efbCopyOn.equals("True") && efbToTexture.equals("False") && efbCopyCache.equals("True"))
+ {
+ editor.putString("efbCopyMethod", "RAM (cached)");
+ }
+
+ editor.putString("textureCacheAccuracy", getConfig("gfx_opengl.ini", "Settings", "SafeTextureCacheColorSamples", "128"));
+
+ String usingXFB = getConfig("gfx_opengl.ini", "Settings", "UseXFB", "False");
+ String usingRealXFB = getConfig("gfx_opengl.ini", "Settings", "UseRealXFB", "False");
+
+ if (usingXFB.equals("False"))
+ {
+ editor.putString("externalFrameBuffer", "Disabled");
+ }
+ else if (usingXFB.equals("True") && usingRealXFB.equals("False"))
+ {
+ editor.putString("externalFrameBuffer", "Virtual");
+ }
+ else if (usingXFB.equals("True") && usingRealXFB.equals("True"))
+ {
+ editor.putString("externalFrameBuffer", "Real");
+ }
+
+ editor.putBoolean("cacheDisplayLists", getConfig("gfx_opengl.ini", "Hacks", "DlistCachingEnable", "False").equals("True"));
+ editor.putBoolean("disableDestinationAlpha", getConfig("gfx_opengl.ini", "Settings", "DstAlphaPass", "False").equals("True"));
+ editor.putBoolean("fastDepthCalculation", getConfig("gfx_opengl.ini", "Settings", "FastDepthCalc", "True").equals("True"));
+
+ // Apply the changes.
+ editor.commit();
+ }
+
+ // Small utility method that shortens calls to NativeLibrary.GetConfig.
+ private static String getConfig(String ini, String section, String key, String defaultValue)
+ {
+ return NativeLibrary.GetConfig(ini, section, key, defaultValue);
+ }
+
+ /**
+ * Writes the config to the Dolphin ini file.
+ *
+ * @param ctx The context used to retrieve the user settings.
+ * */
+ public static void SaveConfigToDolphinIni(Context ctx)
+ {
+ SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(ctx);
+
+ // Whether or not the user is using dual core.
+ boolean isUsingDualCore = prefs.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");
+
+ // Whether or not to draw on-screen controls.
+ boolean drawingOnscreenControls = prefs.getBoolean("drawOnscreenControls", true);
+
+ // Whether or not to ignore all EFB access requests from the CPU.
+ boolean skipEFBAccess = prefs.getBoolean("skipEFBAccess", false);
+
+ // Whether or not to ignore changes to the EFB format.
+ boolean ignoreFormatChanges = prefs.getBoolean("ignoreFormatChanges", false);
+
+ // EFB copy method to use.
+ String efbCopyMethod = prefs.getString("efbCopyMethod", "Off");
+
+ // Texture cache accuracy. Falls back to "Fast" up error.
+ String textureCacheAccuracy = prefs.getString("textureCacheAccuracy", "128");
+
+ // External frame buffer emulation. Falls back to disabled upon error.
+ String externalFrameBuffer = prefs.getString("externalFrameBuffer", "Disabled");
+
+ // Whether or not display list caching is enabled.
+ boolean dlistCachingEnabled = prefs.getBoolean("cacheDisplayLists", false);
+
+ // Whether or not to disable destination alpha.
+ boolean disableDstAlphaPass = prefs.getBoolean("disableDestinationAlpha", false);
+
+ // Whether or not to use fast depth calculation.
+ boolean useFastDepthCalc = prefs.getBoolean("fastDepthCalculation", true);
+
+ // Internal resolution. Falls back to 1x Native upon error.
+ String internalResolution = prefs.getString("internalResolution", "2");
+
+ // Anisotropic Filtering Level. Falls back to 1x upon error.
+ String anisotropicFiltLevel = prefs.getString("anisotropicFiltering", "0");
+
+ // Whether or not Scaled EFB copies are used.
+ boolean usingScaledEFBCopy = prefs.getBoolean("scaledEFBCopy", true);
+
+ // Whether or not per-pixel lighting is used.
+ boolean usingPerPixelLighting = prefs.getBoolean("perPixelLighting", false);
+
+ // Whether or not texture filtering is being forced.
+ boolean isForcingTextureFiltering = prefs.getBoolean("forceTextureFiltering", false);
+
+ // Whether or not fog is disabled.
+ boolean fogIsDisabled = prefs.getBoolean("disableFog", false);
+
+
+ // CPU related Settings
+ NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUCore", currentEmuCore);
+ NativeLibrary.SetConfig("Dolphin.ini", "Core", "CPUThread", isUsingDualCore ? "True" : "False");
+
+ // General Video Settings
+ NativeLibrary.SetConfig("Dolphin.ini", "Core", "GFXBackend", currentVideoBackend);
+ NativeLibrary.SetConfig("Dolphin.ini", "Android", "ScreenControls", drawingOnscreenControls ? "True" : "False");
+
+ // Video Hack Settings
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBAccessEnable", skipEFBAccess ? "False" : "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBEmulateFormatChanges", ignoreFormatChanges ? "True" : "False");
+
+ // Set EFB Copy Method
+ if (efbCopyMethod.equals("Off"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "False");
+ }
+ else if (efbCopyMethod.equals("Texture"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "True");
+ }
+ else if (efbCopyMethod.equals("RAM (uncached)"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyCacheEnable", "False");
+ }
+ else if (efbCopyMethod.equals("RAM (cached)"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyEnable", "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBToTextureEnable", "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBCopyCacheEnable", "True");
+ }
+
+ // Set texture cache accuracy
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "SafeTextureCacheColorSamples", textureCacheAccuracy);
+
+ // Set external frame buffer.
+ if (externalFrameBuffer.equals("Disabled"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "UseXFB", "False");
+ }
+ else if (externalFrameBuffer.equals("Virtual"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "UseXFB", "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "UseRealXFB", "False");
+ }
+ else if (externalFrameBuffer.equals("Real"))
+ {
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "UseXFB", "True");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "UseRealXFB", "True");
+ }
+
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "DlistCachingEnable", dlistCachingEnabled ? "True" : "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "DstAlphaPass", disableDstAlphaPass ? "True" : "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "FastDepthCalc", useFastDepthCalc ? "True" : "False");
+
+ //-- Enhancement Settings --//
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "EFBScale", internalResolution);
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "MaxAnisotropy", anisotropicFiltLevel);
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Hacks", "EFBScaledCopy", usingScaledEFBCopy ? "True" : "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "EnablePixelLighting", usingPerPixelLighting ? "True" : "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Enhancements", "ForceFiltering", isForcingTextureFiltering ? "True" : "False");
+ NativeLibrary.SetConfig("gfx_opengl.ini", "Settings", "DisableFog", fogIsDisabled ? "True" : "False");
+ }
+}
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..3d97f2cbca
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/VideoSettingsFragment.java
@@ -0,0 +1,225 @@
+/**
+ * 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;
+
+ /**
+ * Class which provides a means to check various
+ * info about the OpenGL ES support for a device.
+ */
+ public static final class VersionCheck
+ {
+ private EGL10 mEGL;
+ private EGLDisplay mEGLDisplay;
+ private EGLConfig[] mEGLConfigs;
+ private EGLConfig mEGLConfig;
+ private EGLContext mEGLContext;
+ private EGLSurface mEGLSurface;
+ private 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();
+ }
+
+ /**
+ * Gets the OpenGL ES version string.
+ *
+ * @return the OpenGL ES version string.
+ */
+ public String getVersion()
+ {
+ return mGL.glGetString(GL10.GL_VERSION);
+ }
+
+ /**
+ * Gets the OpenGL ES vendor string.
+ *
+ * @return the OpenGL ES vendor string.
+ */
+ public String getVendor()
+ {
+ return mGL.glGetString(GL10.GL_VENDOR);
+ }
+
+ /**
+ * Gets the name of the OpenGL ES renderer.
+ *
+ * @return the name of the OpenGL ES renderer.
+ */
+ 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
+ }
+ }
+
+ /**
+ * Checks if this device supports OpenGL ES 3.
+ *
+ * @return true if this device supports OpenGL ES 3; false otherwise.
+ */
+ public static 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());
+ }
+ }
+
+ @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/sidemenu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java
new file mode 100644
index 0000000000..0e84009071
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuAdapter.java
@@ -0,0 +1,67 @@
+/**
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.sidemenu;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.TextView;
+
+import java.util.List;
+
+import org.dolphinemu.dolphinemu.R;
+
+/**
+ * Adapter that backs the sidebar menu.
+ * <p>
+ * Responsible for handling the elements of each sidebar item.
+ */
+public final class SideMenuAdapter extends ArrayAdapter<SideMenuItem>
+{
+ private final Context c;
+ private final int id;
+ private final List<SideMenuItem>items;
+
+ public SideMenuAdapter(Context context, int textViewResourceId, List<SideMenuItem> objects)
+ {
+ super(context, textViewResourceId, objects);
+ c = context;
+ id = textViewResourceId;
+ items = objects;
+ }
+
+ @Override
+ public SideMenuItem getItem(int i)
+ {
+ return items.get(i);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent)
+ {
+ View v = convertView;
+ if (v == null)
+ {
+ LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ v = vi.inflate(id, null);
+ }
+
+ final SideMenuItem item = items.get(position);
+ if (item != null)
+ {
+ TextView title = (TextView) v.findViewById(R.id.SideMenuTitle);
+
+ if (title != null)
+ title.setText(item.getName());
+ }
+
+ return v;
+ }
+}
+
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java
new file mode 100644
index 0000000000..a3393ef211
--- /dev/null
+++ b/Source/Android/src/org/dolphinemu/dolphinemu/sidemenu/SideMenuItem.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2013 Dolphin Emulator Project
+ * Licensed under GPLv2
+ * Refer to the license.txt file included.
+ */
+
+package org.dolphinemu.dolphinemu.sidemenu;
+
+
+/**
+ * Represents an item that goes in the sidemenu of the app.
+ */
+public final class SideMenuItem implements Comparable<SideMenuItem>
+{
+ private final String name;
+ private final int id;
+
+ /**
+ * Constructor
+ *
+ * @param name The name of the SideMenuItem.
+ * @param id ID number of this specific SideMenuItem.
+ */
+ public SideMenuItem(String name, int id)
+ {
+ this.name = name;
+ this.id = id;
+ }
+
+ /**
+ * Gets the name of this SideMenuItem.
+ *
+ * @return the name of this SideMenuItem.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Gets the ID of this SideMenuItem.
+ *
+ * @return the ID of this SideMenuItem.
+ */
+ public int getID()
+ {
+ return id;
+ }
+
+ public int compareTo(SideMenuItem o)
+ {
+ if (name != null)
+ return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
+ else
+ throw new IllegalArgumentException();
+ }
+}
+