diff --git a/pkNX.Containers/Misc/AHTB.cs b/pkNX.Containers/Misc/AHTB.cs index fac840ef..2ff342a9 100644 --- a/pkNX.Containers/Misc/AHTB.cs +++ b/pkNX.Containers/Misc/AHTB.cs @@ -52,5 +52,13 @@ protected AHTB(SerializationInfo info, StreamingContext context) public IEnumerable Summary => Entries.Select((z, i) => $"{i:0000}\t{z.Summary}"); public IEnumerable ShortSummary => Entries.Select(z => z.Summary); + + public Dictionary ToDictionary() + { + var map = new Dictionary(); + foreach (var entry in Entries) + map[entry.Hash] = entry.Name; + return map; + } } -} \ No newline at end of file +} diff --git a/pkNX.Structures/Encounter/Gen6/EncounterGift6AO.cs b/pkNX.Structures/Encounter/Gen6/EncounterGift6AO.cs index 1e0bfad6..3a10ab6a 100644 --- a/pkNX.Structures/Encounter/Gen6/EncounterGift6AO.cs +++ b/pkNX.Structures/Encounter/Gen6/EncounterGift6AO.cs @@ -8,7 +8,7 @@ public class EncounterGift6AO : EncounterGift public EncounterGift6AO(byte[] data = null) : base(data ?? new byte[SIZE]) { } public override int Species { get => BitConverter.ToUInt16(Data, 0x00); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x00); } - public int _02 { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } + public int Unk02 { get => BitConverter.ToUInt16(Data, 0x02); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x02); } public override int Form { get => Data[0x04]; set => Data[0x04] = (byte)value; } public override int Level { get => Data[0x05]; set => Data[0x05] = (byte)value; } public override int Ability { get => (sbyte)Data[0x06]; set => Data[0x06] = (byte)value; } @@ -16,15 +16,15 @@ public class EncounterGift6AO : EncounterGift public override Shiny Shiny { get => (Shiny)Data[0x08]; set => Data[0x08] = (byte)value; } // padding? - public int _09 { get => Data[0x09]; set => Data[0x09] = (byte)value; } - public int _0A { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } - public int _0B { get => Data[0x0B]; set => Data[0x0B] = (byte)value; } + public int Unk09 { get => Data[0x09]; set => Data[0x09] = (byte)value; } + public int Unk0A { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } + public int Unk0B { get => Data[0x0B]; set => Data[0x0B] = (byte)value; } public override int HeldItem { get => BitConverter.ToUInt16(Data, 0x0C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0C); } public override FixedGender Gender { get => (FixedGender)Data[0x10]; set => Data[0x10] = (byte)value; } // padding? - public int _11 { get => (sbyte)Data[0x11]; set => Data[0x11] = (byte)value; } + public int Unk11 { get => (sbyte)Data[0x11]; set => Data[0x11] = (byte)value; } public short MetLocation { get => BitConverter.ToInt16(Data, 0x12); set => BitConverter.GetBytes(value).CopyTo(Data, 0x12); } public int Move { get => BitConverter.ToUInt16(Data, 0x14); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x14); } @@ -42,6 +42,6 @@ public class EncounterGift6AO : EncounterGift public int CNT_Tough { get => (sbyte)Data[0x20]; set => Data[0x20] = (byte)value; } public int CNT_Sheen { get => (sbyte)Data[0x21]; set => Data[0x21] = (byte)value; } - public int _22 { get => (sbyte)Data[0x22]; set => Data[0x22] = (byte)value; } + public int Unk22 { get => (sbyte)Data[0x22]; set => Data[0x22] = (byte)value; } } } \ No newline at end of file diff --git a/pkNX.Structures/Encounter/Gen6/EncounterGift6XY.cs b/pkNX.Structures/Encounter/Gen6/EncounterGift6XY.cs index 529096f1..48a494cd 100644 --- a/pkNX.Structures/Encounter/Gen6/EncounterGift6XY.cs +++ b/pkNX.Structures/Encounter/Gen6/EncounterGift6XY.cs @@ -31,6 +31,6 @@ public class EncounterGift6XY : EncounterGift public override int IV_SPE { get => (sbyte)Data[0x16]; set => Data[0x16] = (byte)value; } // padding - public int _17 { get => (sbyte)Data[0x17]; set => Data[0x17] = (byte)value; } + public int Unk17 { get => (sbyte)Data[0x17]; set => Data[0x17] = (byte)value; } } } \ No newline at end of file diff --git a/pkNX.Structures/Encounter/Gen7/EncounterStatic7.cs b/pkNX.Structures/Encounter/Gen7/EncounterStatic7.cs index 27b1ad13..dbb54f82 100644 --- a/pkNX.Structures/Encounter/Gen7/EncounterStatic7.cs +++ b/pkNX.Structures/Encounter/Gen7/EncounterStatic7.cs @@ -49,13 +49,13 @@ public override int Ability set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4)); } - public bool _7 + public bool Unk7_0 { get => (Data[0x7] & 1) >> 0 == 1; set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0)); } - public bool _7_1 + public bool Unk7_1 { get => (Data[0x7] & 2) >> 1 == 1; set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0)); diff --git a/pkNX.Structures/Scripts/AmxError.cs b/pkNX.Structures/Scripts/AmxError.cs index d95b24eb..78f92694 100644 --- a/pkNX.Structures/Scripts/AmxError.cs +++ b/pkNX.Structures/Scripts/AmxError.cs @@ -1,6 +1,8 @@ namespace pkNX.Structures { +#pragma warning disable CA1027 // Mark enums with FlagsAttribute public enum AmxError +#pragma warning restore CA1027 // Mark enums with FlagsAttribute { AMX_ERR_NONE, /* reserve the first 15 error codes for exit codes of the abstract machine */ diff --git a/pkNX.WinForms/Dumping/GameDumperSWSH.cs b/pkNX.WinForms/Dumping/GameDumperSWSH.cs index d3bbd30a..958dd5d0 100644 --- a/pkNX.WinForms/Dumping/GameDumperSWSH.cs +++ b/pkNX.WinForms/Dumping/GameDumperSWSH.cs @@ -114,23 +114,19 @@ public void DumpAHTB() } } - var outname = Path.Combine(DumpFolder, "ahtb.txt"); - var outname2 = Path.Combine(DumpFolder, "ahtblist.txt"); + var outname = GetPath("ahtb.txt"); + var outname2 = GetPath("ahtblist.txt"); File.WriteAllLines(outname, result); File.WriteAllLines(outname2, list); } public static Dictionary ReadAHTB(byte[] bytes) { - Dictionary map = new Dictionary(); if (!AHTB.IsAHTB(bytes)) throw new ArgumentException(); var tbl = new AHTB(bytes); - foreach (var entry in tbl.Entries) - map[entry.Hash] = entry.Name; - - return map; + return tbl.ToDictionary(); } private TrainerEditor GetTrainerEditor()