diff --git a/PS4_Cheater/CheatList.cs b/PS4_Cheater/CheatList.cs
index 3556fca..e11e8fb 100644
--- a/PS4_Cheater/CheatList.cs
+++ b/PS4_Cheater/CheatList.cs
@@ -59,7 +59,6 @@ public static CheatType GetCheatTypeByValueType(ValueType Type)
default:
throw new ArgumentException("Unkown value type.");
}
- return CheatType.NONE_TYPE;
}
public virtual void Refresh()
@@ -97,7 +96,7 @@ public override string Value {
set {
value_ = value;
MemoryHelper memoryHelper = new MemoryHelper();
- memoryHelper.InitMemoryHandler(Type, CompareType.NONE);
+ memoryHelper.InitMemoryHandler(Type, CompareType.NONE, false);
memoryHelper.SetBytesByType(ulong.Parse(Address, NumberStyles.HexNumber), memoryHelper.StringToBytes(value_));
}
}
@@ -151,7 +150,7 @@ public override bool Load(string[] elements, ProcessManager processManager)
Description = elements[CHEAT_CODE_DATA_TYPE_DESCRIPTION];
- Value = elements[CHEAT_CODE_DATA_TYPE_VALUE];
+ value_ = elements[CHEAT_CODE_DATA_TYPE_VALUE];
return true;
}
@@ -174,7 +173,7 @@ public override string Save()
public override void Refresh()
{
MemoryHelper memoryHelper = new MemoryHelper();
- memoryHelper.InitMemoryHandler(Type, CompareType.NONE);
+ memoryHelper.InitMemoryHandler(Type, CompareType.NONE, false);
memoryHelper.SetBytesByType(ulong.Parse(Address, NumberStyles.HexNumber), memoryHelper.StringToBytes(value_));
value_ = memoryHelper.BytesToString(memoryHelper.GetBytesByType(ulong.Parse(Address, NumberStyles.HexNumber)));
@@ -246,7 +245,7 @@ public override bool Load(string[] elements, ProcessManager processManager)
processManager.MappedSectionList[sectionID].Start).ToString("X2");
Type = MemoryHelper.GetValueTypeByString(elements[CHEAT_CODE_HEX_TYPE_VALUE_TYPE]);
- Value = elements[CHEAT_CODE_HEX_TYPE_VALUE];
+ value_ = elements[CHEAT_CODE_HEX_TYPE_VALUE];
ulong flag = ulong.Parse(elements[CHEAT_CODE_HEX_TYPE_FLAG], NumberStyles.HexNumber);
diff --git a/PS4_Cheater/HexEdit.Designer.cs b/PS4_Cheater/HexEdit.Designer.cs
deleted file mode 100644
index f12d5fe..0000000
--- a/PS4_Cheater/HexEdit.Designer.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-namespace PS4_Cheater
-{
- using System.Drawing;
- using System.Windows.Forms;
- partial class HexEdit
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.hexBox = new Be.Windows.Forms.HexBox();
- this.previous_btn = new System.Windows.Forms.Button();
- this.next_btn = new System.Windows.Forms.Button();
- this.msg = new System.Windows.Forms.Label();
- this.page_list = new System.Windows.Forms.ComboBox();
- this.commit_btn = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // hexBox
- //
- this.hexBox.Dock = System.Windows.Forms.DockStyle.Left;
- this.hexBox.Font = new System.Drawing.Font("Segoe UI", 9F);
- this.hexBox.LineInfoVisible = true;
- this.hexBox.Location = new System.Drawing.Point(0, 0);
- this.hexBox.Name = "hexBox";
- this.hexBox.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
- this.hexBox.ShadowSelectionVisible = false;
- this.hexBox.Size = new System.Drawing.Size(652, 581);
- this.hexBox.StringViewVisible = true;
- this.hexBox.TabIndex = 0;
- this.hexBox.UseFixedBytesPerLine = true;
- this.hexBox.VScrollBarVisible = true;
- //
- // previous_btn
- //
- this.previous_btn.Location = new System.Drawing.Point(658, 45);
- this.previous_btn.Name = "previous_btn";
- this.previous_btn.Size = new System.Drawing.Size(113, 23);
- this.previous_btn.TabIndex = 1;
- this.previous_btn.Text = "Previous";
- this.previous_btn.UseVisualStyleBackColor = true;
- this.previous_btn.Click += new System.EventHandler(this.previous_btn_Click);
- //
- // next_btn
- //
- this.next_btn.Location = new System.Drawing.Point(658, 87);
- this.next_btn.Name = "next_btn";
- this.next_btn.Size = new System.Drawing.Size(113, 23);
- this.next_btn.TabIndex = 2;
- this.next_btn.Text = "Next";
- this.next_btn.UseVisualStyleBackColor = true;
- this.next_btn.Click += new System.EventHandler(this.next_btn_Click);
- //
- // msg
- //
- this.msg.AutoSize = true;
- this.msg.Location = new System.Drawing.Point(656, 531);
- this.msg.Name = "msg";
- this.msg.Size = new System.Drawing.Size(0, 12);
- this.msg.TabIndex = 3;
- //
- // page_list
- //
- this.page_list.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.page_list.FormattingEnabled = true;
- this.page_list.Location = new System.Drawing.Point(660, 133);
- this.page_list.Name = "page_list";
- this.page_list.Size = new System.Drawing.Size(111, 20);
- this.page_list.TabIndex = 4;
- this.page_list.SelectedIndexChanged += new System.EventHandler(this.page_list_SelectedIndexChanged);
- //
- // commit_btn
- //
- this.commit_btn.Location = new System.Drawing.Point(660, 199);
- this.commit_btn.Name = "commit_btn";
- this.commit_btn.Size = new System.Drawing.Size(111, 23);
- this.commit_btn.TabIndex = 9;
- this.commit_btn.Text = "Commit";
- this.commit_btn.UseVisualStyleBackColor = true;
- this.commit_btn.Click += new System.EventHandler(this.commit_btn_Click);
- //
- // HexEdit
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(777, 581);
- this.Controls.Add(this.commit_btn);
- this.Controls.Add(this.page_list);
- this.Controls.Add(this.msg);
- this.Controls.Add(this.next_btn);
- this.Controls.Add(this.previous_btn);
- this.Controls.Add(this.hexBox);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
- this.Name = "HexEdit";
- this.Text = "HexEditor";
- this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HexEdit_FormClosing);
- this.Load += new System.EventHandler(this.HexEdit_Load);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
-
- private Be.Windows.Forms.HexBox hexBox;
- private Button previous_btn;
- private Button next_btn;
- private Label msg;
- private ComboBox page_list;
- private Button commit_btn;
- }
-}
\ No newline at end of file
diff --git a/PS4_Cheater/HexEditor.Designer.cs b/PS4_Cheater/HexEditor.Designer.cs
new file mode 100644
index 0000000..7980c95
--- /dev/null
+++ b/PS4_Cheater/HexEditor.Designer.cs
@@ -0,0 +1,170 @@
+namespace PS4_Cheater
+{
+ using System.Drawing;
+ using System.Windows.Forms;
+ partial class HexEditor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.hexBox = new Be.Windows.Forms.HexBox();
+ this.refresh_btn = new System.Windows.Forms.Button();
+ this.previous_btn = new System.Windows.Forms.Button();
+ this.commit_btn = new System.Windows.Forms.Button();
+ this.next_btn = new System.Windows.Forms.Button();
+ this.page_list = new System.Windows.Forms.ComboBox();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.hexBox);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.refresh_btn);
+ this.splitContainer1.Panel2.Controls.Add(this.previous_btn);
+ this.splitContainer1.Panel2.Controls.Add(this.commit_btn);
+ this.splitContainer1.Panel2.Controls.Add(this.next_btn);
+ this.splitContainer1.Panel2.Controls.Add(this.page_list);
+ this.splitContainer1.Size = new System.Drawing.Size(825, 581);
+ this.splitContainer1.SplitterDistance = 623;
+ this.splitContainer1.TabIndex = 4;
+ //
+ // hexBox
+ //
+ this.hexBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.hexBox.Font = new System.Drawing.Font("Segoe UI", 9F);
+ this.hexBox.LineInfoVisible = true;
+ this.hexBox.Location = new System.Drawing.Point(0, 0);
+ this.hexBox.Name = "hexBox";
+ this.hexBox.ShadowSelectionColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(60)))), ((int)(((byte)(188)))), ((int)(((byte)(255)))));
+ this.hexBox.ShadowSelectionVisible = false;
+ this.hexBox.Size = new System.Drawing.Size(623, 581);
+ this.hexBox.StringViewVisible = true;
+ this.hexBox.TabIndex = 11;
+ this.hexBox.UseFixedBytesPerLine = true;
+ this.hexBox.VScrollBarVisible = true;
+ //
+ // refresh_btn
+ //
+ this.refresh_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.refresh_btn.Location = new System.Drawing.Point(15, 154);
+ this.refresh_btn.Name = "refresh_btn";
+ this.refresh_btn.Size = new System.Drawing.Size(160, 25);
+ this.refresh_btn.TabIndex = 16;
+ this.refresh_btn.Text = "Refresh";
+ this.refresh_btn.UseVisualStyleBackColor = true;
+ this.refresh_btn.Click += new System.EventHandler(this.refresh_btn_Click);
+ //
+ // previous_btn
+ //
+ this.previous_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.previous_btn.Location = new System.Drawing.Point(15, 34);
+ this.previous_btn.Name = "previous_btn";
+ this.previous_btn.Size = new System.Drawing.Size(160, 25);
+ this.previous_btn.TabIndex = 12;
+ this.previous_btn.Text = "Previous";
+ this.previous_btn.UseVisualStyleBackColor = true;
+ this.previous_btn.Click += new System.EventHandler(this.previous_btn_Click);
+ //
+ // commit_btn
+ //
+ this.commit_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.commit_btn.Location = new System.Drawing.Point(15, 194);
+ this.commit_btn.Name = "commit_btn";
+ this.commit_btn.Size = new System.Drawing.Size(160, 25);
+ this.commit_btn.TabIndex = 15;
+ this.commit_btn.Text = "Commit";
+ this.commit_btn.UseVisualStyleBackColor = true;
+ this.commit_btn.Click += new System.EventHandler(this.commit_btn_Click);
+ //
+ // next_btn
+ //
+ this.next_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.next_btn.Location = new System.Drawing.Point(15, 74);
+ this.next_btn.Name = "next_btn";
+ this.next_btn.Size = new System.Drawing.Size(160, 25);
+ this.next_btn.TabIndex = 13;
+ this.next_btn.Text = "Next";
+ this.next_btn.UseVisualStyleBackColor = true;
+ this.next_btn.Click += new System.EventHandler(this.next_btn_Click);
+ //
+ // page_list
+ //
+ this.page_list.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.page_list.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.page_list.FormattingEnabled = true;
+ this.page_list.Location = new System.Drawing.Point(15, 114);
+ this.page_list.Name = "page_list";
+ this.page_list.Size = new System.Drawing.Size(160, 20);
+ this.page_list.TabIndex = 14;
+ this.page_list.SelectedIndexChanged += new System.EventHandler(this.page_list_SelectedIndexChanged);
+ //
+ // HexEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(825, 581);
+ this.Controls.Add(this.splitContainer1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
+ this.Name = "HexEditor";
+ this.Text = "HexEditor";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.HexEdit_FormClosing);
+ this.Load += new System.EventHandler(this.HexEdit_Load);
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private SplitContainer splitContainer1;
+ private Be.Windows.Forms.HexBox hexBox;
+ private Button refresh_btn;
+ private Button previous_btn;
+ private Button commit_btn;
+ private Button next_btn;
+ private ComboBox page_list;
+ }
+}
\ No newline at end of file
diff --git a/PS4_Cheater/HexEdit.cs b/PS4_Cheater/HexEditor.cs
similarity index 65%
rename from PS4_Cheater/HexEdit.cs
rename to PS4_Cheater/HexEditor.cs
index f7903ed..b5e043d 100644
--- a/PS4_Cheater/HexEdit.cs
+++ b/PS4_Cheater/HexEditor.cs
@@ -14,41 +14,39 @@
namespace PS4_Cheater
{
- public partial class HexEdit : Form
+ public partial class HexEditor : Form
{
- public byte[] buffer { get; set; }
- public bool changed { get; set; }
-
private MappedSection section;
private MemoryHelper memoryHelper;
private int page;
private int page_count;
- private int offset;
+ private long line;
const int page_size = 8 * 1024 * 1024;
- public HexEdit(MemoryHelper memoryHelper, int offset, MappedSection section)
+ public HexEditor(MemoryHelper memoryHelper, int offset, MappedSection section)
{
InitializeComponent();
this.memoryHelper = memoryHelper;
this.section = section;
- this.changed = false;
- this.offset = offset;
this.page = offset / page_size;
+ this.line = (offset - page * page_size) / hexBox.BytesPerLine;
this.page_count = divup((int)section.Length, page_size);
for (int i = 0; i < page_count; ++i)
{
- page_list.Items.Add((i + 1).ToString());
+ ulong start = section.Start + (ulong)i * page_size;
+ ulong end = section.Start + (ulong)(i + 1) * page_size;
+ page_list.Items.Add((i + 1).ToString() + String.Format(" {0:X}-{1:X}", start, end));
}
}
- private void update_ui(int page)
+ private void update_ui(int page, long line)
{
- this.hexBox.LineInfoOffset = (uint)((ulong)section.Start + (ulong)(page_size * page));
+ hexBox.LineInfoOffset = (uint)((ulong)section.Start + (ulong)(page_size * page));
int mem_size = page_size;
@@ -57,17 +55,21 @@ private void update_ui(int page)
mem_size = section.Length - page_size * page;
}
- msg.Text = "page:" + (page + 1) + "/" + page_count;
- byte[] dst = new byte[mem_size];
- Buffer.BlockCopy(buffer, page * page_size, dst, 0, mem_size);
+ byte[] dst = MemoryHelper.ReadMemory(section.Start + (ulong)page * page_size, (int)mem_size);
hexBox.ByteProvider = new MemoryViewByteProvider(dst);
+
+ if (line != 0)
+ {
+ hexBox.SelectionStart = line * hexBox.BytesPerLine;
+ hexBox.SelectionLength = 0;
+ hexBox.Focus();
+ //hexBox.ScrollToCaret();
+ }
}
private void HexEdit_Load(object sender, EventArgs e)
{
- this.hexBox.LineInfoOffset = (uint)section.Start;
- this.buffer = MemoryHelper.ReadMemory(section.Start, (int)section.Length);
- update_ui(page);
+ page_list.SelectedIndex = page;
}
private void HexEdit_FormClosing(object sender, FormClosingEventArgs e)
@@ -88,8 +90,9 @@ private void next_btn_Click(object sender, EventArgs e)
}
page++;
+ line = 0;
- update_ui(page);
+ page_list.SelectedIndex = page;
}
private void previous_btn_Click(object sender, EventArgs e)
@@ -100,15 +103,15 @@ private void previous_btn_Click(object sender, EventArgs e)
}
page--;
-
- update_ui(page);
+ line = 0;
+ page_list.SelectedIndex = page;
}
private void page_list_SelectedIndexChanged(object sender, EventArgs e)
{
page = page_list.SelectedIndex;
- update_ui(page);
+ update_ui(page, line);
}
private void commit_btn_Click(object sender, EventArgs e)
@@ -128,5 +131,12 @@ private void commit_btn_Click(object sender, EventArgs e)
mvbp.change_list.Clear();
}
}
+
+ private void refresh_btn_Click(object sender, EventArgs e)
+ {
+ page_list.SelectedIndex = page;
+ line = hexBox.CurrentLine - 1;
+ update_ui(page, line);
+ }
}
}
diff --git a/PS4_Cheater/HexEdit.resx b/PS4_Cheater/HexEditor.resx
similarity index 100%
rename from PS4_Cheater/HexEdit.resx
rename to PS4_Cheater/HexEditor.resx
diff --git a/PS4_Cheater/MemoryHelper.cs b/PS4_Cheater/MemoryHelper.cs
index a0cb76d..a7544ed 100644
--- a/PS4_Cheater/MemoryHelper.cs
+++ b/PS4_Cheater/MemoryHelper.cs
@@ -13,11 +13,14 @@ public enum CompareType
EXACT_VALUE,
FUZZY_VALUE,
INCREASED_VALUE,
+ INCREASED_VALUE_BY,
DECREASED_VALUE,
+ DECREASED_VALUE_BY,
BIGGER_THAN_VALUE,
SMALLER_THAN_VALUE,
CHANGED_VALUE,
UNCHANGED_VALUE,
+ BETWEEN_VALUE,
UNKNOWN_INITIAL_VALUE,
NONE,
}
@@ -56,12 +59,8 @@ public static bool Connect(string ip)
public delegate string BytesToStringHandler(Byte[] value);
public delegate Byte[] StringToBytesHandler(string value);
public delegate Byte[] GetBytesByTypeHandler(ulong address);
- public delegate void CompareWithFilterListHandler(Byte[] match_value, ulong address, byte[] mem,
- AddressList filtered_lists);
public delegate void SetBytesByTypeHandler(ulong address, byte[] value);
- public delegate ulong BytesToUlongHandler(byte[] value);
- public delegate byte[] UlongToBytesHandler(ulong value);
- public delegate bool CompareHandler(Byte[] match_value, Byte[] value);
+ public delegate bool ComparatorHandler(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value);
CompareType cur_compare_type = CompareType.UNCHANGED_VALUE;
@@ -69,43 +68,71 @@ public delegate void CompareWithFilterListHandler(Byte[] match_value, ulong addr
public SetBytesByTypeHandler SetBytesByType { get; set; }
public BytesToStringHandler BytesToString { get; set; }
public StringToBytesHandler StringToBytes { get; set; }
- public BytesToUlongHandler BytesToUlong { get; set; }
- public UlongToBytesHandler UlongToBytes { get; set; }
- public CompareHandler Compare { get; set; }
+ public ComparatorHandler Comparer { get; set; }
- public CompareHandler CompareInFilter { get; set; }
-
- public CompareWithFilterListHandler CompareWithFilterList { get; set; }
+ public int Length { get; set; }
+ public int Alignment { get; set; }
public static byte[] ReadMemory(ulong address, int length)
{
mutex.WaitOne();
- byte[] buf = ps4.ReadMemory(ProcessID, address, length);
- mutex.ReleaseMutex();
- return buf;
+ try
+ {
+ byte[] buf = ps4.ReadMemory(ProcessID, address, length);
+ mutex.ReleaseMutex();
+ return buf;
+ }
+ catch
+ {
+ mutex.ReleaseMutex();
+ }
+ return new byte[1];
}
public static void WriteMemory(ulong address, byte[] data)
{
mutex.WaitOne();
- ps4.WriteMemory(ProcessID, address, data);
- mutex.ReleaseMutex();
+ try
+ {
+ ps4.WriteMemory(ProcessID, address, data);
+ mutex.ReleaseMutex();
+ }
+ catch
+ {
+ mutex.ReleaseMutex();
+ }
}
public static ProcessList GetProcessList()
{
mutex.WaitOne();
- ProcessList processList = ps4.GetProcessList();
- mutex.ReleaseMutex();
- return processList;
+ try
+ {
+ ProcessList processList = ps4.GetProcessList();
+ mutex.ReleaseMutex();
+ return processList;
+ }
+ catch
+ {
+ mutex.ReleaseMutex();
+ }
+ return null;
}
public static ProcessInfo GetProcessInfo(int processID)
{
mutex.WaitOne();
- ProcessInfo processInfo = ps4.GetProcessInfo(processID);
- mutex.ReleaseMutex();
- return processInfo;
+ try
+ {
+ ProcessInfo processInfo = ps4.GetProcessInfo(processID);
+ mutex.ReleaseMutex();
+ return processInfo;
+ }
+ catch
+ {
+ mutex.ReleaseMutex();
+ return null;
+ }
}
public static string double_to_string(Byte[] value)
{
@@ -146,17 +173,11 @@ public static string bytes_to_hex_string(byte[] bytes)
public static byte[] string_to_double(string value)
{
- byte[] data = BitConverter.GetBytes(double.Parse(value));
- byte[] ret = new byte[8];
- Buffer.BlockCopy(data, 0, ret, 0, 8);
- return ret;
+ return BitConverter.GetBytes(double.Parse(value));
}
public static byte[] string_to_float(string value)
{
- byte[] data = BitConverter.GetBytes(float.Parse(value));
- byte[] ret = new byte[8];
- Buffer.BlockCopy(data, 0, ret, 0, 4);
- return ret;
+ return BitConverter.GetBytes(float.Parse(value));
}
public static byte[] string_to_8_bytes(string value)
{
@@ -165,16 +186,16 @@ public static byte[] string_to_8_bytes(string value)
public static byte[] string_to_4_bytes(string value)
{
- return BitConverter.GetBytes(ulong.Parse(value));
+ return BitConverter.GetBytes(uint.Parse(value));
}
public static byte[] string_to_2_bytes(string value)
{
- return BitConverter.GetBytes(ulong.Parse(value));
+ return BitConverter.GetBytes(UInt16.Parse(value));
}
public static byte[] string_to_1_byte(string value)
{
- return BitConverter.GetBytes(ulong.Parse(value));
+ return BitConverter.GetBytes(Byte.Parse(value));
}
public static byte[] string_to_hex(string hexString)
{
@@ -189,253 +210,427 @@ public static byte[] string_to_hex(string hexString)
byte[] get_bytes_8_bytes(ulong address)
{
- byte[] buffer = new byte[8];
- buffer = ReadMemory(address, 8);
- return buffer;
+ return ReadMemory(address, 8);
}
byte[] get_bytes_4_bytes(ulong address)
{
- byte[] buffer = new byte[4];
- buffer = ReadMemory(address, 4);
- return buffer;
+ return ReadMemory(address, 4);
}
byte[] get_bytes_2_bytes(ulong address)
{
- byte[] buffer = new byte[2];
- buffer = ReadMemory(address, 2);
- return buffer;
+ return ReadMemory(address, 2);
}
byte[] get_bytes_1_byte(ulong address)
{
- byte[] buffer = new byte[1];
- buffer = ReadMemory(address, 1);
- return buffer;
+ return ReadMemory(address, 1);
+ }
+
+ void set_bytes_hex(ulong address, byte[] data)
+ {
+ WriteMemory(address, data);
}
- public static ulong bytes_to_8_bytes(byte[] bytes)
+ void set_bytes_8_bytes(ulong address, byte[] data)
{
- return BitConverter.ToUInt64(bytes, 0);
+ WriteMemory(address, data);
}
- public static ulong bytes_to_4_bytes(byte[] bytes)
+ void set_bytes_4_bytes(ulong address, byte[] data)
{
- return BitConverter.ToUInt32(bytes, 0);
+ WriteMemory(address, data);
+ }
+ void set_bytes_2_bytes(ulong address, byte[] data)
+ {
+ WriteMemory(address, data);
+ }
+ void set_bytes_1_byte(ulong address, byte[] data)
+ {
+ WriteMemory(address, data);
}
- public static ulong bytes_to_2_bytes(byte[] bytes)
+ public void CompareWithMemoryBufferNextScanner(byte[] default_value_0, byte[] default_value_1, byte[] buffer,
+ AddressList old_address_list, AddressList new_address_list)
{
- return BitConverter.ToUInt16(bytes, 0);
+ int alignment = Alignment;
+ int length = Length;
+
+ Byte[] new_value = new byte[length];
+ for (old_address_list.Begin(); !old_address_list.End(); old_address_list.Next())
+ {
+ uint address_offset = 0;
+ Byte[] old_value = null;
+ old_address_list.Get(ref address_offset, ref old_value);
+ Buffer.BlockCopy(buffer, (int)address_offset, new_value, 0, length);
+ if (Comparer(default_value_0, default_value_1, old_value, new_value))
+ {
+ new_address_list.Add(address_offset, new_value);
+ }
+ }
}
- public static ulong bytes_to_1_byte(byte[] bytes)
+ public void CompareWithMemoryBufferNewScanner(byte[] default_value_0, byte[] default_value_1, byte[] buffer,
+ AddressList old_address_list, AddressList new_address_list)
{
- return bytes[0];
+ int alignment = Alignment;
+ int length = Length;
+
+ Byte[] new_value = new byte[length];
+ Byte[] dummy_value = new byte[length];
+ for (int i = 0; i + length < buffer.LongLength; i += alignment)
+ {
+ Buffer.BlockCopy(buffer, i, new_value, 0, length);
+ if (Comparer(default_value_0, default_value_1, dummy_value, new_value))
+ {
+ new_address_list.Add((uint)i, new_value);
+ }
+ }
}
- public static byte[] ulong_to_8_bytes(ulong value)
+ bool scan_type_any_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.GetBytes(value);
+ return BitConverter.ToUInt64(new_value, 0) != 0 ? true : false;
}
- public static byte[] ulong_to_4_bytes(ulong value)
+ bool scan_type_between_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.GetBytes(value);
+ return BitConverter.ToUInt64(new_value, 0) <= BitConverter.ToUInt64(default_value_1, 0) &&
+ BitConverter.ToUInt64(new_value, 0) >= BitConverter.ToUInt64(default_value_0, 0);
}
- public static byte[] ulong_to_2_bytes(ulong value)
+ bool scan_type_increased_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(new_value, 0) > BitConverter.ToUInt64(old_value, 0);
+ }
+ bool scan_type_increased_by_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.GetBytes(value);
+ return BitConverter.ToUInt64(new_value, 0) ==
+ BitConverter.ToUInt64(old_value, 0) + BitConverter.ToUInt64(default_value_0, 0);
}
- public static byte[] ulong_to_1_byte(ulong value)
+ bool scan_type_bigger_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.GetBytes(value);
+ return BitConverter.ToUInt64(new_value, 0) > BitConverter.ToUInt64(default_value_0, 0);
+ }
+ bool scan_type_decreased_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(new_value, 0) < BitConverter.ToUInt64(old_value, 0);
}
- void set_bytes_hex(ulong address, byte[] value)
+ bool scan_type_decreased_by_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- WriteMemory(address, value);
+ return BitConverter.ToUInt64(new_value, 0) ==
+ BitConverter.ToUInt64(old_value, 0) - BitConverter.ToUInt64(default_value_0, 0);
}
- void set_bytes_8_bytes(ulong address, byte[] value)
+ bool scan_type_less_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- byte[] data = new byte[8];
- Buffer.BlockCopy(value, 0, data, 0, 8);
- WriteMemory(address, data);
+ return BitConverter.ToUInt64(new_value, 0) < BitConverter.ToUInt64(default_value_0, 0);
}
+ bool scan_type_unchanged_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(old_value, 0) == BitConverter.ToUInt64(new_value, 0);
+ }
+ bool scan_type_equal_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(default_value_0, 0) == BitConverter.ToUInt64(new_value, 0);
+ }
+ bool scan_type_changed_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(old_value, 0) != BitConverter.ToUInt64(new_value, 0);
+ }
+ bool scan_type_not_ulong(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt64(default_value_0, 0) != BitConverter.ToUInt64(new_value, 0);
+ }
+
- void set_bytes_4_bytes(ulong address, byte[] value)
+ bool scan_type_any_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- byte[] data = new byte[4];
- Buffer.BlockCopy(value, 0, data, 0, 4);
- WriteMemory(address, data);
+ return BitConverter.ToUInt32(new_value, 0) != 0 ? true : false;
}
- void set_bytes_2_bytes(ulong address, byte[] value)
+
+ bool scan_type_between_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- byte[] data = new byte[2];
- Buffer.BlockCopy(value, 0, data, 0, 2);
- WriteMemory(address, data);
+ return BitConverter.ToUInt32(new_value, 0) <= BitConverter.ToUInt32(default_value_1, 0) &&
+ BitConverter.ToUInt32(new_value, 0) >= BitConverter.ToUInt32(default_value_0, 0);
+ }
+
+ bool scan_type_increased_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(new_value, 0) > BitConverter.ToUInt32(old_value, 0);
}
- void set_bytes_1_byte(ulong address, byte[] value)
+ bool scan_type_increased_by_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- byte[] data = new byte[1];
- Buffer.BlockCopy(value, 0, data, 0, 1);
- WriteMemory(address, data);
+ return BitConverter.ToUInt32(new_value, 0) ==
+ BitConverter.ToUInt32(old_value, 0) + BitConverter.ToUInt32(default_value_0, 0);
+ }
+ bool scan_type_bigger_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(new_value, 0) > BitConverter.ToUInt32(default_value_0, 0);
+ }
+ bool scan_type_decreased_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(new_value, 0) < BitConverter.ToUInt32(old_value, 0);
}
- void compare_with_filter_list_8_bytes(byte[] match_value, ulong address, byte[] mem, AddressList filtered_list)
+ bool scan_type_decreased_by_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- Byte[] bytes = new byte[8];
- for (int i = 0; i + 8 < mem.LongLength; i += 4)
- {
- Buffer.BlockCopy(mem, i, bytes, 0, 8);
- if (CompareInFilter(match_value, bytes))
- {
- Address addr = new Address();
- addr.AddressOffset = (uint)i;
- addr.MemoryValue = BytesToUlong(bytes);
- filtered_list.Add(addr);
- }
- }
+ return BitConverter.ToUInt32(new_value, 0) ==
+ BitConverter.ToUInt32(old_value, 0) - BitConverter.ToUInt32(default_value_0, 0);
}
- void compare_with_filter_list_4_bytes(byte[] match_value, ulong address, byte[] mem, AddressList filtered_list)
+ bool scan_type_less_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- Byte[] bytes = new byte[8];
- for (int i = 0; i + 4 < mem.LongLength; i += 4)
- {
- Buffer.BlockCopy(mem, i, bytes, 0, 4);
- if (CompareInFilter(match_value, bytes))
- {
- Address addr = new Address();
- addr.AddressOffset = (uint)i;
- addr.MemoryValue = BytesToUlong(bytes);
- filtered_list.Add(addr);
- }
- }
+ return BitConverter.ToUInt32(new_value, 0) < BitConverter.ToUInt32(default_value_0, 0);
}
- void compare_with_filter_list_2_bytes(byte[] match_value, ulong address, byte[] mem, AddressList filtered_list)
+ bool scan_type_unchanged_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- Byte[] bytes = new byte[8];
- for (int i = 0; i + 2 < mem.LongLength; i += 2)
- {
- Buffer.BlockCopy(mem, i, bytes, 0, 2);
- if (CompareInFilter(match_value, bytes))
- {
- Address addr = new Address();
- addr.AddressOffset = (uint)i;
- addr.MemoryValue = BytesToUlong(bytes);
- filtered_list.Add(addr);
- }
- }
+ return BitConverter.ToUInt32(old_value, 0) == BitConverter.ToUInt32(new_value, 0);
+ }
+ bool scan_type_equal_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(default_value_0, 0) == BitConverter.ToUInt32(new_value, 0);
+ }
+ bool scan_type_changed_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(old_value, 0) != BitConverter.ToUInt32(new_value, 0);
+ }
+ bool scan_type_not_uint(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt32(default_value_0, 0) != BitConverter.ToUInt32(new_value, 0);
}
- void compare_with_filter_list_1_byte(byte[] match_value, ulong address, byte[] mem, AddressList filtered_list)
+ bool scan_type_any_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- Byte[] bytes = new byte[8];
- for (int i = 0; i + 1 < mem.LongLength; i += 1)
- {
- Buffer.BlockCopy(mem, i, bytes, 0, 1);
- if (CompareInFilter(match_value, bytes))
- {
- Address addr = new Address();
- addr.AddressOffset = (uint)i;
- addr.MemoryValue = BytesToUlong(bytes);
- filtered_list.Add(addr);
- }
- }
+ return BitConverter.ToUInt16(new_value, 0) != 0 ? true : false;
}
- bool scan_type_any_ulong(byte[] match_value, byte[] value)
+ bool scan_type_between_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToUInt64(value, 0) != 0 ? true : false;
+ return BitConverter.ToUInt16(new_value, 0) <= BitConverter.ToUInt16(default_value_1, 0) &&
+ BitConverter.ToUInt16(new_value, 0) >= BitConverter.ToUInt16(default_value_0, 0);
}
- bool scan_type_bigger_ulong(byte[] match_value, byte[] value)
+ bool scan_type_increased_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(new_value, 0) > BitConverter.ToUInt16(old_value, 0);
+ }
+ bool scan_type_increased_by_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(new_value, 0) ==
+ BitConverter.ToUInt16(old_value, 0) + BitConverter.ToUInt16(default_value_0, 0);
+ }
+ bool scan_type_bigger_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToUInt64(value, 0) > BitConverter.ToUInt64(match_value, 0);
+ return BitConverter.ToUInt16(new_value, 0) > BitConverter.ToUInt16(default_value_0, 0);
}
- bool scan_type_less_ulong(byte[] match_value, byte[] value)
+ bool scan_type_decreased_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToUInt64(value, 0) < BitConverter.ToUInt64(match_value, 0);
+ return BitConverter.ToUInt16(new_value, 0) < BitConverter.ToUInt16(old_value, 0);
}
- bool scan_type_equal_ulong(byte[] match_value, byte[] value)
+ bool scan_type_decreased_by_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToUInt64(value, 0) == BitConverter.ToUInt64(match_value, 0);
+ return BitConverter.ToUInt16(new_value, 0) ==
+ BitConverter.ToUInt16(old_value, 0) - BitConverter.ToUInt16(default_value_0, 0);
}
- bool scan_type_not_ulong(byte[] match_value, byte[] value)
+
+ bool scan_type_less_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(new_value, 0) < BitConverter.ToUInt16(default_value_0, 0);
+ }
+ bool scan_type_unchanged_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToUInt64(value, 0) != BitConverter.ToUInt64(match_value, 0);
+ return BitConverter.ToUInt16(old_value, 0) == BitConverter.ToUInt16(new_value, 0);
+ }
+ bool scan_type_equal_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(default_value_0, 0) == BitConverter.ToUInt16(new_value, 0);
+ }
+ bool scan_type_changed_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(old_value, 0) != BitConverter.ToUInt16(new_value, 0);
+ }
+ bool scan_type_not_uint16(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToUInt16(default_value_0, 0) != BitConverter.ToUInt16(new_value, 0);
}
- bool scan_type_any_double(byte[] match_value, byte[] value)
+ bool scan_type_any_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToDouble(value, 0) != 0 ? true : false;
+ return new_value[0] != 0 ? true : false;
}
- bool scan_type_bigger_double(byte[] match_value, byte[] value)
+
+ bool scan_type_between_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToDouble(value, 0) > BitConverter.ToSingle(match_value, 0);
+ return new_value[0] <= default_value_1[0] &&
+ new_value[0] >= default_value_0[0];
}
- bool scan_type_less_double(byte[] match_value, byte[] value)
+
+ bool scan_type_increased_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToDouble(value, 0) < BitConverter.ToSingle(match_value, 0);
+ return new_value[0] > old_value[0];
}
- bool scan_type_equal_double(byte[] match_value, byte[] value)
+ bool scan_type_increased_by_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return Math.Abs(BitConverter.ToDouble(value, 0) -
- BitConverter.ToDouble(match_value, 0)) < 0.0001;
+ return new_value[0] ==
+ old_value[0] + default_value_0[0];
}
- bool scan_type_fuzzy_equal_double(byte[] match_value, byte[] value)
+ bool scan_type_bigger_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return Math.Abs(BitConverter.ToDouble(value, 0) -
- BitConverter.ToDouble(match_value, 0)) < 1;
+ return new_value[0] > default_value_0[0];
}
- bool scan_type_not_double(byte[] match_value, byte[] value)
+ bool scan_type_decreased_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return !scan_type_equal_double(match_value, value);
+ return new_value[0] < old_value[0];
}
- bool scan_type_any_float(byte[] match_value, byte[] value)
+ bool scan_type_decreased_by_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return new_value[0] ==
+ old_value[0] - default_value_0[0];
+ }
+
+ bool scan_type_less_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return new_value[0] < default_value_0[0];
+ }
+ bool scan_type_unchanged_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return old_value[0] == new_value[0];
+ }
+ bool scan_type_equal_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return default_value_0[0] == new_value[0];
+ }
+ bool scan_type_changed_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return old_value[0] != new_value[0];
+ }
+
+ bool scan_type_not_uint8(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return default_value_0[0] != new_value[0];
+ }
+ bool scan_type_any_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToDouble(new_value, 0) != 0 ? true : false;
+ }
+ bool scan_type_fuzzy_equal_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToDouble(default_value_0, 0) -
+ BitConverter.ToDouble(new_value, 0)) < 1;
+ }
+ bool scan_type_between_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToDouble(new_value, 0) <= BitConverter.ToDouble(default_value_1, 0) &&
+ BitConverter.ToDouble(new_value, 0) >= BitConverter.ToDouble(default_value_0, 0);
+ }
+ bool scan_type_increased_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToSingle(value, 0) != 0 ? true : false;
+ return BitConverter.ToDouble(new_value, 0) > BitConverter.ToDouble(old_value, 0);
}
- bool scan_type_bigger_float(byte[] match_value, byte[] value)
+ bool scan_type_increased_by_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToSingle(value, 0) > BitConverter.ToSingle(match_value, 0);
+ return Math.Abs(BitConverter.ToDouble(new_value, 0) -
+ (BitConverter.ToDouble(default_value_0, 0) + BitConverter.ToDouble(old_value, 0))) < 0.0001;
}
- bool scan_type_less_float(byte[] match_value, byte[] value)
+ bool scan_type_bigger_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return BitConverter.ToSingle(value, 0) < BitConverter.ToSingle(match_value, 0);
+ return BitConverter.ToDouble(new_value, 0) > BitConverter.ToDouble(default_value_0, 0);
}
- bool scan_type_equal_float(byte[] match_value, byte[] value)
+ bool scan_type_decreased_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return Math.Abs(BitConverter.ToSingle(value, 0) -
- BitConverter.ToSingle(match_value, 0)) < 0.0001;
+ return BitConverter.ToDouble(new_value, 0) < BitConverter.ToDouble(old_value, 0);
}
- bool scan_type_fuzzy_equal_float(byte[] match_value, byte[] value)
+ bool scan_type_decreased_by_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return Math.Abs(BitConverter.ToSingle(value, 0) -
- BitConverter.ToSingle(match_value, 0)) < 1;
+ return Math.Abs(BitConverter.ToDouble(new_value, 0) -
+ (BitConverter.ToDouble(old_value, 0) - BitConverter.ToDouble(default_value_0, 0))) < 0.0001;
}
- bool scan_type_not_float(byte[] match_value, byte[] value)
+ bool scan_type_less_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- return !scan_type_equal_float(match_value, value);
+ return BitConverter.ToDouble(new_value, 0) < BitConverter.ToDouble(default_value_0, 0);
+ }
+ bool scan_type_unchanged_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToDouble(old_value, 0) -
+ BitConverter.ToDouble(new_value, 0)) < 0.0001;
+ }
+ bool scan_type_equal_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToDouble(default_value_0, 0) -
+ BitConverter.ToDouble(new_value, 0)) < 0.0001;
+ }
+ bool scan_type_changed_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return !scan_type_unchanged_double(default_value_0, default_value_1, old_value, new_value);
+ }
+ bool scan_type_not_double(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return !scan_type_equal_double(default_value_0, default_value_1, old_value, new_value);
}
- public byte[] GetCompareBytes(Address address, string potential_value)
+ bool scan_type_any_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
{
- byte[] compare_value = StringToBytes(potential_value);
- if (CompareType.UNCHANGED_VALUE == cur_compare_type ||
- CompareType.CHANGED_VALUE == cur_compare_type ||
- CompareType.INCREASED_VALUE == cur_compare_type ||
- CompareType.DECREASED_VALUE == cur_compare_type)
- {
- compare_value = UlongToBytes(address.MemoryValue);
- }
+ return BitConverter.ToSingle(new_value, 0) != 0 ? true : false;
+ }
+ bool scan_type_fuzzy_equal_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToSingle(default_value_0, 0) -
+ BitConverter.ToSingle(new_value, 0)) < 1;
+ }
+ bool scan_type_between_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToSingle(new_value, 0) <= BitConverter.ToSingle(default_value_1, 0) &&
+ BitConverter.ToSingle(new_value, 0) >= BitConverter.ToSingle(default_value_0, 0);
+ }
+ bool scan_type_increased_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToSingle(new_value, 0) > BitConverter.ToSingle(old_value, 0);
+ }
+ bool scan_type_increased_by_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToSingle(new_value, 0) -
+ (BitConverter.ToSingle(default_value_0, 0) + BitConverter.ToSingle(old_value, 0))) < 0.0001;
+ }
+ bool scan_type_bigger_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToSingle(new_value, 0) > BitConverter.ToSingle(default_value_0, 0);
+ }
+ bool scan_type_decreased_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToSingle(new_value, 0) < BitConverter.ToSingle(old_value, 0);
+ }
+ bool scan_type_decreased_by_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToSingle(new_value, 0) -
+ (BitConverter.ToSingle(old_value, 0) - BitConverter.ToSingle(default_value_0, 0))) < 0.0001;
+ }
+ bool scan_type_less_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return BitConverter.ToSingle(new_value, 0) < BitConverter.ToSingle(default_value_0, 0);
+ }
+ bool scan_type_unchanged_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToSingle(old_value, 0) -
+ BitConverter.ToSingle(new_value, 0)) < 0.0001;
+ }
- return compare_value;
+ bool scan_type_equal_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return Math.Abs(BitConverter.ToSingle(default_value_0, 0) -
+ BitConverter.ToSingle(new_value, 0)) < 0.0001;
+ }
+ bool scan_type_changed_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return !scan_type_unchanged_float(default_value_0, default_value_1, old_value, new_value);
+ }
+
+ bool scan_type_not_float(Byte[] default_value_0, Byte[] default_value_1, Byte[] old_value, Byte[] new_value)
+ {
+ return !scan_type_equal_float(default_value_0, default_value_1, old_value, new_value);
}
public static ValueType GetValueTypeByString(string valueType)
@@ -452,7 +647,7 @@ public static ValueType GetValueTypeByString(string valueType)
case "2 bytes":
_valueType = ValueType.USHORT_TYPE;
break;
- case "1 byte":
+ case "byte":
_valueType = ValueType.BYTE_TYPE;
break;
case "double":
@@ -481,7 +676,7 @@ public static string GetStringOfValueType(ValueType valueType)
case ValueType.USHORT_TYPE:
return "2 bytes";
case ValueType.BYTE_TYPE:
- return "1 byte";
+ return "byte";
case ValueType.DOUBLE_TYPE:
return "double";
case ValueType.FLOAT_TYPE:
@@ -493,16 +688,13 @@ public static string GetStringOfValueType(ValueType valueType)
}
}
- public void InitMemoryHandler(string valueType, CompareType compareType)
+ public void InitMemoryHandler(string valueType, CompareType compareType, bool is_alignment)
{
ValueType _valueType = GetValueTypeByString(valueType);
- InitMemoryHandler(_valueType, compareType);
+ InitMemoryHandler(_valueType, compareType, is_alignment);
}
-
- public void InitMemoryHandler(ValueType valueType, CompareType compareType)
+ public void InitMemoryHandler(ValueType valueType, CompareType compareType, bool is_alignment)
{
- bool is_float = false;
- bool is_double = false;
cur_compare_type = compareType;
switch (valueType)
@@ -510,218 +702,356 @@ public void InitMemoryHandler(ValueType valueType, CompareType compareType)
case ValueType.DOUBLE_TYPE:
SetBytesByType = set_bytes_8_bytes;
GetBytesByType = get_bytes_8_bytes;
- CompareWithFilterList = compare_with_filter_list_8_bytes;
BytesToString = double_to_string;
StringToBytes = string_to_double;
- BytesToUlong = bytes_to_8_bytes;
- UlongToBytes = ulong_to_8_bytes;
- is_double = true;
+ Length = sizeof(double);
+ Alignment = (is_alignment) ? 4 : 1;
break;
case ValueType.FLOAT_TYPE:
SetBytesByType = set_bytes_4_bytes;
GetBytesByType = get_bytes_4_bytes;
- CompareWithFilterList = compare_with_filter_list_4_bytes;
BytesToString = float_to_string;
StringToBytes = string_to_float;
- BytesToUlong = bytes_to_4_bytes;
- UlongToBytes = ulong_to_4_bytes;
- is_float = true;
+ Length = sizeof(float);
+ Alignment = (is_alignment) ? 4 : 1;
break;
case ValueType.ULONG_TYPE:
SetBytesByType = set_bytes_8_bytes;
GetBytesByType = get_bytes_8_bytes;
- CompareWithFilterList = compare_with_filter_list_8_bytes;
BytesToString = ulong_to_string;
StringToBytes = string_to_8_bytes;
- BytesToUlong = bytes_to_8_bytes;
- UlongToBytes = ulong_to_8_bytes;
+ Length = sizeof(ulong);
+ Alignment = (is_alignment) ? 4 : 1;
break;
case ValueType.UINT_TYPE:
SetBytesByType = set_bytes_4_bytes;
GetBytesByType = get_bytes_4_bytes;
- CompareWithFilterList = compare_with_filter_list_4_bytes;
BytesToString = uint_to_string;
StringToBytes = string_to_4_bytes;
- BytesToUlong = bytes_to_4_bytes;
- UlongToBytes = ulong_to_4_bytes;
+ Length = sizeof(uint);
+ Alignment = (is_alignment) ? 4 : 1;
break;
case ValueType.USHORT_TYPE:
SetBytesByType = set_bytes_2_bytes;
GetBytesByType = get_bytes_2_bytes;
- CompareWithFilterList = compare_with_filter_list_2_bytes;
BytesToString = ushort_to_string;
StringToBytes = string_to_2_bytes;
- BytesToUlong = bytes_to_2_bytes;
- UlongToBytes = ulong_to_2_bytes;
+ Length = sizeof(ushort);
+ Alignment = (is_alignment) ? 2 : 1;
break;
case ValueType.BYTE_TYPE:
SetBytesByType = set_bytes_1_byte;
GetBytesByType = get_bytes_1_byte;
- CompareWithFilterList = compare_with_filter_list_1_byte;
BytesToString = uchar_to_string;
StringToBytes = string_to_1_byte;
- BytesToUlong = bytes_to_1_byte;
- UlongToBytes = ulong_to_1_byte;
+ Length = sizeof(byte);
+ Alignment = 1;
break;
case ValueType.HEX_TYPE:
SetBytesByType = set_bytes_hex;
GetBytesByType = null;
- CompareWithFilterList = null;
BytesToString = bytes_to_hex_string;
StringToBytes = string_to_2_bytes;
+ Alignment = 1;
break;
default:
break;
}
- switch(compareType)
+ switch (compareType)
{
case CompareType.UNKNOWN_INITIAL_VALUE:
- if (is_float)
+ switch (valueType)
{
- Compare = scan_type_any_float;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_any_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_any_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_any_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_any_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_any_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_any_uint8;
+ break;
+ default:
+ break;
}
- else if (is_double)
- {
- Compare = scan_type_any_double;
- }
- else
- {
- Compare = scan_type_any_ulong;
- }
- CompareInFilter = Compare;
- break;
- case CompareType.EXACT_VALUE:
- if (is_float)
- {
- Compare = scan_type_equal_float;
- }
- else if (is_double)
- {
- Compare = scan_type_equal_double;
- }
- else
- {
- Compare = scan_type_equal_ulong;
- }
- CompareInFilter = Compare;
break;
case CompareType.FUZZY_VALUE:
- if (is_float)
+ switch (valueType)
{
- Compare = scan_type_fuzzy_equal_float;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_equal_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_equal_float;
+ break;
+ default:
+ break;
}
- else if (is_double)
- {
- Compare = scan_type_fuzzy_equal_double;
- }
- else
+ break;
+ case CompareType.EXACT_VALUE:
+ switch (valueType)
{
- Compare = scan_type_equal_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_equal_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_equal_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_equal_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_equal_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_equal_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_equal_uint8;
+ break;
+ default:
+ break;
}
- CompareInFilter = Compare;
break;
case CompareType.CHANGED_VALUE:
- if (is_float)
- {
- Compare = scan_type_not_float;
- CompareInFilter = scan_type_any_float;
- }
- else if (is_double)
- {
- Compare = scan_type_not_double;
- CompareInFilter = scan_type_any_double;
- }
- else
+ switch (valueType)
{
- Compare = scan_type_not_ulong;
- CompareInFilter = scan_type_any_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_changed_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_changed_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_changed_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_changed_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_changed_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_changed_uint8;
+ break;
+ default:
+ break;
}
break;
case CompareType.UNCHANGED_VALUE:
- if (is_float)
- {
- Compare = scan_type_equal_float;
- CompareInFilter = scan_type_any_float;
- }
- else if (is_double)
+ switch (valueType)
{
- Compare = scan_type_equal_double;
- CompareInFilter = scan_type_any_double;
- }
- else
- {
- Compare = scan_type_equal_ulong;
- CompareInFilter = scan_type_any_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_unchanged_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_unchanged_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_unchanged_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_unchanged_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_unchanged_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_unchanged_uint8;
+ break;
+ default:
+ break;
}
break;
case CompareType.INCREASED_VALUE:
- if (is_float)
- {
- Compare = scan_type_bigger_float;
- CompareInFilter = scan_type_any_float;
- }
- else if (is_double)
+ switch (valueType)
{
- Compare = scan_type_bigger_double;
- CompareInFilter = scan_type_any_double;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_increased_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_increased_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_increased_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_increased_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_increased_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_increased_uint8;
+ break;
+ default:
+ break;
}
- else
+ break;
+ case CompareType.INCREASED_VALUE_BY:
+ switch (valueType)
{
- Compare = scan_type_bigger_ulong;
- CompareInFilter = scan_type_any_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_increased_by_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_increased_by_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_increased_by_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_increased_by_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_increased_by_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_increased_by_uint8;
+ break;
+ default:
+ break;
}
break;
case CompareType.DECREASED_VALUE:
- if (is_float)
- {
- Compare = scan_type_less_float;
- CompareInFilter = scan_type_any_float;
- }
- else if (is_double)
+ switch (valueType)
{
- Compare = scan_type_less_double;
- CompareInFilter = scan_type_any_double;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_decreased_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_decreased_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_decreased_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_decreased_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_decreased_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_decreased_uint8;
+ break;
+ default:
+ break;
}
- else
+ break;
+ case CompareType.DECREASED_VALUE_BY:
+ switch (valueType)
{
- Compare = scan_type_less_ulong;
- CompareInFilter = scan_type_any_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_decreased_by_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_decreased_by_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_decreased_by_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_decreased_by_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_decreased_by_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_decreased_by_uint8;
+ break;
+ default:
+ break;
}
break;
case CompareType.BIGGER_THAN_VALUE:
- if (is_float)
- {
- Compare = scan_type_bigger_float;
- }
- else if (is_double)
- {
- Compare = scan_type_bigger_double;
- }
- else
+ switch (valueType)
{
- Compare = scan_type_bigger_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_bigger_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_bigger_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_bigger_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_bigger_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_bigger_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_bigger_uint8;
+ break;
+ default:
+ break;
}
- CompareInFilter = Compare;
break;
case CompareType.SMALLER_THAN_VALUE:
- if (is_float)
+ switch (valueType)
{
- Compare = scan_type_less_float;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_less_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_less_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_less_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_less_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_less_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_less_uint8;
+ break;
+ default:
+ break;
}
- else if (is_double)
- {
- Compare = scan_type_less_double;
- }
- else
+ break;
+ case CompareType.BETWEEN_VALUE:
+ switch (valueType)
{
- Compare = scan_type_less_ulong;
+ case ValueType.DOUBLE_TYPE:
+ Comparer = scan_type_between_double;
+ break;
+ case ValueType.FLOAT_TYPE:
+ Comparer = scan_type_between_float;
+ break;
+ case ValueType.ULONG_TYPE:
+ Comparer = scan_type_between_ulong;
+ break;
+ case ValueType.UINT_TYPE:
+ Comparer = scan_type_between_uint;
+ break;
+ case ValueType.USHORT_TYPE:
+ Comparer = scan_type_between_uint16;
+ break;
+ case ValueType.BYTE_TYPE:
+ Comparer = scan_type_between_uint8;
+ break;
+ default:
+ break;
}
- CompareInFilter = Compare;
break;
default:
break;
+ //throw new Exception("Unknown compare type.");
}
}
}
-}
+}
\ No newline at end of file
diff --git a/PS4_Cheater/NewAddress.Designer.cs b/PS4_Cheater/NewAddress.Designer.cs
index 4426dac..4c953ff 100644
--- a/PS4_Cheater/NewAddress.Designer.cs
+++ b/PS4_Cheater/NewAddress.Designer.cs
@@ -71,7 +71,7 @@ private void InitializeComponent()
this.type_box.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.type_box.FormattingEnabled = true;
this.type_box.Items.AddRange(new object[] {
- "1 byte",
+ "byte",
"2 bytes",
"4 bytes",
"8 bytes",
diff --git a/PS4_Cheater/PS4_Cheater.csproj b/PS4_Cheater/PS4_Cheater.csproj
index 5b32317..dbaa071 100644
--- a/PS4_Cheater/PS4_Cheater.csproj
+++ b/PS4_Cheater/PS4_Cheater.csproj
@@ -108,11 +108,11 @@
-
+
Form
-
- HexEdit.cs
+
+ HexEditor.cs
Form
@@ -133,8 +133,8 @@
-
- HexEdit.cs
+
+ HexEditor.cs
main.cs
diff --git a/PS4_Cheater/ProcessManager.cs b/PS4_Cheater/ProcessManager.cs
index 382c862..366c35c 100644
--- a/PS4_Cheater/ProcessManager.cs
+++ b/PS4_Cheater/ProcessManager.cs
@@ -7,86 +7,193 @@
using librpc;
namespace PS4_Cheater
-{
- [StructLayoutAttribute(LayoutKind.Sequential, Pack = 1)]
- public struct Address
- {
- public uint AddressOffset;
-
- public ulong MemoryValue;
- }
+{
public class AddressList
{
- private List address_list = new List();
+ private const int block_size = 4096 * 16;
+ private List block_list = new List();
+
+ private int block_tag_offset = 0;
+ private int block_tag_elem_count = 0;
+ private int block_id = 0;
+
+ private int count = 0;
+ private int iterator = 0;
+ private int element_size = 0;
+ private int element_alignment = 1;
- public void Add(Address address)
+ private const int OFFSET_SIZE = 4;
+ private const int BIT_MAP_SIZE = 8;
+
+ public AddressList(int element_size, int element_alignment)
{
- address_list.Add(address);
+ block_list.Add(new byte[block_size]);
+ this.element_size = element_size;
+ this.element_alignment = element_alignment;
}
- public void Clear()
+ private int bit_count(ulong data, int end)
{
- address_list.Clear();
+ int sum = 0;
+ for (int i = 0; i <= end; ++i)
+ {
+ if ((data & (1ul << i)) != 0)
+ {
+ ++sum;
+ }
+ }
+ return sum;
}
- public void RemoveAt(int idx)
+ private int bit_position(ulong data, int pos)
{
- address_list.RemoveAt(idx);
+ int sum = 0;
+ for (int i = 0; i <= 64; ++i)
+ {
+ if ((data & (1ul << i)) != 0)
+ {
+ if (sum == pos)
+ {
+ return i;
+ }
+ ++sum;
+ }
+ }
+ return -1;
}
- public Address this[int index]
+ public void Add(uint memoryAddress, byte[] memoryValue)
{
- get
+ int o_block_id = block_id;
+ int o_block_tag_offset = block_tag_offset;
+ int o_block_tag_elem_count = block_tag_elem_count;
+
+ if (memoryValue.Length != element_size)
{
- return address_list[index];
+ throw new Exception("Invalid address!");
}
- set
+
+ byte[] dense_buffer = block_list[block_id];
+ uint address = memoryAddress;
+
+ uint tag_address_offset_base = BitConverter.ToUInt32(dense_buffer, block_tag_offset);
+ ulong bit_map = BitConverter.ToUInt64(dense_buffer, block_tag_offset + OFFSET_SIZE);
+
+ if (tag_address_offset_base > address)
{
- address_list[index] = value;
+ throw new Exception("Invalid address!");
+ }
+
+ if (bit_map == 0)
+ {
+ tag_address_offset_base = address;
+ Buffer.BlockCopy(BitConverter.GetBytes(address), 0, dense_buffer, block_tag_offset, OFFSET_SIZE);
+ }
+
+ int offset_in_bit_map = (int)(address - tag_address_offset_base) / element_alignment;
+ if (offset_in_bit_map < 64)
+ {
+ dense_buffer[block_tag_offset + OFFSET_SIZE + offset_in_bit_map / 8] |= (byte)(1 << (offset_in_bit_map % 8)); //bit map
+ Buffer.BlockCopy(memoryValue, 0, dense_buffer, block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE + element_size * block_tag_elem_count, element_size);//value
+ ++block_tag_elem_count;
+ }
+ else
+ {
+ block_tag_offset += OFFSET_SIZE + BIT_MAP_SIZE + element_size * block_tag_elem_count;
+
+ if (block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE + element_size * 64 >= block_size)
+ {
+ block_list.Add(new byte[block_size]);
+ ++block_id;
+ block_tag_offset = 0;
+ block_tag_elem_count = 0;
+ dense_buffer = block_list[block_id];
+ }
+
+ dense_buffer[block_tag_offset + OFFSET_SIZE] = (byte)1; //bit map
+ Buffer.BlockCopy(BitConverter.GetBytes(address), 0, dense_buffer, block_tag_offset, OFFSET_SIZE); //tag address base
+ Buffer.BlockCopy(memoryValue, 0, dense_buffer, block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE, element_size); //value
+ block_tag_elem_count = 1;
}
+ count++;
}
- public AddressList Intersect(MemoryHelper memoryHelper, AddressList filteredList, string default_compare_value)
+ public void Clear()
{
+ count = 0;
+ block_tag_offset = 0;
+ block_tag_elem_count = 0;
+ block_id = 0;
+ block_list.Clear();
+ block_list.Add(new byte[block_size]);
+ }
- AddressList new_address_list = new AddressList();
- int idx_i = 0;
- int idx_j = 0;
+ public void Get(ref uint addressOffset, ref byte[] memoryValue)
+ {
- while (idx_i < address_list.Count && idx_j < filteredList.Count)
- {
- Address address = address_list[idx_i];
- Address filtered = filteredList[idx_j];
+ byte[] dense_buffer = block_list[block_id];
+ memoryValue = new byte[element_size];
- if (address.AddressOffset == filtered.AddressOffset)
- {
- byte[] value = memoryHelper.UlongToBytes(filtered.MemoryValue);
+ uint offset_base = BitConverter.ToUInt32(dense_buffer, block_tag_offset);
+ ulong bit_map = BitConverter.ToUInt64(dense_buffer, block_tag_offset + OFFSET_SIZE);
+ addressOffset = (uint)(bit_position(bit_map, block_tag_elem_count) * element_alignment) + offset_base;
+ Buffer.BlockCopy(dense_buffer, block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE + element_size * block_tag_elem_count, memoryValue, 0, element_size);
+
+ }
- byte[] compare_value = memoryHelper.GetCompareBytes(address, default_compare_value);
+ public void Set(byte[] memoryValue)
+ {
+ byte[] dense_buffer = block_list[block_id];
+ Buffer.BlockCopy(memoryValue, 0, dense_buffer, block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE + element_size * block_tag_elem_count, element_size);
+ }
- if (memoryHelper.Compare(compare_value, value))
- {
- new_address_list.Add(filtered);
- }
+ public void Begin()
+ {
+ iterator = 0;
+ block_tag_offset = 0;
+ block_tag_elem_count = 0;
+ block_id = 0;
+ }
- idx_j++;
- idx_i++;
- }
- else if (address.AddressOffset > filtered.AddressOffset)
+ private int o_tag_offset = 0;
+ private int o_tag_count = 0;
+ private int o_bit_count = 0;
+
+ public void Next()
+ {
+ ++iterator;
+
+ byte[] dense_buffer = block_list[block_id];
+ uint base_offset = BitConverter.ToUInt32(dense_buffer, block_tag_offset);
+ ulong bit_map = BitConverter.ToUInt64(dense_buffer, block_tag_offset + 4);
+ o_tag_offset = block_tag_offset;
+ o_tag_count = block_tag_elem_count;
+ o_bit_count = bit_count(bit_map, 63);
+ ++block_tag_elem_count;
+
+ if (bit_count(bit_map, 63) <= block_tag_elem_count)
+ {
+ block_tag_offset += OFFSET_SIZE + BIT_MAP_SIZE + element_size * block_tag_elem_count;
+ if (block_tag_offset + OFFSET_SIZE + BIT_MAP_SIZE + element_size * 64 >= block_size)
{
- idx_j++;
+ ++block_id;
+ block_tag_offset = 0;
+ block_tag_elem_count = 0;
}
else
{
- idx_i++;
+ block_tag_elem_count = 0;
}
}
+ }
- return new_address_list;
+ public bool End()
+ {
+ return (iterator == count);
}
-
- public int Count { get { return address_list.Count; } }
+
+ public int Count { get { return count; } }
}
public class MappedSection
@@ -101,20 +208,20 @@ public class MappedSection
public MappedSection()
{
- AddressList = new AddressList();
+ AddressList = null;
}
- public AddressList getFilteredAddressList(ProcessManager processManager, MemoryHelper memoryHelper,
- string value, BackgroundWorker worker, ref ulong percent_len, int start, float percent)
+ public void UpdateAddressList(ProcessManager processManager, MemoryHelper memoryHelper,
+ string default_value_0_str, string default_value_1_str, bool newScan)
{
- AddressList filtered_list = new AddressList();
- worker.ReportProgress(start);
-
if (!Check)
{
- return filtered_list;
+ AddressList = null;
+ return;
}
+ AddressList new_address_list = new AddressList(memoryHelper.Length, memoryHelper.Alignment);
+
ulong address = this.Start;
int length = this.Length;
@@ -134,25 +241,28 @@ public AddressList getFilteredAddressList(ProcessManager processManager, MemoryH
length -= cur_length;
}
- percent_len += (ulong)cur_length;
- worker.ReportProgress(start + (int)(((float)percent_len / processManager.TotalMemorySize) * 100 * percent));
-
byte[] buffer = MemoryHelper.ReadMemory(address, (int)cur_length);
- byte[] match_value = memoryHelper.StringToBytes(value);
-
- memoryHelper.CompareWithFilterList(match_value, address, buffer, filtered_list);
+ byte[] default_value_0 = memoryHelper.StringToBytes(default_value_0_str);
+ byte[] default_value_1 = memoryHelper.StringToBytes(default_value_1_str);
+ if (newScan)
+ {
+ memoryHelper.CompareWithMemoryBufferNewScanner(default_value_0, default_value_1, buffer, AddressList, new_address_list);
+ }
+ else
+ {
+ memoryHelper.CompareWithMemoryBufferNextScanner(default_value_0, default_value_1, buffer, AddressList, new_address_list);
+ }
address += (ulong)cur_length;
}
- return filtered_list;
+ AddressList = new_address_list;
}
}
public class ProcessManager
{
public ulong TotalMemorySize { get; set; }
- //public int ProcessID { get; set; }
public List MappedSectionList { get; }
@@ -302,7 +412,10 @@ public ulong TotalAddressCount()
ulong total_address_count = 0;
for (int idx = 0; idx < MappedSectionList.Count; ++idx)
{
- total_address_count += (ulong)MappedSectionList[idx].AddressList.Count;
+ if (MappedSectionList[idx].Check)
+ {
+ total_address_count += (ulong)MappedSectionList[idx].AddressList.Count;
+ }
}
return total_address_count;
}
@@ -311,7 +424,10 @@ public void ClearAddressList()
{
for (int idx = 0; idx < MappedSectionList.Count; ++idx)
{
- MappedSectionList[idx].AddressList.Clear(); ;
+ if (MappedSectionList[idx].AddressList != null)
+ {
+ MappedSectionList[idx].AddressList.Clear();
+ }
}
}
}
diff --git a/PS4_Cheater/main.Designer.cs b/PS4_Cheater/main.Designer.cs
index 337b3e5..051a30b 100644
--- a/PS4_Cheater/main.Designer.cs
+++ b/PS4_Cheater/main.Designer.cs
@@ -13,12 +13,6 @@ partial class main
private Button save_cheat_list_btn;
private Button new_cheat_list_btn;
private DataGridView cheat_list_view;
- private DataGridViewTextBoxColumn cheat_list_view_address;
- private DataGridViewTextBoxColumn cheat_list_view_type;
- private DataGridViewTextBoxColumn cheat_list_view_value;
- private DataGridViewTextBoxColumn cheat_list_view_section;
- private DataGridViewCheckBoxColumn cheat_list_view_lock;
- private DataGridViewTextBoxColumn cheat_list_view_description;
private CheckedListBox section_list_box;
private ContextMenuStrip section_list_menu;
private ToolStripMenuItem section_view_menu;
@@ -73,6 +67,7 @@ private void InitializeComponent()
this.save_cheat_list_btn = new System.Windows.Forms.Button();
this.new_cheat_list_btn = new System.Windows.Forms.Button();
this.cheat_list_view = new System.Windows.Forms.DataGridView();
+ this.cheat_list_view_enabled = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.cheat_list_view_address = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cheat_list_view_type = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.cheat_list_view_value = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -91,6 +86,9 @@ private void InitializeComponent()
this.result_list_view = new System.Windows.Forms.ListView();
this.result_list_view_address = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.result_list_view_type = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
+ this.result_list_menu = new System.Windows.Forms.ContextMenuStrip(this.components);
+ this.view_item = new System.Windows.Forms.ToolStripMenuItem();
+ this.dump_item = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.version_list = new System.Windows.Forms.ComboBox();
this.processes_comboBox = new System.Windows.Forms.ComboBox();
@@ -98,6 +96,10 @@ private void InitializeComponent()
this.port_box = new System.Windows.Forms.TextBox();
this.send_payload_btn = new System.Windows.Forms.Button();
this.get_processes_btn = new System.Windows.Forms.Button();
+ this.alignment_box = new System.Windows.Forms.CheckBox();
+ this.value_1_box = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
this.msg = new System.Windows.Forms.Label();
this.select_all = new System.Windows.Forms.CheckBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
@@ -121,6 +123,7 @@ private void InitializeComponent()
this.splitContainer4.Panel1.SuspendLayout();
this.splitContainer4.Panel2.SuspendLayout();
this.splitContainer4.SuspendLayout();
+ this.result_list_menu.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.Panel2.SuspendLayout();
@@ -132,7 +135,7 @@ private void InitializeComponent()
this.parent.Dock = System.Windows.Forms.DockStyle.Fill;
this.parent.Location = new System.Drawing.Point(0, 0);
this.parent.Name = "parent";
- this.parent.Size = new System.Drawing.Size(1011, 671);
+ this.parent.Size = new System.Drawing.Size(1011, 619);
this.parent.TabIndex = 11;
//
// result_list_view_value
@@ -156,7 +159,7 @@ private void InitializeComponent()
this.refresh_cheat_list_btn.ForeColor = System.Drawing.Color.White;
this.refresh_cheat_list_btn.Location = new System.Drawing.Point(179, 2);
this.refresh_cheat_list_btn.Name = "refresh_cheat_list_btn";
- this.refresh_cheat_list_btn.Size = new System.Drawing.Size(165, 27);
+ this.refresh_cheat_list_btn.Size = new System.Drawing.Size(165, 25);
this.refresh_cheat_list_btn.TabIndex = 33;
this.refresh_cheat_list_btn.TabStop = false;
this.refresh_cheat_list_btn.Text = "Refresh";
@@ -177,7 +180,7 @@ private void InitializeComponent()
this.load_cheat_list_btn.ForeColor = System.Drawing.Color.White;
this.load_cheat_list_btn.Location = new System.Drawing.Point(534, 2);
this.load_cheat_list_btn.Name = "load_cheat_list_btn";
- this.load_cheat_list_btn.Size = new System.Drawing.Size(165, 27);
+ this.load_cheat_list_btn.Size = new System.Drawing.Size(165, 25);
this.load_cheat_list_btn.TabIndex = 32;
this.load_cheat_list_btn.TabStop = false;
this.load_cheat_list_btn.Text = "Load";
@@ -203,7 +206,7 @@ private void InitializeComponent()
this.save_cheat_list_btn.ForeColor = System.Drawing.Color.White;
this.save_cheat_list_btn.Location = new System.Drawing.Point(350, 2);
this.save_cheat_list_btn.Name = "save_cheat_list_btn";
- this.save_cheat_list_btn.Size = new System.Drawing.Size(165, 27);
+ this.save_cheat_list_btn.Size = new System.Drawing.Size(165, 25);
this.save_cheat_list_btn.TabIndex = 31;
this.save_cheat_list_btn.TabStop = false;
this.save_cheat_list_btn.Text = "Save";
@@ -223,7 +226,7 @@ private void InitializeComponent()
this.new_cheat_list_btn.ForeColor = System.Drawing.Color.White;
this.new_cheat_list_btn.Location = new System.Drawing.Point(0, 2);
this.new_cheat_list_btn.Name = "new_cheat_list_btn";
- this.new_cheat_list_btn.Size = new System.Drawing.Size(158, 27);
+ this.new_cheat_list_btn.Size = new System.Drawing.Size(158, 25);
this.new_cheat_list_btn.TabIndex = 30;
this.new_cheat_list_btn.TabStop = false;
this.new_cheat_list_btn.Text = "New";
@@ -240,21 +243,28 @@ private void InitializeComponent()
| System.Windows.Forms.AnchorStyles.Right)));
this.cheat_list_view.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.cheat_list_view.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+ this.cheat_list_view_enabled,
this.cheat_list_view_address,
this.cheat_list_view_type,
this.cheat_list_view_value,
this.cheat_list_view_section,
this.cheat_list_view_lock,
this.cheat_list_view_description});
- this.cheat_list_view.Location = new System.Drawing.Point(0, 39);
+ this.cheat_list_view.Location = new System.Drawing.Point(0, 36);
this.cheat_list_view.MultiSelect = false;
this.cheat_list_view.Name = "cheat_list_view";
this.cheat_list_view.RowTemplate.Height = 23;
- this.cheat_list_view.Size = new System.Drawing.Size(703, 276);
+ this.cheat_list_view.Size = new System.Drawing.Size(703, 255);
this.cheat_list_view.TabIndex = 1;
this.cheat_list_view.CellEndEdit += new System.Windows.Forms.DataGridViewCellEventHandler(this.cheat_list_view_CellEndEdit);
this.cheat_list_view.RowsRemoved += new System.Windows.Forms.DataGridViewRowsRemovedEventHandler(this.cheat_list_view_RowsRemoved);
//
+ // cheat_list_view_enabled
+ //
+ this.cheat_list_view_enabled.HeaderText = "Enabled";
+ this.cheat_list_view_enabled.Name = "cheat_list_view_enabled";
+ this.cheat_list_view_enabled.Width = 50;
+ //
// cheat_list_view_address
//
this.cheat_list_view_address.HeaderText = "Address";
@@ -292,14 +302,15 @@ private void InitializeComponent()
//
// section_list_box
//
- this.section_list_box.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.section_list_box.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.section_list_box.ContextMenuStrip = this.section_list_menu;
this.section_list_box.FormattingEnabled = true;
this.section_list_box.HorizontalScrollbar = true;
this.section_list_box.Location = new System.Drawing.Point(10, 3);
this.section_list_box.Name = "section_list_box";
- this.section_list_box.Size = new System.Drawing.Size(284, 259);
+ this.section_list_box.Size = new System.Drawing.Size(284, 212);
this.section_list_box.TabIndex = 14;
this.section_list_box.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.section_list_box_ItemCheck);
//
@@ -327,15 +338,14 @@ private void InitializeComponent()
//
// value_box
//
- this.value_box.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.value_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.value_box.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.value_box.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.value_box.ForeColor = System.Drawing.Color.White;
- this.value_box.Location = new System.Drawing.Point(59, 308);
+ this.value_box.Location = new System.Drawing.Point(12, 269);
this.value_box.MaxLength = 31;
this.value_box.Name = "value_box";
- this.value_box.Size = new System.Drawing.Size(227, 20);
+ this.value_box.Size = new System.Drawing.Size(109, 21);
this.value_box.TabIndex = 16;
this.value_box.TabStop = false;
this.value_box.Text = "0";
@@ -359,7 +369,7 @@ private void InitializeComponent()
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.splitContainer2);
- this.splitContainer1.Size = new System.Drawing.Size(1011, 671);
+ this.splitContainer1.Size = new System.Drawing.Size(1011, 619);
this.splitContainer1.SplitterDistance = 703;
this.splitContainer1.TabIndex = 47;
//
@@ -381,9 +391,10 @@ private void InitializeComponent()
this.splitContainer4.Panel2.Controls.Add(this.save_cheat_list_btn);
this.splitContainer4.Panel2.Controls.Add(this.new_cheat_list_btn);
this.splitContainer4.Panel2.Controls.Add(this.cheat_list_view);
- this.splitContainer4.Size = new System.Drawing.Size(703, 671);
- this.splitContainer4.SplitterDistance = 352;
+ this.splitContainer4.Size = new System.Drawing.Size(703, 619);
+ this.splitContainer4.SplitterDistance = 324;
this.splitContainer4.TabIndex = 0;
+ this.splitContainer4.TabStop = false;
//
// result_list_view
//
@@ -393,13 +404,15 @@ private void InitializeComponent()
this.result_list_view_value,
this.result_list_view_hex,
this.result_list_view_section});
+ this.result_list_view.ContextMenuStrip = this.result_list_menu;
this.result_list_view.Dock = System.Windows.Forms.DockStyle.Fill;
this.result_list_view.FullRowSelect = true;
this.result_list_view.GridLines = true;
+ this.result_list_view.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.result_list_view.Location = new System.Drawing.Point(0, 0);
this.result_list_view.MultiSelect = false;
this.result_list_view.Name = "result_list_view";
- this.result_list_view.Size = new System.Drawing.Size(703, 352);
+ this.result_list_view.Size = new System.Drawing.Size(703, 324);
this.result_list_view.TabIndex = 28;
this.result_list_view.UseCompatibleStateImageBehavior = false;
this.result_list_view.View = System.Windows.Forms.View.Details;
@@ -415,9 +428,32 @@ private void InitializeComponent()
this.result_list_view_type.Text = "Type";
this.result_list_view_type.Width = 120;
//
+ // result_list_menu
+ //
+ this.result_list_menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.view_item,
+ this.dump_item});
+ this.result_list_menu.Name = "result_list_menu";
+ this.result_list_menu.Size = new System.Drawing.Size(129, 48);
+ //
+ // view_item
+ //
+ this.view_item.Name = "view_item";
+ this.view_item.Size = new System.Drawing.Size(128, 22);
+ this.view_item.Text = "Hex Editor";
+ this.view_item.Click += new System.EventHandler(this.view_item_Click);
+ //
+ // dump_item
+ //
+ this.dump_item.Name = "dump_item";
+ this.dump_item.Size = new System.Drawing.Size(128, 22);
+ this.dump_item.Text = "Dump";
+ this.dump_item.Click += new System.EventHandler(this.dump_item_Click);
+ //
// splitContainer2
//
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
@@ -433,6 +469,10 @@ private void InitializeComponent()
//
// splitContainer2.Panel2
//
+ this.splitContainer2.Panel2.Controls.Add(this.alignment_box);
+ this.splitContainer2.Panel2.Controls.Add(this.value_1_box);
+ this.splitContainer2.Panel2.Controls.Add(this.label2);
+ this.splitContainer2.Panel2.Controls.Add(this.label1);
this.splitContainer2.Panel2.Controls.Add(this.section_list_box);
this.splitContainer2.Panel2.Controls.Add(this.value_box);
this.splitContainer2.Panel2.Controls.Add(this.msg);
@@ -444,9 +484,10 @@ private void InitializeComponent()
this.splitContainer2.Panel2.Controls.Add(this.next_scan_btn);
this.splitContainer2.Panel2.Controls.Add(this.new_scan_btn);
this.splitContainer2.Panel2.Controls.Add(this.refresh_btn);
- this.splitContainer2.Size = new System.Drawing.Size(304, 671);
+ this.splitContainer2.Size = new System.Drawing.Size(304, 619);
this.splitContainer2.SplitterDistance = 113;
this.splitContainer2.TabIndex = 47;
+ this.splitContainer2.TabStop = false;
//
// version_list
//
@@ -460,7 +501,7 @@ private void InitializeComponent()
"4.55"});
this.version_list.Location = new System.Drawing.Point(10, 4);
this.version_list.Name = "version_list";
- this.version_list.Size = new System.Drawing.Size(80, 21);
+ this.version_list.Size = new System.Drawing.Size(80, 20);
this.version_list.TabIndex = 5;
//
// processes_comboBox
@@ -472,9 +513,9 @@ private void InitializeComponent()
this.processes_comboBox.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.processes_comboBox.ForeColor = System.Drawing.Color.White;
this.processes_comboBox.FormattingEnabled = true;
- this.processes_comboBox.Location = new System.Drawing.Point(10, 59);
+ this.processes_comboBox.Location = new System.Drawing.Point(10, 54);
this.processes_comboBox.Name = "processes_comboBox";
- this.processes_comboBox.Size = new System.Drawing.Size(275, 21);
+ this.processes_comboBox.Size = new System.Drawing.Size(275, 20);
this.processes_comboBox.TabIndex = 3;
this.processes_comboBox.SelectedIndexChanged += new System.EventHandler(this.processes_comboBox_SelectedIndexChanged);
//
@@ -488,7 +529,7 @@ private void InitializeComponent()
this.ip_box.Location = new System.Drawing.Point(94, 3);
this.ip_box.MaxLength = 15;
this.ip_box.Name = "ip_box";
- this.ip_box.Size = new System.Drawing.Size(142, 20);
+ this.ip_box.Size = new System.Drawing.Size(142, 21);
this.ip_box.TabIndex = 0;
this.ip_box.TabStop = false;
this.ip_box.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
@@ -502,7 +543,7 @@ private void InitializeComponent()
this.port_box.Location = new System.Drawing.Point(242, 3);
this.port_box.MaxLength = 4;
this.port_box.Name = "port_box";
- this.port_box.Size = new System.Drawing.Size(43, 20);
+ this.port_box.Size = new System.Drawing.Size(43, 21);
this.port_box.TabIndex = 1;
this.port_box.TabStop = false;
this.port_box.Text = "9020";
@@ -519,9 +560,9 @@ private void InitializeComponent()
this.send_payload_btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.send_payload_btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.send_payload_btn.ForeColor = System.Drawing.Color.White;
- this.send_payload_btn.Location = new System.Drawing.Point(10, 33);
+ this.send_payload_btn.Location = new System.Drawing.Point(10, 30);
this.send_payload_btn.Name = "send_payload_btn";
- this.send_payload_btn.Size = new System.Drawing.Size(275, 20);
+ this.send_payload_btn.Size = new System.Drawing.Size(275, 18);
this.send_payload_btn.TabIndex = 2;
this.send_payload_btn.TabStop = false;
this.send_payload_btn.Text = "Send Payload";
@@ -542,9 +583,9 @@ private void InitializeComponent()
this.get_processes_btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.get_processes_btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.get_processes_btn.ForeColor = System.Drawing.Color.White;
- this.get_processes_btn.Location = new System.Drawing.Point(10, 87);
+ this.get_processes_btn.Location = new System.Drawing.Point(10, 80);
this.get_processes_btn.Name = "get_processes_btn";
- this.get_processes_btn.Size = new System.Drawing.Size(275, 22);
+ this.get_processes_btn.Size = new System.Drawing.Size(275, 20);
this.get_processes_btn.TabIndex = 4;
this.get_processes_btn.TabStop = false;
this.get_processes_btn.Text = "Refresh Processes";
@@ -553,23 +594,74 @@ private void InitializeComponent()
this.get_processes_btn.UseVisualStyleBackColor = false;
this.get_processes_btn.Click += new System.EventHandler(this.get_processes_btn_Click);
//
+ // alignment_box
+ //
+ this.alignment_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.alignment_box.AutoSize = true;
+ this.alignment_box.Checked = true;
+ this.alignment_box.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.alignment_box.Location = new System.Drawing.Point(167, 221);
+ this.alignment_box.Name = "alignment_box";
+ this.alignment_box.Size = new System.Drawing.Size(78, 16);
+ this.alignment_box.TabIndex = 32;
+ this.alignment_box.Text = "Alignment";
+ this.alignment_box.UseVisualStyleBackColor = true;
+ //
+ // value_1_box
+ //
+ this.value_1_box.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.value_1_box.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
+ this.value_1_box.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.value_1_box.ForeColor = System.Drawing.Color.White;
+ this.value_1_box.Location = new System.Drawing.Point(167, 269);
+ this.value_1_box.MaxLength = 31;
+ this.value_1_box.Name = "value_1_box";
+ this.value_1_box.Size = new System.Drawing.Size(120, 21);
+ this.value_1_box.TabIndex = 30;
+ this.value_1_box.Text = "0";
+ //
+ // label2
+ //
+ this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.label2.AutoSize = true;
+ this.label2.ForeColor = System.Drawing.Color.White;
+ this.label2.Location = new System.Drawing.Point(165, 255);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(41, 12);
+ this.label2.TabIndex = 31;
+ this.label2.Text = "Value:";
+ //
+ // label1
+ //
+ this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(137, 277);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(23, 12);
+ this.label1.TabIndex = 29;
+ this.label1.Text = "and";
+ //
// msg
//
+ this.msg.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.msg.AutoSize = true;
this.msg.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.msg.ForeColor = System.Drawing.Color.Red;
- this.msg.Location = new System.Drawing.Point(16, 495);
+ this.msg.Location = new System.Drawing.Point(16, 448);
this.msg.Name = "msg";
this.msg.Size = new System.Drawing.Size(0, 16);
this.msg.TabIndex = 21;
//
// select_all
//
+ this.select_all.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.select_all.AutoSize = true;
this.select_all.ForeColor = System.Drawing.SystemColors.ControlLightLight;
- this.select_all.Location = new System.Drawing.Point(12, 280);
+ this.select_all.Location = new System.Drawing.Point(19, 222);
this.select_all.Name = "select_all";
- this.select_all.Size = new System.Drawing.Size(70, 17);
+ this.select_all.Size = new System.Drawing.Size(84, 16);
this.select_all.TabIndex = 27;
this.select_all.Text = "Select All";
this.select_all.UseVisualStyleBackColor = true;
@@ -577,16 +669,16 @@ private void InitializeComponent()
//
// progressBar
//
- this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.progressBar.Location = new System.Drawing.Point(12, 516);
+ this.progressBar.Location = new System.Drawing.Point(12, 467);
this.progressBar.Name = "progressBar";
- this.progressBar.Size = new System.Drawing.Size(275, 25);
+ this.progressBar.Size = new System.Drawing.Size(275, 23);
this.progressBar.TabIndex = 22;
//
// compareList
//
- this.compareList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.compareList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.compareList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.compareList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -597,20 +689,23 @@ private void InitializeComponent()
"Exact Value",
"Fuzzy Value",
"Increased Value",
+ "Increased Value By",
"Decreased Value",
+ "Decreased Value By",
"Bigger Than",
"Smaller Than",
"Changed Value",
"Unchanged Value",
+ "Between Value",
"Unknown Initial Value"});
- this.compareList.Location = new System.Drawing.Point(12, 365);
+ this.compareList.Location = new System.Drawing.Point(12, 328);
this.compareList.Name = "compareList";
- this.compareList.Size = new System.Drawing.Size(274, 21);
+ this.compareList.Size = new System.Drawing.Size(274, 20);
this.compareList.TabIndex = 29;
//
// valueTypeList
//
- this.valueTypeList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.valueTypeList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.valueTypeList.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.valueTypeList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -618,30 +713,31 @@ private void InitializeComponent()
this.valueTypeList.ForeColor = System.Drawing.Color.White;
this.valueTypeList.FormattingEnabled = true;
this.valueTypeList.Items.AddRange(new object[] {
- "1 byte",
+ "byte",
"2 bytes",
"4 bytes",
"8 bytes",
"float",
"double"});
- this.valueTypeList.Location = new System.Drawing.Point(12, 337);
+ this.valueTypeList.Location = new System.Drawing.Point(12, 302);
this.valueTypeList.Name = "valueTypeList";
- this.valueTypeList.Size = new System.Drawing.Size(274, 21);
+ this.valueTypeList.Size = new System.Drawing.Size(274, 20);
this.valueTypeList.TabIndex = 24;
//
// label4
//
+ this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label4.AutoSize = true;
this.label4.ForeColor = System.Drawing.Color.White;
- this.label4.Location = new System.Drawing.Point(17, 312);
+ this.label4.Location = new System.Drawing.Point(10, 254);
this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(37, 13);
+ this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 28;
this.label4.Text = "Value:";
//
// next_scan_btn
//
- this.next_scan_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.next_scan_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.next_scan_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.next_scan_btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
@@ -650,9 +746,9 @@ private void InitializeComponent()
this.next_scan_btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.next_scan_btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.next_scan_btn.ForeColor = System.Drawing.Color.White;
- this.next_scan_btn.Location = new System.Drawing.Point(12, 458);
+ this.next_scan_btn.Location = new System.Drawing.Point(12, 414);
this.next_scan_btn.Name = "next_scan_btn";
- this.next_scan_btn.Size = new System.Drawing.Size(275, 27);
+ this.next_scan_btn.Size = new System.Drawing.Size(275, 25);
this.next_scan_btn.TabIndex = 19;
this.next_scan_btn.TabStop = false;
this.next_scan_btn.Text = "Next Scan";
@@ -663,7 +759,7 @@ private void InitializeComponent()
//
// new_scan_btn
//
- this.new_scan_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.new_scan_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.new_scan_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.new_scan_btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
@@ -672,9 +768,9 @@ private void InitializeComponent()
this.new_scan_btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.new_scan_btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.new_scan_btn.ForeColor = System.Drawing.Color.White;
- this.new_scan_btn.Location = new System.Drawing.Point(12, 391);
+ this.new_scan_btn.Location = new System.Drawing.Point(12, 352);
this.new_scan_btn.Name = "new_scan_btn";
- this.new_scan_btn.Size = new System.Drawing.Size(274, 27);
+ this.new_scan_btn.Size = new System.Drawing.Size(274, 25);
this.new_scan_btn.TabIndex = 17;
this.new_scan_btn.TabStop = false;
this.new_scan_btn.Text = "New Scan";
@@ -685,7 +781,7 @@ private void InitializeComponent()
//
// refresh_btn
//
- this.refresh_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.refresh_btn.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.refresh_btn.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(37)))), ((int)(((byte)(37)))), ((int)(((byte)(38)))));
this.refresh_btn.FlatAppearance.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(100)))), ((int)(((byte)(100)))));
@@ -694,9 +790,9 @@ private void InitializeComponent()
this.refresh_btn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.refresh_btn.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.refresh_btn.ForeColor = System.Drawing.Color.White;
- this.refresh_btn.Location = new System.Drawing.Point(12, 425);
+ this.refresh_btn.Location = new System.Drawing.Point(12, 383);
this.refresh_btn.Name = "refresh_btn";
- this.refresh_btn.Size = new System.Drawing.Size(275, 27);
+ this.refresh_btn.Size = new System.Drawing.Size(275, 25);
this.refresh_btn.TabIndex = 18;
this.refresh_btn.TabStop = false;
this.refresh_btn.Text = "Refresh";
@@ -731,11 +827,11 @@ private void InitializeComponent()
//
// main
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(45)))));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
- this.ClientSize = new System.Drawing.Size(1011, 671);
+ this.ClientSize = new System.Drawing.Size(1011, 619);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.parent);
this.DoubleBuffered = true;
@@ -757,6 +853,7 @@ private void InitializeComponent()
this.splitContainer4.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer4)).EndInit();
this.splitContainer4.ResumeLayout(false);
+ this.result_list_menu.ResumeLayout(false);
this.splitContainer2.Panel1.ResumeLayout(false);
this.splitContainer2.Panel1.PerformLayout();
this.splitContainer2.Panel2.ResumeLayout(false);
@@ -768,5 +865,19 @@ private void InitializeComponent()
}
private ComboBox version_list;
+ private ContextMenuStrip result_list_menu;
+ private ToolStripMenuItem view_item;
+ private ToolStripMenuItem dump_item;
+ private TextBox value_1_box;
+ private Label label2;
+ private Label label1;
+ private CheckBox alignment_box;
+ private DataGridViewCheckBoxColumn cheat_list_view_enabled;
+ private DataGridViewTextBoxColumn cheat_list_view_address;
+ private DataGridViewTextBoxColumn cheat_list_view_type;
+ private DataGridViewTextBoxColumn cheat_list_view_value;
+ private DataGridViewTextBoxColumn cheat_list_view_section;
+ private DataGridViewCheckBoxColumn cheat_list_view_lock;
+ private DataGridViewTextBoxColumn cheat_list_view_description;
}
}
diff --git a/PS4_Cheater/main.cs b/PS4_Cheater/main.cs
index 11e0dbe..c753c7b 100644
--- a/PS4_Cheater/main.cs
+++ b/PS4_Cheater/main.cs
@@ -19,12 +19,13 @@ public partial class main : Form
private MemoryHelper memoryHelper = new MemoryHelper();
private CheatList cheatList = new CheatList();
- private const int CHEAT_LIST_ADDRESS = 0;
- private const int CHEAT_LIST_TYPE = 1;
- private const int CHEAT_LIST_VALUE = 2;
- private const int CHEAT_LIST_SECTION = 3;
- private const int CHEAT_LIST_LOCK = 4;
- private const int CHEAT_LIST_DESC = 5;
+ private const int CHEAT_LIST_ENABLED = 0;
+ private const int CHEAT_LIST_ADDRESS = 1;
+ private const int CHEAT_LIST_TYPE = 2;
+ private const int CHEAT_LIST_VALUE = 3;
+ private const int CHEAT_LIST_SECTION = 4;
+ private const int CHEAT_LIST_LOCK = 5;
+ private const int CHEAT_LIST_DESC = 6;
private const int RESULT_LIST_ADDRESS = 0;
private const int RESULT_LIST_TYPE = 1;
@@ -112,7 +113,7 @@ class WorkerArgs
private void update_result_list_view(BackgroundWorker worker, string value_type, bool refresh, int start, float percent)
{
- worker.ReportProgress(start, 0);
+ worker.ReportProgress(start);
List listViewItems = new List();
HashSet mappedSectionCheckeSet = new HashSet();
@@ -124,46 +125,47 @@ private void update_result_list_view(BackgroundWorker worker, string value_type,
{
MappedSection mapped_section = processManager.MappedSectionList[idx];
AddressList address_list = mapped_section.AddressList;
+ if (address_list == null)
+ {
+ continue;
+ }
+
if (address_list.Count > 0)
{
mappedSectionCheckeSet.Add(idx);
}
- for (int i = 0; i < address_list.Count; i++)
+ for (address_list.Begin(); !address_list.End(); address_list.Next())
{
if (curAddressCount >= 0x1000)
{
break;
}
+ uint memory_address_offset = 0;
+ byte[] memory_value = null;
+
+ address_list.Get(ref memory_address_offset, ref memory_value);
+
curAddressCount++;
ListViewItem lvi = new ListViewItem();
- lvi.Text = String.Format("{0:X}", address_list[i].AddressOffset + mapped_section.Start);
-
- byte[] match_bytes = BitConverter.GetBytes(address_list[i].MemoryValue);
+ lvi.Text = String.Format("{0:X}", memory_address_offset + mapped_section.Start);
+
if (refresh)
{
- match_bytes = memoryHelper.GetBytesByType(address_list[i].AddressOffset + mapped_section.Start);
- Address address_tmp = new Address();
- address_tmp.AddressOffset = address_list[i].AddressOffset;
- address_tmp.MemoryValue = memoryHelper.BytesToUlong(match_bytes);
- address_list[i] = address_tmp;
+ memory_value = memoryHelper.GetBytesByType(memory_address_offset + mapped_section.Start);
+ address_list.Set(memory_value);
}
- string value_output = memoryHelper.BytesToString(match_bytes);
+ string value_output = memoryHelper.BytesToString(memory_value);
lvi.SubItems.Add(value_type);
lvi.SubItems.Add(value_output);
- lvi.SubItems.Add(MemoryHelper.bytes_to_hex_string(match_bytes));
+ lvi.SubItems.Add(MemoryHelper.bytes_to_hex_string(memory_value));
lvi.SubItems.Add(processManager.GetSectionName(idx));
listViewItems.Add(lvi);
-
- if (i % 500 == 0)
- {
- worker.ReportProgress(start + (int)(i / (float)curAddressCount * 100 * percent));
- }
}
}
@@ -190,23 +192,19 @@ private void new_scan_btn_Click(object sender, EventArgs e)
{
try
{
- if (processManager == null)
- {
- return;
- }
-
if (MessageBox.Show("search size:" + (processManager.TotalMemorySize / 1024).ToString() + "KB") != DialogResult.OK)
{
return;
}
- memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex);
+ memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex, alignment_box.Checked);
result_list_view.Items.Clear();
processManager.ClearAddressList();
WorkerArgs args = new WorkerArgs();
args.ValueType = (string)valueTypeList.SelectedItem;
setButtons(false);
+
new_scan_worker.RunWorkerAsync(args);
}
catch (Exception exception)
@@ -219,12 +217,7 @@ private void refresh_Click(object sender, EventArgs e)
{
try
{
- if (processManager == null)
- {
- return;
- }
-
- memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex);
+ memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex, alignment_box.Checked);
WorkerArgs args = new WorkerArgs();
args.ValueType = (string)valueTypeList.SelectedItem;
setButtons(false);
@@ -240,12 +233,7 @@ private void next_scan_btn_Click(object sender, EventArgs e)
{
try
{
- if (processManager == null)
- {
- return;
- }
-
- memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex);
+ memoryHelper.InitMemoryHandler((string)valueTypeList.SelectedItem, (CompareType)compareList.SelectedIndex, alignment_box.Checked);
WorkerArgs args = new WorkerArgs();
args.ValueType = (string)valueTypeList.SelectedItem;
setButtons(false);
@@ -299,33 +287,41 @@ private void update_result_list_worker_DoWork(object sender, DoWorkEventArgs e)
}
private void next_scan_worker_DoWork(object sender, DoWorkEventArgs e)
{
- ulong percent_len = 0;
-
+ long processed_memory_len = 0;
+ ulong total_memory_size = processManager.TotalMemorySize + 1;
+ string value_0 = value_box.Text;
+ string value_1 = value_1_box.Text;
+ next_scan_worker.ReportProgress(0);
for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx)
{
MappedSection mappedSection = processManager.MappedSectionList[section_idx];
- AddressList addressList = mappedSection.AddressList;
-
- AddressList filtered_list = mappedSection.getFilteredAddressList(processManager, memoryHelper, value_box.Text,
- next_scan_worker, ref percent_len, 0, 0.5f);
- mappedSection.AddressList = addressList.Intersect(memoryHelper, filtered_list, value_box.Text);
+ mappedSection.UpdateAddressList(processManager, memoryHelper, value_0, value_1, false);
+ if (mappedSection.Check) processed_memory_len += mappedSection.Length;
+ next_scan_worker.ReportProgress((int)(((float)processed_memory_len / total_memory_size) * 80));
}
+ next_scan_worker.ReportProgress(80);
WorkerArgs args = (WorkerArgs)e.Argument;
- update_result_list_view(next_scan_worker, args.ValueType, false, 50, 0.5f);
+ update_result_list_view(next_scan_worker, args.ValueType, false, 80, 0.2f);
}
private void new_scan_worker_DoWork(object sender, DoWorkEventArgs e)
{
WorkerArgs args = (WorkerArgs)e.Argument;
- ulong lenPercent = 0;
+ long processed_memory_len = 0;
+ ulong total_memory_size = processManager.TotalMemorySize + 1;
+ string value_0 = value_box.Text;
+ string value_1 = value_1_box.Text;
+ new_scan_worker.ReportProgress(0);
for (int section_idx = 0; section_idx < processManager.MappedSectionList.Count; ++section_idx)
{
MappedSection mappedSection = processManager.MappedSectionList[section_idx];
- mappedSection.AddressList = mappedSection.getFilteredAddressList(processManager, memoryHelper, value_box.Text,
- new_scan_worker, ref lenPercent, 0, 0.5f);
+ mappedSection.UpdateAddressList(processManager, memoryHelper, value_0, value_1, true);
+ if (mappedSection.Check) processed_memory_len += mappedSection.Length;
+ new_scan_worker.ReportProgress((int)(((float)processed_memory_len / total_memory_size) * 80));
}
- update_result_list_view(new_scan_worker, args.ValueType, false, 50, 0.5f);
+ new_scan_worker.ReportProgress(80);
+ update_result_list_view(new_scan_worker, args.ValueType, false, 80, 0.2f);
}
private void new_scan_worker_ProgressChanged(object sender, ProgressChangedEventArgs e)
@@ -340,9 +336,12 @@ private void new_scan_worker_ProgressChanged(object sender, ProgressChangedEvent
msg.Text = "Analysing memory...";
}
- if (e.ProgressPercentage == 100 && e.UserState is WorkerReturn)
+ if (e.ProgressPercentage == 100)
{
- update_result_list_view_ui((WorkerReturn)e.UserState);
+ if (e.UserState is WorkerReturn)
+ {
+ update_result_list_view_ui((WorkerReturn)e.UserState);
+ }
}
progressBar.Value = e.ProgressPercentage;
@@ -371,21 +370,11 @@ private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArg
}
setButtons(true);
}
-
- private void sectionView_Click(object sender, EventArgs e)
- {
- if (section_list_box.SelectedIndex >= 0)
- {
- MappedSection section = processManager.MappedSectionList[section_list_box.SelectedIndex];
- HexEdit hexEdit = new HexEdit(memoryHelper, 0, section);
- hexEdit.Show(this);
- }
- }
- private void sectionDump_Click(object sender, EventArgs e)
+ private void dump_dialog(int sectionID)
{
- if (section_list_box.SelectedIndex >= 0)
+ if (sectionID >= 0)
{
- MappedSection section = processManager.MappedSectionList[section_list_box.SelectedIndex];
+ MappedSection section = processManager.MappedSectionList[sectionID];
save_file_dialog.Filter = "Binary files (*.bin)|*.bin|All files (*.*)|*.*";
save_file_dialog.FilterIndex = 1;
@@ -403,6 +392,66 @@ private void sectionDump_Click(object sender, EventArgs e)
}
}
+ private void view_item_Click(object sender, EventArgs e)
+ {
+ if (result_list_view.SelectedItems.Count == 1)
+ {
+ ListView.SelectedListViewItemCollection items = result_list_view.SelectedItems;
+
+ ulong address = ulong.Parse(result_list_view.SelectedItems[0].
+ SubItems[RESULT_LIST_ADDRESS].Text, NumberStyles.HexNumber);
+ int sectionID = processManager.GetMappedSectionID(address);
+
+ if (sectionID >= 0)
+ {
+ int offset = 0;
+
+ MappedSection section = processManager.MappedSectionList[sectionID];
+
+ offset = (int)(address - section.Start);
+ HexEditor hexEdit = new HexEditor(memoryHelper, offset, section);
+ hexEdit.Show(this);
+ }
+ }
+ }
+
+
+ private void dump_item_Click(object sender, EventArgs e)
+ {
+ if (result_list_view.SelectedItems.Count == 1)
+ {
+ ulong address = ulong.Parse(result_list_view.SelectedItems[0].
+ SubItems[RESULT_LIST_ADDRESS].Text, NumberStyles.HexNumber);
+
+ int sectionID = processManager.GetMappedSectionID(address);
+
+ dump_dialog(sectionID);
+ }
+ }
+
+ private void sectionView_Click(object sender, EventArgs e)
+ {
+ int sectionID = -1;
+ int offset = 0;
+
+ sectionID = section_list_box.SelectedIndex;
+
+ if (sectionID >= 0)
+ {
+ MappedSection section = processManager.MappedSectionList[sectionID];
+ HexEditor hexEdit = new HexEditor(memoryHelper, offset, section);
+ hexEdit.Show(this);
+ }
+ }
+
+ private void sectionDump_Click(object sender, EventArgs e)
+ {
+ if (section_list_box.SelectedIndex >= 0)
+ {
+ dump_dialog(section_list_box.SelectedIndex);
+ }
+ }
+
private void section_list_box_ItemCheck(object sender, ItemCheckEventArgs e)
{
processManager.SectionCheck(e.Index, e.NewValue == CheckState.Checked);
@@ -509,9 +558,6 @@ private void cheat_list_view_CellEndEdit(object sender, DataGridViewCellEventArg
case CHEAT_LIST_VALUE:
cheatList[e.RowIndex].Value = (string)edited_col;
break;
- case CHEAT_LIST_LOCK:
- cheatList[e.RowIndex].Lock = (bool)edited_col;
- break;
case CHEAT_LIST_DESC:
cheatList[e.RowIndex].Description = (string)edited_col;
break;
@@ -523,13 +569,39 @@ private void cheat_list_view_CellEndEdit(object sender, DataGridViewCellEventArg
}
}
- private void add_address_btn_Click(object sender, EventArgs e)
+ private void cheat_list_view_CellClick(object sender, DataGridViewCellEventArgs e)
{
- if (processManager == null)
+ try
{
- return;
+ DataGridViewRow edited_row = cheat_list_view.Rows[e.RowIndex];
+
+ object edited_col = null;
+
+ switch (e.ColumnIndex)
+ {
+ case CHEAT_LIST_ENABLED:
+ cheat_list_view.EndEdit();
+ edited_col = edited_row.Cells[e.ColumnIndex].Value;
+ if ((bool)edited_col)
+ {
+ cheatList[e.RowIndex].Value = cheatList[e.RowIndex].Value;
+ }
+ break;
+ case CHEAT_LIST_LOCK:
+ cheat_list_view.EndEdit();
+ edited_col = edited_row.Cells[e.ColumnIndex].Value;
+ cheatList[e.RowIndex].Lock = (bool)edited_col;
+ break;
+ }
}
+ catch (Exception exception)
+ {
+ MessageBox.Show(exception.Message);
+ }
+ }
+ private void add_address_btn_Click(object sender, EventArgs e)
+ {
NewAddress newAddress = new NewAddress();
newAddress.ShowDialog();
@@ -565,11 +637,6 @@ private void save_address_btn_Click(object sender, EventArgs e)
{
try
{
- if (processManager == null)
- {
- return;
- }
-
save_file_dialog.Filter = "Cheat files (*.cht)|*.cht";
save_file_dialog.FilterIndex = 1;
save_file_dialog.RestoreDirectory = true;
@@ -587,11 +654,6 @@ private void save_address_btn_Click(object sender, EventArgs e)
private void load_address_btn_Click(object sender, EventArgs e)
{
- if (processManager == null)
- {
- return;
- }
-
open_file_dialog.Filter = "Cheat files (*.cht)|*.cht";
open_file_dialog.FilterIndex = 1;
open_file_dialog.RestoreDirectory = true;
@@ -623,20 +685,12 @@ private void refresh_cheat_list_Click(object sender, EventArgs e)
{
try
{
- if (processManager == null)
- {
- return;
- }
-
for (int i = 0; i < cheatList.Count; ++i)
{
DataGridViewRow row = cheat_list_view.Rows[i];
cheatList[i].Refresh();
row.Cells[CHEAT_LIST_VALUE].Value = cheatList[i].Value;
- //memoryHelper.InitMemoryHandler(type, CompareType.NONE);
-
- //row.Cells[CHEAT_LIST_VALUE].Value = memoryHelper.BytesToString(memoryHelper.GetBytesByType(address));
}
}
catch (Exception exception)
@@ -657,9 +711,6 @@ private void refresh_lock_Tick(object sender, EventArgs e)
}
cheatList[i].Value = cheatList[i].Value;
-
- //memoryHelper.InitMemoryHandler(type, CompareType.NONE);
- //memoryHelper.SetBytesByType(address, memoryHelper.StringToBytes(value));
}
catch
{
@@ -749,6 +800,7 @@ private void send_payload_btn_Click(object sender, EventArgs e)
MessageBox.Show(exception.Message, exception.Source, MessageBoxButtons.OK, MessageBoxIcon.Hand);
}
}
+
}
}
diff --git a/PS4_Cheater/main.resx b/PS4_Cheater/main.resx
index 1bf362c..8d66850 100644
--- a/PS4_Cheater/main.resx
+++ b/PS4_Cheater/main.resx
@@ -117,6 +117,12 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ True
+
+
+ True
+
326, 17
@@ -126,6 +132,9 @@
604, 17
+
+ 17, 56
+
748, 17
@@ -139,6 +148,6 @@
949, 17
- 42
+ 82
\ No newline at end of file