First pass at converting part of 'ystart' to 'vcenter'.

The logic here is somewhat convoluted.  I suggest renaming 'ystart' to 'startline',
and having it internal to TIA only.  The 'vcenter' option will then modify that value
from certain default constants (for NTSC and PAL).
This commit is contained in:
Stephen Anthony 2019-12-16 23:26:57 -03:30
parent c2fc39f44d
commit fd136e0d49
11 changed files with 33 additions and 33 deletions

View File

@ -431,8 +431,8 @@ PhysicalKeyboardHandler::EventMappingArray PhysicalKeyboardHandler::DefaultCommo
{Event::VidmodeDecrease, KBDK_MINUS, MOD3},
{Event::VidmodeIncrease, KBDK_EQUALS, MOD3},
{Event::YStartDecrease, KBDK_PAGEDOWN, MOD3},
{Event::YStartIncrease, KBDK_PAGEUP, MOD3},
{Event::VCenterDecrease, KBDK_PAGEDOWN, MOD3},
{Event::VCenterIncrease, KBDK_PAGEUP, MOD3},
{Event::VolumeDecrease, KBDK_LEFTBRACKET, MOD3},
{Event::VolumeIncrease, KBDK_RIGHTBRACKET, MOD3},
{Event::SoundToggle, KBDK_RIGHTBRACKET, KBDM_CTRL},

View File

@ -151,7 +151,7 @@ Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,
}
}
if (atoi(myProperties.get(PropType::Display_YStart).c_str()) == 0) {
if (atoi(myProperties.get(PropType::Display_VCenter).c_str()) == 0) {
autodetectYStart();
}
@ -679,7 +679,7 @@ void Console::fry() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::changeYStart(int direction)
void Console::changeVerticalCenter(int direction)
{
uInt32 ystart = myTIA->ystart();
@ -711,7 +711,7 @@ void Console::changeYStart(int direction)
ostringstream ss;
ss << ystart;
myProperties.set(PropType::Display_YStart, ss.str());
myProperties.set(PropType::Display_VCenter, ss.str());
if (ystart != myTIA->ystart()) myTIA->setYStart(ystart);
// use vertical center instead of y-start for display
@ -743,7 +743,7 @@ void Console::updateYStart(uInt32 ystart)
void Console::setTIAProperties()
{
// FIXME - ystart is probably disappearing soon, or at least autodetection is
uInt32 ystart = atoi(myProperties.get(PropType::Display_YStart).c_str());
uInt32 ystart = atoi(myProperties.get(PropType::Display_VCenter).c_str());
if(ystart != 0)
ystart = BSPF::clamp(ystart, 0u, TIAConstants::maxYStart);
else {

View File

@ -256,11 +256,11 @@ class Console : public Serializable, public ConsoleIO
void fry() const;
/**
Change the "Display.YStart" variable.
Change the "Display.VCenter" variable.
@param direction +1 indicates increase, -1 indicates decrease.
*/
void changeYStart(int direction);
void changeVerticalCenter(int direction);
/**
Returns the current framerate.

View File

@ -83,7 +83,7 @@ class Event
ToggleFullScreen,
VidmodeStd, VidmodeRGB, VidmodeSVideo, VidModeComposite, VidModeBad, VidModeCustom,
PreviousAttribute, NextAttribute, DecreaseAttribute, IncreaseAttribute,
ScanlinesDecrease, ScanlinesIncrease,
ScanlinesDecrease, ScanlinesIncrease, VCenterDecrease, VCenterIncrease,
ToggleP0Collision, ToggleP0Bit, ToggleP1Collision, ToggleP1Bit,
ToggleM0Collision, ToggleM0Bit, ToggleM1Collision, ToggleM1Bit,
@ -120,8 +120,6 @@ class Event
CompuMateQuote, CompuMateBackspace, CompuMateEquals, CompuMatePlus,
CompuMateSlash,
YStartDecrease, YStartIncrease,
LastType
};

View File

@ -419,12 +419,12 @@ void EventHandler::handleEvent(Event::Type event, Int32 value, bool repeated)
if(pressed) myOSystem.frameBuffer().changeVidMode(+1);
return;
case Event::YStartDecrease:
if (pressed) myOSystem.console().changeYStart(-1);
case Event::VCenterDecrease:
if (pressed) myOSystem.console().changeVerticalCenter(-1);
return;
case Event::YStartIncrease:
if (pressed) myOSystem.console().changeYStart(+1);
case Event::VCenterIncrease:
if (pressed) myOSystem.console().changeVerticalCenter(+1);
return;
case Event::ToggleFullScreen:
@ -1830,8 +1830,8 @@ EventHandler::EmulActionList EventHandler::ourEmulActionList = { {
{ Event::ToggleFullScreen, "Toggle fullscreen", "" },
{ Event::OverscanDecrease, "Decrease overscan in fullscreen mode", "" },
{ Event::OverscanIncrease, "Increase overscan in fullscreen mode", "" },
{ Event::YStartIncrease, "Move display up", "" },
{ Event::YStartDecrease, "Move display down", "" },
{ Event::VCenterIncrease, "Move display up", "" },
{ Event::VCenterDecrease, "Move display down", "" },
{ Event::FormatDecrease, "Decrease display format", "" },
{ Event::FormatIncrease, "Increase display format", "" },
{ Event::TogglePalette, "Switch palette (Standard/Z26/User)", "" },
@ -1959,7 +1959,7 @@ const Event::EventSet EventHandler::AudioVideoEvents = {
Event::ScanlinesDecrease, Event::ScanlinesIncrease,
Event::PhosphorDecrease, Event::PhosphorIncrease, Event::TogglePhosphor,
Event::FormatDecrease, Event::FormatIncrease,
Event::YStartDecrease, Event::YStartIncrease,
Event::VCenterDecrease, Event::VCenterIncrease,
Event::OverscanDecrease, Event::OverscanIncrease,
Event::TogglePalette,
};

View File

@ -587,7 +587,7 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile, string&
CMDLINE_PROPS_UPDATE("rd", PropType::Console_RightDiff);
CMDLINE_PROPS_UPDATE("tv", PropType::Console_TVType);
CMDLINE_PROPS_UPDATE("format", PropType::Display_Format);
CMDLINE_PROPS_UPDATE("ystart", PropType::Display_YStart);
CMDLINE_PROPS_UPDATE("ystart", PropType::Display_VCenter); // TODO (SA): change option
CMDLINE_PROPS_UPDATE("pp", PropType::Display_Phosphor);
CMDLINE_PROPS_UPDATE("ppblend", PropType::Display_PPBlend);

View File

@ -253,7 +253,7 @@ void Properties::print() const
<< get(PropType::Controller_SwapPaddles) << "|"
<< get(PropType::Controller_MouseAxis) << "|"
<< get(PropType::Display_Format) << "|"
<< get(PropType::Display_YStart) << "|"
<< get(PropType::Display_VCenter) << "|"
<< get(PropType::Display_Phosphor) << "|"
<< get(PropType::Display_PPBlend)
<< endl;
@ -298,7 +298,7 @@ void Properties::printHeader()
<< "Controller_SwapPaddles|"
<< "Controller_MouseAxis|"
<< "Display_Format|"
<< "Display_YStart|"
<< "Display_VCenter|"
<< "Display_Phosphor|"
<< "Display_PPBlend"
<< endl;
@ -325,7 +325,7 @@ string Properties::ourDefaultProperties[static_cast<uInt8>(PropType::NumTypes)]
"NO", // Controller.SwapPaddles
"AUTO", // Controller.MouseAxis
"AUTO", // Display.Format
"0", // Display.YStart
"0", // Display.VCenter
"NO", // Display.Phosphor
"0" // Display.PPBlend
};
@ -351,7 +351,7 @@ const char* const Properties::ourPropertyNames[static_cast<uInt8>(PropType::NumT
"Controller.SwapPaddles",
"Controller.MouseAxis",
"Display.Format",
"Display.YStart",
"Display.VCenter",
"Display.Phosphor",
"Display.PPBlend"
};

View File

@ -39,7 +39,7 @@ enum class PropType : uInt8 {
Controller_SwapPaddles,
Controller_MouseAxis,
Display_Format,
Display_YStart,
Display_VCenter,
Display_Phosphor,
Display_PPBlend,
NumTypes

View File

@ -137,7 +137,8 @@ GameInfoDialog::GameInfoDialog(
ypos += lineHeight + VGAP;
t = new StaticTextWidget(myTab, font, HBORDER, ypos + 1, "V-Center ");
myVCenter = new SliderWidget(myTab, font, t->getRight() + 2, ypos,
"", 0, kYStartChanged, 7 * fontWidth, "px");
"", 0, kVCenterChanged, 7 * fontWidth, "px");
// TODO (SA):check relationship of ystart and vcenter
myVCenter->setMinValue(TIAConstants::minYStart - TIAConstants::defaultYStart);
myVCenter->setMaxValue(TIAConstants::maxYStart - TIAConstants::defaultYStart);
myVCenter->setTickmarkIntervals(4);
@ -456,11 +457,12 @@ void GameInfoDialog::loadEmulationProperties(const Properties& props)
const string& blend = props.get(PropType::Display_PPBlend);
myPPBlend->setValue(atoi(blend.c_str()));
// set vertical center (y-start)
int vCenter = atoi(props.get(PropType::Display_YStart).c_str());
// set vertical center
int vCenter = atoi(props.get(PropType::Display_VCenter).c_str());
if (vCenter)
{
// convert y-start into v-center
// TODO (SA): fix this
vCenter = TIAConstants::defaultYStart - vCenter;
myVCenter->setValueLabel(vCenter);
}
@ -548,9 +550,9 @@ void GameInfoDialog::saveConfig()
myPPBlend->getValueLabel());
int vCenter = myVCenter->getValue();
if (vCenter)
// convert v-center into y-start
// convert v-center into y-start TODO (SA): fix this
vCenter = TIAConstants::defaultYStart - vCenter;
myGameProperties.set(PropType::Display_YStart, std::to_string(vCenter));
myGameProperties.set(PropType::Display_VCenter, std::to_string(vCenter));
myGameProperties.set(PropType::Cart_Sound, mySound->getState() ? "STEREO" : "MONO");
// Console properties
@ -792,7 +794,7 @@ void GameInfoDialog::handleCommand(CommandSender* sender, int cmd,
myPPBlend->setValueUnit("%");
break;
case kYStartChanged:
case kVCenterChanged:
if (myVCenter->getValue() == 0)
{
myVCenter->setValueLabel("Default");

View File

@ -103,7 +103,7 @@ class GameInfoDialog : public Dialog, public CommandSender
EditTextWidget* myNote;
enum {
kYStartChanged = 'YSch',
kVCenterChanged = 'Vcch',
kPhosphorChanged = 'PPch',
kPPBlendChanged = 'PBch',
kLeftCChanged = 'LCch',

View File

@ -21,7 +21,7 @@ my %prop_type = (
"Controller.SwapPaddles" => 15,
"Controller.MouseAxis" => 16,
"Display.Format" => 17,
"Display.YStart" => 18,
"Display.VCenter" => 18,
"Display.Phosphor" => 19,
"Display.PPBlend" => 20
);
@ -44,7 +44,7 @@ my @prop_type_as_string = (
"Controller.SwapPaddles",
"Controller.MouseAxis",
"Display.Format",
"Display.YStart",
"Display.VCenter",
"Display.Phosphor",
"Display.PPBlend"
);