private void B_Save_Click(object sender, EventArgs e) { SetEntry(); Zukan.SpindaPID = Util.GetHexValue(TB_Spinda.Text); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { if (tabControl1.Controls.Contains(TAB_Joyful)) { SaveJoyful(); } if (tabControl1.Controls.Contains(TAB_Ferry)) { SaveFerry(); } if (tabControl1.Controls.Contains(TAB_BF)) { SaveBattleFrontier(); } if (SAV.FRLG) { SAV.SetData(SAV.SetString(TB_OTName.Text, TB_OTName.MaxLength), SAV.GetBlockOffset(4) + 0xBCC); ComboBox[] cba = { CB_TCM1, CB_TCM2, CB_TCM3, CB_TCM4, CB_TCM5, CB_TCM6 }; int ofsTCM = SAV.GetBlockOffset(2) + 0x106; for (int i = 0; i < cba.Length; i++) { BitConverter.GetBytes((ushort)(int)cba[i].SelectedValue).CopyTo(SAV.Data, ofsTCM + (i << 1)); } } if (!SAV.RS) { SAV.BP = (ushort)NUD_BP.Value; } SAV.Coin = (ushort)NUD_Coins.Value; Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SetBags(); SAV.Inventory = Pouches; Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { if (tabControl1.Controls.Contains(TAB_Joyful) && SAV is IGen3Joyful j) { SaveJoyful(j); } if (tabControl1.Controls.Contains(TAB_Ferry)) { SaveFerry(); } if (tabControl1.Controls.Contains(TAB_BF)) { SaveBattleFrontier(); } if (SAV is SAV3FRLG frlg) { frlg.RivalName = TB_RivalName.Text; ComboBox[] cba = { CB_TCM1, CB_TCM2, CB_TCM3, CB_TCM4, CB_TCM5, CB_TCM6 }; for (int i = 0; i < cba.Length; i++) { var species = (ushort)WinFormsUtil.GetIndex(cba[i]); var g3Species = SpeciesConverter.GetG3Species(species); SAV.SetEventConst(0x43 + i, (ushort)g3Species); } } if (SAV is SAV3E se) { se.BP = (ushort)NUD_BP.Value; } SAV.Coin = (ushort)NUD_Coins.Value; Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { // Copy Bags int emptyslots = 0; for (int i = 0; i < 12; i++) { string bag = dataGridView1.Rows[i].Cells[1].Value.ToString(); if (Array.IndexOf(trba, bag) == 0) { emptyslots++; continue; } STB.SetBag(i - emptyslots, (byte)Array.IndexOf(trba, bag)); } if (float.TryParse(TB_Time1.Text, out var t1)) { SAV.SetData(BitConverter.GetBytes(t1), offsetTime + (4 * 30)); } if (float.TryParse(TB_Time2.Text, out var t2)) { SAV.SetData(BitConverter.GetBytes(t2), offsetTime + (4 * 31)); } SAV.SetData(BitConverter.GetBytes((ushort)WinFormsUtil.GetIndex(CB_S2)), offsetSpec + (4 * 30)); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SetUGScores(); SaveUGData(); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SetEntry(); SetTotals(); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { uint flags = Util.ToUInt32(MT_Flags.Text); SAV.Records.SetRecord(080, (int)flags); Array.Copy(BitConverter.GetBytes(flags), 0, SAV.Data, SAV.SecretBase + 0x62C, 4); // write counter Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { for (int i = 0; i < nup_spec.Length; i++) { BitConverter.GetBytes((uint)nup_spec[i].Value).CopyTo(SAV.Data, SAV.Contest + (i * 4)); } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SaveMain(); SaveForest(); SaveSubway(); SaveEntralink(); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SaveData(); SAV.ClockInitial = ClockInitial; SAV.ClockElapsed = ClockElapsed; Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { byte[] bgdata = bg.GetSkin(SAV is SAV5B2W2); if (bgdata.Any(z => z != 0)) { SAV.CGearSkinData = bgdata; Origin.CopyChangesFrom(SAV); } Close(); }
private void B_Save_Click(object sender, EventArgs e) { for (int i = 0; i < seen.Length; i++) { int species = i + 1; SAV.SetSeen(species, seen[i]); SAV.SetCaught(species, caught[i]); } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { var beans = Pouch.Beans; for (int i = 0; i < beans.Length; i++) { beans[i] = (byte)dgv.Rows[i].Cells[1].Value; } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { var beans = SAV.ResortSave.GetBeans(); for (int i = 0; i < beans.Length; i++) { var cells = dgv.Rows[i].Cells; var count = int.TryParse(cells[1].Value?.ToString() ?? "0", out var val) ? val : 0; beans[i] = (byte)Math.Min(byte.MaxValue, count); } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SetEntry(); int s = CB_DexUpgraded.SelectedIndex; if (s >= 0) { SAV.DexUpgraded = s; } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { if (flagArr.Length > 0) { SAV.BoxFlags = flagArr.Select(i => (byte)i.Value).ToArray(); } if (CB_Unlocked.Visible) { SAV.BoxesUnlocked = CB_Unlocked.SelectedIndex; } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { if (entry >= 0) { TempSave(); } Save(); var Err = CheckValid(); if (Err.Count != 0 && DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, $"{Err.Aggregate($"Validation Error. Save?{Environment.NewLine}", (tmp, v) => $"{tmp}{Environment.NewLine}{v}")}")) { return; } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { // Gather Updated Flags foreach (CheckBox flag in TLP_Flags.Controls.OfType <CheckBox>()) { flags[GetControlNum(flag)] = flag.Checked; } SAV.SetEventFlags(flags); // Copy back Constants ChangeConstantIndex(sender, EventArgs.Empty); // Trigger Saving SAV.SetEventConsts(Constants); HandleSpecialFlags(); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { // Copy Bags int emptyslots = 0; for (int i = 0; i < 12; i++) { var bag = dataGridView1.Rows[i].Cells[1].Value.ToString(); if (Array.IndexOf(trba, bag) == 0) { emptyslots++; continue; } STB.SetBag(i - emptyslots, (byte)Array.IndexOf(trba, bag)); } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { ushort[] constants = SAV.GetEventConsts(); for (int i = 0; i < CellCount; i++) { string str = (string)dgv.Rows[i].Cells[2].Value; int val = Array.IndexOf(states, str); if (val < 0) throw new IndexOutOfRangeException("Unable to find cell index."); constants[celloffset + i] = (ushort)val; } constants[cellstotal] = (ushort)NUD_Cells.Value; constants[cellscollected] = (ushort)NUD_Collected.Value; if (SAV is SAV7USUM) SAV.SetRecord(72, (int)NUD_Collected.Value); SAV.SetEventConsts(constants); Origin.CopyChangesFrom(SAV); Close(); }
private void B_Close_Click(object sender, EventArgs e) { int ofs = SAV.HoF; SAV.Data[ofs] &= 0xFE; SAV.Data[ofs] |= (byte)(CHK_Flag.Checked ? 1 : 0); BitConverter.GetBytes((ushort)NUD_Count.Value).CopyTo(SAV.Data, ofs + 2); for (int i = 0; i < entries.Length; i++) { int o = ofs + 4 + (i * 2); var cb = entries[i]; var val = WinFormsUtil.GetIndex(cb); BitConverter.GetBytes((ushort)val).CopyTo(SAV.Data, o); } if (SAV is SAV7USUM) { SAV.MiscBlock.StarterEncryptionConstant = Util.GetHexValue(TB_EC.Text); } Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { Origin.CopyChangesFrom(SAV); Close(); }
private void B_Cancel_Click(object sender, EventArgs e) { // We've been editing the original save file blocks. Restore the clone's data. Origin.CopyChangesFrom(SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { SAV.Link.SetLinkInfo(LinkInfo); Origin.CopyChangesFrom((SaveFile)SAV); Close(); }
private void B_Save_Click(object sender, EventArgs e) { if (SAV.OT != TB_OTName.Text) // only modify if changed (preserve trash bytes?) { SAV.OT = TB_OTName.Text; } SAV.Gender = (byte)CB_Gender.SelectedIndex; SAV.TID = (ushort)Util.ToUInt32(MT_TID.Text); SAV.SID = (ushort)Util.ToUInt32(MT_SID.Text); SAV.Money = Util.ToUInt32(MT_Money.Text); SAV.PlayedHours = ushort.Parse(MT_Hours.Text); SAV.PlayedMinutes = ushort.Parse(MT_Minutes.Text) % 60; SAV.PlayedSeconds = ushort.Parse(MT_Seconds.Text) % 60; // Copy Badges int badgeval = 0; for (int i = 0; i < cba.Length; i++) { badgeval |= (cba[i].Checked ? 1 : 0) << i; } if (SAV is SAV1 sav1) { sav1.Coin = (ushort)Math.Min(Util.ToUInt32(MT_Coins.Text), SAV.MaxCoins); sav1.Badges = badgeval & 0xFF; sav1.PikaFriendship = (byte)Math.Min(255, Util.ToUInt32(MT_PikaFriend.Text)); sav1.PikaBeachScore = (ushort)Math.Min(9999, Util.ToUInt32(MT_PikaBeach.Text)); sav1.BattleEffects = CHK_BattleEffects.Checked; sav1.BattleStyleSwitch = CB_BattleStyle.SelectedIndex == 0; sav1.Sound = CB_SoundType.SelectedIndex; sav1.TextSpeed = CB_TextSpeed.SelectedIndex; } if (SAV is SAV2 sav2) { sav2.Coin = (ushort)Math.Min(Util.ToUInt32(MT_Coins.Text), SAV.MaxCoins); sav2.Badges = badgeval & 0xFFFF; sav2.BattleEffects = CHK_BattleEffects.Checked; sav2.BattleStyleSwitch = CB_BattleStyle.SelectedIndex == 0; sav2.Sound = CB_SoundType.SelectedIndex > 0 ? 2 : 0; sav2.TextSpeed = CB_TextSpeed.SelectedIndex; } if (SAV is SAV3 sav3) { sav3.Badges = badgeval & 0xFF; } if (SAV is SAV4 sav4) { if (MapUpdated) { sav4.M = (int)NUD_M.Value; sav4.X = (int)NUD_X.Value; sav4.Z = (int)NUD_Z.Value; sav4.Y = (int)NUD_Y.Value; } sav4.Badges = badgeval & 0xFF; if (sav4 is SAV4HGSS hgss) { hgss.Badges16 = badgeval >> 8; } } else if (SAV is SAV5 s) { if (MapUpdated) { var pd = s.PlayerData; pd.M = (int)NUD_M.Value; pd.X = (int)NUD_X.Value; pd.Z = (int)NUD_Z.Value; pd.Y = (int)NUD_Y.Value; } s.Misc.Badges = badgeval & 0xFF; s.BattleSubway.BP = (ushort)Math.Min(Util.ToUInt32(MT_Coins.Text), SAV.MaxCoins); } SAV.SecondsToStart = (uint)DateUtil.GetSecondsFrom2000(CAL_AdventureStartDate.Value, CAL_AdventureStartTime.Value); SAV.SecondsToFame = (uint)DateUtil.GetSecondsFrom2000(CAL_HoFDate.Value, CAL_HoFTime.Value); Origin.CopyChangesFrom(SAV); Close(); }