sharkbait263

BO2 Hudelems 1.15

Dec 22nd, 2013
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.28 KB | None | 0 0
  1. public class Hudelem
  2.         {
  3.             public static uint
  4.                 type = 0x6D,
  5.                 xOffset = 0x00,
  6.                 yOffset = 0x04,
  7.                 textOffset = 0x62,
  8.                 sort = 32,
  9.                 fontSizeOffset = 0x0C,
  10.                 clientOffset = 0x7C,
  11.                 colorOffset = 0x18,
  12.                 GlowColor = 0x44,
  13.                 widthOffset = 0x58,
  14.                 heightOffset = 0x5A,
  15.                 shaderOffset = 0x74,
  16.                 Material = 0x71;
  17.  
  18.             public class HUD
  19.             {
  20.                 public static byte[] SetText(string Text)
  21.                 {
  22.                     byte[] clean = new byte[250];
  23.                     SetMemory(0x2000000, clean);
  24.                     SetMemory(0x2000000, Encoding.ASCII.GetBytes(Text + "\0"));
  25.                     byte[] Patch = new byte[] { 0x48, 0x44, 0xB3, 0x1D, 0x3C, 0x60, 0x00, 0xD8,
  26.                                                 0x80, 0x63, 0xBC, 0xD8, 0x2C, 0x03, 0x00, 0x00, 0x40, 0x82, 0x00, 0x7C, 0x3C, 0x60, 0x02, 0x00,
  27.                                                 0x30, 0x63, 0x00, 0x00, 0x4B, 0xED, 0xE4, 0xED, 0x3c, 0x80, 0x02, 0x00, 0x90, 0x64, 0x50, 0x00,
  28.                                                 0x48, 0x00, 0x00, 0x68, 0x4B, 0xFD, 0x80, 0x61 };
  29.  
  30.                     byte[] Unpatch = new byte[] { 0x48, 0x44, 0xB3, 0x1D, 0x3C, 0x60, 0x00,
  31.                                                   0xD8, 0x80, 0x63, 0xBC, 0xD8, 0x2C, 0x03, 0x00, 0x00, 0x41, 0x82, 0x00, 0x7C, 0x3C, 0x60, 0x00,
  32.                                                   0x39, 0x38, 0x80, 0x00, 0x00, 0x3B, 0xE3, 0x70, 0xE4, 0x63, 0x43, 0x00, 0x00, 0xC3, 0xFF, 0x00,
  33.                                                   0x08, 0xFC, 0x20, 0xF8, 0x90, 0x4B, 0xFD, 0x80, 0x61 };
  34.  
  35.                     SetMemory(0X03976DC, Patch);
  36.                     Thread.Sleep(100);
  37.                     SetMemory(0X03976DC, Unpatch);
  38.                     byte[] GetX = new byte[4];
  39.                     GetMemoryHUD(0x2005000, ref GetX);
  40.                     return GetX;
  41.                 }
  42.  
  43.                 public static byte[] uintBytes(uint input)
  44.                 {
  45.                     byte[] data = BitConverter.GetBytes(input);
  46.                     Array.Reverse(data);
  47.                     return data;
  48.                 }
  49.  
  50.                 private class MenuItems
  51.                 {
  52.                     public static uint Shader = 0, ScrollBarBackGround = 1;
  53.                 }
  54.  
  55.                 public static byte[] ReverseBytes(byte[] inArray)
  56.                 {
  57.                     Array.Reverse(inArray);
  58.                     return inArray;
  59.                 }
  60.  
  61.                 public static byte[] ToHexFloat(float Axis)
  62.                 {
  63.                     byte[] bytes = BitConverter.GetBytes(Axis);
  64.                     Array.Reverse(bytes);
  65.                     return bytes;
  66.                 }
  67.  
  68.                 public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
  69.                 {
  70.                     byte[] RGBA = new byte[4];
  71.                     byte[] RVal = BitConverter.GetBytes(Convert.ToInt32(R));
  72.                     byte[] GVal = BitConverter.GetBytes(Convert.ToInt32(G));
  73.                     byte[] BVal = BitConverter.GetBytes(Convert.ToInt32(B));
  74.                     byte[] AVal = BitConverter.GetBytes(Convert.ToInt32(A));
  75.                     RGBA[0] = RVal[0];
  76.                     RGBA[1] = GVal[0];
  77.                     RGBA[2] = BVal[0];
  78.                     RGBA[3] = AVal[0];
  79.                     return RGBA;
  80.                 }
  81.                 public static void ChangeWidth(int elemIndex, int width)
  82.                 {
  83.                     byte[] width_ = BitConverter.GetBytes(Convert.ToInt32(width));
  84.                     Array.Resize(ref width_, 2);
  85.                     Array.Reverse(width_);
  86.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
  87.                     Ps3Memory.SetMemory(elem + HElems.widthOffset, width_);
  88.                     Thread.Sleep(20);
  89.                 }
  90.         public static void ChangeText1(int index, string txt)
  91.                 {
  92.                     string NewText = txt + "\0";
  93.                     byte[] Textz = Hudelem.HUD.SetText(NewText);
  94.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(index)) * 0x88);
  95.                     Ps3Memory.SetMemory(elem + HElems.textOffset, Textz);
  96.                 }
  97.         public static void ChangeText2(int index, string txt, int xAxis)
  98.                 {
  99.                     string NewText = txt + "\0";
  100.                     byte[] Textz = Hudelem.HUD.SetText(NewText);
  101.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(index)) * 0x88);
  102.                     byte[] newX = new byte[4];
  103.                     newX = BitConverter.GetBytes(Convert.ToSingle(xAxis));
  104.                     Array.Reverse(newX);
  105.                     Ps3Memory.SetMemory(elem + HElems.xOffset, newX);
  106.                     Ps3Memory.SetMemory(elem + HElems.textOffset, Textz);
  107.                 }
  108.                 public void ChangeAlpha(int index, int r, int g, int b, int alpha)
  109.                 {
  110.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(index)) * 0x88);
  111.                     Ps3Memory.SetMemory(elem + HElems.colorOffset, RGBA(r, g, b, alpha));
  112.                 }
  113.                 public static void StoreIcon1(int elemIndex, uint client, int shader, int width, int height, int x, int y, uint align, float sort, int r, int g, int b, int a)
  114.                 {
  115.                     byte[] Material_ = BitConverter.GetBytes(shader);
  116.                     Array.Reverse(Material_);
  117.                     byte[] Height_ = BitConverter.GetBytes(Convert.ToInt32(height));
  118.                     Array.Resize(ref Height_, 2);
  119.                     Array.Reverse(Height_);
  120.                     byte[] width_ = BitConverter.GetBytes(Convert.ToInt32(width));
  121.                     Array.Resize(ref width_, 2);
  122.                     Array.Reverse(width_);
  123.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
  124.                     byte[] ClientID = ReverseBytes(BitConverter.GetBytes(client));
  125.                     SetMemory(elem, new byte[0x88]);
  126.                     SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(8)));
  127.                     SetMemory(elem + 0x79, new byte[] { 0xFF });
  128.                     SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
  129.                     SetMemory(elem + Hudelem.Material, Material_);
  130.                     SetMemory(elem + Hudelem.heightOffset, Height_);
  131.                     SetMemory(elem + Hudelem.widthOffset, width_);
  132.                     SetMemory(elem + Hudelem.textOffset + 4, ReverseBytes(BitConverter.GetBytes(sort)));
  133.                     SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
  134.                     SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
  135.                     SetMemory(elem + Hudelem.colorOffset, RGBA(r, g, b, a));
  136.                     SetMemory(elem + Hudelem.clientOffset, ClientID);
  137.                     System.Threading.Thread.Sleep(20);
  138.                 }
  139.  
  140.                 public static void StoreTextElem1(int elemIndex, int client, string text, int font, int fontScale, int x, int y, uint align, int sort, int R, int V, int B, int a)
  141.                 {
  142.                     string setText = text + "\0";
  143.                     byte[] TextIndex = SetText(setText);
  144.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
  145.                     byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
  146.                     SetMemory(elem, new byte[0x88]);
  147.                     SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
  148.                     SetMemory(elem + 0x79, new byte[] { 0xFF });
  149.                     SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
  150.                     SetMemory(elem + Hudelem.textOffset, TextIndex);
  151.                     SetMemory(elem + Hudelem.fontSizeOffset,
  152.                     ReverseBytes(BitConverter.GetBytes(Convert.ToSingle(font))));
  153.                     SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
  154.                     SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
  155.                     SetMemory(elem + Hudelem.colorOffset, RGBA(R, V, B, a));
  156.                     SetMemory(elem + Hudelem.clientOffset, ClientID);
  157.                     System.Threading.Thread.Sleep(20);
  158.                 }
  159.  
  160.                 public static void SetGlow(int elemIndex, int client, string text, int font, int fontScale, int x, int y, uint align, int sort, int R, int V, int B, int a, int GlowR, int GlowG, int GlowB, int GlowA)
  161.                 {
  162.                     string setText = text + "\0";
  163.                     byte[] TextIndex = SetText(setText);
  164.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(elemIndex)) * 0x88);
  165.                     byte[] ClientID = ReverseBytes(BitConverter.GetBytes(Convert.ToInt32(client)));
  166.                     SetMemory(elem, new byte[0x88]);
  167.                     SetMemory(elem + Hudelem.type, ReverseBytes(BitConverter.GetBytes(1)));
  168.                     SetMemory(elem + 0x79, new byte[] { 0xFF });
  169.                     SetMemory(elem + 0xC, new byte[] { 0x3f, 0xc0 });
  170.                     SetMemory(elem + Hudelem.textOffset, TextIndex);
  171.                     SetMemory(elem + Hudelem.fontSizeOffset,
  172.                     ReverseBytes(BitConverter.GetBytes(Convert.ToSingle(font))));
  173.                     SetMemory(elem + Hudelem.xOffset, ToHexFloat(x));
  174.                     SetMemory(elem + Hudelem.yOffset, ToHexFloat(y));
  175.                     SetMemory(elem + Hudelem.colorOffset, RGBA(R, V, B, a));
  176.                     SetMemory(elem + Hudelem.GlowColor,
  177.                               new byte[]
  178.                                   {
  179.                                       BitConverter.GetBytes(GlowR)[0], BitConverter.GetBytes (GlowG)[0],
  180.                                       BitConverter.GetBytes(GlowB)[0], BitConverter.GetBytes (GlowA)[0]
  181.                                   });
  182.                     SetMemory(elem + Hudelem.clientOffset, ClientID);
  183.                     System.Threading.Thread.Sleep(20);
  184.                 }
  185.  
  186.                 public static void MoveShader1(uint index, int X_, int Y_, float TextSize_)
  187.                 {
  188.                     byte[] X = new byte[4];
  189.                     byte[] Y = new byte[4];
  190.                     byte[] TextSize = new byte[4];
  191.                     X = BitConverter.GetBytes(Convert.ToSingle(X_));
  192.                     Y = BitConverter.GetBytes(Convert.ToSingle(Y_));
  193.                     TextSize = BitConverter.GetBytes(Convert.ToSingle(TextSize_));
  194.                     byte[] Width = new byte[4];
  195.                     byte[] Height = new byte[4];
  196.                     Array.Reverse(X);
  197.                     Array.Reverse(Y);
  198.                     Array.Reverse(TextSize);
  199.                     SetMemory(0x15D8400 + (index * 0x88) + 0, X);
  200.                     SetMemory(0x15D8400 + (index * 0x88) + 4, Y);
  201.                     SetMemory(0x15D8400 + (index * 0x88) + 12, TextSize);
  202.                 }
  203.  
  204.                 public static void MoveShader2(uint index, int X_, int Y_, int Width_, int Height_)
  205.                 {
  206.                     byte[] X = new byte[4];
  207.                     byte[] Y = new byte[4];
  208.                     X = BitConverter.GetBytes(Convert.ToSingle(X_));
  209.                     Y = BitConverter.GetBytes(Convert.ToSingle(Y_));
  210.                     byte[] Width = new byte[4];
  211.                     byte[] Height = new byte[4];
  212.                     Width = BitConverter.GetBytes(Width_);
  213.                     Height = BitConverter.GetBytes(Height_);
  214.                     Array.Reverse(X);
  215.                     Array.Reverse(Y);
  216.                     Array.Reverse(Width);
  217.                     Array.Reverse(Height);
  218.                     SetMemory(0x15D8400 + (index * 0x88) + 0, X);
  219.                     SetMemory(0x15D8400 + (index * 0x88) + 4, Y);
  220.                     SetMemory(0x15D8400 + (index * 0x88) + 68, Width);
  221.                     SetMemory(0x15D8400 + (index * 0x88) + 72, Height);
  222.                 }
  223.                 public static void DestroyElem(int index)
  224.                 {
  225.                     uint elem = 0x15D8400 + ((Convert.ToUInt32(index)) * 0x88);
  226.                     SetMemory(elem, new byte[0x88]);
  227.                 }
  228.             }
  229.         }
Advertisement
Add Comment
Please, Sign In to add comment