Advertisement
IndieDeveloper

RPC

May 15th, 2016
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.65 KB | None | 0 0
  1. public class RPC
  2.     {
  3.         private static uint function_address;
  4.  
  5.         public static int Call(uint func_address, params object[] parameters)
  6.         {
  7.             int length = parameters.Length;
  8.             int index = 0;
  9.             uint num3 = 0;
  10.             uint num4 = 0;
  11.             uint num5 = 0;
  12.             uint num6 = 0;
  13.             while (index < length)
  14.             {
  15.                 if (parameters[index] is int)
  16.                 {
  17.                     PS3.Extension.WriteInt32(0x10020000 + (num3 * 4), (int)parameters[index]);
  18.                     num3++;
  19.                 }
  20.                 else if (parameters[index] is uint)
  21.                 {
  22.                     PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), (uint)parameters[index]);
  23.                     num3++;
  24.                 }
  25.                 else
  26.                 {
  27.                     uint num7;
  28.                     if (parameters[index] is string)
  29.                     {
  30.                         num7 = 0x10022000 + (num4 * 0x400);
  31.                         PS3.Extension.WriteString(num7, Convert.ToString(parameters[index]));
  32.                         PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  33.                         num3++;
  34.                         num4++;
  35.                     }
  36.                     else if (parameters[index] is float)
  37.                     {
  38.                         PS3.Extension.WriteFloat(0x10020024 + (num5 * 4), (float)parameters[index]);
  39.                         num5++;
  40.                     }
  41.                     else if (parameters[index] is float[])
  42.                     {
  43.                         float[] input = (float[])parameters[index];
  44.                         num7 = 0x10021000 + (num6 * 4);
  45.                         Lib.WriteSingle(num7, input);
  46.                         PS3.Extension.WriteUInt32(0x10020000 + (num3 * 4), num7);
  47.                         num3++;
  48.                         num6 += (uint)input.Length;
  49.                     }
  50.                 }
  51.                 index++;
  52.             }
  53.             PS3.Extension.WriteUInt32(0x1002004C, func_address);
  54.             Thread.Sleep(20);
  55.             return PS3.Extension.ReadInt32(0x10020050);
  56.         }
  57.  
  58.         public static void Enable()
  59.         {
  60.             PS3.SetMemory(function_address, new byte[] { 0x4E, 0x80, 0x00, 0x20 });
  61.             Thread.Sleep(20);
  62.             byte[] memory = new byte[]
  63.                     { 0x7C, 0x08, 0x02, 0xA6, 0xF8, 0x01, 0x00, 0x80, 0x3C, 0x60, 0x10, 0x02, 0x81, 0x83, 0x00, 0x4C,
  64.             0x2C, 0x0C, 0x00, 0x00, 0x41, 0x82, 0x00, 0x64, 0x80, 0x83, 0x00, 0x04, 0x80, 0xA3, 0x00, 0x08,
  65.             0x80, 0xC3, 0x00, 0x0C, 0x80, 0xE3, 0x00, 0x10, 0x81, 0x03, 0x00, 0x14, 0x81, 0x23, 0x00, 0x18,
  66.             0x81, 0x43, 0x00, 0x1C, 0x81, 0x63, 0x00, 0x20, 0xC0, 0x23, 0x00, 0x24, 0xc0, 0x43, 0x00, 0x28,
  67.             0xC0, 0x63, 0x00, 0x2C, 0xC0, 0x83, 0x00, 0x30, 0xC0, 0xA3, 0x00, 0x34, 0xc0, 0xC3, 0x00, 0x38,
  68.             0xC0, 0xE3, 0x00, 0x3C, 0xC1, 0x03, 0x00, 0x40, 0xC1, 0x23, 0x00, 0x48, 0x80, 0x63, 0x00, 0x00,
  69.             0x7D, 0x89, 0x03, 0xA6, 0x4E, 0x80, 0x04, 0x21, 0x3C, 0x80, 0x10, 0x02, 0x38, 0xA0, 0x00, 0x00,
  70.             0x90, 0xA4, 0x00, 0x4C, 0x90, 0x64, 0x00, 0x50, 0xE8, 0x01, 0x00, 0x80, 0x7C, 0x08, 0x03, 0xA6,
  71.             0x38, 0x21, 0x00, 0x70, 0x4E, 0x80, 0x00, 0x20 };
  72.             PS3.SetMemory(function_address + 4, memory);
  73.             PS3.SetMemory(0x10020000, new byte[0x2854]);
  74.             PS3.SetMemory(function_address, new byte[] { 0xF8, 0x21, 0xFF, 0x91 });
  75.         }
  76.  
  77.         public static int Init()
  78.         {
  79.             function_address = 0x007AA050;
  80.             Enable();
  81.             return 0;
  82.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement