Qt: Add texture replacement settings dialog
This commit is contained in:
parent
9d3ed39432
commit
df6aab2163
|
@ -131,6 +131,9 @@ set(SRCS
|
|||
settingsdialog.h
|
||||
settingsdialog.ui
|
||||
settingwidgetbinder.h
|
||||
texturereplacementssettingswidget.cpp
|
||||
texturereplacementssettingswidget.h
|
||||
texturereplacementssettingswidget.ui
|
||||
)
|
||||
|
||||
if(ENABLE_CHEEVOS)
|
||||
|
|
|
@ -258,21 +258,6 @@ void AdvancedSettingsWidget::addTweakOptions()
|
|||
Settings::GetCPUFastmemModeDisplayName, "CPUFastmemMode",
|
||||
static_cast<u32>(CPUFastmemMode::Count), Settings::DEFAULT_CPU_FASTMEM_MODE);
|
||||
|
||||
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Enable VRAM Write Texture Replacement"),
|
||||
"TextureReplacements", "EnableVRAMWriteReplacements", false);
|
||||
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Preload Texture Replacements"), "TextureReplacements",
|
||||
"PreloadTextures", false);
|
||||
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Dump Replaceable VRAM Writes"), "TextureReplacements",
|
||||
"DumpVRAMWrites", false);
|
||||
addBooleanTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Set Dumped VRAM Write Alpha Channel"),
|
||||
"TextureReplacements", "DumpVRAMWriteForceAlphaChannel", true);
|
||||
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Width"), "TextureReplacements",
|
||||
"DumpVRAMWriteWidthThreshold", 1, VRAM_WIDTH,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
|
||||
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("Minimum Dumped VRAM Write Height"), "TextureReplacements",
|
||||
"DumpVRAMWriteHeightThreshold", 1, VRAM_HEIGHT,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
|
||||
|
||||
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("DMA Max Slice Ticks"), "Hacks", "DMAMaxSliceTicks", 100,
|
||||
10000, Settings::DEFAULT_DMA_MAX_SLICE_TICKS);
|
||||
addIntRangeTweakOption(m_dialog, m_ui.tweakOptionTable, tr("DMA Halt Ticks"), "Hacks", "DMAHaltTicks", 100, 10000,
|
||||
|
@ -313,14 +298,6 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
|
|||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Recompiler memory exceptions
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, true); // Recompiler block linking
|
||||
setChoiceTweakOption(m_ui.tweakOptionTable, i++, Settings::DEFAULT_CPU_FASTMEM_MODE); // Recompiler fastmem mode
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // VRAM write texture replacement
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Preload texture replacements
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Dump replacable VRAM writes
|
||||
setBooleanTweakOption(m_ui.tweakOptionTable, i++, false); // Set dumped VRAM write alpha channel
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD); // Minimum dumped VRAM width
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD); // Minimum dumped VRAm height
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
||||
static_cast<int>(Settings::DEFAULT_DMA_MAX_SLICE_TICKS)); // DMA max slice ticks
|
||||
setIntRangeTweakOption(m_ui.tweakOptionTable, i++,
|
||||
|
@ -356,12 +333,6 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
|
|||
sif->DeleteValue("CPU", "RecompilerMemoryExceptions");
|
||||
sif->DeleteValue("CPU", "RecompilerBlockLinking");
|
||||
sif->DeleteValue("CPU", "FastmemMode");
|
||||
sif->DeleteValue("TextureReplacements", "EnableVRAMWriteReplacements");
|
||||
sif->DeleteValue("TextureReplacements", "PreloadTextures");
|
||||
sif->DeleteValue("TextureReplacements", "DumpVRAMWrites");
|
||||
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteForceAlphaChannel");
|
||||
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteWidthThreshold");
|
||||
sif->DeleteValue("TextureReplacements", "DumpVRAMWriteHeightThreshold");
|
||||
sif->DeleteValue("Hacks", "DMAMaxSliceTicks");
|
||||
sif->DeleteValue("Hacks", "DMAHaltTicks");
|
||||
sif->DeleteValue("Hacks", "GPUFIFOSize");
|
||||
|
@ -374,4 +345,4 @@ void AdvancedSettingsWidget::onResetToDefaultClicked()
|
|||
while (m_ui.tweakOptionTable->rowCount() > 0)
|
||||
m_ui.tweakOptionTable->removeRow(m_ui.tweakOptionTable->rowCount() - 1);
|
||||
addTweakOptions();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
<ClCompile Include="qtprogresscallback.cpp" />
|
||||
<ClCompile Include="qtutils.cpp" />
|
||||
<ClCompile Include="settingsdialog.cpp" />
|
||||
<ClCompile Include="texturereplacementssettingswidget.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="aboutdialog.h" />
|
||||
|
@ -99,6 +100,7 @@
|
|||
<QtMoc Include="foldersettingswidget.h" />
|
||||
<ClInclude Include="qtutils.h" />
|
||||
<QtMoc Include="settingsdialog.h" />
|
||||
<QtMoc Include="texturereplacementssettingswidget.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUi Include="aboutdialog.ui">
|
||||
|
@ -215,6 +217,9 @@
|
|||
<QtUi Include="coverdownloaddialog.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
<QtUi Include="texturereplacementssettingswidget.ui">
|
||||
<FileType>Document</FileType>
|
||||
</QtUi>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtResource Include="resources\resources.qrc">
|
||||
|
@ -266,6 +271,7 @@
|
|||
<ClCompile Include="$(IntDir)moc_qthost.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_qtprogresscallback.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_settingsdialog.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_texturereplacementssettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)qrc_resources.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -348,4 +354,4 @@
|
|||
</ItemDefinitionGroup>
|
||||
<Import Project="..\..\dep\msvc\vsprops\Targets.props" />
|
||||
<Import Project="..\..\dep\msvc\vsprops\QtCompile.targets" />
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -91,6 +91,10 @@
|
|||
<ClCompile Include="$(IntDir)moc_foldersettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_gamesummarywidget.cpp" />
|
||||
<ClCompile Include="qttranslations.cpp" />
|
||||
<ClCompile Include="coverdownloaddialog.cpp" />
|
||||
<ClCompile Include="texturereplacementssettingswidget.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_coverdownloaddialog.cpp" />
|
||||
<ClCompile Include="$(IntDir)moc_texturereplacementssettingswidget.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="qtutils.h" />
|
||||
|
@ -150,6 +154,8 @@
|
|||
<QtMoc Include="gamelistrefreshthread.h" />
|
||||
<QtMoc Include="gamesummarywidget.h" />
|
||||
<QtMoc Include="foldersettingswidget.h" />
|
||||
<QtMoc Include="coverdownloaddialog.h" />
|
||||
<QtMoc Include="texturereplacementssettingswidget.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtUi Include="consolesettingswidget.ui" />
|
||||
|
@ -189,6 +195,8 @@
|
|||
<QtUi Include="controllermacrowidget.ui" />
|
||||
<QtUi Include="controllermacroeditwidget.ui" />
|
||||
<QtUi Include="controllerbindingwidget_mouse.ui" />
|
||||
<QtUi Include="coverdownloaddialog.ui" />
|
||||
<QtUi Include="texturereplacementssettingswidget.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="qt5.natvis" />
|
||||
|
@ -253,4 +261,4 @@
|
|||
<Filter>translations</Filter>
|
||||
</QtTs>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "memorycardsettingswidget.h"
|
||||
#include "postprocessingsettingswidget.h"
|
||||
#include "qthost.h"
|
||||
#include "texturereplacementssettingswidget.h"
|
||||
#include "util/ini_settings_interface.h"
|
||||
#include <QtWidgets/QMessageBox>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
@ -103,6 +104,11 @@ void SettingsDialog::addPages()
|
|||
QStringLiteral("paint-fill"),
|
||||
tr("<strong>Enhancement Settings</strong><hr>These options control enhancements which can improve visuals compared "
|
||||
"to the original console. Mouse over each option for additional information."));
|
||||
addWidget(
|
||||
m_texture_replacement_settings = new TextureReplacementSettingsWidget(this, m_ui.settingsContainer),
|
||||
tr("Texture Replacements"), QStringLiteral("pantone-line"),
|
||||
tr(
|
||||
"<strong>Texture Replacement Settings</strong><hr>WRITE ME! Mouse over each option for additional information."));
|
||||
if (!isPerGameSettings())
|
||||
{
|
||||
addWidget(
|
||||
|
|
|
@ -22,6 +22,7 @@ class EmulationSettingsWidget;
|
|||
class MemoryCardSettingsWidget;
|
||||
class DisplaySettingsWidget;
|
||||
class EnhancementSettingsWidget;
|
||||
class TextureReplacementSettingsWidget;
|
||||
class PostProcessingSettingsWidget;
|
||||
class AudioSettingsWidget;
|
||||
class AchievementSettingsWidget;
|
||||
|
@ -51,6 +52,7 @@ public:
|
|||
ALWAYS_INLINE MemoryCardSettingsWidget* getMemoryCardSettingsWidget() const { return m_memory_card_settings; }
|
||||
ALWAYS_INLINE DisplaySettingsWidget* getDisplaySettingsWidget() const { return m_display_settings; }
|
||||
ALWAYS_INLINE EnhancementSettingsWidget* getEnhancementSettingsWidget() const { return m_enhancement_settings; }
|
||||
ALWAYS_INLINE TextureReplacementSettingsWidget* getTextureReplacementSettingsWidget() const { return m_texture_replacement_settings; }
|
||||
ALWAYS_INLINE AudioSettingsWidget* getAudioSettingsWidget() const { return m_audio_settings; }
|
||||
ALWAYS_INLINE AchievementSettingsWidget* getAchievementSettingsWidget() const { return m_achievement_settings; }
|
||||
ALWAYS_INLINE AdvancedSettingsWidget* getAdvancedSettingsWidget() const { return m_advanced_settings; }
|
||||
|
@ -92,7 +94,7 @@ private Q_SLOTS:
|
|||
private:
|
||||
enum : u32
|
||||
{
|
||||
MAX_SETTINGS_WIDGETS = 13
|
||||
MAX_SETTINGS_WIDGETS = 14
|
||||
};
|
||||
|
||||
void addPages();
|
||||
|
@ -110,6 +112,7 @@ private:
|
|||
MemoryCardSettingsWidget* m_memory_card_settings = nullptr;
|
||||
DisplaySettingsWidget* m_display_settings = nullptr;
|
||||
EnhancementSettingsWidget* m_enhancement_settings = nullptr;
|
||||
TextureReplacementSettingsWidget* m_texture_replacement_settings = nullptr;
|
||||
PostProcessingSettingsWidget* m_post_processing_settings = nullptr;
|
||||
AudioSettingsWidget* m_audio_settings = nullptr;
|
||||
AchievementSettingsWidget* m_achievement_settings = nullptr;
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
#include "texturereplacementssettingswidget.h"
|
||||
#include "core/settings.h"
|
||||
#include "core/texture_dumper.h"
|
||||
#include "core/texture_replacements.h"
|
||||
#include "qtutils.h"
|
||||
#include "settingwidgetbinder.h"
|
||||
#include <QtCore/QUrl>
|
||||
#include <cmath>
|
||||
|
||||
TextureReplacementSettingsWidget::TextureReplacementSettingsWidget(SettingsDialog* dialog, QWidget* parent)
|
||||
: QWidget(parent), m_dialog(dialog)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
connectUi();
|
||||
updateOptionsEnabled();
|
||||
updateVRAMUsage();
|
||||
}
|
||||
|
||||
TextureReplacementSettingsWidget::~TextureReplacementSettingsWidget() = default;
|
||||
|
||||
void TextureReplacementSettingsWidget::connectUi()
|
||||
{
|
||||
SettingsInterface* sif = m_dialog->getSettingsInterface();
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableVRAMWriteReplacement, "TextureReplacements",
|
||||
"EnableVRAMWriteReplacements", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableTextureReplacement, "TextureReplacements",
|
||||
"EnableTextureReplacements", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.preloadTextureReplacements, "TextureReplacements",
|
||||
"PreloadTextures", false);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.textureReplacementScale, "TextureReplacements",
|
||||
"TextureReplacementScale", 1);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.enableVRAMWriteDumping, "TextureReplacements",
|
||||
"DumpVRAMWrites", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.VRAMWriteDumpingClearMaskBit, "TextureReplacements",
|
||||
"DumpVRAMWriteForceAlphaChannel", true);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.VRAMWriteDumpingWidthThreshold, "TextureReplacements",
|
||||
"DumpVRAMWriteWidthThreshold",
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.VRAMWriteDumpingWidthThreshold, "TextureReplacements",
|
||||
"DumpVRAMWriteHeightThreshold",
|
||||
Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
|
||||
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.textureDumpVRAMWriteGroups, "TextureReplacements",
|
||||
"DumpTexturesByVRAMWrite", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.textureDumpCLUTGroups, "TextureReplacements",
|
||||
"DumpTexturesByPalette", false);
|
||||
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.textureDumpForceOpaque, "TextureReplacements",
|
||||
"DumpTexturesForceAlphaChannel", false);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.textureDumpMaxMergeWidth, "TextureReplacements",
|
||||
"DumpTexturesMaxMergeWidth",
|
||||
Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGE_WIDTH);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.textureDumpMaxMergeHeight, "TextureReplacements",
|
||||
"DumpTexturesMaxMergeHeight",
|
||||
Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGE_HEIGHT);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.textureDumpMaxMergeeWidth, "TextureReplacements",
|
||||
"DumpTexturesMaxMergeeWidth",
|
||||
Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGEE_WIDTH);
|
||||
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.textureDumpMaxMergeeHeight, "TextureReplacements",
|
||||
"DumpTexturesMaxMergeeHeight",
|
||||
Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGEE_HEIGHT);
|
||||
|
||||
connect(m_ui.enableVRAMWriteReplacement, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateOptionsEnabled);
|
||||
connect(m_ui.enableTextureReplacement, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateOptionsEnabled);
|
||||
connect(m_ui.enableVRAMWriteDumping, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateOptionsEnabled);
|
||||
connect(m_ui.textureDumpVRAMWriteGroups, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateOptionsEnabled);
|
||||
connect(m_ui.textureDumpCLUTGroups, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateOptionsEnabled);
|
||||
connect(m_ui.enableTextureReplacement, &QCheckBox::stateChanged, this,
|
||||
&TextureReplacementSettingsWidget::updateVRAMUsage);
|
||||
connect(m_ui.textureReplacementScale, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||
&TextureReplacementSettingsWidget::updateVRAMUsage);
|
||||
|
||||
connect(m_ui.resetToDefaults, &QPushButton::clicked, this, &TextureReplacementSettingsWidget::setDefaults);
|
||||
connect(m_ui.openDumpDirectory, &QPushButton::clicked, this, &TextureReplacementSettingsWidget::openDumpDirectory);
|
||||
}
|
||||
|
||||
void TextureReplacementSettingsWidget::setDefaults()
|
||||
{
|
||||
m_ui.enableVRAMWriteReplacement->setChecked(false);
|
||||
m_ui.enableTextureReplacement->setChecked(false);
|
||||
m_ui.preloadTextureReplacements->setChecked(false);
|
||||
|
||||
m_ui.textureReplacementScale->setCurrentIndex(0);
|
||||
|
||||
m_ui.enableVRAMWriteDumping->setChecked(false);
|
||||
m_ui.VRAMWriteDumpingClearMaskBit->setChecked(true);
|
||||
m_ui.VRAMWriteDumpingWidthThreshold->setValue(Settings::DEFAULT_VRAM_WRITE_DUMP_WIDTH_THRESHOLD);
|
||||
m_ui.VRAMWriteDumpingWidthThreshold->setValue(Settings::DEFAULT_VRAM_WRITE_DUMP_HEIGHT_THRESHOLD);
|
||||
|
||||
m_ui.textureDumpVRAMWriteGroups->setChecked(false);
|
||||
m_ui.textureDumpCLUTGroups->setChecked(false);
|
||||
m_ui.textureDumpForceOpaque->setChecked(false);
|
||||
m_ui.textureDumpMaxMergeWidth->setValue(Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGE_WIDTH);
|
||||
m_ui.textureDumpMaxMergeHeight->setValue(Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGE_HEIGHT);
|
||||
m_ui.textureDumpMaxMergeeWidth->setValue(Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGEE_WIDTH);
|
||||
m_ui.textureDumpMaxMergeeHeight->setValue(Settings::DEFAULT_TEXTURE_DUMP_MAX_MERGEE_HEIGHT);
|
||||
}
|
||||
|
||||
void TextureReplacementSettingsWidget::updateOptionsEnabled()
|
||||
{
|
||||
m_ui.preloadTextureReplacements->setEnabled(m_ui.enableVRAMWriteReplacement->isChecked() ||
|
||||
m_ui.enableTextureReplacement->isChecked());
|
||||
m_ui.textureReplacementScale->setEnabled(m_ui.enableTextureReplacement->isChecked());
|
||||
|
||||
const bool vram_write_dumping_enabled = m_ui.enableVRAMWriteDumping->isChecked();
|
||||
m_ui.VRAMWriteDumpingClearMaskBit->setEnabled(vram_write_dumping_enabled);
|
||||
m_ui.VRAMWriteDumpingWidthThreshold->setEnabled(vram_write_dumping_enabled);
|
||||
m_ui.VRAMWriteDumpingHeightThreshold->setEnabled(vram_write_dumping_enabled);
|
||||
m_ui.dumpingThreshold->setEnabled(vram_write_dumping_enabled);
|
||||
|
||||
const bool texture_dumping_enabled =
|
||||
(m_ui.textureDumpVRAMWriteGroups->isChecked() || m_ui.textureDumpCLUTGroups->isChecked());
|
||||
m_ui.textureDumpForceOpaque->setEnabled(texture_dumping_enabled);
|
||||
m_ui.maxMergeSize->setEnabled(texture_dumping_enabled);
|
||||
m_ui.textureDumpMaxMergeWidth->setEnabled(texture_dumping_enabled);
|
||||
m_ui.textureDumpMaxMergeHeight->setEnabled(texture_dumping_enabled);
|
||||
m_ui.maxMergeeSize->setEnabled(texture_dumping_enabled);
|
||||
m_ui.textureDumpMaxMergeeWidth->setEnabled(texture_dumping_enabled);
|
||||
m_ui.textureDumpMaxMergeeHeight->setEnabled(texture_dumping_enabled);
|
||||
}
|
||||
|
||||
void TextureReplacementSettingsWidget::openDumpDirectory()
|
||||
{
|
||||
const std::string dump_directory(TextureDumper::GetDumpDirectory());
|
||||
if (dump_directory.empty())
|
||||
return;
|
||||
|
||||
QtUtils::OpenURL(this, QUrl::fromLocalFile(QString::fromStdString(dump_directory)));
|
||||
}
|
||||
|
||||
void TextureReplacementSettingsWidget::updateVRAMUsage()
|
||||
{
|
||||
if (!m_ui.enableTextureReplacement->isChecked())
|
||||
{
|
||||
m_ui.vramUsage->setText(tr("Texture replacements are not enabled."));
|
||||
return;
|
||||
}
|
||||
|
||||
u32 scale = static_cast<u32>(m_dialog->getEffectiveIntValue("TextureReplacements", "TextureReplacementScale", 0));
|
||||
if (scale == 0)
|
||||
scale = static_cast<u32>(m_dialog->getEffectiveIntValue("GPU", "ResolutionScale", 1));
|
||||
|
||||
const u32 replacement_width = TextureReplacements::TEXTURE_REPLACEMENT_PAGE_WIDTH * scale;
|
||||
const u32 replacement_height = TextureReplacements::TEXTURE_REPLACEMENT_PAGE_HEIGHT * scale;
|
||||
const u32 vram_usage =
|
||||
(replacement_width * replacement_height * sizeof(u32)) * TextureReplacements::TEXTURE_REPLACEMENT_PAGE_COUNT;
|
||||
|
||||
const u32 vram_usage_mb = static_cast<u32>(std::ceil(static_cast<float>(vram_usage) / 1024576.0f));
|
||||
m_ui.vramUsage->setText(tr("Texture replacements will be up to %1x%2, and use %3MB of video memory.")
|
||||
.arg(replacement_width)
|
||||
.arg(replacement_height)
|
||||
.arg(vram_usage_mb));
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
#pragma once
|
||||
#include "ui_texturereplacementssettingswidget.h"
|
||||
#include <QtCore/QMap>
|
||||
#include <QtCore/QString>
|
||||
#include <QtWidgets/QDialog>
|
||||
#include <array>
|
||||
|
||||
class SettingsDialog;
|
||||
|
||||
class TextureReplacementSettingsWidget final : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TextureReplacementSettingsWidget(SettingsDialog* dialog, QWidget* parent);
|
||||
~TextureReplacementSettingsWidget();
|
||||
|
||||
private Q_SLOTS:
|
||||
void setDefaults();
|
||||
void updateOptionsEnabled();
|
||||
void openDumpDirectory();
|
||||
void updateVRAMUsage();
|
||||
|
||||
private:
|
||||
void connectUi();
|
||||
|
||||
SettingsDialog* m_dialog;
|
||||
|
||||
Ui::TextureReplacementSettingsWidget m_ui;
|
||||
};
|
|
@ -0,0 +1,368 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TextureReplacementSettingsWidget</class>
|
||||
<widget class="QWidget" name="TextureReplacementSettingsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>442</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Texture Replacement</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableTextureReplacement">
|
||||
<property name="text">
|
||||
<string>Enable Texture Replacement</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="enableVRAMWriteReplacement">
|
||||
<property name="text">
|
||||
<string>Enable VRAM Write Replacements (backgrounds in supported games)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Texture Replacement Resolution:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="textureReplacementScale">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Auto (Match Rendering Resolution)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1x (256x256)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2x (512x512)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3x (768x768)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>4x (1024x1024)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>5x (1280x1280)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>6x (1536x1536)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>7x (1792x1792)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>8x (2048x2048)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>9x (2304x2304)</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>10x (2560x2560)</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QLabel" name="vramUsage">
|
||||
<property name="text">
|
||||
<string>Texture replacements will be up to 1024x1024, and use 8MB of video memory.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="preloadTextureReplacements">
|
||||
<property name="text">
|
||||
<string>Preload Texture Replacements</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>VRAM Write Dumping</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="enableVRAMWriteDumping">
|
||||
<property name="text">
|
||||
<string>Enable VRAM Write Dumping</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="VRAMWriteDumpingClearMaskBit">
|
||||
<property name="text">
|
||||
<string>Clear Mask Bit (make opaque)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="dumpingThreshold">
|
||||
<property name="text">
|
||||
<string>Dumping Threshold:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="VRAMWriteDumpingWidthThreshold">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>x</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="VRAMWriteDumpingHeightThreshold">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>512</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Texture Dumping</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="textureDumpForceOpaque">
|
||||
<property name="text">
|
||||
<string>Clear Transparency (make opaque)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="textureDumpCLUTGroups">
|
||||
<property name="text">
|
||||
<string>Dump Textures By Palette/CLUT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string><b>WARNING: </b>Texture dumping can create a large number of files on your disk, slowing down emulation and increasing wear on SSDs.</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="maxMergeeSize">
|
||||
<property name="text">
|
||||
<string>Maximum VRAM Write Mergee Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="maxMergeSize">
|
||||
<property name="text">
|
||||
<string>Maximum VRAM Write Merge Size:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="1,0,1">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="textureDumpMaxMergeWidth">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>x</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="textureDumpMaxMergeHeight">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>512</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0,1">
|
||||
<item>
|
||||
<widget class="QSpinBox" name="textureDumpMaxMergeeWidth">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>x</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="textureDumpMaxMergeeHeight">
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>512</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="openDumpDirectory">
|
||||
<property name="text">
|
||||
<string>Open Dump Directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetToDefaults">
|
||||
<property name="text">
|
||||
<string>Reset to Defaults</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="textureDumpVRAMWriteGroups">
|
||||
<property name="text">
|
||||
<string>Dump Merged Textures</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources/resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue