public void RemovesTest() { int numberOfElems = 10; OffsetList list = new OffsetList(); for (int i = 0; i < numberOfElems; ++i) { list.Add(new Offset(i, i)); } Assert.IsFalse(list.Remove(null)); Assert.IsFalse(list.Remove(new Offset(numberOfElems, numberOfElems))); Assert.AreEqual(numberOfElems, list.Length); int numberOfDeletions = 0; for (int i = 0; i < numberOfElems; i += 2) { Assert.IsTrue(list.Remove(new Offset(i, i))); numberOfDeletions++; } Assert.AreEqual(numberOfElems - numberOfDeletions, list.Length); for (int i = 0; i < numberOfElems; i += 2) { Assert.IsFalse(list.Contains(new Offset(i, i))); } }
private void updateOffsetInformation() { int offsetsCountSet = 0, bonesCountSet = 0; List <Offset> offsets = OffsetList.List; List <Bone> bones = BoneList.List; foreach (Offset offset in offsets) { if (offset.GetValue() > 0) { offsetsCountSet++; } } foreach (Bone bone in bones) { if (bone.GetValue() > 0) { bonesCountSet++; } } lblOffsetsSet.Text = offsetsCountSet + "/" + offsets.Count; lblBonesSet.Text = bonesCountSet + "/" + bones.Count; OffsetList.RefreshOffsets(lbOffsets); BoneList.RefreshBones(lbBones); }
public static void DownloadValues(TextBox txt, Action update) { string id = txt.Text; if (id.Length != 8) { MessageBox.Show("Invalid ID detected.\nPlease ensure your ID is correct and try again.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string result = Networking.ShareDownload("values", id); if (string.IsNullOrEmpty(result)) { MessageBox.Show("An error has occurred.\nUnable to download values from ID: " + id + "\nPlease ensure your ID is correct and try again.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int validOffsets = 0, validBones = 0; OffsetList.ParseOffsets(OffsetList.List, result, ref validOffsets); BoneList.ParseBones(BoneList.List, result, ref validBones); MessageBox.Show("Values downloaded and parsed successfully!\n" + "Valid Offsets: " + validOffsets + "/" + OffsetList.List.Count + "\n" + "Valid Bones: " + validBones + "/" + BoneList.List.Count, "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Information); txt.Clear(); update(); }
static GadgetTestData() { ExpectedOffsetList = new OffsetList(); ExpectedOffsetList.AddOffset(94, 397, "ContentBlock"); ExpectedOffsetList[0].ChildOffsets.AddOffset(0, ControlFactory.RESERVEDKEY_LITERAL); ExpectedOffsetList[0].ChildOffsets.AddOffset(212, "os_Name"); ExpectedOffsetList[0].ChildOffsets.AddOffset(242, ControlFactory.RESERVEDKEY_LITERAL); }
public static ref T access <T>(this OffsetList offsets, Memory <byte> buffer, int offset) where T : struct { var slice = buffer.Slice(0, offset); offsets.regions.AddOrSet(buffer, 0); offsets.regions.AddOrSet(slice, offset); offsets.sources.AddOrSet(typeof(T), Tuple.Create(slice, offset)); return(ref MemoryMarshal.AsRef <T>(slice.Span)); }
private void OnMenuStripClick(object sender, ToolStripItemClickedEventArgs e) { if (this != _lastSelected) { return; } switch (e.ClickedItem.Text) { case "Edit": EditMode = true; break; case "View As Hexadecimal": _watchVar.UseHex = !(e.ClickedItem as ToolStripMenuItem).Checked; (e.ClickedItem as ToolStripMenuItem).Checked = !(e.ClickedItem as ToolStripMenuItem).Checked; break; case "Lock Value": EditMode = false; (e.ClickedItem as ToolStripMenuItem).Checked = !(e.ClickedItem as ToolStripMenuItem).Checked; if (OffsetList.Any(o => GetIsLocked(o))) { OffsetList.ForEach(o => RemoveLock(o)); } else { OffsetList.ForEach(o => LockUpdate(o)); } break; case "Select Object": if (_watchVar.ByteCount != 4) { return; } var slotManager = ManagerContext.Current.ObjectSlotManager; slotManager.SelectedSlotsAddresses.Clear(); foreach (var otherOffset in OffsetList) { var objAddress = BitConverter.ToUInt32(_watchVar.GetByteData(otherOffset), 0); if (ManagerContext.Current.ObjectSlotManager.ObjectSlots.Count(s => s.Address == objAddress) > 0) { slotManager.SelectedSlotsAddresses.Add(objAddress); } } break; case "Highlight": var toolItem = (e.ClickedItem as ToolStripMenuItem); toolItem.Checked = !toolItem.Checked; _tablePanel.ShowBorder = toolItem.Checked; break; } }
public void TestAddCount() { OffsetList list = new OffsetList(); Assert.IsTrue(0 == list.Count); list.AddOffset(0, new OsmlNav().OffsetKey); Assert.IsTrue(1 == list.Count); list.AddOffset(3, 55, ControlFactory.RESERVEDKEY_LITERAL); Assert.IsTrue(2 == list.Count); }
public static ref T access <T, B>(this OffsetList offsets, B buffer, int offset) where T : struct { var source = offsets.sources[typeof(B)]; var slice = source.Item1.Slice(0, offset); var position = source.Item2 + offset; offsets.regions.AddOrSet(slice, position); offsets.sources.AddOrSet(typeof(T), Tuple.Create(slice, position)); return(ref MemoryMarshal.AsRef <T>(slice.Span)); }
public void TestSingleNestedDeserialize() { string str = "33:ContentBlock{12:TemplateScript}"; OffsetList list = new OffsetList(str); Assert.AreEqual(1, list.Count, "Main list count wrong"); Assert.AreEqual(new ContentBlock().OffsetKey, list[0].OffsetKey, "Incorrect first item - not content block"); Assert.AreEqual(1, list[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(new OsTemplate().OffsetKey, list[0].ChildOffsets[0].OffsetKey, "Not template at first item"); }
public void TestListDeserialize() { string str = "3:SampleHeading|15-44:Literal|45:mytest_SampleContainer"; OffsetList list = new OffsetList(); Assert.IsTrue(0 == list.Count); list.DeserializeString(str); Assert.IsTrue(3 == list.Count, "Loaded count wrong"); Assert.AreEqual(new SampleHeading().OffsetKey, list[0].OffsetKey, "First item of wrong type"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[list.Count - 1].OffsetKey, "Last item of wrong type"); }
public void TestNestedContentDeserialize() { OffsetItem offsets = new OffsetItem(GadgetTestData.GadgetOffsetListString); OffsetList list = offsets.ChildOffsets; Assert.AreEqual(2, offsets.ChildOffsets.Count, "Main list count wrong"); Assert.AreEqual("ModulePrefs", list[0].OffsetKey, "Incorrect first item - not module prefs"); Assert.AreEqual("ContentBlock", list[1].OffsetKey, "Incorrect second item - not content block"); Assert.AreEqual(3, list[1].ChildOffsets[1].ChildOffsets.Count, "Child list not correct length"); }
public void TestSingleNestedDeserialize() { string str = "33:mytest_SampleContainer{12:mytest_SampleContainer}"; OffsetList list = new OffsetList(str); Assert.AreEqual(1, list.Count, "Main list count wrong"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[0].OffsetKey, "Incorrect first item - not content block"); Assert.AreEqual(1, list[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[0].ChildOffsets[0].OffsetKey, "Not template at first item"); }
public void TestListDeserialize() { string str = "3:os_Name|15-44:Literal|45:os_Nav"; OffsetList list = new OffsetList(); Assert.IsTrue(0 == list.Count); list.DeserializeString(str); Assert.IsTrue(3 == list.Count, "Loaded count wrong"); Assert.AreEqual(new OsmlName().OffsetKey, list[0].OffsetKey, "First item of wrong type"); Assert.AreEqual(new OsmlNav().OffsetKey, list[list.Count - 1].OffsetKey, "Last item of wrong type"); }
public void TestNestedContentDeserialize() { string str = "33:mytest_SampleContainer{12:mytest_SampleContainer{0:Literal|55:ASpecialContainer{0:Literal|55:SampleHeading|70:Literal}|70:Literal}|150:ASpecialContainer{12:ASpecialContainer{0:SampleHeading}}}"; OffsetItem offsets = new OffsetItem(str); OffsetList list = offsets.ChildOffsets; Assert.AreEqual(2, offsets.ChildOffsets.Count, "Main list count wrong"); Assert.AreEqual("mytest_SampleContainer", list[0].OffsetKey, "Incorrect first item"); Assert.AreEqual("ASpecialContainer", list[1].OffsetKey, "Incorrect second item"); Assert.AreEqual(3, list[0].ChildOffsets[1].ChildOffsets.Count, "Child list not correct length"); }
public void TestTwoNestedDeserialize() { string str = "33:mytest_SampleContainer{12:mytest_SampleContainer{0:Literal|55:SampleHeading|70:Literal}}"; OffsetList list = new OffsetList(str); Assert.AreEqual(1, list.Count, "Main list count wrong"); Assert.AreEqual(1, list[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(3, list[0].ChildOffsets[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[0].ChildOffsets[0].OffsetKey, "Not container at first item"); }
public void TestTwoNestedDeserialize() { string str = "33:ContentBlock{12:TemplateScript{0:Literal|55:OsName|70:Literal}}"; OffsetList list = new OffsetList(str); Assert.AreEqual(1, list.Count, "Main list count wrong"); Assert.AreEqual(1, list[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(3, list[0].ChildOffsets[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(new OsTemplate().OffsetKey, list[0].ChildOffsets[0].OffsetKey, "Not template at first item"); }
private void btnChangeValue_Click(object sender, EventArgs e) { bool base16 = rbHexadecimal.Checked; if (base16) { // Using hexadecimal. try { int value = Convert.ToInt32(txtValue.Text, 16); offset.SetValue(value); OffsetList.RefreshOffsets(listBox); Hide(); MessageBox.Show("Offset value changed!\n" + offset.GetName() + " is now equal to 0x" + value.ToString("X") + ".", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch (System.FormatException) { MessageBox.Show("Invalid hexadecimal value detected.\nThat couldn't be converted to an integer.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } catch (Exception ex) { MessageBox.Show("An error has occurred while converting value.\n" + ex.Message, "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } else { // Using decimal. try { int value = Convert.ToInt32(txtValue.Text); offset.SetValue(value); OffsetList.RefreshOffsets(listBox); Hide(); MessageBox.Show("Offset value changed!\n" + offset.GetName() + " is now equal to 0x" + value.ToString("X") + ".", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); } catch (System.FormatException) { MessageBox.Show("Invalid decimal value detected.\nThat couldn't be converted to an integer.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } catch (Exception ex) { MessageBox.Show("An error has occurred while converting value.\n" + ex.Message, "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } }
public void TestListSerialize() { OffsetList list = new OffsetList(); list.AddOffset(3, new OsmlName().OffsetKey); list.AddOffset(15, 44, ControlFactory.RESERVEDKEY_LITERAL); list.AddOffset(45, new OsmlNav().OffsetKey); string expected = "3:os_Name|15-44:Literal|45:os_Nav"; string val = list.ToString(); Assert.AreEqual(expected, val, "List serialized incorrectly"); }
public void TestTwoNestedComplextDeserialize() { string str = "33:mytest_SampleContainer{12:mytest_SampleContainer{0:Literal|55:SampleHeading|70:Literal}}|150:mytest_SampleContainer{12:ASpecialContainer{0:SampleHeading}}"; OffsetList list = new OffsetList(str); Assert.AreEqual(2, list.Count, "Main list count wrong"); Assert.AreEqual(1, list[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(3, list[0].ChildOffsets[0].ChildOffsets.Count, "Child list count wrong"); Assert.AreEqual(1, list[1].ChildOffsets[0].ChildOffsets.Count, "Second content list count wrong"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[0].ChildOffsets[0].OffsetKey, "Not template at first item"); Assert.AreEqual(new ASpecialContainer().OffsetKey, list[1].ChildOffsets[0].OffsetKey, "Not template at first item"); Assert.AreEqual(new SampleContainerControl().OffsetKey, list[1].OffsetKey, "Not Content at second item"); }
public void FromPmxMorph(PmxMorph m, bool nonStr = false) { if (!nonStr) { Name = m.Name; NameE = m.NameE; } Panel = m.Panel; Kind = m.Kind; int count = m.OffsetList.Count; OffsetList.Clear(); OffsetList.Capacity = count; for (int i = 0; i < count; i++) { OffsetList.Add(m.OffsetList[i].Clone()); } FromID(m); }
/// <summary> /// Constructs a copy of an existing UnicodeSetStringSpan. /// Assumes which==<see cref="All"/> for a frozen set. /// </summary> public UnicodeSetStringSpan(UnicodeSetStringSpan otherStringSpan, IList <string> newParentSetStrings) { spanSet = otherStringSpan.spanSet; strings = newParentSetStrings; maxLength16 = otherStringSpan.maxLength16; someRelevant = otherStringSpan.someRelevant; all = true; if (Utility.SameObjects(otherStringSpan.spanNotSet, otherStringSpan.spanSet)) { spanNotSet = spanSet; } else { spanNotSet = (UnicodeSet)otherStringSpan.spanNotSet.Clone(); } offsets = new OffsetList(); spanLengths = (short[])otherStringSpan.spanLengths.Clone(); }
private void _textBoxValue_MouseEnter(object sender, EventArgs e) { var lockedStatus = CheckState.Unchecked; if (OffsetList.Any(o => GetIsLocked(o))) { if (OffsetList.All(o => GetIsLocked(o))) { lockedStatus = CheckState.Checked; } else { lockedStatus = CheckState.Indeterminate; } } _lastSelected = this; if (_watchVar.IsAngle) { (AngleMenu.Items["HexView"] as ToolStripMenuItem).Checked = _watchVar.UseHex; (AngleMenu.Items["LockValue"] as ToolStripMenuItem).CheckState = lockedStatus; (AngleMenu.Items["Highlight"] as ToolStripMenuItem).Checked = _tablePanel.ShowBorder; (AngleDropDownMenu[0].DropDownItems[0] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Recommended); (AngleDropDownMenu[0].DropDownItems[1] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Unsigned); (AngleDropDownMenu[0].DropDownItems[2] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Signed); (AngleDropDownMenu[0].DropDownItems[3] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Degrees); (AngleDropDownMenu[0].DropDownItems[4] as ToolStripMenuItem).Checked = (_angleViewMode == AngleViewModeType.Radians); (AngleDropDownMenu[1] as ToolStripMenuItem).Checked = _angleTruncated; } else { (Menu.Items["HexView"] as ToolStripMenuItem).Checked = _watchVar.UseHex; (Menu.Items["LockValue"] as ToolStripMenuItem).CheckState = lockedStatus; (Menu.Items["Highlight"] as ToolStripMenuItem).Checked = _tablePanel.ShowBorder; ObjectDropDownMenu.ForEach(d => Menu.Items.Remove(d)); if (_watchVar.IsObject) { ObjectDropDownMenu.ForEach(d => Menu.Items.Add(d)); } } }
public void TestOffsetList() { OffsetList listOffset = new OffsetList(); Random random = new Random(DateTime.Now.Millisecond); for (int i = 0; i < 10; ++i) { for (int j = 0; j < 5; ++j) { listOffset.Add(new Offset(i, j)); } } for (int i = 0; i < 10; i += 2) { for (int j = 0; j < 5; j += 2) { listOffset.Remove(new Offset(i, j)); listOffset.Remove(new Offset(10 + random.Next(100), random.Next(300))); } } for (int i = 0; i < 10; ++i) { for (int j = 0; j < 5; ++j) { if (i % 2 == 0 && j % 2 == 0) { Assert.IsFalse(listOffset.Contains(new Offset(i, j))); } else { Assert.IsTrue(listOffset.Contains(new Offset(i, j))); } } } Assert.AreEqual(listOffset.Length, 35); }
public void TestParseOffsets() { GadgetMaster master = new GadgetMaster(testFactory); ContentBlock block = new ContentBlock(); block.MyRootMaster = master; block.LoadTag(sampleContent); //bool done = block.Parse(); //Assert.IsTrue(done); OffsetList offsets = block.MyOffset.ChildOffsets; Assert.AreEqual(2, offsets.Count, "Incorrect offset count"); Assert.IsTrue("DataScript" == offsets[0].OffsetKey, "Data script not found as first item"); Assert.IsTrue("TemplateScript" == offsets[1].OffsetKey, "Template script not second item"); for (int i = 0; i < offsets.Count; i++) { Assert.IsTrue(offsets[i].Position > 0, String.Format("Offset {0} is negatively positioned", i)); } }
public OsTemplate(string name, string markup, OffsetList offsets) : this(name) { LoadNewChildOffsets(offsets); LoadTag(markup); }
public void FromStreamEx(Stream s, PmxElementFormat f = null) { Name = PmxStreamHelper.ReadString(s, f); NameE = PmxStreamHelper.ReadString(s, f); Panel = PmxStreamHelper.ReadElement_Int32(s, 1); Kind = (OffsetKind)PmxStreamHelper.ReadElement_Int32(s, 1); int num = PmxStreamHelper.ReadElement_Int32(s); OffsetList.Clear(); OffsetList.Capacity = num; for (int i = 0; i < num; i++) { switch (Kind) { case OffsetKind.Group: case OffsetKind.Flip: { PmxGroupMorph pmxGroupMorph = new PmxGroupMorph(); pmxGroupMorph.FromStreamEx(s, f); OffsetList.Add(pmxGroupMorph); break; } case OffsetKind.Vertex: { PmxVertexMorph pmxVertexMorph = new PmxVertexMorph(); pmxVertexMorph.FromStreamEx(s, f); OffsetList.Add(pmxVertexMorph); break; } case OffsetKind.Bone: { PmxBoneMorph pmxBoneMorph = new PmxBoneMorph(); pmxBoneMorph.FromStreamEx(s, f); OffsetList.Add(pmxBoneMorph); break; } case OffsetKind.Impulse: { PmxImpulseMorph pmxImpulseMorph = new PmxImpulseMorph(); pmxImpulseMorph.FromStreamEx(s, f); OffsetList.Add(pmxImpulseMorph); break; } case OffsetKind.Material: { PmxMaterialMorph pmxMaterialMorph = new PmxMaterialMorph(); pmxMaterialMorph.FromStreamEx(s, f); OffsetList.Add(pmxMaterialMorph); break; } case OffsetKind.UV: case OffsetKind.UVA1: case OffsetKind.UVA2: case OffsetKind.UVA3: case OffsetKind.UVA4: { PmxUVMorph pmxUVMorph = new PmxUVMorph(); pmxUVMorph.FromStreamEx(s, f); OffsetList.Add(pmxUVMorph); break; } } } if (f.WithID) { base.UID = PmxStreamHelper.ReadElement_UInt(s); base.CID = PmxStreamHelper.ReadElement_UInt(s); } }
public void Update() { if (_watchVar.IsSpecial) { return; } ShowLockedImage(OffsetList.Any(o => GetIsLocked(o)), !OffsetList.All(o => GetIsLocked(o))); if (_editMode) { return; } _changedByUser = false; if (_watchVar.IsBool) { if (OffsetList.Any(o => _watchVar.GetBoolValue(o))) { if (OffsetList.All(o => _watchVar.GetBoolValue(o))) { CheckBoxCheckState = CheckState.Checked; } else { CheckBoxCheckState = CheckState.Indeterminate; } } else { CheckBoxCheckState = CheckState.Unchecked; } } else { bool firstOffset = true; foreach (var offset in OffsetList) { string newText = ""; if (_watchVar.IsAngle) { newText = _watchVar.GetAngleStringValue(offset, _angleViewMode, _angleTruncated); } else { newText = _watchVar.GetStringValue(offset); } if (firstOffset) { _textBoxValue.Text = newText; } else if (_textBoxValue.Text != newText) { _textBoxValue.Text = ""; continue; } firstOffset = false; } } _changedByUser = true; }
private void CompileCheat() { if (BuildInProgress) { txtLog.Log("Build already in progress.", Color.Yellow); return; } BuildInProgress = true; string sourceMemory = Properties.Resources.Memory; string sourceOffsets = Properties.Resources.Offsets; string sourceProgram = Properties.Resources.Program; string sourceAimbotMath = Properties.Resources.AimbotMath; // Temporarily getting cheat source from local files, replace before release. /* * string sourceMemory = File.ReadAllText(@"C:\Users\Justin\Documents\Programming\Programs\Applications\Dynago\Dynago Stub\Dynago Stub\Memory.cs"); * string sourceOffsets = File.ReadAllText(@"C:\Users\Justin\Documents\Programming\Programs\Applications\Dynago\Dynago Stub\Dynago Stub\Offsets.cs"); * string sourceProgram = File.ReadAllText(@"C:\Users\Justin\Documents\Programming\Programs\Applications\Dynago\Dynago Stub\Dynago Stub\Program.cs"); * string sourceAimbotMath = File.ReadAllText(@"C:\Users\Justin\Documents\Programming\Programs\Applications\Dynago\Dynago Stub\Dynago Stub\AimbotMath.cs"); */ string sourceFinal = sourceMemory + sourceOffsets + sourceProgram; txtLog.Log("Initialized original cheat source."); #region settings // Note: use.ToString(format) when converting floats/decimals. #region aimbot settings bool aimbot_required = cb_aimbot_enabled.Checked || general_settings.trigger_magnetic || pistol_settings.trigger_magnetic || sniper_settings.trigger_magnetic; if (aimbot_required) { sourceFinal += sourceAimbotMath; } for (int i = 0; i < cmb_aimbot_type.Items.Count; i++) { string typeName = cmb_aimbot_type.Items[i].ToString(); WeaponSettings type = null; switch (typeName) { case "general": type = general_settings; break; case "pistols": type = pistol_settings; break; case "snipers": type = sniper_settings; break; } if (type.aimbot_on_key) { sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_key", KeyManagement.KeyFromText(type.aimbot_key_txt).ToString()); } else { sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_key", "-1"); } sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_bone", BoneList.GetBone((cmb_aimbot_bone.Items[type.aimbot_bone_index]).ToString()).ToString()); sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_fov", type.aimbot_fov.ToString(format) + "f"); sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_smooth", type.aimbot_smooth.ToString(format) + "f"); sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_rcs", type.aimbot_control_recoil.ToString().ToLower()); sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_enemy", type.aimbot_shoot_enemies.ToString().ToLower()); sourceFinal = sourceFinal.ReplaceComment($"setting_aimbot_{typeName}_team", type.aimbot_shoot_teammates.ToString().ToLower()); } sourceFinal = sourceFinal.ReplaceComment("setting_aimbot_thread_delay", Convert.ToInt32(nud_aimbot_thread_delay.Value).ToString()); if (!cb_aimbot_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_aimbot"); } if (!aimbot_required) { sourceFinal = sourceFinal.EraseComment("feature_aimbot/magnet"); } #endregion #region trigger settings for (int i = 0; i < cmb_triggerbot_type.Items.Count; i++) { string typeName = cmb_triggerbot_type.Items[i].ToString(); WeaponSettings type = null; switch (typeName) { case "general": type = general_settings; break; case "pistols": type = pistol_settings; break; case "snipers": type = sniper_settings; break; } if (type.trigger_on_key) { sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_key", KeyManagement.KeyFromText(type.trigger_key_txt).ToString()); } else { sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_key", "-1"); } sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_magnetbone", BoneList.GetBone((cmb_trigger_magnet_bone.Items[type.trigger_magnet_bone_index]).ToString()).ToString()); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_magnetfov", type.trigger_magnet_fov.ToString(format) + "f"); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_magnetsmooth", type.trigger_magnet_smooth.ToString(format) + "f"); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_magnetic", type.trigger_magnetic.ToString().ToLower()); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_enemy", type.trigger_shoot_enemies.ToString().ToLower()); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_team", type.trigger_shoot_teammates.ToString().ToLower()); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_delay", type.trigger_delay.ToString()); sourceFinal = sourceFinal.ReplaceComment($"setting_triggerbot_{typeName}_overshoot", type.trigger_overshoot.ToString()); } if (nud_trigger_thread_delay.Value > 0) { sourceFinal = sourceFinal.ReplaceComment("setting_trigger_thread_delay", Convert.ToInt32(nud_trigger_thread_delay.Value).ToString()); } if (!cb_trigger_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_triggerbot"); } #endregion #region visual settings // Teammate settings sourceFinal = sourceFinal.ReplaceComment("setting_visuals_teammate_color_r", lbl_visuals_teammates_color.BackColor.R.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_teammate_color_g", lbl_visuals_teammates_color.BackColor.G.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_teammate_color_b", lbl_visuals_teammates_color.BackColor.B.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_teammate_alpha", Convert.ToInt32(nud_visuals_teammates_glowalpha.Value).ToString()); if (!cb_visuals_teammates_visibleonly.Checked) { sourceFinal = sourceFinal.EraseComment("feature_visuals_teammate_chams_enabled"); } else { sourceFinal = sourceFinal.EraseComment("feature_visuals_teammate_chams_disabled"); } if (!cb_visuals_teammates_healthbased.Checked) { sourceFinal = sourceFinal.EraseComment("feature_teammate_healthbased"); } if (!cb_visuals_teammates_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_visuals_teammate"); } // Enemy settings sourceFinal = sourceFinal.ReplaceComment("setting_visuals_enemy_color_r", lbl_visuals_enemies_color.BackColor.R.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_enemy_color_g", lbl_visuals_enemies_color.BackColor.G.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_enemy_color_b", lbl_visuals_enemies_color.BackColor.B.ToString()); sourceFinal = sourceFinal.ReplaceComment("setting_visuals_enemy_alpha", Convert.ToInt32(nud_visuals_enemies_glowalpha.Value).ToString()); if (!cb_visuals_enemies_visibleonly.Checked) { sourceFinal = sourceFinal.EraseComment("feature_visuals_enemy_chams_enabled"); } else { sourceFinal = sourceFinal.EraseComment("feature_visuals_enemy_chams_disabled"); } if (!cb_visuals_enemies_healthbased.Checked) { sourceFinal = sourceFinal.EraseComment("feature_enemy_healthbased"); } if (!cb_visuals_enemies_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_visuals_enemy"); } // Settings that apply to both if (!cb_visuals_teammates_healthbased.Checked && !cb_visuals_enemies_healthbased.Checked) { sourceFinal = sourceFinal.EraseComment("feature_healthbased"); } if (nud_visuals_thread_delay.Value > 0) { sourceFinal = sourceFinal.ReplaceComment("setting_visuals_thread_delay", Convert.ToInt32(nud_visuals_thread_delay.Value).ToString()); } else { sourceFinal = sourceFinal.EraseComment("feature_visuals_thread_delay"); } if (!cb_visuals_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_visuals"); } #endregion #region misc settings // Bunny hop sourceFinal = sourceFinal.ReplaceComment("setting_bhop_key", KeyManagement.KeyFromText(txt_bhop_key.Text).ToString()); if (!cb_bhop_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_bhop"); } // No flash sourceFinal = sourceFinal.ReplaceComment("setting_noflash_percent", nud_noflash_percent.Value.ToString()); if (!cb_noflash_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_noflash"); } // Recoil control sourceFinal = sourceFinal.ReplaceComment("setting_rcs_scale_x", ((float)nud_rcs_x_percent.Value * 0.02f).ToString(format) + "f"); sourceFinal = sourceFinal.ReplaceComment("setting_rcs_scale_y", ((float)nud_rcs_y_percent.Value * 0.02f).ToString(format) + "f"); if (!cb_rcs_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_rcs"); } // Radar if (!cb_radar_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_radar"); } // FOV Changer sourceFinal = sourceFinal.ReplaceComment("setting_custom_fov", nud_fov_changer.Value.ToString()); if (!cb_fov_changer.Checked) { sourceFinal = sourceFinal.EraseComment("feature_fov_changer"); } // Skin Changer sourceFinal = sourceFinal.ReplaceComment("setting_skinchanger_bat", Randomize.String() + ".bat"); if (!cb_skinchanger_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("feature_skinchanger"); } #endregion #region removals if (!cb_aimbot_enabled.Checked && !cb_trigger_enabled.Checked) { sourceFinal = sourceFinal.EraseComment("weapon_type_lists"); } #endregion #endregion txtLog.Log("Implemented selected settings."); sourceFinal = Randomize.RandomizeOrders(sourceFinal); txtLog.Log("Randomized order of code."); sourceFinal = Randomize.Code("rnd", sourceFinal); txtLog.Log("Randomized class names."); txtLog.Log("Randomized variable names."); txtLog.Log("Randomized namespace names."); txtLog.Log("Randomized method names."); txtLog.Log("Randomized goto labels."); sourceFinal = OffsetList.ReplaceOffsets(sourceFinal); txtLog.Log("Replaced offset variables."); sourceFinal = Randomize.ReplaceNumbers(sourceFinal); //txtLog.Log("Replaced numbers with new sigs."); // Does nothing so excluding from logs for now. sourceFinal = sourceFinal.Junkify(); txtLog.Log("Distributed randomized junk code."); sourceFinal = sourceFinal.ReplaceComment("setting_window_title", Randomize.String(16, 32)); sourceFinal = sourceFinal.ReplaceComment("dynago_version", Program.currentVersion); sourceFinal = sourceFinal.ReplaceComment("dynago_user", Program.currentUser); txtLog.Log("Replaced dynamic build strings."); // ENABLE WHEN TESTING Clipboard.SetText(sourceFinal); new Thread(() => { List <string> errors = Compiler.Compile(sourceFinal, txt_build_path.Text); bool success = errors.Count == 0; if (success) { txtLog.Log("Compiled cheat to " + Path.GetFileName(txt_build_path.Text)); // Credits to ConfuserEx (https://yck1509.github.io/ConfuserEx/) // Works by using the Confuser CLI obfuscate an assembly with settings from a .crproj file. if (cb_obfuscation_enabled.Checked) { txtLog.Log("Beginning obfuscation process..."); txtLog.Log("Installing obfuscation dependencies..."); string obf = Program.directory + "\\" + Randomize.String(); Confuser.Install(obf); string confuserPreset = cmb_obfuscation_preset.SelectedItem.ToString(); txtLog.Log("Running obfuscation file..."); string confuserOutput = Confuser.Obfuscate(obf, txt_build_path.Text, confuserPreset); Regex completionCheck = new Regex("Finished at.* elapsed."); Match completionMatch = completionCheck.Match(confuserOutput); if (completionMatch.Success) { txtLog.Log("Build obfuscated successfully."); } else { txtLog.Log("Build obfuscation failed & skipped.", Color.Yellow); } } DialogResult result = MessageBox.Show("Cheat compiled successfully.\nWould you like to run it now?", "Dynago", MessageBoxButtons.YesNo, MessageBoxIcon.Information); try { if (result == DialogResult.Yes) { ProcessStartInfo info = new ProcessStartInfo(txt_build_path.Text); info.UseShellExecute = true; info.Verb = "runas"; Process.Start(info); } } catch (Exception) { MessageBox.Show("Failed to run the cheat.\nPlease launch Dynago manually.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { txtLog.Log("Oh no! There were " + errors.Count + " errors.", Color.Yellow); foreach (string err in errors) { txtLog.Log(err, Color.Red); } // upload sourcefinal + error log to server??? string result = string.Empty; if (string.IsNullOrEmpty(result)) { result = "Shit is scuffed."; } txtLog.Log("Error log ID: " + result, Color.Yellow); txtLog.Log("[Please give that to Me-re-ly]", Color.Green); MessageBox.Show("Build failed!\nWe found some errors :(", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }).Start(); BuildInProgress = false; }
/// <summary> /// Constructs for all variants of <see cref="Span(string, int, SpanCondition)"/>, or only for any one variant. /// Initializes as little as possible, for single use. /// </summary> public UnicodeSetStringSpan(UnicodeSet set, IList <string> setStrings, int which) { spanSet = new UnicodeSet(0, 0x10ffff); // TODO: With Java 6, just take the parent set's strings as is, // as a NavigableSet<String>, rather than as an ArrayList copy of the set of strings. // Then iterate via the first() and higher() methods. // (We do not want to create multiple Iterator objects in each span().) // See ICU ticket #7454. strings = setStrings; all = (which == All); spanSet.RetainAll(set); if (0 != (which & NotContained)) { // Default to the same sets. // addToSpanNotSet() will create a separate set if necessary. spanNotSet = spanSet; } offsets = new OffsetList(); // Determine if the strings even need to be taken into account at all for span() etc. // If any string is relevant, then all strings need to be used for // span(longest match) but only the relevant ones for span(while contained). // TODO: Possible optimization: Distinguish CONTAINED vs. LONGEST_MATCH // and do not store UTF-8 strings if !thisRelevant and CONTAINED. // (Only store irrelevant UTF-8 strings for LONGEST_MATCH where they are relevant after all.) // Also count the lengths of the UTF-8 versions of the strings for memory allocation. int stringsLength = strings.Count; int i, spanLength; int maxLength16 = 0; someRelevant = false; for (i = 0; i < stringsLength; ++i) { string str = strings[i]; int length16 = str.Length; spanLength = spanSet.Span(str, SpanCondition.Contained); if (spanLength < length16) { // Relevant string. someRelevant = true; } if (/* (0 != (which & UTF16)) && */ length16 > maxLength16) { maxLength16 = length16; } } this.maxLength16 = maxLength16; if (!someRelevant && (which & WithCount) == 0) { return; } // Freeze after checking for the need to use strings at all because freezing // a set takes some time and memory which are wasted if there are no relevant strings. if (all) { spanSet.Freeze(); } int spanBackLengthsOffset; // Allocate a block of meta data. int allocSize; if (all) { // 2 sets of span lengths allocSize = stringsLength * (2); } else { allocSize = stringsLength; // One set of span lengths. } spanLengths = new short[allocSize]; if (all) { // Store span lengths for all span() variants. spanBackLengthsOffset = stringsLength; } else { // Store span lengths for only one span() variant. spanBackLengthsOffset = 0; } // Set the meta data and spanNotSet and write the UTF-8 strings. for (i = 0; i < stringsLength; ++i) { string str = strings[i]; int length16 = str.Length; spanLength = spanSet.Span(str, SpanCondition.Contained); if (spanLength < length16) { // Relevant string. if (true /* 0 != (which & UTF16) */) { if (0 != (which & Contained)) { if (0 != (which & Forward)) { spanLengths[i] = MakeSpanLengthByte(spanLength); } if (0 != (which & Backward)) { spanLength = length16 - spanSet.SpanBack(str, length16, SpanCondition.Contained); spanLengths[spanBackLengthsOffset + i] = MakeSpanLengthByte(spanLength); } } else /* not CONTAINED, not all, but NOT_CONTAINED */ { spanLengths[i] = spanLengths[spanBackLengthsOffset + i] = 0; // Only store a relevant/irrelevant // flag. } } if (0 != (which & NotContained)) { // Add string start and end code points to the spanNotSet so that // a span(while not contained) stops before any string. int c; if (0 != (which & Forward)) { c = str.CodePointAt(0); AddToSpanNotSet(c); } if (0 != (which & Backward)) { c = str.CodePointBefore(length16); AddToSpanNotSet(c); } } } else { // Irrelevant string. if (all) { spanLengths[i] = spanLengths[spanBackLengthsOffset + i] = ALL_CP_CONTAINED; } else { // All spanXYZLengths pointers contain the same address. spanLengths[i] = ALL_CP_CONTAINED; } } } // Finish. if (all) { spanNotSet.Freeze(); } }
private void btnSaveChanges_Click(object sender, EventArgs e) { int valid = 0; string offsetData = txtOffsets.Text; foreach (Offset offset in offsets) { Regex regex = new Regex(offset.GetName() + ":.*"); Match m = regex.Match(offsetData); if (!m.Success) { goto offset_not_found; } string data = m.Value.Split(' ').GetValue(1).ToString(); if (data.Length < 1) { goto offset_not_found; } bool hexadecimal = false; try { hexadecimal = data.Substring(0, 2).ToLower() == "0x"; } catch (Exception) { } // Don't handle it, we'll just assume it's not hexadecimal... if (hexadecimal) { // Using hexadecimal. try { int value = Convert.ToInt32(data, 16); offset.SetValue(value); valid++; continue; } catch (System.FormatException) { goto offset_error_converting; } catch (Exception) { goto offset_error_unknown; } } else { // Using decimal. try { int value = Convert.ToInt32(data); offset.SetValue(value); valid++; continue; } catch (System.FormatException) { goto offset_error_converting; } catch (Exception) { goto offset_error_unknown; } } offset_not_found: MessageBox.Show("An error has occurred while finding " + offset.GetName() + ".", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; offset_error_converting: MessageBox.Show("An error has occurred while converting " + offset.GetName() + ".", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; offset_error_unknown: MessageBox.Show("An unknown error has occurred while parsing data from " + offset.GetName() + ".", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Warning); continue; } OffsetList.RefreshOffsets(listBox); Hide(); MessageBox.Show(valid + "/" + offsets.Count + " offsets were parsed and replaced successfully.", "Dynago", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); }