From cb847c94b1e635b9b49243a9282edd5de854caf7 Mon Sep 17 00:00:00 2001 From: thrust26 Date: Sun, 24 May 2020 23:45:46 +0200 Subject: [PATCH] Revert "Merge branch 'master' of https://github.com/stella-emu/stella" This reverts commit 3f9ef8026b1b8e8a44b7ce0d17f54f5540f26fc6, reversing changes made to 191684b6d2cf906904cf4573c5dd30fce8404873. --- src/emucore/Bankswitch.cxx | 4 +++ src/emucore/Bankswitch.hxx | 16 ++++++------ 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/CartDetector.cxx | 16 ++++++++++++ src/emucore/CartDetector.hxx | 5 ++++ 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 ++--- src/emucore/EventHandler.cxx | 42 +++++++++++++++++++++++++----- src/emucore/OSystem.cxx | 2 +- src/windows/Stella.vcxproj | 4 +++ src/windows/Stella.vcxproj.filters | 12 +++++++++ 26 files changed, 122 insertions(+), 70 deletions(-) diff --git a/src/emucore/Bankswitch.cxx b/src/emucore/Bankswitch.cxx index 1b907eea7..2ea053df1 100644 --- a/src/emucore/Bankswitch.cxx +++ b/src/emucore/Bankswitch.cxx @@ -141,6 +141,7 @@ Bankswitch::BSList = {{ { "FE" , "FE (8K Decathlon)" }, { "MDM" , "MDM (Menu Driven Megacart)" }, { "SB" , "SB (128-256K SUPERbank)" }, + { "TVBOY" , "TV Boy (512K)" }, { "UA" , "UA (8K UA Ltd.)" }, { "UASW" , "UASW (8K UA swapped banks)" }, { "WD" , "WD (Pink Panther)" }, @@ -226,6 +227,8 @@ Bankswitch::ExtensionMap Bankswitch::ourExtensions = { { "FE" , Bankswitch::Type::_FE }, { "MDM" , Bankswitch::Type::_MDM }, { "SB" , Bankswitch::Type::_SB }, + { "TVB" , Bankswitch::Type::_TVBOY }, + { "TVBOY" , Bankswitch::Type::_TVBOY }, { "UA" , Bankswitch::Type::_UA }, { "UASW" , Bankswitch::Type::_UASW }, { "WD" , Bankswitch::Type::_WD }, @@ -282,6 +285,7 @@ Bankswitch::NameToTypeMap Bankswitch::ourNameToTypes = { { "FE" , Bankswitch::Type::_FE }, { "MDM" , Bankswitch::Type::_MDM }, { "SB" , Bankswitch::Type::_SB }, + { "TVBOY" , Bankswitch::Type::_TVBOY }, { "UA" , Bankswitch::Type::_UA }, { "UASW" , Bankswitch::Type::_UASW }, { "WD" , Bankswitch::Type::_WD }, diff --git a/src/emucore/Bankswitch.hxx b/src/emucore/Bankswitch.hxx index 0dd3871c7..6ef5da867 100644 --- a/src/emucore/Bankswitch.hxx +++ b/src/emucore/Bankswitch.hxx @@ -38,14 +38,14 @@ class Bankswitch public: // Currently supported bankswitch schemes enum class Type { - _AUTO, _0840, _2IN1, _4IN1, _8IN1, _16IN1, _32IN1, - _64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F, - _4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, - _CDF, _CM, _CTY, _CV, _DF, _DFSC, _DPC, - _DPCP, _E0, _E7, _E78K, _EF, _EFSC, _F0, - _F4, _F4SC, _F6, _F6SC, _F8, _F8SC, _FA, - _FA2, _FC, _FE, _MDM, _SB, _UA, _UASW, - _WD, _WDSW, _X07, + _AUTO, _0840, _2IN1, _4IN1, _8IN1, _16IN1, _32IN1, + _64IN1, _128IN1, _2K, _3E, _3EX, _3EP, _3F, + _4A50, _4K, _4KSC, _AR, _BF, _BFSC, _BUS, + _CDF, _CM, _CTY, _CV, _DF, _DFSC, _DPC, + _DPCP, _E0, _E7, _E78K, _EF, _EFSC, _F0, + _F4, _F4SC, _F6, _F6SC, _F8, _F8SC, _FA, + _FA2, _FC, _FE, _MDM, _SB, _TVBOY, _UA, + _UASW, _WD, _WDSW, _X07, #ifdef CUSTOM_ARM _CUSTOM, #endif diff --git a/src/emucore/Cart.hxx b/src/emucore/Cart.hxx index cfd19497c..b04a95f10 100644 --- a/src/emucore/Cart.hxx +++ b/src/emucore/Cart.hxx @@ -169,13 +169,8 @@ 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 bank, uInt16 segment = 0) { return false; } + virtual bool bank(uInt16) { return false; } /** Get the current bank for the provided address. Carts which have only @@ -202,6 +197,7 @@ 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 08f803e0b..a0eea7486 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, uInt16) +bool CartridgeAR::bank(uInt16 bank) { if(!bankLocked()) return bankConfiguration(uInt8(bank)); diff --git a/src/emucore/CartAR.hxx b/src/emucore/CartAR.hxx index 349de38f1..0bc74a291 100644 --- a/src/emucore/CartAR.hxx +++ b/src/emucore/CartAR.hxx @@ -73,12 +73,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartBUS.cxx b/src/emucore/CartBUS.cxx index 62000118b..e2eb9b74a 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, uInt16) +bool CartridgeBUS::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartBUS.hxx b/src/emucore/CartBUS.hxx index 58e4eea48..3ab40f7ec 100644 --- a/src/emucore/CartBUS.hxx +++ b/src/emucore/CartBUS.hxx @@ -84,12 +84,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartCDF.cxx b/src/emucore/CartCDF.cxx index 09e0da3e3..6f9a5f4f7 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, uInt16) +bool CartridgeCDF::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartCDF.hxx b/src/emucore/CartCDF.hxx index 62c1721ca..14b1eda26 100644 --- a/src/emucore/CartCDF.hxx +++ b/src/emucore/CartCDF.hxx @@ -90,12 +90,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index b5dfc5197..40ec603e5 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -98,7 +98,7 @@ uInt8 CartridgeCM::column() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool CartridgeCM::bank(uInt16 bank, uInt16) +bool CartridgeCM::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartCM.hxx b/src/emucore/CartCM.hxx index 36fa13fa8..bf8b2586e 100644 --- a/src/emucore/CartCM.hxx +++ b/src/emucore/CartCM.hxx @@ -141,12 +141,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index dbb5d13e2..822473081 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, uInt16) +bool CartridgeCTY::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartCTY.hxx b/src/emucore/CartCTY.hxx index 1cd682446..fdd6c1e19 100644 --- a/src/emucore/CartCTY.hxx +++ b/src/emucore/CartCTY.hxx @@ -139,12 +139,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 7a0a7f4c6..b71f5a8c0 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, uInt16) +bool CartridgeDPCPlus::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartDPCPlus.hxx b/src/emucore/CartDPCPlus.hxx index bbbf68197..9617d6545 100644 --- a/src/emucore/CartDPCPlus.hxx +++ b/src/emucore/CartDPCPlus.hxx @@ -86,12 +86,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/CartDetector.cxx b/src/emucore/CartDetector.cxx index 976d56579..2ff85803d 100644 --- a/src/emucore/CartDetector.cxx +++ b/src/emucore/CartDetector.cxx @@ -56,6 +56,7 @@ #include "CartFE.hxx" #include "CartMDM.hxx" #include "CartSB.hxx" +#include "CartTVBoy.hxx" #include "CartUA.hxx" #include "CartWD.hxx" #include "CartX07.hxx" @@ -328,6 +329,8 @@ CartDetector::createFromImage(const ByteBuffer& image, size_t size, Bankswitch:: return make_unique(image, size, md5, settings, true); case Bankswitch::Type::_SB: return make_unique(image, size, md5, settings); + case Bankswitch::Type::_TVBOY: + return make_unique(image, size, md5, settings); case Bankswitch::Type::_WD: case Bankswitch::Type::_WDSW: return make_unique(image, size, md5, settings); @@ -524,6 +527,11 @@ Bankswitch::Type CartDetector::autodetectType(const ByteBuffer& image, size_t si else /*if(isProbablySB(image, size))*/ type = Bankswitch::Type::_SB; } + else if(size == 512_KB) + { + if(isProbablyTVBoy(image, size)) + type = Bankswitch::Type::_TVBOY; + } else // what else can we do? { if(isProbably3EX(image, size)) @@ -1000,6 +1008,14 @@ bool CartDetector::isProbablySB(const ByteBuffer& image, size_t size) return searchForBytes(image, size, signature[1], 3); } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +bool CartDetector::isProbablyTVBoy(const ByteBuffer& image, size_t size) +{ + // TV Boy cart bankswitching switches banks by accessing addresses 0x1800..$187F + uInt8 signature[5] = {0x91, 0x82, 0x6c, 0xfc, 0xff}; // STA ($82),Y; JMP ($FFFC) + return searchForBytes(image, size, signature, 5); +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartDetector::isProbablyUA(const ByteBuffer& image, size_t size) { diff --git a/src/emucore/CartDetector.hxx b/src/emucore/CartDetector.hxx index 9ff193c87..11ff7ac1f 100644 --- a/src/emucore/CartDetector.hxx +++ b/src/emucore/CartDetector.hxx @@ -247,6 +247,11 @@ class CartDetector */ static bool isProbablySB(const ByteBuffer& image, size_t size); + /** + Returns true if the image is probably a TV Boy bankswitching cartridge + */ + static bool isProbablyTVBoy(const ByteBuffer& image, size_t size); + /** Returns true if the image is probably a UA bankswitching cartridge */ diff --git a/src/emucore/CartEnhanced.hxx b/src/emucore/CartEnhanced.hxx index 3c2e2c80d..743a4b50e 100644 --- a/src/emucore/CartEnhanced.hxx +++ b/src/emucore/CartEnhanced.hxx @@ -70,7 +70,16 @@ class CartridgeEnhanced : public Cartridge @return true, if bank has changed */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + 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); } /** Get the current bank. diff --git a/src/emucore/CartMDM.cxx b/src/emucore/CartMDM.cxx index 2734b2793..decb634ec 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, uInt16) +bool CartridgeMDM::bank(uInt16 bank) { if(bankLocked() || myBankingDisabled) return false; diff --git a/src/emucore/CartMDM.hxx b/src/emucore/CartMDM.hxx index fe17ae628..4b0786e42 100644 --- a/src/emucore/CartMDM.hxx +++ b/src/emucore/CartMDM.hxx @@ -73,12 +73,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) 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 84cf8dac8..c6542b2b8 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, uInt16) +bool CartridgeMNetwork::bank(uInt16 bank) { if(bankLocked()) return false; diff --git a/src/emucore/CartMNetwork.hxx b/src/emucore/CartMNetwork.hxx index 7b4fdb729..95cd24b56 100644 --- a/src/emucore/CartMNetwork.hxx +++ b/src/emucore/CartMNetwork.hxx @@ -94,12 +94,9 @@ 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 segment The segment the bank should be using - - @return true, if bank has changed + @param bank The bank that should be installed in the system */ - bool bank(uInt16 bank, uInt16 segment = 0) override; + bool bank(uInt16 bank) override; /** Get the current bank. diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 3817232c6..2f26abc99 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -717,27 +717,57 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated) return; case Event::VidmodeStd: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::OFF); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::OFF); + myAdjustDirect = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::VidmodeRGB: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::RGB); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::RGB); + myAdjustSetting = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::VidmodeSVideo: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::SVIDEO); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::SVIDEO); + myAdjustSetting = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::VidModeComposite: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::COMPOSITE); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::COMPOSITE); + myAdjustSetting = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::VidModeBad: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::BAD); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::BAD); + myAdjustSetting = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::VidModeCustom: - if (pressed && !repeated) myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::CUSTOM); + if(pressed && !repeated) + { + myOSystem.frameBuffer().tiaSurface().setNTSC(NTSCFilter::Preset::CUSTOM); + myAdjustSetting = AdjustSetting::NTSC_PRESET; + myAdjustActive = true; + } return; case Event::PreviousAttribute: diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 2bb3746d4..9c84b4165 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: " << e.what(); + buf << "ERROR: Couldn't create console (" << e.what() << ")"; Logger::error(buf.str()); return buf.str(); } diff --git a/src/windows/Stella.vcxproj b/src/windows/Stella.vcxproj index 6fef5d589..a4a2365a7 100644 --- a/src/windows/Stella.vcxproj +++ b/src/windows/Stella.vcxproj @@ -523,6 +523,7 @@ true + true @@ -729,6 +730,7 @@ + @@ -1532,6 +1534,7 @@ true + true @@ -1747,6 +1750,7 @@ + diff --git a/src/windows/Stella.vcxproj.filters b/src/windows/Stella.vcxproj.filters index 0e4f58929..2a740137e 100644 --- a/src/windows/Stella.vcxproj.filters +++ b/src/windows/Stella.vcxproj.filters @@ -1005,6 +1005,12 @@ Source Files\gui + + Source Files\emucore + + + Source Files\debugger + @@ -2063,6 +2069,12 @@ Header Files\gui + + Header Files\emucore + + + Header Files\debugger +