RSX/Qt: add more performance overlay options to the gui

This commit is contained in:
Megamouse 2018-07-21 16:16:53 +02:00
parent 451d64407b
commit eecb984689
8 changed files with 88 additions and 11 deletions

View file

@ -17,7 +17,7 @@ namespace rsx
// left, top, right, bottom
const areau padding { text_padding, text_padding - 4, text_padding, text_padding };
const positionu margin { m_margin, m_margin };
const positionu margin { m_margin_x, m_margin_y };
positionu pos;
const auto overlay_width = m_body.w + margin.x;
@ -146,9 +146,10 @@ namespace rsx
}
}
void perf_metrics_overlay::set_margin(u32 margin)
void perf_metrics_overlay::set_margins(u32 margin_x, u32 margin_y)
{
m_margin = margin;
m_margin_x = margin_x;
m_margin_y = margin_y;
if (m_is_initialised)
{

View file

@ -432,7 +432,8 @@ namespace rsx
u32 m_frames{ 0 };
std::string m_font;
u32 m_font_size;
u32 m_margin; // distance to screen borders in px
u32 m_margin_x; // horizontal distance to the screen border relative to the screen_quadrant in px
u32 m_margin_y; // vertical distance to the screen border relative to the screen_quadrant in px
f32 m_opacity; // 0..1
bool m_force_update;
@ -461,7 +462,7 @@ namespace rsx
void set_update_interval(u32 update_interval);
void set_font(std::string font);
void set_font_size(u32 font_size);
void set_margin(u32 margin);
void set_margins(u32 margin_x, u32 margin_y);
void set_opacity(f32 opacity);
void force_next_update();

View file

@ -369,7 +369,7 @@ namespace rsx
perf_overlay->set_update_interval(perf_settings.update_interval);
perf_overlay->set_font(perf_settings.font);
perf_overlay->set_font_size(perf_settings.font_size);
perf_overlay->set_margin(perf_settings.margin);
perf_overlay->set_margins(perf_settings.margin_x, perf_settings.margin_y);
perf_overlay->set_opacity(perf_settings.opacity / 100.f);
perf_overlay->init();
}

View file

@ -456,7 +456,8 @@ struct cfg_root : cfg::node
cfg::_int<4, 36> font_size{ this, "Font size (px)", 10 };
cfg::_enum<screen_quadrant> position{this, "Position", screen_quadrant::top_left};
cfg::string font{this, "Font", "n023055ms.ttf"};
cfg::_int<0, 500> margin{this, "Margin (px)", 50};
cfg::_int<0, 500> margin_x{this, "Horizontal Margin (px)", 50}; // horizontal distance to the screen border relative to the screen_quadrant in px
cfg::_int<0, 500> margin_y{this, "Vertical Margin (px)", 50}; // vertical distance to the screen border relative to the screen_quadrant in px
cfg::_int<0, 100> opacity{this, "Opacity (%)", 70};
} perf_overlay{this};

View file

