Skip to content

Commit

Permalink
Fixed the issue of abnormal occurrences when editing Pointer-type Che…
Browse files Browse the repository at this point in the history
…ats in the main window.

Fixed the issue where saving as JSON in the main window without entering ON and OFF values would result in an error.
  • Loading branch information
avan06 committed Feb 11, 2024
1 parent f303f26 commit fc64b61
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
4 changes: 2 additions & 2 deletions PS4CheaterNeo/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private int ParseCheatMC4(StreamReader reader)
decXml = HttpUtility.HtmlDecode(decXml);
decXml = Regex.Unescape(decXml);
Console.WriteLine(decXml);
count = ParseCheatSHN(decXml);
count = ParseCheatSHN(decXml);
}
return count;
}
Expand Down Expand Up @@ -881,7 +881,7 @@ private void SaveCheatJson()
on = ScanTool.BytesToString(scanType, bytes, true, on.StartsWith("-"));
on = ScanTool.ReverseHexString(on);
}
string off = row.Cells[(int)ChertCol.CheatListOff].ToString();
string off = string.IsNullOrWhiteSpace((string)row.Cells[(int)ChertCol.CheatListOff]) ? on : row.Cells[(int)ChertCol.CheatListOff].ToString();
if (Regex.Match(cheatDesc, @"(.*) *__ *\[ *on: *([0-9a-zA-Z]+) *off: *([0-9a-zA-Z]+)") is Match m1 && m1.Success)
{ //Attempt to restore off value from desc
cheatDesc = m1.Groups[1].Value;
Expand Down
34 changes: 16 additions & 18 deletions PS4CheaterNeo/NewAddress.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,14 @@ public NewAddress(Main mainForm, Section addrSection, Section baseSection, ulong
IsPointer = pointerOffsets != null;

AddressBox.Text = Address.ToString("X");
ScanTypeBox.SelectedIndex = ScanTypeBox.FindStringExact(CheatType.GetDescription());
foreach (ScanType filterEnum in (ScanType[])Enum.GetValues(typeof(ScanType)))
{
if (filterEnum == ScanType.Group) continue;
string scanTypeStr = filterEnum.GetDescription();
ComboItem item = new ComboItem(scanTypeStr, filterEnum);
ScanTypeBox.Items.Add(item);
if (filterEnum == CheatType) ScanTypeBox.SelectedItem = item;
}
ValueBox.Text = Value;
LockBox.Checked = IsLock;
DescriptionBox.Text = Descriptioin;
Expand Down Expand Up @@ -185,22 +192,12 @@ public void ApplyUI(LanguageJson langJson)

private void NewAddress_Load(object sender, EventArgs e)
{
foreach (ScanType filterEnum in (ScanType[])Enum.GetValues(typeof(ScanType)))
{
if (filterEnum == ScanType.Group) continue;
string scanTypeStr = filterEnum.GetDescription();
ComboItem item = new ComboItem(scanTypeStr, filterEnum);
ScanTypeBox.Items.Add(item);
if (filterEnum == CheatType) ScanTypeBox.SelectedItem = item;
}
if (PointerOffsets == null || PointerOffsets.Count <= 0) return;

if (PointerOffsets != null && PointerOffsets.Count > 0)
foreach (long offset in PointerOffsets)
{
foreach (long offset in PointerOffsets)
{
AddOffsetBtn.PerformClick();
TableLayoutBottomBox.Controls[TableLayoutBottomBox.Controls.Count - 1].Text = offset.ToString("X");
}
AddOffsetBtn.PerformClick();
TableLayoutBottomBox.Controls[TableLayoutBottomBox.Controls.Count - 1].Text = offset.ToString("X");
}
}

Expand Down Expand Up @@ -341,8 +338,7 @@ private void SetOffsetBoxs(bool isAdd)
Margin = new Padding(3, 6, 3, 3),
ReadOnly = true,
BorderStyle = BorderStyle.None,
};
PointerOffsets.Add(0);
};
TableLayoutBottomBox.RowCount += 1;
TableLayoutBottomBox.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
TableLayoutBottomBox.Controls.Add(textBox, 0, TableLayoutBottomBox.Controls.Count);
Expand Down Expand Up @@ -377,6 +373,7 @@ private void ScanTypeBox_SelectedIndexChanged(object sender, EventArgs e)
ScanTypeBox.SelectedIndex = ScanTypeBox.FindStringExact(CheatType.GetDescription());
return;
}
else if (CheatType == ScanType.Hex && newCheatType == ScanType.Hex) return;
else if (newCheatType == ScanType.String_) return;

try
Expand Down Expand Up @@ -438,7 +435,8 @@ private void RefreshPointerChecker_Tick(object sender, EventArgs e)

if (BaseSection == null) break;

PointerOffsets[idx] = address;
if (TableLayoutBottomBox.Controls.Count > PointerOffsets.Count) PointerOffsets.Add(address);
else PointerOffsets[idx] = address;

if (idx != TableLayoutBottomBox.Controls.Count - 1)
{
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.2")]
[assembly: AssemblyFileVersion("1.0.2.2")]
[assembly: AssemblyVersion("1.0.2.3")]
[assembly: AssemblyFileVersion("1.0.2.3")]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PS4CheaterNeo is a program to find game cheat codes, and it is based on [`ps4debug`](https://github.com/jogolden/ps4debug) and [`.Net Framework 4.8`](https://support.microsoft.com/en-us/topic/microsoft-net-framework-4-8-offline-installer-for-windows-9d23f658-3b97-68ab-d013-aa3c3e7495e0).

Currently in `version 1.0.2.2`
Currently in `version 1.0.2.3`


## Table of Contents
Expand Down

0 comments on commit fc64b61

Please sign in to comment.