Advertisement
Mango_Knife

Call Of Duty Ghosts - HuDElements 1.14

Jun 10th, 2014
597
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 14.22 KB | None | 0 0
  1.                 #region HuDElements
  2.                 public static class HElems
  3.                 {
  4.                     public static uint
  5.                         //Thanks to: īTnDM, BadLuckBrian, Unknuawn, Mango_Knife.
  6.                     ELEM = G_HuDElem,
  7.                     FIX_ELEM = 0x3447F,
  8.                     FPS = 0x36D410,
  9.                     G_HuDElem = 0xD87D88,
  10.                     G_LocalizedStringIndex = 0x34438,
  11.                     Huds_Text = 0x2500000,
  12.                     Huds_Return = 0x2505000,
  13.                     Level_locals_t = 0xDB5E04,
  14.                     LevelTime = Level_locals_t + 0x540,
  15.                     G_LocalizedString = G_LocalizedStringIndex,
  16.                     type = 0x00,
  17.                     xOffset = 0x04,
  18.                     yOffset = 0x08,
  19.                     zOffset = 0x0C,
  20.                     targetEntNum = 0x10,
  21.                     fontScale = 0x14,
  22.                     fromFontScale = 0x18,
  23.                     fontScaleStartTime = 0x1C,
  24.                     fontScaleTime = 0x20,
  25.                     font = 0x24,
  26.                     alignOrg = 0x28,
  27.                     alignScreen = 0x2C,
  28.                      color = 0x30,
  29.                      fromColor = 0x34,
  30.                      fadeStartTime = 0x38,
  31.                      fadeTime = 0x3C,
  32.                      label = 0x40,
  33.                      text = 0x42,
  34.                      width = 0x44,
  35.                      height = 0x48,
  36.                      materialIndex = 0x4C,
  37.                      fromWidth = 0x50,
  38.                      fromHeight = 0x54,
  39.                      scaleStartTime = 0x58,
  40.                      scaleTime = 0x5C,
  41.                      fromX = 0x60,
  42.                      fromY = 0x64,
  43.                      fromAlignOrg = 0x68,
  44.                      fromAlignScreen = 0x6C,
  45.                      moveStartTime = 0x70,
  46.                      moveTime = 0x74,
  47.                      time = 0x78,
  48.                      duration = 0x7C,
  49.                      value = 0x80,
  50.                      sort = 0x88,
  51.                      glowColor = 0x8C,
  52.                      fxBirthTime = 0x90,
  53.                      fxLetterTime = 0x94,
  54.                      fxDecayStartTime = 0x98,
  55.                      fxDecayDuration = 0x9C,
  56.                      soundID = 0xA0,
  57.                     flags = 0xA4,
  58.                     clientOffset = 0xA8;
  59.                 }
  60.                 public static int getLevelTime()
  61.                 {
  62.                     return PS3.Extension.ReadInt32(HElems.LevelTime);
  63.                 }
  64.                 public static void SetGlow(uint elemIndex, int r, int g, int b, int a)
  65.                 {
  66.                     uint num = HElems.ELEM + (elemIndex * 0xb8);
  67.                     PS3.SetMemory(num + HElems.glowColor, RGBA(r, g, b, a));
  68.                 }
  69.                 public static void Enable_Huds()
  70.                 {
  71.                     PS3.SetMemory(0x2100000, new byte[0x20]);
  72.                     PS3.SetMemory(0x2106000, new byte[0x20]);
  73.                     PS3.SetMemory(HElems.FPS, new byte[] {  
  74.                 60, 0x60, 2, 0x10, 0x80, 0x83, 0, 0, 0x2c, 4, 0, 0, 0x41, 130, 0, 140,  
  75.                 0x4b, 0xcc, 0x77, 0x69, 60, 0x80, 2, 0x10, 0x90, 100, 80, 0, 0x38, 0x60, 0, 0,  
  76.                 0x90, 100, 0, 0, 0x48, 0, 0, 0x74
  77.              });
  78.                     PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 1 });
  79.                 }
  80.                 public static void ActivateIndex(int index, int type)
  81.                 {
  82.                     byte[] Typ = BitConverter.GetBytes(type);
  83.                     Array.Reverse(Typ);
  84.                     PS3.SetMemory(HElems.ELEM + 0xb8 * (uint)index, Typ);
  85.                 }
  86.                 public static byte[] ToHexFloat(float Axis)
  87.                 {
  88.                     byte[] bytes = BitConverter.GetBytes(Axis);
  89.                     Array.Reverse(bytes);
  90.                     return bytes;
  91.                 }
  92.                 public static byte[] RGBA(decimal R, decimal G, decimal B, decimal A)
  93.                 {
  94.                     byte[] RGBA = new byte[4];
  95.                     byte[] RVal = BitConverter.GetBytes(Convert.ToInt32(R));
  96.                     byte[] GVal = BitConverter.GetBytes(Convert.ToInt32(G));
  97.                     byte[] BVal = BitConverter.GetBytes(Convert.ToInt32(B));
  98.                     byte[] AVal = BitConverter.GetBytes(Convert.ToInt32(A));
  99.                     RGBA[0] = RVal[0];
  100.                     RGBA[1] = GVal[0];
  101.                     RGBA[2] = BVal[0];
  102.                     RGBA[3] = AVal[0];
  103.                     return RGBA;
  104.                 }
  105.                 //StoreIcon
  106.                 public static void StoreIcon(int elemIndex, uint client, int shader, int width, int height, float x, float y, uint align, float sort, int r, int g, int b, int a)
  107.                 {
  108.                     uint offset = (uint)(HElems.G_HuDElem + (elemIndex * 0xb8));
  109.                     PS3.SetMemory(offset, new byte[0xb8]);
  110.                     byte[] buffer = new byte[4];
  111.                     buffer[3] = 4;
  112.                     PS3.SetMemory(offset, buffer);
  113.                     PS3.Extension.WriteInt32(offset + HElems.materialIndex, shader);
  114.                     PS3.Extension.WriteInt32(offset + HElems.clientOffset, (int)client);
  115.                     PS3.Extension.WriteInt32(offset + HElems.width, width);
  116.                     PS3.Extension.WriteInt32(offset + HElems.height, height);
  117.                     PS3.Extension.WriteInt32(offset + HElems.alignScreen, 0);
  118.                     PS3.Extension.WriteInt32(offset + HElems.alignOrg, 0);
  119.                     PS3.Extension.WriteFloat(offset + HElems.xOffset, x);
  120.                     PS3.Extension.WriteFloat(offset + HElems.yOffset, y);
  121.                     PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
  122.                 }
  123.                 #region GetMemory
  124.                 public static byte[] GetMemory(uint Offset, int Length)
  125.                 {
  126.                     byte[] buffer = new byte[Length];
  127.                     PS3.GetMemory(Offset, buffer);
  128.                     return buffer;
  129.                 }
  130.                 public static void GetMemoryref(uint Address, ref byte[] Bytes)
  131.                 {
  132.                     PS3.GetMemory(Address, Bytes);
  133.                 }
  134.                 #endregion
  135.                 public static byte[] CacheString(string Text)
  136.                 {
  137.                     PS3.SetMemory(HElems.FIX_ELEM, new byte[] { 0x01 }); //must patch this to make it work
  138.                     PS3.SetMemory(0x2100000, Encoding.ASCII.GetBytes(Text + "\0"));
  139.                     byte[] result = new byte[6];
  140.                     Thread.Sleep(10);
  141.                     GetMemoryref(0x2106000, ref result);
  142.                     return result;
  143.                 }
  144.                 //StoreTextElem
  145.                 public static void StoreTextElem(int elemIndex, int client, string Text, short font, float fontSize, float x, float y, uint align, float sort, int r, int g, int b, int a)
  146.                 {
  147.                     uint offset = HElems.ELEM + (Convert.ToUInt32(elemIndex) * 0xb8);
  148.                     PS3.SetMemory(offset, new byte[0xb8]);
  149.                     byte[] buffer = new byte[4];
  150.                     buffer[3] = 1;
  151.                     PS3.SetMemory(offset, buffer);
  152.                     PS3.Extension.WriteInt16(offset + HElems.text, G_LocalizedStringIndex(Text));
  153.                     PS3.Extension.WriteInt32(offset + HElems.font, font);
  154.                     PS3.Extension.WriteInt32(offset + HElems.clientOffset, client);
  155.                     PS3.Extension.WriteFloat(offset + HElems.fontScale, fontSize);
  156.                     PS3.Extension.WriteFloat(offset + HElems.xOffset, x);
  157.                     PS3.Extension.WriteFloat(offset + HElems.yOffset, y);
  158.                     PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
  159.                 }
  160.                 #region LocalizedStringFunction
  161.                 public static short G_LocalizedStringIndex(string Text)
  162.                 {
  163.                     UInt32 G_LocalizedStringIndexOff = HElems.G_LocalizedString;
  164.                     PS3.Extension.WriteByte(G_LocalizedStringIndexOff + 0x48, 0x41);
  165.                     short StringT = (short)RPC.CallFunction(G_LocalizedStringIndexOff, new object[] { Text });
  166.                     PS3.Extension.WriteByte(G_LocalizedStringIndexOff + 0x48, 0x40);
  167.                     return StringT;
  168.                 }
  169.                 #endregion
  170.                 //doTypewriter
  171.                 public static void doTypeWriter(uint ElemIndex, int client, string text, double fontScale, short font, float X, float Y, int fxLetterTime, int fxDecayStartTime, int fxDecayDuration, int r, int g, int b, int a, int r1, int b1, int g1, int a1)
  172.                 {
  173.                     uint offset = HElems.ELEM + (Convert.ToUInt32(ElemIndex) * 0xb8);
  174.                     PS3.SetMemory(offset, new byte[0xb8]);
  175.                     byte[] buffer = new byte[4];
  176.                     buffer[3] = 1;
  177.                     PS3.SetMemory(offset, buffer);
  178.                     PS3.Extension.WriteInt16(offset + HElems.text, G_LocalizedStringIndex(text));
  179.                     PS3.Extension.WriteInt16(offset + HElems.font, font);
  180.                     PS3.Extension.WriteInt32(offset + HElems.clientOffset, client);
  181.                     PS3.Extension.WriteInt16(offset + HElems.alignScreen, 0);
  182.                     PS3.Extension.WriteInt16(offset + HElems.alignOrg, 0);
  183.                     PS3.Extension.WriteFloat(offset + HElems.fontScale, (float)fontScale);
  184.                     PS3.Extension.WriteFloat(offset + HElems.xOffset, X);
  185.                     PS3.Extension.WriteFloat(offset + HElems.yOffset, Y);
  186.                     PS3.SetMemory(offset + HElems.color, RGBA(r, g, b, a));
  187.                     PS3.SetMemory(offset + HElems.glowColor, RGBA(r1, g1, b1, a1));
  188.                     PS3.Extension.WriteInt32(offset + HElems.fxBirthTime, getLevelTime());
  189.                     PS3.Extension.WriteInt32(offset + HElems.fxLetterTime, fxLetterTime);
  190.                     PS3.Extension.WriteInt32(offset + HElems.fxDecayStartTime, fxDecayStartTime);
  191.                     PS3.Extension.WriteInt32(offset + HElems.fxDecayDuration, fxDecayDuration);
  192.                 }
  193.                 public static uint MoveOverTime(uint elemIndex, short Time, float X, float Y)
  194.                 {
  195.                     uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
  196.                     PS3.Extension.WriteFloat(Elem + HElems.fromX, PS3.Extension.ReadFloat(Elem + HElems.xOffset));
  197.                     PS3.Extension.WriteFloat(Elem + HElems.fromY, PS3.Extension.ReadFloat(Elem + HElems.yOffset));
  198.                     PS3.Extension.WriteInt32(Elem + HElems.moveTime, Time);
  199.                     PS3.Extension.WriteInt32(Elem + HElems.moveStartTime, getLevelTime());
  200.                     PS3.Extension.WriteFloat(Elem + HElems.xOffset, X);
  201.                     PS3.Extension.WriteFloat(Elem + HElems.yOffset, Y);
  202.                     return Elem;
  203.                 }
  204.                 public static void ChangeFontScaleOverTime(uint elemIndex, short Time, double OldFont, double NewFont)
  205.                 {
  206.                     uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
  207.                     PS3.Extension.WriteFloat(Elem + HElems.fromFontScale, (float)OldFont);//fromFontScale
  208.                     PS3.Extension.WriteUInt32(Elem + HElems.fontScaleStartTime, (UInt32)getLevelTime());//fontScaleStartTime
  209.                     PS3.Extension.WriteInt32(Elem + HElems.fontScaleTime, Time);//fontScaleTime
  210.                     PS3.Extension.WriteFloat(Elem + HElems.fontScale, (float)NewFont);
  211.                 }
  212.                 public static void ScaleOverTime(uint elemIndex, short Time, short Width, short Height)
  213.                 {
  214.                     uint Elem = HElems.ELEM + (elemIndex) * 0xB8;
  215.                     PS3.Extension.WriteInt32(Elem + HElems.fromHeight, PS3.Extension.ReadInt16(Elem + HElems.height));//From Height
  216.                     PS3.Extension.WriteInt32(Elem + HElems.fromWidth, PS3.Extension.ReadInt16(Elem + HElems.width));//from Width
  217.                     PS3.Extension.WriteInt32(Elem + HElems.scaleTime, Time);
  218.                     PS3.Extension.WriteInt32(Elem + HElems.scaleStartTime, getLevelTime());//MoveStartTime
  219.                     PS3.Extension.WriteInt16(Elem + HElems.height, Height);
  220.                     PS3.Extension.WriteInt16(Elem + HElems.width, Width);
  221.                 }
  222.                 public static void FadeOverTime(uint elem, short Time, int R, int G, int B, int A)
  223.                 {
  224.                     uint Elem = HElems.ELEM + (elem) * 0xB8;
  225.                     byte[] RVal = GetMemory(Elem + HElems.color, 1);//Gets Current RVal
  226.                     byte[] GVal = GetMemory(Elem + HElems.color + 0x01, 1);//Gets Current GVal
  227.                     byte[] BVal = GetMemory(Elem + HElems.color + 0x02, 1);//Gets Current BVal
  228.                     byte[] AVal = GetMemory(Elem + HElems.color + 0x03, 1);//Gets Current AVal
  229.                     PS3.SetMemory(Elem + HElems.fromColor, RVal);//Sets Current RVal
  230.                     PS3.SetMemory(Elem + HElems.fromColor + 0x01, GVal);//Sets Current GVal
  231.                     PS3.SetMemory(Elem + HElems.fromColor + 0x02, BVal);//Sets Current BVal
  232.                     PS3.SetMemory(Elem + HElems.fromColor + 0x03, AVal);//Sets Current AVal
  233.                     PS3.Extension.WriteUInt32(Elem + HElems.fadeStartTime, (UInt32)getLevelTime());
  234.                     PS3.Extension.WriteInt32(Elem + HElems.fadeTime, Time);//Fade Time
  235.                     PS3.SetMemory(Elem + HElems.color, RGBA(R, G, B, A));//Set New Colors
  236.                 }
  237.                 public static byte[] UInt32ToBytes(uint input)
  238.                 {
  239.                     byte[] bytes = BitConverter.GetBytes(input);
  240.                     Array.Reverse(bytes);
  241.                     return bytes;
  242.                 }
  243.  
  244.                 public static byte[] ReverseBytes(byte[] inArray)
  245.                 {
  246.                     Array.Reverse(inArray);
  247.                     return inArray;
  248.                 }
  249.                 public static byte[] uintBytes(uint input)
  250.                 {
  251.                     byte[] data = BitConverter.GetBytes(input);
  252.                     Array.Reverse(data);
  253.                     return data;
  254.                 }
  255.                 #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement