mirror of https://github.com/stella-emu/stella.git
CheatCodeDialog is semi-functional
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@794 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
c917e2ee93
commit
8f035f8e3f
|
@ -20,14 +20,14 @@ uInt16 Cheat::unhex(string hex) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cheat* Cheat::parse(string code) {
|
Cheat* Cheat::parse(OSystem *osystem, string code) {
|
||||||
for(unsigned int i=0; i<code.size(); i++)
|
for(unsigned int i=0; i<code.size(); i++)
|
||||||
if(!isxdigit(code[i]))
|
if(!isxdigit(code[i]))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch(code.size()) {
|
switch(code.size()) {
|
||||||
case 6:
|
case 6:
|
||||||
return new CheetahCheat(code);
|
return new CheetahCheat(osystem, code);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -3,10 +3,11 @@
|
||||||
#define CHEAT_HXX
|
#define CHEAT_HXX
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
#include "OSystem.hxx"
|
||||||
|
|
||||||
class Cheat {
|
class Cheat {
|
||||||
public:
|
public:
|
||||||
static Cheat *parse(string code);
|
static Cheat *parse(OSystem *osystem, string code);
|
||||||
static uInt16 unhex(string hex);
|
static uInt16 unhex(string hex);
|
||||||
|
|
||||||
virtual ~Cheat();
|
virtual ~Cheat();
|
||||||
|
|
|
@ -3,7 +3,8 @@
|
||||||
//#include "Debugger.hxx"
|
//#include "Debugger.hxx"
|
||||||
#include "CheetahCheat.hxx"
|
#include "CheetahCheat.hxx"
|
||||||
|
|
||||||
CheetahCheat::CheetahCheat(string code) {
|
CheetahCheat::CheetahCheat(OSystem *os, string code) {
|
||||||
|
myOSystem = os;
|
||||||
_enabled = false;
|
_enabled = false;
|
||||||
|
|
||||||
address = 0xf000 + unhex(code.substr(0, 3));
|
address = 0xf000 + unhex(code.substr(0, 3));
|
||||||
|
@ -17,20 +18,16 @@ CheetahCheat::~CheetahCheat() {
|
||||||
bool CheetahCheat::enabled() { return _enabled; }
|
bool CheetahCheat::enabled() { return _enabled; }
|
||||||
|
|
||||||
bool CheetahCheat::enable() {
|
bool CheetahCheat::enable() {
|
||||||
/* FIXME
|
|
||||||
for(int i=0; i<count; i++) {
|
for(int i=0; i<count; i++) {
|
||||||
savedRom[i] = Debugger::debugger().peek(address + i);
|
savedRom[i] = myOSystem->console().cartridge().peek(address + i);
|
||||||
Debugger::debugger().patchROM(address + i, value);
|
myOSystem->console().cartridge().patch(address + i, value);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return _enabled = true;
|
return _enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheetahCheat::disable() {
|
bool CheetahCheat::disable() {
|
||||||
/* FIXME
|
|
||||||
for(int i=0; i<count; i++) {
|
for(int i=0; i<count; i++) {
|
||||||
Debugger::debugger().patchROM(address + i, savedRom[i]);
|
myOSystem->console().cartridge().patch(address + i, savedRom[i]);
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return _enabled = false;
|
return _enabled = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
#ifndef CHEETAH_CHEAT_HXX
|
#ifndef CHEETAH_CHEAT_HXX
|
||||||
#define CHEETAH_CHEAT_HXX
|
#define CHEETAH_CHEAT_HXX
|
||||||
|
|
||||||
|
#include "OSystem.hxx"
|
||||||
#include "Cheat.hxx"
|
#include "Cheat.hxx"
|
||||||
|
|
||||||
class CheetahCheat : public Cheat {
|
class CheetahCheat : public Cheat {
|
||||||
public:
|
public:
|
||||||
CheetahCheat(string code);
|
CheetahCheat(OSystem *os, string code);
|
||||||
~CheetahCheat();
|
~CheetahCheat();
|
||||||
|
|
||||||
virtual bool enabled();
|
virtual bool enabled();
|
||||||
|
@ -20,6 +21,7 @@ class CheetahCheat : public Cheat {
|
||||||
uInt16 address;
|
uInt16 address;
|
||||||
uInt8 value;
|
uInt8 value;
|
||||||
uInt8 count;
|
uInt8 count;
|
||||||
|
OSystem *myOSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// 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: 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
|
#ifndef DEBUGGER_HXX
|
||||||
|
@ -79,7 +79,7 @@ typedef uInt16 (Debugger::*DEBUGGER_WORD_METHOD)();
|
||||||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||||
|
|
||||||
@author Stephen Anthony
|
@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
|
class Debugger : public DialogContainer
|
||||||
{
|
{
|
||||||
|
@ -99,6 +99,8 @@ class Debugger : public DialogContainer
|
||||||
virtual ~Debugger();
|
virtual ~Debugger();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
OSystem *getOSystem() { return myOSystem; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Updates the basedialog to be of the type defined for this derived class.
|
Updates the basedialog to be of the type defined for this derived class.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// 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: 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"
|
#include "bspf.hxx"
|
||||||
|
@ -1369,7 +1369,7 @@ void DebuggerParser::executeCheetah() {
|
||||||
|
|
||||||
for(int arg = 0; arg < argCount; arg++) {
|
for(int arg = 0; arg < argCount; arg++) {
|
||||||
string& cheat = argStrings[arg];
|
string& cheat = argStrings[arg];
|
||||||
Cheat *c = Cheat::parse(cheat);
|
Cheat *c = Cheat::parse(debugger->getOSystem(), cheat);
|
||||||
if(c) {
|
if(c) {
|
||||||
c->enable();
|
c->enable();
|
||||||
commandResult = "Cheetah code " + cheat + " enabled\n";
|
commandResult = "Cheetah code " + cheat + " enabled\n";
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// 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: 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 <cassert>
|
#include <cassert>
|
||||||
|
@ -522,7 +522,6 @@ void TIA::update()
|
||||||
myFrameGreyed = true;
|
myFrameGreyed = true;
|
||||||
} else {
|
} else {
|
||||||
endFrame();
|
endFrame();
|
||||||
myFrameGreyed = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,6 +570,8 @@ inline void TIA::startFrame() {
|
||||||
myCOLUBK &= 0xfefefefe;
|
myCOLUBK &= 0xfefefefe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
myFrameGreyed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -581,6 +582,8 @@ inline void TIA::endFrame() {
|
||||||
|
|
||||||
// Stats counters
|
// Stats counters
|
||||||
myFrameCounter++;
|
myFrameCounter++;
|
||||||
|
|
||||||
|
myFrameGreyed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -589,7 +592,6 @@ void TIA::updateScanline()
|
||||||
// Start a new frame if the old one was finished
|
// Start a new frame if the old one was finished
|
||||||
if(!myPartialFrameFlag) {
|
if(!myPartialFrameFlag) {
|
||||||
startFrame();
|
startFrame();
|
||||||
myFrameGreyed = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// grey out old frame contents
|
// grey out old frame contents
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// 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: 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
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -61,7 +61,7 @@ void CheatCodeDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
{
|
{
|
||||||
case kEditAcceptCmd:
|
case kEditAcceptCmd:
|
||||||
cerr << myInput->getEditString() << endl;
|
cerr << myInput->getEditString() << endl;
|
||||||
myCheat = Cheat::parse(myInput->getEditString());
|
myCheat = Cheat::parse(instance(), myInput->getEditString());
|
||||||
if(myCheat) {
|
if(myCheat) {
|
||||||
myError->setFlags(WIDGET_INVISIBLE);
|
myError->setFlags(WIDGET_INVISIBLE);
|
||||||
loadConfig();
|
loadConfig();
|
||||||
|
|
Loading…
Reference in New Issue