Confirm cheat changes on closing window

This commit is contained in:
zilmar 2021-01-17 16:15:26 +10:30
parent 0c177171ea
commit ddcd6ef855
5 changed files with 32 additions and 2 deletions

View File

@ -536,7 +536,8 @@
#2059# "Nintendo 64DD Japanese Retail IPL ROM not found.\nIt is required to play japanese region 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2061# "Nintendo 64DD American Retail IPL ROM not found.\nIt is required to play american region 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2062# "Nintendo 64DD Development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the Settings."
#2063# "Failed to update cheat, it is invalid"
#2064# "Invalid Cheat"
/*********************************************************************************
* Android *

View File

@ -577,6 +577,8 @@ enum LanguageStringID
MSG_MSGBOX_WARNING_TITLE = 2060,
MSG_USA_IPL_REQUIRED = 2061,
MSG_TOOL_IPL_REQUIRED = 2062,
MSG_CHEAT_INVALID_MSG = 2063,
MSG_CHEAT_INVALID_TITLE = 2064,
/*********************************************************************************
* Android *

View File

@ -542,6 +542,8 @@ void CLanguage::LoadDefaultStrings(void)
DEF_STR(MSG_IPL_REQUIRED, "Nintendo 64DD Japanese Retail IPL ROM not found.\nIt is required to play japanese region 64DD disk images.\n\nPlease select the required ROM in the Settings.");
DEF_STR(MSG_USA_IPL_REQUIRED, "Nintendo 64DD American Retail IPL ROM not found.\nIt is required to play american region 64DD disk images.\n\nPlease select the required ROM in the Settings.");
DEF_STR(MSG_TOOL_IPL_REQUIRED, "Nintendo 64DD Development IPL ROM not found.\nIt is required to play development 64DD disk images.\n\nPlease select the required ROM in the Settings.");
DEF_STR(MSG_CHEAT_INVALID_MSG, "Failed to update cheat, it is invalid");
DEF_STR(MSG_CHEAT_INVALID_TITLE, "Invalid Cheat");
/*********************************************************************************
* Android *

View File

@ -112,6 +112,11 @@ LRESULT CCheatsUI::OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/
LRESULT CCheatsUI::OnCloseCmd(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
{
if (m_EditCheat.ValuesChanged())
{
return 0;
}
if (g_BaseSystem)
{
g_BaseSystem->ExternalEvent(SysEvent_ResumeCPU_Cheats);
@ -1034,7 +1039,24 @@ bool CEditCheat::ValuesChanged(void)
}
if (Result == IDYES)
{
SendMessage(WM_COMMAND, MAKELPARAM(IDC_ADD, 0));
bool validcodes, validoptions, nooptions;
CodeFormat Format;
ReadCodeEntries(validcodes, validoptions, nooptions, Format);
if (!nooptions)
{
ReadOptions(validoptions, Format);
}
bool CanAdd = validcodes && (validoptions || nooptions) && GetDlgItem(IDC_CODE_NAME).GetWindowTextLength() > 0;
if (CanAdd)
{
SendMessage(WM_COMMAND, MAKELPARAM(IDC_ADD, 0));
}
else
{
MessageBox(wGS(MSG_CHEAT_INVALID_MSG).c_str(), wGS(MSG_CHEAT_INVALID_TITLE).c_str(), MB_ICONERROR);
return true;
}
}
return false;
}

View File

@ -14,6 +14,7 @@
#include <Project64-core\N64System\Enhancement\EnhancementList.h>
class CEditCheat;
class CCheatsUI;
class CCheatList :
public CDialogImpl<CCheatList>
@ -79,6 +80,8 @@ private:
class CEditCheat :
public CDialogImpl<CEditCheat>
{
friend CCheatsUI;
public:
enum
{