diff --git a/src/common/FSNodeZIP.cxx b/src/common/FSNodeZIP.cxx index 8090612f4..452e326a0 100644 --- a/src/common/FSNodeZIP.cxx +++ b/src/common/FSNodeZIP.cxx @@ -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) { diff --git a/src/common/FSNodeZIP.hxx b/src/common/FSNodeZIP.hxx index f9fd3f5c1..4e10d1d04 100644 --- a/src/common/FSNodeZIP.hxx +++ b/src/common/FSNodeZIP.hxx @@ -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, diff --git a/src/common/PNGLibrary.hxx b/src/common/PNGLibrary.hxx index 2c319ba1f..ee61d302a 100644 --- a/src/common/PNGLibrary.hxx +++ b/src/common/PNGLibrary.hxx @@ -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 row_pointers; png_uint_32 width, height, pitch; uInt32 buffer_size, row_size; diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index b7c303055..91ccbcda6 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -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; diff --git a/src/common/ZipHandler.hxx b/src/common/ZipHandler.hxx index 137682076..5f3081908 100644 --- a/src/common/ZipHandler.hxx +++ b/src/common/ZipHandler.hxx @@ -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; diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index ef5e57f17..f123fa9e6 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -83,7 +83,7 @@ using BoolArray = std::vector; using ByteArray = std::vector; using ShortArray = std::vector; using StringList = std::vector; -using BytePtr = std::unique_ptr; +using ByteBuffer = std::unique_ptr; static const string EmptyString(""); diff --git a/src/common/module.mk b/src/common/module.mk index 530dda57a..6d48a20f5 100644 --- a/src/common/module.mk +++ b/src/common/module.mk @@ -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 diff --git a/src/common/repository/KeyValueRepository.hxx b/src/common/repository/KeyValueRepository.hxx index 58652cc3c..c8c8540e5 100644 --- a/src/common/repository/KeyValueRepository.hxx +++ b/src/common/repository/KeyValueRepository.hxx @@ -31,7 +31,7 @@ class KeyValueRepository virtual std::map load() = 0; - virtual void save(std::map& values) = 0; + virtual void save(const std::map& values) = 0; }; #endif // KEY_VALUE_REPOSITORY_HXX diff --git a/src/common/repository/KeyValueRepositoryConfigfile.cxx b/src/common/repository/KeyValueRepositoryConfigfile.cxx index 6b514ba8b..c265b2a76 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.cxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.cxx @@ -34,7 +34,7 @@ KeyValueRepositoryConfigfile::KeyValueRepositoryConfigfile(const string& filenam // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - std::map KeyValueRepositoryConfigfile::load() { - std::map pairs; + std::map values; string line, key, value; string::size_type equalPos, garbage; @@ -44,7 +44,7 @@ std::map 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 KeyValueRepositoryConfigfile::load() if(key.length() == 0) continue; - pairs[key] = value; + values[key] = value; } - return pairs; + return values; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void KeyValueRepositoryConfigfile::save(std::map& values) +void KeyValueRepositoryConfigfile::save(const std::map& values) { ofstream out(myFilename); if(!out || !out.is_open()) { diff --git a/src/common/repository/KeyValueRepositoryConfigfile.hxx b/src/common/repository/KeyValueRepositoryConfigfile.hxx index 4bb799506..e6b07b299 100644 --- a/src/common/repository/KeyValueRepositoryConfigfile.hxx +++ b/src/common/repository/KeyValueRepositoryConfigfile.hxx @@ -28,7 +28,7 @@ class KeyValueRepositoryConfigfile : public KeyValueRepository virtual std::map load(); - virtual void save(std::map& values); + virtual void save(const std::map& values); private: diff --git a/src/common/repository/KeyValueRepositoryNoop.hxx b/src/common/repository/KeyValueRepositoryNoop.hxx index 863364b31..b4d2dc137 100644 --- a/src/common/repository/KeyValueRepositoryNoop.hxx +++ b/src/common/repository/KeyValueRepositoryNoop.hxx @@ -28,7 +28,7 @@ class KeyValueRepositoryNoop : public KeyValueRepository return std::map(); } - virtual void save(std::map& values) {} + virtual void save(const std::map& values) {} }; #endif // KEY_VALUE_REPOSITORY_NOOP_HXX diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index 41773bae3..d40ef8ab2 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -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) diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index fd4743e46..af6c0d703 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -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) diff --git a/src/emucore/Cart0840.hxx b/src/emucore/Cart0840.hxx index 2fb591c64..eef306fba 100644 --- a/src/emucore/Cart0840.hxx +++ b/src/emucore/Cart0840.hxx @@ -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; diff --git a/src/emucore/Cart2K.cxx b/src/emucore/Cart2K.cxx index c316548b5..8b1b7b3f4 100644 --- a/src/emucore/Cart2K.cxx +++ b/src/emucore/Cart2K.cxx @@ -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) { diff --git a/src/emucore/Cart2K.hxx b/src/emucore/Cart2K.hxx index ddca38048..e603d83bc 100644 --- a/src/emucore/Cart2K.hxx +++ b/src/emucore/Cart2K.hxx @@ -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; diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index c5637752f..80778a501 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -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), diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 383e3f06c..6ec025013 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -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]; diff --git a/src/emucore/Cart3EPlus.cxx b/src/emucore/Cart3EPlus.cxx index dd8a8d719..a40c1e3ea 100644 --- a/src/emucore/Cart3EPlus.cxx +++ b/src/emucore/Cart3EPlus.cxx @@ -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) diff --git a/src/emucore/Cart3EPlus.hxx b/src/emucore/Cart3EPlus.hxx index e064401e0..5de961d2a 100644 --- a/src/emucore/Cart3EPlus.hxx +++ b/src/emucore/Cart3EPlus.hxx @@ -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]; diff --git a/src/emucore/Cart3F.cxx b/src/emucore/Cart3F.cxx index 832cd52a1..10fef4677 100644 --- a/src/emucore/Cart3F.cxx +++ b/src/emucore/Cart3F.cxx @@ -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), diff --git a/src/emucore/Cart3F.hxx b/src/emucore/Cart3F.hxx index 8e63ec577..8982de2ac 100644 --- a/src/emucore/Cart3F.hxx +++ b/src/emucore/Cart3F.hxx @@ -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; diff --git a/src/emucore/Cart4A50.cxx b/src/emucore/Cart4A50.cxx index a512b1ca2..68b109e2d 100644 --- a/src/emucore/Cart4A50.cxx +++ b/src/emucore/Cart4A50.cxx @@ -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), diff --git a/src/emucore/Cart4A50.hxx b/src/emucore/Cart4A50.hxx index cf400859c..2bf24823b 100644 --- a/src/emucore/Cart4A50.hxx +++ b/src/emucore/Cart4A50.hxx @@ -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; diff --git a/src/emucore/Cart4K.cxx b/src/emucore/Cart4K.cxx index 55f874933..1940214a0 100644 --- a/src/emucore/Cart4K.cxx +++ b/src/emucore/Cart4K.cxx @@ -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) { diff --git a/src/emucore/Cart4K.hxx b/src/emucore/Cart4K.hxx index f8ad3c6fa..f876b650f 100644 --- a/src/emucore/Cart4K.hxx +++ b/src/emucore/Cart4K.hxx @@ -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; diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index 57db6f24a..330c7dcdb 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -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) { diff --git a/src/emucore/Cart4KSC.hxx b/src/emucore/Cart4KSC.hxx index 9f2177e39..f2823cdc9 100644 --- a/src/emucore/Cart4KSC.hxx +++ b/src/emucore/Cart4KSC.hxx @@ -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; diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index 00cbf53aa..548bc7f85 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -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)), diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index c2100c080..f78536a22 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -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; diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index b3e2e8d8a..85974c3f9 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -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) diff --git a/src/emucore/CartBF.hxx b/src/emucore/CartBF.hxx index c6e71927a..59853b68a 100644 --- a/src/emucore/CartBF.hxx +++ b/src/emucore/CartBF.hxx @@ -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; diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index c1b50c608..d7edea29b 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -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) diff --git a/src/emucore/CartBFSC.hxx b/src/emucore/CartBFSC.hxx index c9ba66746..34d701d82 100644 --- a/src/emucore/CartBFSC.hxx +++ b/src/emucore/CartBFSC.hxx @@ -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; diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index 520c94360..84057ddd7 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -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), diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index b75d05c30..e4cc7b634 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -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; diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 80211c742..756d4ddd1 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -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), diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 5248bb5d3..340097b83 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -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; diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 29db21f84..b0c93623d 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -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 diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index 64d8a8530..de57c2e40 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -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; diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 01f27c4f0..d0d00b3e5 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -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), diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index 3ce07910c..32f229f14 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -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; diff --git a/src/emucore/CartCV.cxx b/src/emucore/CartCV.cxx index 665055b48..0153b1aaf 100644 --- a/src/emucore/CartCV.cxx +++ b/src/emucore/CartCV.cxx @@ -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) diff --git a/src/emucore/CartCV.hxx b/src/emucore/CartCV.hxx index c393f1865..c22c8f4fa 100644 --- a/src/emucore/CartCV.hxx +++ b/src/emucore/CartCV.hxx @@ -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; diff --git a/src/emucore/CartCVPlus.cxx b/src/emucore/CartCVPlus.cxx index 89eeb24d4..495322dac 100644 --- a/src/emucore/CartCVPlus.cxx +++ b/src/emucore/CartCVPlus.cxx @@ -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), diff --git a/src/emucore/CartCVPlus.hxx b/src/emucore/CartCVPlus.hxx index a9e787e2b..eddda563e 100644 --- a/src/emucore/CartCVPlus.hxx +++ b/src/emucore/CartCVPlus.hxx @@ -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]; diff --git a/src/emucore/CartDASH.cxx b/src/emucore/CartDASH.cxx index f00e0d8d5..7472b4d58 100644 --- a/src/emucore/CartDASH.cxx +++ b/src/emucore/CartDASH.cxx @@ -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) diff --git a/src/emucore/CartDASH.hxx b/src/emucore/CartDASH.hxx index 4b0a4a6c4..7c109e32b 100644 --- a/src/emucore/CartDASH.hxx +++ b/src/emucore/CartDASH.hxx @@ -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]; diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index ab18ee73b..60e9635de 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -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) diff --git a/src/emucore/CartDF.hxx b/src/emucore/CartDF.hxx index da9a8b974..9a8a6182a 100644 --- a/src/emucore/CartDF.hxx +++ b/src/emucore/CartDF.hxx @@ -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; diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 950ced070..f65f97b11 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -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) diff --git a/src/emucore/CartDFSC.hxx b/src/emucore/CartDFSC.hxx index 1a682df48..8ffe7e955 100644 --- a/src/emucore/CartDFSC.hxx +++ b/src/emucore/CartDFSC.hxx @@ -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; diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index ba8b3e189..c7c92740e 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -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), diff --git a/src/emucore/CartDPC.hxx b/src/emucore/CartDPC.hxx index 399c8b00b..45fe0ecca 100644 --- a/src/emucore/CartDPC.hxx +++ b/src/emucore/CartDPC.hxx @@ -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; diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index eecdc8af9..7fbdc7e14 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -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)), diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index 8594382da..fd02eca2b 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -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; diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index 7cc04ffed..67467dc65 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -66,7 +66,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr 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; @@ -210,13 +210,13 @@ unique_ptr CartDetector::create(const FilesystemNode& file, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr -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(size); + ByteBuffer slice = make_unique(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 -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] = { diff --git a/src/emucore/CartDetector.hxx b/src/emucore/CartDetector.hxx index d3213ae2a..2c2c3bd90 100644 --- a/src/emucore/CartDetector.hxx +++ b/src/emucore/CartDetector.hxx @@ -46,7 +46,7 @@ class CartDetector @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr 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 - 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 - 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 diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index 9107a4c1c..0f337a0f5 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -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) { diff --git a/src/emucore/CartE0.hxx b/src/emucore/CartE0.hxx index b2367d76b..c5b6cbde8 100644 --- a/src/emucore/CartE0.hxx +++ b/src/emucore/CartE0.hxx @@ -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; diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index 4c7f9efee..87a3b7a98 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -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) { diff --git a/src/emucore/CartE7.hxx b/src/emucore/CartE7.hxx index 0eca2dff0..6b1c36973 100644 --- a/src/emucore/CartE7.hxx +++ b/src/emucore/CartE7.hxx @@ -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; diff --git a/src/emucore/CartE78K.cxx b/src/emucore/CartE78K.cxx index 9cb0f62ad..04f7b2c82 100644 --- a/src/emucore/CartE78K.cxx +++ b/src/emucore/CartE78K.cxx @@ -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) { diff --git a/src/emucore/CartE78K.hxx b/src/emucore/CartE78K.hxx index d3a374704..91fe1b785 100644 --- a/src/emucore/CartE78K.hxx +++ b/src/emucore/CartE78K.hxx @@ -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; diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index cc2cd1533..594701774 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -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) diff --git a/src/emucore/CartEF.hxx b/src/emucore/CartEF.hxx index b65d2374c..8bee49b90 100644 --- a/src/emucore/CartEF.hxx +++ b/src/emucore/CartEF.hxx @@ -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; diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 0aa99eaa9..86c10a4af 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -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) diff --git a/src/emucore/CartEFSC.hxx b/src/emucore/CartEFSC.hxx index 5d655354f..d948e54ff 100644 --- a/src/emucore/CartEFSC.hxx +++ b/src/emucore/CartEFSC.hxx @@ -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; diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index a48f3005a..b6d178a06 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -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) diff --git a/src/emucore/CartF0.hxx b/src/emucore/CartF0.hxx index ae6fcf719..ad9b6aa30 100644 --- a/src/emucore/CartF0.hxx +++ b/src/emucore/CartF0.hxx @@ -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; diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index cded5dda1..47d5dee96 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -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) diff --git a/src/emucore/CartF4.hxx b/src/emucore/CartF4.hxx index ab9af5c64..3685320c6 100644 --- a/src/emucore/CartF4.hxx +++ b/src/emucore/CartF4.hxx @@ -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; diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 3d407d237..148d61d7d 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -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) diff --git a/src/emucore/CartF4SC.hxx b/src/emucore/CartF4SC.hxx index 5af53fcac..bc37769e2 100644 --- a/src/emucore/CartF4SC.hxx +++ b/src/emucore/CartF4SC.hxx @@ -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; diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index 3fecd3e9b..fc804ead4 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -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) diff --git a/src/emucore/CartF6.hxx b/src/emucore/CartF6.hxx index 423524b1d..16791909e 100644 --- a/src/emucore/CartF6.hxx +++ b/src/emucore/CartF6.hxx @@ -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; diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index c40f0d726..3ad8ad790 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -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) diff --git a/src/emucore/CartF6SC.hxx b/src/emucore/CartF6SC.hxx index 87cb3642d..0a50dc451 100644 --- a/src/emucore/CartF6SC.hxx +++ b/src/emucore/CartF6SC.hxx @@ -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; diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index 0dadfd061..63e504848 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -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) diff --git a/src/emucore/CartF8.hxx b/src/emucore/CartF8.hxx index 710f5088a..9e83db236 100644 --- a/src/emucore/CartF8.hxx +++ b/src/emucore/CartF8.hxx @@ -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; diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index 763503ad5..41da41178 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -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) diff --git a/src/emucore/CartF8SC.hxx b/src/emucore/CartF8SC.hxx index 4e33cc2e5..3907b2b43 100644 --- a/src/emucore/CartF8SC.hxx +++ b/src/emucore/CartF8SC.hxx @@ -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; diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index 0b2966fb5..140277a93 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -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) diff --git a/src/emucore/CartFA.hxx b/src/emucore/CartFA.hxx index 615bd469c..5bcb1cf3f 100644 --- a/src/emucore/CartFA.hxx +++ b/src/emucore/CartFA.hxx @@ -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; diff --git a/src/emucore/CartFA2.cxx b/src/emucore/CartFA2.cxx index 5bb667faa..038d72a07 100644 --- a/src/emucore/CartFA2.cxx +++ b/src/emucore/CartFA2.cxx @@ -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), diff --git a/src/emucore/CartFA2.hxx b/src/emucore/CartFA2.hxx index 779acd795..acc201d1e 100644 --- a/src/emucore/CartFA2.hxx +++ b/src/emucore/CartFA2.hxx @@ -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; diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 83ad0fb9f..5c99e4ab9 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -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), diff --git a/src/emucore/CartFE.hxx b/src/emucore/CartFE.hxx index c63f94e9b..6158c4cfb 100644 --- a/src/emucore/CartFE.hxx +++ b/src/emucore/CartFE.hxx @@ -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; diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index 5e0f6287b..ade4407cb 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -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), diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index 91906ff55..abeaee3a2 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -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; diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx index 0696c695f..7c29f3924 100644 --- a/src/emucore/CartMNetwork.cxx +++ b/src/emucore/CartMNetwork.cxx @@ -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(size); diff --git a/src/emucore/CartMNetwork.hxx b/src/emucore/CartMNetwork.hxx index 59c2de98c..c8441be24 100644 --- a/src/emucore/CartMNetwork.hxx +++ b/src/emucore/CartMNetwork.hxx @@ -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]; diff --git a/src/emucore/CartSB.cxx b/src/emucore/CartSB.cxx index e6e9aafed..bd1cc8568 100644 --- a/src/emucore/CartSB.cxx +++ b/src/emucore/CartSB.cxx @@ -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), diff --git a/src/emucore/CartSB.hxx b/src/emucore/CartSB.hxx index 0f53c59b5..c29559b7f 100644 --- a/src/emucore/CartSB.hxx +++ b/src/emucore/CartSB.hxx @@ -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) diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index bd57f4d92..ec6923edb 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -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) diff --git a/src/emucore/CartUA.hxx b/src/emucore/CartUA.hxx index aaab82390..d1d85e0cc 100644 --- a/src/emucore/CartUA.hxx +++ b/src/emucore/CartUA.hxx @@ -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; diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 66f638f1a..1391ac0d9 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -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)), diff --git a/src/emucore/CartWD.hxx b/src/emucore/CartWD.hxx index 061ad5ac1..fee93ce30 100644 --- a/src/emucore/CartWD.hxx +++ b/src/emucore/CartWD.hxx @@ -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; diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 9a0b3aff8..fe2104e3f 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -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) diff --git a/src/emucore/CartX07.hxx b/src/emucore/CartX07.hxx index 8c9e4babe..81959a79b 100644 --- a/src/emucore/CartX07.hxx +++ b/src/emucore/CartX07.hxx @@ -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; diff --git a/src/emucore/FSNode.cxx b/src/emucore/FSNode.cxx index 244add8bd..77654edbe 100644 --- a/src/emucore/FSNode.cxx +++ b/src/emucore/FSNode.cxx @@ -159,7 +159,7 @@ bool FilesystemNode::rename(const string& newfile) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 FilesystemNode::read(BytePtr& image) const +uInt32 FilesystemNode::read(ByteBuffer& image) const { uInt32 size = 0; diff --git a/src/emucore/FSNode.hxx b/src/emucore/FSNode.hxx index c880cd4d8..408bed559 100644 --- a/src/emucore/FSNode.hxx +++ b/src/emucore/FSNode.hxx @@ -243,7 +243,7 @@ class FilesystemNode * This method can throw exceptions, and should be used inside * a try-catch block. */ - uInt32 read(BytePtr& buffer) const; + uInt32 read(ByteBuffer& buffer) const; /** * The following methods are almost exactly the same as the various @@ -391,7 +391,7 @@ class AbstractFSNode * This method can throw exceptions, and should be used inside * a try-catch block. */ - virtual uInt32 read(BytePtr& buffer) const { return 0; } + virtual uInt32 read(ByteBuffer& buffer) const { return 0; } /** * The parent node of this directory. diff --git a/src/emucore/M6532.hxx b/src/emucore/M6532.hxx index b57f3be2d..1cfd5da5e 100644 --- a/src/emucore/M6532.hxx +++ b/src/emucore/M6532.hxx @@ -212,11 +212,11 @@ class M6532 : public Device #ifdef DEBUGGER_SUPPORT // The arrays containing information about every byte of RIOT // indicating whether and how (RW) it is used. - BytePtr myRAMAccessBase; - BytePtr myStackAccessBase; - BytePtr myIOAccessBase; + ByteBuffer myRAMAccessBase; + ByteBuffer myStackAccessBase; + ByteBuffer myIOAccessBase; // The array used to skip the first ZP access tracking - BytePtr myZPAccessDelay; + ByteBuffer myZPAccessDelay; static constexpr uInt16 RAM_SIZE = 0x80, RAM_MASK = RAM_SIZE - 1, diff --git a/src/emucore/MD5.cxx b/src/emucore/MD5.cxx index 43c92a676..dbdf1c654 100644 --- a/src/emucore/MD5.cxx +++ b/src/emucore/MD5.cxx @@ -307,7 +307,7 @@ static void Decode(uInt32* output, const uInt8* input, uInt32 len) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string hash(const BytePtr& buffer, uInt32 length) +string hash(const ByteBuffer& buffer, uInt32 length) { return hash(buffer.get(), length); } @@ -336,7 +336,7 @@ string hash(const uInt8* buffer, uInt32 length) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string hash(const FilesystemNode& node) { - BytePtr image; + ByteBuffer image; uInt32 size = 0; try { diff --git a/src/emucore/MD5.hxx b/src/emucore/MD5.hxx index 760da598f..199ae6da4 100644 --- a/src/emucore/MD5.hxx +++ b/src/emucore/MD5.hxx @@ -32,7 +32,7 @@ namespace MD5 { @param length The length of the message @return The message-digest */ -string hash(const BytePtr& buffer, uInt32 length); +string hash(const ByteBuffer& buffer, uInt32 length); string hash(const uInt8* buffer, uInt32 length); /** diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 24d2895d0..7adb60466 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -55,6 +55,9 @@ #include "DispatchResult.hxx" #include "EmulationWorker.hxx" #include "AudioSettings.hxx" +#include "repository/KeyValueRepositoryNoop.hxx" +#include "repository/KeyValueRepositoryConfigfile.hxx" + #include "OSystem.hxx" @@ -115,9 +118,13 @@ bool OSystem::create() << " Features: " << myFeatures << endl << " " << myBuildInfo << endl << endl << "Base directory: '" - << FilesystemNode(myBaseDir).getShortPath() << "'" << endl + << FilesystemNode(myBaseDir).getShortPath() << "'" << endl; + + if (!myConfigFile.empty()) buf << "Configuration file: '" - << FilesystemNode(myConfigFile).getShortPath() << "'" << endl + << FilesystemNode(myConfigFile).getShortPath() << "'" << endl; + + buf << "User game properties: '" << FilesystemNode(myPropertiesFile).getShortPath() << "'" << endl; logMessage(buf.str(), 1); @@ -182,7 +189,7 @@ void OSystem::loadConfig(const Settings::Options& options) if(!node.isDirectory()) node.makeDir(); myBaseDir = node.getPath(); - myConfigFile = FilesystemNode(myConfigFile).getPath(); + if (!myConfigFile.empty()) myConfigFile = FilesystemNode(myConfigFile).getPath(); FilesystemNode save(myDefaultSaveDir); if(!save.isDirectory()) @@ -194,8 +201,10 @@ void OSystem::loadConfig(const Settings::Options& options) load.makeDir(); myDefaultLoadDir = load.getShortPath(); + mySettings->setRepository(createSettingsRepository()); + logMessage("Loading config options ...", 2); - mySettings->load(configFile(), options); + mySettings->load(options); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -209,7 +218,7 @@ void OSystem::saveConfig() } logMessage("Saving config options ...", 2); - mySettings->save(configFile()); + mySettings->save(); if(myPropSet && myPropSet->save(myPropertiesFile)) logMessage("Saving properties set ...", 2); @@ -473,7 +482,7 @@ unique_ptr OSystem::openConsole(const FilesystemNode& romfile, string& unique_ptr console; // Open the cartridge image and read it in - BytePtr image; + ByteBuffer image; uInt32 size = 0; if((image = openROM(romfile, md5, size)) != nullptr) { @@ -552,14 +561,14 @@ void OSystem::closeConsole() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BytePtr OSystem::openROM(const FilesystemNode& rom, string& md5, uInt32& size) +ByteBuffer OSystem::openROM(const FilesystemNode& rom, string& md5, uInt32& size) { // This method has a documented side-effect: // It not only loads a ROM and creates an array with its contents, // but also adds a properties entry if the one for the ROM doesn't // contain a valid name - BytePtr image; + ByteBuffer image; if((size = rom.read(image)) == 0) return nullptr; @@ -734,6 +743,15 @@ void OSystem::mainLoop() #endif } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +shared_ptr OSystem::createSettingsRepository() +{ + if (myConfigFile.empty()) + return make_shared(); + + return make_shared(myConfigFile); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string OSystem::ourOverrideBaseDir = ""; bool OSystem::ourOverrideBaseDirWithApp = false; diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 8c8f0dbc0..0f288c453 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -50,6 +50,7 @@ class AudioSettings; #include "FpsMeter.hxx" #include "Settings.hxx" #include "bspf.hxx" +#include "repository/KeyValueRepository.hxx" /** This class provides an interface for accessing operating system specific @@ -256,13 +257,6 @@ class OSystem */ const string& cheatFile() const { return myCheatFile; } - /** - This method should be called to get the full path of the config file. - - @return String representing the full path of the config filename. - */ - const string& configFile() const { return myConfigFile; } - /** This method should be called to get the full path of the (optional) palette file. @@ -298,7 +292,7 @@ class OSystem @return Unique pointer to the array */ - BytePtr openROM(const FilesystemNode& rom, string& md5, uInt32& size); + ByteBuffer openROM(const FilesystemNode& rom, string& md5, uInt32& size); /** Creates a new game console from the specified romfile, and correctly @@ -423,6 +417,9 @@ class OSystem virtual void stateChanged(EventHandlerState state) { } protected: + + virtual shared_ptr createSettingsRepository(); + ////////////////////////////////////////////////////////////////////// // The following methods are system-specific and *must* be // implemented in derived classes. diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx index 8764d1bcd..a0e8ce7ca 100644 --- a/src/emucore/ProfilingRunner.cxx +++ b/src/emucore/ProfilingRunner.cxx @@ -102,7 +102,7 @@ bool ProfilingRunner::runOne(const ProfilingRun run) return false; } - BytePtr image; + ByteBuffer image; uInt32 size = imageFile.read(image); if (size == 0) { cout << "ERROR: unable to read " << run.romFile << endl; diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index a100fa9b0..c7c7df3f0 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -26,10 +26,13 @@ #endif #include "Settings.hxx" +#include "repository/KeyValueRepositoryNoop.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Settings::Settings() { + myRespository = make_shared(); + // Video-related options setPermanent("video", ""); setPermanent("speed", "1.0"); @@ -190,16 +193,17 @@ Settings::Settings() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Settings::load(const string& cfgfile, const Options& options) +void Settings::setRepository(shared_ptr repository) { - // First load from the platform-specific config file - // Different ports may override this functionality - if(!loadConfigFile(cfgfile)) - { - // FIXME - make logger available everywhere - // myOSystem.logMessage("ERROR: Couldn't load settings file", 0); - cout << "ERROR: Couldn't load settings file" << endl; - } + myRespository = repository; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void Settings::load(const Options& options) +{ + Options fromFile = myRespository->load(); + for (const auto& opt: fromFile) + setValue(opt.first, opt.second); // Apply commandline options, which override those from settings file for(const auto& opt: options) @@ -211,14 +215,9 @@ void Settings::load(const string& cfgfile, const Options& options) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Settings::save(const string& cfgfile) const +void Settings::save() { - if(!saveConfigFile(cfgfile)) - { - // FIXME - make logger available everywhere - // myOSystem.logMessage("ERROR: Couldn't save settings file", 0); - cout << "ERROR: Couldn't save settings file" << endl; - } + myRespository->save(myPermanentSettings); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -599,73 +598,6 @@ void Settings::setValue(const string& key, const Variant& value) myTemporarySettings[key] = value; } -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Settings::loadConfigFile(const string& cfgfile) -{ - string line, key, value; - string::size_type equalPos, garbage; - - ifstream in(cfgfile); - if(!in || !in.is_open()) - return false; - - while(getline(in, line)) - { - // Strip all whitespace and tabs from the line - while((garbage = line.find("\t")) != string::npos) - line.erase(garbage, 1); - - // Ignore commented and empty lines - if((line.length() == 0) || (line[0] == ';')) - continue; - - // Search for the equal sign and discard the line if its not found - if((equalPos = line.find("=")) == string::npos) - continue; - - // Split the line into key/value pairs and trim any whitespace - key = trim(line.substr(0, equalPos)); - value = trim(line.substr(equalPos + 1, line.length() - key.length() - 1)); - - // Skip absent key - if(key.length() == 0) - continue; - - // Only settings which have been previously set are valid - setValue(key, value); - } - return true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool Settings::saveConfigFile(const string& cfgfile) const -{ - ofstream out(cfgfile); - if(!out || !out.is_open()) - return false; - - out << "; Stella configuration file" << endl - << ";" << endl - << "; Lines starting with ';' are comments and are ignored." << endl - << "; Spaces and tabs are ignored." << endl - << ";" << endl - << "; Format MUST be as follows:" << endl - << "; command = value" << endl - << ";" << endl - << "; Commands are the same as those specified on the commandline," << endl - << "; without the '-' character." << endl - << ";" << endl - << "; Values are the same as those allowed on the commandline." << endl - << "; Boolean values are specified as 1 (or true) and 0 (or false)" << endl - << ";" << endl; - - // Write out each of the key and value pairs - for(const auto& s: myPermanentSettings) - out << s.first << " = " << s.second << endl; - - return true; -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Settings::setPermanent(const string& key, const Variant& value) { diff --git a/src/emucore/Settings.hxx b/src/emucore/Settings.hxx index bb62634a9..fecea763a 100644 --- a/src/emucore/Settings.hxx +++ b/src/emucore/Settings.hxx @@ -22,6 +22,7 @@ #include "Variant.hxx" #include "bspf.hxx" +#include "repository/KeyValueRepository.hxx" /** This class provides an interface for accessing all configurable options, @@ -56,21 +57,22 @@ class Settings */ void usage() const; + void setRepository(shared_ptr repository); + /** This method is called to load settings from the settings file, and apply commandline options specified by the given parameter. - @param cfgfile The full path to the configuration file @param options A list of options that overrides ones in the settings file */ - void load(const string& cfgfile, const Options& options); + void load(const Options& options); /** This method is called to save the current settings to the settings file. */ - void save(const string& cfgfile) const; + void save(); /** Get the value assigned to the specified key. @@ -110,28 +112,6 @@ class Settings void setPermanent(const string& key, const Variant& value); void setTemporary(const string& key, const Variant& value); - /** - This method will be called to load the settings from the - platform-specific settings file. Since different ports can have - different behaviour here, we mark it as virtual so derived - classes can override as needed. - - @param cfgfile The full path to the configuration file - @return False on any error, else true - */ - virtual bool loadConfigFile(const string& cfgfile); - - /** - This method will be called to save the current settings to the - platform-specific settings file. Since different ports can have - different behaviour here, we mark it as virtual so derived - classes can override as needed. - - @param cfgfile The full path to the configuration file - @return False on any error, else true - */ - virtual bool saveConfigFile(const string& cfgfile) const; - // Trim leading and following whitespace from a string static string trim(const string& str) { @@ -162,6 +142,8 @@ class Settings // program exit. Options myTemporarySettings; + shared_ptr myRespository; + private: // Following constructors and assignment operators not supported Settings(const Settings&) = delete; diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 722a47f33..1a1c15818 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -889,10 +889,10 @@ class TIA : public Device #ifdef DEBUGGER_SUPPORT // The arrays containing information about every byte of TIA // indicating whether and how (RW) it is used. - BytePtr myAccessBase; + ByteBuffer myAccessBase; // The array used to skip the first two TIA access trackings - BytePtr myAccessDelay; + ByteBuffer myAccessDelay; #endif // DEBUGGER_SUPPORT static constexpr uInt16 diff --git a/src/gui/GameInfoDialog.cxx b/src/gui/GameInfoDialog.cxx index ec481d5e3..db0e1f6cf 100644 --- a/src/gui/GameInfoDialog.cxx +++ b/src/gui/GameInfoDialog.cxx @@ -419,7 +419,7 @@ void GameInfoDialog::loadControllerProperties(const Properties& props) { bool swapPorts = props.get(PropType::Console_SwapPorts) == "YES"; bool autoDetect = false; - BytePtr image; + ByteBuffer image; string md5 = props.get(PropType::Cart_MD5); uInt32 size = 0; const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom()); diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index 84c5791c2..3000137d5 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -137,7 +137,7 @@ void RomInfoWidget::parseProperties(const FilesystemNode& node) string right = myProperties.get(PropType::Controller_Right); try { - BytePtr image; + ByteBuffer image; string md5 = myProperties.get(PropType::Cart_MD5); uInt32 size = 0; diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index bf52a908d..e065f14f1 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -341,7 +341,7 @@ void StellaSettingsDialog::loadControllerProperties(const Properties& props) if (enable) { bool autoDetect = false; - BytePtr image; + ByteBuffer image; string md5 = props.get(PropType::Cart_MD5); uInt32 size = 0; const FilesystemNode& node = FilesystemNode(instance().launcher().selectedRom()); diff --git a/src/libretro/FSNodeLIBRETRO.cxx b/src/libretro/FSNodeLIBRETRO.cxx index 90a2dc979..b12305337 100644 --- a/src/libretro/FSNodeLIBRETRO.cxx +++ b/src/libretro/FSNodeLIBRETRO.cxx @@ -84,7 +84,7 @@ AbstractFSNodePtr FilesystemNodeLIBRETRO::getParent() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 FilesystemNodeLIBRETRO::read(BytePtr& image) const +uInt32 FilesystemNodeLIBRETRO::read(ByteBuffer& image) const { image = make_unique(512 * 1024); diff --git a/src/libretro/FSNodeLIBRETRO.hxx b/src/libretro/FSNodeLIBRETRO.hxx index 33182b608..b2790d767 100644 --- a/src/libretro/FSNodeLIBRETRO.hxx +++ b/src/libretro/FSNodeLIBRETRO.hxx @@ -50,7 +50,7 @@ class FilesystemNodeLIBRETRO : 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; protected: string _displayName; diff --git a/src/libretro/OSystemLIBRETRO.cxx b/src/libretro/OSystemLIBRETRO.cxx index 4b5e2c84f..e63de6e96 100644 --- a/src/libretro/OSystemLIBRETRO.cxx +++ b/src/libretro/OSystemLIBRETRO.cxx @@ -24,7 +24,6 @@ void OSystemLIBRETRO::getBaseDirAndConfig(string& basedir, string& cfgfile, bool useappdir, const string& usedir) { basedir = "."; - cfgfile = "."; #if 0 // Check to see if basedir overrides are active diff --git a/src/macos/OSystemMACOS.cxx b/src/macos/OSystemMACOS.cxx index 92bc1e83a..5df230234 100644 --- a/src/macos/OSystemMACOS.cxx +++ b/src/macos/OSystemMACOS.cxx @@ -17,6 +17,7 @@ #include "FSNode.hxx" #include "OSystemMACOS.hxx" +#include "SettingsRepositoryMACOS.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile, @@ -24,7 +25,6 @@ void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile, bool useappdir, const string& usedir) { basedir = "~/Library/Application Support/Stella/"; - cfgfile = "~/Library/Application Support/Stella/stellarc"; // FIXME - actually use this #if 0 // Check to see if basedir overrides are active @@ -40,3 +40,9 @@ void OSystemMACOS::getBaseDirAndConfig(string& basedir, string& cfgfile, FilesystemNode desktop("~/Desktop/"); savedir = loaddir = desktop.isDirectory() ? desktop.getShortPath() : "~/"; } + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +shared_ptr OSystemMACOS::createSettingsRepository() +{ + return make_shared(); +} diff --git a/src/macos/OSystemMACOS.hxx b/src/macos/OSystemMACOS.hxx index c500a3c50..7426dfc41 100644 --- a/src/macos/OSystemMACOS.hxx +++ b/src/macos/OSystemMACOS.hxx @@ -54,6 +54,10 @@ class OSystemMACOS : public OSystem string& savedir, string& loaddir, bool useappdir, const string& usedir) override; +protected: + + virtual shared_ptr createSettingsRepository() override; + private: // Following constructors and assignment operators not supported OSystemMACOS(const OSystemMACOS&) = delete; diff --git a/src/macos/Preferences.m b/src/macos/Preferences.m deleted file mode 100644 index 69e2dee63..000000000 --- a/src/macos/Preferences.m +++ /dev/null @@ -1,95 +0,0 @@ -//============================================================================ -// -// SSSS tt lll lll -// SS SS tt ll ll -// SS tttttt eeee ll ll aaaa -// SSSS tt ee ee ll ll aa -// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" -// SS SS tt ee ll ll aa aa -// SSSS ttt eeeee llll llll aaaaa -// -// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony -// and the Stella Team -// -// See the file "License.txt" for information on usage and redistribution of -// this file, and for a DISCLAIMER OF ALL WARRANTIES. -//============================================================================ - -#import - -#import "Preferences.h" - -void prefsSetString(const char* key, const char* value) -{ - [[Preferences sharedInstance] setString:key:value]; -} - -void prefsGetString(const char* key, char* value, int size) -{ - [[Preferences sharedInstance] getString:key:value:size]; -} - -void prefsSave(void) -{ - [[Preferences sharedInstance] save]; -} - -@implementation Preferences -{ - NSUserDefaults *defaults; /* Defaults pointer */ -} - -static Preferences *sharedInstance = nil; - -+ (Preferences *)sharedInstance -{ - return sharedInstance ? sharedInstance : [[self alloc] init]; -} - -- (id)init -{ - if (self = [super init]) { - defaults = [NSUserDefaults standardUserDefaults]; - sharedInstance = self; - } - return(self); -} - -- (void)dealloc -{ - if (self == sharedInstance) { - sharedInstance = nil; - } - -} - -- (void)setString:(const char *)key : (const char *)value -{ - @autoreleasepool { - NSString* theKey = [NSString stringWithCString:key encoding:NSUTF8StringEncoding]; - NSString* theValue = [NSString stringWithCString:value encoding:NSUTF8StringEncoding]; - - [defaults setObject:theValue forKey:theKey]; - } -} - -- (void)getString:(const char *)key : (char *)value : (int)size -{ - @autoreleasepool { - NSString* theKey = [NSString stringWithCString:key encoding:NSUTF8StringEncoding]; - NSString* theValue = [defaults objectForKey:theKey]; - if (theValue != nil) - strncpy(value, [theValue cStringUsingEncoding: NSUTF8StringEncoding], size); - else - value[0] = 0; - } -} - -- (void)save -{ - @autoreleasepool { - [defaults synchronize]; - } -} - -@end diff --git a/src/macos/SDLMain.m b/src/macos/SDLMain.m index 220f03197..f7e405c18 100644 --- a/src/macos/SDLMain.m +++ b/src/macos/SDLMain.m @@ -5,7 +5,6 @@ #import "SDL.h" #import "SDLMain.h" -#import "Preferences.h" #define SDL_main stellaMain extern int stellaMain(int argc, char* argv[]); @@ -158,8 +157,6 @@ static int IsFinderLaunch(const int argc, char **argv) // Main entry point to executable - should *not* be SDL_main! int main (int argc, char* argv[]) { - static Preferences *myPrefs; - // Copy the arguments into a global variable // This is passed if we are launched by double-clicking if (IsFinderLaunch(argc, argv)) @@ -179,8 +176,6 @@ int main (int argc, char* argv[]) gFinderLaunch = NO; } - myPrefs = [Preferences sharedInstance]; - NSApplicationMain (argc, (const char**)argv); return 0; diff --git a/src/macos/SettingsMACOS.cxx b/src/macos/SettingsMACOS.cxx index b8134e32b..418aab7e8 100644 --- a/src/macos/SettingsMACOS.cxx +++ b/src/macos/SettingsMACOS.cxx @@ -15,49 +15,10 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -// TODO - Fix this code so that we don't need access to getPermanentSettings() -// The code should parse the plist file and call setValue on each -// option; it shouldn't need to query the base class for which options -// are valid. - #include "SettingsMACOS.hxx" -extern "C" { - void prefsSetString(const char* key, const char* value); - void prefsGetString(const char* key, char* value, int size); - void prefsSave(void); -} - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - SettingsMACOS::SettingsMACOS() : Settings() { } - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SettingsMACOS::loadConfigFile(const string&) -{ - string key, value; - char cvalue[4096]; - - // Read key/value pairs from the plist file - for(const auto& s: getPermanentSettings()) - { - prefsGetString(s.first.c_str(), cvalue, 4090); - if(cvalue[0] != 0) - setValue(s.first, cvalue); - } - return true; -} - -// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SettingsMACOS::saveConfigFile(const string&) const -{ - // Write out each of the key and value pairs - for(const auto& s: getPermanentSettings()) - prefsSetString(s.first.c_str(), s.second.toCString()); - - prefsSave(); - - return true; -} diff --git a/src/macos/SettingsMACOS.hxx b/src/macos/SettingsMACOS.hxx index a963c4254..4bdeef803 100644 --- a/src/macos/SettingsMACOS.hxx +++ b/src/macos/SettingsMACOS.hxx @@ -34,19 +34,6 @@ class SettingsMACOS : public Settings explicit SettingsMACOS(); virtual ~SettingsMACOS() = default; - public: - /** - This method should be called to load the current settings from the - standard Mac preferences. - */ - bool loadConfigFile(const string&) override; - - /** - This method should be called to save the current settings to the - standard Mac preferences. - */ - bool saveConfigFile(const string&) const override; - private: // Following constructors and assignment operators not supported SettingsMACOS(const SettingsMACOS&) = delete; diff --git a/src/macos/Preferences.h b/src/macos/SettingsRepositoryMACOS.hxx similarity index 58% rename from src/macos/Preferences.h rename to src/macos/SettingsRepositoryMACOS.hxx index 144bc0880..ff26b6c87 100644 --- a/src/macos/Preferences.h +++ b/src/macos/SettingsRepositoryMACOS.hxx @@ -15,23 +15,17 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#import +#ifndef SETTINGS_REPOSITORY_MACOS_HXX +#define SETTINGS_REPOSITORY_MACOS_HXX -void prefsSetString(const char* key, const char* value); -void prefsGetString(const char* key, char* value, int size); -void prefsSave(void); +#include "repository/KeyValueRepository.hxx" -/** - Preferences class and support functions for the macOS - SDL2 port of Stella. +class SettingsRepositoryMACOS : public KeyValueRepository +{ +public: + virtual std::map load(); - @author Mark Grebe -*/ -@interface Preferences : NSObject + virtual void save(const std::map& values); +}; -+ (Preferences *)sharedInstance; -- (void)setString:(const char *)key : (const char *)value; -- (void)getString:(const char *)key : (char *)value : (int)size; -- (void)save; - -@end +#endif // SETTINGS_REPOSITORY_MACOS_HXX diff --git a/src/macos/SettingsRepositoryMACOS.mm b/src/macos/SettingsRepositoryMACOS.mm new file mode 100644 index 000000000..a9efe5865 --- /dev/null +++ b/src/macos/SettingsRepositoryMACOS.mm @@ -0,0 +1,50 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony +// and the Stella Team +// +// See the file "License.txt" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +//============================================================================ + +#import + +#include "SettingsRepositoryMACOS.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +std::map SettingsRepositoryMACOS::load() +{ + std::map values; + + @autoreleasepool { + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + NSArray* keys = [[defaults dictionaryRepresentation] allKeys]; + + for (NSString* key in keys) { + NSString* value = [defaults stringForKey:key]; + if (value != nil) + values[[key UTF8String]] = string([value UTF8String]); + } + } + + return values; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void SettingsRepositoryMACOS::save(const std::map& values) +{ + @autoreleasepool { + NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; + + for(const auto& pair: values) + [defaults setObject:[NSString stringWithUTF8String:pair.second.toCString()] forKey:[NSString stringWithUTF8String:pair.first.c_str()]]; + } +} diff --git a/src/macos/stella.xcodeproj/project.pbxproj b/src/macos/stella.xcodeproj/project.pbxproj index 7def783ae..58c72cbc4 100644 --- a/src/macos/stella.xcodeproj/project.pbxproj +++ b/src/macos/stella.xcodeproj/project.pbxproj @@ -67,7 +67,6 @@ 2D91741909BA90380026E9FF /* CartUA.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7108457B7D00812C11 /* CartUA.hxx */; }; 2D91741A09BA90380026E9FF /* FSNode.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7308457B7D00812C11 /* FSNode.hxx */; }; 2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEB7508457B7D00812C11 /* OSystem.hxx */; }; - 2D91741D09BA90380026E9FF /* Preferences.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DDBEBE3084582C400812C11 /* Preferences.h */; }; 2D91741F09BA90380026E9FF /* AboutBox.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D1A6CD4085135F9007CDBA8 /* AboutBox.h */; }; 2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FA0857CC88001D664B /* ConsoleFont.hxx */; }; 2D91742109BA90380026E9FF /* Font.hxx in Headers */ = {isa = PBXBuildFile; fileRef = 2D9217FC0857CC88001D664B /* Font.hxx */; }; @@ -166,7 +165,6 @@ 2D9174BE09BA90380026E9FF /* CartUA.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7008457B7D00812C11 /* CartUA.cxx */; }; 2D9174BF09BA90380026E9FF /* FSNode.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7208457B7D00812C11 /* FSNode.cxx */; }; 2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEB7408457B7D00812C11 /* OSystem.cxx */; }; - 2D9174C209BA90380026E9FF /* Preferences.m in Sources */ = {isa = PBXBuildFile; fileRef = 2DDBEBE4084582C400812C11 /* Preferences.m */; }; 2D9174C409BA90380026E9FF /* AboutBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D1A6CD5085135F9007CDBA8 /* AboutBox.m */; }; 2D9174C509BA90380026E9FF /* Font.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D9217FB0857CC88001D664B /* Font.cxx */; }; 2D9174C609BA90380026E9FF /* Debugger.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 2D659E2D085D3DD6005D96C8 /* Debugger.cxx */; }; @@ -235,8 +233,6 @@ DC21E5C021CA903E007D0E1A /* OSystemMACOS.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC21E5BA21CA903E007D0E1A /* OSystemMACOS.hxx */; }; DC21E5C121CA903E007D0E1A /* SerialPortMACOS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC21E5BB21CA903E007D0E1A /* SerialPortMACOS.cxx */; }; DC21E5C221CA903E007D0E1A /* SerialPortMACOS.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC21E5BC21CA903E007D0E1A /* SerialPortMACOS.hxx */; }; - DC21E5C321CA903E007D0E1A /* SettingsMACOS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC21E5BD21CA903E007D0E1A /* SettingsMACOS.cxx */; }; - DC21E5C421CA903E007D0E1A /* SettingsMACOS.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC21E5BE21CA903E007D0E1A /* SettingsMACOS.hxx */; }; DC2874071F8F2278004BF21A /* TrapArray.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC2874061F8F2278004BF21A /* TrapArray.hxx */; }; DC2AADAE194F389C0026C7A4 /* CartDASH.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC2AADAA194F389C0026C7A4 /* CartDASH.cxx */; }; DC2AADAF194F389C0026C7A4 /* CartDASH.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC2AADAB194F389C0026C7A4 /* CartDASH.hxx */; }; @@ -647,6 +643,14 @@ E034A5EF209FB25D00C89E9E /* EmulationTiming.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E034A5ED209FB25C00C89E9E /* EmulationTiming.hxx */; }; E0406FB61F81A85400A82AE0 /* AbstractFrameManager.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E0DFDD781F81A358000F3505 /* AbstractFrameManager.cxx */; }; E0406FB81F81A85400A82AE0 /* FrameManager.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E0DFDD7B1F81A358000F3505 /* FrameManager.cxx */; }; + E06508BE2272447200B341AC /* KeyValueRepositoryNoop.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E06508B82272447200B341AC /* KeyValueRepositoryNoop.hxx */; }; + E06508BF2272447200B341AC /* KeyValueRepository.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E06508B92272447200B341AC /* KeyValueRepository.hxx */; }; + E06508C02272447200B341AC /* KeyValueRepositoryConfigfile.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E06508BA2272447200B341AC /* KeyValueRepositoryConfigfile.hxx */; }; + E06508C12272447200B341AC /* KeyValueRepositoryConfigfile.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E06508BB2272447200B341AC /* KeyValueRepositoryConfigfile.cxx */; }; + E06508CA2272493200B341AC /* SettingsRepositoryMACOS.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E06508C82272493200B341AC /* SettingsRepositoryMACOS.hxx */; }; + E06508CB2272493200B341AC /* SettingsRepositoryMACOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E06508C92272493200B341AC /* SettingsRepositoryMACOS.mm */; }; + E06508D22272671600B341AC /* SettingsMACOS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E06508D02272671600B341AC /* SettingsMACOS.cxx */; }; + E06508D32272671600B341AC /* SettingsMACOS.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E06508D12272671600B341AC /* SettingsMACOS.hxx */; }; E0893AF2211B9842008B170D /* HighPass.cxx in Sources */ = {isa = PBXBuildFile; fileRef = E0893AF0211B9841008B170D /* HighPass.cxx */; }; E0893AF3211B9842008B170D /* HighPass.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E0893AF1211B9841008B170D /* HighPass.hxx */; }; E09F413B201E901D004A3391 /* AudioQueue.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E09F4139201E901C004A3391 /* AudioQueue.hxx */; }; @@ -844,8 +848,6 @@ 2DDBEB7308457B7D00812C11 /* FSNode.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = FSNode.hxx; sourceTree = ""; }; 2DDBEB7408457B7D00812C11 /* OSystem.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = OSystem.cxx; sourceTree = ""; }; 2DDBEB7508457B7D00812C11 /* OSystem.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = OSystem.hxx; sourceTree = ""; }; - 2DDBEBE3084582C400812C11 /* Preferences.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Preferences.h; sourceTree = SOURCE_ROOT; }; - 2DDBEBE4084582C400812C11 /* Preferences.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = Preferences.m; sourceTree = SOURCE_ROOT; }; 2DE2DF100627AE07006BEC99 /* Booster.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Booster.cxx; sourceTree = ""; }; 2DE2DF110627AE07006BEC99 /* Booster.hxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.h; path = Booster.hxx; sourceTree = ""; }; 2DE2DF120627AE07006BEC99 /* Cart.cxx */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Cart.cxx; sourceTree = ""; }; @@ -945,8 +947,6 @@ DC21E5BA21CA903E007D0E1A /* OSystemMACOS.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = OSystemMACOS.hxx; sourceTree = SOURCE_ROOT; }; DC21E5BB21CA903E007D0E1A /* SerialPortMACOS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SerialPortMACOS.cxx; sourceTree = SOURCE_ROOT; }; DC21E5BC21CA903E007D0E1A /* SerialPortMACOS.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SerialPortMACOS.hxx; sourceTree = SOURCE_ROOT; }; - DC21E5BD21CA903E007D0E1A /* SettingsMACOS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsMACOS.cxx; sourceTree = SOURCE_ROOT; }; - DC21E5BE21CA903E007D0E1A /* SettingsMACOS.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SettingsMACOS.hxx; sourceTree = SOURCE_ROOT; }; DC2874061F8F2278004BF21A /* TrapArray.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TrapArray.hxx; sourceTree = ""; }; DC2AADAA194F389C0026C7A4 /* CartDASH.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CartDASH.cxx; sourceTree = ""; }; DC2AADAB194F389C0026C7A4 /* CartDASH.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CartDASH.hxx; sourceTree = ""; }; @@ -1357,6 +1357,14 @@ E0306E0B1F93E916003DDD52 /* JitterEmulation.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = JitterEmulation.hxx; sourceTree = ""; }; E034A5EC209FB25C00C89E9E /* EmulationTiming.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmulationTiming.cxx; sourceTree = ""; }; E034A5ED209FB25C00C89E9E /* EmulationTiming.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EmulationTiming.hxx; sourceTree = ""; }; + E06508B82272447200B341AC /* KeyValueRepositoryNoop.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyValueRepositoryNoop.hxx; sourceTree = ""; }; + E06508B92272447200B341AC /* KeyValueRepository.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyValueRepository.hxx; sourceTree = ""; }; + E06508BA2272447200B341AC /* KeyValueRepositoryConfigfile.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyValueRepositoryConfigfile.hxx; sourceTree = ""; }; + E06508BB2272447200B341AC /* KeyValueRepositoryConfigfile.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyValueRepositoryConfigfile.cxx; sourceTree = ""; }; + E06508C82272493200B341AC /* SettingsRepositoryMACOS.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SettingsRepositoryMACOS.hxx; sourceTree = ""; }; + E06508C92272493200B341AC /* SettingsRepositoryMACOS.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = SettingsRepositoryMACOS.mm; sourceTree = ""; }; + E06508D02272671600B341AC /* SettingsMACOS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SettingsMACOS.cxx; sourceTree = ""; }; + E06508D12272671600B341AC /* SettingsMACOS.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SettingsMACOS.hxx; sourceTree = ""; }; E07C2326226393BD00B78631 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; E0893AF0211B9841008B170D /* HighPass.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = HighPass.cxx; path = audio/HighPass.cxx; sourceTree = ""; }; E0893AF1211B9841008B170D /* HighPass.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = HighPass.hxx; path = audio/HighPass.hxx; sourceTree = ""; }; @@ -1401,10 +1409,10 @@ children = ( 2D1A6CD4085135F9007CDBA8 /* AboutBox.h */, 2D1A6CD5085135F9007CDBA8 /* AboutBox.m */, - 2DDBEBE3084582C400812C11 /* Preferences.h */, - 2DDBEBE4084582C400812C11 /* Preferences.m */, F5A47A9D01A0482F01D3D55B /* SDLMain.h */, F5A47A9E01A0483001D3D55B /* SDLMain.m */, + E06508C82272493200B341AC /* SettingsRepositoryMACOS.hxx */, + E06508C92272493200B341AC /* SettingsRepositoryMACOS.mm */, ); name = Classes; sourceTree = ""; @@ -1654,6 +1662,7 @@ 2D6050C5089876F300C6DE89 /* common */ = { isa = PBXGroup; children = ( + E06508B72272447200B341AC /* repository */, DCC6A4AD20A2620D00863C59 /* audio */, E09F413A201E901D004A3391 /* AudioQueue.cxx */, E09F4139201E901C004A3391 /* AudioQueue.hxx */, @@ -1717,12 +1726,12 @@ 2D6050C60898771C00C6DE89 /* macos */ = { isa = PBXGroup; children = ( + E06508D02272671600B341AC /* SettingsMACOS.cxx */, + E06508D12272671600B341AC /* SettingsMACOS.hxx */, DC21E5B921CA903E007D0E1A /* OSystemMACOS.cxx */, DC21E5BA21CA903E007D0E1A /* OSystemMACOS.hxx */, DC21E5BB21CA903E007D0E1A /* SerialPortMACOS.cxx */, DC21E5BC21CA903E007D0E1A /* SerialPortMACOS.hxx */, - DC21E5BD21CA903E007D0E1A /* SettingsMACOS.cxx */, - DC21E5BE21CA903E007D0E1A /* SettingsMACOS.hxx */, ); path = macos; sourceTree = ""; @@ -2226,6 +2235,17 @@ path = tia; sourceTree = ""; }; + E06508B72272447200B341AC /* repository */ = { + isa = PBXGroup; + children = ( + E06508B82272447200B341AC /* KeyValueRepositoryNoop.hxx */, + E06508B92272447200B341AC /* KeyValueRepository.hxx */, + E06508BA2272447200B341AC /* KeyValueRepositoryConfigfile.hxx */, + E06508BB2272447200B341AC /* KeyValueRepositoryConfigfile.cxx */, + ); + path = repository; + sourceTree = ""; + }; E0DFDD731F81A358000F3505 /* frame-manager */ = { isa = PBXGroup; children = ( @@ -2295,6 +2315,7 @@ 2D9173E809BA90380026E9FF /* MD5.hxx in Headers */, 2D9173EA09BA90380026E9FF /* Paddles.hxx in Headers */, 2D9173EB09BA90380026E9FF /* Props.hxx in Headers */, + E06508CA2272493200B341AC /* SettingsRepositoryMACOS.hxx in Headers */, DC5ACB5C1FBFCE8E00A213FD /* DeveloperDialog.hxx in Headers */, 2D9173EC09BA90380026E9FF /* PropsSet.hxx in Headers */, 2D9173ED09BA90380026E9FF /* Random.hxx in Headers */, @@ -2343,7 +2364,6 @@ DCE8B1871E7E03B300189864 /* FrameLayout.hxx in Headers */, 2D91741A09BA90380026E9FF /* FSNode.hxx in Headers */, 2D91741B09BA90380026E9FF /* OSystem.hxx in Headers */, - 2D91741D09BA90380026E9FF /* Preferences.h in Headers */, DC6A18F919B3E65500DEB242 /* CartMDMWidget.hxx in Headers */, 2D91741F09BA90380026E9FF /* AboutBox.h in Headers */, 2D91742009BA90380026E9FF /* ConsoleFont.hxx in Headers */, @@ -2387,6 +2407,7 @@ DCE5CDE41BA10024005CD08A /* RiotRamWidget.hxx in Headers */, DCF3A6E81DFC75E3008A8AF3 /* Background.hxx in Headers */, DC21E5C021CA903E007D0E1A /* OSystemMACOS.hxx in Headers */, + E06508D32272671600B341AC /* SettingsMACOS.hxx in Headers */, DCFB9FAC1ECA2609004FD69B /* DelayQueueIteratorImpl.hxx in Headers */, DCA078351F8C1B04008EFEE5 /* SDL_lib.hxx in Headers */, DCDA03B11A2009BB00711920 /* CartWD.hxx in Headers */, @@ -2450,7 +2471,9 @@ DCBDDE9F1D6A5F2F009DF1E9 /* Cart3EPlus.hxx in Headers */, DCF467BD0F9399F500B25D7A /* Version.hxx in Headers */, DC2B85E81EF5EF2300379EB9 /* AtariNTSC.hxx in Headers */, + E06508BE2272447200B341AC /* KeyValueRepositoryNoop.hxx in Headers */, DCF467C30F939A1400B25D7A /* CartEF.hxx in Headers */, + E06508C02272447200B341AC /* KeyValueRepositoryConfigfile.hxx in Headers */, DC68F8901FA64C5300F4A2CC /* TIAConstants.hxx in Headers */, DCA82C721FEB4E780059340F /* TimeMachine.hxx in Headers */, DCF467C50F939A1400B25D7A /* CartEFSC.hxx in Headers */, @@ -2527,7 +2550,6 @@ DC71C399221623D9005DE92F /* ControllerDetector.hxx in Headers */, DCAAE5DD1715887B0080BB82 /* CartDebugWidget.hxx in Headers */, DC6DC921205DB879004A5FC3 /* PJoystickHandler.hxx in Headers */, - DC21E5C421CA903E007D0E1A /* SettingsMACOS.hxx in Headers */, DCAAE5DF1715887B0080BB82 /* CartEFSCWidget.hxx in Headers */, DCAAE5E11715887B0080BB82 /* CartEFWidget.hxx in Headers */, DCDFF08220B781B0001227C0 /* DispatchResult.hxx in Headers */, @@ -2543,6 +2565,7 @@ DCAAE5F11715887B0080BB82 /* CartFAWidget.hxx in Headers */, DCAAE5F31715887B0080BB82 /* CartUAWidget.hxx in Headers */, DC676A421729A0B000E4E73D /* Cart3EWidget.hxx in Headers */, + E06508BF2272447200B341AC /* KeyValueRepository.hxx in Headers */, DC676A441729A0B000E4E73D /* Cart4A50Widget.hxx in Headers */, CFE3F6141E84A9CE00A8204E /* CartBUS.hxx in Headers */, DC676A461729A0B000E4E73D /* CartARWidget.hxx in Headers */, @@ -2775,7 +2798,6 @@ 2D9174BF09BA90380026E9FF /* FSNode.cxx in Sources */, DCF3A6FE1DFC75E3008A8AF3 /* TIA.cxx in Sources */, 2D9174C009BA90380026E9FF /* OSystem.cxx in Sources */, - 2D9174C209BA90380026E9FF /* Preferences.m in Sources */, DC53B6AE1F3622DA00AA6BFB /* PointingDevice.cxx in Sources */, 2D9174C409BA90380026E9FF /* AboutBox.m in Sources */, DC96162C1F817830008A2206 /* AmigaMouseWidget.cxx in Sources */, @@ -2788,6 +2810,7 @@ 2D9174CD09BA90380026E9FF /* YaccParser.cxx in Sources */, DC6A18F819B3E65500DEB242 /* CartMDMWidget.cxx in Sources */, DC62E6491960E87B007AEF05 /* SaveKeyWidget.cxx in Sources */, + E06508CB2272493200B341AC /* SettingsRepositoryMACOS.mm in Sources */, 2D9174CE09BA90380026E9FF /* Cart3E.cxx in Sources */, 2D9174CF09BA90380026E9FF /* CpuDebug.cxx in Sources */, 2D9174F109BA90380026E9FF /* InputTextDialog.cxx in Sources */, @@ -2796,6 +2819,7 @@ 2D9174F209BA90380026E9FF /* CheckListWidget.cxx in Sources */, 2D9174F309BA90380026E9FF /* StringListWidget.cxx in Sources */, 2D9174F409BA90380026E9FF /* CommandDialog.cxx in Sources */, + E06508C12272447200B341AC /* KeyValueRepositoryConfigfile.cxx in Sources */, DC2B85E71EF5EF2300379EB9 /* AtariNTSC.cxx in Sources */, 2D9174F509BA90380026E9FF /* CommandMenu.cxx in Sources */, 2D9174F709BA90380026E9FF /* CpuWidget.cxx in Sources */, @@ -2879,7 +2903,6 @@ DC6B2BA611037FF200F199A7 /* DiStella.cxx in Sources */, CFE3F6151E84A9CE00A8204E /* CartCDF.cxx in Sources */, DCA82C711FEB4E780059340F /* TimeMachine.cxx in Sources */, - DC21E5C321CA903E007D0E1A /* SettingsMACOS.cxx in Sources */, DCD3F7C511340AAF00DBA3AE /* Genesis.cxx in Sources */, DCAD60A81152F8BD00BC4184 /* CartDPCPlus.cxx in Sources */, DC5ACB5B1FBFCE8E00A213FD /* DeveloperDialog.cxx in Sources */, @@ -2993,6 +3016,7 @@ DC368F5818A2FB710084199C /* SoundSDL2.cxx in Sources */, DCFF14CD18B0260300A20364 /* EventHandlerSDL2.cxx in Sources */, DC3EE8561E2C0E6D00905161 /* adler32.c in Sources */, + E06508D22272671600B341AC /* SettingsMACOS.cxx in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };