project64/Source/Project64/UserInterface/CheatUI.h

218 lines
6.5 KiB
C
Raw Normal View History

#pragma once
2021-02-28 21:32:50 +00:00
#include <Project64-core/N64System/Enhancement/Enhancement.h>
#include <Project64-core/N64System/Enhancement/EnhancementList.h>
2022-09-26 02:31:54 +00:00
#include <Project64\WTLApp.h>
2020-05-19 02:25:57 +00:00
class CEditCheat;
class CCheatsUI;
2020-05-19 02:25:57 +00:00
class CCheatList :
public CDialogImpl<CCheatList>
{
2020-05-19 02:25:57 +00:00
enum
{
UM_CHANGECODEEXTENSION = WM_USER + 0x121,
};
public:
2020-05-19 02:25:57 +00:00
BEGIN_MSG_MAP_EX(CCheatList)
2022-09-26 02:31:54 +00:00
{
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog);
MESSAGE_HANDLER(WM_DESTROY, OnDestroy);
MESSAGE_HANDLER(UM_CHANGECODEEXTENSION, OnChangeCodeExtension);
COMMAND_ID_HANDLER(IDC_UNMARK, OnUnmark);
COMMAND_ID_HANDLER(ID_POPUP_DELETE, OnPopupDelete);
NOTIFY_HANDLER_EX(IDC_MYTREE, NM_CLICK, OnTreeClicked);
NOTIFY_HANDLER_EX(IDC_MYTREE, NM_RCLICK, OnTreeRClicked);
NOTIFY_HANDLER_EX(IDC_MYTREE, NM_DBLCLK, OnTreeDClicked);
NOTIFY_HANDLER_EX(IDC_MYTREE, TVN_SELCHANGED, OnTreeSelChanged);
}
2020-05-19 02:25:57 +00:00
END_MSG_MAP()
2022-09-26 02:31:54 +00:00
enum
{
IDD = IDD_Cheats_List
};
CCheatList(CEnhancementList & Cheats, CEditCheat & EditCheat);
2020-05-19 02:25:57 +00:00
~CCheatList();
void RefreshItems();
2020-05-19 02:25:57 +00:00
private:
CCheatList(void);
2022-09-26 02:31:54 +00:00
CCheatList(const CCheatList &);
CCheatList & operator=(const CCheatList &);
enum TV_CHECK_STATE
{
TV_STATE_UNKNOWN,
TV_STATE_CLEAR,
TV_STATE_CHECKED,
TV_STATE_INDETERMINATE
};
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnChangeCodeExtension(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnUnmark(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnPopupDelete(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnTreeClicked(NMHDR * lpnmh);
LRESULT OnTreeRClicked(NMHDR * lpnmh);
LRESULT OnTreeDClicked(NMHDR * lpnmh);
LRESULT OnTreeSelChanged(NMHDR * lpnmh);
void AddCodeLayers(LPARAM ListID, const std::wstring & Name, HTREEITEM hParent, bool CheatActive);
2020-05-19 02:25:57 +00:00
void ChangeChildrenStatus(HTREEITEM hParent, bool Checked);
void CheckParentStatus(HTREEITEM hParent);
void DeleteCheat(LPARAM Enhancement);
2020-05-19 02:25:57 +00:00
TV_CHECK_STATE TV_GetCheckState(HTREEITEM hItem);
bool TV_SetCheckState(HTREEITEM hItem, TV_CHECK_STATE state);
static void MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut);
2022-09-26 02:31:54 +00:00
enum
{
IDC_MYTREE = 0x500
};
CEnhancementList & m_Cheats;
2020-05-19 02:25:57 +00:00
CEditCheat & m_EditCheat;
CTreeViewCtrl m_hCheatTree;
HTREEITEM m_hSelectedItem;
bool m_DeleteingEntries;
};
2020-05-19 02:25:57 +00:00
class CEditCheat :
public CDialogImpl<CEditCheat>
{
friend CCheatsUI;
2020-05-19 02:25:57 +00:00
public:
enum
{
WM_EDITCHEAT = WM_USER + 0x120,
};
BEGIN_MSG_MAP_EX(CEditCheat)
2022-09-26 02:31:54 +00:00
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
MESSAGE_HANDLER(WM_EDITCHEAT, OnEditCheat)
COMMAND_ID_HANDLER(IDC_ADD, OnAddCheat)
COMMAND_ID_HANDLER(IDC_NEWCHEAT, OnNewCheat)
COMMAND_HANDLER(IDC_CODE_NAME, EN_CHANGE, OnCodeNameChanged)
COMMAND_HANDLER(IDC_CHEAT_CODES, EN_CHANGE, OnCheatCodeChanged)
COMMAND_HANDLER(IDC_CHEAT_OPTIONS, EN_CHANGE, OnCheatOptionsChanged)
2020-05-19 02:25:57 +00:00
END_MSG_MAP()
2022-09-26 02:31:54 +00:00
enum
{
IDD = IDD_Cheats_Add
};
2020-05-19 02:25:57 +00:00
CEditCheat(CEnhancementList & Cheats, CCheatList & CheatList);
2020-05-19 02:25:57 +00:00
~CEditCheat();
private:
CEditCheat();
2022-09-26 02:31:54 +00:00
CEditCheat(const CEditCheat &);
CEditCheat & operator=(const CEditCheat &);
2020-05-19 02:25:57 +00:00
2022-09-26 02:31:54 +00:00
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnEditCheat(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnAddCheat(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnNewCheat(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnCodeNameChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnCheatCodeChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnCheatOptionsChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
bool ReadEnhancement(CEnhancement & Enhancement);
void DetailsChanged(void);
void RecordCurrentValues(void);
bool ValuesChanged(void);
CEnhancementList & m_Cheats;
2020-05-19 02:25:57 +00:00
CCheatList & m_CheatList;
std::string m_EditName;
std::string m_EditCode;
std::string m_EditOptions;
std::string m_EditNotes;
CEnhancement * m_EditEnhancement;
};
class CEnhancementCodeEx :
public CDialogImpl<CEnhancementCodeEx>
2020-05-19 02:25:57 +00:00
{
public:
BEGIN_MSG_MAP_EX(CEnhancementCodeEx)
2022-09-26 02:31:54 +00:00
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
COMMAND_HANDLER(IDC_CHEAT_LIST, LBN_DBLCLK, OnListDblClick)
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
2020-05-19 02:25:57 +00:00
END_MSG_MAP()
2022-09-26 02:31:54 +00:00
enum
{
IDD = IDD_Cheats_CodeEx
};
2020-05-19 02:25:57 +00:00
CEnhancementCodeEx(CEnhancement * Enhancement);
2020-05-19 02:25:57 +00:00
private:
CEnhancementCodeEx();
2022-09-26 02:31:54 +00:00
CEnhancementCodeEx(const CEnhancementCodeEx &);
CEnhancementCodeEx & operator=(const CEnhancementCodeEx &);
2020-05-19 02:25:57 +00:00
2022-09-26 02:31:54 +00:00
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnListDblClick(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnOkCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
2020-05-19 02:25:57 +00:00
CEnhancement * m_Enhancement;
2020-05-19 02:25:57 +00:00
};
class CCheatsUI :
public CDialogImpl<CCheatsUI>
{
friend CCheatList;
friend CEditCheat;
friend CEnhancementCodeEx;
2020-05-19 02:25:57 +00:00
public:
BEGIN_MSG_MAP_EX(CCheatsUI)
2022-09-26 02:31:54 +00:00
{
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog);
MESSAGE_HANDLER(WM_DESTROY, OnDestroy);
COMMAND_ID_HANDLER(IDC_STATE, OnStateChange);
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd);
}
2020-05-19 02:25:57 +00:00
END_MSG_MAP()
2022-09-26 02:31:54 +00:00
enum
{
IDD = IDD_Cheats_Select
};
2020-05-19 02:25:57 +00:00
CCheatsUI(void);
~CCheatsUI(void);
void Display(HWND hParent, bool BlockExecution);
2020-05-19 02:25:57 +00:00
private:
2022-09-26 02:31:54 +00:00
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL & bHandled);
LRESULT OnCloseCmd(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
LRESULT OnStateChange(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL & bHandled);
2020-05-19 02:25:57 +00:00
CEnhancementList m_Cheats;
2020-05-19 02:25:57 +00:00
CEditCheat m_EditCheat;
CCheatList m_SelectCheat;
CButton m_StateBtn;
2022-09-26 02:31:54 +00:00
int m_MinSizeDlg, m_MaxSizeDlg;
bool m_bModal;
2020-05-19 02:25:57 +00:00
2022-09-26 02:31:54 +00:00
enum Dialog_State
{
CONTRACTED,
EXPANDED
} m_DialogState;
2021-03-17 08:28:39 +00:00
};