mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 05:48:44 +00:00
parent
2a83bc5fa2
commit
8319bfe003
2 changed files with 7 additions and 8 deletions
|
@ -210,7 +210,7 @@ namespace PKHeX.Core
|
|||
|
||||
public EntreeForest EntreeData
|
||||
{
|
||||
get => new(GetData(EntreeForestOffset, 0x850));
|
||||
get => new(GetData(EntreeForestOffset, EntreeForest.SIZE));
|
||||
set => SetData(value.Write(), EntreeForestOffset);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,23 +25,22 @@ namespace PKHeX.Core
|
|||
/// </summary>
|
||||
private const byte MaxUnlock38Areas = 6;
|
||||
|
||||
private const int EncryptionSeedOffset = 0x84C;
|
||||
private const int EncryptionSeedOffset = SIZE - 4; // 0x84C
|
||||
public const int SIZE = 0x850;
|
||||
|
||||
private readonly byte[] Data;
|
||||
|
||||
public EntreeForest(byte[] data)
|
||||
{
|
||||
Data = data;
|
||||
PokeCrypto.CryptArray(data.AsSpan(0, EncryptionSeedOffset), EncryptionSeed);
|
||||
}
|
||||
public EntreeForest(byte[] data) => CryptRegion(Data = data);
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
byte[] data = (byte[])Data.Clone();
|
||||
PokeCrypto.CryptArray(data.AsSpan(0, EncryptionSeedOffset), EncryptionSeedOffset);
|
||||
CryptRegion(data);
|
||||
return data;
|
||||
}
|
||||
|
||||
private void CryptRegion(Span<byte> data) => PokeCrypto.CryptArray(data[..EncryptionSeedOffset], EncryptionSeed);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all Entree Slot data.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Reference in a new issue