Allow to switch between TIA implementations via command line / config.

This commit is contained in:
Christian Speckner 2016-10-31 00:12:52 +01:00
parent 4188d766fb
commit ffccc351f6
4 changed files with 49 additions and 2 deletions

View File

@ -15,5 +15,7 @@
"**/.hg": true, "**/.hg": true,
"**/.DS_Store": true, "**/.DS_Store": true,
"src/**/*.o": true "src/**/*.o": true
} },
"editor.trimAutoWhitespace": true,
"editor.useTabStops": false
} }

View File

@ -20,6 +20,7 @@
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <stdexcept>
#include <fstream> #include <fstream>
#include "AtariVox.hxx" #include "AtariVox.hxx"
@ -83,7 +84,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
// Create subsystems for the console // Create subsystems for the console
my6502 = make_ptr<M6502>(myOSystem.settings()); my6502 = make_ptr<M6502>(myOSystem.settings());
myRiot = make_ptr<M6532>(*this, myOSystem.settings()); myRiot = make_ptr<M6532>(*this, myOSystem.settings());
myTIA = make_ptr<TIADefaultCore::TIA>(*this, myOSystem.sound(), myOSystem.settings()); myTIA = unique_ptr<AbstractTIA>(createTIA());
mySwitches = make_ptr<Switches>(myEvent, myProperties); mySwitches = make_ptr<Switches>(myEvent, myProperties);
// Construct the system and components // Construct the system and components
@ -537,6 +538,31 @@ void Console::changeHeight(int direction)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AbstractTIA* Console::createTIA()
{
string coreType = "default";
#ifdef SUPPORT_6502TS_TIA
coreType = myOSystem.settings().getString("tia.core");
#endif
if (coreType == "default") {
myOSystem.logMessage("using default TIA core", 1);
return new TIADefaultCore::TIA(*this, myOSystem.sound(), myOSystem.settings());
}
if (coreType == "6502ts") {
myOSystem.logMessage("using 6502.ts TIA core", 1);
return 0;
}
ostringstream buffer;
buffer << "invalid TIA core type " << coreType;
throw new runtime_error(buffer.str());
}
void Console::setTIAProperties() void Console::setTIAProperties()
{ {
// TODO - query these values directly from the TIA if value is 'AUTO' // TODO - query these values directly from the TIA if value is 'AUTO'

View File

@ -286,6 +286,12 @@ class Console : public Serializable
void toggleJitter() const; void toggleJitter() const;
private: private:
/**
Create the TIA
*/
AbstractTIA* createTIA();
/** /**
Sets various properties of the TIA (YStart, Height, etc) based on Sets various properties of the TIA (YStart, Height, etc) based on
the current display format. the current display format.

View File

@ -48,6 +48,9 @@ Settings::Settings(OSystem& osystem)
setInternal("uimessages", "true"); setInternal("uimessages", "true");
// TIA specific options // TIA specific options
#ifdef SUPPORT_6502TS_TIA
setInternal("tia.core", "default");
#endif
setInternal("tia.zoom", "2"); setInternal("tia.zoom", "2");
setInternal("tia.inter", "false"); setInternal("tia.inter", "false");
setInternal("tia.aspectn", "90"); setInternal("tia.aspectn", "90");
@ -324,6 +327,12 @@ void Settings::validate()
i = getInt("loglevel"); i = getInt("loglevel");
if(i < 0 || i > 2) if(i < 0 || i > 2)
setInternal("loglevel", "1"); setInternal("loglevel", "1");
#ifdef SUPPORT_6502TS_TIA
s = getString("tia.core");
if (s != "6502ts" && s != "default") setInternal("tia.core", "default");
#endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -364,6 +373,10 @@ void Settings::usage() const
<< " -freq <number> Set sound sample output frequency (11025|22050|31400|44100|48000)\n" << " -freq <number> Set sound sample output frequency (11025|22050|31400|44100|48000)\n"
<< " -volume <number> Set the volume (0 - 100)\n" << " -volume <number> Set the volume (0 - 100)\n"
<< endl << endl
#endif
#ifdef SUPPORT_6502TS_TIA
<< " -tia.core <default|\n"
<< " 6502ts> Select the TIA core\n"
#endif #endif
<< " -tia.zoom <zoom> Use the specified zoom level (windowed mode) for TIA image\n" << " -tia.zoom <zoom> Use the specified zoom level (windowed mode) for TIA image\n"
<< " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA image\n" << " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA image\n"