diff --git a/Changes.txt b/Changes.txt index 2de2987ee..60fd29f4e 100644 --- a/Changes.txt +++ b/Changes.txt @@ -28,6 +28,8 @@ * Added detection of color and audio data in DiStella. + * Restored 'cfg' directory for Distella config files. + -Have fun! diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 612f51542..a52732cfe 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -843,12 +843,13 @@ string CartDebug::loadSymbolFile() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::loadConfigFile() { - // The default naming/location for config files is the ROM dir based on the - // actual ROM filename + // The default naming/location for config files is the CFG dir and based + // on the actual ROM filename if(myCfgFile == "") { - FilesystemNode cfg(myOSystem.romFile().getPathWithExt("") + ".cfg"); + FilesystemNode romNode(myOSystem.romFile().getPathWithExt("") + ".cfg"); + FilesystemNode cfg(myOSystem.cfgDir() + romNode.getName()); if(cfg.isFile() && cfg.isReadable()) myCfgFile = cfg.getPath(); else @@ -964,14 +965,14 @@ string CartDebug::loadConfigFile() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::saveConfigFile() { - // The default naming/location for config files is the ROM dir based on the - // actual ROM filename + // The default naming/location for config files is the CFG dir and based + // on the actual ROM filename - FilesystemNode cfg; if(myCfgFile == "") { - cfg = FilesystemNode(myOSystem.romFile().getPathWithExt("") + ".cfg"); - if(cfg.isFile() && cfg.isWritable()) + FilesystemNode romNode(myOSystem.romFile().getPathWithExt("") + ".cfg"); + FilesystemNode cfg(myOSystem.cfgDir() + romNode.getName()); + if(cfg.getParent().isWritable()) myCfgFile = cfg.getPath(); else return DebuggerParser::red("config file \'" + cfg.getShortPath() + "\' not writable"); @@ -980,13 +981,14 @@ string CartDebug::saveConfigFile() const string& name = myConsole.properties().get(PropType::Cart_Name); const string& md5 = myConsole.properties().get(PropType::Cart_MD5); + FilesystemNode cfg(myCfgFile); ofstream out(cfg.getPath()); if(!out.is_open()) return "Unable to save directives to " + cfg.getShortPath(); // Store all bank information - out << "//Stella.pro: \"" << name << "\"" << endl - << "//MD5: " << md5 << endl + out << "// Stella.pro: \"" << name << "\"" << endl + << "// MD5: " << md5 << endl << endl; for(uInt32 b = 0; b < myConsole.cartridge().bankCount(); ++b) { diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 7fff9c8a6..c2bd03cae 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -343,7 +343,7 @@ class CartDebug : public DebuggerSystem uInt16 myLabelLength{8}; // longest pre-defined label // Filenames to use for various I/O (currently these are hardcoded) - string myListFile, mySymbolFile, myCfgFile, myDisasmFile, myRomFile; + string myListFile, mySymbolFile, myCfgFile, myDisasmFile; /// Table of instruction mnemonics static std::array ourTIAMnemonicR; // read mode diff --git a/src/emucore/Cart3E.cxx b/src/emucore/Cart3E.cxx index f5f37febc..f1ccd2957 100644 --- a/src/emucore/Cart3E.cxx +++ b/src/emucore/Cart3E.cxx @@ -221,6 +221,12 @@ uInt16 Cartridge3E::bankCount() const return myRomBanks + myRamBanks; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt16 Cartridge3E::bankSize(uInt16 bank) const +{ + return 2_KB; // we cannot use bankCount() here, because it delivers wrong numbers +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Cartridge3E::patch(uInt16 address, uInt8 value) { diff --git a/src/emucore/Cart3E.hxx b/src/emucore/Cart3E.hxx index 6b2ea0b88..d78cb3bb0 100644 --- a/src/emucore/Cart3E.hxx +++ b/src/emucore/Cart3E.hxx @@ -111,6 +111,14 @@ class Cartridge3E : public Cartridge */ uInt16 bankCount() const override; + /** + Get the size of a bank. + + @param bank The bank to get the size for + @return The bank's size + */ + virtual uInt16 bankSize(uInt16 bank = 0) const; + /** Patch the cartridge ROM. diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 29359d6ba..832b1ce35 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -268,6 +268,9 @@ void OSystem::setConfigPaths() buildDirIfRequired(myStateDir, myBaseDir + "state"); buildDirIfRequired(myNVRamDir, myBaseDir + "nvram"); +#ifdef DEBUGGER_SUPPORT + buildDirIfRequired(myCfgDir, myBaseDir + "cfg"); +#endif #ifdef PNG_SUPPORT mySnapshotSaveDir = mySettings->getString("snapsavedir"); @@ -292,6 +295,7 @@ void OSystem::setConfigPaths() dbgPath("base dir ", myBaseDir); dbgPath("state dir ", myStateDir); dbgPath("nvram dir ", myNVRamDir); + dbgPath("cfg dir ", myCfgDir); dbgPath("ssave dir ", mySnapshotSaveDir); dbgPath("sload dir ", mySnapshotLoadDir); dbgPath("cheat file", myCheatFile); diff --git a/src/emucore/OSystem.hxx b/src/emucore/OSystem.hxx index 123bc92cb..b23cbdb83 100644 --- a/src/emucore/OSystem.hxx +++ b/src/emucore/OSystem.hxx @@ -270,6 +270,13 @@ class OSystem const string& cheatFile() const { return myCheatFile; } #endif + #ifdef DEBUGGER_SUPPORT + /** + Return the full/complete directory name for storing Distella cfg files. + */ + const string& cfgDir() const { return myCfgDir; } + #endif + #ifdef PNG_SUPPORT /** Return the full/complete directory name for saving and loading @@ -529,6 +536,7 @@ class OSystem string mySnapshotSaveDir; string mySnapshotLoadDir; string myNVRamDir; + string myCfgDir; string myDefaultSaveDir; string myDefaultLoadDir;