mirror of https://github.com/stella-emu/stella.git
Re-added 'lastrom' functionality, where the last ROM successfully loaded
is remembered from a previous run, and autoselected the next time Stella starts. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1453 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c90e67d398
commit
5a50164c9c
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: Settings.cxx,v 1.140 2008-03-30 15:01:38 stephena Exp $
|
// $Id: Settings.cxx,v 1.141 2008-03-30 15:47:10 stephena Exp $
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -88,6 +88,7 @@ Settings::Settings(OSystem* osystem)
|
||||||
setInternal("launcherres", "640x480");
|
setInternal("launcherres", "640x480");
|
||||||
setInternal("launcherfont", "small");
|
setInternal("launcherfont", "small");
|
||||||
setInternal("romviewer", "false");
|
setInternal("romviewer", "false");
|
||||||
|
setInternal("lastrom", "");
|
||||||
|
|
||||||
// UI-related options
|
// UI-related options
|
||||||
setInternal("debuggerres", "1030x690");
|
setInternal("debuggerres", "1030x690");
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: LauncherDialog.cxx,v 1.85 2008-03-23 16:22:46 stephena Exp $
|
// $Id: LauncherDialog.cxx,v 1.86 2008-03-30 15:47:10 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -243,7 +243,31 @@ void LauncherDialog::updateListing(bool fullReload)
|
||||||
buf << (myGameList->size() - 1) << " items found";
|
buf << (myGameList->size() - 1) << " items found";
|
||||||
myRomCount->setLabel(buf.str());
|
myRomCount->setLabel(buf.str());
|
||||||
|
|
||||||
myList->setSelected(myList->getList().isEmpty() ? -1 : 0);
|
// Restore last selection
|
||||||
|
int selected = -1;
|
||||||
|
if(!myList->getList().isEmpty())
|
||||||
|
{
|
||||||
|
string lastrom = instance()->settings().getString("lastrom");
|
||||||
|
if(lastrom == "")
|
||||||
|
selected = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unsigned int itemToSelect = 0;
|
||||||
|
StringList::const_iterator iter;
|
||||||
|
for(iter = myList->getList().begin(); iter != myList->getList().end();
|
||||||
|
++iter, ++itemToSelect)
|
||||||
|
{
|
||||||
|
if(lastrom == *iter)
|
||||||
|
{
|
||||||
|
selected = itemToSelect;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(itemToSelect > myList->getList().size())
|
||||||
|
selected = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
myList->setSelected(selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -330,6 +354,12 @@ void LauncherDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
instance()->frameBuffer().showMessage("Not a valid ROM file", kMiddleCenter);
|
instance()->frameBuffer().showMessage("Not a valid ROM file", kMiddleCenter);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
#if !defined(GP2X) // Quick GP2X hack to spare flash-card saves
|
||||||
|
instance()->settings().setString("lastrom", myList->getSelectedString());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue