private void LoadForm(object sender, EventArgs e) { if (Host.Filename != null && Host.Filename != null) { //Creates a new read object Read = new NSE_Framework.Read(Host.Filename); //Creates a new write object Write = new NSE_Framework.Write(Host.Filename); //see if were eddting a pokemon game if (Read.ReadString(0xA0, 7).ToLower() == "pokemon") { //gets the header Header = Read.ReadString(0xAC, 4); if (Header.Substring(0, 2) == "BP") { #region FIRERED_LEAFGREEN_EMERALD FrontTable = Read.ReadPointer(0x128); BackTable = Read.ReadPointer(0x12C); NormalTable = Read.ReadPointer(0x130); ShinyTable = Read.ReadPointer(0x134); MiniSpriteTable = Read.ReadPointer(0x138); MiniPaletteIndex = Read.ReadPointer(0x13C); MiniPalettes = Read.ReadPointer(0x140); MAX = 439; if (!NSE2.Program.MainForm.SafetyRepointing) { if (MessageBox.Show(this, "It seems that SafetyRepointing is disabled:\nIt's suggested that you enable SafetyRepointing for best results.\nEnable SafetyRepointing?", "Notice:", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.Yes) { NSE2.Program.MainForm.SafetyRepointing = true; } } CanNavigate = true; #endregion } else { MessageBox.Show("Currently this plugin only supports Firered, Leafgreen and Emerald.\n-Link12552", "Notice:", MessageBoxButtons.OK); } Navigate(); NumericUpDownPalette.Enabled = true; // Wires the EDITBOX to NSE Host.SetEditor(ref EditBox); } } }
private void MainForm_Load(object sender, EventArgs e) { this.RomHeader = read.ReadString(0xAC, 4); findTables(this.RomHeader); if (this.SpriteTable == 0x0) { this.Close(); return; } #region FindPalette foundPalettes = new List <byte>(); byte indicator = 0x1; int take = 0; byte b; while (indicator != 0x0) { b = read.ReadByte(PaletteTable + 8 * take + 4); if (!foundPalettes.Contains(b)) { foundPalettes.Add(b); } indicator = read.ReadByte(PaletteTable + 8 * take + 5); take++; } #endregion iEditBox.Image = new Bitmap(128, 128); iPaletteBox.Image = new Bitmap(32, 128); editColorIndex = 0; navigate(); LabelInfo.Text = this.RomHeader + " - " + read.ReadString(0xA0, 12); //this.Edit.Zoom = 2; }