From 5c879d4a48203f46da268a1483060cfa826f5f0f Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Tue, 9 Jun 2020 15:56:31 -0230 Subject: [PATCH] Fixed interaction with ideal ROM size between 3E and 3E+. --- src/emucore/Cart3E.cxx | 9 ++++++++- src/emucore/Cart3E.hxx | 17 ++++++++++++++++- src/emucore/Cart3EPlus.cxx | 2 +- src/emucore/CartEnhanced.hxx | 2 +- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index b03175477..a79e79167 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -22,7 +22,14 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3E::Cartridge3E(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : CartridgeEnhanced(image, size, BSPF::nextMultipleOf(size, 1_KB), md5, settings) + : Cartridge3E(image, size, BSPF::nextMultipleOf(size, 2_KB), md5, settings) +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Cartridge3E::Cartridge3E(const ByteBuffer& image, size_t size, size_t bsSize, + const string& md5, const Settings& settings) + : CartridgeEnhanced(image, size, bsSize, md5, settings) { myBankShift = BANK_SHIFT; myRamSize = RAM_SIZE; diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index f2ead51f5..96fc7b28b 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -65,7 +65,7 @@ class Cartridge3E : public CartridgeEnhanced public: /** - Create a new cartridge using the specified image and size + Create a new cartridge using the specified image and size. @param image Pointer to the ROM image @param size The size of the ROM image @@ -76,6 +76,21 @@ class Cartridge3E : public CartridgeEnhanced const Settings& settings); virtual ~Cartridge3E() = default; + protected: + /** + Create a new cartridge using the specified image and size. + This is an alternate version of the constructor, meant to be used + only by classes inheriting from this class. + + @param image Pointer to the ROM image + @param size The size of the ROM image + @param bsSize The size specified by the bankswitching scheme + @param md5 The md5sum of the ROM image + @param settings A reference to the various settings (read-only) + */ + Cartridge3E(const ByteBuffer& image, size_t size, size_t bsSize, + const string& md5, const Settings& settings); + public: /** diff --git a/src/emucore/Cart3EPlus.cxx b/src/emucore/Cart3EPlus.cxx index 6c9fe7c2a..6d5ce7d4c 100644 --- a/src/emucore/Cart3EPlus.cxx +++ b/src/emucore/Cart3EPlus.cxx @@ -22,7 +22,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cartridge3EPlus::Cartridge3EPlus(const ByteBuffer& image, size_t size, const string& md5, const Settings& settings) - : Cartridge3E(image, size, md5, settings) + : Cartridge3E(image, size, BSPF::nextMultipleOf(size, 1_KB), md5, settings) { myBankShift = BANK_SHIFT; myRamSize = RAM_SIZE; diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx index be0ac95de..cd398be11 100644 --- a/src/emucore/CartEnhanced.hxx +++ b/src/emucore/CartEnhanced.hxx @@ -41,8 +41,8 @@ class CartridgeEnhanced : public Cartridge @param image Pointer to the ROM image @param size The size of the ROM image - @param md5 The md5sum of the ROM image @param bsSize The size specified by the bankswitching scheme + @param md5 The md5sum of the ROM image @param settings A reference to the various settings (read-only) */ CartridgeEnhanced(const ByteBuffer& image, size_t size, size_t bsSize,