Standardization

This commit is contained in:
Kurt 2014-12-11 21:45:01 -08:00
parent ff97a7a973
commit 981965899a
20 changed files with 73 additions and 63 deletions

View file

@ -14,8 +14,8 @@ namespace PKHeX
{
public partial class CodeGenerator : Form
{
byte[] codedata = new Byte[232];
byte[] newdata = new Byte[232];
byte[] codedata = new byte[232];
byte[] newdata = new byte[232];
SaveGames.SaveStruct SaveGame = new SaveGames.SaveStruct(null);
Form1 m_parent;
@ -42,7 +42,7 @@ namespace PKHeX
if (m_parent.verifiedpkx())
{
byte[] pkx = m_parent.preparepkx(m_parent.buff);
newdata = new Byte[232];
newdata = new byte[232];
Array.Copy(PKX.encryptArray(pkx), newdata, 232);
}
else return false;
@ -50,14 +50,14 @@ namespace PKHeX
}
else if (CB_Source.SelectedIndex == 1)
{
newdata = new Byte[0xE8];
newdata = new byte[0xE8];
Array.Copy(m_parent.savefile,
SaveGame.Box // Box Offset
+ CB_Box.SelectedIndex * (232 * 30) // Box Shift
+ CB_Slot.SelectedIndex * 232, // Slot Shift
newdata, 0, 0xE8);
if (newdata.SequenceEqual(new Byte[0xE8]))
if (newdata.SequenceEqual(new byte[0xE8]))
{
System.Media.SystemSounds.Exclamation.Play();
return false;
@ -66,12 +66,12 @@ namespace PKHeX
else if (CB_Source.SelectedIndex == 2)
{
// Wondercard
newdata = new Byte[0x108];
newdata = new byte[0x108];
// Wondercard #
int wcn = CB_Slot.SelectedIndex;
// copy from save, the chosen wondercard offset, to new data
Array.Copy(m_parent.savefile, SaveGame.Wondercard + wcn * 0x108 + 0x100, newdata, 0, 0x108);
byte[] zerodata = new Byte[0x108];
byte[] zerodata = new byte[0x108];
if (newdata.SequenceEqual(zerodata))
{
System.Media.SystemSounds.Exclamation.Play();
@ -193,7 +193,7 @@ namespace PKHeX
// Gotta read in the textbox.
if (RTB_Code.Text.Length < 1) return;
byte[] ncf = new Byte[4 + (RTB_Code.Lines.Count()-1) * (3 * 4)];
byte[] ncf = new byte[4 + (RTB_Code.Lines.Count()-1) * (3 * 4)];
Array.Copy(BitConverter.GetBytes(ncf.Length - 4), ncf, 4);
for (int i = 0; i < RTB_Code.Lines.Count()-1; i++)
@ -244,7 +244,7 @@ namespace PKHeX
RTB_Code.Clear();
byte[] cybersav = m_parent.cyberSAV;
byte[] editedsav = m_parent.savefile;
byte[] newcyber = new Byte[m_parent.cyberSAV.Length];
byte[] newcyber = new byte[m_parent.cyberSAV.Length];
Array.Copy(editedsav, 0x5400, newcyber, 0, newcyber.Length);
int boxoffset = 0x22600;
@ -273,8 +273,8 @@ namespace PKHeX
// Loop Through Party
for (int i = 0x14200; i < 0x14200 + 260 * 6; i+= 260)
{
byte[] newdata = new Byte[260]; Array.Copy(newcyber, i, newdata, 0, 260);
byte[] olddata = new Byte[260]; Array.Copy(cybersav, i, olddata, 0, 260);
byte[] newdata = new byte[260]; Array.Copy(newcyber, i, newdata, 0, 260);
byte[] olddata = new byte[260]; Array.Copy(cybersav, i, olddata, 0, 260);
if (!newdata.SequenceEqual(olddata))
{
for (int z = 0; z < newdata.Length; z += 4)
@ -305,8 +305,8 @@ namespace PKHeX
// Loop Through Boxes
for (int i = boxoffset; i < boxoffset + (232 * 30 * 31); i += 232)
{
byte[] newdata = new Byte[232]; Array.Copy(newcyber, i, newdata, 0, 232);
byte[] olddata = new Byte[232]; Array.Copy(cybersav, i, olddata, 0, 232);
byte[] newdata = new byte[232]; Array.Copy(newcyber, i, newdata, 0, 232);
byte[] olddata = new byte[232]; Array.Copy(cybersav, i, olddata, 0, 232);
if (!newdata.SequenceEqual(olddata))
{
for (int z = 0; z < newdata.Length; z += 4)
@ -344,7 +344,7 @@ namespace PKHeX
{
// Gotta read in the textbox.
if (RTB_Code.Text.Length < 1) return;
byte[] data = new Byte[0];
byte[] data = new byte[0];
// Get Actual Lines
for (int i = 0; i < RTB_Code.Lines.Count(); i++)
{

View file

@ -938,7 +938,7 @@ namespace PKHeX
}
public byte[] convertPK3toPK4(byte[] pk3)
{
byte[] pk4 = new Byte[136];
byte[] pk4 = new byte[136];
Array.Copy(pk3, 0, pk4, 0, 4);
Array.Copy(pk3, 0x20, pk4, 0x08, 2); // Species
@ -1160,7 +1160,7 @@ namespace PKHeX
}
public byte[] convertPK4toPK5(byte[] pk4)
{
byte[] pk5 = new Byte[136];
byte[] pk5 = new byte[136];
if (pk4[0x5F] < 0x10 && BitConverter.ToUInt16(pk4, 0x80) > 0x4000)
return pk4;
@ -1204,7 +1204,7 @@ namespace PKHeX
pk5[0x83] = pk4[0x86];
// Transfer Nickname and OT Name
DataTable CT45 = Char4to5();
byte[] nicknamestr = new Byte[24];
byte[] nicknamestr = new byte[24];
string nickname = "";
string trainer = "";
nicknamestr[22] = nicknamestr[23] = 0xFF;
@ -1222,7 +1222,7 @@ namespace PKHeX
nickname += (char)newval;
}
byte[] OTstr = new Byte[24];
byte[] OTstr = new byte[24];
OTstr[22] = OTstr[23] = 0xFF;
for (int i = 0; i < 24; i += 2)
{
@ -1256,7 +1256,7 @@ namespace PKHeX
public byte[] convertPK5toPK6(byte[] pk5)
{
// To transfer, we will go down the pkm offset list and fill it into the PKX list.
byte[] pk6 = new Byte[232]; // Setup new array to store the new PKX
byte[] pk6 = new byte[232]; // Setup new array to store the new PKX
// Check if G4PKM
if (pk5[0x5F] < 0x10 && BitConverter.ToUInt16(pk5, 0x80) < 4000)

View file

@ -71,6 +71,12 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="PKX\f2-Text.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PKX\f2-Text.Designer.cs">
<DependentUpon>f2-Text.cs</DependentUpon>
</Compile>
<Compile Include="Misc\About.cs">
<SubType>Form</SubType>
</Compile>
@ -102,6 +108,11 @@
<Compile Include="PKX\f3-MemoryAmie.Designer.cs">
<DependentUpon>f3-MemoryAmie.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_PokedexORAS.cs">
<SubType>Form</SubType>
</Compile>
@ -129,11 +140,6 @@
<Compile Include="Misc\pk2pk.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SAV\SAV_BerryField.cs">
<SubType>Form</SubType>
</Compile>
@ -213,6 +219,9 @@
<DependentUpon>SplashScreen.cs</DependentUpon>
</Compile>
<Compile Include="Misc\Util.cs" />
<EmbeddedResource Include="PKX\f2-Text.resx">
<DependentUpon>f2-Text.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Misc\About.resx">
<DependentUpon>About.cs</DependentUpon>
</EmbeddedResource>
@ -328,6 +337,7 @@
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<None Include="Resources\byte\PGLDings-NormalRegular.ttf" />
<None Include="Resources\img\item\item_650.png" />
<None Include="Resources\text\zh\text_xy_60000_zh.txt" />
<None Include="Resources\text\zh\text_bw2_40000_zh.txt" />

View file

@ -14,7 +14,7 @@ namespace PKHeX
public partial class MemoryAmie : Form
{
Form1 m_parent;
public byte[] h = new Byte[260]; // Always Visible
public byte[] h = new byte[260]; // Always Visible
private string disabled = "Disabled";
private string notleft = "Never left";
private string ot = "OT";

View file

@ -23,7 +23,7 @@ namespace PKHeX
}
int berryfoffset;
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savindex; int shiftval;
public bool editing = false;

View file

@ -62,7 +62,7 @@ namespace PKHeX
File.WriteAllBytes(path + ".bak", backupfile);
}
int offset = shiftval + boxoffset + (CB_Box.SelectedIndex) * (0xE8 * 30);
byte[] newbox = new Byte[0xE8 * 30];
byte[] newbox = new byte[0xE8 * 30];
Array.Copy(m_parent.savefile, offset, newbox, 0, 0xE8 * 30);
File.WriteAllBytes(path, newbox);
}

View file

@ -28,7 +28,7 @@ namespace PKHeX
LB_BoxSelect.SelectedIndex = m_parent.C_BoxSelect.SelectedIndex;
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savindex;
public bool editing = false;
private static uint ToUInt32(String value)

View file

@ -101,7 +101,7 @@ namespace PKHeX
//flag_2546, // Pokedex
};
int offset = 0x1A0FC + savshift;
byte[] data = new Byte[0x180];
byte[] data = new byte[0x180];
Array.Copy(m_parent.savefile, offset, data, 0, 0x180);
BitArray BitRegion = new BitArray(data);
BitRegion.CopyTo(flags, 0);
@ -179,8 +179,8 @@ namespace PKHeX
else
TB_UnSet.AppendText(i.ToString("0000") + ",");
}
private byte[] olddata = new Byte[0x180];
private byte[] newdata = new Byte[0x180];
private byte[] olddata = new byte[0x180];
private byte[] newdata = new byte[0x180];
private void openSAV(object sender, EventArgs e)
{
byte[] eventflags = new byte[0x180];

View file

@ -63,7 +63,7 @@ namespace PKHeX
flag_2546, // Pokedex
};
int offset = 0x1A0FC + savshift;
byte[] data = new Byte[0x180];
byte[] data = new byte[0x180];
Array.Copy(m_parent.savefile, offset, data, 0, 0x180);
BitArray BitRegion = new BitArray(data);
BitRegion.CopyTo(flags, 0);
@ -147,8 +147,8 @@ namespace PKHeX
}
}
}
private byte[] olddata = new Byte[0x180];
private byte[] newdata = new Byte[0x180];
private byte[] olddata = new byte[0x180];
private byte[] newdata = new byte[0x180];
private void openSAV(object sender, EventArgs e)
{
byte[] eventflags = new byte[0x180];

View file

@ -54,7 +54,7 @@ namespace PKHeX
editing = true;
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savindex; int shiftval;
public bool editing = false;
private int data_offset = 0x1E800;

View file

@ -48,7 +48,7 @@ namespace PKHeX
B_DisplayKeyItems.Text = Form1.itempouch[4];
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savindex; int shiftval;
public bool editing = false;

View file

@ -89,7 +89,7 @@ namespace PKHeX
for (int i = 0; i < cba.Length; i++)
{
byte[] data = new Byte[cba[i].Items.Count - 1];
byte[] data = new byte[cba[i].Items.Count - 1];
for (int c = 0; c < cba[i].SelectedIndex; c++)
{
data[c] = 1;
@ -116,7 +116,7 @@ namespace PKHeX
byte[] _3 = new byte[] { 01, 01, 01, 00, };
byte[] _4 = new byte[] { 01, 01, 01, 01, };
byte[] data = new Byte[4];
byte[] data = new byte[4];
Array.Copy(m_parent.savefile, o, data, 0, l);
if (data.SequenceEqual(_4)) return 4;

View file

@ -26,7 +26,7 @@ namespace PKHeX
}
private int dexoffset = 0x15000 + 0x5400;
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int sv = 0;
public bool[,] specbools = new bool[9, 0x60 * 8];
public bool[,] langbools = new bool[7, 0x60 * 8];
@ -71,7 +71,7 @@ namespace PKHeX
// Fill Bit arrays
for (int i = 0; i < 9; i++)
{
byte[] data = new Byte[0x60];
byte[] data = new byte[0x60];
int offset = dexoffset + 0x8 + 0x60 * i;
Array.Copy(sav, offset, data, 0, 0x60);
BitArray BitRegion = new BitArray(data);
@ -81,7 +81,7 @@ namespace PKHeX
}
// Fill Language arrays
byte[] langdata = new Byte[0x280];
byte[] langdata = new byte[0x280];
Array.Copy(sav, dexoffset + 0x400, langdata, 0, 0x280);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < (721); b++) // 721 Species

View file

@ -24,7 +24,7 @@ namespace PKHeX
TB_Spinda.Text = BitConverter.ToUInt32(sav, 0x1AA48 + Convert.ToInt16(m_parent.savegame_oras) * 0x38).ToString("X8");
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savshift = 0;
public bool[,] specbools = new bool[10, 0x60 * 8];
public bool[,] langbools = new bool[7, 0x60 * 8];
@ -74,7 +74,7 @@ namespace PKHeX
// Fill Bit arrays
for (int i = 0; i < 0xA; i++)
{
byte[] data = new Byte[0x60];
byte[] data = new byte[0x60];
Array.Copy(sav, savshift + 0x1A408 + 0x60 * i, data, 0, 0x60);
BitArray BitRegion = new BitArray(data);
for (int b = 0; b < (0x60 * 8); b++)
@ -82,7 +82,7 @@ namespace PKHeX
}
// Fill Language arrays
byte[] langdata = new Byte[0x280];
byte[] langdata = new byte[0x280];
Array.Copy(sav, savshift + 0x1A7C8, langdata, 0, 0x280);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < (721); b++) // 721 Species
@ -91,7 +91,7 @@ namespace PKHeX
// Fill Foreign array
{
byte[] foreigndata = new Byte[0x52];
byte[] foreigndata = new byte[0x52];
Array.Copy(sav, savshift + 0x1AA4C, foreigndata, 0, 0x52);
BitArray ForeignRegion = new BitArray(foreigndata);
for (int b = 0; b < (0x52 * 8); b++)

View file

@ -28,7 +28,7 @@ namespace PKHeX
ToolTip2.SetToolTip(this.B_All, "Hold CTRL to give Deluxe instead of Supreme.");
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savindex;
public bool editing = false;
private string[] pfa = {
@ -97,7 +97,7 @@ namespace PKHeX
basepuff = 1;
basemod = 0x19;
}
byte[] newpuffs = new Byte[100];
byte[] newpuffs = new byte[100];
for (int i = 0; i < 100; i++)
{
newpuffs[i] = (byte)(Util.rnd32() % basemod + basepuff);
@ -107,7 +107,7 @@ namespace PKHeX
}
private void B_None_Click(object sender, EventArgs e)
{
byte[] newpuffs = new Byte[100];
byte[] newpuffs = new byte[100];
newpuffs[0] = 1;
newpuffs[1] = 2;
newpuffs[2] = 3;
@ -118,7 +118,7 @@ namespace PKHeX
}
private void B_Sort_Click(object sender, EventArgs e)
{
byte[] puffarray = new Byte[100];
byte[] puffarray = new byte[100];
if (ModifierKeys == Keys.Control)
{
for (int i = 0; i < 100; i++)
@ -151,7 +151,7 @@ namespace PKHeX
}
private void B_Save_Click(object sender, EventArgs e)
{
byte[] puffarray = new Byte[100];
byte[] puffarray = new byte[100];
int emptyslots = 0;
for (int i = 0; i < 100; i++)
{

View file

@ -35,8 +35,8 @@ namespace PKHeX
B_SAV2FAV(null, null);
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] wondercard_data = new Byte[0x108];
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;
@ -371,7 +371,7 @@ namespace PKHeX
private void changeObjectIndex(object sender, EventArgs e)
{
int objindex = (int)(NUD_FObject.Value) - 1;
byte[] objinfo = new Byte[12];
byte[] objinfo = new byte[12];
for (int i = 0; i < 12; i++)
objinfo[i] = objdata[objindex, i];
@ -422,7 +422,7 @@ namespace PKHeX
{
if (loading || !GB_PKM.Enabled) return;
int index = currentpkm;
byte[] pkm = new Byte[0x34];
byte[] pkm = new byte[0x34];
Array.Copy(BitConverter.GetBytes(Util.getHEXval(TB_EC)), 0, pkm, 0, 4); // EC
Array.Copy(BitConverter.GetBytes(Util.getIndex(CB_Species)), 0, pkm, 8, 2);
@ -472,7 +472,7 @@ namespace PKHeX
private void loadFavPKM()
{
int index = currentpkm - 1;
byte[] fpkm = new Byte[0x34];
byte[] fpkm = new byte[0x34];
for (int i = 0; i < 0x34; i++)
fpkm[i] = pkmdata[index, i];

View file

@ -32,7 +32,7 @@ namespace PKHeX
setup();
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public string[] specieslist;
public int savindex;
private int data_offset = 0x24600;
@ -142,7 +142,7 @@ namespace PKHeX
private void B_Save_Click(object sender, EventArgs e)
{
// Copy Bags
byte[] bagarray = new Byte[12];
byte[] bagarray = new byte[12];
int emptyslots = 0;
for (int i = 0; i < 12; i++)
{

View file

@ -200,7 +200,7 @@ namespace PKHeX
}
private string[] statdata = new string[] { };
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] sav = new byte[0x100000];
public int savshift;
public int savindex;
public bool editing = false;

View file

@ -31,8 +31,8 @@ namespace PKHeX
this.DragDrop += new DragEventHandler(tabMain_DragDrop);
}
Form1 m_parent;
public byte[] sav = new Byte[0x100000];
public byte[] wondercard_data = new Byte[0x108];
public byte[] sav = new byte[0x100000];
public byte[] wondercard_data = new byte[0x108];
public int savindex;
public bool editing = false;
private int wcoffset = 0x21100;
@ -104,7 +104,7 @@ namespace PKHeX
catch
{
Util.Error("Loading of data failed... is this really a Wondercard?");
Array.Copy(new Byte[0x108], wondercard_data, 0x108);
Array.Copy(new byte[0x108], wondercard_data, 0x108);
RTB.Clear();
return;
}
@ -188,7 +188,7 @@ namespace PKHeX
{
int index = LB_WCs.SelectedIndex;
int offset = wcoffset + savindex * 0x7F000 + index * 0x108;
byte[] zeros = new Byte[0x108];
byte[] zeros = new byte[0x108];
Array.Copy(zeros, 0, sav, offset, 0x108);
populateWClist();
}

View file

@ -32,7 +32,7 @@ namespace PKHeX
for (int SlotNum = 0; SlotNum < 30; SlotNum++)
{
int offset = boxoffset + 0xE8 * SlotNum;
byte[] slotdata = new Byte[0xE8];
byte[] slotdata = new byte[0xE8];
Array.Copy(SaveData, offset, slotdata, 0, 0xE8);
byte[] dslotdata = PKX.decryptArray(slotdata);
PKX pkm = new PKX(dslotdata);