mirror of https://github.com/stella-emu/stella.git
Properly handle TV and ystart autodetection during runtime.
This commit is contained in:
parent
adc948d806
commit
ab0e4d6bba
|
@ -60,6 +60,10 @@
|
||||||
"cstdint": "cpp",
|
"cstdint": "cpp",
|
||||||
"ostream": "cpp",
|
"ostream": "cpp",
|
||||||
"__memory": "cpp",
|
"__memory": "cpp",
|
||||||
"iosfwd": "cpp"
|
"iosfwd": "cpp",
|
||||||
|
"__hash_table": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"queue": "cpp",
|
||||||
|
"unordered_map": "cpp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "Menu.hxx"
|
#include "Menu.hxx"
|
||||||
#include "CommandMenu.hxx"
|
#include "CommandMenu.hxx"
|
||||||
#include "Serializable.hxx"
|
#include "Serializable.hxx"
|
||||||
|
#include "Serializer.hxx"
|
||||||
#include "Version.hxx"
|
#include "Version.hxx"
|
||||||
#include "TIAConstants.hxx"
|
#include "TIAConstants.hxx"
|
||||||
#include "FrameLayout.hxx"
|
#include "FrameLayout.hxx"
|
||||||
|
@ -85,6 +86,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
||||||
myDisplayFormat(""), // Unknown TV format @ start
|
myDisplayFormat(""), // Unknown TV format @ start
|
||||||
myCurrentFormat(0), // Unknown format @ start,
|
myCurrentFormat(0), // Unknown format @ start,
|
||||||
myAutodetectedYstart(0),
|
myAutodetectedYstart(0),
|
||||||
|
myYStartAutodetected(false),
|
||||||
myUserPaletteDefined(false),
|
myUserPaletteDefined(false),
|
||||||
myConsoleTiming(ConsoleTiming::ntsc),
|
myConsoleTiming(ConsoleTiming::ntsc),
|
||||||
myAudioSettings(audioSettings)
|
myAudioSettings(audioSettings)
|
||||||
|
@ -237,6 +239,21 @@ void Console::autodetectFrameLayout()
|
||||||
myOSystem.settings().setValue("fastscbios", fastscbios);
|
myOSystem.settings().setValue("fastscbios", fastscbios);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Console::redetectFrameLayout()
|
||||||
|
{
|
||||||
|
Serializer s;
|
||||||
|
|
||||||
|
myOSystem.sound().close();
|
||||||
|
save(s);
|
||||||
|
|
||||||
|
autodetectFrameLayout();
|
||||||
|
if (myYStartAutodetected) autodetectYStart();
|
||||||
|
|
||||||
|
load(s);
|
||||||
|
initializeAudio();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void Console::autodetectYStart()
|
void Console::autodetectYStart()
|
||||||
{
|
{
|
||||||
|
@ -259,6 +276,22 @@ void Console::autodetectYStart()
|
||||||
|
|
||||||
// Don't forget to reset the SC progress bars again
|
// Don't forget to reset the SC progress bars again
|
||||||
myOSystem.settings().setValue("fastscbios", fastscbios);
|
myOSystem.settings().setValue("fastscbios", fastscbios);
|
||||||
|
|
||||||
|
myYStartAutodetected = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Console::redetectYStart()
|
||||||
|
{
|
||||||
|
Serializer s;
|
||||||
|
|
||||||
|
myOSystem.sound().close();
|
||||||
|
save(s);
|
||||||
|
|
||||||
|
autodetectYStart();
|
||||||
|
|
||||||
|
load(s);
|
||||||
|
initializeAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -337,7 +370,7 @@ void Console::setFormat(uInt32 format)
|
||||||
case 0: // auto-detect
|
case 0: // auto-detect
|
||||||
{
|
{
|
||||||
string oldDisplayFormat = myDisplayFormat;
|
string oldDisplayFormat = myDisplayFormat;
|
||||||
autodetectFrameLayout();
|
redetectFrameLayout();
|
||||||
myTIA->update();
|
myTIA->update();
|
||||||
reset = oldDisplayFormat != myDisplayFormat;
|
reset = oldDisplayFormat != myDisplayFormat;
|
||||||
saveformat = "AUTO";
|
saveformat = "AUTO";
|
||||||
|
@ -639,15 +672,12 @@ void Console::changeYStart(int direction)
|
||||||
myOSystem.frameBuffer().showMessage("YStart at maximum");
|
myOSystem.frameBuffer().showMessage("YStart at maximum");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
++ystart;
|
++ystart;
|
||||||
|
myYStartAutodetected = false;
|
||||||
}
|
}
|
||||||
else if(direction == -1) // decrease YStart
|
else if(direction == -1) // decrease YStart
|
||||||
{
|
{
|
||||||
if (ystart == TIAConstants::minYStart && myAutodetectedYstart == 0) {
|
|
||||||
myOSystem.frameBuffer().showMessage("Autodetected YStart not available");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ystart == TIAConstants::minYStart-1 && myAutodetectedYstart > 0)
|
if(ystart == TIAConstants::minYStart-1 && myAutodetectedYstart > 0)
|
||||||
{
|
{
|
||||||
myOSystem.frameBuffer().showMessage("YStart at minimum");
|
myOSystem.frameBuffer().showMessage("YStart at minimum");
|
||||||
|
@ -655,14 +685,19 @@ void Console::changeYStart(int direction)
|
||||||
}
|
}
|
||||||
|
|
||||||
--ystart;
|
--ystart;
|
||||||
|
myYStartAutodetected = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ostringstream val;
|
ostringstream val;
|
||||||
val << ystart;
|
val << ystart;
|
||||||
if(ystart == TIAConstants::minYStart-1)
|
if(ystart == TIAConstants::minYStart-1) {
|
||||||
|
redetectYStart();
|
||||||
|
ystart = myAutodetectedYstart;
|
||||||
|
|
||||||
myOSystem.frameBuffer().showMessage("YStart autodetected");
|
myOSystem.frameBuffer().showMessage("YStart autodetected");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(myAutodetectedYstart > 0 && myAutodetectedYstart == ystart)
|
if(myAutodetectedYstart > 0 && myAutodetectedYstart == ystart)
|
||||||
|
@ -674,6 +709,8 @@ void Console::changeYStart(int direction)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myOSystem.frameBuffer().showMessage("YStart " + val.str());
|
myOSystem.frameBuffer().showMessage("YStart " + val.str());
|
||||||
|
|
||||||
|
myAutodetectedYstart = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
myProperties.set(Display_YStart, val.str());
|
myProperties.set(Display_YStart, val.str());
|
||||||
|
@ -739,7 +776,7 @@ void Console::setTIAProperties()
|
||||||
myTIA->setLayout(FrameLayout::pal);
|
myTIA->setLayout(FrameLayout::pal);
|
||||||
}
|
}
|
||||||
|
|
||||||
myTIA->setYStart(ystart != 0 ? ystart : myAutodetectedYstart);
|
myTIA->setYStart(myAutodetectedYstart ? myAutodetectedYstart : ystart);
|
||||||
myTIA->setHeight(height);
|
myTIA->setHeight(height);
|
||||||
|
|
||||||
myEmulationTiming.updateFrameLayout(myTIA->frameLayout());
|
myEmulationTiming.updateFrameLayout(myTIA->frameLayout());
|
||||||
|
|
|
@ -315,6 +315,16 @@ class Console : public Serializable
|
||||||
*/
|
*/
|
||||||
void autodetectYStart();
|
void autodetectYStart();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerun frame layout autodetection
|
||||||
|
*/
|
||||||
|
void redetectFrameLayout();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerun ystart autodetection.
|
||||||
|
*/
|
||||||
|
void redetectYStart();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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.
|
||||||
|
@ -409,6 +419,9 @@ class Console : public Serializable
|
||||||
// Autodetected ystart.
|
// Autodetected ystart.
|
||||||
uInt32 myAutodetectedYstart;
|
uInt32 myAutodetectedYstart;
|
||||||
|
|
||||||
|
// Is ystart currently autodetected?
|
||||||
|
bool myYStartAutodetected;
|
||||||
|
|
||||||
// Indicates whether an external palette was found and
|
// Indicates whether an external palette was found and
|
||||||
// successfully loaded
|
// successfully loaded
|
||||||
bool myUserPaletteDefined;
|
bool myUserPaletteDefined;
|
||||||
|
|
Loading…
Reference in New Issue