mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 14:00:21 +00:00
Set dex on import
This commit is contained in:
parent
79b80e789a
commit
c0df638c53
1 changed files with 8 additions and 8 deletions
|
@ -7692,7 +7692,7 @@ namespace PKHeX
|
||||||
byte[] pkxdata = preparepkx(buff);
|
byte[] pkxdata = preparepkx(buff);
|
||||||
byte[] ekxdata = encryptArray(pkxdata);
|
byte[] ekxdata = encryptArray(pkxdata);
|
||||||
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
||||||
fixParty();
|
setParty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7700,16 +7700,15 @@ namespace PKHeX
|
||||||
byte[] ekxdata = encryptArray(pkxdata);
|
byte[] ekxdata = encryptArray(pkxdata);
|
||||||
Array.Copy(ekxdata, 0, savefile, offset, 0xE8);
|
Array.Copy(ekxdata, 0, savefile, offset, 0xE8);
|
||||||
}
|
}
|
||||||
fixPokedex();
|
setPokedex(preparepkx(buff));
|
||||||
getPKXBoxes();
|
getPKXBoxes();
|
||||||
savedited = true;
|
savedited = true;
|
||||||
|
|
||||||
getSlotColor(slot, Properties.Resources.slotSet);
|
getSlotColor(slot, Properties.Resources.slotSet);
|
||||||
}
|
}
|
||||||
private void fixPokedex()
|
private void setPokedex(byte[] pkxdata)
|
||||||
{
|
{
|
||||||
if (savindex > 1) return;
|
if (savindex > 1) return;
|
||||||
byte[] pkxdata = preparepkx(buff);
|
|
||||||
int species = BitConverter.ToUInt16(pkxdata, 0x8); // Species
|
int species = BitConverter.ToUInt16(pkxdata, 0x8); // Species
|
||||||
int lang = pkxdata[0xE3] - 1; if (lang > 5) lang--; // 0-6 language vals
|
int lang = pkxdata[0xE3] - 1; if (lang > 5) lang--; // 0-6 language vals
|
||||||
int origin = pkxdata[0xDF]; // Native / Non Native
|
int origin = pkxdata[0xDF]; // Native / Non Native
|
||||||
|
@ -7740,7 +7739,7 @@ namespace PKHeX
|
||||||
savefile[0x1A7C8 + 0x7F000 * savindex + ((species - 1) * 7 + lang) / 8] |= (byte)(1 << ((((species - 1) * 7) + lang) % 8));
|
savefile[0x1A7C8 + 0x7F000 * savindex + ((species - 1) * 7 + lang) / 8] |= (byte)(1 << ((((species - 1) * 7) + lang) % 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void fixParty()
|
private void setParty()
|
||||||
{
|
{
|
||||||
byte partymembers = 0;
|
byte partymembers = 0;
|
||||||
int offset = SaveGame.Party + 0x7F000 * savindex;
|
int offset = SaveGame.Party + 0x7F000 * savindex;
|
||||||
|
@ -7780,7 +7779,7 @@ namespace PKHeX
|
||||||
byte[] pkxdata = new Byte[0x104];
|
byte[] pkxdata = new Byte[0x104];
|
||||||
byte[] ekxdata = encryptArray(pkxdata);
|
byte[] ekxdata = encryptArray(pkxdata);
|
||||||
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
||||||
fixParty();
|
setParty();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7877,8 +7876,8 @@ namespace PKHeX
|
||||||
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
Array.Copy(ekxdata, 0, savefile, offset, 0x104);
|
||||||
getSlotColor(slot, Properties.Resources.slotSet);
|
getSlotColor(slot, Properties.Resources.slotSet);
|
||||||
}
|
}
|
||||||
fixPokedex();
|
setPokedex(preparepkx(buff));
|
||||||
fixParty();
|
setParty();
|
||||||
getPKXBoxes();
|
getPKXBoxes();
|
||||||
savedited = true;
|
savedited = true;
|
||||||
}
|
}
|
||||||
|
@ -8426,6 +8425,7 @@ namespace PKHeX
|
||||||
}
|
}
|
||||||
else continue;
|
else continue;
|
||||||
Array.Copy(data, 0, savefile, offset + ctr * size, 232);
|
Array.Copy(data, 0, savefile, offset + ctr * size, 232);
|
||||||
|
setPokedex(decryptArray(data)); // Set the Pokedex data
|
||||||
ctr++;
|
ctr++;
|
||||||
if (ctr == 30 * 31) break; // break out if we have written all 31 boxes
|
if (ctr == 30 * 31) break; // break out if we have written all 31 boxes
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue