mirror of https://github.com/stella-emu/stella.git
Console timing info is now available through Console::timing()
and TIA::consoleTiming(). This allows to query the TIA about specific version of the console being emulated, which can be distinct from the frame layout used by the TIA itself.
This commit is contained in:
parent
41e2f77333
commit
a07a607c76
|
@ -78,7 +78,8 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
|||
myDisplayFormat(""), // Unknown TV format @ start
|
||||
myFramerate(0.0), // Unknown framerate @ start
|
||||
myCurrentFormat(0), // Unknown format @ start
|
||||
myUserPaletteDefined(false)
|
||||
myUserPaletteDefined(false),
|
||||
myConsoleTiming(ConsoleTiming::ntsc)
|
||||
{
|
||||
// Load user-defined palette for this ROM
|
||||
loadUserPalette();
|
||||
|
@ -151,12 +152,36 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
|||
// properties (60Hz, 262 scanlines, etc), but likely result in flicker
|
||||
// The TIA will self-adjust the framerate if necessary
|
||||
setTIAProperties();
|
||||
if(myDisplayFormat == "NTSC") myCurrentFormat = 1;
|
||||
else if(myDisplayFormat == "PAL") myCurrentFormat = 2;
|
||||
else if(myDisplayFormat == "SECAM") myCurrentFormat = 3;
|
||||
else if(myDisplayFormat == "NTSC50") myCurrentFormat = 4;
|
||||
else if(myDisplayFormat == "PAL60") myCurrentFormat = 5;
|
||||
else if(myDisplayFormat == "SECAM60") myCurrentFormat = 6;
|
||||
if(myDisplayFormat == "NTSC")
|
||||
{
|
||||
myCurrentFormat = 1;
|
||||
myConsoleTiming = ConsoleTiming::ntsc;
|
||||
}
|
||||
else if(myDisplayFormat == "PAL")
|
||||
{
|
||||
myCurrentFormat = 2;
|
||||
myConsoleTiming = ConsoleTiming::pal;
|
||||
}
|
||||
else if(myDisplayFormat == "SECAM")
|
||||
{
|
||||
myCurrentFormat = 3;
|
||||
myConsoleTiming = ConsoleTiming::secam;
|
||||
}
|
||||
else if(myDisplayFormat == "NTSC50")
|
||||
{
|
||||
myCurrentFormat = 4;
|
||||
myConsoleTiming = ConsoleTiming::ntsc;
|
||||
}
|
||||
else if(myDisplayFormat == "PAL60")
|
||||
{
|
||||
myCurrentFormat = 5;
|
||||
myConsoleTiming = ConsoleTiming::pal;
|
||||
}
|
||||
else if(myDisplayFormat == "SECAM60")
|
||||
{
|
||||
myCurrentFormat = 6;
|
||||
myConsoleTiming = ConsoleTiming::secam;
|
||||
}
|
||||
|
||||
// Bumper Bash always requires all 4 directions
|
||||
// Other ROMs can use it if the setting is enabled
|
||||
|
@ -249,29 +274,37 @@ void Console::toggleFormat(int direction)
|
|||
myDisplayFormat = myTIA->frameLayout() == FrameLayout::pal ? "PAL" : "NTSC";
|
||||
message = "Auto-detect mode: " + myDisplayFormat;
|
||||
saveformat = "AUTO";
|
||||
myConsoleTiming = myTIA->frameLayout() == FrameLayout::pal ?
|
||||
ConsoleTiming::pal : ConsoleTiming::ntsc;
|
||||
break;
|
||||
case 1:
|
||||
saveformat = myDisplayFormat = "NTSC";
|
||||
saveformat = myDisplayFormat = "NTSC";
|
||||
myConsoleTiming = ConsoleTiming::ntsc;
|
||||
message = "NTSC mode";
|
||||
break;
|
||||
case 2:
|
||||
saveformat = myDisplayFormat = "PAL";
|
||||
saveformat = myDisplayFormat = "PAL";
|
||||
myConsoleTiming = ConsoleTiming::pal;
|
||||
message = "PAL mode";
|
||||
break;
|
||||
case 3:
|
||||
saveformat = myDisplayFormat = "SECAM";
|
||||
saveformat = myDisplayFormat = "SECAM";
|
||||
myConsoleTiming = ConsoleTiming::secam;
|
||||
message = "SECAM mode";
|
||||
break;
|
||||
case 4:
|
||||
saveformat = myDisplayFormat = "NTSC50";
|
||||
saveformat = myDisplayFormat = "NTSC50";
|
||||
myConsoleTiming = ConsoleTiming::ntsc;
|
||||
message = "NTSC50 mode";
|
||||
break;
|
||||
case 5:
|
||||
saveformat = myDisplayFormat = "PAL60";
|
||||
saveformat = myDisplayFormat = "PAL60";
|
||||
myConsoleTiming = ConsoleTiming::pal;
|
||||
message = "PAL60 mode";
|
||||
break;
|
||||
case 6:
|
||||
saveformat = myDisplayFormat = "SECAM60";
|
||||
saveformat = myDisplayFormat = "SECAM60";
|
||||
myConsoleTiming = ConsoleTiming::secam;
|
||||
message = "SECAM60 mode";
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -50,6 +50,16 @@ struct ConsoleInfo
|
|||
string InitialFrameRate;
|
||||
};
|
||||
|
||||
/**
|
||||
Contains timing information about the specified console.
|
||||
*/
|
||||
enum class ConsoleTiming
|
||||
{
|
||||
ntsc, // console with CPU running at 1.193182 MHz, NTSC colours
|
||||
pal, // console with CPU running at 1.182298 MHz, PAL colours
|
||||
secam // console with CPU running at 1.187500 MHz, SECAM colours
|
||||
};
|
||||
|
||||
/**
|
||||
This class represents the entire game console.
|
||||
|
||||
|
@ -160,6 +170,11 @@ class Console : public Serializable
|
|||
*/
|
||||
const ConsoleInfo& about() const { return myConsoleInfo; }
|
||||
|
||||
/**
|
||||
Timing information for this console.
|
||||
*/
|
||||
ConsoleTiming timing() const { return myConsoleTiming; }
|
||||
|
||||
/**
|
||||
Set up the console to use the debugger.
|
||||
*/
|
||||
|
@ -366,6 +381,9 @@ class Console : public Serializable
|
|||
// Contains detailed info about this console
|
||||
ConsoleInfo myConsoleInfo;
|
||||
|
||||
// Contains timing information for this console
|
||||
ConsoleTiming myConsoleTiming;
|
||||
|
||||
// Table of RGB values for NTSC, PAL and SECAM
|
||||
static uInt32 ourNTSCPalette[256];
|
||||
static uInt32 ourPALPalette[256];
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#ifndef FRAME_LAYOUT
|
||||
#define FRAME_LAYOUT
|
||||
|
||||
enum FrameLayout {
|
||||
enum class FrameLayout {
|
||||
ntsc, // ROM display has NTSC timings (~60Hz, ~262 scanlines, etc)
|
||||
pal // ROM display has PAL timings (~50Hz, ~312 scanlines, etc)
|
||||
};
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#define TIA_TIA
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "Console.hxx"
|
||||
#include "Sound.hxx"
|
||||
#include "Settings.hxx"
|
||||
#include "Device.hxx"
|
||||
|
@ -35,8 +36,6 @@
|
|||
#include "LatchedInput.hxx"
|
||||
#include "PaddleReader.hxx"
|
||||
|
||||
class Console;
|
||||
|
||||
/**
|
||||
This class is a device that emulates the Television Interface Adaptor
|
||||
found in the Atari 2600 and 7800 consoles. The Television Interface
|
||||
|
@ -174,6 +173,11 @@ class TIA : public Device
|
|||
void setLayout(FrameLayout layout) { myFrameManager.setLayout(layout); }
|
||||
FrameLayout frameLayout() const { return myFrameManager.layout(); }
|
||||
|
||||
/**
|
||||
Answers the timing of the console currently in use.
|
||||
*/
|
||||
ConsoleTiming consoleTiming() const { return myConsole.timing(); }
|
||||
|
||||
/**
|
||||
Enables/disables auto-frame calculation. If enabled, the TIA
|
||||
re-adjusts the framerate at regular intervals.
|
||||
|
|
Loading…
Reference in New Issue