sharkbait263

MW3 RPC [1.24]

Apr 12th, 2014
2,114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.94 KB | None | 0 0
  1. //              <*><*><*><*><*><*><*><*><*><*><*><*>
  2. //              <*>  MW3 RPC <*> PS3Lib Required <*>
  3. //              <*>        Credits - Choco       <*>
  4. //                  <*><*><*><*><*><*><*><*><*><*><*><*>
  5.  
  6.  
  7. public static byte[] ReverseBytes(byte[] toReverse)
  8.         {
  9.             Array.Reverse(toReverse);
  10.             return toReverse;
  11.         }
  12.  
  13. public static void WriteSingle(uint address, float[] input)
  14.             {
  15.                 int length = input.Length;
  16.                 byte[] array = new byte[length * 4];
  17.                 for (int i = 0; i < length; i++)
  18.                 {
  19.                     ReverseBytes(BitConverter.GetBytes(input[i])).CopyTo(array, (int)(i * 4));
  20.                 }
  21.                 PS3.SetMemory(address, array);
  22.             }      
  23.  
  24.  private static uint RPCFogAddr;
  25.             public static int Init()
  26.             {
  27.                 RPCFogAddr = 0x3BC990;
  28.                 Enable();
  29.                 return 0;
  30.             }
  31.             public static void Enable()
  32.             {
  33.                 PS3.SetMemory(RPCFogAddr, new byte[] { 0x4E, 0x80, 0x00, 0x20 });
  34.                 Thread.Sleep(20);
  35.                 byte[] memory = new byte[]
  36.                     { 0x7C, 0x08, 0x02, 0xA6, 0xF8, 0x01, 0x00, 0x80, 0x3C, 0x60, 0x10, 0x02, 0x81, 0x83, 0x00, 0x4C,
  37.             0x2C, 0x0C, 0x00, 0x00, 0x41, 0x82, 0x00, 0x64, 0x80, 0x83, 0x00, 0x04, 0x80, 0xA3, 0x00, 0x08,
  38.             0x80, 0xC3, 0x00, 0x0C, 0x80, 0xE3, 0x00, 0x10, 0x81, 0x03, 0x00, 0x14, 0x81, 0x23, 0x00, 0x18,
  39.             0x81, 0x43, 0x00, 0x1C, 0x81, 0x63, 0x00, 0x20, 0xC0, 0x23, 0x00, 0x24, 0xc0, 0x43, 0x00, 0x28,
  40.             0xC0, 0x63, 0x00, 0x2C, 0xC0, 0x83, 0x00, 0x30, 0xC0, 0xA3, 0x00, 0x34, 0xc0, 0xC3, 0x00, 0x38,
  41.             0xC0, 0xE3, 0x00, 0x3C, 0xC1, 0x03, 0x00, 0x40, 0xC1, 0x23, 0x00, 0x48, 0x80, 0x63, 0x00, 0x00,
  42.             0x7D, 0x89, 0x03, 0xA6, 0x4E, 0x80, 0x04, 0x21, 0x3C, 0x80, 0x10, 0x02, 0x38, 0xA0, 0x00, 0x00,
  43.             0x90, 0xA4, 0x00, 0x4C, 0x90, 0x64, 0x00, 0x50, 0xE8, 0x01, 0x00, 0x80, 0x7C, 0x08, 0x03, 0xA6,
  44.             0x38, 0x21, 0x00, 0x70, 0x4E, 0x80, 0x00, 0x20 };
  45.                 PS3.SetMemory(RPCFogAddr + 4, memory);
  46.                 PS3.SetMemory(0x10020000, new byte[0x2854]);
  47.                 PS3.SetMemory(RPCFogAddr, new byte[] { 0xF8, 0x21, 0xFF, 0x91 });
  48.             }
  49.  
  50.             public static int CallFunc(uint func_address, params object[] parameters)
  51.             {
  52.                 int length = parameters.Length;
  53.                 int index = 0;
  54.                 uint num3 = 0;
  55.                 uint num4 = 0;
  56.                 uint num5 = 0;
  57.                 uint num6 = 0;
  58.                 while (index < length)
  59.                 {
  60.                     if (parameters[index] is int)
  61.                     {
  62.                         PS3.Extension.WriteInt32(0x10020000 + (num3 * 4), (int)parameters[index]);
  63.                         num3++;
  64.                     }
  65.                     else if (parameters[index] is uint)
  66.                     {
  67.                         PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), (uint)parameters[index]);
  68.                         num3++;
  69.                     }
  70.                     else
  71.                     {
  72.                         uint num7;
  73.                         if (parameters[index] is string)
  74.                         {
  75.                             num7 = 0x10022000 + (num4 * 0x400);
  76.                             PS3.Extension.WriteString(num7, Convert.ToString(parameters[index]));
  77.                             PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  78.                             num3++;
  79.                             num4++;
  80.                         }
  81.                         else if (parameters[index] is float)
  82.                         {
  83.                             PS3.Extension.WriteFloat(0x10020024 + (num5 * 4), (float)parameters[index]);
  84.                             num5++;
  85.                         }
  86.                         else if (parameters[index] is float[])
  87.                         {
  88.                             float[] input = (float[])parameters[index];
  89.                             num7 = 0x10021000 + (num6 * 4);
  90.                             WriteSingle(num7, input);
  91.                             PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  92.                             num3++;
  93.                             num6 += (uint)input.Length;
  94.                         }
  95.                     }
  96.                     index++;
  97.                 }
  98.                 PS3.Extension.WriteUInt32(0x1002004C, func_address);
  99.                 Thread.Sleep(20);
  100.                 return PS3.Extension.ReadInt32(0x10020050);
  101.             }
  102.  
  103. //Examples
  104. public static void SV_GameSendServerCommand(uint client, string command)
  105.             {
  106.                 RPC.CallFunc(0x228FA8, (uint)client, 0, command);
  107.             }
  108.  
  109.             public static void iPrintln(int client, string Text)
  110.             {
  111.                 SV_GameSendServerCommand((uint)client, "f \"" + Text + "\"");
  112.             }
Advertisement
Add Comment
Please, Sign In to add comment