private void diffSaves() { if (!File.Exists(TB_OldSAV.Text)) { Util.Alert("Save 1 path invalid."); return; } if (!File.Exists(TB_NewSAV.Text)) { Util.Alert("Save 2 path invalid."); return; } if (new FileInfo(TB_OldSAV.Text).Length > 0x100000) { Util.Alert("Save 1 file invalid."); return; } if (new FileInfo(TB_NewSAV.Text).Length > 0x100000) { Util.Alert("Save 2 file invalid."); return; } SaveFile s1 = SaveUtil.getVariantSAV(File.ReadAllBytes(TB_OldSAV.Text)); SaveFile s2 = SaveUtil.getVariantSAV(File.ReadAllBytes(TB_NewSAV.Text)); if (s1.GetType() != s2.GetType()) { Util.Alert("Save types are different.", $"S1: {s1.GetType()}", $"S2: {s2.GetType()}"); return; } if (s1.Version != s2.Version) { Util.Alert("Save versions are different.", $"S1: {s1.Version}", $"S2: {s2.Version}"); return; } string tbIsSet = ""; string tbUnSet = ""; try { bool[] oldBits = s1.EventFlags; bool[] newBits = s2.EventFlags; if (oldBits.Length != newBits.Length) { Util.Alert("Event flag lengths for games are different.", $"S1: {(GameVersion)s1.Game}", $"S2: {(GameVersion)s2.Game}"); return; } for (int i = 0; i < oldBits.Length; i++) { if (oldBits[i] == newBits[i]) { continue; } if (newBits[i]) { tbIsSet += i.ToString("0000") + ","; } else { tbUnSet += i.ToString("0000") + ","; } } } catch (Exception e) { Util.Error(e.ToString()); Console.Write(e); } TB_IsSet.Text = tbIsSet; TB_UnSet.Text = tbUnSet; string r = ""; try { ushort[] oldConst = s1.EventConsts; ushort[] newConst = s2.EventConsts; if (oldConst.Length != newConst.Length) { Util.Alert("Event flag lengths for games are different.", $"S1: {(GameVersion)s1.Game}", $"S2: {(GameVersion)s2.Game}"); return; } for (int i = 0; i < newConst.Length; i++) { if (oldConst[i] != newConst[i]) { r += $"{i}: {oldConst[i]}->{newConst[i]}{Environment.NewLine}"; } } } catch (Exception e) { Util.Error(e.ToString()); Console.Write(e); } if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Copy Event Constant diff to clipboard?")) { return; } Clipboard.SetText(r); }