Skip to content

Commit

Permalink
Allow setting of post processing filter in config
Browse files Browse the repository at this point in the history
  • Loading branch information
diegolix29 committed Jan 14, 2025
1 parent 241c515 commit aff42cf
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static bool separateupdatefolder = false;
static bool compatibilityData = false;
static bool checkCompatibilityOnStartup = false;
static std::string trophyKey;
static std::string ppFilter;

// Gui
static bool load_game_size = true;
Expand Down Expand Up @@ -239,6 +240,10 @@ u32 vblankDiv() {
return vblankDivider;
}

std::string getPostProcessingFilter() {
return ppFilter;
}

bool vkValidationEnabled() {
return vkValidation;
}
Expand Down Expand Up @@ -327,6 +332,9 @@ void setVblankDiv(u32 value) {
vblankDivider = value;
}

void setPostProcessingFilter(const std::string& type) {
ppFilter = type;
}
void setIsFullscreen(bool enable) {
isFullscreen = enable;
}
Expand Down Expand Up @@ -636,6 +644,7 @@ void load(const std::filesystem::path& path) {

screenWidth = toml::find_or<int>(gpu, "screenWidth", screenWidth);
screenHeight = toml::find_or<int>(gpu, "screenHeight", screenHeight);
ppFilter = toml::find_or<std::string>(gpu, "ppFilter", "linear");
isNullGpu = toml::find_or<bool>(gpu, "nullGpu", false);
shouldCopyGPUBuffers = toml::find_or<bool>(gpu, "copyGPUBuffers", false);
shouldDumpShaders = toml::find_or<bool>(gpu, "dumpShaders", false);
Expand Down Expand Up @@ -749,6 +758,7 @@ void save(const std::filesystem::path& path) {
data["Input"]["isMotionControlsEnabled"] = isMotionControlsEnabled;
data["GPU"]["screenWidth"] = screenWidth;
data["GPU"]["screenHeight"] = screenHeight;
data["GPU"]["ppFilter"] = ppFilter;
data["GPU"]["nullGpu"] = isNullGpu;
data["GPU"]["copyGPUBuffers"] = shouldCopyGPUBuffers;
data["GPU"]["dumpShaders"] = shouldDumpShaders;
Expand Down
2 changes: 2 additions & 0 deletions src/common/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bool getIsMotionControlsEnabled();
u32 getScreenWidth();
u32 getScreenHeight();
s32 getGpuId();
std::string getPostProcessingFilter();

bool debugDump();
bool collectShadersForDebug();
Expand All @@ -65,6 +66,7 @@ void setNullGpu(bool enable);
void setCopyGPUCmdBuffers(bool enable);
void setDumpShaders(bool enable);
void setVblankDiv(u32 value);
void setPostProcessingFilter(const std::string& type);
void setGpuId(s32 selectedGpuId);
void setScreenWidth(u32 width);
void setScreenHeight(u32 height);
Expand Down
9 changes: 9 additions & 0 deletions src/qt_gui/settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ SettingsDialog::SettingsDialog(std::span<const QString> physical_devices,
ui->backButtonBehaviorComboBox->addItem(tr("Touchpad Right"), "right");
ui->backButtonBehaviorComboBox->addItem(tr("None"), "none");

ui->ppFilterComboBox->addItem(tr("Linear"), "linear");
ui->ppFilterComboBox->addItem(tr("Nearest"), "nearest");

InitializeEmulatorLanguages();
LoadValuesFromConfig();

Expand Down Expand Up @@ -302,6 +305,11 @@ void SettingsDialog::LoadValuesFromConfig() {
ui->widthSpinBox->setValue(toml::find_or<int>(data, "GPU", "screenWidth", 1280));
ui->heightSpinBox->setValue(toml::find_or<int>(data, "GPU", "screenHeight", 720));
ui->vblankSpinBox->setValue(toml::find_or<int>(data, "GPU", "vblankDivider", 1));
if (const auto i = ui->ppFilterComboBox->findData(
QString::fromStdString(toml::find_or<std::string>(data, "GPU", "ppFilter", "linear")));
i != -1) {
ui->ppFilterComboBox->setCurrentIndex(i);
}
ui->dumpShadersCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "dumpShaders", false));
ui->nullGpuCheckBox->setChecked(toml::find_or<bool>(data, "GPU", "nullGpu", false));
ui->playBGMCheckBox->setChecked(toml::find_or<bool>(data, "General", "playBGM", false));
Expand Down Expand Up @@ -568,6 +576,7 @@ void SettingsDialog::UpdateSettings() {
Config::setScreenWidth(ui->widthSpinBox->value());
Config::setScreenHeight(ui->heightSpinBox->value());
Config::setVblankDiv(ui->vblankSpinBox->value());
Config::setPostProcessingFilter(ui->ppFilterComboBox->currentData().toString().toStdString());
Config::setDumpShaders(ui->dumpShadersCheckBox->isChecked());
Config::setNullGpu(ui->nullGpuCheckBox->isChecked());
Config::setSeparateUpdateEnabled(ui->separateUpdatesCheckBox->isChecked());
Expand Down
14 changes: 13 additions & 1 deletion src/qt_gui/settings_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,18 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="ppFilterGroupBox">
<property name="title">
<string>Post-Processing Filter</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QComboBox" name="ppFilterComboBox"/>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1465,4 +1477,4 @@
</widget>
<resources/>
<connections/>
</ui>
</ui>

0 comments on commit aff42cf

Please sign in to comment.