Advertisement
PrimeNotorious

[1.18] Hud Elements

May 25th, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 6.19 KB | None | 0 0
  1. public class Offsets
  2.     {
  3.         public static uint
  4.         FPS = 0x3979EC,
  5.         G_LocalizedStringIndex = 0x275D24,
  6.         G_HudElems = 0x15DDB00,
  7.         HudelemSize = 0x88,
  8.         G_MaterialIndex = 0x276020;
  9.     }
  10.  
  11. public class HudElements
  12. {
  13. public class HElems
  14.         {
  15.             public static uint ElemIndex = Offsets.G_HudElems;
  16.             public static uint HudsLength = 0x88;
  17.             public static uint abilityFlag = 0x84;
  18.             public static uint alignOrg = 0x72;
  19.             public static uint alignScreen = 0x73;
  20.             public static uint color = 0x18;
  21.             public static uint duration = 0x38;
  22.             public static uint fadeStartTime = 0x20;
  23.             public static uint fadeTime = 0x54;
  24.             public static uint flag2 = 0x7A;
  25.             public static uint flags = 0x4C;
  26.             public static uint Font = 0x70;
  27.             public static uint FontSize = 0xC;
  28.             public static uint fontScaleStartTime = 0x14;
  29.             public static uint fontScaleTime = 0x52;
  30.             public static uint fromAlignOrg = 0x76;
  31.             public static uint fromAlignScreen = 0x77;
  32.             public static uint fromColor = 0x1C;
  33.             public static uint fromFontScale = 0x10;
  34.             public static uint fromHeight = 0x5e;
  35.             public static uint fromWidth = 0x5c;
  36.             public static uint fromX = 0x28;
  37.             public static uint fromY = 0x2C;
  38.             public static uint fxBirthTime = 0x48;
  39.             public static uint fxDecayDuration = 0x6A;
  40.             public static uint fxDecayStartTime = 0x68;
  41.             public static uint fxLetterTime = 0x66;
  42.             public static uint fxRedactDecayDuration = 110;
  43.             public static uint fxRedactDecayStartTime = 0x6c;
  44.             public static uint glowColor = 0x44;
  45.             public static uint Height = 0x5A;
  46.             public static uint label = 0x56;
  47.             public static uint materialIndex = 0x71;
  48.             public static uint moveStartTime = 0x30;
  49.             public static uint moveTime = 0x62;
  50.             public static uint offscreenMaterialIdx = 0x75;
  51.             public static uint clientOffset = 0x7c;
  52.             public static uint scaleStartTime = 0x24;
  53.             public static uint scaleTime = 0x60;
  54.             public static uint sort = 0x40;
  55.             public static uint soundID = 0x78;
  56.             public static uint targetEntNum = 80;
  57.             public static uint team = 0x80;
  58.             public static uint text = 0x62;
  59.             public static uint time = 0x34;
  60.             public static uint type = 0x6D;
  61.             public static uint ui3dWindow = 0x4f;
  62.             public static uint value = 60;
  63.             public static uint Width = 0x58;
  64.             public static uint X = 0x00;
  65.             public static uint Y = 0x04;
  66.             public static uint Z = 0x08;
  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. private static uint HudElem_Alloc()
  82.         {
  83.             for (int i = 30; i < 0x400; i++)
  84.             {
  85.                 uint offset = Offsets.G_HudElems + (uint)(i) * 0x88;
  86.                 if (PS3.Extension.ReadInt16(offset + 0x70) == 0)
  87.                 {
  88.                     PS3.SetMemory(offset, new byte[0x88]);
  89.                     return offset;
  90.                 }
  91.             }
  92.             return 0;
  93.         }
  94.  
  95. public static uint SetShader(int clientIndex, object Material, short width, short height, float x, float y, int r = 255, int g = 255, int b = 255, int a = 255)
  96.         {
  97.             uint elem = HudElem_Alloc();
  98.             PS3.Extension.WriteInt32(elem + HElems.type, 8);//8 = Icon
  99.             PS3.Extension.WriteInt32(elem + HElems.materialIndex, (int)Material);
  100.             PS3.Extension.WriteInt16(elem + HElems.Height, height);
  101.             PS3.Extension.WriteInt16(elem + HElems.Width, width);
  102.             PS3.Extension.WriteFloat(elem + HElems.X, x);
  103.             PS3.Extension.WriteFloat(elem + HElems.Y, y);
  104.             PS3.Extension.WriteInt32(elem + HElems.clientOffset, clientIndex);
  105.             PS3.SetMemory(elem + 0x79, new byte[] { 0xFF });
  106.             PS3.SetMemory(elem + HElems.color, RGBA(r, g, b, a));
  107.             return elem;
  108.         }
  109. public static Int16 G_LocalizedStringIndex(string txt)
  110. {
  111.     return (Int16)RPC.Call(Offsets.G_LocalizedStringIndex, txt);
  112. }
  113. public static uint SetText(int clientIndex, string Text, short Font, double FontSize, float x, float y, int r = 255, int g = 255, int b = 255, int a = 255, int glowr = 255, int glowg = 255, int glowb = 255, int glowa = 0)
  114.         {
  115.             uint elem = HudElem_Alloc();
  116.             PS3.Extension.WriteInt32(elem + HElems.type, 1);//1 = Text
  117.             PS3.Extension.WriteFloat(elem + HElems.FontSize, (float)FontSize);
  118.             PS3.Extension.WriteInt16(elem + HElems.Font, Font);
  119.             PS3.Extension.WriteFloat(elem + HElems.X, x);
  120.             PS3.Extension.WriteFloat(elem + HElems.Y, y);
  121.             PS3.Extension.WriteInt32(elem + HElems.clientOffset, clientIndex);
  122.             PS3.Extension.WriteInt16(elem + HElems.text, G_LocalizedStringIndex(Text));
  123.             PS3.SetMemory(elem + HElems.color, RGBA(r, g, b, a));
  124.             PS3.SetMemory(elem + HElems.glowColor, RGBA(glowr, glowg, glowb, glowa));
  125.             PS3.SetMemory(elem + 0x79, new byte[] { 0xFF });
  126.             PS3.SetMemory(elem + HElems.Font, new byte[] { 0x01 });
  127.             return elem;
  128.         }
  129. public static int precacheShader(string Shader)
  130.         {
  131.             PS3.Extension.WriteInt32(0x1608100 + 0x40, 1);
  132.             return RPC.Call(0x276020, Shader);
  133.         }
  134.  
  135. public static void DestroyElement(uint Element)
  136.         {
  137.             PS3.SetMemory(Element, new byte[HElems.HudsLength]);
  138.         }
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement