Guest User

C#

a guest
Dec 12th, 2019
555
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Diagnostics;
  6. using System.Drawing;
  7. using System.IO;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12.  
  13. namespace PES20Patcher_nesa24
  14. {
  15. public partial class Form1 : Form
  16. {
  17. public Form1()
  18. {
  19. InitializeComponent();
  20. }
  21.  
  22.  
  23. #region file name
  24. OpenFileDialog ofd = new OpenFileDialog();
  25. string filename = "PES2020.exe";
  26. string shortname = "";
  27. string patchingfile = "";
  28. string exeversion = "";
  29.  
  30. #endregion file name
  31.  
  32.  
  33. #region gameversions
  34. int gamever;
  35. int gamesub;
  36. int game;
  37. string gamename = "";
  38. string gamesubversion = "";
  39. #endregion
  40.  
  41. private void ExitBTN_Click(object sender, EventArgs e)
  42. {
  43. this.Close();
  44. }
  45.  
  46. public void CheckGP(string file)
  47. {
  48. if (File.Exists(Directory.GetCurrentDirectory() + "\\" + filename))
  49. {
  50. BinaryReader br = new BinaryReader(File.Open(Directory.GetCurrentDirectory() + "\\" + filename, FileMode.Open, FileAccess.Read));
  51.  
  52. byte[] kon = {0x96, 0x42};
  53. byte[] n24 = {0x65, 0x55};
  54. byte[] gpv = new byte[2];
  55. br.BaseStream.Position = 0x02565A56;
  56. gpv = br.ReadBytes(2);
  57. if (gpv[0]==kon[0])
  58. {
  59. exeversion = "KONAMI";
  60.  
  61. }
  62. if (gpv[0] == n24[0])
  63. {
  64. exeversion = "nesa24";
  65.  
  66. }
  67. br.Close();
  68. label2.Text= "Gameplay: " + exeversion;
  69.  
  70. }
  71. else
  72. {
  73. MessageBox.Show("Copy PATCHER to PES2020 main folder!");
  74. MessageBox.Show("Tool will close!");
  75. this.Close();
  76. }
  77. }
  78.  
  79.  
  80. public void patch(string file)
  81. {
  82. BinaryWriter bw = new BinaryWriter(File.Open(Directory.GetCurrentDirectory()+"\\"+filename, FileMode.Open, FileAccess.Write));
  83. bw.BaseStream.Position = 0x02565A54;
  84. byte[] patch1 = { 0x00, 0x00, 0x65, 0x55, 0x00, 0x00, 0xF0, 0x42, 0x00, 0x00, 0x34, 0x43 };
  85. bw.Write(patch1);
  86.  
  87.  
  88. bw.BaseStream.Position = 0x0257FE0C;
  89. byte[] patch2 = { 0x99, 0x99, 0xB9, 0x3F, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x42, 0x69, 0x6E, 0x64, 0x00, 0x00 };
  90. bw.Write(patch2);
  91.  
  92.  
  93.  
  94. bw.BaseStream.Position = 0x0258888C;
  95. byte[] patch3 = { 0xCD, 0xCC, 0x0C, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x88, 0x40 };
  96. bw.Write(patch3);
  97.  
  98.  
  99.  
  100. bw.BaseStream.Position = 0x02588D20;
  101. byte[] patch4 = { 0x00, 0x00, 0x96, 0x45, 0x00, 0x00, 0xF0, 0x42, 0x00, 0x00, 0xC8, 0x42 };
  102. bw.Write(patch4);
  103.  
  104.  
  105. bw.BaseStream.Position = 0x02588D74;
  106. byte[] patch5 = { 0x00, 0x00, 0x96, 0x45, 0x00, 0x00, 0xB4, 0x41, 0x00, 0x00, 0xB4, 0x41 };
  107. bw.Write(patch5);
  108.  
  109.  
  110.  
  111. bw.BaseStream.Position = 0x02588D9C;
  112. byte[] patch6 = { 0x00, 0x00, 0x96, 0x45, 0x00, 0x00, 0x70, 0x42, 0x00, 0x00, 0xD2, 0x42, 0x00, 0x00, 0x70, 0x41 };
  113. bw.Write(patch6);
  114.  
  115. bw.BaseStream.Position = 0x03433FE8;
  116. byte[] patch7 = { 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0xF8, 0x44, 0x07, 0xFF };
  117. bw.Write(patch7);
  118.  
  119. bw.BaseStream.Position = 0x0349ED14;
  120. byte[] patch8 = { 0x00, 0x00, 0xA0, 0x40, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42 };
  121. bw.Write(patch8);
  122.  
  123.  
  124. bw.Close();
  125.  
  126. exeversion = "nesa24";
  127. label2.Text = "Gameplay: " + exeversion;
  128.  
  129. }
  130.  
  131.  
  132. public void konami(string file)
  133. {
  134. BinaryWriter bw = new BinaryWriter(File.Open(Directory.GetCurrentDirectory() + "\\" + filename, FileMode.Open, FileAccess.Write));
  135.  
  136.  
  137. bw.BaseStream.Position = 0x02565A54;
  138. byte[] patch1 = { 0x00, 0x00, 0x96, 0x42, 0x00, 0x00, 0xF0, 0x42, 0x00, 0x00, 0x34, 0x43 }; //000096420000F04200003443
  139. bw.Write(patch1);
  140.  
  141.  
  142. bw.BaseStream.Position = 0x0257FE0C;
  143. byte[] patch2 = { 0x99, 0x99, 0xD9, 0x3F, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x42, 0x69, 0x6E, 0x64, 0x00, 0x00 }; //9999D93F53637269707442696E640000
  144. bw.Write(patch2);
  145.  
  146.  
  147.  
  148. bw.BaseStream.Position = 0x0258888C;
  149. byte[] patch3 = { 0x66, 0x66, 0xE6, 0x3F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0x00, 0x00, 0x88, 0x40 }; // 6666E63F000000000000204000008840
  150. bw.Write(patch3);
  151.  
  152.  
  153.  
  154. bw.BaseStream.Position = 0x02588D20;
  155. byte[] patch4 = { 0x00, 0x00, 0x96, 0x42, 0x00, 0x00, 0xF0, 0x42, 0x00, 0x00, 0xC8, 0x42 }; //000096420000F0420000C842
  156. bw.Write(patch4);
  157.  
  158.  
  159. bw.BaseStream.Position = 0x02588D74;
  160. byte[] patch5 = { 0x00, 0x00, 0x96, 0x42, 0x00, 0x00, 0xB4, 0x41, 0x00, 0x00, 0xB4, 0x41 }; //000096420000B4410000B441
  161. bw.Write(patch5);
  162.  
  163.  
  164.  
  165. bw.BaseStream.Position = 0x02588D9C;
  166. byte[] patch6 = { 0x00, 0x00, 0x96, 0x42, 0x00, 0x00, 0x70, 0x42, 0x00, 0x00, 0xD2, 0x42, 0x00, 0x00, 0x70, 0x41 }; //00009642000070420000D24200007041
  167. bw.Write(patch6);
  168.  
  169. bw.BaseStream.Position = 0x03433FE8;
  170. byte[] patch7 = { 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF, 0x00, 0xA8, 0xFF, 0xFF }; //00A8FFFF00A8FFFF00A8FFFF00A8FFFF00A8FFFF
  171. bw.Write(patch7);
  172.  
  173.  
  174. bw.BaseStream.Position = 0x0349ED14;
  175. byte[] patch8 = { 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42 }; //00000041000080400000000000000042
  176. bw.Write(patch8);
  177.  
  178.  
  179. bw.Close();
  180.  
  181. exeversion = "KONAMI";
  182. label2.Text = "Gameplay: " + exeversion;
  183. }
  184.  
  185.  
  186. private void PatchBTN_Click(object sender, EventArgs e)
  187. {
  188. patch(Directory.GetCurrentDirectory() + "\\"+ filename);
  189. MessageBox.Show("Patched with nesa24 GP");
  190. }
  191.  
  192. private void Form1_Load(object sender, EventArgs e)
  193. {
  194. CheckGP(Directory.GetCurrentDirectory() + "\\" + filename);
  195. }
  196.  
  197. private void button1_Click(object sender, EventArgs e)
  198. {
  199. konami(Directory.GetCurrentDirectory() + "\\" + filename);
  200. MessageBox.Show("Restored KONAMI GP");
  201. }
  202.  
  203. }
  204. }
Add Comment
Please, Sign In to add comment