mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-29 09:05:41 +00:00
GameSettings: Make DMA/GPU tweak settings overridable
This commit is contained in:
parent
be63d893cd
commit
7210b0826a
|
@ -116,9 +116,11 @@ DisablePGXP = true
|
||||||
ForceDigitalController = true
|
ForceDigitalController = true
|
||||||
|
|
||||||
|
|
||||||
# SCUS-94302 (Destruction Derby (USA))
|
# SCUS-94350 (Destruction Derby 2 (USA))
|
||||||
[SCUS-94302]
|
[SCUS-94350]
|
||||||
ForceDigitalController = true
|
ForceDigitalController = true
|
||||||
|
DMAMaxSliceTicks = 225
|
||||||
|
DMAHaltTicks = 100
|
||||||
|
|
||||||
|
|
||||||
# SCUS-94900 (Crash Bandicoot (USA))
|
# SCUS-94900 (Crash Bandicoot (USA))
|
||||||
|
|
|
@ -287,6 +287,27 @@ void GamePropertiesDialog::populateGameSettings()
|
||||||
m_ui.displayActiveEndOffset->setValue(static_cast<int>(gs.display_active_end_offset.value()));
|
m_ui.displayActiveEndOffset->setValue(static_cast<int>(gs.display_active_end_offset.value()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gs.dma_max_slice_ticks.has_value())
|
||||||
|
{
|
||||||
|
QSignalBlocker sb(m_ui.dmaMaxSliceTicks);
|
||||||
|
m_ui.dmaMaxSliceTicks->setValue(static_cast<int>(gs.dma_max_slice_ticks.value()));
|
||||||
|
}
|
||||||
|
if (gs.dma_halt_ticks.has_value())
|
||||||
|
{
|
||||||
|
QSignalBlocker sb(m_ui.dmaHaltTicks);
|
||||||
|
m_ui.dmaHaltTicks->setValue(static_cast<int>(gs.dma_halt_ticks.value()));
|
||||||
|
}
|
||||||
|
if (gs.gpu_fifo_size.has_value())
|
||||||
|
{
|
||||||
|
QSignalBlocker sb(m_ui.gpuFIFOSize);
|
||||||
|
m_ui.gpuFIFOSize->setValue(static_cast<int>(gs.gpu_fifo_size.value()));
|
||||||
|
}
|
||||||
|
if (gs.gpu_max_run_ahead.has_value())
|
||||||
|
{
|
||||||
|
QSignalBlocker sb(m_ui.gpuMaxRunAhead);
|
||||||
|
m_ui.gpuMaxRunAhead->setValue(static_cast<int>(gs.gpu_max_run_ahead.value()));
|
||||||
|
}
|
||||||
|
|
||||||
if (gs.display_crop_mode.has_value())
|
if (gs.display_crop_mode.has_value())
|
||||||
{
|
{
|
||||||
QSignalBlocker sb(m_ui.userCropMode);
|
QSignalBlocker sb(m_ui.userCropMode);
|
||||||
|
@ -584,6 +605,34 @@ void GamePropertiesDialog::connectUi()
|
||||||
m_game_settings.display_active_end_offset = static_cast<s16>(value);
|
m_game_settings.display_active_end_offset = static_cast<s16>(value);
|
||||||
saveGameSettings();
|
saveGameSettings();
|
||||||
});
|
});
|
||||||
|
connect(m_ui.dmaMaxSliceTicks, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
|
if (value == 0)
|
||||||
|
m_game_settings.dma_max_slice_ticks.reset();
|
||||||
|
else
|
||||||
|
m_game_settings.dma_max_slice_ticks = static_cast<u32>(value);
|
||||||
|
saveGameSettings();
|
||||||
|
});
|
||||||
|
connect(m_ui.dmaHaltTicks, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
|
if (value == 0)
|
||||||
|
m_game_settings.dma_halt_ticks.reset();
|
||||||
|
else
|
||||||
|
m_game_settings.dma_halt_ticks = static_cast<u32>(value);
|
||||||
|
saveGameSettings();
|
||||||
|
});
|
||||||
|
connect(m_ui.gpuFIFOSize, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
|
if (value == 0)
|
||||||
|
m_game_settings.gpu_fifo_size.reset();
|
||||||
|
else
|
||||||
|
m_game_settings.gpu_fifo_size = static_cast<u32>(value);
|
||||||
|
saveGameSettings();
|
||||||
|
});
|
||||||
|
connect(m_ui.gpuMaxRunAhead, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
|
||||||
|
if (value == 0)
|
||||||
|
m_game_settings.gpu_max_run_ahead.reset();
|
||||||
|
else
|
||||||
|
m_game_settings.gpu_max_run_ahead = static_cast<u32>(value);
|
||||||
|
saveGameSettings();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GamePropertiesDialog::updateCPUClockSpeedLabel()
|
void GamePropertiesDialog::updateCPUClockSpeedLabel()
|
||||||
|
|
|
@ -676,6 +676,71 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="text">
|
||||||
|
<string>DMA Max Slice Ticks:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QSpinBox" name="dmaMaxSliceTicks">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_25">
|
||||||
|
<property name="text">
|
||||||
|
<string>DMA Halt Ticks:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="dmaHaltTicks">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_26">
|
||||||
|
<property name="text">
|
||||||
|
<string>GPU FIFO Size:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QSpinBox" name="gpuFIFOSize">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>128</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_27">
|
||||||
|
<property name="text">
|
||||||
|
<string>GPU Max Run Ahead:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QSpinBox" name="gpuMaxRunAhead">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>16</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -115,7 +115,7 @@ private:
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
|
GAME_LIST_CACHE_SIGNATURE = 0x45434C47,
|
||||||
GAME_LIST_CACHE_VERSION = 13
|
GAME_LIST_CACHE_VERSION = 14
|
||||||
};
|
};
|
||||||
|
|
||||||
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;
|
using DatabaseMap = std::unordered_map<std::string, GameListDatabaseEntry>;
|
||||||
|
|
|
@ -109,6 +109,8 @@ bool Entry::LoadFromStream(ByteStream* stream)
|
||||||
!ReadOptionalFromStream(stream, &cpu_overclock_enable) || !ReadOptionalFromStream(stream, &cdrom_read_speedup) ||
|
!ReadOptionalFromStream(stream, &cpu_overclock_enable) || !ReadOptionalFromStream(stream, &cdrom_read_speedup) ||
|
||||||
!ReadOptionalFromStream(stream, &display_active_start_offset) ||
|
!ReadOptionalFromStream(stream, &display_active_start_offset) ||
|
||||||
!ReadOptionalFromStream(stream, &display_active_end_offset) ||
|
!ReadOptionalFromStream(stream, &display_active_end_offset) ||
|
||||||
|
!ReadOptionalFromStream(stream, &dma_max_slice_ticks) || !ReadOptionalFromStream(stream, &dma_halt_ticks) ||
|
||||||
|
!ReadOptionalFromStream(stream, &gpu_fifo_size) || !ReadOptionalFromStream(stream, &gpu_max_run_ahead) ||
|
||||||
!ReadOptionalFromStream(stream, &display_crop_mode) || !ReadOptionalFromStream(stream, &display_aspect_ratio) ||
|
!ReadOptionalFromStream(stream, &display_crop_mode) || !ReadOptionalFromStream(stream, &display_aspect_ratio) ||
|
||||||
!ReadOptionalFromStream(stream, &display_linear_upscaling) ||
|
!ReadOptionalFromStream(stream, &display_linear_upscaling) ||
|
||||||
!ReadOptionalFromStream(stream, &display_integer_upscaling) ||
|
!ReadOptionalFromStream(stream, &display_integer_upscaling) ||
|
||||||
|
@ -151,8 +153,10 @@ bool Entry::SaveToStream(ByteStream* stream) const
|
||||||
WriteOptionalToStream(stream, cpu_overclock_denominator) &&
|
WriteOptionalToStream(stream, cpu_overclock_denominator) &&
|
||||||
WriteOptionalToStream(stream, cpu_overclock_enable) && WriteOptionalToStream(stream, cdrom_read_speedup) &&
|
WriteOptionalToStream(stream, cpu_overclock_enable) && WriteOptionalToStream(stream, cdrom_read_speedup) &&
|
||||||
WriteOptionalToStream(stream, display_active_start_offset) &&
|
WriteOptionalToStream(stream, display_active_start_offset) &&
|
||||||
WriteOptionalToStream(stream, display_active_end_offset) && WriteOptionalToStream(stream, display_crop_mode) &&
|
WriteOptionalToStream(stream, display_active_end_offset) &&
|
||||||
WriteOptionalToStream(stream, display_aspect_ratio) &&
|
WriteOptionalToStream(stream, dma_max_slice_ticks) && WriteOptionalToStream(stream, dma_halt_ticks) &&
|
||||||
|
WriteOptionalToStream(stream, gpu_fifo_size) && WriteOptionalToStream(stream, gpu_max_run_ahead) &&
|
||||||
|
WriteOptionalToStream(stream, display_crop_mode) && WriteOptionalToStream(stream, display_aspect_ratio) &&
|
||||||
WriteOptionalToStream(stream, display_linear_upscaling) &&
|
WriteOptionalToStream(stream, display_linear_upscaling) &&
|
||||||
WriteOptionalToStream(stream, display_integer_upscaling) &&
|
WriteOptionalToStream(stream, display_integer_upscaling) &&
|
||||||
WriteOptionalToStream(stream, display_force_4_3_for_24bit) &&
|
WriteOptionalToStream(stream, display_force_4_3_for_24bit) &&
|
||||||
|
@ -193,6 +197,18 @@ static void ParseIniSection(Entry* entry, const char* section, const CSimpleIniA
|
||||||
lvalue = ini.GetLongValue(section, "DisplayActiveEndOffset", 0);
|
lvalue = ini.GetLongValue(section, "DisplayActiveEndOffset", 0);
|
||||||
if (lvalue != 0)
|
if (lvalue != 0)
|
||||||
entry->display_active_end_offset = static_cast<s16>(lvalue);
|
entry->display_active_end_offset = static_cast<s16>(lvalue);
|
||||||
|
lvalue = ini.GetLongValue(section, "DMAMaxSliceTicks", 0);
|
||||||
|
if (lvalue > 0)
|
||||||
|
entry->dma_max_slice_ticks = static_cast<u32>(lvalue);
|
||||||
|
lvalue = ini.GetLongValue(section, "DMAHaltTicks", 0);
|
||||||
|
if (lvalue > 0)
|
||||||
|
entry->dma_halt_ticks = static_cast<u32>(lvalue);
|
||||||
|
lvalue = ini.GetLongValue(section, "GPUFIFOSize", 0);
|
||||||
|
if (lvalue > 0)
|
||||||
|
entry->gpu_fifo_size = static_cast<u32>(lvalue);
|
||||||
|
lvalue = ini.GetLongValue(section, "GPUMaxRunAhead", 0);
|
||||||
|
if (lvalue > 0)
|
||||||
|
entry->gpu_max_run_ahead = static_cast<u32>(lvalue);
|
||||||
|
|
||||||
cvalue = ini.GetValue(section, "DisplayCropMode", nullptr);
|
cvalue = ini.GetValue(section, "DisplayCropMode", nullptr);
|
||||||
if (cvalue)
|
if (cvalue)
|
||||||
|
@ -276,9 +292,16 @@ static void StoreIniSection(const Entry& entry, const char* section, CSimpleIniA
|
||||||
|
|
||||||
if (entry.display_active_start_offset.has_value())
|
if (entry.display_active_start_offset.has_value())
|
||||||
ini.SetLongValue(section, "DisplayActiveStartOffset", entry.display_active_start_offset.value());
|
ini.SetLongValue(section, "DisplayActiveStartOffset", entry.display_active_start_offset.value());
|
||||||
|
|
||||||
if (entry.display_active_end_offset.has_value())
|
if (entry.display_active_end_offset.has_value())
|
||||||
ini.SetLongValue(section, "DisplayActiveEndOffset", entry.display_active_end_offset.value());
|
ini.SetLongValue(section, "DisplayActiveEndOffset", entry.display_active_end_offset.value());
|
||||||
|
if (entry.dma_max_slice_ticks.has_value())
|
||||||
|
ini.SetLongValue(section, "DMAMaxSliceTicks", static_cast<long>(entry.dma_max_slice_ticks.value()));
|
||||||
|
if (entry.dma_halt_ticks.has_value())
|
||||||
|
ini.SetLongValue(section, "DMAHaltTicks", static_cast<long>(entry.dma_halt_ticks.value()));
|
||||||
|
if (entry.gpu_fifo_size.has_value())
|
||||||
|
ini.SetLongValue(section, "GPUFIFOSize", static_cast<long>(entry.gpu_fifo_size.value()));
|
||||||
|
if (entry.gpu_max_run_ahead.has_value())
|
||||||
|
ini.SetLongValue(section, "GPUMaxRunAhead", static_cast<long>(entry.gpu_max_run_ahead.value()));
|
||||||
|
|
||||||
if (entry.display_crop_mode.has_value())
|
if (entry.display_crop_mode.has_value())
|
||||||
ini.SetValue(section, "DisplayCropMode", Settings::GetDisplayCropModeName(entry.display_crop_mode.value()));
|
ini.SetValue(section, "DisplayCropMode", Settings::GetDisplayCropModeName(entry.display_crop_mode.value()));
|
||||||
|
@ -444,6 +467,14 @@ void Entry::ApplySettings(bool display_osd_messages) const
|
||||||
g_settings.display_active_start_offset = display_active_start_offset.value();
|
g_settings.display_active_start_offset = display_active_start_offset.value();
|
||||||
if (display_active_end_offset.has_value())
|
if (display_active_end_offset.has_value())
|
||||||
g_settings.display_active_end_offset = display_active_end_offset.value();
|
g_settings.display_active_end_offset = display_active_end_offset.value();
|
||||||
|
if (dma_max_slice_ticks.has_value())
|
||||||
|
g_settings.dma_max_slice_ticks = dma_max_slice_ticks.value();
|
||||||
|
if (dma_halt_ticks.has_value())
|
||||||
|
g_settings.dma_halt_ticks = dma_halt_ticks.value();
|
||||||
|
if (gpu_fifo_size.has_value())
|
||||||
|
g_settings.gpu_fifo_size = gpu_fifo_size.value();
|
||||||
|
if (gpu_max_run_ahead.has_value())
|
||||||
|
g_settings.gpu_max_run_ahead = gpu_max_run_ahead.value();
|
||||||
|
|
||||||
if (display_crop_mode.has_value())
|
if (display_crop_mode.has_value())
|
||||||
g_settings.display_crop_mode = display_crop_mode.value();
|
g_settings.display_crop_mode = display_crop_mode.value();
|
||||||
|
|
|
@ -38,6 +38,10 @@ struct Entry
|
||||||
std::bitset<static_cast<int>(Trait::Count)> traits{};
|
std::bitset<static_cast<int>(Trait::Count)> traits{};
|
||||||
std::optional<s16> display_active_start_offset;
|
std::optional<s16> display_active_start_offset;
|
||||||
std::optional<s16> display_active_end_offset;
|
std::optional<s16> display_active_end_offset;
|
||||||
|
std::optional<u32> dma_max_slice_ticks;
|
||||||
|
std::optional<u32> dma_halt_ticks;
|
||||||
|
std::optional<u32> gpu_fifo_size;
|
||||||
|
std::optional<u32> gpu_max_run_ahead;
|
||||||
|
|
||||||
// user settings
|
// user settings
|
||||||
std::optional<u32> cpu_overclock_numerator;
|
std::optional<u32> cpu_overclock_numerator;
|
||||||
|
|
Loading…
Reference in a new issue