Skip to content

Commit fc64b61

Browse files
committed
Fixed the issue of abnormal occurrences when editing Pointer-type Cheats 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.
1 parent f303f26 commit fc64b61

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

PS4CheaterNeo/Main.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ private int ParseCheatMC4(StreamReader reader)
663663
decXml = HttpUtility.HtmlDecode(decXml);
664664
decXml = Regex.Unescape(decXml);
665665
Console.WriteLine(decXml);
666-
count = ParseCheatSHN(decXml);
666+
count = ParseCheatSHN(decXml);
667667
}
668668
return count;
669669
}
@@ -881,7 +881,7 @@ private void SaveCheatJson()
881881
on = ScanTool.BytesToString(scanType, bytes, true, on.StartsWith("-"));
882882
on = ScanTool.ReverseHexString(on);
883883
}
884-
string off = row.Cells[(int)ChertCol.CheatListOff].ToString();
884+
string off = string.IsNullOrWhiteSpace((string)row.Cells[(int)ChertCol.CheatListOff]) ? on : row.Cells[(int)ChertCol.CheatListOff].ToString();
885885
if (Regex.Match(cheatDesc, @"(.*) *__ *\[ *on: *([0-9a-zA-Z]+) *off: *([0-9a-zA-Z]+)") is Match m1 && m1.Success)
886886
{ //Attempt to restore off value from desc
887887
cheatDesc = m1.Groups[1].Value;

PS4CheaterNeo/NewAddress.cs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@ public NewAddress(Main mainForm, Section addrSection, Section baseSection, ulong
107107
IsPointer = pointerOffsets != null;
108108

109109
AddressBox.Text = Address.ToString("X");
110-
ScanTypeBox.SelectedIndex = ScanTypeBox.FindStringExact(CheatType.GetDescription());
110+
foreach (ScanType filterEnum in (ScanType[])Enum.GetValues(typeof(ScanType)))
111+
{
112+
if (filterEnum == ScanType.Group) continue;
113+
string scanTypeStr = filterEnum.GetDescription();
114+
ComboItem item = new ComboItem(scanTypeStr, filterEnum);
115+
ScanTypeBox.Items.Add(item);
116+
if (filterEnum == CheatType) ScanTypeBox.SelectedItem = item;
117+
}
111118
ValueBox.Text = Value;
112119
LockBox.Checked = IsLock;
113120
DescriptionBox.Text = Descriptioin;
@@ -185,22 +192,12 @@ public void ApplyUI(LanguageJson langJson)
185192

186193
private void NewAddress_Load(object sender, EventArgs e)
187194
{
188-
foreach (ScanType filterEnum in (ScanType[])Enum.GetValues(typeof(ScanType)))
189-
{
190-
if (filterEnum == ScanType.Group) continue;
191-
string scanTypeStr = filterEnum.GetDescription();
192-
ComboItem item = new ComboItem(scanTypeStr, filterEnum);
193-
ScanTypeBox.Items.Add(item);
194-
if (filterEnum == CheatType) ScanTypeBox.SelectedItem = item;
195-
}
195+
if (PointerOffsets == null || PointerOffsets.Count <= 0) return;
196196

197-
if (PointerOffsets != null && PointerOffsets.Count > 0)
197+
foreach (long offset in PointerOffsets)
198198
{
199-
foreach (long offset in PointerOffsets)
200-
{
201-
AddOffsetBtn.PerformClick();
202-
TableLayoutBottomBox.Controls[TableLayoutBottomBox.Controls.Count - 1].Text = offset.ToString("X");
203-
}
199+
AddOffsetBtn.PerformClick();
200+
TableLayoutBottomBox.Controls[TableLayoutBottomBox.Controls.Count - 1].Text = offset.ToString("X");
204201
}
205202
}
206203

@@ -341,8 +338,7 @@ private void SetOffsetBoxs(bool isAdd)
341338
Margin = new Padding(3, 6, 3, 3),
342339
ReadOnly = true,
343340
BorderStyle = BorderStyle.None,
344-
};
345-
PointerOffsets.Add(0);
341+
};
346342
TableLayoutBottomBox.RowCount += 1;
347343
TableLayoutBottomBox.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
348344
TableLayoutBottomBox.Controls.Add(textBox, 0, TableLayoutBottomBox.Controls.Count);
@@ -377,6 +373,7 @@ private void ScanTypeBox_SelectedIndexChanged(object sender, EventArgs e)
377373
ScanTypeBox.SelectedIndex = ScanTypeBox.FindStringExact(CheatType.GetDescription());
378374
return;
379375
}
376+
else if (CheatType == ScanType.Hex && newCheatType == ScanType.Hex) return;
380377
else if (newCheatType == ScanType.String_) return;
381378

382379
try
@@ -438,7 +435,8 @@ private void RefreshPointerChecker_Tick(object sender, EventArgs e)
438435

439436
if (BaseSection == null) break;
440437

441-
PointerOffsets[idx] = address;
438+
if (TableLayoutBottomBox.Controls.Count > PointerOffsets.Count) PointerOffsets.Add(address);
439+
else PointerOffsets[idx] = address;
442440

443441
if (idx != TableLayoutBottomBox.Controls.Count - 1)
444442
{

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.2")]
36-
[assembly: AssemblyFileVersion("1.0.2.2")]
35+
[assembly: AssemblyVersion("1.0.2.3")]
36+
[assembly: AssemblyFileVersion("1.0.2.3")]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
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).
44

5-
Currently in `version 1.0.2.2`
5+
Currently in `version 1.0.2.3`
66

77

88
## Table of Contents

0 commit comments

Comments
 (0)