diff --git a/.vscode/settings.json b/.vscode/settings.json index 0a5f45bae..826b7d7b7 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -15,5 +15,7 @@ "**/.hg": true, "**/.DS_Store": true, "src/**/*.o": true - } + }, + "editor.trimAutoWhitespace": true, + "editor.useTabStops": false } \ No newline at end of file diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 10fa064d7..04b1fb45e 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -20,6 +20,7 @@ #include #include #include +#include #include #include "AtariVox.hxx" @@ -83,7 +84,7 @@ Console::Console(OSystem& osystem, unique_ptr& cart, // Create subsystems for the console my6502 = make_ptr(myOSystem.settings()); myRiot = make_ptr(*this, myOSystem.settings()); - myTIA = make_ptr(*this, myOSystem.sound(), myOSystem.settings()); + myTIA = unique_ptr(createTIA()); mySwitches = make_ptr(myEvent, myProperties); // 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() { // TODO - query these values directly from the TIA if value is 'AUTO' diff --git a/src/emucore/Console.hxx b/src/emucore/Console.hxx index 4013e8a9a..cd7779ba2 100644 --- a/src/emucore/Console.hxx +++ b/src/emucore/Console.hxx @@ -286,6 +286,12 @@ class Console : public Serializable void toggleJitter() const; private: + + /** + Create the TIA + */ + AbstractTIA* createTIA(); + /** Sets various properties of the TIA (YStart, Height, etc) based on the current display format. diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index becb2f665..94da3ef40 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -48,6 +48,9 @@ Settings::Settings(OSystem& osystem) setInternal("uimessages", "true"); // TIA specific options +#ifdef SUPPORT_6502TS_TIA + setInternal("tia.core", "default"); +#endif setInternal("tia.zoom", "2"); setInternal("tia.inter", "false"); setInternal("tia.aspectn", "90"); @@ -324,6 +327,12 @@ void Settings::validate() i = getInt("loglevel"); if(i < 0 || i > 2) 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 Set sound sample output frequency (11025|22050|31400|44100|48000)\n" << " -volume Set the volume (0 - 100)\n" << endl + #endif + #ifdef SUPPORT_6502TS_TIA + << " -tia.core Select the TIA core\n" #endif << " -tia.zoom Use the specified zoom level (windowed mode) for TIA image\n" << " -tia.inter <1|0> Enable interpolated (smooth) scaling for TIA image\n"