Added Scanlines support

This commit is contained in:
Dimitris Panokostas 2018-12-01 12:28:07 +01:00
parent 1a6238319c
commit 510f801550
2 changed files with 82 additions and 21 deletions

View file

@ -205,24 +205,30 @@ static NavigationMap navMap[] =
{ "cboCD", "Hard drives/CD", "Hard drives/CD", "CD drive", "CDVol" },
{ "CDVol", "", "", "cboCD", "cmdProp0" },
// active move left move right move up move down
// PanelDisplay
{ "sldWidth", "", "", "Frameskip", "sldHeight" },
{ "sldHeight", "", "", "sldWidth", "sldVertPos" },
#ifdef USE_SDL1
{ "sldVertPos", "", "", "sldHeight", "CorrectAR" },
{ "CorrectAR", "Display", "Fullscreen", "sldVertPos", "Line doubling" },
{ "sldVertPos", "", "", "sldHeight", "Single" },
{ "Single", "Display", "Display", "sdlVertPos", "Double" },
{ "Double", "Display", "Display", "Single", "Scanlines" },
{ "Scanlines", "Display", "Display", "Double", "Fullscreen" },
{ "CorrectAR", "Display", "Fullscreen", "Scanlines", "Frameskip" },
#elif USE_SDL2
{ "sldVertPos", "", "", "sldHeight", "Auto" },
{ "Auto", "Display", "Display", "sldVertPos", "Nearest Neighbor (pixelated)" },
{ "Nearest Neighbor (pixelated)","Display","Display", "Auto", "Linear (smooth)" },
{ "Linear (smooth)", "Display", "Display", "Nearest Neighbor (pixelated)", "CorrectAR" },
{ "CorrectAR", "Display", "Fullscreen", "Linear (smooth)","Line doubling" },
{ "sldVertPos", "", "", "sldHeight", "Auto" },
{ "Auto", "Display", "Single", "sldVertPos", "Nearest Neighbor (pixelated)" },
{ "Nearest Neighbor (pixelated)","Display","Double", "Auto", "Linear (smooth)" },
{ "Linear (smooth)","Display", "Scanlines", "Nearest Neighbor (pixelated)", "CorrectAR" },
{ "Single", "Auto", "Auto", "sdlVertPos", "Double" },
{ "Double", "Nearest Neighbor (pixelated)", "Nearest Neighbor (pixelated)", "Single", "Scanlines" },
{ "Scanlines", "Linear (smooth)", "Linear (smooth)", "Double", "Fullscreen" },
{ "CorrectAR", "Display", "Fullscreen", "Linear (smooth)", "Frameskip" },
#endif
{ "Fullscreen", "CorrectAR", "CorrectAR", "Linear (smooth)","Line doubling" },
{ "Line doubling", "Display", "Display", "CorrectAR", "Frameskip" },
{ "Frameskip", "Display", "Display", "Line doubling", "sldWidth" },
{ "Fullscreen", "CorrectAR", "CorrectAR", "Scanlines", "Frameskip" },
{ "Frameskip", "Display", "Display", "CorrectAR", "sldWidth" },
// active move left move right move up move down
//PanelSound
{ "sndDisable", "Sound", "Mono", "sldStereoDelay", "sndDisEmu" },
{ "sndDisEmu", "Sound", "Stereo", "sndDisable", "sndEmulate" },

View file

