From ce3c9b9e8a1d301a2e55e7aaf45a9938984c1533 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 24 May 2020 16:08:24 -0230 Subject: [PATCH 1/2] Shorten error messages in ROM launcher, to fix overflow of buffer width. --- src/emucore/OSystem.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 9c84b4165..2bb3746d4 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -414,7 +414,7 @@ string OSystem::createConsole(const FilesystemNode& rom, const string& md5sum, } catch(const runtime_error& e) { - buf << "ERROR: Couldn't create console (" << e.what() << ")"; + buf << "ERROR: " << e.what(); Logger::error(buf.str()); return buf.str(); } From dbae9b8856637d11d60de5bee7420849a773c931 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sun, 24 May 2020 18:57:45 -0230 Subject: [PATCH 2/2] Unify Cartridge::bank() and CartEnhanced::bank(). Otherwise, gcc complains of methods mirroring another with the same name. --- src/emucore/Cart.hxx | 8 ++++++-- src/emucore/CartAR.cxx | 2 +- src/emucore/CartAR.hxx | 7 +++++-- src/emucore/CartBUS.cxx | 2 +- src/emucore/CartBUS.hxx | 7 +++++-- src/emucore/CartCDF.cxx | 2 +- src/emucore/CartCDF.hxx | 7 +++++-- src/emucore/CartCM.cxx | 2 +- src/emucore/CartCM.hxx | 7 +++++-- src/emucore/CartCTY.cxx | 2 +- src/emucore/CartCTY.hxx | 7 +++++-- src/emucore/CartDPCPlus.cxx | 2 +- src/emucore/CartDPCPlus.hxx | 7 +++++-- src/emucore/CartEnhanced.hxx | 11 +---------- src/emucore/CartMDM.cxx | 2 +- src/emucore/CartMDM.hxx | 7 +++++-- src/emucore/CartMNetwork.cxx | 2 +- src/emucore/CartMNetwork.hxx | 7 +++++-- 18 files changed, 55 insertions(+), 36 deletions(-) diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index b04a95f10..cfd19497c 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -169,8 +169,13 @@ class Cartridge : public Device scheme defines banks in a standard format (ie, 0 for first bank, 1 for second, etc). Carts which will handle their own bankswitching completely or non-bankswitched carts can ignore this method. + + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - virtual bool bank(uInt16) { return false; } + virtual bool bank(uInt16 bank, uInt16 segment = 0) { return false; } /** Get the current bank for the provided address. Carts which have only @@ -197,7 +202,6 @@ class Cartridge : public Device */ virtual uInt16 romBankCount() const { return 1; } - /** Query the number of RAM 'banks' supported by the cartridge. Note that this information is cart-specific, where each cart basically defines diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index a0eea7486..08f803e0b 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -392,7 +392,7 @@ void CartridgeAR::loadIntoRAM(uInt8 load) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeAR::bank(uInt16 bank) +bool CartridgeAR::bank(uInt16 bank, uInt16) { if(!bankLocked()) return bankConfiguration(uInt8(bank)); diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index 0bc74a291..349de38f1 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -73,9 +73,12 @@ class CartridgeAR : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index e2eb9b74a..62000118b 100644 --- a/src/emucore/CartBUS.cxx +++ b/src/emucore/CartBUS.cxx @@ -429,7 +429,7 @@ bool CartridgeBUS::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeBUS::bank(uInt16 bank) +bool CartridgeBUS::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index 3ab40f7ec..58e4eea48 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -84,9 +84,12 @@ class CartridgeBUS : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 6f9a5f4f7..09e0da3e3 100644 --- a/src/emucore/CartCDF.cxx +++ b/src/emucore/CartCDF.cxx @@ -402,7 +402,7 @@ bool CartridgeCDF::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeCDF::bank(uInt16 bank) +bool CartridgeCDF::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 14b1eda26..62c1721ca 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -90,9 +90,12 @@ class CartridgeCDF : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index 40ec603e5..b5dfc5197 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -98,7 +98,7 @@ uInt8 CartridgeCM::column() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeCM::bank(uInt16 bank) +bool CartridgeCM::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index bf8b2586e..36fa13fa8 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -141,9 +141,12 @@ class CartridgeCM : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 822473081..dbb5d13e2 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -229,7 +229,7 @@ bool CartridgeCTY::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeCTY::bank(uInt16 bank) +bool CartridgeCTY::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index fdd6c1e19..1cd682446 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -139,9 +139,12 @@ class CartridgeCTY : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index b71f5a8c0..7a0a7f4c6 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -591,7 +591,7 @@ bool CartridgeDPCPlus::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeDPCPlus::bank(uInt16 bank) +bool CartridgeDPCPlus::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index 9617d6545..bbbf68197 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -86,9 +86,12 @@ class CartridgeDPCPlus : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx index 743a4b50e..3c2e2c80d 100644 --- a/src/emucore/CartEnhanced.hxx +++ b/src/emucore/CartEnhanced.hxx @@ -70,16 +70,7 @@ class CartridgeEnhanced : public Cartridge @return true, if bank has changed */ - virtual bool bank(uInt16 bank, uInt16 segment); - - /** - Install pages for the specified bank in the system. - - @param bank The bank that should be installed in the system - - @return true, if bank has changed - */ - bool bank(uInt16 bank) override { return this->bank(bank, 0); } + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank. diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index decb634ec..2734b2793 100644 --- a/src/emucore/CartMDM.cxx +++ b/src/emucore/CartMDM.cxx @@ -88,7 +88,7 @@ bool CartridgeMDM::poke(uInt16 address, uInt8 value) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeMDM::bank(uInt16 bank) +bool CartridgeMDM::bank(uInt16 bank, uInt16) { if(bankLocked() || myBankingDisabled) return false; diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index 4b0786e42..fe17ae628 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -73,9 +73,12 @@ class CartridgeMDM : public CartridgeEnhanced /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Save the current state of this cart to the given Serializer. diff --git a/src/emucore/CartMNetwork.cxx b/src/emucore/CartMNetwork.cxx index c6542b2b8..84cf8dac8 100644 --- a/src/emucore/CartMNetwork.cxx +++ b/src/emucore/CartMNetwork.cxx @@ -201,7 +201,7 @@ void CartridgeMNetwork::bankRAM(uInt16 bank) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeMNetwork::bank(uInt16 bank) +bool CartridgeMNetwork::bank(uInt16 bank, uInt16) { if(bankLocked()) return false; diff --git a/src/emucore/CartMNetwork.hxx b/src/emucore/CartMNetwork.hxx index 95cd24b56..7b4fdb729 100644 --- a/src/emucore/CartMNetwork.hxx +++ b/src/emucore/CartMNetwork.hxx @@ -94,9 +94,12 @@ class CartridgeMNetwork : public Cartridge /** Install pages for the specified bank in the system. - @param bank The bank that should be installed in the system + @param bank The bank that should be installed in the system + @param segment The segment the bank should be using + + @return true, if bank has changed */ - bool bank(uInt16 bank) override; + bool bank(uInt16 bank, uInt16 segment = 0) override; /** Get the current bank.