mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-16 00:58:01 +00:00
80 lines
2.6 KiB
C#
80 lines
2.6 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.ComponentModel;
|
|||
|
using System.Data;
|
|||
|
using System.Drawing;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Windows.Forms;
|
|||
|
|
|||
|
namespace PKHeX
|
|||
|
{
|
|||
|
public partial class SAV_BoxLayout : Form
|
|||
|
{
|
|||
|
public SAV_BoxLayout(Form1 frm1)
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
m_parent = frm1;
|
|||
|
Array.Copy(m_parent.savefile, sav, 0x100000);
|
|||
|
savindex = m_parent.savindex;
|
|||
|
LB_BoxSelect.SelectedIndex = 0;
|
|||
|
}
|
|||
|
|
|||
|
Form1 m_parent;
|
|||
|
public byte[] sav = new Byte[0x100000];
|
|||
|
public int savindex;
|
|||
|
public bool editing = false;
|
|||
|
private static uint ToUInt32(String value)
|
|||
|
{
|
|||
|
if (String.IsNullOrEmpty(value))
|
|||
|
return 0;
|
|||
|
return UInt32.Parse(value);
|
|||
|
}
|
|||
|
|
|||
|
private void changeBox(object sender, EventArgs e)
|
|||
|
{
|
|||
|
editing = true;
|
|||
|
int index = LB_BoxSelect.SelectedIndex;
|
|||
|
int offset = 0x9800 + savindex * 0x7F000;
|
|||
|
|
|||
|
TB_BoxName.Text = Encoding.Unicode.GetString(sav, offset + 0x22 * index, 0x22);
|
|||
|
MT_BG.Text = sav[0x9C1E + savindex * 0x7F000 + index].ToString();
|
|||
|
|
|||
|
MT_BG1.Text = sav[0x9C3D + savindex * 0x7F000].ToString();
|
|||
|
MT_BG2.Text = sav[0x9C3E + savindex * 0x7F000].ToString();
|
|||
|
MT_BG3.Text = sav[0x9C3F + savindex * 0x7F000].ToString();
|
|||
|
editing = false;
|
|||
|
}
|
|||
|
private void changeBoxDetails(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!editing)
|
|||
|
{
|
|||
|
int index = LB_BoxSelect.SelectedIndex;
|
|||
|
int offset = 0x9800 + savindex * 0x7F000;
|
|||
|
|
|||
|
// Get Sender Index
|
|||
|
|
|||
|
byte[] boxname = Encoding.Unicode.GetBytes(TB_BoxName.Text);
|
|||
|
Array.Resize(ref boxname, 0x22);
|
|||
|
Array.Copy(boxname, 0, sav, offset + 0x22 * index, boxname.Length);
|
|||
|
|
|||
|
sav[0x9C1E + savindex * 0x7F000 + index] = (byte)ToUInt32(MT_BG.Text);
|
|||
|
sav[0x9C3D + savindex * 0x7F000] = (byte)ToUInt32(MT_BG1.Text);
|
|||
|
sav[0x9C3E + savindex * 0x7F000] = (byte)ToUInt32(MT_BG2.Text);
|
|||
|
sav[0x9C3F + savindex * 0x7F000] = (byte)ToUInt32(MT_BG3.Text);
|
|||
|
}
|
|||
|
}
|
|||
|
private void B_Cancel_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Close();
|
|||
|
}
|
|||
|
private void B_Save_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
Array.Copy(sav, m_parent.savefile, 0x100000);
|
|||
|
m_parent.savedited = true;
|
|||
|
m_parent.getBoxNames();
|
|||
|
m_parent.getPKXBoxes();
|
|||
|
Close();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|