Skip to content

Commit

Permalink
Increased string length limit from 255 to 99999, probably #4
Browse files Browse the repository at this point in the history
  • Loading branch information
AITYunivers committed Aug 18, 2023
1 parent 3a0a899 commit 63e22f2
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 112 deletions.
33 changes: 1 addition & 32 deletions CTFPV/InformationItems/CRunActiveObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,43 +151,12 @@ public override void InitData(string parentPointer)
int AlterableStringCount = PV.MemLib.ReadInt(parentPointer + ", 0x2CC");
AlterableStrings = new string[AlterableStringCount];
for (int i = 0; i < AlterableStringCount; i++)
AlterableStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x2C8, 0x" + (i * 4).ToString("X") + ", 0x0", length: 255, stringEncoding: Encoding.Unicode);
AlterableStrings[i] = PV.MemLib.ReadUnicode(parentPointer + ", 0x2C8, 0x" + (i * 4).ToString("X") + ", 0x0");
}

public override void RefreshData(string parentPointer)
{
latestParentPointer = parentPointer;

// Animation Structure
CurrentAnimationStopped = PV.MemLib.ReadInt(parentPointer + ", 0x1DA") == 1;
CurrentAnimation = PV.MemLib.ReadInt(parentPointer + ", 0x1DE");
CurrentDirection = PV.MemLib.ReadInt(parentPointer + ", 0x1E6");
CurrentSpeed = PV.MemLib.ReadInt(parentPointer + ", 0x1F2");
MinSpeed = PV.MemLib.ReadInt(parentPointer + ", 0x1F6");
MaxSpeed = PV.MemLib.ReadInt(parentPointer + ", 0x1FA");
Repeats = PV.MemLib.ReadInt(parentPointer + ", 0x20A");
Looping = PV.MemLib.ReadInt(parentPointer + ", 0x20E");
CurrentFrame = PV.MemLib.ReadInt(parentPointer + ", 0x212");
CurrentAnimationFrameCount = PV.MemLib.ReadInt(parentPointer + ", 0x216");

// Sprite Structure
ZOrder = PV.MemLib.ReadInt(parentPointer + ", 0x22A");

// Alterable Values
int AlterableValueCount = PV.MemLib.ReadInt(parentPointer + ", 0x246");
AlterableValues = new CRunValue[AlterableValueCount];
for (int i = 0; i < AlterableValueCount; i++)
{
CRunValue val = new CRunValue();
val.ValueOffset = i * 16;
val.InitData(parentPointer + ", 0x242");
AlterableValues[i] = val;
}
AlterableFlags.flag = (uint)PV.MemLib.ReadInt(parentPointer + ", 0x2AA");
int AlterableStringCount = PV.MemLib.ReadInt(parentPointer + ", 0x2CC");
AlterableStrings = new string[AlterableStringCount];
for (int i = 0; i < AlterableStringCount; i++)
AlterableStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x2C8, 0x" + (i * 4).ToString("X") + ", 0x0", length: 255, stringEncoding: Encoding.Unicode);
}

public override List<TreeViewItem> GetPanel()
Expand Down
20 changes: 10 additions & 10 deletions CTFPV/InformationItems/CRunApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public override void InitData(string parentPointer)
latestParentPointer = parentPointer;

// App Mini Header
Header = PV.MemLib.ReadString(parentPointer + ", 0x0", length: 4, stringEncoding: Encoding.ASCII);
Version = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x4");
SubVersion = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x6");
Header = PV.MemLib.ReadAscii(parentPointer + ", 0x0", length: 4);
Version = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x4");
ProductVersion = PV.MemLib.ReadInt(parentPointer + ", 0x8");
ProductBuild = PV.MemLib.ReadInt(parentPointer + ", 0xC");

Expand All @@ -160,12 +160,12 @@ public override void InitData(string parentPointer)
FramesPerSecond = PV.MemLib.ReadInt(parentPointer + ", 0x78");

// Information
Name = PV.MemLib.ReadString(parentPointer + ", 0x80, 0x0", length: 255, stringEncoding: Encoding.Unicode);
FilePath = PV.MemLib.ReadString(parentPointer + ", 0x84, 0x0", length: 255, stringEncoding: Encoding.Unicode);
EditorFilePath = PV.MemLib.ReadString(parentPointer + ", 0x88, 0x0", length: 255, stringEncoding: Encoding.Unicode);
Copyright = PV.MemLib.ReadString(parentPointer + ", 0x8C, 0x0", length: 255, stringEncoding: Encoding.Unicode);
About = PV.MemLib.ReadString(parentPointer + ", 0x90, 0x0", length: 255, stringEncoding: Encoding.Unicode);
TargetFilePath = PV.MemLib.ReadString(parentPointer + ", 0x94, 0x0", length: 255, stringEncoding: Encoding.Unicode);
Name = PV.MemLib.ReadUnicode(parentPointer + ", 0x80, 0x0");
FilePath = PV.MemLib.ReadUnicode(parentPointer + ", 0x84, 0x0");
EditorFilePath = PV.MemLib.ReadUnicode(parentPointer + ", 0x88, 0x0");
Copyright = PV.MemLib.ReadUnicode(parentPointer + ", 0x8C, 0x0");
About = PV.MemLib.ReadUnicode(parentPointer + ", 0x90, 0x0");
TargetFilePath = PV.MemLib.ReadUnicode(parentPointer + ", 0x94, 0x0");
FrameCount = PV.MemLib.ReadInt(parentPointer + ", 0xC4");

// Objects
Expand Down Expand Up @@ -205,7 +205,7 @@ public override void InitData(string parentPointer)
}

for (int i = 0; i < GlobalStringCount; i++)
GlobalStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x27C, 0x" + (i * 4).ToString("X") + ", 0x0", length: 255, stringEncoding: Encoding.Unicode);
GlobalStrings[i] = PV.MemLib.ReadUnicode(parentPointer + ", 0x27C, 0x" + (i * 4).ToString("X") + ", 0x0");

// Extended Header
Options.flag = (uint)PV.MemLib.ReadInt(parentPointer + ", 0x37C, 0x0");
Expand Down Expand Up @@ -237,7 +237,7 @@ public override void RefreshData(string parentPointer)
GlobalValues[i].RefreshData(parentPointer + ", 0x268");

for (int i = 0; i < GlobalStringCount; i++)
GlobalStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x27C, 0x" + (i * 4).ToString("X") + ", 0x0", length: 255, stringEncoding: Encoding.Unicode);
GlobalStrings[i] = PV.MemLib.ReadUnicode(parentPointer + ", 0x27C, 0x" + (i * 4).ToString("X") + ", 0x0");
}

public override List<TreeViewItem> GetPanel()
Expand Down
2 changes: 1 addition & 1 deletion CTFPV/InformationItems/CRunFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public override void InitData(string parentPointer)
Flags.flag = (uint)PV.MemLib.ReadInt(parentPointer + ", 0xC");

// Information
Name = PV.MemLib.ReadString(parentPointer + ", 0x10, 0x0", stringEncoding: Encoding.Unicode);
Name = PV.MemLib.ReadUnicode(parentPointer + ", 0x10, 0x0");
LevelLeft = PV.MemLib.ReadInt(parentPointer + ", 0x1C");
LevelTop = PV.MemLib.ReadInt(parentPointer + ", 0x20");
LevelLastLeft = PV.MemLib.ReadInt(parentPointer + ", 0x24");
Expand Down
2 changes: 1 addition & 1 deletion CTFPV/InformationItems/CRunFrameLayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public override void InitData(string parentPointer)
latestParentPointer = parentPointer;

// Information
Name = PV.MemLib.ReadString(parentPointer + ", 0x" + LayerOffset.ToString("X") + ", 0x0", length: 255, stringEncoding: Encoding.Unicode);
Name = PV.MemLib.ReadUnicode(parentPointer + ", 0x" + LayerOffset.ToString("X") + ", 0x0");

// Offset
OffsetX = PV.MemLib.ReadInt(parentPointer + ", 0x" + (LayerOffset + 4).ToString("X"));
Expand Down
7 changes: 4 additions & 3 deletions CTFPV/InformationItems/CRunOCAltValues.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Encryption_Key_Finder.InformationItems;
using CTFPV.Miscellaneous;
using Encryption_Key_Finder.InformationItems;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;
Expand Down Expand Up @@ -37,7 +38,7 @@ public override void InitData(string parentPointer)
int stringOffset = 2;
for (int i = 0; i < AltStringCount; i++)
{
AltStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x" + (StringsOffset + stringOffset).ToString("X"), length: 255, stringEncoding: Encoding.Unicode);
AltStrings[i] = PV.MemLib.ReadUnicode(parentPointer + ", 0x" + (StringsOffset + stringOffset).ToString("X"));
stringOffset += (AltStrings[i].Length + 1) * 2;
}
}
Expand All @@ -62,7 +63,7 @@ public override void RefreshData(string parentPointer)
int stringOffset = 2;
for (int i = 0; i < AltStringCount; i++)
{
AltStrings[i] = PV.MemLib.ReadString(parentPointer + ", 0x" + (StringsOffset + stringOffset).ToString("X"), length: 255, stringEncoding: Encoding.Unicode);
AltStrings[i] = PV.MemLib.ReadUnicode(parentPointer + ", 0x" + (StringsOffset + stringOffset).ToString("X"));
stringOffset += (AltStrings[i].Length + 1) * 2;
}
}
Expand Down
2 changes: 1 addition & 1 deletion CTFPV/InformationItems/CRunOCParagraph.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public override void InitData(string parentPointer)
Font = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x" + ParagraphOffset.ToString("X"));
Flags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x" + (ParagraphOffset + 2).ToString("X"));
Color = PV.MemLib.ReadColor(parentPointer + ", 0x" + (ParagraphOffset + 4).ToString("X"));
Text = PV.MemLib.ReadString(parentPointer + ", 0x" + (ParagraphOffset + 8).ToString("X"), length: 255, stringEncoding: Encoding.Unicode);
Text = PV.MemLib.ReadUnicode(parentPointer + ", 0x" + (ParagraphOffset + 8).ToString("X"));
}

public override void RefreshData(string parentPointer)
Expand Down
5 changes: 3 additions & 2 deletions CTFPV/InformationItems/CRunOCSubApp.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Encryption_Key_Finder.InformationItems;
using CTFPV.Miscellaneous;
using Encryption_Key_Finder.InformationItems;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;
Expand Down Expand Up @@ -59,7 +60,7 @@ public override void InitData(string parentPointer)
Version = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x" + (SubAppOffset + 12).ToString("X"));
StartFrame = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x" + (SubAppOffset + 14).ToString("X"));
Options.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x" + (SubAppOffset + 16).ToString("X"));
Name = PV.MemLib.ReadString(parentPointer + ", 0x" + (SubAppOffset + 20).ToString("X"), length: 255, stringEncoding: Encoding.Unicode);
Name = PV.MemLib.ReadUnicode(parentPointer + ", 0x" + (SubAppOffset + 20).ToString("X"));
}

public override void RefreshData(string parentPointer)
Expand Down
4 changes: 2 additions & 2 deletions CTFPV/InformationItems/CRunObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public override void InitData(string parentPointer)
ObjInfoNumber = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x12");
Type = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x18");
CreationID = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x1A");
MovementName = PV.MemLib.ReadString(parentPointer + ", 0x38, 0x0", length: 255, stringEncoding: Encoding.Unicode);
MovementName = PV.MemLib.ReadUnicode(parentPointer + ", 0x38, 0x0");
ObjectCommon = new CRunObjectCommon();
ObjectCommon.InitData(parentPointer + ", 0x44");

Expand All @@ -146,7 +146,7 @@ public override void InitData(string parentPointer)
Flags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x7C");
Layer = (uint)PV.MemLib.ReadInt(parentPointer + ", 0x84");
CollisionFlags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x94");
Identifier = PV.MemLib.ReadString(parentPointer + ", 0xB4", length: 4, stringEncoding: Encoding.ASCII);
Identifier = PV.MemLib.ReadAscii(parentPointer + ", 0xB4", length: 4);

// Animation/Movement Information
CurrentPlayer = PV.MemLib.ReadInt(parentPointer + ", 0xC8");
Expand Down
2 changes: 1 addition & 1 deletion CTFPV/InformationItems/CRunObjectCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public override void InitData(string parentPointer)
StringsOffset = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x28");
NewFlags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x2A");
Preferences.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x2C");
Identifier = PV.MemLib.ReadString(parentPointer + ", 0x2E", length: 4, stringEncoding: Encoding.ASCII);
Identifier = PV.MemLib.ReadAscii(parentPointer + ", 0x2E", length: 4);
BackgroundColor = PV.MemLib.ReadColor(parentPointer + ", 0x32");
FadeInOffset = PV.MemLib.ReadInt(parentPointer + ", 0x36");
FadeOutOffset = PV.MemLib.ReadInt(parentPointer + ", 0x3A");
Expand Down
5 changes: 3 additions & 2 deletions CTFPV/InformationItems/CRunObjectInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Encryption_Key_Finder.InformationItems;
using CTFPV.Miscellaneous;
using Encryption_Key_Finder.InformationItems;
using System.Collections.Generic;
using System.Text;
using System.Windows.Controls;
Expand Down Expand Up @@ -35,7 +36,7 @@ public class CRunObjectInfo : PropertyPanel
public override void InitData(string parentPointer)
{
// Information
Name = PV.MemLib.ReadString(parentPointer + ", 0x10, 0x0", length: 255, stringEncoding: Encoding.Unicode);
Name = PV.MemLib.ReadUnicode(parentPointer + ", 0x10, 0x0");
Handle = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x0");
Type = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x2");
Flags.flag = (uint)PV.MemLib.Read2Byte(parentPointer + ", 0x4");
Expand Down
80 changes: 26 additions & 54 deletions CTFPV/InformationItems/CRunSystemObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,63 +72,35 @@ public override void InitData(string parentPointer)

// Sprite Structure
ZOrder = PV.MemLib.ReadInt(parentPointer + ", 0x1DA");
// Gets lost somewhere after this
CreationFlags.flag = (uint)PV.MemLib.ReadInt(parentPointer + ", 0x1DE");

// Universal System Object Values
PlayerCount = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x1F2");
Flags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x1F4");

// Counter
OldLevel = PV.MemLib.ReadInt(parentPointer + ", 0x1FA");
Level = PV.MemLib.ReadInt(parentPointer + ", 0x1FE");
Value = new CRunValue();
Value.ValueOffset = 514;
Value.InitData(parentPointer);
// Gets lost somewhere before this
Width = PV.MemLib.ReadInt(parentPointer + ", 0x212");
Height = PV.MemLib.ReadInt(parentPointer + ", 0x216");

// Counter
Minimum = PV.MemLib.ReadDouble(parentPointer + ", 0x21A");
Maximum = PV.MemLib.ReadDouble(parentPointer + ", 0x222");
OldFrame = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x22A");
Hidden = (byte)PV.MemLib.ReadByte(parentPointer + ", 0x22C");

// String
Text = PV.MemLib.ReadString(parentPointer + ", 0x22E, 0x0", length: 255, stringEncoding: Encoding.Unicode);
Text = PV.MemLib.ReadUnicode(parentPointer + ", 0x22E, 0x0");
Font = PV.MemLib.ReadInt(parentPointer + ", 0x236");
Color1 = PV.MemLib.ReadColor(parentPointer + ", 0x23A");
Color2 = PV.MemLib.ReadColor(parentPointer + ", 0x23E");
}

public override void RefreshData(string parentPointer)
{
latestParentPointer = parentPointer;

// Sprite Structure
ZOrder = PV.MemLib.ReadInt(parentPointer + ", 0x1DA");

// Universal System Object Values
PlayerCount = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x202");
Flags.flag = (ushort)PV.MemLib.Read2Byte(parentPointer + ", 0x204");
OldLevel = PV.MemLib.ReadInt(parentPointer + ", 0x20A");
Level = PV.MemLib.ReadInt(parentPointer + ", 0x20E");
Value = new CRunValue();
Value.ValueOffset = 514;
Value.InitData(parentPointer);
Width = PV.MemLib.ReadInt(parentPointer + ", 0x222");
Height = PV.MemLib.ReadInt(parentPointer + ", 0x226");

// Counter
Minimum = PV.MemLib.ReadDouble(parentPointer + ", 0x22A");
Maximum = PV.MemLib.ReadDouble(parentPointer + ", 0x232");
OldFrame = (short)PV.MemLib.Read2Byte(parentPointer + ", 0x23A");
Hidden = (byte)PV.MemLib.ReadByte(parentPointer + ", 0x23C");

// String
Text = PV.MemLib.ReadString(parentPointer + ", 0x23E, 0x0", length: 255, stringEncoding: Encoding.Unicode);
Font = PV.MemLib.ReadInt(parentPointer + ", 0x246");
Color1 = PV.MemLib.ReadColor(parentPointer + ", 0x24A");
Color2 = PV.MemLib.ReadColor(parentPointer + ", 0x24E");
}

public override List<TreeViewItem> GetPanel()
Expand Down Expand Up @@ -197,21 +169,41 @@ public override List<TreeViewItem> GetPanel()
flagsPanel.Items.Add(flagPanel);
}

// Width
TreeViewItem widthPanel = Templates.Editbox();
((widthPanel.Header as Grid).Children[0] as Label).Content = "Width";
((widthPanel.Header as Grid).Children[1] as TextBox).Text = Width.ToString();
(widthPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x212";
sysObjStructPanel.Items.Add(widthPanel);

// Height
TreeViewItem heightPanel = Templates.Editbox();
((heightPanel.Header as Grid).Children[0] as Label).Content = "Height";
((heightPanel.Header as Grid).Children[1] as TextBox).Text = Height.ToString();
(heightPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x216";
sysObjStructPanel.Items.Add(heightPanel);

panel.Add(sysObjStructPanel);

sysObjStructPanel.Items.Add(flagsPanel);

// Counter Structure
TreeViewItem cntrStructPanel = Templates.Tab();
((cntrStructPanel.Header as Grid).Children[0] as Label).Content = "Counter Structure";

// Old Level
TreeViewItem oldLvlPanel = Templates.Editbox();
((oldLvlPanel.Header as Grid).Children[0] as Label).Content = "Minimum";
((oldLvlPanel.Header as Grid).Children[1] as TextBox).Text = OldLevel.ToString();
(oldLvlPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x1FA";
sysObjStructPanel.Items.Add(oldLvlPanel);
cntrStructPanel.Items.Add(oldLvlPanel);

// Level
TreeViewItem lvlPanel = Templates.Editbox();
((lvlPanel.Header as Grid).Children[0] as Label).Content = "Maximum";
((lvlPanel.Header as Grid).Children[1] as TextBox).Text = Level.ToString();
(lvlPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x1FE";
sysObjStructPanel.Items.Add(lvlPanel);
cntrStructPanel.Items.Add(lvlPanel);

// Value
TreeViewItem valPanel = Templates.Editbox();
Expand All @@ -230,27 +222,7 @@ public override List<TreeViewItem> GetPanel()
break;
}

sysObjStructPanel.Items.Add(valPanel);

// Width
TreeViewItem widthPanel = Templates.Editbox();
((widthPanel.Header as Grid).Children[0] as Label).Content = "Width";
((widthPanel.Header as Grid).Children[1] as TextBox).Text = Width.ToString();
(widthPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x212";
sysObjStructPanel.Items.Add(widthPanel);

// Height
TreeViewItem heightPanel = Templates.Editbox();
((heightPanel.Header as Grid).Children[0] as Label).Content = "Height";
((heightPanel.Header as Grid).Children[1] as TextBox).Text = Height.ToString();
(heightPanel.Tag as TagHeader).Pointer = latestParentPointer + ", 0x216";
sysObjStructPanel.Items.Add(heightPanel);

panel.Add(sysObjStructPanel);

// Counter Structure
TreeViewItem cntrStructPanel = Templates.Tab();
((cntrStructPanel.Header as Grid).Children[0] as Label).Content = "Counter Structure";
cntrStructPanel.Items.Add(valPanel);

// Old Frame
TreeViewItem oldFrmPanel = Templates.Editbox();
Expand Down
Loading

0 comments on commit 63e22f2

Please sign in to comment.