Skip to content

Commit

Permalink
added PlusROM support developer option (fixes #1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
thrust26 committed Oct 19, 2024
1 parent 810d587 commit 408e42e
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 6 deletions.
4 changes: 4 additions & 0 deletions Changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
Release History
===========================================================================

7.0 to 7.1 (xxx x, 202x)

* Added developer option for disabling PlusROM support (TODO: Doc)

6.7.1 to 7.0 (October 5, 2024)

* Enhanced ROM launcher to allow multiple images per ROM.
Expand Down
3 changes: 3 additions & 0 deletions src/common/DevSettingsHandler.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ void DevSettingsHandler::loadSettings(SettingsSet set)
// AtariVox/SaveKey/PlusROM access
myExternAccess[set] = settings.getBool(prefix + "extaccess");
myConsole[set] = settings.getString(prefix + "console") == "7800" ? 1 : 0;
myPlusROM[set] = devSettings ? settings.getBool("dev.plusroms.on") : true;
// Randomization
myRandomBank[set] = settings.getBool(prefix + "bankrandom");
myRandomizeTIA[set] = settings.getBool(prefix + "tiarandom");
Expand Down Expand Up @@ -118,6 +119,7 @@ void DevSettingsHandler::saveSettings(SettingsSet set)

if(devSettings)
{
settings.setValue("dev.plusroms.on", myPlusROM[set]);
settings.setValue("dev.hsrandom", myRandomHotspots[set]);
// Undriven TIA pins
settings.setValue("dev.tiadriven", myUndrivenPins[set]);
Expand Down Expand Up @@ -183,6 +185,7 @@ void DevSettingsHandler::applySettings(SettingsSet set)
{
myOSystem.console().cartridge().enableRandomHotspots(myRandomHotspots[set]);
myOSystem.console().tia().driveUnusedPinsRandom(myUndrivenPins[set]);
myOSystem.console().cartridge().enablePlusROM(myPlusROM[set]);
// Notes:
// - thumb exceptions not updated, because set in cart constructor
// - other missing settings are used on-the-fly
Expand Down
1 change: 1 addition & 0 deletions src/common/DevSettingsHandler.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class DevSettingsHandler
std::array<bool, numSets> myDetectedInfo{};
std::array<bool, numSets> myExternAccess{};
std::array<int, numSets> myConsole{};
std::array<int, numSets> myPlusROM{};
std::array<bool, numSets> myRandomBank{};
std::array<bool, numSets> myRandomizeTIA{};
std::array<bool, numSets> myRandomizeRAM{};
Expand Down
7 changes: 7 additions & 0 deletions src/emucore/Cart.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,13 @@ class Cartridge : public Device
*/
virtual bool isPlusROM() const { return false; }

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
virtual void enablePlusROM(bool enable) { };

/**
Set the callback for displaying messages
*/
Expand Down
8 changes: 8 additions & 0 deletions src/emucore/CartCDF.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,14 @@ class CartridgeCDF : public CartridgeARM
*/
bool isPlusROM() const override { return myPlusROM->isValid(); }

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
void enablePlusROM(bool enable) override { myPlusROM->enable(enable); }


private:
static constexpr uInt8 COMMSTREAM = 0x20, JUMPSTREAM_BASE = 0x21;
static constexpr uInt16 LDAXY_OVERRIDE_INACTIVE = 0xFFFF;
Expand Down
7 changes: 7 additions & 0 deletions src/emucore/CartDPCPlus.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ class CartridgeDPCPlus : public CartridgeARM
*/
bool isPlusROM() const override { return myPlusROM->isValid(); }

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
void enablePlusROM(bool enable) override { myPlusROM->enable(enable); }

#ifdef DEBUGGER_SUPPORT
/**
Get debugger widget responsible for accessing the inner workings
Expand Down
7 changes: 7 additions & 0 deletions src/emucore/CartE7.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ class CartridgeE7 : public Cartridge
*/
bool isPlusROM() const override { return myPlusROM->isValid(); }

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
void enablePlusROM(bool enable) override { myPlusROM->enable(enable); }

/**
Set the callback for displaying messages
*/
Expand Down
9 changes: 8 additions & 1 deletion src/emucore/CartEnhanced.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ class CartridgeEnhanced : public Cartridge
*/
bool isPlusROM() const override { return myPlusROM->isValid(); }

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
void enablePlusROM(bool enable) override { myPlusROM->enable(enable); }

/**
Set the callback for displaying messages
*/
Expand Down Expand Up @@ -339,7 +346,7 @@ class CartridgeEnhanced : public Cartridge
*/
uInt16 ramAddressSegmentOffset(uInt16 address) const {
return static_cast<uInt16>(
(myCurrentSegOffset[((address & ROM_MASK) >> myBankShift) % myBankSegs] - mySize)
(myCurrentSegOffset[((address & ROM_MASK) >> myBankShift) % myBankSegs] - mySize)
>> (myBankShift - myRamBankShift));
}

Expand Down
1 change: 0 additions & 1 deletion src/emucore/PlusROM.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "PlusROM.hxx"
#include "Logger.hxx"
#include "Version.hxx"
#include "Settings.hxx"
#include "CartDetector.hxx"

#if defined(HTTP_LIB_SUPPORT)
Expand Down
17 changes: 14 additions & 3 deletions src/emucore/PlusROM.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@
#ifndef PLUSROM_HXX
#define PLUSROM_HXX

class Settings;

#include <deque>

#include "bspf.hxx"
#include "Serializable.hxx"
#include "Cart.hxx"
#include "Settings.hxx"

/**
Class used to emulate the 'PlusROM' meta-scheme, documented at
Expand Down Expand Up @@ -75,7 +74,18 @@ class PlusROM : public Serializable
@return Whether this is actually a PlusROM cart
*/
bool isValid() const { return myIsPlusROM; }
bool isValid() const {
return myIsPlusROM && myIsEnabled;
}

/**
Enable or disable PlusROM support.
@param enabled Whether to enable the PlusROM support
*/
void enable(bool enabled) {
myIsEnabled = enabled;
}

/**
Read from hotspot addresses ($1FF2 and $1FF3).
Expand Down Expand Up @@ -175,6 +185,7 @@ class PlusROM : public Serializable
const Cartridge& myCart;

bool myIsPlusROM{false};
bool myIsEnabled{true};
string myHost;
string myPath;

Expand Down
2 changes: 2 additions & 0 deletions src/emucore/Settings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ Settings::Settings()
setPermanent("dev.tm.horizon", "30s"); // = ~30 seconds
setPermanent("dev.detectedinfo", "true");
setPermanent("dev.extaccess", "true");
setPermanent("dev.plusroms.on", "true");
// Thumb ARM emulation options
setPermanent("dev.thumb.trapfatal", "true");
setPermanent("dev.arm.mips", CartridgeELF::MIPS_DEF);
Expand Down Expand Up @@ -810,6 +811,7 @@ void Settings::usage()
<< " -dev.thumb.mammode <0-3> Selects the LPC's MAM mode\n"
#endif
<< " -dev.extaccess <1|0> Enable messages for external access\n"
<< " -dev.plusroms.on <1|0> Enable PlusROM support\n"
<< " -dev.tia.type <standard|custom| Selects a TIA type\n"
<< " koolaidman|\n"
<< " cosmicark|pesco|\n"
Expand Down
13 changes: 12 additions & 1 deletion src/gui/DeveloperDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)

// AtariVox/SaveKey/PlusROM access
myExternAccessWidget = new CheckboxWidget(myTab, font, HBORDER + INDENT * 1, ypos + 1,
"Display external access message");
"External access messages");
myExternAccessWidget->setToolTip("Display a message for any external access\n"
"AtariVox/SaveKey EEPROM, PlusROM, Supercharger...).");
wid.push_back(myExternAccessWidget);
Expand All @@ -147,6 +147,13 @@ void DeveloperDialog::addEmulationTab(const GUI::Font& font)
myConsoleWidget->setToolTip("Emulate Color/B&W/Pause key and zero\n"
"page RAM initialization differently.");
wid.push_back(myConsoleWidget);

// PlusROM functionality
myPlusRomWidget = new CheckboxWidget(myTab, font,
myDetectedInfoWidget->getLeft(), ypos + 1,
"PlusROM support");
myPlusRomWidget->setToolTip("Enable PlusROM support");
wid.push_back(myPlusRomWidget);
ypos += lineHeight + VGAP;

// Randomize items
Expand Down Expand Up @@ -748,6 +755,7 @@ void DeveloperDialog::getWidgetStates(SettingsSet set)
// AtariVox/SaveKey/PlusROM access
myExternAccess[set] = myExternAccessWidget->getState();
myConsole[set] = myConsoleWidget->getSelected() == 1;
myPlusROM[set] = myPlusRomWidget->getState() == 1;
// Randomization
myRandomBank[set] = myRandomBankWidget->getState();
myRandomizeTIA[set] = myRandomizeTIAWidget->getState();
Expand Down Expand Up @@ -812,6 +820,7 @@ void DeveloperDialog::setWidgetStates(SettingsSet set)
// AtariVox/SaveKey/PlusROM access
myExternAccessWidget->setState(myExternAccess[set]);
myConsoleWidget->setSelectedIndex(myConsole[set]);
myPlusRomWidget->setState(myPlusROM[set]);
// Randomization
myRandomBankWidget->setState(myRandomBank[set]);
myRandomizeTIAWidget->setState(myRandomizeTIA[set]);
Expand Down Expand Up @@ -965,6 +974,7 @@ void DeveloperDialog::setDefaults()
// AtariVox/SaveKey/PlusROM access
myExternAccess[set] = devSettings;
myConsole[set] = 0;
myPlusROM[set] = true;
// Randomization
myRandomBank[set] = devSettings;
myRandomizeTIA[set] = devSettings;
Expand Down Expand Up @@ -1149,6 +1159,7 @@ void DeveloperDialog::handleCommand(CommandSender* sender, int cmd, int data, in
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DeveloperDialog::handleSettings(bool devSettings)
{
myPlusRomWidget->setEnabled(devSettings);
myRandomHotspotsWidget->setEnabled(devSettings);
myUndrivenPinsWidget->setEnabled(devSettings);
#ifdef DEBUGGER_SUPPORT
Expand Down
1 change: 1 addition & 0 deletions src/gui/DeveloperDialog.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class DeveloperDialog : public Dialog, DevSettingsHandler
CheckboxWidget* myFrameStatsWidget{nullptr};
CheckboxWidget* myDetectedInfoWidget{nullptr};
CheckboxWidget* myExternAccessWidget{nullptr};
CheckboxWidget* myPlusRomWidget{nullptr};
PopUpWidget* myConsoleWidget{nullptr};
StaticTextWidget* myLoadingROMLabel{nullptr};
CheckboxWidget* myRandomBankWidget{nullptr};
Expand Down

0 comments on commit 408e42e

Please sign in to comment.