private void Assemble() { int offset = 0; byte[] temp = new byte[0x700]; MenuTexts lastMenuText = null; foreach (MenuTexts menuText in Model.MenuTexts) { if (lastMenuText != null && menuText.Length != 0 && Bits.Compare(menuText.Text, lastMenuText.Text)) { Bits.SetShort(Model.ROM, menuText.Index * 2 + 0x3EEF00, lastMenuText.Offset); menuText.Offset = lastMenuText.Offset; continue; } if (offset + menuText.Length + 1 >= 0x700) { MessageBox.Show("Menu texts exceed allotted ROM space. Stopped saving at index " + menuText.Index + "."); break; } menuText.Offset = offset; lastMenuText = menuText; // Bits.SetShort(Model.ROM, menuText.Index * 2 + 0x3EEF00, offset); Bits.SetChars(temp, offset, menuText.Text); offset += menuText.Length; temp[offset++] = 0; switch (menuText.Index) { case 14: Bits.SetByteBits(Model.ROM, 0x03328E, (byte)(menuText.X * 2), 0x3F); break; case 15: Bits.SetByteBits(Model.ROM, 0x03327E, (byte)(menuText.X * 2), 0x3F); break; case 16: Bits.SetByteBits(Model.ROM, 0x033282, (byte)(menuText.X * 2), 0x3F); break; case 17: Bits.SetByteBits(Model.ROM, 0x033286, (byte)(menuText.X * 2), 0x3F); break; case 18: Bits.SetByteBits(Model.ROM, 0x03328A, (byte)(menuText.X * 2), 0x3F); break; case 19: Bits.SetByteBits(Model.ROM, 0x03327A, (byte)(menuText.X * 2), 0x3F); break; } } Bits.SetBytes(Model.ROM, 0x3EF000, temp); //Bits.SetShort(Model.Data, 0x3EF600, 0x344F); menus.Assemble(); menus.Modified = false; this.Modified = false; }