Repository: RetroAchievements/RAIntegration
Pull request #665 (2021-01-16 23:05:41)

eliminate old achievement editor/list code
fully switches over to the new viewmodel-driven achievement editor and list


Patch:
diff --git a/src/Exports.cpp b/src/Exports.cpp
index ecb81adf..b8ac5d80 100644
--- a/src/Exports.cpp
+++ b/src/Exports.cpp
@@ -36,8 +36,6 @@
 #include "RAInterface\RA_Emulators.h"
 
 #ifndef RA_UTEST
-#include "RA_Dlg_Achievement.h"
-#include "RA_Dlg_AchEditor.h"
 #include "RA_Dlg_GameLibrary.h"
 #endif
 
@@ -323,14 +321,6 @@ static void ProcessAchievements()
     if (pRuntime.IsPaused())
         return;
 
-#ifndef RA_UTEST
-    {
-        auto* pEditingAchievement = g_AchievementEditorDialog.ActiveAchievement();
-        if (pEditingAchievement && pEditingAchievement->Active())
-            pEditingAchievement->SetDirtyFlag(Achievement::DirtyFlags::Conditions);
-    }
-#endif
-
     auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
     
     TALLY_PERFORMANCE(PerformanceCheckpoint::RuntimeProcess);
@@ -372,13 +362,6 @@ static void ProcessAchievements()
                 {
                     if (pGameContext.HasRichPresence() && !pGameContext.IsRichPresenceFromFile())
                         pAchievement->SetUnlockRichPresence(pGameContext.GetRichPresenceDisplayString());
-
-#ifndef RA_UTEST
-                    g_AchievementsDialog.ReloadLBXData(pAchievement->ID());
-
-                    if (g_AchievementEditorDialog.ActiveAchievement() == pAchievement)
-                        g_AchievementEditorDialog.LoadAchievement(pAchievement, TRUE);
-#endif
                 }
 
                 if (vmAchievement && vmAchievement->IsPauseOnTrigger())
@@ -565,9 +548,6 @@ static void OnStateRestored()
 
 #ifndef RA_UTEST
     UpdateUIForFrameChange();
-
-    if (g_AchievementEditorDialog.ActiveAchievement() != nullptr)
-        g_AchievementEditorDialog.ActiveAchievement()->SetDirtyFlag(Achievement::DirtyFlags::Conditions);
 #endif
 }
 
diff --git a/src/RA_Core.cpp b/src/RA_Core.cpp
index 65f82303..6582baeb 100644
--- a/src/RA_Core.cpp
+++ b/src/RA_Core.cpp
@@ -8,8 +8,6 @@
 #include "RA_Resource.h"
 #include "RA_md5factory.h"
 
-#include "RA_Dlg_AchEditor.h"   // RA_httpthread.h, services/ImageRepository.h
-#include "RA_Dlg_Achievement.h" // RA_AchievementSet.h
 #include "RA_Dlg_GameLibrary.h"
 
 #include "data\context\ConsoleContext.hh"
@@ -38,8 +36,6 @@
 
 #include "RAInterface\RA_Emulators.h"
 
-//#define USE_ASSET_LIST
-
 std::string g_sROMDirLocation;
 
 HMODULE g_hThisDLLInst = nullptr;
@@ -134,18 +130,6 @@ API int CCONV _RA_Shutdown()
         ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>().LoadGame(0U);
     }
 
-    if (g_AchievementsDialog.GetHWND() != nullptr)
-    {
-        DestroyWindow(g_AchievementsDialog.GetHWND());
-        g_AchievementsDialog.InstallHWND(nullptr);
-    }
-
-    if (g_AchievementEditorDialog.GetHWND() != nullptr)
-    {
-        DestroyWindow(g_AchievementEditorDialog.GetHWND());
-        g_AchievementEditorDialog.InstallHWND(nullptr);
-    }
-
     if (g_GameLibrary.GetHWND() != nullptr)
     {
         DestroyWindow(g_GameLibrary.GetHWND());
@@ -415,21 +399,11 @@ API void CCONV _RA_InvokeDialog(LPARAM nID)
     switch (nID)
     {
         case IDM_RA_FILES_ACHIEVEMENTS:
-#ifdef USE_ASSET_LIST
             ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::WindowManager>().AssetList.Show();
-#else
-            if (g_AchievementsDialog.GetHWND() == nullptr)
-                g_AchievementsDialog.InstallHWND(CreateDialog(g_hThisDLLInst, MAKEINTRESOURCE(IDD_RA_ACHIEVEMENTS), g_RAMainWnd, g_AchievementsDialog.s_AchievementsProc));
-            if (g_AchievementsDialog.GetHWND() != nullptr)
-                ShowWindow(g_AchievementsDialog.GetHWND(), SW_SHOW);
-#endif
             break;
 
         case IDM_RA_FILES_ACHIEVEMENTEDITOR:
-            if (g_AchievementEditorDialog.GetHWND() == nullptr)
-                g_AchievementEditorDialog.InstallHWND(CreateDialog(g_hThisDLLInst, MAKEINTRESOURCE(IDD_RA_ACHIEVEMENTEDITOR), g_RAMainWnd, g_AchievementEditorDialog.s_AchievementEditorProc));
-            if (g_AchievementEditorDialog.GetHWND() != nullptr)
-                ShowWindow(g_AchievementEditorDialog.GetHWND(), SW_SHOW);
+            ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::WindowManager>().AssetEditor.Show();
             break;
 
         case IDM_RA_FILES_MEMORYFINDER:
diff --git a/src/RA_Dlg_AchEditor.cpp b/src/RA_Dlg_AchEditor.cpp
deleted file mode 100644
index f0d72f02..00000000
--- a/src/RA_Dlg_AchEditor.cpp
+++ /dev/null
@@ -1,2388 +0,0 @@
-#include "RA_Dlg_AchEditor.h"
-
-#include "RA_Achievement.h"
-#include "RA_Core.h"
-#include "RA_Defs.h"
-#include "RA_Dlg_Achievement.h"
-#include "RA_ImageFactory.h"
-#include "RA_Resource.h"
-
-#include "api\FetchBadgeIds.hh"
-#include "api\UploadBadge.hh"
-
-#include "data\context\EmulatorContext.hh"
-#include "data\context\GameContext.hh"
-
-#include "services\IConfiguration.hh"
-#include "services\ServiceLocator.hh"
-
-#include "ui\drawing\gdi\ImageRepository.hh"
-
-#include "ui\viewmodels\MessageBoxViewModel.hh"
-#include "ui\viewmodels\WindowManager.hh"
-
-#include "ra_math.h"
-
-inline constexpr std::array<const char*, 10> COLUMN_TITLE{"ID",  "Flag", "Type", "Size",    "Memory",
-                                                          "Cmp", "Type", "Size", "Mem/Val", "Hits"};
-inline constexpr std::array<int, 10> COLUMN_WIDTH{30, 75, 42, 54, 72, 35, 42, 54, 72, 84};
-static_assert(COLUMN_TITLE.size() == COLUMN_WIDTH.size());
-
-enum class CondSubItems : std::size_t
-{
-    Id,
-    Group,
-    Type_Src,
-    Size_Src,
-    Value_Src,
-    Comparison,
-    Type_Tgt,
-    Size_Tgt,
-    Value_Tgt,
-    Hitcount
-};
-
-Dlg_AchievementEditor g_AchievementEditorDialog;
-
-// Dialog Resizing
-std::vector<ResizeContent> vDlgAchEditorResize;
-POINT pDlgAchEditorMin;
-
-INT_PTR CALLBACK AchProgressProc(HWND hDlg, UINT nMsg, WPARAM wParam, _UNUSED LPARAM) noexcept
-{
-    switch (nMsg)
-    {
-        case WM_INITDIALOG:
-            if (g_AchievementEditorDialog.ActiveAchievement() == nullptr)
-                return FALSE;
-
-            return TRUE;
-
-        case WM_COMMAND:
-        {
-            switch (LOWORD(wParam))
-            {
-                case IDOK:
-                case IDCLOSE:
-                    EndDialog(hDlg, true);
-                    return TRUE;
-
-                default:
-                    return FALSE;
-            }
-        }
-
-        case WM_DESTROY:
-            EndDialog(hDlg, true);
-            return FALSE;
-    }
-
-    return FALSE;
-}
-
-void Dlg_AchievementEditor::SetupColumns(HWND hList)
-{
-    // Remove all columns,
-    while (ListView_DeleteColumn(hList, 0))
-    {
-    }
-
-    // Remove all data.
-    ListView_DeleteAllItems(hList);
-
-    auto i = 0U;
-    for (const auto sTitle : COLUMN_TITLE)
-    {
-        ra::tstring colTitle{NativeStr(sTitle)}; // Take non-const copy
-        LV_COLUMN col{
-            col.mask = ra::to_unsigned(LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT),
-            col.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH,
-            col.cx = COLUMN_WIDTH.at(i),
-            col.pszText = colTitle.data(),
-            col.cchTextMax = 255,
-            col.iSubItem = ra::to_signed(i),
-        };
-
-        if (i == (m_nNumCols - 1))
-            col.fmt |= LVCFMT_FILL;
-
-        ListView_InsertColumn(hList, i, &col);
-        i++;
-    }
-
-    m_lbxData.clear();
-
-    ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
-    ListView_EnableGroupView(hList, FALSE);
-
-    // HWND hGroupList = GetDlgItem( m_hAchievementEditorDlg, IDC_RA_ACH_GROUP );
-    // ListBox_AddString(
-    // bSuccess = ListView_SetExtendedListViewStyle( hGroupList, LVS_EX_FULLROWSELECT );
-    // bSuccess = ListView_EnableGroupView( hGroupList, FALSE );
-
-    ra::api::FetchBadgeIds::Request request;
-    request.CallAsync([this](const ra::api::FetchBadgeIds::Response & response)
-        {
-            m_nFirstBadge = response.FirstID;
-            m_nNextBadge = response.NextID;
-        });
-}
-
-BOOL Dlg_AchievementEditor::IsActive() const noexcept
-{
-    return (g_AchievementEditorDialog.GetHWND() != nullptr) && (IsWindowVisible(g_AchievementEditorDialog.GetHWND()));
-}
-
-const int Dlg_AchievementEditor::AddCondition(HWND hList, const Condition& Cond, unsigned int nCurrentHits)
-{
-    m_lbxData.emplace_back();
-    const int rowIdx = gsl::narrow_cast<int>(m_lbxData.size()) - 1;
-
-    LV_ITEM item{};
-    item.mask = LVIF_TEXT;
-    item.cchTextMax = 256;
-    item.iItem = rowIdx;
-    ra::tstring sData{NativeStr(LbxDataAt(rowIdx, CondSubItems::Id))};
-    item.pszText = sData.data();
-    item.iItem = ListView_InsertItem(hList, &item);
-
-    UpdateCondition(hList, item, Cond, nCurrentHits);
-
-    Ensures(item.iItem == static_cast<int>(m_lbxData.size() - 1));
-
-    return item.iItem;
-}
-
-void Dlg_AchievementEditor::SetCell(HWND hList, LV_ITEM& lvItem, int nRow, CondSubItems nColumn, const std::string& sNewValue)
-{
-    std::string& sCell = LbxDataAt(nRow, nColumn);
-    if (sCell != sNewValue)
-    {
-        sCell.assign(sNewValue);
-        lvItem.iSubItem = gsl::narrow_cast<int>(ra::etoi(nColumn));
-        lvItem.pszText = sCell.data();
-        ListView_SetItem(hList, &lvItem);
-    }
-}
-
-void Dlg_AchievementEditor::SetCell(HWND hList, LV_ITEM& lvItem, int nRow, CondSubItems nColumn, std::string&& sNewValue) noexcept
-{
-    std::string& sCell = LbxDataAt(nRow, nColumn);
-    if (sCell != sNewValue)
-    {
-        sCell = std::move(sNewValue);
-        lvItem.iSubItem = gsl::narrow_cast<int>(ra::etoi(nColumn));
-        lvItem.pszText = sCell.data();
-        ListView_SetItem(hList, &lvItem);
-    }
-}
-
-void Dlg_AchievementEditor::UpdateCondition(HWND hList, LV_ITEM& item, const Condition& Cond, unsigned int nCurrentHits)
-{
-    const int nRow = item.iItem;
-
-    bool bValueInDecimal = false;
-    if (!Cond.CompTarget().IsMemoryType() || !Cond.CompSource().IsMemoryType())
-    {
-        auto& pConfiguration = ra::services::ServiceLocator::Get<ra::services::IConfiguration>();
-        if (pConfiguration.IsFeatureEnabled(ra::services::Feature::PreferDecimal))
-            bValueInDecimal = true;
-    }
-
-    // Update our local array:
-    SetCell(hList, item, nRow, CondSubItems::Id, std::to_string(nRow + 1));
-
-    SetCell(hList, item, nRow, CondSubItems::Group, ra::Narrow(Condition::TYPE_STR.at(ra::etoi(Cond.GetConditionType()))));
-
-    SetCell(hList, item, nRow, CondSubItems::Type_Src,  ra::Narrow(CompVariable::TYPE_STR.at(ra::etoi(Cond.CompSource().GetType()))));
-
-    if (Cond.CompSource().IsMemoryType())
-    {
-        SetCell(hList, item, nRow, CondSubItems::Size_Src, ra::Narrow(MEMSIZE_STR.at(ra::etoi(Cond.CompSource().GetSize()))));
-        SetCell(hList, item, nRow, CondSubItems::Value_Src, ra::Narrow(ra::ByteAddressToString(Cond.CompSource().GetValue())));
-    }
-    else
-    {
-        SetCell(hList, item, nRow, CondSubItems::Size_Src, "");
-
-        if (bValueInDecimal)
-            SetCell(hList, item, nRow, CondSubItems::Value_Src, std::to_string(Cond.CompSource().GetValue()));
-        else
-            SetCell(hList, item, nRow, CondSubItems::Value_Src, ra::StringPrintf("0x%02x", Cond.CompSource().GetValue()));
-    }
-
-    if (Cond.IsSingleOperandConditionType())
-    {
-        SetCell(hList, item, nRow, CondSubItems::Comparison, "");
-        SetCell(hList, item, nRow, CondSubItems::Type_Tgt, "");
-        SetCell(hList, item, nRow, CondSubItems::Size_Tgt, "");
-        SetCell(hList, item, nRow, CondSubItems::Value_Tgt, "");
-        SetCell(hList, item, nRow, CondSubItems::Hitcount, "");
-    }
-    else
-    {
-        SetCell(hList, item, nRow, CondSubItems::Comparison, ra::Narrow(COMPARISONTYPE_STR.at(ra::etoi(Cond.CompareType()))));
-
-        SetCell(hList, item, nRow, CondSubItems::Type_Tgt, ra::Narrow(CompVariable::TYPE_STR.at(ra::etoi(Cond.CompTarget().GetType()))));
-
-        if (Cond.CompTarget().IsMemoryType())
-        {
-            SetCell(hList, item, nRow, CondSubItems::Size_Tgt, ra::Narrow(MEMSIZE_STR.at(ra::etoi(Cond.CompTarget().GetSize()))));
-            SetCell(hList, item, nRow, CondSubItems::Value_Tgt, ra::Narrow(ra::ByteAddressToString(Cond.CompTarget().GetValue())));
-        }
-        else
-        {
-            SetCell(hList, item, nRow, CondSubItems::Size_Tgt, "");
-
-            if (bValueInDecimal)
-                SetCell(hList, item, nRow, CondSubItems::Value_Tgt, std::to_string(Cond.CompTarget().GetValue()));
-            else
-                SetCell(hList, item, nRow, CondSubItems::Value_Tgt, ra::StringPrintf("0x%02x", Cond.CompTarget().GetValue()));
-        }
-
-        SetCell(hList, item, nRow, CondSubItems::Hitcount, ra::StringPrintf("%u (%u)", Cond.RequiredHits(), nCurrentHits));
-    }
-}
-
-WNDPROC EOldProc;
-HWND g_hIPEEdit;
-int nSelItem;
-int nSelSubItem;
-
-LRESULT CALLBACK EditProc(HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam) noexcept
-{
-    switch (nMsg)
-    {
-        case WM_DESTROY:
-            g_hIPEEdit = nullptr;
-            break;
-
-        case WM_KILLFOCUS:
-        {
-            LV_DISPINFO lvDispinfo;
-            ZeroMemory(&lvDispinfo, sizeof(LV_DISPINFO));
-            lvDispinfo.hdr.hwndFrom = hwnd;
-            lvDispinfo.hdr.idFrom = GetDlgCtrlID(hwnd);
-            // inline suppression not working, and by function not working, have to disable it by code
-
-#pragma warning(suppress: 26454)
-            GSL_SUPPRESS(io.5) lvDispinfo.hdr.code = LVN_ENDLABELEDIT;
-
-            lvDispinfo.item.mask = LVIF_TEXT;
-            lvDispinfo.item.iItem = nSelItem;
-            lvDispinfo.item.iSubItem = nSelSubItem;
-            lvDispinfo.item.pszText = nullptr;
-
-            std::array<char, 12> sEditText{};
-            GetWindowTextA(hwnd, sEditText.data(), 12);
-            lvDispinfo.item.pszText = sEditText.data();
-            lvDispinfo.item.cchTextMax = gsl::narrow_cast<int>(std::strlen(sEditText.data()));
-
-            HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_LBX_CONDITIONS);
-
-            // the LV ID and the LVs Parent window's HWND
-            FORWARD_WM_NOTIFY(GetParent(hList), IDC_RA_LBX_CONDITIONS, &lvDispinfo, SendMessage); // ##reinterpret? ##SD
-
-            if (g_AchievementEditorDialog.LbxDataAt(lvDispinfo.item.iItem, CondSubItems::Type_Tgt).compare("Value") == 0)
-            {
-                // Remove the associated 'size' entry
-                if ((lvDispinfo.item.iItem >= 0) && (lvDispinfo.item.iSubItem >= 1))
-                {
-                    g_AchievementEditorDialog
-                        .LbxDataAt(lvDispinfo.item.iItem, ra::itoe<CondSubItems>(lvDispinfo.item.iSubItem))
-                        .clear();
-                }
-            }
-
-            DestroyWindow(hwnd);
-            return 0;
-        }
-
-        case WM_KEYDOWN:
-        {
-            if (wParam == VK_RETURN || wParam == VK_ESCAPE)
-            {
-                DestroyWindow(hwnd); // Causing a killfocus :)
-            }
-            else
-            {
-                // Ignore keystroke, or pass it into the edit box!
-                break;
-            }
-
-            break;
-        }
-    }
-
-    return CallWindowProc(EOldProc, hwnd, nMsg, wParam, lParam);
-}
-
-LRESULT CALLBACK DropDownProc(HWND hwnd, UINT nMsg, WPARAM wParam, LPARAM lParam) noexcept
-{
-    if (nMsg == WM_COMMAND)
-    {
-        if (HIWORD(wParam) == CBN_SELCHANGE)
-        {
-            LV_DISPINFO lvDispinfo;
-            ZeroMemory(&lvDispinfo, sizeof(LV_DISPINFO));
-            lvDispinfo.hdr.hwndFrom = hwnd;
-            lvDispinfo.hdr.idFrom = GetDlgCtrlID(hwnd);
-#pragma warning(suppress: 26454)
-            GSL_SUPPRESS(io.5) lvDispinfo.hdr.code = LVN_ENDLABELEDIT;
-            lvDispinfo.item.mask = LVIF_TEXT;
-            lvDispinfo.item.iItem = nSelItem;
-            lvDispinfo.item.iSubItem = nSelSubItem;
-            lvDispinfo.item.pszText = nullptr;
-
-            TCHAR sEditText[32];
-            GetWindowText(hwnd, sEditText, 32);
-            lvDispinfo.item.pszText = sEditText;
-            lvDispinfo.item.cchTextMax = lstrlen(sEditText);
-
-            // the LV ID and the LVs Parent window's HWND
-            HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_LBX_CONDITIONS);
-            FORWARD_WM_NOTIFY(GetParent(hList), IDC_RA_LBX_CONDITIONS, &lvDispinfo, SendMessage);
-            DestroyWindow(hwnd);
-        }
-    }
-
-    switch (nMsg)
-    {
-        case WM_DESTROY:
-            g_hIPEEdit = nullptr;
-            break;
-
-        case WM_KILLFOCUS:
-        {
-            LV_DISPINFO lvDispinfo;
-            ZeroMemory(&lvDispinfo, sizeof(LV_DISPINFO));
-            lvDispinfo.hdr.hwndFrom = hwnd;
-            lvDispinfo.hdr.idFrom = GetDlgCtrlID(hwnd);
-#pragma warning(suppress: 26454)
-            GSL_SUPPRESS(io.5) lvDispinfo.hdr.code = LVN_ENDLABELEDIT;
-            lvDispinfo.item.mask = LVIF_TEXT;
-            lvDispinfo.item.iItem = nSelItem;
-            lvDispinfo.item.iSubItem = nSelSubItem;
-            lvDispinfo.item.pszText = nullptr;
-
-            TCHAR sEditText[32];
-            GetWindowText(hwnd, sEditText, 32);
-            lvDispinfo.item.pszText = sEditText;
-            lvDispinfo.item.cchTextMax = lstrlen(sEditText);
-
-            HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_LBX_CONDITIONS);
-
-            // the LV ID and the LVs Parent window's HWND
-            FORWARD_WM_NOTIFY(GetParent(hList), IDC_RA_LBX_CONDITIONS, &lvDispinfo, SendMessage);
-
-            // DestroyWindow(hwnd);
-            DestroyWindow(hwnd);
-            return 0;
-        }
-        break;
-
-        case WM_KEYDOWN:
-            if (wParam == VK_RETURN)
-            {
-                DestroyWindow(hwnd);
-            }
-            else if (wParam == VK_ESCAPE)
-            {
-                // Undo changes: i.e. simply destroy the window!
-                DestroyWindow(hwnd);
-            }
-            else
-            {
-                // Ignore keystroke, or pass it into the edit box!
-            }
-
-            break;
-
-        case WM_COMMAND:
-            switch (HIWORD(wParam))
-            {
-                case CBN_SELENDOK:
-                case CBN_SELENDCANCEL:
-                case CBN_SELCHANGE:
-                case CBN_CLOSEUP:
-                case CBN_KILLFOCUS:
-                    break;
-            }
-    }
-
-    return CallWindowProc(EOldProc, hwnd, nMsg, wParam, lParam);
-}
-
-BOOL CreateIPE(int nItem, CondSubItems nSubItem)
-{
-    BOOL bSuccess = FALSE;
-
-    HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_LBX_CONDITIONS);
-
-    RECT rcSubItem{};
-    GSL_SUPPRESS_ES47 ListView_GetSubItemRect(hList, nItem,
-        gsl::narrow_cast<int>(ra::etoi(nSubItem)), LVIR_BOUNDS, &rcSubItem);
-
-    RECT rcOffset{};
-    GetWindowRect(hList, &rcOffset);
-
-    rcSubItem.left += rcOffset.left;
-    rcSubItem.right += rcOffset.left;
-    rcSubItem.top += rcOffset.top;
-    rcSubItem.bottom += rcOffset.top;
-
-    const int nHeight = rcSubItem.bottom - rcSubItem.top;
-    int nWidth = rcSubItem.right - rcSubItem.left;
-    if (nSubItem == CondSubItems())
-        nWidth = nWidth / 4; /*NOTE: the ListView has 4 columns;
-                            when iSubItem == 0 (an item is clicked),
-                            the width (largura) is divided by 4,
-                            because for items (not subitems) the
-                            width returned is that of the whole row.*/
-
-    switch (nSubItem)
-    {
-        case CondSubItems::Id:
-            ASSERT(!"First element does nothing!"); // nothing we do if we click the first element!
-            break;
-
-        case CondSubItems::Group:
-        {
-            // Condition: dropdown
-            ASSERT(g_hIPEEdit == nullptr);
-            if (g_hIPEEdit)
-                break;
-
-            g_hIPEEdit =
-                CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("ComboBox"), TEXT(""),
-                               WS_CHILD | WS_VISIBLE | WS_POPUPWINDOW | WS_BORDER | CBS_DROPDOWNLIST, rcSubItem.left,
-                               rcSubItem.top, nWidth, ra::ftol(1.6F * nHeight * Condition::TYPE_STR.size()),
-                               g_AchievementEditorDialog.GetHWND(), nullptr, GetModuleHandle(nullptr), nullptr);
-
-            if (g_hIPEEdit == nullptr)
-            {
-                ASSERT(!"Could not create combo box!");
-                MessageBox(nullptr, TEXT("Could not create combo box."), TEXT("Error"), MB_OK | MB_ICONERROR);
-                break;
-            };
-
-            for (const auto str : Condition::TYPE_STR)
-            {
-                const auto i = ComboBox_AddString(g_hIPEEdit, str);
-                if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == ra::Narrow(str))
-                    ComboBox_SetCurSel(g_hIPEEdit, i);
-            }
-
-            SetWindowFont(g_hIPEEdit, GetStockObject(DEFAULT_GUI_FONT), TRUE);
-            ComboBox_ShowDropdown(g_hIPEEdit, TRUE);
-
-            EOldProc = SubclassWindow(g_hIPEEdit, DropDownProc);
-        }
-        break;
-
-        case CondSubItems::Type_Src:
-        case CondSubItems::Type_Tgt:
-        {
-            // GetType: dropdown
-            ASSERT(g_hIPEEdit == nullptr);
-            if (g_hIPEEdit)
-                break;
-
-            if (nSubItem == CondSubItems::Type_Tgt)
-            {
-                const size_t nGrp = g_AchievementEditorDialog.GetSelectedConditionGroup();
-                const Condition& Cond = g_AchievementEditorDialog.ActiveAchievement()->GetCondition(nGrp, nItem);
-
-                if (Cond.IsSingleOperandConditionType())
-                    break;
-            }
-
-            constexpr int nNumItems = 4; // "Mem", "Delta", "Prior" or "Value"
-
-            g_hIPEEdit =
-                CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("ComboBox"), TEXT(""),
-                               WS_CHILD | WS_VISIBLE | WS_POPUPWINDOW | WS_BORDER | CBS_DROPDOWNLIST, rcSubItem.left,
-                               rcSubItem.top, nWidth, static_cast<int>(1.6f * nHeight * nNumItems),
-                               g_AchievementEditorDialog.GetHWND(), nullptr, GetModuleHandle(nullptr), nullptr);
-
-            if (g_hIPEEdit == nullptr)
-            {
-                ASSERT(!"Could not create edit box!");
-                MessageBox(nullptr, TEXT("Could not create edit box."), TEXT("Error"), MB_OK | MB_ICONERROR);
-                break;
-            };
-
-            /*CB_ERRSPACE*/
-            ComboBox_AddString(g_hIPEEdit, NativeStr("Mem").c_str());
-            ComboBox_AddString(g_hIPEEdit, NativeStr("Delta").c_str());
-            ComboBox_AddString(g_hIPEEdit, NativeStr("Prior").c_str());
-            ComboBox_AddString(g_hIPEEdit, NativeStr("Value").c_str());
-
-            int nSel{};
-            if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == "Mem")
-                nSel = 0;
-            else if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == "Delta")
-                nSel = 1;
-            else if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == "Prior")
-                nSel = 2;
-            else
-                nSel = 3;
-
-            ComboBox_SetCurSel(g_hIPEEdit, nSel);
-
-            SetWindowFont(g_hIPEEdit, GetStockObject(DEFAULT_GUI_FONT), TRUE);
-            ComboBox_ShowDropdown(g_hIPEEdit, TRUE);
-
-            EOldProc = SubclassWindow(g_hIPEEdit, DropDownProc);
-        }
-        break;
-        case CondSubItems::Size_Src:
-        case CondSubItems::Size_Tgt:
-        {
-            // Size: dropdown
-            ASSERT(g_hIPEEdit == nullptr);
-            if (g_hIPEEdit)
-                break;
-
-            // Note: this relies on column order :S
-            using namespace ra::arith_ops;
-            if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem - 1) == "Value")
-            {
-                // Values have no size.
-                break;
-            }
-
-            if (nSubItem == CondSubItems::Size_Tgt)
-            {
-                const size_t nGrp = g_AchievementEditorDialog.GetSelectedConditionGroup();
-                const Condition& Cond = g_AchievementEditorDialog.ActiveAchievement()->GetCondition(nGrp, nItem);
-
-                if (Cond.IsSingleOperandConditionType())
-                    break;
-            }
-
-            g_hIPEEdit =
-                CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("ComboBox"), TEXT(""),
-                               WS_CHILD | WS_VISIBLE | WS_POPUPWINDOW | WS_BORDER | CBS_DROPDOWNLIST, rcSubItem.left,
-                               rcSubItem.top, nWidth, ra::ftoi(1.6f * nHeight * MEMSIZE_STR.size()),
-                               g_AchievementEditorDialog.GetHWND(), nullptr, GetModuleHandle(nullptr), nullptr);
-
-            if (g_hIPEEdit == nullptr)
-            {
-                ASSERT(!"Could not create combo box!");
-                MessageBox(nullptr, TEXT("Could not create combo box."), TEXT("Error"), MB_OK | MB_ICONERROR);
-                break;
-            };
-
-            for (auto& str : MEMSIZE_STR)
-            {
-                const auto i{ComboBox_AddString(g_hIPEEdit, str)};
-                if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == ra::Narrow(str))
-                    ComboBox_SetCurSel(g_hIPEEdit, i);
-            }
-
-            SetWindowFont(g_hIPEEdit, GetStockObject(DEFAULT_GUI_FONT), TRUE);
-            ComboBox_ShowDropdown(g_hIPEEdit, TRUE);
-
-            EOldProc = SubclassWindow(g_hIPEEdit, DropDownProc);
-        }
-        break;
-        case CondSubItems::Comparison:
-        {
-            // Compare: dropdown
-            ASSERT(g_hIPEEdit == nullptr);
-            if (g_hIPEEdit)
-                break;
-
-            const size_t nGrp = g_AchievementEditorDialog.GetSelectedConditionGroup();
-            const Condition& Cond = g_AchievementEditorDialog.ActiveAchievement()->GetCondition(nGrp, nItem);
-            if (Cond.IsSingleOperandConditionType())
-                break;
-
-            g_hIPEEdit =
-                CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("ComboBox"), TEXT(""),
-                               WS_CHILD | WS_VISIBLE | WS_POPUPWINDOW | WS_BORDER | CBS_DROPDOWNLIST, rcSubItem.left,
-                               rcSubItem.top, nWidth, static_cast<int>(1.6F * nHeight * COMPARISONTYPE_STR.size()),
-                               g_AchievementEditorDialog.GetHWND(), nullptr, GetModuleHandle(nullptr), nullptr);
-
-            if (g_hIPEEdit == nullptr)
-            {
-                ASSERT(!"Could not create combo box...");
-                MessageBox(nullptr, TEXT("Could not create combo box."), TEXT("Error"), MB_OK | MB_ICONERROR);
-                break;
-            };
-
-            for (const auto str : COMPARISONTYPE_STR)
-            {
-                const auto idx = ComboBox_AddString(g_hIPEEdit, str);
-                if (g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem) == ra::Narrow(str))
-                    ComboBox_SetCurSel(g_hIPEEdit, idx);
-            }
-
-            SetWindowFont(g_hIPEEdit, GetStockObject(DEFAULT_GUI_FONT), TRUE);
-            ComboBox_ShowDropdown(g_hIPEEdit, TRUE);
-
-            EOldProc = SubclassWindow(g_hIPEEdit, DropDownProc);
-        }
-        break;
-        case CondSubItems::Hitcount:
-        case CondSubItems::Value_Src: // Mem/Val: edit
-        case CondSubItems::Value_Tgt: // Mem/Val: edit
-        {
-            ASSERT(g_hIPEEdit == nullptr);
-            if (g_hIPEEdit)
-                break;
-
-            if (nSubItem != CondSubItems::Value_Src)
-            {
-                const size_t nGrp = g_AchievementEditorDialog.GetSelectedConditionGroup();
-                const Condition& Cond = g_AchievementEditorDialog.ActiveAchievement()->GetCondition(nGrp, nItem);
-
-                if (Cond.IsSingleOperandConditionType())
-                    break;
-            }
-
-            g_hIPEEdit = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("EDIT"), TEXT(""),
-                                        WS_CHILD | WS_VISIBLE | WS_POPUPWINDOW | WS_BORDER | ES_WANTRETURN | ES_AUTOHSCROLL,
-                                        rcSubItem.left, rcSubItem.top, nWidth, ra::ftoi(1.5f * nHeight),
-                                        g_AchievementEditorDialog.GetHWND(), nullptr, GetModuleHandle(nullptr), nullptr);
-
-            if (g_hIPEEdit == nullptr)
-            {
-                ASSERT(!"Could not create edit box!");
-                MessageBox(nullptr, TEXT("Could not create edit box."), TEXT("Error"), MB_OK | MB_ICONERROR);
-                break;
-            };
-
-            SetWindowFont(g_hIPEEdit, GetStockObject(DEFAULT_GUI_FONT), TRUE);
-
-            const auto& pData = g_AchievementEditorDialog.LbxDataAt(nItem, nSubItem);
-            SetWindowText(g_hIPEEdit, NativeStr(pData).c_str());
-
-            // Special case, hitcounts
-            if (nSubItem == CondSubItems::Hitcount)
-            {
-                if (g_AchievementEditorDialog.ActiveAchievement() != nullptr)
-                {
-                    const size_t nGrp = g_AchievementEditorDialog.GetSelectedConditionGroup();
-                    const Condition& Cond = g_AchievementEditorDialog.ActiveAchievement()->GetCondition(nGrp, nItem);
-
-                    char buffer[256];
-                    sprintf_s(buffer, 256, "%u", Cond.RequiredHits());
-                    SetWindowText(g_hIPEEdit, NativeStr(buffer).c_str());
-                }
-            }
-
-            SendMessage(g_hIPEEdit, EM_SETSEL, 0, -1);
-            SetFocus(g_hIPEEdit);
-            EOldProc = SubclassWindow(g_hIPEEdit, EditProc);
-
-            bSuccess = TRUE;
-        }
-
-        break;
-    }
-
-    return bSuccess;
-}
-
-// static
-LRESULT CALLBACK Dlg_AchievementEditor::ListViewWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) noexcept
-{
-    switch (uMsg)
-    {
-        case WM_MOUSEMOVE:
-            LVHITTESTINFO lvHitTestInfo;
-            GetCursorPos(&lvHitTestInfo.pt);
-            ScreenToClient(hWnd, &lvHitTestInfo.pt);
-
-            int nTooltipLocation = -1;
-            if (ListView_SubItemHitTest(hWnd, &lvHitTestInfo) != -1)
-                nTooltipLocation = lvHitTestInfo.iItem * 256 + lvHitTestInfo.iSubItem;
-
-            // if the mouse has moved to a new grid cell, hide the toolip
-            if (nTooltipLocation != g_AchievementEditorDialog.m_nTooltipLocation)
-            {
-                g_AchievementEditorDialog.m_nTooltipLocation = nTooltipLocation;
-
-                if (IsWindowVisible(g_AchievementEditorDialog.m_hTooltip))
-                {
-                    // tooltip is visible, just hide it
-                    SendMessage(g_AchievementEditorDialog.m_hTooltip, TTM_POP, 0, 0);
-                }
-                else
-                {
-                    // tooltip is not visible. if we told the tooltip to not display in the TTM_GETDISPINFO handler by
-                    // setting lpszText to empty string, it won't try to display again unless we tell it to, so do so
-                    // now
-                    SendMessage(g_AchievementEditorDialog.m_hTooltip, TTM_POPUP, 0, 0);
-                    // but we don't want the tooltip to immediately display when entering a new cell, so immediately
-                    // hide it. the normal hover behavior will make it display as expected after a normal hover wait
-                    // time.
-                    SendMessage(g_AchievementEditorDialog.m_hTooltip, TTM_POP, 0, 0);
-                }
-            }
-            break;
-    }
-
-    return CallWindowProc(g_AchievementEditorDialog.m_pListViewWndProc, hWnd, uMsg, wParam, lParam);
-}
-
-// static
-INT_PTR CALLBACK Dlg_AchievementEditor::s_AchievementEditorProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    // Intercept some msgs?
-    return g_AchievementEditorDialog.AchievementEditorProc(hDlg, uMsg, wParam, lParam);
-}
-
-INT_PTR Dlg_AchievementEditor::AchievementEditorProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    BOOL bHandled = TRUE;
-
-    switch (uMsg)
-    {
-        case WM_TIMER:
-        {
-            // Ignore if we are currently editing a box!
-            if (g_hIPEEdit != nullptr || m_bIgnoreTimer)
-                break;
-
-            Achievement* pActiveAch = ActiveAchievement();
-            if (pActiveAch == nullptr)
-                break;
-
-            if (pActiveAch->IsDirty())
-            {
-                m_bIgnoreTimer = true;
-                LoadAchievement(pActiveAch, TRUE);
-                pActiveAch->ClearDirtyFlag();
-                m_bIgnoreTimer = false;
-            }
-        }
-        break;
-
-        case WM_INITDIALOG:
-        {
-            m_hAchievementEditorDlg = hDlg;
-            GenerateResizes(hDlg);
-
-            HWND hList = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS);
-            SetupColumns(hList);
-            auto& pConfiguration = ra::services::ServiceLocator::Get<ra::services::IConfiguration>();
-            CheckDlgButton(hDlg, IDC_RA_CHK_SHOW_DECIMALS,
-                           pConfiguration.IsFeatureEnabled(ra::services::Feature::PreferDecimal));
-
-            // For scanning changes to achievement conditions (hit counts)
-            SetTimer(m_hAchievementEditorDlg, 1, 200, (TIMERPROC)s_AchievementEditorProc);
-
-            // achievement loaded before UI was created won't have populated the UI. reload it.
-            if (m_pSelectedAchievement != nullptr)
-            {
-                auto* pAchievement = m_pSelectedAchievement;
-                m_pSelectedAchievement = nullptr;
-                LoadAchievement(pAchievement, false);
-            }
-
-            if (!ra::services::ServiceLocator::Get<ra::data::context::EmulatorContext>().CanPause())
-            {
-                ShowWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER), SW_HIDE);
-                ShowWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_PAUSE_ON_RESET), SW_HIDE);
-            }
-
-            // set up the list view tooltip
-            m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, nullptr, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX,
-                                        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hDlg, nullptr,
-                                        GetInstanceModule(g_hThisDLLInst), nullptr);
-            if (m_hTooltip)
-            {
-                TOOLINFO toolInfo;
-                memset(&toolInfo, 0, sizeof(toolInfo));
-                GSL_SUPPRESS_ES47 toolInfo.cbSize = TTTOOLINFO_V1_SIZE;
-                toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
-                toolInfo.hwnd = hDlg;
-                GSL_SUPPRESS_TYPE1 toolInfo.uId = reinterpret_cast<UINT_PTR>(hList);
-                toolInfo.lpszText = LPSTR_TEXTCALLBACK;
-                GSL_SUPPRESS_TYPE1 SendMessage(m_hTooltip, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&toolInfo));
-                SendMessage(m_hTooltip, TTM_ACTIVATE, TRUE, 0);
-                SendMessage(m_hTooltip, TTM_SETMAXTIPWIDTH, 0, 320);
-                SendMessage(m_hTooltip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 30000); // show for 30 seconds
-
-                // install a mouse hook so we can show different tooltips per cell within the list view
-                m_pListViewWndProc = SubclassWindow(hList, ListViewWndProc);
-            }
-
-            LV_COLUMN col{};
-            col.mask = LVCF_WIDTH | LVCF_FMT;
-            col.fmt = LVCFMT_FIXED_WIDTH | LVCFMT_LEFT;
-            col.cx = 50;
-            ListView_InsertColumn(GetDlgItem(hDlg, IDC_RA_ACH_GROUP), 0, &col);
-
-            RestoreWindowPosition(hDlg, "Achievement Editor", true, true);
-        }
-            return TRUE;
-
-        case WM_GETMINMAXINFO:
-        {
-            LPMINMAXINFO lpmmi{};
-            GSL_SUPPRESS_TYPE1 lpmmi = reinterpret_cast<LPMINMAXINFO>(lParam);
-            lpmmi->ptMinTrackSize = pDlgAchEditorMin;
-        }
-        break;
-
-        case WM_SIZE:
-        {
-            RARect winRect;
-            GetWindowRect(hDlg, &winRect);
-
-            for (ResizeContent content : vDlgAchEditorResize)
-                content.Resize(winRect.Width(), winRect.Height());
-
-            InvalidateRect(hDlg, nullptr, TRUE);
-
-            RememberWindowSize(hDlg, "Achievement Editor");
-        }
-        break;
-
-        case WM_MOVE:
-            RememberWindowPosition(hDlg, "Achievement Editor");
-            break;
-
-        case WM_COMMAND:
-            switch (LOWORD(wParam))
-            {
-                case IDCLOSE:
-                    EndDialog(hDlg, true);
-                    bHandled = TRUE;
-                    break;
-
-                case IDC_RA_CHK_SHOW_DECIMALS:
-                {
-                    auto& pConfiguration = ra::services::ServiceLocator::GetMutable<ra::services::IConfiguration>();
-                    pConfiguration.SetFeatureEnabled(
-                        ra::services::Feature::PreferDecimal,
-                        !pConfiguration.IsFeatureEnabled(ra::services::Feature::PreferDecimal));
-                    if (ActiveAchievement() != nullptr)
-                    {
-                        ActiveAchievement()->SetDirtyFlag(Achievement::DirtyFlags::All);
-                        LoadAchievement(ActiveAchievement(), TRUE);
-                        ActiveAchievement()->ClearDirtyFlag();
-                    }
-                    bHandled = TRUE;
-                    break;
-                }
-
-                case IDC_RA_CHK_ACH_ACTIVE:
-                    if (ActiveAchievement() != nullptr)
-                    {
-                        SendMessage(g_AchievementsDialog.GetHWND(), WM_COMMAND, IDC_RA_RESET_ACH, 0L);
-                        CheckDlgButton(hDlg, IDC_RA_CHK_ACH_ACTIVE, ActiveAchievement()->Active());
-                    }
-                    bHandled = TRUE;
-                    break;
-
-                case IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER:
-                {
-                    if (ActiveAchievement() != nullptr)
-                        ActiveAchievement()->SetPauseOnTrigger(!ActiveAchievement()->GetPauseOnTrigger());
-
-                    bHandled = TRUE;
-                }
-                break;
-
-                case IDC_RA_CHK_ACH_PAUSE_ON_RESET:
-                {
-                    if (ActiveAchievement() != nullptr)
-                        ActiveAchievement()->SetPauseOnReset(!ActiveAchievement()->GetPauseOnReset());
-
-                    bHandled = TRUE;
-                }
-                break;
-
-                case IDC_RA_BADGENAME:
-                {
-                    switch (HIWORD(wParam))
-                    {
-                        case EN_KILLFOCUS:
-                        {
-                            if (IsPopulatingAchievementEditorData())
-                                return TRUE;
-
-                            Achievement* pActiveAch = ActiveAchievement();
-                            if (pActiveAch == nullptr)
-                                return FALSE;
-
-                            std::string buffer(16, '\0');
-                            const auto nLength = GetDlgItemTextA(hDlg, IDC_RA_BADGENAME, buffer.data(), 16);
-                            if (nLength == 0)
-                                return FALSE;
-
-                            buffer.resize(nLength);
-                            if (buffer.length() < 5)
-                                buffer.insert(0, 5 - buffer.length(), '0');
-
-                            unsigned int nVal = 0;
-                            try
-                            {
-                                nVal = ra::to_unsigned(std::stoi(NativeStr(buffer)));
-                            }
-                            catch (const std::invalid_argument& e)
-                            {
-                                RA_LOG_ERR("Invalid Argument: %s", e.what());
-                                ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(
-                                    L"The badge field may only contain digits."); // for users
-
-                                // Set it back to 0 immediately, it won't change back by itself
-                                SetDlgItemTextA(hDlg, IDC_RA_ACH_POINTS, "00000");
-                                return FALSE;
-                            }
-
-                            if (nVal < m_nFirstBadge || nVal >= m_nNextBadge)
-                            {
-                                ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(
-                                    ra::StringPrintf(L"Valid badge numbers are between %u and %u.", m_nFirstBadge, m_nNextBadge - 1));
-
-                                return FALSE;
-                            }
-
-                            pActiveAch->SetBadgeImage(buffer);
-                            pActiveAch->SetModified(TRUE);
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            UpdateBadge(buffer);
-                            return TRUE;
-                        }
-                        break;
-                    }
-                }
-                break;
-
-                case IDC_RA_ACH_TITLE:
-                {
-                    switch (HIWORD(wParam))
-                    {
-                        case EN_CHANGE:
-                        {
-                            if (IsPopulatingAchievementEditorData())
-                                return TRUE;
-
-                            Achievement* pActiveAch = ActiveAchievement();
-                            if (pActiveAch == nullptr)
-                                return FALSE;
-
-                            // Disable all achievement tracking
-                            // g_pActiveAchievements->SetPaused( true );
-                            // CheckDlgButton( HWndAchievementsDlg, IDC_RA_CHKACHPROCESSINGACTIVE, FALSE );
-
-                            // Set this achievement as modified
-                            pActiveAch->SetModified(TRUE);
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            HWND hList = GetDlgItem(g_AchievementsDialog.GetHWND(), IDC_RA_LISTACHIEVEMENTS);
-                            const int nSelectedIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                            if (nSelectedIndex != -1)
-                            {
-                                // Implicit updating:
-                                TCHAR buffer[1024] = _T("");
-                                HWND hTitle = GetDlgItem(hDlg, IDC_RA_ACH_TITLE);
-                                if (GetWindowTextLength(hTitle) == 0 || GetDlgItemText(hDlg, IDC_RA_ACH_TITLE, buffer, 1024))
-                                {
-                                    pActiveAch->SetTitle(ra::Narrow(buffer));
-
-                                    // Persist/Update/Inject local LBX data back into LBX (?)
-                                    g_AchievementsDialog.OnEditData(nSelectedIndex,
-                                        Dlg_Achievements::Column::Title, pActiveAch->Title());
-                                }
-                            }
-                        }
-                        break;
-                    }
-                }
-                break;
-                case IDC_RA_ACH_DESC:
-                    switch (HIWORD(wParam))
-                    {
-                        case EN_CHANGE:
-                        {
-                            if (IsPopulatingAchievementEditorData())
-                                return TRUE;
-
-                            Achievement* pActiveAch = ActiveAchievement();
-                            if (pActiveAch == nullptr)
-                                return FALSE;
-
-                            // Disable all achievement tracking:
-                            // g_pActiveAchievements->SetPaused( true );
-                            // CheckDlgButton( HWndAchievementsDlg, IDC_RA_CHKACHPROCESSINGACTIVE, FALSE );
-
-                            // Set this achievement as modified:
-                            pActiveAch->SetModified(TRUE);
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            HWND hList = GetDlgItem(g_AchievementsDialog.GetHWND(), IDC_RA_LISTACHIEVEMENTS);
-                            const int nSelectedIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                            if (nSelectedIndex == -1)
-                                return FALSE;
-
-                            // Implicit updating:
-                            // char* psDesc = g_AchievementsDialog.LbxDataAt( nSelectedIndex, (int)Dlg_Achievements:: );
-                            TCHAR buffer[128] = _T("");
-                            HWND hDescription = GetDlgItem(hDlg, IDC_RA_ACH_DESC);
-                            if (GetWindowTextLength(hDescription) == 0 || GetDlgItemText(hDlg, IDC_RA_ACH_DESC, buffer, 128))
-                                pActiveAch->SetDescription(ra::Narrow(buffer));
-                        }
-                        break;
-                    }
-                    break;
-
-                case IDC_RA_ACH_POINTS:
-                    switch (HIWORD(wParam))
-                    {
-                        case EN_CHANGE:
-                        {
-                            if (IsPopulatingAchievementEditorData())
-                                return TRUE;
-
-                            Achievement* pActiveAch = ActiveAchievement();
-                            if (pActiveAch == nullptr)
-                                return FALSE;
-
-                            std::string buffer(16, '\0');
-                            if (GetDlgItemTextA(hDlg, IDC_RA_ACH_POINTS, buffer.data(), 16))
-                            {
-                                int nVal = 0;
-                                try
-                                {
-                                    nVal = std::stoi(NativeStr(buffer));
-                                } catch (const std::invalid_argument& e)
-                                {
-                                    RA_LOG_ERR("Invalid Argument: %s", e.what());
-                                    ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(
-                                        L"The points field may only contain digits."); // for users
-
-                                    // Set it back to 0 immediately, it won't change back by itself
-                                    SetWindowText(::GetDlgItem(hDlg, IDC_RA_ACH_POINTS), _T("0"));
-                                    return FALSE;
-                                }
-
-                                if (nVal < 0 || nVal > 100)
-                                    return FALSE;
-
-                                pActiveAch->SetPoints(nVal);
-                                // achievement is now dirty
-                                pActiveAch->SetModified(TRUE);
-                                g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-                                return TRUE;
-                            }
-                        }
-                        break;
-                    }
-                    break;
-
-                case IDC_RA_ADDCOND:
-                {
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch == nullptr)
-                        return FALSE;
-
-                    Condition NewCondition;
-                    NewCondition.CompSource().Set(MemSize::EightBit, CompVariable::Type::Address, 0x0000);
-                    NewCondition.CompTarget().Set(MemSize::EightBit, CompVariable::Type::ValueComparison,
-                                                  0); // Compare defaults!
-
-                    // Helper: guess that the currently watched memory location
-                    //  is probably what they are about to want to add a cond for.
-                    {
-                        const auto& pMemoryInspector = ra::services::ServiceLocator::Get<ra::ui::viewmodels::WindowManager>().MemoryInspector;
-                        const auto nSize = pMemoryInspector.Viewer().GetSize();
-                        const auto nAddress = pMemoryInspector.Viewer().GetAddress();
-
-                        NewCondition.CompSource().SetSize(nSize);
-                        NewCondition.CompSource().SetValue(nAddress);
-
-                        const auto nVal = ra::services::ServiceLocator::Get<ra::data::context::EmulatorContext>().ReadMemory(nAddress, nSize);
-                        NewCondition.CompTarget().SetSize(nSize);
-                        NewCondition.CompTarget().SetValue(nVal);
-                    }
-
-                    const size_t nNewID = pActiveAch->AddCondition(GetSelectedConditionGroup(), NewCondition) - 1;
-
-                    // Disable all achievement tracking:
-                    // g_pActiveAchievements->SetPaused( true );
-                    // CheckDlgButton( HWndAchievementsDlg, IDC_RA_CHKACHPROCESSINGACTIVE, FALSE );
-
-                    // Set this achievement as 'modified'
-                    pActiveAch->SetModified(TRUE);
-                    g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                    LoadAchievement(pActiveAch, FALSE);
-                    pActiveAch->ClearDirtyFlag();
-                    pActiveAch->RebuildTrigger();
-
-                    // Select last item
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    ListView_SetItemState(hList, nNewID, LVIS_FOCUSED | LVIS_SELECTED, ra::to_unsigned(-1));
-                    ListView_EnsureVisible(hList, nNewID, FALSE);
-                }
-                break;
-
-                case IDC_RA_COPYCOND:
-                {
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch != nullptr)
-                    {
-                        const unsigned int uSelectedCount = ListView_GetSelectedCount(hList);
-
-                        if (uSelectedCount > 0)
-                        {
-                            m_ConditionClipboard.Clear();
-
-                            for (int i = ListView_GetNextItem(hList, -1, LVNI_SELECTED); i >= 0;
-                                 i = ListView_GetNextItem(hList, i, LVNI_SELECTED))
-                            {
-                                const Condition& CondToCopy =
-                                    pActiveAch->GetCondition(GetSelectedConditionGroup(), ra::to_unsigned(i));
-
-                                const Condition NewCondition(CondToCopy);
-
-                                m_ConditionClipboard.Add(NewCondition);
-                            }
-                        }
-                        else
-                            return FALSE;
-                    }
-                }
-                break;
-
-                case IDC_RA_PASTECOND:
-                {
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    Achievement* pActiveAch = ActiveAchievement();
-
-                    if (pActiveAch != nullptr)
-                    {
-                        if (m_ConditionClipboard.Count() > 0)
-                        {
-                            for (unsigned int i = 0; i < m_ConditionClipboard.Count(); i++)
-                            {
-                                const size_t nNewID = pActiveAch->AddCondition(GetSelectedConditionGroup(),
-                                                                               m_ConditionClipboard.GetAt(i)) -
-                                                      1;
-                                ListView_SetItemState(hList, nNewID, LVIS_FOCUSED | LVIS_SELECTED, ra::to_unsigned(-1));
-                                ListView_EnsureVisible(hList, nNewID, FALSE);
-                            }
-
-                            // Update this achievement entry as 'modified':
-                            pActiveAch->SetModified(TRUE);
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            LoadAchievement(pActiveAch, FALSE);
-                            pActiveAch->ClearDirtyFlag();
-                            pActiveAch->RebuildTrigger();
-                        }
-                        else
-                            return FALSE;
-                    }
-                }
-                break;
-
-                case IDC_RA_DELETECOND:
-                {
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-
-                    if (nSel != -1)
-                    {
-                        Achievement* pActiveAch = ActiveAchievement();
-                        if (pActiveAch != nullptr)
-                        {
-                            const unsigned int uSelectedCount = ListView_GetSelectedCount(hList);
-
-                            char buffer[256];
-                            sprintf_s(buffer, 256, "Are you sure you wish to delete %u condition(s)?", uSelectedCount);
-                            if (MessageBox(hDlg, NativeStr(buffer).c_str(), TEXT("Warning"), MB_YESNO) == IDYES)
-                            {
-                                nSel = -1;
-                                std::vector<int> items;
-
-                                while ((nSel = ListView_GetNextItem(hList, nSel, LVNI_SELECTED)) != -1)
-                                    items.push_back(nSel);
-
-                                while (!items.empty())
-                                {
-                                    nSel = items.back();
-                                    pActiveAch->RemoveCondition(GetSelectedConditionGroup(), nSel);
-
-                                    items.pop_back();
-                                }
-
-                                // Set this achievement as 'modified'
-                                pActiveAch->SetModified(TRUE);
-                                g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                                // Refresh:
-                                LoadAchievement(pActiveAch, TRUE);
-                                pActiveAch->ClearDirtyFlag();
-                                pActiveAch->RebuildTrigger();
-                            }
-                        }
-                    }
-                }
-                break;
-
-                case IDC_RA_MOVECONDUP:
-                {
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch != nullptr)
-                    {
-                        const int nSelectedIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                        if (nSelectedIndex >= 0)
-                        {
-                            //  Get conditions to move
-                            std::vector<Condition> conditionsToMove;
-                            const size_t nSelectedConditionGroup = GetSelectedConditionGroup();
-
-                            for (int i = nSelectedIndex; i >= 0; i = ListView_GetNextItem(hList, i, LVNI_SELECTED))
-                            {
-                                // as we remove items, the index within the achievement changes, but not in the UI until
-                                // we refresh
-                                const auto nUpdatedIndex = ra::to_unsigned(i) - conditionsToMove.size();
-
-                                const Condition& CondToMove =
-                                    pActiveAch->GetCondition(nSelectedConditionGroup, nUpdatedIndex);
-                                conditionsToMove.push_back(CondToMove);
-                                pActiveAch->RemoveCondition(nSelectedConditionGroup, nUpdatedIndex);
-                            }
-
-                            //  Insert at new location
-                            const int nInsertIndex = (nSelectedIndex > 0) ? nSelectedIndex - 1 : 0;
-                            const size_t nInsertCount = conditionsToMove.size();
-
-                            for (size_t i = 0; i < nInsertCount; ++i)
-                            {
-                                const Condition& CondToMove = conditionsToMove.at(i);
-                                pActiveAch->InsertCondition(nSelectedConditionGroup, nInsertIndex + i, CondToMove);
-                            }
-
-                            // Set this achievement as 'modified'
-                            pActiveAch->SetModified(TRUE);
-                            pActiveAch->RebuildTrigger();
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            // Refresh:
-                            LoadAchievement(pActiveAch, TRUE);
-
-                            //  Update selections
-                            ListView_SetItemState(hList, -1, LVIF_STATE, LVIS_SELECTED);
-                            for (size_t i = 0; i < nInsertCount; ++i)
-                                ListView_SetItemState(hList, nInsertIndex + i, LVIS_FOCUSED | LVIS_SELECTED,
-                                                      ra::to_unsigned(-1));
-
-                            ListView_EnsureVisible(hList, nInsertIndex, FALSE);
-                        }
-
-                        SetFocus(hList);
-                        bHandled = TRUE;
-                    }
-                }
-                break;
-
-                case IDC_RA_MOVECONDDOWN:
-                {
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS);
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch != nullptr)
-                    {
-                        int nSelectedIndex = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                        if (nSelectedIndex >= 0)
-                        {
-                            //  Get conditions to move
-                            std::vector<Condition> conditionsToMove;
-                            const size_t nSelectedConditionGroup = GetSelectedConditionGroup();
-
-                            for (int i = nSelectedIndex; i >= 0; i = ListView_GetNextItem(hList, i, LVNI_SELECTED))
-                            {
-                                // as we remove items, the index within the achievement changes, but not in the UI until
-                                // we refresh
-                                const auto nUpdatedIndex = ra::to_unsigned(i) - conditionsToMove.size();
-
-                                const Condition& CondToMove =
-                                    pActiveAch->GetCondition(nSelectedConditionGroup, nUpdatedIndex);
-                                conditionsToMove.push_back(CondToMove);
-                                pActiveAch->RemoveCondition(nSelectedConditionGroup, nUpdatedIndex);
-
-                                // want to insert after last selected item, update nSelectedIndex
-                                nSelectedIndex = gsl::narrow_cast<int>(nUpdatedIndex);
-                            }
-
-                            //  Insert at new location
-                            const size_t nConditionCount = pActiveAch->NumConditions(nSelectedConditionGroup);
-                            const size_t nInsertIndex =
-                                (gsl::narrow_cast<size_t>(nSelectedIndex) < nConditionCount) ? gsl::narrow_cast<size_t>(nSelectedIndex) + 1 : nConditionCount;
-                            const size_t nInsertCount = conditionsToMove.size();
-
-                            for (size_t i = 0; i < nInsertCount; ++i)
-                            {
-                                const Condition& CondToMove = conditionsToMove.at(i);
-                                pActiveAch->InsertCondition(nSelectedConditionGroup, nInsertIndex + i, CondToMove);
-                            }
-
-                            // Set this achievement as 'modified'
-                            pActiveAch->SetModified(TRUE);
-                            pActiveAch->RebuildTrigger();
-                            g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-
-                            // Refresh:
-                            LoadAchievement(pActiveAch, TRUE);
-
-                            //  Update selections
-                            ListView_SetItemState(hList, -1, LVIF_STATE, LVIS_SELECTED);
-                            for (size_t i = 0; i < nInsertCount; ++i)
-                                ListView_SetItemState(hList, nInsertIndex + i, LVIS_FOCUSED | LVIS_SELECTED,
-                                                      ra::to_unsigned(-1));
-
-                            ListView_EnsureVisible(hList, nInsertIndex, FALSE);
-                        }
-
-                        SetFocus(hList);
-                        bHandled = TRUE;
-                    }
-                }
-                break;
-
-                case IDC_RA_UPLOAD_BADGE:
-                {
-                    constexpr int BUF_SIZE = 1024;
-                    TCHAR buffer[BUF_SIZE];
-                    ZeroMemory(buffer, BUF_SIZE);
-
-                    OPENFILENAME ofn{};
-                    ofn.lStructSize = sizeof(OPENFILENAME);
-                    ofn.hwndOwner = hDlg;
-                    ofn.hInstance = GetModuleHandle(nullptr);
-                    ofn.lpstrFile = buffer;
-                    ofn.nMaxFile = BUF_SIZE - 1;
-
-                    ofn.lpstrFilter = TEXT(
-                        "Image Files\0"
-                        "*.png;*.gif;*.jpg;*.jpeg\0")
-                        TEXT(
-                            "All Files\0"
-                            "*.*\0\0"); // Last element MUST be doubly-terminated:
-                                        // https://msdn.microsoft.com/en-us/library/windows/desktop/ms646839(v=vs.85).aspx
-
-                    ofn.nFilterIndex = 1;
-                    ofn.lpstrDefExt = TEXT("png");
-                    ofn.Flags = OFN_FILEMUSTEXIST;
-
-                    if (GetOpenFileName(&ofn) == 0) // 0 == cancelled
-                        return FALSE;
-
-                    if (ofn.lpstrFile != nullptr)
-                    {
-                        ra::api::UploadBadge::Request request;
-                        request.ImageFilePath = ra::Widen(ofn.lpstrFile);
-                        const auto response = request.Call();
-                        if (!response.Succeeded())
-                        {
-                            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Failed to upload badge image", ra::Widen(response.ErrorMessage));
-                        }
-                        else
-                        {
-                            ra::ui::viewmodels::MessageBoxViewModel::ShowMessage(L"Upload successful");
-
-                            m_nNextBadge = std::atoi(response.BadgeId.c_str()) + 1;
-                            UpdateBadge(response.BadgeId);
-                        }
-                    }
-                }
-                break;
-
-                case IDC_RA_ACH_ADDGROUP:
-                {
-                    auto* pActiveAchievement = ActiveAchievement();
-                    if (pActiveAchievement == nullptr)
-                        break;
-
-                    if (pActiveAchievement->NumConditionGroups() == 1)
-                    {
-                        pActiveAchievement->AddAltGroup();
-                        pActiveAchievement->AddAltGroup();
-                    }
-                    else if (pActiveAchievement->NumConditionGroups() > 1)
-                    {
-                        pActiveAchievement->AddAltGroup();
-                    }
-
-                    RepopulateGroupList(pActiveAchievement);
-                    pActiveAchievement->RebuildTrigger();
-                    pActiveAchievement->SetModified(true);
-                    g_AchievementsDialog.OnEditAchievement(*pActiveAchievement);
-                }
-                break;
-                case IDC_RA_ACH_DELGROUP:
-                {
-                    auto* pActiveAchievement = ActiveAchievement();
-                    if (pActiveAchievement == nullptr)
-                        break;
-
-                    auto nSel = GetSelectedConditionGroup();
-
-                    if (nSel == 0)
-                    {
-                        ra::ui::viewmodels::MessageBoxViewModel vmWarning(L"Cannot remove core group.");
-                        vmWarning.SetIcon(ra::ui::viewmodels::MessageBoxViewModel::Icon::Warning);
-                        ShowMessageBox(vmWarning, GetHWND());
-                        break;
-                    }
-
-                    if (pActiveAchievement->NumConditions(nSel) > 0)
-                    {
-                        ra::ui::viewmodels::MessageBoxViewModel vmWarning(ra::StringPrintf(L"Alt %02d is not empty. Are you sure that you want to delete it?", nSel));
-                        vmWarning.SetIcon(ra::ui::viewmodels::MessageBoxViewModel::Icon::Warning);
-                        vmWarning.SetButtons(ra::ui::viewmodels::MessageBoxViewModel::Buttons::YesNo);
-                        if (ShowMessageBox(vmWarning, GetHWND()) != ra::ui::DialogResult::Yes)
-                            break;
-                    }
-
-                    pActiveAchievement->RemoveAltGroup(gsl::narrow_cast<gsl::index>(nSel) - 1);
-
-                    if (nSel == pActiveAchievement->NumConditionGroups())
-                        --nSel;
-
-                    SetSelectedConditionGroup(nSel);
-
-                    RepopulateGroupList(pActiveAchievement);
-                    pActiveAchievement->RebuildTrigger();
-                    pActiveAchievement->SetModified(true);
-                    g_AchievementsDialog.OnEditAchievement(*pActiveAchievement);
-                }
-                break;
-            }
-
-            // Switch also on the highword:
-
-            switch (HIWORD(wParam))
-            {
-                case CBN_SELENDOK:
-                case CBN_SELENDCANCEL:
-                case CBN_SELCHANGE:
-                case CBN_CLOSEUP:
-                case CBN_KILLFOCUS:
-                {
-                    // Only post this if the edit control is not empty:
-                    //  if it's empty, we're not dealing with THIS edit control!
-                    if (g_hIPEEdit != nullptr)
-                    {
-                        LV_DISPINFO lvDispinfo;
-                        ZeroMemory(&lvDispinfo, sizeof(LV_DISPINFO));
-                        lvDispinfo.hdr.hwndFrom = g_hIPEEdit;
-                        lvDispinfo.hdr.idFrom = GetDlgCtrlID(g_hIPEEdit);
-#pragma warning(suppress: 26454)
-                        GSL_SUPPRESS(io.5) lvDispinfo.hdr.code = LVN_ENDLABELEDIT;
-                        lvDispinfo.item.mask = LVIF_TEXT;
-                        lvDispinfo.item.iItem = nSelItem;
-                        lvDispinfo.item.iSubItem = nSelSubItem;
-                        lvDispinfo.item.pszText = nullptr;
-
-                        TCHAR sEditText[32];
-                        GetWindowText(g_hIPEEdit, sEditText, 32);
-                        lvDispinfo.item.pszText = sEditText;
-                        lvDispinfo.item.cchTextMax = lstrlen(sEditText);
-
-                        HWND hList = GetDlgItem(GetHWND(), IDC_RA_LBX_CONDITIONS);
-
-                        // the LV ID and the LVs Parent window's HWND
-                        FORWARD_WM_NOTIFY(GetParent(hList), IDC_RA_LBX_CONDITIONS, &lvDispinfo, SendMessage);
-
-                        DestroyWindow(g_hIPEEdit);
-                    }
-                }
-                break;
-            }
-            break;
-
-        case WM_NOTIFY:
-        {
-#pragma warning(push)
-#pragma warning(disable: 26490)
-            GSL_SUPPRESS_TYPE1
-            switch (((reinterpret_cast<LPNMHDR>(lParam))->code))
-#pragma warning(pop)
-            {
-                case NM_CLICK:
-                {
-                    const NMITEMACTIVATE* pOnClick{};
-                    GSL_SUPPRESS_TYPE1 pOnClick = reinterpret_cast<const NMITEMACTIVATE*>(lParam);
-                    // http://cboard.cprogramming.com/windows-programming/122733-%5Bc%5D-editing-subitems-listview-win32-api.html
-
-                    ASSERT(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS) != nullptr);
-
-                    // Note: first item should be an ID!
-                    if (pOnClick->iItem != -1 && pOnClick->iSubItem != 0)
-                    {
-                        nSelItem = pOnClick->iItem;
-                        nSelSubItem = pOnClick->iSubItem;
-
-                        CreateIPE(pOnClick->iItem, ra::itoe<CondSubItems>(pOnClick->iSubItem));
-                    }
-                    else
-                    {
-                        nSelItem = -1;
-                        nSelSubItem = -1;
-                        /*If SubItemHitTest does return error (lResult=-1),
-                        it kills focus of hEdit in order to destroy it.*/
-                        SendMessage(g_hIPEEdit, WM_KILLFOCUS, 0, 0);
-                    }
-                    return 0;
-                }
-                break;
-                case NM_RCLICK:
-                {
-                    const NMITEMACTIVATE* pOnClick{};
-                    GSL_SUPPRESS_TYPE1 pOnClick = reinterpret_cast<const NMITEMACTIVATE*>(lParam);
-
-                    if (pOnClick->iItem != -1 && pOnClick->iSubItem != -1)
-                    {
-                        if (ra::to_unsigned(pOnClick->iItem) >
-                            ActiveAchievement()->NumConditions(GetSelectedConditionGroup()))
-                            return 0;
-
-                        Condition& rCond =
-                            ActiveAchievement()->GetCondition(GetSelectedConditionGroup(), pOnClick->iItem);
-
-                        // HWND hMem = GetDlgItem( HWndMemoryDlg, IDC_RA_WATCHING );
-                        using namespace ra::rel_ops;
-                        if (pOnClick->iSubItem == CondSubItems::Value_Src)
-                        {
-                            if (rCond.CompSource().GetType() != CompVariable::Type::ValueComparison)
-                            {
-                                auto& vmMemory = ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::WindowManager>().MemoryInspector;
-                                if (!vmMemory.IsVisible())
-                                    vmMemory.Show();
-
-                                vmMemory.SetCurrentAddress(rCond.CompSource().GetValue());
-                            }
-                        }
-                        else if (pOnClick->iSubItem == CondSubItems::Value_Tgt)
-                        {
-                            if (rCond.CompTarget().GetType() != CompVariable::Type::ValueComparison)
-                            {
-                                auto& vmMemory = ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::WindowManager>().MemoryInspector;
-                                if (!vmMemory.IsVisible())
-                                    vmMemory.Show();
-
-                                vmMemory.SetCurrentAddress(rCond.CompTarget().GetValue());
-                            }
-                        }
-                    }
-                    bHandled = TRUE;
-                }
-                break;
-
-                case LVN_ENDLABELEDIT:
-                {
-                    NMLVDISPINFO* pDispInfo{};
-                    GSL_SUPPRESS_TYPE1 pDispInfo = reinterpret_cast<NMLVDISPINFO*>(lParam);
-
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch == nullptr)
-                        return FALSE;
-
-                    if (pDispInfo->item.iItem < 0 ||
-                        pDispInfo->item.iItem >= ra::to_signed(pActiveAch->NumConditions(GetSelectedConditionGroup())))
-                        return FALSE;
-
-                    LVITEM lvItem;
-                    lvItem.iItem = pDispInfo->item.iItem;
-                    lvItem.iSubItem = pDispInfo->item.iSubItem;
-                    lvItem.pszText = pDispInfo->item.pszText;
-                    if (pDispInfo->item.iItem == -1 || pDispInfo->item.iSubItem == -1)
-                    {
-                        nSelItem = -1;
-                        nSelSubItem = -1;
-                        break;
-                    }
-
-                    // Get cached data:
-                    auto& sData = LbxDataAt(pDispInfo->item.iItem, ra::itoe<CondSubItems>(pDispInfo->item.iSubItem));
-
-                    // Update modified flag:
-                    if (ra::Narrow(lvItem.pszText) != sData)
-                    {
-                        // Disable all achievement tracking:
-                        // g_pActiveAchievements->SetPaused( true );
-                        // CheckDlgButton( HWndAchievementsDlg, IDC_RA_CHKACHPROCESSINGACTIVE, FALSE );
-
-                        // Update this achievement as 'modified'
-                        pActiveAch->SetModified(TRUE);
-                        g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-                    }
-
-                    // Inject the new text into the lbx 
-                    ListView_SetItemText(::GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS), lvItem.iItem, lvItem.iSubItem,
-                                         lvItem.pszText); // put new text
-
-                    // Update the cached data:
-                    sData = ra::Narrow(pDispInfo->item.pszText);
-
-                    // Update the achievement data:
-                    Condition& rCond = pActiveAch->GetCondition(GetSelectedConditionGroup(), pDispInfo->item.iItem);
-                    switch (ra::itoe<CondSubItems>(pDispInfo->item.iSubItem))
-                    {
-                        case CondSubItems::Group:
-                        {
-                            auto i = 0U;
-                            for (const auto str : Condition::TYPE_STR)
-                            {
-                                if (sData == ra::Narrow(str))
-                                    rCond.SetConditionType(ra::itoe<Condition::Type>(i));
-                                i++;
-                            }
-                            UpdateCondition(
-                                GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS), pDispInfo->item, rCond,
-                                pActiveAch->GetConditionHitCount(GetSelectedConditionGroup(), pDispInfo->item.iItem));
-                            break;
-                        }
-                        case CondSubItems::Type_Src:
-                        {
-                            const bool bWasValue = rCond.CompSource().GetType() == CompVariable::Type::ValueComparison;
-
-                            if (sData == "Mem")
-                                rCond.CompSource().SetType(CompVariable::Type::Address);
-                            else if (sData == "Delta")
-                                rCond.CompSource().SetType(CompVariable::Type::DeltaMem);
-                            else if (sData == "Prior")
-                                rCond.CompSource().SetType(CompVariable::Type::PriorMem);
-                            else
-                                rCond.CompSource().SetType(CompVariable::Type::ValueComparison);
-
-                            if (bWasValue &&
-                                rCond.CompSource().GetType() != CompVariable::Type::ValueComparison &&
-                                rCond.CompTarget().GetType() != CompVariable::Type::ValueComparison)
-                            {
-                                rCond.CompSource().SetSize(rCond.CompTarget().GetSize());
-                            }
-
-                            break;
-                        }
-                        case CondSubItems::Type_Tgt:
-                        {
-                            const bool bWasValue = rCond.CompTarget().GetType() == CompVariable::Type::ValueComparison;
-
-                            if (sData == "Mem")
-                                rCond.CompTarget().SetType(CompVariable::Type::Address);
-                            else if (sData == "Delta")
-                                rCond.CompTarget().SetType(CompVariable::Type::DeltaMem);
-                            else if (sData == "Prior")
-                                rCond.CompTarget().SetType(CompVariable::Type::PriorMem);
-                            else
-                                rCond.CompTarget().SetType(CompVariable::Type::ValueComparison);
-
-                            if (bWasValue &&
-                                rCond.CompTarget().GetType() != CompVariable::Type::ValueComparison &&
-                                rCond.CompSource().GetType() != CompVariable::Type::ValueComparison)
-                            {
-                                rCond.CompTarget().SetSize(rCond.CompSource().GetSize());
-                            }
-
-                            break;
-                        }
-
-                        case CondSubItems::Size_Src:
-                        {
-                            auto i{0};
-                            for (auto& str : MEMSIZE_STR)
-                            {
-                                if (sData == ra::Narrow(str))
-                                    rCond.CompSource().SetSize(ra::itoe<MemSize>(i));
-                                i++;
-                            }
-                            // TBD: Limit validation
-                        }
-                        break;
-                        case CondSubItems::Size_Tgt:
-                        {
-                            auto i{0};
-                            for (auto& str : MEMSIZE_STR)
-                            {
-                                if (sData == ra::Narrow(str))
-                                    rCond.CompTarget().SetSize(ra::itoe<MemSize>(i));
-                                i++;
-                            }
-                            // TBD: Limit validation
-                        }
-                        break;
-                        case CondSubItems::Comparison:
-                        {
-                            auto i = 0U;
-                            for (const auto str : COMPARISONTYPE_STR)
-                            {
-                                if (sData == ra::Narrow(str))
-                                    rCond.SetCompareType(ra::itoe<ComparisonType>(i));
-                                i++;
-                            }
-                        }
-                        break;
-
-                        case CondSubItems::Value_Src:
-                        {
-                            const auto nVal = ParseValue(sData, rCond.CompSource().GetType());
-                            rCond.CompSource().SetValue(nVal);
-                            break;
-                        }
-                        case CondSubItems::Value_Tgt:
-                        {
-                            const auto nVal = ParseValue(sData, rCond.CompTarget().GetType());
-                            rCond.CompTarget().SetValue(nVal);
-                            break;
-                        }
-                        case CondSubItems::Hitcount:
-                        {
-                            // Always decimal
-                            try
-                            {
-                                rCond.SetRequiredHits(std::stoul(sData));
-                            } catch (const std::invalid_argument& e)
-                            {
-                                RA_LOG_ERR("invalid_argument: %s", e.what());
-                                ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(
-                                    L"Only digits are allowed in this field!");
-                                rCond.SetRequiredHits(0);
-                            }
-                            break;
-                        }
-                        default:
-                            ASSERT(!"Unhandled!");
-                            break;
-                    }
-
-                    nSelItem = -1;
-                    nSelSubItem = -1;
-
-                    pActiveAch->RebuildTrigger();
-                }
-                break;
-
-                case LVN_ITEMCHANGED:
-                {
-                    LPNMLISTVIEW pnmListView;
-                    GSL_SUPPRESS_TYPE1{ pnmListView = reinterpret_cast<LPNMLISTVIEW>(lParam); }
-                    if (pnmListView->uNewState & LVIS_SELECTED)
-                        PopulateConditions(ActiveAchievement());
-                }
-                break;
-
-                case TTN_GETDISPINFO:
-                {
-                    LPNMTTDISPINFO lpDispInfo{};
-                    GSL_SUPPRESS_TYPE1 lpDispInfo = reinterpret_cast<LPNMTTDISPINFO>(lParam);
-
-                    GetListViewTooltip();
-                    if (!m_sTooltip.empty())
-                    {
-                        lpDispInfo->lpszText = m_sTooltip.data();
-                        return TRUE;
-                    }
-
-                    lpDispInfo->szText[0] = '\0';
-                    lpDispInfo->lpszText = lpDispInfo->szText;
-                    return FALSE;
-                }
-
-                case UDN_DELTAPOS:
-                {
-                    Achievement* pActiveAch = ActiveAchievement();
-                    if (pActiveAch == nullptr)
-                        return FALSE;
-
-                    LPNMUPDOWN lpUpDown{};
-                    GSL_SUPPRESS_TYPE1 lpUpDown = reinterpret_cast<LPNMUPDOWN>(lParam);
-
-                    unsigned int nVal = m_nFirstBadge;
-
-                    std::string buffer(16, '\0');
-                    const auto nLength = GetDlgItemTextA(hDlg, IDC_RA_BADGENAME, buffer.data(), 16);
-                    if (nLength > 0)
-                    {
-                        buffer.resize(nLength);
-
-                        try
-                        {
-                            nVal = ra::to_unsigned(std::stoi(buffer));
-                            nVal -= lpUpDown->iDelta; // up returns negative delta
-                        }
-                        catch (const std::invalid_argument&)
-                        {
-                        }
-
-                        if (nVal < m_nFirstBadge)
-                            nVal = m_nNextBadge - 1;
-                        else if (nVal >= m_nNextBadge)
-                            nVal = m_nFirstBadge;
-                    }
-
-                    buffer = std::to_string(nVal);
-                    if (buffer.length() < 5)
-                        buffer.insert(0, 5 - buffer.length(), '0');
-
-                    pActiveAch->SetBadgeImage(buffer);
-                    pActiveAch->SetModified(TRUE);
-                    g_AchievementsDialog.OnEditAchievement(*pActiveAch);
-                    UpdateBadge(buffer);
-                    return FALSE;
-                }
-            }
-        }
-        break;
-
-        case WM_CLOSE:
-            EndDialog(hDlg, true);
-            bHandled = TRUE;
-            break;
-    }
-
-    return !bHandled;
-}
-
-unsigned int Dlg_AchievementEditor::ParseValue(const std::string& sData, CompVariable::Type nType) const
-{
-    unsigned int nMax = 0xFFFFFFFF;
-
-    int nBase = 16;
-    if (nType == CompVariable::Type::ValueComparison)
-    {
-        auto& pConfiguration = ra::services::ServiceLocator::Get<ra::services::IConfiguration>();
-        if (pConfiguration.IsFeatureEnabled(ra::services::Feature::PreferDecimal))
-            nBase = 10;
-
-        // TODO: limit nMax to size of memory being read
-    }
-    else
-    {
-        nMax = gsl::narrow_cast<unsigned int>(ra::services::ServiceLocator::Get<ra::data::context::EmulatorContext>().TotalMemorySize()) - 1;
-    }
-
-    bool bTooLarge = false;
-    bool bInvalid = false;
-    try
-    {
-        size_t nRead;
-        const auto nVal = std::stoul(sData, &nRead, nBase);
-        if (nRead < sData.length())
-            bInvalid = true;
-        else if (nRead > 0 && sData.at(0) == '-')
-            ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Invalid Input", L"Value must be non-negative.");
-        else if (nVal > nMax)
-            bTooLarge = true;
-        else
-            return nVal;
-    }
-    catch (const std::invalid_argument&)
-    {
-        bInvalid = true;
-    }
-    catch (const std::out_of_range&)
-    {
-        bTooLarge = true;
-    }
-
-    if (bInvalid)
-    {
-        if (nBase == 10)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Invalid Input",
-                L"Only values that can be represented as decimal are allowed while the "
-                L"'show decimal values' checkbox is checked.");
-        }
-        else
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Invalid Input",
-                L"Only values that can be represented as hexadecimal are allowed.");
-        }
-    }
-    else if (bTooLarge)
-    {
-        if (nBase == 10)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Too Large",
-                ra::StringPrintf(L"Value cannot exceed %lu", nMax));
-        }
-        else
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Too Large",
-                ra::StringPrintf(L"Value cannot exceed 0x%x", nMax));
-        }
-    }
-
-    return 0;
-}
-
-void Dlg_AchievementEditor::GetListViewTooltip()
-{
-    m_sTooltip.clear();
-
-    Achievement* pActiveAch = ActiveAchievement();
-    if (pActiveAch == nullptr)
-        return;
-
-    HWND hList = GetDlgItem(GetHWND(), IDC_RA_LBX_CONDITIONS);
-
-    LVHITTESTINFO lvHitTestInfo;
-    GetCursorPos(&lvHitTestInfo.pt);
-    ScreenToClient(hList, &lvHitTestInfo.pt);
-
-    if (ListView_SubItemHitTest(hList, &lvHitTestInfo) == -1)
-        return;
-
-    m_nTooltipLocation = lvHitTestInfo.iItem * 256 + lvHitTestInfo.iSubItem;
-
-    Condition& rCond = pActiveAch->GetCondition(GetSelectedConditionGroup(), lvHitTestInfo.iItem);
-    unsigned int nAddr = 0;
-    switch (ra::itoe<CondSubItems>(lvHitTestInfo.iSubItem))
-    {
-        case CondSubItems::Value_Src:
-            if (!rCond.CompSource().IsMemoryType())
-                return;
-
-            nAddr = rCond.CompSource().GetValue();
-            break;
-
-        case CondSubItems::Value_Tgt:
-            if (!rCond.CompTarget().IsMemoryType())
-                return;
-
-            nAddr = rCond.CompTarget().GetValue();
-            break;
-
-        default:
-            return;
-    }
-
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    const auto* pNote = pGameContext.FindCodeNote(nAddr);
-    if (!pNote)
-    {
-        m_sTooltip = NativeStr(ra::StringPrintf(L"%s\r\n", ra::ByteAddressToString(nAddr)));
-    }
-    else
-    {
-        size_t nLines = 0;
-        size_t nIndex = 0;
-        do
-        {
-            nIndex = pNote->find('\n', nIndex);
-            if (nIndex == std::string::npos)
-                break;
-
-            ++nIndex;
-            ++nLines;
-        } while (nLines < 20);
-
-        if (nIndex != std::string::npos && pNote->find('\n', nIndex) != std::string::npos)
-        {
-            std::wstring sSubString(*pNote, 0, nIndex);
-            m_sTooltip = NativeStr(ra::StringPrintf(L"%s\r\n%s...", ra::ByteAddressToString(nAddr), sSubString));
-        }
-        else
-        {
-            m_sTooltip = NativeStr(ra::StringPrintf(L"%s\r\n%s", ra::ByteAddressToString(nAddr), *pNote));
-        }
-    }
-}
-
-GSL_SUPPRESS_CON4
-void Dlg_AchievementEditor::UpdateSelectedBadgeImage(const std::string& sBackupBadgeToUse)
-{
-    std::string sAchievementBadgeURI;
-
-    if (m_pSelectedAchievement != nullptr)
-        sAchievementBadgeURI = m_pSelectedAchievement->BadgeImageURI();
-    else if (sBackupBadgeToUse.length() > 2)
-        sAchievementBadgeURI = sBackupBadgeToUse;
-
-    auto& pImageRepository = ra::services::ServiceLocator::GetMutable<ra::ui::IImageRepository>();
-    if (!pImageRepository.IsImageAvailable(ra::ui::ImageType::Badge, sAchievementBadgeURI))
-    {
-        pImageRepository.FetchImage(ra::ui::ImageType::Badge, sAchievementBadgeURI);
-        ra::services::ServiceLocator::GetMutable<ra::services::IThreadPool>().ScheduleAsync(std::chrono::seconds(1),
-            [this, sBackupBadgeToUse]() { UpdateSelectedBadgeImage(sBackupBadgeToUse); });
-    }
-
-    m_hAchievementBadge.ChangeReference(ra::ui::ImageType::Badge, sAchievementBadgeURI);
-    GSL_SUPPRESS_CON4 // inline suppression for this currently not working
-    const auto hBitmap = ra::ui::drawing::gdi::ImageRepository::GetHBitmap(m_hAchievementBadge);
-
-    if (hBitmap != nullptr)
-    {
-        HWND hCheevoPic = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_CHEEVOPIC);
-        GSL_SUPPRESS_TYPE1
-        SendMessage(hCheevoPic, STM_SETIMAGE, ra::to_unsigned(IMAGE_BITMAP), reinterpret_cast<LPARAM>(hBitmap));
-        InvalidateRect(hCheevoPic, nullptr, TRUE);
-    }
-
-    // Update the text field
-    SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_BADGENAME, sAchievementBadgeURI.c_str());
-}
-
-void Dlg_AchievementEditor::UpdateBadge(const std::string& sNewName)
-{
-    // If a change is detected: change it!
-    if (m_pSelectedAchievement != nullptr)
-    {
-        if (m_pSelectedAchievement->BadgeImageURI().compare(sNewName) != 0)
-        {
-            // The badge we are about to show is different from the one stored for this achievement.
-            // This implies that we are changing the badge: this achievement is modified!
-            m_pSelectedAchievement->SetBadgeImage(sNewName);
-            m_pSelectedAchievement->SetModified(TRUE);
-
-            if (m_pSelectedAchievement->GetCategory() == Achievement::Category::Core)
-            {
-                const int nOffs = g_AchievementsDialog.GetSelectedAchievementIndex();
-                g_AchievementsDialog.OnEditData(nOffs, Dlg_Achievements::Column::Modified, "Yes");
-            }
-        }
-    }
-
-    // Always attempt update.
-    UpdateSelectedBadgeImage(sNewName.c_str());
-}
-
-_Use_decl_annotations_ void
-    Dlg_AchievementEditor::RepopulateGroupList(const Achievement* const restrict pCheevo)
-{
-    HWND hGroupList = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_GROUP);
-    if (hGroupList == nullptr)
-        return;
-
-    int nItems = ListView_GetItemCount(hGroupList);
-
-    int nSel = -1;
-    for (int i = 0; i < nItems; ++i)
-    {
-        if (ListView_GetItemState(hGroupList, i, LVIS_SELECTED) == LVIS_SELECTED)
-        {
-            nSel = i;
-            break;
-        }
-    }
-
-    const int nGroups = pCheevo ? gsl::narrow_cast<int>(pCheevo->NumConditionGroups()) : 0;
-
-    while (nItems > nGroups)
-        ListView_DeleteItem(hGroupList, --nItems);
-
-    if (nItems < nGroups)
-    {
-        LV_ITEM item{};
-        item.mask = LVIF_TEXT;
-        item.iSubItem = 0;
-
-        if (nItems == 0)
-        {
-            std::string sCore = "Core";
-            item.pszText = sCore.data();
-            item.iItem = 0;
-            ListView_InsertItem(hGroupList, &item);
-            ++nItems;
-        }
-
-        while (nItems < nGroups)
-        {
-            auto sAltGroup = ra::StringPrintf("Alt %02d", nItems);
-            item.pszText = sAltGroup.data();
-            item.iItem = nItems++;
-            ListView_InsertItem(hGroupList, &item);
-        }
-    }
-
-    for (int i = 0; i < nItems; ++i)
-        ListView_SetItemState(hGroupList, i, (i == nSel) ? LVIS_SELECTED : 0, LVIS_SELECTED);
-}
-
-_Use_decl_annotations_ void Dlg_AchievementEditor::PopulateConditions(const Achievement* const restrict pCheevo)
-{
-    HWND hCondList = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS);
-    if (hCondList == nullptr)
-        return;
-
-    ListView_DeleteAllItems(hCondList);
-    m_lbxData.clear();
-
-    if (pCheevo != nullptr)
-    {
-        size_t maxNumConditions = m_pSelectedAchievement->NumConditions(0);
-        for (size_t i = 1; i < m_pSelectedAchievement->NumConditionGroups(); ++i)
-            maxNumConditions = std::max(maxNumConditions, m_pSelectedAchievement->NumConditions(i));
-        m_lbxData.reserve(maxNumConditions);
-
-        const auto nGrp = GetSelectedConditionGroup();
-        for (size_t i = 0; i < m_pSelectedAchievement->NumConditions(nGrp); ++i)
-            AddCondition(hCondList, m_pSelectedAchievement->GetCondition(nGrp, i),
-                         m_pSelectedAchievement->GetConditionHitCount(nGrp, i));
-    }
-}
-
-void Dlg_AchievementEditor::LoadAchievement(Achievement* pCheevo, _UNUSED BOOL)
-{
-    if (pCheevo == nullptr)
-    {
-        m_pSelectedAchievement = pCheevo;
-
-        // Just clear data
-
-        m_bPopulatingAchievementEditorData = TRUE;
-
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_ID, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE, TEXT("<Inactive!>"));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_DESC, TEXT("<Select or Create an Achievement first!>"));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR, TEXT("<Inactive!>"));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_BADGENAME, TEXT("00000"));
-
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_ID), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_DESC), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ADDCOND), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_COPYCOND), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_DELETECOND), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_GROUP), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_PROGRESSINDICATORS), FALSE);
-
-        UpdateBadge("00000");
-        PopulateConditions(nullptr);
-
-        m_bPopulatingAchievementEditorData = FALSE;
-    }
-    else if (m_pSelectedAchievement != pCheevo)
-    {
-        pCheevo->GenerateConditions();
-        m_pSelectedAchievement = pCheevo;
-
-        // New achievement selected.
-        // Naturally: update everything!
-
-        m_bPopulatingAchievementEditorData = TRUE;
-
-        // Repopulate the group box:
-        RepopulateGroupList(m_pSelectedAchievement);
-        SetSelectedConditionGroup(0); // Select 0 by default
-        PopulateConditions(m_pSelectedAchievement);
-
-        CheckDlgButton(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_ACTIVE, ActiveAchievement()->Active());
-        CheckDlgButton(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER,
-                       ActiveAchievement()->GetPauseOnTrigger());
-        CheckDlgButton(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_PAUSE_ON_RESET, ActiveAchievement()->GetPauseOnReset());
-
-        if (m_pSelectedAchievement->GetCategory() == Achievement::Category::Local)
-            SetDlgItemTextA(m_hAchievementEditorDlg, IDC_RA_ACH_ID, "0");
-        else
-            SetDlgItemTextA(m_hAchievementEditorDlg, IDC_RA_ACH_ID, std::to_string(m_pSelectedAchievement->ID()).c_str());
-
-        const auto buffer = std::to_string(m_pSelectedAchievement->Points());
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS, NativeStr(buffer).c_str());
-
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE, NativeStr(m_pSelectedAchievement->Title()).c_str());
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_DESC,
-                       NativeStr(m_pSelectedAchievement->Description()).c_str());
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR, NativeStr(m_pSelectedAchievement->Author()).c_str());
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_BADGENAME,
-                       NativeStr(m_pSelectedAchievement->BadgeImageURI()).c_str());
-
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_ID), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_DESC), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ADDCOND), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_COPYCOND), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_DELETECOND), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_GROUP), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_PROGRESSINDICATORS), FALSE);
-
-        UpdateBadge(m_pSelectedAchievement->BadgeImageURI());
-
-        m_bPopulatingAchievementEditorData = FALSE;
-    }
-    else
-    {
-        // Same achievement still selected: what's changed?
-        pCheevo->GenerateConditions();
-
-        const BOOL bTitleSelected = (GetFocus() == GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE));
-        const BOOL bDescSelected = (GetFocus() == GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_DESC));
-        const BOOL bPointsSelected = (GetFocus() == GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS));
-
-        if (!m_pSelectedAchievement->IsDirty())
-            return;
-
-        CheckDlgButton(m_hAchievementEditorDlg, IDC_RA_CHK_ACH_ACTIVE, ActiveAchievement()->Active());
-
-        m_bPopulatingAchievementEditorData = TRUE;
-
-        using namespace ra::bitwise_ops;
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::ID))
-        {
-            if (m_pSelectedAchievement->GetCategory() == Achievement::Category::Local)
-                SetDlgItemTextA(m_hAchievementEditorDlg, IDC_RA_ACH_ID, "0");
-            else
-                SetDlgItemTextA(m_hAchievementEditorDlg, IDC_RA_ACH_ID, std::to_string(m_pSelectedAchievement->ID()).c_str());
-        }
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Points) && !bPointsSelected)
-            SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS,
-                           NativeStr(std::to_string(m_pSelectedAchievement->Points())).c_str());
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Title) && !bTitleSelected)
-            SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE,
-                           NativeStr(m_pSelectedAchievement->Title()).c_str());
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Description) && !bDescSelected)
-            SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_DESC,
-                           NativeStr(m_pSelectedAchievement->Description()).c_str());
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Author))
-            SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR,
-                           NativeStr(m_pSelectedAchievement->Author()).c_str());
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Badge))
-        {
-            SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_BADGENAME,
-                           NativeStr(m_pSelectedAchievement->BadgeImageURI()).c_str());
-            UpdateBadge(m_pSelectedAchievement->BadgeImageURI());
-        }
-
-        const auto nGrp = GetSelectedConditionGroup();
-
-        if (ra::etoi(pCheevo->GetDirtyFlags() & Achievement::DirtyFlags::Conditions))
-        {
-            HWND hCondList = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS);
-            if (hCondList != nullptr)
-            {
-                if (ListView_GetItemCount(hCondList) != ra::to_signed(m_pSelectedAchievement->NumConditions(nGrp)))
-                {
-                    PopulateConditions(pCheevo);
-                }
-                else
-                {
-                    LV_ITEM item;
-                    ZeroMemory(&item, sizeof(item));
-                    item.mask = LVIF_TEXT;
-                    item.cchTextMax = 256;
-
-                    for (size_t i = 0; i < m_pSelectedAchievement->NumConditions(nGrp); ++i)
-                    {
-                        const Condition& Cond = m_pSelectedAchievement->GetCondition(nGrp, i);
-                        item.iItem = gsl::narrow_cast<int>(i);
-                        UpdateCondition(hCondList, item, Cond, m_pSelectedAchievement->GetConditionHitCount(nGrp, i));
-                    }
-                }
-            }
-        }
-
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_ID), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_DESC), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_COPYCOND), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_DELETECOND), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_ACH_GROUP), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementEditorDlg, IDC_RA_PROGRESSINDICATORS), FALSE);
-
-        m_bPopulatingAchievementEditorData = FALSE;
-    }
-
-    // InvalidateRect( hList, nullptr, TRUE );
-    // UpdateWindow( hList );
-    // RedrawWindow( hList, nullptr, nullptr, RDW_INVALIDATE );
-}
-
-inline std::string& Dlg_AchievementEditor::LbxDataAt(unsigned int nRow, CondSubItems nCol) noexcept
-{
-    GSL_SUPPRESS_F6 return m_lbxData.at(nRow).at(ra::etoi(nCol));
-}
-
-void Dlg_AchievementEditor::OnLoad_NewRom()
-{
-    HWND hList = GetDlgItem(m_hAchievementEditorDlg, IDC_RA_LBX_CONDITIONS);
-    if (hList != nullptr)
-    {
-        SetIgnoreEdits(TRUE);
-        SetupColumns(hList);
-
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_ID, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_POINTS, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_TITLE, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_DESC, TEXT(""));
-        SetDlgItemText(m_hAchievementEditorDlg, IDC_RA_ACH_AUTHOR, TEXT(""));
-
-        m_pSelectedAchievement = nullptr;
-        SetIgnoreEdits(FALSE);
-        LoadAchievement(nullptr, FALSE);
-    }
-}
-
-size_t Dlg_AchievementEditor::GetSelectedConditionGroup() const noexcept
-{
-    HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_ACH_GROUP);
-    const int nItems = ListView_GetItemCount(hList);
-    for (int i = 0; i < nItems; ++i)
-    {
-        if (ListView_GetItemState(hList, i, LVIS_SELECTED) == LVIS_SELECTED)
-            return ra::to_unsigned(i);
-    }
-
-    OutputDebugString(TEXT("ListBox_GetCurSel returning LB_ERR\n"));
-    return 0;
-}
-
-void Dlg_AchievementEditor::SetSelectedConditionGroup(size_t nGrp) const noexcept
-{
-    HWND hList = GetDlgItem(g_AchievementEditorDialog.GetHWND(), IDC_RA_ACH_GROUP);
-    const int nItems = ListView_GetItemCount(hList);
-    for (size_t i = 0; i < gsl::narrow_cast<size_t>(nItems); ++i)
-        ListView_SetItemState(hList, i, (i == nGrp) ? LVIS_SELECTED : 0, LVIS_SELECTED);
-}
-
-void GenerateResizes(HWND hDlg)
-{
-    RARect windowRect;
-    GetWindowRect(hDlg, &windowRect);
-    pDlgAchEditorMin.x = windowRect.Width();
-    pDlgAchEditorMin.y = windowRect.Height();
-
-    using AlignType = ResizeContent::AlignType;
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_LBL_POINTS), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_POINTS), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_LBL_BADGENAME), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_BADGENAME), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_BADGE_SPIN), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_UPLOAD_BADGE), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_LBL_AUTHOR), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_AUTHOR), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_CHEEVOPIC), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_TITLE), AlignType::Right, true);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_DESC), AlignType::Right, true);
-
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_LBX_CONDITIONS), AlignType::BottomRight, true);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_GROUP), AlignType::Bottom, true);
-
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_CHK_ACH_PAUSE_ON_RESET), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_CHK_ACH_ACTIVE), AlignType::Right, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_CHK_SHOW_DECIMALS), AlignType::BottomRight, false);
-
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_ADDGROUP), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ACH_DELGROUP), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_ADDCOND), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_DELETECOND), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_COPYCOND), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_PASTECOND), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_MOVECONDUP), AlignType::Bottom, false);
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDC_RA_MOVECONDDOWN), AlignType::Bottom, false);
-
-    vDlgAchEditorResize.emplace_back(::GetDlgItem(hDlg, IDCLOSE), AlignType::BottomRight, false);
-}
diff --git a/src/RA_Dlg_AchEditor.h b/src/RA_Dlg_AchEditor.h
deleted file mode 100644
index acbe4639..00000000
--- a/src/RA_Dlg_AchEditor.h
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef RA_DLG_ACHEDITOR_H
-#define RA_DLG_ACHEDITOR_H
-#pragma once
-
-#include "RA_Achievement.h"
-
-#include "ui\ImageReference.hh"
-
-enum class CondSubItems : std::size_t;
-
-class Dlg_AchievementEditor
-{
-public:
-    static INT_PTR CALLBACK s_AchievementEditorProc(HWND, UINT, WPARAM, LPARAM);
-    INT_PTR AchievementEditorProc(HWND, UINT, WPARAM, LPARAM);
-
-public:
-    void OnLoad_NewRom();
-    void LoadAchievement(Achievement* pCheevo, _UNUSED BOOL);
-
-    inline void SetICEControl(HWND hIce) noexcept { m_hICEControl = hIce; }
-    inline std::string& LbxDataAt(unsigned int nRow, CondSubItems nCol) noexcept;
-
-    HWND GetICEControl() const noexcept { return m_hICEControl; }
-
-    void InstallHWND(HWND hWnd) noexcept { m_hAchievementEditorDlg = hWnd; }
-    HWND GetHWND() const noexcept { return m_hAchievementEditorDlg; }
-    BOOL IsActive() const noexcept;
-
-    Achievement* ActiveAchievement() const noexcept { return m_pSelectedAchievement; }
-    BOOL IsPopulatingAchievementEditorData() const noexcept { return m_bPopulatingAchievementEditorData; }
-    void SetIgnoreEdits(BOOL bIgnore) noexcept { m_bPopulatingAchievementEditorData = bIgnore; }
-
-    void UpdateBadge(const std::string& sNewName); // Call to set/update data
-    void UpdateSelectedBadgeImage(
-        const std::string& sBackupBadgeToUse = std::string()); // Call to just update the badge image/bitmap
-
-    size_t GetSelectedConditionGroup() const noexcept;
-    void SetSelectedConditionGroup(size_t nGrp) const noexcept;
-
-    ConditionGroup m_ConditionClipboard;
-
-private:
-    void RepopulateGroupList(_In_ const Achievement* const restrict pCheevo);
-    void PopulateConditions(_In_ const Achievement* const restrict pCheevo);
-    void SetupColumns(HWND hList);
-
-    static LRESULT CALLBACK ListViewWndProc(HWND, UINT, WPARAM, LPARAM) noexcept;
-    void GetListViewTooltip();
-
-    const int AddCondition(HWND hList, const Condition& Cond, unsigned int nCurrentHits);
-    void UpdateCondition(HWND hList, LV_ITEM& item, const Condition& Cond, unsigned int nCurrentHits);
-    void SetCell(HWND hList, LV_ITEM& item, int nRow, CondSubItems nColumn, const std::string& sNewValue);
-    void SetCell(HWND hList, LV_ITEM& item, int nRow, CondSubItems nColumn, std::string&& sNewValue) noexcept;
-
-    unsigned int ParseValue(const std::string& sData, CompVariable::Type nType) const;
-
-private:
-    static constexpr std::size_t m_nNumCols = 10U;
-    static constexpr std::size_t MEM_STRING_TEXT_LEN = 80U;
-
-    HWND m_hAchievementEditorDlg = nullptr;
-    HWND m_hICEControl = nullptr;
-
-    HWND m_hTooltip = nullptr;
-    int m_nTooltipLocation = 0;
-    ra::tstring m_sTooltip;
-    WNDPROC m_pListViewWndProc = nullptr;
-    bool m_bIgnoreTimer = false;
-
-    std::vector<std::array<std::string, m_nNumCols>> m_lbxData{};
-
-    Achievement* m_pSelectedAchievement = nullptr;
-    BOOL m_bPopulatingAchievementEditorData = FALSE;
-    ra::ui::ImageReference m_hAchievementBadge;
-    unsigned int m_nFirstBadge = 0U;
-    unsigned int m_nNextBadge = 0U;
-};
-
-void GenerateResizes(HWND hDlg);
-
-extern Dlg_AchievementEditor g_AchievementEditorDialog;
-
-#endif // !RA_DLG_ACHEDITOR_H
diff --git a/src/RA_Dlg_Achievement.cpp b/src/RA_Dlg_Achievement.cpp
deleted file mode 100644
index 2fa2ac95..00000000
--- a/src/RA_Dlg_Achievement.cpp
+++ /dev/null
@@ -1,1292 +0,0 @@
-#include "RA_Dlg_Achievement.h"
-
-#include "RA_Achievement.h"
-#include "RA_Core.h"
-#include "RA_Defs.h"
-#include "RA_Dlg_AchEditor.h"
-#include "RA_Resource.h"
-#include "RA_md5factory.h"
-#include "RA_BuildVer.h"
-#include "RA_StringUtils.h"
-
-#include "Exports.hh"
-
-#include "api\UpdateAchievement.hh"
-
-#include "data\context\EmulatorContext.hh"
-#include "data\context\GameContext.hh"
-#include "data\context\UserContext.hh"
-
-#include "services\AchievementRuntime.hh"
-#include "services\IConfiguration.hh"
-
-#include "ui\viewmodels\MessageBoxViewModel.hh"
-
-inline constexpr std::array<LPCTSTR, 6> COLUMN_TITLES_CORE{_T("ID"),     _T("Title"),     _T("Points"),
-                                                           _T("Author"), _T("Achieved?"), _T("Modified?")};
-inline constexpr std::array<LPCTSTR, 6> COLUMN_TITLES_UNOFFICIAL{_T("ID"),     _T("Title"),  _T("Points"),
-                                                                 _T("Author"), _T("Active"), _T("Votes")};
-inline constexpr std::array<LPCTSTR, 6> COLUMN_TITLES_LOCAL{_T("ID"),     _T("Title"),  _T("Points"),
-                                                            _T("Author"), _T("Active"), _T("Votes")};
-
-inline constexpr std::array<int, 6> COLUMN_SIZE{45, 200, 45, 80, 65, 65};
-inline constexpr auto NUM_COLS = ra::to_signed(COLUMN_SIZE.size());
-
-auto iSelect = -1;
-
-Dlg_Achievements g_AchievementsDialog;
-
-void Dlg_Achievements::SetupColumns(HWND hList)
-{
-    //  Remove all columns and data.
-    while (ListView_DeleteColumn(hList, 0) == TRUE)
-    {
-    }
-    ListView_DeleteAllItems(hList);
-    m_vAchievementIDs.clear();
-    m_lbxData.clear();
-
-    auto i = 0;
-    for (const auto& col_size : COLUMN_SIZE)
-    {
-        LPCTSTR sColTitle{_T("")};
-        if (m_nActiveCategory == Achievement::Category::Core)
-            sColTitle = COLUMN_TITLES_CORE.at(i);
-        else if (m_nActiveCategory == Achievement::Category::Unofficial)
-            sColTitle = COLUMN_TITLES_UNOFFICIAL.at(i);
-        else if (m_nActiveCategory == Achievement::Category::Local)
-            sColTitle = COLUMN_TITLES_LOCAL.at(i);
-
-        ra::tstring sColTitleStr = sColTitle; // Take a copy
-        LV_COLUMN newColumn{newColumn.mask = ra::to_unsigned(LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_FMT),
-                            newColumn.fmt = LVCFMT_LEFT | LVCFMT_FIXED_WIDTH,
-                            newColumn.cx = col_size,
-                            newColumn.pszText = sColTitleStr.data(),
-                            newColumn.cchTextMax = 255,
-                            newColumn.iSubItem = i};
-
-        if (i == (::NUM_COLS - 1))
-            newColumn.fmt |= LVCFMT_FILL;
-
-        ListView_InsertColumn(hList, i, &newColumn);
-        i++;
-    }
-
-    m_lbxData.clear();
-    ListView_SetExtendedListViewStyle(hList, LVS_EX_FULLROWSELECT);
-}
-
-LRESULT ProcessCustomDraw(LPARAM lParam)
-{
-#pragma warning(push)
-#pragma warning(disable: 26490)
-    GSL_SUPPRESS_TYPE1 LPNMLVCUSTOMDRAW lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(lParam);
-#pragma warning(pop)
-    switch (lplvcd->nmcd.dwDrawStage)
-    {
-        case CDDS_PREPAINT:
-            //  Before the paint cycle begins
-            //  request notifications for individual listview items
-            return CDRF_NOTIFYITEMDRAW;
-
-        case CDDS_ITEMPREPAINT: // Before an item is drawn
-        {
-            const auto nNextItem = ra::to_signed(lplvcd->nmcd.dwItemSpec);
-            const auto* pAchievement = g_AchievementsDialog.GetAchievementAt(nNextItem);
-
-            if (pAchievement != nullptr)
-            {
-                // if (((int)lplvcd->nmcd.dwItemSpec%2)==0)
-                const BOOL bSelected = pAchievement == g_AchievementEditorDialog.ActiveAchievement();
-                const BOOL bModified = pAchievement->Modified();
-
-                lplvcd->clrText = bModified ? RGB(255, 0, 0) : RGB(0, 0, 0);
-                lplvcd->clrTextBk = bSelected ? RGB(222, 222, 222) : RGB(255, 255, 255);
-            }
-            return CDRF_NEWFONT;
-        }
-        break;
-
-            // Before a subitem is drawn
-            //  case CDDS_SUBITEM | CDDS_ITEMPREPAINT:
-            //      {
-            //          if (iSelect == (int)lplvcd->nmcd.dwItemSpec)
-            //          {
-            //              if (0 == lplvcd->iSubItem)
-            //              {
-            //                  //customize subitem appearance for column 0
-            //                  lplvcd->clrText   = RGB(255,128,0);
-            //                  lplvcd->clrTextBk = RGB(255,255,255);
-            //
-            //                  //To set a custom font:
-            //                  //SelectObject(lplvcd->nmcd.hdc,
-            //                  //    <your custom HFONT>);
-            //
-            //                  return CDRF_NEWFONT;
-            //              }
-            //              else if (1 == lplvcd->iSubItem)
-            //              {
-            //                  //customize subitem appearance for columns 1..n
-            //                  //Note: setting for column i
-            //                  //carries over to columnn i+1 unless
-            //                  //      it is explicitly reset
-            //                  lplvcd->clrTextBk = RGB(255,0,0);
-            //                  lplvcd->clrTextBk = RGB(255,255,255);
-            //
-            //                  return CDRF_NEWFONT;
-            //              }
-            //          }
-            //      }
-    }
-    return CDRF_DODEFAULT;
-}
-
-void Dlg_Achievements::RemoveAchievement(HWND hList, int nIter)
-{
-    ASSERT(nIter < ListView_GetItemCount(hList));
-    ListView_DeleteItem(hList, nIter);
-    m_lbxData.erase(m_lbxData.begin() + nIter);
-    m_vAchievementIDs.erase(m_vAchievementIDs.begin() + nIter);
-
-    UpdateAchievementCounters();
-
-    UpdateSelectedAchievementButtons(nullptr);
-
-    g_AchievementEditorDialog.LoadAchievement(nullptr, FALSE);
-
-}
-
-void Dlg_Achievements::UpdateAchievementCounters()
-{
-    char buffer[16];
-    sprintf_s(buffer, 16, " %zu", m_vAchievementIDs.size());
-    SetDlgItemText(m_hAchievementsDlg, IDC_RA_NUMACH, NativeStr(buffer).c_str());
-
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    int nTotalPoints = 0;
-    for (const auto& pAchievementId : m_vAchievementIDs)
-    {
-        const auto* pAchievement = pGameContext.FindAchievement(pAchievementId);
-        if (pAchievement != nullptr)
-            nTotalPoints += pAchievement->Points();
-    }
-    SetDlgItemText(m_hAchievementsDlg, IDC_RA_POINT_TOTAL,
-                   NativeStr(std::to_string(nTotalPoints)).c_str());
-}
-
-int Dlg_Achievements::AddAchievement(HWND hList, const Achievement& Ach)
-{
-    AddAchievementRow(Ach);
-
-    LV_ITEM item{};
-    item.mask = ra::to_unsigned(LVIF_TEXT);
-    item.iItem = gsl::narrow_cast<int>(m_lbxData.size() - 1);
-    item.cchTextMax = 256;
-
-    for (item.iSubItem = 0; item.iSubItem < NUM_COLS; ++item.iSubItem)
-    {
-        // Cache this (stack) to ensure it lives until after ListView_*Item
-        // SD: Is this necessary?
-        ra::tstring sTextData{NativeStr(m_lbxData.back().at(item.iSubItem))};
-        item.pszText = sTextData.data();
-
-        if (item.iSubItem == 0)
-            item.iItem = ListView_InsertItem(hList, &item);
-        else
-            ListView_SetItem(hList, &item);
-    }
-
-    return ra::to_unsigned(item.iItem);
-}
-
-void Dlg_Achievements::AddAchievementRow(const Achievement& Ach)
-{
-    AchievementDlgRow newRow;
-
-    // Add to our local array:
-    newRow.emplace_back((Ach.GetCategory() == Achievement::Category::Local) ? "0" : std::to_string(Ach.ID()));
-    newRow.emplace_back(Ach.Title());
-    newRow.emplace_back(std::to_string(Ach.Points()));
-    newRow.emplace_back(Ach.Author());
-
-    if (Ach.GetCategory() == Achievement::Category::Core)
-    {
-        newRow.emplace_back(!Ach.Active() ? "Yes" : "No");
-        newRow.emplace_back(Ach.Modified() ? "Yes" : "No");
-    }
-    else
-    {
-        newRow.emplace_back(Ach.Active() ? "Yes" : "No");
-        newRow.emplace_back("N/A");
-    }
-    static_assert(std::is_nothrow_move_constructible_v<AchievementDlgRow>);
-    m_lbxData.emplace_back(std::move_if_noexcept(newRow));
-
-    m_vAchievementIDs.emplace_back(Ach.ID());
-}
-
-void Dlg_Achievements::UpdateAchievementList()
-{
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    std::vector<ra::AchievementID> vAchievementIDs;
-
-    pGameContext.EnumerateAchievements([&vAchievementIDs, nActiveCategory = m_nActiveCategory](const Achievement& pAchievement)
-    {
-        if (pAchievement.GetCategory() == nActiveCategory)
-            vAchievementIDs.push_back(pAchievement.ID());
-
-        return true;
-    });
-
-    HWND hList = GetDlgItem(m_hAchievementsDlg, IDC_RA_LISTACHIEVEMENTS);
-    if (!hList)
-    {
-        m_vAchievementIDs.swap(vAchievementIDs);
-        return;
-    }
-
-    size_t nInsertIndex = 0;
-    for (auto nAchievementID : vAchievementIDs)
-    {
-        if (nInsertIndex == m_vAchievementIDs.size() || m_vAchievementIDs.at(nInsertIndex) != nAchievementID)
-            break;
-
-        ++nInsertIndex;
-    }
-
-    if (nInsertIndex != vAchievementIDs.size() || nInsertIndex != m_vAchievementIDs.size())
-    {
-        if (nInsertIndex < m_vAchievementIDs.size())
-        {
-            if (nInsertIndex == 0)
-            {
-                ListView_DeleteAllItems(hList);
-            }
-            else
-            {
-                for (auto nIndex = m_vAchievementIDs.size() - 1; nIndex >= nInsertIndex; --nIndex)
-                    ListView_DeleteItem(hList, nIndex);
-            }
-
-            m_lbxData.erase(m_lbxData.begin() + nInsertIndex, m_lbxData.end());
-            m_vAchievementIDs.erase(m_vAchievementIDs.begin() + nInsertIndex, m_vAchievementIDs.end());
-        }
-
-        while (nInsertIndex < vAchievementIDs.size())
-        {
-            AddAchievement(hList, *pGameContext.FindAchievement(vAchievementIDs.at(nInsertIndex)));
-            ++nInsertIndex;
-        }
-
-        assert(ListView_GetItemCount(hList) == gsl::narrow_cast<int>(m_vAchievementIDs.size()));
-    }
-}
-
-_Success_(return ) _NODISCARD BOOL
-    LocalValidateAchievementsBeforeCommit(_In_reads_(1) const std::array<int, 1> nLbxItems)
-{
-    for (auto& nIter : nLbxItems)
-    {
-        const Achievement& Ach = *g_AchievementsDialog.GetAchievementAt(nIter);
-        if (Ach.Title().length() < 2)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement title too short.",
-                ra::StringPrintf(L"Must be greater than 2 characters:\n\n%s", Ach.Title()));
-            return FALSE;
-        }
-        if (Ach.Title().length() > 63)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement title too long.",
-                ra::StringPrintf(L"Must be fewer than 64 characters:\n\n%s", Ach.Title()));
-            return FALSE;
-        }
-
-        if (Ach.Description().length() < 2)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement description too short.",
-                ra::StringPrintf(L"Must be greater than 2 characters:\n\n%s", Ach.Description()));
-            return FALSE;
-        }
-        if (Ach.Description().length() > 255)
-        {
-            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement description too long.",
-                ra::StringPrintf(L"Must be fewer than 256 characters:\n\n%s", Ach.Description()));
-            return FALSE;
-        }
-
-#if RA_INTEGRATION_VERSION_MINOR < 78
-        if (!ra::services::ServiceLocator::Get<ra::services::IConfiguration>().IsCustomHost())
-        {
-            for (size_t nGroup = 0; nGroup < Ach.NumConditionGroups(); ++nGroup)
-            {
-                for (size_t nCondition = 0; nCondition < Ach.NumConditions(nGroup); ++nCondition)
-                {
-                    const auto& pCondition = Ach.GetCondition(nGroup, nCondition);
-
-                    if (pCondition.GetConditionType() == Condition::Type::OrNext)
-                    {
-                        ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement contains pre-release logic.", L"* OrNext");
-                        return FALSE;
-                    }
-
-                    if (pCondition.GetConditionType() == Condition::Type::MeasuredIf)
-                    {
-                        ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement contains pre-release logic.", L"* MeasuredIf");
-                        return FALSE;
-                    }
-
-                    if (pCondition.CompSource().GetSize() == MemSize::BitCount ||
-                        pCondition.CompTarget().GetSize() == MemSize::BitCount)
-                    {
-                        ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Achievement contains pre-release logic.", L"* BitCount memory size");
-                        return FALSE;
-                    }
-                }
-            }
-        }
-#endif
-    }
-
-    return TRUE;
-}
-
-// static
-INT_PTR CALLBACK Dlg_Achievements::s_AchievementsProc(HWND hDlg, UINT nMsg, WPARAM wParam, LPARAM lParam)
-{
-    //  TBD: intercept any msgs?
-    return g_AchievementsDialog.AchievementsProc(hDlg, nMsg, wParam, lParam);
-}
-
-static ra::AchievementID AttemptUploadAchievementBlocking(const Achievement& Ach, unsigned int nFlags)
-{
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    const unsigned int nId = Ach.GetCategory() == Achievement::Category::Local ? 0 : Ach.ID();
-
-    ra::api::UpdateAchievement::Request request;
-    request.GameId = pGameContext.GameId();
-    request.AchievementId = nId;
-    request.Title = ra::Widen(Ach.Title());
-    request.Description = ra::Widen(Ach.Description());
-    request.Trigger = Ach.CreateMemString();
-    request.Points = Ach.Points();
-    request.Category = nFlags;
-    request.Badge = Ach.BadgeImageURI();
-
-    const auto& response = request.Call();
-    if (response.Succeeded())
-        return response.AchievementId;
-
-    ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(
-        ra::StringPrintf(L"Failed to upload '%s'", Ach.Title()), ra::Widen(response.ErrorMessage));
-    return 0U;
-}
-
-void Dlg_Achievements::OnClickAchievementSet(Achievement::Category nAchievementSet)
-{
-    m_nActiveCategory = nAchievementSet;
-    SetupColumns(GetDlgItem(m_hAchievementsDlg, IDC_RA_LISTACHIEVEMENTS));
-
-    if (nAchievementSet == Achievement::Category::Core)
-    {
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), FALSE);
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TEXT("Demote from Core"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_COMMIT_ACH), TEXT("Commit Selected"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_DOWNLOAD_ACH), TEXT("Refresh from Server"));
-
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ADD_ACH), FALSE); // Cannot add direct to Core
-
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ACTIVATE_ALL_ACH), FALSE);
-
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_CORE, TRUE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_UNOFFICIAL, FALSE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_LOCAL, FALSE);
-    }
-    else if (nAchievementSet == Achievement::Category::Unofficial)
-    {
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TRUE);
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TEXT("Promote to Core"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_COMMIT_ACH), TEXT("Commit Selected"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_DOWNLOAD_ACH), TEXT("Refresh from Server"));
-
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ADD_ACH), FALSE); // Cannot add direct to Unofficial
-
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ACTIVATE_ALL_ACH), TRUE);
-
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_CORE, FALSE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_UNOFFICIAL, TRUE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_LOCAL, FALSE);
-    }
-    else if (nAchievementSet == Achievement::Category::Local)
-    {
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TRUE);
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TEXT("Promote to Unofficial"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_COMMIT_ACH), TEXT("Save All Local"));
-        SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_DOWNLOAD_ACH), TEXT("Refresh from Disk"));
-
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ADD_ACH), TRUE); // Can add to Local
-
-        ShowWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ACTIVATE_ALL_ACH), TRUE);
-
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_CORE, FALSE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_UNOFFICIAL, FALSE);
-        CheckDlgButton(m_hAchievementsDlg, IDC_RA_ACTIVE_LOCAL, TRUE);
-    }
-
-    UpdateAchievementCounters();
-
-    const auto& pRuntime = ra::services::ServiceLocator::Get<ra::services::AchievementRuntime>();
-    CheckDlgButton(m_hAchievementsDlg, IDC_RA_CHKACHPROCESSINGACTIVE, !pRuntime.IsPaused());
-
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    OnLoad_NewRom(pGameContext.GameId()); // assert: calls UpdateSelectedAchievementButtons
-
-    g_AchievementEditorDialog.OnLoad_NewRom();
-}
-
-INT_PTR Dlg_Achievements::AchievementsProc(HWND hDlg, UINT nMsg, WPARAM wParam, LPARAM lParam)
-{
-    switch (nMsg)
-    {
-        case WM_INITDIALOG:
-        {
-            m_hAchievementsDlg = hDlg;
-
-            SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_CORE, BM_SETCHECK, 0U, 0L);
-            SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_UNOFFICIAL, BM_SETCHECK, 0U, 0L);
-            SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_LOCAL, BM_SETCHECK, 0U, 0L);
-
-            switch (m_nActiveCategory)
-            {
-                case Achievement::Category::Core:
-                    SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_CORE, BM_SETCHECK, 1U, 0L);
-                    break;
-                case Achievement::Category::Unofficial:
-                    SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_UNOFFICIAL, BM_SETCHECK, 1U, 0L);
-                    break;
-                case Achievement::Category::Local:
-                    SendDlgItemMessage(hDlg, IDC_RA_ACTIVE_LOCAL, BM_SETCHECK, 1U, 0L);
-                    break;
-                default:
-                    ASSERT(!"Unknown achievement set!");
-                    break;
-            }
-
-            SetupColumns(GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS));
-
-            //  Continue as if a new rom had been loaded
-            const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-            OnLoad_NewRom(pGameContext.GameId());
-
-            const auto& pRuntime = ra::services::ServiceLocator::Get<ra::services::AchievementRuntime>();
-            CheckDlgButton(hDlg, IDC_RA_CHKACHPROCESSINGACTIVE, !pRuntime.IsPaused());
-
-            //  Click the core
-            OnClickAchievementSet(Achievement::Category::Core);
-
-            RestoreWindowPosition(hDlg, "Achievements", false, true);
-        }
-            return TRUE;
-
-        case WM_COMMAND:
-            switch (LOWORD(wParam))
-            {
-                case IDC_RA_ACTIVE_CORE:
-                    OnClickAchievementSet(Achievement::Category::Core);
-                    return TRUE;
-
-                case IDC_RA_ACTIVE_UNOFFICIAL:
-                    OnClickAchievementSet(Achievement::Category::Unofficial);
-                    return TRUE;
-
-                case IDC_RA_ACTIVE_LOCAL:
-                    OnClickAchievementSet(Achievement::Category::Local);
-                    return TRUE;
-
-                case IDCLOSE:
-                    EndDialog(hDlg, TRUE);
-                    return TRUE;
-
-                case IDC_RA_PROMOTE_ACH:
-                    //  Replace with background upload?
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                    {
-                        MessageBox(hDlg, TEXT("ROM not loaded: please load a ROM first!"), TEXT("Error!"), MB_OK);
-                    }
-                    else
-                    {
-                        if (m_nActiveCategory == Achievement::Category::Local)
-                        {
-                            // Promote from Local to Unofficial is just a commit to Unofficial
-                            CommitAchievements(hDlg);
-                        }
-                        else if (m_nActiveCategory == Achievement::Category::Unofficial)
-                        {
-                            HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                            const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                            if (nSel == -1)
-                                return FALSE;
-
-                            //  Promote to Core
-                            Achievement& selectedAch = *GetAchievementAt(nSel);
-
-                            //  Note: specify that this is a one-way operation
-                            ra::ui::viewmodels::MessageBoxViewModel vmPrompt;
-                            vmPrompt.SetHeader(ra::StringPrintf(L"Promote '%s' to core?", selectedAch.Title()));
-                            vmPrompt.SetMessage(L"Please note that this is a one-way operaton, and will allow players to officially obtain the achievement and the points for it.");
-                            vmPrompt.SetIcon(ra::ui::viewmodels::MessageBoxViewModel::Icon::Warning);
-                            vmPrompt.SetButtons(ra::ui::viewmodels::MessageBoxViewModel::Buttons::YesNo);
-
-                            if (vmPrompt.ShowModal() == ra::ui::DialogResult::Yes)
-                            {
-                                unsigned int nFlags = 1 << 0; //  Active achievements! : 1
-                                if (m_nActiveCategory == Achievement::Category::Unofficial)
-                                    nFlags |= 1 << 1; //  Official achievements: 3
-
-                                const auto nID = AttemptUploadAchievementBlocking(selectedAch, nFlags);
-                                if (nID > 0)
-                                {
-                                    //  Remove the achievement from the local/user achievement set,
-                                    //   add it to the unofficial set.
-                                    selectedAch.SetCategory(Achievement::Category::Core);
-                                    RemoveAchievement(hList, nSel);
-
-                                    selectedAch.SetActive(TRUE); //  Disable it: all promoted ach must be reachieved
-
-                                    // CoreAchievements->Save();
-                                    // UnofficialAchievements->Save();
-
-                                    ra::ui::viewmodels::MessageBoxViewModel::ShowMessage(
-                                        ra::StringPrintf(L"Successfully uploaded '%s'", selectedAch.Title()));
-                                }
-                            }
-                        }
-                        //                  else if( g_nActiveAchievementSet == Core )
-                        //                  {
-                        //                      //  Demote from Core
-                        //
-                        //                  }
-                    }
-
-                    break;
-                case IDC_RA_DOWNLOAD_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                        break;
-
-                    if (m_nActiveCategory == Achievement::Category::Local)
-                    {
-                        if (MessageBox(hDlg,
-                                       TEXT("Are you sure that you want to reload achievements from disk?\n")
-                                           TEXT("This will overwrite any changes that you have made.\n"),
-                                       TEXT("Refresh from Disk"),
-                                       MB_YESNO | MB_ICONWARNING) == IDYES)
-                        {
-                            auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                            const auto nGameID = pGameContext.GameId();
-                            if (nGameID != 0)
-                            {
-                                pGameContext.ReloadAchievements(Achievement::Category::Local);
-
-                                //  Refresh dialog contents:
-                                OnLoad_NewRom(nGameID);
-
-                                //  Cause it to reload!
-                                OnClickAchievementSet(m_nActiveCategory);
-                            }
-                        }
-                    }
-                    else
-                    {
-                        std::ostringstream oss;
-                        oss << "Are you sure that you want to download fresh achievements from " << _RA_HostName()
-                            << "?\n"
-                            << "This will overwrite any changes that you have made with fresh achievements from the "
-                               "server";
-                        if (MessageBox(hDlg, NativeStr(oss.str()).c_str(), TEXT("Refresh from Server"),
-                                       MB_YESNO | MB_ICONWARNING) == IDYES)
-                        {
-                            auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                            const auto nGameID = pGameContext.GameId();
-                            if (nGameID != 0)
-                            {
-                                pGameContext.LoadGame(nGameID);
-
-                                //  Refresh dialog contents:
-                                OnLoad_NewRom(nGameID);
-
-                                //  Cause it to reload!
-                                OnClickAchievementSet(m_nActiveCategory);
-                            }
-                        }
-                    }
-                }
-                break;
-
-                case IDC_RA_ADD_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                    {
-                        MessageBox(hDlg, TEXT("ROM not loaded: please load a ROM first!"), TEXT("Error!"), MB_OK);
-                        break;
-                    }
-
-                    //  Add a new achievement with default params
-                    auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                    Achievement& Cheevo = pGameContext.NewAchievement(Achievement::Category::Local);
-                    Cheevo.SetAuthor(ra::services::ServiceLocator::Get<ra::data::context::UserContext>().GetUsername());
-                    Cheevo.SetBadgeImage("00000");
-
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                    const int nNewID = AddAchievement(hList, Cheevo);
-                    ListView_SetItemState(hList, nNewID, LVIS_FOCUSED | LVIS_SELECTED, ra::to_unsigned(-1));
-                    ListView_EnsureVisible(hList, nNewID, FALSE);
-
-                    char buffer[16];
-                    sprintf_s(buffer, 16, " %zu", m_vAchievementIDs.size());
-                    SetDlgItemText(m_hAchievementsDlg, IDC_RA_NUMACH, NativeStr(buffer).c_str());
-
-                    Cheevo.SetModified(TRUE);
-                    UpdateSelectedAchievementButtons(&Cheevo);
-                }
-                break;
-
-                case IDC_RA_CLONE_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                    {
-                        MessageBox(hDlg, TEXT("ROM not loaded: please load a ROM first!"), TEXT("Error!"), MB_OK);
-                        break;
-                    }
-
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                    const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                    if (nSel == -1)
-                        return FALSE;
-
-                    //  switch to LocalAchievements
-                    auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                    Achievement& NewClone = pGameContext.NewAchievement(Achievement::Category::Local);
-
-                    //  Clone TO the user achievements
-                    const Achievement& Ach = *g_AchievementsDialog.GetAchievementAt(nSel);
-
-                    NewClone.CopyFrom(Ach);
-                    NewClone.SetAuthor(ra::services::ServiceLocator::Get<ra::data::context::UserContext>().GetUsername());
-                    NewClone.SetTitle(ra::StringPrintf("%s (copy)", Ach.Title()));
-
-                    OnClickAchievementSet(Achievement::Category::Local);
-
-                    ListView_SetItemState(hList, m_vAchievementIDs.size() - 1,
-                                          LVIS_FOCUSED | LVIS_SELECTED, ra::to_unsigned(-1));
-                    ListView_EnsureVisible(hList, m_vAchievementIDs.size() - 1, FALSE);
-
-                    UpdateAchievementCounters();
-
-                    NewClone.SetModified(TRUE);
-                    UpdateSelectedAchievementButtons(&NewClone);
-                }
-
-                break;
-                case IDC_RA_DEL_ACH:
-                {
-                    auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                    if (pGameContext.GameId() == 0U)
-                    {
-                        MessageBox(hDlg, TEXT("ROM not loaded: please load a ROM first!"), TEXT("Error!"), MB_OK);
-                        break;
-                    }
-
-                    //  Attempt to remove from list, but if it has an Id > 0,
-                    //   attempt to remove from DB
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                    const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                    if (nSel != -1)
-                    {
-                        const Achievement& Ach = *g_AchievementsDialog.GetAchievementAt(nSel);
-
-                        ra::ui::viewmodels::MessageBoxViewModel vmMessageBox;
-                        vmMessageBox.SetIcon(ra::ui::viewmodels::MessageBoxViewModel::Icon::Warning);
-
-                        if (Ach.GetCategory() == Achievement::Category::Local)
-                        {
-                            vmMessageBox.SetMessage(L"Are you sure that you want to delete this achievement?");
-                        }
-                        else
-                        {
-                            ra::ui::viewmodels::MessageBoxViewModel::ShowErrorMessage(L"Deleting achievements from the server is not supported.");
-                            break;
-
-                            //vmMessageBox.SetHeader(L"Are you sure that you want to delete this achievement?");
-                            //vmMessageBox.SetMessage(ra::StringPrintf(L"This achievement exists on %s. Removing it will affect other players.", _RA_HostName()));
-                        }
-                        vmMessageBox.SetButtons(ra::ui::viewmodels::MessageBoxViewModel::Buttons::YesNo);
-
-                        if (vmMessageBox.ShowModal() == ra::ui::DialogResult::Yes)
-                        {
-                            pGameContext.RemoveAchievement(Ach.ID());
-                            RemoveAchievement(hList, nSel);
-                        }
-                    }
-                }
-                break;
-
-                case IDC_RA_COMMIT_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                        break;
-
-                    auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                    if (m_nActiveCategory == Achievement::Category::Local)
-                    {
-                        // Local save is to disk
-                        std::vector<ra::data::models::AssetModelBase*> vList;
-                        pGameContext.Assets().SaveAssets(vList);
-
-                        ra::ui::viewmodels::MessageBoxViewModel::ShowMessage(L"Saved OK!");
-
-                        for (auto nAchievementId : m_vAchievementIDs)
-                        {
-                            auto* pAchievement = pGameContext.FindAchievement(nAchievementId);
-                            if (pAchievement)
-                                pAchievement->SetModified(FALSE);
-                        }
-
-                        InvalidateRect(hDlg, nullptr, FALSE);
-                    }
-                    else
-                    {
-                        CommitAchievements(hDlg);
-                    }
-
-                    return TRUE;
-                }
-
-                case IDC_RA_REVERTSELECTED:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                        break;
-
-                    //  Attempt to remove from list, but if it has an Id > 0,
-                    //   attempt to remove from DB
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                    const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                    if (nSel != -1)
-                    {
-                        Achievement& Cheevo = *g_AchievementsDialog.GetAchievementAt(nSel);
-
-                        //  Ignore if it's not modified... no changes should be present...
-                        if (!Cheevo.Modified())
-                            break;
-
-                        if (MessageBox(hDlg, TEXT("Attempt to revert this achievement from file?"),
-                                       TEXT("Revert from file?"), MB_YESNO) == IDYES)
-                        {
-                            // Find Achievement with Ach.Id()
-                            const ra::AchievementID nID = Cheevo.ID();
-
-                            auto& pGameContext = ra::services::ServiceLocator::GetMutable<ra::data::context::GameContext>();
-                            if (pGameContext.ReloadAchievement(nID))
-                            {
-                                Cheevo.SetModified(FALSE);
-
-                                ReloadLBXData(nID);
-
-                                // reselect to update AchEditor
-                                if (g_AchievementEditorDialog.ActiveAchievement() &&
-                                    g_AchievementEditorDialog.ActiveAchievement()->ID() == nID)
-                                {
-                                    g_AchievementEditorDialog.LoadAchievement(&Cheevo, FALSE);
-                                }
-                            }
-                            else
-                            {
-                                ra::ui::viewmodels::MessageBoxViewModel::ShowWarningMessage(L"Revert failed.", L"Could not find the selected achievement in the local file.");
-                            }
-                        }
-                    }
-                }
-                break;
-
-                case IDC_RA_CHKACHPROCESSINGACTIVE:
-                {
-                    auto& pRuntime = ra::services::ServiceLocator::GetMutable<ra::services::AchievementRuntime>();
-                    pRuntime.SetPaused(IsDlgButtonChecked(hDlg, IDC_RA_CHKACHPROCESSINGACTIVE) == FALSE);
-                    auto& pEmulatorContext = ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>();
-                    pEmulatorContext.SetMemoryModified();
-                    return TRUE;
-                }
-
-                case IDC_RA_RESET_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U)
-                        break;
-
-                    // this could fuck up in so, so many ways. But fuck it, just reset achieved status.
-                    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                    const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-                    if (nSel != -1)
-                    {
-                        Achievement& Cheevo = *g_AchievementsDialog.GetAchievementAt(nSel);
-                        if (!Cheevo.Active())
-                        {
-                            const TCHAR* sMessage = TEXT("Temporarily reset 'achieved' state of this achievement?");
-                            if (m_nActiveCategory != Achievement::Category::Core)
-                                sMessage = TEXT("Activate this achievement?");
-
-                            if (MessageBox(hDlg, sMessage, TEXT("Activate Achievement"), MB_YESNO) == IDYES)
-                            {
-                                Cheevo.SetActive(true);
-
-                                // SetActive will only set the state to WAITING. We want it to be immediately active
-                                // (i.e. it should immediately trigger if all the conditions are true).
-                                auto& pRuntime = ra::services::ServiceLocator::GetMutable<ra::services::AchievementRuntime>();
-                                auto* pTrigger = pRuntime.GetAchievementTrigger(Cheevo.ID());
-                                if (pTrigger->state == RC_TRIGGER_STATE_WAITING)
-                                    pTrigger->state = RC_TRIGGER_STATE_ACTIVE;
-
-                                if (m_nActiveCategory == Achievement::Category::Core)
-                                    OnEditData(nSel, Column::Achieved, "No");
-                                else
-                                    OnEditData(nSel, Column::Active, "Yes");
-
-                                //  Also needs to reinject text into IDC_RA_LISTACHIEVEMENTS
-                            }
-                        }
-                        else if (m_nActiveCategory != Achievement::Category::Core)
-                        {
-                            if (MessageBox(hDlg, TEXT("Deactivate this achievement?"), TEXT("Deactivate Achievement"),
-                                           MB_YESNO) == IDYES)
-                            {
-                                Cheevo.SetActive(false);
-
-                                OnEditData(nSel, Column::Active, "No");
-                            }
-                        }
-
-                        UpdateSelectedAchievementButtons(&Cheevo);
-                    }
-
-                    return TRUE;
-                }
-
-                case IDC_RA_ACTIVATE_ALL_ACH:
-                {
-                    if (ra::services::ServiceLocator::Get<ra::data::context::GameContext>().GameId() == 0U || m_vAchievementIDs.empty())
-                        break;
-
-                    if (MessageBox(hDlg, TEXT("Activate all achievements?"), TEXT("Activate Achievements"), MB_YESNO) ==
-                        IDYES)
-                    {
-                        HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-                        const size_t nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-
-                        size_t nIndex = 0;
-                        auto& pRuntime = ra::services::ServiceLocator::GetMutable<ra::services::AchievementRuntime>();
-                        const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-                        for (auto nAchievementID : m_vAchievementIDs)
-                        {
-                            Achievement& Cheevo = *pGameContext.FindAchievement(nAchievementID);
-                            if (!Cheevo.Active())
-                            {
-                                Cheevo.SetActive(true);
-
-                                // SetActive will only set the state to WAITING. We want it to be immediately active
-                                // (i.e. it should immediately trigger if all the conditions are true).
-                                auto* pTrigger = pRuntime.GetAchievementTrigger(Cheevo.ID());
-                                if (pTrigger->state == RC_TRIGGER_STATE_WAITING)
-                                    pTrigger->state = RC_TRIGGER_STATE_ACTIVE;
-
-                                if (m_nActiveCategory == Achievement::Category::Core)
-                                    OnEditData(nIndex, Column::Achieved, "No");
-                                else
-                                    OnEditData(nIndex, Column::Active, "Yes");
-
-                                if (nIndex == nSel)
-                                    UpdateSelectedAchievementButtons(&Cheevo);
-                            }
-
-                            ++nIndex;
-                        }
-                    }
-
-                    return TRUE;
-                }
-            }
-            break;
-
-        case WM_NOTIFY:
-        {
-#pragma warning(push)
-#pragma warning(disable: 26490)
-            GSL_SUPPRESS_TYPE1
-            switch (reinterpret_cast<LPNMHDR>(lParam)->code)
-            {
-                case LVN_ITEMCHANGED: //!?? LVN on a LPNMHDR?
-                {
-                    iSelect = -1;
-                    // MessageBox( nullptr, "Item changed!", "TEST", MB_OK );
-                    GSL_SUPPRESS_TYPE1 LPNMLISTVIEW pLVInfo = reinterpret_cast<LPNMLISTVIEW>(lParam);
-#pragma warning(pop)
-                    if (pLVInfo->iItem != -1)
-                    {
-                        iSelect = pLVInfo->iItem;
-                        if ((pLVInfo->uNewState &= LVIS_SELECTED) != 0)
-                        {
-                            const int nNewIndexSelected = pLVInfo->iItem;
-                            Achievement& Cheevo = *g_AchievementsDialog.GetAchievementAt(nNewIndexSelected);
-                            g_AchievementEditorDialog.LoadAchievement(&Cheevo, FALSE);
-
-                            UpdateSelectedAchievementButtons(&Cheevo);
-                        }
-                    }
-                    else
-                    {
-                        UpdateSelectedAchievementButtons(nullptr);
-                    }
-                }
-                break;
-
-                case NM_DBLCLK:
-#pragma warning(push)
-#pragma warning(disable: 26490)
-                    GSL_SUPPRESS_TYPE1
-                    if (reinterpret_cast<LPNMITEMACTIVATE>(lParam)->iItem != -1)
-                    {
-                        _RA_InvokeDialog(IDM_RA_FILES_ACHIEVEMENTEDITOR);
-                        GSL_SUPPRESS_TYPE1 g_AchievementEditorDialog.LoadAchievement(
-                            g_AchievementsDialog.GetAchievementAt(reinterpret_cast<LPNMITEMACTIVATE>(lParam)->iItem),
-                            FALSE);
-#pragma warning(pop)
-                    }
-                    return FALSE; //? TBD ##SD
-
-                case NM_CUSTOMDRAW:
-                    SetWindowLongPtr(hDlg, DWLP_MSGRESULT, ProcessCustomDraw(lParam));
-                    return TRUE;
-            }
-
-            break;
-        }
-
-        case WM_CLOSE:
-            EndDialog(hDlg, TRUE);
-            return TRUE;
-
-        case WM_MOVE:
-            RememberWindowPosition(hDlg, "Achievements");
-            break;
-
-        case WM_SIZE:
-            RememberWindowSize(hDlg, "Achievements");
-            break;
-    }
-
-    return FALSE; //  Unhandled
-}
-
-INT_PTR Dlg_Achievements::CommitAchievements(HWND hDlg)
-{
-    constexpr int nMaxUploadLimit = 1;
-
-    size_t nNumChecked = 0;
-    std::array<int, nMaxUploadLimit> nIDsChecked{};
-    std::array<int, nMaxUploadLimit> nLbxItemsChecked{};
-
-    HWND hList = GetDlgItem(hDlg, IDC_RA_LISTACHIEVEMENTS);
-    const int nSel = ListView_GetNextItem(hList, -1, LVNI_SELECTED);
-    if (nSel != -1)
-    {
-        nLbxItemsChecked.front() = nSel;
-        nIDsChecked.front() = m_vAchievementIDs.at(nSel);
-
-        nNumChecked++;
-    }
-
-    if (nNumChecked == 0)
-        return FALSE;
-
-    if (LocalValidateAchievementsBeforeCommit(nLbxItemsChecked) == FALSE)
-        return FALSE;
-
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    std::string title;
-
-    ra::ui::viewmodels::MessageBoxViewModel vmPrompt;
-    vmPrompt.SetMessage(L"You are about to update data on the server. Doing so will immediately make that data available for other players.");
-    vmPrompt.SetIcon(ra::ui::viewmodels::MessageBoxViewModel::Icon::Warning);
-    vmPrompt.SetButtons(ra::ui::viewmodels::MessageBoxViewModel::Buttons::YesNo);
-
-    if (nNumChecked == 1)
-    {
-        const Achievement& pAch = *pGameContext.FindAchievement(nIDsChecked.front());
-        if (pAch.GetCategory() == Achievement::Category::Local)
-            vmPrompt.SetHeader(ra::StringPrintf(L"Are you sure you want to upload '%s'?", pAch.Title()));
-        else
-            vmPrompt.SetHeader(ra::StringPrintf(L"Are you sure you want to update '%s'?", pAch.Title()));
-    }
-    // else
-    //{
-    //  title = std::string("Upload ") + std::to_string( nNumChecked ) + std::string(" Achievements");
-    //}
-
-    if (vmPrompt.ShowModal() == ra::ui::DialogResult::Yes)
-    {
-        for (size_t nIndex = 0; nIndex < nNumChecked; ++nIndex)
-        {
-            Achievement& NextAch = *pGameContext.FindAchievement(nIDsChecked.at(nIndex));
-
-            BOOL bMovedFromUserToUnofficial = false;
-
-            unsigned int nFlags = ra::etoi(NextAch.GetCategory());
-            if (NextAch.GetCategory() == Achievement::Category::Local)
-            {
-                bMovedFromUserToUnofficial = true;
-                nFlags = ra::etoi(Achievement::Category::Unofficial); // promote to unofficial
-            }
-
-            const auto nAchID = AttemptUploadAchievementBlocking(NextAch, nFlags);
-            if (nAchID > 0)
-            {
-                const auto nCurrentId = NextAch.ID();
-                if (nCurrentId != nAchID)
-                {
-                    ra::services::ServiceLocator::GetMutable<ra::services::AchievementRuntime>().UpdateAchievementId(nCurrentId, nAchID);
-                    NextAch.SetID(nAchID);
-
-                    LbxDataAt(nLbxItemsChecked.at(nIndex), Column::Id) = std::to_string(nAchID);
-                }
-
-                // Update listbox on achievements dlg
-
-                if (bMovedFromUserToUnofficial)
-                {
-                    //  Remove the achievement from the local/user achievement set,
-                    //  add it to the unofficial set.
-                    NextAch.SetCategory(Achievement::Category::Unofficial);
-                    NextAch.SetModified(FALSE);
-
-                    UpdateAchievementList();
-                    UpdateAchievementCounters();
-                }
-                else
-                {
-                    //  Updated an already existing achievement, still the same position/Id.
-                    NextAch.SetModified(FALSE);
-                    OnEditData(nLbxItemsChecked.at(nIndex), Column::Modified, "No");
-
-                    //  Save em all - we may have changed any of them :S
-                    // CoreAchievements->Save();
-                    // UnofficialAchievements->Save();
-                    // LocalAchievements->Save();    // Will this one have changed? Maybe
-                }
-            }
-        }
-
-        {
-            char buffer[512];
-            sprintf_s(buffer, 512, "Successfully uploaded data for %zu achievements!", nNumChecked);
-            MessageBox(hDlg, NativeStr(buffer).c_str(), TEXT("Success!"), MB_OK);
-
-            RECT rcBounds;
-            GetClientRect(hList, &rcBounds);
-            InvalidateRect(hList, &rcBounds, FALSE);
-        }
-    }
-    return TRUE;
-}
-
-void Dlg_Achievements::UpdateSelectedAchievementButtons(const Achievement* restrict Cheevo) noexcept
-{
-    if (Cheevo == nullptr)
-    {
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_RESET_ACH), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_REVERTSELECTED), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_COMMIT_ACH),
-                     m_nActiveCategory == Achievement::Category::Local);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_CLONE_ACH), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_DEL_ACH), FALSE);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), FALSE);
-    }
-    else
-    {
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_REVERTSELECTED), Cheevo->Modified());
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_CLONE_ACH), TRUE);
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_DEL_ACH),
-                     m_nActiveCategory == Achievement::Category::Local);
-
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_COMMIT_ACH),
-            m_nActiveCategory == Achievement::Category::Local ? TRUE : Cheevo->Modified());
-        EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TRUE);
-
-        if (m_nActiveCategory != Achievement::Category::Core)
-        {
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_RESET_ACH), TRUE);
-            SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_RESET_ACH),
-                          Cheevo->Active() ? TEXT("Deactivate Selected") : TEXT("Activate Selected"));
-        }
-        else
-        {
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_RESET_ACH), !Cheevo->Active());
-            SetWindowText(GetDlgItem(m_hAchievementsDlg, IDC_RA_RESET_ACH), TEXT("Activate Selected"));
-        }
-    }
-}
-
-void Dlg_Achievements::OnLoad_NewRom(unsigned int nGameID)
-{
-    EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_DOWNLOAD_ACH), FALSE);
-    EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ADD_ACH), FALSE);
-    EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ACTIVATE_ALL_ACH), FALSE);
-    EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), FALSE);
-
-    {
-        UpdateAchievementList();
-
-        TCHAR buffer[256];
-        _stprintf_s(buffer, 256, _T(" %u"), nGameID);
-        SetDlgItemText(m_hAchievementsDlg, IDC_RA_GAMEHASH, NativeStr(buffer).c_str());
-
-        if (nGameID != 0)
-        {
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_DOWNLOAD_ACH), TRUE);
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ADD_ACH),
-                         m_nActiveCategory == Achievement::Category::Local);
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_ACTIVATE_ALL_ACH), TRUE);
-            EnableWindow(GetDlgItem(m_hAchievementsDlg, IDC_RA_PROMOTE_ACH), TRUE);
-        }
-
-        UpdateAchievementCounters();
-    }
-
-    UpdateSelectedAchievementButtons(nullptr);
-}
-
-void Dlg_Achievements::OnEditAchievement(const Achievement& ach)
-{
-    size_t nIndex = 0;
-    for (auto nAchievementId : m_vAchievementIDs)
-    {
-        if (ach.ID() == nAchievementId)
-            break;
-
-        ++nIndex;
-    }
-
-    if (nIndex < m_vAchievementIDs.size())
-    {
-        OnEditData(nIndex, Column::Points, std::to_string(ach.Points()));
-
-        UpdateAchievementCounters();
-
-        if (m_nActiveCategory == Achievement::Category::Core)
-            OnEditData(nIndex, Column::Modified, "Yes");
-    }
-
-    UpdateSelectedAchievementButtons(&ach);
-}
-
-void Dlg_Achievements::ReloadLBXData(ra::AchievementID nID)
-{
-    // const char* g_sColTitles[]            = { "Id", "Title", "Author", "Achieved?", "Modified?" };
-    // const char* g_sColTitlesUnofficial[]  = { "Id", "Title", "Author", "Active", "Votes" };
-
-    size_t nOffset = 0;
-    for (const auto nLbxID : m_vAchievementIDs)
-    {
-        if (nLbxID == nID)
-            break;
-
-        ++nOffset;
-    }
-
-    if (nOffset == m_vAchievementIDs.size())
-        return;
-
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    const Achievement* pAchievement = pGameContext.FindAchievement(nID);
-    if (pAchievement == nullptr)
-        return;
-
-    const Achievement& Ach = *pAchievement;
-    if (m_nActiveCategory == Achievement::Category::Core)
-    {
-        OnEditData(nOffset, Column::Title, Ach.Title());
-        OnEditData(nOffset, Column::Author, Ach.Author());
-        OnEditData(nOffset, Column::Achieved, !Ach.Active() ? "Yes" : "No");
-        OnEditData(nOffset, Column::Modified, Ach.Modified() ? "Yes" : "No");
-    }
-    else
-    {
-        OnEditData(nOffset, Column::Title, Ach.Title());
-        OnEditData(nOffset, Column::Author, Ach.Author());
-        OnEditData(nOffset, Column::Active, Ach.Active() ? "Yes" : "No");
-        OnEditData(nOffset, Column::Votes, "N/A");
-    }
-
-    UpdateSelectedAchievementButtons(&Ach);
-}
-
-void Dlg_Achievements::UpdateActiveAchievements()
-{
-    const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-    for (size_t nIndex = 0; nIndex < m_vAchievementIDs.size(); ++nIndex)
-    {
-        const Achievement* pAchievement = pGameContext.FindAchievement(m_vAchievementIDs.at(nIndex));
-        if (pAchievement != nullptr)
-        {
-            if (m_nActiveCategory == Achievement::Category::Core)
-                OnEditData(nIndex, Column::Achieved, pAchievement->Active() ? "No" : "Yes");
-            else
-                OnEditData(nIndex, Column::Achieved, pAchievement->Active() ? "Yes" : "No");
-        }
-    }
-}
-
-void Dlg_Achievements::OnEditData(size_t nItem, Column nColumn, const std::string& sNewData)
-{
-    if (nItem >= m_lbxData.size())
-        return;
-
-    m_lbxData.at(nItem).at(ra::etoi(nColumn)) = sNewData;
-
-    HWND hList = GetDlgItem(m_hAchievementsDlg, IDC_RA_LISTACHIEVEMENTS);
-    if (hList != nullptr)
-    {
-        ra::tstring sStr{NativeStr(LbxDataAt(nItem, nColumn))}; // scoped cache
-        LV_ITEM item{};
-        item.mask = UINT{LVIF_TEXT};
-        item.iItem = gsl::narrow_cast<int>(nItem);
-        item.iSubItem = gsl::narrow_cast<int>(ra::etoi(nColumn));
-        item.pszText = sStr.data();
-        item.cchTextMax = 256;
-
-        if (ListView_SetItem(hList, &item) == FALSE)
-        {
-            ASSERT(!"Failed to ListView_SetItem!");
-        }
-        else
-        {
-            RECT rcBounds{};
-            GSL_SUPPRESS_ES47 ListView_GetItemRect(hList, nItem, &rcBounds, LVIR_BOUNDS);
-            InvalidateRect(hList, &rcBounds, FALSE);
-        }
-    }
-}
-
-int Dlg_Achievements::GetSelectedAchievementIndex() noexcept
-{
-    HWND hList = GetDlgItem(m_hAchievementsDlg, IDC_RA_LISTACHIEVEMENTS);
-    return ListView_GetSelectionMark(hList);
-}
-
-Achievement* Dlg_Achievements::GetAchievementAt(gsl::index nIndex) const
-{
-    if (ra::to_unsigned(nIndex) < m_vAchievementIDs.size())
-    {
-        const auto& pGameContext = ra::services::ServiceLocator::Get<ra::data::context::GameContext>();
-        return pGameContext.FindAchievement(m_vAchievementIDs.at(nIndex));
-    }
-
-    return nullptr;
-}
-
diff --git a/src/RA_Dlg_Achievement.h b/src/RA_Dlg_Achievement.h
deleted file mode 100644
index 824613c5..00000000
--- a/src/RA_Dlg_Achievement.h
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef RA_DLG_ACHIEVEMENT_H
-#define RA_DLG_ACHIEVEMENT_H
-#pragma once
-
-#include "RA_Achievement.h"
-
-inline constexpr int MAX_TEXT_ITEM_SIZE = 80;
-
-class Dlg_Achievements
-{
-    using AchievementDlgRow = std::vector<std::string>;
-
-public:
-    enum class Column : std::size_t
-    {
-        Id,
-        Title,
-        Points,
-        Author,
-        Achieved,
-        Active = Achieved,
-        Modified,
-        Votes = Modified
-    };
-
-public:
-    static INT_PTR CALLBACK s_AchievementsProc(HWND, UINT, WPARAM, LPARAM);
-    INT_PTR AchievementsProc(HWND, UINT, WPARAM, LPARAM);
-
-    int GetSelectedAchievementIndex() noexcept;
-    Achievement* GetAchievementAt(gsl::index nIndex) const;
-    void OnLoad_NewRom(unsigned int nGameID);
-    void ReloadLBXData(ra::AchievementID nID);
-    void OnEditData(size_t nItem, Column nColumn, const std::string& sNewData);
-    void OnEditAchievement(const Achievement& ach);
-    void OnClickAchievementSet(Achievement::Category nAchievementSet);
-    void UpdateActiveAchievements();
-    void UpdateAchievementList();
-
-    _NODISCARD inline auto& LbxDataAt(_In_ std::size_t nRow, _In_ Column nCol)
-    {
-        // we need to check stuff to prevent throwing in release mode
-        assert(nRow >= 0 && nRow < m_lbxData.size());
-        auto& rowRef{m_lbxData.at(nRow)};
-
-        using namespace ra::rel_ops;
-        assert(nCol >= 0 && nCol < rowRef.size());
-        return rowRef.at(ra::etoi(nCol));
-    }
-
-    inline HWND GetHWND() const noexcept { return m_hAchievementsDlg; }
-    void InstallHWND(HWND hWnd) noexcept { m_hAchievementsDlg = hWnd; }
-
-    const std::vector<ra::AchievementID>& FilteredAchievements() const noexcept { return m_vAchievementIDs; }
-
-private:
-    void SetupColumns(HWND hList);
-    void UpdateAchievementCounters();
-
-    void RemoveAchievement(HWND hList, int nIter);
-    int AddAchievement(HWND hList, const Achievement& Ach);
-    void AddAchievementRow(const Achievement& Ach);
-
-    INT_PTR CommitAchievements(HWND hDlg);
-
-    void UpdateSelectedAchievementButtons(const Achievement* restrict Cheevo) noexcept;
-
-private:
-    HWND m_hAchievementsDlg = nullptr;
-    std::vector<AchievementDlgRow> m_lbxData;
-    std::vector<ra::AchievementID> m_vAchievementIDs;
-    Achievement::Category m_nActiveCategory = Achievement::Category::Core;
-};
-
-extern Dlg_Achievements g_AchievementsDialog;
-
-#endif // !RA_DLG_ACHIEVEMENT_H
diff --git a/src/RA_Integration.vcxproj b/src/RA_Integration.vcxproj
index e3be126f..28d74486 100644
--- a/src/RA_Integration.vcxproj
+++ b/src/RA_Integration.vcxproj
@@ -110,8 +110,6 @@
     <ClCompile Include="RA_Condition.cpp" />
     <ClCompile Include="RA_Core.cpp" />
     <ClCompile Include="RA_Defs.cpp" />
-    <ClCompile Include="RA_Dlg_AchEditor.cpp" />
-    <ClCompile Include="RA_Dlg_Achievement.cpp" />
     <ClCompile Include="RA_Dlg_GameLibrary.cpp" />
     <ClCompile Include="RA_ImageFactory.cpp" />
     <ClCompile Include="RA_Json.cpp" />
@@ -255,8 +253,6 @@
     <ClInclude Include="RA_Condition.h" />
     <ClInclude Include="RA_Core.h" />
     <ClInclude Include="RA_Defs.h" />
-    <ClInclude Include="RA_Dlg_AchEditor.h" />
-    <ClInclude Include="RA_Dlg_Achievement.h" />
     <ClInclude Include="RA_Dlg_GameLibrary.h" />
     <ClInclude Include="ra_fwd.h" />
     <ClInclude Include="RA_ImageFactory.h" />
diff --git a/src/RA_Integration.vcxproj.filters b/src/RA_Integration.vcxproj.filters
index 2657aa05..7b7ab3d8 100644
--- a/src/RA_Integration.vcxproj.filters
+++ b/src/RA_Integration.vcxproj.filters
@@ -60,12 +60,6 @@
     <ClCompile Include="RA_Condition.cpp">
       <Filter>Data</Filter>
     </ClCompile>
-    <ClCompile Include="RA_Dlg_AchEditor.cpp">
-      <Filter>UI</Filter>
-    </ClCompile>
-    <ClCompile Include="RA_Dlg_Achievement.cpp">
-      <Filter>UI</Filter>
-    </ClCompile>
     <ClCompile Include="RA_Dlg_GameLibrary.cpp">
       <Filter>UI</Filter>
     </ClCompile>
@@ -395,12 +389,6 @@
     <ClInclude Include="RA_Condition.h">
       <Filter>Data</Filter>
     </ClInclude>
-    <ClInclude Include="RA_Dlg_AchEditor.h">
-      <Filter>UI</Filter>
-    </ClInclude>
-    <ClInclude Include="RA_Dlg_Achievement.h">
-      <Filter>UI</Filter>
-    </ClInclude>
     <ClInclude Include="RA_Dlg_GameLibrary.h">
       <Filter>UI</Filter>
     </ClInclude>
diff --git a/src/RA_Resource.h b/src/RA_Resource.h
index f04ed8f0..3ccb8d2e 100644
--- a/src/RA_Resource.h
+++ b/src/RA_Resource.h
@@ -72,6 +72,28 @@
 #define IDC_RA_CATEGORY                 1167
 #define IDC_RA_GAMEID                   1168
 #define IDC_RA_ACHIEVEMENTS             1169
+#define IDC_RA_TITLE                    1170
+#define IDC_RA_LBL_ID                   1171
+#define IDC_RA_ID                       1172
+#define IDC_RA_CHK_ACTIVE               1173
+#define IDC_RA_CHK_SHOW_DECIMALS        1174
+#define IDC_RA_DESCRIPTION              1175
+#define IDC_RA_POINTS                   1176
+#define IDC_RA_BADGENAME                1177
+#define IDC_RA_UPLOAD_BADGE             1178
+#define IDC_RA_BADGEPIC                 1179
+#define IDC_RA_LBX_GROUPS               1180
+#define IDC_RA_ADD_GROUP                1181
+#define IDC_RA_DELETE_GROUP             1182
+#define IDC_RA_CHK_PAUSE_ON_TRIGGER     1183
+#define IDC_RA_CHK_PAUSE_ON_RESET       1184
+#define IDC_RA_LBX_CONDITIONS           1185
+#define IDC_RA_ADD_COND                 1186
+#define IDC_RA_DELETE_COND              1187
+#define IDC_RA_COPY_COND                1188
+#define IDC_RA_PASTE_COND               1189
+#define IDC_RA_MOVE_COND_UP             1190
+#define IDC_RA_MOVE_COND_DOWN           1191
 #define IDD_RA_MEMORY                   1501
 #define IDD_RA_ACHIEVEMENTS             1502
 #define IDD_RA_ACHIEVEMENTEDITOR        1503
@@ -84,18 +106,11 @@
 #define IDD_RA_ROMCHECKSUM              1510
 #define IDD_RA_OVERLAYSETTINGS          1511
 #define IDD_RA_PROGRESS                 1512
-#define IDC_RA_UPLOAD_BADGE             1517
 #define IDC_RA_ADDBOOKMARK              1518
 #define IDC_RA_HELP                     1521
-#define IDC_RA_CHEEVOPIC                1522
 #define IDC_RA_REVERTSELECTED           1523
 #define IDC_RA_RESET_ACH                1524
-#define IDC_RA_CHK_SHOW_DECIMALS        1526
-#define IDC_RA_DELETECOND               1527
-#define IDC_RA_COPYCOND                 1528
-#define IDC_RA_ACH_ID                   1529
 #define IDC_RA_DEL_ACH                  1530
-#define IDC_RA_PASTECOND                1530
 #define IDC_RA_CHKACHPROCESSINGACTIVE   1531
 #define IDC_RA_GOTOWIKI                 1532
 #define IDC_RA_GAMEHASH                 1533
@@ -107,33 +122,19 @@
 #define IDC_RA_ACTIVE_UNOFFICIAL        1538
 #define IDC_RA_ACTIVE_LOCAL             1539
 #define IDC_RA_LISTACHIEVEMENTS         1540
-#define IDC_RA_ACH_TITLE                1541
 #define IDC_RA_ADD_ACH                  1542
-#define IDC_RA_ACH_POINTS               1543
 #define IDC_RA_CLONE_ACH                1544
-#define IDC_RA_LBX_CONDITIONS           1545
-#define IDC_RA_ACH_AUTHOR               1546
-#define IDC_RA_ADDCOND                  1547
-#define IDC_RA_ACH_DESC                 1548
 #define IDC_RA_USERNAME                 1549
 #define IDC_RA_DOWNLOAD_ACH             1550
 #define IDC_RA_COMMIT_ACH               1551
 #define IDC_RA_PROMOTE_ACH              1552
 #define IDC_RA_WATCH                    1557
-#define IDC_RA_CHK_ACH_ACTIVE           1562
 #define IDC_RA_GAMETITLE                1563
-#define IDC_RA_BADGENAME                1564
 #define IDC_RA_KNOWNGAMES               1565
 #define IDC_RA_CHECKSUM                 1566
-#define IDC_RA_MOVECONDUP               1568
 #define IDC_RA_ACTIVATE_ALL_ACH         1574
-#define IDC_RA_ACH_GROUP                1575
-#define IDC_RA_ACH_DELGROUP             1576
-#define IDC_RA_ACH_ADDGROUP             1577
 #define IDC_RA_PROGRESSINDICATORS       1578
-#define IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER 1585
 #define IDC_RA_REPORTBROKENACHIEVEMENTSLIST 1586
-#define IDC_RA_CHK_ACH_PAUSE_ON_RESET   1586
 #define IDC_RA_BROKENACHIEVEMENTREPORTCOMMENT 1587
 #define IDC_RA_PROBLEMTYPE1             1588
 #define IDC_RA_PROBLEMTYPE2             1589
@@ -147,7 +148,6 @@
 #define IDC_RA_SCANNERFOUNDINFO         1597
 #define IDC_RA_ROMCHECKSUMTEXT          1598
 #define IDC_RA_COPYCHECKSUMCLIPBOARD    1599
-#define IDC_RA_MOVECONDDOWN             1605
 #define IDC_RA_ROMCHECKSUMHEADER        1606
 #define IDM_RA_MENUSTART                1700
 #define IDM_RA_RETROACHIEVEMENTS        1700
@@ -176,7 +176,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        122
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1170
+#define _APS_NEXT_CONTROL_VALUE         1192
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
diff --git a/src/RA_Shared.rc b/src/RA_Shared.rc
index 80a56006..7e268ddc 100644
--- a/src/RA_Shared.rc
+++ b/src/RA_Shared.rc
@@ -79,7 +79,7 @@ BEGIN
     RTEXT           "0",IDC_RA_GAMEHASH,194,6,30,11,WS_BORDER
     LTEXT           "Achievements:",IDC_RA_ACHIEVEMENTS,233,7,49,8
     RTEXT           " 0",IDC_RA_NUMACH,282,6,23,11,WS_BORDER
-    LTEXT           "Points:",IDC_RA_ACH_POINTS,312,7,23,8
+    LTEXT           "Points:",IDC_RA_POINTS,312,7,23,8
     RTEXT           "0",IDC_RA_POINT_TOTAL,336,6,28,11,WS_BORDER
     CONTROL         "Processing Active",IDC_RA_CHKACHPROCESSINGACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,367,6,68,10
     CONTROL         "",IDC_RA_LISTACHIEVEMENTS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,4,20,360,141
@@ -108,44 +108,40 @@ BEGIN
     PUSHBUTTON      "&Cancel",IDCANCEL,132,111,50,14
 END
 
-IDD_RA_ACHIEVEMENTEDITOR DIALOGEX 0, 0, 444, 188
+IDD_RA_ACHIEVEMENTEDITOR DIALOGEX 0, 0, 445, 193
 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME
 CAPTION "Achievement Editor"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
-    LTEXT           "ID:",IDC_STATIC,7,8,11,8
-    EDITTEXT        IDC_RA_ACH_ID,50,7,30,13,ES_AUTOHSCROLL | WS_DISABLED
-    LTEXT           "Points:",IDC_RA_LBL_POINTS,145,8,23,8
-    EDITTEXT        IDC_RA_ACH_POINTS,173,7,28,13,ES_AUTOHSCROLL
-    LTEXT           "Title:",IDC_STATIC,7,28,17,8
-    EDITTEXT        IDC_RA_ACH_TITLE,50,26,151,13,ES_AUTOHSCROLL
-    LTEXT           "Description:",IDC_STATIC,7,46,39,8
-    EDITTEXT        IDC_RA_ACH_DESC,50,45,326,13,ES_AUTOHSCROLL
-    LTEXT           "Badge:",IDC_RA_LBL_BADGENAME,209,8,24,8
-    EDITTEXT        IDC_RA_BADGENAME,237,7,68,13,ES_AUTOHSCROLL
-    CONTROL         "",IDC_RA_BADGE_SPIN,"msctls_updown32",UDS_ARROWKEYS,305,7,12,13
-    PUSHBUTTON      "Upload Badge",IDC_RA_UPLOAD_BADGE,317,6,59,14,BS_MULTILINE
-    LTEXT           "Author:",IDC_RA_LBL_AUTHOR,207,28,26,8
-    EDITTEXT        IDC_RA_ACH_AUTHOR,237,26,139,13,ES_AUTOHSCROLL | WS_DISABLED
-    CONTROL         "",IDC_RA_CHEEVOPIC,"Static",SS_BITMAP | SS_CENTERIMAGE,384,7,53,49,WS_EX_CLIENTEDGE
-    LTEXT           "Requirements:",IDC_STATIC,7,60,48,8
-    LTEXT           "Group:",IDC_STATIC,7,74,23,8
-    CONTROL         "",IDC_RA_ACH_GROUP,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,7,87,39,67
-    PUSHBUTTON      "+",IDC_RA_ACH_ADDGROUP,7,159,15,16,BS_MULTILINE
-    PUSHBUTTON      "-",IDC_RA_ACH_DELGROUP,31,159,15,16,BS_MULTILINE
-    CONTROL         "Pause on Reset",IDC_RA_CHK_ACH_PAUSE_ON_RESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,268,63,65,10
-    CONTROL         "Pause on Trigger",IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,336,63,65,10
-    CONTROL         "Active",IDC_RA_CHK_ACH_ACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,406,63,32,10
-    CONTROL         "",IDC_RA_LBX_CONDITIONS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,50,74,388,80
-    PUSHBUTTON      "Add New Requirement",IDC_RA_ADDCOND,50,159,48,24,BS_MULTILINE
-    PUSHBUTTON      "Delete Selected",IDC_RA_DELETECOND,102,159,48,24,BS_MULTILINE
-    PUSHBUTTON      "Copy",IDC_RA_COPYCOND,154,159,32,12,BS_MULTILINE
-    PUSHBUTTON      "Paste",IDC_RA_PASTECOND,154,171,32,12,BS_MULTILINE
-    PUSHBUTTON      "Move Up",IDC_RA_MOVECONDUP,190,159,46,12,BS_MULTILINE
-    PUSHBUTTON      "Move Down",IDC_RA_MOVECONDDOWN,190,171,46,12,BS_MULTILINE
-    CONTROL         "Show Decimal Values",IDC_RA_CHK_SHOW_DECIMALS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,299,173,79,10
-    PUSHBUTTON      "Close",IDCLOSE,388,168,50,15
+    LTEXT           "Title:",IDC_STATIC,4,7,42,8
+    EDITTEXT        IDC_RA_TITLE,50,4,214,13,ES_AUTOHSCROLL
+    LTEXT           "ID:",IDC_RA_LBL_ID,280,7,11,8
+    EDITTEXT        IDC_RA_ID,293,5,44,13,ES_AUTOHSCROLL | WS_DISABLED,WS_EX_RIGHT
+    CONTROL         "Active",IDC_RA_CHK_ACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,347,6,32,10
+    LTEXT           "Description:",IDC_STATIC,4,23,42,8
+    EDITTEXT        IDC_RA_DESCRIPTION,50,21,333,13,ES_AUTOHSCROLL
+    LTEXT           "Points:",IDC_RA_LBL_POINTS,4,40,23,8
+    EDITTEXT        IDC_RA_POINTS,50,38,42,13,ES_AUTOHSCROLL,WS_EX_RIGHT
+    LTEXT           "Badge:",IDC_RA_LBL_BADGENAME,268,40,24,8
+    EDITTEXT        IDC_RA_BADGENAME,293,38,44,13,ES_AUTOHSCROLL,WS_EX_RIGHT
+    CONTROL         "",IDC_RA_BADGE_SPIN,"msctls_updown32",UDS_ARROWKEYS,338,38,11,13
+    PUSHBUTTON      "Upload",IDC_RA_UPLOAD_BADGE,350,38,33,13
+    CONTROL         "",IDC_RA_BADGEPIC,"Static",SS_BITMAP | SS_CENTERIMAGE,388,4,53,48,WS_EX_CLIENTEDGE
+    LTEXT           "Group:",IDC_STATIC,4,55,23,8
+    CONTROL         "",IDC_RA_LBX_GROUPS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | WS_BORDER | WS_TABSTOP,4,66,42,106
+    PUSHBUTTON      "+",IDC_RA_ADD_GROUP,4,176,15,13
+    PUSHBUTTON      "-",IDC_RA_DELETE_GROUP,31,176,15,13
+    LTEXT           "Requirements:",IDC_STATIC,50,55,48,8
+    CONTROL         "",IDC_RA_LBX_CONDITIONS,"SysListView32",LVS_REPORT | LVS_SHOWSELALWAYS | LVS_ALIGNLEFT | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,50,66,391,106
+    CONTROL         "Pause on Reset",IDC_RA_CHK_PAUSE_ON_RESET,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,307,53,65,13
+    CONTROL         "Pause on Trigger",IDC_RA_CHK_PAUSE_ON_TRIGGER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,376,53,65,13
+    PUSHBUTTON      "New",IDC_RA_ADD_COND,50,176,44,13
+    PUSHBUTTON      "Remove",IDC_RA_DELETE_COND,98,176,44,13
+    PUSHBUTTON      "Copy",IDC_RA_COPY_COND,163,176,44,13
+    PUSHBUTTON      "Paste",IDC_RA_PASTE_COND,211,176,44,13
+    PUSHBUTTON      "Move Up",IDC_RA_MOVE_COND_UP,276,176,44,13
+    PUSHBUTTON      "Move Down",IDC_RA_MOVE_COND_DOWN,324,176,44,13
+    CONTROL         "Show Decimal",IDC_RA_CHK_SHOW_DECIMALS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,383,178,54,10
 END
 
 IDD_RA_GAMETITLESEL DIALOGEX 0, 0, 249, 136
@@ -385,26 +381,19 @@ BEGIN
 
     IDD_RA_ACHIEVEMENTEDITOR, DIALOG
     BEGIN
-        LEFTMARGIN, 7
-        RIGHTMARGIN, 409
+        LEFTMARGIN, 4
+        RIGHTMARGIN, 441
         VERTGUIDE, 46
         VERTGUIDE, 50
-        VERTGUIDE, 174
-        VERTGUIDE, 206
-        VERTGUIDE, 210
-        VERTGUIDE, 349
-        VERTGUIDE, 353
-        TOPMARGIN, 7
-        HORZGUIDE, 16
-        HORZGUIDE, 36
-        HORZGUIDE, 40
-        HORZGUIDE, 45
-        HORZGUIDE, 54
-        HORZGUIDE, 57
-        HORZGUIDE, 60
-        HORZGUIDE, 74
-        HORZGUIDE, 154
-        HORZGUIDE, 159
+        VERTGUIDE, 383
+        TOPMARGIN, 4
+        BOTTOMMARGIN, 188
+        HORZGUIDE, 11
+        HORZGUIDE, 27
+        HORZGUIDE, 44
+        HORZGUIDE, 59
+        HORZGUIDE, 67
+        HORZGUIDE, 172
         HORZGUIDE, 183
     END
 
diff --git a/src/data/context/GameContext.cpp b/src/data/context/GameContext.cpp
index 3b6d6d4e..06ed9b07 100644
--- a/src/data/context/GameContext.cpp
+++ b/src/data/context/GameContext.cpp
@@ -3,7 +3,6 @@
 #include "Exports.hh"
 
 #include "RA_Defs.h"
-#include "RA_Dlg_Achievement.h"
 #include "RA_Log.h"
 #include "RA_md5factory.h"
 #include "RA_StringUtils.h"
@@ -216,7 +215,6 @@ void GameContext::LoadGame(unsigned int nGameId, Mode nMode)
     }
 
 #ifndef RA_UTEST
-    g_AchievementsDialog.UpdateAchievementList();
     DoFrame();
 #endif
 
@@ -336,10 +334,6 @@ void GameContext::UpdateUnlocks(const std::set<unsigned int>& vUnlockedAchieveme
     if (bUnpause)
         ra::services::ServiceLocator::GetMutable<ra::services::AchievementRuntime>().SetPaused(false);
 
-#ifndef RA_UTEST
-    g_AchievementsDialog.UpdateActiveAchievements();
-#endif
-
     if (nPopup)
     {
         auto* pPopup = ra::services::ServiceLocator::GetMutable<ra::ui::viewmodels::OverlayManager>().GetMessage(nPopup);
@@ -368,20 +362,6 @@ void GameContext::DoFrame()
     }
 }
 
-void GameContext::EnumerateFilteredAchievements(std::function<bool(const Achievement&)> callback) const
-{
-#ifdef RA_UTEST
-    EnumerateAchievements(callback);
-#else
-    for (auto nID : g_AchievementsDialog.FilteredAchievements())
-    {
-        const auto* pAchievement = FindAchievement(nID);
-        if (pAchievement != nullptr && !callback(*pAchievement))
-            break;
-    }
-#endif
-}
-
 Achievement& GameContext::NewAchievement(Achievement::Category nType)
 {
     auto& pAsset = m_vAssets.NewAchievement();
@@ -666,10 +646,6 @@ void GameContext::ReloadAchievements(Achievement::Category nCategory)
     {
         // TODO
     }
-
-#ifndef RA_UTEST
-    g_AchievementsDialog.UpdateAchievementList();
-#endif
 }
 
 bool GameContext::ReloadAchievement(ra::AchievementID nAchievementId)
diff --git a/src/data/context/GameContext.hh b/src/data/context/GameContext.hh
index 7370ab43..0e746d2e 100644
--- a/src/data/context/GameContext.hh
+++ b/src/data/context/GameContext.hh
@@ -96,14 +96,6 @@ public:
         }
     }
 
-    /// <summary>
-    /// Enumerates the achievements being shown in the achievement list.
-    /// </summary>
-    /// <remarks>
-    /// <paramref name="callback" /> is called for each known achievement. If it returns <c>false</c> enumeration stops.
-    /// </remarks>
-    void EnumerateFilteredAchievements(std::function<bool(const Achievement&)> callback) const;
-
     /// <summary>
     /// Finds the achievement associated to the specified unique identifier.
     /// </summary>
diff --git a/src/data/context/SessionTracker.cpp b/src/data/context/SessionTracker.cpp
index 1ac62b28..d98759ee 100644
--- a/src/data/context/SessionTracker.cpp
+++ b/src/data/context/SessionTracker.cpp
@@ -1,7 +1,6 @@
 #include "SessionTracker.hh"
 
 #include "Exports.hh"
-#include "RA_Dlg_AchEditor.h"
 #include "RA_Log.h"
 #include "RA_md5factory.h"
 #include "RA_StringUtils.h"
@@ -233,10 +232,8 @@ bool SessionTracker::IsInspectingMemory() const
     if (pWindowManager.MemoryInspector.IsVisible())
         return true;
 
-#ifndef RA_UTEST
-    if (g_AchievementEditorDialog.IsActive())
+    if (pWindowManager.AssetEditor.IsVisible())
         return true;
-#endif
 
     return false;
 }
diff --git a/src/data/models/AchievementModel.cpp b/src/data/models/AchievementModel.cpp
index c0fceb77..0ecc84fe 100644
--- a/src/data/models/AchievementModel.cpp
+++ b/src/data/models/AchievementModel.cpp
@@ -17,6 +17,7 @@ const StringModelProperty AchievementModel::BadgeProperty("AchievementModel", "B
 const BoolModelProperty AchievementModel::PauseOnResetProperty("AchievementModel", "PauseOnReset", false);
 const BoolModelProperty AchievementModel::PauseOnTriggerProperty("AchievementModel", "PauseOnTrigger", false);
 const IntModelProperty AchievementModel::TriggerProperty("AchievementModel", "Trigger", 0);
+const StringModelProperty AchievementModel::UnlockRichPresenceProperty("AchievementModel", "UnlockRichPresence", L"");
 
 AchievementModel::AchievementModel() noexcept
 {
@@ -150,6 +151,9 @@ void AchievementModel::DoFrame()
 
 void AchievementModel::HandleStateChanged(AssetState nOldState, AssetState nNewState)
 {
+    if (!ra::services::ServiceLocator::Exists<ra::services::AchievementRuntime>())
+        return;
+
     const bool bWasActive = IsActive(nOldState);
     const bool bIsActive = IsActive(nNewState);
     if (bWasActive == bIsActive)
@@ -198,7 +202,7 @@ void AchievementModel::HandleStateChanged(AssetState nOldState, AssetState nNewS
             const auto& pClock = ra::services::ServiceLocator::Get<ra::services::IClock>();
             m_tUnlock = pClock.Now();
 
-            m_sUnlockRichPresence = pRuntime.GetRichPresenceDisplayString();
+            SetUnlockRichPresence(pRuntime.GetRichPresenceDisplayString());
             break;
     }
 }
diff --git a/src/data/models/AchievementModel.hh b/src/data/models/AchievementModel.hh
index d28e0ff4..1cbfac77 100644
--- a/src/data/models/AchievementModel.hh
+++ b/src/data/models/AchievementModel.hh
@@ -103,6 +103,22 @@ public:
     /// </summary>
     std::chrono::system_clock::time_point GetUnlockTime() const noexcept { return m_tUnlock; }
 
+    /// <summary>
+    /// The <see cref="ModelProperty" /> for the rich presence at the time of the unlock.
+    /// </summary>
+    static const StringModelProperty UnlockRichPresenceProperty;
+
+    /// <summary>
+    /// Gets the trigger definition.
+    /// </summary>
+    const std::wstring& GetUnlockRichPresence() const { return GetValue(UnlockRichPresenceProperty); }
+
+    /// <summary>
+    /// Sets the trigger definition.
+    /// </summary>
+    /// <remarks>For unit testing - should not be called in the code</remarks>
+    void SetUnlockRichPresence(const std::wstring& sValue) { SetValue(UnlockRichPresenceProperty, sValue); }
+
     void Activate() override;
     void Deactivate() override;
 
@@ -124,7 +140,6 @@ private:
 
     AssetDefinition m_pTrigger;
     std::chrono::system_clock::time_point m_tUnlock;
-    std::wstring m_sUnlockRichPresence;
 
     CapturedTriggerHits m_pCapturedTriggerHits;
 };
diff --git a/src/services/GameIdentifier.cpp b/src/services/GameIdentifier.cpp
index f706f648..d73d031f 100644
--- a/src/services/GameIdentifier.cpp
+++ b/src/services/GameIdentifier.cpp
@@ -21,11 +21,6 @@
 #include "ui\viewmodels\UnknownGameViewModel.hh"
 #include "ui\viewmodels\WindowManager.hh"
 
-#ifndef RA_UTEST
-#include "RA_Dlg_AchEditor.h"   // RA_httpthread.h, services/ImageRepository.h
-#include "RA_Dlg_Achievement.h" // RA_AchievementSet.h
-#endif
-
 namespace ra {
 namespace services {
 
@@ -197,11 +192,6 @@ void GameIdentifier::ActivateGame(unsigned int nGameId)
     }
 
     ra::services::ServiceLocator::GetMutable<ra::data::context::EmulatorContext>().ResetMemoryModified();
-
-#ifndef RA_UTEST
-    g_AchievementsDialog.OnLoad_NewRom(nGameId);
-    g_AchievementEditorDialog.OnLoad_NewRom();
-#endif
 }
 
 void GameIdentifier::IdentifyAndActivateGame(const BYTE* pROM, size_t nROMSize)
diff --git a/src/ui/viewmodels/BrokenAchievementsViewModel.cpp b/src/ui/viewmodels/BrokenAchievementsViewModel.cpp
index 3d91e618..bc7ce24c 100644
--- a/src/ui/viewmodels/BrokenAchievementsViewModel.cpp
+++ b/src/ui/viewmodels/BrokenAchievementsViewModel.cpp
@@ -2,17 +2,15 @@
 
 #include "RA_StringUtils.h"
 
-#ifndef RA_UTEST
-#include "RA_Dlg_Achievement.h"
-#endif
-
 #include "api\SubmitTicket.hh"
 
 #include "data\context\GameContext.hh"
+#include "data\context\GameAssets.hh"
 
 #include "services\ServiceLocator.hh"
 
 #include "ui\viewmodels\MessageBoxViewModel.hh"
+#include "ui\viewmodels\WindowManager.hh"
 
 namespace ra {
 namespace ui {
@@ -39,24 +37,32 @@ bool BrokenAchievementsViewModel::InitializeAchievements()
         return false;
     }
 
+    const auto& pWindowManager = ra::services::ServiceLocator::Get<ra::ui::viewmodels::WindowManager>();
+    const auto& pFilteredAssets = pWindowManager.AssetList.FilteredAssets();
     bool bSawLocal = false;
-    pGameContext.EnumerateFilteredAchievements([&bSawLocal, this](const Achievement& pAchievement)
+    for (gsl::index nIndex = 0; nIndex < gsl::narrow_cast<gsl::index>(pFilteredAssets.Count()); ++nIndex)
     {
-        if (pAchievement.GetCategory() == Achievement::Category::Local)
-        {
-            bSawLocal = true;
-        }
-        else
+        const auto* pAssetSummary = pFilteredAssets.GetItemAt(nIndex);
+        if (pAssetSummary && pAssetSummary->GetType() == ra::data::models::AssetType::Achievement)
         {
-            auto& vmAchievement = m_vAchievements.Add();
-            vmAchievement.SetId(pAchievement.ID());
-            vmAchievement.SetLabel(ra::Widen(pAchievement.Title()));
-            vmAchievement.SetDescription(ra::Widen(pAchievement.Description()));
-            vmAchievement.SetAchieved(!pAchievement.Active());
+            if (pAssetSummary->GetCategory() == ra::data::models::AssetCategory::Local)
+            {
+                bSawLocal = true;
+            }
+            else
+            {
+                const auto* pAchievement = pGameContext.Assets().FindAchievement(pAssetSummary->GetId());
+                if (pAchievement)
+                {
+                    auto& vmAchievement = m_vAchievements.Add();
+                    vmAchievement.SetId(pAchievement->GetID());
+                    vmAchievement.SetLabel(ra::Widen(pAchievement->GetName()));
+                    vmAchievement.SetDescription(ra::Widen(pAchievement->GetDescription()));
+                    vmAchievement.SetAchieved(!pAchievement->IsActive());
+                }
+            }
         }
-
-        return true;
-    });
+    }
 
     if (m_vAchievements.Count() == 0)
     {
@@ -80,7 +86,7 @@ static std::wstring GetRichPresence(const ra::data::context::GameContext& pGameC
     std::wstring sRichPresence;
     for (const auto nId : vAchievementIds)
     {
-        const auto* pAchievement = pGameContext.FindAchievement(nId);
+        const auto* pAchievement = pGameContext.Assets().FindAchievement(nId);
         if (pAchievement == nullptr)
             continue;
 
@@ -99,7 +105,7 @@ static std::wstring GetRichPresence(const ra::data::context::GameContext& pGameC
 
         for (const auto nId : vAchievementIds)
         {
-            const auto* pAchievement = pGameContext.FindAchievement(nId);
+            const auto* pAchievement = pGameContext.Assets().FindAchievement(nId);
             if (pAchievement != nullptr && !pAchievement->GetUnlockRichPresence().empty())
                 sRichPresence.append(ra::StringPrintf(L"%u: %s\n", nId, pAchievement->GetUnlockRichPresence()));
         }
@@ -298,7 +304,6 @@ void BrokenAchievementsViewModel::OnItemSelectedChanged(gsl::index nIndex, const
     }
 }
 
-
 } // namespace viewmodels
 } // namespace ui
 } // namespace ra
diff --git a/src/ui/viewmodels/OverlayManager.cpp b/src/ui/viewmodels/OverlayManager.cpp
index d2588f34..1818a5c3 100644
--- a/src/ui/viewmodels/OverlayManager.cpp
+++ b/src/ui/viewmodels/OverlayManager.cpp
@@ -344,6 +344,9 @@ void OverlayManager::UpdatePopup(ra::ui::drawing::ISurface& pSurface, const Popu
     }
     else
     {
+        if (!vmPopup.HasRenderImage())
+            vmPopup.UpdateRenderImage(0.0);
+
         const auto& pImage = vmPopup.GetRenderImage();
         nOldWidth = pImage.GetWidth();
         nOldHeight = pImage.GetHeight();
@@ -629,8 +632,6 @@ void OverlayManager::ProcessScreenshots()
                     {
                         RA_LOG_INFO("Rendering screenshot for %s", iter->second);
 
-                        PopupMessageViewModel::RenderImageLock lock(*pMessage);
-
                         if (!pMessage->IsAnimationStarted())
                             pMessage->BeginAnimation();
 
diff --git a/src/ui/viewmodels/PopupMessageViewModel.cpp b/src/ui/viewmodels/PopupMessageViewModel.cpp
index 5023c1b9..d45aef84 100644
--- a/src/ui/viewmodels/PopupMessageViewModel.cpp
+++ b/src/ui/viewmodels/PopupMessageViewModel.cpp
@@ -32,6 +32,8 @@ void PopupMessageViewModel::BeginAnimation()
     const int nHeight = 4 + nImageSize + 4 + nShadowOffset;
     m_nInitialY = -nHeight;
     SetVerticalOffset(m_nInitialY);
+
+    UpdateRenderImage(0.0);
 }
 
 bool PopupMessageViewModel::UpdateRenderImage(double fElapsed)
@@ -48,6 +50,8 @@ bool PopupMessageViewModel::UpdateRenderImage(double fElapsed)
         bUpdated = true;
     }
 
+    RenderImageLock lock(*this);
+
     if (m_bSurfaceStale)
     {
         m_bSurfaceStale = false;
diff --git a/src/ui/viewmodels/PopupMessageViewModel.hh b/src/ui/viewmodels/PopupMessageViewModel.hh
index 71d75477..e78708dc 100644
--- a/src/ui/viewmodels/PopupMessageViewModel.hh
+++ b/src/ui/viewmodels/PopupMessageViewModel.hh
@@ -126,6 +126,7 @@ public:
     /// </summary>
     int GetTargetVerticalOffset() const noexcept { return m_nTargetY; }
 
+private:
     class RenderImageLock
     {
     public:
@@ -138,7 +139,6 @@ public:
         std::lock_guard<std::recursive_mutex> m_pLock;
     };
 
-private:
     void CreateRenderImage();
     bool m_bSurfaceStale = false;
     std::recursive_mutex m_pSurfaceMutex;
diff --git a/src/ui/viewmodels/PopupViewModelBase.hh b/src/ui/viewmodels/PopupViewModelBase.hh
index dcd46773..9295db6d 100644
--- a/src/ui/viewmodels/PopupViewModelBase.hh
+++ b/src/ui/viewmodels/PopupViewModelBase.hh
@@ -135,6 +135,11 @@ public:
         return *m_pSurface;
     }
 
+    /// <summary>
+    /// Determines if there is an image to render.
+    /// </summary>
+    const bool HasRenderImage() const noexcept { return m_pSurface != nullptr; }
+
     /// <summary>
     /// Updates the image to render.
     /// </summary>
diff --git a/src/ui/win32/AssetEditorDialog.cpp b/src/ui/win32/AssetEditorDialog.cpp
index 8f8da680..f76e4c66 100644
--- a/src/ui/win32/AssetEditorDialog.cpp
+++ b/src/ui/win32/AssetEditorDialog.cpp
@@ -418,18 +418,18 @@ void AssetEditorDialog::ActiveCheckBoxBinding::OnViewModelIntValueChanged(const
 
 AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
     : DialogBase(vmAssetEditor),
-      m_bindID(vmAssetEditor),
-      m_bindName(vmAssetEditor),
-      m_bindDescription(vmAssetEditor),
-      m_bindBadge(vmAssetEditor),
-      m_bindBadgeImage(vmAssetEditor),
-      m_bindPoints(vmAssetEditor),
-      m_bindPauseOnReset(vmAssetEditor),
-      m_bindPauseOnTrigger(vmAssetEditor),
-      m_bindActive(vmAssetEditor),
-      m_bindDecimalPreferred(this, vmAssetEditor),
-      m_bindGroups(vmAssetEditor.Trigger()),
-      m_bindConditions(vmAssetEditor.Trigger())
+    m_bindID(vmAssetEditor),
+    m_bindName(vmAssetEditor),
+    m_bindDescription(vmAssetEditor),
+    m_bindBadge(vmAssetEditor),
+    m_bindBadgeImage(vmAssetEditor),
+    m_bindPoints(vmAssetEditor),
+    m_bindPauseOnReset(vmAssetEditor),
+    m_bindPauseOnTrigger(vmAssetEditor),
+    m_bindActive(vmAssetEditor),
+    m_bindDecimalPreferred(this, vmAssetEditor),
+    m_bindGroups(vmAssetEditor.Trigger()),
+    m_bindConditions(vmAssetEditor.Trigger())
 {
     m_bindWindow.SetInitialPosition(RelativePosition::After, RelativePosition::After, "Achievement Editor");
     m_bindWindow.AddChildViewModel(vmAssetEditor.Trigger());
@@ -441,11 +441,25 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
     m_bindBadge.SetWrapAround(true);
     m_bindBadgeImage.BindImage(AssetEditorViewModel::BadgeProperty, ra::ui::ImageType::Badge);
     m_bindPoints.BindValue(AssetEditorViewModel::PointsProperty);
-
-    m_bindWindow.BindEnabled(IDC_RA_ACH_TITLE, AssetEditorViewModel::AssetLoadedProperty);
-    m_bindWindow.BindEnabled(IDC_RA_ACH_DESC, AssetEditorViewModel::AssetLoadedProperty);
-    m_bindWindow.BindEnabled(IDC_RA_CHK_ACH_PAUSE_ON_RESET, AssetEditorViewModel::AssetLoadedProperty);
-    m_bindWindow.BindEnabled(IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_TITLE, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_DESCRIPTION, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_CHK_ACTIVE, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_POINTS, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_BADGENAME, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_BADGE_SPIN, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_UPLOAD_BADGE, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_CHK_PAUSE_ON_RESET, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_CHK_PAUSE_ON_TRIGGER, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_LBX_GROUPS, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_ADD_GROUP, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_DELETE_GROUP, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_LBX_CONDITIONS, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_ADD_COND, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_DELETE_COND, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_COPY_COND, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_PASTE_COND, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_MOVE_COND_UP, AssetEditorViewModel::AssetLoadedProperty);
+    m_bindWindow.BindEnabled(IDC_RA_MOVE_COND_DOWN, AssetEditorViewModel::AssetLoadedProperty);
 
     m_bindPauseOnReset.BindCheck(AssetEditorViewModel::PauseOnResetProperty);
     m_bindPauseOnTrigger.BindCheck(AssetEditorViewModel::PauseOnTriggerProperty);
@@ -538,28 +552,52 @@ AssetEditorDialog::AssetEditorDialog(AssetEditorViewModel& vmAssetEditor)
     m_bindConditions.BindEnsureVisible(TriggerViewModel::EnsureVisibleConditionIndexProperty);
 
     using namespace ra::bitwise_ops;
-    SetAnchor(IDC_RA_LISTACHIEVEMENTS, Anchor::Top | Anchor::Left | Anchor::Bottom | Anchor::Right);
-
-    SetMinimumSize(400, 188);
+    SetAnchor(IDC_RA_TITLE, Anchor::Top | Anchor::Left | Anchor::Right);
+    SetAnchor(IDC_RA_LBL_ID, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_ID, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_CHK_ACTIVE, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_DESCRIPTION, Anchor::Top | Anchor::Left | Anchor::Right);
+    SetAnchor(IDC_RA_LBL_POINTS, Anchor::Top | Anchor::Left);
+    SetAnchor(IDC_RA_POINTS, Anchor::Top | Anchor::Left);
+    SetAnchor(IDC_RA_LBL_BADGENAME, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_BADGENAME, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_BADGE_SPIN, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_UPLOAD_BADGE, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_BADGEPIC, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_LBX_GROUPS, Anchor::Top | Anchor::Left | Anchor::Bottom);
+    SetAnchor(IDC_RA_ADD_GROUP, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_DELETE_GROUP, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_CHK_PAUSE_ON_RESET, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_CHK_PAUSE_ON_TRIGGER, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_LBX_CONDITIONS, Anchor::Top | Anchor::Left | Anchor::Bottom | Anchor::Right);
+    SetAnchor(IDC_RA_ADD_COND, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_DELETE_COND, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_COPY_COND, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_PASTE_COND, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_MOVE_COND_UP, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_MOVE_COND_DOWN, Anchor::Bottom | Anchor::Left);
+    SetAnchor(IDC_RA_CHK_SHOW_DECIMALS, Anchor::Bottom | Anchor::Right);
+
+    SetMinimumSize(665, 348);
 }
 
 BOOL AssetEditorDialog::OnInitDialog()
 {
-    m_bindID.SetControl(*this, IDC_RA_ACH_ID);
-    m_bindName.SetControl(*this, IDC_RA_ACH_TITLE);
-    m_bindDescription.SetControl(*this, IDC_RA_ACH_DESC);
+    m_bindID.SetControl(*this, IDC_RA_ID);
+    m_bindName.SetControl(*this, IDC_RA_TITLE);
+    m_bindDescription.SetControl(*this, IDC_RA_DESCRIPTION);
     m_bindBadge.SetControl(*this, IDC_RA_BADGENAME);
     m_bindBadge.SetSpinnerControl(*this, IDC_RA_BADGE_SPIN);
-    m_bindBadgeImage.SetControl(*this, IDC_RA_CHEEVOPIC);
-    m_bindPoints.SetControl(*this, IDC_RA_ACH_POINTS);
+    m_bindBadgeImage.SetControl(*this, IDC_RA_BADGEPIC);
+    m_bindPoints.SetControl(*this, IDC_RA_POINTS);
 
-    m_bindGroups.SetControl(*this, IDC_RA_ACH_GROUP);
+    m_bindGroups.SetControl(*this, IDC_RA_LBX_GROUPS);
     m_bindConditions.SetControl(*this, IDC_RA_LBX_CONDITIONS);
     m_bindConditions.InitializeTooltips(std::chrono::seconds(30));
 
-    m_bindPauseOnReset.SetControl(*this, IDC_RA_CHK_ACH_PAUSE_ON_RESET);
-    m_bindPauseOnTrigger.SetControl(*this, IDC_RA_CHK_ACH_PAUSE_ON_TRIGGER);
-    m_bindActive.SetControl(*this, IDC_RA_CHK_ACH_ACTIVE);
+    m_bindPauseOnReset.SetControl(*this, IDC_RA_CHK_PAUSE_ON_RESET);
+    m_bindPauseOnTrigger.SetControl(*this, IDC_RA_CHK_PAUSE_ON_TRIGGER);
+    m_bindActive.SetControl(*this, IDC_RA_CHK_ACTIVE);
     m_bindDecimalPreferred.SetControl(*this, IDC_RA_CHK_SHOW_DECIMALS);
 
     return DialogBase::OnInitDialog();
@@ -569,7 +607,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
 {
     switch (nCommand)
     {
-        case IDC_RA_ADDCOND:
+        case IDC_RA_ADD_COND:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -578,7 +616,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_COPYCOND:
+        case IDC_RA_COPY_COND:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -587,7 +625,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_PASTECOND:
+        case IDC_RA_PASTE_COND:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -596,7 +634,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_DELETECOND:
+        case IDC_RA_DELETE_COND:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -605,7 +643,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_MOVECONDUP:
+        case IDC_RA_MOVE_COND_UP:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -614,7 +652,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_MOVECONDDOWN:
+        case IDC_RA_MOVE_COND_DOWN:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -632,7 +670,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_ACH_ADDGROUP:
+        case IDC_RA_ADD_GROUP:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
@@ -641,7 +679,7 @@ BOOL AssetEditorDialog::OnCommand(WORD nCommand)
             return TRUE;
         }
 
-        case IDC_RA_ACH_DELGROUP:
+        case IDC_RA_DELETE_GROUP:
         {
             auto* vmAssetEditor = dynamic_cast<AssetEditorViewModel*>(&m_vmWindow);
             if (vmAssetEditor)
diff --git a/src/ui/win32/AssetListDialog.cpp b/src/ui/win32/AssetListDialog.cpp
index 1e560020..db1dcbe9 100644
--- a/src/ui/win32/AssetListDialog.cpp
+++ b/src/ui/win32/AssetListDialog.cpp
@@ -152,7 +152,7 @@ AssetListDialog::AssetListDialog(AssetListViewModel& vmAssetList)
     SetAnchor(IDC_RA_GAMEHASH, Anchor::Top | Anchor::Right);
     SetAnchor(IDC_RA_ACHIEVEMENTS, Anchor::Top | Anchor::Right);
     SetAnchor(IDC_RA_NUMACH, Anchor::Top | Anchor::Right);
-    SetAnchor(IDC_RA_ACH_POINTS, Anchor::Top | Anchor::Right);
+    SetAnchor(IDC_RA_POINTS, Anchor::Top | Anchor::Right);
     SetAnchor(IDC_RA_POINT_TOTAL, Anchor::Top | Anchor::Right);
     SetAnchor(IDC_RA_CHKACHPROCESSINGACTIVE, Anchor::Top | Anchor::Right);
     SetAnchor(IDC_RA_LISTACHIEVEMENTS, Anchor::Top | Anchor::Left | Anchor::Bottom | Anchor::Right);
diff --git a/src/ui/win32/DialogBase.cpp b/src/ui/win32/DialogBase.cpp
index f755c63a..5dab8a15 100644
--- a/src/ui/win32/DialogBase.cpp
+++ b/src/ui/win32/DialogBase.cpp
@@ -500,11 +500,15 @@ BOOL DialogBase::OnCommand(WORD nCommand)
     {
         case IDOK:
             SetDialogResult(DialogResult::OK);
+            if (m_vmWindow.GetDialogResult() != DialogResult::None)
+               DoCloseWindow();
             return TRUE;
 
         case IDCLOSE:
         case IDCANCEL:
             SetDialogResult(DialogResult::Cancel);
+            if (m_vmWindow.GetDialogResult() != DialogResult::None)
+                DoCloseWindow();
             return TRUE;
 
         default:
@@ -512,6 +516,17 @@ BOOL DialogBase::OnCommand(WORD nCommand)
     }
 }
 
+void DialogBase::DoCloseWindow() noexcept
+{
+    if (::IsWindowVisible(m_hWnd))
+    {
+        if (m_bModal)
+            EndDialog(m_hWnd, 0); // DialogBox call in CreateModalWindow() ignores return value
+        else
+            DestroyWindow(m_hWnd);
+    }
+}
+
 void DialogBase::SetDialogResult(DialogResult nResult)
 {
     m_vmWindow.SetDialogResult(nResult);
@@ -519,13 +534,7 @@ void DialogBase::SetDialogResult(DialogResult nResult)
     // make sure the dialog is closed on the UI thread
     QueueFunction([this]() noexcept
     {
-        if (::IsWindowVisible(m_hWnd))
-        {
-            if (m_bModal)
-                EndDialog(m_hWnd, 0); // DialogBox call in CreateModalWindow() ignores return value
-            else
-                DestroyWindow(m_hWnd);
-        }
+        DoCloseWindow();
     });
 }
 
diff --git a/src/ui/win32/DialogBase.hh b/src/ui/win32/DialogBase.hh
index 9196ecf7..f01298e4 100644
--- a/src/ui/win32/DialogBase.hh
+++ b/src/ui/win32/DialogBase.hh
@@ -158,7 +158,10 @@ private:
         GSL_SUPPRESS_F6 m_mControlBindings.insert_or_assign(hControl, &pControlBinding);
     }
 
-    void RemoveControlBinding(HWND hControl) noexcept { GSL_SUPPRESS_F6 m_mControlBindings.erase(hControl); }
+    void RemoveControlBinding(HWND hControl) noexcept
+    {
+        GSL_SUPPRESS_F6 m_mControlBindings.erase(hControl);
+    }
 
     void QueueFunction(std::function<void()> fAction);
 
@@ -185,6 +188,7 @@ private:
 
     void InitializeAnchors() noexcept;
     void UpdateAnchoredControls();
+    void DoCloseWindow() noexcept;
 };
 
 } // namespace win32
diff --git a/src/ui/win32/ProgressDialog.cpp b/src/ui/win32/ProgressDialog.cpp
index e74f5961..68d4679c 100644
--- a/src/ui/win32/ProgressDialog.cpp
+++ b/src/ui/win32/ProgressDialog.cpp
@@ -62,7 +62,7 @@ BOOL ProgressDialog::OnCommand(WORD nCommand)
 {
     switch (nCommand)
     {
-        case IDC_RA_ADDCOND:
+        case IDCLOSE:
         {
             auto* vmProgress = dynamic_cast<ProgressViewModel*>(&m_vmWindow);
             if (vmProgress)
diff --git a/src/ui/win32/bindings/CheckBoxBinding.hh b/src/ui/win32/bindings/CheckBoxBinding.hh
index a0edba9e..78099a29 100644
--- a/src/ui/win32/bindings/CheckBoxBinding.hh
+++ b/src/ui/win32/bindings/CheckBoxBinding.hh
@@ -50,6 +50,12 @@ protected:
         }
     }
 
+    void OnValueChanged() override
+    {
+        ControlBinding::ForceRepaint(m_hWnd);
+        ControlBinding::OnValueChanged();
+    }
+
 private:
     const BoolModelProperty* m_pIsCheckedProperty = nullptr;
 };


Test patch:
diff --git a/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp b/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp
index 0eaf73a2..1d2fcd98 100644
--- a/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp
+++ b/tests/ui/viewmodels/BrokenAchievementsViewModel_Tests.cpp
@@ -30,32 +30,42 @@ private:
         ra::ui::mocks::MockDesktop mockDesktop;
         ra::ui::viewmodels::mocks::MockWindowManager mockWindowManager;
 
+        BrokenAchievementsViewModelHarness() noexcept
+        {
+            GSL_SUPPRESS_F6 mockWindowManager.AssetList.InitializeNotifyTargets();
+        }
+
         void MockAchievements()
         {
             mockGameContext.SetGameId(1U);
             mockGameContext.SetGameTitle(L"GAME");
             mockGameContext.SetGameHash("HASH");
 
-            auto& ach1 = mockGameContext.NewAchievement(Achievement::Category::Core);
+            auto& ach1 = mockGameContext.Assets().NewAchievement();
+            ach1.SetCategory(ra::data::models::AssetCategory::Core);
             ach1.SetID(1U);
-            ach1.SetTitle("Title1");
-            ach1.SetActive(false);
-            auto& ach2 = mockGameContext.NewAchievement(Achievement::Category::Core);
+            ach1.SetName(L"Title1");
+            ach1.SetState(ra::data::models::AssetState::Inactive);
+            auto& ach2 = mockGameContext.Assets().NewAchievement();
+            ach2.SetCategory(ra::data::models::AssetCategory::Core);
             ach2.SetID(2U);
-            ach2.SetTitle("Title2");
-            ach2.SetActive(true);
-            auto& ach3 = mockGameContext.NewAchievement(Achievement::Category::Core);
+            ach2.SetName(L"Title2");
+            ach2.SetState(ra::data::models::AssetState::Active);
+            auto& ach3 = mockGameContext.Assets().NewAchievement();
+            ach3.SetCategory(ra::data::models::AssetCategory::Core);
             ach3.SetID(3U);
-            ach3.SetTitle("Title3");
-            ach3.SetActive(false);
-            auto& ach4 = mockGameContext.NewAchievement(Achievement::Category::Core);
+            ach3.SetName(L"Title3");
+            ach3.SetState(ra::data::models::AssetState::Inactive);
+            auto& ach4 = mockGameContext.Assets().NewAchievement();
+            ach4.SetCategory(ra::data::models::AssetCategory::Core);
             ach4.SetID(4U);
-            ach4.SetTitle("Title4");
-            ach4.SetActive(true);
-            auto& ach5 = mockGameContext.NewAchievement(Achievement::Category::Core);
+            ach4.SetName(L"Title4");
+            ach4.SetState(ra::data::models::AssetState::Active);
+            auto& ach5 = mockGameContext.Assets().NewAchievement();
+            ach5.SetCategory(ra::data::models::AssetCategory::Core);
             ach5.SetID(5U);
-            ach5.SetTitle("Title5");
-            ach5.SetActive(true);
+            ach5.SetName(L"Title5");
+            ach5.SetState(ra::data::models::AssetState::Active);
 
             Assert::IsTrue(InitializeAchievements());
         }
@@ -91,7 +101,8 @@ public:
     {
         BrokenAchievementsViewModelHarness vmBrokenAchievements;
         vmBrokenAchievements.mockGameContext.SetGameId(1U);
-        vmBrokenAchievements.mockGameContext.NewAchievement(Achievement::Category::Local);
+        vmBrokenAchievements.mockGameContext.Assets().NewAchievement().SetCategory(ra::data::models::AssetCategory::Local);
+        vmBrokenAchievements.mockWindowManager.AssetList.SetFilterCategory(ra::data::models::AssetCategory::Local);
 
         bool bDialogSeen = false;
         vmBrokenAchievements.mockDesktop.ExpectWindow<MessageBoxViewModel>([&bDialogSeen](const MessageBoxViewModel& vmMessageBox)
@@ -480,7 +491,7 @@ public:
         vmBrokenAchievements.SetSelectedProblemId(1);
         vmBrokenAchievements.Achievements().GetItemAt(0)->SetSelected(true);
         vmBrokenAchievements.SetComment(L"I tried.");
-        vmBrokenAchievements.mockGameContext.FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
+        vmBrokenAchievements.mockGameContext.Assets().FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
 
         vmBrokenAchievements.mockDesktop.ExpectWindow<MessageBoxViewModel>([](const MessageBoxViewModel& vmMessageBox)
         {
@@ -512,8 +523,8 @@ public:
         vmBrokenAchievements.Achievements().GetItemAt(0)->SetSelected(true);
         vmBrokenAchievements.Achievements().GetItemAt(2)->SetSelected(true);
         vmBrokenAchievements.SetComment(L"I tried.");
-        vmBrokenAchievements.mockGameContext.FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
-        vmBrokenAchievements.mockGameContext.FindAchievement(3U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
+        vmBrokenAchievements.mockGameContext.Assets().FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
+        vmBrokenAchievements.mockGameContext.Assets().FindAchievement(3U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
 
         vmBrokenAchievements.mockDesktop.ExpectWindow<MessageBoxViewModel>([](const MessageBoxViewModel& vmMessageBox)
         {
@@ -545,8 +556,8 @@ public:
         vmBrokenAchievements.Achievements().GetItemAt(0)->SetSelected(true);
         vmBrokenAchievements.Achievements().GetItemAt(2)->SetSelected(true);
         vmBrokenAchievements.SetComment(L"I tried.");
-        vmBrokenAchievements.mockGameContext.FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
-        vmBrokenAchievements.mockGameContext.FindAchievement(3U)->SetUnlockRichPresence(L"Somewhere, 2 Lives");
+        vmBrokenAchievements.mockGameContext.Assets().FindAchievement(1U)->SetUnlockRichPresence(L"Nowhere, 2 Lives");
+        vmBrokenAchievements.mockGameContext.Assets().FindAchievement(3U)->SetUnlockRichPresence(L"Somewhere, 2 Lives");
 
         vmBrokenAchievements.mockDesktop.ExpectWindow<MessageBoxViewModel>([](const MessageBoxViewModel& vmMessageBox)
         {