Advertisement
Astekk

Better BO2 RPC [1.19/C#]

Jan 4th, 2015
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.69 KB | None | 0 0
  1. public static class RPC
  2. {
  3.                 private static uint function_address = 0x007AA050;
  4.                     public static uint Call(uint func_address, params object[] parameters)
  5.                     {
  6.                         int length = parameters.Length;
  7.                         for (uint i = 0; i < length; i++)
  8.                         {
  9.                             if (parameters[i] is int)
  10.                             {
  11.                                 byte[] array = BitConverter.GetBytes((int)parameters[i]);
  12.                                 Array.Reverse(array);
  13.                                 SetMemory(0x10050008 + (i * 4), array);
  14.                             }
  15.                             else if (parameters[i] is uint)
  16.                             {
  17.                                 byte[] buffer2 = BitConverter.GetBytes((uint)parameters[i]);
  18.                                 Array.Reverse(buffer2);
  19.                                 SetMemory(0x10050008 + (i * 4), buffer2);
  20.                             }
  21.                             else if (parameters[i] is string)
  22.                             {
  23.                                 byte[] buffer3 = Encoding.UTF8.GetBytes(Convert.ToString(parameters[i]) + "\0");
  24.                                 SetMemory(0x1005002c + (i * 0x150), buffer3);
  25.                                 uint num3 = 0x1005002c + (i * 0x150);
  26.                                 byte[] buffer4 = BitConverter.GetBytes(num3);
  27.                                 Array.Reverse(buffer4);
  28.                                 SetMemory(0x10050008 + (i * 4), buffer4);
  29.                             }
  30.                         }
  31.                         for (int j = 9 - length; j <= 9; j++)
  32.                         {
  33.                             SetMemory((uint)(0x10050008 + (j * 4)), new byte[4]);
  34.                         }
  35.                         byte[] bytes = BitConverter.GetBytes(func_address);
  36.                         Array.Reverse(bytes);
  37.                         SetMemory(0x10050000, bytes);
  38.                         System.Threading.Thread.Sleep(20);
  39.                         byte[] GetX = new byte[4];
  40.                         byte[] memory = GetMemory(0x10050004, 4);
  41.                         Array.Reverse(memory);
  42.                         return BitConverter.ToUInt32(memory, 0);
  43.                     }
  44.  
  45.                     public static void Enable_RPC()
  46.                     {
  47.                         byte[] CheckRPC = new byte[1];
  48.                         if (CheckRPC[0] == 0x4e)
  49.                         {
  50.  
  51.                         }
  52.                         else
  53.                         {
  54.                             SetMemory(function_address, new byte[] { 0x4e, 0x80, 0, 0x20 });
  55.                             byte[] memory = new byte[] {
  56.                 0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0xd0, 0xdb, 0x21, 0, 0x88, 0xdb, 0x41, 0, 0x90,
  57.                 0xdb, 0x61, 0, 0x98, 0xdb, 0x81, 0, 160, 0xdb, 0xa1, 0, 0xa8, 0xdb, 0xc1, 0, 0xb0,
  58.                 0xdb, 0xe1, 0, 0xb8, 0xfb, 0xa1, 0, 0x70, 0xfb, 0xc1, 0, 120, 0xfb, 0xe1, 0, 0x80,
  59.                 0x3d, 0x60, 0x10, 5, 0x80, 0x6b, 0, 0, 0x2c, 3, 0, 0, 0x41, 130, 0, 60,
  60.                 0x80, 0x6b, 0, 8, 0x80, 0x8b, 0, 12, 0x80, 0xab, 0, 0x10, 0x80, 0xcb, 0, 20,
  61.                 0x80, 0xeb, 0, 0x18, 0x81, 11, 0, 0x1c, 0x81, 0x2b, 0, 0x20, 0x81, 0x4b, 0, 0x24,
  62.                 0x81, 0x6b, 0, 40, 0x48, 0, 0, 0x4d, 60, 0x80, 0x10, 5, 0x80, 100, 0, 4,
  63.                 0x38, 160, 0, 0, 0x90, 0xa4, 0, 0, 0xe8, 1, 0, 0xd0, 0x7c, 8, 3, 0xa6,
  64.                 0xcb, 0x21, 0, 0x88, 0xcb, 0x41, 0, 0x90, 0xcb, 0x61, 0, 0x98, 0xcb, 0x81, 0, 160,
  65.                 0xcb, 0xa1, 0, 0xa8, 0xcb, 0xc1, 0, 0xb0, 0xcb, 0xe1, 0, 0xb8, 0xeb, 0xa1, 0, 0x70,
  66.                 0xeb, 0xc1, 0, 120, 0xeb, 0xe1, 0, 0x80, 0x38, 0x21, 0, 0xc0, 0x4e, 0x80, 0, 0x20,
  67.                 0x3d, 0x80, 0x10, 5, 0x81, 140, 0, 0, 0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x20,
  68.                 0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 0xe8, 1, 0, 0x20, 0x7c, 8, 3, 0xa6,
  69.                 0x4e, 0x80, 0, 0x20, 0x60, 0, 0, 0
  70.              };
  71.                             SetMemory(function_address + 4, memory);
  72.                             SetMemory(0x10050000, new byte[0xaac]);
  73.                             SetMemory(function_address, new byte[] { 0xf8, 0x21, 0xff, 0x41 });
  74.                         }
  75.                 public static byte[] GetMemory(uint address, int length)
  76.                 {
  77.                     byte[] buffer = new byte[length];
  78.                     PS3.GetMemory(address, buffer);
  79.                     return buffer;
  80.                 }
  81.                 public static void SetMemory(uint Address, byte[] Bytes)
  82.                 {
  83.                     PS3.SetMemory(Address, Bytes);
  84.                 }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement