Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Fixed errorneous pausing due to pauseEmulator being called during Act…
Browse files Browse the repository at this point in the history
…ionBar

validation no Honeycomb+
  • Loading branch information
Alexander-- committed Jan 2, 2013
1 parent aa7b3eb commit 75783bd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/com/androidemu/EmulatorActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,14 @@ public boolean onPrepareOptionsMenu(Menu menu)
if (!isMenuShowing)
{
isMenuShowing = true;
pauseEmulator();

// On Honeycomb and newer this function is called
// during some ActionBar manipulation, so no need to
// pause
if (Wrapper.SDK_INT < 11)
{
pauseEmulator();
}
}

return true;
Expand Down Expand Up @@ -403,20 +410,29 @@ public void run()

private void resumeEmulator()
{
debug("Resume requested");

if (resumeRequested++ == 0)
{
keyboard.reset();
keypad.reset();
trackball.reset();
onGameKeyChanged();

debug("Resuming");
emulator.resume();
}
}

private void pauseEmulator()
{
if (--resumeRequested == 0) emulator.pause();
debug("Pause requested");

if (--resumeRequested == 0)
{
debug("Pausing");
emulator.pause();
}
}

private static int getScalingMode(String mode)
Expand Down Expand Up @@ -600,7 +616,6 @@ private boolean loadROM(String fname, boolean failPrompt)
}
currentGame = fname;
hidePlaceholder();
emulatorView.setActualSize(Emulator.VIDEO_W, Emulator.VIDEO_H);

Wrapper.Activity_invalidateOptionsMenu(this);
return true;
Expand Down

0 comments on commit 75783bd

Please sign in to comment.