diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index fa46611be..601437635 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -114,7 +114,7 @@ CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size, setInitialState(); - myPlusROM = make_unique(mySettings); + myPlusROM = make_unique(mySettings, *this); // Determine whether we have a PlusROM cart myPlusROM->initialize(myImage, mySize); diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 377928ae6..bba939162 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -80,7 +80,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const ByteBuffer& image, size_t size, setInitialState(); - myPlusROM = make_unique(mySettings); + myPlusROM = make_unique(mySettings, *this); // Determine whether we have a PlusROM cart myPlusROM->initialize(myImage, mySize); diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index f76efaaf7..6b5c8b6e8 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -56,7 +56,7 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size, // space will be filled with 0's from above std::copy_n(image.get(), std::min(mySize, size), myImage.get()); - myPlusROM = make_unique(mySettings); + myPlusROM = make_unique(mySettings, *this); // Determine whether we have a PlusROM cart // PlusROM needs to call peek() method, so disable direct peeks diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index 7fe397494..c885d023d 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -180,8 +180,9 @@ class PlusROMRequest { }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -PlusROM::PlusROM(const Settings& settings) - : mySettings(settings) +PlusROM::PlusROM(const Settings& settings, const Cartridge& cart) + : mySettings(settings), + myCart(cart) { } @@ -229,6 +230,8 @@ bool PlusROM::initialize(const ByteBuffer& image, size_t size) bool PlusROM::peekHotspot(uInt16 address, uInt8& value) { #if defined(HTTP_LIB_SUPPORT) + if(myCart.bankLocked()) return false; + switch(address & 0x1FFF) { // invalid reads from write addresses @@ -262,6 +265,8 @@ bool PlusROM::peekHotspot(uInt16 address, uInt8& value) bool PlusROM::pokeHotspot(uInt16 address, uInt8 value) { #if defined(HTTP_LIB_SUPPORT) + if(myCart.bankLocked()) return false; + switch(address & 0x1FFF) { // valid writes diff --git a/src/emucore/PlusROM.hxx b/src/emucore/PlusROM.hxx index 790307372..104ef9a3f 100644 --- a/src/emucore/PlusROM.hxx +++ b/src/emucore/PlusROM.hxx @@ -53,7 +53,7 @@ class PlusROMRequest; class PlusROM : public Serializable { public: - PlusROM(const Settings& settings); + PlusROM(const Settings& settings, const Cartridge& cart); ~PlusROM() override = default; public: @@ -145,6 +145,8 @@ class PlusROM : public Serializable private: const Settings& mySettings; + const Cartridge& myCart; + bool myIsPlusROM{false}; string myHost; string myPath;