Advertisement
Astekk

BO2 RPC 1.19

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