Mathiis95

RPC - Grand Theft Auto V - 1.26 [PS3]

Apr 9th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.08 KB | None | 0 0
  1. public class RPC
  2.     {
  3.         public static CCAPI PS3 = new CCAPI();
  4.         private static uint SFA1 = 0x1BF5000;
  5.         private static uint EFA1 = 0x1BF5088;
  6.         private static uint SFA2 = 0x1BF5100;
  7.         private static uint EFA2 = 0x1BF5188;
  8.         private static uint SFA3 = 0x1BF5200;
  9.         private static uint EFA3 = 0x1BF5288;
  10.         private static uint BFA1 = 0x18614;
  11.         private static uint BAB1 = 0x18620;
  12.         private static uint BFA2 = 0x1271A00;
  13.         private static uint BAB2 = 0x1271A08;
  14.         private static uint BFA3 = 0x127205C;
  15.         private static uint BAB3 = 0x1272064;
  16.  
  17.         public static int Call(uint func_address, params object[] parameters)
  18.         {
  19.             int length = parameters.Length;
  20.             int index = 0;
  21.             uint num3 = 0;
  22.             uint num4 = 0;
  23.             uint num5 = 0;
  24.             uint num6 = 0;
  25.             while (index < length)
  26.             {
  27.                 if (parameters[index] is int)
  28.                 {
  29.                     PS3.Extension.WriteInt32(0x10020000 + (num3 * 4), (int)parameters[index]);
  30.                     num3++;
  31.                 }
  32.                 else if (parameters[index] is uint)
  33.                 {
  34.                     PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), (uint)parameters[index]);
  35.                     num3++;
  36.                 }
  37.                 else
  38.                 {
  39.                     uint num7;
  40.                     if (parameters[index] is string)
  41.                     {
  42.                         num7 = 0x10022000 + (num4 * 0x400);
  43.                         PS3.Extension.WriteString(num7, Convert.ToString(parameters[index]));
  44.                         PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  45.                         num3++;
  46.                         num4++;
  47.                     }
  48.                     else if (parameters[index] is float)
  49.                     {
  50.                         WriteSingle(0x10020024 + (num5 * 4), (float)parameters[index]);
  51.                         num5++;
  52.                     }
  53.                     else if (parameters[index] is float[])
  54.                     {
  55.                         float[] input = (float[])parameters[index];
  56.                         num7 = 0x10021000 + (num6 * 4);
  57.                         WriteSingle(num7, input);
  58.                         PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  59.                         num3++;
  60.                         num6 += (uint)input.Length;
  61.                     }
  62.                 }
  63.                 index++;
  64.             }
  65.             PS3.Extension.WriteUInt32(0x1002004c, func_address);
  66.             Thread.Sleep(20);
  67.             return PS3.Extension.ReadInt32(0x10020050);
  68.         }
  69.  
  70.         private static uint CBAB(uint F, uint T)
  71.         {
  72.             if (F > T)
  73.             {
  74.                 return (0x4c000000 - (F - T));
  75.             }
  76.             if (F < T)
  77.             {
  78.                 return ((T - F) + 0x48000000);
  79.             }
  80.             return 0x48000000;
  81.         }
  82.  
  83.         public static void Enable()
  84.         {
  85.             byte[] buffer = new byte[] { 0xf8, 0x21, 0xff, 0x91, 0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x80, 60, 0x60, 0x10, 2, 0x81, 0x83, 0, 0x4c, 0x2c, 12, 0, 0, 0x41, 130, 0, 100, 0x80, 0x83, 0, 4, 0x80, 0xa3, 0, 8, 0x80, 0xc3, 0, 12, 0x80, 0xe3, 0, 0x10, 0x81, 3, 0, 20, 0x81, 0x23, 0, 0x18, 0x81, 0x43, 0, 0x1c, 0x81, 0x63, 0, 0x20, 0xc0, 0x23, 0, 0x24, 0xc0, 0x43, 0, 40, 0xc0, 0x63, 0, 0x2c, 0xc0, 0x83, 0, 0x30, 0xc0, 0xa3, 0, 0x34, 0xc0, 0xc3, 0, 0x38, 0xc0, 0xe3, 0, 60, 0xc1, 3, 0, 0x40, 0xc1, 0x23, 0, 0x48, 0x80, 0x63, 0, 0, 0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 60, 0x80, 0x10, 2, 0x38, 160, 0, 0, 0x90, 0xa4, 0, 0x4c, 0x90, 100, 0, 80, 0xe8, 1, 0, 0x80, 0x7c, 8, 3, 0xa6, 0x38, 0x21, 0, 0x70 };
  86.             PS3.SetMemory(SFA1, buffer);
  87.             PS3.SetMemory(SFA2, buffer);
  88.             PS3.SetMemory(SFA3, buffer);
  89.             PS3.Extension.WriteUInt32(EFA1, CBAB(EFA1, BAB1));
  90.             PS3.Extension.WriteUInt32(BFA1, CBAB(BFA1, SFA1));
  91.             PS3.Extension.WriteUInt32(EFA2, CBAB(EFA2, BAB2));
  92.             PS3.Extension.WriteUInt32(BFA2, CBAB(BFA2, SFA2));
  93.             PS3.Extension.WriteUInt32(EFA3, CBAB(EFA3, BAB3));
  94.             PS3.Extension.WriteUInt32(BFA3, CBAB(BFA3, SFA3));
  95.         }
  96.  
  97.         private static byte[] ReverseBytes(byte[] toReverse)
  98.         {
  99.             Array.Reverse(toReverse);
  100.             return toReverse;
  101.         }
  102.  
  103.         private static void WriteSingle(uint address, float input)
  104.         {
  105.             byte[] array = new byte[4];
  106.             BitConverter.GetBytes(input).CopyTo(array, 0);
  107.             Array.Reverse(array, 0, 4);
  108.             PS3.SetMemory(address, array);
  109.         }
  110.  
  111.         private static void WriteSingle(uint address, float[] input)
  112.         {
  113.             int length = input.Length;
  114.             byte[] array = new byte[length * 4];
  115.             for (int i = 0; i < length; i++)
  116.             {
  117.                 ReverseBytes(BitConverter.GetBytes(input[i])).CopyTo(array, (int)(i * 4));
  118.             }
  119.             PS3.SetMemory(address, array);
  120.         }
  121.     }
  122. }
Add Comment
Please, Sign In to add comment