Added 3DS Link editor, needs testing and adding gender safety filter

This commit is contained in:
suloku
2017-03-23 19:47:07 +01:00
parent d6aac7b106
commit 10080446ac
11 changed files with 3026 additions and 23 deletions

View File

@@ -54,6 +54,10 @@
<Compile Include="Editors\DLC.Designer.cs">
<DependentUpon>DLC.cs</DependentUpon>
</Compile>
<Compile Include="Editors\DreamRadar.cs" />
<Compile Include="Editors\DreamRadar.Designer.cs">
<DependentUpon>DreamRadar.cs</DependentUpon>
</Compile>
<Compile Include="Editors\Entralink_DreamWorld.cs" />
<Compile Include="Editors\Entralink_DreamWorld.Designer.cs">
<DependentUpon>Entralink_DreamWorld.cs</DependentUpon>
@@ -116,6 +120,9 @@
<EmbeddedResource Include="Editors\DLC.resx">
<DependentUpon>DLC.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\DreamRadar.resx">
<DependentUpon>DreamRadar.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Editors\Dumper.resx">
<DependentUpon>Dumper.cs</DependentUpon>
</EmbeddedResource>

1203
BW_tool/Editors/DreamRadar.Designer.cs generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,853 @@
/*
* Created by SharpDevelop.
* User: sergi
* Date: 23/03/2017
* Time: 13:29
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BW_tool
{
/// <summary>
/// Description of DreamRadar.
/// </summary>
public partial class DreamRadar : Form
{
DRKEY drkey;
int drkeyblock = 72;
DRA dra;
DRB drb;
public DreamRadar()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
drkey = new DRKEY(MainForm.save.getBlock(drkeyblock));
dra = new DRA(MainForm.save.dslinkA_get());
drb = new DRB(PKX5.cryptoXor32Array(MainForm.save.dslinkB_get(), 0, 0x5C, 0x5C)); //Get 3DS link data decrypted
if (dra.received == false)
MessageBox.Show("Warning! There's unreceived data in the savegame!");
if (drb.illegal == true)
{
allmode.Checked = true;
set_all_list();
}
else
{
legitmode.Checked = true;
set_legal_list();
}
load_data();
//
// TODO: Add constructor code after the InitializeComponent() call.
//
}
void Exit_butClick(object sender, EventArgs e)
{
this.Close();
}
void Saveexit_butClick(object sender, EventArgs e)
{
set_data();
MainForm.save.setBlock(drkey.Data, 72);
MainForm.save.dslinkA_set(dra.Data);
MainForm.save.dslinkB_set(PKX5.cryptoXor32Array(drb.Data, 0, 0x5C, 0x5C));
this.Close();
}
void Clean_butClick(object sender, EventArgs e)
{
drkey.reinit();
dra.reinit();
drb.reinit();
MainForm.save.setBlock(drkey.Data, 72);
MainForm.save.dslinkA_set(dra.Data);
MainForm.save.dslinkB_set(PKX5.cryptoXor32Array(drb.Data, 0, 0x5C, 0x5C));
this.Close();
}
void set_legal_list()
{
pkm1.Items.Clear();
pkm2.Items.Clear();
pkm3.Items.Clear();
pkm4.Items.Clear();
pkm5.Items.Clear();
pkm6.Items.Clear();
pkm1.Items.AddRange(TEXT.drpklist);
pkm2.Items.AddRange(TEXT.drpklist);
pkm3.Items.AddRange(TEXT.drpklist);
pkm4.Items.AddRange(TEXT.drpklist);
pkm5.Items.AddRange(TEXT.drpklist);
pkm6.Items.AddRange(TEXT.drpklist);
item1.Items.Clear();
item2.Items.Clear();
item3.Items.Clear();
item4.Items.Clear();
item5.Items.Clear();
item6.Items.Clear();
item1.Items.AddRange(TEXT.dritemlist);
item2.Items.AddRange(TEXT.dritemlist);
item3.Items.AddRange(TEXT.dritemlist);
item4.Items.AddRange(TEXT.dritemlist);
item5.Items.AddRange(TEXT.dritemlist);
item6.Items.AddRange(TEXT.dritemlist);
}
void set_all_list()
{
pkm1.Items.Clear();
pkm2.Items.Clear();
pkm3.Items.Clear();
pkm4.Items.Clear();
pkm5.Items.Clear();
pkm6.Items.Clear();
pkm1.Items.AddRange(TEXT.pkmlist);
pkm2.Items.AddRange(TEXT.pkmlist);
pkm3.Items.AddRange(TEXT.pkmlist);
pkm4.Items.AddRange(TEXT.pkmlist);
pkm5.Items.AddRange(TEXT.pkmlist);
pkm6.Items.AddRange(TEXT.pkmlist);
item1.Items.Clear();
item2.Items.Clear();
item3.Items.Clear();
item4.Items.Clear();
item5.Items.Clear();
item6.Items.Clear();
item1.Items.AddRange(TEXT.itemlist);
item2.Items.AddRange(TEXT.itemlist);
item3.Items.AddRange(TEXT.itemlist);
item4.Items.AddRange(TEXT.itemlist);
item5.Items.AddRange(TEXT.itemlist);
item6.Items.AddRange(TEXT.itemlist);
}
int poke2legit(int species)
{
if (legitmode.Checked == true)
{
int i = 0;
for (i = 0; i<19; i++)
{
if (species == drb.legit_pk_index[i])
return i;
}
}
return species;
}
int item2legit(int item)
{
if (legitmode.Checked == true)
{
int i = 0;
for (i = 0; i<24; i++)
{
if (item == drb.legit_item_index[i])
return i;
}
}
return item;
}
void load_data()
{
pkm1.SelectedIndex = poke2legit(drb.get_poke_species(0));
pkm2.SelectedIndex = poke2legit(drb.get_poke_species(1));
pkm3.SelectedIndex = poke2legit(drb.get_poke_species(2));
pkm4.SelectedIndex = poke2legit(drb.get_poke_species(3));
pkm5.SelectedIndex = poke2legit(drb.get_poke_species(4));
pkm6.SelectedIndex = poke2legit(drb.get_poke_species(5));
item1.SelectedIndex = item2legit(drb.get_item_id(0));
item2.SelectedIndex = item2legit(drb.get_item_id(1));
item3.SelectedIndex = item2legit(drb.get_item_id(2));
item4.SelectedIndex = item2legit(drb.get_item_id(3));
item5.SelectedIndex = item2legit(drb.get_item_id(4));
item6.SelectedIndex = item2legit(drb.get_item_id(5));
pkmgnd1.SelectedIndex = drb.get_poke_gender(0);
pkmgnd2.SelectedIndex = drb.get_poke_gender(1);
pkmgnd3.SelectedIndex = drb.get_poke_gender(2);
pkmgnd4.SelectedIndex = drb.get_poke_gender(3);
pkmgnd5.SelectedIndex = drb.get_poke_gender(4);
pkmgnd6.SelectedIndex = drb.get_poke_gender(5);
itemcnt1.Value = drb.get_item_amount(0);
itemcnt2.Value = drb.get_item_amount(1);
itemcnt3.Value = drb.get_item_amount(2);
itemcnt4.Value = drb.get_item_amount(3);
itemcnt5.Value = drb.get_item_amount(4);
itemcnt6.Value = drb.get_item_amount(5);
legend1.SelectedIndex = drb.get_legend(0);
legend2.SelectedIndex = drb.get_legend(1);
legend3.SelectedIndex = drb.get_legend(2);
legend4.SelectedIndex = drb.get_legend(3);
legend5.SelectedIndex = drb.get_legend(4);
legend6.SelectedIndex = drb.get_legend(5);
legend7.SelectedIndex = drb.get_legend(6);
legend8.SelectedIndex = drb.get_legend(7);
flag0.Checked = drkey.Tornadus;
flag1.Checked = drkey.Thundurus;
flag2.Checked = drkey.Landorus;
flag3.Checked = drkey.Dialga;
flag4.Checked = drkey.Palkia;
flag5.Checked = drkey.Giratina;
flag6.Checked = drkey.HoOh;
flag7.Checked = drkey.Lugia;
}
void set_data()
{
//Legendary slots
switch (legend1.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 0);
break;
case 2:
drb.set_legend(DRB.Thundurus, 0);
break;
case 3:
drb.set_legend(DRB.Landorus, 0);
break;
case 4:
drb.set_legend(DRB.Dialga, 0);
break;
case 5:
drb.set_legend(DRB.Palkia, 0);
break;
case 6:
drb.set_legend(DRB.Giratina, 0);
break;
case 7:
drb.set_legend(DRB.HoOh, 0);
break;
case 8:
drb.set_legend(DRB.Lugia, 0);
break;
default:
drb.set_legend(0, 0);
break;
};
switch (legend2.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 1);
break;
case 2:
drb.set_legend(DRB.Thundurus, 1);
break;
case 3:
drb.set_legend(DRB.Landorus, 1);
break;
case 4:
drb.set_legend(DRB.Dialga, 1);
break;
case 5:
drb.set_legend(DRB.Palkia, 1);
break;
case 6:
drb.set_legend(DRB.Giratina, 1);
break;
case 7:
drb.set_legend(DRB.HoOh, 1);
break;
case 8:
drb.set_legend(DRB.Lugia, 1);
break;
default:
drb.set_legend(0, 1);
break;
};
switch (legend3.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 2);
break;
case 2:
drb.set_legend(DRB.Thundurus, 2);
break;
case 3:
drb.set_legend(DRB.Landorus, 2);
break;
case 4:
drb.set_legend(DRB.Dialga, 2);
break;
case 5:
drb.set_legend(DRB.Palkia, 2);
break;
case 6:
drb.set_legend(DRB.Giratina, 2);
break;
case 7:
drb.set_legend(DRB.HoOh, 2);
break;
case 8:
drb.set_legend(DRB.Lugia, 2);
break;
default:
drb.set_legend(0, 2);
break;
};
switch (legend4.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 3);
break;
case 2:
drb.set_legend(DRB.Thundurus, 3);
break;
case 3:
drb.set_legend(DRB.Landorus, 3);
break;
case 4:
drb.set_legend(DRB.Dialga, 3);
break;
case 5:
drb.set_legend(DRB.Palkia, 3);
break;
case 6:
drb.set_legend(DRB.Giratina, 3);
break;
case 7:
drb.set_legend(DRB.HoOh, 3);
break;
case 8:
drb.set_legend(DRB.Lugia, 3);
break;
default:
drb.set_legend(0, 3);
break;
};
switch (legend5.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 4);
break;
case 2:
drb.set_legend(DRB.Thundurus, 4);
break;
case 3:
drb.set_legend(DRB.Landorus, 4);
break;
case 4:
drb.set_legend(DRB.Dialga, 4);
break;
case 5:
drb.set_legend(DRB.Palkia, 4);
break;
case 6:
drb.set_legend(DRB.Giratina, 4);
break;
case 7:
drb.set_legend(DRB.HoOh, 4);
break;
case 8:
drb.set_legend(DRB.Lugia, 4);
break;
default:
drb.set_legend(0, 4);
break;
};
switch (legend6.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 5);
break;
case 2:
drb.set_legend(DRB.Thundurus, 5);
break;
case 3:
drb.set_legend(DRB.Landorus, 5);
break;
case 4:
drb.set_legend(DRB.Dialga, 5);
break;
case 5:
drb.set_legend(DRB.Palkia, 5);
break;
case 6:
drb.set_legend(DRB.Giratina, 5);
break;
case 7:
drb.set_legend(DRB.HoOh, 5);
break;
case 8:
drb.set_legend(DRB.Lugia, 5);
break;
default:
drb.set_legend(0, 5);
break;
};
switch (legend7.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 6);
break;
case 2:
drb.set_legend(DRB.Thundurus, 6);
break;
case 3:
drb.set_legend(DRB.Landorus, 6);
break;
case 4:
drb.set_legend(DRB.Dialga, 6);
break;
case 5:
drb.set_legend(DRB.Palkia, 6);
break;
case 6:
drb.set_legend(DRB.Giratina, 6);
break;
case 7:
drb.set_legend(DRB.HoOh, 6);
break;
case 8:
drb.set_legend(DRB.Lugia, 6);
break;
default:
drb.set_legend(0, 6);
break;
};
switch (legend8.SelectedIndex)
{
case 1:
drb.set_legend(DRB.Tornadus, 7);
break;
case 2:
drb.set_legend(DRB.Thundurus, 7);
break;
case 3:
drb.set_legend(DRB.Landorus, 7);
break;
case 4:
drb.set_legend(DRB.Dialga, 7);
break;
case 5:
drb.set_legend(DRB.Palkia, 7);
break;
case 6:
drb.set_legend(DRB.Giratina, 7);
break;
case 7:
drb.set_legend(DRB.HoOh, 7);
break;
case 8:
drb.set_legend(DRB.Lugia, 7);
break;
default:
drb.set_legend(0, 7);
break;
};
if (legitmode.Checked == true)
{
drb.set_poke(drb.legit_pk_index[pkm1.SelectedIndex], pkmgnd1.SelectedIndex, 0);
drb.set_poke(drb.legit_pk_index[pkm2.SelectedIndex], pkmgnd2.SelectedIndex, 1);
drb.set_poke(drb.legit_pk_index[pkm3.SelectedIndex], pkmgnd3.SelectedIndex, 2);
drb.set_poke(drb.legit_pk_index[pkm4.SelectedIndex], pkmgnd4.SelectedIndex, 3);
drb.set_poke(drb.legit_pk_index[pkm5.SelectedIndex], pkmgnd5.SelectedIndex, 4);
drb.set_poke(drb.legit_pk_index[pkm6.SelectedIndex], pkmgnd6.SelectedIndex, 5);
drb.set_item((int)itemcnt1.Value, drb.legit_item_index[item1.SelectedIndex], 0);
drb.set_item((int)itemcnt2.Value, drb.legit_item_index[item2.SelectedIndex], 1);
drb.set_item((int)itemcnt3.Value, drb.legit_item_index[item3.SelectedIndex], 2);
drb.set_item((int)itemcnt4.Value, drb.legit_item_index[item4.SelectedIndex], 3);
drb.set_item((int)itemcnt5.Value, drb.legit_item_index[item5.SelectedIndex], 4);
drb.set_item((int)itemcnt6.Value, drb.legit_item_index[item6.SelectedIndex], 5);
}
else
{
drb.set_poke(pkm1.SelectedIndex, pkmgnd1.SelectedIndex, 0);
drb.set_poke(pkm2.SelectedIndex, pkmgnd2.SelectedIndex, 1);
drb.set_poke(pkm3.SelectedIndex, pkmgnd3.SelectedIndex, 2);
drb.set_poke(pkm4.SelectedIndex, pkmgnd4.SelectedIndex, 3);
drb.set_poke(pkm5.SelectedIndex, pkmgnd5.SelectedIndex, 4);
drb.set_poke(pkm6.SelectedIndex, pkmgnd6.SelectedIndex, 5);
drb.set_item((int)itemcnt1.Value, item1.SelectedIndex, 0);
drb.set_item((int)itemcnt2.Value, item2.SelectedIndex, 1);
drb.set_item((int)itemcnt3.Value, item3.SelectedIndex, 2);
drb.set_item((int)itemcnt4.Value, item4.SelectedIndex, 3);
drb.set_item((int)itemcnt5.Value, item5.SelectedIndex, 4);
drb.set_item((int)itemcnt6.Value, item6.SelectedIndex, 5);
}
int i = 0;
for(i=0;i<drb.Size;i++)
{
if (drb.Data[i] != 0)
dra.received = false; //If we have any data, mark as available to be received
}
}
void AllmodeCheckedChanged(object sender, EventArgs e)
{
if (drb.illegal == true)
{
allmode.Checked = true;
set_all_list();
}
else
{
legitmode.Checked = true;
set_legal_list();
}
load_data();
}
void LegitmodeCheckedChanged(object sender, EventArgs e)
{
if (drb.illegal == true)
{
allmode.Checked = true;
set_all_list();
}
else
{
legitmode.Checked = true;
set_legal_list();
}
load_data();
}
}
public class DRKEY
{
internal int Size = MainForm.save.getBlockLength(72);
public byte[] Data;
public DRKEY(byte[] data = null)
{
Data = data ?? new byte[Size];
}
public UInt32 unknown1 //Not sure how this is used/updated by 3DS link data block
{
get { return BitConverter.ToUInt32(Data, 0x00); }
set { BitConverter.GetBytes((UInt32)value).CopyTo(Data, 0x00); }
}
public byte FLAGS { get { return Data[0x04]; } set { Data[0x04] = value; } }
public bool Tornadus { get { return (FLAGS & (1 << 0)) == 1 << 0; } set { FLAGS = (byte)(FLAGS & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public bool Thundurus { get { return (FLAGS & (1 << 1)) == 1 << 1; } set { FLAGS = (byte)(FLAGS & ~(1 << 1) | (value ? 1 << 1 : 0)); } }
public bool Landorus { get { return (FLAGS & (1 << 2)) == 1 << 2; } set { FLAGS = (byte)(FLAGS & ~(1 << 2) | (value ? 1 << 2 : 0)); } }
public bool Dialga { get { return (FLAGS & (1 << 3)) == 1 << 3; } set { FLAGS = (byte)(FLAGS & ~(1 << 3) | (value ? 1 << 3 : 0)); } }
public bool Palkia { get { return (FLAGS & (1 << 4)) == 1 << 4; } set { FLAGS = (byte)(FLAGS & ~(1 << 4) | (value ? 1 << 4 : 0)); } }
public bool Giratina { get { return (FLAGS & (1 << 5)) == 1 << 5; } set { FLAGS = (byte)(FLAGS & ~(1 << 5) | (value ? 1 << 5 : 0)); } }
public bool HoOh { get { return (FLAGS & (1 << 6)) == 1 << 6; } set { FLAGS = (byte)(FLAGS & ~(1 << 6) | (value ? 1 << 6 : 0)); } }
public bool Lugia { get { return (FLAGS & (1 << 7)) == 1 << 7; } set { FLAGS = (byte)(FLAGS & ~(1 << 7) | (value ? 1 << 7 : 0)); } }
//This value is set to 0x01 when 3DS Link has been used at least once and seems to remain that way
public bool used { get { return (Data[0x08] & (1 << 0)) == 1 << 0; } set { Data[0x08] = (byte)(Data[0x08] & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public void reinit() //Call this to clean all data so legendaries can be received again. Must be used with the other classes reinit() for it to work
{
unknown1 = 0;
FLAGS = 0;
used = false;
}
}
public class DRA
{
internal int Size = 10;
private UInt32 ident = 0x43524746;
public byte[] Data;
public DRA(byte[] data = null)
{
Data = data ?? new byte[Size];
}
//This value is set to 0x01 when 3DS Link has data to be received and 0x00 when no data/data already received
public bool received { get { return (Data[0x00] & (1 << 0)) == 1 << 0; } set { Data[0x00] = (byte)(Data[0x00] & ~(1 << 0) | (value ? 1 << 0 : 0)); } }
public UInt32 unknown1 //derived from offset 0x25E00 (0x00000000 if the Pokemon were not yet received)
{
get { return BitConverter.ToUInt32(Data, 0x04); }
set { BitConverter.GetBytes((UInt32)value).CopyTo(Data, 0x04); }
}
public UInt32 Ident //always 0x43524746 (CRGF)
{
get { return BitConverter.ToUInt32(Data, 0x08); }
//set { BitConverter.GetBytes((UInt32)value).CopyTo(Data, 0x08); }
set { BitConverter.GetBytes(ident).CopyTo(Data, 0x08); }
}
public UInt32 key //Encryption Key used for the next transfer from DR (0x00000000 if the Pokemon were not yet received) --> Also seems to hold the lengedary flags!
{
get { return BitConverter.ToUInt32(Data, 0x0C); }
set { BitConverter.GetBytes((UInt32)value).CopyTo(Data, 0x0C); }
}
public void reinit() //Call this to clean all data so legendaries can be received again. Must be used with the other classes reinit() for it to work
{
received = true;
unknown1 = 0;
Ident = ident;
key = 0;
}
}
public class DRB
{
public int Size = 0x60;
public byte[] Data;
public DRB(byte[] data = null)
{
Data = data ?? new byte[Size];
//Read the legendary values
int i = 0;
for (i=0; i<8;i++)
{
legendaries[i] = BitConverter.ToUInt32(Data, 0x00 + i*4);
}
//Read pokemon
for (i=0; i<6;i++)
{
pokes[i] = BitConverter.ToUInt32(Data, 0x20 + i*4);
}
//Read items
for (i=0; i<6;i++)
{
items[i] = BitConverter.ToUInt32(Data, 0x38 + i*4);
}
//Check legality of data
illegal = false;
int j = 0;
for (i=0; i<6;i++)
{
for (j=0;j<19;j++)
{
if (get_poke_species(i) == legit_pk_index[j])
{
break; //Found valid index, continue next pokémon
}
else if ( (get_poke_species(i) != legit_pk_index[j]) && j == 18) //Couldn't find valid species index
{
illegal = true;
}
}
if (illegal == true) // No need to continue
break;
}
if (illegal == false)
{
for (i=0; i<6;i++)
{
j = 0;
for (j=0;j<24;j++)
{
if (get_item_id(i) == legit_item_index[j])
{
break; //Found valid index, continue next item
}
else if ( (get_item_id(i) != legit_item_index[j]) && j == 23) //Couldn't find valid item index
{
illegal = true;
}
}
if (illegal == true) // No need to continue
break;
}
}
}
public const UInt32 Tornadus = 0x80808080;
public const UInt32 Thundurus = 0x92567284;
public const UInt32 Landorus = 0x87643567;
public const UInt32 Dialga = 0x96436763;
public const UInt32 Palkia = 0x43867368;
public const UInt32 Giratina = 0x17693572;
public const UInt32 HoOh = 0x44798367;
public const UInt32 Lugia = 0x96636983;
private UInt32[] legendaries = new UInt32[8];
public int[] legit_pk_index = new int[]{0, 79, 120, 137, 163, 174, 175, 213, 238, 280, 333, 374, 425, 436, 442, 447, 479, 517, 531};
public int[] legit_item_index = new int[]{0, 72, 73, 74, 75, 51, 154, 28, 29, 80, 109, 81, 82, 83, 84, 85, 91, 93, 270, 275, 538, 44, 50, 221};
public bool illegal;
public int get_legend(int index) //Simple wrapper for the legendary values
{
int legend = 0;
switch (legendaries[index])
{
case Tornadus:
legend = 1;
break;
case Thundurus:
legend = 2;
break;
case Landorus:
legend = 3;
break;
case Dialga:
legend = 4;
break;
case Palkia:
legend = 5;
break;
case Giratina:
legend = 6;
break;
case HoOh:
legend = 7;
break;
case Lugia:
legend = 8;
break;
default:
legend = 0;
break;
}
return legend;
}
public void set_legend(UInt32 legend, int index)
{
BitConverter.GetBytes(legend).CopyTo(Data, 0x00 + index*4);
}
UInt32[] pokes = new UInt32[6];
UInt32[] items = new UInt32[6];
public int get_poke_species(int index)
{
return (int)pokes[index] >> 16;
}
public int get_poke_gender(int index)
{
return (int)pokes[index] & 0x0000000F;
}
public void set_poke(int species, int gender, int index)
{
//TODO add genderless and single gender species filter
pokes[index] = (UInt32)(gender | (species << 16));
BitConverter.GetBytes(pokes[index]).CopyTo(Data, 0x20 + index*4);
}
public int get_item_id(int index)
{
return (int)items[index] & 0x0000FFFF;
}
public int get_item_amount(int index)
{
return (int)items[index] >> 16;
}
public void set_item(int amount, int id, int index)
{
if (amount == 0 && id > 0) //Put 1 of an item if it's 0
{
items[index] = (UInt32)((1 << 16) | id);
}
else if (id == 0)
{
items[index] = 0;
}
else
{
items[index] = (UInt32)((amount << 16) | id);
}
BitConverter.GetBytes(items[index]).CopyTo(Data, 0x20 + index*4);
}
public UInt32 EncKey
{
get { return BitConverter.ToUInt32(Data, 0x5C); }
set { BitConverter.GetBytes((UInt32)value).CopyTo(Data, 0x5C); }
}
public void reinit() //Call this to clean all data so legendaries can be received again. Must be used with the other classes reinit() for it to work
{
int i = 0;
for (i=0; i<Size;i++)
{
Data[i] = 0;
}
}
}
}
//3DS Link structure research by BlackShark: https://projectpokemon.org/forums/forums/topic/40323-white-2-dream-radar-flags/
/*
Save Offset 0x25E00
0x00 unknown (changes when the data is received)
0x04 legendary received flags
0x08 1 after DR data was received the first time, does not increase
Legendary received flags
Bit Pokemon
0 Tornadus
1 Thundurus
2 Landorus
3 Dialga
4 Palkia
5 Giratina
6 Ho-Oh
7 Lugia
======================================================================
Save Offset 0x7F000 (the Dream Radar itself only touches this area!)
0x00 received/not received flag (1 after the Pokemon were received)
0x01 - 0x03 0x000000
0x04 - 0x07 unknown (derived from offset 0x25E00) (0x00000000 if the Pokemon were not yet received)
0x08 - 0x0B always 0x43524746 (CRGF)
0x0C - 0x0F Encryption Key used for the next transfer from DR (0x00000000 if the Pokemon were not yet received) --> Also seems to hold the lengedary flags!
0x10 - 0x11 CRC-16-CCITT over 0x00 - 0x0F
0x12 - 0x13 0x0000
0x14 - 0x33 legendary Pokemon (see values below) (8 x 4 Bytes)
0x34 - 0x4B normal Pokemon (6 x 4 Bytes)
0x4C - 0x63 Items (6 x 4 Bytes)
0x63 - 0x8F probably unused (all zero)
0x90 - 0x93 Decryption Key
0x94 - 0x95 CRC-16-CCITT over 0x14 - 0x93
0x96 - 0x97 0x0000
Legendary Pokemon Values
0x80808080 Tornadus
0x92567284 Thundurus
0x87643567 Landorus
0x96436763 Dialga
0x43867368 Palkia
0x17693572 Giratina
0x44798367 Ho-Oh
0x96636983 Lugia
Pokemon Structure
0x00 Gender (0 - Male, 1 - Female, 2 - Genderless)
0x01 unknown/unused
0x02 - 0x03 Species ID
Item Structure
0x00 - 0x01 Quantity
0x02 - 0x03 Item ID
*/

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -172,7 +172,7 @@ namespace BW_tool
"69 - Key-related data",
"70 - Unknown (70d)",
"71 - Unknown",
"72 - Unknown",
"72 - 3DS Link related data",
"73 - Checksum Block (73d)"});
this.selectedblock.Location = new System.Drawing.Point(12, 12);
this.selectedblock.MaxDropDownItems = 10;

View File

@@ -62,8 +62,6 @@ namespace BW_tool
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.exit_but = new System.Windows.Forms.Button();
this.saveexit_but = new System.Windows.Forms.Button();
this.flag1box = new System.Windows.Forms.CheckBox();
this.flag2box = new System.Windows.Forms.CheckBox();
this.flag3box = new System.Windows.Forms.CheckBox();
@@ -76,6 +74,8 @@ namespace BW_tool
this.flag_hex = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.exit_but = new System.Windows.Forms.Button();
this.saveexit_but = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.day)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.month)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.year)).BeginInit();
@@ -415,26 +415,6 @@ namespace BW_tool
this.label3.TabIndex = 7;
this.label3.Text = "Year";
//
// exit_but
//
this.exit_but.Location = new System.Drawing.Point(178, 184);
this.exit_but.Name = "exit_but";
this.exit_but.Size = new System.Drawing.Size(97, 27);
this.exit_but.TabIndex = 8;
this.exit_but.Text = "Exit";
this.exit_but.UseVisualStyleBackColor = true;
this.exit_but.Click += new System.EventHandler(this.Exit_butClick);
//
// saveexit_but
//
this.saveexit_but.Location = new System.Drawing.Point(178, 217);
this.saveexit_but.Name = "saveexit_but";
this.saveexit_but.Size = new System.Drawing.Size(99, 29);
this.saveexit_but.TabIndex = 9;
this.saveexit_but.Text = "Save and Exit";
this.saveexit_but.UseVisualStyleBackColor = true;
this.saveexit_but.Click += new System.EventHandler(this.Saveexit_butClick);
//
// flag1box
//
this.flag1box.Location = new System.Drawing.Point(12, 67);
@@ -543,6 +523,26 @@ namespace BW_tool
this.label5.Text = "Flag hex:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// exit_but
//
this.exit_but.Location = new System.Drawing.Point(178, 184);
this.exit_but.Name = "exit_but";
this.exit_but.Size = new System.Drawing.Size(97, 27);
this.exit_but.TabIndex = 8;
this.exit_but.Text = "Exit";
this.exit_but.UseVisualStyleBackColor = true;
this.exit_but.Click += new System.EventHandler(this.Exit_butClick);
//
// saveexit_but
//
this.saveexit_but.Location = new System.Drawing.Point(178, 217);
this.saveexit_but.Name = "saveexit_but";
this.saveexit_but.Size = new System.Drawing.Size(99, 29);
this.saveexit_but.TabIndex = 9;
this.saveexit_but.Text = "Save and Exit";
this.saveexit_but.UseVisualStyleBackColor = true;
this.saveexit_but.Click += new System.EventHandler(this.Saveexit_butClick);
//
// Medals
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@@ -1230,8 +1230,747 @@ namespace BW_tool
"Fusion Flare",
"Fusion Bolt"
};
public static object[] itemlist = new object[] {
"None",
"Master Ball",
"Ultra Ball",
"Great Ball",
"Poké Ball",
"Safari Ball",
"Net Ball",
"Dive Ball",
"Nest Ball",
"Repeat Ball",
"Timer Ball",
"Luxury Ball",
"Premier Ball",
"Dusk Ball",
"Heal Ball",
"Quick Ball",
"Cherish Ball",
"Potion",
"Antidote",
"Burn Heal",
"Ice Heal",
"Awakening",
"Parlyz Heal",
"Full Restore",
"Max Potion",
"Hyper Potion",
"Super Potion",
"Full Heal",
"Revive",
"Max Revive",
"Fresh Water",
"Soda Pop",
"Lemonade",
"Moomoo Milk",
"EnergyPowder",
"Energy Root",
"Heal Powder",
"Revival Herb",
"Ether",
"Max Ether",
"Elixir",
"Max Elixir",
"Lava Cookie",
"Berry Juice",
"Sacred Ash",
"HP Up",
"Protein",
"Iron",
"Carbos",
"Calcium",
"Rare Candy",
"PP Up",
"Zinc",
"PP Max",
"Old Gateau",
"Guard Spec.",
"Dire Hit",
"X Attack",
"X Defend",
"X Speed",
"X Accuracy",
"X Special",
"X Sp. Def",
"Poké Doll",
"Fluffy Tail",
"Blue Flute",
"Yellow Flute",
"Red Flute",
"Black Flute",
"White Flute",
"Shoal Salt",
"Shoal Shell",
"Red Shard",
"Blue Shard",
"Yellow Shard",
"Green Shard",
"Super Repel",
"Max Repel",
"Escape Rope",
"Repel",
"Sun Stone",
"Moon Stone",
"Fire Stone",
"Thunder Stone",
"Water Stone",
"Leaf Stone",
"TinyMushroom",
"Big Mushroom",
"Pearl",
"Big Pearl",
"Stardust",
"Star Piece",
"Nugget",
"Heart Scale",
"Honey",
"Growth Mulch",
"Damp Mulch",
"Stable Mulch",
"Gooey Mulch",
"Root Fossil",
"Claw Fossil",
"Helix Fossil",
"Dome Fossil",
"Old Amber",
"Armor Fossil",
"Skull Fossil",
"Rare Bone",
"Shiny Stone",
"Dusk Stone",
"Dawn Stone",
"Oval Stone",
"Odd Keystone",
"Griseous Orb",
"unknown",
"unknown",
"unknown",
"Douse Drive",
"Shock Drive",
"Burn Drive",
"Chill Drive",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"unknown",
"Sweet Heart",
"Adamant Orb",
"Lustrous Orb",
"Greet Mail",
"Favored Mail",
"RSVP Mail",
"Thanks Mail",
"Inquiry Mail",
"Like Mail",
"Reply Mail",
"BridgeMail S",
"BridgeMail D",
"BridgeMail T",
"BridgeMail V",
"BridgeMail M",
"Cheri Berry",
"Chesto Berry",
"Pecha Berry",
"Rawst Berry",
"Aspear Berry",
"Leppa Berry",
"Oran Berry",
"Persim Berry",
"Lum Berry",
"Sitrus Berry",
"Figy Berry",
"Wiki Berry",
"Mago Berry",
"Aguav Berry",
"Iapapa Berry",
"Razz Berry",
"Bluk Berry",
"Nanab Berry",
"Wepear Berry",
"Pinap Berry",
"Pomeg Berry",
"Kelpsy Berry",
"Qualot Berry",
"Hondew Berry",
"Grepa Berry",
"Tamato Berry",
"Cornn Berry",
"Magost Berry",
"Rabuta Berry",
"Nomel Berry",
"Spelon Berry",
"Pamtre Berry",
"Watmel Berry",
"Durin Berry",
"Belue Berry",
"Occa Berry",
"Passho Berry",
"Wacan Berry",
"Rindo Berry",
"Yache Berry",
"Chople Berry",
"Kebia Berry",
"Shuca Berry",
"Coba Berry",
"Payapa Berry",
"Tanga Berry",
"Charti Berry",
"Kasib Berry",
"Haban Berry",
"Colbur Berry",
"Babiri Berry",
"Chilan Berry",
"Liechi Berry",
"Ganlon Berry",
"Salac Berry",
"Petaya Berry",
"Apicot Berry",
"Lansat Berry",
"Starf Berry",
"Enigma Berry",
"Micle Berry",
"Custap Berry",
"Jaboca Berry",
"Rowap Berry",
"BrightPowder",
"White Herb",
"Macho Brace",
"Exp. Share",
"Quick Claw",
"Soothe Bell",
"Mental Herb",
"Choice Band",
"King's Rock",
"SilverPowder",
"Amulet Coin",
"Cleanse Tag",
"Soul Dew",
"DeepSeaTooth",
"DeepSeaScale",
"Smoke Ball",
"Everstone",
"Focus Band",
"Lucky Egg",
"Scope Lens",
"Metal Coat",
"Leftovers",
"Dragon Scale",
"Light Ball",
"Soft Sand",
"Hard Stone",
"Miracle Seed",
"BlackGlasses",
"Black Belt",
"Magnet",
"Mystic Water",
"Sharp Beak",
"Poison Barb",
"NeverMeltIce",
"Spell Tag",
"TwistedSpoon",
"Charcoal",
"Dragon Fang",
"Silk Scarf",
"Up-Grade",
"Shell Bell",
"Sea Incense",
"Lax Incense",
"Lucky Punch",
"Metal Powder",
"Thick Club",
"Stick",
"Red Scarf",
"Blue Scarf",
"Pink Scarf",
"Green Scarf",
"Yellow Scarf",
"Wide Lens",
"Muscle Band",
"Wise Glasses",
"Expert Belt",
"Light Clay",
"Life Orb",
"Power Herb",
"Toxic Orb",
"Flame Orb",
"Quick Powder",
"Focus Sash",
"Zoom Lens",
"Metronome",
"Iron Ball",
"Lagging Tail",
"Destiny Knot",
"Black Sludge",
"Icy Rock",
"Smooth Rock",
"Heat Rock",
"Damp Rock",
"Grip Claw",
"Choice Scarf",
"Sticky Barb",
"Power Bracer",
"Power Belt",
"Power Lens",
"Power Band",
"Power Anklet",
"Power Weight",
"Shed Shell",
"Big Root",
"Choice Specs",
"Flame Plate",
"Splash Plate",
"Zap Plate",
"Meadow Plate",
"Icicle Plate",
"Fist Plate",
"Toxic Plate",
"Earth Plate",
"Sky Plate",
"Mind Plate",
"Insect Plate",
"Stone Plate",
"Spooky Plate",
"Draco Plate",
"Dread Plate",
"Iron Plate",
"Odd Incense",
"Rock Incense",
"Full Incense",
"Wave Incense",
"Rose Incense",
"Luck Incense",
"Pure Incense",
"Protector",
"Electirizer",
"Magmarizer",
"Dubious Disc",
"Reaper Cloth",
"Razor Claw",
"Razor Fang",
"TM01",
"TM02",
"TM03",
"TM04",
"TM05",
"TM06",
"TM07",
"TM08",
"TM09",
"TM10",
"TM11",
"TM12",
"TM13",
"TM14",
"TM15",
"TM16",
"TM17",
"TM18",
"TM19",
"TM20",
"TM21",
"TM22",
"TM23",
"TM24",
"TM25",
"TM26",
"TM27",
"TM28",
"TM29",
"TM30",
"TM31",
"TM32",
"TM33",
"TM34",
"TM35",
"TM36",
"TM37",
"TM38",
"TM39",
"TM40",
"TM41",
"TM42",
"TM43",
"TM44",
"TM45",
"TM46",
"TM47",
"TM48",
"TM49",
"TM50",
"TM51",
"TM52",
"TM53",
"TM54",
"TM55",
"TM56",
"TM57",
"TM58",
"TM59",
"TM60",
"TM61",
"TM62",
"TM63",
"TM64",
"TM65",
"TM66",
"TM67",
"TM68",
"TM69",
"TM70",
"TM71",
"TM72",
"TM73",
"TM74",
"TM75",
"TM76",
"TM77",
"TM78",
"TM79",
"TM80",
"TM81",
"TM82",
"TM83",
"TM84",
"TM85",
"TM86",
"TM87",
"TM88",
"TM89",
"TM90",
"TM91",
"TM92",
"HM01",
"HM02",
"HM03",
"HM04",
"HM05",
"HM06",
"unknown",
"unknown",
"Explorer Kit",
"Loot Sack",
"Rule Book",
"Poké Radar",
"Point Card",
"Journal",
"Seal Case",
"Fashion Case",
"Seal Bag",
"Pal Pad",
"Works Key",
"Old Charm",
"Galactic Key",
"Red Chain",
"Town Map",
"Vs. Seeker",
"Coin Case",
"Old Rod",
"Good Rod",
"Super Rod",
"Sprayduck",
"Poffin Case",
"Bicycle",
"Suite Key",
"Oak's Letter",
"Lunar Wing",
"Member Card",
"Azure Flute",
"S.S. Ticket",
"Contest Pass",
"Magma Stone",
"Parcel",
"Coupon 1",
"Coupon 2",
"Coupon 3",
"Storage Key",
"SecretPotion",
"Vs. Recorder",
"Gracidea",
"Secret Key",
"Apricorn Box",
"Unown Report",
"Berry Pots",
"Dowsing MCHN",
"Blue Card",
"SlowpokeTail",
"Clear Bell",
"Card Key",
"Basement Key",
"SquirtBottle",
"Red Scale",
"Lost Item",
"Pass",
"Machine Part",
"Silver Wing",
"Rainbow Wing",
"Mystery Egg",
"Red Apricorn",
"Ylw Apricorn",
"Blu Apricorn",
"Grn Apricorn",
"Pnk Apricorn",
"Wht Apricorn",
"Blk Apricorn",
"Fast Ball",
"Level Ball",
"Lure Ball",
"Heavy Ball",
"Love Ball",
"Friend Ball",
"Moon Ball",
"Sport Ball",
"Park Ball",
"Photo Album",
"GB Sounds",
"Tidal Bell",
"RageCandyBar",
"Data Card 01",
"Data Card 02",
"Data Card 03",
"Data Card 04",
"Data Card 05",
"Data Card 06",
"Data Card 07",
"Data Card 08",
"Data Card 09",
"Data Card 10",
"Data Card 11",
"Data Card 12",
"Data Card 13",
"Data Card 14",
"Data Card 15",
"Data Card 16",
"Data Card 17",
"Data Card 18",
"Data Card 19",
"Data Card 20",
"Data Card 21",
"Data Card 22",
"Data Card 23",
"Data Card 24",
"Data Card 25",
"Data Card 26",
"Data Card 27",
"Jade Orb",
"Lock Capsule",
"Red Orb",
"Blue Orb",
"Enigma Stone",
"Prism Scale",
"Eviolite",
"Float Stone",
"Rocky Helmet",
"Air Balloon",
"Red Card",
"Ring Target",
"Binding Band",
"Absorb Bulb",
"Cell Battery",
"Eject Button",
"Fire Gem",
"Water Gem",
"Electric Gem",
"Grass Gem",
"Ice Gem",
"Fighting Gem",
"Poison Gem",
"Ground Gem",
"Flying Gem",
"Psychic Gem",
"Bug Gem",
"Rock Gem",
"Ghost Gem",
"Dragon Gem",
"Dark Gem",
"Steel Gem",
"Normal Gem",
"Health Wing",
"Muscle Wing",
"Resist Wing",
"Genius Wing",
"Clever Wing",
"Swift Wing",
"Pretty Wing",
"Cover Fossil",
"Plume Fossil",
"Liberty Pass",
"Pass Orb",
"Dream Ball",
"Poké Toy",
"Prop Case",
"Dragon Skull",
"BalmMushroom",
"Big Nugget",
"Pearl String",
"Comet Shard",
"Relic Copper",
"Relic Silver",
"Relic Gold",
"Relic Vase",
"Relic Band",
"Relic Statue",
"Relic Crown",
"Casteliacone",
"Dire Hit 2",
"X Speed 2",
"X Special 2",
"X Sp. Def 2",
"X Defend 2",
"X Attack 2",
"X Accuracy 2",
"X Speed 3",
"X Special 3",
"X Sp. Def 3",
"X Defend 3",
"X Attack 3",
"X Accuracy 3",
"X Speed 6",
"X Special 6",
"X Sp. Def 6",
"X Defend 6",
"X Attack 6",
"X Accuracy 6",
"Ability Urge",
"Item Drop",
"Item Urge",
"Reset Urge",
"Dire Hit 3",
"Light Stone",
"Dark Stone",
"TM93",
"TM94",
"TM95",
"Xtransceiver (BW2 exclusive)",
"God Stone",
"Gram 1",
"Gram 2",
"Gram 3",
"Xtransceiver (BW2 exclusive)",
"Medal Box (BW2 exclusive)",
"DNA Splicers (BW2 exclusive)",
"DNA Splicers (BW2 exclusive)",
"Permit (BW2 exclusive)",
"Oval Charm (BW2 exclusive)",
"Shiny Charm (BW2 exclusive)",
"Plasma Card (BW2 exclusive)",
"Grubby Hanky (BW2 exclusive)",
"Colress MCHN (BW2 exclusive)",
"Dropped Item (BW2 exclusive)",
"Dropped Item (BW2 exclusive)",
"Reveal Glass (BW2 exclusive)"
};
public static object[] drpklist = new object[] {
"NONE",
"079 - Slowpoke",
"120 - Staryu",
"137 - Porygon",
"163 - Hoothoot",
"174 - Igglybuff",
"175 - Togepi",
"213 - Shuckle",
"238 - Smoochum",
"280 - Ralts",
"333 - Swablu",
"374 - Beldum",
"425 - Drifloon",
"436 - Bronzor",
"442 - Spiritomb",
"447 - Riolu",
"479 - Rotom",
"517 - Munna",
"561 - Sigilyph"
};
public static object[] dritemlist = new object[] {
"NONE",
"Red Shard",
"Blue Shard",
"Yellow Shard",
"Green Shard",
"PP Up",
"Leppa Berry",
"Revive",
"Max Revive",
"Sun Stone",
"Dawn Stone",
"Moon Stone",
"Fire Stone",
"Water Stone",
"Thunderstone",
"Leaf Stone",
"Star Piece",
"Heart Scale",
"Life Orb",
"Focus Sash",
"Eviolite",
"Sacred Ash",
"Rare Candy",
"King's Rock"
};
public void Text()
{
}
}
}
/*
079 - Slowpoke
120 - Staryu
137 - Porygon
163 - Hoothoot
174 - Igglybuff
175 - Togepi
213 - Shuckle
238 - Smoochum
280 - Ralts
333 - Swablu
374 - Beldum
425 - Drifloon
436 - Bronzor
442 - Spiritomb
447 - Riolu
479 - Rotom
517 - Munna
561 - Sigilyph
{0, 79, 120, 137, 163, 174, 175, 213, 238, 280, 333, 374, 425, 436, 442, 447, 479, 517, 531}
Red Shard
Blue Shard
Yellow Shard
Green Shard
PP Up
Leppa Berry
Revive
Max Revive
Sun Stone
Dawn Stone
Moon Stone
Fire Stone
Thunderstone
Water Stone
Leaf Stone
Star Piece
Heart Scale
Life Orb
Focus Sash
Eviolite
Sacred Ash
Rare Candy
King's Rock
{0, 72, 73, 74, 75, 51, 154, 28, 29, 80, 109, 81, 82, 83, 84, 85, 91, 93, 270, 275, 538, 44, 50, 221}
*/

