In my quest to remove all d'tors, converted many more raw pointers to

unique_ptr.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3258 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2016-01-23 22:56:16 +00:00
parent 5e1e8e7abf
commit 755611a5c1
72 changed files with 84 additions and 398 deletions

View File

@ -72,10 +72,6 @@ class Debugger : public DialogContainer
Create a new debugger parent object Create a new debugger parent object
*/ */
Debugger(OSystem& osystem, Console& console); Debugger(OSystem& osystem, Console& console);
/**
Destructor
*/
virtual ~Debugger() = default; virtual ~Debugger() = default;
public: public:

View File

@ -53,10 +53,6 @@ class AtariVox : public Controller
AtariVox(Jack jack, const Event& event, const System& system, AtariVox(Jack jack, const Event& event, const System& system,
const SerialPort& port, const string& portname, const SerialPort& port, const string& portname,
const string& eepromfile); const string& eepromfile);
/**
Destructor
*/
virtual ~AtariVox() = default; virtual ~AtariVox() = default;
public: public:

View File

@ -42,10 +42,6 @@ class BoosterGrip : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
BoosterGrip(Jack jack, const Event& event, const System& system); BoosterGrip(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~BoosterGrip() = default; virtual ~BoosterGrip() = default;
public: public:

View File

@ -312,12 +312,6 @@ Cartridge::Cartridge(const Settings& settings)
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::~Cartridge()
{
delete[] myCodeAccessBase;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge::saveROM(ofstream& out) bool Cartridge::saveROM(ofstream& out)
{ {
@ -362,8 +356,8 @@ void Cartridge::triggerReadFromWritePort(uInt16 address)
void Cartridge::createCodeAccessBase(uInt32 size) void Cartridge::createCodeAccessBase(uInt32 size)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myCodeAccessBase = new uInt8[size]; myCodeAccessBase = make_ptr<uInt8[]>(size);
memset(myCodeAccessBase, CartDebug::ROW, size); memset(myCodeAccessBase.get(), CartDebug::ROW, size);
#else #else
myCodeAccessBase = nullptr; myCodeAccessBase = nullptr;
#endif #endif

View File

@ -71,11 +71,7 @@ class Cartridge : public Device
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge(const Settings& settings); Cartridge(const Settings& settings);
virtual ~Cartridge() = default;
/**
Destructor
*/
virtual ~Cartridge();
/** /**
Query some information about this cartridge. Query some information about this cartridge.
@ -387,7 +383,7 @@ class Cartridge : public Device
// The array containing information about every byte of ROM indicating // The array containing information about every byte of ROM indicating
// whether it is used as code. // whether it is used as code.
uInt8* myCodeAccessBase; unique_ptr<uInt8[]> myCodeAccessBase;
private: private:
// If myBankLocked is true, ignore attempts at bankswitching. This is used // If myBankLocked is true, ignore attempts at bankswitching. This is used

View File

@ -42,11 +42,11 @@ Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settin
mySize = 64; mySize = 64;
// Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam // Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
memset(myImage, 0x02, mySize); memset(myImage.get(), 0x02, mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, size); memcpy(myImage.get(), image, size);
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
// Set mask for accessing the image buffer // Set mask for accessing the image buffer
@ -54,12 +54,6 @@ Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settin
myMask = mySize - 1; myMask = mySize - 1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::~Cartridge2K()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge2K::reset() void Cartridge2K::reset()
{ {
@ -105,7 +99,7 @@ bool Cartridge2K::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge2K::getImage(int& size) const const uInt8* Cartridge2K::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -49,11 +49,7 @@ class Cartridge2K : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings); Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~Cartridge2K() = default;
/**
Destructor
*/
virtual ~Cartridge2K();
public: public:
/** /**
@ -140,7 +136,7 @@ class Cartridge2K : public Cartridge
private: private:
// Pointer to a dynamically allocated ROM image of the cartridge // Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage; unique_ptr<uInt8[]> myImage;
// Size of the ROM image // Size of the ROM image
uInt32 mySize; uInt32 mySize;

View File

@ -32,22 +32,16 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize + 32768); createCodeAccessBase(mySize + 32768);
// Remember startup bank // Remember startup bank
myStartBank = 0; myStartBank = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3E::~Cartridge3E()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::reset() void Cartridge3E::reset()
{ {
@ -255,7 +249,7 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge3E::getImage(int& size) const const uInt8* Cartridge3E::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -77,11 +77,7 @@ class Cartridge3E : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge3E(const uInt8* image, uInt32 size, const Settings& settings); Cartridge3E(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~Cartridge3E() = default;
/**
Destructor
*/
virtual ~Cartridge3E();
public: public:
/** /**
@ -185,7 +181,7 @@ class Cartridge3E : public Cartridge
private: private:
// Pointer to a dynamically allocated ROM image of the cartridge // Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage; unique_ptr<uInt8[]> myImage;
// RAM contents. For now every ROM gets all 32K of potential RAM // RAM contents. For now every ROM gets all 32K of potential RAM
uInt8 myRAM[32 * 1024]; uInt8 myRAM[32 * 1024];

View File

@ -32,22 +32,16 @@ Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
// Remember startup bank // Remember startup bank
myStartBank = 0; myStartBank = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3F::~Cartridge3F()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::reset() void Cartridge3F::reset()
{ {
@ -179,7 +173,7 @@ bool Cartridge3F::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge3F::getImage(int& size) const const uInt8* Cartridge3F::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -54,11 +54,7 @@ class Cartridge3F : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge3F(const uInt8* image, uInt32 size, const Settings& settings); Cartridge3F(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~Cartridge3F() = default;
/**
Destructor
*/
virtual ~Cartridge3F();
public: public:
/** /**
@ -162,7 +158,7 @@ class Cartridge3F : public Cartridge
private: private:
// Pointer to a dynamically allocated ROM image of the cartridge // Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage; unique_ptr<uInt8[]> myImage;
// Size of the ROM image // Size of the ROM image
uInt32 mySize; uInt32 mySize;

View File

@ -62,10 +62,6 @@ class Cartridge4A50 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge4A50(const uInt8* image, uInt32 size, const Settings& settings); Cartridge4A50(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge4A50() = default; virtual ~Cartridge4A50() = default;
public: public:

View File

@ -48,10 +48,6 @@ class Cartridge4K : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge4K(const uInt8* image, uInt32 size, const Settings& settings); Cartridge4K(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge4K() = default; virtual ~Cartridge4K() = default;
public: public:

View File

@ -45,10 +45,6 @@ class Cartridge4KSC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& settings); Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge4KSC() = default; virtual ~Cartridge4KSC() = default;
public: public:

View File

@ -38,13 +38,13 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Create a load image buffer and copy the given image // Create a load image buffer and copy the given image
myLoadImages = new uInt8[mySize]; myLoadImages = make_ptr<uInt8[]>(mySize);
myNumberOfLoadImages = mySize / 8448; myNumberOfLoadImages = mySize / 8448;
memcpy(myLoadImages, image, size); memcpy(myLoadImages.get(), image, size);
// Add header if image doesn't include it // Add header if image doesn't include it
if(size < 8448) if(size < 8448)
memcpy(myLoadImages+8192, ourDefaultHeader, 256); memcpy(myLoadImages.get()+8192, ourDefaultHeader, 256);
// We use System::PageAccess.codeAccessBase, but don't allow its use // We use System::PageAccess.codeAccessBase, but don't allow its use
// through a pointer, since the AR scheme doesn't support bankswitching // through a pointer, since the AR scheme doesn't support bankswitching
@ -55,12 +55,6 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::~CartridgeAR()
{
delete[] myLoadImages;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::reset() void CartridgeAR::reset()
{ {
@ -378,7 +372,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
if(myLoadImages[(image * 8448) + 8192 + 5] == load) if(myLoadImages[(image * 8448) + 8192 + 5] == load)
{ {
// Copy the load's header // Copy the load's header
memcpy(myHeader, myLoadImages + (image * 8448) + 8192, 256); memcpy(myHeader, myLoadImages.get() + (image * 8448) + 8192, 256);
// Verify the load's header // Verify the load's header
if(checksum(myHeader, 8) != 0x55) if(checksum(myHeader, 8) != 0x55)
@ -392,7 +386,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
{ {
uInt32 bank = myHeader[16 + j] & 0x03; uInt32 bank = myHeader[16 + j] & 0x03;
uInt32 page = (myHeader[16 + j] >> 2) & 0x07; uInt32 page = (myHeader[16 + j] >> 2) & 0x07;
uInt8* src = myLoadImages + (image * 8448) + (j * 256); uInt8* src = myLoadImages.get() + (image * 8448) + (j * 256);
uInt8 sum = checksum(src, 256) + myHeader[16 + j] + myHeader[64 + j]; uInt8 sum = checksum(src, 256) + myHeader[16 + j] + myHeader[64 + j];
if(!invalidPageChecksumSeen && (sum != 0x55)) if(!invalidPageChecksumSeen && (sum != 0x55))
@ -456,7 +450,7 @@ bool CartridgeAR::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeAR::getImage(int& size) const const uInt8* CartridgeAR::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myLoadImages; return myLoadImages.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -477,7 +471,7 @@ bool CartridgeAR::save(Serializer& out) const
// All of the 8448 byte loads associated with the game // All of the 8448 byte loads associated with the game
// Note that the size of this array is myNumberOfLoadImages * 8448 // Note that the size of this array is myNumberOfLoadImages * 8448
out.putByteArray(myLoadImages, myNumberOfLoadImages * 8448); out.putByteArray(myLoadImages.get(), myNumberOfLoadImages * 8448);
// Indicates how many 8448 loads there are // Indicates how many 8448 loads there are
out.putByte(myNumberOfLoadImages); out.putByte(myNumberOfLoadImages);
@ -528,7 +522,7 @@ bool CartridgeAR::load(Serializer& in)
// All of the 8448 byte loads associated with the game // All of the 8448 byte loads associated with the game
// Note that the size of this array is myNumberOfLoadImages * 8448 // Note that the size of this array is myNumberOfLoadImages * 8448
in.getByteArray(myLoadImages, myNumberOfLoadImages * 8448); in.getByteArray(myLoadImages.get(), myNumberOfLoadImages * 8448);
// Indicates how many 8448 loads there are // Indicates how many 8448 loads there are
myNumberOfLoadImages = in.getByte(); myNumberOfLoadImages = in.getByte();

View File

@ -53,11 +53,7 @@ class CartridgeAR : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeAR(const uInt8* image, uInt32 size, const Settings& settings); CartridgeAR(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeAR() = default;
/**
Destructor
*/
virtual ~CartridgeAR();
public: public:
/** /**
@ -202,7 +198,7 @@ class CartridgeAR : public Cartridge
uInt32 mySize; uInt32 mySize;
// All of the 8448 byte loads associated with the game // All of the 8448 byte loads associated with the game
uInt8* myLoadImages; unique_ptr<uInt8[]> myLoadImages;
// Indicates how many 8448 loads there are // Indicates how many 8448 loads there are
uInt8 myNumberOfLoadImages; uInt8 myNumberOfLoadImages;

View File

@ -49,10 +49,6 @@ class CartridgeBF : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeBF(const uInt8* image, uInt32 size, const Settings& settings); CartridgeBF(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeBF() = default; virtual ~CartridgeBF() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeBFSC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeBFSC() = default; virtual ~CartridgeBFSC() = default;
public: public:

View File

@ -120,10 +120,6 @@ class CartridgeCM : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeCM(const uInt8* image, uInt32 size, const Settings& settings); CartridgeCM(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeCM() = default; virtual ~CartridgeCM() = default;
public: public:

View File

@ -123,10 +123,6 @@ class CartridgeCTY : public Cartridge
@param osystem A reference to the OSystem currently in use @param osystem A reference to the OSystem currently in use
*/ */
CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osystem); CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osystem);
/**
Destructor
*/
virtual ~CartridgeCTY() = default; virtual ~CartridgeCTY() = default;
public: public:

View File

@ -43,25 +43,19 @@ CartridgeCV::CartridgeCV(const uInt8* image, uInt32 size,
memcpy(myImage, image + 2048, 2048); memcpy(myImage, image + 2048, 2048);
// Copy the RAM image into a buffer for use in reset() // Copy the RAM image into a buffer for use in reset()
myInitialRAM = new uInt8[1024]; myInitialRAM = make_ptr<uInt8[]>(1024);
memcpy(myInitialRAM, image, 1024); memcpy(myInitialRAM.get(), image, 1024);
} }
createCodeAccessBase(2048+1024); createCodeAccessBase(2048+1024);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCV::~CartridgeCV()
{
delete[] myInitialRAM;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeCV::reset() void CartridgeCV::reset()
{ {
if(myInitialRAM) if(myInitialRAM)
{ {
// Copy the RAM image into my buffer // Copy the RAM image into my buffer
memcpy(myRAM, myInitialRAM, 1024); memcpy(myRAM, myInitialRAM.get(), 1024);
} }
else else
{ {

View File

@ -51,11 +51,7 @@ class CartridgeCV : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeCV(const uInt8* image, uInt32 size, const Settings& settings); CartridgeCV(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeCV() = default;
/**
Destructor
*/
virtual ~CartridgeCV();
public: public:
/** /**
@ -143,7 +139,7 @@ class CartridgeCV : public Cartridge
private: private:
// Pointer to the initial RAM data from the cart // Pointer to the initial RAM data from the cart
// This doesn't always exist, so we don't pre-allocate it // This doesn't always exist, so we don't pre-allocate it
uInt8* myInitialRAM; unique_ptr<uInt8[]> myInitialRAM;
// Initial size of the cart data // Initial size of the cart data
uInt32 mySize; uInt32 mySize;

View File

@ -30,10 +30,10 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
myImage(nullptr) myImage(nullptr)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize + RAM_TOTAL_SIZE); createCodeAccessBase(mySize + RAM_TOTAL_SIZE);
// Remember startup bank (0 per spec, rather than last per 3E scheme). // Remember startup bank (0 per spec, rather than last per 3E scheme).
@ -41,12 +41,6 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
myStartBank = 0; myStartBank = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDASH::~CartridgeDASH()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDASH::reset() { void CartridgeDASH::reset() {
@ -316,7 +310,7 @@ bool CartridgeDASH::patch(uInt16 address, uInt8 value) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8* CartridgeDASH::getImage(int& size) const { const uInt8* CartridgeDASH::getImage(int& size) const {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -137,11 +137,7 @@ public:
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeDASH(const uInt8* image, uInt32 size, const Settings& settings); CartridgeDASH(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeDASH() = default;
/**
Destructor
*/
virtual ~CartridgeDASH();
public: public:
/** /**
@ -267,8 +263,8 @@ private:
static const uInt16 RAM_WRITE_OFFSET = 0x800; static const uInt16 RAM_WRITE_OFFSET = 0x800;
uInt32 mySize; // Size of the ROM image uInt32 mySize; // Size of the ROM image
uInt8* myImage; // Pointer to a dynamically allocated ROM image of the cartridge unique_ptr<uInt8[]> myImage; // Pointer to a dynamically allocated ROM image of the cartridge
uInt8 myRAM[RAM_TOTAL_SIZE]; uInt8 myRAM[RAM_TOTAL_SIZE];
private: private:

View File

@ -49,10 +49,6 @@ class CartridgeDF : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeDF(const uInt8* image, uInt32 size, const Settings& settings); CartridgeDF(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeDF() = default; virtual ~CartridgeDF() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeDFSC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeDFSC() = default; virtual ~CartridgeDFSC() = default;
public: public:

View File

@ -53,10 +53,6 @@ class CartridgeDPC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeDPC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeDPC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeDPC() = default; virtual ~CartridgeDPC() = default;
public: public:

View File

@ -41,12 +41,12 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
// Store image, making sure it's at least 29KB // Store image, making sure it's at least 29KB
uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255; uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255;
mySize = BSPF_max(minsize, size); mySize = BSPF_max(minsize, size);
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
memcpy(myImage, image, size); memcpy(myImage.get(), image, size);
createCodeAccessBase(4096 * 6); createCodeAccessBase(4096 * 6);
// Pointer to the program ROM (24K @ 0 byte offset) // Pointer to the program ROM (24K @ 0 byte offset)
myProgramImage = myImage; myProgramImage = myImage.get();
// Pointer to the display RAM // Pointer to the display RAM
myDisplayImage = myDPCRAM + 0xC00; myDisplayImage = myDPCRAM + 0xC00;
@ -72,12 +72,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
myStartBank = 5; myStartBank = 5;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDPCPlus::~CartridgeDPCPlus()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDPCPlus::reset() void CartridgeDPCPlus::reset()
{ {
@ -641,7 +635,7 @@ bool CartridgeDPCPlus::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeDPCPlus::getImage(int& size) const const uInt8* CartridgeDPCPlus::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -22,7 +22,7 @@
class System; class System;
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
class Thumbulator; #include "Thumbulator.hxx"
#endif #endif
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
#include "CartDPCPlusWidget.hxx" #include "CartDPCPlusWidget.hxx"
@ -57,11 +57,7 @@ class CartridgeDPCPlus : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeDPCPlus(const uInt8* image, uInt32 size, const Settings& settings); CartridgeDPCPlus(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeDPCPlus() = default;
/**
Destructor
*/
virtual ~CartridgeDPCPlus();
public: public:
/** /**
@ -199,7 +195,7 @@ class CartridgeDPCPlus : public Cartridge
private: private:
// The ROM image and size // The ROM image and size
uInt8* myImage; unique_ptr<uInt8[]> myImage;
uInt32 mySize; uInt32 mySize;
// Pointer to the 24K program ROM image of the cartridge // Pointer to the 24K program ROM image of the cartridge

View File

@ -57,10 +57,6 @@ class CartridgeE0 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeE0(const uInt8* image, uInt32 size, const Settings& settings); CartridgeE0(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeE0() = default; virtual ~CartridgeE0() = default;
public: public:

View File

@ -74,10 +74,6 @@ class CartridgeE7 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeE7(const uInt8* image, uInt32 size, const Settings& settings); CartridgeE7(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeE7() = default; virtual ~CartridgeE7() = default;
public: public:

View File

@ -52,10 +52,6 @@ class CartridgeEF : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings); CartridgeEF(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeEF() = default; virtual ~CartridgeEF() = default;
public: public:

View File

@ -52,10 +52,6 @@ class CartridgeEFSC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeEFSC() = default; virtual ~CartridgeEFSC() = default;
public: public:

View File

@ -49,10 +49,6 @@ class CartridgeF0 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF0(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF0(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF0() = default; virtual ~CartridgeF0() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeF4 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF4(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF4(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF4() = default; virtual ~CartridgeF4() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeF4SC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF4SC() = default; virtual ~CartridgeF4SC() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeF6 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF6(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF6(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF6() = default; virtual ~CartridgeF6() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeF6SC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF6SC() = default; virtual ~CartridgeF6SC() = default;
public: public:

View File

@ -50,10 +50,6 @@ class CartridgeF8 : public Cartridge
*/ */
CartridgeF8(const uInt8* image, uInt32 size, const string& md5, CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
const Settings& settings); const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF8() = default; virtual ~CartridgeF8() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeF8SC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeF8SC() = default; virtual ~CartridgeF8SC() = default;
public: public:

View File

@ -48,10 +48,6 @@ class CartridgeFA : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeFA(const uInt8* image, uInt32 size, const Settings& settings); CartridgeFA(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeFA() = default; virtual ~CartridgeFA() = default;
public: public:

View File

@ -56,10 +56,6 @@ class CartridgeFA2 : public Cartridge
@param osystem A reference to the OSystem currently in use @param osystem A reference to the OSystem currently in use
*/ */
CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osystem); CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osystem);
/**
Destructor
*/
virtual ~CartridgeFA2() = default; virtual ~CartridgeFA2() = default;
public: public:

View File

@ -63,10 +63,6 @@ class CartridgeFE : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeFE(const uInt8* image, uInt32 size, const Settings& settings); CartridgeFE(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeFE() = default; virtual ~CartridgeFE() = default;
public: public:

View File

@ -154,10 +154,6 @@ class CartridgeMC : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeMC(const uInt8* image, uInt32 size, const Settings& settings); CartridgeMC(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeMC() = default; virtual ~CartridgeMC() = default;
public: public:

View File

@ -31,22 +31,16 @@ CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& sett
myBankingDisabled(false) myBankingDisabled(false)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
// Remember startup bank // Remember startup bank
myStartBank = 0; myStartBank = 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::~CartridgeMDM()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMDM::reset() void CartridgeMDM::reset()
{ {
@ -159,7 +153,7 @@ bool CartridgeMDM::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeMDM::getImage(int& size) const const uInt8* CartridgeMDM::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -59,11 +59,7 @@ class CartridgeMDM : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings); CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeMDM() = default;
/**
Destructor
*/
virtual ~CartridgeMDM();
public: public:
/** /**
@ -167,7 +163,7 @@ class CartridgeMDM : public Cartridge
private: private:
// Pointer to a dynamically allocated ROM image of the cartridge // Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage; unique_ptr<uInt8[]> myImage;
// Size of the ROM image // Size of the ROM image
uInt32 mySize; uInt32 mySize;

View File

@ -31,22 +31,16 @@ CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Allocate array for the ROM image // Allocate array for the ROM image
myImage = new uInt8[mySize]; myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize); createCodeAccessBase(mySize);
// Remember startup bank // Remember startup bank
myStartBank = bankCount() - 1; myStartBank = bankCount() - 1;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeSB::~CartridgeSB()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeSB::reset() void CartridgeSB::reset()
{ {
@ -165,7 +159,7 @@ bool CartridgeSB::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeSB::getImage(int& size) const const uInt8* CartridgeSB::getImage(int& size) const
{ {
size = mySize; size = mySize;
return myImage; return myImage.get();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -48,11 +48,7 @@ class CartridgeSB : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeSB(const uInt8* image, uInt32 size, const Settings& settings); CartridgeSB(const uInt8* image, uInt32 size, const Settings& settings);
virtual ~CartridgeSB() = default;
/**
Destructor
*/
virtual ~CartridgeSB();
public: public:
/** /**
@ -156,7 +152,7 @@ class CartridgeSB : public Cartridge
private: private:
// The 128-256K ROM image and size of the cartridge // The 128-256K ROM image and size of the cartridge
uInt8* myImage; unique_ptr<uInt8[]> myImage;
uInt32 mySize; uInt32 mySize;
// Indicates which bank is currently active // Indicates which bank is currently active

View File

@ -48,10 +48,6 @@ class CartridgeUA : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings); CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeUA() = default; virtual ~CartridgeUA() = default;
public: public:

View File

@ -76,10 +76,6 @@ class CartridgeWD : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeWD(const uInt8* image, uInt32 size, const Settings& settings); CartridgeWD(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeWD() = default; virtual ~CartridgeWD() = default;
public: public:

View File

@ -58,10 +58,6 @@ class CartridgeX07 : public Cartridge
@param settings A reference to the various settings (read-only) @param settings A reference to the various settings (read-only)
*/ */
CartridgeX07(const uInt8* image, uInt32 size, const Settings& settings); CartridgeX07(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeX07() = default; virtual ~CartridgeX07() = default;
public: public:

View File

@ -55,12 +55,7 @@ class CompuMate
@param system The system using this controller @param system The system using this controller
*/ */
CompuMate(const Console& console, const Event& event, const System& system); CompuMate(const Console& console, const Event& event, const System& system);
virtual ~CompuMate() = default; // Controllers are deleted outside this class
/**
Destructor
Controllers are deleted outside this class
*/
virtual ~CompuMate() = default;
/** /**
Return the left and right CompuMate controllers Return the left and right CompuMate controllers
@ -108,10 +103,6 @@ class CompuMate
const System& system) const System& system)
: Controller(jack, event, system, Controller::CompuMate), : Controller(jack, event, system, Controller::CompuMate),
myHandler(handler) { } myHandler(handler) { }
/**
Destructor
*/
virtual ~CMControl() = default; virtual ~CMControl() = default;
public: public:

View File

@ -106,10 +106,6 @@ class Controller : public Serializable
*/ */
Controller(Jack jack, const Event& event, const System& system, Controller(Jack jack, const Event& event, const System& system,
Type type); Type type);
/**
Destructor
*/
virtual ~Controller() = default; virtual ~Controller() = default;
/** /**

View File

@ -42,10 +42,6 @@ class Driving : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
Driving(Jack jack, const Event& event, const System& system); Driving(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~Driving() = default; virtual ~Driving() = default;
public: public:

View File

@ -52,17 +52,8 @@ enum FrameStyle {
class FBSurface class FBSurface
{ {
// friend class TIASurface;
public: public:
/**
Creates a new FBSurface object
*/
FBSurface(); FBSurface();
/**
Destructor
*/
virtual ~FBSurface() = default; virtual ~FBSurface() = default;
/** /**

View File

@ -140,10 +140,6 @@ class FrameBuffer
Creates a new Frame Buffer Creates a new Frame Buffer
*/ */
FrameBuffer(OSystem& osystem); FrameBuffer(OSystem& osystem);
/**
Destructor
*/
virtual ~FrameBuffer() = default; virtual ~FrameBuffer() = default;
/** /**

View File

@ -43,10 +43,6 @@ class Genesis : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
Genesis(Jack jack, const Event& event, const System& system); Genesis(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~Genesis() = default; virtual ~Genesis() = default;
public: public:

View File

@ -41,10 +41,6 @@ class Joystick : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
Joystick(Jack jack, const Event& event, const System& system); Joystick(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~Joystick() = default; virtual ~Joystick() = default;
public: public:

View File

@ -41,10 +41,6 @@ class Keyboard : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
Keyboard(Jack jack, const Event& event, const System& system); Keyboard(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~Keyboard() = default; virtual ~Keyboard() = default;
public: public:

View File

@ -58,10 +58,6 @@ class M6502 : public Serializable
Create a new 6502 microprocessor. Create a new 6502 microprocessor.
*/ */
M6502(const Settings& settings); M6502(const Settings& settings);
/**
Destructor
*/
virtual ~M6502() = default; virtual ~M6502() = default;
public: public:

View File

@ -55,10 +55,6 @@ class M6532 : public Device
@param settings The settings used by the system @param settings The settings used by the system
*/ */
M6532(const Console& console, const Settings& settings); M6532(const Console& console, const Settings& settings);
/**
Destructor
*/
virtual ~M6532() = default; virtual ~M6532() = default;
public: public:

View File

@ -51,10 +51,6 @@ class MindLink : public Controller
@param system The system using this controller @param system The system using this controller
*/ */
MindLink(Jack jack, const Event& event, const System& system); MindLink(Jack jack, const Event& event, const System& system);
/**
Destructor
*/
virtual ~MindLink() = default; virtual ~MindLink() = default;
public: public:

View File

@ -48,10 +48,6 @@ class Paddles : public Controller
*/ */
Paddles(Jack jack, const Event& event, const System& system, Paddles(Jack jack, const Event& event, const System& system,
bool swappaddle, bool swapaxis, bool swapdir); bool swappaddle, bool swapaxis, bool swapdir);
/**
Destructor
*/
virtual ~Paddles() = default; virtual ~Paddles() = default;
public: public:

View File

@ -48,10 +48,6 @@ class SaveKey : public Controller
*/ */
SaveKey(Jack jack, const Event& event, const System& system, SaveKey(Jack jack, const Event& event, const System& system,
const string& eepromfile); const string& eepromfile);
/**
Destructor
*/
virtual ~SaveKey() = default; virtual ~SaveKey() = default;
public: public:

View File

@ -40,10 +40,6 @@ class Settings
Create a new settings abstract class Create a new settings abstract class
*/ */
Settings(OSystem& osystem); Settings(OSystem& osystem);
/**
Destructor
*/
virtual ~Settings() = default; virtual ~Settings() = default;
public: public:

View File

@ -40,10 +40,6 @@ class Sound : public Serializable
using the object. using the object.
*/ */
Sound(OSystem& osystem) : myOSystem(osystem) { } Sound(OSystem& osystem) : myOSystem(osystem) { }
/**
Destructor
*/
virtual ~Sound() = default; virtual ~Sound() = default;
public: public:

View File

@ -47,10 +47,6 @@ class Switches : public Serializable
@param event The event object to use for events @param event The event object to use for events
*/ */
Switches(const Event& event, const Properties& properties); Switches(const Event& event, const Properties& properties);
/**
Destructor
*/
virtual ~Switches() = default; virtual ~Switches() = default;
public: public:

View File

@ -54,10 +54,6 @@ class System : public Serializable
*/ */
System(const OSystem& osystem, M6502& m6502, M6532& m6532, System(const OSystem& osystem, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart); TIA& mTIA, Cartridge& mCart);
/**
Destructor
*/
virtual ~System() = default; virtual ~System() = default;
// Mask to apply to an address before accessing memory // Mask to apply to an address before accessing memory

View File

@ -53,8 +53,8 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
myStartScanline(0) myStartScanline(0)
{ {
// Allocate buffers for two frame buffers // Allocate buffers for two frame buffers
myCurrentFrameBuffer = new uInt8[160 * 320]; myCurrentFrameBuffer = make_ptr<uInt8[]>(160 * 320);
myPreviousFrameBuffer = new uInt8[160 * 320]; myPreviousFrameBuffer = make_ptr<uInt8[]>(160 * 320);
// Compute all of the mask tables // Compute all of the mask tables
TIATables::computeAllTables(); TIATables::computeAllTables();
@ -63,13 +63,6 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
initialize(); initialize();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::~TIA()
{
delete[] myCurrentFrameBuffer;
delete[] myPreviousFrameBuffer;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::initialize() void TIA::initialize()
{ {
@ -159,7 +152,7 @@ void TIA::frameReset()
clearBuffers(); clearBuffers();
// Reset pixel pointer and drawing flag // Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer; myFramePointer = myCurrentFrameBuffer.get();
// Calculate color clock offsets for starting and stopping frame drawing // Calculate color clock offsets for starting and stopping frame drawing
// Note that although we always start drawing at scanline zero, the // Note that although we always start drawing at scanline zero, the
@ -478,7 +471,7 @@ bool TIA::saveDisplay(Serializer& out) const
{ {
out.putBool(myPartialFrameFlag); out.putBool(myPartialFrameFlag);
out.putInt(myFramePointerClocks); out.putInt(myFramePointerClocks);
out.putByteArray(myCurrentFrameBuffer, 160*320); out.putByteArray(myCurrentFrameBuffer.get(), 160*320);
} }
catch(...) catch(...)
{ {
@ -499,9 +492,9 @@ bool TIA::loadDisplay(Serializer& in)
// Reset frame buffer pointer and data // Reset frame buffer pointer and data
clearBuffers(); clearBuffers();
myFramePointer = myCurrentFrameBuffer; myFramePointer = myCurrentFrameBuffer.get();
in.getByteArray(myCurrentFrameBuffer, 160*320); in.getByteArray(myCurrentFrameBuffer.get(), 160*320);
memcpy(myPreviousFrameBuffer, myCurrentFrameBuffer, 160*320); memcpy(myPreviousFrameBuffer.get(), myCurrentFrameBuffer.get(), 160*320);
// If we're in partial frame mode, make sure to re-create the screen // If we're in partial frame mode, make sure to re-create the screen
// as it existed when the state was saved // as it existed when the state was saved
@ -541,9 +534,7 @@ void TIA::update()
inline void TIA::startFrame() inline void TIA::startFrame()
{ {
// This stuff should only happen at the beginning of a new frame. // This stuff should only happen at the beginning of a new frame.
uInt8* tmp = myCurrentFrameBuffer; myCurrentFrameBuffer.swap(myPreviousFrameBuffer);
myCurrentFrameBuffer = myPreviousFrameBuffer;
myPreviousFrameBuffer = tmp;
// Remember the number of clocks which have passed on the current scanline // Remember the number of clocks which have passed on the current scanline
// so that we can adjust the frame's starting clock by this amount. This // so that we can adjust the frame's starting clock by this amount. This
@ -562,7 +553,7 @@ inline void TIA::startFrame()
myClocksToEndOfScanLine = 228; myClocksToEndOfScanLine = 228;
// Reset frame buffer pointer // Reset frame buffer pointer
myFramePointer = myCurrentFrameBuffer; myFramePointer = myCurrentFrameBuffer.get();
myFramePointerClocks = 0; myFramePointerClocks = 0;
// If color loss is enabled then update the color registers based on // If color loss is enabled then update the color registers based on
@ -636,8 +627,8 @@ inline void TIA::endFrame()
myScanlineCountForLastFrame = myMaximumNumberOfScanlines; myScanlineCountForLastFrame = myMaximumNumberOfScanlines;
if(previousCount < myMaximumNumberOfScanlines) if(previousCount < myMaximumNumberOfScanlines)
{ {
memset(myCurrentFrameBuffer, 0, 160 * 320); memset(myCurrentFrameBuffer.get(), 0, 160 * 320);
memset(myPreviousFrameBuffer, 1, 160 * 320); memset(myPreviousFrameBuffer.get(), 1, 160 * 320);
} }
} }
// Did the number of scanlines decrease? // Did the number of scanlines decrease?
@ -647,8 +638,8 @@ inline void TIA::endFrame()
{ {
uInt32 offset = myScanlineCountForLastFrame * 160, uInt32 offset = myScanlineCountForLastFrame * 160,
stride = (previousCount - myScanlineCountForLastFrame) * 160; stride = (previousCount - myScanlineCountForLastFrame) * 160;
memset(myCurrentFrameBuffer + offset, 0, stride); memset(myCurrentFrameBuffer.get() + offset, 0, stride);
memset(myPreviousFrameBuffer + offset, 1, stride); memset(myPreviousFrameBuffer.get() + offset, 1, stride);
} }
// Account for frame jitter, skipping the first few frames // Account for frame jitter, skipping the first few frames
@ -1281,8 +1272,8 @@ inline void TIA::waitHorizontalRSync()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::clearBuffers() void TIA::clearBuffers()
{ {
memset(myCurrentFrameBuffer, 0, 160 * 320); memset(myCurrentFrameBuffer.get(), 0, 160 * 320);
memset(myPreviousFrameBuffer, 0, 160 * 320); memset(myPreviousFrameBuffer.get(), 0, 160 * 320);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -57,11 +57,7 @@ class TIA : public Device
@param settings The settings object for this TIA device @param settings The settings object for this TIA device
*/ */
TIA(Console& console, Sound& sound, Settings& settings); TIA(Console& console, Sound& sound, Settings& settings);
virtual ~TIA() = default;
/**
Destructor
*/
virtual ~TIA();
public: public:
/** /**
@ -175,7 +171,7 @@ class TIA : public Device
@return Pointer to the current frame buffer @return Pointer to the current frame buffer
*/ */
uInt8* currentFrameBuffer() const uInt8* currentFrameBuffer() const
{ return myCurrentFrameBuffer + myFramePointerOffset + myCurrentFrameJitter; } { return myCurrentFrameBuffer.get() + myFramePointerOffset + myCurrentFrameJitter; }
/** /**
Answers the previous frame buffer Answers the previous frame buffer
@ -183,7 +179,7 @@ class TIA : public Device
@return Pointer to the previous frame buffer @return Pointer to the previous frame buffer
*/ */
uInt8* previousFrameBuffer() const uInt8* previousFrameBuffer() const
{ return myPreviousFrameBuffer + myFramePointerOffset; } { return myPreviousFrameBuffer.get() + myFramePointerOffset; }
/** /**
Answers the width and height of the frame buffer Answers the width and height of the frame buffer
@ -410,10 +406,10 @@ class TIA : public Device
Settings& mySettings; Settings& mySettings;
// Pointer to the current frame buffer // Pointer to the current frame buffer
uInt8* myCurrentFrameBuffer; unique_ptr<uInt8[]> myCurrentFrameBuffer;
// Pointer to the previous frame buffer // Pointer to the previous frame buffer
uInt8* myPreviousFrameBuffer; unique_ptr<uInt8[]> myPreviousFrameBuffer;
// Pointer to the next pixel that will be drawn in the current frame buffer // Pointer to the next pixel that will be drawn in the current frame buffer
uInt8* myFramePointer; uInt8* myFramePointer;

View File

@ -26,6 +26,9 @@
#ifdef THUMB_SUPPORT #ifdef THUMB_SUPPORT
#ifndef THUMBULATOR_HXX
#define THUMBULATOR_HXX
#include "bspf.hxx" #include "bspf.hxx"
#define ROMADDMASK 0x7FFF #define ROMADDMASK 0x7FFF
@ -151,4 +154,6 @@ class Thumbulator
Thumbulator& operator=(Thumbulator&&) = delete; Thumbulator& operator=(Thumbulator&&) = delete;
}; };
#endif // THUMBULATOR_HXX
#endif #endif

View File

@ -50,10 +50,6 @@ class TrackBall : public Controller
@param type The type of trackball controller @param type The type of trackball controller
*/ */
TrackBall(Jack jack, const Event& event, const System& system, Type type); TrackBall(Jack jack, const Event& event, const System& system, Type type);
/**
Destructor
*/
virtual ~TrackBall() = default; virtual ~TrackBall() = default;
public: public: