diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp index 25420940c..123c97110 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.cpp +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.cpp @@ -51,7 +51,7 @@ void CEnhancements::ApplyActive(CMipsMemoryVM & MMU, CPlugins * Plugins, bool Up if (m_UpdateCheats && UpdateChanges) { m_UpdateCheats = false; - Load(&MMU, Plugins); + LoadActive(&MMU, Plugins); } for (size_t i = 0, n = m_ActiveCodes.size(); i < n; i++) { @@ -261,14 +261,20 @@ void CEnhancements::LoadEnhancements(const char * Ident, SectionFiles & Files, s } } -void CEnhancements::Load(CMipsMemoryVM * MMU, CPlugins * Plugins) +void CEnhancements::Load(void) { WaitScanDone(); CGuard Guard(m_CS); LoadEnhancements(CEnhancement::CheatIdent, m_CheatFiles, m_CheatFile, m_Cheats); LoadEnhancements(CEnhancement::EnhancementIdent, m_EnhancementFiles, m_EnhancementFile, m_Enhancements); +} +void CEnhancements::LoadActive(CMipsMemoryVM * MMU, CPlugins * Plugins) +{ + Load(); + + CGuard Guard(m_CS); m_OverClock = false; m_OverClockModifier = 1; diff --git a/Source/Project64-core/N64System/Enhancement/Enhancements.h b/Source/Project64-core/N64System/Enhancement/Enhancements.h index ba3cb466b..fed322f0f 100644 --- a/Source/Project64-core/N64System/Enhancement/Enhancements.h +++ b/Source/Project64-core/N64System/Enhancement/Enhancements.h @@ -26,7 +26,8 @@ public: void UpdateCheats(void); void UpdateEnhancements(const CEnhancementList & Enhancements); void ResetActive(CPlugins * Plugins); - void Load(CMipsMemoryVM * MMU, CPlugins * Plugins); + void Load(void); + void LoadActive(CMipsMemoryVM * MMU, CPlugins * Plugins); CEnhancementList Cheats(void); CEnhancementList Enhancements(void); diff --git a/Source/Project64/UserInterface/CheatClassUI.cpp b/Source/Project64/UserInterface/CheatClassUI.cpp index 0112e4060..30b4bfe0a 100644 --- a/Source/Project64/UserInterface/CheatClassUI.cpp +++ b/Source/Project64/UserInterface/CheatClassUI.cpp @@ -14,6 +14,7 @@ CCheatsUI::~CCheatsUI() void CCheatsUI::Display(HWND hParent, bool BlockExecution) { + g_Enhancements->Load(); m_Cheats = g_Enhancements->Cheats(); if (g_BaseSystem) { diff --git a/Source/Project64/UserInterface/EnhancementUI.cpp b/Source/Project64/UserInterface/EnhancementUI.cpp index 127b98e78..9e829eabd 100644 --- a/Source/Project64/UserInterface/EnhancementUI.cpp +++ b/Source/Project64/UserInterface/EnhancementUI.cpp @@ -145,6 +145,7 @@ LRESULT CEnhancementUI::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /* DeleteObject(hBmp); m_TreeList.SetImageList(hImageList, TVSIL_STATE); + g_Enhancements->Load(); m_Enhancements = g_Enhancements->Enhancements(); CRect rcDlg, rcParent; diff --git a/Source/Project64/UserInterface/MainWindow.cpp b/Source/Project64/UserInterface/MainWindow.cpp index eff550257..b3f81c7d5 100644 --- a/Source/Project64/UserInterface/MainWindow.cpp +++ b/Source/Project64/UserInterface/MainWindow.cpp @@ -963,12 +963,12 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO else if (LOWORD(wParam) == ID_POPUPMENU_EDITCHEATS) { g_Enhancements->ResetActive(nullptr); - g_Enhancements->Load(nullptr, nullptr); + g_Enhancements->LoadActive(nullptr, nullptr); _this->m_CheatsUI.Display(hWnd, true); } else if (LOWORD(wParam) == ID_POPUPMENU_CHOOSEENHANCEMENT) { - g_Enhancements->Load(nullptr, nullptr); + g_Enhancements->LoadActive(nullptr, nullptr); _this->m_EnhancementUI.Display(hWnd, true); }