Advertisement
CrEaTiiOn_420

(Released, 1.13, C#) RPC To Make A Menu For MP and ZM (Stabl

Oct 13th, 2014
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.49 KB | None | 0 0
  1. //===================================================================================================//
  2. //                                 BO1 1.13 RPC By: CrEaTiiOn_420                                    //
  3. //===================================================================================================//
  4. // IF You Like My RPC Then Check Out My Thread And Give Me A Thanks Also If You Have Problems Then Just Post Your Question On The Thread Also -----> http://www.nextgenupdate.com/forums/black-ops-mods-patches-tutorials/770811-released-1-13-c-rpc-make-menu-mp-zm-stable-works.html
  5. //===================================================================================================//
  6. //         Also Check Out My New Channel <3--------> http://youtube.com/CrEaTiiOn420OG               //
  7. //===================================================================================================//
  8.  
  9.  
  10. public class RPC
  11.     {
  12.         public static UInt32 function_address = 0x6E34E0; //MP = 0x7A21E0  ||  ZM = 0x6E34E0
  13.  
  14.         public static void Enable_RPC()
  15.         {
  16.             PS3.SetMemory(function_address, new byte[] { 0x4e, 0x80, 0, 0x20 });
  17.             System.Threading.Thread.Sleep(20);
  18.             byte[] memory = new byte[] {
  19.             0x7c, 8, 2, 0xa6, 0xf8, 1, 0, 0x80, 60, 0x60, 0x10, 5, 0x81, 0x83, 0, 0x4c,
  20.             0x2c, 12, 0, 0, 0x41, 130, 0, 100, 0x80, 0x83, 0, 4, 0x80, 0xa3, 0, 8,
  21.             0x80, 0xc3, 0, 12, 0x80, 0xe3, 0, 0x10, 0x81, 3, 0, 20, 0x81, 0x23, 0, 0x18,
  22.             0x81, 0x43, 0, 0x1c, 0x81, 0x63, 0, 0x20, 0xc0, 0x23, 0, 0x24, 0xc0, 0x43, 0, 40,
  23.             0xc0, 0x63, 0, 0x2c, 0xc0, 0x83, 0, 0x30, 0xc0, 0xa3, 0, 0x34, 0xc0, 0xc3, 0, 0x38,
  24.             0xc0, 0xe3, 0, 60, 0xc1, 3, 0, 0x40, 0xc1, 0x23, 0, 0x48, 0x80, 0x63, 0, 0,
  25.             0x7d, 0x89, 3, 0xa6, 0x4e, 0x80, 4, 0x21, 60, 0x80, 0x10, 5, 0x38, 160, 0, 0,
  26.             0x90, 0xa4, 0, 0x4c, 0x90, 100, 0, 80, 0xe8, 1, 0, 0x80, 0x7c, 8, 3, 0xa6,
  27.             0x38, 0x21, 0, 0x70, 0x4e, 0x80, 0, 0x20
  28.          };
  29.             PS3.SetMemory(function_address + 4, memory);
  30.             PS3.SetMemory(0x10050000, new byte[0x2854]);
  31.             PS3.SetMemory(function_address, new byte[] { 0xf8, 0x21, 0xff, 0x91 });
  32.         }
  33.  
  34.         public static uint Call(uint func_address, params object[] parameters)
  35.         {
  36.             int length = parameters.Length;
  37.             uint num2 = 0;
  38.             for (uint i = 0; i < length; i++)
  39.             {
  40.                 if (parameters[i] is int)
  41.                 {
  42.                     byte[] array = BitConverter.GetBytes((int)parameters[i]);
  43.                     Array.Reverse(array);
  44.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), array);
  45.                 }
  46.                 else if (parameters[i] is uint)
  47.                 {
  48.                     byte[] buffer2 = BitConverter.GetBytes((uint)parameters[i]);
  49.                     Array.Reverse(buffer2);
  50.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer2);
  51.                 }
  52.                 else if (parameters[i] is string)
  53.                 {
  54.                     byte[] buffer3 = Encoding.UTF8.GetBytes(Convert.ToString(parameters[i]) + "\0");
  55.                     PS3.SetMemory(0x10050054 + (i * 0x400), buffer3);
  56.                     uint num4 = 0x10050054 + (i * 0x400);
  57.                     byte[] buffer4 = BitConverter.GetBytes(num4);
  58.                     Array.Reverse(buffer4);
  59.                     PS3.SetMemory(0x10050000 + ((i + num2) * 4), buffer4);
  60.                 }
  61.                 else if (parameters[i] is float)
  62.                 {
  63.                     num2++;
  64.                     byte[] buffer5 = BitConverter.GetBytes((float)parameters[i]);
  65.                     Array.Reverse(buffer5);
  66.                     PS3.SetMemory(0x10050024 + ((num2 - 1) * 4), buffer5);
  67.                 }
  68.             }
  69.             byte[] bytes = BitConverter.GetBytes(func_address);
  70.             Array.Reverse(bytes);
  71.             PS3.SetMemory(0x1005004c, bytes);
  72.             System.Threading.Thread.Sleep(20);
  73.             byte[] memory = new byte[4];
  74.             PS3.GetMemoryR(0x10050050, ref memory);
  75.             Array.Reverse(memory);
  76.             return BitConverter.ToUInt32(memory, 0);
  77.         }
  78.     }
  79.  
  80. //Hud Elements
  81. //============
  82.  
  83. public class Huds
  84.         {
  85.             public class HudStruct
  86.             {
  87.                 public static uint
  88.                     G_HudElems = 0x00EE7B84,
  89.                 IndexSize = 0x84,
  90.                 x = 0x0,
  91.                 y = 0x4,
  92.                 z = 0x8,
  93.                 fontScaleStartTime = 0x14,
  94.                 fontScale = 0xC,
  95.                 entNum = 0x18,
  96.                 color = 0x18,
  97.                 teamNum = 0x1C,
  98.                 fromColor = 0x1C,
  99.                 icon = 0x20,
  100.                 fadeStartTime = 0x20,
  101.                 scaleStartTime = 0x24,
  102.                 fromX = 0x28,
  103.                 fromY = 0x2C,
  104.                 moveStartTime = 0x30,
  105.                 time = 0x34,
  106.                 duration = 0x38,
  107.                 value = 0x3C,
  108.                 sort = 0x40,
  109.                 glowColor = 0x44,
  110.                 fxBirthTime = 0x48,
  111.                 targetEntNum = 0x4C,
  112.                 fontScaleTime = 0x4E,
  113.                 fadeTime = 0x50,
  114.                 label = 0x52,
  115.                 width = 0x54,
  116.                 height = 0x56,
  117.                 fromWidth = 0x58,
  118.                 fromHeight = 0x5A,
  119.                 scaleTime = 0x5C,
  120.                 moveTime = 0x5E,
  121.                 text = 0x60,
  122.                 fxDecayStartTime = 0x64,
  123.                 fxDecayDuration = 0x66,
  124.                 fxRedactDecayStartTime = 0x68,
  125.                 fxRedactDecayDuration = 0x6A,
  126.                 flags = 0x6C,
  127.                 type = 0x6E,
  128.                 font = 0x6F,
  129.                 alignOrg = 0x70,
  130.                 alignScreen = 0x71,
  131.                 materialIndex = 0x72,
  132.                 fxLetterTime = 0x62,
  133.                 offscreenMaterialIdx = 0x73,
  134.                 fromAlignOrg = 0x74,
  135.                 fromAlignScreen = 0x75,
  136.                 soundID = 0x76,
  137.                 ui3dWindow = 0x77,
  138.                 clientNum = 0x78,
  139.                 team = 0x7C,
  140.                 archived = 0x80;
  141.             }
  142.             public static short G_LocalizedStringIndex(string Text)
  143.             {
  144.                 return (short)RPC.Call(0x00304BA0, Text);
  145.             }
  146.             public static void ChangeText(UInt32 elemIndex, String Text)
  147.             {
  148.                 PS3.Extension.WriteInt16(elemIndex + HudStruct.text, G_LocalizedStringIndex(Text));
  149.             }
  150.             public static uint SetText(int clientIndex, string TextString, int Font, Single FontSize, Single X, Single Y, uint align = 0, int r = 255, int g = 255, int b = 255, int a = 255, int glowr = 255, int glowg = 255, int glowb = 255, int glowa = 0)
  151.             {
  152.                 uint text = HudElem_Alloc();
  153.                 PS3.Extension.WriteByte(text + HudStruct.type, 1);
  154.                 Funcs.WriteSingle(text + HudStruct.fontScale, FontSize);
  155.                 PS3.Extension.WriteByte(text + HudStruct.font, Convert.ToByte(Font));
  156.                 if (align != 0)
  157.                 { PS3.Extension.WriteByte(text + HudStruct.alignOrg, 5); PS3.Extension.WriteByte(text + HudStruct.alignScreen, Convert.ToByte(align)); }
  158.                 else
  159.                 { Funcs.WriteSingle(text + HudStruct.x, X); Funcs.WriteSingle(text + HudStruct.y, Y); }
  160.                 PS3.Extension.WriteInt32(text + HudStruct.clientNum, clientIndex);
  161.                 PS3.Extension.WriteInt16(text + HudStruct.text, G_LocalizedStringIndex(TextString));
  162.                 PS3.Extension.WriteBytes(text + HudStruct.color, new Byte[] { (Byte)r, (Byte)g, (Byte)b, (Byte)a });
  163.                 PS3.Extension.WriteBytes(text + HudStruct.glowColor, new Byte[] { (Byte)glowr, (Byte)glowg, (Byte)glowb, (Byte)glowa });
  164.                 PS3.Extension.WriteByte(text + HudStruct.ui3dWindow, 0xFF);
  165.                 return text;
  166.             }
  167.             public static uint SetShader(int clientIndex, int Material, short Width, short Height, Single X, Single Y, uint align = 0, int r = 255, int g = 255, int b = 255, int a = 255)
  168.             {
  169.                 uint Shader = HudElem_Alloc();
  170.                 PS3.Extension.WriteByte(Shader + HudStruct.type, 4);
  171.                 PS3.Extension.WriteByte(Shader + HudStruct.materialIndex, Convert.ToByte(Material));
  172.                 PS3.Extension.WriteInt16(Shader + HudStruct.height, Height);
  173.                 PS3.Extension.WriteInt16(Shader + HudStruct.width, Width);
  174.                 if (align != 0)
  175.                 { PS3.Extension.WriteByte(Shader + HudStruct.alignOrg, 5); PS3.Extension.WriteByte(Shader + HudStruct.alignScreen, Convert.ToByte(align)); }
  176.                 else
  177.                 { Funcs.WriteSingle(Shader + HudStruct.x, X); Funcs.WriteSingle(Shader + HudStruct.y, Y); }
  178.                 PS3.Extension.WriteInt32(Shader + HudStruct.clientNum, clientIndex);
  179.                 PS3.SetMemory(Shader + HudStruct.ui3dWindow, new Byte[] { 0xFF });
  180.                 PS3.Extension.WriteBytes(Shader + HudStruct.color, new Byte[] { (Byte)r, (Byte)g, (Byte)b, (Byte)a });
  181.                 return Shader;
  182.             }
  183.             public static uint HudElem_Alloc()
  184.             {
  185.                 for (uint i = 40; i < 1024; i++)
  186.                 {
  187.                     uint Index = HudStruct.G_HudElems + (i * HudStruct.IndexSize);
  188.                     if (PS3.Extension.ReadByte(Index + HudStruct.type) == 0)
  189.                     {
  190.                         PS3.Extension.WriteBytes(Index, new Byte[0x88]);
  191.                         return Index;
  192.                     }
  193.                 }
  194.                 return 0;
  195.             }
  196.             public static void DestroyElement(uint Element)
  197.             {
  198.                 PS3.SetMemory(Element, new byte[HudStruct.IndexSize]);
  199.             }
  200.         }
  201.  
  202. //Buttons Monitoring
  203. //==================
  204.  
  205. public static class Buttons
  206.         {
  207.             public static Int32
  208.                 L1 = 1048704,
  209.                 L2 = 72704,
  210.                 L3 = 1074003968,
  211.                 R1 = -2147483648,
  212.                 R2 = 131072,
  213.                 R3 = 536870912,
  214.                 Square = 67108864,
  215.                 Cross = 2104320,
  216.                 Crouch = 4194304,
  217.                 Prone = 8388608,
  218.                 Triangle = 8;
  219.         }
  220.         public static bool ButtonPressed(int client, int Button)
  221.         {
  222.             if (Convert.ToInt32(PS3.Extension.ReadInt32(0x11007E8 + ((uint)client * 0x1D30))) == Button)
  223.                 return true;
  224.             else return false;
  225.         }
  226.  
  227. //Addresses
  228. //=========
  229.  
  230.  class Addresses
  231.         {
  232.             public static uint
  233.             G_entityZM = 0xFA805C,
  234.             G_entitySizeZM = 0x34C,
  235.             G_clientZM = 0x010fed78,
  236.             G_clientSizeZM = 0x1D30;
  237.         }
  238.  
  239. //Functions
  240. //=========
  241.  
  242. public static string GetPlayerNameForMenu(Int32 clientIndex)
  243.             {
  244.                 String Name = PS3.Extension.ReadString(0x011008B8 + ((uint)clientIndex * 0x1d30));
  245.                 if (Name == "")
  246.                     return "Not Connected";
  247.                 else
  248.                     return Name;
  249.             }
  250.  
  251. public string GetMap()
  252.         {
  253.             return PS3.Extension.ReadString(0x0138E1B8);
  254.         }
  255.  
  256. public int getMapMaterialWhiteShader()
  257.         {
  258.             string map = GetMap();
  259.             if (map == "zombie_theater")
  260.             {
  261.                 return 18;
  262.             }
  263.             if (map == "zombie_pentagon")
  264.             {
  265.                 return 17;
  266.             }
  267.             if (map == "zombie_cod5_prototype")
  268.             {
  269.                 return 16;
  270.             }
  271.             if (map == "zombie_asylum")
  272.             {
  273.                 return 16;
  274.             }
  275.             if (map == "zombie_swamp")
  276.             {
  277.                 return 16;
  278.             }
  279.             if (map == "zombie_cod5_factory")
  280.             {
  281.                 return 16;
  282.             }
  283.             if (map == "zombie_cosmodrome")
  284.             {
  285.                 return 16;
  286.             }
  287.             if (map == "zombie_coast")
  288.             {
  289.                 return 19;
  290.             }
  291.             if (map == "zombie_temple")
  292.             {
  293.                 return 17;
  294.             }
  295.             if (map == "zombie_paris")
  296.             {
  297.                 return 16;
  298.             }
  299.             else
  300.             {
  301.                 return 0;
  302.             }
  303.         }
  304.  
  305.         public int getMapMaterialBlackShader()
  306.         {
  307.             string map = GetMap();
  308.             if (map == "zombie_theater")
  309.             {
  310.                 return 11;
  311.             }
  312.             if (map == "zombie_pentagon")
  313.             {
  314.                 return 10;
  315.             }
  316.             if (map == "zombie_cod5_prototype")
  317.             {
  318.                 return 9;
  319.             }
  320.             if (map == "zombie_asylum")
  321.             {
  322.                 return 9;
  323.             }
  324.             if (map == "zombie_swamp")
  325.             {
  326.                 return 9;
  327.             }
  328.             if (map == "zombie_cod5_factory")
  329.             {
  330.                 return 9;
  331.             }
  332.             if (map == "zombie_cosmodrome")
  333.             {
  334.                 return 9;
  335.             }
  336.             if (map == "zombie_coast")
  337.             {
  338.                 return 12;
  339.             }
  340.             if (map == "zombie_temple")
  341.             {
  342.                 return 10;
  343.             }
  344.             if (map == "zombie_paris")
  345.             {
  346.                 return 9;
  347.             }
  348.             else
  349.             {
  350.                 return 0;
  351.             }
  352.         }
  353.  
  354.         public static int GetHost()
  355.         {
  356.             string Host = PS3.Extension.ReadString(0x01C33DB0);
  357.             int i = 0;
  358.             if (Host == "")
  359.             {
  360.                 i = 0;
  361.             }
  362.             else if (Host == PS3.Extension.ReadString(0x011008B8 + (0 * 0x1d30)))
  363.             {
  364.                 i = 0;
  365.             }
  366.             else if (Host == PS3.Extension.ReadString(0x011008B8 + (1 * 0x1d30)))
  367.             {
  368.                 i = 1;
  369.             }
  370.             else if (Host == PS3.Extension.ReadString(0x011008B8 + (2 * 0x1d30)))
  371.             {
  372.                 i = 2;
  373.             }
  374.             else if (Host == PS3.Extension.ReadString(0x011008B8 + (3 * 0x1d30)))
  375.             {
  376.                 i = 3;
  377.             }
  378.             return i;
  379.         }
  380.  
  381. public static void SV_GameSendServerCommand(int client, string command)
  382.             {
  383.                 RPC.Call(0x003C33A8, client, 1, command);
  384.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement