Skip to content

Commit 193e950

Browse files
committed
The hotkey values can now be modified in the Options window.
The hotkey values added in version 1.0.2.9 can now be modified in the Options window, and you can determine whether to enable them.
1 parent 7756020 commit 193e950

File tree

7 files changed

+818
-221
lines changed

7 files changed

+818
-221
lines changed

PS4CheaterNeo/HexEditor.cs

Lines changed: 55 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,18 @@ public partial class HexEditor : Form
3535
private readonly MutexSecurity mSec;
3636
private readonly Mutex mutex;
3737

38+
bool KeyHexEditor;
39+
Keys KeyGoPreviousBtn;
40+
Keys KeyGoNextBtn;
41+
Keys KeyPerformRefreshBtn;
42+
Keys KeyPerformCommitBtn;
43+
Keys KeyPerformAddToCheatGridBtn;
44+
Keys KeyPerformFindBtn;
45+
Keys KeyCollapseLeftSplitPanel;
46+
Keys KeyExpandLeftSplitPanel;
47+
Keys KeyCollapseUpperRightSplitPanel;
48+
Keys KeyExpandUpperRightSplitPanel;
49+
3850
private HexEditor(Main mainForm)
3951
{
4052
this.Font = mainForm.Font;
@@ -81,10 +93,7 @@ private HexEditor(Main mainForm)
8193
for (int idx = 0; idx <= 0x10; idx++) HexViewMenuGroupSize.Items.Add("GroupSize:" + idx);
8294
HexViewMenuGroupSize.SelectedIndex = HexView.GroupSize;
8395

84-
AutoRefreshBox.Checked = Properties.Settings.Default.AutoRefresh.Value;
85-
AutoRefreshTimer.Interval = (int)Properties.Settings.Default.AutoRefreshTimerInterval.Value;
86-
HexBox.Checked = Properties.Settings.Default.InputIsHexFormat.Value;
87-
LittleEndianBox.Checked = Properties.Settings.Default.UsingLittleEndian.Value;
96+
8897
}
8998

