Fix Navel Rock clearing issue

Closes #1090
Saving of the Battle Frontier symbols is clearing the flag

block2 ofs 0x40C = Navel Rock
block2 ofs 0x408 = symbols

bitconverter getbytes was fed an Int64 due to bit shifting ints and
uints. Forcibly cast to uint to keep only 32 bits -> intended behavior.

sneak in RNG readonly
This commit is contained in:
Kurt 2017-04-23 12:07:45 -07:00
parent 2b1bc213aa
commit a9ff3aceaa
2 changed files with 6 additions and 4 deletions

View file

@ -364,7 +364,9 @@ namespace PKHeX.WinForms
iSymbols |= (uint)((Symbols[i] & 3) << i * 2);
if (CHK_ActivatePass.Checked)
iSymbols |= 1 << 14;
BitConverter.GetBytes(BitConverter.ToUInt32(SAV.Data, ofsSymbols) & ~(0x7FFF << 4) | (iSymbols & 0x7FFF) << 4).CopyTo(SAV.Data, ofsSymbols);
uint val = (uint)(BitConverter.ToUInt32(SAV.Data, ofsSymbols) & ~(0x7FFF << 4) | (iSymbols & 0x7FFF) << 4);
BitConverter.GetBytes(val).CopyTo(SAV.Data, ofsSymbols);
}
private void BTN_Symbol_Click(object sender, EventArgs e)
{

View file

@ -2,9 +2,9 @@
{
public class RNG
{
public static RNG LCRNG = new RNG(0x41C64E6D, 0x00006073, 0xEEB9EB65, 0x0A3561A1);
public static RNG XDRNG = new RNG(0x000343FD, 0x00269EC3, 0xB9B33155, 0xA170F641);
public static RNG ARNG = new RNG(0x6C078965, 0x00000001, 0x9638806D, 0x69C77F93);
public static readonly RNG LCRNG = new RNG(0x41C64E6D, 0x00006073, 0xEEB9EB65, 0x0A3561A1);
public static readonly RNG XDRNG = new RNG(0x000343FD, 0x00269EC3, 0xB9B33155, 0xA170F641);
public static readonly RNG ARNG = new RNG(0x6C078965, 0x00000001, 0x9638806D, 0x69C77F93);
private readonly uint Mult, Add, rMult, rAdd;
protected RNG(uint f_mult, uint f_add, uint r_mult, uint r_add)