Switch MacOS to SettingsRepository, fix clash between bspf.hxx and Cocoa.

This commit is contained in:
Christian Speckner 2019-04-26 00:14:21 +02:00
parent 14e903d8a1
commit 126464f66f
126 changed files with 373 additions and 518 deletions

View File

@ -179,7 +179,7 @@ bool FilesystemNodeZIP::getChildren(AbstractFSList& myList, ListMode mode,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 FilesystemNodeZIP::read(BytePtr& image) const
uInt32 FilesystemNodeZIP::read(ByteBuffer& image) const
{
switch(_error)
{

View File

@ -65,7 +65,7 @@ class FilesystemNodeZIP : public AbstractFSNode
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const override;
AbstractFSNodePtr getParent() const override;
uInt32 read(BytePtr& image) const override;
uInt32 read(ByteBuffer& image) const override;
private:
FilesystemNodeZIP(const string& zipfile, const string& virtualpath,

View File

@ -137,7 +137,7 @@ class PNGLibrary
// The following data remains between invocations of allocateStorage,
// and is only changed when absolutely necessary.
struct ReadInfoType {
BytePtr buffer;
ByteBuffer buffer;
unique_ptr<png_bytep[]> row_pointers;
png_uint_32 width, height, pitch;
uInt32 buffer_size, row_size;

View File

@ -105,7 +105,7 @@ const string& ZipHandler::next()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt64 ZipHandler::decompress(BytePtr& image)
uInt64 ZipHandler::decompress(ByteBuffer& image)
{
if(myZip && myZip->myHeader.uncompressedLength > 0)
{
@ -269,7 +269,7 @@ void ZipHandler::ZipFile::close()
void ZipHandler::ZipFile::readEcd()
{
uInt64 buflen = 1024;
BytePtr buffer;
ByteBuffer buffer;
// We may need multiple tries
while(buflen < 65536)
@ -323,7 +323,7 @@ void ZipHandler::ZipFile::readEcd()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool ZipHandler::ZipFile::readStream(BytePtr& out, uInt64 offset,
bool ZipHandler::ZipFile::readStream(ByteBuffer& out, uInt64 offset,
uInt64 length, uInt64& actual)
{
try
@ -367,7 +367,7 @@ const ZipHandler::ZipHeader* const ZipHandler::ZipFile::nextFile()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompress(BytePtr& out, uInt64 length)
void ZipHandler::ZipFile::decompress(ByteBuffer& out, uInt64 length)
{
// If we don't have enough buffer, error
if(length < myHeader.uncompressedLength)
@ -434,7 +434,7 @@ uInt64 ZipHandler::ZipFile::getCompressedDataOffset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompressDataType0(
uInt64 offset, BytePtr& out, uInt64 length)
uInt64 offset, ByteBuffer& out, uInt64 length)
{
// The data is uncompressed; just read it
uInt64 read_length = 0;
@ -447,7 +447,7 @@ void ZipHandler::ZipFile::decompressDataType0(
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void ZipHandler::ZipFile::decompressDataType8(
uInt64 offset, BytePtr& out, uInt64 length)
uInt64 offset, ByteBuffer& out, uInt64 length)
{
uInt64 input_remaining = myHeader.compressedLength;

View File

@ -47,7 +47,7 @@ class ZipHandler
// Decompress the currently selected file and return its length
// An exception will be thrown on any errors
uInt64 decompress(BytePtr& image);
uInt64 decompress(ByteBuffer& image);
// Answer the number of ROM files (with a valid extension) found
uInt16 romFiles() const { return myZip ? myZip->myRomfiles : 0; }
@ -112,11 +112,11 @@ class ZipHandler
ZipEcd myEcd; // end of central directory
BytePtr myCd; // central directory raw data
ByteBuffer myCd; // central directory raw data
uInt64 myCdPos; // position in central directory
ZipHeader myHeader; // current file header
BytePtr myBuffer; // buffer for decompression
ByteBuffer myBuffer; // buffer for decompression
/** Constructor */
explicit ZipFile(const string& filename);
@ -134,22 +134,22 @@ class ZipHandler
void readEcd();
/** Read data from stream */
bool readStream(BytePtr& out, uInt64 offset, uInt64 length, uInt64& actual);
bool readStream(ByteBuffer& out, uInt64 offset, uInt64 length, uInt64& actual);
/** Return the next entry in the ZIP file */
const ZipHeader* const nextFile();
/** Decompress the most recently found file in the ZIP into target buffer */
void decompress(BytePtr& out, uInt64 length);
void decompress(ByteBuffer& out, uInt64 length);
/** Return the offset of the compressed data */
uInt64 getCompressedDataOffset();
/** Decompress type 0 data (which is uncompressed) */
void decompressDataType0(uInt64 offset, BytePtr& out, uInt64 length);
void decompressDataType0(uInt64 offset, ByteBuffer& out, uInt64 length);
/** Decompress type 8 data (which is deflated) */
void decompressDataType8(uInt64 offset, BytePtr& out, uInt64 length);
void decompressDataType8(uInt64 offset, ByteBuffer& out, uInt64 length);
};
using ZipFilePtr = unique_ptr<ZipFile>;

View File

@ -83,7 +83,7 @@ using BoolArray = std::vector<bool>;
using ByteArray = std::vector<uInt8>;
using ShortArray = std::vector<uInt16>;
using StringList = std::vector<std::string>;
using BytePtr = std::unique_ptr<uInt8[]>;
using ByteBuffer = std::unique_ptr<uInt8[]>;
static const string EmptyString("");

View File

@ -21,7 +21,8 @@ MODULE_OBJS := \
src/common/AudioSettings.o \
src/common/FpsMeter.o \
src/common/ThreadDebugging.o \
src/common/StaggeredLogger.o
src/common/StaggeredLogger.o \
src/common/repository/KeyValueRepositoryConfigfile.o
MODULE_DIRS += \
src/common

View File

@ -31,7 +31,7 @@ class KeyValueRepository
virtual std::map<string, Variant> load() = 0;
virtual void save(std::map<string, Variant>& values) = 0;
virtual void save(const std::map<string, Variant>& values) = 0;
};
#endif // KEY_VALUE_REPOSITORY_HXX

View File

@ -34,7 +34,7 @@ KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const string& filenam
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::map<string, Variant> KeyValueRepositoryConfigfile::load()
{
std::map<string, Variant> pairs;
std::map<string, Variant> values;
string line, key, value;
string::size_type equalPos, garbage;
@ -44,7 +44,7 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
// FIXME - make logger available everywhere
cout << "ERROR: Couldn't load from settings file " << myFilename << endl;
return pairs;
return values;
}
while(getline(in, line))
@ -69,14 +69,14 @@ std::map<string, Variant> KeyValueRepositoryConfigfile::load()
if(key.length() == 0)
continue;
pairs[key] = value;
values[key] = value;
}
return pairs;
return values;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyValueRepositoryConfigfile::save(std::map<string, Variant>& values)
void KeyValueRepositoryConfigfile::save(const std::map<string, Variant>& values)
{
ofstream out(myFilename);
if(!out || !out.is_open()) {

View File

@ -28,7 +28,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepository
virtual std::map<string, Variant> load();
virtual void save(std::map<string, Variant>& values);
virtual void save(const std::map<string, Variant>& values);
private:

View File

@ -28,7 +28,7 @@ class KeyValueRepositoryNoop : public KeyValueRepository
return std::map<string, Variant>();
}
virtual void save(std::map<string, Variant>& values) {}
virtual void save(const std::map<string, Variant>& values) {}
};
#endif // KEY_VALUE_REPOSITORY_NOOP_HXX

View File

@ -302,7 +302,7 @@ class Cartridge : public Device
// The array containing information about every byte of ROM indicating
// whether it is used as code.
BytePtr myCodeAccessBase;
ByteBuffer myCodeAccessBase;
private:
// The startup bank to use (where to look for the reset vector address)

View File

@ -19,7 +19,7 @@
#include "Cart0840.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge0840::Cartridge0840(const BytePtr& image, uInt32 size,
Cartridge0840::Cartridge0840(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -45,7 +45,7 @@ class Cartridge0840 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge0840(const BytePtr& image, uInt32 size, const string& md5,
Cartridge0840(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge0840() = default;

View File

@ -19,7 +19,7 @@
#include "Cart2K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge2K::Cartridge2K(const BytePtr& image, uInt32 size,
Cartridge2K::Cartridge2K(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5)
{

View File

@ -48,7 +48,7 @@ class Cartridge2K : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge2K(const BytePtr& image, uInt32 size, const string& md5,
Cartridge2K(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge2K() = default;
@ -127,7 +127,7 @@ class Cartridge2K : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// Size of the ROM image
uInt32 mySize;

View File

@ -20,7 +20,7 @@
#include "Cart3E.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3E::Cartridge3E(const BytePtr& image, uInt32 size,
Cartridge3E::Cartridge3E(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -74,7 +74,7 @@ class Cartridge3E : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge3E(const BytePtr& image, uInt32 size, const string& md5,
Cartridge3E(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge3E() = default;
@ -180,7 +180,7 @@ class Cartridge3E : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// RAM contents. For now every ROM gets all 32K of potential RAM
uInt8 myRAM[32 * 1024];

View File

@ -20,7 +20,7 @@
#include "Cart3EPlus.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3EPlus::Cartridge3EPlus(const BytePtr& image, uInt32 size,
Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size)

View File

@ -54,7 +54,7 @@ class Cartridge3EPlus: public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge3EPlus(const BytePtr& image, uInt32 size, const string& md5,
Cartridge3EPlus(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge3EPlus() = default;
@ -178,7 +178,7 @@ class Cartridge3EPlus: public Cartridge
static constexpr uInt16 RAM_WRITE_OFFSET = 0x200;
BytePtr myImage; // Pointer to a dynamically allocated ROM image of the cartridge
ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge
uInt32 mySize; // Size of the ROM image
uInt8 myRAM[RAM_TOTAL_SIZE];

View File

@ -20,7 +20,7 @@
#include "Cart3F.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge3F::Cartridge3F(const BytePtr& image, uInt32 size,
Cartridge3F::Cartridge3F(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -51,7 +51,7 @@ class Cartridge3F : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge3F(const BytePtr& image, uInt32 size, const string& md5,
Cartridge3F(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge3F() = default;
@ -157,7 +157,7 @@ class Cartridge3F : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// Size of the ROM image
uInt32 mySize;

View File

@ -21,7 +21,7 @@
#include "Cart4A50.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4A50::Cartridge4A50(const BytePtr& image, uInt32 size,
Cartridge4A50::Cartridge4A50(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -65,7 +65,7 @@ class Cartridge4A50 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge4A50(const BytePtr& image, uInt32 size, const string& md5,
Cartridge4A50(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge4A50() = default;

View File

@ -19,7 +19,7 @@
#include "Cart4K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4K::Cartridge4K(const BytePtr& image, uInt32 size,
Cartridge4K::Cartridge4K(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5)
{

View File

@ -45,7 +45,7 @@ class Cartridge4K : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge4K(const BytePtr& image, uInt32 size, const string& md5,
Cartridge4K(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge4K() = default;

View File

@ -19,7 +19,7 @@
#include "Cart4KSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4KSC::Cartridge4KSC(const BytePtr& image, uInt32 size,
Cartridge4KSC::Cartridge4KSC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5)
{

View File

@ -44,7 +44,7 @@ class Cartridge4KSC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
Cartridge4KSC(const BytePtr& image, uInt32 size, const string& md5,
Cartridge4KSC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~Cartridge4KSC() = default;

View File

@ -20,7 +20,7 @@
#include "CartAR.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::CartridgeAR(const BytePtr& image, uInt32 size,
CartridgeAR::CartridgeAR(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(std::max(size, 8448u)),

View File

@ -52,7 +52,7 @@ class CartridgeAR : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeAR(const BytePtr& image, uInt32 size, const string& md5,
CartridgeAR(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeAR() = default;
@ -197,7 +197,7 @@ class CartridgeAR : public Cartridge
uInt32 mySize;
// All of the 8448 byte loads associated with the game
BytePtr myLoadImages;
ByteBuffer myLoadImages;
// Indicates how many 8448 loads there are
uInt8 myNumberOfLoadImages;

View File

@ -19,7 +19,7 @@
#include "CartBF.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBF::CartridgeBF(const BytePtr& image, uInt32 size,
CartridgeBF::CartridgeBF(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeBF : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeBF(const BytePtr& image, uInt32 size, const string& md5,
CartridgeBF(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeBF() = default;

View File

@ -19,7 +19,7 @@
#include "CartBFSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBFSC::CartridgeBFSC(const BytePtr& image, uInt32 size,
CartridgeBFSC::CartridgeBFSC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeBFSC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeBFSC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeBFSC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeBFSC() = default;

View File

@ -41,7 +41,7 @@
#define DIGITAL_AUDIO_ON ((myMode & 0xF0) == 0)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size,
CartridgeBUS::CartridgeBUS(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myAudioCycles(0),

View File

@ -54,7 +54,7 @@ class CartridgeBUS : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeBUS(const BytePtr& image, uInt32 size, const string& md5,
CartridgeBUS(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeBUS() = default;

View File

@ -57,7 +57,7 @@ namespace {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myAudioCycles(0),

View File

@ -62,7 +62,7 @@ class CartridgeCDF : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCDF(const BytePtr& image, uInt32 size, const string& md5,
CartridgeCDF(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeCDF() = default;

View File

@ -21,7 +21,7 @@
#include "CartCM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCM::CartridgeCM(const BytePtr& image, uInt32 size,
CartridgeCM::CartridgeCM(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySWCHA(0xFF), // portA is all 1's

View File

@ -120,7 +120,7 @@ class CartridgeCM : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCM(const BytePtr& image, uInt32 size, const string& md5,
CartridgeCM(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeCM() = default;

View File

@ -22,7 +22,7 @@
#include "CartCTY.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCTY::CartridgeCTY(const BytePtr& image, uInt32 size,
CartridgeCTY::CartridgeCTY(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myOperationType(0),

View File

@ -118,7 +118,7 @@ class CartridgeCTY : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the settings object
*/
CartridgeCTY(const BytePtr& image, uInt32 size, const string& md5,
CartridgeCTY(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeCTY() = default;

View File

@ -19,7 +19,7 @@
#include "CartCV.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCV::CartridgeCV(const BytePtr& image, uInt32 size,
CartridgeCV::CartridgeCV(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size)

View File

@ -48,7 +48,7 @@ class CartridgeCV : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCV(const BytePtr& image, uInt32 size, const string& md5,
CartridgeCV(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeCV() = default;
@ -138,7 +138,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
BytePtr myInitialRAM;
ByteBuffer myInitialRAM;
// Initial size of the cart data
uInt32 mySize;

View File

@ -20,7 +20,7 @@
#include "CartCVPlus.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCVPlus::CartridgeCVPlus(const BytePtr& image, uInt32 size,
CartridgeCVPlus::CartridgeCVPlus(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -57,7 +57,7 @@ class CartridgeCVPlus : public Cartridge
@param size The size of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeCVPlus(const BytePtr& image, uInt32 size, const string& md5,
CartridgeCVPlus(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeCVPlus() = default;
@ -163,7 +163,7 @@ class CartridgeCVPlus : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// The 1024 bytes of RAM
uInt8 myRAM[1024];

View File

@ -20,7 +20,7 @@
#include "CartDASH.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDASH::CartridgeDASH(const BytePtr& image, uInt32 size,
CartridgeDASH::CartridgeDASH(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size)

View File

@ -136,7 +136,7 @@ class CartridgeDASH: public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeDASH(const BytePtr& image, uInt32 size, const string& md5,
CartridgeDASH(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeDASH() = default;
@ -261,7 +261,7 @@ class CartridgeDASH: public Cartridge
static constexpr uInt16 RAM_WRITE_OFFSET = 0x800;
BytePtr myImage; // Pointer to a dynamically allocated ROM image of the cartridge
ByteBuffer myImage; // Pointer to a dynamically allocated ROM image of the cartridge
uInt32 mySize; // Size of the ROM image
uInt8 myRAM[RAM_TOTAL_SIZE];

View File

@ -19,7 +19,7 @@
#include "CartDF.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDF::CartridgeDF(const BytePtr& image, uInt32 size,
CartridgeDF::CartridgeDF(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeDF : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeDF(const BytePtr& image, uInt32 size, const string& md5,
CartridgeDF(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeDF() = default;

View File

@ -19,7 +19,7 @@
#include "CartDFSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDFSC::CartridgeDFSC(const BytePtr& image, uInt32 size,
CartridgeDFSC::CartridgeDFSC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeDFSC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeDFSC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeDFSC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeDFSC() = default;

View File

@ -19,7 +19,7 @@
#include "CartDPC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDPC::CartridgeDPC(const BytePtr& image, uInt32 size,
CartridgeDPC::CartridgeDPC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -50,7 +50,7 @@ class CartridgeDPC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeDPC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeDPC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeDPC() = default;

View File

@ -26,7 +26,7 @@
#include "exception/FatalEmulationError.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(std::min(size, 32768u)),

View File

@ -56,7 +56,7 @@ class CartridgeDPCPlus : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeDPCPlus(const BytePtr& image, uInt32 size, const string& md5,
CartridgeDPCPlus(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeDPCPlus() = default;

View File

@ -66,7 +66,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Cartridge> CartDetector::create(const FilesystemNode& file,
const BytePtr& image, uInt32 size, string& md5,
const ByteBuffer& image, uInt32 size, string& md5,
const string& propertiesType, Settings& settings)
{
unique_ptr<Cartridge> cartridge;
@ -210,13 +210,13 @@ unique_ptr<Cartridge> CartDetector::create(const FilesystemNode& file,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Cartridge>
CartDetector::createFromMultiCart(const BytePtr& image, uInt32& size,
CartDetector::createFromMultiCart(const ByteBuffer& image, uInt32& size,
uInt32 numroms, string& md5, Bankswitch::Type type, string& id, Settings& settings)
{
// Get a piece of the larger image
uInt32 i = settings.getInt("romloadcount");
size /= numroms;
BytePtr slice = make_unique<uInt8[]>(size);
ByteBuffer slice = make_unique<uInt8[]>(size);
memcpy(slice.get(), image.get()+i*size, size);
// We need a new md5 and name
@ -238,7 +238,7 @@ CartDetector::createFromMultiCart(const BytePtr& image, uInt32& size,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Cartridge>
CartDetector::createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Type type,
CartDetector::createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type,
const string& md5, Settings& settings)
{
// We should know the cart's type by now so let's create it
@ -334,7 +334,7 @@ CartDetector::createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Typ
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Bankswitch::Type CartDetector::autodetectType(const BytePtr& image, uInt32 size)
Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, uInt32 size)
{
// Guess type based on size
Bankswitch::Type type = Bankswitch::Type::_AUTO;
@ -551,7 +551,7 @@ bool CartDetector::searchForBytes(const uInt8* image, uInt32 imagesize,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablySC(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablySC(const ByteBuffer& image, uInt32 size)
{
// We assume a Superchip cart repeats the first 128 bytes for the second
// 128 bytes in the RAM area, which is the first 256 bytes of each 4K bank
@ -568,7 +568,7 @@ bool CartDetector::isProbablySC(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyARM(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyARM(const ByteBuffer& image, uInt32 size)
{
// ARM code contains the following 'loader' patterns in the first 1K
// Thanks to Thomas Jentzsch of AtariAge for this advice
@ -583,7 +583,7 @@ bool CartDetector::isProbablyARM(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably0840(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably0840(const ByteBuffer& image, uInt32 size)
{
// 0840 cart bankswitching is triggered by accessing addresses 0x0800
// or 0x0840 at least twice
@ -608,7 +608,7 @@ bool CartDetector::isProbably0840(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably3E(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably3E(const ByteBuffer& image, uInt32 size)
{
// 3E cart bankswitching is triggered by storing the bank number
// in address 3E using 'STA $3E', commonly followed by an
@ -618,7 +618,7 @@ bool CartDetector::isProbably3E(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably3EPlus(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably3EPlus(const ByteBuffer& image, uInt32 size)
{
// 3E+ cart is identified key 'TJ3E' in the ROM
uInt8 tj3e[] = { 'T', 'J', '3', 'E' };
@ -626,7 +626,7 @@ bool CartDetector::isProbably3EPlus(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably3F(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably3F(const ByteBuffer& image, uInt32 size)
{
// 3F cart bankswitching is triggered by storing the bank number
// in address 3F using 'STA $3F'
@ -637,7 +637,7 @@ bool CartDetector::isProbably3F(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably4A50(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably4A50(const ByteBuffer& image, uInt32 size)
{
// 4A50 carts store address $4A50 at the NMI vector, which
// in this scheme is always in the last page of ROM at
@ -655,7 +655,7 @@ bool CartDetector::isProbably4A50(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbably4KSC(const BytePtr& image, uInt32 size)
bool CartDetector::isProbably4KSC(const ByteBuffer& image, uInt32 size)
{
// We check if the first 256 bytes are identical *and* if there's
// an "SC" signature for one of our larger SC types at 1FFA.
@ -672,7 +672,7 @@ bool CartDetector::isProbably4KSC(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyBF(const BytePtr& image, uInt32 size,
bool CartDetector::isProbablyBF(const ByteBuffer& image, uInt32 size,
Bankswitch::Type& type)
{
// BF carts store strings 'BFBF' and 'BFSC' starting at address $FFF8
@ -694,7 +694,7 @@ bool CartDetector::isProbablyBF(const BytePtr& image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyBUS(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyBUS(const ByteBuffer& image, uInt32 size)
{
// BUS ARM code has 2 occurrences of the string BUS
// Note: all Harmony/Melody custom drivers also contain the value
@ -704,7 +704,7 @@ bool CartDetector::isProbablyBUS(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyCDF(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyCDF(const ByteBuffer& image, uInt32 size)
{
// CDF ARM code has 3 occurrences of the string CDF
// Note: all Harmony/Melody custom drivers also contain the value
@ -714,14 +714,14 @@ bool CartDetector::isProbablyCDF(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyCTY(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyCTY(const ByteBuffer& image, uInt32 size)
{
uInt8 lenin[] = { 'L', 'E', 'N', 'I', 'N' };
return searchForBytes(image.get(), size, lenin, 5, 1);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyCV(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyCV(const ByteBuffer& image, uInt32 size)
{
// CV RAM access occurs at addresses $f3ff and $f400
// These signatures are attributed to the MESS project
@ -736,7 +736,7 @@ bool CartDetector::isProbablyCV(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyCVPlus(const BytePtr& image, uInt32)
bool CartDetector::isProbablyCVPlus(const ByteBuffer& image, uInt32)
{
// CV+ cart is identified key 'commavidplus' @ $04 in the ROM
// We inspect only this area to speed up the search
@ -746,7 +746,7 @@ bool CartDetector::isProbablyCVPlus(const BytePtr& image, uInt32)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyDASH(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyDASH(const ByteBuffer& image, uInt32 size)
{
// DASH cart is identified key 'TJAD' in the ROM
uInt8 tjad[] = { 'T', 'J', 'A', 'D' };
@ -754,7 +754,7 @@ bool CartDetector::isProbablyDASH(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyDF(const BytePtr& image, uInt32 size,
bool CartDetector::isProbablyDF(const ByteBuffer& image, uInt32 size,
Bankswitch::Type& type)
{
@ -777,7 +777,7 @@ bool CartDetector::isProbablyDF(const BytePtr& image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyDPCplus(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyDPCplus(const ByteBuffer& image, uInt32 size)
{
// DPC+ ARM code has 2 occurrences of the string DPC+
// Note: all Harmony/Melody custom drivers also contain the value
@ -787,7 +787,7 @@ bool CartDetector::isProbablyDPCplus(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyE0(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyE0(const ByteBuffer& image, uInt32 size)
{
// E0 cart bankswitching is triggered by accessing addresses
// $FE0 to $FF9 using absolute non-indexed addressing
@ -813,7 +813,7 @@ bool CartDetector::isProbablyE0(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyE7(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyE7(const ByteBuffer& image, uInt32 size)
{
// E7 cart bankswitching is triggered by accessing addresses
// $FE0 to $FE6 using absolute non-indexed addressing
@ -838,7 +838,7 @@ bool CartDetector::isProbablyE7(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyE78K(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyE78K(const ByteBuffer& image, uInt32 size)
{
// E78K cart bankswitching is triggered by accessing addresses
// $FE4 to $FE6 using absolute non-indexed addressing
@ -857,7 +857,7 @@ bool CartDetector::isProbablyE78K(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyEF(const BytePtr& image, uInt32 size,
bool CartDetector::isProbablyEF(const ByteBuffer& image, uInt32 size,
Bankswitch::Type& type)
{
// Newer EF carts store strings 'EFEF' and 'EFSC' starting at address $FFF8
@ -906,7 +906,7 @@ bool CartDetector::isProbablyEF(const BytePtr& image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyFA2(const BytePtr& image, uInt32)
bool CartDetector::isProbablyFA2(const ByteBuffer& image, uInt32)
{
// This currently tests only the 32K version of FA2; the 24 and 28K
// versions are easy, in that they're the only possibility with those
@ -921,7 +921,7 @@ bool CartDetector::isProbablyFA2(const BytePtr& image, uInt32)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyFE(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyFE(const ByteBuffer& image, uInt32 size)
{
// FE bankswitching is very weird, but always seems to include a
// 'JSR $xxxx'
@ -940,7 +940,7 @@ bool CartDetector::isProbablyFE(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyMDM(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyMDM(const ByteBuffer& image, uInt32 size)
{
// MDM cart is identified key 'MDMC' in the first 8K of ROM
uInt8 mdmc[] = { 'M', 'D', 'M', 'C' };
@ -948,7 +948,7 @@ bool CartDetector::isProbablyMDM(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablySB(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablySB(const ByteBuffer& image, uInt32 size)
{
// SB cart bankswitching switches banks by accessing address 0x0800
uInt8 signature[2][3] = {
@ -962,7 +962,7 @@ bool CartDetector::isProbablySB(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyUA(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyUA(const ByteBuffer& image, uInt32 size)
{
// UA cart bankswitching switches to bank 1 by accessing address 0x240
// using 'STA $240' or 'LDA $240'
@ -979,7 +979,7 @@ bool CartDetector::isProbablyUA(const BytePtr& image, uInt32 size)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDetector::isProbablyX07(const BytePtr& image, uInt32 size)
bool CartDetector::isProbablyX07(const ByteBuffer& image, uInt32 size)
{
// X07 bankswitching switches to bank 0, 1, 2, etc by accessing address 0x08xd
uInt8 signature[6][3] = {

View File

@ -46,7 +46,7 @@ class CartDetector
@return Pointer to the new cartridge object allocated on the heap
*/
static unique_ptr<Cartridge> create(const FilesystemNode& file,
const BytePtr& image, uInt32 size, string& md5,
const ByteBuffer& image, uInt32 size, string& md5,
const string& dtype, Settings& settings);
private:
@ -65,7 +65,7 @@ class CartDetector
@return Pointer to the new cartridge object allocated on the heap
*/
static unique_ptr<Cartridge>
createFromMultiCart(const BytePtr& image, uInt32& size,
createFromMultiCart(const ByteBuffer& image, uInt32& size,
uInt32 numroms, string& md5, Bankswitch::Type type, string& id,
Settings& settings);
@ -81,7 +81,7 @@ class CartDetector
@return Pointer to the new cartridge object allocated on the heap
*/
static unique_ptr<Cartridge>
createFromImage(const BytePtr& image, uInt32 size, Bankswitch::Type type,
createFromImage(const ByteBuffer& image, uInt32 size, Bankswitch::Type type,
const string& md5, Settings& settings);
/**
@ -92,7 +92,7 @@ class CartDetector
@return The "best guess" for the cartridge type
*/
static Bankswitch::Type autodetectType(const BytePtr& image, uInt32 size);
static Bankswitch::Type autodetectType(const ByteBuffer& image, uInt32 size);
/**
Search the image for the specified byte signature
@ -113,142 +113,142 @@ class CartDetector
Returns true if the image is probably a SuperChip (128 bytes RAM)
Note: should be called only on ROMs with size multiple of 4K
*/
static bool isProbablySC(const BytePtr& image, uInt32 size);
static bool isProbablySC(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image probably contains ARM code in the first 1K
*/
static bool isProbablyARM(const BytePtr& image, uInt32 size);
static bool isProbablyARM(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 0840 bankswitching cartridge
*/
static bool isProbably0840(const BytePtr& image, uInt32 size);
static bool isProbably0840(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 3E bankswitching cartridge
*/
static bool isProbably3E(const BytePtr& image, uInt32 size);
static bool isProbably3E(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 3E+ bankswitching cartridge
*/
static bool isProbably3EPlus(const BytePtr& image, uInt32 size);
static bool isProbably3EPlus(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 3F bankswitching cartridge
*/
static bool isProbably3F(const BytePtr& image, uInt32 size);
static bool isProbably3F(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 4A50 bankswitching cartridge
*/
static bool isProbably4A50(const BytePtr& image, uInt32 size);
static bool isProbably4A50(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a 4K SuperChip (128 bytes RAM)
*/
static bool isProbably4KSC(const BytePtr& image, uInt32 size);
static bool isProbably4KSC(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a BF/BFSC bankswitching cartridge
*/
static bool isProbablyBF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
static bool isProbablyBF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
/**
Returns true if the image is probably a BUS bankswitching cartridge
*/
static bool isProbablyBUS(const BytePtr& image, uInt32 size);
static bool isProbablyBUS(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a CDF bankswitching cartridge
*/
static bool isProbablyCDF(const BytePtr& image, uInt32 size);
static bool isProbablyCDF(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a CTY bankswitching cartridge
*/
static bool isProbablyCTY(const BytePtr& image, uInt32 size);
static bool isProbablyCTY(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a CV bankswitching cartridge
*/
static bool isProbablyCV(const BytePtr& image, uInt32 size);
static bool isProbablyCV(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a CV+ bankswitching cartridge
*/
static bool isProbablyCVPlus(const BytePtr& image, uInt32 size);
static bool isProbablyCVPlus(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a DASH bankswitching cartridge
*/
static bool isProbablyDASH(const BytePtr& image, uInt32 size);
static bool isProbablyDASH(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a DF/DFSC bankswitching cartridge
*/
static bool isProbablyDF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
static bool isProbablyDF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
/**
Returns true if the image is probably a DPC+ bankswitching cartridge
*/
static bool isProbablyDPCplus(const BytePtr& image, uInt32 size);
static bool isProbablyDPCplus(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a E0 bankswitching cartridge
*/
static bool isProbablyE0(const BytePtr& image, uInt32 size);
static bool isProbablyE0(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a E7 bankswitching cartridge
*/
static bool isProbablyE7(const BytePtr& image, uInt32 size);
static bool isProbablyE7(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a E78K bankswitching cartridge
*/
static bool isProbablyE78K(const BytePtr& image, uInt32 size);
static bool isProbablyE78K(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably an EF/EFSC bankswitching cartridge
*/
static bool isProbablyEF(const BytePtr& image, uInt32 size, Bankswitch::Type& type);
static bool isProbablyEF(const ByteBuffer& image, uInt32 size, Bankswitch::Type& type);
/**
Returns true if the image is probably an F6 bankswitching cartridge
*/
//static bool isProbablyF6(const BytePtr& image, uInt32 size);
//static bool isProbablyF6(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably an FA2 bankswitching cartridge
*/
static bool isProbablyFA2(const BytePtr& image, uInt32 size);
static bool isProbablyFA2(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably an FE bankswitching cartridge
*/
static bool isProbablyFE(const BytePtr& image, uInt32 size);
static bool isProbablyFE(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a MDM bankswitching cartridge
*/
static bool isProbablyMDM(const BytePtr& image, uInt32 size);
static bool isProbablyMDM(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a SB bankswitching cartridge
*/
static bool isProbablySB(const BytePtr& image, uInt32 size);
static bool isProbablySB(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably a UA bankswitching cartridge
*/
static bool isProbablyUA(const BytePtr& image, uInt32 size);
static bool isProbablyUA(const ByteBuffer& image, uInt32 size);
/**
Returns true if the image is probably an X07 bankswitching cartridge
*/
static bool isProbablyX07(const BytePtr& image, uInt32 size);
static bool isProbablyX07(const ByteBuffer& image, uInt32 size);
private:
// Following constructors and assignment operators not supported

View File

@ -19,7 +19,7 @@
#include "CartE0.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE0::CartridgeE0(const BytePtr& image, uInt32 size,
CartridgeE0::CartridgeE0(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5)
{

View File

@ -54,7 +54,7 @@ class CartridgeE0 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeE0(const BytePtr& image, uInt32 size, const string& md5,
CartridgeE0(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeE0() = default;

View File

@ -19,7 +19,7 @@
#include "CartE7.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE7::CartridgeE7(const BytePtr& image, uInt32 size,
CartridgeE7::CartridgeE7(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: CartridgeMNetwork(image, size, md5, settings)
{

View File

@ -43,7 +43,7 @@ class CartridgeE7 : public CartridgeMNetwork
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeE7(const BytePtr& image, uInt32 size, const string& md5,
CartridgeE7(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeE7() = default;

View File

@ -19,7 +19,7 @@
#include "CartE78K.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeE78K::CartridgeE78K(const BytePtr& image, uInt32 size,
CartridgeE78K::CartridgeE78K(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: CartridgeMNetwork(image, size, md5, settings)
{

View File

@ -41,7 +41,7 @@ class CartridgeE78K : public CartridgeMNetwork
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeE78K(const BytePtr& image, uInt32 size, const string& md5,
CartridgeE78K(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeE78K() = default;

View File

@ -19,7 +19,7 @@
#include "CartEF.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEF::CartridgeEF(const BytePtr& image, uInt32 size,
CartridgeEF::CartridgeEF(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeEF : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeEF(const BytePtr& image, uInt32 size, const string& md5,
CartridgeEF(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeEF() = default;

View File

@ -19,7 +19,7 @@
#include "CartEFSC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeEFSC::CartridgeEFSC(const BytePtr& image, uInt32 size,
CartridgeEFSC::CartridgeEFSC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -47,7 +47,7 @@ class CartridgeEFSC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeEFSC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeEFSC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeEFSC() = default;

View File

@ -19,7 +19,7 @@
#include "CartF0.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF0::CartridgeF0(const BytePtr& image, uInt32 size,
CartridgeF0::CartridgeF0(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeF0 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF0(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF0(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF0() = default;

View File

@ -20,7 +20,7 @@
#include "CartF4.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4::CartridgeF4(const BytePtr& image, uInt32 size,
CartridgeF4::CartridgeF4(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -45,7 +45,7 @@ class CartridgeF4 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF4(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF4(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF4() = default;

View File

@ -19,7 +19,7 @@
#include "CartF4SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF4SC::CartridgeF4SC(const BytePtr& image, uInt32 size,
CartridgeF4SC::CartridgeF4SC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeF4SC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF4SC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF4SC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF4SC() = default;

View File

@ -19,7 +19,7 @@
#include "CartF6.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6::CartridgeF6(const BytePtr& image, uInt32 size,
CartridgeF6::CartridgeF6(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -45,7 +45,7 @@ class CartridgeF6 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF6(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF6(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF6() = default;

View File

@ -19,7 +19,7 @@
#include "CartF6SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF6SC::CartridgeF6SC(const BytePtr& image, uInt32 size,
CartridgeF6SC::CartridgeF6SC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeF6SC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF6SC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF6SC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF6SC() = default;

View File

@ -19,7 +19,7 @@
#include "CartF8.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8::CartridgeF8(const BytePtr& image, uInt32 size,
CartridgeF8::CartridgeF8(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -45,7 +45,7 @@ class CartridgeF8 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF8(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF8(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF8() = default;

View File

@ -19,7 +19,7 @@
#include "CartF8SC.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeF8SC::CartridgeF8SC(const BytePtr& image, uInt32 size,
CartridgeF8SC::CartridgeF8SC(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeF8SC : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeF8SC(const BytePtr& image, uInt32 size, const string& md5,
CartridgeF8SC(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeF8SC() = default;

View File

@ -19,7 +19,7 @@
#include "CartFA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA::CartridgeFA(const BytePtr& image, uInt32 size,
CartridgeFA::CartridgeFA(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -46,7 +46,7 @@ class CartridgeFA : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeFA(const BytePtr& image, uInt32 size, const string& md5,
CartridgeFA(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeFA() = default;

View File

@ -22,7 +22,7 @@
#include "CartFA2.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFA2::CartridgeFA2(const BytePtr& image, uInt32 size,
CartridgeFA2::CartridgeFA2(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(28 * 1024),

View File

@ -58,7 +58,7 @@ class CartridgeFA2 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the settings object
*/
CartridgeFA2(const BytePtr& image, uInt32 size, const string& md5,
CartridgeFA2(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeFA2() = default;

View File

@ -20,7 +20,7 @@
#include "CartFE.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const BytePtr& image, uInt32 size,
CartridgeFE::CartridgeFE(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0),

View File

@ -88,7 +88,7 @@ class CartridgeFE : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeFE(const BytePtr& image, uInt32 size, const string& md5,
CartridgeFE(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeFE() = default;

View File

@ -19,7 +19,7 @@
#include "CartMDM.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMDM::CartridgeMDM(const BytePtr& image, uInt32 size,
CartridgeMDM::CartridgeMDM(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -57,7 +57,7 @@ class CartridgeMDM : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeMDM(const BytePtr& image, uInt32 size, const string& md5,
CartridgeMDM(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeMDM() = default;
@ -163,7 +163,7 @@ class CartridgeMDM : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// Size of the ROM image
uInt32 mySize;

View File

@ -19,7 +19,7 @@
#include "CartMNetwork.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
CartridgeMNetwork::CartridgeMNetwork(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),
@ -29,7 +29,7 @@ CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartridgeMNetwork::initialize(const BytePtr& image, uInt32 size)
void CartridgeMNetwork::initialize(const ByteBuffer& image, uInt32 size)
{
// Allocate array for the ROM image
myImage = make_unique<uInt8[]>(size);

View File

@ -73,7 +73,7 @@ class CartridgeMNetwork : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeMNetwork(const BytePtr& image, uInt32 size, const string& md5,
CartridgeMNetwork(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeMNetwork() = default;
@ -162,7 +162,7 @@ class CartridgeMNetwork : public Cartridge
/**
Class initialization
*/
void initialize(const BytePtr& image, uInt32 size);
void initialize(const ByteBuffer& image, uInt32 size);
/**
Install pages for the specified 256 byte bank of RAM
@ -195,7 +195,7 @@ class CartridgeMNetwork : public Cartridge
private:
// Pointer to a dynamically allocated ROM image of the cartridge
BytePtr myImage;
ByteBuffer myImage;
// The 16K ROM image of the cartridge (works for E78K too)
//uInt8 myImage[BANK_SIZE * 8];

View File

@ -19,7 +19,7 @@
#include "CartSB.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeSB::CartridgeSB(const BytePtr& image, uInt32 size,
CartridgeSB::CartridgeSB(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(size),

View File

@ -46,7 +46,7 @@ class CartridgeSB : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeSB(const BytePtr& image, uInt32 size, const string& md5,
CartridgeSB(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeSB() = default;
@ -152,7 +152,7 @@ class CartridgeSB : public Cartridge
private:
// The 128-256K ROM image and size of the cartridge
BytePtr myImage;
ByteBuffer myImage;
uInt32 mySize;
// Indicates the offset into the ROM image (aligns to current bank)

View File

@ -19,7 +19,7 @@
#include "CartUA.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeUA::CartridgeUA(const BytePtr& image, uInt32 size,
CartridgeUA::CartridgeUA(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myBankOffset(0)

View File

@ -45,7 +45,7 @@ class CartridgeUA : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeUA(const BytePtr& image, uInt32 size, const string& md5,
CartridgeUA(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeUA() = default;

View File

@ -21,7 +21,7 @@
#include "CartWD.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeWD::CartridgeWD(const BytePtr& image, uInt32 size,
CartridgeWD::CartridgeWD(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
mySize(std::min(8195u, size)),

View File

@ -74,7 +74,7 @@ class CartridgeWD : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeWD(const BytePtr& image, uInt32 size, const string& md5,
CartridgeWD(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeWD() = default;

View File

@ -21,7 +21,7 @@
#include "CartX07.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeX07::CartridgeX07(const BytePtr& image, uInt32 size,
CartridgeX07::CartridgeX07(const ByteBuffer& image, uInt32 size,
const string& md5, const Settings& settings)
: Cartridge(settings, md5),
myCurrentBank(0)

View File

@ -55,7 +55,7 @@ class CartridgeX07 : public Cartridge
@param md5 The md5sum of the ROM image
@param settings A reference to the various settings (read-only)
*/
CartridgeX07(const BytePtr& image, uInt32 size, const string& md5,
CartridgeX07(const ByteBuffer& image, uInt32 size, const string& md5,
const Settings& settings);
virtual ~CartridgeX07() = default;

Some files were not shown because too many files have changed in this diff Show More