2014-06-28 21:22:05 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX
|
|
|
|
|
{
|
|
|
|
|
public partial class SAV_BoxLayout : Form
|
|
|
|
|
{
|
2014-10-11 07:22:22 +00:00
|
|
|
|
public SAV_BoxLayout(Form1 frm1)
|
2014-06-28 21:22:05 +00:00
|
|
|
|
{
|
2014-10-11 07:22:22 +00:00
|
|
|
|
m_parent = frm1;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
InitializeComponent();
|
2014-12-20 04:19:41 +00:00
|
|
|
|
Util.TranslateInterface(this, Form1.curlanguage);
|
2014-07-27 03:21:31 +00:00
|
|
|
|
editing = true;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
Array.Copy(m_parent.savefile, sav, 0x100000);
|
|
|
|
|
savindex = m_parent.savindex;
|
2014-08-02 06:03:14 +00:00
|
|
|
|
|
|
|
|
|
// Repopulate Wallpaper names
|
|
|
|
|
CB_BG.Items.Clear();
|
2015-03-11 01:44:51 +00:00
|
|
|
|
foreach (string wallpaper in Form1.wallpapernames)
|
|
|
|
|
CB_BG.Items.Add(wallpaper);
|
2014-08-02 06:03:14 +00:00
|
|
|
|
|
|
|
|
|
// Go
|
2015-05-07 02:30:31 +00:00
|
|
|
|
LB_BoxSelect.SelectedIndex = m_parent.CB_BoxSelect.SelectedIndex;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
Form1 m_parent;
|
2014-12-12 05:45:01 +00:00
|
|
|
|
public byte[] sav = new byte[0x100000];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
public int savindex;
|
2015-03-12 04:44:12 +00:00
|
|
|
|
public bool editing;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
private void changeBox(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
editing = true;
|
|
|
|
|
int index = LB_BoxSelect.SelectedIndex;
|
|
|
|
|
int offset = 0x9800 + savindex * 0x7F000;
|
2014-08-02 06:03:14 +00:00
|
|
|
|
int bgoff = (0x7F000 * savindex) + 0x9C1E + LB_BoxSelect.SelectedIndex;
|
|
|
|
|
CB_BG.SelectedIndex = sav[bgoff];
|
|
|
|
|
changeBoxBG(null, null);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
TB_BoxName.Text = Encoding.Unicode.GetString(sav, offset + 0x22 * index, 0x22);
|
2014-08-02 06:03:14 +00:00
|
|
|
|
CB_BG.SelectedIndex = sav[0x9C1E + savindex * 0x7F000 + index];
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
|
|
|
|
MT_BG1.Text = sav[0x9C3D + savindex * 0x7F000].ToString();
|
2014-07-27 03:21:31 +00:00
|
|
|
|
MT_BG2.Text = sav[0x9C3F + savindex * 0x7F000].ToString();
|
|
|
|
|
|
|
|
|
|
CB_Unlocked.SelectedIndex = sav[0x9C3E + savindex * 0x7F000] - 1;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
editing = false;
|
|
|
|
|
}
|
|
|
|
|
private void changeBoxDetails(object sender, EventArgs e)
|
|
|
|
|
{
|
2015-03-12 04:44:12 +00:00
|
|
|
|
if (editing) return;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-03-12 04:44:12 +00:00
|
|
|
|
int index = LB_BoxSelect.SelectedIndex;
|
|
|
|
|
int offset = 0x9800 + savindex * 0x7F000;
|
2014-08-02 06:03:14 +00:00
|
|
|
|
|
2015-03-12 04:44:12 +00:00
|
|
|
|
sav[(0x7F000 * savindex) + 0x9C1E + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex;
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-03-12 04:44:12 +00:00
|
|
|
|
// Get Sender Index
|
2014-06-28 21:22:05 +00:00
|
|
|
|
|
2015-03-12 04:44:12 +00:00
|
|
|
|
byte[] boxname = Encoding.Unicode.GetBytes(TB_BoxName.Text);
|
|
|
|
|
Array.Resize(ref boxname, 0x22);
|
|
|
|
|
Array.Copy(boxname, 0, sav, offset + 0x22 * index, boxname.Length);
|
2014-07-27 03:21:31 +00:00
|
|
|
|
|
2015-03-12 04:44:12 +00:00
|
|
|
|
sav[0x9C1E + savindex * 0x7F000 + index] = (byte)CB_BG.SelectedIndex;
|
|
|
|
|
sav[0x9C3D + savindex * 0x7F000] = (byte)Util.ToUInt32(MT_BG1.Text);
|
|
|
|
|
sav[0x9C3F + savindex * 0x7F000] = (byte)Util.ToUInt32(MT_BG2.Text);
|
|
|
|
|
sav[0x9C3E + savindex * 0x7F000] = (byte)Util.ToUInt32(CB_Unlocked.Text);
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
Close();
|
|
|
|
|
}
|
2014-08-02 06:03:14 +00:00
|
|
|
|
|
|
|
|
|
private void changeBoxBG(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
sav[(0x7F000 * savindex) + 0x9C1E + LB_BoxSelect.SelectedIndex] = (byte)CB_BG.SelectedIndex;
|
2014-11-22 03:26:16 +00:00
|
|
|
|
|
|
|
|
|
string imagename = "box_wp" + (CB_BG.SelectedIndex + 1).ToString("00"); if (m_parent.savegame_oras && (CB_BG.SelectedIndex + 1) > 16) imagename += "o";
|
|
|
|
|
PAN_BG.BackgroundImage = (Image)Properties.Resources.ResourceManager.GetObject(imagename);
|
2014-08-02 06:03:14 +00:00
|
|
|
|
}
|
2014-06-28 21:22:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|