mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-22 03:53:08 +00:00
Refactoring
Refactoring complete (for now).
This commit is contained in:
parent
8b3b7ba29b
commit
bf7cd278cc
29 changed files with 1727 additions and 2018 deletions
|
@ -1,10 +1,4 @@
|
|||
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
|
||||
|
@ -14,22 +8,22 @@ namespace PKHeX
|
|||
public About()
|
||||
{
|
||||
InitializeComponent();
|
||||
RTB.Text = PKHeX.Properties.Resources.changelog;
|
||||
RTB.Text = Properties.Resources.changelog;
|
||||
}
|
||||
private void B_Close_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void B_Shortcuts_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (B_Shortcuts.Text == "Shortcuts")
|
||||
{
|
||||
RTB.Text = PKHeX.Properties.Resources.shortcuts; // display shortcuts
|
||||
RTB.Text = Properties.Resources.shortcuts; // display shortcuts
|
||||
B_Shortcuts.Text = "Changelog";
|
||||
}
|
||||
else
|
||||
{
|
||||
RTB.Text = PKHeX.Properties.Resources.changelog; // display changelog
|
||||
RTB.Text = Properties.Resources.changelog; // display changelog
|
||||
B_Shortcuts.Text = "Shortcuts";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
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;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -19,13 +14,13 @@ namespace PKHeX
|
|||
PKX.Structures.SaveGame SaveGame = new PKX.Structures.SaveGame(null);
|
||||
|
||||
Form1 m_parent;
|
||||
byte[] tabdata = null;
|
||||
byte[] tabdata;
|
||||
public CodeGenerator(Form1 frm1, byte[] formdata)
|
||||
{
|
||||
m_parent = frm1;
|
||||
tabdata = formdata;
|
||||
InitializeComponent();
|
||||
this.CenterToParent();
|
||||
CenterToParent();
|
||||
RTB_Code.Clear();
|
||||
TB_Write.Clear();
|
||||
SaveGame = m_parent.SaveGame;
|
||||
|
@ -157,8 +152,7 @@ namespace PKHeX
|
|||
}
|
||||
private void B_Load_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "Code File|*.bin";
|
||||
OpenFileDialog ofd = new OpenFileDialog {Filter = "Code File|*.bin"};
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = ofd.FileName;
|
||||
|
@ -205,9 +199,7 @@ namespace PKHeX
|
|||
Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[2], NumberStyles.HexNumber)),0,ncf,4+i*12+8,4);
|
||||
}
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "code.bin";
|
||||
sfd.Filter = "Code File|*.bin";
|
||||
SaveFileDialog sfd = new SaveFileDialog {FileName = "code.bin", Filter = "Code File|*.bin"};
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = sfd.FileName;
|
||||
|
@ -296,7 +288,7 @@ namespace PKHeX
|
|||
|
||||
lines++;
|
||||
if ((lines % 128 == 0) && CHK_Break.Checked)
|
||||
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1).ToString() + " ---" + Environment.NewLine + Environment.NewLine); }
|
||||
{ result += (Environment.NewLine + "--- Segment " + (lines / 128 + 1) + " ---" + Environment.NewLine + Environment.NewLine); }
|
||||
if (lines > 10000) goto toomany;
|
||||
}
|
||||
|
||||
|
@ -350,19 +342,16 @@ namespace PKHeX
|
|||
{
|
||||
if (RTB_Code.Lines[i].Length <= 2 * 8 && RTB_Code.Lines[i].Length > 2 * 8 + 2)
|
||||
{ Util.Error("Invalid code pasted (Type)"); return; }
|
||||
else
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
// Grab Line Data
|
||||
string line = RTB_Code.Lines[i];
|
||||
string[] rip = Regex.Split(line, " ");
|
||||
Array.Resize(ref data, data.Length + 4);
|
||||
Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[1], NumberStyles.HexNumber)), 0, data, data.Length - 4, 4);
|
||||
}
|
||||
catch (Exception x)
|
||||
{ Util.Error("Invalid code pasted (Content):", x.ToString()); return; }
|
||||
// Grab Line Data
|
||||
string line = RTB_Code.Lines[i];
|
||||
string[] rip = Regex.Split(line, " ");
|
||||
Array.Resize(ref data, data.Length + 4);
|
||||
Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[1], NumberStyles.HexNumber)), 0, data, data.Length - 4, 4);
|
||||
}
|
||||
catch (Exception x)
|
||||
{ Util.Error("Invalid code pasted (Content):", x.ToString()); return; }
|
||||
}
|
||||
}
|
||||
// Go over the data
|
||||
|
@ -373,14 +362,8 @@ namespace PKHeX
|
|||
data[0] = data[1] = data[2] = data[3] = 0;
|
||||
}
|
||||
if ((data.Length == 232) || (data.Length == 260))
|
||||
{
|
||||
this.returnArray = data;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
Util.Error("Invalid code pasted (Length)"); return;
|
||||
}
|
||||
{ returnArray = data; Close(); }
|
||||
else { Util.Error("Invalid code pasted (Length)"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace PKHeX
|
||||
namespace PKHeX
|
||||
{
|
||||
class Legal
|
||||
{
|
||||
|
|
221
Misc/PKX.cs
221
Misc/PKX.cs
|
@ -9,7 +9,7 @@ using System.Text.RegularExpressions;
|
|||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class PKX
|
||||
public class PKX
|
||||
{
|
||||
// C# PKX Function Library
|
||||
// No WinForm object related code, only to calculate information.
|
||||
|
@ -225,11 +225,9 @@ namespace PKHeX
|
|||
int tl = 0; // Initial Level, immediately incremented before loop.
|
||||
while ((uint)table.Rows[++tl][growth + 1] <= exp)
|
||||
{
|
||||
if (tl == 100)
|
||||
{
|
||||
exp = getEXP(100, species); // Fix EXP
|
||||
return 100;
|
||||
}
|
||||
if (tl != 100) continue;
|
||||
exp = getEXP(100, species); // Fix EXP
|
||||
return 100;
|
||||
// After we find the level above ours, we're done.
|
||||
}
|
||||
return --tl;
|
||||
|
@ -285,11 +283,9 @@ namespace PKHeX
|
|||
for (int i = 1; i < inputCSV.Length; i++)
|
||||
{
|
||||
string[] countryData = inputCSV[i].Split(',');
|
||||
if (countryData.Length > 1)
|
||||
{
|
||||
indexes[i - 1] = Convert.ToInt32(countryData[0]);
|
||||
unsortedList[i - 1] = countryData[index + 1];
|
||||
}
|
||||
if (countryData.Length <= 1) continue;
|
||||
indexes[i - 1] = Convert.ToInt32(countryData[0]);
|
||||
unsortedList[i - 1] = countryData[index + 1];
|
||||
}
|
||||
|
||||
int countrynum = Array.IndexOf(indexes, country);
|
||||
|
@ -311,11 +307,9 @@ namespace PKHeX
|
|||
for (int i = 1; i < inputCSV.Length; i++)
|
||||
{
|
||||
string[] countryData = inputCSV[i].Split(',');
|
||||
if (countryData.Length > 1)
|
||||
{
|
||||
indexes[i - 1] = Convert.ToInt32(countryData[0]);
|
||||
unsortedList[i - 1] = countryData[index + 1];
|
||||
}
|
||||
if (countryData.Length <= 1) continue;
|
||||
indexes[i - 1] = Convert.ToInt32(countryData[0]);
|
||||
unsortedList[i - 1] = countryData[index + 1];
|
||||
}
|
||||
|
||||
int regionnum = Array.IndexOf(indexes, region);
|
||||
|
@ -385,11 +379,9 @@ namespace PKHeX
|
|||
// Account for nature
|
||||
int incr = nature / 5 + 1;
|
||||
int decr = nature % 5 + 1;
|
||||
if (incr != decr)
|
||||
{
|
||||
stats[incr] *= 11; stats[incr] /= 10;
|
||||
stats[decr] *= 9; stats[decr] /= 10;
|
||||
}
|
||||
if (incr == decr) return stats; // if neutral return stats without mod
|
||||
stats[incr] *= 11; stats[incr] /= 10;
|
||||
stats[decr] *= 9; stats[decr] /= 10;
|
||||
|
||||
// Return Result
|
||||
return stats;
|
||||
|
@ -440,9 +432,9 @@ namespace PKHeX
|
|||
|
||||
// Decrypt the Party Stats
|
||||
seed = pv;
|
||||
if (pkx.Length > 232)
|
||||
for (int i = 232; i < 260; i += 2)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(pkx, i) ^ (LCRNG(ref seed) >> 16))), 0, pkx, i, 2);
|
||||
if (pkx.Length <= 232) return pkx;
|
||||
for (int i = 232; i < 260; i += 2)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)(BitConverter.ToUInt16(pkx, i) ^ (LCRNG(ref seed) >> 16))), 0, pkx, i, 2);
|
||||
|
||||
return pkx;
|
||||
}
|
||||
|
@ -478,7 +470,7 @@ namespace PKHeX
|
|||
ushort chk = 0;
|
||||
for (int i = 8; i < 232; i += 2) // Loop through the entire PKX
|
||||
chk += BitConverter.ToUInt16(data, i);
|
||||
|
||||
|
||||
return chk;
|
||||
}
|
||||
internal static bool verifychk(byte[] input)
|
||||
|
@ -1001,88 +993,80 @@ namespace PKHeX
|
|||
public string Name;
|
||||
public SaveGame(string GameID)
|
||||
{
|
||||
if (GameID == "XY")
|
||||
switch (GameID)
|
||||
{
|
||||
Name = "XY";
|
||||
Box = 0x27A00;
|
||||
TrainerCard = 0x19400;
|
||||
Party = 0x19600;
|
||||
BattleBox = 0x09E00;
|
||||
Daycare = 0x20600;
|
||||
GTS = 0x1CC00;
|
||||
Fused = 0x1B400;
|
||||
SUBE = 0x22C90;
|
||||
|
||||
Puff = 0x5400;
|
||||
Item = 0x5800;
|
||||
Trainer1 = 0x6800;
|
||||
Trainer2 = 0x9600;
|
||||
PCLayout = 0x9800;
|
||||
Wondercard = 0x21000;
|
||||
BerryField = 0x20C00;
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00;
|
||||
PokeDex = 0x1A400;
|
||||
|
||||
HoF = 0x1E800;
|
||||
JPEG = 0x5C600;
|
||||
PSS = 0x0A400;
|
||||
}
|
||||
else if (GameID == "ORAS")
|
||||
{
|
||||
// Temp
|
||||
Name = "ORAS";
|
||||
Box = 0x38400; // Confirmed
|
||||
TrainerCard = 0x19400; // Confirmed
|
||||
Party = 0x19600; // Confirmed
|
||||
BattleBox = 0x09E00;// Confirmed
|
||||
Daycare = 0x21000; // Confirmed (thanks Rei)
|
||||
GTS = 0x1D600; // Confirmed
|
||||
Fused = 0x1BE00; // Confirmed
|
||||
SUBE = 0x22C90; // ****not in use, not updating?****
|
||||
|
||||
Puff = 0x5400; // Confirmed
|
||||
Item = 0x5800; // Confirmed
|
||||
Trainer1 = 0x6800; // Confirmed
|
||||
Trainer2 = 0x9600; // Confirmed
|
||||
PCLayout = 0x9800; // Confirmed
|
||||
Wondercard = 0x22000; // Confirmed
|
||||
BerryField = 0x20C00; // ****changed****
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00; // Confirmed
|
||||
PokeDex = 0x1A400;
|
||||
|
||||
HoF = 0x1F200; // Confirmed
|
||||
JPEG = 0x6D000; // Confirmed
|
||||
PSS = 0x0A400; // Confirmed (thanks Rei)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copied...
|
||||
Name = "Unknown";
|
||||
Box = 0x27A00;
|
||||
TrainerCard = 0x19400;
|
||||
Party = 0x19600;
|
||||
BattleBox = 0x09E00;
|
||||
Daycare = 0x20600;
|
||||
GTS = 0x1CC00;
|
||||
Fused = 0x1B400;
|
||||
SUBE = 0x22C90;
|
||||
|
||||
Puff = 0x5400;
|
||||
Item = 0x5800;
|
||||
Trainer1 = 0x6800;
|
||||
Trainer2 = 0x9600;
|
||||
PCLayout = 0x9800;
|
||||
Wondercard = 0x21000;
|
||||
BerryField = 0x20C00;
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00;
|
||||
PokeDex = 0x1A400;
|
||||
|
||||
HoF = 0x1E800;
|
||||
JPEG = 0x5C600;
|
||||
PSS = 0x0A400;
|
||||
case "XY":
|
||||
Name = "XY";
|
||||
Box = 0x27A00;
|
||||
TrainerCard = 0x19400;
|
||||
Party = 0x19600;
|
||||
BattleBox = 0x09E00;
|
||||
Daycare = 0x20600;
|
||||
GTS = 0x1CC00;
|
||||
Fused = 0x1B400;
|
||||
SUBE = 0x22C90;
|
||||
Puff = 0x5400;
|
||||
Item = 0x5800;
|
||||
Trainer1 = 0x6800;
|
||||
Trainer2 = 0x9600;
|
||||
PCLayout = 0x9800;
|
||||
Wondercard = 0x21000;
|
||||
BerryField = 0x20C00;
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00;
|
||||
PokeDex = 0x1A400;
|
||||
HoF = 0x1E800;
|
||||
JPEG = 0x5C600;
|
||||
PSS = 0x0A400;
|
||||
break;
|
||||
case "ORAS":
|
||||
Name = "ORAS";
|
||||
Box = 0x38400; // Confirmed
|
||||
TrainerCard = 0x19400; // Confirmed
|
||||
Party = 0x19600; // Confirmed
|
||||
BattleBox = 0x09E00;// Confirmed
|
||||
Daycare = 0x21000; // Confirmed (thanks Rei)
|
||||
GTS = 0x1D600; // Confirmed
|
||||
Fused = 0x1BE00; // Confirmed
|
||||
SUBE = 0x22C90; // ****not in use, not updating?****
|
||||
Puff = 0x5400; // Confirmed
|
||||
Item = 0x5800; // Confirmed
|
||||
Trainer1 = 0x6800; // Confirmed
|
||||
Trainer2 = 0x9600; // Confirmed
|
||||
PCLayout = 0x9800; // Confirmed
|
||||
Wondercard = 0x22000; // Confirmed
|
||||
BerryField = 0x20C00; // ****changed****
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00; // Confirmed
|
||||
PokeDex = 0x1A400;
|
||||
HoF = 0x1F200; // Confirmed
|
||||
JPEG = 0x6D000; // Confirmed
|
||||
PSS = 0x0A400; // Confirmed (thanks Rei)
|
||||
break;
|
||||
default:
|
||||
Name = "Unknown";
|
||||
Box = 0x27A00;
|
||||
TrainerCard = 0x19400;
|
||||
Party = 0x19600;
|
||||
BattleBox = 0x09E00;
|
||||
Daycare = 0x20600;
|
||||
GTS = 0x1CC00;
|
||||
Fused = 0x1B400;
|
||||
SUBE = 0x22C90;
|
||||
Puff = 0x5400;
|
||||
Item = 0x5800;
|
||||
Trainer1 = 0x6800;
|
||||
Trainer2 = 0x9600;
|
||||
PCLayout = 0x9800;
|
||||
Wondercard = 0x21000;
|
||||
BerryField = 0x20C00;
|
||||
OPower = 0x1BE00;
|
||||
EventFlag = 0x19E00;
|
||||
PokeDex = 0x1A400;
|
||||
HoF = 0x1E800;
|
||||
JPEG = 0x5C600;
|
||||
PSS = 0x0A400;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1118,11 +1102,10 @@ namespace PKHeX
|
|||
savindex = 2;
|
||||
}
|
||||
}
|
||||
if ((data[0x168] ^ 1) != savindex && savindex != 2)
|
||||
{
|
||||
Console.WriteLine("ERROR: ACTIVE BLOCK MISMATCH");
|
||||
savindex = 2;
|
||||
}
|
||||
if ((data[0x168] ^ 1) == savindex || savindex == 2) // success
|
||||
return savindex;
|
||||
Console.WriteLine("ERROR: ACTIVE BLOCK MISMATCH");
|
||||
savindex = 2;
|
||||
return savindex;
|
||||
}
|
||||
internal static ushort ccitt16(byte[] data)
|
||||
|
@ -1208,12 +1191,11 @@ namespace PKHeX
|
|||
internal Personal GetPersonal(int species, int formID)
|
||||
{
|
||||
Personal data = GetPersonal(species);
|
||||
if (formID > 0 && formID <= data.AltFormCount && data.AltFormCount > 0 && data.FormPointer > 0) // Working with an Alt Forme with a base stat change
|
||||
{
|
||||
formID--;
|
||||
data = GetPersonal(721 + formID + data.FormPointer);
|
||||
}
|
||||
return data;
|
||||
if (formID <= 0 || formID > data.AltFormCount || data.AltFormCount <= 0 || data.FormPointer <= 0)
|
||||
return data;
|
||||
|
||||
// Working with an Alt Forme with a base stat change
|
||||
return GetPersonal(721 + --formID + data.FormPointer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1244,7 +1226,7 @@ namespace PKHeX
|
|||
new[] { 1, 1, 1, 0, 0, 1 }, // Ground
|
||||
new[] { 1, 1, 0, 1, 0, 0 }, // Rock
|
||||
new[] { 1, 0, 0, 1, 0, 1 }, // Bug
|
||||
new[] { 1, 1, 0, 1, 0, 1 }, // Ghost
|
||||
new[] { 1, 0, 1, 1, 0, 1 }, // Ghost
|
||||
new[] { 1, 1, 1, 1, 0, 1 }, // Steel
|
||||
new[] { 1, 0, 1, 0, 1, 0 }, // Fire
|
||||
new[] { 1, 0, 0, 0, 1, 1 }, // Water
|
||||
|
@ -1253,7 +1235,7 @@ namespace PKHeX
|
|||
new[] { 1, 0, 1, 1, 1, 0 }, // Psychic
|
||||
new[] { 1, 0, 0, 1, 1, 1 }, // Ice
|
||||
new[] { 1, 0, 1, 1, 1, 1 }, // Dragon
|
||||
new[] { 1, 1, 1, 1, 1, 1 } // Dark
|
||||
new[] { 1, 1, 1, 1, 1, 1 }, // Dark
|
||||
};
|
||||
public class Simulator
|
||||
{
|
||||
|
@ -1291,7 +1273,6 @@ namespace PKHeX
|
|||
string[] stats = { "HP", "Atk", "Def", "SpA", "SpD", "Spe" };
|
||||
|
||||
string[] lines = input.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None);
|
||||
Nickname = null;
|
||||
|
||||
// Seek for start of set
|
||||
int start = -1;
|
||||
|
|
11
Misc/QR.cs
11
Misc/QR.cs
|
@ -1,11 +1,6 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Net;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -31,13 +26,13 @@ namespace PKHeX
|
|||
g.DrawString(top, font, Brushes.Black, new PointF(18, 5));
|
||||
g.DrawString(bottom, font, Brushes.Black, new PointF(18, pic.Width - 15));
|
||||
g.DrawString(left.Replace("s",""), font, Brushes.Black, new PointF(0, 18)); // trim off *V-s-:
|
||||
g.DrawString(right, font, Brushes.Black, new PointF(pic.Width - 15, 18), new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical));
|
||||
g.DrawString(right, font, Brushes.Black, new PointF(pic.Width - 15, 18), new StringFormat(StringFormatFlags.DirectionVertical));
|
||||
|
||||
PB_QR.BackgroundImage = pic;
|
||||
}
|
||||
else
|
||||
{
|
||||
int stretch = 50;
|
||||
const int stretch = 50;
|
||||
Height += stretch;
|
||||
Image newpic = new Bitmap(PB_QR.Width, PB_QR.Height);
|
||||
Graphics g = Graphics.FromImage(newpic);
|
||||
|
@ -46,7 +41,7 @@ namespace PKHeX
|
|||
|
||||
g.DrawString(top, font, Brushes.Black, new PointF(18, qr.Height - 5));
|
||||
g.DrawString(bottom, font, Brushes.Black, new PointF(18, qr.Height + 8));
|
||||
g.DrawString(left.Replace(Environment.NewLine.ToString(), "/").Replace("//", " ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
|
||||
g.DrawString(left.Replace(Environment.NewLine, "/").Replace("//", " ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
|
||||
g.DrawString(right, font, Brushes.Black, new PointF(18, qr.Height + 32));
|
||||
|
||||
PB_QR.BackgroundImage = newpic;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Timers;
|
||||
using System.Windows.Forms;
|
||||
using System.Timers;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -13,7 +11,7 @@ namespace PKHeX
|
|||
InitializeComponent();
|
||||
m_parent = frm1;
|
||||
System.Timers.Timer myTimer = new System.Timers.Timer();
|
||||
myTimer.Elapsed += new ElapsedEventHandler(DisplayTimeEvent);
|
||||
myTimer.Elapsed += DisplayTimeEvent;
|
||||
myTimer.Interval = 50; // milliseconds per trigger interval
|
||||
myTimer.Start();
|
||||
}
|
||||
|
@ -24,7 +22,7 @@ namespace PKHeX
|
|||
else { L_Status.Text = Form1.Status; }
|
||||
else
|
||||
if (InvokeRequired && IsHandleCreated)
|
||||
try { Invoke((MethodInvoker)delegate() { Close(); }); } catch { Close(); }
|
||||
try { Invoke((MethodInvoker)Close); } catch { Close(); }
|
||||
else Close();
|
||||
}
|
||||
}
|
||||
|
|
136
Misc/Util.cs
136
Misc/Util.cs
|
@ -10,7 +10,7 @@ using System.Text.RegularExpressions;
|
|||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class Util
|
||||
public class Util
|
||||
{
|
||||
// Image Layering/Blending Utility
|
||||
internal static Bitmap LayerImage(Image baseLayer, Image overLayer, int x, int y, double trans)
|
||||
|
@ -22,7 +22,7 @@ namespace PKHeX
|
|||
{
|
||||
Color newColor = overlayImage.GetPixel(i % (overlayImage.Width), i / (overlayImage.Width));
|
||||
Color oldColor = newImage.GetPixel(i % (overlayImage.Width) + x, i / (overlayImage.Width) + y);
|
||||
newColor = Color.FromArgb((int)((double)(newColor.A) * trans), newColor.R, newColor.G, newColor.B); // Apply transparency change
|
||||
newColor = Color.FromArgb((int)(newColor.A * trans), newColor.R, newColor.G, newColor.B); // Apply transparency change
|
||||
// if (newColor.A != 0) // If Pixel isn't transparent, we'll overwrite the color.
|
||||
{
|
||||
// if (newColor.A < 100)
|
||||
|
@ -40,8 +40,7 @@ namespace PKHeX
|
|||
if (img == null) return null;
|
||||
Bitmap bmp = new Bitmap(img.Width, img.Height); // Determining Width and Height of Source Image
|
||||
Graphics graphics = Graphics.FromImage(bmp);
|
||||
ColorMatrix colormatrix = new ColorMatrix();
|
||||
colormatrix.Matrix33 = (float)trans;
|
||||
ColorMatrix colormatrix = new ColorMatrix {Matrix33 = (float) trans};
|
||||
ImageAttributes imgAttribute = new ImageAttributes();
|
||||
imgAttribute.SetColorMatrix(colormatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
|
||||
graphics.DrawImage(img, new Rectangle(0, 0, bmp.Width, bmp.Height), 0, 0, img.Width, img.Height, GraphicsUnit.Pixel, imgAttribute);
|
||||
|
@ -78,7 +77,7 @@ namespace PKHeX
|
|||
internal static FileInfo GetNewestFile(DirectoryInfo directory)
|
||||
{
|
||||
return directory.GetFiles()
|
||||
.Union(directory.GetDirectories().Select(d => GetNewestFile(d)))
|
||||
.Union(directory.GetDirectories().Select(GetNewestFile))
|
||||
.OrderByDescending(f => (f == null ? DateTime.MinValue : f.LastWriteTime))
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
@ -137,8 +136,7 @@ namespace PKHeX
|
|||
}
|
||||
return path_3DS;
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
catch { return null; }
|
||||
}
|
||||
internal static string GetSDFLocation()
|
||||
{
|
||||
|
@ -155,22 +153,19 @@ namespace PKHeX
|
|||
}
|
||||
if (path_SDF == null)
|
||||
return null;
|
||||
else
|
||||
{
|
||||
// 3DS data found in SD card reader. Let's get the title folder location!
|
||||
string[] folders = Directory.GetDirectories(path_SDF, "*", System.IO.SearchOption.TopDirectoryOnly);
|
||||
Array.Sort(folders); // Don't need Modified Date, sort by path names just in case.
|
||||
// 3DS data found in SD card reader. Let's get the title folder location!
|
||||
string[] folders = Directory.GetDirectories(path_SDF, "*", SearchOption.TopDirectoryOnly);
|
||||
Array.Sort(folders); // Don't need Modified Date, sort by path names just in case.
|
||||
|
||||
// Loop through all the folders in the Nintendo 3DS folder to see if any of them contain 'title'.
|
||||
for (int i = folders.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (File.Exists(Path.Combine(folders[i], "000011c4" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "000011c4"); // OR
|
||||
if (File.Exists(Path.Combine(folders[i], "000011c5" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "000011c5"); // AS
|
||||
if (File.Exists(Path.Combine(folders[i], "0000055d" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "0000055d"); // X
|
||||
if (File.Exists(Path.Combine(folders[i], "0000055e" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "0000055e"); // Y
|
||||
}
|
||||
return null; // Fallthrough
|
||||
// Loop through all the folders in the Nintendo 3DS folder to see if any of them contain 'title'.
|
||||
for (int i = folders.Length - 1; i >= 0; i--)
|
||||
{
|
||||
if (File.Exists(Path.Combine(folders[i], "000011c4" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "000011c4"); // OR
|
||||
if (File.Exists(Path.Combine(folders[i], "000011c5" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "000011c5"); // AS
|
||||
if (File.Exists(Path.Combine(folders[i], "0000055d" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "0000055d"); // X
|
||||
if (File.Exists(Path.Combine(folders[i], "0000055e" + Path.DirectorySeparatorChar + "main"))) return Path.Combine(folders[i], "0000055e"); // Y
|
||||
}
|
||||
return null; // Fallthrough
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
|
@ -181,15 +176,12 @@ namespace PKHeX
|
|||
internal static string TrimFromZero(string input)
|
||||
{
|
||||
int index = input.IndexOf('\0');
|
||||
if (index < 0)
|
||||
return input;
|
||||
|
||||
return input.Substring(0, index);
|
||||
return index < 0 ? input : input.Substring(0, index);
|
||||
}
|
||||
internal static string[] getStringList(string f, string l)
|
||||
{
|
||||
object txt = Properties.Resources.ResourceManager.GetObject("text_" + f + "_" + l); // Fetch File, \n to list.
|
||||
List<string> rawlist = ((string)txt).Split(new char[] { '\n' }).ToList();
|
||||
List<string> rawlist = ((string)txt).Split(new[] { '\n' }).ToList();
|
||||
|
||||
string[] stringdata = new string[rawlist.Count];
|
||||
for (int i = 0; i < rawlist.Count; i++)
|
||||
|
@ -200,7 +192,7 @@ namespace PKHeX
|
|||
internal static string[] getSimpleStringList(string f)
|
||||
{
|
||||
object txt = Properties.Resources.ResourceManager.GetObject(f); // Fetch File, \n to list.
|
||||
List<string> rawlist = ((string)txt).Split(new char[] { '\n' }).ToList();
|
||||
List<string> rawlist = ((string)txt).Split(new[] { '\n' }).ToList();
|
||||
|
||||
string[] stringdata = new string[rawlist.Count];
|
||||
for (int i = 0; i < rawlist.Count; i++)
|
||||
|
@ -212,9 +204,9 @@ namespace PKHeX
|
|||
{
|
||||
try
|
||||
{
|
||||
string[] newlist = new string[Util.ToInt32(SimpleStringList[SimpleStringList.Length - 1].Split(',')[0]) + 1];
|
||||
string[] newlist = new string[ToInt32(SimpleStringList[SimpleStringList.Length - 1].Split(',')[0]) + 1];
|
||||
for (int i = 1; i < SimpleStringList.Length; i++)
|
||||
newlist[Util.ToInt32(SimpleStringList[i].Split(',')[0])] = SimpleStringList[i].Split(',')[1];
|
||||
newlist[ToInt32(SimpleStringList[i].Split(',')[0])] = SimpleStringList[i].Split(',')[1];
|
||||
return newlist;
|
||||
}
|
||||
catch { return null; }
|
||||
|
@ -255,7 +247,7 @@ namespace PKHeX
|
|||
return 0;
|
||||
try
|
||||
{
|
||||
value = value.TrimEnd(new char[] { '_' });
|
||||
value = value.TrimEnd(new[] { '_' });
|
||||
return Int32.Parse(value);
|
||||
}
|
||||
catch { return 0; }
|
||||
|
@ -267,7 +259,7 @@ namespace PKHeX
|
|||
return 0;
|
||||
try
|
||||
{
|
||||
value = value.TrimEnd(new char[] { '_' });
|
||||
value = value.TrimEnd(new[] { '_' });
|
||||
return UInt32.Parse(value);
|
||||
}
|
||||
catch { return 0; }
|
||||
|
@ -292,12 +284,10 @@ namespace PKHeX
|
|||
{
|
||||
if (str == null) return "0";
|
||||
|
||||
char c;
|
||||
string s = "";
|
||||
|
||||
for (int i = 0; i < str.Length; i++)
|
||||
foreach (char c in str)
|
||||
{
|
||||
c = str[i];
|
||||
// filter for hex
|
||||
if ((c < 0x0047 && c > 0x002F) || (c < 0x0067 && c > 0x0060))
|
||||
s += c;
|
||||
|
@ -330,16 +320,15 @@ namespace PKHeX
|
|||
// debug(Controls);
|
||||
// Fetch a File
|
||||
// Check to see if a the translation file exists in the same folder as the executable
|
||||
string externalLangPath = System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + "lang_" + lang + ".txt";
|
||||
string externalLangPath = Application.StartupPath + Path.DirectorySeparatorChar + "lang_" + lang + ".txt";
|
||||
string[] rawlist;
|
||||
if (File.Exists(externalLangPath))
|
||||
rawlist = File.ReadAllLines(externalLangPath);
|
||||
else
|
||||
{
|
||||
object txt;
|
||||
txt = Properties.Resources.ResourceManager.GetObject("lang_" + lang); // Fetch File, \n to list.
|
||||
object txt = Properties.Resources.ResourceManager.GetObject("lang_" + lang);
|
||||
if (txt == null) return; // Translation file does not exist as a resource; abort this function and don't translate UI.
|
||||
rawlist = ((string)txt).Split(new string[] { "\n" }, StringSplitOptions.None);
|
||||
rawlist = ((string)txt).Split(new[] { "\n" }, StringSplitOptions.None);
|
||||
rawlist = rawlist.Select(i => i.Trim()).ToArray(); // Remove trailing spaces
|
||||
}
|
||||
|
||||
|
@ -408,19 +397,19 @@ namespace PKHeX
|
|||
{
|
||||
System.Media.SystemSounds.Exclamation.Play();
|
||||
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
|
||||
return (DialogResult)MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
internal static DialogResult Alert(params string[] lines)
|
||||
{
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
|
||||
return (DialogResult)MessageBox.Show(msg, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return MessageBox.Show(msg, "Alert", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
}
|
||||
internal static DialogResult Prompt(MessageBoxButtons btn, params string[] lines)
|
||||
{
|
||||
System.Media.SystemSounds.Question.Play();
|
||||
string msg = String.Join(Environment.NewLine + Environment.NewLine, lines);
|
||||
return (DialogResult)MessageBox.Show(msg, "Prompt", btn, MessageBoxIcon.Asterisk);
|
||||
return MessageBox.Show(msg, "Prompt", btn, MessageBoxIcon.Asterisk);
|
||||
}
|
||||
|
||||
// DataSource Providing
|
||||
|
@ -432,11 +421,10 @@ namespace PKHeX
|
|||
internal static List<cbItem> getCBList(string textfile, string lang)
|
||||
{
|
||||
// Set up
|
||||
List<cbItem> cbList = new List<cbItem>();
|
||||
string[] inputCSV = Util.getSimpleStringList(textfile);
|
||||
string[] inputCSV = getSimpleStringList(textfile);
|
||||
|
||||
// Get Language we're fetching for
|
||||
int index = Array.IndexOf(new string[] { "ja", "en", "fr", "de", "it", "es", "ko", "zh", }, lang);
|
||||
int index = Array.IndexOf(new[] { "ja", "en", "fr", "de", "it", "es", "ko", "zh", }, lang);
|
||||
|
||||
// Set up our Temporary Storage
|
||||
string[] unsortedList = new string[inputCSV.Length - 1];
|
||||
|
@ -456,20 +444,17 @@ namespace PKHeX
|
|||
Array.Sort(sortedList);
|
||||
|
||||
// Arrange the input data based on original number
|
||||
for (int i = 0; i < sortedList.Length; i++)
|
||||
return sortedList.Select(s => new cbItem
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedList[i];
|
||||
ncbi.Value = indexes[Array.IndexOf(unsortedList, sortedList[i])];
|
||||
cbList.Add(ncbi);
|
||||
}
|
||||
return cbList;
|
||||
Text = s,
|
||||
Value = indexes[Array.IndexOf(unsortedList, s)]
|
||||
}).ToList();
|
||||
}
|
||||
internal static List<cbItem> getCBList(string[] inStrings, params int[][] allowed)
|
||||
{
|
||||
List<cbItem> cbList = new List<cbItem>();
|
||||
if (allowed == null)
|
||||
allowed = new int[][] { Enumerable.Range(0, inStrings.Length).ToArray() };
|
||||
allowed = new[] { Enumerable.Range(0, inStrings.Length).ToArray() };
|
||||
|
||||
foreach (int[] list in allowed)
|
||||
{
|
||||
|
@ -483,13 +468,11 @@ namespace PKHeX
|
|||
Array.Sort(sortedChoices);
|
||||
|
||||
// Add the rest of the items
|
||||
for (int i = 0; i < sortedChoices.Length; i++)
|
||||
cbList.AddRange(sortedChoices.Select(t => new cbItem
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedChoices[i];
|
||||
ncbi.Value = list[Array.IndexOf(unsortedChoices, sortedChoices[i])];
|
||||
cbList.Add(ncbi);
|
||||
}
|
||||
Text = t,
|
||||
Value = list[Array.IndexOf(unsortedChoices, t)]
|
||||
}));
|
||||
}
|
||||
return cbList;
|
||||
}
|
||||
|
@ -513,13 +496,10 @@ namespace PKHeX
|
|||
Array.Sort(sortedChoices);
|
||||
|
||||
// Add the rest of the items
|
||||
for (int i = 0; i < sortedChoices.Length; i++)
|
||||
cbList.AddRange(sortedChoices.Select(s => new cbItem
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedChoices[i];
|
||||
ncbi.Value = allowed[Array.IndexOf(unsortedChoices, sortedChoices[i])];
|
||||
cbList.Add(ncbi);
|
||||
}
|
||||
Text = s, Value = allowed[Array.IndexOf(unsortedChoices, s)]
|
||||
}));
|
||||
}
|
||||
return cbList;
|
||||
}
|
||||
|
@ -531,9 +511,11 @@ namespace PKHeX
|
|||
for (int i = 4; i > 1; i--) // add 4,3,2
|
||||
{
|
||||
// First 3 Balls are always first
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = inStrings[i];
|
||||
ncbi.Value = i;
|
||||
cbItem ncbi = new cbItem
|
||||
{
|
||||
Text = inStrings[i],
|
||||
Value = i
|
||||
};
|
||||
newlist.Add(ncbi);
|
||||
}
|
||||
|
||||
|
@ -547,28 +529,28 @@ namespace PKHeX
|
|||
Array.Sort(sortedballs);
|
||||
|
||||
// Add the rest of the balls
|
||||
for (int i = 0; i < sortedballs.Length; i++)
|
||||
newlist.AddRange(sortedballs.Select(t => new cbItem
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Text = sortedballs[i];
|
||||
ncbi.Value = stringVal[Array.IndexOf(ballnames, sortedballs[i])];
|
||||
newlist.Add(ncbi);
|
||||
}
|
||||
Text = t,
|
||||
Value = stringVal[Array.IndexOf(ballnames, t)]
|
||||
}));
|
||||
return newlist;
|
||||
}
|
||||
internal static List<cbItem> getUnsortedCBList(string textfile)
|
||||
{
|
||||
// Set up
|
||||
List<cbItem> cbList = new List<cbItem>();
|
||||
string[] inputCSV = Util.getSimpleStringList(textfile);
|
||||
string[] inputCSV = getSimpleStringList(textfile);
|
||||
|
||||
// Gather our data from the input file
|
||||
for (int i = 1; i < inputCSV.Length; i++)
|
||||
{
|
||||
string[] inputData = inputCSV[i].Split(',');
|
||||
cbItem ncbi = new cbItem();
|
||||
ncbi.Value = Convert.ToInt32(inputData[0]);
|
||||
ncbi.Text = inputData[1];
|
||||
cbItem ncbi = new cbItem
|
||||
{
|
||||
Text = inputData[1],
|
||||
Value = Convert.ToInt32(inputData[0])
|
||||
};
|
||||
cbList.Add(ncbi);
|
||||
}
|
||||
return cbList;
|
||||
|
|
|
@ -1,16 +1,10 @@
|
|||
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;
|
||||
using System.IO;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class pk2pk
|
||||
public class pk2pk
|
||||
{
|
||||
public byte[] ConvertPKM(byte[] input, byte[] savefile, int savindex)
|
||||
{
|
||||
|
@ -53,7 +47,7 @@ namespace PKHeX
|
|||
byte[] g6data = convertPK5toPK6(g5data);
|
||||
return g6data;
|
||||
}
|
||||
else if (input.Length == 136 || input.Length == 236 || input.Length == 220) // Ambiguous Gen4/5 file.
|
||||
if (input.Length == 136 || input.Length == 236 || input.Length == 220) // Ambiguous Gen4/5 file.
|
||||
{
|
||||
if (((BitConverter.ToUInt16(input, 0x80) < 0x3333) && (input[0x5F] < 0x10)) || (BitConverter.ToUInt16(input, 0x46) != 0))
|
||||
{
|
||||
|
@ -63,10 +57,10 @@ namespace PKHeX
|
|||
byte[] g6data = convertPK5toPK6(g5data);
|
||||
return g6data;
|
||||
}
|
||||
else return convertPK5toPK6(input);
|
||||
return convertPK5toPK6(input);
|
||||
}
|
||||
#endregion
|
||||
else return input; // Should never get here.
|
||||
return input; // Should never get here.
|
||||
}
|
||||
#region Utility
|
||||
public DateTime moment = DateTime.Now;
|
||||
|
@ -80,16 +74,16 @@ namespace PKHeX
|
|||
public int subreg = 0x7; // California
|
||||
public int _3DSreg = 0x1; // Americas
|
||||
public string g6trname = "PKHeX";
|
||||
public byte g6trgend = 0;
|
||||
public byte g6trgend;
|
||||
private int getAbilityNumber(int species, int ability, int formnum)
|
||||
{
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species, formnum);
|
||||
int[] spec_abilities = new int[3];
|
||||
Array.Copy(MonData.Abilities, spec_abilities, 3);
|
||||
int abilval = Array.IndexOf(spec_abilities, ability);
|
||||
if (abilval >= 0)
|
||||
return 1 << abilval;
|
||||
else return -1;
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species, formnum);
|
||||
int[] spec_abilities = new int[3];
|
||||
Array.Copy(MonData.Abilities, spec_abilities, 3);
|
||||
int abilval = Array.IndexOf(spec_abilities, ability);
|
||||
if (abilval >= 0)
|
||||
return 1 << abilval;
|
||||
return -1;
|
||||
}
|
||||
public byte[] convertPK3toPK4(byte[] pk3)
|
||||
{
|
||||
|
@ -104,7 +98,7 @@ namespace PKHeX
|
|||
pk4[0x8] = (byte)(species & 0xFF); pk4[0x9] = (byte)(species >> 8);
|
||||
|
||||
uint exp = BitConverter.ToUInt32(pk4, 0x10);
|
||||
pk4[0x14] = (byte)70;
|
||||
pk4[0x14] = 70;
|
||||
// ability later
|
||||
pk4[0x16] = pk3[27]; // Copy markings
|
||||
pk4[0x17] = pk3[18]; // Language
|
||||
|
@ -114,7 +108,7 @@ namespace PKHeX
|
|||
uint ribo = BitConverter.ToUInt32(pk3, 0x4C);
|
||||
int fateful = (int)(ribo >> 31);
|
||||
uint newrib = 0;
|
||||
uint mask = 0xF;
|
||||
const uint mask = 0xF;
|
||||
for (int i = 0; i < 5; i++) // copy contest ribbons
|
||||
{
|
||||
uint oldval = (ribo >> (3 * i)) & 0x7; // get 01234 stage
|
||||
|
@ -161,7 +155,7 @@ namespace PKHeX
|
|||
int genderratio = MonData.GenderRatio;
|
||||
uint PID = BitConverter.ToUInt32(pk4, 0);
|
||||
int gv = (int)(PID & 0xFF);
|
||||
int gender = 0;
|
||||
int gender;
|
||||
|
||||
if (genderratio == 255)
|
||||
gender = 2;
|
||||
|
@ -170,12 +164,7 @@ namespace PKHeX
|
|||
else if (genderratio == 0)
|
||||
gender = 0;
|
||||
else
|
||||
{
|
||||
if (gv <= genderratio)
|
||||
gender = 1;
|
||||
else
|
||||
gender = 0;
|
||||
}
|
||||
gender = gv <= genderratio ? 1 : 0;
|
||||
|
||||
int formnum = 0;
|
||||
// unown
|
||||
|
@ -216,7 +205,7 @@ namespace PKHeX
|
|||
chartable = Char3to4J();
|
||||
|
||||
// Get Species Names
|
||||
string[] names = new string[]
|
||||
string[] names =
|
||||
{
|
||||
speclang_ja[species].ToUpper(),
|
||||
speclang_en[species].ToUpper(),
|
||||
|
@ -263,12 +252,9 @@ namespace PKHeX
|
|||
Array.Copy(BitConverter.GetBytes(0xFFFF), 0, pk4, 0x48 + i * 2, 2);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
nickname += (char)chartable.Rows[val][2];
|
||||
int newval = (int)chartable.Rows[val][1];
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk4, 0x48 + i * 2, 2);
|
||||
}
|
||||
nickname += (char)chartable.Rows[val][2];
|
||||
int newval = (int)chartable.Rows[val][1];
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk4, 0x48 + i * 2, 2);
|
||||
}
|
||||
|
||||
// nickname detection
|
||||
|
@ -278,7 +264,6 @@ namespace PKHeX
|
|||
|
||||
// Set Trainer Name
|
||||
// First, transfer the Nickname to trashbytes for OT
|
||||
string trainer = "";
|
||||
Array.Copy(pk4, 0x48, pk4, 0x68, 0x10);
|
||||
{
|
||||
for (int i = 0; i < 8; i++)
|
||||
|
@ -290,12 +275,8 @@ namespace PKHeX
|
|||
Array.Copy(BitConverter.GetBytes(0xFFFF), 0, pk4, 0x68 + i * 2, 2);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
trainer += (char)chartable.Rows[val][2];
|
||||
int newval = (int)chartable.Rows[val][1];
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk4, 0x68 + i * 2, 2);
|
||||
}
|
||||
int newval = (int)chartable.Rows[val][1];
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk4, 0x68 + i * 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -338,7 +319,7 @@ namespace PKHeX
|
|||
// Met / Crown Data Detection
|
||||
int species = BitConverter.ToInt16(pk5, 0x8);
|
||||
bool fateful = Convert.ToBoolean(BitConverter.ToUInt16(pk5, 0x40) & 0x1);
|
||||
int[] crownspec = new int[] { 251, 243, 244, 245 };
|
||||
int[] crownspec = { 251, 243, 244, 245 };
|
||||
if (fateful && Array.IndexOf(crownspec, species) >= 0)
|
||||
{
|
||||
if (species == 251)
|
||||
|
@ -361,8 +342,6 @@ namespace PKHeX
|
|||
// Transfer Nickname and OT Name
|
||||
DataTable CT45 = Char4to5();
|
||||
byte[] nicknamestr = new byte[24];
|
||||
string nickname = "";
|
||||
string trainer = "";
|
||||
nicknamestr[22] = nicknamestr[23] = 0xFF;
|
||||
try
|
||||
{
|
||||
|
@ -375,7 +354,6 @@ namespace PKHeX
|
|||
// find entry
|
||||
int newval = (int)CT45.Rows.Find(val)[1];
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk5, 0x48 + i, 2);
|
||||
nickname += (char)newval;
|
||||
}
|
||||
|
||||
byte[] OTstr = new byte[24];
|
||||
|
@ -388,7 +366,6 @@ namespace PKHeX
|
|||
|
||||
// find entry
|
||||
int newval = (int)CT45.Rows.Find(val)[1];
|
||||
trainer += (char)newval;
|
||||
Array.Copy(BitConverter.GetBytes(newval), 0, pk5, 0x68 + i, 2);
|
||||
}
|
||||
} catch { return pk4; }
|
||||
|
@ -488,8 +465,7 @@ namespace PKHeX
|
|||
{
|
||||
if (BitConverter.ToUInt16(pk5, 0x68 + i) == 0xFFFF) // If terminated, stop
|
||||
break;
|
||||
else
|
||||
Array.Copy(pk5, 0x68 + i, pk6, 0xB0 + i, 2); // Copy 16bit Character
|
||||
Array.Copy(pk5, 0x68 + i, pk6, 0xB0 + i, 2); // Copy 16bit Character
|
||||
}
|
||||
|
||||
// Copy Met Info
|
||||
|
@ -506,11 +482,12 @@ namespace PKHeX
|
|||
|
||||
// Get the current level of the specimen to be transferred
|
||||
int species = BitConverter.ToInt16(pk6, 0x08);
|
||||
uint exp = BitConverter.ToUInt32(pk6, 0x10);
|
||||
|
||||
// Level isn't altered, keeps Gen5 Met Level
|
||||
// int currentlevel = getLevel((species), (exp));
|
||||
// (byte)(((pk5[0x84]) & 0x80) + currentlevel);
|
||||
// uint exp = BitConverter.ToUInt32(pk6, 0x10);
|
||||
// int currentlevel = getLevel((species), (exp));
|
||||
// (byte)(((pk5[0x84]) & 0x80) + currentlevel);
|
||||
|
||||
pk6[0xDD] = pk5[0x84]; // OT Gender & Encounter Level
|
||||
pk6[0xDE] = pk5[0x85]; // Encounter Type
|
||||
|
||||
|
@ -618,10 +595,10 @@ namespace PKHeX
|
|||
// 01 - Not handled by OT
|
||||
// 07 - CA
|
||||
// 31 - USA
|
||||
byte[] x90x = new byte[] { 0x00, 0x00, g6trgend, 0x01, (byte)subreg, (byte)country, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)PKX.getBaseFriendship(species), 0x00, 0x01, 0x04, (byte)(Util.rnd32() % 10), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
byte[] x90x = { 0x00, 0x00, g6trgend, 0x01, (byte)subreg, (byte)country, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, PKX.getBaseFriendship(species), 0x00, 0x01, 0x04, (byte)(Util.rnd32() % 10), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
Array.Copy(x90x, 0, pk6, 0x90, x90x.Length);
|
||||
// When transferred, friendship gets reset.
|
||||
pk6[0xCA] = (byte)PKX.getBaseFriendship(species);
|
||||
pk6[0xCA] = PKX.getBaseFriendship(species);
|
||||
|
||||
// Write Origin (USA California) - location is dependent on 3DS system that transfers.
|
||||
pk6[0xE0] = (byte)country;
|
||||
|
@ -647,7 +624,7 @@ namespace PKHeX
|
|||
// Apply New Checksum
|
||||
Array.Copy(BitConverter.GetBytes(chk), 0, pk6, 06, 2);
|
||||
|
||||
string trainer = Util.TrimFromZero(Encoding.Unicode.GetString(pk6, 0xB0, 24));
|
||||
Util.TrimFromZero(Encoding.Unicode.GetString(pk6, 0xB0, 24));
|
||||
|
||||
return pk6; // Done!
|
||||
}
|
||||
|
@ -3906,7 +3883,7 @@ namespace PKHeX
|
|||
|
||||
private int getg3species(int g3index)
|
||||
{
|
||||
int[] newindex = new int[]
|
||||
int[] newindex =
|
||||
{
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||
|
@ -3927,7 +3904,7 @@ namespace PKHeX
|
|||
345,346,347,348,280,281,282,371,372,373,374,375,376,377,378,379,382,383,384,380,381,
|
||||
385,386,358,
|
||||
};
|
||||
int[] oldindex = new int[]
|
||||
int[] oldindex =
|
||||
{
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
class ram2sav
|
||||
{
|
||||
internal static uint UNKNOWNVAL = 0x96696996;
|
||||
internal const uint UNKNOWNVAL = 0x96696996;
|
||||
internal static byte[] getMAIN(byte[] ramsav)
|
||||
{
|
||||
byte[] main = new byte[] { };
|
||||
uint[] offsets = new uint[] { };
|
||||
uint[] lens = new uint[] { };
|
||||
uint[] magics = new uint[] { };
|
||||
uint[] skips = new uint[] { };
|
||||
uint[] instances = new uint[] { };
|
||||
byte[] main;
|
||||
uint[] offsets;
|
||||
uint[] lens;
|
||||
uint[] magics;
|
||||
uint[] skips;
|
||||
uint[] instances;
|
||||
uint val = BitConverter.ToUInt32(ramsav, 0);
|
||||
uint spos = 0;
|
||||
if (ramsav.Length == 0x80000) // ORAS
|
||||
|
@ -34,17 +32,17 @@ namespace PKHeX
|
|||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x0059AE94, 0x0059ACC0, 0x0059AC00, 0x0059AD80, 0x0059AED4, 0x0059A8E8, 0x0059ADE0, 0x0059AD20, 0x0059ADA0, 0x0059A8C8, 0x0059A968, 0x0059AC40, 0x0059AC20, 0x0059AE54, 0x0059ABA0, 0x0059ABA0, 0x0059ABA0, 0x0059ADC0, 0x0059A9A8, 0x00599734, 0x0059AEF4, 0x0059AA48, 0x0059A908, 0x0059AC60, 0x0059A9C8, 0x0059AA08, 0x0059A948, 0x0059AEB4, 0x0059AD40, 0x0059AE74, 0x0059AAE8, 0x0059AD00, 0x0059A8A8, 0x0059A800, 0x0059A888, 0x0059AB70, 0x0059AC80, 0x0059AA28, 0x0059AE34, 0x0059A868, 0x0059A820, 0x0059AB28, 0x0059AA88, 0x0059AAC8, 0x0059ACE0, 0x0059ABC0, 0x0059AAA8, 0x0059AA68, 0x0059A928, 0x0059A9E8, 0x0059AD60, 0x0059AB80, 0x0059AB08, 0x0059A7E0, 0x0059A988, 0x0059ACA0 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
if (val == 0x0059E418)
|
||||
switch (val)
|
||||
{
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
}
|
||||
else if (val == 0x0059E408)
|
||||
{
|
||||
magics = new uint[] { 0x0059E408, 0x0059E234, 0x0059E174, 0x0059E2F4, 0x0059E448, 0x0059DE5C, 0x0059E354, 0x0059E294, 0x0059E314, 0x0059DE3C, 0x0059DEDC, 0x0059E1B4, 0x0059E194, 0x0059E3C8, 0x0059E114, 0x0059E114, 0x0059E114, 0x0059E334, 0x0059DF1C, 0x0059CCA8, 0x0059E468, 0x0059DFBC, 0x0059DE7C, 0x0059E1D4, 0x0059DF3C, 0x0059DF7C, 0x0059DEBC, 0x0059E428, 0x0059E2B4, 0x0059E3E8, 0x0059E05C, 0x0059E274, 0x0059DE1C, 0x0059DD74, 0x0059DDFC, 0x0059E0BC, 0x0059E1F4, 0x0059DF9C, 0x0059E3A8, 0x0059DDDC, 0x0059DD94, 0x0059E09C, 0x0059DFFC, 0x0059E03C, 0x0059E254, 0x0059E134, 0x0059E01C, 0x0059DFDC, 0x0059DE9C, 0x0059DF5C, 0x0059E2D4, 0x0059E0F4, 0x0059E07C, 0x0059DD54, 0x0059DEFC, 0x0059E214 };
|
||||
}
|
||||
else if (val == 0x0059BEC4)
|
||||
{
|
||||
magics = new uint[] { 0x0059BEC4, 0x0059BCF0, 0x0059BC30, 0x0059BDB0, 0x0059BF04, 0x0059B918, 0x0059BE10, 0x0059BD50, 0x0059BDD0, 0x0059B8F8, 0x0059B998, 0x0059BC70, 0x0059BC50, 0x0059BE84, 0x0059BBD0, 0x0059BBD0, 0x0059BBD0, 0x0059BDF0, 0x0059B9D8, 0x0059A764, 0x0059BF24, 0x0059BA78, 0x0059B938, 0x0059BC90, 0x0059B9F8, 0x0059BA38, 0x0059B978, 0x0059BEE4, 0x0059BD70, 0x0059BEA4, 0x0059BB18, 0x0059BD30, 0x0059B8D8, 0x0059B830, 0x0059B8B8, 0x0059BBA0, 0x0059BCB0, 0x0059BA58, 0x0059BE64, 0x0059B898, 0x0059B850, 0x0059BB58, 0x0059BAB8, 0x0059BAF8, 0x0059BD10, 0x0059BBF0, 0x0059BAD8, 0x0059BA98, 0x0059B958, 0x0059BA18, 0x0059BD90, 0x0059BBB0, 0x0059BB38, 0x0059B810, 0x0059B9B8, 0x0059BCD0 };
|
||||
case 0x0059E418:
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
break;
|
||||
case 0x0059E408:
|
||||
magics = new uint[] { 0x0059E408, 0x0059E234, 0x0059E174, 0x0059E2F4, 0x0059E448, 0x0059DE5C, 0x0059E354, 0x0059E294, 0x0059E314, 0x0059DE3C, 0x0059DEDC, 0x0059E1B4, 0x0059E194, 0x0059E3C8, 0x0059E114, 0x0059E114, 0x0059E114, 0x0059E334, 0x0059DF1C, 0x0059CCA8, 0x0059E468, 0x0059DFBC, 0x0059DE7C, 0x0059E1D4, 0x0059DF3C, 0x0059DF7C, 0x0059DEBC, 0x0059E428, 0x0059E2B4, 0x0059E3E8, 0x0059E05C, 0x0059E274, 0x0059DE1C, 0x0059DD74, 0x0059DDFC, 0x0059E0BC, 0x0059E1F4, 0x0059DF9C, 0x0059E3A8, 0x0059DDDC, 0x0059DD94, 0x0059E09C, 0x0059DFFC, 0x0059E03C, 0x0059E254, 0x0059E134, 0x0059E01C, 0x0059DFDC, 0x0059DE9C, 0x0059DF5C, 0x0059E2D4, 0x0059E0F4, 0x0059E07C, 0x0059DD54, 0x0059DEFC, 0x0059E214 };
|
||||
break;
|
||||
case 0x0059BEC4:
|
||||
magics = new uint[] { 0x0059BEC4, 0x0059BCF0, 0x0059BC30, 0x0059BDB0, 0x0059BF04, 0x0059B918, 0x0059BE10, 0x0059BD50, 0x0059BDD0, 0x0059B8F8, 0x0059B998, 0x0059BC70, 0x0059BC50, 0x0059BE84, 0x0059BBD0, 0x0059BBD0, 0x0059BBD0, 0x0059BDF0, 0x0059B9D8, 0x0059A764, 0x0059BF24, 0x0059BA78, 0x0059B938, 0x0059BC90, 0x0059B9F8, 0x0059BA38, 0x0059B978, 0x0059BEE4, 0x0059BD70, 0x0059BEA4, 0x0059BB18, 0x0059BD30, 0x0059B8D8, 0x0059B830, 0x0059B8B8, 0x0059BBA0, 0x0059BCB0, 0x0059BA58, 0x0059BE64, 0x0059B898, 0x0059B850, 0x0059BB58, 0x0059BAB8, 0x0059BAF8, 0x0059BD10, 0x0059BBF0, 0x0059BAD8, 0x0059BA98, 0x0059B958, 0x0059BA18, 0x0059BD90, 0x0059BBB0, 0x0059BB38, 0x0059B810, 0x0059B9B8, 0x0059BCD0 };
|
||||
break;
|
||||
}
|
||||
}
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
@ -52,7 +50,7 @@ namespace PKHeX
|
|||
for (int i = 0; i < lens.Length; i++)
|
||||
{
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i], spos);
|
||||
ms.Seek((long)(offsets[i] - 0x5400), SeekOrigin.Begin);
|
||||
ms.Seek(offsets[i] - 0x5400, SeekOrigin.Begin);
|
||||
spos += lens[i];
|
||||
if (ofs > 0)
|
||||
{
|
||||
|
@ -74,11 +72,11 @@ namespace PKHeX
|
|||
bool oras = (main.Length > 0x65600);
|
||||
byte[] newram = new byte[ramsav.Length];
|
||||
Array.Copy(ramsav, newram, ramsav.Length);
|
||||
uint[] offsets = new uint[] { };
|
||||
uint[] lens = new uint[] { };
|
||||
uint[] magics = new uint[] { };
|
||||
uint[] skips = new uint[] { };
|
||||
uint[] instances = new uint[] { };
|
||||
uint[] offsets;
|
||||
uint[] lens;
|
||||
uint[] magics;
|
||||
uint[] skips;
|
||||
uint[] instances;
|
||||
uint val = BitConverter.ToUInt32(ramsav, 0);
|
||||
uint spos = 0;
|
||||
if (oras) // ORAS
|
||||
|
@ -96,30 +94,26 @@ namespace PKHeX
|
|||
skips = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000004, 0x00000004 };
|
||||
magics = new uint[] { 0x0059AE94, 0x0059ACC0, 0x0059AC00, 0x0059AD80, 0x0059AED4, 0x0059A8E8, 0x0059ADE0, 0x0059AD20, 0x0059ADA0, 0x0059A8C8, 0x0059A968, 0x0059AC40, 0x0059AC20, 0x0059AE54, 0x0059ABA0, 0x0059ABA0, 0x0059ABA0, 0x0059ADC0, 0x0059A9A8, 0x00599734, 0x0059AEF4, 0x0059AA48, 0x0059A908, 0x0059AC60, 0x0059A9C8, 0x0059AA08, 0x0059A948, 0x0059AEB4, 0x0059AD40, 0x0059AE74, 0x0059AAE8, 0x0059AD00, 0x0059A8A8, 0x0059A800, 0x0059A888, 0x0059AB70, 0x0059AC80, 0x0059AA28, 0x0059AE34, 0x0059A868, 0x0059A820, 0x0059AB28, 0x0059AA88, 0x0059AAC8, 0x0059ACE0, 0x0059ABC0, 0x0059AAA8, 0x0059AA68, 0x0059A928, 0x0059A9E8, 0x0059AD60, 0x0059AB80, 0x0059AB08, 0x0059A7E0, 0x0059A988, 0x0059ACA0 };
|
||||
instances = new uint[] { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 };
|
||||
if (val == 0x0059E418)
|
||||
switch (val)
|
||||
{
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
}
|
||||
else if (val == 0x0059E408)
|
||||
{
|
||||
magics = new uint[] { 0x0059E408, 0x0059E234, 0x0059E174, 0x0059E2F4, 0x0059E448, 0x0059DE5C, 0x0059E354, 0x0059E294, 0x0059E314, 0x0059DE3C, 0x0059DEDC, 0x0059E1B4, 0x0059E194, 0x0059E3C8, 0x0059E114, 0x0059E114, 0x0059E114, 0x0059E334, 0x0059DF1C, 0x0059CCA8, 0x0059E468, 0x0059DFBC, 0x0059DE7C, 0x0059E1D4, 0x0059DF3C, 0x0059DF7C, 0x0059DEBC, 0x0059E428, 0x0059E2B4, 0x0059E3E8, 0x0059E05C, 0x0059E274, 0x0059DE1C, 0x0059DD74, 0x0059DDFC, 0x0059E0BC, 0x0059E1F4, 0x0059DF9C, 0x0059E3A8, 0x0059DDDC, 0x0059DD94, 0x0059E09C, 0x0059DFFC, 0x0059E03C, 0x0059E254, 0x0059E134, 0x0059E01C, 0x0059DFDC, 0x0059DE9C, 0x0059DF5C, 0x0059E2D4, 0x0059E0F4, 0x0059E07C, 0x0059DD54, 0x0059DEFC, 0x0059E214 };
|
||||
}
|
||||
else if (val == 0x0059BEC4)
|
||||
{
|
||||
magics = new uint[] { 0x0059BEC4, 0x0059BCF0, 0x0059BC30, 0x0059BDB0, 0x0059BF04, 0x0059B918, 0x0059BE10, 0x0059BD50, 0x0059BDD0, 0x0059B8F8, 0x0059B998, 0x0059BC70, 0x0059BC50, 0x0059BE84, 0x0059BBD0, 0x0059BBD0, 0x0059BBD0, 0x0059BDF0, 0x0059B9D8, 0x0059A764, 0x0059BF24, 0x0059BA78, 0x0059B938, 0x0059BC90, 0x0059B9F8, 0x0059BA38, 0x0059B978, 0x0059BEE4, 0x0059BD70, 0x0059BEA4, 0x0059BB18, 0x0059BD30, 0x0059B8D8, 0x0059B830, 0x0059B8B8, 0x0059BBA0, 0x0059BCB0, 0x0059BA58, 0x0059BE64, 0x0059B898, 0x0059B850, 0x0059BB58, 0x0059BAB8, 0x0059BAF8, 0x0059BD10, 0x0059BBF0, 0x0059BAD8, 0x0059BA98, 0x0059B958, 0x0059BA18, 0x0059BD90, 0x0059BBB0, 0x0059BB38, 0x0059B810, 0x0059B9B8, 0x0059BCD0 };
|
||||
case 0x0059E418:
|
||||
magics = new uint[] { 0x0059E418, 0x0059E244, 0x0059E184, 0x0059E304, 0x0059E458, 0x0059DE6C, 0x0059E364, 0x0059E2A4, 0x0059E324, 0x0059DE4C, 0x0059DEEC, 0x0059E1C4, 0x0059E1A4, 0x0059E3D8, 0x0059E124, 0x0059E124, 0x0059E124, 0x0059E344, 0x0059DF2C, 0x0059CCB8, 0x0059E478, 0x0059DFCC, 0x0059DE8C, 0x0059E1E4, 0x0059DF4C, 0x0059DF8C, 0x0059DECC, 0x0059E438, 0x0059E2C4, 0x0059E3F8, 0x0059E06C, 0x0059E284, 0x0059DE2C, 0x0059DD84, 0x0059DE0C, 0x0059E0CC, 0x0059E204, 0x0059DFAC, 0x0059E3B8, 0x0059DDEC, 0x0059DDA4, 0x0059E0AC, 0x0059E00C, 0x0059E04C, 0x0059E264, 0x0059E144, 0x0059E02C, 0x0059DFEC, 0x0059DEAC, 0x0059DF6C, 0x0059E2E4, 0x0059E104, 0x0059E08C, 0x0059DD64, 0x0059DF0C, 0x0059E224 };
|
||||
break;
|
||||
case 0x0059E408:
|
||||
magics = new uint[] { 0x0059E408, 0x0059E234, 0x0059E174, 0x0059E2F4, 0x0059E448, 0x0059DE5C, 0x0059E354, 0x0059E294, 0x0059E314, 0x0059DE3C, 0x0059DEDC, 0x0059E1B4, 0x0059E194, 0x0059E3C8, 0x0059E114, 0x0059E114, 0x0059E114, 0x0059E334, 0x0059DF1C, 0x0059CCA8, 0x0059E468, 0x0059DFBC, 0x0059DE7C, 0x0059E1D4, 0x0059DF3C, 0x0059DF7C, 0x0059DEBC, 0x0059E428, 0x0059E2B4, 0x0059E3E8, 0x0059E05C, 0x0059E274, 0x0059DE1C, 0x0059DD74, 0x0059DDFC, 0x0059E0BC, 0x0059E1F4, 0x0059DF9C, 0x0059E3A8, 0x0059DDDC, 0x0059DD94, 0x0059E09C, 0x0059DFFC, 0x0059E03C, 0x0059E254, 0x0059E134, 0x0059E01C, 0x0059DFDC, 0x0059DE9C, 0x0059DF5C, 0x0059E2D4, 0x0059E0F4, 0x0059E07C, 0x0059DD54, 0x0059DEFC, 0x0059E214 };
|
||||
break;
|
||||
case 0x0059BEC4:
|
||||
magics = new uint[] { 0x0059BEC4, 0x0059BCF0, 0x0059BC30, 0x0059BDB0, 0x0059BF04, 0x0059B918, 0x0059BE10, 0x0059BD50, 0x0059BDD0, 0x0059B8F8, 0x0059B998, 0x0059BC70, 0x0059BC50, 0x0059BE84, 0x0059BBD0, 0x0059BBD0, 0x0059BBD0, 0x0059BDF0, 0x0059B9D8, 0x0059A764, 0x0059BF24, 0x0059BA78, 0x0059B938, 0x0059BC90, 0x0059B9F8, 0x0059BA38, 0x0059B978, 0x0059BEE4, 0x0059BD70, 0x0059BEA4, 0x0059BB18, 0x0059BD30, 0x0059B8D8, 0x0059B830, 0x0059B8B8, 0x0059BBA0, 0x0059BCB0, 0x0059BA58, 0x0059BE64, 0x0059B898, 0x0059B850, 0x0059BB58, 0x0059BAB8, 0x0059BAF8, 0x0059BD10, 0x0059BBF0, 0x0059BAD8, 0x0059BA98, 0x0059B958, 0x0059BA18, 0x0059BD90, 0x0059BBB0, 0x0059BB38, 0x0059B810, 0x0059B9B8, 0x0059BCD0 };
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < lens.Length; i++)
|
||||
{
|
||||
int ofs = FindIndex(ramsav, magics[i], instances[i], spos);
|
||||
spos += lens[i];
|
||||
if (ofs > 0)
|
||||
{
|
||||
Array.Copy(main, (int)offsets[i] - 0x5400, newram, ofs + (int)skips[i], lens[i]);
|
||||
spos += 4;
|
||||
}
|
||||
else { }
|
||||
//Do nothing. Don't Copy blocks we can't find lol
|
||||
if (ofs <= 0) continue;
|
||||
Array.Copy(main, (int)offsets[i] - 0x5400, newram, ofs + (int)skips[i], lens[i]);
|
||||
spos += 4;
|
||||
}
|
||||
return newram;
|
||||
}
|
||||
|
@ -139,12 +133,9 @@ namespace PKHeX
|
|||
times++;
|
||||
v = (BitConverter.ToUInt32(data, ofs));
|
||||
}
|
||||
if (ofs + 4 == data.Length)
|
||||
{
|
||||
Console.WriteLine("Failed to find " + val.ToString("X8"));
|
||||
return -1;
|
||||
}
|
||||
return ofs + 4;
|
||||
if (ofs + 4 != data.Length) return ofs + 4;
|
||||
Console.WriteLine("Failed to find " + val.ToString("X8"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1873
PKX/f1-Main.cs
1873
PKX/f1-Main.cs
File diff suppressed because it is too large
Load diff
|
@ -1,10 +1,5 @@
|
|||
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
|
||||
|
@ -14,19 +9,19 @@ namespace PKHeX
|
|||
public f2_Text(TextBox TB_NN)
|
||||
{
|
||||
Form1.specialChars = true;
|
||||
this.Hide();
|
||||
Hide();
|
||||
InitializeComponent();
|
||||
Util.TranslateInterface(this, Form1.curlanguage);
|
||||
TB_Nickname = TB_NN;
|
||||
Font pkxFont = PKX.getPKXFont(12F);
|
||||
Label[] lbla = new Label[]
|
||||
Label[] lbla =
|
||||
{
|
||||
L00, L01, L02, L03, L04, L05, L06, L07,
|
||||
L08, L09, L0A, L0B, L0C, L0D, L0E, L0F,
|
||||
L10, L11, L12, L13, L14, L15, L16, L17,
|
||||
L18, L19, L1A, L1B, L1C, L1D, L1E, L1F,
|
||||
};
|
||||
ushort[] chars = new ushort[]
|
||||
ushort[] chars =
|
||||
{
|
||||
0xE081, 0xE082, 0xE083, 0xE084, 0xE085, 0xE086, 0xE087, 0xE08D,
|
||||
0xE08E, 0xE08F, 0xE090, 0xE091, 0xE092, 0xE093, 0xE094, 0xE095,
|
||||
|
@ -37,10 +32,10 @@ namespace PKHeX
|
|||
{
|
||||
lbla[i].Font = pkxFont;
|
||||
lbla[i].Text = Convert.ToChar(chars[i]).ToString();
|
||||
lbla[i].Click += new EventHandler(onClick);
|
||||
lbla[i].Click += onClick;
|
||||
}
|
||||
this.CenterToParent();
|
||||
this.Show();
|
||||
CenterToParent();
|
||||
Show();
|
||||
}
|
||||
TextBox TB_Nickname;
|
||||
private void onClick(object sender, EventArgs e)
|
||||
|
|
|
@ -1,13 +1,6 @@
|
|||
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;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -45,7 +38,14 @@ namespace PKHeX
|
|||
past = arguments[3];
|
||||
withOT = arguments[4];
|
||||
}
|
||||
catch { };
|
||||
catch
|
||||
{
|
||||
disabled = "Disabled";
|
||||
notleft = "Never left";
|
||||
ot = "OT";
|
||||
past = "Past Gen";
|
||||
withOT = "Memories with";
|
||||
}
|
||||
h = m_parent.buff;
|
||||
|
||||
getCountries();
|
||||
|
@ -54,7 +54,7 @@ namespace PKHeX
|
|||
}
|
||||
public string[] feeling;
|
||||
public string[] quality;
|
||||
bool init = false;
|
||||
bool init;
|
||||
|
||||
// Load/Save Actions
|
||||
private void loadFields()
|
||||
|
@ -118,8 +118,8 @@ namespace PKHeX
|
|||
|
||||
if ((!m_parent.CHK_IsEgg.Checked))
|
||||
{
|
||||
bool enable = false;
|
||||
int game = (int)(Util.getIndex(m_parent.CB_GameOrigin));
|
||||
bool enable;
|
||||
int game = Util.getIndex(m_parent.CB_GameOrigin);
|
||||
if ((game < 24) && (game != 0))
|
||||
{
|
||||
// Banked Mon
|
||||
|
@ -225,11 +225,11 @@ namespace PKHeX
|
|||
}
|
||||
private void i1cb(ComboBox cb, int o)
|
||||
{
|
||||
cb.SelectedIndex = (int)h[o];
|
||||
cb.SelectedIndex = h[o];
|
||||
}
|
||||
private void v2cb(ComboBox cb, int o)
|
||||
{
|
||||
cb.SelectedValue = (int)(h[o] + h[o + 1] * 0x100);
|
||||
cb.SelectedValue = h[o] + h[o + 1] * 0x100;
|
||||
}
|
||||
private void cb1v(ComboBox cb, int o)
|
||||
{
|
||||
|
@ -258,14 +258,15 @@ namespace PKHeX
|
|||
|
||||
private void getCountries()
|
||||
{
|
||||
ComboBox[] cba = new ComboBox[] { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4, };
|
||||
for (int i = 0; i < cba.Length; i++)
|
||||
ComboBox[] cba = { CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4, };
|
||||
foreach (ComboBox comboBox in cba)
|
||||
{
|
||||
cba[i].DisplayMember = "Text";
|
||||
cba[i].ValueMember = "Value";
|
||||
m_parent.setCountrySubRegion(cba[i], "countries");
|
||||
comboBox.DisplayMember = "Text";
|
||||
comboBox.ValueMember = "Value";
|
||||
m_parent.setCountrySubRegion(comboBox, "countries");
|
||||
}
|
||||
}
|
||||
|
||||
private void getLangStrings()
|
||||
{
|
||||
// Memory Chooser
|
||||
|
@ -278,7 +279,7 @@ namespace PKHeX
|
|||
allowed[i] = i + 1;
|
||||
}
|
||||
Array.Resize(ref allowed, allowed.Length - 1);
|
||||
var memory_list1 = Util.getCBList(new string[] { memories[0] }, null);
|
||||
var memory_list1 = Util.getCBList(new[] { memories[0] }, null);
|
||||
var memory_list = Util.getOffsetCBList(memory_list1, memories, 0, allowed);
|
||||
|
||||
CB_OTMemory.DisplayMember = "Text";
|
||||
|
@ -309,7 +310,7 @@ namespace PKHeX
|
|||
}
|
||||
private void getMemoryArguments(string ARG, ComboBox sender)
|
||||
{
|
||||
var argvals = Util.getCBList(new string[] { "" }, null);
|
||||
var argvals = Util.getCBList(new[] { "" }, null);
|
||||
|
||||
string vs = "";
|
||||
bool enabled = true;
|
||||
|
@ -331,25 +332,25 @@ namespace PKHeX
|
|||
else if (ARG == "ITEM")
|
||||
{
|
||||
#region Items
|
||||
int[] items_allowed = new int[]
|
||||
int[] items_allowed =
|
||||
{
|
||||
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,
|
||||
50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,
|
||||
100,101,102,103,104,105,106,107,108,109,110,111,112,116,117,118,119,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,
|
||||
150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,
|
||||
200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,
|
||||
250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,
|
||||
300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,
|
||||
350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,
|
||||
400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,
|
||||
450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,
|
||||
500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,
|
||||
550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,
|
||||
600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,
|
||||
650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,
|
||||
700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,
|
||||
/* ORAS */
|
||||
718,719,720,737,738,739,740,741,742,765,775
|
||||
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,
|
||||
50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,
|
||||
100,101,102,103,104,105,106,107,108,109,110,111,112,116,117,118,119,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,
|
||||
150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,
|
||||
200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,
|
||||
250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,
|
||||
300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,
|
||||
350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,
|
||||
400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,
|
||||
450,451,452,453,454,455,456,457,458,459,460,461,462,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,485,486,487,488,489,490,491,492,493,494,495,496,497,498,499,
|
||||
500,501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525,526,527,528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547,548,549,
|
||||
550,551,552,553,554,555,556,557,558,559,560,561,562,563,564,565,566,567,568,569,570,571,572,573,574,575,576,577,578,579,580,581,582,583,584,585,586,587,588,589,590,591,592,593,594,595,596,597,598,599,
|
||||
600,601,602,603,604,605,606,607,608,609,610,611,612,613,614,615,616,617,618,619,620,621,623,624,625,626,627,628,629,630,631,632,633,634,635,636,637,638,639,640,641,642,643,644,645,646,647,648,649,
|
||||
650,651,652,653,654,655,656,657,658,659,660,661,662,663,664,665,666,667,668,669,670,671,672,673,674,675,676,677,678,679,680,681,682,683,684,685,686,687,688,689,690,691,692,693,694,695,696,697,698,699,
|
||||
700,701,702,703,704,705,706,707,708,709,710,711,712,713,714,715,716,717,
|
||||
/* ORAS */
|
||||
718,719,720,737,738,739,740,741,742,765,775
|
||||
};
|
||||
var item_list = Util.getCBList(Form1.itemlist, items_allowed);
|
||||
#endregion
|
||||
|
@ -363,7 +364,6 @@ namespace PKHeX
|
|||
}
|
||||
else if (ARG == "LOCATION")
|
||||
{
|
||||
int[] allowed = { };
|
||||
argvals = Util.getCBList(Form1.metXY_00000, Legal.Met_XY_0);
|
||||
vs = vartypes[4];
|
||||
}
|
||||
|
@ -487,7 +487,7 @@ namespace PKHeX
|
|||
case 63: getMemoryArguments("NONE", m); break;
|
||||
case 64: getMemoryArguments("NONE", m); break;
|
||||
default: getMemoryArguments("NONE", m); break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (!init) return;
|
||||
|
@ -496,11 +496,11 @@ namespace PKHeX
|
|||
}
|
||||
private void changeCountry(object sender, EventArgs e)
|
||||
{
|
||||
ComboBox[] cba = new ComboBox[]
|
||||
ComboBox[] cba =
|
||||
{
|
||||
CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4
|
||||
};
|
||||
ComboBox[] mta = new ComboBox[]
|
||||
ComboBox[] mta =
|
||||
{
|
||||
CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4,
|
||||
};
|
||||
|
@ -522,15 +522,15 @@ namespace PKHeX
|
|||
|
||||
private void clickResetLocation(object sender, EventArgs e)
|
||||
{
|
||||
Label[] senderarr = new Label[]
|
||||
Label[] senderarr =
|
||||
{
|
||||
L_Geo0, L_Geo1, L_Geo2, L_Geo3, L_Geo4,
|
||||
};
|
||||
ComboBox[] cba = new ComboBox[]
|
||||
ComboBox[] cba =
|
||||
{
|
||||
CB_Country0, CB_Country1, CB_Country2, CB_Country3, CB_Country4,
|
||||
};
|
||||
ComboBox[] mta = new ComboBox[]
|
||||
ComboBox[] mta =
|
||||
{
|
||||
CB_Region0, CB_Region1, CB_Region2, CB_Region3, CB_Region4,
|
||||
};
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class RibbMedal : Form
|
||||
{
|
||||
Form1 m_parent;
|
||||
CheckBox[] distro;
|
||||
public RibbMedal(Form1 frm1)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
@ -29,7 +21,6 @@ namespace PKHeX
|
|||
comboBox1.Items.Add(Form1.trainingbags[i]);
|
||||
comboBox1.SelectedIndex = m_parent.buff[0x17];
|
||||
numericUpDown1.Value = m_parent.buff[0x16];
|
||||
distro = new CheckBox[] { CHK_D0, CHK_D1, CHK_D2, CHK_D3, CHK_D4, CHK_D5 };
|
||||
getRibbons();
|
||||
}
|
||||
private void getRibbons()
|
||||
|
@ -298,7 +289,7 @@ namespace PKHeX
|
|||
dis |= addRibbon(CHK_D5);
|
||||
m_parent.buff[0x3A] = (byte)dis;
|
||||
|
||||
m_parent.buff[0x72] = (byte)Convert.ToByte(CHK_Secret.Checked);
|
||||
m_parent.buff[0x72] = Convert.ToByte(CHK_Secret.Checked);
|
||||
} // Saving Ribbons prompted
|
||||
private void updateRibbon(CheckBox chk, int rv, int sh)
|
||||
{
|
||||
|
@ -341,11 +332,9 @@ namespace PKHeX
|
|||
|
||||
TB_PastContest.Text = (Convert.ToInt32(b) * 40).ToString();
|
||||
TB_PastBattle.Text = (Convert.ToInt32(b) * 8).ToString();
|
||||
if (m_parent.buff[0xDF] > 0x10)
|
||||
{
|
||||
TB_PastContest.Text = 0.ToString();
|
||||
TB_PastBattle.Text = 0.ToString();
|
||||
}
|
||||
if (m_parent.buff[0xDF] <= 0x10) return; // gen3
|
||||
TB_PastContest.Text = 0.ToString(); // no past gen ribbons 4-5
|
||||
TB_PastBattle.Text = 0.ToString();
|
||||
}
|
||||
else if (tabControl1.SelectedTab == Tab_Medals)
|
||||
{
|
||||
|
@ -369,7 +358,7 @@ namespace PKHeX
|
|||
CHK_Secret
|
||||
};
|
||||
checkboxFlag(ck, b);
|
||||
foreach (CheckBox chk in distro) chk.Checked = b;
|
||||
foreach (CheckBox chk in new[] { CHK_D0, CHK_D1, CHK_D2, CHK_D3, CHK_D4, CHK_D5 }) chk.Checked = b;
|
||||
}
|
||||
} // Checkbox Flipping Logic (dependent on Tab)
|
||||
|
||||
|
@ -396,15 +385,13 @@ namespace PKHeX
|
|||
private void updateSecretSuper(object sender, EventArgs e)
|
||||
{
|
||||
GB_Medals2.Enabled = CHK_Secret.Checked;
|
||||
if (!CHK_Secret.Checked)
|
||||
{
|
||||
CheckBox[] ck = {TMedal3_4,
|
||||
TMedal3_5, TMedal3_6, TMedal3_7, TMedal4_0,
|
||||
TMedal4_1, TMedal4_2, TMedal4_3,
|
||||
TMedal4_4, TMedal4_5, TMedal4_6,
|
||||
TMedal4_7};
|
||||
checkboxFlag(ck, false);
|
||||
}
|
||||
if (CHK_Secret.Checked) return;
|
||||
CheckBox[] ck = {
|
||||
TMedal3_4, TMedal3_5, TMedal3_6, TMedal3_7,
|
||||
TMedal4_0, TMedal4_1, TMedal4_2, TMedal4_3,
|
||||
TMedal4_4, TMedal4_5, TMedal4_6, TMedal4_7
|
||||
};
|
||||
checkboxFlag(ck, false);
|
||||
} // Only allow secret if checkbox is toggled.
|
||||
private void unusedbits(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -458,7 +445,7 @@ namespace PKHeX
|
|||
int index = Array.IndexOf(cba, sender as CheckBox);
|
||||
|
||||
|
||||
pba[index].Image = Util.ChangeOpacity(bma[index], (float)(Convert.ToInt32(cba[index].Checked)) * 0.9 + 0.1);
|
||||
pba[index].Image = Util.ChangeOpacity(bma[index], Convert.ToInt32(cba[index].Checked) * 0.9 + 0.1);
|
||||
}
|
||||
private void pastribbontoggle(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -466,18 +453,11 @@ namespace PKHeX
|
|||
PastContest, PastBattle,
|
||||
};
|
||||
|
||||
if (Util.ToUInt32(TB_PastContest.Text) < 40)
|
||||
pba2[0].Image = Properties.Resources.contestmemory;
|
||||
else
|
||||
pba2[0].Image = Properties.Resources.contestmemory2;
|
||||
pba2[0].Image = Util.ToUInt32(TB_PastContest.Text) < 40 ? Properties.Resources.contestmemory : Properties.Resources.contestmemory2;
|
||||
pba2[1].Image = Util.ToUInt32(TB_PastBattle.Text) < 8 ? Properties.Resources.battlememory : Properties.Resources.battlememory2;
|
||||
|
||||
if (Util.ToUInt32(TB_PastBattle.Text) < 8)
|
||||
pba2[1].Image = Properties.Resources.battlememory;
|
||||
else
|
||||
pba2[1].Image = Properties.Resources.battlememory2;
|
||||
|
||||
pba2[0].Image = Util.ChangeOpacity(pba2[0].Image, (float)(Util.ToUInt32(TB_PastContest.Text)) * 0.9 + 0.1);
|
||||
pba2[1].Image = Util.ChangeOpacity(pba2[1].Image, (float)(Util.ToUInt32(TB_PastBattle.Text)) * 0.9 + 0.1);
|
||||
pba2[0].Image = Util.ChangeOpacity(pba2[0].Image, Util.ToUInt32(TB_PastContest.Text) * 0.9 + 0.1);
|
||||
pba2[1].Image = Util.ChangeOpacity(pba2[1].Image, Util.ToUInt32(TB_PastBattle.Text) * 0.9 + 0.1);
|
||||
}
|
||||
|
||||
private void clickRibbon(object sender, EventArgs e)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
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
|
||||
|
@ -16,14 +10,13 @@ namespace PKHeX
|
|||
berryfoffset = bfo;
|
||||
InitializeComponent();
|
||||
Util.TranslateInterface(this, Form1.curlanguage);
|
||||
m_parent = frm1;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
savindex = m_parent.savindex;
|
||||
Form1 mParent = frm1;
|
||||
Array.Copy(mParent.savefile, sav, 0x100000);
|
||||
savindex = mParent.savindex;
|
||||
shiftval = savindex * 0x7F000;
|
||||
listBox1.SelectedIndex = 0;
|
||||
}
|
||||
int berryfoffset;
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public int savindex; int shiftval;
|
||||
public bool editing = false;
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
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;
|
||||
|
||||
|
@ -22,8 +18,8 @@ namespace PKHeX
|
|||
|
||||
// Repopulate Wallpaper names
|
||||
CB_BG.Items.Clear();
|
||||
for (int i = 0; i < Form1.wallpapernames.Length; i++)
|
||||
CB_BG.Items.Add(Form1.wallpapernames[i]);
|
||||
foreach (string wallpaper in Form1.wallpapernames)
|
||||
CB_BG.Items.Add(wallpaper);
|
||||
|
||||
// Go
|
||||
LB_BoxSelect.SelectedIndex = m_parent.C_BoxSelect.SelectedIndex;
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -20,9 +15,9 @@ namespace PKHeX
|
|||
m_parent = frm1;
|
||||
savshift = 0x7F000 * m_parent.savindex;
|
||||
|
||||
this.AllowDrop = true;
|
||||
this.DragEnter += tabMain_DragEnter;
|
||||
this.DragDrop += tabMain_DragDrop;
|
||||
AllowDrop = true;
|
||||
DragEnter += tabMain_DragEnter;
|
||||
DragDrop += tabMain_DragDrop;
|
||||
Setup();
|
||||
|
||||
nud.Text = "0"; // Prompts an update for flag 0.
|
||||
|
@ -41,8 +36,8 @@ namespace PKHeX
|
|||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Gather Updated Flags
|
||||
for (int i = 0; i < chka.Length; i++)
|
||||
flags[getFlagNum(chka[i])] = chka[i].Checked;
|
||||
foreach (CheckBox flag in chka)
|
||||
flags[getFlagNum(flag)] = flag.Checked;
|
||||
|
||||
byte[] data = new byte[flags.Length / 8];
|
||||
|
||||
|
@ -58,15 +53,15 @@ namespace PKHeX
|
|||
// Copy back Constants
|
||||
changeConstantIndex(null, null); // Trigger Saving
|
||||
for (int i = 0; i < Constants.Length; i++)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Constants[i]), 0, m_parent.savefile, 0x19E00 + savshift + 2 * i, 2);
|
||||
Array.Copy(BitConverter.GetBytes(Constants[i]), 0, m_parent.savefile, 0x19E00 + savshift + 2 * i, 2);
|
||||
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void Setup()
|
||||
{
|
||||
// Fill Bit arrays
|
||||
|
||||
chka = new CheckBox[] {
|
||||
chka = new[] {
|
||||
|
||||
flag_0173,flag_2811, // Raikou
|
||||
flag_0174,flag_2812, // Entei
|
||||
|
@ -131,13 +126,11 @@ namespace PKHeX
|
|||
}
|
||||
private void popFlags()
|
||||
{
|
||||
if (setup)
|
||||
{
|
||||
for (int i = 0; i < chka.Length; i++)
|
||||
chka[i].Checked = flags[getFlagNum(chka[i])];
|
||||
if (!setup) return;
|
||||
foreach (CheckBox flag in chka)
|
||||
flag.Checked = flags[getFlagNum(flag)];
|
||||
|
||||
changeCustomFlag(null, null);
|
||||
}
|
||||
changeCustomFlag(null, null);
|
||||
}
|
||||
|
||||
private int getFlagNum(CheckBox chk)
|
||||
|
@ -195,13 +188,11 @@ namespace PKHeX
|
|||
string tbUnSet = "";
|
||||
for (int i = 0; i < oldBits.Length; i++)
|
||||
{
|
||||
if (oldBits[i] != newBits[i])
|
||||
{
|
||||
if (newBits[i])
|
||||
tbIsSet += (i.ToString("0000") + ",");
|
||||
else
|
||||
tbUnSet += (i.ToString("0000") + ",");
|
||||
}
|
||||
if (oldBits[i] == newBits[i]) continue;
|
||||
if (newBits[i])
|
||||
tbIsSet += (i.ToString("0000") + ",");
|
||||
else
|
||||
tbUnSet += (i.ToString("0000") + ",");
|
||||
}
|
||||
TB_IsSet.Text = tbIsSet;
|
||||
TB_UnSet.Text = tbUnSet;
|
||||
|
@ -218,14 +209,21 @@ namespace PKHeX
|
|||
{
|
||||
FileInfo fi = new FileInfo(path);
|
||||
byte[] eventflags = new byte[0x180];
|
||||
if (fi.Length == 0x100000)
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC, eventflags, 0, 0x180);
|
||||
else if (fi.Length == 0x76000)
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else if (fi.Name.ToLower().Contains("ram") && fi.Length == 0x80000)
|
||||
Array.Copy(ram2sav.getMAIN(File.ReadAllBytes(path)), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else
|
||||
{ Util.Error("Invalid SAV Size", String.Format("File Size: 0x{1} ({0} bytes)", fi.Length.ToString(), fi.Length.ToString("X5")), "File Loaded: " + path); return; }
|
||||
switch (fi.Length)
|
||||
{
|
||||
case 0x100000: // ramsav
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC, eventflags, 0, 0x180);
|
||||
break;
|
||||
case 0x76000: // oras main
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
break;
|
||||
default: // figure it out
|
||||
if (fi.Name.ToLower().Contains("ram") && fi.Length == 0x80000)
|
||||
Array.Copy(ram2sav.getMAIN(File.ReadAllBytes(path)), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else
|
||||
{ Util.Error("Invalid SAV Size", String.Format("File Size: 0x{1} ({0} bytes)", fi.Length.ToString(), fi.Length.ToString("X5")), "File Loaded: " + path); return; }
|
||||
break;
|
||||
}
|
||||
|
||||
Button bs = (Button)sender;
|
||||
if (bs.Name == "B_LoadOld")
|
||||
|
|
|
@ -1,13 +1,8 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -20,9 +15,9 @@ namespace PKHeX
|
|||
m_parent = frm1;
|
||||
savshift = 0x7F000 * m_parent.savindex;
|
||||
|
||||
this.AllowDrop = true;
|
||||
this.DragEnter += tabMain_DragEnter;
|
||||
this.DragDrop += tabMain_DragDrop;
|
||||
AllowDrop = true;
|
||||
DragEnter += tabMain_DragEnter;
|
||||
DragDrop += tabMain_DragDrop;
|
||||
|
||||
Setup();
|
||||
|
||||
|
@ -41,8 +36,8 @@ namespace PKHeX
|
|||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Gather Updated Flags
|
||||
for (int i = 0; i < chka.Length; i++)
|
||||
flags[getFlagNum(chka[i])] = chka[i].Checked;
|
||||
foreach (CheckBox flag in chka)
|
||||
flags[getFlagNum(flag)] = flag.Checked;
|
||||
|
||||
byte[] data = new byte[flags.Length / 8];
|
||||
|
||||
|
@ -56,15 +51,15 @@ namespace PKHeX
|
|||
// Copy back Constants
|
||||
changeConstantIndex(null, null); // Trigger Saving
|
||||
for (int i = 0; i < Constants.Length; i++)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Constants[i]), 0, m_parent.savefile, 0x19E00 + savshift + 2 * i, 2);
|
||||
Array.Copy(BitConverter.GetBytes(Constants[i]), 0, m_parent.savefile, 0x19E00 + savshift + 2 * i, 2);
|
||||
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void Setup()
|
||||
{
|
||||
// Fill Bit arrays
|
||||
|
||||
chka = new CheckBox[] {
|
||||
chka = new[] {
|
||||
flag_0001,flag_0002,flag_0003,flag_0004,flag_0005,
|
||||
flag_2237,flag_2238,flag_2239,
|
||||
flag_0115,flag_0963, // Mewtwo
|
||||
|
@ -95,13 +90,11 @@ namespace PKHeX
|
|||
}
|
||||
private void popFlags()
|
||||
{
|
||||
if (setup)
|
||||
{
|
||||
for (int i = 0; i < chka.Length; i++)
|
||||
chka[i].Checked = flags[getFlagNum(chka[i])];
|
||||
if (!setup) return;
|
||||
foreach (CheckBox flag in chka)
|
||||
flag.Checked = flags[getFlagNum(flag)];
|
||||
|
||||
changeCustomFlag(null, null);
|
||||
}
|
||||
changeCustomFlag(null, null);
|
||||
}
|
||||
|
||||
private int getFlagNum(CheckBox chk)
|
||||
|
@ -184,14 +177,21 @@ namespace PKHeX
|
|||
{
|
||||
FileInfo fi = new FileInfo(path);
|
||||
byte[] eventflags = new byte[0x180];
|
||||
if (fi.Length == 0x100000)
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC, eventflags, 0, 0x180);
|
||||
else if (fi.Length == 0x65600)
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else if (fi.Name.ToLower().Contains("ram") && fi.Length == 0x70000)
|
||||
Array.Copy(ram2sav.getMAIN(File.ReadAllBytes(path)), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else
|
||||
{ Util.Error("Invalid SAV Size", String.Format("File Size: 0x{1} ({0} bytes)", fi.Length.ToString(), fi.Length.ToString("X5")), "File Loaded: " + path); return; }
|
||||
switch (fi.Length)
|
||||
{
|
||||
case 0x100000: // ramsav
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC, eventflags, 0, 0x180);
|
||||
break;
|
||||
case 0x65600: // xy main
|
||||
Array.Copy(File.ReadAllBytes(path), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
break;
|
||||
default: // figure it out
|
||||
if (fi.Name.ToLower().Contains("ram") && fi.Length == 0x70000)
|
||||
Array.Copy(ram2sav.getMAIN(File.ReadAllBytes(path)), 0x1A0FC - 0x5400, eventflags, 0, 0x180);
|
||||
else
|
||||
{ Util.Error("Invalid SAV Size", String.Format("File Size: 0x{1} ({0} bytes)", fi.Length.ToString(), fi.Length.ToString("X5")), "File Loaded: " + path); return; }
|
||||
break;
|
||||
}
|
||||
|
||||
Button bs = (Button)sender;
|
||||
if (bs.Name == "B_LoadOld")
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -59,7 +54,7 @@ namespace PKHeX
|
|||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public int savindex; int shiftval;
|
||||
public bool editing = false;
|
||||
public bool editing;
|
||||
private int data_offset = 0x1E800;
|
||||
|
||||
private string[] types = Form1.types;
|
||||
|
@ -71,16 +66,12 @@ namespace PKHeX
|
|||
|
||||
private void Setup()
|
||||
{
|
||||
try
|
||||
{
|
||||
CB_Species.Items.Clear();
|
||||
CB_HeldItem.Items.Clear();
|
||||
CB_Move1.Items.Clear();
|
||||
CB_Move2.Items.Clear();
|
||||
CB_Move3.Items.Clear();
|
||||
CB_Move4.Items.Clear();
|
||||
}
|
||||
catch { }
|
||||
CB_Species.Items.Clear();
|
||||
CB_HeldItem.Items.Clear();
|
||||
CB_Move1.Items.Clear();
|
||||
CB_Move2.Items.Clear();
|
||||
CB_Move3.Items.Clear();
|
||||
CB_Move4.Items.Clear();
|
||||
|
||||
#region Species
|
||||
{
|
||||
|
@ -123,7 +114,6 @@ namespace PKHeX
|
|||
{
|
||||
editing = false;
|
||||
RTB.Font = new Font("Courier New", 8);
|
||||
string s = "";
|
||||
RTB.LanguageOption = RichTextBoxLanguageOptions.DualFont;
|
||||
int index = LB_DataEntry.SelectedIndex;
|
||||
int offset = index * 0x1B4;
|
||||
|
@ -131,7 +121,7 @@ namespace PKHeX
|
|||
uint vnd = BitConverter.ToUInt32(data, offset + 0x1B0);
|
||||
uint vn = vnd & 0xFF;
|
||||
TB_VN.Text = vn.ToString("000");
|
||||
s = "Entry #" + vn + Environment.NewLine;
|
||||
string s = "Entry #" + vn + Environment.NewLine;
|
||||
uint date = (vnd >> 14) & 0x1FFFF;
|
||||
uint year = (date & 0xFF) + 2000;
|
||||
uint month = (date >> 8) & 0xF;
|
||||
|
@ -139,20 +129,17 @@ namespace PKHeX
|
|||
if (day == 0)
|
||||
{
|
||||
s += "No records in this slot.";
|
||||
for (int i = 0; i < editor_spec.Length; i++)
|
||||
((Control)editor_spec[i]).Enabled = false;
|
||||
foreach (object t in editor_spec)
|
||||
((Control)t).Enabled = false;
|
||||
|
||||
editing = false;
|
||||
NUP_PartyIndex_ValueChanged(sender, e);
|
||||
goto end;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < editor_spec.Length; i++)
|
||||
((Control)editor_spec[i]).Enabled = true;
|
||||
}
|
||||
foreach (object t in editor_spec)
|
||||
((Control)t).Enabled = true;
|
||||
|
||||
s += "Date: " + year.ToString() + "/" + month.ToString() + "/" + day.ToString() + "" + Environment.NewLine + Environment.NewLine;
|
||||
s += "Date: " + year + "/" + month + "/" + day + "" + Environment.NewLine + Environment.NewLine;
|
||||
CAL_MetDate.Value = new DateTime((int)year, (int)month, (int)day);
|
||||
int moncount = 0;
|
||||
for (int i = 0; i < 6; i++)
|
||||
|
@ -168,11 +155,11 @@ namespace PKHeX
|
|||
int SID = BitConverter.ToUInt16(data, offset + 0x12);
|
||||
|
||||
uint slgf = BitConverter.ToUInt32(data, offset + 0x14);
|
||||
uint form = slgf & 0x1F;
|
||||
// uint form = slgf & 0x1F;
|
||||
uint gender = (slgf >> 5) & 3; // 0 M; 1 F; 2 G
|
||||
uint level = (slgf >> 7) & 0x7F;
|
||||
uint shiny = (slgf >> 14) & 0x1;
|
||||
uint unkn = slgf >> 15;
|
||||
// uint unkn = slgf >> 15;
|
||||
|
||||
string nickname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x18, 22));
|
||||
string OTname = Util.TrimFromZero(Encoding.Unicode.GetString(data, offset + 0x30, 22));
|
||||
|
@ -186,14 +173,14 @@ namespace PKHeX
|
|||
|
||||
s += "Name: " + nickname;
|
||||
s += " (" + Form1.specieslist[species] + " - " + genderstr + ")" + Environment.NewLine;
|
||||
s += "Level: " + level.ToString() + Environment.NewLine;
|
||||
s += "Level: " + level + Environment.NewLine;
|
||||
s += "Shiny: " + shinystr + Environment.NewLine;
|
||||
s += "Held Item: " + Form1.itemlist[helditem] + Environment.NewLine;
|
||||
s += "Move 1: " + Form1.movelist[move1] + Environment.NewLine;
|
||||
s += "Move 2: " + Form1.movelist[move2] + Environment.NewLine;
|
||||
s += "Move 3: " + Form1.movelist[move3] + Environment.NewLine;
|
||||
s += "Move 4: " + Form1.movelist[move4] + Environment.NewLine;
|
||||
s += "OT: " + OTname + " (" + TID.ToString() + "/" + SID.ToString() + ")" + Environment.NewLine;
|
||||
s += "OT: " + OTname + " (" + TID + "/" + SID + ")" + Environment.NewLine;
|
||||
s += Environment.NewLine;
|
||||
|
||||
offset += 0x48;
|
||||
|
@ -412,10 +399,7 @@ namespace PKHeX
|
|||
|
||||
if (gt < 256) // If not a single gender(less) species:
|
||||
{
|
||||
if (PKX.getGender(Label_Gender.Text) == 0) // ♂
|
||||
Label_Gender.Text = gendersymbols[1]; // ♀
|
||||
else
|
||||
Label_Gender.Text = gendersymbols[0]; // ♂
|
||||
Label_Gender.Text = PKX.getGender(Label_Gender.Text) == 0 ? gendersymbols[1] : gendersymbols[0];
|
||||
|
||||
if (PKX.getGender(CB_Form.Text) == 0 && Label_Gender.Text != gendersymbols[0])
|
||||
CB_Form.SelectedIndex = 1;
|
||||
|
@ -447,26 +431,25 @@ namespace PKHeX
|
|||
{ bpkx.Image = (Image)Properties.Resources.ResourceManager.GetObject("_0"); }
|
||||
else
|
||||
{
|
||||
file = "_" + species.ToString();
|
||||
file = "_" + species;
|
||||
if (form > 0) // Alt Form Handling
|
||||
file = file + "_" + form.ToString();
|
||||
file = file + "_" + form;
|
||||
else if ((gender == 1) && (species == 521 || species == 668)) // Unfezant & Pyroar
|
||||
file = file = "_" + species.ToString() + "f";
|
||||
file = "_" + species + "f";
|
||||
}
|
||||
|
||||
Image baseImage = (Image)Properties.Resources.ResourceManager.GetObject(file);
|
||||
if (shiny)
|
||||
{ // Is Shiny
|
||||
// Redraw our image
|
||||
baseImage = PKHeX.Util.LayerImage(baseImage, Properties.Resources.rare_icon, 0, 0, 0.7);
|
||||
baseImage = Util.LayerImage(baseImage, Properties.Resources.rare_icon, 0, 0, 0.7);
|
||||
}
|
||||
if (item > 0)
|
||||
{
|
||||
// Has Item
|
||||
Image itemimg = (Image)Properties.Resources.ResourceManager.GetObject("item_" + item.ToString());
|
||||
if (itemimg == null) itemimg = Properties.Resources.helditem;
|
||||
Image itemimg = (Image)Properties.Resources.ResourceManager.GetObject("item_" + item) ?? Properties.Resources.helditem;
|
||||
// Redraw
|
||||
baseImage = PKHeX.Util.LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1);
|
||||
baseImage = Util.LayerImage(baseImage, itemimg, 22 + (15 - itemimg.Width) / 2, 15 + (15 - itemimg.Height), 1);
|
||||
}
|
||||
bpkx.Image = baseImage;
|
||||
editing = true;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
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
|
||||
|
@ -21,7 +16,7 @@ namespace PKHeX
|
|||
shiftval = savindex * 0x7F000;
|
||||
if (m_parent.savegame_oras)
|
||||
{
|
||||
bagoffsets = new int[]
|
||||
bagoffsets = new[]
|
||||
{
|
||||
0x05800,
|
||||
0x05E40,
|
||||
|
@ -58,13 +53,14 @@ namespace PKHeX
|
|||
public string[] medicine_val;
|
||||
public string[] berries_val;
|
||||
|
||||
public int[] bagoffsets = new int[] {
|
||||
0x05800,
|
||||
0x05E40,
|
||||
0x05FC0,
|
||||
0x06168,
|
||||
0x06268,
|
||||
};
|
||||
public int[] bagoffsets =
|
||||
{
|
||||
0x05800,
|
||||
0x05E40,
|
||||
0x05FC0,
|
||||
0x06168,
|
||||
0x06268,
|
||||
};
|
||||
|
||||
// Initialize String Tables
|
||||
private void getListItems()
|
||||
|
@ -147,11 +143,13 @@ namespace PKHeX
|
|||
dgvIndex.Width = 45;
|
||||
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
DataGridViewComboBoxColumn dgvItemVal = new DataGridViewComboBoxColumn();
|
||||
dgvItemVal.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
|
||||
DataGridViewComboBoxColumn dgvItemVal = new DataGridViewComboBoxColumn
|
||||
{
|
||||
for (int i = 0; i < itemarr.Length; i++)
|
||||
dgvItemVal.Items.Add(itemarr[i]); // add only the Item Names
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
|
||||
};
|
||||
{
|
||||
foreach (string t in itemarr)
|
||||
dgvItemVal.Items.Add(t); // add only the Item Names
|
||||
|
||||
dgvItemVal.DisplayIndex = 0;
|
||||
dgvItemVal.Width = 135;
|
||||
|
@ -197,31 +195,25 @@ namespace PKHeX
|
|||
}
|
||||
private void saveBag(object sender)
|
||||
{
|
||||
string[] itemstrarr = {};
|
||||
int offset = 0;
|
||||
if (B_DisplayItems.ForeColor == Color.Red)
|
||||
{
|
||||
itemstrarr = item_val;
|
||||
offset = bagoffsets[0] + shiftval;
|
||||
}
|
||||
else if (B_DisplayKeyItems.ForeColor == Color.Red)
|
||||
{
|
||||
itemstrarr = keyitem_val;
|
||||
offset = bagoffsets[1] + shiftval;
|
||||
}
|
||||
else if (B_DisplayTMHM.ForeColor == Color.Red)
|
||||
{
|
||||
itemstrarr = tmhm_val;
|
||||
offset = bagoffsets[2] + shiftval;
|
||||
}
|
||||
else if (B_DisplayMedicine.ForeColor == Color.Red)
|
||||
{
|
||||
itemstrarr = medicine_val;
|
||||
offset = bagoffsets[3] + shiftval;
|
||||
}
|
||||
else if (B_DisplayBerries.ForeColor == Color.Red)
|
||||
{
|
||||
itemstrarr = berries_val;
|
||||
offset = bagoffsets[4] + shiftval;
|
||||
}
|
||||
|
||||
|
@ -232,7 +224,7 @@ namespace PKHeX
|
|||
{
|
||||
string item = dataGridView1.Rows[i].Cells[0].Value.ToString();
|
||||
int itemindex = Array.IndexOf(Form1.itemlist, item);
|
||||
int itemcnt = 0;
|
||||
int itemcnt;
|
||||
try
|
||||
{ itemcnt = Convert.ToUInt16(dataGridView1.Rows[i].Cells[1].Value.ToString()); }
|
||||
catch { itemcnt = 0; }
|
||||
|
@ -242,7 +234,7 @@ namespace PKHeX
|
|||
emptyslots++;
|
||||
continue;
|
||||
}
|
||||
else if (itemcnt == 0)
|
||||
if (itemcnt == 0)
|
||||
itemcnt++; // No 0 count of items
|
||||
else if (itemcnt > 995)
|
||||
itemcnt = 995;
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
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
|
||||
|
@ -23,12 +18,12 @@ namespace PKHeX
|
|||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.SaveData();
|
||||
this.Close();
|
||||
SaveData();
|
||||
Close();
|
||||
}
|
||||
private int opoweroffset = 0x1BE00;
|
||||
private void LoadData()
|
||||
|
@ -36,10 +31,6 @@ namespace PKHeX
|
|||
int o = opoweroffset + m_parent.savindex * 0x7F000; // offset
|
||||
|
||||
// Fill up the 17 o-powers
|
||||
ComboBox[] cba = new ComboBox[] {
|
||||
CB_1, CB_2, CB_3, CB_4, CB_5, CB_6, CB_7, CB_8, CB_9,
|
||||
CB_10, CB_11, CB_12, CB_13, CB_14, CB_15, CB_16, CB_17,
|
||||
};
|
||||
// 1 2 3 4 5 10 use 4 bytes, everything else uses 3
|
||||
o++; // Skip first 0
|
||||
CB_1.SelectedIndex = getIndex(o, 4); o += 4; o++; // @ 1
|
||||
|
@ -76,11 +67,13 @@ namespace PKHeX
|
|||
}
|
||||
private void SaveData()
|
||||
{
|
||||
ComboBox[] cba = new ComboBox[] {
|
||||
ComboBox[] cba =
|
||||
{
|
||||
CB_1, CB_2, CB_3, CB_4, CB_5, CB_6, CB_7, CB_8, CB_9,
|
||||
CB_10, CB_11, CB_12, CB_13, CB_14, CB_15, CB_16, CB_17,
|
||||
};
|
||||
int[] offsets= new int[] {
|
||||
int[] offsets =
|
||||
{
|
||||
1,6,0xB,0x10,0x15,
|
||||
0x1A,0x1D,0x20,0x23,
|
||||
0x27,
|
||||
|
@ -111,21 +104,20 @@ namespace PKHeX
|
|||
}
|
||||
private int getIndex(int o, int l)
|
||||
{
|
||||
byte[] _0 = new byte[] { 00, 00, 00, 00, };
|
||||
byte[] _1 = new byte[] { 01, 00, 00, 00, };
|
||||
byte[] _2 = new byte[] { 01, 01, 00, 00, };
|
||||
byte[] _3 = new byte[] { 01, 01, 01, 00, };
|
||||
byte[] _4 = new byte[] { 01, 01, 01, 01, };
|
||||
byte[] _0 = { 00, 00, 00, 00, };
|
||||
byte[] _1 = { 01, 00, 00, 00, };
|
||||
byte[] _2 = { 01, 01, 00, 00, };
|
||||
byte[] _3 = { 01, 01, 01, 00, };
|
||||
byte[] _4 = { 01, 01, 01, 01, };
|
||||
|
||||
byte[] data = new byte[4];
|
||||
Array.Copy(m_parent.savefile, o, data, 0, l);
|
||||
|
||||
if (data.SequenceEqual(_4)) return 4;
|
||||
else if (data.SequenceEqual(_3)) return 3;
|
||||
else if (data.SequenceEqual(_2)) return 2;
|
||||
else if (data.SequenceEqual(_1)) return 1;
|
||||
else if (data.SequenceEqual(_0)) return 0;
|
||||
else return 1;
|
||||
if (data.SequenceEqual(_4)) return 4;
|
||||
if (data.SequenceEqual(_3)) return 3;
|
||||
if (data.SequenceEqual(_2)) return 2;
|
||||
if (data.SequenceEqual(_1)) return 1;
|
||||
return data.SequenceEqual(_0) ? 0 : 1;
|
||||
}
|
||||
private void B_AllMax_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -137,24 +129,25 @@ namespace PKHeX
|
|||
}
|
||||
private void max(bool s)
|
||||
{
|
||||
ComboBox[] cba = new ComboBox[] {
|
||||
ComboBox[] cba =
|
||||
{
|
||||
CB_1, CB_2, CB_3, CB_4, CB_5, CB_6, CB_7, CB_8, CB_9,
|
||||
CB_10, CB_11, CB_12, CB_13, CB_14, CB_15, CB_16, CB_17,
|
||||
};
|
||||
CheckBox[] echk = new CheckBox[] { CHK_1, CHK_2, CHK_3, CHK_4, CHK_5, CHK_6, CHK_7, CHK_8 };
|
||||
CheckBox[] echk = { CHK_1, CHK_2, CHK_3, CHK_4, CHK_5, CHK_6, CHK_7, CHK_8 };
|
||||
|
||||
for (int i = 0; i < cba.Length; i++)
|
||||
cba[i].SelectedIndex = (cba[i].Items.Count-1);
|
||||
foreach (ComboBox t in cba)
|
||||
t.SelectedIndex = (t.Items.Count-1);
|
||||
|
||||
if (!s)
|
||||
for (int i = 0; i < echk.Length; i++)
|
||||
echk[i].Checked = !(ModifierKeys == Keys.Control);
|
||||
foreach (CheckBox t in echk)
|
||||
t.Checked = ModifierKeys != Keys.Control;
|
||||
else if (ModifierKeys == Keys.Control)
|
||||
{
|
||||
for (int i = 0; i < cba.Length; i++)
|
||||
cba[i].SelectedIndex = 0;
|
||||
for (int i = 0; i < echk.Length; i++)
|
||||
echk[i].Checked = false;
|
||||
foreach (ComboBox t in cba)
|
||||
t.SelectedIndex = 0;
|
||||
foreach (CheckBox t in echk)
|
||||
t.Checked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
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
|
||||
|
@ -35,12 +29,8 @@ namespace PKHeX
|
|||
private void Setup()
|
||||
{
|
||||
// Clear Listbox and ComboBox
|
||||
try
|
||||
{
|
||||
LB_Species.Items.Clear();
|
||||
CB_Species.Items.Clear();
|
||||
}
|
||||
catch { }
|
||||
LB_Species.Items.Clear();
|
||||
CB_Species.Items.Clear();
|
||||
|
||||
// Fill List
|
||||
#region Species
|
||||
|
@ -63,7 +53,6 @@ namespace PKHeX
|
|||
int offset = dexoffset + 0x8 + 0x60 * i;
|
||||
Array.Copy(sav, offset, data, 0, 0x60);
|
||||
BitArray BitRegion = new BitArray(data);
|
||||
bool fuck = BitRegion[767];
|
||||
for (int b = 0; b < (0x60 * 8); b++)
|
||||
specbools[i, b] = BitRegion[b];
|
||||
}
|
||||
|
@ -83,38 +72,38 @@ namespace PKHeX
|
|||
editing = true;
|
||||
int index = (int)CB_Species.SelectedValue;
|
||||
LB_Species.SelectedIndex = index - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = (int)(LB_Species.SelectedIndex);
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
loadchks();
|
||||
editing = false;
|
||||
}
|
||||
}
|
||||
private void changeLBSpecies(object sender, EventArgs e)
|
||||
{
|
||||
if (!editing)
|
||||
if (editing) return;
|
||||
editing = true;
|
||||
try
|
||||
{
|
||||
editing = true;
|
||||
try
|
||||
{
|
||||
int index = LB_Species.SelectedIndex + 1;
|
||||
CB_Species.SelectedValue = index;
|
||||
}
|
||||
catch { };
|
||||
loadchks();
|
||||
editing = false;
|
||||
int index = LB_Species.SelectedIndex + 1;
|
||||
CB_Species.SelectedValue = index;
|
||||
}
|
||||
catch { }
|
||||
loadchks();
|
||||
editing = false;
|
||||
}
|
||||
private void loadchks()
|
||||
{
|
||||
// Load Bools for the data
|
||||
int pk = 0;
|
||||
int pk;
|
||||
try
|
||||
{ pk = Util.getIndex(CB_Species); }
|
||||
catch { pk = (int)LB_Species.SelectedIndex + 1; }
|
||||
catch { pk = LB_Species.SelectedIndex + 1; }
|
||||
|
||||
CheckBox[] CP = new CheckBox[] {
|
||||
CheckBox[] CP =
|
||||
{
|
||||
CHK_P1,CHK_P2,CHK_P3,CHK_P4,CHK_P5,CHK_P6,CHK_P7,CHK_P8,CHK_P9,
|
||||
};
|
||||
CheckBox[] CL = new CheckBox[] {
|
||||
CheckBox[] CL =
|
||||
{
|
||||
CHK_L1,CHK_L2,CHK_L3,CHK_L4,CHK_L5,CHK_L6,CHK_L7,
|
||||
};
|
||||
// Load Partitions
|
||||
|
@ -172,7 +161,7 @@ namespace PKHeX
|
|||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -180,7 +169,7 @@ namespace PKHeX
|
|||
|
||||
// Return back to the parent savefile
|
||||
Array.Copy(sav, m_parent.savefile, sav.Length);
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void saveChanges()
|
||||
{
|
||||
|
@ -234,19 +223,19 @@ namespace PKHeX
|
|||
CHK_L4.Checked =
|
||||
CHK_L5.Checked =
|
||||
CHK_L6.Checked =
|
||||
CHK_L7.Checked = !(ModifierKeys == Keys.Control);
|
||||
CHK_L7.Checked = ModifierKeys != Keys.Control;
|
||||
}
|
||||
if (CHK_P1.Enabled)
|
||||
{
|
||||
CHK_P1.Checked = !(ModifierKeys == Keys.Control);
|
||||
CHK_P1.Checked = ModifierKeys != Keys.Control;
|
||||
}
|
||||
int index = LB_Species.SelectedIndex+1;
|
||||
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(index);
|
||||
int gt = MonData.GenderRatio;
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = CHK_P6.Checked = CHK_P8.Checked = ((gt != 254)) && !(ModifierKeys == Keys.Control);
|
||||
CHK_P3.Checked = CHK_P5.Checked = CHK_P7.Checked = CHK_P9.Checked = (gt != 0) && (gt != 255) && !(ModifierKeys == Keys.Control);
|
||||
CHK_P2.Checked = CHK_P4.Checked = CHK_P6.Checked = CHK_P8.Checked = ((gt != 254)) && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = CHK_P7.Checked = CHK_P9.Checked = (gt != 0) && (gt != 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
changePartitionBool(null, null);
|
||||
changeLanguageBool(null, null);
|
||||
|
@ -266,207 +255,208 @@ namespace PKHeX
|
|||
{
|
||||
// starting at 0x15068;
|
||||
#region Payload
|
||||
uint[] payload = new uint[] {
|
||||
0x8FFFFFFF, // 20015068
|
||||
0xFFFFFFFF, // 2001506C
|
||||
0xFFFFFFFF, // 20015070
|
||||
0xF7FAFFFF, // 20015074
|
||||
0xFFFFFFFF, // 20015078
|
||||
0xFFFFFFFF, // 2001507C
|
||||
0xFFFFFFFF, // 20015080
|
||||
0xFFFCDFFF, // 20015084
|
||||
0xFFFFFFFF, // 20015088
|
||||
0xFDFFFFFF, // 2001508C
|
||||
0xFFFFFFFF, // 20015090
|
||||
0xF7FFFFFF, // 20015094
|
||||
0x6FFFFFFF, // 20015098
|
||||
0xFF7FFFFF, // 2001509C
|
||||
0xDFFFFFFF, // 200150A0
|
||||
0xFFFFFF7F, // 200150A4
|
||||
0xFFFFFFFF, // 200150A8
|
||||
0xFFFFFFE7, // 200150AC
|
||||
0xFFFFFFFF, // 200150B0
|
||||
0xFFCFFFFF, // 200150B4
|
||||
0x8FFFFFFF, // 200150B8
|
||||
0xFFFFFFFF, // 200150BC
|
||||
0x0001FFFF, // 200150C0
|
||||
0x00000000, //
|
||||
uint[] payload =
|
||||
{
|
||||
0x8FFFFFFF, // 20015068
|
||||
0xFFFFFFFF, // 2001506C
|
||||
0xFFFFFFFF, // 20015070
|
||||
0xF7FAFFFF, // 20015074
|
||||
0xFFFFFFFF, // 20015078
|
||||
0xFFFFFFFF, // 2001507C
|
||||
0xFFFFFFFF, // 20015080
|
||||
0xFFFCDFFF, // 20015084
|
||||
0xFFFFFFFF, // 20015088
|
||||
0xFDFFFFFF, // 2001508C
|
||||
0xFFFFFFFF, // 20015090
|
||||
0xF7FFFFFF, // 20015094
|
||||
0x6FFFFFFF, // 20015098
|
||||
0xFF7FFFFF, // 2001509C
|
||||
0xDFFFFFFF, // 200150A0
|
||||
0xFFFFFF7F, // 200150A4
|
||||
0xFFFFFFFF, // 200150A8
|
||||
0xFFFFFFE7, // 200150AC
|
||||
0xFFFFFFFF, // 200150B0
|
||||
0xFFCFFFFF, // 200150B4
|
||||
0x8FFFFFFF, // 200150B8
|
||||
0xFFFFFFFF, // 200150BC
|
||||
0x0001FFFF, // 200150C0
|
||||
0x00000000, //
|
||||
|
||||
0x7FFFFFFF, // 200150C8
|
||||
0xFFFFFFFC, // 200150CC
|
||||
0xFFFCFFFF, // 200150D0
|
||||
0x7E7FF9E7, // 200150D4
|
||||
0xFF9C7EF7, // 200150D8
|
||||
0xFFFFFFFF, // 200150DC
|
||||
0xFFFFFEFF, // 200150E0
|
||||
0xF8E3E6FF, // 200150E4
|
||||
0xFFFFFFFF, // 200150E8
|
||||
0xFEFFFFF7, // 200150EC
|
||||
0xFF3CFFFF, // 200150F0
|
||||
0x081FFFFF, // 200150F4
|
||||
0xDFFFFFFC, // 200150F8
|
||||
0xFFE7FFFF, // 200150FC
|
||||
0x39FFDFFF, // 20015100
|
||||
0xFFFFC090, // 20015104
|
||||
0xF9FFFFFF, // 20015108
|
||||
0xFFFFFFFF, // 2001510C
|
||||
0xFE3FFFFF, // 20015110
|
||||
0x1FF39FBF, // 20015114
|
||||
0xFFFFFE00, // 20015118
|
||||
0xBFFFFFFF, // 2001511C
|
||||
0x000007FF, // 10015120
|
||||
0x00000000, //
|
||||
0x7FFFFFFF, // 200150C8
|
||||
0xFFFFFFFC, // 200150CC
|
||||
0xFFFCFFFF, // 200150D0
|
||||
0x7E7FF9E7, // 200150D4
|
||||
0xFF9C7EF7, // 200150D8
|
||||
0xFFFFFFFF, // 200150DC
|
||||
0xFFFFFEFF, // 200150E0
|
||||
0xF8E3E6FF, // 200150E4
|
||||
0xFFFFFFFF, // 200150E8
|
||||
0xFEFFFFF7, // 200150EC
|
||||
0xFF3CFFFF, // 200150F0
|
||||
0x081FFFFF, // 200150F4
|
||||
0xDFFFFFFC, // 200150F8
|
||||
0xFFE7FFFF, // 200150FC
|
||||
0x39FFDFFF, // 20015100
|
||||
0xFFFFC090, // 20015104
|
||||
0xF9FFFFFF, // 20015108
|
||||
0xFFFFFFFF, // 2001510C
|
||||
0xFE3FFFFF, // 20015110
|
||||
0x1FF39FBF, // 20015114
|
||||
0xFFFFFE00, // 20015118
|
||||
0xBFFFFFFF, // 2001511C
|
||||
0x000007FF, // 10015120
|
||||
0x00000000, //
|
||||
|
||||
0x8FFFFFFF, // 20015128
|
||||
0xFFFFFFFF, // 2001512C
|
||||
0xFFFFFFFF, // 20015130
|
||||
0xF7FAFFFF, // 20015134
|
||||
0xFFFFFFFF, // 20015138
|
||||
0xFFFFFFFF, // 2001513C
|
||||
0xFFFFFFFF, // 20015140
|
||||
0xFFFCDFFF, // 20015144
|
||||
0xFFFFFFFF, // 20015148
|
||||
0xFDFFFFFF, // 2001514C
|
||||
0xFFFFFFFF, // 20015150
|
||||
0xF7FFFFFF, // 20015154
|
||||
0x6FFFFFFF, // 20015158
|
||||
0xFF7FFFFF, // 2001515C
|
||||
0xDFFFFFFF, // 20015160
|
||||
0xFFFFFF7F, // 20015164
|
||||
0xFFFFFFFF, // 20015168
|
||||
0xFFFFFFE7, // 2001516C
|
||||
0xFFFFFFFF, // 20015170
|
||||
0xFFCFFFFF, // 20015174
|
||||
0x8FFFFFFF, // 20015178
|
||||
0xFFFFFFFF, // 2001517C
|
||||
0x0001FFFF, // 20015180
|
||||
0x00000000, //
|
||||
0x8FFFFFFF, // 20015128
|
||||
0xFFFFFFFF, // 2001512C
|
||||
0xFFFFFFFF, // 20015130
|
||||
0xF7FAFFFF, // 20015134
|
||||
0xFFFFFFFF, // 20015138
|
||||
0xFFFFFFFF, // 2001513C
|
||||
0xFFFFFFFF, // 20015140
|
||||
0xFFFCDFFF, // 20015144
|
||||
0xFFFFFFFF, // 20015148
|
||||
0xFDFFFFFF, // 2001514C
|
||||
0xFFFFFFFF, // 20015150
|
||||
0xF7FFFFFF, // 20015154
|
||||
0x6FFFFFFF, // 20015158
|
||||
0xFF7FFFFF, // 2001515C
|
||||
0xDFFFFFFF, // 20015160
|
||||
0xFFFFFF7F, // 20015164
|
||||
0xFFFFFFFF, // 20015168
|
||||
0xFFFFFFE7, // 2001516C
|
||||
0xFFFFFFFF, // 20015170
|
||||
0xFFCFFFFF, // 20015174
|
||||
0x8FFFFFFF, // 20015178
|
||||
0xFFFFFFFF, // 2001517C
|
||||
0x0001FFFF, // 20015180
|
||||
0x00000000, //
|
||||
|
||||
0x7FFFFFFF, // 20015188
|
||||
0xFFFFFFFC, // 2001518C
|
||||
0xFFFCFFFF, // 20015190
|
||||
0x7E7FF9E7, // 20015194
|
||||
0xFF9C7EF7, // 20015198
|
||||
0xFFFFFFFF, // 2001519C
|
||||
0xFFFFFEFF, // 200151A0
|
||||
0xF8E3E6FF, // 200151A4
|
||||
0xFFFFFFFF, // 200151A8
|
||||
0xFEFFFFF7, // 200151AC
|
||||
0xFF3CFFFF, // 200151B0
|
||||
0x081FFFFF, // 200151B4
|
||||
0xDFFFFFFC, // 200151B8
|
||||
0xFFE7FFFF, // 200151BC
|
||||
0x39FFDFFF, // 200151C0
|
||||
0xFFFFC090, // 200151C4
|
||||
0xF9FFFFFF, // 200151C8
|
||||
0xFFFFFFFF, // 200151CC
|
||||
0xFE3FFFFF, // 200151D0
|
||||
0x1FF39FBF, // 200151D4
|
||||
0xFFFFFE00, // 200151D8
|
||||
0xBFFFFFFF, // 200151DC
|
||||
0x000007FF, // 100151E0
|
||||
0x00000000, //
|
||||
0x7FFFFFFF, // 20015188
|
||||
0xFFFFFFFC, // 2001518C
|
||||
0xFFFCFFFF, // 20015190
|
||||
0x7E7FF9E7, // 20015194
|
||||
0xFF9C7EF7, // 20015198
|
||||
0xFFFFFFFF, // 2001519C
|
||||
0xFFFFFEFF, // 200151A0
|
||||
0xF8E3E6FF, // 200151A4
|
||||
0xFFFFFFFF, // 200151A8
|
||||
0xFEFFFFF7, // 200151AC
|
||||
0xFF3CFFFF, // 200151B0
|
||||
0x081FFFFF, // 200151B4
|
||||
0xDFFFFFFC, // 200151B8
|
||||
0xFFE7FFFF, // 200151BC
|
||||
0x39FFDFFF, // 200151C0
|
||||
0xFFFFC090, // 200151C4
|
||||
0xF9FFFFFF, // 200151C8
|
||||
0xFFFFFFFF, // 200151CC
|
||||
0xFE3FFFFF, // 200151D0
|
||||
0x1FF39FBF, // 200151D4
|
||||
0xFFFFFE00, // 200151D8
|
||||
0xBFFFFFFF, // 200151DC
|
||||
0x000007FF, // 100151E0
|
||||
0x00000000, //
|
||||
|
||||
0x8FFFFFFF, // 200151E8
|
||||
0xFFFFFFFF, // 200151EC
|
||||
0xFFFFFFFF, // 200151F0
|
||||
0xF7FAFFFF, // 200151F4
|
||||
0xFFFFFFFF, // 200151F8
|
||||
0xFFFFFFFF, // 200151FC
|
||||
0xFFFFFFFF, // 20015200
|
||||
0xFFFCDFFF, // 20015204
|
||||
0xFFFFFFFF, // 20015208
|
||||
0xFDFFFFFF, // 2001520C
|
||||
0xFFFFFFFF, // 20015210
|
||||
0xF7FFFFFF, // 20015214
|
||||
0x6FFFFFFF, // 20015218
|
||||
0xFF7FFFFF, // 2001521C
|
||||
0xDFFFFFFF, // 20015220
|
||||
0xFFFFFF7F, // 20015224
|
||||
0xFFFFFFFF, // 20015228
|
||||
0xFFFFFFE7, // 2001522C
|
||||
0xFFFFFFFF, // 20015230
|
||||
0xFFCFFFFF, // 20015234
|
||||
0x8FFFFFFF, // 20015238
|
||||
0xFFFFFFFF, // 2001523C
|
||||
0x0001FFFF, // 20015240
|
||||
0x00000000, //
|
||||
0x8FFFFFFF, // 200151E8
|
||||
0xFFFFFFFF, // 200151EC
|
||||
0xFFFFFFFF, // 200151F0
|
||||
0xF7FAFFFF, // 200151F4
|
||||
0xFFFFFFFF, // 200151F8
|
||||
0xFFFFFFFF, // 200151FC
|
||||
0xFFFFFFFF, // 20015200
|
||||
0xFFFCDFFF, // 20015204
|
||||
0xFFFFFFFF, // 20015208
|
||||
0xFDFFFFFF, // 2001520C
|
||||
0xFFFFFFFF, // 20015210
|
||||
0xF7FFFFFF, // 20015214
|
||||
0x6FFFFFFF, // 20015218
|
||||
0xFF7FFFFF, // 2001521C
|
||||
0xDFFFFFFF, // 20015220
|
||||
0xFFFFFF7F, // 20015224
|
||||
0xFFFFFFFF, // 20015228
|
||||
0xFFFFFFE7, // 2001522C
|
||||
0xFFFFFFFF, // 20015230
|
||||
0xFFCFFFFF, // 20015234
|
||||
0x8FFFFFFF, // 20015238
|
||||
0xFFFFFFFF, // 2001523C
|
||||
0x0001FFFF, // 20015240
|
||||
0x00000000, //
|
||||
|
||||
0x7FFFFFFF, // 20015248
|
||||
0xFFFFFFFC, // 2001524C
|
||||
0xFFFCFFFF, // 20015250
|
||||
0x7E7FF9E7, // 20015254
|
||||
0xFF9C7EF7, // 20015258
|
||||
0xFFFFFFFF, // 2001525C
|
||||
0xFFFFFEFF, // 20015260
|
||||
0xF8E3E6FF, // 20015264
|
||||
0xFFFFFFFF, // 20015268
|
||||
0xFEFFFFF7, // 2001526C
|
||||
0xFF3CFFFF, // 20015270
|
||||
0x081FFFFF, // 20015274
|
||||
0xDFFFFFFC, // 20015278
|
||||
0xFFE7FFFF, // 2001527C
|
||||
0x39FFDFFF, // 20015280
|
||||
0xFFFFC090, // 20015284
|
||||
0xF9FFFFFF, // 20015288
|
||||
0xFFFFFFFF, // 2001528C
|
||||
0xFE3FFFFF, // 20015290
|
||||
0x1FF39FBF, // 20015294
|
||||
0xFFFFFE00, // 20015298
|
||||
0xBFFFFFFF, // 2001529C
|
||||
0x000007FF, // 100152A0
|
||||
0x00000000, //
|
||||
0x7FFFFFFF, // 20015248
|
||||
0xFFFFFFFC, // 2001524C
|
||||
0xFFFCFFFF, // 20015250
|
||||
0x7E7FF9E7, // 20015254
|
||||
0xFF9C7EF7, // 20015258
|
||||
0xFFFFFFFF, // 2001525C
|
||||
0xFFFFFEFF, // 20015260
|
||||
0xF8E3E6FF, // 20015264
|
||||
0xFFFFFFFF, // 20015268
|
||||
0xFEFFFFF7, // 2001526C
|
||||
0xFF3CFFFF, // 20015270
|
||||
0x081FFFFF, // 20015274
|
||||
0xDFFFFFFC, // 20015278
|
||||
0xFFE7FFFF, // 2001527C
|
||||
0x39FFDFFF, // 20015280
|
||||
0xFFFFC090, // 20015284
|
||||
0xF9FFFFFF, // 20015288
|
||||
0xFFFFFFFF, // 2001528C
|
||||
0xFE3FFFFF, // 20015290
|
||||
0x1FF39FBF, // 20015294
|
||||
0xFFFFFE00, // 20015298
|
||||
0xBFFFFFFF, // 2001529C
|
||||
0x000007FF, // 100152A0
|
||||
0x00000000, //
|
||||
|
||||
0x8FFFFFFF, // 200152A8
|
||||
0xFFFFFFFF, // 200152AC
|
||||
0xFFFFFFFF, // 200152B0
|
||||
0xF7FAFFFF, // 200152B4
|
||||
0xFFFFFFFF, // 200152B8
|
||||
0xFFFFFFFF, // 200152BC
|
||||
0xFFFFFFFF, // 200152C0
|
||||
0xFFFCDFFF, // 200152C4
|
||||
0xFFFFFFFF, // 200152C8
|
||||
0xFDFFFFFF, // 200152CC
|
||||
0xFFFFFFFF, // 200152D0
|
||||
0xF7FFFFFF, // 200152D4
|
||||
0x6FFFFFFF, // 200152D8
|
||||
0xFF7FFFFF, // 200152DC
|
||||
0xDFFFFFFF, // 200152E0
|
||||
0xFFFFFF7F, // 200152E4
|
||||
0xFFFFFFFF, // 200152E8
|
||||
0xFFFFFFE7, // 200152EC
|
||||
0xFFFFFFFF, // 200152F0
|
||||
0xFFCFFFFF, // 200152F4
|
||||
0x8FFFFFFF, // 200152F8
|
||||
0xFFFFFFFF, // 200152FC
|
||||
0x0001FFFF, // 20015300
|
||||
0x00000000, //
|
||||
0x8FFFFFFF, // 200152A8
|
||||
0xFFFFFFFF, // 200152AC
|
||||
0xFFFFFFFF, // 200152B0
|
||||
0xF7FAFFFF, // 200152B4
|
||||
0xFFFFFFFF, // 200152B8
|
||||
0xFFFFFFFF, // 200152BC
|
||||
0xFFFFFFFF, // 200152C0
|
||||
0xFFFCDFFF, // 200152C4
|
||||
0xFFFFFFFF, // 200152C8
|
||||
0xFDFFFFFF, // 200152CC
|
||||
0xFFFFFFFF, // 200152D0
|
||||
0xF7FFFFFF, // 200152D4
|
||||
0x6FFFFFFF, // 200152D8
|
||||
0xFF7FFFFF, // 200152DC
|
||||
0xDFFFFFFF, // 200152E0
|
||||
0xFFFFFF7F, // 200152E4
|
||||
0xFFFFFFFF, // 200152E8
|
||||
0xFFFFFFE7, // 200152EC
|
||||
0xFFFFFFFF, // 200152F0
|
||||
0xFFCFFFFF, // 200152F4
|
||||
0x8FFFFFFF, // 200152F8
|
||||
0xFFFFFFFF, // 200152FC
|
||||
0x0001FFFF, // 20015300
|
||||
0x00000000, //
|
||||
|
||||
0x7FFFFFFF, // 20015308
|
||||
0xFFFFFFFC, // 2001530C
|
||||
0xFFFCFFFF, // 20015310
|
||||
0x7E7FF9E7, // 20015314
|
||||
0xFF9C7EF7, // 20015318
|
||||
0xFFFFFFFF, // 2001531C
|
||||
0xFFFFFEFF, // 20015320
|
||||
0xF8E3E6FF, // 20015324
|
||||
0xFFFFFFFF, // 20015328
|
||||
0xFEFFFFF7, // 2001532C
|
||||
0xFF3CFFFF, // 20015330
|
||||
0x081FFFFF, // 20015334
|
||||
0xDFFFFFFC, // 20015338
|
||||
0xFFE7FFFF, // 2001533C
|
||||
0x39FFDFFF, // 20015340
|
||||
0xFFFFC090, // 20015344
|
||||
0xF9FFFFFF, // 20015348
|
||||
0xFFFFFFFF, // 2001534C
|
||||
0xFE3FFFFF, // 20015350
|
||||
0x1FF39FBF, // 20015354
|
||||
0xFFFFFE00, // 20015358
|
||||
0xBFFFFFFF, // 2001535C
|
||||
0x000007FF, // 10015360
|
||||
0x00000000, //
|
||||
};
|
||||
0x7FFFFFFF, // 20015308
|
||||
0xFFFFFFFC, // 2001530C
|
||||
0xFFFCFFFF, // 20015310
|
||||
0x7E7FF9E7, // 20015314
|
||||
0xFF9C7EF7, // 20015318
|
||||
0xFFFFFFFF, // 2001531C
|
||||
0xFFFFFEFF, // 20015320
|
||||
0xF8E3E6FF, // 20015324
|
||||
0xFFFFFFFF, // 20015328
|
||||
0xFEFFFFF7, // 2001532C
|
||||
0xFF3CFFFF, // 20015330
|
||||
0x081FFFFF, // 20015334
|
||||
0xDFFFFFFC, // 20015338
|
||||
0xFFE7FFFF, // 2001533C
|
||||
0x39FFDFFF, // 20015340
|
||||
0xFFFFC090, // 20015344
|
||||
0xF9FFFFFF, // 20015348
|
||||
0xFFFFFFFF, // 2001534C
|
||||
0xFE3FFFFF, // 20015350
|
||||
0x1FF39FBF, // 20015354
|
||||
0xFFFFFE00, // 20015358
|
||||
0xBFFFFFFF, // 2001535C
|
||||
0x000007FF, // 10015360
|
||||
0x00000000, //
|
||||
};
|
||||
#endregion
|
||||
for (int i = 0; i < payload.Length; i++)
|
||||
Array.Copy(BitConverter.GetBytes(payload[i]), 0, sav, sv + 0x5400 + 0x15068 + 4 * i, 4);
|
||||
|
|
|
@ -1,11 +1,5 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
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
|
||||
|
@ -26,7 +20,7 @@ namespace PKHeX
|
|||
}
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public int savshift = 0;
|
||||
public int savshift;
|
||||
public bool[,] specbools = new bool[10, 0x60 * 8];
|
||||
public bool[,] langbools = new bool[7, 0x60 * 8];
|
||||
public bool[] foreignbools = new bool[0x52 * 8];
|
||||
|
@ -34,12 +28,8 @@ namespace PKHeX
|
|||
private void Setup()
|
||||
{
|
||||
// Clear Listbox and ComboBox
|
||||
try
|
||||
{
|
||||
LB_Species.Items.Clear();
|
||||
CB_Species.Items.Clear();
|
||||
}
|
||||
catch { }
|
||||
LB_Species.Items.Clear();
|
||||
CB_Species.Items.Clear();
|
||||
|
||||
// Fill List
|
||||
#region Species
|
||||
|
@ -93,7 +83,7 @@ namespace PKHeX
|
|||
editing = true;
|
||||
int index = (int)CB_Species.SelectedValue;
|
||||
LB_Species.SelectedIndex = index - 1; // Since we don't allow index0 in combobox, everything is shifted by 1
|
||||
LB_Species.TopIndex = (int)(LB_Species.SelectedIndex);
|
||||
LB_Species.TopIndex = LB_Species.SelectedIndex;
|
||||
loadchks();
|
||||
editing = false;
|
||||
}
|
||||
|
@ -116,17 +106,19 @@ namespace PKHeX
|
|||
private void loadchks()
|
||||
{
|
||||
// Load Bools for the data
|
||||
int pk = 0;
|
||||
int pk;
|
||||
try
|
||||
{
|
||||
pk = Util.getIndex(CB_Species);
|
||||
}
|
||||
catch { pk = (int)LB_Species.SelectedIndex + 1; }
|
||||
catch { pk = LB_Species.SelectedIndex + 1; }
|
||||
|
||||
CheckBox[] CP = new CheckBox[] {
|
||||
CheckBox[] CP =
|
||||
{
|
||||
CHK_P1,CHK_P2,CHK_P3,CHK_P4,CHK_P5,CHK_P6,CHK_P7,CHK_P8,CHK_P9,CHK_P10,
|
||||
};
|
||||
CheckBox[] CL = new CheckBox[] {
|
||||
CheckBox[] CL =
|
||||
{
|
||||
CHK_L1,CHK_L2,CHK_L3,CHK_L4,CHK_L5,CHK_L6,CHK_L7,
|
||||
};
|
||||
// Load Partitions
|
||||
|
@ -201,7 +193,7 @@ namespace PKHeX
|
|||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -209,7 +201,7 @@ namespace PKHeX
|
|||
|
||||
// Return back to the parent savefile
|
||||
Array.Copy(sav, m_parent.savefile, sav.Length);
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void saveChanges()
|
||||
{
|
||||
|
@ -272,23 +264,23 @@ namespace PKHeX
|
|||
CHK_L4.Checked =
|
||||
CHK_L5.Checked =
|
||||
CHK_L6.Checked =
|
||||
CHK_L7.Checked = !(ModifierKeys == Keys.Control);
|
||||
CHK_L7.Checked = ModifierKeys != Keys.Control;
|
||||
}
|
||||
if (CHK_P1.Enabled)
|
||||
{
|
||||
CHK_P1.Checked =
|
||||
CHK_P10.Checked = !(ModifierKeys == Keys.Control);
|
||||
CHK_P10.Checked = ModifierKeys != Keys.Control;
|
||||
}
|
||||
if (CHK_F1.Enabled)
|
||||
{
|
||||
CHK_F1.Checked = !(ModifierKeys == Keys.Control);
|
||||
CHK_F1.Checked = ModifierKeys != Keys.Control;
|
||||
}
|
||||
int index = LB_Species.SelectedIndex+1;
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(index);
|
||||
int gt = MonData.GenderRatio;
|
||||
|
||||
CHK_P2.Checked = CHK_P4.Checked = CHK_P6.Checked = CHK_P8.Checked = ((gt != 254)) && !(ModifierKeys == Keys.Control);
|
||||
CHK_P3.Checked = CHK_P5.Checked = CHK_P7.Checked = CHK_P9.Checked = (gt != 0) && (gt != 255) && !(ModifierKeys == Keys.Control);
|
||||
CHK_P2.Checked = CHK_P4.Checked = CHK_P6.Checked = CHK_P8.Checked = ((gt != 254)) && ModifierKeys != Keys.Control;
|
||||
CHK_P3.Checked = CHK_P5.Checked = CHK_P7.Checked = CHK_P9.Checked = (gt != 0) && (gt != 255) && ModifierKeys != Keys.Control;
|
||||
|
||||
changePartitionBool(null, null);
|
||||
changeLanguageBool(null, null);
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
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
|
||||
|
@ -22,8 +16,8 @@ namespace PKHeX
|
|||
pfa[0] = "---";
|
||||
Setup();
|
||||
|
||||
new ToolTip().SetToolTip(this.B_Sort, "Hold CTRL to reverse sort.");
|
||||
new ToolTip().SetToolTip(this.B_All, "Hold CTRL to give Deluxe instead of Supreme.");
|
||||
new ToolTip().SetToolTip(B_Sort, "Hold CTRL to reverse sort.");
|
||||
new ToolTip().SetToolTip(B_All, "Hold CTRL to give Deluxe instead of Supreme.");
|
||||
}
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
|
@ -51,13 +45,14 @@ namespace PKHeX
|
|||
dgvIndex.ReadOnly = true;
|
||||
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
DataGridViewComboBoxColumn dgvPuff = new DataGridViewComboBoxColumn();
|
||||
dgvPuff.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
|
||||
DataGridViewComboBoxColumn dgvPuff = new DataGridViewComboBoxColumn
|
||||
{
|
||||
for (int i = 0; i < pfa.Length; i++)
|
||||
{
|
||||
dgvPuff.Items.Add(pfa[i]);
|
||||
}
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
|
||||
};
|
||||
{
|
||||
foreach (string t in pfa)
|
||||
dgvPuff.Items.Add(t);
|
||||
|
||||
dgvPuff.DisplayIndex = 1;
|
||||
dgvPuff.Width = 135;
|
||||
dgvPuff.FlatStyle = FlatStyle.Flat;
|
||||
|
@ -133,11 +128,9 @@ namespace PKHeX
|
|||
{
|
||||
string puff = dataGridView1.Rows[i].Cells[1].Value.ToString();
|
||||
byte puffval = (byte)Array.IndexOf(pfa, puff);
|
||||
if (puffval != 0)
|
||||
{
|
||||
puffarray[count] = puffval;
|
||||
count++;
|
||||
}
|
||||
if (puffval == 0) continue;
|
||||
puffarray[count] = puffval;
|
||||
count++;
|
||||
}
|
||||
Array.Resize(ref puffarray, count);
|
||||
Array.Sort(puffarray);
|
||||
|
|
|
@ -1,12 +1,6 @@
|
|||
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;
|
||||
using System.IO;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -18,13 +12,7 @@ namespace PKHeX
|
|||
Util.TranslateInterface(this, Form1.curlanguage);
|
||||
m_parent = frm1;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
savindex = m_parent.savindex;
|
||||
|
||||
specieslist = Form1.specieslist;
|
||||
movelist = Form1.movelist;
|
||||
itemlist = Form1.itemlist;
|
||||
abilitylist = Form1.abilitylist;
|
||||
natures = Form1.natures;
|
||||
|
||||
setupComboBoxes();
|
||||
popFavorite();
|
||||
|
@ -38,16 +26,12 @@ namespace PKHeX
|
|||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public byte[] wondercard_data = new byte[0x108];
|
||||
public bool editing = false;
|
||||
public int savindex; int sv = 0;
|
||||
private int fav_offset = 0x23A00;
|
||||
public bool editing;
|
||||
private const int sv = 0;
|
||||
private const int fav_offset = 0x23A00;
|
||||
private bool loading = true;
|
||||
|
||||
public static string[] specieslist = { };
|
||||
public static string[] movelist = { };
|
||||
public static string[] itemlist = { };
|
||||
public static string[] abilitylist = { };
|
||||
public static string[] natures = { };
|
||||
|
||||
private void setupComboBoxes()
|
||||
{
|
||||
|
@ -89,8 +73,8 @@ namespace PKHeX
|
|||
{
|
||||
LB_Favorite.Items.Clear();
|
||||
|
||||
int playeroff = fav_offset + 0x5400 + 0x326;
|
||||
int favoff = fav_offset + 0x5400 + 0x63A;
|
||||
const int playeroff = fav_offset + 0x5400 + 0x326;
|
||||
const int favoff = fav_offset + 0x5400 + 0x63A;
|
||||
string OT = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + playeroff + 0x218, 0x1A));
|
||||
LB_Favorite.Items.Add("* " + OT);
|
||||
for (int i = 0; i < 30; i++)
|
||||
|
@ -233,13 +217,13 @@ namespace PKHeX
|
|||
}
|
||||
private void B_GiveDecor_Click(object sender, EventArgs e)
|
||||
{
|
||||
int offset = sv + 0x23A00 + 0x5400;
|
||||
const int offset = sv + 0x23A00 + 0x5400;
|
||||
for (int i = 0; i < 173; i++)
|
||||
{
|
||||
// int qty = BitConverter.ToUInt16(sav, offset + i * 4);
|
||||
// int has = BitConverter.ToUInt16(sav, offset + i * 4 + 2);
|
||||
|
||||
sav[offset + i * 4] = (byte)25;
|
||||
sav[offset + i * 4] = 25;
|
||||
sav[offset + i * 4 + 2] = 1;
|
||||
}
|
||||
}
|
||||
|
@ -256,8 +240,8 @@ namespace PKHeX
|
|||
byte x = objinfo[2];
|
||||
byte y = objinfo[4];
|
||||
byte rot = objinfo[6];
|
||||
byte unk1 = objinfo[7];
|
||||
ushort unk2 = BitConverter.ToUInt16(objinfo, 0x8);
|
||||
// byte unk1 = objinfo[7];
|
||||
// ushort unk2 = BitConverter.ToUInt16(objinfo, 0x8);
|
||||
|
||||
// Set values to display
|
||||
editing = true;
|
||||
|
@ -353,10 +337,10 @@ namespace PKHeX
|
|||
fpkm[i] = pkmdata[index, i];
|
||||
|
||||
uint ec = BitConverter.ToUInt32(fpkm, 0);
|
||||
uint unk = BitConverter.ToUInt32(fpkm, 4);
|
||||
// uint unk = BitConverter.ToUInt32(fpkm, 4);
|
||||
int spec = BitConverter.ToInt16(fpkm, 8);
|
||||
int item = BitConverter.ToInt16(fpkm, 0xA);
|
||||
int abil = fpkm[0xC];
|
||||
// int abil = fpkm[0xC];
|
||||
int abil_no = fpkm[0xD];
|
||||
MT_AbilNo.Text = abil_no.ToString();
|
||||
// 6 unknown bytes, contest?
|
||||
|
@ -444,15 +428,12 @@ namespace PKHeX
|
|||
|
||||
private void updateSpecies(object sender, EventArgs e)
|
||||
{
|
||||
int species = Util.getIndex(CB_Species);
|
||||
|
||||
// Get Forms for Given Species
|
||||
m_parent.setForms(species, CB_Form);
|
||||
m_parent.setForms(Util.getIndex(CB_Species), CB_Form);
|
||||
|
||||
// Check for Gender Changes
|
||||
// Get Gender Threshold
|
||||
species = Util.getIndex(CB_Species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(Util.getIndex(CB_Species));
|
||||
int gt = MonData.GenderRatio;
|
||||
|
||||
if (gt == 255) // Genderless
|
||||
|
@ -474,12 +455,11 @@ namespace PKHeX
|
|||
Label_Gender.Text = Form1.gendersymbols[CB_Form.SelectedIndex];
|
||||
}
|
||||
|
||||
private int species; private int genderflag;
|
||||
private int genderflag;
|
||||
private void Label_Gender_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Get Gender Threshold
|
||||
species = Util.getIndex(CB_Species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(Util.getIndex(CB_Species));
|
||||
int gt = MonData.GenderRatio;
|
||||
|
||||
if (gt == 255 || gt == 0 || gt == 254) // Single gender/genderless
|
||||
|
@ -497,23 +477,23 @@ namespace PKHeX
|
|||
{
|
||||
if (LB_Favorite.SelectedIndex < 1) { Util.Alert("Cannot delete your Secret Base."); return; }
|
||||
int index = LB_Favorite.SelectedIndex - 1;
|
||||
|
||||
int playeroff = fav_offset + 0x5400 + 0x326;
|
||||
int favoff = fav_offset + 0x5400 + 0x63A;
|
||||
string OT = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + playeroff + 0x218, 0x1A));
|
||||
|
||||
const int favoff = fav_offset + 0x5400 + 0x63A;
|
||||
string BaseTrainer = Util.TrimFromZero(Encoding.Unicode.GetString(sav, sv + favoff + index * 0x3E0 + 0x218, 0x1A));
|
||||
if (BaseTrainer.Length < 1 || BaseTrainer[0] == '\0')
|
||||
BaseTrainer = "Empty";
|
||||
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, String.Format("Delete {1}'s base (Entry {0}) from your records?", index, BaseTrainer)) == DialogResult.Yes)
|
||||
{
|
||||
int max = 29; int size = 0x3E0;
|
||||
int offset = sv + favoff + index * size;
|
||||
if (index != max) Array.Copy(sav, offset + size, sav, offset, size * (max - index));
|
||||
// Ensure Last Entry is Cleared
|
||||
Array.Copy(new byte[size], 0, sav, size * max, size);
|
||||
popFavorite();
|
||||
}
|
||||
if (
|
||||
Util.Prompt(MessageBoxButtons.YesNo,
|
||||
String.Format("Delete {1}'s base (Entry {0}) from your records?", index, BaseTrainer)) != DialogResult.Yes)
|
||||
return;
|
||||
const int max = 29;
|
||||
const int size = 0x3E0;
|
||||
int offset = sv + favoff + index * size;
|
||||
if (index != max) Array.Copy(sav, offset + size, sav, offset, size * (max - index));
|
||||
// Ensure Last Entry is Cleared
|
||||
Array.Copy(new byte[size], 0, sav, size * max, size);
|
||||
popFavorite();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,4 @@
|
|||
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
|
||||
|
@ -15,7 +9,6 @@ namespace PKHeX
|
|||
{
|
||||
m_parent = frm1;
|
||||
savindex = m_parent.savindex;
|
||||
specieslist = Form1.specieslist;
|
||||
Array.Copy(m_parent.savefile, sav, 0x100000);
|
||||
if (m_parent.savegame_oras) data_offset = 0x25600;
|
||||
trba = Form1.trainingbags;
|
||||
|
@ -34,7 +27,6 @@ namespace PKHeX
|
|||
}
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public string[] specieslist;
|
||||
public int savindex;
|
||||
private int data_offset = 0x24600;
|
||||
private string[] trba = {
|
||||
|
@ -49,9 +41,9 @@ namespace PKHeX
|
|||
"Big-Shot Bag","Double-Up Bag","Team Flare Bag",
|
||||
"Reset Bag","Soothing Bag",
|
||||
};
|
||||
private int offsetVal = 0;
|
||||
private int offsetTime = 0;
|
||||
private int offsetSpec = 0;
|
||||
private int offsetVal;
|
||||
private int offsetTime;
|
||||
private int offsetSpec;
|
||||
private void setup()
|
||||
{
|
||||
dataGridView1.Rows.Clear();
|
||||
|
@ -82,12 +74,14 @@ namespace PKHeX
|
|||
dgvIndex.ReadOnly = true;
|
||||
dgvIndex.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
|
||||
}
|
||||
DataGridViewComboBoxColumn dgvBag = new DataGridViewComboBoxColumn();
|
||||
dgvBag.DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing;
|
||||
DataGridViewComboBoxColumn dgvBag = new DataGridViewComboBoxColumn
|
||||
{
|
||||
for (int i = 0; i < trba.Length; i++)
|
||||
if (trba[i].Length > 0)
|
||||
dgvBag.Items.Add(trba[i]);
|
||||
DisplayStyle = DataGridViewComboBoxDisplayStyle.Nothing
|
||||
};
|
||||
{
|
||||
foreach (string t in trba)
|
||||
if (t.Length > 0)
|
||||
dgvBag.Items.Add(t);
|
||||
|
||||
dgvBag.DisplayIndex = 1;
|
||||
dgvBag.Width = 135;
|
||||
|
@ -108,13 +102,11 @@ namespace PKHeX
|
|||
{
|
||||
try
|
||||
{
|
||||
if (e.ColumnIndex == 1)
|
||||
{
|
||||
ComboBox comboBox = (ComboBox)dataGridView1.EditingControl;
|
||||
comboBox.DroppedDown = true;
|
||||
}
|
||||
if (e.ColumnIndex != 1) return;
|
||||
ComboBox comboBox = (ComboBox)dataGridView1.EditingControl;
|
||||
comboBox.DroppedDown = true;
|
||||
}
|
||||
catch { return; }
|
||||
catch { }
|
||||
}
|
||||
private void changeListRecordSelection(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -167,7 +159,7 @@ namespace PKHeX
|
|||
}
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
Close();
|
||||
}
|
||||
private void changeRecordSpecies(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
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;
|
||||
using System.Drawing.Imaging;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class SAV_Trainer : Form
|
||||
{
|
||||
private int TrainerCard = 0x19400;
|
||||
private int Trainer1 = 0x6800;
|
||||
private int Trainer2 = 0x9600;
|
||||
private const int TrainerCard = 0x19400;
|
||||
private const int Trainer1 = 0x6800;
|
||||
private const int Trainer2 = 0x9600;
|
||||
private int Maison = 0x205C0;
|
||||
private int VivillonForm = 0x9650;
|
||||
public SAV_Trainer(Form1 frm1)
|
||||
|
@ -32,7 +28,7 @@ namespace PKHeX
|
|||
if (m_parent.savegame_oras)
|
||||
{
|
||||
psssatoffset = 0x24800; Maison += 0xA00; VivillonForm = 0x9644;
|
||||
this.Width = (int)((float)Width * (float)428 / (float)590);
|
||||
Width = (int)((float)Width * 428 / 590);
|
||||
CB_Multi.Enabled = true;
|
||||
L_MultiplayerSprite.Enabled = true; // Multiplayer Sprite Label
|
||||
|
||||
|
@ -46,7 +42,7 @@ namespace PKHeX
|
|||
getBadges();
|
||||
GB_Map.Enabled = !Form1.ramsavloaded;
|
||||
|
||||
statdata = new string[] {
|
||||
statdata = new[] {
|
||||
"0x000", "0x000", // Steps taken?
|
||||
"0x004", "0x004", // Minutes Played / Pokemon Encountered?
|
||||
"0x008", "0x008",
|
||||
|
@ -205,13 +201,13 @@ namespace PKHeX
|
|||
CB_Stats.Items.Add(statdata[2 * i + 1]);
|
||||
CB_Stats.SelectedIndex = 0;
|
||||
}
|
||||
private string[] statdata = new string[] { };
|
||||
private string[] statdata = { };
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
public int savshift;
|
||||
public int savindex;
|
||||
public bool editing = false;
|
||||
public byte badgeval = 0;
|
||||
public bool editing;
|
||||
public byte badgeval;
|
||||
public ToolTip Tip1 = new ToolTip();
|
||||
public ToolTip Tip2 = new ToolTip();
|
||||
|
||||
|
@ -348,7 +344,7 @@ namespace PKHeX
|
|||
};
|
||||
if (m_parent.savegame_oras)
|
||||
{
|
||||
bma = new Bitmap[] {
|
||||
bma = new[] {
|
||||
Properties.Resources.badge_01, // ORAS Badges
|
||||
Properties.Resources.badge_02,
|
||||
Properties.Resources.badge_03,
|
||||
|
@ -364,22 +360,19 @@ namespace PKHeX
|
|||
|
||||
for (int i = 0; i < 8; i++)
|
||||
{
|
||||
if (!cba[i].Checked)
|
||||
pba[i].Image = Util.ChangeOpacity(bma[i], 0.1);
|
||||
else
|
||||
pba[i].Image = Util.ChangeOpacity(bma[i], 1);
|
||||
pba[i].Image = Util.ChangeOpacity(bma[i], !cba[i].Checked ? 0.1 : 1);
|
||||
}
|
||||
}
|
||||
private void getTextBoxes()
|
||||
{
|
||||
byte badgeval = sav[Trainer2 + 0xC + savindex * 0x7F000];
|
||||
badgeval = sav[Trainer2 + 0xC + savindex * 0x7F000];
|
||||
CheckBox[] cba = { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8, };
|
||||
for (int i = 0; i < 8; i++)
|
||||
cba[i].Checked = !((badgeval & (1 << i)) == 0);
|
||||
cba[i].Checked = (badgeval & (1 << i)) != 0;
|
||||
|
||||
// Get Data
|
||||
string OT_NAME = Encoding.Unicode.GetString(sav, TrainerCard + 0x48 + savshift, 0x1A);
|
||||
string RIV_NAME = Encoding.Unicode.GetString(sav, Trainer2 + 0x10 + savshift, 0x1A);
|
||||
// string RIV_NAME = Encoding.Unicode.GetString(sav, Trainer2 + 0x10 + savshift, 0x1A);
|
||||
|
||||
CB_Game.SelectedIndex = sav[TrainerCard + 0x04 + savshift] - 0x18;
|
||||
CB_Gender.SelectedIndex = sav[TrainerCard + 0x05 + savshift];
|
||||
|
@ -557,7 +550,8 @@ namespace PKHeX
|
|||
|
||||
// New stuff.
|
||||
// Copy Maison Data in
|
||||
MaskedTextBox[] tba = new MaskedTextBox[] {
|
||||
MaskedTextBox[] tba =
|
||||
{
|
||||
TB_MCSN,TB_MCSS,TB_MBSN,TB_MBSS,
|
||||
TB_MCDN,TB_MCDS,TB_MBDN,TB_MBDS,
|
||||
TB_MCTN,TB_MCTS,TB_MBTN,TB_MBTS,
|
||||
|
@ -632,8 +626,8 @@ namespace PKHeX
|
|||
uint TID = Util.ToUInt32(MT_TID.Text);
|
||||
uint SID = Util.ToUInt32(MT_SID.Text);
|
||||
uint tsv = (TID ^ SID) >> 4;
|
||||
Tip1.SetToolTip(this.MT_TID, "TSV: " + tsv.ToString("0000"));
|
||||
Tip2.SetToolTip(this.MT_SID, "TSV: " + tsv.ToString("0000"));
|
||||
Tip1.SetToolTip(MT_TID, "TSV: " + tsv.ToString("0000"));
|
||||
Tip2.SetToolTip(MT_SID, "TSV: " + tsv.ToString("0000"));
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
|
@ -697,7 +691,8 @@ namespace PKHeX
|
|||
}
|
||||
private void giveAllAccessories(object sender, EventArgs e)
|
||||
{
|
||||
byte[] data = new byte[] {
|
||||
byte[] data =
|
||||
{
|
||||
0xFE,0xFF,0xFF,0x7E,0xFF,0xFD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
|
||||
0xFF,0xEF,0xFF,0xFF,0xFF,0xF9,0xFF,0xFB,0xFF,0xF7,0xFF,0xFF,0x0F,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFE,0xFF,
|
||||
|
@ -717,7 +712,7 @@ namespace PKHeX
|
|||
private void toggleBadge(object sender, EventArgs e)
|
||||
{
|
||||
int val = Convert.ToInt16(((PictureBox)sender).Name.Last().ToString()) - 1;
|
||||
CheckBox[] chka = new CheckBox[] { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8 };
|
||||
CheckBox[] chka = { cb1, cb2, cb3, cb4, cb5, cb6, cb7, cb8 };
|
||||
chka[val].Checked = !chka[val].Checked;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -28,8 +23,8 @@ namespace PKHeX
|
|||
if (LB_Received.Items.Count > 0)
|
||||
LB_Received.SelectedIndex = 0;
|
||||
|
||||
this.DragEnter += new DragEventHandler(tabMain_DragEnter);
|
||||
this.DragDrop += new DragEventHandler(tabMain_DragDrop);
|
||||
DragEnter += tabMain_DragEnter;
|
||||
DragDrop += tabMain_DragDrop;
|
||||
}
|
||||
Form1 m_parent;
|
||||
public byte[] sav = new byte[0x100000];
|
||||
|
@ -37,7 +32,7 @@ namespace PKHeX
|
|||
public int savindex;
|
||||
public bool editing = false;
|
||||
private int wcoffset = 0x21100;
|
||||
private uint herpesval = 0x225D73C2;
|
||||
private const uint herpesval = 0x225D73C2;
|
||||
|
||||
// Repopulation Functions
|
||||
private void populateWClist()
|
||||
|
@ -107,7 +102,6 @@ namespace PKHeX
|
|||
Util.Error("Loading of data failed... is this really a Wondercard?", e.ToString());
|
||||
Array.Copy(new byte[0x108], wondercard_data, 0x108);
|
||||
RTB.Clear();
|
||||
return;
|
||||
}
|
||||
}
|
||||
private void populateReceived()
|
||||
|
@ -122,8 +116,7 @@ namespace PKHeX
|
|||
// Wondercard IO (.wc6<->window)
|
||||
private void B_Import_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog importwc6 = new OpenFileDialog();
|
||||
importwc6.Filter = "Wondercard|*.wc6";
|
||||
OpenFileDialog importwc6 = new OpenFileDialog {Filter = "Wondercard|*.wc6"};
|
||||
if (importwc6.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = importwc6.FileName;
|
||||
|
@ -205,9 +198,9 @@ namespace PKHeX
|
|||
|
||||
// Make sure all of the Received Flags are flipped!
|
||||
byte[] wcflags = new byte[0x100];
|
||||
for (int i = 0; i < LB_Received.Items.Count; i++)
|
||||
foreach (object card in LB_Received.Items)
|
||||
{
|
||||
string cardID = LB_Received.Items[i].ToString();
|
||||
string cardID = card.ToString();
|
||||
uint cardnum = Util.ToUInt32(cardID);
|
||||
|
||||
wcflags[(cardnum / 8) & 0xFF] |= (byte)(1 << ((byte)(cardnum & 0x7)));
|
||||
|
|
|
@ -2,14 +2,10 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Security.Cryptography;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
|
@ -26,7 +22,6 @@ namespace PKHeX
|
|||
SaveData = new byte[InputData.Length];
|
||||
Array.Copy(InputData, SaveData, InputData.Length);
|
||||
PokemonList PL = new PokemonList();
|
||||
PKX.Structures.SaveGame SaveGame = new PKX.Structures.SaveGame("XY");
|
||||
if (savindex > 1) savindex = 0;
|
||||
BoxBar.Maximum = 930 + 100;
|
||||
BoxBar.Step = 1;
|
||||
|
@ -62,9 +57,11 @@ namespace PKHeX
|
|||
{
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo,"Save all the data to CSV?") == DialogResult.Yes)
|
||||
{
|
||||
SaveFileDialog savecsv = new SaveFileDialog();
|
||||
savecsv.Filter = "Spreadsheet|*.csv";
|
||||
savecsv.FileName = "Box Data Dump.csv";
|
||||
SaveFileDialog savecsv = new SaveFileDialog
|
||||
{
|
||||
Filter = "Spreadsheet|*.csv",
|
||||
FileName = "Box Data Dump.csv"
|
||||
};
|
||||
if (savecsv.ShowDialog() == DialogResult.OK)
|
||||
Export_CSV(savecsv.FileName);
|
||||
}
|
||||
|
@ -103,16 +100,16 @@ namespace PKHeX
|
|||
private ListSortDirection listSortDirection;
|
||||
private PropertyDescriptor propertyDescriptor;
|
||||
|
||||
public SortableBindingList()
|
||||
protected SortableBindingList()
|
||||
: base(new List<T>())
|
||||
{
|
||||
this.comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
}
|
||||
|
||||
public SortableBindingList(IEnumerable<T> enumeration)
|
||||
: base(new List<T>(enumeration))
|
||||
{
|
||||
this.comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
comparers = new Dictionary<Type, PropertyComparer<T>>();
|
||||
}
|
||||
|
||||
protected override bool SupportsSortingCore
|
||||
|
@ -122,17 +119,17 @@ namespace PKHeX
|
|||
|
||||
protected override bool IsSortedCore
|
||||
{
|
||||
get { return this.isSorted; }
|
||||
get { return isSorted; }
|
||||
}
|
||||
|
||||
protected override PropertyDescriptor SortPropertyCore
|
||||
{
|
||||
get { return this.propertyDescriptor; }
|
||||
get { return propertyDescriptor; }
|
||||
}
|
||||
|
||||
protected override ListSortDirection SortDirectionCore
|
||||
{
|
||||
get { return this.listSortDirection; }
|
||||
get { return listSortDirection; }
|
||||
}
|
||||
|
||||
protected override bool SupportsSearchingCore
|
||||
|
@ -142,38 +139,38 @@ namespace PKHeX
|
|||
|
||||
protected override void ApplySortCore(PropertyDescriptor property, ListSortDirection direction)
|
||||
{
|
||||
List<T> itemsList = (List<T>)this.Items;
|
||||
List<T> itemsList = (List<T>)Items;
|
||||
|
||||
Type propertyType = property.PropertyType;
|
||||
PropertyComparer<T> comparer;
|
||||
if (!this.comparers.TryGetValue(propertyType, out comparer))
|
||||
if (!comparers.TryGetValue(propertyType, out comparer))
|
||||
{
|
||||
comparer = new PropertyComparer<T>(property, direction);
|
||||
this.comparers.Add(propertyType, comparer);
|
||||
comparers.Add(propertyType, comparer);
|
||||
}
|
||||
|
||||
comparer.SetPropertyAndDirection(property, direction);
|
||||
itemsList.Sort(comparer);
|
||||
|
||||
this.propertyDescriptor = property;
|
||||
this.listSortDirection = direction;
|
||||
this.isSorted = true;
|
||||
propertyDescriptor = property;
|
||||
listSortDirection = direction;
|
||||
isSorted = true;
|
||||
|
||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
}
|
||||
|
||||
protected override void RemoveSortCore()
|
||||
{
|
||||
this.isSorted = false;
|
||||
this.propertyDescriptor = base.SortPropertyCore;
|
||||
this.listSortDirection = base.SortDirectionCore;
|
||||
isSorted = false;
|
||||
propertyDescriptor = base.SortPropertyCore;
|
||||
listSortDirection = base.SortDirectionCore;
|
||||
|
||||
this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, -1));
|
||||
}
|
||||
|
||||
protected override int FindCore(PropertyDescriptor property, object key)
|
||||
{
|
||||
int count = this.Count;
|
||||
int count = Count;
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
T element = this[i];
|
||||
|
@ -194,35 +191,35 @@ namespace PKHeX
|
|||
|
||||
public PropertyComparer(PropertyDescriptor property, ListSortDirection direction)
|
||||
{
|
||||
this.propertyDescriptor = property;
|
||||
propertyDescriptor = property;
|
||||
Type comparerForPropertyType = typeof(Comparer<>).MakeGenericType(property.PropertyType);
|
||||
this.comparer = (IComparer)comparerForPropertyType.InvokeMember("Default", BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.Public, null, null, null);
|
||||
this.SetListSortDirection(direction);
|
||||
comparer = (IComparer)comparerForPropertyType.InvokeMember("Default", BindingFlags.Static | BindingFlags.GetProperty | BindingFlags.Public, null, null, null);
|
||||
SetListSortDirection(direction);
|
||||
}
|
||||
|
||||
#region IComparer<T> Members
|
||||
|
||||
public int Compare(T x, T y)
|
||||
{
|
||||
return this.reverse * this.comparer.Compare(this.propertyDescriptor.GetValue(x), this.propertyDescriptor.GetValue(y));
|
||||
return reverse * comparer.Compare(propertyDescriptor.GetValue(x), propertyDescriptor.GetValue(y));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void SetPropertyDescriptor(PropertyDescriptor descriptor)
|
||||
{
|
||||
this.propertyDescriptor = descriptor;
|
||||
propertyDescriptor = descriptor;
|
||||
}
|
||||
|
||||
private void SetListSortDirection(ListSortDirection direction)
|
||||
{
|
||||
this.reverse = direction == ListSortDirection.Ascending ? 1 : -1;
|
||||
reverse = direction == ListSortDirection.Ascending ? 1 : -1;
|
||||
}
|
||||
|
||||
public void SetPropertyAndDirection(PropertyDescriptor descriptor, ListSortDirection direction)
|
||||
{
|
||||
this.SetPropertyDescriptor(descriptor);
|
||||
this.SetListSortDirection(direction);
|
||||
SetPropertyDescriptor(descriptor);
|
||||
SetListSortDirection(direction);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue