From 0ae02cb0be2ca4f8ddff5e173425e98837f36836 Mon Sep 17 00:00:00 2001 From: stephena Date: Sat, 17 May 2008 15:16:45 +0000 Subject: [PATCH] Made an empty EEPROM default to all $FF. Fixed bug in commandmenu where console command buttons weren't working. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1516 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/emucore/MT24LC256.cxx | 7 +++---- stella/src/gui/CommandDialog.cxx | 34 +++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/stella/src/emucore/MT24LC256.cxx b/stella/src/emucore/MT24LC256.cxx index e3c663afb..f2dfc38cb 100644 --- a/stella/src/emucore/MT24LC256.cxx +++ b/stella/src/emucore/MT24LC256.cxx @@ -13,11 +13,12 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: MT24LC256.cxx,v 1.11 2008-05-15 19:05:09 stephena Exp $ +// $Id: MT24LC256.cxx,v 1.12 2008-05-17 15:16:45 stephena Exp $ //============================================================================ #include #include +#include #include #include "System.hxx" @@ -157,9 +158,7 @@ void MT24LC256::jpee_init() jpee_smallmode = 0; jpee_logmode = -1; if(!myDataFileExists) - for(int i = 0; i < 256; i++) - for(int j = 0; j < 128; j++) - myData[i + j*256] = (i+1)*(j+1); + memset(myData, 0xff, 32768); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/stella/src/gui/CommandDialog.cxx b/stella/src/gui/CommandDialog.cxx index f2c3e2ab4..edb7c777e 100644 --- a/stella/src/gui/CommandDialog.cxx +++ b/stella/src/gui/CommandDialog.cxx @@ -13,13 +13,14 @@ // See the file "license" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: CommandDialog.cxx,v 1.18 2008-03-30 15:01:38 stephena Exp $ +// $Id: CommandDialog.cxx,v 1.19 2008-05-17 15:16:45 stephena Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project //============================================================================ #include "Console.hxx" +#include "Switches.hxx" #include "DialogContainer.hxx" #include "Dialog.hxx" #include "EventHandler.hxx" @@ -128,96 +129,105 @@ CommandDialog::~CommandDialog() void CommandDialog::handleCommand(CommandSender* sender, int cmd, int data, int id) { - bool execute = true; + bool consoleCmd = false, stateCmd = false; Event::Type event = Event::NoType; switch(cmd) { case kSelectCmd: event = Event::ConsoleSelect; + consoleCmd = true; break; case kResetCmd: event = Event::ConsoleReset; + consoleCmd = true; break; case kColorCmd: event = Event::ConsoleColor; + consoleCmd = true; break; case kBWCmd: event = Event::ConsoleBlackWhite; + consoleCmd = true; break; case kLeftDiffACmd: event = Event::ConsoleLeftDifficultyA; + consoleCmd = true; break; case kLeftDiffBCmd: event = Event::ConsoleLeftDifficultyB; + consoleCmd = true; break; case kRightDiffACmd: event = Event::ConsoleRightDifficultyA; + consoleCmd = true; break; case kRightDiffBCmd: event = Event::ConsoleRightDifficultyB; + consoleCmd = true; break; case kSaveStateCmd: event = Event::SaveState; + stateCmd = true; break; case kStateSlotCmd: event = Event::ChangeState; + stateCmd = true; break; case kLoadStateCmd: event = Event::LoadState; + stateCmd = true; break; case kSnapshotCmd: instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().refreshDisplay(true); instance()->eventHandler().handleEvent(Event::TakeSnapshot, 1); - execute = false; break; case kFormatCmd: instance()->eventHandler().leaveMenuMode(); instance()->console().toggleFormat(); - execute = false; break; case kPaletteCmd: instance()->eventHandler().leaveMenuMode(); instance()->console().togglePalette(); - execute = false; break; case kReloadRomCmd: instance()->eventHandler().leaveMenuMode(); instance()->deleteConsole(); instance()->createConsole(); - execute = false; break; case kExitCmd: instance()->eventHandler().handleEvent(Event::LauncherMode, 1); - execute = false; break; - - default: - execute = false; } - // Show changes onscreen - if(execute) + // Console commands show be performed right away, after leaving the menu + // State commands require you to exit the menu manually + if(consoleCmd) { instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().handleEvent(event, 1); + instance()->console().switches().update(); instance()->console().mediaSource().update(); instance()->eventHandler().handleEvent(event, 0); } + else if(stateCmd) + { + instance()->eventHandler().handleEvent(event, 1); + } }