Skip to content

Commit e23b866

Browse files
committed
Add support for Hotkeys feature.
Currently, the hotkeys are hardcoded in the program...
1 parent 51b3776 commit e23b866

File tree

7 files changed

+335
-141
lines changed

7 files changed

+335
-141
lines changed

PS4CheaterNeo/HexEditor.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,46 @@ public HexEditor(Main mainForm, SectionTool sectionTool, Section section, int ba
104104
InitPageData(section, baseAddr);
105105
}
106106

107+
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
108+
{
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+
}
144+
return true;
145+
}
146+
107147
/// <summary>
108148
/// Initialize the contents of the PageBox menu based on the specified Section and
109149
/// select the corresponding PageBox menu based on the relative address (baseAddr).

PS4CheaterNeo/Main.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,46 @@ public Main()
7474
CheatGridView.RowCount = 0;
7575
}
7676

77+
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
78+
{
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+
}
114+
return true;
115+
}
116+
77117
public void ParseLanguageJson()
78118
{
79119
string codes = Properties.Settings.Default.UILanguage.Value.ToString();

PS4CheaterNeo/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.2.8")]
36-
[assembly: AssemblyFileVersion("1.0.2.8")]
35+
[assembly: AssemblyVersion("1.0.2.9")]
36+
[assembly: AssemblyFileVersion("1.0.2.9")]

PS4CheaterNeo/Query.cs

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,52 @@ public Query(Main mainForm, ComparerTool comparerTool = null, int bitsDictDictsI
7676
this.bitsDictDicts = new List<Dictionary<uint, BitsDictionary>>(bitsDictDicts);
7777
}
7878

79+
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
80+
{
81+
switch (keyData)
82+
{
83+
case Keys.Control | Keys.G:
84+
GetProcessesBtn.PerformClick();
85+
break;
86+
case Keys.Control | Keys.P:
87+
PauseResume();
88+
break;
89+
case Keys.Alt | Keys.S:
90+
ScanBtn.PerformClick();
91+
break;
92+
case Keys.Alt | Keys.U:
93+
UndoBtn.PerformClick();
94+
break;
95+
case Keys.Alt | Keys.R:
96+
RedoBtn.PerformClick();
97+
break;
98+
case Keys.Control | Keys.R:
99+
RefreshBtn.PerformClick();
100+
break;
101+
case Keys.Control | Keys.N:
102+
NewBtn.PerformClick();
103+
break;
104+
case Keys.Alt | Keys.C:
105+
CloneScanBtn.PerformClick();
106+
break;
107+
case Keys.Control | Keys.Left:
108+
SplitContainer1.SplitterPanelCollapseExpand(true);
109+
break;
110+
case Keys.Control | Keys.Right:
111+
SplitContainer1.SplitterPanelCollapseExpand(false);
112+
break;
113+
case Keys.Control | Keys.Up:
114+
SplitContainer2.SplitterPanelCollapseExpand(true);
115+
break;
116+
case Keys.Control | Keys.Down:
117+
SplitContainer2.SplitterPanelCollapseExpand(false);
118+
break;
119+
default:
120+
return base.ProcessCmdKey(ref msg, keyData);
121+
}
122+
return true;
123+
}
124+
79125
public void ApplyUI(LanguageJson langJson)
80126
{
81127
try
@@ -1578,16 +1624,13 @@ private void CompareTypeBox_SelectedIndexChanged(object sender, EventArgs e)
15781624
}
15791625
}
15801626

1581-
private void ResumeBtn_Click(object sender, EventArgs e)
1582-
{
1583-
processStatus = ProcessStatus.Resume;
1584-
ComboItem process = (ComboItem)ProcessesBox.SelectedItem;
1585-
PS4Tool.AttachDebugger((int)process.Value, (string)process.Text, processStatus);
1586-
}
1627+
private void ResumeBtn_Click(object sender, EventArgs e) => PauseResume(ProcessStatus.Resume);
1628+
1629+
private void PauseBtn_Click(object sender, EventArgs e) => PauseResume(ProcessStatus.Pause);
15871630

1588-
private void PauseBtn_Click(object sender, EventArgs e)
1631+
private void PauseResume(ProcessStatus? newStatus = null)
15891632
{
1590-
processStatus = ProcessStatus.Pause;
1633+
processStatus = newStatus != null ? (ProcessStatus)newStatus : (processStatus == ProcessStatus.Pause ? ProcessStatus.Resume : ProcessStatus.Pause);
15911634
ComboItem process = (ComboItem)ProcessesBox.SelectedItem;
15921635
PS4Tool.AttachDebugger((int)process.Value, (string)process.Text, processStatus);
15931636
}

0 commit comments

Comments
 (0)