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