mirror of https://github.com/stella-emu/stella.git
Fixed segfault when a ROM had per-frame cheats enabled. Apparently the
cheats were being evaluated even after the console was deleted. Also moved saving of cheats out of the Console d'tor. I never liked that required functionality was in a d'tor; it felt sort of hacky. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1257 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
f0a3700e53
commit
32f8c8ba2f
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: CheatManager.cxx,v 1.11 2006-12-08 16:48:55 stephena Exp $
|
||||
// $Id: CheatManager.cxx,v 1.12 2006-12-31 17:21:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <sstream>
|
||||
|
@ -339,6 +339,7 @@ void CheatManager::saveCheats(const string& md5sum)
|
|||
|
||||
// Update the dirty flag
|
||||
myListIsDirty = myListIsDirty || changed;
|
||||
clear();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Console.cxx,v 1.117 2006-12-31 02:16:37 stephena Exp $
|
||||
// $Id: Console.cxx,v 1.118 2006-12-31 17:21:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -229,10 +229,6 @@ Console::Console(OSystem* osystem, Cartridge* cart, const Properties& props)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Console::~Console()
|
||||
{
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
myOSystem->cheat().saveCheats(myProperties.get(Cartridge_MD5));
|
||||
#endif
|
||||
|
||||
delete mySystem;
|
||||
delete mySwitches;
|
||||
delete myControllers[0];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: OSystem.cxx,v 1.87 2006-12-30 22:26:28 stephena Exp $
|
||||
// $Id: OSystem.cxx,v 1.88 2006-12-31 17:21:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -397,9 +397,12 @@ bool OSystem::createConsole(const string& romfile)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::deleteConsole()
|
||||
{
|
||||
mySound->close();
|
||||
if(myConsole)
|
||||
{
|
||||
mySound->close();
|
||||
#ifdef CHEATCODE_SUPPORT
|
||||
myCheatManager->saveCheats(myConsole->properties().get(Cartridge_MD5));
|
||||
#endif
|
||||
if(mySettings->getBool("showinfo"))
|
||||
{
|
||||
double executionTime = (double) myTimingInfo.totalTime / 1000000.0;
|
||||
|
@ -417,18 +420,14 @@ void OSystem::deleteConsole()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void OSystem::createLauncher()
|
||||
{
|
||||
resetLoopTiming();
|
||||
|
||||
setFramerate(60);
|
||||
myEventHandler->reset(EventHandler::S_LAUNCHER);
|
||||
createFrameBuffer(false);
|
||||
|
||||
// And start the base dialog
|
||||
myLauncher->initialize();
|
||||
myLauncher->reStack();
|
||||
|
||||
myEventHandler->refreshDisplay();
|
||||
myFrameBuffer->setCursorState();
|
||||
myEventHandler->refreshDisplay();
|
||||
|
||||
setFramerate(60);
|
||||
resetLoopTiming();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -692,7 +691,6 @@ void OSystem::mainLoop()
|
|||
myEventHandler->poll(myTimingInfo.start);
|
||||
if(myQuitLoop) break; // Exit if the user wants to quit
|
||||
myFrameBuffer->update();
|
||||
|
||||
myTimingInfo.current = getTicks();
|
||||
myTimingInfo.virt += myTimePerFrame;
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Launcher.cxx,v 1.8 2006-12-08 16:49:35 stephena Exp $
|
||||
// $Id: Launcher.cxx,v 1.9 2006-12-31 17:21:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "Version.hxx"
|
||||
|
@ -25,8 +25,10 @@
|
|||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Launcher::Launcher(OSystem* osystem)
|
||||
: DialogContainer(osystem)
|
||||
: DialogContainer(osystem)
|
||||
{
|
||||
myBaseDialog = new LauncherDialog(myOSystem, this,
|
||||
0, 0, kLauncherWidth, kLauncherHeight);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -34,16 +36,6 @@ Launcher::~Launcher()
|
|||
{
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Launcher::initialize()
|
||||
{
|
||||
// We only create one instance of this dialog, since each time we do so,
|
||||
// the ROM listing is read from disk. This can be very expensive.
|
||||
if(myBaseDialog == NULL)
|
||||
myBaseDialog = new LauncherDialog(myOSystem, this,
|
||||
0, 0, kLauncherWidth, kLauncherHeight);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Launcher::initializeVideo()
|
||||
{
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Launcher.hxx,v 1.6 2006-12-08 16:49:35 stephena Exp $
|
||||
// $Id: Launcher.hxx,v 1.7 2006-12-31 17:21:17 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef LAUNCHER_HXX
|
||||
|
@ -34,7 +34,7 @@ enum {
|
|||
The base dialog for the ROM launcher in Stella.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Launcher.hxx,v 1.6 2006-12-08 16:49:35 stephena Exp $
|
||||
@version $Id: Launcher.hxx,v 1.7 2006-12-31 17:21:17 stephena Exp $
|
||||
*/
|
||||
class Launcher : public DialogContainer
|
||||
{
|
||||
|
@ -49,12 +49,6 @@ class Launcher : public DialogContainer
|
|||
*/
|
||||
virtual ~Launcher();
|
||||
|
||||
public:
|
||||
/**
|
||||
Updates the basedialog to be of the type defined for this derived class.
|
||||
*/
|
||||
void initialize();
|
||||
|
||||
/**
|
||||
Initialize the video subsystem wrt this class.
|
||||
*/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: LauncherDialog.cxx,v 1.63 2006-12-30 22:26:29 stephena Exp $
|
||||
// $Id: LauncherDialog.cxx,v 1.64 2006-12-31 17:21:17 stephena Exp $
|
||||
//
|
||||
// Based on code from ScummVM - Scumm Interpreter
|
||||
// Copyright (C) 2002-2004 The ScummVM project
|
||||
|
@ -139,13 +139,6 @@ LauncherDialog::LauncherDialog(OSystem* osystem, DialogContainer* parent,
|
|||
myGameList = new GameList();
|
||||
|
||||
addToFocusList(wid);
|
||||
|
||||
// (De)activate browse mode
|
||||
myBrowseModeFlag = instance()->settings().getBool("rombrowse");
|
||||
myPrevDirButton->setEnabled(myBrowseModeFlag);
|
||||
myNoteLabel->setLabel(myBrowseModeFlag ? "Dir:" : "Note:");
|
||||
|
||||
myCurrentNode = instance()->settings().getString("romdir");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
@ -161,8 +154,15 @@ void LauncherDialog::loadConfig()
|
|||
// Assume that if the list is empty, this is the first time that loadConfig()
|
||||
// has been called (and we should reload the list).
|
||||
if(myList->getList().isEmpty())
|
||||
updateListing();
|
||||
{
|
||||
// (De)activate browse mode
|
||||
myBrowseModeFlag = instance()->settings().getBool("rombrowse");
|
||||
myPrevDirButton->setEnabled(myBrowseModeFlag);
|
||||
myNoteLabel->setLabel(myBrowseModeFlag ? "Dir:" : "Note:");
|
||||
myCurrentNode = instance()->settings().getString("romdir");
|
||||
|
||||
updateListing();
|
||||
}
|
||||
Dialog::setFocus(getFocusList()[mySelectedItem]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue