CheatCodeDialog work in progress.

TIA greyout work in progress.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@793 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
urchlay 2005-09-25 18:35:26 +00:00
parent bf194366e1
commit c917e2ee93
5 changed files with 45 additions and 30 deletions

View File

@ -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: DebuggerParser.cxx,v 1.80 2005-09-23 23:35:02 stephena Exp $
// $Id: DebuggerParser.cxx,v 1.81 2005-09-25 18:35:26 urchlay Exp $
//============================================================================
#include "bspf.hxx"
@ -1225,7 +1225,7 @@ bool DebuggerParser::saveScriptFile(string file) {
FunctionDefMap funcs = debugger->getFunctionDefMap();
for(FunctionDefMap::const_iterator i = funcs.begin(); i != funcs.end(); ++i)
out << "function " << i->first << " " << i->second << endl;
out << "function " << i->first << " { " << i->second << " }" << endl;
for(unsigned int i=0; i<watches.size(); i++)
out << "watch " << watches[i] << endl;

View File

@ -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: TIA.cxx,v 1.59 2005-09-22 22:10:57 stephena Exp $
// $Id: TIA.cxx,v 1.60 2005-09-25 18:35:26 urchlay Exp $
//============================================================================
#include <cassert>
@ -516,8 +516,14 @@ void TIA::update()
uInt32 totalClocks = (mySystem->cycles() * 3) - myClockWhenFrameStarted;
myCurrentScanline = totalClocks / 228;
if(!myPartialFrameFlag)
if(myPartialFrameFlag) {
// grey out old frame contents
if(!myFrameGreyed) greyOutFrame();
myFrameGreyed = true;
} else {
endFrame();
myFrameGreyed = false;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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: CheatCodeDialog.cxx,v 1.2 2005-08-16 18:34:12 stephena Exp $
// $Id: CheatCodeDialog.cxx,v 1.3 2005-09-25 18:35:26 urchlay Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -38,14 +38,14 @@ CheatCodeDialog::CheatCodeDialog(OSystem* osystem, DialogContainer* parent,
int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h)
{
const GUI::Font& font = instance()->font();
// const GUI::Font& font = instance()->font();
myTitle = new StaticTextWidget(this, 10, 5, w - 20, kFontHeight, "Cheat Codes", kTextAlignCenter);
myTitle = new StaticTextWidget(this, 10, 5, w - 20, kFontHeight, "Cheat Code", kTextAlignCenter);
myError = new StaticTextWidget(this, 10, 32, w - 20, kFontHeight, "Invalid Code", kTextAlignLeft);
myError->setFlags(WIDGET_INVISIBLE);
myInput = new EditTextWidget(this, 10, 20, 48, kFontHeight, "");
addFocusWidget(myInput);
addButton(w - (kButtonWidth + 10), h - 24, "Close", kCloseCmd, 'C');
addButton(w - (kButtonWidth + 10), h - 48, "Load", kLoadCmd, 'C');
myEnableCheat = new CheckboxWidget(this, font, 10, 20, "Enabled", kEnableCheat);
myEnableCheat->setState(false);
myCheat = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -59,30 +59,36 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
{
switch(cmd)
{
case kLoadCmd:
myCheat = Cheat::parse("db000f");
loadConfig();
case kEditAcceptCmd:
cerr << myInput->getEditString() << endl;
myCheat = Cheat::parse(myInput->getEditString());
if(myCheat) {
myError->setFlags(WIDGET_INVISIBLE);
loadConfig();
draw();
myCheat->enable();
delete myCheat; // TODO: keep and add to list
Dialog::handleCommand(sender, kCloseCmd, data, id);
} else {
cerr << "bad cheat code" << endl;
myInput->setEditString("");
myError->clearFlags(WIDGET_INVISIBLE);
loadConfig();
draw();
Dialog::handleCommand(sender, cmd, data, 0);
}
break;
case kEnableCheat:
if(!myCheat)
myEnableCheat->setState(false);
else if(myCheat->enabled())
myCheat->disable();
else
myCheat->enable();
case kEditCancelCmd:
Dialog::handleCommand(sender, kCloseCmd, data, id);
break;
default:
Dialog::handleCommand(sender, cmd, data, 0);
break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheatCodeDialog::loadConfig() {
cerr << "CheatCodeDialog::loadConfig()" << endl;
myEnableCheat->setState(myCheat && myCheat->enabled());
myEnableCheat->setEnabled(myCheat != 0);
}

View File

@ -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: CheatCodeDialog.hxx,v 1.1 2005-08-05 02:28:22 urchlay Exp $
// $Id: CheatCodeDialog.hxx,v 1.2 2005-09-25 18:35:26 urchlay Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -31,6 +31,7 @@ class StaticTextWidget;
#include "Dialog.hxx"
#include "Widget.hxx"
#include "Cheat.hxx"
#include "EditTextWidget.hxx"
#include "Props.hxx"
#include "bspf.hxx"
@ -45,12 +46,14 @@ class CheatCodeDialog : public Dialog
protected:
ButtonWidget *myExitButton;
StaticTextWidget *myTitle;
CheckboxWidget *myEnableCheat;
StaticTextWidget *myError;
// CheckboxWidget *myEnableCheat;
private:
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig();
Cheat *myCheat;
EditTextWidget *myInput;
};
#endif

View File

@ -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: OptionsDialog.cxx,v 1.26 2005-09-06 22:25:40 stephena Exp $
// $Id: OptionsDialog.cxx,v 1.27 2005-09-25 18:35:26 urchlay Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -83,7 +83,7 @@ OptionsDialog::OptionsDialog(OSystem* osystem, DialogContainer* parent)
addBigButton("Event Mapping", kEMapCmd, 0);
addBigButton("Game Information", kInfoCmd, 0);
b = addBigButton("Cheat Code", kCheatCmd, 0);
b->clearFlags(WIDGET_ENABLED); // TODO - finish after next release
// b->clearFlags(WIDGET_ENABLED); // TODO - finish after next release
addBigButton("Help", kHelpCmd, 0);
addBigButton("About", kAboutCmd, 0);
addBigButton("Exit Menu", kExitCmd, 0);