diff --git a/PKHeX.Core/Saves/Substructures/EntreeForest/EntreeSlot.cs b/PKHeX.Core/Saves/Substructures/EntreeForest/EntreeSlot.cs index 3dd4a5881..2b2720088 100644 --- a/PKHeX.Core/Saves/Substructures/EntreeForest/EntreeSlot.cs +++ b/PKHeX.Core/Saves/Substructures/EntreeForest/EntreeSlot.cs @@ -4,31 +4,54 @@ namespace PKHeX.Core { public class EntreeSlot { + /// + /// index + /// public int Species // bits 0-10 { get => (int)(RawValue & 0x3FF) >> 0; set => RawValue = (RawValue & 0xFFFF_F800) | ((uint)(value & 0x3FF) << 0); } + + /// + /// Special Move + /// public int Move // bits 11-20 { get => (int)(RawValue & 0x001F_F800) >> 11; - set => RawValue = (RawValue & 0xFFF0_02FF) | ((uint)(value & 0x3FF) << 11); + set => RawValue = (RawValue & 0xFFE0_07FF) | ((uint)(value & 0x3FF) << 11); } + + /// + /// index + /// public int Gender // bits 21-22 { get => (int)(RawValue & 0x0060_0000) >> 21; set => RawValue = (RawValue & 0xFF9F_FFFF) | ((uint)(value & 0x3) << 21); } + + /// + /// index + /// public int Form // bits 23-27 { get => (int)(RawValue & 0x0F80_0000) >> 23; set => RawValue = (RawValue & 0xF07F_FFFF) | ((uint)(value & 0x1F) << 23); } + + /// + /// Visibility Flag + /// public bool Invisible // bit 28 { get => ((RawValue >> 28) & 1) == 1; set => RawValue = (RawValue & 0xEFFFFFFF) | (value ? 0 : 1u << 28); } + + /// + /// Animation Leash (How many steps it can deviate from its spawn location). + /// public int Animation // bits 29-31 { get => (int)(RawValue >> 29); @@ -38,6 +61,9 @@ public class EntreeSlot private readonly byte[] Data; private readonly int Offset; + /// + /// Raw Data Value + /// public uint RawValue { get => BitConverter.ToUInt32(Data, Offset); diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs index d7a58e51c..18b4a980c 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen5/SAV_Misc5.cs @@ -541,8 +541,8 @@ private void LoadForest() CB_Move.ValueMember = nameof(ComboItem.Value); CB_Areas.ValueMember = nameof(ComboItem.Value); - CB_Species.DataSource = new BindingSource(GameInfo.Strings.SpeciesDataSource, null); - CB_Move.DataSource = new BindingSource(GameInfo.Strings.MoveDataSource, null); + CB_Species.DataSource = new BindingSource(GameInfo.SpeciesDataSource.Where(s => s.Value <= SAV.MaxSpeciesID).ToList(), null); + CB_Move.DataSource = new BindingSource(GameInfo.MoveDataSource, null); CB_Areas.DataSource = new BindingSource(areas, null); CB_Areas.SelectedIndex = 0; @@ -574,7 +574,7 @@ private void ChangeSlot(object sender, EventArgs e) SetGenders(current); CB_Move.SelectedValue = current.Move; CB_Gender.SelectedValue = current.Gender; - CB_Form.SelectedValue = current.Form; + CB_Form.SelectedIndex = current.Form; CurrentSlot = current; SetSprite(current); } @@ -624,6 +624,7 @@ private void B_RandForest_Click(object sender, EventArgs e) { int r = Util.Rand.Next(source.Count); var slot = source[r]; + source.Remove(slot); s.Species = slot.Species; s.Form = slot.Form; s.Move = slot.Moves?[Util.Rand.Next(slot.Moves.Length)] ?? 0;