Really fix dex lang flag offset style

c345688f6d

base(x) -> base(x - y) resulted in incorrect offsets for LGPE. Great.
Just make PokeDexLanguageFlags a shift offset instead of absolute;
update all usages.

Closes #2348
This commit is contained in:
Kurt 2019-07-05 12:16:09 -07:00
parent 599ec4ed45
commit 7f186048fb
8 changed files with 15 additions and 15 deletions

View file

@ -21,7 +21,7 @@
EventFlag = EventConst + 0x35E;
Daycare = 0x20D00;
PokeDex = 0x21400;
PokeDexLanguageFlags = PokeDex + 0x328; // forme flags size is + 8 from bw with new formes (therians)
PokeDexLanguageFlags = 0x328; // forme flags size is + 8 from bw with new formes (therians)
BattleSubway = 0x21B00;
CGearInfoOffset = 0x1C000;
CGearDataOffset = 0x52800;

View file

@ -22,7 +22,7 @@
EventFlag = EventConst + 0x27C;
Daycare = 0x20E00;
PokeDex = 0x21600;
PokeDexLanguageFlags = PokeDex + 0x320;
PokeDexLanguageFlags = 0x320;
BattleSubway = 0x21D00;
CGearInfoOffset = 0x1C000;
CGearDataOffset = 0x52000;

View file

@ -142,7 +142,7 @@ namespace PKHeX.Core
EventFlag = EventConst + (EventConstMax * 2); // After Event Const (u16)*n
HoF = EventFlag + (EventFlagMax / 8); // After Event Flags (1b)*(1u8/8b)*n
PokeDexLanguageFlags = PokeDex + 0x550;
PokeDexLanguageFlags = 0x550;
WondercardData = WondercardFlags + 0x100;
Played = new PlayTime6(this, PlayTime);
@ -202,7 +202,7 @@ namespace PKHeX.Core
// Accessible as SAV7
private int TrainerCard { get; set; } = 0x14000;
private int Resort { get; set; }
public int PokeDexLanguageFlags { get; private set; } = int.MinValue;
public int PokeDexLanguageFlags { get; private set; }
public int Fashion { get; set; } = int.MinValue;
protected int Record { get; set; } = int.MinValue;

View file

@ -41,7 +41,7 @@ namespace PKHeX.WinForms
Displayed[i] = SetBits(Parent.Data, ofs, SeenDispLen);
ofs += SeenDispLen;
}
LanguageFlags = SetBits(Parent.Data, Parent.PokeDexLanguageFlags, LanguageLen);
LanguageFlags = SetBits(Parent.Data, Parent.PokeDex + Parent.PokeDexLanguageFlags, LanguageLen);
}
public void Write()
@ -63,7 +63,7 @@ namespace PKHeX.WinForms
SetBits(Displayed[i]).CopyTo(Parent.Data, ofs);
ofs += SeenDispLen;
}
SetBits(LanguageFlags).CopyTo(Parent.Data, Parent.PokeDexLanguageFlags);
SetBits(LanguageFlags).CopyTo(Parent.Data, Parent.PokeDex + Parent.PokeDexLanguageFlags);
}
public IEnumerable<int> GetAllFormEntries(int spec)

View file

@ -21,7 +21,7 @@ namespace PKHeX.Core
private IList<int> FormBaseSpecies;
public Zukan7(SaveFile sav, int dex, int langflag) : base(sav, dex, langflag - dex)
public Zukan7(SaveFile sav, int dex, int langflag) : base(sav, dex, langflag)
{
DexFormIndexFetcher = SAV.USUM ? (Func<int, int, int, int>) DexFormUtil.GetDexFormIndexSM : DexFormUtil.GetDexFormIndexSM;
LoadDexList();

View file

@ -206,7 +206,7 @@ namespace PKHeX.WinForms
// Fill Language arrays
byte[] langdata = new byte[LangSize];
Array.Copy(SAV.Data, SAV.PokeDexLanguageFlags, langdata, 0, LangSize);
Array.Copy(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags, langdata, 0, LangSize);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < 493; b++)
{
@ -257,7 +257,7 @@ namespace PKHeX.WinForms
ldata[i>>3] |= (byte)(1 << (i&7));
}
ldata.CopyTo(SAV.Data, SAV.PokeDexLanguageFlags);
ldata.CopyTo(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags);
}
int FormDex = SAV.PokeDex + 0x8 + (brSize * 9);
formbools.CopyTo(SAV.Data, FormDex);

View file

@ -210,7 +210,7 @@ namespace PKHeX.WinForms
// Fill Language arrays
byte[] langdata = new byte[0x280];
Array.Copy(SAV.Data, SAV.PokeDexLanguageFlags, langdata, 0, langdata.Length);
Array.Copy(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags, langdata, 0, langdata.Length);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < SAV.MaxSpeciesID; b++) // 721 Species
{
@ -257,7 +257,7 @@ namespace PKHeX.WinForms
ldata[i/8] |= (byte) (1 << i%8);
}
ldata.CopyTo(SAV.Data, SAV.PokeDexLanguageFlags);
ldata.CopyTo(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags);
formbools.CopyTo(SAV.Data, SAV.PokeDex + 0x368);
@ -418,7 +418,7 @@ namespace PKHeX.WinForms
SetEntry();
SetData();
if (mnuComplete == sender) // Turn off Italian Petlil
SAV.Data[SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
SAV.Data[SAV.PokeDex + SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
GetData();
GetEntry();

View file

@ -210,7 +210,7 @@ namespace PKHeX.WinForms
// Fill Language arrays
byte[] langdata = new byte[0x280];
Array.Copy(SAV.Data, SAV.PokeDexLanguageFlags, langdata, 0, 0x280);
Array.Copy(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags, langdata, 0, 0x280);
BitArray LangRegion = new BitArray(langdata);
for (int b = 0; b < 721; b++) // 721 Species
{
@ -265,7 +265,7 @@ namespace PKHeX.WinForms
ldata[i / 8] |= (byte)(1 << i % 8);
}
ldata.CopyTo(SAV.Data, SAV.PokeDexLanguageFlags);
ldata.CopyTo(SAV.Data, SAV.PokeDex + SAV.PokeDexLanguageFlags);
}
formbools.CopyTo(SAV.Data, SAV.PokeDex + 0x368);
@ -423,7 +423,7 @@ namespace PKHeX.WinForms
SetEntry();
SetData();
if (mnuComplete == sender) // Turn off Italian Petlil
SAV.Data[SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
SAV.Data[SAV.PokeDex + SAV.PokeDexLanguageFlags + 0x1DF] &= 0xFE;
GetData();
GetEntry();