From dac9659c58380d07e0084757034ec77c532cdb5d Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 29 Aug 2013 21:07:17 -0400 Subject: [PATCH] [Android] Preliminary save-state support. Have the UI set up. Crashes with SIGABRT however. --- Source/Android/res/menu/emuwindow_overlay.xml | 45 +++++++++++++ Source/Android/res/values-ja/strings.xml | 11 +++- Source/Android/res/values/strings.xml | 9 +++ .../dolphinemu/EmulationActivity.java | 66 +++++++++++++++++++ 4 files changed, 130 insertions(+), 1 deletion(-) create mode 100644 Source/Android/res/menu/emuwindow_overlay.xml diff --git a/Source/Android/res/menu/emuwindow_overlay.xml b/Source/Android/res/menu/emuwindow_overlay.xml new file mode 100644 index 0000000000..04c7161699 --- /dev/null +++ b/Source/Android/res/menu/emuwindow_overlay.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Source/Android/res/values-ja/strings.xml b/Source/Android/res/values-ja/strings.xml index 73ef858a00..71cdcd47b3 100644 --- a/Source/Android/res/values-ja/strings.xml +++ b/Source/Android/res/values-ja/strings.xml @@ -29,7 +29,16 @@ クリックされたファイル: - + + + ステートセーブ + ステートロード + スロット 1 + スロット 2 + スロット 3 + スロット 4 + スロット 5 + 入力設定 入力バインディング diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 1abeb4992d..99522f5f00 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -30,6 +30,15 @@ File clicked: + + Save State + Load State + Slot 1 + Slot 2 + Slot 3 + Slot 4 + Slot 5 + Input Input Binding diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java index 85dfb1189b..eeefb1d80f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/EmulationActivity.java @@ -7,11 +7,16 @@ import org.dolphinemu.dolphinemu.settings.InputConfigFragment; import android.app.Activity; import android.content.Context; import android.content.Intent; +import android.graphics.Color; +import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.util.DisplayMetrics; +import android.util.Log; import android.view.InputDevice; import android.view.KeyEvent; import android.view.Menu; +import android.view.MenuInflater; +import android.view.MenuItem; import android.view.MotionEvent; import android.view.Window; import android.view.WindowManager; @@ -45,6 +50,11 @@ public final class EmulationActivity extends Activity getWindow().addFlags(LayoutParams.FLAG_FULLSCREEN); getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY); + // Set the transparency for the action bar. + ColorDrawable actionBarBackground = new ColorDrawable(Color.parseColor("#303030")); + actionBarBackground.setAlpha(175); + 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 @@ -123,9 +133,65 @@ public final class EmulationActivity extends Activity @Override public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.emuwindow_overlay, menu); return true; } + @Override + public boolean onMenuItemSelected(int itemId, MenuItem item) + { + switch(item.getItemId()) + { + // Save state slots + case R.id.saveSlot1: + NativeLibrary.SaveState(0); + return true; + + case R.id.saveSlot2: + NativeLibrary.SaveState(1); + return true; + + case R.id.saveSlot3: + NativeLibrary.SaveState(2); + return true; + + case R.id.saveSlot4: + NativeLibrary.SaveState(3); + return true; + + case R.id.saveSlot5: + NativeLibrary.SaveState(4); + return true; + + // Load state slot + case R.id.loadSlot1: + NativeLibrary.LoadState(0); + return true; + + case R.id.loadSlot2: + NativeLibrary.LoadState(1); + return true; + + case R.id.loadSlot3: + NativeLibrary.LoadState(2); + return true; + + case R.id.loadSlot4: + NativeLibrary.LoadState(3); + return true; + + case R.id.loadSlot5: + NativeLibrary.LoadState(4); + return true; + + default: + Log.d("EMU", "ID: " + item.getGroupId()); + Log.d("EMU", "NOPE"); + return super.onOptionsItemSelected( item ); + } + } + // Gets button presses @Override public boolean dispatchKeyEvent(KeyEvent event)