Update kor offsets & r/w operations

Closes #1451 , was caused by empty party writebacks (was reading from
wrong offset
dex caught/owned offset was listed as 0x28AE in the thread, is at 0x2AAE
instead (-0x20 from seen)

should have correct offsets and handling now :)
This commit is contained in:
Kurt 2017-09-12 19:47:37 -07:00
parent c55b3df939
commit 7d8a0e0287
3 changed files with 11 additions and 6 deletions

View file

@ -184,9 +184,11 @@ namespace PKHeX.Core
var table = U2GSC_KOR[i];
if (!table.TryGetValue(c.ToString(), out byte val))
continue;
koreanChar = true;
if (arr.Count + 1 >= maxLength)
break; // adding 2 characters will overflow requested buffer cap
arr.Add(i);
arr.Add(val);
koreanChar = true;
break;
}
if (!koreanChar)
@ -196,6 +198,8 @@ namespace PKHeX.Core
arr.Add(val);
}
}
while (arr.Count >= maxLength)
arr.RemoveAt(arr.Count - 1);
arr.Add(0x50); // terminator
while (arr.Count < padTo)
arr.Add((byte)padWith);

View file

@ -438,7 +438,8 @@ namespace PKHeX.Core
public override string GetBoxName(int box)
{
return GetString(Offsets.BoxNames + box * 9, 9);
int len = Korean ? 17 : 9;
return GetString(Offsets.BoxNames + box * len, len);
}
public override void SetBoxName(int box, string value)
{

View file

@ -155,10 +155,10 @@
Palette = 0x2065;
Money = 0x23D3;
JohtoBadges = 0x23DC;
BoxNames = 0x2727;
Party = 0x288A;
PokedexCaught = 0x2A4C;
PokedexSeen = 0x2A6C;
BoxNames = 0x26FF;
Party = 0x28CC;
PokedexCaught = 0x2AAE;
PokedexSeen = 0x2ACE;
CurrentBox = 0x26FC;
CurrentBoxIndex = 0x2DAE;
Gender = -1; // No gender in GS