add Bottom Screen Opacity in Enhancement tab

This commit is contained in:
blakdulz 2023-05-13 05:09:06 +07:00
parent 152e655fa7
commit 244b6e7d91
3 changed files with 202 additions and 163 deletions

View file

@ -22,6 +22,13 @@ ConfigureEnhancements::ConfigureEnhancements(QWidget* parent)
const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software; const bool res_scale_enabled = graphics_api != Settings::GraphicsAPI::Software;
ui->resolution_factor_combobox->setEnabled(res_scale_enabled); ui->resolution_factor_combobox->setEnabled(res_scale_enabled);
ui->custom_layout_group->setEnabled((Settings::values.layout_option.GetValue() == Settings::LayoutOption::CustomLayout));
connect(ui->layout_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) {
ui->custom_layout_group->setEnabled(ui->layout_combobox->currentIndex() == 5);
});
connect(ui->render_3d_combobox, connect(ui->render_3d_combobox,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
[this](int currentIndex) { [this](int currentIndex) {
@ -90,6 +97,7 @@ void ConfigureEnhancements::SetConfiguration() {
ui->custom_bottom_top->setValue(Settings::values.custom_bottom_top.GetValue()); ui->custom_bottom_top->setValue(Settings::values.custom_bottom_top.GetValue());
ui->custom_bottom_right->setValue(Settings::values.custom_bottom_right.GetValue()); ui->custom_bottom_right->setValue(Settings::values.custom_bottom_right.GetValue());
ui->custom_bottom_bottom->setValue(Settings::values.custom_bottom_bottom.GetValue()); ui->custom_bottom_bottom->setValue(Settings::values.custom_bottom_bottom.GetValue());
ui->custom_second_layer_opacity->setValue(Settings::values.custom_second_layer_opacity.GetValue());
ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue()); ui->toggle_dump_textures->setChecked(Settings::values.dump_textures.GetValue());
ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue()); ui->toggle_custom_textures->setChecked(Settings::values.custom_textures.GetValue());
ui->toggle_preload_textures->setChecked(Settings::values.preload_textures.GetValue()); ui->toggle_preload_textures->setChecked(Settings::values.preload_textures.GetValue());
@ -163,6 +171,7 @@ void ConfigureEnhancements::ApplyConfiguration() {
Settings::values.custom_bottom_top = ui->custom_bottom_top->value(); Settings::values.custom_bottom_top = ui->custom_bottom_top->value();
Settings::values.custom_bottom_right = ui->custom_bottom_right->value(); Settings::values.custom_bottom_right = ui->custom_bottom_right->value();
Settings::values.custom_bottom_bottom = ui->custom_bottom_bottom->value(); Settings::values.custom_bottom_bottom = ui->custom_bottom_bottom->value();
Settings::values.custom_second_layer_opacity = ui->custom_second_layer_opacity->value();
ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode, ConfigurationShared::ApplyPerGameSetting(&Settings::values.filter_mode,
ui->toggle_linear_filter, linear_filter); ui->toggle_linear_filter, linear_filter);

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>440</width> <width>440</width>
<height>748</height> <height>950</height>
</rect> </rect>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
@ -430,7 +430,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="label_31"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Large Screen Proportion:</string> <string>Large Screen Proportion:</string>
</property> </property>
@ -488,7 +488,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="gb_custom_layout"> <widget class="QGroupBox" name="custom_layout_group">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
@ -498,166 +498,194 @@
<property name="title"> <property name="title">
<string>Custom Layout</string> <string>Custom Layout</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_5">
<item> <item>
<widget class="QGroupBox" name="gb_top_screen"> <layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="title"> <item>
<string>Top Screen</string> <widget class="QGroupBox" name="gb_top_screen">
</property> <property name="title">
<layout class="QGridLayout" name="gridLayout_2"> <string>Top Screen</string>
<item row="0" column="0"> </property>
<widget class="QLabel" name="lb_top_left"> <layout class="QGridLayout" name="gridLayout_2">
<property name="text"> <item row="0" column="0">
<string>Left</string> <widget class="QLabel" name="lb_top_left">
</property> <property name="text">
</widget> <string>Left</string>
</item> </property>
<item row="0" column="1"> </widget>
<widget class="QSpinBox" name="custom_top_left"> </item>
<property name="buttonSymbols"> <item row="0" column="1">
<enum>QAbstractSpinBox::NoButtons</enum> <widget class="QSpinBox" name="custom_top_left">
</property> <property name="buttonSymbols">
<property name="maximum"> <enum>QAbstractSpinBox::NoButtons</enum>
<number>2147483647</number> </property>
</property> <property name="maximum">
</widget> <number>2147483647</number>
</item> </property>
<item row="1" column="0"> </widget>
<widget class="QLabel" name="lb_top_top"> </item>
<property name="text"> <item row="1" column="0">
<string>Top</string> <widget class="QLabel" name="lb_top_top">
</property> <property name="text">
</widget> <string>Top</string>
</item> </property>
<item row="1" column="1"> </widget>
<widget class="QSpinBox" name="custom_top_top"> </item>
<property name="buttonSymbols"> <item row="1" column="1">
<enum>QAbstractSpinBox::NoButtons</enum> <widget class="QSpinBox" name="custom_top_top">
</property> <property name="buttonSymbols">
<property name="maximum"> <enum>QAbstractSpinBox::NoButtons</enum>
<number>2147483647</number> </property>
</property> <property name="maximum">
</widget> <number>2147483647</number>
</item> </property>
<item row="2" column="0"> </widget>
<widget class="QLabel" name="lb_top_right"> </item>
<property name="text"> <item row="2" column="0">
<string>Right</string> <widget class="QLabel" name="lb_top_right">
</property> <property name="text">
</widget> <string>Right</string>
</item> </property>
<item row="2" column="1"> </widget>
<widget class="QSpinBox" name="custom_top_right"> </item>
<property name="buttonSymbols"> <item row="2" column="1">
<enum>QAbstractSpinBox::NoButtons</enum> <widget class="QSpinBox" name="custom_top_right">
</property> <property name="buttonSymbols">
<property name="maximum"> <enum>QAbstractSpinBox::NoButtons</enum>
<number>2147483647</number> </property>
</property> <property name="maximum">
</widget> <number>2147483647</number>
</item> </property>
<item row="3" column="0"> </widget>
<widget class="QLabel" name="lb_top_bottom"> </item>
<property name="text"> <item row="3" column="0">
<string>Bottom</string> <widget class="QLabel" name="lb_top_bottom">
</property> <property name="text">
</widget> <string>Bottom</string>
</item> </property>
<item row="3" column="1"> </widget>
<widget class="QSpinBox" name="custom_top_bottom"> </item>
<property name="buttonSymbols"> <item row="3" column="1">
<enum>QAbstractSpinBox::NoButtons</enum> <widget class="QSpinBox" name="custom_top_bottom">
</property> <property name="buttonSymbols">
<property name="maximum"> <enum>QAbstractSpinBox::NoButtons</enum>
<number>2147483647</number> </property>
</property> <property name="maximum">
</widget> <number>2147483647</number>
</item> </property>
</layout> </widget>
</widget> </item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="gb_bottom_screen">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title">
<string>Bottom Screen</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="lb_bottom_left">
<property name="text">
<string>Left</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="custom_bottom_left">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_bottom_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_bottom_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_bottom_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_bottom_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_bottom_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_bottom_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="gb_bottom_screen"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="minimumSize"> <item>
<size> <widget class="QLabel" name="lb_opacity_second_layer">
<width>0</width> <property name="text">
<height>0</height> <string>Bottom Screen Opacity:</string>
</size> </property>
</property> </widget>
<property name="title"> </item>
<string>Bottom Screen</string> <item>
</property> <widget class="QSpinBox" name="custom_second_layer_opacity">
<layout class="QGridLayout" name="gridLayout"> <property name="buttonSymbols">
<item row="0" column="0"> <enum>QAbstractSpinBox::PlusMinus</enum>
<widget class="QLabel" name="lb_bottom_left"> </property>
<property name="text"> <property name="minimum">
<string>Left</string> <number>10</number>
</property> </property>
</widget> <property name="maximum">
</item> <number>100</number>
<item row="0" column="1"> </property>
<widget class="QSpinBox" name="custom_bottom_left"> </widget>
<property name="buttonSymbols"> </item>
<enum>QAbstractSpinBox::NoButtons</enum> </layout>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lb_bottom_top">
<property name="text">
<string>Top</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="custom_bottom_top">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="lb_bottom_right">
<property name="text">
<string>Right</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="custom_bottom_right">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="lb_bottom_bottom">
<property name="text">
<string>Bottom</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QSpinBox" name="custom_bottom_bottom">
<property name="buttonSymbols">
<enum>QAbstractSpinBox::NoButtons</enum>
</property>
<property name="maximum">
<number>2147483647</number>
</property>
</widget>
</item>
</layout>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>
@ -739,4 +767,4 @@
</tabstops> </tabstops>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

View file

@ -946,7 +946,8 @@ void RendererOpenGL::DrawScreens(const Layout::FramebufferLayout& layout, bool f
} }
void RendererOpenGL::ApplySecondLayerOpacity() { void RendererOpenGL::ApplySecondLayerOpacity() {
if (Settings::values.custom_layout && if ((Settings::values.layout_option.GetValue() == Settings::LayoutOption::CustomLayout ||
Settings::values.custom_layout) &&
Settings::values.custom_second_layer_opacity.GetValue() < 100) { Settings::values.custom_second_layer_opacity.GetValue() < 100) {
state.blend.src_rgb_func = GL_CONSTANT_ALPHA; state.blend.src_rgb_func = GL_CONSTANT_ALPHA;
state.blend.src_a_func = GL_CONSTANT_ALPHA; state.blend.src_a_func = GL_CONSTANT_ALPHA;
@ -957,7 +958,8 @@ void RendererOpenGL::ApplySecondLayerOpacity() {
} }
void RendererOpenGL::ResetSecondLayerOpacity() { void RendererOpenGL::ResetSecondLayerOpacity() {
if (Settings::values.custom_layout && if ((Settings::values.layout_option.GetValue() == Settings::LayoutOption::CustomLayout ||
Settings::values.custom_layout) &&
Settings::values.custom_second_layer_opacity.GetValue() < 100) { Settings::values.custom_second_layer_opacity.GetValue() < 100) {
state.blend.src_rgb_func = GL_ONE; state.blend.src_rgb_func = GL_ONE;
state.blend.dst_rgb_func = GL_ZERO; state.blend.dst_rgb_func = GL_ZERO;