View File

@@ -31,6 +31,7 @@ namespace BW_tool
private System.Windows.Forms.Button about;
private System.Windows.Forms.Button memory_but;
private System.Windows.Forms.Button dlc_but;
private System.Windows.Forms.Button dr_but;
/// <summary>
/// Disposes resources used by the form.
@@ -70,6 +71,7 @@ namespace BW_tool
this.about = new System.Windows.Forms.Button();
this.memory_but = new System.Windows.Forms.Button();
this.dlc_but = new System.Windows.Forms.Button();
this.dr_but = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// loadsave_but
@@ -250,12 +252,24 @@ namespace BW_tool
this.dlc_but.UseVisualStyleBackColor = true;
this.dlc_but.Click += new System.EventHandler(this.Dlc_butClick);
//
// dr_but
//
this.dr_but.Enabled = false;
this.dr_but.Location = new System.Drawing.Point(12, 194);
this.dr_but.Name = "dr_but";
this.dr_but.Size = new System.Drawing.Size(140, 23);
this.dr_but.TabIndex = 17;
this.dr_but.Text = "Dream Radar (3DS Link)";
this.dr_but.UseVisualStyleBackColor = true;
this.dr_but.Click += new System.EventHandler(this.Dr_butClick);
//
// MainForm
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(503, 239);
this.Controls.Add(this.dr_but);
this.Controls.Add(this.dlc_but);
this.Controls.Add(this.memory_but);
this.Controls.Add(this.about);

View File

@@ -91,6 +91,7 @@ namespace BW_tool
trainer_but.Enabled = true;
memory_but.Enabled = true;
dlc_but.Enabled = true;
dr_but.Enabled = true;
}
else if (save.BW)
{
@@ -109,6 +110,7 @@ namespace BW_tool
trainer_but.Enabled = true;
memory_but.Enabled = false;
dlc_but.Enabled = true;
dr_but.Enabled = false;
}
else versiontext.Text = "Invalid file";
@@ -129,6 +131,7 @@ namespace BW_tool
trainer_but.Enabled = false;
memory_but.Enabled = false;
dlc_but.Enabled = false;
dr_but.Enabled = false;
}
}
void Save_butClick(object sender, EventArgs e)
@@ -203,5 +206,10 @@ namespace BW_tool
Form dlc = new DLC();
dlc.ShowDialog();
}
void Dr_butClick(object sender, EventArgs e)
{
Form dr = new DreamRadar();
dr.ShowDialog();
}
}
}

View File

@@ -73,6 +73,22 @@ namespace BW_tool
return buffer_dec;
}
internal static byte[] cryptoXor32Array(byte[] encarray, int start_offset, int length, int key_offset)
// --------------------------------------------------
{
byte[] buffer_dec = (byte[])encarray.Clone();
UInt32 encKey = BitConverter.ToUInt32(encarray, key_offset);
int i = 0;
for (i= 0; i< length; i+=4)
{
BitConverter.GetBytes(BitConverter.ToUInt32(encarray, start_offset + i) ^ encKey).CopyTo(buffer_dec, i);
}
return buffer_dec;
}
// SAV Manipulation
/// <summary>Calculates the CRC16-CCITT checksum over an input byte array.</summary>
/// <param name="chunk">Input byte array</param>

View File

@@ -615,5 +615,48 @@ namespace BW_tool
;
}
}
public byte[] dslinkA_get()
{
if (B2W2 == true){
return getData(0x7F000, 0x12);
}else{
;
}
return null;
}
public void dslinkA_set(byte[] dslinkA)
{
if (B2W2 == true)
{
setData(dslinkA, 0x7F000);
//Fix checksum
ushort crc = ccitt16(dslinkA);
setData(BitConverter.GetBytes(crc), 0x7F010);
//Just to be sure this is set 0xFFFF (seems basically unused though)
Data[0x7F012] = 0xFF;
Data[0x7F013] = 0xFF;
}
}
public byte[] dslinkB_get()
{
if (B2W2 == true){
return getData(0x7F014, 0x80);
}else{
;
}
return null;
}
public void dslinkB_set(byte[] dslinkB)
{
if (B2W2 == true)
{
setData(dslinkB, 0x7F014);
//Fix checksum
ushort crc = ccitt16(dslinkB);
setData(BitConverter.GetBytes(crc), 0x7F094);
}
}
}
}