diff options
| author | Matthew Parlane <parlane@gmail.com> | 2013-08-24 23:56:31 +1200 |
|---|---|---|
| committer | Matthew Parlane <parlane@gmail.com> | 2013-08-24 23:56:31 +1200 |
| commit | 5548e7743831079d850e618c4e6b7da4769241c7 (patch) | |
| tree | a2a9ca8e26f602b1eadc701e6de886f55a00854b /Source/Android | |
| parent | 6907a326530d2771f9a39d72cebe54d391172c1b (diff) | |
| parent | 66c50ebf191b1b8d3d4cb696203a1cc225085eb7 (diff) | |
Merge branch 'master' into wii-network
Diffstat (limited to 'Source/Android')
13 files changed, 162 insertions, 80 deletions
diff --git a/Source/Android/res/menu/gamelist_menu.xml b/Source/Android/res/menu/gamelist_menu.xml new file mode 100644 index 0000000000..dbec1a65f3 --- /dev/null +++ b/Source/Android/res/menu/gamelist_menu.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8"?> +<menu xmlns:android="http://schemas.android.com/apk/res/android" > + <item + android:id="@+id/clearGameList" + android:title="@string/clear_game_list" + android:showAsAction="ifRoom|withText" /> +</menu>
\ No newline at end of file diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml index 9216a2ecdc..12594ca2ac 100644 --- a/Source/Android/res/values-ja/strings.xml +++ b/Source/Android/res/values-ja/strings.xml @@ -17,9 +17,10 @@ <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="clear_game_list">クリア</string> + <string name="clear_game_list_confirm">ゲームリストからすべての項目を削除しますか?</string> <string name="game_list">ゲームリスト</string> <string name="browse_folder">フォルダの参照</string> <string name="settings">設定</string> @@ -61,7 +62,7 @@ <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="dual_core_descrip">処理のための2つのCPUコアを使用して。速度が向上します。</string> <string name="video_settings">ビデオ設定</string> <string name="software_renderer">Software Renderer</string> <string name="opengl_es3">OpenGL ES 3</string> diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 50bacda5df..dac787e4bc 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -17,9 +17,10 @@ <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="clear_game_list">Clear game list</string> + <string name="clear_game_list_confirm">Do you want to clear the game list?</string> <string name="game_list">Game List</string> <string name="browse_folder">Browse Folder</string> <string name="settings">Settings</string> @@ -58,11 +59,11 @@ <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="cpu_settings">CPU</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="dual_core_descrip">Split workload to two CPU cores instead of one. Increases speed.</string> + <string name="video_settings">Video</string> <string name="software_renderer">Software Renderer</string> <string name="opengl_es3">OpenGL ES 3</string> <string name="video_backend">Video Backend</string> diff --git a/Source/Android/res/xml/cpu_prefs.xml b/Source/Android/res/xml/cpu_prefs.xml index adb6fff91f..83dc830791 100644 --- a/Source/Android/res/xml/cpu_prefs.xml +++ b/Source/Android/res/xml/cpu_prefs.xml @@ -3,7 +3,7 @@ <!-- CPU Settings --> <CheckBoxPreference android:key="dualCorePref" - android:summary="@string/on_off" + android:summary="@string/dual_core_descrip" android:title="@string/dual_core" /> <ListPreference diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 41e347a697..1f35a58f76 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -36,8 +36,8 @@ public final class AboutFragment extends Fragment String no = getString(R.string.no); 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(new FolderBrowserItem(getString(R.string.build_revision), NativeLibrary.GetVersionString(), "")); + Input.add(new FolderBrowserItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no, "")); adapter = new FolderBrowserAdapter(m_activity, R.layout.about_layout, Input); mMainList.setAdapter(adapter); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index b708b756b5..a616df609a 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -128,6 +128,8 @@ public final class DolphinEmulator<MainActivity> extends Activity CopyAsset("setting-usa.txt", WiiDir + File.separator + "setting-usa.txt"); } + // Load the configuration keys set in the Dolphin ini and gfx ini files + // into the application's shared preferences. UserPreferences.LoadDolphinConfigToPrefs(this); } } @@ -148,7 +150,6 @@ public final class DolphinEmulator<MainActivity> extends Activity 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"); NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight); NativeLibrary.SetFilename(FileName); setContentView(GLview); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index 8622026b97..dedd824c87 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -18,17 +18,83 @@ 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); + + /** + * Gets a value from a key in the given ini-based config file. + * + * @param configFile The ini-based config file to get the value from. + * @param Section The section key that the actual key is in. + * @param Key The key to get the value from. + * @param Default The value to return in the event the given key doesn't exist. + * + * @return the value stored at the key, or a default value if it doesn't exist. + */ + public static native String GetConfig(String configFile, String Section, String Key, String Default); + + /** + * Sets a value to a key in the given ini config file. + * + * @param configFile The ini-based config file to add the value to. + * @param Section The section key for the ini key + * @param Key The actual ini key to set. + * @param Value The string to set the ini key to. + */ + public static native void SetConfig(String configFile, String Section, String Key, String Value); + + /** + * Sets the filename to be run during emulation. + * + * @param filename The filename to be run during emulation. + */ public static native void SetFilename(String filename); + + /** + * Sets the dimensions of the rendering window. + * + * @param width The new width of the rendering window (in pixels). + * @param height The new height of the rendering window (in pixels). + */ public static native void SetDimensions(int width, int height); + + /** + * Gets the embedded banner within the given ISO/ROM. + * + * @param filename the file path to the ISO/ROM. + * + * @return an integer array containing the color data for the banner. + */ public static native int[] GetBanner(String filename); + + /** + * Gets the embedded title of the given ISO/ROM. + * + * @param filename The file path to the ISO/ROM. + * + * @return the embedded title of the ISO/ROM. + */ public static native String GetTitle(String filename); + + /** + * Gets the Dolphin version string. + * + * @return the Dolphin version string. + */ public static native String GetVersionString(); + /** + * Begins emulation. + * + * @param surf The surface to render to. + */ public static native void Run(Surface surf); + + /** Unpauses emulation from a paused state. */ public static native void UnPauseEmulation(); + + /** Pauses emulation. */ public static native void PauseEmulation(); + + /** Stops emulation. */ public static native void StopEmulation(); static diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java index 2895196ff7..55f88b3931 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java @@ -10,7 +10,6 @@ import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ListView; -import android.widget.Toast; import java.io.File; import java.util.*; @@ -50,7 +49,6 @@ public final class FolderBrowser extends Fragment // Supported extensions to filter by Set<String> validExts = new HashSet<String>(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf", ".dff")); - Set<String> invalidExts = new HashSet<String>(Arrays.asList(".zip", ".rar", ".7z")); // Search for any directories or files within the current dir. for(File entry : dirs) @@ -65,17 +63,13 @@ public final class FolderBrowser extends Fragment { if(entry.isDirectory()) { - dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath(), true)); + dir.add(new FolderBrowserItem(entryName, entry.getAbsolutePath())); } else if (entry.isFile() && hasExtension) { if (validExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) { - fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), true)); - } - else if (invalidExts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) - { - fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath(), false)); + fls.add(new FolderBrowserItem(entryName, getString(R.string.file_size)+entry.length(), entry.getAbsolutePath())); } } } @@ -92,7 +86,7 @@ public final class FolderBrowser extends Fragment // Check for a parent directory to the one we're currently in. if (!currDir.getPath().equalsIgnoreCase("/")) - dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent(), true)); + dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent())); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); @@ -124,10 +118,7 @@ public final class FolderBrowser extends Fragment } else { - if (item.isValid()) - FolderSelected(); - else - Toast.makeText(m_activity, getString(R.string.cant_use_compressed_filetypes), Toast.LENGTH_LONG).show(); + FolderSelected(); } } }; @@ -137,17 +128,8 @@ public final class FolderBrowser extends Fragment { 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"); - } + // Cache the activity instance. + m_activity = activity; } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java index e77205b527..6de1fbcb79 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserAdapter.java @@ -58,11 +58,6 @@ public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem> if(mainText != null) { mainText.setText(item.getName()); - - if (!item.isValid()) - { - mainText.setTextColor(0xFFFF0000); - } } if(subtitleText != null) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java index ebff901961..00e41852fa 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowserItem.java @@ -10,7 +10,6 @@ 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; /** @@ -19,14 +18,12 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem> * @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) + public FolderBrowserItem(String name, String subtitle, String path) { this.name = name; this.subtitle = subtitle; this.path = path; - this.isValid = isValid; this.underlyingFile = new File(path); } @@ -35,14 +32,12 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem> * * @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) + public FolderBrowserItem(String name, String path) { this.name = name; this.subtitle = ""; this.path = path; - this.isValid = isValid; this.underlyingFile = new File(path); } @@ -77,20 +72,6 @@ public final class FolderBrowserItem implements Comparable<FolderBrowserItem> } /** - * 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. * diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java index 62a9f34189..3678cf7637 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java @@ -7,8 +7,10 @@ package org.dolphinemu.dolphinemu.gamelist; import android.app.Activity; +import android.app.AlertDialog; import android.app.Fragment; import android.app.FragmentManager; +import android.content.DialogInterface; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; @@ -16,6 +18,7 @@ import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.widget.DrawerLayout; import android.view.*; import android.widget.AdapterView; +import android.widget.ArrayAdapter; import android.widget.ListView; import java.util.ArrayList; import java.util.List; @@ -248,6 +251,20 @@ public final class GameListActivity extends Activity { return super.onPrepareOptionsMenu(menu); } + + @Override + public boolean onCreateOptionsMenu(Menu menu) + { + // Only show this in the game list. + if (this.mCurFragmentNum == 0) + { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.gamelist_menu, menu); + return true; + } + + return false; + } @Override public boolean onOptionsItemSelected(MenuItem item) @@ -259,6 +276,38 @@ public final class GameListActivity extends Activity return true; } + // If clear game list is pressed. + if (item.getItemId() == R.id.clearGameList) + { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle(R.string.clear_game_list); + builder.setMessage(getString(R.string.clear_game_list_confirm)); + builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener(){ + public void onClick(DialogInterface dialog, int which) + { + String directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0"); + int intDirs = Integer.parseInt(directories); + + for (int i = 0; i < intDirs; i++) + { + NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPath" + i, ""); + } + + ArrayAdapter<GameListItem> adapter = ((GameListFragment)GameListActivity.this.mCurFragment).getAdapter(); + adapter.clear(); + adapter.notifyDataSetChanged(); + } + }); + builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) + { + // Do nothing. This just make "No" appear. + } + }); + + builder.show(); + } + return super.onOptionsItemSelected(item); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java index d77741016b..b72509419f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListFragment.java @@ -51,6 +51,16 @@ public final class GameListFragment extends Fragment */ void onZeroFiles(); } + + /** + * Gets the adapter for this fragment. + * + * @return the adapter for this fragment. + */ + public GameListAdapter getAdapter() + { + return mGameAdapter; + } private void Fill() { @@ -77,7 +87,7 @@ public final class GameListFragment extends Fragment if (!entry.isDirectory()) { if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.')))) - fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), true)); + fls.add(new GameListItem(mMe.getApplicationContext(), entryName, getString(R.string.file_size)+entry.length(),entry.getAbsolutePath())); } } } @@ -95,11 +105,12 @@ public final class GameListFragment extends Fragment // 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())) + for (int j = i+1; j < fls.size(); j++) { - fls.remove(indexNext); + if (fls.get(j).getPath().equals(fls.get(i).getPath())) + { + fls.remove(j); + } } } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java index 16ba06a65a..9ecff70b9b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java @@ -25,7 +25,6 @@ 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; /** @@ -37,12 +36,11 @@ public final class GameListItem implements Comparable<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) + public GameListItem(Context ctx, String name, String data, String path) { this.name = name; this.data = data; this.path = path; - this.isValid = isValid; File file = new File(path); if (!file.isDirectory() && !path.equals("")) @@ -115,16 +113,6 @@ public final class GameListItem implements Comparable<GameListItem> 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) |
