diff options
| author | Lioncash <mathew1800@gmail.com> | 2013-10-25 23:10:17 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2013-10-25 23:10:17 -0400 |
| commit | 77eb9ce725dc9a3f17394318356bcde39562169e (patch) | |
| tree | f3c82ed6963df130164b055b30d1d909a4146eb6 /Source/Android/src/org | |
| parent | d9be95ed9eb894216d2483fa220992fc7cdf01da (diff) | |
[Android] Add the capability to dynamically enable and disable the input overlay during emulation.
Diffstat (limited to 'Source/Android/src/org')
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java index 8b8f4e0551..1d8b2afe17 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java @@ -36,6 +36,7 @@ public final class EmulationActivity extends Activity private boolean IsActionBarHidden = false; private float screenWidth; private float screenHeight; + private SharedPreferences sharedPrefs; @Override public void onCreate(Bundle savedInstanceState) @@ -60,29 +61,36 @@ public final class EmulationActivity extends Activity getActionBar().setBackgroundDrawable(actionBarBackground); // Set the native rendering screen width/height. - // Also get the intent passed from the GameList when the game - // was selected. This is so the path of the game can be retrieved - // and set on the native side of the code so the emulator can actually - // load the game. - Intent gameToEmulate = getIntent(); - + // // Due to a bug in Adreno, it renders the screen rotated 90 degrees when using OpenGL // Flip the width and height when on Adreno to work around this. // Mali isn't affected by this bug. - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - if (prefs.getString("gpuPref", "Software Rendering").equals("OGL") + sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this); + if (sharedPrefs.getString("gpuPref", "Software Rendering").equals("OGL") && VideoSettingsFragment.SupportsGLES3() && VideoSettingsFragment.m_GLVendor != null && VideoSettingsFragment.m_GLVendor.equals("Qualcomm")) NativeLibrary.SetDimensions((int)screenHeight, (int)screenWidth); else NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight); + + // Get the intent passed from the GameList when the game + // was selected. This is so the path of the game can be retrieved + // and set on the native side of the code so the emulator can actually + // load the game. + Intent gameToEmulate = getIntent(); NativeLibrary.SetFilename(gameToEmulate.getStringExtra("SelectedGame")); Running = true; // Set the emulation window. setContentView(R.layout.emulation_view); + // If the input overlay was previously disabled, then don't show it. + if (!sharedPrefs.getBoolean("showInputOverlay", true)) + { + findViewById(R.id.emulationControlOverlay).setVisibility(View.INVISIBLE); + } + // Hide the action bar by default so it doesn't get in the way. getActionBar().hide(); IsActionBarHidden = true; @@ -169,10 +177,49 @@ public final class EmulationActivity extends Activity } @Override + public boolean onPrepareOptionsMenu(Menu menu) + { + // Determine which string the "Enable Input Overlay" menu item should have + // depending on its visibility at the time of preparing the options menu. + if (!sharedPrefs.getBoolean("showInputOverlay", true)) + { + menu.findItem(R.id.enableInputOverlay).setTitle(R.string.enable_input_overlay); + } + else + { + menu.findItem(R.id.enableInputOverlay).setTitle(R.string.disable_input_overlay); + } + + return true; + } + + @Override public boolean onMenuItemSelected(int itemId, MenuItem item) { switch(item.getItemId()) { + // Enable/Disable input overlay. + case R.id.enableInputOverlay: + { + View overlay = findViewById(R.id.emulationControlOverlay); + + // Show the overlay + if (item.getTitle().equals(getString(R.string.enable_input_overlay))) + { + overlay.setVisibility(View.VISIBLE); + item.setTitle(R.string.disable_input_overlay); + sharedPrefs.edit().putBoolean("showInputOverlay", true).commit(); + } + else // Hide the overlay + { + overlay.setVisibility(View.INVISIBLE); + item.setTitle(R.string.enable_input_overlay); + sharedPrefs.edit().putBoolean("showInputOverlay", false).commit(); + } + + return true; + } + // Save state slots case R.id.saveSlot1: NativeLibrary.SaveState(0); @@ -194,7 +241,7 @@ public final class EmulationActivity extends Activity NativeLibrary.SaveState(4); return true; - // Load state slot + // Load state slots case R.id.loadSlot1: NativeLibrary.LoadState(0); return true; |
