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
This commit is contained in:
stephena 2008-05-17 15:16:45 +00:00
parent a45191dbe3
commit 0ae02cb0be
2 changed files with 25 additions and 16 deletions

View File

@ -13,11 +13,12 @@
// 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: 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 <cassert> #include <cassert>
#include <cstdio> #include <cstdio>
#include <cstring>
#include <fstream> #include <fstream>
#include "System.hxx" #include "System.hxx"
@ -157,9 +158,7 @@ void MT24LC256::jpee_init()
jpee_smallmode = 0; jpee_smallmode = 0;
jpee_logmode = -1; jpee_logmode = -1;
if(!myDataFileExists) if(!myDataFileExists)
for(int i = 0; i < 256; i++) memset(myData, 0xff, 32768);
for(int j = 0; j < 128; j++)
myData[i + j*256] = (i+1)*(j+1);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,13 +13,14 @@
// 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: 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 // Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project // Copyright (C) 2002-2004 The ScummVM project
//============================================================================ //============================================================================
#include "Console.hxx" #include "Console.hxx"
#include "Switches.hxx"
#include "DialogContainer.hxx" #include "DialogContainer.hxx"
#include "Dialog.hxx" #include "Dialog.hxx"
#include "EventHandler.hxx" #include "EventHandler.hxx"
@ -128,96 +129,105 @@ CommandDialog::~CommandDialog()
void CommandDialog::handleCommand(CommandSender* sender, int cmd, void CommandDialog::handleCommand(CommandSender* sender, int cmd,
int data, int id) int data, int id)
{ {
bool execute = true; bool consoleCmd = false, stateCmd = false;
Event::Type event = Event::NoType; Event::Type event = Event::NoType;
switch(cmd) switch(cmd)
{ {
case kSelectCmd: case kSelectCmd:
event = Event::ConsoleSelect; event = Event::ConsoleSelect;
consoleCmd = true;
break; break;
case kResetCmd: case kResetCmd:
event = Event::ConsoleReset; event = Event::ConsoleReset;
consoleCmd = true;
break; break;
case kColorCmd: case kColorCmd:
event = Event::ConsoleColor; event = Event::ConsoleColor;
consoleCmd = true;
break; break;
case kBWCmd: case kBWCmd:
event = Event::ConsoleBlackWhite; event = Event::ConsoleBlackWhite;
consoleCmd = true;
break; break;
case kLeftDiffACmd: case kLeftDiffACmd:
event = Event::ConsoleLeftDifficultyA; event = Event::ConsoleLeftDifficultyA;
consoleCmd = true;
break; break;
case kLeftDiffBCmd: case kLeftDiffBCmd:
event = Event::ConsoleLeftDifficultyB; event = Event::ConsoleLeftDifficultyB;
consoleCmd = true;
break; break;
case kRightDiffACmd: case kRightDiffACmd:
event = Event::ConsoleRightDifficultyA; event = Event::ConsoleRightDifficultyA;
consoleCmd = true;
break; break;
case kRightDiffBCmd: case kRightDiffBCmd:
event = Event::ConsoleRightDifficultyB; event = Event::ConsoleRightDifficultyB;
consoleCmd = true;
break; break;
case kSaveStateCmd: case kSaveStateCmd:
event = Event::SaveState; event = Event::SaveState;
stateCmd = true;
break; break;
case kStateSlotCmd: case kStateSlotCmd:
event = Event::ChangeState; event = Event::ChangeState;
stateCmd = true;
break; break;
case kLoadStateCmd: case kLoadStateCmd:
event = Event::LoadState; event = Event::LoadState;
stateCmd = true;
break; break;
case kSnapshotCmd: case kSnapshotCmd:
instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().leaveMenuMode();
instance()->eventHandler().refreshDisplay(true); instance()->eventHandler().refreshDisplay(true);
instance()->eventHandler().handleEvent(Event::TakeSnapshot, 1); instance()->eventHandler().handleEvent(Event::TakeSnapshot, 1);
execute = false;
break; break;
case kFormatCmd: case kFormatCmd:
instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().leaveMenuMode();
instance()->console().toggleFormat(); instance()->console().toggleFormat();
execute = false;
break; break;
case kPaletteCmd: case kPaletteCmd:
instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().leaveMenuMode();
instance()->console().togglePalette(); instance()->console().togglePalette();
execute = false;
break; break;
case kReloadRomCmd: case kReloadRomCmd:
instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().leaveMenuMode();
instance()->deleteConsole(); instance()->deleteConsole();
instance()->createConsole(); instance()->createConsole();
execute = false;
break; break;
case kExitCmd: case kExitCmd:
instance()->eventHandler().handleEvent(Event::LauncherMode, 1); instance()->eventHandler().handleEvent(Event::LauncherMode, 1);
execute = false;
break; break;
default:
execute = false;
} }
// Show changes onscreen // Console commands show be performed right away, after leaving the menu
if(execute) // State commands require you to exit the menu manually
if(consoleCmd)
{ {
instance()->eventHandler().leaveMenuMode(); instance()->eventHandler().leaveMenuMode();
instance()->eventHandler().handleEvent(event, 1); instance()->eventHandler().handleEvent(event, 1);
instance()->console().switches().update();
instance()->console().mediaSource().update(); instance()->console().mediaSource().update();
instance()->eventHandler().handleEvent(event, 0); instance()->eventHandler().handleEvent(event, 0);
} }
else if(stateCmd)
{
instance()->eventHandler().handleEvent(event, 1);
}
} }