From 72257d5f699d7d234c035547c02c5d9781bb2e11 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Thu, 27 Jun 2013 04:47:39 -0500 Subject: [PATCH] [Android] Support clicking on games in the folder browser to add the folder currently in. Mostly for derps that keep trying to run the game from the folder browser. --- Source/Android/.idea/workspace.xml | 254 ++++++++++-------- Source/Android/AndroidManifest.xml | 4 +- Source/Android/assets/GCPadNew.ini | 40 +-- .../dolphinemu/DolphinEmulator.java | 48 +++- .../dolphinemu/dolphinemu/FolderBrowser.java | 19 +- 5 files changed, 210 insertions(+), 155 deletions(-) diff --git a/Source/Android/.idea/workspace.xml b/Source/Android/.idea/workspace.xml index 01d723657a..1a8e010c8e 100644 --- a/Source/Android/.idea/workspace.xml +++ b/Source/Android/.idea/workspace.xml @@ -103,18 +103,34 @@ - - - - + + - + - + + + + + + + + + + + + + + + + + + + @@ -143,22 +159,22 @@ @@ -212,6 +228,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + @@ -256,51 +310,27 @@ + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -310,9 +340,9 @@ + - @@ -382,20 +412,6 @@ - - + + - - - - - - - - - - - - - - - - - @@ -655,20 +668,6 @@ - - - - - - - - - - - - - - @@ -697,13 +696,6 @@ - - - - - - - @@ -732,18 +724,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + - + + + + + + + + diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml index 0edfe1f4de..125bb474eb 100644 --- a/Source/Android/AndroidManifest.xml +++ b/Source/Android/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="9" + android:versionName="0.9" > diff --git a/Source/Android/assets/GCPadNew.ini b/Source/Android/assets/GCPadNew.ini index 3c22ed5a2e..42144db1ce 100644 --- a/Source/Android/assets/GCPadNew.ini +++ b/Source/Android/assets/GCPadNew.ini @@ -1,29 +1,29 @@ [GCPad1] Device = Android/0/Touchscreen -Buttons/A = Button 0 -Buttons/B = Button 1 -Buttons/X = Button 3 -Buttons/Y = Button 4 -Buttons/Z = Button 5 -Buttons/Start = Button 2 -Main Stick/Up = Axis 10 -Main Stick/Down = Axis 11 -Main Stick/Left = Axis 12 -Main Stick/Right = Axis 13 +Buttons/A = `Button 0` +Buttons/B = `Button 1` +Buttons/X = `Button 3` +Buttons/Y = `Button 4` +Buttons/Z = `Button 5` +Buttons/Start = `Button 2` +Main Stick/Up = `Axis 10` +Main Stick/Down = `Axis 11` +Main Stick/Left = `Axis 12` +Main Stick/Right = `Axis 13` Main Stick/Modifier = Shift_L Main Stick/Modifier/Range = 50.000000 -C-Stick/Up = Axis 14 -C-Stick/Down = Axis 15 -C-Stick/Left = Axis 16 -C-Stick/Right = Axis 17 +C-Stick/Up = `Axis 14` +C-Stick/Down = `Axis 15` +C-Stick/Left = `Axis 16` +C-Stick/Right = `Axis 17` C-Stick/Modifier = Control_L C-Stick/Modifier/Range = 50.000000 -Triggers/L = Axis 18 -Triggers/R = Axis 19 -D-Pad/Up = Button 6 -D-Pad/Down = Button 7 -D-Pad/Left = Button 8 -D-Pad/Right = Button 9 +Triggers/L = `Axis 18` +Triggers/R = `Axis 19` +D-Pad/Up = `Button 6` +D-Pad/Down = `Button 7` +D-Pad/Left = `Button 8` +D-Pad/Right = `Button 9` [GCPad2] [GCPad3] [GCPad4] diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java index a7f70c08af..1afeff417e 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/DolphinEmulator.java @@ -173,24 +173,46 @@ public class DolphinEmulator extends Activity @Override public boolean dispatchKeyEvent(KeyEvent event) { int action = 0; - switch (event.getAction()) { - case KeyEvent.ACTION_DOWN: - action = 0; - break; - case KeyEvent.ACTION_UP: - action = 1; - break; - default: - break; + + // Special catch for the back key + // Currently disabled because stopping and starting emulation is broken. + /* + if ( event.getSource() == InputDevice.SOURCE_KEYBOARD + && event.getKeyCode() == KeyEvent.KEYCODE_BACK + && event.getAction() == KeyEvent.ACTION_UP + ) + { + if (Running) + NativeLibrary.StopEmulation(); + Running = false; + Intent ListIntent = new Intent(this, GameListActivity.class); + startActivityForResult(ListIntent, 1); + return true; } - InputDevice input = event.getDevice(); - NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action); - return true; + */ + + if (Running) + { + switch (event.getAction()) { + case KeyEvent.ACTION_DOWN: + action = 0; + break; + case KeyEvent.ACTION_UP: + action = 1; + break; + default: + return false; + } + InputDevice input = event.getDevice(); + NativeLibrary.onGamePadEvent(input.getDescriptor(), event.getKeyCode(), action); + return true; + } + return false; } @Override public boolean dispatchGenericMotionEvent(MotionEvent event) { - if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0)) { + if (((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) == 0) || !Running) { return super.dispatchGenericMotionEvent(event); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java index 0ceb776a77..d0e16e67a5 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/FolderBrowser.java @@ -60,10 +60,12 @@ public class FolderBrowser extends ListActivity { protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); GameListItem o = adapter.getItem(position); - if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){ + if(o.getData().equalsIgnoreCase("folder") || o.getData().equalsIgnoreCase("parent directory")){ currentDir = new File(o.getPath()); Fill(currentDir); } + else + FolderSelected(); } @Override @@ -83,11 +85,14 @@ public class FolderBrowser extends ListActivity { } @Override public boolean onOptionsItemSelected(MenuItem item) { - Intent intent = new Intent(); - intent.putExtra("Select", currentDir.getPath()); - setResult(Activity.RESULT_OK, intent); - - this.finish(); - return true; + FolderSelected(); + return true; } + private void FolderSelected() + { + Intent intent = new Intent(); + intent.putExtra("Select", currentDir.getPath()); + setResult(Activity.RESULT_OK, intent); + this.finish(); + } }