mirror of
https://github.com/jamessanford/kegs.git
synced 2024-11-18 15:06:59 +00:00
Add warm reset menu option. (Open Apple-Control-Reset)
This commit is contained in:
parent
c0ecd8da18
commit
4b03473214
@ -8,4 +8,6 @@
|
||||
android:title="@string/input_controls_hide" />
|
||||
<item android:id="@+id/emulation_speed"
|
||||
android:title="@string/emulation_speed" />
|
||||
<item android:id="@+id/warm_reset"
|
||||
android:title="@string/warm_reset" />
|
||||
</menu>
|
||||
|
@ -28,4 +28,5 @@
|
||||
<string name="input_controls_hide">Hide Controls</string>
|
||||
<string name="input_controls_show">Show Controls</string>
|
||||
<string name="emulation_speed">Emulation Speed</string>
|
||||
<string name="warm_reset">Warm Reset</string>
|
||||
</resources>
|
||||
|
@ -105,6 +105,9 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
||||
} else if (item_id == R.id.emulation_speed) {
|
||||
new SpeedFragment().show(getFragmentManager(), FRAGMENT_SPEED);
|
||||
return true;
|
||||
} else if (item_id == R.id.warm_reset) {
|
||||
mKegsView.doWarmReset();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -222,6 +225,7 @@ public class KegsMain extends Activity implements KegsKeyboard.StickyReset {
|
||||
}
|
||||
} else {
|
||||
Rect displaySize = new Rect();
|
||||
// We use the mKegsView object here, but we could ask any view.
|
||||
mKegsView.getWindowVisibleDisplayFrame(displaySize);
|
||||
width = displaySize.width();
|
||||
height = displaySize.height();
|
||||
|
@ -147,6 +147,17 @@ class KegsView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
mEventQueue.add(new Event.KeyKegsEvent(speed + 0x80, true));
|
||||
}
|
||||
|
||||
public void doWarmReset() {
|
||||
// Press keys down.
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_OPEN_APPLE, false));
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_CONTROL, false));
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_RESET, false));
|
||||
// Release reset key first, then the others.
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_RESET, true));
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_CONTROL, true));
|
||||
mEventQueue.add(new Event.KeyKegsEvent(KegsKeyboard.KEY_OPEN_APPLE, true));
|
||||
}
|
||||
|
||||
public KegsThread getThread() {
|
||||
return thread;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user