Skip to content

Commit 7a323b8

Browse files
committed
Fix some minor issues with cheats
1 parent 2a96468 commit 7a323b8

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/action_replay.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ bool ActionReplay::loadCheats()
6868
// Load the cheat code up until an empty line
6969
while (fgets(data, 512, file) != nullptr && data[0] != '\n')
7070
{
71-
cheat.code.push_back(strtol(&data[0], nullptr, 16));
72-
cheat.code.push_back(strtol(&data[8], nullptr, 16));
71+
cheat.code.push_back(strtoll(&data[0], nullptr, 16));
72+
cheat.code.push_back(strtoll(&data[8], nullptr, 16));
7373
}
7474
}
7575

src/desktop/cheat_dialog.cpp

+6-7
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ CheatDialog::CheatDialog(Core *core): wxDialog(nullptr, wxID_ANY, "Action Replay
4343

4444
// Set up the cheat name and code editors
4545
wxBoxSizer *editSizer = new wxBoxSizer(wxVERTICAL);
46-
nameEditor = new wxTextCtrl();
47-
nameEditor->Create(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(size * 8, size));
46+
nameEditor = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(size * 8, size));
4847
editSizer->Add(nameEditor, 0, wxEXPAND | wxBOTTOM, size / 16);
49-
codeEditor = new wxTextCtrl();
50-
codeEditor->Create(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
48+
codeEditor = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE);
5149
editSizer->Add(codeEditor, 1, wxEXPAND | wxTOP, size / 16);
5250

5351
// Set up the cheat list and combine it with the editors
@@ -104,7 +102,7 @@ void CheatDialog::updateCheat()
104102
{
105103
p = code.find_first_of(" \n", i);
106104
if (p == std::string::npos) p = code.size();
107-
cheat->code.push_back(strtol(code.substr(i, p).c_str(), nullptr, 16));
105+
cheat->code.push_back(strtoll(code.substr(i, p).c_str(), nullptr, 16));
108106
}
109107

110108
// Ensure the code's word count is a multiple of 2
@@ -124,10 +122,11 @@ void CheatDialog::selectCheat(wxCommandEvent &event)
124122
// Select a new cheat and put its name in the editor
125123
if (curCheat >= 0) updateCheat();
126124
ARCheat *cheat = &core->actionReplay.cheats[curCheat = event.GetInt()];
127-
nameEditor->SetValue(cheat->name);
128-
codeEditor->Clear();
125+
nameEditor->Clear();
126+
nameEditor->AppendText(cheat->name);
129127

130128
// Write the code to the editor as a string
129+
codeEditor->Clear();
131130
for (uint32_t i = 0; i < cheat->code.size(); i += 2)
132131
{
133132
char line[19];

0 commit comments

Comments
 (0)