mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
Code cleanup
Seems like every time I go through the code I find more of my newb code.
This commit is contained in:
parent
bb951188a0
commit
5eaf603c3b
3 changed files with 97 additions and 128 deletions
67
Misc/PKX.cs
67
Misc/PKX.cs
|
@ -18,7 +18,7 @@ namespace PKHeX
|
|||
// Relies on Util for some common operations.
|
||||
|
||||
// Data
|
||||
public static uint LCRNG(uint seed)
|
||||
internal static uint LCRNG(uint seed)
|
||||
{
|
||||
uint a = 0x41C64E6D;
|
||||
uint c = 0x00006073;
|
||||
|
@ -26,7 +26,7 @@ namespace PKHeX
|
|||
seed = (seed * a + c) & 0xFFFFFFFF;
|
||||
return seed;
|
||||
}
|
||||
public static uint LCRNG(ref uint seed)
|
||||
internal static uint LCRNG(ref uint seed)
|
||||
{
|
||||
uint a = 0x41C64E6D;
|
||||
uint c = 0x00006073;
|
||||
|
@ -34,7 +34,7 @@ namespace PKHeX
|
|||
seed = (seed * a + c) & 0xFFFFFFFF;
|
||||
return seed;
|
||||
}
|
||||
public static DataTable ExpTable()
|
||||
internal static DataTable ExpTable()
|
||||
{
|
||||
DataTable table = new DataTable();
|
||||
table.Columns.Add("Level", typeof(byte));
|
||||
|
@ -147,13 +147,13 @@ namespace PKHeX
|
|||
table.Rows.Add(100, 1000000, 600000, 1640000, 1059860, 800000, 1250000);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
// Stat Fetching
|
||||
public static int getMovePP(int move, int ppup)
|
||||
internal static int getMovePP(int move, int ppup)
|
||||
{
|
||||
return (getBasePP(move) * (5 + ppup) / 5);
|
||||
}
|
||||
public static int getBasePP(int move)
|
||||
internal static int getBasePP(int move)
|
||||
{
|
||||
byte[] movepptable =
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ namespace PKHeX
|
|||
if (move < 0) { move = 0; }
|
||||
return (byte)movepptable[move];
|
||||
}
|
||||
public static byte[] getRandomEVs()
|
||||
internal static byte[] getRandomEVs()
|
||||
{
|
||||
byte[] evs = new byte[6] { 0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xBE, }; // ha ha, just to start off above 510!
|
||||
|
||||
|
@ -210,11 +210,11 @@ namespace PKHeX
|
|||
Util.Shuffle(evs);
|
||||
return evs;
|
||||
}
|
||||
public static byte getBaseFriendship(int species)
|
||||
internal static byte getBaseFriendship(int species)
|
||||
{
|
||||
return PersonalGetter.GetPersonal(species).BaseFriendship;
|
||||
}
|
||||
public static int getLevel(int species, ref uint exp)
|
||||
internal static int getLevel(int species, ref uint exp)
|
||||
{
|
||||
if (exp == 0) { return 1; }
|
||||
|
||||
|
@ -235,13 +235,13 @@ namespace PKHeX
|
|||
}
|
||||
return --tl;
|
||||
}
|
||||
public static bool getIsShiny(uint PID, uint TID, uint SID)
|
||||
internal static bool getIsShiny(uint PID, uint TID, uint SID)
|
||||
{
|
||||
uint PSV = getPSV(PID);
|
||||
uint TSV = getTSV(TID, SID);
|
||||
return (TSV == PSV);
|
||||
}
|
||||
public static uint getEXP(int level, int species)
|
||||
internal static uint getEXP(int level, int species)
|
||||
{
|
||||
// Fetch Growth
|
||||
if ((level == 0) || (level == 1))
|
||||
|
@ -254,11 +254,11 @@ namespace PKHeX
|
|||
uint exp = (uint)PKX.ExpTable().Rows[level][growth + 1];
|
||||
return exp;
|
||||
}
|
||||
public static byte[] getAbilities(int species, int formnum)
|
||||
internal static byte[] getAbilities(int species, int formnum)
|
||||
{
|
||||
return PersonalGetter.GetPersonal(species, formnum).Abilities;
|
||||
}
|
||||
public static int getGender(string s)
|
||||
internal static int getGender(string s)
|
||||
{
|
||||
if (s == "♂" || s == "M")
|
||||
return 0;
|
||||
|
@ -266,7 +266,7 @@ namespace PKHeX
|
|||
return 1;
|
||||
else return 2;
|
||||
}
|
||||
public static string[] getCountryRegionText(int country, int region, string lang)
|
||||
internal static string[] getCountryRegionText(int country, int region, string lang)
|
||||
{
|
||||
// Get Language we're fetching for
|
||||
int index = Array.IndexOf(new string[] { "ja", "en", "fr", "de", "it", "es", "zh", "ko", }, lang);
|
||||
|
@ -326,7 +326,7 @@ namespace PKHeX
|
|||
catch { data[1] = "Illegal"; }
|
||||
return data;
|
||||
}
|
||||
public static string getLocation(bool eggmet, int gameorigin, int locval)
|
||||
internal static string getLocation(bool eggmet, int gameorigin, int locval)
|
||||
{
|
||||
string loctext = "";
|
||||
if (gameorigin < 13 && gameorigin > 6 && eggmet)
|
||||
|
@ -340,7 +340,7 @@ namespace PKHeX
|
|||
}
|
||||
else if (gameorigin < 24)
|
||||
{
|
||||
if (locval < 30000)
|
||||
if (locval < 30000)
|
||||
loctext = Form1.metBW2_00000[locval];
|
||||
else if (locval < 40000)
|
||||
loctext = Form1.metBW2_30000[locval % 10000 - 1];
|
||||
|
@ -362,7 +362,7 @@ namespace PKHeX
|
|||
}
|
||||
return loctext;
|
||||
}
|
||||
public static ushort[] getStats(int species, int level, int nature, int form,
|
||||
internal static ushort[] getStats(int species, int level, int nature, int form,
|
||||
int HP_EV, int ATK_EV, int DEF_EV, int SPA_EV, int SPD_EV, int SPE_EV,
|
||||
int HP_IV, int ATK_IV, int DEF_IV, int SPA_IV, int SPD_IV, int SPE_IV)
|
||||
{
|
||||
|
@ -397,7 +397,7 @@ namespace PKHeX
|
|||
}
|
||||
|
||||
// Manipulation
|
||||
public static byte[] shuffleArray(byte[] pkx, uint sv)
|
||||
internal static byte[] shuffleArray(byte[] pkx, uint sv)
|
||||
{
|
||||
byte[] ekx = new byte[260];
|
||||
Array.Copy(pkx, ekx, 8);
|
||||
|
@ -423,7 +423,7 @@ namespace PKHeX
|
|||
|
||||
return ekx;
|
||||
}
|
||||
public static byte[] decryptArray(byte[] ekx)
|
||||
internal static byte[] decryptArray(byte[] ekx)
|
||||
{
|
||||
byte[] pkx = (byte[])ekx.Clone();
|
||||
|
||||
|
@ -447,7 +447,7 @@ namespace PKHeX
|
|||
|
||||
return pkx;
|
||||
}
|
||||
public static byte[] encryptArray(byte[] pkx)
|
||||
internal static byte[] encryptArray(byte[] pkx)
|
||||
{
|
||||
// Shuffle
|
||||
uint pv = BitConverter.ToUInt32(pkx, 0);
|
||||
|
@ -474,7 +474,7 @@ namespace PKHeX
|
|||
// Done
|
||||
return ekx;
|
||||
}
|
||||
public static ushort getCHK(byte[] data)
|
||||
internal static ushort getCHK(byte[] data)
|
||||
{
|
||||
ushort chk = 0;
|
||||
for (int i = 8; i < 232; i += 2) // Loop through the entire PKX
|
||||
|
@ -482,7 +482,7 @@ namespace PKHeX
|
|||
|
||||
return chk;
|
||||
}
|
||||
public static bool verifychk(byte[] input)
|
||||
internal static bool verifychk(byte[] input)
|
||||
{
|
||||
ushort checksum = 0;
|
||||
if (input.Length == 100 || input.Length == 80) // Gen 3 Files
|
||||
|
@ -495,9 +495,9 @@ namespace PKHeX
|
|||
else
|
||||
{
|
||||
if (input.Length == 236 || input.Length == 220 || input.Length == 136) // Gen 4/5
|
||||
Array.Resize(ref input, 136);
|
||||
Array.Resize(ref input, 136);
|
||||
else if (input.Length == 232 || input.Length == 260) // Gen 6
|
||||
Array.Resize(ref input, 232);
|
||||
Array.Resize(ref input, 232);
|
||||
else throw new Exception("Wrong sized input array to verifychecksum");
|
||||
|
||||
ushort chk = 0;
|
||||
|
@ -507,15 +507,15 @@ namespace PKHeX
|
|||
return (chk == BitConverter.ToUInt16(input, 0x6));
|
||||
}
|
||||
}
|
||||
public static uint getPSV(uint PID)
|
||||
internal static uint getPSV(uint PID)
|
||||
{
|
||||
return Convert.ToUInt16(((PID >> 16) ^ (PID & 0xFFFF)) >> 4);
|
||||
}
|
||||
public static uint getTSV(uint TID, uint SID)
|
||||
internal static uint getTSV(uint TID, uint SID)
|
||||
{
|
||||
return ((TID ^ SID) >> 4);
|
||||
}
|
||||
public static uint getRandomPID(int species, int cg)
|
||||
internal static uint getRandomPID(int species, int cg)
|
||||
{
|
||||
PersonalParser.Personal MonData = PersonalGetter.GetPersonal(species);
|
||||
int gt = MonData.GenderRatio;
|
||||
|
@ -553,7 +553,7 @@ namespace PKHeX
|
|||
slot,
|
||||
mnicknamestr, mgenderstring, mnotOT, mot, mSpeciesName, mNatureName, mHPName, mAbilityName,
|
||||
mMove1N, mMove2N, mMove3N, mMove4N, mhelditemN,
|
||||
mRMove1N, mRMove2N, mRMove3N, mRMove4N,
|
||||
mRMove1N, mRMove2N, mRMove3N, mRMove4N,
|
||||
mMetLocN, mEggLocN,
|
||||
mcountryID, mregionID, mGameN, mBallN, mdsregIDN, motlangN;
|
||||
|
||||
|
@ -566,7 +566,7 @@ namespace PKHeX
|
|||
|
||||
private ushort
|
||||
mhelditem, mspecies, mTID, mSID, mTSV, mESV,
|
||||
mmove1, mmove2, mmove3, mmove4,
|
||||
mmove1, mmove2, mmove3, mmove4,
|
||||
mmove1_pp, mmove2_pp, mmove3_pp, mmove4_pp,
|
||||
mmove1_ppu, mmove2_ppu, mmove3_ppu, mmove4_ppu,
|
||||
meggmove1, meggmove2, meggmove3, meggmove4,
|
||||
|
@ -774,7 +774,7 @@ namespace PKHeX
|
|||
mgenderstring = "♂";
|
||||
else if (mgenderflag == 1)
|
||||
mgenderstring = "♀";
|
||||
else
|
||||
else
|
||||
mgenderstring = "-";
|
||||
|
||||
mhptype = (15 * ((mHP_IV & 1) + 2 * (mATK_IV & 1) + 4 * (mDEF_IV & 1) + 8 * (mSPE_IV & 1) + 16 * (mSPA_IV & 1) + 32 * (mSPD_IV & 1))) / 63 + 1;
|
||||
|
@ -863,7 +863,7 @@ namespace PKHeX
|
|||
{
|
||||
public uint EC;
|
||||
public ushort Checksum, Sanity;
|
||||
|
||||
|
||||
public uint PID, Experience;
|
||||
public ushort Species, HeldItem, TID, SID;
|
||||
public byte Ability, AbilityNumber, Nature, Gender, Form;
|
||||
|
@ -1151,7 +1151,7 @@ namespace PKHeX
|
|||
{
|
||||
byte[] fontData = Properties.Resources.PGLDings_NormalRegular;
|
||||
IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData.Length);
|
||||
System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length);
|
||||
System.Runtime.InteropServices.Marshal.Copy(fontData, 0, fontPtr, fontData.Length);
|
||||
PrivateFontCollection fonts = new PrivateFontCollection();
|
||||
try
|
||||
{
|
||||
|
@ -1197,7 +1197,6 @@ namespace PKHeX
|
|||
data.FormPointer = MonData[0xD];
|
||||
return data;
|
||||
}
|
||||
|
||||
internal Personal GetPersonal(int species, int formID)
|
||||
{
|
||||
Personal data = GetPersonal(species);
|
||||
|
@ -1210,4 +1209,4 @@ namespace PKHeX
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
77
Misc/Util.cs
77
Misc/Util.cs
|
@ -200,15 +200,15 @@ namespace PKHeX
|
|||
|
||||
// Data Retrieval
|
||||
internal static int ToInt32(TextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToInt32(value);
|
||||
}
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToInt32(value);
|
||||
}
|
||||
internal static uint ToUInt32(TextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToUInt32(value);
|
||||
}
|
||||
{
|
||||
string value = tb.Text;
|
||||
return ToUInt32(value);
|
||||
}
|
||||
internal static int ToInt32(MaskedTextBox tb)
|
||||
{
|
||||
string value = tb.Text;
|
||||
|
@ -222,12 +222,12 @@ namespace PKHeX
|
|||
internal static int ToInt32(String value)
|
||||
{
|
||||
value = value.Replace(" ", "");
|
||||
if (String.IsNullOrEmpty(value))
|
||||
return 0;
|
||||
if (String.IsNullOrEmpty(value))
|
||||
return 0;
|
||||
try
|
||||
{
|
||||
value = value.TrimEnd(new char[]{'_'});
|
||||
return Int32.Parse(value);
|
||||
{
|
||||
value = value.TrimEnd(new char[] { '_' });
|
||||
return Int32.Parse(value);
|
||||
}
|
||||
catch { return 0; }
|
||||
}
|
||||
|
@ -235,10 +235,10 @@ namespace PKHeX
|
|||
{
|
||||
value = value.Replace(" ", "");
|
||||
if (String.IsNullOrEmpty(value))
|
||||
return 0;
|
||||
return 0;
|
||||
try
|
||||
{
|
||||
value = value.TrimEnd(new char[]{'_'});
|
||||
value = value.TrimEnd(new char[] { '_' });
|
||||
return UInt32.Parse(value);
|
||||
}
|
||||
catch { return 0; }
|
||||
|
@ -253,11 +253,11 @@ namespace PKHeX
|
|||
internal static int getIndex(ComboBox cb)
|
||||
{
|
||||
int val = 0;
|
||||
if (cb.SelectedValue == null)
|
||||
return 0;
|
||||
if (cb.SelectedValue == null)
|
||||
return 0;
|
||||
|
||||
try
|
||||
{ val = Util.ToInt32(cb.SelectedValue.ToString()); }
|
||||
{ val = (int)cb.SelectedValue; }
|
||||
catch
|
||||
{ val = cb.SelectedIndex; if (val < 0) val = 0; }
|
||||
return val;
|
||||
|
@ -274,7 +274,7 @@ namespace PKHeX
|
|||
c = str[i];
|
||||
// filter for hex
|
||||
if ((c < 0x0047 && c > 0x002F) || (c < 0x0067 && c > 0x0060))
|
||||
s+= c;
|
||||
s += c;
|
||||
else
|
||||
System.Media.SystemSounds.Beep.Play();
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ namespace PKHeX
|
|||
stringdata[itemsToRename] = rawlist[j]; // Add the entry to process later.
|
||||
itemsToRename++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return; // Not Found
|
||||
|
@ -356,23 +356,23 @@ namespace PKHeX
|
|||
string text = SplitString[1]; // Text to set Control.Text to...
|
||||
Control[] controllist = Controls.Find(ctrl, true);
|
||||
if (controllist.Length == 0) // If Control isn't found...
|
||||
try
|
||||
{
|
||||
// Menu Items can't be found with Controls.Find as they aren't Controls
|
||||
ToolStripDropDownItem TSI = (ToolStripDropDownItem)menu.Items[ctrl];
|
||||
if (TSI != null)
|
||||
try
|
||||
{
|
||||
// We'll rename the main and child in a row.
|
||||
string[] ToolItems = Regex.Split(SplitString[1], " ; ");
|
||||
TSI.Text = ToolItems[0]; // Set parent's text first
|
||||
if (TSI.DropDownItems.Count != ToolItems.Length - 1)
|
||||
continue; // Error in Input, errhandled
|
||||
for (int ti = 1; ti <= TSI.DropDownItems.Count; ti++)
|
||||
TSI.DropDownItems[ti - 1].Text = ToolItems[ti]; // Set child text
|
||||
// Menu Items can't be found with Controls.Find as they aren't Controls
|
||||
ToolStripDropDownItem TSI = (ToolStripDropDownItem)menu.Items[ctrl];
|
||||
if (TSI != null)
|
||||
{
|
||||
// We'll rename the main and child in a row.
|
||||
string[] ToolItems = Regex.Split(SplitString[1], " ; ");
|
||||
TSI.Text = ToolItems[0]; // Set parent's text first
|
||||
if (TSI.DropDownItems.Count != ToolItems.Length - 1)
|
||||
continue; // Error in Input, errhandled
|
||||
for (int ti = 1; ti <= TSI.DropDownItems.Count; ti++)
|
||||
TSI.DropDownItems[ti - 1].Text = ToolItems[ti]; // Set child text
|
||||
}
|
||||
// If not found, it is not something to rename and is thus skipped.
|
||||
}
|
||||
// If not found, it is not something to rename and is thus skipped.
|
||||
}
|
||||
catch { }
|
||||
catch { }
|
||||
else // Set the input control's text.
|
||||
controllist[0].Text = text;
|
||||
}
|
||||
|
@ -403,11 +403,6 @@ namespace PKHeX
|
|||
{
|
||||
public string Text { get; set; }
|
||||
public object Value { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Text;
|
||||
}
|
||||
}
|
||||
internal static List<cbItem> getCBList(string textfile, string lang)
|
||||
{
|
||||
|
@ -554,4 +549,4 @@ namespace PKHeX
|
|||
return cbList;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -177,14 +177,12 @@ namespace PKHeX
|
|||
}
|
||||
|
||||
#region Global Variables: Always Visible!
|
||||
public byte[] buff = new byte[260];
|
||||
public byte[] buff = new byte[260]; // Tab Pokemon Data Storage
|
||||
public byte[] savefile = new byte[0x100000];
|
||||
public byte[] cyberSAV = new byte[0x65600];
|
||||
public bool savegame_oras = false;
|
||||
public bool cybergadget = false;
|
||||
public bool savLoaded = false;
|
||||
public int gt = 258;
|
||||
public int genderflag, species;
|
||||
public int savindex;
|
||||
public bool savedited;
|
||||
public string SDFLoc = null;
|
||||
|
@ -888,7 +886,7 @@ namespace PKHeX
|
|||
uint PID = BitConverter.ToUInt32(buff, 0x18);
|
||||
int nature = buff[0x1C];
|
||||
int feflag = buff[0x1D] % 2;
|
||||
this.genderflag = (buff[0x1D] >> 1) & 0x3;
|
||||
int genderflag = (buff[0x1D] >> 1) & 0x3;
|
||||
int altforms = (buff[0x1D] >> 3);
|
||||
int HP_EV = buff[0x1E];
|
||||
int ATK_EV = buff[0x1F];
|
||||
|
@ -1116,8 +1114,7 @@ namespace PKHeX
|
|||
// Load Extrabyte Value
|
||||
TB_ExtraByte.Text = buff[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
|
||||
|
||||
// Reload Gender Flag
|
||||
this.genderflag = ((buff[0x1D] >> 1) & 0x3);
|
||||
// Load Gender Flag
|
||||
Label_Gender.Text = gendersymbols[genderflag];
|
||||
updateStats();
|
||||
setIsShiny();
|
||||
|
@ -1516,9 +1513,8 @@ namespace PKHeX
|
|||
private void clickGender(object sender, EventArgs e)
|
||||
{
|
||||
// Get Gender Threshold
|
||||
species = Util.getIndex(CB_Species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species);
|
||||
gt = MonData.GenderRatio;
|
||||
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
|
||||
return;
|
||||
|
@ -1920,7 +1916,8 @@ namespace PKHeX
|
|||
// Get Gender Threshold
|
||||
species = Util.getIndex(CB_Species);
|
||||
PKX.PersonalParser.Personal MonData = PKX.PersonalGetter.GetPersonal(species);
|
||||
gt = MonData.GenderRatio;
|
||||
int gt = MonData.GenderRatio;
|
||||
int genderflag;
|
||||
|
||||
if (gt == 255) // Genderless
|
||||
genderflag = 2;
|
||||
|
@ -2207,7 +2204,7 @@ namespace PKHeX
|
|||
private void updateStats()
|
||||
{
|
||||
// Gather the needed information.
|
||||
species = Util.getIndex(CB_Species);
|
||||
int species = Util.getIndex(CB_Species);
|
||||
int level = Util.ToInt32((MT_Level.Enabled) ? MT_Level.Text : TB_Level.Text);
|
||||
if (level == 0) { level = 1; }
|
||||
int form = CB_Form.SelectedIndex;
|
||||
|
@ -2621,10 +2618,7 @@ namespace PKHeX
|
|||
// Dragout Display
|
||||
private void dragoutHover(object sender, EventArgs e)
|
||||
{
|
||||
if (Util.getIndex(CB_Species) > 0)
|
||||
dragout.BackgroundImage = Properties.Resources.slotSet;
|
||||
else
|
||||
dragout.BackgroundImage = Properties.Resources.slotDel;
|
||||
dragout.BackgroundImage = (Util.getIndex(CB_Species) > 0) ? Properties.Resources.slotSet : Properties.Resources.slotDel;
|
||||
}
|
||||
private void dragoutLeave(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -2642,7 +2636,7 @@ namespace PKHeX
|
|||
{
|
||||
if (savedited)
|
||||
{
|
||||
RTB_S.Text = "Save has been edited. Cannot integrity check.";
|
||||
Util.Alert("Save has been edited. Cannot integrity check.");
|
||||
return;
|
||||
}
|
||||
// Verify Checksums
|
||||
|
@ -3236,15 +3230,11 @@ namespace PKHeX
|
|||
// Box/SAV Functions //
|
||||
private void clickBoxRight(object sender, EventArgs e)
|
||||
{
|
||||
if (C_BoxSelect.SelectedIndex < 30)
|
||||
C_BoxSelect.SelectedIndex++;
|
||||
else C_BoxSelect.SelectedIndex = 0;
|
||||
C_BoxSelect.SelectedIndex = (C_BoxSelect.SelectedIndex + 1) % 31;
|
||||
}
|
||||
private void clickBoxLeft(object sender, EventArgs e)
|
||||
{
|
||||
if (C_BoxSelect.SelectedIndex > 0)
|
||||
C_BoxSelect.SelectedIndex--;
|
||||
else C_BoxSelect.SelectedIndex = 30;
|
||||
C_BoxSelect.SelectedIndex = (C_BoxSelect.SelectedIndex + 30) % 31;
|
||||
}
|
||||
private void clickSlot(object sender, EventArgs e)
|
||||
{
|
||||
|
@ -3562,24 +3552,15 @@ namespace PKHeX
|
|||
dcpkx1, dcpkx2, gtspkx, fusedpkx,subepkx1,subepkx2,subepkx3,
|
||||
};
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
int offset = boxoffset + 0xE8 * i;
|
||||
getSlotFiller(offset, pba[i]);
|
||||
}
|
||||
getSlotFiller(boxoffset + 0xE8 * i, pba[i]);
|
||||
|
||||
// Reload Party
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
int offset = SaveGame.Party + (0x7F000 * savindex) + 0x104 * i;
|
||||
getSlotFiller(offset, pba[i + 30]);
|
||||
}
|
||||
getSlotFiller(SaveGame.Party + (0x7F000 * savindex) + 0x104 * i, pba[i + 30]);
|
||||
|
||||
// Reload Battle Box
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
int offset = SaveGame.BattleBox + (0x7F000 * savindex) + 0xE8 * i;
|
||||
getSlotFiller(offset, pba[i + 36]);
|
||||
}
|
||||
getSlotFiller(SaveGame.BattleBox + (0x7F000 * savindex) + 0xE8 * i, pba[i + 36]);
|
||||
|
||||
// Reload Daycare
|
||||
Label[] dclabela = { L_DC1, L_DC2, };
|
||||
|
@ -3587,8 +3568,7 @@ namespace PKHeX
|
|||
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
int offset = SaveGame.Daycare + (0x7F000 * savindex) + 0xE8 * i + 8 * (i + 1);
|
||||
getSlotFiller(offset, pba[i + 42]);
|
||||
getSlotFiller(SaveGame.Daycare + (0x7F000 * savindex) + 0xE8 * i + 8 * (i + 1), pba[i + 42]);
|
||||
dctexta[i].Text = BitConverter.ToUInt32(savefile, SaveGame.Daycare + (0x7F000 * savindex) + 0xF0 * i + 4).ToString();
|
||||
if (Convert.ToBoolean(savefile[SaveGame.Daycare + (0x7F000 * savindex) + 0xF0 * i])) // If Occupied
|
||||
dclabela[i].Text = (i + 1) + ": ✓";
|
||||
|
@ -4185,7 +4165,7 @@ namespace PKHeX
|
|||
private void B_OUTPasserby_Click(object sender, EventArgs e)
|
||||
{
|
||||
string result = "";
|
||||
result += "PSS List" + Environment.NewLine + Environment.NewLine;
|
||||
result += "PSS List" + Environment.NewLine;
|
||||
string[] headers = {
|
||||
"PSS Data - Friends",
|
||||
"PSS Data - Acquaintances",
|
||||
|
@ -4194,14 +4174,18 @@ namespace PKHeX
|
|||
int offset = savindex * 0x7F000 + SaveGame.PSS;
|
||||
for (int g = 0; g < 3; g++)
|
||||
{
|
||||
result += "----" + Environment.NewLine + headers[g] + Environment.NewLine + "----" + Environment.NewLine + Environment.NewLine;
|
||||
result += Environment.NewLine
|
||||
+ "----" + Environment.NewLine
|
||||
+ headers[g] + Environment.NewLine
|
||||
+ "----" + Environment.NewLine;
|
||||
uint count = BitConverter.ToUInt32(savefile, offset + 0x4E20);
|
||||
int r_offset = offset;
|
||||
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
ulong unkn = BitConverter.ToUInt64(savefile, r_offset);
|
||||
if (unkn == 0) break;
|
||||
if (unkn == 0) break; // No data present here
|
||||
if (i > 0) result += Environment.NewLine + Environment.NewLine;
|
||||
|
||||
string otname = Util.TrimFromZero(Encoding.Unicode.GetString(savefile, r_offset + 8, 0x1A));
|
||||
string message = Util.TrimFromZero(Encoding.Unicode.GetString(savefile, r_offset + 0x22, 0x22));
|
||||
|
@ -4217,16 +4201,8 @@ namespace PKHeX
|
|||
byte game = savefile[r_offset + 0x5A];
|
||||
ulong outfit = BitConverter.ToUInt64(savefile, r_offset + 0x5C);
|
||||
int favpkm = BitConverter.ToUInt16(savefile, r_offset + 0x9C) & 0x7FF;
|
||||
string gamename;
|
||||
if (game == 24)
|
||||
gamename = "X";
|
||||
else if (game == 25)
|
||||
gamename = "Y";
|
||||
else if (game == 26)
|
||||
gamename = "AS";
|
||||
else if (game == 27)
|
||||
gamename = "OR";
|
||||
else gamename = "UNK GAME";
|
||||
string gamename = "UNKNOWN GAME";
|
||||
try { gamename = gamelist[game]; } catch { }
|
||||
|
||||
string[] cr = PKX.getCountryRegionText(country, region, curlanguage);
|
||||
result +=
|
||||
|
@ -4235,12 +4211,11 @@ namespace PKHeX
|
|||
"Game: " + gamename + Environment.NewLine +
|
||||
"Country: " + cr[0] + Environment.NewLine +
|
||||
"Region: " + cr[1] + Environment.NewLine +
|
||||
"Favorite: " + specieslist[favpkm] + Environment.NewLine;
|
||||
"Favorite: " + specieslist[favpkm];
|
||||
|
||||
result += Environment.NewLine;
|
||||
r_offset += 0xC8;
|
||||
r_offset += 0xC8; // Advance to next entry
|
||||
}
|
||||
offset += 0x5000;
|
||||
offset += 0x5000; // Advance to next block
|
||||
}
|
||||
RTB_T.Text = result;
|
||||
RTB_T.Font = new Font("Courier New", 8);
|
||||
|
|
Loading…
Reference in a new issue