Isolate TIA implementation in sub-module, remove all direct references in favor of AbstractTIA.

This commit is contained in:
Christian Speckner 2016-10-30 00:31:55 +02:00
parent 9a85bf5405
commit 83417e976f
29 changed files with 54 additions and 38 deletions

View File

@ -2,7 +2,9 @@
{
"clang.cxxflags": [
"-std=c++11",
"-I/home/cnspeckn/git/stella/src/common"
"-I/home/cnspeckn/git/stella/src/common",
"-I/home/cnspeckn/git/stella/src/emucore",
"-I/home/cnspeckn/git/stella/src/emucore/tia/default_core"
],
"editor.tabSize": 2,
"files.trimTrailingWhitespace": false,

View File

@ -94,6 +94,7 @@ MODULES := $(MODULES)
# After the game specific modules follow the shared modules
MODULES += \
src/emucore \
src/emucore/tia/core_default \
src/gui \
src/common \
src/common/tv_filters

3
configure vendored
View File

@ -672,6 +672,7 @@ find_sdlconfig
SRC="src"
CORE="$SRC/emucore"
TIA_CORE_DEFAULT="$SRC/emucore/tia/core_default"
COMMON="$SRC/common"
TV="$SRC/common/tv_filters"
GUI="$SRC/gui"
@ -682,7 +683,7 @@ CHEAT="$SRC/cheat"
LIBPNG="$SRC/libpng"
ZLIB="$SRC/zlib"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI"
INCLUDES="-I$CORE -I$COMMON -I$TV -I$GUI -I$TIA_CORE_DEFAULT"
INCLUDES="$INCLUDES `$_sdlconfig --cflags`"
if test "$_build_static" = yes ; then

View File

@ -23,6 +23,7 @@
#include "bspf.hxx"
#include "Device.hxx"
#include "Serializer.hxx"
#include "System.hxx"
#include "TIATypes.hxx"
class AbstractTIA: public Device
@ -31,6 +32,8 @@ class AbstractTIA: public Device
virtual ~AbstractTIA() = default;
virtual void installDelegate(System& system, Device& device) = 0;
virtual void frameReset() = 0;
virtual bool saveDisplay(Serializer& out) const = 0;

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "Cart3E.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "Cart3EPlus.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "Cart3F.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -19,7 +19,7 @@
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "Cart4A50.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -80,8 +80,8 @@ void Cartridge4A50::install(System& system)
// Mirror all access in TIA and RIOT; by doing so we're taking responsibility
// for that address space in peek and poke below.
mySystem->tia().install(system, *this);
mySystem->m6532().install(system, *this);
mySystem->tia().installDelegate(system, *this);
mySystem->m6532().installDelegate(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -52,7 +52,7 @@ void CartridgeCM::install(System& system)
// Mirror all access in RIOT; by doing so we're taking responsibility
// for that address space in peek and poke below.
mySystem->m6532().install(system, *this);
mySystem->m6532().installDelegate(system, *this);
// Install pages for the startup bank
bank(myStartBank);

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "CartCVPlus.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "CartDASH.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -17,7 +17,7 @@
// $Id$
//============================================================================
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "M6502.hxx"
#include "System.hxx"
#include "CartWD.hxx"
@ -76,7 +76,7 @@ void CartridgeWD::install(System& system)
// Mirror all access in TIA; by doing so we're taking responsibility
// for that address space in peek and poke below.
mySystem->tia().install(system, *this);
mySystem->tia().installDelegate(system, *this);
// Setup segments to some default slices
bank(myStartBank);

View File

@ -19,7 +19,7 @@
#include "System.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "CartX07.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -23,7 +23,7 @@
class Event;
class Switches;
class System;
class TIA;
class AbstractTIA;
class M6502;
class M6532;
class Cartridge;
@ -33,7 +33,7 @@ class Debugger;
#include "bspf.hxx"
#include "Control.hxx"
#include "Props.hxx"
#include "TIATables.hxx"
#include "TIATypes.hxx"
#include "FrameBuffer.hxx"
#include "Serializable.hxx"
#include "NTSCFilter.hxx"
@ -91,7 +91,7 @@ class Console : public Serializable
@return The TIA
*/
TIA& tia() const { return *myTIA; }
AbstractTIA& tia() const { return *myTIA; }
/**
Get the properties being used by the game
@ -340,7 +340,7 @@ class Console : public Serializable
unique_ptr<M6532> myRiot;
// Pointer to the TIA object
unique_ptr<TIA> myTIA;
unique_ptr<AbstractTIA> myTIA;
// Pointer to the Cartridge (the debugger needs it)
unique_ptr<Cartridge> myCart;

View File

@ -35,7 +35,7 @@
#include "Menu.hxx"
#include "OSystem.hxx"
#include "Settings.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "FBSurface.hxx"
#include "TIASurface.hxx"

View File

@ -107,11 +107,11 @@ void M6532::update()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::install(System& system)
{
install(system, *this);
installDelegate(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::install(System& system, Device& device)
void M6532::installDelegate(System& system, Device& device)
{
// Remember which system I'm installed in
mySystem = &system;

View File

@ -92,7 +92,7 @@ class M6532 : public Device
@param system The system the device should install itself in
@param device The device responsible for this address space
*/
void install(System& system, Device& device);
void installDelegate(System& system, Device& device);
/**
Save the current state of this device to the given Serializer.

View File

@ -23,13 +23,13 @@
#include "Device.hxx"
#include "M6502.hxx"
#include "M6532.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "Cart.hxx"
#include "System.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System::System(const OSystem& osystem, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart)
AbstractTIA& mTIA, Cartridge& mCart)
: myOSystem(osystem),
myM6502(m6502),
myM6532(m6532),

View File

@ -23,7 +23,7 @@
class Device;
class M6502;
class M6532;
class TIA;
class AbstractTIA;
class NullDevice;
#include "bspf.hxx"
@ -53,7 +53,7 @@ class System : public Serializable
pages of 2^6 bytes.
*/
System(const OSystem& osystem, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart);
AbstractTIA& mTIA, Cartridge& mCart);
virtual ~System() = default;
// Mask to apply to an address before accessing memory
@ -109,7 +109,7 @@ class System : public Serializable
@return The attached TIA device
*/
TIA& tia() const { return myTIA; }
AbstractTIA& tia() const { return myTIA; }
/**
Answer the random generator attached to the system.
@ -389,7 +389,7 @@ class System : public Serializable
M6532& myM6532;
// TIA device attached to the system
TIA& myTIA;
AbstractTIA& myTIA;
// Cartridge device attached to the system
Cartridge& myCart;

View File

@ -18,7 +18,7 @@
//============================================================================
#include "System.hxx"
#include "TIATables.hxx"
#include "TIATypes.hxx"
#include "TIASnd.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -23,7 +23,7 @@
#include "Settings.hxx"
#include "OSystem.hxx"
#include "Console.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "TIASurface.hxx"

View File

@ -20,7 +20,7 @@
#ifndef TIASURFACE_HXX
#define TIASURFACE_HXX
class TIA;
class AbstractTIA;
class Console;
class OSystem;
class FrameBuffer;
@ -137,7 +137,7 @@ class TIASurface
private:
OSystem& myOSystem;
FrameBuffer& myFB;
TIA* myTIA;
AbstractTIA* myTIA;
shared_ptr<FBSurface> myTiaSurface, mySLineSurface, myBaseTiaSurface;

View File

@ -21,7 +21,7 @@
#include "Event.hxx"
#include "System.hxx"
#include "TIA.hxx"
#include "AbstractTIA.hxx"
#include "TrackBall.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -72,9 +72,7 @@ MODULE_OBJS := \
src/emucore/Switches.o \
src/emucore/StateManager.o \
src/emucore/System.o \
src/emucore/TIA.o \
src/emucore/TIASnd.o \
src/emucore/TIATables.o \
src/emucore/TIASurface.o \
src/emucore/TrackBall.o \
src/emucore/Thumbulator.o

View File

@ -230,11 +230,11 @@ void TIA::systemCyclesReset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system)
{
install(system, *this);
installDelegate(system, *this);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::install(System& system, Device& device)
void TIA::installDelegate(System& system, Device& device)
{
// Remember which system I'm installed in
mySystem = &system;

View File

@ -94,7 +94,7 @@ class TIA : public AbstractTIA
@param system The system the device should install itself in
@param device The device responsible for this address space
*/
void install(System& system, Device& device);
void installDelegate(System& system, Device& device) override;
/**
Save the current state of this device to the given Serializer.

View File

@ -0,0 +1,11 @@
MODULE := src/emucore/tia/core_default
MODULE_OBJS := \
src/emucore/tia/core_default/TIA.o \
src/emucore/tia/core_default/TIATables.o
MODULE_DIRS += \
src/emucore/tia/core_default
# Include common rules
include $(srcdir)/common.rules