public override void SaveChanges()
        {
            if (this.m_Data.Length % 4 != 0)
            {
                this.SetSize((uint)(this.m_Data.Length + 3 & -4));
            }
            NitroROM.OverlayEntry[] overlayEntries = this.m_ROM.GetOverlayEntries();
            NitroROM.OverlayEntry   overlayEntry   = overlayEntries[(int)this.m_ID];
            overlayEntry.RAMSize           = (uint)this.m_Data.Length;
            overlayEntries[(int)this.m_ID] = overlayEntry;
            this.m_ROM.ReinsertFile(this.m_FileID, this.m_Data);
            this.Update();
            int num = !this.m_ROM.CanRW() ? 1 : 0;

            if (num != 0)
            {
                this.m_ROM.BeginRW();
            }
            this.m_ROM.Write8(this.m_OVTEntryAddr + 31U, (byte)((uint)this.m_ROM.Read8(this.m_OVTEntryAddr + 31U) & 254U));
            if (num == 0)
            {
                return;
            }
            this.m_ROM.EndRW();
        }
        public override void SaveChanges()
        {
            if (this.m_Data.Length % 4 != 0)
            {
                this.SetSize((uint)(this.m_Data.Length + 3 & -4));
            }

            if (Program.m_IsROMFolder)
            {
                List <Ndst.Overlay> overlays = JsonConvert.DeserializeObject <List <Ndst.Overlay> >(NitroROM.GetExtractedLines("__ROM__/arm9Overlays.json"));
                Ndst.Overlay        o        = overlays.Where(x => x.Id == m_ID).ElementAt(0);
                o.RAMSize = (uint)m_Data.Length;
                o.Flags  &= 0xFFFFFFFE;
                NitroROM.WriteExtractedBytes("__ROM__/Arm9/" + m_ID + ".bin", m_Data);
                string toWrite = JsonConvert.SerializeObject(overlays, Formatting.Indented);
                NitroROM.WriteExtractedLines("__ROM__/arm9Overlays.json", toWrite);
                return;
            }

            NitroROM.OverlayEntry[] overlayEntries = this.m_ROM.GetOverlayEntries();
            NitroROM.OverlayEntry   overlayEntry   = overlayEntries[(int)this.m_ID];
            overlayEntry.RAMSize           = (uint)this.m_Data.Length;
            overlayEntries[(int)this.m_ID] = overlayEntry;
            this.m_ROM.ReinsertFile(this.m_FileID, this.m_Data);
            this.Update();
            int num = !this.m_ROM.CanRW() ? 1 : 0;

            if (num != 0)
            {
                this.m_ROM.BeginRW();
            }
            this.m_ROM.Write8(this.m_OVTEntryAddr + 31U, (byte)((uint)this.m_ROM.Read8(this.m_OVTEntryAddr + 31U) & 254U));
            if (num == 0)
            {
                return;
            }
            this.m_ROM.EndRW();
        }