Advertisement
sharkbait263

Fixed Ghosts RPC 1.07

Jan 9th, 2014
570
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.17 KB | None | 0 0
  1. class GHOSTS
  2.         {
  3.             public class PS3
  4.             {
  5.                 public static void SetMemory(uint address, byte[] memory)
  6.                 {
  7.                     DEX.SetMemory(address, memory);
  8.                 }
  9.  
  10.                 public static byte[] GetMemory(uint address, int length)
  11.                 {
  12.                     byte[] bytes = new byte[length];
  13.                     DEX.GetMemory(address, bytes);
  14.                     return bytes;
  15.                 }
  16.  
  17.                 public static int Init()
  18.                 {
  19.                     return RPC.Init();
  20.                 }
  21.             }
  22.  
  23.             public class RPC
  24.             {
  25.                 static uint function_address;
  26.  
  27.                 public static int Init()
  28.                 {
  29.                     //function_address = Get_func_address();
  30.                     //if (function_address == 0) return -1;
  31.                     function_address = 0x495D10; //1.07
  32.                     Enable_RPC();
  33.                     return 0;
  34.                 }
  35.  
  36.                 public static uint Get_func_address()
  37.                 {
  38.                     for (uint i = 0x489BD4; i < 0x1000000; i += 4)
  39.                     {
  40.                         byte[] bytes = GetMemory2(i, 8);
  41.                         if (((bytes[0] == 0x3C) && (bytes[1] == 0x8E) && (bytes[2] == 0xFA) && (bytes[3] == 0x35) && (bytes[4] == 0x42) && (bytes[5] == 0xC8) && (bytes[6] == 0x00) && (bytes[7] == 0x00)))
  42.                         {
  43.                             return i + 0xC;
  44.                         }
  45.                     }
  46.                     return 0;
  47.                 }
  48.  
  49.                 public static void Enable_RPC()
  50.                 {
  51.                     PS3.SetMemory(function_address, new byte[] { 0x4e, 0x80, 0, 0x20 });
  52.                     Thread.Sleep(20);
  53.                     byte[] memory = new byte[] {
  54.             0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x80, 60, 0x60, 0x10, 5, 0x81, 0x83, 0, 0x4c,
  55.             0x2c, 12, 0, 0, 0x41, 130, 0, 100, 0x80, 0x83, 0, 4, 0x80, 0xa3, 0, 8,
  56.             0x80, 0xc3, 0, 12, 0x80, 0xe3, 0, 0x10, 0x81, 3, 0, 20, 0x81, 0x23, 0, 0x18,
  57.             0x81, 0x43, 0, 0x1c, 0x81, 0x63, 0, 0x20, 0xc0, 0x23, 0, 0x24, 0xc0, 0x43, 0, 40,
  58.             0xc0, 0x63, 0, 0x2c, 0xc0, 0x83, 0, 0x30, 0xc0, 0xa3, 0, 0x34, 0xc0, 0xc3, 0, 0x38,
  59.             0xc0, 0xe3, 0, 60, 0xc1, 3, 0, 0x40, 0xc1, 0x23, 0, 0x48, 0x80, 0x63, 0, 0,
  60.             0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 60, 0x80, 0x10, 5, 0x38, 160, 0, 0,
  61.             0x90, 0xa4, 0, 0x4c, 0x90, 100, 0, 80, 0xe8, 1, 0, 0x80, 0x7c, 8, 3, 0xa6,
  62.             0x38, 0x21, 0, 0x70, 0x4e, 0x80, 0, 0x20
  63.          };
  64.                     PS3.SetMemory(function_address + 4, memory);
  65.                     PS3.SetMemory(0x10050000, new byte[0x2854]);
  66.                     PS3.SetMemory(function_address, new byte[] { 0xf8, 0x21, 0xff, 0x91 });
  67.                 }
  68.  
  69.                 public static uint Call(uint func_address, params object[] parameters)
  70.                 {
  71.                     int length = parameters.Length;
  72.                     uint num2 = 0;
  73.                     for (uint i = 0; i < length; i++)
  74.                     {
  75.                         if (parameters[i] is int)
  76.                         {
  77.                             byte[] array = BitConverter.GetBytes((int)parameters[i]);
  78.                             Array.Reverse(array);
  79.                             PS3.SetMemory(0x10050000 + ((i + num2) * 4), array);
  80.                         }
  81.                         else if (parameters[i] is uint)
  82.                         {
  83.                             byte[] buffer2 = BitConverter.GetBytes((uint)parameters[i]);
  84.                             Array.Reverse(buffer2);
  85.                             PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer2);
  86.                         }
  87.                         else if (parameters[i] is string)
  88.                         {
  89.                             byte[] buffer3 = Encoding.UTF8.GetBytes(Convert.ToString(parameters[i]) + "\0");
  90.                             PS3.SetMemory(0x10050054 + (i * 0x400), buffer3);
  91.                             uint num4 = 0x10050054 + (i * 0x400);
  92.                             byte[] buffer4 = BitConverter.GetBytes(num4);
  93.                             Array.Reverse(buffer4);
  94.                             PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer4);
  95.                         }
  96.                         else if (parameters[i] is float)
  97.                         {
  98.                             num2++;
  99.                             byte[] buffer5 = BitConverter.GetBytes((float)parameters[i]);
  100.                             Array.Reverse(buffer5);
  101.                             PS3.SetMemory(0x10050024 + ((num2 - 1) * 4), buffer5);
  102.                         }
  103.                     }
  104.                     byte[] bytes = BitConverter.GetBytes(func_address);
  105.                     Array.Reverse(bytes);
  106.                     PS3.SetMemory(0x1005004c, bytes);
  107.                     Thread.Sleep(20);
  108.                     byte[] memory = PS3.GetMemory(0x10050050, 4);
  109.                     Array.Reverse(memory);
  110.                     return BitConverter.ToUInt32(memory, 0);
  111.                 }
  112.             }
  113.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement