mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
Android: Save screenshot at end of an emulation session.
This commit is contained in:
@ -274,6 +274,12 @@ public final class NativeLibrary
|
||||
});
|
||||
}
|
||||
|
||||
public static void endEmulationActivity()
|
||||
{
|
||||
Log.v("DolphinEmu", "Ending EmulationActivity.");
|
||||
mEmulationActivity.finish();
|
||||
}
|
||||
|
||||
public static void setEmulationActivity(EmulationActivity emulationActivity)
|
||||
{
|
||||
Log.v("DolphinEmu", "Registering EmulationActivity.");
|
||||
|
@ -150,7 +150,11 @@ public final class EmulationActivity extends AppCompatActivity
|
||||
else
|
||||
{
|
||||
// Let the system handle it; i.e. quit the activity TODO or show "are you sure?" dialog.
|
||||
super.onBackPressed();
|
||||
EmulationFragment fragment = (EmulationFragment) getFragmentManager()
|
||||
.findFragmentByTag(EmulationFragment.FRAGMENT_TAG);
|
||||
fragment.notifyEmulationStopped();
|
||||
|
||||
NativeLibrary.StopEmulation();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,6 +127,13 @@ public final class MainActivity extends AppCompatActivity implements LoaderManag
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
super.onResume();
|
||||
mAdapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCreateOptionsMenu(Menu menu)
|
||||
{
|
||||
|
@ -119,7 +119,7 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
public void onDestroyView()
|
||||
{
|
||||
super.onDestroyView();
|
||||
if (getActivity().isFinishing())
|
||||
if (getActivity().isFinishing() && mEmulationStarted)
|
||||
{
|
||||
NativeLibrary.StopEmulation();
|
||||
}
|
||||
@ -195,6 +195,16 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C
|
||||
mEmulationRunning = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called by containing activity to tell the Fragment emulation is already stopping,
|
||||
* so it doesn't try to stop emulation on its way to the garbage collector.
|
||||
*/
|
||||
public void notifyEmulationStopped()
|
||||
{
|
||||
mEmulationStarted = false;
|
||||
mEmulationRunning = false;
|
||||
}
|
||||
|
||||
private Runnable mEmulationRunner = new Runnable()
|
||||
{
|
||||
@Override
|
||||
|
@ -113,21 +113,7 @@ public final class Game
|
||||
{
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
// TODO Come up with a way of finding the most recent screenshot that doesn't involve counting files
|
||||
String screenshotFolderPath = PATH_SCREENSHOT_FOLDER + gameId + "/";
|
||||
|
||||
// Count how many screenshots are available, so we can use the most recent one.
|
||||
File screenshotFolder = new File(screenshotFolderPath.substring(screenshotFolderPath.indexOf('s') - 1));
|
||||
int screenCount = 0;
|
||||
|
||||
if (screenshotFolder.isDirectory())
|
||||
{
|
||||
screenCount = screenshotFolder.list().length;
|
||||
}
|
||||
|
||||
String screenPath = screenshotFolderPath
|
||||
+ gameId + "-"
|
||||
+ screenCount + ".png";
|
||||
String screenPath = PATH_SCREENSHOT_FOLDER + gameId + "/thumb.png";
|
||||
|
||||
values.put(GameDatabase.KEY_GAME_PLATFORM, platform);
|
||||
values.put(GameDatabase.KEY_GAME_TITLE, title);
|
||||
|
Reference in New Issue
Block a user