@ -34,6 +34,11 @@ static gcn::UaeRadioButton* optNearest;
static gcn::UaeRadioButton* optLinear;
#endif
static gcn::Window* grpLineMode;
static gcn::UaeRadioButton* optSingle;
static gcn::UaeRadioButton* optDouble;
static gcn::UaeRadioButton* optScanlines;
static gcn::Window *grpAmigaScreen;
static gcn::Label* lblAmigaWidth;
static gcn::Label* lblAmigaWidthInfo;
@ -46,7 +51,6 @@ static gcn::Label* lblVertPos;
static gcn::Label* lblVertPosInfo;
static gcn::Slider* sldVertPos;
static gcn::UaeCheckBox* chkLineDbl;
static gcn::UaeCheckBox* chkFrameskip;
static gcn::UaeCheckBox* chkAspect;
static gcn::UaeCheckBox* chkFullscreen;
@ -83,9 +87,6 @@ public:
else if (actionEvent.getSource() == chkFrameskip)
changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0;
else if (actionEvent.getSource() == chkLineDbl)
changed_prefs.gfx_vresolution = chkLineDbl->isSelected() ? VRES_DOUBLE : VRES_NONDOUBLE;
else if (actionEvent.getSource() == chkAspect)
changed_prefs.gfx_correct_aspect = chkAspect->isSelected();
@ -125,6 +126,31 @@ public:
static ScalingMethodActionListener* scalingMethodActionListener;
#endif
class LineModeActionListener : public gcn::ActionListener
{
public:
void action(const gcn::ActionEvent& action_event) override
{
if (action_event.getSource() == optSingle)
{
changed_prefs.gfx_vresolution = VRES_NONDOUBLE;
changed_prefs.gfx_pscanlines = 0;
}
else if (action_event.getSource() == optDouble)
{
changed_prefs.gfx_vresolution = VRES_DOUBLE;
changed_prefs.gfx_pscanlines = 0;
}
else if (action_event.getSource() == optScanlines)
{
changed_prefs.gfx_vresolution = VRES_DOUBLE;
changed_prefs.gfx_pscanlines = 1;
}
}
};
static LineModeActionListener* lineModeActionListener;
void InitPanelDisplay(const struct _ConfigCategory& category)
{
amigaScreenActionListener = new AmigaScreenActionListener();
@ -167,8 +193,6 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
chkAspect->setId("CorrectAR");
chkAspect->addActionListener(amigaScreenActionListener);
chkLineDbl = new gcn::UaeCheckBox("Line doubling");
chkLineDbl->addActionListener(amigaScreenActionListener);
chkFrameskip = new gcn::UaeCheckBox("Frameskip");
chkFrameskip->addActionListener(amigaScreenActionListener);
@ -225,12 +249,36 @@ void InitPanelDisplay(const struct _ConfigCategory& category)
posY += DISTANCE_BORDER + grpScalingMethod->getHeight() + DISTANCE_NEXT_Y;
#endif
lineModeActionListener = new LineModeActionListener();
optSingle = new gcn::UaeRadioButton("Single", "linemodegroup");
optSingle->addActionListener(lineModeActionListener);
optDouble = new gcn::UaeRadioButton("Double", "linemodegroup");
optDouble->addActionListener(lineModeActionListener);
optScanlines = new gcn::UaeRadioButton("Scanlines", "linemodegroup");
optScanlines->addActionListener(lineModeActionListener);
grpLineMode = new gcn::Window("Line mode");
#ifdef USE_SDL2
grpLineMode->setPosition(
grpScalingMethod->getWidth() + DISTANCE_BORDER + DISTANCE_NEXT_X,
posY - DISTANCE_BORDER - grpScalingMethod->getHeight() - DISTANCE_NEXT_Y);
#else
grpLineMode->setPosition(DISTANCE_BORDER, posY);
#endif
grpLineMode->add(optSingle, 5, 10);
grpLineMode->add(optDouble, 5, 40);
grpLineMode->add(optScanlines, 5, 70);
grpLineMode->setMovable(false);
grpLineMode->setSize(optScanlines->getWidth() + DISTANCE_BORDER, optScanlines->getY() + optScanlines->getHeight() + 30);
grpLineMode->setBaseColor(gui_baseCol);
category.panel->add(grpLineMode);
category.panel->add(chkAspect, DISTANCE_BORDER, posY);
category.panel->add(chkFullscreen, chkAspect->getX() + chkAspect->getWidth() + DISTANCE_NEXT_X * 2, posY);
posY += chkAspect->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkLineDbl, DISTANCE_BORDER, posY);
posY += chkLineDbl->getHeight() + DISTANCE_NEXT_Y;
category.panel->add(chkFrameskip, DISTANCE_BORDER, posY);
RefreshPanelDisplay();
@ -260,6 +308,7 @@ void ExitPanelDisplay()
delete optNearest;
delete optLinear;
delete grpScalingMethod;
delete grpLineMode;
delete scalingMethodActionListener;
#endif
}
@ -267,7 +316,6 @@ void ExitPanelDisplay()
void RefreshPanelDisplay()
{
chkLineDbl->setSelected(changed_prefs.gfx_vresolution == VRES_DOUBLE);
chkFrameskip->setSelected(changed_prefs.gfx_framerate);
int i;
@ -307,6 +355,13 @@ void RefreshPanelDisplay()
optLinear->setSelected(true);
#endif
if (changed_prefs.gfx_vresolution == VRES_NONDOUBLE && changed_prefs.gfx_pscanlines == 0)
optSingle->setSelected(true);
else if (changed_prefs.gfx_vresolution == VRES_DOUBLE && changed_prefs.gfx_pscanlines == 0)
optDouble->setSelected(true);
else if (changed_prefs.gfx_vresolution == VRES_DOUBLE && changed_prefs.gfx_pscanlines == 1)
optScanlines->setSelected(true);
sldVertPos->setValue(changed_prefs.vertical_offset - OFFSET_Y_ADJUST);
snprintf(tmp, 32, "%d", changed_prefs.vertical_offset - OFFSET_Y_ADJUST);
lblVertPosInfo->setCaption(tmp);
@ -329,7 +384,7 @@ bool HelpPanelDisplay(std::vector<std::string> &helptext)
helptext.emplace_back("With \"Vert. offset\" you can adjust the position of the first drawn line of the Amiga ");
helptext.emplace_back("screen.");
helptext.emplace_back("");
helptext.emplace_back("Activate line doubling to remove flicker in interlace modes.");
helptext.emplace_back("Activate line doubling to remove flicker in interlace modes, or Scanlines for the CRT effect.");
helptext.emplace_back("");
helptext.emplace_back("When you activate \"Frameskip\", only every second frame is drawn.");
helptext.emplace_back("This will improve performance and some more games are playable.");