diff --git a/src/emucore/CartCreator.cxx b/src/emucore/CartCreator.cxx index 4c31066cb..efe84fdd4 100644 --- a/src/emucore/CartCreator.cxx +++ b/src/emucore/CartCreator.cxx @@ -63,7 +63,7 @@ #include "MD5.hxx" #include "Props.hxx" #include "Logger.hxx" -#include "OSystem.hxx" +#include "Settings.hxx" #include "CartDetector.hxx" #include "CartCreator.hxx" @@ -71,7 +71,7 @@ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr CartCreator::create(const FilesystemNode& file, const ByteBuffer& image, size_t size, string& md5, - const string& propertiesType, OSystem& osystem) + const string& propertiesType, Settings& settings) { unique_ptr cartridge; Bankswitch::Type type = Bankswitch::nameToType(propertiesType), @@ -89,7 +89,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, // See if we should try to auto-detect the cartridge type // If we ask for extended info, always do an autodetect - if(type == Bankswitch::Type::_AUTO || osystem.settings().getBool("rominfo")) + if(type == Bankswitch::Type::_AUTO || settings.getBool("rominfo")) { detectedType = CartDetector::autodetectType(image, size); if(type != Bankswitch::Type::_AUTO && type != detectedType) @@ -111,7 +111,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 2*2_KB || size == 2*4_KB || size == 2*8_KB || size == 2*16_KB || size == 2*32_KB) { cartridge = - createFromMultiCart(image, size, 2, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 2, md5, detectedType, id, settings); buf << id; } else @@ -124,7 +124,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 4*2_KB || size == 4*4_KB || size == 4*8_KB || size == 4*16_KB) { cartridge = - createFromMultiCart(image, size, 4, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 4, md5, detectedType, id, settings); buf << id; } else @@ -137,7 +137,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 8*2_KB || size == 8*4_KB || size == 8*8_KB) { cartridge = - createFromMultiCart(image, size, 8, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 8, md5, detectedType, id, settings); buf << id; } else @@ -150,7 +150,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 16*2_KB || size == 16*4_KB || size == 16*8_KB) { cartridge = - createFromMultiCart(image, size, 16, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 16, md5, detectedType, id, settings); buf << id; } else @@ -163,7 +163,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 32*2_KB || size == 32*4_KB) { cartridge = - createFromMultiCart(image, size, 32, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 32, md5, detectedType, id, settings); buf << id; } else @@ -176,7 +176,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 64*2_KB || size == 64*4_KB) { cartridge = - createFromMultiCart(image, size, 64, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 64, md5, detectedType, id, settings); buf << id; } else @@ -189,7 +189,7 @@ unique_ptr CartCreator::create(const FilesystemNode& file, if(size == 128*2_KB || size == 128*4_KB) { cartridge = - createFromMultiCart(image, size, 128, md5, detectedType, id, osystem); + createFromMultiCart(image, size, 128, md5, detectedType, id, settings); buf << id; } else @@ -198,11 +198,11 @@ unique_ptr CartCreator::create(const FilesystemNode& file, break; case Bankswitch::Type::_MVC: - cartridge = make_unique(file.getPath(), size, md5, osystem.settings()); + cartridge = make_unique(file.getPath(), size, md5, settings); break; default: - cartridge = createFromImage(image, size, detectedType, md5, osystem); + cartridge = createFromImage(image, size, detectedType, md5, settings); break; } @@ -219,10 +219,8 @@ unique_ptr CartCreator::create(const FilesystemNode& file, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size, - uInt32 numroms, string& md5, Bankswitch::Type type, string& id, OSystem& osystem) + uInt32 numroms, string& md5, Bankswitch::Type type, string& id, Settings& settings) { - Settings& settings = osystem.settings(); - // Get a piece of the larger image uInt32 i = settings.getInt("romloadcount"); @@ -252,16 +250,14 @@ CartCreator::createFromMultiCart(const ByteBuffer& image, size_t& size, else /* default */ type = Bankswitch::Type::_4K; - return createFromImage(slice, size, type, md5, osystem); + return createFromImage(slice, size, type, md5, settings); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - unique_ptr CartCreator::createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, - const string& md5, OSystem& osystem) + const string& md5, Settings& settings) { - Settings& settings = osystem.settings(); - // We should know the cart's type by now so let's create it switch(type) { diff --git a/src/emucore/CartCreator.hxx b/src/emucore/CartCreator.hxx index 4b72cf652..3aa3a6217 100644 --- a/src/emucore/CartCreator.hxx +++ b/src/emucore/CartCreator.hxx @@ -21,7 +21,6 @@ class Cartridge; class Properties; class Settings; -class OSystem; #include "Bankswitch.hxx" #include "bspf.hxx" @@ -43,12 +42,12 @@ class CartCreator @param size The size of the ROM image @param md5 The md5sum for the given ROM image (can be updated) @param dtype The detected bankswitch type of the ROM image - @param osystem The OSystem object to use + @param settings The settings container @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr create(const FilesystemNode& file, const ByteBuffer& image, size_t size, string& md5, - const string& dtype, OSystem& osystem); + const string& dtype, Settings& settings); private: /** @@ -61,14 +60,14 @@ class CartCreator @param md5 The md5sum for the slice of the ROM image @param type The detected type of the slice of the ROM image @param id The ID for the slice of the ROM image - @param osystem The OSystem object to use + @param settings The settings container @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr createFromMultiCart(const ByteBuffer& image, size_t& size, uInt32 numroms, string& md5, Bankswitch::Type type, string& id, - OSystem& osystem); + Settings& settings); /** Create a cartridge from the entire image pointer. @@ -77,14 +76,13 @@ class CartCreator @param size The size of the ROM image @param type The bankswitch type of the ROM image @param md5 The md5sum for the ROM image - @param osystem The OSystem object to use + @param settings The settings container @return Pointer to the new cartridge object allocated on the heap */ static unique_ptr createFromImage(const ByteBuffer& image, size_t size, Bankswitch::Type type, - const string& md5, OSystem& osystem); - + const string& md5, Settings& settings); private: // Following constructors and assignment operators not supported diff --git a/src/emucore/OSystem.cxx b/src/emucore/OSystem.cxx index 51b27f6f3..80ce13a7c 100644 --- a/src/emucore/OSystem.cxx +++ b/src/emucore/OSystem.cxx @@ -640,7 +640,7 @@ unique_ptr OSystem::openConsole(const FilesystemNode& romfile, string& }; unique_ptr cart = - CartCreator::create(romfile, image, size, cartmd5, type, *this); + CartCreator::create(romfile, image, size, cartmd5, type, *mySettings); cart->setMessageCallback(callback); // Some properties may not have a name set; we can't leave it blank diff --git a/src/emucore/ProfilingRunner.cxx b/src/emucore/ProfilingRunner.cxx index 4fb332ccd..e8ed88797 100644 --- a/src/emucore/ProfilingRunner.cxx +++ b/src/emucore/ProfilingRunner.cxx @@ -26,7 +26,6 @@ #include "Control.hxx" #include "M6502.hxx" #include "M6532.hxx" -#include "MediaFactory.hxx" #include "TIA.hxx" #include "ConsoleTiming.hxx" #include "FrameManager.hxx" @@ -74,7 +73,6 @@ ProfilingRunner::ProfilingRunner(int argc, char* argv[]) } } - myOSystem = MediaFactory::createOSystem(); mySettings.setValue("fastscbios", true); } @@ -112,7 +110,7 @@ bool ProfilingRunner::runOne(const ProfilingRun& run) string md5 = MD5::hash(image, size); string type = ""; unique_ptr cartridge = CartCreator::create( - imageFile, image, size, md5, type, *myOSystem); + imageFile, image, size, md5, type, mySettings); if (!cartridge) { cout << "ERROR: unable to determine cartridge type" << endl; diff --git a/src/emucore/ProfilingRunner.hxx b/src/emucore/ProfilingRunner.hxx index 40ee04823..bb9d298e2 100644 --- a/src/emucore/ProfilingRunner.hxx +++ b/src/emucore/ProfilingRunner.hxx @@ -18,8 +18,6 @@ #ifndef PROFILING_RUNNER #define PROFILING_RUNNER -class OSystem; - #include "bspf.hxx" #include "Control.hxx" #include "Switches.hxx" @@ -59,7 +57,6 @@ class ProfilingRunner { vector profilingRuns; - unique_ptr myOSystem; Settings mySettings; Properties myProps;