[Android] Preliminary save-state support. Have the UI set up. Crashes with SIGABRT however.

This commit is contained in:
Lioncash 2013-08-29 21:07:17 -04:00
parent b5d5296250
commit dac9659c58
4 changed files with 130 additions and 1 deletions

View File

@ -0,0 +1,45 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/saveStateRoot"
android:showAsAction="always"
android:title="@string/overlay_savestate">
<menu>
<item android:id="@+id/saveSlot1"
android:title="@string/overlay_slot1"/>
<item android:id="@+id/saveSlot2"
android:title="@string/overlay_slot2"/>
<item android:id="@+id/saveSlot3"
android:title="@string/overlay_slot3"/>
<item android:id="@+id/saveSlot4"
android:title="@string/overlay_slot4"/>
<item android:id="@+id/saveSlot5"
android:title="@string/overlay_slot5"/>
</menu>
</item>
<item
android:id="@+id/loadtateRoot"
android:showAsAction="always"
android:title="@string/overlay_loadstate">
<menu>
<item android:id="@+id/loadSlot1"
android:title="@string/overlay_slot1"/>
<item android:id="@+id/loadSlot2"
android:title="@string/overlay_slot2"/>
<item android:id="@+id/loadSlot3"
android:title="@string/overlay_slot3"/>
<item android:id="@+id/loadSlot4"
android:title="@string/overlay_slot4"/>
<item android:id="@+id/loadSlot5"
android:title="@string/overlay_slot5"/>
</menu>
</item>
</menu>

View File

@ -30,6 +30,15 @@
<!-- Game List Fragment -->
<string name="file_clicked">クリックされたファイル: </string>
<!-- Emulation Window Overlay -->
<string name="overlay_savestate">ステートセーブ</string>
<string name="overlay_loadstate">ステートロード</string>
<string name="overlay_slot1">スロット 1</string>
<string name="overlay_slot2">スロット 2</string>
<string name="overlay_slot3">スロット 3</string>
<string name="overlay_slot4">スロット 4</string>
<string name="overlay_slot5">スロット 5</string>
<!-- Input Config Fragment -->
<string name="input_settings">入力設定</string>
<string name="input_binding">入力バインディング</string>

View File

@ -30,6 +30,15 @@
<!-- Game List Fragment -->
<string name="file_clicked">File clicked: </string>
<!-- Emulation Overlay -->
<string name="overlay_savestate">Save State</string>
<string name="overlay_loadstate">Load State</string>
<string name="overlay_slot1">Slot 1</string>
<string name="overlay_slot2">Slot 2</string>
<string name="overlay_slot3">Slot 3</string>
<string name="overlay_slot4">Slot 4</string>
<string name="overlay_slot5">Slot 5</string>
<!-- Input Config Fragment -->
<string name="input_settings">Input</string>
<string name="input_binding">Input Binding</string>

View File

@ -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)