Second pass at optimizing header files, to eliminate cascaded compiles.

This commit is contained in:
Stephen Anthony 2017-11-16 13:31:20 -03:30
parent 838b277c0a
commit a7f1764411
27 changed files with 307 additions and 115 deletions

View File

@ -19,6 +19,7 @@
#include "bspf.hxx"
#include "System.hxx"
#include "M6502.hxx"
#include "FSNode.hxx"
#include "DiStella.hxx"
#include "Debugger.hxx"

View File

@ -21,6 +21,10 @@
class Settings;
class CartDebugWidget;
// Function type for CartDebug instance methods
class CartDebug;
using CartMethod = int (CartDebug::*)();
#include <map>
#include <set>
#include <list>
@ -28,10 +32,6 @@ class CartDebugWidget;
#include "bspf.hxx"
#include "DebuggerSystem.hxx"
// Function type for CartDebug instance methods
class CartDebug;
using CartMethod = int (CartDebug::*)();
class CartState : public DebuggerState
{
public:

View File

@ -18,6 +18,7 @@
#include <sstream>
#include "M6502.hxx"
#include "System.hxx"
#include "Debugger.hxx"
#include "CartDebug.hxx"
#include "TIADebug.hxx"
@ -69,6 +70,78 @@ void CpuDebug::saveOldState()
Debugger::set_bits(myOldState.PS, myOldState.PSbits);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::pc() const
{
return mySystem.m6502().PC;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::sp() const
{
return mySystem.m6502().SP;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::a() const
{
return mySystem.m6502().A;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::x() const
{
return mySystem.m6502().X;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::y() const
{
return mySystem.m6502().Y;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::n() const
{
return mySystem.m6502().N;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::v() const
{
return mySystem.m6502().V;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::b() const
{
return mySystem.m6502().B;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::d() const
{
return mySystem.m6502().D;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::i() const
{
return mySystem.m6502().I;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::z() const
{
return !mySystem.m6502().notZ;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::c() const
{
return mySystem.m6502().C;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CpuDebug::setPC(int pc)
{

View File

@ -18,13 +18,15 @@
#ifndef CPU_DEBUG_HXX
#define CPU_DEBUG_HXX
#include "M6502.hxx"
#include "System.hxx"
#include "DebuggerSystem.hxx"
class M6502;
class System;
// Function type for CpuDebug instance methods
class CpuDebug;
using CpuMethod = int (CpuDebug::*)() const;
#include "DebuggerSystem.hxx"
class CpuState : public DebuggerState
{
public:
@ -44,23 +46,20 @@ class CpuDebug : public DebuggerSystem
void saveOldState() override;
string toString() override { return EmptyString; } // Not needed, since CPU stuff is always visible
// I know, we ain't supposed to do this...
M6502& m6502() const { return mySystem.m6502(); }
int pc() const { return mySystem.m6502().PC; }
int sp() const { return mySystem.m6502().SP; }
int a() const { return mySystem.m6502().A; }
int x() const { return mySystem.m6502().X; }
int y() const { return mySystem.m6502().Y; }
int pc() const;
int sp() const;
int a() const;
int x() const;
int y() const;
// These return int, not boolean!
int n() const { return mySystem.m6502().N; }
int v() const { return mySystem.m6502().V; }
int b() const { return mySystem.m6502().B; }
int d() const { return mySystem.m6502().D; }
int i() const { return mySystem.m6502().I; }
int z() const { return !mySystem.m6502().notZ; }
int c() const { return mySystem.m6502().C; }
int n() const;
int v() const;
int b() const;
int d() const;
int i() const;
int z() const;
int c() const;
void setPC(int pc);
void setSP(int sp);

View File

@ -83,6 +83,11 @@ Debugger::Debugger(OSystem& osystem, Console& console)
myStaticDebugger = this;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Debugger::~Debugger()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::initialize()
{

View File

@ -31,6 +31,7 @@ class TrapArray;
class PromptWidget;
class ButtonWidget;
class M6502;
class CartDebug;
class CpuDebug;
class RiotDebug;
@ -43,6 +44,7 @@ class RewindManager;
#include "Base.hxx"
#include "DialogContainer.hxx"
#include "DebuggerDialog.hxx"
#include "FrameBufferConstants.hxx"
#include "System.hxx"
#include "bspf.hxx"
@ -69,7 +71,7 @@ class Debugger : public DialogContainer
Create a new debugger parent object
*/
Debugger(OSystem& osystem, Console& console);
virtual ~Debugger() = default;
virtual ~Debugger();
public:
/**
@ -217,6 +219,9 @@ class Debugger : public DialogContainer
mySystem.poke(addr, value, flags);
}
/** Convenience method to access the 6502 from System */
M6502& m6502() const { return mySystem.m6502(); }
/** These are now exposed so Expressions can use them. */
int peekAsInt(int addr, uInt8 flags = 0) {
return mySystem.peek(uInt16(addr), flags);

View File

@ -30,6 +30,7 @@
#include "M6502.hxx"
#include "Expression.hxx"
#include "FSNode.hxx"
#include "Settings.hxx"
#include "PromptWidget.hxx"
#include "RomWidget.hxx"
#include "ProgressDialog.hxx"
@ -565,7 +566,7 @@ string DebuggerParser::eval()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DebuggerParser::listTraps(bool listCond)
{
StringList names = debugger.cpuDebug().m6502().getCondTrapNames();
StringList names = debugger.m6502().getCondTrapNames();
commandResult << (listCond ? "trapifs:" : "traps:") << endl;
for(uInt32 i = 0; i < names.size(); i++)
@ -648,11 +649,11 @@ string DebuggerParser::saveScriptFile(string file)
if(debugger.breakPoint(i))
out << "break " << Base::toString(i) << endl;
StringList conds = debugger.cpuDebug().m6502().getCondBreakNames();
StringList conds = debugger.m6502().getCondBreakNames();
for(const auto& cond : conds)
out << "breakif {" << cond << "}" << endl;
StringList names = debugger.cpuDebug().m6502().getCondTrapNames();
StringList names = debugger.m6502().getCondTrapNames();
for(uInt32 i = 0; i < myTraps.size(); ++i)
{
bool read = myTraps[i]->read;
@ -745,7 +746,7 @@ void DebuggerParser::executeBreakif()
int res = YaccParser::parse(argStrings[0].c_str());
if(res == 0)
{
uInt32 ret = debugger.cpuDebug().m6502().addCondBreak(
uInt32 ret = debugger.m6502().addCondBreak(
YaccParser::getResult(), argStrings[0] );
commandResult << "Added breakif " << Base::toString(ret);
}
@ -793,7 +794,7 @@ void DebuggerParser::executeCheat()
void DebuggerParser::executeClearbreaks()
{
debugger.clearAllBreakPoints();
debugger.cpuDebug().m6502().clearCondBreaks();
debugger.m6502().clearCondBreaks();
commandResult << "all breakpoints cleared";
}
@ -812,7 +813,7 @@ void DebuggerParser::executeClearconfig()
void DebuggerParser::executeCleartraps()
{
debugger.clearAllTraps();
debugger.cpuDebug().m6502().clearCondTraps();
debugger.m6502().clearCondTraps();
myTraps.clear();
commandResult << "all traps cleared";
}
@ -916,7 +917,7 @@ void DebuggerParser::executeDefine()
// "delbreakif"
void DebuggerParser::executeDelbreakif()
{
if (debugger.cpuDebug().m6502().delCondBreak(args[0]))
if (debugger.m6502().delCondBreak(args[0]))
commandResult << "removed breakif " << Base::toString(args[0]);
else
commandResult << red("no such breakif");
@ -938,7 +939,7 @@ void DebuggerParser::executeDeltrap()
{
int index = args[0];
if(debugger.cpuDebug().m6502().delCondTrap(index))
if(debugger.m6502().delCondTrap(index))
{
for(uInt32 addr = myTraps[index]->begin; addr <= myTraps[index]->end; ++addr)
executeTrapRW(addr, myTraps[index]->read, myTraps[index]->write, false);
@ -1170,7 +1171,7 @@ void DebuggerParser::executeListbreaks()
if(count)
commandResult << "breaks:" << endl << buf.str();
StringList conds = debugger.cpuDebug().m6502().getCondBreakNames();
StringList conds = debugger.m6502().getCondBreakNames();
if(conds.size() > 0)
{
if(count)
@ -1216,7 +1217,7 @@ void DebuggerParser::executeListfunctions()
// "listtraps"
void DebuggerParser::executeListtraps()
{
StringList names = debugger.cpuDebug().m6502().getCondTrapNames();
StringList names = debugger.m6502().getCondTrapNames();
if(myTraps.size() != names.size())
{
@ -1691,7 +1692,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
myTraps[i]->read == read && myTraps[i]->write == write &&
myTraps[i]->condition == condition)
{
if(debugger.cpuDebug().m6502().delCondTrap(i))
if(debugger.m6502().delCondTrap(i))
{
add = false;
// @sa666666: please check this:
@ -1705,7 +1706,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
}
if(add)
{
uInt32 ret = debugger.cpuDebug().m6502().addCondTrap(
uInt32 ret = debugger.m6502().addCondTrap(
YaccParser::getResult(), hasCond ? argStrings[0] : "");
commandResult << "Added trap " << Base::toString(ret);

View File

@ -23,12 +23,11 @@
#include <set>
class Debugger;
class Settings;
class FilesystemNode;
struct Command;
#include "bspf.hxx"
#include "FrameBuffer.hxx"
#include "Settings.hxx"
class DebuggerParser
{

View File

@ -19,6 +19,7 @@
#include "System.hxx"
#include "Debugger.hxx"
#include "TIA.hxx"
#include "DelayQueueIterator.hxx"
#include "TIADebug.hxx"
@ -688,6 +689,66 @@ void TIADebug::setENABLOld(bool b)
myTIA.myBall.setENABLOld(b);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeWsync()
{
mySystem.poke(WSYNC, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeRsync()
{
mySystem.poke(RSYNC, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeResP0()
{
mySystem.poke(RESP0, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeResP1()
{
mySystem.poke(RESP1, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeResM0()
{
mySystem.poke(RESM0, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeResM1()
{
mySystem.poke(RESM1, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeResBL()
{
mySystem.poke(RESBL, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeHmove()
{
mySystem.poke(HMOVE, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeHmclr()
{
mySystem.poke(HMCLR, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIADebug::strobeCxclr()
{
mySystem.poke(CXCLR, 0);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::frameCount() const
{

View File

@ -19,17 +19,16 @@
#define TIA_DEBUG_HXX
class Debugger;
class TiaDebug;
class TIA;
#include "DebuggerSystem.hxx"
#include "DelayQueueIterator.hxx"
#include "bspf.hxx"
class DelayQueueIterator;
// Function type for TIADebug instance methods
class TIADebug;
using TiaMethod = int (TIADebug::*)() const;
#include "DebuggerSystem.hxx"
#include "bspf.hxx"
// Indices for various IntArray in TiaState
enum {
P0, P1, M0, M1, BL
@ -144,16 +143,16 @@ class TIADebug : public DebuggerSystem
bool collM0_M1() const { return collision(Cx_M0M1); }
// TIA strobe registers
void strobeWsync() { mySystem.poke(WSYNC, 0); }
void strobeRsync() { mySystem.poke(RSYNC, 0); }
void strobeResP0() { mySystem.poke(RESP0, 0); }
void strobeResP1() { mySystem.poke(RESP1, 0); }
void strobeResM0() { mySystem.poke(RESM0, 0); }
void strobeResM1() { mySystem.poke(RESM1, 0); }
void strobeResBL() { mySystem.poke(RESBL, 0); }
void strobeHmove() { mySystem.poke(HMOVE, 0); }
void strobeHmclr() { mySystem.poke(HMCLR, 0); }
void strobeCxclr() { mySystem.poke(CXCLR, 0); }
void strobeWsync();
void strobeRsync();
void strobeResP0();
void strobeResP1();
void strobeResM0();
void strobeResM1();
void strobeResBL();
void strobeHmove();
void strobeHmclr();
void strobeCxclr();
// Read-only internal TIA state
int scanlines() const;

View File

@ -22,6 +22,7 @@ class GuiObject;
class ButtonWidget;
#include "Widget.hxx"
#include "Console.hxx"
#include "Command.hxx"

View File

@ -15,8 +15,10 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include "Cart.hxx"
#include "Widget.hxx"
#include "Dialog.hxx"
#include "Settings.hxx"
#include "TabWidget.hxx"
#include "TiaInfoWidget.hxx"
#include "TiaOutputWidget.hxx"

View File

@ -34,9 +34,12 @@ class TiaZoomWidget;
class CartDebugWidget;
class CartRamWidget;
namespace GUI {
class MessageBox;
struct Rect;
}
#include "Dialog.hxx"
#include "MessageBox.hxx"
#include "Rect.hxx"
class DebuggerDialog : public Dialog
{

View File

@ -16,6 +16,7 @@
//============================================================================
#include "OSystem.hxx"
#include "Settings.hxx"
#include "FrameBuffer.hxx"
#include "Dialog.hxx"
#include "DialogContainer.hxx"

View File

@ -17,6 +17,7 @@
#include <sstream>
#include "Settings.hxx"
#include "Debugger.hxx"
#include "CartDebug.hxx"
#include "DiStella.hxx"

View File

@ -25,6 +25,7 @@
#include "TiaZoomWidget.hxx"
#include "Debugger.hxx"
#include "DebuggerParser.hxx"
#include "PNGLibrary.hxx"
#include "TIADebug.hxx"
#include "TIASurface.hxx"
#include "TIA.hxx"

View File

@ -19,12 +19,12 @@
#define TIA_OUTPUT_WIDGET_HXX
class GuiObject;
class FBSurface;
class ContextMenu;
class TiaZoomWidget;
class FBSurface;
#include "Widget.hxx"
#include "Command.hxx"
#include "ContextMenu.hxx"
class TiaOutputWidget : public Widget, public CommandSender
{

View File

@ -42,6 +42,7 @@
#include "Switches.hxx"
#include "M6532.hxx"
#include "MouseControl.hxx"
#include "PNGLibrary.hxx"
#include "Version.hxx"
#include "EventHandler.hxx"
@ -81,6 +82,11 @@ EventHandler::EventHandler(OSystem& osystem)
myJoyHandler = make_unique<JoystickHandler>(osystem);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::~EventHandler()
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EventHandler::initialize()
{

View File

@ -22,12 +22,13 @@
class Console;
class OSystem;
class MouseControl;
class DialogContainer;
class EventMappingWidget;
#include "Event.hxx"
#include "Control.hxx"
#include "StellaKeys.hxx"
#include "MouseControl.hxx"
#include "Variant.hxx"
#include "bspf.hxx"
@ -82,7 +83,7 @@ class EventHandler
Create a new event handler object
*/
EventHandler(OSystem& osystem);
virtual ~EventHandler() = default;
virtual ~EventHandler();
// Enumeration representing the different states of operation
enum State {

View File

@ -34,57 +34,9 @@ namespace GUI {
#include "FBSurface.hxx"
#include "TIASurface.hxx"
#include "TIAConstants.hxx"
#include "FrameBufferConstants.hxx"
#include "bspf.hxx"
// Return values for initialization of framebuffer window
enum FBInitStatus {
kSuccess,
kFailComplete,
kFailTooLarge,
kFailNotSupported
};
// Positions for onscreen/overlaid messages
enum MessagePosition {
kTopLeft,
kTopCenter,
kTopRight,
kMiddleLeft,
kMiddleCenter,
kMiddleRight,
kBottomLeft,
kBottomCenter,
kBottomRight
};
// Colors indices to use for the various GUI elements
enum {
kColor = 256,
kBGColor,
kBGColorLo,
kBGColorHi,
kShadowColor,
kTextColor,
kTextColorHi,
kTextColorEm,
kDlgColor,
kWidColor,
kWidFrameColor,
kBtnColor,
kBtnColorHi,
kBtnTextColor,
kBtnTextColorHi,
kCheckColor,
kScrollColor,
kScrollColorHi,
kSliderColor,
kSliderColorHi,
kDbgChangedColor,
kDbgChangedTextColor,
kDbgColorHi,
kNumColors
};
// Contains all relevant info for the dimensions of a video screen
// Also takes care of the case when the image should be 'centered'
// within the given screen:

View File

@ -0,0 +1,72 @@
//============================================================================
//
// SSSS tt lll lll
// SS SS tt ll ll
// SS tttttt eeee ll ll aaaa
// SSSS tt ee ee ll ll aa
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
// SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa
//
// Copyright (c) 1995-2017 by Bradford W. Mott, Stephen Anthony
// and the Stella Team
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
// FIXME - perhaps add to namespace or something
#ifndef FRAMEBUFFER_CONSTANTS_HXX
#define FRAMEBUFFER_CONSTANTS_HXX
// Return values for initialization of framebuffer window
enum FBInitStatus {
kSuccess,
kFailComplete,
kFailTooLarge,
kFailNotSupported
};
// Positions for onscreen/overlaid messages
enum MessagePosition {
kTopLeft,
kTopCenter,
kTopRight,
kMiddleLeft,
kMiddleCenter,
kMiddleRight,
kBottomLeft,
kBottomCenter,
kBottomRight
};
// Colors indices to use for the various GUI elements
enum {
kColor = 256,
kBGColor,
kBGColorLo,
kBGColorHi,
kShadowColor,
kTextColor,
kTextColorHi,
kTextColorEm,
kDlgColor,
kWidColor,
kWidFrameColor,
kBtnColor,
kBtnColorHi,
kBtnTextColor,
kBtnTextColorHi,
kCheckColor,
kScrollColor,
kScrollColorHi,
kSliderColor,
kSliderColorHi,
kDbgChangedColor,
kDbgChangedTextColor,
kDbgColorHi,
kNumColors
};
#endif // FRAMEBUFFER_CONSTANTS_HXX

View File

@ -41,12 +41,14 @@
#include "MD5.hxx"
#include "Cart.hxx"
#include "CartDetector.hxx"
#include "FrameBuffer.hxx"
#include "Settings.hxx"
#include "PropsSet.hxx"
#include "EventHandler.hxx"
#include "Menu.hxx"
#include "CommandMenu.hxx"
#include "Launcher.hxx"
#include "PNGLibrary.hxx"
#include "Widget.hxx"
#include "Console.hxx"
#include "Random.hxx"

View File

@ -26,6 +26,8 @@ class Console;
class Debugger;
class Launcher;
class Menu;
class FrameBuffer;
class PNGLibrary;
class Properties;
class PropertiesSet;
class Random;
@ -35,10 +37,9 @@ class Sound;
class StateManager;
class VideoDialog;
#include "Cart.hxx"
#include "EventHandler.hxx"
#include "FSNode.hxx"
#include "FrameBuffer.hxx"
#include "PNGLibrary.hxx"
#include "FrameBufferConstants.hxx"
#include "bspf.hxx"
struct TimingInfo {

View File

@ -15,6 +15,8 @@
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//============================================================================
#include <climits>
#include "Control.hxx"
#include "Event.hxx"
#include "System.hxx"

View File

@ -18,6 +18,7 @@
#include "bspf.hxx"
#include "OSystem.hxx"
#include "Console.hxx"
#include "Joystick.hxx"
#include "Paddles.hxx"
#include "PointingDevice.hxx"

View File

@ -18,6 +18,9 @@
#include "FrameBuffer.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "Props.hxx"
#include "PNGLibrary.hxx"
#include "Rect.hxx"
#include "Widget.hxx"
#include "TIAConstants.hxx"

View File

@ -18,15 +18,15 @@
#ifndef ROM_INFO_WIDGET_HXX
#define ROM_INFO_WIDGET_HXX
#include <fstream>
class FBSurface;
class Properties;
namespace GUI {
struct Size;
}
#include "Props.hxx"
#include "Widget.hxx"
#include "Command.hxx"
#include "Rect.hxx"
#include "bspf.hxx"
class RomInfoWidget : public Widget
{
public: