Make cheat UI to be wtl based
This commit is contained in:
parent
48abaff90f
commit
71160d08c0
|
@ -446,13 +446,9 @@ void CSettings::AddHowToHandleSetting(const char * BaseDirectory)
|
|||
AddHandler(Cheat_Entry, new CSettingTypeCheats("", Cheat_UserEntry));
|
||||
AddHandler(Cheat_Notes, new CSettingTypeCheats("_N", Cheat_UserNotes));
|
||||
AddHandler(Cheat_Options, new CSettingTypeCheats("_O", Cheat_UserOptions));
|
||||
AddHandler(Cheat_Range, new CSettingTypeCheats("_R", Cheat_UserRange));
|
||||
AddHandler(Cheat_RangeNotes, new CSettingTypeCheats("_RN", Cheat_UserRangeNotes));
|
||||
AddHandler(Cheat_UserEntry, new CSettingTypeGameIndex("Cheat", "", ""));
|
||||
AddHandler(Cheat_UserNotes, new CSettingTypeGameIndex("Cheat", "_N", ""));
|
||||
AddHandler(Cheat_UserOptions, new CSettingTypeGameIndex("Cheat", "_O", ""));
|
||||
AddHandler(Cheat_UserRange, new CSettingTypeGameIndex("Cheat", "_R", ""));
|
||||
AddHandler(Cheat_UserRangeNotes, new CSettingTypeGameIndex("Cheat", "_RN", ""));
|
||||
AddHandler(Cheat_Active, new CSettingTypeGameIndex("Cheat", "Active", false));
|
||||
AddHandler(Cheat_Extension, new CSettingTypeGameIndex("Cheat", ".exten", "??? - Not Set"));
|
||||
|
||||
|
|
|
@ -176,13 +176,5 @@ void CSettingTypeCheats::CopyCheats(void)
|
|||
{
|
||||
g_Settings->SaveStringIndex(Cheat_UserOptions, i, Value);
|
||||
}
|
||||
if (g_Settings->LoadStringIndex(Cheat_Range, i, Value))
|
||||
{
|
||||
g_Settings->SaveStringIndex(Cheat_UserRange, i, Value);
|
||||
}
|
||||
if (g_Settings->LoadStringIndex(Cheat_RangeNotes, i, Value))
|
||||
{
|
||||
g_Settings->SaveStringIndex(Cheat_UserRangeNotes, i, Value);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -338,13 +338,9 @@ enum SettingID
|
|||
Cheat_Entry,
|
||||
Cheat_Notes,
|
||||
Cheat_Options,
|
||||
Cheat_Range,
|
||||
Cheat_RangeNotes,
|
||||
Cheat_UserEntry,
|
||||
Cheat_UserNotes,
|
||||
Cheat_UserOptions,
|
||||
Cheat_UserRange,
|
||||
Cheat_UserRangeNotes,
|
||||
Cheat_Active,
|
||||
Cheat_Extension,
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -9,63 +9,189 @@
|
|||
* *
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
#include <Project64\WTLApp.h>
|
||||
|
||||
class CCheatsUI
|
||||
class CEditCheat;
|
||||
|
||||
class CCheatList :
|
||||
public CDialogImpl<CCheatList>
|
||||
{
|
||||
enum
|
||||
{
|
||||
UM_CHANGECODEEXTENSION = WM_USER + 0x121,
|
||||
};
|
||||
|
||||
public:
|
||||
BEGIN_MSG_MAP_EX(CCheatList)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
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)
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Cheats_List };
|
||||
|
||||
CCheatList(CEditCheat & EditCheat);
|
||||
~CCheatList();
|
||||
|
||||
void RefreshItems();
|
||||
|
||||
private:
|
||||
CCheatList(void);
|
||||
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 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(int CheatNumber, const std::wstring &CheatName, HTREEITEM hParent, bool CheatActive);
|
||||
void ChangeChildrenStatus(HTREEITEM hParent, bool Checked);
|
||||
void CheckParentStatus(HTREEITEM hParent);
|
||||
void DeleteCheat(int Index);
|
||||
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);
|
||||
|
||||
enum { IDC_MYTREE = 0x500 };
|
||||
|
||||
CEditCheat & m_EditCheat;
|
||||
CTreeViewCtrl m_hCheatTree;
|
||||
HTREEITEM m_hSelectedItem;
|
||||
bool m_DeleteingEntries;
|
||||
};
|
||||
|
||||
class CEditCheat :
|
||||
public CDialogImpl<CEditCheat>
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
WM_EDITCHEAT = WM_USER + 0x120,
|
||||
};
|
||||
|
||||
enum CodeFormat
|
||||
{
|
||||
CodeFormat_Invalid = -1,
|
||||
CodeFormat_Normal = 0,
|
||||
CodeFormat_LowerByte = 1,
|
||||
CodeFormat_Word = 2,
|
||||
};
|
||||
|
||||
BEGIN_MSG_MAP_EX(CEditCheat)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
MESSAGE_HANDLER(WM_EDITCHEAT, OnEditCheat)
|
||||
MESSAGE_HANDLER(IDC_ADD, OnAddCheat)
|
||||
MESSAGE_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)
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Cheats_Add };
|
||||
|
||||
CEditCheat(CCheatList & CheatList);
|
||||
~CEditCheat();
|
||||
|
||||
private:
|
||||
CEditCheat();
|
||||
CEditCheat(const CEditCheat&);
|
||||
CEditCheat& operator=(const CEditCheat&);
|
||||
|
||||
LRESULT OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnEditCheat(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnAddCheat(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
|
||||
LRESULT OnNewCheat(UINT uMsg, WPARAM wParam, LPARAM lParam, 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);
|
||||
|
||||
std::string ReadCodeString(bool &ValidCodes, bool &ValidOptions, bool &NoOptions, CodeFormat & Format);
|
||||
std::string ReadOptionsString(bool &validoptions, CodeFormat Format);
|
||||
|
||||
void RecordCheatValues(void);
|
||||
bool CheatChanged(void);
|
||||
std::string GetItemText(int nIDDlgItem);
|
||||
|
||||
CCheatList & m_CheatList;
|
||||
std::string m_EditName;
|
||||
std::string m_EditCode;
|
||||
std::string m_EditOptions;
|
||||
std::string m_EditNotes;
|
||||
int32_t m_EditCheat;
|
||||
};
|
||||
|
||||
class CCheatsCodeEx :
|
||||
public CDialogImpl<CCheatsCodeEx>
|
||||
{
|
||||
public:
|
||||
BEGIN_MSG_MAP_EX(CCheatsCodeEx)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_HANDLER(IDC_CHEAT_LIST, LBN_DBLCLK, OnListDblClick)
|
||||
COMMAND_ID_HANDLER(IDOK, OnOkCmd)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Cheats_CodeEx };
|
||||
|
||||
CCheatsCodeEx(int EditCheat);
|
||||
|
||||
private:
|
||||
CCheatsCodeEx();
|
||||
CCheatsCodeEx(const CCheatsCodeEx&);
|
||||
CCheatsCodeEx& operator=(const CCheatsCodeEx&);
|
||||
|
||||
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);
|
||||
|
||||
int32_t m_EditCheat;
|
||||
};
|
||||
|
||||
class CCheatsUI :
|
||||
public CDialogImpl<CCheatsUI>
|
||||
{
|
||||
friend CCheatList;
|
||||
friend CEditCheat;
|
||||
friend CCheatsCodeEx;
|
||||
|
||||
public:
|
||||
BEGIN_MSG_MAP_EX(CCheatsUI)
|
||||
MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
|
||||
COMMAND_ID_HANDLER(IDC_STATE, OnStateChange)
|
||||
COMMAND_ID_HANDLER(IDCANCEL, OnCloseCmd)
|
||||
END_MSG_MAP()
|
||||
|
||||
enum { IDD = IDD_Cheats_Select };
|
||||
|
||||
CCheatsUI(void);
|
||||
~CCheatsUI(void);
|
||||
|
||||
bool IsCheatMessage(MSG * msg);
|
||||
void SelectCheats(HWND hParent, bool BlockExecution);
|
||||
void Display(HWND hParent);
|
||||
|
||||
private:
|
||||
static int CALLBACK CheatAddProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
|
||||
static int CALLBACK CheatListProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
|
||||
static int CALLBACK ManageCheatsProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
|
||||
static int CALLBACK CheatsCodeExProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
|
||||
static int CALLBACK CheatsCodeQuantProc(HWND hDlg, uint32_t uMsg, uint32_t wParam, uint32_t lParam);
|
||||
LRESULT OnInitDialog(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);
|
||||
|
||||
//information about the gui for selecting cheats
|
||||
HWND m_Window, m_hSelectCheat, m_AddCheat, m_hCheatTree, m_hSelectedItem;
|
||||
void * const m_rcList, *const m_rcAdd;
|
||||
static std::string GetCheatName(int CheatNo, bool AddExtension);
|
||||
static bool CheatUsesCodeExtensions(const std::string &LineEntry);
|
||||
|
||||
CEditCheat m_EditCheat;
|
||||
CCheatList m_SelectCheat;
|
||||
CButton m_StateBtn;
|
||||
int m_MinSizeDlg, m_MaxSizeDlg;
|
||||
int m_EditCheat;
|
||||
bool m_DeleteingEntries;
|
||||
|
||||
//Information about the current cheat we are editing
|
||||
stdstr m_EditName;
|
||||
stdstr m_EditCode;
|
||||
stdstr m_EditOptions;
|
||||
stdstr m_EditNotes;
|
||||
|
||||
enum Dialog_State { CONTRACTED, EXPANDED } m_DialogState;
|
||||
enum TV_CHECK_STATE { TV_STATE_UNKNOWN, TV_STATE_CLEAR, TV_STATE_CHECKED, TV_STATE_INDETERMINATE };
|
||||
enum { IDC_MYTREE = 0x500 };
|
||||
|
||||
void AddCodeLayers(int CheatNumber, const stdstr &CheatName, HWND hParent, bool CheatActive);
|
||||
//Reload the cheats from the ini file to the select gui
|
||||
void RefreshCheatManager();
|
||||
void ChangeChildrenStatus(HWND hParent, bool Checked);
|
||||
void CheckParentStatus(HWND hParent);
|
||||
static stdstr ReadCodeString(HWND hDlg, bool &validcodes, bool &validoption, bool &nooptions, int &codeformat);
|
||||
static stdstr ReadOptionsString(HWND hDlg, bool &validcodes, bool &validoptions, bool &nooptions, int &codeformat);
|
||||
|
||||
void RecordCheatValues(HWND hDlg);
|
||||
bool CheatChanged(HWND hDlg);
|
||||
void DeleteCheat(int Index);
|
||||
|
||||
//Get Information about the Cheat
|
||||
stdstr GetCheatName(int CheatNo, bool AddExtension) const;
|
||||
static bool CheatUsesCodeExtensions(const stdstr &LineEntry);
|
||||
//Working with treeview
|
||||
static bool TV_SetCheckState(HWND hwndTreeView, HWND hItem, TV_CHECK_STATE state);
|
||||
static int TV_GetCheckState(HWND hwndTreeView, HWND hItem);
|
||||
|
||||
static void MenuSetText(HMENU hMenu, int MenuPos, const wchar_t * Title, const wchar_t * ShortCut);
|
||||
|
||||
//UI Functions
|
||||
static stdstr GetDlgItemStr(HWND hDlg, int nIDDlgItem);
|
||||
};
|
||||
|
||||
extern CCheatsUI * g_cheatUI;
|
||||
enum Dialog_State { CONTRACTED, EXPANDED } m_DialogState;
|
||||
};
|
|
@ -274,15 +274,12 @@ void CMainMenu::OnLodState(HWND hWnd)
|
|||
|
||||
void CMainMenu::OnCheats(HWND hWnd)
|
||||
{
|
||||
CCheatsUI * cheatUI = new CCheatsUI;
|
||||
g_cheatUI = cheatUI;
|
||||
cheatUI->SelectCheats(hWnd, false);
|
||||
CCheatsUI().Display(hWnd);
|
||||
}
|
||||
|
||||
void CMainMenu::OnSettings(HWND hWnd)
|
||||
{
|
||||
CSettingConfig SettingConfig;
|
||||
SettingConfig.Display(hWnd);
|
||||
CSettingConfig().Display(hWnd);
|
||||
}
|
||||
|
||||
bool CMainMenu::ProcessMessage(HWND hWnd, DWORD /*FromAccelerator*/, DWORD MenuID)
|
||||
|
|
|
@ -509,11 +509,6 @@ WPARAM CMainGui::ProcessAllMessages(void)
|
|||
|
||||
while (GetMessage(&msg, NULL, 0, 0))
|
||||
{
|
||||
if (g_cheatUI != NULL && g_cheatUI->IsCheatMessage(&msg))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m_ResetPlugins)
|
||||
{
|
||||
m_ResetPlugins = false;
|
||||
|
@ -521,7 +516,6 @@ WPARAM CMainGui::ProcessAllMessages(void)
|
|||
SetEvent(m_ResetInfo->hEvent);
|
||||
m_ResetInfo = NULL;
|
||||
}
|
||||
if (g_cheatUI && g_cheatUI->IsCheatMessage(&msg)) { continue; }
|
||||
if (m_Menu->ProcessAccelerator(m_hMainWindow, &msg)) { continue; }
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
|
@ -1068,13 +1062,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
|||
}
|
||||
else if (LOWORD(wParam) == ID_POPUPMENU_EDITCHEATS)
|
||||
{
|
||||
CCheatsUI * cheatUI = new CCheatsUI;
|
||||
g_cheatUI = cheatUI;
|
||||
cheatUI->SelectCheats(hWnd, true);
|
||||
if (g_cheatUI == cheatUI)
|
||||
{
|
||||
g_cheatUI = NULL;
|
||||
}
|
||||
CCheatsUI().Display(hWnd);
|
||||
}
|
||||
|
||||
if (g_Rom)
|
||||
|
@ -1103,13 +1091,7 @@ LRESULT CALLBACK CMainGui::MainGui_Proc(HWND hWnd, DWORD uMsg, DWORD wParam, DWO
|
|||
}
|
||||
else if (LOWORD(wParam) == ID_POPUPMENU_EDITCHEATS)
|
||||
{
|
||||
CCheatsUI * cheatUI = new CCheatsUI;
|
||||
g_cheatUI = cheatUI;
|
||||
cheatUI->SelectCheats(hWnd, true);
|
||||
if (g_cheatUI == cheatUI)
|
||||
{
|
||||
g_cheatUI = NULL;
|
||||
}
|
||||
CCheatsUI().Display(hWnd);
|
||||
}
|
||||
|
||||
if (g_Disk)
|
||||
|
|
Loading…
Reference in New Issue