reverted some previous, superfluous changes

This commit is contained in:
Thomas Jentzsch 2021-10-10 15:52:13 +02:00
parent eeecf28acc
commit 649352991a
5 changed files with 23 additions and 34 deletions

View File

@ -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<Cartridge> 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> cartridge;
Bankswitch::Type type = Bankswitch::nameToType(propertiesType),
@ -89,7 +89,7 @@ unique_ptr<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> 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<Cartridge> CartCreator::create(const FilesystemNode& file,
break;
case Bankswitch::Type::_MVC:
cartridge = make_unique<CartridgeMVC>(file.getPath(), size, md5, osystem.settings());
cartridge = make_unique<CartridgeMVC>(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<Cartridge> CartCreator::create(const FilesystemNode& file,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
unique_ptr<Cartridge>
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<Cartridge>
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)
{

View File

@ -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<Cartridge> 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<Cartridge>
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<Cartridge>
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

View File

@ -640,7 +640,7 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
};
unique_ptr<Cartridge> 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

View File

@ -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> 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;

View File

@ -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<ProfilingRun> profilingRuns;
unique_ptr<OSystem> myOSystem;
Settings mySettings;
Properties myProps;