Add Video settings.

+ F9 to cycle video modes.
This commit is contained in:
Andrea Odetti 2019-11-24 21:06:55 +00:00
parent 17b43a9ded
commit 151c6c92f9
8 changed files with 171 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include "Registry.h"
#include "SaveState.h"
#include "CPU.h"
#include "Video.h"
#include <QMessageBox>
#include <QGamepad>
@ -198,6 +199,10 @@ void getAppleWinPreferences(Preferences::Data & data)
{
data.saveState = QString::fromStdString(saveState);
}
data.videoType = GetVideoType();
data.scanLines = IsVideoStyle(VS_HALF_SCANLINES);
data.verticalBlend = IsVideoStyle(VS_COLOR_VERTICAL_BLEND);
}
void setAppleWinPreferences(const Preferences::Data & currentData, const Preferences::Data & newData)
@ -255,4 +260,22 @@ void setAppleWinPreferences(const Preferences::Data & currentData, const Prefere
Snapshot_SetFilename(name);
RegSaveString(TEXT(REG_CONFIG), REGVALUE_SAVESTATE_FILENAME, 1, name);
}
if (currentData.videoType != newData.videoType || currentData.scanLines != newData.scanLines || currentData.verticalBlend != newData.verticalBlend)
{
const VideoType_e videoType = VideoType_e(newData.videoType);
SetVideoType(videoType);
VideoStyle_e videoStyle = VS_NONE;
if (newData.scanLines)
videoStyle = VideoStyle_e(videoStyle | VS_HALF_SCANLINES);
if (newData.verticalBlend)
videoStyle = VideoStyle_e(videoStyle | VS_COLOR_VERTICAL_BLEND);
SetVideoStyle(videoStyle);
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
}
}

View file

@ -188,6 +188,10 @@ void Preferences::setData(const Data & data)
audio_latency->setValue(data.audioLatency);
silence_delay->setValue(data.silenceDelay);
volume->setValue(data.volume);
video_type->setCurrentIndex(data.videoType);
scan_lines->setChecked(data.scanLines);
vertical_blend->setChecked(data.verticalBlend);
}
Preferences::Data Preferences::getData() const
@ -218,6 +222,10 @@ Preferences::Data Preferences::getData() const
data.silenceDelay = silence_delay->value();
data.volume = volume->value();
data.videoType = video_type->currentIndex();
data.scanLines = scan_lines->isChecked();
data.verticalBlend = vertical_blend->isChecked();
return data;
}

View file

@ -30,6 +30,10 @@ public:
int silenceDelay;
int volume;
int videoType;
bool scanLines;
bool verticalBlend;
std::vector<QString> disks;
std::vector<QString> hds;

View file

@ -385,6 +385,90 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="video">
<attribute name="title">
<string>Video</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_8">
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Mode</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="video_type">
<item>
<property name="text">
<string>Monochrome (Custom)</string>
</property>
</item>
<item>
<property name="text">
<string>Color (RGB Monitor)</string>
</property>
</item>
<item>
<property name="text">
<string>Color (NTSC Monitor)</string>
</property>
</item>
<item>
<property name="text">
<string>Color TV</string>
</property>
</item>
<item>
<property name="text">
<string>B&amp;W TV</string>
</property>
</item>
<item>
<property name="text">
<string>Monochrome (Amber)</string>
</property>
</item>
<item>
<property name="text">
<string>Monochrome (Green)</string>
</property>
</item>
<item>
<property name="text">
<string>Monochtome (White)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="scan_lines">
<property name="text">
<string>50% Scan lines</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="vertical_blend">
<property name="text">
<string>Vertical blend</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="audio">
<attribute name="title">
<string>Audio</string>

View file

@ -493,3 +493,14 @@ void QApple::on_actionLoad_state_from_triggered()
}
}
}
void QApple::on_actionNext_video_mode_triggered()
{
g_eVideoType++;
if (g_eVideoType >= NUM_VIDEO_MODES)
g_eVideoType = 0;
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
}

View file

@ -64,6 +64,8 @@ private slots:
void on_actionLoad_state_from_triggered();
void on_actionNext_video_mode_triggered();
private:
// helper class to pause the emulator and restart at the end of the block

View file

@ -59,6 +59,7 @@
</property>
<addaction name="actionScreenshot"/>
<addaction name="actionBenchmark"/>
<addaction name="actionNext_video_mode"/>
</widget>
<widget class="QMenu" name="menuView">
<property name="title">
@ -219,6 +220,17 @@
<string>Load state...</string>
</property>
</action>
<action name="actionNext_video_mode">
<property name="text">
<string>Next video mode</string>
</property>
<property name="toolTip">
<string>Next video mode</string>
</property>
<property name="shortcut">
<string>F9</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>

View file

@ -501,6 +501,25 @@ void Video_ResetScreenshotCounter( const std::string & pImageName )
{
}
void VideoRedrawScreen (void)
{
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
VideoRefreshScreen( g_uVideoMode, true );
}
void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRedrawWholeScreen /* =false*/ )
{
if (bRedrawWholeScreen)
{
// uVideoModeForWholeScreen set if:
// . MODE_DEBUG : always
// . MODE_RUNNING : called from VideoRedrawScreen(), eg. during full-speed
if (bRedrawWholeScreen)
NTSC_SetVideoMode( uRedrawWholeScreenVideoMode );
NTSC_VideoRedrawWholeScreen();
}
}
static void videoCreateDIBSection()
{
const size_t size = GetFrameBufferWidth()*GetFrameBufferHeight()*sizeof(bgra_t);
@ -558,3 +577,11 @@ void VideoLoadSnapshot(YamlLoadHelper& yamlLoadHelper)
yamlLoadHelper.PopMap();
}
void Config_Save_Video()
{
REGSAVE(TEXT(REGVALUE_VIDEO_MODE) ,g_eVideoType);
REGSAVE(TEXT(REGVALUE_VIDEO_STYLE) ,g_eVideoStyle);
REGSAVE(TEXT(REGVALUE_VIDEO_MONO_COLOR),g_nMonochromeRGB);
REGSAVE(TEXT(REGVALUE_VIDEO_REFRESH_RATE), GetVideoRefreshRate());
}