Advertisement
BullyATWiiplaza

PS3 PRC

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