public void Refresh() { itemTypes = LegacyMemoryReader.ReadBytes(_offsetItemType, 0x88); itemCounts = LegacyMemoryReader.ReadBytes(_offsetItemCount, 0x44); for (int i = 0; i < 68; i++) { var button = (Button)ItemsGrid.Children[i]; if (button == null) { continue; } SetButtonText((Button)button, i); button.Click += (sender, args) => { var itemNum = int.Parse(button.Name.Substring(4)); if (itemNum == editingItem && editingButton != null) { return; } SetButtonBox(button, itemNum); (button.Content as StackPanel).UpdateLayout(); (button.Content as StackPanel).Children[1].Focus(); }; } }
private void WriteAbility(int index, int abilityId) { LegacyMemoryReader.WriteBytes( _abilityOffset + (_creatureIndex * 0xE38) + (index * 2), BitConverter.GetBytes((ushort)abilityId)); Refresh(); }
public void Refresh() { var creatureBytes = LegacyMemoryReader.ReadBytes(_abilityOffset + (_creatureIndex * 0xE38), 0x16); // Refresh commands for (int commandSlot = 0; commandSlot < 8; commandSlot++) { var commandId = BitConverter.ToUInt16(creatureBytes, commandSlot * 2); var commandButton = (Button)this.FindName("Command" + commandSlot); if (commandButton == null) { return; } if (commandId == 0xFF || commandId == 0x0) { commandButton.Content = string.Empty; } else { var command = Commands.GetCommand(commandId); if (command != null) { SetCommandText(commandButton, command); } else { var auto = AutoAbilities.GetAutoAbility(commandId); SetAutoAbilityText(commandButton, auto); } } } }
private ushort ReadAbility(int index) { var creatureBytes = LegacyMemoryReader.ReadBytes(_abilityOffset + (_creatureIndex * 0xE38), 0x16); var abilityId = BitConverter.ToUInt16(creatureBytes, index * 2); return(abilityId); }
public void Refresh() { _refreshing = true; var garmentGridBytes = LegacyMemoryReader.ReadBytes(_offsetGarmentGrids, 8); var ggLen = GarmentGrids.GarmentGridList.Length; for (int i = 0; i < GarmentGrids.GarmentGridList.Length; i++) { CheckBox checkBox = null; if (i < ggLen / 2) { checkBox = (CheckBox)GarmentGridList.Children[i]; } else { checkBox = (CheckBox)GarmentGridList2.Children[i - ggLen / 2]; } if (checkBox == null) { continue; } var byteIndex = i / 8; var bitIndex = i % 8; byte mask = (byte)(1 << bitIndex); bool isSet = (garmentGridBytes[byteIndex] & mask) != 0; checkBox.IsChecked = isSet; } _refreshing = false; }
private void GarmentGridChanged(object sender, RoutedEventArgs routedEventArgs) { if (_refreshing) { return; } var checkBox = sender as CheckBox; if (checkBox == null) { return; } var gridIndex = int.Parse(checkBox.Name.Substring(4)); var byteIndex = gridIndex / 8; var bitIndex = gridIndex % 8; var garmentGridBytes = LegacyMemoryReader.ReadBytes(_offsetGarmentGrids, 8); var gByte = garmentGridBytes[byteIndex]; var mask = (1 << bitIndex); var newByte = gByte ^ (byte)mask; LegacyMemoryReader.WriteBytes(_offsetGarmentGrids + byteIndex, new byte[] { (byte)newByte }); Refresh(); }
public void UpdateCreaturesMethod() { var tabs = TabCreatures.Items.SourceCollection.OfType <TabItem>().ToArray(); var creatureCount = LegacyMemoryReader.ReadByte(0x9FA6C1); for (int i = 0; i < 8; i++) { var creatureTab = tabs[i]; if (creatureTab == null) { continue; } if (i >= creatureCount) { creatureTab.Visibility = Visibility.Collapsed; continue; } creatureTab.Visibility = Visibility.Visible; var nameBytes = LegacyMemoryReader.ReadBytes(_offsetCreatureName + (i * 40), 18); var name = StringConverter.ToASCII(nameBytes); creatureTab.Header = name; _editors[i].Refresh(); } }
public static void MaxSphereLevels() { var partyOffset = OffsetScanner.GetOffset(GameOffset.FFX_PartyStatBase); for (var i = 0; i < 8; i++) { int characterOffset = partyOffset + 0x94 * i; LegacyMemoryReader.WriteByte(StructHelper.GetFieldOffset <PartyMember>("SphereLevelCurrent", characterOffset), 255); } }
private void CommandButton_RightMouseDown(object sender, MouseButtonEventArgs e) { var senderButton = sender as Button; if (senderButton == null) { return; } var buttonIndex = int.Parse(senderButton.Name.Substring(7)); var abilityId = LegacyMemoryReader.ReadInt16(_abilityOffset + (0xE38 * _creatureIndex) + (2 * buttonIndex)); ShowButtonBox(senderButton, abilityId.ToString("X2")); }
public void Refresh() { var dressBytes = LegacyMemoryReader.ReadBytes(_offsetDresspheres, 30); for (int d = 1; d <= 29; d++) { var dressBox = (TextBox)FindName("Dressphere" + d); if (dressBox == null) { continue; } dressBox.Text = dressBytes[d].ToString(); } }
private void SelectProcess_Click(object sender, RoutedEventArgs e) { if (!_ready || ProcessList.SelectedItems.Count != 1) { return; } var selectedProcess = ((ProcessListItem)ProcessList.SelectedItem).Process; var attachResult = GameMemory.Attach(selectedProcess); if (attachResult == false) { return; } LegacyMemoryReader.Attach(selectedProcess); DialogResult = true; Close(); }
private void NumGil_OnKeyDown(object sender, KeyEventArgs e) { if (e.Key != Key.Enter) { return; } var gil = 0; var parsed = int.TryParse(NumGil.Text, out gil); if (!parsed) { // error parsing gil MessageBox.Show("The value you entered was invalid.", "Error parsing gil", MessageBoxButton.OK, MessageBoxImage.Error); return; } LegacyMemoryReader.WriteBytes(_offsetCurrentGil, BitConverter.GetBytes((uint)gil)); }
public static void LearnAllAbilities() { var partyOffset = OffsetScanner.GetOffset(GameOffset.FFX_PartyStatBase); for (var i = 0; i < 18; i++) { int characterAbilityOffset = partyOffset + Marshal.SizeOf <PartyMember>() * i + StructHelper.GetFieldOffset <PartyMember>("SkillFlags");; var currentAbilities = LegacyMemoryReader.ReadBytes(characterAbilityOffset, 13); // Flip all normal ability bits currentAbilities[1] |= 0xF0; for (int b = 2; b < 11; b++) { currentAbilities[b] |= 0xFF; } currentAbilities[11] |= 0x0F; currentAbilities[12] |= 0xFF; LegacyMemoryReader.WriteBytes(characterAbilityOffset, currentAbilities); } }
private void DressBox_KeyDown(object sender, KeyEventArgs e) { var dressBox = (TextBox)sender; if (dressBox == null) { return; } switch (e.Key) { case Key.Enter: var dressIndex = int.Parse(dressBox.Name.Substring(10)); var quantity = 0; var parsed = int.TryParse(dressBox.Text, out quantity); if (parsed && quantity <= 127 && quantity >= 0) { LegacyMemoryReader.WriteBytes(_offsetDresspheres + dressIndex, new byte[] { (byte)quantity }); Refresh(); } else { MessageBox.Show("Please enter a number between 0 and 127.", "Value input error", MessageBoxButton.OK, MessageBoxImage.Error); } break; case Key.Escape: Refresh(); dressBox.SelectionStart = 0; dressBox.SelectionLength = dressBox.Text.Length; break; default: break; } }