mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
PatchEngine: Make PatchType an enum class
Makes the enum strongly typed. A function for retrieving the string representation of the enum is also added, which allows hiding the array that contains all of the strings from view (i.e. we operate on the API, not the exposed internals). This also allows us to bounds check any querying for the strings.
This commit is contained in:
@ -161,24 +161,24 @@ QGroupBox* NewPatchDialog::CreateEntry(int index)
|
||||
|
||||
connect(byte, &QRadioButton::toggled, [this, index](bool checked) {
|
||||
if (checked)
|
||||
m_patch.entries[index].type = PatchEngine::PATCH_8BIT;
|
||||
m_patch.entries[index].type = PatchEngine::PatchType::Patch8Bit;
|
||||
});
|
||||
|
||||
connect(word, &QRadioButton::toggled, [this, index](bool checked) {
|
||||
if (checked)
|
||||
m_patch.entries[index].type = PatchEngine::PATCH_16BIT;
|
||||
m_patch.entries[index].type = PatchEngine::PatchType::Patch16Bit;
|
||||
});
|
||||
|
||||
connect(dword, &QRadioButton::toggled, [this, index](bool checked) {
|
||||
if (checked)
|
||||
m_patch.entries[index].type = PatchEngine::PATCH_32BIT;
|
||||
m_patch.entries[index].type = PatchEngine::PatchType::Patch32Bit;
|
||||
});
|
||||
|
||||
auto entry_type = m_patch.entries[index].type;
|
||||
|
||||
byte->setChecked(entry_type == PatchEngine::PATCH_8BIT);
|
||||
word->setChecked(entry_type == PatchEngine::PATCH_16BIT);
|
||||
dword->setChecked(entry_type == PatchEngine::PATCH_32BIT);
|
||||
byte->setChecked(entry_type == PatchEngine::PatchType::Patch8Bit);
|
||||
word->setChecked(entry_type == PatchEngine::PatchType::Patch16Bit);
|
||||
dword->setChecked(entry_type == PatchEngine::PatchType::Patch32Bit);
|
||||
|
||||
offset->setText(
|
||||
QStringLiteral("%1").arg(m_patch.entries[index].address, 10, 16, QLatin1Char('0')));
|
||||
|
Reference in New Issue
Block a user