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",
|
||||
"ostream": "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 "CommandMenu.hxx"
|
||||
#include "Serializable.hxx"
|
||||
#include "Serializer.hxx"
|
||||
#include "Version.hxx"
|
||||
#include "TIAConstants.hxx"
|
||||
#include "FrameLayout.hxx"
|
||||
|
@ -85,6 +86,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
|
|||
myDisplayFormat(""), // Unknown TV format @ start
|
||||
myCurrentFormat(0), // Unknown format @ start,
|
||||
myAutodetectedYstart(0),
|
||||
myYStartAutodetected(false),
|
||||
myUserPaletteDefined(false),
|
||||
myConsoleTiming(ConsoleTiming::ntsc),
|
||||
myAudioSettings(audioSettings)
|
||||
|
@ -237,6 +239,21 @@ void Console::autodetectFrameLayout()
|
|||
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()
|
||||
{
|
||||
|
@ -259,6 +276,22 @@ void Console::autodetectYStart()
|
|||
|
||||
// Don't forget to reset the SC progress bars again
|
||||
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
|
||||
{
|
||||
string oldDisplayFormat = myDisplayFormat;
|
||||
autodetectFrameLayout();
|
||||
redetectFrameLayout();
|
||||
myTIA->update();
|
||||
reset = oldDisplayFormat != myDisplayFormat;
|
||||
saveformat = "AUTO";
|
||||
|
@ -639,15 +672,12 @@ void Console::changeYStart(int direction)
|
|||
myOSystem.frameBuffer().showMessage("YStart at maximum");
|
||||
return;
|
||||
}
|
||||
|
||||
++ystart;
|
||||
myYStartAutodetected = false;
|
||||
}
|
||||
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)
|
||||
{
|
||||
myOSystem.frameBuffer().showMessage("YStart at minimum");
|
||||
|
@ -655,14 +685,19 @@ void Console::changeYStart(int direction)
|
|||
}
|
||||
|
||||
--ystart;
|
||||
myYStartAutodetected = false;
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
ostringstream val;
|
||||
val << ystart;
|
||||
if(ystart == TIAConstants::minYStart-1)
|
||||
if(ystart == TIAConstants::minYStart-1) {
|
||||
redetectYStart();
|
||||
ystart = myAutodetectedYstart;
|
||||
|
||||
myOSystem.frameBuffer().showMessage("YStart autodetected");
|
||||
}
|
||||
else
|
||||
{
|
||||
if(myAutodetectedYstart > 0 && myAutodetectedYstart == ystart)
|
||||
|
@ -674,6 +709,8 @@ void Console::changeYStart(int direction)
|
|||
}
|
||||
else
|
||||
myOSystem.frameBuffer().showMessage("YStart " + val.str());
|
||||
|
||||
myAutodetectedYstart = false;
|
||||
}
|
||||
|
||||
myProperties.set(Display_YStart, val.str());
|
||||
|
@ -739,7 +776,7 @@ void Console::setTIAProperties()
|
|||
myTIA->setLayout(FrameLayout::pal);
|
||||
}
|
||||
|
||||
myTIA->setYStart(ystart != 0 ? ystart : myAutodetectedYstart);
|
||||
myTIA->setYStart(myAutodetectedYstart ? myAutodetectedYstart : ystart);
|
||||
myTIA->setHeight(height);
|
||||
|
||||
myEmulationTiming.updateFrameLayout(myTIA->frameLayout());
|
||||
|
|
|
@ -315,6 +315,16 @@ class Console : public Serializable
|
|||
*/
|
||||
void autodetectYStart();
|
||||
|
||||
/**
|
||||
* Rerun frame layout autodetection
|
||||
*/
|
||||
void redetectFrameLayout();
|
||||
|
||||
/**
|
||||
* Rerun ystart autodetection.
|
||||
*/
|
||||
void redetectYStart();
|
||||
|
||||
/**
|
||||
Sets various properties of the TIA (YStart, Height, etc) based on
|
||||
the current display format.
|
||||
|
@ -409,6 +419,9 @@ class Console : public Serializable
|
|||
// Autodetected ystart.
|
||||
uInt32 myAutodetectedYstart;
|
||||
|
||||
// Is ystart currently autodetected?
|
||||
bool myYStartAutodetected;
|
||||
|
||||
// Indicates whether an external palette was found and
|
||||
// successfully loaded
|
||||
bool myUserPaletteDefined;
|
||||
|
|
Loading…
Reference in New Issue