private void NTSCJToolStripMenuItem1_Click(object sender, EventArgs e) { long.TryParse(TextboxMRFN.Text, out long nnn); string VMRFN = DectoHex_Uint(nnn); string VGM = DectoHex_Uint(Convert.ToInt64(ComboGM.SelectedIndex)); string VCourse = DectoHex_Uint(Convert.ToInt64(ComboCourse.SelectedIndex)); string VChar = DectoHex_Uint(Convert.ToInt64(ComboChar.SelectedIndex)); string VVehicle = DectoHex_Uint(Convert.ToInt64(ComboVehicle.SelectedIndex)); string VClass = DectoHex_Uint(Convert.ToInt64(ComboClass.SelectedIndex)); long.TryParse(TextboxTime.Text, out nnn); string VTime = DectoHex_Uint(nnn); long.TryParse(TextboxScore.Text, out nnn); string VScore = DectoHex_Uint(nnn); VMRFN = "00000000" + VMRFN; VGM = "00000000" + VGM; VCourse = "00000000" + VCourse; VChar = "00000000" + VChar; VVehicle = "00000000" + VVehicle; VClass = "00000000" + VClass; VTime = "00000000" + VTime; VScore = "00000000" + VScore; VMRFN = VMRFN.Substring(VMRFN.Length - 4, 4); VGM = VGM.Substring(VGM.Length - 4, 4); VCourse = VCourse.Substring(VCourse.Length - 2, 2); VChar = VChar.Substring(VChar.Length - 2, 2); VVehicle = VVehicle.Substring(VVehicle.Length - 2, 2); VClass = VClass.Substring(VClass.Length - 2, 2); VTime = VTime.Substring(VTime.Length - 4, 4); VScore = VScore.Substring(VScore.Length - 8, 8); string Patch = Patchcode.Replace("GGGG", VMRFN); Patch = Patch.Replace("HHHH", VGM); Patch = Patch.Replace("II", VCourse); Patch = Patch.Replace("JJ", VChar); Patch = Patch.Replace("KK", VVehicle); Patch = Patch.Replace("LL", VClass); Patch = Patch.Replace("MMMM", VTime); Patch = Patch.Replace("NNNNNNNN", VScore); Clipboard.SetText( Begin_NTSCJ + System.Environment.NewLine + Patch + System.Environment.NewLine + End_NTSCJ ); }
private void NTSCJToolStripMenuItem_Click(object sender, EventArgs e) { long.TryParse(TextboxMRFN.Text, out long nnn); string VMRFN = DectoHex_Uint(nnn); string VGM = DectoHex_Uint(Convert.ToInt64(ComboGM.SelectedIndex)); string VCourse = DectoHex_Uint(Convert.ToInt64(ComboCourse.SelectedIndex)); string VChar = DectoHex_Uint(Convert.ToInt64(ComboChar.SelectedIndex)); string VVehicle = DectoHex_Uint(Convert.ToInt64(ComboVehicle.SelectedIndex)); string VClass = DectoHex_Uint(Convert.ToInt64(ComboClass.SelectedIndex)); long.TryParse(TextboxTime.Text, out nnn); string VTime = DectoHex_Uint(nnn); long.TryParse(TextboxScore.Text, out nnn); string VScore = DectoHex_Uint(nnn); VMRFN = "00000000" + VMRFN; VGM = "00000000" + VGM; VCourse = "00000000" + VCourse; VChar = "00000000" + VChar; VVehicle = "00000000" + VVehicle; VClass = "00000000" + VClass; VTime = "00000000" + VTime; VScore = "00000000" + VScore; VMRFN = VMRFN.Substring(VMRFN.Length - 4, 4); VGM = VGM.Substring(VGM.Length - 4, 4); VCourse = VCourse.Substring(VCourse.Length - 2, 2); VChar = VChar.Substring(VChar.Length - 2, 2); VVehicle = VVehicle.Substring(VVehicle.Length - 2, 2); VClass = VClass.Substring(VClass.Length - 2, 2); VTime = VTime.Substring(VTime.Length - 4, 4); VScore = VScore.Substring(VScore.Length - 8, 8); string Patch = Patchcode.Replace("GGGG", VMRFN); Patch = Patch.Replace("HHHH", VGM); Patch = Patch.Replace("II", VCourse); Patch = Patch.Replace("JJ", VChar); Patch = Patch.Replace("KK", VVehicle); Patch = Patch.Replace("LL", VClass); Patch = Patch.Replace("MMMM", VTime); Patch = Patch.Replace("NNNNNNNN", VScore); string MissionMode = GCTHeader + Begin_NTSCJ + Patch + End_NTSCJ + GCTFooter; SaveFileDialog SaveFileDialog1 = new SaveFileDialog(); SaveFileDialog1.InitialDirectory = "c:\\"; SaveFileDialog1.Filter = "Gecko Cheat Code File (*.gct)|*.gct"; SaveFileDialog1.FilterIndex = 1; SaveFileDialog1.RestoreDirectory = true; if (SaveFileDialog1.ShowDialog() == DialogResult.OK) { try { byte[] fff = HextoBytes(MissionMode); string Ofile = SaveFileDialog1.FileName; File.WriteAllBytes(Ofile, fff); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } }