Fix gen3 emerald badge setter

Closes #1452
the bitwise or treated it as an int, which wrote 4 bytes instead of 2,
thus overwriting 16 flyto flags
Thanks @sora10pls & @Tk77185!
This commit is contained in:
Kurt
2017-09-18 16:06:31 -07:00
parent ad69420ad9
commit 298dc344cf

View File

@@ -326,7 +326,8 @@ public int Badges
switch (Version)
{
case GameVersion.E:
BitConverter.GetBytes(BitConverter.ToUInt16(Data, BlockOfs[2] + 0x3FC) & ~(0xFF << 7) | (value << 7)).CopyTo(Data, BlockOfs[2] + 0x3FC);
var val = BitConverter.ToUInt16(Data, BlockOfs[2] + 0x3FC) & ~(0xFF << 7) | (value << 7);
BitConverter.GetBytes((ushort)val).CopyTo(Data, BlockOfs[2] + 0x3FC);
break;
case GameVersion.FRLG: Data[BlockOfs[2] + 0x64] = (byte)value; break;
default: return; // RS