From f97417fe85ab1fee0049a3df2cf91deaef52ce2f Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 6 Jan 2019 22:21:25 -0800 Subject: [PATCH] Remove some unused bitflag regions cuts down memory footprint by quite a bit (bool[] is 4bytes per bool) --- PKHeX.Core/PersonalInfo/PersonalInfoGG.cs | 11 ++++++++++- PKHeX.Core/PersonalInfo/PersonalInfoSM.cs | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoGG.cs b/PKHeX.Core/PersonalInfo/PersonalInfoGG.cs index 94bf68f4b..1fd2a5b2a 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoGG.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoGG.cs @@ -7,7 +7,16 @@ namespace PKHeX.Core /// public class PersonalInfoGG : PersonalInfoSM { - public PersonalInfoGG(byte[] data) : base(data) { } + public PersonalInfoGG(byte[] data) + { + if (data.Length != SIZE) + return; + Data = data; + + TMHM = GetBits(Data, 0x28, 8); // only 60 TMs used + TypeTutors = GetBits(Data, 0x38, 1); // at most 8 flags used + } + public int GoSpecies { get => BitConverter.ToUInt16(Data, 0x48); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x48); } } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs index 6320cfcf6..0709bc7f6 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoSM.cs @@ -7,6 +7,7 @@ namespace PKHeX.Core /// public class PersonalInfoSM : PersonalInfoXY { + protected PersonalInfoSM() { } // For GG public new const int SIZE = 0x54; public PersonalInfoSM(byte[] data)