From 8f035f8e3f6e96e76af8375dd887ba98c5a49195 Mon Sep 17 00:00:00 2001 From: urchlay Date: Sun, 25 Sep 2005 20:18:46 +0000 Subject: [PATCH] CheatCodeDialog is semi-functional git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@794 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- stella/src/common/Cheat.cxx | 4 ++-- stella/src/common/Cheat.hxx | 3 ++- stella/src/common/CheetahCheat.cxx | 13 +++++-------- stella/src/common/CheetahCheat.hxx | 4 +++- stella/src/debugger/Debugger.hxx | 6 ++++-- stella/src/debugger/DebuggerParser.cxx | 4 ++-- stella/src/emucore/TIA.cxx | 8 +++++--- stella/src/gui/CheatCodeDialog.cxx | 4 ++-- 8 files changed, 25 insertions(+), 21 deletions(-) diff --git a/stella/src/common/Cheat.cxx b/stella/src/common/Cheat.cxx index 3fa8ab404..821801ba6 100644 --- a/stella/src/common/Cheat.cxx +++ b/stella/src/common/Cheat.cxx @@ -20,14 +20,14 @@ uInt16 Cheat::unhex(string hex) { return ret; } -Cheat* Cheat::parse(string code) { +Cheat* Cheat::parse(OSystem *osystem, string code) { for(unsigned int i=0; iconsole().cartridge().peek(address + i); + myOSystem->console().cartridge().patch(address + i, value); } -*/ return _enabled = true; } bool CheetahCheat::disable() { -/* FIXME for(int i=0; iconsole().cartridge().patch(address + i, savedRom[i]); } -*/ return _enabled = false; } diff --git a/stella/src/common/CheetahCheat.hxx b/stella/src/common/CheetahCheat.hxx index 6d024f4a3..13c9d47cc 100644 --- a/stella/src/common/CheetahCheat.hxx +++ b/stella/src/common/CheetahCheat.hxx @@ -2,11 +2,12 @@ #ifndef CHEETAH_CHEAT_HXX #define CHEETAH_CHEAT_HXX +#include "OSystem.hxx" #include "Cheat.hxx" class CheetahCheat : public Cheat { public: - CheetahCheat(string code); + CheetahCheat(OSystem *os, string code); ~CheetahCheat(); virtual bool enabled(); @@ -20,6 +21,7 @@ class CheetahCheat : public Cheat { uInt16 address; uInt8 value; uInt8 count; + OSystem *myOSystem; }; #endif diff --git a/stella/src/debugger/Debugger.hxx b/stella/src/debugger/Debugger.hxx index 43e53eae3..fbaa85c3c 100644 --- a/stella/src/debugger/Debugger.hxx +++ b/stella/src/debugger/Debugger.hxx @@ -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: Debugger.hxx,v 1.77 2005-09-23 17:38:26 stephena Exp $ +// $Id: Debugger.hxx,v 1.78 2005-09-25 20:18:46 urchlay Exp $ //============================================================================ #ifndef DEBUGGER_HXX @@ -79,7 +79,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)(); for all debugging operations in Stella (parser, 6502 debugger, etc). @author Stephen Anthony - @version $Id: Debugger.hxx,v 1.77 2005-09-23 17:38:26 stephena Exp $ + @version $Id: Debugger.hxx,v 1.78 2005-09-25 20:18:46 urchlay Exp $ */ class Debugger : public DialogContainer { @@ -99,6 +99,8 @@ class Debugger : public DialogContainer virtual ~Debugger(); public: + OSystem *getOSystem() { return myOSystem; } + /** Updates the basedialog to be of the type defined for this derived class. */ diff --git a/stella/src/debugger/DebuggerParser.cxx b/stella/src/debugger/DebuggerParser.cxx index 7f58afdb7..56b946a39 100644 --- a/stella/src/debugger/DebuggerParser.cxx +++ b/stella/src/debugger/DebuggerParser.cxx @@ -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.81 2005-09-25 18:35:26 urchlay Exp $ +// $Id: DebuggerParser.cxx,v 1.82 2005-09-25 20:18:46 urchlay Exp $ //============================================================================ #include "bspf.hxx" @@ -1369,7 +1369,7 @@ void DebuggerParser::executeCheetah() { for(int arg = 0; arg < argCount; arg++) { string& cheat = argStrings[arg]; - Cheat *c = Cheat::parse(cheat); + Cheat *c = Cheat::parse(debugger->getOSystem(), cheat); if(c) { c->enable(); commandResult = "Cheetah code " + cheat + " enabled\n"; diff --git a/stella/src/emucore/TIA.cxx b/stella/src/emucore/TIA.cxx index 792602f37..600968ccc 100644 --- a/stella/src/emucore/TIA.cxx +++ b/stella/src/emucore/TIA.cxx @@ -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.60 2005-09-25 18:35:26 urchlay Exp $ +// $Id: TIA.cxx,v 1.61 2005-09-25 20:18:46 urchlay Exp $ //============================================================================ #include @@ -522,7 +522,6 @@ void TIA::update() myFrameGreyed = true; } else { endFrame(); - myFrameGreyed = false; } } @@ -571,6 +570,8 @@ inline void TIA::startFrame() { myCOLUBK &= 0xfefefefe; } } + + myFrameGreyed = false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -581,6 +582,8 @@ inline void TIA::endFrame() { // Stats counters myFrameCounter++; + + myFrameGreyed = false; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -589,7 +592,6 @@ void TIA::updateScanline() // Start a new frame if the old one was finished if(!myPartialFrameFlag) { startFrame(); - myFrameGreyed = false; } // grey out old frame contents diff --git a/stella/src/gui/CheatCodeDialog.cxx b/stella/src/gui/CheatCodeDialog.cxx index 4f6936f46..3759f2499 100644 --- a/stella/src/gui/CheatCodeDialog.cxx +++ b/stella/src/gui/CheatCodeDialog.cxx @@ -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.3 2005-09-25 18:35:26 urchlay Exp $ +// $Id: CheatCodeDialog.cxx,v 1.4 2005-09-25 20:18:46 urchlay Exp $ // // Based on code from ScummVM - Scumm Interpreter // Copyright (C) 2002-2004 The ScummVM project @@ -61,7 +61,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd, { case kEditAcceptCmd: cerr << myInput->getEditString() << endl; - myCheat = Cheat::parse(myInput->getEditString()); + myCheat = Cheat::parse(instance(), myInput->getEditString()); if(myCheat) { myError->setFlags(WIDGET_INVISIBLE); loadConfig();