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
*/
Debugger(OSystem& osystem, Console& console);
/**
Destructor
*/
virtual ~Debugger() = default;
public:

View File

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

View File

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

View File

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

View File

@ -71,11 +71,7 @@ class Cartridge : public Device
@param settings A reference to the various settings (read-only)
*/
Cartridge(const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge();
virtual ~Cartridge() = default;
/**
Query some information about this cartridge.
@ -387,7 +383,7 @@ class Cartridge : public Device
// The array containing information about every byte of ROM indicating
// whether it is used as code.
uInt8* myCodeAccessBase;
unique_ptr<uInt8[]> myCodeAccessBase;
private:
// 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;
// Initialize ROM with illegal 6502 opcode that causes a real 6502 to jam
myImage = new uInt8[mySize];
memset(myImage, 0x02, mySize);
myImage = make_ptr<uInt8[]>(mySize);
memset(myImage.get(), 0x02, mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, size);
memcpy(myImage.get(), image, size);
createCodeAccessBase(mySize);
// Set mask for accessing the image buffer
@ -54,12 +54,6 @@ Cartridge2K::Cartridge2K(const uInt8* image, uInt32 size, const Settings& settin
myMask = mySize - 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::~Cartridge2K()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge2K::reset()
{
@ -105,7 +99,7 @@ bool Cartridge2K::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge2K::getImage(int& size) const
{
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)
*/
Cartridge2K(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge2K();
virtual ~Cartridge2K() = default;
public:
/**
@ -140,7 +136,7 @@ class Cartridge2K : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage;
unique_ptr<uInt8[]> myImage;
// Size of the ROM image
uInt32 mySize;

View File

@ -32,22 +32,16 @@ Cartridge3E::Cartridge3E(const uInt8* image, uInt32 size,
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize + 32768);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3E::~Cartridge3E()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3E::reset()
{
@ -255,7 +249,7 @@ bool Cartridge3E::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge3E::getImage(int& size) const
{
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)
*/
Cartridge3E(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge3E();
virtual ~Cartridge3E() = default;
public:
/**
@ -185,7 +181,7 @@ class Cartridge3E : public Cartridge
private:
// 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
uInt8 myRAM[32 * 1024];

View File

@ -32,22 +32,16 @@ Cartridge3F::Cartridge3F(const uInt8* image, uInt32 size,
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3F::~Cartridge3F()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Cartridge3F::reset()
{
@ -179,7 +173,7 @@ bool Cartridge3F::patch(uInt16 address, uInt8 value)
const uInt8* Cartridge3F::getImage(int& size) const
{
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)
*/
Cartridge3F(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~Cartridge3F();
virtual ~Cartridge3F() = default;
public:
/**
@ -162,7 +158,7 @@ class Cartridge3F : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage;
unique_ptr<uInt8[]> myImage;
// Size of the ROM image
uInt32 mySize;

View File

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

View File

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

View File

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

View File

@ -38,13 +38,13 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
myCurrentBank(0)
{
// Create a load image buffer and copy the given image
myLoadImages = new uInt8[mySize];
myLoadImages = make_ptr<uInt8[]>(mySize);
myNumberOfLoadImages = mySize / 8448;
memcpy(myLoadImages, image, size);
memcpy(myLoadImages.get(), image, size);
// Add header if image doesn't include it
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
// through a pointer, since the AR scheme doesn't support bankswitching
@ -55,12 +55,6 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
createCodeAccessBase(mySize);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::~CartridgeAR()
{
delete[] myLoadImages;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeAR::reset()
{
@ -378,7 +372,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
if(myLoadImages[(image * 8448) + 8192 + 5] == load)
{
// 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
if(checksum(myHeader, 8) != 0x55)
@ -392,7 +386,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load)
{
uInt32 bank = myHeader[16 + j] & 0x03;
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];
if(!invalidPageChecksumSeen && (sum != 0x55))
@ -456,7 +450,7 @@ bool CartridgeAR::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeAR::getImage(int& size) const
{
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
// 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
out.putByte(myNumberOfLoadImages);
@ -528,7 +522,7 @@ bool CartridgeAR::load(Serializer& in)
// All of the 8448 byte loads associated with the game
// 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
myNumberOfLoadImages = in.getByte();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,10 +30,10 @@ CartridgeDASH::CartridgeDASH(const uInt8* image, uInt32 size, const Settings& se
myImage(nullptr)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize + RAM_TOTAL_SIZE);
// 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;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDASH::~CartridgeDASH()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeDASH::reset() {
@ -316,7 +310,7 @@ bool CartridgeDASH::patch(uInt16 address, uInt8 value) {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt8* CartridgeDASH::getImage(int& size) const {
size = mySize;
return myImage;
return myImage.get();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,22 +31,16 @@ CartridgeMDM::CartridgeMDM(const uInt8* image, uInt32 size, const Settings& sett
myBankingDisabled(false)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::~CartridgeMDM()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMDM::reset()
{
@ -159,7 +153,7 @@ bool CartridgeMDM::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeMDM::getImage(int& size) const
{
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)
*/
CartridgeMDM(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeMDM();
virtual ~CartridgeMDM() = default;
public:
/**
@ -167,7 +163,7 @@ class CartridgeMDM : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
uInt8* myImage;
unique_ptr<uInt8[]> myImage;
// Size of the ROM image
uInt32 mySize;

View File

@ -31,22 +31,16 @@ CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
myCurrentBank(0)
{
// Allocate array for the ROM image
myImage = new uInt8[mySize];
myImage = make_ptr<uInt8[]>(mySize);
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
memcpy(myImage.get(), image, mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = bankCount() - 1;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeSB::~CartridgeSB()
{
delete[] myImage;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeSB::reset()
{
@ -165,7 +159,7 @@ bool CartridgeSB::patch(uInt16 address, uInt8 value)
const uInt8* CartridgeSB::getImage(int& size) const
{
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)
*/
CartridgeSB(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeSB();
virtual ~CartridgeSB() = default;
public:
/**
@ -156,7 +152,7 @@ class CartridgeSB : public Cartridge
private:
// The 128-256K ROM image and size of the cartridge
uInt8* myImage;
unique_ptr<uInt8[]> myImage;
uInt32 mySize;
// 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)
*/
CartridgeUA(const uInt8* image, uInt32 size, const Settings& settings);
/**
Destructor
*/
virtual ~CartridgeUA() = default;
public:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -54,10 +54,6 @@ class System : public Serializable
*/
System(const OSystem& osystem, M6502& m6502, M6532& m6532,
TIA& mTIA, Cartridge& mCart);
/**
Destructor
*/
virtual ~System() = default;
// 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)
{
// Allocate buffers for two frame buffers
myCurrentFrameBuffer = new uInt8[160 * 320];
myPreviousFrameBuffer = new uInt8[160 * 320];
myCurrentFrameBuffer = make_ptr<uInt8[]>(160 * 320);
myPreviousFrameBuffer = make_ptr<uInt8[]>(160 * 320);
// Compute all of the mask tables
TIATables::computeAllTables();
@ -63,13 +63,6 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings)
initialize();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::~TIA()
{
delete[] myCurrentFrameBuffer;
delete[] myPreviousFrameBuffer;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::initialize()
{
@ -159,7 +152,7 @@ void TIA::frameReset()
clearBuffers();
// Reset pixel pointer and drawing flag
myFramePointer = myCurrentFrameBuffer;
myFramePointer = myCurrentFrameBuffer.get();
// Calculate color clock offsets for starting and stopping frame drawing
// 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.putInt(myFramePointerClocks);
out.putByteArray(myCurrentFrameBuffer, 160*320);
out.putByteArray(myCurrentFrameBuffer.get(), 160*320);
}
catch(...)
{
@ -499,9 +492,9 @@ bool TIA::loadDisplay(Serializer& in)
// Reset frame buffer pointer and data
clearBuffers();
myFramePointer = myCurrentFrameBuffer;
in.getByteArray(myCurrentFrameBuffer, 160*320);
memcpy(myPreviousFrameBuffer, myCurrentFrameBuffer, 160*320);
myFramePointer = myCurrentFrameBuffer.get();
in.getByteArray(myCurrentFrameBuffer.get(), 160*320);
memcpy(myPreviousFrameBuffer.get(), myCurrentFrameBuffer.get(), 160*320);
// If we're in partial frame mode, make sure to re-create the screen
// as it existed when the state was saved
@ -541,9 +534,7 @@ void TIA::update()
inline void TIA::startFrame()
{
// This stuff should only happen at the beginning of a new frame.
uInt8* tmp = myCurrentFrameBuffer;
myCurrentFrameBuffer = myPreviousFrameBuffer;
myPreviousFrameBuffer = tmp;
myCurrentFrameBuffer.swap(myPreviousFrameBuffer);
// 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
@ -562,7 +553,7 @@ inline void TIA::startFrame()
myClocksToEndOfScanLine = 228;
// Reset frame buffer pointer
myFramePointer = myCurrentFrameBuffer;
myFramePointer = myCurrentFrameBuffer.get();
myFramePointerClocks = 0;
// If color loss is enabled then update the color registers based on
@ -636,8 +627,8 @@ inline void TIA::endFrame()
myScanlineCountForLastFrame = myMaximumNumberOfScanlines;
if(previousCount < myMaximumNumberOfScanlines)
{
memset(myCurrentFrameBuffer, 0, 160 * 320);
memset(myPreviousFrameBuffer, 1, 160 * 320);
memset(myCurrentFrameBuffer.get(), 0, 160 * 320);
memset(myPreviousFrameBuffer.get(), 1, 160 * 320);
}
}
// Did the number of scanlines decrease?
@ -647,8 +638,8 @@ inline void TIA::endFrame()
{
uInt32 offset = myScanlineCountForLastFrame * 160,
stride = (previousCount - myScanlineCountForLastFrame) * 160;
memset(myCurrentFrameBuffer + offset, 0, stride);
memset(myPreviousFrameBuffer + offset, 1, stride);
memset(myCurrentFrameBuffer.get() + offset, 0, stride);
memset(myPreviousFrameBuffer.get() + offset, 1, stride);
}
// Account for frame jitter, skipping the first few frames
@ -1281,8 +1272,8 @@ inline void TIA::waitHorizontalRSync()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::clearBuffers()
{
memset(myCurrentFrameBuffer, 0, 160 * 320);
memset(myPreviousFrameBuffer, 0, 160 * 320);
memset(myCurrentFrameBuffer.get(), 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
*/
TIA(Console& console, Sound& sound, Settings& settings);
/**
Destructor
*/
virtual ~TIA();
virtual ~TIA() = default;
public:
/**
@ -175,7 +171,7 @@ class TIA : public Device
@return Pointer to the current frame buffer
*/
uInt8* currentFrameBuffer() const
{ return myCurrentFrameBuffer + myFramePointerOffset + myCurrentFrameJitter; }
{ return myCurrentFrameBuffer.get() + myFramePointerOffset + myCurrentFrameJitter; }
/**
Answers the previous frame buffer
@ -183,7 +179,7 @@ class TIA : public Device
@return Pointer to the previous frame buffer
*/
uInt8* previousFrameBuffer() const
{ return myPreviousFrameBuffer + myFramePointerOffset; }
{ return myPreviousFrameBuffer.get() + myFramePointerOffset; }
/**
Answers the width and height of the frame buffer
@ -410,10 +406,10 @@ class TIA : public Device
Settings& mySettings;
// Pointer to the current frame buffer
uInt8* myCurrentFrameBuffer;
unique_ptr<uInt8[]> myCurrentFrameBuffer;
// 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
uInt8* myFramePointer;

View File

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

View File

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