9099
public HexEditor(Main mainForm, SectionTool sectionTool, Section section, int baseAddr) : this(mainForm)
@@ -106,41 +115,31 @@ public HexEditor(Main mainForm, SectionTool sectionTool, Section section, int ba
106115

107116
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
108117
{
109-
switch (keyData)
110-
{
111-
case Keys.Control | Keys.P:
112-
PreviousBtn.PerformClick();
113-
break;
114-
case Keys.Control | Keys.N:
115-
NextBtn.PerformClick();
116-
break;
117-
case Keys.Control | Keys.R:
118-
RefreshBtn.PerformClick();
119-
break;
120-
case Keys.Control | Keys.S:
121-
CommitBtn.PerformClick();
122-
break;
123-
case Keys.Control | Keys.A:
124-
AddToCheatGridBtn.PerformClick();
125-
break;
126-
case Keys.F3:
127-
FindBtn.PerformClick();
128-
break;
129-
case Keys.Control | Keys.Left:
130-
SplitContainer1.SplitterPanelCollapseExpand(true);
131-
break;
132-
case Keys.Control | Keys.Right:
133-
SplitContainer1.SplitterPanelCollapseExpand(false);
134-
break;
135-
case Keys.Control | Keys.Up:
136-
SplitContainer2.SplitterPanelCollapseExpand(true);
137-
break;
138-
case Keys.Control | Keys.Down:
139-
SplitContainer2.SplitterPanelCollapseExpand(false);
140-
break;
141-
default:
142-
return base.ProcessCmdKey(ref msg, keyData);
143-
}
118+
if (!KeyHexEditor) return base.ProcessCmdKey(ref msg, keyData);
119+
120+
if (keyData == KeyGoPreviousBtn)
121+
PreviousBtn.PerformClick();
122+
else if (keyData == KeyGoNextBtn)
123+
NextBtn.PerformClick();
124+
else if (keyData == KeyPerformRefreshBtn)
125+
RefreshBtn.PerformClick();
126+
else if (keyData == KeyPerformCommitBtn)
127+
CommitBtn.PerformClick();
128+
else if (keyData == KeyPerformAddToCheatGridBtn)
129+
AddToCheatGridBtn.PerformClick();
130+
else if (keyData == KeyPerformFindBtn)
131+
FindBtn.PerformClick();
132+
else if (keyData == KeyCollapseLeftSplitPanel)
133+
SplitContainer1.SplitterPanelCollapseExpand(true);
134+
else if (keyData == KeyExpandLeftSplitPanel)
135+
SplitContainer1.SplitterPanelCollapseExpand(false);
136+
else if (keyData == KeyCollapseUpperRightSplitPanel)
137+
SplitContainer2.SplitterPanelCollapseExpand(true);
138+
else if (keyData == KeyExpandUpperRightSplitPanel)
139+
SplitContainer2.SplitterPanelCollapseExpand(false);
140+
else
141+
return base.ProcessCmdKey(ref msg, keyData);
142+
144143
return true;
145144
}
146145

@@ -195,6 +194,23 @@ public void ApplyUI(LanguageJson langJson)
195194
HexViewMenuJumpToAddress.Text = langJson.HexEditorForm.HexViewMenuJumpToAddress;
196195
HexViewMenuJumpToOffset.Text = langJson.HexEditorForm.HexViewMenuJumpToOffset;
197196
}
197+
198+
AutoRefreshBox.Checked = Properties.Settings.Default.AutoRefresh.Value;
199+
AutoRefreshTimer.Interval = (int)Properties.Settings.Default.AutoRefreshTimerInterval.Value;
200+
HexBox.Checked = Properties.Settings.Default.InputIsHexFormat.Value;
201+
LittleEndianBox.Checked = Properties.Settings.Default.UsingLittleEndian.Value;
202+
203+
KeyHexEditor = Properties.Settings.Default.KeyHexEditor.Value;
204+
KeyGoPreviousBtn = Properties.Settings.Default.KeyHexEditorGoPreviousBtn.Value;
205+
KeyGoNextBtn = Properties.Settings.Default.KeyHexEditorGoNextBtn.Value;
206+
KeyPerformRefreshBtn = Properties.Settings.Default.KeyHexEditorPerformRefreshBtn.Value;
207+
KeyPerformCommitBtn = Properties.Settings.Default.KeyHexEditorPerformCommitBtn.Value;
208+
KeyPerformAddToCheatGridBtn = Properties.Settings.Default.KeyHexEditorPerformAddToCheatGridBtn.Value;
209+
KeyPerformFindBtn = Properties.Settings.Default.KeyHexEditorPerformFindBtn.Value;
210+
KeyCollapseLeftSplitPanel = Properties.Settings.Default.KeyHexEditorCollapseLeftSplitPanel.Value;
211+
KeyExpandLeftSplitPanel = Properties.Settings.Default.KeyHexEditorExpandLeftSplitPanel.Value;
212+
KeyCollapseUpperRightSplitPanel = Properties.Settings.Default.KeyHexEditorCollapseUpperRightSplitPanel.Value;
213+
KeyExpandUpperRightSplitPanel = Properties.Settings.Default.KeyHexEditorExpandUpperRightSplitPanel.Value;
198214
}
199215
catch (Exception ex)
200216
{

PS4CheaterNeo/Main.cs

Lines changed: 59 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -51,21 +51,26 @@ public class CheatRow
5151
public string ProcessName;
5252
public string ProcessContentid;
5353
public int ProcessPid;
54+
55+
bool KeyMain;
56+
Keys KeyPerformOpen;
57+
Keys KeyPerformSave;
58+
Keys KeyOpenNewQuery;
59+
Keys KeyOpenHexView;
60+
Keys KeyOpenSettings;
61+
Keys KeyPerformAdd;
62+
Keys KeyPerformRefreshCheat;
63+
Keys KeyCollapseExpandAll;
64+
Keys KeySetLockEnable;
65+
Keys KeySetAutoRefresh;
5466
public Main()
5567
{
5668
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; //Avoid the case where CurrentCulture.NumberFormatInfo.NumberDecimalSeparator is not "."
5769
if ((Properties.Settings.Default.PS4IP.Value ?? "") == "") Properties.Settings.Default.Upgrade(); //Need to get the settings again when the AssemblyVersion is changed
5870
InitializeComponent();
5971
ParseLanguageJson();
6072
ApplyUI();
61-
ToolStripLockEnable.Checked = Properties.Settings.Default.CheatLock.Value;
62-
ToolStripAutoRefresh.Checked = Properties.Settings.Default.CheatAutoRefresh.Value;
63-
CheatAutoRefreshShowStatus = Properties.Settings.Default.CheatAutoRefreshShowStatus.Value;
64-
AutoRefreshTimer.Interval = (int)Properties.Settings.Default.CheatAutoRefreshTimerInterval.Value;
65-
VerifySectionWhenLock = Properties.Settings.Default.VerifySectionWhenLock.Value;
66-
VerifySectionWhenRefresh = Properties.Settings.Default.VerifySectionWhenRefresh.Value;
67-
CheatGridGroupRefreshThreshold = Properties.Settings.Default.CheatGridGroupRefreshThreshold.Value;
68-
CheatGridView.GroupByEnabled = Properties.Settings.Default.CheatGridViewGroupByEnabled.Value;
73+
6974

7075
Text += " " + Application.ProductVersion; //Assembly.GetExecutingAssembly().GetName().Version.ToString(); // Assembly.GetEntryAssembly().GetName().Version.ToString();
7176
sectionTool = new SectionTool(this);
@@ -76,41 +81,31 @@ public Main()
7681

7782
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
7883
{
79-
switch (keyData)
80-
{
81-
case Keys.Control | Keys.O:
82-
ToolStripOpen.PerformClick();
83-
break;
84-
case Keys.Control | Keys.S:
85-
ToolStripSave.PerformClick();
86-
break;
87-
case Keys.Control | Keys.Q:
88-
ToolStripNewQuery.PerformClick();
89-
break;
90-
case Keys.Control | Keys.A:
91-
ToolStripAdd.PerformClick();
92-
break;
93-
case Keys.Control | Keys.H:
94-
ToolStripHexView.PerformClick();
95-
break;
96-
case Keys.Control | Keys.R:
97-
ToolStripRefreshCheat.PerformClick();
98-
break;
99-
case Keys.Alt | Keys.E:
100-
CheatGridView.CollapseExpandAll();
101-
break;
102-
case Keys.Alt | Keys.L:
103-
ToolStripLockEnable.PerformClick();
104-
break;
105-
case Keys.Alt | Keys.R:
106-
ToolStripAutoRefresh.PerformClick();
107-
break;
108-
case Keys.Alt | Keys.S:
109-
ToolStripSettings.PerformClick();
110-
break;
111-
default:
112-
return base.ProcessCmdKey(ref msg, keyData);
113-
}
84+
if (!KeyMain) return base.ProcessCmdKey(ref msg, keyData);
85+
86+
if (keyData == KeyPerformOpen)
87+
ToolStripOpen.PerformClick();
88+
else if (keyData == KeyPerformSave)
89+
ToolStripSave.PerformClick();
90+
else if (keyData == KeyOpenNewQuery)
91+
ToolStripNewQuery.PerformClick();
92+
else if (keyData == KeyOpenHexView)
93+
ToolStripHexView.PerformClick();
94+
else if (keyData == KeyOpenSettings)
95+
ToolStripSettings.PerformClick();
96+
else if (keyData == KeyPerformAdd)
97+
ToolStripAdd.PerformClick();
98+
else if (keyData == KeyPerformRefreshCheat)
99+
ToolStripRefreshCheat.PerformClick();
100+
else if (keyData == KeyCollapseExpandAll)
101+
CheatGridView.CollapseExpandAll();
102+
else if (keyData == KeySetLockEnable)
103+
ToolStripLockEnable.PerformClick();
104+
else if (keyData == KeySetAutoRefresh)
105+
ToolStripAutoRefresh.PerformClick();
106+
else
107+
return base.ProcessCmdKey(ref msg, keyData);
108+
114109
return true;
115110
}
116111

@@ -177,6 +172,27 @@ public void ApplyUI()
177172
}
178173
UIFont = Properties.Settings.Default.UIFont.Value;
179174
Font = new Font(UIFont, Font.Size);
175+
176+
ToolStripLockEnable.Checked = Properties.Settings.Default.CheatLock.Value;
177+
ToolStripAutoRefresh.Checked = Properties.Settings.Default.CheatAutoRefresh.Value;
178+
CheatAutoRefreshShowStatus = Properties.Settings.Default.CheatAutoRefreshShowStatus.Value;
179+
AutoRefreshTimer.Interval = (int)Properties.Settings.Default.CheatAutoRefreshTimerInterval.Value;
180+
VerifySectionWhenLock = Properties.Settings.Default.VerifySectionWhenLock.Value;
181+
VerifySectionWhenRefresh = Properties.Settings.Default.VerifySectionWhenRefresh.Value;
182+
CheatGridGroupRefreshThreshold = Properties.Settings.Default.CheatGridGroupRefreshThreshold.Value;
183+
CheatGridView.GroupByEnabled = Properties.Settings.Default.CheatGridViewGroupByEnabled.Value;
184+
185+
KeyMain = Properties.Settings.Default.KeyMain.Value;
186+
KeyPerformOpen = Properties.Settings.Default.KeyMainPerformOpen.Value;
187+
KeyPerformSave = Properties.Settings.Default.KeyMainPerformSave.Value;
188+
KeyOpenNewQuery = Properties.Settings.Default.KeyMainOpenNewQuery.Value;
189+
KeyOpenHexView = Properties.Settings.Default.KeyMainOpenHexView.Value;
190+
KeyOpenSettings = Properties.Settings.Default.KeyMainOpenSettings.Value;
191+
KeyPerformAdd = Properties.Settings.Default.KeyMainPerformAdd.Value;
192+
KeyPerformRefreshCheat = Properties.Settings.Default.KeyMainPerformRefreshCheat.Value;
193+
KeyCollapseExpandAll = Properties.Settings.Default.KeyMainCheatGridViewCollapseExpandAll.Value;
194+
KeySetLockEnable = Properties.Settings.Default.KeyMainSetLockEnable.Value;
195+
KeySetAutoRefresh = Properties.Settings.Default.KeyMainSetAutoRefresh.Value;
180196
}
181197
catch (Exception ex)
182198
{

0 commit comments

Comments
 (0)