Add Author to enhancement file

This commit is contained in:
zilmar 2021-07-13 08:17:16 +09:30
parent 416205ed5f
commit fc996df8ec
7 changed files with 40 additions and 14 deletions

View File

@ -171,6 +171,10 @@ CEnhancement::CEnhancement(const char * Ident, const char * Entry) :
m_PluginList.push_back(Plugins[i]);
}
}
else if (stricmp(Key.c_str(), "Author") == 0)
{
m_Author = &Pos[1];
}
else if (stricmp(Key.c_str(), "Note") == 0)
{
m_Note = &Pos[1];
@ -282,6 +286,11 @@ void CEnhancement::SetName(const char * Name)
CheckValid();
}
void CEnhancement::SetAuthor(const char * Author)
{
m_Author = Author != nullptr ? Author : "";
}
void CEnhancement::SetNote(const char * Note)
{
m_Note = Note != nullptr ? Note : "";

View File

@ -26,6 +26,7 @@ public:
CEnhancement(const char * Ident);
CEnhancement(const char * Ident, const char * Entry);
void SetName(const char * Name);
void SetAuthor(const char * Author);
void SetNote(const char * Note);
void SetEntries(const CodeEntries & Entries);
void SetOptions(const CodeOptions & Options);
@ -37,6 +38,7 @@ public:
inline const std::string & GetName(void) const { return m_Name; }
inline const std::string & GetNameAndExtension(void) const { return m_NameAndExtension; }
inline const std::string & GetAuthor(void) const { return m_Author; }
inline const std::string & GetNote(void) const { return m_Note; }
inline const CodeEntries & GetEntries(void) const { return m_Entries; }
inline const CodeOptions & GetOptions(void) const { return m_Options; }
@ -58,6 +60,7 @@ private:
std::string m_Ident;
std::string m_Name;
std::string m_NameAndExtension;
std::string m_Author;
std::string m_Note;
PluginList m_PluginList;
CodeEntries m_Entries;

View File

@ -337,6 +337,10 @@ void CEnhancmentFile::SaveCurrentSection(void)
{
Section += stdstr_f("Note=%s%s", Enhancement.GetNote().c_str(), m_LineFeed);
}
if (!Enhancement.GetAuthor().empty())
{
Section += stdstr_f("Author=%s%s", Enhancement.GetAuthor().c_str(), m_LineFeed);
}
const CEnhancement::CodeEntries & Entries = Enhancement.GetEntries();
for (size_t i = 0, n = Entries.size(); i < n; i++)
{

View File

@ -645,6 +645,7 @@ LRESULT CEditCheat::OnEditCheat(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/,
return 0;
}
GetDlgItem(IDC_CODE_NAME).SetWindowText(stdstr(m_EditEnhancement->GetName()).ToUTF16().c_str());
GetDlgItem(IDC_CODE_AUTHOR).SetWindowText(stdstr(m_EditEnhancement->GetAuthor()).ToUTF16().c_str());
stdstr Buffer;
const CEnhancement::CodeEntries & Entries = m_EditEnhancement->GetEntries();
for (size_t i = 0, n = Entries.size(); i < n; i++)
@ -706,6 +707,7 @@ LRESULT CEditCheat::OnAddCheat(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCt
if (m_EditEnhancement != nullptr)
{
m_EditEnhancement->SetName(NewCheatName.c_str());
m_EditEnhancement->SetAuthor(GetCWindowText(GetDlgItem(IDC_CODE_AUTHOR)).c_str());
m_EditEnhancement->SetEntries(Enhancement.GetEntries());
m_EditEnhancement->SetOptions(Enhancement.GetOptions());
m_EditEnhancement->SetNote(GetCWindowText(GetDlgItem(IDC_NOTES)).c_str());

View File

@ -502,6 +502,7 @@ LRESULT CEditEnhancement::OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM
m_Entries = m_EditEnhancement != nullptr ? m_EditEnhancement->GetEntries() : CEnhancement::CodeEntries();
m_PluginList = m_EditEnhancement != nullptr ? m_EditEnhancement->GetPluginList() : CEnhancement::PluginList();
GetDlgItem(IDC_CODE_NAME).SetWindowText(m_EditEnhancement != nullptr ? stdstr(m_EditEnhancement->GetName()).ToUTF16().c_str() : L"");
GetDlgItem(IDC_CODE_AUTHOR).SetWindowText(m_EditEnhancement != nullptr ? stdstr(m_EditEnhancement->GetAuthor()).ToUTF16().c_str() : L"");
GetDlgItem(IDC_NOTES).SetWindowText(m_EditEnhancement != nullptr ? stdstr(m_EditEnhancement->GetNote()).ToUTF16().c_str() : L"");
CButton(GetDlgItem(IDC_AUTOON)).SetCheck(m_EditEnhancement != nullptr ? (m_EditEnhancement->GetOnByDefault() ? BST_CHECKED : BST_UNCHECKED) : BST_UNCHECKED);
CButton(GetDlgItem(IDC_GAMESHARK)).SetCheck(m_Entries.size() > 0 ? BST_CHECKED : BST_UNCHECKED);
@ -543,6 +544,7 @@ LRESULT CEditEnhancement::OnOkCmd(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl
CEnhancement TempEnhancement(CEnhancement::EnhancementIdent);
CEnhancement & Enhancement = m_EditEnhancement != nullptr ? *m_EditEnhancement : TempEnhancement;
Enhancement.SetName(GetCWindowText(GetDlgItem(IDC_CODE_NAME)).c_str());
Enhancement.SetAuthor(GetCWindowText(GetDlgItem(IDC_CODE_AUTHOR)).c_str());
Enhancement.SetOnByDefault(CButton(GetDlgItem(IDC_AUTOON)).GetCheck() == BST_CHECKED);
Enhancement.SetOverClock(CButton(GetDlgItem(IDC_OVERCLOCK)).GetCheck() == BST_CHECKED, atoi(GetCWindowText(GetDlgItem(IDC_OVER_CLOCK_MODIFIER)).c_str()));
Enhancement.SetEntries(m_Entries);

View File

@ -287,14 +287,16 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD | WS_VISIBLE
EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Name:",IDC_NAME,4,6,25,10
EDITTEXT IDC_CODE_NAME,52,4,146,12,ES_AUTOHSCROLL
LTEXT "Code:",IDC_CODE,4,24,31,10
LTEXT "<address> <value>:<old>",IDC_CODE_DES,4,34,92,10
LTEXT "Options:",IDC_LABEL_OPTIONS,101,24,38,10,WS_DISABLED
LTEXT "<value> <label>",IDC_LABEL_OPTIONS_FORMAT,101,34,80,10,WS_DISABLED
EDITTEXT IDC_CHEAT_CODES,4,44,88,96,ES_MULTILINE | ES_UPPERCASE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_CHEAT_OPTIONS,100,44,98,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_DISABLED | WS_VSCROLL | WS_HSCROLL
LTEXT "Name:",IDC_NAME,4,5,25,10
EDITTEXT IDC_CODE_NAME,52,3,146,12,ES_AUTOHSCROLL
LTEXT "Author",IDC_AUTHOR,4,19,25,10
EDITTEXT IDC_CODE_AUTHOR,52,18,146,12,ES_AUTOHSCROLL
LTEXT "Code:",IDC_CODE,4,32,31,10
LTEXT "<address> <value>:<old>",IDC_CODE_DES,4,42,92,10
LTEXT "Options:",IDC_LABEL_OPTIONS,101,32,38,10,WS_DISABLED
LTEXT "<value> <label>",IDC_LABEL_OPTIONS_FORMAT,101,42,80,10,WS_DISABLED
EDITTEXT IDC_CHEAT_CODES,4,52,88,96,ES_MULTILINE | ES_UPPERCASE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_VSCROLL
EDITTEXT IDC_CHEAT_OPTIONS,100,52,98,96,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN | WS_DISABLED | WS_VSCROLL | WS_HSCROLL
LTEXT "Cheat Notes",IDC_CHEATNOTES,3,149,60,10
EDITTEXT IDC_NOTES,4,160,194,32,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL
PUSHBUTTON "New Cheat",IDC_NEWCHEAT,23,198,75,15
@ -1267,13 +1269,15 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTI
CAPTION "Edit Enhancement"
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
LTEXT "Name:",IDC_NAME,7,9,25,10
LTEXT "Name:",IDC_NAME,7,8,25,10
EDITTEXT IDC_CODE_NAME,37,7,162,12,ES_AUTOHSCROLL
CONTROL "Game Shark Code",IDC_GAMESHARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,20,74,10
PUSHBUTTON "Edit",IDC_BTN_GAMESHARK,90,20,51,10
CONTROL "Overclock modifier:",IDC_OVERCLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,31,74,10
EDITTEXT IDC_OVER_CLOCK_MODIFIER,90,31,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "On by default",IDC_AUTOON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,42,74,10
LTEXT "Author:",IDC_AUTHOR,7,22,25,10
EDITTEXT IDC_CODE_AUTHOR,37,21,162,12,ES_AUTOHSCROLL
CONTROL "Game Shark Code",IDC_GAMESHARK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,36,74,10
PUSHBUTTON "Edit",IDC_BTN_GAMESHARK,90,36,51,10
CONTROL "Overclock modifier:",IDC_OVERCLOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,47,74,10
EDITTEXT IDC_OVER_CLOCK_MODIFIER,90,47,109,12,ES_AUTOHSCROLL | ES_NUMBER
CONTROL "On by default",IDC_AUTOON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,58,74,10
GROUPBOX "Notes",IDC_ENHANCEMENTNOTES,7,139,192,43
EDITTEXT IDC_NOTES,11,148,186,30,ES_MULTILINE | ES_WANTRETURN | WS_VSCROLL
CONTROL "",IDC_STATIC,"Static",SS_BLACKFRAME | SS_SUNKEN,8,186,190,1

View File

@ -299,6 +299,8 @@
#define IDC_RANGE 1125
#define IDC_ADD 1126
#define IDC_CODE_NAME 1130
#define IDC_AUTHOR 1131
#define IDC_CODE_AUTHOR 1132
#define IDC_USE_ROMBROWSER 1133
#define IDC_USING 1134
#define IDC_AVALIABLE 1135