mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-07-29 06:09:13 -05:00
Refactoring
No functional changes
This commit is contained in:
parent
2c523dcd97
commit
2c233be43f
|
|
@ -8,8 +8,8 @@ public static partial class Legal
|
|||
// PKHeX master Wonder Card Database
|
||||
internal static WC6[] WC6DB;
|
||||
// PKHeX master personal.dat
|
||||
internal static readonly PersonalInfo[] PersonalAO = PersonalInfo.getPersonalArray(Properties.Resources.personal_ao, PersonalInfo.SizeAO);
|
||||
private static readonly PersonalInfo[] PersonalXY = PersonalInfo.getPersonalArray(Properties.Resources.personal_xy, PersonalInfo.SizeXY);
|
||||
internal static readonly PersonalInfo[] PersonalAO = PersonalInfo.getArray(Properties.Resources.personal_ao, PersonalInfo.SizeAO);
|
||||
private static readonly PersonalInfo[] PersonalXY = PersonalInfo.getArray(Properties.Resources.personal_xy, PersonalInfo.SizeXY);
|
||||
private static readonly EggMoves[] EggMoveXY = EggMoves.getArray(Data.unpackMini(Properties.Resources.eggmove_xy, "xy"));
|
||||
private static readonly Learnset[] LevelUpXY = Learnset.getArray(Data.unpackMini(Properties.Resources.lvlmove_xy, "xy"));
|
||||
private static readonly EggMoves[] EggMoveAO = EggMoves.getArray(Data.unpackMini(Properties.Resources.eggmove_ao, "ao"));
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ public int RandomGender
|
|||
}
|
||||
public bool HasFormes => FormeCount > 1;
|
||||
|
||||
internal static PersonalInfo[] getPersonalArray(byte[] data, int size)
|
||||
internal static PersonalInfo[] getArray(byte[] data, int size)
|
||||
{
|
||||
PersonalInfo[] d = new PersonalInfo[data.Length / size];
|
||||
for (int i = 0; i < d.Length; i++)
|
||||
|
|
|
|||
21
Misc/PKX.cs
21
Misc/PKX.cs
|
|
@ -556,20 +556,23 @@ internal static uint getRandomPID(int species, int cg, int origin, int nature, i
|
|||
|
||||
// SAV Manipulation
|
||||
/// <summary>Calculates the CRC16-CCITT checksum over an input byte array.</summary>
|
||||
/// <param name="chunk">Input byte array</param>
|
||||
/// <param name="data">Input byte array</param>
|
||||
/// <returns>Checksum</returns>
|
||||
internal static ushort ccitt16(byte[] chunk)
|
||||
internal static ushort ccitt16(byte[] data)
|
||||
{
|
||||
ushort crc = 0xFFFF;
|
||||
foreach (byte t in chunk)
|
||||
const ushort init = 0xFFFF;
|
||||
const ushort poly = 0x1021;
|
||||
|
||||
ushort crc = init;
|
||||
foreach (byte b in data)
|
||||
{
|
||||
crc ^= (ushort)(t << 8);
|
||||
crc ^= (ushort)(b << 8);
|
||||
for (int j = 0; j < 8; j++)
|
||||
{
|
||||
if ((crc & 0x8000) > 0)
|
||||
crc = (ushort)(crc << 1 ^ 0x1021);
|
||||
else
|
||||
crc <<= 1;
|
||||
bool flag = (crc & 0x8000) > 0;
|
||||
crc <<= 1;
|
||||
if (flag)
|
||||
crc ^= poly;
|
||||
}
|
||||
}
|
||||
return crc;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user