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 Binary files /dev/null and b/Source/Android/res/drawable-hdpi/ic_menu_file.png 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 Binary files /dev/null and b/Source/Android/res/drawable-hdpi/ic_menu_folder.png 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 Binary files /dev/null and b/Source/Android/res/drawable-mdpi/ic_menu_file.png 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 Binary files /dev/null and b/Source/Android/res/drawable-mdpi/ic_menu_folder.png 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 Binary files /dev/null and b/Source/Android/res/drawable-xhdpi/ic_menu_file.png 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 Binary files /dev/null and b/Source/Android/res/drawable-xhdpi/ic_menu_folder.png 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..7189fd7ce5 --- /dev/null +++ b/Source/Android/res/layout/about_layout.xml @@ -0,0 +1,29 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Source/Android/res/layout/folderbrowser.xml b/Source/Android/res/layout/folderbrowser.xml index 82b94e238f..adfd72ed35 100644 --- a/Source/Android/res/layout/folderbrowser.xml +++ b/Source/Android/res/layout/folderbrowser.xml @@ -1,29 +1,43 @@ - - + android:layout_height="?android:attr/listPreferredItemHeight" + android:padding="3dip"> + + - - - - - - + + + /> + diff --git a/Source/Android/res/layout/prefs.xml b/Source/Android/res/layout/prefs.xml index 34700f56b7..d8d8664a97 100644 --- a/Source/Android/res/layout/prefs.xml +++ b/Source/Android/res/layout/prefs.xml @@ -2,23 +2,23 @@ + android:summary="@string/on_off" + android:title="@string/dual_core" /> + android:summary="@string/video_backend_to_use" + android:title="@string/video_backend" /> \ No newline at end of file diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml new file mode 100644 index 0000000000..329d464ccb --- /dev/null +++ b/Source/Android/res/values-ja/strings.xml @@ -0,0 +1,83 @@ + + + + + Dolphin Emulator + + + ナビゲーションウィンドウを開く + ナビゲーションウィンドウを閉じる + + + ビルドのバージョン: + サポートのOpenGL ES 3: + + + 現在のディレクトリ: + 親ディレクトリ + フォルダ + ファイルサイズ: + 圧縮ファイル形式はサポートされていません + + + ゲームリスト + フォルダの参照 + 設定 + ゲームパッド設定 + について + ファイルブラウザのロード + 設定のロード + ゲームパッド設定のロード + メニューについてのロード + + + クリックされたファイル: + + + 画面上のコントロールを描画 + Aボタン + Bボタン + スタートボタン + Xボタン + Yボタン + Zボタン + D-Pad: ↑ + D-Pad: ↓ + D-Pad: ← + D-Pad: → + コントロールスティック: ↑ + コントロールスティック: ↓ + コントロールスティック: ← + コントロールスティック: → + C-スティック: ↑ + C-スティック: ↓ + C-スティック: ← + C-スティック: → + 左のトリガー + 右のトリガー + + コントロールは画面上に描画されていない + コントロールは画面上に描画されています + %1$sを設定するにはボタンを押して + + + Interpreter + JIT64 Recompiler + JITIL Recompiler + JIT ARM Recompiler + CPUコア + CPU設定 + 使用するエミュレーションコア + デュアルコア + 有効/無効 + + ビデオ設定 + Software Renderer + ビデオレンダラ + 使用するビデオレンダラー + + + はい + いいえ + + diff --git a/Source/Android/res/values/prefvalues.xml b/Source/Android/res/values/prefvalues.xml index 409666e328..8564801f6f 100644 --- a/Source/Android/res/values/prefvalues.xml +++ b/Source/Android/res/values/prefvalues.xml @@ -1,11 +1,11 @@ - + Software Renderer OpenGL ES 3 - + Software Renderer OGL diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 40a14e3b4e..ea1e02297a 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -1,8 +1,83 @@ + Dolphin Emulator + + Open navigation drawer Close navigation drawer + + + Build Revision: + Supports OpenGL ES 3: + + + Current Dir: + Parent Directory + Folder + File Size: + Can not use compressed file types + + + Game List + Browse Folder + Settings + Gamepad Config + About + Loading up the browser + Loading up settings + Loading up gamepad config + Loading about menu + + + File clicked: + + + Draw on-screen controls + Button A + Button B + Button Start + Button X + Button Y + Button Z + D-Pad Up + D-Pad Down + D-Pad Left + D-Pad Right + Main Stick Up + Main Stick Down + Main Stick Left + Main Stick Right + C Stick Up + C Stick Down + C Stick Left + C Stick Right + Trigger L + Trigger R + + Not drawing on-screen controls + Drawing on-screen controls + Press button to configure %1$s + + + Interpreter + JIT64 Recompiler + JITIL Recompiler + JIT ARM Recompiler + CPU Core + CPU Settings + Emulation core to use + Dual Core + On/Off + + Video Settings + Software Renderer + Video Backend + Video backend to use + + + Yes + No diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java index 906736b039..4905027ae1 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java @@ -22,7 +22,6 @@ public class AboutFragment extends Fragment { private ListView mMainList; private FolderBrowserAdapter adapter; - private int configPosition = 0; boolean Configuring = false; boolean firstEvent = true; @@ -35,12 +34,15 @@ public class AboutFragment extends Fragment { 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 Input = new ArrayList(); - Input.add(new GameListItem(m_activity, "Build Revision", NativeLibrary.GetVersionString(), "", true)); - Input.add(new GameListItem(m_activity, "Supports OpenGL ES 3", PrefsFragment.SupportsGLES3() ? "Yes" : "No", "", true)); + List Input = new ArrayList(); + Input.add(new FolderBrowserItem(m_activity, getString(R.string.build_revision), NativeLibrary.GetVersionString(), "", true)); + Input.add(new FolderBrowserItem(m_activity, getString(R.string.supports_gles3), 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; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index 6cad8cb3bd..d4177de5a4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -33,12 +33,9 @@ public class DolphinEmulator extends Activity 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); + Log.e("DolphinEmulator", "Failed to copy asset file: " + asset, e); } } @@ -78,7 +75,6 @@ public class DolphinEmulator extends Activity super.onCreate(savedInstanceState); if (savedInstanceState == null) { - Intent ListIntent = new Intent(this, GameListActivity.class); startActivityForResult(ListIntent, 1); @@ -96,41 +92,19 @@ public class DolphinEmulator extends Activity 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(GCDir + File.separator + "dsp_coef.bin"); 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"); + 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"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences.Editor editor = prefs.edit(); @@ -169,11 +143,9 @@ public class DolphinEmulator extends Activity @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; @@ -233,14 +205,13 @@ public class DolphinEmulator extends Activity InputDevice input = event.getDevice(); List 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())); + 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/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 9094486197..aa44ad83ca 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -24,14 +24,14 @@ 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(); - Listdir = new ArrayList(); - Listfls = new ArrayList(); + Listdir = new ArrayList(); + Listfls = new ArrayList(); // Supported extensions to filter by Set validExts = new HashSet(Arrays.asList(".gcm", ".iso", ".wbfs", ".gcz", ".dol", ".elf", ".dff")); - Set archiveExts = new HashSet(Arrays.asList(".zip", ".rar", ".7z")); + Set invalidExts = new HashSet(Arrays.asList(".zip", ".rar", ".7z")); // Search for any directories or supported files within the current dir. try @@ -44,17 +44,17 @@ public class FolderBrowser extends Fragment { { if(entry.isDirectory()) { - dir.add(new GameListItem(m_activity, entryName,"Folder",entry.getAbsolutePath(), true)); + dir.add(new FolderBrowserItem(m_activity, entryName, getString(R.string.folder), entry.getAbsolutePath(), true)); } else { 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(m_activity, 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(m_activity, entryName,getString(R.string.file_size)+entry.length(),entry.getAbsolutePath(), false)); } } } @@ -70,7 +70,7 @@ 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(m_activity, "..", getString(R.string.parent_directory), currDir.getParent(), true)); adapter = new FolderBrowserAdapter(m_activity, R.layout.folderbrowser, dir); mDrawerList = (ListView) rootView.findViewById(R.id.gamelist); @@ -94,17 +94,19 @@ 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 o = adapter.getItem(position); + if(o.isDirectory() || o.getSubtitle().equalsIgnoreCase(getString(R.string.parent_directory))) { currentDir = new File(o.getPath()); Fill(currentDir); } else - if (o.isValid()) + { + if (o.isValidItem()) 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(); + } } }; diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java index 30c1747781..0c38aa7b2f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserAdapter.java @@ -1,58 +1,79 @@ package org.dolphinemu.dolphinemu; import android.content.Context; +import android.util.Log; 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 FolderBrowserAdapter extends ArrayAdapter{ +public class FolderBrowserAdapter extends ArrayAdapter{ private Context c; private int id; - private Listitems; + private List items; - public FolderBrowserAdapter(Context context, int textViewResourceId, - List objects) { + public FolderBrowserAdapter(Context context, int textViewResourceId, List objects) { super(context, textViewResourceId, objects); c = context; id = textViewResourceId; items = objects; } - public GameListItem getItem(int i) + public FolderBrowserItem getItem(int i) { return items.get(i); } + @Override - public View getView(int position, View convertView, ViewGroup parent) { + 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); + if (v == null) + { + LayoutInflater vi = (LayoutInflater) c.getSystemService(Context.LAYOUT_INFLATER_SERVICE); + v = vi.inflate(id, parent, false); } - 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); + + 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(t1!=null) + if(mainText != null) { - t1.setText(o.getName()); - if (!o.isValid()) - t1.setTextColor(0xFFFF0000); + mainText.setText(item.getName()); + + if (!item.isValidItem()) + { + mainText.setTextColor(0xFFFF0000); + } + } + + if(subtitleText != null) + { + 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); + } } - if(t2!=null) - t2.setText(o.getData()); } return v; } - - - } - diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java new file mode 100644 index 0000000000..d2f8773e24 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowserItem.java @@ -0,0 +1,113 @@ +package org.dolphinemu.dolphinemu; + +import java.io.File; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.drawable.Drawable; + +/** + * Represents an item in the folder browser list. + */ +public final class FolderBrowserItem implements Comparable +{ + private final Context ctx; + private final String name; + private final String subtitle; + private final String path; + private final boolean isValid; + private final File underlyingFile; + + /** + * Constructor + * + * @param ctx Context this FolderBrowserItem is being used in. + * @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(Context ctx, String name, String subtitle, String path, boolean isValid) + { + this.ctx = ctx; + this.name = name; + this.subtitle = 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 isValidItem() + { + 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/GameListActivity.java index 9a48de4d8b..845bf72bdd 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListActivity.java @@ -52,11 +52,11 @@ public class GameListActivity extends Activity mDrawerList = (ListView) findViewById(R.id.left_drawer); List dir = new ArrayList(); - 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); @@ -179,7 +179,7 @@ public class GameListActivity extends Activity break; case 1: { - Toast.makeText(mMe, "Loading up the browser", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_browser), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 1; mCurFragment = new FolderBrowser(); FragmentManager fragmentManager = getFragmentManager(); @@ -188,7 +188,7 @@ public class GameListActivity extends Activity break; case 2: { - Toast.makeText(mMe, "Loading up settings", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_settings), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 2; mCurFragment = new PrefsFragment(); FragmentManager fragmentManager = getFragmentManager(); @@ -197,7 +197,7 @@ public class GameListActivity extends Activity break; case 3: { - Toast.makeText(mMe, "Loading up gamepad config", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.loading_gamepad), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 3; mCurFragment = new InputConfigFragment(); FragmentManager fragmentManager = getFragmentManager(); @@ -206,7 +206,7 @@ public class GameListActivity extends Activity break; case 4: { - Toast.makeText(mMe, "Loading up About", Toast.LENGTH_SHORT).show(); + Toast.makeText(mMe, getString(R.string.about), Toast.LENGTH_SHORT).show(); mCurFragmentNum = 4; mCurFragment = new AboutFragment(); FragmentManager fragmentManager = getFragmentManager(); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java index 152c18662b..8e4d2cb244 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/GameListFragment.java @@ -49,7 +49,7 @@ 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(); try @@ -63,7 +63,7 @@ public class GameListFragment extends Fragment 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)); } } } @@ -96,7 +96,7 @@ public class GameListFragment extends Fragment 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()); } @@ -104,7 +104,7 @@ public class GameListFragment extends Fragment }; 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); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java index 91f550d2a2..b11dc4a34b 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigFragment.java @@ -47,27 +47,27 @@ public class InputConfigFragment extends Fragment Bundle savedInstanceState) { List Input = new ArrayList(); - Input.add(new InputConfigItem("Draw on-screen controls", "Android-ScreenControls", "True")); - Input.add(new InputConfigItem("Button A", "Android-InputA")); - Input.add(new InputConfigItem("Button B", "Android-InputB")); - Input.add(new InputConfigItem("Button Start", "Android-InputStart")); - Input.add(new InputConfigItem("Button X", "Android-InputX")); - Input.add(new InputConfigItem("Button Y", "Android-InputY")); - Input.add(new InputConfigItem("Button Z", "Android-InputZ")); - Input.add(new InputConfigItem("D-Pad Up", "Android-DPadUp")); - Input.add(new InputConfigItem("D-Pad Down", "Android-DPadDown")); - Input.add(new InputConfigItem("D-Pad Left", "Android-DPadLeft")); - Input.add(new InputConfigItem("D-Pad Right", "Android-DPadRight")); - Input.add(new InputConfigItem("Main Stick Up", "Android-MainUp")); - Input.add(new InputConfigItem("Main Stick Down", "Android-MainDown")); - Input.add(new InputConfigItem("Main Stick Left", "Android-MainLeft")); - Input.add(new InputConfigItem("Main Stick Right", "Android-MainRight")); - Input.add(new InputConfigItem("C Stick Up", "Android-CStickUp")); - Input.add(new InputConfigItem("C Stick Down", "Android-CStickDown")); - Input.add(new InputConfigItem("C Stick Left", "Android-CStickLeft")); - Input.add(new InputConfigItem("C Stick Right", "Android-CStickRight")); - Input.add(new InputConfigItem("Trigger L", "Android-InputL")); - Input.add(new InputConfigItem("Trigger R", "Android-InputR")); + Input.add(new InputConfigItem(getString(R.string.draw_onscreen_controls), "Android-ScreenControls", "True")); + 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); @@ -88,12 +88,12 @@ public class InputConfigFragment extends Fragment String newBind; if (o.getBind().equals("True")) { - Toast.makeText(m_activity, "Not Drawing on screen controls", Toast.LENGTH_SHORT).show(); + Toast.makeText(m_activity, getString(R.string.not_drawing_onscreen_controls), Toast.LENGTH_SHORT).show(); newBind = "False"; } else { - Toast.makeText(m_activity, "Drawing on screen controls", Toast.LENGTH_SHORT).show(); + Toast.makeText(m_activity, getString(R.string.drawing_onscreen_controls), Toast.LENGTH_SHORT).show(); newBind = "True"; } adapter.remove(o); @@ -101,7 +101,8 @@ public class InputConfigFragment extends Fragment adapter.insert(o, position); break; default: // gamepad controls - Toast.makeText(m_activity, "Press button to configure " + o.getName(), Toast.LENGTH_SHORT).show(); + + Toast.makeText(m_activity, getString(R.string.press_button_to_config, o.getName()), Toast.LENGTH_SHORT).show(); configPosition = position; Configuring = true; firstEvent = true; @@ -136,9 +137,12 @@ 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 @@ -164,7 +168,7 @@ public class InputConfigFragment extends Fragment } public boolean onKeyEvent(KeyEvent event) { - Log.w("Dolphinemu", "Got Event " + event.getAction()); + Log.w("InputConfigFragment", "Got Event " + event.getAction()); switch (event.getAction()) { case KeyEvent.ACTION_DOWN: case KeyEvent.ACTION_UP: diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java index 7511406dc9..0a6f69a1d0 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/InputConfigItem.java @@ -1,49 +1,91 @@ -package org.dolphinemu.dolphinemu; - -/** +/* * Copyright 2013 Dolphin Emulator Project * Licensed under GPLv2 * Refer to the license.txt file included. */ + +package org.dolphinemu.dolphinemu; + +/** + * Represents a controller input item (button, stick, etc). + */ public class InputConfigItem implements Comparable{ private String m_name; private String m_Config; private String m_bind; - private void Init(String n, String c, String d) + private void Init(String name, String config, String defaultBind) { - m_name = n; - m_Config = c; + 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, d); + m_bind = NativeLibrary.GetConfig("Dolphin.ini", Key, Value, defaultBind); } - public InputConfigItem(String n, String c, String d) + /** + * 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(n, c, d); + Init(name, config, defaultBind); } - public InputConfigItem(String n, String c) + /** + * 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(n, c, "None"); + 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; } - public void setBind(String b) + + /** + * Sets a new binding for this InputConfigItem. + * + * @param bind The new binding. + */ + public void setBind(String bind) { - m_bind = b; + m_bind = bind; } public int compareTo(InputConfigItem o) diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java index f089362c38..da58274c5f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/NativeLibrary.java @@ -1,12 +1,17 @@ +/* + * 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 static native void onTouchEvent(int Action, float X, float Y); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java index e16b2503c3..4f088a58b4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/PrefsFragment.java @@ -97,33 +97,35 @@ public class PrefsFragment extends PreferenceFragment { } 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(); + String m_GLVersion = mbuffer.getVersion(); + String m_GLVendor = mbuffer.getVendor(); + String m_GLRenderer = mbuffer.getRenderer(); boolean mSupportsGLES3 = false; - if (m_GLVersion.contains("OpenGL ES 3.0") || - m_GLVersion.equals("OpenGL ES 3.0")) // 3.0 support + // Check for OpenGL ES 3 support (General case). + if (m_GLVersion.contains("OpenGL ES 3.0") || m_GLVersion.equals("OpenGL ES 3.0")) mSupportsGLES3 = true; + + // Checking for OpenGL ES 3 support for certain Qualcomm devices. if (!mSupportsGLES3 && m_GLVendor.equals("Qualcomm")) { if (m_GLRenderer.contains("Adreno (TM) 3")) { - int mVStart, mVEnd = 0; + int mVStart = m_GLVersion.indexOf("V@") + 2; + int 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) @@ -144,18 +146,18 @@ public class PrefsFragment extends PreferenceFragment { if (Build.CPU_ABI.contains("x86")) { - entries.put("Interpreter", "0"); - entries.put("JIT64 Recompiler", "1"); - entries.put("JITIL Recompiler", "2"); + entries.put(getString(R.string.interpreter), "0"); + entries.put(getString(R.string.jit64_recompiler), "1"); + entries.put(getString(R.string.jitil_recompiler), "2"); } else if (Build.CPU_ABI.contains("arm")) { - entries.put("Interpreter", "0"); - entries.put("JIT ARM Recompiler", "3"); + entries.put(getString(R.string.interpreter), "0"); + entries.put(getString(R.string.jit_arm_recompiler), "3"); } else { - entries.put("Interpreter", "0"); + entries.put(getString(R.string.interpreter), "0"); } // Convert the key/value sections to arrays respectively so the list can be set. @@ -163,8 +165,8 @@ public class PrefsFragment extends PreferenceFragment { etp.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); etp.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); etp.setKey("cpupref"); - etp.setTitle("CPU Core"); - etp.setSummary("Emulation core to use"); + etp.setTitle(getString(R.string.cpu_core)); + etp.setSummary(getString(R.string.emu_core_to_use)); PreferenceCategory mCategory = (PreferenceCategory) findPreference("cpuprefcat"); mCategory.addPreference(etp); @@ -181,11 +183,11 @@ public class PrefsFragment extends PreferenceFragment { // Add available graphics renderers to the hashmap to add to the list. entries.clear(); - entries.put("Software Renderer", "Software Renderer"); // TODO: I think this is a bug? The value shouldn't be the same as the key? + entries.put(getString(R.string.software_renderer), "Software Renderer"); videobackend.setKey("gpupref"); - videobackend.setTitle("Video Backend"); - videobackend.setSummary("Video backend to use"); + videobackend.setTitle(getString(R.string.video_backend)); + videobackend.setSummary(getString(R.string.video_backend_to_use)); videobackend.setEntries(entries.keySet().toArray(new CharSequence[entries.size()])); videobackend.setEntryValues(entries.values().toArray(new CharSequence[entries.size()])); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java index 599ce5007a..eb2143becb 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuAdapter.java @@ -16,34 +16,38 @@ public class SideMenuAdapter extends ArrayAdapter{ private Listitems; public SideMenuAdapter(Context context, int textViewResourceId, - List objects) { + List 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; - } - - - + } + @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 index e24842bed1..6d204d0d69 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java @@ -1,25 +1,47 @@ -package org.dolphinemu.dolphinemu; - -/** +/* * Copyright 2013 Dolphin Emulator Project * Licensed under GPLv2 * Refer to the license.txt file included. */ -public class SideMenuItem implements Comparable{ +package org.dolphinemu.dolphinemu; + + +/** + * Represents an item that goes in the sidemenu of the app. + */ +public class SideMenuItem implements Comparable +{ private String m_name; private int m_id; - public SideMenuItem(String n, int id) + /** + * Constructor + * + * @param name The name of the SideMenuItem. + * @param id ID number of this specific SideMenuItem. + */ + public SideMenuItem(String name, int id) { - m_name = n; + m_name = name; m_id = id; } + /** + * Gets the name of this SideMenuItem. + * + * @return the name of this SideMenuItem. + */ public String getName() { return m_name; } + + /** + * Gets the ID of this SideMenuItem. + * + * @return the ID of this SideMenuItem. + */ public int getID() { return m_id; diff --git a/Source/Core/DolphinWX/Src/NetWindow.cpp b/Source/Core/DolphinWX/Src/NetWindow.cpp index 1c8f0549b9..e4bc377f37 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.cpp +++ b/Source/Core/DolphinWX/Src/NetWindow.cpp @@ -409,7 +409,7 @@ void NetPlayDiag::GetNetSettings(NetSettings &settings) settings.m_Controllers[i] = SConfig::GetInstance().m_SIDevice[i]; } -const std::string& NetPlayDiag::FindGame() +std::string NetPlayDiag::FindGame() { // find path for selected game, sloppy.. for (u32 i = 0 ; auto game = m_game_list->GetISO(i); ++i) diff --git a/Source/Core/DolphinWX/Src/NetWindow.h b/Source/Core/DolphinWX/Src/NetWindow.h index 543c164994..e798033eab 100644 --- a/Source/Core/DolphinWX/Src/NetWindow.h +++ b/Source/Core/DolphinWX/Src/NetWindow.h @@ -92,7 +92,7 @@ private: void OnAdjustBuffer(wxCommandEvent& event); void OnConfigPads(wxCommandEvent& event); void GetNetSettings(NetSettings &settings); - const std::string& FindGame(); + std::string FindGame(); wxListBox* m_player_lbox; wxTextCtrl* m_chat_text;