Skip to content

Commit

Permalink
Add support for Hotkeys feature.
Browse files Browse the repository at this point in the history
Currently, the hotkeys are hardcoded in the program...
  • Loading branch information
avan06 committed Mar 3, 2024
1 parent 51b3776 commit e23b866
Show file tree
Hide file tree
Showing 7 changed files with 335 additions and 141 deletions.
40 changes: 40 additions & 0 deletions PS4CheaterNeo/HexEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,46 @@ public HexEditor(Main mainForm, SectionTool sectionTool, Section section, int ba
InitPageData(section, baseAddr);
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Control | Keys.P:
PreviousBtn.PerformClick();
break;
case Keys.Control | Keys.N:
NextBtn.PerformClick();
break;
case Keys.Control | Keys.R:
RefreshBtn.PerformClick();
break;
case Keys.Control | Keys.S:
CommitBtn.PerformClick();
break;
case Keys.Control | Keys.A:
AddToCheatGridBtn.PerformClick();
break;
case Keys.F3:
FindBtn.PerformClick();
break;
case Keys.Control | Keys.Left:
SplitContainer1.SplitterPanelCollapseExpand(true);
break;
case Keys.Control | Keys.Right:
SplitContainer1.SplitterPanelCollapseExpand(false);
break;
case Keys.Control | Keys.Up:
SplitContainer2.SplitterPanelCollapseExpand(true);
break;
case Keys.Control | Keys.Down:
SplitContainer2.SplitterPanelCollapseExpand(false);
break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}
return true;
}

/// <summary>
/// Initialize the contents of the PageBox menu based on the specified Section and
/// select the corresponding PageBox menu based on the relative address (baseAddr).
Expand Down
40 changes: 40 additions & 0 deletions PS4CheaterNeo/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,46 @@ public Main()
CheatGridView.RowCount = 0;
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Control | Keys.O:
ToolStripOpen.PerformClick();
break;
case Keys.Control | Keys.S:
ToolStripSave.PerformClick();
break;
case Keys.Control | Keys.Q:
ToolStripNewQuery.PerformClick();
break;
case Keys.Control | Keys.A:
ToolStripAdd.PerformClick();
break;
case Keys.Control | Keys.H:
ToolStripHexView.PerformClick();
break;
case Keys.Control | Keys.R:
ToolStripRefreshCheat.PerformClick();
break;
case Keys.Alt | Keys.E:
CheatGridView.CollapseExpandAll();
break;
case Keys.Alt | Keys.L:
ToolStripLockEnable.PerformClick();
break;
case Keys.Alt | Keys.R:
ToolStripAutoRefresh.PerformClick();
break;
case Keys.Alt | Keys.S:
ToolStripSettings.PerformClick();
break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}
return true;
}

public void ParseLanguageJson()
{
string codes = Properties.Settings.Default.UILanguage.Value.ToString();
Expand Down
4 changes: 2 additions & 2 deletions PS4CheaterNeo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.2.8")]
[assembly: AssemblyFileVersion("1.0.2.8")]
[assembly: AssemblyVersion("1.0.2.9")]
[assembly: AssemblyFileVersion("1.0.2.9")]
59 changes: 51 additions & 8 deletions PS4CheaterNeo/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,52 @@ public Query(Main mainForm, ComparerTool comparerTool = null, int bitsDictDictsI
this.bitsDictDicts = new List<Dictionary<uint, BitsDictionary>>(bitsDictDicts);
}

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Control | Keys.G:
GetProcessesBtn.PerformClick();
break;
case Keys.Control | Keys.P:
PauseResume();
break;
case Keys.Alt | Keys.S:
ScanBtn.PerformClick();
break;
case Keys.Alt | Keys.U:
UndoBtn.PerformClick();
break;
case Keys.Alt | Keys.R:
RedoBtn.PerformClick();
break;
case Keys.Control | Keys.R:
RefreshBtn.PerformClick();
break;
case Keys.Control | Keys.N:
NewBtn.PerformClick();
break;
case Keys.Alt | Keys.C:
CloneScanBtn.PerformClick();
break;
case Keys.Control | Keys.Left:
SplitContainer1.SplitterPanelCollapseExpand(true);
break;
case Keys.Control | Keys.Right:
SplitContainer1.SplitterPanelCollapseExpand(false);
break;
case Keys.Control | Keys.Up:
SplitContainer2.SplitterPanelCollapseExpand(true);
break;
case Keys.Control | Keys.Down:
SplitContainer2.SplitterPanelCollapseExpand(false);
break;
default:
return base.ProcessCmdKey(ref msg, keyData);
}
return true;
}

public void ApplyUI(LanguageJson langJson)
{
try
Expand Down Expand Up @@ -1578,16 +1624,13 @@ private void CompareTypeBox_SelectedIndexChanged(object sender, EventArgs e)
}
}

private void ResumeBtn_Click(object sender, EventArgs e)
{
processStatus = ProcessStatus.Resume;
ComboItem process = (ComboItem)ProcessesBox.SelectedItem;
PS4Tool.AttachDebugger((int)process.Value, (string)process.Text, processStatus);
}
private void ResumeBtn_Click(object sender, EventArgs e) => PauseResume(ProcessStatus.Resume);

private void PauseBtn_Click(object sender, EventArgs e) => PauseResume(ProcessStatus.Pause);

private void PauseBtn_Click(object sender, EventArgs e)
private void PauseResume(ProcessStatus? newStatus = null)
{
processStatus = ProcessStatus.Pause;
processStatus = newStatus != null ? (ProcessStatus)newStatus : (processStatus == ProcessStatus.Pause ? ProcessStatus.Resume : ProcessStatus.Pause);
ComboItem process = (ComboItem)ProcessesBox.SelectedItem;
PS4Tool.AttachDebugger((int)process.Value, (string)process.Text, processStatus);
}
Expand Down
Loading

0 comments on commit e23b866

Please sign in to comment.