@ -76,7 +76,10 @@
"perfOverlayPosition": "Sets the on-screen position (quadrant) of the perfomance overlay.",
"perfOverlayDetailLevel": "Controls the amount of information displayed on the performance overlay.",
"perfOverlayUpdateInterval": "Sets the time interval in which the performance overlay is being updated (measured in milliseconds).",
"perfOverlayFontSize": "Sets the font size of the performance overlay (measured in pixels)."
"perfOverlayFontSize": "Sets the font size of the performance overlay (measured in pixels).",
"perfOverlayOpacity": "Sets the opacity of the performance overlay (measured in %).",
"perfOverlayMarginX": "Sets the horizontal distance to the screen border relative to the screen quadrant (measured in pixels).",
"perfOverlayMarginY": "Sets the vertical distance to the screen border relative to the screen quadrant (measured in pixels)."
}
},
"gpu": {

View file

@ -83,6 +83,9 @@ public:
PerfOverlayPosition,
PerfOverlayUpdateInterval,
PerfOverlayFontSize,
PerfOverlayOpacity,
PerfOverlayMarginX,
PerfOverlayMarginY,
// Audio
AudioRenderer,
@ -271,6 +274,9 @@ private:
{ PerfOverlayPosition, { "Video", "Performance Overlay", "Position" } },
{ PerfOverlayUpdateInterval,{ "Video", "Performance Overlay", "Metrics update interval (ms)" } },
{ PerfOverlayFontSize, { "Video", "Performance Overlay", "Font size (px)" } },
{ PerfOverlayOpacity, { "Video", "Performance Overlay", "Opacity (%)" } },
{ PerfOverlayMarginX, { "Video", "Performance Overlay", "Horizontal Margin (px)" } },
{ PerfOverlayMarginY, { "Video", "Performance Overlay", "Vertical Margin (px)" } },
// Audio
{ AudioRenderer, { "Audio", "Renderer"}},

View file

@ -819,10 +819,17 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
ui->label_detail_level->setEnabled(enabled);
ui->label_update_interval->setEnabled(enabled);
ui->label_font_size->setEnabled(enabled);
ui->label_position->setEnabled(enabled);
ui->label_opacity->setEnabled(enabled);
ui->label_margin_x->setEnabled(enabled);
ui->label_margin_y->setEnabled(enabled);
ui->perfOverlayDetailLevel->setEnabled(enabled);
ui->perfOverlayPosition->setEnabled(enabled);
ui->perfOverlayUpdateInterval->setEnabled(enabled);
ui->perfOverlayFontSize->setEnabled(enabled);
ui->perfOverlayOpacity->setEnabled(enabled);
ui->perfOverlayMarginX->setEnabled(enabled);
ui->perfOverlayMarginY->setEnabled(enabled);
};
EnablePerfOverlayOptions(ui->perfOverlayEnabled->isChecked());
connect(ui->perfOverlayEnabled, &QCheckBox::clicked, EnablePerfOverlayOptions);
@ -845,6 +852,22 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
ui->label_font_size->setText(tr("Font Size: %0 px").arg(value));
});
xemu_settings->EnhanceSlider(ui->perfOverlayOpacity, emu_settings::PerfOverlayOpacity);
SubscribeTooltip(ui->perfOverlayOpacity, json_emu_overlay["perfOverlayOpacity"].toString());
ui->label_opacity->setText(tr("Opacity: %0 %").arg(ui->perfOverlayOpacity->value()));
connect(ui->perfOverlayOpacity, &QSlider::valueChanged, [this](int value)
{
ui->label_opacity->setText(tr("Opacity: %0 %").arg(value));
});
// SpinBoxes
xemu_settings->EnhanceSpinBox(ui->perfOverlayMarginX, emu_settings::PerfOverlayMarginX, "", tr("px"));
SubscribeTooltip(ui->perfOverlayMarginX, json_emu_overlay["perfOverlayMarginX"].toString());
xemu_settings->EnhanceSpinBox(ui->perfOverlayMarginY, emu_settings::PerfOverlayMarginY, "", tr("px"));
SubscribeTooltip(ui->perfOverlayMarginY, json_emu_overlay["perfOverlayMarginY"].toString());
// Global settings (gui_settings)
if (!game)
{

View file

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>752</width>
<height>519</height>
<width>703</width>
<height>482</height>
</rect>
</property>
<property name="sizePolicy">
@ -36,7 +36,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="coreTab">
<attribute name="title">
@ -1432,6 +1432,34 @@
<item>
<widget class="QComboBox" name="perfOverlayPosition"/>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_x" stretch="2,1">
<item>
<widget class="QLabel" name="label_margin_x">
<property name="text">
<string>Horizontal Margin:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="perfOverlayMarginX"/>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_margin_y" stretch="2,1">
<item>
<widget class="QLabel" name="label_margin_y">
<property name="text">
<string>Vertical Margin:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="perfOverlayMarginY"/>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_update_interval">
<property name="text">
@ -1466,6 +1494,20 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_opacity">
<property name="text">
<string>Opacity:</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="perfOverlayOpacity">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_18">
<property name="orientation">